llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/vmlinux.lds: Drop .interp description
@ 2025-10-18 17:52 Nathan Chancellor
  2025-10-21  8:18 ` Vishal Chourasia
  2025-11-21  2:53 ` Madhavan Srinivasan
  0 siblings, 2 replies; 5+ messages in thread
From: Nathan Chancellor @ 2025-10-18 17:52 UTC (permalink / raw)
  To: Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy
  Cc: Nick Desaulniers, Bill Wendling, Justin Stitt, linuxppc-dev,
	linux-kernel, llvm, Vishal Chourasia, Nathan Chancellor

Commit da30705c4621 ("arch/powerpc: Remove .interp section in vmlinux")
intended to drop the .interp section from vmlinux but even with this
change, relocatable kernels linked with ld.lld contain an empty .interp
section, which ends up causing crashes in GDB [1].

  $ make -skj"$(nproc)" ARCH=powerpc LLVM=1 clean pseries_le_defconfig vmlinux

  $ llvm-readelf -S vmlinux | grep interp
    [44] .interp           PROGBITS        c0000000021ddb34 21edb34 000000 00   A  0   0  1

There appears to be a subtle difference between GNU ld and ld.lld when
it comes to discarding sections that specify load addresses [2].

Since '--no-dynamic-linker' prevents emission of the .interp section,
there is no need to describe it in the output sections of the vmlinux
linker script. Drop the .interp section description from vmlinux.lds.S
to avoid this issue altogether.

Link: https://sourceware.org/bugzilla/show_bug.cgi?id=33481 [1]
Link: https://github.com/ClangBuiltLinux/linux/issues/2137 [2]
Reported-by: Vishal Chourasia <vishalc@linux.ibm.com>
Closes: https://lore.kernel.org/20251013040148.560439-1-vishalc@linux.ibm.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 arch/powerpc/kernel/vmlinux.lds.S | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index de6ee7d35cff..15850296c0a9 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -330,7 +330,6 @@ SECTIONS
 	}
 	.hash : AT(ADDR(.hash) - LOAD_OFFSET) { *(.hash) }
 	.gnu.hash : AT(ADDR(.gnu.hash) - LOAD_OFFSET) { *(.gnu.hash) }
-	.interp : AT(ADDR(.interp) - LOAD_OFFSET) { *(.interp) }
 	.rela.dyn : AT(ADDR(.rela.dyn) - LOAD_OFFSET)
 	{
 		__rela_dyn_start = .;

---
base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
change-id: 20251018-ppc-fix-lld-interp-1a78c361cd42

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


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

* Re: [PATCH] powerpc/vmlinux.lds: Drop .interp description
  2025-10-18 17:52 [PATCH] powerpc/vmlinux.lds: Drop .interp description Nathan Chancellor
@ 2025-10-21  8:18 ` Vishal Chourasia
  2025-10-27  7:46   ` Vishal Chourasia
  2025-11-21  2:53 ` Madhavan Srinivasan
  1 sibling, 1 reply; 5+ messages in thread
From: Vishal Chourasia @ 2025-10-21  8:18 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Nick Desaulniers, Bill Wendling, Justin Stitt,
	linuxppc-dev, linux-kernel, llvm

On Sat, Oct 18, 2025 at 06:52:40PM +0100, Nathan Chancellor wrote:
> Commit da30705c4621 ("arch/powerpc: Remove .interp section in vmlinux")
> intended to drop the .interp section from vmlinux but even with this
> change, relocatable kernels linked with ld.lld contain an empty .interp
> section, which ends up causing crashes in GDB [1].
> 
>   $ make -skj"$(nproc)" ARCH=powerpc LLVM=1 clean pseries_le_defconfig vmlinux
> 
>   $ llvm-readelf -S vmlinux | grep interp
>     [44] .interp           PROGBITS        c0000000021ddb34 21edb34 000000 00   A  0   0  1
> 
> There appears to be a subtle difference between GNU ld and ld.lld when
> it comes to discarding sections that specify load addresses [2].
> 
> Since '--no-dynamic-linker' prevents emission of the .interp section,
> there is no need to describe it in the output sections of the vmlinux
> linker script. Drop the .interp section description from vmlinux.lds.S
> to avoid this issue altogether.
> 
> Link: https://sourceware.org/bugzilla/show_bug.cgi?id=33481 [1]
> Link: https://github.com/ClangBuiltLinux/linux/issues/2137 [2]
> Reported-by: Vishal Chourasia <vishalc@linux.ibm.com>
> Closes: https://lore.kernel.org/20251013040148.560439-1-vishalc@linux.ibm.com/
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  arch/powerpc/kernel/vmlinux.lds.S | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
> index de6ee7d35cff..15850296c0a9 100644
> --- a/arch/powerpc/kernel/vmlinux.lds.S
> +++ b/arch/powerpc/kernel/vmlinux.lds.S
> @@ -330,7 +330,6 @@ SECTIONS
>  	}
>  	.hash : AT(ADDR(.hash) - LOAD_OFFSET) { *(.hash) }
>  	.gnu.hash : AT(ADDR(.gnu.hash) - LOAD_OFFSET) { *(.gnu.hash) }
> -	.interp : AT(ADDR(.interp) - LOAD_OFFSET) { *(.interp) }
>  	.rela.dyn : AT(ADDR(.rela.dyn) - LOAD_OFFSET)
>  	{
>  		__rela_dyn_start = .;
> 
> ---
> base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
> change-id: 20251018-ppc-fix-lld-interp-1a78c361cd42
> 

With this patch, I don't see .interp section being emitted the final
vmlinux binary.

```
(i) ❯ make LLVM=1 vmlinux
(i) ❯ llvm-readelf -p .comment vmlinux

String dump of section '.comment':
[     1] clang version 22.0.0git (https://github.com/llvm/llvm-project.git 7314565281ec28b745502c3f429fd431e16673eb)
[    6d] Linker: LLD 22.0.0 (https://github.com/llvm/llvm-project.git 7314565281ec28b745502c3f429fd431e16673eb)

(i) ❯ llvm-readelf -p .interp vmlinux
llvm-readelf: warning: 'vmlinux': could not find section '.interp'
```

Tested-by: Vishal Chourasia <vishalc@linux.ibm.com>

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

* Re: [PATCH] powerpc/vmlinux.lds: Drop .interp description
  2025-10-21  8:18 ` Vishal Chourasia
@ 2025-10-27  7:46   ` Vishal Chourasia
  2025-10-28  8:58     ` Madhavan Srinivasan
  0 siblings, 1 reply; 5+ messages in thread
From: Vishal Chourasia @ 2025-10-27  7:46 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Nick Desaulniers, Bill Wendling, Justin Stitt,
	linuxppc-dev, linux-kernel, llvm

ping.

what's the status for this patch?

vishalc


On Tue, Oct 21, 2025 at 01:48:31PM +0530, Vishal Chourasia wrote:
> On Sat, Oct 18, 2025 at 06:52:40PM +0100, Nathan Chancellor wrote:
> > Commit da30705c4621 ("arch/powerpc: Remove .interp section in vmlinux")
> > intended to drop the .interp section from vmlinux but even with this
> > change, relocatable kernels linked with ld.lld contain an empty .interp
> > section, which ends up causing crashes in GDB [1].
> > 
> >   $ make -skj"$(nproc)" ARCH=powerpc LLVM=1 clean pseries_le_defconfig vmlinux
> > 
> >   $ llvm-readelf -S vmlinux | grep interp
> >     [44] .interp           PROGBITS        c0000000021ddb34 21edb34 000000 00   A  0   0  1
> > 
> > There appears to be a subtle difference between GNU ld and ld.lld when
> > it comes to discarding sections that specify load addresses [2].
> > 
> > Since '--no-dynamic-linker' prevents emission of the .interp section,
> > there is no need to describe it in the output sections of the vmlinux
> > linker script. Drop the .interp section description from vmlinux.lds.S
> > to avoid this issue altogether.
> > 
> > Link: https://sourceware.org/bugzilla/show_bug.cgi?id=33481 [1]
> > Link: https://github.com/ClangBuiltLinux/linux/issues/2137 [2]
> > Reported-by: Vishal Chourasia <vishalc@linux.ibm.com>
> > Closes: https://lore.kernel.org/20251013040148.560439-1-vishalc@linux.ibm.com/
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> >  arch/powerpc/kernel/vmlinux.lds.S | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
> > index de6ee7d35cff..15850296c0a9 100644
> > --- a/arch/powerpc/kernel/vmlinux.lds.S
> > +++ b/arch/powerpc/kernel/vmlinux.lds.S
> > @@ -330,7 +330,6 @@ SECTIONS
> >  	}
> >  	.hash : AT(ADDR(.hash) - LOAD_OFFSET) { *(.hash) }
> >  	.gnu.hash : AT(ADDR(.gnu.hash) - LOAD_OFFSET) { *(.gnu.hash) }
> > -	.interp : AT(ADDR(.interp) - LOAD_OFFSET) { *(.interp) }
> >  	.rela.dyn : AT(ADDR(.rela.dyn) - LOAD_OFFSET)
> >  	{
> >  		__rela_dyn_start = .;
> > 
> > ---
> > base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
> > change-id: 20251018-ppc-fix-lld-interp-1a78c361cd42
> > 
> 
> With this patch, I don't see .interp section being emitted the final
> vmlinux binary.
> 
> ```
> (i) ❯ make LLVM=1 vmlinux
> (i) ❯ llvm-readelf -p .comment vmlinux
> 
> String dump of section '.comment':
> [     1] clang version 22.0.0git (https://github.com/llvm/llvm-project.git 7314565281ec28b745502c3f429fd431e16673eb)
> [    6d] Linker: LLD 22.0.0 (https://github.com/llvm/llvm-project.git 7314565281ec28b745502c3f429fd431e16673eb)
> 
> (i) ❯ llvm-readelf -p .interp vmlinux
> llvm-readelf: warning: 'vmlinux': could not find section '.interp'
> ```
> 
> Tested-by: Vishal Chourasia <vishalc@linux.ibm.com>

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

* Re: [PATCH] powerpc/vmlinux.lds: Drop .interp description
  2025-10-27  7:46   ` Vishal Chourasia
@ 2025-10-28  8:58     ` Madhavan Srinivasan
  0 siblings, 0 replies; 5+ messages in thread
From: Madhavan Srinivasan @ 2025-10-28  8:58 UTC (permalink / raw)
  To: Vishal Chourasia, Nathan Chancellor
  Cc: Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Nick Desaulniers, Bill Wendling, Justin Stitt, linuxppc-dev,
	linux-kernel, llvm

Will pick it up. Thanks

Maddy

On 10/27/25 1:16 PM, Vishal Chourasia wrote:
> ping.
>
> what's the status for this patch?
>
> vishalc
>
>
> On Tue, Oct 21, 2025 at 01:48:31PM +0530, Vishal Chourasia wrote:
>> On Sat, Oct 18, 2025 at 06:52:40PM +0100, Nathan Chancellor wrote:
>>> Commit da30705c4621 ("arch/powerpc: Remove .interp section in vmlinux")
>>> intended to drop the .interp section from vmlinux but even with this
>>> change, relocatable kernels linked with ld.lld contain an empty .interp
>>> section, which ends up causing crashes in GDB [1].
>>>
>>>    $ make -skj"$(nproc)" ARCH=powerpc LLVM=1 clean pseries_le_defconfig vmlinux
>>>
>>>    $ llvm-readelf -S vmlinux | grep interp
>>>      [44] .interp           PROGBITS        c0000000021ddb34 21edb34 000000 00   A  0   0  1
>>>
>>> There appears to be a subtle difference between GNU ld and ld.lld when
>>> it comes to discarding sections that specify load addresses [2].
>>>
>>> Since '--no-dynamic-linker' prevents emission of the .interp section,
>>> there is no need to describe it in the output sections of the vmlinux
>>> linker script. Drop the .interp section description from vmlinux.lds.S
>>> to avoid this issue altogether.
>>>
>>> Link: https://sourceware.org/bugzilla/show_bug.cgi?id=33481 [1]
>>> Link: https://github.com/ClangBuiltLinux/linux/issues/2137 [2]
>>> Reported-by: Vishal Chourasia <vishalc@linux.ibm.com>
>>> Closes: https://lore.kernel.org/20251013040148.560439-1-vishalc@linux.ibm.com/
>>> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
>>> ---
>>>   arch/powerpc/kernel/vmlinux.lds.S | 1 -
>>>   1 file changed, 1 deletion(-)
>>>
>>> diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
>>> index de6ee7d35cff..15850296c0a9 100644
>>> --- a/arch/powerpc/kernel/vmlinux.lds.S
>>> +++ b/arch/powerpc/kernel/vmlinux.lds.S
>>> @@ -330,7 +330,6 @@ SECTIONS
>>>   	}
>>>   	.hash : AT(ADDR(.hash) - LOAD_OFFSET) { *(.hash) }
>>>   	.gnu.hash : AT(ADDR(.gnu.hash) - LOAD_OFFSET) { *(.gnu.hash) }
>>> -	.interp : AT(ADDR(.interp) - LOAD_OFFSET) { *(.interp) }
>>>   	.rela.dyn : AT(ADDR(.rela.dyn) - LOAD_OFFSET)
>>>   	{
>>>   		__rela_dyn_start = .;
>>>
>>> ---
>>> base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
>>> change-id: 20251018-ppc-fix-lld-interp-1a78c361cd42
>>>
>> With this patch, I don't see .interp section being emitted the final
>> vmlinux binary.
>>
>> ```
>> (i) ❯ make LLVM=1 vmlinux
>> (i) ❯ llvm-readelf -p .comment vmlinux
>>
>> String dump of section '.comment':
>> [     1] clang version 22.0.0git (https://github.com/llvm/llvm-project.git 7314565281ec28b745502c3f429fd431e16673eb)
>> [    6d] Linker: LLD 22.0.0 (https://github.com/llvm/llvm-project.git 7314565281ec28b745502c3f429fd431e16673eb)
>>
>> (i) ❯ llvm-readelf -p .interp vmlinux
>> llvm-readelf: warning: 'vmlinux': could not find section '.interp'
>> ```
>>
>> Tested-by: Vishal Chourasia <vishalc@linux.ibm.com>

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

* Re: [PATCH] powerpc/vmlinux.lds: Drop .interp description
  2025-10-18 17:52 [PATCH] powerpc/vmlinux.lds: Drop .interp description Nathan Chancellor
  2025-10-21  8:18 ` Vishal Chourasia
@ 2025-11-21  2:53 ` Madhavan Srinivasan
  1 sibling, 0 replies; 5+ messages in thread
From: Madhavan Srinivasan @ 2025-11-21  2:53 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Nathan Chancellor
  Cc: Nick Desaulniers, Bill Wendling, Justin Stitt, linuxppc-dev,
	linux-kernel, llvm, Vishal Chourasia

On Sat, 18 Oct 2025 18:52:40 +0100, Nathan Chancellor wrote:
> Commit da30705c4621 ("arch/powerpc: Remove .interp section in vmlinux")
> intended to drop the .interp section from vmlinux but even with this
> change, relocatable kernels linked with ld.lld contain an empty .interp
> section, which ends up causing crashes in GDB [1].
> 
>   $ make -skj"$(nproc)" ARCH=powerpc LLVM=1 clean pseries_le_defconfig vmlinux
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/vmlinux.lds: Drop .interp description
      https://git.kernel.org/powerpc/c/d2be62d5858312f3e6c36dbfc43faa1f287d5249

Thanks

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

end of thread, other threads:[~2025-11-21  4:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-18 17:52 [PATCH] powerpc/vmlinux.lds: Drop .interp description Nathan Chancellor
2025-10-21  8:18 ` Vishal Chourasia
2025-10-27  7:46   ` Vishal Chourasia
2025-10-28  8:58     ` Madhavan Srinivasan
2025-11-21  2:53 ` Madhavan Srinivasan

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).