Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6065634ybe; Tue, 17 Sep 2019 19:21:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNhpDhd3Q1DXPYO4jb4LS6HNsri2Y+bc3JEoqCRnOLkA3WqqQUjKKvs5tH8ilYHg/LEAyb X-Received: by 2002:a50:a532:: with SMTP id y47mr7761445edb.273.1568773273346; Tue, 17 Sep 2019 19:21:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568773273; cv=none; d=google.com; s=arc-20160816; b=Jj8POBoDq6eBl351WPtsASyYxmNoJEVKZW6IVLKwYN8922NAPcE089TNL+c0YpAVqx fLxpjhZVO/1NfBGJaVEMKhXzYDkMLBTbh/x1HFMBbj6S5IqUzzQ0f4MIx27jWikj6WxG ZaTku32x9MP/dVvZiE8rFw3DOZPTxXmfoTvZPYqlD22TRNdhai5sMQUX3WDOGz2lZqAu Ck5MbVM/rrXI1K8LYDk16lnfWQbboNeOcY6ws2vepP9bZnkOAPbFiUgb8tUP9CO+I0yl NYQwV4Svj1epBs1X75xYJxd4wYxgmstsH/HOZ1BPSmaPkrkqqm1oSUJSZhkRUz9BYo4Q AnBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=BegyS4bOdhV/4W363nuBMo/MR31JnI7T3ixbji8LT0k=; b=Cw0ssQkn4TlCziy6IWyBW7H4keJZScxYYI2zLt0v4oi0mpiD+93oErCyB9pfhC8qAb xkgSSBkE/wynm94fsaiNTB4WHisn58x0MGx1LjStAaWGtp4boniy9d6Kqwh4BwooIhKL DsS5IL6qZmL5FILZNN7CCy7t+6MW7cGFXzEmhtqwV3VNQI53VDTULOrNipHrz7FovBFX sVdtvnNzlAD99PaCgctAOltdkOYbLlkFKaf9M+UBd7CIo3plvn5azfuHKubtzEYDLiFJ HKMA4nCLzXVJKCS5mDMcyt3jsHXB5k8ZCIuKBVzJEDT2S5Gtc+wyEcGQrG9VpdG4eZQ/ GYeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vMk1upZO; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q10si2440405eda.293.2019.09.17.19.20.49; Tue, 17 Sep 2019 19:21:13 -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=@gmail.com header.s=20161025 header.b=vMk1upZO; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728846AbfIQXmT (ORCPT + 99 others); Tue, 17 Sep 2019 19:42:19 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:42452 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727437AbfIQXmS (ORCPT ); Tue, 17 Sep 2019 19:42:18 -0400 Received: by mail-qt1-f196.google.com with SMTP id g16so6619198qto.9; Tue, 17 Sep 2019 16:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BegyS4bOdhV/4W363nuBMo/MR31JnI7T3ixbji8LT0k=; b=vMk1upZOsmLe++G9kBDDj9CahrV2tNdF/nBj/Sm8wZzpdEurdvhYJ5J9ixKghaKpoe Cabrh+OuWLIlOL8RKUBb5jFHtQb1xdQFeP0HSY5tUS40GSQMc/d4paYdK+u6g/Yr3bsN 6joSSp0Y0CGRaUTCcNJvsHVSlzZqO0cPTY86eZbFHDEOvnqp+RjGcdWDcelGje3coVJ8 I7Z/w7Yely9GyEovAfl0SQ6k8tjJd/NdJcl9i59BmGBOpTmRjOYlePwLpac2ocUn0GQ4 px4HlmsNfTsrEh9cgAI0XrjTx8lSfmL8E2I9wAxcrBLDGTu2tQwc2dvhwx/ojX/ZO+Mu /5TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BegyS4bOdhV/4W363nuBMo/MR31JnI7T3ixbji8LT0k=; b=YnsgEJ5js/tuoWKJQmoaFbKybu1/VeGCVjBTI7U2e7ncZWWQrM4e1KRG3fjYeP5JaP QuaZRSY6XRu2LR32JFYUgcMs2AgNPnYwyS73EsqpZczPi/C7gSzZWzAXHMCu4ABxON8Y 9H7uBVDjG5qHeeS+UUiLkQcp/VcCUBSyyVyesdioDBzvr7pA4bk+HGm3/aRZMZMq4kJm hdTt1/v9mdl9+R+g2Iznicu5uycPMXar/30l2aCxpilYHq8o86czHSwM0SCrMPZ0YGUE xl5G3YFI5/A48HbB/scHwzDJLrkMziXqXPqpGWv4hF27US6I0e/ADRauP8p0KIKA5uRP WqFA== X-Gm-Message-State: APjAAAUH4o5dhBY3JcsVWhQJhQxIG2vj2d5HLWRncaJO+DotT5Bt2FcJ C6SatMKd55tZ0I0SoLpBGO8NZ1ypw6P3XrBSYV4= X-Received: by 2002:a0c:88f0:: with SMTP id 45mr1124543qvo.78.1568763737848; Tue, 17 Sep 2019 16:42:17 -0700 (PDT) MIME-Version: 1.0 References: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> <20190916105433.11404-10-ivan.khoronzhuk@linaro.org> In-Reply-To: <20190916105433.11404-10-ivan.khoronzhuk@linaro.org> From: Andrii Nakryiko Date: Tue, 17 Sep 2019 16:42:07 -0700 Message-ID: Subject: Re: [PATCH v3 bpf-next 09/14] samples: bpf: makefile: use own flags but not host when cross compile To: Ivan Khoronzhuk 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > +TPROGS_CFLAGS += -fomit-frame-pointer Why this one? > +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... > +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 >