module/zstd: pass -U__BMI__

If kernel is compiled with -march=znver1 or -march=znver2 zstd module 
compilation will fail due to SSE register return with SSE disabled.
What's interesting, is that -march=skylake also implies -mbmi which 
defines __BMI__ but compilation succeeds.  It is probably due to 
different BMI implementations on AMD and INTEL processors and the 
way compiler uses instructions.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
Closes #10758 
Closes #10829
This commit is contained in:
Georgy Yakovlev 2020-08-27 15:50:13 -07:00 committed by GitHub
parent 770269ef3a
commit 735ba76104
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -356,4 +356,4 @@ CFLAGS.zil.c= -Wno-cast-qual
CFLAGS.zio.c= -Wno-cast-qual CFLAGS.zio.c= -Wno-cast-qual
CFLAGS.zrlock.c= -Wno-cast-qual CFLAGS.zrlock.c= -Wno-cast-qual
CFLAGS.zfs_zstd.c= -Wno-cast-qual -Wno-pointer-arith CFLAGS.zfs_zstd.c= -Wno-cast-qual -Wno-pointer-arith
CFLAGS.zstd.c= -fno-tree-vectorize CFLAGS.zstd.c= -fno-tree-vectorize -U__BMI__

View File

@ -20,6 +20,9 @@ ccflags-y += -O3
# Set it for other compilers, too. # Set it for other compilers, too.
$(obj)/lib/zstd.o: c_flags += -fno-tree-vectorize $(obj)/lib/zstd.o: c_flags += -fno-tree-vectorize
# SSE register return with SSE disabled if -march=znverX is passed
$(obj)/lib/zstd.o: c_flags += -U__BMI__
# Quiet warnings about frame size due to unused code in unmodified zstd lib # Quiet warnings about frame size due to unused code in unmodified zstd lib
$(obj)/lib/zstd.o: c_flags += -Wframe-larger-than=20480 $(obj)/lib/zstd.o: c_flags += -Wframe-larger-than=20480