Author: Jesse Huang
Date: 2026-09-16T16:33:04+08:00
New Revision: 52ae463fb3ebb5de414fcd8a660ed035c40e9272

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

LOG: [Clang][RISCV] Loose the requirement of cf-protection=return to Zimop 
(#223671)

Added: 
    

Modified: 
    clang/lib/Basic/Targets/RISCV.cpp
    clang/test/Preprocessor/riscv-cf-protection-return.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/Targets/RISCV.cpp 
b/clang/lib/Basic/Targets/RISCV.cpp
index 5a8dda5218533..c282136cf5fcf 100644
--- a/clang/lib/Basic/Targets/RISCV.cpp
+++ b/clang/lib/Basic/Targets/RISCV.cpp
@@ -243,7 +243,7 @@ void RISCVTargetInfo::getTargetDefines(const LangOptions 
&Opts,
       Builder.defineMacro("__riscv_32e");
   }
 
-  if (Opts.CFProtectionReturn && ISAInfo->hasExtension("zicfiss"))
+  if (Opts.CFProtectionReturn && ISAInfo->hasExtension("zimop"))
     Builder.defineMacro("__riscv_shadow_stack");
 
   if (Opts.CFProtectionBranch) {

diff  --git a/clang/test/Preprocessor/riscv-cf-protection-return.c 
b/clang/test/Preprocessor/riscv-cf-protection-return.c
index a4cbaa1edf68c..68ac49c1da3d3 100644
--- a/clang/test/Preprocessor/riscv-cf-protection-return.c
+++ b/clang/test/Preprocessor/riscv-cf-protection-return.c
@@ -7,16 +7,15 @@
 // RUN: %clang --target=riscv32 -fcf-protection=full -E -dM %s -o - | \
 // RUN: FileCheck --check-prefixes=NO-MACRO %s
 
-// RUN: %clang --target=riscv32 -march=rv32i_zicfiss1p0 \
-// RUN: -menable-experimental-extensions -E -dM %s -o - | \
+// RUN: %clang --target=riscv32 -march=rv32i_zimop -E -dM %s -o - | \
 // RUN: FileCheck --check-prefixes=NO-MACRO %s
 
-// RUN: %clang --target=riscv32 -march=rv32i_zicfiss1p0 \
-// RUN: -menable-experimental-extensions -fcf-protection=return -E -dM %s \
+// RUN: %clang --target=riscv32 -march=rv32i_zimop \
+// RUN: -fcf-protection=return -E -dM %s \
 // RUN: -o - | FileCheck --check-prefixes=SHSTK-MACRO %s
 
-// RUN: %clang --target=riscv32 -march=rv32i_zicfiss1p0 \
-// RUN: -menable-experimental-extensions -fcf-protection=full -E -dM %s -o - \
+// RUN: %clang --target=riscv32 -march=rv32i_zimop \
+// RUN: -fcf-protection=full -E -dM %s -o - \
 // RUN: | FileCheck --check-prefixes=SHSTK-MACRO %s
 
 // RUN: %clang --target=riscv64 -E -dM %s -o - | \
@@ -28,16 +27,15 @@
 // RUN: %clang --target=riscv64 -fcf-protection=full -E -dM %s -o - | \
 // RUN: FileCheck --check-prefixes=NO-MACRO %s
 
-// RUN: %clang --target=riscv64 -march=rv64i_zicfiss1p0 \
-// RUN: -menable-experimental-extensions -E -dM %s -o - | \
+// RUN: %clang --target=riscv64 -march=rv64i_zimop -E -dM %s -o - | \
 // RUN: FileCheck --check-prefixes=NO-MACRO %s
 
-// RUN: %clang --target=riscv64 -march=rv64i_zicfiss1p0 \
-// RUN: -menable-experimental-extensions -fcf-protection=return -E -dM %s \
+// RUN: %clang --target=riscv64 -march=rv64i_zimop \
+// RUN: -fcf-protection=return -E -dM %s \
 // RUN: -o - | FileCheck --check-prefixes=SHSTK-MACRO %s
 
-// RUN: %clang --target=riscv64 -march=rv64i_zicfiss1p0 \
-// RUN: -menable-experimental-extensions -fcf-protection=full -E -dM %s -o - \
+// RUN: %clang --target=riscv64 -march=rv64i_zimop \
+// RUN: -fcf-protection=full -E -dM %s -o - \
 // RUN: | FileCheck --check-prefixes=SHSTK-MACRO %s
 
 // SHSTK-MACRO-NOT: __CET__


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to