rtld: Add a special case in do_dlsym() for TLS stored symbols.
authorSascha Wildner <saw@online.de>
Fri, 2 Mar 2012 09:15:56 +0000 (10:15 +0100)
committerJohn Marino <draco@marino.st>
Fri, 30 Mar 2012 19:27:22 +0000 (21:27 +0200)
Submitted-by: Markus Pfeiffer <markus.pfeiffer@morphism.de>
Conflicts:

libexec/rtld-elf/rtld.c

libexec/rtld-elf/rtld.c

index 5a37546..d7f3551 100644 (file)
@@ -2323,7 +2323,12 @@ do_dlsym(void *handle, const char *name, void *retaddr, const Ver_Entry *ve,
         */
        if (ELF_ST_TYPE(def->st_info) == STT_FUNC)
            return (make_function_pointer(def, defobj));
-       else
+       else if (ELF_ST_TYPE(def->st_info) == STT_TLS) {
+           tls_index ti;
+           ti.ti_module = defobj->tlsindex;
+           ti.ti_offset = def->st_value;
+           return (__tls_get_addr(&ti));
+       } else
            return (defobj->relocbase + def->st_value);
     }