[12/13] nptl: Move __default_pthread_attr, __default_pthread_attr_lock into libc

Message ID 2320d7987e65bc57dbef63c8af1448810cd2f3ea.1620323953.git.fweimer@redhat.com
State Committed
Commit 8c1c0da3a8112695d5cc82aae22666321965b42f
Headers
Series Linux: Move most stack management out of libpthread |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Florian Weimer May 6, 2021, 6:11 p.m. UTC
  The GLIBC_PRIVATE exports for these symbols are expected to be
temporary.
---
 nptl/Makefile   | 2 +-
 nptl/Versions   | 2 ++
 nptl/pthreadP.h | 8 +++++---
 nptl/vars.c     | 8 ++++++--
 4 files changed, 14 insertions(+), 6 deletions(-)
  

Comments

Carlos O'Donell May 9, 2021, 9:41 p.m. UTC | #1
On 5/6/21 2:11 PM, Florian Weimer via Libc-alpha wrote:
> The GLIBC_PRIVATE exports for these symbols are expected to be
> temporary.

LGTM.

Tested on x86_64 and i686 without regression.

Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>


> ---
>  nptl/Makefile   | 2 +-
>  nptl/Versions   | 2 ++
>  nptl/pthreadP.h | 8 +++++---
>  nptl/vars.c     | 8 ++++++--
>  4 files changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/nptl/Makefile b/nptl/Makefile
> index b5f26c6864..f7723cb808 100644
> --- a/nptl/Makefile
> +++ b/nptl/Makefile
> @@ -170,6 +170,7 @@ routines = \
>    sem_wait \
>    tpp \
>    unwind \
> +  vars \
>  
>  shared-only-routines = forward
>  static-only-routines = pthread_atfork
> @@ -212,7 +213,6 @@ libpthread-routines = \
>    pthread_sigqueue \
>    pthread_timedjoin \
>    pthread_tryjoin \
> -  vars \
>    version \
>  
>  libpthread-shared-only-routines = \
> diff --git a/nptl/Versions b/nptl/Versions
> index fb15a7e8eb..d439a023b7 100644
> --- a/nptl/Versions
> +++ b/nptl/Versions
> @@ -298,6 +298,8 @@ libc {
>      tss_set;
>    }
>    GLIBC_PRIVATE {
> +    __default_pthread_attr;
> +    __default_pthread_attr_lock;
>      __futex_abstimed_wait64;
>      __futex_abstimed_wait_cancelable64;
>      __init_sched_fifo_prio;
> diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
> index 3a6b436400..6b912f053b 100644
> --- a/nptl/pthreadP.h
> +++ b/nptl/pthreadP.h
> @@ -198,9 +198,11 @@ enum
>  
>  
>  /* Default pthread attributes.  */
> -extern union pthread_attr_transparent __default_pthread_attr attribute_hidden;
> -extern int __default_pthread_attr_lock attribute_hidden;
> -/* Called from __libpthread_freeres to deallocate the default attribute.  */
> +extern union pthread_attr_transparent __default_pthread_attr;
> +libc_hidden_proto (__default_pthread_attr)
> +extern int __default_pthread_attr_lock;
> +libc_hidden_proto (__default_pthread_attr_lock)
> +/* Called from __libc_freeres to deallocate the default attribute.  */
>  extern void __default_pthread_attr_freeres (void) attribute_hidden;
>  
>  /* Size and alignment of static TLS block.  */
> diff --git a/nptl/vars.c b/nptl/vars.c
> index 03a6cc84be..989d7930e0 100644
> --- a/nptl/vars.c
> +++ b/nptl/vars.c
> @@ -22,7 +22,11 @@
>  
>  /* Default thread attributes for the case when the user does not
>     provide any.  */
> -union pthread_attr_transparent __default_pthread_attr attribute_hidden;
> +union pthread_attr_transparent __default_pthread_attr
> +  __attribute__ ((nocommon));
> +libc_hidden_data_def (__default_pthread_attr)
>  
>  /* Mutex protecting __default_pthread_attr.  */
> -int __default_pthread_attr_lock = LLL_LOCK_INITIALIZER;
> +int __default_pthread_attr_lock __attribute__ ((nocommon))
> +  = LLL_LOCK_INITIALIZER;
> +libc_hidden_data_def (__default_pthread_attr_lock)
>
  
Carlos O'Donell May 9, 2021, 9:42 p.m. UTC | #2
On 5/6/21 2:11 PM, Florian Weimer via Libc-alpha wrote:
> The GLIBC_PRIVATE exports for these symbols are expected to be
> temporary.
> ---
>  nptl/Makefile   | 2 +-
>  nptl/Versions   | 2 ++
>  nptl/pthreadP.h | 8 +++++---
>  nptl/vars.c     | 8 ++++++--
>  4 files changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/nptl/Makefile b/nptl/Makefile
> index b5f26c6864..f7723cb808 100644
> --- a/nptl/Makefile
> +++ b/nptl/Makefile
> @@ -170,6 +170,7 @@ routines = \
>    sem_wait \
>    tpp \
>    unwind \
> +  vars \
>  
>  shared-only-routines = forward
>  static-only-routines = pthread_atfork
> @@ -212,7 +213,6 @@ libpthread-routines = \
>    pthread_sigqueue \
>    pthread_timedjoin \
>    pthread_tryjoin \
> -  vars \
>    version \
>  
>  libpthread-shared-only-routines = \
> diff --git a/nptl/Versions b/nptl/Versions
> index fb15a7e8eb..d439a023b7 100644
> --- a/nptl/Versions
> +++ b/nptl/Versions
> @@ -298,6 +298,8 @@ libc {
>      tss_set;
>    }
>    GLIBC_PRIVATE {
> +    __default_pthread_attr;
> +    __default_pthread_attr_lock;
>      __futex_abstimed_wait64;
>      __futex_abstimed_wait_cancelable64;
>      __init_sched_fifo_prio;
> diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
> index 3a6b436400..6b912f053b 100644
> --- a/nptl/pthreadP.h
> +++ b/nptl/pthreadP.h
> @@ -198,9 +198,11 @@ enum
>  
>  
>  /* Default pthread attributes.  */
> -extern union pthread_attr_transparent __default_pthread_attr attribute_hidden;
> -extern int __default_pthread_attr_lock attribute_hidden;
> -/* Called from __libpthread_freeres to deallocate the default attribute.  */
> +extern union pthread_attr_transparent __default_pthread_attr;
> +libc_hidden_proto (__default_pthread_attr)
> +extern int __default_pthread_attr_lock;
> +libc_hidden_proto (__default_pthread_attr_lock)
> +/* Called from __libc_freeres to deallocate the default attribute.  */
>  extern void __default_pthread_attr_freeres (void) attribute_hidden;
>  
>  /* Size and alignment of static TLS block.  */
> diff --git a/nptl/vars.c b/nptl/vars.c
> index 03a6cc84be..989d7930e0 100644
> --- a/nptl/vars.c
> +++ b/nptl/vars.c
> @@ -22,7 +22,11 @@
>  
>  /* Default thread attributes for the case when the user does not
>     provide any.  */
> -union pthread_attr_transparent __default_pthread_attr attribute_hidden;
> +union pthread_attr_transparent __default_pthread_attr
> +  __attribute__ ((nocommon));
> +libc_hidden_data_def (__default_pthread_attr)
>  
>  /* Mutex protecting __default_pthread_attr.  */
> -int __default_pthread_attr_lock = LLL_LOCK_INITIALIZER;
> +int __default_pthread_attr_lock __attribute__ ((nocommon))
> +  = LLL_LOCK_INITIALIZER;
> +libc_hidden_data_def (__default_pthread_attr_lock)
>
  

Patch

diff --git a/nptl/Makefile b/nptl/Makefile
index b5f26c6864..f7723cb808 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -170,6 +170,7 @@  routines = \
   sem_wait \
   tpp \
   unwind \
+  vars \
 
 shared-only-routines = forward
 static-only-routines = pthread_atfork
@@ -212,7 +213,6 @@  libpthread-routines = \
   pthread_sigqueue \
   pthread_timedjoin \
   pthread_tryjoin \
-  vars \
   version \
 
 libpthread-shared-only-routines = \
diff --git a/nptl/Versions b/nptl/Versions
index fb15a7e8eb..d439a023b7 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -298,6 +298,8 @@  libc {
     tss_set;
   }
   GLIBC_PRIVATE {
+    __default_pthread_attr;
+    __default_pthread_attr_lock;
     __futex_abstimed_wait64;
     __futex_abstimed_wait_cancelable64;
     __init_sched_fifo_prio;
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index 3a6b436400..6b912f053b 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -198,9 +198,11 @@  enum
 
 
 /* Default pthread attributes.  */
-extern union pthread_attr_transparent __default_pthread_attr attribute_hidden;
-extern int __default_pthread_attr_lock attribute_hidden;
-/* Called from __libpthread_freeres to deallocate the default attribute.  */
+extern union pthread_attr_transparent __default_pthread_attr;
+libc_hidden_proto (__default_pthread_attr)
+extern int __default_pthread_attr_lock;
+libc_hidden_proto (__default_pthread_attr_lock)
+/* Called from __libc_freeres to deallocate the default attribute.  */
 extern void __default_pthread_attr_freeres (void) attribute_hidden;
 
 /* Size and alignment of static TLS block.  */
diff --git a/nptl/vars.c b/nptl/vars.c
index 03a6cc84be..989d7930e0 100644
--- a/nptl/vars.c
+++ b/nptl/vars.c
@@ -22,7 +22,11 @@ 
 
 /* Default thread attributes for the case when the user does not
    provide any.  */
-union pthread_attr_transparent __default_pthread_attr attribute_hidden;
+union pthread_attr_transparent __default_pthread_attr
+  __attribute__ ((nocommon));
+libc_hidden_data_def (__default_pthread_attr)
 
 /* Mutex protecting __default_pthread_attr.  */
-int __default_pthread_attr_lock = LLL_LOCK_INITIALIZER;
+int __default_pthread_attr_lock __attribute__ ((nocommon))
+  = LLL_LOCK_INITIALIZER;
+libc_hidden_data_def (__default_pthread_attr_lock)