Map ".text.hot" and ".text.unlikely" input section prefixes to separate output sections.

Ian Lance Taylor iant@google.com
Fri Dec 21 06:27:00 GMT 2012
On Thu, Dec 20, 2012 at 2:38 PM, Cary Coutant <ccoutant@google.com> wrote:
> This patch fixes the problems I've been seeing. It sets the "may sort
> attached input sections" flag for the .text section, which ensures
> that we track all input sections for that output section. The problem
> was that we can't start tracking input sections in mid-stream. We may
> not want to do this unconditionally for .text, so maybe you'll want a
> linker option to enable this reordering?

Thanks for tracking this down.

It would be nice to avoid doing it for .text, but I don't see how to
do that while remaining compatible with GNU ld.

I reimplemented this code in a different way that I think fits in
better with the existing section ordering code.  Committed to
mainline.

Ian


2012-12-20  Ian Lance Taylor  <iant@google.com>

	* layout.cc (Layout::special_ordering_of_input_section): New
	function.
	(Layout::layout): If input section requires special ordering, must
	sort input sections.
	(Layout::make_output_section): May sort .text input sections.
	(Layout::is_section_name_prefix_grouped): Remove.
	* layout.h (class Layout): Declare
	special_ordering_of_input_section.  Don't declare
	is_section_name_prefix_grouped.
	* output.cc (Output_section::add_input_section): Revert last
	change.
	(Output_section::Input_section_sort::match_file_name): Don't crash
	if called on output section data.
	(Output_section::Input_section_sort_compare): Sort based on
	special ordering.
	(Output_section::Input_section_sort_section_order_index_compare):
	Revert last patch.
	(Output_section::sort_attached_input_sections): Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: application/octet-stream
Size: 10349 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20121221/1a9c615e/attachment.obj>


More information about the Binutils mailing list