From: "Arnd Bergmann" <arnd@arndb.de>
To: "schuster.simon@siemens-energy.com"
<schuster.simon@siemens-energy.com>,
"Dinh Nguyen" <dinguyen@kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>
Cc: "Sasha Levin" <sashal@kernel.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/3] lib: Add software mul/div helpers and use them from nios2
Date: Fri, 30 Oct 2026 17:50:58 +0100 [thread overview]
Message-ID: <802dd722-fab6-496c-a457-c1533ff96132@app.fastmail.com> (raw)
In-Reply-To: <20261030-nios2-remove-usage-of-libgcc-v1-0-4e341c66082e@siemens-energy.com>
On Fri, Oct 30, 2026, at 16:53, Simon Schuster wrote:
> Recently, there have been linking failures on nios2 regarding libgcc
> symbols that we reexport to modules (in particular __mulsi3 [0], and
> __divsi3_table [1]).
>
> In the resulting discussion, Arnd suggested [2] dropping the libgcc
> dependency altogether, as -- while specific functions might be fine --
> libgcc does not expect to run in a kernel-like freestanding environment.
>
> To this end, Dinh Nguyen was kind enough to locate and extract
> GPLv2-compliant versions of the software mul/div/mod and __gcc_bcmp
> functions required by nios2 gcc and integrate them into the kernel.
>
> As Arnd also suggested [3] that these might be helpful to other smaller
> architectures (such as arc or openrisc), I've further extracted them to
> lib/ with corresponding CONFIG_GENERIC_LIB_* options that allow
> selectively enabling and exporting these as required.
>
> The patch series compiles mostly^4 fine in a nios2 allyesconfig
> without modpost errors; a quick boot test on a regular build also
> completed successfully.
This looks very good to me overall, thanks for working on this.
Just a few minor things that stood out:
- I don't see a need to add the files under arch/ first and then
move them to lib/, just start with the added files there
- I did not expect gccbcmp.c to be needed at all, the kernel
should handle the string functions internally. If you do need it,
there is of course no harm adding it, but probably need to
build with -ffreestanding to prevent it from recursively
ending up in bcmp()
> One aspect I'm not fully sure of is whether adding declarations for the
> new lib/ functions to include/linux/libgcc.h unconditionally in the last
> patch of this series is completely clean; but it matches how other
> "optional vendored" functions in libgcc.h seem to be handled.
That part is looks fine.
Arnd
prev parent reply other threads:[~2026-10-30 16:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 15:53 Simon Schuster
2026-10-30 15:53 ` [PATCH 1/3] nios2: remove usage of libgcc Simon Schuster
2026-10-30 15:53 ` [PATCH 2/3] nios2: export __divsi3_table Simon Schuster
2026-10-30 15:53 ` [PATCH 3/3] lib: extract 32bit mul/div helpers from nios2 into GENERIC_LIB Simon Schuster
2026-10-30 16:50 ` Arnd Bergmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=802dd722-fab6-496c-a457-c1533ff96132@app.fastmail.com \
--to=arnd@arndb.de \
--cc=akpm@linux-foundation.org \
--cc=dinguyen@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sashal@kernel.org \
--cc=schuster.simon@siemens-energy.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®