From patchwork Wed Sep 20 16:11:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 816336 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="PG3oc3yr"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xy4Xl49sxz9s7c for ; Thu, 21 Sep 2017 02:13:11 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751798AbdITQNJ (ORCPT ); Wed, 20 Sep 2017 12:13:09 -0400 Received: from mail-pf0-f180.google.com ([209.85.192.180]:47641 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751897AbdITQMN (ORCPT ); Wed, 20 Sep 2017 12:12:13 -0400 Received: by mail-pf0-f180.google.com with SMTP id u12so1763088pfl.4 for ; Wed, 20 Sep 2017 09:12:13 -0700 (PDT) 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=rulQ4wZPI8gVFEadlD132HmE0jbw7SRDcmzOKpuGIpM=; b=PG3oc3yrm89xmNekEBRzK/85eEaED4Oe+wT6JLO5ped2pqWtgqF7y3DP53Puoj9526 fgcHwX4QAg8KIukmB9r66A0Ag+Edcy2KFSMXGBSCN2NZ2d5B15H8rRE1IrzEcIXbnXqr 78/H1P/jN14FcqUPtlCqS7UcrFOQE2SPGIh4+hdU/HYV4XhN80wsiy783eImAEdHjRPq fvUx+OIIfzRaJTboqdw0jDY9vR102zd3MCd4/G1NTYQQ0SdpabdMXSwqSb1LnGlwHt/7 aAh9ZHy+ehMzyqUqFtCzOyc7f1BfGIVDNco8R6kOcZZzsY6D2VPbFXZnCjuoK2VALgGE OMDw== 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=rulQ4wZPI8gVFEadlD132HmE0jbw7SRDcmzOKpuGIpM=; b=IEykjgT33oEtFDr4VfaEfhCdf6MqG1h0fEiR4gcg5s2lRhhSn9PTFAxWZWxjhMOOqi /pbMsG+x046QXjswIivquPEnHZKZMysZOZLI+MikBzB5pl3UFspS0b28ugY5cmRF90RP DgDT38ZLF9n+lQo3gcseRj7naI4IxQmr6jMUAzvTG1qhGIQJJVPyqek9CAgHXf+uvrai mJimN0ZGrK8+z6aOln/GVjERXdKUQyzLtKkM5r2iBk5JF0xYeCkIAsMhZZwb8BbZzI68 TpePdvann4BUWOW5ElZHcaRdi0EILCiYbFOl6w5II+Eo331LD5v31m90GXzoe/Ya/kPk dK9w== X-Gm-Message-State: AHPjjUj91qtDYJvwwDk6qwyzUTr7N7KOfu1aKwXJjwBEVBYN07fBmF0d e0QK7h5Ud1TdiVY+nfpIcxURKXZVfz8= X-Google-Smtp-Source: AOwi7QCBwZzgwvjL9ppgyQb6C4DTr8h/bOzzlMb56m9b8Xybo3iEateqVMcBm8E1jy6SGwc7d5/hrg== X-Received: by 10.101.66.70 with SMTP id d6mr2663769pgq.169.1505923932725; Wed, 20 Sep 2017 09:12:12 -0700 (PDT) Received: from joelaf-glaptop0.roam.corp.google.com ([73.93.152.222]) by smtp.gmail.com with ESMTPSA id x9sm8767200pfk.40.2017.09.20.09.12.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Sep 2017 09:12:12 -0700 (PDT) From: Joel Fernandes To: linux-kernel@vger.kernel.org Cc: netdev@vger.kernel.org, alison@she-devel.com, juri.lelli@arm.com, fengc@google.com, daniel@iogearbox.net, davem@davemloft.net, ast@kernel.org, kernel-team@android.com, Joel Fernandes Subject: [PATCH v4 2/4] samples/bpf: Enable cross compiler support Date: Wed, 20 Sep 2017 09:11:57 -0700 Message-Id: <20170920161159.25747-2-joelaf@google.com> X-Mailer: git-send-email 2.14.1.821.g8fa685d3b7-goog In-Reply-To: <20170920161159.25747-1-joelaf@google.com> References: <20170920161159.25747-1-joelaf@google.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Signed-off-by: Joel Fernandes Acked-by: Daniel Borkmann --- 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)/