[llvm] r331664 - [WebAssembly] Ensure all .debug_XXX section has proper symbol names
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Mon May 7 12:40:50 PDT 2018
Author: sbc
Date: Mon May 7 12:40:50 2018
New Revision: 331664
URL: http://llvm.org/viewvc/llvm-project?rev=331664&view=rev
Log:
[WebAssembly] Ensure all .debug_XXX section has proper symbol names
Updated wasm section symbols names to match section name, and ensure all
referenced sections will have a symbol (per DWARF spec v3, Figure 43)
Patch by Yury Delendik!
Differential Revision: https://reviews.llvm.org/D46543
Modified:
llvm/trunk/lib/MC/MCObjectFileInfo.cpp
llvm/trunk/lib/MC/WasmObjectWriter.cpp
Modified: llvm/trunk/lib/MC/MCObjectFileInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectFileInfo.cpp?rev=331664&r1=331663&r2=331664&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCObjectFileInfo.cpp (original)
+++ llvm/trunk/lib/MC/MCObjectFileInfo.cpp Mon May 7 12:40:50 2018
@@ -870,10 +870,13 @@ void MCObjectFileInfo::initWasmMCObjectF
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());
Modified: llvm/trunk/lib/MC/WasmObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WasmObjectWriter.cpp?rev=331664&r1=331663&r2=331664&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WasmObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/WasmObjectWriter.cpp Mon May 7 12:40:50 2018
@@ -1207,8 +1207,12 @@ void WasmObjectWriter::writeObject(MCAss
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);
}
}
More information about the llvm-commits
mailing list