From f10a90587f044e134d470ca1ab56d8f244f25336 Mon Sep 17 00:00:00 2001 From: Anatoly Trosinenko Date: Tue, 20 May 2025 12:50:58 +0300 Subject: [clang][AArch64] Move initialization of ptrauth-* function attrs (#140277) Move the initialization of ptrauth-* function attributes near the initialization of branch protection attributes. The semantics of these groups of attributes partially overlaps, so handle both groups in getDefaultFunctionAttributes() and setTargetAttributes() functions to prevent getting them out of sync. This fixes C++ TLS wrappers. --- clang/lib/CodeGen/CodeGenFunction.cpp | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp') diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index ac40aab..4e79cdf 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -890,19 +890,6 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, FD->getBody()->getStmtClass() == Stmt::CoroutineBodyStmtClass) SanOpts.Mask &= ~SanitizerKind::Null; - // 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.AuthTraps) - 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; if (const auto *XRayAttr = D ? D->getAttr() : nullptr) { -- cgit v1.1