以下这些选项为ARM port定义:
-mabi=name
产生指定ABI的代码,允许的值有:apcs-gnu, atpcs, aapcs, aapcs-linux, iwmmxt
-mapcs-frame
为所有函数产生兼容ARM Procedure Call standard的栈帧。和-fomit-frame-pointer一起,将导致叶子函数不产生栈帧。默认值为-mno-apcs-frame,这个选项被反对。
-mapcs
-mapcs-frame的别名。
-mthumb-interwork
产生支持ARM和Thumb之间调用支持的代码。默认是-mno-thumb-interwork。AAPCS这个选项无意义。
-mno-sched-prolog
阻止function prologue里面的指令reorder和merge。默认-msched-prolog
-mfloat-abi=name
指定浮点数ABI,允许的值有:soft, softfp, hard
soft使GCC产生函数调用来实现浮点操作。softfp允许产生使用硬件浮点指令集的代码,但是仍然使用soft-float调用约定。hard 允许产生浮点指令,且使用FPU定义的调用约定。
-mlittle-endian
小端模式。
-mbig-endian
大端模式
-march=name
指定目标arm架构的名字。GCC根据这个名字来决定产生何种指令。这个选项用来和-mcpu一起或单独使用。允许的名字有:armv2, armv2a, armv3, armv3m, armv4, armv4t, armv5, armv5e, armv5t, armv5te, armv6, armv6-m, armv6j, armv6k, armv6s-m, armv6t2, armv6z, armv6zk, armv7, armv7-a, armv7-m, armv7-r, armv7e-m, armv7ve, armv8-a, armv8-a+crc, armv8.1-a, armv8.1+crc, armv8-m.base, armv8-m.main, armv8-m.main+dsp, iwmmxt, iwmmxt2.
-mtune=name
指定目标arm处理器的名字,GCC用来tune the performance of the code, 如arm920t
-mcpu=name
指定目标ARM处理器的名字。允许的名字和-mtune一样。
-mfpu=name
指定浮点数硬件,如vfpv2,如果定义了-msoft-float,则指定浮点格式。
-mstructure-size-boundary=n
结构体和联合应该对齐的大小,允许的值有8, 32, 64
-mabort-on-noreturn
在无返回的函数退出时,执行abort调用。
-mlong-calls
-mno-long-calls
告诉编译器执行函数调用时,想将函数的地址载入寄存器,然后在此寄存器上执行子程序调用。
-msingle-pic-base
认为用于PIC寻址的寄存器是只读的,这样在每个函数的开场白(prologue)就不需要载入它。在执行开始前,运行时系统需要初始化它。
-mpic-register=reg
指定用于PIC寻址的寄存器。对于single PIC base register默认是r9,如果目标是EABI,或者栈检查开启,默认是r10。
-mpic-data-is-text-relative
假设text段和data段的偏移是固定的。这允许使用PC相对地址来操作数据。对于非non-VxWorks RTP目标,这个选项默认打开,当这个选项关闭时,将打开-msingle-pic-base选项。
-mpoke-function-name
将每个函数的名字写入text section。在直接放在函数前面。
-mthumb
-marm
选择产生哪种代码。
-mno-tpcs-frame
-mtpcs-frame
为所有非叶子函数产生兼容Thumb Procedure Call Standard的栈帧。
-mno-tpcs-leaf-frame
-mtpcs-leaf-frame
为所有叶子函数产生兼容Thumb Procedure Call Standard的栈帧。
-mcallee-super-interworking
为所有本文件中外部可见的函数产生ARM指令,用于在执行函数前切换到Thumb模式,AAPCS该选项非法,因为AAPCS默认开启interworking。
-mcaller-super-interworking
类似上面那个选项。
-mtp=name
指定thread local storage指针的访问模型,默认是auto。
-mtls-dialect=dialect
指定访问thread local storage的dialect,支持gnu和gnu2,对于共享库gnu2性能更好。
-mword-relocations
只产生绝对重定向,值大小为word size,如R_ARM_ABS32。This is enabled by default on targets (uClinux, SymbianOS) where the runtime loader imposes this restriction, and when ‘-fpic’ or ‘-fPIC’ is specified.
-mfix-cortex-m3-ldrd
一些Cortex-M3核使用ldrd指令可能导致data corruption,这个选项避免产生这些指令。-mcpu=cortex-m3默认开启该选项。
-munaligned-access
-mno-unaligned-access
如果unaligned access没有开启,在packed structures中,words的访问一次访问一个字节。在ARMv6之前,ARMv6-M和ARMv8-M Baseline架构默认关闭unaligned access,其它所有架构默认开启。
-mneon-for-64bits
开启用neon操作scalar 64-bits operation,默认关闭。
参考
GCC Manual