hppa: Drop 16-byte pthread lock alignment
authorJohn David Anglin <danglin@gcc.gnu.org>
Sun, 26 Mar 2023 21:16:22 +0000 (21:16 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Sun, 26 Mar 2023 21:16:22 +0000 (21:16 +0000)
Linux threads were removed about 12 years ago and the current
nptl implementation only requires 4-byte alignment for pthread
locks.

The 16-byte alignment causes various issues. For example in
building ignition-msgs, we have:

/usr/include/google/protobuf/map.h:124:37: error: static assertion failed
  124 |   static_assert(alignof(value_type) <= 8, "");
      |                 ~~~~~~~~~~~~~~~~~~~~^~~~

This is caused by the 16-byte pthread lock alignment.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
sysdeps/hppa/nptl/bits/struct_rwlock.h

index 999195c5b06dd52462be80946e3d1f72f98a4c5b..c1a46d66d0f9fa1d403baed438328ab0a5a0c2eb 100644 (file)
@@ -40,7 +40,7 @@
 #define __SIZEOF_PTHREAD_RWLOCK_T 64
 #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
 
-#define __LOCK_ALIGNMENT __attribute__ ((__aligned__(16)))
+#define __LOCK_ALIGNMENT
 #define __ONCE_ALIGNMENT
 
 #endif /* bits/pthreadtypes.h */
index e83b4aab5281ace4aad30bd79ebb62aef428f960..59bc9fe76ff52c1d5538d66d03e93dccdb97ee7e 100644 (file)
@@ -25,8 +25,14 @@ struct __pthread_rwlock_arch_t
   /* In the old Linuxthreads pthread_rwlock_t, this is the
      start of the 4-word 16-byte aligned lock structure. The
      next four words are all set to 1 by the Linuxthreads
-     PTHREAD_RWLOCK_INITIALIZER. We ignore them in NPTL.  */
-  int __compat_padding[4] __attribute__ ((__aligned__(16)));
+     PTHREAD_RWLOCK_INITIALIZER. We ignore them in NPTL.
+
+     The 16-byte aligned lock stucture causes various pthread
+     structures to be over aligned. This causes some builds
+     to fail which assume a maximum alignment of 8 bytes.
+     Linuxthreads has been removed for 12 years, so drop
+     alignment of lock structure.  */
+  int __compat_padding[4];
   unsigned int __readers;
   unsigned int __writers;
   unsigned int __wrphase_futex;