Lines Matching refs:elf
305 static int sanity_check_usdt_elf(Elf *elf, const char *path)
310 if (elf_kind(elf) != ELF_K_ELF) {
311 pr_warn("usdt: unrecognized ELF kind %d for '%s'\n", elf_kind(elf), path);
315 switch (gelf_getclass(elf)) {
333 if (!gelf_getehdr(elf, &ehdr))
357 static int find_elf_sec_by_name(Elf *elf, const char *sec_name, GElf_Shdr *shdr, Elf_Scn **scn)
362 if (elf_getshdrstrndx(elf, &shstrndx))
366 if (!elf_rawdata(elf_getscn(elf, shstrndx), NULL))
369 while ((sec = elf_nextscn(elf, sec)) != NULL) {
375 name = elf_strptr(elf, shstrndx, shdr->sh_name);
400 static int parse_elf_segs(Elf *elf, const char *path, struct elf_seg **segs, size_t *seg_cnt)
410 if (elf_getphdrnum(elf, &n)) {
416 if (!gelf_getphdr(elf, i, &phdr)) {
572 static int parse_usdt_note(Elf *elf, const char *path, GElf_Nhdr *nhdr,
578 static int collect_usdt_targets(struct usdt_manager *man, Elf *elf, const char *path, pid_t pid,
596 err = find_elf_sec_by_name(elf, USDT_NOTE_SEC, ¬es_shdr, ¬es_scn);
602 if (notes_shdr.sh_type != SHT_NOTE || !gelf_getehdr(elf, &ehdr)) {
607 err = parse_elf_segs(elf, path, &segs, &seg_cnt);
616 if (find_elf_sec_by_name(elf, USDT_BASE_SEC, &base_shdr, &base_scn) == 0)
627 err = parse_usdt_note(elf, path, &nhdr, data->d_buf, name_off, desc_off, ¬e);
977 err = sanity_check_usdt_elf(elf_fd.elf, path);
990 err = collect_usdt_targets(man, elf_fd.elf, path, pid, usdt_provider, usdt_name,
1133 static int parse_usdt_note(Elf *elf, const char *path, GElf_Nhdr *nhdr,