[llvm] r202499 - Centralize the handling of install_name and rpath.

Rafael Espindola rafael.espindola at gmail.com
Fri Feb 28 05:48:03 PST 2014


Author: rafael
Date: Fri Feb 28 07:48:03 2014
New Revision: 202499

URL: http://llvm.org/viewvc/llvm-project?rev=202499&view=rev
Log:
Centralize the handling of install_name and rpath.

This centralizes the Makefile handling of -install_name and -rpath. It also
moves the cmake build to using @rpath. The reason being that libclang needs it,
and it works for everything else.

A followup patch will move clang to using this and then there will be a single
point to edit to support other systems.

Modified:
    llvm/trunk/CMakeLists.txt
    llvm/trunk/Makefile.rules
    llvm/trunk/tools/llvm-shlib/Makefile
    llvm/trunk/tools/lto/Makefile

Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=202499&r1=202498&r2=202499&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Fri Feb 28 07:48:03 2014
@@ -443,7 +443,7 @@ set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LL
 
 set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
 if (APPLE)
-  set(CMAKE_INSTALL_NAME_DIR "@executable_path/../lib")
+  set(CMAKE_INSTALL_NAME_DIR "@rpath")
   set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
 else(UNIX)
   if(NOT DEFINED CMAKE_INSTALL_RPATH)

Modified: llvm/trunk/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=202499&r1=202498&r2=202499&view=diff
==============================================================================
--- llvm/trunk/Makefile.rules (original)
+++ llvm/trunk/Makefile.rules Fri Feb 28 07:48:03 2014
@@ -589,6 +589,8 @@ ifdef SHARED_LIBRARY
 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
 ifneq ($(HOST_OS),Darwin)
   LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
+else
+  LD.Flags += -Wl,-install_name  -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)"
 endif
 endif
 endif

Modified: llvm/trunk/tools/llvm-shlib/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-shlib/Makefile?rev=202499&r1=202498&r2=202499&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-shlib/Makefile (original)
+++ llvm/trunk/tools/llvm-shlib/Makefile Fri Feb 28 07:48:03 2014
@@ -49,14 +49,6 @@ ifeq ($(HOST_OS),Darwin)
     endif
     # Include everything from the .a's into the shared library.
     LLVMLibsOptions    := $(LLVMLibsOptions) -all_load
-
-    # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
-    DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
-    ifneq ($(DARWIN_VERS),8)
-       LLVMLibsOptions    := $(LLVMLibsOptions)  \
-                            -Wl,-install_name \
-                            -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)"
-    endif
 endif
 
 ifeq ($(HOST_OS), $(filter $(HOST_OS), DragonFly Linux FreeBSD GNU/kFreeBSD OpenBSD GNU Bitrig))

Modified: llvm/trunk/tools/lto/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/Makefile?rev=202499&r1=202498&r2=202499&view=diff
==============================================================================
--- llvm/trunk/tools/lto/Makefile (original)
+++ llvm/trunk/tools/lto/Makefile Fri Feb 28 07:48:03 2014
@@ -37,14 +37,6 @@ ifeq ($(HOST_OS),Darwin)
                         -Wl,-compatibility_version -Wl,1
     endif
 
-    # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
-    DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
-    ifneq ($(DARWIN_VERS),8)
-       LLVMLibsOptions    := $(LLVMLibsOptions)  \
-                            -Wl,-install_name \
-                            -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
-    endif
-
     # If we're doing an Apple-style build, add the LTO object path.
     ifeq ($(RC_XBS),YES)
        TempFile        := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX)





More information about the llvm-commits mailing list