summaryrefslogtreecommitdiff
path: root/gold/ehframe.h
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2015-03-09 10:10:29 -0700
committerCary Coutant <ccoutant@google.com>2015-03-09 10:12:06 -0700
commite16631979e847a6b39db3435bea7708b9f34b36d (patch)
tree81496b855792790e6ebe28028a07670e26737e53 /gold/ehframe.h
parent9a9df97001814c87929826e6538762f3be07c4a4 (diff)
Fix failure in exception_static_test.
Because the __EH_FRAME_BEGIN__ symbol is provided in an empty .eh_frame section in crtbeginT.o, if crt1.o has a non-empty .eh_frame section, we place all optimized .eh_frame sections into the output section ahead of the __EH_FRAME_BEGIN__ symbol, which breaks EH for statically-linked binaries. This patch fixes the problem by delaying the attachment of the optimized .eh_frame sections to the output section until we see the end marker section (or to the end of pass 1 if we never see an end marker). gold/ PR gold/14675 * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type; return enum indicating whether .eh_frame section is empty, optimizable, unrecognized, or an end marker. Adjust explicit instantiations. * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type. (Eh_frame::add_ehframe_input_section): Change return type. * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section. * layout.cc (Layout::layout_eh_frame): Don't add optimized sections to the .eh_frame output section until we see the end marker. (Layout::finalize_eh_frame_section): New. * layout.h: (Layout::finalize_eh_frame_section): New.
Diffstat (limited to 'gold/ehframe.h')
-rw-r--r--gold/ehframe.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/gold/ehframe.h b/gold/ehframe.h
index bb47381d18..e6e21b2673 100644
--- a/gold/ehframe.h
+++ b/gold/ehframe.h
@@ -359,6 +359,14 @@ extern bool operator==(const Cie&, const Cie&);
class Eh_frame : public Output_section_data
{
public:
+ enum Eh_frame_section_disposition
+ {
+ EH_EMPTY_SECTION,
+ EH_UNRECOGNIZED_SECTION,
+ EH_OPTIMIZABLE_SECTION,
+ EH_END_MARKER_SECTION
+ };
+
Eh_frame();
// Record the associated Eh_frame_hdr, if any.
@@ -374,7 +382,7 @@ class Eh_frame : public Output_section_data
// returns whether the section was incorporated into the .eh_frame
// data.
template<int size, bool big_endian>
- bool
+ Eh_frame_section_disposition
add_ehframe_input_section(Sized_relobj_file<size, big_endian>* object,
const unsigned char* symbols,
section_size_type symbols_size,