From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75196C55186 for ; Thu, 23 Apr 2020 14:24:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 56212208E4 for ; Thu, 23 Apr 2020 14:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587651886; bh=XmS8pQ2PXn/pw9dfX8EPTJ1tvhsuVr38vl7orPxFm8s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=DITpDzQU/l0tf9eeMBxFHlJaFUiYxxVj3M8U6xY4gWNxiO6gUEApOdiw3mz86lm2t mzLQY/HPHSXrLPepcvhIAFuAXzcYVXf4wNDgya8/oEwTQdZ6w6kNcCqF7PBAM1qMKz MZJ/1V9PryuDUwwekAgj4GZgVoS9d4fYyX/NAx3Q= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728036AbgDWOYm (ORCPT ); Thu, 23 Apr 2020 10:24:42 -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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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__ -- 2.25.1