Maintain order of LTO sections
commit805389b2340140c0b46a374f0a5dce3b9eefed40
authorak <ak@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 Oct 2011 14:12:37 +0000 (4 14:12 +0000)
committerak <ak@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 Oct 2011 14:12:37 +0000 (4 14:12 +0000)
tree8e13f5db02816ade11570d10b3d459b2c9b7e71d
parenta5ebfbbbe292e6516542adc117fa7525e46e0b8f
Maintain order of LTO sections

Currently when reading in LTO sections from ld -r files they can
get randomly reordered based on hash tables and random IDs.
This causes reordering later when the final code is generated and
also makes crashes harder to reproduce.

This patch maintains explicit lists based on the input order and uses
those lists to preserve that order when starting the rest of the
LTO passes.

This is the first step to working -fno-toplevel-reorder for
LTO. But this needs more changes because the LTO partitioner
can still reorder.

This add two lists: one for the section and another one for
the file_decl_datas. This is needed because the sections are
walked twice through different data structures.

In addition some code becomes slightly cleaner because we don't need
to pass state through abstract callbacks anymore, but
can just use direct type safe calls.

gcc/lto/:

2011-10-02   Andi Kleen <ak@linux.intel.com>

* lto-object.c (lto_obj_add_section_data): Add list.
(lto_obj_add_section): Fill in list.
(ltoobj_build_section_table): Pass through list.
* lto.c (file_data_list): Declare.
(create_subid_section_table): Pass arguments directly.
Fill in list of file_datas.
(lwstate): Delete.
(lto_create_files_from_ids): Pass in direct arguments.
Don't maintain list.
(lto_file_read): Use explicit section and file data lists.
(lto_read_all_file_options): Pass in section_list.
* lto.h (lto_obj_build_section_table): Add list.
(lto_section_slot): Add next.
(lto_section_list): Declare.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179505 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/lto/ChangeLog
gcc/lto/lto-object.c
gcc/lto/lto.c
gcc/lto/lto.h