Lines Matching defs:efile

681 	/* Information when doing ELF related work. Only valid if efile.elf is not NULL */
682 struct elf_state efile;
854 Elf_Data *symbols = obj->efile.symbols;
890 if (sec_idx != obj->efile.text_shndx && ELF64_ST_BIND(sym->st_info) == STB_LOCAL) {
1285 err = init_struct_ops_maps(obj, STRUCT_OPS_SEC, obj->efile.st_ops_shndx,
1286 obj->efile.st_ops_data, 0);
1288 obj->efile.st_ops_link_shndx,
1289 obj->efile.st_ops_link_data,
1319 obj->efile.fd = -1;
1326 obj->efile.obj_buf = obj_buf;
1327 obj->efile.obj_buf_sz = obj_buf_sz;
1328 obj->efile.btf_maps_shndx = -1;
1329 obj->efile.st_ops_shndx = -1;
1330 obj->efile.st_ops_link_shndx = -1;
1341 if (!obj->efile.elf)
1344 elf_end(obj->efile.elf);
1346 if (obj->efile.shstring) {
1347 elfio_string_section_accessor_delete(obj->efile.shstring);
1349 if (obj->efile.strstring) {
1350 elfio_string_section_accessor_delete(obj->efile.strstring);
1352 elfio_delete(obj->efile.elf);
1354 obj->efile.elf = NULL;
1355 obj->efile.symbols = NULL;
1356 obj->efile.st_ops_data = NULL;
1357 obj->efile.st_ops_link_data = NULL;
1359 zfree(&obj->efile.secs);
1360 obj->efile.sec_cnt = 0;
1361 zclose(obj->efile.fd);
1362 obj->efile.obj_buf = NULL;
1363 obj->efile.obj_buf_sz = 0;
1376 if (obj->efile.elf) {
1381 if (obj->efile.obj_buf_sz > 0) {
1384 elf = elf_memory((char *)obj->efile.obj_buf, obj->efile.obj_buf_sz);
1389 ftruncate(fdm, obj->efile.obj_buf_sz);
1390 write(fdm, (char *)obj->efile.obj_buf, obj->efile.obj_buf_sz);
1395 obj->efile.fd = open(obj->path, O_RDONLY | O_CLOEXEC);
1396 if (obj->efile.fd < 0) {
1405 elf = elf_begin(obj->efile.fd, ELF_C_READ_MMAP, NULL);
1415 obj->efile.elf = elf;
1432 obj->efile.ehdr = ehdr = elf64_getehdr(elf);
1434 obj->efile.ehdr = ehdr = (Elf64_Ehdr*)obj->efile.obj_buf;
1436 if (!obj->efile.ehdr) {
1443 if (elf_getshdrstrndx(elf, &obj->efile.shstrndx)) {
1451 if (!elf_rawdata(elf_getscn(elf, obj->efile.shstrndx), NULL)) {
1458 obj->efile.shstrndx = elfio_get_section_name_str_index(elf);
1476 if (obj->efile.ehdr->e_ident[EI_DATA] == ELFDATA2LSB)
1479 if (obj->efile.ehdr->e_ident[EI_DATA] == ELFDATA2MSB)
1553 Elf_Data *symbols = obj->efile.symbols;
1790 for (sec_idx = 1; sec_idx < obj->efile.sec_cnt; sec_idx++) {
1791 sec_desc = &obj->efile.secs[sec_idx];
2151 ".kconfig", obj->efile.symbols_shndx,
2724 if (obj->efile.btf_maps_shndx < 0)
2727 scn = elf_sec_by_idx(obj, obj->efile.btf_maps_shndx);
2732 data = elf_sec_data_by_idx(obj, obj->efile.btf_maps_shndx, &realdata);
2748 obj->efile.btf_maps_sec_btf_id = i;
2761 obj->efile.btf_maps_shndx,
2920 return obj->efile.btf_maps_shndx >= 0 ||
2921 obj->efile.st_ops_shndx >= 0 ||
2922 obj->efile.st_ops_link_shndx >= 0 ||
2928 return obj->efile.st_ops_shndx >= 0 || obj->efile.st_ops_link_shndx >= 0;
3004 pelfio_t elf = obj->efile.elf;
3407 name = elf_strptr(obj->efile.elf, obj->efile.strtabidx, off);
3409 name = elfio_string_get_string(obj->efile.strstring, off);
3424 name = elf_strptr(obj->efile.elf, obj->efile.shstrndx, off);
3426 name = elfio_string_get_string(obj->efile.shstring, off);
3443 scn = elf_getscn(obj->efile.elf, idx);
3455 Elf *elf = obj->efile.elf;
3512 psection_t psection = elfio_get_section_by_index(obj->efile.elf, idx);
3567 pelfio_t elf = obj->efile.elf;
3577 pelfio_t elf = obj->efile.elf;
3588 if (idx >= obj->efile.symbols->d_size / sizeof(Elf64_Sym))
3591 return (Elf64_Sym *)obj->efile.symbols->d_buf + idx;
3658 Elf *elf = obj->efile.elf;
3660 pelfio_t elf = obj->efile.elf;
3682 if (elf_getshdrnum(obj->efile.elf, &obj->efile.sec_cnt)) {
3688 obj->efile.sec_cnt = elfio_get_sections_num(elf);
3690 obj->efile.secs = calloc(obj->efile.sec_cnt, sizeof(*obj->efile.secs));
3691 if (!obj->efile.secs)
3711 if (obj->efile.symbols) {
3727 obj->efile.symbols = data;
3729 obj->efile.realsymbols.d_buf = data->d_buf;
3730 obj->efile.realsymbols.d_size = data->d_size;
3731 obj->efile.symbols = &(obj->efile.realsymbols);
3735 obj->efile.symbols_shndx = idx;
3737 obj->efile.symbols_shndx = i;
3739 obj->efile.strtabidx = sh->sh_link;
3747 psection_t psection = elfio_get_section_by_index(elf, obj->efile.strtabidx);
3752 psection = elfio_get_section_by_index(elf, obj->efile.shstrndx);
3759 obj->efile.strstring = strstring;
3760 obj->efile.shstring = shstring;
3763 if (!obj->efile.symbols) {
3783 sec_desc = &obj->efile.secs[idx];
3826 obj->efile.btf_maps_shndx = idx;
3840 obj->efile.text_shndx = idx;
3871 obj->efile.st_ops_data = data;
3873 obj->efile.realst_ops_data.d_buf = data->d_buf;
3874 obj->efile.realst_ops_data.d_size = data->d_size;
3875 obj->efile.st_ops_data = &(obj->efile.realst_ops_data);
3877 obj->efile.st_ops_shndx = idx;
3886 targ_sec_idx >= obj->efile.sec_cnt)
3927 if (!obj->efile.strtabidx || obj->efile.strtabidx > idx) {
4161 if (!obj->efile.symbols)
4165 scn = elf_sec_by_idx(obj, obj->efile.symbols_shndx);
4169 sh = elf_sec_hdr_by_idx(obj, obj->efile.symbols_shndx, sh);
4377 return prog->sec_idx == obj->efile.text_shndx && obj->nr_programs > 1;
4398 switch (obj->efile.secs[shndx].sec_type) {
4411 return shndx == obj->efile.btf_maps_shndx;
4417 if (shndx == obj->efile.symbols_shndx)
4420 switch (obj->efile.secs[shndx].sec_type) {
4484 if (!shdr_idx || shdr_idx != obj->efile.text_shndx) {
4512 if (sym_is_subprog(sym, obj->efile.text_shndx)) {
4643 if (sec_idx >= obj->efile.sec_cnt)
4683 if (sym->st_shndx >= obj->efile.sec_cnt) {
4751 if (map->sec_idx == obj->efile.btf_maps_shndx || bpf_map__is_struct_ops(map))
6744 subprog = find_prog_by_sec_insn(obj, obj->efile.text_shndx, sub_insn_idx);
7054 if (!obj->efile.btf_maps_sec_btf_id || !obj->btf)
7056 sec = btf__type_by_id(obj->btf, obj->efile.btf_maps_sec_btf_id);
7082 if (map->sec_idx != obj->efile.btf_maps_shndx)
7100 if (sym->st_shndx != obj->efile.btf_maps_shndx) {
7178 for (i = 0; i < obj->efile.sec_cnt; i++) {
7179 struct elf_sec_desc *sec_desc = &obj->efile.secs[i];
7201 if (idx == obj->efile.st_ops_shndx || idx == obj->efile.st_ops_link_shndx)
7203 else if (idx == obj->efile.btf_maps_shndx)