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>2021-04-22 12:30:05 +0200
commita5bf347ca0849b23a2563d775dcb948dfc34f20d (patch)
tree07e37fd832a6ee20e7ccb35dc0d4d400cd9f3d56
parent[compiler-rt] Apply Gentoo compiler-rt-prefix-paths.patch (diff)
downloadllvm-project-gentoo.tar.gz
llvm-project-gentoo.tar.bz2
llvm-project-gentoo.zip
[libcxx] Force -Wl,-z,defsgentoo-9999-1gentoo
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 a53493e7fd8e..10800fe3a4f3 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -507,6 +507,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)