diff options
author | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2020-06-10 13:40:40 +0100 |
---|---|---|
committer | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2020-07-08 17:32:56 +0100 |
commit | ffb17e7ba3a5ba9632cee97330b325072fbe41dd (patch) | |
tree | bf6865a3ec36c6a818a73bee954b06568154a90f /elf/dynamic-link.h | |
parent | 17796419b5fd694348cceb65c3f77601faae082c (diff) | |
download | glibc-ffb17e7ba3a5ba9632cee97330b325072fbe41dd.tar.gz glibc-ffb17e7ba3a5ba9632cee97330b325072fbe41dd.tar.xz glibc-ffb17e7ba3a5ba9632cee97330b325072fbe41dd.zip |
rtld: Avoid using up static TLS surplus for optimizations [BZ #25051]
On some targets static TLS surplus area can be used opportunistically for dynamically loaded modules such that the TLS access then becomes faster (TLSDESC and powerpc TLS optimization). However we don't want all surplus TLS to be used for this optimization because dynamically loaded modules with initial-exec model TLS can only use surplus TLS. The new contract for surplus static TLS use is: - libc.so can have up to 192 bytes of IE TLS, - other system libraries together can have up to 144 bytes of IE TLS. - Some "optional" static TLS is available for opportunistic use. The optional TLS is now tunable: rtld.optional_static_tls, so users can directly affect the allocated static TLS size. (Note that module unloading with dlclose does not reclaim static TLS. After the optional TLS runs out, TLS access is no longer optimized to use static TLS.) The default setting of rtld.optional_static_tls is 512 so the surplus TLS is 3*192 + 4*144 + 512 = 1664 by default, the same as before. Fixes BZ #25051. Tested on aarch64-linux-gnu and x86_64-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'elf/dynamic-link.h')
-rw-r--r-- | elf/dynamic-link.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h index bb7a66f4cd..6727233e1a 100644 --- a/elf/dynamic-link.h +++ b/elf/dynamic-link.h @@ -40,9 +40,10 @@ (__builtin_expect ((sym_map)->l_tls_offset \ != FORCED_DYNAMIC_TLS_OFFSET, 1) \ && (__builtin_expect ((sym_map)->l_tls_offset != NO_TLS_OFFSET, 1) \ - || _dl_try_allocate_static_tls (sym_map) == 0)) + || _dl_try_allocate_static_tls (sym_map, true) == 0)) -int _dl_try_allocate_static_tls (struct link_map *map) attribute_hidden; +int _dl_try_allocate_static_tls (struct link_map *map, bool optional) + attribute_hidden; #include <elf.h> |