1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/glibc/ports-2.10.1/170-localedef-fix-trampoline.patch Fri May 25 19:09:43 2012 +0200
1.3 @@ -0,0 +1,69 @@
1.4 +#! /bin/sh -e
1.5 +
1.6 +# DP: Description: Fix localedef segfault when run under exec-shield,
1.7 +# PaX or similar. (#231438, #198099)
1.8 +# DP: Dpatch Author: James Troup <james@nocrew.org>
1.9 +# DP: Patch Author: (probably) Jakub Jelinek <jakub@redhat.com>
1.10 +# DP: Upstream status: Unknown
1.11 +# DP: Status Details: Unknown
1.12 +# DP: Date: 2004-03-16
1.13 +
1.14 +if [ $# -ne 2 ]; then
1.15 + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
1.16 + exit 1
1.17 +fi
1.18 +case "$1" in
1.19 + -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
1.20 + -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
1.21 + *)
1.22 + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
1.23 + exit 1
1.24 +esac
1.25 +exit 0
1.26 +
1.27 +diff -durN glibc-2.10.1.orig/locale/programs/3level.h glibc-2.10.1/locale/programs/3level.h
1.28 +--- glibc-2.10.1.orig/locale/programs/3level.h 2007-07-16 02:54:59.000000000 +0200
1.29 ++++ glibc-2.10.1/locale/programs/3level.h 2009-11-13 00:49:56.000000000 +0100
1.30 +@@ -203,6 +203,42 @@
1.31 + }
1.32 + }
1.33 + }
1.34 ++
1.35 ++/* GCC ATM seems to do a poor job with pointers to nested functions passed
1.36 ++ to inlined functions. Help it a little bit with this hack. */
1.37 ++#define wchead_table_iterate(tp, fn) \
1.38 ++do \
1.39 ++ { \
1.40 ++ struct wchead_table *t = (tp); \
1.41 ++ uint32_t index1; \
1.42 ++ for (index1 = 0; index1 < t->level1_size; index1++) \
1.43 ++ { \
1.44 ++ uint32_t lookup1 = t->level1[index1]; \
1.45 ++ if (lookup1 != ((uint32_t) ~0)) \
1.46 ++ { \
1.47 ++ uint32_t lookup1_shifted = lookup1 << t->q; \
1.48 ++ uint32_t index2; \
1.49 ++ for (index2 = 0; index2 < (1 << t->q); index2++) \
1.50 ++ { \
1.51 ++ uint32_t lookup2 = t->level2[index2 + lookup1_shifted]; \
1.52 ++ if (lookup2 != ((uint32_t) ~0)) \
1.53 ++ { \
1.54 ++ uint32_t lookup2_shifted = lookup2 << t->p; \
1.55 ++ uint32_t index3; \
1.56 ++ for (index3 = 0; index3 < (1 << t->p); index3++) \
1.57 ++ { \
1.58 ++ struct element_t *lookup3 \
1.59 ++ = t->level3[index3 + lookup2_shifted]; \
1.60 ++ if (lookup3 != NULL) \
1.61 ++ fn ((((index1 << t->q) + index2) << t->p) + index3, \
1.62 ++ lookup3); \
1.63 ++ } \
1.64 ++ } \
1.65 ++ } \
1.66 ++ } \
1.67 ++ } \
1.68 ++ } while (0)
1.69 ++
1.70 + #endif
1.71 +
1.72 + #ifndef NO_FINALIZE