aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-sym.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-sym.c')
-rw-r--r--elf/dl-sym.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/elf/dl-sym.c b/elf/dl-sym.c
index b0db159aa6..8cb5d2f411 100644
--- a/elf/dl-sym.c
+++ b/elf/dl-sym.c
@@ -83,7 +83,16 @@ RTLD_NEXT used in code not dynamically loaded"));
}
if (ref != NULL)
- return DL_SYMBOL_ADDRESS (result, ref);
+ {
+#if defined USE_TLS && defined SHARED
+ if (ELFW(ST_TYPE) (ref->st_info) == STT_TLS)
+ /* The found symbol is a thread-local storage variable.
+ Return the address for to the current thread. */
+ return _dl_tls_symaddr (result, ref);
+#endif
+
+ return DL_SYMBOL_ADDRESS (result, ref);
+ }
return NULL;
}
@@ -152,7 +161,16 @@ RTLD_NEXT used in code not dynamically loaded"));
}
if (ref != NULL)
- return DL_SYMBOL_ADDRESS (result, ref);
+ {
+#if defined USE_TLS && defined SHARED
+ if (ELFW(ST_TYPE) (ref->st_info) == STT_TLS)
+ /* The found symbol is a thread-local storage variable.
+ Return the address for to the current thread. */
+ return _dl_tls_symaddr (result, ref);
+#endif
+
+ return DL_SYMBOL_ADDRESS (result, ref);
+ }
return NULL;
}