This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Need help on OVERLAY command in linker script...


Hi, Ian

>
> > 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

I think I found what the problem is. The problem is due to I use .text
twice and place something else between two .text. I think during linking,
when the linker sees the first .text, it will try to finish the processing
of that section and maybe it will collect all the actions needed for that
section and perform them. That basically has an effect of merging the
second .text section with the first one. Since there is a *.text matching
in the second .text, all .text sections in the object files are processed
and when the linker processes OVERLAY command, there is nothing left.

I changed the name of the original first .text section, then I got overlay
sections. But the "not enough room for program headers" problem is still
there.

Tao


>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]