Hi!

Re-submitting an oldie of Samuel's:

On Sun, 24 Jun 2007 17:45:35 +0200, Samuel Thibault 
<samuel.thiba...@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.

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

Attachment: pgp_HpbhK3R37.pgp
Description: PGP signature

Reply via email to