patches/glibc/2.9/230-2.3.3-localedef-fix-trampoline.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jan 17 23:06:02 2010 +0100 (2010-01-17)
changeset 1740 c57458bb354d
parent 1201 c9967a6e3b25
permissions -rw-r--r--
configure: do not require hg when configuring in an hg clone

When configuring in an hg clone, we need hg to compute the version string.
It can happen that users do not have Mercurial (eg. if they got a snapshot
rather that they did a full clone). In this case, we can still run, of
course, so simply fill the version string with a sufficiently explicit
value, that does not require hg. The date is a good candidate.
     1 Original patch from: gentoo/src/patchsets/glibc/2.9/1040_all_2.3.3-localedef-fix-trampoline.patch
     2 
     3 -= BEGIN original header =-
     4 #! /bin/sh -e
     5 
     6 # DP: Description: Fix localedef segfault when run under exec-shield,
     7 #        PaX or similar. (#231438, #198099)
     8 # DP: Dpatch Author: James Troup <james@nocrew.org>
     9 # DP: Patch Author: (probably) Jakub Jelinek <jakub@redhat.com>
    10 # DP: Upstream status: Unknown
    11 # DP: Status Details: Unknown
    12 # DP: Date: 2004-03-16
    13 
    14 if [ $# -ne 2 ]; then
    15     echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    16     exit 1
    17 fi
    18 case "$1" in
    19     -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
    20     -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
    21     *)
    22 	echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    23 	exit 1
    24 esac
    25 exit 0
    26 
    27 -= END original header =-
    28 
    29 diff -durN glibc-2_9.orig/locale/programs/3level.h glibc-2_9/locale/programs/3level.h
    30 --- glibc-2_9.orig/locale/programs/3level.h	2007-07-16 02:54:59.000000000 +0200
    31 +++ glibc-2_9/locale/programs/3level.h	2009-02-02 22:00:54.000000000 +0100
    32 @@ -203,6 +203,42 @@
    33  	}
    34      }
    35  }
    36 +
    37 +/* GCC ATM seems to do a poor job with pointers to nested functions passed
    38 +   to inlined functions.  Help it a little bit with this hack.  */
    39 +#define wchead_table_iterate(tp, fn) \
    40 +do									      \
    41 +  {									      \
    42 +    struct wchead_table *t = (tp);					      \
    43 +    uint32_t index1;							      \
    44 +    for (index1 = 0; index1 < t->level1_size; index1++)			      \
    45 +      {									      \
    46 +	uint32_t lookup1 = t->level1[index1];				      \
    47 +	if (lookup1 != ((uint32_t) ~0))					      \
    48 +	  {								      \
    49 +	    uint32_t lookup1_shifted = lookup1 << t->q;			      \
    50 +	    uint32_t index2;						      \
    51 +	    for (index2 = 0; index2 < (1 << t->q); index2++)		      \
    52 +	      {								      \
    53 +		uint32_t lookup2 = t->level2[index2 + lookup1_shifted];	      \
    54 +		if (lookup2 != ((uint32_t) ~0))				      \
    55 +		  {							      \
    56 +		    uint32_t lookup2_shifted = lookup2 << t->p;		      \
    57 +		    uint32_t index3;					      \
    58 +		    for (index3 = 0; index3 < (1 << t->p); index3++)	      \
    59 +		      {							      \
    60 +			struct element_t *lookup3			      \
    61 +			  = t->level3[index3 + lookup2_shifted];	      \
    62 +			if (lookup3 != NULL)				      \
    63 +			  fn ((((index1 << t->q) + index2) << t->p) + index3, \
    64 +			      lookup3);					      \
    65 +		      }							      \
    66 +		  }							      \
    67 +	      }								      \
    68 +	  }								      \
    69 +      }									      \
    70 +  } while (0)
    71 +
    72  #endif
    73  
    74  #ifndef NO_FINALIZE