mirror of
https://github.com/fluencelabs/musl
synced 2025-06-14 07:21:40 +00:00
cleanup dynamic linker start code cruft
two actual issues: one is that __dynlink no longer wants/needs a GOT pointer argument, so the code to generate that argument can be removed. the other issue was that in the i386 code, argc/argv were being loaded into registers that would be call-clobbered, then copied to preserved registers, rather than just being loaded into the proper call-preserved registers to begin with. this cleanup is in preparation for adding new dynamic linker functionality (ability to explicitly invoke the dynamic linker to run a program).
This commit is contained in:
@ -3,12 +3,9 @@
|
|||||||
_start:
|
_start:
|
||||||
ldr r0,[sp]
|
ldr r0,[sp]
|
||||||
add r1,sp,#4
|
add r1,sp,#4
|
||||||
ldr r2,2f
|
bl __dynlink
|
||||||
add r2,pc,r2
|
|
||||||
1: bl __dynlink
|
|
||||||
mov r1,r0
|
mov r1,r0
|
||||||
mov r0,#0
|
mov r0,#0
|
||||||
tst r1,#1
|
tst r1,#1
|
||||||
moveq pc,r1
|
moveq pc,r1
|
||||||
bx r1
|
bx r1
|
||||||
2: .word _GLOBAL_OFFSET_TABLE_ - 1b - 4
|
|
||||||
|
@ -2,16 +2,13 @@
|
|||||||
.global _start
|
.global _start
|
||||||
_start:
|
_start:
|
||||||
xor %ebp,%ebp
|
xor %ebp,%ebp
|
||||||
pop %ecx
|
pop %edi
|
||||||
mov %esp,%eax
|
mov %esp,%esi
|
||||||
and $-16,%esp
|
and $-16,%esp
|
||||||
mov %eax,%esi
|
|
||||||
mov %ecx,%edi
|
|
||||||
push %ebp
|
push %ebp
|
||||||
call 1f
|
push %ebp
|
||||||
1: addl $_GLOBAL_OFFSET_TABLE_,(%esp)
|
push %esi
|
||||||
push %eax
|
push %edi
|
||||||
push %ecx
|
|
||||||
call __dynlink
|
call __dynlink
|
||||||
mov %esi,%esp
|
mov %esi,%esp
|
||||||
push %edi
|
push %edi
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
_start:
|
_start:
|
||||||
mov (%rsp),%rdi
|
mov (%rsp),%rdi
|
||||||
lea 8(%rsp),%rsi
|
lea 8(%rsp),%rsi
|
||||||
lea _GLOBAL_OFFSET_TABLE_(%rip),%rdx
|
|
||||||
call __dynlink
|
call __dynlink
|
||||||
xor %edx,%edx
|
xor %edx,%edx
|
||||||
jmp *%rax
|
jmp *%rax
|
||||||
|
Reference in New Issue
Block a user