| # Copyright 2016 The Chromium Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| # This file is a clean copy of Chromium's third_party/libFuzzer/BUILD.gn |
| |
| import("///build/config/sanitizers/sanitizers.gni") |
| |
| config("warnings") { |
| if (is_clang) { |
| cflags = [ |
| "-Wno-shadow", |
| |
| # See crbug.com/932188, libFuzzer does not check the result of write() |
| # when it does raw printing. |
| "-Wno-unused-result", |
| ] |
| } |
| } |
| |
| # Depend on this if you wish to use LLVMFuzzerRunDriver from within |
| # some existing code |
| source_set("libfuzzer") { |
| sources = [ |
| "src/FuzzerCrossOver.cpp", |
| "src/FuzzerDataFlowTrace.cpp", |
| "src/FuzzerDriver.cpp", |
| "src/FuzzerExtFunctionsDlsym.cpp", |
| "src/FuzzerExtFunctionsWeak.cpp", |
| "src/FuzzerExtFunctionsWindows.cpp", |
| "src/FuzzerExtraCounters.cpp", |
| "src/FuzzerExtraCountersDarwin.cpp", |
| "src/FuzzerExtraCountersWindows.cpp", |
| "src/FuzzerFork.cpp", |
| "src/FuzzerIO.cpp", |
| "src/FuzzerIOPosix.cpp", |
| "src/FuzzerIOWindows.cpp", |
| "src/FuzzerLoop.cpp", |
| "src/FuzzerMerge.cpp", |
| "src/FuzzerMutate.cpp", |
| "src/FuzzerSHA1.cpp", |
| "src/FuzzerTracePC.cpp", |
| "src/FuzzerUtil.cpp", |
| "src/FuzzerUtilDarwin.cpp", |
| "src/FuzzerUtilFuchsia.cpp", |
| "src/FuzzerUtilLinux.cpp", |
| "src/FuzzerUtilPosix.cpp", |
| "src/FuzzerUtilWindows.cpp", |
| ] |
| if (!using_sanitizer) { |
| sources += [ "src/FuzzerInterceptors.cpp" ] |
| } |
| |
| configs -= fuzzing_engine_remove_configs |
| configs += fuzzing_engine_add_configs |
| configs += [ ":warnings" ] |
| |
| deps = [] |
| if (is_fuchsia) { |
| deps += [ "//third_party/fuchsia-sdk/sdk:fdio" ] |
| } |
| } |
| |
| # Depend on this if you wish for libfuzzer to provide the main() |
| # function for your target. |
| source_set("libfuzzer_main") { |
| deps = [ ":libfuzzer" ] |
| configs -= fuzzing_engine_remove_configs |
| configs += fuzzing_engine_add_configs |
| sources = [] |
| if (!is_ios) { |
| sources += [ "src/FuzzerMain.cpp" ] |
| } |
| } |
| |
| if (use_afl) { |
| source_set("afl_driver") { |
| sources = [ "src/afl/afl_driver.cpp" ] |
| |
| configs -= fuzzing_engine_remove_configs |
| configs += fuzzing_engine_add_configs |
| configs += [ ":warnings" ] |
| } |
| } |