[llvm] [ARM] Apply sign-return-address attribute to outlined function (PR #107877)
Benson Chu via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 9 08:21:35 PDT 2024
https://github.com/pestctrl created https://github.com/llvm/llvm-project/pull/107877
This make checking for whether PAC is necessary simpler when building the outlined frame.
>From 006ad779ec1811edae0adc79da76ac02a610ee5e 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 | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
index 0921e364498186..bad963fa8bb5ff 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,8 @@ 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