aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf-bfd.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-04-12 17:16:03 +0930
committerAlan Modra <amodra@gmail.com>2021-04-12 21:19:02 +0930
commit2cc15b10e5ce606e8348b7cf9b89ec06541231c5 (patch)
tree583cb501aed91a00ff9d41c3ce46a3eef8e3e843 /bfd/elf-bfd.h
parentb585e899960202fbe3c137cbf765f75b088592fe (diff)
downloadgdb-2cc15b10e5ce606e8348b7cf9b89ec06541231c5.zip
gdb-2cc15b10e5ce606e8348b7cf9b89ec06541231c5.tar.gz
gdb-2cc15b10e5ce606e8348b7cf9b89ec06541231c5.tar.bz2
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.
Diffstat (limited to 'bfd/elf-bfd.h')
-rw-r--r--bfd/elf-bfd.h49
1 files changed, 34 insertions, 15 deletions
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 6f9d737..e0b7e57 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -707,30 +707,49 @@ struct elf_link_hash_table
asection *dynsym;
};
+/* Returns TRUE if the hash table is a struct elf_link_hash_table. */
+
+static inline bool
+is_elf_hash_table (const struct bfd_link_hash_table *htab)
+{
+ return htab->type == bfd_link_elf_hash_table;
+}
+
/* Look up an entry in an ELF linker hash table. */
-#define elf_link_hash_lookup(table, string, create, copy, follow) \
- ((struct elf_link_hash_entry *) \
- bfd_link_hash_lookup (&(table)->root, (string), (create), \
- (copy), (follow)))
+static inline struct elf_link_hash_entry *
+elf_link_hash_lookup (struct elf_link_hash_table *table, const char *string,
+ bool create, bool copy, bool follow)
+{
+ return (struct elf_link_hash_entry *)
+ bfd_link_hash_lookup (&table->root, string, create, copy, follow);
+}
/* Traverse an ELF linker hash table. */
-#define elf_link_hash_traverse(table, func, info) \
- (bfd_link_hash_traverse \
- (&(table)->root, \
- (bool (*) (struct bfd_link_hash_entry *, void *)) (func), \
- (info)))
+static inline void
+elf_link_hash_traverse (struct elf_link_hash_table *table,
+ bool (*f) (struct elf_link_hash_entry *, void *),
+ void *info)
+{
+ bfd_link_hash_traverse (&table->root,
+ (bool (*) (struct bfd_link_hash_entry *, void *)) f,
+ info);
+}
/* Get the ELF linker hash table from a link_info structure. */
-#define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
-
-#define elf_hash_table_id(table) ((table) -> hash_table_id)
+static inline struct elf_link_hash_table *
+elf_hash_table (const struct bfd_link_info *info)
+{
+ return (struct elf_link_hash_table *) info->hash;
+}
-/* Returns TRUE if the hash table is a struct elf_link_hash_table. */
-#define is_elf_hash_table(htab) \
- (((struct bfd_link_hash_table *) (htab))->type == bfd_link_elf_hash_table)
+static inline enum elf_target_id
+elf_hash_table_id (const struct elf_link_hash_table *table)
+{
+ return table->hash_table_id;
+}
/* Constant information held for an ELF backend. */