summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>2005-03-21 10:40:38 +0000
committerJoakim Tjernlund <joakim.tjernlund@transmode.se>2005-03-21 10:40:38 +0000
commit98c8f32c52d179c4f12b6c719dc0f2fceaa3037d (patch)
tree6db969d79bb6311fd2b0b11647766c5cc82c48fd
parent748c2fe4247540c1ffa333705d7384f6da41da4f (diff)
Prepare for moving ldso FINI handling to libc by passing _dl_fini. This should not break ABI.
Minor cleanup as well.
-rw-r--r--ldso/ldso/powerpc/dl-startup.h30
1 files changed, 26 insertions, 4 deletions
diff --git a/ldso/ldso/powerpc/dl-startup.h b/ldso/ldso/powerpc/dl-startup.h
index 8f67c3610..d86dd13c7 100644
--- a/ldso/ldso/powerpc/dl-startup.h
+++ b/ldso/ldso/powerpc/dl-startup.h
@@ -10,12 +10,34 @@ asm(
" .type _start,@function\n"
"_start:\n"
" mr 3,1\n" /* Pass SP to _dl_start in r3 */
- " addi 1,1,-16\n" /* Make room on stack for _dl_start to store LR */
- " li 4,0\n"
- " stw 4,0(1)\n" /* Clear Stack frame */
+ " li 0,0\n"
+ " stwu 1,-16(1)\n" /* Make room on stack for _dl_start to store LR */
+ " stw 0,0(1)\n" /* Clear Stack frame */
" bl _dl_start@local\n" /* Perform relocation */
+ /* Save the address of the apps entry point in CTR register */
+ " mtctr 3\n" /* application entry point */
+ " bl _GLOBAL_OFFSET_TABLE_-4@local\n" /* Put our GOT pointer in r31, */
+ " mflr 31\n"
" addi 1,1,16\n" /* Restore SP */
- " mtctr 3\n" /* Load applications entry point */
+#if 0
+ /* Try beeing SVR4 ABI compliant?, even though it is not needed for uClibc on Linux */
+ /* argc */
+ " lwz 3,0(1)\n"
+ /* find argv one word offset from the stack pointer */
+ " addi 4,1,4\n"
+ /* find environment pointer (argv+argc+1) */
+ " lwz 5,0(1)\n"
+ " addi 5,5,1\n"
+ " rlwinm 5,5,2,0,29\n"
+ " add 5,5,4\n"
+ /* pass the auxilary vector in r6. This is passed to us just after _envp. */
+ "2: lwzu 0,4(6)\n"
+ " cmpwi 0,0\n"
+ " bne 2b\n"
+ " addi 6,6,4\n"
+#endif
+ /* Pass a termination function pointer (in this case _dl_fini) in r7. */
+ " lwz 7,_dl_fini@got(31)\n"
" bctr\n" /* Jump to entry point */
" .size _start,.-_start\n"
" .previous\n"