Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ld.elf_so/arch/i386 Add support for R_386_TLS_TPOFF3...



details:   https://anonhg.NetBSD.org/src/rev/5cbc662d35ec
branches:  trunk
changeset: 782574:5cbc662d35ec
user:      apb <apb%NetBSD.org@localhost>
date:      Wed Nov 07 07:24:46 2012 +0000

description:
Add support for R_386_TLS_TPOFF32.  This patch was created by
Nick Hudson for PR 47061.

diffstat:

 libexec/ld.elf_so/arch/i386/mdreloc.c |  21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diffs (44 lines):

diff -r ea689142c06f -r 5cbc662d35ec libexec/ld.elf_so/arch/i386/mdreloc.c
--- a/libexec/ld.elf_so/arch/i386/mdreloc.c     Wed Nov 07 05:18:51 2012 +0000
+++ b/libexec/ld.elf_so/arch/i386/mdreloc.c     Wed Nov 07 07:24:46 2012 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: mdreloc.c,v 1.34 2011/03/25 18:07:05 joerg Exp $       */
+/*     $NetBSD: mdreloc.c,v 1.35 2012/11/07 07:24:46 apb Exp $ */
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: mdreloc.c,v 1.34 2011/03/25 18:07:05 joerg Exp $");
+__RCSID("$NetBSD: mdreloc.c,v 1.35 2012/11/07 07:24:46 apb Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -129,13 +129,28 @@
                            _rtld_tls_offset_allocate(obj))
                                return -1;
 
-                       *where = (Elf_Addr)(def->st_value - defobj->tlsoffset);
+                       *where += (Elf_Addr)(def->st_value - defobj->tlsoffset);
 
                        rdbg(("TLS_TPOFF %s in %s --> %p",
                            obj->strtab + obj->symtab[symnum].st_name,
                            obj->path, (void *)*where));
                        break;
 
+               case R_TYPE(TLS_TPOFF32):
+                       def = _rtld_find_symdef(symnum, obj, &defobj, false);
+                       if (def == NULL)
+                               return -1;
+
+                       if (!defobj->tls_done &&
+                           _rtld_tls_offset_allocate(obj))
+                               return -1;
+
+                       *where += (Elf_Addr)(defobj->tlsoffset - def->st_value);
+                       rdbg(("TLS_TPOFF32 %s in %s --> %p",
+                           obj->strtab + obj->symtab[symnum].st_name,
+                           obj->path, (void *)*where));
+                       break;
+
                case R_TYPE(TLS_DTPMOD32):
                        def = _rtld_find_symdef(symnum, obj, &defobj, false);
                        if (def == NULL)



Home | Main Index | Thread Index | Old Index