From 598354d16cc45221c7517e18ca30b55140f54079 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 18 Nov 2021 08:40:49 -0500 Subject: [PATCH] Add a libfuzzer config to the build system. (#11921) --- build/config/compiler/BUILD.gn | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index d26edebaf3a929..81fb08caa8afdb 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -304,6 +304,9 @@ declare_args() { # enable undefined behavior sanitizer is_ubsan = false + # enable libfuzzer + is_libfuzzer = false + # Exit on sanitize error. Generally standard libraries may get errors # so not stopping on the first error is often useful is_sanitize_fatal = true @@ -374,7 +377,16 @@ config("sanitize_default") { } } +config("libfuzzer_fuzzing") { + cflags = [ "-fsanitize=fuzzer" ] + ldflags = cflags +} + config("fuzzing_default") { + configs = [] + if (is_libfuzzer) { + configs += [ ":libfuzzer_fuzzing" ] + } } declare_args() {