Using FILL(n) or =FILLEXP in linker scripts

Alan Modra amodra@bigpond.net.au
Fri Aug 10 07:01:00 GMT 2007


On Thu, Aug 09, 2007 at 02:19:01PM -0400, Ti Strga wrote:
> .internal_chunk_two : {
>     FILL(0xDEADBEEF)           /* attempt one */
>     __chunk_two_bottom = .;
>     . = . + _CHUNK_TWO_SIZE;
>     . = ALIGN(16);
>     __chunk_two_top = .;
> } > ram =0xDEADBEEF           /* attempt two */
> 
> Neither FILL nor FILLEXP work here.

> Our questions:
> (1)  What are we doing wrong with the fill expression?

The reason the fill isn't working is that ld treats this section like
a bss section.  It doesn't have any input sections containing data,
nor does it have any data statements.  You could argure that a
non-zero fill ought to force a normal section, ie. you've struck a ld
bug.

> (2)  Shouldn't the line ". = . + _CHUNK_ONE_SIZE;" have moved the location
> counter forward in memory for the references in .internal_chunk_two?

No.  You are using memory regions, with .internal_chunk_two belonging
to "ram".  The ". = . + _CHUNK_ONE_SIZE;" is not inside an output
section statement, so this increases "dot" in the default memory
region.  The value of "dot" in "ram" isn't changed.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list