elf 61 arch/alpha/boot/tools/objstrip.c struct elfhdr *elf; elf 149 arch/alpha/boot/tools/objstrip.c elf = (struct elfhdr *) buf; elf 151 arch/alpha/boot/tools/objstrip.c if (elf->e_ident[0] == 0x7f && strncmp((char *)elf->e_ident + 1, "ELF", 3) == 0) { elf 152 arch/alpha/boot/tools/objstrip.c if (elf->e_type != ET_EXEC) { elf 157 arch/alpha/boot/tools/objstrip.c if (!elf_check_arch(elf)) { elf 159 arch/alpha/boot/tools/objstrip.c prog_name, elf->e_machine); elf 162 arch/alpha/boot/tools/objstrip.c if (elf->e_phnum != 1) { elf 165 arch/alpha/boot/tools/objstrip.c prog_name, elf->e_phnum); elf 168 arch/alpha/boot/tools/objstrip.c e_entry = elf->e_entry; elf 170 arch/alpha/boot/tools/objstrip.c lseek(fd, elf->e_phoff, SEEK_SET); elf 502 arch/mips/include/asm/elf.h extern int arch_elf_pt_proc(void *ehdr, void *phdr, struct file *elf, elf 75 arch/mips/kernel/elf.c int arch_elf_pt_proc(void *_ehdr, void *_phdr, struct file *elf, elf 119 arch/mips/kernel/elf.c ret = kernel_read(elf, &abiflags, sizeof(abiflags), &pos); elf 657 arch/powerpc/kernel/fadump.c struct elfhdr *elf; elf 660 arch/powerpc/kernel/fadump.c elf = (struct elfhdr *)bufp; elf 841 arch/powerpc/kernel/fadump.c struct elfhdr *elf; elf 843 arch/powerpc/kernel/fadump.c elf = (struct elfhdr *) bufp; elf 845 arch/powerpc/kernel/fadump.c memcpy(elf->e_ident, ELFMAG, SELFMAG); elf 846 arch/powerpc/kernel/fadump.c elf->e_ident[EI_CLASS] = ELF_CLASS; elf 847 arch/powerpc/kernel/fadump.c elf->e_ident[EI_DATA] = ELF_DATA; elf 848 arch/powerpc/kernel/fadump.c elf->e_ident[EI_VERSION] = EV_CURRENT; elf 849 arch/powerpc/kernel/fadump.c elf->e_ident[EI_OSABI] = ELF_OSABI; elf 850 arch/powerpc/kernel/fadump.c memset(elf->e_ident+EI_PAD, 0, EI_NIDENT-EI_PAD); elf 851 arch/powerpc/kernel/fadump.c elf->e_type = ET_CORE; elf 852 arch/powerpc/kernel/fadump.c elf->e_machine = ELF_ARCH; elf 853 arch/powerpc/kernel/fadump.c elf->e_version = EV_CURRENT; elf 854 arch/powerpc/kernel/fadump.c elf->e_entry = 0; elf 855 arch/powerpc/kernel/fadump.c elf->e_phoff = sizeof(struct elfhdr); elf 856 arch/powerpc/kernel/fadump.c elf->e_shoff = 0; elf 858 arch/powerpc/kernel/fadump.c elf->e_flags = _CALL_ELF; elf 860 arch/powerpc/kernel/fadump.c elf->e_flags = 0; elf 862 arch/powerpc/kernel/fadump.c elf->e_ehsize = sizeof(struct elfhdr); elf 863 arch/powerpc/kernel/fadump.c elf->e_phentsize = sizeof(struct elf_phdr); elf 864 arch/powerpc/kernel/fadump.c elf->e_phnum = 0; elf 865 arch/powerpc/kernel/fadump.c elf->e_shentsize = 0; elf 866 arch/powerpc/kernel/fadump.c elf->e_shnum = 0; elf 867 arch/powerpc/kernel/fadump.c elf->e_shstrndx = 0; elf 956 arch/powerpc/kernel/fadump.c struct elfhdr *elf; elf 960 arch/powerpc/kernel/fadump.c elf = (struct elfhdr *)bufp; elf 982 arch/powerpc/kernel/fadump.c (elf->e_phnum)++; elf 997 arch/powerpc/kernel/fadump.c (elf->e_phnum)++; elf 1037 arch/powerpc/kernel/fadump.c (elf->e_phnum)++; elf 307 arch/powerpc/platforms/powernv/opal-core.c Elf64_Ehdr *elf; elf 354 arch/powerpc/platforms/powernv/opal-core.c elf = (Elf64_Ehdr *)bufp; elf 356 arch/powerpc/platforms/powernv/opal-core.c memcpy(elf->e_ident, ELFMAG, SELFMAG); elf 357 arch/powerpc/platforms/powernv/opal-core.c elf->e_ident[EI_CLASS] = ELF_CLASS; elf 358 arch/powerpc/platforms/powernv/opal-core.c elf->e_ident[EI_DATA] = ELFDATA2MSB; elf 359 arch/powerpc/platforms/powernv/opal-core.c elf->e_ident[EI_VERSION] = EV_CURRENT; elf 360 arch/powerpc/platforms/powernv/opal-core.c elf->e_ident[EI_OSABI] = ELF_OSABI; elf 361 arch/powerpc/platforms/powernv/opal-core.c memset(elf->e_ident+EI_PAD, 0, EI_NIDENT-EI_PAD); elf 362 arch/powerpc/platforms/powernv/opal-core.c elf->e_type = cpu_to_be16(ET_CORE); elf 363 arch/powerpc/platforms/powernv/opal-core.c elf->e_machine = cpu_to_be16(ELF_ARCH); elf 364 arch/powerpc/platforms/powernv/opal-core.c elf->e_version = cpu_to_be32(EV_CURRENT); elf 365 arch/powerpc/platforms/powernv/opal-core.c elf->e_entry = 0; elf 366 arch/powerpc/platforms/powernv/opal-core.c elf->e_phoff = cpu_to_be64(sizeof(Elf64_Ehdr)); elf 367 arch/powerpc/platforms/powernv/opal-core.c elf->e_shoff = 0; elf 368 arch/powerpc/platforms/powernv/opal-core.c elf->e_flags = 0; elf 370 arch/powerpc/platforms/powernv/opal-core.c elf->e_ehsize = cpu_to_be16(sizeof(Elf64_Ehdr)); elf 371 arch/powerpc/platforms/powernv/opal-core.c elf->e_phentsize = cpu_to_be16(sizeof(Elf64_Phdr)); elf 372 arch/powerpc/platforms/powernv/opal-core.c elf->e_phnum = 0; elf 373 arch/powerpc/platforms/powernv/opal-core.c elf->e_shentsize = 0; elf 374 arch/powerpc/platforms/powernv/opal-core.c elf->e_shnum = 0; elf 375 arch/powerpc/platforms/powernv/opal-core.c elf->e_shstrndx = 0; elf 416 arch/powerpc/platforms/powernv/opal-core.c elf->e_phnum = cpu_to_be16(count); elf 170 arch/s390/include/asm/elf.h #define arch_elf_pt_proc(ehdr, phdr, elf, interp, state) \ elf 185 arch/s390/include/asm/elf.h #define arch_elf_pt_proc(ehdr, phdr, elf, interp, state) \ elf 496 fs/binfmt_elf.c struct file *elf, bool is_interp, elf 1426 fs/binfmt_elf.c static void fill_elf_header(struct elfhdr *elf, int segs, elf 1429 fs/binfmt_elf.c memset(elf, 0, sizeof(*elf)); elf 1431 fs/binfmt_elf.c memcpy(elf->e_ident, ELFMAG, SELFMAG); elf 1432 fs/binfmt_elf.c elf->e_ident[EI_CLASS] = ELF_CLASS; elf 1433 fs/binfmt_elf.c elf->e_ident[EI_DATA] = ELF_DATA; elf 1434 fs/binfmt_elf.c elf->e_ident[EI_VERSION] = EV_CURRENT; elf 1435 fs/binfmt_elf.c elf->e_ident[EI_OSABI] = ELF_OSABI; elf 1437 fs/binfmt_elf.c elf->e_type = ET_CORE; elf 1438 fs/binfmt_elf.c elf->e_machine = machine; elf 1439 fs/binfmt_elf.c elf->e_version = EV_CURRENT; elf 1440 fs/binfmt_elf.c elf->e_phoff = sizeof(struct elfhdr); elf 1441 fs/binfmt_elf.c elf->e_flags = flags; elf 1442 fs/binfmt_elf.c elf->e_ehsize = sizeof(struct elfhdr); elf 1443 fs/binfmt_elf.c elf->e_phentsize = sizeof(struct elf_phdr); elf 1444 fs/binfmt_elf.c elf->e_phnum = segs; elf 1760 fs/binfmt_elf.c static int fill_note_info(struct elfhdr *elf, int phdrs, elf 1803 fs/binfmt_elf.c fill_elf_header(elf, phdrs, elf 2009 fs/binfmt_elf.c static int fill_note_info(struct elfhdr *elf, int phdrs, elf 2041 fs/binfmt_elf.c fill_elf_header(elf, phdrs, ELF_ARCH, ELF_CORE_EFLAGS); elf 2161 fs/binfmt_elf.c static void fill_extnum_info(struct elfhdr *elf, struct elf_shdr *shdr4extnum, elf 2164 fs/binfmt_elf.c elf->e_shoff = e_shoff; elf 2165 fs/binfmt_elf.c elf->e_shentsize = sizeof(*shdr4extnum); elf 2166 fs/binfmt_elf.c elf->e_shnum = 1; elf 2167 fs/binfmt_elf.c elf->e_shstrndx = SHN_UNDEF; elf 2172 fs/binfmt_elf.c shdr4extnum->sh_size = elf->e_shnum; elf 2173 fs/binfmt_elf.c shdr4extnum->sh_link = elf->e_shstrndx; elf 2191 fs/binfmt_elf.c struct elfhdr *elf = NULL; elf 2213 fs/binfmt_elf.c elf = kmalloc(sizeof(*elf), GFP_KERNEL); elf 2214 fs/binfmt_elf.c if (!elf) elf 2239 fs/binfmt_elf.c if (!fill_note_info(elf, e_phnum, &info, cprm->siginfo, cprm->regs)) elf 2247 fs/binfmt_elf.c offset += sizeof(*elf); /* Elf header */ elf 2290 fs/binfmt_elf.c fill_extnum_info(elf, shdr4extnum, e_shoff, segs); elf 2295 fs/binfmt_elf.c if (!dump_emit(cprm, elf, sizeof(*elf))) elf 2379 fs/binfmt_elf.c kfree(elf); elf 1290 fs/binfmt_elf_fdpic.c static inline void fill_elf_fdpic_header(struct elfhdr *elf, int segs) elf 1292 fs/binfmt_elf_fdpic.c memcpy(elf->e_ident, ELFMAG, SELFMAG); elf 1293 fs/binfmt_elf_fdpic.c elf->e_ident[EI_CLASS] = ELF_CLASS; elf 1294 fs/binfmt_elf_fdpic.c elf->e_ident[EI_DATA] = ELF_DATA; elf 1295 fs/binfmt_elf_fdpic.c elf->e_ident[EI_VERSION] = EV_CURRENT; elf 1296 fs/binfmt_elf_fdpic.c elf->e_ident[EI_OSABI] = ELF_OSABI; elf 1297 fs/binfmt_elf_fdpic.c memset(elf->e_ident+EI_PAD, 0, EI_NIDENT-EI_PAD); elf 1299 fs/binfmt_elf_fdpic.c elf->e_type = ET_CORE; elf 1300 fs/binfmt_elf_fdpic.c elf->e_machine = ELF_ARCH; elf 1301 fs/binfmt_elf_fdpic.c elf->e_version = EV_CURRENT; elf 1302 fs/binfmt_elf_fdpic.c elf->e_entry = 0; elf 1303 fs/binfmt_elf_fdpic.c elf->e_phoff = sizeof(struct elfhdr); elf 1304 fs/binfmt_elf_fdpic.c elf->e_shoff = 0; elf 1305 fs/binfmt_elf_fdpic.c elf->e_flags = ELF_FDPIC_CORE_EFLAGS; elf 1306 fs/binfmt_elf_fdpic.c elf->e_ehsize = sizeof(struct elfhdr); elf 1307 fs/binfmt_elf_fdpic.c elf->e_phentsize = sizeof(struct elf_phdr); elf 1308 fs/binfmt_elf_fdpic.c elf->e_phnum = segs; elf 1309 fs/binfmt_elf_fdpic.c elf->e_shentsize = 0; elf 1310 fs/binfmt_elf_fdpic.c elf->e_shnum = 0; elf 1311 fs/binfmt_elf_fdpic.c elf->e_shstrndx = 0; elf 1474 fs/binfmt_elf_fdpic.c static void fill_extnum_info(struct elfhdr *elf, struct elf_shdr *shdr4extnum, elf 1477 fs/binfmt_elf_fdpic.c elf->e_shoff = e_shoff; elf 1478 fs/binfmt_elf_fdpic.c elf->e_shentsize = sizeof(*shdr4extnum); elf 1479 fs/binfmt_elf_fdpic.c elf->e_shnum = 1; elf 1480 fs/binfmt_elf_fdpic.c elf->e_shstrndx = SHN_UNDEF; elf 1485 fs/binfmt_elf_fdpic.c shdr4extnum->sh_size = elf->e_shnum; elf 1486 fs/binfmt_elf_fdpic.c shdr4extnum->sh_link = elf->e_shstrndx; elf 1556 fs/binfmt_elf_fdpic.c struct elfhdr *elf = NULL; elf 1590 fs/binfmt_elf_fdpic.c elf = kmalloc(sizeof(*elf), GFP_KERNEL); elf 1591 fs/binfmt_elf_fdpic.c if (!elf) elf 1647 fs/binfmt_elf_fdpic.c fill_elf_fdpic_header(elf, e_phnum); elf 1684 fs/binfmt_elf_fdpic.c offset += sizeof(*elf); /* Elf header */ elf 1715 fs/binfmt_elf_fdpic.c fill_extnum_info(elf, shdr4extnum, e_shoff, segs); elf 1720 fs/binfmt_elf_fdpic.c if (!dump_emit(cprm, elf, sizeof(*elf))) elf 1800 fs/binfmt_elf_fdpic.c kfree(elf); elf 74 include/linux/elfnote.h struct elf##size##_note _nhdr; \ elf 316 samples/bpf/bpf_load.c static int get_sec(Elf *elf, int i, GElf_Ehdr *ehdr, char **shname, elf 321 samples/bpf/bpf_load.c scn = elf_getscn(elf, i); elf 328 samples/bpf/bpf_load.c *shname = elf_strptr(elf, ehdr->e_shstrndx, shdr->sh_name); elf 400 samples/bpf/bpf_load.c Elf *elf, Elf_Data *symbols, int strtabidx) elf 416 samples/bpf/bpf_load.c scn = elf_getscn(elf, maps_shndx); elf 475 samples/bpf/bpf_load.c map_name = elf_strptr(elf, strtabidx, sym[i].st_name); elf 511 samples/bpf/bpf_load.c Elf *elf; elf 530 samples/bpf/bpf_load.c elf = elf_begin(fd, ELF_C_READ, NULL); elf 532 samples/bpf/bpf_load.c if (!elf) elf 535 samples/bpf/bpf_load.c if (gelf_getehdr(elf, &ehdr) != &ehdr) elf 544 samples/bpf/bpf_load.c if (get_sec(elf, i, &ehdr, &shname, &shdr, &data)) elf 585 samples/bpf/bpf_load.c elf, symbols, strtabidx); elf 603 samples/bpf/bpf_load.c if (get_sec(elf, i, &ehdr, &shname, &shdr, &data)) elf 610 samples/bpf/bpf_load.c if (get_sec(elf, shdr.sh_info, &ehdr, &shname_prog, elf 633 samples/bpf/bpf_load.c if (get_sec(elf, i, &ehdr, &shname, &shdr, &data)) elf 303 scripts/mod/modpost.c static const char *sech_name(struct elf_info *elf, Elf_Shdr *sechdr) elf 305 scripts/mod/modpost.c return (void *)elf->hdr + elf 306 scripts/mod/modpost.c elf->sechdrs[elf->secindex_strings].sh_offset + elf 310 scripts/mod/modpost.c static const char *sec_name(struct elf_info *elf, int secindex) elf 312 scripts/mod/modpost.c return sech_name(elf, &elf->sechdrs[secindex]); elf 317 scripts/mod/modpost.c static enum export export_from_secname(struct elf_info *elf, unsigned int sec) elf 319 scripts/mod/modpost.c const char *secname = sec_name(elf, sec); elf 335 scripts/mod/modpost.c static enum export export_from_sec(struct elf_info *elf, unsigned int sec) elf 337 scripts/mod/modpost.c if (sec == elf->export_sec) elf 339 scripts/mod/modpost.c else if (sec == elf->export_unused_sec) elf 341 scripts/mod/modpost.c else if (sec == elf->export_gpl_sec) elf 343 scripts/mod/modpost.c else if (sec == elf->export_unused_gpl_sec) elf 345 scripts/mod/modpost.c else if (sec == elf->export_gpl_future_sec) elf 841 scripts/mod/modpost.c static const char *sym_name(struct elf_info *elf, Elf_Sym *sym) elf 844 scripts/mod/modpost.c return elf->strtab + sym->st_name; elf 921 scripts/mod/modpost.c static void check_section(const char *modname, struct elf_info *elf, elf 924 scripts/mod/modpost.c const char *sec = sech_name(elf, sechdr); elf 1050 scripts/mod/modpost.c void (*handler)(const char *modname, struct elf_info *elf, elf 1056 scripts/mod/modpost.c static void extable_mismatch_handler(const char *modname, struct elf_info *elf, elf 1299 scripts/mod/modpost.c static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym) elf 1301 scripts/mod/modpost.c const char *name = elf->strtab + sym->st_name; elf 1315 scripts/mod/modpost.c static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr, elf 1327 scripts/mod/modpost.c relsym_secindex = get_secindex(elf, relsym); elf 1328 scripts/mod/modpost.c for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) { elf 1329 scripts/mod/modpost.c if (get_secindex(elf, sym) != relsym_secindex) elf 1333 scripts/mod/modpost.c if (!is_valid_name(elf, sym)) elf 1359 scripts/mod/modpost.c static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr, elf 1366 scripts/mod/modpost.c for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) { elf 1371 scripts/mod/modpost.c symsec = sec_name(elf, get_secindex(elf, sym)); elf 1374 scripts/mod/modpost.c if (!is_valid_name(elf, sym)) elf 1599 scripts/mod/modpost.c static void default_mismatch_handler(const char *modname, struct elf_info *elf, elf 1609 scripts/mod/modpost.c from = find_elf_symbol2(elf, r->r_offset, fromsec); elf 1610 scripts/mod/modpost.c fromsym = sym_name(elf, from); elf 1615 scripts/mod/modpost.c tosec = sec_name(elf, get_secindex(elf, sym)); elf 1616 scripts/mod/modpost.c to = find_elf_symbol(elf, r->r_addend, sym); elf 1617 scripts/mod/modpost.c tosym = sym_name(elf, to); elf 1629 scripts/mod/modpost.c static int is_executable_section(struct elf_info* elf, unsigned int section_index) elf 1631 scripts/mod/modpost.c if (section_index > elf->num_sections) elf 1634 scripts/mod/modpost.c return ((elf->sechdrs[section_index].sh_flags & SHF_EXECINSTR) == SHF_EXECINSTR); elf 1674 scripts/mod/modpost.c static void report_extable_warnings(const char* modname, struct elf_info* elf, elf 1679 scripts/mod/modpost.c Elf_Sym* fromsym = find_elf_symbol2(elf, r->r_offset, fromsec); elf 1680 scripts/mod/modpost.c const char* fromsym_name = sym_name(elf, fromsym); elf 1681 scripts/mod/modpost.c Elf_Sym* tosym = find_elf_symbol(elf, r->r_addend, sym); elf 1682 scripts/mod/modpost.c const char* tosym_name = sym_name(elf, tosym); elf 1700 scripts/mod/modpost.c is_executable_section(elf, get_secindex(elf, sym))) elf 1712 scripts/mod/modpost.c static void extable_mismatch_handler(const char* modname, struct elf_info *elf, elf 1717 scripts/mod/modpost.c const char* tosec = sec_name(elf, get_secindex(elf, sym)); elf 1721 scripts/mod/modpost.c report_extable_warnings(modname, elf, mismatch, r, sym, fromsec, tosec); elf 1730 scripts/mod/modpost.c else if (!is_executable_section(elf, get_secindex(elf, sym))) { elf 1748 scripts/mod/modpost.c static void check_section_mismatch(const char *modname, struct elf_info *elf, elf 1751 scripts/mod/modpost.c const char *tosec = sec_name(elf, get_secindex(elf, sym)); elf 1756 scripts/mod/modpost.c mismatch->handler(modname, elf, mismatch, elf 1759 scripts/mod/modpost.c default_mismatch_handler(modname, elf, mismatch, elf 1764 scripts/mod/modpost.c static unsigned int *reloc_location(struct elf_info *elf, elf 1767 scripts/mod/modpost.c Elf_Shdr *sechdrs = elf->sechdrs; elf 1770 scripts/mod/modpost.c return (void *)elf->hdr + sechdrs[section].sh_offset + elf 1774 scripts/mod/modpost.c static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) elf 1777 scripts/mod/modpost.c unsigned int *location = reloc_location(elf, sechdr, r); elf 1786 scripts/mod/modpost.c if (elf->hdr->e_type == ET_EXEC) elf 1810 scripts/mod/modpost.c static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) elf 1818 scripts/mod/modpost.c (elf->symtab_start + ELF_R_SYM(r->r_info)); elf 1827 scripts/mod/modpost.c r->r_addend = (int)(long)(elf->hdr + elf 1837 scripts/mod/modpost.c static int addend_mips_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) elf 1840 scripts/mod/modpost.c unsigned int *location = reloc_location(elf, sechdr, r); elf 1860 scripts/mod/modpost.c static void section_rela(const char *modname, struct elf_info *elf, elf 1869 scripts/mod/modpost.c Elf_Rela *start = (void *)elf->hdr + sechdr->sh_offset; elf 1872 scripts/mod/modpost.c fromsec = sech_name(elf, sechdr); elf 1881 scripts/mod/modpost.c if (elf->hdr->e_machine == EM_MIPS) { elf 1896 scripts/mod/modpost.c sym = elf->symtab_start + r_sym; elf 1902 scripts/mod/modpost.c check_section_mismatch(modname, elf, &r, sym, fromsec); elf 1906 scripts/mod/modpost.c static void section_rel(const char *modname, struct elf_info *elf, elf 1915 scripts/mod/modpost.c Elf_Rel *start = (void *)elf->hdr + sechdr->sh_offset; elf 1918 scripts/mod/modpost.c fromsec = sech_name(elf, sechdr); elf 1927 scripts/mod/modpost.c if (elf->hdr->e_machine == EM_MIPS) { elf 1942 scripts/mod/modpost.c switch (elf->hdr->e_machine) { elf 1944 scripts/mod/modpost.c if (addend_386_rel(elf, sechdr, &r)) elf 1948 scripts/mod/modpost.c if (addend_arm_rel(elf, sechdr, &r)) elf 1952 scripts/mod/modpost.c if (addend_mips_rel(elf, sechdr, &r)) elf 1956 scripts/mod/modpost.c sym = elf->symtab_start + r_sym; elf 1962 scripts/mod/modpost.c check_section_mismatch(modname, elf, &r, sym, fromsec); elf 1979 scripts/mod/modpost.c struct elf_info *elf) elf 1982 scripts/mod/modpost.c Elf_Shdr *sechdrs = elf->sechdrs; elf 1985 scripts/mod/modpost.c for (i = 0; i < elf->num_sections; i++) { elf 1986 scripts/mod/modpost.c check_section(modname, elf, &elf->sechdrs[i]); elf 1989 scripts/mod/modpost.c section_rela(modname, elf, &elf->sechdrs[i]); elf 1991 scripts/mod/modpost.c section_rel(modname, elf, &elf->sechdrs[i]); elf 6 tools/build/feature/test-libelf-mmap.c Elf *elf = elf_begin(0, ELF_C_READ_MMAP, 0); elf 8 tools/build/feature/test-libelf-mmap.c return (long)elf; elf 6 tools/build/feature/test-libelf.c Elf *elf = elf_begin(0, ELF_C_READ, 0); elf 8 tools/build/feature/test-libelf.c return (long)elf; elf 388 tools/lib/bpf/btf.c Elf *elf = NULL; elf 405 tools/lib/bpf/btf.c elf = elf_begin(fd, ELF_C_READ, NULL); elf 406 tools/lib/bpf/btf.c if (!elf) { elf 410 tools/lib/bpf/btf.c if (!gelf_getehdr(elf, &ehdr)) { elf 418 tools/lib/bpf/btf.c if (!elf_rawdata(elf_getscn(elf, ehdr.e_shstrndx), NULL)) { elf 423 tools/lib/bpf/btf.c while ((scn = elf_nextscn(elf, scn)) != NULL) { elf 433 tools/lib/bpf/btf.c name = elf_strptr(elf, ehdr.e_shstrndx, sh.sh_name); elf 477 tools/lib/bpf/btf.c if (elf) elf 478 tools/lib/bpf/btf.c elf_end(elf); elf 260 tools/lib/bpf/libbpf.c Elf *elf; elf 296 tools/lib/bpf/libbpf.c #define obj_elf_valid(o) ((o)->efile.elf) elf 464 tools/lib/bpf/libbpf.c name = elf_strptr(obj->efile.elf, elf 541 tools/lib/bpf/libbpf.c if (obj->efile.elf) { elf 542 tools/lib/bpf/libbpf.c elf_end(obj->efile.elf); elf 543 tools/lib/bpf/libbpf.c obj->efile.elf = NULL; elf 572 tools/lib/bpf/libbpf.c obj->efile.elf = elf_memory(obj->efile.obj_buf, elf 585 tools/lib/bpf/libbpf.c obj->efile.elf = elf_begin(obj->efile.fd, elf 589 tools/lib/bpf/libbpf.c if (!obj->efile.elf) { elf 595 tools/lib/bpf/libbpf.c if (!gelf_getehdr(obj->efile.elf, &obj->efile.ehdr)) { elf 676 tools/lib/bpf/libbpf.c Elf *elf = obj->efile.elf; elf 680 tools/lib/bpf/libbpf.c while ((scn = elf_nextscn(elf, scn)) != NULL) { elf 692 tools/lib/bpf/libbpf.c sec_name = elf_strptr(elf, ep->e_shstrndx, sh.sh_name); elf 762 tools/lib/bpf/libbpf.c sname = elf_strptr(obj->efile.elf, obj->efile.strtabidx, elf 905 tools/lib/bpf/libbpf.c scn = elf_getscn(obj->efile.elf, obj->efile.maps_shndx); elf 959 tools/lib/bpf/libbpf.c map_name = elf_strptr(obj->efile.elf, obj->efile.strtabidx, elf 1282 tools/lib/bpf/libbpf.c scn = elf_getscn(obj->efile.elf, obj->efile.btf_maps_shndx); elf 1349 tools/lib/bpf/libbpf.c scn = elf_getscn(obj->efile.elf, idx); elf 1521 tools/lib/bpf/libbpf.c Elf *elf = obj->efile.elf; elf 1529 tools/lib/bpf/libbpf.c if (!elf_rawdata(elf_getscn(elf, ep->e_shstrndx), NULL)) { elf 1534 tools/lib/bpf/libbpf.c while ((scn = elf_nextscn(elf, scn)) != NULL) { elf 1546 tools/lib/bpf/libbpf.c name = elf_strptr(elf, ep->e_shstrndx, sh.sh_name); elf 1765 tools/lib/bpf/libbpf.c name = elf_strptr(obj->efile.elf, obj->efile.strtabidx, elf 71 tools/objtool/arch.h int arch_decode_instruction(struct elf *elf, struct section *sec, elf 29 tools/objtool/arch/x86/decode.c static int is_x86_64(struct elf *elf) elf 31 tools/objtool/arch/x86/decode.c switch (elf->ehdr.e_machine) { elf 37 tools/objtool/arch/x86/decode.c WARN("unexpected ELF machine type %d", elf->ehdr.e_machine); elf 69 tools/objtool/arch/x86/decode.c int arch_decode_instruction(struct elf *elf, struct section *sec, elf 80 tools/objtool/arch/x86/decode.c x86_64 = is_x86_64(elf); elf 261 tools/objtool/check.c ret = arch_decode_instruction(file->elf, sec, offset, elf 316 tools/objtool/check.c sec = find_section_by_name(file->elf, ".rela.discard.unreachable"); elf 358 tools/objtool/check.c sec = find_section_by_name(file->elf, ".rela.discard.reachable"); elf 406 tools/objtool/check.c sec = find_section_by_name(file->elf, ".rela.discard.func_stack_frame_non_standard"); elf 502 tools/objtool/check.c func = find_symbol_by_name(file->elf, *name); elf 522 tools/objtool/check.c sec = find_section_by_name(file->elf, ".rela.discard.ignore_alts"); elf 839 tools/objtool/check.c ret = special_get_alts(file->elf, &special_alts); elf 1166 tools/objtool/check.c sec = find_section_by_name(file->elf, ".discard.unwind_hints"); elf 1257 tools/objtool/check.c sec = find_section_by_name(file->elf, ".rela.discard.retpoline_safe"); elf 2431 tools/objtool/check.c elf_close(file->elf); elf 2442 tools/objtool/check.c file.elf = elf_read(objname, orc ? O_RDWR : O_RDONLY); elf 2443 tools/objtool/check.c if (!file.elf) elf 2448 tools/objtool/check.c file.c_file = find_section_by_name(file.elf, ".comment"); elf 2495 tools/objtool/check.c ret = elf_write(file.elf); elf 51 tools/objtool/check.h struct elf *elf; elf 24 tools/objtool/elf.c struct section *find_section_by_name(struct elf *elf, const char *name) elf 28 tools/objtool/elf.c list_for_each_entry(sec, &elf->sections, list) elf 35 tools/objtool/elf.c static struct section *find_section_by_index(struct elf *elf, elf 40 tools/objtool/elf.c list_for_each_entry(sec, &elf->sections, list) elf 47 tools/objtool/elf.c static struct symbol *find_symbol_by_index(struct elf *elf, unsigned int idx) elf 52 tools/objtool/elf.c list_for_each_entry(sec, &elf->sections, list) elf 72 tools/objtool/elf.c struct symbol *find_symbol_by_name(struct elf *elf, const char *name) elf 77 tools/objtool/elf.c list_for_each_entry(sec, &elf->sections, list) elf 131 tools/objtool/elf.c static int read_sections(struct elf *elf) elf 138 tools/objtool/elf.c if (elf_getshdrnum(elf->elf, §ions_nr)) { elf 143 tools/objtool/elf.c if (elf_getshdrstrndx(elf->elf, &shstrndx)) { elf 161 tools/objtool/elf.c list_add_tail(&sec->list, &elf->sections); elf 163 tools/objtool/elf.c s = elf_getscn(elf->elf, i); elf 176 tools/objtool/elf.c sec->name = elf_strptr(elf->elf, shstrndx, sec->sh.sh_name); elf 199 tools/objtool/elf.c if (elf_nextscn(elf->elf, s)) { elf 207 tools/objtool/elf.c static int read_symbols(struct elf *elf) elf 215 tools/objtool/elf.c symtab = find_section_by_name(elf, ".symtab"); elf 239 tools/objtool/elf.c sym->name = elf_strptr(elf->elf, symtab->sh.sh_link, elf 251 tools/objtool/elf.c sym->sec = find_section_by_index(elf, elf 263 tools/objtool/elf.c sym->sec = find_section_by_index(elf, 0); elf 296 tools/objtool/elf.c list_for_each_entry(sec, &elf->sections, list) { elf 316 tools/objtool/elf.c pfunc = find_symbol_by_name(elf, pname); elf 350 tools/objtool/elf.c static int read_relas(struct elf *elf) elf 357 tools/objtool/elf.c list_for_each_entry(sec, &elf->sections, list) { elf 361 tools/objtool/elf.c sec->base = find_section_by_name(elf, sec->name + 5); elf 387 tools/objtool/elf.c rela->sym = find_symbol_by_index(elf, symndx); elf 404 tools/objtool/elf.c struct elf *elf_read(const char *name, int flags) elf 406 tools/objtool/elf.c struct elf *elf; elf 411 tools/objtool/elf.c elf = malloc(sizeof(*elf)); elf 412 tools/objtool/elf.c if (!elf) { elf 416 tools/objtool/elf.c memset(elf, 0, sizeof(*elf)); elf 418 tools/objtool/elf.c INIT_LIST_HEAD(&elf->sections); elf 420 tools/objtool/elf.c elf->fd = open(name, flags); elf 421 tools/objtool/elf.c if (elf->fd == -1) { elf 434 tools/objtool/elf.c elf->elf = elf_begin(elf->fd, cmd, NULL); elf 435 tools/objtool/elf.c if (!elf->elf) { elf 440 tools/objtool/elf.c if (!gelf_getehdr(elf->elf, &elf->ehdr)) { elf 445 tools/objtool/elf.c if (read_sections(elf)) elf 448 tools/objtool/elf.c if (read_symbols(elf)) elf 451 tools/objtool/elf.c if (read_relas(elf)) elf 454 tools/objtool/elf.c return elf; elf 457 tools/objtool/elf.c elf_close(elf); elf 461 tools/objtool/elf.c struct section *elf_create_section(struct elf *elf, const char *name, elf 481 tools/objtool/elf.c list_add_tail(&sec->list, &elf->sections); elf 483 tools/objtool/elf.c s = elf_newscn(elf->elf); elf 530 tools/objtool/elf.c shstrtab = find_section_by_name(elf, ".shstrtab"); elf 532 tools/objtool/elf.c shstrtab = find_section_by_name(elf, ".strtab"); elf 538 tools/objtool/elf.c s = elf_getscn(elf->elf, shstrtab->idx); elf 562 tools/objtool/elf.c struct section *elf_create_rela_section(struct elf *elf, struct section *base) elf 575 tools/objtool/elf.c sec = elf_create_section(elf, relaname, sizeof(GElf_Rela), 0); elf 585 tools/objtool/elf.c sec->sh.sh_link = find_section_by_name(elf, ".symtab")->idx; elf 625 tools/objtool/elf.c int elf_write(struct elf *elf) elf 631 tools/objtool/elf.c list_for_each_entry(sec, &elf->sections, list) { elf 633 tools/objtool/elf.c s = elf_getscn(elf->elf, sec->idx); elf 646 tools/objtool/elf.c elf_flagelf(elf->elf, ELF_C_SET, ELF_F_DIRTY); elf 649 tools/objtool/elf.c if (elf_update(elf->elf, ELF_C_WRITE) < 0) { elf 657 tools/objtool/elf.c void elf_close(struct elf *elf) elf 663 tools/objtool/elf.c if (elf->elf) elf 664 tools/objtool/elf.c elf_end(elf->elf); elf 666 tools/objtool/elf.c if (elf->fd > 0) elf 667 tools/objtool/elf.c close(elf->fd); elf 669 tools/objtool/elf.c list_for_each_entry_safe(sec, tmpsec, &elf->sections, list) { elf 684 tools/objtool/elf.c free(elf); elf 69 tools/objtool/elf.h Elf *elf; elf 78 tools/objtool/elf.h struct elf *elf_read(const char *name, int flags); elf 79 tools/objtool/elf.h struct section *find_section_by_name(struct elf *elf, const char *name); elf 81 tools/objtool/elf.h struct symbol *find_symbol_by_name(struct elf *elf, const char *name); elf 87 tools/objtool/elf.h struct section *elf_create_section(struct elf *elf, const char *name, size_t elf 89 tools/objtool/elf.h struct section *elf_create_rela_section(struct elf *elf, struct section *base); elf 91 tools/objtool/elf.h int elf_write(struct elf *elf); elf 92 tools/objtool/elf.h void elf_close(struct elf *elf); elf 95 tools/objtool/elf.h list_for_each_entry(sec, &file->elf->sections, list) elf 70 tools/objtool/orc_dump.c Elf *elf; elf 88 tools/objtool/orc_dump.c elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); elf 89 tools/objtool/orc_dump.c if (!elf) { elf 94 tools/objtool/orc_dump.c if (elf_getshdrnum(elf, &nr_sections)) { elf 99 tools/objtool/orc_dump.c if (elf_getshdrstrndx(elf, &shstrtab_idx)) { elf 105 tools/objtool/orc_dump.c scn = elf_getscn(elf, i); elf 116 tools/objtool/orc_dump.c name = elf_strptr(elf, shstrtab_idx, sh.sh_name); elf 165 tools/objtool/orc_dump.c scn = elf_getscn(elf, sym.st_shndx); elf 176 tools/objtool/orc_dump.c name = elf_strptr(elf, shstrtab_idx, sh.sh_name); elf 182 tools/objtool/orc_dump.c name = elf_strptr(elf, strtab_idx, sym.st_name); elf 208 tools/objtool/orc_dump.c elf_end(elf); elf 131 tools/objtool/orc_gen.c sec = find_section_by_name(file->elf, ".orc_unwind"); elf 162 tools/objtool/orc_gen.c sec = elf_create_section(file->elf, ".orc_unwind_ip", sizeof(int), idx); elf 166 tools/objtool/orc_gen.c ip_relasec = elf_create_rela_section(file->elf, sec); elf 171 tools/objtool/orc_gen.c u_sec = elf_create_section(file->elf, ".orc_unwind", elf 71 tools/objtool/special.c static int get_alt_entry(struct elf *elf, struct special_entry *entry, elf 159 tools/objtool/special.c int special_get_alts(struct elf *elf, struct list_head *alts) elf 170 tools/objtool/special.c sec = find_section_by_name(elf, entry->sec); elf 190 tools/objtool/special.c ret = get_alt_entry(elf, entry, sec, idx, alt); elf 29 tools/objtool/special.h int special_get_alts(struct elf *elf, struct list_head *alts); elf 260 tools/perf/util/probe-event.c Elf *elf; elf 272 tools/perf/util/probe-event.c elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); elf 273 tools/perf/util/probe-event.c if (elf == NULL) elf 276 tools/perf/util/probe-event.c if (gelf_getehdr(elf, &ehdr) == NULL) elf 279 tools/perf/util/probe-event.c sec = elf_section_by_name(elf, &ehdr, &shdr, elf 305 tools/perf/util/probe-event.c elf_end(elf); elf 531 tools/perf/util/probe-event.c Elf *elf; elf 543 tools/perf/util/probe-event.c elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); elf 544 tools/perf/util/probe-event.c if (elf == NULL) { elf 549 tools/perf/util/probe-event.c if (gelf_getehdr(elf, &ehdr) == NULL) elf 552 tools/perf/util/probe-event.c if (!elf_section_by_name(elf, &ehdr, &shdr, ".text", NULL)) elf 558 tools/perf/util/probe-event.c elf_end(elf); elf 1154 tools/perf/util/probe-finder.c Elf *elf; elf 1161 tools/perf/util/probe-finder.c elf = dwarf_getelf(dbg->dbg); elf 1162 tools/perf/util/probe-finder.c if (elf == NULL) elf 1165 tools/perf/util/probe-finder.c if (gelf_getehdr(elf, &ehdr) == NULL) elf 1174 tools/perf/util/probe-finder.c if (elf_section_by_name(elf, &ehdr, &shdr, ".eh_frame", NULL) && elf 1176 tools/perf/util/probe-finder.c pf->cfi_eh = dwarf_getcfi_elf(elf); elf 1549 tools/perf/util/probe-finder.c Elf *elf; elf 1553 tools/perf/util/probe-finder.c elf = dwfl_module_getelf(dbg->mod, &dbg->bias); elf 1554 tools/perf/util/probe-finder.c if (!elf) elf 1566 tools/perf/util/probe-finder.c scn = elf_getscn(elf, shndx); elf 75 tools/perf/util/symbol-elf.c static int elf_getphdrnum(Elf *elf, size_t *dst) elf 80 tools/perf/util/symbol-elf.c ehdr = gelf_getehdr(elf, &gehdr); elf 91 tools/perf/util/symbol-elf.c static int elf_getshdrstrndx(Elf *elf __maybe_unused, size_t *dst __maybe_unused) elf 188 tools/perf/util/symbol-elf.c static size_t elf_addr_to_index(Elf *elf, GElf_Addr addr) elf 194 tools/perf/util/symbol-elf.c while ((sec = elf_nextscn(elf, sec)) != NULL) { elf 207 tools/perf/util/symbol-elf.c Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep, elf 214 tools/perf/util/symbol-elf.c if (!elf_rawdata(elf_getscn(elf, ep->e_shstrndx), NULL)) elf 217 tools/perf/util/symbol-elf.c while ((sec = elf_nextscn(elf, sec)) != NULL) { elf 221 tools/perf/util/symbol-elf.c str = elf_strptr(elf, ep->e_shstrndx, shp->sh_name); elf 294 tools/perf/util/symbol-elf.c Elf *elf; elf 300 tools/perf/util/symbol-elf.c elf = ss->elf; elf 310 tools/perf/util/symbol-elf.c scn_plt_rel = elf_section_by_name(elf, &ehdr, &shdr_rel_plt, elf 313 tools/perf/util/symbol-elf.c scn_plt_rel = elf_section_by_name(elf, &ehdr, &shdr_rel_plt, elf 324 tools/perf/util/symbol-elf.c if (elf_section_by_name(elf, &ehdr, &shdr_plt, ".plt", NULL) == NULL) elf 339 tools/perf/util/symbol-elf.c scn_symstrs = elf_getscn(elf, shdr_dynsym.sh_link); elf 454 tools/perf/util/symbol-elf.c static int elf_read_build_id(Elf *elf, void *bf, size_t size) elf 467 tools/perf/util/symbol-elf.c ek = elf_kind(elf); elf 471 tools/perf/util/symbol-elf.c if (gelf_getehdr(elf, &ehdr) == NULL) { elf 483 tools/perf/util/symbol-elf.c sec = elf_section_by_name(elf, &ehdr, &shdr, elf 488 tools/perf/util/symbol-elf.c sec = elf_section_by_name(elf, &ehdr, &shdr, elf 493 tools/perf/util/symbol-elf.c sec = elf_section_by_name(elf, &ehdr, &shdr, elf 536 tools/perf/util/symbol-elf.c Elf *elf; elf 545 tools/perf/util/symbol-elf.c elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); elf 546 tools/perf/util/symbol-elf.c if (elf == NULL) { elf 551 tools/perf/util/symbol-elf.c err = elf_read_build_id(elf, bf, size); elf 553 tools/perf/util/symbol-elf.c elf_end(elf); elf 615 tools/perf/util/symbol-elf.c Elf *elf; elf 626 tools/perf/util/symbol-elf.c elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); elf 627 tools/perf/util/symbol-elf.c if (elf == NULL) { elf 632 tools/perf/util/symbol-elf.c ek = elf_kind(elf); elf 636 tools/perf/util/symbol-elf.c if (gelf_getehdr(elf, &ehdr) == NULL) { elf 641 tools/perf/util/symbol-elf.c sec = elf_section_by_name(elf, &ehdr, &shdr, elf 656 tools/perf/util/symbol-elf.c elf_end(elf); elf 703 tools/perf/util/symbol-elf.c elf_end(ss->elf); elf 716 tools/perf/util/symbol-elf.c Elf *elf; elf 733 tools/perf/util/symbol-elf.c elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); elf 734 tools/perf/util/symbol-elf.c if (elf == NULL) { elf 740 tools/perf/util/symbol-elf.c if (gelf_getehdr(elf, &ehdr) == NULL) { elf 755 tools/perf/util/symbol-elf.c if (elf_read_build_id(elf, build_id, BUILD_ID_SIZE) < 0) { elf 767 tools/perf/util/symbol-elf.c ss->is_64_bit = (gelf_getclass(elf) == ELFCLASS64); elf 769 tools/perf/util/symbol-elf.c ss->symtab = elf_section_by_name(elf, &ehdr, &ss->symshdr, ".symtab", elf 775 tools/perf/util/symbol-elf.c ss->dynsym = elf_section_by_name(elf, &ehdr, &ss->dynshdr, ".dynsym", elf 781 tools/perf/util/symbol-elf.c ss->opdsec = elf_section_by_name(elf, &ehdr, &ss->opdshdr, ".opd", elf 797 tools/perf/util/symbol-elf.c ss->elf = elf; elf 805 tools/perf/util/symbol-elf.c elf_end(elf); elf 966 tools/perf/util/symbol-elf.c Elf *elf; elf 997 tools/perf/util/symbol-elf.c elf = syms_ss->elf; elf 1002 tools/perf/util/symbol-elf.c if (elf_section_by_name(runtime_ss->elf, &runtime_ss->ehdr, &tshdr, elf 1013 tools/perf/util/symbol-elf.c sec = elf_getscn(elf, shdr.sh_link); elf 1021 tools/perf/util/symbol-elf.c sec_strndx = elf_getscn(runtime_ss->elf, runtime_ss->ehdr.e_shstrndx); elf 1090 tools/perf/util/symbol-elf.c sym.st_shndx = elf_addr_to_index(runtime_ss->elf, elf 1106 tools/perf/util/symbol-elf.c sec = elf_getscn(runtime_ss->elf, sym.st_shndx); elf 1173 tools/perf/util/symbol-elf.c static int elf_read_maps(Elf *elf, bool exe, mapfn_t mapfn, void *data) elf 1180 tools/perf/util/symbol-elf.c if (elf_getphdrnum(elf, &phdrnum)) elf 1184 tools/perf/util/symbol-elf.c if (gelf_getphdr(elf, i, &phdr) == NULL) elf 1209 tools/perf/util/symbol-elf.c Elf *elf; elf 1211 tools/perf/util/symbol-elf.c elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); elf 1212 tools/perf/util/symbol-elf.c if (elf == NULL) elf 1216 tools/perf/util/symbol-elf.c *is_64_bit = (gelf_getclass(elf) == ELFCLASS64); elf 1218 tools/perf/util/symbol-elf.c err = elf_read_maps(elf, exe, mapfn, data); elf 1220 tools/perf/util/symbol-elf.c elf_end(elf); elf 1229 tools/perf/util/symbol-elf.c Elf *elf; elf 1231 tools/perf/util/symbol-elf.c elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); elf 1232 tools/perf/util/symbol-elf.c if (elf == NULL) elf 1235 tools/perf/util/symbol-elf.c ek = elf_kind(elf); elf 1239 tools/perf/util/symbol-elf.c if (gelf_getclass(elf) == ELFCLASS64) { elf 1244 tools/perf/util/symbol-elf.c if (gelf_getehdr(elf, &ehdr) == NULL) elf 1252 tools/perf/util/symbol-elf.c elf_end(elf); elf 1301 tools/perf/util/symbol-elf.c Elf *elf; elf 1313 tools/perf/util/symbol-elf.c kcore->elf = elf_begin(kcore->fd, ELF_C_READ, NULL); elf 1314 tools/perf/util/symbol-elf.c if (!kcore->elf) elf 1317 tools/perf/util/symbol-elf.c kcore->elfclass = gelf_getclass(kcore->elf); elf 1321 tools/perf/util/symbol-elf.c ehdr = gelf_getehdr(kcore->elf, &kcore->ehdr); elf 1328 tools/perf/util/symbol-elf.c elf_end(kcore->elf); elf 1346 tools/perf/util/symbol-elf.c kcore->elf = elf_begin(kcore->fd, ELF_C_WRITE, NULL); elf 1347 tools/perf/util/symbol-elf.c if (!kcore->elf) elf 1350 tools/perf/util/symbol-elf.c if (!gelf_newehdr(kcore->elf, elfclass)) elf 1358 tools/perf/util/symbol-elf.c elf_end(kcore->elf); elf 1367 tools/perf/util/symbol-elf.c elf_end(kcore->elf); elf 1398 tools/perf/util/symbol-elf.c if (!gelf_update_ehdr(to->elf, ehdr)) elf 1401 tools/perf/util/symbol-elf.c if (!gelf_newphdr(to->elf, count)) elf 1421 tools/perf/util/symbol-elf.c if (!gelf_update_phdr(kcore->elf, idx, &phdr)) elf 1429 tools/perf/util/symbol-elf.c return elf_update(kcore->elf, ELF_C_WRITE); elf 1638 tools/perf/util/symbol-elf.c static int kcore_copy__read_maps(struct kcore_copy_info *kci, Elf *elf) elf 1640 tools/perf/util/symbol-elf.c if (elf_read_maps(elf, true, kcore_copy__read_map, kci) < 0) elf 1705 tools/perf/util/symbol-elf.c Elf *elf) elf 1739 tools/perf/util/symbol-elf.c if (kcore_copy__read_maps(kci, elf)) elf 1889 tools/perf/util/symbol-elf.c if (kcore_copy__calc_maps(&kci, from_dir, kcore.elf)) elf 1898 tools/perf/util/symbol-elf.c offset = gelf_fsize(extract.elf, ELF_T_EHDR, 1, EV_CURRENT) + elf 1899 tools/perf/util/symbol-elf.c gelf_fsize(extract.elf, ELF_T_PHDR, kci.phnum, EV_CURRENT); elf 2034 tools/perf/util/symbol-elf.c static int populate_sdt_note(Elf **elf, const char *data, size_t len, elf 2050 tools/perf/util/symbol-elf.c .d_size = gelf_fsize((*elf), ELF_T_ADDR, NR_ADDR, EV_CURRENT), elf 2071 tools/perf/util/symbol-elf.c if (gelf_xlatetom(*elf, &dst, &src, elf 2072 tools/perf/util/symbol-elf.c elf_getident(*elf, NULL)[EI_DATA]) == NULL) { elf 2114 tools/perf/util/symbol-elf.c if (gelf_getclass(*elf) == ELFCLASS32) { elf 2122 tools/perf/util/symbol-elf.c if (!gelf_getehdr(*elf, &ehdr)) { elf 2135 tools/perf/util/symbol-elf.c if (elf_section_by_name(*elf, &ehdr, &shdr, SDT_BASE_SCN, NULL)) elf 2139 tools/perf/util/symbol-elf.c if (elf_section_by_name(*elf, &ehdr, &shdr, SDT_PROBES_SCN, NULL)) elf 2166 tools/perf/util/symbol-elf.c static int construct_sdt_notes_list(Elf *elf, struct list_head *sdt_notes) elf 2177 tools/perf/util/symbol-elf.c if (gelf_getehdr(elf, &ehdr) == NULL) { elf 2181 tools/perf/util/symbol-elf.c if (elf_getshdrstrndx(elf, &shstrndx) != 0) { elf 2187 tools/perf/util/symbol-elf.c scn = elf_section_by_name(elf, &ehdr, &shdr, SDT_NOTE_SCN, NULL); elf 2210 tools/perf/util/symbol-elf.c ret = populate_sdt_note(&elf, ((data->d_buf) + desc_off), elf 2233 tools/perf/util/symbol-elf.c Elf *elf; elf 2240 tools/perf/util/symbol-elf.c elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); elf 2241 tools/perf/util/symbol-elf.c if (!elf) { elf 2245 tools/perf/util/symbol-elf.c ret = construct_sdt_notes_list(elf, head); elf 2246 tools/perf/util/symbol-elf.c elf_end(elf); elf 37 tools/perf/util/symbol.h Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep, elf 21 tools/perf/util/symsrc.h Elf *elf; elf 173 tools/perf/util/unwind-libunwind-local.c Elf *elf; elf 178 tools/perf/util/unwind-libunwind-local.c elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); elf 179 tools/perf/util/unwind-libunwind-local.c if (elf == NULL) elf 183 tools/perf/util/unwind-libunwind-local.c if (gelf_getehdr(elf, &ehdr) == NULL) elf 186 tools/perf/util/unwind-libunwind-local.c if (!elf_section_by_name(elf, &ehdr, &shdr, name, NULL)) elf 192 tools/perf/util/unwind-libunwind-local.c elf_end(elf); elf 199 tools/perf/util/unwind-libunwind-local.c Elf *elf; elf 203 tools/perf/util/unwind-libunwind-local.c elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); elf 204 tools/perf/util/unwind-libunwind-local.c if (elf == NULL) elf 206 tools/perf/util/unwind-libunwind-local.c if (gelf_getehdr(elf, &ehdr) == NULL) elf 212 tools/perf/util/unwind-libunwind-local.c elf_end(elf);