pahole treats embedded structures a holes

Christoph Hellwig <[email protected]> Thu, 28 May 2026 07:11:52 +0200
Newsgroups org.kernel.vger.dwarves
Message-ID <[email protected]>
Hi all,

this is a pretty old bug as far as I can tell, but I finally tried to
track it down and failed.

When running dwarves, both the package in Debian testing and a build of
todays git tree on Debian testing, it treats a lot of C structures
embedded into others as holes instead of having a size for them.  I
think this generally structures defined in other header files and
not the file containing the offending struct.

E.g. if I run pahole on fs/xfs/xfs_buf.o on a current mainline kernel,
the output for struct xfs_buf starts like this:

struct xfs_buf {
        struct rhash_head          b_rhash_head;         /*     0     0 */

        /* XXX 8 bytes hole, try to pack */

        xfs_daddr_t                b_rhash_key;          /*     8     8 */

struct rhash_head is a single pointer, so 8 bytes on x86-64, and
xfs_daddr_t is also a 64-bit type, so both the 0 size and the 8
byte hole are clearly wrong.  The kernel .config is attached in case
it matter.
config.gz (application/x-gzip, 26.2 KB) - not displayed