public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@bigpond.net.au>
To: Nick Clifton <nickc@redhat.com>
Cc: binutils@sourceware.org
Subject: Re: LMA XXX Overlaps Previous Sections When Using PHDRS
Date: Wed, 26 Dec 2007 21:40:00 -0000	[thread overview]
Message-ID: <20071226214045.GB23286@bubble.grove.modra.org> (raw)
In-Reply-To: <4772A539.8050906@redhat.com>

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

  reply	other threads:[~2007-12-26 21:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-19 22:19 DeRosa, Anthony
2007-12-24 17:21 ` Nick Clifton
2007-12-25 23:09   ` Alan Modra
2007-12-26 19:02     ` Nick Clifton
2007-12-26 21:40       ` Alan Modra [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-12-19 22:15 DeRosa, Anthony

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071226214045.GB23286@bubble.grove.modra.org \
    --to=amodra@bigpond.net.au \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).