* [PATCH] arch/powerpc: Remove .interp section in vmlinux
@ 2025-07-01 10:49 Christophe Leroy
2025-07-01 13:32 ` Segher Boessenkool
2025-10-13 4:01 ` Vishal Chourasia
0 siblings, 2 replies; 9+ messages in thread
From: Christophe Leroy @ 2025-07-01 10:49 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin, Naveen N Rao,
Madhavan Srinivasan
Cc: Christophe Leroy, linux-kernel, linuxppc-dev
When building with CONFIG_RELOCATABLE, there is a .interp section
which contains the name of the expected ELF interpreter:
Contents of section .interp:
c0000000021c1bac 2f757372 2f6c6962 2f6c642e 736f2e31 /usr/lib/ld.so.1
c0000000021c1bbc 00 .
That information is useless and even likely wrong. Remove it.
Link: https://github.com/linuxppc/issues/issues/434
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index f3804103c56c..9753fb87217c 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -101,7 +101,7 @@ KBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION)
endif
LDFLAGS_vmlinux-y := -Bstatic
-LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
+LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie --no-dynamic-linker
LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) += -z notext
LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y)
--
2.49.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] arch/powerpc: Remove .interp section in vmlinux
2025-07-01 10:49 [PATCH] arch/powerpc: Remove .interp section in vmlinux Christophe Leroy
@ 2025-07-01 13:32 ` Segher Boessenkool
2025-10-13 4:01 ` Vishal Chourasia
1 sibling, 0 replies; 9+ messages in thread
From: Segher Boessenkool @ 2025-07-01 13:32 UTC (permalink / raw)
To: Christophe Leroy
Cc: Michael Ellerman, Nicholas Piggin, Naveen N Rao,
Madhavan Srinivasan, linux-kernel, linuxppc-dev
Hi!
On Tue, Jul 01, 2025 at 12:49:29PM +0200, Christophe Leroy wrote:
> When building with CONFIG_RELOCATABLE, there is a .interp section
> which contains the name of the expected ELF interpreter:
>
> Contents of section .interp:
> c0000000021c1bac 2f757372 2f6c6962 2f6c642e 736f2e31 /usr/lib/ld.so.1
> c0000000021c1bbc 00 .
>
> That information is useless and even likely wrong. Remove it.
s/ likely//
You cannot run the kernel as some dynamic object (under control of some
interpreter that will load DSOs for you), hehe.
The various bfd/elf*.c (in binutils/ld) have code like
if (htab->elf.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
if (s == NULL)
abort ();
s->size = sizeof ELF_DYNAMIC_INTERPRETER;
s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
}
}
(yes there are about a hundred copies of this code, that could be
improved :-) )
whenever producing dynamic objects, so this code just sets that text and
that's all, no side effect to be worried of.
Acked-by: Segher Boessenkool <segher@kernel.crashing.org>
(Maybe this could or should be in generic code though, not architecture
code?)
Segher
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] arch/powerpc: Remove .interp section in vmlinux
2025-07-01 10:49 [PATCH] arch/powerpc: Remove .interp section in vmlinux Christophe Leroy
2025-07-01 13:32 ` Segher Boessenkool
@ 2025-10-13 4:01 ` Vishal Chourasia
2025-10-13 6:46 ` Christophe Leroy
1 sibling, 1 reply; 9+ messages in thread
From: Vishal Chourasia @ 2025-10-13 4:01 UTC (permalink / raw)
To: christophe.leroy, maddy, linuxppc-dev, linux-kernel
While debugging a ppc64le QEMU guest on an x86_64 host, I observed GDB crashes
when attempting to attach to the remote target:
(gdb) target remote :1234
Investigation revealed that cross-compiling the Linux kernel for ppc64le on an
x86_64 host using Clang produces a vmlinux binary containing an empty .interp
section. This empty .interp section is responsible for the GDB crashes.
This issue does not occur when:
- Building for ppc64le target using GCC on x86_64 host
- Building for ppc64le target using Clang on ppc64le host
- Building for ppc64le target using GCC on ppc64le host
For details refer [1]
[1] https://sourceware.org/bugzilla/show_bug.cgi?id=33481
vishalc
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] arch/powerpc: Remove .interp section in vmlinux
2025-10-13 4:01 ` Vishal Chourasia
@ 2025-10-13 6:46 ` Christophe Leroy
2025-10-13 7:27 ` Vishal Chourasia
0 siblings, 1 reply; 9+ messages in thread
From: Christophe Leroy @ 2025-10-13 6:46 UTC (permalink / raw)
To: Vishal Chourasia, christophe.leroy, maddy, linuxppc-dev,
linux-kernel, clang-built-linux, llvm@lists.linux.dev,
Nathan Chancellor
+CLANG ppl
Hi,
Le 13/10/2025 à 06:01, Vishal Chourasia a écrit :
> While debugging a ppc64le QEMU guest on an x86_64 host, I observed GDB crashes
> when attempting to attach to the remote target:
>
> (gdb) target remote :1234
>
> Investigation revealed that cross-compiling the Linux kernel for ppc64le on an
> x86_64 host using Clang produces a vmlinux binary containing an empty .interp
> section. This empty .interp section is responsible for the GDB crashes.
Which version of CLANG is it ?
>
> This issue does not occur when:
> - Building for ppc64le target using GCC on x86_64 host
> - Building for ppc64le target using Clang on ppc64le host
Is it the same CLANG version ?
> - Building for ppc64le target using GCC on ppc64le host
>
> For details refer [1]
>
> [1] https://sourceware.org/bugzilla/show_bug.cgi?id=33481
Christophe
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] arch/powerpc: Remove .interp section in vmlinux
2025-10-13 6:46 ` Christophe Leroy
@ 2025-10-13 7:27 ` Vishal Chourasia
2025-10-15 0:21 ` Nathan Chancellor
0 siblings, 1 reply; 9+ messages in thread
From: Vishal Chourasia @ 2025-10-13 7:27 UTC (permalink / raw)
To: Christophe Leroy
Cc: maddy, linuxppc-dev, linux-kernel, clang-built-linux,
llvm@lists.linux.dev, Nathan Chancellor
On Mon, Oct 13, 2025 at 08:46:48AM +0200, Christophe Leroy wrote:
> +CLANG ppl
>
> Hi,
>
> Le 13/10/2025 à 06:01, Vishal Chourasia a écrit :
> > While debugging a ppc64le QEMU guest on an x86_64 host, I observed GDB crashes
> > when attempting to attach to the remote target:
> >
> > (gdb) target remote :1234
> >
> > Investigation revealed that cross-compiling the Linux kernel for ppc64le on an
> > x86_64 host using Clang produces a vmlinux binary containing an empty .interp
> > section. This empty .interp section is responsible for the GDB crashes.
>
> Which version of CLANG is it ?
(i) ❯ clang --version
clang version 21.0.0git (https://github.com/llvm/llvm-project.git a80bccc6847be104948f46d313f03ac6b9ccb292)
>
> >
> > This issue does not occur when:
> > - Building for ppc64le target using GCC on x86_64 host
> > - Building for ppc64le target using Clang on ppc64le host
>
> Is it the same CLANG version ?
# clang --version
clang version 22.0.0git (https://github.com/llvm/llvm-project.git 2f755c543ab357bd83235592fcee37fa391cdd9d)
>
> > - Building for ppc64le target using GCC on ppc64le host
> >
> > For details refer [1]
> >
> > [1] https://sourceware.org/bugzilla/show_bug.cgi?id=33481
>
vishalc
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] arch/powerpc: Remove .interp section in vmlinux
2025-10-13 7:27 ` Vishal Chourasia
@ 2025-10-15 0:21 ` Nathan Chancellor
2025-10-15 3:37 ` Vishal Chourasia
0 siblings, 1 reply; 9+ messages in thread
From: Nathan Chancellor @ 2025-10-15 0:21 UTC (permalink / raw)
To: Vishal Chourasia
Cc: Christophe Leroy, maddy, linuxppc-dev, linux-kernel,
clang-built-linux, llvm@lists.linux.dev
Hi Vishal,
On Mon, Oct 13, 2025 at 12:57:00PM +0530, Vishal Chourasia wrote:
> On Mon, Oct 13, 2025 at 08:46:48AM +0200, Christophe Leroy wrote:
> > +CLANG ppl
> >
> > Hi,
> >
> > Le 13/10/2025 à 06:01, Vishal Chourasia a écrit :
> > > While debugging a ppc64le QEMU guest on an x86_64 host, I observed GDB crashes
> > > when attempting to attach to the remote target:
> > >
> > > (gdb) target remote :1234
> > >
> > > Investigation revealed that cross-compiling the Linux kernel for ppc64le on an
> > > x86_64 host using Clang produces a vmlinux binary containing an empty .interp
> > > section. This empty .interp section is responsible for the GDB crashes.
> >
> > Which version of CLANG is it ?
> (i) ❯ clang --version
> clang version 21.0.0git (https://github.com/llvm/llvm-project.git a80bccc6847be104948f46d313f03ac6b9ccb292)
>
> >
> > >
> > > This issue does not occur when:
> > > - Building for ppc64le target using GCC on x86_64 host
> > > - Building for ppc64le target using Clang on ppc64le host
> >
> > Is it the same CLANG version ?
> # clang --version
> clang version 22.0.0git (https://github.com/llvm/llvm-project.git 2f755c543ab357bd83235592fcee37fa391cdd9d)
>
> >
> > > - Building for ppc64le target using GCC on ppc64le host
> > >
> > > For details refer [1]
> > >
> > > [1] https://sourceware.org/bugzilla/show_bug.cgi?id=33481
In this bug report, you mention using LLVM=1. Does the issue happen if
you use GNU ld (ld.bfd) via LD (i.e., LD=powerpc64le-linux-gnu-ld or
equivalent) over ld.lld from LLVM=1? This sounds more likely to be a
linker difference rather than a compiler difference.
Cheers,
Nathan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] arch/powerpc: Remove .interp section in vmlinux
2025-10-15 0:21 ` Nathan Chancellor
@ 2025-10-15 3:37 ` Vishal Chourasia
2025-10-15 18:27 ` Nathan Chancellor
0 siblings, 1 reply; 9+ messages in thread
From: Vishal Chourasia @ 2025-10-15 3:37 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Christophe Leroy, maddy, linuxppc-dev, linux-kernel,
clang-built-linux, llvm@lists.linux.dev
Hello Nathan,
On Tue, Oct 14, 2025 at 05:21:54PM -0700, Nathan Chancellor wrote:
> In this bug report, you mention using LLVM=1. Does the issue happen if
> you use GNU ld (ld.bfd) via LD (i.e., LD=powerpc64le-linux-gnu-ld or
> equivalent) over ld.lld from LLVM=1? This sounds more likely to be a
> linker difference rather than a compiler difference.
Thank you for the insight.
Yes, when using powerpc64le-linux-gnu-ld linker .interp section is not
emitted.
Command:
$ make LLVM=1 ARCH=powerpc LD=powerpc64le-linux-gnu-ld -j 8 zImage
$ llvm-readelf -p .comment vmlinux
String dump of section '.comment':
[ 0] clang version 22.0.0git (https://github.com/llvm/llvm-project.git 7314565281ec28b745502c3f429fd431e16673eb)
$ llvm-readelf -p .interp vmlinux
llvm-readelf: warning: 'vmlinux': could not find section '.interp'
vishalc
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] arch/powerpc: Remove .interp section in vmlinux
2025-10-15 3:37 ` Vishal Chourasia
@ 2025-10-15 18:27 ` Nathan Chancellor
2025-10-16 6:06 ` Vishal Chourasia
0 siblings, 1 reply; 9+ messages in thread
From: Nathan Chancellor @ 2025-10-15 18:27 UTC (permalink / raw)
To: Vishal Chourasia
Cc: Christophe Leroy, maddy, linuxppc-dev, linux-kernel,
clang-built-linux, llvm@lists.linux.dev
On Wed, Oct 15, 2025 at 09:07:54AM +0530, Vishal Chourasia wrote:
> Hello Nathan,
>
> On Tue, Oct 14, 2025 at 05:21:54PM -0700, Nathan Chancellor wrote:
> > In this bug report, you mention using LLVM=1. Does the issue happen if
> > you use GNU ld (ld.bfd) via LD (i.e., LD=powerpc64le-linux-gnu-ld or
> > equivalent) over ld.lld from LLVM=1? This sounds more likely to be a
> > linker difference rather than a compiler difference.
>
> Thank you for the insight.
>
> Yes, when using powerpc64le-linux-gnu-ld linker .interp section is not
> emitted.
>
> Command:
> $ make LLVM=1 ARCH=powerpc LD=powerpc64le-linux-gnu-ld -j 8 zImage
> $ llvm-readelf -p .comment vmlinux
>
> String dump of section '.comment':
> [ 0] clang version 22.0.0git (https://github.com/llvm/llvm-project.git 7314565281ec28b745502c3f429fd431e16673eb)
>
> $ llvm-readelf -p .interp vmlinux
> llvm-readelf: warning: 'vmlinux': could not find section '.interp'
Thanks for confirming. Does this fix the issue for you? It appears to
work for me.
Cheers,
Nathan
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 = .;
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] arch/powerpc: Remove .interp section in vmlinux
2025-10-15 18:27 ` Nathan Chancellor
@ 2025-10-16 6:06 ` Vishal Chourasia
0 siblings, 0 replies; 9+ messages in thread
From: Vishal Chourasia @ 2025-10-16 6:06 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Christophe Leroy, maddy, linuxppc-dev, linux-kernel,
clang-built-linux, llvm@lists.linux.dev
On 15/10/25 23:57, Nathan Chancellor wrote:
> On Wed, Oct 15, 2025 at 09:07:54AM +0530, Vishal Chourasia wrote:
>> Hello Nathan,
>>
>> On Tue, Oct 14, 2025 at 05:21:54PM -0700, Nathan Chancellor wrote:
>>> In this bug report, you mention using LLVM=1. Does the issue happen if
>>> you use GNU ld (ld.bfd) via LD (i.e., LD=powerpc64le-linux-gnu-ld or
>>> equivalent) over ld.lld from LLVM=1? This sounds more likely to be a
>>> linker difference rather than a compiler difference.
>> Thank you for the insight.
>>
>> Yes, when using powerpc64le-linux-gnu-ld linker .interp section is not
>> emitted.
>>
>> Command:
>> $ make LLVM=1 ARCH=powerpc LD=powerpc64le-linux-gnu-ld -j 8 zImage
>> $ llvm-readelf -p .comment vmlinux
>>
>> String dump of section '.comment':
>> [ 0] clang version 22.0.0git (https://github.com/llvm/llvm-project.git 7314565281ec28b745502c3f429fd431e16673eb)
>>
>> $ llvm-readelf -p .interp vmlinux
>> llvm-readelf: warning: 'vmlinux': could not find section '.interp'
> Thanks for confirming. Does this fix the issue for you? It appears to
> work for me.
>
> Cheers,
> Nathan
>
> 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 = .;
Hello Nathan,
It does solve the problem, but with GNU linker it would work even
without this change.
regards,
vishalc
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-10-16 6:06 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-01 10:49 [PATCH] arch/powerpc: Remove .interp section in vmlinux Christophe Leroy
2025-07-01 13:32 ` Segher Boessenkool
2025-10-13 4:01 ` Vishal Chourasia
2025-10-13 6:46 ` Christophe Leroy
2025-10-13 7:27 ` Vishal Chourasia
2025-10-15 0:21 ` Nathan Chancellor
2025-10-15 3:37 ` Vishal Chourasia
2025-10-15 18:27 ` Nathan Chancellor
2025-10-16 6:06 ` Vishal Chourasia
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).