[llvm-commits] [PATCH] Fix $ORIGIN expansion for dynamically linked executables

Dimitry Andric dimitry at andric.com
Sun Apr 15 14:06:39 PDT 2012


Hi,

I recently tried building llvm and clang trunk on FreeBSD with shared
libraries enabled.  Building went just fine, but during testing each
llvm executable complained it could not find libLLVM-3.1svn.so.

It turned out that they all use $ORIGIN in their RPATH section, to find
any libraries relative to their own installation path.

However, the necessary ORIGIN flag was not set in their FLAGS (or
FLAGS_1) section.  It seems you must pass "-z origin" to GNU ld to have
this flag set in the final executable.

It's probably that e.g. Linux simply ignores this flag, and always
expands $ORIGIN anyway, but this is not the case on FreeBSD, and
possibly on other operating systems too.

So I would like to propose the attached patch, which passes "-z origin"
to the linker, in addition to any -rpath option.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-origin-flags-1.diff
Type: text/x-diff
Size: 1120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120415/825bf030/attachment.diff>


More information about the llvm-commits mailing list