summaryrefslogtreecommitdiffstats
path: root/meta/packages/gcc/gcc-3.4.3
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/gcc/gcc-3.4.3')
-rw-r--r--meta/packages/gcc/gcc-3.4.3/15342.patch22
-rw-r--r--meta/packages/gcc/gcc-3.4.3/GCC3.4.0VisibilityPatch.diff1100
-rw-r--r--meta/packages/gcc/gcc-3.4.3/always-fixincperm.patch32
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-bigendian-uclibc.patch30
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-bigendian.patch70
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-lib1asm.patch24
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-nolibfloat.patch24
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-softfloat.patch256
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc-3.4.1-uclibc-100-conf.patch442
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc-3.4.1-uclibc-200-locale.patch3246
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc-uclibc-3.4.0-120-softfloat.patch14
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc34-arm-ldm-peephole.patch79
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc34-arm-ldm.patch119
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc34-arm-tune.patch9
-rw-r--r--meta/packages/gcc/gcc-3.4.3/gcc34-reverse-compare.patch32
-rw-r--r--meta/packages/gcc/gcc-3.4.3/sdk-libstdc++-includes.patch22
16 files changed, 5521 insertions, 0 deletions
diff --git a/meta/packages/gcc/gcc-3.4.3/15342.patch b/meta/packages/gcc/gcc-3.4.3/15342.patch
new file mode 100644
index 0000000000..d0f3e72d47
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.3/15342.patch
@@ -0,0 +1,22 @@
1--- gcc/gcc/regrename.c~ 2004-01-14 17:55:20.000000000 +0000
2+++ gcc/gcc/regrename.c 2005-02-28 07:24:25.893015200 +0000
3@@ -671,7 +671,8 @@
4
5 case SET:
6 scan_rtx (insn, &SET_SRC (x), class, action, OP_IN, 0);
7- scan_rtx (insn, &SET_DEST (x), class, action, OP_OUT, 0);
8+ scan_rtx (insn, &SET_DEST (x), class, action,
9+ GET_CODE (PATTERN (insn)) == COND_EXEC ? OP_INOUT : OP_OUT, 0);
10 return;
11
12 case STRICT_LOW_PART:
13@@ -696,7 +697,8 @@
14 abort ();
15
16 case CLOBBER:
17- scan_rtx (insn, &SET_DEST (x), class, action, OP_OUT, 1);
18+ scan_rtx (insn, &SET_DEST (x), class, action,
19+ GET_CODE (PATTERN (insn)) == COND_EXEC ? OP_INOUT : OP_OUT, 0);
20 return;
21
22 case EXPR_LIST:
diff --git a/meta/packages/gcc/gcc-3.4.3/GCC3.4.0VisibilityPatch.diff b/meta/packages/gcc/gcc-3.4.3/GCC3.4.0VisibilityPatch.diff
new file mode 100644
index 0000000000..d51da7157d
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.3/GCC3.4.0VisibilityPatch.diff
@@ -0,0 +1,1100 @@
1
2diff -aur gcc-3.4.0orig/gcc/c-common.c gcc-3.4.0/gcc/c-common.c
3--- gcc-3.4.0orig/gcc/c-common.c 2004-03-19 01:32:59.000000000 +0000
4+++ gcc-3.4.0/gcc/c-common.c 2004-05-10 21:05:33.000000000 +0100
5@@ -833,7 +833,7 @@
6 handle_deprecated_attribute },
7 { "vector_size", 1, 1, false, true, false,
8 handle_vector_size_attribute },
9- { "visibility", 1, 1, true, false, false,
10+ { "visibility", 1, 1, false, false, false,
11 handle_visibility_attribute },
12 { "tls_model", 1, 1, true, false, false,
13 handle_tls_model_attribute },
14@@ -4886,7 +4886,16 @@
15
16 *no_add_attrs = true;
17
18- if (decl_function_context (decl) != 0 || ! TREE_PUBLIC (decl))
19+ if (TYPE_P (*node))
20+ {
21+ if (TREE_CODE (*node) != RECORD_TYPE && TREE_CODE (*node) != UNION_TYPE)
22+ {
23+ warning ("`%s' attribute ignored on non-class types",
24+ IDENTIFIER_POINTER (name));
25+ return NULL_TREE;
26+ }
27+ }
28+ else if (decl_function_context (decl) != 0 || ! TREE_PUBLIC (decl))
29 {
30 warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
31 return NULL_TREE;
32@@ -4897,6 +4906,14 @@
33 error ("visibility arg not a string");
34 return NULL_TREE;
35 }
36+
37+ /* If this is a type, set the visibility on the type decl. */
38+ if (TYPE_P (decl))
39+ {
40+ decl = TYPE_NAME (decl);
41+ if (! decl)
42+ return NULL_TREE;
43+ }
44
45 if (strcmp (TREE_STRING_POINTER (id), "default") == 0)
46 DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
47@@ -4908,6 +4925,14 @@
48 DECL_VISIBILITY (decl) = VISIBILITY_PROTECTED;
49 else
50 error ("visibility arg must be one of \"default\", \"hidden\", \"protected\" or \"internal\"");
51+ DECL_VISIBILITYSPECIFIED (decl) = 1;
52+
53+ /* For decls only, go ahead and attach the attribute to the node as well.
54+ This is needed so we can determine whether we have VISIBILITY_DEFAULT
55+ because the visibility was not specified, or because it was explicitly
56+ overridden from the class visibility. */
57+ if (DECL_P (*node))
58+ *no_add_attrs = false;
59
60 return NULL_TREE;
61 }
62
63diff -aur gcc-3.4.0orig/gcc/c-decl.c gcc-3.4.0/gcc/c-decl.c
64--- gcc-3.4.0orig/gcc/c-decl.c 2004-03-22 17:58:18.000000000 +0000
65+++ gcc-3.4.0/gcc/c-decl.c 2004-05-10 15:16:27.000000000 +0100
66@@ -1164,9 +1164,8 @@
67 }
68
69 /* warnings */
70- /* All decls must agree on a non-default visibility. */
71- if (DECL_VISIBILITY (newdecl) != VISIBILITY_DEFAULT
72- && DECL_VISIBILITY (olddecl) != VISIBILITY_DEFAULT
73+ /* All decls must agree on a visibility. */
74+ if (DECL_VISIBILITYSPECIFIED (newdecl) && DECL_VISIBILITYSPECIFIED (olddecl)
75 && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
76 {
77 warning ("%Jredeclaration of '%D' with different visibility "
78@@ -1361,9 +1360,12 @@
79 Currently, it can only be defined in the prototype. */
80 COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl);
81
82- /* If either declaration has a nondefault visibility, use it. */
83- if (DECL_VISIBILITY (olddecl) != VISIBILITY_DEFAULT)
84- DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl);
85+ /* Use visibility of whichever declaration had it specified */
86+ if (DECL_VISIBILITYSPECIFIED (olddecl))
87+ {
88+ DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl);
89+ DECL_VISIBILITYSPECIFIED (newdecl) = 1;
90+ }
91
92 if (TREE_CODE (newdecl) == FUNCTION_DECL)
93 {
94
95diff -aur gcc-3.4.0orig/gcc/common.opt gcc-3.4.0/gcc/common.opt
96--- gcc-3.4.0orig/gcc/common.opt 2004-02-18 00:09:04.000000000 +0000
97+++ gcc-3.4.0/gcc/common.opt 2004-05-09 08:10:50.000000000 +0100
98@@ -718,6 +718,11 @@
99 Common
100 Add extra commentary to assembler output
101
102+fvisibility=
103+Common Joined RejectNegative
104+-fvisibility=[default|internal|hidden|protected] Set the default symbol visibility
105+
106+
107 fvpt
108 Common
109 Use expression value profiles in optimizations
110
111diff -aur gcc-3.4.0orig/gcc/c.opt gcc-3.4.0/gcc/c.opt
112--- gcc-3.4.0orig/gcc/c.opt 2004-02-18 00:09:03.000000000 +0000
113+++ gcc-3.4.0/gcc/c.opt 2004-05-09 08:10:50.000000000 +0100
114@@ -656,6 +656,10 @@
115 C++ ObjC++
116 Use __cxa_atexit to register destructors
117
118+fvisibility-inlines-hidden
119+C++
120+Marks all inlined methods as having hidden visibility
121+
122 fvtable-gc
123 C++ ObjC++
124 Discard unused virtual functions
125diff -aur gcc-3.4.0orig/gcc/c-opts.c gcc-3.4.0/gcc/c-opts.c
126--- gcc-3.4.0orig/gcc/c-opts.c 2004-02-18 00:09:03.000000000 +0000
127+++ gcc-3.4.0/gcc/c-opts.c 2004-05-09 08:10:50.000000000 +0100
128@@ -912,6 +912,10 @@
129 case OPT_fuse_cxa_atexit:
130 flag_use_cxa_atexit = value;
131 break;
132+
133+ case OPT_fvisibility_inlines_hidden:
134+ visibility_options.inlineshidden = value;
135+ break;
136
137 case OPT_fweak:
138 flag_weak = value;
139
140diff -aur gcc-3.4.0orig/gcc/cp/class.c gcc-3.4.0/gcc/cp/class.c
141--- gcc-3.4.0orig/gcc/cp/class.c 2004-03-09 07:27:23.000000000 +0000
142+++ gcc-3.4.0/gcc/cp/class.c 2004-05-10 21:06:50.000000000 +0100
143@@ -524,6 +524,10 @@
144 DECL_ALIGN (decl) = MAX (TYPE_ALIGN (double_type_node),
145 DECL_ALIGN (decl));
146
147+ /* The vtable's visibility is the class visibility. There is no way
148+ to override the visibility for just the vtable. */
149+ DECL_VISIBILITY (decl) = CLASSTYPE_VISIBILITY (class_type);
150+ DECL_VISIBILITYSPECIFIED (decl) = CLASSTYPE_VISIBILITYSPECIFIED (class_type);
151 import_export_vtable (decl, class_type, 0);
152
153 return decl;
154@@ -2971,7 +2975,25 @@
155 continue;
156
157 if (TREE_CODE (x) == CONST_DECL || TREE_CODE (x) == VAR_DECL)
158- continue;
159+ {
160+ /* Apply the class's visibility attribute to static members
161+ which do not have a visibility attribute. */
162+ if (! lookup_attribute ("visibility", DECL_ATTRIBUTES (x)))
163+ {
164+ if (visibility_options.inlineshidden && DECL_INLINE (x))
165+ {
166+ DECL_VISIBILITY (x) = VISIBILITY_HIDDEN;
167+ DECL_VISIBILITYSPECIFIED (x) = 1;
168+ }
169+ else
170+ {
171+ DECL_VISIBILITY (x) = CLASSTYPE_VISIBILITY (current_class_type);
172+ DECL_VISIBILITYSPECIFIED (x) = CLASSTYPE_VISIBILITYSPECIFIED (current_class_type);
173+ }
174+ }
175+
176+ continue;
177+ }
178
179 /* Now it can only be a FIELD_DECL. */
180
181@@ -3708,6 +3730,22 @@
182 check_for_override (x, t);
183 if (DECL_PURE_VIRTUAL_P (x) && ! DECL_VINDEX (x))
184 cp_error_at ("initializer specified for non-virtual method `%D'", x);
185+
186+ /* Apply the class's visibility attribute to methods which do
187+ not have a visibility attribute. */
188+ if (! lookup_attribute ("visibility", DECL_ATTRIBUTES (x)))
189+ {
190+ if (visibility_options.inlineshidden && DECL_INLINE (x))
191+ {
192+ DECL_VISIBILITY (x) = VISIBILITY_HIDDEN;
193+ DECL_VISIBILITYSPECIFIED (x) = 1;
194+ }
195+ else
196+ {
197+ DECL_VISIBILITY (x) = CLASSTYPE_VISIBILITY (current_class_type);
198+ DECL_VISIBILITYSPECIFIED (x) = CLASSTYPE_VISIBILITYSPECIFIED (current_class_type);
199+ }
200+ }
201
202 /* The name of the field is the original field name
203 Save this in auxiliary field for later overloading. */
204@@ -7830,3 +7868,4 @@
205 *vid->last_init = build_tree_list (NULL_TREE, init);
206 vid->last_init = &TREE_CHAIN (*vid->last_init);
207 }
208+
209
210diff -aur gcc-3.4.0orig/gcc/cp/cp-tree.h gcc-3.4.0/gcc/cp/cp-tree.h
211--- gcc-3.4.0orig/gcc/cp/cp-tree.h 2004-03-20 00:13:08.000000000 +0000
212+++ gcc-3.4.0/gcc/cp/cp-tree.h 2004-05-10 20:56:56.000000000 +0100
213@@ -1008,7 +1008,12 @@
214 #define PUBLICLY_UNIQUELY_DERIVED_P(PARENT, TYPE) \
215 (lookup_base ((TYPE), (PARENT), ba_not_special | ba_quiet, NULL) \
216 != NULL_TREE)
217-
218+
219+/* Gives the visibility specification for a class type. */
220+#define CLASSTYPE_VISIBILITY(TYPE) DECL_VISIBILITY (TYPE_NAME (TYPE))
221+#define CLASSTYPE_VISIBILITYSPECIFIED(TYPE) DECL_VISIBILITYSPECIFIED (TYPE_NAME (TYPE))
222+
223+
224 /* This is a few header flags for 'struct lang_type'. Actually,
225 all but the first are used only for lang_type_class; they
226 are put in this structure to save space. */
227
228diff -aur gcc-3.4.0orig/gcc/cp/decl.c gcc-3.4.0/gcc/cp/decl.c
229--- gcc-3.4.0orig/gcc/cp/decl.c 2004-04-01 21:47:21.000000000 +0100
230+++ gcc-3.4.0/gcc/cp/decl.c 2004-05-28 21:16:11.000000000 +0100
231@@ -1869,17 +1869,34 @@
232 DECL_COMMON (newdecl) = DECL_COMMON (olddecl);
233 COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl);
234
235- /* If either declaration has a nondefault visibility, use it. */
236- if (DECL_VISIBILITY (olddecl) != VISIBILITY_DEFAULT)
237+ /* Warn about conflicting visibility specifications. */
238+ if (DECL_VISIBILITYSPECIFIED (olddecl) && DECL_VISIBILITYSPECIFIED (newdecl)
239+ && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
240+ {
241+ warning ("%J'%D': visibility attribute ignored because it",
242+ newdecl, newdecl);
243+ warning ("%Jconflicts with previous declaration here", olddecl);
244+ }
245+ /* Choose the declaration which specified visibility. */
246+ if (DECL_VISIBILITYSPECIFIED (olddecl))
247 {
248- if (DECL_VISIBILITY (newdecl) != VISIBILITY_DEFAULT
249- && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
250- {
251- warning ("%J'%D': visibility attribute ignored because it",
252- newdecl, newdecl);
253- warning ("%Jconflicts with previous declaration here", olddecl);
254- }
255 DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl);
256+ DECL_VISIBILITYSPECIFIED (newdecl) = 1;
257+ }
258+ /* If it's a definition of a global operator new or operator
259+ delete, it must be default visibility. */
260+ if (NEW_DELETE_OPNAME_P (DECL_NAME (newdecl)) && DECL_INITIAL (newdecl) != NULL_TREE)
261+ {
262+ if (!DECL_FUNCTION_MEMBER_P (newdecl) && VISIBILITY_DEFAULT != DECL_VISIBILITY (newdecl))
263+ {
264+ warning ("%J`%D': ignoring non-default symbol",
265+ newdecl, newdecl);
266+ warning ("%Jvisibility on global operator new or delete", newdecl);
267+ DECL_VISIBILITY (olddecl) = VISIBILITY_DEFAULT;
268+ DECL_VISIBILITYSPECIFIED (olddecl) = 1;
269+ DECL_VISIBILITY (newdecl) = VISIBILITY_DEFAULT;
270+ DECL_VISIBILITYSPECIFIED (newdecl) = 1;
271+ }
272 }
273
274 if (TREE_CODE (newdecl) == FUNCTION_DECL)
275
276diff -aur gcc-3.4.0orig/gcc/cp/method.c gcc-3.4.0/gcc/cp/method.c
277--- gcc-3.4.0orig/gcc/cp/method.c 2004-04-08 23:15:58.000000000 +0100
278+++ gcc-3.4.0/gcc/cp/method.c 2004-05-09 08:10:52.000000000 +0100
279@@ -394,6 +394,7 @@
280 rewrite. */
281 TREE_PUBLIC (thunk_fndecl) = TREE_PUBLIC (function);
282 DECL_VISIBILITY (thunk_fndecl) = DECL_VISIBILITY (function);
283+ DECL_VISIBILITYSPECIFIED (thunk_fndecl) = DECL_VISIBILITYSPECIFIED (function);
284
285 if (flag_syntax_only)
286 {
287
288diff -aur gcc-3.4.0orig/gcc/cp/optimize.c gcc-3.4.0/gcc/cp/optimize.c
289--- gcc-3.4.0orig/gcc/cp/optimize.c 2004-02-08 01:52:50.000000000 +0000
290+++ gcc-3.4.0/gcc/cp/optimize.c 2004-05-09 08:10:52.000000000 +0100
291@@ -155,6 +155,7 @@
292 DECL_NOT_REALLY_EXTERN (clone) = DECL_NOT_REALLY_EXTERN (fn);
293 TREE_PUBLIC (clone) = TREE_PUBLIC (fn);
294 DECL_VISIBILITY (clone) = DECL_VISIBILITY (fn);
295+ DECL_VISIBILITYSPECIFIED (clone) = DECL_VISIBILITYSPECIFIED (fn);
296
297 /* Adjust the parameter names and locations. */
298 parm = DECL_ARGUMENTS (fn);
299
300diff -aur gcc-3.4.0orig/gcc/cp/rtti.c gcc-3.4.0/gcc/cp/rtti.c
301--- gcc-3.4.0orig/gcc/cp/rtti.c 2004-03-08 23:00:26.000000000 +0000
302+++ gcc-3.4.0/gcc/cp/rtti.c 2004-05-10 21:09:21.000000000 +0100
303@@ -361,7 +361,11 @@
304 pushdecl_top_level_and_finish (d, NULL_TREE);
305
306 if (CLASS_TYPE_P (type))
307- CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type)) = d;
308+ {
309+ CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type)) = d;
310+ DECL_VISIBILITY (d) = CLASSTYPE_VISIBILITY (type);
311+ DECL_VISIBILITYSPECIFIED (d) = CLASSTYPE_VISIBILITYSPECIFIED (type);
312+ }
313
314 /* Remember the type it is for. */
315 TREE_TYPE (name) = type;
316@@ -759,6 +763,11 @@
317 TREE_STATIC (name_decl) = 1;
318 DECL_EXTERNAL (name_decl) = 0;
319 TREE_PUBLIC (name_decl) = 1;
320+ if (CLASS_TYPE_P (target))
321+ {
322+ DECL_VISIBILITY (name_decl) = CLASSTYPE_VISIBILITY (target);
323+ DECL_VISIBILITYSPECIFIED (name_decl) = CLASSTYPE_VISIBILITYSPECIFIED (target);
324+ }
325 import_export_tinfo (name_decl, target, typeinfo_in_lib_p (target));
326 /* External name of the string containing the type's name has a
327 special name. */
328
329diff -aur gcc-3.4.0orig/gcc/c-pragma.c gcc-3.4.0/gcc/c-pragma.c
330--- gcc-3.4.0orig/gcc/c-pragma.c 2004-01-23 23:35:53.000000000 +0000
331+++ gcc-3.4.0/gcc/c-pragma.c 2004-05-09 08:10:52.000000000 +0100
332@@ -480,6 +480,86 @@
333 return asmname;
334 }
335
336+
337+#ifdef HANDLE_PRAGMA_VISIBILITY
338+static void handle_pragma_visibility (cpp_reader *);
339+
340+/* Sets the default visibility for symbols to something other than that
341+ specified on the command line. */
342+static void
343+handle_pragma_visibility (cpp_reader *dummy ATTRIBUTE_UNUSED)
344+{ /* Form is #pragma GCC visibility push(hidden)|pop */
345+ static int visstack [16], visidx;
346+ tree x;
347+ enum cpp_ttype token;
348+ enum { bad, push, pop } action = bad;
349+
350+ token = c_lex (&x);
351+ if (token == CPP_NAME)
352+ {
353+ const char *op = IDENTIFIER_POINTER (x);
354+ if (!strcmp (op, "push"))
355+ action = push;
356+ else if (!strcmp (op, "pop"))
357+ action = pop;
358+ }
359+ if (bad == action)
360+ GCC_BAD ("#pragma GCC visibility must be followed by push or pop");
361+ else
362+ {
363+ if (pop == action)
364+ {
365+ if (!visidx)
366+ {
367+ GCC_BAD ("No matching push for '#pragma GCC visibility pop'");
368+ }
369+ else
370+ {
371+ default_visibility = visstack[--visidx];
372+ visibility_options.inpragma = (visidx>0);
373+ }
374+ }
375+ else
376+ {
377+ if (c_lex (&x) != CPP_OPEN_PAREN)
378+ GCC_BAD ("missing '(' after '#pragma GCC visibility push' - ignored");
379+ token = c_lex (&x);
380+ if (token != CPP_NAME)
381+ {
382+ GCC_BAD ("malformed #pragma GCC visibility push");
383+ }
384+ else if (visidx >= 16)
385+ {
386+ GCC_BAD ("No more than sixteen #pragma GCC visibility pushes allowed at once");
387+ }
388+ else
389+ {
390+ const char *str = IDENTIFIER_POINTER (x);
391+ visstack[visidx++] = default_visibility;
392+ if (!strcmp (str, "default"))
393+ default_visibility = VISIBILITY_DEFAULT;
394+ else if (!strcmp (str, "internal"))
395+ default_visibility = VISIBILITY_INTERNAL;
396+ else if (!strcmp (str, "hidden"))
397+ default_visibility = VISIBILITY_HIDDEN;
398+ else if (!strcmp (str, "protected"))
399+ default_visibility = VISIBILITY_PROTECTED;
400+ else
401+ {
402+ GCC_BAD ("#pragma GCC visibility push() must specify default, internal, hidden or protected");
403+ }
404+ visibility_options.inpragma = 1;
405+ }
406+ if (c_lex (&x) != CPP_CLOSE_PAREN)
407+ GCC_BAD ("missing '(' after '#pragma GCC visibility push' - ignored");
408+ }
409+ }
410+ if (c_lex (&x) != CPP_EOF)
411+ warning ("junk at end of '#pragma GCC visibility'");
412+}
413+
414+#endif
415+
416 /* Front-end wrapper for pragma registration to avoid dragging
417 cpplib.h in almost everywhere. */
418 void
419@@ -505,6 +585,9 @@
420 #ifdef HANDLE_PRAGMA_EXTERN_PREFIX
421 c_register_pragma (0, "extern_prefix", handle_pragma_extern_prefix);
422 #endif
423+#ifdef HANDLE_PRAGMA_VISIBILITY
424+ c_register_pragma ("GCC", "visibility", handle_pragma_visibility);
425+#endif
426
427 #ifdef REGISTER_TARGET_PRAGMAS
428 REGISTER_TARGET_PRAGMAS ();
429diff -aur gcc-3.4.0orig/gcc/c-pragma.h gcc-3.4.0/gcc/c-pragma.h
430--- gcc-3.4.0orig/gcc/c-pragma.h 2004-01-31 06:18:05.000000000 +0000
431+++ gcc-3.4.0/gcc/c-pragma.h 2004-05-09 08:10:53.000000000 +0100
432@@ -44,6 +44,11 @@
433 #define HANDLE_PRAGMA_PACK 1
434 #endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
435
436+/* It's safe to always leave visibility pragma enabled as if
437+ visibility is not supported on the host OS platform the
438+ statements are ignored. */
439+#define HANDLE_PRAGMA_VISIBILITY 1
440+
441 extern void init_pragma (void);
442
443 /* Front-end wrapper for pragma registration to avoid dragging
444
445
446diff -aur gcc-3.4.0orig/gcc/doc/invoke.texi gcc-3.4.0/gcc/doc/invoke.texi
447--- gcc-3.4.0orig/gcc/doc/invoke.texi 2004-04-19 00:05:36.000000000 +0100
448+++ gcc-3.4.0/gcc/doc/invoke.texi 2004-05-28 21:29:36.000000000 +0100
449@@ -183,7 +183,8 @@
450 -fno-optional-diags -fpermissive @gol
451 -frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol
452 -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
453--fno-default-inline -Wabi -Wctor-dtor-privacy @gol
454+-fno-default-inline -fvisibility-inlines-hidden @gol
455+-Wabi -Wctor-dtor-privacy @gol
456 -Wnon-virtual-dtor -Wreorder @gol
457 -Weffc++ -Wno-deprecated @gol
458 -Wno-non-template-friend -Wold-style-cast @gol
459@@ -674,7 +675,8 @@
460 -fargument-alias -fargument-noalias @gol
461 -fargument-noalias-global -fleading-underscore @gol
462 -ftls-model=@var{model} @gol
463--ftrapv -fwrapv -fbounds-check}
464+-ftrapv -fwrapv -fbounds-check @gol
465+-fvisibility}
466 @end table
467
468 @menu
469@@ -1433,6 +1435,20 @@
470 destructors, but will only work if your C library supports
471 @code{__cxa_atexit}.
472
473+@item -fvisibility-inlines-hidden
474+@opindex fvisibility-inlines-hidden
475+Causes all inlined methods to be marked with
476+@code{__attribute__ ((visibility ("hidden")))} so that they do not
477+appear in the export table of a DSO and do not require a PLT indirection
478+when used within the DSO. Enabling this option can have a dramatic effect
479+on load and link times of a DSO as it massively reduces the size of the
480+dynamic export table when the library makes heavy use of templates. While
481+it can cause bloating through duplication of code within each DSO where
482+it is used, often the wastage is less than the considerable space occupied
483+by a long symbol name in the export table which is typical when using
484+templates and namespaces. For even more savings, combine with the
485+@code{-fvisibility=hidden} switch.
486+
487 @item -fno-weak
488 @opindex fno-weak
489 Do not use weak symbol support, even if it is provided by the linker.
490@@ -11198,6 +11214,54 @@
491
492 The default without @option{-fpic} is @code{initial-exec}; with
493 @option{-fpic} the default is @code{global-dynamic}.
494+
495+@item -fvisibility=@var{default|internal|hidden|protected}
496+@opindex fvisibility
497+Set the default ELF image symbol visibility to the specified option - all
498+symbols will be marked with this unless overrided within the code.
499+Using this feature can very substantially improve linking and
500+load times of shared object libraries, produce more optimised
501+code, provide near-perfect API export and prevent symbol clashes.
502+It is @strong{strongly} recommended that you use this in any shared objects
503+you distribute.
504+
505+Despite the nomenclature, @code{default} always means public ie;
506+available to be linked against from outside the shared object.
507+@code{protected} and @code{internal} are pretty useless in real-world
508+usage so the only other commonly used option will be @code{hidden}.
509+The default if -fvisibility isn't specified is @code{default} ie; make every
510+symbol public - this causes the same behaviour as previous versions of
511+GCC.
512+
513+A good explanation of the benefits offered by ensuring ELF
514+symbols have the correct visibility is given by ``How To Write
515+Shared Libraries'' by Ulrich Drepper (which can be found at
516+@w{@uref{http://people.redhat.com/~drepper/}}) - however a superior
517+solution made possible by this option to marking things hidden when
518+the default is public is to make the default hidden and mark things
519+public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
520+and @code{__attribute__ ((visibility("default")))} instead of
521+@code{__declspec(dllexport)} you get almost identical semantics with
522+identical syntax. This is a great boon to those working with
523+cross-platform projects.
524+
525+For those adding visibility support to existing code, you may find
526+@samp{#pragma GCC visibility} of use. This works by you enclosing
527+the declarations you wish to set visibility for with (for example)
528+@samp{#pragma GCC visibility push(hidden)} and
529+@samp{#pragma GCC visibility pop}. These can be nested up to sixteen
530+times. Bear in mind that symbol visibility should be viewed @strong{as
531+part of the API interface contract} and thus all new code should
532+always specify visibility when it is not the default ie; declarations
533+only for use within the local DSO should @strong{always} be marked explicitly
534+as hidden as so to avoid PLT indirection overheads - making this
535+abundantly clear also aids readability and self-documentation of the code.
536+Note that due to ISO C++ specification requirements, operator new and
537+operator delete must always be of default visibility.
538+
539+An overview of these techniques, their benefits and how to use them
540+is at @w{@uref{http://www.nedprod.com/programs/gccvisibility.html}}.
541+
542 @end table
543
544 @c man end
545
546diff -aur gcc-3.4.0orig/gcc/flags.h gcc-3.4.0/gcc/flags.h
547--- gcc-3.4.0orig/gcc/flags.h 2004-02-18 00:09:04.000000000 +0000
548+++ gcc-3.4.0/gcc/flags.h 2004-05-09 08:10:53.000000000 +0100
549@@ -60,6 +60,30 @@
550 /* Nonzero means emit debugging information only for symbols which are used. */
551 extern int flag_debug_only_used_symbols;
552
553+/* Enumerate visibility settings. */
554+#ifndef SYMBOL_VISIBILITY_DEFINED
555+#define SYMBOL_VISIBILITY_DEFINED
556+enum symbol_visibility
557+{
558+ VISIBILITY_DEFAULT,
559+ VISIBILITY_INTERNAL,
560+ VISIBILITY_HIDDEN,
561+ VISIBILITY_PROTECTED
562+};
563+#endif
564+
565+/* The default visibility for all symbols (unless overridden). */
566+extern enum symbol_visibility default_visibility;
567+
568+struct visibility_flags
569+{
570+ unsigned inpragma : 1; /* True when in #pragma GCC visibility. */
571+ unsigned inlineshidden : 1; /* True when -finlineshidden in effect. */
572+};
573+
574+/* Global visibility options. */
575+extern struct visibility_flags visibility_options;
576+
577 /* Nonzero means do optimizations. -opt. */
578
579 extern int optimize;
580
581diff -aur gcc-3.4.0orig/gcc/opts.c gcc-3.4.0/gcc/opts.c
582--- gcc-3.4.0orig/gcc/opts.c 2004-02-18 00:09:04.000000000 +0000
583+++ gcc-3.4.0/gcc/opts.c 2004-05-09 08:10:53.000000000 +0100
584@@ -142,6 +142,12 @@
585 write_symbols is set to DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
586 bool use_gnu_debug_info_extensions;
587
588+/* The default visibility for all symbols (unless overridden) */
589+enum symbol_visibility default_visibility = VISIBILITY_DEFAULT;
590+
591+/* Global visibility options. */
592+struct visibility_flags visibility_options;
593+
594 /* Columns of --help display. */
595 static unsigned int columns = 80;
596
597@@ -1440,6 +1446,21 @@
598 flag_verbose_asm = value;
599 break;
600
601+ case OPT_fvisibility_:
602+ {
603+ if(!strcmp(arg, "default"))
604+ default_visibility=VISIBILITY_DEFAULT;
605+ else if(!strcmp(arg, "internal"))
606+ default_visibility=VISIBILITY_INTERNAL;
607+ else if(!strcmp(arg, "hidden"))
608+ default_visibility=VISIBILITY_HIDDEN;
609+ else if(!strcmp(arg, "protected"))
610+ default_visibility=VISIBILITY_PROTECTED;
611+ else
612+ error("unrecognised visibility value \"%s\"", arg);
613+ }
614+ break;
615+
616 case OPT_fweb:
617 flag_web = value;
618 break;
619
620diff -aur gcc-3.4.0orig/gcc/tree.c gcc-3.4.0/gcc/tree.c
621--- gcc-3.4.0orig/gcc/tree.c 2004-02-05 22:01:35.000000000 +0000
622+++ gcc-3.4.0/gcc/tree.c 2004-05-10 15:22:52.000000000 +0100
623@@ -2563,6 +2563,11 @@
624 layout_decl (t, 0);
625 else if (code == FUNCTION_DECL)
626 DECL_MODE (t) = FUNCTION_MODE;
627+
628+ /* Set default visibility to whatever the user supplied with
629+ visibility_specified depending on #pragma GCC visibility. */
630+ DECL_VISIBILITY (t) = default_visibility;
631+ DECL_VISIBILITYSPECIFIED (t) = visibility_options.inpragma;
632
633 return t;
634 }
635
636diff -aur gcc-3.4.0orig/gcc/tree.h gcc-3.4.0/gcc/tree.h
637--- gcc-3.4.0orig/gcc/tree.h 2004-02-08 01:52:43.000000000 +0000
638+++ gcc-3.4.0/gcc/tree.h 2004-05-09 08:10:54.000000000 +0100
639@@ -1499,6 +1499,10 @@
640 /* Value of the decls's visibility attribute */
641 #define DECL_VISIBILITY(NODE) (DECL_CHECK (NODE)->decl.visibility)
642
643+/* Nonzero means that the decl had its visibility specified rather than
644+ being inferred. */
645+#define DECL_VISIBILITYSPECIFIED(NODE) (DECL_CHECK (NODE)->decl.visibility_specified)
646+
647 /* In a FUNCTION_DECL, nonzero if the function cannot be inlined. */
648 #define DECL_UNINLINABLE(NODE) (FUNCTION_DECL_CHECK (NODE)->decl.uninlinable)
649
650@@ -1633,7 +1637,8 @@
651 || TREE_CODE (DECL_CONTEXT (EXP)) == TRANSLATION_UNIT_DECL)
652
653 /* Enumerate visibility settings. */
654-
655+#ifndef SYMBOL_VISIBILITY_DEFINED
656+#define SYMBOL_VISIBILITY_DEFINED
657 enum symbol_visibility
658 {
659 VISIBILITY_DEFAULT,
660@@ -1641,6 +1646,7 @@
661 VISIBILITY_HIDDEN,
662 VISIBILITY_PROTECTED
663 };
664+#endif
665
666 struct function;
667
668@@ -1684,8 +1690,7 @@
669 unsigned thread_local_flag : 1;
670 unsigned declared_inline_flag : 1;
671 ENUM_BITFIELD(symbol_visibility) visibility : 2;
672- unsigned unused : 1;
673- /* one unused bit. */
674+ unsigned visibility_specified : 1;
675
676 unsigned lang_flag_0 : 1;
677 unsigned lang_flag_1 : 1;
678
679diff -aur gcc-3.4.0orig/gcc/varasm.c gcc-3.4.0/gcc/varasm.c
680--- gcc-3.4.0orig/gcc/varasm.c 2004-04-14 22:14:08.000000000 +0100
681+++ gcc-3.4.0/gcc/varasm.c 2004-05-09 08:10:54.000000000 +0100
682@@ -5150,8 +5150,8 @@
683 /* Static variables are always local. */
684 else if (! TREE_PUBLIC (exp))
685 local_p = true;
686- /* A variable is local if the user tells us so. */
687- else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
688+ /* A variable is local if the user explicitly tells us so. */
689+ else if (DECL_VISIBILITYSPECIFIED (exp) && DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
690 local_p = true;
691 /* Otherwise, variables defined outside this object may not be local. */
692 else if (DECL_EXTERNAL (exp))
693@@ -5159,6 +5159,9 @@
694 /* Linkonce and weak data are never local. */
695 else if (DECL_ONE_ONLY (exp) || DECL_WEAK (exp))
696 local_p = false;
697+ /* If none of the above and visibility is not default, make local. */
698+ else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
699+ local_p = true;
700 /* If PIC, then assume that any global name can be overridden by
701 symbols resolved from other modules. */
702 else if (shlib)
703
704diff -Naur gcc-3.4.0orig/gcc/testsuite/gcc.dg/visibility-9.c gcc-3.4.0/gcc/testsuite/gcc.dg/visibility-9.c
705--- gcc-3.4.0orig/gcc/testsuite/gcc.dg/visibility-9.c 1970-01-01 01:00:00.000000000 +0100
706+++ gcc-3.4.0/gcc/testsuite/gcc.dg/visibility-9.c 2004-05-09 12:40:39.000000000 +0100
707@@ -0,0 +1,9 @@
708+/* Test that -fvisibility works. */
709+/* { dg-do compile } */
710+/* { dg-require-visibility "" } */
711+/* { dg-options "-fvisibility=hidden" } */
712+/* { dg-final { scan-assembler "\\.hidden.*foo" } } */
713+
714+void foo();
715+
716+void foo() { }
717diff -Naur gcc-3.4.0orig/gcc/testsuite/gcc.dg/visibility-a.c gcc-3.4.0/gcc/testsuite/gcc.dg/visibility-a.c
718--- gcc-3.4.0orig/gcc/testsuite/gcc.dg/visibility-a.c 1970-01-01 01:00:00.000000000 +0100
719+++ gcc-3.4.0/gcc/testsuite/gcc.dg/visibility-a.c 2004-05-09 12:55:04.000000000 +0100
720@@ -0,0 +1,10 @@
721+/* Test that #pragma GCC visibility works. */
722+/* { dg-do compile } */
723+/* { dg-require-visibility "" } */
724+/* { dg-final { scan-assembler "\\.hidden.*foo" } } */
725+
726+#pragma GCC visibility push(hidden)
727+void foo();
728+#pragma GCC visibility pop
729+
730+void foo() { }
731diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility.C
732--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility.C 1970-01-01 01:00:00.000000000 +0100
733+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility.C 2004-05-09 19:17:13.000000000 +0100
734@@ -0,0 +1,12 @@
735+/* Test that -fvisibility affects class members. */
736+/* { dg-do compile } */
737+/* { dg-require-visibility "" } */
738+/* { dg-options "-fvisibility=hidden" } */
739+/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */
740+
741+class Foo
742+{
743+ void method();
744+};
745+
746+void Foo::method() { }
747diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden.C
748--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden.C 1970-01-01 01:00:00.000000000 +0100
749+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden.C 2004-05-09 19:17:59.000000000 +0100
750@@ -0,0 +1,18 @@
751+/* Test that -fvisibility-inlines-hidden affects class members. */
752+/* { dg-do compile } */
753+/* { dg-require-visibility "" } */
754+/* { dg-options "-fvisibility-inlines-hidden" } */
755+/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */
756+
757+class Foo
758+{
759+public:
760+ void method() { }
761+};
762+
763+int main(void)
764+{
765+ Foo f;
766+ f.method();
767+ return 0;
768+}
769diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override1.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override1.C
770--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override1.C 1970-01-01 01:00:00.000000000 +0100
771+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override1.C 2004-05-09 19:18:06.000000000 +0100
772@@ -0,0 +1,12 @@
773+/* Test that -fvisibility does not override class member specific settings. */
774+/* { dg-do compile } */
775+/* { dg-require-visibility "" } */
776+/* { dg-options "-fvisibility=hidden" } */
777+/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */
778+
779+class __attribute__ ((visibility ("internal"))) Foo
780+{
781+ void method();
782+};
783+
784+void Foo::method() { }
785diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override2.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override2.C
786--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override2.C 1970-01-01 01:00:00.000000000 +0100
787+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override2.C 2004-05-09 19:18:12.000000000 +0100
788@@ -0,0 +1,12 @@
789+/* Test that -fvisibility does not override class member specific settings. */
790+/* { dg-do compile } */
791+/* { dg-require-visibility "" } */
792+/* { dg-options "-fvisibility=hidden" } */
793+/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */
794+
795+class Foo
796+{
797+ __attribute__ ((visibility ("internal"))) void method();
798+};
799+
800+void Foo::method() { }
801diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/memfuncts.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/memfuncts.C
802--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/memfuncts.C 1970-01-01 01:00:00.000000000 +0100
803+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/memfuncts.C 2004-05-09 19:18:19.000000000 +0100
804@@ -0,0 +1,11 @@
805+/* Test that setting visibility for class member functions works. */
806+/* { dg-do compile } */
807+/* { dg-require-visibility "" } */
808+/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */
809+
810+class __attribute__ ((visibility ("hidden"))) Foo
811+{
812+ void method();
813+};
814+
815+void Foo::method() { }
816diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/noPLT.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/noPLT.C
817--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/noPLT.C 1970-01-01 01:00:00.000000000 +0100
818+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/noPLT.C 2004-05-09 19:21:49.000000000 +0100
819@@ -0,0 +1,20 @@
820+/* Test that -fvisibility=hidden prevents PLT. */
821+/* { dg-do compile } */
822+/* { dg-require-visibility "" } */
823+/* { dg-options "-fPIC -fvisibility=hidden" } */
824+/* { dg-final { scan-assembler-not "methodEv@PLT" } } */
825+
826+class Foo
827+{
828+public:
829+ void method();
830+};
831+
832+void Foo::method() { }
833+
834+int main(void)
835+{
836+ Foo f;
837+ f.method();
838+ return 0;
839+}
840diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma.C
841--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma.C 1970-01-01 01:00:00.000000000 +0100
842+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma.C 2004-05-09 19:18:30.000000000 +0100
843@@ -0,0 +1,13 @@
844+/* Test that #pragma GCC visibility affects class members. */
845+/* { dg-do compile } */
846+/* { dg-require-visibility "" } */
847+/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */
848+
849+#pragma GCC visibility push(hidden)
850+class Foo
851+{
852+ void method();
853+};
854+#pragma GCC visibility pop
855+
856+void Foo::method() { }
857diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C
858--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C 1970-01-01 01:00:00.000000000 +0100
859+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C 2004-05-09 19:18:36.000000000 +0100
860@@ -0,0 +1,13 @@
861+/* Test that #pragma GCC visibility does not override class member specific settings. */
862+/* { dg-do compile } */
863+/* { dg-require-visibility "" } */
864+/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */
865+
866+#pragma GCC visibility push(hidden)
867+class __attribute__ ((visibility ("internal"))) Foo
868+{
869+ void method();
870+};
871+#pragma GCC visibility pop
872+
873+void Foo::method() { }
874diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C
875--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C 1970-01-01 01:00:00.000000000 +0100
876+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C 2004-05-09 19:18:44.000000000 +0100
877@@ -0,0 +1,13 @@
878+/* Test that #pragma GCC visibility does not override class member specific settings. */
879+/* { dg-do compile } */
880+/* { dg-require-visibility "" } */
881+/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */
882+
883+#pragma GCC visibility push(hidden)
884+class Foo
885+{
886+ __attribute__ ((visibility ("internal"))) void method();
887+};
888+#pragma GCC visibility pop
889+
890+void Foo::method() { }
891diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/staticmemfuncts.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/staticmemfuncts.C
892--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/staticmemfuncts.C 1970-01-01 01:00:00.000000000 +0100
893+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/staticmemfuncts.C 2004-05-09 19:18:50.000000000 +0100
894@@ -0,0 +1,11 @@
895+/* Test that setting visibility for static class member functions works. */
896+/* { dg-do compile } */
897+/* { dg-require-visibility "" } */
898+/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */
899+
900+class __attribute__ ((visibility ("hidden"))) Foo
901+{
902+ static void method();
903+};
904+
905+void Foo::method() { }
906diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/virtual.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/virtual.C
907--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/virtual.C 1970-01-01 01:00:00.000000000 +0100
908+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/virtual.C 2004-05-09 13:24:06.000000000 +0100
909@@ -0,0 +1,11 @@
910+/* Test that setting visibility for class affects virtual table. */
911+/* { dg-do compile } */
912+/* { dg-require-visibility "" } */
913+/* { dg-final { scan-assembler "\\.hidden.*ZTV3Foo" } } */
914+
915+class __attribute__ ((visibility ("hidden"))) Foo
916+{
917+ virtual void method();
918+};
919+
920+void Foo::method() { }
921diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-1.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-1.C
922--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-1.C 1970-01-01 01:00:00.000000000 +0100
923+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-1.C 2003-12-10 06:34:44.000000000 +0000
924@@ -0,0 +1,8 @@
925+/* Test visibility attribute on function definition. */
926+/* { dg-do compile { target *86-*-linux* } } */
927+/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
928+
929+void
930+__attribute__((visibility ("hidden")))
931+foo()
932+{ }
933diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-2.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-2.C
934--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-2.C 1970-01-01 01:00:00.000000000 +0100
935+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-2.C 2003-12-10 06:34:44.000000000 +0000
936@@ -0,0 +1,7 @@
937+/* Test that visibility attribute on declaration extends to definition. */
938+/* { dg-do compile { target *86-*-linux* } } */
939+/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
940+
941+void __attribute__((visibility ("hidden"))) foo();
942+
943+void foo() { }
944diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-3.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-3.C
945--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-3.C 1970-01-01 01:00:00.000000000 +0100
946+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-3.C 2003-12-10 06:34:45.000000000 +0000
947@@ -0,0 +1,7 @@
948+/* Test visibility attribute on forward declaration of global variable */
949+/* { dg-do compile { target *86-*-linux* } } */
950+/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
951+
952+int
953+__attribute__((visibility ("hidden")))
954+xyzzy = 5;
955diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-4.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-4.C
956--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-4.C 1970-01-01 01:00:00.000000000 +0100
957+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-4.C 2003-12-10 06:34:45.000000000 +0000
958@@ -0,0 +1,8 @@
959+/* Test visibility attribute on forward declaration of global variable */
960+/* { dg-do compile { target *86-*-linux* } } */
961+/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
962+
963+extern int __attribute__ ((visibility ("hidden")))
964+xyzzy;
965+
966+int xyzzy = 5;
967diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-5.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-5.C
968--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-5.C 1970-01-01 01:00:00.000000000 +0100
969+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-5.C 2003-12-10 06:34:45.000000000 +0000
970@@ -0,0 +1,11 @@
971+/* Test visibility attribute on definition of a function that has
972+ already had a forward declaration. */
973+/* { dg-do compile { target *86-*-linux* } } */
974+/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
975+
976+void foo();
977+
978+void
979+ __attribute__((visibility ("hidden")))
980+foo()
981+{ }
982diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-6.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-6.C
983--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-6.C 1970-01-01 01:00:00.000000000 +0100
984+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-6.C 2003-12-10 06:34:45.000000000 +0000
985@@ -0,0 +1,10 @@
986+/* Test visibility attribute on definition of global variable that has
987+ already had a forward declaration. */
988+/* { dg-do compile { target *86-*-linux* } } */
989+/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
990+
991+extern int xyzzy;
992+
993+int
994+__attribute__((visibility ("hidden")))
995+xyzzy = 5;
996diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C
997--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C 1970-01-01 01:00:00.000000000 +0100
998+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C 2003-12-10 06:34:45.000000000 +0000
999@@ -0,0 +1,11 @@
1000+/* Test warning from conflicting visibility specifications. */
1001+/* { dg-do compile { target *86-*-linux* } } */
1002+/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
1003+
1004+extern int
1005+__attribute__((visibility ("hidden")))
1006+xyzzy; /* { dg-warning "previous declaration here" "" } */
1007+
1008+int
1009+__attribute__((visibility ("protected")))
1010+xyzzy = 5; /* { dg-warning "visibility attribute ignored" "" } */
1011diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-1.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-1.C
1012--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-1.C 2003-12-10 06:34:44.000000000 +0000
1013+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-1.C 1970-01-01 01:00:00.000000000 +0100
1014@@ -1,8 +0,0 @@
1015-/* Test visibility attribute on function definition. */
1016-/* { dg-do compile { target *86-*-linux* } } */
1017-/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
1018-
1019-void
1020-__attribute__((visibility ("hidden")))
1021-foo()
1022-{ }
1023diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-2.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-2.C
1024--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-2.C 2003-12-10 06:34:44.000000000 +0000
1025+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-2.C 1970-01-01 01:00:00.000000000 +0100
1026@@ -1,7 +0,0 @@
1027-/* Test that visibility attribute on declaration extends to definition. */
1028-/* { dg-do compile { target *86-*-linux* } } */
1029-/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
1030-
1031-void __attribute__((visibility ("hidden"))) foo();
1032-
1033-void foo() { }
1034diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-3.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-3.C
1035--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-3.C 2003-12-10 06:34:45.000000000 +0000
1036+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-3.C 1970-01-01 01:00:00.000000000 +0100
1037@@ -1,7 +0,0 @@
1038-/* Test visibility attribute on forward declaration of global variable */
1039-/* { dg-do compile { target *86-*-linux* } } */
1040-/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
1041-
1042-int
1043-__attribute__((visibility ("hidden")))
1044-xyzzy = 5;
1045diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-4.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-4.C
1046--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-4.C 2003-12-10 06:34:45.000000000 +0000
1047+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-4.C 1970-01-01 01:00:00.000000000 +0100
1048@@ -1,8 +0,0 @@
1049-/* Test visibility attribute on forward declaration of global variable */
1050-/* { dg-do compile { target *86-*-linux* } } */
1051-/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
1052-
1053-extern int __attribute__ ((visibility ("hidden")))
1054-xyzzy;
1055-
1056-int xyzzy = 5;
1057diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-5.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-5.C
1058--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-5.C 2003-12-10 06:34:45.000000000 +0000
1059+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-5.C 1970-01-01 01:00:00.000000000 +0100
1060@@ -1,11 +0,0 @@
1061-/* Test visibility attribute on definition of a function that has
1062- already had a forward declaration. */
1063-/* { dg-do compile { target *86-*-linux* } } */
1064-/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */
1065-
1066-void foo();
1067-
1068-void
1069- __attribute__((visibility ("hidden")))
1070-foo()
1071-{ }
1072diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-6.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-6.C
1073--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-6.C 2003-12-10 06:34:45.000000000 +0000
1074+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-6.C 1970-01-01 01:00:00.000000000 +0100
1075@@ -1,10 +0,0 @@
1076-/* Test visibility attribute on definition of global variable that has
1077- already had a forward declaration. */
1078-/* { dg-do compile { target *86-*-linux* } } */
1079-/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
1080-
1081-extern int xyzzy;
1082-
1083-int
1084-__attribute__((visibility ("hidden")))
1085-xyzzy = 5;
1086diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-7.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-7.C
1087--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-7.C 2003-12-10 06:34:45.000000000 +0000
1088+++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-7.C 1970-01-01 01:00:00.000000000 +0100
1089@@ -1,11 +0,0 @@
1090-/* Test warning from conflicting visibility specifications. */
1091-/* { dg-do compile { target *86-*-linux* } } */
1092-/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
1093-
1094-extern int
1095-__attribute__((visibility ("hidden")))
1096-xyzzy; /* { dg-warning "previous declaration here" "" } */
1097-
1098-int
1099-__attribute__((visibility ("protected")))
1100-xyzzy = 5; /* { dg-warning "visibility attribute ignored" "" } */
diff --git a/meta/packages/gcc/gcc-3.4.3/always-fixincperm.patch b/meta/packages/gcc/gcc-3.4.3/always-fixincperm.patch
new file mode 100644
index 0000000000..59e5e2edeb
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.3/always-fixincperm.patch
@@ -0,0 +1,32 @@
1Index: gcc-3.4.3/gcc/configure
2===================================================================
3--- gcc-3.4.3.orig/gcc/configure 2004-11-04 23:14:05.000000000 -0500
4+++ gcc-3.4.3/gcc/configure 2005-03-11 14:41:06.373910320 -0500
5@@ -9916,11 +9916,6 @@
6 BUILD_PREFIX=build-
7 BUILD_PREFIX_1=build-
8 BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
9-
10- if test "x$TARGET_SYSTEM_ROOT" = x; then
11- STMP_FIXINC=
12- STMP_FIXPROTO=
13- fi
14 fi
15
16 # Expand extra_headers to include complete path.
17Index: gcc-3.4.3/gcc/configure.ac
18===================================================================
19--- gcc-3.4.3.orig/gcc/configure.ac 2004-09-23 20:43:53.000000000 -0400
20+++ gcc-3.4.3/gcc/configure.ac 2005-03-11 14:40:55.256600408 -0500
21@@ -1524,11 +1524,6 @@
22 BUILD_PREFIX=build-
23 BUILD_PREFIX_1=build-
24 BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
25-
26- if test "x$TARGET_SYSTEM_ROOT" = x; then
27- STMP_FIXINC=
28- STMP_FIXPROTO=
29- fi
30 fi
31
32 # Expand extra_headers to include complete path.
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-bigendian-uclibc.patch b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-bigendian-uclibc.patch
new file mode 100644
index 0000000000..8fa9af880a
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-bigendian-uclibc.patch
@@ -0,0 +1,30 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- gcc-3.4.1/gcc/config.gcc~gcc-3.4.0-arm-bigendian-uclibc
7+++ gcc-3.4.1/gcc/config.gcc
8@@ -666,6 +666,11 @@
9 ;;
10 arm*-*-linux-uclibc*) # ARM GNU/Linux with ELF - uClibc
11 tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h"
12+ case $target in
13+ arm*b-*)
14+ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines"
15+ ;;
16+ esac
17 tmake_file="t-slibgcc-elf-ver t-linux-uclibc arm/t-linux"
18 extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
19 gnu_ld=yes
20--- gcc-3.4.1/gcc/config/arm/linux-elf.h~gcc-3.4.0-arm-bigendian-uclibc
21+++ gcc-3.4.1/gcc/config/arm/linux-elf.h
22@@ -120,7 +120,7 @@
23 %{rdynamic:-export-dynamic} \
24 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
25 -X \
26- %{mbig-endian:-EB}" \
27+ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
28 SUBTARGET_EXTRA_LINK_SPEC
29 #endif
30
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-bigendian.patch b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-bigendian.patch
new file mode 100644
index 0000000000..c9288c6c15
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-bigendian.patch
@@ -0,0 +1,70 @@
1By Lennert Buytenhek <buytenh@wantstofly.org>
2Adds support for arm*b-linux* big-endian ARM targets
3
4See http://gcc.gnu.org/PR16350
5
6diff -urN gcc-3.4.0.orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h
7--- gcc-3.4.0.orig/gcc/config/arm/linux-elf.h 2004-01-31 07:18:11.000000000 +0100
8+++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-07-02 14:46:29.225443757 +0200
9@@ -30,17 +30,34 @@
10 /* Do not assume anything about header files. */
11 #define NO_IMPLICIT_EXTERN_C
12
13+/*
14+ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
15+ * (big endian) configurations.
16+ */
17+#if TARGET_BIG_ENDIAN_DEFAULT
18+#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END
19+#define TARGET_ENDIAN_OPTION "mbig-endian"
20+#define TARGET_LINKER_EMULATION "armelfb_linux"
21+#else
22+#define TARGET_ENDIAN_DEFAULT 0
23+#define TARGET_ENDIAN_OPTION "mlittle-endian"
24+#define TARGET_LINKER_EMULATION "armelf_linux"
25+#endif
26+
27 /* Default is to use APCS-32 mode. */
28 #undef TARGET_DEFAULT
29-#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS)
30+#define TARGET_DEFAULT \
31+ ( ARM_FLAG_APCS_32 | \
32+ ARM_FLAG_MMU_TRAPS | \
33+ TARGET_ENDIAN_DEFAULT )
34
35 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
36
37-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
38+#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
39
40 #undef MULTILIB_DEFAULTS
41 #define MULTILIB_DEFAULTS \
42- { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" }
43+ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" }
44
45 #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
46
47@@ -89,7 +106,7 @@
48 %{rdynamic:-export-dynamic} \
49 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
50 -X \
51- %{mbig-endian:-EB}" \
52+ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
53 SUBTARGET_EXTRA_LINK_SPEC
54
55 #define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS()
56diff -urN gcc-3.4.0.orig/gcc/config.gcc gcc-3.4.0/gcc/config.gcc
57--- gcc-3.4.0.orig/gcc/config.gcc 2004-04-17 04:28:24.000000000 +0200
58+++ gcc-3.4.0/gcc/config.gcc 2004-07-02 14:44:40.045822542 +0200
59@@ -666,6 +666,11 @@
60 ;;
61 arm*-*-linux*) # ARM GNU/Linux with ELF
62 tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h"
63+ case $target in
64+ arm*b-*)
65+ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines"
66+ ;;
67+ esac
68 tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux"
69 extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
70 gnu_ld=yes
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-lib1asm.patch b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-lib1asm.patch
new file mode 100644
index 0000000000..ca42bfbc0a
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-lib1asm.patch
@@ -0,0 +1,24 @@
1# Fixes errors like the following when building glibc (or any other executable
2# or shared library) when using gcc 3.4.0 for ARM with softfloat:
3#
4# .../libc_pic.os(.text+0x15834): In function `__modf': undefined reference to `__subdf3'
5# .../libc_pic.os(.text+0x158b8): In function `__modf': undefined reference to `__subdf3'
6# .../libc_pic.os(.text+0x1590c): In function `scalbn': undefined reference to `__muldf3'
7# .../libc_pic.os(.text+0x15e94): In function `__ldexpf': undefined reference to `__eqsf2'
8# .../libc_pic.os(.text+0xcee4c): In function `monstartup': undefined reference to `__fixsfsi'
9
10diff -urNd gcc-3.4.0-orig/gcc/config/arm/t-linux gcc-3.4.0/gcc/config/arm/t-linux
11--- gcc-3.4.0-orig/gcc/config/arm/t-linux 2003-09-20 23:09:07.000000000 +0200
12+++ gcc-3.4.0/gcc/config/arm/t-linux 2004-05-01 20:31:59.102846400 +0200
13@@ -4,7 +4,10 @@
14 LIBGCC2_DEBUG_CFLAGS = -g0
15
16 LIB1ASMSRC = arm/lib1funcs.asm
17-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx
18+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
19+ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
20+ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
21+ _fixsfsi _fixunssfsi
22
23 # MULTILIB_OPTIONS = mhard-float/msoft-float
24 # MULTILIB_DIRNAMES = hard-float soft-float
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-nolibfloat.patch b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-nolibfloat.patch
new file mode 100644
index 0000000000..43eed3ef28
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-nolibfloat.patch
@@ -0,0 +1,24 @@
1# Dimitry Andric <dimitry@andric.com>, 2004-05-01
2#
3# * Removed the extra -lfloat option from LIBGCC_SPEC, since it isn't needed
4# anymore. (The required functions are now in libgcc.)
5#
6# Fixes errors like
7# arm-softfloat-linux-gnu/3.4.0/../../../../arm-softfloat-linux-gnu/bin/ld: cannot find -lfloat
8# collect2: ld returned 1 exit status
9# make[2]: *** [arm-softfloat-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/iconvdata/ISO8859-1.so] Error 1
10# when building glibc-2.3.3 with gcc-3.4.0 for arm-softfloat
11
12diff -urNd gcc-3.4.0-orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h
13--- gcc-3.4.0-orig/gcc/config/arm/linux-elf.h 2004-01-31 07:18:11.000000000 +0100
14+++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-05-01 19:19:06.935979200 +0200
15@@ -55,7 +73,7 @@
16 %{shared:-lc} \
17 %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
18
19-#define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc"
20+#define LIBGCC_SPEC "-lgcc"
21
22 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add
23 the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
24
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-softfloat.patch b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-softfloat.patch
new file mode 100644
index 0000000000..f53d64b374
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.0-arm-softfloat.patch
@@ -0,0 +1,256 @@
1#
2# Submitted:
3#
4# Dimitry Andric <dimitry@andric.com>, 2004-05-01
5#
6# Description:
7#
8# Nicholas Pitre released this patch for gcc soft-float support here:
9# http://lists.arm.linux.org.uk/pipermail/linux-arm/2003-October/006436.html
10#
11# This version has been adapted to work with gcc 3.4.0.
12#
13# The original patch doesn't distinguish between softfpa and softvfp modes
14# in the way Nicholas Pitre probably meant. His description is:
15#
16# "Default is to use APCS-32 mode with soft-vfp. The old Linux default for
17# floats can be achieved with -mhard-float or with the configure
18# --with-float=hard option. If -msoft-float or --with-float=soft is used then
19# software float support will be used just like the default but with the legacy
20# big endian word ordering for double float representation instead."
21#
22# Which means the following:
23#
24# * If you compile without -mhard-float or -msoft-float, you should get
25# software floating point, using the VFP format. The produced object file
26# should have these flags in its header:
27#
28# private flags = 600: [APCS-32] [VFP float format] [software FP]
29#
30# * If you compile with -mhard-float, you should get hardware floating point,
31# which always uses the FPA format. Object file header flags should be:
32#
33# private flags = 0: [APCS-32] [FPA float format]
34#
35# * If you compile with -msoft-float, you should get software floating point,
36# using the FPA format. This is done for compatibility reasons with many
37# existing distributions. Object file header flags should be:
38#
39# private flags = 200: [APCS-32] [FPA float format] [software FP]
40#
41# The original patch from Nicholas Pitre contained the following constructs:
42#
43# #define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \
44# %{mhard-float:-mfpu=fpa} \
45# %{!mhard-float: %{msoft-float:-mfpu=softfpa;:-mfpu=softvfp}}"
46#
47# However, gcc doesn't accept this ";:" notation, used in the 3rd line. This
48# is probably the reason Robert Schwebel modified it to:
49#
50# #define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \
51# %{mhard-float:-mfpu=fpa} \
52# %{!mhard-float: %{msoft-float:-mfpu=softfpa -mfpu=softvfp}}"
53#
54# But this causes the following behaviour:
55#
56# * If you compile without -mhard-float or -msoft-float, the compiler generates
57# software floating point instructions, but *nothing* is passed to the
58# assembler, which results in an object file which has flags:
59#
60# private flags = 0: [APCS-32] [FPA float format]
61#
62# This is not correct!
63#
64# * If you compile with -mhard-float, the compiler generates hardware floating
65# point instructions, and passes "-mfpu=fpa" to the assembler, which results
66# in an object file which has the same flags as in the previous item, but now
67# those *are* correct.
68#
69# * If you compile with -msoft-float, the compiler generates software floating
70# point instructions, and passes "-mfpu=softfpa -mfpu=softvfp" (in that
71# order) to the assembler, which results in an object file with flags:
72#
73# private flags = 600: [APCS-32] [VFP float format] [software FP]
74#
75# This is not correct, because the last "-mfpu=" option on the assembler
76# command line determines the actual FPU convention used (which should be FPA
77# in this case).
78#
79# Therefore, I modified this patch to get the desired behaviour. Every
80# instance of the notation:
81#
82# %{msoft-float:-mfpu=softfpa -mfpu=softvfp}
83#
84# was changed to:
85#
86# %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}
87#
88# I also did the following:
89#
90# * Modified all TARGET_DEFAULT macros I could find to include ARM_FLAG_VFP, to
91# be consistent with Nicholas' original patch.
92# * Removed any "msoft-float" or "mhard-float" from all MULTILIB_DEFAULTS
93# macros I could find. I think that if you compile without any options, you
94# would like to get the defaults. :)
95# * Removed the extra -lfloat option from LIBGCC_SPEC, since it isn't needed
96# anymore. (The required functions are now in libgcc.)
97
98diff -urNd gcc-3.4.0-orig/gcc/config/arm/coff.h gcc-3.4.0/gcc/config/arm/coff.h
99--- gcc-3.4.0-orig/gcc/config/arm/coff.h 2004-02-24 15:25:22.000000000 +0100
100+++ gcc-3.4.0/gcc/config/arm/coff.h 2004-05-01 19:07:06.059409600 +0200
101@@ -31,11 +31,16 @@
102 #define TARGET_VERSION fputs (" (ARM/coff)", stderr)
103
104 #undef TARGET_DEFAULT
105-#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS)
106+#define TARGET_DEFAULT \
107+ ( ARM_FLAG_SOFT_FLOAT \
108+ | ARM_FLAG_VFP \
109+ | ARM_FLAG_APCS_32 \
110+ | ARM_FLAG_APCS_FRAME \
111+ | ARM_FLAG_MMU_TRAPS )
112
113 #ifndef MULTILIB_DEFAULTS
114 #define MULTILIB_DEFAULTS \
115- { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork" }
116+ { "marm", "mlittle-endian", "mapcs-32", "mno-thumb-interwork" }
117 #endif
118
119 /* This is COFF, but prefer stabs. */
120diff -urNd gcc-3.4.0-orig/gcc/config/arm/elf.h gcc-3.4.0/gcc/config/arm/elf.h
121--- gcc-3.4.0-orig/gcc/config/arm/elf.h 2004-02-24 15:25:22.000000000 +0100
122+++ gcc-3.4.0/gcc/config/arm/elf.h 2004-05-01 19:12:16.976486400 +0200
123@@ -46,7 +46,9 @@
124
125 #ifndef SUBTARGET_ASM_FLOAT_SPEC
126 #define SUBTARGET_ASM_FLOAT_SPEC "\
127-%{mapcs-float:-mfloat} %{msoft-float:-mfpu=softfpa}"
128+%{mapcs-float:-mfloat} \
129+%{mhard-float:-mfpu=fpa} \
130+%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}"
131 #endif
132
133 #ifndef ASM_SPEC
134@@ -106,12 +108,17 @@
135 #endif
136
137 #ifndef TARGET_DEFAULT
138-#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS)
139+#define TARGET_DEFAULT \
140+ ( ARM_FLAG_SOFT_FLOAT \
141+ | ARM_FLAG_VFP \
142+ | ARM_FLAG_APCS_32 \
143+ | ARM_FLAG_APCS_FRAME \
144+ | ARM_FLAG_MMU_TRAPS )
145 #endif
146
147 #ifndef MULTILIB_DEFAULTS
148 #define MULTILIB_DEFAULTS \
149- { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork", "fno-leading-underscore" }
150+ { "marm", "mlittle-endian", "mapcs-32", "mno-thumb-interwork", "fno-leading-underscore" }
151 #endif
152
153 #define TARGET_ASM_FILE_START_APP_OFF true
154diff -urNd gcc-3.4.0-orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h
155--- gcc-3.4.0-orig/gcc/config/arm/linux-elf.h 2004-01-31 07:18:11.000000000 +0100
156+++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-05-01 19:19:06.935979200 +0200
157@@ -30,9 +30,27 @@
158 /* Do not assume anything about header files. */
159 #define NO_IMPLICIT_EXTERN_C
160
161-/* Default is to use APCS-32 mode. */
162+/*
163+ * Default is to use APCS-32 mode with soft-vfp.
164+ * The old Linux default for floats can be achieved with -mhard-float
165+ * or with the configure --with-float=hard option.
166+ * If -msoft-float or --with-float=soft is used then software float
167+ * support will be used just like the default but with the legacy
168+ * big endian word ordering for double float representation instead.
169+ */
170+
171 #undef TARGET_DEFAULT
172-#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS)
173+#define TARGET_DEFAULT \
174+ ( ARM_FLAG_APCS_32 \
175+ | ARM_FLAG_SOFT_FLOAT \
176+ | ARM_FLAG_VFP \
177+ | ARM_FLAG_MMU_TRAPS )
178+
179+#undef SUBTARGET_EXTRA_ASM_SPEC
180+#define SUBTARGET_EXTRA_ASM_SPEC "\
181+%{!mcpu=*:-mcpu=xscale} \
182+%{mhard-float:-mfpu=fpa} \
183+%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}"
184
185 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
186
187@@ -40,7 +58,7 @@
188
189 #undef MULTILIB_DEFAULTS
190 #define MULTILIB_DEFAULTS \
191- { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" }
192+ { "marm", "mlittle-endian", "mapcs-32", "mno-thumb-interwork" }
193
194 #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
195
196@@ -55,7 +73,7 @@
197 %{shared:-lc} \
198 %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
199
200-#define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc"
201+#define LIBGCC_SPEC "-lgcc"
202
203 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add
204 the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
205diff -urNd gcc-3.4.0-orig/gcc/config/arm/t-linux gcc-3.4.0/gcc/config/arm/t-linux
206--- gcc-3.4.0-orig/gcc/config/arm/t-linux 2003-09-20 23:09:07.000000000 +0200
207+++ gcc-3.4.0/gcc/config/arm/t-linux 2004-05-01 20:31:59.102846400 +0200
208@@ -4,7 +4,10 @@
209 LIBGCC2_DEBUG_CFLAGS = -g0
210
211 LIB1ASMSRC = arm/lib1funcs.asm
212-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx
213+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
214+ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
215+ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
216+ _fixsfsi _fixunssfsi
217
218 # MULTILIB_OPTIONS = mhard-float/msoft-float
219 # MULTILIB_DIRNAMES = hard-float soft-float
220diff -urNd gcc-3.4.0-orig/gcc/config/arm/unknown-elf.h gcc-3.4.0/gcc/config/arm/unknown-elf.h
221--- gcc-3.4.0-orig/gcc/config/arm/unknown-elf.h 2004-02-24 15:25:22.000000000 +0100
222+++ gcc-3.4.0/gcc/config/arm/unknown-elf.h 2004-05-01 19:09:09.016212800 +0200
223@@ -30,7 +30,12 @@
224
225 /* Default to using APCS-32 and software floating point. */
226 #ifndef TARGET_DEFAULT
227-#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS)
228+#define TARGET_DEFAULT \
229+ ( ARM_FLAG_SOFT_FLOAT \
230+ | ARM_FLAG_VFP \
231+ | ARM_FLAG_APCS_32 \
232+ | ARM_FLAG_APCS_FRAME \
233+ | ARM_FLAG_MMU_TRAPS )
234 #endif
235
236 /* Now we define the strings used to build the spec file. */
237diff -urNd gcc-3.4.0-orig/gcc/config/arm/xscale-elf.h gcc-3.4.0/gcc/config/arm/xscale-elf.h
238--- gcc-3.4.0-orig/gcc/config/arm/xscale-elf.h 2003-07-02 01:26:43.000000000 +0200
239+++ gcc-3.4.0/gcc/config/arm/xscale-elf.h 2004-05-01 20:15:36.620105600 +0200
240@@ -49,11 +49,12 @@
241 endian, regardless of the endian-ness of the memory
242 system. */
243
244-#define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \
245- %{mhard-float:-mfpu=fpa} \
246- %{!mhard-float: %{msoft-float:-mfpu=softfpa;:-mfpu=softvfp}}"
247+#define SUBTARGET_EXTRA_ASM_SPEC "\
248+%{!mcpu=*:-mcpu=xscale} \
249+%{mhard-float:-mfpu=fpa} \
250+%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}"
251
252 #ifndef MULTILIB_DEFAULTS
253 #define MULTILIB_DEFAULTS \
254- { "mlittle-endian", "mno-thumb-interwork", "marm", "msoft-float" }
255+ { "mlittle-endian", "mno-thumb-interwork", "marm" }
256 #endif
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.1-uclibc-100-conf.patch b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.1-uclibc-100-conf.patch
new file mode 100644
index 0000000000..29e4c802e2
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.1-uclibc-100-conf.patch
@@ -0,0 +1,442 @@
1diff -urN gcc-3.4.1-dist/boehm-gc/configure gcc-3.4.1/boehm-gc/configure
2--- gcc-3.4.1-dist/boehm-gc/configure 2004-07-01 14:14:03.000000000 -0500
3+++ gcc-3.4.1/boehm-gc/configure 2004-08-12 16:22:57.000000000 -0500
4@@ -1947,6 +1947,11 @@
5 lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
6 ;;
7
8+linux-uclibc*)
9+ lt_cv_deplibs_check_method=pass_all
10+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
11+ ;;
12+
13 netbsd*)
14 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
15 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
16diff -urN gcc-3.4.1-dist/boehm-gc/ltconfig gcc-3.4.1/boehm-gc/ltconfig
17--- gcc-3.4.1-dist/boehm-gc/ltconfig 2002-11-20 09:59:06.000000000 -0600
18+++ gcc-3.4.1/boehm-gc/ltconfig 2004-08-12 15:54:42.000000000 -0500
19@@ -1981,6 +1981,23 @@
20 fi
21 ;;
22
23+linux-uclibc*)
24+ version_type=linux
25+ need_lib_prefix=no
26+ need_version=no
27+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
28+ soname_spec='${libname}${release}.so$major'
29+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
30+ shlibpath_var=LD_LIBRARY_PATH
31+ shlibpath_overrides_runpath=no
32+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
33+ file_magic_cmd=/usr/bin/file
34+ file_magic_test_file=`echo /lib/libuClibc-*.so`
35+
36+ # Assume using the uClibc dynamic linker.
37+ dynamic_linker="uClibc ld.so"
38+ ;;
39+
40 netbsd*)
41 version_type=sunos
42 if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
43diff -urN gcc-3.4.1-dist/gcc/config/arm/linux-elf.h gcc-3.4.1/gcc/config/arm/linux-elf.h
44--- gcc-3.4.1-dist/gcc/config/arm/linux-elf.h 2004-01-31 00:18:11.000000000 -0600
45+++ gcc-3.4.1/gcc/config/arm/linux-elf.h 2004-08-12 15:54:42.000000000 -0500
46@@ -81,6 +81,18 @@
47 "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
48
49 #undef LINK_SPEC
50+#ifdef USE_UCLIBC
51+#define LINK_SPEC "%{h*} %{version:-v} \
52+ %{b} %{Wl,*:%*} \
53+ %{static:-Bstatic} \
54+ %{shared:-shared} \
55+ %{symbolic:-Bsymbolic} \
56+ %{rdynamic:-export-dynamic} \
57+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0} \
58+ -X \
59+ %{mbig-endian:-EB}" \
60+ SUBTARGET_EXTRA_LINK_SPEC
61+#else
62 #define LINK_SPEC "%{h*} %{version:-v} \
63 %{b} %{Wl,*:%*} \
64 %{static:-Bstatic} \
65@@ -91,6 +103,7 @@
66 -X \
67 %{mbig-endian:-EB}" \
68 SUBTARGET_EXTRA_LINK_SPEC
69+#endif
70
71 #define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS()
72
73diff -urN gcc-3.4.1-dist/gcc/config/cris/linux.h gcc-3.4.1/gcc/config/cris/linux.h
74--- gcc-3.4.1-dist/gcc/config/cris/linux.h 2003-11-28 21:08:09.000000000 -0600
75+++ gcc-3.4.1/gcc/config/cris/linux.h 2004-08-12 15:54:43.000000000 -0500
76@@ -79,6 +79,25 @@
77 #undef CRIS_DEFAULT_CPU_VERSION
78 #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
79
80+#ifdef USE_UCLIBC
81+
82+#undef CRIS_SUBTARGET_VERSION
83+#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc"
84+
85+#undef CRIS_LINK_SUBTARGET_SPEC
86+#define CRIS_LINK_SUBTARGET_SPEC \
87+ "-mcrislinux\
88+ -rpath-link include/asm/../..%s\
89+ %{shared} %{static}\
90+ %{symbolic:-Bdynamic} %{shlib:-Bdynamic} %{static:-Bstatic}\
91+ %{!shared: \
92+ %{!static: \
93+ %{rdynamic:-export-dynamic} \
94+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} \
95+ %{!r:%{O2|O3: --gc-sections}}"
96+
97+#else /* USE_UCLIBC */
98+
99 #undef CRIS_SUBTARGET_VERSION
100 #define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
101
102@@ -93,6 +112,8 @@
103 %{!shared:%{!static:%{rdynamic:-export-dynamic}}}\
104 %{!r:%{O2|O3: --gc-sections}}"
105
106+#endif /* USE_UCLIBC */
107+
108
109 /* Node: Run-time Target */
110
111diff -urN gcc-3.4.1-dist/gcc/config/cris/t-linux-uclibc gcc-3.4.1/gcc/config/cris/t-linux-uclibc
112--- gcc-3.4.1-dist/gcc/config/cris/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600
113+++ gcc-3.4.1/gcc/config/cris/t-linux-uclibc 2004-08-12 15:54:43.000000000 -0500
114@@ -0,0 +1,3 @@
115+T_CFLAGS = -DUSE_UCLIBC
116+TARGET_LIBGCC2_CFLAGS += -fPIC
117+CRTSTUFF_T_CFLAGS_S = $(TARGET_LIBGCC2_CFLAGS)
118diff -urN gcc-3.4.1-dist/gcc/config/i386/linux.h gcc-3.4.1/gcc/config/i386/linux.h
119--- gcc-3.4.1-dist/gcc/config/i386/linux.h 2003-11-28 21:08:10.000000000 -0600
120+++ gcc-3.4.1/gcc/config/i386/linux.h 2004-08-12 15:54:43.000000000 -0500
121@@ -118,6 +118,15 @@
122 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \
123 %{static:-static}}}"
124 #else
125+#if defined USE_UCLIBC
126+#define LINK_SPEC "-m elf_i386 %{shared:-shared} \
127+ %{!shared: \
128+ %{!ibcs: \
129+ %{!static: \
130+ %{rdynamic:-export-dynamic} \
131+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
132+ %{static:-static}}}"
133+#else
134 #define LINK_SPEC "-m elf_i386 %{shared:-shared} \
135 %{!shared: \
136 %{!ibcs: \
137@@ -126,6 +135,7 @@
138 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
139 %{static:-static}}}"
140 #endif
141+#endif
142
143 /* A C statement (sans semicolon) to output to the stdio stream
144 FILE the assembler definition of uninitialized global DECL named
145diff -urN gcc-3.4.1-dist/gcc/config/mips/linux.h gcc-3.4.1/gcc/config/mips/linux.h
146--- gcc-3.4.1-dist/gcc/config/mips/linux.h 2004-06-15 20:42:24.000000000 -0500
147+++ gcc-3.4.1/gcc/config/mips/linux.h 2004-08-12 15:54:43.000000000 -0500
148@@ -109,6 +109,17 @@
149
150 /* Borrowed from sparc/linux.h */
151 #undef LINK_SPEC
152+#ifdef USE_UCLIBC
153+#define LINK_SPEC \
154+ "%(endian_spec) \
155+ %{shared:-shared} \
156+ %{!shared: \
157+ %{!ibcs: \
158+ %{!static: \
159+ %{rdynamic:-export-dynamic} \
160+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
161+ %{static:-static}}}"
162+#else
163 #define LINK_SPEC \
164 "%(endian_spec) \
165 %{shared:-shared} \
166@@ -118,6 +129,7 @@
167 %{rdynamic:-export-dynamic} \
168 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
169 %{static:-static}}}"
170+#endif
171
172 #undef SUBTARGET_ASM_SPEC
173 #define SUBTARGET_ASM_SPEC "\
174diff -urN gcc-3.4.1-dist/gcc/config/rs6000/linux.h gcc-3.4.1/gcc/config/rs6000/linux.h
175--- gcc-3.4.1-dist/gcc/config/rs6000/linux.h 2004-02-25 09:11:19.000000000 -0600
176+++ gcc-3.4.1/gcc/config/rs6000/linux.h 2004-08-12 15:54:43.000000000 -0500
177@@ -61,7 +61,11 @@
178 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
179
180 #undef LINK_OS_DEFAULT_SPEC
181+#ifdef USE_UCLIBC
182+#define LINK_OS_DEFAULT_SPEC "%(link_os_linux_uclibc)"
183+#else
184 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
185+#endif
186
187 #define LINK_GCC_C_SEQUENCE_SPEC \
188 "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
189diff -urN gcc-3.4.1-dist/gcc/config/rs6000/sysv4.h gcc-3.4.1/gcc/config/rs6000/sysv4.h
190--- gcc-3.4.1-dist/gcc/config/rs6000/sysv4.h 2004-06-10 01:39:50.000000000 -0500
191+++ gcc-3.4.1/gcc/config/rs6000/sysv4.h 2004-08-12 15:54:43.000000000 -0500
192@@ -947,6 +947,7 @@
193 mcall-linux : %(link_os_linux) ; \
194 mcall-gnu : %(link_os_gnu) ; \
195 mcall-netbsd : %(link_os_netbsd) ; \
196+ mcall-linux-uclibc : %(link_os_linux_uclibc); \
197 mcall-openbsd: %(link_os_openbsd) ; \
198 : %(link_os_default) }"
199
200@@ -1124,6 +1125,10 @@
201 %{rdynamic:-export-dynamic} \
202 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
203
204+#define LINK_OS_LINUX_UCLIBC_SPEC "-m elf32ppclinux %{!shared: %{!static: \
205+ %{rdynamic:-export-dynamic} \
206+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}}"
207+
208 #if defined(HAVE_LD_EH_FRAME_HDR)
209 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
210 #endif
211@@ -1290,6 +1295,7 @@
212 { "link_os_sim", LINK_OS_SIM_SPEC }, \
213 { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
214 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
215+ { "link_os_linux_uclibc", LINK_OS_LINUX_UCLIBC_SPEC }, \
216 { "link_os_gnu", LINK_OS_GNU_SPEC }, \
217 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
218 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
219diff -urN gcc-3.4.1-dist/gcc/config/sh/linux.h gcc-3.4.1/gcc/config/sh/linux.h
220--- gcc-3.4.1-dist/gcc/config/sh/linux.h 2004-01-11 20:29:13.000000000 -0600
221+++ gcc-3.4.1/gcc/config/sh/linux.h 2004-08-12 15:54:43.000000000 -0500
222@@ -73,12 +73,21 @@
223 #undef SUBTARGET_LINK_EMUL_SUFFIX
224 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
225 #undef SUBTARGET_LINK_SPEC
226+#ifdef USE_UCLIBC
227+#define SUBTARGET_LINK_SPEC \
228+ "%{shared:-shared} \
229+ %{!static: \
230+ %{rdynamic:-export-dynamic} \
231+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
232+ %{static:-static}"
233+#else
234 #define SUBTARGET_LINK_SPEC \
235 "%{shared:-shared} \
236 %{!static: \
237 %{rdynamic:-export-dynamic} \
238 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
239 %{static:-static}"
240+#endif
241
242 #undef LIB_SPEC
243 #define LIB_SPEC \
244diff -urN gcc-3.4.1-dist/gcc/config/sh/t-linux-uclibc gcc-3.4.1/gcc/config/sh/t-linux-uclibc
245--- gcc-3.4.1-dist/gcc/config/sh/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600
246+++ gcc-3.4.1/gcc/config/sh/t-linux-uclibc 2004-08-12 15:54:43.000000000 -0500
247@@ -0,0 +1,13 @@
248+T_CFLAGS = -DUSE_UCLIBC
249+
250+TARGET_LIBGCC2_CFLAGS = -fpic -DNO_FPSCR_VALUES
251+LIB1ASMFUNCS_CACHE = _ic_invalidate
252+
253+LIB2FUNCS_EXTRA=
254+
255+MULTILIB_OPTIONS= $(MULTILIB_ENDIAN) m3e/m4
256+MULTILIB_DIRNAMES=
257+MULTILIB_MATCHES =
258+MULTILIB_EXCEPTIONS=
259+
260+EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
261diff -urN gcc-3.4.1-dist/gcc/config/sh/t-sh64-uclibc gcc-3.4.1/gcc/config/sh/t-sh64-uclibc
262--- gcc-3.4.1-dist/gcc/config/sh/t-sh64-uclibc 1969-12-31 18:00:00.000000000 -0600
263+++ gcc-3.4.1/gcc/config/sh/t-sh64-uclibc 2004-08-12 15:54:43.000000000 -0500
264@@ -0,0 +1,13 @@
265+EXTRA_MULTILIB_PARTS= crt1.o crti.o crtn.o crtbegin.o crtend.o
266+
267+LIB1ASMFUNCS = \
268+ _sdivsi3 _sdivsi3_i4 _udivsi3 _udivsi3_i4 _set_fpscr \
269+ _shcompact_call_trampoline _shcompact_return_trampoline \
270+ _shcompact_incoming_args _ic_invalidate _nested_trampoline \
271+ _push_pop_shmedia_regs \
272+ _udivdi3 _divdi3 _umoddi3 _moddi3
273+
274+MULTILIB_OPTIONS = $(MULTILIB_ENDIAN) m5-32media-nofpu/m5-compact/m5-compact-nofpu/m5-64media/m5-64media-nofpu
275+MULTILIB_DIRNAMES= $(MULTILIB_ENDIAN) nofpu compact nofpu/compact media64 nofpu/media64
276+MULTILIB_MATCHES=
277+MULTILIB_EXCEPTIONS=
278diff -urN gcc-3.4.1-dist/gcc/config/t-linux-uclibc gcc-3.4.1/gcc/config/t-linux-uclibc
279--- gcc-3.4.1-dist/gcc/config/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600
280+++ gcc-3.4.1/gcc/config/t-linux-uclibc 2004-08-12 15:54:43.000000000 -0500
281@@ -0,0 +1,15 @@
282+T_CFLAGS = -DUSE_UCLIBC
283+
284+# Compile crtbeginS.o and crtendS.o with pic.
285+CRTSTUFF_T_CFLAGS_S = $(CRTSTUFF_T_CFLAGS) -fPIC
286+# Compile libgcc2.a with pic.
287+TARGET_LIBGCC2_CFLAGS = -fPIC
288+
289+# Override t-slibgcc-elf-ver to export some libgcc symbols with
290+# the symbol versions that glibc used.
291+#SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver
292+
293+# Use unwind-dw2-fde
294+LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \
295+ $(srcdir)/unwind-sjlj.c $(srcdir)/gthr-gnat.c $(srcdir)/unwind-c.c
296+LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h
297diff -urN gcc-3.4.1-dist/gcc/config.gcc gcc-3.4.1/gcc/config.gcc
298--- gcc-3.4.1-dist/gcc/config.gcc 2004-04-21 10:12:35.000000000 -0500
299+++ gcc-3.4.1/gcc/config.gcc 2004-08-12 15:59:46.000000000 -0500
300@@ -664,6 +664,12 @@
301 extra_parts=""
302 use_collect2=yes
303 ;;
304+arm*-*-linux-uclibc*) # ARM GNU/Linux with ELF - uClibc
305+ tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h"
306+ tmake_file="t-slibgcc-elf-ver t-linux-uclibc arm/t-linux"
307+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
308+ gnu_ld=yes
309+ ;;
310 arm*-*-linux*) # ARM GNU/Linux with ELF
311 tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h"
312 tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux"
313@@ -725,6 +731,10 @@
314 tmake_file="cris/t-cris cris/t-elfmulti"
315 gas=yes
316 ;;
317+cris-*-linux-uclibc*)
318+ tm_file="dbxelf.h elfos.h svr4.h ${tm_file} linux.h cris/linux.h"
319+ tmake_file="cris/t-cris t-slibgcc-elf-ver cris/t-linux-uclibc"
320+ ;;
321 cris-*-linux*)
322 tm_file="dbxelf.h elfos.h svr4.h ${tm_file} linux.h cris/linux.h"
323 tmake_file="cris/t-cris t-slibgcc-elf-ver cris/t-linux"
324@@ -988,6 +998,11 @@
325 thread_file='single'
326 fi
327 ;;
328+i[34567]86-*-linux*uclibc*) # Intel 80386's running GNU/Linux
329+ # with ELF format using uClibc
330+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h i386/linux.h"
331+ tmake_file="t-slibgcc-elf-ver t-linux-uclibc i386/t-crtstuff"
332+ ;;
333 i[34567]86-*-linux*) # Intel 80386's running GNU/Linux
334 # with ELF format using glibc 2
335 # aka GNU/Linux C library 6
336@@ -1547,6 +1562,16 @@
337 gnu_ld=yes
338 gas=yes
339 ;;
340+mips*-*-linux-uclibc*) # Linux MIPS, either endian. uClibc
341+ tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h"
342+ case ${target} in
343+ mipsisa32*-*)
344+ target_cpu_default="MASK_SOFT_FLOAT"
345+ tm_defines="MIPS_ISA_DEFAULT=32"
346+ ;;
347+ esac
348+ tmake_file="t-slibgcc-elf-ver t-linux-uclibc"
349+ ;;
350 mips*-*-linux*) # Linux MIPS, either endian.
351 tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h"
352 case ${target} in
353@@ -1764,6 +1789,10 @@
354 tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h rs6000/linuxspe.h"
355 tmake_file="rs6000/t-fprules rs6000/t-ppcos t-slibgcc-elf-ver t-linux rs6000/t-ppccomm"
356 ;;
357+powerpc-*-linux-uclibc*)
358+ tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h"
359+ tmake_file="rs6000/t-fprules rs6000/t-ppcos t-slibgcc-elf-ver t-linux-uclibc rs6000/t-ppccomm"
360+ ;;
361 powerpc-*-linux*)
362 tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h"
363 tmake_file="rs6000/t-fprules rs6000/t-ppcos t-slibgcc-elf-ver t-linux rs6000/t-ppccomm"
364@@ -1916,7 +1945,7 @@
365 tm_file="${tm_file} dbxelf.h elfos.h svr4.h sh/elf.h sh/embed-elf.h sh/rtemself.h rtems.h"
366 ;;
367 sh-*-linux* | sh[2346lbe]*-*-linux*)
368- tmake_file="sh/t-sh sh/t-elf t-slibgcc-elf-ver t-linux"
369+ tmake_file="sh/t-sh sh/t-elf t-slibgcc-elf-ver"
370 case ${target} in
371 sh*be-*-* | sh*eb-*-*) ;;
372 *)
373@@ -1924,9 +1953,17 @@
374 tmake_file="${tmake_file} sh/t-le"
375 ;;
376 esac
377- tmake_file="${tmake_file} sh/t-linux"
378+ case ${target} in
379+ *-*-linux-uclibc*) tmake_file="${tmake_file} t-linux-uclibc sh/t-linux-uclibc" ;;
380+ *) tmake_file="${tmake_file} t-linux sh/t-linux" ;;
381+ esac
382 tm_file="${tm_file} dbxelf.h elfos.h svr4.h sh/elf.h sh/linux.h"
383 case ${target} in
384+ sh64*-*-linux-uclibc*)
385+ tmake_file="${tmake_file} sh/t-sh64-uclibc"
386+ tm_file="${tm_file} sh/sh64.h"
387+ extra_headers="shmedia.h ushmedia.h sshmedia.h"
388+ ;;
389 sh64*)
390 tmake_file="${tmake_file} sh/t-sh64"
391 tm_file="${tm_file} sh/sh64.h"
392diff -urN gcc-3.4.1-dist/libtool.m4 gcc-3.4.1/libtool.m4
393--- gcc-3.4.1-dist/libtool.m4 2004-05-18 04:08:37.000000000 -0500
394+++ gcc-3.4.1/libtool.m4 2004-08-12 15:54:43.000000000 -0500
395@@ -689,6 +689,11 @@
396 lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
397 ;;
398
399+linux-uclibc*)
400+ lt_cv_deplibs_check_method=pass_all
401+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
402+ ;;
403+
404 netbsd*)
405 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
406 [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
407diff -urN gcc-3.4.1-dist/ltconfig gcc-3.4.1/ltconfig
408--- gcc-3.4.1-dist/ltconfig 2004-03-05 15:05:41.000000000 -0600
409+++ gcc-3.4.1/ltconfig 2004-08-12 15:55:48.000000000 -0500
410@@ -602,6 +602,7 @@
411
412 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
413 case $host_os in
414+linux-uclibc*) ;;
415 linux-gnu*) ;;
416 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
417 esac
418@@ -1262,6 +1263,24 @@
419 dynamic_linker='GNU/Linux ld.so'
420 ;;
421
422+linux-uclibc*)
423+ version_type=linux
424+ need_lib_prefix=no
425+ need_version=no
426+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
427+ soname_spec='${libname}${release}.so$major'
428+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
429+ shlibpath_var=LD_LIBRARY_PATH
430+ shlibpath_overrides_runpath=no
431+ # This implies no fast_install, which is unacceptable.
432+ # Some rework will be needed to allow for fast_install
433+ # before this can be enabled.
434+ # Note: copied from linux-gnu, and may not be appropriate.
435+ hardcode_into_libs=yes
436+ # Assume using the uClibc dynamic linker.
437+ dynamic_linker="uClibc ld.so"
438+ ;;
439+
440 netbsd*)
441 need_lib_prefix=no
442 need_version=no
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc-3.4.1-uclibc-200-locale.patch b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.1-uclibc-200-locale.patch
new file mode 100644
index 0000000000..3fc4900b06
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.3/gcc-3.4.1-uclibc-200-locale.patch
@@ -0,0 +1,3246 @@
1diff -urN gcc-3.4.2-dist/libstdc++-v3/acinclude.m4 gcc-3.4.2/libstdc++-v3/acinclude.m4
2--- gcc-3.4.2-dist/libstdc++-v3/acinclude.m4 2004-07-15 12:42:45.000000000 -0500
3+++ gcc-3.4.2/libstdc++-v3/acinclude.m4 2004-09-10 10:47:40.000000000 -0500
4@@ -996,7 +996,7 @@
5 AC_MSG_CHECKING([for C locale to use])
6 GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
7 [use MODEL for target locale package],
8- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
9+ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
10
11 # If they didn't use this option switch, or if they specified --enable
12 # with no specific model, we'll have to look for one. If they
13@@ -1012,6 +1012,9 @@
14 # Default to "generic".
15 if test $enable_clocale_flag = auto; then
16 case x${target_os} in
17+ x*-uclibc*)
18+ enable_clocale_flag=uclibc
19+ ;;
20 xlinux* | xgnu* | xkfreebsd*-gnu | xknetbsd*-gnu)
21 AC_EGREP_CPP([_GLIBCXX_ok], [
22 #include <features.h>
23@@ -1138,6 +1141,41 @@
24 CTIME_CC=config/locale/generic/time_members.cc
25 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
26 ;;
27+ uclibc)
28+ AC_MSG_RESULT(uclibc)
29+
30+ # Declare intention to use gettext, and add support for specific
31+ # languages.
32+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
33+ ALL_LINGUAS="de fr"
34+
35+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
36+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
37+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
38+ USE_NLS=yes
39+ fi
40+ # Export the build objects.
41+ for ling in $ALL_LINGUAS; do \
42+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
43+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
44+ done
45+ AC_SUBST(glibcxx_MOFILES)
46+ AC_SUBST(glibcxx_POFILES)
47+
48+ CLOCALE_H=config/locale/uclibc/c_locale.h
49+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
50+ CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
51+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
52+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
53+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
54+ CMESSAGES_H=config/locale/uclibc/messages_members.h
55+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
56+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
57+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
58+ CTIME_H=config/locale/uclibc/time_members.h
59+ CTIME_CC=config/locale/uclibc/time_members.cc
60+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
61+ ;;
62 esac
63
64 # This is where the testsuite looks for locale catalogs, using the
65diff -urN gcc-3.4.2-dist/libstdc++-v3/aclocal.m4 gcc-3.4.2/libstdc++-v3/aclocal.m4
66--- gcc-3.4.2-dist/libstdc++-v3/aclocal.m4 2004-08-13 15:44:03.000000000 -0500
67+++ gcc-3.4.2/libstdc++-v3/aclocal.m4 2004-09-10 10:47:40.000000000 -0500
68@@ -1025,6 +1025,9 @@
69 # Default to "generic".
70 if test $enable_clocale_flag = auto; then
71 case x${target_os} in
72+ x*-uclibc*)
73+ enable_clocale_flag=uclibc
74+ ;;
75 xlinux* | xgnu* | xkfreebsd*-gnu | xknetbsd*-gnu)
76 AC_EGREP_CPP([_GLIBCXX_ok], [
77 #include <features.h>
78@@ -1151,6 +1154,41 @@
79 CTIME_CC=config/locale/generic/time_members.cc
80 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
81 ;;
82+ uclibc)
83+ AC_MSG_RESULT(uclibc)
84+
85+ # Declare intention to use gettext, and add support for specific
86+ # languages.
87+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
88+ ALL_LINGUAS="de fr"
89+
90+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
91+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
92+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
93+ USE_NLS=yes
94+ fi
95+ # Export the build objects.
96+ for ling in $ALL_LINGUAS; do \
97+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
98+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
99+ done
100+ AC_SUBST(glibcxx_MOFILES)
101+ AC_SUBST(glibcxx_POFILES)
102+
103+ CLOCALE_H=config/locale/uclibc/c_locale.h
104+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
105+ CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
106+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
107+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
108+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
109+ CMESSAGES_H=config/locale/uclibc/messages_members.h
110+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
111+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
112+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
113+ CTIME_H=config/locale/uclibc/time_members.h
114+ CTIME_CC=config/locale/uclibc/time_members.cc
115+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
116+ ;;
117 esac
118
119 # This is where the testsuite looks for locale catalogs, using the
120diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
121--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1969-12-31 18:00:00.000000000 -0600
122+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2004-09-10 10:47:40.000000000 -0500
123@@ -0,0 +1,59 @@
124+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
125+
126+// Copyright (C) 2002, 2004 Free Software Foundation, Inc.
127+//
128+// This file is part of the GNU ISO C++ Library. This library is free
129+// software; you can redistribute it and/or modify it under the
130+// terms of the GNU General Public License as published by the
131+// Free Software Foundation; either version 2, or (at your option)
132+// any later version.
133+
134+// This library is distributed in the hope that it will be useful,
135+// but WITHOUT ANY WARRANTY; without even the implied warranty of
136+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
137+// GNU General Public License for more details.
138+
139+// You should have received a copy of the GNU General Public License along
140+// with this library; see the file COPYING. If not, write to the Free
141+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
142+// USA.
143+
144+// As a special exception, you may use this file as part of a free software
145+// library without restriction. Specifically, if other files instantiate
146+// templates or use macros or inline functions from this file, or you compile
147+// this file and link it with other files to produce an executable, this
148+// file does not by itself cause the resulting executable to be covered by
149+// the GNU General Public License. This exception does not however
150+// invalidate any other reasons why the executable file might be covered by
151+// the GNU General Public License.
152+
153+// Written by Jakub Jelinek <jakub@redhat.com>
154+
155+#include <clocale>
156+
157+#ifdef __UCLIBC_MJN3_ONLY__
158+#warning clean this up
159+#endif
160+
161+#ifdef __UCLIBC_HAS_XLOCALE__
162+
163+extern "C" __typeof(iswctype_l) __iswctype_l;
164+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
165+extern "C" __typeof(strcoll_l) __strcoll_l;
166+extern "C" __typeof(strftime_l) __strftime_l;
167+extern "C" __typeof(strtod_l) __strtod_l;
168+extern "C" __typeof(strtof_l) __strtof_l;
169+extern "C" __typeof(strtold_l) __strtold_l;
170+extern "C" __typeof(strxfrm_l) __strxfrm_l;
171+extern "C" __typeof(towlower_l) __towlower_l;
172+extern "C" __typeof(towupper_l) __towupper_l;
173+extern "C" __typeof(wcscoll_l) __wcscoll_l;
174+extern "C" __typeof(wcsftime_l) __wcsftime_l;
175+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
176+extern "C" __typeof(wctype_l) __wctype_l;
177+extern "C" __typeof(newlocale) __newlocale;
178+extern "C" __typeof(freelocale) __freelocale;
179+extern "C" __typeof(duplocale) __duplocale;
180+extern "C" __typeof(uselocale) __uselocale;
181+
182+#endif // GLIBC 2.3 and later
183diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c_locale.cc
184--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c_locale.cc 1969-12-31 18:00:00.000000000 -0600
185+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c_locale.cc 2004-09-10 10:47:40.000000000 -0500
186@@ -0,0 +1,160 @@
187+// Wrapper for underlying C-language localization -*- C++ -*-
188+
189+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
190+//
191+// This file is part of the GNU ISO C++ Library. This library is free
192+// software; you can redistribute it and/or modify it under the
193+// terms of the GNU General Public License as published by the
194+// Free Software Foundation; either version 2, or (at your option)
195+// any later version.
196+
197+// This library is distributed in the hope that it will be useful,
198+// but WITHOUT ANY WARRANTY; without even the implied warranty of
199+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
200+// GNU General Public License for more details.
201+
202+// You should have received a copy of the GNU General Public License along
203+// with this library; see the file COPYING. If not, write to the Free
204+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
205+// USA.
206+
207+// As a special exception, you may use this file as part of a free software
208+// library without restriction. Specifically, if other files instantiate
209+// templates or use macros or inline functions from this file, or you compile
210+// this file and link it with other files to produce an executable, this
211+// file does not by itself cause the resulting executable to be covered by
212+// the GNU General Public License. This exception does not however
213+// invalidate any other reasons why the executable file might be covered by
214+// the GNU General Public License.
215+
216+//
217+// ISO C++ 14882: 22.8 Standard locale categories.
218+//
219+
220+// Written by Benjamin Kosnik <bkoz@redhat.com>
221+
222+#include <cerrno> // For errno
223+#include <locale>
224+#include <stdexcept>
225+#include <langinfo.h>
226+#include <bits/c++locale_internal.h>
227+
228+#ifndef __UCLIBC_HAS_XLOCALE__
229+#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
230+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
231+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
232+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
233+#define __strtof_l(S, E, L) strtof((S), (E))
234+#define __strtod_l(S, E, L) strtod((S), (E))
235+#define __strtold_l(S, E, L) strtold((S), (E))
236+#warning should dummy __newlocale check for C|POSIX ?
237+#define __newlocale(a, b, c) NULL
238+#define __freelocale(a) ((void)0)
239+#define __duplocale(a) __c_locale()
240+#endif
241+
242+namespace std
243+{
244+ template<>
245+ void
246+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
247+ const __c_locale& __cloc)
248+ {
249+ if (!(__err & ios_base::failbit))
250+ {
251+ char* __sanity;
252+ errno = 0;
253+ float __f = __strtof_l(__s, &__sanity, __cloc);
254+ if (__sanity != __s && errno != ERANGE)
255+ __v = __f;
256+ else
257+ __err |= ios_base::failbit;
258+ }
259+ }
260+
261+ template<>
262+ void
263+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
264+ const __c_locale& __cloc)
265+ {
266+ if (!(__err & ios_base::failbit))
267+ {
268+ char* __sanity;
269+ errno = 0;
270+ double __d = __strtod_l(__s, &__sanity, __cloc);
271+ if (__sanity != __s && errno != ERANGE)
272+ __v = __d;
273+ else
274+ __err |= ios_base::failbit;
275+ }
276+ }
277+
278+ template<>
279+ void
280+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
281+ const __c_locale& __cloc)
282+ {
283+ if (!(__err & ios_base::failbit))
284+ {
285+ char* __sanity;
286+ errno = 0;
287+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
288+ if (__sanity != __s && errno != ERANGE)
289+ __v = __ld;
290+ else
291+ __err |= ios_base::failbit;
292+ }
293+ }
294+
295+ void
296+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
297+ __c_locale __old)
298+ {
299+ __cloc = __newlocale(1 << LC_ALL, __s, __old);
300+#ifdef __UCLIBC_HAS_XLOCALE__
301+ if (!__cloc)
302+ {
303+ // This named locale is not supported by the underlying OS.
304+ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
305+ "name not valid"));
306+ }
307+#endif
308+ }
309+
310+ void
311+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
312+ {
313+ if (_S_get_c_locale() != __cloc)
314+ __freelocale(__cloc);
315+ }
316+
317+ __c_locale
318+ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
319+ { return __duplocale(__cloc); }
320+} // namespace std
321+
322+namespace __gnu_cxx
323+{
324+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
325+ {
326+ "LC_CTYPE",
327+ "LC_NUMERIC",
328+ "LC_TIME",
329+ "LC_COLLATE",
330+ "LC_MONETARY",
331+ "LC_MESSAGES",
332+#if _GLIBCXX_NUM_CATEGORIES != 0
333+ "LC_PAPER",
334+ "LC_NAME",
335+ "LC_ADDRESS",
336+ "LC_TELEPHONE",
337+ "LC_MEASUREMENT",
338+ "LC_IDENTIFICATION"
339+#endif
340+ };
341+}
342+
343+namespace std
344+{
345+ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
346+} // namespace std
347diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c_locale.h
348--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c_locale.h 1969-12-31 18:00:00.000000000 -0600
349+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c_locale.h 2004-09-10 10:48:08.000000000 -0500
350@@ -0,0 +1,115 @@
351+// Wrapper for underlying C-language localization -*- C++ -*-
352+
353+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
354+//
355+// This file is part of the GNU ISO C++ Library. This library is free
356+// software; you can redistribute it and/or modify it under the
357+// terms of the GNU General Public License as published by the
358+// Free Software Foundation; either version 2, or (at your option)
359+// any later version.
360+
361+// This library is distributed in the hope that it will be useful,
362+// but WITHOUT ANY WARRANTY; without even the implied warranty of
363+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
364+// GNU General Public License for more details.
365+
366+// You should have received a copy of the GNU General Public License along
367+// with this library; see the file COPYING. If not, write to the Free
368+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
369+// USA.
370+
371+// As a special exception, you may use this file as part of a free software
372+// library without restriction. Specifically, if other files instantiate
373+// templates or use macros or inline functions from this file, or you compile
374+// this file and link it with other files to produce an executable, this
375+// file does not by itself cause the resulting executable to be covered by
376+// the GNU General Public License. This exception does not however
377+// invalidate any other reasons why the executable file might be covered by
378+// the GNU General Public License.
379+
380+//
381+// ISO C++ 14882: 22.8 Standard locale categories.
382+//
383+
384+// Written by Benjamin Kosnik <bkoz@redhat.com>
385+
386+#ifndef _C_LOCALE_H
387+#define _C_LOCALE_H 1
388+
389+#pragma GCC system_header
390+
391+#include <cstring> // get std::strlen
392+#include <cstdio> // get std::snprintf or std::sprintf
393+#include <clocale>
394+#include <langinfo.h> // For codecvt
395+#ifdef __UCLIBC_MJN3_ONLY__
396+#warning fix this
397+#endif
398+#ifdef __UCLIBC_HAS_LOCALE__
399+#include <iconv.h> // For codecvt using iconv, iconv_t
400+#endif
401+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
402+#include <libintl.h> // For messages
403+#endif
404+
405+#ifdef __UCLIBC_MJN3_ONLY__
406+#warning what is _GLIBCXX_C_LOCALE_GNU for
407+#endif
408+#define _GLIBCXX_C_LOCALE_GNU 1
409+
410+#ifdef __UCLIBC_MJN3_ONLY__
411+#warning fix categories
412+#endif
413+// #define _GLIBCXX_NUM_CATEGORIES 6
414+#define _GLIBCXX_NUM_CATEGORIES 0
415+
416+#ifdef __UCLIBC_HAS_XLOCALE__
417+namespace __gnu_cxx
418+{
419+ extern "C" __typeof(uselocale) __uselocale;
420+}
421+#endif
422+
423+namespace std
424+{
425+#ifdef __UCLIBC_HAS_XLOCALE__
426+ typedef __locale_t __c_locale;
427+#else
428+ typedef int* __c_locale;
429+#endif
430+
431+ // Convert numeric value of type _Tv to string and return length of
432+ // string. If snprintf is available use it, otherwise fall back to
433+ // the unsafe sprintf which, in general, can be dangerous and should
434+ // be avoided.
435+ template<typename _Tv>
436+ int
437+ __convert_from_v(char* __out, const int __size, const char* __fmt,
438+#ifdef __UCLIBC_HAS_XLOCALE__
439+ _Tv __v, const __c_locale& __cloc, int __prec)
440+ {
441+ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
442+#else
443+ _Tv __v, const __c_locale&, int __prec)
444+ {
445+# ifdef __UCLIBC_HAS_LOCALE__
446+ char* __old = std::setlocale(LC_ALL, NULL);
447+ char* __sav = new char[std::strlen(__old) + 1];
448+ std::strcpy(__sav, __old);
449+ std::setlocale(LC_ALL, "C");
450+# endif
451+#endif
452+
453+ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
454+
455+#ifdef __UCLIBC_HAS_XLOCALE__
456+ __gnu_cxx::__uselocale(__old);
457+#elif defined __UCLIBC_HAS_LOCALE__
458+ std::setlocale(LC_ALL, __sav);
459+ delete [] __sav;
460+#endif
461+ return __ret;
462+ }
463+}
464+
465+#endif
466diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-3.4.2/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
467--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1969-12-31 18:00:00.000000000 -0600
468+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2004-09-10 10:47:40.000000000 -0500
469@@ -0,0 +1,306 @@
470+// std::codecvt implementation details, GNU version -*- C++ -*-
471+
472+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
473+//
474+// This file is part of the GNU ISO C++ Library. This library is free
475+// software; you can redistribute it and/or modify it under the
476+// terms of the GNU General Public License as published by the
477+// Free Software Foundation; either version 2, or (at your option)
478+// any later version.
479+
480+// This library is distributed in the hope that it will be useful,
481+// but WITHOUT ANY WARRANTY; without even the implied warranty of
482+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
483+// GNU General Public License for more details.
484+
485+// You should have received a copy of the GNU General Public License along
486+// with this library; see the file COPYING. If not, write to the Free
487+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
488+// USA.
489+
490+// As a special exception, you may use this file as part of a free software
491+// library without restriction. Specifically, if other files instantiate
492+// templates or use macros or inline functions from this file, or you compile
493+// this file and link it with other files to produce an executable, this
494+// file does not by itself cause the resulting executable to be covered by
495+// the GNU General Public License. This exception does not however
496+// invalidate any other reasons why the executable file might be covered by
497+// the GNU General Public License.
498+
499+//
500+// ISO C++ 14882: 22.2.1.5 - Template class codecvt
501+//
502+
503+// Written by Benjamin Kosnik <bkoz@redhat.com>
504+
505+#include <locale>
506+#include <bits/c++locale_internal.h>
507+
508+namespace std
509+{
510+ // Specializations.
511+#ifdef _GLIBCXX_USE_WCHAR_T
512+ codecvt_base::result
513+ codecvt<wchar_t, char, mbstate_t>::
514+ do_out(state_type& __state, const intern_type* __from,
515+ const intern_type* __from_end, const intern_type*& __from_next,
516+ extern_type* __to, extern_type* __to_end,
517+ extern_type*& __to_next) const
518+ {
519+ result __ret = ok;
520+ state_type __tmp_state(__state);
521+
522+#ifdef __UCLIBC_HAS_XLOCALE__
523+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
524+#endif
525+
526+ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
527+ // in case we fall back to wcrtomb and then continue, in a loop.
528+ // NB: wcsnrtombs is a GNU extension
529+ for (__from_next = __from, __to_next = __to;
530+ __from_next < __from_end && __to_next < __to_end
531+ && __ret == ok;)
532+ {
533+ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
534+ __from_end - __from_next);
535+ if (!__from_chunk_end)
536+ __from_chunk_end = __from_end;
537+
538+ __from = __from_next;
539+ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
540+ __from_chunk_end - __from_next,
541+ __to_end - __to_next, &__state);
542+ if (__conv == static_cast<size_t>(-1))
543+ {
544+ // In case of error, in order to stop at the exact place we
545+ // have to start again from the beginning with a series of
546+ // wcrtomb.
547+ for (; __from < __from_next; ++__from)
548+ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
549+ __state = __tmp_state;
550+ __ret = error;
551+ }
552+ else if (__from_next && __from_next < __from_chunk_end)
553+ {
554+ __to_next += __conv;
555+ __ret = partial;
556+ }
557+ else
558+ {
559+ __from_next = __from_chunk_end;
560+ __to_next += __conv;
561+ }
562+
563+ if (__from_next < __from_end && __ret == ok)
564+ {
565+ extern_type __buf[MB_LEN_MAX];
566+ __tmp_state = __state;
567+ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
568+ if (__conv > static_cast<size_t>(__to_end - __to_next))
569+ __ret = partial;
570+ else
571+ {
572+ memcpy(__to_next, __buf, __conv);
573+ __state = __tmp_state;
574+ __to_next += __conv;
575+ ++__from_next;
576+ }
577+ }
578+ }
579+
580+#ifdef __UCLIBC_HAS_XLOCALE__
581+ __uselocale(__old);
582+#endif
583+
584+ return __ret;
585+ }
586+
587+ codecvt_base::result
588+ codecvt<wchar_t, char, mbstate_t>::
589+ do_in(state_type& __state, const extern_type* __from,
590+ const extern_type* __from_end, const extern_type*& __from_next,
591+ intern_type* __to, intern_type* __to_end,
592+ intern_type*& __to_next) const
593+ {
594+ result __ret = ok;
595+ state_type __tmp_state(__state);
596+
597+#ifdef __UCLIBC_HAS_XLOCALE__
598+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
599+#endif
600+
601+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
602+ // in case we store a L'\0' and then continue, in a loop.
603+ // NB: mbsnrtowcs is a GNU extension
604+ for (__from_next = __from, __to_next = __to;
605+ __from_next < __from_end && __to_next < __to_end
606+ && __ret == ok;)
607+ {
608+ const extern_type* __from_chunk_end;
609+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
610+ __from_end
611+ - __from_next));
612+ if (!__from_chunk_end)
613+ __from_chunk_end = __from_end;
614+
615+ __from = __from_next;
616+ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
617+ __from_chunk_end - __from_next,
618+ __to_end - __to_next, &__state);
619+ if (__conv == static_cast<size_t>(-1))
620+ {
621+ // In case of error, in order to stop at the exact place we
622+ // have to start again from the beginning with a series of
623+ // mbrtowc.
624+ for (;; ++__to_next, __from += __conv)
625+ {
626+ __conv = mbrtowc(__to_next, __from, __from_end - __from,
627+ &__tmp_state);
628+ if (__conv == static_cast<size_t>(-1)
629+ || __conv == static_cast<size_t>(-2))
630+ break;
631+ }
632+ __from_next = __from;
633+ __state = __tmp_state;
634+ __ret = error;
635+ }
636+ else if (__from_next && __from_next < __from_chunk_end)
637+ {
638+ // It is unclear what to return in this case (see DR 382).
639+ __to_next += __conv;
640+ __ret = partial;
641+ }
642+ else
643+ {
644+ __from_next = __from_chunk_end;
645+ __to_next += __conv;
646+ }
647+
648+ if (__from_next < __from_end && __ret == ok)
649+ {
650+ if (__to_next < __to_end)
651+ {
652+ // XXX Probably wrong for stateful encodings
653+ __tmp_state = __state;
654+ ++__from_next;
655+ *__to_next++ = L'\0';
656+ }
657+ else
658+ __ret = partial;
659+ }
660+ }
661+
662+#ifdef __UCLIBC_HAS_XLOCALE__
663+ __uselocale(__old);
664+#endif
665+
666+ return __ret;
667+ }
668+
669+ int
670+ codecvt<wchar_t, char, mbstate_t>::
671+ do_encoding() const throw()
672+ {
673+ // XXX This implementation assumes that the encoding is
674+ // stateless and is either single-byte or variable-width.
675+ int __ret = 0;
676+#ifdef __UCLIBC_HAS_XLOCALE__
677+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
678+#endif
679+ if (MB_CUR_MAX == 1)
680+ __ret = 1;
681+#ifdef __UCLIBC_HAS_XLOCALE__
682+ __uselocale(__old);
683+#endif
684+ return __ret;
685+ }
686+
687+ int
688+ codecvt<wchar_t, char, mbstate_t>::
689+ do_max_length() const throw()
690+ {
691+#ifdef __UCLIBC_HAS_XLOCALE__
692+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
693+#endif
694+ // XXX Probably wrong for stateful encodings.
695+ int __ret = MB_CUR_MAX;
696+#ifdef __UCLIBC_HAS_XLOCALE__
697+ __uselocale(__old);
698+#endif
699+ return __ret;
700+ }
701+
702+ int
703+ codecvt<wchar_t, char, mbstate_t>::
704+ do_length(state_type& __state, const extern_type* __from,
705+ const extern_type* __end, size_t __max) const
706+ {
707+ int __ret = 0;
708+ state_type __tmp_state(__state);
709+
710+#ifdef __UCLIBC_HAS_XLOCALE__
711+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
712+#endif
713+
714+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
715+ // in case we advance past it and then continue, in a loop.
716+ // NB: mbsnrtowcs is a GNU extension
717+
718+ // A dummy internal buffer is needed in order for mbsnrtocws to consider
719+ // its fourth parameter (it wouldn't with NULL as first parameter).
720+ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
721+ * __max));
722+ while (__from < __end && __max)
723+ {
724+ const extern_type* __from_chunk_end;
725+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
726+ __end
727+ - __from));
728+ if (!__from_chunk_end)
729+ __from_chunk_end = __end;
730+
731+ const extern_type* __tmp_from = __from;
732+ size_t __conv = mbsnrtowcs(__to, &__from,
733+ __from_chunk_end - __from,
734+ __max, &__state);
735+ if (__conv == static_cast<size_t>(-1))
736+ {
737+ // In case of error, in order to stop at the exact place we
738+ // have to start again from the beginning with a series of
739+ // mbrtowc.
740+ for (__from = __tmp_from;; __from += __conv)
741+ {
742+ __conv = mbrtowc(NULL, __from, __end - __from,
743+ &__tmp_state);
744+ if (__conv == static_cast<size_t>(-1)
745+ || __conv == static_cast<size_t>(-2))
746+ break;
747+ }
748+ __state = __tmp_state;
749+ __ret += __from - __tmp_from;
750+ break;
751+ }
752+ if (!__from)
753+ __from = __from_chunk_end;
754+
755+ __ret += __from - __tmp_from;
756+ __max -= __conv;
757+
758+ if (__from < __end && __max)
759+ {
760+ // XXX Probably wrong for stateful encodings
761+ __tmp_state = __state;
762+ ++__from;
763+ ++__ret;
764+ --__max;
765+ }
766+ }
767+
768+#ifdef __UCLIBC_HAS_XLOCALE__
769+ __uselocale(__old);
770+#endif
771+
772+ return __ret;
773+ }
774+#endif
775+}
776diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-3.4.2/libstdc++-v3/config/locale/uclibc/collate_members.cc
777--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/collate_members.cc 1969-12-31 18:00:00.000000000 -0600
778+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/collate_members.cc 2004-09-10 10:47:40.000000000 -0500
779@@ -0,0 +1,80 @@
780+// std::collate implementation details, GNU version -*- C++ -*-
781+
782+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
783+//
784+// This file is part of the GNU ISO C++ Library. This library is free
785+// software; you can redistribute it and/or modify it under the
786+// terms of the GNU General Public License as published by the
787+// Free Software Foundation; either version 2, or (at your option)
788+// any later version.
789+
790+// This library is distributed in the hope that it will be useful,
791+// but WITHOUT ANY WARRANTY; without even the implied warranty of
792+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
793+// GNU General Public License for more details.
794+
795+// You should have received a copy of the GNU General Public License along
796+// with this library; see the file COPYING. If not, write to the Free
797+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
798+// USA.
799+
800+// As a special exception, you may use this file as part of a free software
801+// library without restriction. Specifically, if other files instantiate
802+// templates or use macros or inline functions from this file, or you compile
803+// this file and link it with other files to produce an executable, this
804+// file does not by itself cause the resulting executable to be covered by
805+// the GNU General Public License. This exception does not however
806+// invalidate any other reasons why the executable file might be covered by
807+// the GNU General Public License.
808+
809+//
810+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
811+//
812+
813+// Written by Benjamin Kosnik <bkoz@redhat.com>
814+
815+#include <locale>
816+#include <bits/c++locale_internal.h>
817+
818+#ifndef __UCLIBC_HAS_XLOCALE__
819+#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
820+#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
821+#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
822+#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
823+#endif
824+
825+namespace std
826+{
827+ // These are basically extensions to char_traits, and perhaps should
828+ // be put there instead of here.
829+ template<>
830+ int
831+ collate<char>::_M_compare(const char* __one, const char* __two) const
832+ {
833+ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
834+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
835+ }
836+
837+ template<>
838+ size_t
839+ collate<char>::_M_transform(char* __to, const char* __from,
840+ size_t __n) const
841+ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
842+
843+#ifdef _GLIBCXX_USE_WCHAR_T
844+ template<>
845+ int
846+ collate<wchar_t>::_M_compare(const wchar_t* __one,
847+ const wchar_t* __two) const
848+ {
849+ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
850+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
851+ }
852+
853+ template<>
854+ size_t
855+ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
856+ size_t __n) const
857+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
858+#endif
859+}
860diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-3.4.2/libstdc++-v3/config/locale/uclibc/ctype_members.cc
861--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1969-12-31 18:00:00.000000000 -0600
862+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2004-09-10 10:47:40.000000000 -0500
863@@ -0,0 +1,300 @@
864+// std::ctype implementation details, GNU version -*- C++ -*-
865+
866+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
867+//
868+// This file is part of the GNU ISO C++ Library. This library is free
869+// software; you can redistribute it and/or modify it under the
870+// terms of the GNU General Public License as published by the
871+// Free Software Foundation; either version 2, or (at your option)
872+// any later version.
873+
874+// This library is distributed in the hope that it will be useful,
875+// but WITHOUT ANY WARRANTY; without even the implied warranty of
876+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
877+// GNU General Public License for more details.
878+
879+// You should have received a copy of the GNU General Public License along
880+// with this library; see the file COPYING. If not, write to the Free
881+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
882+// USA.
883+
884+// As a special exception, you may use this file as part of a free software
885+// library without restriction. Specifically, if other files instantiate
886+// templates or use macros or inline functions from this file, or you compile
887+// this file and link it with other files to produce an executable, this
888+// file does not by itself cause the resulting executable to be covered by
889+// the GNU General Public License. This exception does not however
890+// invalidate any other reasons why the executable file might be covered by
891+// the GNU General Public License.
892+
893+//
894+// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
895+//
896+
897+// Written by Benjamin Kosnik <bkoz@redhat.com>
898+
899+#define _LIBC
900+#include <locale>
901+#undef _LIBC
902+#include <bits/c++locale_internal.h>
903+
904+#ifndef __UCLIBC_HAS_XLOCALE__
905+#define __wctype_l(S, L) wctype((S))
906+#define __towupper_l(C, L) towupper((C))
907+#define __towlower_l(C, L) towlower((C))
908+#define __iswctype_l(C, M, L) iswctype((C), (M))
909+#endif
910+
911+namespace std
912+{
913+ // NB: The other ctype<char> specializations are in src/locale.cc and
914+ // various /config/os/* files.
915+ template<>
916+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
917+ : ctype<char>(0, false, __refs)
918+ {
919+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
920+ {
921+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
922+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
923+#ifdef __UCLIBC_HAS_XLOCALE__
924+ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
925+ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
926+ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
927+#endif
928+ }
929+ }
930+
931+#ifdef _GLIBCXX_USE_WCHAR_T
932+ ctype<wchar_t>::__wmask_type
933+ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
934+ {
935+ __wmask_type __ret;
936+ switch (__m)
937+ {
938+ case space:
939+ __ret = __wctype_l("space", _M_c_locale_ctype);
940+ break;
941+ case print:
942+ __ret = __wctype_l("print", _M_c_locale_ctype);
943+ break;
944+ case cntrl:
945+ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
946+ break;
947+ case upper:
948+ __ret = __wctype_l("upper", _M_c_locale_ctype);
949+ break;
950+ case lower:
951+ __ret = __wctype_l("lower", _M_c_locale_ctype);
952+ break;
953+ case alpha:
954+ __ret = __wctype_l("alpha", _M_c_locale_ctype);
955+ break;
956+ case digit:
957+ __ret = __wctype_l("digit", _M_c_locale_ctype);
958+ break;
959+ case punct:
960+ __ret = __wctype_l("punct", _M_c_locale_ctype);
961+ break;
962+ case xdigit:
963+ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
964+ break;
965+ case alnum:
966+ __ret = __wctype_l("alnum", _M_c_locale_ctype);
967+ break;
968+ case graph:
969+ __ret = __wctype_l("graph", _M_c_locale_ctype);
970+ break;
971+ default:
972+ __ret = 0;
973+ }
974+ return __ret;
975+ }
976+
977+ wchar_t
978+ ctype<wchar_t>::do_toupper(wchar_t __c) const
979+ { return __towupper_l(__c, _M_c_locale_ctype); }
980+
981+ const wchar_t*
982+ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
983+ {
984+ while (__lo < __hi)
985+ {
986+ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
987+ ++__lo;
988+ }
989+ return __hi;
990+ }
991+
992+ wchar_t
993+ ctype<wchar_t>::do_tolower(wchar_t __c) const
994+ { return __towlower_l(__c, _M_c_locale_ctype); }
995+
996+ const wchar_t*
997+ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
998+ {
999+ while (__lo < __hi)
1000+ {
1001+ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
1002+ ++__lo;
1003+ }
1004+ return __hi;
1005+ }
1006+
1007+ bool
1008+ ctype<wchar_t>::
1009+ do_is(mask __m, wchar_t __c) const
1010+ {
1011+ // Highest bitmask in ctype_base == 10, but extra in "C"
1012+ // library for blank.
1013+ bool __ret = false;
1014+ const size_t __bitmasksize = 11;
1015+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
1016+ if (__m & _M_bit[__bitcur]
1017+ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
1018+ {
1019+ __ret = true;
1020+ break;
1021+ }
1022+ return __ret;
1023+ }
1024+
1025+ const wchar_t*
1026+ ctype<wchar_t>::
1027+ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
1028+ {
1029+ for (; __lo < __hi; ++__vec, ++__lo)
1030+ {
1031+ // Highest bitmask in ctype_base == 10, but extra in "C"
1032+ // library for blank.
1033+ const size_t __bitmasksize = 11;
1034+ mask __m = 0;
1035+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
1036+ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
1037+ __m |= _M_bit[__bitcur];
1038+ *__vec = __m;
1039+ }
1040+ return __hi;
1041+ }
1042+
1043+ const wchar_t*
1044+ ctype<wchar_t>::
1045+ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
1046+ {
1047+ while (__lo < __hi && !this->do_is(__m, *__lo))
1048+ ++__lo;
1049+ return __lo;
1050+ }
1051+
1052+ const wchar_t*
1053+ ctype<wchar_t>::
1054+ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
1055+ {
1056+ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
1057+ ++__lo;
1058+ return __lo;
1059+ }
1060+
1061+ wchar_t
1062+ ctype<wchar_t>::
1063+ do_widen(char __c) const
1064+ { return _M_widen[static_cast<unsigned char>(__c)]; }
1065+
1066+ const char*
1067+ ctype<wchar_t>::
1068+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
1069+ {
1070+ while (__lo < __hi)
1071+ {
1072+ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
1073+ ++__lo;
1074+ ++__dest;
1075+ }
1076+ return __hi;
1077+ }
1078+
1079+ char
1080+ ctype<wchar_t>::
1081+ do_narrow(wchar_t __wc, char __dfault) const
1082+ {
1083+ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
1084+ return _M_narrow[__wc];
1085+#ifdef __UCLIBC_HAS_XLOCALE__
1086+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1087+#endif
1088+ const int __c = wctob(__wc);
1089+#ifdef __UCLIBC_HAS_XLOCALE__
1090+ __uselocale(__old);
1091+#endif
1092+ return (__c == EOF ? __dfault : static_cast<char>(__c));
1093+ }
1094+
1095+ const wchar_t*
1096+ ctype<wchar_t>::
1097+ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
1098+ char* __dest) const
1099+ {
1100+#ifdef __UCLIBC_HAS_XLOCALE__
1101+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1102+#endif
1103+ if (_M_narrow_ok)
1104+ while (__lo < __hi)
1105+ {
1106+ if (*__lo >= 0 && *__lo < 128)
1107+ *__dest = _M_narrow[*__lo];
1108+ else
1109+ {
1110+ const int __c = wctob(*__lo);
1111+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1112+ }
1113+ ++__lo;
1114+ ++__dest;
1115+ }
1116+ else
1117+ while (__lo < __hi)
1118+ {
1119+ const int __c = wctob(*__lo);
1120+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1121+ ++__lo;
1122+ ++__dest;
1123+ }
1124+#ifdef __UCLIBC_HAS_XLOCALE__
1125+ __uselocale(__old);
1126+#endif
1127+ return __hi;
1128+ }
1129+
1130+ void
1131+ ctype<wchar_t>::_M_initialize_ctype()
1132+ {
1133+#ifdef __UCLIBC_HAS_XLOCALE__
1134+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1135+#endif
1136+ wint_t __i;
1137+ for (__i = 0; __i < 128; ++__i)
1138+ {
1139+ const int __c = wctob(__i);
1140+ if (__c == EOF)
1141+ break;
1142+ else
1143+ _M_narrow[__i] = static_cast<char>(__c);
1144+ }
1145+ if (__i == 128)
1146+ _M_narrow_ok = true;
1147+ else
1148+ _M_narrow_ok = false;
1149+ for (size_t __j = 0;
1150+ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
1151+ _M_widen[__j] = btowc(__j);
1152+
1153+ for (size_t __k = 0; __k <= 11; ++__k)
1154+ {
1155+ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
1156+ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
1157+ }
1158+#ifdef __UCLIBC_HAS_XLOCALE__
1159+ __uselocale(__old);
1160+#endif
1161+ }
1162+#endif // _GLIBCXX_USE_WCHAR_T
1163+}
1164diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-3.4.2/libstdc++-v3/config/locale/uclibc/messages_members.cc
1165--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/messages_members.cc 1969-12-31 18:00:00.000000000 -0600
1166+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/messages_members.cc 2004-09-10 10:47:40.000000000 -0500
1167@@ -0,0 +1,100 @@
1168+// std::messages implementation details, GNU version -*- C++ -*-
1169+
1170+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1171+//
1172+// This file is part of the GNU ISO C++ Library. This library is free
1173+// software; you can redistribute it and/or modify it under the
1174+// terms of the GNU General Public License as published by the
1175+// Free Software Foundation; either version 2, or (at your option)
1176+// any later version.
1177+
1178+// This library is distributed in the hope that it will be useful,
1179+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1180+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1181+// GNU General Public License for more details.
1182+
1183+// You should have received a copy of the GNU General Public License along
1184+// with this library; see the file COPYING. If not, write to the Free
1185+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1186+// USA.
1187+
1188+// As a special exception, you may use this file as part of a free software
1189+// library without restriction. Specifically, if other files instantiate
1190+// templates or use macros or inline functions from this file, or you compile
1191+// this file and link it with other files to produce an executable, this
1192+// file does not by itself cause the resulting executable to be covered by
1193+// the GNU General Public License. This exception does not however
1194+// invalidate any other reasons why the executable file might be covered by
1195+// the GNU General Public License.
1196+
1197+//
1198+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
1199+//
1200+
1201+// Written by Benjamin Kosnik <bkoz@redhat.com>
1202+
1203+#include <locale>
1204+#include <bits/c++locale_internal.h>
1205+
1206+#ifdef __UCLIBC_MJN3_ONLY__
1207+#warning fix gettext stuff
1208+#endif
1209+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1210+extern "C" char *__dcgettext(const char *domainname,
1211+ const char *msgid, int category);
1212+#undef gettext
1213+#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
1214+#else
1215+#undef gettext
1216+#define gettext(msgid) (msgid)
1217+#endif
1218+
1219+namespace std
1220+{
1221+ // Specializations.
1222+ template<>
1223+ string
1224+ messages<char>::do_get(catalog, int, int, const string& __dfault) const
1225+ {
1226+#ifdef __UCLIBC_HAS_XLOCALE__
1227+ __c_locale __old = __uselocale(_M_c_locale_messages);
1228+ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
1229+ __uselocale(__old);
1230+ return string(__msg);
1231+#elif defined __UCLIBC_HAS_LOCALE__
1232+ char* __old = strdup(setlocale(LC_ALL, NULL));
1233+ setlocale(LC_ALL, _M_name_messages);
1234+ const char* __msg = gettext(__dfault.c_str());
1235+ setlocale(LC_ALL, __old);
1236+ free(__old);
1237+ return string(__msg);
1238+#else
1239+ const char* __msg = gettext(__dfault.c_str());
1240+ return string(__msg);
1241+#endif
1242+ }
1243+
1244+#ifdef _GLIBCXX_USE_WCHAR_T
1245+ template<>
1246+ wstring
1247+ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
1248+ {
1249+# ifdef __UCLIBC_HAS_XLOCALE__
1250+ __c_locale __old = __uselocale(_M_c_locale_messages);
1251+ char* __msg = gettext(_M_convert_to_char(__dfault));
1252+ __uselocale(__old);
1253+ return _M_convert_from_char(__msg);
1254+# elif defined __UCLIBC_HAS_LOCALE__
1255+ char* __old = strdup(setlocale(LC_ALL, NULL));
1256+ setlocale(LC_ALL, _M_name_messages);
1257+ char* __msg = gettext(_M_convert_to_char(__dfault));
1258+ setlocale(LC_ALL, __old);
1259+ free(__old);
1260+ return _M_convert_from_char(__msg);
1261+# else
1262+ char* __msg = gettext(_M_convert_to_char(__dfault));
1263+ return _M_convert_from_char(__msg);
1264+# endif
1265+ }
1266+#endif
1267+}
1268diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-3.4.2/libstdc++-v3/config/locale/uclibc/messages_members.h
1269--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/messages_members.h 1969-12-31 18:00:00.000000000 -0600
1270+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/messages_members.h 2004-09-10 10:47:40.000000000 -0500
1271@@ -0,0 +1,118 @@
1272+// std::messages implementation details, GNU version -*- C++ -*-
1273+
1274+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1275+//
1276+// This file is part of the GNU ISO C++ Library. This library is free
1277+// software; you can redistribute it and/or modify it under the
1278+// terms of the GNU General Public License as published by the
1279+// Free Software Foundation; either version 2, or (at your option)
1280+// any later version.
1281+
1282+// This library is distributed in the hope that it will be useful,
1283+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1284+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1285+// GNU General Public License for more details.
1286+
1287+// You should have received a copy of the GNU General Public License along
1288+// with this library; see the file COPYING. If not, write to the Free
1289+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1290+// USA.
1291+
1292+// As a special exception, you may use this file as part of a free software
1293+// library without restriction. Specifically, if other files instantiate
1294+// templates or use macros or inline functions from this file, or you compile
1295+// this file and link it with other files to produce an executable, this
1296+// file does not by itself cause the resulting executable to be covered by
1297+// the GNU General Public License. This exception does not however
1298+// invalidate any other reasons why the executable file might be covered by
1299+// the GNU General Public License.
1300+
1301+//
1302+// ISO C++ 14882: 22.2.7.1.2 messages functions
1303+//
1304+
1305+// Written by Benjamin Kosnik <bkoz@redhat.com>
1306+
1307+#ifdef __UCLIBC_MJN3_ONLY__
1308+#warning fix prototypes for *textdomain funcs
1309+#endif
1310+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1311+extern "C" char *__textdomain(const char *domainname);
1312+extern "C" char *__bindtextdomain(const char *domainname,
1313+ const char *dirname);
1314+#else
1315+#undef __textdomain
1316+#undef __bindtextdomain
1317+#define __textdomain(D) ((void)0)
1318+#define __bindtextdomain(D,P) ((void)0)
1319+#endif
1320+
1321+ // Non-virtual member functions.
1322+ template<typename _CharT>
1323+ messages<_CharT>::messages(size_t __refs)
1324+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
1325+ _M_name_messages(_S_get_c_name())
1326+ { }
1327+
1328+ template<typename _CharT>
1329+ messages<_CharT>::messages(__c_locale __cloc, const char* __s,
1330+ size_t __refs)
1331+ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
1332+ _M_name_messages(__s)
1333+ {
1334+ char* __tmp = new char[std::strlen(__s) + 1];
1335+ std::strcpy(__tmp, __s);
1336+ _M_name_messages = __tmp;
1337+ }
1338+
1339+ template<typename _CharT>
1340+ typename messages<_CharT>::catalog
1341+ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
1342+ const char* __dir) const
1343+ {
1344+ __bindtextdomain(__s.c_str(), __dir);
1345+ return this->do_open(__s, __loc);
1346+ }
1347+
1348+ // Virtual member functions.
1349+ template<typename _CharT>
1350+ messages<_CharT>::~messages()
1351+ {
1352+ if (_M_name_messages != _S_get_c_name())
1353+ delete [] _M_name_messages;
1354+ _S_destroy_c_locale(_M_c_locale_messages);
1355+ }
1356+
1357+ template<typename _CharT>
1358+ typename messages<_CharT>::catalog
1359+ messages<_CharT>::do_open(const basic_string<char>& __s,
1360+ const locale&) const
1361+ {
1362+ // No error checking is done, assume the catalog exists and can
1363+ // be used.
1364+ __textdomain(__s.c_str());
1365+ return 0;
1366+ }
1367+
1368+ template<typename _CharT>
1369+ void
1370+ messages<_CharT>::do_close(catalog) const
1371+ { }
1372+
1373+ // messages_byname
1374+ template<typename _CharT>
1375+ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
1376+ : messages<_CharT>(__refs)
1377+ {
1378+ if (this->_M_name_messages != locale::facet::_S_get_c_name())
1379+ delete [] this->_M_name_messages;
1380+ char* __tmp = new char[std::strlen(__s) + 1];
1381+ std::strcpy(__tmp, __s);
1382+ this->_M_name_messages = __tmp;
1383+
1384+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
1385+ {
1386+ this->_S_destroy_c_locale(this->_M_c_locale_messages);
1387+ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
1388+ }
1389+ }
1390diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-3.4.2/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1391--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1969-12-31 18:00:00.000000000 -0600
1392+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2004-09-10 10:47:40.000000000 -0500
1393@@ -0,0 +1,698 @@
1394+// std::moneypunct implementation details, GNU version -*- C++ -*-
1395+
1396+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1397+//
1398+// This file is part of the GNU ISO C++ Library. This library is free
1399+// software; you can redistribute it and/or modify it under the
1400+// terms of the GNU General Public License as published by the
1401+// Free Software Foundation; either version 2, or (at your option)
1402+// any later version.
1403+
1404+// This library is distributed in the hope that it will be useful,
1405+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1406+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1407+// GNU General Public License for more details.
1408+
1409+// You should have received a copy of the GNU General Public License along
1410+// with this library; see the file COPYING. If not, write to the Free
1411+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1412+// USA.
1413+
1414+// As a special exception, you may use this file as part of a free software
1415+// library without restriction. Specifically, if other files instantiate
1416+// templates or use macros or inline functions from this file, or you compile
1417+// this file and link it with other files to produce an executable, this
1418+// file does not by itself cause the resulting executable to be covered by
1419+// the GNU General Public License. This exception does not however
1420+// invalidate any other reasons why the executable file might be covered by
1421+// the GNU General Public License.
1422+
1423+//
1424+// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
1425+//
1426+
1427+// Written by Benjamin Kosnik <bkoz@redhat.com>
1428+
1429+#define _LIBC
1430+#include <locale>
1431+#undef _LIBC
1432+#include <bits/c++locale_internal.h>
1433+
1434+#ifdef __UCLIBC_MJN3_ONLY__
1435+#warning optimize this for uclibc
1436+#warning tailor for stub locale support
1437+#endif
1438+
1439+#ifndef __UCLIBC_HAS_XLOCALE__
1440+#define __nl_langinfo_l(N, L) nl_langinfo((N))
1441+#endif
1442+
1443+namespace std
1444+{
1445+ // Construct and return valid pattern consisting of some combination of:
1446+ // space none symbol sign value
1447+ money_base::pattern
1448+ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
1449+ {
1450+ pattern __ret;
1451+
1452+ // This insanely complicated routine attempts to construct a valid
1453+ // pattern for use with monyepunct. A couple of invariants:
1454+
1455+ // if (__precedes) symbol -> value
1456+ // else value -> symbol
1457+
1458+ // if (__space) space
1459+ // else none
1460+
1461+ // none == never first
1462+ // space never first or last
1463+
1464+ // Any elegant implementations of this are welcome.
1465+ switch (__posn)
1466+ {
1467+ case 0:
1468+ case 1:
1469+ // 1 The sign precedes the value and symbol.
1470+ __ret.field[0] = sign;
1471+ if (__space)
1472+ {
1473+ // Pattern starts with sign.
1474+ if (__precedes)
1475+ {
1476+ __ret.field[1] = symbol;
1477+ __ret.field[3] = value;
1478+ }
1479+ else
1480+ {
1481+ __ret.field[1] = value;
1482+ __ret.field[3] = symbol;
1483+ }
1484+ __ret.field[2] = space;
1485+ }
1486+ else
1487+ {
1488+ // Pattern starts with sign and ends with none.
1489+ if (__precedes)
1490+ {
1491+ __ret.field[1] = symbol;
1492+ __ret.field[2] = value;
1493+ }
1494+ else
1495+ {
1496+ __ret.field[1] = value;
1497+ __ret.field[2] = symbol;
1498+ }
1499+ __ret.field[3] = none;
1500+ }
1501+ break;
1502+ case 2:
1503+ // 2 The sign follows the value and symbol.
1504+ if (__space)
1505+ {
1506+ // Pattern either ends with sign.
1507+ if (__precedes)
1508+ {
1509+ __ret.field[0] = symbol;
1510+ __ret.field[2] = value;
1511+ }
1512+ else
1513+ {
1514+ __ret.field[0] = value;
1515+ __ret.field[2] = symbol;
1516+ }
1517+ __ret.field[1] = space;
1518+ __ret.field[3] = sign;
1519+ }
1520+ else
1521+ {
1522+ // Pattern ends with sign then none.
1523+ if (__precedes)
1524+ {
1525+ __ret.field[0] = symbol;
1526+ __ret.field[1] = value;
1527+ }
1528+ else
1529+ {
1530+ __ret.field[0] = value;
1531+ __ret.field[1] = symbol;
1532+ }
1533+ __ret.field[2] = sign;
1534+ __ret.field[3] = none;
1535+ }
1536+ break;
1537+ case 3:
1538+ // 3 The sign immediately precedes the symbol.
1539+ if (__precedes)
1540+ {
1541+ __ret.field[0] = sign;
1542+ __ret.field[1] = symbol;
1543+ if (__space)
1544+ {
1545+ __ret.field[2] = space;
1546+ __ret.field[3] = value;
1547+ }
1548+ else
1549+ {
1550+ __ret.field[2] = value;
1551+ __ret.field[3] = none;
1552+ }
1553+ }
1554+ else
1555+ {
1556+ __ret.field[0] = value;
1557+ if (__space)
1558+ {
1559+ __ret.field[1] = space;
1560+ __ret.field[2] = sign;
1561+ __ret.field[3] = symbol;
1562+ }
1563+ else
1564+ {
1565+ __ret.field[1] = sign;
1566+ __ret.field[2] = symbol;
1567+ __ret.field[3] = none;
1568+ }
1569+ }
1570+ break;
1571+ case 4:
1572+ // 4 The sign immediately follows the symbol.
1573+ if (__precedes)
1574+ {
1575+ __ret.field[0] = symbol;
1576+ __ret.field[1] = sign;
1577+ if (__space)
1578+ {
1579+ __ret.field[2] = space;
1580+ __ret.field[3] = value;
1581+ }
1582+ else
1583+ {
1584+ __ret.field[2] = value;
1585+ __ret.field[3] = none;
1586+ }
1587+ }
1588+ else
1589+ {
1590+ __ret.field[0] = value;
1591+ if (__space)
1592+ {
1593+ __ret.field[1] = space;
1594+ __ret.field[2] = symbol;
1595+ __ret.field[3] = sign;
1596+ }
1597+ else
1598+ {
1599+ __ret.field[1] = symbol;
1600+ __ret.field[2] = sign;
1601+ __ret.field[3] = none;
1602+ }
1603+ }
1604+ break;
1605+ default:
1606+ ;
1607+ }
1608+ return __ret;
1609+ }
1610+
1611+ template<>
1612+ void
1613+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
1614+ const char*)
1615+ {
1616+ if (!_M_data)
1617+ _M_data = new __moneypunct_cache<char, true>;
1618+
1619+ if (!__cloc)
1620+ {
1621+ // "C" locale
1622+ _M_data->_M_decimal_point = '.';
1623+ _M_data->_M_thousands_sep = ',';
1624+ _M_data->_M_grouping = "";
1625+ _M_data->_M_grouping_size = 0;
1626+ _M_data->_M_curr_symbol = "";
1627+ _M_data->_M_curr_symbol_size = 0;
1628+ _M_data->_M_positive_sign = "";
1629+ _M_data->_M_positive_sign_size = 0;
1630+ _M_data->_M_negative_sign = "";
1631+ _M_data->_M_negative_sign_size = 0;
1632+ _M_data->_M_frac_digits = 0;
1633+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1634+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1635+
1636+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1637+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1638+ }
1639+ else
1640+ {
1641+ // Named locale.
1642+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1643+ __cloc));
1644+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1645+ __cloc));
1646+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1647+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1648+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1649+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1650+
1651+ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1652+ if (!__nposn)
1653+ _M_data->_M_negative_sign = "()";
1654+ else
1655+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1656+ __cloc);
1657+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1658+
1659+ // _Intl == true
1660+ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1661+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1662+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1663+ __cloc));
1664+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1665+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1666+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1667+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1668+ __pposn);
1669+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1670+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1671+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1672+ __nposn);
1673+ }
1674+ }
1675+
1676+ template<>
1677+ void
1678+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
1679+ const char*)
1680+ {
1681+ if (!_M_data)
1682+ _M_data = new __moneypunct_cache<char, false>;
1683+
1684+ if (!__cloc)
1685+ {
1686+ // "C" locale
1687+ _M_data->_M_decimal_point = '.';
1688+ _M_data->_M_thousands_sep = ',';
1689+ _M_data->_M_grouping = "";
1690+ _M_data->_M_grouping_size = 0;
1691+ _M_data->_M_curr_symbol = "";
1692+ _M_data->_M_curr_symbol_size = 0;
1693+ _M_data->_M_positive_sign = "";
1694+ _M_data->_M_positive_sign_size = 0;
1695+ _M_data->_M_negative_sign = "";
1696+ _M_data->_M_negative_sign_size = 0;
1697+ _M_data->_M_frac_digits = 0;
1698+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1699+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1700+
1701+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1702+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1703+ }
1704+ else
1705+ {
1706+ // Named locale.
1707+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1708+ __cloc));
1709+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1710+ __cloc));
1711+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1712+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1713+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1714+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1715+
1716+ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1717+ if (!__nposn)
1718+ _M_data->_M_negative_sign = "()";
1719+ else
1720+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1721+ __cloc);
1722+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1723+
1724+ // _Intl == false
1725+ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1726+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1727+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1728+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1729+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1730+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1731+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1732+ __pposn);
1733+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1734+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1735+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1736+ __nposn);
1737+ }
1738+ }
1739+
1740+ template<>
1741+ moneypunct<char, true>::~moneypunct()
1742+ { delete _M_data; }
1743+
1744+ template<>
1745+ moneypunct<char, false>::~moneypunct()
1746+ { delete _M_data; }
1747+
1748+#ifdef _GLIBCXX_USE_WCHAR_T
1749+ template<>
1750+ void
1751+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
1752+#ifdef __UCLIBC_HAS_XLOCALE__
1753+ const char*)
1754+#else
1755+ const char* __name)
1756+#endif
1757+ {
1758+ if (!_M_data)
1759+ _M_data = new __moneypunct_cache<wchar_t, true>;
1760+
1761+ if (!__cloc)
1762+ {
1763+ // "C" locale
1764+ _M_data->_M_decimal_point = L'.';
1765+ _M_data->_M_thousands_sep = L',';
1766+ _M_data->_M_grouping = "";
1767+ _M_data->_M_grouping_size = 0;
1768+ _M_data->_M_curr_symbol = L"";
1769+ _M_data->_M_curr_symbol_size = 0;
1770+ _M_data->_M_positive_sign = L"";
1771+ _M_data->_M_positive_sign_size = 0;
1772+ _M_data->_M_negative_sign = L"";
1773+ _M_data->_M_negative_sign_size = 0;
1774+ _M_data->_M_frac_digits = 0;
1775+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1776+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1777+
1778+ // Use ctype::widen code without the facet...
1779+ unsigned char uc;
1780+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1781+ {
1782+ uc = static_cast<unsigned char>(money_base::_S_atoms[__i]);
1783+ _M_data->_M_atoms[__i] = btowc(uc);
1784+ }
1785+ }
1786+ else
1787+ {
1788+ // Named locale.
1789+#ifdef __UCLIBC_HAS_XLOCALE__
1790+ __c_locale __old = __uselocale(__cloc);
1791+#else
1792+ // Switch to named locale so that mbsrtowcs will work.
1793+ char* __old = strdup(setlocale(LC_ALL, NULL));
1794+ setlocale(LC_ALL, __name);
1795+#endif
1796+
1797+#ifdef __UCLIBC_MJN3_ONLY__
1798+#warning fix this... should be monetary
1799+#endif
1800+#ifdef __UCLIBC__
1801+# ifdef __UCLIBC_HAS_XLOCALE__
1802+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1803+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1804+# else
1805+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1806+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1807+# endif
1808+#else
1809+ union __s_and_w { const char *__s; unsigned int __w; } __u;
1810+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1811+ _M_data->_M_decimal_point = static_cast<wchar_t>(__u.__w);
1812+
1813+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1814+ _M_data->_M_thousands_sep = static_cast<wchar_t>(__u.__w);
1815+#endif
1816+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1817+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1818+
1819+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1820+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1821+ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1822+
1823+ wchar_t* __wcs_ps = 0;
1824+ wchar_t* __wcs_ns = 0;
1825+ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1826+ try
1827+ {
1828+ mbstate_t __state;
1829+ size_t __len = strlen(__cpossign);
1830+ if (__len)
1831+ {
1832+ ++__len;
1833+ memset(&__state, 0, sizeof(mbstate_t));
1834+ __wcs_ps = new wchar_t[__len];
1835+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1836+ _M_data->_M_positive_sign = __wcs_ps;
1837+ }
1838+ else
1839+ _M_data->_M_positive_sign = L"";
1840+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1841+
1842+ __len = strlen(__cnegsign);
1843+ if (!__nposn)
1844+ _M_data->_M_negative_sign = L"()";
1845+ else if (__len)
1846+ {
1847+ ++__len;
1848+ memset(&__state, 0, sizeof(mbstate_t));
1849+ __wcs_ns = new wchar_t[__len];
1850+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1851+ _M_data->_M_negative_sign = __wcs_ns;
1852+ }
1853+ else
1854+ _M_data->_M_negative_sign = L"";
1855+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1856+
1857+ // _Intl == true.
1858+ __len = strlen(__ccurr);
1859+ if (__len)
1860+ {
1861+ ++__len;
1862+ memset(&__state, 0, sizeof(mbstate_t));
1863+ wchar_t* __wcs = new wchar_t[__len];
1864+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1865+ _M_data->_M_curr_symbol = __wcs;
1866+ }
1867+ else
1868+ _M_data->_M_curr_symbol = L"";
1869+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1870+ }
1871+ catch (...)
1872+ {
1873+ delete _M_data;
1874+ _M_data = 0;
1875+ delete __wcs_ps;
1876+ delete __wcs_ns;
1877+#ifdef __UCLIBC_HAS_XLOCALE__
1878+ __uselocale(__old);
1879+#else
1880+ setlocale(LC_ALL, __old);
1881+ free(__old);
1882+#endif
1883+ __throw_exception_again;
1884+ }
1885+
1886+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1887+ __cloc));
1888+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1889+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1890+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1891+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1892+ __pposn);
1893+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1894+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1895+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1896+ __nposn);
1897+
1898+#ifdef __UCLIBC_HAS_XLOCALE__
1899+ __uselocale(__old);
1900+#else
1901+ setlocale(LC_ALL, __old);
1902+ free(__old);
1903+#endif
1904+ }
1905+ }
1906+
1907+ template<>
1908+ void
1909+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
1910+#ifdef __UCLIBC_HAS_XLOCALE__
1911+ const char*)
1912+#else
1913+ const char* __name)
1914+#endif
1915+ {
1916+ if (!_M_data)
1917+ _M_data = new __moneypunct_cache<wchar_t, false>;
1918+
1919+ if (!__cloc)
1920+ {
1921+ // "C" locale
1922+ _M_data->_M_decimal_point = L'.';
1923+ _M_data->_M_thousands_sep = L',';
1924+ _M_data->_M_grouping = "";
1925+ _M_data->_M_grouping_size = 0;
1926+ _M_data->_M_curr_symbol = L"";
1927+ _M_data->_M_curr_symbol_size = 0;
1928+ _M_data->_M_positive_sign = L"";
1929+ _M_data->_M_positive_sign_size = 0;
1930+ _M_data->_M_negative_sign = L"";
1931+ _M_data->_M_negative_sign_size = 0;
1932+ _M_data->_M_frac_digits = 0;
1933+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1934+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1935+
1936+ // Use ctype::widen code without the facet...
1937+ unsigned char uc;
1938+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1939+ {
1940+ uc = static_cast<unsigned char>(money_base::_S_atoms[__i]);
1941+ _M_data->_M_atoms[__i] = btowc(uc);
1942+ }
1943+ }
1944+ else
1945+ {
1946+ // Named locale.
1947+#ifdef __UCLIBC_HAS_XLOCALE__
1948+ __c_locale __old = __uselocale(__cloc);
1949+#else
1950+ // Switch to named locale so that mbsrtowcs will work.
1951+ char* __old = strdup(setlocale(LC_ALL, NULL));
1952+ setlocale(LC_ALL, __name);
1953+#endif
1954+
1955+#ifdef __UCLIBC_MJN3_ONLY__
1956+#warning fix this... should be monetary
1957+#endif
1958+#ifdef __UCLIBC__
1959+# ifdef __UCLIBC_HAS_XLOCALE__
1960+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1961+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1962+# else
1963+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1964+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1965+# endif
1966+#else
1967+ union __s_and_w { const char *__s; unsigned int __w; } __u;
1968+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1969+ _M_data->_M_decimal_point = static_cast<wchar_t>(__u.__w);
1970+
1971+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1972+ _M_data->_M_thousands_sep = static_cast<wchar_t>(__u.__w);
1973+#endif
1974+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1975+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1976+
1977+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1978+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1979+ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1980+
1981+ wchar_t* __wcs_ps = 0;
1982+ wchar_t* __wcs_ns = 0;
1983+ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1984+ try
1985+ {
1986+ mbstate_t __state;
1987+ size_t __len;
1988+ __len = strlen(__cpossign);
1989+ if (__len)
1990+ {
1991+ ++__len;
1992+ memset(&__state, 0, sizeof(mbstate_t));
1993+ __wcs_ps = new wchar_t[__len];
1994+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1995+ _M_data->_M_positive_sign = __wcs_ps;
1996+ }
1997+ else
1998+ _M_data->_M_positive_sign = L"";
1999+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
2000+
2001+ __len = strlen(__cnegsign);
2002+ if (!__nposn)
2003+ _M_data->_M_negative_sign = L"()";
2004+ else if (__len)
2005+ {
2006+ ++__len;
2007+ memset(&__state, 0, sizeof(mbstate_t));
2008+ __wcs_ns = new wchar_t[__len];
2009+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
2010+ _M_data->_M_negative_sign = __wcs_ns;
2011+ }
2012+ else
2013+ _M_data->_M_negative_sign = L"";
2014+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
2015+
2016+ // _Intl == true.
2017+ __len = strlen(__ccurr);
2018+ if (__len)
2019+ {
2020+ ++__len;
2021+ memset(&__state, 0, sizeof(mbstate_t));
2022+ wchar_t* __wcs = new wchar_t[__len];
2023+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
2024+ _M_data->_M_curr_symbol = __wcs;
2025+ }
2026+ else
2027+ _M_data->_M_curr_symbol = L"";
2028+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
2029+ }
2030+ catch (...)
2031+ {
2032+ delete _M_data;
2033+ _M_data = 0;
2034+ delete __wcs_ps;
2035+ delete __wcs_ns;
2036+#ifdef __UCLIBC_HAS_XLOCALE__
2037+ __uselocale(__old);
2038+#else
2039+ setlocale(LC_ALL, __old);
2040+ free(__old);
2041+#endif
2042+ __throw_exception_again;
2043+ }
2044+
2045+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
2046+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
2047+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
2048+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
2049+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
2050+ __pposn);
2051+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
2052+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
2053+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
2054+ __nposn);
2055+
2056+#ifdef __UCLIBC_HAS_XLOCALE__
2057+ __uselocale(__old);
2058+#else
2059+ setlocale(LC_ALL, __old);
2060+ free(__old);
2061+#endif
2062+ }
2063+ }
2064+
2065+ template<>
2066+ moneypunct<wchar_t, true>::~moneypunct()
2067+ {
2068+ if (_M_data->_M_positive_sign_size)
2069+ delete [] _M_data->_M_positive_sign;
2070+ if (_M_data->_M_negative_sign_size
2071+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2072+ delete [] _M_data->_M_negative_sign;
2073+ if (_M_data->_M_curr_symbol_size)
2074+ delete [] _M_data->_M_curr_symbol;
2075+ delete _M_data;
2076+ }
2077+
2078+ template<>
2079+ moneypunct<wchar_t, false>::~moneypunct()
2080+ {
2081+ if (_M_data->_M_positive_sign_size)
2082+ delete [] _M_data->_M_positive_sign;
2083+ if (_M_data->_M_negative_sign_size
2084+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2085+ delete [] _M_data->_M_negative_sign;
2086+ if (_M_data->_M_curr_symbol_size)
2087+ delete [] _M_data->_M_curr_symbol;
2088+ delete _M_data;
2089+ }
2090+#endif
2091+}
2092diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-3.4.2/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2093--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1969-12-31 18:00:00.000000000 -0600
2094+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2004-09-10 10:47:40.000000000 -0500
2095@@ -0,0 +1,183 @@
2096+// std::numpunct implementation details, GNU version -*- C++ -*-
2097+
2098+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2099+//
2100+// This file is part of the GNU ISO C++ Library. This library is free
2101+// software; you can redistribute it and/or modify it under the
2102+// terms of the GNU General Public License as published by the
2103+// Free Software Foundation; either version 2, or (at your option)
2104+// any later version.
2105+
2106+// This library is distributed in the hope that it will be useful,
2107+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2108+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2109+// GNU General Public License for more details.
2110+
2111+// You should have received a copy of the GNU General Public License along
2112+// with this library; see the file COPYING. If not, write to the Free
2113+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2114+// USA.
2115+
2116+// As a special exception, you may use this file as part of a free software
2117+// library without restriction. Specifically, if other files instantiate
2118+// templates or use macros or inline functions from this file, or you compile
2119+// this file and link it with other files to produce an executable, this
2120+// file does not by itself cause the resulting executable to be covered by
2121+// the GNU General Public License. This exception does not however
2122+// invalidate any other reasons why the executable file might be covered by
2123+// the GNU General Public License.
2124+
2125+//
2126+// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
2127+//
2128+
2129+// Written by Benjamin Kosnik <bkoz@redhat.com>
2130+
2131+#define _LIBC
2132+#include <locale>
2133+#undef _LIBC
2134+#include <bits/c++locale_internal.h>
2135+
2136+#ifdef __UCLIBC_MJN3_ONLY__
2137+#warning tailor for stub locale support
2138+#endif
2139+#ifndef __UCLIBC_HAS_XLOCALE__
2140+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2141+#endif
2142+
2143+namespace std
2144+{
2145+ template<>
2146+ void
2147+ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
2148+ {
2149+ if (!_M_data)
2150+ _M_data = new __numpunct_cache<char>;
2151+
2152+ if (!__cloc)
2153+ {
2154+ // "C" locale
2155+ _M_data->_M_grouping = "";
2156+ _M_data->_M_grouping_size = 0;
2157+ _M_data->_M_use_grouping = false;
2158+
2159+ _M_data->_M_decimal_point = '.';
2160+ _M_data->_M_thousands_sep = ',';
2161+
2162+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2163+ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
2164+
2165+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2166+ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
2167+ }
2168+ else
2169+ {
2170+ // Named locale.
2171+ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
2172+ __cloc));
2173+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
2174+ __cloc));
2175+
2176+ // Check for NULL, which implies no grouping.
2177+ if (_M_data->_M_thousands_sep == '\0')
2178+ _M_data->_M_grouping = "";
2179+ else
2180+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2181+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2182+ }
2183+
2184+ // NB: There is no way to extact this info from posix locales.
2185+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2186+ _M_data->_M_truename = "true";
2187+ _M_data->_M_truename_size = strlen(_M_data->_M_truename);
2188+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2189+ _M_data->_M_falsename = "false";
2190+ _M_data->_M_falsename_size = strlen(_M_data->_M_falsename);
2191+ }
2192+
2193+ template<>
2194+ numpunct<char>::~numpunct()
2195+ { delete _M_data; }
2196+
2197+#ifdef _GLIBCXX_USE_WCHAR_T
2198+ template<>
2199+ void
2200+ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
2201+ {
2202+ if (!_M_data)
2203+ _M_data = new __numpunct_cache<wchar_t>;
2204+
2205+ if (!__cloc)
2206+ {
2207+ // "C" locale
2208+ _M_data->_M_grouping = "";
2209+ _M_data->_M_grouping_size = 0;
2210+ _M_data->_M_use_grouping = false;
2211+
2212+ _M_data->_M_decimal_point = L'.';
2213+ _M_data->_M_thousands_sep = L',';
2214+
2215+#ifdef __UCLIBC_HAS_XLOCALE__
2216+ __c_locale __old = __uselocale(_S_get_c_locale());
2217+#endif
2218+ // Use ctype::widen code without the facet...
2219+ unsigned char uc;
2220+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2221+ {
2222+ uc = static_cast<unsigned char>(__num_base::_S_atoms_out[__i]);
2223+ _M_data->_M_atoms_out[__i] = btowc(uc);
2224+ }
2225+
2226+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2227+ {
2228+ uc = static_cast<unsigned char>(__num_base::_S_atoms_in[__j]);
2229+ _M_data->_M_atoms_in[__j] = btowc(uc);
2230+ }
2231+#ifdef __UCLIBC_HAS_XLOCALE__
2232+ __uselocale(__old);
2233+#endif
2234+ }
2235+ else
2236+ {
2237+ // Named locale.
2238+#ifdef __UCLIBC_MJN3_ONLY__
2239+#warning fix this
2240+#endif
2241+#ifdef __UCLIBC__
2242+# ifdef __UCLIBC_HAS_XLOCALE__
2243+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
2244+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
2245+# else
2246+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
2247+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
2248+# endif
2249+#else
2250+ union __s_and_w { const char *__s; unsigned int __w; } __u;
2251+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
2252+ _M_data->_M_decimal_point = static_cast<wchar_t>(__u.__w);
2253+
2254+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
2255+ _M_data->_M_thousands_sep = static_cast<wchar_t>(__u.__w);
2256+#endif
2257+
2258+ if (_M_data->_M_thousands_sep == L'\0')
2259+ _M_data->_M_grouping = "";
2260+ else
2261+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2262+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2263+ }
2264+
2265+ // NB: There is no way to extact this info from posix locales.
2266+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2267+ _M_data->_M_truename = L"true";
2268+ _M_data->_M_truename_size = wcslen(_M_data->_M_truename);
2269+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2270+ _M_data->_M_falsename = L"false";
2271+ _M_data->_M_falsename_size = wcslen(_M_data->_M_falsename);
2272+ }
2273+
2274+ template<>
2275+ numpunct<wchar_t>::~numpunct()
2276+ { delete _M_data; }
2277+ #endif
2278+}
2279diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-3.4.2/libstdc++-v3/config/locale/uclibc/time_members.cc
2280--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/time_members.cc 1969-12-31 18:00:00.000000000 -0600
2281+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/time_members.cc 2004-09-10 10:48:00.000000000 -0500
2282@@ -0,0 +1,356 @@
2283+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2284+
2285+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2286+//
2287+// This file is part of the GNU ISO C++ Library. This library is free
2288+// software; you can redistribute it and/or modify it under the
2289+// terms of the GNU General Public License as published by the
2290+// Free Software Foundation; either version 2, or (at your option)
2291+// any later version.
2292+
2293+// This library is distributed in the hope that it will be useful,
2294+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2295+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2296+// GNU General Public License for more details.
2297+
2298+// You should have received a copy of the GNU General Public License along
2299+// with this library; see the file COPYING. If not, write to the Free
2300+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2301+// USA.
2302+
2303+// As a special exception, you may use this file as part of a free software
2304+// library without restriction. Specifically, if other files instantiate
2305+// templates or use macros or inline functions from this file, or you compile
2306+// this file and link it with other files to produce an executable, this
2307+// file does not by itself cause the resulting executable to be covered by
2308+// the GNU General Public License. This exception does not however
2309+// invalidate any other reasons why the executable file might be covered by
2310+// the GNU General Public License.
2311+
2312+//
2313+// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
2314+// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
2315+//
2316+
2317+// Written by Benjamin Kosnik <bkoz@redhat.com>
2318+
2319+#include <locale>
2320+#include <bits/c++locale_internal.h>
2321+
2322+#ifdef __UCLIBC_MJN3_ONLY__
2323+#warning tailor for stub locale support
2324+#endif
2325+#ifndef __UCLIBC_HAS_XLOCALE__
2326+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2327+#endif
2328+
2329+namespace std
2330+{
2331+ template<>
2332+ void
2333+ __timepunct<char>::
2334+ _M_put(char* __s, size_t __maxlen, const char* __format,
2335+ const tm* __tm) const
2336+ {
2337+#ifdef __UCLIBC_HAS_XLOCALE__
2338+ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
2339+ _M_c_locale_timepunct);
2340+#else
2341+ char* __old = strdup(setlocale(LC_ALL, NULL));
2342+ setlocale(LC_ALL, _M_name_timepunct);
2343+ const size_t __len = strftime(__s, __maxlen, __format, __tm);
2344+ setlocale(LC_ALL, __old);
2345+ free(__old);
2346+#endif
2347+ // Make sure __s is null terminated.
2348+ if (__len == 0)
2349+ __s[0] = '\0';
2350+ }
2351+
2352+ template<>
2353+ void
2354+ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
2355+ {
2356+ if (!_M_data)
2357+ _M_data = new __timepunct_cache<char>;
2358+
2359+ if (!__cloc)
2360+ {
2361+ // "C" locale
2362+ _M_c_locale_timepunct = _S_get_c_locale();
2363+
2364+ _M_data->_M_date_format = "%m/%d/%y";
2365+ _M_data->_M_date_era_format = "%m/%d/%y";
2366+ _M_data->_M_time_format = "%H:%M:%S";
2367+ _M_data->_M_time_era_format = "%H:%M:%S";
2368+ _M_data->_M_date_time_format = "";
2369+ _M_data->_M_date_time_era_format = "";
2370+ _M_data->_M_am = "AM";
2371+ _M_data->_M_pm = "PM";
2372+ _M_data->_M_am_pm_format = "";
2373+
2374+ // Day names, starting with "C"'s Sunday.
2375+ _M_data->_M_day1 = "Sunday";
2376+ _M_data->_M_day2 = "Monday";
2377+ _M_data->_M_day3 = "Tuesday";
2378+ _M_data->_M_day4 = "Wednesday";
2379+ _M_data->_M_day5 = "Thursday";
2380+ _M_data->_M_day6 = "Friday";
2381+ _M_data->_M_day7 = "Saturday";
2382+
2383+ // Abbreviated day names, starting with "C"'s Sun.
2384+ _M_data->_M_aday1 = "Sun";
2385+ _M_data->_M_aday2 = "Mon";
2386+ _M_data->_M_aday3 = "Tue";
2387+ _M_data->_M_aday4 = "Wed";
2388+ _M_data->_M_aday5 = "Thu";
2389+ _M_data->_M_aday6 = "Fri";
2390+ _M_data->_M_aday7 = "Sat";
2391+
2392+ // Month names, starting with "C"'s January.
2393+ _M_data->_M_month01 = "January";
2394+ _M_data->_M_month02 = "February";
2395+ _M_data->_M_month03 = "March";
2396+ _M_data->_M_month04 = "April";
2397+ _M_data->_M_month05 = "May";
2398+ _M_data->_M_month06 = "June";
2399+ _M_data->_M_month07 = "July";
2400+ _M_data->_M_month08 = "August";
2401+ _M_data->_M_month09 = "September";
2402+ _M_data->_M_month10 = "October";
2403+ _M_data->_M_month11 = "November";
2404+ _M_data->_M_month12 = "December";
2405+
2406+ // Abbreviated month names, starting with "C"'s Jan.
2407+ _M_data->_M_amonth01 = "Jan";
2408+ _M_data->_M_amonth02 = "Feb";
2409+ _M_data->_M_amonth03 = "Mar";
2410+ _M_data->_M_amonth04 = "Apr";
2411+ _M_data->_M_amonth05 = "May";
2412+ _M_data->_M_amonth06 = "Jun";
2413+ _M_data->_M_amonth07 = "Jul";
2414+ _M_data->_M_amonth08 = "Aug";
2415+ _M_data->_M_amonth09 = "Sep";
2416+ _M_data->_M_amonth10 = "Oct";
2417+ _M_data->_M_amonth11 = "Nov";
2418+ _M_data->_M_amonth12 = "Dec";
2419+ }
2420+ else
2421+ {
2422+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2423+
2424+ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
2425+ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
2426+ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
2427+ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
2428+ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
2429+ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT, __cloc);
2430+ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
2431+ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
2432+ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
2433+
2434+ // Day names, starting with "C"'s Sunday.
2435+ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
2436+ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
2437+ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
2438+ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
2439+ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
2440+ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
2441+ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
2442+
2443+ // Abbreviated day names, starting with "C"'s Sun.
2444+ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
2445+ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
2446+ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
2447+ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
2448+ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
2449+ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
2450+ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
2451+
2452+ // Month names, starting with "C"'s January.
2453+ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
2454+ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
2455+ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
2456+ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
2457+ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
2458+ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
2459+ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
2460+ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
2461+ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
2462+ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
2463+ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
2464+ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
2465+
2466+ // Abbreviated month names, starting with "C"'s Jan.
2467+ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
2468+ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
2469+ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
2470+ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
2471+ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
2472+ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
2473+ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
2474+ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
2475+ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
2476+ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
2477+ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
2478+ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
2479+ }
2480+ }
2481+
2482+#ifdef _GLIBCXX_USE_WCHAR_T
2483+ template<>
2484+ void
2485+ __timepunct<wchar_t>::
2486+ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
2487+ const tm* __tm) const
2488+ {
2489+#ifdef __UCLIBC_HAS_XLOCALE__
2490+ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
2491+ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
2492+ _M_c_locale_timepunct);
2493+#else
2494+ char* __old = strdup(setlocale(LC_ALL, NULL));
2495+ setlocale(LC_ALL, _M_name_timepunct);
2496+ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
2497+ setlocale(LC_ALL, __old);
2498+ free(__old);
2499+#endif
2500+ // Make sure __s is null terminated.
2501+ if (__len == 0)
2502+ __s[0] = L'\0';
2503+ }
2504+
2505+ template<>
2506+ void
2507+ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
2508+ {
2509+ if (!_M_data)
2510+ _M_data = new __timepunct_cache<wchar_t>;
2511+
2512+#warning wide time stuff
2513+// if (!__cloc)
2514+ {
2515+ // "C" locale
2516+ _M_c_locale_timepunct = _S_get_c_locale();
2517+
2518+ _M_data->_M_date_format = L"%m/%d/%y";
2519+ _M_data->_M_date_era_format = L"%m/%d/%y";
2520+ _M_data->_M_time_format = L"%H:%M:%S";
2521+ _M_data->_M_time_era_format = L"%H:%M:%S";
2522+ _M_data->_M_date_time_format = L"";
2523+ _M_data->_M_date_time_era_format = L"";
2524+ _M_data->_M_am = L"AM";
2525+ _M_data->_M_pm = L"PM";
2526+ _M_data->_M_am_pm_format = L"";
2527+
2528+ // Day names, starting with "C"'s Sunday.
2529+ _M_data->_M_day1 = L"Sunday";
2530+ _M_data->_M_day2 = L"Monday";
2531+ _M_data->_M_day3 = L"Tuesday";
2532+ _M_data->_M_day4 = L"Wednesday";
2533+ _M_data->_M_day5 = L"Thursday";
2534+ _M_data->_M_day6 = L"Friday";
2535+ _M_data->_M_day7 = L"Saturday";
2536+
2537+ // Abbreviated day names, starting with "C"'s Sun.
2538+ _M_data->_M_aday1 = L"Sun";
2539+ _M_data->_M_aday2 = L"Mon";
2540+ _M_data->_M_aday3 = L"Tue";
2541+ _M_data->_M_aday4 = L"Wed";
2542+ _M_data->_M_aday5 = L"Thu";
2543+ _M_data->_M_aday6 = L"Fri";
2544+ _M_data->_M_aday7 = L"Sat";
2545+
2546+ // Month names, starting with "C"'s January.
2547+ _M_data->_M_month01 = L"January";
2548+ _M_data->_M_month02 = L"February";
2549+ _M_data->_M_month03 = L"March";
2550+ _M_data->_M_month04 = L"April";
2551+ _M_data->_M_month05 = L"May";
2552+ _M_data->_M_month06 = L"June";
2553+ _M_data->_M_month07 = L"July";
2554+ _M_data->_M_month08 = L"August";
2555+ _M_data->_M_month09 = L"September";
2556+ _M_data->_M_month10 = L"October";
2557+ _M_data->_M_month11 = L"November";
2558+ _M_data->_M_month12 = L"December";
2559+
2560+ // Abbreviated month names, starting with "C"'s Jan.
2561+ _M_data->_M_amonth01 = L"Jan";
2562+ _M_data->_M_amonth02 = L"Feb";
2563+ _M_data->_M_amonth03 = L"Mar";
2564+ _M_data->_M_amonth04 = L"Apr";
2565+ _M_data->_M_amonth05 = L"May";
2566+ _M_data->_M_amonth06 = L"Jun";
2567+ _M_data->_M_amonth07 = L"Jul";
2568+ _M_data->_M_amonth08 = L"Aug";
2569+ _M_data->_M_amonth09 = L"Sep";
2570+ _M_data->_M_amonth10 = L"Oct";
2571+ _M_data->_M_amonth11 = L"Nov";
2572+ _M_data->_M_amonth12 = L"Dec";
2573+ }
2574+#if 0
2575+ else
2576+ {
2577+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2578+
2579+ _M_data->_M_date_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WD_FMT, __cloc));
2580+ _M_data->_M_date_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_D_FMT, __cloc));
2581+ _M_data->_M_time_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WT_FMT, __cloc));
2582+ _M_data->_M_time_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_T_FMT, __cloc));
2583+ _M_data->_M_date_time_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WD_T_FMT, __cloc));
2584+ _M_data->_M_date_time_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc));
2585+ _M_data->_M_am = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WAM_STR, __cloc));
2586+ _M_data->_M_pm = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WPM_STR, __cloc));
2587+ _M_data->_M_am_pm_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc));
2588+
2589+ // Day names, starting with "C"'s Sunday.
2590+ _M_data->_M_day1 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_1, __cloc));
2591+ _M_data->_M_day2 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_2, __cloc));
2592+ _M_data->_M_day3 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_3, __cloc));
2593+ _M_data->_M_day4 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_4, __cloc));
2594+ _M_data->_M_day5 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_5, __cloc));
2595+ _M_data->_M_day6 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_6, __cloc));
2596+ _M_data->_M_day7 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_7, __cloc));
2597+
2598+ // Abbreviated day names, starting with "C"'s Sun.
2599+ _M_data->_M_aday1 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_1, __cloc));
2600+ _M_data->_M_aday2 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_2, __cloc));
2601+ _M_data->_M_aday3 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_3, __cloc));
2602+ _M_data->_M_aday4 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_4, __cloc));
2603+ _M_data->_M_aday5 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_5, __cloc));
2604+ _M_data->_M_aday6 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_6, __cloc));
2605+ _M_data->_M_aday7 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_7, __cloc));
2606+
2607+ // Month names, starting with "C"'s January.
2608+ _M_data->_M_month01 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_1, __cloc));
2609+ _M_data->_M_month02 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_2, __cloc));
2610+ _M_data->_M_month03 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_3, __cloc));
2611+ _M_data->_M_month04 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_4, __cloc));
2612+ _M_data->_M_month05 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_5, __cloc));
2613+ _M_data->_M_month06 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_6, __cloc));
2614+ _M_data->_M_month07 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_7, __cloc));
2615+ _M_data->_M_month08 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_8, __cloc));
2616+ _M_data->_M_month09 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_9, __cloc));
2617+ _M_data->_M_month10 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_10, __cloc));
2618+ _M_data->_M_month11 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_11, __cloc));
2619+ _M_data->_M_month12 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_12, __cloc));
2620+
2621+ // Abbreviated month names, starting with "C"'s Jan.
2622+ _M_data->_M_amonth01 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_1, __cloc));
2623+ _M_data->_M_amonth02 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_2, __cloc));
2624+ _M_data->_M_amonth03 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_3, __cloc));
2625+ _M_data->_M_amonth04 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_4, __cloc));
2626+ _M_data->_M_amonth05 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_5, __cloc));
2627+ _M_data->_M_amonth06 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_6, __cloc));
2628+ _M_data->_M_amonth07 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_7, __cloc));
2629+ _M_data->_M_amonth08 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_8, __cloc));
2630+ _M_data->_M_amonth09 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_9, __cloc));
2631+ _M_data->_M_amonth10 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_10, __cloc));
2632+ _M_data->_M_amonth11 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_11, __cloc));
2633+ _M_data->_M_amonth12 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_12, __cloc));
2634+ }
2635+#endif // 0
2636+ }
2637+#endif
2638+}
2639diff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/time_members.h gcc-3.4.2/libstdc++-v3/config/locale/uclibc/time_members.h
2640--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/time_members.h 1969-12-31 18:00:00.000000000 -0600
2641+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/time_members.h 2004-09-10 10:47:40.000000000 -0500
2642@@ -0,0 +1,68 @@
2643+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2644+
2645+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2646+//
2647+// This file is part of the GNU ISO C++ Library. This library is free
2648+// software; you can redistribute it and/or modify it under the
2649+// terms of the GNU General Public License as published by the
2650+// Free Software Foundation; either version 2, or (at your option)
2651+// any later version.
2652+
2653+// This library is distributed in the hope that it will be useful,
2654+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2655+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2656+// GNU General Public License for more details.
2657+
2658+// You should have received a copy of the GNU General Public License along
2659+// with this library; see the file COPYING. If not, write to the Free
2660+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2661+// USA.
2662+
2663+// As a special exception, you may use this file as part of a free software
2664+// library without restriction. Specifically, if other files instantiate
2665+// templates or use macros or inline functions from this file, or you compile
2666+// this file and link it with other files to produce an executable, this
2667+// file does not by itself cause the resulting executable to be covered by
2668+// the GNU General Public License. This exception does not however
2669+// invalidate any other reasons why the executable file might be covered by
2670+// the GNU General Public License.
2671+
2672+//
2673+// ISO C++ 14882: 22.2.5.1.2 - time_get functions
2674+// ISO C++ 14882: 22.2.5.3.2 - time_put functions
2675+//
2676+
2677+// Written by Benjamin Kosnik <bkoz@redhat.com>
2678+
2679+ template<typename _CharT>
2680+ __timepunct<_CharT>::__timepunct(size_t __refs)
2681+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2682+ _M_name_timepunct(_S_get_c_name())
2683+ { _M_initialize_timepunct(); }
2684+
2685+ template<typename _CharT>
2686+ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
2687+ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
2688+ _M_name_timepunct(_S_get_c_name())
2689+ { _M_initialize_timepunct(); }
2690+
2691+ template<typename _CharT>
2692+ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
2693+ size_t __refs)
2694+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2695+ _M_name_timepunct(__s)
2696+ {
2697+ char* __tmp = new char[std::strlen(__s) + 1];
2698+ std::strcpy(__tmp, __s);
2699+ _M_name_timepunct = __tmp;
2700+ _M_initialize_timepunct(__cloc);
2701+ }
2702+
2703+ template<typename _CharT>
2704+ __timepunct<_CharT>::~__timepunct()
2705+ {
2706+ if (_M_name_timepunct != _S_get_c_name())
2707+ delete [] _M_name_timepunct;
2708+ delete _M_data;
2709+ _S_destroy_c_locale(_M_c_locale_timepunct);
2710+ }
2711diff -urN gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/ctype_base.h gcc-3.4.2/libstdc++-v3/config/os/uclibc/ctype_base.h
2712--- gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/ctype_base.h 1969-12-31 18:00:00.000000000 -0600
2713+++ gcc-3.4.2/libstdc++-v3/config/os/uclibc/ctype_base.h 2004-09-10 10:47:40.000000000 -0500
2714@@ -0,0 +1,58 @@
2715+// Locale support -*- C++ -*-
2716+
2717+// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
2718+// Free Software Foundation, Inc.
2719+//
2720+// This file is part of the GNU ISO C++ Library. This library is free
2721+// software; you can redistribute it and/or modify it under the
2722+// terms of the GNU General Public License as published by the
2723+// Free Software Foundation; either version 2, or (at your option)
2724+// any later version.
2725+
2726+// This library is distributed in the hope that it will be useful,
2727+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2728+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2729+// GNU General Public License for more details.
2730+
2731+// You should have received a copy of the GNU General Public License along
2732+// with this library; see the file COPYING. If not, write to the Free
2733+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2734+// USA.
2735+
2736+// As a special exception, you may use this file as part of a free software
2737+// library without restriction. Specifically, if other files instantiate
2738+// templates or use macros or inline functions from this file, or you compile
2739+// this file and link it with other files to produce an executable, this
2740+// file does not by itself cause the resulting executable to be covered by
2741+// the GNU General Public License. This exception does not however
2742+// invalidate any other reasons why the executable file might be covered by
2743+// the GNU General Public License.
2744+
2745+//
2746+// ISO C++ 14882: 22.1 Locales
2747+//
2748+
2749+// Information as gleaned from /usr/include/ctype.h
2750+
2751+ struct ctype_base
2752+ {
2753+ // Note: In uClibc, the following two types depend on configuration.
2754+
2755+ // Non-standard typedefs.
2756+ typedef const __ctype_touplow_t* __to_type;
2757+
2758+ // NB: Offsets into ctype<char>::_M_table force a particular size
2759+ // on the mask type. Because of this, we don't use an enum.
2760+ typedef __ctype_mask_t mask;
2761+ static const mask upper = _ISupper;
2762+ static const mask lower = _ISlower;
2763+ static const mask alpha = _ISalpha;
2764+ static const mask digit = _ISdigit;
2765+ static const mask xdigit = _ISxdigit;
2766+ static const mask space = _ISspace;
2767+ static const mask print = _ISprint;
2768+ static const mask graph = _ISalpha | _ISdigit | _ISpunct;
2769+ static const mask cntrl = _IScntrl;
2770+ static const mask punct = _ISpunct;
2771+ static const mask alnum = _ISalpha | _ISdigit;
2772+ };
2773diff -urN gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/ctype_inline.h gcc-3.4.2/libstdc++-v3/config/os/uclibc/ctype_inline.h
2774--- gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/ctype_inline.h 1969-12-31 18:00:00.000000000 -0600
2775+++ gcc-3.4.2/libstdc++-v3/config/os/uclibc/ctype_inline.h 2004-09-10 10:47:40.000000000 -0500
2776@@ -0,0 +1,69 @@
2777+// Locale support -*- C++ -*-
2778+
2779+// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
2780+//
2781+// This file is part of the GNU ISO C++ Library. This library is free
2782+// software; you can redistribute it and/or modify it under the
2783+// terms of the GNU General Public License as published by the
2784+// Free Software Foundation; either version 2, or (at your option)
2785+// any later version.
2786+
2787+// This library is distributed in the hope that it will be useful,
2788+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2789+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2790+// GNU General Public License for more details.
2791+
2792+// You should have received a copy of the GNU General Public License along
2793+// with this library; see the file COPYING. If not, write to the Free
2794+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2795+// USA.
2796+
2797+// As a special exception, you may use this file as part of a free software
2798+// library without restriction. Specifically, if other files instantiate
2799+// templates or use macros or inline functions from this file, or you compile
2800+// this file and link it with other files to produce an executable, this
2801+// file does not by itself cause the resulting executable to be covered by
2802+// the GNU General Public License. This exception does not however
2803+// invalidate any other reasons why the executable file might be covered by
2804+// the GNU General Public License.
2805+
2806+//
2807+// ISO C++ 14882: 22.1 Locales
2808+//
2809+
2810+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
2811+// functions go in ctype.cc
2812+
2813+ bool
2814+ ctype<char>::
2815+ is(mask __m, char __c) const
2816+ { return _M_table[static_cast<unsigned char>(__c)] & __m; }
2817+
2818+ const char*
2819+ ctype<char>::
2820+ is(const char* __low, const char* __high, mask* __vec) const
2821+ {
2822+ while (__low < __high)
2823+ *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
2824+ return __high;
2825+ }
2826+
2827+ const char*
2828+ ctype<char>::
2829+ scan_is(mask __m, const char* __low, const char* __high) const
2830+ {
2831+ while (__low < __high
2832+ && !(_M_table[static_cast<unsigned char>(*__low)] & __m))
2833+ ++__low;
2834+ return __low;
2835+ }
2836+
2837+ const char*
2838+ ctype<char>::
2839+ scan_not(mask __m, const char* __low, const char* __high) const
2840+ {
2841+ while (__low < __high
2842+ && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
2843+ ++__low;
2844+ return __low;
2845+ }
2846diff -urN gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/ctype_noninline.h gcc-3.4.2/libstdc++-v3/config/os/uclibc/ctype_noninline.h
2847--- gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1969-12-31 18:00:00.000000000 -0600
2848+++ gcc-3.4.2/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2004-09-10 10:47:40.000000000 -0500
2849@@ -0,0 +1,92 @@
2850+// Locale support -*- C++ -*-
2851+
2852+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
2853+// Free Software Foundation, Inc.
2854+//
2855+// This file is part of the GNU ISO C++ Library. This library is free
2856+// software; you can redistribute it and/or modify it under the
2857+// terms of the GNU General Public License as published by the
2858+// Free Software Foundation; either version 2, or (at your option)
2859+// any later version.
2860+
2861+// This library is distributed in the hope that it will be useful,
2862+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2863+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2864+// GNU General Public License for more details.
2865+
2866+// You should have received a copy of the GNU General Public License along
2867+// with this library; see the file COPYING. If not, write to the Free
2868+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2869+// USA.
2870+
2871+// As a special exception, you may use this file as part of a free software
2872+// library without restriction. Specifically, if other files instantiate
2873+// templates or use macros or inline functions from this file, or you compile
2874+// this file and link it with other files to produce an executable, this
2875+// file does not by itself cause the resulting executable to be covered by
2876+// the GNU General Public License. This exception does not however
2877+// invalidate any other reasons why the executable file might be covered by
2878+// the GNU General Public License.
2879+
2880+//
2881+// ISO C++ 14882: 22.1 Locales
2882+//
2883+
2884+// Information as gleaned from /usr/include/ctype.h
2885+
2886+ const ctype_base::mask*
2887+ ctype<char>::classic_table() throw()
2888+ { return __C_ctype_b; }
2889+
2890+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
2891+ size_t __refs)
2892+ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
2893+ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
2894+ {
2895+ _M_toupper = __C_ctype_toupper;
2896+ _M_tolower = __C_ctype_tolower;
2897+ _M_table = __table ? __table : __C_ctype_b;
2898+ memset(_M_widen, 0, sizeof(_M_widen));
2899+ memset(_M_narrow, 0, sizeof(_M_narrow));
2900+ }
2901+
2902+ ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
2903+ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
2904+ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
2905+ {
2906+ _M_toupper = __C_ctype_toupper;
2907+ _M_tolower = __C_ctype_tolower;
2908+ _M_table = __table ? __table : __C_ctype_b;
2909+ memset(_M_widen, 0, sizeof(_M_widen));
2910+ memset(_M_narrow, 0, sizeof(_M_narrow));
2911+ }
2912+
2913+ char
2914+ ctype<char>::do_toupper(char __c) const
2915+ { return _M_toupper[static_cast<unsigned char>(__c)]; }
2916+
2917+ const char*
2918+ ctype<char>::do_toupper(char* __low, const char* __high) const
2919+ {
2920+ while (__low < __high)
2921+ {
2922+ *__low = _M_toupper[static_cast<unsigned char>(*__low)];
2923+ ++__low;
2924+ }
2925+ return __high;
2926+ }
2927+
2928+ char
2929+ ctype<char>::do_tolower(char __c) const
2930+ { return _M_tolower[static_cast<unsigned char>(__c)]; }
2931+
2932+ const char*
2933+ ctype<char>::do_tolower(char* __low, const char* __high) const
2934+ {
2935+ while (__low < __high)
2936+ {
2937+ *__low = _M_tolower[static_cast<unsigned char>(*__low)];
2938+ ++__low;
2939+ }
2940+ return __high;
2941+ }
2942diff -urN gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/os_defines.h gcc-3.4.2/libstdc++-v3/config/os/uclibc/os_defines.h
2943--- gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/os_defines.h 1969-12-31 18:00:00.000000000 -0600
2944+++ gcc-3.4.2/libstdc++-v3/config/os/uclibc/os_defines.h 2004-09-10 10:47:40.000000000 -0500
2945@@ -0,0 +1,44 @@
2946+// Specific definitions for GNU/Linux -*- C++ -*-
2947+
2948+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
2949+//
2950+// This file is part of the GNU ISO C++ Library. This library is free
2951+// software; you can redistribute it and/or modify it under the
2952+// terms of the GNU General Public License as published by the
2953+// Free Software Foundation; either version 2, or (at your option)
2954+// any later version.
2955+
2956+// This library is distributed in the hope that it will be useful,
2957+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2958+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2959+// GNU General Public License for more details.
2960+
2961+// You should have received a copy of the GNU General Public License along
2962+// with this library; see the file COPYING. If not, write to the Free
2963+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2964+// USA.
2965+
2966+// As a special exception, you may use this file as part of a free software
2967+// library without restriction. Specifically, if other files instantiate
2968+// templates or use macros or inline functions from this file, or you compile
2969+// this file and link it with other files to produce an executable, this
2970+// file does not by itself cause the resulting executable to be covered by
2971+// the GNU General Public License. This exception does not however
2972+// invalidate any other reasons why the executable file might be covered by
2973+// the GNU General Public License.
2974+
2975+#ifndef _GLIBCXX_OS_DEFINES
2976+#define _GLIBCXX_OS_DEFINES 1
2977+
2978+// System-specific #define, typedefs, corrections, etc, go here. This
2979+// file will come before all others.
2980+
2981+// This keeps isanum, et al from being propagated as macros.
2982+#define __NO_CTYPE 1
2983+
2984+#include <features.h>
2985+
2986+// We must not see the optimized string functions GNU libc defines.
2987+#define __NO_STRING_INLINES
2988+
2989+#endif
2990diff -urN gcc-3.4.2-dist/libstdc++-v3/configure gcc-3.4.2/libstdc++-v3/configure
2991--- gcc-3.4.2-dist/libstdc++-v3/configure 2004-08-13 15:44:04.000000000 -0500
2992+++ gcc-3.4.2/libstdc++-v3/configure 2004-09-10 10:47:40.000000000 -0500
2993@@ -3878,6 +3878,11 @@
2994 lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
2995 ;;
2996
2997+linux-uclibc*)
2998+ lt_cv_deplibs_check_method=pass_all
2999+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
3000+ ;;
3001+
3002 netbsd*)
3003 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
3004 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
3005@@ -5545,6 +5550,9 @@
3006 # Default to "generic".
3007 if test $enable_clocale_flag = auto; then
3008 case x${target_os} in
3009+ xlinux-uclibc*)
3010+ enable_clocale_flag=uclibc
3011+ ;;
3012 xlinux* | xgnu* | xkfreebsd*-gnu | xknetbsd*-gnu)
3013 cat >conftest.$ac_ext <<_ACEOF
3014 #line $LINENO "configure"
3015@@ -5759,6 +5767,77 @@
3016 CTIME_CC=config/locale/generic/time_members.cc
3017 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
3018 ;;
3019+ uclibc)
3020+ echo "$as_me:$LINENO: result: uclibc" >&5
3021+echo "${ECHO_T}uclibc" >&6
3022+
3023+ # Declare intention to use gettext, and add support for specific
3024+ # languages.
3025+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
3026+ ALL_LINGUAS="de fr"
3027+
3028+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
3029+ # Extract the first word of "msgfmt", so it can be a program name with args.
3030+set dummy msgfmt; ac_word=$2
3031+echo "$as_me:$LINENO: checking for $ac_word" >&5
3032+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
3033+if test "${ac_cv_prog_check_msgfmt+set}" = set; then
3034+ echo $ECHO_N "(cached) $ECHO_C" >&6
3035+else
3036+ if test -n "$check_msgfmt"; then
3037+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
3038+else
3039+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3040+for as_dir in $PATH
3041+do
3042+ IFS=$as_save_IFS
3043+ test -z "$as_dir" && as_dir=.
3044+ for ac_exec_ext in '' $ac_executable_extensions; do
3045+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
3046+ ac_cv_prog_check_msgfmt="yes"
3047+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
3048+ break 2
3049+ fi
3050+done
3051+done
3052+
3053+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
3054+fi
3055+fi
3056+check_msgfmt=$ac_cv_prog_check_msgfmt
3057+if test -n "$check_msgfmt"; then
3058+ echo "$as_me:$LINENO: result: $check_msgfmt" >&5
3059+echo "${ECHO_T}$check_msgfmt" >&6
3060+else
3061+ echo "$as_me:$LINENO: result: no" >&5
3062+echo "${ECHO_T}no" >&6
3063+fi
3064+
3065+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
3066+ USE_NLS=yes
3067+ fi
3068+ # Export the build objects.
3069+ for ling in $ALL_LINGUAS; do \
3070+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
3071+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
3072+ done
3073+
3074+
3075+
3076+ CLOCALE_H=config/locale/uclibc/c_locale.h
3077+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
3078+ CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
3079+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
3080+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
3081+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
3082+ CMESSAGES_H=config/locale/uclibc/messages_members.h
3083+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
3084+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
3085+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
3086+ CTIME_H=config/locale/uclibc/time_members.h
3087+ CTIME_CC=config/locale/uclibc/time_members.cc
3088+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
3089+ ;;
3090 esac
3091
3092 # This is where the testsuite looks for locale catalogs, using the
3093diff -urN gcc-3.4.2-dist/libstdc++-v3/configure.host gcc-3.4.2/libstdc++-v3/configure.host
3094--- gcc-3.4.2-dist/libstdc++-v3/configure.host 2004-08-27 14:52:30.000000000 -0500
3095+++ gcc-3.4.2/libstdc++-v3/configure.host 2004-09-10 10:47:40.000000000 -0500
3096@@ -217,6 +217,12 @@
3097 ;;
3098 esac
3099
3100+# Override for uClibc since linux-uclibc gets mishandled above.
3101+case "${host_os}" in
3102+ *-uclibc*)
3103+ os_include_dir="os/uclibc"
3104+ ;;
3105+esac
3106
3107 # Set any OS-dependent and CPU-dependent bits.
3108 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
3109diff -urN gcc-3.4.2-dist/libstdc++-v3/crossconfig.m4 gcc-3.4.2/libstdc++-v3/crossconfig.m4
3110--- gcc-3.4.2-dist/libstdc++-v3/crossconfig.m4 2004-07-06 20:23:49.000000000 -0500
3111+++ gcc-3.4.2/libstdc++-v3/crossconfig.m4 2004-09-10 10:47:40.000000000 -0500
3112@@ -138,6 +138,99 @@
3113 ;;
3114 esac
3115 ;;
3116+ *-uclibc*)
3117+# Temporary hack until we implement the float versions of the libm funcs
3118+ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
3119+ machine/endian.h machine/param.h sys/machine.h sys/types.h \
3120+ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h])
3121+ SECTION_FLAGS='-ffunction-sections -fdata-sections'
3122+ AC_SUBST(SECTION_FLAGS)
3123+ GLIBCXX_CHECK_LINKER_FEATURES
3124+ GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
3125+ GLIBCXX_CHECK_WCHAR_T_SUPPORT
3126+
3127+ # For LFS.
3128+ AC_DEFINE(HAVE_INT64_T)
3129+ case "$target" in
3130+ *-uclinux*)
3131+ # Don't enable LFS with uClinux
3132+ ;;
3133+ *)
3134+ AC_DEFINE(_GLIBCXX_USE_LFS)
3135+ esac
3136+
3137+ # For showmanyc_helper().
3138+ AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
3139+ GLIBCXX_CHECK_POLL
3140+ GLIBCXX_CHECK_S_ISREG_OR_S_IFREG
3141+
3142+ # For xsputn_2().
3143+ AC_CHECK_HEADERS(sys/uio.h)
3144+ GLIBCXX_CHECK_WRITEV
3145+
3146+# AC_DEFINE(HAVE_ACOSF)
3147+# AC_DEFINE(HAVE_ASINF)
3148+# AC_DEFINE(HAVE_ATANF)
3149+# AC_DEFINE(HAVE_ATAN2F)
3150+ AC_DEFINE(HAVE_CEILF)
3151+ AC_DEFINE(HAVE_COPYSIGN)
3152+# AC_DEFINE(HAVE_COPYSIGNF)
3153+# AC_DEFINE(HAVE_COSF)
3154+# AC_DEFINE(HAVE_COSHF)
3155+# AC_DEFINE(HAVE_EXPF)
3156+# AC_DEFINE(HAVE_FABSF)
3157+ AC_DEFINE(HAVE_FINITE)
3158+ AC_DEFINE(HAVE_FINITEF)
3159+ AC_DEFINE(HAVE_FLOORF)
3160+# AC_DEFINE(HAVE_FMODF)
3161+# AC_DEFINE(HAVE_FREXPF)
3162+ AC_DEFINE(HAVE_HYPOT)
3163+# AC_DEFINE(HAVE_HYPOTF)
3164+ AC_DEFINE(HAVE_ISINF)
3165+ AC_DEFINE(HAVE_ISINFF)
3166+ AC_DEFINE(HAVE_ISNAN)
3167+ AC_DEFINE(HAVE_ISNANF)
3168+# AC_DEFINE(HAVE_LOGF)
3169+# AC_DEFINE(HAVE_LOG10F)
3170+# AC_DEFINE(HAVE_MODFF)
3171+# AC_DEFINE(HAVE_SINF)
3172+# AC_DEFINE(HAVE_SINHF)
3173+# AC_DEFINE(HAVE_SINCOS)
3174+# AC_DEFINE(HAVE_SINCOSF)
3175+ AC_DEFINE(HAVE_SQRTF)
3176+# AC_DEFINE(HAVE_TANF)
3177+# AC_DEFINE(HAVE_TANHF)
3178+ if test x"long_double_math_on_this_cpu" = x"yes"; then
3179+ AC_MSG_ERROR([long_double_math_on_this_cpu is yes!])
3180+# AC_DEFINE(HAVE_ACOSL)
3181+# AC_DEFINE(HAVE_ASINL)
3182+# AC_DEFINE(HAVE_ATANL)
3183+# AC_DEFINE(HAVE_ATAN2L)
3184+# AC_DEFINE(HAVE_CEILL)
3185+# AC_DEFINE(HAVE_COPYSIGNL)
3186+# AC_DEFINE(HAVE_COSL)
3187+# AC_DEFINE(HAVE_COSHL)
3188+# AC_DEFINE(HAVE_EXPL)
3189+# AC_DEFINE(HAVE_FABSL)
3190+# AC_DEFINE(HAVE_FINITEL)
3191+# AC_DEFINE(HAVE_FLOORL)
3192+# AC_DEFINE(HAVE_FMODL)
3193+# AC_DEFINE(HAVE_FREXPL)
3194+# AC_DEFINE(HAVE_HYPOTL)
3195+# AC_DEFINE(HAVE_ISINFL)
3196+# AC_DEFINE(HAVE_ISNANL)
3197+# AC_DEFINE(HAVE_LOGL)
3198+# AC_DEFINE(HAVE_LOG10L)
3199+# AC_DEFINE(HAVE_MODFL)
3200+# AC_DEFINE(HAVE_POWL)
3201+# AC_DEFINE(HAVE_SINL)
3202+# AC_DEFINE(HAVE_SINHL)
3203+# AC_DEFINE(HAVE_SINCOSL)
3204+# AC_DEFINE(HAVE_SQRTL)
3205+# AC_DEFINE(HAVE_TANL)
3206+# AC_DEFINE(HAVE_TANHL)
3207+ fi
3208+ ;;
3209 *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu)
3210 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
3211 machine/endian.h machine/param.h sys/machine.h sys/types.h \
3212@@ -152,7 +245,7 @@
3213 AC_DEFINE(HAVE_INT64_T)
3214 case "$target" in
3215 *-uclinux*)
3216- # Don't enable LFS with uClibc
3217+ # Don't enable LFS with uClinux
3218 ;;
3219 *)
3220 AC_DEFINE(_GLIBCXX_USE_LFS)
3221diff -urN gcc-3.4.2-dist/libstdc++-v3/include/c_compatibility/wchar.h gcc-3.4.2/libstdc++-v3/include/c_compatibility/wchar.h
3222--- gcc-3.4.2-dist/libstdc++-v3/include/c_compatibility/wchar.h 2003-12-08 21:51:45.000000000 -0600
3223+++ gcc-3.4.2/libstdc++-v3/include/c_compatibility/wchar.h 2004-09-10 10:47:40.000000000 -0500
3224@@ -101,7 +101,9 @@
3225 using std::wmemcpy;
3226 using std::wmemmove;
3227 using std::wmemset;
3228+#if _GLIBCXX_HAVE_WCSFTIME
3229 using std::wcsftime;
3230+#endif
3231
3232 #if _GLIBCXX_USE_C99
3233 using std::wcstold;
3234diff -urN gcc-3.4.2-dist/libstdc++-v3/include/c_std/std_cwchar.h gcc-3.4.2/libstdc++-v3/include/c_std/std_cwchar.h
3235--- gcc-3.4.2-dist/libstdc++-v3/include/c_std/std_cwchar.h 2004-07-20 03:52:12.000000000 -0500
3236+++ gcc-3.4.2/libstdc++-v3/include/c_std/std_cwchar.h 2004-09-10 10:47:40.000000000 -0500
3237@@ -179,7 +179,9 @@
3238 using ::wcscoll;
3239 using ::wcscpy;
3240 using ::wcscspn;
3241+#if _GLIBCXX_HAVE_WCSFTIME
3242 using ::wcsftime;
3243+#endif
3244 using ::wcslen;
3245 using ::wcsncat;
3246 using ::wcsncmp;
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc-uclibc-3.4.0-120-softfloat.patch b/meta/packages/gcc/gcc-3.4.3/gcc-uclibc-3.4.0-120-softfloat.patch
new file mode 100644
index 0000000000..f2431896cf
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.3/gcc-uclibc-3.4.0-120-softfloat.patch
@@ -0,0 +1,14 @@
1--- gcc-3.3.2-old/configure.in 2003-08-09 01:57:21.000000000 -0500
2+++ gcc-3.3.2/configure.in 2004-01-15 12:46:29.000000000 -0600
3@@ -1418,6 +1418,11 @@
4 fi
5
6 FLAGS_FOR_TARGET=
7+case " $targargs " in
8+ *" --nfp "* | *" --without-float "*)
9+ FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -msoft-float'
10+ ;;
11+esac
12 case " $target_configdirs " in
13 *" newlib "*)
14 case " $targargs " in
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc34-arm-ldm-peephole.patch b/meta/packages/gcc/gcc-3.4.3/gcc34-arm-ldm-peephole.patch
new file mode 100644
index 0000000000..fb317e1537
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.3/gcc34-arm-ldm-peephole.patch
@@ -0,0 +1,79 @@
1--- gcc-3.4.0/gcc/config/arm/arm.md.arm-ldm-peephole 2004-01-13 08:24:37.000000000 -0500
2+++ gcc-3.4.0/gcc/config/arm/arm.md 2004-04-24 18:18:04.000000000 -0400
3@@ -8810,13 +8810,16 @@
4 (set_attr "length" "4,8,8")]
5 )
6
7+; Try to convert LDR+LDR+arith into [add+]LDM+arith
8+; On XScale, LDM is always slower than two LDRs, so only do this if
9+; optimising for size.
10 (define_insn "*arith_adjacentmem"
11 [(set (match_operand:SI 0 "s_register_operand" "=r")
12 (match_operator:SI 1 "shiftable_operator"
13 [(match_operand:SI 2 "memory_operand" "m")
14 (match_operand:SI 3 "memory_operand" "m")]))
15 (clobber (match_scratch:SI 4 "=r"))]
16- "TARGET_ARM && adjacent_mem_locations (operands[2], operands[3])"
17+ "TARGET_ARM && (!arm_tune_xscale || optimize_size) && adjacent_mem_locations (operands[2], operands[3])"
18 "*
19 {
20 rtx ldm[3];
21@@ -8851,6 +8854,8 @@
22 }
23 if (val1 && val2)
24 {
25+ /* This would be a loss on a Harvard core, but adjacent_mem_locations()
26+ will prevent it from happening. */
27 rtx ops[3];
28 ldm[0] = ops[0] = operands[4];
29 ops[1] = XEXP (XEXP (operands[2], 0), 0);
30--- gcc-3.4.0/gcc/config/arm/arm.c.arm-ldm-peephole 2004-04-24 18:16:25.000000000 -0400
31+++ gcc-3.4.0/gcc/config/arm/arm.c 2004-04-24 18:18:04.000000000 -0400
32@@ -4593,8 +4593,11 @@
33 arith_adjacentmem pattern to output an overlong sequence. */
34 if (!const_ok_for_op (PLUS, val0) || !const_ok_for_op (PLUS, val1))
35 return 0;
36-
37- return (reg0 == reg1) && ((val1 - val0) == 4 || (val0 - val1) == 4);
38+
39+ /* For Harvard cores, only accept pairs where one offset is zero.
40+ See comment in load_multiple_sequence. */
41+ return (reg0 == reg1) && ((val1 - val0) == 4 || (val0 - val1) == 4)
42+ && (!arm_ld_sched || val0 == 0 || val1 == 0);
43 }
44 return 0;
45 }
46@@ -4838,6 +4841,11 @@
47 *load_offset = unsorted_offsets[order[0]];
48 }
49
50+ /* For XScale a two-word LDM is a performance loss, so only do this if
51+ size is more important. See comments in arm_gen_load_multiple. */
52+ if (nops == 2 && arm_tune_xscale && !optimize_size)
53+ return 0;
54+
55 if (unsorted_offsets[order[0]] == 0)
56 return 1; /* ldmia */
57
58@@ -5064,6 +5072,11 @@
59 *load_offset = unsorted_offsets[order[0]];
60 }
61
62+ /* For XScale a two-word LDM is a performance loss, so only do this if
63+ size is more important. See comments in arm_gen_load_multiple. */
64+ if (nops == 2 && arm_tune_xscale && !optimize_size)
65+ return 0;
66+
67 if (unsorted_offsets[order[0]] == 0)
68 return 1; /* stmia */
69
70--- gcc-3.4.0/gcc/genpeep.c.arm-ldm-peephole 2003-07-05 01:27:22.000000000 -0400
71+++ gcc-3.4.0/gcc/genpeep.c 2004-04-24 18:18:04.000000000 -0400
72@@ -381,6 +381,7 @@
73 printf ("#include \"recog.h\"\n");
74 printf ("#include \"except.h\"\n\n");
75 printf ("#include \"function.h\"\n\n");
76+ printf ("#include \"flags.h\"\n\n");
77
78 printf ("#ifdef HAVE_peephole\n");
79 printf ("extern rtx peep_operand[];\n\n");
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc34-arm-ldm.patch b/meta/packages/gcc/gcc-3.4.3/gcc34-arm-ldm.patch
new file mode 100644
index 0000000000..142052fdf0
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.3/gcc34-arm-ldm.patch
@@ -0,0 +1,119 @@
1--- gcc-3.4.0/gcc/config/arm/arm.c.arm-ldm 2004-02-27 09:51:05.000000000 -0500
2+++ gcc-3.4.0/gcc/config/arm/arm.c 2004-04-24 18:16:25.000000000 -0400
3@@ -8520,6 +8520,26 @@
4 return_used_this_function = 0;
5 }
6
7+/* Return the number (counting from 0) of
8+ the least significant set bit in MASK. */
9+
10+#ifdef __GNUC__
11+inline
12+#endif
13+static int
14+number_of_first_bit_set (mask)
15+ int mask;
16+{
17+ int bit;
18+
19+ for (bit = 0;
20+ (mask & (1 << bit)) == 0;
21+ ++bit)
22+ continue;
23+
24+ return bit;
25+}
26+
27 const char *
28 arm_output_epilogue (rtx sibling)
29 {
30@@ -8753,27 +8773,47 @@
31 saved_regs_mask |= (1 << PC_REGNUM);
32 }
33
34- /* Load the registers off the stack. If we only have one register
35- to load use the LDR instruction - it is faster. */
36- if (saved_regs_mask == (1 << LR_REGNUM))
37- {
38- /* The exception handler ignores the LR, so we do
39- not really need to load it off the stack. */
40- if (eh_ofs)
41- asm_fprintf (f, "\tadd\t%r, %r, #4\n", SP_REGNUM, SP_REGNUM);
42- else
43- asm_fprintf (f, "\tldr\t%r, [%r], #4\n", LR_REGNUM, SP_REGNUM);
44- }
45- else if (saved_regs_mask)
46+ if (saved_regs_mask)
47 {
48- if (saved_regs_mask & (1 << SP_REGNUM))
49- /* Note - write back to the stack register is not enabled
50- (ie "ldmfd sp!..."). We know that the stack pointer is
51- in the list of registers and if we add writeback the
52- instruction becomes UNPREDICTABLE. */
53- print_multi_reg (f, "ldmfd\t%r", SP_REGNUM, saved_regs_mask);
54+ /* Load the registers off the stack. If we only have one register
55+ to load use the LDR instruction - it is faster. */
56+ if (bit_count (saved_regs_mask) == 1)
57+ {
58+ int reg = number_of_first_bit_set (saved_regs_mask);
59+
60+ switch (reg)
61+ {
62+ case SP_REGNUM:
63+ /* Mustn't use base writeback when loading SP. */
64+ asm_fprintf (f, "\tldr\t%r, [%r]\n", SP_REGNUM, SP_REGNUM);
65+ break;
66+
67+ case LR_REGNUM:
68+ if (eh_ofs)
69+ {
70+ /* The exception handler ignores the LR, so we do
71+ not really need to load it off the stack. */
72+ asm_fprintf (f, "\tadd\t%r, %r, #4\n", SP_REGNUM, SP_REGNUM);
73+ break;
74+ }
75+ /* else fall through */
76+
77+ default:
78+ asm_fprintf (f, "\tldr\t%r, [%r], #4\n", reg, SP_REGNUM);
79+ break;
80+ }
81+ }
82 else
83- print_multi_reg (f, "ldmfd\t%r!", SP_REGNUM, saved_regs_mask);
84+ {
85+ if (saved_regs_mask & (1 << SP_REGNUM))
86+ /* Note - write back to the stack register is not enabled
87+ (ie "ldmfd sp!..."). We know that the stack pointer is
88+ in the list of registers and if we add writeback the
89+ instruction becomes UNPREDICTABLE. */
90+ print_multi_reg (f, "ldmfd\t%r", SP_REGNUM, saved_regs_mask);
91+ else
92+ print_multi_reg (f, "ldmfd\t%r!", SP_REGNUM, saved_regs_mask);
93+ }
94 }
95
96 if (current_function_pretend_args_size)
97@@ -11401,22 +11441,6 @@
98 }
99 }
100
101-/* Return the number (counting from 0) of
102- the least significant set bit in MASK. */
103-
104-inline static int
105-number_of_first_bit_set (int mask)
106-{
107- int bit;
108-
109- for (bit = 0;
110- (mask & (1 << bit)) == 0;
111- ++bit)
112- continue;
113-
114- return bit;
115-}
116-
117 /* Generate code to return from a thumb function.
118 If 'reg_containing_return_addr' is -1, then the return address is
119 actually on the stack, at the stack pointer. */
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc34-arm-tune.patch b/meta/packages/gcc/gcc-3.4.3/gcc34-arm-tune.patch
new file mode 100644
index 0000000000..cdb20bef9b
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.3/gcc34-arm-tune.patch
@@ -0,0 +1,9 @@
1--- gcc-3.4.0/gcc/config/arm/linux-elf.h.arm-tune 2004-01-31 01:18:11.000000000 -0500
2+++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-04-24 18:19:10.000000000 -0400
3@@ -126,3 +126,6 @@
4
5 #define LINK_GCC_C_SEQUENCE_SPEC \
6 "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
7+
8+/* Tune for XScale. */
9+#define TARGET_TUNE_DEFAULT TARGET_CPU_xscale
diff --git a/meta/packages/gcc/gcc-3.4.3/gcc34-reverse-compare.patch b/meta/packages/gcc/gcc-3.4.3/gcc34-reverse-compare.patch
new file mode 100644
index 0000000000..c3c40dd183
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.3/gcc34-reverse-compare.patch
@@ -0,0 +1,32 @@
1--- gcc-3.4.0/gcc/flow.c.reverse-compare 2004-02-27 22:39:19.000000000 -0500
2+++ gcc-3.4.0/gcc/flow.c 2004-04-24 16:36:00.000000000 -0400
3@@ -1843,6 +1843,7 @@
4 regset_head diff_head;
5 regset diff = INITIALIZE_REG_SET (diff_head);
6 basic_block bb_true, bb_false;
7+ enum rtx_code reversed_code;
8 int i;
9
10 /* Identify the successor blocks. */
11@@ -1889,8 +1890,11 @@
12 if (GET_CODE (reg) == REG
13 && XEXP (cond_true, 1) == const0_rtx)
14 {
15- rtx cond_false
16- = gen_rtx_fmt_ee (reverse_condition (GET_CODE (cond_true)),
17+ rtx cond_false;
18+ reversed_code = reverse_condition (GET_CODE (cond_true));
19+ if (reversed_code == UNKNOWN)
20+ goto skip;
21+ cond_false = gen_rtx_fmt_ee (reversed_code,
22 GET_MODE (cond_true), XEXP (cond_true, 0),
23 XEXP (cond_true, 1));
24 if (GET_CODE (XEXP (set_src, 1)) == PC)
25@@ -1925,6 +1929,7 @@
26 }
27 }
28
29+ skip:
30 FREE_REG_SET (diff);
31 }
32 #endif
diff --git a/meta/packages/gcc/gcc-3.4.3/sdk-libstdc++-includes.patch b/meta/packages/gcc/gcc-3.4.3/sdk-libstdc++-includes.patch
new file mode 100644
index 0000000000..4377c2143b
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.3/sdk-libstdc++-includes.patch
@@ -0,0 +1,22 @@
1--- gcc-3.4.1/libstdc++-v3/libmath/Makefile.am~ 2003-08-27 22:29:42.000000000 +0100
2+++ gcc-3.4.1/libstdc++-v3/libmath/Makefile.am 2004-07-22 16:41:45.152130128 +0100
3@@ -32,7 +32,7 @@
4
5 libmath_la_SOURCES = stubs.c
6
7-AM_CPPFLAGS = $(CANADIAN_INCLUDES)
8+AM_CPPFLAGS = $(CANADIAN_INCLUDES) -I$(toplevel_srcdir)/include
9
10 # Only compiling "C" sources in this directory.
11 LIBTOOL = @LIBTOOL@ --tag CC
12--- gcc-3.4.1/libstdc++-v3/fragment.am.old 2004-07-22 18:24:58.024083656 +0100
13+++ gcc-3.4.1/libstdc++-v3/fragment.am 2004-07-22 18:24:59.019932264 +0100
14@@ -18,7 +18,7 @@
15 $(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once
16
17 # -I/-D flags to pass when compiling.
18-AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
19+AM_CPPFLAGS = $(GLIBCXX_INCLUDES) -I$(toplevel_srcdir)/include
20
21
22