[PATCH 2/2] riscv: tests: Make RISCV_KPROBES_KUNIT tristate

Vivian Wang wangruikang at iscas.ac.cn
Mon Oct 20 05:23:56 PDT 2025


This disallows KUNIT=m and RISCV_KPROBES_KUNIT=y, which produces these
relocs_check.sh warnings when RELOCATABLE=y:

    WARNING: 3 bad relocations
    ffffffff81e24118 R_RISCV_64        kunit_unary_assert_format
    ffffffff81e24a60 R_RISCV_64        kunit_binary_assert_format
    ffffffff81e269d0 R_RISCV_JUMP_SLOT  __kunit_do_failed_assertion

This fixes allmodconfig build.

Reported-by: Inochi Amaoto <inochiama at gmail.com>
Fixes: f2fab612824f ("riscv: Add kprobes KUnit test")
Signed-off-by: Vivian Wang <wangruikang at iscas.ac.cn>
---
 arch/riscv/kernel/tests/Kconfig.debug          | 2 +-
 arch/riscv/kernel/tests/kprobes/Makefile       | 4 +++-
 arch/riscv/kernel/tests/kprobes/test-kprobes.c | 3 +++
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/kernel/tests/Kconfig.debug b/arch/riscv/kernel/tests/Kconfig.debug
index 5db4df44279e..40f8dafffa0a 100644
--- a/arch/riscv/kernel/tests/Kconfig.debug
+++ b/arch/riscv/kernel/tests/Kconfig.debug
@@ -31,7 +31,7 @@ config RISCV_MODULE_LINKING_KUNIT
          If unsure, say N.
 
 config RISCV_KPROBES_KUNIT
-       bool "KUnit test for riscv kprobes" if !KUNIT_ALL_TESTS
+       tristate "KUnit test for riscv kprobes" if !KUNIT_ALL_TESTS
        depends on KUNIT
        depends on KPROBES
        default KUNIT_ALL_TESTS
diff --git a/arch/riscv/kernel/tests/kprobes/Makefile b/arch/riscv/kernel/tests/kprobes/Makefile
index 4cb6c66a98e8..df7256f62313 100644
--- a/arch/riscv/kernel/tests/kprobes/Makefile
+++ b/arch/riscv/kernel/tests/kprobes/Makefile
@@ -1 +1,3 @@
-obj-y += test-kprobes.o test-kprobes-asm.o
+obj-$(CONFIG_RISCV_KPROBES_KUNIT) += kprobes_riscv_kunit.o
+
+kprobes_riscv_kunit-objs := test-kprobes.o test-kprobes-asm.o
diff --git a/arch/riscv/kernel/tests/kprobes/test-kprobes.c b/arch/riscv/kernel/tests/kprobes/test-kprobes.c
index 0716c88bcec7..664535ca0a98 100644
--- a/arch/riscv/kernel/tests/kprobes/test-kprobes.c
+++ b/arch/riscv/kernel/tests/kprobes/test-kprobes.c
@@ -54,3 +54,6 @@ static struct kunit_suite kprobes_test_suite = {
 };
 
 kunit_test_suites(&kprobes_test_suite);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("KUnit test for riscv kprobes");

-- 
2.51.0




More information about the linux-riscv mailing list