Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6441632ybe; Wed, 18 Sep 2019 03:37:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6mdzVhM/dxYFhJp19IIr5HpnNsvPCkoMfdzR/wH17KZmW5LbBc2SGQ/Zug6+7S+99KKcu X-Received: by 2002:aa7:d698:: with SMTP id d24mr9586988edr.32.1568803043849; Wed, 18 Sep 2019 03:37:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568803043; cv=none; d=google.com; s=arc-20160816; b=UKSzB7vIkvQQ8ZYWL9IUwjEqq58TUFY6T2lIxZTjsRjpzit3HM/KBZLee7bmD8Fua8 oiEzlvys+CLna28ORVkIyFX+qeYNfM6qK+Zj3y1nVzHch8YwD/n074lhbomzfa6GiTcc MuTcc2bY/u1MTzw1LlBxaf2eyQMV9H0VT15o0dKborl+LSWNQz4mBhJ7DyrlWJ8Mo9XJ kW4/Gdtm96gUToy8Ih3kq7PqjuvtGx3tLCxHvISZZ5jqTAMDfFxelBLNb2cD6Q+T3IJ7 oGmug41qyfK7WLGQKK3ce8g2EAC22K4bRRX6h09pZ1xpIz4MHlwVyqmz5llenyy0frAb IDIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=5IKevHxYE8kJAT6rh5UWN+J7usw4VjwCKVPryNseZJE=; b=HlBfTJWhi2Yc4pxO+YqiKC8UFeE1SMnFA5feGhACWpCF/EbQaTwcylIjtuDFMYJtud 1hYwI+bjZ2q33VGB3jfjxgmcYobL4QNnX3dp4YNEA2Xi0MzO0xcPhZzR2WY8XczxMkmt G5VJCib5IuhKceA+lAeOI10Zn4desjftywkFG83Gtm5IdOope5BVH2i5YVKK9w6Hplyr gjJ7U0f7R8uW/Bx75y6wWvLdWDJGlEVfGSp5XnCjMevTQlrHXvt2ZP7As55yJ7DGmBld XsESFej3+loG79QN46eGVyxPi8Qzm+5UUXeexNNSjWgl3nJBIAa0KjlZNrGm10CK2G7d yBEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WO9H67nV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n4si2308090ejj.132.2019.09.18.03.36.59; Wed, 18 Sep 2019 03:37:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WO9H67nV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729111AbfIRKfP (ORCPT + 99 others); Wed, 18 Sep 2019 06:35:15 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:45160 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727658AbfIRKfO (ORCPT ); Wed, 18 Sep 2019 06:35:14 -0400 Received: by mail-lf1-f66.google.com with SMTP id r134so5259884lff.12 for ; Wed, 18 Sep 2019 03:35:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=5IKevHxYE8kJAT6rh5UWN+J7usw4VjwCKVPryNseZJE=; b=WO9H67nVw2fT4Z2j/RPZzKh1muXV7mcGA8J1lk2RWGs2FHPWhOPkyl1I1sCSpysElI Ktq8U63s20pJSpRtGo7OAL2AeKJZJoOPcq5cj8K3VgFbFnZTUXN9N0V0x3Bk2LcTA7ux UFDOVVCgrhdUR0gYw1X80XO+Vf2YOSoRce39mhb0indSnYQ7dd5T/RfIutn5iXyqqsuA AU1pwvN86k0TXLLx1hTjvdx9HKGYUw+/ToZFyPCDd2/dk9vGOYYROCSxkK1RNWczW9pm eR5+0UrUO/AmkDcbiPYVDy0Il64EmQXeE+g5poMQtgiVyMyzJ1pU78Y0vs9R/ywO3cYh 1Zbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=5IKevHxYE8kJAT6rh5UWN+J7usw4VjwCKVPryNseZJE=; b=QkdWjfKaZJIrkzmfYcoG2eWpdW6Ig9Ffg/WJAlTFXEEuVa+TMPOlE+Qs+jvFrQwO/V Cp5LlodZq/AjuwqSuEBpQKrmzwv0IUCuaqrNZNO/4y9QAnLpLhZF1sQ/U7dOq5+xpv9g kp/jLiKTOviT4+iEJAMttNmNF3SI4zIwkF/IxJOqfc6svCJWtcInIo4sz15pQcw3TVI4 FFdP5ADPXtvvUPaaiaFLT++Qm/T+jK5pnfdHoF6eEvSoZ35zLUXGYv2HOQ3I5glntUW8 ocjfGM7EOk+KHUfFzQgslG3YpHhUA+sx5Wmg7FBuZpeNUtDZ4o4IDXQvR6NMo9LBW5rc QOQA== X-Gm-Message-State: APjAAAW+eItxrXvLCKjpSKzvgHgQwDrDoC6QywMN9kiNFoBmYj+EWzeV 3Vs+Z8lAPn7f1nT8DdHk8XQqGg== X-Received: by 2002:a19:6a09:: with SMTP id u9mr1673963lfu.91.1568802912601; Wed, 18 Sep 2019 03:35:12 -0700 (PDT) Received: from khorivan (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id p9sm955453lji.107.2019.09.18.03.35.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Sep 2019 03:35:11 -0700 (PDT) Date: Wed, 18 Sep 2019 13:35:09 +0300 From: Ivan Khoronzhuk To: Andrii Nakryiko Cc: Alexei Starovoitov , Daniel Borkmann , Yonghong Song , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , john fastabend , open list , Networking , bpf , clang-built-linux@googlegroups.com, sergei.shtylyov@cogentembedded.com Subject: Re: [PATCH v3 bpf-next 09/14] samples: bpf: makefile: use own flags but not host when cross compile Message-ID: <20190918103508.GC2908@khorivan> Mail-Followup-To: Andrii Nakryiko , Alexei Starovoitov , Daniel Borkmann , Yonghong Song , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , john fastabend , open list , Networking , bpf , clang-built-linux@googlegroups.com, sergei.shtylyov@cogentembedded.com References: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> <20190916105433.11404-10-ivan.khoronzhuk@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 17, 2019 at 04:42:07PM -0700, Andrii Nakryiko wrote: >On Mon, Sep 16, 2019 at 3:59 AM Ivan Khoronzhuk > wrote: >> >> While compile natively, the hosts cflags and ldflags are equal to ones >> used from HOSTCFLAGS and HOSTLDFLAGS. When cross compiling it should >> have own, used for target arch. While verification, for arm, arm64 and >> x86_64 the following flags were used alsways: >> >> -Wall >> -O2 >> -fomit-frame-pointer >> -Wmissing-prototypes >> -Wstrict-prototypes >> >> So, add them as they were verified and used before adding >> Makefile.target, but anyway limit it only for cross compile options as >> for host can be some configurations when another options can be used, >> So, for host arch samples left all as is, it allows to avoid potential >> option mistmatches for existent environments. >> >> Signed-off-by: Ivan Khoronzhuk >> --- >> samples/bpf/Makefile | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile >> index 1579cc16a1c2..b5c87a8b8b51 100644 >> --- a/samples/bpf/Makefile >> +++ b/samples/bpf/Makefile >> @@ -178,8 +178,17 @@ CLANG_EXTRA_CFLAGS := $(ARM_ARCH_SELECTOR) >> TPROGS_CFLAGS += $(ARM_ARCH_SELECTOR) >> endif >> >> +ifdef CROSS_COMPILE >> +TPROGS_CFLAGS += -Wall >> +TPROGS_CFLAGS += -O2 > >Specifying one arg per line seems like overkill, put them in one line? Will combine. > >> +TPROGS_CFLAGS += -fomit-frame-pointer > >Why this one? I've explained in commit msg. The logic is to have as much as close options to have smiliar binaries. As those options are used before for hosts and kinda cross builds - better follow same way. > >> +TPROGS_CFLAGS += -Wmissing-prototypes >> +TPROGS_CFLAGS += -Wstrict-prototypes > >Are these in some way special that we want them in cross-compile mode only? > >All of those flags seem useful regardless of cross-compilation or not, >shouldn't they be common? I'm a bit lost about the intent here... They are common but split is needed to expose it at least. Also host for different arches can have some own opts already used that shouldn't be present for cross, better not mix it for safety. > >> +else >> TPROGS_LDLIBS := $(KBUILD_HOSTLDLIBS) >> TPROGS_CFLAGS += $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) >> +endif >> + >> TPROGS_CFLAGS += -I$(objtree)/usr/include >> TPROGS_CFLAGS += -I$(srctree)/tools/lib/bpf/ >> TPROGS_CFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ >> -- >> 2.17.1 >> -- Regards, Ivan Khoronzhuk