diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp --- a/llvm/lib/MC/MCObjectFileInfo.cpp +++ b/llvm/lib/MC/MCObjectFileInfo.cpp @@ -974,9 +974,6 @@ return Ctx->getELFSection(Name, ELF::SHT_PROGBITS, ELF::SHF_GROUP, 0, utostr(Hash)); case Triple::Wasm: - // FIXME: When using dwarf 5, the .debug_info section is used for type units - // but that section already exists, so attempting to get it as a comdate - // section triggers an assert. return Ctx->getWasmSection(Name, SectionKind::getMetadata(), utostr(Hash), MCContext::GenericSectionID); case Triple::MachO: diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -749,7 +749,6 @@ if (Index >= Sections.size()) return make_error( "COMDAT section index out of range", object_error::parse_failed); - llvm::errs() << "Index " << Index<<"\n"; if (Sections[Index].Type != wasm::WASM_SEC_CUSTOM) return make_error( "Non-custom section in a COMDAT", object_error::parse_failed); diff --git a/llvm/test/DebugInfo/WebAssembly/dwarf-headers.ll b/llvm/test/DebugInfo/WebAssembly/dwarf-headers.ll --- a/llvm/test/DebugInfo/WebAssembly/dwarf-headers.ll +++ b/llvm/test/DebugInfo/WebAssembly/dwarf-headers.ll @@ -8,17 +8,15 @@ ; RUN: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=O-4 ; RUN: llvm-dwarfdump -v %t.dwo | FileCheck %s --check-prefix=DWO-4 -; TODO: enable testing for dwarf v5 with type units -; (See the FIXME in MCObjectFileInfo::getDwarfComdatSection) -; RU N: llc -dwarf-version=5 -generate-type-units \ -; RU N: -filetype=obj -O0 -mtriple= < %s \ -; RU N: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=SINGLE-5 - -; RU N: llc -split-dwarf-file=foo.dwo -split-dwarf-output=%t.dwo \ -; RU N: -dwarf-version=5 -generate-type-units \ -; RU N: -filetype=obj -O0 -mtriple= < %s \ -; RU N: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=O-5 -; RU N: llvm-dwarfdump -v %t.dwo | FileCheck %s --check-prefix=DWO-5 +; RUN: llc -dwarf-version=5 -generate-type-units \ +; RUN: -filetype=obj -O0 -mtriple= < %s \ +; RUN: | llvm-dwarfdup -v - | FileCheck %s --check-prefix=SINGLE-5 + +; RUN: llc -split-dwarf-file=foo.dwo -split-dwarf-output=%t.dwo \ +; RUN: -dwarf-version=5 -generate-type-units \ +; RUN: -filetype=obj -O0 -mtriple= < %s \ +; RUN: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=O-5 +; RUN: llvm-dwarfdump -v %t.dwo | FileCheck %s --check-prefix=DWO-5 ; This test is derived from test/CodeGen/X86/dwarf-headers.ll diff --git a/llvm/test/MC/WebAssembly/comdat-sections.ll b/llvm/test/MC/WebAssembly/comdat-sections.ll new file mode 100644 --- /dev/null +++ b/llvm/test/MC/WebAssembly/comdat-sections.ll @@ -0,0 +1,37 @@ +; RUN: llc -dwarf-version=4 -generate-type-units \ +; RUN: -filetype=obj -O0 -mtriple=wasm32-unknown-unknown < %s \ +; RUN: | obj2yaml | FileCheck %s + + +; CHECK: Comdats: +; CHECK: - Name: '4721183873463917179' +; CHECK: Entries: +; CHECK: - Kind: SECTION +; CHECK: Index: 3 + +; ModuleID = 't.cpp' +source_filename = "t.cpp" +target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" +target triple = "wasm32-unknown-unknown-wasm" + +%struct.S = type { i32 } + +@s = global %struct.S zeroinitializer, align 4, !dbg !0 + +!llvm.dbg.cu = !{!2} +!llvm.module.flags = !{!10, !11} +!llvm.ident = !{!12} + +!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) +!1 = distinct !DIGlobalVariable(name: "s", scope: !2, file: !3, line: 5, type: !6, isLocal: false, isDefinition: true) +!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 5.0.0 (trunk 295942)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5) +!3 = !DIFile(filename: "t.cpp", directory: "/home/probinson/projects/scratch") +!4 = !{} +!5 = !{!0} +!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !3, line: 1, size: 32, elements: !7, identifier: "_ZTS1S") +!7 = !{!8} +!8 = !DIDerivedType(tag: DW_TAG_member, name: "s1", scope: !6, file: !3, line: 2, baseType: !9, size: 32) +!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!10 = !{i32 2, !"Dwarf Version", i32 4} +!11 = !{i32 2, !"Debug Info Version", i32 3} +!12 = !{!"clang version 5.0.0 (trunk 295942)"}