[PATCH] D63637: Do not set an RPATH on statically-linked LLVM executables.

Richard Smith - zygoloid via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 20 19:26:40 PDT 2019


rsmith created this revision.
rsmith added a reviewer: chandlerc.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.

This RPATH breaks the ability to run executables from the build area if
the host compiler provides a libc++ and we also build an
ABI-incompatible libc++ as part of the same monorepo compilation.

(This only works around the problem, which still exists for the
LLVM_ENABLE_SHARED configuration.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63637

Files:
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -753,8 +753,11 @@
 
   setup_dependency_debugging(${name} ${LLVM_COMMON_DEPENDS})
 
-  if(NOT ARG_NO_INSTALL_RPATH)
-    llvm_setup_rpath(${name})
+  if (LLVM_LINK_LLVM_DYLIB AND NOT ARG_DISABLE_LLVM_LINK_LLVM_DYLIB)
+    set(USE_SHARED USE_SHARED)
+    if(NOT ARG_NO_INSTALL_RPATH)
+      llvm_setup_rpath(${name})
+    endif()
   endif()
 
   if(DEFINED windows_resource_file)
@@ -777,10 +780,6 @@
     add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} )
   endif(LLVM_EXPORTED_SYMBOL_FILE)
 
-  if (LLVM_LINK_LLVM_DYLIB AND NOT ARG_DISABLE_LLVM_LINK_LLVM_DYLIB)
-    set(USE_SHARED USE_SHARED)
-  endif()
-
   set(EXCLUDE_FROM_ALL OFF)
   set_output_directory(${name} BINARY_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR} LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
   llvm_config( ${name} ${USE_SHARED} ${LLVM_LINK_COMPONENTS} )


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63637.205939.patch
Type: text/x-patch
Size: 1016 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190621/491449a7/attachment.bin>


More information about the llvm-commits mailing list