* [PATCH 1/2] nios2: remove libgcc for lshrdi3, ashldi3, ashrdi3, muldi3, and ucmpdi2
@ 2026-10-19 16:50 Dinh Nguyen
2026-10-19 16:50 ` [PATCH 2/2] nios2: remove 64-bit division Dinh Nguyen
2026-10-19 21:20 ` [PATCH 1/2] nios2: remove libgcc for lshrdi3, ashldi3, ashrdi3, muldi3, and ucmpdi2 Arnd Bergmann
0 siblings, 2 replies; 4+ messages in thread
From: Dinh Nguyen @ 2026-10-19 16:50 UTC (permalink / raw)
To: arnd, schuster.simon; +Cc: dinguyen, thomas.weissschuh, linux-kernel
Use the kernel's runtime support for lshrdi3, ashldi3, ashrdi3, muldi3,
and ucmpdi2.
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
---
arch/nios2/Kconfig | 5 +++++
arch/nios2/kernel/nios2_ksyms.c | 5 -----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
index 9c0e6eaeb005c..9417bcf583957 100644
--- a/arch/nios2/Kconfig
+++ b/arch/nios2/Kconfig
@@ -14,6 +14,11 @@ config NIOS2
select GENERIC_CPU_DEVICES
select GENERIC_IRQ_PROBE
select GENERIC_IRQ_SHOW
+ select GENERIC_LIB_LSHRDI3
+ select GENERIC_LIB_ASHLDI3
+ select GENERIC_LIB_ASHRDI3
+ select GENERIC_LIB_MULDI3
+ select GENERIC_LIB_UCMPDI2
select HAVE_ARCH_TRACEHOOK
select HAVE_ARCH_KGDB
select HAVE_PAGE_SIZE_4KB
diff --git a/arch/nios2/kernel/nios2_ksyms.c b/arch/nios2/kernel/nios2_ksyms.c
index e8710a269b398..15a223cad84e1 100644
--- a/arch/nios2/kernel/nios2_ksyms.c
+++ b/arch/nios2/kernel/nios2_ksyms.c
@@ -37,9 +37,4 @@ DECLARE_EXPORT(__udivmoddi4);
DECLARE_EXPORT(__udivsi3);
DECLARE_EXPORT(__umoddi3);
DECLARE_EXPORT(__umodsi3);
-DECLARE_EXPORT(__muldi3);
DECLARE_EXPORT(__mulsi3);
-DECLARE_EXPORT(__ucmpdi2);
-DECLARE_EXPORT(__lshrdi3);
-DECLARE_EXPORT(__ashldi3);
-DECLARE_EXPORT(__ashrdi3);
--
2.42.0.411.g813d9a9188
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] nios2: remove 64-bit division
2026-10-19 16:50 [PATCH 1/2] nios2: remove libgcc for lshrdi3, ashldi3, ashrdi3, muldi3, and ucmpdi2 Dinh Nguyen
@ 2026-10-19 16:50 ` Dinh Nguyen
2026-10-19 21:14 ` Arnd Bergmann
2026-10-19 21:20 ` [PATCH 1/2] nios2: remove libgcc for lshrdi3, ashldi3, ashrdi3, muldi3, and ucmpdi2 Arnd Bergmann
1 sibling, 1 reply; 4+ messages in thread
From: Dinh Nguyen @ 2026-10-19 16:50 UTC (permalink / raw)
To: arnd, schuster.simon; +Cc: dinguyen, thomas.weissschuh, linux-kernel
The NIOS2 is not a 64-bit platform, so there is no need to support
64-bit division. Remove moddi3, udivmoddi4, and umoddi3.
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
---
arch/nios2/kernel/nios2_ksyms.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/arch/nios2/kernel/nios2_ksyms.c b/arch/nios2/kernel/nios2_ksyms.c
index 15a223cad84e1..400d2b8158dae 100644
--- a/arch/nios2/kernel/nios2_ksyms.c
+++ b/arch/nios2/kernel/nios2_ksyms.c
@@ -31,10 +31,7 @@ EXPORT_SYMBOL(flush_icache_range);
DECLARE_EXPORT(__gcc_bcmp);
DECLARE_EXPORT(__divsi3);
-DECLARE_EXPORT(__moddi3);
DECLARE_EXPORT(__modsi3);
-DECLARE_EXPORT(__udivmoddi4);
DECLARE_EXPORT(__udivsi3);
-DECLARE_EXPORT(__umoddi3);
DECLARE_EXPORT(__umodsi3);
DECLARE_EXPORT(__mulsi3);
--
2.42.0.411.g813d9a9188
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] nios2: remove 64-bit division
2026-10-19 16:50 ` [PATCH 2/2] nios2: remove 64-bit division Dinh Nguyen
@ 2026-10-19 21:14 ` Arnd Bergmann
0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2026-10-19 21:14 UTC (permalink / raw)
To: Dinh Nguyen, schuster.simon; +Cc: Thomas Weißschuh, linux-kernel
On Mon, Oct 19, 2026, at 18:50, Dinh Nguyen wrote:
> The NIOS2 is not a 64-bit platform, so there is no need to support
> 64-bit division. Remove moddi3, udivmoddi4, and umoddi3.
>
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Did this pass allyesconfig and some randconfig tests to ensure that
there are no hidden 64-bit divisions that need to be converted to
div_u64() etc?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] nios2: remove libgcc for lshrdi3, ashldi3, ashrdi3, muldi3, and ucmpdi2
2026-10-19 16:50 [PATCH 1/2] nios2: remove libgcc for lshrdi3, ashldi3, ashrdi3, muldi3, and ucmpdi2 Dinh Nguyen
2026-10-19 16:50 ` [PATCH 2/2] nios2: remove 64-bit division Dinh Nguyen
@ 2026-10-19 21:20 ` Arnd Bergmann
1 sibling, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2026-10-19 21:20 UTC (permalink / raw)
To: Dinh Nguyen, schuster.simon; +Cc: Thomas Weißschuh, linux-kernel
On Mon, Oct 19, 2026, at 18:50, Dinh Nguyen wrote:
> Use the kernel's runtime support for lshrdi3, ashldi3, ashrdi3, muldi3,
> and ucmpdi2.
>
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
You still link against libgcc in addition to the in-kernel
copies of these functions. While this may work correctly depending
on the link order, what I had suggested here is to remove libgcc
entirely here:
diff --git a/arch/nios2/Makefile b/arch/nios2/Makefile
index f1ff4ce0f1a2..173588c31abf 100644
--- a/arch/nios2/Makefile
+++ b/arch/nios2/Makefile
@@ -19,8 +19,6 @@ UTS_SYSNAME = Linux
export MMU
-LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) $(KCFLAGS) -print-libgcc-file-name)
-
KBUILD_AFLAGS += -march=r$(CONFIG_NIOS2_ARCH_REVISION)
KBUILD_CFLAGS += -pipe -D__linux__ -D__ELF__
@@ -37,7 +35,7 @@ KBUILD_CFLAGS += -DUTS_SYSNAME=\"$(UTS_SYSNAME)\"
KBUILD_CFLAGS += -fno-builtin
KBUILD_CFLAGS += -G 0
-libs-y += arch/nios2/lib/ $(LIBGCC)
+libs-y += arch/nios2/lib/
INSTALL_PATH ?= /tftpboot
nios2-boot := arch/$(ARCH)/boot
I expect you'll have to copy a few functions from the last gcc release
into arch/nios2/lib/ to make this work, at least (a GPLv2 compatible
version of) libgcc/config/nios2/lib2-divmod.c but maybe more.
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-19 21:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-19 16:50 [PATCH 1/2] nios2: remove libgcc for lshrdi3, ashldi3, ashrdi3, muldi3, and ucmpdi2 Dinh Nguyen
2026-10-19 16:50 ` [PATCH 2/2] nios2: remove 64-bit division Dinh Nguyen
2026-10-19 21:14 ` Arnd Bergmann
2026-10-19 21:20 ` [PATCH 1/2] nios2: remove libgcc for lshrdi3, ashldi3, ashrdi3, muldi3, and ucmpdi2 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®