Browse Source

Teach initfini to build properly on arches where gcc tries to be
sneaky behind our back...
-Erik

Eric Andersen 23 years ago
parent
commit
9f18d3e1a8
2 changed files with 18 additions and 0 deletions
  1. 8 0
      extra/scripts/initfini.pl
  2. 10 0
      libc/sysdeps/linux/common/initfini.c

+ 8 - 0
extra/scripts/initfini.pl

@@ -81,6 +81,14 @@ while(<INITFINI>) {
 	$omitcrti = 0;
 	next;
     }
+    if (/PROLOG_PAUSES/) {
+	$omitcrti = 1;
+	next;
+    }
+    if (/PROLOG_UNPAUSES/) {
+	$omitcrti = 0;
+	next;
+    }
     if (/PROLOG_ENDS/) {
 	$omitcrti = 1;
 	next;

+ 10 - 0
libc/sysdeps/linux/common/initfini.c

@@ -84,6 +84,16 @@ _init (void)
      module which has a constructor; but then user code's constructors
      would come first, and not be profiled.  */
   call_gmon_start ();
+#else
+  asm ("\n/*@_init_PROLOG_PAUSES*/");
+  {
+    /* Let GCC know that _init is not a leaf function by having a dummy
+     * function call here.  We arrange for this call to be omitted from
+     * either crt file.  */
+    extern void i_am_not_a_leaf (void);
+    i_am_not_a_leaf ();
+  }
+  asm ("\n/*@_init_PROLOG_UNPAUSES*/");
 #endif
 
   asm ("ALIGN");