From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: Jiri Olsa <jolsa@kernel.org>,
Clark Williams <williams@redhat.com>,
dwarves@vger.kernel.org, bpf@vger.kernel.org,
Andrii Nakryiko <andrii@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Mark Wieelard <mjw@redhat.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 09/12] dwarf_loader: Add cu parameter to tag__set_spec() and dwarf_tag__set_attr_type()
Date: Fri, 31 Jul 2026 16:30:57 -0300 [thread overview]
Message-ID: <20260731193102.110693-10-acme@kernel.org> (raw)
In-Reply-To: <20260731193102.110693-1-acme@kernel.org>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Thread the cu parameter through the reference-setting helpers, in
preparation for using it to track which offset space (main file vs dwz
alternate file) each reference targets.
The cu parameter is currently unused: dwarf_tag__set_attr_type() silently
ignores the extra macro argument, and tag__set_spec() marks it
__maybe_unused.
No functional change.
Assisted-by: Claude:claude-sonnet-4-5
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
dwarf_loader.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/dwarf_loader.c b/dwarf_loader.c
index ab4036dc32cdda61..39a49e9a5048dee7 100644
--- a/dwarf_loader.c
+++ b/dwarf_loader.c
@@ -572,7 +572,7 @@ static void tag__free(struct tag *tag, struct cu *cu)
cu__free(cu, dtag);
}
-#define dwarf_tag__set_attr_type(dtag, field, die, attr_name) \
+#define dwarf_tag__set_attr_type(dtag, field, die, attr_name, cu) \
dtag->from_types_section.field = attr_type(die, attr_name, &dtag->field)
static void tag__init(struct tag *tag, struct cu *cu, Dwarf_Die *die)
@@ -584,13 +584,13 @@ static void tag__init(struct tag *tag, struct cu *cu, Dwarf_Die *die)
dtag->id = dwarf_dieoffset(die);
if (tag->tag == DW_TAG_imported_module || tag->tag == DW_TAG_imported_declaration)
- dwarf_tag__set_attr_type(dtag, type, die, DW_AT_import);
+ dwarf_tag__set_attr_type(dtag, type, die, DW_AT_import, cu);
else if (tag->tag == DW_TAG_variant_part)
- dwarf_tag__set_attr_type(dtag, type, die, DW_AT_discr);
+ dwarf_tag__set_attr_type(dtag, type, die, DW_AT_discr, cu);
else
- dwarf_tag__set_attr_type(dtag, type, die, DW_AT_type);
+ dwarf_tag__set_attr_type(dtag, type, die, DW_AT_type, cu);
- dwarf_tag__set_attr_type(dtag, abstract_origin, die, DW_AT_abstract_origin);
+ dwarf_tag__set_attr_type(dtag, abstract_origin, die, DW_AT_abstract_origin, cu);
tag->recursivity_level = 0;
tag->attributes = NULL;
@@ -633,10 +633,10 @@ static struct tag *tag__new(Dwarf_Die *die, struct cu *cu)
return tag;
}
-static void tag__set_spec(struct tag *tag, Dwarf_Die *die)
+static void tag__set_spec(struct tag *tag, Dwarf_Die *die, struct cu *cu __maybe_unused)
{
struct dwarf_tag *dtag = tag__dwarf(tag);
- dwarf_tag__set_attr_type(dtag, specification, die, DW_AT_specification);
+ dwarf_tag__set_attr_type(dtag, specification, die, DW_AT_specification, cu);
}
static struct ptr_to_member_type *ptr_to_member_type__new(Dwarf_Die *die,
@@ -647,7 +647,7 @@ static struct ptr_to_member_type *ptr_to_member_type__new(Dwarf_Die *die,
if (ptr != NULL) {
tag__init(&ptr->tag, cu, die);
struct dwarf_tag *dtag = tag__dwarf(&ptr->tag);
- dwarf_tag__set_attr_type(dtag, containing_type, die, DW_AT_containing_type);
+ dwarf_tag__set_attr_type(dtag, containing_type, die, DW_AT_containing_type, cu);
}
return ptr;
@@ -738,7 +738,7 @@ static void type__init(struct type *type, Dwarf_Die *die, struct cu *cu, struct
type->size = attr_numeric(die, DW_AT_byte_size);
type->alignment = attr_alignment(die, conf);
type->declaration = attr_numeric(die, DW_AT_declaration);
- tag__set_spec(&type->namespace.tag, die);
+ tag__set_spec(&type->namespace.tag, die, cu);
type->definition_emitted = 0;
type->fwd_decl_emitted = 0;
type->resized = 0;
@@ -851,7 +851,7 @@ static struct variable *variable__new(Dwarf_Die *die, struct cu *cu, struct conf
if (!var->declaration && cu->has_addr_info)
var->scope = dwarf__location(die, &var->ip.addr, &var->location);
if (has_specification) {
- tag__set_spec(&var->ip.tag, die);
+ tag__set_spec(&var->ip.tag, die, cu);
}
}
@@ -1326,7 +1326,7 @@ static struct variant *variant__new(Dwarf_Die *die, struct cu *cu, struct conf_l
struct dwarf_tag *dtag = tag__dwarf(&var->tag);
var->name = attr_string(&child, DW_AT_name, conf);
- dwarf_tag__set_attr_type(dtag, type, &child, DW_AT_type);
+ dwarf_tag__set_attr_type(dtag, type, &child, DW_AT_type, cu);
break;
}
} while (dwarf_siblingof(&child, &child) == 0);
@@ -1779,7 +1779,7 @@ static struct inline_expansion *inline_expansion__new(Dwarf_Die *die, struct cu
tag__init(&exp->ip.tag, cu, die);
dtag->decl_file = attr_string(die, DW_AT_call_file, conf);
dtag->decl_line = attr_numeric(die, DW_AT_call_line);
- dwarf_tag__set_attr_type(dtag, type, die, DW_AT_abstract_origin);
+ dwarf_tag__set_attr_type(dtag, type, die, DW_AT_abstract_origin, cu);
exp->ip.addr = 0;
exp->high_pc = 0;
@@ -1941,7 +1941,7 @@ static struct function *function__new(Dwarf_Die *die, struct cu *cu, struct conf
func->declaration = dwarf_hasattr(die, DW_AT_declaration);
func->external = dwarf_hasattr(die, DW_AT_external);
func->abstract_origin = dwarf_hasattr(die, DW_AT_abstract_origin);
- tag__set_spec(&func->proto.tag, die);
+ tag__set_spec(&func->proto.tag, die, cu);
func->accessibility = attr_numeric(die, DW_AT_accessibility);
func->virtuality = attr_numeric(die, DW_AT_virtuality);
INIT_LIST_HEAD(&func->vtable_node);
--
2.55.0
next prev parent reply other threads:[~2026-07-31 19:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 19:30 [PATCHES 00/12] pahole: Support more rust tags and references to dwz alternate debug files Arnaldo Carvalho de Melo
2026-07-31 19:30 ` [PATCH 01/12] dwarf_loader: Initial support for DW_TAG_variant_part Arnaldo Carvalho de Melo
2026-07-31 19:30 ` [PATCH 02/12] dwarf_loader: Initial support for DW_TAG_subprogram in DW_TAG_enumeration Arnaldo Carvalho de Melo
2026-07-31 19:30 ` [PATCH 03/12] dwarf_loader: Populate DW_TAG_variant children in DW_TAG_variant_part Arnaldo Carvalho de Melo
2026-07-31 19:30 ` [PATCH 04/12] btf_encoder: Encode variant parts as union members in BTF Arnaldo Carvalho de Melo
2026-07-31 19:30 ` [PATCH 05/12] dwarf_loader: Handle DW_FORM_block in attr_numeric for Rust discriminant values Arnaldo Carvalho de Melo
2026-07-31 19:30 ` [PATCH 06/12] dwarf_loader: Allow forcing the merge of CUs for solving inter CU tag references Arnaldo Carvalho de Melo
2026-07-31 19:30 ` [PATCH 07/12] dwarf_loader: Support DW_TAG_imported_unit for same-file partial units Arnaldo Carvalho de Melo
2026-07-31 19:30 ` [PATCH 08/12] dwarf_loader: Fix cus__merging_cu failing to detect DW_FORM_ref_addr Arnaldo Carvalho de Melo
2026-07-31 19:30 ` Arnaldo Carvalho de Melo [this message]
2026-07-31 19:30 ` [PATCH 10/12] dwarf_loader: Support DW_FORM_GNU_ref_alt references to dwz alternate debug files Arnaldo Carvalho de Melo
2026-07-31 19:30 ` [PATCH 11/12] tests: Add inter-CU type reference comparison test Arnaldo Carvalho de Melo
2026-07-31 19:31 ` [PATCH 12/12] scripts: Add vmlinux_comparison.py for DWARF/BTF analysis Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260731193102.110693-10-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dwarves@vger.kernel.org \
--cc=jolsa@kernel.org \
--cc=mjw@redhat.com \
--cc=williams@redhat.com \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.