Lines Matching defs:elf_handle
303 /// @param elf_handle the elf handle to use.
309 find_section_by_name(Elf* elf_handle, const std::string& name)
312 if (elf_getshdrstrndx (elf_handle, §ion_header_string_index) < 0)
317 while ((section = elf_nextscn(elf_handle, section)) != 0)
324 elf_strptr(elf_handle, section_header_string_index, header->sh_name);
334 /// @param elf_handle the elf handle to use.
344 find_section(Elf* elf_handle, const std::string& name, Elf64_Word section_type)
347 if (elf_getshdrstrndx (elf_handle, §ion_header_string_index) < 0)
352 while ((section = elf_nextscn(elf_handle, section)) != 0)
359 elf_strptr(elf_handle, section_header_string_index, header->sh_name);
369 /// @param elf_handle the elf handle to use.
377 find_section(Elf* elf_handle, Elf64_Word section_type)
380 while ((section = elf_nextscn(elf_handle, section)) != 0)
392 /// @param elf_handle the elf handle to use.
396 find_symtab_section(Elf* elf_handle)
398 return find_section(elf_handle, SHT_SYMTAB);
403 /// @param elf_handle the elf handle to use.
407 find_dynsym_section(Elf* elf_handle)
409 return find_section(elf_handle, SHT_DYNSYM);
419 /// @param elf_handle the elf handle to consider.
425 find_symbol_table_section(Elf* elf_handle)
427 Elf_Scn *dynsym = find_dynsym_section(elf_handle),
428 *sym_tab = find_symtab_section(elf_handle);
433 GElf_Ehdr* elf_header = gelf_getehdr(elf_handle, &eh_mem);
451 /// @param elf_handle the elf handle to use.
457 find_symbol_table_section_index(Elf* elf_handle, size_t& symtab_index)
459 Elf_Scn* section = find_symbol_table_section(elf_handle);
470 /// @param elf_handle the elf handle to use.
478 find_hash_table_section_index(Elf* elf_handle,
482 if (!elf_handle)
487 for (Elf_Scn* section = elf_nextscn(elf_handle, 0);
489 section = elf_nextscn(elf_handle, section))
515 /// @param elf_handle the elf handle to use.
519 find_text_section(Elf* elf_handle)
520 {return find_section(elf_handle, ".text", SHT_PROGBITS);}
524 /// @param elf_handle.
528 find_bss_section(Elf* elf_handle)
529 {return find_section(elf_handle, ".bss", SHT_NOBITS);}
533 /// @param elf_handle.
537 find_rodata_section(Elf* elf_handle)
538 {return find_section(elf_handle, ".rodata", SHT_PROGBITS);}
542 /// @param elf_handle the elf handle to use.
546 find_data_section(Elf* elf_handle)
547 {return find_section(elf_handle, ".data", SHT_PROGBITS);}
551 /// @param elf_handle the elf handle to use.
555 find_data1_section(Elf* elf_handle)
556 {return find_section(elf_handle, ".data1", SHT_PROGBITS);}
562 /// @param elf_handle the elf handle to consider.
566 find_opd_section(Elf* elf_handle)
567 {return find_section(elf_handle, ".opd", SHT_PROGBITS);}
572 /// @param elf_handle the elf handle to use.
585 get_symbol_versionning_sections(Elf* elf_handle,
594 while ((section = elf_nextscn(elf_handle, section)) != NULL)
620 /// @param elf_handle the elf handle to consider.
624 find_ksymtab_section(Elf* elf_handle)
625 {return find_section(elf_handle, "__ksymtab", SHT_PROGBITS);}
630 /// @param elf_handle the elf handle to consider.
634 find_ksymtab_gpl_section(Elf* elf_handle)
635 {return find_section(elf_handle, "__ksymtab_gpl", SHT_PROGBITS);}
639 /// @param elf_handle the elf handle to use.
642 /// binary denoted by @p elf_handle, or nil if such a section could
645 find_ksymtab_strings_section(Elf *elf_handle)
647 if (is_linux_kernel(elf_handle))
648 return find_section(elf_handle, "__ksymtab_strings", SHT_PROGBITS);
654 /// @param elf_handle the elf handle to consider.
660 find_relocation_section(Elf* elf_handle, Elf_Scn* target_section)
671 while ((section = elf_nextscn(elf_handle, section)) != 0)
687 /// @param elf_handle the elf handle to use.
693 find_strtab_for_symtab_section(Elf* elf_handle, Elf_Scn* symtab_section)
702 strtab_section = elf_getscn(elf_handle, symtab_shdr->sh_link);
722 get_version_definition_for_versym(Elf* elf_handle,
755 version.str(elf_strptr(elf_handle, verdef_stridx, verdaux->vda_name));
783 get_version_needed_for_versym(Elf* elf_handle,
788 if (versym == 0 || elf_handle == 0 || verneed_section == 0)
820 version.str(elf_strptr(elf_handle,
839 /// @param elf_handle the elf handle to use.
856 get_version_for_symbol(Elf* elf_handle,
865 if (!get_symbol_versionning_sections(elf_handle,
895 && get_version_definition_for_versym(elf_handle, versym,
902 && get_version_needed_for_versym(elf_handle, versym,
912 /// @param elf_handle the elf handle to use.
920 get_crc_for_symbol(Elf* elf_handle, GElf_Sym* crc_symbol, uint32_t& crc_value)
930 Elf_Scn* kcrctab_section = elf_getscn(elf_handle, crc_section_index);
959 /// @param elf_handle the ELF handle to consider.
963 architecture_is_ppc64(Elf* elf_handle)
966 GElf_Ehdr* elf_header = gelf_getehdr(elf_handle, &eh_mem);
972 /// @param elf_handle the ELF handle to consider.
976 architecture_is_ppc32(Elf* elf_handle)
979 GElf_Ehdr* elf_header = gelf_getehdr(elf_handle, &eh_mem);
985 /// @param elf_handle the ELF handle to consider.
989 architecture_is_arm32(Elf* elf_handle)
992 GElf_Ehdr* elf_header = gelf_getehdr(elf_handle, &eh_mem);
998 /// @param elf_handle the ELF handle to consider.
1002 architecture_is_arm64(Elf* elf_handle)
1006 GElf_Ehdr* elf_header = gelf_getehdr(elf_handle, &eh_mem);
1017 /// @param elf_handle the ELF handle to consider.
1021 architecture_is_big_endian(Elf* elf_handle)
1024 gelf_getehdr(elf_handle, &elf_header);
1140 lookup_ppc64_elf_fn_entry_point_address(Elf* elf_handle, GElf_Addr fn_desc_address)
1142 if (!elf_handle)
1145 if (!architecture_is_ppc64(elf_handle))
1148 bool is_big_endian = architecture_is_big_endian(elf_handle);
1150 Elf_Scn* opd_section = find_opd_section(elf_handle);
1184 /// @param elf_handle the ELF handle to consider.
1186 /// @return true iff the binary denoted by @p elf_handle is a Linux
1189 is_linux_kernel_module(Elf *elf_handle)
1191 return (find_section(elf_handle, ".modinfo", SHT_PROGBITS)
1192 && find_section(elf_handle,
1200 /// @param elf_handle the ELF handle to consider.
1202 /// @return true iff the binary denoted by @p elf_handle is a Linux
1205 is_linux_kernel(Elf *elf_handle)
1207 return (find_section(elf_handle,
1210 || is_linux_kernel_module(elf_handle));
1215 /// @param elf_handle the elf handle for the binary to consider.
1223 get_binary_load_address(Elf* elf_handle, GElf_Addr& load_address)
1226 gelf_getehdr(elf_handle, &elf_header);
1235 program_header = gelf_getphdr(elf_handle, i, &ph_mem);
1261 /// @param elf_handle the ELF handle to consider.
1265 get_architecture_word_size(Elf* elf_handle)
1269 gelf_getehdr(elf_handle, &elf_header);
1281 /// @param elf_handle the ELF handle to consider.
1285 is_executable(Elf* elf_handle)
1288 gelf_getehdr(elf_handle, &elf_header);
1294 /// @param elf_handle the ELF handle to consider.
1298 is_dso(Elf* elf_handle)
1301 gelf_getehdr(elf_handle, &elf_header);
1314 /// @param elf_handle the elf handle for the binary to consider.
1323 maybe_adjust_et_rel_sym_addr_to_abs_addr(Elf* elf_handle, GElf_Sym* sym)
1325 Elf_Scn* symbol_section = elf_getscn(elf_handle, sym->st_shndx);
1332 if (!gelf_getehdr(elf_handle, &elf_header))
1375 address_is_in_opd_section(Elf* elf_handle, Dwarf_Addr addr)
1377 Elf_Scn * opd_section = find_opd_section(elf_handle);