[testsuite] Always pass -pthread for TLS tests on Tru64 UNIX (PR target/46131)

Message ID ydd7hh21izv.fsf@manam.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth Oct. 28, 2010, 2:37 p.m.
As indicated in the PR, all TLS execution tests were failing on Tru64
UNIX.  After some investigation, the problem became obvious: due to lack
of native TLS support, Tru64 UNIX relies on emutls, which needs a couple
of libpthread functions.  Since the Tru64 UNIX linker lacks support for
weak definitions, there are also dummy implementations of them in
libgcc.  But here the real functions are needed, so the affected TLS
tests need to be linked with -pthread.  Manual testing indicated that
this fixes the problem as expected.  This patch implements the proper
solution by always passing -pthread in add_options_for_tls, just as on
Solaris 8/9.

Testing in progress, will commit once regtest finishes successfully.


2010-10-28  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR target/46131
	* lib/target-supports.exp (add_options_for_tls): Pass -pthread for


diff -r 201f524dd582 gcc/testsuite/lib/target-supports.exp
--- a/gcc/testsuite/lib/target-supports.exp	Thu Oct 28 15:17:34 2010 +0200
+++ b/gcc/testsuite/lib/target-supports.exp	Thu Oct 28 16:32:58 2010 +0200
@@ -613,6 +613,11 @@ 
 # Add to FLAGS all the target-specific flags needed to use thread-local storage.
 proc add_options_for_tls { flags } {
+    # Tru64 UNIX uses emutls, which relies on a couple of pthread functions
+    # which only live in libpthread, so always pass -pthread for TLS.
+    if { [istarget *-*-osf*] } {
+	return "$flags -pthread"
+    }
     # On Solaris 8 and 9, __tls_get_addr/___tls_get_addr only lives in
     # libthread, so always pass -pthread for native TLS.
     # Need to duplicate native TLS check from