X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gold%2Fehframe.h;h=3fe96002dc94dd3ab57a853081f2976d364565bf;hb=5233f39b8b999f2675fb9493149e878c281e1d60;hp=d5ac668e417faf423b8feddca5d3cf33705119b5;hpb=7cdd7d57e6fa3932eb63aa785ae0e3fa837aab20;p=deliverable%2Fbinutils-gdb.git diff --git a/gold/ehframe.h b/gold/ehframe.h index d5ac668e41..3fe96002dc 100644 --- a/gold/ehframe.h +++ b/gold/ehframe.h @@ -1,6 +1,6 @@ // ehframe.h -- handle exception frame sections for gold -*- C++ -*- -// Copyright 2006, 2007, 2008, 2010, 2011 Free Software Foundation, Inc. +// Copyright (C) 2006-2020 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -60,10 +60,7 @@ class Eh_frame_hdr : public Output_section_data record_fde(section_offset_type fde_offset, unsigned char fde_encoding) { if (!this->any_unrecognized_eh_frame_sections_) - { - Hold_lock(*this->lock_); - this->fde_offsets_.push_back(std::make_pair(fde_offset, fde_encoding)); - } + this->fde_offsets_.push_back(std::make_pair(fde_offset, fde_encoding)); } protected: @@ -160,8 +157,6 @@ class Eh_frame_hdr : public Output_section_data // Whether we found any .eh_frame sections which we could not // process. bool any_unrecognized_eh_frame_sections_; - // Lock held while updating fde_offsets_. - Lock* lock_; }; // This class holds an FDE. @@ -197,27 +192,33 @@ class Fde // Add a mapping for this FDE to MERGE_MAP, so that relocations // against the FDE are applied to right part of the output file. void - add_mapping(section_offset_type output_offset, Merge_map* merge_map) const + add_mapping(section_offset_type output_offset, + Output_section_data* output_data) const { if (this->object_ != NULL) - merge_map->add_mapping(this->object_, this->u_.from_object.shndx, + this->object_->add_merge_mapping(output_data, this->u_.from_object.shndx, this->u_.from_object.input_offset, this->length(), output_offset); } // Return whether this FDE was added after merge mapping. bool - post_map() + post_map() const { return this->object_ == NULL && this->u_.from_linker.post_map; } + // Return whether this FDE was added for the PLT after merge mapping. + bool + post_map(const Output_data* plt) const + { return this->post_map() && this->u_.from_linker.plt == plt; } + // Write the FDE to OVIEW starting at OFFSET. FDE_ENCODING is the // encoding, from the CIE. Round up the bytes to ADDRALIGN if // necessary. ADDRESS is the virtual address of OVIEW. Record the // FDE in EH_FRAME_HDR. Return the new offset. template section_offset_type - write(unsigned char* oview, section_offset_type offset, - uint64_t address, unsigned int addralign, + write(unsigned char* oview, section_offset_type output_section_offset, + section_offset_type offset, uint64_t address, unsigned int addralign, section_offset_type cie_offset, unsigned char fde_encoding, Eh_frame_hdr* eh_frame_hdr); @@ -302,6 +303,16 @@ class Cie add_fde(Fde* fde) { this->fdes_.push_back(fde); } + // Remove the last FDE associated with this CIE. + void + remove_fde() + { this->fdes_.pop_back(); } + + // Access the last FDE associated with this CIE. + const Fde* + last_fde() const + { return this->fdes_.back(); } + // Return the number of FDEs. unsigned int fde_count() const @@ -313,7 +324,7 @@ class Cie // mapping. It returns the new output offset. section_offset_type set_output_offset(section_offset_type output_offset, unsigned int addralign, - Merge_map*); + Output_section_data*); // Write the CIE to OVIEW starting at OFFSET. Round up the bytes to // ADDRALIGN. ADDRESS is the virtual address of OVIEW. @@ -322,10 +333,16 @@ class Cie // writing. Return the new offset. template section_offset_type - write(unsigned char* oview, section_offset_type offset, uint64_t address, + write(unsigned char* oview, section_offset_type output_section_offset, + section_offset_type offset, uint64_t address, unsigned int addralign, Eh_frame_hdr* eh_frame_hdr, Post_fdes* post_fdes); + // Return the FDE encoding. + unsigned char + fde_encoding() const + { return this->fde_encoding_; } + friend bool operator<(const Cie&, const Cie&); friend bool operator==(const Cie&, const Cie&); @@ -362,6 +379,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. @@ -377,7 +402,7 @@ class Eh_frame : public Output_section_data // returns whether the section was incorporated into the .eh_frame // data. template - bool + Eh_frame_section_disposition add_ehframe_input_section(Sized_relobj_file* object, const unsigned char* symbols, section_size_type symbols_size, @@ -395,6 +420,11 @@ class Eh_frame : public Output_section_data size_t cie_length, const unsigned char* fde_data, size_t fde_length); + // Remove all post-map unwind information for a PLT. + void + remove_ehframe_for_plt(Output_data* plt, const unsigned char* cie_data, + size_t cie_length); + // Return the number of FDEs. unsigned int fde_count() const; @@ -410,10 +440,6 @@ class Eh_frame : public Output_section_data section_offset_type offset, section_offset_type* poutput) const; - // Return whether this is the merge section for an input section. - bool - do_is_merge_section_for(const Relobj*, unsigned int shndx) const; - // Write the data to the file. void do_write(Output_file*); @@ -508,8 +534,6 @@ class Eh_frame : public Output_section_data // A mapping from unmergeable CIEs to their offset in the output // file. Unmergeable_cie_offsets unmergeable_cie_offsets_; - // A mapping from input sections to the output section. - Merge_map merge_map_; // Whether we have created the mappings to the output section. bool mappings_are_done_; // The final data size. This is only set if mappings_are_done_ is