about summary refs log tree commit diff
path: root/sysdeps/riscv/nptl/bits/struct_rwlock.h
diff options
context:
space:
mode:
authorAlistair Francis <alistair.francis@wdc.com>2020-02-10 10:36:21 -0800
committerAlistair Francis <alistair.francis@wdc.com>2020-08-27 08:17:42 -0700
commit5b6113d62efabb123db433b14adddd4a5fb6b7ec (patch)
tree1959bde3e74c6e491bbce89f0f8e1806647c9225 /sysdeps/riscv/nptl/bits/struct_rwlock.h
parent07598d76006faec6c60a9d86bda44dcb81b3a743 (diff)
downloadglibc-5b6113d62efabb123db433b14adddd4a5fb6b7ec.tar.gz
glibc-5b6113d62efabb123db433b14adddd4a5fb6b7ec.tar.xz
glibc-5b6113d62efabb123db433b14adddd4a5fb6b7ec.zip
RISC-V: Support the 32-bit ABI implementation
This patch adds the ABI implementation for 32-bit RISC-V.  It contains
the Linux-specific and RISC-V architecture code.

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>
Diffstat (limited to 'sysdeps/riscv/nptl/bits/struct_rwlock.h')
-rw-r--r--sysdeps/riscv/nptl/bits/struct_rwlock.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/sysdeps/riscv/nptl/bits/struct_rwlock.h b/sysdeps/riscv/nptl/bits/struct_rwlock.h
index acfaa75e1b..dc467d42c7 100644
--- a/sysdeps/riscv/nptl/bits/struct_rwlock.h
+++ b/sysdeps/riscv/nptl/bits/struct_rwlock.h
@@ -15,7 +15,7 @@
 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
+   <https://www.gnu.org/licenses/>.  */
 
 #ifndef _RWLOCK_INTERNAL_H
 #define _RWLOCK_INTERNAL_H
@@ -32,14 +32,37 @@ struct __pthread_rwlock_arch_t
   unsigned int __writers_futex;
   unsigned int __pad3;
   unsigned int __pad4;
+#if __WORDSIZE == 64
   int __cur_writer;
   int __shared;
   unsigned long int __pad1;
   unsigned long int __pad2;
   unsigned int __flags;
+#else
+# if __BYTE_ORDER == __BIG_ENDIAN
+  unsigned char __pad1;
+  unsigned char __pad2;
+  unsigned char __shared;
+  unsigned char __flags;
+# else
+  unsigned char __flags;
+  unsigned char __shared;
+  unsigned char __pad1;
+  unsigned char __pad2;
+# endif
+  int __cur_writer;
+#endif
 };
 
-#define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
+#if __WORDSIZE == 64
+# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags
+#elif __BYTE_ORDER == __BIG_ENDIAN
+# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
+  0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0
+#else
+# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
+  0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0
+#endif
 
 #endif