diff options
author | Cary Coutant <ccoutant@google.com> | 2015-03-09 10:10:29 -0700 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2015-03-09 10:12:06 -0700 |
commit | e16631979e847a6b39db3435bea7708b9f34b36d (patch) | |
tree | 81496b855792790e6ebe28028a07670e26737e53 /gold/ehframe.cc | |
parent | 9a9df97001814c87929826e6538762f3be07c4a4 (diff) | |
download | gdb-e16631979e847a6b39db3435bea7708b9f34b36d.zip gdb-e16631979e847a6b39db3435bea7708b9f34b36d.tar.gz gdb-e16631979e847a6b39db3435bea7708b9f34b36d.tar.bz2 |
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.cc')
-rw-r--r-- | gold/ehframe.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gold/ehframe.cc b/gold/ehframe.cc index 711103b..262766e 100644 --- a/gold/ehframe.cc +++ b/gold/ehframe.cc @@ -567,7 +567,7 @@ Eh_frame::skip_leb128(const unsigned char** pp, const unsigned char* pend) // section. template<int size, bool big_endian> -bool +Eh_frame::Eh_frame_section_disposition Eh_frame::add_ehframe_input_section( Sized_relobj_file<size, big_endian>* object, const unsigned char* symbols, @@ -584,7 +584,7 @@ Eh_frame::add_ehframe_input_section( &contents_len, false); if (contents_len == 0) - return false; + return EH_EMPTY_SECTION; // If this is the marker section for the end of the data, then // return false to force it to be handled as an ordinary input @@ -592,7 +592,7 @@ Eh_frame::add_ehframe_input_section( // of unrecognized .eh_frame sections. if (contents_len == 4 && elfcpp::Swap<32, big_endian>::readval(pcontents) == 0) - return false; + return EH_END_MARKER_SECTION; New_cies new_cies; if (!this->do_add_ehframe_input_section(object, symbols, symbols_size, @@ -609,7 +609,7 @@ Eh_frame::add_ehframe_input_section( ++p) delete p->first; - return false; + return EH_UNRECOGNIZED_SECTION; } // Now that we know we are using this section, record any new CIEs @@ -624,7 +624,7 @@ Eh_frame::add_ehframe_input_section( this->unmergeable_cie_offsets_.push_back(p->first); } - return true; + return EH_OPTIMIZABLE_SECTION; } // The bulk of the implementation of add_ehframe_input_section. @@ -1206,7 +1206,7 @@ Eh_frame::do_sized_write(unsigned char* oview) #ifdef HAVE_TARGET_32_LITTLE template -bool +Eh_frame::Eh_frame_section_disposition Eh_frame::add_ehframe_input_section<32, false>( Sized_relobj_file<32, false>* object, const unsigned char* symbols, @@ -1220,7 +1220,7 @@ Eh_frame::add_ehframe_input_section<32, false>( #ifdef HAVE_TARGET_32_BIG template -bool +Eh_frame::Eh_frame_section_disposition Eh_frame::add_ehframe_input_section<32, true>( Sized_relobj_file<32, true>* object, const unsigned char* symbols, @@ -1234,7 +1234,7 @@ Eh_frame::add_ehframe_input_section<32, true>( #ifdef HAVE_TARGET_64_LITTLE template -bool +Eh_frame::Eh_frame_section_disposition Eh_frame::add_ehframe_input_section<64, false>( Sized_relobj_file<64, false>* object, const unsigned char* symbols, @@ -1248,7 +1248,7 @@ Eh_frame::add_ehframe_input_section<64, false>( #ifdef HAVE_TARGET_64_BIG template -bool +Eh_frame::Eh_frame_section_disposition Eh_frame::add_ehframe_input_section<64, true>( Sized_relobj_file<64, true>* object, const unsigned char* symbols, |