From 41cde465acfddb44d400b0a53bb57960762312a2 Mon Sep 17 00:00:00 2001 From: Daniil Kovalev Date: Thu, 5 Dec 2024 11:34:29 +0300 Subject: [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. --- clang/lib/CodeGen/CodeGenFunction.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp') 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; -- cgit v1.1