This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Make asection->id and asection->index unsigned
- From: Alan Modra <amodra at gmail dot com>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: binutils at sourceware dot org
- Date: Mon, 31 Aug 2015 20:28:00 +0930
- Subject: Re: Make asection->id and asection->index unsigned
- Authentication-results: sourceware.org; auth=none
- References: <20150831042014 dot GJ24814 at bubble dot grove dot modra dot org> <20150831065713 dot GM24814 at bubble dot grove dot modra dot org> <mvm37yzydew dot fsf at hawking dot suse dot de>
On Mon, Aug 31, 2015 at 12:12:39PM +0200, Andreas Schwab wrote:
> Alan Modra <amodra@gmail.com> writes:
>
> > diff --git a/bfd/elflink.c b/bfd/elflink.c
> > index 192ce15..4f86700 100644
> > --- a/bfd/elflink.c
> > +++ b/bfd/elflink.c
> > @@ -3247,7 +3247,7 @@ elf_sort_symbol (const void *arg1, const void *arg2)
> > return vdiff > 0 ? 1 : -1;
> > else
> > {
> > - long sdiff = h1->root.u.def.section->id - h2->root.u.def.section->id;
> > + int sdiff = h1->root.u.def.section->id - h2->root.u.def.section->id;
>
> Can this overflow?
If it could, then it would have overflowed before when "id" was
"int". Since the expression will overflow only when ld has allocated
2G sections, I think you would kill the process long before that
happens..
--
Alan Modra
Australia Development Lab, IBM