Skip to content

Commit 009bcc9

Browse files
committed
Change ARM code to use position independent code
This is all arising from issue #68 and PR #76. It seems that MacOS Arm64 does not like the use of relocation in the original switch-arm64.c code. This arises from a single instruction ldr lr, =action_entry As action_entry is extremely close to this code this can simply be replaced with adr lr, action_entry for both ARM32 and ARM64.
1 parent da8b793 commit 009bcc9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

context/switch-arm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ FSIZE(switch_frame)
6868
FNAME(create_frame)
6969
" stmfd r0!, {r1, r2}\n" // Save arguments for new coroutine
7070
" mov ip, lr\n" // Save LR so can use same STM slot
71-
" ldr lr, =action_entry\n"
71+
" adr lr, action_entry\n"
7272
" stmfd r0!, {r4, r5, r6, r7, r8, r9, sl, fp, lr}\n"
7373
IF_VFP_FP(
7474
" fstmfdd r0!, {d8-d15}\n")

context/switch-arm64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ FSIZE(switch_frame)
105105
FNAME(create_frame)
106106
" stp x1, x2, [x0, #-16]!\n"
107107
" mov x16, lr\n" // Save LR so can use same STP slot
108-
" ldr lr, =action_entry\n"
108+
" adr lr, action_entry\n"
109109
" stp x19, x20, [x0, #-16]!\n"
110110
" stp x21, x22, [x0, #-16]!\n"
111111
" stp x23, x24, [x0, #-16]!\n"

0 commit comments

Comments
 (0)