[git commit] libdl: fix tls symbol lookup in dlsym

Filippo Arcidiacono filippo.arcidiacono at st.com
Fri Jul 1 07:49:47 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=c0e02109219a857fc94a26a9eb07d60527730073
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

Due to merge with prelink, the sym_ref.tpnt is always set when the symbol
is found, so it needs to call the _dl_tls_symaddr only for tls symbols.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono at st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso at st.com>
---
 ldso/libdl/libdl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
index f95341b..5007a7e 100644
--- a/ldso/libdl/libdl.c
+++ b/ldso/libdl/libdl.c
@@ -710,7 +710,7 @@ void *dlsym(void *vhandle, const char *name)
 	ret = _dl_find_hash(name2, &handle->dyn->symbol_scope, tpnt, 0, &sym_ref);
 
 #if defined(USE_TLS) && USE_TLS && defined SHARED
-	if (sym_ref.tpnt) {
+	if (sym_ref.sym && (ELF_ST_TYPE(sym_ref.sym->st_info) == STT_TLS) && (sym_ref.tpnt)) {
 		/* The found symbol is a thread-local storage variable.
 		Return the address for to the current thread.  */
 		ret = _dl_tls_symaddr ((struct link_map *)sym_ref.tpnt, (Elf32_Addr)ret);
-- 
1.7.3.4



More information about the uClibc-cvs mailing list