Have getRelExpr return the final values for tls gd.

llvm-svn: 266583
This commit is contained in:
Rafael Espindola 2016-04-18 01:29:15 +00:00
parent 134cb5d30f
commit df17277d72
2 changed files with 6 additions and 3 deletions

View File

@ -372,6 +372,8 @@ RelExpr X86TargetInfo::getRelExpr(uint32_t Type, const SymbolBody &S) const {
switch (Type) {
default:
return R_ABS;
case R_386_TLS_GD:
return R_TLSGD;
case R_386_TLS_LDM:
return R_TLSLD;
case R_386_PLT32:
@ -677,12 +679,13 @@ RelExpr X86_64TargetInfo::getRelExpr(uint32_t Type, const SymbolBody &S) const {
return R_ABS;
case R_X86_64_TLSLD:
return R_TLSLD_PC;
case R_X86_64_TLSGD:
return R_TLSGD_PC;
case R_X86_64_SIZE32:
case R_X86_64_SIZE64:
return R_SIZE;
case R_X86_64_PLT32:
case R_X86_64_PC32:
case R_X86_64_TLSGD:
return R_PC;
case R_X86_64_GOT32:
return R_GOT;

View File

@ -317,13 +317,13 @@ static unsigned handleTlsRelocation(uint32_t Type, SymbolBody &Body,
Off + (uintX_t)sizeof(uintX_t), false,
&Body, 0});
}
Expr = Expr == R_PC ? R_TLSGD_PC : R_TLSGD;
C.Relocations.push_back({Expr, Type, Offset, Addend, &Body});
return 1;
}
if (Body.isPreemptible()) {
Expr = Expr == R_PC ? R_RELAX_TLS_GD_TO_IE_PC : R_RELAX_TLS_GD_TO_IE;
Expr =
Expr == R_TLSGD_PC ? R_RELAX_TLS_GD_TO_IE_PC : R_RELAX_TLS_GD_TO_IE;
C.Relocations.push_back({Expr, Type, Offset, Addend, &Body});
if (!Body.isInGot()) {
Out<ELFT>::Got->addEntry(Body);