[PATCH] D49472: [WIP] Always create a MCFragment for Mach-O section.
Jonas Devlieghere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 18 03:56:54 PDT 2018
JDevlieghere created this revision.
Herald added subscribers: aheejin, hiraditya.
https://bugs.llvm.org/show_bug.cgi?id=38190
https://reviews.llvm.org/D49472
Files:
llvm/lib/MC/MCContext.cpp
llvm/lib/MC/MCObjectFileInfo.cpp
Index: llvm/lib/MC/MCObjectFileInfo.cpp
===================================================================
--- llvm/lib/MC/MCObjectFileInfo.cpp
+++ llvm/lib/MC/MCObjectFileInfo.cpp
@@ -950,8 +950,27 @@
}
MCSection *MCObjectFileInfo::getDwarfTypesSection(uint64_t Hash) const {
- return Ctx->getELFSection(".debug_types", ELF::SHT_PROGBITS, ELF::SHF_GROUP,
- 0, utostr(Hash));
+ switch (TT.getObjectFormat()) {
+ case Triple::MachO:
+ return Ctx->getMachOSection("__DWARF", "__debug_types", MachO::S_ATTR_DEBUG,
+ SectionKind::getMetadata(),
+ "debug_types_begin");
+ case Triple::COFF:
+
+ return Ctx->getCOFFSection(".debug_types",
+ COFF::IMAGE_SCN_MEM_DISCARDABLE |
+ COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
+ COFF::IMAGE_SCN_MEM_READ,
+ SectionKind::getMetadata(), "debug_types");
+ case Triple::ELF:
+ return Ctx->getELFSection(".debug_types", ELF::SHT_PROGBITS, ELF::SHF_GROUP,
+ 0, utostr(Hash));
+ case Triple::Wasm:
+ return Ctx->getWasmSection(".debug_info", SectionKind::getMetadata());
+ case Triple::UnknownObjectFormat:
+ report_fatal_error("DWARF types section for unknown object file format.");
+ break;
+ }
}
MCSection *
Index: llvm/lib/MC/MCContext.cpp
===================================================================
--- llvm/lib/MC/MCContext.cpp
+++ llvm/lib/MC/MCContext.cpp
@@ -294,8 +294,16 @@
Begin = createTempSymbol(BeginSymName, false);
// Otherwise, return a new section.
- return Entry = new (MachOAllocator.Allocate()) MCSectionMachO(
+ auto Result = new (MachOAllocator.Allocate()) MCSectionMachO(
Segment, Section, TypeAndAttributes, Reserved2, Kind, Begin);
+
+ auto *F = new MCDataFragment();
+ Result->getFragmentList().insert(Result->begin(), F);
+ F->setParent(Result);
+ if (Begin)
+ Begin->setFragment(F);
+
+ return Result;
}
void MCContext::renameELFSection(MCSectionELF *Section, StringRef Name) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49472.156039.patch
Type: text/x-patch
Size: 2161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180718/667f22b5/attachment.bin>
More information about the llvm-commits
mailing list