Skip to content

Commit 40ecff6

Browse files
committed
[clang][RISCV] Accept -fcf-protection=branch when Zicfilp extension is on
-fcf-protection=branch turns on indirect branching protection on RISC-V targets with Zicfilp extension.
1 parent 81c3499 commit 40ecff6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

clang/lib/Basic/Targets/RISCV.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,13 @@ class RISCVTargetInfo : public TargetInfo {
131131
bool supportsCpuInit() const override { return getTriple().isOSLinux(); }
132132
bool validateCpuSupports(StringRef Feature) const override;
133133
bool isValidFeatureName(StringRef Name) const override;
134+
135+
bool
136+
checkCFProtectionBranchSupported(DiagnosticsEngine &Diags) const override {
137+
if (ISAInfo->hasExtension("zicfilp"))
138+
return true;
139+
return TargetInfo::checkCFProtectionBranchSupported(Diags);
140+
}
134141
};
135142
class LLVM_LIBRARY_VISIBILITY RISCV32TargetInfo : public RISCVTargetInfo {
136143
public:

0 commit comments

Comments
 (0)