* [PATCH 1/1] dwarf_loader: Hash DW_TAG_enumerator entries
@ 2024-07-16 18:43 Arnaldo Carvalho de Melo
0 siblings, 0 replies; only message in thread
From: Arnaldo Carvalho de Melo @ 2024-07-16 18:43 UTC (permalink / raw)
To: Matthias Schwarzott; +Cc: dwarves
As they are referenced by DW_TAG_imported_declaration, as we can see
from these warnings:
⬢[acme@toolbox zzam@gentoo.org]$ pdwtags popup.cpp.o > /dev/null
die__process_class: tag not supported 0x2f (template_type_parameter)!
die__process_class: tag not supported 0x30 (template_value_parameter)!
die__process_class: tag not supported 0x4107 (GNU_template_parameter_pack)!
die__process_function: tag not supported 0x4108 (GNU_formal_parameter_pack)!
tag__recode_dwarf_type: couldn't find 0x5706e type for 0xedb9 (imported_declaration)!
tag__recode_dwarf_type: couldn't find 0x57074 type for 0xedc1 (imported_declaration)!
tag__recode_dwarf_type: couldn't find 0x5707a type for 0xedc9 (imported_declaration)!
namespace__recode_dwarf_types: couldn't find 0x5706e type for 0xedb9 (imported_declaration)!
namespace__recode_dwarf_types: couldn't find 0x57074 type for 0xedc1 (imported_declaration)!
namespace__recode_dwarf_types: couldn't find 0x5707a type for 0xedc9 (imported_declaration)!
⬢[acme@toolbox zzam@gentoo.org]$
Looking at the DWARF info for one of those types not found:
⬢[acme@toolbox zzam@gentoo.org]$ readelf -wi popup.cpp.o | grep -w edb9 -A5
<2><edb9>: Abbrev Number: 14 (DW_TAG_imported_declaration)
<edba> DW_AT_decl_file : 64
<edbb> DW_AT_decl_line : 100
<edbc> DW_AT_decl_column : 20
<edbd> DW_AT_import : <0x5706e> [Abbrev Number: 51 (DW_TAG_enumerator)]
<2><edc1>: Abbrev Number: 14 (DW_TAG_imported_declaration)
⬢[acme@toolbox zzam@gentoo.org]$
And then:
⬢[acme@toolbox zzam@gentoo.org]$ readelf -wi popup.cpp.o | grep -w 5706e -A3
<3><5706e>: Abbrev Number: 51 (DW_TAG_enumerator)
<5706f> DW_AT_name : (indirect string, offset: 0xaec05): _S_single
<57073> DW_AT_const_value : 0
<3><57074>: Abbrev Number: 51 (DW_TAG_enumerator)
⬢[acme@toolbox zzam@gentoo.org]$
So we need to hash those DW_TAG_enumerator and not just the
DW_TAG_enumerator_type containing them.
This way tag__recode_dwarf_type() and namespace__recode_dwarf_types()
will find them when looking them up using dwarf_cu__find_type_by_ref().
This was found first on the stratagus codebase (C++) at
https://github.com/Wargus/stratagus.git.
This didn't generate any difference in output from pahole, not
influenced BTF generation as tested using tests/reproducible_build.sh.
Reported-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
dwarf_loader.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dwarf_loader.c b/dwarf_loader.c
index 2d49960120b56f78..d914b91c1f375f7f 100644
--- a/dwarf_loader.c
+++ b/dwarf_loader.c
@@ -1776,6 +1776,7 @@ static struct tag *die__create_new_enumeration(Dwarf_Die *die, struct cu *cu, st
goto out_delete;
enumeration__add(enumeration, enumerator);
+ cu__hash(cu, &enumerator->tag);
} while (dwarf_siblingof(die, die) == 0);
out:
return &enumeration->namespace.tag;
--
2.45.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-07-16 18:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-16 18:43 [PATCH 1/1] dwarf_loader: Hash DW_TAG_enumerator entries Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).