From patchwork Mon Sep 16 10:54:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 173827 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp3337890ilq; Mon, 16 Sep 2019 03:55:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzuPCA6jEhHHfz7iCMhzCe28B7DrYAVdf9P01kZrc+rGMh+ZuT/aCozI7KAvEwaaGHf2Gtn X-Received: by 2002:aa7:c1d0:: with SMTP id d16mr50556601edp.82.1568631300889; Mon, 16 Sep 2019 03:55:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568631300; cv=none; d=google.com; s=arc-20160816; b=EA9RVPi9oSHW3vBNTbcZX8ILC/DQV/FZJFOhkGB+4iL7qokWWdtaSQMdgrm7K4vCHx nfMHOPF3ot+7nxTtMobRIls3cmDPsqQ65IfIT9mFxjbB/md0CbqIQSioWjupyQrKnJQf WmSGQ1drWQtcJ/X9PqU/8IANNQr82Td0azPjrZw9SG7hv1OmX4O6pLgPep8gl/uR8H4V 3YADtWR2btqNl2EHa0o8bl1RV0fHPPqNJwViM8fdWHHwR483bu5GngFa65E/0DScoIhB JO/53p6WLZRWk/HaLk7Cofyt0Ppf0J47Nb8ts3JvPe+4PlmBFihegOIDGaPMTQQkzTXl 115A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=awMC2NNgYQwIhWG3qRO8zKuB3GE6M/09XFXZ6Czatbc=; b=NZe/MJD+fwU/5r5x2KoNREA/6sS8yHaOwarniwMGn4Ya8D03CET5Nfb2NCBR1I22Qt upfa8CDPIbo/4blUnP1n3JXApIzGgWHRopz1/MC/eUHE1C1vlBdMB8BMcJ5r2zSm7Cln EDcDI3cIQuK8oZyMKjYsat+0DBXRkorSyHvHugGJ1DPmZfiWpqgoDVjp98RsiywORF91 PdkzzDVymikAasylKvDAq4X3RoGBh3OFhQOd3sN5JQKuchYoaLMti155qIepRjoI8AAX 5YtL0x9AG1TR7pgDoG1fBJZfWI8BC3nqUTV4+mCEQDD4ZdWv7IOHt3M8Fg7o+yfYDZvp g9LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fA1ZBPhj; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 i24si20524048edj.207.2019.09.16.03.55.00; Mon, 16 Sep 2019 03:55:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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=fA1ZBPhj; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 S1732581AbfIPKy6 (ORCPT + 8 others); Mon, 16 Sep 2019 06:54:58 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:37605 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732510AbfIPKyz (ORCPT ); Mon, 16 Sep 2019 06:54:55 -0400 Received: by mail-lj1-f195.google.com with SMTP id c22so5455809ljj.4 for ; Mon, 16 Sep 2019 03:54:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=awMC2NNgYQwIhWG3qRO8zKuB3GE6M/09XFXZ6Czatbc=; b=fA1ZBPhjkBsytlESQk6kpCQlXY2ePyrNVBUlN9vF9PL4a+tBgZiDhVywUcbg19c3Bt AFVvZR1wfpLJcovFqZU/aQsKJXekdUri03k6Na1iWOGfp6K6Dp58O6CN7NSB6SPDLpfg GXozVCNmNMDLClTQ87gCKyH9LKAUpqI+k+Kbnp0FZ2PA94mpFRY1q5zyGP+aXEbwImgB OFvOewfBoSVb3rMrGhZmnr3GGZ/Ajob3fWyYwb1F8nLz6YwfPnoTqeH9KHRQvED/7xCu AUV1acvpatip1LNApKO+AX58CTgYVBaSdpoGIR9HXyn994giZy6+fdPsNDCYKKXBskWH 9zdw== 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=awMC2NNgYQwIhWG3qRO8zKuB3GE6M/09XFXZ6Czatbc=; b=bUlminGbHj82mIDS8WJ1F9OEZ8jtaNytI06kgDMT+bgLaqV0tp8QA8mYPimwsEPM9t q5gt4PEmsr3UU8Xt0LiNbjJsjWZhJWpoPL7meDKakirrDS3HWURPqkBxowCK8ENYd/Dj tw3HaZnN5/wCLezaZd+sh4aZAlWdNv+gmvpmFmj4erhGktQ9BXRiuTo5xBkCwdwwf41+ kACdR8vnBfi+JwW3iTotbl1qSrlVEpQqh59hrAyHdWfm1zJyJp6eKThE4xD3kZRMfyOg zIzwitT7g5M9xp+ITW9NiwSJun+gfo0f48Bz1pIaKqyRPdU8L8SkUrgd0w8vxW2RUJGv yGNw== X-Gm-Message-State: APjAAAVhGpkDsexGrAgH2lY/loNeu3OqOfD5GI0y4RJSGIxqUkuNP+ie bqqsUqlSZ0w4cOYSakLhrL5QwQ== X-Received: by 2002:a2e:98d2:: with SMTP id s18mr5649688ljj.68.1568631292008; Mon, 16 Sep 2019 03:54:52 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id v1sm8987737lfq.89.2019.09.16.03.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 03:54:51 -0700 (PDT) From: Ivan Khoronzhuk To: ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, sergei.shtylyov@cogentembedded.com, Ivan Khoronzhuk Subject: [PATCH v3 bpf-next 09/14] samples: bpf: makefile: use own flags but not host when cross compile Date: Mon, 16 Sep 2019 13:54:28 +0300 Message-Id: <20190916105433.11404-10-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> References: <20190916105433.11404-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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(+) -- 2.17.1 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 +TPROGS_CFLAGS += -fomit-frame-pointer +TPROGS_CFLAGS += -Wmissing-prototypes +TPROGS_CFLAGS += -Wstrict-prototypes +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/