about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-08-23 10:35:03 +0000
committerRoland McGrath <roland@gnu.org>2002-08-23 10:35:03 +0000
commit16495f81270e72edf3a8faae19dd0e0b22373cf1 (patch)
tree8752fda456facd34f9d8334c5b2241483fa7fa96 /sysdeps
parent3d31e109a09d665b1551a90d8c3369d83aac37df (diff)
downloadglibc-16495f81270e72edf3a8faae19dd0e0b22373cf1.tar.gz
glibc-16495f81270e72edf3a8faae19dd0e0b22373cf1.tar.xz
glibc-16495f81270e72edf3a8faae19dd0e0b22373cf1.zip
* 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.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/i386/dl-machine.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 8092e889b0..09c1a9b6a4 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -49,10 +49,14 @@ elf_machine_dynamic (void)
 static inline Elf32_Addr __attribute__ ((unused))
 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;
   asm ("leal _dl_start@GOTOFF(%%ebx), %0\n"
        "subl _dl_start@GOT(%%ebx), %0"
-       : "=r" (addr) : : "cc");
+       : "=r" (addr) : "m" (_dl_argc) : "cc");
   return addr;
 }