dwarves_fprintf: Allow suppressing the __attribute__((__aligned__(N))
So that we can use it in things like btfdiff. Cc: Alexei Starovoitov <ast@fb.com> Cc: Andrii Nakryiko <andriin@fb.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Mark Wielaard <mark@klomp.org> Cc: Yonghong Song <yhs@fb.com> Cc: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
f31ea292e3
commit
6cd6a6bd87
|
@ -69,6 +69,7 @@ struct conf_fprintf {
|
||||||
uint8_t rel_offset:1;
|
uint8_t rel_offset:1;
|
||||||
uint8_t emit_stats:1;
|
uint8_t emit_stats:1;
|
||||||
uint8_t suppress_comments:1;
|
uint8_t suppress_comments:1;
|
||||||
|
uint8_t suppress_aligned_attribute:1;
|
||||||
uint8_t suppress_offset_comment:1;
|
uint8_t suppress_offset_comment:1;
|
||||||
uint8_t show_decl_info:1;
|
uint8_t show_decl_info:1;
|
||||||
uint8_t show_only_data_members:1;
|
uint8_t show_only_data_members:1;
|
||||||
|
|
|
@ -774,7 +774,7 @@ static size_t class_member__fprintf(struct class_member *member, bool union_memb
|
||||||
printed += fprintf(fp, ":%u", member->bitfield_size);
|
printed += fprintf(fp, ":%u", member->bitfield_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (member->alignment != 0)
|
if (!sconf.suppress_aligned_attribute && member->alignment != 0)
|
||||||
printed += fprintf(fp, " __attribute__((__aligned__(%u))", member->alignment);
|
printed += fprintf(fp, " __attribute__((__aligned__(%u))", member->alignment);
|
||||||
|
|
||||||
fputc(';', fp);
|
fputc(';', fp);
|
||||||
|
|
|
@ -167,9 +167,14 @@ Show CUs where CLASS_NAME (-C) is defined.
|
||||||
.TP
|
.TP
|
||||||
.B \-\-flat_arrays
|
.B \-\-flat_arrays
|
||||||
Flatten arrays, so that array[10][2] becomes array[20].
|
Flatten arrays, so that array[10][2] becomes array[20].
|
||||||
Useful when generating from both CTF and DWARF encodings
|
Useful when generating from both CTF/BTF and DWARF encodings
|
||||||
for the same binary for testing purposes.
|
for the same binary for testing purposes.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B \-\-suppress_aligned_attribute
|
||||||
|
Suppress forced alignment markers, so that one can compare BTF or
|
||||||
|
CTF output, that don't have that info, to output from DWARF >= 5.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-\-fixup_silly_bitfields
|
.B \-\-fixup_silly_bitfields
|
||||||
Converts silly bitfields such as "int foo:32" to plain "int foo".
|
Converts silly bitfields such as "int foo:32" to plain "int foo".
|
||||||
|
|
8
pahole.c
8
pahole.c
|
@ -749,6 +749,7 @@ ARGP_PROGRAM_VERSION_HOOK_DEF = dwarves_print_version;
|
||||||
#define ARGP_first_obj_only 303
|
#define ARGP_first_obj_only 303
|
||||||
#define ARGP_classes_as_structs 304
|
#define ARGP_classes_as_structs 304
|
||||||
#define ARGP_hex_fmt 305
|
#define ARGP_hex_fmt 305
|
||||||
|
#define ARGP_suppress_aligned_attribute 306
|
||||||
|
|
||||||
static const struct argp_option pahole__options[] = {
|
static const struct argp_option pahole__options[] = {
|
||||||
{
|
{
|
||||||
|
@ -946,6 +947,11 @@ static const struct argp_option pahole__options[] = {
|
||||||
.key = ARGP_flat_arrays,
|
.key = ARGP_flat_arrays,
|
||||||
.doc = "Flat arrays",
|
.doc = "Flat arrays",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.name = "suppress_aligned_attribute",
|
||||||
|
.key = ARGP_suppress_aligned_attribute,
|
||||||
|
.doc = "Suppress __attribute__((aligned(N))",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.name = "show_private_classes",
|
.name = "show_private_classes",
|
||||||
.key = ARGP_show_private_classes,
|
.key = ARGP_show_private_classes,
|
||||||
|
@ -1046,6 +1052,8 @@ static error_t pahole__options_parser(int key, char *arg,
|
||||||
break;
|
break;
|
||||||
case 'Z': ctf_encode = 1; break;
|
case 'Z': ctf_encode = 1; break;
|
||||||
case ARGP_flat_arrays: conf.flat_arrays = 1; break;
|
case ARGP_flat_arrays: conf.flat_arrays = 1; break;
|
||||||
|
case ARGP_suppress_aligned_attribute:
|
||||||
|
conf.suppress_aligned_attribute = 1; break;
|
||||||
case ARGP_show_private_classes:
|
case ARGP_show_private_classes:
|
||||||
show_private_classes = true;
|
show_private_classes = true;
|
||||||
conf.show_only_data_members = 1; break;
|
conf.show_only_data_members = 1; break;
|
||||||
|
|
Loading…
Reference in New Issue