[PATCH 01/12] riscv: Add --enable-cfi option for controlling cfi features

Jesse Huang jesse.huang@sifive.com
Wed Jun 18 08:42:47 GMT 2025


---
 configure    | 12 ++++++++++++
 configure.ac |  6 ++++++
 2 files changed, 18 insertions(+)

diff --git a/configure b/configure
index 7cda641fce..5a996c8f25 100755
--- a/configure
+++ b/configure
@@ -818,6 +818,7 @@ enable_nscd
 enable_pt_chown
 enable_mathvec
 enable_cet
+enable_cfi
 enable_scv
 enable_fortify_source
 with_cpu
@@ -1499,6 +1500,7 @@ Optional Features:
                           depends on architecture]
   --enable-cet            enable Intel Control-flow Enforcement Technology
                           (CET), x86 only
+  --enable-cfi            enable Control Flow Integrity (CFI), RISC-V only
   --disable-scv           syscalls will not use scv instruction, even if the
                           kernel supports it, powerpc only
   --enable-fortify-source[=1|2|3]
@@ -4853,6 +4855,16 @@ esac
 fi
 
 
+# Check whether --enable-cfi was given.
+if test ${enable_cfi+y}
+then :
+  enableval=$enable_cfi; enable_cfi=$enableval
+else case e in #(
+  e) enable_cfi=no ;;
+esac
+fi
+
+
 # Check whether --enable-scv was given.
 if test ${enable_scv+y}
 then :
diff --git a/configure.ac b/configure.ac
index 0b0d8875cc..9bda3d1520 100644
--- a/configure.ac
+++ b/configure.ac
@@ -421,6 +421,12 @@ AC_ARG_ENABLE([cet],
 	      [enable_cet=$enableval],
 	      [enable_cet=$libc_cv_compiler_default_cet])
 
+AC_ARG_ENABLE([cfi],
+	      AS_HELP_STRING([--enable-cfi],
+			     [enable Control Flow Integrity (CFI), RISC-V only]),
+	      [enable_cfi=$enableval],
+	      [enable_cfi=no])
+
 AC_ARG_ENABLE([scv],
 	      AS_HELP_STRING([--disable-scv],
 			     [syscalls will not use scv instruction, even if the kernel supports it, powerpc only]),
-- 
2.39.3



More information about the Libc-alpha mailing list