From patchwork Thu Apr 23 14:23:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11505809 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7E5071392 for ; Thu, 23 Apr 2020 14:24:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5B79D206ED for ; Thu, 23 Apr 2020 14:24:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587651891; bh=FwygQils8DzB5QIO6kXsQ+CsetkfmNfNe2b3sSiyi2Y=; h=From:To:Cc:Subject:Date:List-ID:From; b=HguIV7XM9P9NiCRMJxEDulnJYgB/Ho0bBXP3OmbYVDRp5urHb5fXGLS+AWZAkUAUM JkA7GANOtElklWnBCTWIMSlEO5wf7jGcq1R52xKM5Pbw3zNJVTdhIH0fa/QbC4Qexa 51f1jxUyl3w+SS9RizyYfF3Iez/nEP58XK9EAY/A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728135AbgDWOYu (ORCPT ); Thu, 23 Apr 2020 10:24:50 -0400 Received: from conuserg-12.nifty.com ([210.131.2.79]:43061 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726458AbgDWOYu (ORCPT ); Thu, 23 Apr 2020 10:24:50 -0400 Received: from oscar.flets-west.jp (softbank126090202047.bbtec.net [126.90.202.47]) (authenticated) by conuserg-12.nifty.com with ESMTP id 03NEO72U028581; Thu, 23 Apr 2020 23:24:07 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com 03NEO72U028581 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1587651848; bh=GblWkrQ3fEk/yGag5fkIHPDknZcOQFOJ4u0hcJxUM+0=; h=From:To:Cc:Subject:Date:From; b=LM0K96az7fkbv+R8SxUG4eo39HU/jM6q0JT1kmFn40n2ZeU2VcTuuq9rkkDA6WO13 kSa+i/6AW3PCOZYmYQgUhXvi5KVN0D0ikpkk2GkVfAvMosWhIJNUPiUpz+3KHoI5tR 13l+n2REvpNMl9O+yPXCLVY+VllaTK0xiH/xGhOF0B8bal+xN5IB+0wjElmoETZ8DO RZnExlLkdTchPBZAxL5TyM6S4P48PWVzaS5EYuuOfSrsP10EGfVnYtbtcvTEGQCNyN 80U444az98uXO4FO7MiSQINQ3RAjBj+5ngYaZdJ0VZyCuLpvI4fA1PcGojC1iiCsO+ w1mhux82lz5RA== X-Nifty-SrcIP: [126.90.202.47] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , clang-built-linux@googlegroups.com, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/4] kbuild: use $(CC_VERSION_TEXT) to evaluate CC_IS_GCC and CC_IS_CLANG Date: Thu, 23 Apr 2020 23:23:51 +0900 Message-Id: <20200423142354.312088-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org The result of '$(CC) --version | head -n 1' is already computed by the top Makefile, and stored in the environment variable, CC_VERSION_TEXT. 'echo' is probably less expensive than the two commands $(CC) and 'head' although this optimization is not noticeable level. Signed-off-by: Masahiro Yamada Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor --- Changes in v2: - new patch init/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index 9e22ee8fbd75..5f797df3f043 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -9,7 +9,7 @@ config DEFCONFIG_LIST default "arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)" config CC_IS_GCC - def_bool $(success,$(CC) --version | head -n 1 | grep -q gcc) + def_bool $(success,echo "$(CC_VERSION_TEXT)" | grep -q gcc) config GCC_VERSION int @@ -21,7 +21,7 @@ config LD_VERSION default $(shell,$(LD) --version | $(srctree)/scripts/ld-version.sh) config CC_IS_CLANG - def_bool $(success,$(CC) --version | head -n 1 | grep -q clang) + def_bool $(success,echo "$(CC_VERSION_TEXT)" | grep -q clang) config CLANG_VERSION int From patchwork Thu Apr 23 14:23:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11505805 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 36DC8913 for ; Thu, 23 Apr 2020 14:24:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1CEE2208E4 for ; Thu, 23 Apr 2020 14:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587651889; bh=BpUb0BBw5EhgaZkhHSPvHqB8CqgdB6yE1vxXqRbuajk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gsGdIBd/s2217QBF4xNLq7sg6s7/6Jvzj5MccZ8gIBbcIHRXk3LBB9SCMJgaofEu/ rZmN2UXoeVw9xVrTYHPaWXW4bOEctvuX/5wioZIPbGDjrx40RFl0AoKYEkeZjVDeo6 4GMxnY9RaK8chkkTbsv8Ec+U5zvE4o6vyXeFRz8E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726713AbgDWOYk (ORCPT ); Thu, 23 Apr 2020 10:24:40 -0400 Received: from conuserg-12.nifty.com ([210.131.2.79]:42830 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726458AbgDWOYi (ORCPT ); Thu, 23 Apr 2020 10:24:38 -0400 Received: from oscar.flets-west.jp (softbank126090202047.bbtec.net [126.90.202.47]) (authenticated) by conuserg-12.nifty.com with ESMTP id 03NEO72V028581; Thu, 23 Apr 2020 23:24:08 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com 03NEO72V028581 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1587651848; bh=dZXf7RX0rt+kpbcYyj6XQVDErqTPqO5onUOvG62v5rY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0AApny0S7hBgWPz4YTP2vapxj0SaBbn73Xty1w2smskRlRV+ZdSMVG2jaCGmYvro4 IiWfgDOshRxeAvzecsBk8m3EEzFk4x2J6wbRv9ej6lmgldI07Ey6SC13Z/H86TlyA2 8fjJBMmLOMt8JmzzL34HbsgUqxXCRqOQCc5OW5JitbTjF0Ue8Xzy83xjllDtl05BeE ZcXpbnmi3krI9m7FZhV1iOmWgqGfVZqWyibjBJaOt0QIwJQfDCcKmMfH2y1n12eo94 RDJjNMZJ71obfCs1ZROMvzylmJZZLQ7vV7HZZGX1vVnKatwVo31ozIzdIXU1OMG1QT vR8Q7/4OvM7Pw== X-Nifty-SrcIP: [126.90.202.47] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/4] kbuild: ensure full rebuild when the compiler is updated Date: Thu, 23 Apr 2020 23:23:52 +0900 Message-Id: <20200423142354.312088-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200423142354.312088-1-masahiroy@kernel.org> References: <20200423142354.312088-1-masahiroy@kernel.org> MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Commit 21c54b774744 ("kconfig: show compiler version text in the top comment") added the environment variable, CC_VERSION_TEXT in the comment of the top Kconfig file. It can detect the compiler update, and invoke the syncconfig because all environment variables referenced in Kconfig files are recorded in include/config/auto.conf.cmd This commit makes it a CONFIG option in order to ensure the full rebuild when the compiler is updated. This works like follows: include/config/kconfig.h contains "CONFIG_CC_VERSION_TEXT" in the comment block. The top Makefile specifies "-include $(srctree)/include/linux/kconfig.h" to guarantee it is included from all kernel source files. fixdep parses every source file and all headers included from it, searching for words prefixed with "CONFIG_". Then, fixdep finds CONFIG_CC_VERSION_TEXT in include/config/kconfig.h and adds include/config/cc/version/text.h into every .*.cmd file. When the compiler is updated, syncconfig is invoked because init/Kconfig contains the reference to the environment variable CC_VERTION_TEXT. CONFIG_CC_VERSION_TEXT is updated to the new version string, and include/config/cc/version/text.h is touched. In the next rebuild, Make will rebuild every files since the timestamp of include/config/cc/version/text.h is newer than that of target. Signed-off-by: Masahiro Yamada --- Changes in v2: - Move detailed comments to Kconfig help Kconfig | 2 -- include/linux/kconfig.h | 2 ++ init/Kconfig | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Kconfig b/Kconfig index e10b3ee084d4..745bc773f567 100644 --- a/Kconfig +++ b/Kconfig @@ -5,8 +5,6 @@ # mainmenu "Linux/$(ARCH) $(KERNELVERSION) Kernel Configuration" -comment "Compiler: $(CC_VERSION_TEXT)" - source "scripts/Kconfig.include" source "init/Kconfig" diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h index cc8fa109cfa3..9d12c970f18f 100644 --- a/include/linux/kconfig.h +++ b/include/linux/kconfig.h @@ -2,6 +2,8 @@ #ifndef __LINUX_KCONFIG_H #define __LINUX_KCONFIG_H +/* CONFIG_CC_VERSION_TEXT (Do not delete this comment. See help in Kconfig) */ + #include #ifdef CONFIG_CPU_BIG_ENDIAN diff --git a/init/Kconfig b/init/Kconfig index 5f797df3f043..a494212a3a79 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -8,6 +8,23 @@ config DEFCONFIG_LIST default "/boot/config-$(shell,uname -r)" default "arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)" +config CC_VERSION_TEXT + string + default "$(CC_VERSION_TEXT)" + help + This is used in unclear ways: + + - Re-run Kconfig when the compiler is updated + The 'default' property references the environment variable, + CC_VERSION_TEXT so it is recorded in include/config/auto.conf.cmd. + When the compiler is updated, Kconfig will be invoked. + + - Ensure full rebuild when the compier is updated + include/linux/kconfig.h contains this option in the comment line so + fixdep adds include/config/cc/version/text.h into the auto-generated + dependency. When the compiler is updated, syncconfig will touch it + and then every file will be rebuilt. + config CC_IS_GCC def_bool $(success,echo "$(CC_VERSION_TEXT)" | grep -q gcc) From patchwork Thu Apr 23 14:23:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11505807 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DFC8B913 for ; Thu, 23 Apr 2020 14:24:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C793F208E4 for ; Thu, 23 Apr 2020 14:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587651889; bh=XmS8pQ2PXn/pw9dfX8EPTJ1tvhsuVr38vl7orPxFm8s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=IdtfuETpazDyc1EbTrvLSpQAGaygkA89gne6S7cCF/4HAmt2a+TCPrWx/boAur6ya t/PWms5rn32Ndd6Sgo+/8VxXLXXR9+EwOb0UB0wBhVe/sS8KvockDC9i1UbzuUcx+X 66VKUGRi3OKR69wSI0IG9r8Y0qqMmEeEBH5HXMWo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726591AbgDWOYk (ORCPT ); Thu, 23 Apr 2020 10:24:40 -0400 Received: from conuserg-12.nifty.com ([210.131.2.79]:42832 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726119AbgDWOYi (ORCPT ); Thu, 23 Apr 2020 10:24:38 -0400 Received: from oscar.flets-west.jp (softbank126090202047.bbtec.net [126.90.202.47]) (authenticated) by conuserg-12.nifty.com with ESMTP id 03NEO72W028581; Thu, 23 Apr 2020 23:24:09 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com 03NEO72W028581 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1587651849; bh=y/RgA3OfQwkVYcRBj8yVKgjZM+9PXxFWaqqKysxWTF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GEJHkPB7pnUT8XQVjZx66sdja70mNI1EkP3EXp+DPCtqmUPuIF5GCm2lofc6Z1CY1 zPE8LTXS/oMr5FXjAPpQGzUI9TTChO4wTYUglxaPKYz1TEl0o4eY3QWGprxFCLjCxs E/lDXfqjXjQvxZs90Y1iacbc2bl1zHXAN4RH/Us/V3+1jTYaBuhJ7J61rF1aUK+7e1 3kjzxKG6GqZBABH1Nvee/Mby55k+rseUpP7cVY6XkUz/PhNUX0i0z/v+f/PjXm0jqr LzTeas2+e//21lUlxJIDhYKrgGtJA2I2wqCgxTPMsWoLb9cUNKhihnGFMjWL/v6fLm 3xHJci5vYW77Q== X-Nifty-SrcIP: [126.90.202.47] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 3/4] kbuild: use -MMD instead of -MD to exclude system headers from dependency Date: Thu, 23 Apr 2020 23:23:53 +0900 Message-Id: <20200423142354.312088-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200423142354.312088-1-masahiroy@kernel.org> References: <20200423142354.312088-1-masahiroy@kernel.org> MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org This omits system headers from the generated header dependency. System headers are not updated unless you upgrade the compiler. Nor do they contain CONFIG options, so fixdep does not need to parse them. Having said that, the effect of this optimization will be quite small because the kernel code generally does not include system headers except . Host programs include a lot of system headers, but there are not so many in the kernel tree. Theoretically, fixdep does not need to cater to host programs because they should not contain CONFIG options in the first place. fixdep actually does just because Kbuild reuses if_changed_dep for host programs. At first, keeping system headers in .*.cmd files might be useful to detect the compiler update, but there is no guarantee that is included from every file. So, I implemented a more reliable way in the previous commit. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/Kbuild.include | 2 +- scripts/Makefile.host | 4 ++-- scripts/Makefile.lib | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 6cabf20ce66a..0c3dc983439b 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -16,7 +16,7 @@ pound := \# dot-target = $(dir $@).$(notdir $@) ### -# The temporary file to save gcc -MD generated dependencies must not +# The temporary file to save gcc -MMD generated dependencies must not # contain a comma depfile = $(subst $(comma),_,$(dot-target).d) diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 2045855d0b75..c8a4a033dc3e 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -88,8 +88,8 @@ _hostcxx_flags += -I $(objtree)/$(obj) endif endif -hostc_flags = -Wp,-MD,$(depfile) $(_hostc_flags) -hostcxx_flags = -Wp,-MD,$(depfile) $(_hostcxx_flags) +hostc_flags = -Wp,-MMD,$(depfile) $(_hostc_flags) +hostcxx_flags = -Wp,-MMD,$(depfile) $(_hostcxx_flags) ##### # Compile programs on the host diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 97547108ee7f..a94c1e741df9 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -171,22 +171,22 @@ modkern_aflags = $(if $(part-of-module), \ $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE), \ $(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL)) -c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ +c_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ -include $(srctree)/include/linux/compiler_types.h \ $(_c_flags) $(modkern_cflags) \ $(basename_flags) $(modname_flags) -a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ +a_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ $(_a_flags) $(modkern_aflags) -cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ +cpp_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ $(_cpp_flags) ld_flags = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) DTC_INCLUDE := $(srctree)/scripts/dtc/include-prefixes -dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ +dtc_cpp_flags = -Wp,-MMD,$(depfile).pre.tmp -nostdinc \ $(addprefix -I,$(DTC_INCLUDE)) \ -undef -D__DTS__ From patchwork Thu Apr 23 14:23:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11505803 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A465B1392 for ; Thu, 23 Apr 2020 14:24:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A700208E4 for ; Thu, 23 Apr 2020 14:24:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587651880; bh=1xIts4KaIX3Y30fLzFZNrsEs46xtAGAJjx6EYhOOeVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=c/mkOG2BPjcGo3st3UOACWraNEJwWHiPyJ0q47GbZs8Slwwi7k3biYy4ELvfR2YYa jJLIyMMwnHFhakBZ1QjRarwKV63pBEeU8UsH86yd9IuSlcFSjvPIS3Gr4N50csHH6o 2VhyHLMTHPFw5IjGnU8nzYYa1A5emFwymUJSZZNw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726380AbgDWOYk (ORCPT ); Thu, 23 Apr 2020 10:24:40 -0400 Received: from conuserg-12.nifty.com ([210.131.2.79]:42829 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726456AbgDWOYi (ORCPT ); Thu, 23 Apr 2020 10:24:38 -0400 Received: from oscar.flets-west.jp (softbank126090202047.bbtec.net [126.90.202.47]) (authenticated) by conuserg-12.nifty.com with ESMTP id 03NEO72X028581; Thu, 23 Apr 2020 23:24:09 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com 03NEO72X028581 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1587651849; bh=OlCb8frhpY2Za1yj/p2H075SumHInvU8We060i62nwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oZjBIcd4ohGNjihfaisSdXgwVTujFq+0B8pHpx3EVq04kMZpyRDsbo3haZBTcmB1M 098HHsN68cll5ysJdxKc8kTIOEQ6sn8czjan0cq00Jux3B4PL9X0XJnvtAALXq5WR5 PNEFNiQU9Ol8WY+YTKfNHK4EMW1aymqhT08DB01mZeQIu36rMXR9tc5HcfD0GS19yY P7KeMJ39RoIIFzmgYoEWG7tQ6ADoxAxYO/Ayfc1iWJ7XPOFHB3Nnz2RAonPKAV36ga sP+OOwJSQ2Lbi6RIAg5FzjEeE9L4igdfTgiRvnrNe35AbGbgXpsU6YNdEdzJVjqjdI a/kTQPvWWC7mQ== X-Nifty-SrcIP: [126.90.202.47] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 4/4] kbuild: use CONFIG_CC_VERSION_TEXT to construct LINUX_COMPILER macro Date: Thu, 23 Apr 2020 23:23:54 +0900 Message-Id: <20200423142354.312088-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200423142354.312088-1-masahiroy@kernel.org> References: <20200423142354.312088-1-masahiroy@kernel.org> MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org scripts/mkcompile_h runs $(CC) just for getting the version string. Re-use CONFIG_CC_VERSION_TEXT to optimize it. For GCC, this slightly changes the version string. I do not think it is a big deal as we do not have the defined format for LINUX_COMPILER. In fact, the recent commit 4dcc9a88448a ("kbuild: mkcompile_h: Include $LD version in /proc/version") added the linker version. Signed-off-by: Masahiro Yamada --- Changes in v2: - new patch init/Makefile | 2 +- scripts/mkcompile_h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/init/Makefile b/init/Makefile index d45e967483b2..30c7345e4fe2 100644 --- a/init/Makefile +++ b/init/Makefile @@ -35,4 +35,4 @@ include/generated/compile.h: FORCE @$($(quiet)chk_compile.h) $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \ "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" \ - "$(CONFIG_PREEMPT_RT)" "$(CC)" "$(LD)" + "$(CONFIG_PREEMPT_RT)" "$(CONFIG_CC_VERSION_TEXT)" "$(LD)" diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index 5b80a4699740..baf3ab8d9d49 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h @@ -6,7 +6,7 @@ ARCH=$2 SMP=$3 PREEMPT=$4 PREEMPT_RT=$5 -CC=$6 +CC_VERSION="$6" LD=$7 vecho() { [ "${quiet}" = "silent_" ] || echo "$@" ; } @@ -62,7 +62,6 @@ UTS_VERSION="$(echo $UTS_VERSION $CONFIG_FLAGS $TIMESTAMP | cut -b -$UTS_LEN)" printf '#define LINUX_COMPILE_BY "%s"\n' "$LINUX_COMPILE_BY" echo \#define LINUX_COMPILE_HOST \"$LINUX_COMPILE_HOST\" - CC_VERSION=$($CC -v 2>&1 | grep ' version ' | sed 's/[[:space:]]*$//') LD_VERSION=$($LD -v | head -n1 | sed 's/(compatible with [^)]*)//' \ | sed 's/[[:space:]]*$//') printf '#define LINUX_COMPILER "%s"\n' "$CC_VERSION, $LD_VERSION"