linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] kbuild: Fixes for fallout from recent modules.builtin.modinfo series
@ 2025-10-08 22:46 Nathan Chancellor
  2025-10-08 22:46 ` [PATCH 1/3] kbuild: Restore pattern to avoid stripping .rela.dyn from vmlinux Nathan Chancellor
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Nathan Chancellor @ 2025-10-08 22:46 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier
  Cc: Alexey Gladkov, Masahiro Yamada, linux-kbuild, linux-kernel,
	Ard Biesheuvel, Alexandre Ghiti, Linux Kernel Functional Testing,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, linux-s390

Hi all,

This is a series to address some problems that were exposed by the
recent modules.builtin.modinfo series that landed in commit c7d3dd9163e6
("Merge patch series "Add generated modalias to
modules.builtin.modinfo"").

The third patch is not directly related to the aforementioned series, as
the warning it fixes happens prior to the series but commit 8d18ef04f940
("s390: vmlinux.lds.S: Reorder sections") from the series creates
conflicts in this area, so I included it here.

I plan to send at least the first two patches to Linus by Saturday for
-rc1 but I will take the third with an Ack.

---
Nathan Chancellor (3):
      kbuild: Restore pattern to avoid stripping .rela.dyn from vmlinux
      kbuild: Add '.rel.*' strip pattern for vmlinux
      s390/vmlinux.lds.S: Move .vmlinux.info to end of allocatable sections

 arch/s390/kernel/vmlinux.lds.S | 44 +++++++++++++++++++++---------------------
 scripts/Makefile.vmlinux       |  5 ++++-
 2 files changed, 26 insertions(+), 23 deletions(-)
---
base-commit: 38492c5743f8b7213ca86f0cd72ea625af35d5ef
change-id: 20251008-kbuild-fix-modinfo-regressions-95e3fd151dec

Best regards,
--  
Nathan Chancellor <nathan@kernel.org>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] kbuild: Restore pattern to avoid stripping .rela.dyn from vmlinux
  2025-10-08 22:46 [PATCH 0/3] kbuild: Fixes for fallout from recent modules.builtin.modinfo series Nathan Chancellor
@ 2025-10-08 22:46 ` Nathan Chancellor
  2025-10-10 17:13   ` Ard Biesheuvel
  2025-10-08 22:46 ` [PATCH 2/3] kbuild: Add '.rel.*' strip pattern for vmlinux Nathan Chancellor
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Nathan Chancellor @ 2025-10-08 22:46 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier
  Cc: Alexey Gladkov, Masahiro Yamada, linux-kbuild, linux-kernel,
	Ard Biesheuvel, Alexandre Ghiti

Commit 0ce5139fd96e ("kbuild: always create intermediate
vmlinux.unstripped") removed the pattern to avoid stripping .rela.dyn
sections added by commit e9d86b8e17e7 ("scripts: Do not strip .rela.dyn
section"). Restore it so that .rela.dyn sections remain in the final
vmlinux.

Fixes: 0ce5139fd96e ("kbuild: always create intermediate vmlinux.unstripped")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
---
 scripts/Makefile.vmlinux | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux
index 7c6ae9886f8f..a62639982be5 100644
--- a/scripts/Makefile.vmlinux
+++ b/scripts/Makefile.vmlinux
@@ -82,7 +82,7 @@ endif
 # ---------------------------------------------------------------------------
 
 remove-section-y                                   := .modinfo
-remove-section-$(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS) += '.rel*'
+remove-section-$(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS) += '.rel*' '!.rel*.dyn'
 
 remove-symbols := -w --strip-symbol='__mod_device_table__*'
 

-- 
2.51.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] kbuild: Add '.rel.*' strip pattern for vmlinux
  2025-10-08 22:46 [PATCH 0/3] kbuild: Fixes for fallout from recent modules.builtin.modinfo series Nathan Chancellor
  2025-10-08 22:46 ` [PATCH 1/3] kbuild: Restore pattern to avoid stripping .rela.dyn from vmlinux Nathan Chancellor
@ 2025-10-08 22:46 ` Nathan Chancellor
  2025-10-10 17:16   ` Ard Biesheuvel
  2025-10-08 22:46 ` [PATCH 3/3] s390/vmlinux.lds.S: Move .vmlinux.info to end of allocatable sections Nathan Chancellor
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Nathan Chancellor @ 2025-10-08 22:46 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier
  Cc: Alexey Gladkov, Masahiro Yamada, linux-kbuild, linux-kernel,
	Linux Kernel Functional Testing, Ard Biesheuvel

Prior to binutils commit c12d9fa2afe ("Support objcopy
--remove-section=.relaFOO") [1] in 2.32, stripping relocation sections
required the trailing period (i.e., '.rel.*') to work properly.

After commit 3e86e4d74c04 ("kbuild: keep .modinfo section in
vmlinux.unstripped"), there is an error with binutils 2.31.1 or earlier
because these sections are not properly removed:

  s390-linux-objcopy: st6tO8Ev: symbol `.modinfo' required but not present
  s390-linux-objcopy:st6tO8Ev: no symbols

Add the old pattern to resolve this issue (along with a comment to allow
cleaning this when binutils 2.32 or newer is the minimum supported
version). While the aforementioned kbuild change exposes this, the
pattern was originally changed by commit 71d815bf5dfd ("kbuild: Strip
runtime const RELA sections correctly"), where it would still be
incorrect with binutils older than 2.32.

Fixes: 71d815bf5dfd ("kbuild: Strip runtime const RELA sections correctly")
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c12d9fa2afe7abcbe407a00e15719e1a1350c2a7 [1]
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Closes: https://lore.kernel.org/CA+G9fYvVktRhFtZXdNgVOL8j+ArsJDpvMLgCitaQvQmCx=hwOQ@mail.gmail.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: Ard Biesheuvel <ardb@kernel.org>
---
 scripts/Makefile.vmlinux | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux
index a62639982be5..c02f85c2e241 100644
--- a/scripts/Makefile.vmlinux
+++ b/scripts/Makefile.vmlinux
@@ -83,6 +83,9 @@ endif
 
 remove-section-y                                   := .modinfo
 remove-section-$(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS) += '.rel*' '!.rel*.dyn'
+# for compatibility with binutils < 2.32
+# https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c12d9fa2afe7abcbe407a00e15719e1a1350c2a7
+remove-section-$(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS) += '.rel.*'
 
 remove-symbols := -w --strip-symbol='__mod_device_table__*'
 

-- 
2.51.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] s390/vmlinux.lds.S: Move .vmlinux.info to end of allocatable sections
  2025-10-08 22:46 [PATCH 0/3] kbuild: Fixes for fallout from recent modules.builtin.modinfo series Nathan Chancellor
  2025-10-08 22:46 ` [PATCH 1/3] kbuild: Restore pattern to avoid stripping .rela.dyn from vmlinux Nathan Chancellor
  2025-10-08 22:46 ` [PATCH 2/3] kbuild: Add '.rel.*' strip pattern for vmlinux Nathan Chancellor
@ 2025-10-08 22:46 ` Nathan Chancellor
  2025-10-09 11:37   ` Alexander Gordeev
  2025-10-09 19:44 ` [PATCH 0/3] kbuild: Fixes for fallout from recent modules.builtin.modinfo series Nicolas Schier
  2025-10-10  7:19 ` Alexey Gladkov
  4 siblings, 1 reply; 9+ messages in thread
From: Nathan Chancellor @ 2025-10-08 22:46 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier
  Cc: Alexey Gladkov, Masahiro Yamada, linux-kbuild, linux-kernel,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, linux-s390

When building s390 defconfig with binutils older than 2.32, there are
several warnings during the final linking stage:

  s390-linux-ld: .tmp_vmlinux1: warning: allocated section `.got.plt' not in segment
  s390-linux-ld: .tmp_vmlinux2: warning: allocated section `.got.plt' not in segment
  s390-linux-ld: vmlinux.unstripped: warning: allocated section `.got.plt' not in segment
  s390-linux-objcopy: vmlinux: warning: allocated section `.got.plt' not in segment
  s390-linux-objcopy: st7afZyb: warning: allocated section `.got.plt' not in segment

binutils commit afca762f598 ("S/390: Improve partial relro support for
64 bit") [1] in 2.32 changed where .got.plt is emitted, avoiding the
warning.

The :NONE in the .vmlinux.info output section description changes the
segment for subsequent allocated sections. Move .vmlinux.info right
above the discards section to place all other sections in the previously
defined segment, .data.

Fixes: 30226853d6ec ("s390: vmlinux.lds.S: explicitly handle '.got' and '.plt' sections")
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=afca762f598d453c563f244cd3777715b1a0cb72 [1]
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: linux-s390@vger.kernel.org
---
 arch/s390/kernel/vmlinux.lds.S | 44 +++++++++++++++++++++---------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index feecf1a6ddb4..d74d4c52ccd0 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -214,6 +214,28 @@ SECTIONS
 	DWARF_DEBUG
 	ELF_DETAILS
 
+	/*
+	 * Make sure that the .got.plt is either completely empty or it
+	 * contains only the three reserved double words.
+	 */
+	.got.plt : {
+		*(.got.plt)
+	}
+	ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0x18, "Unexpected GOT/PLT entries detected!")
+
+	/*
+	 * Sections that should stay zero sized, which is safer to
+	 * explicitly check instead of blindly discarding.
+	 */
+	.plt : {
+		*(.plt) *(.plt.*) *(.iplt) *(.igot .igot.plt)
+	}
+	ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!")
+	.rela.dyn : {
+		*(.rela.*) *(.rela_*)
+	}
+	ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!")
+
 	/*
 	 * uncompressed image info used by the decompressor
 	 * it should match struct vmlinux_info
@@ -244,28 +266,6 @@ SECTIONS
 #endif
 	} :NONE
 
-	/*
-	 * Make sure that the .got.plt is either completely empty or it
-	 * contains only the three reserved double words.
-	 */
-	.got.plt : {
-		*(.got.plt)
-	}
-	ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0x18, "Unexpected GOT/PLT entries detected!")
-
-	/*
-	 * Sections that should stay zero sized, which is safer to
-	 * explicitly check instead of blindly discarding.
-	 */
-	.plt : {
-		*(.plt) *(.plt.*) *(.iplt) *(.igot .igot.plt)
-	}
-	ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!")
-	.rela.dyn : {
-		*(.rela.*) *(.rela_*)
-	}
-	ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!")
-
 	/* Sections to be discarded */
 	DISCARDS
 	/DISCARD/ : {

-- 
2.51.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] s390/vmlinux.lds.S: Move .vmlinux.info to end of allocatable sections
  2025-10-08 22:46 ` [PATCH 3/3] s390/vmlinux.lds.S: Move .vmlinux.info to end of allocatable sections Nathan Chancellor
@ 2025-10-09 11:37   ` Alexander Gordeev
  0 siblings, 0 replies; 9+ messages in thread
From: Alexander Gordeev @ 2025-10-09 11:37 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Nicolas Schier, Alexey Gladkov, Masahiro Yamada, linux-kbuild,
	linux-kernel, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger, Sven Schnelle, linux-s390

On Wed, Oct 08, 2025 at 03:46:46PM -0700, Nathan Chancellor wrote:
> When building s390 defconfig with binutils older than 2.32, there are
> several warnings during the final linking stage:
> 
>   s390-linux-ld: .tmp_vmlinux1: warning: allocated section `.got.plt' not in segment
>   s390-linux-ld: .tmp_vmlinux2: warning: allocated section `.got.plt' not in segment
>   s390-linux-ld: vmlinux.unstripped: warning: allocated section `.got.plt' not in segment
>   s390-linux-objcopy: vmlinux: warning: allocated section `.got.plt' not in segment
>   s390-linux-objcopy: st7afZyb: warning: allocated section `.got.plt' not in segment
> 
> binutils commit afca762f598 ("S/390: Improve partial relro support for
> 64 bit") [1] in 2.32 changed where .got.plt is emitted, avoiding the
> warning.
> 
> The :NONE in the .vmlinux.info output section description changes the
> segment for subsequent allocated sections. Move .vmlinux.info right
> above the discards section to place all other sections in the previously
> defined segment, .data.
> 
> Fixes: 30226853d6ec ("s390: vmlinux.lds.S: explicitly handle '.got' and '.plt' sections")
> Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=afca762f598d453c563f244cd3777715b1a0cb72 [1]
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Cc: Heiko Carstens <hca@linux.ibm.com>
> Cc: Vasily Gorbik <gor@linux.ibm.com>
> Cc: Alexander Gordeev <agordeev@linux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
> Cc: Sven Schnelle <svens@linux.ibm.com>
> Cc: linux-s390@vger.kernel.org
> ---
>  arch/s390/kernel/vmlinux.lds.S | 44 +++++++++++++++++++++---------------------
>  1 file changed, 22 insertions(+), 22 deletions(-)

Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>

Thanks!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] kbuild: Fixes for fallout from recent modules.builtin.modinfo series
  2025-10-08 22:46 [PATCH 0/3] kbuild: Fixes for fallout from recent modules.builtin.modinfo series Nathan Chancellor
                   ` (2 preceding siblings ...)
  2025-10-08 22:46 ` [PATCH 3/3] s390/vmlinux.lds.S: Move .vmlinux.info to end of allocatable sections Nathan Chancellor
@ 2025-10-09 19:44 ` Nicolas Schier
  2025-10-10  7:19 ` Alexey Gladkov
  4 siblings, 0 replies; 9+ messages in thread
From: Nicolas Schier @ 2025-10-09 19:44 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Alexey Gladkov, Masahiro Yamada, linux-kbuild, linux-kernel,
	Ard Biesheuvel, Alexandre Ghiti, Linux Kernel Functional Testing,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, linux-s390

On Wed, Oct 08, 2025 at 03:46:43PM -0700, Nathan Chancellor wrote:
> Hi all,
> 
> This is a series to address some problems that were exposed by the
> recent modules.builtin.modinfo series that landed in commit c7d3dd9163e6
> ("Merge patch series "Add generated modalias to
> modules.builtin.modinfo"").
> 
> The third patch is not directly related to the aforementioned series, as
> the warning it fixes happens prior to the series but commit 8d18ef04f940
> ("s390: vmlinux.lds.S: Reorder sections") from the series creates
> conflicts in this area, so I included it here.
> 
> I plan to send at least the first two patches to Linus by Saturday for
> -rc1 but I will take the third with an Ack.
> 
> ---
> Nathan Chancellor (3):
>       kbuild: Restore pattern to avoid stripping .rela.dyn from vmlinux
>       kbuild: Add '.rel.*' strip pattern for vmlinux
>       s390/vmlinux.lds.S: Move .vmlinux.info to end of allocatable sections
> 
>  arch/s390/kernel/vmlinux.lds.S | 44 +++++++++++++++++++++---------------------
>  scripts/Makefile.vmlinux       |  5 ++++-
>  2 files changed, 26 insertions(+), 23 deletions(-)

Thanks!

Acked-by: Nicolas Schier <nsc@kernel.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] kbuild: Fixes for fallout from recent modules.builtin.modinfo series
  2025-10-08 22:46 [PATCH 0/3] kbuild: Fixes for fallout from recent modules.builtin.modinfo series Nathan Chancellor
                   ` (3 preceding siblings ...)
  2025-10-09 19:44 ` [PATCH 0/3] kbuild: Fixes for fallout from recent modules.builtin.modinfo series Nicolas Schier
@ 2025-10-10  7:19 ` Alexey Gladkov
  4 siblings, 0 replies; 9+ messages in thread
From: Alexey Gladkov @ 2025-10-10  7:19 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Nicolas Schier, Masahiro Yamada, linux-kbuild, linux-kernel,
	Ard Biesheuvel, Alexandre Ghiti, Linux Kernel Functional Testing,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, linux-s390

On Wed, Oct 08, 2025 at 03:46:43PM -0700, Nathan Chancellor wrote:
> Hi all,
> 
> This is a series to address some problems that were exposed by the
> recent modules.builtin.modinfo series that landed in commit c7d3dd9163e6
> ("Merge patch series "Add generated modalias to
> modules.builtin.modinfo"").
> 
> The third patch is not directly related to the aforementioned series, as
> the warning it fixes happens prior to the series but commit 8d18ef04f940
> ("s390: vmlinux.lds.S: Reorder sections") from the series creates
> conflicts in this area, so I included it here.
> 
> I plan to send at least the first two patches to Linus by Saturday for
> -rc1 but I will take the third with an Ack.
> 
> ---
> Nathan Chancellor (3):
>       kbuild: Restore pattern to avoid stripping .rela.dyn from vmlinux
>       kbuild: Add '.rel.*' strip pattern for vmlinux
>       s390/vmlinux.lds.S: Move .vmlinux.info to end of allocatable sections
> 
>  arch/s390/kernel/vmlinux.lds.S | 44 +++++++++++++++++++++---------------------
>  scripts/Makefile.vmlinux       |  5 ++++-
>  2 files changed, 26 insertions(+), 23 deletions(-)
> ---
> base-commit: 38492c5743f8b7213ca86f0cd72ea625af35d5ef
> change-id: 20251008-kbuild-fix-modinfo-regressions-95e3fd151dec
> 
> Best regards,
> --  
> Nathan Chancellor <nathan@kernel.org>
> 

Acked-by: Alexey Gladkov <legion@kernel.org>

-- 
Rgrds, legion


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] kbuild: Restore pattern to avoid stripping .rela.dyn from vmlinux
  2025-10-08 22:46 ` [PATCH 1/3] kbuild: Restore pattern to avoid stripping .rela.dyn from vmlinux Nathan Chancellor
@ 2025-10-10 17:13   ` Ard Biesheuvel
  0 siblings, 0 replies; 9+ messages in thread
From: Ard Biesheuvel @ 2025-10-10 17:13 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Nicolas Schier, Alexey Gladkov, Masahiro Yamada, linux-kbuild,
	linux-kernel, Alexandre Ghiti

On Wed, 8 Oct 2025 at 15:47, Nathan Chancellor <nathan@kernel.org> wrote:
>
> Commit 0ce5139fd96e ("kbuild: always create intermediate
> vmlinux.unstripped") removed the pattern to avoid stripping .rela.dyn
> sections added by commit e9d86b8e17e7 ("scripts: Do not strip .rela.dyn
> section"). Restore it so that .rela.dyn sections remain in the final
> vmlinux.
>
> Fixes: 0ce5139fd96e ("kbuild: always create intermediate vmlinux.unstripped")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Acked-by: Ard Biesheuvel <ardb@kernel.org>

> ---
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
> ---
>  scripts/Makefile.vmlinux | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux
> index 7c6ae9886f8f..a62639982be5 100644
> --- a/scripts/Makefile.vmlinux
> +++ b/scripts/Makefile.vmlinux
> @@ -82,7 +82,7 @@ endif
>  # ---------------------------------------------------------------------------
>
>  remove-section-y                                   := .modinfo
> -remove-section-$(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS) += '.rel*'
> +remove-section-$(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS) += '.rel*' '!.rel*.dyn'
>
>  remove-symbols := -w --strip-symbol='__mod_device_table__*'
>
>
> --
> 2.51.0
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] kbuild: Add '.rel.*' strip pattern for vmlinux
  2025-10-08 22:46 ` [PATCH 2/3] kbuild: Add '.rel.*' strip pattern for vmlinux Nathan Chancellor
@ 2025-10-10 17:16   ` Ard Biesheuvel
  0 siblings, 0 replies; 9+ messages in thread
From: Ard Biesheuvel @ 2025-10-10 17:16 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Nicolas Schier, Alexey Gladkov, Masahiro Yamada, linux-kbuild,
	linux-kernel, Linux Kernel Functional Testing

On Wed, 8 Oct 2025 at 15:47, Nathan Chancellor <nathan@kernel.org> wrote:
>
> Prior to binutils commit c12d9fa2afe ("Support objcopy
> --remove-section=.relaFOO") [1] in 2.32, stripping relocation sections
> required the trailing period (i.e., '.rel.*') to work properly.
>
> After commit 3e86e4d74c04 ("kbuild: keep .modinfo section in
> vmlinux.unstripped"), there is an error with binutils 2.31.1 or earlier
> because these sections are not properly removed:
>
>   s390-linux-objcopy: st6tO8Ev: symbol `.modinfo' required but not present
>   s390-linux-objcopy:st6tO8Ev: no symbols
>
> Add the old pattern to resolve this issue (along with a comment to allow
> cleaning this when binutils 2.32 or newer is the minimum supported
> version). While the aforementioned kbuild change exposes this, the
> pattern was originally changed by commit 71d815bf5dfd ("kbuild: Strip
> runtime const RELA sections correctly"), where it would still be
> incorrect with binutils older than 2.32.
>
> Fixes: 71d815bf5dfd ("kbuild: Strip runtime const RELA sections correctly")
> Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c12d9fa2afe7abcbe407a00e15719e1a1350c2a7 [1]
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> Closes: https://lore.kernel.org/CA+G9fYvVktRhFtZXdNgVOL8j+ArsJDpvMLgCitaQvQmCx=hwOQ@mail.gmail.com/
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Acked-by: Ard Biesheuvel <ardb@kernel.org>

> ---
> Cc: Ard Biesheuvel <ardb@kernel.org>
> ---
>  scripts/Makefile.vmlinux | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux
> index a62639982be5..c02f85c2e241 100644
> --- a/scripts/Makefile.vmlinux
> +++ b/scripts/Makefile.vmlinux
> @@ -83,6 +83,9 @@ endif
>
>  remove-section-y                                   := .modinfo
>  remove-section-$(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS) += '.rel*' '!.rel*.dyn'
> +# for compatibility with binutils < 2.32
> +# https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c12d9fa2afe7abcbe407a00e15719e1a1350c2a7
> +remove-section-$(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS) += '.rel.*'
>
>  remove-symbols := -w --strip-symbol='__mod_device_table__*'
>
>
> --
> 2.51.0
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-10-10 17:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-08 22:46 [PATCH 0/3] kbuild: Fixes for fallout from recent modules.builtin.modinfo series Nathan Chancellor
2025-10-08 22:46 ` [PATCH 1/3] kbuild: Restore pattern to avoid stripping .rela.dyn from vmlinux Nathan Chancellor
2025-10-10 17:13   ` Ard Biesheuvel
2025-10-08 22:46 ` [PATCH 2/3] kbuild: Add '.rel.*' strip pattern for vmlinux Nathan Chancellor
2025-10-10 17:16   ` Ard Biesheuvel
2025-10-08 22:46 ` [PATCH 3/3] s390/vmlinux.lds.S: Move .vmlinux.info to end of allocatable sections Nathan Chancellor
2025-10-09 11:37   ` Alexander Gordeev
2025-10-09 19:44 ` [PATCH 0/3] kbuild: Fixes for fallout from recent modules.builtin.modinfo series Nicolas Schier
2025-10-10  7:19 ` Alexey Gladkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).