Author: Jesse Huang
Date: 2025-09-09T22:49:40+08:00
New Revision: e91f3674198707531a6d97632a6bd8e446c67633

URL: 
https://github.com/llvm/llvm-project/commit/e91f3674198707531a6d97632a6bd8e446c67633
DIFF: 
https://github.com/llvm/llvm-project/commit/e91f3674198707531a6d97632a6bd8e446c67633.diff

LOG: [Clang][RISCV] Loosen the requirement of -fcf-protection=return to zimop 
(#152252)

Following https://github.com/llvm/llvm-project/pull/152251
We can now loosen the requirement of `-fcf-protection=return` from
Zicfiss to Zimop

Added: 
    

Modified: 
    clang/lib/Basic/Targets/RISCV.h
    clang/test/CodeGen/RISCV/attr-hw-shadow-stack.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/Targets/RISCV.h b/clang/lib/Basic/Targets/RISCV.h
index 58bfad128ce2c..d8b0e64c90dd6 100644
--- a/clang/lib/Basic/Targets/RISCV.h
+++ b/clang/lib/Basic/Targets/RISCV.h
@@ -147,7 +147,7 @@ class RISCVTargetInfo : public TargetInfo {
 
   bool
   checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const override {
-    if (ISAInfo->hasExtension("zicfiss"))
+    if (ISAInfo->hasExtension("zimop"))
       return true;
     return TargetInfo::checkCFProtectionReturnSupported(Diags);
   }

diff  --git a/clang/test/CodeGen/RISCV/attr-hw-shadow-stack.c 
b/clang/test/CodeGen/RISCV/attr-hw-shadow-stack.c
index cabff7e598eb0..8dfdc8c044cae 100644
--- a/clang/test/CodeGen/RISCV/attr-hw-shadow-stack.c
+++ b/clang/test/CodeGen/RISCV/attr-hw-shadow-stack.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -triple riscv64 -target-feature +experimental-zicfiss 
-emit-llvm -o - %s -fcf-protection=return | FileCheck %s
-// RUN: %clang_cc1 -triple riscv64 -target-feature +experimental-zicfiss 
-emit-llvm -o - %s | FileCheck -check-prefix=NOSHADOWSTACK %s
-// RUN: %clang_cc1 -triple riscv32 -target-feature +experimental-zicfiss 
-emit-llvm -o - %s -fcf-protection=return | FileCheck %s
-// RUN: %clang_cc1 -triple riscv32 -target-feature +experimental-zicfiss 
-emit-llvm -o - %s | FileCheck -check-prefix=NOSHADOWSTACK %s
+// RUN: %clang_cc1 -triple riscv64 -target-feature +zimop -emit-llvm -o - %s 
-fcf-protection=return | FileCheck %s
+// RUN: %clang_cc1 -triple riscv64 -target-feature +zimop -emit-llvm -o - %s | 
FileCheck -check-prefix=NOSHADOWSTACK %s
+// RUN: %clang_cc1 -triple riscv32 -target-feature +zimop -emit-llvm -o - %s 
-fcf-protection=return | FileCheck %s
+// RUN: %clang_cc1 -triple riscv32 -target-feature +zimop -emit-llvm -o - %s | 
FileCheck -check-prefix=NOSHADOWSTACK %s
 
 int foo(int *a) { return *a; }
 


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to