riscv: Add norvc after .option arch in runtime const
PATCH 1/1 riscv: Add norvc after .option arch in runtime const
.option arch clobbers .option norvc. Prevent gas from emitting compressed instructions in the runtime const alternative blocks by setting .option norvc after .option arch. This issue starts appearing on gcc 15, which adds zca to the march.
Reported by: Klara Modin <[email protected]>
--- arch/riscv/include/asm/runtime-const.h | 2 ++ 1 file changed, 2 insertions(+)
arch/riscv/include/asm/runtime-const.h +2 -0
@@ -56,6 +56,7 @@#define RISCV_RUNTIME_CONST_64_ZBA \ ".option push\n\t" \ ".option arch,+zba\n\t" \ + ".option norvc\n\t" \ "slli %[__tmp],%[__tmp],32\n\t" \ "add.uw %[__ret],%[__ret],%[__tmp]\n\t" \ "nop\n\t" \
@@ -65,6 +66,7 @@#define RISCV_RUNTIME_CONST_64_ZBKB \ ".option push\n\t" \ ".option arch,+zbkb\n\t" \ + ".option norvc\n\t" \ "pack %[__ret],%[__ret],%[__tmp]\n\t" \ "nop\n\t" \ "nop\n\t" \
---
base-commit: b2117b630c48be69d2782ed79fefe35dcd192ce6
change-id: 20250331-fix_runtime_const_norvc-407af1f24541
Signature · 1 line
- Charlie
Palmer Dabbelt
maintainerQuoted 4 lines · Charlie Jenkins
.option arch clobbers .option norvc. Prevent gas from emitting compressed instructions in the runtime const alternative blocks by setting .option norvc after .option arch. This issue starts appearing on gcc 15, which adds zca to the march.
There's some clunkiness around ".option arch" and ".option rvc". So this might be an assembler bug, but IMO it's sane to just work around it in Linux -- at a bare minimum it'll manifest for users, as binutils already released (and GCC 15 is just enabling the Kconfig that triggers the bug).
Quoted 1 line
Reported by: Klara Modin <[email protected]>
There shouldn't be a newline here, I'll just drop it.
Quoted 29 lines
Signed-off-by Charlie Jenkins <[email protected]>Fixes a44fb5722199 ("riscv: Add runtime constant support")--- arch/riscv/include/asm/runtime-const.h | 2 ++ 1 file changed, 2 insertions(+)arch/riscv/include/asm/runtime-const.h +2
-1@@ -56,6 +56,7 @@#define RISCV_RUNTIME_CONST_64_ZBA \ ".option push\n\t" \ ".option arch,+zba\n\t" \ + ".option norvc\n\t" \ "slli %[__tmp],%[__tmp],32\n\t" \ "add.uw %[__ret],%[__ret],%[__tmp]\n\t" \ "nop\n\t" \@@ -65,6 +66,7 @@#define RISCV_RUNTIME_CONST_64_ZBKB \ ".option push\n\t" \ ".option arch,+zbkb\n\t" \ + ".option norvc\n\t" \ "pack %[__ret],%[__ret],%[__tmp]\n\t" \ "nop\n\t" \ "nop\n\t" \ ---
Quoted 2 lines
base-commit:
b2117b630c48be69d2782ed79fefe35dcd192ce6
change-id: 20250331-fix_runtime_const_norvc-407af1f24541
Thanks!
Quoted 36 lines · Charlie Jenkins
.option arch clobbers .option norvc. Prevent gas from emitting compressed instructions in the runtime const alternative blocks by setting .option norvc after .option arch. This issue starts appearing on gcc 15, which adds zca to the march.
Reported by: Klara Modin <[email protected]>
Signed-off-by Charlie Jenkins <[email protected]>Fixes a44fb5722199 ("riscv: Add runtime constant support")--- arch/riscv/include/asm/runtime-const.h | 2 ++ 1 file changed, 2 insertions(+)arch/riscv/include/asm/runtime-const.h +2
-1@@ -56,6 +56,7 @@#define RISCV_RUNTIME_CONST_64_ZBA \ ".option push\n\t" \ ".option arch,+zba\n\t" \ + ".option norvc\n\t" \ "slli %[__tmp],%[__tmp],32\n\t" \ "add.uw %[__ret],%[__ret],%[__tmp]\n\t" \ "nop\n\t" \@@ -65,6 +66,7 @@#define RISCV_RUNTIME_CONST_64_ZBKB \ ".option push\n\t" \ ".option arch,+zbkb\n\t" \ + ".option norvc\n\t" \ "pack %[__ret],%[__ret],%[__tmp]\n\t" \ "nop\n\t" \ "nop\n\t" \ ---
Quoted 2 lines
base-commit:
b2117b630c48be69d2782ed79fefe35dcd192ce6
change-id: 20250331-fix_runtime_const_norvc-407af1f24541
Thanks!
Quoted 19 lines · Charlie Jenkins
.option arch clobbers .option norvc. Prevent gas from emitting compressed instructions in the runtime const alternative blocks by setting .option norvc after .option arch. This issue starts appearing on gcc 15, which adds zca to the march.
Reported by: Klara Modin <[email protected]>
Signed-off-by Charlie Jenkins <[email protected]>Fixes a44fb5722199 ("riscv: Add runtime constant support")--- arch/riscv/include/asm/runtime-const.h | 2 ++ 1 file changed, 2 insertions(+)arch/riscv/include/asm/runtime-const.h +0
-0
arch/riscv/include/asm/runtime-const.h line 59
Quoted 4 lines
arch/riscv/include/asm/runtime-const.h +1
-0@@ -56,6 +56,7 @@#define RISCV_RUNTIME_CONST_64_ZBA \ ".option push\n\t" \ ".option arch,+zba\n\t" \ + ".option norvc\n\t" \
Hey Charlie,
Could ".option arch,+zba,-c" be used as well ? That way, c is treated like any other arch option. Or does norvc has other side effects ?
Thanks,
Clément
Quoted 15 lines
arch/riscv/include/asm/runtime-const.h +1
-1"slli %[__tmp],%[__tmp],32\n\t" \"add.uw %[__ret],%[__ret],%[__tmp]\n\t" \"nop\n\t" \@@ -65,6 +66,7 @@#define RISCV_RUNTIME_CONST_64_ZBKB \ ".option push\n\t" \ ".option arch,+zbkb\n\t" \ + ".option norvc\n\t" \ "pack %[__ret],%[__ret],%[__tmp]\n\t" \ "nop\n\t" \ "nop\n\t" \ ---base-commit:
b2117b630c48be69d2782ed79fefe35dcd192ce6
change-id: 20250331-fix_runtime_const_norvc-407af1f24541
This patch was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:
Hello:
This patch was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:
Quoted 8 lines · On Mon, 31 Mar 2025 11:45:24 -0700 you wrote:
.option arch clobbers .option norvc. Prevent gas from emitting compressed instructions in the runtime const alternative blocks by setting .option norvc after .option arch. This issue starts appearing on gcc 15, which adds zca to the march.
Reported by: Klara Modin <[email protected]>
[...]
Here is the summary with links:
- [FOR-NEXT] riscv: Add norvc after .option arch in runtime const
https://git.kernel.org/riscv/c/95c18b7ccdd1
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html