1
votes

now that Apple's platforms finally made a decision about architectures, I am starting to learn arm64 assembly on Darwin, and I don't find any information how to load addresses in the .data section.

On Linux, this works:

ldr X1, =symbol

.data
symbol:      .ascii  "foo"

Apple has an article why this does not work for Mach-O binaries, and how it is done on x86 with @GOTPCREL, but that does not tell me how the Clang assembler handles this on Apple Silicon. (Putting the data into the .text section does not help, because I need it to be writable)

Any information is appreciated!

1
You could write it in C and see what the compiler does?trojanfoe
I tried that, the disassembly was half helpful. See my solution belowbelow
Check the answer here stackoverflow.com/questions/56985859/ios-arm64-syscalls/… for some examplesKamil.S

1 Answers

0
votes

It would appear that I need to use ADRP Rx, symbol@GOTPAGE. Still, any more insight is appreciated