Optional Section Attributes
secname
BLOCK(align)
AT (ldadr)
For example, this
The symbol
>region
...
secname start BLOCK( align) (NOLOAD) : AT ( ldadr )
{ contents }>region = fill
...
}
You can force the output section to be loaded at a specified address by
specifying start immediately following the section name. start can be represented as any expression. The following example generates section output at location 0x40000000.
...
output 0x40000000: {
...
}
...
}
You can include BLOCK() specification to advance the location counter . prior to the beginning of the
section, so that the section will begin at the specified alignment. align is an expression.
Use ‘(NOLOAD)’ to prevent a section from being loaded into memory each time it is accessed.
For example, in the script sample below, the ROM segment is addressed at memory location ‘0’ and does not need to be loaded into each object file:
ROM 0 (NOLOAD) : { ...}
...
}
{
.text 0x1000 : { *(.text) _etext = . ; }
.mdata 0x2000 :
AT ( ADDR(.text) + SIZEOF ( .text ) )
{ _data = . ; *(.data); _edata = . ; }
.bss 0x3000 :
{ _bstart = . ; *(.bss) *(COMMON) ; _bend = . ;}
}
char *dst = _data;
/* ROM has data at end of text; copy it. */
while (dst < _edata) {
*dst++ = *src++;
}
/* Zero bss */
for (dst = _bstart; dst< _bend; dst++)
*dst = 0;
Including =fill in a section definition specifies the initial fill value for that section.
You may use any expression to specify fill. Any unallocated holes in the current output section when written to the
output file will be filled with the two least significant bytes of the value,
repeated as necessary. You can also change the fill value with a FILL statement in the contents of a section definition.