about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-03-12 14:43:36 -0400
committerRich Felker <dalias@aerifal.cx>2015-03-12 14:43:36 -0400
commit673cab5c56f6b6a8afb01c4b5341963ff259e996 (patch)
tree57c3de54cb6887e4290af8de8dfd781e1e75121f
parent01ef3dd9c5fa7a56aa370f244dd08e05c73010f5 (diff)
downloadmusl-673cab5c56f6b6a8afb01c4b5341963ff259e996.tar.gz
musl-673cab5c56f6b6a8afb01c4b5341963ff259e996.tar.xz
musl-673cab5c56f6b6a8afb01c4b5341963ff259e996.zip
align x32 pthread type sizes to be common with 32-bit archs
previously, commit e7b9887e8b65253087ab0b209dc8dd85c9f09614 aligned
the sizes with the glibc ABI. subsequent discussion during the merge
of the aarch64 port reached a conclusion that we should reject larger
arch-specific sizes, which have significant cost and no benefit, and
stick with the existing common 32-bit sizes for all 32-bit/ILP32 archs
and the x86_64 sizes for 64-bit archs.

one peculiarity of this change is that x32 pthread_attr_t is now
larger in musl than in the glibc x32 ABI, making it unsafe to call
pthread_attr_init from x32 code that was compiled against glibc. with
all the ABI issues of x32, it's not clear that ABI compatibility will
ever work, but if it's needed, pthread_attr_init and related functions
could be modified not to write to the last slot of the object.

this is not a regression versus previous releases, since on previous
releases the x32 pthread type sizes were all severely oversized
already (due to incorrectly using the x86_64 LP64 definitions).
moreover, x32 is still considered experimental and not ABI-stable.
-rw-r--r--arch/x32/bits/alltypes.h.in8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/x32/bits/alltypes.h.in b/arch/x32/bits/alltypes.h.in
index 4f218817..16391295 100644
--- a/arch/x32/bits/alltypes.h.in
+++ b/arch/x32/bits/alltypes.h.in
@@ -22,10 +22,10 @@ TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
 TYPEDEF long long time_t;
 TYPEDEF long long suseconds_t;
 
-TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; unsigned long __s[8]; } __u; } pthread_attr_t;
-TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; volatile void *volatile __p[8]; } __u; } pthread_mutex_t;
-TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; volatile void *volatile __p[8]; } __u; } mtx_t;
+TYPEDEF struct { union { int __i[9]; volatile int __vi[9]; unsigned __s[9]; } __u; } pthread_attr_t;
+TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
+TYPEDEF struct { union { int __i[6]; volatile int __vi[6]; volatile void *volatile __p[6]; } __u; } mtx_t;
 TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } pthread_cond_t;
 TYPEDEF struct { union { int __i[12]; volatile int __vi[12]; void *__p[12]; } __u; } cnd_t;
-TYPEDEF struct { union { int __i[11]; volatile int __vi[11]; void *__p[11]; } __u; } pthread_rwlock_t;
+TYPEDEF struct { union { int __i[8]; volatile int __vi[8]; void *__p[8]; } __u; } pthread_rwlock_t;
 TYPEDEF struct { union { int __i[5]; volatile int __vi[5]; void *__p[5]; } __u; } pthread_barrier_t;