Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: build/config/sanitizers/BUILD.gn

Issue 2363953004: Ensure the sanitizer runtime library is copied to app bundle if enabled. (Closed)
Patch Set: Improve CL. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« build/config/ios/codesign.py ('K') | « build/config/ios/rules.gni ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import("//build_overrides/build.gni") 5 import("//build_overrides/build.gni")
6 import("//build/config/chrome_build.gni") 6 import("//build/config/chrome_build.gni")
7 import("//build/config/chromecast_build.gni") 7 import("//build/config/chromecast_build.gni")
8 import("//build/config/clang/clang.gni") 8 import("//build/config/clang/clang.gni")
9 import("//build/config/sanitizers/sanitizers.gni") 9 import("//build/config/sanitizers/sanitizers.gni")
10 import("//build/toolchain/toolchain.gni") 10 import("//build/toolchain/toolchain.gni")
11 11
12 if (is_ios) {
13 import("//build/config/ios/ios_sdk.gni")
14 }
15
12 # Contains the dependencies needed for sanitizers to link into executables and 16 # Contains the dependencies needed for sanitizers to link into executables and
13 # shared_libraries. Unconditionally depend upon this target as it is empty if 17 # shared_libraries. Unconditionally depend upon this target as it is empty if
14 # |is_asan|, |is_lsan|, |is_tsan|, |is_msan| and |use_custom_libcxx| are false. 18 # |is_asan|, |is_lsan|, |is_tsan|, |is_msan| and |use_custom_libcxx| are false.
15 group("deps") { 19 group("deps") {
16 public_deps = [ 20 public_deps = [
17 ":deps_no_options", 21 ":deps_no_options",
18 ] 22 ]
19 if (using_sanitizer) { 23 if (using_sanitizer) {
20 public_configs = [ 24 public_configs = [
21 ":sanitizer_options_link_helper", 25 ":sanitizer_options_link_helper",
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 69 }
66 if (use_custom_libcxx) { 70 if (use_custom_libcxx) {
67 public_deps += [ "//buildtools/third_party/libc++:libcxx_proxy" ] 71 public_deps += [ "//buildtools/third_party/libc++:libcxx_proxy" ]
68 data += [ "$root_out_dir/libc++.so" ] 72 data += [ "$root_out_dir/libc++.so" ]
69 } 73 }
70 if (is_mac || is_win) { 74 if (is_mac || is_win) {
71 data_deps = [ 75 data_deps = [
72 ":copy_asan_runtime", 76 ":copy_asan_runtime",
73 ] 77 ]
74 } 78 }
75 if (is_mac) { 79 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
76 public_deps += [ ":asan_runtime_bundle_data" ] 80 public_deps += [ ":asan_runtime_bundle_data" ]
77 } 81 }
78 } 82 }
79 } 83 }
80 84
81 if ((is_mac || is_win) && using_sanitizer) { 85 if ((is_mac || is_win || (is_ios && !use_xcode_clang)) && using_sanitizer) {
82 copy("copy_asan_runtime") { 86 if (is_mac) {
83 if (is_mac) { 87 _clang_rt_dso_path = "darwin/libclang_rt.asan_osx_dynamic.dylib"
84 clang_rt_dso_path = "darwin/libclang_rt.asan_osx_dynamic.dylib" 88 } else if (is_ios) {
85 } else if (is_win && target_cpu == "x86") { 89 _clang_rt_dso_path = "darwin/libclang_rt.asan_iossim_dynamic.dylib"
86 clang_rt_dso_path = "windows/clang_rt.asan_dynamic-i386.dll" 90 } else if (is_win && target_cpu == "x86") {
87 } else if (is_win && target_cpu == "x64") { 91 _clang_rt_dso_path = "windows/clang_rt.asan_dynamic-i386.dll"
88 clang_rt_dso_path = "windows/clang_rt.asan_dynamic-x86_64.dll" 92 } else if (is_win && target_cpu == "x64") {
89 } 93 _clang_rt_dso_path = "windows/clang_rt.asan_dynamic-x86_64.dll"
90 sources = [
91 "$clang_base_path/lib/clang/$clang_version/lib/$clang_rt_dso_path",
92 ]
93 outputs = [
94 "$root_out_dir/{{source_file_part}}",
95 ]
96 } 94 }
97 95
98 if (is_mac) { 96 _clang_rt_dso_full_path =
97 "$clang_base_path/lib/clang/$clang_version/lib/$_clang_rt_dso_path"
98
99 if (!is_ios) {
100 copy("copy_asan_runtime") {
101 sources = [
102 _clang_rt_dso_full_path,
103 ]
104 outputs = [
105 "$root_out_dir/{{source_file_part}}",
106 ]
107 }
108 } else {
109 # On iOS, the runtime library need to be code signed (adhoc signature)
110 # starting with Xcode 8, so use an action instead of a copy on iOS.
111 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
112 script = "//build/config/ios/codesign.py"
113 sources = [
114 _clang_rt_dso_full_path,
115 ]
116 outputs = [
117 "$root_out_dir/" + get_path_info(sources[0], "file"),
118 ]
119 args = [
120 "code-sign-file",
121 "--identity=" + ios_code_signing_identity,
122 "--output=" + rebase_path(outputs[0], root_build_dir),
123 rebase_path(sources[0], root_build_dir),
124 ]
125 }
126 }
127
128 if (is_mac || is_ios) {
99 bundle_data("asan_runtime_bundle_data") { 129 bundle_data("asan_runtime_bundle_data") {
100 sources = get_target_outputs(":copy_asan_runtime") 130 sources = get_target_outputs(":copy_asan_runtime")
101 outputs = [ 131 outputs = [
102 "{{bundle_executable_dir}}/{{source_file_part}}", 132 "{{bundle_executable_dir}}/{{source_file_part}}",
103 ] 133 ]
104 public_deps = [ 134 public_deps = [
105 ":copy_asan_runtime", 135 ":copy_asan_runtime",
106 ] 136 ]
107 } 137 }
108 } 138 }
109 } 139 }
110 140
111 config("sanitizer_options_link_helper") { 141 config("sanitizer_options_link_helper") {
112 if (is_mac) { 142 if (is_mac || is_ios) {
113 ldflags = [ "-Wl,-U,_sanitizer_options_link_helper" ] 143 ldflags = [ "-Wl,-U,_sanitizer_options_link_helper" ]
114 } else if (!is_win) { 144 } else if (!is_win) {
115 ldflags = [ "-Wl,-u_sanitizer_options_link_helper" ] 145 ldflags = [ "-Wl,-u_sanitizer_options_link_helper" ]
116 } 146 }
117 } 147 }
118 148
119 static_library("options_sources") { 149 static_library("options_sources") {
120 # This is a static_library instead of a source_set, as it shouldn't be 150 # This is a static_library instead of a source_set, as it shouldn't be
121 # unconditionally linked into targets. 151 # unconditionally linked into targets.
122 visibility = [ 152 visibility = [
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 # This allows to selectively disable ubsan_vptr, when needed. In particular, 531 # This allows to selectively disable ubsan_vptr, when needed. In particular,
502 # if some third_party code is required to be compiled without rtti, which 532 # if some third_party code is required to be compiled without rtti, which
503 # is a requirement for ubsan_vptr. 533 # is a requirement for ubsan_vptr.
504 config("default_sanitizer_flags_but_ubsan_vptr") { 534 config("default_sanitizer_flags_but_ubsan_vptr") {
505 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ] 535 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ]
506 } 536 }
507 537
508 config("default_sanitizer_flags_but_coverage") { 538 config("default_sanitizer_flags_but_coverage") {
509 configs = all_sanitizer_configs - [ ":coverage_flags" ] 539 configs = all_sanitizer_configs - [ ":coverage_flags" ]
510 } 540 }
OLDNEW
« build/config/ios/codesign.py ('K') | « build/config/ios/rules.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698