From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de ([217.72.192.73]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmi8e-000CHz-Pp for linux-um@lists.infradead.org; Thu, 05 May 2022 20:32:01 +0000 Date: Thu, 5 May 2022 22:31:28 +0200 From: Nicolas Schier Subject: Re: [PATCH v3 15/15] kbuild: make *.mod rule robust against too long argument error Message-ID: References: <20220505072244.1155033-1-masahiroy@kernel.org> <20220505072244.1155033-16-masahiroy@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220505072244.1155033-16-masahiroy@kernel.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-um" Errors-To: linux-um-bounces+geert=linux-m68k.org@lists.infradead.org To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, clang-built-linux@googlegroups.com, linux-kernel@vger.kernel.org, Ard Biesheuvel , Luis Chamberlain , Peter Zijlstra , linuxppc-dev@lists.ozlabs.org, linux-um@lists.infradead.org, linux-s390@vger.kernel.org, Nick Desaulniers , Sami Tolvanen , Kees Cook On Thu, May 05, 2022 at 04:22:44PM +0900 Masahiro Yamada wrote: > Like built-in.a, the command length of the *.mod rule scales with > the depth of the directory times the number of objects in the Makefile. > > Add $(obj)/ by the shell command (awk) instead of by Make's builtin > function. > > In-tree modules still have some room to the limit (ARG_MAX=2097152), > but this is more future-proof for big modules in a deep directory. > > For example, you can build i915 as a module (CONFIG_DRM_I915=m) and > compare drivers/gpu/drm/i915/.i915.mod.cmd with/without this commit. > > The issue is more critical for external modules because the M= path > can be very long as Jeff Johnson reported before [1]. > > [1] https://lore.kernel.org/linux-kbuild/4c02050c4e95e4cb8cc04282695f8404@codeaurora.org/ > > Signed-off-by: Masahiro Yamada > --- > > (no changes since v2) > > Changes in v2: > - New patch > > scripts/Makefile.build | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/scripts/Makefile.build b/scripts/Makefile.build > index cea48762299c..e7b3f329d443 100644 > --- a/scripts/Makefile.build > +++ b/scripts/Makefile.build > @@ -266,8 +266,8 @@ $(obj)/%.o: $(src)/%.c $(recordmcount_source) FORCE > $(call if_changed_rule,cc_o_c) > $(call cmd,force_checksrc) > > -cmd_mod = echo $(addprefix $(obj)/, $(call real-search, $*.o, .o, -objs -y -m)) | \ > - $(AWK) -v RS='( |\n)' '!x[$$0]++' > $@ > +cmd_mod = echo $(call real-search, $*.o, .o, -objs -y -m) | \ > + $(AWK) -v RS='( |\n)' '!x[$$0]++ { print("$(obj)/"$$0) }' > $@ > > $(obj)/%.mod: FORCE > $(call if_changed,mod) > -- > 2.32.0 Thanks! At work, some colleagues of mine stumbled over that problem, too. Reviewed-by: Nicolas Schier _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um