BPF List
 help / color / mirror / Atom feed
From: Vineet Gupta <vineet.gupta@linux.dev>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Emil Tsalapatis <emil@etsalapatis.com>
Cc: dwarves@vger.kernel.org, bpf@vger.kernel.org,
	Andrii Nakryiko <andrii@kernel.org>,
	Alan Maguire <alan.maguire@oracle.com>,
	jose.marchesi@oracle.com, David Faust <david.faust@oracle.com>
Subject: Re: [PAHOLE v3 1/3] dwarf_loader: Extract die__add_btf_type_tag() helper
Date: Tue, 2 Jun 2026 12:00:45 -0700	[thread overview]
Message-ID: <e3cd95d7-88bd-4db3-b5d3-a3d5e293958f@linux.dev> (raw)
In-Reply-To: <ah8dl-yaSPm64GhP@x1>

On 6/2/26 11:14 AM, Arnaldo Carvalho de Melo wrote:
> On Mon, Jun 01, 2026 at 03:27:41PM -0400, Emil Tsalapatis wrote:
>> On Mon Jun 1, 2026 at 2:35 PM EDT, Vineet Gupta wrote:
>>> NFC change preparing for DW_TAG_GNU_annotation support.
>>> Extract the btf_type_tag annotation creation logic from into a helper
>>> die__add_btf_type_tag().
>>>
>>> Signed-off-by: Vineet Gupta <vineet.gupta@linux.dev>
>>> ---
>>> Changes since v2 [2]
>>>   - die__add_btf_type_tag() returns pointer not error code.
>>>
>>> Changes since v1 [1]
>>>   - NFC reinstate some original comments
>> Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
>   
>> Minor nit/question below.
> Some more nits below :-)
>   
>>> +++ b/dwarf_loader.c
>>> @@ -1600,14 +1600,43 @@ static struct btf_type_tag_type *die__create_new_btf_type_tag_type(Dwarf_Die *di
>>>   	return tag;
>>>   }
>>>   
>>> +static struct btf_type_tag_ptr_type *die__add_btf_type_tag(struct btf_type_tag_ptr_type *tag,
>>> +							    Dwarf_Die *die, Dwarf_Die *adie,
>>> +							    struct cu *cu, struct conf_load *conf)
>>> +{
>>> +	struct btf_type_tag_type *annot;
>>> +	uint32_t id;
>>> +
>>> +	if (tag == NULL) {
>>> +		tag = die__create_new_btf_type_tag_ptr_type(die, cu);
>>> +		if (!tag)
>>> +			return NULL;
> There was an inconsistency on the code you moved here, namely first tag
> is tested against NULL then it is negated, equivalent, but since we're
> moving it, lets make it consistent, in the kernel it is most common to
> use !ptr as it is more compact, so please make the first test !tag, just
> like the second.

Thx, I already spotted that and fixed for v4.

>
>>> +	}
>>> +
>>> +	annot = die__create_new_btf_type_tag_type(adie, cu, conf);
>>> +	if (annot == NULL)
>>> +		return NULL;
>>> +
>>> +	if (cu__table_add_tag(cu, &annot->tag, &id) < 0)
>>> +		return NULL;
>>> +
>>> +	struct dwarf_tag *dtag = tag__dwarf(&annot->tag);
>>> +	dtag->small_id = id;
>>> +	cu__hash(cu, &annot->tag);
>>> +
>>> +	/* Prepends: for annotations tag1 -> tag2 -> tag3,
>   
>> Not familiar with pahole's coding style, do we want to adjust the
>> comments?
> Not that important, but we try to follow kernel style, so yeah that
> would be:
>
> 	/*
> 	 * Prepends: for annotations tag1 -> tag2 -> tag3,
>
> But by now I don't dwell that much on these minor details :)

Ok will fix it.

Thx,
-Vineet

      reply	other threads:[~2026-06-02 19:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01 18:35 [PAHOLE v3 1/3] dwarf_loader: Extract die__add_btf_type_tag() helper Vineet Gupta
2026-06-01 18:35 ` [PAHOLE v3 2/3] dwarf_loader: Add support for DW_TAG_GNU_annotation Vineet Gupta
2026-06-02  1:04   ` Emil Tsalapatis
2026-06-02 18:54     ` Vineet Gupta
2026-06-02 18:24   ` Arnaldo Carvalho de Melo
2026-06-02 19:23     ` Vineet Gupta
2026-06-01 18:35 ` [PAHOLE v3 3/3] tests: Support GCC in pfunct-btf-decl-tags test Vineet Gupta
2026-06-02  1:05   ` Emil Tsalapatis
2026-06-01 19:27 ` [PAHOLE v3 1/3] dwarf_loader: Extract die__add_btf_type_tag() helper Emil Tsalapatis
2026-06-01 19:44   ` Vineet Gupta
2026-06-02 18:14   ` Arnaldo Carvalho de Melo
2026-06-02 19:00     ` Vineet Gupta [this message]

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=e3cd95d7-88bd-4db3-b5d3-a3d5e293958f@linux.dev \
    --to=vineet.gupta@linux.dev \
    --cc=acme@kernel.org \
    --cc=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=david.faust@oracle.com \
    --cc=dwarves@vger.kernel.org \
    --cc=emil@etsalapatis.com \
    --cc=jose.marchesi@oracle.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox