This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: bfd/elf32-arm.c build breakage
- From: "Maciej W. Rozycki" <macro at imgtec dot com>
- To: Thomas Preudhomme <thomas dot preudhomme at foss dot arm dot com>
- Cc: Alan Modra <amodra at gmail dot com>, <binutils at sourceware dot org>
- Date: Tue, 17 May 2016 12:15:08 +0100
- Subject: Re: bfd/elf32-arm.c build breakage
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 00 dot 1604300408480 dot 21846 at tp dot orcam dot me dot uk> <1791612 dot JvV0be8Ar9 at e108577-lin> <20160517014106 dot GH24091 at bubble dot grove dot modra dot org> <1509984 dot dbhicChkuv at e108577-lin>
On Tue, 17 May 2016, Thomas Preudhomme wrote:
> > diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
> > index 65b593a..f67c59a 100644
> > --- a/bfd/elf32-arm.c
> > +++ b/bfd/elf32-arm.c
> > @@ -5663,6 +5663,15 @@ elf32_arm_size_stubs (bfd *output_bfd,
> > != 0)
> > goto error_ret_free_local;
> > }
> > +
> > + if (local_syms != NULL
> > + && symtab_hdr->contents != (unsigned char *) local_syms)
> > + {
>
> Oops, I had missed that normal exiting of the block was not handled.
>
> > + if (!info->keep_memory)
> > + free (local_syms);
> > + else
> > + symtab_hdr->contents = (unsigned char *) local_syms;
>
> Should we make that check at the error_ret_free_local label as well?
>
> > + }
> > }
>
> Can't we instead move error_ret_free_internal and error_ret_free_local at this
> location and rewrite the if (r_type >= (unsigned int) R_ARM_max) to call
> bfd_set_error and then use goto? That would avoid some code duplication,
> wouldn't it?
FWIW I suspect all these observations mean that you probably want to
factor out this whole block. Besides improving structure it would help
readability too as parts of this code indent quite far to the right.
Maciej