10 #ifndef __ABG_ELF_HELPERS_H__
11 #define __ABG_ELF_HELPERS_H__
15 #include <elfutils/libdwfl.h>
16 #include <elfutils/libdwelf.h>
32 operator()(Dwfl* dwfl)
37 typedef shared_ptr<Dwfl> dwfl_sptr;
41 typedef unordered_map<GElf_Addr, elf_symbol_sptr> addr_elf_symbol_sptr_map_type;
44 typedef unordered_set<GElf_Addr> address_set_type;
47 typedef shared_ptr<address_set_type> address_set_sptr;
54 stt_to_elf_symbol_type(
unsigned char stt);
57 stb_to_elf_symbol_binding(
unsigned char stb);
60 stv_to_elf_symbol_visibility(
unsigned char stv);
63 e_machine_to_string(GElf_Half e_machine);
70 find_section(Elf* elf_handle,
71 const std::string& name,
72 Elf64_Word section_type);
75 find_section_by_name(Elf* elf_handle,
const std::string& name);
78 find_section(Elf* elf_handle, Elf64_Word section_type);
81 find_symtab_section(Elf* elf_handle);
84 find_dynsym_section(Elf* elf_handle);
87 find_symbol_table_section(Elf* elf_handle);
90 find_symbol_table_section_index(Elf* elf_handle,
size_t& symtab_index);
94 NO_HASH_TABLE_KIND = 0,
100 find_hash_table_section_index(Elf* elf_handle,
101 size_t& ht_section_index,
102 size_t& symtab_section_index);
105 find_text_section(Elf* elf_handle);
108 find_bss_section(Elf* elf_handle);
111 find_rodata_section(Elf* elf_handle);
114 find_data_section(Elf* elf_handle);
117 find_data1_section(Elf* elf_handle);
120 find_opd_section(Elf* elf_handle);
123 get_symbol_versionning_sections(Elf* elf_handle,
124 Elf_Scn*& versym_section,
125 Elf_Scn*& verdef_section,
126 Elf_Scn*& verneed_section);
129 find_ksymtab_section(Elf* elf_handle);
132 find_ksymtab_gpl_section(Elf* elf_handle);
135 find_ksymtab_strings_section(Elf *elf_handle);
138 find_relocation_section(Elf* elf_handle, Elf_Scn* target_section);
141 find_strtab_for_symtab_section(Elf* elf_handle,
142 Elf_Scn* symtab_section);
149 get_version_definition_for_versym(Elf* elf_handle,
151 Elf_Scn* verdef_section,
155 get_version_needed_for_versym(Elf* elf_handle,
157 Elf_Scn* verneed_section,
161 get_version_for_symbol(Elf* elf_handle,
163 bool get_def_version,
167 get_crc_for_symbol(Elf* elf_handle, GElf_Sym* crc_symbol, uint32_t& crc_value);
173 architecture_is_ppc64(Elf* elf_handle);
176 architecture_is_ppc32(Elf* elf_handle);
179 architecture_is_arm32(Elf* elf_handle);
182 architecture_is_arm64(Elf* elf_handle);
185 architecture_is_big_endian(Elf* elf_handle);
188 lookup_ppc64_elf_fn_entry_point_address(Elf* elf_handle,
189 GElf_Addr fn_desc_address);
196 is_linux_kernel_module(Elf *elf_handle);
199 is_linux_kernel(Elf *elf_handle);
205 const Dwfl_Callbacks&
206 initialize_dwfl_callbacks(Dwfl_Callbacks&,
char**);
209 create_new_dwfl_handle(Dwfl_Callbacks&);
216 get_binary_load_address(Elf* elf_handle, GElf_Addr& load_address);
219 get_architecture_word_size(Elf* elf_handle);
222 is_executable(Elf* elf_handle);
225 is_dso(Elf* elf_handle);
228 maybe_adjust_et_rel_sym_addr_to_abs_addr(Elf* elf_handle, GElf_Sym* sym);
231 address_is_in_opd_section(Elf* elf_handle, Dwarf_Addr addr);
234 lookup_data_tag_from_dynamic_segment(Elf* elf,
235 Elf64_Sxword data_tag,
236 vector<string>& dt_tag_data);
239 get_soname_of_elf_file(
const string& path,
string &soname);
243 #endif // __ABG_ELF_HELPERS_H__
visibility
The visibility of the symbol.
Toplevel namespace for libabigail.
Types of the main internal representation of libabigail.
A functor used by dwfl_sptr.
type
The type of a symbol.
binding
The binding of a symbol.
The abstraction of the version of an ELF symbol.