This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: LMA XXX Overlaps Previous Sections When Using PHDRS
On Wed, Dec 26, 2007 at 07:02:17PM +0000, Nick Clifton wrote:
> Hi Alan,
>
> >>This is a bogus error message due to a spurious check in the linker.
> >
> >Eh? I think the error message is correct. We really do have an error
> >of some sort here, most likely the linker ignoring phdr "AT" when
> >assigning section lmas in ldlang.c.
>
> Ok - can you explain what that piece of code was doing then ? I could not
> work out what it was trying to achieve.
The linker sets up section vma and lma, and section to segment mapping
well before assign_file_positions_for_load_sections. In cases where
the segment (program header) p_paddr is set, it ought to match the
first section lma mapped to that segment. The same goes for p_vaddr
and section vma. (Both can be offset by some amount, for file header
and program header space, but this is the general idea.) After adding
the first section to the segment, we increase p_memsz to account for
space taken by that section. Any following section in that segment
can't start before the end of the previous section. ie. for lma,
section lma must be greater than p_paddr + p_memsz. The same goes for
vma and p_vaddr + p_memsz but it doesn't look like we check that..
There can of course be gaps between sections, but overlap is an error.
The testcase is failing the consistency check on the first section
due to section lma disagreeing with header p_paddr.
--
Alan Modra
Australia Development Lab, IBM