This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: _bfd_elf_merge_symbol tidy
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Tue, 26 Mar 2013 16:37:16 +1030
- Subject: Re: _bfd_elf_merge_symbol tidy
- References: <20130325055926 dot GY18331 at bubble dot grove dot modra dot org> <20130325061120 dot GC18331 at bubble dot grove dot modra dot org>
On Mon, Mar 25, 2013 at 04:41:20PM +1030, Alan Modra wrote:
> This patch reorganizes elf_link_add_object_symbols a little to allow
> removal of two elf_link_hash_lookup calls.
I'm not completely certain that we can't hit a bfd_link_hash_indirect
symbol here after moving _bfd_elf_add_default_symbol before this code.
So make a noise if we ever hit it.
* elflink.c (elf_link_add_object_symbols): Add assertion for
common override alignment check code. Formatting.
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.482
diff -u -p -r1.482 elflink.c
--- bfd/elflink.c 25 Mar 2013 06:12:06 -0000 1.482
+++ bfd/elflink.c 26 Mar 2013 04:58:42 -0000
@@ -4255,6 +4255,9 @@ error_free_dyn:
bfd *normal_bfd;
bfd *common_bfd;
+ BFD_ASSERT (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak);
+
symbol_align = ffs (h->root.u.def.value) - 1;
if (h->root.u.def.section->owner != NULL
&& (h->root.u.def.section->owner->flags & DYNAMIC) == 0)
@@ -4298,7 +4301,8 @@ error_free_dyn:
}
/* Remember the symbol size if it isn't undefined. */
- if ((isym->st_size != 0 && isym->st_shndx != SHN_UNDEF)
+ if (isym->st_size != 0
+ && isym->st_shndx != SHN_UNDEF
&& (definition || h->size == 0))
{
if (h->size != 0
--
Alan Modra
Australia Development Lab, IBM