AArch64 assembly - part 4
Author: Carmelo C.
Published: Feb 27, 2025 (updated)assembly
arm64
aarch64
coding
AArch64
Index
Cross-compilation
Interestingly, one does not need to own an ARM64 processor. With the help of QEMU user mode emulation (qemu-user
) and the GNU C compiler for AArch64 (gcc-aarch64-linux-gnu
), assembling and linking native code is a breeze.
Starting from exactly the same source code let’s run:
$ aarch64-linux-gnu-as answer.s
$ aarch64-linux-gnu-gcc -static -o answer a.out
$ ./answer
$ echo $?
42
Of course, no tricks, the output above has been collected on:
$ uname -m
x86_64
$ file a.out
a.out: ELF 64-bit LSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
$ file answer
answer: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, not stripped