Lines Matching refs:efile

655 	struct elf_state efile;  member
811 Elf_Data *symbols = obj->efile.symbols; in bpf_object__add_programs()
847 if (sec_idx != obj->efile.text_shndx && ELF64_ST_BIND(sym->st_info) == STB_LOCAL) { in bpf_object__add_programs()
1240 err = init_struct_ops_maps(obj, STRUCT_OPS_SEC, obj->efile.st_ops_shndx, in bpf_object_init_struct_ops()
1241 obj->efile.st_ops_data, 0); in bpf_object_init_struct_ops()
1243 obj->efile.st_ops_link_shndx, in bpf_object_init_struct_ops()
1244 obj->efile.st_ops_link_data, in bpf_object_init_struct_ops()
1274 obj->efile.fd = -1; in bpf_object__new()
1281 obj->efile.obj_buf = obj_buf; in bpf_object__new()
1282 obj->efile.obj_buf_sz = obj_buf_sz; in bpf_object__new()
1283 obj->efile.btf_maps_shndx = -1; in bpf_object__new()
1284 obj->efile.st_ops_shndx = -1; in bpf_object__new()
1285 obj->efile.st_ops_link_shndx = -1; in bpf_object__new()
1296 if (!obj->efile.elf) in bpf_object__elf_finish()
1299 elf_end(obj->efile.elf); in bpf_object__elf_finish()
1300 obj->efile.elf = NULL; in bpf_object__elf_finish()
1301 obj->efile.symbols = NULL; in bpf_object__elf_finish()
1302 obj->efile.st_ops_data = NULL; in bpf_object__elf_finish()
1303 obj->efile.st_ops_link_data = NULL; in bpf_object__elf_finish()
1305 zfree(&obj->efile.secs); in bpf_object__elf_finish()
1306 obj->efile.sec_cnt = 0; in bpf_object__elf_finish()
1307 zclose(obj->efile.fd); in bpf_object__elf_finish()
1308 obj->efile.obj_buf = NULL; in bpf_object__elf_finish()
1309 obj->efile.obj_buf_sz = 0; in bpf_object__elf_finish()
1318 if (obj->efile.elf) { in bpf_object__elf_init()
1323 if (obj->efile.obj_buf_sz > 0) { in bpf_object__elf_init()
1325 elf = elf_memory((char *)obj->efile.obj_buf, obj->efile.obj_buf_sz); in bpf_object__elf_init()
1327 obj->efile.fd = open(obj->path, O_RDONLY | O_CLOEXEC); in bpf_object__elf_init()
1328 if (obj->efile.fd < 0) { in bpf_object__elf_init()
1337 elf = elf_begin(obj->efile.fd, ELF_C_READ_MMAP, NULL); in bpf_object__elf_init()
1346 obj->efile.elf = elf; in bpf_object__elf_init()
1360 obj->efile.ehdr = ehdr = elf64_getehdr(elf); in bpf_object__elf_init()
1361 if (!obj->efile.ehdr) { in bpf_object__elf_init()
1367 if (elf_getshdrstrndx(elf, &obj->efile.shstrndx)) { in bpf_object__elf_init()
1375 if (!elf_rawdata(elf_getscn(elf, obj->efile.shstrndx), NULL)) { in bpf_object__elf_init()
1398 if (obj->efile.ehdr->e_ident[EI_DATA] == ELFDATA2LSB) in bpf_object__check_endianness()
1401 if (obj->efile.ehdr->e_ident[EI_DATA] == ELFDATA2MSB) in bpf_object__check_endianness()
1468 Elf_Data *symbols = obj->efile.symbols; in find_elf_var_sym()
1705 for (sec_idx = 1; sec_idx < obj->efile.sec_cnt; sec_idx++) { in bpf_object__init_global_data_maps()
1706 sec_desc = &obj->efile.secs[sec_idx]; in bpf_object__init_global_data_maps()
2054 ".kconfig", obj->efile.symbols_shndx, in bpf_object__init_kconfig_map()
2625 if (obj->efile.btf_maps_shndx < 0) in bpf_object__init_user_btf_maps()
2628 scn = elf_sec_by_idx(obj, obj->efile.btf_maps_shndx); in bpf_object__init_user_btf_maps()
2644 obj->efile.btf_maps_sec_btf_id = i; in bpf_object__init_user_btf_maps()
2657 obj->efile.btf_maps_shndx, in bpf_object__init_user_btf_maps()
2812 return obj->efile.btf_maps_shndx >= 0 || in libbpf_needs_btf()
2813 obj->efile.st_ops_shndx >= 0 || in libbpf_needs_btf()
2814 obj->efile.st_ops_link_shndx >= 0 || in libbpf_needs_btf()
2820 return obj->efile.st_ops_shndx >= 0 || obj->efile.st_ops_link_shndx >= 0; in kernel_needs_btf()
3205 name = elf_strptr(obj->efile.elf, obj->efile.strtabidx, off); in elf_sym_str()
3219 name = elf_strptr(obj->efile.elf, obj->efile.shstrndx, off); in elf_sec_str()
3233 scn = elf_getscn(obj->efile.elf, idx); in elf_sec_by_idx()
3245 Elf *elf = obj->efile.elf; in elf_sec_by_name()
3320 if (idx >= obj->efile.symbols->d_size / sizeof(Elf64_Sym)) in elf_sym_by_idx()
3323 return (Elf64_Sym *)obj->efile.symbols->d_buf + idx; in elf_sym_by_idx()
3389 Elf *elf = obj->efile.elf; in bpf_object__elf_collect()
3403 if (elf_getshdrnum(obj->efile.elf, &obj->efile.sec_cnt)) { in bpf_object__elf_collect()
3408 obj->efile.secs = calloc(obj->efile.sec_cnt, sizeof(*obj->efile.secs)); in bpf_object__elf_collect()
3409 if (!obj->efile.secs) in bpf_object__elf_collect()
3422 if (obj->efile.symbols) { in bpf_object__elf_collect()
3433 obj->efile.symbols = data; in bpf_object__elf_collect()
3434 obj->efile.symbols_shndx = idx; in bpf_object__elf_collect()
3435 obj->efile.strtabidx = sh->sh_link; in bpf_object__elf_collect()
3439 if (!obj->efile.symbols) { in bpf_object__elf_collect()
3448 sec_desc = &obj->efile.secs[idx]; in bpf_object__elf_collect()
3482 obj->efile.btf_maps_shndx = idx; in bpf_object__elf_collect()
3496 obj->efile.text_shndx = idx; in bpf_object__elf_collect()
3511 obj->efile.st_ops_data = data; in bpf_object__elf_collect()
3512 obj->efile.st_ops_shndx = idx; in bpf_object__elf_collect()
3514 obj->efile.st_ops_link_data = data; in bpf_object__elf_collect()
3515 obj->efile.st_ops_link_shndx = idx; in bpf_object__elf_collect()
3524 targ_sec_idx >= obj->efile.sec_cnt) in bpf_object__elf_collect()
3552 if (!obj->efile.strtabidx || obj->efile.strtabidx > idx) { in bpf_object__elf_collect()
3783 if (!obj->efile.symbols) in bpf_object__collect_externs()
3786 scn = elf_sec_by_idx(obj, obj->efile.symbols_shndx); in bpf_object__collect_externs()
3993 return prog->sec_idx == obj->efile.text_shndx && obj->nr_programs > 1; in prog_is_subprog()
4014 switch (obj->efile.secs[shndx].sec_type) { in bpf_object__shndx_is_data()
4027 return shndx == obj->efile.btf_maps_shndx; in bpf_object__shndx_is_maps()
4033 if (shndx == obj->efile.symbols_shndx) in bpf_object__section_to_libbpf_map_type()
4036 switch (obj->efile.secs[shndx].sec_type) { in bpf_object__section_to_libbpf_map_type()
4100 if (!shdr_idx || shdr_idx != obj->efile.text_shndx) { in bpf_program__record_reloc()
4124 if (sym_is_subprog(sym, obj->efile.text_shndx)) { in bpf_program__record_reloc()
4250 if (sec_idx >= obj->efile.sec_cnt) in bpf_object__collect_prog_relos()
4282 if (sym->st_shndx >= obj->efile.sec_cnt) { in bpf_object__collect_prog_relos()
4346 if (map->sec_idx == obj->efile.btf_maps_shndx || bpf_map__is_struct_ops(map)) in map_fill_btf_type_info()
6307 subprog = find_prog_by_sec_insn(obj, obj->efile.text_shndx, sub_insn_idx); in bpf_object__reloc_code()
6616 if (!obj->efile.btf_maps_sec_btf_id || !obj->btf) in bpf_object__collect_map_relos()
6618 sec = btf__type_by_id(obj->btf, obj->efile.btf_maps_sec_btf_id); in bpf_object__collect_map_relos()
6644 if (map->sec_idx != obj->efile.btf_maps_shndx) in bpf_object__collect_map_relos()
6662 if (sym->st_shndx != obj->efile.btf_maps_shndx) { in bpf_object__collect_map_relos()
6740 for (i = 0; i < obj->efile.sec_cnt; i++) { in bpf_object__collect_relos()
6741 struct elf_sec_desc *sec_desc = &obj->efile.secs[i]; in bpf_object__collect_relos()
6758 if (idx == obj->efile.st_ops_shndx || idx == obj->efile.st_ops_link_shndx) in bpf_object__collect_relos()
6760 else if (idx == obj->efile.btf_maps_shndx) in bpf_object__collect_relos()