LKML Archive on
 help / color / Atom feed
* [PATCH v2 2/4] selftests: Fix seccomp to support relocatable build (O=objdir)
@ 2020-03-05  0:36 Shuah Khan
  2020-03-05  2:20 ` Kees Cook
  0 siblings, 1 reply; 5+ messages in thread
From: Shuah Khan @ 2020-03-05  0:36 UTC (permalink / raw)
  To: shuah, keescook, luto, wad, daniel, kafai, yhs, andriin, gregkh, tglx
  Cc: Shuah Khan, khilman, mpe, linux-kselftest, linux-kernel, netdev, bpf

Fix seccomp relocatable builds. This is a simple fix to use the
right variable TEST_CUSTOM_PROGS to continue to do custom
build to preserve dependency on kselftest_harness.h local header.
This change applies cutom rule to seccomp_bpf seccomp_benchmark
for a simpler logic. 

Uses $(OUTPUT) defined in to handle build relocation.

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 <>
 tools/testing/selftests/seccomp/Makefile | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/tools/testing/selftests/seccomp/Makefile b/tools/testing/selftests/seccomp/Makefile
index 1760b3e39730..355bcbc0394a 100644
--- a/tools/testing/selftests/seccomp/Makefile
+++ b/tools/testing/selftests/seccomp/Makefile
@@ -1,17 +1,16 @@
 # SPDX-License-Identifier: GPL-2.0
-include ../
+CFLAGS += -Wl,-no-as-needed -Wall
+LDFLAGS += -lpthread
 .PHONY: all clean
-BINARIES := seccomp_bpf seccomp_benchmark
-CFLAGS += -Wl,-no-as-needed -Wall
+include ../
+# OUTPUT set by
+TEST_CUSTOM_PROGS := $(OUTPUT)/seccomp_bpf $(OUTPUT)/seccomp_benchmark
-seccomp_bpf: seccomp_bpf.c ../kselftest_harness.h
-	$(CC) $(CFLAGS) $(LDFLAGS) $< -lpthread -o $@
+$(TEST_CUSTOM_PROGS): ../kselftest_harness.h
-all: $(BINARIES)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-05  0:36 [PATCH v2 2/4] selftests: Fix seccomp to support relocatable build (O=objdir) Shuah Khan
2020-03-05  2:20 ` Kees Cook
2020-03-05 16:41   ` Shuah Khan
2020-03-05 17:42     ` Kees Cook
2020-03-10 23:11       ` Shuah Khan

LKML Archive on

Archives are clonable:
	git clone --mirror lkml/git/0.git
	git clone --mirror lkml/git/1.git
	git clone --mirror lkml/git/2.git
	git clone --mirror lkml/git/3.git
	git clone --mirror lkml/git/4.git
	git clone --mirror lkml/git/5.git
	git clone --mirror lkml/git/6.git
	git clone --mirror lkml/git/7.git
	git clone --mirror lkml/git/8.git
	git clone --mirror lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ \
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone