给自己挖了个坑,一切都得从“Hello World”开始。

hello.S

.datamsg:.ascii"Hello,World!\n"len=.-msg.text.globl_start_start:/*syscallwrite(intfd,constvoid*buf,size_tcount)*/mov%r0,$1/*fd->stdout*/ldr%r1,=msg/*buf->msg*/ldr%r2,=len/*count->len(msg)*/mov%r7,$4/*writeissyscall#4*/swi$0/*invokesyscall*//*syscallexit(intstatus)*/mov%r0,$0/*status->0*/mov%r7,$1/*exitissyscall#1*/swi$0/*invokesyscall*/

arm-linux-androideabi-as-ohello.ohello.S

arm-linux-androideabi-ld-s-ohellohello.o

adb push hello /data/local/tmp/hello
adb shell /data/local/tmp/hello