From e9aba58f6cbfee6fec2af0ec4832a3c23ec66b9f Mon Sep 17 00:00:00 2001 From: aizatsky Date: Fri, 25 Mar 2016 15:37:16 -0700 Subject: Experimental support for fuzzing on mac. BUG=597066 Review URL: https://codereview.chromium.org/1818273002 Cr-Commit-Position: refs/heads/master@{#383389} --- build/config/sanitizers/BUILD.gn | 25 ++++++++++++++++++++++++- build/config/sanitizers/sanitizers.gni | 4 ++-- 2 files changed, 26 insertions(+), 3 deletions(-) (limited to 'build') 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. -- cgit v1.1