Skip to content

Commit 7dc168a

Browse files
committed
[Clang][RISCV] Add RISCV check for hw-shadow-stack
1 parent fe4a28f commit 7dc168a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -899,8 +899,9 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
899899
if (CodeGenOpts.PointerAuth.IndirectGotos)
900900
Fn->addFnAttr("ptrauth-indirect-gotos");
901901

902-
// Add return control flow integrity attributes.
903-
if (CodeGenOpts.CFProtectionReturn)
902+
// Add return control flow integrity attributes for RISCV.
903+
if (CodeGenOpts.CFProtectionReturn &&
904+
getContext().getTargetInfo().getTriple().isRISCV())
904905
Fn->addFnAttr("hw-shadow-stack");
905906

906907
// Apply xray attributes to the function (as a string, for now)

0 commit comments

Comments
 (0)