arm匯編學(xué)習(xí)(五)
hello.S文件
本文引用地址:http://m.butianyuan.cn/article/201611/317583.htm.datamsg:.ascii "Hello, ARM!n"len = . - msg.text.globl _start_start:/* syscall write(int fd, const void *buf, size_t count) */mov %r0, $1 /* fd -> stdout */ldr %r1, =msg /* buf -> msg */ldr %r2, =len /* count -> len(msg) */mov %r7, $4 /* write is syscall #4 */swi $0 /* invoke syscall *//* syscall exit(int status) */mov %r0, $0 /* status -> 0 */mov %r7, $1 /* exit is syscall #1 */swi $0 /* invoke syscall */
記得最后加個(gè)空格或者回車,不然會(huì)報(bào)hello.S:21: Warning: partial line at end of file ignored
arm-linux-androideabi-as -o hello.o hello.S
arm-linux-androideabi-ld -s -o hello hello.o
也是個(gè)學(xué)習(xí)ARM匯編的方法
評(píng)論