From e09ad04ada67c0aa5c6c0f233aeede49c1ed484f Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 29 May 2008 23:51:30 +0000 Subject: [PATCH] PR 6407 * target-reloc.h (relocate_for_relocatable): Fix new_offset calculation. --- gold/ChangeLog | 6 ++++++ gold/target-reloc.h | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gold/ChangeLog b/gold/ChangeLog index a20de3a1164..0fb667d1e4a 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,9 @@ +2008-05-29 Kris Van Hees + + PR 6407 + * target-reloc.h (relocate_for_relocatable): Fix new_offset + calculation. + 2008-05-28 Caleb Howe * reduced_debug_output.cc: New file. diff --git a/gold/target-reloc.h b/gold/target-reloc.h index d06dc82023b..15d59bb9019 100644 --- a/gold/target-reloc.h +++ b/gold/target-reloc.h @@ -542,7 +542,11 @@ relocate_for_relocatable( // In an executable or dynamic object, generated by // --emit-relocs, r_offset is an absolute address. if (!parameters->options().relocatable()) - new_offset += view_address; + { + new_offset += view_address; + if (offset_in_output_section != -1) + new_offset -= offset_in_output_section; + } reloc_write.put_r_offset(new_offset); reloc_write.put_r_info(elfcpp::elf_r_info(new_symndx, r_type)); -- 2.30.2