diff options
author | kib <kib@FreeBSD.org> | 2011-10-08 12:42:19 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2011-10-08 12:42:19 +0000 |
commit | a011c99980aa09ec857ee5006943c95bfce6a95b (patch) | |
tree | 13c1ed24007e8e35cab0c6cad2c864be9b4aa84c /libexec | |
parent | 85d4378ca8b2ee0b3c911448dbf9ef0978cbe1d7 (diff) | |
download | FreeBSD-src-a011c99980aa09ec857ee5006943c95bfce6a95b.zip FreeBSD-src-a011c99980aa09ec857ee5006943c95bfce6a95b.tar.gz |
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
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/rtld-elf/i386/reloc.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libexec/rtld-elf/i386/reloc.c b/libexec/rtld-elf/i386/reloc.c index 9efebb3..c9a6e53 100644 --- a/libexec/rtld-elf/i386/reloc.c +++ b/libexec/rtld-elf/i386/reloc.c @@ -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; |