VMA section overlap warnings for overlays

Alan Modra amodra@gmail.com
Thu Apr 22 01:11:00 GMT 2010


On Wed, Apr 21, 2010 at 03:44:08PM +0100, David Stubbs wrote:
>   .imem 0x2000 : AT (LOADADDR (.text) + SIZEOF (.text))
>   {
>     *(.imem)
>   } :imem

So this goes to imem with a vma of 0x2000 and lma x, say

>   .overlay1 ALIGN (ADDR (.imem) + SIZEOF (.imem), 8K) 
>     : AT (LOADADDR (.imem) + SIZEOF (.imem))
>   {
>     *(.overlay.1)
>   } :imem

and this to imem with vma 0x4000 and lma x+1

Now we have a problem.  If we put .overlay1 in imem at p_offset+1 then
the execution model lma (calculated from p_paddr+p_offset+1) for
.overlay1 will be correct, but the vma (from p_vaddr+p_offset+1
ie. 0x2001) will be wrong.  Of course, with multiple overlays packed
into one header you can't possibly get the execution model vma correct
for all the overlays, so you probably don't care.  However, the
ELF_IS_SECTION_IN_SEGMENT_FILE test in
elf.c:assign_file_positions_for_load_sections fails, which is why you
get a linker error.

Conversely, putting .overlay1 at p_offset+0x2000 will give the correct
vma but the wrong lma, and of course insert a whole lot of padding.
This is what Jan's patch did, and is quite wrong for overlays..

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list