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