public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: Tristan Gingold <gingold@adacore.com>
Cc: "H.J. Lu" <hjl.tools@gmail.com>, binutils <binutils@sourceware.org>
Subject: Re: [Patch] ld: check for address space overflow
Date: Tue, 14 Mar 2017 10:20:00 -0000	[thread overview]
Message-ID: <20170314101952.GL4983@bubble.grove.modra.org> (raw)
In-Reply-To: <F639AA22-1566-43A8-96DD-C3013A5E5B5B@adacore.com>

On Tue, Mar 14, 2017 at 09:15:30AM +0100, Tristan Gingold wrote:
> [...]
> 
> > This works:
> > 
> > diff --git a/ld/ldlang.c b/ld/ldlang.c
> > index a0638ea..8c1d829 100644
> > --- a/ld/ldlang.c
> > +++ b/ld/ldlang.c
> > @@ -4783,13 +4783,13 @@ lang_check_section_addresses (void)
> >   for (s = link_info.output_bfd->sections; s != NULL; s = s->next)
> >     {
> >       s_end = (s->vma + s->size) & addr_mask;
> > -      if (s_end != 0 && s_end < s->vma)
> > +      if (s_end != 0 && s_end < (s->vma & addr_mask))
> >   einfo (_("%X%P: section %s VMA wraps around address space\n"),
> >          s->name);
> >       else
> >   {
> >     s_end = (s->lma + s->size) & addr_mask;
> > -    if (s_end != 0 && s_end < s->lma)
> > +    if (s_end != 0 && s_end < (s->lma & addr_mask))
> >       einfo (_("%X%P: section %s LMA wraps around address space\n"),
> >         s->name);
> >   }
> 
> Yes, that makes sense.
> Do you plan to commit it ?

The new testcases need some tweaking too.  Even after applying the
above I'm left with:

arm-aout  +FAIL: section size overflow
arm-coff  +FAIL: section size overflow
arm-epoc-pe  +FAIL: section size overflow
arm-pe  +FAIL: section size overflow
arm-symbianelf  +FAIL: section size overflow
arm-wince-pe  +FAIL: section size overflow
i386-linuxaout  +FAIL: section size overflow
i386-linuxaout  +FAIL: section size overflow
i386-lynxos  +FAIL: section size overflow
i386-netware  +FAIL: section size overflow
i586-aout  +FAIL: section size overflow
i686-pe  +FAIL: section size overflow

-- 
Alan Modra
Australia Development Lab, IBM

  reply	other threads:[~2017-03-14 10:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-10 14:29 Tristan Gingold
2017-03-11  1:14 ` Alan Modra
2017-03-13  9:47   ` Tristan Gingold
2017-03-13 17:52     ` H.J. Lu
2017-03-13 19:06 ` H.J. Lu
2017-03-13 19:27   ` H.J. Lu
2017-03-14  8:15     ` Tristan Gingold
2017-03-14 10:20       ` Alan Modra [this message]
2017-03-14 10:50         ` Tristan Gingold
2017-03-14 12:17           ` Alan Modra
2017-03-14 13:56             ` Tristan Gingold
2017-03-15  1:11               ` Alan Modra
2017-03-15  9:26                 ` Tristan Gingold
2017-03-14 16:13       ` H.J. Lu

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=20170314101952.GL4983@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=gingold@adacore.com \
    --cc=hjl.tools@gmail.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).