From patchwork Tue Oct 30 04:21:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 149693 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp4977606ljp; Mon, 29 Oct 2018 21:23:44 -0700 (PDT) X-Google-Smtp-Source: AJdET5fOIkaCS34RV0fKpnaDF/PMNsLHbw8Ftjj+ebyAj6a5xVDL1HGOs3BPq9y6aHCxHGlgZKtw X-Received: by 2002:a17:902:64:: with SMTP id 91-v6mr4476259pla.161.1540873424284; Mon, 29 Oct 2018 21:23:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540873424; cv=none; d=google.com; s=arc-20160816; b=Ia0kyStP6w8z53FrwDJDLIHNU2WYZDQRk65dc0xHbeXr3wzRBNKOeBe1JZUwW/fHhj sZ+10v/9DZ8uMi4nqRtJCRkmxF1DldCsauc+Y6nbY4U1FdHbICIe6iVU2kLA+WEqVUKb mCmwObmkKwhzHABsLm4DmwaAxeoYAfTEipEkRFr5QrkVZtWwZKrLlyQKepbY1/S9xkPK ivjE2HAYMqXjZMTISpmSPUOsvDdQ2XBBxVHy9yQ7nnRfvsvImUM2FqLM2b0DwoswjVHv aC9bKPyk3XMEvoMKZBl+5yV3RVhMAgt/6SmCduH0DUuB90bwCWpdts5wiUoiHs0N5WVR M2QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=U06X4wzGUcKfpT3rd6eTAurlLB8yHi+i7Y+oD+BqWGI=; b=a9Q36UnG/oFpbdPRXp/Oq5KLKZRAj4fsQpDXj/QyfYU9sH09KUPzgrfvaNbiE4OSNH 3PmkJjD7KT8z+oqRVUhCC+cmvjpzJfDNyBXrzgfiSjs8Z1CJi5/p/LyeS9nUKNZyejpv MxfGN5FBfsFPS9sWPB7N43kpxKmalIxI6EqEPzjrDfisSAPQVW+73DkfZMvQj8pt/hQ+ zgxwNtbadfhNhZYgNipWYuJRD+lgDfm/VA2GYHJu9OX8KTs+c3Gzl9CjThALtB5+ijZH I2E73x17k2WuWHzHo8sSJDXH5aelznc88/KIM9vmBHe6GBoN9fHjLUeB00t9/C+/gtDH UgCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=QMIHH3VI; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c135-v6si14144588pfc.6.2018.10.29.21.23.43; Mon, 29 Oct 2018 21:23:44 -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=@nifty.com header.s=dec2015msa header.b=QMIHH3VI; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726523AbeJ3NPa (ORCPT + 32 others); Tue, 30 Oct 2018 09:15:30 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:36722 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725988AbeJ3NPa (ORCPT ); Tue, 30 Oct 2018 09:15:30 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id w9U4LgZK000764; Tue, 30 Oct 2018 13:21:42 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com w9U4LgZK000764 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1540873303; bh=U06X4wzGUcKfpT3rd6eTAurlLB8yHi+i7Y+oD+BqWGI=; h=From:To:Cc:Subject:Date:From; b=QMIHH3VIc22lCyApk6nAwVLVVVeGu5tpxb0dOTThkGDf2WyypYKO8jE7lypabKmVp beRCiYw0UDlfLYtD8ksbR2gtf6c9QSAv41ijLHfJBrWbIMt8fOYrQz8Mky5n5ypcby ivcuUn34IkFJxRon5eCgL0VeT0yQSGhXq7GcVlW2A9hCszA/bAxAYpKMk1F0gb1vMp 1aFUsTYRLzRxovPIsEbJmtQLNQf/cqiDrJwp8nx9R49r8XUsJfVd8tLe3LBFBklaQg cgfnRry5me4+5DGjfz/Wb2LC/0QJeOzeHIqOwl6NX+hxO1tD0gmNPlDihoNO3HFpQH HGqmmbzoKb7og== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-mips@linux-mips.org, James Hogan , Michael Ellerman , Benjamin Herrenschmidt , linux-kernel@vger.kernel.org, Michal Marek , Paul Mackerras , Paul Burton , Ralf Baechle , linuxppc-dev@lists.ozlabs.org Subject: [PATCH 1/2] kbuild: replace cc-name test with CONFIG_CC_IS_CLANG Date: Tue, 30 Oct 2018 13:21:32 +0900 Message-Id: <1540873293-29817-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Evaluating cc-name invokes the compiler every time even when you are not compiling anything, like 'make help'. This is not efficient. The compiler type has been already detected in the Kconfig stage. Use CONFIG_CC_IS_CLANG, instead. Signed-off-by: Masahiro Yamada --- Makefile | 2 +- arch/mips/Makefile | 2 +- arch/mips/vdso/Makefile | 2 +- arch/powerpc/Makefile | 4 ++-- scripts/Makefile.extrawarn | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) -- 2.7.4 Acked-by: Michael Ellerman (powerpc) diff --git a/Makefile b/Makefile index 0a42d06..bd93bc3 100644 --- a/Makefile +++ b/Makefile @@ -707,7 +707,7 @@ stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG) := -fstack-protector-strong KBUILD_CFLAGS += $(stackp-flags-y) -ifeq ($(cc-name),clang) +ifeq ($(CONFIG_CC_IS_CLANG),y) KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) KBUILD_CFLAGS += $(call cc-disable-warning, gnu) diff --git a/arch/mips/Makefile b/arch/mips/Makefile index 15a84cf..ad1c418 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile @@ -128,7 +128,7 @@ cflags-y += -ffreestanding # clang's output will be based upon the build machine. So for clang we simply # unconditionally specify -EB or -EL as appropriate. # -ifeq ($(cc-name),clang) +ifeq ($(CONFIG_CC_IS_CLANG),y) cflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -EL else diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile index 34605ca..e2b055e 100644 --- a/arch/mips/vdso/Makefile +++ b/arch/mips/vdso/Makefile @@ -10,7 +10,7 @@ ccflags-vdso := \ $(filter -march=%,$(KBUILD_CFLAGS)) \ -D__VDSO__ -ifeq ($(cc-name),clang) +ifeq ($(CONFIG_CC_IS_CLANG),y) ccflags-vdso += $(filter --target=%,$(KBUILD_CFLAGS)) endif diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 17be664..338e827 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -96,7 +96,7 @@ aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1) aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mabi=elfv2 endif -ifneq ($(cc-name),clang) +ifneq ($(CONFIG_CC_IS_CLANG),y) cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mno-strict-align endif @@ -175,7 +175,7 @@ endif # Work around gcc code-gen bugs with -pg / -fno-omit-frame-pointer in gcc <= 4.8 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44199 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52828 -ifneq ($(cc-name),clang) +ifneq ($(CONFIG_CC_IS_CLANG),y) CC_FLAGS_FTRACE += $(call cc-ifversion, -lt, 0409, -mno-sched-epilog) endif endif diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 24b2fb1..88129e5 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -64,7 +64,7 @@ endif KBUILD_CFLAGS += $(warning) else -ifeq ($(cc-name),clang) +ifeq ($(CONFIG_CC_IS_CLANG),y) KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides) KBUILD_CFLAGS += $(call cc-disable-warning, unused-value) KBUILD_CFLAGS += $(call cc-disable-warning, format) From patchwork Tue Oct 30 04:21:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 149692 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp4976447ljp; Mon, 29 Oct 2018 21:22:00 -0700 (PDT) X-Google-Smtp-Source: AJdET5cw11j3iemJalicQHua0WfKtrJCsWFWgCfmuduaJksDUgOt/YTWlsd7QfJ9cmh/VN7W8+XM X-Received: by 2002:a65:4783:: with SMTP id e3-v6mr16193842pgs.12.1540873320791; Mon, 29 Oct 2018 21:22:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540873320; cv=none; d=google.com; s=arc-20160816; b=nbQBhhGn8+FC0hchdAW8PDz1Z2bt8Mzm/63mCrDLo4kfhrheJN/aXI0XyFEVRDAEew fbE3Ep3KrGztJ5fYJlKgPPKFYtxU6MomcDyVyk4ojNWA9sq4VVSq62X5p7IZiveTNHIA 5Nuoel9bu+qtMPI9heF8P8Q6QaSAl9iDjRUU6NjMAiq4wu/3Qv1rdA3CzPQgcZ7HEQDb vhzluwpHaI4d2FK18FxIRflK7bT9KT6iwmmtEMgzdlReZBAy9s7Wip/Vi0L+HsCE8zSU RuHx96eVKYmch3rPiuQaY2NoVcgMQamtQFHicrnr2v8MPWhhZuHuYTIWpbuCfCkxbO46 sYXw== 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:dkim-filter; bh=vok3clh1+AcMHEIx5gsB0OBiQpXmww8S1/r1ejlge/g=; b=AxrQIUncvcmqTB49f2dOSTr6f2y8q4QEtB46xkvlLEGvi6bicFUDMUHcrG4opGK3wp KfKAQFXw7Dq1/gFSYXnu8eKgYHRTiaPZIk9Jl3c9NEYWHGmdJP9CbnA4bIp9tBKwd6EB byuoaoKpQeQo28rp7qe5tmhkfp2PHrppxqdQDTl16GbLc0uZ+yedkeT5LAkmNU/59oG3 UJR0mwr5XiFPVPgPiqh6Q0Q1zKRWmQihpXi/+4n3enYc7SaUPzvwdEpeqrVK6TrtWpKn zptMDhuZqmjfy0Zaj9n4mHhbiwf/i5W8WMz5yLYaK2KxLIRrZJTe1JUxJl/SPeN69uR6 B1rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=hqzboSOg; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65-v6si20600151pfl.220.2018.10.29.21.21.58; Mon, 29 Oct 2018 21:22:00 -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=@nifty.com header.s=dec2015msa header.b=hqzboSOg; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726108AbeJ3NNo (ORCPT + 32 others); Tue, 30 Oct 2018 09:13:44 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:33569 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725971AbeJ3NNo (ORCPT ); Tue, 30 Oct 2018 09:13:44 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id w9U4LgZL000764; Tue, 30 Oct 2018 13:21:43 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com w9U4LgZL000764 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1540873303; bh=vok3clh1+AcMHEIx5gsB0OBiQpXmww8S1/r1ejlge/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hqzboSOgvlGLlHrDxCF879w0FQ1OFDmdzF1JKCpMFslFuQ/dh3uJOmOqiKF+clWun +NRttbUcp1ACWTaJGy82Vv+b39zhxgKi6CSk7dOjEb+RAMQmcu6uAV7X0mq8ksBCS9 3sT9s23GKdjfdLfnxorRD/RY4ZyUmw99YFRf8j9rd6Ad46dmpe+gUVd8Ru16LPNB58 HTd/zYrRQU/3KK4jF/A6JUTf4+5fjx8MxSqmcTdfPgfTccmut6a61qEnyatZm9UJvO ahvGIM3fAqnZC4Yu8OfYNLomXnBI5fjWul4QiBjHZ8nOyF9mjvYVAqBOl26PkfHWbX g0cw4ITBNK6YA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] kbuild: remove cc-name variable Date: Tue, 30 Oct 2018 13:21:33 +0900 Message-Id: <1540873293-29817-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1540873293-29817-1-git-send-email-yamada.masahiro@socionext.com> References: <1540873293-29817-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is one more user of $(cc-name) in the top Makefile. It is supposed to detect Clang before invoking Kconfig, so it should still be there in the $(shell ...) form. All the other users of $(cc-name) have been replaced with $(CONFIG_CC_IS_CLANG). Hence, scripts/Kbuild.include does not need to define cc-name any more. Signed-off-by: Masahiro Yamada --- Makefile | 2 +- scripts/Kbuild.include | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index bd93bc3..430f7de 100644 --- a/Makefile +++ b/Makefile @@ -485,7 +485,7 @@ ifneq ($(KBUILD_SRC),) $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) endif -ifeq ($(cc-name),clang) +ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),) ifneq ($(CROSS_COMPILE),) CLANG_TARGET := --target=$(notdir $(CROSS_COMPILE:%-=%)) GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD))) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index ca21a35..51703ae 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -140,10 +140,6 @@ cc-option-yn = $(call try-run,\ cc-disable-warning = $(call try-run,\ $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) -# cc-name -# Expands to either gcc or clang -cc-name = $(shell $(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc) - # cc-version cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))