]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Pass cookie and symndx to gc_mark_hook
authorAlan Modra <amodra@gmail.com>
Thu, 30 Oct 2025 05:56:27 +0000 (16:26 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 30 Oct 2025 05:56:27 +0000 (16:26 +1030)
Replace the "sym" param with "cookie" and "symndx".  This is in
preparation for the next patch.  Also remove "rel" param since this is
available via "cookie", and is always set from cookie->rel.

PR 33530
* elf-m10300.c (mn10300_elf_gc_mark_hook): Replace "rel" and "sym"
params with "cookie" and "symndx".  Adjust to suit.
* elf32-arm.c (elf32_arm_gc_mark_hook): Likewise.
* elf32-bfin.c (bfin_gc_mark_hook): Likewise.
* elf32-cris.c (cris_elf_gc_mark_hook): Likewise.
* elf32-csky.c (csky_elf_gc_mark_hook): Likewise.
* elf32-d10v.c (elf32_d10v_gc_mark_hook): Likewise.
* elf32-fr30.c (fr30_elf_gc_mark_hook): Likewise.
* elf32-frv.c (elf32_frv_gc_mark_hook): Likewise.
* elf32-hppa.c (elf32_hppa_gc_mark_hook): Likewise.
* elf32-iq2000.c (iq2000_elf_gc_mark_hook): Likewise.
* elf32-lm32.c (lm32_elf_gc_mark_hook): Likewise.
* elf32-m32r.c (m32r_elf_gc_mark_hook): Likewise.
* elf32-m68k.c (elf_m68k_gc_mark_hook): Likewise.
* elf32-mcore.c (mcore_elf_gc_mark_hook): Likewise.
* elf32-metag.c (elf_metag_gc_mark_hook): Likewise.
* elf32-microblaze.c (microblaze_elf_gc_mark_hook): Likewise.
* elf32-nds32.c (nds32_elf_gc_mark_hook): Likewise.
* elf32-or1k.c (or1k_elf_gc_mark_hook): Likewise.
* elf32-ppc.c (ppc_elf_gc_mark_hook): Likewise.
* elf32-s390.c (elf_s390_gc_mark_hook): Likewise.
* elf32-score.c (s3_bfd_score_elf_gc_mark_hook): Likewise.
(_bfd_score_elf_gc_mark_hook): Likewise.
* elf32-score7.c (s7_bfd_score_elf_gc_mark_hook): Likewise.
* elf32-sh.c (sh_elf_gc_mark_hook): Likewise.
* elf32-tilepro.c (tilepro_elf_gc_mark_hook): Likewise.
* elf32-v850.c (v850_elf_gc_mark_hook): Likewise.
* elf32-vax.c (elf_vax_gc_mark_hook): Likewise.
* elf32-visium.c (visium_elf_gc_mark_hook): Likewise.
* elf32-xstormy16.c (xstormy16_elf_gc_mark_hook): Likewise.
* elf32-xtensa.c (elf_xtensa_gc_mark_hook): Likewise.
* elf64-alpha.c (elf64_alpha_gc_mark_hook): Likewise.
* elf64-mmix.c (mmix_elf_gc_mark_hook): Likewise.
* elf64-ppc.c (ppc64_elf_gc_mark_hook): Likewise.
* elf64-s390.c (elf_s390_gc_mark_hook): Likewise.
* elfnn-loongarch.c (loongarch_elf_gc_mark_hook): Likewise.
* elfxx-mips.c (_bfd_mips_elf_gc_mark_hook): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_gc_mark_hook): Likewise.
* elfxx-tilegx.c (tilegx_elf_gc_mark_hook): Likewise.
* elfxx-x86.c (_bfd_x86_elf_gc_mark_hook): Likewise.
* elflink.c (_bfd_elf_gc_mark_hook): Likewise.
(elf_gc_mark_debug_section): Likewise.
(_bfd_elf_gc_mark_rsec): Adjust gc_mark_hook calls.
* elf32-cr16.c (elf32_cr16_gc_mark_hook): Delete.
(elf_backend_gc_mark_hook): Don't define.
* elf32-moxie.c (moxie_elf_gc_mark_hook): Delete.
(elf_backend_gc_mark_hook): Don't define.
* elf-bfd.h (elf_gc_mark_hook_fn, _bfd_elf_gc_mark_hook): Update
declarations.
* elf32-score.h (s7_bfd_score_elf_gc_mark_hook): Likewise.
* elfxx-mips.h (_bfd_mips_elf_gc_mark_hook): Likewise.
* elfxx-sparc.h (_bfd_sparc_elf_gc_mark_hook): Likewise.
* elfxx-tilegx.h (tilegx_elf_gc_mark_hook): Likewise.
* elfxx-x86.h (_bfd_x86_elf_gc_mark_hook): Likewise.

47 files changed:
bfd/elf-bfd.h
bfd/elf-m10300.c
bfd/elf32-arm.c
bfd/elf32-bfin.c
bfd/elf32-cr16.c
bfd/elf32-cris.c
bfd/elf32-csky.c
bfd/elf32-d10v.c
bfd/elf32-fr30.c
bfd/elf32-frv.c
bfd/elf32-hppa.c
bfd/elf32-iq2000.c
bfd/elf32-lm32.c
bfd/elf32-m32r.c
bfd/elf32-m68k.c
bfd/elf32-mcore.c
bfd/elf32-metag.c
bfd/elf32-microblaze.c
bfd/elf32-moxie.c
bfd/elf32-nds32.c
bfd/elf32-or1k.c
bfd/elf32-ppc.c
bfd/elf32-s390.c
bfd/elf32-score.c
bfd/elf32-score.h
bfd/elf32-score7.c
bfd/elf32-sh.c
bfd/elf32-tilepro.c
bfd/elf32-v850.c
bfd/elf32-vax.c
bfd/elf32-visium.c
bfd/elf32-xstormy16.c
bfd/elf32-xtensa.c
bfd/elf64-alpha.c
bfd/elf64-mmix.c
bfd/elf64-ppc.c
bfd/elf64-s390.c
bfd/elflink.c
bfd/elfnn-loongarch.c
bfd/elfxx-mips.c
bfd/elfxx-mips.h
bfd/elfxx-sparc.c
bfd/elfxx-sparc.h
bfd/elfxx-tilegx.c
bfd/elfxx-tilegx.h
bfd/elfxx-x86.c
bfd/elfxx-x86.h

index 850a86fda253873e6f908bf6b7d5064b739d2f68..05d4baac23c430ec5c1974cf365fb9a7d7e0cd49 100644 (file)
@@ -940,8 +940,8 @@ enum action_discarded
   };
 
 typedef asection * (*elf_gc_mark_hook_fn)
-  (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
-   struct elf_link_hash_entry *, Elf_Internal_Sym *);
+  (asection *, struct bfd_link_info *, struct elf_reloc_cookie *,
+   struct elf_link_hash_entry *, unsigned int);
 
 enum elf_property_kind
  {
@@ -2827,8 +2827,8 @@ extern bool bfd_elf_gc_record_vtentry
   (bfd *, asection *, struct elf_link_hash_entry *, bfd_vma);
 
 extern asection *_bfd_elf_gc_mark_hook
-  (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
-   struct elf_link_hash_entry *, Elf_Internal_Sym *);
+  (asection *, struct bfd_link_info *, struct elf_reloc_cookie *,
+   struct elf_link_hash_entry *, unsigned int);
 
 extern asection *_bfd_elf_gc_mark_rsec
   (struct bfd_link_info *, asection *, elf_gc_mark_hook_fn,
index 9a6870877f19b8492bcdb5b15b0846ee4f370199..b5babd239910856ebc7c01139083c838d7aa9b92 100644 (file)
@@ -1385,19 +1385,19 @@ mn10300_elf_check_relocs (bfd *abfd,
 static asection *
 mn10300_elf_gc_mark_hook (asection *sec,
                          struct bfd_link_info *info,
-                         Elf_Internal_Rela *rel,
+                         struct elf_reloc_cookie *cookie,
                          struct elf_link_hash_entry *h,
-                         Elf_Internal_Sym *sym)
+                         unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_MN10300_GNU_VTINHERIT:
       case R_MN10300_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Perform a relocation as part of a final link.  */
index ae3dc246be0ee8c51fb42958d846eb5e4feb136a..4e968077b3e15aa83d56128055890faf62a9843c 100644 (file)
@@ -15217,19 +15217,19 @@ elf32_arm_get_symbol_type (Elf_Internal_Sym * elf_sym, int type)
 static asection *
 elf32_arm_gc_mark_hook (asection *sec,
                        struct bfd_link_info *info,
-                       Elf_Internal_Rela *rel,
+                       struct elf_reloc_cookie *cookie,
                        struct elf_link_hash_entry *h,
-                       Elf_Internal_Sym *sym)
+                       unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_ARM_GNU_VTINHERIT:
       case R_ARM_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Look through the relocs for a section during the first phase.  */
index 7ed1285f4c2bace4c5ea400822082567d6acd6b7..e5ad4d6ca0a51e729e0bccaf0ad71721ea5e8c95 100644 (file)
@@ -1630,21 +1630,21 @@ bfin_relocate_section (bfd * output_bfd,
 }
 
 static asection *
-bfin_gc_mark_hook (asection * sec,
+bfin_gc_mark_hook (asection *sec,
                   struct bfd_link_info *info,
-                  Elf_Internal_Rela * rel,
+                  struct elf_reloc_cookie *cookie,
                   struct elf_link_hash_entry *h,
-                  Elf_Internal_Sym * sym)
+                  unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_BFIN_GNU_VTINHERIT:
       case R_BFIN_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 \f
 extern const bfd_target bfin_elf32_fdpic_vec;
index 31d1ba41c1710a5b9037400d218f40ed3110702e..df3771bda89d8359535f3e6b73fd7356d69ce8ce 100644 (file)
@@ -2173,16 +2173,6 @@ elf32_cr16_relax_section (bfd *abfd, asection *sec,
   return false;
 }
 
-static asection *
-elf32_cr16_gc_mark_hook (asection *sec,
-                        struct bfd_link_info *info,
-                        Elf_Internal_Rela *rel,
-                        struct elf_link_hash_entry *h,
-                        Elf_Internal_Sym *sym)
-{
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
-}
-
 /* Create dynamic sections when linking against a dynamic object.  */
 
 static bool
@@ -2821,7 +2811,6 @@ _bfd_cr16_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSE
 #define bfd_elf32_bfd_relax_section      elf32_cr16_relax_section
 #define bfd_elf32_bfd_get_relocated_section_contents \
                                elf32_cr16_get_relocated_section_contents
-#define elf_backend_gc_mark_hook         elf32_cr16_gc_mark_hook
 #define elf_backend_can_gc_sections      1
 #define elf_backend_rela_normal                  1
 #define elf_backend_check_relocs         cr16_elf_check_relocs
index faaebb9ebee952355641eaf3ab62ff321bc956f2..77e8201b4a6be89336b509426d761ff418c03a56 100644 (file)
@@ -2439,11 +2439,11 @@ elf_cris_finish_dynamic_sections (bfd *output_bfd,
 static asection *
 cris_elf_gc_mark_hook (asection *sec,
                       struct bfd_link_info *info,
-                      Elf_Internal_Rela *rel,
+                      struct elf_reloc_cookie *cookie,
                       struct elf_link_hash_entry *h,
-                      Elf_Internal_Sym *sym)
+                      unsigned int symndx)
 {
-  enum elf_cris_reloc_type r_type = ELF32_R_TYPE (rel->r_info);
+  enum elf_cris_reloc_type r_type = ELF32_R_TYPE (cookie->rel->r_info);
   if (h != NULL)
     switch (r_type)
       {
@@ -2455,7 +2455,7 @@ cris_elf_gc_mark_hook (asection *sec,
        break;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* The elf_backend_plt_sym_val hook function.  */
index 40781a0e1bbc8625b5b0e727f537ea3efa8e3cff..9ab0f49f43490917d15ea05ce917718c47320d16 100644 (file)
@@ -2412,13 +2412,13 @@ csky_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
 static asection *
 csky_elf_gc_mark_hook (asection *sec,
                       struct bfd_link_info *info,
-                      Elf_Internal_Rela *rel,
+                      struct elf_reloc_cookie *cookie,
                       struct elf_link_hash_entry *h,
-                      Elf_Internal_Sym *sym)
+                      unsigned int symndx)
 {
   if (h != NULL)
     {
-      switch (ELF32_R_TYPE (rel->r_info))
+      switch (ELF32_R_TYPE (cookie->rel->r_info))
        {
        case R_CKCORE_GNU_VTINHERIT:
        case R_CKCORE_GNU_VTENTRY:
@@ -2426,7 +2426,7 @@ csky_elf_gc_mark_hook (asection *sec,
        }
     }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Match symbol names created by tc-csky.c:make_mapping_symbol.  */
index 5474f57a4533dfed196a03e7507c632d5479da12..b2a48c8b2117b44ecae5e9d92b7fbc174cfeb295 100644 (file)
@@ -243,19 +243,19 @@ d10v_info_to_howto_rel (bfd *abfd,
 static asection *
 elf32_d10v_gc_mark_hook (asection *sec,
                         struct bfd_link_info *info,
-                        Elf_Internal_Rela *rel,
+                        struct elf_reloc_cookie *cookie,
                         struct elf_link_hash_entry *h,
-                        Elf_Internal_Sym *sym)
+                        unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_D10V_GNU_VTINHERIT:
       case R_D10V_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Look through the relocs for a section during the first phase.
index d0ca4e893e59e289e5ae8cd5a9e9656440ee136f..3392acd526178673eb131437b65751e407d73fae 100644 (file)
@@ -623,19 +623,19 @@ fr30_elf_relocate_section (bfd *output_bfd,
 static asection *
 fr30_elf_gc_mark_hook (asection *sec,
                       struct bfd_link_info *info,
-                      Elf_Internal_Rela *rel,
+                      struct elf_reloc_cookie *cookie,
                       struct elf_link_hash_entry *h,
-                      Elf_Internal_Sym *sym)
+                      unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_FR30_GNU_VTINHERIT:
       case R_FR30_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Look through the relocs for a section during the first phase.
index b7183133ad1a9ec670c00a37818582de88c90b5d..baeb8ba337814d6643f1863a8d7921385cf4b8e0 100644 (file)
@@ -4082,19 +4082,19 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
 static asection *
 elf32_frv_gc_mark_hook (asection *sec,
                        struct bfd_link_info *info,
-                       Elf_Internal_Rela *rel,
+                       struct elf_reloc_cookie *cookie,
                        struct elf_link_hash_entry *h,
-                       Elf_Internal_Sym *sym)
+                       unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_FRV_GNU_VTINHERIT:
       case R_FRV_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 \f
 /* Hook called by the linker routine which adds symbols from an object
index 2f463e12829aa7b6e0bee60ee246fe2f0045d95b..3a7237dbe7d31a888b0ed49d057912ab0a306360 100644 (file)
@@ -1508,19 +1508,19 @@ elf32_hppa_check_relocs (bfd *abfd,
 static asection *
 elf32_hppa_gc_mark_hook (asection *sec,
                         struct bfd_link_info *info,
-                        Elf_Internal_Rela *rela,
+                        struct elf_reloc_cookie *cookie,
                         struct elf_link_hash_entry *hh,
-                        Elf_Internal_Sym *sym)
+                        unsigned int symndx)
 {
   if (hh != NULL)
-    switch ((unsigned int) ELF32_R_TYPE (rela->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_PARISC_GNU_VTINHERIT:
       case R_PARISC_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rela, hh, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, hh, symndx);
 }
 
 /* Support for core dump NOTE sections.  */
index 11d6e1e347dbb8368f0907269eb19214ea6a3032..d4d7188aa0a7d0af10f6e450704ca48f2e02c82c 100644 (file)
@@ -721,19 +721,19 @@ iq2000_elf_relocate_section (bfd *                     output_bfd ATTRIBUTE_UNUSED,
 static asection *
 iq2000_elf_gc_mark_hook (asection *sec,
                         struct bfd_link_info *info,
-                        Elf_Internal_Rela *rel,
+                        struct elf_reloc_cookie *cookie,
                         struct elf_link_hash_entry *h,
-                        Elf_Internal_Sym *sym)
+                        unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_IQ2000_GNU_VTINHERIT:
       case R_IQ2000_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 \f
index 0ead0df9cf0b7fbc1da2c85f1210763dcb803b21..f8568d76ed1f16785b0c87f6c1d5d9b183795e47 100644 (file)
@@ -1096,19 +1096,19 @@ lm32_elf_relocate_section (bfd *output_bfd,
 static asection *
 lm32_elf_gc_mark_hook (asection *sec,
                       struct bfd_link_info *info,
-                      Elf_Internal_Rela *rel,
+                      struct elf_reloc_cookie *cookie,
                       struct elf_link_hash_entry *h,
-                      Elf_Internal_Sym *sym)
+                      unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_LM32_GNU_VTINHERIT:
       case R_LM32_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Look through the relocs for a section during the first phase.  */
index c51133090b4a6d23bdd4aef5c533201cdf991e83..5444ddaa1270e9047ad2e8310a72043e8a636444 100644 (file)
@@ -3316,12 +3316,12 @@ m32r_elf_print_private_bfd_data (bfd *abfd, void * ptr)
 static asection *
 m32r_elf_gc_mark_hook (asection *sec,
                       struct bfd_link_info *info,
-                      Elf_Internal_Rela *rel,
+                      struct elf_reloc_cookie *cookie,
                       struct elf_link_hash_entry *h,
-                      Elf_Internal_Sym *sym)
+                      unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_M32R_GNU_VTINHERIT:
       case R_M32R_GNU_VTENTRY:
@@ -3330,7 +3330,7 @@ m32r_elf_gc_mark_hook (asection *sec,
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Look through the relocs for a section during the first phase.
index 44ef102ea601bde46efc543a6db47235a33e9a14..b5df42d7488d75e4fd2bb0f1eeef119417ff1996 100644 (file)
@@ -2896,19 +2896,19 @@ elf_m68k_check_relocs (bfd *abfd,
 static asection *
 elf_m68k_gc_mark_hook (asection *sec,
                       struct bfd_link_info *info,
-                      Elf_Internal_Rela *rel,
+                      struct elf_reloc_cookie *cookie,
                       struct elf_link_hash_entry *h,
-                      Elf_Internal_Sym *sym)
+                      unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_68K_GNU_VTINHERIT:
       case R_68K_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 \f
 /* Return the type of PLT associated with OUTPUT_BFD.  */
index 2d4e7a9cb267d7b5f211ea24430f882a53ca75f9..96e921ef64d14e0d675baa0467b8334aee8a1ac3 100644 (file)
@@ -562,19 +562,19 @@ mcore_elf_relocate_section (bfd * output_bfd,
 static asection *
 mcore_elf_gc_mark_hook (asection *sec,
                        struct bfd_link_info *info,
-                       Elf_Internal_Rela *rel,
+                       struct elf_reloc_cookie *cookie,
                        struct elf_link_hash_entry *h,
-                       Elf_Internal_Sym *sym)
+                       unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_MCORE_GNU_VTINHERIT:
       case R_MCORE_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Look through the relocs for a section during the first phase.
index 916f3e15c7200995043010e494c8a8675e8399c9..ca95aad17e8464b07f0057c06110442cf116274a 100644 (file)
@@ -3222,19 +3222,19 @@ elf_metag_finish_dynamic_sections (bfd *output_bfd,
 static asection *
 elf_metag_gc_mark_hook (asection *sec,
                        struct bfd_link_info *info,
-                       Elf_Internal_Rela *rela,
+                       struct elf_reloc_cookie *cookie,
                        struct elf_link_hash_entry *hh,
-                       Elf_Internal_Sym *sym)
+                       unsigned int symndx)
 {
   if (hh != NULL)
-    switch ((unsigned int) ELF32_R_TYPE (rela->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_METAG_GNU_VTINHERIT:
       case R_METAG_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rela, hh, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, hh, symndx);
 }
 
 /* Determine the type of stub needed, if any, for a call.  */
index db7ed46577940805fbf7de88ba4445e4f058b3f8..ede21310cf2750849666638096843c6a5ff589f7 100644 (file)
@@ -2310,20 +2310,20 @@ microblaze_elf_relax_section (bfd *abfd,
 
 static asection *
 microblaze_elf_gc_mark_hook (asection *sec,
-                            struct bfd_link_info * info,
-                            Elf_Internal_Rela * rel,
-                            struct elf_link_hash_entry * h,
-                            Elf_Internal_Sym * sym)
+                            struct bfd_link_info *info,
+                            struct elf_reloc_cookie *cookie,
+                            struct elf_link_hash_entry *h,
+                            unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_MICROBLAZE_GNU_VTINHERIT:
       case R_MICROBLAZE_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* PIC support.  */
index d2a95f53718de8b8532b81e5719f2a890adbb47a..3318c07e529ca6a7d5b73e6e9fa0bb672a44c841 100644 (file)
@@ -311,19 +311,6 @@ moxie_elf_relocate_section (bfd *output_bfd,
   return true;
 }
 \f
-/* Return the section that should be marked against GC for a given
-   relocation.  */
-
-static asection *
-moxie_elf_gc_mark_hook (asection *sec,
-                       struct bfd_link_info *info,
-                       Elf_Internal_Rela *rel,
-                       struct elf_link_hash_entry *h,
-                       Elf_Internal_Sym *sym)
-{
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
-}
-
 /* Look through the relocs for a section during the first phase.
    Since we don't do .gots or .plts, we just need to consider the
    virtual table relocs for gc.  */
@@ -379,7 +366,6 @@ moxie_elf_check_relocs (bfd *abfd,
 #define elf_info_to_howto_rel                  NULL
 #define elf_info_to_howto                      moxie_info_to_howto_rela
 #define elf_backend_relocate_section           moxie_elf_relocate_section
-#define elf_backend_gc_mark_hook               moxie_elf_gc_mark_hook
 #define elf_backend_check_relocs               moxie_elf_check_relocs
 
 #define elf_backend_can_gc_sections            1
index 5ca99ee9e62a904e23e0c228b3add20f7a46d220..92e3bc796ebc4d2e39f873b3b15543acc50d62b4 100644 (file)
@@ -6932,11 +6932,12 @@ nds32_elf_action_discarded (asection *sec)
 
 static asection *
 nds32_elf_gc_mark_hook (asection *sec, struct bfd_link_info *info,
-                       Elf_Internal_Rela *rel, struct elf_link_hash_entry *h,
-                       Elf_Internal_Sym *sym)
+                       struct elf_reloc_cookie *cookie,
+                       struct elf_link_hash_entry *h,
+                       unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_NDS32_GNU_VTINHERIT:
       case R_NDS32_GNU_VTENTRY:
@@ -6945,7 +6946,7 @@ nds32_elf_gc_mark_hook (asection *sec, struct bfd_link_info *info,
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 static enum elf_nds32_tls_type
index 159308fec7446989d88a47a551b845fc19e97b9e..0f315184310afcdbb769f624b65face5e314e545 100644 (file)
@@ -1924,19 +1924,19 @@ or1k_elf_relocate_section (bfd *output_bfd,
 static asection *
 or1k_elf_gc_mark_hook (asection *sec,
                       struct bfd_link_info *info,
-                      Elf_Internal_Rela *rel,
+                      struct elf_reloc_cookie *cookie,
                       struct elf_link_hash_entry *h,
-                      Elf_Internal_Sym *sym)
+                      unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_OR1K_GNU_VTINHERIT:
       case R_OR1K_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Look through the relocs for a section during the first phase.  */
index 900b5a76880ffcd21efb0a9f753d01833fb7f30d..9625ff2a5b7dda274f36f83b5100f87ff2cb0f1a 100644 (file)
@@ -4049,19 +4049,19 @@ ppc_elf_select_plt_layout (bfd *output_bfd ATTRIBUTE_UNUSED,
 static asection *
 ppc_elf_gc_mark_hook (asection *sec,
                      struct bfd_link_info *info,
-                     Elf_Internal_Rela *rel,
+                     struct elf_reloc_cookie *cookie,
                      struct elf_link_hash_entry *h,
-                     Elf_Internal_Sym *sym)
+                     unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_PPC_GNU_VTINHERIT:
       case R_PPC_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 static bool
index 0d04663756a0fdabb0fe03c604173790ca3bf21c..1216aeed1ab2b1eda38a8239a5a3eb4d31a9d639 100644 (file)
@@ -1345,19 +1345,18 @@ elf_s390_check_relocs (bfd *abfd,
 static asection *
 elf_s390_gc_mark_hook (asection *sec,
                       struct bfd_link_info *info,
-                      Elf_Internal_Rela *rel,
+                      struct elf_reloc_cookie *cookie,
                       struct elf_link_hash_entry *h,
-                      Elf_Internal_Sym *sym)
+                      unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_390_GNU_VTINHERIT:
       case R_390_GNU_VTENTRY:
        return NULL;
       }
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
-
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Make sure we emit a GOT entry if the symbol was supposed to have a PLT
index d91f2dedcf55f419d112736e104f758e7b3f5957..624b8a8b591e205eeddc261b5ca4310a2a8e1e98 100644 (file)
@@ -3863,19 +3863,19 @@ s3_bfd_score_elf_ignore_discarded_relocs (asection *sec)
 static asection *
 s3_bfd_score_elf_gc_mark_hook (asection *sec,
                               struct bfd_link_info *info,
-                              Elf_Internal_Rela *rel,
+                              struct elf_reloc_cookie *cookie,
                               struct elf_link_hash_entry *h,
-                              Elf_Internal_Sym *sym)
+                              unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_SCORE_GNU_VTINHERIT:
       case R_SCORE_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Support for core dump NOTE sections.  */
@@ -4300,14 +4300,14 @@ _bfd_score_elf_ignore_discarded_relocs (asection *sec)
 static asection *
 _bfd_score_elf_gc_mark_hook (asection *sec,
                             struct bfd_link_info *info,
-                            Elf_Internal_Rela *rel,
+                            struct elf_reloc_cookie *cookie,
                             struct elf_link_hash_entry *h,
-                            Elf_Internal_Sym *sym)
+                            unsigned int symndx)
 {
   if (bfd_get_mach (info->input_bfds) == bfd_mach_score3)
-    return s3_bfd_score_elf_gc_mark_hook (sec, info, rel, h, sym);
+    return s3_bfd_score_elf_gc_mark_hook (sec, info, cookie, h, symndx);
   else
-    return s7_bfd_score_elf_gc_mark_hook (sec, info, rel, h, sym);
+    return s7_bfd_score_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 static bool
index 3d71f222636dc32aa4572a58e8a137465329d061..f18e097bb221a9df102e767eee7f62f0d8f8a730 100644 (file)
@@ -121,9 +121,9 @@ s7_bfd_score_elf_ignore_discarded_relocs (asection *);
 extern asection *
 s7_bfd_score_elf_gc_mark_hook (asection *,
                               struct bfd_link_info *,
-                              Elf_Internal_Rela *,
+                              struct elf_reloc_cookie *,
                               struct elf_link_hash_entry *,
-                              Elf_Internal_Sym *);
+                              unsigned int);
 
 extern bool
 s7_bfd_score_elf_grok_prstatus (bfd *, Elf_Internal_Note *);
index 44718f39ccfda4b90082f0f103f5fd8c2e735b81..a586831ec9fdaf0d589a8cb9415134388f3c1f19 100644 (file)
@@ -3682,19 +3682,19 @@ s7_bfd_score_elf_ignore_discarded_relocs (asection *sec)
 asection *
 s7_bfd_score_elf_gc_mark_hook (asection *sec,
                               struct bfd_link_info *info,
-                              Elf_Internal_Rela *rel,
+                              struct elf_reloc_cookie *cookie,
                               struct elf_link_hash_entry *h,
-                              Elf_Internal_Sym *sym)
+                              unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_SCORE_GNU_VTINHERIT:
       case R_SCORE_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Support for core dump NOTE sections.  */
index e078e41b675af964d02362aa0a80c03b978ffdfc..f4efd7bba7c2d11b93176ad444c2089725ec2ee5 100644 (file)
@@ -5202,19 +5202,19 @@ tpoff (struct bfd_link_info *info, bfd_vma address)
 static asection *
 sh_elf_gc_mark_hook (asection *sec,
                     struct bfd_link_info *info,
-                    Elf_Internal_Rela *rel,
+                    struct elf_reloc_cookie *cookie,
                     struct elf_link_hash_entry *h,
-                    Elf_Internal_Sym *sym)
+                    unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_SH_GNU_VTINHERIT:
       case R_SH_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Copy the extra info we tack onto an elf_link_hash_entry.  */
index 12ff2a9121fbb5ac6863493bd0596837c02c205f..05746e9d6b69a5daa57b1c27ab0b33336b7c054f 100644 (file)
@@ -1783,13 +1783,13 @@ tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
 static asection *
 tilepro_elf_gc_mark_hook (asection *sec,
                          struct bfd_link_info *info,
-                         Elf_Internal_Rela *rel,
+                         struct elf_reloc_cookie *cookie,
                          struct elf_link_hash_entry *h,
-                         Elf_Internal_Sym *sym)
+                         unsigned int symndx)
 {
   if (h != NULL)
     {
-      switch (ELF32_R_TYPE (rel->r_info))
+      switch (ELF32_R_TYPE (cookie->rel->r_info))
        {
        case R_TILEPRO_GNU_VTINHERIT:
        case R_TILEPRO_GNU_VTENTRY:
@@ -1803,7 +1803,7 @@ tilepro_elf_gc_mark_hook (asection *sec,
     {
       struct bfd_link_hash_entry *bh;
 
-      switch (ELF32_R_TYPE (rel->r_info))
+      switch (ELF32_R_TYPE (cookie->rel->r_info))
        {
        case R_TILEPRO_TLS_GD_CALL:
          /* This reloc implicitly references __tls_get_addr.  We know
@@ -1823,11 +1823,11 @@ tilepro_elf_gc_mark_hook (asection *sec,
          h->mark = 1;
          if (h->is_weakalias)
            weakdef (h)->mark = 1;
-         sym = NULL;
+         symndx = 0;
        }
     }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Adjust a symbol defined by a dynamic object and referenced by a
index 27744814691e768463cc2f95d5b7df95903982dc..5f9a8f64a3f6f097ca4ddcd0f175196a75aba6dd 100644 (file)
@@ -2336,19 +2336,19 @@ v850_elf_relocate_section (bfd *output_bfd,
 static asection *
 v850_elf_gc_mark_hook (asection *sec,
                       struct bfd_link_info *info,
-                      Elf_Internal_Rela *rel,
+                      struct elf_reloc_cookie *cookie,
                       struct elf_link_hash_entry *h,
-                      Elf_Internal_Sym *sym)
+                      unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_V850_GNU_VTINHERIT:
       case R_V850_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 static void
index a5ced1f69583bab362568e076dc87d8a7a98d97a..37a96492d619afd70e37dcfb9b0dcce35b981aa7 100644 (file)
@@ -803,19 +803,19 @@ elf_vax_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
 static asection *
 elf_vax_gc_mark_hook (asection *sec,
                      struct bfd_link_info *info,
-                     Elf_Internal_Rela *rel,
+                     struct elf_reloc_cookie *cookie,
                      struct elf_link_hash_entry *h,
-                     Elf_Internal_Sym *sym)
+                     unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_VAX_GNU_VTINHERIT:
       case R_VAX_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Adjust a symbol defined by a dynamic object and referenced by a
index cf367024cfb79c7b914d10a7415b50d6f0cfa274..0475a029d8c975dad7027cfe32260a85044b5559 100644 (file)
@@ -700,18 +700,19 @@ visium_elf_relocate_section (bfd *output_bfd,
 
 static asection *
 visium_elf_gc_mark_hook (asection *sec, struct bfd_link_info *info,
-                        Elf_Internal_Rela *rel, struct elf_link_hash_entry *h,
-                        Elf_Internal_Sym *sym)
+                        struct elf_reloc_cookie *cookie,
+                        struct elf_link_hash_entry *h,
+                        unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_VISIUM_GNU_VTINHERIT:
       case R_VISIUM_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 static bool
index 5cee2f389ebd1695dacfc7b76cceb49eec580edf..471eb2e6c91acffb5dc3304a5f1c09c817c6afa0 100644 (file)
@@ -988,19 +988,19 @@ xstormy16_elf_finish_dynamic_sections (bfd *abfd ATTRIBUTE_UNUSED,
 static asection *
 xstormy16_elf_gc_mark_hook (asection *sec,
                            struct bfd_link_info *info,
-                           Elf_Internal_Rela *rel,
+                           struct elf_reloc_cookie *cookie,
                            struct elf_link_hash_entry *h,
-                           Elf_Internal_Sym *sym)
+                           unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_XSTORMY16_GNU_VTINHERIT:
       case R_XSTORMY16_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 \f
 #define ELF_ARCH               bfd_arch_xstormy16
index b21676df36a0b98c9dd9136dc33d379b7e28047a..c2be35eb4b7c5678ee248cdeb5b0d9478ac06ddb 100644 (file)
@@ -1322,9 +1322,9 @@ elf_xtensa_hide_symbol (struct bfd_link_info *info,
 static asection *
 elf_xtensa_gc_mark_hook (asection *sec,
                         struct bfd_link_info *info,
-                        Elf_Internal_Rela *rel,
+                        struct elf_reloc_cookie *cookie,
                         struct elf_link_hash_entry *h,
-                        Elf_Internal_Sym *sym)
+                        unsigned int symndx)
 {
   /* Property sections are marked "KEEP" in the linker scripts, but they
      should not cause other sections to be marked.  (This approach relies
@@ -1340,14 +1340,14 @@ elf_xtensa_gc_mark_hook (asection *sec,
     return NULL;
 
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_XTENSA_GNU_VTINHERIT:
       case R_XTENSA_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 
index b193f9166ee21d23da5b578103efdf7425a0a534..967c9c3c4147bdf245d734b7b24b25c4dbd79ade 100644 (file)
@@ -1996,12 +1996,12 @@ elf64_alpha_check_relocs (bfd *abfd, struct bfd_link_info *info,
 
 static asection *
 elf64_alpha_gc_mark_hook (asection *sec, struct bfd_link_info *info,
-                         Elf_Internal_Rela *rel,
-                         struct elf_link_hash_entry *h, Elf_Internal_Sym *sym)
+                         struct elf_reloc_cookie *cookie,
+                         struct elf_link_hash_entry *h, unsigned int symndx)
 {
   /* These relocations don't really reference a symbol.  Instead we store
      extra data in their addend slot.  Ignore the symbol.  */
-  switch (ELF64_R_TYPE (rel->r_info))
+  switch (ELF64_R_TYPE (cookie->rel->r_info))
     {
     case R_ALPHA_LITUSE:
     case R_ALPHA_GPDISP:
@@ -2009,7 +2009,7 @@ elf64_alpha_gc_mark_hook (asection *sec, struct bfd_link_info *info,
       return NULL;
     }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Adjust a symbol defined by a dynamic object and referenced by a
index bb8350718a216c0ff89f3edee1e97410b0c0cdaf..223a85044f2f5e0790ead2e8d11e89c78eed823e 100644 (file)
@@ -1762,19 +1762,19 @@ mmix_final_link_relocate (reloc_howto_type *howto, asection *input_section,
 static asection *
 mmix_elf_gc_mark_hook (asection *sec,
                       struct bfd_link_info *info,
-                      Elf_Internal_Rela *rel,
+                      struct elf_reloc_cookie *cookie,
                       struct elf_link_hash_entry *h,
-                      Elf_Internal_Sym *sym)
+                      unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF64_R_TYPE (rel->r_info))
+    switch (ELF64_R_TYPE (cookie->rel->r_info))
       {
       case R_MMIX_GNU_VTINHERIT:
       case R_MMIX_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 \f
 /* Sort register relocs to come before expanding relocs.  */
index fdda9e0bbb3cdcec0d0dacecd9bb55d7086cd665..26dab93c5383a3f7f287d2b23bb0eb0e27e1dd7b 100644 (file)
@@ -5996,9 +5996,9 @@ ppc64_elf_gc_mark_dynamic_ref (struct elf_link_hash_entry *h, void *inf)
 static asection *
 ppc64_elf_gc_mark_hook (asection *sec,
                        struct bfd_link_info *info,
-                       Elf_Internal_Rela *rel,
+                       struct elf_reloc_cookie *cookie,
                        struct elf_link_hash_entry *h,
-                       Elf_Internal_Sym *sym)
+                       unsigned int symndx)
 {
   asection *rsec;
 
@@ -6013,7 +6013,7 @@ ppc64_elf_gc_mark_hook (asection *sec,
       enum elf_ppc64_reloc_type r_type;
       struct ppc_link_hash_entry *eh, *fh, *fdh;
 
-      r_type = ELF64_R_TYPE (rel->r_info);
+      r_type = ELF64_R_TYPE (cookie->rel->r_info);
       switch (r_type)
        {
        case R_PPC64_GNU_VTINHERIT:
@@ -6062,13 +6062,14 @@ ppc64_elf_gc_mark_hook (asection *sec,
              break;
 
            default:
-             return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+             return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
            }
        }
     }
   else
     {
       struct _opd_sec_data *opd;
+      Elf_Internal_Sym *sym = &cookie->locsyms[symndx];
 
       rsec = bfd_section_from_elf_index (sec->owner, sym->st_shndx);
       opd = get_opd_info (rsec);
@@ -6076,7 +6077,7 @@ ppc64_elf_gc_mark_hook (asection *sec,
        {
          rsec->gc_mark = 1;
 
-         rsec = opd->func_sec[OPD_NDX (sym->st_value + rel->r_addend)];
+         rsec = opd->func_sec[OPD_NDX (sym->st_value + cookie->rel->r_addend)];
        }
     }
 
index 16daf981e1de7b6d3644d6553c00bdf3d3254715..e87f063be695923130f9501314c95a558a65299d 100644 (file)
@@ -1361,19 +1361,19 @@ elf_s390_check_relocs (bfd *abfd,
 static asection *
 elf_s390_gc_mark_hook (asection *sec,
                       struct bfd_link_info *info,
-                      Elf_Internal_Rela *rel,
+                      struct elf_reloc_cookie *cookie,
                       struct elf_link_hash_entry *h,
-                      Elf_Internal_Sym *sym)
+                      unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELF64_R_TYPE (rel->r_info))
+    switch (ELF64_R_TYPE (cookie->rel->r_info))
       {
       case R_390_GNU_VTINHERIT:
       case R_390_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Make sure we emit a GOT entry if the symbol was supposed to have a PLT
index 9862559b0fc0f5a345be12d4efc4db065a199c29..860184bdcba3ecbd70a6e39c2f14a510d5ad9320 100644 (file)
@@ -13949,12 +13949,15 @@ fini_reloc_cookie_for_section (struct elf_reloc_cookie *cookie,
 asection *
 _bfd_elf_gc_mark_hook (asection *sec,
                       struct bfd_link_info *info ATTRIBUTE_UNUSED,
-                      Elf_Internal_Rela *rel ATTRIBUTE_UNUSED,
+                      struct elf_reloc_cookie *cookie,
                       struct elf_link_hash_entry *h,
-                      Elf_Internal_Sym *sym)
+                      unsigned int symndx)
 {
   if (h == NULL)
-    return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+    {
+      Elf_Internal_Sym *sym = &cookie->locsyms[symndx];
+      return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+    }
 
   switch (h->root.type)
     {
@@ -13975,9 +13978,9 @@ _bfd_elf_gc_mark_hook (asection *sec,
 static asection *
 elf_gc_mark_debug_section (asection *sec ATTRIBUTE_UNUSED,
                           struct bfd_link_info *info ATTRIBUTE_UNUSED,
-                          Elf_Internal_Rela *rel ATTRIBUTE_UNUSED,
+                          struct elf_reloc_cookie *cookie,
                           struct elf_link_hash_entry *h,
-                          Elf_Internal_Sym *sym)
+                          unsigned int symndx)
 {
   if (h != NULL)
     {
@@ -13990,6 +13993,7 @@ elf_gc_mark_debug_section (asection *sec ATTRIBUTE_UNUSED,
   else
     {
       /* Return the local debug definition section.  */
+      Elf_Internal_Sym *sym = &cookie->locsyms[symndx];
       asection *isec = bfd_section_from_elf_index (sec->owner,
                                                   sym->st_shndx);
       if (isec != NULL && (isec->flags & SEC_DEBUGGING) != 0)
@@ -14024,8 +14028,7 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_info *info, asection *sec,
       if (r_symndx >= cookie->locsymcount)
        return NULL;
 
-      return (*gc_mark_hook) (sec, info, cookie->rel, NULL,
-                             &cookie->locsyms[r_symndx]);
+      return (*gc_mark_hook) (sec, info, cookie, NULL, r_symndx);
     }
 
   bool was_marked = h->mark;
@@ -14058,7 +14061,7 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_info *info, asection *sec,
        }
     }
 
-  return (*gc_mark_hook) (sec, info, cookie->rel, h, NULL);
+  return (*gc_mark_hook) (sec, info, cookie, h, 0);
 }
 
 /* COOKIE->rel describes a relocation against section SEC, which is
index e579babc7ecacd3a12f104b771c6fa4b517a4a42..1eff3b134ee765dfc6381197bf8e49c7ecafcfd7 100644 (file)
@@ -6634,19 +6634,19 @@ loongarch_elf_object_p (bfd *abfd)
 
 static asection *
 loongarch_elf_gc_mark_hook (asection *sec, struct bfd_link_info *info,
-                           Elf_Internal_Rela *rel,
+                           struct elf_reloc_cookie *cookie,
                            struct elf_link_hash_entry *h,
-                           Elf_Internal_Sym *sym)
+                           unsigned int symndx)
 {
   if (h != NULL)
-    switch (ELFNN_R_TYPE (rel->r_info))
+    switch (ELFNN_R_TYPE (cookie->rel->r_info))
       {
       case R_LARCH_GNU_VTINHERIT:
       case R_LARCH_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Return TRUE if symbol H should be hashed in the `.gnu.hash' section.  For
index 12b66b0bdb1b0671a5731061d5dd11ae3d99c8d4..5fbfbc6c2dd645f17d69a2f5dd3400d300222853 100644 (file)
@@ -12988,21 +12988,21 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd,
 asection *
 _bfd_mips_elf_gc_mark_hook (asection *sec,
                            struct bfd_link_info *info,
-                           Elf_Internal_Rela *rel,
+                           struct elf_reloc_cookie *cookie,
                            struct elf_link_hash_entry *h,
-                           Elf_Internal_Sym *sym)
+                           unsigned int symndx)
 {
   /* ??? Do mips16 stub sections need to be handled special?  */
 
   if (h != NULL)
-    switch (ELF_R_TYPE (sec->owner, rel->r_info))
+    switch (ELF_R_TYPE (sec->owner, cookie->rel->r_info))
       {
       case R_MIPS_GNU_VTINHERIT:
       case R_MIPS_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Prevent .MIPS.abiflags from being discarded with --gc-sections.  */
index ee4de9e5ca21ac81dc53a901a9eefc4557c6dd92..37b761161d98c4c5b991d04f0e4a1fd7fef46a35 100644 (file)
@@ -91,8 +91,8 @@ extern int _bfd_mips_elf_additional_program_headers
 extern bool _bfd_mips_elf_modify_segment_map
   (bfd *, struct bfd_link_info *);
 extern asection * _bfd_mips_elf_gc_mark_hook
-  (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
-   struct elf_link_hash_entry *, Elf_Internal_Sym *);
+  (asection *, struct bfd_link_info *, struct elf_reloc_cookie *,
+   struct elf_link_hash_entry *, unsigned int);
 extern void _bfd_mips_elf_copy_indirect_symbol
   (struct bfd_link_info *, struct elf_link_hash_entry *,
    struct elf_link_hash_entry *);
index 1f3b9d831d885dfc00c335b13940c6641bf2cc4f..0a80e7c7f5a4ef343941153b6677efebbc39a722 100644 (file)
@@ -1826,12 +1826,12 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
 asection *
 _bfd_sparc_elf_gc_mark_hook (asection *sec,
                             struct bfd_link_info *info,
-                            Elf_Internal_Rela *rel,
+                            struct elf_reloc_cookie *cookie,
                             struct elf_link_hash_entry *h,
-                            Elf_Internal_Sym *sym)
+                            unsigned int symndx)
 {
   if (h != NULL)
-    switch (SPARC_ELF_R_TYPE (rel->r_info))
+    switch (SPARC_ELF_R_TYPE (cookie->rel->r_info))
       {
       case R_SPARC_GNU_VTINHERIT:
       case R_SPARC_GNU_VTENTRY:
@@ -1840,7 +1840,7 @@ _bfd_sparc_elf_gc_mark_hook (asection *sec,
 
   if (!bfd_link_executable (info))
     {
-      switch (SPARC_ELF_R_TYPE (rel->r_info))
+      switch (SPARC_ELF_R_TYPE (cookie->rel->r_info))
        {
        case R_SPARC_TLS_GD_CALL:
        case R_SPARC_TLS_LDM_CALL:
@@ -1855,11 +1855,11 @@ _bfd_sparc_elf_gc_mark_hook (asection *sec,
          h->mark = 1;
          if (h->is_weakalias)
            weakdef (h)->mark = 1;
-         sym = NULL;
+         symndx = 0;
        }
     }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 static Elf_Internal_Rela *
index 572c2331112ca0dbf8884d3ab464b121a4e82057..fe1780777069b074b2d7ac03935930156c792993 100644 (file)
@@ -107,9 +107,8 @@ extern bool _bfd_sparc_elf_check_relocs
   (bfd *, struct bfd_link_info *,
    asection *, const Elf_Internal_Rela *);
 extern asection *_bfd_sparc_elf_gc_mark_hook
-  (asection *, struct bfd_link_info *,
-   Elf_Internal_Rela *, struct elf_link_hash_entry *,
-   Elf_Internal_Sym *);
+  (asection *, struct bfd_link_info *, struct elf_reloc_cookie *,
+   struct elf_link_hash_entry *, unsigned int);
 extern bool _bfd_sparc_elf_adjust_dynamic_symbol
   (struct bfd_link_info *, struct elf_link_hash_entry *);
 extern bool _bfd_sparc_elf_omit_section_dynsym
index 577d259a3b8b08e3699cc00b5a34adcbca60b582..cdbeac1a30cf4ec22f85e0102b37367a6f183666 100644 (file)
@@ -2030,13 +2030,13 @@ tilegx_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
 asection *
 tilegx_elf_gc_mark_hook (asection *sec,
                         struct bfd_link_info *info,
-                        Elf_Internal_Rela *rel,
+                        struct elf_reloc_cookie *cookie,
                         struct elf_link_hash_entry *h,
-                        Elf_Internal_Sym *sym)
+                        unsigned int symndx)
 {
   if (h != NULL)
     {
-      switch (TILEGX_ELF_R_TYPE (rel->r_info))
+      switch (TILEGX_ELF_R_TYPE (cookie->rel->r_info))
        {
        case R_TILEGX_GNU_VTINHERIT:
        case R_TILEGX_GNU_VTENTRY:
@@ -2050,7 +2050,7 @@ tilegx_elf_gc_mark_hook (asection *sec,
     {
       struct bfd_link_hash_entry *bh;
 
-      switch (TILEGX_ELF_R_TYPE (rel->r_info))
+      switch (TILEGX_ELF_R_TYPE (cookie->rel->r_info))
        {
        case R_TILEGX_TLS_GD_CALL:
          /* This reloc implicitly references __tls_get_addr.  We know
@@ -2070,11 +2070,11 @@ tilegx_elf_gc_mark_hook (asection *sec,
          h->mark = 1;
          if (h->is_weakalias)
            weakdef (h)->mark = 1;
-         sym = NULL;
+         symndx = 0;
        }
     }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 /* Adjust a symbol defined by a dynamic object and referenced by a
index 225b4c4bac99d67b0f3bdfec827411cc94b7cb3f..f20946027d2595c07e79304b99c619558fc9aa1e 100644 (file)
@@ -69,9 +69,9 @@ tilegx_elf_relocate_section (bfd *, struct bfd_link_info *,
 extern asection *
 tilegx_elf_gc_mark_hook (asection *,
                         struct bfd_link_info *,
-                        Elf_Internal_Rela *,
+                        struct elf_reloc_cookie *,
                         struct elf_link_hash_entry *,
-                        Elf_Internal_Sym *);
+                        unsigned int);
 
 extern bfd_vma
 tilegx_elf_plt_sym_val (bfd_vma, const asection *, const arelent *);
index 140e86888a6654fb9c1daae3b1732fe089e02d9f..b224a546901661872246c3711a432d5d1a321fe3 100644 (file)
@@ -3711,9 +3711,9 @@ _bfd_x86_elf_link_symbol_references_local (struct bfd_link_info *info,
 asection *
 _bfd_x86_elf_gc_mark_hook (asection *sec,
                           struct bfd_link_info *info,
-                          Elf_Internal_Rela *rel,
+                          struct elf_reloc_cookie *cookie,
                           struct elf_link_hash_entry *h,
-                          Elf_Internal_Sym *sym)
+                          unsigned int symndx)
 {
   /* Compiler should optimize this out.  */
   if (((unsigned int) R_X86_64_GNU_VTINHERIT
@@ -3723,14 +3723,14 @@ _bfd_x86_elf_gc_mark_hook (asection *sec,
     abort ();
 
   if (h != NULL)
-    switch (ELF32_R_TYPE (rel->r_info))
+    switch (ELF32_R_TYPE (cookie->rel->r_info))
       {
       case R_X86_64_GNU_VTINHERIT:
       case R_X86_64_GNU_VTENTRY:
        return NULL;
       }
 
-  return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
+  return _bfd_elf_gc_mark_hook (sec, info, cookie, h, symndx);
 }
 
 static bfd_vma
index 4cb18a914f96880d6c6423f6d4a211f854aa7cbc..f3e376782731dda8d6aea61ac623ada5f16815e9 100644 (file)
@@ -914,8 +914,8 @@ extern bool _bfd_x86_elf_link_symbol_references_local
   (struct bfd_link_info *, struct elf_link_hash_entry *) ATTRIBUTE_HIDDEN;
 
 extern asection * _bfd_x86_elf_gc_mark_hook
-  (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
-   struct elf_link_hash_entry *, Elf_Internal_Sym *) ATTRIBUTE_HIDDEN;
+  (asection *, struct bfd_link_info *, struct elf_reloc_cookie *,
+   struct elf_link_hash_entry *, unsigned int) ATTRIBUTE_HIDDEN;
 
 extern long _bfd_x86_elf_get_synthetic_symtab
   (bfd *, long, long, bfd_vma, struct elf_x86_plt [], asymbol **,