فهرست منبع

make sh crti/crtn init/fini fragments setup proper stack frame

for fdpic support is is essential that the got pointer be saved at a
known, ABI-dictated offset from the frame pointer, since there is no
way to recover it once it's lost.
Rich Felker 9 سال پیش
والد
کامیت
ad5d8a2bf3
2فایلهای تغییر یافته به همراه14 افزوده شده و 2 حذف شده
  1. 8 0
      crt/sh/crti.s
  2. 6 2
      crt/sh/crtn.s

+ 8 - 0
crt/sh/crti.s

@@ -2,12 +2,20 @@
 .global  _init
 .type    _init, @function
 _init:
+	add #-4, r15
+	mov.l r12, @-r15
+	mov.l r14, @-r15
 	sts.l pr, @-r15
+	mov r15, r14
 	nop
 
 .section .fini
 .global  _fini
 .type    _fini, @function
 _fini:
+	add #-4, r15
+	mov.l r12, @-r15
+	mov.l r14, @-r15
 	sts.l pr, @-r15
+	mov r15, r14
 	nop

+ 6 - 2
crt/sh/crtn.s

@@ -1,9 +1,13 @@
 .section .init
 	lds.l @r15+, pr
+	mov.l @r15+, r14
+	mov.l @r15+, r12
 	rts
-	 nop
+	 add #4, r15
 
 .section .fini
 	lds.l @r15+, pr
+	mov.l @r15+, r14
+	mov.l @r15+, r12
 	rts
-	 nop
+	 add #4, r15