fprintf: Only add bitfield forced paddings when alignment info available
I.e. BTF doesn't have DW_AT_alignment, so avoid emitting the bitfield for padding at the end: $ pahole -F btf -C rseq examples/tcp.o struct rseq { __u32 cpu_id_start; /* 0 4 */ __u32 cpu_id; /* 4 4 */ union { __u64 ptr64; /* 8 8 */ __u64 ptr; /* 8 8 */ } rseq_cs; /* 8 8 */ __u32 flags; /* 16 4 */ /* Force padding: */ __u32 :32; __u32 :32; __u32 :32; /* size: 32, cachelines: 1, members: 4 */ /* padding: 12 */ /* last cacheline: 32 bytes */ }; $ After: $ pahole -F btf -C rseq examples/tcp.o struct rseq { __u32 cpu_id_start; /* 0 4 */ __u32 cpu_id; /* 4 4 */ union { __u64 ptr64; /* 8 8 */ __u64 ptr; /* 8 8 */ } rseq_cs; /* 8 8 */ __u32 flags; /* 16 4 */ /* size: 32, cachelines: 1, members: 4 */ /* padding: 12 */ /* last cacheline: 32 bytes */ }; $ Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
49c27bdd66
commit
986a3b58a8
|
@ -1596,7 +1596,11 @@ static size_t __class__fprintf(struct class *class, const struct cu *cu,
|
|||
last = pos;
|
||||
}
|
||||
|
||||
if (class->padding != 0 && type->alignment == 0) {
|
||||
/*
|
||||
* BTF doesn't have alignment info, for now use this infor from the loader
|
||||
* to avoid adding the forced bitfield paddings and have btfdiff happy.
|
||||
*/
|
||||
if (class->padding != 0 && type->alignment == 0 && conf->has_alignment_info) {
|
||||
tag_pos = cu__type(cu, last->tag.type);
|
||||
size = tag__size(tag_pos, cu);
|
||||
|
||||
|
|
Loading…
Reference in New Issue