gas/
[deliverable/binutils-gdb.git] / gold / icf.h
index 27bbbba0fe5f461dc73eea2e155985c02a842e3e..f1581375c3b52a35bf4a261adc58807a1ad46abc 100644 (file)
@@ -43,6 +43,7 @@ class Icf
   typedef std::vector<Symbol*> Symbol_info;
   typedef std::vector<std::pair<long long, long long> > Addend_info;
   typedef std::vector<uint64_t> Offset_info;
+  typedef std::vector<unsigned int> Reloc_addend_size_info;
   typedef Unordered_map<Section_id,
                         unsigned int,
                         Section_id_hash> Uniq_secn_id_map;
@@ -57,6 +58,7 @@ class Icf
     // This stores the symbol value and the addend for a reloc.
     Addend_info addend_info;
     Offset_info offset_info;
+    Reloc_addend_size_info reloc_addend_size_info;
   } Reloc_info;
 
   typedef Unordered_map<Section_id, Reloc_info,
@@ -103,7 +105,7 @@ class Icf
   // Given an object and a section index, this returns true if the
   // pointer of the function defined in this section is taken.
   bool
-  section_has_function_pointers(Object *obj, unsigned int shndx)
+  section_has_function_pointers(Objectobj, unsigned int shndx)
   {
     return (this->fptr_section_id_.find(Section_id(obj, shndx))
             != this->fptr_section_id_.end());
@@ -112,7 +114,7 @@ class Icf
   // Records that a pointer of the function defined in this section
   // is taken.
   void
-  set_section_has_function_pointers(Object *obj, unsigned int shndx)
+  set_section_has_function_pointers(Objectobj, unsigned int shndx)
   {
     this->fptr_section_id_.insert(Section_id(obj, shndx));
   }
@@ -121,14 +123,13 @@ class Icf
   // corresponding to taken function pointers.  Ignores eh_frame
   // and vtable sections.
   inline bool
-  check_section_for_function_pointers(std::string section_name,
+  check_section_for_function_pointers(const std::string& section_name,
                                       Target* target)
   {
     return (parameters->options().icf_safe_folding()
            && target->can_check_for_function_pointers()
-            && !is_prefix_of(".rodata._ZTV", section_name.c_str())
-            && !is_prefix_of(".data.rel.ro._ZTV", section_name.c_str())
-            && !is_prefix_of(".eh_frame", section_name.c_str()));
+           && target->section_may_have_icf_unsafe_pointers(
+               section_name.c_str()));
   }
 
   // Returns a map of a section to info (Reloc_info) about its relocations.
@@ -167,10 +168,11 @@ class Icf
 // earlier gcc versions, like 4.0.3, put constructors and destructors in
 // .gnu.linkonce.t sections and hence should be included too.
 inline bool
-is_section_foldable_candidate(const char* section_name)
+is_section_foldable_candidate(const std::string& section_name)
 {
-  return (is_prefix_of(".text", section_name)
-          || is_prefix_of(".gnu.linkonce.t", section_name));
+  const char* section_name_cstr = section_name.c_str();
+  return (is_prefix_of(".text", section_name_cstr)
+          || is_prefix_of(".gnu.linkonce.t", section_name_cstr));
 }
 
 } // End of namespace gold.
This page took 0.032937 seconds and 4 git commands to generate.