From: Alan Modra Date: Wed, 27 Mar 2013 13:37:51 +0000 (+0000) Subject: * elf-bfd.h (enum elf_reloc_type_class): Add reloc_class_ifunc. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7e612e9848387838d6e9bda6e95eac165a25e4ed;p=binutils-gdb.git * elf-bfd.h (enum elf_reloc_type_class): Add reloc_class_ifunc. (struct elf_backend_data ): Add bfd_link_info* and asection* params. (_bfd_elf_reloc_type_class): Likewise. * elf.c (_bfd_elf_reloc_type_class): Likewise. * elflink.c (elf_link_sort_cmp2): Sort first on reloc class. (elf_link_sort_relocs): Update elf_backed_reloc_type_class call. * elf32-ppc.c (ppc_elf_reloc_type_class): Return reloc_class_ifunc for any reliplt reloc. Don't return reloc_class_plt for R_PPC_REL24 and R_PPC_ADDR24. * elf64-ppc.c (allocate_got): Formatting. (ppc64_elf_reloc_type_class): Return reloc_class_ifunc for any reliplt reloc. * elf-m10300.c, * elf32-arm.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-cris.c, * elf32-hppa.c, * elf32-i386.c, * elf32-lm32.c, * elf32-m32r.c, * elf32-m68k.c, * elf32-metag.c, * elf32-nios2.c, * elf32-s390.c, * elf32-sh.c, * elf32-sparc.c, * elf32-tilepro.c, * elf32-vax.c, * elf32-xtensa.c, * elf64-aarch64.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c, * elfnn-ia64.c, * elfxx-tilegx.c, * elfxx-tilegx.h: Add extra params to the various reloc_type_class functions. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 6253a24e7de..2ab4d574f14 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,27 @@ +2013-03-28 Alan Modra + + * elf-bfd.h (enum elf_reloc_type_class): Add reloc_class_ifunc. + (struct elf_backend_data ): Add + bfd_link_info* and asection* params. + (_bfd_elf_reloc_type_class): Likewise. + * elf.c (_bfd_elf_reloc_type_class): Likewise. + * elflink.c (elf_link_sort_cmp2): Sort first on reloc class. + (elf_link_sort_relocs): Update elf_backed_reloc_type_class call. + * elf32-ppc.c (ppc_elf_reloc_type_class): Return reloc_class_ifunc + for any reliplt reloc. Don't return reloc_class_plt for + R_PPC_REL24 and R_PPC_ADDR24. + * elf64-ppc.c (allocate_got): Formatting. + (ppc64_elf_reloc_type_class): Return reloc_class_ifunc for any + reliplt reloc. + * elf-m10300.c, * elf32-arm.c, * elf32-bfin.c, * elf32-cr16.c, + * elf32-cris.c, * elf32-hppa.c, * elf32-i386.c, * elf32-lm32.c, + * elf32-m32r.c, * elf32-m68k.c, * elf32-metag.c, * elf32-nios2.c, + * elf32-s390.c, * elf32-sh.c, * elf32-sparc.c, * elf32-tilepro.c, + * elf32-vax.c, * elf32-xtensa.c, * elf64-aarch64.c, * elf64-alpha.c, + * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-s390.c, * elf64-sparc.c, + * elf64-x86-64.c, * elfnn-ia64.c, * elfxx-tilegx.c, * elfxx-tilegx.h: + Add extra params to the various reloc_type_class functions. + 2013-03-27 Alan Modra * elf32-ppc.c (ppc_elf_check_relocs): Set PLT_IFUNC in local got diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index c05807d1843..3b4bd6f9894 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -641,7 +641,8 @@ enum elf_reloc_type_class { reloc_class_normal, reloc_class_relative, reloc_class_plt, - reloc_class_copy + reloc_class_copy, + reloc_class_ifunc }; struct elf_reloc_cookie @@ -1128,7 +1129,7 @@ struct elf_backend_data /* This function returns class of a reloc type. */ enum elf_reloc_type_class (*elf_backend_reloc_type_class) - (const Elf_Internal_Rela *); + (const struct bfd_link_info *, const asection *, const Elf_Internal_Rela *); /* This function, if defined, removes information about discarded functions from other sections which mention them. */ @@ -1777,7 +1778,8 @@ extern bfd_boolean _bfd_elf_can_make_relative (bfd *input_bfd, struct bfd_link_info *info, asection *eh_frame_section); extern enum elf_reloc_type_class _bfd_elf_reloc_type_class - (const Elf_Internal_Rela *); + (const struct bfd_link_info *, const asection *, + const Elf_Internal_Rela *); extern bfd_vma _bfd_elf_rela_local_sym (bfd *, Elf_Internal_Sym *, asection **, Elf_Internal_Rela *); extern bfd_vma _bfd_elf_rel_local_sym diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index 6171febd864..ffd873d7b3d 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -5532,7 +5532,9 @@ _bfd_mn10300_elf_finish_dynamic_sections (bfd * output_bfd, properly. */ static enum elf_reloc_type_class -_bfd_mn10300_elf_reloc_type_class (const Elf_Internal_Rela *rela) +_bfd_mn10300_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF32_R_TYPE (rela->r_info)) { diff --git a/bfd/elf.c b/bfd/elf.c index 05d492db080..bf05ae0a802 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -9756,7 +9756,9 @@ bfd_get_elf_phdrs (bfd *abfd, void *phdrs) } enum elf_reloc_type_class -_bfd_elf_reloc_type_class (const Elf_Internal_Rela *rela ATTRIBUTE_UNUSED) +_bfd_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela ATTRIBUTE_UNUSED) { return reloc_class_normal; } diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 9a97cbfc9a8..8e335e745bd 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -14432,7 +14432,9 @@ elf32_arm_post_process_headers (bfd * abfd, struct bfd_link_info * link_info ATT } static enum elf_reloc_type_class -elf32_arm_reloc_type_class (const Elf_Internal_Rela *rela) +elf32_arm_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF32_R_TYPE (rela->r_info)) { diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c index a42d3a45dbe..d956da65a52 100644 --- a/bfd/elf32-bfin.c +++ b/bfd/elf32-bfin.c @@ -1301,7 +1301,9 @@ bfin_check_relocs (bfd * abfd, } static enum elf_reloc_type_class -elf32_bfin_reloc_type_class (const Elf_Internal_Rela * rela) +elf32_bfin_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela * rela) { switch ((int) ELF32_R_TYPE (rela->r_info)) { diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c index 449775b2cb6..656caffb330 100644 --- a/bfd/elf32-cr16.c +++ b/bfd/elf32-cr16.c @@ -2916,7 +2916,9 @@ error_return: properly. */ static enum elf_reloc_type_class -_bfd_cr16_elf_reloc_type_class (const Elf_Internal_Rela *rela) +_bfd_cr16_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF32_R_TYPE (rela->r_info)) { diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index 7af0255772b..ff2dfe33684 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -4241,7 +4241,9 @@ cris_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd) } static enum elf_reloc_type_class -elf_cris_reloc_type_class (const Elf_Internal_Rela *rela) +elf_cris_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { enum elf_cris_reloc_type r_type = ELF32_R_TYPE (rela->r_info); switch (r_type) diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index c74c0539fd9..8d21cee53d8 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -4436,7 +4436,9 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd, dynamic linker, before writing them out. */ static enum elf_reloc_type_class -elf32_hppa_reloc_type_class (const Elf_Internal_Rela *rela) +elf32_hppa_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { /* Handle TLS relocs first; we don't want them to be marked relative by the "if (ELF32_R_SYM (rela->r_info) == STN_UNDEF)" diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index c048e58e906..f898a5c2f2b 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -4718,7 +4718,9 @@ elf_i386_finish_local_dynamic_symbol (void **slot, void *inf) dynamic linker, before writing them out. */ static enum elf_reloc_type_class -elf_i386_reloc_type_class (const Elf_Internal_Rela *rela) +elf_i386_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch (ELF32_R_TYPE (rela->r_info)) { diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c index d1985608a9e..6bbbec8a811 100644 --- a/bfd/elf32-lm32.c +++ b/bfd/elf32-lm32.c @@ -1741,7 +1741,9 @@ lm32_elf_finish_dynamic_symbol (bfd *output_bfd, } static enum elf_reloc_type_class -lm32_elf_reloc_type_class (const Elf_Internal_Rela *rela) +lm32_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF32_R_TYPE (rela->r_info)) { diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 93b5021c3c8..385f4cc87ba 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -3981,7 +3981,9 @@ static const struct bfd_elf_special_section m32r_elf_special_sections[] = }; static enum elf_reloc_type_class -m32r_elf_reloc_type_class (const Elf_Internal_Rela *rela) +m32r_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF32_R_TYPE (rela->r_info)) { diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 76a1e0c08c0..01b5d67d68d 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -4737,7 +4737,9 @@ bfd_elf_m68k_set_target_options (struct bfd_link_info *info, int got_handling) } static enum elf_reloc_type_class -elf32_m68k_reloc_type_class (const Elf_Internal_Rela *rela) +elf32_m68k_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF32_R_TYPE (rela->r_info)) { diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c index 2d42517a297..8f08bf6cf94 100644 --- a/bfd/elf32-metag.c +++ b/bfd/elf32-metag.c @@ -3257,7 +3257,9 @@ elf_metag_post_process_headers (bfd * abfd, struct bfd_link_info * link_info ATT dynamic linker, before writing them out. */ static enum elf_reloc_type_class -elf_metag_reloc_type_class (const Elf_Internal_Rela *rela) +elf_metag_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF32_R_TYPE (rela->r_info)) { diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c index 85ef7c9039d..91cbce43e86 100644 --- a/bfd/elf32-nios2.c +++ b/bfd/elf32-nios2.c @@ -3977,7 +3977,9 @@ nios2_elf32_link_hash_table_create (bfd *abfd) /* Implement elf_backend_reloc_type_class. */ static enum elf_reloc_type_class -nios2_elf32_reloc_type_class (const Elf_Internal_Rela *rela) +nios2_elf32_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF32_R_TYPE (rela->r_info)) { diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 05d6e351adc..417a3b7b7ae 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -9362,14 +9362,19 @@ ppc_elf_finish_dynamic_symbol (bfd *output_bfd, } static enum elf_reloc_type_class -ppc_elf_reloc_type_class (const Elf_Internal_Rela *rela) +ppc_elf_reloc_type_class (const struct bfd_link_info *info, + const asection *rel_sec, + const Elf_Internal_Rela *rela) { + struct ppc_elf_link_hash_table *htab = ppc_elf_hash_table (info); + + if (rel_sec == htab->reliplt) + return reloc_class_ifunc; + switch (ELF32_R_TYPE (rela->r_info)) { case R_PPC_RELATIVE: return reloc_class_relative; - case R_PPC_REL24: - case R_PPC_ADDR24: case R_PPC_JMP_SLOT: return reloc_class_plt; case R_PPC_COPY: diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 948b621e587..fae222eefd9 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -3712,7 +3712,9 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, dynamic linker, before writing them out. */ static enum elf_reloc_type_class -elf_s390_reloc_type_class (const Elf_Internal_Rela *rela) +elf_s390_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF32_R_TYPE (rela->r_info)) { @@ -3940,7 +3942,6 @@ elf32_s390_merge_private_bfd_data (bfd *ibfd, bfd *obfd) #define elf_backend_relocate_section elf_s390_relocate_section #define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections #define elf_backend_init_index_section _bfd_elf_init_1_index_section -#define elf_backend_reloc_type_class elf_s390_reloc_type_class #define elf_backend_grok_prstatus elf_s390_grok_prstatus #define elf_backend_plt_sym_val elf_s390_plt_sym_val #define elf_backend_add_symbol_hook elf_s390_add_symbol_hook diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index fff324d7a14..8e93dda5bf8 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -7261,7 +7261,9 @@ sh_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) } static enum elf_reloc_type_class -sh_elf_reloc_type_class (const Elf_Internal_Rela *rela) +sh_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF32_R_TYPE (rela->r_info)) { diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index 63996c43bae..52abfd43d04 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -153,7 +153,9 @@ elf32_sparc_final_write_processing (bfd *abfd, } static enum elf_reloc_type_class -elf32_sparc_reloc_type_class (const Elf_Internal_Rela *rela) +elf32_sparc_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF32_R_TYPE (rela->r_info)) { diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c index db31eebe2c8..4f13241138e 100644 --- a/bfd/elf32-tilepro.c +++ b/bfd/elf32-tilepro.c @@ -3964,7 +3964,9 @@ tilepro_elf_plt_sym_val (bfd_vma i, const asection *plt, } static enum elf_reloc_type_class -tilepro_reloc_type_class (const Elf_Internal_Rela *rela) +tilepro_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF32_R_TYPE (rela->r_info)) { diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index 0e79a2ae35b..1208d431e50 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -2026,7 +2026,9 @@ elf_vax_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) } static enum elf_reloc_type_class -elf_vax_reloc_type_class (const Elf_Internal_Rela *rela) +elf_vax_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF32_R_TYPE (rela->r_info)) { diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index 64ae6e4e1a4..b397422994c 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -3585,7 +3585,9 @@ elf_xtensa_final_write_processing (bfd *abfd, static enum elf_reloc_type_class -elf_xtensa_reloc_type_class (const Elf_Internal_Rela *rela) +elf_xtensa_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF32_R_TYPE (rela->r_info)) { diff --git a/bfd/elf64-aarch64.c b/bfd/elf64-aarch64.c index 94d90c5e4ce..feb1a006ff1 100644 --- a/bfd/elf64-aarch64.c +++ b/bfd/elf64-aarch64.c @@ -5560,7 +5560,9 @@ elf64_aarch64_post_process_headers (bfd *abfd, } static enum elf_reloc_type_class -elf64_aarch64_reloc_type_class (const Elf_Internal_Rela *rela) +elf64_aarch64_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF64_R_TYPE (rela->r_info)) { diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index aeff52699e2..81fe6c18b42 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -5315,7 +5315,9 @@ elf64_alpha_final_link (bfd *abfd, struct bfd_link_info *info) } static enum elf_reloc_type_class -elf64_alpha_reloc_type_class (const Elf_Internal_Rela *rela) +elf64_alpha_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF64_R_TYPE (rela->r_info)) { diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index 0ceccf6d967..b2f0ed150a3 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -194,9 +194,6 @@ static bfd_boolean elf64_hppa_finish_dynamic_symbol (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, Elf_Internal_Sym *); -static enum elf_reloc_type_class elf64_hppa_reloc_type_class - (const Elf_Internal_Rela *); - static bfd_boolean elf64_hppa_finish_dynamic_sections (bfd *, struct bfd_link_info *); @@ -2446,7 +2443,9 @@ elf64_hppa_finalize_dynreloc (struct elf_link_hash_entry *eh, dynamic linker, before writing them out. */ static enum elf_reloc_type_class -elf64_hppa_reloc_type_class (const Elf_Internal_Rela *rela) +elf64_hppa_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { if (ELF64_R_SYM (rela->r_info) == STN_UNDEF) return reloc_class_relative; diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c index 82fd6469476..20b456e7f08 100644 --- a/bfd/elf64-ia64-vms.c +++ b/bfd/elf64-ia64-vms.c @@ -4310,7 +4310,9 @@ elf64_ia64_print_private_bfd_data (bfd *abfd, void * ptr) } static enum elf_reloc_type_class -elf64_ia64_reloc_type_class (const Elf_Internal_Rela *rela) +elf64_ia64_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF64_R_TYPE (rela->r_info)) { diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 22468ec7d3a..9d7c79ed32a 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -8816,8 +8816,8 @@ allocate_got (struct elf_link_hash_entry *h, dyn = htab->elf.dynamic_sections_created; if ((info->shared || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)) - && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT - || h->root.type != bfd_link_hash_undefweak)) + && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak)) { asection *relgot = ppc64_elf_tdata (gent->owner)->relgot; relgot->size += rentsize; @@ -14062,9 +14062,15 @@ ppc64_elf_finish_dynamic_symbol (bfd *output_bfd, dynamic linker, before writing them out. */ static enum elf_reloc_type_class -ppc64_elf_reloc_type_class (const Elf_Internal_Rela *rela) +ppc64_elf_reloc_type_class (const struct bfd_link_info *info, + const asection *rel_sec, + const Elf_Internal_Rela *rela) { enum elf_ppc64_reloc_type r_type; + struct ppc_link_hash_table *htab = ppc_hash_table (info); + + if (rel_sec == htab->reliplt) + return reloc_class_ifunc; r_type = ELF64_R_TYPE (rela->r_info); switch (r_type) diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index eece2c26f97..d939a3d68b4 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -3516,7 +3516,9 @@ do_glob_dat: dynamic linker, before writing them out. */ static enum elf_reloc_type_class -elf_s390_reloc_type_class (const Elf_Internal_Rela *rela) +elf_s390_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF64_R_TYPE (rela->r_info)) { @@ -3752,7 +3754,6 @@ const struct elf_size_info s390_elf64_size_info = #define elf_backend_relocate_section elf_s390_relocate_section #define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections #define elf_backend_init_index_section _bfd_elf_init_1_index_section -#define elf_backend_reloc_type_class elf_s390_reloc_type_class #define elf_backend_plt_sym_val elf_s390_plt_sym_val #define elf_backend_add_symbol_hook elf_s390_add_symbol_hook diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index e9b76e5af3a..65e39070447 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -765,7 +765,9 @@ elf64_sparc_print_symbol_all (bfd *abfd ATTRIBUTE_UNUSED, void * filep, } static enum elf_reloc_type_class -elf64_sparc_reloc_type_class (const Elf_Internal_Rela *rela) +elf64_sparc_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF64_R_TYPE (rela->r_info)) { diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 3aeb4e66b89..1e43ff5022d 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -4666,7 +4666,9 @@ elf_x86_64_finish_local_dynamic_symbol (void **slot, void *inf) dynamic linker, before writing them out. */ static enum elf_reloc_type_class -elf_x86_64_reloc_type_class (const Elf_Internal_Rela *rela) +elf_x86_64_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELF32_R_TYPE (rela->r_info)) { diff --git a/bfd/elflink.c b/bfd/elflink.c index bb981388c66..38add1a98c2 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -8097,17 +8097,14 @@ elf_link_sort_cmp2 (const void *A, const void *B) { const struct elf_link_sort_rela *a = (const struct elf_link_sort_rela *) A; const struct elf_link_sort_rela *b = (const struct elf_link_sort_rela *) B; - int copya, copyb; - if (a->u.offset < b->u.offset) + if (a->type < b->type) return -1; - if (a->u.offset > b->u.offset) + if (a->type > b->type) return 1; - copya = (a->type == reloc_class_copy) * 2 + (a->type == reloc_class_plt); - copyb = (b->type == reloc_class_copy) * 2 + (b->type == reloc_class_plt); - if (copya < copyb) + if (a->u.offset < b->u.offset) return -1; - if (copya > copyb) + if (a->u.offset > b->u.offset) return 1; if (a->rela->r_offset < b->rela->r_offset) return -1; @@ -8334,7 +8331,7 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec) struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p; (*swap_in) (abfd, erel, s->rela); - s->type = (*bed->elf_backend_reloc_type_class) (s->rela); + s->type = (*bed->elf_backend_reloc_type_class) (info, o, s->rela); s->u.sym_mask = r_sym_mask; p += sort_elt; erel += ext_size; diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c index 9e46bbc28b4..8de94e4751a 100644 --- a/bfd/elfnn-ia64.c +++ b/bfd/elfnn-ia64.c @@ -4808,7 +4808,9 @@ elfNN_ia64_print_private_bfd_data (bfd *abfd, void * ptr) } static enum elf_reloc_type_class -elfNN_ia64_reloc_type_class (const Elf_Internal_Rela *rela) +elfNN_ia64_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) ELFNN_R_TYPE (rela->r_info)) { diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c index cd92bf9a875..accf34b33ce 100644 --- a/bfd/elfxx-tilegx.c +++ b/bfd/elfxx-tilegx.c @@ -4370,7 +4370,9 @@ tilegx_elf_plt_sym_val (bfd_vma i, const asection *plt, } enum elf_reloc_type_class -tilegx_reloc_type_class (const Elf_Internal_Rela *rela) +tilegx_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) { switch ((int) TILEGX_ELF_R_TYPE (rela->r_info)) { diff --git a/bfd/elfxx-tilegx.h b/bfd/elfxx-tilegx.h index 90ea5c89e7a..78900ad37cf 100644 --- a/bfd/elfxx-tilegx.h +++ b/bfd/elfxx-tilegx.h @@ -22,7 +22,9 @@ #include "elf/internal.h" extern enum elf_reloc_type_class -tilegx_reloc_type_class (const Elf_Internal_Rela *); +tilegx_reloc_type_class (const struct bfd_link_info *, + const asection *, + const Elf_Internal_Rela *); extern reloc_howto_type * tilegx_reloc_name_lookup (bfd *, const char *);