summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraizatsky <aizatsky@chromium.org>2016-03-25 15:37:16 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-25 22:39:10 +0000
commite9aba58f6cbfee6fec2af0ec4832a3c23ec66b9f (patch)
tree33150b351b168f8e47f0943c323c0c725aec217b
parenta828668c94c68c08ed6f5838baacef475d842910 (diff)
downloadchromium_src-e9aba58f6cbfee6fec2af0ec4832a3c23ec66b9f.zip
chromium_src-e9aba58f6cbfee6fec2af0ec4832a3c23ec66b9f.tar.gz
chromium_src-e9aba58f6cbfee6fec2af0ec4832a3c23ec66b9f.tar.bz2
Experimental support for fuzzing on mac.
BUG=597066 Review URL: https://codereview.chromium.org/1818273002 Cr-Commit-Position: refs/heads/master@{#383389}
-rw-r--r--BUILD.gn9
-rw-r--r--build/config/sanitizers/BUILD.gn25
-rw-r--r--build/config/sanitizers/sanitizers.gni4
-rw-r--r--testing/libfuzzer/BUILD.gn10
-rw-r--r--testing/libfuzzer/fuzzer_test.gni1
5 files changed, 44 insertions, 5 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 38268fb..35133fd 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -644,8 +644,6 @@ group("gn_only") {
"//media/cast:udp_proxy",
"//native_client/src/trusted/debug_stub:gdb_rsp_unittest",
"//storage/browser:dump_file_system",
- "//testing/libfuzzer/fuzzers",
- "//testing/libfuzzer/tests:libfuzzer_tests",
"//third_party/angle:libANGLE",
"//third_party/angle:libEGL",
"//third_party/angle:libGLESv2",
@@ -713,6 +711,13 @@ group("gn_only") {
}
}
+ if ((is_linux && !is_chromeos && !is_chromecast) || is_mac) {
+ deps += [
+ "//testing/libfuzzer/fuzzers",
+ "//testing/libfuzzer/tests:libfuzzer_tests",
+ ]
+ }
+
if (enable_nacl) {
deps += [ "//native_client_sdk/src:nacl_core_sdk" ]
}
diff --git a/build/config/sanitizers/BUILD.gn b/build/config/sanitizers/BUILD.gn
index 48a8d45..2580a15 100644
--- a/build/config/sanitizers/BUILD.gn
+++ b/build/config/sanitizers/BUILD.gn
@@ -28,12 +28,17 @@ group("deps") {
}
if (use_custom_libcxx) {
deps += [ "//buildtools/third_party/libc++:libcxx_proxy" ]
+ if (is_mac) {
+ deps += [ ":copy_libclang_rt_dyn" ]
+ }
}
}
}
config("sanitizer_options_link_helper") {
- ldflags = [ "-Wl,-u_sanitizer_options_link_helper" ]
+ if (!is_mac) {
+ ldflags = [ "-Wl,-u_sanitizer_options_link_helper" ]
+ }
}
source_set("options_sources") {
@@ -292,6 +297,10 @@ config("default_sanitizer_flags") {
]
}
}
+
+ if (is_mac && is_asan) {
+ libs = [ "clang_rt.asan_osx_dynamic" ]
+ }
}
config("default_sanitizer_coverage_flags") {
@@ -306,3 +315,17 @@ config("default_sanitizer_coverage_flags") {
]
}
}
+
+# Copy dynamic clang_rt sanitizer libraries to output directory.
+if (is_mac) {
+ copy("copy_libclang_rt_dyn") {
+ sources = [
+ "//third_party/llvm-build/Release+Asserts/compiler-rt/lib/darwin/libclang_rt.asan_osx_dynamic.dylib",
+ "//third_party/llvm-build/Release+Asserts/compiler-rt/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib",
+ "//third_party/llvm-build/Release+Asserts/compiler-rt/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib",
+ ]
+ outputs = [
+ "$root_build_dir/{{source_file_part}}",
+ ]
+ }
+}
diff --git a/build/config/sanitizers/sanitizers.gni b/build/config/sanitizers/sanitizers.gni
index c467db2..2d6fb1e 100644
--- a/build/config/sanitizers/sanitizers.gni
+++ b/build/config/sanitizers/sanitizers.gni
@@ -69,8 +69,8 @@ declare_args() {
# Use libc++ (buildtools/third_party/libc++ and
# buildtools/third_party/libc++abi) instead of stdlibc++ as standard library.
# This is intended to be used for instrumented builds.
- use_custom_libcxx =
- (is_asan && is_linux) || is_tsan || is_msan || is_ubsan || use_libfuzzer
+ use_custom_libcxx = (is_asan && (is_linux || is_mac)) || is_tsan || is_msan ||
+ is_ubsan || use_libfuzzer
# Enable Link Time Optimization (output programs runs faster,
# but linking is up to 5-20x slower.
diff --git a/testing/libfuzzer/BUILD.gn b/testing/libfuzzer/BUILD.gn
index 2063f92..1ac14ecc 100644
--- a/testing/libfuzzer/BUILD.gn
+++ b/testing/libfuzzer/BUILD.gn
@@ -37,6 +37,16 @@ static_library("libfuzzer_main") {
}
}
+# A config used by all fuzzer_tests.
+config("fuzzer_test_config") {
+ if (use_libfuzzer && is_mac) {
+ ldflags = [
+ "-Wl,-U,_LLVMFuzzerCustomMutator",
+ "-Wl,-U,_LLVMFuzzerInitialize",
+ ]
+ }
+}
+
# Noop config used to tag fuzzer tests excluded from clusterfuzz.
# Libfuzzer build bot uses this to filter out targets while
# building an archive for clusterfuzz.
diff --git a/testing/libfuzzer/fuzzer_test.gni b/testing/libfuzzer/fuzzer_test.gni
index 266016c..258cff4 100644
--- a/testing/libfuzzer/fuzzer_test.gni
+++ b/testing/libfuzzer/fuzzer_test.gni
@@ -127,6 +127,7 @@ template("fuzzer_test") {
if (defined(invoker.additional_configs)) {
configs += invoker.additional_configs
}
+ configs += [ "//testing/libfuzzer:fuzzer_test_config" ]
}
} else {
# noop on unsupported platforms.