Fix corrupted .eh_frame section with LTO and --gc-sections.
authorCary Coutant <ccoutant@google.com>
Tue, 25 Nov 2014 21:55:42 +0000 (13:55 -0800)
committerCary Coutant <ccoutant@google.com>
Wed, 26 Nov 2014 00:14:15 +0000 (16:14 -0800)
commit9ec85a27138aefcd3fc35ddbd7727f384fe299b1
treedc1f26e559c637ca906fda7200694e428641a16f
parentbd30b2c856c9ae1fc3559d80fc8c8ccdf65e5fce
Fix corrupted .eh_frame section with LTO and --gc-sections.

Backport from trunk:

When --gc-sections is turned on during an LTO link, the .eh_frame sections
from deferred files are processed before those from the replacement files.
As a result, the section end-cap from crtendS.o is placed ahead of
the .eh_frame data from the replacement files. This patch fixes the bug
by skipping the layout of the deferred sections during GC pass 2.

gold/
PR gold/17639
* object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
(Sized_relobj_file::do_layout): Handle deferred sections properly
during GC pass 1. Don't add reloc sections to deferred list twice.
* object.h (Sized_relobj_file::is_deferred_layout): New function.
(Sized_relobj_file::is_deferred_layout_): New data member.
gold/ChangeLog
gold/object.cc
gold/object.h