> I don't know if this is expected behavior, but it's certainly annoying behavior. I'm writing an app that depends on libtcodxx.so, which in turn depends on libtcod.so. I want to ship them both in the lib directory next to my app. With RUNPATH as "$ORIGIN/lib", it finds the direct dependency (libtcodxx.so) and then doesn't look in the same directory for its dependency. To get it to search there for both, I have to set RPATH to "$ORIGIN/lib", and I suspect that RPATH may not technically be supposed to support the $ORIGIN syntax. It looks like it's the expected behaviour after all. From "Shared Object Dependencies" section in [1]: """ The set of directories specified by a given DT_RUNPATH entry is used to find only the immediate dependencies of the executable or shared object containing the DT_RUNPATH entry. That is, it is used only for those dependencies contained in the DT_NEEDED entries of the dynamic structure containing the DT_RUNPATH entry, itself. One object's DT_RUNPATH entry does not affect the search for any other object's dependencies. """ Another interesting bit in [1] is the "Dynamic Array Tags" table, where it's stated that RUNPATH is optionally considered for both shared objects and executables, while RPATH is ignored for shared objects. It seems like that suggests the idea when using RUNPATH is that you'd have both executables and shared objects specifying it, instead of setting it just for the "top level" executable and letting that work transitively. I've investigated this a bit and it seems that the move to using --enable-new-dtags by default is something Debian changed explicitly a while ago: binutils (2.27.51.20161116-2) unstable; urgency=medium * Stop building the mipsr6 mipsr6el mipsn32r6 mipsn32r6el mips64r6 mips64r6el variants; can't continue with this work, because package uploads with these architectures are still rejected. * Add homepage attribute to the control file: Closes: #841432. * ld: enable new dtags by default for linux/gnu targets. Closes: #835859. * Fix PR ld/20827, using proposed patch. Closes: #844378. -- Matthias Klose