patches/glibc/ports-2.13/310-hppa-nptl-carlos.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue May 03 00:19:56 2011 +0200 (2011-05-03)
changeset 2438 2ba5655f6297
permissions -rw-r--r--
libc/glibc: add 2.13

Patchset provided by "Ioannis E. Venetis" <venetis@mail.capsl.udel.edu>
http://sourceware.org/ml/crossgcc/2011-04/msg00072.html
http://sourceware.org/ml/crossgcc/2011-04/msg00073.html

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
     1 
     2 
     3 diff -durN glibc-2.13.orig/elf/rtld.c glibc-2.13/elf/rtld.c
     4 --- glibc-2.13.orig/elf/rtld.c	2009-04-17 02:00:08.000000000 +0200
     5 +++ glibc-2.13/elf/rtld.c	2009-11-13 00:50:26.000000000 +0100
     6 @@ -392,14 +392,14 @@
     7       know it is available.  We do not have to clear the memory if we
     8       do not have to use the temporary bootstrap_map.  Global variables
     9       are initialized to zero by default.  */
    10 -#ifndef DONT_USE_BOOTSTRAP_MAP
    11 +#if !defined DONT_USE_BOOTSTRAP_MAP
    12  # ifdef HAVE_BUILTIN_MEMSET
    13    __builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info));
    14  # else
    15 -  for (size_t cnt = 0;
    16 -       cnt < sizeof (bootstrap_map.l_info) / sizeof (bootstrap_map.l_info[0]);
    17 -       ++cnt)
    18 -    bootstrap_map.l_info[cnt] = 0;
    19 +  /* Clear the whole bootstrap_map structure */
    20 +  for (char *cnt = (char *)&(bootstrap_map);
    21 +       cnt < ((char *)&(bootstrap_map) + sizeof (bootstrap_map));
    22 +       *cnt++ = '\0');
    23  # endif
    24  # if USE___THREAD
    25    bootstrap_map.l_tls_modid = 0;
    26 diff -durN glibc-2.13.orig/include/atomic.h glibc-2.13/include/atomic.h
    27 --- glibc-2.13.orig/include/atomic.h	2009-02-09 00:49:53.000000000 +0100
    28 +++ glibc-2.13/include/atomic.h	2009-11-13 00:50:26.000000000 +0100
    29 @@ -185,7 +185,7 @@
    30       __typeof (*(mem)) __atg5_value = (newvalue);			      \
    31  									      \
    32       do									      \
    33 -       __atg5_oldval = *__atg5_memp;					      \
    34 +       __atg5_oldval = *(volatile __typeof (mem))__atg5_memp;		      \
    35       while (__builtin_expect						      \
    36  	    (atomic_compare_and_exchange_bool_acq (__atg5_memp, __atg5_value, \
    37  						   __atg5_oldval), 0));	      \
    38 @@ -206,7 +206,7 @@
    39       __typeof (*(mem)) __atg6_value = (value);				      \
    40  									      \
    41       do									      \
    42 -       __atg6_oldval = *__atg6_memp;					      \
    43 +       __atg6_oldval = *(volatile __typeof (mem))__atg6_memp;		      \
    44       while (__builtin_expect						      \
    45  	    (atomic_compare_and_exchange_bool_acq (__atg6_memp,		      \
    46  						   __atg6_oldval	      \
    47 @@ -224,7 +224,7 @@
    48       __typeof (*(mem)) __atg7_value = (value);				      \
    49  									      \
    50       do									      \
    51 -       __atg7_oldv = *__atg7_memp;					      \
    52 +       __atg7_oldv = *(volatile __typeof (mem))__atg7_memp;		      \
    53       while (__builtin_expect						      \
    54  	    (catomic_compare_and_exchange_bool_acq (__atg7_memp,	      \
    55  						    __atg7_oldv		      \
    56 @@ -242,7 +242,7 @@
    57      __typeof (mem) __atg8_memp = (mem);					      \
    58      __typeof (*(mem)) __atg8_value = (value);				      \
    59      do {								      \
    60 -      __atg8_oldval = *__atg8_memp;					      \
    61 +      __atg8_oldval = *(volatile __typeof (mem))__atg8_memp;		      \
    62        if (__atg8_oldval >= __atg8_value)				      \
    63  	break;								      \
    64      } while (__builtin_expect						      \
    65 @@ -259,7 +259,7 @@
    66      __typeof (mem) __atg9_memp = (mem);					      \
    67      __typeof (*(mem)) __atg9_value = (value);				      \
    68      do {								      \
    69 -      __atg9_oldv = *__atg9_memp;					      \
    70 +      __atg9_oldv = *(volatile __typeof (mem))__atg9_memp;		      \
    71        if (__atg9_oldv >= __atg9_value)					      \
    72  	break;								      \
    73      } while (__builtin_expect						      \
    74 @@ -277,7 +277,7 @@
    75      __typeof (mem) __atg10_memp = (mem);				      \
    76      __typeof (*(mem)) __atg10_value = (value);				      \
    77      do {								      \
    78 -      __atg10_oldval = *__atg10_memp;					      \
    79 +      __atg10_oldval = *(volatile __typeof (mem))__atg10_memp;		      \
    80        if (__atg10_oldval <= __atg10_value)				      \
    81  	break;								      \
    82      } while (__builtin_expect						      \
    83 @@ -361,7 +361,7 @@
    84  									      \
    85       do									      \
    86         {								      \
    87 -	 __atg11_oldval = *__atg11_memp;				      \
    88 +	 __atg11_oldval = *(volatile __typeof (mem))__atg11_memp;	      \
    89  	 if (__builtin_expect (__atg11_oldval <= 0, 0))			      \
    90  	   break;							      \
    91         }								      \
    92 @@ -400,7 +400,7 @@
    93       __typeof (*(mem)) __atg14_mask = ((__typeof (*(mem))) 1 << (bit));	      \
    94  									      \
    95       do									      \
    96 -       __atg14_old = (*__atg14_memp);					      \
    97 +       __atg14_old = (*(volatile __typeof (mem))__atg14_memp);		      \
    98       while (__builtin_expect						      \
    99  	    (atomic_compare_and_exchange_bool_acq (__atg14_memp,	      \
   100  						   __atg14_old | __atg14_mask,\
   101 @@ -418,7 +418,7 @@
   102      __typeof (*(mem)) __atg15_mask = (mask);				      \
   103  									      \
   104      do									      \
   105 -      __atg15_old = (*__atg15_memp);					      \
   106 +      __atg15_old = (*(volatile __typeof (mem))__atg15_memp);		      \
   107      while (__builtin_expect						      \
   108  	   (atomic_compare_and_exchange_bool_acq (__atg15_memp,		      \
   109  						  __atg15_old & __atg15_mask, \
   110 @@ -450,7 +450,7 @@
   111       __typeof (*(mem)) __atg16_mask = (mask);				      \
   112  									      \
   113       do									      \
   114 -       __atg16_old = (*__atg16_memp);					      \
   115 +       __atg16_old = (*(volatile __typeof (mem))__atg16_memp);		      \
   116       while (__builtin_expect						      \
   117  	    (atomic_compare_and_exchange_bool_acq (__atg16_memp,	      \
   118  						   __atg16_old & __atg16_mask,\
   119 @@ -468,7 +468,7 @@
   120      __typeof (*(mem)) __atg17_mask = (mask);				      \
   121  									      \
   122      do									      \
   123 -      __atg17_old = (*__atg17_memp);					      \
   124 +      __atg17_old = (*(volatile __typeof (mem))__atg17_memp);		      \
   125      while (__builtin_expect						      \
   126  	   (atomic_compare_and_exchange_bool_acq (__atg17_memp,		      \
   127  						  __atg17_old | __atg17_mask, \
   128 @@ -484,7 +484,7 @@
   129      __typeof (*(mem)) __atg18_mask = (mask);				      \
   130  									      \
   131      do									      \
   132 -      __atg18_old = (*__atg18_memp);					      \
   133 +      __atg18_old = (*(volatile __typeof (mem))__atg18_memp);		      \
   134      while (__builtin_expect						      \
   135  	   (catomic_compare_and_exchange_bool_acq (__atg18_memp,	      \
   136  						   __atg18_old | __atg18_mask,\
   137 @@ -500,7 +500,7 @@
   138       __typeof (*(mem)) __atg19_mask = (mask);				      \
   139  									      \
   140       do									      \
   141 -       __atg19_old = (*__atg19_memp);					      \
   142 +       __atg19_old = (*(volatile __typeof (mem))__atg19_memp);		      \
   143       while (__builtin_expect						      \
   144  	    (atomic_compare_and_exchange_bool_acq (__atg19_memp,	      \
   145  						   __atg19_old | __atg19_mask,\
   146 diff -durN glibc-2.13.orig/nptl/Makefile glibc-2.13/nptl/Makefile
   147 --- glibc-2.13.orig/nptl/Makefile	2008-11-12 14:38:23.000000000 +0100
   148 +++ glibc-2.13/nptl/Makefile	2009-11-13 00:50:26.000000000 +0100
   149 @@ -265,9 +265,9 @@
   150  # Files which must not be linked with libpthread.
   151  tests-nolibpthread = tst-unload
   152  
   153 -# This sets the stack resource limit to 1023kb, which is not a multiple
   154 -# of the page size since every architecture's page size is > 1k.
   155 -tst-oddstacklimit-ENV = ; ulimit -s 1023;
   156 +# This sets the stack resource limit to 8193kb, which is not a multiple
   157 +# of the page size since every architecture's page size is 4096 bytes.
   158 +tst-oddstacklimit-ENV = ; ulimit -s 8193;
   159  
   160  distribute = eintr.c tst-cleanup4aux.c
   161  
   162 @@ -426,6 +426,35 @@
   163  CFLAGS-tst-cleanupx4.c += -fexceptions
   164  CFLAGS-tst-oncex3.c += -fexceptions
   165  CFLAGS-tst-oncex4.c += -fexceptions
   166 +
   167 +ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
   168 +LDFLAGS-tst-cancelx2 += $(ldflags-libgcc_s)
   169 +LDFLAGS-tst-cancelx3 += $(ldflags-libgcc_s)
   170 +LDFLAGS-tst-cancelx4 += $(ldflags-libgcc_s)
   171 +LDFLAGS-tst-cancelx5 += $(ldflags-libgcc_s)
   172 +LDFLAGS-tst-cancelx6 += $(ldflags-libgcc_s)
   173 +LDFLAGS-tst-cancelx7 += $(ldflags-libgcc_s)
   174 +LDFLAGS-tst-cancelx8 += $(ldflags-libgcc_s)
   175 +LDFLAGS-tst-cancelx9 += $(ldflags-libgcc_s)
   176 +LDFLAGS-tst-cancelx10 += $(ldflags-libgcc_s)
   177 +LDFLAGS-tst-cancelx11 += $(ldflags-libgcc_s)
   178 +LDFLAGS-tst-cancelx12 += $(ldflags-libgcc_s)
   179 +LDFLAGS-tst-cancelx13 += $(ldflags-libgcc_s)
   180 +LDFLAGS-tst-cancelx14 += $(ldflags-libgcc_s)
   181 +LDFLAGS-tst-cancelx15 += $(ldflags-libgcc_s)
   182 +LDFLAGS-tst-cancelx16 += $(ldflags-libgcc_s)
   183 +LDFLAGS-tst-cancelx17 += $(ldflags-libgcc_s)
   184 +LDFLAGS-tst-cancelx18 += $(ldflags-libgcc_s)
   185 +LDFLAGS-tst-cancelx20 += $(ldflags-libgcc_s)
   186 +LDFLAGS-tst-cancelx21 += $(ldflags-libgcc_s)
   187 +LDFLAGS-tst-cleanupx0 += $(ldflags-libgcc_s)
   188 +LDFLAGS-tst-cleanupx1 += $(ldflags-libgcc_s)
   189 +LDFLAGS-tst-cleanupx2 += $(ldflags-libgcc_s)
   190 +LDFLAGS-tst-cleanupx3 += $(ldflags-libgcc_s)
   191 +LDFLAGS-tst-cleanupx4 += $(ldflags-libgcc_s)
   192 +LDFLAGS-tst-oncex3 += $(ldflags-libgcc_s)
   193 +LDFLAGS-tst-oncex4 += $(ldflags-libgcc_s)
   194 +
   195  CFLAGS-tst-align.c += $(stack-align-test-flags)
   196  CFLAGS-tst-align3.c += $(stack-align-test-flags)
   197  CFLAGS-tst-initializers1.c = -W -Wall -Werror
   198 diff -durN glibc-2.13.orig/nptl/pthread_barrier_wait.c glibc-2.13/nptl/pthread_barrier_wait.c
   199 --- glibc-2.13.orig/nptl/pthread_barrier_wait.c	2007-08-01 06:18:50.000000000 +0200
   200 +++ glibc-2.13/nptl/pthread_barrier_wait.c	2009-11-13 00:50:26.000000000 +0100
   201 @@ -64,7 +64,7 @@
   202        do
   203  	lll_futex_wait (&ibarrier->curr_event, event,
   204  			ibarrier->private ^ FUTEX_PRIVATE_FLAG);
   205 -      while (event == ibarrier->curr_event);
   206 +      while (event == *(volatile unsigned int *)&ibarrier->curr_event);
   207      }
   208  
   209    /* Make sure the init_count is stored locally or in a register.  */
   210 diff -durN glibc-2.13.orig/nptl/sysdeps/pthread/Makefile glibc-2.13/nptl/sysdeps/pthread/Makefile
   211 --- glibc-2.13.orig/nptl/sysdeps/pthread/Makefile	2006-02-28 08:09:41.000000000 +0100
   212 +++ glibc-2.13/nptl/sysdeps/pthread/Makefile	2009-11-13 00:50:26.000000000 +0100
   213 @@ -33,7 +33,9 @@
   214  
   215  ifeq ($(have-forced-unwind),yes)
   216  tests += tst-mqueue8x
   217 +ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
   218  CFLAGS-tst-mqueue8x.c += -fexceptions
   219 +LDFLAGS-tst-mqueue8x += $(ldflags-libgcc_s) 
   220  endif
   221  endif
   222  
   223 diff -durN glibc-2.13.orig/stdio-common/Makefile glibc-2.13/stdio-common/Makefile
   224 --- glibc-2.13.orig/stdio-common/Makefile	2009-04-11 07:29:56.000000000 +0200
   225 +++ glibc-2.13/stdio-common/Makefile	2009-11-13 00:50:26.000000000 +0100
   226 @@ -82,7 +82,7 @@
   227  	$(SHELL) -e tst-printf.sh $(common-objpfx) '$(run-program-prefix)'
   228  endif
   229  
   230 -CFLAGS-vfprintf.c = -Wno-uninitialized
   231 +CFLAGS-vfprintf.c = -Wno-uninitialized -fno-delayed-branch
   232  CFLAGS-vfwprintf.c = -Wno-uninitialized
   233  CFLAGS-tst-printf.c = -Wno-format
   234  CFLAGS-tstdiomisc.c = -Wno-format
   235 diff -durN glibc-2.13.orig/sunrpc/clnt_udp.c glibc-2.13/sunrpc/clnt_udp.c
   236 --- glibc-2.13.orig/sunrpc/clnt_udp.c	2008-07-26 10:42:44.000000000 +0200
   237 +++ glibc-2.13/sunrpc/clnt_udp.c	2009-11-13 00:50:26.000000000 +0100
   238 @@ -456,7 +456,7 @@
   239        while (inlen < 0 && errno == EINTR);
   240        if (inlen < 0)
   241  	{
   242 -	  if (errno == EWOULDBLOCK)
   243 +	  if (errno == EWOULDBLOCK || errno == EAGAIN)
   244  	    continue;
   245  	  cu->cu_error.re_errno = errno;
   246  	  return (cu->cu_error.re_status = RPC_CANTRECV);