* [PATCH 1/4] ARC: math emul: elide 64/64 divide and floating point routines
2026-11-19 5:59 [PATCH 0/4] Remove libgcc dependency for ARC Vineet Gupta
@ 2026-11-19 5:59 ` Vineet Gupta
2026-11-19 5:59 ` [PATCH 2/4] ARC: math emul: use existing lib versions of libgcc routines Vineet Gupta
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Vineet Gupta @ 2026-11-19 5:59 UTC (permalink / raw)
To: linux-snps-arc
Cc: linux-kernel, Arnd Bergmann, Dinh Nguyen, Simon Schuster, Vineet Gupta
64/63 divide are not needed in 32-bit kernels.
FP shouldn't be needed at all.
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vineet Gupta <vgupta@kernel.org>
---
arch/arc/kernel/arcksyms.c | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/arch/arc/kernel/arcksyms.c b/arch/arc/kernel/arcksyms.c
index 8851c0a19e09..c22055e66cfe 100644
--- a/arch/arc/kernel/arcksyms.c
+++ b/arch/arc/kernel/arcksyms.c
@@ -11,7 +11,6 @@
extern void __ashldi3(void);
extern void __ashrdi3(void);
extern void __divsi3(void);
-extern void __divsf3(void);
extern void __lshrdi3(void);
extern void __modsi3(void);
extern void __muldi3(void);
@@ -19,17 +18,10 @@ extern void __ucmpdi2(void);
extern void __udivsi3(void);
extern void __umodsi3(void);
extern void __cmpdi2(void);
-extern void __fixunsdfsi(void);
-extern void __muldf3(void);
-extern void __divdf3(void);
-extern void __floatunsidf(void);
-extern void __floatunsisf(void);
-extern void __udivdi3(void);
EXPORT_SYMBOL(__ashldi3);
EXPORT_SYMBOL(__ashrdi3);
EXPORT_SYMBOL(__divsi3);
-EXPORT_SYMBOL(__divsf3);
EXPORT_SYMBOL(__lshrdi3);
EXPORT_SYMBOL(__modsi3);
EXPORT_SYMBOL(__muldi3);
@@ -37,12 +29,6 @@ EXPORT_SYMBOL(__ucmpdi2);
EXPORT_SYMBOL(__udivsi3);
EXPORT_SYMBOL(__umodsi3);
EXPORT_SYMBOL(__cmpdi2);
-EXPORT_SYMBOL(__fixunsdfsi);
-EXPORT_SYMBOL(__muldf3);
-EXPORT_SYMBOL(__divdf3);
-EXPORT_SYMBOL(__floatunsidf);
-EXPORT_SYMBOL(__floatunsisf);
-EXPORT_SYMBOL(__udivdi3);
/* ARC optimised assembler routines */
EXPORT_SYMBOL(memset);
--
2.53.0
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 2/4] ARC: math emul: use existing lib versions of libgcc routines
2026-11-19 5:59 [PATCH 0/4] Remove libgcc dependency for ARC Vineet Gupta
2026-11-19 5:59 ` [PATCH 1/4] ARC: math emul: elide 64/64 divide and floating point routines Vineet Gupta
@ 2026-11-19 5:59 ` Vineet Gupta
2026-11-19 5:59 ` [PATCH 3/4] Revert "ARC: Strip libgcc debug information when generating BTF" Vineet Gupta
2026-11-19 5:59 ` [PATCH 4/4] ARC: stop linking libgcc Vineet Gupta
3 siblings, 0 replies; 5+ messages in thread
From: Vineet Gupta @ 2026-11-19 5:59 UTC (permalink / raw)
To: linux-snps-arc
Cc: linux-kernel, Arnd Bergmann, Dinh Nguyen, Simon Schuster, Vineet Gupta
Use the existing lib/ emulation.
Divide/modulo need some mention: technically emulation is only needed
for hardware lacking the insns (ARCompact ISA or ARCv2 ISA based cores
configured w/o divider and/or those insns disabled in the
build (-mno-div-rem). But to be future-proof (thinking modules)
just add them unconditionally.
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vineet Gupta <vgupta@kernel.org>
---
arch/arc/Kconfig | 10 ++++++++++
arch/arc/kernel/arcksyms.c | 23 -----------------------
2 files changed, 10 insertions(+), 23 deletions(-)
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 80e61175bf52..9bf747882f2a 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -25,6 +25,16 @@ config ARC
select GENERIC_ATOMIC64 if !ISA_ARCV2 || !(ARC_HAS_LL64 && ARC_HAS_LLSC)
# for now, we don't need GENERIC_IRQ_PROBE, CONFIG_GENERIC_IRQ_CHIP
select GENERIC_IRQ_SHOW
+ select GENERIC_LIB_ASHLDI3
+ select GENERIC_LIB_ASHRDI3
+ select GENERIC_LIB_LSHRDI3
+ select GENERIC_LIB_MULDI3
+ select GENERIC_LIB_CMPDI2
+ select GENERIC_LIB_UCMPDI2
+ select GENERIC_LIB_MODSI3
+ select GENERIC_LIB_UMODSI3
+ select GENERIC_LIB_DIVSI3
+ select GENERIC_LIB_UDIVSI3
select GENERIC_PCI_IOMAP
select GENERIC_SCHED_CLOCK
select GENERIC_SMP_IDLE_THREAD
diff --git a/arch/arc/kernel/arcksyms.c b/arch/arc/kernel/arcksyms.c
index c22055e66cfe..bba133fdd1b6 100644
--- a/arch/arc/kernel/arcksyms.c
+++ b/arch/arc/kernel/arcksyms.c
@@ -7,29 +7,6 @@
#include <linux/module.h>
-/* libgcc functions, not part of kernel sources */
-extern void __ashldi3(void);
-extern void __ashrdi3(void);
-extern void __divsi3(void);
-extern void __lshrdi3(void);
-extern void __modsi3(void);
-extern void __muldi3(void);
-extern void __ucmpdi2(void);
-extern void __udivsi3(void);
-extern void __umodsi3(void);
-extern void __cmpdi2(void);
-
-EXPORT_SYMBOL(__ashldi3);
-EXPORT_SYMBOL(__ashrdi3);
-EXPORT_SYMBOL(__divsi3);
-EXPORT_SYMBOL(__lshrdi3);
-EXPORT_SYMBOL(__modsi3);
-EXPORT_SYMBOL(__muldi3);
-EXPORT_SYMBOL(__ucmpdi2);
-EXPORT_SYMBOL(__udivsi3);
-EXPORT_SYMBOL(__umodsi3);
-EXPORT_SYMBOL(__cmpdi2);
-
/* ARC optimised assembler routines */
EXPORT_SYMBOL(memset);
EXPORT_SYMBOL(memcpy);
--
2.53.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/4] Revert "ARC: Strip libgcc debug information when generating BTF"
2026-11-19 5:59 [PATCH 0/4] Remove libgcc dependency for ARC Vineet Gupta
2026-11-19 5:59 ` [PATCH 1/4] ARC: math emul: elide 64/64 divide and floating point routines Vineet Gupta
2026-11-19 5:59 ` [PATCH 2/4] ARC: math emul: use existing lib versions of libgcc routines Vineet Gupta
@ 2026-11-19 5:59 ` Vineet Gupta
2026-11-19 5:59 ` [PATCH 4/4] ARC: stop linking libgcc Vineet Gupta
3 siblings, 0 replies; 5+ messages in thread
From: Vineet Gupta @ 2026-11-19 5:59 UTC (permalink / raw)
To: linux-snps-arc
Cc: linux-kernel, Arnd Bergmann, Dinh Nguyen, Simon Schuster, Vineet Gupta
This reverts commit ca201ad6e92a1924138e83ff966f7a091e3bbe6e.
This is in preparation of libgcc dependency removal.
And its better then deleteing those bits anyways.
Signed-off-by: Vineet Gupta <vgupta@kernel.org>
---
arch/arc/Makefile | 9 +--------
arch/arc/lib/Makefile | 8 --------
2 files changed, 1 insertion(+), 16 deletions(-)
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index 4ea705a331c7..868805ffcfea 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -86,14 +86,7 @@ core-$(CONFIG_ARC_PLAT_TB10X) += arch/arc/plat-tb10x/
core-$(CONFIG_ARC_PLAT_AXS10X) += arch/arc/plat-axs10x/
core-$(CONFIG_ARC_SOC_HSDK) += arch/arc/plat-hsdk/
-libs-y += arch/arc/lib/
-
-ifdef CONFIG_DEBUG_INFO_BTF
-export LIBGCC := $(LIBGCC)
-libs-y += arch/arc/lib/libgcc.a
-else
-libs-y += $(LIBGCC)
-endif
+libs-y += arch/arc/lib/ $(LIBGCC)
boot := arch/arc/boot
diff --git a/arch/arc/lib/Makefile b/arch/arc/lib/Makefile
index 2807ee24f27e..30158ae69fd4 100644
--- a/arch/arc/lib/Makefile
+++ b/arch/arc/lib/Makefile
@@ -13,11 +13,3 @@ lib-$(CONFIG_ISA_ARCV2) +=memcpy-archs-unaligned.o
else
lib-$(CONFIG_ISA_ARCV2) +=memcpy-archs.o
endif
-
-# libgcc can contain complex floating-point debug types unsupported by BTF.
-# Strip only the debug information from a local copy of the selected archive.
-always-$(CONFIG_DEBUG_INFO_BTF) += libgcc.a
-OBJCOPYFLAGS_libgcc.a := --strip-debug
-
-$(obj)/libgcc.a: $(LIBGCC) FORCE
- $(call if_changed,objcopy)
--
2.53.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4] ARC: stop linking libgcc
2026-11-19 5:59 [PATCH 0/4] Remove libgcc dependency for ARC Vineet Gupta
` (2 preceding siblings ...)
2026-11-19 5:59 ` [PATCH 3/4] Revert "ARC: Strip libgcc debug information when generating BTF" Vineet Gupta
@ 2026-11-19 5:59 ` Vineet Gupta
3 siblings, 0 replies; 5+ messages in thread
From: Vineet Gupta @ 2026-11-19 5:59 UTC (permalink / raw)
To: linux-snps-arc
Cc: linux-kernel, Arnd Bergmann, Dinh Nguyen, Simon Schuster, Vineet Gupta
With the generic lib/ versions of the shift/multiply/compare helpers,
the 32-bit divide routines (only needed without hardware div/rem) and
clz/ctz all provided by the kernel, and the 64/64 divide and floating
point routines gone, nothing in the kernel or modules resolves against
libgcc any more.
Drop it from the link so that any new dependency on it (e.g. a raw
64-bit division instead of div_u64()) shows up as a build failure
rather than silently pulling in libgcc code.
Signed-off-by: Vineet Gupta <vgupta@kernel.org>
---
arch/arc/Makefile | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index 868805ffcfea..9f34198d74a3 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -71,8 +71,6 @@ cflags-$(disable_small_data) += -mno-sdata
cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian
ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
-LIBGCC = $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
-
# Modules with short calls might break for calls into builtin-kernel
KBUILD_CFLAGS_MODULE += -mlong-calls -mno-millicode
@@ -86,7 +84,7 @@ core-$(CONFIG_ARC_PLAT_TB10X) += arch/arc/plat-tb10x/
core-$(CONFIG_ARC_PLAT_AXS10X) += arch/arc/plat-axs10x/
core-$(CONFIG_ARC_SOC_HSDK) += arch/arc/plat-hsdk/
-libs-y += arch/arc/lib/ $(LIBGCC)
+libs-y += arch/arc/lib/
boot := arch/arc/boot
--
2.53.0
^ permalink raw reply [flat|nested] 5+ messages in thread