[patch] Centralize the handling of install_name and rpath

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Feb 27 19:32:18 PST 2014


Currently this is spread over multiple locations and is out of sync
between Makefile and CMake. For example

* libclang uses an @rpath install name.
* libLTO uses @executable_path with Makefile.
* everything else uses @executable_path when building with cmake.

For some reason it looks like @rpath is needed by libclang. It seems
to work for the others too, so what these patches do is centralize the
logic for using "-install_name @rpath" for shared libraries and
"-rpath @executable_path/../lib" for binaries.

Having the logic in one place is cleaner and introduces a single point
to patch for supporting old OS X versions.

I now get in a configure build:

$ otool -l  Debug+Asserts/lib/libLTO.dylib  | grep LC_ID_DYLIB -A2
          cmd LC_ID_DYLIB
      cmdsize 48
         name @rpath/libLTO.dylib (offset 24)

$ otool -l  Debug+Asserts/lib/libclang.dylib | grep LC_ID_DYLIB -A2
          cmd LC_ID_DYLIB
      cmdsize 48
         name @rpath/libclang.dylib (offset 24)

$ otool -l Debug+Asserts/bin/llvm-as | grep LC_RPATH -A2
          cmd LC_RPATH
      cmdsize 40
         path @executable_path/../lib (offset 12)

and in a cmake build

$ otool -l  lib/libLTO.dylib  | grep LC_ID_DYLIB -A2
          cmd LC_ID_DYLIB
      cmdsize 48
         name @rpath/libLTO.dylib (offset 24)

$ otool -l  lib/libclang.3.5.dylib  | grep LC_ID_DYLIB -A2
          cmd LC_ID_DYLIB
      cmdsize 56
         name @rpath/libclang.3.5.dylib (offset 24)

$ otool -l bin/llvm-as | grep LC_RPATH -A2
          cmd LC_RPATH
      cmdsize 40
         path @executable_path/../lib (offset 12)

Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm.patch
Type: application/octet-stream
Size: 2529 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140227/04d9188e/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang.patch
Type: application/octet-stream
Size: 1262 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140227/04d9188e/attachment-0001.obj>


More information about the llvm-commits mailing list