From 4c3023bc803012656cf45749960282351efc8020 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sat, 20 Sep 2014 22:36:23 +0200 Subject: xtensa: add support for NPTL Changes from: https://github.com/foss-xtensa/uClibc/commits/xtensa_nptl Author: Chris Zankel Author: Baruch Siach --- ldso/ldso/dl-tls.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'ldso/ldso/dl-tls.c') 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 -- cgit v1.2.3