Skip to content

Commit 8d51969

Browse files
committed
[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: 3a667b9 libc++abi: 4877063 libc++: 88434fe Those added llvm_setup_rpath() for consistency, so it seems reasonable to revert. Differential Revision: https://reviews.llvm.org/D91099
1 parent 142c6f8 commit 8d51969

File tree

3 files changed

+0
-9
lines changed

3 files changed

+0
-9
lines changed

libcxx/src/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,6 @@ split_list(LIBCXX_LINK_FLAGS)
176176
# Build the shared library.
177177
if (LIBCXX_ENABLE_SHARED)
178178
add_library(cxx_shared SHARED ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
179-
if(COMMAND llvm_setup_rpath)
180-
llvm_setup_rpath(cxx_shared)
181-
endif()
182179
target_link_libraries(cxx_shared PUBLIC cxx-headers
183180
PRIVATE ${LIBCXX_LIBRARIES})
184181
set_target_properties(cxx_shared

libcxxabi/src/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,6 @@ endif()
165165
# Build the shared library.
166166
if (LIBCXXABI_ENABLE_SHARED)
167167
add_library(cxxabi_shared SHARED ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS})
168-
if(COMMAND llvm_setup_rpath)
169-
llvm_setup_rpath(cxxabi_shared)
170-
endif()
171168
target_link_libraries(cxxabi_shared PRIVATE ${LIBCXXABI_SHARED_LIBRARIES} ${LIBCXXABI_LIBRARIES})
172169
if (TARGET pstl::ParallelSTL)
173170
target_link_libraries(cxxabi_shared PUBLIC pstl::ParallelSTL)

libunwind/src/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,6 @@ if (LIBUNWIND_ENABLE_SHARED)
125125
else()
126126
target_compile_options(unwind_shared PRIVATE -fno-rtti)
127127
endif()
128-
if(COMMAND llvm_setup_rpath)
129-
llvm_setup_rpath(unwind_shared)
130-
endif()
131128
target_link_libraries(unwind_shared PRIVATE ${LIBUNWIND_LIBRARIES})
132129
set_target_properties(unwind_shared PROPERTIES
133130
CXX_EXTENSIONS OFF

0 commit comments

Comments
 (0)