On Tue, Nov 10, 2020 at 8:44 AM Jean-Philippe Brucker <jean-philippe@xxxxxxxxxx> wrote: > > The bpftool build first creates an intermediate binary, executed on the > host, to generate skeletons required by the final build. When > cross-building bpftool for an architecture different from the host, the > intermediate binary should be built using the host compiler (gcc) and > the final bpftool using the cross compiler (e.g. aarch64-linux-gnu-gcc). > > Generate the intermediate objects into the bootstrap/ directory using > the host toolchain. > > Signed-off-by: Jean-Philippe Brucker <jean-philippe@xxxxxxxxxx> > --- > v3: Always set LIBBPF_OUTPUT. Tidy the clean recipe. > --- > tools/bpf/bpftool/Makefile | 34 ++++++++++++++++++++++++++-------- > 1 file changed, 26 insertions(+), 8 deletions(-) > > diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile > index 1358c093b812..d566bced135e 100644 > --- a/tools/bpf/bpftool/Makefile > +++ b/tools/bpf/bpftool/Makefile > @@ -19,24 +19,37 @@ BPF_DIR = $(srctree)/tools/lib/bpf/ > ifneq ($(OUTPUT),) > LIBBPF_OUTPUT = $(OUTPUT)/libbpf/ > LIBBPF_PATH = $(LIBBPF_OUTPUT) > + BOOTSTRAP_OUTPUT = $(OUTPUT)/bootstrap/ > else > + LIBBPF_OUTPUT = > LIBBPF_PATH = $(BPF_DIR) > + BOOTSTRAP_OUTPUT = $(CURDIR)/bootstrap/ This leaves behind bootstrap dir, which is not in .gitignore. Please follow up with a fix. Thanks! > endif > > LIBBPF = $(LIBBPF_PATH)libbpf.a > +LIBBPF_BOOTSTRAP_OUTPUT = $(BOOTSTRAP_OUTPUT)libbpf/ > +LIBBPF_BOOTSTRAP = $(LIBBPF_BOOTSTRAP_OUTPUT)libbpf.a > [...]