[llvm] [ARM] Apply sign-return-address attribute to outlined function (PR #107877)
Benson Chu via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 23 08:51:11 PDT 2024
https://github.com/pestctrl updated https://github.com/llvm/llvm-project/pull/107877
>From 0b327694440f64f497eca9ca7754ff0b80798a5d Mon Sep 17 00:00:00 2001
From: Benson Chu <bensonchu457 at gmail.com>
Date: Fri, 6 Sep 2024 16:09:12 -0500
Subject: [PATCH] [ARM] Apply sign-return-address attribute to outlined
function
This make checking for whether PAC is necessary simpler when building
the outlined frame.
---
llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
index 51a5f895f341db..49d1f02a2f6913 100644
--- a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
@@ -6207,6 +6207,9 @@ void ARMBaseInstrInfo::mergeOutliningCandidateAttributes(
if (CFn.hasFnAttribute("branch-target-enforcement"))
F.addFnAttr(CFn.getFnAttribute("branch-target-enforcement"));
+ if (CFn.hasFnAttribute("sign-return-address"))
+ F.addFnAttr(CFn.getFnAttribute("sign-return-address"));
+
ARMGenInstrInfo::mergeOutliningCandidateAttributes(F, Candidates);
}
@@ -6623,10 +6626,7 @@ void ARMBaseInstrInfo::buildOutlinedFrame(
MBB.addLiveIn(ARM::LR);
// Insert a save before the outlined region
- bool Auth = OF.Candidates.front()
- .getMF()
- ->getInfo<ARMFunctionInfo>()
- ->shouldSignReturnAddress(true);
+ bool Auth = MF.getInfo<ARMFunctionInfo>()->shouldSignReturnAddress(true);
saveLROnStack(MBB, It, true, Auth);
// Fix up the instructions in the range, since we're going to modify the
More information about the llvm-commits
mailing list