]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Optimize __libc_tsd_* thread variable access
authorFlorian Weimer <fweimer@redhat.com>
Fri, 16 May 2025 17:53:09 +0000 (19:53 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Fri, 16 May 2025 17:53:09 +0000 (19:53 +0200)
These variables are not exported, and libc.so TLS is initial-exec
anyway.  Declare these variables as hidden and use the initial-exec
TLS model.

Reviewed-by: Frédéric Bérat <fberat@redhat.com>
include/ctype.h
include/rpc/rpc.h
locale/localeinfo.h

index e993adc86da43b7c3047834c6aa1e051fed532ac..0f6e7fc7ea28f821b290f5b0c31b5afb7fc37723 100644 (file)
@@ -29,9 +29,12 @@ libc_hidden_proto (toupper)
 #   define CTYPE_EXTERN_INLINE extern inline
 #  endif
 
-extern __thread const uint16_t * __libc_tsd_CTYPE_B;
-extern __thread const int32_t * __libc_tsd_CTYPE_TOUPPER;
-extern __thread const int32_t * __libc_tsd_CTYPE_TOLOWER;
+extern __thread const uint16_t * __libc_tsd_CTYPE_B
+  attribute_hidden attribute_tls_model_ie;
+extern __thread const int32_t * __libc_tsd_CTYPE_TOUPPER
+  attribute_hidden attribute_tls_model_ie;
+extern __thread const int32_t * __libc_tsd_CTYPE_TOLOWER
+  attribute_hidden attribute_tls_model_ie;
 
 
 CTYPE_EXTERN_INLINE const uint16_t ** __attribute__ ((const))
index 936ea3cebb8101e158ca591aa72f94793a0175e1..ba967833ad8d8ac33e138032ff6f3e7fa1320a43 100644 (file)
@@ -45,7 +45,8 @@ extern void __rpc_thread_key_cleanup (void) attribute_hidden;
 
 extern void __rpc_thread_destroy (void) attribute_hidden;
 
-extern __thread struct rpc_thread_variables *__libc_tsd_RPC_VARS;
+extern __thread struct rpc_thread_variables *__libc_tsd_RPC_VARS
+  attribute_hidden attribute_tls_model_ie;
 
 #define RPC_THREAD_VARIABLE(x) (__rpc_thread_variables()->x)
 
index 40e11865cac20139a9e1c3d7371d8ebe898f5a36..f503792d0428df7c889a7fb31a1f0fbd54c57e7f 100644 (file)
@@ -237,7 +237,8 @@ extern struct __locale_struct _nl_global_locale attribute_hidden;
 /* This fetches the thread-local locale_t pointer, either one set with
    uselocale or &_nl_global_locale.  */
 #define _NL_CURRENT_LOCALE     __libc_tsd_LOCALE
-extern __thread locale_t __libc_tsd_LOCALE;
+extern __thread locale_t __libc_tsd_LOCALE
+  attribute_hidden attribute_tls_model_ie;
 
 /* For static linking it is desireable to avoid always linking in the code
    and data for every category when we can tell at link time that they are