From 2cc15b10e5ce606e8348b7cf9b89ec06541231c5 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 12 Apr 2021 17:16:03 +0930 Subject: convert elf_link_hash macros to inline functions Involves a bit of editing as we now need to be more precise in pointer types. bfd/ * elf-bfd.h (is_elf_hash_table): Convert macro to inline function. (elf_link_hash_lookup, elf_link_hash_traverse): Likewise. (elf_hash_table, elf_hash_table_id): Likewise. * elf32-arm.c (elf32_arm_setup_section_lists): Delete redundant is_elf_hash_table check. * elf32-csky.c (elf32_csky_setup_section_lists): Likewise. * elf32-hppa.c (clobber_millicode_symbols): Correct param types. * elf64-alpha.c (elf64_alpha_output_extsym): Likewise. * elfnn-ia64.c (elfNN_ia64_global_dyn_info_free: Likewise. (elfNN_ia64_global_dyn_sym_thunk: Likewise. * elf64-ia64-vms.c (elf64_ia64_global_dyn_info_free): Likewise. (elf64_ia64_global_dyn_sym_thunk): Likewise. (elf64_vms_link_add_object_symbols): Pass base type of hash table to is_elf_hash_table. * elflink.c (_bfd_elf_dynamic_symbol_p): Likewise. (_bfd_elf_symbol_refs_local_p, _bfd_elf_add_dynamic_entry): Likewise. (_bfd_elf_strip_zero_sized_dynamic_sections): Likewise. (_bfd_elf_link_check_relocs, elf_link_add_object_symbols): Likewise. (bfd_elf_final_link): Likewise. * elfnn-aarch64.c (elfNN_aarch64_setup_section_lists): Likewise. * elf64-ppc.c (ppc64_elf_set_toc): Likewise. Use bfd_link_hash_lookup. ld/ * emultempl/mipself.em (mips_create_output_section_statements): Pass base type of hash table to is_elf_hash_table. * ldelf.c (ldelf_after_open): Likewise. --- bfd/elf64-ppc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'bfd/elf64-ppc.c') diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 7873f97ab3..08227f0e43 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -13955,19 +13955,20 @@ ppc64_elf_set_toc (struct bfd_link_info *info, bfd *obfd) struct elf_link_hash_entry *h; struct elf_link_hash_table *htab = elf_hash_table (info); - if (is_elf_hash_table (htab) + if (is_elf_hash_table (&htab->root) && htab->hgot != NULL) h = htab->hgot; else { - h = elf_link_hash_lookup (htab, ".TOC.", false, false, true); - if (is_elf_hash_table (htab)) + h = (struct elf_link_hash_entry *) + bfd_link_hash_lookup (&htab->root, ".TOC.", false, false, true); + if (is_elf_hash_table (&htab->root)) htab->hgot = h; } if (h != NULL && h->root.type == bfd_link_hash_defined && !h->root.linker_def - && (!is_elf_hash_table (htab) + && (!is_elf_hash_table (&htab->root) || h->def_regular)) { TOCstart = defined_sym_val (h) - TOC_BASE_OFF; -- cgit v1.2.3