From 49a9e070f5dc7fdb0e39fdfdbbf998451c75a68e Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Fri, 12 Mar 2021 15:31:38 -0800 Subject: [PATCH] [contrib][linux-kernel] Update test include stubs Update the test include stubs so they are able to run the current zstd version in the kernel, so I can compare stack usage. --- contrib/linux-kernel/test/Makefile | 7 ++++--- contrib/linux-kernel/test/include/linux/compiler.h | 4 ++++ contrib/linux-kernel/test/include/linux/kernel.h | 4 ++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/contrib/linux-kernel/test/Makefile b/contrib/linux-kernel/test/Makefile index 80bce74db..794671386 100644 --- a/contrib/linux-kernel/test/Makefile +++ b/contrib/linux-kernel/test/Makefile @@ -7,9 +7,9 @@ CPPFLAGS += -I$(LINUX)/include -I$(LINUX_ZSTDLIB) -Iinclude -DNDEBUG CPPFLAGS += -DZSTD_ASAN_DONT_POISON_WORKSPACE LINUX_ZSTD_MODULE := $(wildcard $(LINUX_ZSTDLIB)/*.c) -LINUX_ZSTD_COMMON := $(wildcard $(LINUX_ZSTDLIB)/common/*.c) -LINUX_ZSTD_COMPRESS := $(wildcard $(LINUX_ZSTDLIB)/compress/*.c) -LINUX_ZSTD_DECOMPRESS := $(wildcard $(LINUX_ZSTDLIB)/decompress/*.c) +LINUX_ZSTD_COMMON := $(wildcard $(LINUX_ZSTDLIB)/common/*.c) +LINUX_ZSTD_COMPRESS := $(wildcard $(LINUX_ZSTDLIB)/compress/*.c) +LINUX_ZSTD_DECOMPRESS := $(wildcard $(LINUX_ZSTDLIB)/decompress/*.c) LINUX_ZSTD_FILES := $(LINUX_ZSTD_MODULE) $(LINUX_ZSTD_COMMON) $(LINUX_ZSTD_COMPRESS) $(LINUX_ZSTD_DECOMPRESS) LINUX_ZSTD_OBJECTS := $(LINUX_ZSTD_FILES:.c=.o) @@ -29,6 +29,7 @@ run-test: test static_test .PHONY: clean: + $(RM) -f $(LINUX_ZSTDLIB)/*.o $(RM) -f $(LINUX_ZSTDLIB)/**/*.o $(RM) -f *.o *.a $(RM) -f test diff --git a/contrib/linux-kernel/test/include/linux/compiler.h b/contrib/linux-kernel/test/include/linux/compiler.h index 58c711816..ea3422ee3 100644 --- a/contrib/linux-kernel/test/include/linux/compiler.h +++ b/contrib/linux-kernel/test/include/linux/compiler.h @@ -14,4 +14,8 @@ #define inline __inline __attribute__((unused)) #endif +#ifndef noinline +#define noinline __attribute__((noinline)) +#endif + #endif diff --git a/contrib/linux-kernel/test/include/linux/kernel.h b/contrib/linux-kernel/test/include/linux/kernel.h index 9b481ef47..1f702abac 100644 --- a/contrib/linux-kernel/test/include/linux/kernel.h +++ b/contrib/linux-kernel/test/include/linux/kernel.h @@ -12,4 +12,8 @@ #define WARN_ON(x) +#define PTR_ALIGN(p, a) (typeof(p))ALIGN((unsigned long long)(p), (a)) +#define ALIGN(x, a) ALIGN_MASK((x), (a) - 1) +#define ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask)) + #endif