Alan Modra [off-list ref] writes:
On Thu, Feb 27, 2020 at 03:59:32PM +1100, Michael Ellerman wrote:
quoted
Relocatable kernel builds produce a warning about .gnu.hash being an
orphan section:
ld: warning: orphan section `.gnu.hash' from `linker stubs' being placed in section `.gnu.hash'
If we try to discard it the build fails:
ld -EL -m elf64lppc -pie --orphan-handling=warn --build-id -o
.tmp_vmlinux1 -T ./arch/powerpc/kernel/vmlinux.lds --whole-archive
arch/powerpc/kernel/head_64.o arch/powerpc/kernel/entry_64.o
...
sound/built-in.a net/built-in.a virt/built-in.a --no-whole-archive
--start-group lib/lib.a --end-group
ld: could not find section .gnu.hash
So add an entry to explicitly retain it, as we do for .hash.
Looks fine to me. You can also pass --hash-style=sysv to ld (since
binutils-2.18) to disable generation of .gnu.hash.
Our current minimum is 2.21, so that's probably 5-10 years away :)
cheers