diff options
author | Ian Lance Taylor <iant@google.com> | 2008-03-06 06:10:44 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2008-03-06 06:10:44 +0000 |
commit | 6be6f3bdcd929ff4133a1bc210bd7bf70fa4ede8 (patch) | |
tree | e9a72117f3b87e016d63a848f79a51daebf9cec7 | |
parent | a4d4b13f6892131f5e79a5270862ad57a37fa2f0 (diff) | |
download | gdb-6be6f3bdcd929ff4133a1bc210bd7bf70fa4ede8.zip gdb-6be6f3bdcd929ff4133a1bc210bd7bf70fa4ede8.tar.gz gdb-6be6f3bdcd929ff4133a1bc210bd7bf70fa4ede8.tar.bz2 |
Use absolute address for relocations when not doing a relocatable
link.
-rw-r--r-- | gold/target-reloc.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gold/target-reloc.h b/gold/target-reloc.h index 09f5076..2823c17 100644 --- a/gold/target-reloc.h +++ b/gold/target-reloc.h @@ -375,7 +375,7 @@ relocate_for_relocatable( off_t offset_in_output_section, const Relocatable_relocs* rr, unsigned char* view, - typename elfcpp::Elf_types<size>::Elf_Addr, + typename elfcpp::Elf_types<size>::Elf_Addr view_address, section_size_type, unsigned char* reloc_view, section_size_type reloc_view_size) @@ -466,6 +466,12 @@ relocate_for_relocatable( gold_assert(new_offset != -1); } + // In an object file, r_offset is an offset within the section. + // In an executable or dynamic object, generated by + // --emit-relocs, r_offset is an absolute address. + if (!parameters->options().relocatable()) + new_offset += view_address; + reloc_write.put_r_offset(new_offset); reloc_write.put_r_info(elfcpp::elf_r_info<size>(new_symndx, r_type)); |