Skip to content

Commit

Permalink
Mac: actually link in sanitizer options
Browse files Browse the repository at this point in the history
- We need `-u` and not `-U` to actually pull these in from the archive
- The symbol needs two leading underscores

This might do something unexpected on ASAN since we'll now be pulling
in default options that we weren't previously.

Bug: 1320449
Change-Id: I1e41b08736271945ae272c3a9e42e944d1714d7d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3611824
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#997349}
  • Loading branch information
speednoisemovement authored and Chromium LUCI CQ committed Apr 28, 2022
1 parent fdd01ea commit 48f7037
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build/config/sanitizers/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ if ((is_apple || is_win) && is_asan) {

config("sanitizer_options_link_helper") {
if (is_apple) {
ldflags = [ "-Wl,-U,_sanitizer_options_link_helper" ]
ldflags = [ "-Wl,-u,__sanitizer_options_link_helper" ]
} else if (!is_win) {
ldflags = [ "-Wl,-u_sanitizer_options_link_helper" ]
}
Expand Down
6 changes: 5 additions & 1 deletion buildtools/third_party/libc++/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,12 @@ target(_libcxx_target_type, "libc++") {
"//build/config/compiler:no_chromium_code",
"//build/config/compiler:exceptions",
"//build/config/compiler:rtti",
"//build/config/sanitizers:sanitizer_options_link_helper",
]

if (using_sanitizer) {
configs += [ "//build/config/sanitizers:sanitizer_options_link_helper" ]
}

if (libcxx_is_shared && !is_win) {
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
configs += [ "//build/config/gcc:symbol_visibility_default" ]
Expand Down
2 changes: 1 addition & 1 deletion chrome/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@ if (is_win) {

# TOOD(crbug/1163903#c8) - thakis@ look into why profile and coverage
# instrumentation adds these symbols in different orders
if (!is_component_build && chrome_pgo_phase != 1) {
if (!is_component_build && chrome_pgo_phase != 1 && !using_sanitizer) {
action("verify_chrome_framework_order") {
script = "//chrome/tools/build/mac/verify_order.py"
stamp_file = "$target_out_dir/run_$target_name.stamp"
Expand Down

0 comments on commit 48f7037

Please sign in to comment.