[llvm] 7a3e664 - [DebugInfo] Do not error on unsupported CIE version
Rafael Auler via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 8 19:52:47 PST 2021
Author: Rafael Auler
Date: 2021-03-08T19:39:08-08:00
New Revision: 7a3e664db5761e27a3cf7d67580f43470f927624
URL: https://github.com/llvm/llvm-project/commit/7a3e664db5761e27a3cf7d67580f43470f927624
DIFF: https://github.com/llvm/llvm-project/commit/7a3e664db5761e27a3cf7d67580f43470f927624.diff
LOG: [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
Added:
Modified:
llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
llvm/test/DebugInfo/X86/eh-frame-invalid-version-zero.s
llvm/test/DebugInfo/X86/eh-frame-invalid-version.s
Removed:
################################################################################
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);
diff --git a/llvm/test/DebugInfo/X86/eh-frame-invalid-version-zero.s b/llvm/test/DebugInfo/X86/eh-frame-invalid-version-zero.s
index 0c773671ddca..92abf1181f60 100644
--- a/llvm/test/DebugInfo/X86/eh-frame-invalid-version-zero.s
+++ b/llvm/test/DebugInfo/X86/eh-frame-invalid-version-zero.s
@@ -1,9 +1,9 @@
## Check we do not support .eh_frame sections of version 0.
# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t
-# RUN: not llvm-dwarfdump -debug-frame %t 2>&1 | FileCheck %s
+# RUN: llvm-dwarfdump -debug-frame %t 2>&1 | FileCheck %s
-# CHECK: unsupported CIE version: 0
+# CHECK: unsupported CIE version
.section .eh_frame,"a", at unwind
.long .Lend - .LCIEptr ## Length
diff --git a/llvm/test/DebugInfo/X86/eh-frame-invalid-version.s b/llvm/test/DebugInfo/X86/eh-frame-invalid-version.s
index c2f7317c9e31..2b41349c98bd 100644
--- a/llvm/test/DebugInfo/X86/eh-frame-invalid-version.s
+++ b/llvm/test/DebugInfo/X86/eh-frame-invalid-version.s
@@ -1,9 +1,9 @@
## Check we do not support .eh_frame sections of versions greater than 1.
# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t
-# RUN: not llvm-dwarfdump -debug-frame %t 2>&1 | FileCheck %s
+# RUN: llvm-dwarfdump -debug-frame %t 2>&1 | FileCheck %s
-# CHECK: unsupported CIE version: 2
+# CHECK: unsupported CIE version
.section .eh_frame,"a", at unwind
.long .Lend - .LCIEptr ## Length
More information about the llvm-commits
mailing list