blob: 3e39647c9161020413ee532ec30c6e47a6e24c7d [file] [log] [blame]
# Copyright 2023 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 partial translation of
# //third_party/centipede/src/centipede/BUILD
# into BUILD.gn format, so we can get started
# playing with centipede. We will need to convert the
# whole file in due course.
import("//build/config/sanitizers/sanitizers.gni")
source_set("centipede_common") {
sources = [
"src/centipede/binary_info.cc",
"src/centipede/binary_info.h",
"src/centipede/byte_array_mutator.cc",
"src/centipede/byte_array_mutator.h",
"src/centipede/defs.h",
"src/centipede/execution_metadata.cc",
"src/centipede/execution_metadata.h",
"src/centipede/feature.cc",
"src/centipede/feature.h",
"src/centipede/knobs.cc",
"src/centipede/knobs.h",
"src/centipede/reverse_pc_table.h",
"src/centipede/runner_cmp_trace.h",
"src/centipede/runner_request.cc",
"src/centipede/runner_request.h",
"src/centipede/runner_result.cc",
"src/centipede/runner_result.h",
"src/centipede/shared_memory_blob_sequence.cc",
"src/centipede/shared_memory_blob_sequence.h",
]
deps = [
"//third_party/abseil-cpp:absl",
"//third_party/abseil-cpp/absl/log:check",
"//third_party/abseil-cpp/absl/log:log",
]
configs += [ ":centipede_internal_config" ]
configs -= fuzzing_engine_remove_configs
configs += fuzzing_engine_add_configs
}
source_set("centipede_runner_no_main") {
sources = [
"src/centipede/runner.cc",
"src/centipede/runner.h",
"src/centipede/runner_dl_info.cc",
"src/centipede/runner_dl_info.h",
"src/centipede/runner_fork_server.cc",
"src/centipede/runner_interceptors.cc",
"src/centipede/runner_interface.h",
"src/centipede/runner_sancov.cc",
"src/centipede/runner_sancov_object.cc",
"src/centipede/runner_sancov_object.h",
"src/centipede/runner_sanitizer.cc",
"src/centipede/runner_utils.cc",
"src/centipede/runner_utils.h",
]
deps = [
":centipede_common",
"//third_party/abseil-cpp:absl",
]
configs += [ ":centipede_internal_config" ]
configs -= fuzzing_engine_remove_configs
configs += fuzzing_engine_add_configs
# sancov symbols need to be exported for centipede to work correctly with
# multi-dso.
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
configs += [ "//build/config/gcc:symbol_visibility_default" ]
}
config("centipede_internal_config") {
cflags = [
"-Wno-sign-compare", # https://github.com/google/centipede/issues/487,
"-Wno-unused-private-field",
"-Wno-unreachable-code-return",
"-Wno-unused-but-set-variable",
]
# int_utils.h depends on an SSE 4.2 intrinsic.
if (current_cpu == "x64") {
cflags += [ "-msse4.2" ]
}
include_dirs = [ "src" ]
}
source_set("centipede_runner_main") {
deps = [
":centipede_runner_no_main",
"//third_party/abseil-cpp:absl",
]
configs += [ ":centipede_internal_config" ]
sources = [ "src/centipede/runner_main.cc" ]
}
source_set("centipede_weak_sancov_stubs") {
sources = [ "src/centipede/weak_sancov_stubs.cc" ]
}
source_set("fuzztest_internal") {
sources = [
"src/fuzztest/internal/coverage.cc",
"src/fuzztest/internal/coverage.h",
"src/fuzztest/internal/logging.cc",
"src/fuzztest/internal/logging.h",
"src/fuzztest/internal/type_support.cc",
"src/fuzztest/internal/type_support.h",
]
configs -= fuzzing_engine_remove_configs
configs += fuzzing_engine_add_configs
include_dirs = [ "src" ]
deps = [ "//third_party/abseil-cpp:absl" ]
}
executable("centipede") {
configs += [ ":centipede_internal_config" ]
configs -= fuzzing_engine_remove_configs
configs += fuzzing_engine_add_configs
include_dirs = [ "src" ]
deps = [
":centipede_common",
":fuzztest_internal",
# Depend on fuzzing_engine_no_main so that we are automatically built in builds
# destined for ClusterFuzz.
"//testing/libfuzzer:fuzzing_engine",
"//third_party/abseil-cpp:absl",
"//third_party/abseil-cpp/absl/flags:config",
"//third_party/abseil-cpp/absl/flags:flag",
"//third_party/abseil-cpp/absl/flags:parse",
"//third_party/abseil-cpp/absl/flags:reflection",
"//third_party/abseil-cpp/absl/log",
"//third_party/abseil-cpp/absl/log:check",
"//third_party/abseil-cpp/absl/log:globals",
"//third_party/abseil-cpp/absl/log:initialize",
"//third_party/boringssl",
]
sources = [
"src/centipede/analyze_corpora.cc",
"src/centipede/blob_file.cc",
"src/centipede/call_graph.cc",
"src/centipede/centipede.cc",
"src/centipede/centipede_callbacks.cc",
"src/centipede/centipede_default_callbacks.cc",
"src/centipede/centipede_interface.cc",
"src/centipede/centipede_main.cc",
"src/centipede/command.cc",
"src/centipede/config_file.cc",
"src/centipede/config_init.cc",
"src/centipede/config_util.cc",
"src/centipede/control_flow.cc",
"src/centipede/corpus.cc",
"src/centipede/coverage.cc",
"src/centipede/distill.cc",
"src/centipede/distill.h",
"src/centipede/environment.cc",
"src/centipede/feature_set.cc",
"src/centipede/feature_set.h",
"src/centipede/fuzztest_mutator.cc",
"src/centipede/fuzztest_mutator.h",
"src/centipede/hash.cc",
"src/centipede/logging.cc",
"src/centipede/logging.h",
"src/centipede/minimize_crash.cc",
"src/centipede/remote_file.cc",
"src/centipede/rusage_profiler.cc",
"src/centipede/rusage_stats.cc",
"src/centipede/shard_reader.cc",
"src/centipede/stats.cc",
"src/centipede/symbol_table.cc",
"src/centipede/util.cc",
]
}