基于Android的ARM汇编语言系列之二:C/C++程序生成ARM汇编程序
时间:11-09
来源:互联网
点击:
章节列表
之一:ARM汇编语言开篇
之二:C/C++程序生成ARM汇编程序的过程分析
之三:ARM汇编语言程序结构
之四:ARM处理器的寻址方式
之五:ARM指令集与Thumb指令集
之六:NEON指令集与VFP指令集
所谓的原生程序指的是用C/C++编写的程序,下面来详细演示一下原生程序是怎么一步步生成汇编代码的。
这里编译的是一个简单的hello.c程序,如下所示:
#includeint main(int argc, char* argv[]){printf("Hello ARM!\n");return 0;}
一 预处理
预处理阶段会处理代码中的预处理指令,如下所示:
- #include
- #define
- #if
执行以下命令进行预处理,-E可以用来查看详细输出。
gcc -E hello.c -o hello.i
成成的hello.i如下所示:
# 1 "hello.c"# 1 ""# 1 " "# 1 "hello.c"# 1 "c:/android-ndk-r8/platforms/android-14/arch-arm/usr/include/stdio.h" 1# 41 "c:/android-ndk-r8/platforms/android-14/arch-arm/usr/include/stdio.h"# 1 "c:/android-ndk-r8/platforms/android-14/arch-arm/usr/include/sys/cdefs.h" 1# 59 "c:/android-ndk-r8/platforms/android-14/arch-arm/usr/include/sys/cdefs.h"# 1 "c:/android-ndk-r8/platforms/android-14/arch-arm/usr/include/sys/cdefs_elf.h" 1# 60 "c:/android-ndk-r8/platforms/android-14/arch-arm/usr/include/sys/cdefs.h" 2# 42 "c:/android-ndk-r8/platforms/android-14/arch-arm/usr/include/stdio.h" 2# 1 "c:/android-ndk-r8/platforms/android-14/arch-arm/usr/include/sys/_types.h" 1# 40 "c:/android-ndk-r8/platforms/android-14/arch-arm/usr/include/sys/_types.h"# 1 "c:/android-ndk-r8/platforms/android-14/arch-arm/usr/include/machine/_types.h" 1# 52 "c:/android-ndk-r8/platforms/android-14/arch-arm/usr/include/machine/_types.h"typedef signed char __int8_t;typedef unsigned char __uint8_t;typedef short __int16_t;typedef unsigned short __uint16_t;typedef int __int32_t;typedef unsigned int __uint32_t;typedef long long __int64_t;typedef unsigned long long __uint64_t;typedef __int8_t __int_least8_t;typedef __uint8_t __uint_least8_t;typedef __int16_t __int_least16_t;typedef __uint16_t __uint_least16_t;typedef __int32_t __int_least32_t;typedef __uint32_t __uint_least32_t;typedef __int64_t __int_least64_t;typedef __uint64_t __uint_least64_t;typedef __int32_t __int_fast8_t;typedef __uint32_t __uint_fast8_t;typedef __int32_t __int_fast16_t;typedef __uint32_t __uint_fast16_t;typedef __int32_t __int_fast32_t;typedef __uint32_t __uint_fast32_t;typedef __int64_t __int_fast64_t;typedef __uint64_t __uint_fast64_t;typedef int __intptr_t;typedef unsigned int __uintptr_t;typedef __int64_t __intmax_t;typedef __uint64_t __uintmax_t;typedef __int32_t __register_t;typedef unsigned long __vaddr_t;typedef unsigned long __paddr_t;typedef unsigned long __vsize_t;typedef unsigned long __psize_t;typedef int __clock_t;typedef int __clockid_t;typedef long __ptrdiff_t;typedef int __time_t;typedef int __timer_t;typedef __builtin_va_list __va_list;typedef int __wchar_t;typedef int __wint_t;typedef int __rune_t;typedef void * __wctrans_t;typedef void * __wctype_t;# 41 "c:/android-ndk-r8/platforms/android-14/arch-arm/usr/include/sys/_types.h" 2typedef unsigned long __cpuid_t;typedef __int32_t __dev_t;typedef __uint32_t __fixpt_t;typedef __uint32_t __gid_t;typedef __uint32_t __id_t;typedef __uint32_t __in_addr_t;typedef __uint16_t __in_port_t;typedef __uint32_t __ino_t;typedef long __key_t;typedef __uint32_t __mode_t;typedef __uint32_t __nlink_t;typedef __int32_t __pid_t;typedef __uint64_t __rlim_t;typedef __uint16_t __sa_family_t;typedef __int32_t __segsz_t;typedef __uint32_t __socklen_t;typedef __int32_t __swblk_t;typedef __uint32_t __uid_t;typedef __uint32_t __useconds_t;typedef
AndroidARM汇编语言汇编程 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)