Need help on OVERLAY command in linker script...

Ian Lance Taylor ian@wasabisystems.com
Wed Jun 30 01:28:00 GMT 2004


Tao Zhang <zhangtao@cc.gatech.edu> writes:

> I modified the standard linker script a little bit:
> 
> [skip...]
> .text    :
> {
>     foo1.o(.text) foo2.o(.text)
> }
> OVERLAY  :
> {
>     .ovly0 { ovly0.o(.text) }
>     .ovly1 { ovly1.o(.text) }
>     .ovly2 { ovly2.o(.text) }
> }
> .text    :
> {
>     *(.text)
> }

Presumably these appear inside a SECTIONS construct.

I'm not sure that it makes sense to use OVERLAY without using either
AT to specify the LMA or > to specify a memory region.

It's very odd to specify .text more than once.  I think that will
create two different .text sections.  Do you want the overlay space to
be within the .text section?  Why?

> The result is that the binary doesn't contain .ovly0, .ovly1 and .ovly2
> sections at all, it looks the overlay command is simply ignored.

That is hard to understand.  Generate a linker map using the -M option
to see what happened to those sections.

Ian



More information about the Binutils mailing list