Skip to contentSkip to conversation

Add generated modalias to modules.builtin.modinfo

PATCH Superseded Alexey Gladkov 6 participants 20 messages Jul 24, 2025 – Jul 29, 2025

Subsystems (15)
Networking SCSI Kbuild GPIO +11 more subsystems

v5 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v5 cover Add generated modalias to modules.builtin.modinfo

The modules.builtin.modinfo file is used by userspace (kmod to be specific) to get information about builtin modules. Among other information about the module, information about module aliases is stored. This is very important to determine that a particular modalias will be handled by a module that is inside the kernel.

There are several mechanisms for creating modalias for modules:

The first is to explicitly specify the MODULE_ALIAS of the macro. In this case, the aliases go into the '.modinfo' section of the module if it is compiled separately or into vmlinux.o if it is builtin into the kernel.

The second is the use of MODULE_DEVICE_TABLE followed by the use of the modpost utility. In this case, vmlinux.o no longer has this information and does not get it into modules.builtin.modinfo.

For example:

$ modinfo pci:v00008086d0000A36Dsv00001043sd00008694bc0Csc03i30
modinfo: ERROR: Module pci:v00008086d0000A36Dsv00001043sd00008694bc0Csc03i30 not found.
$ modinfo xhci_pci
name:           xhci_pci
filename:       (builtin)
license:        GPL
file:           drivers/usb/host/xhci-pci
description:    xHCI PCI Host Controller Driver

The builtin module is missing alias "pci:v*d*sv*sd*bc0Csc03i30*" which will be generated by modpost if the module is built separately.

To fix this it is necessary to add the generated by modpost modalias to modules.builtin.modinfo. Fortunately modpost already generates .vmlinux.export.c for exported symbols. It is possible to add .modinfo for builtin modules and modify the build system so that .modinfo section is extracted from the intermediate vmlinux after modpost is executed.

---
Notes:
- v5:
* Rebase to v6.16-rc6-281-gf4a40a4282f4 to pick up the fixes made by Masahiro Yamada.
* Attempt to fix linker warning on s390.
* Fix typo in pinctrl/meson found by the kernel test robot.
* v4: https://lore.kernel.org/all/[email protected]/

- v4:
* Rework the patchset based on top of Masahiro Yamada's patches.
* Add removal of unnecessary __mod_device_table__* symbols to avoid symbol table growth in vmlinux.
* rust code takes into account changes in __mod_device_table__*.
* v3: https://lore.kernel.org/all/[email protected]/

- v3:
* Add Reviewed-by tag to patches from Petr Pavlu.
* Rebase to v6.15.
* v2: https://lore.kernel.org/all/[email protected]/

- v2:
* Drop patch for mfd because it was already applied and is in linux-next.
* The generation of aliases for builtin modules has been redone as suggested by Masahiro Yamada.
* Rebase to v6.15-rc5-136-g9c69f8884904
* v1: https://lore.kernel.org/all/[email protected]/

Alexey Gladkov (6):
scsi: Always define blogic_pci_tbl structure
pinctrl: meson: Fix typo in device table macro
modpost: Add modname to mod_device_table alias
modpost: Create modalias for builtin modules
kbuild: vmlinux.unstripped should always depend on .vmlinux.export.o
s390: vmlinux.lds.S: Reorder sections

Masahiro Yamada (4):
module: remove meaningless 'name' parameter from __MODULE_INFO()
kbuild: always create intermediate vmlinux.unstripped
kbuild: keep .modinfo section in vmlinux.unstripped
kbuild: extract modules.builtin.modinfo from vmlinux.unstripped

 arch/s390/kernel/vmlinux.lds.S             | 10 +--
 drivers/pinctrl/meson/pinctrl-amlogic-a4.c |  2 +-
 drivers/scsi/BusLogic.c                    |  2 -
 include/asm-generic/vmlinux.lds.h          |  2 +-
 include/crypto/algapi.h                    |  4 +-
 include/linux/module.h                     | 21 +++---
 include/linux/moduleparam.h                |  9 +--
 include/net/tcp.h                          |  4 +-
 rust/kernel/device_id.rs                   |  8 +--
 scripts/Makefile.vmlinux                   | 77 ++++++++++++++--------
 scripts/Makefile.vmlinux_o                 | 26 +-------
 scripts/link-vmlinux.sh                    |  5 +-
 scripts/mksysmap                           |  6 ++
 scripts/mod/file2alias.c                   | 34 ++++++++--
 scripts/mod/modpost.c                      | 17 ++++-
 scripts/mod/modpost.h                      |  2 +
 16 files changed, 139 insertions(+), 90 deletions(-)

base-commit: f4a40a4282f467ec99745c6ba62cb84346e42139

Signature · 1 line
2.50.1
#1 lore raw

PATCH v5 1/10 module: remove meaningless 'name' parameter from __MODULE_INFO()

From: Masahiro Yamada <[email protected]>

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
Cc Herbert Xu <[email protected]>
Cc "David S. Miller" <[email protected]>
---
 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(-)
include/crypto/algapi.h +2 -2
index 188eface0a11..fc4574940636 100644
@@ -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)
 
 struct crypto_aead;
 struct crypto_instance;
include/linux/module.h +0 -3
index 5faa1fb1f4b4..4689852d7b18 100644
@@ -164,9 +164,6 @@ extern void cleanup_module(void);
 
 struct module_kobject *lookup_or_create_module_kobject(const char *name);
 
-/* Generic info of form tag = "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)
 
include/linux/moduleparam.h +5 -4
index bfb85fd13e1f..00166f747e27 100644
@@ -20,18 +20,19 @@
 /* Chosen so that structs with an unsigned long line up. */
 #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long))
 
-#define __MODULE_INFO(tag, name, info)					  \
-	static const char __UNIQUE_ID(name)[]				  \
+/* Generic info of form tag = "info" */
+#define MODULE_INFO(tag, info)					  \
+	static const char __UNIQUE_ID(modinfo)[]			  \
 		__used __section(".modinfo") __aligned(1)		  \
 		= __MODULE_INFO_PREFIX __stringify(tag) "=" info
 
 #define __MODULE_PARM_TYPE(name, _type)					  \
-	__MODULE_INFO(parmtype, name##type, #name ":" _type)
+	MODULE_INFO(parmtype, #name ":" _type)
 
 /* 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)
 
 struct kernel_param;
 
include/net/tcp.h +2 -2
index 5078ad868fee..9b39ef630c92 100644
@@ -2662,8 +2662,8 @@ void tcp_update_ulp(struct sock *sk, struct proto *p,
 		    void (*write_space)(struct sock *sk));
 
 #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)
 
 #ifdef CONFIG_NET_SOCK_MSG
 struct sk_msg;
Signature · 1 line
2.50.1
#2 lore raw

PATCH v5 2/10 kbuild: always create intermediate vmlinux.unstripped

In reply to Alexey Gladkov

From: Masahiro Yamada <[email protected]>

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.

---
 scripts/Makefile.vmlinux | 45 ++++++++++++++++++++--------------------
 1 file changed, 22 insertions(+), 23 deletions(-)
scripts/Makefile.vmlinux +22 -23
index b64862dc6f08..4f2d4c3fb737 100644
@@ -9,20 +9,6 @@ include $(srctree)/scripts/Makefile.lib
 
 targets :=
 
-ifdef CONFIG_ARCH_VMLINUX_NEEDS_RELOCS
-vmlinux-final := vmlinux.unstripped
-
-quiet_cmd_strip_relocs = RSTRIP  $@
-      cmd_strip_relocs = $(OBJCOPY) --remove-section='.rel*' --remove-section=!'.rel*.dyn' $< $@
-
-vmlinux: $(vmlinux-final) FORCE
-	$(call if_changed,strip_relocs)
-
-targets += vmlinux
-else
-vmlinux-final := vmlinux
-endif
-
 %.o: %.c FORCE
 	$(call if_changed_rule,cc_o_c)
 
@@ -61,19 +47,19 @@ targets += .builtin-dtbs-list
 
 ifdef CONFIG_GENERIC_BUILTIN_DTB
 targets += .builtin-dtbs.S .builtin-dtbs.o
-$(vmlinux-final): .builtin-dtbs.o
+vmlinux.unstripped: .builtin-dtbs.o
 endif
 
-# vmlinux
+# vmlinux.unstripped
 # ---------------------------------------------------------------------------
 
 ifdef CONFIG_MODULES
 targets += .vmlinux.export.o
-$(vmlinux-final): .vmlinux.export.o
+vmlinux.unstripped: .vmlinux.export.o
 endif
 
 ifdef CONFIG_ARCH_WANTS_PRE_LINK_VMLINUX
-$(vmlinux-final): arch/$(SRCARCH)/tools/vmlinux.arch.o
+vmlinux.unstripped: arch/$(SRCARCH)/tools/vmlinux.arch.o
 
 arch/$(SRCARCH)/tools/vmlinux.arch.o: vmlinux.o FORCE
 	$(Q)$(MAKE) $(build)=arch/$(SRCARCH)/tools $@
@@ -86,17 +72,30 @@ cmd_link_vmlinux =							\
 	$< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)" "$@";	\
 	$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
 
-targets += $(vmlinux-final)
-$(vmlinux-final): scripts/link-vmlinux.sh vmlinux.o $(KBUILD_LDS) FORCE
+targets += 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
 
 ifdef CONFIG_BUILDTIME_TABLE_SORT
-$(vmlinux-final): scripts/sorttable
+vmlinux.unstripped: scripts/sorttable
 endif
 
+# vmlinux
+# ---------------------------------------------------------------------------
+
+remove-section-y                                   :=
+remove-section-$(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS) += '.rel*'
+
+quiet_cmd_strip_relocs = OBJCOPY $@
+      cmd_strip_relocs = $(OBJCOPY) $(addprefix --remove-section=,$(remove-section-y)) $< $@
+
+targets += 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_builtin_ranges.awk \
 			modules.builtin vmlinux.map vmlinux.o.map FORCE
 	$(call if_changed,modules_builtin_ranges)
 
-vmlinux.map: $(vmlinux-final)
+vmlinux.map: vmlinux.unstripped
 	@:
 
 endif
Signature · 1 line
2.50.1
#3 lore raw

PATCH v5 3/10 kbuild: keep .modinfo section in vmlinux.unstripped

In reply to Alexey Gladkov

From: Masahiro Yamada <[email protected]>

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.

---
 include/asm-generic/vmlinux.lds.h | 2 +-
 scripts/Makefile.vmlinux          | 2 +-
 scripts/mksysmap                  | 3 +++
 3 files changed, 5 insertions(+), 2 deletions(-)
include/asm-generic/vmlinux.lds.h +1 -1
index fa5f19b8d53a..1791665006f9 100644
@@ -831,6 +831,7 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG)
 
 /* Required sections not related to debugging. */
 #define ELF_DETAILS							\
+		.modinfo : { *(.modinfo) }				\
 		.comment 0 : { *(.comment) }				\
 		.symtab 0 : { *(.symtab) }				\
 		.strtab 0 : { *(.strtab) }				\
@@ -1044,7 +1045,6 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG)
 	*(.discard.*)							\
 	*(.export_symbol)						\
 	*(.no_trim_symbol)						\
-	*(.modinfo)							\
 	/* ld.bfd warns about .gnu.version* even when not emitted */	\
 	*(.gnu.version*)						\
 
scripts/Makefile.vmlinux +1 -1
index 4f2d4c3fb737..e2ceeb9e168d 100644
@@ -86,7 +86,7 @@ endif
 # vmlinux
 # ---------------------------------------------------------------------------
 
-remove-section-y                                   :=
+remove-section-y                                   := .modinfo
 remove-section-$(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS) += '.rel*'
 
 quiet_cmd_strip_relocs = OBJCOPY $@
scripts/mksysmap +3 -0
index 3accbdb269ac..a607a0059d11 100755
@@ -79,6 +79,9 @@
 / _SDA_BASE_$/d
 / _SDA2_BASE_$/d
 
+# MODULE_INFO()
+/ __UNIQUE_ID_modinfo[0-9]*$/d
+
 # ---------------------------------------------------------------------------
 # Ignored patterns
 #  (symbols that contain the pattern are ignored)
Signature · 1 line
2.50.1
#4 lore raw

Re: [PATCH v5 03/10] kbuild: keep .modinfo section in vmlinux.unstripped

On Thu, Jul 24, 2025 at 03:49:40PM +0200, Alexey Gladkov wrote:

Hi Alexey, Masahiro,

Quoted 22 lines

From: Masahiro Yamada <[email protected]>

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.

---
 include/asm-generic/vmlinux.lds.h | 2 +-
 scripts/Makefile.vmlinux          | 2 +-
 scripts/mksysmap                  | 3 +++
 3 files changed, 5 insertions(+), 2 deletions(-)
include/asm-generic/vmlinux.lds.h +0 -0
index fa5f19b8d53a..1791665006f9 100644

include/asm-generic/vmlinux.lds.h defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG) · line 834

Quoted 4 lines
include/asm-generic/vmlinux.lds.h +1 -0
@@ -831,6 +831,7 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG)
 
 /* Required sections not related to debugging. */
 #define ELF_DETAILS							\
+		.modinfo : { *(.modinfo) }				\

FWIW, to me .modinfo logically does not quite belong to ELF_DETAILS, since it is not about ELF.

I would guess, that you want to make a minimal code impact to the linker scripts, but with that you turn .modinfo the only section among ones that do not make it to the final image:

STABS_DEBUG
DWARF_DEBUG
ELF_DETAILS

That immediately breaks s390, but also is a call for trouble in the future, as far as I am concerned.

Would it makes sense to introduce e.g MODINFO instead?

include/asm-generic/vmlinux.lds.h defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG) · line 1049

Quoted 10 lines
include/asm-generic/vmlinux.lds.h +0 -1
 		.comment 0 : { *(.comment) }				\
 		.symtab 0 : { *(.symtab) }				\
 		.strtab 0 : { *(.strtab) }				\
@@ -1044,7 +1045,6 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG)
 	*(.discard.*)							\
 	*(.export_symbol)						\
 	*(.no_trim_symbol)						\
-	*(.modinfo)							\
 	/* ld.bfd warns about .gnu.version* even when not emitted */	\
 	*(.gnu.version*)						\

Thanks!

#5 lore raw

Re: [PATCH v5 03/10] kbuild: keep .modinfo section in vmlinux.unstripped

Quoted 27 lines · Alexander Gordeev

On Thu, Jul 24, 2025 at 03:49:40PM +0200, Alexey Gladkov wrote:

Hi Alexey, Masahiro,

Quoted 23 lines

From: Masahiro Yamada <[email protected]>

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.

---
 include/asm-generic/vmlinux.lds.h | 2 +-
 scripts/Makefile.vmlinux          | 2 +-
 scripts/mksysmap                  | 3 +++
 3 files changed, 5 insertions(+), 2 deletions(-)
include/asm-generic/vmlinux.lds.h +0 -0
index fa5f19b8d53a..1791665006f9 100644
@@ -831,6 +831,7 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG)
 
Quoted 6 lines

include/asm-generic/vmlinux.lds.h defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG) · line 834

Quoted 3 lines
include/asm-generic/vmlinux.lds.h +1 -0
 /* Required sections not related to debugging. */
 #define ELF_DETAILS							\
+		.modinfo : { *(.modinfo) }				\

FWIW, to me .modinfo logically does not quite belong to ELF_DETAILS, since it is not about ELF.

The macro name ELF_DETAILS is rather unfortunate. The description says that these sections are not related to debugging.

Quoted 4 lines

I would guess, that you want to make a minimal code impact to the linker scripts, but with that you turn .modinfo the only section among ones that do not make it to the final image:

Quoted 8 lines

STABS_DEBUG
DWARF_DEBUG
ELF_DETAILS

That immediately breaks s390, but also is a call for trouble in the future, as far as I am concerned.

Would it makes sense to introduce e.g MODINFO instead?

This will require patching all architectures to add MODINFO. This will have a significant code impact. To avoid this, .modinfo was added to ELF_DETAILS.

Quoted 13 lines

include/asm-generic/vmlinux.lds.h defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG) · line 1049

Quoted 10 lines
include/asm-generic/vmlinux.lds.h +0 -1
 		.comment 0 : { *(.comment) }				\
 		.symtab 0 : { *(.symtab) }				\
 		.strtab 0 : { *(.strtab) }				\
@@ -1044,7 +1045,6 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG)
 	*(.discard.*)							\
 	*(.export_symbol)						\
 	*(.no_trim_symbol)						\
-	*(.modinfo)							\
 	/* ld.bfd warns about .gnu.version* even when not emitted */	\
 	*(.gnu.version*)						\

Thanks!

Signature · 1 line
Rgrds, legion
#6 lore raw

Re: [PATCH v5 03/10] kbuild: keep .modinfo section in vmlinux.unstripped

In reply to Alexander Gordeev
Quoted 39 lines · Alexander Gordeev

On Thu, Jul 24, 2025 at 03:49:40PM +0200, Alexey Gladkov wrote:

Hi Alexey, Masahiro,

Quoted 22 lines

From: Masahiro Yamada <[email protected]>

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.

---
 include/asm-generic/vmlinux.lds.h | 2 +-
 scripts/Makefile.vmlinux          | 2 +-
 scripts/mksysmap                  | 3 +++
 3 files changed, 5 insertions(+), 2 deletions(-)
include/asm-generic/vmlinux.lds.h +0 -0
index fa5f19b8d53a..1791665006f9 100644

include/asm-generic/vmlinux.lds.h defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG) · line 834

Quoted 4 lines
include/asm-generic/vmlinux.lds.h +1 -0
@@ -831,6 +831,7 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG)
 
 /* Required sections not related to debugging. */
 #define ELF_DETAILS                                                  \
+             .modinfo : { *(.modinfo) }                              \

FWIW, to me .modinfo logically does not quite belong to ELF_DETAILS, since it is not about ELF.

I would guess, that you want to make a minimal code impact to the linker scripts, but with that you turn .modinfo the only section among ones that do not make it to the final image:

Quoted 8 lines

STABS_DEBUG
DWARF_DEBUG
ELF_DETAILS

That immediately breaks s390, but also is a call for trouble in the future, as far as I am concerned.

Would it makes sense to introduce e.g MODINFO instead?

I am open to MODINFO addition, if Alexey is happy about modifying linker scripts for all arches.
Yeah, it is tedious, though...

Quoted 13 lines

include/asm-generic/vmlinux.lds.h defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG) · line 1049

Quoted 11 lines
include/asm-generic/vmlinux.lds.h +0 -1
              .comment 0 : { *(.comment) }                            \
              .symtab 0 : { *(.symtab) }                              \
              .strtab 0 : { *(.strtab) }                              \
@@ -1044,7 +1045,6 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG)
      *(.discard.*)                                                   \
      *(.export_symbol)                                               \
      *(.no_trim_symbol)                                              \
-     *(.modinfo)                                                     \
      /* ld.bfd warns about .gnu.version* even when not emitted */    \
      *(.gnu.version*)                                                \

Thanks!

Signature · 2 lines
Best Regards
Masahiro Yamada
#7 lore raw

PATCH v5 4/10 kbuild: extract modules.builtin.modinfo from vmlinux.unstripped

In reply to Alexey Gladkov

From: Masahiro Yamada <[email protected]>

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.

---
 scripts/Makefile.vmlinux   | 26 ++++++++++++++++++++++++++
 scripts/Makefile.vmlinux_o | 26 +-------------------------
 2 files changed, 27 insertions(+), 25 deletions(-)
scripts/Makefile.vmlinux +26 -0
index e2ceeb9e168d..fdab5aa90215 100644
@@ -96,6 +96,32 @@ targets += vmlinux
 vmlinux: vmlinux.unstripped FORCE
 	$(call if_changed,strip_relocs)
 
+# modules.builtin.modinfo
+# ---------------------------------------------------------------------------
+
+OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary
+
+targets += 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 = GEN     $@
+      cmd_modules_builtin = \
+	tr '\0' '\n' < $< | \
+	sed -n 's/^[[:alnum:]:_]*\.file=//p' | \
+	tr ' ' '\n' | uniq | sed -e 's:^:kernel/:' -e 's/$$/.ko/' > $@
+
+targets += modules.builtin
+modules.builtin: modules.builtin.modinfo FORCE
+	$(call if_changed,modules_builtin)
+
 # modules.builtin.ranges
 # ---------------------------------------------------------------------------
 ifdef CONFIG_BUILTIN_MODULE_RANGES
scripts/Makefile.vmlinux_o +1 -25
index b024ffb3e201..23c8751285d7 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
 PHONY := __default
-__default: vmlinux.o modules.builtin.modinfo modules.builtin
+__default: vmlinux.o
 
 include include/config/auto.conf
 include $(srctree)/scripts/Kbuild.include
@@ -73,30 +73,6 @@ vmlinux.o: $(initcalls-lds) vmlinux.a $(KBUILD_VMLINUX_LIBS) FORCE
 
 targets += vmlinux.o
 
-# modules.builtin.modinfo
-# ---------------------------------------------------------------------------
-
-OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary
-
-targets += 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 = GEN     $@
-      cmd_modules_builtin = \
-	tr '\0' '\n' < $< | \
-	sed -n 's/^[[:alnum:]:_]*\.file=//p' | \
-	tr ' ' '\n' | uniq | sed -e 's:^:kernel/:' -e 's/$$/.ko/' > $@
-
-targets += 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 rebuilt.
 # ---------------------------------------------------------------------------
 
Signature · 1 line
2.50.1
#8 lore raw

PATCH v5 5/10 scsi: Always define blogic_pci_tbl structure

In reply to Alexey Gladkov

The blogic_pci_tbl structure is used by the MODULE_DEVICE_TABLE macro. There is no longer a need to protect it with the MODULE condition, since this no longer causes the compiler to warn about an unused variable.

---
 drivers/scsi/BusLogic.c | 2 --
 1 file changed, 2 deletions(-)
drivers/scsi/BusLogic.c +0 -2
index 1f100270cd38..08e12a3d6703 100644
@@ -3715,7 +3715,6 @@ static void __exit blogic_exit(void)
 
 __setup("BusLogic=", blogic_setup);
 
-#ifdef MODULE
 /*static const struct pci_device_id blogic_pci_tbl[] = {
 	{ PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER,
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
@@ -3731,7 +3730,6 @@ static const struct pci_device_id blogic_pci_tbl[] = {
 	{PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT)},
 	{0, },
 };
-#endif
 MODULE_DEVICE_TABLE(pci, blogic_pci_tbl);
 
 module_init(blogic_init);
Signature · 1 line
2.50.1
#9 lore raw

PATCH v5 6/10 pinctrl: meson: Fix typo in device table macro

In reply to Alexey Gladkov

The typo when using the MODULE_DEVICE_TABLE macro was not noticeable because the macro was defined only if the module was built as a separate module.

---
 drivers/pinctrl/meson/pinctrl-amlogic-a4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/meson/pinctrl-amlogic-a4.c +1 -1
index 385cc619df13..95525e66e5c0 100644
@@ -1023,7 +1023,7 @@ static const struct of_device_id aml_pctl_of_match[] = {
 	{ .compatible = "amlogic,pinctrl-a4", },
 	{ /* sentinel */ }
 };
-MODULE_DEVICE_TABLE(of, aml_pctl_dt_match);
+MODULE_DEVICE_TABLE(of, aml_pctl_of_match);
 
 static struct platform_driver aml_pctl_driver = {
 	.driver = {
Signature · 1 line
2.50.1
maintainer Reviewed-by on v5 6/10
#10 lore raw

Re: [PATCH v5 06/10] pinctrl: meson: Fix typo in device table macro

Quoted 22 lines · Alexey Gladkov

The typo when using the MODULE_DEVICE_TABLE macro was not noticeable because the macro was defined only if the module was built as a separate module.

---
  drivers/pinctrl/meson/pinctrl-amlogic-a4.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/meson/pinctrl-amlogic-a4.c +0 -0
index 385cc619df13..95525e66e5c0 100644

drivers/pinctrl/meson/pinctrl-amlogic-a4.c static const struct of_device_id aml_pctl_of_match[] = { · line 1029

Quoted 8 lines
drivers/pinctrl/meson/pinctrl-amlogic-a4.c +1 -1
@@ -1023,7 +1023,7 @@ static const struct of_device_id aml_pctl_of_match[] = {
  	{ .compatible = "amlogic,pinctrl-a4", },
  	{ /* sentinel */ }
  };
-MODULE_DEVICE_TABLE(of, aml_pctl_dt_match);
+MODULE_DEVICE_TABLE(of, aml_pctl_of_match);
 
  static struct platform_driver aml_pctl_driver = {
  	.driver = {
#11 lore raw

PATCH v5 7/10 modpost: Add modname to mod_device_table alias

In reply to Alexey Gladkov

At this point, if a symbol is compiled as part of the kernel, information about which module the symbol belongs to is lost.

To save this it is possible to add the module name to the alias name. It's not very pretty, but it's possible for now.

---
 include/linux/module.h   | 14 +++++++++++++-
 rust/kernel/device_id.rs |  8 ++++----
 scripts/mod/file2alias.c | 18 ++++++++++++++----
 3 files changed, 31 insertions(+), 9 deletions(-)
include/linux/module.h +13 -1
index 4689852d7b18..32e98200b2f4 100644
@@ -243,10 +243,22 @@ struct module_kobject *lookup_or_create_module_kobject(const char *name);
 /* What your module does. */
 #define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description)
 
+/*
+ * Format: __mod_device_table__kmod_<modname>__<type>__<name>
+ * Parts of the string `__kmod_` and `__` are used as delimiters when parsing
+ * a symbol in file2alias.c
+ */
+#define __mod_device_table(type, name)	\
+	__PASTE(__mod_device_table__,	\
+	__PASTE(__KBUILD_MODNAME,	\
+	__PASTE(__,			\
+	__PASTE(type,			\
+	__PASTE(__, name)))))
+
 #ifdef MODULE
 /* Creates an alias so file2alias.c can find device table. */
 #define MODULE_DEVICE_TABLE(type, name)					\
-static typeof(name) __mod_device_table__##type##__##name		\
+static typeof(name) __mod_device_table(type, name)			\
   __attribute__ ((used, alias(__stringify(name))))
 #else  /* !MODULE */
 #define MODULE_DEVICE_TABLE(type, name)
rust/kernel/device_id.rs +4 -4
index 0a4eb56d98f2..365d8f544844 100644
@@ -154,10 +154,10 @@ macro_rules! module_device_table {
     ($table_type: literal, $module_table_name:ident, $table_name:ident) => {
         #[rustfmt::skip]
         #[export_name =
-            concat!("__mod_device_table__", $table_type,
-                    "__", module_path!(),
-                    "_", line!(),
-                    "_", stringify!($table_name))
+            concat!("__mod_device_table__", line!(),
+                    "__kmod_", module_path!(),
+                    "__", $table_type,
+                    "__", stringify!($table_name))
         ]
         static $module_table_name: [::core::mem::MaybeUninit<u8>; $table_name.raw_ids().size()] =
             unsafe { ::core::mem::transmute_copy($table_name.raw_ids()) };
scripts/mod/file2alias.c +14 -4
index 00586119a25b..13021266a18f 100644
@@ -1476,8 +1476,8 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
 {
 	void *symval;
 	char *zeros = NULL;
-	const char *type, *name;
-	size_t typelen;
+	const char *type, *name, *modname;
+	size_t typelen, modnamelen;
 	static const char *prefix = "__mod_device_table__";
 
 	/* We're looking for a section relative symbol */
@@ -1488,10 +1488,20 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
 	if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT)
 		return;
 
-	/* All our symbols are of form __mod_device_table__<type>__<name>. */
+	/* All our symbols are of form __mod_device_table__kmod_<modname>__<type>__<name>. */
 	if (!strstarts(symname, prefix))
 		return;
-	type = symname + strlen(prefix);
+
+	modname = strstr(symname, "__kmod_");
+	if (!modname)
+		return;
+	modname += strlen("__kmod_");
+
+	type = strstr(modname, "__");
+	if (!type)
+		return;
+	modnamelen = type - modname;
+	type += strlen("__");
 
 	name = strstr(type, "__");
 	if (!name)
Signature · 1 line
2.50.1
#12 lore raw

Re: [PATCH v5 07/10] modpost: Add modname to mod_device_table alias

Quoted 8 lines · Alexey Gladkov

At this point, if a symbol is compiled as part of the kernel, information about which module the symbol belongs to is lost.

To save this it is possible to add the module name to the alias name. It's not very pretty, but it's possible for now.

Cc Miguel Ojeda <[email protected]>

Thanks for the ping -- Cc'ing as well Andreas who is working on module bits lately (but is away right now) and Danilo who maintains the modified file:

Cc Andreas Hindborg <[email protected]>
Cc Danilo Krummrich <[email protected]>

Cheers,
Miguel

#13 lore raw

PATCH v5 8/10 modpost: Create modalias for builtin modules

In reply to Alexey Gladkov

For some modules, modalias is generated using the modpost utility and the section is added to the module file.

When a module is added inside vmlinux, modpost does not generate modalias for such modules and the information is lost.

As a result kmod (which uses modules.builtin.modinfo in userspace) cannot determine that modalias is handled by a builtin kernel module.

$ cat /sys/devices/pci0000:00/0000:00:14.0/modalias
pci:v00008086d0000A36Dsv00001043sd00008694bc0Csc03i30
$ modinfo xhci_pci
name:           xhci_pci
filename:       (builtin)
license:        GPL
file:           drivers/usb/host/xhci-pci
description:    xHCI PCI Host Controller Driver

Missing modalias "pci:v*d*sv*sd*bc0Csc03i30*" which will be generated by modpost if the module is built separately.

To fix this it is necessary to generate the same modalias for vmlinux as for the individual modules. Fortunately '.vmlinux.export.o' is already generated from which '.modinfo' can be extracted in the same way as for vmlinux.o.

---
 include/linux/module.h   |  4 ----
 scripts/Makefile.vmlinux |  5 ++++-
 scripts/mksysmap         |  3 +++
 scripts/mod/file2alias.c | 16 ++++++++++++++++
 scripts/mod/modpost.c    | 17 ++++++++++++++++-
 scripts/mod/modpost.h    |  2 ++
 6 files changed, 41 insertions(+), 6 deletions(-)
include/linux/module.h +0 -4
index 32e98200b2f4..9a8b359a1016 100644
@@ -255,14 +255,10 @@ struct module_kobject *lookup_or_create_module_kobject(const char *name);
 	__PASTE(type,			\
 	__PASTE(__, name)))))
 
-#ifdef MODULE
 /* Creates an alias so file2alias.c can find device table. */
 #define MODULE_DEVICE_TABLE(type, name)					\
 static typeof(name) __mod_device_table(type, name)			\
   __attribute__ ((used, alias(__stringify(name))))
-#else  /* !MODULE */
-#define MODULE_DEVICE_TABLE(type, name)
-#endif
 
 /* Version of form [<epoch>:]<version>[-<extra-version>].
  * Or for CVS/RCS ID version, everything but the number is stripped.
scripts/Makefile.vmlinux +4 -1
index fdab5aa90215..fcc188d26ead 100644
@@ -89,8 +89,11 @@ endif
 remove-section-y                                   := .modinfo
 remove-section-$(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS) += '.rel*'
 
+remove-symbols := -w --strip-symbol='__mod_device_table__*'
+
 quiet_cmd_strip_relocs = OBJCOPY $@
-      cmd_strip_relocs = $(OBJCOPY) $(addprefix --remove-section=,$(remove-section-y)) $< $@
+      cmd_strip_relocs = $(OBJCOPY) $(addprefix --remove-section=,$(remove-section-y)) \
+                         $(remove-symbols) $< $@
 
 targets += vmlinux
 vmlinux: vmlinux.unstripped FORCE
scripts/mksysmap +3 -0
index a607a0059d11..c4531eacde20 100755
@@ -59,6 +59,9 @@
 # EXPORT_SYMBOL (namespace)
 / __kstrtabns_/d
 
+# MODULE_DEVICE_TABLE (symbol name)
+/ __mod_device_table__/d
+
 # ---------------------------------------------------------------------------
 # Ignored suffixes
 #  (do not forget '$' after each pattern)
scripts/mod/file2alias.c +16 -0
index 13021266a18f..7da9735e7ab3 100644
@@ -1527,5 +1527,21 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
 		}
 	}
 
+	if (mod->is_vmlinux) {
+		struct module_alias *alias;
+
+		/*
+		 * If this is vmlinux, record the name of the builtin module.
+		 * Traverse the linked list in the reverse order, and set the
+		 * builtin_modname unless it has already been set in the
+		 * previous call.
+		 */
+		list_for_each_entry_reverse(alias, &mod->aliases, node) {
+			if (alias->builtin_modname)
+				break;
+			alias->builtin_modname = xstrndup(modname, modnamelen);
+		}
+	}
+
 	free(zeros);
 }
scripts/mod/modpost.c +16 -1
index 5ca7c268294e..67f9cd76bdd2 100644
@@ -2067,11 +2067,26 @@ static void write_if_changed(struct buffer *b, const char *fname)
 static void write_vmlinux_export_c_file(struct module *mod)
 {
 	struct buffer buf = { };
+	struct module_alias *alias, *next;
 
 	buf_printf(&buf,
-		   "#include <linux/export-internal.h>\n");
+		   "#include <linux/export-internal.h>\n"
+		   "#include <linux/module.h>\n");
 
 	add_exported_symbols(&buf, mod);
+
+	buf_printf(&buf,
+		   "#undef __MODULE_INFO_PREFIX\n"
+		   "#define __MODULE_INFO_PREFIX\n");
+
+	list_for_each_entry_safe(alias, next, &mod->aliases, node) {
+		buf_printf(&buf, "MODULE_INFO(%s.alias, \"%s\");\n",
+			   alias->builtin_modname, alias->str);
+		list_del(&alias->node);
+		free(alias->builtin_modname);
+		free(alias);
+	}
+
 	write_if_changed(&buf, ".vmlinux.export.c");
 	free(buf.p);
 }
scripts/mod/modpost.h +2 -0
index 9133e4c3803f..2aecb8f25c87 100644
@@ -99,10 +99,12 @@ buf_write(struct buffer *buf, const char *s, int len);
  * struct module_alias - auto-generated MODULE_ALIAS()
  *
  * @node: linked to module::aliases
+ * @modname: name of the builtin module (only for vmlinux)
  * @str: a string for MODULE_ALIAS()
  */
 struct module_alias {
 	struct list_head node;
+	char *builtin_modname;
 	char str[];
 };
 
Signature · 1 line
2.50.1
#14 lore raw

PATCH v5 9/10 kbuild: vmlinux.unstripped should always depend on .vmlinux.export.o

In reply to Alexey Gladkov

Since .vmlinux.export.c is used to add generated by modpost modaliases for builtin modules the .vmlinux.export.o is no longer optional and should always be created. The generation of this file is not dependent on CONFIG_MODULES.

---
 scripts/Makefile.vmlinux | 9 ++-------
 scripts/link-vmlinux.sh  | 5 +----
 2 files changed, 3 insertions(+), 11 deletions(-)
scripts/Makefile.vmlinux +2 -7
index fcc188d26ead..dbbe3bf0cf23 100644
@@ -53,11 +53,6 @@ endif
 # vmlinux.unstripped
 # ---------------------------------------------------------------------------
 
-ifdef CONFIG_MODULES
-targets += .vmlinux.export.o
-vmlinux.unstripped: .vmlinux.export.o
-endif
-
 ifdef CONFIG_ARCH_WANTS_PRE_LINK_VMLINUX
 vmlinux.unstripped: arch/$(SRCARCH)/tools/vmlinux.arch.o
 
@@ -72,8 +67,8 @@ cmd_link_vmlinux =							\
 	$< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)" "$@";	\
 	$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
 
-targets += vmlinux.unstripped
-vmlinux.unstripped: scripts/link-vmlinux.sh vmlinux.o $(KBUILD_LDS) FORCE
+targets += vmlinux.unstripped .vmlinux.export.o
+vmlinux.unstripped: scripts/link-vmlinux.sh vmlinux.o .vmlinux.export.o $(KBUILD_LDS) FORCE
 	+$(call if_changed_dep,link_vmlinux)
 ifdef CONFIG_DEBUG_INFO_BTF
 vmlinux.unstripped: $(RESOLVE_BTFIDS)
scripts/link-vmlinux.sh +1 -4
index 51367c2bfc21..433849ff7529 100755
@@ -73,10 +73,7 @@ vmlinux_link()
 		objs="${objs} .builtin-dtbs.o"
 	fi
 
-	if is_enabled CONFIG_MODULES; then
-		objs="${objs} .vmlinux.export.o"
-	fi
-
+	objs="${objs} .vmlinux.export.o"
 	objs="${objs} init/version-timestamp.o"
 
 	if [ "${SRCARCH}" = "um" ]; then
Signature · 1 line
2.50.1
#15 lore raw

PATCH v5 10/10 s390: vmlinux.lds.S: Reorder sections

In reply to Alexey Gladkov

Reorder the sections to be placed in the default segment. The .vmlinux.info use :NONE to override the default segment and tell the linker to not put the section in any segment at all.

Quoted 3 lines
Quoted 3 lines

s390x-linux-ld: .tmp_vmlinux1: warning: allocated section `.modinfo' not in segment
s390x-linux-ld: .tmp_vmlinux2: warning: allocated section `.modinfo' not in segment
s390x-linux-ld: vmlinux.unstripped: warning: allocated section `.modinfo' not in segment

---
 arch/s390/kernel/vmlinux.lds.S | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
arch/s390/kernel/vmlinux.lds.S +5 -5
index ff1ddba96352..3f2f90e38808 100644
@@ -202,6 +202,11 @@ SECTIONS
 	. = ALIGN(PAGE_SIZE);
 	_end = . ;
 
+	/* Debugging sections.	*/
+	STABS_DEBUG
+	DWARF_DEBUG
+	ELF_DETAILS
+
 	/*
 	 * uncompressed image info used by the decompressor
 	 * it should match struct vmlinux_info
@@ -232,11 +237,6 @@ SECTIONS
 #endif
 	} :NONE
 
-	/* Debugging sections.	*/
-	STABS_DEBUG
-	DWARF_DEBUG
-	ELF_DETAILS
-
 	/*
 	 * Make sure that the .got.plt is either completely empty or it
 	 * contains only the three reserved double words.
Signature · 1 line
2.50.1
#16 lore raw

Re: [PATCH v5 10/10] s390: vmlinux.lds.S: Reorder sections

Quoted 8 lines · Alexey Gladkov

Reorder the sections to be placed in the default segment. The .vmlinux.info use :NONE to override the default segment and tell the linker to not put the section in any segment at all.

Quoted 3 lines
Quoted 3 lines

s390x-linux-ld: .tmp_vmlinux1: warning: allocated section `.modinfo' not in segment
s390x-linux-ld: .tmp_vmlinux2: warning: allocated section `.modinfo' not in segment
s390x-linux-ld: vmlinux.unstripped: warning: allocated section `.modinfo' not in segment

Thank you for root-causing!

Quoted 4 lines
Cc Heiko Carstens <[email protected]>
Cc Vasily Gorbik <[email protected]>
Cc Alexander Gordeev <[email protected]>

Hi s390 maintainers,
I need this patch for kbuild tree.
Ack is appreciated.

Quoted 38 lines
---
 arch/s390/kernel/vmlinux.lds.S | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
arch/s390/kernel/vmlinux.lds.S +5 -6
index ff1ddba96352..3f2f90e38808 100644
@@ -202,6 +202,11 @@ SECTIONS
        . = ALIGN(PAGE_SIZE);
        _end = . ;
 
+       /* Debugging sections.  */
+       STABS_DEBUG
+       DWARF_DEBUG
+       ELF_DETAILS
+
        /*
         * uncompressed image info used by the decompressor
         * it should match struct vmlinux_info
@@ -232,11 +237,6 @@ SECTIONS
 #endif
        } :NONE
 
-       /* Debugging sections.  */
-       STABS_DEBUG
-       DWARF_DEBUG
-       ELF_DETAILS
-
        /*
         * Make sure that the .got.plt is either completely empty or it
         * contains only the three reserved double words.
--

2.50.1

Signature · 2 lines
Best Regards
Masahiro Yamada
maintainer Acked-by
#17 lore raw

Re: [PATCH v5 10/10] s390: vmlinux.lds.S: Reorder sections

Quoted 12 lines · Masahiro Yamada
Quoted 8 lines · Alexey Gladkov

Reorder the sections to be placed in the default segment. The .vmlinux.info use :NONE to override the default segment and tell the linker to not put the section in any segment at all.

Quoted 3 lines
Quoted 3 lines

s390x-linux-ld: .tmp_vmlinux1: warning: allocated section `.modinfo' not in segment
s390x-linux-ld: .tmp_vmlinux2: warning: allocated section `.modinfo' not in segment
s390x-linux-ld: vmlinux.unstripped: warning: allocated section `.modinfo' not in segment

Thank you for root-causing!

Quoted 8 lines
Quoted 4 lines
Cc Heiko Carstens <[email protected]>
Cc Vasily Gorbik <[email protected]>
Cc Alexander Gordeev <[email protected]>

Hi s390 maintainers,
I need this patch for kbuild tree.
Ack is appreciated.

But can you reorder the series so this patch comes before any of the patches which introduces the above warnings, please?

Thanks!

#18 lore raw

Re: [PATCH v5 10/10] s390: vmlinux.lds.S: Reorder sections

Quoted 18 lines · Heiko Carstens
Quoted 17 lines · Masahiro Yamada
Quoted 8 lines · Alexey Gladkov

Reorder the sections to be placed in the default segment. The .vmlinux.info use :NONE to override the default segment and tell the linker to not put the section in any segment at all.

Quoted 3 lines
Quoted 3 lines

s390x-linux-ld: .tmp_vmlinux1: warning: allocated section `.modinfo' not in segment
s390x-linux-ld: .tmp_vmlinux2: warning: allocated section `.modinfo' not in segment
s390x-linux-ld: vmlinux.unstripped: warning: allocated section `.modinfo' not in segment

Thank you for root-causing!

Quoted 4 lines
Cc Heiko Carstens <[email protected]>
Cc Vasily Gorbik <[email protected]>
Cc Alexander Gordeev <[email protected]>
Quoted 8 lines
Quoted 3 lines

Hi s390 maintainers,
I need this patch for kbuild tree.
Ack is appreciated.

But can you reorder the series so this patch comes before any of the patches which introduces the above warnings, please?

Sure. I will put it first to avoid warnings.

Signature · 1 line
Rgrds, legion
#19 lore raw

Re: [PATCH v5 10/10] s390: vmlinux.lds.S: Reorder sections

Quoted 9 lines · Alexey Gladkov
Quoted 7 lines · Heiko Carstens
Quoted 6 lines · Masahiro Yamada
Quoted 5 lines · Alexey Gladkov

Reorder the sections to be placed in the default segment. The .vmlinux.info use :NONE to override the default segment and tell the linker to not put the section in any segment at all.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

s390x-linux-ld: .tmp_vmlinux1: warning: allocated section `.modinfo' not in segment
s390x-linux-ld: .tmp_vmlinux2: warning: allocated section `.modinfo' not in segment
s390x-linux-ld: vmlinux.unstripped: warning: allocated section `.modinfo' not in segment

Thank you for root-causing!

I applied this series with patch re-ordering.

Signature · 2 lines
Best Regards
Masahiro Yamada