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]

Need help on OVERLAY command in linker script...


Hi, all

I cannot figure out how to use OVERLAY command in linker script, need help
badly...

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)
}
[skip...]

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

I tried to rearrage the order to the following:

[skip...]
OVERLAY  :
{
    .ovly0 { ovly0.o(.text) }
    .ovly1 { ovly1.o(.text) }
    .ovly2 { ovly2.o(.text) }
}
.text    :
{
    foo1.o(.text) foo2.o(.text)
}
.text    :
{
    *(.text)
}
[skip...]

I got two errors. The first is something like "section
.text[00008340->0000a0d3] overlaps section .ovly2 [00007d00->
0000843f]". The second is "Not enough room for program headers". I
don't understand both of them. For first error, it looks the current
location after OVERLAY command is wrong? Otherwise, how come the
overlaid parts overlap with .text? If I explicitly add a
".=0x8500;" after the OVERLAY command, then the first error will
disappear, but I don't understand what I did wrong so the linker is
confused. Also, I have no idea what the second error is about. I am
using SIZEOF_HEADERS at the beginning of linker script, but does using
OVERLAY increase the number of program headers??

Thanks so much for any help. I am really stuck there.

Tao
			-Tao Zhang (zhangtao@cc.gatech.edu)


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