[PATCH] D81469: [DebugInfo/DWARF] - Report .eh_frame sections of version != 1.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 16 06:04:44 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG66fb3c39cbc6: [DebugInfo/DWARF] - Report .eh_frame sections of version != 1. (authored by grimar).

Changed prior to commit:
  https://reviews.llvm.org/D81469?vs=269535&id=271071#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81469/new/

https://reviews.llvm.org/D81469

Files:
  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


Index: llvm/test/DebugInfo/X86/eh-frame-invalid-version.s
===================================================================
--- /dev/null
+++ llvm/test/DebugInfo/X86/eh-frame-invalid-version.s
@@ -0,0 +1,13 @@
+## 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
+
+# CHECK: unsupported CIE version: 2
+
+.section .eh_frame,"a", at unwind
+ .long .Lend - .LCIEptr ## Length
+.LCIEptr:
+ .long 0x00000000       ## CIE ID
+ .byte 2                ## Version
+.Lend:
Index: llvm/test/DebugInfo/X86/eh-frame-invalid-version-zero.s
===================================================================
--- /dev/null
+++ llvm/test/DebugInfo/X86/eh-frame-invalid-version-zero.s
@@ -0,0 +1,13 @@
+## 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
+
+# CHECK: unsupported CIE version: 0
+
+.section .eh_frame,"a", at unwind
+ .long .Lend - .LCIEptr ## Length
+.LCIEptr:
+ .long 0x00000000       ## CIE ID
+ .byte 0                ## Version
+.Lend:
Index: llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
@@ -415,6 +415,11 @@
       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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81469.271071.patch
Type: text/x-patch
Size: 2069 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200616/6b42e2df/attachment.bin>


More information about the llvm-commits mailing list