diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-05-20 20:09:35 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-05-20 20:09:35 +0000 |
commit | 74f3dbe438d322a15657e56c99f33ee67c38d68c (patch) | |
tree | 22a7394dd0765d20057d1aa8905c1c49faf048be | |
parent | 3eded68bef73953267956d9688a42d52c482214c (diff) | |
download | bcm5719-llvm-74f3dbe438d322a15657e56c99f33ee67c38d68c.tar.gz bcm5719-llvm-74f3dbe438d322a15657e56c99f33ee67c38d68c.zip |
Directly compute the right value for R_RELAX_TLS_GD_TO_IE.
This avoid doing math in Target.cpp to compensate.
llvm-svn: 270266
-rw-r--r-- | lld/ELF/InputSection.cpp | 2 | ||||
-rw-r--r-- | lld/ELF/Target.cpp | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 4dc3252e8da..5552b90d319 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -168,10 +168,10 @@ getSymVA(uint32_t Type, typename ELFT::uint A, typename ELFT::uint P, case R_GOTREL: return Body.getVA<ELFT>(A) - Out<ELFT>::Got->getVA(); case R_GOT_FROM_END: + case R_RELAX_TLS_GD_TO_IE: return Body.getGotOffset<ELFT>() + A - Out<ELFT>::Got->getNumEntries() * sizeof(uintX_t); case R_GOT: - case R_RELAX_TLS_GD_TO_IE: return Body.getGotVA<ELFT>() + A; case R_GOT_PAGE_PC: return getAArch64Page(Body.getGotVA<ELFT>() + A) - getAArch64Page(P); diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp index 6fb09a5ff41..8bbdfd28f6f 100644 --- a/lld/ELF/Target.cpp +++ b/lld/ELF/Target.cpp @@ -416,8 +416,7 @@ void X86TargetInfo::relaxTlsGdToIe(uint8_t *Loc, uint32_t Type, 0x03, 0x83, 0x00, 0x00, 0x00, 0x00 // addl 0(%ebx), %eax }; memcpy(Loc - 3, Inst, sizeof(Inst)); - relocateOne(Loc + 5, R_386_32, Val - Out<ELF32LE>::Got->getVA() - - Out<ELF32LE>::Got->getNumEntries() * 4); + relocateOne(Loc + 5, R_386_32, Val); } // In some conditions, relocations can be optimized to avoid using GOT. |