Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1735878 > unrolled thread

[PATCH v4 2/4] samples/bpf: Enable cross compiler support

Started byJoel Fernandes <joelaf@google.com>
First post2017-09-20 18:20 +0200
Last post2017-09-20 23:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v4 2/4] samples/bpf: Enable cross compiler support Joel Fernandes <joelaf@google.com> - 2017-09-20 18:20 +0200
    Re: [PATCH v4 2/4] samples/bpf: Enable cross compiler support Daniel Borkmann <daniel@iogearbox.net> - 2017-09-20 23:30 +0200

#1735878 — [PATCH v4 2/4] samples/bpf: Enable cross compiler support

FromJoel Fernandes <joelaf@google.com>
Date2017-09-20 18:20 +0200
Subject[PATCH v4 2/4] samples/bpf: Enable cross compiler support
Message-ID<urPTb-5ov-9@gated-at.bofh.it>
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>
---
 samples/bpf/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

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)/
-- 
2.14.1.821.g8fa685d3b7-goog

[toc] | [next] | [standalone]


#1736161

FromDaniel Borkmann <daniel@iogearbox.net>
Date2017-09-20 23:30 +0200
Message-ID<urUJc-8w7-17@gated-at.bofh.it>
In reply to#1735878
On 09/20/2017 06:11 PM, Joel Fernandes wrote:
> 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>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web