[ELF][X86_64] Use R_GOTREL_FROM_END instead of R_GOTREL for R_X86_64_GOTOFF64
authorFangrui Song <maskray@google.com>
Wed, 13 Jun 2018 23:29:28 +0000 (23:29 +0000)
committerFangrui Song <maskray@google.com>
Wed, 13 Jun 2018 23:29:28 +0000 (23:29 +0000)
commit4ff63648adf243678869daa5359cdfd6b822bc81
tree654cc31bfbbc7c6988c1dd2de0387cfe637151ef
parentb8b248cf2e0fdd6b5449aaecb6b060b6050f6b72
[ELF][X86_64] Use R_GOTREL_FROM_END instead of R_GOTREL for R_X86_64_GOTOFF64

Summary:
R_X86_64_GOTOFF64: S + A - GOT
R_X86_64_GOTPC{32,64}: GOT + A - P (R_GOTONLY_PC_FROM_END)

R_X86_64_GOTOFF64 should use R_GOTREL_FROM_END so that in conjunction with
R_X86_64_GOTPC{32,64}, the `GOT` term is neutralized. This also matches
the handling of R_386_GOTOFF (S + A - GOT).

Reviewers: ruiu, espindola

Subscribers: emaste, arichardson, llvm-commits

Differential Revision: https://reviews.llvm.org/D48095

llvm-svn: 334672
lld/ELF/Arch/X86_64.cpp
lld/test/ELF/x86-64-reloc-gotoff64.s
lld/test/ELF/x86-64-reloc-gotpc64.s [moved from lld/test/ELF/x86-64-reloc-got.s with 62% similarity]