📄 elf-bfd.h
字号:
int elf_machine_code; /* The maximum page size for this backend. */ bfd_vma maxpagesize; /* A function to translate an ELF RELA relocation to a BFD arelent structure. */ void (*elf_info_to_howto) PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); /* A function to translate an ELF REL relocation to a BFD arelent structure. */ void (*elf_info_to_howto_rel) PARAMS ((bfd *, arelent *, Elf_Internal_Rel *)); /* A function to determine whether a symbol is global when partitioning the symbol table into local and global symbols. This should be NULL for most targets, in which case the correct thing will be done. MIPS ELF, at least on the Irix 5, has special requirements. */ boolean (*elf_backend_sym_is_global) PARAMS ((bfd *, asymbol *)); /* The remaining functions are hooks which are called only if they are not NULL. */ /* A function to permit a backend specific check on whether a particular BFD format is relevant for an object file, and to permit the backend to set any global information it wishes. When this is called elf_elfheader is set, but anything else should be used with caution. If this returns false, the check_format routine will return a bfd_error_wrong_format error. */ boolean (*elf_backend_object_p) PARAMS ((bfd *)); /* A function to do additional symbol processing when reading the ELF symbol table. This is where any processor-specific special section indices are handled. */ void (*elf_backend_symbol_processing) PARAMS ((bfd *, asymbol *)); /* A function to do additional symbol processing after reading the entire ELF symbol table. */ boolean (*elf_backend_symbol_table_processing) PARAMS ((bfd *, elf_symbol_type *, unsigned int)); /* A function to set the type of the info field. Processor-specific types should be handled here. */ int (*elf_backend_get_symbol_type) PARAMS (( Elf_Internal_Sym *, int)); /* A function to do additional processing on the ELF section header just before writing it out. This is used to set the flags and type fields for some sections, or to actually write out data for unusual sections. */ boolean (*elf_backend_section_processing) PARAMS ((bfd *, Elf32_Internal_Shdr *)); /* A function to handle unusual section types when creating BFD sections from ELF sections. */ boolean (*elf_backend_section_from_shdr) PARAMS ((bfd *, Elf32_Internal_Shdr *, char *)); /* A function to convert machine dependent section header flags to BFD internal section header flags. */ boolean (*elf_backend_section_flags) PARAMS ((flagword *, Elf32_Internal_Shdr *)); /* A function to handle unusual program segment types when creating BFD sections from ELF program segments. */ boolean (*elf_backend_section_from_phdr) PARAMS ((bfd *, Elf32_Internal_Phdr *, int)); /* A function to set up the ELF section header for a BFD section in preparation for writing it out. This is where the flags and type fields are set for unusual sections. */ boolean (*elf_backend_fake_sections) PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *)); /* A function to get the ELF section index for a BFD section. If this returns true, the section was found. If it is a normal ELF section, *RETVAL should be left unchanged. If it is not a normal ELF section *RETVAL should be set to the SHN_xxxx index. */ boolean (*elf_backend_section_from_bfd_section) PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *retval)); /* If this field is not NULL, it is called by the add_symbols phase of a link just before adding a symbol to the global linker hash table. It may modify any of the fields as it wishes. If *NAME is set to NULL, the symbol will be skipped rather than being added to the hash table. This function is responsible for handling all processor dependent symbol bindings and section indices, and must set at least *FLAGS and *SEC for each processor dependent case; failure to do so will cause a link error. */ boolean (*elf_add_symbol_hook) PARAMS ((bfd *abfd, struct bfd_link_info *info, const 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 phase of a link for each symbol which will appear in the object file. */ boolean (*elf_backend_link_output_symbol_hook) PARAMS ((bfd *, struct bfd_link_info *info, const char *, Elf_Internal_Sym *, asection *)); /* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend linker the first time it encounters a dynamic object in the link. This function must create any sections required for dynamic linking. The ABFD argument is a dynamic object. The .interp, .dynamic, .dynsym, .dynstr, and .hash functions have already been created, and this function may modify the section flags if desired. This function will normally create the .got and .plt sections, but different backends have different requirements. */ boolean (*elf_backend_create_dynamic_sections) PARAMS ((bfd *abfd, struct bfd_link_info *info)); /* The CHECK_RELOCS function is called by the add_symbols phase of the ELF backend linker. It is called once for each section with relocs of an object file, just after the symbols for the object file have been added to the global linker hash table. The function must look through the relocs and do any special handling required. This generally means allocating space in the global offset table, and perhaps allocating space for a reloc. The relocs are always passed as Rela structures; if the section actually uses Rel structures, the r_addend field will always be zero. */ boolean (*check_relocs) PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o, const Elf_Internal_Rela *relocs)); /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend linker for every symbol which is defined by a dynamic object and referenced by a regular object. This is called after all the input files have been seen, but before the SIZE_DYNAMIC_SECTIONS function has been called. The hash table entry should be bfd_link_hash_defined ore bfd_link_hash_defweak, and it should be defined in a section from a dynamic object. Dynamic object sections are not included in the final link, and this function is responsible for changing the value to something which the rest of the link can deal with. This will normally involve adding an entry to the .plt or .got or some such section, and setting the symbol to point to that. */ boolean (*elf_backend_adjust_dynamic_symbol) PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *h)); /* The ALWAYS_SIZE_SECTIONS function is called by the backend linker after all the linker input files have been seen but before the section sizes have been set. This is called after ADJUST_DYNAMIC_SYMBOL, but before SIZE_DYNAMIC_SECTIONS. */ boolean (*elf_backend_always_size_sections) PARAMS ((bfd *output_bfd, struct bfd_link_info *info)); /* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend linker after all the linker input files have been seen but before the sections sizes have been set. This is called after ADJUST_DYNAMIC_SYMBOL has been called on all appropriate symbols. It is only called when linking against a dynamic object. It must set the sizes of the dynamic sections, and may fill in their contents as well. The generic ELF linker can handle the .dynsym, .dynstr and .hash sections. This function must handle the .interp section and any sections created by the CREATE_DYNAMIC_SECTIONS entry point. */ boolean (*elf_backend_size_dynamic_sections) PARAMS ((bfd *output_bfd, struct bfd_link_info *info)); /* The RELOCATE_SECTION function is called by the ELF backend linker to handle the relocations for a section. The relocs are always passed as Rela structures; if the section actually uses Rel structures, the r_addend field will always be zero. This function is responsible for adjust the section contents as necessary, and (if using Rela relocs and generating a relocateable output file) adjusting the reloc addend as necessary. This function does not have to worry about setting the reloc address or the reloc symbol index. LOCAL_SYMS is a pointer to the swapped in local symbols. LOCAL_SECTIONS is an array giving the section in the input file corresponding to the st_shndx field of each local symbol. The global hash table entry for the global symbols can be found via elf_sym_hashes (input_bfd). When generating relocateable output, this function must handle STB_LOCAL/STT_SECTION symbols specially. The output symbol is going to be the section symbol corresponding to the output section, which means that the addend must be adjusted accordingly. */ boolean (*elf_backend_relocate_section) PARAMS ((bfd *output_bfd, struct bfd_link_info *info, bfd *input_bfd, asection *input_section, bfd_byte *contents, Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms, asection **local_sections)); /* The FINISH_DYNAMIC_SYMBOL function is called by the ELF backend linker just before it writes a symbol out to the .dynsym section. The processor backend may make any required adjustment to the symbol. It may also take the opportunity to set contents of the dynamic sections. Note that FINISH_DYNAMIC_SYMBOL is called on all .dynsym symbols, while ADJUST_DYNAMIC_SYMBOL is only called on those symbols which are defined by a dynamic object. */ boolean (*elf_backend_finish_dynamic_symbol) PARAMS ((bfd *output_bfd, struct bfd_link_info *info, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym)); /* The FINISH_DYNAMIC_SECTIONS function is called by the ELF backend linker just before it writes all the dynamic sections out to the output file. The FINISH_DYNAMIC_SYMBOL will have been called on all dynamic symbols. */ boolean (*elf_backend_finish_dynamic_sections) PARAMS ((bfd *output_bfd, struct bfd_link_info *info)); /* A function to do any beginning processing needed for the ELF file before building the ELF headers and computing file positions. */ void (*elf_backend_begin_write_processing) PARAMS ((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) PARAMS ((bfd *, boolean linker)); /* This function is called by get_program_header_size. It should return the number of additional program segments which this BFD will need. It should return -1 on error. */ int (*elf_backend_additional_program_headers) PARAMS ((bfd *)); /* This function is called to modify an existing segment map in a backend specific fashion. */ boolean (*elf_backend_modify_segment_map) PARAMS ((bfd *)); /* This function is called during section gc to discover the section a particular relocation refers to. It need not be defined for hosts that have no queer relocation types. */ asection * (*gc_mark_hook) PARAMS ((bfd *abfd, struct bfd_link_info *, Elf_Internal_Rela *, struct elf_link_hash_entry *h, Elf_Internal_Sym *)); /* This function, if defined, is called during the sweep phase of gc in order that a backend might update any data structures it might be maintaining. */ boolean (*gc_sweep_hook) PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o, const Elf_Internal_Rela *relocs)); /* This function, if defined, is called after the ELF headers have been created. This allows for things like the OS and ABI versions to be changed. */ void (*elf_backend_post_process_headers) PARAMS ((bfd *, struct bfd_link_info *)); /* This function, if defined, prints a symbol to file and returns the name of the symbol to be printed. It should return NULL to fall back to default symbol printing. */ const char *(*elf_backend_print_symbol_all) PARAMS ((bfd *, PTR, asymbol *)); /* This function, if defined, is called after all local symbols and global symbols converted to locals are emited into the symtab section. It allows the backend to emit special global symbols not handled in the hash table. */ boolean (*elf_backend_output_arch_syms) PARAMS ((bfd *, struct bfd_link_info *, PTR, boolean (*) PARAMS ((PTR, const char *, Elf_Internal_Sym *, asection *)))); /* Copy any information related to dynamic linking from a pre-existing symbol IND to a newly created symbol DIR. */ void (*elf_backend_copy_indirect_symbol) PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *)); /* Modify any information related to dynamic linking such that the symbol is not exported. */ void (*elf_backend_hide_symbol) PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); /* The swapping table to use when dealing with ECOFF information. Used for the MIPS ELF .mdebug section. */ const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap; /* Alternate EM_xxxx machine codes for this backend. */ int elf_machine_alt1; int elf_machine_alt2; const struct elf_size_info *s; /* offset of the _GLOBAL_OFFSET_TABLE_ symbol from the start of the .got section */ bfd_vma got_symbol_offset; /* The size in bytes of the headers for the GOT and PLT. This includes the so-called reserved entries on some systems. */ bfd_vma got_header_size; bfd_vma plt_header_size; /* This is true if the linker should act like collect and gather global constructors and destructors by name. This is true for MIPS ELF because the Irix 5 tools can not handle the .init section. */ unsigned collect : 1; /* This is true if the linker should ignore changes to the type of a symbol. This is true for MIPS ELF because some Irix 5 objects record undefined functions as STT_OBJECT although the definitions are STT_FUNC. */ unsigned type_change_ok : 1; /* Whether the backend may use REL relocations. (Some backends use both REL and RELA relocations, and this flag is set for those backends.) */ unsigned may_use_rel_p : 1; /* Whether the backend may use RELA relocations. (Some backends use both REL and RELA relocations, and this flag is set for those backends.) */ unsigned may_use_rela_p : 1; /* Whether the default relocation type is RELA. If a backend with this flag set wants REL relocations for a particular section, it must note that explicitly. Similarly, if this flag is clear, and the backend wants RELA relocations for a particular section. */ unsigned default_use_rela_p : 1; /* True if addresses "naturally" sign extend. This is used when swapping in from Elf32 when BFD64. */ unsigned sign_extend_vma : 1; unsigned want_got_plt : 1; unsigned plt_readonly : 1; unsigned want_plt_sym : 1; unsigned plt_not_loaded : 1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -