[PATCH] D115325: [DWARF] Fix PR51087 Extraneous enum record in DWARF with type units
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 23 20:51:51 PST 2021
dblaikie added a comment.
Seems to have broken some ThinLTO+Split DWARF situation, as follows:
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!18}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, emissionKind: FullDebug, enums: !2, nameTableKind: GNU)
!1 = !DIFile(filename: "x.cc", directory: "/proc/self/cwd")
!2 = !{!3}
!3 = distinct !DICompositeType(tag: DW_TAG_enumeration_type, name: "E", baseType: !8, size: 64, flags: DIFlagEnumClass, elements: !9, identifier: "_Z1E")
!8 = !DIBasicType(name: "unsigned long", size: 64, encoding: DW_ATE_unsigned)
!9 = !{}
!18 = !{i32 2, !"Debug Info Version", i32 3}
Built with:
llc test.ll -split-dwarf-file=out.dwo -generate-type-units
This will produce an invalid `.debug_gnu_pubnames` with 0 offset values (`.long 0 # DIE offset`), or, if you apply this patch (this patch isn't perfectly clean for the codebase just yet - I need to cleanup one other mistake - but for the purpose of testing this patch it'll give a good signal as to where things have gone wrong), it'll assert:
diff --git llvm/include/llvm/CodeGen/DIE.h llvm/include/llvm/CodeGen/DIE.h
index 9e94c401bfae..60bd52ee4032 100644
--- llvm/include/llvm/CodeGen/DIE.h
+++ llvm/include/llvm/CodeGen/DIE.h
@@ -774,7 +774,10 @@ public:
unsigned getAbbrevNumber() const { return AbbrevNumber; }
dwarf::Tag getTag() const { return Tag; }
/// Get the compile/type unit relative offset of this DIE.
- unsigned getOffset() const { return Offset; }
+ unsigned getOffset() const {
+ assert(Offset && "Offset being queried before it's been computed.");
+ return Offset;
+ }
unsigned getSize() const { return Size; }
bool hasChildren() const { return ForceChildren || !Children.empty(); }
void setForceChildren(bool B) { ForceChildren = B; }
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115325/new/
https://reviews.llvm.org/D115325
More information about the llvm-commits
mailing list