From: Alan Modra Date: Thu, 30 Oct 2025 05:56:27 +0000 (+1030) Subject: Pass cookie and symndx to gc_mark_hook X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ad4b8c3e9586991795daf8358bee31335e412e56;p=thirdparty%2Fbinutils-gdb.git Pass cookie and symndx to gc_mark_hook 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. --- diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 850a86fda25..05d4baac23c 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -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, diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index 9a6870877f1..b5babd23991 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -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. */ diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index ae3dc246be0..4e968077b3e 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -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. */ diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c index 7ed1285f4c2..e5ad4d6ca0a 100644 --- a/bfd/elf32-bfin.c +++ b/bfd/elf32-bfin.c @@ -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); } extern const bfd_target bfin_elf32_fdpic_vec; diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c index 31d1ba41c17..df3771bda89 100644 --- a/bfd/elf32-cr16.c +++ b/bfd/elf32-cr16.c @@ -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 diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index faaebb9ebee..77e8201b4a6 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -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. */ diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c index 40781a0e1bb..9ab0f49f434 100644 --- a/bfd/elf32-csky.c +++ b/bfd/elf32-csky.c @@ -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. */ diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c index 5474f57a453..b2a48c8b211 100644 --- a/bfd/elf32-d10v.c +++ b/bfd/elf32-d10v.c @@ -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. diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c index d0ca4e893e5..3392acd5261 100644 --- a/bfd/elf32-fr30.c +++ b/bfd/elf32-fr30.c @@ -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. diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index b7183133ad1..baeb8ba3378 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -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); } /* Hook called by the linker routine which adds symbols from an object diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 2f463e12829..3a7237dbe7d 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -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. */ diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c index 11d6e1e347d..d4d7188aa0a 100644 --- a/bfd/elf32-iq2000.c +++ b/bfd/elf32-iq2000.c @@ -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); } diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c index 0ead0df9cf0..f8568d76ed1 100644 --- a/bfd/elf32-lm32.c +++ b/bfd/elf32-lm32.c @@ -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. */ diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index c51133090b4..5444ddaa127 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -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. diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 44ef102ea60..b5df42d7488 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -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); } /* Return the type of PLT associated with OUTPUT_BFD. */ diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c index 2d4e7a9cb26..96e921ef64d 100644 --- a/bfd/elf32-mcore.c +++ b/bfd/elf32-mcore.c @@ -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. diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c index 916f3e15c72..ca95aad17e8 100644 --- a/bfd/elf32-metag.c +++ b/bfd/elf32-metag.c @@ -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. */ diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c index db7ed465779..ede21310cf2 100644 --- a/bfd/elf32-microblaze.c +++ b/bfd/elf32-microblaze.c @@ -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. */ diff --git a/bfd/elf32-moxie.c b/bfd/elf32-moxie.c index d2a95f53718..3318c07e529 100644 --- a/bfd/elf32-moxie.c +++ b/bfd/elf32-moxie.c @@ -311,19 +311,6 @@ moxie_elf_relocate_section (bfd *output_bfd, return true; } -/* 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 diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c index 5ca99ee9e62..92e3bc796eb 100644 --- a/bfd/elf32-nds32.c +++ b/bfd/elf32-nds32.c @@ -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 diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c index 159308fec74..0f315184310 100644 --- a/bfd/elf32-or1k.c +++ b/bfd/elf32-or1k.c @@ -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. */ diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 900b5a76880..9625ff2a5b7 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -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 diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 0d04663756a..1216aeed1ab 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -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 diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c index d91f2dedcf5..624b8a8b591 100644 --- a/bfd/elf32-score.c +++ b/bfd/elf32-score.c @@ -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 diff --git a/bfd/elf32-score.h b/bfd/elf32-score.h index 3d71f222636..f18e097bb22 100644 --- a/bfd/elf32-score.h +++ b/bfd/elf32-score.h @@ -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 *); diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c index 44718f39ccf..a586831ec9f 100644 --- a/bfd/elf32-score7.c +++ b/bfd/elf32-score7.c @@ -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. */ diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index e078e41b675..f4efd7bba7c 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -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. */ diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c index 12ff2a9121f..05746e9d6b6 100644 --- a/bfd/elf32-tilepro.c +++ b/bfd/elf32-tilepro.c @@ -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 diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index 27744814691..5f9a8f64a3f 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -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 diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index a5ced1f6958..37a96492d61 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -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 diff --git a/bfd/elf32-visium.c b/bfd/elf32-visium.c index cf367024cfb..0475a029d8c 100644 --- a/bfd/elf32-visium.c +++ b/bfd/elf32-visium.c @@ -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 diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c index 5cee2f389eb..471eb2e6c91 100644 --- a/bfd/elf32-xstormy16.c +++ b/bfd/elf32-xstormy16.c @@ -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); } #define ELF_ARCH bfd_arch_xstormy16 diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index b21676df36a..c2be35eb4b7 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -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); } diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index b193f9166ee..967c9c3c414 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -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 diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index bb8350718a2..223a85044f2 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -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); } /* Sort register relocs to come before expanding relocs. */ diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index fdda9e0bbb3..26dab93c538 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -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)]; } } diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 16daf981e1d..e87f063be69 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -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 diff --git a/bfd/elflink.c b/bfd/elflink.c index 9862559b0fc..860184bdcba 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -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 diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c index e579babc7ec..1eff3b134ee 100644 --- a/bfd/elfnn-loongarch.c +++ b/bfd/elfnn-loongarch.c @@ -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 diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 12b66b0bdb1..5fbfbc6c2dd 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -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. */ diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h index ee4de9e5ca2..37b761161d9 100644 --- a/bfd/elfxx-mips.h +++ b/bfd/elfxx-mips.h @@ -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 *); diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index 1f3b9d831d8..0a80e7c7f5a 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -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 * diff --git a/bfd/elfxx-sparc.h b/bfd/elfxx-sparc.h index 572c2331112..fe178077706 100644 --- a/bfd/elfxx-sparc.h +++ b/bfd/elfxx-sparc.h @@ -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 diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c index 577d259a3b8..cdbeac1a30c 100644 --- a/bfd/elfxx-tilegx.c +++ b/bfd/elfxx-tilegx.c @@ -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 diff --git a/bfd/elfxx-tilegx.h b/bfd/elfxx-tilegx.h index 225b4c4bac9..f20946027d2 100644 --- a/bfd/elfxx-tilegx.h +++ b/bfd/elfxx-tilegx.h @@ -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 *); diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c index 140e86888a6..b224a546901 100644 --- a/bfd/elfxx-x86.c +++ b/bfd/elfxx-x86.c @@ -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 diff --git a/bfd/elfxx-x86.h b/bfd/elfxx-x86.h index 4cb18a914f9..f3e37678273 100644 --- a/bfd/elfxx-x86.h +++ b/bfd/elfxx-x86.h @@ -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 **,