ld i386 differences 2.10.2 / 2.12

Alan Modra amodra@bigpond.net.au
Wed Mar 27 19:17:00 GMT 2002


When/if my build of current glibc completes sucessfully, I'll install
this patch.  Most of the patch is tediously repetitious, simply just
following warning symbol root.u.i.link to get at the real symbol.
In addition, there's a change to how duplicate warning symbols are
handled.  Previously, a duplicate would result in a chain of syms
warning -> warning -> real, which means iterating to reach the real
sym.  I can't see that allowing duplicates provides any useful purpose,
so we now just ignore them.

bfd/ChangeLog
	* linker.c (link_action): Ignore duplicate warning syms.
	(_bfd_generic_link_write_global_symbol): Follow warning symbol link.
	* elflink.h (elf_adjust_dynstr_offsets): Likewise.
	(elf_adjust_dynamic_symbol): Likewise.
	(elf_export_symbol): Likewise.
	(elf_link_find_version_dependencies): Likewise.
	(elf_link_assign_sym_version): Likewise.
	(elf_link_sec_merge_syms): Likewise.
	(elf_link_output_extsym): Likewise.
	(elf_gc_sweep_symbol): Likewise.
	(elf_gc_propagate_vtable_entries_used): Likewise.
	(elf_gc_smash_unused_vtentry_relocs): Likewise.
	(elf_gc_allocate_got_offsets): Likewise.
	(elf_collect_hash_codes): Likewise.
	* elflink.c (elf_link_renumber_hash_table_dynsyms): Likewise.
	* elf-hppa.h (elf_hppa_unmark_useless_dynamic_symbols): Likewise.
	(elf_hppa_remark_useless_dynamic_symbols): Likewise.
	* elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise.
	* elf32-arm.h (elf32_arm_discard_copies): Likewise.
	* elf32-cris.c (elf_cris_adjust_gotplt_to_got): Likewise.
	(elf_cris_discard_excess_dso_dynamics): Likewise.
	* elf32-hppa.c (clobber_millicode_symbols): Likewise.
	(mark_PIC_calls): Likewise.
	(allocate_plt_static): Likewise.
	(allocate_dynrelocs): Likewise.
	(readonly_dynrelocs): Likewise.
	* elf32-i386.c (allocate_dynrelocs): Likewise.
	(readonly_dynrelocs): Likewise.
	* elf32-i370.c (i370_elf_adjust_dynindx): Likewise.
	* elf32-m68k.c (elf_m68k_discard_copies): Likewise.
	* elf32-mips.c (mips_elf_output_extsym): Likewise.
	(mips_elf_sort_hash_table_f): Likewise.
	(mips_elf_check_mips16_stubs): Likewise.
	* elf32-s390.c (allocate_dynrelocs): Likewise.
	(readonly_dynrelocs): Likewise.
	* elf32-sh.c (sh_elf_discard_copies): Likewise.
	* elf32-xstormy16.c (xstormy16_relax_plt_check): Likewise.
	(xstormy16_relax_plt_realloc): Likewise.
	* elf64-alpha.c (elf64_alpha_calc_got_offsets_for_symbol): Likewise.
	(elf64_alpha_output_extsym): Likewise.
	* elf64-hppa.c (elf64_hppa_mark_exported_functions): Likewise.
	* elf64-mips.c (mips_elf64_sort_hash_table_f): Likewise.
	(mips_elf64_check_mips16_stubs): Likewise.
	(mips_elf64_output_extsym): Likewise.
	* elf64-ppc.c (func_desc_adjust): Likewise.
	(allocate_dynrelocs): Likewise.
	(readonly_dynrelocs): Likewise.
	* elf64-s390.c (allocate_dynrelocs): Likewise.
	(readonly_dynrelocs): Likewise.
	* elf64-sh64.c (sh64_elf64_discard_copies): Likewise.
	* elf64-x86-64.c (allocate_dynrelocs): Likewise.
	(readonly_dynrelocs): Likewise.
	* elfxx-ia64.c (elfNN_ia64_global_dyn_sym_thunk): Likewise.
	* aoutx.h (aout_link_write_other_symbol): Likewise.
	* cofflink.c (_bfd_coff_write_task_globals): Likewise.
	(_bfd_coff_write_global_sym): Likewise.
	* i386linux.c (linux_tally_symbols): Likewise.
	* m68klinux.c (linux_tally_symbols): Likewise.
	* sparclinux.c (linux_tally_symbols): Likewise.
	* pdp11.c (aout_link_write_other_symbol): Likewise.
	* sunos.c (sunos_scan_dynamic_symbol): Likewise.
	* xcofflink.c (xcoff_build_ldsyms): Likewise.
	(xcoff_write_global_symbol): Likewise.

	* cofflink.c (_bfd_coff_final_link): Formatting.
	* cpu-mips.c (mips_compatible): Make static, prototype.
	* elf32-i386.c (elf_i386_check_relocs): Formatting.
	* elf32-sh.c (sh_elf_size_dynamic_sections): Likewise.
	* elf64-alpha.c (elf64_alpha_output_extsym): Likewise.
	* elf64-mips.c (mips_elf64_sort_hash_table): Likewise.
	(mips_elf64_final_link): Likewise.
	* elflink.h (elf_link_find_version_dependencies): Remove duplicate
	prototype.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

Index: bfd/aoutx.h
===================================================================
RCS file: /cvs/src/src/bfd/aoutx.h,v
retrieving revision 1.27
diff -u -p -r1.27 aoutx.h
--- aoutx.h	2001/10/10 12:08:27	1.27
+++ aoutx.h	2002/03/28 01:49:54
@@ -1,6 +1,6 @@
 /* BFD semi-generic back-end for a.out binaries.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
-   2001
+   2001, 2002
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -4577,6 +4577,13 @@ aout_link_write_other_symbol (h, data)
   bfd_size_type indx;
   bfd_size_type amt;
 
+  if (h->root.type == bfd_link_hash_warning)
+    {
+      h = (struct aout_link_hash_entry *) h->root.u.i.link;
+      if (h->root.type == bfd_link_hash_new)
+	return true;
+    }
+
   output_bfd = finfo->output_bfd;
 
   if (aout_backend_info (output_bfd)->write_dynamic_symbol != NULL)
@@ -4605,6 +4612,7 @@ aout_link_write_other_symbol (h, data)
   switch (h->root.type)
     {
     default:
+    case bfd_link_hash_warning:
       abort ();
       /* Avoid variable not initialized warnings.  */
       return true;
@@ -4646,9 +4654,8 @@ aout_link_write_other_symbol (h, data)
       type = N_WEAKU;
       val = 0;
     case bfd_link_hash_indirect:
-    case bfd_link_hash_warning:
-      /* FIXME: Ignore these for now.  The circumstances under which
-	 they should be written out are not clear to me.  */
+      /* We ignore these symbols, since the indirected symbol is
+	 already in the hash table.  */
       return true;
     }
 
Index: bfd/cofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/cofflink.c,v
retrieving revision 1.30
diff -u -p -r1.30 cofflink.c
--- cofflink.c	2001/10/10 12:08:27	1.30
+++ cofflink.c	2002/03/28 01:49:59
@@ -1,5 +1,5 @@
 /* COFF specific linker code.
-   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
    Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
@@ -1005,7 +1005,8 @@ _bfd_coff_final_link (abfd, info)
   if (info->task_link)
     {
       finfo.failed = false;
-      coff_link_hash_traverse (coff_hash_table (info), _bfd_coff_write_task_globals,
+      coff_link_hash_traverse (coff_hash_table (info),
+			       _bfd_coff_write_task_globals,
 			       (PTR) &finfo);
       if (finfo.failed)
 	goto error_return;
@@ -1013,7 +1014,8 @@ _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,
+  coff_link_hash_traverse (coff_hash_table (info),
+			   _bfd_coff_write_global_sym,
 			   (PTR) &finfo);
   if (finfo.failed)
     goto error_return;
@@ -2497,6 +2499,13 @@ _bfd_coff_write_global_sym (h, data)
 
   output_bfd = finfo->output_bfd;
 
+  if (h->root.type == bfd_link_hash_warning)
+    {
+      h = (struct coff_link_hash_entry *) h->root.u.i.link;
+      if (h->root.type == bfd_link_hash_new)
+	return true;
+    }
+
   if (h->indx >= 0)
     return true;
 
@@ -2512,6 +2521,7 @@ _bfd_coff_write_global_sym (h, data)
     {
     default:
     case bfd_link_hash_new:
+    case bfd_link_hash_warning:
       abort ();
       return false;
 
@@ -2544,7 +2554,6 @@ _bfd_coff_write_global_sym (h, data)
       break;
 
     case bfd_link_hash_indirect:
-    case bfd_link_hash_warning:
       /* Just ignore these.  They can't be handled anyhow.  */
       return true;
     }
@@ -2698,6 +2707,9 @@ _bfd_coff_write_task_globals (h, data)
   struct coff_final_link_info *finfo = (struct coff_final_link_info *) data;
   boolean rtnval = true;
   boolean save_global_to_static;
+
+  if (h->root.type == bfd_link_hash_warning)
+    h = (struct coff_link_hash_entry *) h->root.u.i.link;
 
   if (h->indx < 0)
     {
Index: bfd/cpu-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/cpu-mips.c,v
retrieving revision 1.11
diff -u -p -r1.11 cpu-mips.c
--- cpu-mips.c	2002/03/14 10:38:31	1.11
+++ cpu-mips.c	2002/03/28 01:49:59
@@ -23,10 +23,13 @@ Foundation, Inc., 59 Temple Place - Suit
 #include "sysdep.h"
 #include "libbfd.h"
 
+static const bfd_arch_info_type *mips_compatible
+  PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
+
 /* The default routine tests bits_per_word, which is wrong on mips as
    mips word size doesn't correlate with reloc size.  */
 
-const bfd_arch_info_type *
+static const bfd_arch_info_type *
 mips_compatible (a, b)
      const bfd_arch_info_type *a;
      const bfd_arch_info_type *b;
Index: bfd/ecoff.c
===================================================================
RCS file: /cvs/src/src/bfd/ecoff.c,v
retrieving revision 1.13
diff -u -p -r1.13 ecoff.c
--- ecoff.c	2001/10/10 12:08:28	1.13
+++ ecoff.c	2002/03/28 01:50:03
@@ -1,5 +1,5 @@
 /* Generic ECOFF (Extended-COFF) routines.
-   Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+   Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
    Free Software Foundation, Inc.
    Original version by Per Bothner.
    Full support added by Ian Lance Taylor, ian@cygnus.com.
@@ -4393,6 +4393,13 @@ ecoff_link_write_external (h, data)
   bfd *output_bfd = einfo->abfd;
   boolean strip;
 
+  if (h->root.type == bfd_link_hash_warning)
+    {
+      h = (struct ecoff_link_hash_entry *) h->root.u.i.link;
+      if (h->root.type == bfd_link_hash_new)
+	return true;
+    }
+
   /* We need to check if this symbol is being stripped.  */
   if (h->root.type == bfd_link_hash_undefined
       || h->root.type == bfd_link_hash_undefweak)
@@ -4474,6 +4481,7 @@ ecoff_link_write_external (h, data)
   switch (h->root.type)
     {
     default:
+    case bfd_link_hash_warning:
     case bfd_link_hash_new:
       abort ();
     case bfd_link_hash_undefined:
@@ -4502,9 +4510,8 @@ ecoff_link_write_external (h, data)
       h->esym.asym.value = h->root.u.c.size;
       break;
     case bfd_link_hash_indirect:
-    case bfd_link_hash_warning:
-      /* FIXME: Ignore these for now.  The circumstances under which
-	 they should be written out are not clear to me.  */
+      /* We ignore these symbols, since the indirected symbol is
+	 already in the hash table.  */
       return true;
     }
 
Index: bfd/elf-hppa.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-hppa.h,v
retrieving revision 1.54
diff -u -p -r1.54 elf-hppa.h
--- elf-hppa.h	2002/03/05 17:55:55	1.54
+++ elf-hppa.h	2002/03/28 01:50:05
@@ -1079,6 +1079,9 @@ elf_hppa_unmark_useless_dynamic_symbols 
 {
   struct bfd_link_info *info = (struct bfd_link_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.
@@ -1111,6 +1114,9 @@ elf_hppa_remark_useless_dynamic_symbols 
      PTR data;
 {
   struct bfd_link_info *info = (struct bfd_link_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
Index: bfd/elf-m10300.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-m10300.c,v
retrieving revision 1.21
diff -u -p -r1.21 elf-m10300.c
--- elf-m10300.c	2002/02/12 09:25:39	1.21
+++ elf-m10300.c	2002/03/28 01:50:06
@@ -709,6 +709,9 @@ elf32_mn10300_finish_hash_table_entry (g
 
   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.h
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.h,v
retrieving revision 1.77
diff -u -p -r1.77 elf32-arm.h
--- elf32-arm.h	2002/03/21 15:26:03	1.77
+++ elf32-arm.h	2002/03/28 01:50:08
@@ -3288,6 +3288,9 @@ elf32_arm_discard_copies (h, ignore)
 {
   struct elf32_arm_pcrel_relocs_copied * s;
 
+  if (h->root.root.type == bfd_link_hash_warning)
+    h = (struct elf32_arm_link_hash_entry *) h->root.root.u.i.link;
+
   /* We only discard relocs for symbols defined in a regular object.  */
   if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
     return true;
Index: bfd/elf32-cris.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-cris.c,v
retrieving revision 1.26
diff -u -p -r1.26 elf32-cris.c
--- elf32-cris.c	2002/02/19 12:40:24	1.26
+++ elf32-cris.c	2002/03/28 01:50:11
@@ -1930,6 +1930,9 @@ elf_cris_adjust_gotplt_to_got (h, p)
 
   BFD_ASSERT (dynobj != NULL);
 
+  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;
@@ -2881,6 +2884,9 @@ 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.  */
@@ -2905,6 +2911,9 @@ elf_cris_discard_excess_program_dynamics
      PTR inf;
 {
   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,
Index: bfd/elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.74
diff -u -p -r1.74 elf32-hppa.c
--- elf32-hppa.c	2002/03/05 17:55:55	1.74
+++ elf32-hppa.c	2002/03/28 01:50:15
@@ -1982,6 +1982,9 @@ mark_PIC_calls (h, inf)
      struct elf_link_hash_entry *h;
      PTR inf ATTRIBUTE_UNUSED;
 {
+  if (h->root.type == bfd_link_hash_warning)
+    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
   if (! (h->plt.refcount > 0
 	 && (h->root.type == bfd_link_hash_defined
 	     || h->root.type == bfd_link_hash_defweak)
@@ -2011,10 +2014,12 @@ allocate_plt_static (h, inf)
   struct elf32_hppa_link_hash_table *htab;
   asection *s;
 
-  if (h->root.type == bfd_link_hash_indirect
-      || h->root.type == bfd_link_hash_warning)
+  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 = hppa_link_hash_table (info);
   if (((struct elf32_hppa_link_hash_entry *) h)->pic_call)
@@ -2080,10 +2085,12 @@ allocate_dynrelocs (h, inf)
   struct elf32_hppa_link_hash_entry *eh;
   struct elf32_hppa_dyn_reloc_entry *p;
 
-  if (h->root.type == bfd_link_hash_indirect
-      || h->root.type == bfd_link_hash_warning)
+  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 = hppa_link_hash_table (info);
   if (htab->elf.dynamic_sections_created
@@ -2213,6 +2220,9 @@ clobber_millicode_symbols (h, info)
      struct elf_link_hash_entry *h;
      struct bfd_link_info *info;
 {
+  if (h->root.type == bfd_link_hash_warning)
+    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
   if (h->type == STT_PARISC_MILLI
       && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
     {
@@ -2230,6 +2240,9 @@ readonly_dynrelocs (h, inf)
 {
   struct elf32_hppa_link_hash_entry *eh;
   struct elf32_hppa_dyn_reloc_entry *p;
+
+  if (h->root.type == bfd_link_hash_warning)
+    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
   eh = (struct elf32_hppa_link_hash_entry *) h;
   for (p = eh->dyn_relocs; p != NULL; p = p->next)
Index: bfd/elf32-i370.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i370.c,v
retrieving revision 1.19
diff -u -p -r1.19 elf32-i370.c
--- elf32-i370.c	2002/02/19 12:40:24	1.19
+++ elf32-i370.c	2002/03/28 01:50:16
@@ -1,5 +1,5 @@
 /* i370-specific support for 32-bit ELF
-   Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001
+   Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002
    Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
    Hacked by Linas Vepstas for i370 linas@linas.org
@@ -735,6 +735,9 @@ i370_elf_adjust_dynindx (h, cparg)
 	   "i370_elf_adjust_dynindx called, h->dynindx = %d, *cp = %d\n",
 	   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.65
diff -u -p -r1.65 elf32-i386.c
--- elf32-i386.c	2002/02/19 12:40:23	1.65
+++ elf32-i386.c	2002/03/28 01:50:19
@@ -1,5 +1,5 @@
 /* Intel 80386/80486-specific support for 32-bit ELF
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
    Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -847,11 +847,10 @@ elf_i386_check_relocs (abfd, info, sec, 
 		{
 		  const char *name;
 		  bfd *dynobj;
+		  unsigned int strndx = elf_elfheader (abfd)->e_shstrndx;
+		  unsigned int shnam = elf_section_data (sec)->rel_hdr.sh_name;
 
-		  name = (bfd_elf_string_from_elf_section
-			  (abfd,
-			   elf_elfheader (abfd)->e_shstrndx,
-			   elf_section_data (sec)->rel_hdr.sh_name));
+		  name = bfd_elf_string_from_elf_section (abfd, strndx, shnam);
 		  if (name == NULL)
 		    return false;
 
@@ -1251,10 +1250,15 @@ allocate_dynrelocs (h, inf)
   struct elf_i386_link_hash_entry *eh;
   struct elf_i386_dyn_relocs *p;
 
-  if (h->root.type == bfd_link_hash_indirect
-      || h->root.type == bfd_link_hash_warning)
+  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_i386_hash_table (info);
 
@@ -1420,6 +1424,9 @@ readonly_dynrelocs (h, inf)
 {
   struct elf_i386_link_hash_entry *eh;
   struct elf_i386_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_i386_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.37
diff -u -p -r1.37 elf32-m68k.c
--- elf32-m68k.c	2002/02/19 12:40:25	1.37
+++ elf32-m68k.c	2002/03/28 01:50:20
@@ -1,5 +1,5 @@
 /* Motorola 68k series support for 32-bit ELF
-   Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+   Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
    Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -1270,6 +1270,9 @@ elf_m68k_discard_copies (h, ignore)
      PTR ignore ATTRIBUTE_UNUSED;
 {
   struct elf_m68k_pcrel_relocs_copied *s;
+
+  if (h->root.root.type == bfd_link_hash_warning)
+    h = (struct elf_m68k_link_hash_entry *) h->root.root.u.i.link;
 
   /* We only discard relocs for symbols defined in a regular object.  */
   if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
Index: bfd/elf32-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-mips.c,v
retrieving revision 1.147
diff -u -p -r1.147 elf32-mips.c
--- elf32-mips.c	2002/02/19 12:40:29	1.147
+++ elf32-mips.c	2002/03/28 01:50:27
@@ -4779,6 +4779,9 @@ mips_elf_output_extsym (h, data)
   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.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
@@ -6089,6 +6092,9 @@ mips_elf_sort_hash_table_f (h, data)
   struct mips_elf_hash_sort_data *hsd
     = (struct mips_elf_hash_sort_data *) 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)
@@ -8789,6 +8795,9 @@ mips_elf_check_mips16_stubs (h, data)
      struct mips_elf_link_hash_entry *h;
      PTR data ATTRIBUTE_UNUSED;
 {
+  if (h->root.root.type == bfd_link_hash_warning)
+    h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
+
   if (h->fn_stub != NULL
       && ! h->need_fn_stub)
     {
Index: bfd/elf32-s390.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-s390.c,v
retrieving revision 1.22
diff -u -p -r1.22 elf32-s390.c
--- elf32-s390.c	2002/02/19 18:22:16	1.22
+++ elf32-s390.c	2002/03/28 01:50:31
@@ -1,5 +1,5 @@
 /* IBM S/390-specific support for 32-bit ELF
-   Copyright 2000, 2001 Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
    Contributed by Carl B. Pedersen and Martin Schwidefsky.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -1214,10 +1214,12 @@ allocate_dynrelocs (h, inf)
   struct elf_s390_link_hash_entry *eh;
   struct elf_s390_dyn_relocs *p;
 
-  if (h->root.type == bfd_link_hash_indirect
-      || h->root.type == bfd_link_hash_warning)
+  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 = elf_s390_hash_table (info);
 
@@ -1383,6 +1385,9 @@ 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-sh.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh.c,v
retrieving revision 1.45
diff -u -p -r1.45 elf32-sh.c
--- elf32-sh.c	2002/02/19 12:40:26	1.45
+++ elf32-sh.c	2002/03/28 01:50:35
@@ -3899,8 +3899,8 @@ sh_elf_size_dynamic_sections (output_bfd
      will not fill them in in the relocate_section routine.  */
   if (info->shared && info->symbolic)
     sh_elf_link_hash_traverse (sh_elf_hash_table (info),
-				 sh_elf_discard_copies,
-				 (PTR) NULL);
+			       sh_elf_discard_copies,
+			       (PTR) NULL);
 
   /* The check_relocs and adjust_dynamic_symbol entry points have
      determined the sizes of the various dynamic sections.  Allocate
@@ -4037,6 +4037,9 @@ sh_elf_discard_copies (h, ignore)
      PTR ignore ATTRIBUTE_UNUSED;
 {
   struct elf_sh_pcrel_relocs_copied *s;
+
+  if (h->root.root.type == bfd_link_hash_warning)
+    h = (struct elf_sh_link_hash_entry *) h->root.root.u.i.link;
 
   /* We only discard relocs for symbols defined in a regular object.  */
   if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
Index: bfd/elf32-xstormy16.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-xstormy16.c,v
retrieving revision 1.3
diff -u -p -r1.3 elf32-xstormy16.c
--- elf32-xstormy16.c	2002/01/15 11:58:42	1.3
+++ elf32-xstormy16.c	2002/03/28 01:50:36
@@ -500,6 +500,9 @@ xstormy16_relax_plt_check (h, xdata)
 {
   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;
@@ -532,6 +535,9 @@ xstormy16_relax_plt_realloc (h, xdata)
      PTR xdata;
 {
   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)
     {
Index: bfd/elf64-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-alpha.c,v
retrieving revision 1.59
diff -u -p -r1.59 elf64-alpha.c
--- elf64-alpha.c	2002/02/19 12:40:27	1.59
+++ elf64-alpha.c	2002/03/28 01:50:40
@@ -2120,18 +2120,21 @@ elf64_alpha_output_extsym (h, data)
   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.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
-           || (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0)
-          && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
-          && (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
+	    || (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0)
+	   && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
+	   && (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
     strip = true;
   else if (einfo->info->strip == strip_all
-          || (einfo->info->strip == strip_some
-              && bfd_hash_lookup (einfo->info->keep_hash,
-                                  h->root.root.root.string,
-                                  false, false) == NULL))
+	   || (einfo->info->strip == strip_some
+	       && bfd_hash_lookup (einfo->info->keep_hash,
+				   h->root.root.root.string,
+				   false, false) == NULL))
     strip = true;
   else
     strip = false;
@@ -2150,44 +2153,44 @@ elf64_alpha_output_extsym (h, data)
       h->esym.asym.st = stGlobal;
 
       if (h->root.root.type != bfd_link_hash_defined
-         && h->root.root.type != bfd_link_hash_defweak)
-       h->esym.asym.sc = scAbs;
+	  && h->root.root.type != bfd_link_hash_defweak)
+	h->esym.asym.sc = scAbs;
       else
-       {
-         const char *name;
+	{
+	  const char *name;
+
+	  sec = h->root.root.u.def.section;
+	  output_section = sec->output_section;
 
-         sec = h->root.root.u.def.section;
-         output_section = sec->output_section;
+	  /* When making a shared library and symbol h is the one from
+	     the another shared library, OUTPUT_SECTION may be null.  */
+	  if (output_section == NULL)
+	    h->esym.asym.sc = scUndefined;
+	  else
+	    {
+	      name = bfd_section_name (output_section->owner, output_section);
 
-         /* When making a shared library and symbol h is the one from
-            the another shared library, OUTPUT_SECTION may be null.  */
-         if (output_section == NULL)
-           h->esym.asym.sc = scUndefined;
-         else
-           {
-             name = bfd_section_name (output_section->owner, output_section);
-
-             if (strcmp (name, ".text") == 0)
-               h->esym.asym.sc = scText;
-             else if (strcmp (name, ".data") == 0)
-               h->esym.asym.sc = scData;
-             else if (strcmp (name, ".sdata") == 0)
-               h->esym.asym.sc = scSData;
-             else if (strcmp (name, ".rodata") == 0
-                      || strcmp (name, ".rdata") == 0)
-               h->esym.asym.sc = scRData;
-             else if (strcmp (name, ".bss") == 0)
-               h->esym.asym.sc = scBss;
-             else if (strcmp (name, ".sbss") == 0)
-               h->esym.asym.sc = scSBss;
-             else if (strcmp (name, ".init") == 0)
-               h->esym.asym.sc = scInit;
-             else if (strcmp (name, ".fini") == 0)
-               h->esym.asym.sc = scFini;
-             else
-               h->esym.asym.sc = scAbs;
-           }
-       }
+	      if (strcmp (name, ".text") == 0)
+		h->esym.asym.sc = scText;
+	      else if (strcmp (name, ".data") == 0)
+		h->esym.asym.sc = scData;
+	      else if (strcmp (name, ".sdata") == 0)
+		h->esym.asym.sc = scSData;
+	      else if (strcmp (name, ".rodata") == 0
+		       || strcmp (name, ".rdata") == 0)
+		h->esym.asym.sc = scRData;
+	      else if (strcmp (name, ".bss") == 0)
+		h->esym.asym.sc = scBss;
+	      else if (strcmp (name, ".sbss") == 0)
+		h->esym.asym.sc = scSBss;
+	      else if (strcmp (name, ".init") == 0)
+		h->esym.asym.sc = scInit;
+	      else if (strcmp (name, ".fini") == 0)
+		h->esym.asym.sc = scFini;
+	      else
+		h->esym.asym.sc = scAbs;
+	    }
+	}
 
       h->esym.asym.reserved = 0;
       h->esym.asym.index = indexNil;
@@ -2199,18 +2202,18 @@ elf64_alpha_output_extsym (h, data)
 	   || h->root.root.type == bfd_link_hash_defweak)
     {
       if (h->esym.asym.sc == scCommon)
-       h->esym.asym.sc = scBss;
+	h->esym.asym.sc = scBss;
       else if (h->esym.asym.sc == scSCommon)
-       h->esym.asym.sc = scSBss;
+	h->esym.asym.sc = scSBss;
 
       sec = h->root.root.u.def.section;
       output_section = sec->output_section;
       if (output_section != NULL)
-       h->esym.asym.value = (h->root.root.u.def.value
-                             + sec->output_offset
-                             + output_section->vma);
+	h->esym.asym.value = (h->root.root.u.def.value
+			      + sec->output_offset
+			      + output_section->vma);
       else
-       h->esym.asym.value = 0;
+	h->esym.asym.value = 0;
     }
   else if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
     {
@@ -2232,8 +2235,8 @@ elf64_alpha_output_extsym (h, data)
     }
 
   if (! bfd_ecoff_debug_one_external (einfo->abfd, einfo->debug, einfo->swap,
-                                     h->root.root.root.string,
-                                     &h->esym))
+				      h->root.root.root.string,
+				      &h->esym))
     {
       einfo->failed = true;
       return false;
@@ -2861,6 +2864,9 @@ 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)
       {
@@ -3038,6 +3044,9 @@ elf64_alpha_calc_dynrel_sizes (h, info)
      struct alpha_elf_link_hash_entry *h;
      struct bfd_link_info *info;
 {
+  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
Index: bfd/elf64-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-hppa.c,v
retrieving revision 1.17
diff -u -p -r1.17 elf64-hppa.c
--- elf64-hppa.c	2001/12/17 00:52:35	1.17
+++ elf64-hppa.c	2002/03/28 01:50:42
@@ -1,5 +1,5 @@
 /* Support for HPPA 64-bit ELF
-   Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -1022,6 +1022,9 @@ elf64_hppa_mark_exported_functions (h, d
   struct elf64_hppa_link_hash_table *hppa_info;
 
   hppa_info = elf64_hppa_hash_table (info);
+
+  if (h->root.type == bfd_link_hash_warning)
+    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
   if (h
       && (h->root.type == bfd_link_hash_defined
Index: bfd/elf64-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-mips.c,v
retrieving revision 1.28
diff -u -p -r1.28 elf64-mips.c
--- elf64-mips.c	2002/02/19 12:40:32	1.28
+++ elf64-mips.c	2002/03/28 01:50:47
@@ -3052,6 +3052,9 @@ mips_elf64_sort_hash_table_f (h, data)
   struct mips_elf64_hash_sort_data *hsd 
     = (struct mips_elf64_hash_sort_data *) data;
 
+  if (h->root.root.type == bfd_link_hash_warning)
+    h = (struct mips_elf64_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)
@@ -3090,9 +3093,9 @@ mips_elf64_sort_hash_table (info, max_lo
   hsd.min_got_dynindx = elf_hash_table (info)->dynsymcount;
   hsd.max_non_got_dynindx = max_local;
   mips_elf64_link_hash_traverse (((struct mips_elf64_link_hash_table *) 
-				elf_hash_table (info)), 
-			       mips_elf64_sort_hash_table_f, 
-			       &hsd);
+				  elf_hash_table (info)), 
+				 mips_elf64_sort_hash_table_f, 
+				 &hsd);
 
   /* There shoud have been enough room in the symbol table to
      accomodate both the GOT and non-GOT symbols.  */
@@ -4685,6 +4688,9 @@ mips_elf64_check_mips16_stubs (h, data)
      struct mips_elf64_link_hash_entry *h;
      PTR data ATTRIBUTE_UNUSED;
 {
+  if (h->root.root.type == bfd_link_hash_warning)
+    h = (struct mips_elf64_link_hash_entry *) h->root.root.u.i.link;
+
   if (h->fn_stub != NULL
       && ! h->need_fn_stub)
     {
@@ -6129,6 +6135,9 @@ mips_elf64_output_extsym (h, data)
   boolean strip;
   asection *sec, *output_section;
 
+  if (h->root.root.type == bfd_link_hash_warning)
+    h = (struct mips_elf64_link_hash_entry *) h->root.root.u.i.link;
+
   if (h->root.indx == -2)
     strip = false;
   else if (((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
@@ -6619,8 +6628,8 @@ mips_elf64_final_link (abfd, info)
 	  einfo.swap = swap;
 	  einfo.failed = false;
 	  mips_elf64_link_hash_traverse (mips_elf64_hash_table (info),
-				       mips_elf64_output_extsym,
-				       (PTR) &einfo);
+					 mips_elf64_output_extsym,
+					 (PTR) &einfo);
 	  if (einfo.failed)
 	    return false;
 
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.31
diff -u -p -r1.31 elf64-ppc.c
--- elf64-ppc.c	2002/02/25 03:44:16	1.31
+++ elf64-ppc.c	2002/03/28 01:50:50
@@ -2501,10 +2501,12 @@ func_desc_adjust (h, inf)
   struct bfd_link_info *info;
   struct ppc_link_hash_table *htab;
 
-  if (h->root.type == bfd_link_hash_indirect
-      || h->root.type == bfd_link_hash_warning)
+  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);
 
@@ -2875,10 +2877,12 @@ allocate_dynrelocs (h, inf)
   struct ppc_link_hash_entry *eh;
   struct ppc_dyn_relocs *p;
 
-  if (h->root.type == bfd_link_hash_indirect
-      || h->root.type == bfd_link_hash_warning)
+  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);
 
@@ -3033,6 +3037,9 @@ readonly_dynrelocs (h, inf)
 {
   struct ppc_link_hash_entry *eh;
   struct ppc_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)
Index: bfd/elf64-s390.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-s390.c,v
retrieving revision 1.21
diff -u -p -r1.21 elf64-s390.c
--- elf64-s390.c	2002/02/19 18:22:16	1.21
+++ elf64-s390.c	2002/03/28 01:50:52
@@ -1,5 +1,5 @@
 /* IBM S/390-specific support for 64-bit ELF
-   Copyright 2000, 2001 Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
    Contributed Martin Schwidefsky (schwidefsky@de.ibm.com).
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -1169,10 +1169,12 @@ allocate_dynrelocs (h, inf)
   struct elf_s390_link_hash_entry *eh;
   struct elf_s390_dyn_relocs *p;
 
-  if (h->root.type == bfd_link_hash_indirect
-      || h->root.type == bfd_link_hash_warning)
+  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 = elf_s390_hash_table (info);
 
@@ -1338,6 +1340,9 @@ 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.4
diff -u -p -r1.4 elf64-sh64.c
--- elf64-sh64.c	2002/02/22 10:03:03	1.4
+++ elf64-sh64.c	2002/03/28 01:50:55
@@ -3607,6 +3607,9 @@ sh64_elf64_discard_copies (h, ignore)
 {
   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.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
     return true;
Index: bfd/elf64-x86-64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-x86-64.c,v
retrieving revision 1.37
diff -u -p -r1.37 elf64-x86-64.c
--- elf64-x86-64.c	2002/02/22 10:03:03	1.37
+++ elf64-x86-64.c	2002/03/28 01:50:57
@@ -1075,10 +1075,12 @@ allocate_dynrelocs (h, inf)
   struct elf64_x86_64_link_hash_entry *eh;
   struct elf64_x86_64_dyn_relocs *p;
 
-  if (h->root.type == bfd_link_hash_indirect
-      || h->root.type == bfd_link_hash_warning)
+  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 = elf64_x86_64_hash_table (info);
 
@@ -1244,6 +1246,9 @@ readonly_dynrelocs (h, inf)
 {
   struct elf64_x86_64_link_hash_entry *eh;
   struct elf64_x86_64_dyn_relocs *p;
+
+  if (h->root.type == bfd_link_hash_warning)
+    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
   eh = (struct elf64_x86_64_link_hash_entry *) h;
   for (p = eh->dyn_relocs; p != NULL; p = p->next)
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.23
diff -u -p -r1.23 elflink.c
--- elflink.c	2002/01/16 05:50:02	1.23
+++ elflink.c	2002/03/28 01:50:57
@@ -1,5 +1,5 @@
 /* ELF linking support for BFD.
-   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001
+   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
    Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -329,6 +329,9 @@ elf_link_renumber_hash_table_dynsyms (h,
      PTR data;
 {
   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->dynindx != -1)
     h->dynindx = ++(*count);
Index: bfd/elflink.h
===================================================================
RCS file: /cvs/src/src/bfd/elflink.h,v
retrieving revision 1.155
diff -u -p -r1.155 elflink.h
--- elflink.h	2002/03/26 18:13:54	1.155
+++ elflink.h	2002/03/28 01:51:05
@@ -57,8 +57,6 @@ static boolean elf_adjust_dynamic_symbol
   PARAMS ((struct elf_link_hash_entry *, PTR));
 static boolean elf_link_find_version_dependencies
   PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean elf_link_find_version_dependencies
-  PARAMS ((struct elf_link_hash_entry *, PTR));
 static boolean elf_link_assign_sym_version
   PARAMS ((struct elf_link_hash_entry *, PTR));
 static boolean elf_collect_hash_codes
@@ -3687,6 +3685,9 @@ elf_adjust_dynstr_offsets (h, data)
 {
   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;
@@ -3966,6 +3967,17 @@ elf_adjust_dynamic_symbol (h, data)
   bfd *dynobj;
   struct elf_backend_data *bed;
 
+  if (h->root.type == bfd_link_hash_warning)
+    {
+      h->plt.offset = (bfd_vma) -1;
+      h->got.offset = (bfd_vma) -1;
+
+      /* 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;
@@ -4082,6 +4094,9 @@ elf_export_symbol (h, data)
   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->dynindx == -1
       && (h->elf_link_hash_flags
 	  & (ELF_LINK_HASH_DEF_REGULAR | ELF_LINK_HASH_REF_REGULAR)) != 0)
@@ -4139,6 +4154,9 @@ elf_link_find_version_dependencies (h, d
   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->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
@@ -4219,6 +4237,9 @@ elf_link_assign_sym_version (h, data)
   sinfo = (struct elf_assign_sym_version_info *) 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;
@@ -5929,6 +5950,9 @@ elf_link_sec_merge_syms (h, data)
 {
   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)
@@ -5964,6 +5988,13 @@ elf_link_output_extsym (h, data)
   Elf_Internal_Sym sym;
   asection *input_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_new)
+	return true;
+    }
+
   /* Decide whether to output this symbol in this pass.  */
   if (eoinfo->localsyms)
     {
@@ -6041,6 +6072,7 @@ elf_link_output_extsym (h, data)
     {
     default:
     case bfd_link_hash_new:
+    case bfd_link_hash_warning:
       abort ();
       return false;
 
@@ -6101,16 +6134,6 @@ elf_link_output_extsym (h, data)
 	 foo which points to foo@@GNU_1.2.  We ignore these symbols,
 	 since the indirected symbol is already in the hash table.  */
       return true;
-
-    case bfd_link_hash_warning:
-      /* We can't represent these symbols in ELF, although a warning
-	 symbol may have come from a .gnu.warning.SYMBOL section.  We
-	 just put the target symbol in the hash table.  If the target
-	 symbol does not really exist, don't do anything.  */
-      if (h->root.u.i.link->type == bfd_link_hash_new)
-	return true;
-      return (elf_link_output_extsym
-	      ((struct elf_link_hash_entry *) h->root.u.i.link, data));
     }
 
   /* Give the processor backend a chance to tweak the symbol value,
@@ -7677,6 +7700,9 @@ elf_gc_sweep_symbol (h, idxptr)
 {
   int *idx = (int *) idxptr;
 
+  if (h->root.type == bfd_link_hash_warning)
+    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
   if (h->dynindx != -1
       && ((h->root.type != bfd_link_hash_defined
 	   && h->root.type != bfd_link_hash_defweak)
@@ -7694,6 +7720,9 @@ elf_gc_propagate_vtable_entries_used (h,
      struct elf_link_hash_entry *h;
      PTR 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_parent == NULL)
     return true;
@@ -7756,6 +7785,9 @@ elf_gc_smash_unused_vtentry_relocs (h, o
   struct elf_backend_data *bed;
   int 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_parent == NULL)
@@ -8043,6 +8075,9 @@ elf_gc_allocate_got_offsets (h, offarg)
 {
   bfd_vma *off = (bfd_vma *) offarg;
 
+  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 = off[0];
@@ -8082,6 +8117,9 @@ elf_collect_hash_codes (h, data)
   char *p;
   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)
Index: bfd/elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.45
diff -u -p -r1.45 elfxx-ia64.c
--- elfxx-ia64.c	2002/03/04 20:41:55	1.45
+++ elfxx-ia64.c	2002/03/28 01:51:08
@@ -1710,6 +1710,9 @@ elfNN_ia64_global_dyn_sym_thunk (xentry,
     = (struct elfNN_ia64_dyn_sym_traverse_data *) xdata;
   struct elfNN_ia64_dyn_sym_info *dyn_i;
 
+  if (entry->root.root.type == bfd_link_hash_warning)
+    entry = (struct elfNN_ia64_link_hash_entry *) entry->root.root.u.i.link;
+
   for (dyn_i = entry->info; dyn_i; dyn_i = dyn_i->next)
     if (! (*data->func) (dyn_i, data->data))
       return false;
Index: bfd/i386linux.c
===================================================================
RCS file: /cvs/src/src/bfd/i386linux.c,v
retrieving revision 1.5
diff -u -p -r1.5 i386linux.c
--- i386linux.c	2001/10/02 05:58:41	1.5
+++ i386linux.c	2002/03/28 01:51:08
@@ -1,5 +1,5 @@
 /* BFD back-end for linux flavored i386 a.out binaries.
-   Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001
+   Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001, 2002
    Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -437,6 +437,9 @@ linux_tally_symbols (h, data)
   int is_plt;
   struct linux_link_hash_entry *h1, *h2;
   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
       && strncmp (h->root.root.root.string, NEEDS_SHRLIB,
Index: bfd/linker.c
===================================================================
RCS file: /cvs/src/src/bfd/linker.c,v
retrieving revision 1.19
diff -u -p -r1.19 linker.c
--- linker.c	2002/02/15 02:10:34	1.19
+++ linker.c	2002/03/28 01:51:11
@@ -1419,7 +1419,7 @@ static const enum link_action link_actio
   /* DEFW_ROW 	*/  {DEFW,  DEFW,  DEFW,  NOACT, NOACT, NOACT, NOACT, CYCLE },
   /* COMMON_ROW	*/  {COM,   COM,   COM,   CREF,  COM,   BIG,   REFC,  WARNC },
   /* INDR_ROW	*/  {IND,   IND,   IND,   MDEF,  IND,   CIND,  MIND,  CYCLE },
-  /* WARN_ROW   */  {MWARN, WARN,  WARN,  CWARN, CWARN, WARN,  CWARN, MWARN },
+  /* WARN_ROW   */  {MWARN, WARN,  WARN,  CWARN, CWARN, WARN,  CWARN, NOACT },
   /* SET_ROW	*/  {SET,   SET,   SET,   SET,   SET,   SET,   CYCLE, CYCLE }
 };
 
@@ -2455,6 +2455,9 @@ _bfd_generic_link_write_global_symbol (h
   struct generic_write_global_symbol_info *wginfo =
     (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;
Index: bfd/m68klinux.c
===================================================================
RCS file: /cvs/src/src/bfd/m68klinux.c,v
retrieving revision 1.7
diff -u -p -r1.7 m68klinux.c
--- m68klinux.c	2001/10/02 05:58:41	1.7
+++ m68klinux.c	2002/03/28 01:51:12
@@ -1,5 +1,5 @@
 /* BFD back-end for linux flavored m68k a.out binaries.
-   Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001
+   Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002
    Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -441,6 +441,9 @@ linux_tally_symbols (h, data)
   int is_plt;
   struct linux_link_hash_entry *h1, *h2;
   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
       && strncmp (h->root.root.root.string, NEEDS_SHRLIB,
Index: bfd/pdp11.c
===================================================================
RCS file: /cvs/src/src/bfd/pdp11.c,v
retrieving revision 1.11
diff -u -p -r1.11 pdp11.c
--- pdp11.c	2001/10/17 12:01:05	1.11
+++ pdp11.c	2002/03/28 01:51:15
@@ -1,5 +1,5 @@
 /* BFD back-end for PDP-11 a.out binaries.
-   Copyright 2001 Free Software Foundation, Inc.
+   Copyright 2001, 2002 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -4304,6 +4304,13 @@ aout_link_write_other_symbol (h, data)
   struct external_nlist outsym;
   bfd_size_type indx;
   bfd_size_type amt;
+
+  if (h->root.type == bfd_link_hash_warning)
+    {
+      h = (struct aout_link_hash_entry *) h->root.u.i.link;
+      if (h->root.type == bfd_link_hash_new)
+	return true;
+    }
 
   output_bfd = finfo->output_bfd;
 
Index: bfd/sparclinux.c
===================================================================
RCS file: /cvs/src/src/bfd/sparclinux.c,v
retrieving revision 1.6
diff -u -p -r1.6 sparclinux.c
--- sparclinux.c	2001/10/02 05:58:41	1.6
+++ sparclinux.c	2002/03/28 01:51:16
@@ -1,5 +1,5 @@
 /* BFD back-end for linux flavored sparc a.out binaries.
-   Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001
+   Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002
    Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -438,6 +438,9 @@ linux_tally_symbols (h, data)
   int is_plt;
   struct linux_link_hash_entry *h1, *h2;
   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
       && strncmp (h->root.root.root.string, NEEDS_SHRLIB,
Index: bfd/sunos.c
===================================================================
RCS file: /cvs/src/src/bfd/sunos.c,v
retrieving revision 1.7
diff -u -p -r1.7 sunos.c
--- sunos.c	2002/01/05 13:11:31	1.7
+++ sunos.c	2002/03/28 01:51:17
@@ -2052,6 +2052,9 @@ sunos_scan_dynamic_symbol (h, data)
 {
   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/xcofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/xcofflink.c,v
retrieving revision 1.21
diff -u -p -r1.21 xcofflink.c
--- xcofflink.c	2002/03/20 12:03:27	1.21
+++ xcofflink.c	2002/03/28 01:51:22
@@ -3253,6 +3253,9 @@ xcoff_build_ldsyms (h, p)
   struct xcoff_loader_info *ldinfo = (struct xcoff_loader_info *) p;
   bfd_size_type amt;
 
+  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;
@@ -5373,6 +5376,13 @@ xcoff_write_global_symbol (h, inf)
 
   output_bfd = finfo->output_bfd;
   outsym = finfo->outsyms;
+
+  if (h->root.type == bfd_link_hash_warning)
+    {
+      h = (struct xcoff_link_hash_entry *) h->root.u.i.link;
+      if (h->root.type == bfd_link_hash_new)
+	return true;
+    }
 
   /* If this symbol was garbage collected, just skip it.  */
   if (xcoff_hash_table (finfo->info)->gc



More information about the Binutils mailing list