From: Alan Modra Date: Fri, 26 Mar 2004 06:13:40 +0000 (+0000) Subject: * elf64-ppc.c (elf_backend_add_symbol_hook): Define. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=555cd47695349e40eb1fe06ac707d2f278d63021;p=binutils-gdb.git * elf64-ppc.c (elf_backend_add_symbol_hook): Define. (ppc64_elf_add_symbol_hook): New function. * elf-bfd.h (struct elf_backend_data ): Remove const from Elf_Internal_Sym param. * elflink.c (elf_link_add_object_symbols): Adjust. * elf-hppa.h (elf_hppa_add_symbol_hook): Adjust. * elf32-frv.c (elf32_frv_add_symbol_hook): Adjust. * elf32-i370.c (elf_backend_add_symbol_hook): Adjust. * elf32-m32r.c (m32r_elf_add_symbol_hook): Adjust. * elf32-m68hc1x.c (elf32_m68hc11_add_symbol_hook): Adjust. * elf32-m68hc1x.h (elf32_m68hc11_add_symbol_hook): Adjust. * elf32-ppc.c (ppc_elf_add_symbol_hook): Adjust. * elf32-sh64.c (sh64_elf_add_symbol_hook): Adjust. * elf32-v850.c (v850_elf_add_symbol_hook): Adjust. * elf64-alpha.c (elf64_alpha_add_symbol_hook): Adjust. * elf64-mmix.c (mmix_elf_add_symbol_hook): Adjust. * elf64-sh64.c (sh64_elf64_add_symbol_hook): Adjust. * elf64-sparc.c (sparc64_elf_add_symbol_hook): Adjust. * elfxx-ia64.c (elfNN_ia64_add_symbol_hook): Adjust. * elfxx-mips.c (_bfd_mips_elf_add_symbol_hook): Adjust. * elfxx-mips.h (_bfd_mips_elf_add_symbol_hook): Adjust. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 3ccef116009..0b8b69cb016 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,27 @@ +2004-03-26 Alan Modra + + * elf64-ppc.c (elf_backend_add_symbol_hook): Define. + (ppc64_elf_add_symbol_hook): New function. + * elf-bfd.h (struct elf_backend_data ): Remove + const from Elf_Internal_Sym param. + * elflink.c (elf_link_add_object_symbols): Adjust. + * elf-hppa.h (elf_hppa_add_symbol_hook): Adjust. + * elf32-frv.c (elf32_frv_add_symbol_hook): Adjust. + * elf32-i370.c (elf_backend_add_symbol_hook): Adjust. + * elf32-m32r.c (m32r_elf_add_symbol_hook): Adjust. + * elf32-m68hc1x.c (elf32_m68hc11_add_symbol_hook): Adjust. + * elf32-m68hc1x.h (elf32_m68hc11_add_symbol_hook): Adjust. + * elf32-ppc.c (ppc_elf_add_symbol_hook): Adjust. + * elf32-sh64.c (sh64_elf_add_symbol_hook): Adjust. + * elf32-v850.c (v850_elf_add_symbol_hook): Adjust. + * elf64-alpha.c (elf64_alpha_add_symbol_hook): Adjust. + * elf64-mmix.c (mmix_elf_add_symbol_hook): Adjust. + * elf64-sh64.c (sh64_elf64_add_symbol_hook): Adjust. + * elf64-sparc.c (sparc64_elf_add_symbol_hook): Adjust. + * elfxx-ia64.c (elfNN_ia64_add_symbol_hook): Adjust. + * elfxx-mips.c (_bfd_mips_elf_add_symbol_hook): Adjust. + * elfxx-mips.h (_bfd_mips_elf_add_symbol_hook): Adjust. + 2004-03-26 Alan Modra * elfxx-target.h (bfd_elfNN_bfd_link_add_symbols): Define. diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 6b7730ae4a6..484a4923e15 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -625,7 +625,7 @@ struct elf_backend_data indices, and must set at least *FLAGS and *SEC for each processor dependent case; failure to do so will cause a link error. */ bfd_boolean (*elf_add_symbol_hook) - (bfd *abfd, struct bfd_link_info *info, const Elf_Internal_Sym *, + (bfd *abfd, struct bfd_link_info *info, Elf_Internal_Sym *, const char **name, flagword *flags, asection **sec, bfd_vma *value); /* If this field is not NULL, it is called by the elf_link_output_sym diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h index f5aba51e55f..534dd11453a 100644 --- a/bfd/elf-hppa.h +++ b/bfd/elf-hppa.h @@ -1,5 +1,6 @@ /* Common code for PA ELF implementations. - Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -1070,7 +1071,7 @@ static bfd_boolean elf_hppa_sort_unwind (bfd *abfd) static bfd_boolean elf_hppa_add_symbol_hook (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED, - const Elf_Internal_Sym *sym, + Elf_Internal_Sym *sym, const char **namep ATTRIBUTE_UNUSED, flagword *flagsp ATTRIBUTE_UNUSED, asection **secp, diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index 46a5ea4f7cd..039b4a3b479 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -52,7 +52,7 @@ static bfd_boolean elf32_frv_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); static bfd_boolean elf32_frv_add_symbol_hook - PARAMS (( bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, + PARAMS (( bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *)); static bfd_reloc_status_type frv_final_link_relocate PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, @@ -2584,7 +2584,7 @@ static bfd_boolean elf32_frv_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) bfd *abfd; struct bfd_link_info *info; - const Elf_Internal_Sym *sym; + Elf_Internal_Sym *sym; const char **namep ATTRIBUTE_UNUSED; flagword *flagsp ATTRIBUTE_UNUSED; asection **secp; diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c index dd84b2dc6f7..f7829250081 100644 --- a/bfd/elf32-i370.c +++ b/bfd/elf32-i370.c @@ -1548,7 +1548,7 @@ static int i370_noop () #define elf_backend_add_symbol_hook \ (bfd_boolean (*) \ - PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, \ + PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Sym *, \ const char **, flagword *, asection **, bfd_vma *))) i370_noop #define elf_backend_finish_dynamic_symbol \ (bfd_boolean (*) \ diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 605abcf83aa..812b3ca0451 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -51,7 +51,7 @@ bfd_boolean _bfd_m32r_elf_section_from_bfd_section void _bfd_m32r_elf_symbol_processing PARAMS ((bfd *, asymbol *)); static bfd_boolean m32r_elf_add_symbol_hook - PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, + PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *)); static bfd_boolean m32r_elf_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, @@ -1391,7 +1391,7 @@ static bfd_boolean m32r_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) bfd *abfd; struct bfd_link_info *info; - const Elf_Internal_Sym *sym; + Elf_Internal_Sym *sym; const char **namep; flagword *flagsp ATTRIBUTE_UNUSED; asection **secp; diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c index 00b75df0a7a..9de2f8b20e6 100644 --- a/bfd/elf32-m68hc1x.c +++ b/bfd/elf32-m68hc1x.c @@ -181,7 +181,7 @@ m68hc12_add_stub (const char *stub_name, asection *section, bfd_boolean elf32_m68hc11_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, - const Elf_Internal_Sym *sym, + Elf_Internal_Sym *sym, const char **namep ATTRIBUTE_UNUSED, flagword *flagsp ATTRIBUTE_UNUSED, asection **secp ATTRIBUTE_UNUSED, diff --git a/bfd/elf32-m68hc1x.h b/bfd/elf32-m68hc1x.h index 59640232d80..f6b2001a334 100644 --- a/bfd/elf32-m68hc1x.h +++ b/bfd/elf32-m68hc1x.h @@ -1,5 +1,5 @@ /* Motorola 68HC11/68HC12-specific support for 32-bit ELF - Copyright 2003 Free Software Foundation, Inc. + Copyright 2003, 2004 Free Software Foundation, Inc. Contributed by Stephane Carrez (stcarrez@nerim.fr) This file is part of BFD, the Binary File Descriptor library. @@ -178,7 +178,7 @@ bfd_boolean elf32_m68hc11_relocate_section bfd_boolean elf32_m68hc11_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, - const Elf_Internal_Sym *sym, const char **namep, + Elf_Internal_Sym *sym, const char **namep, flagword *flagsp, asection **secp, bfd_vma *valp); diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 019545463d9..515a9296b84 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -4376,7 +4376,7 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, static bfd_boolean ppc_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, - const Elf_Internal_Sym *sym, + Elf_Internal_Sym *sym, const char **namep ATTRIBUTE_UNUSED, flagword *flagsp ATTRIBUTE_UNUSED, asection **secp, diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c index eac444af462..f013e6fea8f 100644 --- a/bfd/elf32-sh64.c +++ b/bfd/elf32-sh64.c @@ -1,5 +1,5 @@ /* SuperH SH64-specific support for 32-bit ELF - Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -56,7 +56,7 @@ static bfd_boolean shmedia_prepare_reloc static int sh64_elf_get_symbol_type (Elf_Internal_Sym *, int); static bfd_boolean sh64_elf_add_symbol_hook - (bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, const char **, + (bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *); static bfd_boolean sh64_elf_link_output_symbol_hook (struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *, @@ -374,7 +374,7 @@ sh64_elf_get_symbol_type (Elf_Internal_Sym *elf_sym, int type) static bfd_boolean sh64_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, - const Elf_Internal_Sym *sym, const char **namep, + Elf_Internal_Sym *sym, const char **namep, flagword *flagsp ATTRIBUTE_UNUSED, asection **secp, bfd_vma *valp) { diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index 747095213e7..2aba9cd5a86 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -73,7 +73,7 @@ static bfd_boolean v850_elf_section_from_bfd_section static void v850_elf_symbol_processing PARAMS ((bfd *, asymbol *)); static bfd_boolean v850_elf_add_symbol_hook - PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, + PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *)); static bfd_boolean v850_elf_link_output_symbol_hook PARAMS ((struct bfd_link_info *, const char *, Elf_Internal_Sym *, @@ -2124,7 +2124,7 @@ static bfd_boolean v850_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) bfd *abfd; struct bfd_link_info *info ATTRIBUTE_UNUSED; - const Elf_Internal_Sym *sym; + Elf_Internal_Sym *sym; const char **namep ATTRIBUTE_UNUSED; flagword *flagsp ATTRIBUTE_UNUSED; asection **secp; diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index c84dddf71c3..1683683f775 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -123,7 +123,7 @@ static bfd_boolean elf64_alpha_size_rela_got_section static bfd_boolean elf64_alpha_size_rela_got_1 PARAMS ((struct alpha_elf_link_hash_entry *, struct bfd_link_info *)); static bfd_boolean elf64_alpha_add_symbol_hook - PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, + PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *)); static struct alpha_elf_got_entry *get_got_entry PARAMS ((bfd *, struct alpha_elf_link_hash_entry *, unsigned long, @@ -2363,7 +2363,7 @@ static bfd_boolean elf64_alpha_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) bfd *abfd; struct bfd_link_info *info; - const Elf_Internal_Sym *sym; + Elf_Internal_Sym *sym; const char **namep ATTRIBUTE_UNUSED; flagword *flagsp ATTRIBUTE_UNUSED; asection **secp; diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index 0e1da0650ec..7f34a83b679 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -205,7 +205,7 @@ static bfd_boolean mmix_elf_section_from_bfd_section PARAMS ((bfd *, asection *, int *)); static bfd_boolean mmix_elf_add_symbol_hook - PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, + PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *)); static bfd_boolean mmix_elf_is_local_label_name @@ -2175,7 +2175,7 @@ bfd_boolean mmix_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) bfd *abfd; struct bfd_link_info *info ATTRIBUTE_UNUSED; - const Elf_Internal_Sym *sym; + Elf_Internal_Sym *sym; const char **namep ATTRIBUTE_UNUSED; flagword *flagsp ATTRIBUTE_UNUSED; asection **secp; diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index cf15f929779..a2aebfea212 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -82,6 +82,7 @@ static bfd_reloc_status_type ppc64_elf_unhandled_reloc #define elf_backend_grok_psinfo ppc64_elf_grok_psinfo #define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections #define elf_backend_copy_indirect_symbol ppc64_elf_copy_indirect_symbol +#define elf_backend_add_symbol_hook ppc64_elf_add_symbol_hook #define elf_backend_check_relocs ppc64_elf_check_relocs #define elf_backend_gc_mark_hook ppc64_elf_gc_mark_hook #define elf_backend_gc_sweep_hook ppc64_elf_gc_sweep_hook @@ -3474,6 +3475,22 @@ ppc64_elf_mark_entry_syms (struct bfd_link_info *info) return TRUE; } +/* Hack symbols defined in .opd sections to be function type. */ + +static bfd_boolean +ppc64_elf_add_symbol_hook (bfd *ibfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + Elf_Internal_Sym *isym, + const char **name ATTRIBUTE_UNUSED, + flagword *flags ATTRIBUTE_UNUSED, + asection **sec, + bfd_vma *value ATTRIBUTE_UNUSED) +{ + if (strcmp (bfd_get_section_name (ibfd, *sec), ".opd") == 0) + isym->st_info = ELF_ST_INFO (ELF_ST_BIND (isym->st_info), STT_FUNC); + return TRUE; +} + static bfd_boolean update_local_sym_info (bfd *abfd, Elf_Internal_Shdr *symtab_hdr, unsigned long r_symndx, bfd_vma r_addend, int tls_type) diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index 652a4f8ac42..87b754e31bd 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -141,7 +141,7 @@ static bfd_boolean sh_elf64_check_relocs static int sh64_elf64_get_symbol_type (Elf_Internal_Sym *, int); static bfd_boolean sh64_elf64_add_symbol_hook - (bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, const char **, + (bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *); static bfd_boolean sh64_elf64_link_output_symbol_hook (struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *, @@ -2887,7 +2887,7 @@ sh64_elf64_get_symbol_type (Elf_Internal_Sym * elf_sym, int type) static bfd_boolean sh64_elf64_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, - const Elf_Internal_Sym *sym, const char **namep, + Elf_Internal_Sym *sym, const char **namep, flagword *flagsp ATTRIBUTE_UNUSED, asection **secp, bfd_vma *valp) { diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 219a434d803..6c9d302564e 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -61,7 +61,7 @@ static bfd_boolean sparc64_elf_size_dynamic_sections static int sparc64_elf_get_symbol_type PARAMS (( Elf_Internal_Sym *, int)); static bfd_boolean sparc64_elf_add_symbol_hook - PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, + PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *)); static bfd_boolean sparc64_elf_output_arch_syms PARAMS ((bfd *, struct bfd_link_info *, PTR, @@ -1385,7 +1385,7 @@ static bfd_boolean sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) bfd *abfd; struct bfd_link_info *info; - const Elf_Internal_Sym *sym; + Elf_Internal_Sym *sym; const char **namep; flagword *flagsp ATTRIBUTE_UNUSED; asection **secp ATTRIBUTE_UNUSED; diff --git a/bfd/elflink.c b/bfd/elflink.c index 61495fcc6da..a11e7cdea8d 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -2848,7 +2848,7 @@ static bfd_boolean elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) { bfd_boolean (*add_symbol_hook) - (bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, + (bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *); bfd_boolean (*check_relocs) (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index 27b5aa59f3c..c1d6622006e 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -192,7 +192,7 @@ static bfd_boolean elfNN_ia64_fake_sections static void elfNN_ia64_final_write_processing PARAMS ((bfd *abfd, bfd_boolean linker)); static bfd_boolean elfNN_ia64_add_symbol_hook - PARAMS ((bfd *abfd, struct bfd_link_info *info, const Elf_Internal_Sym *sym, + PARAMS ((bfd *abfd, struct bfd_link_info *info, Elf_Internal_Sym *sym, const char **namep, flagword *flagsp, asection **secp, bfd_vma *valp)); static int elfNN_ia64_additional_program_headers @@ -1430,7 +1430,7 @@ static bfd_boolean elfNN_ia64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) bfd *abfd; struct bfd_link_info *info; - const Elf_Internal_Sym *sym; + Elf_Internal_Sym *sym; const char **namep ATTRIBUTE_UNUSED; flagword *flagsp ATTRIBUTE_UNUSED; asection **secp; diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index b82e1093176..12eb566941f 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -4715,7 +4715,7 @@ _bfd_mips_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, - const Elf_Internal_Sym *sym, const char **namep, + Elf_Internal_Sym *sym, const char **namep, flagword *flagsp ATTRIBUTE_UNUSED, asection **secp, bfd_vma *valp) { diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h index 9e5d7afe427..0a684d90867 100644 --- a/bfd/elfxx-mips.h +++ b/bfd/elfxx-mips.h @@ -1,5 +1,5 @@ /* MIPS ELF specific backend routines. - Copyright 2002, 2003 Free Software Foundation, Inc. + Copyright 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -35,7 +35,7 @@ extern bfd_boolean _bfd_mips_elf_fake_sections extern bfd_boolean _bfd_mips_elf_section_from_bfd_section (bfd *, asection *, int *); extern bfd_boolean _bfd_mips_elf_add_symbol_hook - (bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, + (bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *); extern bfd_boolean _bfd_mips_elf_link_output_symbol_hook (struct bfd_link_info *, const char *, Elf_Internal_Sym *,