Message ID | 20200227045933.22967-1-mpe@ellerman.id.au (mailing list archive) |
---|---|
State | Accepted |
Commit | ead983604c5a390f1e3ce085945b60e82f08dbbe |
Headers | show |
Series | [1/2] powerpc/vmlinux.lds: Explicitly retain .gnu.hash | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch powerpc/merge (65b2623f395a4e25ab3ff4cff1c9c7623619a22d) |
snowpatch_ozlabs/checkpatch | warning | total: 0 errors, 1 warnings, 0 checks, 7 lines checked |
snowpatch_ozlabs/needsstable | success | Patch has no Fixes tags |
On Thu, Feb 27, 2020 at 03:59:32PM +1100, Michael Ellerman wrote: > 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. > > Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> > --- > arch/powerpc/kernel/vmlinux.lds.S | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S > index b4c89a1acebb..31a0f201fb6f 100644 > --- a/arch/powerpc/kernel/vmlinux.lds.S > +++ b/arch/powerpc/kernel/vmlinux.lds.S > @@ -256,6 +256,7 @@ SECTIONS > *(.dynamic) > } > .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) > { > -- > 2.21.1
Alan Modra <amodra@gmail.com> writes: > On Thu, Feb 27, 2020 at 03:59:32PM +1100, Michael Ellerman wrote: >> 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
On Thu, 2020-02-27 at 04:59:32 UTC, Michael Ellerman wrote: > 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. > > Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Applied to powerpc next. https://git.kernel.org/powerpc/c/ead983604c5a390f1e3ce085945b60e82f08dbbe cheers
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index b4c89a1acebb..31a0f201fb6f 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S @@ -256,6 +256,7 @@ SECTIONS *(.dynamic) } .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) {
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. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> --- arch/powerpc/kernel/vmlinux.lds.S | 1 + 1 file changed, 1 insertion(+)