From 575295fc8314b089e52f98de4aa16a9d7aeb9bf4 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Mon, 3 May 2021 08:12:11 +0200 Subject: nptl: Move call_once into libc The symbol was moved using scripts/move-symbol-to-libc.py. This change also turns __pthread_once into a compatibility symbol because after the call_once move, an internal call to __pthread_once can be used. This an adjustment to __libc_once: Outside libc (e.g., in nscd), it has to call pthread_once. With __pthread_once as a compatibility symbol, it is no longer to add a new GLIBC_2.34 version after the move from libpthread, and this commit removes the new __pthread_once@@GLIBC_2.34 version. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell --- sysdeps/nptl/libc-lockP.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'sysdeps/nptl') diff --git a/sysdeps/nptl/libc-lockP.h b/sysdeps/nptl/libc-lockP.h index e573689799..aad9c9778c 100644 --- a/sysdeps/nptl/libc-lockP.h +++ b/sysdeps/nptl/libc-lockP.h @@ -210,9 +210,15 @@ _Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0"); CLASS pthread_once_t NAME = PTHREAD_ONCE_INIT #endif -/* Call handler iff the first call. */ -#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \ +/* Call handler iff the first call. Use a local call in libc, but the + global pthread_once symbol elsewhere. */ +#if IS_IN (libc) +# define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \ __pthread_once (&(ONCE_CONTROL), INIT_FUNCTION) +#else +# define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \ + pthread_once (&(ONCE_CONTROL), INIT_FUNCTION) +#endif /* Get once control variable. */ #define __libc_once_get(ONCE_CONTROL) ((ONCE_CONTROL) != PTHREAD_ONCE_INIT) -- cgit v1.2.3-70-g09d2