public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Ihor Solodrai <ihor.solodrai@linux.dev>
To: Alan Maguire <alan.maguire@oracle.com>,
	yonghong.song@linux.dev, mattbobrowski@google.com
Cc: eddyz87@gmail.com, jolsa@kernel.org, andrii@kernel.org,
	ast@kernel.org, dwarves@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH dwarves 2/4] btf_encoder: Refactor elf_functions__new() with struct btf_encoder as argument
Date: Tue, 13 Jan 2026 10:32:06 -0800	[thread overview]
Message-ID: <362ab824-6726-49ad-9602-ea25490e3298@linux.dev> (raw)
In-Reply-To: <20260113131352.2395024-3-alan.maguire@oracle.com>

On 1/13/26 5:13 AM, Alan Maguire wrote:
> From: Yonghong Song <yonghong.song@linux.dev>
> 
> For elf_functions__new(), replace original argument 'Elf *elf' with
> 'struct btf_encoder *encoder' for future use.
> 
> Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
> ---
>  btf_encoder.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/btf_encoder.c b/btf_encoder.c
> index 2c3cef9..5bc61cb 100644
> --- a/btf_encoder.c
> +++ b/btf_encoder.c
> @@ -187,11 +187,13 @@ static inline void elf_functions__delete(struct elf_functions *funcs)
>  
>  static int elf_functions__collect(struct elf_functions *functions);
>  
> -struct elf_functions *elf_functions__new(Elf *elf)
> +struct elf_functions *elf_functions__new(struct btf_encoder *encoder)

Hi Alan, Yonghong,

I assume "future use" refers to this patch:
https://lore.kernel.org/dwarves/20251130040350.2636774-1-yonghong.song@linux.dev/

Do I understand correctly that you're passing btf_encoder here in
order to detect that the `encoder->dotted_true_signature` feature flag
is set? If so, I think this is a bit of an overkill.

How about just store the flag in struct elf_functions, pass it to the
elf_functions__new() directly and set it there:

	funcs->elf = elf;
	funcs->dotted_true_signature = dotted_true_signature; // <--
	err = elf_functions__collect(funcs);
	if (err < 0)
		goto out_delete;

And even then, it doesn't feel right to me that the contents of the
*ELF* functions table changes based on a feature flag. But we are
discarding the suffixes currently, so I understand why this was done.

Taking a step back, I remember Yonghong mentioned some pushback both
from LLVM and DWARF side regarding the introduction of true signatures
to DWARF data. Is there a feasible path forward landing all that?

I haven't followed this work in detail, so apologies if I missed
anything. Just want to have a high-level understanding of the
situation.

Thank you!


>  {
>  	struct elf_functions *funcs;
> +	Elf *elf;
>  	int err;
>  
> +	elf = encoder->cu->elf;
>  	funcs = calloc(1, sizeof(*funcs));
>  	if (!funcs) {
>  		err = -ENOMEM;
> @@ -1552,7 +1554,7 @@ static struct elf_functions *btf_encoder__elf_functions(struct btf_encoder *enco
>  
>  	funcs = elf_functions__find(encoder->cu->elf, &encoder->elf_functions_list);
>  	if (!funcs) {
> -		funcs = elf_functions__new(encoder->cu->elf);
> +		funcs = elf_functions__new(encoder);
>  		if (funcs)
>  			list_add(&funcs->node, &encoder->elf_functions_list);
>  	}


  reply	other threads:[~2026-01-13 18:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-13 13:13 [PATCH dwarves 0/4] Improve BTF concrete function accuracy Alan Maguire
2026-01-13 13:13 ` [PATCH dwarves 1/4] dwarf_loader/btf_encoder: Detect reordered parameters Alan Maguire
2026-01-20 16:07   ` Yonghong Song
2026-01-13 13:13 ` [PATCH dwarves 2/4] btf_encoder: Refactor elf_functions__new() with struct btf_encoder as argument Alan Maguire
2026-01-13 18:32   ` Ihor Solodrai [this message]
2026-01-13 18:57     ` Yonghong Song
2026-01-13 20:59     ` Alan Maguire
2026-01-13 13:13 ` [PATCH dwarves 3/4] btf_encoder: Add true_signature feature support for "."-suffixed functions Alan Maguire
2026-01-14 16:15   ` Yonghong Song
2026-01-14 16:55     ` Alan Maguire
2026-01-14 18:22       ` David Faust
2026-01-15  3:27         ` Yonghong Song
2026-01-15 18:38         ` Yonghong Song
2026-01-20 17:53   ` Yonghong Song
2026-01-22 18:21     ` Alan Maguire
2026-01-22 18:36       ` Yonghong Song
2026-01-13 13:13 ` [PATCH dwarves 4/4] btf_encoder: Prefer strong function definitions for BTF generation Alan Maguire
2026-01-20 17:54   ` Yonghong Song
2026-01-20  9:52 ` [PATCH dwarves 0/4] Improve BTF concrete function accuracy Alan Maguire

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=362ab824-6726-49ad-9602-ea25490e3298@linux.dev \
    --to=ihor.solodrai@linux.dev \
    --cc=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=eddyz87@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=mattbobrowski@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox