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

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: Address reviewers comments. 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
« no previous file with comments | « 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 64 }
61 65
62 if (use_prebuilt_instrumented_libraries || 66 if (use_prebuilt_instrumented_libraries ||
63 use_locally_built_instrumented_libraries) { 67 use_locally_built_instrumented_libraries) {
64 deps += [ "//third_party/instrumented_libraries:deps" ] 68 deps += [ "//third_party/instrumented_libraries:deps" ]
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
75 # ASAN is supported on iOS but the runtime library depends on the compiler
76 # used (Chromium version of clang versus Xcode version of clang). Only copy
77 # the ASAN runtime on iOS if building with Chromium clang.
78 if (is_win || is_mac || (is_ios && !use_xcode_clang)) {
71 data_deps = [ 79 data_deps = [
72 ":copy_asan_runtime", 80 ":copy_asan_runtime",
73 ] 81 ]
74 } 82 }
75 if (is_mac) { 83 if (is_mac || (is_ios && !use_xcode_clang)) {
76 public_deps += [ ":asan_runtime_bundle_data" ] 84 public_deps += [ ":asan_runtime_bundle_data" ]
77 } 85 }
78 } 86 }
79 } 87 }
80 88
81 if ((is_mac || is_win) && using_sanitizer) { 89 if ((is_mac || is_win || (is_ios && !use_xcode_clang)) && using_sanitizer) {
82 copy("copy_asan_runtime") { 90 if (is_mac) {
83 if (is_mac) { 91 _clang_rt_dso_path = "darwin/libclang_rt.asan_osx_dynamic.dylib"
84 clang_rt_dso_path = "darwin/libclang_rt.asan_osx_dynamic.dylib" 92 } else if (is_ios) {
85 } else if (is_win && target_cpu == "x86") { 93 _clang_rt_dso_path = "darwin/libclang_rt.asan_iossim_dynamic.dylib"
86 clang_rt_dso_path = "windows/clang_rt.asan_dynamic-i386.dll" 94 } else if (is_win && target_cpu == "x86") {
87 } else if (is_win && target_cpu == "x64") { 95 _clang_rt_dso_path = "windows/clang_rt.asan_dynamic-i386.dll"
88 clang_rt_dso_path = "windows/clang_rt.asan_dynamic-x86_64.dll" 96 } else if (is_win && target_cpu == "x64") {
89 } 97 _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 } 98 }
97 99
98 if (is_mac) { 100 _clang_rt_dso_full_path =
101 "$clang_base_path/lib/clang/$clang_version/lib/$_clang_rt_dso_path"
102
103 if (!is_ios) {
104 copy("copy_asan_runtime") {
105 sources = [
106 _clang_rt_dso_full_path,
107 ]
108 outputs = [
109 "$root_out_dir/{{source_file_part}}",
110 ]
111 }
112 } else {
113 # On iOS, the runtime library need to be code signed (adhoc signature)
114 # starting with Xcode 8, so use an action instead of a copy on iOS.
115 action("copy_asan_runtime") {
116 script = "//build/config/ios/codesign.py"
117 sources = [
118 _clang_rt_dso_full_path,
119 ]
120 outputs = [
121 "$root_out_dir/" + get_path_info(sources[0], "file"),
122 ]
123 args = [
124 "code-sign-file",
125 "--identity=" + ios_code_signing_identity,
126 "--output=" + rebase_path(outputs[0], root_build_dir),
127 rebase_path(sources[0], root_build_dir),
128 ]
129 }
130 }
131
132 if (is_mac || is_ios) {
99 bundle_data("asan_runtime_bundle_data") { 133 bundle_data("asan_runtime_bundle_data") {
100 sources = get_target_outputs(":copy_asan_runtime") 134 sources = get_target_outputs(":copy_asan_runtime")
101 outputs = [ 135 outputs = [
102 "{{bundle_executable_dir}}/{{source_file_part}}", 136 "{{bundle_executable_dir}}/{{source_file_part}}",
103 ] 137 ]
104 public_deps = [ 138 public_deps = [
105 ":copy_asan_runtime", 139 ":copy_asan_runtime",
106 ] 140 ]
107 } 141 }
108 } 142 }
109 } 143 }
110 144
111 config("sanitizer_options_link_helper") { 145 config("sanitizer_options_link_helper") {
112 if (is_mac) { 146 if (is_mac || is_ios) {
113 ldflags = [ "-Wl,-U,_sanitizer_options_link_helper" ] 147 ldflags = [ "-Wl,-U,_sanitizer_options_link_helper" ]
114 } else if (!is_win) { 148 } else if (!is_win) {
115 ldflags = [ "-Wl,-u_sanitizer_options_link_helper" ] 149 ldflags = [ "-Wl,-u_sanitizer_options_link_helper" ]
116 } 150 }
117 } 151 }
118 152
119 static_library("options_sources") { 153 static_library("options_sources") {
120 # This is a static_library instead of a source_set, as it shouldn't be 154 # This is a static_library instead of a source_set, as it shouldn't be
121 # unconditionally linked into targets. 155 # unconditionally linked into targets.
122 visibility = [ 156 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, 535 # 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 536 # if some third_party code is required to be compiled without rtti, which
503 # is a requirement for ubsan_vptr. 537 # is a requirement for ubsan_vptr.
504 config("default_sanitizer_flags_but_ubsan_vptr") { 538 config("default_sanitizer_flags_but_ubsan_vptr") {
505 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ] 539 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ]
506 } 540 }
507 541
508 config("default_sanitizer_flags_but_coverage") { 542 config("default_sanitizer_flags_but_coverage") {
509 configs = all_sanitizer_configs - [ ":coverage_flags" ] 543 configs = all_sanitizer_configs - [ ":coverage_flags" ]
510 } 544 }
OLDNEW
« no previous file with comments | « build/config/ios/rules.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698