]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* elf-bfd.h (struct elf_backend_data): Add struct elf_backend_data
authorAlan Modra <amodra@gmail.com>
Thu, 22 Aug 2002 01:27:20 +0000 (01:27 +0000)
committerAlan Modra <amodra@gmail.com>
Thu, 22 Aug 2002 01:27:20 +0000 (01:27 +0000)
param to elf_backend_copy_indirect_symbol.
(_bfd_elf_link_hash_copy_indirect): Likewise.
* elflink.h (elf_add_default_symbol, elf_fix_symbol_flags): Adjust
calls to copy_indirect_symbol.
* elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Likewise.
* elf32-i386.c (elf_i386_copy_indirect_symbol): Likewise.
* elf32-s390.c (elf_s390_copy_indirect_symbol): Likewise.
* elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise.
* elf64-s390.c (elf_s390_copy_indirect_symbol): Likewise.
* elf64-x86-64.c (elf64_x86_64_copy_indirect_symbol): Likewise.
* elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise.
* elfxx-mips.c (_bfd_mips_elf_copy_indirect_symbol): Likewise.
* elfxx-mips.h (_bfd_mips_elf_copy_indirect_symbol): Likewise.
* elf.c (_bfd_elf_link_hash_copy_indirect): Likewise.  Properly
test refcounts for "used" values.

13 files changed:
bfd/ChangeLog
bfd/elf-bfd.h
bfd/elf.c
bfd/elf32-hppa.c
bfd/elf32-i386.c
bfd/elf32-s390.c
bfd/elf64-ppc.c
bfd/elf64-s390.c
bfd/elf64-x86-64.c
bfd/elflink.h
bfd/elfxx-ia64.c
bfd/elfxx-mips.c
bfd/elfxx-mips.h

index 528f5c52d8ef4285061d81d0a2f67162e44e25bc..7bbdb91e5c723101ff2d27db7acc98b842a76f21 100644 (file)
@@ -1,3 +1,22 @@
+2002-08-22  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf-bfd.h (struct elf_backend_data): Add struct elf_backend_data
+       param to elf_backend_copy_indirect_symbol.
+       (_bfd_elf_link_hash_copy_indirect): Likewise.
+       * elflink.h (elf_add_default_symbol, elf_fix_symbol_flags): Adjust
+       calls to copy_indirect_symbol.
+       * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Likewise.
+       * elf32-i386.c (elf_i386_copy_indirect_symbol): Likewise.
+       * elf32-s390.c (elf_s390_copy_indirect_symbol): Likewise.
+       * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise.
+       * elf64-s390.c (elf_s390_copy_indirect_symbol): Likewise.
+       * elf64-x86-64.c (elf64_x86_64_copy_indirect_symbol): Likewise.
+       * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise.
+       * elfxx-mips.c (_bfd_mips_elf_copy_indirect_symbol): Likewise.
+       * elfxx-mips.h (_bfd_mips_elf_copy_indirect_symbol): Likewise.
+       * elf.c (_bfd_elf_link_hash_copy_indirect): Likewise.  Properly
+       test refcounts for "used" values.
+
 2002-08-21  John David Anglin  <dave@hiauly1.hia.nrc.ca>
 
        * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Add PARAMS to
index 8a7fff13b72b00a86cab700ec0c438983d11a844..dcccc482f88b523ff3dbe28a22ffdb6ab4b87c47 100644 (file)
@@ -717,7 +717,8 @@ struct elf_backend_data
      newly created and plt/got refcounts and dynamic indices should not
      be copied.  */
   void (*elf_backend_copy_indirect_symbol)
-    PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
+    PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
+            struct elf_link_hash_entry *));
 
   /* Modify any information related to dynamic linking such that the
      symbol is not exported.  */
@@ -1271,7 +1272,8 @@ extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
 extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
   PARAMS ((bfd *));
 extern void _bfd_elf_link_hash_copy_indirect
-  PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
+  PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
+          struct elf_link_hash_entry *));
 extern void _bfd_elf_link_hash_hide_symbol
   PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
 extern boolean _bfd_elf_link_hash_table_init
index a9db43bb82d07d5cb9d539e6f14aa66233f3c3a7..71763d41befce52a8bcd4aff828f22f580532cec 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1418,10 +1418,12 @@ _bfd_elf_link_hash_newfunc (entry, table, string)
    old indirect symbol.  Also used for copying flags to a weakdef.  */
 
 void
-_bfd_elf_link_hash_copy_indirect (dir, ind)
+_bfd_elf_link_hash_copy_indirect (bed, dir, ind)
+     struct elf_backend_data *bed;
      struct elf_link_hash_entry *dir, *ind;
 {
   bfd_signed_vma tmp;
+  bfd_signed_vma lowest_valid = bed->can_refcount;
 
   /* Copy down any references that we may have already seen to the
      symbol which just became indirect.  */
@@ -1439,22 +1441,22 @@ _bfd_elf_link_hash_copy_indirect (dir, ind)
   /* Copy over the global and procedure linkage table refcount entries.
      These may have been already set up by a check_relocs routine.  */
   tmp = dir->got.refcount;
-  if (tmp <= 0)
+  if (tmp < lowest_valid)
     {
       dir->got.refcount = ind->got.refcount;
       ind->got.refcount = tmp;
     }
   else
-    BFD_ASSERT (ind->got.refcount <= 0);
+    BFD_ASSERT (ind->got.refcount < lowest_valid);
 
   tmp = dir->plt.refcount;
-  if (tmp <= 0)
+  if (tmp < lowest_valid)
     {
       dir->plt.refcount = ind->plt.refcount;
       ind->plt.refcount = tmp;
     }
   else
-    BFD_ASSERT (ind->plt.refcount <= 0);
+    BFD_ASSERT (ind->plt.refcount < lowest_valid);
 
   if (dir->dynindx == -1)
     {
index ca62709872e868bad597f2df1c69ca467bfd8681..35e6f32f6ac70c162b3ff56cfbbf6e7e69e6a84e 100644 (file)
@@ -327,7 +327,8 @@ static boolean elf32_hppa_create_dynamic_sections
   PARAMS ((bfd *, struct bfd_link_info *));
 
 static void elf32_hppa_copy_indirect_symbol
-  PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
+  PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
+          struct elf_link_hash_entry *));
 
 static boolean elf32_hppa_check_relocs
   PARAMS ((bfd *, struct bfd_link_info *,
@@ -1145,7 +1146,8 @@ elf32_hppa_create_dynamic_sections (abfd, info)
 /* Copy the extra info we tack onto an elf_link_hash_entry.  */
 
 static void
-elf32_hppa_copy_indirect_symbol (dir, ind)
+elf32_hppa_copy_indirect_symbol (bed, dir, ind)
+     struct elf_backend_data *bed;
      struct elf_link_hash_entry *dir, *ind;
 {
   struct elf32_hppa_link_hash_entry *edir, *eind;
@@ -1189,7 +1191,7 @@ elf32_hppa_copy_indirect_symbol (dir, ind)
       eind->dyn_relocs = NULL;
     }
 
-  _bfd_elf_link_hash_copy_indirect (dir, ind);
+  _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
 }
 
 /* Look through the relocs for a section during the first phase, and
index 5c0d5a1ceab7cf67c0999549ae6f8e441f152842..edf06de43e0d8d9b11db73ebc485a6677b8bf218 100644 (file)
@@ -45,7 +45,8 @@ static boolean create_got_section
 static boolean elf_i386_create_dynamic_sections
   PARAMS((bfd *, struct bfd_link_info *));
 static void elf_i386_copy_indirect_symbol
-  PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
+  PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
+          struct elf_link_hash_entry *));
 static int elf_i386_tls_transition
   PARAMS ((struct bfd_link_info *, int, int));
 
@@ -767,7 +768,8 @@ elf_i386_create_dynamic_sections (dynobj, info)
 /* Copy the extra info we tack onto an elf_link_hash_entry.  */
 
 static void
-elf_i386_copy_indirect_symbol (dir, ind)
+elf_i386_copy_indirect_symbol (bed, dir, ind)
+     struct elf_backend_data *bed;
      struct elf_link_hash_entry *dir, *ind;
 {
   struct elf_i386_link_hash_entry *edir, *eind;
@@ -815,7 +817,7 @@ elf_i386_copy_indirect_symbol (dir, ind)
       edir->tls_type = eind->tls_type;
       eind->tls_type = GOT_UNKNOWN;
     }
-  _bfd_elf_link_hash_copy_indirect (dir, ind);
+  _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
 }
 
 static int
index 8067018dd890b1d7f3b7eeadb5b8d3beb3a7530b..bbc2ead947664b848e7c4b10e9631cb10dc43da6 100644 (file)
@@ -40,7 +40,8 @@ static boolean create_got_section
 static boolean elf_s390_create_dynamic_sections
   PARAMS((bfd *, struct bfd_link_info *));
 static void elf_s390_copy_indirect_symbol
-  PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
+  PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
+          struct elf_link_hash_entry *));
 static boolean elf_s390_check_relocs
   PARAMS ((bfd *, struct bfd_link_info *, asection *,
           const Elf_Internal_Rela *));
@@ -562,7 +563,8 @@ elf_s390_create_dynamic_sections (dynobj, info)
 /* Copy the extra info we tack onto an elf_link_hash_entry.  */
 
 static void
-elf_s390_copy_indirect_symbol (dir, ind)
+elf_s390_copy_indirect_symbol (bed, dir, ind)
+     struct elf_backend_data *bed;
      struct elf_link_hash_entry *dir, *ind;
 {
   struct elf_s390_link_hash_entry *edir, *eind;
@@ -604,7 +606,7 @@ elf_s390_copy_indirect_symbol (dir, ind)
       eind->dyn_relocs = NULL;
     }
 
-  _bfd_elf_link_hash_copy_indirect (dir, ind);
+  _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
 }
 
 /* Look through the relocs for a section during the first phase, and
index 616fbd496afc41f0b9688dec116098fe46501469..d9f86260b49cd110912b8d67874c97832ab103f1 100644 (file)
@@ -1952,7 +1952,8 @@ static boolean create_got_section
 static boolean ppc64_elf_create_dynamic_sections
   PARAMS ((bfd *, struct bfd_link_info *));
 static void ppc64_elf_copy_indirect_symbol
-  PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
+  PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
+          struct elf_link_hash_entry *));
 static boolean ppc64_elf_check_relocs
   PARAMS ((bfd *, struct bfd_link_info *, asection *,
           const Elf_Internal_Rela *));
@@ -2440,7 +2441,8 @@ ppc64_elf_create_dynamic_sections (dynobj, info)
 /* Copy the extra info we tack onto an elf_link_hash_entry.  */
 
 static void
-ppc64_elf_copy_indirect_symbol (dir, ind)
+ppc64_elf_copy_indirect_symbol (bed, dir, ind)
+     struct elf_backend_data *bed;
      struct elf_link_hash_entry *dir, *ind;
 {
   struct ppc_link_hash_entry *edir, *eind;
@@ -2486,7 +2488,7 @@ ppc64_elf_copy_indirect_symbol (dir, ind)
   edir->is_func_descriptor |= eind->is_func_descriptor;
   edir->is_entry |= eind->is_entry;
 
-  _bfd_elf_link_hash_copy_indirect (dir, ind);
+  _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
 }
 
 /* Set a flag, used by ppc64_elf_gc_mark_hook, on the entry symbol and
index 5f2a16e2143703c8037ae220c7bce29e69c3a32b..296e349320070c6aa2130652c29cd0a7da2159e2 100644 (file)
@@ -40,7 +40,8 @@ static boolean create_got_section
 static boolean elf_s390_create_dynamic_sections
   PARAMS((bfd *, struct bfd_link_info *));
 static void elf_s390_copy_indirect_symbol
-  PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
+  PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
+          struct elf_link_hash_entry *));
 static boolean elf_s390_check_relocs
   PARAMS ((bfd *, struct bfd_link_info *, asection *,
           const Elf_Internal_Rela *));
@@ -508,7 +509,8 @@ elf_s390_create_dynamic_sections (dynobj, info)
 /* Copy the extra info we tack onto an elf_link_hash_entry.  */
 
 static void
-elf_s390_copy_indirect_symbol (dir, ind)
+elf_s390_copy_indirect_symbol (bed, dir, ind)
+     struct elf_backend_data *bed;
      struct elf_link_hash_entry *dir, *ind;
 {
   struct elf_s390_link_hash_entry *edir, *eind;
@@ -550,7 +552,7 @@ elf_s390_copy_indirect_symbol (dir, ind)
       eind->dyn_relocs = NULL;
     }
 
-  _bfd_elf_link_hash_copy_indirect (dir, ind);
+  _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
 }
 
 /* Look through the relocs for a section during the first phase, and
index b6cce8eef991a0120f5372e1ac626efe2f84f814..9c4a9d4ec18a5ccaa0feef9f7a9814f4ece1e35c 100644 (file)
@@ -134,7 +134,8 @@ static boolean create_got_section
 static boolean elf64_x86_64_create_dynamic_sections
   PARAMS((bfd *, struct bfd_link_info *));
 static void elf64_x86_64_copy_indirect_symbol
-  PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
+  PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
+          struct elf_link_hash_entry *));
 static boolean elf64_x86_64_check_relocs
   PARAMS ((bfd *, struct bfd_link_info *, asection *sec,
           const Elf_Internal_Rela *));
@@ -494,7 +495,8 @@ elf64_x86_64_create_dynamic_sections (dynobj, info)
 /* Copy the extra info we tack onto an elf_link_hash_entry.  */
 
 static void
-elf64_x86_64_copy_indirect_symbol (dir, ind)
+elf64_x86_64_copy_indirect_symbol (bed, dir, ind)
+     struct elf_backend_data *bed;
      struct elf_link_hash_entry *dir, *ind;
 {
   struct elf64_x86_64_link_hash_entry *edir, *eind;
@@ -536,7 +538,7 @@ elf64_x86_64_copy_indirect_symbol (dir, ind)
       eind->dyn_relocs = NULL;
     }
 
-  _bfd_elf_link_hash_copy_indirect (dir, ind);
+  _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
 }
 
 static boolean
index 480bd1786afacbd3869cbd30a273d847974cd6cb..638f80af266ef32aa374fbd5d450a52a70f703f3 100644 (file)
@@ -1044,7 +1044,7 @@ elf_add_default_symbol (abfd, info, h, name, sym, psec, value,
                      | ELF_LINK_HASH_DEF_REGULAR)) == 0);
 
       ht = (struct elf_link_hash_entry *) hi->root.u.i.link;
-      (*bed->elf_backend_copy_indirect_symbol) (ht, hi);
+      (*bed->elf_backend_copy_indirect_symbol) (bed, ht, hi);
 
       /* See if the new flags lead us to realize that the symbol must
         be dynamic.  */
@@ -1116,7 +1116,7 @@ elf_add_default_symbol (abfd, info, h, name, sym, psec, value,
                       & (ELF_LINK_HASH_DEF_DYNAMIC
                          | ELF_LINK_HASH_DEF_REGULAR)) == 0);
 
-         (*bed->elf_backend_copy_indirect_symbol) (h, hi);
+         (*bed->elf_backend_copy_indirect_symbol) (bed, h, hi);
 
          /* See if the new flags lead us to realize that the symbol
             must be dynamic.  */
@@ -3903,7 +3903,7 @@ elf_fix_symbol_flags (h, eif)
          struct elf_backend_data *bed;
 
          bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj);
-         (*bed->elf_backend_copy_indirect_symbol) (weakdef, h);
+         (*bed->elf_backend_copy_indirect_symbol) (bed, weakdef, h);
        }
     }
 
index 4de90dffc424cc7684d04f440ad1354d1760e95f..dca8b45cd34d738a383f5ecfce9b6be989b5b9d5 100644 (file)
@@ -207,7 +207,8 @@ static struct bfd_hash_entry *elfNN_ia64_new_elf_hash_entry
   PARAMS ((struct bfd_hash_entry *entry, struct bfd_hash_table *table,
           const char *string));
 static void elfNN_ia64_hash_copy_indirect
-  PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
+  PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
+          struct elf_link_hash_entry *));
 static void elfNN_ia64_hash_hide_symbol
   PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
 static struct bfd_link_hash_table *elfNN_ia64_hash_table_create
@@ -1602,7 +1603,8 @@ elfNN_ia64_new_elf_hash_entry (entry, table, string)
 }
 
 static void
-elfNN_ia64_hash_copy_indirect (xdir, xind)
+elfNN_ia64_hash_copy_indirect (bed, xdir, xind)
+     struct elf_backend_data *bed ATTRIBUTE_UNUSED;
      struct elf_link_hash_entry *xdir, *xind;
 {
   struct elfNN_ia64_link_hash_entry *dir, *ind;
index 6eab7f924c3bc53fb8c828a4a65a20a2cd87ab86..51326934ffd67b82c6d87d5b2738eca7b27eeb1b 100644 (file)
@@ -6369,12 +6369,13 @@ _bfd_mips_elf_gc_sweep_hook (abfd, info, sec, relocs)
    _bfd_elf_link_hash_copy_indirect copy the flags for us.  */
 
 void
-_bfd_mips_elf_copy_indirect_symbol (dir, ind)
+_bfd_mips_elf_copy_indirect_symbol (bed, dir, ind)
+     struct elf_backend_data *bed;
      struct elf_link_hash_entry *dir, *ind;
 {
   struct mips_elf_link_hash_entry *dirmips, *indmips;
 
-  _bfd_elf_link_hash_copy_indirect (dir, ind);
+  _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
 
   if (ind->root.type != bfd_link_hash_indirect)
     return;
index 2bdaacc20160fe33024712197b6f6521bdfde3a9..2c8ac2f2fb4afedf9472aa8ec48c2a8ad7d8470b 100644 (file)
@@ -68,7 +68,8 @@ extern boolean _bfd_mips_elf_gc_sweep_hook
   PARAMS ((bfd *, struct bfd_link_info *, asection *,
           const Elf_Internal_Rela *));
 extern void _bfd_mips_elf_copy_indirect_symbol
-  PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
+  PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
+          struct elf_link_hash_entry *));
 extern void _bfd_mips_elf_hide_symbol
   PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
 extern boolean _bfd_mips_elf_ignore_discarded_relocs