Skip to content

Commit 24009d1

Browse files
committed
dwarf_loader: Hash DW_TAG_enumerator entries
As they are referenced by DW_TAG_imported_declaration, as we can see from these warnings: ⬢[acme@toolbox [email protected]]$ 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 [email protected]]$ Looking at the DWARF info for one of those types not found: ⬢[acme@toolbox [email protected]]$ 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 [email protected]]$ And then: ⬢[acme@toolbox [email protected]]$ 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 [email protected]]$ 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 <[email protected]> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 693522e commit 24009d1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

dwarf_loader.c

+1
Original file line numberDiff line numberDiff line change
@@ -1776,6 +1776,7 @@ static struct tag *die__create_new_enumeration(Dwarf_Die *die, struct cu *cu, st
17761776
goto out_delete;
17771777

17781778
enumeration__add(enumeration, enumerator);
1779+
cu__hash(cu, &enumerator->tag);
17791780
} while (dwarf_siblingof(die, die) == 0);
17801781
out:
17811782
return &enumeration->namespace.tag;

0 commit comments

Comments
 (0)