Re: [PATCH v10 2/2] riscv: Add runtime constant support

From: Klara Modin
Date: Fri Mar 28 2025 - 16:22:37 EST


On 3/28/25 20:51, Charlie Jenkins wrote:
On Fri, Mar 28, 2025 at 04:42:42PM +0100, Klara Modin wrote:
Hi,

On 3/19/25 19:35, Charlie Jenkins wrote:
Implement the runtime constant infrastructure for riscv. Use this
infrastructure to generate constants to be used by the d_hash()
function.

This is the riscv variant of commit 94a2bc0f611c ("arm64: add 'runtime
constant' support") and commit e3c92e81711d ("runtime constants: add
x86 architecture support").

This patch causes the following build failure for me:

fs/dcache.c: Assembler messages:
fs/dcache.c:157: Error: attempt to move .org backwards
fs/dcache.c:157: Error: attempt to move .org backwards
fs/dcache.c:157: Error: attempt to move .org backwards
fs/dcache.c:157: Error: attempt to move .org backwards
fs/dcache.c:157: Error: attempt to move .org backwards
make[3]: *** [scripts/Makefile.build:203: fs/dcache.o] Error 1

Thank you for the report, this seems like a binutils issue potentially.
I will look into it. Here is a minimally reproducible example:

886 :
.option push
.option norvc
nop
nop
.option pop
887 :
888 :
.option push
.option norvc
.option arch,+zba
nop
nop
.option pop
889 :
.org . - (887b - 886b) + (889b - 888b)
.org . - (889b - 888b) + (887b - 886b)

Removing the ".option arch,+zba" fixes the issue but that shouldn't
matter...

I tried again with GCC 14.2 and 12.4 (with the same binutils version) after Alex's answer and couldn't see the issue with these. I got the same result with your example. If I invoke `as` directly it doesn't happen either.

The issue might be with GCC 15 then?

Regards,
Klara Modin


- Charlie


The value of CONFIG_RISCV_ISA_ZBKB doesn't seem to have an impact. Reverting
the patch on top of next-20250328 resolved the issue for me. I attached the
generated fs/dcache.s.

Please let me know if there's anything else you need.

Regards,
Klara Modin