[PATCH] D100440: [Debug-Info] DW_AT_export_symbols shouldn't be generated before version-5 of DWARF.
EsmeYi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 13 20:25:18 PDT 2021
Esme created this revision.
Esme added reviewers: shchenz, aprantl, dblaikie, jsji, PowerPC.
Herald added a subscriber: hiraditya.
Esme requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
`DW_AT_export_symbols` is an attribute introduced in DWARF-5, which should not be generated under previous DWARF versions. And this unexpected behavior caused the DBX to fail.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D100440
Files:
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/test/DebugInfo/Generic/export-symbol-anonymous-class.ll
Index: llvm/test/DebugInfo/Generic/export-symbol-anonymous-class.ll
===================================================================
--- llvm/test/DebugInfo/Generic/export-symbol-anonymous-class.ll
+++ llvm/test/DebugInfo/Generic/export-symbol-anonymous-class.ll
@@ -38,6 +38,6 @@
!10 = !{!11}
!11 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !9, file: !3, line: 3, baseType: !12, size: 32)
!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
-!14 = !{i32 2, !"Dwarf Version", i32 4}
+!14 = !{i32 2, !"Dwarf Version", i32 5}
!15 = !{i32 2, !"Debug Info Version", i32 3}
!16 = !{!"clang version 10.0.0"}
Index: llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -930,7 +930,7 @@
if (CTy->isAppleBlockExtension())
addFlag(Buffer, dwarf::DW_AT_APPLE_block);
- if (CTy->getExportSymbols())
+ if (CTy->getExportSymbols() && DD->getDwarfVersion() >= 5)
addFlag(Buffer, dwarf::DW_AT_export_symbols);
// This is outside the DWARF spec, but GDB expects a DW_AT_containing_type
@@ -1064,7 +1064,7 @@
Name = "(anonymous namespace)";
DD->addAccelNamespace(*CUNode, Name, NDie);
addGlobalName(Name, NDie, NS->getScope());
- if (NS->getExportSymbols())
+ if (NS->getExportSymbols() && DD->getDwarfVersion() >= 5)
addFlag(NDie, dwarf::DW_AT_export_symbols);
return &NDie;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100440.337322.patch
Type: text/x-patch
Size: 1502 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210414/ef33b40e/attachment.bin>
More information about the llvm-commits
mailing list