[uClibc][PATCH] MIPS dynamic linker patch and init/fini changes...

Steven J. Hill sjhill at realitydiluted.com
Wed May 15 13:02:21 UTC 2002


This patch is needed for some MIPS platforms and also cleans up
code for the init/fini symbols and assembly that is emitted. Please
apply. Thanks.

-Steve

diff -urN uclibc/extra/scripts/initfini.pl uclibc-patched/extra/scripts/initfini.pl
--- uclibc/extra/scripts/initfini.pl	Wed Apr  3 08:09:24 2002
+++ uclibc-patched/extra/scripts/initfini.pl	Wed May 15 07:45:55 2002
@@ -31,19 +31,20 @@
 } 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,7 +80,11 @@
     }
     if (/PROLOG_BEGINS/) {
 	$omitcrti = 0;
+	$omitcrtn = 0;
 	next;
+    }
+    if (/^_init:/ || /^_fini:/) {
+	$omitcrtn = 1;
     }
     if (/PROLOG_PAUSES/) {
 	$omitcrti = 1;
diff -urN uclibc/ldso/ldso/mips/boot1_arch.h uclibc-patched/ldso/ldso/mips/boot1_arch.h
--- uclibc/ldso/ldso/mips/boot1_arch.h	Thu May  2 07:44:52 2002
+++ uclibc-patched/ldso/ldso/mips/boot1_arch.h	Wed May 15 07:45:55 2002
@@ -16,8 +16,11 @@
 	sw $4, -0x7ff0($28)
 	move $4, $29
 	la $8, coff
-	bltzal $8, coff
+	.set noreorder
+	bltzal $0, coff
+	nop
 coff:	subu $8, $31, $8
+	.set reorder
 	la $25, _dl_boot2
 	addu $25, $8
 	jalr $25
diff -urN uclibc/libc/sysdeps/linux/common/initfini.c uclibc-patched/libc/sysdeps/linux/common/initfini.c
--- uclibc/libc/sysdeps/linux/common/initfini.c	Wed Apr  3 08:09:25 2002
+++ uclibc-patched/libc/sysdeps/linux/common/initfini.c	Wed May 15 07:45:55 2002
@@ -101,9 +101,7 @@
   /* 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 @@
 
   /* 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. */



More information about the uClibc mailing list