This is the mail archive of the binutils@sources.redhat.com 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]

PATCH: PR/1025: binutils failed to build gcc 4.0.1 20050619


This patch fixes PR/1025. It also shows up on many platforms where
indirect symbols aren't handled properly, like

http://gcc.gnu.org/ml/gcc/2005-06/msg00842.html
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22109

Those platforms need similar patch.


H.J.
-----
2005-06-19  H.J. Lu  <hongjiu.lu@intel.com>

	PR 1025:
	* elf32-i386.c (elf_i386_check_relocs): Handle indirect symbol.
	* elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise.

--- bfd/elf32-i386.c.got	2005-06-18 10:16:12.000000000 -0700
+++ bfd/elf32-i386.c	2005-06-19 23:03:13.000000000 -0700
@@ -924,7 +924,12 @@ elf_i386_check_relocs (bfd *abfd,
       if (r_symndx < symtab_hdr->sh_info)
 	h = NULL;
       else
-	h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+	{
+	  h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+	  while (h->root.type == bfd_link_hash_indirect
+		 || h->root.type == bfd_link_hash_warning)
+	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+	}
 
       r_type = elf_i386_tls_transition (info, r_type, h == NULL);
 
--- bfd/elf64-x86-64.c.got	2005-06-18 10:16:12.000000000 -0700
+++ bfd/elf64-x86-64.c	2005-06-19 23:05:34.000000000 -0700
@@ -677,7 +677,12 @@ elf64_x86_64_check_relocs (bfd *abfd, st
       if (r_symndx < symtab_hdr->sh_info)
 	h = NULL;
       else
-	h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+	{
+	  h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+	  while (h->root.type == bfd_link_hash_indirect
+		 || h->root.type == bfd_link_hash_warning)
+	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+	}
 
       r_type = elf64_x86_64_tls_transition (info, r_type, h == NULL);
       switch (r_type)


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