patches/glibc/ports-2.13/310-hppa-nptl-carlos.patch
changeset 2438 2ba5655f6297
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/glibc/ports-2.13/310-hppa-nptl-carlos.patch	Tue May 03 00:19:56 2011 +0200
     1.3 @@ -0,0 +1,246 @@
     1.4 +
     1.5 +
     1.6 +diff -durN glibc-2.13.orig/elf/rtld.c glibc-2.13/elf/rtld.c
     1.7 +--- glibc-2.13.orig/elf/rtld.c	2009-04-17 02:00:08.000000000 +0200
     1.8 ++++ glibc-2.13/elf/rtld.c	2009-11-13 00:50:26.000000000 +0100
     1.9 +@@ -392,14 +392,14 @@
    1.10 +      know it is available.  We do not have to clear the memory if we
    1.11 +      do not have to use the temporary bootstrap_map.  Global variables
    1.12 +      are initialized to zero by default.  */
    1.13 +-#ifndef DONT_USE_BOOTSTRAP_MAP
    1.14 ++#if !defined DONT_USE_BOOTSTRAP_MAP
    1.15 + # ifdef HAVE_BUILTIN_MEMSET
    1.16 +   __builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info));
    1.17 + # else
    1.18 +-  for (size_t cnt = 0;
    1.19 +-       cnt < sizeof (bootstrap_map.l_info) / sizeof (bootstrap_map.l_info[0]);
    1.20 +-       ++cnt)
    1.21 +-    bootstrap_map.l_info[cnt] = 0;
    1.22 ++  /* Clear the whole bootstrap_map structure */
    1.23 ++  for (char *cnt = (char *)&(bootstrap_map);
    1.24 ++       cnt < ((char *)&(bootstrap_map) + sizeof (bootstrap_map));
    1.25 ++       *cnt++ = '\0');
    1.26 + # endif
    1.27 + # if USE___THREAD
    1.28 +   bootstrap_map.l_tls_modid = 0;
    1.29 +diff -durN glibc-2.13.orig/include/atomic.h glibc-2.13/include/atomic.h
    1.30 +--- glibc-2.13.orig/include/atomic.h	2009-02-09 00:49:53.000000000 +0100
    1.31 ++++ glibc-2.13/include/atomic.h	2009-11-13 00:50:26.000000000 +0100
    1.32 +@@ -185,7 +185,7 @@
    1.33 +      __typeof (*(mem)) __atg5_value = (newvalue);			      \
    1.34 + 									      \
    1.35 +      do									      \
    1.36 +-       __atg5_oldval = *__atg5_memp;					      \
    1.37 ++       __atg5_oldval = *(volatile __typeof (mem))__atg5_memp;		      \
    1.38 +      while (__builtin_expect						      \
    1.39 + 	    (atomic_compare_and_exchange_bool_acq (__atg5_memp, __atg5_value, \
    1.40 + 						   __atg5_oldval), 0));	      \
    1.41 +@@ -206,7 +206,7 @@
    1.42 +      __typeof (*(mem)) __atg6_value = (value);				      \
    1.43 + 									      \
    1.44 +      do									      \
    1.45 +-       __atg6_oldval = *__atg6_memp;					      \
    1.46 ++       __atg6_oldval = *(volatile __typeof (mem))__atg6_memp;		      \
    1.47 +      while (__builtin_expect						      \
    1.48 + 	    (atomic_compare_and_exchange_bool_acq (__atg6_memp,		      \
    1.49 + 						   __atg6_oldval	      \
    1.50 +@@ -224,7 +224,7 @@
    1.51 +      __typeof (*(mem)) __atg7_value = (value);				      \
    1.52 + 									      \
    1.53 +      do									      \
    1.54 +-       __atg7_oldv = *__atg7_memp;					      \
    1.55 ++       __atg7_oldv = *(volatile __typeof (mem))__atg7_memp;		      \
    1.56 +      while (__builtin_expect						      \
    1.57 + 	    (catomic_compare_and_exchange_bool_acq (__atg7_memp,	      \
    1.58 + 						    __atg7_oldv		      \
    1.59 +@@ -242,7 +242,7 @@
    1.60 +     __typeof (mem) __atg8_memp = (mem);					      \
    1.61 +     __typeof (*(mem)) __atg8_value = (value);				      \
    1.62 +     do {								      \
    1.63 +-      __atg8_oldval = *__atg8_memp;					      \
    1.64 ++      __atg8_oldval = *(volatile __typeof (mem))__atg8_memp;		      \
    1.65 +       if (__atg8_oldval >= __atg8_value)				      \
    1.66 + 	break;								      \
    1.67 +     } while (__builtin_expect						      \
    1.68 +@@ -259,7 +259,7 @@
    1.69 +     __typeof (mem) __atg9_memp = (mem);					      \
    1.70 +     __typeof (*(mem)) __atg9_value = (value);				      \
    1.71 +     do {								      \
    1.72 +-      __atg9_oldv = *__atg9_memp;					      \
    1.73 ++      __atg9_oldv = *(volatile __typeof (mem))__atg9_memp;		      \
    1.74 +       if (__atg9_oldv >= __atg9_value)					      \
    1.75 + 	break;								      \
    1.76 +     } while (__builtin_expect						      \
    1.77 +@@ -277,7 +277,7 @@
    1.78 +     __typeof (mem) __atg10_memp = (mem);				      \
    1.79 +     __typeof (*(mem)) __atg10_value = (value);				      \
    1.80 +     do {								      \
    1.81 +-      __atg10_oldval = *__atg10_memp;					      \
    1.82 ++      __atg10_oldval = *(volatile __typeof (mem))__atg10_memp;		      \
    1.83 +       if (__atg10_oldval <= __atg10_value)				      \
    1.84 + 	break;								      \
    1.85 +     } while (__builtin_expect						      \
    1.86 +@@ -361,7 +361,7 @@
    1.87 + 									      \
    1.88 +      do									      \
    1.89 +        {								      \
    1.90 +-	 __atg11_oldval = *__atg11_memp;				      \
    1.91 ++	 __atg11_oldval = *(volatile __typeof (mem))__atg11_memp;	      \
    1.92 + 	 if (__builtin_expect (__atg11_oldval <= 0, 0))			      \
    1.93 + 	   break;							      \
    1.94 +        }								      \
    1.95 +@@ -400,7 +400,7 @@
    1.96 +      __typeof (*(mem)) __atg14_mask = ((__typeof (*(mem))) 1 << (bit));	      \
    1.97 + 									      \
    1.98 +      do									      \
    1.99 +-       __atg14_old = (*__atg14_memp);					      \
   1.100 ++       __atg14_old = (*(volatile __typeof (mem))__atg14_memp);		      \
   1.101 +      while (__builtin_expect						      \
   1.102 + 	    (atomic_compare_and_exchange_bool_acq (__atg14_memp,	      \
   1.103 + 						   __atg14_old | __atg14_mask,\
   1.104 +@@ -418,7 +418,7 @@
   1.105 +     __typeof (*(mem)) __atg15_mask = (mask);				      \
   1.106 + 									      \
   1.107 +     do									      \
   1.108 +-      __atg15_old = (*__atg15_memp);					      \
   1.109 ++      __atg15_old = (*(volatile __typeof (mem))__atg15_memp);		      \
   1.110 +     while (__builtin_expect						      \
   1.111 + 	   (atomic_compare_and_exchange_bool_acq (__atg15_memp,		      \
   1.112 + 						  __atg15_old & __atg15_mask, \
   1.113 +@@ -450,7 +450,7 @@
   1.114 +      __typeof (*(mem)) __atg16_mask = (mask);				      \
   1.115 + 									      \
   1.116 +      do									      \
   1.117 +-       __atg16_old = (*__atg16_memp);					      \
   1.118 ++       __atg16_old = (*(volatile __typeof (mem))__atg16_memp);		      \
   1.119 +      while (__builtin_expect						      \
   1.120 + 	    (atomic_compare_and_exchange_bool_acq (__atg16_memp,	      \
   1.121 + 						   __atg16_old & __atg16_mask,\
   1.122 +@@ -468,7 +468,7 @@
   1.123 +     __typeof (*(mem)) __atg17_mask = (mask);				      \
   1.124 + 									      \
   1.125 +     do									      \
   1.126 +-      __atg17_old = (*__atg17_memp);					      \
   1.127 ++      __atg17_old = (*(volatile __typeof (mem))__atg17_memp);		      \
   1.128 +     while (__builtin_expect						      \
   1.129 + 	   (atomic_compare_and_exchange_bool_acq (__atg17_memp,		      \
   1.130 + 						  __atg17_old | __atg17_mask, \
   1.131 +@@ -484,7 +484,7 @@
   1.132 +     __typeof (*(mem)) __atg18_mask = (mask);				      \
   1.133 + 									      \
   1.134 +     do									      \
   1.135 +-      __atg18_old = (*__atg18_memp);					      \
   1.136 ++      __atg18_old = (*(volatile __typeof (mem))__atg18_memp);		      \
   1.137 +     while (__builtin_expect						      \
   1.138 + 	   (catomic_compare_and_exchange_bool_acq (__atg18_memp,	      \
   1.139 + 						   __atg18_old | __atg18_mask,\
   1.140 +@@ -500,7 +500,7 @@
   1.141 +      __typeof (*(mem)) __atg19_mask = (mask);				      \
   1.142 + 									      \
   1.143 +      do									      \
   1.144 +-       __atg19_old = (*__atg19_memp);					      \
   1.145 ++       __atg19_old = (*(volatile __typeof (mem))__atg19_memp);		      \
   1.146 +      while (__builtin_expect						      \
   1.147 + 	    (atomic_compare_and_exchange_bool_acq (__atg19_memp,	      \
   1.148 + 						   __atg19_old | __atg19_mask,\
   1.149 +diff -durN glibc-2.13.orig/nptl/Makefile glibc-2.13/nptl/Makefile
   1.150 +--- glibc-2.13.orig/nptl/Makefile	2008-11-12 14:38:23.000000000 +0100
   1.151 ++++ glibc-2.13/nptl/Makefile	2009-11-13 00:50:26.000000000 +0100
   1.152 +@@ -265,9 +265,9 @@
   1.153 + # Files which must not be linked with libpthread.
   1.154 + tests-nolibpthread = tst-unload
   1.155 + 
   1.156 +-# This sets the stack resource limit to 1023kb, which is not a multiple
   1.157 +-# of the page size since every architecture's page size is > 1k.
   1.158 +-tst-oddstacklimit-ENV = ; ulimit -s 1023;
   1.159 ++# This sets the stack resource limit to 8193kb, which is not a multiple
   1.160 ++# of the page size since every architecture's page size is 4096 bytes.
   1.161 ++tst-oddstacklimit-ENV = ; ulimit -s 8193;
   1.162 + 
   1.163 + distribute = eintr.c tst-cleanup4aux.c
   1.164 + 
   1.165 +@@ -426,6 +426,35 @@
   1.166 + CFLAGS-tst-cleanupx4.c += -fexceptions
   1.167 + CFLAGS-tst-oncex3.c += -fexceptions
   1.168 + CFLAGS-tst-oncex4.c += -fexceptions
   1.169 ++
   1.170 ++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
   1.171 ++LDFLAGS-tst-cancelx2 += $(ldflags-libgcc_s)
   1.172 ++LDFLAGS-tst-cancelx3 += $(ldflags-libgcc_s)
   1.173 ++LDFLAGS-tst-cancelx4 += $(ldflags-libgcc_s)
   1.174 ++LDFLAGS-tst-cancelx5 += $(ldflags-libgcc_s)
   1.175 ++LDFLAGS-tst-cancelx6 += $(ldflags-libgcc_s)
   1.176 ++LDFLAGS-tst-cancelx7 += $(ldflags-libgcc_s)
   1.177 ++LDFLAGS-tst-cancelx8 += $(ldflags-libgcc_s)
   1.178 ++LDFLAGS-tst-cancelx9 += $(ldflags-libgcc_s)
   1.179 ++LDFLAGS-tst-cancelx10 += $(ldflags-libgcc_s)
   1.180 ++LDFLAGS-tst-cancelx11 += $(ldflags-libgcc_s)
   1.181 ++LDFLAGS-tst-cancelx12 += $(ldflags-libgcc_s)
   1.182 ++LDFLAGS-tst-cancelx13 += $(ldflags-libgcc_s)
   1.183 ++LDFLAGS-tst-cancelx14 += $(ldflags-libgcc_s)
   1.184 ++LDFLAGS-tst-cancelx15 += $(ldflags-libgcc_s)
   1.185 ++LDFLAGS-tst-cancelx16 += $(ldflags-libgcc_s)
   1.186 ++LDFLAGS-tst-cancelx17 += $(ldflags-libgcc_s)
   1.187 ++LDFLAGS-tst-cancelx18 += $(ldflags-libgcc_s)
   1.188 ++LDFLAGS-tst-cancelx20 += $(ldflags-libgcc_s)
   1.189 ++LDFLAGS-tst-cancelx21 += $(ldflags-libgcc_s)
   1.190 ++LDFLAGS-tst-cleanupx0 += $(ldflags-libgcc_s)
   1.191 ++LDFLAGS-tst-cleanupx1 += $(ldflags-libgcc_s)
   1.192 ++LDFLAGS-tst-cleanupx2 += $(ldflags-libgcc_s)
   1.193 ++LDFLAGS-tst-cleanupx3 += $(ldflags-libgcc_s)
   1.194 ++LDFLAGS-tst-cleanupx4 += $(ldflags-libgcc_s)
   1.195 ++LDFLAGS-tst-oncex3 += $(ldflags-libgcc_s)
   1.196 ++LDFLAGS-tst-oncex4 += $(ldflags-libgcc_s)
   1.197 ++
   1.198 + CFLAGS-tst-align.c += $(stack-align-test-flags)
   1.199 + CFLAGS-tst-align3.c += $(stack-align-test-flags)
   1.200 + CFLAGS-tst-initializers1.c = -W -Wall -Werror
   1.201 +diff -durN glibc-2.13.orig/nptl/pthread_barrier_wait.c glibc-2.13/nptl/pthread_barrier_wait.c
   1.202 +--- glibc-2.13.orig/nptl/pthread_barrier_wait.c	2007-08-01 06:18:50.000000000 +0200
   1.203 ++++ glibc-2.13/nptl/pthread_barrier_wait.c	2009-11-13 00:50:26.000000000 +0100
   1.204 +@@ -64,7 +64,7 @@
   1.205 +       do
   1.206 + 	lll_futex_wait (&ibarrier->curr_event, event,
   1.207 + 			ibarrier->private ^ FUTEX_PRIVATE_FLAG);
   1.208 +-      while (event == ibarrier->curr_event);
   1.209 ++      while (event == *(volatile unsigned int *)&ibarrier->curr_event);
   1.210 +     }
   1.211 + 
   1.212 +   /* Make sure the init_count is stored locally or in a register.  */
   1.213 +diff -durN glibc-2.13.orig/nptl/sysdeps/pthread/Makefile glibc-2.13/nptl/sysdeps/pthread/Makefile
   1.214 +--- glibc-2.13.orig/nptl/sysdeps/pthread/Makefile	2006-02-28 08:09:41.000000000 +0100
   1.215 ++++ glibc-2.13/nptl/sysdeps/pthread/Makefile	2009-11-13 00:50:26.000000000 +0100
   1.216 +@@ -33,7 +33,9 @@
   1.217 + 
   1.218 + ifeq ($(have-forced-unwind),yes)
   1.219 + tests += tst-mqueue8x
   1.220 ++ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
   1.221 + CFLAGS-tst-mqueue8x.c += -fexceptions
   1.222 ++LDFLAGS-tst-mqueue8x += $(ldflags-libgcc_s) 
   1.223 + endif
   1.224 + endif
   1.225 + 
   1.226 +diff -durN glibc-2.13.orig/stdio-common/Makefile glibc-2.13/stdio-common/Makefile
   1.227 +--- glibc-2.13.orig/stdio-common/Makefile	2009-04-11 07:29:56.000000000 +0200
   1.228 ++++ glibc-2.13/stdio-common/Makefile	2009-11-13 00:50:26.000000000 +0100
   1.229 +@@ -82,7 +82,7 @@
   1.230 + 	$(SHELL) -e tst-printf.sh $(common-objpfx) '$(run-program-prefix)'
   1.231 + endif
   1.232 + 
   1.233 +-CFLAGS-vfprintf.c = -Wno-uninitialized
   1.234 ++CFLAGS-vfprintf.c = -Wno-uninitialized -fno-delayed-branch
   1.235 + CFLAGS-vfwprintf.c = -Wno-uninitialized
   1.236 + CFLAGS-tst-printf.c = -Wno-format
   1.237 + CFLAGS-tstdiomisc.c = -Wno-format
   1.238 +diff -durN glibc-2.13.orig/sunrpc/clnt_udp.c glibc-2.13/sunrpc/clnt_udp.c
   1.239 +--- glibc-2.13.orig/sunrpc/clnt_udp.c	2008-07-26 10:42:44.000000000 +0200
   1.240 ++++ glibc-2.13/sunrpc/clnt_udp.c	2009-11-13 00:50:26.000000000 +0100
   1.241 +@@ -456,7 +456,7 @@
   1.242 +       while (inlen < 0 && errno == EINTR);
   1.243 +       if (inlen < 0)
   1.244 + 	{
   1.245 +-	  if (errno == EWOULDBLOCK)
   1.246 ++	  if (errno == EWOULDBLOCK || errno == EAGAIN)
   1.247 + 	    continue;
   1.248 + 	  cu->cu_error.re_errno = errno;
   1.249 + 	  return (cu->cu_error.re_status = RPC_CANTRECV);