SPRUI03E June 2015 – January 2023
When a hole exists in an initialized output section, the linker must supply raw data to fill it. The linker fills holes with a 32-bit fill value that is replicated through memory until it fills the hole. The linker determines the fill value as follows:
SECTIONS
{ outsect:
{
file1.c.obj(.text)
file2.c.obj(.bss)= 0xFF00FF00 /* Fill this hole with 0xFF00FF00 */
}
}
SECTIONS
{ outsect:fill = 0xFF00FF00 /* Fills holes with 0xFF00FF00 */
{
. += 0x0010; /* This creates a hole */
file1.c.obj(.text)
file1.c.obj(.bss) /* This creates another hole */
}
}
SECTIONS { .text: { .= 0x0100; } /* Create a 100 word hole */ }
Now invoke the linker with the --fill_value option:
cl6x --run_linker --fill_value=0xFFFFFFFF link.cmd
This fills the hole with 0xFFFFFFFF.
Whenever a hole is created and filled in an initialized output section, the hole is identified in the link map along with the value the linker uses to fill it.