From 4ccfbc66ce2b829a41300702ea3c8025cc5dcea8 Mon Sep 17 00:00:00 2001 From: Vyacheslav Egorov Date: Thu, 21 Aug 2025 14:55:54 -0700 Subject: [PATCH] [build] Fix sanitizer build on Mac. It seems on Linux linker parses -usymbol as -u symbol, but the same does not get parsed on Mac - it interprets the whole thing as a name of a flag and gets confused. Fixes https://github.com/dart-lang/sdk/issues/61377 TEST=tried building with TSAN on mac R=aam@google.com Change-Id: I75e386813621f6e15562b5d8386f2c4441773970 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/446301 Commit-Queue: Alexander Aprelev Auto-Submit: Slava Egorov Reviewed-by: Alexander Aprelev --- build/config/sanitizers/BUILD.gn | 2 +- build/sanitizers/sanitizer_options.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/config/sanitizers/BUILD.gn b/build/config/sanitizers/BUILD.gn index 5b8d4edfcb6..bad9e897d6e 100644 --- a/build/config/sanitizers/BUILD.gn +++ b/build/config/sanitizers/BUILD.gn @@ -15,7 +15,7 @@ group("deps") { } config("sanitizer_options_link_helper") { - ldflags = [ "-Wl,-u_sanitizer_options_link_helper" ] + ldflags = [ "-Wl,-u,_sanitizer_options_link_helper" ] } source_set("options_sources") { diff --git a/build/sanitizers/sanitizer_options.cc b/build/sanitizers/sanitizer_options.cc index 6be233ddf4a..14a06227e54 100644 --- a/build/sanitizers/sanitizer_options.cc +++ b/build/sanitizers/sanitizer_options.cc @@ -8,7 +8,7 @@ // Functions returning default options are declared weak in the tools' runtime // libraries. To make the linker pick the strong replacements for those // functions from this module, we explicitly force its inclusion by passing -// -Wl,-u_sanitizer_options_link_helper +// -Wl,-u,_sanitizer_options_link_helper extern "C" void _sanitizer_options_link_helper() {} // The callbacks we define here will be called from the sanitizer runtime, but