summary refs log tree commit diff
path: root/csu/initfini.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-01-24 01:34:10 +0000
committerRoland McGrath <roland@gnu.org>1996-01-24 01:34:10 +0000
commitfd86137937b2be15f18c6564f39aa51fd0c48b00 (patch)
treedc7bfce2017d697a0d04ddd170f27840151fdf64 /csu/initfini.c
parent1d8dc4293f772369e2da018ba5f1bf6e67967f3a (diff)
downloadglibc-fd86137937b2be15f18c6564f39aa51fd0c48b00.tar.gz
glibc-fd86137937b2be15f18c6564f39aa51fd0c48b00.tar.xz
glibc-fd86137937b2be15f18c6564f39aa51fd0c48b00.zip
(dl_main): Support additional args in --list mode for debugging: look them up as symbol names and print values.
Diffstat (limited to 'csu/initfini.c')
-rw-r--r--csu/initfini.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/csu/initfini.c b/csu/initfini.c
index a3c3b3b7bc..e1bf2b8284 100644
--- a/csu/initfini.c
+++ b/csu/initfini.c
@@ -59,6 +59,7 @@ cp crti.s-new crtn.s-new");
 
 /* Append the .init prologue to crti.s-new.  */
 asm ("cat >> crti.s-new <<\\EOF.crti.init");
+
 SECTION (".init")
 void
 _init (void)
@@ -69,10 +70,13 @@ _init (void)
      gcrt1.o to reference a symbol which would be defined by some library
      module which has a constructor; but then user code's constructors
      would come first, and not be profiled.  */
-  extern void __gmon_start__ (void) __attribute__ ((weak));
+  extern volatile void __gmon_start__ (void) __attribute__ ((weak));
+  /* This volatile variable is necessary to avoid GCC optimizing
+     out the test.  */
+  register volatile void (*g) (void) = &__gmon_start__;
   weak_symbol (__gmon_start__)
-  if (&__gmon_start__)
-    __gmon_start__ ();
+  if (g)
+    (*g) ();
 
   /* End the here document containing the .init prologue code.
      Then fetch the .section directive just written and append that