现在的位置: 首页 > 综合 > 正文

ARM汇编:printf

2018年04月16日 ⁄ 综合 ⁄ 共 761字 ⁄ 字号 评论关闭

#include <stdio.h>
int add3(int a, int b, int c)
{
	return a+b+c;
}
int main()
{
	//char* p="Hello world!";
	int a=1, b=2, c =3;
	printf("func printf: %d\n", a++);
	add3(a, b, c);
	return 0;
}

lumy1@xmws48:~/workspace/mickey/android/external/asmtest$
~/workspace/mt6592_dev/android/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-objdump -D -s asmtest.o > asmtest2.asm

Contents of section .rodata.str1.4:
 0000 66756e63 20707269 6e74663a 2025640a  func printf: %d.
 0010 00000000       

Disassembly of section .text.add3:


00000000 <add3>:
   0: 1840      adds r0, r0, r1
   2: 1880      adds r0, r0, r2
   4: 4770      bx lr
   6: bf00      nop

Disassembly of section .text.startup.main:


00000000 <main>:
   0: 4803      ldr r0, [pc, #12]; (10 <main+0x10>)
   2: 2101      movs r1, #1
   4: b508      push {r3, lr}
   6: 4478      add r0, pc
   8:f7ff fffe bl0 <printf>
   c: 2000      movs r0, #0
   e: bd08      pop {r3, pc}
  10: 00000006 andeq r0, r0, r6

抱歉!评论已关闭.