[uClibc-cvs] CVS update of uClibc/libc/sysdeps/linux/powerpc (Makefile crt0.S)
Joakim Tjernlund
jocke at codepoet.org
Fri Aug 27 15:14:55 UTC 2004
Date: Friday, August 27, 2004 @ 09:14:55
Author: jocke
Path: /var/cvs/uClibc/libc/sysdeps/linux/powerpc
Modified: Makefile (1.31 -> 1.32) crt0.S (1.9 -> 1.10)
Preliminary PIE support for powerpc, i386 was used as template.
Requested by Peter Mazinger. Testing wanted.
Index: uClibc/libc/sysdeps/linux/powerpc/Makefile
diff -u uClibc/libc/sysdeps/linux/powerpc/Makefile:1.31 uClibc/libc/sysdeps/linux/powerpc/Makefile:1.32
--- uClibc/libc/sysdeps/linux/powerpc/Makefile:1.31 Sat Aug 21 15:19:28 2004
+++ uClibc/libc/sysdeps/linux/powerpc/Makefile Fri Aug 27 09:14:55 2004
@@ -22,6 +22,9 @@
CRT0_SRC = crt0.S
CRT0_OBJ = crt0.o crt1.o
+ifeq ($(strip $(UCLIBC_PIE_SUPPORT)),y)
+CRT0_OBJ += Scrt0.o Scrt1.o
+endif
CRT0_DEPS=gmon-start.S
CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
@@ -41,6 +44,13 @@
ar-target: $(OBJS) $(CRT0_OBJ) $(CTOR_TARGETS)
$(AR) $(ARFLAGS) $(LIBC) $(OBJS)
cp $(CRT0_OBJ) $(TOPDIR)lib/
+ifeq ($(strip $(UCLIBC_PIE_SUPPORT)),y)
+ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
+ $(RM) $(TOPDIR)lib/Scrt0.o
+else
+ mv $(TOPDIR)lib/Scrt0.o $(TOPDIR)lib/Scrt1.o
+endif
+endif
$(CRT0_OBJ): $(CRT0_SRC)
$(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
Index: uClibc/libc/sysdeps/linux/powerpc/crt0.S
diff -u uClibc/libc/sysdeps/linux/powerpc/crt0.S:1.9 uClibc/libc/sysdeps/linux/powerpc/crt0.S:1.10
--- uClibc/libc/sysdeps/linux/powerpc/crt0.S:1.9 Sat Aug 21 15:19:28 2004
+++ uClibc/libc/sysdeps/linux/powerpc/crt0.S Fri Aug 27 09:14:55 2004
@@ -35,7 +35,7 @@
.section ".text"
.globl _start
.type _start, at function
-#if defined L_crt0 || ! defined __UCLIBC_CTOR_DTOR__
+#if defined L_crt0 || L_Scrt0 || ! defined __UCLIBC_CTOR_DTOR__
.type __uClibc_main,%function
#else
.weak _init
@@ -66,16 +66,29 @@
addi r5,r5,1
rlwinm r5,r5,2,0,29
add r5,r5,r4
-
+#if defined L_Scrt0 || defined L_Scrt1
+ bl _GLOBAL_OFFSET_TABLE_-4 at local
+ mflr r31
+#endif
/* Ok, now run uClibc's main() -- shouldn't return */
-#if (defined L_crt1) && defined __UCLIBC_CTOR_DTOR__
+#if (defined L_crt1 || defined L_Scrt1) && defined __UCLIBC_CTOR_DTOR__
+# ifdef L_Scrt1
+ lwz r6,_init at got(r31)
+ lwz r7,_fini at got(r31)
+ bl __uClibc_start_main at plt
+# else
lis r6,_init at ha # load top 16 bits
addi r6,r6,_init at l # load bottom 16 bits
lis r7,_fini at ha # load top 16 bits of &msg
addi r7,r7,_fini at l # load bottom 16 bits
bl __uClibc_start_main
+# endif
#else
+# ifdef L_Scrt0
+ bl __uClibc_main at plt
+# else
bl __uClibc_main
+# endif
#endif
.size _start,.-_start
More information about the uClibc-cvs
mailing list