Hurd: Use __executable_start symbol instead of _start.

_start points to the first instruction, not to the ELF header.
__executable_start does point on the ELF header.
This commit is contained in:
Samuel Thibault 2007-06-24 17:45:35 +02:00 committed by Thomas Schwinge
parent d821f07c9e
commit ed479b02c2
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2013-08-29 Samuel Thibault <samuel.thibault@ens-lyon.org>
* sysdeps/mach/hurd/i386/init-first.c (init1): Use
__executable_start symbol instead of _start.
2013-08-29 Thomas Schwinge <thomas@codesourcery.com> 2013-08-29 Thomas Schwinge <thomas@codesourcery.com>
* sysdeps/unix/sysv/linux/ldsodefs.h (VALID_ELF_HEADER) * sysdeps/unix/sysv/linux/ldsodefs.h (VALID_ELF_HEADER)

View File

@ -122,8 +122,8 @@ init1 (int argc, char *arg0, ...)
/* We may need to see our own phdrs, e.g. for TLS setup. /* We may need to see our own phdrs, e.g. for TLS setup.
Try the usual kludge to find the headers without help from Try the usual kludge to find the headers without help from
the exec server. */ the exec server. */
extern const void _start; extern const void __executable_start;
const ElfW(Ehdr) *const ehdr = &_start; const ElfW(Ehdr) *const ehdr = &__executable_start;
_dl_phdr = (const void *) ehdr + ehdr->e_phoff; _dl_phdr = (const void *) ehdr + ehdr->e_phoff;
_dl_phnum = ehdr->e_phnum; _dl_phnum = ehdr->e_phnum;
assert (ehdr->e_phentsize == sizeof (ElfW(Phdr))); assert (ehdr->e_phentsize == sizeof (ElfW(Phdr)));