Fix bug where SECTIONS clause does not handle compressed debug sections.
[deliverable/binutils-gdb.git] / gold / ehframe.h
index de7c1092ebc9d3ff12e26f66221fce5c67abe37c..e6e21b2673e0e3ba406d33f719f1f34294c4acb7 100644 (file)
@@ -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-2015 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -192,10 +192,11 @@ 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);
   }
@@ -211,8 +212,8 @@ class Fde
   // FDE in EH_FRAME_HDR.  Return the new offset.
   template<int size, bool big_endian>
   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);
 
@@ -246,10 +247,20 @@ class Fde
   std::string contents_;
 };
 
-// FDEs stashed for later processing.
+// A FDE plus some info from a CIE to allow later writing of the FDE.
 
-struct Post_fde;
-typedef std::vector<Post_fde*> Post_fdes;
+struct Post_fde
+{
+  Post_fde(Fde* f, section_offset_type cie_off, unsigned char encoding)
+    : fde(f), cie_offset(cie_off), fde_encoding(encoding)
+  { }
+
+  Fde* fde;
+  section_offset_type cie_offset;
+  unsigned char fde_encoding;
+};
+
+typedef std::vector<Post_fde> Post_fdes;
 
 // This class holds a CIE.
 
@@ -298,7 +309,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.
@@ -307,7 +318,8 @@ class Cie
   // writing.  Return the new offset.
   template<int size, bool big_endian>
   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);
 
@@ -347,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.
@@ -362,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,
@@ -395,10 +415,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*);
@@ -493,8 +509,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
This page took 0.041573 seconds and 4 git commands to generate.