svn commit: r233833 - stable/9/libexec/rtld-elf

Konstantin Belousov kib at FreeBSD.org
Tue Apr 3 09:02:20 UTC 2012


Author: kib
Date: Tue Apr  3 09:02:19 2012
New Revision: 233833
URL: http://svn.freebsd.org/changeset/base/233833

Log:
  MFC r233655:
  Add a special case in do_dlsym() for TLS stored symbols.
  
  MFC r233674:
  Fix ia64 build after r233655.

Modified:
  stable/9/libexec/rtld-elf/rtld.c
Directory Properties:
  stable/9/libexec/rtld-elf/   (props changed)

Modified: stable/9/libexec/rtld-elf/rtld.c
==============================================================================
--- stable/9/libexec/rtld-elf/rtld.c	Tue Apr  3 08:56:29 2012	(r233832)
+++ stable/9/libexec/rtld-elf/rtld.c	Tue Apr  3 09:02:19 2012	(r233833)
@@ -2620,6 +2620,9 @@ do_dlsym(void *handle, const char *name,
     const Elf_Sym *def;
     SymLook req;
     RtldLockState lockstate;
+#ifndef __ia64__
+    tls_index ti;
+#endif
     int res;
 
     def = NULL;
@@ -2734,7 +2737,15 @@ 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) {
+#ifdef __ia64__
+	    return (__tls_get_addr(defobj->tlsindex, def->st_value));
+#else
+	    ti.ti_module = defobj->tlsindex;
+	    ti.ti_offset = def->st_value;
+	    return (__tls_get_addr(&ti));
+#endif
+	} else
 	    return (defobj->relocbase + def->st_value);
     }
 


More information about the svn-src-stable-9 mailing list