Chromium Code Reviews| Index: build/config/sanitizers/BUILD.gn |
| diff --git a/build/config/sanitizers/BUILD.gn b/build/config/sanitizers/BUILD.gn |
| index 73bafa9891c858cab0a14a595a32cf9ebf99784a..3a48fa936326678ef8aa35857fbd181bc0e9497f 100644 |
| --- a/build/config/sanitizers/BUILD.gn |
| +++ b/build/config/sanitizers/BUILD.gn |
| @@ -9,6 +9,10 @@ import("//build/config/clang/clang.gni") |
| import("//build/config/sanitizers/sanitizers.gni") |
| import("//build/toolchain/toolchain.gni") |
| +if (is_ios) { |
| + import("//build/config/ios/ios_sdk.gni") |
| +} |
| + |
| # Contains the dependencies needed for sanitizers to link into executables and |
| # shared_libraries. Unconditionally depend upon this target as it is empty if |
| # |is_asan|, |is_lsan|, |is_tsan|, |is_msan| and |use_custom_libcxx| are false. |
| @@ -72,30 +76,56 @@ group("deps_no_options") { |
| ":copy_asan_runtime", |
| ] |
| } |
| - if (is_mac) { |
| + if (is_mac || (is_ios && !use_xcode_clang)) { |
|
Dirk Pranke
2016/09/27 17:54:44
Can we use the sanitizers w/ xcode_clang at all? M
sdefresne
2016/09/28 14:01:46
Yes we can use asan and clang Xcode as the version
Dirk Pranke
2016/09/28 16:24:37
Okay. Well, given that xcode clang isn't our first
|
| public_deps += [ ":asan_runtime_bundle_data" ] |
| } |
| } |
| } |
| -if ((is_mac || is_win) && using_sanitizer) { |
| - copy("copy_asan_runtime") { |
| - if (is_mac) { |
| - clang_rt_dso_path = "darwin/libclang_rt.asan_osx_dynamic.dylib" |
| - } else if (is_win && target_cpu == "x86") { |
| - clang_rt_dso_path = "windows/clang_rt.asan_dynamic-i386.dll" |
| - } else if (is_win && target_cpu == "x64") { |
| - clang_rt_dso_path = "windows/clang_rt.asan_dynamic-x86_64.dll" |
| +if ((is_mac || is_win || (is_ios && !use_xcode_clang)) && using_sanitizer) { |
| + if (is_mac) { |
| + _clang_rt_dso_path = "darwin/libclang_rt.asan_osx_dynamic.dylib" |
| + } else if (is_ios) { |
| + _clang_rt_dso_path = "darwin/libclang_rt.asan_iossim_dynamic.dylib" |
| + } else if (is_win && target_cpu == "x86") { |
| + _clang_rt_dso_path = "windows/clang_rt.asan_dynamic-i386.dll" |
| + } else if (is_win && target_cpu == "x64") { |
| + _clang_rt_dso_path = "windows/clang_rt.asan_dynamic-x86_64.dll" |
| + } |
| + |
| + _clang_rt_dso_full_path = |
| + "$clang_base_path/lib/clang/$clang_version/lib/$_clang_rt_dso_path" |
| + |
| + if (!is_ios) { |
| + copy("copy_asan_runtime") { |
| + sources = [ |
| + _clang_rt_dso_full_path, |
| + ] |
| + outputs = [ |
| + "$root_out_dir/{{source_file_part}}", |
| + ] |
| + } |
| + } else { |
| + # On iOS, the runtime library need to be code signed (adhoc signature) |
| + # starting with Xcode 8, so use an action instead of a copy on iOS. |
| + action("copy_asan_runtime") { |
|
justincohen
2016/09/27 18:08:23
copy_and_sign_asan_runtime?
sdefresne
2016/09/28 14:01:46
That would make the BUILD file unnecessarily compl
|
| + script = "//build/config/ios/codesign.py" |
| + sources = [ |
| + _clang_rt_dso_full_path, |
| + ] |
| + outputs = [ |
| + "$root_out_dir/" + get_path_info(sources[0], "file"), |
| + ] |
| + args = [ |
| + "code-sign-file", |
| + "--identity=" + ios_code_signing_identity, |
| + "--output=" + rebase_path(outputs[0], root_build_dir), |
| + rebase_path(sources[0], root_build_dir), |
| + ] |
| } |
| - sources = [ |
| - "$clang_base_path/lib/clang/$clang_version/lib/$clang_rt_dso_path", |
| - ] |
| - outputs = [ |
| - "$root_out_dir/{{source_file_part}}", |
| - ] |
| } |
| - if (is_mac) { |
| + if (is_mac || is_ios) { |
| bundle_data("asan_runtime_bundle_data") { |
| sources = get_target_outputs(":copy_asan_runtime") |
| outputs = [ |
| @@ -109,7 +139,7 @@ if ((is_mac || is_win) && using_sanitizer) { |
| } |
| config("sanitizer_options_link_helper") { |
| - if (is_mac) { |
| + if (is_mac || is_ios) { |
| ldflags = [ "-Wl,-U,_sanitizer_options_link_helper" ] |
| } else if (!is_win) { |
| ldflags = [ "-Wl,-u_sanitizer_options_link_helper" ] |