谁能给出一个复杂一点的代码并且在其他编译器上试一下?
// a.c
int main(void) { for(volatile int i=0xff; i; i--); return 0; }
命令:
arm-elf-gcc -std=gnu99 -g -c -o a.o a.c arm-elf-objdump -S a.o >a.lst
a.lst 的内容:
a.o: file format elf32-littlearm
Disassembly of section .text:
00000000 <main>:
int main(void) { 0: e1a0c00d mov ip, sp 4: e92dd800 stmdb sp!, {fp, ip, lr, pc} 8: e24cb004 sub fp, ip, #4 ; 0x4 c: e24dd004 sub sp, sp, #4 ; 0x4 for(volatile int i=0xff; i; i--) 10: e3a030ff mov r3, #255 ; 0xff 14: e50b3010 str r3, [fp, #-16] 18: ea000002 b 28 <main+0x28> 1c: e51b3010 ldr r3, [fp, #-16] 20: e2433001 sub r3, r3, #1 ; 0x1 24: e50b3010 str r3, [fp, #-16] 28: e51b3010 ldr r3, [fp, #-16] 2c: e3530000 cmp r3, #0 ; 0x0 30: 1afffff9 bne 1c <main+0x1c> ; return 0; 34: e3a03000 mov r3, #0 ; 0x0 } 38: e1a00003 mov r0, r3 3c: e89da808 ldmia sp, {r3, fp, sp, pc}
|