From d60691e195c8d1742cace1bf10cc8dc2152bc044 Mon Sep 17 00:00:00 2001 From: dougkwan Date: Wed, 21 Oct 2009 00:45:52 +0000 Subject: [PATCH] 2009-10-20 Doug Kwan * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section symbols of relaxed input sections. * output.h (Output_section::find_relaxed_input_section): Make method public. --- gold/ChangeLog | 7 +++++++ gold/object.cc | 18 ++++++++++++------ gold/output.h | 10 +++++----- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/gold/ChangeLog b/gold/ChangeLog index 55c3a70890..acff2b18a7 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,10 @@ +2009-10-20 Doug Kwan + + * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section + symbols of relaxed input sections. + * output.h (Output_section::find_relaxed_input_section): Make + method public. + 2009-10-16 Doug Kwan * dynobj.cc (Versions::Versions): Initialize version_script_. diff --git a/gold/object.cc b/gold/object.cc index e9826b08a2..80897743ae 100644 --- a/gold/object.cc +++ b/gold/object.cc @@ -1711,12 +1711,18 @@ Sized_relobj::do_finalize_local_symbols(unsigned int index, } else if (!os->find_starting_output_address(this, shndx, &start)) { - // This is a section symbol, but apparently not one - // in a merged section. Just use the start of the - // output section. This happens with relocatable - // links when the input object has section symbols - // for arbitrary non-merge sections. - lv.set_output_value(os->address()); + // This is a section symbol, but apparently not one in a + // merged section. First check to see if this is a relaxed + // input section. If so, use its address. Otherwise just + // use the start of the output section. This happens with + // relocatable links when the input object has section + // symbols for arbitrary non-merge sections. + const Output_section_data* posd = + os->find_relaxed_input_section(this, shndx); + if (posd != NULL) + lv.set_output_value(posd->address()); + else + lv.set_output_value(os->address()); } else { diff --git a/gold/output.h b/gold/output.h index bc109509cf..7505ca8638 100644 --- a/gold/output.h +++ b/gold/output.h @@ -2585,6 +2585,11 @@ class Output_section : public Output_data convert_input_sections_to_relaxed_sections( const std::vector& sections); + // Find a relaxed input section to an input section in OBJECT + // with index SHNDX. Return NULL if none is found. + const Output_section_data* + find_relaxed_input_section(const Relobj* object, unsigned int shndx) const; + // Print merge statistics to stderr. void print_merge_stats(); @@ -3208,11 +3213,6 @@ class Output_section : public Output_data Output_section_data* find_merge_section(const Relobj* object, unsigned int shndx) const; - // Find a relaxed input section to an input section in OBJECT - // with index SHNDX. Return NULL if none is found. - const Output_section_data* - find_relaxed_input_section(const Relobj* object, unsigned int shndx) const; - // Build a relaxation map. void build_relaxation_map( -- 2.11.0