]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/generic/initfini.c
Update.
[thirdparty/glibc.git] / sysdeps / generic / initfini.c
index 4c43941ad0c9de465fac545258716fdbf3891658..836d606cfdbf9d9fe2ec9b219c9bc7c55c496dde 100644 (file)
@@ -61,6 +61,16 @@ asm ("\n/*@TESTS_END*/");
 /* The beginning of _init:  */
 asm ("\n/*@_init_PROLOG_BEGINS*/");
 
+static void
+call_gmon_start(void)
+{
+  extern void __gmon_start__ (void) __attribute__ ((weak)); /*weak_extern (__gmon_start__);*/
+  void (*gmon_start) (void) = __gmon_start__;
+
+  if (gmon_start)
+    gmon_start ();  
+}
+
 SECTION (".init");
 void
 _init (void)
@@ -71,15 +81,7 @@ _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)); /*weak_extern (__gmon_start__);*/
-#ifndef WEAK_GMON_START
-  __gmon_start__ ();
-#else
-  void (*gmon_start) (void) = __gmon_start__;
-
-  if (gmon_start)
-    gmon_start ();
-#endif
+  call_gmon_start ();
 
   asm ("ALIGN");
   asm("END_INIT");
@@ -89,19 +91,6 @@ _init (void)
   SECTION(".init");
 }
 asm ("END_INIT");
-#ifndef WEAK_GMON_START
-SECTION(".text");
-
-/* This version of __gmon_start__ is used if no other is found.  By providing
-   a default function we avoid the need to test whether the pointer is NULL,
-   which can be painful on some machines.  */
-
-void __attribute__ ((weak))
-__gmon_start__ (void)
-{
-  /* do nothing */
-}
-#endif
 
 /* End of the _init epilog, beginning of the _fini prolog. */
 asm ("\n/*@_init_EPILOG_ENDS*/");