public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] powerpc/build: vdso linker warning for orphan sections
       [not found] <20230609051002.3342-1-npiggin@gmail.com>
@ 2023-07-17 19:43 ` John Ogness
  2023-07-18 12:59   ` Michael Ellerman
  0 siblings, 1 reply; 5+ messages in thread
From: John Ogness @ 2023-07-17 19:43 UTC (permalink / raw)
  To: Nicholas Piggin; +Cc: linuxppc-dev, Michael Ellerman, linux-kernel

Hi Nicholas,

On 2023-06-09, Nicholas Piggin <npiggin@gmail.com> wrote:
> Add --orphan-handlin for vdsos, and adjust vdso linker scripts to deal
> with orphan sections.

I'm reporting that I am getting a linker warning with 6.5-rc2. The
warning message is:

ld: warning: discarding dynamic section .rela.opd

and bisects to:

8ad57add77d3 ("powerpc/build: vdso linker warning for orphan sections")

Despite the warning, my ppc64 system seems to run fine. Let me know if
you need any other information from me.

I noticed [0] this with 6.5-rc1 but didn't contact the right people.

John Ogness

[0] https://lore.kernel.org/lkml/871qhf1q3j.fsf@jogness.linutronix.de

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

* Re: [PATCH] powerpc/build: vdso linker warning for orphan sections
  2023-07-17 19:43 ` [PATCH] powerpc/build: vdso linker warning for orphan sections John Ogness
@ 2023-07-18 12:59   ` Michael Ellerman
  2023-07-18 14:22     ` John Ogness
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2023-07-18 12:59 UTC (permalink / raw)
  To: John Ogness, Nicholas Piggin; +Cc: linuxppc-dev, linux-kernel

John Ogness <john.ogness@linutronix.de> writes:
> Hi Nicholas,
>
> On 2023-06-09, Nicholas Piggin <npiggin@gmail.com> wrote:
>> Add --orphan-handlin for vdsos, and adjust vdso linker scripts to deal
>> with orphan sections.
>
> I'm reporting that I am getting a linker warning with 6.5-rc2. The
> warning message is:
>
> ld: warning: discarding dynamic section .rela.opd
>
> and bisects to:
>
> 8ad57add77d3 ("powerpc/build: vdso linker warning for orphan sections")
>
> Despite the warning, my ppc64 system seems to run fine. Let me know if
> you need any other information from me.

We already discard .opd and .rela*, so I guess we should also be
discarding .rela.opd.

Can you test with a newer compiler/binutils?

cheers

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

* Re: [PATCH] powerpc/build: vdso linker warning for orphan sections
  2023-07-18 12:59   ` Michael Ellerman
@ 2023-07-18 14:22     ` John Ogness
  2023-07-19 11:55       ` Michael Ellerman
  0 siblings, 1 reply; 5+ messages in thread
From: John Ogness @ 2023-07-18 14:22 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin; +Cc: linuxppc-dev, linux-kernel

On 2023-07-18, Michael Ellerman <mpe@ellerman.id.au> wrote:
>> ld: warning: discarding dynamic section .rela.opd
>>
>> and bisects to:
>>
>> 8ad57add77d3 ("powerpc/build: vdso linker warning for orphan sections")
>
> Can you test with a newer compiler/binutils?

Testing the Debian release cross compilers/binutils:

Debian 10 / gcc 8.3.0  / ld 2.31.1: generates the warning

Debian 11 / gcc 10.2.1 / ld 2.35.2: generates the warning

Debian 12 / gcc 12.2.0 / ld 2.40:   does _not_ generate the warning

I suppose moving to the newer toolchain is the workaround. Although it
is a bit unusual to require such a modern toolchain in order to build a
kernel without warnings.

John Ogness

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

* Re: [PATCH] powerpc/build: vdso linker warning for orphan sections
  2023-07-18 14:22     ` John Ogness
@ 2023-07-19 11:55       ` Michael Ellerman
  2023-07-19 17:10         ` John Ogness
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2023-07-19 11:55 UTC (permalink / raw)
  To: John Ogness, Nicholas Piggin; +Cc: linuxppc-dev, linux-kernel

John Ogness <john.ogness@linutronix.de> writes:
> On 2023-07-18, Michael Ellerman <mpe@ellerman.id.au> wrote:
>>> ld: warning: discarding dynamic section .rela.opd
>>>
>>> and bisects to:
>>>
>>> 8ad57add77d3 ("powerpc/build: vdso linker warning for orphan sections")
>>
>> Can you test with a newer compiler/binutils?
>
> Testing the Debian release cross compilers/binutils:
>
> Debian 10 / gcc 8.3.0  / ld 2.31.1: generates the warning
>
> Debian 11 / gcc 10.2.1 / ld 2.35.2: generates the warning
>
> Debian 12 / gcc 12.2.0 / ld 2.40:   does _not_ generate the warning
>
> I suppose moving to the newer toolchain is the workaround. Although it
> is a bit unusual to require such a modern toolchain in order to build a
> kernel without warnings.

I didn't mean that you should move to a new toolchain to avoid the
warning, I was just curious why you're the only person to see it.

I regularly test with a gcc 5.5.0 / ld 2.29 toolchain and gcc 13.1.1 /
ld 2.39, and I haven't seen the warning. I tried a bunch of others and
can't reproduce it.

Can you confirm that this makes the warning go away?

cheers


diff --git a/arch/powerpc/kernel/vdso/vdso64.lds.S b/arch/powerpc/kernel/vdso/vdso64.lds.S
index bda6c8cdd459..286e1597c548 100644
--- a/arch/powerpc/kernel/vdso/vdso64.lds.S
+++ b/arch/powerpc/kernel/vdso/vdso64.lds.S
@@ -85,7 +85,7 @@ SECTIONS
 		*(.branch_lt)
 		*(.data .data.* .gnu.linkonce.d.* .sdata*)
 		*(.bss .sbss .dynbss .dynsbss)
-		*(.opd)
+		*(.opd .rela.opd)
 		*(.glink .iplt .plt .rela*)
 	}
 }

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

* Re: [PATCH] powerpc/build: vdso linker warning for orphan sections
  2023-07-19 11:55       ` Michael Ellerman
@ 2023-07-19 17:10         ` John Ogness
  0 siblings, 0 replies; 5+ messages in thread
From: John Ogness @ 2023-07-19 17:10 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin; +Cc: linuxppc-dev, linux-kernel

Hi Michael,

On 2023-07-19, Michael Ellerman <mpe@ellerman.id.au> wrote:
> I regularly test with a gcc 5.5.0 / ld 2.29 toolchain and gcc 13.1.1 /
> ld 2.39, and I haven't seen the warning. I tried a bunch of others and
> can't reproduce it.

I will send my config in a separate email (without the lists in
CC). Building the vdso_prepare target is all that is needed.

> Can you confirm that this makes the warning go away?
>
> diff --git a/arch/powerpc/kernel/vdso/vdso64.lds.S b/arch/powerpc/kernel/vdso/vdso64.lds.S
> index bda6c8cdd459..286e1597c548 100644
> --- a/arch/powerpc/kernel/vdso/vdso64.lds.S
> +++ b/arch/powerpc/kernel/vdso/vdso64.lds.S
> @@ -85,7 +85,7 @@ SECTIONS
>  		*(.branch_lt)
>  		*(.data .data.* .gnu.linkonce.d.* .sdata*)
>  		*(.bss .sbss .dynbss .dynsbss)
> -		*(.opd)
> +		*(.opd .rela.opd)
>  		*(.glink .iplt .plt .rela*)

Hmmm. Not sure what that would change. And indeed it does not make the
warning go away.

Doing some testing it seems that previously .rela.opd was being silently
placed in the .rela.dyn section. So doing that explicitly obviously gets
rid of the warning:

Index: linux-6.5-rc2/arch/powerpc/kernel/vdso/vdso64.lds.S
===================================================================
--- linux-6.5-rc2.orig/arch/powerpc/kernel/vdso/vdso64.lds.S
+++ linux-6.5-rc2/arch/powerpc/kernel/vdso/vdso64.lds.S
@@ -69,7 +69,7 @@ SECTIONS
 	.eh_frame_hdr	: { *(.eh_frame_hdr) }		:text	:eh_frame_hdr
 	.eh_frame	: { KEEP (*(.eh_frame)) }	:text
 	.gcc_except_table : { *(.gcc_except_table) }
-	.rela.dyn ALIGN(8) : { *(.rela.dyn) }
+	.rela.dyn ALIGN(8) : { *(.rela.dyn) *(.rela.opd) }
 
 	.got ALIGN(8)	: { *(.got .toc) }

But if the goal is to get rid of .rela.opd then the question is: why is
the linker complaining about it being discarded?

John

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

end of thread, other threads:[~2023-07-19 17:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230609051002.3342-1-npiggin@gmail.com>
2023-07-17 19:43 ` [PATCH] powerpc/build: vdso linker warning for orphan sections John Ogness
2023-07-18 12:59   ` Michael Ellerman
2023-07-18 14:22     ` John Ogness
2023-07-19 11:55       ` Michael Ellerman
2023-07-19 17:10         ` John Ogness

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox