gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gold / merge.h
index 3e500bc186de6d84f5ac5e550cb9e13631a425fe..8ac638eb6bd7855a27e407214b81cdd2f17551cc 100644 (file)
@@ -1,6 +1,6 @@
 // merge.h -- handle section merging for gold  -*- C++ -*-
 
-// Copyright (C) 2006-2015 Free Software Foundation, Inc.
+// Copyright (C) 2006-2020 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -42,9 +42,7 @@ class Object_merge_map
 {
  public:
   Object_merge_map()
-    : first_shnum_(-1U), first_map_(),
-      second_shnum_(-1U), second_map_(),
-      section_merge_maps_()
+    : section_merge_maps_()
   { }
 
   ~Object_merge_map();
@@ -71,9 +69,8 @@ class Object_merge_map
                    section_offset_type offset,
                    section_offset_type* output_offset);
 
-  // Return whether this is the merge map for section SHNDX.
-  bool
-  is_merge_section_for(const Output_section_data*, unsigned int shndx);
+  const Output_section_data*
+  find_merge_section(unsigned int shndx) const;
 
   // Initialize an mapping from input offsets to output addresses for
   // section SHNDX.  STARTING_ADDRESS is the output address of the
@@ -86,7 +83,6 @@ class Object_merge_map
       Unordered_map<section_offset_type,
                    typename elfcpp::Elf_types<size>::Elf_Addr>*);
 
- private:
   // Map input section offsets to a length and an output section
   // offset.  An output section offset of -1 means that this part of
   // the input section is being discarded.
@@ -100,17 +96,12 @@ class Object_merge_map
     section_offset_type output_offset;
   };
 
-  // A less-than comparison routine for Input_merge_entry.
-  struct Input_merge_compare
-  {
-    bool
-    operator()(const Input_merge_entry& i1, const Input_merge_entry& i2) const
-    { return i1.input_offset < i2.input_offset; }
-  };
-
   // A list of entries for a particular input section.
   struct Input_merge_map
   {
+    void add_mapping(section_offset_type input_offset, section_size_type length,
+                     section_offset_type output_offset);
+
     typedef std::vector<Input_merge_entry> Entries;
 
     // We store these with the Relobj, and we look them up by input
@@ -143,29 +134,36 @@ class Object_merge_map
     { }
   };
 
-  // Map input section indices to merge maps.
-  typedef std::map<unsigned int, Input_merge_map*> Section_merge_maps;
-
-  // Return a pointer to the Input_merge_map to use for the input
-  // section SHNDX, or NULL.
-  Input_merge_map*
-  get_input_merge_map(unsigned int shndx);
-
   // Get or make the Input_merge_map to use for the section SHNDX
   // with MERGE_MAP.
   Input_merge_map*
   get_or_make_input_merge_map(const Output_section_data* merge_map,
                               unsigned int shndx);
 
-  // Any given object file will normally only have a couple of input
-  // sections with mergeable contents.  So we keep the first two input
-  // section numbers inline, and push any further ones into a map.  A
-  // value of -1U in first_shnum_ or second_shnum_ means that we don't
-  // have a corresponding entry.
-  unsigned int first_shnum_;
-  Input_merge_map first_map_;
-  unsigned int second_shnum_;
-  Input_merge_map second_map_;
+  private:
+  // A less-than comparison routine for Input_merge_entry.
+  struct Input_merge_compare
+  {
+    bool
+    operator()(const Input_merge_entry& i1, const Input_merge_entry& i2) const
+    { return i1.input_offset < i2.input_offset; }
+  };
+
+  // Map input section indices to merge maps.
+  typedef std::vector<std::pair<unsigned int, Input_merge_map*> >
+      Section_merge_maps;
+
+  // Return a pointer to the Input_merge_map to use for the input
+  // section SHNDX, or NULL.
+  const Input_merge_map*
+  get_input_merge_map(unsigned int shndx) const;
+
+  Input_merge_map *
+  get_input_merge_map(unsigned int shndx) {
+    return const_cast<Input_merge_map *>(static_cast<const Object_merge_map *>(
+                                             this)->get_input_merge_map(shndx));
+  }
+
   Section_merge_maps section_merge_maps_;
 };
 
This page took 0.025124 seconds and 4 git commands to generate.