Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: Fix seccomp to support relocatable build (O=objdir)

Fix seccomp relocatable builds. This is a simple fix to use the
right lib.mk variable TEST_GEN_PROGS. Local header dependency
is addressed in a change to lib.mk as a framework change that
enforces the dependency without requiring changes to individual
tests.

The following use-cases work with this change:

In seccomp directory:
make all and make clean

From top level from main Makefile:
make kselftest-install O=objdir ARCH=arm64 HOSTCC=gcc \
CROSS_COMPILE=aarch64-linux-gnu- TARGETS=seccomp

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

+3 -14
+3 -14
tools/testing/selftests/seccomp/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 - all: 3 - 4 - include ../lib.mk 5 - 6 - .PHONY: all clean 7 - 8 - BINARIES := seccomp_bpf seccomp_benchmark 9 2 CFLAGS += -Wl,-no-as-needed -Wall 3 + LDFLAGS += -lpthread 10 4 11 - seccomp_bpf: seccomp_bpf.c ../kselftest_harness.h 12 - $(CC) $(CFLAGS) $(LDFLAGS) $< -lpthread -o $@ 13 - 14 - TEST_PROGS += $(BINARIES) 15 - EXTRA_CLEAN := $(BINARIES) 16 - 17 - all: $(BINARIES) 5 + TEST_GEN_PROGS := seccomp_bpf seccomp_benchmark 6 + include ../lib.mk