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() {