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