[PATCH] D46543: [WebAssembly] Ensure all .debug_XXX section has proper symbol names

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 7 12:44:40 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL331664: [WebAssembly] Ensure all .debug_XXX section has proper symbol names (authored by sbc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D46543?vs=145515&id=145518#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D46543

Files:
  llvm/trunk/lib/MC/MCObjectFileInfo.cpp
  llvm/trunk/lib/MC/WasmObjectWriter.cpp


Index: llvm/trunk/lib/MC/WasmObjectWriter.cpp
===================================================================
--- llvm/trunk/lib/MC/WasmObjectWriter.cpp
+++ llvm/trunk/lib/MC/WasmObjectWriter.cpp
@@ -1207,8 +1207,12 @@
         Name = Name.substr(strlen(".custom_section."));
 
       MCSymbol* Begin = Sec.getBeginSymbol();
-      if (Begin)
+      if (Begin) {
         WasmIndices[cast<MCSymbolWasm>(Begin)] = CustomSections.size();
+        if (Name != Begin->getName())
+          report_fatal_error("section name and begin symbol should match: " +
+                             Twine(Name));
+      }
       CustomSections.emplace_back(Name, &Section);
     }
   }
Index: llvm/trunk/lib/MC/MCObjectFileInfo.cpp
===================================================================
--- llvm/trunk/lib/MC/MCObjectFileInfo.cpp
+++ llvm/trunk/lib/MC/MCObjectFileInfo.cpp
@@ -870,10 +870,13 @@
   DwarfLineStrSection =
       Ctx->getWasmSection(".debug_line_str", SectionKind::getMetadata());
   DwarfStrSection = Ctx->getWasmSection(".debug_str", SectionKind::getMetadata(), ".debug_str");
-  DwarfLocSection = Ctx->getWasmSection(".debug_loc", SectionKind::getMetadata());
-  DwarfAbbrevSection = Ctx->getWasmSection(".debug_abbrev", SectionKind::getMetadata(), ".section_abbrev");
+  DwarfLocSection = Ctx->getWasmSection(
+      ".debug_loc", SectionKind::getMetadata(), ".debug_loc");
+  DwarfAbbrevSection = Ctx->getWasmSection(
+      ".debug_abbrev", SectionKind::getMetadata(), ".debug_abbrev");
   DwarfARangesSection = Ctx->getWasmSection(".debug_aranges", SectionKind::getMetadata());
-  DwarfRangesSection = Ctx->getWasmSection(".debug_ranges", SectionKind::getMetadata(), ".debug_range");
+  DwarfRangesSection = Ctx->getWasmSection(
+      ".debug_ranges", SectionKind::getMetadata(), ".debug_ranges");
   DwarfMacinfoSection = Ctx->getWasmSection(".debug_macinfo", SectionKind::getMetadata(), ".debug_macinfo");
   DwarfAddrSection = Ctx->getWasmSection(".debug_addr", SectionKind::getMetadata());
   DwarfCUIndexSection = Ctx->getWasmSection(".debug_cu_index", SectionKind::getMetadata());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46543.145518.patch
Type: text/x-patch
Size: 2111 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180507/758058f4/attachment.bin>


More information about the llvm-commits mailing list