Is '$ORIGIN' supposed to work within DT_NEEDED sections?

Sasha Unknown sasha2048@gmail.com
Fri Dec 2 15:33:00 GMT 2016


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



More information about the Binutils mailing list