patches/glibc/ports-2.13/170-localedef-fix-trampoline.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed May 18 23:00:46 2011 +0200 (2011-05-18)
changeset 2467 200836977ce6
permissions -rw-r--r--
config: rename variables that are arrays

Make it explicit that a variable is an array bu the name of the variable.
It will be used later when .config gets munged to allow both multiple
arguments and arguments with spaces at the same time to be passed from the
configuration down to the build scripts.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
yann@2438
     1
#! /bin/sh -e
yann@2438
     2
yann@2438
     3
# DP: Description: Fix localedef segfault when run under exec-shield,
yann@2438
     4
#        PaX or similar. (#231438, #198099)
yann@2438
     5
# DP: Dpatch Author: James Troup <james@nocrew.org>
yann@2438
     6
# DP: Patch Author: (probably) Jakub Jelinek <jakub@redhat.com>
yann@2438
     7
# DP: Upstream status: Unknown
yann@2438
     8
# DP: Status Details: Unknown
yann@2438
     9
# DP: Date: 2004-03-16
yann@2438
    10
yann@2438
    11
if [ $# -ne 2 ]; then
yann@2438
    12
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
yann@2438
    13
    exit 1
yann@2438
    14
fi
yann@2438
    15
case "$1" in
yann@2438
    16
    -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
yann@2438
    17
    -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
yann@2438
    18
    *)
yann@2438
    19
	echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
yann@2438
    20
	exit 1
yann@2438
    21
esac
yann@2438
    22
exit 0
yann@2438
    23
yann@2438
    24
diff -durN glibc-2.13.orig/locale/programs/3level.h glibc-2.13/locale/programs/3level.h
yann@2438
    25
--- glibc-2.13.orig/locale/programs/3level.h	2007-07-16 02:54:59.000000000 +0200
yann@2438
    26
+++ glibc-2.13/locale/programs/3level.h	2009-11-13 00:49:56.000000000 +0100
yann@2438
    27
@@ -203,6 +203,42 @@
yann@2438
    28
 	}
yann@2438
    29
     }
yann@2438
    30
 }
yann@2438
    31
+
yann@2438
    32
+/* GCC ATM seems to do a poor job with pointers to nested functions passed
yann@2438
    33
+   to inlined functions.  Help it a little bit with this hack.  */
yann@2438
    34
+#define wchead_table_iterate(tp, fn) \
yann@2438
    35
+do									      \
yann@2438
    36
+  {									      \
yann@2438
    37
+    struct wchead_table *t = (tp);					      \
yann@2438
    38
+    uint32_t index1;							      \
yann@2438
    39
+    for (index1 = 0; index1 < t->level1_size; index1++)			      \
yann@2438
    40
+      {									      \
yann@2438
    41
+	uint32_t lookup1 = t->level1[index1];				      \
yann@2438
    42
+	if (lookup1 != ((uint32_t) ~0))					      \
yann@2438
    43
+	  {								      \
yann@2438
    44
+	    uint32_t lookup1_shifted = lookup1 << t->q;			      \
yann@2438
    45
+	    uint32_t index2;						      \
yann@2438
    46
+	    for (index2 = 0; index2 < (1 << t->q); index2++)		      \
yann@2438
    47
+	      {								      \
yann@2438
    48
+		uint32_t lookup2 = t->level2[index2 + lookup1_shifted];	      \
yann@2438
    49
+		if (lookup2 != ((uint32_t) ~0))				      \
yann@2438
    50
+		  {							      \
yann@2438
    51
+		    uint32_t lookup2_shifted = lookup2 << t->p;		      \
yann@2438
    52
+		    uint32_t index3;					      \
yann@2438
    53
+		    for (index3 = 0; index3 < (1 << t->p); index3++)	      \
yann@2438
    54
+		      {							      \
yann@2438
    55
+			struct element_t *lookup3			      \
yann@2438
    56
+			  = t->level3[index3 + lookup2_shifted];	      \
yann@2438
    57
+			if (lookup3 != NULL)				      \
yann@2438
    58
+			  fn ((((index1 << t->q) + index2) << t->p) + index3, \
yann@2438
    59
+			      lookup3);					      \
yann@2438
    60
+		      }							      \
yann@2438
    61
+		  }							      \
yann@2438
    62
+	      }								      \
yann@2438
    63
+	  }								      \
yann@2438
    64
+      }									      \
yann@2438
    65
+  } while (0)
yann@2438
    66
+
yann@2438
    67
 #endif
yann@2438
    68
 
yann@2438
    69
 #ifndef NO_FINALIZE