[06/19] nptl: Make __pthread_attr_init, __pthread_attr_destroy available internally

Message ID dd7d115d4be92c3b483c46bdb24331c80d53ec31.1589884403.git.fweimer@redhat.com
State New
Headers show
Series
  • Signal mask for timer helper thread
Related show

Commit Message

Florian Weimer via Libc-alpha May 19, 2020, 10:44 a.m.
pthread_attr_destroy needs to be a weak alias to avoid future
linknamespace failures.
---
 nptl/Versions               | 1 +
 nptl/pthreadP.h             | 4 +++-
 nptl/pthread_attr_destroy.c | 3 ++-
 nptl/pthread_attr_init.c    | 5 +++--
 4 files changed, 9 insertions(+), 4 deletions(-)

-- 
2.25.4

Comments

Florian Weimer via Libc-alpha May 20, 2020, 1:59 p.m. | #1
On 5/19/20 6:44 AM, Florian Weimer via Libc-alpha wrote:
> pthread_attr_destroy needs to be a weak alias to avoid future

> linknamespace failures.


Agreed.

> ---

>  nptl/Versions               | 1 +

>  nptl/pthreadP.h             | 4 +++-

>  nptl/pthread_attr_destroy.c | 3 ++-

>  nptl/pthread_attr_init.c    | 5 +++--

>  4 files changed, 9 insertions(+), 4 deletions(-)

> 


OK for master.

Tested clean on x86_64 and i686.

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

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


> diff --git a/nptl/Versions b/nptl/Versions

> index ce08076611..65f0c077da 100644

> --- a/nptl/Versions

> +++ b/nptl/Versions

> @@ -59,6 +59,7 @@ libc {

>      # Used by the C11 threads implementation.

>      __pthread_cond_destroy; __pthread_cond_init;

>      __pthread_attr_setaffinity_np;

> +    __pthread_attr_init; __pthread_attr_destroy;


OK.

>    }

>  }

>  

> diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h

> index ac0135422b..f218b01574 100644

> --- a/nptl/pthreadP.h

> +++ b/nptl/pthreadP.h

> @@ -347,7 +347,8 @@ extern int __pthread_create_2_1 (pthread_t *newthread,

>  extern int __pthread_create_2_0 (pthread_t *newthread,

>  				 const pthread_attr_t *attr,

>  				 void *(*start_routine) (void *), void *arg);

> -extern int __pthread_attr_init_2_1 (pthread_attr_t *attr);

> +extern int __pthread_attr_init (pthread_attr_t *attr);

> +libc_hidden_proto (__pthread_attr_init)

>  extern int __pthread_attr_init_2_0 (pthread_attr_t *attr);

>  

>  

> @@ -403,6 +404,7 @@ extern int __pthread_mutexattr_init (pthread_mutexattr_t *attr);

>  extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *attr);

>  extern int __pthread_mutexattr_settype (pthread_mutexattr_t *attr, int kind);

>  extern int __pthread_attr_destroy (pthread_attr_t *attr);

> +libc_hidden_proto (__pthread_attr_destroy)

>  extern int __pthread_attr_getdetachstate (const pthread_attr_t *attr,

>  					  int *detachstate);

>  extern int __pthread_attr_setdetachstate (pthread_attr_t *attr,

> diff --git a/nptl/pthread_attr_destroy.c b/nptl/pthread_attr_destroy.c

> index d20f209377..21f8026a2c 100644

> --- a/nptl/pthread_attr_destroy.c

> +++ b/nptl/pthread_attr_destroy.c

> @@ -39,4 +39,5 @@ __pthread_attr_destroy (pthread_attr_t *attr)

>  

>    return 0;

>  }

> -strong_alias (__pthread_attr_destroy, pthread_attr_destroy)

> +libc_hidden_def (__pthread_attr_destroy)

> +weak_alias (__pthread_attr_destroy, pthread_attr_destroy)


OK.

> diff --git a/nptl/pthread_attr_init.c b/nptl/pthread_attr_init.c

> index f15cccab0a..acc22c64c4 100644

> --- a/nptl/pthread_attr_init.c

> +++ b/nptl/pthread_attr_init.c

> @@ -29,7 +29,7 @@ int __attr_list_lock = LLL_LOCK_INITIALIZER;

>  

>  

>  int

> -__pthread_attr_init_2_1 (pthread_attr_t *attr)

> +__pthread_attr_init (pthread_attr_t *attr)

>  {

>    struct pthread_attr *iattr;

>  

> @@ -48,7 +48,8 @@ __pthread_attr_init_2_1 (pthread_attr_t *attr)

>  

>    return 0;

>  }

> -versioned_symbol (libc, __pthread_attr_init_2_1, pthread_attr_init, GLIBC_2_1);

> +libc_hidden_def (__pthread_attr_init)

> +versioned_symbol (libc, __pthread_attr_init, pthread_attr_init, GLIBC_2_1);

>  

>  

>  #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_1)

> 



-- 
Cheers,
Carlos.

Patch

diff --git a/nptl/Versions b/nptl/Versions
index ce08076611..65f0c077da 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -59,6 +59,7 @@  libc {
     # Used by the C11 threads implementation.
     __pthread_cond_destroy; __pthread_cond_init;
     __pthread_attr_setaffinity_np;
+    __pthread_attr_init; __pthread_attr_destroy;
   }
 }
 
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index ac0135422b..f218b01574 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -347,7 +347,8 @@  extern int __pthread_create_2_1 (pthread_t *newthread,
 extern int __pthread_create_2_0 (pthread_t *newthread,
 				 const pthread_attr_t *attr,
 				 void *(*start_routine) (void *), void *arg);
-extern int __pthread_attr_init_2_1 (pthread_attr_t *attr);
+extern int __pthread_attr_init (pthread_attr_t *attr);
+libc_hidden_proto (__pthread_attr_init)
 extern int __pthread_attr_init_2_0 (pthread_attr_t *attr);
 
 
@@ -403,6 +404,7 @@  extern int __pthread_mutexattr_init (pthread_mutexattr_t *attr);
 extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *attr);
 extern int __pthread_mutexattr_settype (pthread_mutexattr_t *attr, int kind);
 extern int __pthread_attr_destroy (pthread_attr_t *attr);
+libc_hidden_proto (__pthread_attr_destroy)
 extern int __pthread_attr_getdetachstate (const pthread_attr_t *attr,
 					  int *detachstate);
 extern int __pthread_attr_setdetachstate (pthread_attr_t *attr,
diff --git a/nptl/pthread_attr_destroy.c b/nptl/pthread_attr_destroy.c
index d20f209377..21f8026a2c 100644
--- a/nptl/pthread_attr_destroy.c
+++ b/nptl/pthread_attr_destroy.c
@@ -39,4 +39,5 @@  __pthread_attr_destroy (pthread_attr_t *attr)
 
   return 0;
 }
-strong_alias (__pthread_attr_destroy, pthread_attr_destroy)
+libc_hidden_def (__pthread_attr_destroy)
+weak_alias (__pthread_attr_destroy, pthread_attr_destroy)
diff --git a/nptl/pthread_attr_init.c b/nptl/pthread_attr_init.c
index f15cccab0a..acc22c64c4 100644
--- a/nptl/pthread_attr_init.c
+++ b/nptl/pthread_attr_init.c
@@ -29,7 +29,7 @@  int __attr_list_lock = LLL_LOCK_INITIALIZER;
 
 
 int
-__pthread_attr_init_2_1 (pthread_attr_t *attr)
+__pthread_attr_init (pthread_attr_t *attr)
 {
   struct pthread_attr *iattr;
 
@@ -48,7 +48,8 @@  __pthread_attr_init_2_1 (pthread_attr_t *attr)
 
   return 0;
 }
-versioned_symbol (libc, __pthread_attr_init_2_1, pthread_attr_init, GLIBC_2_1);
+libc_hidden_def (__pthread_attr_init)
+versioned_symbol (libc, __pthread_attr_init, pthread_attr_init, GLIBC_2_1);
 
 
 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_1)