From 3f87d2904978f50ace83645b21d5cbc5f581c3f9 Mon Sep 17 00:00:00 2001 From: Jing Yu Date: Mon, 4 Oct 2010 16:07:15 -0700 Subject: Backport upstream fix to disable inlining of merge sections in ICF for ARM back end. Change-Id: If59807eea3b016308bdcd70153c0a84d9dc265ac http://sourceware.org/ml/binutils/2010-09/msg00492.html --- binutils-2.19/README.android | 14 ++++++++++++++ binutils-2.19/gold/i386.cc | 4 ++++ binutils-2.19/gold/icf.cc | 3 ++- binutils-2.19/gold/target.h | 7 +++++++ binutils-2.19/gold/x86_64.cc | 4 ++++ 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/binutils-2.19/README.android b/binutils-2.19/README.android index 93ea299..5c04089 100644 --- a/binutils-2.19/README.android +++ b/binutils-2.19/README.android @@ -1,3 +1,17 @@ +2010-09-28 Sriraman Tallam + + Backport upstream fix to disable inlining of merge section in ICF for + ARM back end. + + http://sourceware.org/ml/binutils/2010-09/msg00492.html + + Changed files: + + gold/target.h + gold/i386.cc + gold/x86_64.cc + gold/icf.cc + 2010-09-17 Doug Kwan Backport upstream fix for mis-handling of GOT-using relocations diff --git a/binutils-2.19/gold/i386.cc b/binutils-2.19/gold/i386.cc index bb1de1c..3796b94 100644 --- a/binutils-2.19/gold/i386.cc +++ b/binutils-2.19/gold/i386.cc @@ -69,6 +69,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/binutils-2.19/gold/icf.cc b/binutils-2.19/gold/icf.cc index 31312bb..09cb1d4 100644 --- a/binutils-2.19/gold/icf.cc +++ b/binutils-2.19/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/binutils-2.19/gold/target.h b/binutils-2.19/gold/target.h index 563a365..48b11b2 100644 --- a/binutils-2.19/gold/target.h +++ b/binutils-2.19/gold/target.h @@ -71,6 +71,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/binutils-2.19/gold/x86_64.cc b/binutils-2.19/gold/x86_64.cc index 61299c2..dcd6c46 100644 --- a/binutils-2.19/gold/x86_64.cc +++ b/binutils-2.19/gold/x86_64.cc @@ -81,6 +81,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; -- cgit v1.1