From: Baokun Li <libaokun1@huawei.com>
To: Jan Kara <jack@suse.cz>
Cc: kernel test robot <lkp@intel.com>,
<oe-kbuild-all@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
Theodore Ts'o <tytso@mit.edu>, Zhang Yi <yi.zhang@huawei.com>,
Ojaswin Mujoo <ojaswin@linux.ibm.com>,
<cooper.qu@linux.alibaba.com>, <yunhai@linux.alibaba.com>
Subject: Re: {standard input}:4155: Error: pcrel offset for branch to .LS000B too far (0x38)
Date: Tue, 13 Jan 2026 10:13:49 +0800 [thread overview]
Message-ID: <b07ae769-6f10-484f-9291-a8b40f58c5f9@huawei.com> (raw)
In-Reply-To: <txzy4pnt3se34lsvbtpbgvndxts6xsydxx5sswdjzdrcie7zlq@63cewvtotbu3>
On 2026-01-13 00:35, Jan Kara wrote:
> Hi!
>
> On Mon 12-01-26 20:09:47, Baokun Li wrote:
>> On 2026-01-12 17:42, kernel test robot wrote:
>>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>>> head: 0f61b1860cc3f52aef9036d7235ed1f017632193
>>> commit: a6d73242b8b5caa9f9a529eab49cc1e85ace9890 ext4: support large block size in ext4_mpage_readpages()
>>> date: 6 weeks ago
>>> config: csky-randconfig-001-20260112 (https://download.01.org/0day-ci/archive/20260112/202601121758.kA3osRht-lkp@intel.com/config)
>>> compiler: csky-linux-gcc (GCC) 15.2.0
>>> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260112/202601121758.kA3osRht-lkp@intel.com/reproduce)
>>>
>>> If you fix the issue in a separate patch/commit (i.e. not just a new version of
>>> the same patch/commit), kindly add following tags
>>> | Reported-by: kernel test robot <lkp@intel.com>
>>> | Closes: https://lore.kernel.org/oe-kbuild-all/202601121758.kA3osRht-lkp@intel.com/
>>>
>>> All errors (new ones prefixed by >>):
>>>
>>> {standard input}: Assembler messages:
>>>>> {standard input}:4155: Error: pcrel offset for branch to .LS000B too far (0x38)
>> Hi,
>>
>> Thanks for the report.
>>
>> After looking into this issue, it turns out that replacing the original
>> calculation with the macro version causes the compiler to emit a larger
>> sequence of instructions.
>>
>> On most architectures this is harmless, because their GCC backends support
>> proper branch relaxation and can automatically promote a short branch to
>> a long branch when the offset grows.
>>
>> However, the CSKY GCC backend does not implement branch relaxation. As a
>> result, once the generated basic block becomes slightly larger, some short
>> branch instructions can no longer reach their targets, and the assembler
>> reports the “pcrel offset too far” error.
>>
>> Given this, one possible workaround on the kernel side would be to replace
>> the macro with a static inline helper. Using an inline function allows GCC
>> to perform more aggressive optimization and typically avoids generating
>> unnecessarily large instruction sequences, which helps prevent the
>> short-branch overflow seen on CSKY.
>>
>> However, the more general and robust solution would be to improve the
>> CSKY GCC backend so that it supports proper branch relaxation, as other
>> architectures do. With branch relaxation in place, these issues would not
>> depend on how the code is written.
>>
>> We’d appreciate any thoughts on which approach makes more sense.
> Frankly, since this is such a niche platform, I'd just let those guys fix
> their compiler and don't complicate ext4 codebase for that.
>
> Honza
That makes sense. I’ve CC'd the GCC C-SKY port maintainers.
Let's see if they have any thoughts.
Regards,
Baokun
prev parent reply other threads:[~2026-01-13 2:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-12 9:42 kernel test robot
2026-01-12 12:09 ` Baokun Li
2026-01-12 16:35 ` Jan Kara
2026-01-13 2:13 ` Baokun Li [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=b07ae769-6f10-484f-9291-a8b40f58c5f9@huawei.com \
--to=libaokun1@huawei.com \
--cc=cooper.qu@linux.alibaba.com \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=ojaswin@linux.ibm.com \
--cc=tytso@mit.edu \
--cc=yi.zhang@huawei.com \
--cc=yunhai@linux.alibaba.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®