summaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
diff options
context:
space:
mode:
authorRafael Auler <rafaelauler@fb.com>2021-03-08 19:21:16 -0800
committerRafael Auler <rafaelauler@fb.com>2021-03-08 19:39:08 -0800
commit7a3e664db5761e27a3cf7d67580f43470f927624 (patch)
treeb6adcaaf9a96c19e0d3a0128dd7bbf44e245ed0b /llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
parent5cdb2e98608bf57c216ee7067e8a12d070c9e2bd (diff)
[DebugInfo] Do not error on unsupported CIE version
D81469 introduced a check to error on CIE version different than 1 for eh_frame, but older compilers mistakenly create binaries with this version set to 3 for DWARF4 or 4 to DWARF5. Move the check to dump time instead of eh_frame parse time, so we can be tolerant with older binaries. Reviewed By: aprantl Differential Revision: https://reviews.llvm.org/D97830
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
index 3ff1c0700dd7..b5ec79b615d6 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
@@ -891,8 +891,10 @@ void CIE::dump(raw_ostream &OS, DIDumpOptions DumpOpts,
<< format(" %0*" PRIx64, IsDWARF64 && !IsEH ? 16 : 8,
getCIEId(IsDWARF64, IsEH))
<< " CIE\n"
- << " Format: " << FormatString(IsDWARF64) << "\n"
- << format(" Version: %d\n", Version)
+ << " Format: " << FormatString(IsDWARF64) << "\n";
+ if (IsEH && Version != 1)
+ OS << "WARNING: unsupported CIE version\n";
+ OS << format(" Version: %d\n", Version)
<< " Augmentation: \"" << Augmentation << "\"\n";
if (Version >= 4) {
OS << format(" Address size: %u\n", (uint32_t)AddressSize);
@@ -1012,11 +1014,6 @@ Error DWARFDebugFrame::parse(DWARFDataExtractor Data) {
uint8_t Version = Data.getU8(&Offset);
const char *Augmentation = Data.getCStr(&Offset);
StringRef AugmentationString(Augmentation ? Augmentation : "");
- // TODO: we should provide a way to report a warning and continue dumping.
- if (IsEH && Version != 1)
- return createStringError(errc::not_supported,
- "unsupported CIE version: %" PRIu8, Version);
-
uint8_t AddressSize = Version < 4 ? Data.getAddressSize() :
Data.getU8(&Offset);
Data.setAddressSize(AddressSize);