[clang] [Clang][RISCV] Support -fcf-protection=return for RISC-V (PR #112477)
Jesse Huang via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 22 23:43:03 PDT 2024
================
@@ -899,6 +899,10 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
if (CodeGenOpts.PointerAuth.IndirectGotos)
Fn->addFnAttr("ptrauth-indirect-gotos");
+ // Add return control flow integrity attributes.
+ if (CodeGenOpts.CFProtectionReturn)
+ Fn->addFnAttr("hw-shadow-stack");
+
----------------
jaidTw wrote:
Yeah nice catch, it definitely needs to check the arch
https://github.com/llvm/llvm-project/pull/112477
More information about the cfe-commits
mailing list