This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Should ld consider -rpath '$ORIGIN' when finding dependencies?


On 2 May 2013 21:04, H.J. Lu wrote:
> On Thu, May 2, 2013 at 12:29 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>> So is this a ld bug, or just a difference between bfd and gold?
>>
>> I expected this to work given that ./libbar.so contains
>> DT_RPATH=$ORIGIN and ./main is being given DT_RPATH=$ORIGIN too, both
>> of which would allow finding ./libfoo.so at runtime, so I expect it to
>> link successfully.
>
> Since the build directory layout is independent of the run-time directory
> layout, checking $ORIGIN may not always work at build time.

Right, but in my case my build directory structure exactly mirrors the
deployment directory structure, precisely so that RPATHs work both in
development and when deployed to production and I don't need to mess
around with LD_LIBRARY_PATH.

The link succeeds if there is some other libfoo.so e.g. in another
directory in LD_LIBRARY_PATH, even though that's *not* the one that
will be used at run-time.

> BTW, gold doesn't check undefined symbols in libbar.so.

Ah, so it "works" with gold because it doesn't do the check.

It seems this isn't a bug, so I'll use -rpath-link in addition to
-rpath so the library will be found at link-time.

Thanks for the quick response.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]