• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("///build/config/sanitizers/sanitizers.gni")
15
16fuzzing_engine_remove_configs = [
17  "//build/config/coverage:default_coverage",
18  "//build/config/sanitizers:default_sanitizer_flags",
19]
20
21fuzzing_engine_add_configs =
22    [ "//build/config/sanitizers:default_sanitizer_flags_but_coverage" ]
23
24source_set("libfuzzer") {
25  sources = [
26    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerCrossOver.cpp",
27    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerDataFlowTrace.cpp",
28    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp",
29    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerExtFunctionsDlsym.cpp",
30    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerExtFunctionsWeak.cpp",
31    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerExtFunctionsWindows.cpp",
32    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerExtraCounters.cpp",
33    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerFork.cpp",
34    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerIO.cpp",
35    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerIOPosix.cpp",
36    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerIOWindows.cpp",
37    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp",
38    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp",
39    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerMerge.cpp",
40    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerMutate.cpp",
41    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerSHA1.cpp",
42    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp",
43    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerUtil.cpp",
44    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerUtilDarwin.cpp",
45    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp",
46    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerUtilLinux.cpp",
47    "//third_party/llvm-project/compiler-rt/lib/fuzzer/FuzzerUtilPosix.cpp",
48  ]
49
50  configs -= fuzzing_engine_remove_configs
51  configs += fuzzing_engine_add_configs
52}
53
54if (use_afl) {
55  source_set("afl_driver") {
56    sources = [ "src/afl/afl_driver.cpp" ]
57
58    configs -= fuzzing_engine_remove_configs
59    configs += fuzzing_engine_add_configs
60  }
61}
62