This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] ld: check for address space overflow


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]