BPF List
 help / color / mirror / Atom feed
* [PATCH dwarves v2 0/3] pahole: Fix arm64 argument register allocation
@ 2026-09-17 16:40 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
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Yonghong Song @ 2026-09-17 16:40 UTC (permalink / raw)
  To: Alan Maguire, Arnaldo Carvalho de Melo, dwarves
  Cc: Alexei Starovoitov, Andrii Nakryiko, bpf, kernel-team

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.

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-09-25  7:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH dwarves v2 0/3] pahole: Fix arm64 argument register allocation Alan Maguire
2026-09-24 16:20   ` Alexei Starovoitov
2026-09-25  6:59     ` Alan Maguire
2026-09-25  7:03   ` Alan Maguire

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox