Lines Matching refs:btf_ext
803 struct btf *btf__parse_elf(const char *path, struct btf_ext **btf_ext)
864 } else if (btf_ext && strcmp(name, BTF_EXT_ELF_SEC) == 0) {
897 if (btf_ext && btf_ext_data) {
898 *btf_ext = btf_ext__new(btf_ext_data->d_buf,
900 if (IS_ERR(*btf_ext))
902 } else if (btf_ext) {
903 *btf_ext = NULL;
913 * btf is always parsed before btf_ext, so no need to clean up
914 * btf_ext, if btf loading failed
918 if (btf_ext && IS_ERR(*btf_ext)) {
920 err = PTR_ERR(*btf_ext);
989 struct btf *btf__parse(const char *path, struct btf_ext **btf_ext)
993 if (btf_ext)
994 *btf_ext = NULL;
1000 return btf__parse_elf(path, btf_ext);
2346 static int btf_ext_setup_info(struct btf_ext *btf_ext,
2364 info = btf_ext->data + btf_ext->hdr->hdr_len + ext_sec->off;
2367 if (btf_ext->data + btf_ext->data_size < info + ext_sec->len) {
2435 static int btf_ext_setup_func_info(struct btf_ext *btf_ext)
2438 .off = btf_ext->hdr->func_info_off,
2439 .len = btf_ext->hdr->func_info_len,
2441 .ext_info = &btf_ext->func_info,
2445 return btf_ext_setup_info(btf_ext, ¶m);
2448 static int btf_ext_setup_line_info(struct btf_ext *btf_ext)
2451 .off = btf_ext->hdr->line_info_off,
2452 .len = btf_ext->hdr->line_info_len,
2454 .ext_info = &btf_ext->line_info,
2458 return btf_ext_setup_info(btf_ext, ¶m);
2461 static int btf_ext_setup_core_relos(struct btf_ext *btf_ext)
2464 .off = btf_ext->hdr->core_relo_off,
2465 .len = btf_ext->hdr->core_relo_len,
2467 .ext_info = &btf_ext->core_relo_info,
2471 return btf_ext_setup_info(btf_ext, ¶m);
2510 void btf_ext__free(struct btf_ext *btf_ext)
2512 if (IS_ERR_OR_NULL(btf_ext))
2514 free(btf_ext->data);
2515 free(btf_ext);
2518 struct btf_ext *btf_ext__new(__u8 *data, __u32 size)
2520 struct btf_ext *btf_ext;
2527 btf_ext = calloc(1, sizeof(struct btf_ext));
2528 if (!btf_ext)
2531 btf_ext->data_size = size;
2532 btf_ext->data = malloc(size);
2533 if (!btf_ext->data) {
2537 memcpy(btf_ext->data, data, size);
2539 if (btf_ext->hdr->hdr_len <
2542 err = btf_ext_setup_func_info(btf_ext);
2546 err = btf_ext_setup_line_info(btf_ext);
2550 if (btf_ext->hdr->hdr_len < offsetofend(struct btf_ext_header, core_relo_len))
2552 err = btf_ext_setup_core_relos(btf_ext);
2558 btf_ext__free(btf_ext);
2562 return btf_ext;
2565 const void *btf_ext__get_raw_data(const struct btf_ext *btf_ext, __u32 *size)
2567 *size = btf_ext->data_size;
2568 return btf_ext->data;
2620 const struct btf_ext *btf_ext,
2624 return btf_ext_reloc_info(btf, &btf_ext->func_info, sec_name,
2629 const struct btf_ext *btf_ext,
2633 return btf_ext_reloc_info(btf, &btf_ext->line_info, sec_name,
2637 __u32 btf_ext__func_info_rec_size(const struct btf_ext *btf_ext)
2639 return btf_ext->func_info.rec_size;
2642 __u32 btf_ext__line_info_rec_size(const struct btf_ext *btf_ext)
2644 return btf_ext->line_info.rec_size;
2649 static struct btf_dedup *btf_dedup_new(struct btf *btf, struct btf_ext *btf_ext,
2665 * information. If optional `struct btf_ext` representing '.BTF.ext' ELF section
2796 int btf__dedup(struct btf *btf, struct btf_ext *btf_ext,
2799 struct btf_dedup *d = btf_dedup_new(btf, btf_ext, opts);
2856 struct btf_ext *btf_ext;
2961 static struct btf_dedup *btf_dedup_new(struct btf *btf, struct btf_ext *btf_ext,
2977 d->btf_ext = btf_ext;
3081 if (!d->btf_ext)
3084 line_data_cur = d->btf_ext->line_info.info;
3085 line_data_end = d->btf_ext->line_info.info + d->btf_ext->line_info.len;
3086 rec_size = d->btf_ext->line_info.rec_size;