This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: __executable_start
- From: Emilio Pozuelo Monfort <pochu27 at gmail dot com>
- To: Thomas Schwinge <thomas at codesourcery dot com>
- Cc: Roland McGrath <roland at hack dot frob dot com>, libc-alpha at sourceware dot org, bug-hurd at gnu dot org
- Date: Sun, 26 May 2013 18:15:30 +0200
- Subject: Re: __executable_start
- References: <20061106-162243 dot sv33391 dot 95744 at savannah dot gnu dot org> <20061106-163926 dot sv33391 dot 3217 at savannah dot gnu dot org> <20070612-021101 dot sv13138 dot 26156 at savannah dot gnu dot org> <20070613-044302 dot sv13138 dot 42718 at savannah dot gnu dot org> <20070613-063711 dot sv13138 dot 86063 at savannah dot gnu dot org> <20070613-063821 dot sv13138 dot 28638 at savannah dot gnu dot org> <20070613-075056 dot sv13138 dot 72692 at savannah dot gnu dot org> <20070613-075935 dot sv13138 dot 27391 at savannah dot gnu dot org> <20070614-000207 dot sv13138 dot 96203 at savannah dot gnu dot org> <20070624-160912 dot sv13138 dot 20130 at savannah dot gnu dot org> <20070624154535 dot GK4668 at interface dot famille dot thibault dot fr> <874ndpiz6o dot fsf at kepler dot schwinge dot homeip dot net>
Hi,
On 26/05/13 16:38, Thomas Schwinge wrote:
Hi!
Re-submitting an oldie of Samuel's:
On Sun, 24 Jun 2007 17:45:35 +0200, Samuel Thibault <samuel.thibault@ens-lyon.org> wrote:
- _start points on the first instruction, not on the elf header.
__executable_start does point on the elf header.
--- sysdeps/mach/hurd/i386/init-first.c.orig 2007-06-23 19:27:14.000000000 +0000
+++ sysdeps/mach/hurd/i386/init-first.c 2007-06-23 21:41:40.000000000 +0000
@@ -116,14 +116,14 @@
/* 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;
+ extern const void __executable_start;
+ const ElfW(Ehdr) *const ehdr = &__executable_start;
_dl_phdr = (ElfW(Phdr) *) ((const void *) ehdr + ehdr->e_phoff);
_dl_phnum = ehdr->e_phnum;
assert (ehdr->e_phentsize == sizeof (ElfW(Phdr)));
This is, as far as I can tell, the only such usage of _start in glibc.
OK to commit?
* sysdeps/mach/hurd/i386/init-first.c (init1): Use
__executable_start symbol intsead instead of _start.
Typo there, s/intsead//. Won't comment on the patch itself as I'm no ELF expert.
Cheers,
Emilio
diff --git sysdeps/mach/hurd/i386/init-first.c sysdeps/mach/hurd/i386/init-first.c
index fc3330c..7031ed4 100644
--- sysdeps/mach/hurd/i386/init-first.c
+++ sysdeps/mach/hurd/i386/init-first.c
@@ -125,8 +125,8 @@ init1 (int argc, char *arg0, ...)
/* 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;
+ extern const void __executable_start;
+ const ElfW(Ehdr) *const ehdr = &__executable_start;
_dl_phdr = (const void *) ehdr + ehdr->e_phoff;
_dl_phnum = ehdr->e_phnum;
assert (ehdr->e_phentsize == sizeof (ElfW(Phdr)));
GrÃÃe,
Thomas