Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4267114ybe; Mon, 16 Sep 2019 09:17:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXRDSSrQCNg5TRst5kRkDQmxtIOqazvgP5QNgduoyZKdkItakRiXwSKxsTA4hb2buuNhDV X-Received: by 2002:a17:906:d0c5:: with SMTP id bq5mr788159ejb.95.1568650625117; Mon, 16 Sep 2019 09:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568650625; cv=none; d=google.com; s=arc-20160816; b=WTBRLtAx8SicatJNdB/f7vlhHyCX3bQEQy8EvFWdUDmyPCebEQK2NsXmGDwTEh6IKw QfbgwBGKsQNZLGJlrW+6IrMnyXNZxZSGrHARepsExznuKgecBsPC3upnQ0KuZ0Fat0kw IY83f3RHxcGj6o+evHuTEDeZcl0G5rA2Kcvdy09Xd7MXz/m68eaNcYYYk6HmTHbFZhlA tuYjmGEcLx4jaujphcFSFpVh+i85FdtCD6pHKIePuEsdtHPgdmNC0GbqHpWwfuvaVRct +ujrvnbARrxyOg7nJ3AElP85Pvhx1V5i6mc1C7bIy+ydq4LeS+huT6h80taOxEkN+xKb Il0g== 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=R9JtqNk8649kaZ7fRKK2bkSXir1+MxsmtAxyBria8dMAQI5STKMgshUaXeU0I1riKj H8yMF4GUgErchb4ZX0pNzE7jZ1nEVNY6XY0b6mAf/KPYhta9gGHY3s8Kl0jQaksMHc6A gl8k1PCGAKpmjXvWcJTcZj63MBIKIhnLvvGb8nMxkH5SfVeGxA7FDC4SLZY2zYg0wVO1 XMrU+BHLA5DwqE4SJUNExhDXPQaYjIRfF7o48Y86yxUfawo0aqKQRy947qI4pK2t6TEq 4jAdJzmlCe1ZL/MqMHStpNXIeLNfXgt4lwFV6u2qbdlzQCzW1Ttk4tdAzYhZLtqxQNBq VhYg== 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 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 n19si6143781ejs.159.2019.09.16.09.16.41; Mon, 16 Sep 2019 09:17:05 -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=fA1ZBPhj; 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 S1732572AbfIPKy5 (ORCPT + 99 others); Mon, 16 Sep 2019 06:54:57 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:44140 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732535AbfIPKyz (ORCPT ); Mon, 16 Sep 2019 06:54:55 -0400 Received: by mail-lj1-f196.google.com with SMTP id m13so5320690ljj.11 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=uDbsWYTSvi3JA5V01TZaGJHjiuVYtvxPXFajkuxsI6j4WZJVPCLD46Nhj5IH4Jz6+Q 2JiveRgE7bZwurC7Si0M2nPa1ytqZ2IyLtpSzaxyNZZNANSWIl4JO/qrMyacEiYvnJ3v 4Z3XV2R9Pg0p5QxERfUYdWThPyBiEjzUeTi7ppWNaByTJKI7NsCtOTAOmOzKd8wXJAHg ghBWvJ1DsiLkTLevmA8qLkKMkzhhgbdBYW/5dGx3Ku4Jh++6jzS9EJulTk902WmYzbLf 5gmjqlISvofdZNHGKj8MpRS+pIAdRYTH7Hb0NB1RQp5+IzrT/0cAM0O1NDNP8EWeUISp DlAA== X-Gm-Message-State: APjAAAWzQESMK1/YuLHRMMzfdgR7WRMorZFhH1UPzQEZ/OQsoCN4MzwY /0Lj1VeXo8xbIXejaZGMSjJ1vw== 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(+) 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/ -- 2.17.1