From 8ffc85f2942f486905c80bc9fab80e8928024f62 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Fri, 2 Mar 2012 10:15:56 +0100 Subject: [PATCH] rtld: Add a special case in do_dlsym() for TLS stored symbols. Submitted-by: Markus Pfeiffer Conflicts: libexec/rtld-elf/rtld.c --- libexec/rtld-elf/rtld.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 5a37546948..d7f35516ad 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -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); } -- 2.41.0