aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.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/Frontend/CompilerInvocation.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/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 4dbb13f..4370342 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1511,13 +1511,15 @@ void CompilerInvocation::setDefaultPointerAuthOptions(
}
}
Opts.IndirectGotos = LangOpts.PointerAuthIndirectGotos;
+ Opts.ReturnAddresses = LangOpts.PointerAuthReturns;
}
static void parsePointerAuthOptions(PointerAuthOptions &Opts,
const LangOptions &LangOpts,
const llvm::Triple &Triple,
DiagnosticsEngine &Diags) {
- if (!LangOpts.PointerAuthCalls && !LangOpts.PointerAuthIndirectGotos)
+ if (!LangOpts.PointerAuthCalls && !LangOpts.PointerAuthIndirectGotos &&
+ !LangOpts.PointerAuthReturns)
return;
CompilerInvocation::setDefaultPointerAuthOptions(Opts, LangOpts, Triple);