Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2640588rwb; Sat, 24 Sep 2022 12:03:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6POiCRO4MuTS+vAPrO90tEVQk/MEoqWLNC+e+5vd8Gk7CdZWt49xeIKYdjVFqhE6IWVcJB X-Received: by 2002:a05:6a00:1747:b0:548:8629:cec5 with SMTP id j7-20020a056a00174700b005488629cec5mr15310354pfc.41.1664046222402; Sat, 24 Sep 2022 12:03:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664046222; cv=none; d=google.com; s=arc-20160816; b=bgTeCzO/9p1CtJK/D1Xi18CR8GcW/gT81Tlg998l2Sn2uaMwldx19PC/AH6JSYtN6u Ndq6dtuvMBr7loGGOACTytWp63uVVPV8j7uJoMs4HgUGTZZXMcQKxfoqWoq4EVxoWe5J 7IRobltc3KD8udzqIqwT+2kwN1/rHE7F4qiAfmhZu9rUfC5hIhKJUUoOVR4Cr7QcNcWi KpcOkjRv7Bx/RtlhoJVABRwkkjfVbuQ0TZy9b6gEXiw5hlhgot1B/nXUD+jaKynDYLkY r7rJic6Dt8W83EdLcIKPY3oMWE/Q/3xyXOY+aLW9oszw3rwqT38idLRT98ObEp+3EizF I4jg== 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:dkim-filter; bh=1hjUHl39f3ahq5fbA8lEwFThtEMEkQko4lR9hIJILXc=; b=zBi/VaT695Z8LZqgX34/2hJKoBMITq5SD6wqWtauXup8I6vLNDKnDDHxlnsM/ADGFX 6hZ6dGOE+3xX0A6QYxfA085LeoacE2x/uQmL7vX+umItmce2U+CJl/+TAKtGFoCzBREa Ruz13VFuuLAFDCR1+iltwbqxqXcsc1kJme5LfrbwtSmMdvHMNc5LWEVBBT9LrvcMlvu8 RoCFHdcHrpObml9+7lOmO4bTokATQIBT9Tb+z2O+1JLBpomo9e+DFrBeoBgDBM/i/+Iq Y9VllhBLfm52SgCZBnbigFs9XjqirymYf1mbC04BrhDmhhiEm2LMO7FhcDaVL08PF7U9 +D/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=qnsXZhFn; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z6-20020a1709027e8600b0016eef21566dsi6035603pla.198.2022.09.24.12.03.30; Sat, 24 Sep 2022 12:03:42 -0700 (PDT) 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=@nifty.com header.s=dec2015msa header.b=qnsXZhFn; 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 S229573AbiIXSVF (ORCPT + 99 others); Sat, 24 Sep 2022 14:21:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229837AbiIXSU3 (ORCPT ); Sat, 24 Sep 2022 14:20:29 -0400 Received: from conuserg-11.nifty.com (conuserg-11.nifty.com [210.131.2.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 367D12E6AF; Sat, 24 Sep 2022 11:20:27 -0700 (PDT) Received: from zoe.. (133-32-182-133.west.xps.vectant.ne.jp [133.32.182.133]) (authenticated) by conuserg-11.nifty.com with ESMTP id 28OIJItT005682; Sun, 25 Sep 2022 03:19:20 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com 28OIJItT005682 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1664043560; bh=1hjUHl39f3ahq5fbA8lEwFThtEMEkQko4lR9hIJILXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qnsXZhFniO7nRG7nF0uXwcErr+yccHtzXzvffQkPk0K+4dIJCi+YPFuzvlgdJ3/kV UgmtoD4kg/jUNQOVLt2f5Er9IxHMyX/7DJyxvq7HzUjyVohuWvVmtYtMW/PLTrc6bU ZGYM2k7Ac9iiGov++kR2jGoQ3tV19YNoV+3GGgHhj3i3dY1ty9/0OJ4zFqaefgcVB+ ZOyHMrd5yJIZlCv++FfQZarMWDfKM+ykiG5G5gREiJ0xQ3Zm73VvepO5soz+iFrwPT 8ihxs7bQXKgv80o1j9bTSEH9ZGVJ0AghVkxBPCq45l2yNCrer8mo5zts9SDxT198fy MLwIxjxx0hs6w== X-Nifty-SrcIP: [133.32.182.133] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Nick Desaulniers , Nathan Chancellor , Masahiro Yamada Subject: [PATCH v3 3/7] kbuild: move .vmlinux.objs rule to Makefile.modpost Date: Sun, 25 Sep 2022 03:19:11 +0900 Message-Id: <20220924181915.3251186-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220924181915.3251186-1-masahiroy@kernel.org> References: <20220924181915.3251186-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no 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 .vmlinux.objs is used by modpost, so scripts/Makefile.modpost is a better place to generate it. It is used only when CONFIG_MODVERSIONS=y. It should be guarded by "ifdef CONFIG_MODVERSIONS". Signed-off-by: Masahiro Yamada --- (no changes since v1) Makefile | 2 +- scripts/Makefile.modpost | 30 ++++++++++++++++++++++++++++-- scripts/link-vmlinux.sh | 18 ------------------ 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index f793c3b1eaec..92413b6de451 100644 --- a/Makefile +++ b/Makefile @@ -1477,7 +1477,7 @@ endif # CONFIG_MODULES # Directories & files removed with 'make clean' CLEAN_FILES += include/ksym vmlinux.symvers modules-only.symvers \ modules.builtin modules.builtin.modinfo modules.nsdeps \ - compile_commands.json .thinlto-cache + compile_commands.json .thinlto-cache .vmlinux.objs # Directories & files removed with 'make mrproper' MRPROPER_FILES += include/config include/generated \ diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 911606496341..04ad00917b2f 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -57,6 +57,32 @@ vmlinux.symvers: vmlinux.o __modpost: vmlinux.symvers +# Generate the list of in-tree objects in vmlinux +# --------------------------------------------------------------------------- + +# This is used to retrieve symbol versions generated by genksyms. +ifdef CONFIG_MODVERSIONS +vmlinux.symvers: .vmlinux.objs +endif + +# Ignore libgcc.a +# Some architectures do '$(CC) --print-libgcc-file-name' to borrow libgcc.a +# from the toolchain, but there is no EXPORT_SYMBOL in it. + +quiet_cmd_vmlinux_objs = GEN $@ + cmd_vmlinux_objs = \ + for f in $(real-prereqs); do \ + case $${f} in \ + *libgcc.a) ;; \ + *.a) $(AR) t $${f} ;; \ + *) echo $${f} ;; \ + esac \ + done > $@ + +targets += .vmlinux.objs +.vmlinux.objs: $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) FORCE + $(call if_changed,vmlinux_objs) + else ifeq ($(KBUILD_EXTMOD),) @@ -134,6 +160,8 @@ ifneq ($(KBUILD_MODPOST_NOFINAL),1) $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal endif +endif + PHONY += FORCE FORCE: @@ -141,6 +169,4 @@ existing-targets := $(wildcard $(sort $(targets))) -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) -endif - .PHONY: $(PHONY) diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 8d982574145a..161bca64e8aa 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -199,7 +199,6 @@ cleanup() rm -f System.map rm -f vmlinux rm -f vmlinux.map - rm -f .vmlinux.objs rm -f .vmlinux.export.c } @@ -218,23 +217,6 @@ fi #link vmlinux.o ${MAKE} -f "${srctree}/scripts/Makefile.vmlinux_o" -# Generate the list of in-tree objects in vmlinux -# -# This is used to retrieve symbol versions generated by genksyms. -for f in ${KBUILD_VMLINUX_OBJS} ${KBUILD_VMLINUX_LIBS}; do - case ${f} in - *libgcc.a) - # Some architectures do '$(CC) --print-libgcc-file-name' to - # borrow libgcc.a from the toolchain. - # There is no EXPORT_SYMBOL in external objects. Ignore this. - ;; - *.a) - ${AR} t ${f} ;; - *) - echo ${f} ;; - esac -done > .vmlinux.objs - # modpost vmlinux.o to check for section mismatches ${MAKE} -f "${srctree}/scripts/Makefile.modpost" MODPOST_VMLINUX=1 -- 2.34.1