Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Mar 2012 10:32:34 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r233655 - head/libexec/rtld-elf
Message-ID:  <201203291032.q2TAWYVa088905@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Thu Mar 29 10:32:34 2012
New Revision: 233655
URL: http://svn.freebsd.org/changeset/base/233655

Log:
  Import DragonFly BSD commit
  
    From: Sascha Wildner <saw@online.de>
    Date: Fri, 2 Mar 2012 09:15:56 +0000 (+0100)
    Subject: rtld: Add a special case in do_dlsym() for TLS stored symbols.
    X-Git-Url: http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/1388aaafe730c85693936aaf9bc6d83fc2d981be?hp=bca4412595a8979ab9f1bf36068c806ce88a667a
  
    rtld: Add a special case in do_dlsym() for TLS stored symbols.
  
    Submitted-by: Markus Pfeiffer <markus.pfeiffer@morphism.de>
  
  Discussed with:	kan
  MFC after:	1 week

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

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c	Thu Mar 29 09:19:00 2012	(r233654)
+++ head/libexec/rtld-elf/rtld.c	Thu Mar 29 10:32:34 2012	(r233655)
@@ -2618,6 +2618,7 @@ do_dlsym(void *handle, const char *name,
     const Elf_Sym *def;
     SymLook req;
     RtldLockState lockstate;
+    tls_index ti;
     int res;
 
     def = NULL;
@@ -2732,7 +2733,11 @@ do_dlsym(void *handle, const char *name,
 	    return (make_function_pointer(def, defobj));
 	else if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC)
 	    return (rtld_resolve_ifunc(defobj, def));
-	else
+	else if (ELF_ST_TYPE(def->st_info) == STT_TLS) {
+	    ti.ti_module = defobj->tlsindex;
+	    ti.ti_offset = def->st_value;
+	    return (__tls_get_addr(&ti));
+	} else
 	    return (defobj->relocbase + def->st_value);
     }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203291032.q2TAWYVa088905>