aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/lib.mk
diff options
context:
space:
mode:
authorTommi Rantala <tommi.t.rantala@nokia.com>2020-10-08 15:26:21 +0300
committerShuah Khan <skhan@linuxfoundation.org>2020-10-27 16:51:06 -0600
commitf825d3f7ed9305e7dd0a3e0a74673a4257d0cc53 (patch)
tree243b8591e4106cfe7cecb9378067d2dcfe003e4e /tools/testing/selftests/lib.mk
parentselftests/ftrace: check for do_sys_openat2 in user-memory test (diff)
downloadlinux-dev-f825d3f7ed9305e7dd0a3e0a74673a4257d0cc53.tar.xz
linux-dev-f825d3f7ed9305e7dd0a3e0a74673a4257d0cc53.zip
selftests: filter kselftest headers from command in lib.mk
Commit 1056d3d2c97e ("selftests: enforce local header dependency in lib.mk") added header dependency to the rule, but as the rule uses $^, the headers are added to the compiler command line. This can cause unexpected precompiled header files being generated when compilation fails: $ echo { >> openat2_test.c $ make gcc -Wall -O2 -g -fsanitize=address -fsanitize=undefined openat2_test.c tools/testing/selftests/kselftest_harness.h tools/testing/selftests/kselftest.h helpers.c -o tools/testing/selftests/openat2/openat2_test openat2_test.c:313:1: error: expected identifier or ‘(’ before ‘{’ token 313 | { | ^ make: *** [../lib.mk:140: tools/testing/selftests/openat2/openat2_test] Error 1 $ file openat2_test* openat2_test: GCC precompiled header (version 014) for C openat2_test.c: C source, ASCII text Fix it by filtering out the headers, so that we'll only pass the actual *.c files in the compiler command line. Fixes: 1056d3d2c97e ("selftests: enforce local header dependency in lib.mk") Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com> Acked-by: Kees Cook <keescook@chromium.org> Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/lib.mk')
-rw-r--r--tools/testing/selftests/lib.mk2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 30848ca36555..a5ce26d548e4 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -136,7 +136,7 @@ endif
ifeq ($(OVERRIDE_TARGETS),)
LOCAL_HDRS := $(selfdir)/kselftest_harness.h $(selfdir)/kselftest.h
$(OUTPUT)/%:%.c $(LOCAL_HDRS)
- $(LINK.c) $^ $(LDLIBS) -o $@
+ $(LINK.c) $(filter-out $(LOCAL_HDRS),$^) $(LDLIBS) -o $@
$(OUTPUT)/%.o:%.S
$(COMPILE.S) $^ -o $@