mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-24 22:10:13 +00:00
nptl: Add tests for internal pthread_rwlock_t offsets
This patch new build tests to check for internal fields offsets for internal pthread_rwlock_t definition. Althoug the '__data.__flags' field layout should be preserved due static initializators, the patch also adds tests for the futexes that may be used in a shared memory (although using different libc version in such scenario is not really supported). Checked with a build against all affected ABIs. Change-Id: Iccc103d557de13d17e4a3f59a0cad2f4a640c148
This commit is contained in:
parent
71d260c107
commit
48dbce60cf
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "pthreadP.h"
|
#include "pthreadP.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <pthread-offsets.h>
|
||||||
|
|
||||||
|
|
||||||
static const struct pthread_rwlockattr default_rwlockattr =
|
static const struct pthread_rwlockattr default_rwlockattr =
|
||||||
@ -34,6 +35,13 @@ __pthread_rwlock_init (pthread_rwlock_t *rwlock,
|
|||||||
{
|
{
|
||||||
ASSERT_TYPE_SIZE (pthread_rwlock_t, __SIZEOF_PTHREAD_RWLOCK_T);
|
ASSERT_TYPE_SIZE (pthread_rwlock_t, __SIZEOF_PTHREAD_RWLOCK_T);
|
||||||
|
|
||||||
|
/* The __flags is the only field where its offset should be checked to
|
||||||
|
avoid ABI breakage with static initializers. */
|
||||||
|
ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_rwlock_t, __data.__flags,
|
||||||
|
__PTHREAD_RWLOCK_FLAGS_OFFSET);
|
||||||
|
ASSERT_PTHREAD_INTERNAL_MEMBER_SIZE (pthread_rwlock_t, __data.__flags,
|
||||||
|
int);
|
||||||
|
|
||||||
const struct pthread_rwlockattr *iattr;
|
const struct pthread_rwlockattr *iattr;
|
||||||
|
|
||||||
iattr = ((const struct pthread_rwlockattr *) attr) ?: &default_rwlockattr;
|
iattr = ((const struct pthread_rwlockattr *) attr) ?: &default_rwlockattr;
|
||||||
|
@ -1 +1,3 @@
|
|||||||
#define __PTHREAD_MUTEX_KIND_OFFSET 16
|
#define __PTHREAD_MUTEX_KIND_OFFSET 16
|
||||||
|
|
||||||
|
#define __PTHREAD_RWLOCK_FLAGS_OFFSET 48
|
||||||
|
@ -1 +1,3 @@
|
|||||||
#define __PTHREAD_MUTEX_KIND_OFFSET 16
|
#define __PTHREAD_MUTEX_KIND_OFFSET 16
|
||||||
|
|
||||||
|
#define __PTHREAD_RWLOCK_FLAGS_OFFSET 48
|
||||||
|
@ -1 +1,7 @@
|
|||||||
#define __PTHREAD_MUTEX_KIND_OFFSET 12
|
#define __PTHREAD_MUTEX_KIND_OFFSET 12
|
||||||
|
|
||||||
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||||
|
# define __PTHREAD_RWLOCK_FLAGS_OFFSET 27
|
||||||
|
#else
|
||||||
|
# define __PTHREAD_RWLOCK_FLAGS_OFFSET 24
|
||||||
|
#endif
|
||||||
|
@ -1 +1,3 @@
|
|||||||
#define __PTHREAD_MUTEX_KIND_OFFSET 12
|
#define __PTHREAD_MUTEX_KIND_OFFSET 12
|
||||||
|
|
||||||
|
#define __PTHREAD_RWLOCK_FLAGS_OFFSET 24
|
||||||
|
@ -1 +1,3 @@
|
|||||||
#define __PTHREAD_MUTEX_KIND_OFFSET 12
|
#define __PTHREAD_MUTEX_KIND_OFFSET 12
|
||||||
|
|
||||||
|
#define __PTHREAD_RWLOCK_FLAGS_OFFSET 51
|
||||||
|
@ -1 +1,3 @@
|
|||||||
#define __PTHREAD_MUTEX_KIND_OFFSET 12
|
#define __PTHREAD_MUTEX_KIND_OFFSET 12
|
||||||
|
|
||||||
|
#define __PTHREAD_RWLOCK_FLAGS_OFFSET 24
|
||||||
|
@ -1 +1,3 @@
|
|||||||
#define __PTHREAD_MUTEX_KIND_OFFSET 16
|
#define __PTHREAD_MUTEX_KIND_OFFSET 16
|
||||||
|
|
||||||
|
#define __PTHREAD_RWLOCK_FLAGS_OFFSET 48
|
||||||
|
@ -1 +1,3 @@
|
|||||||
#define __PTHREAD_MUTEX_KIND_OFFSET 12
|
#define __PTHREAD_MUTEX_KIND_OFFSET 12
|
||||||
|
|
||||||
|
#define __PTHREAD_RWLOCK_FLAGS_OFFSET 27
|
||||||
|
@ -1 +1,7 @@
|
|||||||
#define __PTHREAD_MUTEX_KIND_OFFSET 12
|
#define __PTHREAD_MUTEX_KIND_OFFSET 12
|
||||||
|
|
||||||
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||||
|
# define __PTHREAD_RWLOCK_FLAGS_OFFSET 27
|
||||||
|
#else
|
||||||
|
# define __PTHREAD_RWLOCK_FLAGS_OFFSET 24
|
||||||
|
#endif
|
||||||
|
@ -3,3 +3,13 @@
|
|||||||
#else
|
#else
|
||||||
# define __PTHREAD_MUTEX_KIND_OFFSET 12
|
# define __PTHREAD_MUTEX_KIND_OFFSET 12
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if _MIPS_SIM == _ABI64
|
||||||
|
# define __PTHREAD_RWLOCK_FLAGS_OFFSET 48
|
||||||
|
#else
|
||||||
|
# if __BYTE_ORDER == __BIG_ENDIAN
|
||||||
|
# define __PTHREAD_RWLOCK_FLAGS_OFFSET 27
|
||||||
|
# else
|
||||||
|
# define __PTHREAD_RWLOCK_FLAGS_OFFSET 24
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
@ -1 +1,3 @@
|
|||||||
#define __PTHREAD_MUTEX_KIND_OFFSET 12
|
#define __PTHREAD_MUTEX_KIND_OFFSET 12
|
||||||
|
|
||||||
|
#define __PTHREAD_RWLOCK_FLAGS_OFFSET 24
|
||||||
|
@ -5,3 +5,9 @@
|
|||||||
#else
|
#else
|
||||||
# define __PTHREAD_MUTEX_KIND_OFFSET 12
|
# define __PTHREAD_MUTEX_KIND_OFFSET 12
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __WORDSIZE == 64
|
||||||
|
# define __PTHREAD_RWLOCK_FLAGS_OFFSET 48
|
||||||
|
#else
|
||||||
|
# define __PTHREAD_RWLOCK_FLAGS_OFFSET 27
|
||||||
|
#endif
|
||||||
|
@ -18,3 +18,5 @@
|
|||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#define __PTHREAD_MUTEX_KIND_OFFSET 16
|
#define __PTHREAD_MUTEX_KIND_OFFSET 16
|
||||||
|
|
||||||
|
#define __PTHREAD_RWLOCK_FLAGS_OFFSET 48
|
||||||
|
@ -5,3 +5,9 @@
|
|||||||
#else
|
#else
|
||||||
# define __PTHREAD_MUTEX_KIND_OFFSET 12
|
# define __PTHREAD_MUTEX_KIND_OFFSET 12
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __WORDSIZE == 64
|
||||||
|
# define __PTHREAD_RWLOCK_FLAGS_OFFSET 48
|
||||||
|
#else
|
||||||
|
# define __PTHREAD_RWLOCK_FLAGS_OFFSET 27
|
||||||
|
#endif
|
||||||
|
@ -1 +1,7 @@
|
|||||||
#define __PTHREAD_MUTEX_KIND_OFFSET 12
|
#define __PTHREAD_MUTEX_KIND_OFFSET 12
|
||||||
|
|
||||||
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||||
|
# define __PTHREAD_RWLOCK_FLAGS_OFFSET 27
|
||||||
|
#else
|
||||||
|
# define __PTHREAD_RWLOCK_FLAGS_OFFSET 24
|
||||||
|
#endif
|
||||||
|
@ -5,3 +5,9 @@
|
|||||||
#else
|
#else
|
||||||
# define __PTHREAD_MUTEX_KIND_OFFSET 12
|
# define __PTHREAD_MUTEX_KIND_OFFSET 12
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __WORDSIZE == 64
|
||||||
|
# define __PTHREAD_RWLOCK_FLAGS_OFFSET 48
|
||||||
|
#else
|
||||||
|
# define __PTHREAD_RWLOCK_FLAGS_OFFSET 27
|
||||||
|
#endif
|
||||||
|
@ -1 +1,7 @@
|
|||||||
#define __PTHREAD_MUTEX_KIND_OFFSET 16
|
#define __PTHREAD_MUTEX_KIND_OFFSET 16
|
||||||
|
|
||||||
|
#ifdef __ILP32__
|
||||||
|
# define __PTHREAD_RWLOCK_FLAGS_OFFSET 40
|
||||||
|
#else
|
||||||
|
# define __PTHREAD_RWLOCK_FLAGS_OFFSET 48
|
||||||
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user