components/gcc4/patches/004-alignment.patch
changeset 6923 338aea22bf22
equal deleted inserted replaced
6922:499ba999c1ee 6923:338aea22bf22
       
     1 #
       
     2 # Make a few alignment adjustments for sparc.  This has not been
       
     3 # submitted upstream yet.
       
     4 #
       
     5 --- gcc-5.3.0/libgomp/config/posix/omp-lock.h	2008-06-06 09:01:54.000000000 -0400
       
     6 +++ gcc-5.3.0/libgomp/config/posix/omp-lock.h	2014-11-19 08:34:08.522303786 -0500
       
     7 @@ -11,13 +11,28 @@
       
     8  #include <semaphore.h>
       
     9  
       
    10  typedef pthread_mutex_t omp_lock_25_t;
       
    11 -typedef struct { pthread_mutex_t lock; int count; } omp_nest_lock_25_t;
       
    12 +
       
    13 +typedef struct {
       
    14 +  pthread_mutex_t lock;
       
    15 +  int count;
       
    16 +} omp_nest_lock_25_t __attribute__((__aligned__(8)));
       
    17 +
       
    18  #ifdef HAVE_BROKEN_POSIX_SEMAPHORES
       
    19  /* If we don't have working semaphores, we'll make all explicit tasks
       
    20     tied to the creating thread.  */
       
    21  typedef pthread_mutex_t omp_lock_t;
       
    22 -typedef struct { pthread_mutex_t lock; int count; void *owner; } omp_nest_lock_t;
       
    23 +
       
    24 +typedef struct {
       
    25 +  pthread_mutex_t lock;
       
    26 +  int count;
       
    27 +  void *owner;
       
    28 +} omp_nest_lock_t __attribute__((__aligned__(8)));
       
    29  #else
       
    30  typedef sem_t omp_lock_t;
       
    31 -typedef struct { sem_t lock; int count; void *owner; } omp_nest_lock_t;
       
    32 +typedef struct {
       
    33 +  sem_t lock;
       
    34 +  int count;
       
    35 +  void *owner;
       
    36 +} omp_nest_lock_t __attribute__((__aligned__(8)));
       
    37  #endif
       
    38 +
       
    39 --- gcc-5.3.0/libgomp/omp.h.in	2014-01-02 17:25:54.000000000 -0500
       
    40 +++ gcc-5.3.0/libgomp/omp.h.in	2014-11-19 08:31:53.354302270 -0500
       
    41 @@ -31,16 +31,24 @@
       
    42     reflect the shape of the two types.  Their internals are private
       
    43     to the library.  */
       
    44  
       
    45 +#if defined(__x86_64__) || defined(__amd64) || defined(__sparc)
       
    46 +#define OMP_LOCK_ALIGN 8
       
    47 +#define OMP_NEST_LOCK_ALIGN 8
       
    48 +#else
       
    49 +#define OMP_LOCK_ALIGN 4
       
    50 +#define OMP_NEST_LOCK_ALIGN 4
       
    51 +#endif
       
    52 +
       
    53  typedef struct
       
    54  {
       
    55    unsigned char _x[@OMP_LOCK_SIZE@] 
       
    56 -    __attribute__((__aligned__(@OMP_LOCK_ALIGN@)));
       
    57 +    __attribute__((__aligned__(OMP_LOCK_ALIGN)));
       
    58  } omp_lock_t;
       
    59  
       
    60  typedef struct
       
    61  {
       
    62    unsigned char _x[@OMP_NEST_LOCK_SIZE@] 
       
    63 -    __attribute__((__aligned__(@OMP_NEST_LOCK_ALIGN@)));
       
    64 +    __attribute__((__aligned__(OMP_NEST_LOCK_ALIGN)));
       
    65  } omp_nest_lock_t;
       
    66  #endif
       
    67  
       
    68 --- gcc-5.3.0/libgomp/config/posix/ptrlock.h	2014-01-02 17:25:54.000000000 -0500
       
    69 +++ gcc-5.3.0/libgomp/config/posix/ptrlock.h	2014-11-19 08:35:00.554310487 -0500
       
    70 @@ -28,7 +28,10 @@
       
    71  #ifndef GOMP_PTRLOCK_H
       
    72  #define GOMP_PTRLOCK_H 1
       
    73  
       
    74 -typedef struct { void *ptr; gomp_mutex_t lock; } gomp_ptrlock_t;
       
    75 +typedef struct {
       
    76 +  void *ptr;
       
    77 +  gomp_mutex_t lock;
       
    78 +} gomp_ptrlock_t __attribute__((__aligned__(8)));
       
    79  
       
    80  static inline void gomp_ptrlock_init (gomp_ptrlock_t *ptrlock, void *ptr)
       
    81  {
       
    82 --- gcc-5.3.0/libgomp/config/posix/sem.h	2014-01-02 17:25:54.000000000 -0500
       
    83 +++ gcc-5.3.0/libgomp/config/posix/sem.h	2014-11-19 08:35:29.670306230 -0500
       
    84 @@ -48,8 +48,8 @@
       
    85  
       
    86  struct gomp_sem
       
    87  {
       
    88 -  pthread_mutex_t	mutex;
       
    89 -  pthread_cond_t	cond;
       
    90 +  pthread_mutex_t	mutex __attribute__((__aligned__(8)));
       
    91 +  pthread_cond_t	cond __attribute__((__aligned__(8)));
       
    92    int			value;
       
    93  };
       
    94  
       
    95 #--- gcc-5.3.0/libgomp/config/posix/lock.c       2015-01-10 11:10:37.000000000 -0800
       
    96 #+++ gcc-5.3.0/libgomp/config/posix/lock.c       2015-08-02 20:30:05.513685199 -0700
       
    97 #@@ -33,7 +33,14 @@
       
    98 #
       
    99 # /* We need UNIX98/XPG5 extensions to get recursive locks.  Request XPG6 since
       
   100 #    Solaris requires this for C99 and later.  */
       
   101 #+#ifndef _XOPEN_SOURCE
       
   102 # #define _XOPEN_SOURCE 600
       
   103 #+#endif
       
   104 #+
       
   105 #+#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE < 600)
       
   106 #+#undef _XOPEN_SOURCE
       
   107 #+#define _XOPEN_SOURCE 600
       
   108 #+#endif
       
   109 #
       
   110 # #include "libgomp.h"
       
   111 #