aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-09-11 13:22:42 +0930
committerAlan Modra <amodra@gmail.com>2019-09-28 16:47:52 +0930
commitea8e302e12bd155a3acd79290ec87d7dda2cce61 (patch)
treee853d2a083965ab1b5895d1b5597883a4051fb0c /gold/x86_64.cc
parentAutomatic date update in version.in (diff)
downloadbinutils-gdb-ea8e302e12bd155a3acd79290ec87d7dda2cce61.tar.gz
binutils-gdb-ea8e302e12bd155a3acd79290ec87d7dda2cce61.tar.bz2
binutils-gdb-ea8e302e12bd155a3acd79290ec87d7dda2cce61.zip
PR16794, gold ignores R_386_GOTOFF addend
An R_386_GOTOFF relocation has an addend, typically used when a symbol can be replaced by its section symbol plus an offset. psymval->value(object,0) is quite wrong then, fix it. PR 16794 * i386.cc (Target_i386::Relocate::relocate <R_386_GOTOFF>): Don't ignore addend, apply using pcrel32. * x86_64.cc (Target_x86_64::Relocate::relocate <R_X86_64_GOTOFF64>): Similarly use pcrel64.
Diffstat (limited to 'gold/x86_64.cc')
-rw-r--r--gold/x86_64.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/gold/x86_64.cc b/gold/x86_64.cc
index c06a2822473..bafd90ef5ef 100644
--- a/gold/x86_64.cc
+++ b/gold/x86_64.cc
@@ -4852,10 +4852,9 @@ Target_x86_64<size>::Relocate::relocate(
case elfcpp::R_X86_64_GOTOFF64:
{
- typename elfcpp::Elf_types<size>::Elf_Addr value;
- value = (psymval->value(object, 0)
- - target->got_plt_section()->address());
- Reloc_funcs::rela64(view, value, addend);
+ typename elfcpp::Elf_types<size>::Elf_Addr reladdr;
+ reladdr = target->got_plt_section()->address();
+ Reloc_funcs::pcrela64(view, object, psymval, addend, reladdr);
}
break;