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=unavailable 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 2F868C433DF for ; Thu, 18 Jun 2020 01:17:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 03E64206F1 for ; Thu, 18 Jun 2020 01:17:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592443069; bh=D93pV5GFvpRHLErS7J7MDSQ80njR/gHakMfqSDGt6Ac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gsEvTlhkIZSXNOiC9oKov6/GKcKbsdY0TIIRjYR7cHN46ElFuepFuq+94MPabBPtw DeyEcGBQuqGDnh1x/Pw5bo82d/96Ie/wauJpDwpj1CTqa714tYeoGbQs/gILQTiqIV upM+7oj+ETza8sbdSjAE6J6OFxfOTkhIbJCmgLvo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728991AbgFRBRq (ORCPT ); Wed, 17 Jun 2020 21:17:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:44978 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728689AbgFRBPC (ORCPT ); Wed, 17 Jun 2020 21:15:02 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 274AB21D7E; Thu, 18 Jun 2020 01:15:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592442901; bh=D93pV5GFvpRHLErS7J7MDSQ80njR/gHakMfqSDGt6Ac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zH+2hO0PHbcoILZQeyi2eH7UfHWKaNneGyRLnPBnoE8BHijGyxgSJT7KaB4pWrnXq GkFI9c2C9qeyZZ3Oj9hi9HBkcxhN8RIU8BZGaZwfLXfz0WjR+p6Lis3wkqDVTyKlsx 0phP0wBUD/4mJBk7lXKgPhqQ5t74Qa7URtFYYqZ4= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Masahiro Yamada , Guenter Roeck , Sasha Levin , linux-kbuild@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 322/388] modpost: fix -i (--ignore-errors) MAKEFLAGS detection Date: Wed, 17 Jun 2020 21:06:59 -0400 Message-Id: <20200618010805.600873-322-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200618010805.600873-1-sashal@kernel.org> References: <20200618010805.600873-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masahiro Yamada [ Upstream commit 91e6ee581270b8ae970f028b898314d73f16870b ] $(filter -i,$(MAKEFLAGS)) works only in limited use-cases. The representation of $(MAKEFLAGS) depends on various factors: - GNU Make version (version 3.8x or version 4.x) - The presence of other flags like -j In my experiments, $(MAKEFLAGS) is expanded as follows: * GNU Make 3.8x: * without -j option: --no-print-directory -Rri * with -j option: --no-print-directory -Rr --jobserver-fds=3,4 -j -i * GNU Make 4.x: * without -j option: irR --no-print-directory * with -j option: irR -j --jobserver-fds=3,4 --no-print-directory For GNU Make 4.x, the flags are grouped as 'irR', which does not work. For the single thread build with GNU Make 3.8x, the flags are grouped as '-Rri', which does not work either. To make it work for all cases, do likewise as commit 6f0fa58e4596 ("kbuild: simplify silent build (-s) detection"). BTW, since commit ff9b45c55b26 ("kbuild: modpost: read modules.order instead of $(MODVERDIR)/*.mod"), you also need to pass -k option to build final *.ko files. 'make -i -k' ignores compile errors in modules, and build as many remaining *.ko as possible. Please note this feature is kind of dangerous if other modules depend on the broken module because the generated modules will lack the correct module dependency or CRC. Honestly, I am not a big fan of it, but I am keeping this feature. Fixes: eed380f3f593 ("modpost: Optionally ignore secondary errors seen if a single module build fails") Cc: Guenter Roeck Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin --- scripts/Makefile.modpost | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 957eed6a17a5..33aaa572f686 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -66,7 +66,7 @@ __modpost: else -MODPOST += $(subst -i,-n,$(filter -i,$(MAKEFLAGS))) -s -T - \ +MODPOST += -s -T - \ $(if $(KBUILD_NSDEPS),-d $(MODULES_NSDEPS)) ifeq ($(KBUILD_EXTMOD),) @@ -82,6 +82,11 @@ include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \ $(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile) endif +# 'make -i -k' ignores compile errors, and builds as many modules as possible. +ifneq ($(findstring i,$(filter-out --%,$(MAKEFLAGS))),) +MODPOST += -n +endif + # find all modules listed in modules.order modules := $(sort $(shell cat $(MODORDER))) -- 2.25.1