[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:39:55 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb64fdaa86b5b: [gn build] Don't pass -Wl,-z,defs for sanitizer builds (authored by aeubanks).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110086/new/
https://reviews.llvm.org/D110086
Files:
llvm/utils/gn/build/BUILD.gn
llvm/utils/gn/build/BUILDCONFIG.gn
llvm/utils/gn/build/toolchain/BUILD.gn
Index: llvm/utils/gn/build/toolchain/BUILD.gn
===================================================================
--- llvm/utils/gn/build/toolchain/BUILD.gn
+++ llvm/utils/gn/build/toolchain/BUILD.gn
@@ -109,7 +109,7 @@
command = "$ld -shared {{ldflags}} -o $outfile {{inputs}} {{libs}} {{frameworks}}"
default_output_extension = ".dylib"
} else {
- command = "$ld -shared {{ldflags}} -Wl,-z,defs -Wl,-soname,{{target_output_name}}{{output_extension}} -o $outfile {{inputs}} {{libs}}"
+ command = "$ld -shared {{ldflags}} -Wl,-soname,{{target_output_name}}{{output_extension}} -o $outfile {{inputs}} {{libs}}"
default_output_extension = ".so"
}
description = "SOLINK $outfile"
Index: llvm/utils/gn/build/BUILDCONFIG.gn
===================================================================
--- llvm/utils/gn/build/BUILDCONFIG.gn
+++ llvm/utils/gn/build/BUILDCONFIG.gn
@@ -22,7 +22,7 @@
configs = shared_binary_target_configs
}
set_defaults("shared_library") {
- configs = shared_binary_target_configs
+ configs = shared_binary_target_configs + [ "//llvm/utils/gn/build:zdefs" ]
}
set_defaults("source_set") {
configs = shared_binary_target_configs
Index: llvm/utils/gn/build/BUILD.gn
===================================================================
--- llvm/utils/gn/build/BUILD.gn
+++ llvm/utils/gn/build/BUILD.gn
@@ -370,6 +370,14 @@
cflags_objcc = cflags_cc
}
+config("zdefs") {
+ # -Wl,-z,defs doesn't work with sanitizers.
+ # https://clang.llvm.org/docs/AddressSanitizer.html
+ if (current_os != "ios" && current_os != "mac" && current_os != "win" && !(use_asan || use_tsan || use_ubsan)) {
+ ldflags = [ "-Wl,-z,defs" ]
+ }
+}
+
# To make an archive that can be distributed, you need to remove this config and
# set complete_static_lib.
config("thin_archive") {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110086.373672.patch
Type: text/x-patch
Size: 1859 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210920/541effd0/attachment.bin>
More information about the llvm-commits
mailing list