From 662b7978fc63a8ad248561ecfdfcdaac0ddf331b Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Mon, 20 Jul 2026 20:13:05 +0200 Subject: [PATCH] Falcon: enable SSE2 for the fpr asm object in the LinuxKM build The generated wc_falcon_fpr_x86_64_asm.S implements the fpr seam with SSE2 scalar double math (mulsd/divsd/sqrtsd/ucomisd on xmm; no x87), so its object needs the vector instructions enabled in the assembler -- the same ASFLAGS_FPU_DISABLE_SIMD_ENABLE the other vectorized _asm.o files use -- plus OBJECT_FILES_NON_STANDARD for objtool. Run-time FPU state is handled by the SAVE_VECTOR_REGISTERS2() wrapping added in falcon.c. The C file falcon.o needs no rule: the kernel module uses the asm (or emulated) fpr backend, where falcon.c is integer-only, exactly as the ML-KEM/ML-DSA C poly files do. --- linuxkm/Kbuild | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/linuxkm/Kbuild b/linuxkm/Kbuild index e5974e4a93..b9bf722c2b 100644 --- a/linuxkm/Kbuild +++ b/linuxkm/Kbuild @@ -230,6 +230,12 @@ $(obj)/wolfcrypt/src/wc_mlkem_asm.o: asflags-y := $(WOLFSSL_ASFLAGS) $(ASFLAGS_F $(obj)/wolfcrypt/src/wc_mlkem_asm.o: OBJECT_FILES_NON_STANDARD := y $(obj)/wolfcrypt/src/wc_mldsa_asm.o: asflags-y := $(WOLFSSL_ASFLAGS) $(ASFLAGS_FPU_DISABLE_SIMD_ENABLE) $(obj)/wolfcrypt/src/wc_mldsa_asm.o: OBJECT_FILES_NON_STANDARD := y +# Native Falcon fpr backend: scalar double math on SSE2 (mulsd/divsd/sqrtsd, +# no x87), so it needs the vector insns enabled in the assembler like the other +# _asm.o here. The vector registers are saved at run time by the SAVE_VECTOR_ +# REGISTERS2() wrapping in falcon.c around signing and keygen. +$(obj)/wolfcrypt/src/wc_falcon_fpr_x86_64_asm.o: asflags-y := $(WOLFSSL_ASFLAGS) $(ASFLAGS_FPU_DISABLE_SIMD_ENABLE) +$(obj)/wolfcrypt/src/wc_falcon_fpr_x86_64_asm.o: OBJECT_FILES_NON_STANDARD := y ifndef READELF READELF := readelf