summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCObjectFileInfo.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-08-01 12:53:06 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-08-01 12:53:06 +0000
commit8acb74e01f1095f028bb19d3cd157687ddf173cc (patch)
tree3981de30ab746bdad08cb14482be2bd4d0894e01 /llvm/lib/MC/MCObjectFileInfo.cpp
parent59dad0f7cd90fc2d19ffcc98a3cb8f7b7d715609 (diff)
downloadbcm5719-llvm-8acb74e01f1095f028bb19d3cd157687ddf173cc.tar.gz
bcm5719-llvm-8acb74e01f1095f028bb19d3cd157687ddf173cc.zip
[MC] Report fatal error for DWARF types for non-ELF object files
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. Additionally we ignore the generate debug types flag for unsupported target triples. See PR38190 for more information. Differential revision: https://reviews.llvm.org/D50057 llvm-svn: 338527
Diffstat (limited to 'llvm/lib/MC/MCObjectFileInfo.cpp')
-rw-r--r--llvm/lib/MC/MCObjectFileInfo.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index 29d34a8c1e3..d42231264da 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -950,8 +950,18 @@ void MCObjectFileInfo::InitMCObjectFileInfo(const Triple &TheTriple, bool PIC,
}
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 *
OpenPOWER on IntegriCloud