[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

thread tests: avoid link error with --enable-threads=isoc+posix on AIX

From: Bruno Haible
Subject: thread tests: avoid link error with --enable-threads=isoc+posix on AIX
Date: Mon, 02 Dec 2019 11:00:02 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-166-generic; KDE/5.18.0; x86_64; ; )

On AIX, with --enable-threads=isoc+posix, I'm seeing this link error:

xlc -q64 -qthreaded -qtls  -g  -L/home/haible/prefix64/lib -o test-thread_self 
test-thread_self.o libtests.a ../gllib/libgnu.a libtests.a   
ld: 0711-317 ERROR: Undefined symbol: .pthread_self
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
gmake[4]: *** [test-thread_self] Error 8

The test's expectation is not justified: since gl_thread_self(), in this case,
is based on pthread_self() - since that's the only way to make it interoperate
with pthread_join() -, use of gl_thread_self() requires linking with
$(LIBMULTITHREAD), not $(LIBTHREAD). The test was written for glibc systems and
is not universally valid.

2019-12-02  Bruno Haible  <address@hidden>

        thread tests: Avoid link error with --enable-threads=isoc+posix on AIX.
        * tests/test-thread_self.c (main): Disable test on AIX.

diff --git a/tests/test-thread_self.c b/tests/test-thread_self.c
index 8fb00a1..0d48ddc 100644
--- a/tests/test-thread_self.c
+++ b/tests/test-thread_self.c
@@ -28,7 +28,12 @@ main ()
   /* Check that gl_thread_self () can be used with just $(LIBTHREAD), not
      $(LIBMULTITHREAD), i.e. in libraries that are multithread-safe but don't
      create threads themselves.  */
+  /* This is not the case on AIX with --enable-threads=isoc+posix, because in
+     this case, $(LIBTHREAD) is empty whereas $(LIBMULTITHREAD) is '-lpthread'.
+   */
+#if !defined _AIX
   main_thread = gl_thread_self ();
   return 0;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]