This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: elf_sym_hashes saved for --as-needed


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]