From patchwork Sun Nov 13 11:15:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 19346 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1642012wru; Sun, 13 Nov 2022 03:30:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf6bnQtn6kJjwNlWc5zsnXBRNS0+/bmF8A07BxuH/L2Zm9MNVDmg/rducjtd0MkTpVwD9h4V X-Received: by 2002:a05:6402:68d:b0:45f:c86e:5336 with SMTP id f13-20020a056402068d00b0045fc86e5336mr7698432edy.233.1668339049735; Sun, 13 Nov 2022 03:30:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668339049; cv=none; d=google.com; s=arc-20160816; b=tZEbfW2xXaKM3cJz67LVQ7zCx1rQaSfKTBC8y+gpZDfMYmG2B8oZIjVfHd5ssaOO1v ng19wbC7O8dFGn20D8xO+YuRSeyL9MWENk/ua4LR5HU3pxsL5uQ1+rtefuxxD0eUv0Gb /nC/kJgHfaxgcHXxAzqSwtjsy6CB3xed6/DKhkAZFZl5tQgb+Jb2Gjis02038BKGu2kd gQEOUUr/rTzriXN/JlQb7NEfzIUJLVSYL+6lRPSVhi8iw+KwNjHl2ETini7T95SuUtE9 laFuJOlatEUUY8FKF51eq+F/7B095mgoQUmIswRclQbNbSf+qvajAfLXjG7EyzsZrhAh nYJQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=K+DQ3M/xdO0QsZRFLhdLJ/9nkVb1G+4ti+sc7ZsqTPU=; b=eSrNc1m4pqw7KQAvWogk49e1iXrlbTDF3qk0uqmREBpDGIlNXl3Fr7vgrf+hfUHXKR Fzc4JDyrt9BKN8R/cyJJwPmXfb1y/d8Ti+psBj5eeyDCqH4LDvl3+vvWRr9LV6A/D0D+ rIByMShKBpjvGj0Htk1/HzOznmZVUIbHFPR0wUbNhvnsGGm8dlGq7kwJB/jomOr+fJI/ lPvJaSCCinQ12QpuO6cYsmfGkMjUuOisLAdQVdEq2AYVXZRB8UrR32yDOwC4bynoBCTW lPt/ZWij+u6iz05FO4Yq0caO9PsPsOeO66S1cFSiGEWZhNczxrhP2srWmM8v8jSAJB+f 5eEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rOV2ODH+; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b14-20020a17090630ce00b0078db1258ae9si5837314ejb.555.2022.11.13.03.30.26; Sun, 13 Nov 2022 03:30:49 -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=@kernel.org header.s=k20201202 header.b=rOV2ODH+; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235230AbiKMLP4 (ORCPT + 99 others); Sun, 13 Nov 2022 06:15:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235205AbiKMLPy (ORCPT ); Sun, 13 Nov 2022 06:15:54 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC7F32DD8; Sun, 13 Nov 2022 03:15:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CFBD960B7D; Sun, 13 Nov 2022 11:15:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D78B1C4347C; Sun, 13 Nov 2022 11:15:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668338139; bh=CChkGirQ7tNdW0xs9Ao2IBhdo5UClPyAQeNzBiEycCs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rOV2ODH+mFiGalOdh3cb8F6arVpi9UcFhM4xPe6LxP7hq1R6oP2As6BM59t22SrMN e30nEec80SxAVR5p4t8cB+t15H4GzWD2F8RPfPruUHRC+esXPQQKJPwVEaMxMvPomw mm8xh1ve7CMidpLRRBnUwZmsMnviHeCh0+7nnxO3A4jFMzbdhsuTfvKrnnr8UJUTB0 R7JW4TysTS5EntFzIsE8e06QFQmcj3eTn0R/vFZB6ApxUT/ieRAlnV54A2RlJN8k2k trbp9c8MTzgmB1G4rWco+YFIc7vBP2gnB09Z9Ae26YZOI04W3LetDiGn7cOYX1pcpL skimVcVu+7M6A== From: Masahiro Yamada To: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 1/3] kbuild: add kbuild-file macro Date: Sun, 13 Nov 2022 20:15:23 +0900 Message-Id: <20221113111525.3762483-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221113111525.3762483-1-masahiroy@kernel.org> References: <20221113111525.3762483-1-masahiroy@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749380287475223745?= X-GMAIL-MSGID: =?utf-8?q?1749380287475223745?= While building, installing, cleaning, Kbuild visits sub-directories and includes 'Kbuild' or 'Makefile' that exists there. Add 'kbuild-file' macro, and reuse it from scripts/Makefie.* Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- scripts/Kbuild.include | 5 +++++ scripts/Makefile.asm-generic | 6 +++--- scripts/Makefile.build | 6 +----- scripts/Makefile.clean | 5 +---- scripts/Makefile.dtbinst | 2 +- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 2bc08ace38a3..cbe28744637b 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -40,6 +40,11 @@ escsq = $(subst $(squote),'\$(squote)',$1) # Quote a string to pass it to C files. foo => '"foo"' stringify = $(squote)$(quote)$1$(quote)$(squote) +### +# The path to Kbuild or Makefile. Kbuild has precedence over Makefile. +kbuild-dir = $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) +kbuild-file = $(or $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Makefile) + ### # Easy method for doing a status message kecho := : diff --git a/scripts/Makefile.asm-generic b/scripts/Makefile.asm-generic index 1d501c57f9ef..8d01b37b7677 100644 --- a/scripts/Makefile.asm-generic +++ b/scripts/Makefile.asm-generic @@ -10,15 +10,15 @@ PHONY := all all: src := $(subst /generated,,$(obj)) --include $(src)/Kbuild + +include $(srctree)/scripts/Kbuild.include +-include $(kbuild-file) # $(generic)/Kbuild lists mandatory-y. Exclude um since it is a special case. ifneq ($(SRCARCH),um) include $(srctree)/$(generic)/Kbuild endif -include $(srctree)/scripts/Kbuild.include - redundant := $(filter $(mandatory-y) $(generated-y), $(generic-y)) redundant += $(foreach f, $(generic-y), $(if $(wildcard $(srctree)/$(src)/$(f)),$(f))) redundant := $(sort $(redundant)) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 41f3602fc8de..37cf88d076e8 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -38,11 +38,7 @@ subdir-ccflags-y := include $(srctree)/scripts/Kbuild.include include $(srctree)/scripts/Makefile.compiler - -# The filename Kbuild has precedence over Makefile -kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) -include $(or $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Makefile) - +include $(kbuild-file) include $(srctree)/scripts/Makefile.lib # Do not include hostprogs rules unless needed. diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index 878cec648959..3649900696dd 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean @@ -9,10 +9,7 @@ PHONY := __clean __clean: include $(srctree)/scripts/Kbuild.include - -# The filename Kbuild has precedence over Makefile -kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) -include $(or $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Makefile) +include $(kbuild-file) # Figure out what we need to build from the various variables # ========================================================================== diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst index 190d781e84f4..2ab936e4179d 100644 --- a/scripts/Makefile.dtbinst +++ b/scripts/Makefile.dtbinst @@ -15,7 +15,7 @@ __dtbs_install: include include/config/auto.conf include $(srctree)/scripts/Kbuild.include -include $(src)/Makefile +include $(kbuild-file) dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-))) subdirs := $(addprefix $(obj)/, $(subdir-y) $(subdir-m)) From patchwork Sun Nov 13 11:15:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 19349 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1642903wru; Sun, 13 Nov 2022 03:34:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf4ZlpDl+YpS02Wj/+168k6NF/B7YV/9dYO+lhEQEOdIFyRvNhbCLZpCAoukL8CYEywzlO7S X-Received: by 2002:a17:906:6d89:b0:7ad:eb7f:d082 with SMTP id h9-20020a1709066d8900b007adeb7fd082mr7062525ejt.356.1668339258387; Sun, 13 Nov 2022 03:34:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668339258; cv=none; d=google.com; s=arc-20160816; b=bCp72Vc858AscUMfFub5MhHZ34b9jc5CKenGJT6hUsU1a1ZB7euv3dwa99vpT2Dqri OQpJ1E3eT2OleqDZMyCU1RmFrcGvR0Qug5JcySMDfABZu74/m1zSmP317ZGT4EFYAkBX XL0G95AwsK/cgf6aGvtGK82IWWqAscECFt4JfJFgY6IkFOF6WjykbUDJ/TNDIbC6CvDJ r2W4H32Rrxe7XrfFL/DTSC1HE7BG0NL7/dJk0BI/pW7C50cRLdtSwxtkwJpkFjSK7TaD chMLuLrHQO/7vd4KfRBFcnlB2KjaliC8WEZVgS4V6IkVrAa6lrYINZ3gie8HPCmEcUV6 LC/g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YLv8beCzInYrzjgwDWYepxrq3+Kgj/4uWfir8fCn1mk=; b=Y+vdK75C3EDeCJhtRMw2RqfMMsvnycDk+80Jz4il7rEyJSyvM96JyFDUPjWRLQEj/Z O+7pv6t5bgV/bJ9w0zlad6i3rLJRB2YZ3My9Rjv/1hHXkpVStVS1bBpQuXYhMT5uiOAZ M6Z1upXa46xLi/8LGGNTEUleIctdfDMIfy3yOPJWlDpbzyRi2Go+0d57LcBBkuExhKUc T9pHgwvO44g6QCawj0dRpq6Oplbp1FWatosudF5MyBIDBcEsuVxTjMgWqKBAX+fbXLxt 6OxLnyNFaHxCws9iLXHXXhLT0Du9zARswmomYwsEIRxiKf5I5NC1lsbqMubYBGpvvbzZ zgig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=buQXqYWa; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t26-20020a50ab5a000000b0045cafc51fbfsi6839986edc.525.2022.11.13.03.33.54; Sun, 13 Nov 2022 03:34:18 -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=@kernel.org header.s=k20201202 header.b=buQXqYWa; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235309AbiKMLQC (ORCPT + 99 others); Sun, 13 Nov 2022 06:16:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235244AbiKMLP5 (ORCPT ); Sun, 13 Nov 2022 06:15:57 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7337FD1; Sun, 13 Nov 2022 03:15:55 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DF728B80945; Sun, 13 Nov 2022 11:15:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1FC4C43470; Sun, 13 Nov 2022 11:15:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668338141; bh=6esSQCF97bsSy1DYAQHpS5FTQFJROMZrtxeSvvj4LzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=buQXqYWaIW5FDaBq4ttgC6Na56yHwfD3JOFP4ggY7JPXsvYAJMgO8qRafM9hMuuQW UEiWgUPTAUK65CxD26/dftY3+SW2LNF5c8F2vbzRRklOwhr8grn+8lWyiz2qvLtqEd WuDiTEDmHJuFga7jmApRBXkXgxqcs1KhOTQIh7NlJN/0EzkhcCQACIZlZDVXRga1c1 eAeOz6mw2v1y0mZTCqIMSuliQFUKfeUKIVAXPnXxHFT7XFXI+LGnKqj2yjROCVpScj fqJZ6FbxQeFcMyPD8tgqWRQ9eqQ42CHKIYujTvhU6uPrWjT7Hh/dID4hUU+vvd+wF8 Ss3xmFRvFLIRQ== From: Masahiro Yamada To: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nick Terrell , Nicolas Schier , Tom Rix , llvm@lists.linux.dev Subject: [PATCH 2/3] kbuild: warn objects shared among multiple modules Date: Sun, 13 Nov 2022 20:15:24 +0900 Message-Id: <20221113111525.3762483-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221113111525.3762483-1-masahiroy@kernel.org> References: <20221113111525.3762483-1-masahiroy@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749380506608699676?= X-GMAIL-MSGID: =?utf-8?q?1749380506608699676?= If an object is shared among multiple modules, some of them are configured as 'm', but the others as 'y', the shared object is linked to the modules and vmlinux. This is a potential issue because the expected CFLAGS are different between modules and builtins. Commit 637a642f5ca5 ("zstd: Fixing mixed module-builtin objects") reported that this could be even more fatal in some cases such as Clang LTO. That commit fixed lib/zlib/zstd_{compress,decompress}, but there are still more instances of breakage. This commit adds a W=1 warning for shared objects, so that the kbuild test robot, which provides build tests with W=1, will avoid a new breakage slipping in. Quick compile tests on v6.1-rc4 detected the following: scripts/Makefile.build:252: ./drivers/crypto/marvell/octeontx2/Makefile: cn10k_cpt.o is added to multiple modules: rvu_cptpf rvu_cptvf scripts/Makefile.build:252: ./drivers/crypto/marvell/octeontx2/Makefile: otx2_cptlf.o is added to multiple modules: rvu_cptpf rvu_cptvf scripts/Makefile.build:252: ./drivers/crypto/marvell/octeontx2/Makefile: otx2_cpt_mbox_common.o is added to multiple modules: rvu_cptpf rvu_cptvf scripts/Makefile.build:252: ./drivers/edac/Makefile: skx_common.o is added to multiple modules: i10nm_edac skx_edac scripts/Makefile.build:252: ./drivers/gpu/drm/bridge/imx/Makefile: imx-ldb-helper.o is added to multiple modules: imx8qm-ldb imx8qxp-ldb scripts/Makefile.build:252: ./drivers/mfd/Makefile: rsmu_core.o is added to multiple modules: rsmu-i2c rsmu-spi scripts/Makefile.build:252: ./drivers/mtd/tests/Makefile: mtd_test.o is added to multiple modules: mtd_nandbiterrs mtd_oobtest mtd_pagetest mtd_readtest mtd_speedtest mtd_stresstest mtd_subpagetest mtd_torturetest scripts/Makefile.build:252: ./drivers/net/dsa/ocelot/Makefile: felix.o is added to multiple modules: mscc_felix mscc_seville scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: cn23xx_pf_device.o is added to multiple modules: liquidio liquidio_vf scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: cn23xx_vf_device.o is added to multiple modules: liquidio liquidio_vf scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: cn66xx_device.o is added to multiple modules: liquidio liquidio_vf scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: cn68xx_device.o is added to multiple modules: liquidio liquidio_vf scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: lio_core.o is added to multiple modules: liquidio liquidio_vf scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: lio_ethtool.o is added to multiple modules: liquidio liquidio_vf scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: octeon_device.o is added to multiple modules: liquidio liquidio_vf scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: octeon_droq.o is added to multiple modules: liquidio liquidio_vf scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: octeon_mailbox.o is added to multiple modules: liquidio liquidio_vf scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: octeon_mem_ops.o is added to multiple modules: liquidio liquidio_vf scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: octeon_nic.o is added to multiple modules: liquidio liquidio_vf scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: request_manager.o is added to multiple modules: liquidio liquidio_vf scripts/Makefile.build:252: ./drivers/net/ethernet/cavium/liquidio/Makefile: response_manager.o is added to multiple modules: liquidio liquidio_vf scripts/Makefile.build:252: ./drivers/net/ethernet/freescale/dpaa2/Makefile: dpaa2-mac.o is added to multiple modules: fsl-dpaa2-eth fsl-dpaa2-switch scripts/Makefile.build:252: ./drivers/net/ethernet/freescale/dpaa2/Makefile: dpmac.o is added to multiple modules: fsl-dpaa2-eth fsl-dpaa2-switch scripts/Makefile.build:252: ./drivers/net/ethernet/freescale/enetc/Makefile: enetc_cbdr.o is added to multiple modules: fsl-enetc fsl-enetc-vf scripts/Makefile.build:252: ./drivers/net/ethernet/freescale/enetc/Makefile: enetc_ethtool.o is added to multiple modules: fsl-enetc fsl-enetc-vf scripts/Makefile.build:252: ./drivers/net/ethernet/freescale/enetc/Makefile: enetc.o is added to multiple modules: fsl-enetc fsl-enetc-vf scripts/Makefile.build:252: ./drivers/net/ethernet/hisilicon/hns3/Makefile: hns3_common/hclge_comm_cmd.o is added to multiple modules: hclge hclgevf scripts/Makefile.build:252: ./drivers/net/ethernet/hisilicon/hns3/Makefile: hns3_common/hclge_comm_rss.o is added to multiple modules: hclge hclgevf scripts/Makefile.build:252: ./drivers/net/ethernet/hisilicon/hns3/Makefile: hns3_common/hclge_comm_tqp_stats.o is added to multiple modules: hclge hclgevf scripts/Makefile.build:252: ./drivers/net/ethernet/marvell/octeontx2/nic/Makefile: otx2_dcbnl.o is added to multiple modules: rvu_nicpf rvu_nicvf scripts/Makefile.build:252: ./drivers/net/ethernet/marvell/octeontx2/nic/Makefile: otx2_devlink.o is added to multiple modules: rvu_nicpf rvu_nicvf scripts/Makefile.build:252: ./drivers/net/ethernet/ti/Makefile: cpsw_ale.o is added to multiple modules: keystone_netcp keystone_netcp_ethss ti_cpsw ti_cpsw_new scripts/Makefile.build:252: ./drivers/net/ethernet/ti/Makefile: cpsw_ethtool.o is added to multiple modules: ti_cpsw ti_cpsw_new scripts/Makefile.build:252: ./drivers/net/ethernet/ti/Makefile: cpsw_priv.o is added to multiple modules: ti_cpsw ti_cpsw_new scripts/Makefile.build:252: ./drivers/net/ethernet/ti/Makefile: cpsw_sl.o is added to multiple modules: ti_cpsw ti_cpsw_new scripts/Makefile.build:252: ./drivers/net/ethernet/ti/Makefile: davinci_cpdma.o is added to multiple modules: ti_cpsw ti_cpsw_new ti_davinci_emac scripts/Makefile.build:252: ./drivers/platform/x86/intel/int3472/Makefile: common.o is added to multiple modules: intel_skl_int3472_discrete intel_skl_int3472_tps68470 scripts/Makefile.build:252: ./sound/soc/codecs/Makefile: wcd-clsh-v2.o is added to multiple modules: snd-soc-wcd9335 snd-soc-wcd934x snd-soc-wcd938x Once all the warnings are fixed, it can become an error irrespective of W= option. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 37cf88d076e8..799df12b53f3 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -222,6 +222,10 @@ endif cmd_check_local_export = $(srctree)/scripts/check-local-export $@ +ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),) +cmd_warn_shared_object = $(if $(word 2, $(modname-multi)),$(warning $(kbuild-file): $*.o is added to multiple modules: $(modname-multi))) +endif + define rule_cc_o_c $(call cmd_and_fixdep,cc_o_c) $(call cmd,gen_ksymdeps) @@ -231,6 +235,7 @@ define rule_cc_o_c $(call cmd,gen_objtooldep) $(call cmd,gen_symversions_c) $(call cmd,record_mcount) + $(call cmd,warn_shared_object) endef define rule_as_o_S @@ -239,6 +244,7 @@ define rule_as_o_S $(call cmd,check_local_export) $(call cmd,gen_objtooldep) $(call cmd,gen_symversions_S) + $(call cmd,warn_shared_object) endef # Built-in and composite module parts From patchwork Sun Nov 13 11:15:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 19347 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1642776wru; Sun, 13 Nov 2022 03:33:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf7z3HLwZZ7Noo4MRZvJIx3azBI/d4RiLOWhy2zx8D2KeBi88+wUuoSLS8x3W0tGWgKAhkZi X-Received: by 2002:a05:6402:3814:b0:461:7d1f:1a7b with SMTP id es20-20020a056402381400b004617d1f1a7bmr7555267edb.400.1668339230836; Sun, 13 Nov 2022 03:33:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668339230; cv=none; d=google.com; s=arc-20160816; b=Z8qRZ/0fVowDwMXne5tqkEUMQhmZhlM3Zm3/h2+DGgBE3oVkdqh9NrzsDc2zHSuz5A pNkEKbTE7SXUSXLjQDs0EeMXpeGW8w0PVdeILyMgUsQbW5Vn4NvEePSEeo3kp8v9y1Gr 48hkqz8Ni9AIydNQsROhR+z5eEIuSdsrQKvtbuwvyQsQbYrS4OYrMbhKkz6jti8FOX9r MGYIs8gGjy/AQtaYBfGp3dQJop91d+/n1/Eb9Z3XueG4yA/A/+enmQc/tLSp29EgsTZt UW8TxrEiaIFgiz62BC0rJMnsBsTMiKroHcCOSigEUXI5tOXFGii21srUiaJF7sXYKOsr 86rw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1PeEHyS5aVP+TLigR9eGvMxrq4ZCzJOgVrcvjg2+V5E=; b=UU/JYKbnWqVzbrc8lF3zG/3UrxfTL9sH0Y7aZfkLMTRDeus/2ow0fJZ1lWFJmdr7U9 pCX+t26Pzi09SDQQABsu19sm+lQPsxN5CAe5QLx7IKQz8mf95dgOr0sw8ZUtnozuyBWl 8sOV57Wr7m3Y8cRAlqZnSHRK4k1nxO/a45bOqz+cKkJUyiJPksHlnHX0WGYDq03nmh+5 8SUNJE/agyccA7grMa6FaRoNhc3EEDeJquI1dFwWf7zcxHR8m9W9YAb+QysBASW5URe6 OjmYG7RT7RDA6nWaFsALH97dYMTh9dNbNN4ktCblLAlqxhqkhW2wPdPso6M75TvslKpk Q/dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XL8cVlk8; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id vw2-20020a170907a70200b0078e15c30a6csi6097088ejc.559.2022.11.13.03.33.01; Sun, 13 Nov 2022 03:33:50 -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=@kernel.org header.s=k20201202 header.b=XL8cVlk8; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235290AbiKMLQE (ORCPT + 99 others); Sun, 13 Nov 2022 06:16:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235277AbiKMLP6 (ORCPT ); Sun, 13 Nov 2022 06:15:58 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D47FBCB4; Sun, 13 Nov 2022 03:15:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C783AB80C71; Sun, 13 Nov 2022 11:15:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C838C433B5; Sun, 13 Nov 2022 11:15:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668338143; bh=1P63x9nTvuyG2RvATLWGR+XaRnu7BvTepYHhkKgeLKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XL8cVlk83wiEBd8Oka0LGV2ggk6Plrp7LXgvNA/fGr+11sAFvgBPoBK/2lD5/MgXZ qs33wgSxSBNddXpbZlmPToyCDE7yAaoH9D9//iAgRYniqlqY8d/ynn8GHkcu3zw7O7 fClCU6xjnrdRKbriWSMQO1L2Bv2VnJF6eaaZQTEd4xVG/aM4sktSzrB1gT9L0Oa/+a MCb11H5oxcYl/lDeI5TW55IldyG/eOxbrTAAiZk8/c87wfjZnGLbbl3xVw8ckDgkh4 ydXAk+rDezdAe/5IdiaoTYIfEFXIdCcmWUv5Z7JhByX3S1g7/Ru+YQmM/8olHdesc6 NLF+1rQGsMS6Q== From: Masahiro Yamada To: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 3/3] [pending] kbuild: make forbid sharing objects among multiple modules Date: Sun, 13 Nov 2022 20:15:25 +0900 Message-Id: <20221113111525.3762483-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221113111525.3762483-1-masahiroy@kernel.org> References: <20221113111525.3762483-1-masahiroy@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749380477247962135?= X-GMAIL-MSGID: =?utf-8?q?1749380477247962135?= *** This patch is applicable after all the warnings are fixed. *** It may take a couple of development cycles. Now that all the warnings are fixed, the warning can be promoted to an error. Simplify the modules.builtin rule because modname always consists of a single word. Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- scripts/Makefile.build | 6 ------ scripts/Makefile.lib | 8 ++++---- scripts/Makefile.vmlinux_o | 5 +---- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 799df12b53f3..37cf88d076e8 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -222,10 +222,6 @@ endif cmd_check_local_export = $(srctree)/scripts/check-local-export $@ -ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),) -cmd_warn_shared_object = $(if $(word 2, $(modname-multi)),$(warning $(kbuild-file): $*.o is added to multiple modules: $(modname-multi))) -endif - define rule_cc_o_c $(call cmd_and_fixdep,cc_o_c) $(call cmd,gen_ksymdeps) @@ -235,7 +231,6 @@ define rule_cc_o_c $(call cmd,gen_objtooldep) $(call cmd,gen_symversions_c) $(call cmd,record_mcount) - $(call cmd,warn_shared_object) endef define rule_as_o_S @@ -244,7 +239,6 @@ define rule_as_o_S $(call cmd,check_local_export) $(call cmd,gen_objtooldep) $(call cmd,gen_symversions_S) - $(call cmd,warn_shared_object) endef # Built-in and composite module parts diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 3aa384cec76b..d73bfe0fabda 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -106,13 +106,13 @@ endif # Finds the multi-part object the current object will be linked into. # If the object belongs to two or more multi-part objects, list them all. -modname-multi = $(sort $(foreach m,$(multi-obj-ym),\ +__modname-multi = $(sort $(foreach m,$(multi-obj-ym),\ $(if $(filter $*.o, $(call suffix-search, $m, .o, -objs -y -m)),$(m:.o=)))) -__modname = $(or $(modname-multi),$(basetarget)) +modname-multi = $(if $(word 2, $(__modname-multi)), $(error $(kbuild-file): $*.o is added to multiple modules: $(__modname-multi)))$(__modname-multi) -modname = $(subst $(space),:,$(__modname)) -modfile = $(addprefix $(obj)/,$(__modname)) +modname = $(or $(modname-multi),$(basetarget)) +modfile = $(addprefix $(obj)/,$(modname)) # target with $(obj)/ and its suffix stripped target-stem = $(basename $(patsubst $(obj)/%,%,$@)) diff --git a/scripts/Makefile.vmlinux_o b/scripts/Makefile.vmlinux_o index 0edfdb40364b..2faf4960aa7a 100644 --- a/scripts/Makefile.vmlinux_o +++ b/scripts/Makefile.vmlinux_o @@ -74,13 +74,10 @@ modules.builtin.modinfo: vmlinux.o FORCE # module.builtin # --------------------------------------------------------------------------- -# The second line aids cases where multiple modules share the same object. - quiet_cmd_modules_builtin = GEN $@ cmd_modules_builtin = \ tr '\0' '\n' < $< | \ - sed -n 's/^[[:alnum:]:_]*\.file=//p' | \ - tr ' ' '\n' | uniq | sed -e 's:^:kernel/:' -e 's/$$/.ko/' > $@ + sed -n 's@^[[:alnum:]:_]*\.file=\(.*\)@kernel/\1.ko@p' | uniq > $@ targets += modules.builtin modules.builtin: modules.builtin.modinfo FORCE