[clang] 44eea0b - Revert "[WebAssembly] Add support for DWARF type units"

Derek Schuff via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 27 17:57:55 PDT 2020


Author: Derek Schuff
Date: 2020-10-27T17:57:32-07:00
New Revision: 44eea0b1a7301de4c284afed1c023014c391372f

URL: https://github.com/llvm/llvm-project/commit/44eea0b1a7301de4c284afed1c023014c391372f
DIFF: https://github.com/llvm/llvm-project/commit/44eea0b1a7301de4c284afed1c023014c391372f.diff

LOG: Revert "[WebAssembly] Add support for DWARF type units"

This reverts commit bcb8a119df210753c5f1a3ac346d49597fef0f51.

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Clang.cpp
    clang/test/Driver/debug-options.c
    llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/lib/MC/MCObjectFileInfo.cpp
    llvm/lib/MC/WasmObjectWriter.cpp

Removed: 
    llvm/test/DebugInfo/WebAssembly/dwarf-headers.ll


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 59cf34749bb4..61e367bd835d 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -3989,7 +3989,7 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
 
   if (Args.hasFlag(options::OPT_fdebug_types_section,
                    options::OPT_fno_debug_types_section, false)) {
-    if (!(T.isOSBinFormatELF() || T.isOSBinFormatWasm())) {
+    if (!T.isOSBinFormatELF()) {
       D.Diag(diag::err_drv_unsupported_opt_for_target)
           << Args.getLastArg(options::OPT_fdebug_types_section)
                  ->getAsString(Args)

diff  --git a/clang/test/Driver/debug-options.c b/clang/test/Driver/debug-options.c
index bedc9d044a2c..1be976d9743a 100644
--- a/clang/test/Driver/debug-options.c
+++ b/clang/test/Driver/debug-options.c
@@ -214,9 +214,6 @@
 // RUN: %clang -### -fdebug-types-section -fno-debug-types-section -target x86_64-unknown-linux %s 2>&1 \
 // RUN:        | FileCheck -check-prefix=NOFDTS %s
 //
-// RUN: %clang -### -fdebug-types-section -target wasm32-unknown-unknown %s 2>&1 \
-// RUN:        | FileCheck -check-prefix=FDTS %s
-//
 // RUN: %clang -### -fdebug-types-section -target x86_64-apple-darwin %s 2>&1 \
 // RUN:        | FileCheck -check-prefix=FDTSE %s
 //

diff  --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 859956e6c3a5..e460402e7941 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -394,9 +394,8 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
     UseSectionsAsReferences = DwarfSectionsAsReferences == Enable;
 
   // Don't generate type units for unsupported object file formats.
-  GenerateTypeUnits = (A->TM.getTargetTriple().isOSBinFormatELF() ||
-                       A->TM.getTargetTriple().isOSBinFormatWasm()) &&
-                      GenerateDwarfTypeUnits;
+  GenerateTypeUnits =
+      A->TM.getTargetTriple().isOSBinFormatELF() && GenerateDwarfTypeUnits;
 
   TheAccelTableKind = computeAccelTableKind(
       DwarfVersion, GenerateTypeUnits, DebuggerTuning, A->TM.getTargetTriple());

diff  --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index fcae22c8ce2e..d8ea0a879f2b 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -963,11 +963,9 @@ MCSection *MCObjectFileInfo::getDwarfComdatSection(const char *Name,
   case Triple::ELF:
     return Ctx->getELFSection(Name, ELF::SHT_PROGBITS, ELF::SHF_GROUP, 0,
                               utostr(Hash));
-  case Triple::Wasm:
-    return Ctx->getWasmSection(Name, SectionKind::getMetadata(), utostr(Hash),
-                               MCContext::GenericSectionID);
   case Triple::MachO:
   case Triple::COFF:
+  case Triple::Wasm:
   case Triple::GOFF:
   case Triple::XCOFF:
   case Triple::UnknownObjectFormat:

diff  --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp
index 2f1277eb8110..f81a83d1651c 100644
--- a/llvm/lib/MC/WasmObjectWriter.cpp
+++ b/llvm/lib/MC/WasmObjectWriter.cpp
@@ -1378,6 +1378,9 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
       MCSymbol *Begin = Sec.getBeginSymbol();
       if (Begin) {
         WasmIndices[cast<MCSymbolWasm>(Begin)] = CustomSections.size();
+        if (SectionName != Begin->getName())
+          report_fatal_error("section name and begin symbol should match: " +
+                             Twine(SectionName));
       }
 
       // Separate out the producers and target features sections

diff  --git a/llvm/test/DebugInfo/WebAssembly/dwarf-headers.ll b/llvm/test/DebugInfo/WebAssembly/dwarf-headers.ll
deleted file mode 100644
index a35bbca2cd21..000000000000
--- a/llvm/test/DebugInfo/WebAssembly/dwarf-headers.ll
+++ /dev/null
@@ -1,116 +0,0 @@
-; RUN: llc -dwarf-version=4 -generate-type-units \
-; RUN:     -filetype=obj -O0 -mtriple=wasm32-unknown-unknown < %s \
-; RUN:     | llvm-dwarfdump -v - | FileCheck %s --check-prefix=SINGLE-4
-
-; RUN: llc -split-dwarf-file=foo.dwo -split-dwarf-output=%t.dwo \
-; RUN:     -dwarf-version=4 -generate-type-units \
-; RUN:     -filetype=obj -O0 -mtriple=wasm32-unknown-unknown < %s \
-; 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
-; RUN: llc -dwarf-version=5 -generate-type-units \
-; RUN:     -filetype=obj -O0 -mtriple= < %s \
-; RUN:     | llvm-dwarfdump -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
-
-; Looking for DWARF headers to be generated correctly.
-; There are 8 variants with 5 formats: v4 CU, v4 TU, v5 normal/partial CU,
-; v5 skeleton/split CU, v5 normal/split TU.  Some v5 variants 
diff er only
-; in the unit_type code, and the skeleton/split CU 
diff ers from normal/partial
-; by having one extra field (dwo_id).
-; (v2 thru v4 CUs are all the same, and TUs were invented in v4,
-; so we don't bother checking older versions.)
-
-; Test case built from:
-;struct S {
-;  int s1;
-;};
-;
-;S s;
-
-; Verify the v4 non-split headers.
-; Note that we check the exact offset of the DIEs because that tells us
-; the length of the header.
-;
-; SINGLE-4: .debug_info contents:
-; SINGLE-4: 0x00000000: Compile Unit: {{.*}} version = 0x0004, abbr_offset
-; SINGLE-4: 0x0000000b: DW_TAG_compile_unit
-;
-; SINGLE-4: .debug_types contents:
-; SINGLE-4: 0x00000000: Type Unit: {{.*}} version = 0x0004, abbr_offset
-; SINGLE-4: 0x00000017: DW_TAG_type_unit
-
-; Verify the v4 split headers.
-;
-; O-4: .debug_info contents:
-; O-4: 0x00000000: Compile Unit: {{.*}} version = 0x0004, abbr_offset
-; O-4: 0x0000000b: DW_TAG_compile_unit
-;
-; DWO-4: .debug_info.dwo contents:
-; DWO-4: 0x00000000: Compile Unit: {{.*}} version = 0x0004, abbr_offset
-; DWO-4: 0x0000000b: DW_TAG_compile_unit
-;
-; DWO-4: .debug_types.dwo contents:
-; DWO-4: 0x00000000: Type Unit: {{.*}} version = 0x0004, abbr_offset
-; DWO-4: 0x00000017: DW_TAG_type_unit
-
-; Verify the v5 non-split headers. Type units come first.
-; All .debug_info sections are reported in one go, but the offset resets for
-; each new section.
-;
-; SINGLE-5: .debug_info contents:
-; SINGLE-5: 0x00000000: Type Unit: {{.*}} version = 0x0005, unit_type = DW_UT_type, abbr_offset
-; SINGLE-5: 0x00000018: DW_TAG_type_unit
-; SINGLE-5-NOT: contents:
-; SINGLE-5: 0x00000000: Compile Unit: {{.*}} version = 0x0005, unit_type = DW_UT_compile, abbr_offset
-; SINGLE-5: 0x0000000c: DW_TAG_compile_unit
-
-; Verify the v5 split headers.
-;
-; O-5: .debug_info contents:
-; O-5: 0x00000000: Compile Unit: {{.*}} version = 0x0005, unit_type = DW_UT_skeleton, abbr_offset
-; O-5-SAME:        DWO_id = 0xccd7e58ef8bf4aa6
-; O-5: 0x00000014: DW_TAG_skeleton_unit 
-;
-; DWO-5: .debug_info.dwo contents:
-; DWO-5: 0x00000000: Type Unit: {{.*}} version = 0x0005, unit_type = DW_UT_split_type, abbr_offset
-; DWO-5: 0x00000018: DW_TAG_type_unit
-; DWO-5: 0x00000033: Compile Unit: {{.*}} version = 0x0005, unit_type = DW_UT_split_compile, abbr_offset
-; DWO-5-SAME:        DWO_id = 0xccd7e58ef8bf4aa6
-; DWO-5: 0x00000047: DW_TAG_compile_unit
-
-
-; 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 }
-
- at 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)"}


        


More information about the cfe-commits mailing list