diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2025-07-15 19:01:00 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-15 19:01:00 +0900 |
commit | 92501396b42411d404729608d0456c9c29b06386 (patch) | |
tree | 105b3dc5654c49ac16cbd7a6ce30d3be0bbaf868 /llvm/lib/CodeGen/SafeStack.cpp | |
parent | a64bfd8a5186bc5b967878689509db81b9d1922c (diff) | |
download | llvm-92501396b42411d404729608d0456c9c29b06386.zip llvm-92501396b42411d404729608d0456c9c29b06386.tar.gz llvm-92501396b42411d404729608d0456c9c29b06386.tar.bz2 |
SafeStack: Emit __safestack_pointer_address call through RuntimeLibcalls (#147916)
Stop using hardcoded function named and check availability. This only fixes
the forced usage via command line in the pass itself; the implementations
inside of TargetLoweringBase hide additional call emission.
Diffstat (limited to 'llvm/lib/CodeGen/SafeStack.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SafeStack.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SafeStack.cpp b/llvm/lib/CodeGen/SafeStack.cpp index a6c1a76..9962070 100644 --- a/llvm/lib/CodeGen/SafeStack.cpp +++ b/llvm/lib/CodeGen/SafeStack.cpp @@ -799,8 +799,16 @@ bool SafeStack::run() { IRB.SetCurrentDebugLocation( DILocation::get(SP->getContext(), SP->getScopeLine(), 0, SP)); if (SafeStackUsePointerAddress) { + const char *SafestackPointerAddressName = + TL.getLibcallName(RTLIB::SAFESTACK_POINTER_ADDRESS); + if (!SafestackPointerAddressName) { + F.getContext().emitError( + "no libcall available for safestack pointer address"); + return false; + } + FunctionCallee Fn = F.getParent()->getOrInsertFunction( - "__safestack_pointer_address", IRB.getPtrTy(0)); + SafestackPointerAddressName, IRB.getPtrTy(0)); UnsafeStackPtr = IRB.CreateCall(Fn); } else { UnsafeStackPtr = TL.getSafeStackPointerLocation(IRB); |