aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Kwan <dougkwan@google.com>2010-05-26 18:53:46 +0000
committerDoug Kwan <dougkwan@google.com>2010-05-26 18:53:46 +0000
commit29e11421774bceff6b4d895d7b133bc02850e4f6 (patch)
treea24868cc4907f0ab615411969132ab6d2c2daa77
parent23de6b34102ea355f05aaa1bfb4ebac1510f3407 (diff)
downloadgdb-29e11421774bceff6b4d895d7b133bc02850e4f6.zip
gdb-29e11421774bceff6b4d895d7b133bc02850e4f6.tar.gz
gdb-29e11421774bceff6b4d895d7b133bc02850e4f6.tar.bz2
2010-05-27 Doug Kwan <dougkwan@google.com>
* object.cc (Sized_relobj::do_finalize_local_symbols): Use offset from start of output section instead of address for a local symbol in a merged or relaxed section when doing a relocatable link.
-rw-r--r--gold/ChangeLog6
-rw-r--r--gold/object.cc16
2 files changed, 19 insertions, 3 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 3dba197..ef47e8e 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,9 @@
+2010-05-27 Doug Kwan <dougkwan@google.com>
+
+ * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
+ from start of output section instead of address for a local symbol
+ in a merged or relaxed section when doing a relocatable link.
+
2010-05-26 Rafael Espindola <espindola@google.com>
PR 11604
diff --git a/gold/object.cc b/gold/object.cc
index 9581fd8..24fd586 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -1827,7 +1827,12 @@ Sized_relobj<size, big_endian>::do_finalize_local_symbols(unsigned int index,
const Output_section_data* posd =
os->find_relaxed_input_section(this, shndx);
if (posd != NULL)
- lv.set_output_value(posd->address());
+ {
+ Address relocatable_link_adjustment =
+ relocatable ? os->address() : 0;
+ lv.set_output_value(posd->address()
+ - relocatable_link_adjustment);
+ }
else
lv.set_output_value(os->address());
}
@@ -1835,9 +1840,14 @@ Sized_relobj<size, big_endian>::do_finalize_local_symbols(unsigned int index,
{
// We have to consider the addend to determine the
// value to use in a relocation. START is the start
- // of this input section.
+ // of this input section. If we are doing a relocatable
+ // link, use offset from start output section instead of
+ // address.
+ Address adjusted_start =
+ relocatable ? start - os->address() : start;
Merged_symbol_value<size>* msv =
- new Merged_symbol_value<size>(lv.input_value(), start);
+ new Merged_symbol_value<size>(lv.input_value(),
+ adjusted_start);
lv.set_merged_symbol_value(msv);
}
}