From b91b4d00d0bdc9c29a43a3cf859f1444273495cd Mon Sep 17 00:00:00 2001
From: "\"Steven J. Hill\"" <sjhill@realitydiluted.com>
Date: Mon, 20 May 2002 18:35:43 +0000
Subject: Changes needed for MIPS with regards to the .init and .fini sections.

---
 extra/scripts/initfini.pl            | 13 +++++++++----
 libc/sysdeps/linux/common/initfini.c |  4 ----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/extra/scripts/initfini.pl b/extra/scripts/initfini.pl
index ec6bdb36b..7c592daac 100755
--- a/extra/scripts/initfini.pl
+++ b/extra/scripts/initfini.pl
@@ -31,19 +31,20 @@ if ($initfini) {
 } else {
     die "(fatal) Please give me an --initfini argument$!";
 }
-while($line = <INITFINI>) {
-    if ($line =~ /^\w\.endp/) {
+while(<INITFINI>) {
+    if (/\.endp/) {
 	$endp=1;
 	next;
     }
-    if ($line =~ /^\w\.end/) {
+    if (/\.end/) {
 	$end=1;
 	next;
     }
-    if ($line =~ /\w\.align\(.*\)/) {
+    if (/\.align(.*)/) {
 	$alignval=$1;
 	next;
     }
+
 }
 close(INITFINI);
 
@@ -79,8 +80,12 @@ while(<INITFINI>) {
     }
     if (/PROLOG_BEGINS/) {
 	$omitcrti = 0;
+	$omitcrtn = 0;
 	next;
     }
+    if (/^_init:/ || /^_fini:/) {
+	$omitcrtn = 1;
+    }
     if (/PROLOG_PAUSES/) {
 	$omitcrti = 1;
 	next;
diff --git a/libc/sysdeps/linux/common/initfini.c b/libc/sysdeps/linux/common/initfini.c
index 4f95fbfd1..a0b2869d9 100644
--- a/libc/sysdeps/linux/common/initfini.c
+++ b/libc/sysdeps/linux/common/initfini.c
@@ -101,9 +101,7 @@ _init (void)
   /* Now the epilog. */
   asm ("\n/*@_init_PROLOG_ENDS*/");
   asm ("\n/*@_init_EPILOG_BEGINS*/");
-  SECTION(".init");
 }
-asm ("END_INIT");
 
 /* End of the _init epilog, beginning of the _fini prolog. */
 asm ("\n/*@_init_EPILOG_ENDS*/");
@@ -130,9 +128,7 @@ _fini (void)
 
   /* Beginning of the _fini epilog. */
   asm ("\n/*@_fini_EPILOG_BEGINS*/");
-  SECTION (".fini");
 }
-asm ("END_FINI");
 
 /* End of the _fini epilog.  Any further generated assembly (e.g. .ident)
    is shared between both crt files. */
-- 
cgit v1.2.3