[libcxx-commits] [libcxxabi] 8d51969 - [runtimes] Avoid overwriting the rpath unconditionally
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 9 13:56:10 PST 2020
Author: Louis Dionne
Date: 2020-11-09T16:56:03-05:00
New Revision: 8d51969bd40a0351ed2f0be54c61b1e62b0b433c
URL: https://github.com/llvm/llvm-project/commit/8d51969bd40a0351ed2f0be54c61b1e62b0b433c
DIFF: https://github.com/llvm/llvm-project/commit/8d51969bd40a0351ed2f0be54c61b1e62b0b433c.diff
LOG: [runtimes] Avoid overwriting the rpath unconditionally
When building the runtimes, it's very important not to add rpaths unless
the user explicitly asks for them (the standard way being CMAKE_INSTALL_RPATH),
or to change the install name dir unless the user requests it (via
CMAKE_INSTALL_NAME_DIR).
llvm_setup_rpath() would override the install_name_dir of the runtimes
even if CMAKE_INSTALL_NAME_DIR was specified to something, which is wrong
and in fact even "dangerous" for the runtimes.
This issue was discovered when trying to build libc++ and libc++abi as
system libraries for Apple, where we set the install name dir to /usr/lib
explicitly. llvm_setup_rpath() would cause libc++ to have the wrong install
name dir, and for basically everything on the system to fail to load.
This was discovered just now because we previously used something closer
to a standalone build, where llvm_setup_rpath() wouldn't exist, and hence
not be used.
This is a revert of the following commits:
libunwind: 3a667b9bd8b741f5ac1d8d47857140a3d70737fb
libc++abi: 4877063e195dfcc128451bbf3dd7b03d04d2562f
libc++: 88434fe05fdb112a33052c4d8a91c9e989cb032d
Those added llvm_setup_rpath() for consistency, so it seems reasonable
to revert.
Differential Revision: https://reviews.llvm.org/D91099
Added:
Modified:
libcxx/src/CMakeLists.txt
libcxxabi/src/CMakeLists.txt
libunwind/src/CMakeLists.txt
Removed:
################################################################################
diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
index 181aa95bf870..52b68e50dd4e 100644
--- a/libcxx/src/CMakeLists.txt
+++ b/libcxx/src/CMakeLists.txt
@@ -176,9 +176,6 @@ split_list(LIBCXX_LINK_FLAGS)
# Build the shared library.
if (LIBCXX_ENABLE_SHARED)
add_library(cxx_shared SHARED ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
- if(COMMAND llvm_setup_rpath)
- llvm_setup_rpath(cxx_shared)
- endif()
target_link_libraries(cxx_shared PUBLIC cxx-headers
PRIVATE ${LIBCXX_LIBRARIES})
set_target_properties(cxx_shared
diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index ec88a1e4d27d..7353c2086b94 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -165,9 +165,6 @@ endif()
# Build the shared library.
if (LIBCXXABI_ENABLE_SHARED)
add_library(cxxabi_shared SHARED ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS})
- if(COMMAND llvm_setup_rpath)
- llvm_setup_rpath(cxxabi_shared)
- endif()
target_link_libraries(cxxabi_shared PRIVATE ${LIBCXXABI_SHARED_LIBRARIES} ${LIBCXXABI_LIBRARIES})
if (TARGET pstl::ParallelSTL)
target_link_libraries(cxxabi_shared PUBLIC pstl::ParallelSTL)
diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
index 09449178208b..dc2c5e0087e9 100644
--- a/libunwind/src/CMakeLists.txt
+++ b/libunwind/src/CMakeLists.txt
@@ -125,9 +125,6 @@ if (LIBUNWIND_ENABLE_SHARED)
else()
target_compile_options(unwind_shared PRIVATE -fno-rtti)
endif()
- if(COMMAND llvm_setup_rpath)
- llvm_setup_rpath(unwind_shared)
- endif()
target_link_libraries(unwind_shared PRIVATE ${LIBUNWIND_LIBRARIES})
set_target_properties(unwind_shared PROPERTIES
CXX_EXTENSIONS OFF
More information about the libcxx-commits
mailing list