diff --git a/include/bits/errno.h b/include/bits/errno.h
new file mode 100644
index 0000000000000000000000000000000000000000..1ade524d96342231283ca385b02358b485dcdb34
--- /dev/null
+++ b/include/bits/errno.h
@@ -0,0 +1,7 @@
+#ifndef _BITS_ERRNO_H
+#define _BITS_ERRNO_H
+
+//TODO extern __thread int errno;
+extern int errno;
+
+#endif /* _BITS_ERRNO_H */
diff --git a/include/errno.h b/include/errno.h
deleted file mode 100644
index 02b7e0c00f57580b0e132baa1c6679fa4a44a3b2..0000000000000000000000000000000000000000
--- a/include/errno.h
+++ /dev/null
@@ -1 +0,0 @@
-extern __thread int errno;
diff --git a/src/errno/cbindgen.toml b/src/errno/cbindgen.toml
index e71467bc3cc2a9abf964813b4d7a08c4b0c56cb9..1159d8eda7d72be9043ea92755f9783a7677704e 100644
--- a/src/errno/cbindgen.toml
+++ b/src/errno/cbindgen.toml
@@ -1,4 +1,4 @@
-sys_includes = []
+sys_includes = ["bits/errno.h"]
 include_guard = "_ERRNO_H"
 language = "C"
 
diff --git a/src/errno/src/lib.rs b/src/errno/src/lib.rs
index 3cb5cd036c4cdd178d54ab15f1fc25d18aa9c124..a40975c9f9ef62073cd7fc737e96721f54b7b2a7 100644
--- a/src/errno/src/lib.rs
+++ b/src/errno/src/lib.rs
@@ -4,6 +4,7 @@
 
 extern crate platform;
 
+#[repr(C)]
 pub enum Errno {
     // Argument list too long
     E2BIG = 1,
diff --git a/src/platform/src/lib.rs b/src/platform/src/lib.rs
index 6e5841a965681dd62e48e6e0e193f72088a491ef..a3270531070b56b7f66cae6f938e47c67b55eaa2 100644
--- a/src/platform/src/lib.rs
+++ b/src/platform/src/lib.rs
@@ -2,7 +2,7 @@
 
 #![no_std]
 #![allow(non_camel_case_types)]
-#![feature(thread_local)]
+//TODO #![feature(thread_local)]
 
 #[cfg(all(not(feature = "no_std"), target_os = "linux"))]
 #[macro_use]
@@ -28,7 +28,7 @@ use core::fmt;
 
 use types::*;
 
-#[thread_local]
+//TODO #[thread_local]
 #[no_mangle]
 pub static mut errno: c_int = 0;
 
diff --git a/tests/Makefile b/tests/Makefile
index 8d87af542c9b85dc10bdf89aa339ab7d36ce5e5c..7d293f7246448f9a0ef3ae77d318a438f2478436 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -37,4 +37,4 @@ GCCTAIL=\
 	../openlibm/libopenlibm.a
 
 %: %.c
-	gcc -fno-stack-protector -Wall $(GCCHEAD) "$<" $(GCCTAIL) -o "$@"
+	gcc -no-pie -fno-stack-protector -Wall $(GCCHEAD) "$<" $(GCCTAIL) -o "$@"