This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: elf_sym_hashes saved for --as-needed
- From: Alan Modra <amodra at gmail dot com>
- To: Kyrylo Tkachov <kyrylo dot tkachov at arm dot com>
- Cc: binutils at sourceware dot org
- Date: Thu, 9 May 2013 08:57:54 +0930
- Subject: Re: elf_sym_hashes saved for --as-needed
- References: <20130506084302 dot GE5221 at bubble dot grove dot modra dot org> <518a7268 dot e2bf420a dot 5a77 dot fffff1cdSMTPIN_ADDED_BROKEN at mx dot google dot com>
On Wed, May 08, 2013 at 04:41:58PM +0100, Kyrylo Tkachov wrote:
> collect2: error: ld terminated with signal 11 [Segmentation fault]
A silly error. This should fix it.
* elflink.c (elf_link_add_object_symbols): Don't omit reading
of symbols when hashes already exist.
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.493
diff -u -p -r1.493 elflink.c
--- bfd/elflink.c 6 May 2013 08:45:40 -0000 1.493
+++ bfd/elflink.c 8 May 2013 23:24:02 -0000
@@ -3699,20 +3699,23 @@ error_free_dyn:
}
sym_hash = elf_sym_hashes (abfd);
- if (sym_hash == NULL && extsymcount != 0)
+ if (extsymcount != 0)
{
isymbuf = bfd_elf_get_elf_syms (abfd, hdr, extsymcount, extsymoff,
NULL, NULL, NULL);
if (isymbuf == NULL)
goto error_return;
- /* We store a pointer to the hash table entry for each external
- symbol. */
- amt = extsymcount * sizeof (struct elf_link_hash_entry *);
- sym_hash = (struct elf_link_hash_entry **) bfd_zalloc (abfd, amt);
if (sym_hash == NULL)
- goto error_free_sym;
- elf_sym_hashes (abfd) = sym_hash;
+ {
+ /* We store a pointer to the hash table entry for each
+ external symbol. */
+ amt = extsymcount * sizeof (struct elf_link_hash_entry *);
+ sym_hash = (struct elf_link_hash_entry **) bfd_zalloc (abfd, amt);
+ if (sym_hash == NULL)
+ goto error_free_sym;
+ elf_sym_hashes (abfd) = sym_hash;
+ }
}
if (dynamic)
--
Alan Modra
Australia Development Lab, IBM