public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* bfd_link_hash_traverse
@ 2011-06-13  1:00 Alan Modra
  2011-06-13 12:55 ` bfd_link_hash_traverse H.J. Lu
  2011-06-13 20:48 ` bfd_link_hash_traverse Ian Lance Taylor
  0 siblings, 2 replies; 8+ messages in thread
From: Alan Modra @ 2011-06-13  1:00 UTC (permalink / raw)
  To: binutils

I audited all the link_hash_traverse functions the other day and found
thirty more that ignored the need to follow u.i.link to see the real
symbol.  Rather than fixing them all individually, as I started to do,
I decided to change the traversal.  It turns out that no traversal
function ever really needs to see warning symbols, but a few currently
do something special.  _bfd_elf_adjust_dynamic_symbol is one instance,
but if all following traversals skip over warning symbols then we
don't need to do anything special there.  elf_link_output_extsym and
similar for other formats just look at warning symbols so that they
can do a little error checking.  The error check of bfd_link_hash_new
symbols could be removed, but instead I keep the old symbol traversal
by using bfd_hash_traverse.

Committed mainline.

bfd/
	* linker.c (bfd_link_hash_traverse): Follow warning symbol link.
	(_bfd_generic_link_write_global_symbol, fix_syms): Don't handle
	warning symbols here.
	* elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise.
	* elf32-arm.c (allocate_dynrelocs_for_symbol,
	elf32_arm_readonly_dynrelocs): Likewise.
	* elf32-bfin.c (bfin_discard_copies): Likewise.
	* elf32-cris.c (elf_cris_adjust_gotplt_to_got,
	elf_cris_discard_excess_dso_dynamics,
	elf_cris_discard_excess_program_dynamics): Likewise.
	* elf32-hppa.c (allocate_plt_static, allocate_dynrelocs,
	clobber_millicode_symbols, readonly_dynrelocs): Likewise.
	* elf32-i370.c (i370_elf_adjust_dynindx): Likewise.
	* elf32-i386.c (elf_i386_allocate_dynrelocs,
	elf_i386_readonly_dynrelocs): Likewise.
	* elf32-lm32.c (allocate_dynrelocs, readonly_dynrelocs): Likewise.
	* elf32-m32c.c (m32c_relax_plt_check, m32c_relax_plt_realloc): Likewise.
	* elf32-m32r.c (allocate_dynrelocs, readonly_dynrelocs): Likewise.
	* elf32-m68k.c (elf_m68k_discard_copies): Likewise.
	* elf32-microblaze.c (allocate_dynrelocs): Likewise.
	* elf32-ppc.c (allocate_dynrelocs, maybe_set_textrel): Likewise.
	* elf32-s390.c (allocate_dynrelocs, readonly_dynrelocs): Likewise.
	* elf32-score.c (score_elf_sort_hash_table_f): Likewise.
	* elf32-score7.c (score_elf_sort_hash_table_f): Likewise.
	* elf32-sh.c (allocate_dynrelocs, readonly_dynrelocs): Likewise.
	* elf32-tic6x.c (elf32_tic6x_allocate_dynrelocs,
	elf32_tic6x_readonly_dynrelocs): Likewise.
	* elf32-vax.c (elf_vax_discard_copies): Likewise.
	* elf32-xstormy16.c (xstormy16_relax_plt_check,
	xstormy16_relax_plt_realloc): Likewise.
	* elf32-xtensa.c (elf_xtensa_allocate_dynrelocs): Likewise.
	* elf64-alpha.c (elf64_alpha_output_extsym,
	elf64_alpha_calc_got_offsets_for_symbol,
	elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_1): Likewise.
	* elf64-hppa.c (elf64_hppa_mark_exported_functions,
	allocate_global_data_opd, elf64_hppa_mark_milli_and_exported_functions,
	elf_hppa_unmark_useless_dynamic_symbols,
	elf_hppa_remark_useless_dynamic_symbols): Likewise.
	* elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref, func_desc_adjust,
	adjust_opd_syms, adjust_toc_syms, allocate_dynrelocs,
	readonly_dynrelocs, merge_global_got, reallocate_got,
	undo_symbol_twiddle): Likewise.
	* elf64-s390.c (allocate_dynrelocs, readonly_dynrelocs): Likewise.
	* elf64-sh64.c (sh64_elf64_discard_copies): Likewise.
	* elf64-x86-64.c (elf_x86_64_allocate_dynrelocs,
	elf_x86_64_readonly_dynrelocs): Likewise.
	* elflink.c (elf_link_renumber_hash_table_dynsyms,
	elf_link_renumber_local_hash_table_dynsyms, _bfd_elf_export_symbol,
	_bfd_elf_link_find_version_dependencies,
	_bfd_elf_link_assign_sym_version, _bfd_elf_adjust_dynamic_symbol,
	_bfd_elf_link_sec_merge_syms, elf_adjust_dynstr_offsets,
	elf_collect_hash_codes, elf_collect_gnu_hash_codes,
	elf_renumber_gnu_hash_syms, elf_gc_sweep_symbol,
	elf_gc_propagate_vtable_entries_used,
	elf_gc_smash_unused_vtentry_relocs, bfd_elf_gc_mark_dynamic_ref_symbol,
	elf_gc_allocate_got_offsets): Likewise.
	* elfnn-ia64.c (elfNN_ia64_global_dyn_info_free,
	elfNN_ia64_global_dyn_sym_thunk): Likewise.
	* elfxx-mips.c (mips_elf_check_symbols, mips_elf_output_extsym,
	mips_elf_sort_hash_table_f, allocate_dynrelocs): Likewise.
	* elfxx-sparc.c (allocate_dynrelocs, readonly_dynrelocs): Likewise.
	* i386linux.c (linux_tally_symbols): Likewise.
	* m68klinux.c (linux_tally_symbols): Likewise.
	* sparclinux.c (linux_tally_symbols): Likewise.
	* sunos.c (sunos_scan_dynamic_symbol): Likewise.
	* xcofflink.c (xcoff_post_gc_symbol): Likewise.

	* elflink.c (elf_link_output_extsym): Make it a bfd_hash_traverse
	function.  Update all callers.
	* aoutx.h (aout_link_write_other_symbol): Likewise.
	* pdp11.c (aout_link_write_other_symbol): Likewise.
	* cofflink.c (_bfd_coff_write_global_sym): Likewise.
	* ecoff.c (ecoff_link_write_external): Likewise.
	* xcofflink.c (xcoff_write_global_symbol): Likewise.
	* vms-alpha.c (alpha_vms_link_output_symbol): Likewise.  Handle
	warning symbols.
	* ecoff.c (ecoff_link_hash_traverse): Delete.
	* coff-ppc.c (ppc_bfd_coff_final_link): Use bfd_hash_traverse for
	_bfd_coff_write_global_sym.
	* libcoff-in.h (_bfd_coff_write_global_sym): Update prototype.
	* libcoff.h: Regenerate.
ld/
	* ldlang.c (sort_def_symbol, lang_one_common): Don't handle
	warning symbols here.
	* emultempl/pe.em (pr_sym): Remove redundant test.
	* emultempl/pep.em (pr_sym): Likewise.

Index: bfd/linker.c
===================================================================
RCS file: /cvs/src/src/bfd/linker.c,v
retrieving revision 1.84
diff -u -p -r1.84 linker.c
--- bfd/linker.c	10 Jun 2011 14:04:24 -0000	1.84
+++ bfd/linker.c	12 Jun 2011 13:46:24 -0000
@@ -604,21 +604,32 @@ bfd_wrapped_link_hash_lookup (bfd *abfd,
   return bfd_link_hash_lookup (info->hash, string, create, copy, follow);
 }
 
-/* Traverse a generic link hash table.  The only reason this is not a
-   macro is to do better type checking.  This code presumes that an
-   argument passed as a struct bfd_hash_entry * may be caught as a
-   struct bfd_link_hash_entry * with no explicit cast required on the
-   call.  */
+/* Traverse a generic link hash table.  Differs from bfd_hash_traverse
+   in the treatment of warning symbols.  When warning symbols are
+   created they replace the real symbol, so you don't get to see the
+   real symbol in a bfd_hash_travere.  This traversal calls func with
+   the real symbol.  */
 
 void
 bfd_link_hash_traverse
-  (struct bfd_link_hash_table *table,
+  (struct bfd_link_hash_table *htab,
    bfd_boolean (*func) (struct bfd_link_hash_entry *, void *),
    void *info)
 {
-  bfd_hash_traverse (&table->table,
-		     (bfd_boolean (*) (struct bfd_hash_entry *, void *)) func,
-		     info);
+  unsigned int i;
+
+  htab->table.frozen = 1;
+  for (i = 0; i < htab->table.size; i++)
+    {
+      struct bfd_link_hash_entry *p;
+
+      p = (struct bfd_link_hash_entry *) htab->table.table[i];
+      for (; p != NULL; p = (struct bfd_link_hash_entry *) p->root.next)
+	if (!(*func) (p->type == bfd_link_hash_warning ? p->u.i.link : p, info))
+	  goto out;
+    }
+ out:
+  htab->table.frozen = 0;
 }
 
 /* Add a symbol to the linker hash table undefs list.  */
@@ -2442,9 +2453,6 @@ _bfd_generic_link_write_global_symbol (s
       (struct generic_write_global_symbol_info *) data;
   asymbol *sym;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct generic_link_hash_entry *) h->root.u.i.link;
-
   if (h->written)
     return TRUE;
 
@@ -3095,9 +3103,6 @@ fix_syms (struct bfd_link_hash_entry *h,
 {
   bfd *obfd = (bfd *) data;
 
-  if (h->type == bfd_link_hash_warning)
-    h = h->u.i.link;
-
   if (h->type == bfd_link_hash_defined
       || h->type == bfd_link_hash_defweak)
     {
Index: bfd/aoutx.h
===================================================================
RCS file: /cvs/src/src/bfd/aoutx.h,v
retrieving revision 1.86
diff -u -p -r1.86 aoutx.h
--- bfd/aoutx.h	3 Mar 2011 23:47:21 -0000	1.86
+++ bfd/aoutx.h	12 Jun 2011 12:53:12 -0000
@@ -1,6 +1,6 @@
 /* BFD semi-generic back-end for a.out binaries.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -3551,8 +3551,9 @@ aout_link_includes_newfunc (struct bfd_h
    object.  */
 
 static bfd_boolean
-aout_link_write_other_symbol (struct aout_link_hash_entry *h, void * data)
+aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data)
 {
+  struct aout_link_hash_entry *h = (struct aout_link_hash_entry *) bh;
   struct aout_final_link_info *finfo = (struct aout_final_link_info *) data;
   bfd *output_bfd;
   int type;
@@ -3719,7 +3720,7 @@ aout_link_reloc_link_order (struct aout_
 	     symbol.  */
 	  h->indx = -2;
 	  h->written = FALSE;
-	  if (! aout_link_write_other_symbol (h, (void *) finfo))
+	  if (!aout_link_write_other_symbol (&h->root.root, finfo))
 	    return FALSE;
 	  r_index = h->indx;
 	}
@@ -4077,8 +4078,8 @@ aout_link_input_section_std (struct aout
 			    {
 			      h->indx = -2;
 			      h->written = FALSE;
-			      if (! aout_link_write_other_symbol (h,
-								  (void *) finfo))
+			      if (!aout_link_write_other_symbol (&h->root.root,
+								 finfo))
 				return FALSE;
 			    }
 			  r_index = h->indx;
@@ -4419,8 +4420,8 @@ aout_link_input_section_ext (struct aout
 			    {
 			      h->indx = -2;
 			      h->written = FALSE;
-			      if (! aout_link_write_other_symbol (h,
-								  (void *) finfo))
+			      if (!aout_link_write_other_symbol (&h->root.root,
+								 finfo))
 				return FALSE;
 			    }
 			  r_index = h->indx;
@@ -5468,7 +5469,7 @@ NAME (aout, final_link) (bfd *abfd,
     h = aout_link_hash_lookup (aout_hash_table (info), "__DYNAMIC",
 			       FALSE, FALSE, FALSE);
     if (h != NULL)
-      aout_link_write_other_symbol (h, &aout_info);
+      aout_link_write_other_symbol (&h->root.root, &aout_info);
   }
 
   /* The most time efficient way to do the link would be to read all
@@ -5542,9 +5543,9 @@ NAME (aout, final_link) (bfd *abfd,
     }
 
   /* Write out any symbols that we have not already written out.  */
-  aout_link_hash_traverse (aout_hash_table (info),
-			   aout_link_write_other_symbol,
-			   (void *) &aout_info);
+  bfd_hash_traverse (&info->hash->table,
+		     aout_link_write_other_symbol,
+		     &aout_info);
 
   /* Now handle any relocs we were asked to create by the linker.
      These did not come from any input file.  We must do these after
Index: bfd/coff-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-ppc.c,v
retrieving revision 1.40
diff -u -p -r1.40 coff-ppc.c
--- bfd/coff-ppc.c	6 Jun 2011 01:26:01 -0000	1.40
+++ bfd/coff-ppc.c	12 Jun 2011 12:53:17 -0000
@@ -2401,8 +2401,7 @@ ppc_bfd_coff_final_link (abfd, info)
 
   /* Write out the global symbols.  */
   finfo.failed = FALSE;
-  coff_link_hash_traverse (coff_hash_table (info), _bfd_coff_write_global_sym,
-			   (PTR) &finfo);
+  bfd_hash_traverse (&info->hash->table, _bfd_coff_write_global_sym, &finfo);
   if (finfo.failed)
     goto error_return;
 
Index: bfd/cofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/cofflink.c,v
retrieving revision 1.76
diff -u -p -r1.76 cofflink.c
--- bfd/cofflink.c	7 May 2011 14:29:08 -0000	1.76
+++ bfd/cofflink.c	12 Jun 2011 12:53:18 -0000
@@ -1,6 +1,6 @@
 /* COFF specific linker code.
    Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+   2004, 2005, 2006, 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -1019,8 +1019,7 @@ _bfd_coff_final_link (bfd *abfd,
 
   /* Write out the global symbols.  */
   finfo.failed = FALSE;
-  coff_link_hash_traverse (coff_hash_table (info),
-			   _bfd_coff_write_global_sym, &finfo);
+  bfd_hash_traverse (&info->hash->table, _bfd_coff_write_global_sym, &finfo);
   if (finfo.failed)
     goto error_return;
 
@@ -2516,11 +2515,12 @@ _bfd_coff_link_input_bfd (struct coff_fi
   return TRUE;
 }
 
-/* Write out a global symbol.  Called via coff_link_hash_traverse.  */
+/* Write out a global symbol.  Called via bfd_hash_traverse.  */
 
 bfd_boolean
-_bfd_coff_write_global_sym (struct coff_link_hash_entry *h, void *data)
+_bfd_coff_write_global_sym (struct bfd_hash_entry *bh, void *data)
 {
+  struct coff_link_hash_entry *h = (struct coff_link_hash_entry *) bh;
   struct coff_final_link_info *finfo = (struct coff_final_link_info *) data;
   bfd *output_bfd;
   struct internal_syment isym;
@@ -2745,7 +2745,7 @@ _bfd_coff_write_task_globals (struct cof
 	case bfd_link_hash_defweak:
 	  save_global_to_static = finfo->global_to_static;
 	  finfo->global_to_static = TRUE;
-	  rtnval = _bfd_coff_write_global_sym (h, data);
+	  rtnval = _bfd_coff_write_global_sym (&h->root.root, data);
 	  finfo->global_to_static = save_global_to_static;
 	  break;
 	default:
Index: bfd/ecoff.c
===================================================================
RCS file: /cvs/src/src/bfd/ecoff.c,v
retrieving revision 1.72
diff -u -p -r1.72 ecoff.c
--- bfd/ecoff.c	13 Dec 2010 01:06:16 -0000	1.72
+++ bfd/ecoff.c	12 Jun 2011 12:53:20 -0000
@@ -1,6 +1,6 @@
 /* Generic ECOFF (Extended-COFF) routines.
    Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
    Original version by Per Bothner.
    Full support added by Ian Lance Taylor, ian@cygnus.com.
@@ -3231,14 +3231,6 @@ _bfd_ecoff_bfd_link_hash_table_create (b
   ((struct ecoff_link_hash_entry *) \
    bfd_link_hash_lookup (&(table)->root, (string), (create), (copy), (follow)))
 
-/* Traverse an ECOFF link hash table.  */
-
-#define ecoff_link_hash_traverse(table, func, info)			\
-  (bfd_link_hash_traverse						\
-   (&(table)->root,							\
-    (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func),	\
-    (info)))
-
 /* Get the ECOFF link hash table from the info structure.  This is
    just a cast.  */
 
@@ -4259,8 +4251,9 @@ ecoff_reloc_link_order (bfd *output_bfd,
    the hash table.  */
 
 static bfd_boolean
-ecoff_link_write_external (struct ecoff_link_hash_entry *h, void * data)
+ecoff_link_write_external (struct bfd_hash_entry *bh, void * data)
 {
+  struct ecoff_link_hash_entry *h = (struct ecoff_link_hash_entry *) bh;
   struct extsym_info *einfo = (struct extsym_info *) data;
   bfd *output_bfd = einfo->abfd;
   bfd_boolean strip;
@@ -4491,9 +4484,7 @@ _bfd_ecoff_bfd_final_link (bfd *abfd, st
   /* Write out the external symbols.  */
   einfo.abfd = abfd;
   einfo.info = info;
-  ecoff_link_hash_traverse (ecoff_hash_table (info),
-			    ecoff_link_write_external,
-			    (void *) &einfo);
+  bfd_hash_traverse (&info->hash->table, ecoff_link_write_external, &einfo);
 
   if (info->relocatable)
     {
Index: bfd/elf-m10300.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-m10300.c,v
retrieving revision 1.107
diff -u -p -r1.107 elf-m10300.c
--- bfd/elf-m10300.c	23 May 2011 14:55:39 -0000	1.107
+++ bfd/elf-m10300.c	12 Jun 2011 12:53:23 -0000
@@ -1,6 +1,6 @@
 /* Matsushita 10300 specific support for 32-bit ELF
    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+   2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -1602,9 +1602,6 @@ elf32_mn10300_finish_hash_table_entry (s
 
   entry = (struct elf32_mn10300_link_hash_entry *) gen_entry;
 
-  if (entry->root.root.type == bfd_link_hash_warning)
-    entry = (struct elf32_mn10300_link_hash_entry *) entry->root.root.u.i.link;
-
   /* If we already know we want to convert "call" to "calls" for calls
      to this symbol, then return now.  */
   if (entry->flags == MN10300_CONVERT_CALL_TO_CALLS)
Index: bfd/elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.268
diff -u -p -r1.268 elf32-arm.c
--- bfd/elf32-arm.c	2 Jun 2011 13:43:14 -0000	1.268
+++ bfd/elf32-arm.c	12 Jun 2011 12:53:28 -0000
@@ -12787,12 +12789,6 @@ allocate_dynrelocs_for_symbol (struct el
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    /* When warning symbols are created, they **replace** the "real"
-       entry in the hash table, thus we never get to see the real
-       symbol in a hash traversal.  So look at it now.  */
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   eh = (struct elf32_arm_link_hash_entry *) h;
 
   info = (struct bfd_link_info *) inf;
@@ -13156,9 +13152,6 @@ elf32_arm_readonly_dynrelocs (struct elf
   struct elf32_arm_link_hash_entry * eh;
   struct elf_dyn_relocs * p;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   eh = (struct elf32_arm_link_hash_entry *) h;
   for (p = eh->dyn_relocs; p != NULL; p = p->next)
     {
Index: bfd/elf32-bfin.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-bfin.c,v
retrieving revision 1.53
diff -u -p -r1.53 elf32-bfin.c
--- bfd/elf32-bfin.c	28 Feb 2011 18:30:16 -0000	1.53
+++ bfd/elf32-bfin.c	12 Jun 2011 12:53:30 -0000
@@ -5451,9 +5451,6 @@ bfin_discard_copies (struct elf_link_has
   struct bfd_link_info *info = (struct bfd_link_info *) inf;
   struct bfin_pcrel_relocs_copied *s;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   if (!h->def_regular || (!info->symbolic && !h->forced_local))
     {
       if ((info->flags & DF_TEXTREL) == 0)
Index: bfd/elf32-cris.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-cris.c,v
retrieving revision 1.114
diff -u -p -r1.114 elf32-cris.c
--- bfd/elf32-cris.c	25 Oct 2010 15:54:13 -0000	1.114
+++ bfd/elf32-cris.c	12 Jun 2011 12:53:32 -0000
@@ -1,6 +1,6 @@
 /* CRIS-specific support for 32-bit ELF.
    Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-   2010  Free Software Foundation, Inc.
+   2010, 2011 Free Software Foundation, Inc.
    Contributed by Axis Communications AB.
    Written by Hans-Peter Nilsson, based on elf32-fr30.c
    PIC and shlib bits based primarily on elf32-m68k.c and elf32-i386.c.
@@ -2733,9 +2733,6 @@ elf_cris_adjust_gotplt_to_got (h, p)
 {
   struct bfd_link_info *info = (struct bfd_link_info *) p;
 
-  if (h->root.root.type == bfd_link_hash_warning)
-    h = (struct elf_cris_link_hash_entry *) h->root.root.u.i.link;
-
   /* If nobody wanted a GOTPLT with this symbol, we're done.  */
   if (h->gotplt_refcount <= 0)
     return TRUE;
@@ -3956,9 +3953,6 @@ elf_cris_discard_excess_dso_dynamics (h,
   struct elf_cris_pcrel_relocs_copied *s;
   struct bfd_link_info *info = (struct bfd_link_info *) inf;
 
-  if (h->root.root.type == bfd_link_hash_warning)
-    h = (struct elf_cris_link_hash_entry *) h->root.root.u.i.link;
-
   /* If a symbol has been forced local or we have found a regular
      definition for the symbolic link case, then we won't be needing
      any relocs.  */
@@ -4014,9 +4008,6 @@ elf_cris_discard_excess_program_dynamics
 {
   struct bfd_link_info *info = (struct bfd_link_info *) inf;
 
-  if (h->root.root.type == bfd_link_hash_warning)
-    h = (struct elf_cris_link_hash_entry *) h->root.root.u.i.link;
-
   /* If we're not creating a shared library and have a symbol which is
      referred to by .got references, but the symbol is defined locally,
      (or rather, not defined by a DSO) then lose the reloc for the .got
Index: bfd/elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.176
diff -u -p -r1.176 elf32-hppa.c
--- bfd/elf32-hppa.c	25 Oct 2010 15:54:14 -0000	1.176
+++ bfd/elf32-hppa.c	12 Jun 2011 12:53:34 -0000
@@ -1,6 +1,6 @@
 /* BFD back-end for HP PA-RISC ELF files.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001,
-   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
 
    Original code by
@@ -1938,9 +1938,6 @@ allocate_plt_static (struct elf_link_has
   if (eh->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (eh->root.type == bfd_link_hash_warning)
-    eh = (struct elf_link_hash_entry *) eh->root.u.i.link;
-
   info = (struct bfd_link_info *) inf;
   hh = hppa_elf_hash_entry (eh);
   htab = hppa_link_hash_table (info);
@@ -2008,9 +2005,6 @@ allocate_dynrelocs (struct elf_link_hash
   if (eh->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (eh->root.type == bfd_link_hash_warning)
-    eh = (struct elf_link_hash_entry *) eh->root.u.i.link;
-
   info = inf;
   htab = hppa_link_hash_table (info);
   if (htab == NULL)
@@ -2170,9 +2164,6 @@ static bfd_boolean
 clobber_millicode_symbols (struct elf_link_hash_entry *eh,
 			   struct bfd_link_info *info)
 {
-  if (eh->root.type == bfd_link_hash_warning)
-    eh = (struct elf_link_hash_entry *) eh->root.u.i.link;
-
   if (eh->type == STT_PARISC_MILLI
       && !eh->forced_local)
     {
@@ -2189,9 +2180,6 @@ readonly_dynrelocs (struct elf_link_hash
   struct elf32_hppa_link_hash_entry *hh;
   struct elf32_hppa_dyn_reloc_entry *hdh_p;
 
-  if (eh->root.type == bfd_link_hash_warning)
-    eh = (struct elf_link_hash_entry *) eh->root.u.i.link;
-
   hh = hppa_elf_hash_entry (eh);
   for (hdh_p = hh->dyn_relocs; hdh_p != NULL; hdh_p = hdh_p->hdh_next)
     {
Index: bfd/elf32-i370.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i370.c,v
retrieving revision 1.68
diff -u -p -r1.68 elf32-i370.c
--- bfd/elf32-i370.c	14 Mar 2011 15:54:58 -0000	1.68
+++ bfd/elf32-i370.c	12 Jun 2011 12:53:34 -0000
@@ -562,9 +562,6 @@ i370_elf_adjust_dynindx (struct elf_link
 	   h->dynindx, *cp);
 #endif
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   if (h->dynindx != -1)
     h->dynindx += *cp;
 
Index: bfd/elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.253
diff -u -p -r1.253 elf32-i386.c
--- bfd/elf32-i386.c	1 Jun 2011 19:42:01 -0000	1.253
+++ bfd/elf32-i386.c	12 Jun 2011 12:53:36 -0000
@@ -2083,11 +2083,6 @@ elf_i386_allocate_dynrelocs (struct elf_
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    /* When warning symbols are created, they **replace** the "real"
-       entry in the hash table, thus we never get to see the real
-       symbol in a hash traversal.  So look at it now.  */
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
   eh = (struct elf_i386_link_hash_entry *) h;
 
   info = (struct bfd_link_info *) inf;
@@ -2383,9 +2378,6 @@ elf_i386_readonly_dynrelocs (struct elf_
   struct elf_i386_link_hash_entry *eh;
   struct elf_dyn_relocs *p;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   /* Skip local IFUNC symbols. */
   if (h->forced_local && h->type == STT_GNU_IFUNC)
     return TRUE;
Index: bfd/elf32-lm32.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-lm32.c,v
retrieving revision 1.8
diff -u -p -r1.8 elf32-lm32.c
--- bfd/elf32-lm32.c	25 Oct 2010 15:54:14 -0000	1.8
+++ bfd/elf32-lm32.c	12 Jun 2011 12:53:37 -0000
@@ -1,5 +1,5 @@
 /* Lattice Mico32-specific support for 32-bit ELF
-   Copyright 2008, 2009, 2010  Free Software Foundation, Inc.
+   Copyright 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
    Contributed by Jon Beniston <jon@beniston.com>
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -1918,12 +1918,6 @@ allocate_dynrelocs (struct elf_link_hash
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    /* When warning symbols are created, they **replace** the "real"
-       entry in the hash table, thus we never get to see the real
-       symbol in a hash traversal.  So look at it now.  */
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   info = (struct bfd_link_info *) inf;
   htab = lm32_elf_hash_table (info);
   if (htab == NULL)
@@ -2110,9 +2104,6 @@ readonly_dynrelocs (struct elf_link_hash
   struct elf_lm32_link_hash_entry *eh;
   struct elf_lm32_dyn_relocs *p;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   eh = (struct elf_lm32_link_hash_entry *) h;
   for (p = eh->dyn_relocs; p != NULL; p = p->next)
     {
Index: bfd/elf32-m32c.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m32c.c,v
retrieving revision 1.23
diff -u -p -r1.23 elf32-m32c.c
--- bfd/elf32-m32c.c	25 Oct 2010 15:54:14 -0000	1.23
+++ bfd/elf32-m32c.c	12 Jun 2011 12:53:38 -0000
@@ -1,5 +1,5 @@
 /* M16C/M32C specific support for 32-bit ELF.
-   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -989,9 +989,6 @@ m32c_relax_plt_check (struct elf_link_ha
 {
   struct relax_plt_data *data = (struct relax_plt_data *) xdata;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   if (h->plt.offset != (bfd_vma) -1)
     {
       bfd_vma address;
@@ -1024,9 +1021,6 @@ m32c_relax_plt_realloc (struct elf_link_
 {
   bfd_vma *entry = (bfd_vma *) xdata;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   if (h->plt.offset != (bfd_vma) -1)
     {
       h->plt.offset = *entry;
Index: bfd/elf32-m32r.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m32r.c,v
retrieving revision 1.101
diff -u -p -r1.101 elf32-m32r.c
--- bfd/elf32-m32r.c	25 Oct 2010 15:54:14 -0000	1.101
+++ bfd/elf32-m32r.c	12 Jun 2011 12:53:39 -0000
@@ -1,6 +1,6 @@
 /* M32R-specific support for 32-bit ELF.
    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+   2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -1977,12 +1977,6 @@ allocate_dynrelocs (struct elf_link_hash
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    /* When warning symbols are created, they **replace** the "real"
-       entry in the hash table, thus we never get to see the real
-       symbol in a hash traversal.  So look at it now.  */
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   info = (struct bfd_link_info *) inf;
   htab = m32r_elf_hash_table (info);
   if (htab == NULL)
@@ -2169,9 +2163,6 @@ readonly_dynrelocs (struct elf_link_hash
   struct elf_m32r_link_hash_entry *eh;
   struct elf_m32r_dyn_relocs *p;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   eh = (struct elf_m32r_link_hash_entry *) h;
   for (p = eh->dyn_relocs; p != NULL; p = p->next)
     {
Index: bfd/elf32-m68k.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68k.c,v
retrieving revision 1.125
diff -u -p -r1.125 elf32-m68k.c
--- bfd/elf32-m68k.c	22 Feb 2011 15:46:13 -0000	1.125
+++ bfd/elf32-m68k.c	12 Jun 2011 12:53:41 -0000
@@ -1,6 +1,7 @@
 /* Motorola 68k series support for 32-bit ELF
    Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+   2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+   Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -3466,9 +3467,6 @@ elf_m68k_discard_copies (h, inf)
   struct bfd_link_info *info = (struct bfd_link_info *) inf;
   struct elf_m68k_pcrel_relocs_copied *s;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   if (!SYMBOL_CALLS_LOCAL (info, h))
     {
       if ((info->flags & DF_TEXTREL) == 0)
Index: bfd/elf32-microblaze.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-microblaze.c,v
retrieving revision 1.10
diff -u -p -r1.10 elf32-microblaze.c
--- bfd/elf32-microblaze.c	11 Apr 2011 04:08:12 -0000	1.10
+++ bfd/elf32-microblaze.c	12 Jun 2011 12:53:41 -0000
@@ -2382,12 +2382,6 @@ allocate_dynrelocs (struct elf_link_hash
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    /* When warning symbols are created, they **replace** the "real"
-       entry in the hash table, thus we never get to see the real
-       symbol in a hash traversal.  So look at it now.  */
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   info = (struct bfd_link_info *) dat;
   htab = elf32_mb_hash_table (info);
   if (htab == NULL)
Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.297
diff -u -p -r1.297 elf32-ppc.c
--- bfd/elf32-ppc.c	2 Jun 2011 13:43:14 -0000	1.297
+++ bfd/elf32-ppc.c	12 Jun 2011 12:53:44 -0000
@@ -5149,12 +5149,6 @@ allocate_dynrelocs (struct elf_link_hash
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    /* When warning symbols are created, they **replace** the "real"
-       entry in the hash table, thus we never get to see the real
-       symbol in a hash traversal.  So look at it now.  */
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   htab = ppc_elf_hash_table (info);
   if (htab->elf.dynamic_sections_created
       || h->type == STT_GNU_IFUNC)
@@ -5504,9 +5498,6 @@ maybe_set_textrel (struct elf_link_hash_
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   if (readonly_dynrelocs (h))
     {
       ((struct bfd_link_info *) info)->flags |= DF_TEXTREL;
Index: bfd/elf32-s390.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-s390.c,v
retrieving revision 1.107
diff -u -p -r1.107 elf32-s390.c
--- bfd/elf32-s390.c	25 Oct 2010 15:54:14 -0000	1.107
+++ bfd/elf32-s390.c	12 Jun 2011 12:53:46 -0000
@@ -1,6 +1,6 @@
 /* IBM S/390-specific support for 32-bit ELF
-   Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-   Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+   2011 Free Software Foundation, Inc.
    Contributed by Carl B. Pedersen and Martin Schwidefsky.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -1696,12 +1696,6 @@ allocate_dynrelocs (h, inf)
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    /* When warning symbols are created, they **replace** the "real"
-       entry in the hash table, thus we never get to see the real
-       symbol in a hash traversal.  So look at it now.  */
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   info = (struct bfd_link_info *) inf;
   htab = elf_s390_hash_table (info);
 
@@ -1922,9 +1916,6 @@ readonly_dynrelocs (h, inf)
   struct elf_s390_link_hash_entry *eh;
   struct elf_s390_dyn_relocs *p;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   eh = (struct elf_s390_link_hash_entry *) h;
   for (p = eh->dyn_relocs; p != NULL; p = p->next)
     {
Index: bfd/elf32-score.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-score.c,v
retrieving revision 1.21
diff -u -p -r1.21 elf32-score.c
--- bfd/elf32-score.c	25 Oct 2010 15:54:14 -0000	1.21
+++ bfd/elf32-score.c	12 Jun 2011 12:53:47 -0000
@@ -1037,9 +1037,6 @@ score_elf_sort_hash_table_f (struct scor
 {
   struct score_elf_hash_sort_data *hsd = data;
 
-  if (h->root.root.type == bfd_link_hash_warning)
-    h = (struct score_elf_link_hash_entry *) h->root.root.u.i.link;
-
   /* Symbols without dynamic symbol table entries aren't interesting at all.  */
   if (h->root.dynindx == -1)
     return TRUE;
Index: bfd/elf32-score7.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-score7.c,v
retrieving revision 1.8
diff -u -p -r1.8 elf32-score7.c
--- bfd/elf32-score7.c	25 Oct 2010 15:54:14 -0000	1.8
+++ bfd/elf32-score7.c	12 Jun 2011 12:53:49 -0000
@@ -1,5 +1,5 @@
 /* 32-bit ELF support for S+core.
-   Copyright 2009, 2010 Free Software Foundation, Inc.
+   Copyright 2009, 2010, 2011 Free Software Foundation, Inc.
    Contributed by
    Brain.lin (brain.lin@sunplusct.com)
    Mei Ligang (ligang@sunnorth.com.cn)
@@ -920,9 +920,6 @@ score_elf_sort_hash_table_f (struct scor
 {
   struct score_elf_hash_sort_data *hsd = data;
 
-  if (h->root.root.type == bfd_link_hash_warning)
-    h = (struct score_elf_link_hash_entry *) h->root.root.u.i.link;
-
   /* Symbols without dynamic symbol table entries aren't interesting at all.  */
   if (h->root.dynindx == -1)
     return TRUE;
Index: bfd/elf32-sh.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh.c,v
retrieving revision 1.170
diff -u -p -r1.170 elf32-sh.c
--- bfd/elf32-sh.c	25 Oct 2010 15:54:14 -0000	1.170
+++ bfd/elf32-sh.c	12 Jun 2011 12:53:52 -0000
@@ -1,6 +1,6 @@
 /* Renesas / SuperH SH specific support for 32-bit ELF
    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+   2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
    Contributed by Ian Lance Taylor, Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -2977,12 +2977,6 @@ allocate_dynrelocs (struct elf_link_hash
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    /* When warning symbols are created, they **replace** the "real"
-       entry in the hash table, thus we never get to see the real
-       symbol in a hash traversal.  So look at it now.  */
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   info = (struct bfd_link_info *) inf;
   htab = sh_elf_hash_table (info);
   if (htab == NULL)
@@ -3321,9 +3315,6 @@ readonly_dynrelocs (struct elf_link_hash
   struct elf_sh_link_hash_entry *eh;
   struct elf_sh_dyn_relocs *p;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   eh = (struct elf_sh_link_hash_entry *) h;
   for (p = eh->dyn_relocs; p != NULL; p = p->next)
     {
Index: bfd/elf32-tic6x.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-tic6x.c,v
retrieving revision 1.24
diff -u -p -r1.24 elf32-tic6x.c
--- bfd/elf32-tic6x.c	20 May 2011 10:09:57 -0000	1.24
+++ bfd/elf32-tic6x.c	12 Jun 2011 12:53:55 -0000
@@ -3127,13 +3129,7 @@ elf32_tic6x_allocate_dynrelocs (struct e
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    /* When warning symbols are created, they **replace** the "real"
-       entry in the hash table, thus we never get to see the real
-       symbol in a hash traversal.  So look at it now.  */
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
   eh = (struct elf32_tic6x_link_hash_entry *) h;
-
   info = (struct bfd_link_info *) inf;
   htab = elf32_tic6x_hash_table (info);
 
@@ -3277,9 +3273,6 @@ elf32_tic6x_readonly_dynrelocs (struct e
   struct elf32_tic6x_link_hash_entry *eh;
   struct elf_dyn_relocs *p;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   eh = (struct elf32_tic6x_link_hash_entry *) h;
   for (p = eh->dyn_relocs; p != NULL; p = p->next)
     {
Index: bfd/elf32-vax.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-vax.c,v
retrieving revision 1.63
diff -u -p -r1.63 elf32-vax.c
--- bfd/elf32-vax.c	25 Oct 2010 15:54:14 -0000	1.63
+++ bfd/elf32-vax.c	12 Jun 2011 12:53:55 -0000
@@ -1,6 +1,7 @@
 /* VAX series support for 32-bit ELF
    Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+   2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+   Free Software Foundation, Inc.
    Contributed by Matt Thomas <matt@3am-software.com>.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -1272,9 +1273,6 @@ elf_vax_discard_copies (struct elf_vax_l
 {
   struct elf_vax_pcrel_relocs_copied *s;
 
-  if (h->root.root.type == bfd_link_hash_warning)
-    h = (struct elf_vax_link_hash_entry *) h->root.root.u.i.link;
-
   /* We only discard relocs for symbols defined in a regular object.  */
   if (!h->root.def_regular)
     return TRUE;
Index: bfd/elf32-xstormy16.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-xstormy16.c,v
retrieving revision 1.42
diff -u -p -r1.42 elf32-xstormy16.c
--- bfd/elf32-xstormy16.c	25 Oct 2010 15:54:14 -0000	1.42
+++ bfd/elf32-xstormy16.c	12 Jun 2011 12:53:56 -0000
@@ -1,5 +1,5 @@
 /* Xstormy16-specific support for 32-bit ELF.
-   Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+   Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010, 2011
    Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -537,9 +537,6 @@ xstormy16_relax_plt_check (struct elf_li
 {
   struct relax_plt_data *data = (struct relax_plt_data *) xdata;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   if (h->plt.offset != (bfd_vma) -1)
     {
       bfd_vma address;
@@ -571,9 +568,6 @@ xstormy16_relax_plt_realloc (struct elf_
 {
   bfd_vma *entry = (bfd_vma *) xdata;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   if (h->plt.offset != (bfd_vma) -1)
     {
       h->plt.offset = *entry;
Index: bfd/elf32-xtensa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-xtensa.c,v
retrieving revision 1.129
diff -u -p -r1.129 elf32-xtensa.c
--- bfd/elf32-xtensa.c	2 Jun 2011 13:43:14 -0000	1.129
+++ bfd/elf32-xtensa.c	12 Jun 2011 12:53:59 -0000
@@ -1531,9 +1531,6 @@ elf_xtensa_allocate_dynrelocs (struct el
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   info = (struct bfd_link_info *) arg;
   htab = elf_xtensa_hash_table (info);
   if (htab == NULL)
Index: bfd/elf64-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-alpha.c,v
retrieving revision 1.176
diff -u -p -r1.176 elf64-alpha.c
--- bfd/elf64-alpha.c	12 Apr 2011 23:23:02 -0000	1.176
+++ bfd/elf64-alpha.c	12 Jun 2011 12:54:01 -0000
@@ -1553,9 +1553,6 @@ elf64_alpha_output_extsym (struct alpha_
   bfd_boolean strip;
   asection *sec, *output_section;
 
-  if (h->root.root.type == bfd_link_hash_warning)
-    h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link;
-
   if (h->root.indx == -2)
     strip = FALSE;
   else if ((h->root.def_dynamic
@@ -2390,9 +2387,6 @@ elf64_alpha_calc_got_offsets_for_symbol 
 {
   struct alpha_elf_got_entry *gotent;
 
-  if (h->root.root.type == bfd_link_hash_warning)
-    h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link;
-
   for (gotent = h->got_entries; gotent; gotent = gotent->next)
     if (gotent->use_count > 0)
       {
@@ -2695,9 +2689,6 @@ elf64_alpha_calc_dynrel_sizes (struct al
   struct alpha_elf_reloc_entry *relent;
   unsigned long entries;
 
-  if (h->root.root.type == bfd_link_hash_warning)
-    h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link;
-
   /* If the symbol was defined as a common symbol in a regular object
      file, and there was no definition in any dynamic object, then the
      linker will have allocated space for the symbol in a common
@@ -2751,9 +2742,6 @@ elf64_alpha_size_rela_got_1 (struct alph
   struct alpha_elf_got_entry *gotent;
   unsigned long entries;
 
-  if (h->root.root.type == bfd_link_hash_warning)
-    h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link;
-
   /* If we're using a plt for this symbol, then all of its relocations
      for its got entries go into .rela.plt.  */
   if (h->root.needs_plt)
Index: bfd/elf64-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-hppa.c,v
retrieving revision 1.102
diff -u -p -r1.102 elf64-hppa.c
--- bfd/elf64-hppa.c	8 Nov 2010 02:48:56 -0000	1.102
+++ bfd/elf64-hppa.c	12 Jun 2011 12:54:03 -0000
@@ -1,6 +1,6 @@
 /* Support for HPPA 64-bit ELF
    1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-   2010  Free Software Foundation, Inc.
+   2010, 2011 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -937,9 +937,6 @@ elf64_hppa_mark_exported_functions (stru
   if (hppa_info == NULL)
     return FALSE;
 
-  if (eh->root.type == bfd_link_hash_warning)
-    eh = (struct elf_link_hash_entry *) eh->root.u.i.link;
-
   if (eh
       && (eh->root.type == bfd_link_hash_defined
 	  || eh->root.type == bfd_link_hash_defweak)
@@ -1056,10 +1053,6 @@ allocate_global_data_opd (struct elf_lin
 
   if (hh && hh->want_opd)
     {
-      while (hh->eh.root.type == bfd_link_hash_indirect
-	     || hh->eh.root.type == bfd_link_hash_warning)
-	hh = hppa_elf_hash_entry (hh->eh.root.u.i.link);
-
       /* We never need an opd entry for a symbol which is not
 	 defined by this output file.  */
       if (hh && (hh->eh.root.type == bfd_link_hash_undefined
@@ -1512,19 +1505,15 @@ static bfd_boolean
 elf64_hppa_mark_milli_and_exported_functions (struct elf_link_hash_entry *eh,
 					      void *data)
 {
-  struct elf_link_hash_entry *elf = eh;
-  struct bfd_link_info *info = (struct bfd_link_info *)data;
-
-  if (elf->root.type == bfd_link_hash_warning)
-    elf = (struct elf_link_hash_entry *) elf->root.u.i.link;
+  struct bfd_link_info *info = (struct bfd_link_info *) data;
 
-  if (elf->type == STT_PARISC_MILLI)
+  if (eh->type == STT_PARISC_MILLI)
     {
-      if (elf->dynindx != -1)
+      if (eh->dynindx != -1)
 	{
-	  elf->dynindx = -1;
+	  eh->dynindx = -1;
 	  _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
-				  elf->dynstr_index);
+				  eh->dynstr_index);
 	}
       return TRUE;
     }
@@ -2839,9 +2828,6 @@ elf_hppa_unmark_useless_dynamic_symbols 
 {
   struct bfd_link_info *info = data;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   /* If we are not creating a shared library, and this symbol is
      referenced by a shared library but is not defined anywhere, then
      the generic code will warn that it is undefined.
@@ -2873,9 +2859,6 @@ elf_hppa_remark_useless_dynamic_symbols 
 {
   struct bfd_link_info *info = data;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   /* If we are not creating a shared library, and this symbol is
      referenced by a shared library but is not defined anywhere, then
      the generic code will warn that it is undefined.
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.353
diff -u -p -r1.353 elf64-ppc.c
--- bfd/elf64-ppc.c	3 Jun 2011 10:11:06 -0000	1.353
+++ bfd/elf64-ppc.c	12 Jun 2011 12:54:07 -0000
@@ -5669,9 +5669,6 @@ ppc64_elf_gc_mark_dynamic_ref (struct el
   struct ppc_link_hash_entry *eh = (struct ppc_link_hash_entry *) h;
   struct ppc_link_hash_entry *fdh;
 
-  if (eh->elf.root.type == bfd_link_hash_warning)
-    eh = (struct ppc_link_hash_entry *) eh->elf.root.u.i.link;
-
   /* Dynamic linking info is on the func descriptor sym.  */
   fdh = defined_func_desc (eh);
   if (fdh != NULL)
@@ -6214,9 +6211,6 @@ func_desc_adjust (struct elf_link_hash_e
   if (fh->elf.root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (fh->elf.root.type == bfd_link_hash_warning)
-    fh = (struct ppc_link_hash_entry *) fh->elf.root.u.i.link;
-
   info = inf;
   htab = ppc_hash_table (info);
   if (htab == NULL)
@@ -6742,9 +6736,6 @@ adjust_opd_syms (struct elf_link_hash_en
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   if (h->root.type != bfd_link_hash_defined
       && h->root.type != bfd_link_hash_defweak)
     return TRUE;
@@ -7905,9 +7896,6 @@ adjust_toc_syms (struct elf_link_hash_en
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   if (h->root.type != bfd_link_hash_defined
       && h->root.type != bfd_link_hash_defweak)
     return TRUE;
@@ -8603,9 +8591,6 @@ allocate_dynrelocs (struct elf_link_hash
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   info = (struct bfd_link_info *) inf;
   htab = ppc_hash_table (info);
   if (htab == NULL)
@@ -8846,9 +8831,6 @@ readonly_dynrelocs (struct elf_link_hash
   struct ppc_link_hash_entry *eh;
   struct elf_dyn_relocs *p;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   eh = (struct ppc_link_hash_entry *) h;
   for (p = eh->dyn_relocs; p != NULL; p = p->next)
     {
@@ -10217,9 +10199,6 @@ merge_global_got (struct elf_link_hash_e
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   merge_got_entries (&h->got.glist);
 
   return TRUE;
@@ -10236,9 +10215,6 @@ reallocate_got (struct elf_link_hash_ent
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   for (gent = h->got.glist; gent != NULL; gent = gent->next)
     if (!gent->is_indirect)
       allocate_got (h, (struct bfd_link_info *) inf, gent);
@@ -11493,9 +11469,6 @@ undo_symbol_twiddle (struct elf_link_has
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   eh = (struct ppc_link_hash_entry *) h;
   if (eh->elf.root.type != bfd_link_hash_undefweak || !eh->was_undefined)
     return TRUE;
Index: bfd/elf64-s390.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-s390.c,v
retrieving revision 1.107
diff -u -p -r1.107 elf64-s390.c
--- bfd/elf64-s390.c	25 Oct 2010 15:54:15 -0000	1.107
+++ bfd/elf64-s390.c	12 Jun 2011 12:54:08 -0000
@@ -1,6 +1,6 @@
 /* IBM S/390-specific support for 64-bit ELF
    Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-   2010  Free Software Foundation, Inc.
+   2010, 2011 Free Software Foundation, Inc.
    Contributed Martin Schwidefsky (schwidefsky@de.ibm.com).
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -1680,12 +1680,6 @@ allocate_dynrelocs (struct elf_link_hash
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    /* When warning symbols are created, they **replace** the "real"
-       entry in the hash table, thus we never get to see the real
-       symbol in a hash traversal.  So look at it now.  */
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   info = (struct bfd_link_info *) inf;
   htab = elf_s390_hash_table (info);
   if (htab == NULL)
@@ -1907,9 +1901,6 @@ readonly_dynrelocs (h, inf)
   struct elf_s390_link_hash_entry *eh;
   struct elf_s390_dyn_relocs *p;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   eh = (struct elf_s390_link_hash_entry *) h;
   for (p = eh->dyn_relocs; p != NULL; p = p->next)
     {
Index: bfd/elf64-sh64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-sh64.c,v
retrieving revision 1.86
diff -u -p -r1.86 elf64-sh64.c
--- bfd/elf64-sh64.c	25 Oct 2010 15:54:15 -0000	1.86
+++ bfd/elf64-sh64.c	12 Jun 2011 12:54:10 -0000
@@ -1,6 +1,6 @@
 /* SuperH SH64-specific support for 64-bit ELF
    Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-   2010  Free Software Foundation, Inc.
+   2010, 2011 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -3422,9 +3422,6 @@ sh64_elf64_discard_copies (struct elf_sh
 {
   struct elf_sh64_pcrel_relocs_copied *s;
 
-  if (h->root.root.type == bfd_link_hash_warning)
-    h = (struct elf_sh64_link_hash_entry *) h->root.root.u.i.link;
-
   /* We only discard relocs for symbols defined in a regular object.  */
   if (!h->root.def_regular)
     return TRUE;
Index: bfd/elf64-x86-64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-x86-64.c,v
retrieving revision 1.228
diff -u -p -r1.228 elf64-x86-64.c
--- bfd/elf64-x86-64.c	9 Jun 2011 05:51:09 -0000	1.228
+++ bfd/elf64-x86-64.c	12 Jun 2011 12:54:11 -0000
@@ -2039,8 +2039,6 @@ elf_x86_64_allocate_dynrelocs (struct el
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
   eh = (struct elf_x86_64_link_hash_entry *) h;
 
   info = (struct bfd_link_info *) inf;
@@ -2305,9 +2303,6 @@ elf_x86_64_readonly_dynrelocs (struct el
   struct elf_x86_64_link_hash_entry *eh;
   struct elf_dyn_relocs *p;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   /* Skip local IFUNC symbols. */
   if (h->forced_local && h->type == STT_GNU_IFUNC)
     return TRUE;
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.409
diff -u -p -r1.409 elflink.c
--- bfd/elflink.c	10 Jun 2011 14:04:23 -0000	1.409
+++ bfd/elflink.c	12 Jun 2011 13:46:23 -0000
@@ -722,9 +722,6 @@ elf_link_renumber_hash_table_dynsyms (st
 {
   size_t *count = (size_t *) data;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   if (h->forced_local)
     return TRUE;
 
@@ -744,9 +741,6 @@ elf_link_renumber_local_hash_table_dynsy
 {
   size_t *count = (size_t *) data;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   if (!h->forced_local)
     return TRUE;
 
@@ -1812,16 +1806,13 @@ _bfd_elf_export_symbol (struct elf_link_
 {
   struct elf_info_failed *eif = (struct elf_info_failed *) data;
 
-  /* Ignore this if we won't export it.  */
-  if (!eif->info->export_dynamic && !h->dynamic)
-    return TRUE;
-
   /* Ignore indirect symbols.  These are added by the versioning code.  */
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+  /* Ignore this if we won't export it.  */
+  if (!eif->info->export_dynamic && !h->dynamic)
+    return TRUE;
 
   if (h->dynindx == -1
       && (h->def_regular
@@ -1858,9 +1849,6 @@ _bfd_elf_link_find_version_dependencies 
   Elf_Internal_Vernaux *a;
   bfd_size_type amt;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   /* We only care about symbols defined in shared objects with version
      information.  */
   if (!h->def_dynamic
@@ -1946,9 +1934,6 @@ _bfd_elf_link_assign_sym_version (struct
   sinfo = (struct elf_info_failed *) data;
   info = sinfo->info;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   /* Fix the symbol flags.  */
   eif.failed = FALSE;
   eif.info = info;
@@ -2564,17 +2549,6 @@ _bfd_elf_adjust_dynamic_symbol (struct e
   if (! is_elf_hash_table (eif->info->hash))
     return FALSE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    {
-      h->got = elf_hash_table (eif->info)->init_got_offset;
-      h->plt = elf_hash_table (eif->info)->init_plt_offset;
-
-      /* When warning symbols are created, they **replace** the "real"
-	 entry in the hash table, thus we never get to see the real
-	 symbol in a hash traversal.  So look at it now.  */
-      h = (struct elf_link_hash_entry *) h->root.u.i.link;
-    }
-
   /* Ignore indirect symbols.  These are added by the versioning code.  */
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
@@ -2730,9 +2704,6 @@ _bfd_elf_link_sec_merge_syms (struct elf
 {
   asection *sec;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   if ((h->root.type == bfd_link_hash_defined
        || h->root.type == bfd_link_hash_defweak)
       && ((sec = h->root.u.def.section)->flags & SEC_MERGE)
@@ -3180,9 +3151,6 @@ elf_adjust_dynstr_offsets (struct elf_li
 {
   struct elf_strtab_hash *dynstr = (struct elf_strtab_hash *) data;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   if (h->dynindx != -1)
     h->dynstr_index = _bfd_elf_strtab_offset (dynstr, h->dynstr_index);
   return TRUE;
@@ -5175,9 +5143,6 @@ elf_collect_hash_codes (struct elf_link_
   unsigned long ha;
   char *alc = NULL;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   /* Ignore indirect symbols.  These are added by the versioning code.  */
   if (h->dynindx == -1)
     return TRUE;
@@ -5246,9 +5211,6 @@ elf_collect_gnu_hash_codes (struct elf_l
   unsigned long ha;
   char *alc = NULL;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   /* Ignore indirect symbols.  These are added by the versioning code.  */
   if (h->dynindx == -1)
     return TRUE;
@@ -5299,9 +5261,6 @@ elf_renumber_gnu_hash_syms (struct elf_l
   unsigned long int bucket;
   unsigned long int val;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   /* Ignore indirect symbols.  */
   if (h->dynindx == -1)
     return TRUE;
@@ -8605,8 +8564,9 @@ elf_link_check_versioned_symbol (struct 
    global symbols.  */
 
 static bfd_boolean
-elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
+elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
 {
+  struct elf_link_hash_entry *h = (struct elf_link_hash_entry *) bh;
   struct elf_outext_info *eoinfo = (struct elf_outext_info *) data;
   struct elf_final_link_info *finfo = eoinfo->finfo;
   bfd_boolean strip;
@@ -10822,8 +10782,7 @@ bfd_elf_final_link (bfd *abfd, struct bf
   eoinfo.failed = FALSE;
   eoinfo.finfo = &finfo;
   eoinfo.localsyms = TRUE;
-  elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
-			  &eoinfo);
+  bfd_hash_traverse (&info->hash->table, elf_link_output_extsym, &eoinfo);
   if (eoinfo.failed)
     return FALSE;
 
@@ -10932,8 +10891,7 @@ bfd_elf_final_link (bfd *abfd, struct bf
   eoinfo.failed = FALSE;
   eoinfo.localsyms = FALSE;
   eoinfo.finfo = &finfo;
-  elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
-			  &eoinfo);
+  bfd_hash_traverse (&info->hash->table, elf_link_output_extsym, &eoinfo);
   if (eoinfo.failed)
     return FALSE;
 
@@ -11687,9 +11645,6 @@ struct elf_gc_sweep_symbol_info
 static bfd_boolean
 elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data)
 {
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   if ((h->root.type == bfd_link_hash_defined
        || h->root.type == bfd_link_hash_defweak)
       && !h->root.u.def.section->gc_mark
@@ -11801,9 +11756,6 @@ elf_gc_sweep (bfd *abfd, struct bfd_link
 static bfd_boolean
 elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *okp)
 {
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   /* Those that are not vtables.  */
   if (h->vtable == NULL || h->vtable->parent == NULL)
     return TRUE;
@@ -11865,9 +11817,6 @@ elf_gc_smash_unused_vtentry_relocs (stru
   const struct elf_backend_data *bed;
   unsigned int log_file_align;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   /* Take care of both those symbols that do not describe vtables as
      well as those that are not loaded.  */
   if (h->vtable == NULL || h->vtable->parent == NULL)
@@ -11915,9 +11864,6 @@ bfd_elf_gc_mark_dynamic_ref_symbol (stru
 {
   struct bfd_link_info *info = (struct bfd_link_info *) inf;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   if ((h->root.type == bfd_link_hash_defined
        || h->root.type == bfd_link_hash_defweak)
       && (h->ref_dynamic
@@ -12190,9 +12136,6 @@ elf_gc_allocate_got_offsets (struct elf_
   bfd *obfd = gofarg->info->output_bfd;
   const struct elf_backend_data *bed = get_elf_backend_data (obfd);
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   if (h->got.refcount > 0)
     {
       h->got.offset = gofarg->gotoff;
Index: bfd/elfnn-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfnn-ia64.c,v
retrieving revision 1.2
diff -u -p -r1.2 elfnn-ia64.c
--- bfd/elfnn-ia64.c	9 Jun 2011 15:35:30 -0000	1.2
+++ bfd/elfnn-ia64.c	12 Jun 2011 12:54:18 -0000
@@ -1421,9 +1421,6 @@ elfNN_ia64_global_dyn_info_free (void **
   struct elfNN_ia64_link_hash_entry *entry
     = (struct elfNN_ia64_link_hash_entry *) xentry;
 
-  if (entry->root.root.type == bfd_link_hash_warning)
-    entry = (struct elfNN_ia64_link_hash_entry *) entry->root.root.u.i.link;
-
   if (entry->info)
     {
       free (entry->info);
@@ -1496,9 +1493,6 @@ elfNN_ia64_global_dyn_sym_thunk (struct 
   struct elfNN_ia64_dyn_sym_info *dyn_i;
   unsigned int count;
 
-  if (entry->root.root.type == bfd_link_hash_warning)
-    entry = (struct elfNN_ia64_link_hash_entry *) entry->root.root.u.i.link;
-
   for (count = entry->count, dyn_i = entry->info;
        count != 0;
        count--, dyn_i++)
Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.286
diff -u -p -r1.286 elfxx-mips.c
--- bfd/elfxx-mips.c	9 Jun 2011 10:36:20 -0000	1.286
+++ bfd/elfxx-mips.c	12 Jun 2011 12:54:24 -0000
@@ -1719,9 +1719,6 @@ mips_elf_check_symbols (struct mips_elf_
   struct mips_htab_traverse_info *hti;
 
   hti = (struct mips_htab_traverse_info *) data;
-  if (h->root.root.type == bfd_link_hash_warning)
-    h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
-
   if (!hti->info->relocatable)
     mips_elf_check_mips16_stubs (hti->info, h);
 
@@ -2409,9 +2406,6 @@ mips_elf_output_extsym (struct mips_elf_
   bfd_boolean strip;
   asection *sec, *output_section;
 
-  if (h->root.root.type == bfd_link_hash_warning)
-    h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
-
   if (h->root.indx == -2)
     strip = FALSE;
   else if ((h->root.def_dynamic
@@ -3437,9 +3431,6 @@ mips_elf_sort_hash_table_f (struct mips_
 {
   struct mips_elf_hash_sort_data *hsd = data;
 
-  if (h->root.root.type == bfd_link_hash_warning)
-    h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
-
   /* Symbols without dynamic symbol table entries aren't interesting
      at all.  */
   if (h->root.dynindx == -1)
@@ -8147,10 +8143,9 @@ allocate_dynrelocs (struct elf_link_hash
   if (htab->is_vxworks && !info->shared)
     return TRUE;
 
-  /* Ignore indirect and warning symbols.  All relocations against
-     such symbols will be redirected to the target symbol.  */
-  if (h->root.type == bfd_link_hash_indirect
-      || h->root.type == bfd_link_hash_warning)
+  /* Ignore indirect symbols.  All relocations against such symbols
+     will be redirected to the target symbol.  */
+  if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
   /* If this symbol is defined in a dynamic object, or we are creating
Index: bfd/elfxx-sparc.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-sparc.c,v
retrieving revision 1.58
diff -u -p -r1.58 elfxx-sparc.c
--- bfd/elfxx-sparc.c	14 Mar 2011 15:54:58 -0000	1.58
+++ bfd/elfxx-sparc.c	12 Jun 2011 12:54:25 -0000
@@ -1,5 +1,6 @@
 /* SPARC-specific support for ELF
-   Copyright 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+   Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011
+   Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -2145,12 +2146,6 @@ allocate_dynrelocs (struct elf_link_hash
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (h->root.type == bfd_link_hash_warning)
-    /* When warning symbols are created, they **replace** the "real"
-       entry in the hash table, thus we never get to see the real
-       symbol in a hash traversal.  So look at it now.  */
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   info = (struct bfd_link_info *) inf;
   htab = _bfd_sparc_elf_hash_table (info);
   BFD_ASSERT (htab != NULL);
@@ -2426,9 +2421,6 @@ readonly_dynrelocs (struct elf_link_hash
   struct _bfd_sparc_elf_link_hash_entry *eh;
   struct _bfd_sparc_elf_dyn_relocs *p;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
   eh = (struct _bfd_sparc_elf_link_hash_entry *) h;
   for (p = eh->dyn_relocs; p != NULL; p = p->next)
     {
Index: bfd/i386linux.c
===================================================================
RCS file: /cvs/src/src/bfd/i386linux.c,v
retrieving revision 1.23
diff -u -p -r1.23 i386linux.c
--- bfd/i386linux.c	2 Oct 2009 14:40:41 -0000	1.23
+++ bfd/i386linux.c	12 Jun 2011 12:54:28 -0000
@@ -1,6 +1,6 @@
 /* BFD back-end for linux flavored i386 a.out binaries.
    Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2001, 2002, 2003,
-   2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+   2004, 2005, 2006, 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -435,9 +435,6 @@ linux_tally_symbols (h, data)
   struct linux_link_hash_entry *h1, *h2;
   bfd_boolean exists;
 
-  if (h->root.root.type == bfd_link_hash_warning)
-    h = (struct linux_link_hash_entry *) h->root.root.u.i.link;
-
   if (h->root.root.type == bfd_link_hash_undefined
       && CONST_STRNEQ (h->root.root.root.string, NEEDS_SHRLIB))
     {
Index: bfd/libcoff-in.h
===================================================================
RCS file: /cvs/src/src/bfd/libcoff-in.h,v
retrieving revision 1.42
diff -u -p -r1.42 libcoff-in.h
--- bfd/libcoff-in.h	31 Mar 2011 08:08:39 -0000	1.42
+++ bfd/libcoff-in.h	12 Jun 2011 12:54:28 -0000
@@ -559,7 +559,7 @@ extern bfd_boolean _bfd_coff_generic_rel
 extern struct bfd_hash_entry *_bfd_coff_debug_merge_hash_newfunc
   (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
 extern bfd_boolean _bfd_coff_write_global_sym
-  (struct coff_link_hash_entry *, void *);
+  (struct bfd_hash_entry *, void *);
 extern bfd_boolean _bfd_coff_write_task_globals
   (struct coff_link_hash_entry *, void *);
 extern bfd_boolean _bfd_coff_link_input_bfd
Index: bfd/m68klinux.c
===================================================================
RCS file: /cvs/src/src/bfd/m68klinux.c,v
retrieving revision 1.25
diff -u -p -r1.25 m68klinux.c
--- bfd/m68klinux.c	2 Oct 2009 14:40:41 -0000	1.25
+++ bfd/m68klinux.c	12 Jun 2011 12:54:29 -0000
@@ -1,6 +1,7 @@
 /* BFD back-end for linux flavored m68k a.out binaries.
    Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011
+   Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -439,9 +440,6 @@ linux_tally_symbols (h, data)
   struct linux_link_hash_entry *h1, *h2;
   bfd_boolean exists;
 
-  if (h->root.root.type == bfd_link_hash_warning)
-    h = (struct linux_link_hash_entry *) h->root.root.u.i.link;
-
   if (h->root.root.type == bfd_link_hash_undefined
       && CONST_STRNEQ (h->root.root.root.string, NEEDS_SHRLIB))
     {
Index: bfd/pdp11.c
===================================================================
RCS file: /cvs/src/src/bfd/pdp11.c,v
retrieving revision 1.48
diff -u -p -r1.48 pdp11.c
--- bfd/pdp11.c	6 Jun 2011 01:26:03 -0000	1.48
+++ bfd/pdp11.c	12 Jun 2011 12:54:30 -0000
@@ -2892,8 +2892,9 @@ aout_link_includes_newfunc (struct bfd_h
 }
 
 static bfd_boolean
-aout_link_write_other_symbol (struct aout_link_hash_entry *h, void * data)
+aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data)
 {
+  struct aout_link_hash_entry *h = (struct aout_link_hash_entry *) bh;
   struct aout_final_link_info *finfo = (struct aout_final_link_info *) data;
   bfd *output_bfd;
   int type;
@@ -3056,7 +3057,7 @@ aout_link_reloc_link_order (struct aout_
 	     symbol.  */
 	  h->indx = -2;
 	  h->written = FALSE;
-	  if (! aout_link_write_other_symbol (h, (void *) finfo))
+	  if (!aout_link_write_other_symbol (&h->root.root, finfo))
 	    return FALSE;
 	  r_index = h->indx;
 	}
@@ -3335,8 +3336,8 @@ pdp11_aout_link_input_section (struct ao
 			    {
 			      h->indx = -2;
 			      h->written = FALSE;
-			      if (! aout_link_write_other_symbol (h,
-								  (void *) finfo))
+			      if (!aout_link_write_other_symbol (&h->root.root,
+								 finfo))
 				return FALSE;
 			    }
 			  r_index = h->indx;
@@ -3799,7 +3800,7 @@ NAME (aout, final_link) (bfd *abfd,
     h = aout_link_hash_lookup (aout_hash_table (info), "__DYNAMIC",
 			       FALSE, FALSE, FALSE);
     if (h != NULL)
-      aout_link_write_other_symbol (h, &aout_info);
+      aout_link_write_other_symbol (&h->root.root, &aout_info);
   }
 
   /* The most time efficient way to do the link would be to read all
@@ -3871,9 +3872,9 @@ NAME (aout, final_link) (bfd *abfd,
     }
 
   /* Write out any symbols that we have not already written out.  */
-  aout_link_hash_traverse (aout_hash_table (info),
-			   aout_link_write_other_symbol,
-			   (void *) &aout_info);
+  bfd_hash_traverse (&info->hash->table,
+		     aout_link_write_other_symbol,
+		     &aout_info);
 
   /* Now handle any relocs we were asked to create by the linker.
      These did not come from any input file.  We must do these after
Index: bfd/sparclinux.c
===================================================================
RCS file: /cvs/src/src/bfd/sparclinux.c,v
retrieving revision 1.25
diff -u -p -r1.25 sparclinux.c
--- bfd/sparclinux.c	2 Oct 2009 14:40:41 -0000	1.25
+++ bfd/sparclinux.c	12 Jun 2011 12:54:30 -0000
@@ -1,6 +1,7 @@
 /* BFD back-end for linux flavored sparc a.out binaries.
    Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011
+   Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -433,9 +434,6 @@ linux_tally_symbols (struct linux_link_h
   struct linux_link_hash_entry *h1, *h2;
   bfd_boolean exists;
 
-  if (h->root.root.type == bfd_link_hash_warning)
-    h = (struct linux_link_hash_entry *) h->root.root.u.i.link;
-
   if (h->root.root.type == bfd_link_hash_undefined
       && CONST_STRNEQ (h->root.root.root.string, NEEDS_SHRLIB))
     {
Index: bfd/sunos.c
===================================================================
RCS file: /cvs/src/src/bfd/sunos.c,v
retrieving revision 1.25
diff -u -p -r1.25 sunos.c
--- bfd/sunos.c	15 Feb 2008 03:35:52 -0000	1.25
+++ bfd/sunos.c	12 Jun 2011 12:54:31 -0000
@@ -1,6 +1,6 @@
 /* BFD backend for SunOS binaries.
    Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2011
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -1749,9 +1749,6 @@ sunos_scan_dynamic_symbol (struct sunos_
 {
   struct bfd_link_info *info = (struct bfd_link_info *) data;
 
-  if (h->root.root.type == bfd_link_hash_warning)
-    h = (struct sunos_link_hash_entry *) h->root.root.u.i.link;
-
   /* Set the written flag for symbols we do not want to write out as
      part of the regular symbol table.  This is all symbols which are
      not defined in a regular object file.  For some reason symbols
Index: bfd/vms-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/vms-alpha.c,v
retrieving revision 1.46
diff -u -p -r1.46 vms-alpha.c
--- bfd/vms-alpha.c	6 Jun 2011 01:26:04 -0000	1.46
+++ bfd/vms-alpha.c	12 Jun 2011 12:54:34 -0000
@@ -8600,21 +8600,31 @@ alpha_vms_build_fixups (struct bfd_link_
   return TRUE;
 }
 
-/* Called by bfd_link_hash_traverse to fill the symbol table.
+/* Called by bfd_hash_traverse to fill the symbol table.
    Return FALSE in case of failure.  */
 
 static bfd_boolean
-alpha_vms_link_output_symbol (struct bfd_link_hash_entry *hc, void *infov)
+alpha_vms_link_output_symbol (struct bfd_hash_entry *bh, void *infov)
 {
+  struct bfd_link_hash_entry *hc = (struct bfd_link_hash_entry *) bh;
   struct bfd_link_info *info = (struct bfd_link_info *)infov;
-  struct alpha_vms_link_hash_entry *h = (struct alpha_vms_link_hash_entry *)hc;
+  struct alpha_vms_link_hash_entry *h;
   struct vms_symbol_entry *sym;
 
+  if (hc->type == bfd_link_hash_warning)
+    {
+      hc = hc->u.i.link;
+      if (hc->type == bfd_link_hash_new)
+	return TRUE;
+    }
+  h = (struct alpha_vms_link_hash_entry *) hc;
+
   switch (h->root.type)
     {
     case bfd_link_hash_undefined:
       return TRUE;
     case bfd_link_hash_new:
+    case bfd_link_hash_warning:
       abort ();
     case bfd_link_hash_undefweak:
       return TRUE;
@@ -8634,7 +8644,6 @@ alpha_vms_link_output_symbol (struct bfd
     case bfd_link_hash_common:
       break;
     case bfd_link_hash_indirect:
-    case bfd_link_hash_warning:
       return TRUE;
     }
 
@@ -8740,7 +8749,7 @@ alpha_vms_bfd_final_link (bfd *abfd, str
   /* Generate the symbol table.  */
   BFD_ASSERT (PRIV (syms) == NULL);
   if (info->strip != strip_all)
-    bfd_link_hash_traverse (info->hash, alpha_vms_link_output_symbol, info);
+    bfd_hash_traverse (&info->hash->table, alpha_vms_link_output_symbol, info);
 
   /* Find the entry point.  */
   if (bfd_get_start_address (abfd) == 0)
Index: bfd/xcofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/xcofflink.c,v
retrieving revision 1.80
diff -u -p -r1.80 xcofflink.c
--- bfd/xcofflink.c	18 May 2011 08:00:08 -0000	1.80
+++ bfd/xcofflink.c	12 Jun 2011 12:54:36 -0000
@@ -3354,9 +3354,6 @@ xcoff_post_gc_symbol (struct xcoff_link_
 {
   struct xcoff_loader_info *ldinfo = (struct xcoff_loader_info *) p;
 
-  if (h->root.type == bfd_link_hash_warning)
-    h = (struct xcoff_link_hash_entry *) h->root.u.i.link;
-
   /* __rtinit, this symbol has special handling. */
   if (h->flags & XCOFF_RTINIT)
     return TRUE;
@@ -5152,8 +5149,9 @@ xcoff_find_tc0 (bfd *output_bfd, struct 
 /* Write out a non-XCOFF global symbol.  */
 
 static bfd_boolean
-xcoff_write_global_symbol (struct xcoff_link_hash_entry *h, void * inf)
+xcoff_write_global_symbol (struct bfd_hash_entry *bh, void * inf)
 {
+  struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) bh;
   struct xcoff_final_link_info *flinfo = (struct xcoff_final_link_info *) inf;
   bfd *output_bfd;
   bfd_byte *outsym;
@@ -6237,9 +6235,7 @@ _bfd_xcoff_bfd_final_link (bfd *abfd, st
 
   /* Write out all the global symbols which do not come from XCOFF
      input files.  */
-  xcoff_link_hash_traverse (xcoff_hash_table (info),
-			    xcoff_write_global_symbol,
-			    (void *) &flinfo);
+  bfd_hash_traverse (&info->hash->table, xcoff_write_global_symbol, &flinfo);
 
   if (flinfo.outsyms != NULL)
     {
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.371
diff -u -p -r1.371 ldlang.c
--- ld/ldlang.c	7 Jun 2011 23:58:30 -0000	1.371
+++ ld/ldlang.c	12 Jun 2011 12:55:05 -0000
@@ -2100,9 +2100,6 @@ static bfd_boolean
 sort_def_symbol (struct bfd_link_hash_entry *hash_entry,
 		 void *info ATTRIBUTE_UNUSED)
 {
-  if (hash_entry->type == bfd_link_hash_warning)
-    hash_entry = (struct bfd_link_hash_entry *) hash_entry->u.i.link;
-
   if (hash_entry->type == bfd_link_hash_defined
       || hash_entry->type == bfd_link_hash_defweak)
     {
@@ -5885,9 +5882,6 @@ lang_one_common (struct bfd_link_hash_en
   bfd_vma size;
   asection *section;
 
-  if (h->type == bfd_link_hash_warning)
-    h = h->u.i.link;
-
   if (h->type != bfd_link_hash_common)
     return TRUE;
 
Index: ld/emultempl/pe.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/pe.em,v
retrieving revision 1.170
diff -u -p -r1.170 pe.em
--- ld/emultempl/pe.em	28 Apr 2011 15:29:42 -0000	1.170
+++ ld/emultempl/pe.em	12 Jun 2011 12:55:07 -0000
@@ -1197,8 +1197,7 @@ This should work unless it involves cons
 static bfd_boolean
 pr_sym (struct bfd_hash_entry *h, void *inf ATTRIBUTE_UNUSED)
 {
-  if (pe_dll_extra_pe_debug)
-    printf ("+%s\n", h->string);
+  printf ("+%s\n", h->string);
 
   return TRUE;
 }
Index: ld/emultempl/pep.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/pep.em,v
retrieving revision 1.45
diff -u -p -r1.45 pep.em
--- ld/emultempl/pep.em	10 Mar 2011 10:20:26 -0000	1.45
+++ ld/emultempl/pep.em	12 Jun 2011 12:55:08 -0000
@@ -1130,8 +1130,7 @@ pep_find_data_imports (void)
 static bfd_boolean
 pr_sym (struct bfd_hash_entry *h, void *inf ATTRIBUTE_UNUSED)
 {
-  if (pep_dll_extra_pe_debug)
-    printf ("+%s\n", h->string);
+  printf ("+%s\n", h->string);
 
   return TRUE;
 }

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: bfd_link_hash_traverse
  2011-06-13  1:00 bfd_link_hash_traverse Alan Modra
@ 2011-06-13 12:55 ` H.J. Lu
  2011-06-13 14:00   ` bfd_link_hash_traverse Alan Modra
  2011-06-13 20:48 ` bfd_link_hash_traverse Ian Lance Taylor
  1 sibling, 1 reply; 8+ messages in thread
From: H.J. Lu @ 2011-06-13 12:55 UTC (permalink / raw)
  To: binutils

On Sun, Jun 12, 2011 at 5:59 PM, Alan Modra <amodra@gmail.com> wrote:
> I audited all the link_hash_traverse functions the other day and found
> thirty more that ignored the need to follow u.i.link to see the real
> symbol.  Rather than fixing them all individually, as I started to do,
> I decided to change the traversal.  It turns out that no traversal
> function ever really needs to see warning symbols, but a few currently
> do something special.  _bfd_elf_adjust_dynamic_symbol is one instance,
> but if all following traversals skip over warning symbols then we
> don't need to do anything special there.  elf_link_output_extsym and
> similar for other formats just look at warning symbols so that they
> can do a little error checking.  The error check of bfd_link_hash_new
> symbols could be removed, but instead I keep the old symbol traversal
> by using bfd_hash_traverse.
>
> Committed mainline.
>
> bfd/
>        * linker.c (bfd_link_hash_traverse): Follow warning symbol link.
>        (_bfd_generic_link_write_global_symbol, fix_syms): Don't handle
>        warning symbols here.
>        * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise.
>        * elf32-arm.c (allocate_dynrelocs_for_symbol,
>        elf32_arm_readonly_dynrelocs): Likewise.
>        * elf32-bfin.c (bfin_discard_copies): Likewise.
>        * elf32-cris.c (elf_cris_adjust_gotplt_to_got,
>        elf_cris_discard_excess_dso_dynamics,
>        elf_cris_discard_excess_program_dynamics): Likewise.
>        * elf32-hppa.c (allocate_plt_static, allocate_dynrelocs,
>        clobber_millicode_symbols, readonly_dynrelocs): Likewise.
>        * elf32-i370.c (i370_elf_adjust_dynindx): Likewise.
>        * elf32-i386.c (elf_i386_allocate_dynrelocs,
>        elf_i386_readonly_dynrelocs): Likewise.
>        * elf32-lm32.c (allocate_dynrelocs, readonly_dynrelocs): Likewise.
>        * elf32-m32c.c (m32c_relax_plt_check, m32c_relax_plt_realloc): Likewise.
>        * elf32-m32r.c (allocate_dynrelocs, readonly_dynrelocs): Likewise.
>        * elf32-m68k.c (elf_m68k_discard_copies): Likewise.
>        * elf32-microblaze.c (allocate_dynrelocs): Likewise.
>        * elf32-ppc.c (allocate_dynrelocs, maybe_set_textrel): Likewise.
>        * elf32-s390.c (allocate_dynrelocs, readonly_dynrelocs): Likewise.
>        * elf32-score.c (score_elf_sort_hash_table_f): Likewise.
>        * elf32-score7.c (score_elf_sort_hash_table_f): Likewise.
>        * elf32-sh.c (allocate_dynrelocs, readonly_dynrelocs): Likewise.
>        * elf32-tic6x.c (elf32_tic6x_allocate_dynrelocs,
>        elf32_tic6x_readonly_dynrelocs): Likewise.
>        * elf32-vax.c (elf_vax_discard_copies): Likewise.
>        * elf32-xstormy16.c (xstormy16_relax_plt_check,
>        xstormy16_relax_plt_realloc): Likewise.
>        * elf32-xtensa.c (elf_xtensa_allocate_dynrelocs): Likewise.
>        * elf64-alpha.c (elf64_alpha_output_extsym,
>        elf64_alpha_calc_got_offsets_for_symbol,
>        elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_1): Likewise.
>        * elf64-hppa.c (elf64_hppa_mark_exported_functions,
>        allocate_global_data_opd, elf64_hppa_mark_milli_and_exported_functions,
>        elf_hppa_unmark_useless_dynamic_symbols,
>        elf_hppa_remark_useless_dynamic_symbols): Likewise.
>        * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref, func_desc_adjust,
>        adjust_opd_syms, adjust_toc_syms, allocate_dynrelocs,
>        readonly_dynrelocs, merge_global_got, reallocate_got,
>        undo_symbol_twiddle): Likewise.
>        * elf64-s390.c (allocate_dynrelocs, readonly_dynrelocs): Likewise.
>        * elf64-sh64.c (sh64_elf64_discard_copies): Likewise.
>        * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs,
>        elf_x86_64_readonly_dynrelocs): Likewise.
>        * elflink.c (elf_link_renumber_hash_table_dynsyms,
>        elf_link_renumber_local_hash_table_dynsyms, _bfd_elf_export_symbol,
>        _bfd_elf_link_find_version_dependencies,
>        _bfd_elf_link_assign_sym_version, _bfd_elf_adjust_dynamic_symbol,
>        _bfd_elf_link_sec_merge_syms, elf_adjust_dynstr_offsets,
>        elf_collect_hash_codes, elf_collect_gnu_hash_codes,
>        elf_renumber_gnu_hash_syms, elf_gc_sweep_symbol,
>        elf_gc_propagate_vtable_entries_used,
>        elf_gc_smash_unused_vtentry_relocs, bfd_elf_gc_mark_dynamic_ref_symbol,
>        elf_gc_allocate_got_offsets): Likewise.
>        * elfnn-ia64.c (elfNN_ia64_global_dyn_info_free,
>        elfNN_ia64_global_dyn_sym_thunk): Likewise.
>        * elfxx-mips.c (mips_elf_check_symbols, mips_elf_output_extsym,
>        mips_elf_sort_hash_table_f, allocate_dynrelocs): Likewise.
>        * elfxx-sparc.c (allocate_dynrelocs, readonly_dynrelocs): Likewise.
>        * i386linux.c (linux_tally_symbols): Likewise.
>        * m68klinux.c (linux_tally_symbols): Likewise.
>        * sparclinux.c (linux_tally_symbols): Likewise.
>        * sunos.c (sunos_scan_dynamic_symbol): Likewise.
>        * xcofflink.c (xcoff_post_gc_symbol): Likewise.
>
>        * elflink.c (elf_link_output_extsym): Make it a bfd_hash_traverse
>        function.  Update all callers.
>        * aoutx.h (aout_link_write_other_symbol): Likewise.
>        * pdp11.c (aout_link_write_other_symbol): Likewise.
>        * cofflink.c (_bfd_coff_write_global_sym): Likewise.
>        * ecoff.c (ecoff_link_write_external): Likewise.
>        * xcofflink.c (xcoff_write_global_symbol): Likewise.
>        * vms-alpha.c (alpha_vms_link_output_symbol): Likewise.  Handle
>        warning symbols.
>        * ecoff.c (ecoff_link_hash_traverse): Delete.
>        * coff-ppc.c (ppc_bfd_coff_final_link): Use bfd_hash_traverse for
>        _bfd_coff_write_global_sym.
>        * libcoff-in.h (_bfd_coff_write_global_sym): Update prototype.
>        * libcoff.h: Regenerate.
> ld/
>        * ldlang.c (sort_def_symbol, lang_one_common): Don't handle
>        warning symbols here.
>        * emultempl/pe.em (pr_sym): Remove redundant test.
>        * emultempl/pep.em (pr_sym): Likewise.

On Linux/ia64, I got

Executing on host: sh -c {tmpdir/ld2 -m elf64_ia64  -o tmpdir/ld3
-dynamic-linker /lib/ld-linux-ia64.so.2
/usr/lib/gcc/ia64-redhat-linux/4.1.2/../../../crt1.o
/usr/lib/gcc/ia64-redhat-linux/4.1.2/../../../crti.o
/usr/lib/gcc/ia64-redhat-linux/4.1.2/crtbegin.o --traditional-format
ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o
plugin.o ldwrite.o ldexp.o  ldemul.o ldver.o ldmisc.o ldfile.o
ldcref.o eelf64_ia64.o  ../bfd/.libs/libbfd.a ../libiberty/libiberty.a
  -ldl -lz -ldl  -L/usr/lib/gcc/ia64-redhat-linux/4.1.2/../../..
--start-group /usr/lib/gcc/ia64-redhat-linux/4.1.2/libgcc.a
/usr/lib/gcc/ia64-redhat-linux/4.1.2/libgcc_eh.a
/usr/lib/gcc/ia64-redhat-linux/4.1.2/../../../libunwind.a -lc
--end-group /usr/lib/gcc/ia64-redhat-linux/4.1.2/crtend.o
/usr/lib/gcc/ia64-redhat-linux/4.1.2/../../../crtn.o 2>&1}  /dev/null
ld.tmp (timeout = 300)
tmpdir/ld2: can't relax section: File truncated
tmpdir/ld2: can't relax section: File truncated
FAIL: bootstrap with --traditional-format

-- 
H.J.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: bfd_link_hash_traverse
  2011-06-13 12:55 ` bfd_link_hash_traverse H.J. Lu
@ 2011-06-13 14:00   ` Alan Modra
  2011-06-13 14:07     ` bfd_link_hash_traverse H.J. Lu
  0 siblings, 1 reply; 8+ messages in thread
From: Alan Modra @ 2011-06-13 14:00 UTC (permalink / raw)
  To: H.J. Lu; +Cc: binutils

On Mon, Jun 13, 2011 at 05:55:14AM -0700, H.J. Lu wrote:
> On Linux/ia64, I got
> 
> Executing on host: sh -c {tmpdir/ld2 -m elf64_ia64  -o tmpdir/ld3
> -dynamic-linker /lib/ld-linux-ia64.so.2
> /usr/lib/gcc/ia64-redhat-linux/4.1.2/../../../crt1.o
> /usr/lib/gcc/ia64-redhat-linux/4.1.2/../../../crti.o
> /usr/lib/gcc/ia64-redhat-linux/4.1.2/crtbegin.o --traditional-format
> ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o
> plugin.o ldwrite.o ldexp.o  ldemul.o ldver.o ldmisc.o ldfile.o
> ldcref.o eelf64_ia64.o  ../bfd/.libs/libbfd.a ../libiberty/libiberty.a
>   -ldl -lz -ldl  -L/usr/lib/gcc/ia64-redhat-linux/4.1.2/../../..
> --start-group /usr/lib/gcc/ia64-redhat-linux/4.1.2/libgcc.a
> /usr/lib/gcc/ia64-redhat-linux/4.1.2/libgcc_eh.a
> /usr/lib/gcc/ia64-redhat-linux/4.1.2/../../../libunwind.a -lc
> --end-group /usr/lib/gcc/ia64-redhat-linux/4.1.2/crtend.o
> /usr/lib/gcc/ia64-redhat-linux/4.1.2/../../../crtn.o 2>&1}  /dev/null
> ld.tmp (timeout = 300)
> tmpdir/ld2: can't relax section: File truncated
> tmpdir/ld2: can't relax section: File truncated
> FAIL: bootstrap with --traditional-format

Unfortunately I don't have an ia64 system available to debug this.
Can you help out?  Possibly there is a miscompilation of ld2?  How
does ld2 differ from ld1?

ia64 was one of the targets that didn't have any problem with its
treatment of warning symbols, except for elflink.c
_bfd_elf_export_symbol looking at h->dynamic before following a
warning symbol link, and that one is unlikely to trigger in the
bootstrap tests..  The files that did have problems were

	* elf32-arm.c (elf32_arm_to_thumb_export_stub): 
	* elf32-m68k.c (elf_m68k_init_symndx2h_1): 
	* elf32-spu.c (allocate_spuear_stubs, build_spuear_stubs): 
	* elf32-vax.c (elf_vax_instantiate_got_entries): 
	* elf64-alpha.c (elf64_alpha_merge_ind_symbols): 
	(elf64_alpha_size_plt_section_1): 
	* elf64-hppa.c (elf64_hppa_mark_exported_functions): 
	(allocate_global_data_dlt, allocate_global_data_plt): 
	(allocate_global_data_stub, allocate_global_data_opd): 
	(allocate_dynrel_entries): 
	(elf64_hppa_mark_milli_and_exported_functions): 
	(elf64_hppa_finish_dynamic_symbol, elf64_hppa_finalize_opd): 
	(elf64_hppa_finalize_dlt, elf64_hppa_finalize_dynreloc): 
	* elflink.c (_bfd_elf_export_symbol): 
	* elfxx-mips.c (mips_elf_count_global_tls_entries): 
	(mips_elf_count_global_tls_relocs, allocate_dynrelocs): 
	(mips_elf_count_got_symbols, mips_elf_allocate_lazy_stub): 
	* vms-alpha.c (alpha_vms_link_output_symbol): 
	* xcofflink.c (xcoff_mark_auto_exports): 

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: bfd_link_hash_traverse
  2011-06-13 14:00   ` bfd_link_hash_traverse Alan Modra
@ 2011-06-13 14:07     ` H.J. Lu
  2011-06-13 14:37       ` bfd_link_hash_traverse H.J. Lu
  0 siblings, 1 reply; 8+ messages in thread
From: H.J. Lu @ 2011-06-13 14:07 UTC (permalink / raw)
  To: Binutils

On Mon, Jun 13, 2011 at 6:59 AM, Alan Modra <amodra@gmail.com> wrote:
> On Mon, Jun 13, 2011 at 05:55:14AM -0700, H.J. Lu wrote:
>> On Linux/ia64, I got
>>
>> Executing on host: sh -c {tmpdir/ld2 -m elf64_ia64  -o tmpdir/ld3
>> -dynamic-linker /lib/ld-linux-ia64.so.2
>> /usr/lib/gcc/ia64-redhat-linux/4.1.2/../../../crt1.o
>> /usr/lib/gcc/ia64-redhat-linux/4.1.2/../../../crti.o
>> /usr/lib/gcc/ia64-redhat-linux/4.1.2/crtbegin.o --traditional-format
>> ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o
>> plugin.o ldwrite.o ldexp.o  ldemul.o ldver.o ldmisc.o ldfile.o
>> ldcref.o eelf64_ia64.o  ../bfd/.libs/libbfd.a ../libiberty/libiberty.a
>>   -ldl -lz -ldl  -L/usr/lib/gcc/ia64-redhat-linux/4.1.2/../../..
>> --start-group /usr/lib/gcc/ia64-redhat-linux/4.1.2/libgcc.a
>> /usr/lib/gcc/ia64-redhat-linux/4.1.2/libgcc_eh.a
>> /usr/lib/gcc/ia64-redhat-linux/4.1.2/../../../libunwind.a -lc
>> --end-group /usr/lib/gcc/ia64-redhat-linux/4.1.2/crtend.o
>> /usr/lib/gcc/ia64-redhat-linux/4.1.2/../../../crtn.o 2>&1}  /dev/null
>> ld.tmp (timeout = 300)
>> tmpdir/ld2: can't relax section: File truncated
>> tmpdir/ld2: can't relax section: File truncated
>> FAIL: bootstrap with --traditional-format
>
> Unfortunately I don't have an ia64 system available to debug this.
> Can you help out?  Possibly there is a miscompilation of ld2?  How
> does ld2 differ from ld1?

ld2 is linked with --traditional-format.  Does it make a difference?

> ia64 was one of the targets that didn't have any problem with its
> treatment of warning symbols, except for elflink.c
> _bfd_elf_export_symbol looking at h->dynamic before following a
> warning symbol link, and that one is unlikely to trigger in the
> bootstrap tests..  The files that did have problems were
>

I will investigate.

Thanks.

-- 
H.J.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: bfd_link_hash_traverse
  2011-06-13 14:07     ` bfd_link_hash_traverse H.J. Lu
@ 2011-06-13 14:37       ` H.J. Lu
  0 siblings, 0 replies; 8+ messages in thread
From: H.J. Lu @ 2011-06-13 14:37 UTC (permalink / raw)
  To: Binutils

On Mon, Jun 13, 2011 at 7:06 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Jun 13, 2011 at 6:59 AM, Alan Modra <amodra@gmail.com> wrote:
>> On Mon, Jun 13, 2011 at 05:55:14AM -0700, H.J. Lu wrote:
>>> On Linux/ia64, I got
>>>
>>> Executing on host: sh -c {tmpdir/ld2 -m elf64_ia64  -o tmpdir/ld3
>>> -dynamic-linker /lib/ld-linux-ia64.so.2
>>> /usr/lib/gcc/ia64-redhat-linux/4.1.2/../../../crt1.o
>>> /usr/lib/gcc/ia64-redhat-linux/4.1.2/../../../crti.o
>>> /usr/lib/gcc/ia64-redhat-linux/4.1.2/crtbegin.o --traditional-format
>>> ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o
>>> plugin.o ldwrite.o ldexp.o  ldemul.o ldver.o ldmisc.o ldfile.o
>>> ldcref.o eelf64_ia64.o  ../bfd/.libs/libbfd.a ../libiberty/libiberty.a
>>>   -ldl -lz -ldl  -L/usr/lib/gcc/ia64-redhat-linux/4.1.2/../../..
>>> --start-group /usr/lib/gcc/ia64-redhat-linux/4.1.2/libgcc.a
>>> /usr/lib/gcc/ia64-redhat-linux/4.1.2/libgcc_eh.a
>>> /usr/lib/gcc/ia64-redhat-linux/4.1.2/../../../libunwind.a -lc
>>> --end-group /usr/lib/gcc/ia64-redhat-linux/4.1.2/crtend.o
>>> /usr/lib/gcc/ia64-redhat-linux/4.1.2/../../../crtn.o 2>&1}  /dev/null
>>> ld.tmp (timeout = 300)
>>> tmpdir/ld2: can't relax section: File truncated
>>> tmpdir/ld2: can't relax section: File truncated
>>> FAIL: bootstrap with --traditional-format
>>
>> Unfortunately I don't have an ia64 system available to debug this.
>> Can you help out?  Possibly there is a miscompilation of ld2?  How
>> does ld2 differ from ld1?
>
> ld2 is linked with --traditional-format.  Does it make a difference?
>
>> ia64 was one of the targets that didn't have any problem with its
>> treatment of warning symbols, except for elflink.c
>> _bfd_elf_export_symbol looking at h->dynamic before following a
>> warning symbol link, and that one is unlikely to trigger in the
>> bootstrap tests..  The files that did have problems were
>>
>
> I will investigate.
>

I can't reproduce it.  I will keep an eye on it.


-- 
H.J.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: bfd_link_hash_traverse
  2011-06-13  1:00 bfd_link_hash_traverse Alan Modra
  2011-06-13 12:55 ` bfd_link_hash_traverse H.J. Lu
@ 2011-06-13 20:48 ` Ian Lance Taylor
  2011-06-14  1:07   ` bfd_link_hash_traverse Alan Modra
  1 sibling, 1 reply; 8+ messages in thread
From: Ian Lance Taylor @ 2011-06-13 20:48 UTC (permalink / raw)
  To: binutils

Alan Modra <amodra@gmail.com> writes:

> +  for (i = 0; i < htab->table.size; i++)
> +    {
> +      struct bfd_link_hash_entry *p;
> +
> +      p = (struct bfd_link_hash_entry *) htab->table.table[i];
> +      for (; p != NULL; p = (struct bfd_link_hash_entry *) p->root.next)
> +	if (!(*func) (p->type == bfd_link_hash_warning ? p->u.i.link : p, info))
> +	  goto out;
> +    }

I believe it is technically possible to have two warnings on a single
symbol, which I believe will show up as a warning symbol pointing to a
warning symbol pointing to a real symbol.  That's why the linker code is
littered with loops like

  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;

You probably want to have such a loop here.

Ian

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: bfd_link_hash_traverse
  2011-06-13 20:48 ` bfd_link_hash_traverse Ian Lance Taylor
@ 2011-06-14  1:07   ` Alan Modra
  2011-06-14  1:48     ` bfd_link_hash_traverse Ian Lance Taylor
  0 siblings, 1 reply; 8+ messages in thread
From: Alan Modra @ 2011-06-14  1:07 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: binutils

On Mon, Jun 13, 2011 at 01:47:41PM -0700, Ian Lance Taylor wrote:
> Alan Modra <amodra@gmail.com> writes:
> 
> > +  for (i = 0; i < htab->table.size; i++)
> > +    {
> > +      struct bfd_link_hash_entry *p;
> > +
> > +      p = (struct bfd_link_hash_entry *) htab->table.table[i];
> > +      for (; p != NULL; p = (struct bfd_link_hash_entry *) p->root.next)
> > +	if (!(*func) (p->type == bfd_link_hash_warning ? p->u.i.link : p, info))
> > +	  goto out;
> > +    }
> 
> I believe it is technically possible to have two warnings on a single
> symbol, which I believe will show up as a warning symbol pointing to a
> warning symbol pointing to a real symbol.

Really?  Only one of the functions called by link_hash_traverse,
elf64-hppa.c:allocate_global_data_opd handled two levels of warning
symbols, using

      while (hh->eh.root.type == bfd_link_hash_indirect
	     || hh->eh.root.type == bfd_link_hash_warning)
	hh = hppa_elf_hash_entry (hh->eh.root.u.i.link);

which is just plain wrong.  You shouldn't look at the indirect link
like this in a traverse function, because then you'll process the
real symbol twice.

I also don't see how we could create two levels of warning symbols
with current code, given that warning symbols have the same name as
the real symbol they point to.  See linker.c:link_action table
current/prev both WARN gives NOACT.

>  That's why the linker code is
> littered with loops like
> 
>   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;
> 
> You probably want to have such a loop here.

Aren't these loops more to handle multiple levels of indirect
symbols?  I believe you can have warn -> indirect -> indirect -> real
and even deeper nesting of indirects.  In fact, those loops might be
better written as

   if (h->root.type == bfd_link_hash_warning)
     h = (struct elf_link_hash_entry *) h->root.u.i.link;
   while (h->root.type == bfd_link_hash_indirect)
     h = (struct elf_link_hash_entry *) h->root.u.i.link;

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: bfd_link_hash_traverse
  2011-06-14  1:07   ` bfd_link_hash_traverse Alan Modra
@ 2011-06-14  1:48     ` Ian Lance Taylor
  0 siblings, 0 replies; 8+ messages in thread
From: Ian Lance Taylor @ 2011-06-14  1:48 UTC (permalink / raw)
  To: binutils

Alan Modra <amodra@gmail.com> writes:

> I also don't see how we could create two levels of warning symbols
> with current code, given that warning symbols have the same name as
> the real symbol they point to.  See linker.c:link_action table
> current/prev both WARN gives NOACT.

Hmmm, you're right, I guess I am misremembering.  I guess we don't
handle multiple warnings on the same symbol.

Ian

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-06-14  1:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-13  1:00 bfd_link_hash_traverse Alan Modra
2011-06-13 12:55 ` bfd_link_hash_traverse H.J. Lu
2011-06-13 14:00   ` bfd_link_hash_traverse Alan Modra
2011-06-13 14:07     ` bfd_link_hash_traverse H.J. Lu
2011-06-13 14:37       ` bfd_link_hash_traverse H.J. Lu
2011-06-13 20:48 ` bfd_link_hash_traverse Ian Lance Taylor
2011-06-14  1:07   ` bfd_link_hash_traverse Alan Modra
2011-06-14  1:48     ` bfd_link_hash_traverse Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).