[clang] [Clang][RISCV] Support -fcf-protection=return for RISC-V (PR #112477)
Ming-Yi Lai via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 21 21:03:01 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");
+
----------------
mylai-mtk wrote:
This feel a bit weird: I thought using `-fcf-protection=return` to select hardware-based shadow stack is a RISC-V specific thing. Perhaps for now this should look more tailored for RISC-V to avoid misleading?
https://github.com/llvm/llvm-project/pull/112477
More information about the cfe-commits
mailing list