gold patch committed: Rewrite orphan section handling

Ian Lance Taylor iant@google.com
Thu Mar 19 05:58:00 GMT 2009


I got a bug report that gold was failing to build the Linux kernel.  It
turned out to be gold and the GNU linker differed in how they handle
orphan sections (an orphan section is an output section which is not
named in the linker script; you can only have orphan sections when using
a linker script, which is not the default for gold).  gold was placing
the .eh_frame section, which was not named in the linker script, after a
new .bsdata section, where GNU ld was putting it after the .rodata
section.

The gold orphan section placement is also rather slow when there are a
lot of orphan sections.

I committed this patch to make gold's orphan section handling much more
like the GNU linkers.  This should also make it faster.

Ian


2009-03-18  Ian Lance Taylor  <iant@google.com>

	* script-sections.h: Include <list>.
	(class Script_sections): Change Sections_elements from std::vector
	to std::list.  Typedef public Elements_iterator.  Add
	orphan_section_placement_, data_segment_align_start_, and
	saw_data_segment_align_ fields.  Remove data_segment_align_index_
	field.
	* script-sections.cc (class Orphan_section_placement): New class.
	(class Sections_element): Add virtual functions is_relro and
	orphan_section_init.  Remove virtual function place_orphan_here.
	(class Output_section_definition): Add is_relro and
	orphan_section_init.  Remove place_orphan_here.
	(class Orphan_output_section): Likewise.
	(Script_sections::Script_sections): Update for field changes.
	(Script_sections::data_segment_align): Set saw_data_segment_align_
	and data_segment_align_start_, not data_segment_align_index.
	(Script_sections::data_segment_relro_end): Check
	saw_data_segment_align_.  Use data_segment_align_start_ rather
	than data_segment_align_index_.
	(Script_sections::place_orphan): Rewrite to use
	Orphan_section_placement.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-patch
Size: 20351 bytes
Desc: Change orphan section handling
URL: <https://sourceware.org/pipermail/binutils/attachments/20090319/6233fe2e/attachment.bin>


More information about the Binutils mailing list