public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix NPTL x86-64 headers for -m32 compilation
Date: Mon, 30 Aug 2004 09:19:00 -0000	[thread overview]
Message-ID: <20040830070111.GB30497@sunsite.ms.mff.cuni.cz> (raw)

Hi!

Seems compiling against NPTL pthread.h/semaphore.h on x86-64 with
-m32 doesn't DTRT.

2004-08-30  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h: Include
	bits/wordsize.h.  Make the header match i386 header when __WORDSIZE
	!= 64.
	* sysdeps/unix/sysv/linux/x86_64/bits/semaphore.h: Likewise.

--- libc/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h.jj	2004-06-11 14:45:54.000000000 +0200
+++ libc/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h	2004-08-30 11:11:48.883542018 +0200
@@ -20,15 +20,29 @@
 #ifndef _BITS_PTHREADTYPES_H
 #define _BITS_PTHREADTYPES_H	1
 
-#define __SIZEOF_PTHREAD_ATTR_T 56
-#define __SIZEOF_PTHREAD_MUTEX_T 40
-#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-#define __SIZEOF_PTHREAD_COND_T 48
-#define __SIZEOF_PTHREAD_CONDATTR_T 4
-#define __SIZEOF_PTHREAD_RWLOCK_T 56
-#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
-#define __SIZEOF_PTHREAD_BARRIER_T 32
-#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+# define __SIZEOF_PTHREAD_ATTR_T 56
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+# define __SIZEOF_PTHREAD_COND_T 48
+# define __SIZEOF_PTHREAD_CONDATTR_T 4
+# define __SIZEOF_PTHREAD_RWLOCK_T 56
+# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+# define __SIZEOF_PTHREAD_BARRIER_T 32
+# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+#else
+# define __SIZEOF_PTHREAD_ATTR_T 36
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+# define __SIZEOF_PTHREAD_COND_T 48
+# define __SIZEOF_PTHREAD_CONDATTR_T 4
+# define __SIZEOF_PTHREAD_RWLOCK_T 32
+# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+# define __SIZEOF_PTHREAD_BARRIER_T 20
+# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+#endif
 
 
 /* Thread identifiers.  The structure of the attribute type is not
@@ -52,10 +66,15 @@ typedef union
     int __lock;
     unsigned int __count;
     int __owner;
+#if __WORDSIZE == 64
     unsigned int __nusers;
+#endif
     /* KIND must stay at this position in the structure to maintain
        binary compatibility.  */
     int __kind;
+#if __WORDSIZE != 64
+    unsigned int __nusers;
+#endif
     int __spins;
   } __data;
   char __size[__SIZEOF_PTHREAD_MUTEX_T];
@@ -85,7 +104,7 @@ typedef union
     unsigned int __broadcast_seq;
   } __data;
   char __size[__SIZEOF_PTHREAD_COND_T];
-  long int __align;
+  long long int __align;
 } pthread_cond_t;
 
 typedef union
@@ -108,6 +127,7 @@ typedef int pthread_once_t;
    structure of the attribute type is not exposed on purpose.  */
 typedef union
 {
+# if __WORDSIZE == 64
   struct
   {
     int __lock;
@@ -124,6 +144,21 @@ typedef union
        binary compatibility.  */
     unsigned int __flags;
   } __data;
+# else
+  struct
+  {
+    int __lock;
+    unsigned int __nr_readers;
+    unsigned int __readers_wakeup;
+    unsigned int __writer_wakeup;
+    unsigned int __nr_readers_queued;
+    unsigned int __nr_writers_queued;
+    /* FLAGS must stay at this position in the structure to maintain
+       binary compatibility.  */
+    unsigned int __flags;
+    int __writer;
+  } __data;
+# endif
   char __size[__SIZEOF_PTHREAD_RWLOCK_T];
   long int __align;
 } pthread_rwlock_t;
--- libc/nptl/sysdeps/unix/sysv/linux/x86_64/bits/semaphore.h.jj	2004-04-20 19:03:26.000000000 +0200
+++ libc/nptl/sysdeps/unix/sysv/linux/x86_64/bits/semaphore.h	2004-08-30 11:05:13.377347474 +0200
@@ -21,8 +21,13 @@
 # error "Never use <bits/semaphore.h> directly; include <semaphore.h> instead."
 #endif
 
+#include <bits/wordsize.h>
 
-#define __SIZEOF_SEM_T	32
+#if __WORDSIZE == 64
+# define __SIZEOF_SEM_T	32
+#else
+# define __SIZEOF_SEM_T	16
+#endif
 
 
 /* Value returned if `sem_open' failed.  */

	Jakub

             reply	other threads:[~2004-08-30  9:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-30  9:19 Jakub Jelinek [this message]
2004-08-30 16:51 ` Ulrich Drepper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040830070111.GB30497@sunsite.ms.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).