Previous: Output Section Phdr, Up: Output Section Attributes



3.6.8.7 Output Section Fill

You can set the fill pattern for an entire section by using =fillexp. fillexp is an expression (see Expressions). Any otherwise unspecified regions of memory within the output section (for example, gaps left due to the required alignment of input sections) will be filled with the value, repeated as necessary. If the fill expression is a simple hex number, ie. a string of hex digit starting with 0x and without a trailing k or M, then an arbitrarily long sequence of hex digits can be used to specify the fill pattern; Leading zeros become part of the pattern too. For all other cases, including extra parentheses or a unary +, the fill pattern is the four least significant bytes of the value of the expression. In all cases, the number is big-endian.

You can also change the fill value with a FILL command in the output section commands; (see Output Section Data).

Here is a simple example:

     SECTIONS { .text : { *(.text) } =0x90909090 }