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


Groups > linux.kernel > #1705487 > unrolled thread

[PATCH RFC v2 2/5] samples/bpf: Enable cross compiler support

Started byJoel Fernandes <joelaf@google.com>
First post2017-08-07 15:10 +0200
Last post2017-08-07 15:10 +0200
Articles 1 — 1 participant

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 RFC v2 2/5] samples/bpf: Enable cross compiler support Joel Fernandes <joelaf@google.com> - 2017-08-07 15:10 +0200

#1705487 — [PATCH RFC v2 2/5] samples/bpf: Enable cross compiler support

FromJoel Fernandes <joelaf@google.com>
Date2017-08-07 15:10 +0200
Subject[PATCH RFC v2 2/5] samples/bpf: Enable cross compiler support
Message-ID<ubPXd-bV-35@gated-at.bofh.it>
When cross compiling, bpf samples use HOSTCC, however what we really want is to
use the cross compiler to build for the cross target since that is what will
help run the BPF target code.  Detect this and also set -static as LDFLAGS
since often times we don't have control over what C library the cross target is
running and its not smart to rely on it.

Signed-off-by: Joel Fernandes <joelaf@google.com>
---
 samples/bpf/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 6c7468eb3684..e5642c8c144d 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -152,6 +152,12 @@ HOSTLOADLIBES_test_map_in_map += -lelf
 LLC ?= llc
 CLANG ?= clang
 
+# Detect that we're cross compiling and use the right compilers and flags
+ifdef CROSS_COMPILE
+HOSTCC = $(CROSS_COMPILE)gcc
+HOSTLDFLAGS += -static
+endif
+
 # Trick to allow make to be run from this directory
 all:
 	$(MAKE) -C ../../ $(CURDIR)/
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web