gold patch committed: Fix debug info for commons in shared libraries

Ian Lance Taylor
Wed Mar 4 06:53:00 GMT 2009

PR 9918 is about a bug in gold in which it does not generate correct
debugging information for common symbols in shared libraries.  The bug
only occurred for the x86 target (not x86_64).  gold does not scan
relocs for sections with the SHF_ALLOC flag clear.  When i386 gold is
processing relocs, it skips applying relocs which will get a dynamic
reloc.  However, the calculation for whether a reloc would get a dynamic
reloc was flawed, because it did not consider the sections with
SHF_ALLOC clear which had been skipped.

I committed this patch to fix the problem, along with a test case.


2009-03-03  Ian Lance Taylor  <>

	PR 9918
	* target-reloc.h (relocate_section): Pass output_section to
	* (Target_i386::should_apply_static_reloc): Add
	output_section parameter.  Change all callers.
	(Target_i386::Relocate::relocate): Add output_section parameter.
	* (Target_x86_64::Relocate::relocate): Likewise.
	* (Target_sparc::Relocate::relocate): Likewise.
	* (Target_powerpc::Relocate::relocate): Likewise.
	* testsuite/ New script.
	* testsuite/ (check_SCRIPTS): Add
	(check_DATA): Add two_file_shared.dbg.
	(two_file_shared.dbg): New target.
	* testsuite/ Rebuild.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-patch
Size: 11800 bytes
Desc: Fix debug info for commons in shared libraries
URL: <>

More information about the Binutils mailing list