With gold built from a recent SVN (GNU gold (GNU Binutils 2.20.51.20091220) 1.9) a Linux 2.6.33-rc1 kernel "make allyesconfig" fails with gold: fs/built-in.o:(.debug_info+0x181cb5): error: undefined reference to '__pcpu_scope_xfsstats' gold: fs/built-in.o:(.debug_info+0x181ce1): error: undefined reference to '__pcpu_unique_xfsstats' These are magic symbols used for CPU data, so it's probably some trick that gold doesn't like. An older gold from a few months ago failed in the same way. Standard ld works. Sorry no small test case, but can be reproduced by fetching 2.6.33-rc1 from kernel.org and building with make allyesconfig ; make
I haven't looked, but this is very likely another example of PR 10238.
Oh wait, sorry, this is the kernel itself. It must be something else.
The problem here is that the GNU linker does not warn when it sees a reference from a debugging section to a symbol defined in a section which is discarded by the linker script. I don't know whether this should be considered a bug in the GNU linker or not. I guess gold should be bug-compatible.
Subject: Bug 11108 CVSROOT: /cvs/src Module name: src Changes by: ian@sourceware.org 2010-01-09 00:13:49 Modified files: gold : ChangeLog resolve.cc symtab.cc symtab.h target-reloc.h Log message: PR 11108 * symtab.h (class Symbol): Remove fields is_target_special_ and has_plt_offset_. Add field is_defined_in_discarded_section_. (Symbol::is_defined_in_discarded_section): New function. (Symbol::set_is_defined_in_discarded_section): New function. (Symbol::has_plt_offset): Rewrite. (Symbol::set_plt_offset): Verify that new offset is not -1U. * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U. Don't initialize is_target_special_ or has_plt_offset_. Initialize is_defined_in_discarded_section_. (Symbol_table::add_from_relobj): If appropriate, set is_defined_in_discarded_section. * resolve.cc (Symbol::override_base_with_special): Don't test is_target_special_. Change has_plt_offset_ to has_plt_offset(). * target-reloc.h (relocate_section): Do special handling for symbols defined in discarded sections for global symbols as well as local symbols. Patches: http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.444&r2=1.445 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/resolve.cc.diff?cvsroot=src&r1=1.50&r2=1.51 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/symtab.cc.diff?cvsroot=src&r1=1.136&r2=1.137 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/symtab.h.diff?cvsroot=src&r1=1.103&r2=1.104 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/target-reloc.h.diff?cvsroot=src&r1=1.37&r2=1.38
I've committed a patch which should fix this problem. At least, the kernel does build now with gold, though I did not test whether it ran correctly after building.