================ @@ -818,6 +818,12 @@ void CodeGenModule::EmitCXXModuleInitFunc(Module *Primary) { Fn->addFnAttr("device-init"); } + if (getTarget().isBranchProtectionSupportedArch( + getTarget().getTargetOpts().CPU)) { + TargetInfo::BranchProtectionInfo BPI(getLangOpts()); + getTargetCodeGenInfo().setBranchProtectionFnAttributes(BPI, (*Fn)); ---------------- efriedma-quic wrote:
This does not look like the right place for this code; we have a bunch of different functions for setting attributes, we shouldn't be bypassing all of them to directly juggle branch protection specifically for initializing global variables. Maybe AArch64TargetCodeGenInfo::setTargetAttributes needs to be changed so it works even if there isn't a FunctionDecl? https://github.com/llvm/llvm-project/pull/133716 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits