PATCH: fix som_get_reloc_upper_bound if no reloc

Alan Modra amodra@bigpond.net.au
Wed Sep 26 03:07:00 GMT 2007


On Tue, Sep 25, 2007 at 05:14:49PM +0100, Nick Clifton wrote:
> Hi Tristan,
> 
> >This seems to be an obvious patch: if there are no relocs, 
> >bfd_get_reloc_upper_bound should returns
> >sizeof (arelent *) for the ending NULL (and not 0).
> 
> I am not so sure about this.  If the section does not have any relocs 
> associated with it then there should be no need to store anything, not even 
> a NUL reloc.  So returning 0 seems to be the correct thing to me.

som_get_reloc_upper_bound returns the number of bytes needed by
som_canonicalize_reloc.  The latter function returns a NULL terminated
array of pointers.  So one of these functions need changing.  I think
Tristan's patch is the right way to go.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list