Skip to content

Commit 5be6cec

Browse files
Yang Jihongacmel
authored andcommitted
perf bpf skels: Make vmlinux.h use bpf.h and perf_event.h in source directory
Currently, vmlinux.h uses the bpf.h and perf_event.h header files in the system path. If the header files in compilation environment are old, compilation may fail. For example: /home/yangjihong/linux/tools/perf/util/bpf_skel/.tmp/../vmlinux.h:151:27: error: field has incomplete type 'union perf_sample_weight' union perf_sample_weight weight; Use the bpf.h and perf_event.h files in the source code directory to avoid compilation compatibility problems. Signed-off-by: Yang Jihong <[email protected]> Tested-by: Arnaldo Carvalho de Melo <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Nathan Chancellor <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Tom Rix <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 7d16116 commit 5be6cec

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

tools/perf/Makefile.perf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,13 +1058,14 @@ $(SKEL_TMP_OUT) $(LIBAPI_OUTPUT) $(LIBBPF_OUTPUT) $(LIBPERF_OUTPUT) $(LIBSUBCMD_
10581058
ifdef BUILD_BPF_SKEL
10591059
BPFTOOL := $(SKEL_TMP_OUT)/bootstrap/bpftool
10601060
BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(LIBBPF_INCLUDE)
1061+
TOOLS_UAPI_INCLUDE := -I$(srctree)/tools/include/uapi
10611062

10621063
$(BPFTOOL): | $(SKEL_TMP_OUT)
10631064
$(Q)CFLAGS= $(MAKE) -C ../bpf/bpftool \
10641065
OUTPUT=$(SKEL_TMP_OUT)/ bootstrap
10651066

10661067
$(SKEL_TMP_OUT)/%.bpf.o: util/bpf_skel/%.bpf.c $(LIBBPF) | $(SKEL_TMP_OUT)
1067-
$(QUIET_CLANG)$(CLANG) -g -O2 -target bpf -Wall -Werror $(BPF_INCLUDE) \
1068+
$(QUIET_CLANG)$(CLANG) -g -O2 -target bpf -Wall -Werror $(BPF_INCLUDE) $(TOOLS_UAPI_INCLUDE) \
10681069
-c $(filter util/bpf_skel/%.bpf.c,$^) -o $@ && $(LLVM_STRIP) -g $@
10691070

10701071
$(SKEL_OUT)/%.skel.h: $(SKEL_TMP_OUT)/%.bpf.o | $(BPFTOOL)

tools/perf/util/bpf_skel/vmlinux.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef __VMLINUX_H
22
#define __VMLINUX_H
33

4+
#include <linux/stddef.h> // for define __always_inline
45
#include <linux/bpf.h>
56
#include <linux/types.h>
67
#include <linux/perf_event.h>

0 commit comments

Comments
 (0)