Message ID | 20221227214821.16495-1-samuel@sholland.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1597942wrt; Tue, 27 Dec 2022 13:55:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXtgkj7Q7KANxnCG/DywTxb52u5berVqKetEPoNuSG0NjtYM46nnGfV/wxhTOsCca/llsVBd X-Received: by 2002:a05:6a20:1446:b0:af:7989:2579 with SMTP id a6-20020a056a20144600b000af79892579mr57816015pzi.32.1672178117458; Tue, 27 Dec 2022 13:55:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672178117; cv=none; d=google.com; s=arc-20160816; b=vnjbl3S7Yd75PUQXFNGmtKntECmR0g6jDpSoru6abF7ihtgDZMEQhFnevNZdiL1lNY wYy8luPYdlTdm9KIxyUm3EMIkBwqEQvCe0bSHBDPNhnyc1Sl0pGt2/FB/pHwKlrkIl7q xc7NU4Aix3WkYmslfyMrhE8TnFqx2CHY7Jtds372Bt14BCLXmknvTtDcJxU3YqrPbLQR Xm4W1eRuGe8lQNNMIRvx1l3gWtWeekOvw6dU4wQKNns+rjMdTrlZ2m8vNSByyduVgS17 OwUUbF2KybTHCK3fUgs9aDKRMuf8as4eRyWDO49KxhAYF6ienAc66FHK2kFyV1udW3ex QPXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:feedback-id:dkim-signature :dkim-signature; bh=C0mduqepIxRredmqLCGAPlCT9t1Daw7dkB3PcPVQQ3E=; b=XbDp4rfkX3QwUeb2Vyps+a6AITdBwAT9KJRPuc/TlkBn+CWhAVzfmboSxi6siVF1UR JXm5vxFNIpzaGAMlvBjcFjranHS4oaeeeIfoV8re5ThwmisX88orzyqpSD2RWb+udu+/ 9t9/9tRAy2735KUERNrLE1SFzfeSIg4vtvbIsEhU3U9QFKB7kn4wVPqLxy+6m/Xe245f ovhaagzmouGGMSRDEr1LRV6nCGBRhNHONvJ+wgVRT2GaHy8PzMRuqm9dPBWzW57ckFMO LL2sgbnYP+aHqFsQ4X9wH0T5PwohrOLb9Tt7LG71SPAkeAx1YtyjHH/ixxfl8wVaF5mq I6UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=nY0dxDhs; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="WurPVl/t"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 187-20020a6300c4000000b00476c6b9cf69si14883157pga.856.2022.12.27.13.55.05; Tue, 27 Dec 2022 13:55:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=nY0dxDhs; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="WurPVl/t"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sholland.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229915AbiL0Vsn (ORCPT <rfc822;eddaouddi.ayoub@gmail.com> + 99 others); Tue, 27 Dec 2022 16:48:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbiL0Vs2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 27 Dec 2022 16:48:28 -0500 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 951E5B23; Tue, 27 Dec 2022 13:48:27 -0800 (PST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 0046B320092C; Tue, 27 Dec 2022 16:48:23 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 27 Dec 2022 16:48:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to; s=fm3; t=1672177703; x=1672264103; bh=C0mduqepIxRredmqLCGAPlCT9 t1Daw7dkB3PcPVQQ3E=; b=nY0dxDhsd+tCGN802X+bhYqSPy8PYau9FRg3vhaCY VvlLL9Y9Pl55nCRZPB2bRhJXzyJQu0c4A3ztUNZn/MOuBlvvFO4eHFyiTWk5eAvb /VNW9WPjpGL/AvyYsGUC1pWUXlFRdzxA9YZyqU5/v1mUtaOw/lTpEAJjO50YYdIz ny2vEjKAPgLt61JKet83zl3CoHvN7oxYquuReIjGkZhQTBUR2eMvZDosRsMewlPL R9IX0aN+T0F9Oh+f5FVcHRLfJRHc12k4JD2r2SYYtDVq2Dlnxf//67Jko527z1HJ nQF3rNM/lqHHVoh5VuhFNb8A6l6tCIgrh610v4h7FjxAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1672177703; x=1672264103; bh=C0mduqepIxRredmqLCGAPlCT9t1Daw7dkB3 PcPVQQ3E=; b=WurPVl/tTUBytSRQe8TuOosBIVTX78y/9kLmo0nTKx++EweK9bi bPf3xfzlDOl+Xxk4t0npclfNhzybYc/mN78UOfUsaBH7aeIduZ1km9PYZaA2ox5C 9thueB6zjOrGdX6IV1VfekgbGHwr/UuhMN/kFGR4mcz2xztZGkJiLuKhLd7U1te8 Ef8ZzRadLKUw1YOICJBOC2Cxsup56UJE6OdXERKe2l8jl+58F1brw8tSsbxvBMrY GrteUJO23aYlDhtS/GHXgyG5N4f+0bcUqOKZSj94P9be045o9PLojCn9q6gJk7iP F482qxgggzs5aOdPR0pJ9USIPkTpUFfhqtw== X-ME-Sender: <xms:J2irY6cCTMzqB_B61qxc5Cgg-LKdNZYvXgCgdSWu22W0R6KzXgyslg> <xme:J2irY0NHqdJPlSJ7I5mjzn17BygVdHvaz_n8B58UDOWwwXvfICaDKTPV9tJ7ghTBM QGuSVi-FN_FJiR7rg> X-ME-Received: <xmr:J2irY7jhPYty4dxYflo7b1uiZ7eQkv-jt562wv9gl3TwLWEZXylV6DLLBCKq0iicWeB00Tet1Xn_feCc7r26vI8DPr08IBQpwWo3dAr9s_62B_0wrAIlpzlZRxQQmCPPi8hrhg> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedriedtgdduheefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgggfestdekredtredttdenucfhrhhomhepufgrmhhuvghl ucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecuggftrf grthhtvghrnhepkeevlefhjeeuleeltedvjedvfeefteegleehueejffehgffffeekhefh hfekkeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: <xmx:J2irY3_Xp8w9enFDzND1cbEa50Qd8R5feYGcv6JIQFelTUgAscaOJQ> <xmx:J2irY2ufavZLS8n4xel48H7vnazktM8ZRbR7WWvFnurO5TbjFflvFg> <xmx:J2irY-GeKvhlF8JpfCPKwGyycrjRAS4K66EEvj_BoD3--vAoD-etFA> <xmx:J2irY4XglnCQrG5Z4O3b48dJ1HvrXUELHT9fd7Jz9XEgchJO1vgDUg> Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 27 Dec 2022 16:48:22 -0500 (EST) From: Samuel Holland <samuel@sholland.org> To: Masahiro Yamada <masahiroy@kernel.org>, linux-kbuild@vger.kernel.org Cc: Samuel Holland <samuel@sholland.org>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Nicolas Schier <nicolas@fjasle.eu>, linux-kernel@vger.kernel.org Subject: [PATCH] kbuild: Fix running modpost with musl libc Date: Tue, 27 Dec 2022 15:48:21 -0600 Message-Id: <20221227214821.16495-1-samuel@sholland.org> X-Mailer: git-send-email 2.37.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753405841654673192?= X-GMAIL-MSGID: =?utf-8?q?1753405841654673192?= |
Series |
kbuild: Fix running modpost with musl libc
|
|
Commit Message
Samuel Holland
Dec. 27, 2022, 9:48 p.m. UTC
commit 3d57e1b7b1d4 ("kbuild: refactor the prerequisites of the modpost
rule") moved 'vmlinux.o' inside modpost-args, possibly before some of
the other options. However, getopt() in musl libc follows POSIX and
stops looking for options upon reaching the first non-option argument.
As a result, the '-T' option is misinterpreted as a positional argument,
and the build fails:
make -f ./scripts/Makefile.modpost
scripts/mod/modpost -E -o Module.symvers vmlinux.o -T modules.order
-T: No such file or directory
make[1]: *** [scripts/Makefile.modpost:137: Module.symvers] Error 1
make: *** [Makefile:1960: modpost] Error 2
The fix is to move all options before 'vmlinux.o' in modpost-args.
Fixes: 3d57e1b7b1d4 ("kbuild: refactor the prerequisites of the modpost rule")
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
scripts/Makefile.modpost | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
Comments
On Tue, Dec 27, 2022 at 03:48:21PM -0600, Samuel Holland wrote: > commit 3d57e1b7b1d4 ("kbuild: refactor the prerequisites of the modpost > rule") moved 'vmlinux.o' inside modpost-args, possibly before some of > the other options. However, getopt() in musl libc follows POSIX and > stops looking for options upon reaching the first non-option argument. > As a result, the '-T' option is misinterpreted as a positional argument, > and the build fails: > > make -f ./scripts/Makefile.modpost > scripts/mod/modpost -E -o Module.symvers vmlinux.o -T modules.order > -T: No such file or directory > make[1]: *** [scripts/Makefile.modpost:137: Module.symvers] Error 1 > make: *** [Makefile:1960: modpost] Error 2 > > The fix is to move all options before 'vmlinux.o' in modpost-args. > > Fixes: 3d57e1b7b1d4 ("kbuild: refactor the prerequisites of the modpost rule") > Signed-off-by: Samuel Holland <samuel@sholland.org> Seems reasonable to me. Reviewed-by: Nathan Chancellor <nathan@kernel.org> > --- > > scripts/Makefile.modpost | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) > > diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost > index 5eb5e8280379..0ee296cf520c 100644 > --- a/scripts/Makefile.modpost > +++ b/scripts/Makefile.modpost > @@ -55,6 +55,17 @@ ifneq ($(findstring i,$(filter-out --%,$(MAKEFLAGS))),) > modpost-args += -n > endif > > +ifneq ($(KBUILD_MODPOST_WARN)$(missing-input),) > +modpost-args += -w > +endif > + > +# Read out modules.order to pass in modpost. > +# Otherwise, allmodconfig would fail with "Argument list too long". > +ifdef KBUILD_MODULES > +modpost-args += -T $(MODORDER) > +modpost-deps += $(MODORDER) > +endif > + > ifeq ($(KBUILD_EXTMOD),) > > # Generate the list of in-tree objects in vmlinux > @@ -113,17 +124,6 @@ modpost-args += -e $(addprefix -i , $(KBUILD_EXTRA_SYMBOLS)) > > endif # ($(KBUILD_EXTMOD),) > > -ifneq ($(KBUILD_MODPOST_WARN)$(missing-input),) > -modpost-args += -w > -endif > - > -ifdef KBUILD_MODULES > -modpost-args += -T $(MODORDER) > -modpost-deps += $(MODORDER) > -endif > - > -# Read out modules.order to pass in modpost. > -# Otherwise, allmodconfig would fail with "Argument list too long". > quiet_cmd_modpost = MODPOST $@ > cmd_modpost = \ > $(if $(missing-input), \ > -- > 2.37.4 >
On Wed, Dec 28, 2022 at 6:48 AM Samuel Holland <samuel@sholland.org> wrote: > > commit 3d57e1b7b1d4 ("kbuild: refactor the prerequisites of the modpost > rule") moved 'vmlinux.o' inside modpost-args, possibly before some of > the other options. However, getopt() in musl libc follows POSIX and > stops looking for options upon reaching the first non-option argument. > As a result, the '-T' option is misinterpreted as a positional argument, > and the build fails: > > make -f ./scripts/Makefile.modpost > scripts/mod/modpost -E -o Module.symvers vmlinux.o -T modules.order > -T: No such file or directory > make[1]: *** [scripts/Makefile.modpost:137: Module.symvers] Error 1 > make: *** [Makefile:1960: modpost] Error 2 > > The fix is to move all options before 'vmlinux.o' in modpost-args. > > Fixes: 3d57e1b7b1d4 ("kbuild: refactor the prerequisites of the modpost rule") > Signed-off-by: Samuel Holland <samuel@sholland.org> > --- > Applied to linux-kbuild/fixes. Thanks. > scripts/Makefile.modpost | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) > > diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost > index 5eb5e8280379..0ee296cf520c 100644 > --- a/scripts/Makefile.modpost > +++ b/scripts/Makefile.modpost > @@ -55,6 +55,17 @@ ifneq ($(findstring i,$(filter-out --%,$(MAKEFLAGS))),) > modpost-args += -n > endif > > +ifneq ($(KBUILD_MODPOST_WARN)$(missing-input),) > +modpost-args += -w > +endif > + > +# Read out modules.order to pass in modpost. > +# Otherwise, allmodconfig would fail with "Argument list too long". > +ifdef KBUILD_MODULES > +modpost-args += -T $(MODORDER) > +modpost-deps += $(MODORDER) > +endif > + > ifeq ($(KBUILD_EXTMOD),) > > # Generate the list of in-tree objects in vmlinux > @@ -113,17 +124,6 @@ modpost-args += -e $(addprefix -i , $(KBUILD_EXTRA_SYMBOLS)) > > endif # ($(KBUILD_EXTMOD),) > > -ifneq ($(KBUILD_MODPOST_WARN)$(missing-input),) > -modpost-args += -w > -endif > - > -ifdef KBUILD_MODULES > -modpost-args += -T $(MODORDER) > -modpost-deps += $(MODORDER) > -endif > - > -# Read out modules.order to pass in modpost. > -# Otherwise, allmodconfig would fail with "Argument list too long". > quiet_cmd_modpost = MODPOST $@ > cmd_modpost = \ > $(if $(missing-input), \ > -- > 2.37.4 >
This change seems to break expected symbol warnings when building an external module against a kernel prepared with modules_prepare. The build used to show WARNING: Module.symvers is missing. Modules may not have dependencies or modversions. You may get many unresolved symbol warnings. followed by those many unresolved symbol warnings. 6.2-rc2 still shows that warning but the unresolved symbol messages are now errors and the build fails (at scripts/Makefile.modpost:137). This seems to happen due to -T getting added.
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 5eb5e8280379..0ee296cf520c 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -55,6 +55,17 @@ ifneq ($(findstring i,$(filter-out --%,$(MAKEFLAGS))),) modpost-args += -n endif +ifneq ($(KBUILD_MODPOST_WARN)$(missing-input),) +modpost-args += -w +endif + +# Read out modules.order to pass in modpost. +# Otherwise, allmodconfig would fail with "Argument list too long". +ifdef KBUILD_MODULES +modpost-args += -T $(MODORDER) +modpost-deps += $(MODORDER) +endif + ifeq ($(KBUILD_EXTMOD),) # Generate the list of in-tree objects in vmlinux @@ -113,17 +124,6 @@ modpost-args += -e $(addprefix -i , $(KBUILD_EXTRA_SYMBOLS)) endif # ($(KBUILD_EXTMOD),) -ifneq ($(KBUILD_MODPOST_WARN)$(missing-input),) -modpost-args += -w -endif - -ifdef KBUILD_MODULES -modpost-args += -T $(MODORDER) -modpost-deps += $(MODORDER) -endif - -# Read out modules.order to pass in modpost. -# Otherwise, allmodconfig would fail with "Argument list too long". quiet_cmd_modpost = MODPOST $@ cmd_modpost = \ $(if $(missing-input), \