aboutsummaryrefslogtreecommitdiffstats
path: root/module/zstd/Makefile.in
blob: 80096c3e379db5c4fd097e77a571035a22451f13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
ifneq ($(KBUILD_EXTMOD),)
src = @abs_srcdir@
obj = @abs_builddir@
zstd_include = $(src)/include
else
zstd_include = $(srctree)/$(src)/include
endif

MODULE := zzstd

obj-$(CONFIG_ZFS) := $(MODULE).o

asflags-y := -I$(zstd_include)
ccflags-y := -I$(zstd_include)

# Zstd uses -O3 by default, so we should follow
ccflags-y += -O3

# -fno-tree-vectorize gets set for gcc in zstd/common/compiler.h
# Set it for other compilers, too.
common_flags := -fno-tree-vectorize

# SSE register return with SSE disabled if -march=znverX is passed
common_flags += -U__BMI__

# Quiet warnings about frame size due to unused code in unmodified zstd lib
common_flags += -Wframe-larger-than=20480

ccflags-y += $(common_flags)

vanilla-objs := lib/common/entropy_common.o \
		lib/common/error_private.o \
		lib/common/fse_decompress.o \
		lib/common/pool.o \
		lib/common/zstd_common.o \
		lib/compress/fse_compress.o \
		lib/compress/hist.o \
		lib/compress/huf_compress.o \
		lib/compress/zstd_compress_literals.o \
		lib/compress/zstd_compress_sequences.o \
		lib/compress/zstd_compress_superblock.o \
		lib/compress/zstd_compress.o \
		lib/compress/zstd_double_fast.o \
		lib/compress/zstd_fast.o \
		lib/compress/zstd_lazy.o \
		lib/compress/zstd_ldm.o \
		lib/compress/zstd_opt.o \
		lib/decompress/huf_decompress.o \
		lib/decompress/zstd_ddict.o \
		lib/decompress/zstd_decompress.o \
		lib/decompress/zstd_decompress_block.o

# Disable aarch64 neon SIMD instructions for kernel mode
$(addprefix $(obj)/,$(vanilla-objs)) : ccflags-y += -include $(zstd_include)/aarch64_compat.h -include $(zstd_include)/zstd_compat_wrapper.h -Wp,-w $(common_flags)

$(obj)/zfs_zstd.o: ccflags-y += -include $(zstd_include)/zstd_compat_wrapper.h $(common_flags)

$(MODULE)-objs += zfs_zstd.o
$(MODULE)-objs += zstd_sparc.o
$(MODULE)-objs += $(vanilla-objs)

all:
	mkdir -p lib/common lib/compress lib/decompress

gensymbols:
	for obj in $(vanilla-objs); do echo; echo "/* $$obj: */"; @OBJDUMP@ -t $$obj | awk '$$2 == "g" && !/ zfs_/ {print "#define\t" $$6 " zfs_" $$6}' | sort; done >> include/zstd_compat_wrapper.h

checksymbols:
	@OBJDUMP@ -t $(vanilla-objs) | awk '/file format/ {print}  $$2 == "g" && !/ zfs_/ {++ret; print}  END {exit ret}'