[lld] r270266 - Directly compute the right value for R_RELAX_TLS_GD_TO_IE.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri May 20 13:09:35 PDT 2016
Author: rafael
Date: Fri May 20 15:09:35 2016
New Revision: 270266
URL: http://llvm.org/viewvc/llvm-project?rev=270266&view=rev
Log:
Directly compute the right value for R_RELAX_TLS_GD_TO_IE.
This avoid doing math in Target.cpp to compensate.
Modified:
lld/trunk/ELF/InputSection.cpp
lld/trunk/ELF/Target.cpp
Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=270266&r1=270265&r2=270266&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Fri May 20 15:09:35 2016
@@ -168,10 +168,10 @@ getSymVA(uint32_t Type, typename ELFT::u
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);
Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=270266&r1=270265&r2=270266&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Fri May 20 15:09:35 2016
@@ -416,8 +416,7 @@ void X86TargetInfo::relaxTlsGdToIe(uint8
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.
More information about the llvm-commits
mailing list