]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/vmlinux.lds: Don't discard .rela* for relocatable builds
authorMichael Ellerman <mpe@ellerman.id.au>
Thu, 2 Mar 2023 02:07:02 +0000 (19:07 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2023 07:32:53 +0000 (08:32 +0100)
commit94e6880af6e35c59d087005ad2c34807e6973250
treeef573e5b7833c460b5611b761d2defb2ef03844f
parent7d705e1383d09655eb2edc5057214fd2e2493854
powerpc/vmlinux.lds: Don't discard .rela* for relocatable builds

commit 8da5d5380d3d970e7ba28491abe361b0b2581f53 upstream.

Relocatable kernels must not discard relocations, they need to be
processed at runtime. As such they are included for CONFIG_RELOCATABLE
builds in the powerpc linker script (line 340).

However they are also unconditionally discarded later in the
script (line 414). Previously that worked because the earlier inclusion
superseded the discard.

However commit fe15ce495a51 ("arch: fix broken BuildID for arm64 and
riscv") introduced an earlier use of DISCARD as part of the RO_DATA
macro (line 137). With binutils < 2.36 that causes the DISCARD
directives later in the script to be applied earlier, causing .rela* to
actually be discarded at link time, leading to build warnings and a
kernel that doesn't boot:

  ld: warning: discarding dynamic section .rela.init.rodata

Fix it by conditionally discarding .rela* only when CONFIG_RELOCATABLE
is disabled.

Fixes: fe15ce495a51 ("arch: fix broken BuildID for arm64 and riscv")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230105132349.384666-2-mpe@ellerman.id.au
Signed-off-by: Tom Saeger <tom.saeger@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/kernel/vmlinux.lds.S