svn commit: r226156 - head/libexec/rtld-elf/i386

Konstantin Belousov kib at FreeBSD.org
Sat Oct 8 12:42:21 UTC 2011


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;
 


More information about the svn-src-head mailing list