[PATCH 7/9] riscv: vdso: Directly include the generic vDSO implementations
From: Thomas Weißschuh
Date: Fri Dec 04 2026 - 02:31:13 EST
The inclusion of the generic vDSO implementation through compiler
arguments is complicated and non-obvious.
Directly include the .c files instead.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
---
arch/riscv/kernel/vdso/Makefile | 10 ++--------
arch/riscv/kernel/vdso/getrandom.c | 2 ++
arch/riscv/kernel/vdso/vgettimeofday.c | 2 ++
3 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
index c023046a3fd7..f9ce25984bff 100644
--- a/arch/riscv/kernel/vdso/Makefile
+++ b/arch/riscv/kernel/vdso/Makefile
@@ -44,14 +44,8 @@ asflags-y += $(CFI_FULL)
ccflags-remove-y += $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS) $(CC_FLAGS_LTO)
-ifneq ($(c-gettimeofday-y),)
- CFLAGS_vgettimeofday.o += -fPIC -include $(c-gettimeofday-y)
-endif
-
-ifneq ($(c-getrandom-y),)
- CFLAGS_getrandom.o += -fPIC -include $(c-getrandom-y)
-endif
-
+CFLAGS_vgettimeofday.o += -fPIC
+CFLAGS_getrandom.o += -fPIC
CFLAGS_hwprobe.o += -fPIC
# Build rules
diff --git a/arch/riscv/kernel/vdso/getrandom.c b/arch/riscv/kernel/vdso/getrandom.c
index f21922e8cebd..05711a04f547 100644
--- a/arch/riscv/kernel/vdso/getrandom.c
+++ b/arch/riscv/kernel/vdso/getrandom.c
@@ -4,6 +4,8 @@
*/
#include <linux/types.h>
+#include "../../../../lib/vdso/getrandom.c"
+
ssize_t __vdso_getrandom(void *buffer, size_t len, unsigned int flags, void *opaque_state, size_t opaque_len)
{
return __cvdso_getrandom(buffer, len, flags, opaque_state, opaque_len);
diff --git a/arch/riscv/kernel/vdso/vgettimeofday.c b/arch/riscv/kernel/vdso/vgettimeofday.c
index b35057802584..a7134b5aebd6 100644
--- a/arch/riscv/kernel/vdso/vgettimeofday.c
+++ b/arch/riscv/kernel/vdso/vgettimeofday.c
@@ -10,6 +10,8 @@
#include <linux/types.h>
#include <vdso/gettime.h>
+#include "../../../../lib/vdso/gettimeofday.c"
+
int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts)
{
return __cvdso_clock_gettime(clock, ts);
--
2.56.1