Commit 876e88e3 authored by Joel Fernandes's avatar Joel Fernandes Committed by David S. Miller

samples/bpf: Enable cross compiler support

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: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarJoel Fernandes <joelaf@google.com>
Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 95ec6696
...@@ -177,6 +177,11 @@ HOSTLOADLIBES_syscall_tp += -lelf ...@@ -177,6 +177,11 @@ HOSTLOADLIBES_syscall_tp += -lelf
LLC ?= llc LLC ?= llc
CLANG ?= clang 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 # Trick to allow make to be run from this directory
all: all:
$(MAKE) -C ../../ $(CURDIR)/ $(MAKE) -C ../../ $(CURDIR)/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment