aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorDaniil Kovalev <dkovalev@accesssoftek.com>2024-12-05 11:34:29 +0300
committerGitHub <noreply@github.com>2024-12-05 11:34:29 +0300
commit41cde465acfddb44d400b0a53bb57960762312a2 (patch)
tree8711f8e0eff2d0f0d0e01afab44a48f212b02cc6 /clang/lib/CodeGen/CodeGenFunction.cpp
parentfd3907ccb583df99e9c19d2fe84e4e7c52d75de9 (diff)
downloadllvm-41cde465acfddb44d400b0a53bb57960762312a2.zip
llvm-41cde465acfddb44d400b0a53bb57960762312a2.tar.gz
llvm-41cde465acfddb44d400b0a53bb57960762312a2.tar.bz2
[PAC][Driver] Add `-faarch64-jump-table-hardening` flag (#113149)
The flag is placed together with pointer authentication flags since they serve the same security purpose of protecting against attacks on control flow. The flag is not ABI-affecting and might be enabled separately if needed, but it's also intended to be enabled as part of pauth-enabled environments (e.g. pauthtest). See also codegen implementation #97666.
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 f8138e9..2bc10cd 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -899,6 +899,8 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
Fn->addFnAttr("ptrauth-auth-traps");
if (CodeGenOpts.PointerAuth.IndirectGotos)
Fn->addFnAttr("ptrauth-indirect-gotos");
+ if (CodeGenOpts.PointerAuth.AArch64JumpTableHardening)
+ Fn->addFnAttr("aarch64-jump-table-hardening");
// Apply xray attributes to the function (as a string, for now)
bool AlwaysXRayAttr = false;