I get the following error when trying to build the kernel with ld.gold - it works fine with ld.bfd axion linux # make CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h CHK include/generated/bounds.h CHK include/generated/timeconst.h CHK include/generated/asm-offsets.h CALL scripts/checksyscalls.sh CHK include/generated/compile.h CHK kernel/config_data.h EXPORTS drivers/firmware/efi/libstub/lib-ksyms.o LD drivers/firmware/efi/libstub/built-in.o LD drivers/firmware/efi/built-in.o LD drivers/firmware/built-in.o LD drivers/built-in.o EXPORTS lib/lib-ksyms.o ld: internal error in target, at /var/tmp/portage/sys-devel/binutils-2.26.1/work/binutils-2.26.1/gold/parameters.h:105 make[1]: *** [scripts/Makefile.build:432: lib/lib-ksyms.o] Error 1 make: *** [Makefile:978: lib] Error 2
I've bisected this back to: 7f2084fa55e6cb61f61b4224d4a8bafaeee55f9f is the first bad commit commit 7f2084fa55e6cb61f61b4224d4a8bafaeee55f9f Author: Al Viro <viro@zeniv.linux.org.uk> Date: Fri Jan 15 14:01:22 2016 -0500 [kbuild] handle exports in lib-y objects reliably Collect the symbols exported by anything that goes into lib.a and add an empty object (lib-exports.o) with explicit undefs for each of those to obj-y. That allows to relax the rules regarding the use of exports in lib-* objects - right now an object with export can be in lib-* only if we are guaranteed that there always will be users in built-in parts of the tree, otherwise it needs to be in obj-*. As the result, we have an unholy mix of lib- and obj- in lib/Makefile and (especially) in arch/*/lib/Makefile. Moreover, a change in generic part of the kernel can lead to mysteriously missing exports on some configs. With this change we don't have to worry about that anymore. One side effect is that built-in.o now pulls everything with exports from the corresponding lib.a (if such exists). That's exactly what we want for linking vmlinux and fortunately it's almost the only thing built-in.o is used in. arch/ia64/hp/sim/boot/bootloader is the only exception and it's easy to get rid of now - just turn everything in arch/ia64/lib into lib-* and don't bother with arch/ia64/lib/built-in.o anymore. [AV: stylistic fix from Michal folded in] Acked-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Reverting this patch allows me to compile the kernel with ld.gold again
There is a fix on the go for kbuild composed of two patches: - all arches: http://marc.info/?l=linux-kernel&m=147667665501297&w=2 and a per architectures one, for x86: - http://marc.info/?l=linux-kernel&m=147669851906489&w=2 You might want to try those but they might not do for ld.gold: http://marc.info/?l=linux-kernel&m=147682325012335&w=2 tells > > > > > > When I revert > > > > > > 784d5699eddc ("x86: move exports to actual definitions") > > > > > > the warnings are gone. > Also ld.gold doesn't handle linker scripts with empty archives. > It hits an internal error, see: > https://sourceware.org/bugzilla/show_bug.cgi?id=20693
We're at rc5 now and I was wondering if you were any closer to getting a fix (or a revert) merged
Most of it is queued in https://git.kernel.org/cgit/linux/kernel/git/mmarek/kbuild.git/log/?h=rc-fixes that is : https://git.kernel.org/cgit/linux/kernel/git/mmarek/kbuild.git/commit/?h=rc-fixes&id=4efca4ed05cbdfd13ec3e8cb623fb77d6e4ab187 but arch (here x86) bits are missing : http://marc.info/?l=linux-kernel&m=147808873514195&w=2
We're really close to 4.9 being released, are there plans to get this fixed before it does?
Created attachment 246881 [details] This gets it building for me
(In reply to Mike Lothian from comment #6) > Created attachment 246881 [details] > This gets it building for me Mike Lothian's patch works for me too (in addition to the patch in bug 187841). I'm starting to wish for a Kconfig option to set "-fuse-ld=bfd" globally...
Try link binutils self with ld.gold. After swith my gentoo box to ld.gold, my sys-kernel/gentoo-sources-4.9.5 happend the same link failed. Only last this issue: LD arch/x86/boot/compressed/vmlinux ld: arch/x86/boot/compressed/head_64.o: warning: relocation in readonly section `.head.text' ld: warning: creating a DT_TEXTREL in a shared object. ZOFFSET arch/x86/boot/zoffset.h
(In reply to henglinli from comment #8) > Try link binutils self with ld.gold. > After swith my gentoo box to ld.gold, my sys-kernel/gentoo-sources-4.9.5 > happend the same link failed. > Only last this issue: > LD arch/x86/boot/compressed/vmlinux > ld: arch/x86/boot/compressed/head_64.o: warning: relocation in readonly > section `.head.text' > ld: warning: creating a DT_TEXTREL in a shared object. > ZOFFSET arch/x86/boot/zoffset.h I also experience the same symptoms with 4.8.17. Although it doesn't limit functionality, it's disturbing.