diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2022-10-10 09:42:30 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2022-10-10 17:03:11 -0300 |
commit | cffe5e1f75e1612e1ffd8da5fab30e0230fbcdd4 (patch) | |
tree | 047947eb3f3fe78738b3e1f218847c27f720a5a8 | |
parent | 75e0fe28bb02036dd404eec53dc3b71b55684ed1 (diff) | |
download | pahole-cffe5e1f75e1612e1ffd8da5fab30e0230fbcdd4.tar.gz |
core: Record if a CU has a DW_TAG_unspecified_type
So that the BTF encoder can turn such functions into returning void
instead, as BTF doesn't have a representation for such tags.
First noticed with Linux circa v6.1 built with GNU AS 2.39.50, git
HEAD at the time building a .S file where the entry_ibpb assembly
"function" was encoded as DWARF with DW_TAG_unspecified_type as its
return type.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | dwarf_loader.c | 7 | ||||
-rw-r--r-- | dwarves.h | 8 |
2 files changed, 14 insertions, 1 deletions
diff --git a/dwarf_loader.c b/dwarf_loader.c index 28a912ec..03ac8718 100644 --- a/dwarf_loader.c +++ b/dwarf_loader.c @@ -2006,10 +2006,12 @@ static struct tag *__die__process_tag(Dwarf_Die *die, struct cu *cu, case DW_TAG_imported_module: case DW_TAG_reference_type: case DW_TAG_restrict_type: - case DW_TAG_unspecified_type: case DW_TAG_volatile_type: case DW_TAG_atomic_type: tag = die__create_new_tag(die, cu); break; + case DW_TAG_unspecified_type: + cu->unspecified_type.tag = + tag = die__create_new_tag(die, cu); break; case DW_TAG_pointer_type: tag = die__create_new_pointer_tag(die, cu, conf); break; case DW_TAG_ptr_to_member_type: @@ -2077,6 +2079,8 @@ static int die__process_unit(Dwarf_Die *die, struct cu *cu, struct conf_load *co cu__hash(cu, tag); struct dwarf_tag *dtag = tag->priv; dtag->small_id = id; + if (tag->tag == DW_TAG_unspecified_type) + cu->unspecified_type.type = id; } while (dwarf_siblingof(die, die) == 0); return 0; @@ -2512,6 +2516,7 @@ static int cu__recode_dwarf_types_table(struct cu *cu, if (tag__recode_dwarf_type(tag, cu)) return -1; } + return 0; } @@ -230,6 +230,10 @@ struct debug_fmt_ops { bool has_alignment_info; }; +/* + * unspecified_type: If this CU has a DW_TAG_unspecified_type, as BTF doesn't have a representation for this + * and thus we need to check functions returning this to convert it to void. + */ struct cu { struct list_head node; struct list_head tags; @@ -238,6 +242,10 @@ struct cu { struct ptr_table functions_table; struct ptr_table tags_table; struct rb_root functions; + struct { + struct tag *tag; + uint32_t type; + } unspecified_type; char *name; char *filename; void *priv; |