Skip to content

Commit

Permalink
avoid symbol collission with in-kernel zstdlib
Browse files Browse the repository at this point in the history
in case zfs is compiled as in kernel static variant
and the in kernel zstd library is compiled static into the kernel, a
symbol collision will occur. this wrapper header does rename all
relevant zstd function to avoid this problem

Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
  • Loading branch information
BrainSlayer committed Aug 22, 2020
1 parent b3b2cad commit 2fee275
Show file tree
Hide file tree
Showing 4 changed files with 456 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/libzstd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ nodist_libzstd_la_SOURCES = $(KERNEL_C)

# -fno-tree-vectorize is set for gcc in zstd/common/compiler.h
# Set it for other compilers, too.
lib/zstd.$(OBJEXT): CFLAGS += -fno-tree-vectorize
lib/zstd.l$(OBJEXT): CFLAGS += -fno-tree-vectorize
lib/zstd.$(OBJEXT): CFLAGS += -fno-tree-vectorize -include $(top_srcdir)/module/zstd/include/zstd_compat_wrapper.h -Wp,-w
lib/zstd.l$(OBJEXT): CFLAGS += -fno-tree-vectorize -include $(top_srcdir)/module/zstd/include/zstd_compat_wrapper.h -Wp,-w

zfs_zstd.$(OBJEXT): CFLAGS += -include $(top_srcdir)/module/zstd/include/zstd_compat_wrapper.h
zfs_zstd.l$(OBJEXT): CFLAGS += -include $(top_srcdir)/module/zstd/include/zstd_compat_wrapper.h

# Quiet warnings about frame size due to unused code in unmodified zstd lib
lib/zstd.$(OBJEXT): CFLAGS += -Wframe-larger-than=20480
Expand Down
4 changes: 3 additions & 1 deletion module/zstd/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ $(obj)/lib/zstd.o: c_flags += -fno-tree-vectorize
$(obj)/lib/zstd.o: c_flags += -Wframe-larger-than=20480

# Disable aarch64 neon SIMD instructions for kernel mode
$(obj)/lib/zstd.o: c_flags += -include $(zstd_include)/aarch64_compat.h
$(obj)/lib/zstd.o: c_flags += -include $(zstd_include)/aarch64_compat.h -include $(zstd_include)/zstd_compat_wrapper.h -Wp,-w

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

$(MODULE)-objs += zfs_zstd.o
$(MODULE)-objs += lib/zstd.o
Expand Down

0 comments on commit 2fee275

Please sign in to comment.