Skip to content

Commit

Permalink
Merge pull request #50 from gmbr3/v4_0
Browse files Browse the repository at this point in the history
Align CRT0 exit function naming
  • Loading branch information
ncroxon authored Nov 4, 2024
2 parents 9276df8 + be28887 commit 5ea320f
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 18 deletions.
5 changes: 3 additions & 2 deletions gnuefi/crt0-efi-aarch64-local.S
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,13 @@ _start:
adrp x1, _DYNAMIC
add x1, x1, #:lo12:_DYNAMIC
bl _relocate
cbnz x0, 0f
cbnz x0, .L_exit

ldp x0, x1, [sp, #16]
bl _entry

0: ldp x29, x30, [sp], #32
.L_exit:
ldp x29, x30, [sp], #32
ret

// hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:
Expand Down
7 changes: 4 additions & 3 deletions gnuefi/crt0-efi-aarch64.S
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@ _start:
adrp x1, _DYNAMIC
add x1, x1, #:lo12:_DYNAMIC
bl _relocate
cbnz x0, 0f
cbnz x0, .L_exit

ldp x0, x1, [sp, #16]
bl _entry

0: ldp x29, x30, [sp], #32
.L_exit:
ldp x29, x30, [sp], #32
ret

// hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:

.data
dummy0: .4byte 0
dummy1: .4byte 0
Expand Down
5 changes: 3 additions & 2 deletions gnuefi/crt0-efi-arm.S
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,13 @@ _start:
sub r0, r0, #0x1000
bl _relocate
teq r0, #0
bne 0f
bne .L_exit

ldmfd sp, {r0-r1}
bl _entry

0: add sp, sp, #12
.L_exit:
add sp, sp, #12
ldr pc, [sp], #4

.L_DYNAMIC:
Expand Down
5 changes: 3 additions & 2 deletions gnuefi/crt0-efi-ia32-local.S
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,12 @@ _start:
popl %ebx
popl %ebx
testl %eax,%eax
jne .exit
jne .L_exit

call _entry # call app with "image" and "systab" argument

.exit: leave
.L_exit:
leave
ret

// hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:
Expand Down
5 changes: 3 additions & 2 deletions gnuefi/crt0-efi-ia32.S
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ _start:
popl %ebx
popl %ebx
testl %eax,%eax
jne .exit
jne .L_exit

call _entry # call app with "image" and "systab" argument

.exit: leave
.L_exit:
leave
ret

// hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:
Expand Down
5 changes: 3 additions & 2 deletions gnuefi/crt0-efi-loongarch64.S
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ _start:
la.local $a0, ImageBase // a0: ImageBase
la.local $a1, _DYNAMIC // a1: DynamicSection
bl _relocate
bnez $a0, 0f
bnez $a0, .L_exit

ld.d $a0, $sp, 8
ld.d $a1, $sp, 16
bl _entry

0: ld.d $ra, $sp, 0
.L_exit:
ld.d $ra, $sp, 0
addi.d $sp, $sp, 24
jr $ra

Expand Down
5 changes: 3 additions & 2 deletions gnuefi/crt0-efi-riscv64-local.S
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,13 @@ _start:
lla a0, ImageBase
lla a1, _DYNAMIC
call _relocate
bne a0, zero, 0f
bne a0, zero, .L_exit
ld a1, 8(sp)
ld a0, 0(sp)
call _entry
ld ra, 16(sp)
0: addi sp, sp, 24
.L_exit:
addi sp, sp, 24
ret

// hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:
Expand Down
5 changes: 3 additions & 2 deletions gnuefi/crt0-efi-riscv64.S
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ _start:
lla a0, ImageBase
lla a1, _DYNAMIC
call _relocate
bne a0, zero, 0f
bne a0, zero, .L_exit
ld a1, 8(sp)
ld a0, 0(sp)
call _entry
ld ra, 16(sp)
0: addi sp, sp, 24
.L_exit:
addi sp, sp, 24
ret

// hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:
Expand Down
2 changes: 1 addition & 1 deletion gnuefi/crt0-efi-x86_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ _start:
call _entry
addq $8, %rsp

.exit:
.L_exit:
ret

// hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:
Expand Down

0 comments on commit 5ea320f

Please sign in to comment.