aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2017-12-11 20:25:32 -0500
committerAlexei Starovoitov <ast@kernel.org>2017-12-12 12:51:12 -0500
commit720f228e8d3128b7ab1d39f51fdd8da07a7640c9 (patch)
tree3c9f5086b0b07625e069109a3f2fe37c815980f2 /tools
parenta23f06f06dbe54696e8d4f156b317e8c9961c345 (diff)
bpf: fix broken BPF selftest build
At least on x86_64, the kernel's BPF selftests seemed to have stopped to build due to 618e165b2a8e ("selftests/bpf: sync kernel headers and introduce arch support in Makefile"): [...] In file included from test_verifier.c:29:0: ../../../include/uapi/linux/bpf_perf_event.h:11:32: fatal error: asm/bpf_perf_event.h: No such file or directory #include <asm/bpf_perf_event.h> ^ compilation terminated. [...] While pulling in tools/arch/*/include/uapi/asm/bpf_perf_event.h seems to work fine, there's no automated fall-back logic right now that would do the same out of tools/include/uapi/asm-generic/bpf_perf_event.h. The usual convention today is to add a include/[uapi/]asm/ equivalent that would pull in the correct arch header or generic one as fall-back, all ifdef'ed based on compiler target definition. It's similarly done also in other cases such as tools/include/asm/barrier.h, thus adapt the same here. Fixes: 618e165b2a8e ("selftests/bpf: sync kernel headers and introduce arch support in Makefile") Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/include/uapi/asm/bpf_perf_event.h7
-rw-r--r--tools/testing/selftests/bpf/Makefile13
2 files changed, 8 insertions, 12 deletions
diff --git a/tools/include/uapi/asm/bpf_perf_event.h b/tools/include/uapi/asm/bpf_perf_event.h
new file mode 100644
index 000000000000..13a58531e6fa
--- /dev/null
+++ b/tools/include/uapi/asm/bpf_perf_event.h
@@ -0,0 +1,7 @@
1#if defined(__aarch64__)
2#include "../../arch/arm64/include/uapi/asm/bpf_perf_event.h"
3#elif defined(__s390__)
4#include "../../arch/s390/include/uapi/asm/bpf_perf_event.h"
5#else
6#include <uapi/asm-generic/bpf_perf_event.h>
7#endif
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 21a2d76b67dc..792af7c3b74f 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -1,19 +1,8 @@
1# SPDX-License-Identifier: GPL-2.0 1# SPDX-License-Identifier: GPL-2.0
2 2
3ifeq ($(srctree),)
4srctree := $(patsubst %/,%,$(dir $(CURDIR)))
5srctree := $(patsubst %/,%,$(dir $(srctree)))
6srctree := $(patsubst %/,%,$(dir $(srctree)))
7srctree := $(patsubst %/,%,$(dir $(srctree)))
8endif
9include $(srctree)/tools/scripts/Makefile.arch
10
11$(call detected_var,SRCARCH)
12
13LIBDIR := ../../../lib 3LIBDIR := ../../../lib
14BPFDIR := $(LIBDIR)/bpf 4BPFDIR := $(LIBDIR)/bpf
15APIDIR := ../../../include/uapi 5APIDIR := ../../../include/uapi
16ASMDIR:= ../../../arch/$(ARCH)/include/uapi
17GENDIR := ../../../../include/generated 6GENDIR := ../../../../include/generated
18GENHDR := $(GENDIR)/autoconf.h 7GENHDR := $(GENDIR)/autoconf.h
19 8
@@ -21,7 +10,7 @@ ifneq ($(wildcard $(GENHDR)),)
21 GENFLAGS := -DHAVE_GENHDR 10 GENFLAGS := -DHAVE_GENHDR
22endif 11endif
23 12
24CFLAGS += -Wall -O2 -I$(APIDIR) -I$(ASMDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include 13CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
25LDLIBS += -lcap -lelf 14LDLIBS += -lcap -lelf
26 15
27TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \ 16TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \