diff options
author | Alan Modra <amodra@gmail.com> | 2021-03-29 09:39:15 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-03-29 11:22:21 +1030 |
commit | 37bb890f814d58dd4c5f67db32ea4618008229ee (patch) | |
tree | 96cac119eb97496b93bf83069ff0634dde3846b1 /bfd | |
parent | 0f68420117f805ecb51aa623867201f9d95a5ab7 (diff) | |
download | gdb-37bb890f814d58dd4c5f67db32ea4618008229ee.zip gdb-37bb890f814d58dd4c5f67db32ea4618008229ee.tar.gz gdb-37bb890f814d58dd4c5f67db32ea4618008229ee.tar.bz2 |
ELF output symbol hooks int vs. bfd_boolean
elf_backend_link_output_symbol_hook and elf_link_output_symstrtab may
return 2 when a symbol is to be discarded. Update places that use
bfd_boolean rather than int for these functions.
* elflink.c (elf_link_output_symstrtab): Make flinfo parameter
a void pointer.
(bfd_elf_final_link): Delete out_sym_func typedef and don't cast
elf_link_output_symstrtab when calling output_arch_syms and
output_arch_local_syms.
* elf-bfd.h (struct elf_backend_data <elf_backend_output_arch_syms,
elf_backend_output_arch_local_syms>): Change return type of func
arg to match elf_link_output_symstrtab.
* elf-vxworks.h (elf_vxworks_link_output_symbol_hook): Correct
return type.
* elf32-nds32.c (nds32_elf_output_symbol_hook): Correct return type.
(nds32_elf_output_arch_syms): Correct func return type.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 15 | ||||
-rw-r--r-- | bfd/elf-bfd.h | 8 | ||||
-rw-r--r-- | bfd/elf-vxworks.h | 2 | ||||
-rw-r--r-- | bfd/elf32-nds32.c | 10 | ||||
-rw-r--r-- | bfd/elflink.c | 17 |
5 files changed, 29 insertions, 23 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 1fbbe33..5cdb6c8 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,20 @@ 2021-03-29 Alan Modra <amodra@gmail.com> + * elflink.c (elf_link_output_symstrtab): Make flinfo parameter + a void pointer. + (bfd_elf_final_link): Delete out_sym_func typedef and don't cast + elf_link_output_symstrtab when calling output_arch_syms and + output_arch_local_syms. + * elf-bfd.h (struct elf_backend_data <elf_backend_output_arch_syms, + elf_backend_output_arch_local_syms>): Change return type of func + arg to match elf_link_output_symstrtab. + * elf-vxworks.h (elf_vxworks_link_output_symbol_hook): Correct + return type. + * elf32-nds32.c (nds32_elf_output_symbol_hook): Correct return type. + (nds32_elf_output_arch_syms): Correct func return type. + +2021-03-29 Alan Modra <amodra@gmail.com> + * elf-m10200.c (mn10200_elf_relocate_section): Return int. * elf-m10300.c (mn10300_elf_relocate_section): Likewise. * elf32-arc.c (elf_arc_relocate_section): Likewise. diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 04785a8..dec6925 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1259,16 +1259,16 @@ struct elf_backend_data not handled in the hash table. */ bfd_boolean (*elf_backend_output_arch_local_syms) (bfd *, struct bfd_link_info *, void *, - bfd_boolean (*) (void *, const char *, Elf_Internal_Sym *, asection *, - struct elf_link_hash_entry *)); + int (*) (void *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *)); /* This function, if defined, is called after all symbols are emitted into the symtab section. It allows the backend to emit special global symbols not handled in the hash table. */ bfd_boolean (*elf_backend_output_arch_syms) (bfd *, struct bfd_link_info *, void *, - bfd_boolean (*) (void *, const char *, Elf_Internal_Sym *, asection *, - struct elf_link_hash_entry *)); + int (*) (void *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *)); /* Filter what symbols of the output file to include in the import library if one is created. */ diff --git a/bfd/elf-vxworks.h b/bfd/elf-vxworks.h index dbdf1a5..d0207a7 100644 --- a/bfd/elf-vxworks.h +++ b/bfd/elf-vxworks.h @@ -22,7 +22,7 @@ bfd_boolean elf_vxworks_add_symbol_hook (bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *); -bfd_boolean elf_vxworks_link_output_symbol_hook +int elf_vxworks_link_output_symbol_hook (struct bfd_link_info *, const char *name, Elf_Internal_Sym *, asection *, struct elf_link_hash_entry *); bfd_boolean elf_vxworks_emit_relocs diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c index 0e63dfb..f6a89a7 100644 --- a/bfd/elf32-nds32.c +++ b/bfd/elf32-nds32.c @@ -4677,7 +4677,7 @@ nds32_elf_final_link_relocate (reloc_howto_type *howto, bfd *input_bfd, contents + address); } -static bfd_boolean +static int nds32_elf_output_symbol_hook (struct bfd_link_info *info, const char *name, Elf_Internal_Sym *elfsym ATTRIBUTE_UNUSED, @@ -12461,10 +12461,10 @@ static bfd_boolean nds32_elf_output_arch_syms (bfd *output_bfd ATTRIBUTE_UNUSED, struct bfd_link_info *info, void *finfo ATTRIBUTE_UNUSED, - bfd_boolean (*func) (void *, const char *, - Elf_Internal_Sym *, - asection *, - struct elf_link_hash_entry *) + int (*func) (void *, const char *, + Elf_Internal_Sym *, + asection *, + struct elf_link_hash_entry *) ATTRIBUTE_UNUSED) { FILE *sym_ld_script = NULL; diff --git a/bfd/elflink.c b/bfd/elflink.c index c5db406..6be14e7 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -9767,12 +9767,13 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec) /* Add a symbol to the output symbol string table. */ static int -elf_link_output_symstrtab (struct elf_final_link_info *flinfo, +elf_link_output_symstrtab (void *finf, const char *name, Elf_Internal_Sym *elfsym, asection *input_sec, struct elf_link_hash_entry *h) { + struct elf_final_link_info *flinfo = finf; int (*output_symbol_hook) (struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *, struct elf_link_hash_entry *); @@ -12662,13 +12663,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) if (bed->elf_backend_output_arch_local_syms && (info->strip != strip_all || emit_relocs)) { - typedef int (*out_sym_func) - (void *, const char *, Elf_Internal_Sym *, asection *, - struct elf_link_hash_entry *); - if (! ((*bed->elf_backend_output_arch_local_syms) - (abfd, info, &flinfo, - (out_sym_func) elf_link_output_symstrtab))) + (abfd, info, &flinfo, elf_link_output_symstrtab))) { ret = FALSE; goto return_local_hash_table; @@ -12796,13 +12792,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) if (bed->elf_backend_output_arch_syms && (info->strip != strip_all || emit_relocs)) { - typedef int (*out_sym_func) - (void *, const char *, Elf_Internal_Sym *, asection *, - struct elf_link_hash_entry *); - if (! ((*bed->elf_backend_output_arch_syms) - (abfd, info, &flinfo, - (out_sym_func) elf_link_output_symstrtab))) + (abfd, info, &flinfo, elf_link_output_symstrtab))) { ret = FALSE; goto return_local_hash_table; |