Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751953AbdITQMR (ORCPT ); Wed, 20 Sep 2017 12:12:17 -0400 Received: from mail-pf0-f175.google.com ([209.85.192.175]:50343 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751903AbdITQMO (ORCPT ); Wed, 20 Sep 2017 12:12:14 -0400 X-Google-Smtp-Source: AOwi7QCBwZzgwvjL9ppgyQb6C4DTr8h/bOzzlMb56m9b8Xybo3iEateqVMcBm8E1jy6SGwc7d5/hrg== 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: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 923 Lines: 29 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 --- 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