components/gcc47/patches/003-libgomp-omp_h-multilib.patch
changeset 1414 9eeb516d9fdd
equal deleted inserted replaced
1413:5993f361061f 1414:9eeb516d9fdd
       
     1 # 2013-02-07  Stefan Teleman <[email protected]>
       
     2 # Not everything aligns on 4.
       
     3 #
       
     4 #	* Fix Solaris alignment. (st)
       
     5 #
       
     6 --- gcc-4.7.3/libgomp/omp.h.in	2011-08-02 09:13:29.000000000 -0700
       
     7 +++ gcc-4.7.3/libgomp/omp.h.in	2013-03-02 12:54:41.720505107 -0800
       
     8 @@ -31,16 +31,24 @@
       
     9     reflect the shape of the two types.  Their internals are private
       
    10     to the library.  */
       
    11  
       
    12 +#if defined(__x86__64__) || defined(__amd64) || defined(__sparc)
       
    13 +#define OMP_LOCK_ALIGN 8
       
    14 +#define OMP_NEST_LOCK_ALIGN 8
       
    15 +#else
       
    16 +#define OMP_LOCK_ALIGN 4
       
    17 +#define OMP_NEST_LOCK_ALIGN 4
       
    18 +#endif
       
    19 +
       
    20  typedef struct
       
    21  {
       
    22    unsigned char _x[@OMP_LOCK_SIZE@] 
       
    23 -    __attribute__((__aligned__(@OMP_LOCK_ALIGN@)));
       
    24 +    __attribute__((__aligned__(OMP_LOCK_ALIGN)));
       
    25  } omp_lock_t;
       
    26  
       
    27  typedef struct
       
    28  {
       
    29    unsigned char _x[@OMP_NEST_LOCK_SIZE@] 
       
    30 -    __attribute__((__aligned__(@OMP_NEST_LOCK_ALIGN@)));
       
    31 +    __attribute__((__aligned__(OMP_NEST_LOCK_ALIGN)));
       
    32  } omp_nest_lock_t;
       
    33  #endif
       
    34  
       
    35 --- gcc-4.7.3/libgomp/config/posix/omp-lock.h	2008-06-06 09:01:54.000000000 -0400
       
    36 +++ gcc-4.7.3/libgomp/config/posix/omp-lock.h	2013-02-25 14:11:24.930553496 -0500
       
    37 @@ -11,12 +11,19 @@
       
    38  #include <semaphore.h>
       
    39  
       
    40  typedef pthread_mutex_t omp_lock_25_t;
       
    41 -typedef struct { pthread_mutex_t lock; int count; } omp_nest_lock_25_t;
       
    42 +typedef struct {
       
    43 +  pthread_mutex_t lock __attribute__((__aligned__(8)));
       
    44 +  int count;
       
    45 +} omp_nest_lock_25_t __attribute__((__aligned__(8)));
       
    46  #ifdef HAVE_BROKEN_POSIX_SEMAPHORES
       
    47  /* If we don't have working semaphores, we'll make all explicit tasks
       
    48     tied to the creating thread.  */
       
    49  typedef pthread_mutex_t omp_lock_t;
       
    50 -typedef struct { pthread_mutex_t lock; int count; void *owner; } omp_nest_lock_t;
       
    51 +typedef struct {
       
    52 +  pthread_mutex_t lock __attribute__((__aligned__(8)));
       
    53 +  int count;
       
    54 +  void *owner;
       
    55 +} omp_nest_lock_t __attribute__((__aligned__(8)));
       
    56  #else
       
    57  typedef sem_t omp_lock_t;
       
    58  typedef struct { sem_t lock; int count; void *owner; } omp_nest_lock_t;
       
    59 
       
    60 --- gcc-4.7.3/libgomp/config/posix/ptrlock.h	2009-04-09 11:00:19.000000000 -0400
       
    61 +++ gcc-4.7.3/libgomp/config/posix/ptrlock.h	2013-02-25 14:17:24.458008326 -0500
       
    62 @@ -29,7 +29,10 @@
       
    63  #ifndef GOMP_PTRLOCK_H
       
    64  #define GOMP_PTRLOCK_H 1
       
    65  
       
    66 -typedef struct { void *ptr; gomp_mutex_t lock; } gomp_ptrlock_t;
       
    67 +typedef struct {
       
    68 +  gomp_mutex_t lock __attribute__((__aligned__(8)));
       
    69 +  void *ptr;
       
    70 +} gomp_ptrlock_t __attribute__((__aligned__(8)));
       
    71  
       
    72  static inline void gomp_ptrlock_init (gomp_ptrlock_t *ptrlock, void *ptr)
       
    73  {
       
    74 
       
    75 --- gcc-4.7.3/libgomp/config/posix/sem.h	2009-04-09 11:00:19.000000000 -0400
       
    76 +++ gcc-4.7.3/libgomp/config/posix/sem.h	2013-02-25 14:12:48.361516225 -0500
       
    77 @@ -48,10 +48,10 @@
       
    78  
       
    79  struct gomp_sem
       
    80  {
       
    81 -  pthread_mutex_t	mutex;
       
    82 -  pthread_cond_t	cond;
       
    83 +  pthread_mutex_t	mutex __attribute__((__aligned__(8)));
       
    84 +  pthread_cond_t	cond __attribute__((__aligned__(8)));
       
    85    int			value;
       
    86 -};
       
    87 +} __attribute__((__aligned__(8)));
       
    88  
       
    89  typedef struct gomp_sem gomp_sem_t;
       
    90  
       
    91 @@ -85,3 +85,4 @@
       
    92  }
       
    93  #endif /* doesn't HAVE_BROKEN_POSIX_SEMAPHORES  */
       
    94  #endif /* GOMP_SEM_H  */
       
    95 +
       
    96 
       
    97 --- gcc-4.7.3/libgomp/Makefile.in	2012-09-20 00:23:55.000000000 -0700
       
    98 +++ gcc-4.7.3/libgomp/Makefile.in	2013-03-01 06:29:56.402569714 -0800
       
    99 @@ -177,7 +177,7 @@
       
   100  LD = @LD@
       
   101  LDFLAGS = @LDFLAGS@
       
   102  LIBOBJS = @LIBOBJS@
       
   103 -LIBS = @LIBS@
       
   104 +LIBS = -lrt -lc -lm
       
   105  LIBTOOL = @LIBTOOL@
       
   106  LIPO = @LIPO@
       
   107  LN_S = @LN_S@
       
   108 
       
   109 --- gcc-4.7.3/libgomp/testsuite/lib/libgomp.exp	2011-07-28 13:35:32.000000000 -0700
       
   110 +++ gcc-4.7.3/libgomp/testsuite/lib/libgomp.exp	2013-03-02 07:44:50.147571956 -0800
       
   111 @@ -141,7 +141,7 @@
       
   112      # We use atomic operations in the testcases to validate results.
       
   113      if { ([istarget i?86-*-*] || [istarget x86_64-*-*])
       
   114  	 && [check_effective_target_ia32] } {
       
   115 -	lappend ALWAYS_CFLAGS "additional_flags=-march=i486"
       
   116 +	lappend ALWAYS_CFLAGS "additional_flags=-march=pentium4"
       
   117      }
       
   118  
       
   119      if [istarget *-*-darwin*] {