aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@moritz.systems>2021-04-22 12:30:05 +0200
committerMichał Górny <mgorny@moritz.systems>2022-03-23 10:07:18 +0100
commitd60814447c1dffa38c89e364cd4d0bb7cfbdf4b0 (patch)
tree633b803de0699a68fb2ea5a194e45bda79904b1c
parent[compiler-rt] Apply Gentoo compiler-rt-prefix-paths.patch (diff)
downloadllvm-project-d60814447c1dffa38c89e364cd4d0bb7cfbdf4b0.tar.gz
llvm-project-d60814447c1dffa38c89e364cd4d0bb7cfbdf4b0.tar.bz2
llvm-project-d60814447c1dffa38c89e364cd4d0bb7cfbdf4b0.zip
[libcxx] Force -Wl,-z,defsgentoo-14.0.0
Gentoo-Component: libcxx
-rw-r--r--libcxx/CMakeLists.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 35c2ce515dd1..7f8719e245b5 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -534,6 +534,18 @@ remove_flags("/D_DEBUG" "/MTd" "/MDd" "/MT" "/Md")
# so they don't get transformed into -Wno and -errors respectively.
remove_flags(-Wno-pedantic -pedantic-errors -pedantic)
+# FIXME: this is cribbed from HandleLLVMOptions.cmake.
+if(LIBCXX_STANDALONE_BUILD)
+ # Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO
+ # build might work on ELF but fail on MachO/COFF.
+ if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR WIN32 OR CYGWIN OR
+ ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR
+ ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") AND
+ NOT LLVM_USE_SANITIZER)
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
+ endif()
+endif()
+
# Required flags ==============================================================
function(cxx_add_basic_build_flags target)