Lines Matching refs:btf_ext
793 struct btf *btf__parse_elf(const char *path, struct btf_ext **btf_ext) in btf__parse_elf() argument
854 } else if (btf_ext && strcmp(name, BTF_EXT_ELF_SEC) == 0) { in btf__parse_elf()
887 if (btf_ext && btf_ext_data) { in btf__parse_elf()
888 *btf_ext = btf_ext__new(btf_ext_data->d_buf, in btf__parse_elf()
890 if (IS_ERR(*btf_ext)) in btf__parse_elf()
892 } else if (btf_ext) { in btf__parse_elf()
893 *btf_ext = NULL; in btf__parse_elf()
908 if (btf_ext && IS_ERR(*btf_ext)) { in btf__parse_elf()
910 err = PTR_ERR(*btf_ext); in btf__parse_elf()
979 struct btf *btf__parse(const char *path, struct btf_ext **btf_ext) in btf__parse() argument
983 if (btf_ext) in btf__parse()
984 *btf_ext = NULL; in btf__parse()
990 return btf__parse_elf(path, btf_ext); in btf__parse()
2336 static int btf_ext_setup_info(struct btf_ext *btf_ext, in btf_ext_setup_info() argument
2354 info = btf_ext->data + btf_ext->hdr->hdr_len + ext_sec->off; in btf_ext_setup_info()
2357 if (btf_ext->data + btf_ext->data_size < info + ext_sec->len) { in btf_ext_setup_info()
2425 static int btf_ext_setup_func_info(struct btf_ext *btf_ext) in btf_ext_setup_func_info() argument
2428 .off = btf_ext->hdr->func_info_off, in btf_ext_setup_func_info()
2429 .len = btf_ext->hdr->func_info_len, in btf_ext_setup_func_info()
2431 .ext_info = &btf_ext->func_info, in btf_ext_setup_func_info()
2435 return btf_ext_setup_info(btf_ext, ¶m); in btf_ext_setup_func_info()
2438 static int btf_ext_setup_line_info(struct btf_ext *btf_ext) in btf_ext_setup_line_info() argument
2441 .off = btf_ext->hdr->line_info_off, in btf_ext_setup_line_info()
2442 .len = btf_ext->hdr->line_info_len, in btf_ext_setup_line_info()
2444 .ext_info = &btf_ext->line_info, in btf_ext_setup_line_info()
2448 return btf_ext_setup_info(btf_ext, ¶m); in btf_ext_setup_line_info()
2451 static int btf_ext_setup_core_relos(struct btf_ext *btf_ext) in btf_ext_setup_core_relos() argument
2454 .off = btf_ext->hdr->core_relo_off, in btf_ext_setup_core_relos()
2455 .len = btf_ext->hdr->core_relo_len, in btf_ext_setup_core_relos()
2457 .ext_info = &btf_ext->core_relo_info, in btf_ext_setup_core_relos()
2461 return btf_ext_setup_info(btf_ext, ¶m); in btf_ext_setup_core_relos()
2500 void btf_ext__free(struct btf_ext *btf_ext) in btf_ext__free() argument
2502 if (IS_ERR_OR_NULL(btf_ext)) in btf_ext__free()
2504 free(btf_ext->data); in btf_ext__free()
2505 free(btf_ext); in btf_ext__free()
2508 struct btf_ext *btf_ext__new(__u8 *data, __u32 size) in btf_ext__new()
2510 struct btf_ext *btf_ext; in btf_ext__new() local
2517 btf_ext = calloc(1, sizeof(struct btf_ext)); in btf_ext__new()
2518 if (!btf_ext) in btf_ext__new()
2521 btf_ext->data_size = size; in btf_ext__new()
2522 btf_ext->data = malloc(size); in btf_ext__new()
2523 if (!btf_ext->data) { in btf_ext__new()
2527 memcpy(btf_ext->data, data, size); in btf_ext__new()
2529 if (btf_ext->hdr->hdr_len < in btf_ext__new()
2532 err = btf_ext_setup_func_info(btf_ext); in btf_ext__new()
2536 err = btf_ext_setup_line_info(btf_ext); in btf_ext__new()
2540 if (btf_ext->hdr->hdr_len < offsetofend(struct btf_ext_header, core_relo_len)) in btf_ext__new()
2542 err = btf_ext_setup_core_relos(btf_ext); in btf_ext__new()
2548 btf_ext__free(btf_ext); in btf_ext__new()
2552 return btf_ext; in btf_ext__new()
2555 const void *btf_ext__get_raw_data(const struct btf_ext *btf_ext, __u32 *size) in btf_ext__get_raw_data() argument
2557 *size = btf_ext->data_size; in btf_ext__get_raw_data()
2558 return btf_ext->data; in btf_ext__get_raw_data()
2610 const struct btf_ext *btf_ext, in btf_ext__reloc_func_info() argument
2614 return btf_ext_reloc_info(btf, &btf_ext->func_info, sec_name, in btf_ext__reloc_func_info()
2619 const struct btf_ext *btf_ext, in btf_ext__reloc_line_info() argument
2623 return btf_ext_reloc_info(btf, &btf_ext->line_info, sec_name, in btf_ext__reloc_line_info()
2627 __u32 btf_ext__func_info_rec_size(const struct btf_ext *btf_ext) in btf_ext__func_info_rec_size() argument
2629 return btf_ext->func_info.rec_size; in btf_ext__func_info_rec_size()
2632 __u32 btf_ext__line_info_rec_size(const struct btf_ext *btf_ext) in btf_ext__line_info_rec_size() argument
2634 return btf_ext->line_info.rec_size; in btf_ext__line_info_rec_size()
2639 static struct btf_dedup *btf_dedup_new(struct btf *btf, struct btf_ext *btf_ext,
2786 int btf__dedup(struct btf *btf, struct btf_ext *btf_ext, in btf__dedup() argument
2789 struct btf_dedup *d = btf_dedup_new(btf, btf_ext, opts); in btf__dedup()
2846 struct btf_ext *btf_ext; member
2951 static struct btf_dedup *btf_dedup_new(struct btf *btf, struct btf_ext *btf_ext, in btf_dedup_new() argument
2967 d->btf_ext = btf_ext; in btf_dedup_new()
3071 if (!d->btf_ext) in btf_for_each_str_off()
3074 line_data_cur = d->btf_ext->line_info.info; in btf_for_each_str_off()
3075 line_data_end = d->btf_ext->line_info.info + d->btf_ext->line_info.len; in btf_for_each_str_off()
3076 rec_size = d->btf_ext->line_info.rec_size; in btf_for_each_str_off()