From patchwork Sun Sep 3 18:25:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 809347 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="eOd/2SkN"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xlhJb2Z1Qz9sDB for ; Mon, 4 Sep 2017 04:26:39 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752803AbdICS0I (ORCPT ); Sun, 3 Sep 2017 14:26:08 -0400 Received: from mail-pg0-f45.google.com ([74.125.83.45]:37426 "EHLO mail-pg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752604AbdICS0G (ORCPT ); Sun, 3 Sep 2017 14:26:06 -0400 Received: by mail-pg0-f45.google.com with SMTP id 83so13054124pgb.4 for ; Sun, 03 Sep 2017 11:26:06 -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=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=pvc5sj8a8Y1j+g6UlUBJnl/uefxPZifdMfm2vrroSZbjmADAZrQze1ZO6HkeLyTRuH P522HJ9d+u363XX6oUV922CuMaxrVYJst/T4X/va4/p+uDXbr6zLv3FcRyddAwW62uEz Y2/lGT8y5eEg7Hcj+faEbv2rN7LK4RsLnWPPDHEfeZxgiy088JwVyjJfK82uoJuPw1T2 ZjPj5znq4SyCNNh1GeeeMx46LVpuX7QM2MWZX+j5XkUGu2gs9kXFMNgDDn2MShF0XBeW kOwJ2+26aExRH6D40rNtOZYg6po3ueUfjHzHgi57B0oJfmPi099cem6kiaSV6EYiN4tr NhsQ== X-Gm-Message-State: AHPjjUgYIm/UNX9xkT/e1rkjld92Cs9NxiAbQJl1fymMif5BFKaK8+qJ EMcc5DRZm4jMZb/Y 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) Received: from joelaf-glaptop0.roam.corp.google.com (74.sub-70-213-6.myvzw.com. [70.213.6.74]) by smtp.gmail.com with ESMTPSA id p64sm7627440pfi.168.2017.09.03.11.26.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 03 Sep 2017 11:26:05 -0700 (PDT) From: Joel Fernandes To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: kernel-team@android.com, Juri Lelli , Alison Chaiken , Chenbo Feng , Joel Fernandes , Alexei Starovoitov , Daniel Borkmann , David Miller Subject: [PATCH RFC v3 2/4] samples/bpf: Enable cross compiler support Date: Sun, 3 Sep 2017 11:25:47 -0700 Message-Id: <20170903182549.30866-2-joelaf@google.com> X-Mailer: git-send-email 2.14.1.581.gf28d330327-goog In-Reply-To: <20170903182549.30866-1-joelaf@google.com> References: <20170903182549.30866-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. CC: Alexei Starovoitov CC: Daniel Borkmann Cc: David Miller 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)/