Skip to content

Commit eb7f512

Browse files
committed
main: Fix link error with lld
Signed-off-by: Akira Moroo <[email protected]>
1 parent 8208cfe commit eb7f512

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

main.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,12 @@ void ____asm_impl(void) {
118118
".globl enter_syscall \n\t"
119119
"enter_syscall: \n\t"
120120
"mov x8, x6 \n\t"
121-
"ldr x6, =syscall_table \n\t"
121+
/*
122+
* NOTE: Below assembly is same as "ldr x6, =syscall_table", but lld fails
123+
* to resolve relocation R_AARCH64_ABS64. So, we use adrp/ldr instead.
124+
*/
125+
"adrp x6, :got:syscall_table \n\t"
126+
"ldr x6, [x6, #:got_lo12:syscall_table] \n\t"
122127
"ldr x6, [x6] \n\t"
123128
"add x6, x6, xzr, lsl #3 \n\t"
124129
"br x6 \n\t");

0 commit comments

Comments
 (0)