[PATCH] D50057: [MC] Report fatal error for DWARF types for non-ELF object files

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 31 05:53:25 PDT 2018


JDevlieghere created this revision.
JDevlieghere added reviewers: aprantl, dblaikie, probinson, labath.
JDevlieghere added a project: debug-info.
Herald added subscribers: aheejin, hiraditya.

Getting the DWARF types section is only implemented for ELF object
files. We already disabled emitting debug types in clang (r337717), but
now we also report an fatal error (rather than crashing) when trying to
obtain this section in MC.

See PR38190 for more information.


Repository:
  rL LLVM

https://reviews.llvm.org/D50057

Files:
  llvm/lib/MC/MCObjectFileInfo.cpp


Index: llvm/lib/MC/MCObjectFileInfo.cpp
===================================================================
--- llvm/lib/MC/MCObjectFileInfo.cpp
+++ llvm/lib/MC/MCObjectFileInfo.cpp
@@ -950,8 +950,18 @@
 }
 
 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::ELF:
+    return Ctx->getELFSection(".debug_types", ELF::SHT_PROGBITS, ELF::SHF_GROUP,
+                              0, utostr(Hash));
+  case Triple::MachO:
+  case Triple::COFF:
+  case Triple::Wasm:
+  case Triple::UnknownObjectFormat:
+    report_fatal_error("Cannot get DWARF types section for this object file "
+                       "format: not implemented.");
+    break;
+  }
 }
 
 MCSection *


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50057.158230.patch
Type: text/x-patch
Size: 867 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180731/11377aa9/attachment.bin>


More information about the llvm-commits mailing list