ARM RealView Compiler 3.1中的“--split_sections”选项是指每个函数生成一个ELF节。它会将每个函数编译成一个单独的节,从而使得在链接时可以更细粒度地控制函数和数据的位置和对齐方式,提高代码的可读性和可维护性。
示例代码:
int foo(int x) { return x + 1; }
int main(void) { int a = foo(2); return 0; }
在编译时使用“--split_sections”选项:
armcc --split_sections test.c -o test.axf
编译后的结果,每个函数生成一个单独的节:
Disassembly of section foo:
00000000
Disassembly of section main:
00000000