GNU >> Assembly (ARM)

hello, world! (printf)


參考資訊:
1. syscall
2. helloworld
3. ARM-assembly-hello-world

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!


返回上一頁