指定入口点

gcc -nostartfiles -e entry_func filename.c

链接

间接寻址

-fpie  让程序能装载在随机的地址

将 .text变为可写

-Wl,--omagic

__attribute 编译器指令,告诉编译器声明的特性。attribute 可以设置函数属性(Function Attribute)、变量属性(Variable Attribute)和类型属性(Type Attribute)

将作用的函数或数据放入指定名为"section_name"的段: attribute((section("section_name")))

eg.   char data[64] attribute((section(".text")));  (data array in text section)

gcc和clang最新版本都支持**-masm=intel**可以将内部汇编格式切换成intel语法,此时内联汇编也是intel语法

在.S asm源码头部需要添加 .intel_syntax noprefix

使gcc识别为intel汇编格式,否则会出现Error: too many memory references