diff --git a/include/bits/errno.h b/include/bits/errno.h
index d59af2876a485c2bd578f20bcb010ad45e36177d..c4f10c1d1f849ee390145fe62a522dae046ac7f7 100644
--- a/include/bits/errno.h
+++ b/include/bits/errno.h
@@ -7,8 +7,7 @@ extern "C" {
 
 #define ENOTSUP EOPNOTSUPP
 
-//TODO extern __thread int errno;
-extern int errno;
+extern __thread int errno;
 
 #ifdef __cplusplus
 } // extern "C"
diff --git a/src/c/dlmalloc.c b/src/c/dlmalloc.c
index 5343ad8c22cb494097584223de461cb66888c7eb..13db7003174602841434df26756549d16fd03df1 100644
--- a/src/c/dlmalloc.c
+++ b/src/c/dlmalloc.c
@@ -544,7 +544,7 @@ MAX_RELEASE_CHECK_RATE   default: 4095 unless not HAVE_MMAP
 #define ENOMEM 12
 #define EINVAL 22
 
-extern int errno;
+extern __thread int errno;
 
 void abort(void);
 void *memcpy(void *dest, const void *src, size_t n);
diff --git a/src/platform/mod.rs b/src/platform/mod.rs
index 8dfaa1f897fa093bab16ae88935d26b25bb7bedd..047aee80dbf97c434287d42140a5cd1030075575 100644
--- a/src/platform/mod.rs
+++ b/src/platform/mod.rs
@@ -34,7 +34,7 @@ pub mod rlb;
 use self::types::*;
 pub mod types;
 
-//TODO #[thread_local]
+#[thread_local]
 #[allow(non_upper_case_globals)]
 #[no_mangle]
 pub static mut errno: c_int = 0;