[PATCH 5/9] powerpc/vdso: Directly include the generic vDSO implementations
Christophe Leroy (CS GROUP)
chleroy at kernel.org
Fri Dec 4 02:28:19 PST 2026
Le 04/12/2026 à 08:30, Thomas Weißschuh a écrit :
> 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 at linutronix.de>
> ---
> arch/powerpc/kernel/vdso/Makefile | 10 +---------
> arch/powerpc/kernel/vdso/vgetrandom.c | 2 ++
> arch/powerpc/kernel/vdso/vgettimeofday.c | 2 ++
> 3 files changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
> index 0d1a49529885..386eb3778934 100644
> --- a/arch/powerpc/kernel/vdso/Makefile
> +++ b/arch/powerpc/kernel/vdso/Makefile
> @@ -11,19 +11,11 @@ obj-vdso64 = sigtramp64-64.o gettimeofday-64.o datapage-64.o cacheflush-64.o not
> obj-vdso32 += getrandom-32.o vgetrandom-chacha-32.o
> obj-vdso64 += getrandom-64.o vgetrandom-chacha-64.o
>
> -ifneq ($(c-gettimeofday-y),)
> - CFLAGS_vgettimeofday-32.o += -include $(c-gettimeofday-y)
> # Go prior to 1.16.x assumes r30 is not clobbered by any VDSO code. That used to be true
> # by accident when the VDSO was hand-written asm code, but may not be now that the VDSO is
> # compiler generated. To avoid breaking Go tell GCC not to use r30. Impact on code
> # generation is minimal, it will just use r29 instead.
> - CFLAGS_vgettimeofday-64.o += -include $(c-gettimeofday-y) $(call cc-option, -ffixed-r30)
> -endif
> -
> -ifneq ($(c-getrandom-y),)
> - CFLAGS_vgetrandom-32.o += -include $(c-getrandom-y)
> - CFLAGS_vgetrandom-64.o += -include $(c-getrandom-y)
> -endif
> +CFLAGS_vgettimeofday-64.o += $(call cc-option, -ffixed-r30)
Maybe it is time to get rid of this fixed r30 workaround ?
It was introduced in July 2021 by commit a88603f4b92e ("powerpc/vdso:
Don't use r30 to avoid breaking Go lang")
But go 1.15 has been obsoleted in August 2021.
Allthought the comment gives the impression to go 1.16 is ok, it is only
from go 1.16.7 that the problem is fixed. However go 1.17 onwoards are
fixed, and go 1.16 was obsoleted by mi march 2022.
>
> # Build rules
>
> diff --git a/arch/powerpc/kernel/vdso/vgetrandom.c b/arch/powerpc/kernel/vdso/vgetrandom.c
> index cc79b960a541..e164e2052615 100644
> --- a/arch/powerpc/kernel/vdso/vgetrandom.c
> +++ b/arch/powerpc/kernel/vdso/vgetrandom.c
> @@ -7,6 +7,8 @@
> #include <linux/time.h>
> #include <linux/types.h>
>
> +#include "../../../../lib/vdso/getrandom.c"
> +
> ssize_t __c_kernel_getrandom(void *buffer, size_t len, unsigned int flags, void *opaque_state,
> size_t opaque_len)
> {
> diff --git a/arch/powerpc/kernel/vdso/vgettimeofday.c b/arch/powerpc/kernel/vdso/vgettimeofday.c
> index 4b712fb01a3f..11a69411e04a 100644
> --- a/arch/powerpc/kernel/vdso/vgettimeofday.c
> +++ b/arch/powerpc/kernel/vdso/vgettimeofday.c
> @@ -5,6 +5,8 @@
> #include <linux/time.h>
> #include <linux/types.h>
>
> +#include "../../../../lib/vdso/gettimeofday.c"
> +
> #ifdef __powerpc64__
> int __c_kernel_clock_gettime(clockid_t clock, struct __kernel_timespec *ts,
> const struct vdso_time_data *vd)
>
More information about the linux-arm-kernel
mailing list