-# define GC_getspecific(x) (x)
-# define GC_setspecific(key, v) ((key) = (v), 0)
-# define GC_key_create(key, d) 0
- typedef void * GC_key_t;
+# define GC_getspecific(x) (GC_thread_tls)
+# define GC_setspecific(key, v) (GC_thread_tls = (v), pthread_setspecific ((key), (v)))
+# define GC_key_create pthread_key_create
+ typedef pthread_key_t GC_key_t;