[PATCH dwarves] btf: rename btf_tag to btf_decl_tag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/20211012164838.3345699-1-yhs@xxxxxx/
  [2] https://reviews.llvm.org/D111199

Signed-off-by: Yonghong Song <yhs@xxxxxx>
---
 btf_encoder.c  | 16 ++++++++--------
 dwarf_loader.c |  6 +++---
 dwarves.h      |  2 +-
 lib/bpf        |  2 +-
 pahole.c       | 12 ++++++------
 5 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/btf_encoder.c b/btf_encoder.c
index c341f95..968af92 100644
--- a/btf_encoder.c
+++ b/btf_encoder.c
@@ -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 char
 	return 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);
diff --git a/dwarf_loader.c b/dwarf_loader.c
index 48e1bf0..fc7490e 100644
--- a/dwarf_loader.c
+++ b/dwarf_loader.c
@@ -866,12 +866,12 @@ static int add_llvm_annotation(Dwarf_Die *die, int component_idx, struct conf_lo
 	struct 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));
diff --git a/dwarves.h b/dwarves.h
index 30d33fa..8e293bd 100644
--- a/dwarves.h
+++ b/dwarves.h
@@ -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;
diff --git a/lib/bpf b/lib/bpf
index 980777c..f05791d 160000
--- a/lib/bpf
+++ b/lib/bpf
@@ -1 +1 @@
-Subproject commit 980777cc16db75d5628a537c892aefc2640bb242
+Subproject commit f05791d8cfcbbf9092b4099b9d011bb72e241ef8
diff --git a/pahole.c b/pahole.c
index 80271b5..23e1256 100644
--- a/pahole.c
+++ b/pahole.c
@@ -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 331
 
 static 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;
 	}
-- 
2.30.2





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux