1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

nptl: Cleanup mutex internal offset tests

The offsets of pthread_mutex_t __data.__nusers, __data.__spins,
__data.elision, __data.list are not required to be constant over
the releases.  Only the __data.__kind is used for static
initializers.

This patch also adds an additional size check for __data.__kind.

Checked with a build against affected ABIs.

Change-Id: I7a4e48cc91b4c4ada57e9a5d1b151fb702bfaa9f
This commit is contained in:
Adhemerval Zanella
2019-11-07 20:58:41 +00:00
parent 7fc8c286e3
commit 71d260c107
19 changed files with 6 additions and 94 deletions

View File

@ -55,18 +55,11 @@ __pthread_mutex_init (pthread_mutex_t *mutex,
ASSERT_TYPE_SIZE (pthread_mutex_t, __SIZEOF_PTHREAD_MUTEX_T);
ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_mutex_t, __data.__nusers,
__PTHREAD_MUTEX_NUSERS_OFFSET);
/* __kind is the only field where its offset should be checked to
avoid ABI breakage with static initializers. */
ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_mutex_t, __data.__kind,
__PTHREAD_MUTEX_KIND_OFFSET);
ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_mutex_t, __data.__spins,
__PTHREAD_MUTEX_SPINS_OFFSET);
#if __PTHREAD_MUTEX_LOCK_ELISION
ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_mutex_t, __data.__elision,
__PTHREAD_MUTEX_ELISION_OFFSET);
#endif
ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_mutex_t, __data.__list,
__PTHREAD_MUTEX_LIST_OFFSET);
ASSERT_PTHREAD_INTERNAL_MEMBER_SIZE (pthread_mutex_t, __data.__kind, int);
imutexattr = ((const struct pthread_mutexattr *) mutexattr
?: &default_mutexattr);