diff options
-rw-r--r-- | include/netdb.h | 26 | ||||
-rw-r--r-- | libc/misc/internals/Makefile.in | 2 | ||||
-rw-r--r-- | libc/misc/internals/__h_errno_location.c | 6 | ||||
-rw-r--r-- | libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in | 4 |
4 files changed, 29 insertions, 9 deletions
diff --git a/include/netdb.h b/include/netdb.h index 1d27ddcd4..d386736e1 100644 --- a/include/netdb.h +++ b/include/netdb.h @@ -60,9 +60,31 @@ __BEGIN_DECLS /* Function to get address of global `h_errno' variable. */ extern int *__h_errno_location (void) __THROW __attribute__ ((__const__)); +/* Macros for accessing h_errno from inside libc. */ #ifdef _LIBC -# define __set_h_errno(x) (h_errno = (x)) -#endif +# ifdef __UCLIBC_HAS_THREADS__ +# if defined __UCLIBC_HAS_THREADS_NATIVE__ \ + && (!defined NOT_IN_libc || defined IS_IN_libpthread) +# undef h_errno +# ifndef NOT_IN_libc +# define h_errno __libc_h_errno +# else +# define h_errno h_errno /* For #ifndef h_errno tests. */ +# endif +extern __thread int h_errno attribute_tls_model_ie; +# define __set_h_errno(x) (h_errno = (x)) +# else +static inline int __set_h_errno (int __err) +{ + return *__h_errno_location () = __err; +} +# endif /* __UCLIBC_HAS_THREADS_NATIVE__ */ +# else +# undef h_errno +# define __set_h_errno(x) (h_errno = (x)) +extern int h_errno; +# endif /* __UCLIBC_HAS_THREADS__ */ +#endif /* _LIBC */ /* Possible values left in `h_errno'. */ #define NETDB_INTERNAL -1 /* See errno. */ diff --git a/libc/misc/internals/Makefile.in b/libc/misc/internals/Makefile.in index 4c7012d9a..66fde4f76 100644 --- a/libc/misc/internals/Makefile.in +++ b/libc/misc/internals/Makefile.in @@ -17,7 +17,7 @@ MISC_INTERNALS_SRC:=$(patsubst %.c,$(MISC_INTERNALS_DIR)/%.c,$(CSRC)) MISC_INTERNALS_OBJ:=$(patsubst %.c,$(MISC_INTERNALS_OUT)/%.o,$(CSRC)) libc-a-y+=$(MISC_INTERNALS_OBJ) -libc-so-y+=$(MISC_INTERNALS_OBJ:.o=.os) +libc-so-y+=$(MISC_INTERNALS_OBJ:.o=.oS) libc-shared-y+=$(MISC_INTERNALS_OUT)/__uClibc_main.oS libc-static-y+=$(MISC_INTERNALS_OUT)/__uClibc_main.o diff --git a/libc/misc/internals/__h_errno_location.c b/libc/misc/internals/__h_errno_location.c index d1040dd87..209dcfc9c 100644 --- a/libc/misc/internals/__h_errno_location.c +++ b/libc/misc/internals/__h_errno_location.c @@ -1,11 +1,9 @@ #define __FORCE_GLIBC #include <features.h> #include <netdb.h> -#undef h_errno -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -extern __thread int h_errno; -#else +#ifndef __UCLIBC_HAS_THREADS_NATIVE__ +#undef h_errno extern int h_errno; #endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in index d19aba771..8bd512731 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in @@ -43,7 +43,6 @@ CFLAGS-pthread_getcpuclockid.c = -I$(top_srcdir)/librt CFLAGS-linux = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 $(SSP_ALL_CFLAGS) #CFLAGS:=$(CFLAGS:-O1=-O2) -CFLAGS-OMIT-libc-lowlevellock.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 CFLAGS-OMIT-libc_pthread_init.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 CFLAGS-OMIT-libc_multiple_threads.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 CFLAGS-OMIT-register-atfork.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 @@ -51,6 +50,7 @@ CFLAGS-OMIT-unregister-atfork.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 CFLAGS-OMIT-getpid.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 CFLAGS-OMIT-raise.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 CFLAGS-OMIT-sleep.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 +CFLAGS-OMIT-libc-lowlevellock.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 linux_DIR := $(top_srcdir)/libpthread/nptl/sysdeps/unix/sysv/linux linux_OUT := $(top_builddir)/libpthread/nptl/sysdeps/unix/sysv/linux @@ -67,7 +67,7 @@ LIBC_OBJ = $(patsubst %.c, $(linux_OUT)/%.o, $(libc_CSRC)) libc-a-y += $(LIBC_OBJ) -libc-so-y += $(LIBC_OBJ:.o=.os) +libc-so-y += $(LIBC_OBJ:.o=.oS) objclean-y += pthread_linux_objclean |