From nobody Fri Dec 19 00:03:21 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AE2A1DFE09; Fri, 6 Jun 2025 04:10:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749183059; cv=none; b=UXKu1m914DvmLItiJf4sl8w+U4gtT4zezQh+5BxEGRZ1iTOKEWC7MO9H8zEDElNXcH62XFbKEeWVsNj80PrMybFBOBcs8GO/I1XjEttqVHwsGkSLoizhuScV2LloKIKID3IYX8su1aenhM5U+xe6OTfkkBGjisymtqR5J0mfCT0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749183059; c=relaxed/simple; bh=pQjVgtjLZxBNIPAfQihqfJ1ExBGADC8vA7OEebDx+qk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ikbdrQ1ZdP90s/VSwb0k1+U/nWxmbp8I+iarTnm77vLK80fbKTv3decB3wlVazx6i+WLNAW/a/x2eENbHvg5EBnjmiie6Ye62Ep0rw4nAUjb7eMkYZDkgYalclEc5mI53afLXOjnS2ScxggbUfqX4cWMldkZPECCookn4bH6Iuc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=u4+y3cZM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="u4+y3cZM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D85D5C4CEF2; Fri, 6 Jun 2025 04:10:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1749183058; bh=pQjVgtjLZxBNIPAfQihqfJ1ExBGADC8vA7OEebDx+qk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u4+y3cZMblVE8K7UDF/mfvPemp6PdqwijZNuP4nmRumlJdItJW0qits0VDVMGxuvy OE2JPqg2fVKsitrKXLE3RIy5RxUJWXp7xNKcT9QQqbc9jEa7Hdi8+3sBYupIfLffb0 jt3eiujdhNTQDHq+KWmOlo3S6mK2TzP385D+4zNgfms70qZo4dP5Qfhdw5hcyKTseA rDRCgBTGGTzCn0t2hfm91g9wXN9H6GTaUX7KgAmss7r5EMJBc0qDLWyEh93Xce0gzz 7Ghm0GeNsRcY6jkwIWYwy7GvXXOgyJhvf9XnZx2t1yZJy/vPzFqe41W4BkZWGXqeg/ zgNlTQEpIjx2A== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Petr Pavlu , Alexey Gladkov , Ard Biesheuvel , Nathan Chancellor , Nicolas Schier , linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 1/4] module: remove meaningless 'name' parameter from __MODULE_INFO() Date: Fri, 6 Jun 2025 13:10:23 +0900 Message-ID: <20250606041029.614348-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250606041029.614348-1-masahiroy@kernel.org> References: <20250606041029.614348-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The symbol names in the .modinfo section are never used and already randomized by the __UNIQUE_ID() macro. Therefore, the second parameter of __MODULE_INFO() is meaningless and can be removed to simplify the code. With this change, the symbol names in the .modinfo section will be prefixed with __UNIQUE_ID_modinfo, making it clearer that they originate from MODULE_INFO(). [Before] $ objcopy -j .modinfo vmlinux.o modinfo.o $ nm -n modinfo.o | head -n10 0000000000000000 r __UNIQUE_ID_license560 0000000000000011 r __UNIQUE_ID_file559 0000000000000030 r __UNIQUE_ID_description558 0000000000000074 r __UNIQUE_ID_license580 000000000000008e r __UNIQUE_ID_file579 00000000000000bd r __UNIQUE_ID_description578 00000000000000e6 r __UNIQUE_ID_license581 00000000000000ff r __UNIQUE_ID_file580 0000000000000134 r __UNIQUE_ID_description579 0000000000000179 r __UNIQUE_ID_uncore_no_discover578 [After] $ objcopy -j .modinfo vmlinux.o modinfo.o $ nm -n modinfo.o | head -n10 0000000000000000 r __UNIQUE_ID_modinfo560 0000000000000011 r __UNIQUE_ID_modinfo559 0000000000000030 r __UNIQUE_ID_modinfo558 0000000000000074 r __UNIQUE_ID_modinfo580 000000000000008e r __UNIQUE_ID_modinfo579 00000000000000bd r __UNIQUE_ID_modinfo578 00000000000000e6 r __UNIQUE_ID_modinfo581 00000000000000ff r __UNIQUE_ID_modinfo580 0000000000000134 r __UNIQUE_ID_modinfo579 0000000000000179 r __UNIQUE_ID_modinfo578 Signed-off-by: Masahiro Yamada Reviewed-by: Petr Pavlu --- include/crypto/algapi.h | 4 ++-- include/linux/module.h | 3 --- include/linux/moduleparam.h | 9 +++++---- include/net/tcp.h | 4 ++-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index 6e07bbc04089..f5e7454758bd 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h @@ -43,8 +43,8 @@ * alias. */ #define MODULE_ALIAS_CRYPTO(name) \ - __MODULE_INFO(alias, alias_userspace, name); \ - __MODULE_INFO(alias, alias_crypto, "crypto-" name) + MODULE_INFO(alias, name); \ + MODULE_INFO(alias, "crypto-" name) =20 struct crypto_aead; struct crypto_instance; diff --git a/include/linux/module.h b/include/linux/module.h index 92e1420fccdf..81b41cc6a19e 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -164,9 +164,6 @@ extern void cleanup_module(void); =20 struct module_kobject *lookup_or_create_module_kobject(const char *name); =20 -/* Generic info of form tag =3D "info" */ -#define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info) - /* For userspace: you can also call me... */ #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias) =20 diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index bfb85fd13e1f..00166f747e27 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h @@ -20,18 +20,19 @@ /* Chosen so that structs with an unsigned long line up. */ #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) =20 -#define __MODULE_INFO(tag, name, info) \ - static const char __UNIQUE_ID(name)[] \ +/* Generic info of form tag =3D "info" */ +#define MODULE_INFO(tag, info) \ + static const char __UNIQUE_ID(modinfo)[] \ __used __section(".modinfo") __aligned(1) \ =3D __MODULE_INFO_PREFIX __stringify(tag) "=3D" info =20 #define __MODULE_PARM_TYPE(name, _type) \ - __MODULE_INFO(parmtype, name##type, #name ":" _type) + MODULE_INFO(parmtype, #name ":" _type) =20 /* One for each parameter, describing how to use it. Some files do multiple of these per line, so can't just use MODULE_INFO. */ #define MODULE_PARM_DESC(_parm, desc) \ - __MODULE_INFO(parm, _parm, #_parm ":" desc) + MODULE_INFO(parm, #_parm ":" desc) =20 struct kernel_param; =20 diff --git a/include/net/tcp.h b/include/net/tcp.h index 4450c384ef17..ac6df59e4eea 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -2661,8 +2661,8 @@ void tcp_update_ulp(struct sock *sk, struct proto *p, void (*write_space)(struct sock *sk)); =20 #define MODULE_ALIAS_TCP_ULP(name) \ - __MODULE_INFO(alias, alias_userspace, name); \ - __MODULE_INFO(alias, alias_tcp_ulp, "tcp-ulp-" name) + MODULE_INFO(alias, name); \ + MODULE_INFO(alias, "tcp-ulp-" name) =20 #ifdef CONFIG_NET_SOCK_MSG struct sk_msg; --=20 2.43.0 From nobody Fri Dec 19 00:03:21 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BF2E1DD0F6; Fri, 6 Jun 2025 04:11:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749183063; cv=none; b=kgSBWFXqgBXyTvyJObpOStxQsCJJoZsZS4VMpH4s4rx5d8PR3aEaZllT+v1ofxKOhPkUMl2dpsYwd0sQUr6Q7qFVY+qlJ9Mw74vfl4y2zfj7UNGajOBnS+fU/q+yYiVVNRW0G/QbEQW816EV5MCvPYrkDcXTJT8nypOk97jC7gw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749183063; c=relaxed/simple; bh=86Dh/Q52b6/llPWHYYB5hoYpZGrYsitSgBTFGkk8RXg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L1Eawvah4nsI94pb7tmqUYgi3b0fbfPOeNxiQVaQC1POSFWBm9eTzs2dzo/upvSzfZzdzX9BhFf0nNo1+7HNyISmyt09wNsgez0XjwowHVLjwM6MWkRm1LwWc1ljfW0b9RJXGo0/rK/AAnq8nqyPlep+H1FqY1aVmvItdnWF2rk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=W3s6LnG7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="W3s6LnG7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E5C1C4CEEE; Fri, 6 Jun 2025 04:10:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1749183062; bh=86Dh/Q52b6/llPWHYYB5hoYpZGrYsitSgBTFGkk8RXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W3s6LnG7t24xI3qKN8tPKH2ZicR+uBk3ndA6sCDDqMLQusXprGHlk44vLgeljRo0W NoeesIb6iZWplZDCuga8wkZzpL/Tn8LJ4tSI0gN+iZxAUIUt44rc5V1aZyWpU8JGZI 9WUWW4D/pv3lxkg182PMhSef2TJ8OJQTDTNLMkpgcW7gmIDhn4PfctwUCbz2rZVX07 Mg7icpOGSJ95Jpj7Nkyd1iyxDlHVeEkd0TwZ1+vkbNZsx6QoXhS6KLzQVcfimjyiUm 2e/HhweH/XLyeI2f4IKfERfjz9dOS/Sbes91aBFdMZ01Xj7cOaPRD7aFPPPKljLgK9 hz//m597LJgxg== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Petr Pavlu , Alexey Gladkov , Ard Biesheuvel , Nathan Chancellor , Nicolas Schier , linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 2/4] kbuild: always create intermediate vmlinux.unstripped Date: Fri, 6 Jun 2025 13:10:24 +0900 Message-ID: <20250606041029.614348-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250606041029.614348-1-masahiroy@kernel.org> References: <20250606041029.614348-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Generate the intermediate vmlinux.unstripped regardless of CONFIG_ARCH_VMLINUX_NEEDS_RELOCS. If CONFIG_ARCH_VMLINUX_NEEDS_RELOCS is unset, vmlinux.unstripped and vmlinux are identiacal. This simplifies the build rule, and allows to strip more sections by adding them to remove-section-y. Signed-off-by: Masahiro Yamada --- scripts/Makefile.vmlinux | 45 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux index b64862dc6f08..4f2d4c3fb737 100644 --- a/scripts/Makefile.vmlinux +++ b/scripts/Makefile.vmlinux @@ -9,20 +9,6 @@ include $(srctree)/scripts/Makefile.lib =20 targets :=3D =20 -ifdef CONFIG_ARCH_VMLINUX_NEEDS_RELOCS -vmlinux-final :=3D vmlinux.unstripped - -quiet_cmd_strip_relocs =3D RSTRIP $@ - cmd_strip_relocs =3D $(OBJCOPY) --remove-section=3D'.rel*' --remove-= section=3D!'.rel*.dyn' $< $@ - -vmlinux: $(vmlinux-final) FORCE - $(call if_changed,strip_relocs) - -targets +=3D vmlinux -else -vmlinux-final :=3D vmlinux -endif - %.o: %.c FORCE $(call if_changed_rule,cc_o_c) =20 @@ -61,19 +47,19 @@ targets +=3D .builtin-dtbs-list =20 ifdef CONFIG_GENERIC_BUILTIN_DTB targets +=3D .builtin-dtbs.S .builtin-dtbs.o -$(vmlinux-final): .builtin-dtbs.o +vmlinux.unstripped: .builtin-dtbs.o endif =20 -# vmlinux +# vmlinux.unstripped # ------------------------------------------------------------------------= --- =20 ifdef CONFIG_MODULES targets +=3D .vmlinux.export.o -$(vmlinux-final): .vmlinux.export.o +vmlinux.unstripped: .vmlinux.export.o endif =20 ifdef CONFIG_ARCH_WANTS_PRE_LINK_VMLINUX -$(vmlinux-final): arch/$(SRCARCH)/tools/vmlinux.arch.o +vmlinux.unstripped: arch/$(SRCARCH)/tools/vmlinux.arch.o =20 arch/$(SRCARCH)/tools/vmlinux.arch.o: vmlinux.o FORCE $(Q)$(MAKE) $(build)=3Darch/$(SRCARCH)/tools $@ @@ -86,17 +72,30 @@ cmd_link_vmlinux =3D \ $< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)" "$@"; \ $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) =20 -targets +=3D $(vmlinux-final) -$(vmlinux-final): scripts/link-vmlinux.sh vmlinux.o $(KBUILD_LDS) FORCE +targets +=3D vmlinux.unstripped +vmlinux.unstripped: scripts/link-vmlinux.sh vmlinux.o $(KBUILD_LDS) FORCE +$(call if_changed_dep,link_vmlinux) ifdef CONFIG_DEBUG_INFO_BTF -$(vmlinux-final): $(RESOLVE_BTFIDS) +vmlinux.unstripped: $(RESOLVE_BTFIDS) endif =20 ifdef CONFIG_BUILDTIME_TABLE_SORT -$(vmlinux-final): scripts/sorttable +vmlinux.unstripped: scripts/sorttable endif =20 +# vmlinux +# ------------------------------------------------------------------------= --- + +remove-section-y :=3D +remove-section-$(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS) +=3D '.rel*' + +quiet_cmd_strip_relocs =3D OBJCOPY $@ + cmd_strip_relocs =3D $(OBJCOPY) $(addprefix --remove-section=3D,$(re= move-section-y)) $< $@ + +targets +=3D vmlinux +vmlinux: vmlinux.unstripped FORCE + $(call if_changed,strip_relocs) + # modules.builtin.ranges # ------------------------------------------------------------------------= --- ifdef CONFIG_BUILTIN_MODULE_RANGES @@ -110,7 +109,7 @@ modules.builtin.ranges: $(srctree)/scripts/generate_bui= ltin_ranges.awk \ modules.builtin vmlinux.map vmlinux.o.map FORCE $(call if_changed,modules_builtin_ranges) =20 -vmlinux.map: $(vmlinux-final) +vmlinux.map: vmlinux.unstripped @: =20 endif --=20 2.43.0 From nobody Fri Dec 19 00:03:21 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C1FA1E98E3; Fri, 6 Jun 2025 04:11:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749183066; cv=none; b=K/f8Bs3a/97xWUdW8308loPdtdKR5V+5/4Nduq7MSihIIrkDFdGm6yffabwfw8MljkNQ68DWzoQ3YDC29zZLJEpgOC6V+HaaoGNNx4a/NLUbDJ8hP5WCZY5k9EoVwfj5oYdpyrfGhc4/e4W3whWoLgZpclfe+XC9rWWaLqmOdsQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749183066; c=relaxed/simple; bh=ayF3R0tSKj0OJesZ+fxPbrtJx/oOovwQFsLtj1f9dNE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CKcgvrSW7tKwDb0sP5s7LxTb7eLib+JPTywp1SWq3uhurqwUDm7agiveGX+Xh2fZTSBntHocDH3mOvhvNkjnZYDe2HfhmZ8ESGjho0qITWlg18aMEGML3hdYAkpjL+QhtuSKzPMiPMbGFaAnYrr0aYdGhjNRNTnrscU4Wawi1UI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Gs0eht9K; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Gs0eht9K" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EF47C4CEED; Fri, 6 Jun 2025 04:11:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1749183065; bh=ayF3R0tSKj0OJesZ+fxPbrtJx/oOovwQFsLtj1f9dNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gs0eht9KyYSIR04NLPdWdnjHK4a2jqq8E1qqSpU+qCGXKO6Zr266K6i0xPWvHqkJ8 n/HXl86H5TDghuykMRCSaWePMRjg0stQF1CDYlZQVGKzs5w3WZkr1CuuSSsKcyLvIT bOlC/BnQ9E4qwfej6USY03CbxHqF8BEV4PFJJESu1wBouTCfoU43JxasvRb8ERjYf4 Kd+W56skc6IRT/LFwPfVDULg3CixW5f2bTpCD8O9HNUMx5NXGoPJXHVbRqI0CGTrrl 5MuZYYjxs6j2veLP7qz/lxhN51atg/oJsSzFOtjaKhkogudnHGaYche2ZouLYSXbxq JYYK5zQDQFfPA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Petr Pavlu , Alexey Gladkov , Ard Biesheuvel , Nathan Chancellor , Nicolas Schier , linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 3/4] kbuild: keep .modinfo section in vmlinux.unstripped Date: Fri, 6 Jun 2025 13:10:25 +0900 Message-ID: <20250606041029.614348-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250606041029.614348-1-masahiroy@kernel.org> References: <20250606041029.614348-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Keep the .modinfo section during linking, but strip it from the final vmlinux. Adjust scripts/mksysmap to exclude modinfo symbols from kallsyms. This change will allow the next commit to extract the .modinfo section from the vmlinux.unstripped intermediate. Signed-off-by: Masahiro Yamada --- include/asm-generic/vmlinux.lds.h | 2 +- scripts/Makefile.vmlinux | 2 +- scripts/mksysmap | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinu= x.lds.h index 58a635a6d5bd..ce292ae70a93 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -830,6 +830,7 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELL= ER_CLANG) =20 /* Required sections not related to debugging. */ #define ELF_DETAILS \ + .modinfo : { *(.modinfo) } \ .comment 0 : { *(.comment) } \ .symtab 0 : { *(.symtab) } \ .strtab 0 : { *(.strtab) } \ @@ -1043,7 +1044,6 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPE= LLER_CLANG) *(.discard.*) \ *(.export_symbol) \ *(.no_trim_symbol) \ - *(.modinfo) \ /* ld.bfd warns about .gnu.version* even when not emitted */ \ *(.gnu.version*) \ =20 diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux index 4f2d4c3fb737..e2ceeb9e168d 100644 --- a/scripts/Makefile.vmlinux +++ b/scripts/Makefile.vmlinux @@ -86,7 +86,7 @@ endif # vmlinux # ------------------------------------------------------------------------= --- =20 -remove-section-y :=3D +remove-section-y :=3D .modinfo remove-section-$(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS) +=3D '.rel*' =20 quiet_cmd_strip_relocs =3D OBJCOPY $@ diff --git a/scripts/mksysmap b/scripts/mksysmap index 3accbdb269ac..a607a0059d11 100755 --- a/scripts/mksysmap +++ b/scripts/mksysmap @@ -79,6 +79,9 @@ / _SDA_BASE_$/d / _SDA2_BASE_$/d =20 +# MODULE_INFO() +/ __UNIQUE_ID_modinfo[0-9]*$/d + # ------------------------------------------------------------------------= --- # Ignored patterns # (symbols that contain the pattern are ignored) --=20 2.43.0 From nobody Fri Dec 19 00:03:21 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2735E1E98E3; Fri, 6 Jun 2025 04:11:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749183069; cv=none; b=t1K7SRK+7w59fIDWzSChm8vL9Bq/3EQJySKdZ5rIlomTsUydhfSYPA5ZO5i+2z9JYo2LdlNdC8Bg5upkOe4vmQhQYW0cYFy5pVFtzgnwHTnZmGNJVE1DuA9HAztbeCHxRhkuJRrAfRWsvT5TW3eZs50BC5D2mwdQCXBKegWV0L4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749183069; c=relaxed/simple; bh=UJ3B2wGZA1eu/Vs9p/nH/qeqQ3tcNsCm21mmvFo5xrI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qOGpKgcyOYkxxRYyvKxtD1vyNmHS6Ak4nlFBOPD9VQrOXxC91RB10cHPufVGvh688xK7cLHMHNugk34sKqRIObM1owS66xJxbn1z6pplFhawJsgP1b2Wugu/dJoqHGgc+gSccsxwBr8ojDXx7FpU975ASbYz14GL33B3A0G9g6o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Fl3A9eDS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Fl3A9eDS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92689C4CEEF; Fri, 6 Jun 2025 04:11:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1749183069; bh=UJ3B2wGZA1eu/Vs9p/nH/qeqQ3tcNsCm21mmvFo5xrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fl3A9eDSvxErtEYU5DD6xiFELSbvVuf40GV0RQPquknJCOSoWaIQjjsWKuR6C8B7w L3c1krItHKDkS/mLN4wIHk0MHGFIJ+fEHHthE4V7u47o5dK8gR2jKX06nUt3F111DM gZ0MPZwgRyDCxBC+XygLCZufMmPFEkoQprCJP1vdB4UEuk/LrqfRBQh6VzjCfuR99+ QzeH/DxAjqq3C46ew3CmmNWb9XXLZVCrq+g2J/7fueoL1aruI8EtC298VkfWN8921R TaWMTLZflvIKBsdvv/jfWO1bDgGcpDttLLQ1yFdlanCoY56/eroTGf5uwKLWMJefwu B/o+tvPKDa9eA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Petr Pavlu , Alexey Gladkov , Ard Biesheuvel , Nathan Chancellor , Nicolas Schier , linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 4/4] kbuild: extract modules.builtin.modinfo from vmlinux.unstripped Date: Fri, 6 Jun 2025 13:10:26 +0900 Message-ID: <20250606041029.614348-5-masahiroy@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250606041029.614348-1-masahiroy@kernel.org> References: <20250606041029.614348-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently, we assume all the data for modules.builtin.modinfo are available in vmlinux.o. This makes it impossible for modpost, which is invoked after vmlinux.o, to add additional module info. This commit moves the modules.builtin.modinfo rule after modpost. Signed-off-by: Masahiro Yamada --- scripts/Makefile.vmlinux | 28 +++++++++++++++++++++++++++- scripts/Makefile.vmlinux_o | 26 +------------------------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux index e2ceeb9e168d..45597068f11f 100644 --- a/scripts/Makefile.vmlinux +++ b/scripts/Makefile.vmlinux @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only =20 PHONY :=3D __default -__default: vmlinux +__default: =20 include include/config/auto.conf include $(srctree)/scripts/Kbuild.include @@ -96,6 +96,32 @@ targets +=3D vmlinux vmlinux: vmlinux.unstripped FORCE $(call if_changed,strip_relocs) =20 +# modules.builtin.modinfo +# ------------------------------------------------------------------------= --- + +OBJCOPYFLAGS_modules.builtin.modinfo :=3D -j .modinfo -O binary + +targets +=3D modules.builtin.modinfo +modules.builtin.modinfo: vmlinux.unstripped FORCE + $(call if_changed,objcopy) + +# modules.builtin +# ------------------------------------------------------------------------= --- + +__default: modules.builtin + +# The second line aids cases where multiple modules share the same object. + +quiet_cmd_modules_builtin =3D GEN $@ + cmd_modules_builtin =3D \ + tr '\0' '\n' < $< | \ + sed -n 's/^[[:alnum:]:_]*\.file=3D//p' | \ + tr ' ' '\n' | uniq | sed -e 's:^:kernel/:' -e 's/$$/.ko/' > $@ + +targets +=3D modules.builtin +modules.builtin: modules.builtin.modinfo FORCE + $(call if_changed,modules_builtin) + # modules.builtin.ranges # ------------------------------------------------------------------------= --- ifdef CONFIG_BUILTIN_MODULE_RANGES diff --git a/scripts/Makefile.vmlinux_o b/scripts/Makefile.vmlinux_o index b024ffb3e201..23c8751285d7 100644 --- a/scripts/Makefile.vmlinux_o +++ b/scripts/Makefile.vmlinux_o @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only =20 PHONY :=3D __default -__default: vmlinux.o modules.builtin.modinfo modules.builtin +__default: vmlinux.o =20 include include/config/auto.conf include $(srctree)/scripts/Kbuild.include @@ -73,30 +73,6 @@ vmlinux.o: $(initcalls-lds) vmlinux.a $(KBUILD_VMLINUX_L= IBS) FORCE =20 targets +=3D vmlinux.o =20 -# modules.builtin.modinfo -# ------------------------------------------------------------------------= --- - -OBJCOPYFLAGS_modules.builtin.modinfo :=3D -j .modinfo -O binary - -targets +=3D modules.builtin.modinfo -modules.builtin.modinfo: vmlinux.o FORCE - $(call if_changed,objcopy) - -# modules.builtin -# ------------------------------------------------------------------------= --- - -# The second line aids cases where multiple modules share the same object. - -quiet_cmd_modules_builtin =3D GEN $@ - cmd_modules_builtin =3D \ - tr '\0' '\n' < $< | \ - sed -n 's/^[[:alnum:]:_]*\.file=3D//p' | \ - tr ' ' '\n' | uniq | sed -e 's:^:kernel/:' -e 's/$$/.ko/' > $@ - -targets +=3D modules.builtin -modules.builtin: modules.builtin.modinfo FORCE - $(call if_changed,modules_builtin) - # Add FORCE to the prerequisites of a target to force it to be always rebu= ilt. # ------------------------------------------------------------------------= --- =20 --=20 2.43.0