PR 6407
authorIan Lance Taylor <ian@airs.com>
Thu, 29 May 2008 23:51:30 +0000 (23:51 +0000)
committerIan Lance Taylor <ian@airs.com>
Thu, 29 May 2008 23:51:30 +0000 (23:51 +0000)
* target-reloc.h (relocate_for_relocatable): Fix new_offset
calculation.

gold/ChangeLog
gold/target-reloc.h

index a20de3a11644602ee231c9ecab58b7f3019a0036..0fb667d1e4adda2fecc9fe7990a4e70a2a5fa9d9 100644 (file)
@@ -1,3 +1,9 @@
+2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
+
+       PR 6407
+       * target-reloc.h (relocate_for_relocatable): Fix new_offset
+       calculation.
+
 2008-05-28  Caleb Howe  <cshowe@google.com>
 
        * reduced_debug_output.cc: New file.
index d06dc82023bcd759328c4828fe46d5b8a17de5a2..15d59bb9019dad431ba79ded5f8b915767ba16b3 100644 (file)
@@ -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<size>(new_symndx, r_type));