Messages in this thread | | | Date | Tue, 24 Nov 2020 20:51:22 +0100 | From | Jiri Olsa <> | Subject | Re: [RFC 1/2] perf: support build BPF skeletons with perf |
| |
On Wed, Nov 18, 2020 at 08:50:45PM -0800, Song Liu wrote:
SNIP
> + $(Q)$(BPFTOOL) gen skeleton $< > $@ > + > +$(TMP_OUTPUT)/%.bpf.o: %.bpf.c $(TMP_OUTPUT)/vmlinux.h $(BPFOBJ) | $(TMP_OUTPUT) > + $(call msg,BPF,$@) > + $(Q)$(CLANG) -g -O2 -target bpf $(INCLUDES) \ > + -c $(filter %.c,$^) -o $@ && \ > + $(LLVM_STRIP) -g $@ > + > +$(TMP_OUTPUT): > + $(call msg,MKDIR,$@) > + $(Q)mkdir -p $(TMP_OUTPUT) > + > +$(TMP_OUTPUT)/vmlinux.h: $(VMLINUX_BTF_PATH) | $(TMP_OUTPUT) $(BPFTOOL)
please add support to specify VMLINUX_H as it is in selftests or bpftool, we will need it in out building setup
thanks, jirka
> + $(call msg,GEN,$@) > + $(Q)if [ ! -e "$(VMLINUX_BTF_PATH)" ] ; then \ > + echo "Couldn't find kernel BTF; set VMLINUX_BTF to" \ > + "specify its location." >&2; \ > + exit 1;\ > + fi > + $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF_PATH) format c > $@ > + > +$(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(TMP_OUTPUT) > + $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) \ > + OUTPUT=$(abspath $(dir $@))/ $(abspath $@) > + > +$(DEFAULT_BPFTOOL): | $(TMP_OUTPUT) > + $(Q)$(MAKE) $(submake_extras) -C ../../../bpf/bpftool \ > + prefix= OUTPUT=$(TMP_OUTPUT)/ DESTDIR=$(TMP_OUTPUT) install > diff --git a/tools/perf/util/bpf_skel/dummy.bpf.c b/tools/perf/util/bpf_skel/dummy.bpf.c > new file mode 100644 > index 0000000000000..085fcee1f52cf > --- /dev/null > +++ b/tools/perf/util/bpf_skel/dummy.bpf.c > @@ -0,0 +1,19 @@ > +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +// Copyright (c) 2020 Facebook > +#include "vmlinux.h" > +#include <bpf/bpf_helpers.h> > +#include <bpf/bpf_tracing.h> > + > +struct { > + __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); > + __uint(key_size, sizeof(u32)); > + __uint(value_size, sizeof(u64)); > +} counts SEC(".maps"); > + > +SEC("fentry/dummy") > +int BPF_PROG(fentry_dummy) > +{ > + return 0; > +} > + > +char LICENSE[] SEC("license") = "Dual BSD/GPL"; > -- > 2.24.1 >
| |