diff options
author | Cary Coutant <ccoutant@google.com> | 2014-11-25 13:55:42 -0800 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2014-11-25 13:56:21 -0800 |
commit | c924eb67e143722e4098d84c1cb91123a51c988f (patch) | |
tree | 2e1410cddd8f1a119ea4e76e73cf1b481ad55c7c /gold/object.h | |
parent | 61e6682207163bfc02b2fc0c54c084cf8f2c5f10 (diff) | |
download | gdb-c924eb67e143722e4098d84c1cb91123a51c988f.zip gdb-c924eb67e143722e4098d84c1cb91123a51c988f.tar.gz gdb-c924eb67e143722e4098d84c1cb91123a51c988f.tar.bz2 |
Fix corrupted .eh_frame section with LTO and --gc-sections.
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.
Diffstat (limited to 'gold/object.h')
-rw-r--r-- | gold/object.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gold/object.h b/gold/object.h index 754b1d2..cf45ec5 100644 --- a/gold/object.h +++ b/gold/object.h @@ -2202,6 +2202,10 @@ class Sized_relobj_file : public Sized_relobj<size, big_endian> Symbol_value<size>* lv_out, const Symbol_table* symtab); + // Return true if the layout for this object was deferred. + bool is_deferred_layout() const + { return this->is_deferred_layout_; } + protected: typedef typename Sized_relobj<size, big_endian>::Output_sections Output_sections; @@ -2740,6 +2744,9 @@ class Sized_relobj_file : public Sized_relobj<size, big_endian> // If this object has a GNU style .eh_frame section that is discarded in // output, record the index here. Otherwise it is -1U. unsigned int discarded_eh_frame_shndx_; + // True if the layout of this object was deferred, waiting for plugin + // replacement files. + bool is_deferred_layout_; // The list of sections whose layout was deferred. std::vector<Deferred_layout> deferred_layout_; // The list of relocation sections whose layout was deferred. |