diff options
author | "Steven J. Hill" <sjhill@realitydiluted.com> | 2006-01-05 01:31:22 +0000 |
---|---|---|
committer | "Steven J. Hill" <sjhill@realitydiluted.com> | 2006-01-05 01:31:22 +0000 |
commit | 4c607eb71e5bcd3997ea72333c2fe89fc4181b3e (patch) | |
tree | 0545e22c5fef9674d15013378bf21eada4017ef2 /libc/misc/internals/errno.c | |
parent | 43918e1e747e7d52c2d86565721dd66efc5167e5 (diff) | |
download | uClibc-alpine-4c607eb71e5bcd3997ea72333c2fe89fc4181b3e.tar.bz2 uClibc-alpine-4c607eb71e5bcd3997ea72333c2fe89fc4181b3e.tar.xz |
And finally, make 'errno' and TLS variable. The TLS conversion of errno, h_errno and __resp was a real challenge. I am glad that is over with.
Diffstat (limited to 'libc/misc/internals/errno.c')
-rw-r--r-- | libc/misc/internals/errno.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/libc/misc/internals/errno.c b/libc/misc/internals/errno.c index f2424eae0..107b61403 100644 --- a/libc/misc/internals/errno.c +++ b/libc/misc/internals/errno.c @@ -1,6 +1,24 @@ #include <features.h> -#undef errno +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ +__thread int errno; +__thread int h_errno; + +#ifdef SHARED +/* + * FIXME: Add usage of hidden attribute for both of these when used in + * the shared library. It currently crashes the linker when doing + * section relocations. + */ +extern __thread int __libc_errno __attribute__ ((alias ("errno"))); +extern __thread int __libc_h_errno __attribute__ ((alias ("h_errno"))); +#else +extern __thread int __libc_errno __attribute__ ((alias ("errno"))); +extern __thread int __libc_h_errno __attribute__ ((alias ("h_errno"))); +#endif +#define h_errno __libc_h_errno + +#else extern int errno; extern int h_errno; @@ -15,3 +33,4 @@ int _h_errno = 0; weak_alias (_errno, errno) weak_alias(_h_errno, h_errno); +#endif |