summaryrefslogtreecommitdiff
path: root/gcc/gthr-vxworks.h
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-22 10:53:53 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-22 10:53:53 +0000
commit00159b450c7ac462d5dbd5aa66a56651c977e86d (patch)
treee11dcde40e7283e50e32e96ee6676f534174b607 /gcc/gthr-vxworks.h
parenta3fd2a2bf8c17444c86cdb22de3e88c68e410ec5 (diff)
downloadgcc-00159b450c7ac462d5dbd5aa66a56651c977e86d.tar.gz
* gthr-vxworks.h (struct __gthread_once_t): Add alignment and
padding for PPC. (__GTHREAD_ONCE_INIT): Adjust ppc initializer. * config/vxlib.c (__gthread_once): Add race guard for PPC. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146566 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gthr-vxworks.h')
-rw-r--r--gcc/gthr-vxworks.h23
1 files changed, 19 insertions, 4 deletions
diff --git a/gcc/gthr-vxworks.h b/gcc/gthr-vxworks.h
index c2fb8e6729f..dee15731f0a 100644
--- a/gcc/gthr-vxworks.h
+++ b/gcc/gthr-vxworks.h
@@ -115,17 +115,32 @@ __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
typedef struct
{
-#ifndef __RTP__
+#if !defined(__RTP__)
+#if defined(__PPC__)
+ __attribute ((aligned (__alignof (unsigned))))
+#endif
volatile unsigned char busy;
#endif
volatile unsigned char done;
+#if !defined(__RTP__) && defined(__PPC__)
+ /* PPC's test-and-set implementation requires a 4 byte aligned
+ object, of which it only sets the first byte. We use padding
+ here, in order to maintain some amount of backwards
+ compatibility. Without this padding, gthread_once objects worked
+ by accident because they happen to be static objects and the ppc
+ port automatically increased their alignment to 4 bytes. */
+ unsigned char pad1;
+ unsigned char pad2;
+#endif
}
__gthread_once_t;
-#ifndef __RTP__
-# define __GTHREAD_ONCE_INIT { 0, 0 }
-#else
+#if defined (__RTP__)
# define __GTHREAD_ONCE_INIT { 0 }
+#elif defined (__PPC__)
+# define __GTHREAD_ONCE_INIT { 0, 0, 0, 0 }
+#else
+# define __GTHREAD_ONCE_INIT { 0, 0 }
#endif
extern int __gthread_once (__gthread_once_t *__once, void (*__func)(void));