Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion linuxkm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,25 @@ endif
$(obj)/$(LIBWOLFSSL_NAME).mod.o: ccflags-y := $(PIE_SUPPORT_FLAGS)
$(obj)/wolfcrypt/test/test.o: ccflags-y += -DNO_MAIN_DRIVER -DWOLFSSL_NO_OPTIONS_H
$(obj)/wolfcrypt/src/aes.o: ccflags-y := $(WOLFSSL_CFLAGS) $(WOLFSSL_CFLAGS_YES_VECTOR_INSNS) $(PIE_FLAGS) $(PIE_SUPPORT_FLAGS)
$(obj)/wolfcrypt/benchmark/benchmark.o: ccflags-y := $(WOLFSSL_CFLAGS) $(CFLAGS_FPU_ENABLE) $(CFLAGS_SIMD_ENABLE) $(CFLAGS_AUTO_VECTORIZE_DISABLE) $(PIE_SUPPORT_FLAGS) -DNO_MAIN_FUNCTION -DWOLFSSL_NO_OPTIONS_H
# benchmark.c used to compute its statistics in double, so this object alone
# was built with the FPU and SSE enabled while every other object in the module
# gets $(WOLFSSL_CFLAGS_NO_VECTOR_INSNS). That permission outlived its reason:
# under WC_BENCH_INT_ONLY, which is automatic for WOLFSSL_LINUXKM, the
# statistics are 64-bit integer work and no floating point remains.
#
# Leaving it enabled was not free. gcc used the permission for things that
# have nothing to do with arithmetic -- zeroing a stack buffer with
# "pxor %xmm0,%xmm0" and a run of movaps -- and emitted them in the function
# PROLOGUE, before the SAVE_VECTOR_REGISTERS() that bench_stats_start() opens.
# 21 reachable bench_* functions wrote %xmm0 with no kernel_fpu_begin() in
# effect, and nothing outside brackets them: init_module() calls
# wolfcrypt_benchmark_main() directly, and neither it nor benchmark_test()
# opens a bracket.
#
# Disabling vector instructions here fixes that at the source rather than by
# widening a bracket. The bracket in bench_stats_start() still has to exist:
# it is there for the benchmarked CRYPTO, which does use SIMD.
$(obj)/wolfcrypt/benchmark/benchmark.o: ccflags-y := $(WOLFSSL_CFLAGS) $(WOLFSSL_CFLAGS_NO_VECTOR_INSNS) $(CFLAGS_AUTO_VECTORIZE_DISABLE) $(PIE_SUPPORT_FLAGS) -DNO_MAIN_FUNCTION -DWOLFSSL_NO_OPTIONS_H

asflags-y := $(WOLFSSL_ASFLAGS) $(ASFLAGS_FPUSIMD_DISABLE)

Expand Down
Loading
Loading