public inbox for dwarves@vger.kernel.org
 help / color / mirror / Atom feed
From: Antoine Tenart <atenart@kernel.org>
To: dwarves@vger.kernel.org
Cc: Antoine Tenart <atenart@kernel.org>, pvalerio@redhat.com
Subject: [PATCH 0/2] pahole: BTF alignment inference improvements
Date: Wed, 25 Jun 2025 17:23:18 +0200	[thread overview]
Message-ID: <20250625152329.28601-1-atenart@kernel.org> (raw)

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


             reply	other threads:[~2025-06-25 15:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-25 15:23 Antoine Tenart [this message]
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

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=20250625152329.28601-1-atenart@kernel.org \
    --to=atenart@kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=pvalerio@redhat.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