diff options
author | Roland McGrath <roland@hack.frob.com> | 2013-03-28 16:15:48 -0700 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2013-03-28 16:15:48 -0700 |
commit | 288f7d79fe2dcc8e62c539f57b25d7662a2cd5ff (patch) | |
tree | 01fbd48750047a5246b6bcc6d6551eb18bbdd4e3 /sysdeps/mach | |
parent | dc0a02638583d8e7f7e1cc72643d1b26ec6042fd (diff) | |
download | glibc-288f7d79fe2dcc8e62c539f57b25d7662a2cd5ff.zip glibc-288f7d79fe2dcc8e62c539f57b25d7662a2cd5ff.tar.gz glibc-288f7d79fe2dcc8e62c539f57b25d7662a2cd5ff.tar.bz2 |
Use __ehdr_start, if available, as fallback for AT_PHDR.
Diffstat (limited to 'sysdeps/mach')
-rw-r--r-- | sysdeps/mach/hurd/i386/init-first.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c index 59253db..fc3330c 100644 --- a/sysdeps/mach/hurd/i386/init-first.c +++ b/sysdeps/mach/hurd/i386/init-first.c @@ -117,14 +117,20 @@ init1 (int argc, char *arg0, ...) if ((void *) d == argv[0]) { #ifndef SHARED - /* We may need to see our own phdrs, e.g. for TLS setup. - Try the usual kludge to find the headers without help from - the exec server. */ - extern const void _start; - const ElfW(Ehdr) *const ehdr = &_start; - _dl_phdr = (const void *) ehdr + ehdr->e_phoff; - _dl_phnum = ehdr->e_phnum; - assert (ehdr->e_phentsize == sizeof (ElfW(Phdr))); + /* With a new enough linker (binutils-2.23 or better), + the magic __ehdr_start symbol will be available and + __libc_start_main will have done this that way already. */ + if (_dl_phdr == NULL) + { + /* We may need to see our own phdrs, e.g. for TLS setup. + Try the usual kludge to find the headers without help from + the exec server. */ + extern const void _start; + const ElfW(Ehdr) *const ehdr = &_start; + _dl_phdr = (const void *) ehdr + ehdr->e_phoff; + _dl_phnum = ehdr->e_phnum; + assert (ehdr->e_phentsize == sizeof (ElfW(Phdr))); + } #endif return; } |