Author: kib
Date: Sat Oct  8 12:42:19 2011
New Revision: 226156
URL: http://svn.freebsd.org/changeset/base/226156

Log:
  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

Modified:
  head/libexec/rtld-elf/i386/reloc.c

Modified: head/libexec/rtld-elf/i386/reloc.c
==============================================================================
--- head/libexec/rtld-elf/i386/reloc.c  Sat Oct  8 12:39:47 2011        
(r226155)
+++ head/libexec/rtld-elf/i386/reloc.c  Sat Oct  8 12:42:19 2011        
(r226156)
@@ -213,9 +213,11 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry 
                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 
                            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;
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to