GNU >> Assembly (ARM 64)

hello, world! (printf)


參考資訊:
1. syscall
2. explain-arm64-instruction-stp

main.s

    .global main
    .extern printf

    .data
msg: .asciz "hello, world!\n"

    .text
main:
    stp x29, x30, [sp, #-0x10]!

    ldr x0, =msg
    bl printf
    mov x0, #0

    ldp x29, x30, [sp], #0x10
    ret

編譯、執行

$ aarch64-linux-gnu-gcc main.s -o main -static
$ qemu-aarch64 ./main
    hello, world!


返回上一頁