summaryrefslogtreecommitdiff
path: root/ldso/ldso/dl-tls.c
diff options
context:
space:
mode:
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