Maintain order of LTO sections
authorAndi Kleen <ak@linux.intel.com>
Tue, 4 Oct 2011 14:12:37 +0000 (14:12 +0000)
committerAndi Kleen <ak@gcc.gnu.org>
Tue, 4 Oct 2011 14:12:37 +0000 (14:12 +0000)
commitc17d253c7ac235322caca8248f34a9e83919714d
tree8e13f5db02816ade11570d10b3d459b2c9b7e71d
parent0d9bbe5476d3b2bb2815c8b3ec77fae607243511
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.

From-SVN: r179505
gcc/lto/ChangeLog
gcc/lto/lto-object.c
gcc/lto/lto.c
gcc/lto/lto.h