转载至:https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html#ARM-Options
-mstructure-size-boundary=
nThe sizes of all structures and unions are rounded up to
a multiple of the number of bits set by this option. Permissible values are 8, 32and 64. The default value varies for different toolchains. For the COFF targeted toolchain the default value is 8. A value of 64 is only allowed if the underlying ABI supports it.
Specifying a larger number can produce faster, more efficient code, but can also increase the size of the program. Different values are potentially incompatible. Code compiled with one value cannot necessarily expect to work with code or libraries compiled with another value, if they exchange information using structures or unions.
这里有两点非常关键。
第一:这里的n表达的是bit值,即n=8时表示的是两字节对应,比较无语。
第二:兼容问题。由于不同的n值会导致结构体大小不同,所以在不同的编译器下编译时要注意这个问题。
本文深入解析GCC ARM选项中的-mstructure-size-boundary=n参数,探讨其如何影响结构体和联合体的大小,以及不同设置值的兼容性和性能影响。
1093

被折叠的 条评论
为什么被折叠?



