* [PATCH v4] selftests: Fix seccomp to support relocatable build (O=objdir)
@ 2020-03-25 23:16 Shuah Khan
2020-03-25 23:26 ` Kees Cook
0 siblings, 1 reply; 2+ messages in thread
From: Shuah Khan @ 2020-03-25 23:16 UTC (permalink / raw)
To: keescook, luto, wad, shuah, mpe; +Cc: Shuah Khan, linux-kselftest, linux-kernel
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>
---
Changes since v3:
Simplified logic based on comments from Kees and Michael
tools/testing/selftests/seccomp/Makefile | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/tools/testing/selftests/seccomp/Makefile b/tools/testing/selftests/seccomp/Makefile
index 1760b3e39730..0ebfe8b0e147 100644
--- a/tools/testing/selftests/seccomp/Makefile
+++ b/tools/testing/selftests/seccomp/Makefile
@@ -1,17 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
-all:
-
-include ../lib.mk
-
-.PHONY: all clean
-
-BINARIES := seccomp_bpf seccomp_benchmark
CFLAGS += -Wl,-no-as-needed -Wall
+LDFLAGS += -lpthread
-seccomp_bpf: seccomp_bpf.c ../kselftest_harness.h
- $(CC) $(CFLAGS) $(LDFLAGS) $< -lpthread -o $@
-
-TEST_PROGS += $(BINARIES)
-EXTRA_CLEAN := $(BINARIES)
-
-all: $(BINARIES)
+TEST_GEN_PROGS := seccomp_bpf seccomp_benchmark
+include ../lib.mk
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v4] selftests: Fix seccomp to support relocatable build (O=objdir)
2020-03-25 23:16 [PATCH v4] selftests: Fix seccomp to support relocatable build (O=objdir) Shuah Khan
@ 2020-03-25 23:26 ` Kees Cook
0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2020-03-25 23:26 UTC (permalink / raw)
To: Shuah Khan; +Cc: luto, wad, shuah, mpe, linux-kselftest, linux-kernel
On Wed, Mar 25, 2020 at 05:16:02PM -0600, Shuah Khan wrote:
> 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>
Thanks for getting this fixed. :)
Acked-by: Kees Cook <keescook@chromium.org>
-Kees
> ---
> Changes since v3:
> Simplified logic based on comments from Kees and Michael
>
> tools/testing/selftests/seccomp/Makefile | 17 +++--------------
> 1 file changed, 3 insertions(+), 14 deletions(-)
>
> diff --git a/tools/testing/selftests/seccomp/Makefile b/tools/testing/selftests/seccomp/Makefile
> index 1760b3e39730..0ebfe8b0e147 100644
> --- a/tools/testing/selftests/seccomp/Makefile
> +++ b/tools/testing/selftests/seccomp/Makefile
> @@ -1,17 +1,6 @@
> # SPDX-License-Identifier: GPL-2.0
> -all:
> -
> -include ../lib.mk
> -
> -.PHONY: all clean
> -
> -BINARIES := seccomp_bpf seccomp_benchmark
> CFLAGS += -Wl,-no-as-needed -Wall
> +LDFLAGS += -lpthread
>
> -seccomp_bpf: seccomp_bpf.c ../kselftest_harness.h
> - $(CC) $(CFLAGS) $(LDFLAGS) $< -lpthread -o $@
> -
> -TEST_PROGS += $(BINARIES)
> -EXTRA_CLEAN := $(BINARIES)
> -
> -all: $(BINARIES)
> +TEST_GEN_PROGS := seccomp_bpf seccomp_benchmark
> +include ../lib.mk
> --
> 2.20.1
>
--
Kees Cook
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-25 23:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-25 23:16 [PATCH v4] selftests: Fix seccomp to support relocatable build (O=objdir) Shuah Khan
2020-03-25 23:26 ` Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).