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 EE7DDC47255 for ; Mon, 11 May 2020 04:23:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C8BA8207FF for ; Mon, 11 May 2020 04:23:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589170996; bh=KlBhoyn/MnBO9/WZNMuYVKpy6pF5Ofw0HZk43nWR0t0=; h=From:To:Cc:Subject:Date:List-ID:From; b=D3naRX1l5egZSZgVU0E82XWPdV1Bj/FwJy3dGcXtVC/szUJJHcK8vn1+NYFqhkMCM +ATifwaK6tyh51778Kf9r+kCLZSRur9NEO8umlis6Q+Bao4+S9E9k4ROdjJxiJHUvF gDag3++rYX/0CzdQg6pkeH7uZ0vCV84iO8mZCa8Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726071AbgEKEXQ (ORCPT ); Mon, 11 May 2020 00:23:16 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:29748 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725790AbgEKEXP (ORCPT ); Mon, 11 May 2020 00:23:15 -0400 Received: from oscar.flets-west.jp (softbank126090202047.bbtec.net [126.90.202.47]) (authenticated) by conuserg-08.nifty.com with ESMTP id 04B4LsSl009856; Mon, 11 May 2020 13:21:54 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com 04B4LsSl009856 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1589170915; bh=bEd3hBdLhKUwiRkpNdiCa9W/1TH8Wtl6cdq8NlrF14Q=; h=From:To:Cc:Subject:Date:From; b=befzyPqsVsx2syuhFxp9p3bHbYTwnF9na1iJjkcFtrZuEsAUiCR57FjAh2LZgozLt QYSv3U1HPIqe523P/m7N96jfhZY+htjvMmQz9gyGuqtNJOEM1uZw4LXN7yfrt99sqM 54xQ5cy4vDKxFWuwxjkv4dwsUEBsom3FPn2eOQ+IRunljIYd4cye/W/qXOh5tHDQPg AWOmbnh69qkGpCKA54DyuoioAD4uc8S8KillSpfPNB5Z4I6EgSmbkOGp2NAB1M3tQr HY5lVGMR3BV1vNsk2DPlZttslCSi89jcjeFHSzmo9MrE3FGUp+CzCvX1li/2OgvE+P /OXaJCnUw8w5g== X-Nifty-SrcIP: [126.90.202.47] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Arnd Bergmann , Greg Kroah-Hartman , Lucas De Marchi , Michal Marek , Stephen Rothwell , linux-kernel@vger.kernel.org Subject: [PATCH] kbuild: make module name conflict fatal error Date: Mon, 11 May 2020 13:21:49 +0900 Message-Id: <20200511042149.1712876-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.25.1 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 I think all the warnings have been fixed by now. Make it a fatal error. Check it before modpost because we need to stop building *.ko files. Also, pass modules.order via a script parameter. Signed-off-by: Masahiro Yamada --- Makefile | 7 +++++-- scripts/modules-check.sh | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 1162cb04860c..a2e4d0945500 100644 --- a/Makefile +++ b/Makefile @@ -1328,9 +1328,12 @@ all: modules # using awk while concatenating to the final file. PHONY += modules -modules: $(if $(KBUILD_BUILTIN),vmlinux) modules.order +modules: $(if $(KBUILD_BUILTIN),vmlinux) modules_check $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost - $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh + +PHONY += modules_check +modules_check: modules.order + $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $< modules.order: descend $(Q)$(AWK) '!x[$$0]++' $(addsuffix /$@, $(build-dirs)) > $@ diff --git a/scripts/modules-check.sh b/scripts/modules-check.sh index f51f446707b8..43de226071ae 100755 --- a/scripts/modules-check.sh +++ b/scripts/modules-check.sh @@ -3,14 +3,24 @@ set -e +if [ $# != 1 ]; then + echo "Usage: $0 " >& 2 + exit 1 +fi + +exit_code=0 + # Check uniqueness of module names check_same_name_modules() { - for m in $(sed 's:.*/::' modules.order | sort | uniq -d) + for m in $(sed 's:.*/::' $1 | sort | uniq -d) do - echo "warning: same module names found:" >&2 + echo "error: the following would cause module name conflict:" >&2 sed -n "/\/$m/s:^: :p" modules.order >&2 + exit_code=1 done } -check_same_name_modules +check_same_name_modules "$1" + +exit $exit_code -- 2.25.1