Reputation: 43
Entry | Info |
---|---|
Computer | MacBook 2022 M2 13 inch 24GB |
OS | MacOS 15.1 Beta 2405055e |
Compiling Command | as as -g hello.s -o hello.o && ld -o hello.exec hello.o -lSystem -syslibroot `xcrun -sdk macosx --show-sdk-path` -e _start -arch arm64 |
Hi nice people at SO
I'm new to assembly, and I'm learning Mach-O AArch64 asm. I'm trying to create a simple print(input())
program, by allocating a buffer, reading it through STDIN, and then output it through STDOUT.
I had the problem of not able to write to the buffer section, but some nice people told me to put the declaration(or definition?) of the label in the .bss
section. This worked just fine on my raspi 4B
.section .bss
buffer: .skip 128
How can I do it on a mach-o system? If I used the same code, the compiler complains about “unknown AArch64 fixup kind”
Here's my code:
.global _start
.align 8
_start: mov X0, #0
adr X1, buffer
mov X2, #128
mov X8, #63
svc #0
mov X0, #1
mov X2, #5
mov X8, #64
svc #0
mov X0, #0
mov X8, #93
svc #0
.section .bss
buffer: .skip 128
Upvotes: 1
Views: 25