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


Groups > linux.kernel > #1725723

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

Path csiph.com!news.freedyn.net!open-news-network.org!aioe.org!bofh.it!news.nic.it!robomod
From Joel Fernandes <joelaf@google.com>
Newsgroups linux.kernel
Subject [PATCH RFC v3 2/4] samples/bpf: Enable cross compiler support
Date Sun, 03 Sep 2017 20:30:01 +0200
Message-ID <ulHOF-3lK-3@gated-at.bofh.it> (permalink)
References <ulHOF-3lK-5@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6LA6iB402DqWY3wSPsbxSjZ553wPZxkUBM0nrdMv4B0=; b=eOd/2SkNICbJZR5zSzvaWJGz+uY0yBpiR+5BVbvd7iFTkPLmY7bVGlaqvTEOS1D3OQ tZo+7fY+WsZKP5oVxfLF9pR+ozyKO/va0RQrGRmre/kd9uvZcSmZ7C9geLtzbJ67MtLt pGUWZOlnGAJ14/oXD0BzvxRxjPBX+raFxYSKUyaDsW7BB3mV2w4n1ZXNBgVkKehwx2Gt flY1e2sdfY0yEcRPjvv3ujj4dyoHZdf0zFnGqLJ6n7Iq7uG7JWyu7y+a4z8uv7DVUBvt FxZEsPdBQIraIjYUN1YKSTnwDqTFmLsYhl5ozf/3T96VKkX7devP7Z3h+yRp+FuKclsu GVng==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6LA6iB402DqWY3wSPsbxSjZ553wPZxkUBM0nrdMv4B0=; b=AdljzrFBvebfQGYbSvDBiLO+AAM2bXIVXEC4yZOqeL8PvIvkhRdTA8QHMpLCTXlQps zz3drKRw2Wvp2BVGyg2xk3JddpSkeNJn69tOPyGfEY+CZgs1IXMoo6xHcRVPIWZN3Xnc gdtaAQq9TI5uqgwPYB+cYSZvB07LSyvFBmad0p969O+cAhWoyBiqO4UNPVmpcI8wSUYO U0AzTNTO7otwgYC1ZxshJ9Xo5DMhEi89zVPe650BCzo7nnk4mg8v+vRdvVK3UnM97vat lZUoQZafxpZnPBBxzW9Q4W5r3x4StngFSriFUJBV7uVKUJwcPQjxYMwn4c985e7iuIEd wavg==
X-Gm-Message-State AHPjjUgHwTh5SoZNZgI94hbb1baQsKk7iLD/TEoP2M/I3cg2ZIizvh3K mF9dCSy/SR9Vc+H7QVFeaw==
X-Google-SMTP-Source ADKCNb6U3yhnPgNKmGknbV3AXPQ2U2TMkyLTYzxeJO/Lh8K0ghSCwBZ406evNogB7okkGFpIMedOTg==
X-Received by 10.98.193.1 with SMTP id i1mr2132779pfg.155.1504463165590; Sun, 03 Sep 2017 11:26:05 -0700 (PDT)
X-Mailer git-send-email 2.14.1.581.gf28d330327-goog
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 31
Organization linux.* mail to news gateway
X-Original-Cc kernel-team@android.com, Juri Lelli <juri.lelli@arm.com>, Alison Chaiken <alison@she-devel.com>, Chenbo Feng <fengc@google.com>, Joel Fernandes <joelaf@google.com>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, David Miller <davem@davemloft.net>
X-Original-Date Sun, 3 Sep 2017 11:25:47 -0700
X-Original-Message-ID <20170903182549.30866-2-joelaf@google.com>
X-Original-References <20170903182549.30866-1-joelaf@google.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1725723

Show key headers only | View raw


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.

CC: Alexei Starovoitov <ast@kernel.org>
CC: Daniel Borkmann <daniel@iogearbox.net>
Cc: David Miller <davem@davemloft.net>
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.581.gf28d330327-goog

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH RFC v3 2/4] samples/bpf: Enable cross compiler support Joel Fernandes <joelaf@google.com> - 2017-09-03 20:30 +0200

csiph-web