소스 검색

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.
Rich Felker 11 년 전
부모
커밋
0311d1dd17
1개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 3
      src/ldso/microblaze/start.s

+ 4 - 3
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