VMA section overlap warnings for overlays

H.J. Lu hjl.tools@gmail.com
Sat Aug 28 01:02:00 GMT 2010


On Wed, Apr 21, 2010 at 6:53 PM, Alan Modra <amodra@gmail.com> wrote:
> On Thu, Apr 22, 2010 at 10:41:06AM +0930, Alan Modra wrote:
>> 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..
>
> Committed.  I didn't see any occurrence of the problem Jan originally
> reported in http://sourceware.org/ml/binutils/2008-05/msg00235.html on
> i386 or powerpc using recent compilers so perhaps some other change
> cured it.
>
> bfd/
>        * elf.c (assign_file_positions_for_load_sections): Revert 2008-05-29
>        change.  Tidy.  Don't error on sections not allocated in segment.
> ld/testsuite/
>        * ld-elf/extract-symbol-1sec.d: Update lma.
>        * ld-i386/alloc.d: Expect a warning, not an error.
>

This patch caused:

http://www.sourceware.org/bugzilla/show_bug.cgi?id=11953


-- 
H.J.



More information about the Binutils mailing list