Message ID | gerrit.1573136666000.Iccc103d557de13d17e4a3f59a0cad2f4a640c148@gnutoolchain-gerrit.osci.io |
---|---|
State | New |
Headers | show |
Series | [review] nptl: Add tests for internal pthread_rwlock_t offsets | expand |
Florian Weimer has posted comments on this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/516 ...................................................................... Patch Set 1: Code-Review+1 (3 comments) Still need to run build-many-glibcs.py against this patch. https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/516/1//COMMIT_MSG Commit Message: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/516/1//COMMIT_MSG@16 PS1, Line 16: 11 | field layout should be preserved due static initializators, the patch 12 | also adds tests for the futexes that may be used in a shared memory 13 | (although using different libc version in such scenario is not really 14 | supported). 15 | 16 > Checked with a build against all affected ABIs. 17 | 18 | Change-Id: Iccc103d557de13d17e4a3f59a0cad2f4a640c148 Did you build the tests too? https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/516/1/nptl/pthread_rwlock_init.c File nptl/pthread_rwlock_init.c: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/516/1/nptl/pthread_rwlock_init.c@51 PS1, Line 51: 33 | __pthread_rwlock_init (pthread_rwlock_t *rwlock, | ... 46 | ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_rwlock_t, __data.__cur_writer, 47 | __PTHREAD_RWLOCK_CUR_WRITER_OFFSET); 48 | ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_rwlock_t, __data.__shared, 49 | __PTHREAD_RWLOCK_SHARED_OFFSET); 50 | ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_rwlock_t, __data.__flags, 51 > __PTHREAD_RWLOCK_FLAGS_OFFSET); 52 | 53 | const struct pthread_rwlockattr *iattr; 54 | 55 | iattr = ((const struct pthread_rwlockattr *) attr) ?: &default_rwlockattr; 56 | Do we really need to assert on all those implementation details? Or is covering __flags enough? I think from an ABI perspective, only the position of the non-zero bits in __flags matters. If you want to leave in all the asserts, I'd suggest to single out __flags with a comment. https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/516/1/sysdeps/mips/nptl/pthread-offsets.h File sysdeps/mips/nptl/pthread-offsets.h: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/516/1/sysdeps/mips/nptl/pthread-offsets.h@36 PS1, Line 36: 31 | # define __PTHREAD_RWLOCK_FLAGS_OFFSET 27 32 | # else 33 | # define __PTHREAD_RWLOCK_SHARED_OFFSET 25 34 | # define __PTHREAD_RWLOCK_FLAGS_OFFSET 24 35 | # endif 36 > #endif I wonder if that should be handled with sysdeps overrides instead of conditionals? I kind of like the conditionals because they better highlight commonalities, though.
Adhemerval Zanella has posted comments on this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/516 ...................................................................... Patch Set 1: > Patch Set 1: Code-Review+1 > > (3 comments) > > Still need to run build-many-glibcs.py against this patch. Yes I ran build-many-glibcs.py, although with a subset that aims to cover all the affected ABIs (aarch64-linux-gnu alpha-linux-gnu armeb-linux-gnueabihf arm-linux-gnueabihf csky-linux-gnuabiv2 hppa-linux-gnu i686-gnu i686-linux-gnu ia64-linux-gnu m68k-linux-gnu m68k-linux-gnu-coldfire microblazeel-linux-gnu microblaze-linux-gnu mips64-linux-gnu mips64-n32-linux-gnu mips-linux-gnu mips-linux-gnu-soft nios2-linux-gnu powerpc64le-linux-gnu powerpc64-linux-gnu powerpc-linux-gnu powerpc-linux-gnu-power4 riscv64-linux-gnu-rv64imafdc-lp64d s390-linux-gnu s390x-linux-gnu sh4eb-linux-gnu sh4-linux-gnu sparc64-linux-gnu sparcv9-linux-gnu x86_64-linux-gnu x86_64-linux-gnu-x32).
Adhemerval Zanella has posted comments on this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/516 ...................................................................... Patch Set 1: (3 comments) https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/516/1//COMMIT_MSG Commit Message: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/516/1//COMMIT_MSG@16 PS1, Line 16: 11 | field layout should be preserved due static initializators, the patch 12 | also adds tests for the futexes that may be used in a shared memory 13 | (although using different libc version in such scenario is not really 14 | supported). 15 | 16 > Checked with a build against all affected ABIs. 17 | 18 | Change-Id: Iccc103d557de13d17e4a3f59a0cad2f4a640c148 > Did you build the tests too? Done https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/516/1/nptl/pthread_rwlock_init.c File nptl/pthread_rwlock_init.c: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/516/1/nptl/pthread_rwlock_init.c@51 PS1, Line 51: 33 | __pthread_rwlock_init (pthread_rwlock_t *rwlock, | ... 46 | ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_rwlock_t, __data.__cur_writer, 47 | __PTHREAD_RWLOCK_CUR_WRITER_OFFSET); 48 | ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_rwlock_t, __data.__shared, 49 | __PTHREAD_RWLOCK_SHARED_OFFSET); 50 | ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_rwlock_t, __data.__flags, 51 > __PTHREAD_RWLOCK_FLAGS_OFFSET); 52 | 53 | const struct pthread_rwlockattr *iattr; 54 | 55 | iattr = ((const struct pthread_rwlockattr *) attr) ?: &default_rwlockattr; 56 | > Do we really need to assert on all those implementation details? Or is covering __flags enough? I th […] The __flags cover the static initializers, which is what really defines the ABI. The other members might be used along with a shared memory (PTHREAD_PROCESS_SHARED), but I don't think we support using shared pthread objects across different glibc versions. I have added all the fields to certify the subsequent code refactoring (that add rwlock-internal.h) do not change the current internal layout. I will add a comment stating that ABI-wise only __flags should be checked, the other fields are an implementation detail that can be changed over the releases. https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/516/1/sysdeps/mips/nptl/pthread-offsets.h File sysdeps/mips/nptl/pthread-offsets.h: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/516/1/sysdeps/mips/nptl/pthread-offsets.h@36 PS1, Line 36: 31 | # define __PTHREAD_RWLOCK_FLAGS_OFFSET 27 32 | # else 33 | # define __PTHREAD_RWLOCK_SHARED_OFFSET 25 34 | # define __PTHREAD_RWLOCK_FLAGS_OFFSET 24 35 | # endif 36 > #endif > I wonder if that should be handled with sysdeps overrides instead of conditionals? […] I don't have a strong opinion here.
Florian Weimer has posted comments on this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/516 ...................................................................... Patch Set 1: Code-Review+2 My independent testing show that the computed offsets are okay.
Florian Weimer has posted comments on this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/516 ...................................................................... Patch Set 2: (2 comments) I ran this through a full build-many-glibcs.py run, and the results look good. | --- nptl/pthread_rwlock_init.c | +++ nptl/pthread_rwlock_init.c | @@ -37,8 +42,19 @@ __pthread_rwlock_init (pthread_rwlock_t *rwlock, | + ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_rwlock_t, __data.__wrphase_futex, | + __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET); | + ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_rwlock_t, __data.__writers_futex, | + __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET); | + ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_rwlock_t, __data.__cur_writer, | + __PTHREAD_RWLOCK_CUR_WRITER_OFFSET); | + ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_rwlock_t, __data.__shared, | + __PTHREAD_RWLOCK_SHARED_OFFSET); | + ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_rwlock_t, __data.__flags, | + __PTHREAD_RWLOCK_FLAGS_OFFSET); PS1, Line 51: Done | + | const struct pthread_rwlockattr *iattr; | | iattr = ((const struct pthread_rwlockattr *) attr) ?: &default_rwlockattr; | | memset (rwlock, '\0', sizeof (*rwlock)); | | rwlock->__data.__flags = iattr->lockkind; | | --- sysdeps/mips/nptl/pthread-offsets.h | +++ sysdeps/mips/nptl/pthread-offsets.h | @@ -14,0 +27,10 @@ # define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 | +# define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 | +# define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 28 | +# if __BYTE_ORDER == __BIG_ENDIAN | +# define __PTHREAD_RWLOCK_SHARED_OFFSET 26 | +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 27 | +# else | +# define __PTHREAD_RWLOCK_SHARED_OFFSET 25 | +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 24 | +# endif | +#endif PS1, Line 36: Done
Florian Weimer has posted comments on this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/516 ...................................................................... Patch Set 4: Code-Review+2
diff --git a/nptl/pthread_rwlock_init.c b/nptl/pthread_rwlock_init.c index 04f0d40..a485cb8 100644 --- a/nptl/pthread_rwlock_init.c +++ b/nptl/pthread_rwlock_init.c @@ -18,6 +18,7 @@ #include "pthreadP.h" #include <string.h> +#include <pthread-offsets.h> static const struct pthread_rwlockattr default_rwlockattr = @@ -34,6 +35,21 @@ { ASSERT_TYPE_SIZE (pthread_rwlock_t, __SIZEOF_PTHREAD_RWLOCK_T); + ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_rwlock_t, __data.__readers, + __PTHREAD_RWLOCK_READERS_OFFSET); + ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_rwlock_t, __data.__writers, + __PTHREAD_RWLOCK_WRITERS_OFFSET); + ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_rwlock_t, __data.__wrphase_futex, + __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET); + ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_rwlock_t, __data.__writers_futex, + __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET); + ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_rwlock_t, __data.__cur_writer, + __PTHREAD_RWLOCK_CUR_WRITER_OFFSET); + ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_rwlock_t, __data.__shared, + __PTHREAD_RWLOCK_SHARED_OFFSET); + ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_rwlock_t, __data.__flags, + __PTHREAD_RWLOCK_FLAGS_OFFSET); + const struct pthread_rwlockattr *iattr; iattr = ((const struct pthread_rwlockattr *) attr) ?: &default_rwlockattr; diff --git a/sysdeps/aarch64/nptl/pthread-offsets.h b/sysdeps/aarch64/nptl/pthread-offsets.h index 16c6b0d..679cec5 100644 --- a/sysdeps/aarch64/nptl/pthread-offsets.h +++ b/sysdeps/aarch64/nptl/pthread-offsets.h @@ -3,3 +3,11 @@ #define __PTHREAD_MUTEX_SPINS_OFFSET 20 #define __PTHREAD_MUTEX_ELISION_OFFSET 22 #define __PTHREAD_MUTEX_LIST_OFFSET 24 + +#define __PTHREAD_RWLOCK_READERS_OFFSET 0 +#define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +#define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +#define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +#define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 24 +#define __PTHREAD_RWLOCK_SHARED_OFFSET 28 +#define __PTHREAD_RWLOCK_FLAGS_OFFSET 48 diff --git a/sysdeps/alpha/nptl/pthread-offsets.h b/sysdeps/alpha/nptl/pthread-offsets.h index 16c6b0d..679cec5 100644 --- a/sysdeps/alpha/nptl/pthread-offsets.h +++ b/sysdeps/alpha/nptl/pthread-offsets.h @@ -3,3 +3,11 @@ #define __PTHREAD_MUTEX_SPINS_OFFSET 20 #define __PTHREAD_MUTEX_ELISION_OFFSET 22 #define __PTHREAD_MUTEX_LIST_OFFSET 24 + +#define __PTHREAD_RWLOCK_READERS_OFFSET 0 +#define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +#define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +#define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +#define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 24 +#define __PTHREAD_RWLOCK_SHARED_OFFSET 28 +#define __PTHREAD_RWLOCK_FLAGS_OFFSET 48 diff --git a/sysdeps/arm/nptl/pthread-offsets.h b/sysdeps/arm/nptl/pthread-offsets.h index 9617354..cc2a939 100644 --- a/sysdeps/arm/nptl/pthread-offsets.h +++ b/sysdeps/arm/nptl/pthread-offsets.h @@ -3,3 +3,16 @@ #define __PTHREAD_MUTEX_SPINS_OFFSET 20 #define __PTHREAD_MUTEX_ELISION_OFFSET 22 #define __PTHREAD_MUTEX_LIST_OFFSET 20 + +#define __PTHREAD_RWLOCK_READERS_OFFSET 0 +#define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +#define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +#define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +#define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 28 +#if __BYTE_ORDER == __BIG_ENDIAN +# define __PTHREAD_RWLOCK_SHARED_OFFSET 26 +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 27 +#else +# define __PTHREAD_RWLOCK_SHARED_OFFSET 25 +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 24 +#endif diff --git a/sysdeps/csky/nptl/pthread-offsets.h b/sysdeps/csky/nptl/pthread-offsets.h index 9617354..a0eea7a 100644 --- a/sysdeps/csky/nptl/pthread-offsets.h +++ b/sysdeps/csky/nptl/pthread-offsets.h @@ -3,3 +3,11 @@ #define __PTHREAD_MUTEX_SPINS_OFFSET 20 #define __PTHREAD_MUTEX_ELISION_OFFSET 22 #define __PTHREAD_MUTEX_LIST_OFFSET 20 + +#define __PTHREAD_RWLOCK_READERS_OFFSET 0 +#define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +#define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +#define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +#define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 28 +#define __PTHREAD_RWLOCK_SHARED_OFFSET 25 +#define __PTHREAD_RWLOCK_FLAGS_OFFSET 24 diff --git a/sysdeps/hppa/nptl/pthread-offsets.h b/sysdeps/hppa/nptl/pthread-offsets.h index 8ae01b9..f5d5b9e 100644 --- a/sysdeps/hppa/nptl/pthread-offsets.h +++ b/sysdeps/hppa/nptl/pthread-offsets.h @@ -3,3 +3,11 @@ #define __PTHREAD_MUTEX_SPINS_OFFSET 36 #define __PTHREAD_MUTEX_ELISION_OFFSET 22 #define __PTHREAD_MUTEX_LIST_OFFSET 36 + +#define __PTHREAD_RWLOCK_READERS_OFFSET 16 +#define __PTHREAD_RWLOCK_WRITERS_OFFSET 20 +#define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 24 +#define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 28 +#define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 40 +#define __PTHREAD_RWLOCK_SHARED_OFFSET 50 +#define __PTHREAD_RWLOCK_FLAGS_OFFSET 51 diff --git a/sysdeps/i386/nptl/pthread-offsets.h b/sysdeps/i386/nptl/pthread-offsets.h index 9617354..a0eea7a 100644 --- a/sysdeps/i386/nptl/pthread-offsets.h +++ b/sysdeps/i386/nptl/pthread-offsets.h @@ -3,3 +3,11 @@ #define __PTHREAD_MUTEX_SPINS_OFFSET 20 #define __PTHREAD_MUTEX_ELISION_OFFSET 22 #define __PTHREAD_MUTEX_LIST_OFFSET 20 + +#define __PTHREAD_RWLOCK_READERS_OFFSET 0 +#define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +#define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +#define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +#define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 28 +#define __PTHREAD_RWLOCK_SHARED_OFFSET 25 +#define __PTHREAD_RWLOCK_FLAGS_OFFSET 24 diff --git a/sysdeps/ia64/nptl/pthread-offsets.h b/sysdeps/ia64/nptl/pthread-offsets.h index 16c6b0d..679cec5 100644 --- a/sysdeps/ia64/nptl/pthread-offsets.h +++ b/sysdeps/ia64/nptl/pthread-offsets.h @@ -3,3 +3,11 @@ #define __PTHREAD_MUTEX_SPINS_OFFSET 20 #define __PTHREAD_MUTEX_ELISION_OFFSET 22 #define __PTHREAD_MUTEX_LIST_OFFSET 24 + +#define __PTHREAD_RWLOCK_READERS_OFFSET 0 +#define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +#define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +#define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +#define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 24 +#define __PTHREAD_RWLOCK_SHARED_OFFSET 28 +#define __PTHREAD_RWLOCK_FLAGS_OFFSET 48 diff --git a/sysdeps/m68k/nptl/pthread-offsets.h b/sysdeps/m68k/nptl/pthread-offsets.h index 9617354..14d66ac 100644 --- a/sysdeps/m68k/nptl/pthread-offsets.h +++ b/sysdeps/m68k/nptl/pthread-offsets.h @@ -3,3 +3,11 @@ #define __PTHREAD_MUTEX_SPINS_OFFSET 20 #define __PTHREAD_MUTEX_ELISION_OFFSET 22 #define __PTHREAD_MUTEX_LIST_OFFSET 20 + +#define __PTHREAD_RWLOCK_READERS_OFFSET 0 +#define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +#define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +#define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +#define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 28 +#define __PTHREAD_RWLOCK_SHARED_OFFSET 26 +#define __PTHREAD_RWLOCK_FLAGS_OFFSET 27 diff --git a/sysdeps/microblaze/nptl/pthread-offsets.h b/sysdeps/microblaze/nptl/pthread-offsets.h index 9617354..cc2a939 100644 --- a/sysdeps/microblaze/nptl/pthread-offsets.h +++ b/sysdeps/microblaze/nptl/pthread-offsets.h @@ -3,3 +3,16 @@ #define __PTHREAD_MUTEX_SPINS_OFFSET 20 #define __PTHREAD_MUTEX_ELISION_OFFSET 22 #define __PTHREAD_MUTEX_LIST_OFFSET 20 + +#define __PTHREAD_RWLOCK_READERS_OFFSET 0 +#define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +#define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +#define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +#define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 28 +#if __BYTE_ORDER == __BIG_ENDIAN +# define __PTHREAD_RWLOCK_SHARED_OFFSET 26 +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 27 +#else +# define __PTHREAD_RWLOCK_SHARED_OFFSET 25 +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 24 +#endif diff --git a/sysdeps/mips/nptl/pthread-offsets.h b/sysdeps/mips/nptl/pthread-offsets.h index 0ac3eda..cf96b88 100644 --- a/sysdeps/mips/nptl/pthread-offsets.h +++ b/sysdeps/mips/nptl/pthread-offsets.h @@ -11,3 +11,26 @@ # define __PTHREAD_MUTEX_ELISION_OFFSET 22 # define __PTHREAD_MUTEX_LIST_OFFSET 20 #endif + +#if _MIPS_SIM == _ABI64 +# define __PTHREAD_RWLOCK_READERS_OFFSET 0 +# define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +# define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +# define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +# define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 24 +# define __PTHREAD_RWLOCK_SHARED_OFFSET 28 +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 48 +#else +# define __PTHREAD_RWLOCK_READERS_OFFSET 0 +# define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +# define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +# define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +# define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 28 +# if __BYTE_ORDER == __BIG_ENDIAN +# define __PTHREAD_RWLOCK_SHARED_OFFSET 26 +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 27 +# else +# define __PTHREAD_RWLOCK_SHARED_OFFSET 25 +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 24 +# endif +#endif diff --git a/sysdeps/nios2/nptl/pthread-offsets.h b/sysdeps/nios2/nptl/pthread-offsets.h index 9617354..a0eea7a 100644 --- a/sysdeps/nios2/nptl/pthread-offsets.h +++ b/sysdeps/nios2/nptl/pthread-offsets.h @@ -3,3 +3,11 @@ #define __PTHREAD_MUTEX_SPINS_OFFSET 20 #define __PTHREAD_MUTEX_ELISION_OFFSET 22 #define __PTHREAD_MUTEX_LIST_OFFSET 20 + +#define __PTHREAD_RWLOCK_READERS_OFFSET 0 +#define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +#define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +#define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +#define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 28 +#define __PTHREAD_RWLOCK_SHARED_OFFSET 25 +#define __PTHREAD_RWLOCK_FLAGS_OFFSET 24 diff --git a/sysdeps/powerpc/nptl/pthread-offsets.h b/sysdeps/powerpc/nptl/pthread-offsets.h index bdda1f1..a9ce40d 100644 --- a/sysdeps/powerpc/nptl/pthread-offsets.h +++ b/sysdeps/powerpc/nptl/pthread-offsets.h @@ -13,3 +13,21 @@ # define __PTHREAD_MUTEX_ELISION_OFFSET 22 # define __PTHREAD_MUTEX_LIST_OFFSET 20 #endif + +#if __WORDSIZE == 64 +# define __PTHREAD_RWLOCK_READERS_OFFSET 0 +# define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +# define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +# define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +# define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 24 +# define __PTHREAD_RWLOCK_SHARED_OFFSET 28 +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 48 +#else +# define __PTHREAD_RWLOCK_READERS_OFFSET 0 +# define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +# define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +# define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +# define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 28 +# define __PTHREAD_RWLOCK_SHARED_OFFSET 26 +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 27 +#endif diff --git a/sysdeps/riscv/nptl/pthread-offsets.h b/sysdeps/riscv/nptl/pthread-offsets.h index f164004..f93af00 100644 --- a/sysdeps/riscv/nptl/pthread-offsets.h +++ b/sysdeps/riscv/nptl/pthread-offsets.h @@ -22,3 +22,11 @@ #define __PTHREAD_MUTEX_SPINS_OFFSET 20 #define __PTHREAD_MUTEX_ELISION_OFFSET 22 #define __PTHREAD_MUTEX_LIST_OFFSET 24 + +#define __PTHREAD_RWLOCK_READERS_OFFSET 0 +#define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +#define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +#define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +#define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 24 +#define __PTHREAD_RWLOCK_SHARED_OFFSET 28 +#define __PTHREAD_RWLOCK_FLAGS_OFFSET 48 diff --git a/sysdeps/s390/nptl/pthread-offsets.h b/sysdeps/s390/nptl/pthread-offsets.h index bdda1f1..a9ce40d 100644 --- a/sysdeps/s390/nptl/pthread-offsets.h +++ b/sysdeps/s390/nptl/pthread-offsets.h @@ -13,3 +13,21 @@ # define __PTHREAD_MUTEX_ELISION_OFFSET 22 # define __PTHREAD_MUTEX_LIST_OFFSET 20 #endif + +#if __WORDSIZE == 64 +# define __PTHREAD_RWLOCK_READERS_OFFSET 0 +# define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +# define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +# define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +# define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 24 +# define __PTHREAD_RWLOCK_SHARED_OFFSET 28 +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 48 +#else +# define __PTHREAD_RWLOCK_READERS_OFFSET 0 +# define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +# define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +# define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +# define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 28 +# define __PTHREAD_RWLOCK_SHARED_OFFSET 26 +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 27 +#endif diff --git a/sysdeps/sh/nptl/pthread-offsets.h b/sysdeps/sh/nptl/pthread-offsets.h index 9617354..cc2a939 100644 --- a/sysdeps/sh/nptl/pthread-offsets.h +++ b/sysdeps/sh/nptl/pthread-offsets.h @@ -3,3 +3,16 @@ #define __PTHREAD_MUTEX_SPINS_OFFSET 20 #define __PTHREAD_MUTEX_ELISION_OFFSET 22 #define __PTHREAD_MUTEX_LIST_OFFSET 20 + +#define __PTHREAD_RWLOCK_READERS_OFFSET 0 +#define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +#define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +#define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +#define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 28 +#if __BYTE_ORDER == __BIG_ENDIAN +# define __PTHREAD_RWLOCK_SHARED_OFFSET 26 +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 27 +#else +# define __PTHREAD_RWLOCK_SHARED_OFFSET 25 +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 24 +#endif diff --git a/sysdeps/sparc/nptl/pthread-offsets.h b/sysdeps/sparc/nptl/pthread-offsets.h index bdda1f1..a9ce40d 100644 --- a/sysdeps/sparc/nptl/pthread-offsets.h +++ b/sysdeps/sparc/nptl/pthread-offsets.h @@ -13,3 +13,21 @@ # define __PTHREAD_MUTEX_ELISION_OFFSET 22 # define __PTHREAD_MUTEX_LIST_OFFSET 20 #endif + +#if __WORDSIZE == 64 +# define __PTHREAD_RWLOCK_READERS_OFFSET 0 +# define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +# define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +# define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +# define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 24 +# define __PTHREAD_RWLOCK_SHARED_OFFSET 28 +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 48 +#else +# define __PTHREAD_RWLOCK_READERS_OFFSET 0 +# define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +# define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +# define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +# define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 28 +# define __PTHREAD_RWLOCK_SHARED_OFFSET 26 +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 27 +#endif diff --git a/sysdeps/x86_64/nptl/pthread-offsets.h b/sysdeps/x86_64/nptl/pthread-offsets.h index 16c6b0d..5c0cab0 100644 --- a/sysdeps/x86_64/nptl/pthread-offsets.h +++ b/sysdeps/x86_64/nptl/pthread-offsets.h @@ -3,3 +3,15 @@ #define __PTHREAD_MUTEX_SPINS_OFFSET 20 #define __PTHREAD_MUTEX_ELISION_OFFSET 22 #define __PTHREAD_MUTEX_LIST_OFFSET 24 + +#define __PTHREAD_RWLOCK_READERS_OFFSET 0 +#define __PTHREAD_RWLOCK_WRITERS_OFFSET 4 +#define __PTHREAD_RWLOCK_WRPHASE_FUTEX_OFFSET 8 +#define __PTHREAD_RWLOCK_WRITERS_FUTEX_OFFSET 12 +#define __PTHREAD_RWLOCK_CUR_WRITER_OFFSET 24 +#define __PTHREAD_RWLOCK_SHARED_OFFSET 28 +#ifdef __ILP32__ +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 40 +#else +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 48 +#endif