public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: libc-alpha@sourceware.org
Subject: [PATCH 01/19] Add pthread-in-libc, libpthread-routines-var, librt-routines-var
Date: Mon, 26 Apr 2021 19:00:01 +0200	[thread overview]
Message-ID: <62101950200ba00285cf57a6e83aa4ef03816160.1619456219.git.fweimer@redhat.com> (raw)
In-Reply-To: <cover.1619456219.git.fweimer@redhat.com>

These make variables can be used to add routines to different
libraries for the Hurd and Linux builds.
---
 Makeconfig                     | 11 +++++++++++
 config.h.in                    |  3 +++
 config.make.in                 |  1 +
 configure                      |  8 ++++++++
 configure.ac                   |  6 ++++++
 rt/Makefile                    |  2 ++
 sysdeps/mach/hurd/configure    |  3 +++
 sysdeps/mach/hurd/configure.ac |  3 +++
 sysdeps/pthread/Makefile       |  3 +++
 9 files changed, 40 insertions(+)

diff --git a/Makeconfig b/Makeconfig
index 01f8638c2e..1d5e45926c 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -1328,6 +1328,17 @@ endif
 sysd-rules-targets := $(sort $(foreach p,$(sysd-rules-patterns),\
 					 $(firstword $(subst :, ,$p))))
 
+# $(libpthread-routines-var) and $(librt-routines-var) are the make
+# variable to which pthread routines need to be added to land in the
+# right library.
+ifeq ($(pthread-in-libc),yes)
+libpthread-routines-var = routines
+librt-routines-var = routines
+else
+libpthread-routines-var = libpthread-routines
+librt-routines-var = libpthread-routines
+endif
+
 # A sysdeps Makeconfig fragment may set libc-reentrant to yes.
 ifeq (yes,$(libc-reentrant))
 defines += -D_LIBC_REENTRANT
diff --git a/config.h.in b/config.h.in
index ea56e5b4a4..99036b887f 100644
--- a/config.h.in
+++ b/config.h.in
@@ -200,6 +200,9 @@
    multiple symbol versions for one symbol.  */
 #define SYMVER_NEEDS_ALIAS 0
 
+/* Define to 1 if libpthread actually resides in libc.  */
+#define PTHREAD_IN_LIBC 0
+
 /*
 \f */
 
diff --git a/config.make.in b/config.make.in
index 7f47f0caa4..cbf59114b0 100644
--- a/config.make.in
+++ b/config.make.in
@@ -103,6 +103,7 @@ use-nscd = @use_nscd@
 build-hardcoded-path-in-tests= @hardcoded_path_in_tests@
 build-pt-chown = @build_pt_chown@
 have-tunables = @have_tunables@
+pthread-in-libc = @pthread_in_libc@
 
 # Build tools.
 CC = @CC@
diff --git a/configure b/configure
index e64b7f8efe..4cc462613c 100755
--- a/configure
+++ b/configure
@@ -588,6 +588,7 @@ ac_unique_file="include/features.h"
 enable_option_checking=no
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+pthread_in_libc
 RELEASE
 VERSION
 mach_interface_list
@@ -6780,6 +6781,7 @@ libc_cv_sysconfdir=$sysconfdir
 libc_cv_localstatedir=$localstatedir
 libc_cv_gcc_unwind_find_fde=no
 libc_cv_idn=no
+pthread_in_libc=yes
 
 # Iterate over all the sysdep directories we will use, running their
 # configure fragments.
@@ -6939,6 +6941,12 @@ RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
 
 
 
+if test "$pthread_in_libc" = yes; then
+  $as_echo "#define PTHREAD_IN_LIBC 1" >>confdefs.h
+
+fi
+
+
 ac_config_files="$ac_config_files config.make Makefile"
 
 ac_config_commands="$ac_config_commands default"
diff --git a/configure.ac b/configure.ac
index cc47e56e82..64be29d877 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1777,6 +1777,7 @@ libc_cv_sysconfdir=$sysconfdir
 libc_cv_localstatedir=$localstatedir
 libc_cv_gcc_unwind_find_fde=no
 libc_cv_idn=no
+pthread_in_libc=yes
 
 # Iterate over all the sysdep directories we will use, running their
 # configure fragments.
@@ -1903,6 +1904,11 @@ RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
 AC_SUBST(VERSION)
 AC_SUBST(RELEASE)
 
+if test "$pthread_in_libc" = yes; then
+  AC_DEFINE(PTHREAD_IN_LIBC)
+fi
+AC_SUBST(pthread_in_libc)
+
 AC_CONFIG_FILES([config.make Makefile])
 AC_CONFIG_COMMANDS([default],[[
 case $CONFIG_FILES in *config.make*)
diff --git a/rt/Makefile b/rt/Makefile
index 7b374f2073..c1a0fdeb46 100644
--- a/rt/Makefile
+++ b/rt/Makefile
@@ -39,6 +39,8 @@ librt-routines = $(aio-routines) \
 		 $(timer-routines) \
 		 $(shm-routines) $(mq-routines)
 
+$(librt-routines-var) = \
+
 tests := tst-shm tst-timer tst-timer2 \
 	 tst-aio tst-aio64 tst-aio2 tst-aio3 tst-aio4 tst-aio5 tst-aio6 \
 	 tst-aio7 tst-aio8 tst-aio9 tst-aio10 \
diff --git a/sysdeps/mach/hurd/configure b/sysdeps/mach/hurd/configure
index 537f235077..4876e1f176 100644
--- a/sysdeps/mach/hurd/configure
+++ b/sysdeps/mach/hurd/configure
@@ -45,3 +45,6 @@ fi
 if test -n "$sysheaders"; then
   CPPFLAGS=$OLD_CPPFLAGS
 fi
+
+# Hurd has libpthread as a separate library.
+pthread_in_libc=no
diff --git a/sysdeps/mach/hurd/configure.ac b/sysdeps/mach/hurd/configure.ac
index eab0e5b6c1..9a049b1d86 100644
--- a/sysdeps/mach/hurd/configure.ac
+++ b/sysdeps/mach/hurd/configure.ac
@@ -26,3 +26,6 @@ fi
 if test -n "$sysheaders"; then
   CPPFLAGS=$OLD_CPPFLAGS
 fi
+
+# Hurd has libpthread as a separate library.
+pthread_in_libc=no
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
index ed15c1e433..8133bcda8f 100644
--- a/sysdeps/pthread/Makefile
+++ b/sysdeps/pthread/Makefile
@@ -39,6 +39,9 @@ libpthread-routines += thrd_create thrd_detach thrd_exit thrd_join \
 		       cnd_destroy cnd_init cnd_signal cnd_timedwait cnd_wait \
 		       tss_create tss_delete tss_get tss_set
 
+$(libpthread-routines-var) += \
+
+
 tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
 	 tst-cnd-timedwait tst-thrd-detach tst-mtx-basic tst-thrd-sleep \
 	 tst-mtx-recursive tst-tss-basic tst-call-once tst-mtx-timedlock \
-- 
2.30.2



  reply	other threads:[~2021-04-26 16:59 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26 16:59 [PATCH 00/19] nptl: Move most C11 symbols into libc Florian Weimer
2021-04-26 17:00 ` Florian Weimer [this message]
2021-05-02 20:46   ` [PATCH 01/19] Add pthread-in-libc, libpthread-routines-var, librt-routines-var Carlos O'Donell
2021-04-26 17:00 ` [PATCH 02/19] nptl: Move call_once into libc Florian Weimer
2021-05-02 20:46   ` Carlos O'Donell
2021-04-26 17:00 ` [PATCH 03/19] nptl: Move cnd_broadcast " Florian Weimer
2021-05-02 20:48   ` Carlos O'Donell
2021-04-26 17:00 ` [PATCH 04/19] nptl: Move cnd_destroy " Florian Weimer
2021-05-02 20:48   ` Carlos O'Donell
2021-04-26 17:00 ` [PATCH 05/19] nptl: Move cnd_init " Florian Weimer
2021-05-02 20:46   ` Carlos O'Donell
2021-04-26 17:00 ` [PATCH 06/19] nptl: Move cnd_signal " Florian Weimer
2021-05-02 20:46   ` Carlos O'Donell
2021-04-26 17:00 ` [PATCH 07/19] nptl: Move cnd_timedwait " Florian Weimer
2021-05-02 20:46   ` Carlos O'Donell
2021-04-26 17:01 ` [PATCH 08/19] nptl: Move cnd_wait " Florian Weimer
2021-05-02 20:46   ` Carlos O'Donell
2021-04-26 17:01 ` [PATCH 09/19] nptl: Move mtx_destroy " Florian Weimer
2021-05-02 20:47   ` Carlos O'Donell
2021-04-26 17:02 ` [PATCH 10/19] nptl: Move mtx_init " Florian Weimer
2021-05-02 20:47   ` Carlos O'Donell
2021-04-26 17:02 ` [PATCH 11/19] nptl: Move mtx_lock " Florian Weimer
2021-05-02 20:46   ` Carlos O'Donell
2021-04-26 17:02 ` [PATCH 12/19] nptl: Move mtx_timedlock " Florian Weimer
2021-05-02 20:46   ` Carlos O'Donell
2021-04-26 17:02 ` [PATCH 13/19] nptl: Move mtx_trylock " Florian Weimer
2021-05-02 20:46   ` Carlos O'Donell
2021-04-26 17:02 ` [PATCH 14/19] nptl: Move mtx_unlock " Florian Weimer
2021-05-02 20:46   ` Carlos O'Donell
2021-04-26 17:11 ` [PATCH 15/19] nptl: Move thrd_exit " Florian Weimer
2021-05-02 20:47   ` Carlos O'Donell
2021-04-26 17:11 ` [PATCH 16/19] nptl: Move tss_create " Florian Weimer
2021-05-02 20:47   ` Carlos O'Donell
2021-04-26 17:11 ` [PATCH 17/19] nptl: Move tss_delete " Florian Weimer
2021-05-02 20:46   ` Carlos O'Donell
2021-04-26 17:11 ` [PATCH 18/19] nptl: Move tss_get " Florian Weimer
2021-05-02 20:46   ` Carlos O'Donell
2021-04-26 17:12 ` [PATCH 19/19] nptl: Move tss_set " Florian Weimer
2021-05-02 20:46   ` Carlos O'Donell
2021-05-02 20:46 ` [PATCH 00/19] nptl: Move most C11 symbols " Carlos O'Donell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=62101950200ba00285cf57a6e83aa4ef03816160.1619456219.git.fweimer@redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).