about summary refs log tree commit diff
path: root/elf/dl-open.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-open.c')
-rw-r--r--elf/dl-open.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 84a76cfb4a..b984aa8f89 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -1,5 +1,5 @@
 /* Load a shared object at runtime, relocate it, and run its initializer.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -93,6 +93,13 @@ _dl_open (const char *file, int mode)
 	     between when _dl_object_relocation_scope returns and when we
 	     enter the dynamic linker's code (_dl_relocate_object).  */
 	  __typeof (_dl_relocate_object) *reloc = &_dl_relocate_object;
+
+	  /* GCC is very clever.  If we wouldn't add some magic it would
+	     simply optimize away our nice little variable `reloc' and we
+	     would result in a not working binary.  So let's swing the
+	     magic ward.  */
+	  asm ("" : "=r" (reloc) : "0" (reloc));
+
 	  (*reloc) (l, _dl_object_relocation_scope (l),
 		    (mode & RTLD_BINDING_MASK) == RTLD_LAZY);
 	  *_dl_global_scope_end = NULL;