dwarf_loader: Allow asking not to read the DW_AT_alignment attribute
As this isn't present in most types or struct members, which ends up making dwarf_attr() call libdw_find_attr() that will do a linear search on all the attributes. We don't use this in the BTF encoder, so no point in reading that. This will be used in pahole in the following cset. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
1ef1639039
commit
21a41e5386
|
@ -322,6 +322,11 @@ static uint64_t attr_numeric(Dwarf_Die *die, uint32_t name)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint64_t attr_alignment(Dwarf_Die *die, struct conf_load *conf)
|
||||||
|
{
|
||||||
|
return conf->ignore_alignment_attr ? 0 : attr_numeric(die, DW_AT_alignment);
|
||||||
|
}
|
||||||
|
|
||||||
static uint64_t dwarf_expr(const uint8_t *expr, uint32_t len __maybe_unused)
|
static uint64_t dwarf_expr(const uint8_t *expr, uint32_t len __maybe_unused)
|
||||||
{
|
{
|
||||||
/* Common case: offset from start of the class */
|
/* Common case: offset from start of the class */
|
||||||
|
@ -601,7 +606,7 @@ static void type__init(struct type *type, Dwarf_Die *die, struct cu *cu, struct
|
||||||
namespace__init(&type->namespace, die, cu, conf);
|
namespace__init(&type->namespace, die, cu, conf);
|
||||||
__type__init(type);
|
__type__init(type);
|
||||||
type->size = attr_numeric(die, DW_AT_byte_size);
|
type->size = attr_numeric(die, DW_AT_byte_size);
|
||||||
type->alignment = attr_numeric(die, DW_AT_alignment);
|
type->alignment = attr_alignment(die, conf);
|
||||||
type->declaration = attr_numeric(die, DW_AT_declaration);
|
type->declaration = attr_numeric(die, DW_AT_declaration);
|
||||||
dwarf_tag__set_spec(type->namespace.tag.priv,
|
dwarf_tag__set_spec(type->namespace.tag.priv,
|
||||||
attr_type(die, DW_AT_specification));
|
attr_type(die, DW_AT_specification));
|
||||||
|
@ -860,7 +865,7 @@ static struct class_member *class_member__new(Dwarf_Die *die, struct cu *cu,
|
||||||
if (member != NULL) {
|
if (member != NULL) {
|
||||||
tag__init(&member->tag, cu, die);
|
tag__init(&member->tag, cu, die);
|
||||||
member->name = attr_string(die, DW_AT_name, conf);
|
member->name = attr_string(die, DW_AT_name, conf);
|
||||||
member->alignment = attr_numeric(die, DW_AT_alignment);
|
member->alignment = attr_alignment(die, conf);
|
||||||
|
|
||||||
Dwarf_Attribute attr;
|
Dwarf_Attribute attr;
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ struct conf_load {
|
||||||
bool extra_dbg_info;
|
bool extra_dbg_info;
|
||||||
bool fixup_silly_bitfields;
|
bool fixup_silly_bitfields;
|
||||||
bool get_addr_info;
|
bool get_addr_info;
|
||||||
|
bool ignore_alignment_attr;
|
||||||
uint16_t kabi_prefix_len;
|
uint16_t kabi_prefix_len;
|
||||||
const char *kabi_prefix;
|
const char *kabi_prefix;
|
||||||
struct btf *base_btf;
|
struct btf *base_btf;
|
||||||
|
|
Loading…
Reference in New Issue