Lines Matching refs:efile

702 	struct elf_state efile;  member
869 Elf_Data *symbols = obj->efile.symbols; in bpf_object__add_programs()
905 if (sec_idx != obj->efile.text_shndx && ELF64_ST_BIND(sym->st_info) == STB_LOCAL) { in bpf_object__add_programs()
1464 for (sec_idx = 0; sec_idx < obj->efile.sec_cnt; ++sec_idx) { in bpf_object_init_struct_ops()
1465 struct elf_sec_desc *desc = &obj->efile.secs[sec_idx]; in bpf_object_init_struct_ops()
1507 obj->efile.fd = -1; in bpf_object__new()
1514 obj->efile.obj_buf = obj_buf; in bpf_object__new()
1515 obj->efile.obj_buf_sz = obj_buf_sz; in bpf_object__new()
1516 obj->efile.btf_maps_shndx = -1; in bpf_object__new()
1527 if (!obj->efile.elf) in bpf_object__elf_finish()
1530 elf_end(obj->efile.elf); in bpf_object__elf_finish()
1531 obj->efile.elf = NULL; in bpf_object__elf_finish()
1532 obj->efile.ehdr = NULL; in bpf_object__elf_finish()
1533 obj->efile.symbols = NULL; in bpf_object__elf_finish()
1534 obj->efile.arena_data = NULL; in bpf_object__elf_finish()
1536 zfree(&obj->efile.secs); in bpf_object__elf_finish()
1537 obj->efile.sec_cnt = 0; in bpf_object__elf_finish()
1538 zclose(obj->efile.fd); in bpf_object__elf_finish()
1539 obj->efile.obj_buf = NULL; in bpf_object__elf_finish()
1540 obj->efile.obj_buf_sz = 0; in bpf_object__elf_finish()
1549 if (obj->efile.elf) { in bpf_object__elf_init()
1554 if (obj->efile.obj_buf_sz > 0) { in bpf_object__elf_init()
1556 elf = elf_memory((char *)obj->efile.obj_buf, obj->efile.obj_buf_sz); in bpf_object__elf_init()
1558 obj->efile.fd = open(obj->path, O_RDONLY | O_CLOEXEC); in bpf_object__elf_init()
1559 if (obj->efile.fd < 0) { in bpf_object__elf_init()
1565 elf = elf_begin(obj->efile.fd, ELF_C_READ_MMAP, NULL); in bpf_object__elf_init()
1574 obj->efile.elf = elf; in bpf_object__elf_init()
1588 obj->efile.ehdr = ehdr = elf64_getehdr(elf); in bpf_object__elf_init()
1589 if (!obj->efile.ehdr) { in bpf_object__elf_init()
1605 if (elf_getshdrstrndx(elf, &obj->efile.shstrndx)) { in bpf_object__elf_init()
1613 if (!elf_rawdata(elf_getscn(elf, obj->efile.shstrndx), NULL)) { in bpf_object__elf_init()
1702 Elf_Data *symbols = obj->efile.symbols; in find_elf_var_sym()
2001 for (sec_idx = 1; sec_idx < obj->efile.sec_cnt; sec_idx++) { in bpf_object__init_global_data_maps()
2002 sec_desc = &obj->efile.secs[sec_idx]; in bpf_object__init_global_data_maps()
2364 ".kconfig", obj->efile.symbols_shndx, in bpf_object__init_kconfig_map()
3003 if (obj->efile.btf_maps_shndx < 0) in bpf_object__init_user_btf_maps()
3006 scn = elf_sec_by_idx(obj, obj->efile.btf_maps_shndx); in bpf_object__init_user_btf_maps()
3022 obj->efile.btf_maps_sec_btf_id = i; in bpf_object__init_user_btf_maps()
3035 obj->efile.btf_maps_shndx, in bpf_object__init_user_btf_maps()
3055 if (obj->efile.arena_data) { in bpf_object__init_user_btf_maps()
3056 err = init_arena_map_data(obj, map, ARENA_SEC, obj->efile.arena_data_shndx, in bpf_object__init_user_btf_maps()
3057 obj->efile.arena_data->d_buf, in bpf_object__init_user_btf_maps()
3058 obj->efile.arena_data->d_size); in bpf_object__init_user_btf_maps()
3063 if (obj->efile.arena_data && !obj->arena_map) { in bpf_object__init_user_btf_maps()
3232 return obj->efile.btf_maps_shndx >= 0 || in libbpf_needs_btf()
3233 obj->efile.has_st_ops || in libbpf_needs_btf()
3239 return obj->efile.has_st_ops; in kernel_needs_btf()
3638 name = elf_strptr(obj->efile.elf, obj->efile.strtabidx, off); in elf_sym_str()
3652 name = elf_strptr(obj->efile.elf, obj->efile.shstrndx, off); in elf_sec_str()
3666 scn = elf_getscn(obj->efile.elf, idx); in elf_sec_by_idx()
3678 Elf *elf = obj->efile.elf; in elf_sec_by_name()
3753 if (idx >= obj->efile.symbols->d_size / sizeof(Elf64_Sym)) in elf_sym_by_idx()
3756 return (Elf64_Sym *)obj->efile.symbols->d_buf + idx; in elf_sym_by_idx()
3822 Elf *elf = obj->efile.elf; in bpf_object__elf_collect()
3836 if (elf_getshdrnum(obj->efile.elf, &obj->efile.sec_cnt)) { in bpf_object__elf_collect()
3841 obj->efile.secs = calloc(obj->efile.sec_cnt, sizeof(*obj->efile.secs)); in bpf_object__elf_collect()
3842 if (!obj->efile.secs) in bpf_object__elf_collect()
3855 if (obj->efile.symbols) { in bpf_object__elf_collect()
3866 obj->efile.symbols = data; in bpf_object__elf_collect()
3867 obj->efile.symbols_shndx = idx; in bpf_object__elf_collect()
3868 obj->efile.strtabidx = sh->sh_link; in bpf_object__elf_collect()
3872 if (!obj->efile.symbols) { in bpf_object__elf_collect()
3881 sec_desc = &obj->efile.secs[idx]; in bpf_object__elf_collect()
3915 obj->efile.btf_maps_shndx = idx; in bpf_object__elf_collect()
3929 obj->efile.text_shndx = idx; in bpf_object__elf_collect()
3950 obj->efile.has_st_ops = true; in bpf_object__elf_collect()
3952 obj->efile.arena_data = data; in bpf_object__elf_collect()
3953 obj->efile.arena_data_shndx = idx; in bpf_object__elf_collect()
3962 targ_sec_idx >= obj->efile.sec_cnt) in bpf_object__elf_collect()
3992 if (!obj->efile.strtabidx || obj->efile.strtabidx > idx) { in bpf_object__elf_collect()
4227 if (!obj->efile.symbols) in bpf_object__collect_externs()
4230 scn = elf_sec_by_idx(obj, obj->efile.symbols_shndx); in bpf_object__collect_externs()
4437 return prog->sec_idx == obj->efile.text_shndx; in prog_is_subprog()
4458 switch (obj->efile.secs[shndx].sec_type) { in bpf_object__shndx_is_data()
4471 return shndx == obj->efile.btf_maps_shndx; in bpf_object__shndx_is_maps()
4477 if (shndx == obj->efile.symbols_shndx) in bpf_object__section_to_libbpf_map_type()
4480 switch (obj->efile.secs[shndx].sec_type) { in bpf_object__section_to_libbpf_map_type()
4544 if (!shdr_idx || shdr_idx != obj->efile.text_shndx) { in bpf_program__record_reloc()
4568 if (sym_is_subprog(sym, obj->efile.text_shndx)) { in bpf_program__record_reloc()
4588 if (shdr_idx == obj->efile.arena_data_shndx) { in bpf_program__record_reloc()
4703 if (sec_idx >= obj->efile.sec_cnt) in bpf_object__collect_prog_relos()
4735 if (sym->st_shndx >= obj->efile.sec_cnt) { in bpf_object__collect_prog_relos()
4799 if (map->sec_idx == obj->efile.btf_maps_shndx || bpf_map__is_struct_ops(map)) in map_fill_btf_type_info()
6472 subprog = find_prog_by_sec_insn(obj, obj->efile.text_shndx, sub_insn_idx); in bpf_object__reloc_code()
7194 if (!obj->efile.btf_maps_sec_btf_id || !obj->btf) in bpf_object__collect_map_relos()
7196 sec = btf__type_by_id(obj->btf, obj->efile.btf_maps_sec_btf_id); in bpf_object__collect_map_relos()
7222 if (map->sec_idx != obj->efile.btf_maps_shndx) in bpf_object__collect_map_relos()
7240 if (sym->st_shndx != obj->efile.btf_maps_shndx) { in bpf_object__collect_map_relos()
7318 for (i = 0; i < obj->efile.sec_cnt; i++) { in bpf_object__collect_relos()
7319 struct elf_sec_desc *sec_desc = &obj->efile.secs[i]; in bpf_object__collect_relos()
7331 if (shdr->sh_type != SHT_REL || idx < 0 || idx >= obj->efile.sec_cnt) { in bpf_object__collect_relos()
7336 if (obj->efile.secs[idx].sec_type == SEC_ST_OPS) in bpf_object__collect_relos()
7338 else if (idx == obj->efile.btf_maps_shndx) in bpf_object__collect_relos()