| |||
| Home > Compiler Command-line Options > Command-line options > ‑‑split_sections | |||
This option instructs the compiler to generate one ELF section for each function in the source file.
Output sections are named with the same name as the function
that generates the section, but with an i. prefix.
If you want to place specific data items or structures in
separate sections, mark them individually with __attribute__((section(...))).
If you want to remove unused functions, it is recommended that you use the linker feedback optimization in preference to this option. This is because linker feedback produces smaller code by avoiding the overhead of splitting all sections.
This option reduces the potential for sharing addresses, data, and string literals between functions. Consequently, it might increase code size slightly for some functions.
int f(int x)
{
return x+1;
}
Compiling this code with --split_sections produces:
AREA ||i.f||, CODE, READONLY, ALIGN=2 f PROC ADD r0,r0,#1 BX lr ENDP