summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>2007-03-19 18:02:16 +0000
committerJoakim Tjernlund <joakim.tjernlund@transmode.se>2007-03-19 18:02:16 +0000
commit3850723af0f79ba4c5bcf701bd227b06340be6bb (patch)
tree62259aeaadd40aeada011c4d0507569c1867b902
parentee238d84145433dd5df45adffe523ae8ddcc650f (diff)
Joseph S. Myers writes:
On PowerPC, r13 is used for a small data pointer and needs to be set up from _SDA_BASE_ (defined by the linker) at startup. This is needed for the GCC testcase gcc.target/powerpc/980827-1.c to work. This patch fixes that testcase (verified for both static and dynamic linking).
-rw-r--r--libc/sysdeps/linux/powerpc/crt1.S7
1 files changed, 7 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/powerpc/crt1.S b/libc/sysdeps/linux/powerpc/crt1.S
index 7928a7ed3..8798849b3 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)