* [PATCH bpf 0/2] Two fixes for make kselftest TARGETS=bpf
@ 2020-06-02 17:56 Ilya Leoshkevich
2020-06-02 17:56 ` [PATCH bpf 1/2] tools/bpf: Don't use $(COMPILE.c) Ilya Leoshkevich
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ilya Leoshkevich @ 2020-06-02 17:56 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann
Cc: bpf, Heiko Carstens, Vasily Gorbik, Sumanth Korikkar, Ilya Leoshkevich
While the primary documented way to run BPF tests is by invoking
make in tools/testing/selftests/bpf, kselftest documentation implies that
make kselftest TARGETS=bpf from the top directory should work as well.
This patch series contains two fixes that were neccesary to make it run:
- Patch 1: $(COMPILE.c) -> $(CC) $(CFLAGS) -c
- Patch 2: Add CXX=$(CROSS_COMPILE)g++ default value
Ilya Leoshkevich (2):
tools/bpf: Don't use $(COMPILE.c)
selftests/bpf: Add a default $(CXX) value
tools/bpf/Makefile | 6 +++---
tools/bpf/bpftool/Makefile | 8 ++++----
tools/testing/selftests/bpf/Makefile | 1 +
3 files changed, 8 insertions(+), 7 deletions(-)
--
2.25.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH bpf 1/2] tools/bpf: Don't use $(COMPILE.c)
2020-06-02 17:56 [PATCH bpf 0/2] Two fixes for make kselftest TARGETS=bpf Ilya Leoshkevich
@ 2020-06-02 17:56 ` Ilya Leoshkevich
2020-06-02 17:56 ` [PATCH bpf 2/2] selftests/bpf: Add a default $(CXX) value Ilya Leoshkevich
2020-06-02 20:37 ` [PATCH bpf 0/2] Two fixes for make kselftest TARGETS=bpf Daniel Borkmann
2 siblings, 0 replies; 4+ messages in thread
From: Ilya Leoshkevich @ 2020-06-02 17:56 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann
Cc: bpf, Heiko Carstens, Vasily Gorbik, Sumanth Korikkar, Ilya Leoshkevich
When using make kselftest TARGETS=bpf, tools/bpf is built with
MAKEFLAGS=rR, which causes $(COMPILE.c) to be undefined, which in turn
causes the build to fail with
CC kselftest/bpf/tools/build/bpftool/map_perf_ring.o
/bin/sh: 1: -MMD: not found
Fix by using $(CC) $(CFLAGS) -c instead of $(COMPILE.c).
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
tools/bpf/Makefile | 6 +++---
tools/bpf/bpftool/Makefile | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
index f897eeeb0b4f..77472e28c8fd 100644
--- a/tools/bpf/Makefile
+++ b/tools/bpf/Makefile
@@ -64,12 +64,12 @@ $(OUTPUT)%.lex.c: $(srctree)/tools/bpf/%.l
$(QUIET_FLEX)$(LEX) -o $@ $<
$(OUTPUT)%.o: $(srctree)/tools/bpf/%.c
- $(QUIET_CC)$(COMPILE.c) -o $@ $<
+ $(QUIET_CC)$(CC) $(CFLAGS) -c -o $@ $<
$(OUTPUT)%.yacc.o: $(OUTPUT)%.yacc.c
- $(QUIET_CC)$(COMPILE.c) -o $@ $<
+ $(QUIET_CC)$(CC) $(CFLAGS) -c -o $@ $<
$(OUTPUT)%.lex.o: $(OUTPUT)%.lex.c
- $(QUIET_CC)$(COMPILE.c) -o $@ $<
+ $(QUIET_CC)$(CC) $(CFLAGS) -c -o $@ $<
PROGS = $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg $(OUTPUT)bpf_asm
diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index f584d1fdfc64..4df7ed7e47da 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -121,7 +121,7 @@ else
endif
$(OUTPUT)_prog.o: prog.c
- $(QUIET_CC)$(COMPILE.c) -MMD -DBPFTOOL_WITHOUT_SKELETONS -o $@ $<
+ $(QUIET_CC)$(CC) $(CFLAGS) -c -MMD -DBPFTOOL_WITHOUT_SKELETONS -o $@ $<
$(OUTPUT)_bpftool: $(_OBJS) $(LIBBPF)
$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(_OBJS) $(LIBS)
@@ -136,10 +136,10 @@ profiler.skel.h: $(OUTPUT)_bpftool skeleton/profiler.bpf.o
$(QUIET_GEN)$(OUTPUT)./_bpftool gen skeleton skeleton/profiler.bpf.o > $@
$(OUTPUT)prog.o: prog.c profiler.skel.h
- $(QUIET_CC)$(COMPILE.c) -MMD -o $@ $<
+ $(QUIET_CC)$(CC) $(CFLAGS) -c -MMD -o $@ $<
$(OUTPUT)disasm.o: $(srctree)/kernel/bpf/disasm.c
- $(QUIET_CC)$(COMPILE.c) -MMD -o $@ $<
+ $(QUIET_CC)$(CC) $(CFLAGS) -c -MMD -o $@ $<
$(OUTPUT)feature.o: | zdep
@@ -147,7 +147,7 @@ $(OUTPUT)bpftool: $(__OBJS) $(LIBBPF)
$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(__OBJS) $(LIBS)
$(OUTPUT)%.o: %.c
- $(QUIET_CC)$(COMPILE.c) -MMD -o $@ $<
+ $(QUIET_CC)$(CC) $(CFLAGS) -c -MMD -o $@ $<
clean: $(LIBBPF)-clean
$(call QUIET_CLEAN, bpftool)
--
2.25.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH bpf 2/2] selftests/bpf: Add a default $(CXX) value
2020-06-02 17:56 [PATCH bpf 0/2] Two fixes for make kselftest TARGETS=bpf Ilya Leoshkevich
2020-06-02 17:56 ` [PATCH bpf 1/2] tools/bpf: Don't use $(COMPILE.c) Ilya Leoshkevich
@ 2020-06-02 17:56 ` Ilya Leoshkevich
2020-06-02 20:37 ` [PATCH bpf 0/2] Two fixes for make kselftest TARGETS=bpf Daniel Borkmann
2 siblings, 0 replies; 4+ messages in thread
From: Ilya Leoshkevich @ 2020-06-02 17:56 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann
Cc: bpf, Heiko Carstens, Vasily Gorbik, Sumanth Korikkar, Ilya Leoshkevich
When using make kselftest TARGETS=bpf, tools/bpf is built with
MAKEFLAGS=rR, which causes $(CXX) to be undefined, which in turn causes
the build to fail with
CXX test_cpp
/bin/sh: 2: g: not found
Fix by adding a default $(CXX) value, like tools/build/feature/Makefile
already does.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
tools/testing/selftests/bpf/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index b59cd1042f9d..03017be02fac 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -2,6 +2,7 @@
include ../../../../scripts/Kbuild.include
include ../../../scripts/Makefile.arch
+CXX ?= $(CROSS_COMPILE)g++
CURDIR := $(abspath .)
TOOLSDIR := $(abspath ../../..)
LIBDIR := $(TOOLSDIR)/lib
--
2.25.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH bpf 0/2] Two fixes for make kselftest TARGETS=bpf
2020-06-02 17:56 [PATCH bpf 0/2] Two fixes for make kselftest TARGETS=bpf Ilya Leoshkevich
2020-06-02 17:56 ` [PATCH bpf 1/2] tools/bpf: Don't use $(COMPILE.c) Ilya Leoshkevich
2020-06-02 17:56 ` [PATCH bpf 2/2] selftests/bpf: Add a default $(CXX) value Ilya Leoshkevich
@ 2020-06-02 20:37 ` Daniel Borkmann
2 siblings, 0 replies; 4+ messages in thread
From: Daniel Borkmann @ 2020-06-02 20:37 UTC (permalink / raw)
To: Ilya Leoshkevich, Alexei Starovoitov
Cc: bpf, Heiko Carstens, Vasily Gorbik, Sumanth Korikkar
On 6/2/20 7:56 PM, Ilya Leoshkevich wrote:
> While the primary documented way to run BPF tests is by invoking
> make in tools/testing/selftests/bpf, kselftest documentation implies that
> make kselftest TARGETS=bpf from the top directory should work as well.
> This patch series contains two fixes that were neccesary to make it run:
>
> - Patch 1: $(COMPILE.c) -> $(CC) $(CFLAGS) -c
> - Patch 2: Add CXX=$(CROSS_COMPILE)g++ default value
>
> Ilya Leoshkevich (2):
> tools/bpf: Don't use $(COMPILE.c)
> selftests/bpf: Add a default $(CXX) value
>
> tools/bpf/Makefile | 6 +++---
> tools/bpf/bpftool/Makefile | 8 ++++----
> tools/testing/selftests/bpf/Makefile | 1 +
> 3 files changed, 8 insertions(+), 7 deletions(-)
I've tested on x86-64 and arm64 as well, applied, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-06-02 20:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02 17:56 [PATCH bpf 0/2] Two fixes for make kselftest TARGETS=bpf Ilya Leoshkevich
2020-06-02 17:56 ` [PATCH bpf 1/2] tools/bpf: Don't use $(COMPILE.c) Ilya Leoshkevich
2020-06-02 17:56 ` [PATCH bpf 2/2] selftests/bpf: Add a default $(CXX) value Ilya Leoshkevich
2020-06-02 20:37 ` [PATCH bpf 0/2] Two fixes for make kselftest TARGETS=bpf Daniel Borkmann
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).