X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Felf-bfd.h;h=7309499119f02c878e8ea6c5fb3c669a9704fe4f;hb=595d3787e9cbedbceb6182f873a4774707c0e74f;hp=e051c9c0892b84cdacacc76707aa3f1d4ad3e5bb;hpb=34a87bb07a4a3b2202fc25167a6b0f12575edc87;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index e051c9c089..7309499119 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1,5 +1,5 @@ /* BFD back-end data structures for ELF files. - Copyright (C) 1992-2018 Free Software Foundation, Inc. + Copyright (C) 1992-2019 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -489,6 +489,7 @@ enum elf_target_id AVR_ELF_DATA, BFIN_ELF_DATA, CRIS_ELF_DATA, + CSKY_ELF_DATA, FRV_ELF_DATA, HPPA32_ELF_DATA, HPPA64_ELF_DATA, @@ -515,7 +516,6 @@ enum elf_target_id TIC6X_ELF_DATA, X86_64_ELF_DATA, XTENSA_ELF_DATA, - XGATE_ELF_DATA, TILEGX_ELF_DATA, TILEPRO_ELF_DATA, RISCV_ELF_DATA, @@ -529,6 +529,13 @@ struct elf_sym_strtab unsigned long destshndx_index; }; +struct bfd_link_needed_list +{ + struct bfd_link_needed_list *next; + bfd *by; + const char *name; +}; + /* ELF linker hash table. */ struct elf_link_hash_table @@ -543,6 +550,9 @@ struct elf_link_hash_table when linking against or generating a shared object. */ bfd_boolean dynamic_sections_created; + /* Whether dynamic relocations are present. */ + bfd_boolean dynamic_relocs; + /* True if this target has relocatable executables, so needs dynamic section symbols. */ bfd_boolean is_relocatable_executable; @@ -1138,10 +1148,9 @@ struct elf_backend_data (bfd *, struct bfd_link_info *); /* A function to do any final processing needed for the ELF file - before writing it out. The LINKER argument is TRUE if this BFD - was created by the ELF backend linker. */ - void (*elf_backend_final_write_processing) - (bfd *, bfd_boolean linker); + before writing it out. */ + bfd_boolean (*elf_backend_final_write_processing) + (bfd *); /* This function is called by get_program_header_size. It should return the number of additional program segments which this BFD @@ -1368,6 +1377,8 @@ struct elf_backend_data int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, bfd_size_type len)); + bfd_boolean (*elf_backend_core_find_build_id) (bfd *, bfd_vma); + /* This function is used by `_bfd_elf_get_synthetic_symtab'; see elf.c. */ bfd_vma (*plt_sym_val) (bfd_vma, const asection *, const arelent *); @@ -1390,6 +1401,13 @@ struct elf_backend_data /* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */ bfd_boolean (*elf_hash_symbol) (struct elf_link_hash_entry *); + /* If non-NULL, called to register the location of XLAT_LOC within + .MIPS.xhash at which real final dynindx for H will be written. + If XLAT_LOC is zero, the symbol is not included in + .MIPS.xhash and no dynindx will be written. */ + void (*record_xhash_symbol) + (struct elf_link_hash_entry *h, bfd_vma xlat_loc); + /* Return TRUE if type is a function symbol type. */ bfd_boolean (*is_function_type) (unsigned int type); @@ -1470,12 +1488,16 @@ struct elf_backend_data unsigned int); /* Merge GNU properties. Return TRUE if property is updated. */ - bfd_boolean (*merge_gnu_properties) (struct bfd_link_info *, bfd *, + bfd_boolean (*merge_gnu_properties) (struct bfd_link_info *, bfd *, bfd *, elf_property *, elf_property *); /* Set up GNU properties. */ bfd *(*setup_gnu_properties) (struct bfd_link_info *); + /* Fix up GNU properties. */ + void (*fixup_gnu_properties) (struct bfd_link_info *, + elf_property_list **); + /* Encoding used for compact EH tables. */ int (*compact_eh_encoding) (struct bfd_link_info *); @@ -1696,17 +1718,20 @@ struct bfd_elf_section_data /* The value of an object attribute. The type indicates whether the attribute holds and integer, a string, or both. It can also indicate that there can - be no default (i.e. all values must be written to file, even zero). */ + be no default (i.e. all values must be written to file, even zero), or + that the value is in error and should not be written to file. */ typedef struct obj_attribute { #define ATTR_TYPE_FLAG_INT_VAL (1 << 0) #define ATTR_TYPE_FLAG_STR_VAL (1 << 1) #define ATTR_TYPE_FLAG_NO_DEFAULT (1 << 2) +#define ATTR_TYPE_FLAG_ERROR (1 << 3) #define ATTR_TYPE_HAS_INT_VAL(TYPE) ((TYPE) & ATTR_TYPE_FLAG_INT_VAL) #define ATTR_TYPE_HAS_STR_VAL(TYPE) ((TYPE) & ATTR_TYPE_FLAG_STR_VAL) #define ATTR_TYPE_HAS_NO_DEFAULT(TYPE) ((TYPE) & ATTR_TYPE_FLAG_NO_DEFAULT) +#define ATTR_TYPE_HAS_ERROR(TYPE) ((TYPE) & ATTR_TYPE_FLAG_ERROR) int type; unsigned int i; @@ -1791,24 +1816,18 @@ struct output_elf_obj_tdata /* Segment flags for the PT_GNU_STACK segment. */ unsigned int stack_flags; - /* This is set to TRUE if the object was created by the backend - linker. */ - bfd_boolean linker; - /* Used to determine if the e_flags field has been initialized */ bfd_boolean flags_init; }; -/* 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 +/* Indicate if the bfd contains SHF_GNU_MBIND sections or 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_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_mbind = 1 << 0, + elf_gnu_osabi_ifunc = 1 << 1, + elf_gnu_osabi_unique = 1 << 2, }; typedef struct elf_section_list @@ -1818,6 +1837,14 @@ typedef struct elf_section_list struct elf_section_list * next; } elf_section_list; +enum dynamic_lib_link_class { + DYN_NORMAL = 0, + DYN_AS_NEEDED = 1, + DYN_DT_NEEDED = 2, + DYN_NO_ADD_NEEDED = 4, + DYN_NO_NEEDED = 8 +}; + /* Some private data is stashed away for future use using the tdata pointer in the bfd structure. */ @@ -1929,9 +1956,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. */ @@ -1961,7 +1987,6 @@ struct elf_obj_tdata #define elf_seg_map(bfd) (elf_tdata(bfd) -> o->seg_map) #define elf_next_file_pos(bfd) (elf_tdata(bfd) -> o->next_file_pos) #define elf_eh_frame_hdr(bfd) (elf_tdata(bfd) -> o->eh_frame_hdr) -#define elf_linker(bfd) (elf_tdata(bfd) -> o->linker) #define elf_stack_flags(bfd) (elf_tdata(bfd) -> o->stack_flags) #define elf_shstrtab(bfd) (elf_tdata(bfd) -> o->strtab_ptr) #define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section) @@ -2028,6 +2053,7 @@ extern char *bfd_elf_string_from_elf_section extern Elf_Internal_Sym *bfd_elf_get_elf_syms (bfd *, Elf_Internal_Shdr *, size_t, size_t, Elf_Internal_Sym *, void *, Elf_External_Sym_Shndx *); +extern char * bfd_elf_get_str_section (bfd *, unsigned int); extern const char *bfd_elf_sym_name (bfd *, Elf_Internal_Shdr *, Elf_Internal_Sym *, asection *); @@ -2103,6 +2129,8 @@ extern bfd_boolean _bfd_elf_match_sections_by_type (bfd *, const asection *, bfd *, const asection *); extern bfd_boolean bfd_elf_is_group_section (bfd *, const struct bfd_section *); +extern const char *bfd_elf_group_name + (bfd *, const struct bfd_section *); extern bfd_boolean _bfd_elf_section_already_linked (bfd *, asection *, struct bfd_link_info *); extern void bfd_elf_set_group_contents @@ -2186,6 +2214,9 @@ extern const struct bfd_elf_special_section *_bfd_elf_get_special_section extern const struct bfd_elf_special_section *_bfd_elf_get_sec_type_attr (bfd *, asection *); +extern bfd_boolean _bfd_elf_link_hide_sym_by_version + (struct bfd_link_info *, struct elf_link_hash_entry *); + /* If the target doesn't have reloc handling written yet: */ extern bfd_boolean _bfd_elf_no_info_to_howto (bfd *, arelent *, Elf_Internal_Rela *); @@ -2223,8 +2254,12 @@ extern void _bfd_elf_strtab_restore (struct elf_strtab_hash *, void *); extern bfd_size_type _bfd_elf_strtab_size (struct elf_strtab_hash *); +extern bfd_size_type _bfd_elf_strtab_len + (struct elf_strtab_hash *); extern bfd_size_type _bfd_elf_strtab_offset (struct elf_strtab_hash *, size_t); +extern const char * _bfd_elf_strtab_str + (struct elf_strtab_hash *, size_t idx, bfd_size_type *offset); extern bfd_boolean _bfd_elf_strtab_emit (bfd *, struct elf_strtab_hash *); extern void _bfd_elf_strtab_finalize @@ -2274,6 +2309,37 @@ extern file_ptr _bfd_elf_assign_file_position_for_section extern bfd_boolean _bfd_elf_validate_reloc (bfd *, arelent *); +extern bfd_boolean bfd_elf_record_link_assignment + (bfd *, struct bfd_link_info *, const char *, bfd_boolean, + bfd_boolean); +extern bfd_boolean bfd_elf_stack_segment_size (bfd *, struct bfd_link_info *, + const char *, bfd_vma); +extern bfd_boolean bfd_elf_size_dynamic_sections + (bfd *, const char *, const char *, const char *, const char *, const char *, + const char * const *, struct bfd_link_info *, struct bfd_section **); +extern bfd_boolean bfd_elf_size_dynsym_hash_dynstr + (bfd *, struct bfd_link_info *); +extern bfd_boolean bfd_elf_get_bfd_needed_list + (bfd *, struct bfd_link_needed_list **); +extern struct bfd_link_needed_list *bfd_elf_get_needed_list + (bfd *, struct bfd_link_info *); +extern void bfd_elf_set_dt_needed_name + (bfd *, const char *); +extern const char *bfd_elf_get_dt_soname + (bfd *); +extern void bfd_elf_set_dyn_lib_class + (bfd *, enum dynamic_lib_link_class); +extern int bfd_elf_get_dyn_lib_class + (bfd *); +extern struct bfd_link_needed_list *bfd_elf_get_runpath_list + (bfd *, struct bfd_link_info *); +extern int bfd_elf_discard_info + (bfd *, struct bfd_link_info *); +extern unsigned int _bfd_elf_default_action_discarded + (struct bfd_section *); +extern struct bfd_section *_bfd_elf_tls_setup + (bfd *, struct bfd_link_info *); + extern bfd_boolean _bfd_elf_link_create_dynamic_sections (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_elf_omit_section_dynsym_default @@ -2323,7 +2389,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 bfd_boolean _bfd_elf_final_write_processing (bfd *); extern const bfd_target *bfd_elf32_object_p (bfd *); @@ -2337,6 +2405,8 @@ extern bfd_boolean bfd_elf32_core_file_matches_executable_p (bfd *, bfd *); extern int bfd_elf32_core_file_pid (bfd *); +extern bfd_boolean _bfd_elf32_core_find_build_id + (bfd *, bfd_vma); extern bfd_boolean bfd_elf32_swap_symbol_in (bfd *, const void *, const void *, Elf_Internal_Sym *); @@ -2383,6 +2453,8 @@ extern bfd_boolean bfd_elf64_core_file_matches_executable_p (bfd *, bfd *); extern int bfd_elf64_core_file_pid (bfd *); +extern bfd_boolean _bfd_elf64_core_find_build_id + (bfd *, bfd_vma); extern bfd_boolean bfd_elf64_swap_symbol_in (bfd *, const void *, const void *, Elf_Internal_Sym *); @@ -2539,7 +2611,24 @@ extern unsigned int _bfd_elf_ppc_at_tprel_transform /* PowerPC elf_object_p tweak. */ extern bfd_boolean _bfd_elf_ppc_set_arch (bfd *); /* PowerPC .gnu.attributes handling common to both 32-bit and 64-bit. */ -extern void _bfd_elf_ppc_merge_fp_attributes (bfd *, struct bfd_link_info *); +extern bfd_boolean _bfd_elf_ppc_merge_fp_attributes + (bfd *, struct bfd_link_info *); + +/* Return an upper bound on the number of bytes required to store a + copy of ABFD's program header table entries. Return -1 if an error + occurs; bfd_get_error will return an appropriate code. */ +extern long bfd_get_elf_phdr_upper_bound + (bfd *abfd); + +/* Copy ABFD's program header table entries to *PHDRS. The entries + will be stored as an array of Elf_Internal_Phdr structures, as + defined in include/elf/internal.h. To find out how large the + buffer needs to be, call bfd_get_elf_phdr_upper_bound. + + Return the number of program header table entries read, or -1 if an + error occurs; bfd_get_error will return an appropriate code. */ +extern int bfd_get_elf_phdrs + (bfd *abfd, void *phdrs); /* Exported interface for writing elf corefile notes. */ extern char *elfcore_write_note @@ -2560,6 +2649,32 @@ extern char *elfcore_write_ppc_vmx (bfd *, char *, int *, const void *, int); extern char *elfcore_write_ppc_vsx (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_ppc_tar + (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_ppc_ppr + (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_ppc_dscr + (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_ppc_ebb + (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_ppc_pmu + (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_ppc_tm_cgpr + (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_ppc_tm_cfpr + (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_ppc_tm_cvmx + (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_ppc_tm_cvsx + (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_ppc_tm_spr + (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_ppc_tm_ctar + (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_ppc_tm_cppr + (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_ppc_tm_cdscr + (bfd *, char *, int *, const void *, int); extern char *elfcore_write_s390_timer (bfd *, char *, int *, const void *, int); extern char *elfcore_write_s390_todcmp @@ -2592,6 +2707,10 @@ extern char *elfcore_write_aarch_hw_break (bfd *, char *, int *, const void *, int); extern char *elfcore_write_aarch_hw_watch (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_aarch_sve + (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_aarch_pauth + (bfd *, char *, int *, const void *, int); extern char *elfcore_write_lwpstatus (bfd *, char *, int *, long, int, const void *); extern char *elfcore_write_register_note @@ -2660,6 +2779,7 @@ extern bfd_boolean _bfd_elf_merge_object_attributes extern bfd_boolean _bfd_elf_merge_unknown_attribute_low (bfd *, bfd *, int); extern bfd_boolean _bfd_elf_merge_unknown_attribute_list (bfd *, bfd *); extern Elf_Internal_Shdr *_bfd_elf_single_rel_hdr (asection *sec); +extern bfd_boolean elf_read_notes (bfd *, file_ptr, bfd_size_type, size_t); extern bfd_boolean _bfd_elf_parse_gnu_properties (bfd *, Elf_Internal_Note *); @@ -2667,6 +2787,10 @@ extern elf_property * _bfd_elf_get_property (bfd *, unsigned int, unsigned int); extern bfd *_bfd_elf_link_setup_gnu_properties (struct bfd_link_info *); +extern bfd_size_type _bfd_elf_convert_gnu_property_size + (bfd *, bfd *); +extern bfd_boolean _bfd_elf_convert_gnu_properties + (bfd *, asection *, bfd *, bfd_byte **, bfd_size_type *); /* The linker may need to keep track of the number of relocs that it decides to copy as dynamic relocs in check_relocs for each symbol. @@ -2703,6 +2827,8 @@ extern bfd_vma elf64_r_sym (bfd_vma); extern bfd_vma elf32_r_info (bfd_vma, bfd_vma); extern bfd_vma elf32_r_sym (bfd_vma); +extern bfd_boolean is_debuginfo_file (bfd *); + /* Large common section. */ extern asection _bfd_elf_large_com_section; @@ -2801,7 +2927,7 @@ extern asection _bfd_elf_large_com_section; { \ int i_; \ _bfd_clear_contents (howto, input_bfd, input_section, \ - contents + rel[index].r_offset); \ + contents, rel[index].r_offset); \ \ if (bfd_link_relocatable (info) \ && (input_section->flags & SEC_DEBUGGING)) \ @@ -2846,6 +2972,14 @@ extern asection _bfd_elf_large_com_section; || (H)->start_stop \ || ((INFO)->dynamic && !(H)->dynamic))) +/* Determine if a section contains CTF data, using its name. */ +static inline bfd_boolean +bfd_section_is_ctf (const asection *sec) +{ + const char *name = bfd_section_name (sec); + return strncmp (name, ".ctf", 4) == 0 && (name[4] == 0 || name[4] == '.'); +} + #ifdef __cplusplus } #endif