btf_encoder: Adopt btf__encode_func_proto() as btf_encoder__add_func_proto()
As it is just prep work to call libbpf's btf__add_func_proto() for a function prototype using pahole's data structures populated from another format, normally DWARF. So that we can eventually ditch the btf_encoder__verbose and btf_gen_float globals, making them members of 'struct btf_encoder'. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
4eb4c03578
commit
393febe592
|
@ -261,7 +261,7 @@ static int btf_encoder__encode_tag(struct btf_encoder *encoder, struct cu *cu, s
|
|||
case DW_TAG_enumeration_type:
|
||||
return btf__encode_enumeration_type(btf, cu, tag);
|
||||
case DW_TAG_subroutine_type:
|
||||
return btf__encode_func_proto(btf, cu, tag__ftype(tag), type_id_off);
|
||||
return btf_encoder__add_func_proto(encoder, cu, tag__ftype(tag), type_id_off);
|
||||
default:
|
||||
fprintf(stderr, "Unsupported DW_TAG_%s(0x%x)\n",
|
||||
dwarf_tag_name(tag->tag), tag->tag);
|
||||
|
@ -743,7 +743,7 @@ int btf_encoder__encode_cu(struct btf_encoder *encoder, struct cu *cu, bool skip
|
|||
continue;
|
||||
}
|
||||
|
||||
btf_fnproto_id = btf__encode_func_proto(encoder->btf, cu, &fn->proto, type_id_off);
|
||||
btf_fnproto_id = btf_encoder__add_func_proto(encoder, cu, &fn->proto, type_id_off);
|
||||
name = dwarves__active_loader->strings__ptr(cu, fn->name);
|
||||
btf_fn_id = btf_encoder__add_ref_type(encoder, BTF_KIND_FUNC, btf_fnproto_id, name, false);
|
||||
if (btf_fnproto_id < 0 || btf_fn_id < 0) {
|
||||
|
|
3
libbtf.c
3
libbtf.c
|
@ -469,8 +469,9 @@ static int32_t btf__encode_func_proto_param(struct btf *btf, const char *name,
|
|||
|
||||
extern struct debug_fmt_ops *dwarves__active_loader;
|
||||
|
||||
int32_t btf__encode_func_proto(struct btf *btf, struct cu *cu, struct ftype *ftype, uint32_t type_id_off)
|
||||
int32_t btf_encoder__add_func_proto(struct btf_encoder *encoder, struct cu *cu, struct ftype *ftype, uint32_t type_id_off)
|
||||
{
|
||||
struct btf *btf = encoder->btf;
|
||||
const struct btf_type *t;
|
||||
struct parameter *param;
|
||||
uint16_t nr_params, param_idx;
|
||||
|
|
2
libbtf.h
2
libbtf.h
|
@ -29,7 +29,7 @@ int32_t btf_encoder__add_struct(struct btf_encoder *encoder, uint8_t kind, const
|
|||
int32_t btf_encoder__add_array(struct btf_encoder *encoder, uint32_t type, uint32_t index_type, uint32_t nelems);
|
||||
int32_t btf__encode_enum(struct btf *btf, const char *name, uint32_t size);
|
||||
int btf__encode_enum_val(struct btf *btf, const char *name, int32_t value);
|
||||
int32_t btf__encode_func_proto(struct btf *btf, struct cu *cu, struct ftype *ftype, uint32_t type_id_off);
|
||||
int32_t btf_encoder__add_func_proto(struct btf_encoder *encoder, struct cu *cu, struct ftype *ftype, uint32_t type_id_off);
|
||||
int32_t btf__encode_var_type(struct btf *btf, uint32_t type, const char *name, uint32_t linkage);
|
||||
int32_t btf__encode_var_secinfo(struct gobuffer *buf, uint32_t type, uint32_t offset, uint32_t size);
|
||||
int32_t btf__encode_datasec_type(struct btf *btf, const char *section_name, struct gobuffer *var_secinfo_buf);
|
||||
|
|
Loading…
Reference in New Issue