[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
Fri Apr 16 06:18:58 PDT 2021
Esme updated this revision to Diff 338082.
Esme added a comment.
Herald added subscribers: ormris, nemanjai.
Addressed Zheng's comments.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100440/new/
https://reviews.llvm.org/D100440
Files:
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/test/DebugInfo/PowerPC/export-symbol.ll
Index: llvm/test/DebugInfo/PowerPC/export-symbol.ll
===================================================================
--- llvm/test/DebugInfo/PowerPC/export-symbol.ll
+++ llvm/test/DebugInfo/PowerPC/export-symbol.ll
@@ -0,0 +1,36 @@
+; RUN: %llc_dwarf -O0 -filetype=obj -mtriple=powerpc64le-unknown-linux-gnu < %s | \
+; RUN: llvm-dwarfdump -debug-info - | FileCheck %s
+; RUN: %llc_dwarf -O0 -filetype=obj -mtriple=powerpc64le-unknown-linux-gnu \
+; RUN: -debugger-tune=dbx < %s | llvm-dwarfdump -debug-info - | \
+; RUN: FileCheck %s --check-prefix=DBX
+
+; CHECK: DW_AT_export_symbols (true)
+; DBX-NOT: DW_AT_export_symbols (true)
+
+
+%struct.A = type { %struct.anon }
+%struct.anon = type { i32 }
+
+ at a = dso_local global %struct.A zeroinitializer, align 4, !dbg !0
+
+!llvm.dbg.cu = !{!2}
+!llvm.module.flags = !{!13, !14, !15}
+!llvm.ident = !{!16}
+
+!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
+!1 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !3, line: 6, type: !6, isLocal: false, isDefinition: true)
+!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "XL C/C++ for Linux on Power, (IBM Internal Development Branch), clang version 13.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, splitDebugInlining: false, nameTableKind: None)
+!3 = !DIFile(filename: "1.c", directory: "/home/esme/workspace/build")
+!4 = !{}
+!5 = !{!0}
+!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !3, line: 2, size: 32, elements: !7)
+!7 = !{!8}
+!8 = !DIDerivedType(tag: DW_TAG_member, scope: !6, file: !3, line: 3, baseType: !9, size: 32)
+!9 = distinct !DICompositeType(tag: DW_TAG_structure_type, scope: !6, file: !3, line: 3, size: 32, elements: !10)
+!10 = !{!11}
+!11 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !9, file: !3, line: 4, baseType: !12, size: 32)
+!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!13 = !{i32 7, !"Dwarf Version", i32 4}
+!14 = !{i32 2, !"Debug Info Version", i32 3}
+!15 = !{i32 1, !"wchar_size", i32 4}
+!16 = !{!"XL C/C++ for Linux on Power, (IBM Internal Development Branch), clang version 13.0.0"}
Index: llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -930,7 +930,8 @@
if (CTy->isAppleBlockExtension())
addFlag(Buffer, dwarf::DW_AT_APPLE_block);
- if (CTy->getExportSymbols())
+ if (CTy->getExportSymbols() &&
+ ((!DD->tuneForDBX() || 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 +1065,8 @@
Name = "(anonymous namespace)";
DD->addAccelNamespace(*CUNode, Name, NDie);
addGlobalName(Name, NDie, NS->getScope());
- if (NS->getExportSymbols())
+ if (NS->getExportSymbols() &&
+ (!DD->tuneForDBX() || DD->getDwarfVersion() >= 5))
addFlag(NDie, dwarf::DW_AT_export_symbols);
return &NDie;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100440.338082.patch
Type: text/x-patch
Size: 3123 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210416/dc2b97ef/attachment-0001.bin>
More information about the llvm-commits
mailing list