about summary refs log tree commit diff
path: root/sysdeps/nptl/libc-lockP.h
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-05-03 08:12:11 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-05-03 08:14:01 +0200
commit575295fc8314b089e52f98de4aa16a9d7aeb9bf4 (patch)
treebeee73fc51f4c1213cf54e9b137ef9d776eaab66 /sysdeps/nptl/libc-lockP.h
parentad201afe5c348de265b92bae6688034102a4386b (diff)
downloadglibc-575295fc8314b089e52f98de4aa16a9d7aeb9bf4.tar.gz
glibc-575295fc8314b089e52f98de4aa16a9d7aeb9bf4.tar.xz
glibc-575295fc8314b089e52f98de4aa16a9d7aeb9bf4.zip
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 <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'sysdeps/nptl/libc-lockP.h')
-rw-r--r--sysdeps/nptl/libc-lockP.h10
1 files changed, 8 insertions, 2 deletions
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)