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

Cary Coutant ccoutant@gmail.com
Thu Dec 1 03:17:00 GMT 2016


>> 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