This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Need help on OVERLAY command in linker script...
- From: Tao Zhang <zhangtao at cc dot gatech dot edu>
- To: binutils at sources dot redhat dot com
- Date: Tue, 29 Jun 2004 13:41:44 -0400 (EDT)
- Subject: 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)