Bug 11108 - gold doesn't build Linux kernel 2.6.33-rc1 allyesconfig
Summary: gold doesn't build Linux kernel 2.6.33-rc1 allyesconfig
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.21
: P2 normal
Target Milestone: ---
Assignee: Ian Lance Taylor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-20 00:47 UTC by Andi Kleen
Modified: 2010-01-09 00:27 UTC (History)
1 user (show)

See Also:
Host: x86_64-linux
Target: x86_64-linux
Build: x86_64-linux
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andi Kleen 2009-12-20 00:47:43 UTC
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
Comment 1 Ian Lance Taylor 2009-12-22 14:10:59 UTC
I haven't looked, but this is very likely another example of PR 10238.
Comment 2 Ian Lance Taylor 2009-12-22 14:11:38 UTC
Oh wait, sorry, this is the kernel itself.  It must be something else.
Comment 3 Ian Lance Taylor 2010-01-08 23:21:41 UTC
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.
Comment 4 Sourceware Commits 2010-01-09 00:14:02 UTC
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

Comment 5 Ian Lance Taylor 2010-01-09 00:27:21 UTC
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.