public inbox for dwarves@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] pahole: BTF alignment inference improvements
@ 2025-06-25 15:23 Antoine Tenart
  2025-06-25 15:23 ` [PATCH 1/2] btf_loader: infer alignment for zero-length arrays Antoine Tenart
  2025-06-25 15:23 ` [PATCH 2/2] btf_loader: fix smallest offset in case of bitfields Antoine Tenart
  0 siblings, 2 replies; 7+ messages in thread
From: Antoine Tenart @ 2025-06-25 15:23 UTC (permalink / raw)
  To: dwarves; +Cc: Antoine Tenart, pvalerio

Hello,

While generating C code using pahole we noticed alignment issues in rare
cases: when having variable size and 0-length arrays, and when a hole
follows a bitfield. It's worth noticing alignment is inferred when using
BTF as a source as the format does not contain such information. As such
the logic is tricky.

The first patch fixes alignment inference for zero-length and variable
length arrays. The second patch fixes alignment when a hole follows a
bitfield.

I generated a full vmlinux.h using `pahole --compile` before and after
the changes, the differences looked reasonable to me. I've also ran the
project's tests using GH actions.

Thanks,
Antoine

Antoine Tenart (2):
  btf_loader: infer alignment for zero-length arrays
  btf_loader: fix smallest offset in case of bitfields

 btf_loader.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

-- 
2.49.0


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

end of thread, other threads:[~2025-07-08 14:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-25 15:23 [PATCH 0/2] pahole: BTF alignment inference improvements Antoine Tenart
2025-06-25 15:23 ` [PATCH 1/2] btf_loader: infer alignment for zero-length arrays Antoine Tenart
2025-07-04 16:34   ` Alan Maguire
2025-07-08 13:55     ` Antoine Tenart
2025-06-25 15:23 ` [PATCH 2/2] btf_loader: fix smallest offset in case of bitfields Antoine Tenart
2025-07-04 16:40   ` Alan Maguire
2025-07-08 14:01     ` Antoine Tenart

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