Skip to content

Commit 1aed342

Browse files
committed
fixup! [PAuthLR] Add support for FEAT_PAuth_LR's DWARF frame instruction
Formatting Fixes
1 parent 6f5bcf8 commit 1aed342

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

llvm/include/llvm/MC/MCDwarf.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,6 @@ class MCCFIInstruction {
649649
return MCCFIInstruction(OpNegateRAStateWithPC, L, 0, INT64_C(0), Loc);
650650
}
651651

652-
653652
/// .cfi_restore says that the rule for Register is now the same as it
654653
/// was at the beginning of the function, after all initial instructions added
655654
/// by .cfi_startproc were executed.

llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -668,26 +668,26 @@ Error UnwindTable::parseRows(const CFIProgram &CFIP, UnwindRow &Row,
668668
break;
669669

670670
case dwarf::DW_CFA_AARCH64_negate_ra_state_with_pc: {
671-
constexpr uint32_t AArch64DWARFPAuthRaState = 34;
672-
auto LRLoc = Row.getRegisterLocations().getRegisterLocation(
673-
AArch64DWARFPAuthRaState);
674-
if (LRLoc) {
675-
if (LRLoc->getLocation() == UnwindLocation::Constant) {
676-
// Toggle the constant value of bits[1:0] from 0 to 1 or 1 to 0.
677-
LRLoc->setConstant(LRLoc->getConstant() ^ 0x3);
678-
} else {
679-
return createStringError(
680-
errc::invalid_argument,
681-
"%s encountered when existing rule for this register is not "
682-
"a constant",
683-
CFIP.callFrameString(Inst.Opcode).str().c_str());
684-
}
671+
constexpr uint32_t AArch64DWARFPAuthRaState = 34;
672+
auto LRLoc = Row.getRegisterLocations().getRegisterLocation(
673+
AArch64DWARFPAuthRaState);
674+
if (LRLoc) {
675+
if (LRLoc->getLocation() == UnwindLocation::Constant) {
676+
// Toggle the constant value of bits[1:0] from 0 to 1 or 1 to 0.
677+
LRLoc->setConstant(LRLoc->getConstant() ^ 0x3);
685678
} else {
686-
Row.getRegisterLocations().setRegisterLocation(
687-
AArch64DWARFPAuthRaState, UnwindLocation::createIsConstant(0x3));
679+
return createStringError(
680+
errc::invalid_argument,
681+
"%s encountered when existing rule for this register is not "
682+
"a constant",
683+
CFIP.callFrameString(Inst.Opcode).str().c_str());
688684
}
689-
break;
685+
} else {
686+
Row.getRegisterLocations().setRegisterLocation(
687+
AArch64DWARFPAuthRaState, UnwindLocation::createIsConstant(0x3));
690688
}
689+
break;
690+
}
691691

692692
case dwarf::DW_CFA_undefined: {
693693
llvm::Expected<uint64_t> RegNum = Inst.getOperandAsUnsigned(CFIP, 0);

llvm/lib/Target/AArch64/AArch64PointerAuth.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,15 @@ void AArch64PointerAuth::authenticateLR(
224224
TII->get(UseBKey ? AArch64::AUTIBSPPCi : AArch64::AUTIASPPCi))
225225
.addSym(PACSym)
226226
.setMIFlag(MachineInstr::FrameDestroy);
227-
emitPACCFI(*Subtarget, MBB, MBBI, DL, MachineInstr::FrameDestroy, EmitAsyncCFI);
227+
emitPACCFI(*Subtarget, MBB, MBBI, DL, MachineInstr::FrameDestroy,
228+
EmitAsyncCFI);
228229
} else {
229230
BuildPACM(*Subtarget, MBB, MBBI, DL, MachineInstr::FrameDestroy, PACSym);
230231
BuildMI(MBB, MBBI, DL,
231232
TII->get(UseBKey ? AArch64::AUTIBSP : AArch64::AUTIASP))
232233
.setMIFlag(MachineInstr::FrameDestroy);
233-
emitPACCFI(*Subtarget, MBB, MBBI, DL, MachineInstr::FrameDestroy, EmitAsyncCFI);
234+
emitPACCFI(*Subtarget, MBB, MBBI, DL, MachineInstr::FrameDestroy,
235+
EmitAsyncCFI);
234236
}
235237

236238
if (NeedsWinCFI) {

0 commit comments

Comments
 (0)