Dwarves debugging tools
 help / color / mirror / Atom feed
From: Alan Maguire <alan.maguire@oracle.com>
To: Yonghong Song <yonghong.song@linux.dev>,
	Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>,
	dwarves@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	bpf@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH dwarves v2 0/3] pahole: Fix arm64 argument register allocation
Date: Thu, 24 Sep 2026 17:15:09 +0100	[thread overview]
Message-ID: <09dbfeea-a4d1-4b7a-b92e-bcf8c4cdabb4@oracle.com> (raw)
In-Reply-To: <20260917164038.1576763-1-yonghong.song@linux.dev>

On 17/09/2026 17:40, Yonghong Song wrote:
> 
> The arm64 ABI starts an argument twice the register size on an even-numbered
> argument register, leaving a hole when the next free register is an odd one:
> 
>   u64 f(u64 a, __int128 v, u64 b);
> 
> passes a in x0, v in x2:x3 -- skipping x1 -- and b in x4.  pahole did not
> model the hole, so b looked like it was in an unexpected register and the
> whole function was dropped from BTF.  Patch 1 skips the register the ABI
> leaves behind, patch 3 adds a test for it.  Only arm64 has this rule; the
> other architectures are unaffected.
> 
> Patch 2 is a small follow-up.  Floating point and vector arguments are
> allocated from a register bank of their own -- v0-v7 on arm64, xmm0-xmm7 on
> x86-64 -- so a wide one never occupies a general purpose register pair and
> must not trigger the even-register rule either.  It does not change the BTF
> emitted today, because such an argument still advances the general purpose
> register index by its own size, so it comes with no test of its own; it
> keeps the alignment rule scoped to the bank it applies to.
>

one small issue here; we record alignment for structs from DW_AT_align
in associated tags; we should ensure that we utilize that alignment
where available. However it's a bit broken in that we don't appear
to record alignment for typedefs, just structs.

I think we can tackle that with a followup though; unless anyone objects I'll
land these patches later today.

 
> Changelog:
>   v1 -> v2:
>     - v1: https://lore.kernel.org/bpf/20260911040955.339939-1-yonghong.song@linux.dev/
>     - add commit "Do not align the argument register index for FP arguments".
> 
> Yonghong Song (3):
>   dwarf_loader: Skip the argument register the arm64 ABI leaves as a
>     hole
>   dwarf_loader: Do not align the argument register index for FP
>     arguments
>   tests: tests: Add test for 16-byte aligned arguments on arm64
> 
>  dwarf_loader.c              | 72 ++++++++++++++++++++++++++++++++--
>  dwarves.h                   | 11 ++++++
>  tests/clang_parm_align16.sh | 77 +++++++++++++++++++++++++++++++++++++
>  tests/test_lib.sh           |  3 +-
>  4 files changed, 158 insertions(+), 5 deletions(-)
>  create mode 100755 tests/clang_parm_align16.sh
> 
> -- 
> 2.53.0-Meta
> 


  parent reply	other threads:[~2026-09-24 16:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 16:40 [PATCH dwarves v2 0/3] pahole: Fix arm64 argument register allocation Yonghong Song
2026-09-17 16:40 ` [PATCH 1/3] dwarf_loader: Skip the argument register the arm64 ABI leaves as a hole Yonghong Song
2026-09-17 16:40 ` [PATCH 2/3] dwarf_loader: Do not align the argument register index for FP arguments Yonghong Song
2026-09-17 16:40 ` [PATCH 3/3] tests: tests: Add test for 16-byte aligned arguments on arm64 Yonghong Song
2026-09-24 16:15 ` Alan Maguire [this message]
2026-09-24 16:20   ` [PATCH dwarves v2 0/3] pahole: Fix arm64 argument register allocation Alexei Starovoitov
2026-09-25  6:59     ` Alan Maguire
2026-09-25  7:03   ` 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=09dbfeea-a4d1-4b7a-b92e-bcf8c4cdabb4@oracle.com \
    --to=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=arnaldo.melo@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=kernel-team@fb.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