[PATCH 1/2] riscv: vdso: Do not use LTO for the vDSO

Nathan Chancellor nathan at kernel.org
Tue Jul 7 10:44:06 PDT 2026


On Tue, Jul 07, 2026 at 08:10:19AM +0200, Thomas Weißschuh wrote:
> On Mon, Jul 06, 2026 at 02:01:58PM -0700, Nathan Chancellor wrote:
> > On Wed, Jul 01, 2026 at 11:21:22AM +0200, Thomas Weißschuh wrote:
> > > 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 at intel.com>
> > > Closes: https://lore.kernel.org/oe-kbuild-all/202606301855.WvkSC4kD-lkp@intel.com/
> > 
> > While this change seems correct, is this really the fix for that report?
> > It seems like that error happens in clang but I would expect this sort
> > of issue to only appear once LTO has run through ld.lld?
> 
> At this point the vDSO userspace library has already run through ld.lld.
> That has optimized away the futex symbols, which means their offsets are not
> defined when building the regular vDSO *kernel* code.

Ahhh, thanks for the additional clarification! That makes much more
sense, I had missed that we were in kernel code, not userspace.

-- 
Cheers,
Nathan



More information about the linux-riscv mailing list