mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] nios2: ksyms: Export __divsi3_table
@ 2026-10-26 23:44 Sasha Levin
  2026-10-27  0:17 ` Arnd Bergmann
  0 siblings, 1 reply; 2+ messages in thread
From: Sasha Levin @ 2026-10-26 23:44 UTC (permalink / raw)
  To: Dinh Nguyen, Simon Schuster
  Cc: Thomas Weißschuh, Arnd Bergmann, linux-kernel, kernel test robot

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@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202610270503.NGox5O6j-lkp@intel.com/
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/nios2/kernel/nios2_ksyms.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/nios2/kernel/nios2_ksyms.c b/arch/nios2/kernel/nios2_ksyms.c
index e8710a269b398..b7152258430a6 100644
--- a/arch/nios2/kernel/nios2_ksyms.c
+++ b/arch/nios2/kernel/nios2_ksyms.c
@@ -31,6 +31,7 @@ EXPORT_SYMBOL(flush_icache_range);
 
 DECLARE_EXPORT(__gcc_bcmp);
 DECLARE_EXPORT(__divsi3);
+DECLARE_EXPORT(__divsi3_table);
 DECLARE_EXPORT(__moddi3);
 DECLARE_EXPORT(__modsi3);
 DECLARE_EXPORT(__udivmoddi4);

base-commit: d135ab453a7400a34930bdda1ef4bdc8acfac80e
-- 
2.53.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] nios2: ksyms: Export __divsi3_table
  2026-10-26 23:44 [PATCH] nios2: ksyms: Export __divsi3_table Sasha Levin
@ 2026-10-27  0:17 ` Arnd Bergmann
  0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2026-10-27  0:17 UTC (permalink / raw)
  To: Sasha Levin, Dinh Nguyen, schuster.simon
  Cc: Thomas Weißschuh, linux-kernel, kernel test robot

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@intel.com>
> Closes: 
> https://lore.kernel.org/oe-kbuild-all/202610270503.NGox5O6j-lkp@intel.com/
> Signed-off-by: Sasha Levin <sashal@kernel.org>

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-27  0:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-26 23:44 [PATCH] nios2: ksyms: Export __divsi3_table Sasha Levin
2026-10-27  0:17 ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®