summaryrefslogtreecommitdiff
path: root/ldso/ldso/dl-tls.c
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2014-09-20 22:36:23 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2014-09-22 20:35:40 +0200
commit4c3023bc803012656cf45749960282351efc8020 (patch)
tree979feef511fde3dbe564e5362e89a2e8b793909e /ldso/ldso/dl-tls.c
parent51f9b66d2fee1c7c1088b548751ac64131220b6e (diff)
xtensa: add support for NPTL
Changes from: https://github.com/foss-xtensa/uClibc/commits/xtensa_nptl Author: Chris Zankel <chris@zankel.net> Author: Baruch Siach <baruch@tkos.co.il>
Diffstat (limited to 'ldso/ldso/dl-tls.c')
-rw-r--r--ldso/ldso/dl-tls.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/ldso/ldso/dl-tls.c b/ldso/ldso/dl-tls.c
index 6679693f4..5d6d3b9d3 100644
--- a/ldso/ldso/dl-tls.c
+++ b/ldso/ldso/dl-tls.c
@@ -100,20 +100,16 @@ _dl_realloc (void * __ptr, size_t __size)
* the static TLS area already allocated for each running thread. If this
* object's TLS segment is too big to fit, we fail. If it fits,
* we set MAP->l_tls_offset and return.
- * This function intentionally does not return any value but signals error
- * directly, as static TLS should be rare and code handling it should
- * not be inlined as much as possible.
*/
-void
-internal_function __attribute_noinline__
-_dl_allocate_static_tls (struct link_map *map)
+int
+internal_function
+_dl_try_allocate_static_tls (struct link_map* map)
{
/* If the alignment requirements are too high fail. */
if (map->l_tls_align > _dl_tls_static_align)
{
fail:
- _dl_dprintf(2, "cannot allocate memory in static TLS block");
- _dl_exit(30);
+ return -1;
}
# ifdef TLS_TCB_AT_TP
@@ -169,6 +165,23 @@ fail:
}
else
map->l_need_tls_init = 1;
+
+ return 0;
+}
+
+/*
+ * This function intentionally does not return any value but signals error
+ * directly, as static TLS should be rare and code handling it should
+ * not be inlined as much as possible.
+ */
+void
+internal_function __attribute_noinline__
+_dl_allocate_static_tls (struct link_map *map)
+{
+ if (_dl_try_allocate_static_tls (map)) {
+ _dl_dprintf(2, "cannot allocate memory in static TLS block");
+ _dl_exit(30);
+ }
}
#ifdef SHARED