All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/build: vdso linker warning for orphan sections
@ 2021-06-11 11:10 Nicholas Piggin
  2021-06-16 22:45 ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Nicholas Piggin @ 2021-06-11 11:10 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin

Add --orphan-handling=warn for vdsos, and adjust vdso linker scripts to
deal with orphan sections.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/kernel/vdso32/Makefile     | 2 +-
 arch/powerpc/kernel/vdso32/vdso32.lds.S | 3 ++-
 arch/powerpc/kernel/vdso64/Makefile     | 2 +-
 arch/powerpc/kernel/vdso64/vdso64.lds.S | 3 ++-
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/vdso32/Makefile b/arch/powerpc/kernel/vdso32/Makefile
index 7d9a6fee0e3d..403033013848 100644
--- a/arch/powerpc/kernel/vdso32/Makefile
+++ b/arch/powerpc/kernel/vdso32/Makefile
@@ -66,7 +66,7 @@ include/generated/vdso32-offsets.h: $(obj)/vdso32.so.dbg FORCE
 
 # actual build commands
 quiet_cmd_vdso32ld_and_check = VDSO32L $@
-      cmd_vdso32ld_and_check = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) ; $(cmd_vdso_check)
+      cmd_vdso32ld_and_check = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) $(if $(CONFIG_LD_ORPHAN_WARN), -Wl$(comma)--orphan-handling=warn) ; $(cmd_vdso_check)
 quiet_cmd_vdso32as = VDSO32A $@
       cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) -c -o $@ $<
 quiet_cmd_vdso32cc = VDSO32C $@
diff --git a/arch/powerpc/kernel/vdso32/vdso32.lds.S b/arch/powerpc/kernel/vdso32/vdso32.lds.S
index 58e0099f70f4..b42e8759e67a 100644
--- a/arch/powerpc/kernel/vdso32/vdso32.lds.S
+++ b/arch/powerpc/kernel/vdso32/vdso32.lds.S
@@ -85,9 +85,10 @@ SECTIONS
 
 	/DISCARD/	: {
 		*(.note.GNU-stack)
+		*(.branch_lt)
 		*(.data .data.* .gnu.linkonce.d.* .sdata*)
 		*(.bss .sbss .dynbss .dynsbss)
-		*(.got1)
+		*(.got1 .glink .iplt .rela*)
 	}
 }
 
diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile
index d783c07e558f..980dfd631a08 100644
--- a/arch/powerpc/kernel/vdso64/Makefile
+++ b/arch/powerpc/kernel/vdso64/Makefile
@@ -59,4 +59,4 @@ include/generated/vdso64-offsets.h: $(obj)/vdso64.so.dbg FORCE
 
 # actual build commands
 quiet_cmd_vdso64ld_and_check = VDSO64L $@
-      cmd_vdso64ld_and_check = $(CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^); $(cmd_vdso_check)
+      cmd_vdso64ld_and_check = $(CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) $(if $(CONFIG_LD_ORPHAN_WARN), -Wl$(comma)--orphan-handling=warn) ; $(cmd_vdso_check)
diff --git a/arch/powerpc/kernel/vdso64/vdso64.lds.S b/arch/powerpc/kernel/vdso64/vdso64.lds.S
index 0288cad428b0..3750b3b15b51 100644
--- a/arch/powerpc/kernel/vdso64/vdso64.lds.S
+++ b/arch/powerpc/kernel/vdso64/vdso64.lds.S
@@ -33,7 +33,7 @@ SECTIONS
 	. = ALIGN(16);
 	.text		: {
 		*(.text .stub .text.* .gnu.linkonce.t.* __ftr_alt_*)
-		*(.sfpr .glink)
+		*(.sfpr)
 	}						:text
 	PROVIDE(__etext = .);
 	PROVIDE(_etext = .);
@@ -87,6 +87,7 @@ SECTIONS
 		*(.data .data.* .gnu.linkonce.d.* .sdata*)
 		*(.bss .sbss .dynbss .dynsbss)
 		*(.opd)
+		*(.glink .iplt .plt .rela*)
 	}
 }
 
-- 
2.23.0


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

* Re: [PATCH] powerpc/build: vdso linker warning for orphan sections
  2021-06-11 11:10 [PATCH] powerpc/build: vdso linker warning for orphan sections Nicholas Piggin
@ 2021-06-16 22:45 ` kernel test robot
  2021-06-16 22:59 ` kernel test robot
  2021-06-17  1:48 ` Nicholas Piggin
  2 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2021-06-16 22:45 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1981 bytes --]

Hi Nicholas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on v5.13-rc6 next-20210616]
[cannot apply to scottwood/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Nicholas-Piggin/powerpc-build-vdso-linker-warning-for-orphan-sections/20210616-123155
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/c16d1f65a49de22ffb37b84c51010a87fe155fe2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Nicholas-Piggin/powerpc-build-vdso-linker-warning-for-orphan-sections/20210616-123155
        git checkout c16d1f65a49de22ffb37b84c51010a87fe155fe2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   scripts/genksyms/parse.y: warning: 9 shift/reduce conflicts [-Wconflicts-sr]
   scripts/genksyms/parse.y: warning: 5 reduce/reduce conflicts [-Wconflicts-rr]
>> /opt/cross/gcc-9.3.0-nolibc/powerpc64-linux/bin/../lib/gcc/powerpc64-linux/9.3.0/../../../../powerpc64-linux/bin/ld: warning: discarding dynamic section .rela.opd

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 73412 bytes --]

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

* Re: [PATCH] powerpc/build: vdso linker warning for orphan sections
  2021-06-11 11:10 [PATCH] powerpc/build: vdso linker warning for orphan sections Nicholas Piggin
  2021-06-16 22:45 ` kernel test robot
@ 2021-06-16 22:59 ` kernel test robot
  2021-06-17  1:48 ` Nicholas Piggin
  2 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2021-06-16 22:59 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2126 bytes --]

Hi Nicholas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on v5.13-rc6 next-20210616]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Nicholas-Piggin/powerpc-build-vdso-linker-warning-for-orphan-sections/20210616-123155
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-ppa8548_defconfig (attached as .config)
compiler: powerpc-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/c16d1f65a49de22ffb37b84c51010a87fe155fe2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Nicholas-Piggin/powerpc-build-vdso-linker-warning-for-orphan-sections/20210616-123155
        git checkout c16d1f65a49de22ffb37b84c51010a87fe155fe2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> /opt/cross/gcc-9.3.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/9.3.0/../../../../powerpc-linux/bin/ld: warning: orphan section `.PPC.EMB.apuinfo' from `arch/powerpc/kernel/vdso32/vgettimeofday.o' being placed in section `.PPC.EMB.apuinfo'
--
>> /opt/cross/gcc-9.3.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/9.3.0/../../../../powerpc-linux/bin/ld: warning: orphan section `.PPC.EMB.apuinfo' from `arch/powerpc/kernel/vdso32/vgettimeofday.o' being placed in section `.PPC.EMB.apuinfo'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 13616 bytes --]

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

* Re: [PATCH] powerpc/build: vdso linker warning for orphan sections
  2021-06-11 11:10 [PATCH] powerpc/build: vdso linker warning for orphan sections Nicholas Piggin
  2021-06-16 22:45 ` kernel test robot
  2021-06-16 22:59 ` kernel test robot
@ 2021-06-17  1:48 ` Nicholas Piggin
  2 siblings, 0 replies; 14+ messages in thread
From: Nicholas Piggin @ 2021-06-17  1:48 UTC (permalink / raw)
  To: linuxppc-dev

Excerpts from Nicholas Piggin's message of June 11, 2021 9:10 pm:
> Add --orphan-handling=warn for vdsos, and adjust vdso linker scripts to
> deal with orphan sections.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Okay it looks like modules should discard .PPC.EMB.apuinfo. Not entirely 
sure about .rela.opd.

Thanks,
Nick

^ permalink raw reply	[flat|nested] 14+ 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; 14+ 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] 14+ 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; 14+ 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] 14+ 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; 14+ 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] 14+ messages in thread

* Re: [PATCH] powerpc/build: vdso linker warning for orphan sections
  2023-07-17 19:43   ` John Ogness
  (?)
@ 2023-07-18 12:59   ` Michael Ellerman
  2023-07-18 14:22     ` John Ogness
  -1 siblings, 1 reply; 14+ 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] 14+ messages in thread

* Re: [PATCH] powerpc/build: vdso linker warning for orphan sections
  2023-06-09  5:10 Nicholas Piggin
@ 2023-07-17 19:43   ` John Ogness
  2023-07-17 19:43   ` John Ogness
  1 sibling, 0 replies; 14+ 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] 14+ messages in thread

* Re: [PATCH] powerpc/build: vdso linker warning for orphan sections
@ 2023-07-17 19:43   ` John Ogness
  0 siblings, 0 replies; 14+ messages in thread
From: John Ogness @ 2023-07-17 19:43 UTC (permalink / raw)
  To: Nicholas Piggin; +Cc: linuxppc-dev, 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] 14+ messages in thread

* Re: [PATCH] powerpc/build: vdso linker warning for orphan sections
  2023-06-09  5:10 Nicholas Piggin
@ 2023-07-03  5:26 ` Michael Ellerman
  2023-07-17 19:43   ` John Ogness
  1 sibling, 0 replies; 14+ messages in thread
From: Michael Ellerman @ 2023-07-03  5:26 UTC (permalink / raw)
  To: linuxppc-dev, Nicholas Piggin

On Fri, 09 Jun 2023 15:10:02 +1000, Nicholas Piggin wrote:
> Add --orphan-handlin for vdsos, and adjust vdso linker scripts to deal
> with orphan sections.
> 
> 

Applied to powerpc/next.

[1/1] powerpc/build: vdso linker warning for orphan sections
      https://git.kernel.org/powerpc/c/8ad57add77d352102ba9edd500b00bc851c2e261

cheers

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

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

Add --orphan-handlin for vdsos, and adjust vdso linker scripts to deal
with orphan sections.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/kernel/vdso/Makefile     | 2 ++
 arch/powerpc/kernel/vdso/vdso32.lds.S | 4 +++-
 arch/powerpc/kernel/vdso/vdso64.lds.S | 4 +++-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
index 4c3f34485f08..23ee96106537 100644
--- a/arch/powerpc/kernel/vdso/Makefile
+++ b/arch/powerpc/kernel/vdso/Makefile
@@ -56,6 +56,8 @@ KCSAN_SANITIZE := n
 ccflags-y := -fno-common -fno-builtin
 ldflags-y := -Wl,--hash-style=both -nostdlib -shared -z noexecstack
 ldflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
+ldflags-$(CONFIG_LD_ORPHAN_WARN) += -Wl,--orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL)
+
 # Filter flags that clang will warn are unused for linking
 ldflags-y += $(filter-out $(CC_AUTO_VAR_INIT_ZERO_ENABLER) $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CFLAGS))
 
diff --git a/arch/powerpc/kernel/vdso/vdso32.lds.S b/arch/powerpc/kernel/vdso/vdso32.lds.S
index bc0be274a9ac..426e1ccc6971 100644
--- a/arch/powerpc/kernel/vdso/vdso32.lds.S
+++ b/arch/powerpc/kernel/vdso/vdso32.lds.S
@@ -83,9 +83,11 @@ SECTIONS
 
 	/DISCARD/	: {
 		*(.note.GNU-stack)
+		*(*.EMB.apuinfo)
+		*(.branch_lt)
 		*(.data .data.* .gnu.linkonce.d.* .sdata*)
 		*(.bss .sbss .dynbss .dynsbss)
-		*(.got1)
+		*(.got1 .glink .iplt .rela*)
 	}
 }
 
diff --git a/arch/powerpc/kernel/vdso/vdso64.lds.S b/arch/powerpc/kernel/vdso/vdso64.lds.S
index 744ae5363e6c..bda6c8cdd459 100644
--- a/arch/powerpc/kernel/vdso/vdso64.lds.S
+++ b/arch/powerpc/kernel/vdso/vdso64.lds.S
@@ -32,7 +32,7 @@ SECTIONS
 	. = ALIGN(16);
 	.text		: {
 		*(.text .stub .text.* .gnu.linkonce.t.* __ftr_alt_*)
-		*(.sfpr .glink)
+		*(.sfpr)
 	}						:text
 	PROVIDE(__etext = .);
 	PROVIDE(_etext = .);
@@ -81,10 +81,12 @@ SECTIONS
 
 	/DISCARD/	: {
 		*(.note.GNU-stack)
+		*(*.EMB.apuinfo)
 		*(.branch_lt)
 		*(.data .data.* .gnu.linkonce.d.* .sdata*)
 		*(.bss .sbss .dynbss .dynsbss)
 		*(.opd)
+		*(.glink .iplt .plt .rela*)
 	}
 }
 
-- 
2.40.1


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

* Re: [PATCH] powerpc/build: vdso linker warning for orphan sections
  2020-03-03  1:27 Nicholas Piggin
@ 2020-07-30 12:50 ` Michael Ellerman
  0 siblings, 0 replies; 14+ messages in thread
From: Michael Ellerman @ 2020-07-30 12:50 UTC (permalink / raw)
  To: linuxppc-dev, Nicholas Piggin

On Tue, 3 Mar 2020 11:27:48 +1000, Nicholas Piggin wrote:
> 


Applied to powerpc/next.

[1/1] powerpc/build: vdso linker warning for orphan sections
      https://git.kernel.org/powerpc/c/f2af201002a8bc22500c04cc474ea480bf361351

cheers

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

* [PATCH] powerpc/build: vdso linker warning for orphan sections
@ 2020-03-03  1:27 Nicholas Piggin
  2020-07-30 12:50 ` Michael Ellerman
  0 siblings, 1 reply; 14+ messages in thread
From: Nicholas Piggin @ 2020-03-03  1:27 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/kernel/vdso32/Makefile     | 2 +-
 arch/powerpc/kernel/vdso32/vdso32.lds.S | 1 +
 arch/powerpc/kernel/vdso64/Makefile     | 2 +-
 arch/powerpc/kernel/vdso64/vdso64.lds.S | 3 ++-
 4 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/vdso32/Makefile b/arch/powerpc/kernel/vdso32/Makefile
index e147bbdc12cd..87ab1152d5ce 100644
--- a/arch/powerpc/kernel/vdso32/Makefile
+++ b/arch/powerpc/kernel/vdso32/Makefile
@@ -50,7 +50,7 @@ $(obj-vdso32): %.o: %.S FORCE
 
 # actual build commands
 quiet_cmd_vdso32ld = VDSO32L $@
-      cmd_vdso32ld = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^)
+      cmd_vdso32ld = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ $(call cc-ldoption, -Wl$(comma)--orphan-handling=warn) -Wl,-T$(filter %.lds,$^) $(filter %.o,$^)
 quiet_cmd_vdso32as = VDSO32A $@
       cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) -c -o $@ $<
 
diff --git a/arch/powerpc/kernel/vdso32/vdso32.lds.S b/arch/powerpc/kernel/vdso32/vdso32.lds.S
index 5206c2eb2a1d..4c985467a668 100644
--- a/arch/powerpc/kernel/vdso32/vdso32.lds.S
+++ b/arch/powerpc/kernel/vdso32/vdso32.lds.S
@@ -111,6 +111,7 @@ SECTIONS
 		*(.note.GNU-stack)
 		*(.data .data.* .gnu.linkonce.d.* .sdata*)
 		*(.bss .sbss .dynbss .dynsbss)
+		*(.glink .iplt .plt .rela*)
 	}
 }
 
diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile
index 32ebb3522ea1..38c317f25141 100644
--- a/arch/powerpc/kernel/vdso64/Makefile
+++ b/arch/powerpc/kernel/vdso64/Makefile
@@ -34,7 +34,7 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE
 
 # actual build commands
 quiet_cmd_vdso64ld = VDSO64L $@
-      cmd_vdso64ld = $(CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^)
+      cmd_vdso64ld = $(CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) $(call cc-ldoption, -Wl$(comma)--orphan-handling=warn)
 
 # install commands for the unstripped file
 quiet_cmd_vdso_install = INSTALL $@
diff --git a/arch/powerpc/kernel/vdso64/vdso64.lds.S b/arch/powerpc/kernel/vdso64/vdso64.lds.S
index 256fb9720298..4e3a8d4ee614 100644
--- a/arch/powerpc/kernel/vdso64/vdso64.lds.S
+++ b/arch/powerpc/kernel/vdso64/vdso64.lds.S
@@ -30,7 +30,7 @@ SECTIONS
 	. = ALIGN(16);
 	.text		: {
 		*(.text .stub .text.* .gnu.linkonce.t.* __ftr_alt_*)
-		*(.sfpr .glink)
+		*(.sfpr)
 	}						:text
 	PROVIDE(__etext = .);
 	PROVIDE(_etext = .);
@@ -111,6 +111,7 @@ SECTIONS
 		*(.branch_lt)
 		*(.data .data.* .gnu.linkonce.d.* .sdata*)
 		*(.bss .sbss .dynbss .dynsbss)
+		*(.glink .iplt .plt .rela*)
 	}
 }
 
-- 
2.23.0


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

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

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-11 11:10 [PATCH] powerpc/build: vdso linker warning for orphan sections Nicholas Piggin
2021-06-16 22:45 ` kernel test robot
2021-06-16 22:59 ` kernel test robot
2021-06-17  1:48 ` Nicholas Piggin
  -- strict thread matches above, loose matches on Subject: below --
2023-06-09  5:10 Nicholas Piggin
2023-07-03  5:26 ` Michael Ellerman
2023-07-17 19:43 ` John Ogness
2023-07-17 19:43   ` 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
2020-03-03  1:27 Nicholas Piggin
2020-07-30 12:50 ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.