Lines Matching refs:efile

488 	} efile;  member
520 #define obj_elf_valid(o) ((o)->efile.elf)
664 Elf_Data *symbols = obj->efile.symbols; in bpf_object__add_programs()
701 if (sec_idx != obj->efile.text_shndx && GELF_ST_BIND(sym.st_info) == STB_LOCAL) { in bpf_object__add_programs()
1017 if (obj->efile.st_ops_shndx == -1) in bpf_object__init_struct_ops_maps()
1057 map->sec_idx = obj->efile.st_ops_shndx; in bpf_object__init_struct_ops_maps()
1079 if (vsi->offset + type->size > obj->efile.st_ops_data->d_size) { in bpf_object__init_struct_ops_maps()
1086 obj->efile.st_ops_data->d_buf + vsi->offset, in bpf_object__init_struct_ops_maps()
1126 obj->efile.fd = -1; in bpf_object__new()
1133 obj->efile.obj_buf = obj_buf; in bpf_object__new()
1134 obj->efile.obj_buf_sz = obj_buf_sz; in bpf_object__new()
1135 obj->efile.maps_shndx = -1; in bpf_object__new()
1136 obj->efile.btf_maps_shndx = -1; in bpf_object__new()
1137 obj->efile.data_shndx = -1; in bpf_object__new()
1138 obj->efile.rodata_shndx = -1; in bpf_object__new()
1139 obj->efile.bss_shndx = -1; in bpf_object__new()
1140 obj->efile.st_ops_shndx = -1; in bpf_object__new()
1157 if (obj->efile.elf) { in bpf_object__elf_finish()
1158 elf_end(obj->efile.elf); in bpf_object__elf_finish()
1159 obj->efile.elf = NULL; in bpf_object__elf_finish()
1161 obj->efile.symbols = NULL; in bpf_object__elf_finish()
1162 obj->efile.data = NULL; in bpf_object__elf_finish()
1163 obj->efile.rodata = NULL; in bpf_object__elf_finish()
1164 obj->efile.bss = NULL; in bpf_object__elf_finish()
1165 obj->efile.st_ops_data = NULL; in bpf_object__elf_finish()
1167 zfree(&obj->efile.reloc_sects); in bpf_object__elf_finish()
1168 obj->efile.nr_reloc_sects = 0; in bpf_object__elf_finish()
1169 zclose(obj->efile.fd); in bpf_object__elf_finish()
1170 obj->efile.obj_buf = NULL; in bpf_object__elf_finish()
1171 obj->efile.obj_buf_sz = 0; in bpf_object__elf_finish()
1184 if (obj->efile.obj_buf_sz > 0) { in bpf_object__elf_init()
1189 obj->efile.elf = elf_memory((char *)obj->efile.obj_buf, in bpf_object__elf_init()
1190 obj->efile.obj_buf_sz); in bpf_object__elf_init()
1192 obj->efile.fd = open(obj->path, O_RDONLY); in bpf_object__elf_init()
1193 if (obj->efile.fd < 0) { in bpf_object__elf_init()
1202 obj->efile.elf = elf_begin(obj->efile.fd, ELF_C_READ_MMAP, NULL); in bpf_object__elf_init()
1205 if (!obj->efile.elf) { in bpf_object__elf_init()
1211 if (!gelf_getehdr(obj->efile.elf, &obj->efile.ehdr)) { in bpf_object__elf_init()
1216 ep = &obj->efile.ehdr; in bpf_object__elf_init()
1218 if (elf_getshdrstrndx(obj->efile.elf, &obj->efile.shstrndx)) { in bpf_object__elf_init()
1226 if (!elf_rawdata(elf_getscn(obj->efile.elf, obj->efile.shstrndx), NULL)) { in bpf_object__elf_init()
1250 if (obj->efile.ehdr.e_ident[EI_DATA] == ELFDATA2LSB) in bpf_object__check_endianness()
1253 if (obj->efile.ehdr.e_ident[EI_DATA] == ELFDATA2MSB) in bpf_object__check_endianness()
1302 if (obj->efile.data) in bpf_object__section_size()
1303 *size = obj->efile.data->d_size; in bpf_object__section_size()
1305 if (obj->efile.bss) in bpf_object__section_size()
1306 *size = obj->efile.bss->d_size; in bpf_object__section_size()
1308 if (obj->efile.rodata) in bpf_object__section_size()
1309 *size = obj->efile.rodata->d_size; in bpf_object__section_size()
1311 if (obj->efile.st_ops_data) in bpf_object__section_size()
1312 *size = obj->efile.st_ops_data->d_size; in bpf_object__section_size()
1329 Elf_Data *symbols = obj->efile.symbols; in bpf_object__variable_offset()
1482 if (obj->efile.data_shndx >= 0) { in bpf_object__init_global_data_maps()
1484 obj->efile.data_shndx, in bpf_object__init_global_data_maps()
1485 obj->efile.data->d_buf, in bpf_object__init_global_data_maps()
1486 obj->efile.data->d_size); in bpf_object__init_global_data_maps()
1490 if (obj->efile.rodata_shndx >= 0) { in bpf_object__init_global_data_maps()
1492 obj->efile.rodata_shndx, in bpf_object__init_global_data_maps()
1493 obj->efile.rodata->d_buf, in bpf_object__init_global_data_maps()
1494 obj->efile.rodata->d_size); in bpf_object__init_global_data_maps()
1500 if (obj->efile.bss_shndx >= 0) { in bpf_object__init_global_data_maps()
1502 obj->efile.bss_shndx, in bpf_object__init_global_data_maps()
1504 obj->efile.bss->d_size); in bpf_object__init_global_data_maps()
1801 obj->efile.symbols_shndx, in bpf_object__init_kconfig_map()
1813 Elf_Data *symbols = obj->efile.symbols; in bpf_object__init_user_maps()
1818 if (obj->efile.maps_shndx < 0) in bpf_object__init_user_maps()
1824 scn = elf_sec_by_idx(obj, obj->efile.maps_shndx); in bpf_object__init_user_maps()
1845 if (sym.st_shndx != obj->efile.maps_shndx) in bpf_object__init_user_maps()
1869 if (sym.st_shndx != obj->efile.maps_shndx) in bpf_object__init_user_maps()
2412 if (obj->efile.btf_maps_shndx < 0) in bpf_object__init_user_btf_maps()
2415 scn = elf_sec_by_idx(obj, obj->efile.btf_maps_shndx); in bpf_object__init_user_btf_maps()
2431 obj->efile.btf_maps_sec_btf_id = i; in bpf_object__init_user_btf_maps()
2444 obj->efile.btf_maps_shndx, in bpf_object__init_user_btf_maps()
2563 return obj->efile.btf_maps_shndx >= 0 || in libbpf_needs_btf()
2564 obj->efile.st_ops_shndx >= 0 || in libbpf_needs_btf()
2570 return obj->efile.st_ops_shndx >= 0; in kernel_needs_btf()
2800 name = elf_strptr(obj->efile.elf, obj->efile.strtabidx, off); in elf_sym_str()
2814 name = elf_strptr(obj->efile.elf, obj->efile.shstrndx, off); in elf_sec_str()
2828 scn = elf_getscn(obj->efile.elf, idx); in elf_sec_by_idx()
2840 Elf *elf = obj->efile.elf; in elf_sec_by_name()
2963 Elf *elf = obj->efile.elf; in bpf_object__elf_collect()
2981 if (obj->efile.symbols) { in bpf_object__elf_collect()
2990 obj->efile.symbols = data; in bpf_object__elf_collect()
2991 obj->efile.symbols_shndx = elf_ndxscn(scn); in bpf_object__elf_collect()
2992 obj->efile.strtabidx = sh.sh_link; in bpf_object__elf_collect()
3028 obj->efile.maps_shndx = idx; in bpf_object__elf_collect()
3030 obj->efile.btf_maps_shndx = idx; in bpf_object__elf_collect()
3040 obj->efile.text_shndx = idx; in bpf_object__elf_collect()
3045 obj->efile.data = data; in bpf_object__elf_collect()
3046 obj->efile.data_shndx = idx; in bpf_object__elf_collect()
3048 obj->efile.rodata = data; in bpf_object__elf_collect()
3049 obj->efile.rodata_shndx = idx; in bpf_object__elf_collect()
3051 obj->efile.st_ops_data = data; in bpf_object__elf_collect()
3052 obj->efile.st_ops_shndx = idx; in bpf_object__elf_collect()
3058 int nr_sects = obj->efile.nr_reloc_sects; in bpf_object__elf_collect()
3059 void *sects = obj->efile.reloc_sects; in bpf_object__elf_collect()
3073 sizeof(*obj->efile.reloc_sects)); in bpf_object__elf_collect()
3077 obj->efile.reloc_sects = sects; in bpf_object__elf_collect()
3078 obj->efile.nr_reloc_sects++; in bpf_object__elf_collect()
3080 obj->efile.reloc_sects[nr_sects].shdr = sh; in bpf_object__elf_collect()
3081 obj->efile.reloc_sects[nr_sects].data = data; in bpf_object__elf_collect()
3083 obj->efile.bss = data; in bpf_object__elf_collect()
3084 obj->efile.bss_shndx = idx; in bpf_object__elf_collect()
3091 if (!obj->efile.strtabidx || obj->efile.strtabidx > idx) { in bpf_object__elf_collect()
3315 if (!obj->efile.symbols) in bpf_object__collect_externs()
3318 scn = elf_sec_by_idx(obj, obj->efile.symbols_shndx); in bpf_object__collect_externs()
3332 if (!gelf_getsym(obj->efile.symbols, i, &sym)) in bpf_object__collect_externs()
3547 return prog->sec_idx == obj->efile.text_shndx && obj->nr_programs > 1; in prog_is_subprog()
3568 return shndx == obj->efile.data_shndx || in bpf_object__shndx_is_data()
3569 shndx == obj->efile.bss_shndx || in bpf_object__shndx_is_data()
3570 shndx == obj->efile.rodata_shndx; in bpf_object__shndx_is_data()
3576 return shndx == obj->efile.maps_shndx || in bpf_object__shndx_is_maps()
3577 shndx == obj->efile.btf_maps_shndx; in bpf_object__shndx_is_maps()
3583 if (shndx == obj->efile.data_shndx) in bpf_object__section_to_libbpf_map_type()
3585 else if (shndx == obj->efile.bss_shndx) in bpf_object__section_to_libbpf_map_type()
3587 else if (shndx == obj->efile.rodata_shndx) in bpf_object__section_to_libbpf_map_type()
3589 else if (shndx == obj->efile.symbols_shndx) in bpf_object__section_to_libbpf_map_type()
3647 if (!shdr_idx || shdr_idx != obj->efile.text_shndx) { in bpf_program__record_reloc()
3671 if (sym_is_subprog(sym, obj->efile.text_shndx)) { in bpf_program__record_reloc()
3782 Elf_Data *symbols = obj->efile.symbols; in bpf_object__collect_prog_relos()
3875 if (map->sec_idx == obj->efile.btf_maps_shndx || in bpf_map_find_btf_info()
5597 subprog = find_prog_by_sec_insn(obj, obj->efile.text_shndx, sub_insn_idx); in bpf_object__reloc_code()
5872 if (!obj->efile.btf_maps_sec_btf_id || !obj->btf) in bpf_object__collect_map_relos()
5874 sec = btf__type_by_id(obj->btf, obj->efile.btf_maps_sec_btf_id); in bpf_object__collect_map_relos()
5878 symbols = obj->efile.symbols; in bpf_object__collect_map_relos()
5891 if (sym.st_shndx != obj->efile.btf_maps_shndx) { in bpf_object__collect_map_relos()
5903 if (map->sec_idx != obj->efile.btf_maps_shndx) in bpf_object__collect_map_relos()
5988 for (i = 0; i < obj->efile.nr_reloc_sects; i++) { in bpf_object__collect_relos()
5989 GElf_Shdr *shdr = &obj->efile.reloc_sects[i].shdr; in bpf_object__collect_relos()
5990 Elf_Data *data = obj->efile.reloc_sects[i].data; in bpf_object__collect_relos()
5998 if (idx == obj->efile.st_ops_shndx) in bpf_object__collect_relos()
6000 else if (idx == obj->efile.btf_maps_shndx) in bpf_object__collect_relos()
8181 symbols = obj->efile.symbols; in bpf_object__collect_st_ops_relos()