程式語言 - GNU - Assembly (ARM) - Hello, world!(printf)



參考資訊:
http://kerseykyle.com/articles/ARM-assembly-hello-world
https://github.com/kevinhooke/learning-arm-asm/blob/master/helloworld.s
https://chromium.googlesource.com/chromiumos/docs/+/HEAD/constants/syscalls.md

main.s

    .global main
    .extern printf
  
    .data
msg: .asciz "hello, world!\n"
  
    .text
main:
    push {lr}

    ldr r0, =msg
    bl printf
    eor r0, r0

    pop {pc}

編譯、執行

$ arm-linux-gnueabihf-gcc main.s -o main -static
$ qemu-arm ./main
    hello, world!