This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Fix duplicate output section statement lookup
- From: Alan Modra <amodra at gmail dot com>
- To: Guy Martin <gmsoft at tuxicoman dot be>
- Cc: binutils at sourceware dot org
- Date: Fri, 17 Jan 2014 17:03:19 +1030
- Subject: Re: [PATCH] Fix duplicate output section statement lookup
- Authentication-results: sourceware.org; auth=none
- References: <40590ef10cd8c08dddafc067cf818ee7 at tuxicoman dot be> <20140115222459 dot GZ5390 at bubble dot grove dot modra dot org> <8dcd6ff7e0a0d143ad4e3d2db750d2eb at tuxicoman dot be>
On Thu, Jan 16, 2014 at 04:32:46PM +0100, Guy Martin wrote:
> Instead of trying to lookup the output section statement associated with
> an output section, we assign the output section statement to the section
> userdata and retreive it as needed. This also fix an issue occurring
> when multiple section with the same name exists, the wrong one was
> returned.
>
> * ldlang.h (lang_output_section_get): Define.
> * ldlang.c (lang_output_section_get): Likewise.
> (init_os): Set the output_section userdata to the output
> section statement.
> * emultempl/hppaelf.em: Use lang_output_section_get instead of
> lang_output_section_find where applicable.
> * emultempl/aarch64elf.em: Likewise.
> * emultempl/aix.em: Likewise.
> * emultempl/armelf.em: Likewise.
> * emultempl/metagelf.em: Likewise.
> * emultempl/mipself.em: Likewise.
> * emultempl/ppc64elf.em: Likewise.
> * emultempl/spuelf.em: Likewise.
> * emultempl/m68hc1xelf.em: Likewise.
This looks OK, except for the spuelf.em patch.
> if (o != NULL)
> - output_name = o->name;
> - os = lang_output_section_find (output_name);
> + os = lang_output_section_get (o);
Please keep the lookup when o is NULL. OK with that fixed.
--
Alan Modra
Australia Development Lab, IBM