]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
riscv: Add norvc after .option arch in runtime const
authorCharlie Jenkins <charlie@rivosinc.com>
Mon, 31 Mar 2025 18:45:24 +0000 (11:45 -0700)
committerPalmer Dabbelt <palmer@rivosinc.com>
Mon, 31 Mar 2025 18:53:02 +0000 (11:53 -0700)
.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 <klarasmodin@gmail.com>
Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Fixes: a44fb5722199 ("riscv: Add runtime constant support")
Closes: https://lore.kernel.org/all/cc8f3525-20b7-445b-877b-2add28a160a2@gmail.com/
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20250331-fix_runtime_const_norvc-v1-1-89bc62687ab8@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/runtime-const.h

index ea2e49c7149cdcee61a1cb37a58db358cf3eaecf..1ba0985a7ffeaacdfc6e57a9fecb47ca874e9d55 100644 (file)
@@ -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"                                               \