Linux SOC development
 help / color / mirror / Atom feed
* [PATCH] openrisc: stop using libgcc
@ 2026-11-18 16:08 Arnd Bergmann
  2026-11-18 23:03 ` Stafford Horne
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2026-11-18 16:08 UTC (permalink / raw)
  To: Stafford Horne
  Cc: soc, Arnd Bergmann, Jonas Bonn, Stefan Kristiansson, Dinh Nguyen,
	Simon Schuster, Vineet Gupta, linux-openrisc

From: Arnd Bergmann <arnd@arndb.de>

Based on the work for nios2 and arc, remove the inclusion of libgcc
and instead use the kernel's own copy of the required functions.

Cc: Jonas Bonn <jonas@southpole.se>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Simon Schuster <schuster.simon@siemens-energy.com>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: linux-openrisc@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
Hi Stafford,

I've based this on top of the branch at
https://lore.kernel.org/all/20261118144652.3124085-1-dinguyen@kernel.org/
which I've merged into the asm-generic tree. Vineet already
has a similar patch for arch/arc, and I did the one for
arch/openrisc after seeing that everything is there.

If this looks ok to you, please Ack so I can merge it in the 
asm-generic tree as well.

      Arnd

 arch/openrisc/Kconfig             | 10 ++++++++++
 arch/openrisc/Makefile            |  3 ---
 arch/openrisc/kernel/or32_ksyms.c | 14 --------------
 3 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 6aaedc67a5e0..5be29befd86c 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -22,6 +22,16 @@ config OPENRISC
 	select GENERIC_IRQ_CHIP
 	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 GENERIC_LIB_DIVSI3
+	select GENERIC_LIB_MODSI3
+	select GENERIC_LIB_UDIVSI3
+	select GENERIC_LIB_UMODSI3
+	select GENERIC_LIB_MULSI3
 	select GENERIC_PCI_IOMAP
 	select GENERIC_IOREMAP
 	select GENERIC_CPU_DEVICES
diff --git a/arch/openrisc/Makefile b/arch/openrisc/Makefile
index 68249521db5a..38dc87bc6a3a 100644
--- a/arch/openrisc/Makefile
+++ b/arch/openrisc/Makefile
@@ -18,7 +18,6 @@
 KBUILD_DEFCONFIG := or1ksim_defconfig
 
 OBJCOPYFLAGS    := -O binary -R .note -R .comment -S
-LIBGCC 		:= $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
 
 KBUILD_CFLAGS	+= -pipe -ffixed-r10 -D__linux__
 KBUILD_CFLAGS	+= -msfimm -mshftimm
@@ -55,8 +54,6 @@ ifeq ($(CONFIG_OPENRISC_HAVE_INST_SEXT),y)
 	KBUILD_CFLAGS += $(call cc-option,-msext)
 endif
 
-libs-y		+= $(LIBGCC)
-
 PHONY += vmlinux.bin
 
 vmlinux.bin: vmlinux
diff --git a/arch/openrisc/kernel/or32_ksyms.c b/arch/openrisc/kernel/or32_ksyms.c
index 5aabef30ca09..7ae38030a9d4 100644
--- a/arch/openrisc/kernel/or32_ksyms.c
+++ b/arch/openrisc/kernel/or32_ksyms.c
@@ -27,20 +27,6 @@
 #include <asm/hardirq.h>
 #include <asm/delay.h>
 
-#define DECLARE_EXPORT(name) extern void name(void); EXPORT_SYMBOL(name)
-
-/* compiler generated symbols */
-DECLARE_EXPORT(__udivsi3);
-DECLARE_EXPORT(__divsi3);
-DECLARE_EXPORT(__umodsi3);
-DECLARE_EXPORT(__modsi3);
-DECLARE_EXPORT(__muldi3);
-DECLARE_EXPORT(__mulsi3);
-DECLARE_EXPORT(__ashrdi3);
-DECLARE_EXPORT(__ashldi3);
-DECLARE_EXPORT(__lshrdi3);
-DECLARE_EXPORT(__ucmpdi2);
-
 EXPORT_SYMBOL(__copy_tofrom_user);
 EXPORT_SYMBOL(__clear_user);
 EXPORT_SYMBOL(memset);
-- 
2.53.0


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

* Re: [PATCH] openrisc: stop using libgcc
  2026-11-18 16:08 [PATCH] openrisc: stop using libgcc Arnd Bergmann
@ 2026-11-18 23:03 ` Stafford Horne
  2026-11-19  8:26   ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Stafford Horne @ 2026-11-18 23:03 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: soc, Arnd Bergmann, Jonas Bonn, Stefan Kristiansson, Dinh Nguyen,
	Simon Schuster, Vineet Gupta, linux-openrisc

On Wed, Nov 18, 2026 at 05:08:20PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> Based on the work for nios2 and arc, remove the inclusion of libgcc
> and instead use the kernel's own copy of the required functions.
> 
> Cc: Jonas Bonn <jonas@southpole.se>
> Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
> Cc: Stafford Horne <shorne@gmail.com>
> Cc: Dinh Nguyen <dinguyen@kernel.org>
> Cc: Simon Schuster <schuster.simon@siemens-energy.com>
> Cc: Vineet Gupta <vgupta@kernel.org>
> Cc: linux-openrisc@vger.kernel.org
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Stafford Horne <shorne@gmail.com>

> ---
> Hi Stafford,
> 
> I've based this on top of the branch at
> https://lore.kernel.org/all/20261118144652.3124085-1-dinguyen@kernel.org/
> which I've merged into the asm-generic tree. Vineet already
> has a similar patch for arch/arc, and I did the one for
> arch/openrisc after seeing that everything is there.
> 
> If this looks ok to you, please Ack so I can merge it in the 
> asm-generic tree as well.

Thanks,

This all looks good to me. Acked above.

-Stafford

> 
>  arch/openrisc/Kconfig             | 10 ++++++++++
>  arch/openrisc/Makefile            |  3 ---
>  arch/openrisc/kernel/or32_ksyms.c | 14 --------------
>  3 files changed, 10 insertions(+), 17 deletions(-)
> 
> diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
> index 6aaedc67a5e0..5be29befd86c 100644
> --- a/arch/openrisc/Kconfig
> +++ b/arch/openrisc/Kconfig
> @@ -22,6 +22,16 @@ config OPENRISC
>  	select GENERIC_IRQ_CHIP
>  	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 GENERIC_LIB_DIVSI3
> +	select GENERIC_LIB_MODSI3
> +	select GENERIC_LIB_UDIVSI3
> +	select GENERIC_LIB_UMODSI3
> +	select GENERIC_LIB_MULSI3
>  	select GENERIC_PCI_IOMAP
>  	select GENERIC_IOREMAP
>  	select GENERIC_CPU_DEVICES
> diff --git a/arch/openrisc/Makefile b/arch/openrisc/Makefile
> index 68249521db5a..38dc87bc6a3a 100644
> --- a/arch/openrisc/Makefile
> +++ b/arch/openrisc/Makefile
> @@ -18,7 +18,6 @@
>  KBUILD_DEFCONFIG := or1ksim_defconfig
>  
>  OBJCOPYFLAGS    := -O binary -R .note -R .comment -S
> -LIBGCC 		:= $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
>  
>  KBUILD_CFLAGS	+= -pipe -ffixed-r10 -D__linux__
>  KBUILD_CFLAGS	+= -msfimm -mshftimm
> @@ -55,8 +54,6 @@ ifeq ($(CONFIG_OPENRISC_HAVE_INST_SEXT),y)
>  	KBUILD_CFLAGS += $(call cc-option,-msext)
>  endif
>  
> -libs-y		+= $(LIBGCC)
> -
>  PHONY += vmlinux.bin
>  
>  vmlinux.bin: vmlinux
> diff --git a/arch/openrisc/kernel/or32_ksyms.c b/arch/openrisc/kernel/or32_ksyms.c
> index 5aabef30ca09..7ae38030a9d4 100644
> --- a/arch/openrisc/kernel/or32_ksyms.c
> +++ b/arch/openrisc/kernel/or32_ksyms.c
> @@ -27,20 +27,6 @@
>  #include <asm/hardirq.h>
>  #include <asm/delay.h>
>  
> -#define DECLARE_EXPORT(name) extern void name(void); EXPORT_SYMBOL(name)
> -
> -/* compiler generated symbols */
> -DECLARE_EXPORT(__udivsi3);
> -DECLARE_EXPORT(__divsi3);
> -DECLARE_EXPORT(__umodsi3);
> -DECLARE_EXPORT(__modsi3);
> -DECLARE_EXPORT(__muldi3);
> -DECLARE_EXPORT(__mulsi3);
> -DECLARE_EXPORT(__ashrdi3);
> -DECLARE_EXPORT(__ashldi3);
> -DECLARE_EXPORT(__lshrdi3);
> -DECLARE_EXPORT(__ucmpdi2);
> -
>  EXPORT_SYMBOL(__copy_tofrom_user);
>  EXPORT_SYMBOL(__clear_user);
>  EXPORT_SYMBOL(memset);
> -- 
> 2.53.0
> 

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

* Re: [PATCH] openrisc: stop using libgcc
  2026-11-18 23:03 ` Stafford Horne
@ 2026-11-19  8:26   ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2026-11-19  8:26 UTC (permalink / raw)
  To: Stafford Horne, Arnd Bergmann
  Cc: soc, Jonas Bonn, Stefan Kristiansson, Dinh Nguyen,
	schuster.simon@siemens-energy.com, Vineet Gupta,
	linux-openrisc@vger.kernel.org

On Thu, Nov 19, 2026, at 00:03, Stafford Horne wrote:
> On Wed, Nov 18, 2026 at 05:08:20PM +0100, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> Based on the work for nios2 and arc, remove the inclusion of libgcc
>> and instead use the kernel's own copy of the required functions.
>> 
>> Cc: Jonas Bonn <jonas@southpole.se>
>> Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
>> Cc: Stafford Horne <shorne@gmail.com>
>> Cc: Dinh Nguyen <dinguyen@kernel.org>
>> Cc: Simon Schuster <schuster.simon@siemens-energy.com>
>> Cc: Vineet Gupta <vgupta@kernel.org>
>> Cc: linux-openrisc@vger.kernel.org
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Acked-by: Stafford Horne <shorne@gmail.com>

Thanks, I've added this to the asm-generic tree, and now only arch/parisc
still uses libgcc.

    Arnd

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

end of thread, other threads:[~2026-11-19  8:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 16:08 [PATCH] openrisc: stop using libgcc Arnd Bergmann
2026-11-18 23:03 ` Stafford Horne
2026-11-19  8:26   ` Arnd Bergmann

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