git-pthread_link_tests
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Wed, 30 Apr 2025 01:01:35 +0000 (09:01 +0800)
committerSean Whitton <spwhitton@spwhitton.name>
Wed, 30 Apr 2025 01:01:35 +0000 (09:01 +0800)
Committed for 2.32

commit dd7a8ad7ba25cb2269b306758c7d97d4a95527e6
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Mon Jun 8 13:32:08 2020 +0200

    pthread: Move back linking rules to nptl and htl

    d6d74ec16 ('htl: Enable more tests') moved the linking rules from
    nptl/Makefile and htl/Makefile to the shared sysdeps/pthread/Makefile.  But
    e.g. on powerpc some tests are added in sysdeps/powerpc/Makefile, which is
    included *after* sysdeps/pthread/Makefile, and thus the tests don't get
    affected by the rules and fail to link.  For now let's just copy over the
    set of rules in both nptl/Makefile and htl/Makefile.

    * sysdeps/pthread/Makefile: Move libpthread linking rules to...
    * htl/Makefile: ... here and...
    * nptl/Makefile: ... there.

Gbp-Pq: Topic hurd-i386
Gbp-Pq: Name git-pthread_link_tests.diff

htl/Makefile

index 701ad7f552aa04dada90bfcb833bd80dde1ffc90..29e3fa702259f4f3013ba30a9f95d1ef28756172 100644 (file)
@@ -204,9 +204,20 @@ extra-B-pthread.so = -B$(common-objpfx)htl/
 
 include ../Rules
 
-ifeq (yes,$(build-shared))
+# Make sure we link with the thread library.
+ifeq ($(build-shared),yes)
 $(addprefix $(objpfx), \
   $(filter-out $(tests-static) $(xtests-static) $(tests-reverse) \
     $(tests-nolibpthread), \
-    $(tests) $(xtests) $(test-srcs))): $(objpfx)libpthread.so
+    $(tests) $(tests-internal) $(xtests) $(test-srcs) $(tests-container))): \
+       $(objpfx)libpthread.so
+$(objpfx)tst-unload: $(libdl)
+# $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so,
+# since otherwise libpthread.so comes before libc.so when linking.
+$(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
+else
+$(addprefix $(objpfx),$(tests) $(test-srcs)): $(objpfx)libpthread.a
 endif