Lines Matching refs:ehdr

71 	GElf_Ehdr *ehdr;
73 ehdr = gelf_getehdr(elf, &gehdr);
74 if (!ehdr)
77 *dst = ehdr->e_phnum;
230 GElf_Ehdr ehdr;
242 if (gelf_getehdr(elf, &ehdr) == NULL)
245 found = !!elf_section_by_name(elf, &ehdr, &shdr, sec, NULL);
397 static bool addend_may_be_ifunc(GElf_Ehdr *ehdr, struct rel_info *ri)
399 return ehdr->e_machine == EM_X86_64 && ri->is_rela &&
403 static bool get_ifunc_name(Elf *elf, struct dso *dso, GElf_Ehdr *ehdr,
410 if (!addend_may_be_ifunc(ehdr, ri))
434 static bool get_plt_sizes(struct dso *dso, GElf_Ehdr *ehdr, GElf_Shdr *shdr_plt,
437 switch (ehdr->e_machine) {
539 static void get_rela_dyn_info(Elf *elf, GElf_Ehdr *ehdr, struct rela_dyn_info *di, Elf_Scn *scn)
546 scn = elf_section_by_name(elf, ehdr, &rela_dyn_shdr, ".rela.dyn", NULL);
634 GElf_Ehdr *ehdr,
644 scn = elf_section_by_name(elf, ehdr, &shdr, ".plt.got", NULL);
648 if (ehdr->e_machine == EM_X86_64)
649 get_rela_dyn_info(elf, ehdr, &di, scn);
682 GElf_Ehdr ehdr;
690 ehdr = ss->ehdr;
692 if (!elf_section_by_name(elf, &ehdr, &shdr_plt, ".plt", NULL))
704 if (!get_plt_sizes(dso, &ehdr, &shdr_plt, &plt_header_size, &plt_entry_size))
714 if (machine_is_x86(ehdr.e_machine) &&
715 dso__synthesize_plt_got_symbols(dso, elf, &ehdr, sympltname, sizeof(sympltname)))
719 if (machine_is_x86(ehdr.e_machine) &&
720 elf_section_by_name(elf, &ehdr, &plt_sec_shdr, ".plt.sec", NULL)) {
721 if (!get_plt_sizes(dso, &ehdr, &plt_sec_shdr, &plt_header_size, &plt_entry_size))
733 scn_plt_rel = elf_section_by_name(elf, &ehdr, &shdr_rel_plt,
736 scn_plt_rel = elf_section_by_name(elf, &ehdr, &shdr_rel_plt,
808 if (machine_is_x86(ehdr.e_machine) && sort_rel(&ri))
823 else if (!get_ifunc_name(elf, dso, &ehdr, &ri, sympltname, sizeof(sympltname)))
860 GElf_Ehdr ehdr;
874 if (gelf_getehdr(elf, &ehdr) == NULL) {
886 sec = elf_section_by_name(elf, &ehdr, &shdr,
891 sec = elf_section_by_name(elf, &ehdr, &shdr,
896 sec = elf_section_by_name(elf, &ehdr, &shdr,
1125 GElf_Ehdr ehdr;
1145 if (gelf_getehdr(elf, &ehdr) == NULL) {
1150 sec = elf_section_by_name(elf, &ehdr, &shdr,
1218 bool elf__needs_adjust_symbols(GElf_Ehdr ehdr)
1225 return ehdr.e_type == ET_EXEC || ehdr.e_type == ET_REL ||
1226 ehdr.e_type == ET_DYN;
1232 GElf_Ehdr ehdr;
1257 if (gelf_getehdr(elf, &ehdr) == NULL) {
1263 if (dso__swap_init(dso, ehdr.e_ident[EI_DATA])) {
1291 ss->symtab = elf_section_by_name(elf, &ehdr, &ss->symshdr, ".symtab",
1297 ss->dynsym = elf_section_by_name(elf, &ehdr, &ss->dynshdr, ".dynsym",
1303 ss->opdsec = elf_section_by_name(elf, &ehdr, &ss->opdshdr, ".opd",
1311 ss->adjust_symbols = elf__needs_adjust_symbols(ehdr);
1321 ss->ehdr = ehdr;
1344 static u64 max_text_section(Elf *elf, GElf_Ehdr *ehdr)
1351 if (ehdr->e_machine == EM_PARISC ||
1352 ehdr->e_machine == EM_ALPHA)
1356 if (!elf_rawdata(elf_getscn(elf, ehdr->e_shstrndx), NULL))
1369 sec_name = elf_strptr(elf, ehdr->e_shstrndx, shdr.sh_name);
1558 GElf_Ehdr ehdr;
1573 ehdr = syms_ss->ehdr;
1582 if (elf_section_by_name(runtime_ss->elf, &runtime_ss->ehdr, &tshdr,
1603 sec_strndx = elf_getscn(runtime_ss->elf, runtime_ss->ehdr.e_shstrndx);
1611 sec_strndx = elf_getscn(elf, ehdr.e_shstrndx);
1657 max_text_sh_offset = max_text_section(runtime_ss->elf, &runtime_ss->ehdr);
1673 if (ehdr.e_machine == EM_ARM || ehdr.e_machine == EM_AARCH64) {
1741 if ((ehdr.e_machine == EM_ARM) &&
1826 dso->rel = syms_ss->ehdr.e_type == ET_REL;
1916 GElf_Ehdr ehdr;
1933 if (gelf_getehdr(elf, &ehdr) == NULL)
1936 if (ehdr.e_machine == EM_X86_64)
1991 GElf_Ehdr ehdr;
1996 GElf_Ehdr *ehdr;
2010 ehdr = gelf_getehdr(kcore->elf, &kcore->ehdr);
2011 if (!ehdr)
2042 memset(&kcore->ehdr, 0, sizeof(GElf_Ehdr));
2062 GElf_Ehdr *ehdr = &to->ehdr;
2063 GElf_Ehdr *kehdr = &from->ehdr;
2065 memcpy(ehdr->e_ident, kehdr->e_ident, EI_NIDENT);
2066 ehdr->e_type = kehdr->e_type;
2067 ehdr->e_machine = kehdr->e_machine;
2068 ehdr->e_version = kehdr->e_version;
2069 ehdr->e_entry = 0;
2070 ehdr->e_shoff = 0;
2071 ehdr->e_flags = kehdr->e_flags;
2072 ehdr->e_phnum = count;
2073 ehdr->e_shentsize = 0;
2074 ehdr->e_shnum = 0;
2075 ehdr->e_shstrndx = 0;
2078 ehdr->e_phoff = sizeof(Elf32_Ehdr);
2079 ehdr->e_ehsize = sizeof(Elf32_Ehdr);
2080 ehdr->e_phentsize = sizeof(Elf32_Phdr);
2082 ehdr->e_phoff = sizeof(Elf64_Ehdr);
2083 ehdr->e_ehsize = sizeof(Elf64_Ehdr);
2084 ehdr->e_phentsize = sizeof(Elf64_Phdr);
2087 if (!gelf_update_ehdr(to->elf, ehdr))
2732 GElf_Ehdr ehdr;
2815 if (!gelf_getehdr(*elf, &ehdr)) {
2828 if (elf_section_by_name(*elf, &ehdr, &shdr, SDT_BASE_SCN, NULL))
2832 if (elf_section_by_name(*elf, &ehdr, &shdr, SDT_PROBES_SCN, NULL))
2861 GElf_Ehdr ehdr;
2870 if (gelf_getehdr(elf, &ehdr) == NULL) {
2880 scn = elf_section_by_name(elf, &ehdr, &shdr, SDT_NOTE_SCN, NULL);