2010-09-28 Sriraman Tallam <tmsriram@google.com>
authorSriraman Tallam <tmsriram@google.com>
Tue, 28 Sep 2010 17:14:15 +0000 (17:14 +0000)
committerSriraman Tallam <tmsriram@google.com>
Tue, 28 Sep 2010 17:14:15 +0000 (17:14 +0000)
* target.h (Target::can_icf_inline_merge_sections): New virtual
function.
* x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
virtual function.
* i386.cc (Target_i386::can_icf_inline_merge_sections): New
virtual function.
* icf.cc (get_section_contents): Inline merge sections only when
target allows it.

gold/ChangeLog
gold/i386.cc
gold/icf.cc
gold/target.h
gold/x86_64.cc

index bdc600f69acb71a0cbce0dc66a760fbb2f3f87bb..a42330b3d1410247b798d98fda6fb3b2420a846c 100644 (file)
@@ -1,3 +1,14 @@
+2010-09-28  Sriraman Tallam  <tmsriram@google.com>
+
+       * target.h (Target::can_icf_inline_merge_sections): New virtual
+       function. 
+       * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
+       virtual function.
+       * i386.cc (Target_i386::can_icf_inline_merge_sections): New
+       virtual function.
+       * icf.cc (get_section_contents): Inline merge sections only when
+       target allows it.
+
 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * configure: Regenerate.
index 009f217799788ed1c496b8902bcc627b1927568a..693ae4c9b05f17a0403da159495ad219333cbfd3 100644 (file)
@@ -175,6 +175,10 @@ class Target_i386 : public Target_freebsd<32, false>
   can_check_for_function_pointers() const
   { return true; }
 
+  virtual bool
+  can_icf_inline_merge_sections () const
+  { return true; }
+
   // Process the relocations to determine unreferenced sections for 
   // garbage collection.
   void
index 31312bbff9587a92ddbbd3d83535efc936be89d5..09cb1d4892b84d5d983368c13b559c33d1dd965e 100644 (file)
@@ -366,7 +366,8 @@ get_section_contents(bool first_iteration,
               uint64_t secn_flags = (it_v->first)->section_flags(it_v->second);
               // This reloc points to a merge section.  Hash the
               // contents of this section.
-              if ((secn_flags & elfcpp::SHF_MERGE) != 0)
+              if ((secn_flags & elfcpp::SHF_MERGE) != 0
+                 && parameters->target().can_icf_inline_merge_sections ())
                 {
                   uint64_t entsize =
                     (it_v->first)->section_entsize(it_v->second);
index 33f7ee80639389423b7edb047652677a5863d793..5cdd032bf5f05950a33eb63693f214f052a29b94 100644 (file)
@@ -72,6 +72,13 @@ class Target
   can_check_for_function_pointers() const
   { return false; }
 
+  // This function is used in ICF (icf.cc).  This is set to true by
+  // the target if a relocation to a merged section can be processed
+  // to retrieve the contents of the merged section.
+  virtual bool
+  can_icf_inline_merge_sections () const
+  { return false; }
+
   // Whether a section called SECTION_NAME may have function pointers to
   // sections not eligible for safe ICF folding.
   virtual bool
index 1396fb39283eaf3f47930dc149851fc8df38efa5..4853603fdb96e414789c9e2937e71eb0ae0a3381 100644 (file)
@@ -189,6 +189,10 @@ class Target_x86_64 : public Target_freebsd<64, false>
   can_check_for_function_pointers() const
   { return !parameters->options().pie(); }
 
+  virtual bool
+  can_icf_inline_merge_sections () const
+  { return true; }
+
   // Hook for a new output section.
   void
   do_new_output_section(Output_section*) const;