Lines Matching defs:elf
316 static int sanity_check_usdt_elf(Elf *elf, const char *path)
321 if (elf_kind(elf) != ELF_K_ELF) {
322 pr_warn("usdt: unrecognized ELF kind %d for '%s'\n", elf_kind(elf), path);
326 switch (gelf_getclass(elf)) {
344 if (!gelf_getehdr(elf, &ehdr))
368 static int find_elf_sec_by_name(Elf *elf, const char *sec_name, GElf_Shdr *shdr, Elf_Scn **scn)
373 if (elf_getshdrstrndx(elf, &shstrndx))
377 if (!elf_rawdata(elf_getscn(elf, shstrndx), NULL))
380 while ((sec = elf_nextscn(elf, sec)) != NULL) {
386 name = elf_strptr(elf, shstrndx, shdr->sh_name);
411 static int parse_elf_segs(Elf *elf, const char *path, struct elf_seg **segs, size_t *seg_cnt)
421 if (elf_getphdrnum(elf, &n)) {
427 if (!gelf_getphdr(elf, i, &phdr)) {
588 static int collect_usdt_targets(struct usdt_manager *man, Elf *elf, const char *path, pid_t pid,
606 err = find_elf_sec_by_name(elf, USDT_NOTE_SEC, ¬es_shdr, ¬es_scn);
612 if (notes_shdr.sh_type != SHT_NOTE || !gelf_getehdr(elf, &ehdr)) {
617 err = parse_elf_segs(elf, path, &segs, &seg_cnt);
627 if (find_elf_sec_by_name(elf, USDT_BASE_SEC, &base_shdr, &base_scn) == 0)
988 err = sanity_check_usdt_elf(elf_fd.elf, path);
1001 err = collect_usdt_targets(man, elf_fd.elf, path, pid, usdt_provider, usdt_name,