Skip to content

Commit 720f228

Browse files
borkmannAlexei Starovoitov
authored andcommitted
bpf: fix broken BPF selftest build
At least on x86_64, the kernel's BPF selftests seemed to have stopped to build due to 618e165 ("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: 618e165 ("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>
1 parent a23f06f commit 720f228

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

tools/testing/selftests/bpf/Makefile

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,16 @@
11
# SPDX-License-Identifier: GPL-2.0
22

3-
ifeq ($(srctree),)
4-
srctree := $(patsubst %/,%,$(dir $(CURDIR)))
5-
srctree := $(patsubst %/,%,$(dir $(srctree)))
6-
srctree := $(patsubst %/,%,$(dir $(srctree)))
7-
srctree := $(patsubst %/,%,$(dir $(srctree)))
8-
endif
9-
include $(srctree)/tools/scripts/Makefile.arch
10-
11-
$(call detected_var,SRCARCH)
12-
133
LIBDIR := ../../../lib
144
BPFDIR := $(LIBDIR)/bpf
155
APIDIR := ../../../include/uapi
16-
ASMDIR:= ../../../arch/$(ARCH)/include/uapi
176
GENDIR := ../../../../include/generated
187
GENHDR := $(GENDIR)/autoconf.h
198

209
ifneq ($(wildcard $(GENHDR)),)
2110
GENFLAGS := -DHAVE_GENHDR
2211
endif
2312

24-
CFLAGS += -Wall -O2 -I$(APIDIR) -I$(ASMDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
13+
CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
2514
LDLIBS += -lcap -lelf
2615

2716
TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \

0 commit comments

Comments
 (0)