diff --git a/stubs.c b/stubs.c
index d267fa6..e40099b 100644
--- a/stubs.c
+++ b/stubs.c
@@ -28,11 +28,11 @@
 #include "config.h"
 
 #ifndef HAVE_PTHREAD_SELF
-#define NEED_ZERO_STUB
+#define NEED_SELF_STUB
 # ifdef SUPPORT_ATTRIBUTE_ALIAS
-int pthread_self() __attribute__ ((weak, alias ("__pthread_zero_stub")));
+pthread_t pthread_self() __attribute__ ((weak, alias ("__pthread_self_stub")));
 # else
-#  pragma weak pthread_self = __pthread_zero_stub
+#  pragma weak pthread_self = __pthread_self_stub
 # endif
 #endif
 
@@ -136,6 +136,14 @@ static int __pthread_zero_stub()
 #ifdef NEED_EQUAL_STUB
 static int __pthread_equal_stub(pthread_t t1, pthread_t t2)
 {
-    return (t1 == t2);
+    return 0;
+}
+#endif
+
+#ifdef NEED_SELF_STUB
+static pthread_t __pthread_self_stub()
+{
+    pthread_t t;
+    return t;
 }
 #endif
