about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-12-14 19:51:48 -0500
committerRich Felker <dalias@aerifal.cx>2013-12-14 19:51:48 -0500
commit0311d1dd17ca88da6edd61b6535ec8637642dfe4 (patch)
tree1f9ee3c65fc9e9802a9c9118c52583a7c89ec916 /src
parent2b7cf6dbb9d56c5fac8f673e7c9d06c81d312af5 (diff)
downloadmusl-0311d1dd17ca88da6edd61b6535ec8637642dfe4.tar.gz
musl-0311d1dd17ca88da6edd61b6535ec8637642dfe4.tar.xz
musl-0311d1dd17ca88da6edd61b6535ec8637642dfe4.zip
fix dynamic linker entry point for microblaze
the ABI allows the callee to clobber stack slots that correspond to
arguments passed in registers, so the caller must adjust the stack
pointer to reserve space appropriately. prior to this fix, the argv
array was possibly clobbered by dynamic linker code before passing
control to the main program.
Diffstat (limited to 'src')
-rw-r--r--src/ldso/microblaze/start.s7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ldso/microblaze/start.s b/src/ldso/microblaze/start.s
index 5ffbcbae..4e0a0e50 100644
--- a/src/ldso/microblaze/start.s
+++ b/src/ldso/microblaze/start.s
@@ -9,11 +9,12 @@ _start:
 	addi    r7, r7, _GLOBAL_OFFSET_TABLE_+8
 	addi    r7, r7, _DYNAMIC@GOTOFF
 	brlid   r15, __reloc_self@PLT
-	nop
+	addik   r1, r1, -16
 
-	lwi     r5, r1, 0
+	lwi     r5, r1, 16
 	brlid   r15, __dynlink@PLT
-	addi    r6, r1, 4
+	addi    r6, r1, 20
+	addik   r1, r1, 16
 
 	lwi     r4, r1, 0
 1:	lwi     r5, r1, 4