]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
htl: Fix linking static tests by factorizing the symbols list
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Wed, 10 Jun 2020 20:03:52 +0000 (20:03 +0000)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Wed, 10 Jun 2020 21:34:19 +0000 (21:34 +0000)
libpthread_syms.a will contain the symbols that libc tries to get from
libpthread, to be used by the system, but also by tests.

* htl/libpthread.a, htl/libpthread_pic.a: Link libpthread_syms.a and Move EXTERN
references to...
* htl/libpthread_syms.a: ... new file. Add missing
__pthread_enable_asynccancel reference.
* htl/Makefile: Install libpthread_syms.a and link it into static tests.

htl/Makefile
htl/libpthread.a
htl/libpthread_pic.a
htl/libpthread_syms.a [new file with mode: 0644]

index 2de98e1774c4407a69a2d9f37a100799971eee86..c424bd512b8285f77f858094ef3d57cfbb1c8a8c 100644 (file)
@@ -173,6 +173,7 @@ static-only-routines = pt-atfork
 extra-libs := libpthread
 extra-libs-others := $(extra-libs)
 install-lib := libpthread.so
+install-lib-ldscripts := libpthread_syms.a
 
 include ../Makeconfig
 
@@ -180,7 +181,7 @@ CFLAGS-lockfile.c = -D_IO_MTSAFE_IO
 
 all: # Make this the default target; it will be defined in Rules.
 
-subdir_install: $(inst_libdir)/libpthread2.a
+subdir_install: $(inst_libdir)/libpthread2.a $(inst_libdir)/libpthread_syms.a
 
 # XXX: If $(inst_libdir)/libpthread2.a is installed and
 # $(inst_libdir)/libpthread is not, we can have some issues.
@@ -198,6 +199,9 @@ $(inst_libdir)/libpthread2_pic.a: $(inst_libdir)/libpthread_pic.a
        mv $< $@
        $(INSTALL_DATA) $(srcdir)/libpthread_pic.a $<
 
+$(inst_libdir)/libpthread_syms.a: $(srcdir)/libpthread_syms.a $(+force)
+       $(do-install)
+
 libc-link.so = $(common-objpfx)libc.so
 
 extra-B-pthread.so = -B$(common-objpfx)htl/
@@ -217,7 +221,7 @@ $(objpfx)tst-unload: $(libdl)
 $(addprefix $(objpfx), $(tests-reverse)): \
   $(objpfx)../libc.so $(objpfx)libpthread.so
 $(objpfx)../libc.so: $(common-objpfx)libc.so ;
-$(addprefix $(objpfx),$(tests-static) $(xtests-static)): $(objpfx)libpthread.a
+$(addprefix $(objpfx),$(tests-static) $(xtests-static)): $(srcdir)/libpthread_syms.a $(objpfx)libpthread.a
 else
-$(addprefix $(objpfx),$(tests) $(test-srcs)): $(objpfx)libpthread.a
+$(addprefix $(objpfx),$(tests) $(test-srcs)): $(srcdir)/libpthread_syms.a $(objpfx)libpthread.a
 endif
index e5bd2cc2295428842e319f9d8e0ac74ca2ef1885..cfc1893b2ba54f5b7fec10a4a56b2959a9cef7cc 100644 (file)
@@ -1,22 +1,2 @@
-/* pthread initializer is weak in glibc.  It must be included if glibc
-   is to start threading. */
-EXTERN(_cthread_init_routine)
-
-/* Weak references in glibc that must be filled if glibc is to be
-   thread safe.  */
-EXTERN(cthread_detach)
-EXTERN(cthread_fork)
-EXTERN(cthread_keycreate)
-EXTERN(cthread_getspecific)
-EXTERN(cthread_setspecific)
-EXTERN(__mutex_lock_solid)
-EXTERN(__mutex_unlock_solid)
-/* For libio stream locking.  */
-EXTERN(_cthreads_flockfile)
-EXTERN(_cthreads_funlockfile)
-EXTERN(_cthreads_ftrylockfile)
-/* To get the sigthread stack layout on fork */
-EXTERN(pthread_getattr_np)
-EXTERN(pthread_attr_getstack)
-
+GROUP(-lpthread_syms)
 GROUP(-lpthread2 -lrt)
index 33346b4b39a7296e0c6d43db1f359c55023ca294..8794ac6dabe0a1a0cab9df39bece1c1ffedbace0 100644 (file)
@@ -1,22 +1,2 @@
-/* pthread initializer is weak in glibc.  It must be included if glibc
-   is to start threading. */
-EXTERN(_cthread_init_routine)
-
-/* Weak references in glibc that must be filled if glibc is to be
-   thread safe.  */
-EXTERN(cthread_detach)
-EXTERN(cthread_fork)
-EXTERN(cthread_keycreate)
-EXTERN(cthread_getspecific)
-EXTERN(cthread_setspecific)
-EXTERN(__mutex_lock_solid)
-EXTERN(__mutex_unlock_solid)
-/* For libio stream locking.  */
-EXTERN(_cthreads_flockfile)
-EXTERN(_cthreads_funlockfile)
-EXTERN(_cthreads_ftrylockfile)
-/* To get the sigthread stack layout on fork */
-EXTERN(pthread_getattr_np)
-EXTERN(pthread_attr_getstack)
-
+GROUP(-lpthread_syms)
 GROUP(-lpthread2_pic)
diff --git a/htl/libpthread_syms.a b/htl/libpthread_syms.a
new file mode 100644 (file)
index 0000000..3801ec9
--- /dev/null
@@ -0,0 +1,21 @@
+/* pthread initializer is weak in glibc.  It must be included if glibc
+   is to start threading. */
+EXTERN(_cthread_init_routine)
+
+/* Weak references in glibc that must be filled if glibc is to be
+   thread safe.  */
+EXTERN(cthread_detach)
+EXTERN(cthread_fork)
+EXTERN(cthread_keycreate)
+EXTERN(cthread_getspecific)
+EXTERN(cthread_setspecific)
+EXTERN(__mutex_lock_solid)
+EXTERN(__mutex_unlock_solid)
+/* For libio stream locking.  */
+EXTERN(_cthreads_flockfile)
+EXTERN(_cthreads_funlockfile)
+EXTERN(_cthreads_ftrylockfile)
+/* To get the sigthread stack layout on fork */
+EXTERN(pthread_getattr_np)
+EXTERN(pthread_attr_getstack)
+EXTERN(__pthread_enable_asynccancel)