forked from OSchip/llvm-project
Directly compute the right value for R_RELAX_TLS_GD_TO_IE.
This avoid doing math in Target.cpp to compensate. llvm-svn: 270266
This commit is contained in:
parent
3eded68bef
commit
74f3dbe438
|
|
@ -168,10 +168,10 @@ getSymVA(uint32_t Type, typename ELFT::uint A, typename ELFT::uint P,
|
||||||
case R_GOTREL:
|
case R_GOTREL:
|
||||||
return Body.getVA<ELFT>(A) - Out<ELFT>::Got->getVA();
|
return Body.getVA<ELFT>(A) - Out<ELFT>::Got->getVA();
|
||||||
case R_GOT_FROM_END:
|
case R_GOT_FROM_END:
|
||||||
|
case R_RELAX_TLS_GD_TO_IE:
|
||||||
return Body.getGotOffset<ELFT>() + A -
|
return Body.getGotOffset<ELFT>() + A -
|
||||||
Out<ELFT>::Got->getNumEntries() * sizeof(uintX_t);
|
Out<ELFT>::Got->getNumEntries() * sizeof(uintX_t);
|
||||||
case R_GOT:
|
case R_GOT:
|
||||||
case R_RELAX_TLS_GD_TO_IE:
|
|
||||||
return Body.getGotVA<ELFT>() + A;
|
return Body.getGotVA<ELFT>() + A;
|
||||||
case R_GOT_PAGE_PC:
|
case R_GOT_PAGE_PC:
|
||||||
return getAArch64Page(Body.getGotVA<ELFT>() + A) - getAArch64Page(P);
|
return getAArch64Page(Body.getGotVA<ELFT>() + A) - getAArch64Page(P);
|
||||||
|
|
|
||||||
|
|
@ -416,8 +416,7 @@ void X86TargetInfo::relaxTlsGdToIe(uint8_t *Loc, uint32_t Type,
|
||||||
0x03, 0x83, 0x00, 0x00, 0x00, 0x00 // addl 0(%ebx), %eax
|
0x03, 0x83, 0x00, 0x00, 0x00, 0x00 // addl 0(%ebx), %eax
|
||||||
};
|
};
|
||||||
memcpy(Loc - 3, Inst, sizeof(Inst));
|
memcpy(Loc - 3, Inst, sizeof(Inst));
|
||||||
relocateOne(Loc + 5, R_386_32, Val - Out<ELF32LE>::Got->getVA() -
|
relocateOne(Loc + 5, R_386_32, Val);
|
||||||
Out<ELF32LE>::Got->getNumEntries() * 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// In some conditions, relocations can be optimized to avoid using GOT.
|
// In some conditions, relocations can be optimized to avoid using GOT.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue