diff --git a/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C b/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C
index 82d6a5c8329ed95d7f379b811ebc9fbbc6338931..b43f3ebf80e2c0c74e21e2c13a9d05f4ccabc6db 100644
--- a/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C
+++ b/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C
@@ -4,6 +4,19 @@
 
 #include <pthread.h>
 
+// This overloaded version should only be selected on targets that
+// don't have a pthread_cond_clockwait in pthread.h, and it will wait
+// indefinitely for the cond_signal that, in this testcase, ought to
+// be delivered.
+static inline int
+pthread_cond_clockwait (pthread_cond_t *cv,
+			pthread_mutex_t *mtx,
+			__clockid_t,
+			void const /* struct timespec */ *)
+{
+  return pthread_cond_wait (cv, mtx);
+}		   
+
 pthread_cond_t cv;
 pthread_mutex_t mtx;