components/gcc47/patches/003-libgomp-omp_h-multilib.patch
author Stefan Teleman <stefan.teleman@oracle.com>
Wed, 07 Aug 2013 11:25:39 -0700
branchs11-update
changeset 2720 ce63a14b34c3
permissions -rw-r--r--
15823988 SUNBT7205673-12.0 Upgrade GCC to >= 4.7.2

# 2013-02-07  Stefan Teleman <[email protected]>
# Not everything aligns on 4.
#
#	* Fix Solaris alignment. (st)
#
--- gcc-4.7.3/libgomp/omp.h.in	2011-08-02 09:13:29.000000000 -0700
+++ gcc-4.7.3/libgomp/omp.h.in	2013-03-02 12:54:41.720505107 -0800
@@ -31,16 +31,24 @@
    reflect the shape of the two types.  Their internals are private
    to the library.  */
 
+#if defined(__x86__64__) || defined(__amd64) || defined(__sparc)
+#define OMP_LOCK_ALIGN 8
+#define OMP_NEST_LOCK_ALIGN 8
+#else
+#define OMP_LOCK_ALIGN 4
+#define OMP_NEST_LOCK_ALIGN 4
+#endif
+
 typedef struct
 {
   unsigned char _x[@OMP_LOCK_SIZE@] 
-    __attribute__((__aligned__(@OMP_LOCK_ALIGN@)));
+    __attribute__((__aligned__(OMP_LOCK_ALIGN)));
 } omp_lock_t;
 
 typedef struct
 {
   unsigned char _x[@OMP_NEST_LOCK_SIZE@] 
-    __attribute__((__aligned__(@OMP_NEST_LOCK_ALIGN@)));
+    __attribute__((__aligned__(OMP_NEST_LOCK_ALIGN)));
 } omp_nest_lock_t;
 #endif
 
--- gcc-4.7.3/libgomp/config/posix/omp-lock.h	2008-06-06 09:01:54.000000000 -0400
+++ gcc-4.7.3/libgomp/config/posix/omp-lock.h	2013-02-25 14:11:24.930553496 -0500
@@ -11,12 +11,19 @@
 #include <semaphore.h>
 
 typedef pthread_mutex_t omp_lock_25_t;
-typedef struct { pthread_mutex_t lock; int count; } omp_nest_lock_25_t;
+typedef struct {
+  pthread_mutex_t lock __attribute__((__aligned__(8)));
+  int count;
+} omp_nest_lock_25_t __attribute__((__aligned__(8)));
 #ifdef HAVE_BROKEN_POSIX_SEMAPHORES
 /* If we don't have working semaphores, we'll make all explicit tasks
    tied to the creating thread.  */
 typedef pthread_mutex_t omp_lock_t;
-typedef struct { pthread_mutex_t lock; int count; void *owner; } omp_nest_lock_t;
+typedef struct {
+  pthread_mutex_t lock __attribute__((__aligned__(8)));
+  int count;
+  void *owner;
+} omp_nest_lock_t __attribute__((__aligned__(8)));
 #else
 typedef sem_t omp_lock_t;
 typedef struct { sem_t lock; int count; void *owner; } omp_nest_lock_t;

--- gcc-4.7.3/libgomp/config/posix/ptrlock.h	2009-04-09 11:00:19.000000000 -0400
+++ gcc-4.7.3/libgomp/config/posix/ptrlock.h	2013-02-25 14:17:24.458008326 -0500
@@ -29,7 +29,10 @@
 #ifndef GOMP_PTRLOCK_H
 #define GOMP_PTRLOCK_H 1
 
-typedef struct { void *ptr; gomp_mutex_t lock; } gomp_ptrlock_t;
+typedef struct {
+  gomp_mutex_t lock __attribute__((__aligned__(8)));
+  void *ptr;
+} gomp_ptrlock_t __attribute__((__aligned__(8)));
 
 static inline void gomp_ptrlock_init (gomp_ptrlock_t *ptrlock, void *ptr)
 {

--- gcc-4.7.3/libgomp/config/posix/sem.h	2009-04-09 11:00:19.000000000 -0400
+++ gcc-4.7.3/libgomp/config/posix/sem.h	2013-02-25 14:12:48.361516225 -0500
@@ -48,10 +48,10 @@
 
 struct gomp_sem
 {
-  pthread_mutex_t	mutex;
-  pthread_cond_t	cond;
+  pthread_mutex_t	mutex __attribute__((__aligned__(8)));
+  pthread_cond_t	cond __attribute__((__aligned__(8)));
   int			value;
-};
+} __attribute__((__aligned__(8)));
 
 typedef struct gomp_sem gomp_sem_t;
 
@@ -85,3 +85,4 @@
 }
 #endif /* doesn't HAVE_BROKEN_POSIX_SEMAPHORES  */
 #endif /* GOMP_SEM_H  */
+

--- gcc-4.7.3/libgomp/Makefile.in	2012-09-20 00:23:55.000000000 -0700
+++ gcc-4.7.3/libgomp/Makefile.in	2013-03-01 06:29:56.402569714 -0800
@@ -177,7 +177,7 @@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
+LIBS = -lrt -lc -lm
 LIBTOOL = @LIBTOOL@
 LIPO = @LIPO@
 LN_S = @LN_S@

--- gcc-4.7.3/libgomp/testsuite/lib/libgomp.exp	2011-07-28 13:35:32.000000000 -0700
+++ gcc-4.7.3/libgomp/testsuite/lib/libgomp.exp	2013-03-02 07:44:50.147571956 -0800
@@ -141,7 +141,7 @@
     # We use atomic operations in the testcases to validate results.
     if { ([istarget i?86-*-*] || [istarget x86_64-*-*])
 	 && [check_effective_target_ia32] } {
-	lappend ALWAYS_CFLAGS "additional_flags=-march=i486"
+	lappend ALWAYS_CFLAGS "additional_flags=-march=pentium4"
     }
 
     if [istarget *-*-darwin*] {