This is the mail archive of the
mailing list for the binutils project.
RE: VMA section overlap warnings for overlays
> > Am I doing something wrong or unusual in my linker script, or
> does it
> > look like there's a problem in the linker?
> Your script is fine. I'm looking at reverting Jan's patch.
On a related note, I've noticed that a slightly 'enhanced' version of
the linker script ends up with incorrect LMAs being used. Here's the
LONG (LOADADDR (.overlay1))
LONG (LOADADDR (.overlay2))
LONG (LOADADDR (.overlay3))
.imem 0x2000 : AT (LOADADDR (.text) + SIZEOF (.text))
.overlay1 ALIGN (ADDR (.imem) + SIZEOF (.imem), 8K)
: AT (LOADADDR (.imem) + SIZEOF (.imem))
.overlay2 ALIGN (ADDR (.imem) + SIZEOF (.imem), 8K)
: AT (LOADADDR (.overlay1) + SIZEOF (.overlay1))
.overlay3 ALIGN (ADDR (.imem) + SIZEOF (.imem), 8k)
: AT (LOADADDR (.overlay2) + SIZEOF (.overlay2))
The .overlays section reports the load addresses as:
Hex dump of section '.overlays':
0x00009000 00001004 00001003 00001002 ............
Whereas the section headers report:
Idx Name Size VMA LMA File off Algn
1 .overlay1 00000001 00004000 00003001 00005000 2**0
4 .overlay2 00000001 00004000 00003002 00005001 2**0
5 .overlay3 00000001 00004000 00003003 00005002 2**0
So the LMAs in the .overlays section do not match the LMAs in the
section headers. And for completeness, the program headers looks like:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg
LOAD 0x001000 0x00001000 0x00001000 0x00001 0x00001 R E
LOAD 0x002000 0x00009000 0x00009000 0x0000c 0x0000c RW
LOAD 0x003000 0x00002000 0x00001001 0x02003 0x02003 R E
Section to Segment mapping:
02 .overlay1 .imem .overlay2 .overlay3
I think it's the contents of the .overlays section that is actually
incorrect in this case.
I don't think reverting that patch alone fixes it though. In fact, from
a very quick test I get this error:
test.exe: section `.overlay1' can't be allocated in segment 2
LOAD: .imem .overlay1 .overlay2 .overlay3
Which definitely doesn't look correct to me. There must be some other
associated change that I've not yet found...
I was planning on taking another look into this, but would obviously
appreciate any help you can provide!