GNU ARM汇编常用伪操作
-
- 1).global
- 2).extern
- 3).section
- 4).end
- 5).text / .data / .bss
- 6).code16 / .code32 / .thumb / .arm
- 7).include
- 8).incbin
- 9).set / .equ
- 10).if .else .endif / .ifdef .else .endif
- 11).macro .exitm .endm
- 12).byte
- 13).short .hword
- 14).long .word .int
- 15).quad
- 16).string / .asciz / .ascii
- 17).zero / .space / .skip
- 18).rept .endr
1).global
声明符号全局可见;类似于C语言头文件中的extern
2).extern
声明外部符号;类似于C语言源文件中只声明(不定义)的extern
3).section
定义一个段,每一个段以段名为开始,以下一个段名或者文件结尾为结束。
.section section_name[,"flags"[,%type[,flag_specific_arguments]]]
- ELF格式允许的段标志(flags):
- a:可分配
- w:可写段
- x:执行段
4).end
表明源文件的结束,如果该标号之后还有代码,不会被编译到执行文件中
5).text / .data / .bss
.text、.data和.bss将汇编系统预定义的段名编译到相应的代码段、数据段和bss段。
6).code16 / .code32 / .thumb / .arm
用来选择ARM或者Thumb指令集,.thumb伪操作等同于.code16,表明使用Thumb指令类似的.arm等同于.code32
7).include
引用头文件,类似于C语言中的#include
.include "filename"
8).incbin
可以将原封不动的一个二进制文件编译到当前文件中。其中,skip表明是从文件开始跳过skip个字节开始读取文件,count是读取的字数
.incbin "file"[