diff options
author | Ahmed Bougacha <ahmed@bougacha.org> | 2024-08-09 12:32:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-09 12:32:01 -0700 |
commit | d179acd0484bac30c5ebbbed4d29a4734d92ac93 (patch) | |
tree | 5aaf43122e6fc2f03ee3c932dfd771f7ccecd440 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 22cce65464e4be60554de1af95794766eeb1f63a (diff) | |
download | llvm-d179acd0484bac30c5ebbbed4d29a4734d92ac93.zip llvm-d179acd0484bac30c5ebbbed4d29a4734d92ac93.tar.gz llvm-d179acd0484bac30c5ebbbed4d29a4734d92ac93.tar.bz2 |
[clang] Implement -fptrauth-auth-traps. (#102417)
This provides -fptrauth-auth-traps, which at the frontend level only
controls the addition of the "ptrauth-auth-traps" function attribute.
The attribute in turn controls various aspects of backend codegen, by
providing the guarantee that every "auth" operation generated will trap
on failure.
This can either be delegated to the hardware (if AArch64 FPAC is known
to be available), in which case this attribute doesn't change codegen.
Otherwise, if FPAC isn't available, this asks the backend to emit
additional instructions to check and trap on auth failure.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 4dc57d0..2b2e23f 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -884,6 +884,8 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, Fn->addFnAttr("ptrauth-returns"); if (CodeGenOpts.PointerAuth.FunctionPointers) Fn->addFnAttr("ptrauth-calls"); + if (CodeGenOpts.PointerAuth.AuthTraps) + Fn->addFnAttr("ptrauth-auth-traps"); if (CodeGenOpts.PointerAuth.IndirectGotos) Fn->addFnAttr("ptrauth-indirect-gotos"); |