diff options
author | 2017-09-20 09:11:57 -0700 | |
---|---|---|
committer | 2017-09-21 11:59:16 -0700 | |
commit | 876e88e3273e300895e308bd660c6cfaabb03cd5 (patch) | |
tree | 8872934ddc072a92c589cdbe1199bd0b1c7d944d /samples/bpf | |
parent | samples/bpf: Use getppid instead of getpgrp for array map stress (diff) | |
download | linux-876e88e3273e300895e308bd660c6cfaabb03cd5.tar.gz linux-876e88e3273e300895e308bd660c6cfaabb03cd5.tar.bz2 linux-876e88e3273e300895e308bd660c6cfaabb03cd5.zip |
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: 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>
Diffstat (limited to 'samples/bpf')
-rw-r--r-- | samples/bpf/Makefile | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index cf17c7932a6e..13f74b67ca44 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -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)/ |