* [PATCH v2] ARC: stop linking libgcc
@ 2026-11-23 0:06 Vineet Gupta
2026-11-23 9:02 ` Arnd Bergmann
0 siblings, 1 reply; 2+ messages in thread
From: Vineet Gupta @ 2026-11-23 0:06 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.
libgcc elision can break -Os builds as older gcc generate millicode
thunks: disable them with -mno-millicode.
Signed-off-by: Vineet Gupta <vgupta@kernel.org>
---
arch/arc/Makefile | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index 868805ffcfea..d8633354a47a 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -71,10 +71,12 @@ 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)
+# Millicode thunks for prologue/epilogue (e.g. at -Os) live in libgcc,
+# which neither the kernel nor modules link against
+cflags-y += -mno-millicode
# Modules with short calls might break for calls into builtin-kernel
-KBUILD_CFLAGS_MODULE += -mlong-calls -mno-millicode
+KBUILD_CFLAGS_MODULE += -mlong-calls
# Finally dump eveything into kernel build system
KBUILD_CFLAGS += $(cflags-y)
@@ -86,7 +88,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] 2+ messages in thread
* Re: [PATCH v2] ARC: stop linking libgcc
2026-11-23 0:06 [PATCH v2] ARC: stop linking libgcc Vineet Gupta
@ 2026-11-23 9:02 ` Arnd Bergmann
0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2026-11-23 9:02 UTC (permalink / raw)
To: Vineet Gupta, linux-snps-arc; +Cc: linux-kernel, Dinh Nguyen, schuster.simon
On Mon, Nov 23, 2026, at 01:06, Vineet Gupta wrote:
> 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.
>
> libgcc elision can break -Os builds as older gcc generate millicode
> thunks: disable them with -mno-millicode.
>
> Signed-off-by: Vineet Gupta <vgupta@kernel.org>
Thanks, I have updated the asm-generic tree to use this version now.
Arnd
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-23 9:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23 0:06 [PATCH v2] ARC: stop linking libgcc Vineet Gupta
2026-11-23 9:02 ` 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®