diff --git a/Libraries/LibC/errno.h b/Libraries/LibC/errno.h index 2d2a0b334f..f763dbc914 100644 --- a/Libraries/LibC/errno.h +++ b/Libraries/LibC/errno.h @@ -43,7 +43,12 @@ __BEGIN_DECLS extern const char* const sys_errlist[]; extern int sys_nerr; + +#ifdef NO_TLS +extern int errno; +#else extern __thread int errno; +#endif #define errno errno diff --git a/Libraries/LibC/libcinit.cpp b/Libraries/LibC/libcinit.cpp index 7e38ebc36f..83209b9ca4 100644 --- a/Libraries/LibC/libcinit.cpp +++ b/Libraries/LibC/libcinit.cpp @@ -31,7 +31,11 @@ extern "C" { +#ifdef NO_TLS +int errno; +#else __thread int errno; +#endif char** environ; bool __environ_is_malloced; bool __stdio_is_initialized; diff --git a/Libraries/LibC/unistd.cpp b/Libraries/LibC/unistd.cpp index cf6643e736..da88bef354 100644 --- a/Libraries/LibC/unistd.cpp +++ b/Libraries/LibC/unistd.cpp @@ -48,7 +48,12 @@ extern "C" { +#ifdef NO_TLS +static int s_cached_tid = 0; +#else static __thread int s_cached_tid = 0; +#endif + static int s_cached_pid = 0; int chown(const char* pathname, uid_t uid, gid_t gid)