| OLD | NEW |
| 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/config/chrome_build.gni") | 5 import("//build/config/chrome_build.gni") |
| 6 import("//build/config/chromecast_build.gni") | 6 import("//build/config/chromecast_build.gni") |
| 7 import("//build/config/clang/clang.gni") | 7 import("//build/config/clang/clang.gni") |
| 8 import("//build/config/sanitizers/sanitizers.gni") | 8 import("//build/config/sanitizers/sanitizers.gni") |
| 9 import("//build/toolchain/toolchain.gni") | 9 import("//build/toolchain/toolchain.gni") |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 if (use_prebuilt_instrumented_libraries || | 61 if (use_prebuilt_instrumented_libraries || |
| 62 use_locally_built_instrumented_libraries) { | 62 use_locally_built_instrumented_libraries) { |
| 63 deps += [ "//third_party/instrumented_libraries:deps" ] | 63 deps += [ "//third_party/instrumented_libraries:deps" ] |
| 64 } | 64 } |
| 65 if (use_custom_libcxx) { | 65 if (use_custom_libcxx) { |
| 66 public_deps += [ "//buildtools/third_party/libc++:libcxx_proxy" ] | 66 public_deps += [ "//buildtools/third_party/libc++:libcxx_proxy" ] |
| 67 data += [ "$root_out_dir/libc++.so" ] | 67 data += [ "$root_out_dir/libc++.so" ] |
| 68 } | 68 } |
| 69 if (is_mac) { | 69 |
| 70 if (is_mac || is_win) { |
| 70 data_deps = [ | 71 data_deps = [ |
| 71 ":copy_asan_runtime", | 72 ":copy_asan_runtime", |
| 72 ] | 73 ] |
| 74 } |
| 73 | 75 |
| 76 if (is_mac) { |
| 74 public_deps += [ ":asan_runtime_bundle_data" ] | 77 public_deps += [ ":asan_runtime_bundle_data" ] |
| 75 } | 78 } |
| 76 } | 79 } |
| 77 } | 80 } |
| 78 | 81 |
| 79 if (is_mac && using_sanitizer) { | 82 if (using_sanitizer) { |
| 80 copy("copy_asan_runtime") { | 83 copy("copy_asan_runtime") { |
| 81 sources = [ | 84 if (is_mac) { |
| 82 "$clang_base_path/lib/clang/$clang_version/lib/darwin/libclang_rt.asan_osx
_dynamic.dylib", | 85 sources = [ |
| 83 ] | 86 "$clang_base_path/lib/clang/$clang_version/lib/darwin/libclang_rt.asan_o
sx_dynamic.dylib", |
| 87 ] |
| 88 } else if (is_win) { |
| 89 sources = [ |
| 90 "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dyn
amic-i386.dll", |
| 91 "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dyn
amic-x86_64.dll", |
| 92 ] |
| 93 } |
| 84 outputs = [ | 94 outputs = [ |
| 85 "$root_out_dir/{{source_file_part}}", | 95 "$root_out_dir/{{source_file_part}}", |
| 86 ] | 96 ] |
| 87 } | 97 } |
| 88 | 98 |
| 89 bundle_data("asan_runtime_bundle_data") { | 99 if (is_mac) { |
| 90 sources = get_target_outputs(":copy_asan_runtime") | 100 bundle_data("asan_runtime_bundle_data") { |
| 91 outputs = [ | 101 sources = get_target_outputs(":copy_asan_runtime") |
| 92 "{{bundle_executable_dir}}/{{source_file_part}}", | 102 outputs = [ |
| 93 ] | 103 "{{bundle_executable_dir}}/{{source_file_part}}", |
| 94 public_deps = [ | 104 ] |
| 95 ":copy_asan_runtime", | 105 public_deps = [ |
| 96 ] | 106 ":copy_asan_runtime", |
| 107 ] |
| 108 } |
| 97 } | 109 } |
| 98 } | 110 } |
| 99 | 111 |
| 100 config("sanitizer_options_link_helper") { | 112 config("sanitizer_options_link_helper") { |
| 101 if (is_mac) { | 113 if (is_mac) { |
| 102 ldflags = [ "-Wl,-U,_sanitizer_options_link_helper" ] | 114 ldflags = [ "-Wl,-U,_sanitizer_options_link_helper" ] |
| 103 } else if (!is_win) { | 115 } else if (!is_win) { |
| 104 ldflags = [ "-Wl,-u_sanitizer_options_link_helper" ] | 116 ldflags = [ "-Wl,-u_sanitizer_options_link_helper" ] |
| 105 } | 117 } |
| 106 } | 118 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 127 | 139 |
| 128 if (is_lsan) { | 140 if (is_lsan) { |
| 129 sources += [ "//build/sanitizers/lsan_suppressions.cc" ] | 141 sources += [ "//build/sanitizers/lsan_suppressions.cc" ] |
| 130 } | 142 } |
| 131 | 143 |
| 132 if (is_tsan) { | 144 if (is_tsan) { |
| 133 sources += [ "//build/sanitizers/tsan_suppressions.cc" ] | 145 sources += [ "//build/sanitizers/tsan_suppressions.cc" ] |
| 134 } | 146 } |
| 135 } | 147 } |
| 136 | 148 |
| 149 config("executable_config") { |
| 150 if (is_win && is_asan) { |
| 151 if (current_cpu == "x64") { |
| 152 libs = [ "clang_rt.asan_dynamic-x86_64.lib" ] |
| 153 } else { |
| 154 libs = [ "clang_rt.asan_dynamic-i386.lib" ] |
| 155 } |
| 156 } |
| 157 } |
| 158 |
| 137 # Applies linker flags necessary when either :deps or :default_sanitizer_flags | 159 # Applies linker flags necessary when either :deps or :default_sanitizer_flags |
| 138 # are used. | 160 # are used. |
| 139 config("default_sanitizer_ldflags") { | 161 config("default_sanitizer_ldflags") { |
| 140 visibility = [ | 162 visibility = [ |
| 141 ":default_sanitizer_flags", | 163 ":default_sanitizer_flags", |
| 142 ":deps", | 164 ":deps", |
| 143 ] | 165 ] |
| 144 | 166 |
| 145 if (is_posix) { | 167 if (is_posix) { |
| 146 ldflags = [] | 168 ldflags = [] |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 rebase_path("//tools/memory/asan/blacklist_win.txt", | 253 rebase_path("//tools/memory/asan/blacklist_win.txt", |
| 232 root_build_dir) ] | 254 root_build_dir) ] |
| 233 } else { | 255 } else { |
| 234 # TODO(rnk): Remove this as discussed in http://crbug.com/427202. | 256 # TODO(rnk): Remove this as discussed in http://crbug.com/427202. |
| 235 cflags += | 257 cflags += |
| 236 [ "-fsanitize-blacklist=" + | 258 [ "-fsanitize-blacklist=" + |
| 237 rebase_path("//tools/memory/asan/blacklist.txt", root_build_dir) ] | 259 rebase_path("//tools/memory/asan/blacklist.txt", root_build_dir) ] |
| 238 } | 260 } |
| 239 | 261 |
| 240 if (is_win) { | 262 if (is_win) { |
| 241 if (target_cpu == "x64") { | 263 if (current_cpu == "x64") { |
| 242 # Windows 64-bit. | 264 # Windows 64-bit. |
| 243 if (is_component_build) { | 265 if (is_component_build) { |
| 244 libs = [ | 266 libs = [ |
| 245 "clang_rt.asan_dynamic-x86_64.lib", | 267 "clang_rt.asan_dynamic-x86_64.lib", |
| 246 "clang_rt.asan_dynamic_runtime_thunk-x86_64.lib", | 268 "clang_rt.asan_dynamic_runtime_thunk-x86_64.lib", |
| 247 ] | 269 ] |
| 248 } else { | 270 } else { |
| 249 # TODO(etienneb): DLLs in the non-component build should link against | 271 libs = [ "clang_rt.asan_dynamic_runtime_thunk-x86_64.lib" ] |
| 250 # clang_rt.asan_dll_thunk-x86_64.lib instead. | |
| 251 libs = [ "clang_rt.asan-x86_64.lib" ] | |
| 252 } | 272 } |
| 253 } else { | 273 } else { |
| 254 assert(target_cpu == "x86", "WinASan unsupported architecture") | 274 assert(current_cpu == "x86", "WinASan unsupported architecture") |
| 255 if (is_component_build) { | 275 if (is_component_build) { |
| 256 libs = [ | 276 libs = [ |
| 257 "clang_rt.asan_dynamic-i386.lib", | 277 "clang_rt.asan_dynamic-i386.lib", |
| 258 "clang_rt.asan_dynamic_runtime_thunk-i386.lib", | 278 "clang_rt.asan_dynamic_runtime_thunk-i386.lib", |
| 259 ] | 279 ] |
| 260 } else { | 280 } else { |
| 261 # TODO(etienneb): DLLs in the non-component build should link against | 281 libs = [ "clang_rt.asan_dynamic_runtime_thunk-i386.lib" ] |
| 262 # clang_rt.asan_dll_thunk-i386.lib instead. | |
| 263 libs = [ "clang_rt.asan-i386.lib" ] | |
| 264 } | 282 } |
| 265 } | 283 } |
| 266 } | 284 } |
| 267 } | 285 } |
| 268 } | 286 } |
| 269 | 287 |
| 270 config("cfi_flags") { | 288 config("cfi_flags") { |
| 271 cflags = [] | 289 cflags = [] |
| 272 if (is_cfi && !is_nacl) { | 290 if (is_cfi && !is_nacl) { |
| 273 cfi_blacklist_path = | 291 cfi_blacklist_path = |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 # This allows to selectively disable ubsan_vptr, when needed. In particular, | 475 # This allows to selectively disable ubsan_vptr, when needed. In particular, |
| 458 # if some third_party code is required to be compiled without rtti, which | 476 # if some third_party code is required to be compiled without rtti, which |
| 459 # is a requirement for ubsan_vptr. | 477 # is a requirement for ubsan_vptr. |
| 460 config("default_sanitizer_flags_but_ubsan_vptr") { | 478 config("default_sanitizer_flags_but_ubsan_vptr") { |
| 461 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ] | 479 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ] |
| 462 } | 480 } |
| 463 | 481 |
| 464 config("default_sanitizer_flags_but_coverage") { | 482 config("default_sanitizer_flags_but_coverage") { |
| 465 configs = all_sanitizer_configs - [ ":coverage_flags" ] | 483 configs = all_sanitizer_configs - [ ":coverage_flags" ] |
| 466 } | 484 } |
| OLD | NEW |