fprintf: Print __attribute__((__aligned__(N))) for structs/classes
For instance: $ pahole -C kern_ipc_perm /home/acme/git/build/v5.0-rc2+/ipc/util.o struct kern_ipc_perm { spinlock_t lock; /* 0 4 */ bool deleted; /* 4 1 */ /* XXX 3 bytes hole, try to pack */ int id; /* 8 4 */ key_t key; /* 12 4 */ kuid_t uid; /* 16 4 */ kgid_t gid; /* 20 4 */ kuid_t cuid; /* 24 4 */ kgid_t cgid; /* 28 4 */ umode_t mode; /* 32 2 */ /* XXX 6 bytes hole, try to pack */ long unsigned int seq; /* 40 8 */ void * security; /* 48 8 */ struct rhash_head khtnode; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ struct callback_head rcu __attribute__((__aligned__(8))); /* 64 16 */ refcount_t refcount; /* 80 4 */ /* size: 128, cachelines: 2, members: 14 */ /* sum members: 75, holes: 2, sum holes: 9 */ /* padding: 44 */ /* forced alignments: 1 */ } __attribute__((__aligned__(64))); $ Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
1c9c1d6bbd
commit
b42d77b0bb
|
@ -1608,8 +1608,13 @@ static size_t __class__fprintf(struct class *class, const struct cu *cu,
|
|||
cconf.indent, tabs,
|
||||
type->size, sum_bytes, sum_bits, sum_holes, sum_bit_holes, size_diff);
|
||||
out:
|
||||
return printed + fprintf(fp, "%.*s}%s%s", indent, tabs,
|
||||
cconf.suffix ? " ": "", cconf.suffix ?: "");
|
||||
|
||||
printed += fprintf(fp, "%.*s}%s%s", indent, tabs, cconf.suffix ? " ": "", cconf.suffix ?: "");
|
||||
|
||||
if (type->alignment != 0)
|
||||
printed += fprintf(fp, " __attribute__((__aligned__(%u)))", type->alignment);
|
||||
|
||||
return printed;
|
||||
}
|
||||
|
||||
size_t class__fprintf(struct class *class, const struct cu *cu, FILE *fp)
|
||||
|
|
Loading…
Reference in New Issue