Re: [PATCH] nios2: ksyms: Export __divsi3_table

From: Arnd Bergmann

Date: Mon Oct 26 2026 - 20:18:13 EST


On Tue, Oct 27, 2026, at 00:44, Sasha Levin wrote:
> lib/lz4 is built with -O3, and at -O3 GCC enables -mfast-sw-div, which
> expands divisions by small numbers using __divsi3_table, a lookup table
> in libgcc. Without CONFIG_NIOS2_HW_DIV_SUPPORT that leaves
> lz4_compress.ko with a reference modpost cannot resolve:
>
> ERROR: modpost: lib/lz4/lz4_compress.ko: symbol '__divsi3_table' undefined!
>
> libgcc is linked into vmlinux, so built-in code finds the table, but it
> is not exported to modules. Export it next to __divsi3.
>
> The error predates commit 2180d11e06fb ("nios2: ksyms: Declare __mulsi3
> export"), which only made it visible: before that commit, modpost used
> up its ten unresolved symbol reports on __mulsi3 and suppressed the rest.
>
> Fixes: 2fc8483fdcde ("nios2: Build infrastructure")
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Closes:
> https://lore.kernel.org/oe-kbuild-all/202610270503.NGox5O6j-lkp@xxxxxxxxx/
> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

I hope we can address this using a copy of libgcc like the other
architectures:

https://lore.kernel.org/lkml/20261020123149.cyjzz4uo25oiiu2m@dev-vm-schuster/

Your patch is otherwise correct of course, but it may end up
clashing with the other fix.

Arnd