From: "Arnd Bergmann" <arnd@kernel.org>
To: "Zhihao Cheng" <chengzhihao1@huawei.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Richard Weinberger" <richard@nod.at>,
"Miquel Raynal" <miquel.raynal@bootlin.com>,
"Vignesh Raghavendra" <vigneshr@ti.com>,
"Daniel Golle" <daniel@makrotopia.org>
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: ubi: avoid expensive do_div() on 32-bit machines
Date: Wed, 13 Mar 2024 13:21:26 +0100 [thread overview]
Message-ID: <b08aaae4-8c69-47eb-9658-5f3f5c8e4056@app.fastmail.com> (raw)
In-Reply-To: <1a12c8ed-0cb5-5650-24a2-84b021c444c3@huawei.com>
On Wed, Mar 13, 2024, at 13:10, Zhihao Cheng wrote:
> 在 2024/3/13 19:53, Arnd Bergmann 写道:
>> On Wed, Mar 13, 2024, at 12:29, Zhihao Cheng wrote:
>>
>> The way it usually goes is that someone adds an open-coded
>> 64-bit division that causes a link failure, which prompts
> I'm a little confused, what kind of link failure? Could you show an example?
The open-coded 64-bit division without using do_div() shows up as
x86_64-linux-ld: drivers/mtd/ubi/nvmem.o: in function `ubi_nvmem_reg_read':
nvmem.c:(.text+0x10a): undefined reference to `__umoddi3'
x86_64-linux-ld: nvmem.c:(.text+0x11f): undefined reference to `__udivdi3'
x86_64-linux-ld: drivers/mtd/ubi/nvmem.o: in function `ubi_nvmem_reg_read.cold':
nvmem.c:(.text.unlikely+0x2d): undefined reference to `__umoddi3'
The idea is that gcc expects __umoddi3 to be provided by libgcc,
but Linux intentionally leaves it out in order to catch accidental
64-bit divisions.
Arnd
next prev parent reply other threads:[~2024-03-13 12:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-13 8:46 Arnd Bergmann
2024-03-13 11:29 ` Zhihao Cheng
2024-03-13 11:53 ` Arnd Bergmann
2024-03-13 12:10 ` Zhihao Cheng
2024-03-13 12:21 ` Arnd Bergmann [this message]
2024-03-13 13:29 ` Zhihao Cheng
2024-03-13 13:39 ` Arnd Bergmann
2024-03-13 13:43 ` Zhihao Cheng
2024-03-13 13:51 ` Arnd Bergmann
2024-03-13 13:41 ` Zhihao Cheng
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=b08aaae4-8c69-47eb-9658-5f3f5c8e4056@app.fastmail.com \
--to=arnd@kernel.org \
--cc=arnd@arndb.de \
--cc=chengzhihao1@huawei.com \
--cc=daniel@makrotopia.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.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®