[PATCH] D157036: Emit a .debug_str_offsets section with dsymutil to support DW_FORM_strx in dsymutil.
Alexey Lapshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 4 03:48:30 PDT 2023
avl added inline comments.
================
Comment at: llvm/lib/DWARFLinker/DWARFLinker.cpp:1063
Info.MangledName = StringEntry;
-
+ if (AttrSpec.Form == dwarf::DW_FORM_strx ||
+ (AttrSpec.Form >= dwarf::DW_FORM_strx1 &&
----------------
I would suggest to use DwarfVersion as a sign of which resulting form would be used:
```
if (DwarfVersion >= 5) {
// Switch everything to DW_FORM_strx strings.
auto StringOffsetIndex =
StringOffsetPool.getValueIndex(StringEntry.getOffset());
return Die
.addValue(DIEAlloc, AttrSpec.Attr,
dwarf::DW_FORM_strx, DIEInteger(StringOffsetIndex))
->sizeOf(U.getFormParams());
}
// Switch everything to DW_FORM_strp strings.
return Die
.addValue(DIEAlloc, AttrSpec.Attr,
dwarf::DW_FORM_strp, DIEInteger(StringEntry.getOffset()))
->sizeOf(U.getFormParams());
```
This allows to save more space if original CU is of 5 version but uses DW_FORM_strp forms. Also it would allow to simplify patch by removing StrxFoundInCU and AttrStrOffsetBaseSeen flags.
Though we would need to pay attention to the case when original CU of 5 dwarf version does not have DW_AT_str_offsets_base because it uses DW_FORM_strp forms. We would need to add DW_AT_str_offsets_base in that case.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157036/new/
https://reviews.llvm.org/D157036
More information about the llvm-commits
mailing list