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 <binutils at sourceware dot org>
- Date: Fri, 2 Dec 2016 17:32:56 +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> <a2ca5267-927b-f2f8-7049-45b57159a62c@gmail.com> <CAJimCsF2smg8JQqX=cGeCuK_TiAD6k2R8rapuHP7iGYMTWidEg@mail.gmail.com>
Thanks for the link.
Actually, you're wrong with your conclusion.
From the link you pointed, the conclusion should be: "no, $ORIGIN isn't
supposed to work within DT_NEEDED".
From the link you pointed:
"$ORIGIN sequences within a DT_NEEDED entry or path passed as a
parameter to dlopen() are treated as errors."
Although I consider current de-facto behavior not fully fitting the
documentation. Without versioning, it works; with versioning it fails
assertion/crashes (but doesn't explicitly report an error).
I'll report the bug for libc/ld.so.
On 01.12.16 05:16, Cary Coutant wrote:
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?
Yes, it's supposed to work. From "Substitution Sequences" in the gABI:
"Within a string provided by dynamic array entries with the DT_NEEDED
or DT_RUNPATH tags and in pathnames passed as parameters to the
dlopen() routine, a dollar sign ($) introduces a substitution
sequence. ..."
http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#substitution
-cary