Skip to content

Commit a6d2385

Browse files
[AArch64] Fallback to DWARF when trying to emit compact unwind info with multiple CFA offset adjustments
Instead of asserting, fallback to emitting DWARF unwind info when an attempt is made to output compact unwind info for a function with multiple adjustments to the CFA offset. Multiple adjustments of SP are common and with instruction precise unwind tables these may translate into multiple `.cfi_def_cfa_offset` directives. Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1302998 Reviewed By: dmgreen Differential Revision: https://reviews.llvm.org/D121017
1 parent 9580f95 commit a6d2385

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,8 @@ class DarwinAArch64AsmBackend : public AArch64AsmBackend {
621621
break;
622622
}
623623
case MCCFIInstruction::OpDefCfaOffset: {
624-
assert(StackSize == 0 && "We already have the CFA offset!");
624+
if (StackSize != 0)
625+
return CU::UNWIND_ARM64_MODE_DWARF;
625626
StackSize = std::abs(Inst.getOffset());
626627
break;
627628
}

llvm/test/MC/AArch64/arm64-compact-unwind-fallback.s

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,21 @@
55

66
// CHECK: Contents of __compact_unwind section:
77
// CHECK: compact encoding: 0x03000000
8+
// CHECK: compact encoding: 0x03000000
89

910
// CHECK: .eh_frame contents:
1011
// CHECK: DW_CFA_def_cfa: reg1 +32
1112

12-
_cfi_dwarf:
13+
// DW_CFA_def_cfa_offset: +32
14+
// DW_CFA_def_cfa_offset: +64
15+
16+
_cfi_dwarf0:
1317
.cfi_startproc
1418
.cfi_def_cfa x1, 32;
1519
.cfi_endproc
20+
21+
_cfi_dwarf1:
22+
.cfi_startproc
23+
.cfi_def_cfa_offset 32
24+
.cfi_def_cfa_offset 64
25+
.cfi_endproc

0 commit comments

Comments
 (0)