[v3] Link libstdc++ with -lpthread on IRIX 6 (PR target/47852)

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

Commit Message

Rainer Orth Jan. 12, 2012, 10:21 a.m.
When PR target/47852 was filed last year, it turned out that this seemed
to be the same problem as PR target/45693 on Tru64 UNIX, i.e. stub
implementations of pthread functions getting in the way, although I
couldn't really figure out how this happens.  Since the problem on IRIX
didn't show up anywhere in the testsuite and seemed to be a weird corner
case, I all but forgot about it.

Recently, though, a couple of 30_threads testcases started to fail:

FAIL: 30_threads/future/cons/move_assign.cc execution test
FAIL: 30_threads/shared_future/cons/assign.cc execution test
FAIL: 30_threads/shared_future/cons/move_assign.cc execution test

like this:

terminate called after throwing an instance of 'std::system_error'
  what():  Function not implemented

It turns out that __gthread_cond_broadcast in

  condition_variable::notify_all() noexcept
    int __e = __gthread_cond_broadcast(&_M_cond);

    // XXX not in spec
    // EINVAL
    if (__e)

returns ENOSYS due to a stub for pthread_cond_broadcast in libc.
Linking libstdc++.so with -lpthread fixes those tests.

I've relinked libstdc++.so with -lpthread using the patch below and
rerun the libstdc++-v3 testsuite, where all 3 testcases pass now.

I'll include the patch in the next full mips-sgi-irix6.5 bootstrap this
weekend.  Ok for mainline if that passes?


2011-02-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR target/47852
	* configure.host (irix6.5*): Add -lpthread to OPT_LDFLAGS.


Benjamin Kosnik Jan. 13, 2012, 5:18 p.m. | #1
> 2011-02-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
> 	PR target/47852
> 	* configure.host (irix6.5*): Add -lpthread to OPT_LDFLAGS.




# HG changeset patch
# Parent dc4f565925904068ffc3f7444fbc4f73ebfdcd07
Link libstdc++ with -lpthread on IRIX 6 (PR target/47852)

diff -r dc4f56592590 libstdc++-v3/configure.host
--- a/libstdc++-v3/configure.host	Tue Feb 22 15:54:16 2011 +0000
+++ b/libstdc++-v3/configure.host	Fri Feb 25 19:39:22 2011 +0100
@@ -252,6 +252,10 @@ 
+    # libstdc++.so relies on emutls on IRIX, which only works with the
+    # real functions implemented in libpthread.so, not with the stubs in
+    # libc, so always pass -lpthread.
+    OPT_LDFLAGS="${OPT_LDFLAGS} -lpthread"