summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2025-05-16 19:53:09 +0200
committerFlorian Weimer <fweimer@redhat.com>2025-05-16 19:53:09 +0200
commita894f04d877653bea1639fc9a4adf73bd9347bf4 (patch)
tree5714300710d74cc535049fda28f1860e53955b1a
parent10a66a8e421b09682b774c795ef1da402235dddc (diff)
Optimize __libc_tsd_* thread variable access
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>
-rw-r--r--include/ctype.h9
-rw-r--r--include/rpc/rpc.h3
-rw-r--r--locale/localeinfo.h3
3 files changed, 10 insertions, 5 deletions
diff --git a/include/ctype.h b/include/ctype.h
index e993adc86d..0f6e7fc7ea 100644
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -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))
diff --git a/include/rpc/rpc.h b/include/rpc/rpc.h
index 936ea3cebb..ba967833ad 100644
--- a/include/rpc/rpc.h
+++ b/include/rpc/rpc.h
@@ -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)
diff --git a/locale/localeinfo.h b/locale/localeinfo.h
index 40e11865ca..f503792d04 100644
--- a/locale/localeinfo.h
+++ b/locale/localeinfo.h
@@ -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