Skip to contentSkip to conversation

pahole treats embedded structures a holes

DISCUSSION Christoph Hellwig 2 participants 6 messages May 28 – May 29

lore
Share & tools
lore
#0 lore raw

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.

#1 lore raw
Quoted 17 lines · Christoph Hellwig

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 */

Quoted 8 lines

/* 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.

Starting from using the BTF info, that becomes available thru sysfs as soon as we load the xfs kernel module:

acme@x1:~$ ls -la /sys/kernel/btf/xfs
ls: cannot access '/sys/kernel/btf/xfs': No such file or directory
acme@x1:~$ sudo modprobe xfs
acme@x1:~$ ls -la /sys/kernel/btf/xfs
-r--r--r--. 1 root root 630917 May 28 10:33 /sys/kernel/btf/xfs
acme@x1:~$
acme@x1:~$ pahole --sizes /sys/kernel/btf/xfs | sort -nr -k2 | grep xfs | head 
xfs_mount	4032	8
xfs_dquot_acct	1320	0
xfs_cil_ctx	1240	2
xfsstats	1088	0
__xfsstats	1088	0
xfs_inode	984	2
xfs_quotainfo	552	1
xfs_dquot	536	3
xfs_perag	480	4
xfs_da_state	480	1
acme@x1:~$

Now to the 'xfs_buf' struct:

acme@x1:~$ pahole /sys/kernel/btf/xfs -C xfs_buf | head
struct xfs_buf {
	struct rhash_head          b_rhash_head;         /*     0     8 */
	xfs_daddr_t                b_rhash_key;          /*     8     8 */
	int                        b_length;             /*    16     4 */
	unsigned int               b_hold;               /*    20     4 */
	atomic_t                   b_lru_ref;            /*    24     4 */
	xfs_buf_flags_t            b_flags;              /*    28     4 */
	struct semaphore           b_sema;               /*    32    24 */
	struct list_head           b_lru;                /*    56    16 */
	/* --- cacheline 1 boundary (64 bytes) was 8 bytes ago --- */
acme@x1:~$

Seems ok, expanding it:

acme@x1:~$ pahole -E /sys/kernel/btf/xfs -C xfs_buf | head
struct xfs_buf {
	struct rhash_head {
		struct rhash_head * next;                                                /*     0     8 */
	} b_rhash_head; /*     0     8 */
	/* typedef xfs_daddr_t -> __s64 */ long long int              b_rhash_key;       /*     8     8 */
	int                        b_length;                                             /*    16     4 */
	unsigned int               b_hold;                                               /*    20     4 */
	/* typedef atomic_t */ struct {
		int                counter;                                              /*    24     4 */
	} b_lru_ref; /*    24     4 */
acme@x1:~$

Looks ok and with your description of the struct, a pointer, 8 bytes, etc.

Now I'll try with a fresh kernel build, with a default fedora kernel config, will take a while, but having access to a separate .o file from the kernel build process, with just DWARF info is what we need to get to the state you're in, that should work, lets see why you're getting the unsatisfactory results you're getting, maybe we need further info about compiler versions, etc, but lets see...

- Arnaldo

#2 lore raw
Quoted 7 lines · Arnaldo Carvalho de Melo
Quoted 4 lines

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.

Starting from using the BTF info, that becomes available thru sysfs as soon as we load the xfs kernel module:

This works fine on my installed distro kernel as well. But this is for test builds which are only going to run in a VM. I don't really care about DWARF vs BTF, but I do care about not having to run the kernel :)

Note that I'm also seeing this for other code than XFS, e.g. the nvme driver or block layer code.

Quoted 6 lines

Now I'll try with a fresh kernel build, with a default fedora kernel config, will take a while, but having access to a separate .o file from the kernel build process, with just DWARF info is what we need to get to the state you're in, that should work, lets see why you're getting the unsatisfactory results you're getting, maybe we need further info about compiler versions, etc, but lets see...

gcc (Debian 15.2.0-17) 15.2.0

#3 lore raw
Quoted 6 lines · Christoph Hellwig
Quoted 4 lines · Arnaldo Carvalho de Melo
Quoted 4 lines

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.

Quoted 7 lines
Quoted 2 lines

Starting from using the BTF info, that becomes available thru sysfs as soon as we load the xfs kernel module:

This works fine on my installed distro kernel as well. But this is for test builds which are only going to run in a VM. I don't really care about DWARF vs BTF, but I do care about not having to run the kernel :)

Sure, I was just checking with what I had at hand, before building the kernel, to see if the problem was there as well.

Quoted 11 lines

Note that I'm also seeing this for other code than XFS, e.g. the nvme driver or block layer code.

Quoted 6 lines

Now I'll try with a fresh kernel build, with a default fedora kernel config, will take a while, but having access to a separate .o file from the kernel build process, with just DWARF info is what we need to get to the state you're in, that should work, lets see why you're getting the unsatisfactory results you're getting, maybe we need further info about compiler versions, etc, but lets see...

gcc (Debian 15.2.0-17) 15.2.0

acme@number:~$ pahole -C xfs_buf git/build/allmodconfig/fs/xfs/xfs_buf.o  | head
struct xfs_buf {
	struct rhash_head          b_rhash_head;         /*     0     8 */
	xfs_daddr_t                b_rhash_key;          /*     8     8 */
	int                        b_length;             /*    16     4 */
	/* XXX 4 bytes hole, try to pack */

	struct lockref             b_lockref __attribute__((__aligned__(8))); /*    24    80 */
	/* --- cacheline 1 boundary (64 bytes) was 40 bytes ago --- */
	atomic_t                   b_lru_ref __attribute__((__aligned__(4))); /*   104     4 */

acme@number:~$

acme@number:~$ pahole -E -C xfs_buf git/build/allmodconfig/fs/xfs/xfs_buf.o  | head
struct xfs_buf {
	struct rhash_head {
		struct rhash_head * next;                                                /*     0     8 */
	} b_rhash_head; /*     0     8 */
	/* typedef xfs_daddr_t -> __s64 */ long long int              b_rhash_key;       /*     8     8 */
	int                        b_length;                                             /*    16     4 */
	/* XXX 4 bytes hole, try to pack */

	struct lockref {

acme@number:~$

acme@number:~$ readelf -wi git/build/allmodconfig/fs/xfs/xfs_buf.o  | grep -m1 DW_AT_producer
    <e>   DW_AT_producer    : (indirect string, offset: 0x923f): GNU C11 16.1.1 20260515 (Red Hat 16.1.1-2) -march=znver5 -mpopcnt -msse3 -mssse3 -msse4.1 -msse4.2 -mavx2 -mno-fma4 -mno-xop -mfma -mavx512f -mbmi -mbmi2 -maes -mpclmul -mavx512vl -mavx512bw -mavx512dq -mavx512cd -mavx512vbmi -mavx512ifma -mavx512vpopcntdq -mavx512vbmi2 -mgfni -mvpclmulqdq -mavx512vnni -mavx512bitalg -mavx512bf16 -mavx512vp2intersect -madx -mabm -mno-cldemote -mclflushopt -mclwb -mclzero -mcx16 -mno-enqcmd -mf16c -mfsgsbase -mfxsr -mno-hle -msahf -mno-lwp -mlzcnt -mmovbe -mmovdir64b -mmovdiri -mmwaitx -mno-pconfig -mpku -mprfchw -mno-ptwrite -mrdpid -mrdrnd -mrdseed -mno-rtm -mno-serialize -mno-sgx -msha -mshstk -mno-tbm -mno-tsxldtrk -mvaes -mno-waitpkg -mwbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-amx-tile -mno-amx-int8 -mno-amx-bf16 -mno-uintr -mno-hreset -mno-kl -mno-widekl -mavxvnni -mno-avx512fp16 -mno-avxifma -mno-avxvnniint8 -mno-avxneconvert -mno-cmpccxadd -mno-amx-fp16 -mprefetchi -mno-raoint -mno-amx-complex -mno-avxvnniint16 -mno-sm3 -mno-sha512 -mno-sm4 -mno-apxf -mno-usermsr -mno-avx10.1 -mno-avx10.2 -mno-amx-avx512 -mno-amx-tf32 -mno-amx-fp8 -mno-movrs -mno-amx-movrs -mno-avx512bmm --param=l1-cache-size=48 --param=l1-cache-line-size=64 --param=l2-cache-size=1024 -mtune=znver5 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mno-sse4a -m64 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mno-red-zone -mcmodel=kernel -mstack-protector-guard-reg=gs -mstack-protector-guard-symbol=__ref_stack_chk_guard -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-return=thunk-extern -mharden-sls=all -mrecord-mcount -mfentry -mtls-dialect=gnu2 -g -O2 -std=gnu11 -p -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -fms-extensions -fcf-protection=branch -falign-jumps=1 -falign-loops=1 -fno-asynchronous-unwind-tables -fno-jump-tables -fpatchable-function-entry=64,64 -fno-delete-null-pointer-checks -fno-allow-store-data-races -fno-reorder-blocks -fno-ipa-cp-clone -fno-partial-inlining -fstack-protector-strong -ftrivial-auto-var-init=pattern -fzero-init-padding-bits=all -fno-stack-clash-protection -fdiagnostics-show-context=2 -fzero-call-used-regs=used-gpr -fno-inline-functions-called-once -fmin-function-alignment=64 -fstrict-flex-arrays=3 -fno-strict-overflow -fstack-check=no -fconserve-stack -fno-builtin-wcslen -fsanitize=kernel-address -fasan-shadow-offset=0xdffffc0000000000 -fsanitize=bounds-strict -fsanitize=shift -fsanitize=integer-divide-by-zero -fsanitize=bool -fsanitize=enum -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp --param=asan-instrumentation-with-call-threshold=10000 --param=asan-stack=1 --param=asan-instrument-allocas=1 --param=asan-globals=1 --param=asan-kernel-mem-intrinsic-prefix=1
acme@number:~$

then, please take a look at this sequence:

acme@number:~$ readelf -wi git/build/allmodconfig/fs/xfs/xfs_buf.o  | grep -w xfs_buf$ -B1 -A12
 <1><15f59>: Abbrev Number: 76 (DW_TAG_structure_type)
    <15f5a>   DW_AT_name        : (indirect string, offset: 0x8a96): xfs_buf
    <15f5e>   DW_AT_byte_size   : 664
    <15f60>   DW_AT_alignment   : 8
    <15f61>   DW_AT_decl_file   : 49
    <15f62>   DW_AT_decl_line   : 138
    <15f63>   DW_AT_decl_column : 8
    <15f64>   DW_AT_sibling     : <0x1610b>
 <2><15f68>: Abbrev Number: 4 (DW_TAG_member)
    <15f69>   DW_AT_name        : (indirect string, offset: 0x4e54): b_rhash_head
    <15f6d>   DW_AT_decl_file   : 49
    <15f6e>   DW_AT_decl_line   : 146
    <15f6f>   DW_AT_decl_column : 20
    <15f70>   DW_AT_type        : <0x5b22>
acme@number:~$
acme@number:~$ readelf -wi git/build/allmodconfig/fs/xfs/xfs_buf.o  | grep '<5b22>' -A12
 <1><5b22>: Abbrev Number: 30 (DW_TAG_structure_type)
    <5b23>   DW_AT_name        : (indirect string, offset: 0x1bb8): rhash_head
    <5b27>   DW_AT_byte_size   : 8
    <5b28>   DW_AT_decl_file   : 160
    <5b29>   DW_AT_decl_line   : 19
    <5b2a>   DW_AT_decl_column : 8
    <5b2b>   DW_AT_sibling     : <0x5b3d>
 <2><5b2f>: Abbrev Number: 4 (DW_TAG_member)
    <5b30>   DW_AT_name        : (indirect string, offset: 0x123e3): next
    <5b34>   DW_AT_decl_file   : 160
    <5b35>   DW_AT_decl_line   : 20
    <5b36>   DW_AT_decl_column : 28
    <5b37>   DW_AT_type        : <0x5b42>
acme@number:~$
iacme@number:~$ readelf -wi git/build/allmodconfig/fs/xfs/xfs_buf.o  | grep '<5b42>' -A4
 <1><5b42>: Abbrev Number: 8 (DW_TAG_pointer_type)
    <5b43>   DW_AT_byte_size   : 8
    <5b43>   DW_AT_type        : <0x5b22>
 <1><5b47>: Abbrev Number: 30 (DW_TAG_structure_type)
    <5b48>   DW_AT_name        : (indirect string, offset: 0x14c84): rhlist_head
acme@number:~$

So everything is in this CU (debug info for the .o file), at least here, what do you see on your system?

- Arnaldo

#4 lore raw
Quoted 1 line · Arnaldo Carvalho de Melo
acme@number:~$ readelf -wi git/build/allmodconfig/fs/xfs/xfs_buf.o  | grep -m1 DW_AT_producer
hch@brick:~/work/xfs$ readelf -wi fs/xfs/xfs_buf.o  | grep -m1 DW_AT_producer
    <d>   DW_AT_producer    : (indirect string, offset: 0x6012): GNU C11 15.2.0 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mno-sse4a -m64 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -march=x86-64 -mtune=generic -mno-red-zone -mcmodel=kernel -mstack-protector-guard-reg=gs -mstack-protector-guard-symbol=__ref_stack_chk_guard -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-return=thunk-extern -g -gdwarf-5 -O2 -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -fms-extensions -fcf-protection=branch -falign-jumps=1 -falign-loops=1 -fno-asynchronous-unwind-tables -fno-jump-tables -fpatchable-function-entry=16,16 -fno-delete-null-pointer-checks -fno-allow-store-data-races -fstack-protector-strong -fomit-frame-pointer -fzero-init-padding-bits=all -fno-stack-clash-protection -fmin-function-alignment=16 -fstrict-flex-arrays=3 -fno-strict-overflow -fstack-check=no -fconserve-stack -fno-builtin-wcslen -fno-var-tracking -femit-struct-debug-baseonly
Quoted 3 lines

then, please take a look at this sequence:

acme@number:~$ readelf -wi git/build/allmodconfig/fs/xfs/xfs_buf.o  | grep -w xfs_buf$ -B1 -A12
hch@brick:~/work/xfs$ readelf -wi fs/xfs/xfs_buf.o  | grep -w xfs_buf$ -B1 -A12
 <1><f1c>: Abbrev Number: 93 (DW_TAG_structure_type)
    <f1d>   DW_AT_name        : (indirect string, offset: 0x3358): xfs_buf
    <f21>   DW_AT_byte_size   : 344
    <f23>   DW_AT_alignment   : 8
    <f23>   DW_AT_decl_file   : 46
    <f23>   DW_AT_decl_line   : 138
    <f24>   DW_AT_decl_column : 8
    <f24>   DW_AT_sibling     : <0x10a2>
 <2><f28>: Abbrev Number: 39 (DW_TAG_member)
    <f29>   DW_AT_name        : (indirect string, offset: 0x5e80): b_rhash_head
    <f2d>   DW_AT_decl_file   : 46
    <f2d>   DW_AT_decl_line   : 146
    <f2e>   DW_AT_decl_column : 20
    <f2f>   DW_AT_type        : <0x9c8>
Quoted 1 line
acme@number:~$ readelf -wi git/build/allmodconfig/fs/xfs/xfs_buf.o  | grep '<5b22>' -A12
hch@brick:~/work/xfs$ readelf -wi fs/xfs/xfs_buf.o  | grep '<0x9c8>' -A12
    <9ce>   DW_AT_type        : <0x9c8>
 <1><9d2>: Abbrev Number: 29 (DW_TAG_structure_type)
    <9d3>   DW_AT_name        : (indirect string, offset: 0x303): rhlist_head
    <9d7>   DW_AT_declaration : 1
 <1><9d7>: Abbrev Number: 29 (DW_TAG_structure_type)
    <9d8>   DW_AT_name        : (indirect string, offset: 0x27b4): rhashtable_compare_arg
    <9dc>   DW_AT_declaration : 1
 <1><9dc>: Abbrev Number: 17 (DW_TAG_pointer_type)
    <9dd>   DW_AT_byte_size   : 8
    <9dd>   DW_AT_type        : <0x9d7>
 <1><9e1>: Abbrev Number: 29 (DW_TAG_structure_type)
    <9e2>   DW_AT_name        : (indirect string, offset: 0x2ce3): rhashtable_params
    <9e6>   DW_AT_declaration : 1
--
    <f2f>   DW_AT_type        : <0x9c8>
    <f33>   DW_AT_data_member_location: 0
 <2><f34>: Abbrev Number: 39 (DW_TAG_member)
    <f35>   DW_AT_name        : (indirect string, offset: 0x25e): b_rhash_key
    <f39>   DW_AT_decl_file   : 46
    <f39>   DW_AT_decl_line   : 148
    <f3a>   DW_AT_decl_column : 15
    <f3b>   DW_AT_type        : <0xcb1>
    <f3f>   DW_AT_data_member_location: 8
 <2><f40>: Abbrev Number: 39 (DW_TAG_member)
    <f41>   DW_AT_name        : (indirect string, offset: 0x3fbd): b_length
    <f45>   DW_AT_decl_file   : 46
    <f45>   DW_AT_decl_line   : 149
--
    <1fa9>   DW_AT_type        : <0x9c8>
 <1><1fad>: Abbrev Number: 33 (DW_TAG_subprogram)
    <1fae>   DW_AT_external    : 1
    <1fae>   DW_AT_name        : (indirect string, offset: 0x5b66): __SCT__tp_func_xfs_buf_backing_vmalloc
    <1fb2>   DW_AT_decl_file   : 3
    <1fb3>   DW_AT_decl_line   : 793
    <1fb5>   DW_AT_decl_column : 1
    <1fb6>   DW_AT_prototyped  : 1
    <1fb6>   DW_AT_type        : <0x6e>
    <1fba>   DW_AT_declaration : 1
    <1fba>   DW_AT_sibling     : <0x1fce>
 <2><1fbe>: Abbrev Number: 6 (DW_TAG_formal_parameter)
    <1fbf>   DW_AT_type        : <0x27f>
Quoted 6 lines
iacme@number:~$ readelf -wi git/build/allmodconfig/fs/xfs/xfs_buf.o  | grep '<5b42>' -A4
 <1><5b42>: Abbrev Number: 8 (DW_TAG_pointer_type)
    <5b43>   DW_AT_byte_size   : 8
    <5b43>   DW_AT_type        : <0x5b22>
 <1><5b47>: Abbrev Number: 30 (DW_TAG_structure_type)
    <5b48>   DW_AT_name        : (indirect string, offset: 0x14c84): rhlist_head
hch@brick:~/work/xfs$ readelf -wi fs/xfs/xfs_buf.o  | grep '<0x9c8>' -A4
    <9ce>   DW_AT_type        : <0x9c8>
 <1><9d2>: Abbrev Number: 29 (DW_TAG_structure_type)
    <9d3>   DW_AT_name        : (indirect string, offset: 0x303): rhlist_head
    <9d7>   DW_AT_declaration : 1
 <1><9d7>: Abbrev Number: 29 (DW_TAG_structure_type)
--
    <f2f>   DW_AT_type        : <0x9c8>
    <f33>   DW_AT_data_member_location: 0
 <2><f34>: Abbrev Number: 39 (DW_TAG_member)
    <f35>   DW_AT_name        : (indirect string, offset: 0x25e): b_rhash_key
    <f39>   DW_AT_decl_file   : 46
--
    <1fa9>   DW_AT_type        : <0x9c8>
 <1><1fad>: Abbrev Number: 33 (DW_TAG_subprogram)
    <1fae>   DW_AT_external    : 1
    <1fae>   DW_AT_name        : (indirect string, offset: 0x5b66): __SCT__tp_func_xfs_buf_backing_vmalloc
    <1fb2>   DW_AT_decl_file   : 3
#5 lore raw
Quoted 26 lines · Christoph Hellwig
Quoted 1 line · Arnaldo Carvalho de Melo
acme@number:~$ readelf -wi git/build/allmodconfig/fs/xfs/xfs_buf.o  | grep -m1 DW_AT_producer
hch@brick:~/work/xfs$ readelf -wi fs/xfs/xfs_buf.o  | grep -m1 DW_AT_producer
    <d>   DW_AT_producer    : (indirect string, offset: 0x6012): GNU C11 15.2.0 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mno-sse4a -m64 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -march=x86-64 -mtune=generic -mno-red-zone -mcmodel=kernel -mstack-protector-guard-reg=gs -mstack-protector-guard-symbol=__ref_stack_chk_guard -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-return=thunk-extern -g -gdwarf-5 -O2 -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -fms-extensions -fcf-protection=branch -falign-jumps=1 -falign-loops=1 -fno-asynchronous-unwind-tables -fno-jump-tables -fpatchable-function-entry=16,16 -fno-delete-null-pointer-checks -fno-allow-store-data-races -fstack-protector-strong -fomit-frame-pointer -fzero-init-padding-bits=all -fno-stack-clash-protection -fmin-function-alignment=16 -fstrict-flex-arrays=3 -fno-strict-overflow -fstack-check=no -fconserve-stack -fno-builtin-wcslen -fno-var-tracking -femit-struct-debug-baseonly
Quoted 3 lines

then, please take a look at this sequence:

acme@number:~$ readelf -wi git/build/allmodconfig/fs/xfs/xfs_buf.o  | grep -w xfs_buf$ -B1 -A12
hch@brick:~/work/xfs$ readelf -wi fs/xfs/xfs_buf.o  | grep -w xfs_buf$ -B1 -A12
 <1><f1c>: Abbrev Number: 93 (DW_TAG_structure_type)
    <f1d>   DW_AT_name        : (indirect string, offset: 0x3358): xfs_buf
    <f21>   DW_AT_byte_size   : 344
    <f23>   DW_AT_alignment   : 8
    <f23>   DW_AT_decl_file   : 46
    <f23>   DW_AT_decl_line   : 138
    <f24>   DW_AT_decl_column : 8
    <f24>   DW_AT_sibling     : <0x10a2>
 <2><f28>: Abbrev Number: 39 (DW_TAG_member)
    <f29>   DW_AT_name        : (indirect string, offset: 0x5e80): b_rhash_head
    <f2d>   DW_AT_decl_file   : 46
    <f2d>   DW_AT_decl_line   : 146
    <f2e>   DW_AT_decl_column : 20
    <f2f>   DW_AT_type        : <0x9c8>
Quoted 3 lines
Quoted 1 line
acme@number:~$ readelf -wi git/build/allmodconfig/fs/xfs/xfs_buf.o  | grep '<5b22>' -A12
hch@brick:~/work/xfs$ readelf -wi fs/xfs/xfs_buf.o  | grep '<0x9c8>' -A12

This part is the tricky one, see that the 0x isn't there inside the <TYPE> in my grep, I guess whoever wrote readelf used this to get the offset, not the many entries pointing to it :-)

You need to do this:

hch@brick:~/work/xfs$ readelf -wi fs/xfs/xfs_buf.o  | grep '<9c8>' -A12

Without the 0x, so that I can see what is the type for that member.

Or better, please send me your fs/xfs/xfs_buf.o, that will be easier, I'll try it myself, and if I reproduce your results, I'll be able to fix it and test on the same fs/xfs/xfs_buf.o file.

- Arnaldo

Quoted 68 lines
    <9ce>   DW_AT_type        : <0x9c8>
 <1><9d2>: Abbrev Number: 29 (DW_TAG_structure_type)
    <9d3>   DW_AT_name        : (indirect string, offset: 0x303): rhlist_head
    <9d7>   DW_AT_declaration : 1
 <1><9d7>: Abbrev Number: 29 (DW_TAG_structure_type)
    <9d8>   DW_AT_name        : (indirect string, offset: 0x27b4): rhashtable_compare_arg
    <9dc>   DW_AT_declaration : 1
 <1><9dc>: Abbrev Number: 17 (DW_TAG_pointer_type)
    <9dd>   DW_AT_byte_size   : 8
    <9dd>   DW_AT_type        : <0x9d7>
 <1><9e1>: Abbrev Number: 29 (DW_TAG_structure_type)
    <9e2>   DW_AT_name        : (indirect string, offset: 0x2ce3): rhashtable_params
    <9e6>   DW_AT_declaration : 1
--
    <f2f>   DW_AT_type        : <0x9c8>
    <f33>   DW_AT_data_member_location: 0
 <2><f34>: Abbrev Number: 39 (DW_TAG_member)
    <f35>   DW_AT_name        : (indirect string, offset: 0x25e): b_rhash_key
    <f39>   DW_AT_decl_file   : 46
    <f39>   DW_AT_decl_line   : 148
    <f3a>   DW_AT_decl_column : 15
    <f3b>   DW_AT_type        : <0xcb1>
    <f3f>   DW_AT_data_member_location: 8
 <2><f40>: Abbrev Number: 39 (DW_TAG_member)
    <f41>   DW_AT_name        : (indirect string, offset: 0x3fbd): b_length
    <f45>   DW_AT_decl_file   : 46
    <f45>   DW_AT_decl_line   : 149
--
    <1fa9>   DW_AT_type        : <0x9c8>
 <1><1fad>: Abbrev Number: 33 (DW_TAG_subprogram)
    <1fae>   DW_AT_external    : 1
    <1fae>   DW_AT_name        : (indirect string, offset: 0x5b66): __SCT__tp_func_xfs_buf_backing_vmalloc
    <1fb2>   DW_AT_decl_file   : 3
    <1fb3>   DW_AT_decl_line   : 793
    <1fb5>   DW_AT_decl_column : 1
    <1fb6>   DW_AT_prototyped  : 1
    <1fb6>   DW_AT_type        : <0x6e>
    <1fba>   DW_AT_declaration : 1
    <1fba>   DW_AT_sibling     : <0x1fce>
 <2><1fbe>: Abbrev Number: 6 (DW_TAG_formal_parameter)
    <1fbf>   DW_AT_type        : <0x27f>
Quoted 6 lines
iacme@number:~$ readelf -wi git/build/allmodconfig/fs/xfs/xfs_buf.o  | grep '<5b42>' -A4
 <1><5b42>: Abbrev Number: 8 (DW_TAG_pointer_type)
    <5b43>   DW_AT_byte_size   : 8
    <5b43>   DW_AT_type        : <0x5b22>
 <1><5b47>: Abbrev Number: 30 (DW_TAG_structure_type)
    <5b48>   DW_AT_name        : (indirect string, offset: 0x14c84): rhlist_head
hch@brick:~/work/xfs$ readelf -wi fs/xfs/xfs_buf.o  | grep '<0x9c8>' -A4
    <9ce>   DW_AT_type        : <0x9c8>
 <1><9d2>: Abbrev Number: 29 (DW_TAG_structure_type)
    <9d3>   DW_AT_name        : (indirect string, offset: 0x303): rhlist_head
    <9d7>   DW_AT_declaration : 1
 <1><9d7>: Abbrev Number: 29 (DW_TAG_structure_type)
--
    <f2f>   DW_AT_type        : <0x9c8>
    <f33>   DW_AT_data_member_location: 0
 <2><f34>: Abbrev Number: 39 (DW_TAG_member)
    <f35>   DW_AT_name        : (indirect string, offset: 0x25e): b_rhash_key
    <f39>   DW_AT_decl_file   : 46
--
    <1fa9>   DW_AT_type        : <0x9c8>
 <1><1fad>: Abbrev Number: 33 (DW_TAG_subprogram)
    <1fae>   DW_AT_external    : 1
    <1fae>   DW_AT_name        : (indirect string, offset: 0x5b66): __SCT__tp_func_xfs_buf_backing_vmalloc
    <1fb2>   DW_AT_decl_file   : 3