aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf-bfd.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-07-23 17:46:38 +0930
committerAlan Modra <amodra@gmail.com>2019-07-23 18:22:02 +0930
commit06f44071ccbeca33fff70b928b71d95a15982740 (patch)
treec96aae3c1815856852a99cb7dac89061a85a0af2 /bfd/elf-bfd.h
parentec49711a16785636a5b9eac3a92bd00382fcb1a9 (diff)
downloadgdb-06f44071ccbeca33fff70b928b71d95a15982740.zip
gdb-06f44071ccbeca33fff70b928b71d95a15982740.tar.gz
gdb-06f44071ccbeca33fff70b928b71d95a15982740.tar.bz2
ELF final_write_processing
Move setting of OSABI to final_write_processing, after symbols are written. This allows OSABI to be set based on symbols actually written to the output rather than assuming input symbols will be output. Corrects object files such as the one generated on powerpc64le-linux by ld-powerpc/pr23927.s which has a local STT_GNU_IFUNC symbol but prior to this patch the file was marked ELFOSABI_NONE. * elf-bfd.h (enum elf_gnu_osabi): Rename from elf_gnu_symbols. Remove none, any, all enums. (struct elf_obj_tdata): Rename has_gnu_symbols field to has_gnu_osabi. (_bfd_elf_final_write_processing): Declare. * elf.c (_bfd_elf_write_object_contents): Unconditionally call elf_backend_final_write_processing. (_bfd_elf_post_process_headers): Move body of function to.. (_bfd_elf_final_write_processing): ..here, but set EI_OSABI byte only when not already set. Adjust for rename. * elfxx-target.h (elf_backend_final_write_processing): Default to _bfd_elf_final_write_processing. * elf-hppa.h (elf_hppa_final_write_processing): Call _bfd_elf_final_write_processing. * elf-m10300.c (_bfd_mn10300_elf_final_write_processing): Likewise. * elf-nacl.c (nacl_final_write_processing): Likewise. * elf-vxworks.c (elf_vxworks_final_write_processing): Likewise. * elf32-arc.c (arc_elf_final_write_processing): Likewise. * elf32-avr.c (bfd_elf_avr_final_write_processing): Likewise. * elf32-bfin.c (elf32_bfin_final_write_processing): Likewise. * elf32-cr16.c (_bfd_cr16_elf_final_write_processing): Likewise. * elf32-cris.c (cris_elf_final_write_processing): Likewise. * elf32-h8300.c (elf32_h8_final_write_processing): Likewise. * elf32-lm32.c (lm32_elf_final_write_processing): Likewise. * elf32-m32r.c (m32r_elf_final_write_processing): Likewise. * elf32-m68k.c (elf_m68k_final_write_processing): Likewise. * elf32-msp430.c (bfd_elf_msp430_final_write_processing): Likewise. * elf32-nds32.c (nds32_elf_final_write_processing): Likewise. * elf32-or1k.c (or1k_elf_final_write_processing): Likewise. * elf32-pj.c (pj_elf_final_write_processing): Likewise. * elf32-v850.c (v850_elf_final_write_processing): Likewise. * elf32-xc16x.c (elf32_xc16x_final_write_processing): Likewise. * elf32-xtensa.c (elf_xtensa_final_write_processing): Likewise. * elf64-ia64-vms.c (elf64_vms_final_write_processing): Likewise. * elfnn-ia64.c (elfNN_ia64_final_write_processing): Likewise. * elf32-arm.c (arm_final_write_processing): Split out from.. (elf32_arm_final_write_processing): ..here. Call _bfd_elf_final_write_processing. (elf32_arm_nacl_final_write_processing): Adjust. * elfxx-mips.c (_bfd_mips_final_write_processing): Split out from.. (_bfd_mips_elf_final_write_processing): ..here. Call _bfd_elf_final_write_processing. * elfxx-mips.h (_bfd_mips_final_write_processing): Declare. * elf32-mips.c (mips_vxworks_final_write_processing): Adjust. * elf32-ppc.c (ppc_final_write_processing): Split out from.. (ppc_elf_final_write_processing): ..here. Call _bfd_elf_final_write_processing. (ppc_elf_vxworks_final_write_processing): Adjust. * elf32-sparc.c (sparc_final_write_processing): Split out from.. (elf32_sparc_final_write_processing): ..here. Call _bfd_elf_final_write_processing. (elf32_sparc_vxworks_final_write_processing): Adjust. * elf32-d10v.c (elf_backend_final_write_processing): Don't define. * elf32-d30v.c (elf_backend_final_write_processing): Don't define. * elf32-m68hc11.c (elf_backend_final_write_processing): Don't define. * elf32-m68hc12.c (elf_backend_final_write_processing): Don't define. * elf32-s12z.c (elf_backend_final_write_processing): Don't define. * elf32-i386.c (elf_i386_check_relocs): Don't set has_gnu_symbols. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise. * elflink.c (elf_link_add_object_symbols): Likewise. (elf_link_output_symstrtab): Set has_gnu_osabi for symbols here instead.
Diffstat (limited to 'bfd/elf-bfd.h')
-rw-r--r--bfd/elf-bfd.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index a6a831b..134496e 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1812,13 +1812,10 @@ struct output_elf_obj_tdata
/* Indicate if the bfd contains symbols that have the STT_GNU_IFUNC
symbol type or STB_GNU_UNIQUE binding. Used to set the osabi
field in the ELF header structure. */
-enum elf_gnu_symbols
+enum elf_gnu_osabi
{
- elf_gnu_symbol_none = 0,
- elf_gnu_symbol_any = 1 << 0,
- elf_gnu_symbol_ifunc = (elf_gnu_symbol_any | 1 << 1),
- elf_gnu_symbol_unique = (elf_gnu_symbol_any | 1 << 2),
- elf_gnu_symbol_all = (elf_gnu_symbol_ifunc | elf_gnu_symbol_unique)
+ elf_gnu_osabi_ifunc = 1 << 1,
+ elf_gnu_osabi_unique = 1 << 2,
};
typedef struct elf_section_list
@@ -1939,9 +1936,8 @@ struct elf_obj_tdata
or was found via a DT_NEEDED entry. */
ENUM_BITFIELD (dynamic_lib_link_class) dyn_lib_class : 4;
- /* Whether if the bfd contains symbols that have the STT_GNU_IFUNC
- symbol type or STB_GNU_UNIQUE binding. */
- ENUM_BITFIELD (elf_gnu_symbols) has_gnu_symbols : 3;
+ /* Whether the bfd uses OS specific bits that require ELFOSABI_GNU. */
+ ENUM_BITFIELD (elf_gnu_osabi) has_gnu_osabi : 3;
/* Whether if the bfd contains the GNU_PROPERTY_NO_COPY_ON_PROTECTED
property. */
@@ -2336,7 +2332,9 @@ extern bfd_boolean _bfd_elf_setup_sections
extern struct bfd_link_hash_entry *bfd_elf_define_start_stop
(struct bfd_link_info *, const char *, asection *);
-extern void _bfd_elf_post_process_headers (bfd * , struct bfd_link_info *);
+extern void _bfd_elf_post_process_headers (bfd *, struct bfd_link_info *);
+
+extern void _bfd_elf_final_write_processing (bfd *, bfd_boolean);
extern const bfd_target *bfd_elf32_object_p
(bfd *);