CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
automake: fixed compilation
[crossrootfs.git] / glibc / glibc-2.9-localedef_segfault-1.patch
CommitLineData
6dca1d21
JB
1Submitted By: Jim Gifford (patches at jg555 dot com)
2Date: 2007-05-19
3Initial Package Version: 2.6
4Origin: Debian
5Upstream Status: Unknown
6Description: Fixes Segfault when using localdef.
7 This problem is only noticed when using PaX
8 and some architectures besides x86.
9 See debian bug # 231438
10
11 Rediffed for 2.8 by Joe Ciccone
12 Rediffed for 2.9 by Joe Ciccone
13
14diff -Naur glibc-2.8.orig/locale/programs/3level.h glibc-2.8/locale/programs/3level.h
15--- glibc-2.8.orig/locale/programs/3level.h 2007-07-15 20:54:59.000000000 -0400
16+++ glibc-2.8/locale/programs/3level.h 2008-09-20 12:09:34.000000000 -0400
17@@ -203,6 +203,42 @@
18 }
19 }
20 }
21+
22+/* GCC ATM seems to do a poor job with pointers to nested functions passed
23+ to inlined functions. Help it a little bit with this hack. */
24+#define wchead_table_iterate(tp, fn) \
25+do \
26+ { \
27+ struct wchead_table *t = (tp); \
28+ uint32_t index1; \
29+ for (index1 = 0; index1 < t->level1_size; index1++) \
30+ { \
31+ uint32_t lookup1 = t->level1[index1]; \
32+ if (lookup1 != ((uint32_t) ~0)) \
33+ { \
34+ uint32_t lookup1_shifted = lookup1 << t->q; \
35+ uint32_t index2; \
36+ for (index2 = 0; index2 < (1 << t->q); index2++) \
37+ { \
38+ uint32_t lookup2 = t->level2[index2 + lookup1_shifted]; \
39+ if (lookup2 != ((uint32_t) ~0)) \
40+ { \
41+ uint32_t lookup2_shifted = lookup2 << t->p; \
42+ uint32_t index3; \
43+ for (index3 = 0; index3 < (1 << t->p); index3++) \
44+ { \
45+ struct element_t *lookup3 \
46+ = t->level3[index3 + lookup2_shifted]; \
47+ if (lookup3 != NULL) \
48+ fn ((((index1 << t->q) + index2) << t->p) + index3, \
49+ lookup3); \
50+ } \
51+ } \
52+ } \
53+ } \
54+ } \
55+ } while (0)
56+
57 #endif
58
59 #ifndef NO_FINALIZE