Lines Matching refs:efile
456 } efile; member
476 #define obj_elf_valid(o) ((o)->efile.elf)
948 if (obj->efile.st_ops_shndx == -1) in bpf_object__init_struct_ops_maps()
988 map->sec_idx = obj->efile.st_ops_shndx; in bpf_object__init_struct_ops_maps()
1010 if (vsi->offset + type->size > obj->efile.st_ops_data->d_size) { in bpf_object__init_struct_ops_maps()
1017 obj->efile.st_ops_data->d_buf + vsi->offset, in bpf_object__init_struct_ops_maps()
1057 obj->efile.fd = -1; in bpf_object__new()
1064 obj->efile.obj_buf = obj_buf; in bpf_object__new()
1065 obj->efile.obj_buf_sz = obj_buf_sz; in bpf_object__new()
1066 obj->efile.maps_shndx = -1; in bpf_object__new()
1067 obj->efile.btf_maps_shndx = -1; in bpf_object__new()
1068 obj->efile.data_shndx = -1; in bpf_object__new()
1069 obj->efile.rodata_shndx = -1; in bpf_object__new()
1070 obj->efile.bss_shndx = -1; in bpf_object__new()
1071 obj->efile.st_ops_shndx = -1; in bpf_object__new()
1088 if (obj->efile.elf) { in bpf_object__elf_finish()
1089 elf_end(obj->efile.elf); in bpf_object__elf_finish()
1090 obj->efile.elf = NULL; in bpf_object__elf_finish()
1092 obj->efile.symbols = NULL; in bpf_object__elf_finish()
1093 obj->efile.data = NULL; in bpf_object__elf_finish()
1094 obj->efile.rodata = NULL; in bpf_object__elf_finish()
1095 obj->efile.bss = NULL; in bpf_object__elf_finish()
1096 obj->efile.st_ops_data = NULL; in bpf_object__elf_finish()
1098 zfree(&obj->efile.reloc_sects); in bpf_object__elf_finish()
1099 obj->efile.nr_reloc_sects = 0; in bpf_object__elf_finish()
1100 zclose(obj->efile.fd); in bpf_object__elf_finish()
1101 obj->efile.obj_buf = NULL; in bpf_object__elf_finish()
1102 obj->efile.obj_buf_sz = 0; in bpf_object__elf_finish()
1120 if (obj->efile.obj_buf_sz > 0) { in bpf_object__elf_init()
1125 obj->efile.elf = elf_memory((char *)obj->efile.obj_buf, in bpf_object__elf_init()
1126 obj->efile.obj_buf_sz); in bpf_object__elf_init()
1128 obj->efile.fd = open(obj->path, O_RDONLY); in bpf_object__elf_init()
1129 if (obj->efile.fd < 0) { in bpf_object__elf_init()
1138 obj->efile.elf = elf_begin(obj->efile.fd, ELF_C_READ_MMAP, NULL); in bpf_object__elf_init()
1141 if (!obj->efile.elf) { in bpf_object__elf_init()
1147 if (!gelf_getehdr(obj->efile.elf, &obj->efile.ehdr)) { in bpf_object__elf_init()
1152 ep = &obj->efile.ehdr; in bpf_object__elf_init()
1154 if (elf_getshdrstrndx(obj->efile.elf, &obj->efile.shstrndx)) { in bpf_object__elf_init()
1162 if (!elf_rawdata(elf_getscn(obj->efile.elf, obj->efile.shstrndx), NULL)) { in bpf_object__elf_init()
1185 if (obj->efile.ehdr.e_ident[EI_DATA] == ELFDATA2LSB) in bpf_object__check_endianness()
1188 if (obj->efile.ehdr.e_ident[EI_DATA] == ELFDATA2MSB) in bpf_object__check_endianness()
1237 if (obj->efile.data) in bpf_object__section_size()
1238 *size = obj->efile.data->d_size; in bpf_object__section_size()
1240 if (obj->efile.bss) in bpf_object__section_size()
1241 *size = obj->efile.bss->d_size; in bpf_object__section_size()
1243 if (obj->efile.rodata) in bpf_object__section_size()
1244 *size = obj->efile.rodata->d_size; in bpf_object__section_size()
1246 if (obj->efile.st_ops_data) in bpf_object__section_size()
1247 *size = obj->efile.st_ops_data->d_size; in bpf_object__section_size()
1264 Elf_Data *symbols = obj->efile.symbols; in bpf_object__variable_offset()
1417 if (obj->efile.data_shndx >= 0) { in bpf_object__init_global_data_maps()
1419 obj->efile.data_shndx, in bpf_object__init_global_data_maps()
1420 obj->efile.data->d_buf, in bpf_object__init_global_data_maps()
1421 obj->efile.data->d_size); in bpf_object__init_global_data_maps()
1425 if (obj->efile.rodata_shndx >= 0) { in bpf_object__init_global_data_maps()
1427 obj->efile.rodata_shndx, in bpf_object__init_global_data_maps()
1428 obj->efile.rodata->d_buf, in bpf_object__init_global_data_maps()
1429 obj->efile.rodata->d_size); in bpf_object__init_global_data_maps()
1435 if (obj->efile.bss_shndx >= 0) { in bpf_object__init_global_data_maps()
1437 obj->efile.bss_shndx, in bpf_object__init_global_data_maps()
1439 obj->efile.bss->d_size); in bpf_object__init_global_data_maps()
1736 obj->efile.symbols_shndx, in bpf_object__init_kconfig_map()
1748 Elf_Data *symbols = obj->efile.symbols; in bpf_object__init_user_maps()
1753 if (obj->efile.maps_shndx < 0) in bpf_object__init_user_maps()
1760 scn = elf_sec_by_idx(obj, obj->efile.maps_shndx); in bpf_object__init_user_maps()
1781 if (sym.st_shndx != obj->efile.maps_shndx) in bpf_object__init_user_maps()
1805 if (sym.st_shndx != obj->efile.maps_shndx) in bpf_object__init_user_maps()
2156 map->inner_map->sec_idx = obj->efile.btf_maps_shndx; in parse_btf_map_def()
2291 if (obj->efile.btf_maps_shndx < 0) in bpf_object__init_user_btf_maps()
2294 scn = elf_sec_by_idx(obj, obj->efile.btf_maps_shndx); in bpf_object__init_user_btf_maps()
2310 obj->efile.btf_maps_sec_btf_id = i; in bpf_object__init_user_btf_maps()
2323 obj->efile.btf_maps_shndx, in bpf_object__init_user_btf_maps()
2435 return obj->efile.btf_maps_shndx >= 0 || in libbpf_needs_btf()
2436 obj->efile.st_ops_shndx >= 0 || in libbpf_needs_btf()
2442 return obj->efile.st_ops_shndx >= 0; in kernel_needs_btf()
2620 name = elf_strptr(obj->efile.elf, obj->efile.strtabidx, off); in elf_sym_str()
2634 name = elf_strptr(obj->efile.elf, obj->efile.shstrndx, off); in elf_sec_str()
2648 scn = elf_getscn(obj->efile.elf, idx); in elf_sec_by_idx()
2660 Elf *elf = obj->efile.elf; in elf_sec_by_name()
2732 Elf_Data *symbols = obj->efile.symbols; in elf_sym_by_sec_off()
2803 Elf *elf = obj->efile.elf; in bpf_object__elf_collect()
2821 if (obj->efile.symbols) { in bpf_object__elf_collect()
2830 obj->efile.symbols = data; in bpf_object__elf_collect()
2831 obj->efile.symbols_shndx = elf_ndxscn(scn); in bpf_object__elf_collect()
2832 obj->efile.strtabidx = sh.sh_link; in bpf_object__elf_collect()
2868 obj->efile.maps_shndx = idx; in bpf_object__elf_collect()
2870 obj->efile.btf_maps_shndx = idx; in bpf_object__elf_collect()
2880 obj->efile.text_shndx = idx; in bpf_object__elf_collect()
2885 obj->efile.data = data; in bpf_object__elf_collect()
2886 obj->efile.data_shndx = idx; in bpf_object__elf_collect()
2888 obj->efile.rodata = data; in bpf_object__elf_collect()
2889 obj->efile.rodata_shndx = idx; in bpf_object__elf_collect()
2891 obj->efile.st_ops_data = data; in bpf_object__elf_collect()
2892 obj->efile.st_ops_shndx = idx; in bpf_object__elf_collect()
2898 int nr_sects = obj->efile.nr_reloc_sects; in bpf_object__elf_collect()
2899 void *sects = obj->efile.reloc_sects; in bpf_object__elf_collect()
2913 sizeof(*obj->efile.reloc_sects)); in bpf_object__elf_collect()
2917 obj->efile.reloc_sects = sects; in bpf_object__elf_collect()
2918 obj->efile.nr_reloc_sects++; in bpf_object__elf_collect()
2920 obj->efile.reloc_sects[nr_sects].shdr = sh; in bpf_object__elf_collect()
2921 obj->efile.reloc_sects[nr_sects].data = data; in bpf_object__elf_collect()
2923 obj->efile.bss = data; in bpf_object__elf_collect()
2924 obj->efile.bss_shndx = idx; in bpf_object__elf_collect()
2931 if (!obj->efile.strtabidx || obj->efile.strtabidx > idx) { in bpf_object__elf_collect()
3095 if (!obj->efile.symbols) in bpf_object__collect_externs()
3098 scn = elf_sec_by_idx(obj, obj->efile.symbols_shndx); in bpf_object__collect_externs()
3108 if (!gelf_getsym(obj->efile.symbols, i, &sym)) in bpf_object__collect_externs()
3286 return prog->sec_idx == obj->efile.text_shndx && obj->nr_programs > 1; in prog_is_subprog()
3307 return shndx == obj->efile.data_shndx || in bpf_object__shndx_is_data()
3308 shndx == obj->efile.bss_shndx || in bpf_object__shndx_is_data()
3309 shndx == obj->efile.rodata_shndx; in bpf_object__shndx_is_data()
3315 return shndx == obj->efile.maps_shndx || in bpf_object__shndx_is_maps()
3316 shndx == obj->efile.btf_maps_shndx; in bpf_object__shndx_is_maps()
3322 if (shndx == obj->efile.data_shndx) in bpf_object__section_to_libbpf_map_type()
3324 else if (shndx == obj->efile.bss_shndx) in bpf_object__section_to_libbpf_map_type()
3326 else if (shndx == obj->efile.rodata_shndx) in bpf_object__section_to_libbpf_map_type()
3328 else if (shndx == obj->efile.symbols_shndx) in bpf_object__section_to_libbpf_map_type()
3356 if (!shdr_idx || shdr_idx != obj->efile.text_shndx) { in bpf_program__record_reloc()
3503 Elf_Data *symbols = obj->efile.symbols; in bpf_object__collect_prog_relos()
3590 if (map->sec_idx == obj->efile.btf_maps_shndx || in bpf_map_find_btf_info()
6187 subprog = find_prog_by_sec_insn(obj, obj->efile.text_shndx, sub_insn_idx); in bpf_object__reloc_code()
6433 if (!obj->efile.btf_maps_sec_btf_id || !obj->btf) in bpf_object__collect_map_relos()
6435 sec = btf__type_by_id(obj->btf, obj->efile.btf_maps_sec_btf_id); in bpf_object__collect_map_relos()
6439 symbols = obj->efile.symbols; in bpf_object__collect_map_relos()
6452 if (sym.st_shndx != obj->efile.btf_maps_shndx) { in bpf_object__collect_map_relos()
6464 if (map->sec_idx != obj->efile.btf_maps_shndx) in bpf_object__collect_map_relos()
6549 for (i = 0; i < obj->efile.nr_reloc_sects; i++) { in bpf_object__collect_relos()
6550 GElf_Shdr *shdr = &obj->efile.reloc_sects[i].shdr; in bpf_object__collect_relos()
6551 Elf_Data *data = obj->efile.reloc_sects[i].data; in bpf_object__collect_relos()
6559 if (idx == obj->efile.st_ops_shndx) in bpf_object__collect_relos()
6561 else if (idx == obj->efile.btf_maps_shndx) in bpf_object__collect_relos()
8490 symbols = obj->efile.symbols; in bpf_object__collect_st_ops_relos()