From patchwork Thu Jul 11 05:44:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11039309 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6694413B1 for ; Thu, 11 Jul 2019 05:46:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5675D28A49 for ; Thu, 11 Jul 2019 05:46:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AB0928A5C; Thu, 11 Jul 2019 05:46:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E141528A49 for ; Thu, 11 Jul 2019 05:46:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728041AbfGKFpy (ORCPT ); Thu, 11 Jul 2019 01:45:54 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:59471 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727922AbfGKFpx (ORCPT ); Thu, 11 Jul 2019 01:45:53 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x6B5ip8L031345; Thu, 11 Jul 2019 14:44:53 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x6B5ip8L031345 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562823893; bh=mjkkjTnXRVjdI3ciIRz1HWZFd7z2yTHWDPrWodufX/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jAODMvDCKfqR1Zhn7vZaIDr1Mbtv7fOKReJCqG98rha6TTAsX3wWiAChWv1gg25W8 r6Sxv0+lEkZ6VZJ30c30gqKTqg0NArc0RYsEIpt5p8cSYVpQn3Pmos6nn6KXvJhJxf ITaMDCsE1YIxfHHN0wFCEuVLsMZARh5uJMs3XIUoxQ/++Uu5X8WcHhi8yJ1B4FsWyW 3Ujk0mejbaMkFCqygqJzfrj168G2a3v9D1O9RJBbuwJFxBPATN8UUyzrMpvxqjFmbA gDWmtm80d1Y3qgfdivmIgylOveCorw2YRsKLGa1cAUtCwLiXXVpDXtsr/aqbzzhvRv 8GEcsS8bddsvA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Nicolas Pitre , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 01/11] kbuild: do not create empty modules.order in the prepare stage Date: Thu, 11 Jul 2019 14:44:24 +0900 Message-Id: <20190711054434.1177-2-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190711054434.1177-1-yamada.masahiro@socionext.com> References: <20190711054434.1177-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, $(objtree)/modules.order is touched in two places. In the 'prepare0' rule, scripts/Makefile.build creates an empty modules.order while processing 'obj=.' In the 'modules' rule, the top-level Makefile overwrites it with the correct list of modules. While this might be a good side-effect that modules.order is made empty every time (probably this is not intended functionality), I personally do not like this behavior. Create modules.order only when it is sensible to do so. This avoids creating the following pointless files: scripts/basic/modules.order scripts/dtc/modules.order scripts/gcc-plugins/modules.order scripts/genksyms/modules.order scripts/mod/modules.order scripts/modules.order scripts/selinux/genheaders/modules.order scripts/selinux/mdp/modules.order scripts/selinux/modules.order Going forward, $(objtree)/modules.order lists the modules that was built in the last successful build. Signed-off-by: Masahiro Yamada --- Changes in v2: - inverted the logic "preparing" -> need-modorder Makefile | 4 ++-- scripts/Makefile.build | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 5c75ea7177f6..d8421d245f75 100644 --- a/Makefile +++ b/Makefile @@ -1076,7 +1076,7 @@ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ; PHONY += $(vmlinux-dirs) $(vmlinux-dirs): prepare - $(Q)$(MAKE) $(build)=$@ need-builtin=1 + $(Q)$(MAKE) $(build)=$@ need-builtin=1 need-modorder=1 filechk_kernel.release = \ echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" @@ -1611,7 +1611,7 @@ $(objtree)/Module.symvers: module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD)) PHONY += $(module-dirs) modules $(module-dirs): prepare $(objtree)/Module.symvers - $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) + $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) need-modorder=1 modules: $(module-dirs) @$(kecho) ' Building modules, stage 2.'; diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 776842b7e6a3..e9b3d88257dd 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -63,7 +63,7 @@ ifneq ($(strip $(real-obj-y) $(need-builtin)),) builtin-target := $(obj)/built-in.a endif -ifdef CONFIG_MODULES +ifeq ($(CONFIG_MODULES)$(need-modorder),y1) modorder-target := $(obj)/modules.order endif From patchwork Thu Jul 11 05:44:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11039293 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4ACF814E5 for ; Thu, 11 Jul 2019 05:46:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 396B228A49 for ; Thu, 11 Jul 2019 05:46:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DDE228A5C; Thu, 11 Jul 2019 05:46:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF3DA28A4A for ; Thu, 11 Jul 2019 05:46:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728100AbfGKFp4 (ORCPT ); Thu, 11 Jul 2019 01:45:56 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:59529 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728031AbfGKFp4 (ORCPT ); Thu, 11 Jul 2019 01:45:56 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x6B5ip8M031345; Thu, 11 Jul 2019 14:44:53 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x6B5ip8M031345 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562823894; bh=X0Z9xUjl6EX9XPtrMZWPoQaJCvf/QCS9Lre9ezeX1dQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bHwi8ztPYdyDa6tI8DH5CsZJ9IRYV8xVu2KGAUcQqdXoBTMAQBFNRrPA/qm0dig9/ 94BEql1ASPfq7azRtzByUL1CC+q9fawkzTaxeS/lVdBimCwn85p6aWt25RVHphZm1L 76hwfT1SufnxyQURYMqZ9IJYzuBxOwXF02FW+Zo/c8w6so/zB5l6H9bReYwP8vRVFu KB00hqisImA3lP6sxtEm8M8PKKnlzeySyfrOqLJDS3/zG8GILIlHza9zm5njCno6IR pnbLTyF4I8ZxLRYoj4TK5fbGVtulUhsXTjz+GcmlgmbQSs2GAkOW4PYnQfFjjAmEWx ElTKeO9I3b0IQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Nicolas Pitre , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 02/11] kbuild: get rid of kernel/ prefix from in-tree modules.{order,builtin} Date: Thu, 11 Jul 2019 14:44:25 +0900 Message-Id: <20190711054434.1177-3-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190711054434.1177-1-yamada.masahiro@socionext.com> References: <20190711054434.1177-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Removing the 'kernel/' prefix will make our life easier because we can simply do 'cat modules.order' to get all built modules with full paths. Currently, we parse the first line of '*.mod' files in $(MODVERDIR). Since we have duplicated functionality here, I plan to remove MODVERDIR entirely. In fact, modules.order is generated also for external modules in a broken format. It adds the 'kernel/' prefix to the absolute path of the module, like this: kernel//path/to/your/external/module/foo.ko This is fine for now since modules.order is not used for external modules. However, I want to sanitize the format everywhere towards the goal of removing MODVERDIR. We cannot change the format of installed module.{order,builtin}. So, 'make modules_install' will add the 'kernel/' prefix while copying them to $(MODLIB)/. Signed-off-by: Masahiro Yamada --- Changes in v2: None Makefile | 4 ++-- scripts/Makefile.build | 2 +- scripts/Makefile.modbuiltin | 2 +- scripts/modules-check.sh | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d8421d245f75..b5e21d676ee2 100644 --- a/Makefile +++ b/Makefile @@ -1333,8 +1333,8 @@ _modinst_: rm -f $(MODLIB)/build ; \ ln -s $(CURDIR) $(MODLIB)/build ; \ fi - @cp -f $(objtree)/modules.order $(MODLIB)/ - @cp -f $(objtree)/modules.builtin $(MODLIB)/ + @sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order + @sed 's:^:kernel/:' modules.builtin > $(MODLIB)/modules.builtin @cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst diff --git a/scripts/Makefile.build b/scripts/Makefile.build index e9b3d88257dd..f21d691c776a 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -426,7 +426,7 @@ endif # builtin-target modorder-cmds = \ $(foreach m, $(modorder), \ $(if $(filter %/modules.order, $m), \ - cat $m;, echo kernel/$m;)) + cat $m;, echo $m;)) $(modorder-target): $(subdir-ym) FORCE $(Q)(cat /dev/null; $(modorder-cmds)) > $@ diff --git a/scripts/Makefile.modbuiltin b/scripts/Makefile.modbuiltin index ea90a90b41a0..12ac300fe51b 100644 --- a/scripts/Makefile.modbuiltin +++ b/scripts/Makefile.modbuiltin @@ -40,7 +40,7 @@ __modbuiltin: $(modbuiltin-target) $(subdir-ym) @: $(modbuiltin-target): $(subdir-ym) FORCE - $(Q)(for m in $(modbuiltin-mods); do echo kernel/$$m; done; \ + $(Q)(for m in $(modbuiltin-mods); do echo $$m; done; \ cat /dev/null $(modbuiltin-subdirs)) > $@ PHONY += FORCE diff --git a/scripts/modules-check.sh b/scripts/modules-check.sh index 39e8cb36ba19..f51f446707b8 100755 --- a/scripts/modules-check.sh +++ b/scripts/modules-check.sh @@ -9,7 +9,7 @@ check_same_name_modules() for m in $(sed 's:.*/::' modules.order | sort | uniq -d) do echo "warning: same module names found:" >&2 - sed -n "/\/$m/s:^kernel/: :p" modules.order >&2 + sed -n "/\/$m/s:^: :p" modules.order >&2 done } From patchwork Thu Jul 11 05:44:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11039297 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8771F14C0 for ; Thu, 11 Jul 2019 05:46:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 782A128A4A for ; Thu, 11 Jul 2019 05:46:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C6DD28A5C; Thu, 11 Jul 2019 05:46:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D24828A49 for ; Thu, 11 Jul 2019 05:46:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728228AbfGKFq0 (ORCPT ); Thu, 11 Jul 2019 01:46:26 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:59531 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727960AbfGKFpz (ORCPT ); Thu, 11 Jul 2019 01:45:55 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x6B5ip8N031345; Thu, 11 Jul 2019 14:44:54 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x6B5ip8N031345 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562823894; bh=73BNt3XOxU/QtVB4UusmprlWYwd5Q4e7yWpAuZSG5uY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YCK5T9hStu+Tg1CcwBxF7RxNzvgQxSD8fZegCbPmyxjHMkTIzehtyWz21wLmdYItT 0xnfiBXXycLrcGRTX7bFIiWTZ+xvl5CJww5/lQDoRO0M5pu40AXZsC6ioXz4S8+3S2 iOKwUYQpMxAan67dXUrCZYmUVz1leCcEdb4f0zoKHRCRCIumcI+5iXgfj2U69fCJhh IbWA8/kyQjcW277Sr1/NHY6uTEYk4UkMUEgjJvhefpU+GOULQoA8dyCyPQkBTlkScH TfcniABve4vtENr0+/C0Oa6F1rPk+qbmog471lBrAha2kPWQviYShv0RhS9xAtNhr2 smX6TrK+sS1xA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Nicolas Pitre , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 03/11] kbuild: remove duplication from modules.order in sub-directories Date: Thu, 11 Jul 2019 14:44:26 +0900 Message-Id: <20190711054434.1177-4-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190711054434.1177-1-yamada.masahiro@socionext.com> References: <20190711054434.1177-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, only the top-level modules.order drops duplicated entries. The modules.order files in sub-directories potentially contain duplication. To list out the paths of all modules, I want to use modules.order instead of parsing *.mod files in $(MODVERDIR). To achieve this, I want to rip off duplication from modules.order of external modules too. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/Makefile.build | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index f21d691c776a..98dede0b2ca8 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -423,13 +423,10 @@ endif # builtin-target # # Create commands to either record .ko file or cat modules.order from # a subdirectory -modorder-cmds = \ - $(foreach m, $(modorder), \ - $(if $(filter %/modules.order, $m), \ - cat $m;, echo $m;)) - $(modorder-target): $(subdir-ym) FORCE - $(Q)(cat /dev/null; $(modorder-cmds)) > $@ + $(Q){ $(foreach m, $(modorder), \ + $(if $(filter %/modules.order, $m), cat $m, echo $m);) :; } \ + | $(AWK) '!x[$$0]++' - > $@ # # Rule to compile a set of .o files into one .a file (with symbol table) From patchwork Thu Jul 11 05:44:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11039291 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0F07C14C0 for ; Thu, 11 Jul 2019 05:46:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F41EC28A49 for ; Thu, 11 Jul 2019 05:46:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E82B328A61; Thu, 11 Jul 2019 05:46:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9612D28A49 for ; Thu, 11 Jul 2019 05:46:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727834AbfGKFp5 (ORCPT ); Thu, 11 Jul 2019 01:45:57 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:59588 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728085AbfGKFp4 (ORCPT ); Thu, 11 Jul 2019 01:45:56 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x6B5ip8O031345; Thu, 11 Jul 2019 14:44:55 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x6B5ip8O031345 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562823895; bh=aRuS7xPLwHQCrWoOTeMolVYBvvu7Tw4KJE4Uze+OyV0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iV9jU60tfKU5vtZ9Py2MycrCttKLlDxXkXYEHJUGLEj2+jU0MkKckEekY5ywAbK0g pvQiUQ5DQkRNigrmzpPB4i0tUQh8ms9VfWQXv1uRhAc4+TyiR1OmCeqJqp4o/CQIZe YNfUcpLKp8CugcjV3GUl3PO6iCtmOsZ18hyFS7LNWt6gXutm3LH8Lr/p8SoIb+GNzH s5MjcMScACopRKuqiZ20qZAwG+ZnFmivNZTm7q77bnnd7QDD2d8Cku7bJ0gazk1/52 MoYupam9tbvDOGZgG3lUQFZKCUDpmgwnl+I7yKSkPGtLdiERWD9E1MCb1pF3BRehZ5 J2vx62iLSHKpA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Nicolas Pitre , Masahiro Yamada , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 04/11] scsi: remove pointless $(MODVERDIR)/$(obj)/53c700.ver Date: Thu, 11 Jul 2019 14:44:27 +0900 Message-Id: <20190711054434.1177-5-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190711054434.1177-1-yamada.masahiro@socionext.com> References: <20190711054434.1177-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Nothing depends on this, so it is dead code. Signed-off-by: Masahiro Yamada --- I will apply this to kbuild tree since it is trivial. Changes in v2: None drivers/scsi/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index 8826111fdf4a..acdd57e647f8 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile @@ -183,7 +183,7 @@ zalon7xx-objs := zalon.o ncr53c8xx.o # Files generated that shall be removed upon make clean clean-files := 53c700_d.h 53c700_u.h scsi_devinfo_tbl.c -$(obj)/53c700.o $(MODVERDIR)/$(obj)/53c700.ver: $(obj)/53c700_d.h +$(obj)/53c700.o: $(obj)/53c700_d.h $(obj)/scsi_sysfs.o: $(obj)/scsi_devinfo_tbl.c From patchwork Thu Jul 11 05:44:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11039301 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5A80213B1 for ; Thu, 11 Jul 2019 05:46:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B36E28A49 for ; Thu, 11 Jul 2019 05:46:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3FF6D28A4A; Thu, 11 Jul 2019 05:46:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9AC528A68 for ; Thu, 11 Jul 2019 05:46:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728133AbfGKFqZ (ORCPT ); Thu, 11 Jul 2019 01:46:25 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:59527 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728028AbfGKFpz (ORCPT ); Thu, 11 Jul 2019 01:45:55 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x6B5ip8P031345; Thu, 11 Jul 2019 14:44:55 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x6B5ip8P031345 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562823896; bh=6aRVUmTSBwVJYpeiNrND1Xnxtiy5tFvj/eUl4BEOmnc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gI/Vgxkl42D76bzIw86W0xAvgqd/+P9LGeK3eqdoNY+/3cg32JjQiPq+OEI5ruDDa 53++i6RCIod+sjVonx9UOF0AwIH8wwyq+kz98nq1muLri3nAmE+/CY0hSD8vYgThxN xlluPEopOqRYPImPeZwz+pPjZ/CUOhFu0eRVuAXpLqSFg5cJow8jRY74FA0GNoS/zM v7VRJyoDyUx5aGxAtrYOA81J0VHJsSGZmLvcBY2QTHd4XpRw6RHIf529efE1P/YQxk RpokO3chRPcsLuBW6FmfUYun6h5aivyvfGhM3tSHAUgcYusgAmO6s+yO3sc9mLklIj wWGw2od18x9UA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Nicolas Pitre , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 05/11] kbuild: modinst: read modules.order instead of $(MODVERDIR)/*.mod Date: Thu, 11 Jul 2019 14:44:28 +0900 Message-Id: <20190711054434.1177-6-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190711054434.1177-1-yamada.masahiro@socionext.com> References: <20190711054434.1177-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Towards the goal of removing MODVERDIR, read out modules.order to get the list of modules to be installed. This is simpler than parsing *.mod files in $(MODVERDIR). For external modules, $(KBUILD_EXTMOD)/modules.order should be read. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/Makefile.modinst | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst index 0dae402661f3..5a4579e76485 100644 --- a/scripts/Makefile.modinst +++ b/scripts/Makefile.modinst @@ -8,10 +8,7 @@ __modinst: include scripts/Kbuild.include -# - -__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod))) -modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o))) +modules := $(sort $(shell cat $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order)) PHONY += $(modules) __modinst: $(modules) From patchwork Thu Jul 11 05:44:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11039299 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 304DF1805 for ; Thu, 11 Jul 2019 05:46:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2128228A49 for ; Thu, 11 Jul 2019 05:46:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1547C28A61; Thu, 11 Jul 2019 05:46:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5C2428A49 for ; Thu, 11 Jul 2019 05:46:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728224AbfGKFq0 (ORCPT ); Thu, 11 Jul 2019 01:46:26 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:59526 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728030AbfGKFpz (ORCPT ); Thu, 11 Jul 2019 01:45:55 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x6B5ip8Q031345; Thu, 11 Jul 2019 14:44:56 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x6B5ip8Q031345 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562823896; bh=1zEZHAW0UpTSAns9BBkOgZFy59b+y/4j41w96kvIZ+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G9HS4ZmBuLG3L98G76TzvdwLRWUjZU78qt+ES9tTxhlzPWOFwsgPsbVLHjglL8kvQ hbg5pY2s6o5wEuZN1Kl27fO0NqkDOVWyJ3aTokFSk+RI+pSpTX1DeuYNxVJ0Cy1Lvd fMZtfyaioNI0HgIsrPdwLj540EOcTokB7xK/KYZOPfsMwYiD4hNyB3bHmRVz54y0pp zFfi/0Y2H52/KbLxpJQn0EDOEg0ev1cLrHpYWd3ziHTnH7C68i/4Ws45P2HrLeYt2X eRRQ3Uiv1sG71oNfaEa67YbosbyH4DGDYrXg1DUaPD2ihc1aNcR+JAxcltcMrZzB4u ld3fC6bbVTaXA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Nicolas Pitre , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 06/11] kbuild: modsign: read modules.order instead of $(MODVERDIR)/*.mod Date: Thu, 11 Jul 2019 14:44:29 +0900 Message-Id: <20190711054434.1177-7-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190711054434.1177-1-yamada.masahiro@socionext.com> References: <20190711054434.1177-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Towards the goal of removing MODVERDIR, read out modules.order to get the list of modules to be signed. This is simpler than parsing *.mod files in $(MODVERDIR). The modules_sign target is only supported for in-kernel modules. So, this commit does not take care of external modules. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/Makefile.modsign | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/Makefile.modsign b/scripts/Makefile.modsign index da56aa78d245..d7325cefe709 100644 --- a/scripts/Makefile.modsign +++ b/scripts/Makefile.modsign @@ -8,8 +8,7 @@ __modsign: include scripts/Kbuild.include -__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod))) -modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o))) +modules := $(sort $(shell cat modules.order)) PHONY += $(modules) __modsign: $(modules) From patchwork Thu Jul 11 05:44:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11039303 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1FCAD13B1 for ; Thu, 11 Jul 2019 05:46:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E6F828A49 for ; Thu, 11 Jul 2019 05:46:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02FA228A4A; Thu, 11 Jul 2019 05:46:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A91728A61 for ; Thu, 11 Jul 2019 05:46:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728070AbfGKFpy (ORCPT ); Thu, 11 Jul 2019 01:45:54 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:59469 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727785AbfGKFpx (ORCPT ); Thu, 11 Jul 2019 01:45:53 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x6B5ip8R031345; Thu, 11 Jul 2019 14:44:57 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x6B5ip8R031345 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562823897; bh=3stWZci9Q+1wdEeQ+22mZim0UiOILKQPDAUatPWkXUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zzCfgYA12HxNWflkTTSLjdaoGUyyLL9M/njlyZm5txsFXwvgJ74ShigkKw5imyZss kj8ERkblQ7mqx44PHmO/10pfcCrbHP5C/I9wot+jrNFccigeDUKEnwI04V+fgBncmL RFD4T5FPwZVADdTjjOw5g4GNWzpH+f6O7a5KIby/9/DHMvVBZ1t5CXpuE1bcFvCDv1 B9COiiUpEIyfHCm4A1D3SVkjPGegRCEiJiDVrbEW8klESO24PwaNQyujT+yJyhVqVj b1pEjy1iPZmi52NbIXi0UIkMjHpL/b8CmEV9dE8qeFlVDFMl+/sWdQm/YPGlzlVjSR OwrXibzngaTQQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Nicolas Pitre , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 07/11] kbuild: modpost: read modules.order instead of $(MODVERDIR)/*.mod Date: Thu, 11 Jul 2019 14:44:30 +0900 Message-Id: <20190711054434.1177-8-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190711054434.1177-1-yamada.masahiro@socionext.com> References: <20190711054434.1177-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Towards the goal of removing MODVERDIR, read out modules.order to get the list of modules to be processed. This is simpler than parsing *.mod files in $(MODVERDIR). For external modules, $(KBUILD_EXTMOD)/modules.order should be read. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/Makefile.modpost | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index fec6ec2ffa47..2ab1694a7df3 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -8,9 +8,10 @@ # b) A .o file which is the .o files above linked together # c) A .mod file in $(MODVERDIR)/, listing the name of the # the preliminary .o file, plus all .o files +# d) modules.order, which lists all the modules # Stage 2 is handled by this file and does the following -# 1) Find all modules from the files listed in $(MODVERDIR)/ +# 1) Find all modules listed in modules.order # 2) modpost is then used to # 3) create one .mod.c file pr. module # 4) create one Module.symvers file with CRC for all exported symbols @@ -60,10 +61,10 @@ include scripts/Makefile.lib kernelsymfile := $(objtree)/Module.symvers modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers -# Step 1), find all modules listed in $(MODVERDIR)/ -MODLISTCMD := find $(MODVERDIR) -name '*.mod' | xargs -r grep -h '\.ko$$' | sort -u -__modules := $(shell $(MODLISTCMD)) -modules := $(patsubst %.o,%.ko, $(wildcard $(__modules:.ko=.o))) +modorder := $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order + +# Step 1), find all modules listed in modules.order +modules := $(sort $(shell cat $(modorder))) # Stop after building .o files if NOFINAL is set. Makes compile tests quicker _modpost: $(if $(KBUILD_MODPOST_NOFINAL), $(modules:.ko:.o),$(modules)) @@ -84,7 +85,7 @@ MODPOST_OPT=$(subst -i,-n,$(filter -i,$(MAKEFLAGS))) # We can go over command line length here, so be careful. quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules - cmd_modpost = $(MODLISTCMD) | sed 's/\.ko$$/.o/' | $(modpost) $(MODPOST_OPT) -s -T - + cmd_modpost = sed 's/ko$$/o/' $(modorder) | $(modpost) $(MODPOST_OPT) -s -T - PHONY += __modpost __modpost: $(modules:.ko=.o) FORCE From patchwork Thu Jul 11 05:44:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11039295 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7A131138B for ; Thu, 11 Jul 2019 05:46:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6811528A49 for ; Thu, 11 Jul 2019 05:46:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59FEF28A5C; Thu, 11 Jul 2019 05:46:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76C0528A49 for ; Thu, 11 Jul 2019 05:46:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728147AbfGKFqU (ORCPT ); Thu, 11 Jul 2019 01:46:20 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:59830 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728133AbfGKFqG (ORCPT ); Thu, 11 Jul 2019 01:46:06 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x6B5ip8S031345; Thu, 11 Jul 2019 14:44:57 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x6B5ip8S031345 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562823898; bh=zZHC7kuEat8Wjj58eLs5YktuTxK/MA2LOpg5kpa1Adk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FCqFYTZznK80VZReW6vN2qr2vh3/mBUofINF1wV7zGe9hPo9+3JT8cZLb7uJdIBqN bdCcg6nrdpM+bPPFn11wwp4luRgBlf2smhwbCKwkvvALb2abXQ+YDCobdrUTCUymSA TCbG77NJwu3Y2TxlKGcCz3Lznj8/TUGNOSiauftierRJzv06Om82QNcfPZdHCxz0pb ILpkkWdRarZhq7ZwepmX0ol2I15fne+iCU3VGLOZD2lthmBoMzrGOf82gZlK4FKJvc GN4i02P/rf4LP+7nMp40J5Aezj4L/uEJlokQS5lBnqXjr1e9txTx01eIGPKtygi1NB IMPzydkBNfk1w== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Nicolas Pitre , Masahiro Yamada , linux-doc@vger.kernel.org, Jonathan Corbet , linux-kernel@vger.kernel.org, Michal Marek Subject: [PATCH v2 08/11] kbuild: create *.mod with full directory path and remove MODVERDIR Date: Thu, 11 Jul 2019 14:44:31 +0900 Message-Id: <20190711054434.1177-9-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190711054434.1177-1-yamada.masahiro@socionext.com> References: <20190711054434.1177-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP While descending directories, Kbuild produces objects for modules, but do not link final *.ko files; it is done in the modpost. To keep track of modules, Kbuild creates a *.mod file in $(MODVERDIR) for every module it is building. Some post-processing steps read the necessary information from *.mod files. This avoids descending into directories again. This mechanism was introduced in 2003 or so. Later, commit 551559e13af1 ("kbuild: implement modules.order") added modules.order. So, we can simply read it out to know all the modules with directory paths. This is easier than parsing the first line of *.mod files. $(MODVERDIR) has a flat directory structure, that is, *.mod files are named only with base names. This is based on the assumption that the module name is unique across the tree. This assumption is really fragile. Stephen Rothwell reported a race condition caused by a module name conflict: https://lkml.org/lkml/2019/5/13/991 In parallel building, two different threads could write to the same $(MODVERDIR)/*.mod simultaneously. Non-unique module names are the source of all kind of troubles, hence commit 3a48a91901c5 ("kbuild: check uniqueness of module names") introduced a new checker script. However, it is still fragile in the build system point of view because this race happens before scripts/modules-check.sh is invoked. If it happens again, the modpost will emit unclear error messages. To fix this issue completely, create *.mod in the same directory as *.ko so that two threads never attempt to write to the same file. $(MODVERDIR) is no longer needed. Since modules with directory paths are listed in modules.order, Kbuild is still able to find *.mod files without additional descending. Signed-off-by: Masahiro Yamada Acked-by: Nicolas Pitre --- Changes in v2: - Remove -r of xargs, which is a GNU extension - Add '--' for extra safety .gitignore | 1 + Documentation/dontdiff | 1 + Makefile | 20 +++----------------- scripts/Makefile.build | 8 ++------ scripts/Makefile.modpost | 4 ++-- scripts/adjust_autoksyms.sh | 11 ++++------- scripts/mod/sumversion.c | 16 +++------------- scripts/package/mkspec | 2 +- 8 files changed, 17 insertions(+), 46 deletions(-) diff --git a/.gitignore b/.gitignore index 7587ef56b92d..8f5422cba6e2 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ *.lz4 *.lzma *.lzo +*.mod *.mod.c *.o *.o.* diff --git a/Documentation/dontdiff b/Documentation/dontdiff index 5eba889ea84d..9f4392876099 100644 --- a/Documentation/dontdiff +++ b/Documentation/dontdiff @@ -30,6 +30,7 @@ *.lzo *.mo *.moc +*.mod *.mod.c *.o *.o.* diff --git a/Makefile b/Makefile index b5e21d676ee2..4243b6daffcf 100644 --- a/Makefile +++ b/Makefile @@ -488,11 +488,6 @@ export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL export KBUILD_ARFLAGS -# When compiling out-of-tree modules, put MODVERDIR in the module -# tree rather than in the kernel tree. The kernel tree might -# even be read-only. -export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions - # Files to ignore in find ... statements export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \ @@ -1033,7 +1028,7 @@ vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) # Recurse until adjust_autoksyms.sh is satisfied PHONY += autoksyms_recursive -autoksyms_recursive: $(vmlinux-deps) +autoksyms_recursive: $(vmlinux-deps) modules.order ifdef CONFIG_TRIM_UNUSED_KSYMS $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \ "$(MAKE) -f $(srctree)/Makefile vmlinux" @@ -1117,7 +1112,6 @@ endif prepare1: prepare3 outputmakefile asm-generic $(version_h) $(autoksyms_h) \ include/generated/utsrelease.h - $(cmd_crmodverdir) archprepare: archheaders archscripts prepare1 scripts @@ -1375,7 +1369,7 @@ endif # CONFIG_MODULES # make distclean Remove editor backup files, patch leftover files and the like # Directories & files removed with 'make clean' -CLEAN_DIRS += $(MODVERDIR) include/ksym +CLEAN_DIRS += include/ksym CLEAN_FILES += modules.builtin.modinfo # Directories & files removed with 'make mrproper' @@ -1636,7 +1630,6 @@ PHONY += $(clean-dirs) clean $(clean-dirs): $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) -clean: rm-dirs := $(MODVERDIR) clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers PHONY += help @@ -1650,8 +1643,6 @@ help: @echo '' PHONY += prepare -prepare: - $(cmd_crmodverdir) endif # KBUILD_EXTMOD clean: $(clean-dirs) @@ -1662,7 +1653,7 @@ clean: $(clean-dirs) -o -name '*.ko.*' \ -o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \ -o -name '*.dwo' -o -name '*.lst' \ - -o -name '*.su' \ + -o -name '*.su' -o -name '*.mod' \ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ -o -name '*.lex.c' -o -name '*.tab.[ch]' \ -o -name '*.asn1.[ch]' \ @@ -1791,11 +1782,6 @@ quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \ $(KERNELRELEASE) -# Create temporary dir for module support files -# clean it up only when building all modules -cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \ - $(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*) - # read saved command lines for existing targets existing-targets := $(wildcard $(sort $(targets))) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 98dede0b2ca8..9fb30633acd2 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -67,8 +67,6 @@ ifeq ($(CONFIG_MODULES)$(need-modorder),y1) modorder-target := $(obj)/modules.order endif -# We keep a list of all modules in $(MODVERDIR) - __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target)) \ $(subdir-ym) $(always) @@ -278,13 +276,11 @@ $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE $(call cmd,force_checksrc) $(call if_changed_rule,cc_o_c) -# Single-part modules are special since we need to mark them in $(MODVERDIR) - $(single-used-m): $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE $(call cmd,force_checksrc) $(call if_changed_rule,cc_o_c) @{ echo $(@:.o=.ko); echo $@; \ - $(cmd_undef_syms); } > $(MODVERDIR)/$(@F:.o=.mod) + $(cmd_undef_syms); } > $(patsubst %.o,%.mod,$@) quiet_cmd_cc_lst_c = MKLST $@ cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \ @@ -466,7 +462,7 @@ cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) $(cmd_secanalysis $(multi-used-m): FORCE $(call if_changed,link_multi-m) @{ echo $(@:.o=.ko); echo $(filter %.o,$^); \ - $(cmd_undef_syms); } > $(MODVERDIR)/$(@F:.o=.mod) + $(cmd_undef_syms); } > $(patsubst %.o,%.mod,$@) $(call multi_depend, $(multi-used-m), .o, -objs -y -m) targets += $(multi-used-m) diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 2ab1694a7df3..3e229d4f4d72 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -6,8 +6,8 @@ # Stage one of module building created the following: # a) The individual .o files used for the module # b) A .o file which is the .o files above linked together -# c) A .mod file in $(MODVERDIR)/, listing the name of the -# the preliminary .o file, plus all .o files +# c) A .mod file, listing the name of the preliminary .o file, +# plus all .o files # d) modules.order, which lists all the modules # Stage 2 is handled by this file and does the following diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh index aab4e299d7a2..8b44bb80a451 100755 --- a/scripts/adjust_autoksyms.sh +++ b/scripts/adjust_autoksyms.sh @@ -47,13 +47,10 @@ cat > "$new_ksyms_file" << EOT */ EOT -[ "$(ls -A "$MODVERDIR")" ] && -for mod in "$MODVERDIR"/*.mod; do - sed -n -e '3{s/ /\n/g;/^$/!p;}' "$mod" -done | sort -u | -while read sym; do - echo "#define __KSYM_${sym} 1" -done >> "$new_ksyms_file" +sed 's/ko$/mod/' modules.order | +xargs -n1 sed -n -e '3{s/ /\n/g;/^$/!p;}' -- | +sort -u | +sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$new_ksyms_file" # Special case for modversions (see modpost.c) if [ -n "$CONFIG_MODVERSIONS" ]; then diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index 0f6dcb4011a8..166f3fa247a9 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c @@ -396,21 +396,11 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen) unsigned long len; struct md4_ctx md; char *sources, *end, *fname; - const char *basename; char filelist[PATH_MAX + 1]; - char *modverdir = getenv("MODVERDIR"); - if (!modverdir) - modverdir = "."; - - /* Source files for module are in .tmp_versions/modname.mod, - after the first line. */ - if (strrchr(modname, '/')) - basename = strrchr(modname, '/') + 1; - else - basename = modname; - snprintf(filelist, sizeof(filelist), "%s/%.*s.mod", modverdir, - (int) strlen(basename) - 2, basename); + /* objects for a module are listed in the second line of *.mod file. */ + snprintf(filelist, sizeof(filelist), "%.*smod", + (int)strlen(modname) - 1, modname); file = grab_file(filelist, &len); if (!file) diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 2d29df4a0a53..8640c278f1aa 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -29,7 +29,7 @@ fi PROVIDES="$PROVIDES kernel-$KERNELRELEASE" __KERNELRELEASE=$(echo $KERNELRELEASE | sed -e "s/-/_/g") -EXCLUDES="$RCS_TAR_IGNORE --exclude=.tmp_versions --exclude=*vmlinux* \ +EXCLUDES="$RCS_TAR_IGNORE --exclude=*vmlinux* --exclude=*.mod \ --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \ --exclude=.config.old --exclude=.missing-syscalls.d --exclude=*.s" From patchwork Thu Jul 11 05:44:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11039305 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 66A7B14C0 for ; Thu, 11 Jul 2019 05:46:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5672428A49 for ; Thu, 11 Jul 2019 05:46:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B09C28A5C; Thu, 11 Jul 2019 05:46:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D624928A4A for ; Thu, 11 Jul 2019 05:46:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728060AbfGKFpy (ORCPT ); Thu, 11 Jul 2019 01:45:54 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:59467 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726088AbfGKFpx (ORCPT ); Thu, 11 Jul 2019 01:45:53 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x6B5ip8T031345; Thu, 11 Jul 2019 14:44:58 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x6B5ip8T031345 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562823898; bh=iZRH/pqcP+K+A+neVC6JVPL+Vc4UBQc7CTbEdrMj1B8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mlVGsQwYQrxJg90PTLm52mBuqGweoB+CPzQbf6QvCV0ZUtIl7a1bvZOTnzt0sQLcp f8fDC1/p3uD+3JlI93ZJO4w0J6r9cr3seTLJtkxha//rjK2bEAfwKlwerAkkO63T0J yEX+3+VMFdAeVAPazEHvof9Oa419QX6AZLYWwLS2qohjske8vaxATuhSGVvR+aSTWr RCTQrAeTGVh5/3UWqR4h8DOH0Ji/UQHwLVeifXEZ4ZmcMC1LN99D9LwbivpQ+sH7Cc +hOpKqz7+QXkHs/O8vXHyRllYVdjVORSLCkP6DNygPTN9tSeRXDkudZUd1WUOqOqet anh8tFjYBKNzw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Nicolas Pitre , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 09/11] kbuild: remove the first line of *.mod files Date: Thu, 11 Jul 2019 14:44:32 +0900 Message-Id: <20190711054434.1177-10-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190711054434.1177-1-yamada.masahiro@socionext.com> References: <20190711054434.1177-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The current format of *.mod is like this: line 1: directory path to the .ko file line 2: a list of objects linked into this module line 3: unresolved symbols (only when CONFIG_TRIM_UNUSED_KSYMS=y) Now that *.mod and *.ko are created in the same directory, the line 1 provides no valuable information. It can be derived by replacing the extension .mod with .ko. Cut the first line. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/Makefile.build | 4 ++-- scripts/adjust_autoksyms.sh | 2 +- scripts/mod/sumversion.c | 9 ++------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 9fb30633acd2..2709646b1a5d 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -279,7 +279,7 @@ $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE $(single-used-m): $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE $(call cmd,force_checksrc) $(call if_changed_rule,cc_o_c) - @{ echo $(@:.o=.ko); echo $@; \ + @{ echo $@; \ $(cmd_undef_syms); } > $(patsubst %.o,%.mod,$@) quiet_cmd_cc_lst_c = MKLST $@ @@ -461,7 +461,7 @@ cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) $(cmd_secanalysis $(multi-used-m): FORCE $(call if_changed,link_multi-m) - @{ echo $(@:.o=.ko); echo $(filter %.o,$^); \ + @{ echo $(filter %.o,$^); \ $(cmd_undef_syms); } > $(patsubst %.o,%.mod,$@) $(call multi_depend, $(multi-used-m), .o, -objs -y -m) diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh index 8b44bb80a451..89871cae3954 100755 --- a/scripts/adjust_autoksyms.sh +++ b/scripts/adjust_autoksyms.sh @@ -48,7 +48,7 @@ cat > "$new_ksyms_file" << EOT EOT sed 's/ko$/mod/' modules.order | -xargs -n1 sed -n -e '3{s/ /\n/g;/^$/!p;}' -- | +xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- | sort -u | sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$new_ksyms_file" diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index 166f3fa247a9..63062024ce0e 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c @@ -398,7 +398,7 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen) char *sources, *end, *fname; char filelist[PATH_MAX + 1]; - /* objects for a module are listed in the second line of *.mod file. */ + /* objects for a module are listed in the first line of *.mod file. */ snprintf(filelist, sizeof(filelist), "%.*smod", (int)strlen(modname) - 1, modname); @@ -407,13 +407,8 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen) /* not a module or .mod file missing - ignore */ return; - sources = strchr(file, '\n'); - if (!sources) { - warn("malformed versions file for %s\n", modname); - goto release; - } + sources = file; - sources++; end = strchr(sources, '\n'); if (!end) { warn("bad ending versions file for %s\n", modname); From patchwork Thu Jul 11 05:44:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11039307 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EC6A11805 for ; Thu, 11 Jul 2019 05:46:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCBCB28A49 for ; Thu, 11 Jul 2019 05:46:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D120628A5C; Thu, 11 Jul 2019 05:46:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 844C728A49 for ; Thu, 11 Jul 2019 05:46:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728055AbfGKFpy (ORCPT ); Thu, 11 Jul 2019 01:45:54 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:59468 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727956AbfGKFpx (ORCPT ); Thu, 11 Jul 2019 01:45:53 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x6B5ip8U031345; Thu, 11 Jul 2019 14:44:59 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x6B5ip8U031345 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562823899; bh=Ns+sXHJZbzo/hYCT2LP+L4TcrC5zi8mC7e+kBaXavh4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dl2hS4bC47jOuAJKxFYhxgx3/mkDJGp+FB6ejQdwkgRoovkUEhE77ghFexiCV2vT5 vBqiBj5ksQJ3d5oP8rj84I3y6UD90fpM+LXgCjiaHzzQ/cVpbULJdtRZ0rS4u9alla Ss/kfRge6YJqs/ZHn2xR+FCDGxcotVTP4Ctu8lHLKgEG8XIZmZEr/hvg+pP078mSiY Ecbpm6nCsIxKRRxzvQ1ZwBMoelhFBzyXAR+fxKxECBAl1roq8sYso2vcJoE3Khngvh CMgCTAMLzMmw8VXUcPgApuV/V7kUFCU6/L/zQHFPpIEZB495HVHumyXjkRTbgYRgyh O6NDviHp/qF6g== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Nicolas Pitre , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 10/11] kbuild: remove 'prepare1' target Date: Thu, 11 Jul 2019 14:44:33 +0900 Message-Id: <20190711054434.1177-11-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190711054434.1177-1-yamada.masahiro@socionext.com> References: <20190711054434.1177-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that there is no rule for 'prepare1', it can go away. Signed-off-by: Masahiro Yamada --- Changes in v2: None Makefile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 4243b6daffcf..8de893e41149 100644 --- a/Makefile +++ b/Makefile @@ -1093,7 +1093,7 @@ scripts: scripts_basic scripts_dtc # archprepare is used in arch Makefiles and when processed asm symlink, # version.h and scripts_basic is processed / created. -PHONY += prepare archprepare prepare1 prepare3 +PHONY += prepare archprepare prepare3 # prepare3 is used to check if we are building in a separate output directory, # and if so do: @@ -1110,10 +1110,8 @@ ifneq ($(srctree),.) fi; endif -prepare1: prepare3 outputmakefile asm-generic $(version_h) $(autoksyms_h) \ - include/generated/utsrelease.h - -archprepare: archheaders archscripts prepare1 scripts +archprepare: archheaders archscripts scripts prepare3 outputmakefile \ + asm-generic $(version_h) $(autoksyms_h) include/generated/utsrelease.h prepare0: archprepare $(Q)$(MAKE) $(build)=scripts/mod From patchwork Thu Jul 11 05:44:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11039287 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 20991138B for ; Thu, 11 Jul 2019 05:45:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F70728958 for ; Thu, 11 Jul 2019 05:45:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03AF128A46; Thu, 11 Jul 2019 05:45:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D44C28958 for ; Thu, 11 Jul 2019 05:45:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727967AbfGKFpx (ORCPT ); Thu, 11 Jul 2019 01:45:53 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:59472 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727960AbfGKFpx (ORCPT ); Thu, 11 Jul 2019 01:45:53 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x6B5ip8V031345; Thu, 11 Jul 2019 14:44:59 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x6B5ip8V031345 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562823900; bh=iRp9Du8hIMlIwOLhJe7rDNMn7P7N/4zadqD4+iwRwl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kHHROSX5oyo66/pfhCsF+TrfXLXku+LACPJkW0iet8erC7xG/EvN4XWYSx5tsRd/W lsFYztWkgGnh31I5CogAYVE1AD20ywUkiqdw7T2a/L9KKpjZ4e74xRXA4Peqey4nJ6 gowGCHXn/8v2uBm8G8bJdnfXKUn+mxBVNKfl4K7VKH6BOatc6BPFpwQWENIIJzddyh ge9KxtwnrpMCyjXJRLm6OcUmdxeD2bEk99+ybLty2fZrElUbLtSesyNB+eHNlsaTnc utDi+WeMxMGD4ZFlOGRLEAsSuC7BAGg7lUtPXje6fX8D/iDN7fK2xvGm5nMS3+DGR6 sQfWX0otXw6Jw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Nicolas Pitre , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 11/11] kbuild: split out *.mod out of {single,multi}-used-m rules Date: Thu, 11 Jul 2019 14:44:34 +0900 Message-Id: <20190711054434.1177-12-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190711054434.1177-1-yamada.masahiro@socionext.com> References: <20190711054434.1177-1-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, *.mod is created as a side-effect of obj-m. Split out *.mod as a dedicated build rule, which allows to unify the %.c -> %.o rule, and remove the single-used-m rule. This also makes the incremental build of allmodconfig faster because it saves $(NM) invocation when there is no change in the module. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/Makefile.build | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 2709646b1a5d..63fc266b4985 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -67,8 +67,10 @@ ifeq ($(CONFIG_MODULES)$(need-modorder),y1) modorder-target := $(obj)/modules.order endif +mod-targets := $(patsubst %.o, %.mod, $(obj-m)) + __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ - $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target)) \ + $(if $(KBUILD_MODULES),$(obj-m) $(mod-targets) $(modorder-target)) \ $(subdir-ym) $(always) @: @@ -266,7 +268,7 @@ endef # List module undefined symbols (or empty line if not enabled) ifdef CONFIG_TRIM_UNUSED_KSYMS -cmd_undef_syms = $(NM) $@ | sed -n 's/^ *U //p' | xargs echo +cmd_undef_syms = $(NM) $< | sed -n 's/^ *U //p' | xargs echo else cmd_undef_syms = echo endif @@ -276,11 +278,15 @@ $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE $(call cmd,force_checksrc) $(call if_changed_rule,cc_o_c) -$(single-used-m): $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE - $(call cmd,force_checksrc) - $(call if_changed_rule,cc_o_c) - @{ echo $@; \ - $(cmd_undef_syms); } > $(patsubst %.o,%.mod,$@) +cmd_mod = { \ + echo $(if $($*-objs)$($*-y)$($*-m), $(addprefix $(obj)/, $($*-objs) $($*-y) $($*-m)), $(@:.mod=.o)); \ + $(cmd_undef_syms); \ + } > $@ + +$(obj)/%.mod: $(obj)/%.o FORCE + $(call if_changed,mod) + +targets += $(mod-targets) quiet_cmd_cc_lst_c = MKLST $@ cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \ @@ -461,8 +467,6 @@ cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) $(cmd_secanalysis $(multi-used-m): FORCE $(call if_changed,link_multi-m) - @{ echo $(filter %.o,$^); \ - $(cmd_undef_syms); } > $(patsubst %.o,%.mod,$@) $(call multi_depend, $(multi-used-m), .o, -objs -y -m) targets += $(multi-used-m)