This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Fix ARM and MIPS build
- From: Daniel Jacobowitz <drow at false dot org>
- To: libc-ports at sourceware dot org
- Date: Wed, 6 Jun 2007 13:28:07 -0400
- Subject: Fix ARM and MIPS build
This patch fixes arm-linux and mips64-linux builds on trunk.
Applied.
--
Daniel Jacobowitz
CodeSourcery
2007-06-06 Daniel Jacobowitz <dan@codesourcery.com>
* sysdeps/arm/nptl/tls.h (THREAD_GSCOPE_FLAG_UNUSED,
THREAD_GSCOPE_FLAG_USED, THREAD_GSCOPE_FLAG_WAIT): Define.
(THREAD_GSCOPE_RESET_FLAG, THREAD_GSCOPE_SET_FLAG,
THREAD_GSCOPE_WAIT): Define.
* sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.c
(lll_unlock_wake_cb): Delete.
* sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
(FUTEX_PRIVATE_FLAG): Define.
(lll_unlock_wake_cb): Delete prototype.
* sysdeps/unix/sysv/linux/arm/nptl/bits/pthreadtypes.h: Include
<endian.h>.
(pthread_rwlock_t): Shrink __flags and add __shared.
* sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h
(RTLD_SINGLE_THREAD_P): Define.
2007-06-06 Daniel Jacobowitz <dan@codesourcery.com>
* sysdeps/mips/nptl/tls.h (THREAD_GSCOPE_FLAG_UNUSED,
THREAD_GSCOPE_FLAG_USED, THREAD_GSCOPE_FLAG_WAIT): Define.
(THREAD_GSCOPE_RESET_FLAG, THREAD_GSCOPE_SET_FLAG,
THREAD_GSCOPE_WAIT): Define.
* sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h
(FUTEX_PRIVATE_FLAG): Define.
(lll_unlock_wake_cb): Delete prototype.
* sysdeps/unix/sysv/linux/mips/nptl/bits/pthreadtypes.h: Include
<endian.h>.
(pthread_rwlock_t): Shrink __flags and add __shared.
Index: sysdeps/arm/nptl/tls.h
===================================================================
RCS file: /cvs/glibc/ports/sysdeps/arm/nptl/tls.h,v
retrieving revision 1.1
diff -u -p -r1.1 tls.h
--- sysdeps/arm/nptl/tls.h 16 Nov 2005 19:03:42 -0000 1.1
+++ sysdeps/arm/nptl/tls.h 6 Jun 2007 16:41:47 -0000
@@ -1,5 +1,5 @@
/* Definition for thread-local data handling. NPTL/ARM version.
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -132,6 +132,29 @@ typedef struct
is not available. */
#define TLS_INIT_TP_EXPENSIVE 1
+/* Get and set the global scope generation counter in struct pthread. */
+#define THREAD_GSCOPE_FLAG_UNUSED 0
+#define THREAD_GSCOPE_FLAG_USED 1
+#define THREAD_GSCOPE_FLAG_WAIT 2
+#define THREAD_GSCOPE_RESET_FLAG() \
+ do \
+ { int __res \
+ = atomic_exchange_rel (&THREAD_SELF->header.gscope_flag, \
+ THREAD_GSCOPE_FLAG_UNUSED); \
+ if (__res == THREAD_GSCOPE_FLAG_WAIT) \
+ lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1); \
+ } \
+ while (0)
+#define THREAD_GSCOPE_SET_FLAG() \
+ do \
+ { \
+ THREAD_SELF->header.gscope_flag = THREAD_GSCOPE_FLAG_USED; \
+ atomic_write_barrier (); \
+ } \
+ while (0)
+#define THREAD_GSCOPE_WAIT() \
+ GL(dl_wait_lookup_done) ()
+
#endif /* __ASSEMBLER__ */
#endif /* tls.h */
Index: sysdeps/mips/nptl/tls.h
===================================================================
RCS file: /cvs/glibc/ports/sysdeps/mips/nptl/tls.h,v
retrieving revision 1.1
diff -u -p -r1.1 tls.h
--- sysdeps/mips/nptl/tls.h 28 Mar 2005 09:19:38 -0000 1.1
+++ sysdeps/mips/nptl/tls.h 6 Jun 2007 16:41:47 -0000
@@ -1,5 +1,5 @@
/* Definition for thread-local data handling. NPTL/MIPS version.
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -156,6 +156,29 @@ typedef struct
different value to mean unset l_tls_offset. */
# define NO_TLS_OFFSET -1
+/* Get and set the global scope generation counter in struct pthread. */
+#define THREAD_GSCOPE_FLAG_UNUSED 0
+#define THREAD_GSCOPE_FLAG_USED 1
+#define THREAD_GSCOPE_FLAG_WAIT 2
+#define THREAD_GSCOPE_RESET_FLAG() \
+ do \
+ { int __res \
+ = atomic_exchange_rel (&THREAD_SELF->header.gscope_flag, \
+ THREAD_GSCOPE_FLAG_UNUSED); \
+ if (__res == THREAD_GSCOPE_FLAG_WAIT) \
+ lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1); \
+ } \
+ while (0)
+#define THREAD_GSCOPE_SET_FLAG() \
+ do \
+ { \
+ THREAD_SELF->header.gscope_flag = THREAD_GSCOPE_FLAG_USED; \
+ atomic_write_barrier (); \
+ } \
+ while (0)
+#define THREAD_GSCOPE_WAIT() \
+ GL(dl_wait_lookup_done) ()
+
#endif /* __ASSEMBLER__ */
#endif /* tls.h */
Index: sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.c
===================================================================
RCS file: /cvs/glibc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.c,v
retrieving revision 1.1
diff -u -p -r1.1 lowlevellock.c
--- sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.c 16 Nov 2005 19:03:42 -0000 1.1
+++ sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.c 6 Jun 2007 16:41:47 -0000
@@ -1,5 +1,5 @@
/* low level locking for pthread library. Generic futex-using version.
- Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -63,21 +63,9 @@ __lll_timedlock_wait (int *futex, const
}
-/* These don't get included in libc.so */
+/* This function doesn't get included in libc.so */
#ifdef IS_IN_libpthread
int
-lll_unlock_wake_cb (int *futex)
-{
- int val = atomic_exchange_rel (futex, 0);
-
- if (__builtin_expect (val > 1, 0))
- lll_futex_wake (futex, 1);
-
- return 0;
-}
-
-
-int
__lll_timedwait_tid (int *tidp, const struct timespec *abstime)
{
int tid;
@@ -114,5 +102,4 @@ __lll_timedwait_tid (int *tidp, const st
return 0;
}
-
#endif
Index: sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
===================================================================
RCS file: /cvs/glibc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h,v
retrieving revision 1.3
diff -u -p -r1.3 lowlevellock.h
--- sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h 4 Aug 2006 18:56:15 -0000 1.3
+++ sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h 6 Jun 2007 16:41:47 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -34,6 +34,7 @@
#define FUTEX_LOCK_PI 6
#define FUTEX_UNLOCK_PI 7
#define FUTEX_TRYLOCK_PI 8
+#define FUTEX_PRIVATE_FLAG 128
/* Initializer for compatibility lock. */
#define LLL_MUTEX_LOCK_INITIALIZER (0)
@@ -267,8 +268,6 @@ typedef int lll_lock_t;
#define LLL_LOCK_INITIALIZER (0)
#define LLL_LOCK_INITIALIZER_LOCKED (1)
-extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
-
/* The states of a lock are:
0 - untaken
1 - taken by one user
Index: sysdeps/unix/sysv/linux/arm/nptl/bits/pthreadtypes.h
===================================================================
RCS file: /cvs/glibc/ports/sysdeps/unix/sysv/linux/arm/nptl/bits/pthreadtypes.h,v
retrieving revision 1.2
diff -u -p -r1.2 pthreadtypes.h
--- sysdeps/unix/sysv/linux/arm/nptl/bits/pthreadtypes.h 27 Feb 2006 15:36:07 -0000 1.2
+++ sysdeps/unix/sysv/linux/arm/nptl/bits/pthreadtypes.h 6 Jun 2007 16:41:47 -0000
@@ -19,6 +19,8 @@
#ifndef _BITS_PTHREADTYPES_H
#define _BITS_PTHREADTYPES_H 1
+#include <endian.h>
+
#define __SIZEOF_PTHREAD_ATTR_T 36
#define __SIZEOF_PTHREAD_MUTEX_T 24
#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
@@ -126,9 +128,21 @@ typedef union
unsigned int __writer_wakeup;
unsigned int __nr_readers_queued;
unsigned int __nr_writers_queued;
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned char __pad1;
+ unsigned char __pad2;
+ unsigned char __shared;
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned char __flags;
+#else
/* FLAGS must stay at this position in the structure to maintain
binary compatibility. */
- unsigned int __flags;
+ unsigned char __flags;
+ unsigned char __shared;
+ unsigned char __pad1;
+ unsigned char __pad2;
+#endif
int __writer;
} __data;
char __size[__SIZEOF_PTHREAD_RWLOCK_T];
Index: sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h
===================================================================
RCS file: /cvs/glibc/ports/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h,v
retrieving revision 1.4
diff -u -p -r1.4 lowlevellock.h
--- sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h 4 Aug 2006 18:54:56 -0000 1.4
+++ sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h 6 Jun 2007 16:41:47 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -35,6 +35,7 @@
#define FUTEX_LOCK_PI 6
#define FUTEX_UNLOCK_PI 7
#define FUTEX_TRYLOCK_PI 8
+#define FUTEX_PRIVATE_FLAG 128
/* Initializer for compatibility lock. */
#define LLL_MUTEX_LOCK_INITIALIZER (0)
@@ -234,8 +235,6 @@ typedef int lll_lock_t;
#define LLL_LOCK_INITIALIZER (0)
#define LLL_LOCK_INITIALIZER_LOCKED (1)
-extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
-
/* The states of a lock are:
0 - untaken
1 - taken by one user
Index: sysdeps/unix/sysv/linux/mips/nptl/bits/pthreadtypes.h
===================================================================
RCS file: /cvs/glibc/ports/sysdeps/unix/sysv/linux/mips/nptl/bits/pthreadtypes.h,v
retrieving revision 1.3
diff -u -p -r1.3 pthreadtypes.h
--- sysdeps/unix/sysv/linux/mips/nptl/bits/pthreadtypes.h 3 Mar 2006 01:16:30 -0000 1.3
+++ sysdeps/unix/sysv/linux/mips/nptl/bits/pthreadtypes.h 6 Jun 2007 16:41:47 -0000
@@ -20,6 +20,8 @@
#ifndef _BITS_PTHREADTYPES_H
#define _BITS_PTHREADTYPES_H 1
+#include <endian.h>
+
#if _MIPS_SIM == _ABI64
# define __SIZEOF_PTHREAD_ATTR_T 56
# define __SIZEOF_PTHREAD_MUTEX_T 40
@@ -157,9 +159,9 @@ typedef union
unsigned int __nr_readers_queued;
unsigned int __nr_writers_queued;
int __writer;
- int __pad1;
+ int __shared;
+ unsigned long int __pad1;
unsigned long int __pad2;
- unsigned long int __pad3;
/* FLAGS must stay at this position in the structure to maintain
binary compatibility. */
unsigned int __flags;
@@ -173,9 +175,21 @@ typedef union
unsigned int __writer_wakeup;
unsigned int __nr_readers_queued;
unsigned int __nr_writers_queued;
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned char __pad1;
+ unsigned char __pad2;
+ unsigned char __shared;
/* FLAGS must stay at this position in the structure to maintain
binary compatibility. */
- unsigned int __flags;
+ unsigned char __flags;
+#else
+ /* FLAGS must stay at this position in the structure to maintain
+ binary compatibility. */
+ unsigned char __flags;
+ unsigned char __shared;
+ unsigned char __pad1;
+ unsigned char __pad2;
+#endif
int __writer;
} __data;
# endif
Index: sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h
===================================================================
RCS file: /cvs/glibc/ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h,v
retrieving revision 1.1
diff -u -p -r1.1 sysdep-cancel.h
--- sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h 16 Nov 2005 19:22:59 -0000 1.1
+++ sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h 6 Jun 2007 17:26:04 -0000
@@ -126,3 +126,9 @@ extern int __local_multiple_threads attr
# define NO_CANCELLATION 1
#endif
+
+#ifndef __ASSEMBLER__
+# define RTLD_SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+#endif