summaryrefslogtreecommitdiffstats
path: root/binutils-2.19/gold/object.cc
diff options
context:
space:
mode:
Diffstat (limited to 'binutils-2.19/gold/object.cc')
-rw-r--r--binutils-2.19/gold/object.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/binutils-2.19/gold/object.cc b/binutils-2.19/gold/object.cc
index 73bf370..02366c0 100644
--- a/binutils-2.19/gold/object.cc
+++ b/binutils-2.19/gold/object.cc
@@ -1751,7 +1751,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());
}
@@ -1759,9 +1764,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);
}
}