btf: rename btf_tag to btf_decl_tag
Subsystems (2)
PATCH 1/1 btf: rename btf_tag to btf_decl_tag
Kernel commit ([1]) renamed btf_tag to btf_decl_tag for uapi btf.h and libbpf api's. The reason is a new clang attribute, btf_type_tag, is introduced ([2]). Renaming btf_tag to btf_decl_tag makes it easier to distinghish from btf_type_tag.
I also pulled in latest libbpf repo since it contains renamed libbpf api function btf__add_decl_tag().
[1] https://lore.kernel.org/bpf/[email protected]/
[2] https://reviews.llvm.org/D111199
--- btf_encoder.c | 16 ++++++++-------- dwarf_loader.c | 6 +++--- dwarves.h | 2 +- lib/bpf | 2 +- pahole.c | 12 ++++++------ 5 files changed, 19 insertions(+), 19 deletions(-)
btf_encoder.c +8 -8
@@ -141,7 +141,7 @@ static const char * const btf_kind_str[NR_BTF_KINDS] = { [BTF_KIND_VAR] = "VAR", [BTF_KIND_DATASEC] = "DATASEC", [BTF_KIND_FLOAT] = "FLOAT", - [BTF_KIND_TAG] = "TAG", + [BTF_KIND_DECL_TAG] = "DECL_TAG", };static const char *btf__printable_name (const struct btf *btf,uint32_t offset)
@@ -645,20 +645,20 @@ static int32_t btf_encoder__add_datasec(struct btf_encoder *encoder, const charreturn id; } -static int32_t btf_encoder__add_tag (struct btf_encoder *encoder,const char *value,uint32_t type, -int component_idx) +static int32_t btf_encoder__add_decl_tag (struct btf_encoder *encoder,const char *value,uint32_t type, +int component_idx) {struct btf *btf = encoder->btf;const struct btf_type *t;int32_t id; - id =btf__add_tag (btf, value, type, component_idx); + id =btf__add_decl_tag (btf, value, type, component_idx);if (id >0 ) { t =btf__type_by_id (btf, id);btf_encoder__log_type (encoder, t, false, true,"type_id=%u component_idx=%d" , t->type, component_idx); }else { -btf__log_err (btf,BTF_KIND_TAG , value, true,"component_idx=%d Error emitting BTF type" , +btf__log_err (btf,BTF_KIND_DECL_TAG , value, true,"component_idx=%d Error emitting BTF type" , component_idx); }
@@ -1267,7 +1267,7 @@ static int btf_encoder__encode_cu_variables(struct btf_encoder *encoder, struct }list_for_each_entry (annot, &var->annots, node) { -int tag_type_id =btf_encoder__add_tag (encoder, annot->value, id, annot->component_idx); +int tag_type_id =btf_encoder__add_decl_tag (encoder, annot->value, id, annot->component_idx);if (tag_type_id <0 ) {fprintf (stderr,"error: failed to encode tag '%s' to variable '%s' with component_idx %d\n" , annot->value, name, annot->component_idx);
@@ -1438,7 +1438,7 @@ int btf_encoder__encode_cu(struct btf_encoder *encoder, struct cu *cu) btf_type_id = type_id_off + core_id; ns =tag__namespace (pos);list_for_each_entry (annot, &ns->annots, node) { - tag_type_id =btf_encoder__add_tag (encoder, annot->value, btf_type_id, annot->component_idx); + tag_type_id =btf_encoder__add_decl_tag (encoder, annot->value, btf_type_id, annot->component_idx);if (tag_type_id <0 ) { fprintf(stderr, "error: failed to encode tag '%s' to %s '%s' with component_idx %d\n", annot->value, pos->tag == DW_TAG_structure_type ? "struct" : "union",
@@ -1490,7 +1490,7 @@ int btf_encoder__encode_cu(struct btf_encoder *encoder, struct cu *cu) }list_for_each_entry (annot, &fn->annots, node) { - tag_type_id =btf_encoder__add_tag (encoder, annot->value, btf_fn_id, annot->component_idx); + tag_type_id =btf_encoder__add_decl_tag (encoder, annot->value, btf_fn_id, annot->component_idx);if (tag_type_id <0 ) {fprintf (stderr,"error: failed to encode tag '%s' to func %s with component_idx %d\n" , annot->value, name, annot->component_idx);
dwarf_loader.c +3 -3
@@ -866,12 +866,12 @@ static int add_llvm_annotation(Dwarf_Die *die, int component_idx, struct conf_lostruct llvm_annotation *annot;const char *name; -if (conf->skip_encoding_btf_tag) +if (conf->skip_encoding_btf_decl_tag)return 0 ; -/* Only handle btf_tag annotation for now. */ +/* Only handle btf_decl_tag annotation for now. */ name =attr_string (die, DW_AT_name, conf); -if (strcmp (name,"btf_tag" ) !=0 ) +if (strcmp (name,"btf_decl_tag" ) !=0 )return 0 ; annot =zalloc (sizeof (*annot));
dwarves.h +1 -1
@@ -58,7 +58,7 @@ struct conf_load {bool ignore_inline_expansions;bool ignore_labels;bool ptr_table_stats; -bool skip_encoding_btf_tag; +bool skip_encoding_btf_decl_tag;uint8_t hashtable_bits;uint8_t max_hashtable_bits;uint16_t kabi_prefix_len;
lib/bpf +1 -1
@@ -1 +1 @@ -Subproject commit 980777cc16db75d5628a537c892aefc2640bb242 +Subproject commit f05791d8cfcbbf9092b4099b9d011bb72e241ef8
pahole.c +6 -6
@@ -1124,7 +1124,7 @@ ARGP_PROGRAM_VERSION_HOOK_DEF = dwarves_print_version;#define ARGP_sort_output 328#define ARGP_hashbits 329#define ARGP_devel_stats 330 -#define ARGP_skip_encoding_btf_tag 331 +#define ARGP_skip_encoding_btf_decl_tag 331static const struct argp_option pahole__options[] = { {
@@ -1496,9 +1496,9 @@ static const struct argp_option pahole__options[] = { .doc = "Print internal data structures stats", }, { - .name = "skip_encoding_btf_tag", - .key = ARGP_skip_encoding_btf_tag, - .doc ="Do not encode TAGs in BTF." + .name = "skip_encoding_btf_decl_tag", + .key = ARGP_skip_encoding_btf_decl_tag, + .doc ="Do not encode DECL_TAGs in BTF." }, { .name = NULL,
@@ -1648,8 +1648,8 @@ static error_t pahole__options_parser(int key, char *arg, conf_load.hashtable_bits =atoi (arg);break ;case ARGP_devel_stats: conf_load.ptr_table_stats = true;break ; -case ARGP_skip_encoding_btf_tag: - conf_load.skip_encoding_btf_tag = true;break ; +case ARGP_skip_encoding_btf_decl_tag: + conf_load.skip_encoding_btf_decl_tag = true;break ;default :return ARGP_ERR_UNKNOWN ; }
Signature · 1 line
2.30.2
Quoted 7 lines · Yonghong Song
Kernel commit ([1]) renamed
btf_tagtobtf_decl_tagfor uapibtf.hand libbpf api's. The reason is a new clang attribute,btf_type_tag, is introduced ([2]). Renamingbtf_tagtobtf_decl_tagmakes it easier to distinghish frombtf_type_tag.
Quoted 8 lines
I also pulled in latest libbpf repo since it contains renamed libbpf api function
btf__add_decl_tag().[1] https://lore.kernel.org/bpf/[email protected]/
[2] https://reviews.llvm.org/D111199Signed-off-by Yonghong Song <[email protected]>---
LGTM.
Quoted 7 lines
btf_encoder.c | 16 ++++++++-------- dwarf_loader.c | 6 +++--- dwarves.h | 2 +- lib/bpf | 2 +- pahole.c | 12 ++++++------ 5 files changed, 19 insertions(+), 19 deletions(-)
[...]
Arnaldo Carvalho de Melo
AppliedEm Mon, Oct 25, 2021 at 05:20:49PM -0700, Andrii Nakryiko escreveu:
Quoted 14 lines · Yonghong Song
Quoted 13 lines
Kernel commit ([1]) renamed
btf_tagtobtf_decl_tagfor uapibtf.hand libbpf api's. The reason is a new clang attribute,btf_type_tag, is introduced ([2]). Renamingbtf_tagtobtf_decl_tagmakes it easier to distinghish frombtf_type_tag.I also pulled in latest libbpf repo since it contains renamed libbpf api function
btf__add_decl_tag().[1] https://lore.kernel.org/bpf/[email protected]/
[2] https://reviews.llvm.org/D111199
Quoted 6 lines
Quoted 2 lines
Signed-off-by Yonghong Song <[email protected]>---
LGTM.
Acked-by Andrii Nakryiko <[email protected]>
Thanks, applied. Made a few adjustments as there were changes touching the pahole options in my local tree, very minor stuff.
- Arnaldo
Quoted 9 lines
Quoted 7 lines
btf_encoder.c | 16 ++++++++-------- dwarf_loader.c | 6 +++--- dwarves.h | 2 +- lib/bpf | 2 +- pahole.c | 12 ++++++------ 5 files changed, 19 insertions(+), 19 deletions(-)[...]
Signature · 1 line
- Arnaldo