Emit unwind information in the .debug_frame section when the .cfi_sections .debug_fra...
authorShubham Sandeep Rastogi <srastogi22@apple.com>
Thu, 8 Dec 2022 18:55:52 +0000 (10:55 -0800)
committerShubham Sandeep Rastogi <srastogi22@apple.com>
Thu, 15 Dec 2022 00:36:02 +0000 (16:36 -0800)
Differential Revision: https://reviews.llvm.org/D139663

llvm/lib/MC/MCDwarf.cpp
llvm/test/DebugInfo/debugframeinfo.s [new file with mode: 0644]

index a3ecebbfa03855910fdab6f5145f4760c088d11b..7d7e790a254cf0c1b1a49ce9c5269d0093e9cfca 100644 (file)
@@ -1860,7 +1860,7 @@ void MCDwarfFrameEmitter::Emit(MCObjectStreamer &Streamer, MCAsmBackend *MAB,
 
   // Emit the compact unwind info if available.
   bool NeedsEHFrameSection = !MOFI->getSupportsCompactUnwindWithoutEHFrame();
-  if (IsEH && MOFI->getCompactUnwindSection()) {
+  if (MOFI->getCompactUnwindSection()) {
     Streamer.generateCompactUnwindEncodings(MAB);
     bool SectionEmitted = false;
     for (const MCDwarfFrameInfo &Frame : FrameArray) {
diff --git a/llvm/test/DebugInfo/debugframeinfo.s b/llvm/test/DebugInfo/debugframeinfo.s
new file mode 100644 (file)
index 0000000..9c39a30
--- /dev/null
@@ -0,0 +1,14 @@
+# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin22.1.0 %s -o %t.o
+# RUN: llvm-dwarfdump -debug-frame %t.o | FileCheck %s
+
+# CHECK: .debug_frame contents:
+# CHECK-EMPTY:
+# CHECK-NEXT: 00000000 00000014 ffffffff CIE
+# CHECK: .eh_frame contents:
+# CHECK-EMPTY:
+
+ .cfi_startproc
+ .cfi_signal_frame
+ .cfi_def_cfa x28, 0x340
+ .cfi_endproc
+ .cfi_sections .debug_frame