Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Matt Rice <ratmice@gmail.com>
To: Mike Frysinger <vapier@gentoo.org>
Cc: gdb-patches@sourceware.org, Pedro Alves <palves@redhat.com>,
		Jan Kratochvil <jan.kratochvil@redhat.com>
Subject: Re: [patch+7.5.1] Work around PR libc/13097 "linux-vdso.so.1" #3
Date: Tue, 27 Nov 2012 23:00:00 -0000	[thread overview]
Message-ID: <CACTLOFrwdpFDoFHz1FfJ53d5DTZDji_5k7O1UmCEbQT_yAavAw@mail.gmail.com> (raw)
In-Reply-To: <201211271659.11975.vapier@gentoo.org>

On Tue, Nov 27, 2012 at 1:59 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Friday 23 November 2012 11:01:03 Pedro Alves wrote:
>
>>  "If a shared object name has one or more slash (/) characters anywhere in
>> the name, such as /usr/lib/lib2 above or directory/file, the dynamic
>> linker uses that string directly as the path name. If the name has no
>> slashes, such as lib1 above, three facilities specify shared object path
>> search-ing, with the following precedence."
>>
>> So your example had a slash.  If there'd be no slash, the below applies:
>>
>>  "First, the dynamic array tag DT_RPATH may give a string that holds a list
>> of directories, separated by colons (:). For example, the string
>> /home/dir/lib:/home/dir2/lib: tells the dynamic linker to search first the
>> directory /home/dir/lib, then /home/dir2/lib, and then the current
>> directory to find dependencies.
>>   Second, a variable called LD_LIBRARY_PATH in the process environment [see
>> exec(BA_OS)] may hold a list of directories as above, optionally followed
>> by a semicolon (;) and another directory list."
>>
>>   The following values would be equivalent to the previous example:
>>   LD_LIBRARY_PATH=/home/dir/lib:/home/dir2/lib:
>>   LD_LIBRARY_PATH=/home/dir/lib;/home/dir2/lib:
>>   LD_LIBRARY_PATH=/home/dir/lib:/home/dir2/lib:;
>>   All LD_LIBRARY_PATH directories are searched after those from DT_RPATH.
>> Although some programs (such as the link editor) treat the lists before
>> and after the semicolon differently, the dynamic linker does not.
>> Nevertheless, the dynamic linker accepts the semicolon notation, with the
>> semantics described above.
>>   Finally, if the other two groups of directories fail to locate the
>> desired library, the dynamic linker searches /usr/lib."
>
> there's actually a 4th way according to the ELF spec: DT_RUNPATH is after
> LD_LIBRARY_PATH and before the runtime ldso falls back to its own
> configuration.  further, if DT_RUNPATH is set, the DT_RPATH settings are
> ignored.  this can make a difference if LD_LIBRARY_PATH is in use.
>
> beyond that, while not part of the ELF spec, every ldso worth using has a
> ld.so.cache which it consults before the paths it has hardcoded internally.
> although any path loaded via either of those mechanisms will be a full path,
> so gdb probably need not worry about it.

there is sort of a 5th, la_objsearch from rtld-audit(7) which can
happen at various stages through all of this to replace a path (see
its FLAG argument) I didn't find anything specifying it in the glibc
manual but  the 'slash characters rule' seems to apply to the return
value, under glibc there is currently no way to do this without
specifying an audit lib as a environment variable, but under sun, a
library could specify one itself by adding a DT_AUDIT or DT_DEPAUDIT
entry in the dynamic section.

not sure how this matters except to say it doesn't appear to be useful
for generating a relative path without a '/' due to the slash
characters rule applying.


  reply	other threads:[~2012-11-27 23:00 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-22 20:17 Jan Kratochvil
2012-11-23 11:30 ` Luis Gustavo
2012-11-23 11:41   ` Jan Kratochvil
2012-11-23 11:59     ` Luis Machado
2012-11-23 12:03 ` Pedro Alves
2012-11-23 12:40   ` Jan Kratochvil
2012-11-23 14:05     ` Luis Machado
2012-11-23 14:07       ` Jan Kratochvil
2012-11-23 16:01     ` Pedro Alves
2012-11-23 16:12       ` Mark Kettenis
2012-11-23 16:17         ` Jan Kratochvil
2012-11-23 16:23         ` Pedro Alves
2012-11-23 17:28       ` Joel Brobecker
2012-11-23 18:17         ` Jan Kratochvil
2012-11-23 18:22           ` Pedro Alves
2012-11-27 21:58       ` Mike Frysinger
2012-11-27 23:00         ` Matt Rice [this message]
2012-11-28  1:12         ` Pedro Alves
2012-11-28 20:39           ` Mike Frysinger
2012-11-28 22:44           ` Jan Kratochvil
2012-11-29  1:07             ` Mike Frysinger
2012-11-23 12:43   ` Mark Kettenis
2012-11-23 16:30 ` H.J. Lu
2012-11-23 18:19   ` Pedro Alves
2012-11-23 18:43     ` Jan Kratochvil
2012-11-25 18:15       ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACTLOFrwdpFDoFHz1FfJ53d5DTZDji_5k7O1UmCEbQT_yAavAw@mail.gmail.com \
    --to=ratmice@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=palves@redhat.com \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox