aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorAhmed Bougacha <ahmed@bougacha.org>2024-08-09 11:49:50 -0700
committerGitHub <noreply@github.com>2024-08-09 11:49:50 -0700
commit2eb6e30fe83ccce3cf01e596e73fa6385facd44b (patch)
treec1f1bd37244974aea4108f2e4b981f0db4ae3bf4 /clang/lib/CodeGen/CodeGenFunction.cpp
parentca7ad38ca0d241658da04bcfa63598b5519026f2 (diff)
downloadllvm-2eb6e30fe83ccce3cf01e596e73fa6385facd44b.zip
llvm-2eb6e30fe83ccce3cf01e596e73fa6385facd44b.tar.gz
llvm-2eb6e30fe83ccce3cf01e596e73fa6385facd44b.tar.bz2
[clang] Wire -fptrauth-returns to "ptrauth-returns" fn attribute. (#102416)
We already ended up with -fptrauth-returns, the feature macro, the lang opt, and the actual backend lowering. The only part left is threading it all through PointerAuthOptions, to drive the addition of the "ptrauth-returns" attribute to generated functions. While there, do minor cleanup on ptrauth-function-attributes.c. This also adds ptrauth_key_return_address to ptrauth.h.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index af20155..4dc57d0 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -880,6 +880,8 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
// Add pointer authentication attributes.
const CodeGenOptions &CodeGenOpts = CGM.getCodeGenOpts();
+ if (CodeGenOpts.PointerAuth.ReturnAddresses)
+ Fn->addFnAttr("ptrauth-returns");
if (CodeGenOpts.PointerAuth.FunctionPointers)
Fn->addFnAttr("ptrauth-calls");
if (CodeGenOpts.PointerAuth.IndirectGotos)