summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps/linux/powerpc/crt1.S
diff options
context:
space:
mode:
authorCarmelo Amoroso <carmelo.amoroso@st.com>2008-06-18 16:59:33 +0000
committerCarmelo Amoroso <carmelo.amoroso@st.com>2008-06-18 16:59:33 +0000
commitf3c549ad2d6056d81ad709040f485a5b3b14ac79 (patch)
treefb00d87f25aa2f07767ce0f6dd6b6cd255968ea6 /libc/sysdeps/linux/powerpc/crt1.S
parent3d17dd647a04ad0837b063a610520fb6defb2d8d (diff)
downloaduClibc-alpine-f3c549ad2d6056d81ad709040f485a5b3b14ac79.tar.bz2
uClibc-alpine-f3c549ad2d6056d81ad709040f485a5b3b14ac79.tar.xz
Synch libc powerpc/arm/sh64/m68k/alpha/microblaze/i960/vax/e1 specific with trunk
Diffstat (limited to 'libc/sysdeps/linux/powerpc/crt1.S')
-rw-r--r--libc/sysdeps/linux/powerpc/crt1.S14
1 files changed, 12 insertions, 2 deletions
diff --git a/libc/sysdeps/linux/powerpc/crt1.S b/libc/sysdeps/linux/powerpc/crt1.S
index 7928a7ed3..4f1494a8f 100644
--- a/libc/sysdeps/linux/powerpc/crt1.S
+++ b/libc/sysdeps/linux/powerpc/crt1.S
@@ -58,6 +58,13 @@ _start:
mflr r31
# endif
#endif
+ /* Set up the small data pointer in r13. */
+#ifdef __PIC__
+ lwz r13,_SDA_BASE_@got(r31)
+#else
+ lis r13,_SDA_BASE_@ha
+ addi r13,r13,_SDA_BASE_@l
+#endif
/* Set up an initial stack frame, and clear the LR. */
li r0,0
stwu r1,-16(r1)
@@ -67,8 +74,11 @@ _start:
lwz r4,0(r9)
/* find argv one word offset from the stack pointer */
addi r5,r9,4
- mr r8,r3 /* Pass _dl_fini from ldso or NULL if statically linked
- Note: using r3 instead of r7, since linux 2.6 clobbers r7 */
+ mr r8,r3 /* Pass _dl_fini from ldso or NULL if statically linked */
+ /* Note: PPC depends on the kernel to zero r3 before */
+ /* handing over to user space, otherwise static apps */
+ /* will SEGV during exit() */
+
/* Ok, now run uClibc's main() -- shouldn't return */
#ifdef __PIC__
lwz r6,_init@got(r31)