aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gold/ChangeLog11
-rw-r--r--gold/i386.cc4
-rw-r--r--gold/icf.cc3
-rw-r--r--gold/target.h7
-rw-r--r--gold/x86_64.cc4
5 files changed, 28 insertions, 1 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index bdc600f..a42330b 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -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.
diff --git a/gold/i386.cc b/gold/i386.cc
index 009f217..693ae4c 100644
--- a/gold/i386.cc
+++ b/gold/i386.cc
@@ -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
diff --git a/gold/icf.cc b/gold/icf.cc
index 31312bb..09cb1d4 100644
--- a/gold/icf.cc
+++ b/gold/icf.cc
@@ -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);
diff --git a/gold/target.h b/gold/target.h
index 33f7ee8..5cdd032 100644
--- a/gold/target.h
+++ b/gold/target.h
@@ -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
diff --git a/gold/x86_64.cc b/gold/x86_64.cc
index 1396fb3..4853603 100644
--- a/gold/x86_64.cc
+++ b/gold/x86_64.cc
@@ -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;