[PATCH][v2] Add dynamic linker support for $EXEC_ORIGIN.

Brooks Moses bmoses@google.com
Fri Dec 20 21:20:00 GMT 2013


On Fri, Dec 20, 2013 at 11:45 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> this probably should be documented somewhere in glibc (beyond just the code
> itself).  a quick scan of the manual though doesn't seem to turn up any
> discussion of topics like rpath or $ORIGIN, so i guess the assumption is that
> we follow the standard ELF conventions.  which leads into the next point ...
>
> shouldn't it also be coordinated (at least loosely) with the linker and ELF
> ABI peeps ?  they already fully document (and in some cases implement) the
> semantics of DT_RPATH/DT_RUNPATH, so having glibc add its own (undocumented)
> extensions doesn't seem like a good idea.

Agreed that this needs to be documented, and I was surprised
substitution patterns are not mentioned in the glibc documentation.
However, the $ORIGIN and other similar substituation patterns are
documented in the ld.so manpage that's part of the Linux man-pages
project, and I am planning to submit a patch there once this is
accepted.  (See, e.g.,
http://manpages.ubuntu.com/manpages/lucid/man8/ld.so.8.html for a
current version.)

IIUC, the latest version of the ELF ABI specification is
http://www.sco.com/developers/gabi/latest/contents.html.  (That's a
draft from 10 June 2013.)  That mentions $ORIGIN, but states that the
behavior for other substitution patterns starting with $ is
"unspecified".  We already have a couple of additional extensions in
glibc that are not in the ABI specification: $LIB and $PLATFORM.
Adding another seems not unreasonable.

I'm also not seeing any documentation of these patterns in the GNU
linker manual (https://sourceware.org/binutils/docs-2.24/ld/index.html);
in particular, the -rpath option documentation doesn't mention it.  Am
I missing something there?  I'd be happy to coordinate if there's
coordination that needs to be done.

Thanks,
- Brooks



More information about the Libc-alpha mailing list