* [PATCH 0/2] riscv: vdso: Do not use LTO for the vDSO
@ 2026-07-01 9:21 Thomas Weißschuh
2026-07-01 9:21 ` [PATCH 1/2] " Thomas Weißschuh
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Thomas Weißschuh @ 2026-07-01 9:21 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Nathan Chancellor, Conor Dooley, Wende Tan
Cc: Palmer Dabbelt, linux-riscv, linux-kernel, Nam Cao,
Thomas Weißschuh, kernel test robot, stable
With LTO enabled the compiler assumes that the vDSO functions are not
used and optimizes them away completely.
Disable LTO for the vDSO, as these functions are hand-optimized anyways.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
Thomas Weißschuh (2):
riscv: vdso: Do not use LTO for the vDSO
riscv: vdso: Simplify cflags remove logic
arch/riscv/kernel/vdso/Makefile | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
---
base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
change-id: 20260630-riscv-vdso-lto-2a5c6f021162
Best regards,
--
Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] riscv: vdso: Do not use LTO for the vDSO
2026-07-01 9:21 [PATCH 0/2] riscv: vdso: Do not use LTO for the vDSO Thomas Weißschuh
@ 2026-07-01 9:21 ` Thomas Weißschuh
2026-07-01 9:21 ` [PATCH 2/2] riscv: vdso: Simplify cflags remove logic Thomas Weißschuh
2026-07-02 9:38 ` [PATCH 0/2] riscv: vdso: Do not use LTO for the vDSO Nam Cao
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Weißschuh @ 2026-07-01 9:21 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Nathan Chancellor, Conor Dooley, Wende Tan
Cc: Palmer Dabbelt, linux-riscv, linux-kernel, Nam Cao,
Thomas Weißschuh, kernel test robot, stable
With LTO enabled the compiler assumes that the vDSO functions are not
used and optimizes them away completely. Currently this happens to
__vdso_clock_getres(), __vdso_clock_gettime(), __vdso_getrandom(),
__vdso_gettimeofday() and __vdso_riscv_hwprobe().
Disable LTO for the vDSO, as these functions are hand-optimized anyways.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202606301855.WvkSC4kD-lkp@intel.com/
Fixes: 021d23428bdb ("RISC-V: build: Allow LTO to be selected")
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
arch/riscv/kernel/vdso/Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
index a842dc034571..43ee881f6c6f 100644
--- a/arch/riscv/kernel/vdso/Makefile
+++ b/arch/riscv/kernel/vdso/Makefile
@@ -69,9 +69,9 @@ CPPFLAGS_$(vdso_lds) += -DHAS_VGETTIMEOFDAY
endif
# Disable -pg to prevent insert call site
-CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS)
-CFLAGS_REMOVE_getrandom.o = $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS)
-CFLAGS_REMOVE_hwprobe.o = $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS)
+CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS) $(CC_FLAGS_LTO)
+CFLAGS_REMOVE_getrandom.o = $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS) $(CC_FLAGS_LTO)
+CFLAGS_REMOVE_hwprobe.o = $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS) $(CC_FLAGS_LTO)
# Force dependency
$(obj)/$(vdso_o): $(obj)/$(vdso_so)
--
2.55.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] riscv: vdso: Simplify cflags remove logic
2026-07-01 9:21 [PATCH 0/2] riscv: vdso: Do not use LTO for the vDSO Thomas Weißschuh
2026-07-01 9:21 ` [PATCH 1/2] " Thomas Weißschuh
@ 2026-07-01 9:21 ` Thomas Weißschuh
2026-07-02 9:38 ` [PATCH 0/2] riscv: vdso: Do not use LTO for the vDSO Nam Cao
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Weißschuh @ 2026-07-01 9:21 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Nathan Chancellor, Conor Dooley, Wende Tan
Cc: Palmer Dabbelt, linux-riscv, linux-kernel, Nam Cao,
Thomas Weißschuh
Listing all flags for each object file is tedious and error-prone.
Replace it with a simpler solution.
Link: https://lore.kernel.org/all/20260630135316-f26f0e0f-c08c-4d4d-9963-10f9985a7689@linutronix.de/
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
arch/riscv/kernel/vdso/Makefile | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
index 43ee881f6c6f..8dbf2532a573 100644
--- a/arch/riscv/kernel/vdso/Makefile
+++ b/arch/riscv/kernel/vdso/Makefile
@@ -41,6 +41,8 @@ ccflags-y += $(CFI_FULL)
asflags-y += $(KBUILD_BASE_ISA)$(CFI_MARCH)
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
@@ -68,11 +70,6 @@ ifneq ($(filter vgettimeofday, $(vdso-syms)),)
CPPFLAGS_$(vdso_lds) += -DHAS_VGETTIMEOFDAY
endif
-# Disable -pg to prevent insert call site
-CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS) $(CC_FLAGS_LTO)
-CFLAGS_REMOVE_getrandom.o = $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS) $(CC_FLAGS_LTO)
-CFLAGS_REMOVE_hwprobe.o = $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS) $(CC_FLAGS_LTO)
-
# Force dependency
$(obj)/$(vdso_o): $(obj)/$(vdso_so)
--
2.55.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] riscv: vdso: Do not use LTO for the vDSO
2026-07-01 9:21 [PATCH 0/2] riscv: vdso: Do not use LTO for the vDSO Thomas Weißschuh
2026-07-01 9:21 ` [PATCH 1/2] " Thomas Weißschuh
2026-07-01 9:21 ` [PATCH 2/2] riscv: vdso: Simplify cflags remove logic Thomas Weißschuh
@ 2026-07-02 9:38 ` Nam Cao
2 siblings, 0 replies; 4+ messages in thread
From: Nam Cao @ 2026-07-02 9:38 UTC (permalink / raw)
To: Thomas Weißschuh, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, Nathan Chancellor, Conor Dooley, Wende Tan
Cc: Palmer Dabbelt, linux-riscv, linux-kernel, Thomas Weißschuh,
kernel test robot, stable
Thomas Weißschuh <thomas.weissschuh@linutronix.de> writes:
> With LTO enabled the compiler assumes that the vDSO functions are not
> used and optimizes them away completely.
>
> Disable LTO for the vDSO, as these functions are hand-optimized anyways.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Nam Cao <namcao@linutronix.de>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-02 9:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 9:21 [PATCH 0/2] riscv: vdso: Do not use LTO for the vDSO Thomas Weißschuh
2026-07-01 9:21 ` [PATCH 1/2] " Thomas Weißschuh
2026-07-01 9:21 ` [PATCH 2/2] riscv: vdso: Simplify cflags remove logic Thomas Weißschuh
2026-07-02 9:38 ` [PATCH 0/2] riscv: vdso: Do not use LTO for the vDSO Nam Cao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox