[PATCH] D71156: [WebAssembly] Don't crash when gnu-style pubnames are requested
Keno Fischer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 6 16:44:05 PST 2019
loladiro created this revision.
loladiro added reviewers: sbc100, vchuravy.
Herald added subscribers: sunfish, aheejin, hiraditya, jgravelle-google, dschuff.
Herald added a project: LLVM.
Julia started emitting these after upgrading to LLVM8, causing crashes
in LLVM when targetting WebAssembly. I'm not entirely convinced that
these sections are useful for WebAssembly since the wasm debugging
story isn't entirely fleshed out yet, but at least we shouldn't crash
here while we figure out the right answer.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D71156
Files:
llvm/lib/MC/MCObjectFileInfo.cpp
llvm/test/DebugInfo/WebAssembly/gnu-public-names-tu.ll
Index: llvm/test/DebugInfo/WebAssembly/gnu-public-names-tu.ll
===================================================================
--- /dev/null
+++ llvm/test/DebugInfo/WebAssembly/gnu-public-names-tu.ll
@@ -0,0 +1,39 @@
+; RUN: llc -mtriple=wasm32-unknown-unknown -generate-type-units -filetype=obj < %s | llvm-dwarfdump -v - | FileCheck %s
+
+; Generated from:
+
+; namespace ns {
+; struct foo {
+; };
+; }
+; struct bar {
+; ns::foo f;
+; };
+; bar b;
+
+; CHECK-LABEL: .debug_gnu_pubnames contents:
+; CHECK-LABEL: debug_gnu_pubtypes contents:
+
+%struct.bar = type { %"struct.ns::foo" }
+%"struct.ns::foo" = type { i8 }
+
+ at b = global %struct.bar zeroinitializer, align 1, !dbg !0
+
+!llvm.dbg.cu = !{!2}
+!llvm.module.flags = !{!11, !12}
+!llvm.ident = !{!13}
+
+!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
+!1 = distinct !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 8, type: !6, isLocal: false, isDefinition: true)
+!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 5.0.0 (trunk 293904) (llvm/trunk 293908)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: GNU)
+!3 = !DIFile(filename: "type.cpp", directory: "/tmp/dbginfo")
+!4 = !{}
+!5 = !{!0}
+!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "bar", file: !3, line: 5, size: 8, elements: !7, identifier: "_ZTS3bar")
+!7 = !{!8}
+!8 = !DIDerivedType(tag: DW_TAG_member, name: "f", scope: !6, file: !3, line: 6, baseType: !9, size: 8)
+!9 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "foo", scope: !10, file: !3, line: 2, size: 8, elements: !4, identifier: "_ZTSN2ns3fooE")
+!10 = !DINamespace(name: "ns", scope: null)
+!11 = !{i32 2, !"Dwarf Version", i32 4}
+!12 = !{i32 2, !"Debug Info Version", i32 3}
+!13 = !{!"clang version 5.0.0 (trunk 293904) (llvm/trunk 293908)"}
Index: llvm/lib/MC/MCObjectFileInfo.cpp
===================================================================
--- llvm/lib/MC/MCObjectFileInfo.cpp
+++ llvm/lib/MC/MCObjectFileInfo.cpp
@@ -758,6 +758,8 @@
DwarfFrameSection = Ctx->getWasmSection(".debug_frame", SectionKind::getMetadata());
DwarfPubNamesSection = Ctx->getWasmSection(".debug_pubnames", SectionKind::getMetadata());
DwarfPubTypesSection = Ctx->getWasmSection(".debug_pubtypes", SectionKind::getMetadata());
+ DwarfGnuPubNamesSection = Ctx->getWasmSection(".debug_gnu_pubnames", SectionKind::getMetadata());
+ DwarfGnuPubTypesSection = Ctx->getWasmSection(".debug_gnu_pubtypes", SectionKind::getMetadata());
// Wasm use data section for LSDA.
// TODO Consider putting each function's exception table in a separate
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71156.232677.patch
Type: text/x-patch
Size: 2694 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191207/cdbf983c/attachment.bin>
More information about the llvm-commits
mailing list