diff options
-rw-r--r-- | include/features.h | 8 | ||||
-rw-r--r-- | include/netdb.h | 5 | ||||
-rw-r--r-- | libc/inet/rpc/rpc_thread.c | 9 | ||||
-rw-r--r-- | libc/sysdeps/linux/mips/sys/asm.h | 45 | ||||
-rw-r--r-- | libc/sysdeps/linux/mips/sys/regdef.h | 10 | ||||
-rw-r--r-- | libpthread/nptl/compat/libc-internal.h | 3 | ||||
-rw-r--r-- | libpthread/nptl/compat/libc-symbols.h | 31 | ||||
-rw-r--r-- | libpthread/nptl/pt-system.c | 5 | ||||
-rw-r--r-- | libpthread/nptl/sem_open.c | 14 | ||||
-rw-r--r-- | libpthread/nptl/sysdeps/mips/tls.h | 4 |
10 files changed, 108 insertions, 26 deletions
diff --git a/include/features.h b/include/features.h index 0af6bf43b..07d19f1f5 100644 --- a/include/features.h +++ b/include/features.h @@ -280,6 +280,14 @@ # define __GLIBC_MINOR__ 2 #endif +/* + * NPTL requires this to be defined. Unfortunately, due to complexities + * in include dependencies, this cannot be defined on a per file basis. + */ +#ifdef __PTHREADS_NATIVE__ +# define __USE_XOPEN2K 1 +#endif + /* Convenience macros to test the versions of glibc and gcc. Use them like this: #if __GNUC_PREREQ (2,8) diff --git a/include/netdb.h b/include/netdb.h index 4a48d0b97..c047c7fe7 100644 --- a/include/netdb.h +++ b/include/netdb.h @@ -53,8 +53,13 @@ __BEGIN_DECLS +#include <tls.h> +#ifdef USE___THREAD +extern __thread int h_errno attribute_tls_model_ie; +#else /* Error status for non-reentrant lookup functions. */ extern int h_errno; +#endif /* Function to get address of global `h_errno' variable. */ extern int *__h_errno_location (void) __THROW __attribute__ ((__const__)); diff --git a/libc/inet/rpc/rpc_thread.c b/libc/inet/rpc/rpc_thread.c index 75a5d0f4d..be820599b 100644 --- a/libc/inet/rpc/rpc_thread.c +++ b/libc/inet/rpc/rpc_thread.c @@ -9,8 +9,13 @@ /* Variable used in non-threaded applications or for the first thread. */ static struct rpc_thread_variables __libc_tsd_RPC_VARS_mem; +#ifdef __PTHREADS_NATIVE__ +static struct rpc_thread_variables *__libc_tsd_RPC_VARS = + &__libc_tsd_RPC_VARS_mem; +#else static struct rpc_thread_variables *__libc_tsd_RPC_VARS_data = &__libc_tsd_RPC_VARS_mem; +#endif /* * Task-variable destructor @@ -77,7 +82,11 @@ __rpc_thread_variables (void) if (tvp != NULL) __libc_tsd_set (RPC_VARS, tvp); else +#ifdef __PTHREADS_NATIVE__ + tvp = __libc_tsd_RPC_VARS; +#else tvp = __libc_tsd_RPC_VARS_data; +#endif } } return tvp; diff --git a/libc/sysdeps/linux/mips/sys/asm.h b/libc/sysdeps/linux/mips/sys/asm.h index 76f6af3e1..b590802fd 100644 --- a/libc/sysdeps/linux/mips/sys/asm.h +++ b/libc/sysdeps/linux/mips/sys/asm.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1997, 1998, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ralf Baechle <ralf@gnu.org>. @@ -37,11 +38,11 @@ * 64 bit address space isn't used yet, so we may use the R3000 32 bit * defines for now. */ -#if (_MIPS_SIM == _MIPS_SIM_ABI32) || (_MIPS_SIM == _MIPS_SIM_NABI32) +#if _MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIN32 # define PTR .word # define PTRSIZE 4 # define PTRLOG 2 -#elif (_MIPS_SIM == _MIPS_SIM_ABI64) +#elif _MIPS_SIM == _ABI64 # define PTR .dword # define PTRSIZE 8 # define PTRLOG 3 @@ -50,7 +51,7 @@ /* * PIC specific declarations */ -#if (_MIPS_SIM == _MIPS_SIM_ABI32) +#if _MIPS_SIM == _ABIO32 # ifdef __PIC__ # define CPRESTORE(register) \ .cprestore register @@ -97,7 +98,7 @@ l: \ # define SETUP_GPX64_L(cp_reg, ra_save, l) # define RESTORE_GP64 # define USE_ALT_CP(a) -#else /* (_MIPS_SIM == _MIPS_SIM_ABI64) || (_MIPS_SIM == _MIPS_SIM_NABI32) */ +#else /* _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32 */ /* * For callee-saved gp calling convention: */ @@ -131,15 +132,15 @@ l: \ /* Use alternate register for context pointer. */ # define USE_ALT_CP(reg) \ .cplocal reg -#endif /* _MIPS_SIM != _MIPS_SIM_ABI32 */ +#endif /* _MIPS_SIM != _ABIO32 */ /* * Stack Frame Definitions */ -#if (_MIPS_SIM == _MIPS_SIM_ABI32) +#if _MIPS_SIM == _ABIO32 # define NARGSAVE 4 /* Space for 4 argument registers must be allocated. */ #endif -#if (_MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32) +#if _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32 # define NARGSAVE 0 /* No caller responsibilities. */ #endif @@ -287,7 +288,7 @@ symbol = value /* * Stack alignment */ -#if (_MIPS_SIM == _MIPS_SIM_ABI64) || (_MIPS_SIM == _MIPS_SIM_NABI32) +#if _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32 # define ALSZ 15 # define ALMASK ~15 #else @@ -298,7 +299,7 @@ symbol = value /* * Size of a register */ -#if (_MIPS_SIM == _MIPS_SIM_ABI64) || (_MIPS_SIM == _MIPS_SIM_NABI32) +#if _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32 # define SZREG 8 #else # define SZREG 4 @@ -389,7 +390,7 @@ symbol = value /* * How to add/sub/load/store/shift pointers. */ -#if (_MIPS_SIM == _MIPS_SIM_ABI32 && _MIPS_SZPTR == 32) +#if (_MIPS_SIM == _ABIO32 && _MIPS_SZPTR == 32) # define PTR_ADD add # define PTR_ADDI addi # define PTR_ADDU addu @@ -411,7 +412,7 @@ symbol = value # define PTR_SCALESHIFT 2 #endif -#if _MIPS_SIM == _MIPS_SIM_NABI32 +#if _MIPS_SIM == _ABIN32 # define PTR_ADD add # define PTR_ADDI addi # define PTR_ADDU add /* no u */ @@ -433,8 +434,8 @@ symbol = value # define PTR_SCALESHIFT 2 #endif -#if (_MIPS_SIM == _MIPS_SIM_ABI32 && _MIPS_SZPTR == 64 /* o64??? */) \ - || _MIPS_SIM == _MIPS_SIM_ABI64 +#if (_MIPS_SIM == _ABIO32 && _MIPS_SZPTR == 64 /* o64??? */) \ + || _MIPS_SIM == _ABI64 # define PTR_ADD dadd # define PTR_ADDI daddi # define PTR_ADDU daddu @@ -470,4 +471,20 @@ symbol = value # define MTC0 dmtc0 #endif +/* The MIPS archtectures do not have a uniform memory model. Particular + platforms may provide additional guarantees - for instance, the R4000 + LL and SC instructions implicitly perform a SYNC, and the 4K promises + strong ordering. + + However, in the absence of those guarantees, we must assume weak ordering + and SYNC explicitly where necessary. + + Some obsolete MIPS processors may not support the SYNC instruction. This + applies to "true" MIPS I processors; most of the processors which compile + using MIPS I implement parts of MIPS II. */ + +#ifndef MIPS_SYNC +# define MIPS_SYNC sync +#endif + #endif /* sys/asm.h */ diff --git a/libc/sysdeps/linux/mips/sys/regdef.h b/libc/sysdeps/linux/mips/sys/regdef.h index 9d2c4c1c4..8fb898a2d 100644 --- a/libc/sysdeps/linux/mips/sys/regdef.h +++ b/libc/sysdeps/linux/mips/sys/regdef.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ralf Baechle <ralf@gnu.org>. @@ -20,6 +20,8 @@ #ifndef _SYS_REGDEF_H #define _SYS_REGDEF_H +#include <sgidefs.h> + /* * Symbolic register names for 32 bit ABI */ @@ -31,7 +33,7 @@ #define a1 $5 #define a2 $6 #define a3 $7 -#if _MIPS_SIM != _MIPS_SIM_ABI32 +#if _MIPS_SIM != _ABIO32 #define a4 $8 #define a5 $9 #define a6 $10 @@ -44,7 +46,7 @@ #define ta1 a5 #define ta2 a6 #define ta3 a7 -#else /* if _MIPS_SIM == _MIPS_SIM_ABI32 */ +#else /* if _MIPS_SIM == _ABIO32 */ #define t0 $8 /* caller saved */ #define t1 $9 #define t2 $10 @@ -57,7 +59,7 @@ #define ta1 t5 #define ta2 t6 #define ta3 t7 -#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ +#endif /* _MIPS_SIM == _ABIO32 */ #define s0 $16 /* callee saved */ #define s1 $17 #define s2 $18 diff --git a/libpthread/nptl/compat/libc-internal.h b/libpthread/nptl/compat/libc-internal.h index e5fd5337a..455e9b34b 100644 --- a/libpthread/nptl/compat/libc-internal.h +++ b/libpthread/nptl/compat/libc-internal.h @@ -5,6 +5,9 @@ # define _LIBC_INTERNAL 1 #include <hp-timing.h> +#ifdef __UCLIBC__ +#include <libc-symbols.h> +#endif /* Initialize the `__libc_enable_secure' flag. */ extern void __libc_init_secure (void); diff --git a/libpthread/nptl/compat/libc-symbols.h b/libpthread/nptl/compat/libc-symbols.h index f2db6a416..9c7cc6238 100644 --- a/libpthread/nptl/compat/libc-symbols.h +++ b/libpthread/nptl/compat/libc-symbols.h @@ -1,12 +1,31 @@ #ifndef _LIBC_SYMBOLS_H #define _LIBC_SYMBOLS_H 1 -/* - * NPTL - These definitions were taken from 'include/libc-symbols.h' - * in glibc. We are going to use the empty macros for now - * until we run into other compile errors that force us to - * do otherwise. - */ +/* Handling on non-exported internal names. We have to do this only + for shared code. */ +#ifdef SHARED +# define INTUSE(name) name##_internal +# define INTDEF(name) strong_alias (name, name##_internal) +# define INTVARDEF(name) \ + _INTVARDEF (name, name##_internal) +# if defined HAVE_VISIBILITY_ATTRIBUTE +# define _INTVARDEF(name, aliasname) \ + extern __typeof (name) aliasname __attribute__ ((alias (#name), \ + visibility ("hidden"))); +# else +# define _INTVARDEF(name, aliasname) \ + extern __typeof (name) aliasname __attribute__ ((alias (#name))); +# endif +# define INTDEF2(name, newname) strong_alias (name, newname##_internal) +# define INTVARDEF2(name, newname) _INTVARDEF (name, newname##_internal) +#else +# define INTUSE(name) name +# define INTDEF(name) +# define INTVARDEF(name) +# define INTDEF2(name, newname) +# define INTVARDEF2(name, newname) +#endif + #if 0 # ifndef __ASSEMBLER__ # if !defined HAVE_VISIBILITY_ATTRIBUTE \ diff --git a/libpthread/nptl/pt-system.c b/libpthread/nptl/pt-system.c index b3b45ab93..c43c1edbb 100644 --- a/libpthread/nptl/pt-system.c +++ b/libpthread/nptl/pt-system.c @@ -22,6 +22,11 @@ #include <sysdep.h> #include "pthreadP.h" +/* Compatibility define. */ +#ifdef __UCLIBC__ +#include <sysdep-cancel.h> +#define __libc_system system +#endif int system (const char *line) diff --git a/libpthread/nptl/sem_open.c b/libpthread/nptl/sem_open.c index a4b2f5b3a..1fb72d2d4 100644 --- a/libpthread/nptl/sem_open.c +++ b/libpthread/nptl/sem_open.c @@ -18,6 +18,9 @@ 02111-1307 USA. */ #include <errno.h> +#ifdef __PTHREADS_NATIVE__ +#define __USE_GNU +#endif #include <fcntl.h> #include <mntent.h> #include <paths.h> @@ -36,6 +39,17 @@ #include "semaphoreP.h" +/* Compatibility defines. */ +#if __UCLIBC__ +#define __endmntent endmntent +#define __fxstat64(vers, fd, buf) fstat64(fd, buf) +#define __getmntent_r getmntent_r +#define __setmntent setmntent +#define __statfs statfs +#define __libc_close close +#define __libc_open open +#define __libc_write write +#endif /* Information about the mount point. */ struct mountpoint_info mountpoint attribute_hidden; diff --git a/libpthread/nptl/sysdeps/mips/tls.h b/libpthread/nptl/sysdeps/mips/tls.h index dde10be60..3adfebccf 100644 --- a/libpthread/nptl/sysdeps/mips/tls.h +++ b/libpthread/nptl/sysdeps/mips/tls.h @@ -59,7 +59,7 @@ typedef union dtv /* We require TLS support in the tools. */ /* * NPTL - These defines would normally be handled by the top-level - * configure script in glibc. We define them ourselves. + * configure script in glibc. */ #ifdef __PTHREADS_NATIVE__ #define HAVE_TLS_SUPPORT 1 @@ -84,7 +84,7 @@ typedef union dtv /* Get the thread descriptor definition. */ #ifdef __UCLIBC__ -# include <descr.h> +# include <../../descr.h> #else # include <nptl/descr.h> #endif |