[PATCH] D110086: [gn build] Don't pass -Wl,-z,defs for sanitizer builds

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 20 11:07:26 PDT 2021


aeubanks added inline comments.


================
Comment at: llvm/utils/gn/build/BUILD.gn:374
+config("zdefs") {
+  # -Wl,-z,defs doesn't work with sanitizers.
+  # https://clang.llvm.org/docs/AddressSanitizer.html
----------------
thakis wrote:
> Only on Linux (or non-win non-mac non-ios i guess. Maybe non-android non-fuchsia too, not sure there without looking it up)
> 
> Also, do we need a separate config for this? Can we edit llvm/utils/gn/build/BUILD.gn around line 91 and put something like
> 
> ```
>   if (current_os != "ios" && current_os != "mac" && !(current_os == "linux" && (use_asan || use_tsan || use_ubsan))) {
>     ldflags += [ "-Wl,-z,defs" ]
>   }
> ```
> 
> there?
> 
> (Things only go in configs if some configs need to opt out of them, which here doesn't seem to be the case as far as I can tell.)
I initially did put it there, but that adds -Wl,-z,defs to static links as well, which doesn't change anything but makes the command line a bit longer. If that's fine with you though I can do that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110086/new/

https://reviews.llvm.org/D110086



More information about the llvm-commits mailing list