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 35/35] Linux: Cleanups after librt move
Date: Fri, 04 Jun 2021 01:17:55 +0200	[thread overview]
Message-ID: <881e88f0ef8e023a113b819912ee5776fcaaddf6.1622761829.git.fweimer@redhat.com> (raw)
In-Reply-To: <cover.1622761828.git.fweimer@redhat.com>

librt.so is no longer installed for PTHREAD_IN_LIBC, and tests
are not linked against it.

GLIBC_PRIVATE symbols that were needed during the transition are
removed again.
---
 elf/Makefile                                  |  4 +-
 nptl/Makefile                                 |  9 ----
 rt/Makefile                                   | 13 ++++--
 rt/Versions                                   | 13 ------
 rt/aio_misc.c                                 | 14 ------
 rt/aio_notify.c                               |  8 ----
 rt/aio_sigqueue.c                             |  1 -
 sysdeps/generic/aio_misc.h                    | 43 ++++++-------------
 sysdeps/pthread/Makefile                      |  2 +
 sysdeps/unix/sysv/linux/Versions              |  6 ---
 sysdeps/unix/sysv/linux/aio_sigqueue.c        |  1 -
 sysdeps/unix/sysv/linux/kernel-posix-timers.h | 19 +++-----
 sysdeps/unix/sysv/linux/timer_create.c        |  3 +-
 sysdeps/unix/sysv/linux/timer_routines.c      | 10 +----
 14 files changed, 37 insertions(+), 109 deletions(-)

diff --git a/elf/Makefile b/elf/Makefile
index e9788d3d4f..f83e7fe757 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1181,7 +1181,6 @@ localplt-built-dso := $(addprefix $(common-objpfx),\
 				  libc.so \
 				  elf/ld.so \
 				  math/libm.so \
-				  rt/librt.so \
 				  dlfcn/libdl.so \
 				  resolv/libresolv.so \
 		       )
@@ -1194,6 +1193,9 @@ endif
 ifeq ($(build-crypt),yes)
 localplt-built-dso += $(addprefix $(common-objpfx), crypt/libcrypt.so)
 endif
+ifneq ($(pthread-in-libc),yes)
+localplt-built-dso += $(addprefix $(common-objpfx), rt/librt.so)
+endif
 
 vpath localplt.data $(+sysdep_dirs)
 
diff --git a/nptl/Makefile b/nptl/Makefile
index f7d7a2c7e2..9346115487 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -532,15 +532,6 @@ $(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \
 	$(evaluate-test)
 endif
 
-ifeq (yes,$(build-shared))
-librt = $(common-objpfx)rt/librt.so
-else
-librt = $(common-objpfx)rt/librt.a
-endif
-
-$(objpfx)tst-cancel17: $(librt)
-$(objpfx)tst-cancelx17: $(librt)
-
 LDLIBS-tst-cancel24 = -Wl,--no-as-needed -lstdc++
 LDLIBS-tst-cancel24-static = $(LDLIBS-tst-cancel24)
 
diff --git a/rt/Makefile b/rt/Makefile
index a41bdb5728..dca20f050d 100644
--- a/rt/Makefile
+++ b/rt/Makefile
@@ -28,9 +28,7 @@ routines = \
   shm_open \
   shm_unlink \
 
-librt-routines = \
-  librt-compat \
-
+librt-routines = librt-compat
 librt-shared-only-routines = librt-compat
 
 $(librt-routines-var) += \
@@ -64,6 +62,13 @@ $(librt-routines-var) += \
   timer_gettime \
   timer_settime \
 
+ifeq ($(pthread-in-libc),yes)
+# Pretend that libdl.so is a linker script, so that the symbolic
+# link is not installed.
+install-lib-ldscripts = librt.so
+$(inst_libdir)/librt.so:
+endif
+
 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 \
@@ -87,6 +92,7 @@ LDFLAGS-rt.so = -Wl,--enable-new-dtags,-z,nodelete
 
 $(objpfx)librt.so: $(shared-thread-library)
 
+ifneq ($(pthread-in-libc),yes)
 ifeq (yes,$(build-shared))
 $(addprefix $(objpfx),$(tests) $(tests-internal)): \
 	$(objpfx)librt.so $(shared-thread-library)
@@ -94,5 +100,6 @@ else
 $(addprefix $(objpfx),$(tests)) $(tests-internal): \
 	$(objpfx)librt.a $(static-thread-library)
 endif
+endif # !$(pthread-in-libc)
 
 tst-mqueue7-ARGS = -- $(host-test-program-cmd)
diff --git a/rt/Versions b/rt/Versions
index 7e41beae06..a3dc72cff4 100644
--- a/rt/Versions
+++ b/rt/Versions
@@ -95,19 +95,6 @@ libc {
     shm_open;
     shm_unlink;
   }
-%if PTHREAD_IN_LIBC
-  GLIBC_PRIVATE {
-    __aio_enqueue_request;
-    __aio_find_req;
-    __aio_find_req_fd;
-    __aio_free_request;
-    __aio_notify;
-    __aio_notify_only;
-    __aio_remove_request;
-    __aio_requests_mutex;
-    __aio_sigqueue;
-  }
-%endif
 }
 librt {
   GLIBC_2.1 {
diff --git a/rt/aio_misc.c b/rt/aio_misc.c
index 634456d489..bdee61611c 100644
--- a/rt/aio_misc.c
+++ b/rt/aio_misc.c
@@ -735,24 +735,10 @@ add_request_to_runlist (struct requestlist *newrequest)
 }
 
 #if PTHREAD_IN_LIBC
-libc_hidden_data_def (__aio_requests_mutex)
-libc_hidden_def (__aio_enqueue_request)
-libc_hidden_def (__aio_find_req)
-libc_hidden_def (__aio_find_req_fd)
-libc_hidden_def (__aio_free_request)
-libc_hidden_def (__aio_remove_request)
-
 versioned_symbol (libc, __aio_init, aio_init, GLIBC_2_34);
 # if OTHER_SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_34)
 compat_symbol (librt, __aio_init, aio_init, GLIBC_2_1);
 # endif
-
 #else /* !PTHREAD_IN_LIBC */
-librt_hidden_data_def (__aio_requests_mutex)
-librt_hidden_def (__aio_enqueue_request)
-librt_hidden_def (__aio_find_req)
-librt_hidden_def (__aio_find_req_fd)
-librt_hidden_def (__aio_free_request)
-librt_hidden_def (__aio_remove_request)
 weak_alias (__aio_init, aio_init)
 #endif /* !PTHREAD_IN_LIBC */
diff --git a/rt/aio_notify.c b/rt/aio_notify.c
index 432000e34b..0fa84f203c 100644
--- a/rt/aio_notify.c
+++ b/rt/aio_notify.c
@@ -160,11 +160,3 @@ __aio_notify (struct requestlist *req)
       waitlist = next;
     }
 }
-
-#if PTHREAD_IN_LIBC
-libc_hidden_def (__aio_notify)
-libc_hidden_def (__aio_notify_only)
-#else
-librt_hidden_def (__aio_notify)
-librt_hidden_def (__aio_notify_only)
-#endif
diff --git a/rt/aio_sigqueue.c b/rt/aio_sigqueue.c
index 0ad95ae04c..84848bacd8 100644
--- a/rt/aio_sigqueue.c
+++ b/rt/aio_sigqueue.c
@@ -28,5 +28,4 @@ __aio_sigqueue (int sig, const union sigval val, pid_t caller_pid)
   __set_errno (ENOSYS);
   return -1;
 }
-librt_hidden_def (__aio_sigqueue)
 stub_warning (__aio_sigqueue)
diff --git a/sysdeps/generic/aio_misc.h b/sysdeps/generic/aio_misc.h
index d9bff36e50..4d05b8cdd6 100644
--- a/sysdeps/generic/aio_misc.h
+++ b/sysdeps/generic/aio_misc.h
@@ -87,55 +87,36 @@ struct requestlist
 
 
 /* Lock for global I/O list of requests.  */
-extern pthread_mutex_t __aio_requests_mutex;
+extern pthread_mutex_t __aio_requests_mutex attribute_hidden;
 
 
 /* Enqueue request.  */
 extern struct requestlist *__aio_enqueue_request (aiocb_union *aiocbp,
-						  int operation);
+						  int operation)
+  attribute_hidden;
 
 /* Find request entry for given AIO control block.  */
-extern struct requestlist *__aio_find_req (aiocb_union *elem);
+extern struct requestlist *__aio_find_req (aiocb_union *elem) attribute_hidden;
 
 /* Find request entry for given file descriptor.  */
-extern struct requestlist *__aio_find_req_fd (int fildes);
+extern struct requestlist *__aio_find_req_fd (int fildes) attribute_hidden;
 
 /* Remove request from the list.  */
 extern void __aio_remove_request (struct requestlist *last,
-				  struct requestlist *req, int all);
+				  struct requestlist *req, int all)
+  attribute_hidden;
 
 /* Release the entry for the request.  */
-extern void __aio_free_request (struct requestlist *req);
+extern void __aio_free_request (struct requestlist *req) attribute_hidden;
 
 /* Notify initiator of request and tell this everybody listening.  */
-extern void __aio_notify (struct requestlist *req);
+extern void __aio_notify (struct requestlist *req) attribute_hidden;
 
 /* Notify initiator of request.  */
-extern int __aio_notify_only (struct sigevent *sigev);
+extern int __aio_notify_only (struct sigevent *sigev) attribute_hidden;
 
 /* Send the signal.  */
-extern int __aio_sigqueue (int sig, const union sigval val, pid_t caller_pid);
-
-#if PTHREAD_IN_LIBC
-libc_hidden_proto (__aio_enqueue_request)
-libc_hidden_proto (__aio_find_req)
-libc_hidden_proto (__aio_find_req_fd)
-libc_hidden_proto (__aio_free_request)
-libc_hidden_proto (__aio_notify)
-libc_hidden_proto (__aio_notify_only)
-libc_hidden_proto (__aio_remove_request)
-libc_hidden_proto (__aio_requests_mutex)
-libc_hidden_proto (__aio_sigqueue)
-#else
-librt_hidden_proto (__aio_enqueue_request)
-librt_hidden_proto (__aio_find_req)
-librt_hidden_proto (__aio_find_req_fd)
-librt_hidden_proto (__aio_free_request)
-librt_hidden_proto (__aio_notify)
-librt_hidden_proto (__aio_notify_only)
-librt_hidden_proto (__aio_remove_request)
-librt_hidden_proto (__aio_requests_mutex)
-librt_hidden_proto (__aio_sigqueue)
-#endif
+extern int __aio_sigqueue (int sig, const union sigval val, pid_t caller_pid)
+  attribute_hidden;
 
 #endif /* aio_misc.h */
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
index e4690a7bc4..a5d0099d9a 100644
--- a/sysdeps/pthread/Makefile
+++ b/sysdeps/pthread/Makefile
@@ -18,11 +18,13 @@
 
 ifeq ($(subdir),rt)
 
+ifneq ($(pthread-in-libc),yes)
 ifeq (yes,$(build-shared))
 $(objpfx)tst-timer: $(objpfx)librt.so $(shared-thread-library)
 else
 $(objpfx)tst-timer: $(objpfx)librt.a $(static-thread-library)
 endif
+endif # !$(pthread-in-libc)
 
 endif
 
diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
index c0ae7d9b4d..d1ac5c4207 100644
--- a/sysdeps/unix/sysv/linux/Versions
+++ b/sysdeps/unix/sysv/linux/Versions
@@ -201,12 +201,6 @@ libc {
     __pread64_nocancel;
     __close_nocancel;
     __sigtimedwait;
-    __timer_active_sigev_thread;
-    __timer_active_sigev_thread_lock;
-    __timer_compat_list;
-    __timer_helper_once;
-    __timer_helper_tid;
-    __timer_start_helper_thread;
     # functions used by nscd
     __netlink_assert_response;
   }
diff --git a/sysdeps/unix/sysv/linux/aio_sigqueue.c b/sysdeps/unix/sysv/linux/aio_sigqueue.c
index bd0da6e763..0b0f347197 100644
--- a/sysdeps/unix/sysv/linux/aio_sigqueue.c
+++ b/sysdeps/unix/sysv/linux/aio_sigqueue.c
@@ -44,4 +44,3 @@ __aio_sigqueue (int sig, const union sigval val, pid_t caller_pid)
 
   return INLINE_SYSCALL (rt_sigqueueinfo, 3, info.si_pid, sig, &info);
 }
-libc_hidden_def (__aio_sigqueue)
diff --git a/sysdeps/unix/sysv/linux/kernel-posix-timers.h b/sysdeps/unix/sysv/linux/kernel-posix-timers.h
index a976b028e0..0f7eff1794 100644
--- a/sysdeps/unix/sysv/linux/kernel-posix-timers.h
+++ b/sysdeps/unix/sysv/linux/kernel-posix-timers.h
@@ -26,27 +26,23 @@
 extern int __no_posix_timers attribute_hidden;
 
 /* Callback to start helper thread.  */
-extern void __timer_start_helper_thread (void);
-libc_hidden_proto (__timer_start_helper_thread)
+extern void __timer_start_helper_thread (void) attribute_hidden;
 
 /* Control variable for helper thread creation.  */
-extern pthread_once_t __timer_helper_once;
-libc_hidden_proto (__timer_helper_once)
+extern pthread_once_t __timer_helper_once attribute_hidden;
 
 /* Called from fork so that the new subprocess re-creates the
    notification thread if necessary.  */
 void __timer_fork_subprocess (void) attribute_hidden;
 
 /* TID of the helper thread.  */
-extern pid_t __timer_helper_tid;
-libc_hidden_proto (__timer_helper_tid)
+extern pid_t __timer_helper_tid attribute_hidden;
 
 /* List of active SIGEV_THREAD timers.  */
-extern struct timer *__timer_active_sigev_thread;
-libc_hidden_proto (__timer_active_sigev_thread)
+extern struct timer *__timer_active_sigev_thread attribute_hidden;
+
 /* Lock for __timer_active_sigev_thread.  */
-extern pthread_mutex_t __timer_active_sigev_thread_lock;
-libc_hidden_proto (__timer_active_sigev_thread_lock)
+extern pthread_mutex_t __timer_active_sigev_thread_lock attribute_hidden;
 
 extern __typeof (timer_create) __timer_create;
 libc_hidden_proto (__timer_create)
@@ -117,5 +113,4 @@ timerid_to_kernel_timer (timer_t timerid)
 
 /* Used if an override sets TIMER_T_WAS_INT_COMPAT to 1.  */
 #define OLD_TIMER_MAX 256
-extern timer_t __timer_compat_list[OLD_TIMER_MAX];
-libc_hidden_proto (__timer_compat_list)
+extern timer_t __timer_compat_list[OLD_TIMER_MAX] attribute_hidden;
diff --git a/sysdeps/unix/sysv/linux/timer_create.c b/sysdeps/unix/sysv/linux/timer_create.c
index 9861177cf2..230bc45083 100644
--- a/sysdeps/unix/sysv/linux/timer_create.c
+++ b/sysdeps/unix/sysv/linux/timer_create.c
@@ -146,8 +146,7 @@ compat_symbol (librt, ___timer_create, timer_create, GLIBC_2_3_3);
 # endif
 
 # if OTHER_SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_3_3)
-timer_t __timer_compat_list[OLD_TIMER_MAX] __attribute__ ((nocommon));
-libc_hidden_data_def (__timer_compat_list)
+timer_t __timer_compat_list[OLD_TIMER_MAX];
 
 int
 __timer_create_old (clockid_t clock_id, struct sigevent *evp, int *timerid)
diff --git a/sysdeps/unix/sysv/linux/timer_routines.c b/sysdeps/unix/sysv/linux/timer_routines.c
index fc3aa894ab..3a509d8ace 100644
--- a/sysdeps/unix/sysv/linux/timer_routines.c
+++ b/sysdeps/unix/sysv/linux/timer_routines.c
@@ -26,13 +26,10 @@
 
 
 /* List of active SIGEV_THREAD timers.  */
-struct timer *__timer_active_sigev_thread __attribute__ ((nocommon));
-libc_hidden_data_def (__timer_active_sigev_thread)
+struct timer *__timer_active_sigev_thread;
 
 /* Lock for _timer_active_sigev_thread.  */
-pthread_mutex_t __timer_active_sigev_thread_lock __attribute__ ((nocommon))
-  = PTHREAD_MUTEX_INITIALIZER;
-libc_hidden_data_def (__timer_active_sigev_thread_lock)
+pthread_mutex_t __timer_active_sigev_thread_lock = PTHREAD_MUTEX_INITIALIZER;
 
 struct thread_start_data
 {
@@ -112,12 +109,10 @@ timer_helper_thread (void *arg)
 /* Control variable for helper thread creation.  */
 pthread_once_t __timer_helper_once __attribute__ ((nocommon))
   = PTHREAD_ONCE_INIT;
-libc_hidden_data_def (__timer_helper_once)
 
 
 /* TID of the helper thread.  */
 pid_t __timer_helper_tid __attribute__ ((nocommon));
-libc_hidden_data_def (__timer_helper_tid)
 
 
 /* Reset variables so that after a fork a new helper thread gets started.  */
@@ -159,4 +154,3 @@ __timer_start_helper_thread (void)
   /* No need for the attribute anymore.  */
   (void) __pthread_attr_destroy (&attr);
 }
-libc_hidden_def (__timer_start_helper_thread)
-- 
2.31.1


  parent reply	other threads:[~2021-06-03 23:18 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03 23:14 [PATCH 00/35] Linux: Move librt into libc Florian Weimer
2021-06-03 23:14 ` [PATCH 01/35] rt: Lexicographically sort Versions file; librt-routines in Makefile Florian Weimer
2021-06-17 11:05   ` Adhemerval Zanella
2021-06-03 23:14 ` [PATCH 02/35] Fix librt-routines-var issues for !PTHREAD_IN_LIBC Florian Weimer
2021-06-17 11:07   ` Adhemerval Zanella
2021-06-17 12:19     ` Florian Weimer
2021-06-03 23:15 ` [PATCH 03/35] rt: Replace generic stub of shm_open with the posix version Florian Weimer
2021-06-17 11:08   ` Adhemerval Zanella
2021-06-03 23:15 ` [PATCH 04/35] rt: Replace generic stub of shm_unlink " Florian Weimer
2021-06-17 11:08   ` Adhemerval Zanella
2021-06-03 23:15 ` [PATCH 05/35] rt: Move shm_open into libc Florian Weimer
2021-06-17 11:12   ` Adhemerval Zanella
2021-06-17 12:25   ` Adhemerval Zanella
2021-06-03 23:15 ` [PATCH 06/35] rt: Move shm_unlink " Florian Weimer
2021-06-17 18:00   ` Adhemerval Zanella
2021-06-03 23:15 ` [PATCH 07/35] rt: Move generic implementation from sysdeps/pthread to rt Florian Weimer
2021-06-03 23:15 ` [PATCH 08/35] nptl: Move pthreadP.h into sysdeps directory Florian Weimer
2021-06-03 23:15 ` [PATCH 09/35] nptl: Add internal macro definition of pthread_self Florian Weimer
2021-06-03 23:15 ` [PATCH 10/35] Add hidden prototypes for fsync, fdatasync Florian Weimer
2021-06-03 23:15 ` [PATCH 11/35] Linux: Move aio_init from librt into libc Florian Weimer
2021-06-03 23:15 ` [PATCH 12/35] Linux: Move aio_cancel, aio_cancel64 " Florian Weimer
2021-06-03 23:15 ` [PATCH 13/35] Linux: Move aio_error, aio_error64 " Florian Weimer
2021-06-03 23:15 ` [PATCH 14/35] Linux: Move aio_fsync, aio_fsync64 " Florian Weimer
2021-06-03 23:16 ` [PATCH 15/35] Linux: Move aio_read, aio_read64 " Florian Weimer
2021-06-03 23:16 ` [PATCH 16/35] Linux: Move aio_return, aio_return64 " Florian Weimer
2021-06-03 23:16 ` [PATCH 17/35] Linux: Move aio_suspend, aio_suspend64 from librt to libc Florian Weimer
2021-06-03 23:16 ` [PATCH 18/35] Linux: Move aio_write, aio_write64 into libc Florian Weimer
2021-06-03 23:16 ` [PATCH 19/35] rt: Rework lio_listio implementation Florian Weimer
2021-06-03 23:16 ` [PATCH 20/35] Linux: Move lio_listio, lio_listio64 from librt to libc Florian Weimer
2021-06-03 23:16 ` [PATCH 21/35] Linux: Move mq_close " Florian Weimer
2021-06-03 23:16 ` [PATCH 22/35] Linux: Move mq_setattr " Florian Weimer
2021-06-03 23:16 ` [PATCH 23/35] Linux: Move mq_getattr " Florian Weimer
2021-06-03 23:16 ` [PATCH 24/35] Linux: Move mq_notify " Florian Weimer
2021-06-03 23:16 ` [PATCH 25/35] Linux: Move mq_open, __mq_open_2 " Florian Weimer
2021-06-03 23:17 ` [PATCH 26/35] Linux: Move mq_receive, mq_timedreceive " Florian Weimer
2021-06-03 23:17 ` [PATCH 27/35] Linux: Move mq_send, mq_timedsend " Florian Weimer
2021-06-03 23:17 ` [PATCH 28/35] Linux: Move mq_unlink " Florian Weimer
2021-06-03 23:17 ` [PATCH 29/35] Linux: Move timer helper routines " Florian Weimer
2021-06-03 23:17 ` [PATCH 30/35] Linux: Define TIMER_T_WAS_INT_COMPAT in kernel-posix-timers.h Florian Weimer
2021-06-03 23:17 ` [PATCH 31/35] Linux: Move timer_create, timer_delete from librt to libc Florian Weimer
2021-06-03 23:17 ` [PATCH 32/35] Linux: Move timer_getoverrun " Florian Weimer
2021-06-03 23:17 ` [PATCH 33/35] Linux: Move timer_gettime " Florian Weimer
2021-06-03 23:17 ` [PATCH 34/35] Linux: Move timer_settime " Florian Weimer
2021-06-03 23:17 ` Florian Weimer [this message]
2021-06-15 20:18 ` [PATCH 00/35] Linux: Move librt into libc Florian Weimer

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=881e88f0ef8e023a113b819912ee5776fcaaddf6.1622761829.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).