This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: __executable_start


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]