[clang] [llvm] [AArch64] Codegen for AArch64 Return Address Signing Hardening (PR #176187)

Anatoly Trosinenko via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 26 05:10:24 PDT 2026


================
@@ -2453,9 +2453,6 @@ static void getTrivialDefaultFunctionAttributes(
     std::tie(Var, Value) = Attr.split('=');
     FuncAttrs.addAttribute(Var, Value);
   }
-
-  TargetInfo::BranchProtectionInfo BPI(LangOpts);
-  TargetCodeGenInfo::initBranchProtectionFnAttributes(BPI, FuncAttrs);
----------------
atrosinenko wrote:

I'm a bit worried about removing anything here: the `::getTrivialDefaultFunctionAttributes` function is called not only from `CodeGenModule::getDefaultFunctionAttributes` but also from `CodeGen::mergeDefaultFunctionDefinitionAttributes` (and the latter function is called from `BackendConsumer::LinkInModules`). I'm not really sure linking pre-built bitcode modules is ever used together with, say, BTI hardening. Though, any possibility of silently losing any security hardening looks somewhat suspicious.

WDYT on keeping the call to `TargetCodeGenInfo::initBranchProtectionFnAttributes` here for now and just making it conditional? (thankfully, we already have `bool AttrOnCallSite` available in this function)

Note that I do support the idea that the calls to `initBranchProtectionFnAttributes` and `initPointerAuthFnAttributes` should be placed close to each other. Furthermore, it looks like these two functions should be merged into a single one (the same applies to their "set attributes" counterparts). My suggestion is merely that this change probably deserves its own follow-up PR and its own thorough review.

https://github.com/llvm/llvm-project/pull/176187


More information about the llvm-commits mailing list