我正在为 Linux 编写“Hello World”程序的编译 AArch64 程序集文件。
我已经成功地将它从 504 字节缩短到 124 字节。我能想到的唯一更“优化”的是找到一些在单个指令中执行两个或多个任务的指令。
目前文件中的机器代码(以 asm 表示)是这样的:
mov x8, 64 // __NR_write
adr x1, hello //the string, I know the exact address
mov x2, 10 //string length (actually only "HelloWorld")
j:
mov x0, 0 // write to stdin happens to work
svc 0
mov x8, 93 // __NR_exit
b j //the branching saves me one instruction to exit with status = 0
有什么指令可以缩短这里的内容吗?