Handle the R_386_TLS_TPOFF32 relocation, which is similar to R_386_TLS_TPOFF,

but with negative relocation value.

Found by:	mpfr test suite, pointed to by ale
Reviewed by:	kan
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2011-10-08 12:42:19 +00:00
parent 4e63ea7386
commit ef9cbd91d0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=226156

View File

@ -213,9 +213,11 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, RtldLockState *lockstate)
break;
case R_386_TLS_TPOFF:
case R_386_TLS_TPOFF32:
{
const Elf_Sym *def;
const Obj_Entry *defobj;
Elf_Addr add;
def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj,
false, cache, lockstate);
@ -237,8 +239,11 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, RtldLockState *lockstate)
goto done;
}
}
*where += (Elf_Addr) (def->st_value - defobj->tlsoffset);
add = (Elf_Addr) (def->st_value - defobj->tlsoffset);
if (ELF_R_TYPE(rel->r_info) == R_386_TLS_TPOFF)
*where += add;
else
*where -= add;
}
break;