Skip to content

Commit

Permalink
samples/bpf: Enable cross compiler support
Browse files Browse the repository at this point in the history
When cross compiling, bpf samples use HOSTCC for compiling the non-BPF part of
the sample, however what we really want is to use the cross compiler to build
for the cross target since that is what will load and run the BPF sample.
Detect this and compile samples correctly.

Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Joel Fernandes <joelaf@google.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Joel Fernandes authored and David S. Miller committed Sep 21, 2017
1 parent 95ec669 commit 876e88e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions samples/bpf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ HOSTLOADLIBES_syscall_tp += -lelf
LLC ?= llc
CLANG ?= clang

# Detect that we're cross compiling and use the cross compiler
ifdef CROSS_COMPILE
HOSTCC = $(CROSS_COMPILE)gcc
endif

# Trick to allow make to be run from this directory
all:
$(MAKE) -C ../../ $(CURDIR)/
Expand Down

0 comments on commit 876e88e

Please sign in to comment.