mirror of git://sourceware.org/git/glibc.git
* sysdeps/i386/dl-machine.h (elf_machine_load_address): Add a dummy
global variable reference in an unused asm parameter, to ensure the compiler has set up the GOT register before we use it.
This commit is contained in:
parent
3d31e109a0
commit
16495f8127
|
|
@ -1,5 +1,9 @@
|
||||||
2002-08-23 Roland McGrath <roland@redhat.com>
|
2002-08-23 Roland McGrath <roland@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/i386/dl-machine.h (elf_machine_load_address): Add a dummy
|
||||||
|
global variable reference in an unused asm parameter, to ensure the
|
||||||
|
compiler has set up the GOT register before we use it.
|
||||||
|
|
||||||
* malloc/hooks.c: Move variable definitions ahead of uses.
|
* malloc/hooks.c: Move variable definitions ahead of uses.
|
||||||
* libio/fileops.c: Move versioned_symbol defns ahead of _IO_jump_t
|
* libio/fileops.c: Move versioned_symbol defns ahead of _IO_jump_t
|
||||||
initializers that make reference to variables they define.
|
initializers that make reference to variables they define.
|
||||||
|
|
|
||||||
|
|
@ -49,10 +49,14 @@ elf_machine_dynamic (void)
|
||||||
static inline Elf32_Addr __attribute__ ((unused))
|
static inline Elf32_Addr __attribute__ ((unused))
|
||||||
elf_machine_load_address (void)
|
elf_machine_load_address (void)
|
||||||
{
|
{
|
||||||
|
/* It doesn't matter what variable this is, the reference never makes
|
||||||
|
it to assembly. We need a dummy reference to some global variable
|
||||||
|
via the GOT to make sure the compiler initialized %ebx in time. */
|
||||||
|
extern int _dl_argc;
|
||||||
Elf32_Addr addr;
|
Elf32_Addr addr;
|
||||||
asm ("leal _dl_start@GOTOFF(%%ebx), %0\n"
|
asm ("leal _dl_start@GOTOFF(%%ebx), %0\n"
|
||||||
"subl _dl_start@GOT(%%ebx), %0"
|
"subl _dl_start@GOT(%%ebx), %0"
|
||||||
: "=r" (addr) : : "cc");
|
: "=r" (addr) : "m" (_dl_argc) : "cc");
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue