This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Is '$ORIGIN' supposed to work within DT_NEEDED sections?
- From: Sasha Unknown <sasha2048 at gmail dot com>
- To: binutils at sourceware dot org
- Date: Thu, 1 Dec 2016 03:03:30 +0200
- Subject: Re: Is '$ORIGIN' supposed to work within DT_NEEDED sections?
- Authentication-results: sourceware.org; auth=none
- References: <23ad2fb0-fb69-aae6-0199-144d59e08d05@gmail.com> <c43852e6-45f1-2965-4238-702f0ce16188@redhat.com>
> Yes, $ORIGIN is supposed to work
Please, note, that I'm talking not about putting '$ORIGIN' into 'RPATH'
field, but about putting it directly into 'NEEDED' field. E.g. not about
this:
objdump -p file | egrep RPATH\|NEEDED
RPATH $ORIGIN/dir1:$ORIGIN/dir2/dir3
NEEDED lib1.so
NEEDED lib2.so
… but about this:
objdump -p file | egrep RPATH\|NEEDED
NEEDED $ORIGIN/dir1/lib1.so
NEEDED $ORIGIN/dir2/dir3/lib2.so
Did you notice it?
> I do not get an assertion failure [during 'ld' call]. The linker
appears to work OK.
I get assertion failure _not during 'ld' call_, but exactly during
'./main3' call.
I, probably, had to say 'it causes assertion failure in ld.so', not 'it
causes assertion failure in ld'.
My output of './main3' is the following: "Inconsistency detected by
ld.so: dl-version.c: 224: _dl_check_map_versions: Assertion `needed !=
NULL' failed!" (between quotes).
> This command ['./main3'] generates a seg-fault.
Probably, for some reason your ld.so doesn't report assertion failures
and thus goes further until segfaulting at later point within the same
'_dl_check_map_versions' function (or: maybe the segfault is a way to
handle assertion failure at some environments?).
On 24.11.16 13:10, Nick Clifton wrote:
Hi Sasha,
Yes, $ORIGIN is supposed to work, although you will need to use the latest
development sources in order to get full support for this feature.
De-facto current state is (at least, in Ubuntu 16.04):
- it works when *.so files don't use versions;
- it causes assertion failure in ld (line 224) when *.so files use versions.
I do not get an assertion failure. The linker appears to work OK. (This is
using the binutils 2.26 release and/or the current development sources).
./main3 && echo ' It works' || echo ' It does not work'
This command generates a seg-fault. (In _dl_check_map_versions in the loader).
I do not have enough knowledge to know what this seg-fault means however.
Cheers
Nick