summaryrefslogtreecommitdiffstats
path: root/meta/packages/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/gcc')
-rw-r--r--meta/packages/gcc/gcc-3.3.4/arm-gotoff.dpatch135
-rw-r--r--meta/packages/gcc/gcc-3.3.4/arm-ldm-peephole.patch91
-rw-r--r--meta/packages/gcc/gcc-3.3.4/arm-ldm.dpatch148
-rw-r--r--meta/packages/gcc/gcc-3.3.4/arm-tune.patch9
-rw-r--r--meta/packages/gcc/gcc-3.3.4/bash3.patch20
-rw-r--r--meta/packages/gcc/gcc-3.3.4/gcc-uclibc-3.3-100-conf.patch1593
-rw-r--r--meta/packages/gcc/gcc-3.3.4/gcc-uclibc-3.3-110-conf.patch55
-rw-r--r--meta/packages/gcc/gcc-3.3.4/gcc-uclibc-3.3-120-softfloat.patch14
-rw-r--r--meta/packages/gcc/gcc-3.3.4/gcc-uclibc-3.3-200-code.patch3021
-rw-r--r--meta/packages/gcc/gcc-3.3.4/gcc34-15089.patch19
-rw-r--r--meta/packages/gcc/gcc-3.3.4/libibery-crosstool.patch683
-rw-r--r--meta/packages/gcc/gcc-3.3.4/reverse-compare.patch31
-rw-r--r--meta/packages/gcc/gcc-3.3.4/sdk-libstdc++-includes.patch48
-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
-rw-r--r--meta/packages/gcc/gcc-3.4.4/15342.patch22
-rw-r--r--meta/packages/gcc/gcc-3.4.4/GCC3.4.0VisibilityPatch.diff1100
-rw-r--r--meta/packages/gcc/gcc-3.4.4/always-fixincperm.patch32
-rw-r--r--meta/packages/gcc/gcc-3.4.4/gcc-3.4.0-arm-bigendian-uclibc.patch30
-rw-r--r--meta/packages/gcc/gcc-3.4.4/gcc-3.4.0-arm-bigendian.patch70
-rw-r--r--meta/packages/gcc/gcc-3.4.4/gcc-3.4.0-arm-lib1asm.patch24
-rw-r--r--meta/packages/gcc/gcc-3.4.4/gcc-3.4.0-arm-nolibfloat.patch24
-rw-r--r--meta/packages/gcc/gcc-3.4.4/gcc-3.4.0-arm-softfloat.patch256
-rw-r--r--meta/packages/gcc/gcc-3.4.4/gcc-3.4.1-uclibc-100-conf.patch442
-rw-r--r--meta/packages/gcc/gcc-3.4.4/gcc-3.4.1-uclibc-200-locale.patch3246
-rw-r--r--meta/packages/gcc/gcc-3.4.4/gcc-uclibc-3.4.0-120-softfloat.patch14
-rw-r--r--meta/packages/gcc/gcc-3.4.4/gcc34-arm-ldm-peephole.patch79
-rw-r--r--meta/packages/gcc/gcc-3.4.4/gcc34-arm-ldm.patch119
-rw-r--r--meta/packages/gcc/gcc-3.4.4/gcc34-arm-tune.patch9
-rw-r--r--meta/packages/gcc/gcc-3.4.4/gcc34-configure.in.patch22
-rw-r--r--meta/packages/gcc/gcc-3.4.4/gcc34-reverse-compare.patch32
-rw-r--r--meta/packages/gcc/gcc-3.4.4/gcc34-thumb-support.patch156
-rw-r--r--meta/packages/gcc/gcc-3.4.4/sdk-libstdc++-includes.patch22
-rw-r--r--meta/packages/gcc/gcc-4.0.2/100-uclibc-conf.patch556
-rw-r--r--meta/packages/gcc/gcc-4.0.2/200-uclibc-locale.patch3240
-rw-r--r--meta/packages/gcc/gcc-4.0.2/301-missing-execinfo_h.patch14
-rw-r--r--meta/packages/gcc/gcc-4.0.2/302-c99-snprintf.patch14
-rw-r--r--meta/packages/gcc/gcc-4.0.2/303-c99-complex-ugly-hack.patch15
-rw-r--r--meta/packages/gcc/gcc-4.0.2/800-arm-bigendian.patch70
-rw-r--r--meta/packages/gcc/gcc-4.0.2/arm-nolibfloat.patch24
-rw-r--r--meta/packages/gcc/gcc-4.0.2/arm-softfloat.patch16
-rw-r--r--meta/packages/gcc/gcc-4.0.2/ldflags.patch22
-rw-r--r--meta/packages/gcc/gcc-4.0.2/zecke-host-cpp-ac-hack.patch140
-rw-r--r--meta/packages/gcc/gcc-cross-initial_3.3.4.bb28
-rw-r--r--meta/packages/gcc/gcc-cross-initial_3.4.3.bb28
-rw-r--r--meta/packages/gcc/gcc-cross-initial_3.4.4.bb28
-rw-r--r--meta/packages/gcc/gcc-cross-initial_4.0.2.bb29
-rw-r--r--meta/packages/gcc/gcc-cross-initial_csl-arm-2005q3.bb28
-rw-r--r--meta/packages/gcc/gcc-cross_3.3.4.bb13
-rw-r--r--meta/packages/gcc/gcc-cross_3.4.3.bb16
-rw-r--r--meta/packages/gcc/gcc-cross_3.4.4.bb16
-rw-r--r--meta/packages/gcc/gcc-cross_4.0.2.bb16
-rw-r--r--meta/packages/gcc/gcc-cross_csl-arm-2005q3.bb15
-rw-r--r--meta/packages/gcc/gcc-csl-arm/15342.patch22
-rw-r--r--meta/packages/gcc/gcc-csl-arm/gcc-3.4.0-arm-lib1asm.patch24
-rw-r--r--meta/packages/gcc/gcc-csl-arm/gcc34-arm-tune.patch9
-rw-r--r--meta/packages/gcc/gcc-csl-arm/gcc_optab_arm.patch95
-rw-r--r--meta/packages/gcc/gcc-csl-arm/no-libfloat.patch11
-rw-r--r--meta/packages/gcc/gcc-csl-arm/pic-without-sl.patch303
-rw-r--r--meta/packages/gcc/gcc-package-cross.inc77
-rw-r--r--meta/packages/gcc/gcc-package.inc111
-rw-r--r--meta/packages/gcc/gcc-paths-cross.inc7
-rw-r--r--meta/packages/gcc/gcc3-build-cross.inc47
-rw-r--r--meta/packages/gcc/gcc3-build.inc95
-rw-r--r--meta/packages/gcc/gcc4-build.inc6
-rw-r--r--meta/packages/gcc/gcc_3.3.4.bb176
-rw-r--r--meta/packages/gcc/gcc_3.4.3.bb27
-rw-r--r--meta/packages/gcc/gcc_3.4.4.bb30
-rw-r--r--meta/packages/gcc/gcc_4.0.2.bb28
-rw-r--r--meta/packages/gcc/gcc_csl-arm-2005q3.bb27
84 files changed, 22510 insertions, 0 deletions
diff --git a/meta/packages/gcc/gcc-3.3.4/arm-gotoff.dpatch b/meta/packages/gcc/gcc-3.3.4/arm-gotoff.dpatch
new file mode 100644
index 0000000000..610f9430e0
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.3.4/arm-gotoff.dpatch
@@ -0,0 +1,135 @@
1#! /bin/sh -e
2
3src=gcc
4if [ $# -eq 3 -a "$2" = '-d' ]; then
5 pdir="-d $3"
6 src=$3/gcc
7elif [ $# -ne 1 ]; then
8 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
9 exit 1
10fi
11case "$1" in
12 -patch)
13 patch $pdir -f --no-backup-if-mismatch -p0 --fuzz 10 < $0
14 ;;
15 -unpatch)
16 patch $pdir -f --no-backup-if-mismatch -R -p0 --fuzz 10 < $0
17 ;;
18 *)
19 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
20 exit 1
21esac
22exit 0
23
24# DP: use GOTOFF not GOT relocs for .LCn and other local symbols;
25# DP: don't use gotoff for non-static functions, even if defined locally
26
27--- gcc/config/arm/arm.c 2003-06-14 15:20:53.000000000 +0100
28+++ gcc/config/arm/arm.c 2004-03-06 15:15:32.000000000 +0000
29@@ -2364,6 +2394,40 @@
30 return 1;
31 }
32
33+/* Return true if OP is a symbolic operand that resolves locally. */
34+
35+static int
36+local_symbolic_operand (op, mode)
37+ rtx op;
38+ enum machine_mode mode ATTRIBUTE_UNUSED;
39+{
40+ if (GET_CODE (op) == CONST
41+ && GET_CODE (XEXP (op, 0)) == PLUS
42+ && GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT)
43+ op = XEXP (XEXP (op, 0), 0);
44+
45+ if (GET_CODE (op) == LABEL_REF)
46+ return 1;
47+
48+ if (GET_CODE (op) != SYMBOL_REF)
49+ return 0;
50+
51+ /* These we've been told are local by varasm and encode_section_info
52+ respectively. */
53+ if (CONSTANT_POOL_ADDRESS_P (op) || ENCODED_LOCAL_BINDING_ATTR_P (XSTR (op, 0)))
54+ return 1;
55+
56+ /* There is, however, a not insubstantial body of code in the rest of
57+ the compiler that assumes it can just stick the results of
58+ ASM_GENERATE_INTERNAL_LABEL in a symbol_ref and have done. */
59+ /* ??? This is a hack. Should update the body of the compiler to
60+ always create a DECL an invoke targetm.encode_section_info. */
61+ if (strncmp (arm_strip_name_encoding (XSTR (op, 0)), ".L", 2) == 0)
62+ return 1;
63+
64+ return 0;
65+}
66+
67 rtx
68 legitimize_pic_address (orig, mode, reg)
69 rtx orig;
70@@ -2404,10 +2468,7 @@
71 else
72 emit_insn (gen_pic_load_addr_thumb (address, orig));
73
74- if ((GET_CODE (orig) == LABEL_REF
75- || (GET_CODE (orig) == SYMBOL_REF &&
76- ENCODED_SHORT_CALL_ATTR_P (XSTR (orig, 0))))
77- && NEED_GOT_RELOC)
78+ if (local_symbolic_operand (orig, Pmode) && NEED_GOT_RELOC)
79 pic_ref = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, address);
80 else
81 {
82@@ -8804,11 +8911,7 @@
83 if (NEED_GOT_RELOC && flag_pic && making_const_table &&
84 (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF))
85 {
86- if (GET_CODE (x) == SYMBOL_REF
87- && (CONSTANT_POOL_ADDRESS_P (x)
88- || ENCODED_SHORT_CALL_ATTR_P (XSTR (x, 0))))
89- fputs ("(GOTOFF)", asm_out_file);
90- else if (GET_CODE (x) == LABEL_REF)
91+ if (local_symbolic_operand (x, Pmode))
92 fputs ("(GOTOFF)", asm_out_file);
93 else
94 fputs ("(GOT)", asm_out_file);
95@@ -11335,6 +11418,11 @@
96 else if (! TREE_PUBLIC (decl))
97 arm_encode_call_attribute (decl, SHORT_CALL_FLAG_CHAR);
98 }
99+
100+ if (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd'
101+ && flag_pic
102+ && (*targetm.binds_local_p) (decl))
103+ arm_encode_call_attribute (decl, LOCAL_BINDING_FLAG_CHAR);
104 }
105 #endif /* !ARM_PE */
106
107
108--- gcc/config/arm/arm.h Fri Mar 5 18:49:44 2004
109+++ gcc/config/arm/arm.h Fri Mar 5 15:04:31 2004
110@@ -1870,6 +1870,7 @@
111 Note, '@' and '*' have already been taken. */
112 #define SHORT_CALL_FLAG_CHAR '^'
113 #define LONG_CALL_FLAG_CHAR '#'
114+#define LOCAL_BINDING_FLAG_CHAR '%'
115
116 #define ENCODED_SHORT_CALL_ATTR_P(SYMBOL_NAME) \
117 (*(SYMBOL_NAME) == SHORT_CALL_FLAG_CHAR)
118@@ -1877,6 +1878,9 @@
119 #define ENCODED_LONG_CALL_ATTR_P(SYMBOL_NAME) \
120 (*(SYMBOL_NAME) == LONG_CALL_FLAG_CHAR)
121
122+#define ENCODED_LOCAL_BINDING_ATTR_P(SYMBOL_NAME) \
123+ (*(SYMBOL_NAME) == LOCAL_BINDING_FLAG_CHAR)
124+
125 #ifndef SUBTARGET_NAME_ENCODING_LENGTHS
126 #define SUBTARGET_NAME_ENCODING_LENGTHS
127 #endif
128@@ -1888,6 +1892,7 @@
129 #define ARM_NAME_ENCODING_LENGTHS \
130 case SHORT_CALL_FLAG_CHAR: return 1; \
131 case LONG_CALL_FLAG_CHAR: return 1; \
132+ case LOCAL_BINDING_FLAG_CHAR: return 1; \
133 case '*': return 1; \
134 SUBTARGET_NAME_ENCODING_LENGTHS
135
diff --git a/meta/packages/gcc/gcc-3.3.4/arm-ldm-peephole.patch b/meta/packages/gcc/gcc-3.3.4/arm-ldm-peephole.patch
new file mode 100644
index 0000000000..83b07e0343
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.3.4/arm-ldm-peephole.patch
@@ -0,0 +1,91 @@
12004-03-19 Philip Blundell <philb@gnu.org>
2
3 * config/arm/arm.c (adjacent_mem_locations): Reject location pairs
4 where both offsets are nonzero if target is Harvard architecture.
5 (load_multiple_sequence, store_multiple_sequence): Avoid two-word
6 LDM/STM on XScale unless -Os.
7 * config/arm/arm.md (arith_adjacentmem): Inhibit if tuning for
8 XScale and not -Os.
9 * genpeep.c: Have generated code include flags.h.
10
11--- gcc/genpeep.c~ 2001-12-02 00:04:19.000000000 +0000
12+++ gcc/genpeep.c 2004-03-19 11:17:18.000000000 +0000
13@@ -402,6 +402,7 @@
14 printf ("#include \"recog.h\"\n");
15 printf ("#include \"except.h\"\n\n");
16 printf ("#include \"function.h\"\n\n");
17+ printf ("#include \"flags.h\"\n\n");
18
19 printf ("#ifdef HAVE_peephole\n");
20 printf ("extern rtx peep_operand[];\n\n");
21
22--- gcc/config/arm/arm.md~ 2004-03-11 15:28:01.000000000 +0000
23+++ gcc/config/arm/arm.md 2004-03-19 13:00:03.000000000 +0000
24@@ -7958,13 +7958,16 @@
25 (set_attr "length" "4,8,8")]
26 )
27
28+; Try to convert LDR+LDR+arith into [add+]LDM+arith
29+; On XScale, LDM is always slower than two LDRs, so only do this if
30+; optimising for size.
31 (define_insn "*arith_adjacentmem"
32 [(set (match_operand:SI 0 "s_register_operand" "=r")
33 (match_operator:SI 1 "shiftable_operator"
34 [(match_operand:SI 2 "memory_operand" "m")
35 (match_operand:SI 3 "memory_operand" "m")]))
36 (clobber (match_scratch:SI 4 "=r"))]
37- "TARGET_ARM && adjacent_mem_locations (operands[2], operands[3])"
38+ "TARGET_ARM && (!arm_tune_xscale || optimize_size) && adjacent_mem_locations (operands[2], operands[3])"
39 "*
40 {
41 rtx ldm[3];
42@@ -7999,7 +8002,9 @@
43 }
44 if (val1 && val2)
45 {
46+ /* This would be a loss on a Harvard core, but adjacent_mem_locations()
47+ will prevent it from happening. */
48 rtx ops[3];
49 ldm[0] = ops[0] = operands[4];
50 ops[1] = XEXP (XEXP (operands[2], 0), 0);
51
52--- gcc/config/arm/arm.c~ 2004-03-11 15:28:01.000000000 +0000
53+++ gcc/config/arm/arm.c 2004-03-19 15:36:03.000000000 +0000
54@@ -3818,8 +3818,11 @@
55 sequence. */
56 if (!const_ok_for_op (PLUS, val0) || !const_ok_for_op (PLUS, val1))
57 return 0;
58-
59- return (reg0 == reg1) && ((val1 - val0) == 4 || (val0 - val1) == 4);
60+
61+ /* For Harvard cores, only accept pairs where one offset is zero.
62+ See comment in load_multiple_sequence. */
63+ return (reg0 == reg1) && ((val1 - val0) == 4 || (val0 - val1) == 4)
64+ && (!arm_ld_sched || val0 == 0 || val1 == 0);
65 }
66 return 0;
67 }
68@@ -4075,6 +4078,11 @@
69 *load_offset = unsorted_offsets[order[0]];
70 }
71
72+ /* For XScale a two-word LDM is a performance loss, so only do this if
73+ size is more important. See comments in arm_gen_load_multiple. */
74+ if (nops == 2 && arm_tune_xscale && !optimize_size)
75+ return 0;
76+
77 if (unsorted_offsets[order[0]] == 0)
78 return 1; /* ldmia */
79
80@@ -4307,6 +4315,11 @@
81 *load_offset = unsorted_offsets[order[0]];
82 }
83
84+ /* For XScale a two-word LDM is a performance loss, so only do this if
85+ size is more important. See comments in arm_gen_load_multiple. */
86+ if (nops == 2 && arm_tune_xscale && !optimize_size)
87+ return 0;
88+
89 if (unsorted_offsets[order[0]] == 0)
90 return 1; /* stmia */
91
diff --git a/meta/packages/gcc/gcc-3.3.4/arm-ldm.dpatch b/meta/packages/gcc/gcc-3.3.4/arm-ldm.dpatch
new file mode 100644
index 0000000000..561624f39c
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.3.4/arm-ldm.dpatch
@@ -0,0 +1,148 @@
1#! /bin/sh -e
2
3src=gcc
4if [ $# -eq 3 -a "$2" = '-d' ]; then
5 pdir="-d $3"
6 src=$3/gcc
7elif [ $# -ne 1 ]; then
8 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
9 exit 1
10fi
11case "$1" in
12 -patch)
13 patch $pdir -f --no-backup-if-mismatch -p0 --fuzz 10 < $0
14 ;;
15 -unpatch)
16 patch $pdir -f --no-backup-if-mismatch -R -p0 --fuzz 10 < $0
17 ;;
18 *)
19 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
20 exit 1
21esac
22exit 0
23
24# DP: try harder to avoid ldm in function epilogues
25
26--- gcc/config/arm/arm.c Fri Mar 5 18:49:42 2004
27+++ gcc/config/arm/arm.c Fri Mar 5 16:00:21 2004
28@@ -7598,6 +7629,26 @@
29 return_used_this_function = 0;
30 }
31
32+/* Return the number (counting from 0) of
33+ the least significant set bit in MASK. */
34+
35+#ifdef __GNUC__
36+inline
37+#endif
38+static int
39+number_of_first_bit_set (mask)
40+ int mask;
41+{
42+ int bit;
43+
44+ for (bit = 0;
45+ (mask & (1 << bit)) == 0;
46+ ++bit)
47+ continue;
48+
49+ return bit;
50+}
51+
52 const char *
53 arm_output_epilogue (really_return)
54 int really_return;
55@@ -7788,27 +7839,47 @@
56 saved_regs_mask |= (1 << PC_REGNUM);
57 }
58
59- /* Load the registers off the stack. If we only have one register
60- to load use the LDR instruction - it is faster. */
61- if (saved_regs_mask == (1 << LR_REGNUM))
62- {
63- /* The exception handler ignores the LR, so we do
64- not really need to load it off the stack. */
65- if (eh_ofs)
66- asm_fprintf (f, "\tadd\t%r, %r, #4\n", SP_REGNUM, SP_REGNUM);
67- else
68- asm_fprintf (f, "\tldr\t%r, [%r], #4\n", LR_REGNUM, SP_REGNUM);
69- }
70- else if (saved_regs_mask)
71+ if (saved_regs_mask)
72 {
73- if (saved_regs_mask & (1 << SP_REGNUM))
74- /* Note - write back to the stack register is not enabled
75- (ie "ldmfd sp!..."). We know that the stack pointer is
76- in the list of registers and if we add writeback the
77- instruction becomes UNPREDICTABLE. */
78- print_multi_reg (f, "ldmfd\t%r", SP_REGNUM, saved_regs_mask);
79+ /* Load the registers off the stack. If we only have one register
80+ to load use the LDR instruction - it is faster. */
81+ if (bit_count (saved_regs_mask) == 1)
82+ {
83+ int reg = number_of_first_bit_set (saved_regs_mask);
84+
85+ switch (reg)
86+ {
87+ case SP_REGNUM:
88+ /* Mustn't use base writeback when loading SP. */
89+ asm_fprintf (f, "\tldr\t%r, [%r]\n", SP_REGNUM, SP_REGNUM);
90+ break;
91+
92+ case LR_REGNUM:
93+ if (eh_ofs)
94+ {
95+ /* The exception handler ignores the LR, so we do
96+ not really need to load it off the stack. */
97+ asm_fprintf (f, "\tadd\t%r, %r, #4\n", SP_REGNUM, SP_REGNUM);
98+ break;
99+ }
100+ /* else fall through */
101+
102+ default:
103+ asm_fprintf (f, "\tldr\t%r, [%r], #4\n", reg, SP_REGNUM);
104+ break;
105+ }
106+ }
107 else
108- print_multi_reg (f, "ldmfd\t%r!", SP_REGNUM, saved_regs_mask);
109+ {
110+ if (saved_regs_mask & (1 << SP_REGNUM))
111+ /* Note - write back to the stack register is not enabled
112+ (ie "ldmfd sp!..."). We know that the stack pointer is
113+ in the list of registers and if we add writeback the
114+ instruction becomes UNPREDICTABLE. */
115+ print_multi_reg (f, "ldmfd\t%r", SP_REGNUM, saved_regs_mask);
116+ else
117+ print_multi_reg (f, "ldmfd\t%r!", SP_REGNUM, saved_regs_mask);
118+ }
119 }
120
121 if (current_function_pretend_args_size)
122@@ -9610,26 +9677,6 @@
123 }
124 }
125
126-/* Return the number (counting from 0) of
127- the least significant set bit in MASK. */
128-
129-#ifdef __GNUC__
130-inline
131-#endif
132-static int
133-number_of_first_bit_set (mask)
134- int mask;
135-{
136- int bit;
137-
138- for (bit = 0;
139- (mask & (1 << bit)) == 0;
140- ++bit)
141- continue;
142-
143- return bit;
144-}
145-
146 /* Generate code to return from a thumb function.
147 If 'reg_containing_return_addr' is -1, then the return address is
148 actually on the stack, at the stack pointer. */
diff --git a/meta/packages/gcc/gcc-3.3.4/arm-tune.patch b/meta/packages/gcc/gcc-3.3.4/arm-tune.patch
new file mode 100644
index 0000000000..701c99b87c
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.3.4/arm-tune.patch
@@ -0,0 +1,9 @@
1--- gcc/config/arm/linux-elf.h.orig 2004-03-11 14:46:33.000000000 +0000
2+++ gcc/config/arm/linux-elf.h 2004-03-11 14:48:23.000000000 +0000
3@@ -128,3 +128,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.3.4/bash3.patch b/meta/packages/gcc/gcc-3.3.4/bash3.patch
new file mode 100644
index 0000000000..614ba50eec
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.3.4/bash3.patch
@@ -0,0 +1,20 @@
1--- gcc-3.3.4/configure.orig 2002-09-29 18:11:24.000000000 +0200
2+++ gcc-3.3.4/configure 2005-01-28 12:26:40.000000000 +0100
3@@ -697,7 +697,7 @@
4 if test -f skip-this-dir; then
5 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
6 # and reset the trap handler.
7- trap 0
8+ trap '' 0
9 rm -rf Makefile* ${tmpdir}
10 # Execute the final clean-up actions
11 ${config_shell} skip-this-dir
12@@ -1596,7 +1596,7 @@
13 # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
14 # and reset the trap handler.
15 rm -rf ${tmpdir}
16-trap 0
17+trap '' 0
18
19 exit 0
20
diff --git a/meta/packages/gcc/gcc-3.3.4/gcc-uclibc-3.3-100-conf.patch b/meta/packages/gcc/gcc-3.3.4/gcc-uclibc-3.3-100-conf.patch
new file mode 100644
index 0000000000..213b4fbbd6
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.3.4/gcc-uclibc-3.3-100-conf.patch
@@ -0,0 +1,1593 @@
1diff -urN gcc-3.3.3/boehm-gc/config.sub gcc-3.3.3-new/boehm-gc/config.sub
2--- gcc-3.3.3/boehm-gc/config.sub 2002-02-11 22:37:53.000000000 -0600
3+++ gcc-3.3.3-new/boehm-gc/config.sub 2004-02-16 21:12:16.000000000 -0600
4@@ -118,7 +118,7 @@
5 # Here we must recognize all the valid KERNEL-OS combinations.
6 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
7 case $maybe_os in
8- nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*)
9+ nto-qnx* | linux-gnu* | linux-uclibc* | storm-chaos* | os2-emx* | windows32-*)
10 os=-$maybe_os
11 basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
12 ;;
13@@ -1089,7 +1089,8 @@
14 | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
15 | -chorusos* | -chorusrdb* \
16 | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
17- | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
18+ | -mingw32* | -linux-gnu* | -linux-uclibc* \
19+ | -uxpv* | -beos* | -mpeix* | -udk* \
20 | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
21 | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
22 | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
23diff -urN gcc-3.3.3/config.sub gcc-3.3.3-new/config.sub
24--- gcc-3.3.3/config.sub 2003-01-30 17:25:36.000000000 -0600
25+++ gcc-3.3.3-new/config.sub 2004-02-16 21:12:16.000000000 -0600
26@@ -118,7 +118,7 @@
27 # Here we must recognize all the valid KERNEL-OS combinations.
28 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
29 case $maybe_os in
30- nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
31+ nto-qnx* | linux-gnu* | linux-uclibc* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
32 os=-$maybe_os
33 basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
34 ;;
35@@ -1112,7 +1112,8 @@
36 | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
37 | -chorusos* | -chorusrdb* \
38 | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
39- | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
40+ | -mingw32* | -linux-gnu* | -linux-uclibc* \
41+ | -uxpv* | -beos* | -mpeix* | -udk* \
42 | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
43 | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
44 | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
45diff -urN gcc-3.3.3/gcc/config/arm/linux-elf.h gcc-3.3.3-new/gcc/config/arm/linux-elf.h
46--- gcc-3.3.3/gcc/config/arm/linux-elf.h 2003-09-16 10:39:23.000000000 -0500
47+++ gcc-3.3.3-new/gcc/config/arm/linux-elf.h 2004-02-16 21:12:16.000000000 -0600
48@@ -78,6 +78,18 @@
49 "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
50
51 #undef LINK_SPEC
52+#ifdef USE_UCLIBC
53+#define LINK_SPEC "%{h*} %{version:-v} \
54+ %{b} %{Wl,*:%*} \
55+ %{static:-Bstatic} \
56+ %{shared:-shared} \
57+ %{symbolic:-Bsymbolic} \
58+ %{rdynamic:-export-dynamic} \
59+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0} \
60+ -X \
61+ %{mbig-endian:-EB}" \
62+ SUBTARGET_EXTRA_LINK_SPEC
63+#else
64 #define LINK_SPEC "%{h*} %{version:-v} \
65 %{b} %{Wl,*:%*} \
66 %{static:-Bstatic} \
67@@ -88,6 +100,7 @@
68 -X \
69 %{mbig-endian:-EB}" \
70 SUBTARGET_EXTRA_LINK_SPEC
71+#endif
72
73 #define TARGET_OS_CPP_BUILTINS() \
74 do { \
75diff -urN gcc-3.3.3/gcc/config/cris/linux.h gcc-3.3.3-new/gcc/config/cris/linux.h
76--- gcc-3.3.3/gcc/config/cris/linux.h 2003-03-10 21:01:35.000000000 -0600
77+++ gcc-3.3.3-new/gcc/config/cris/linux.h 2004-02-16 21:12:16.000000000 -0600
78@@ -81,6 +81,25 @@
79 #undef CRIS_DEFAULT_CPU_VERSION
80 #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
81
82+#ifdef USE_UCLIBC
83+
84+#undef CRIS_SUBTARGET_VERSION
85+#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc"
86+
87+#undef CRIS_LINK_SUBTARGET_SPEC
88+#define CRIS_LINK_SUBTARGET_SPEC \
89+ "-mcrislinux\
90+ -rpath-link include/asm/../..%s\
91+ %{shared} %{static}\
92+ %{symbolic:-Bdynamic} %{shlib:-Bdynamic} %{static:-Bstatic}\
93+ %{!shared: \
94+ %{!static: \
95+ %{rdynamic:-export-dynamic} \
96+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} \
97+ %{!r:%{O2|O3: --gc-sections}}"
98+
99+#else /* USE_UCLIBC */
100+
101 #undef CRIS_SUBTARGET_VERSION
102 #define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
103
104@@ -95,6 +114,8 @@
105 %{!shared:%{!static:%{rdynamic:-export-dynamic}}}\
106 %{!r:%{O2|O3: --gc-sections}}"
107
108+#endif /* USE_UCLIBC */
109+
110
111 /* Node: Run-time Target */
112
113diff -urN gcc-3.3.3/gcc/config/cris/t-linux-uclibc gcc-3.3.3-new/gcc/config/cris/t-linux-uclibc
114--- gcc-3.3.3/gcc/config/cris/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600
115+++ gcc-3.3.3-new/gcc/config/cris/t-linux-uclibc 2004-02-16 21:12:16.000000000 -0600
116@@ -0,0 +1,3 @@
117+T_CFLAGS = -DUSE_UCLIBC
118+TARGET_LIBGCC2_CFLAGS += -fPIC
119+CRTSTUFF_T_CFLAGS_S = $(TARGET_LIBGCC2_CFLAGS)
120diff -urN gcc-3.3.3/gcc/config/i386/linux.h gcc-3.3.3-new/gcc/config/i386/linux.h
121--- gcc-3.3.3/gcc/config/i386/linux.h 2003-11-14 00:46:12.000000000 -0600
122+++ gcc-3.3.3-new/gcc/config/i386/linux.h 2004-02-16 21:12:16.000000000 -0600
123@@ -136,6 +136,15 @@
124 %{static:-static}}}"
125 #endif
126 #else
127+#if defined USE_UCLIBC
128+#define LINK_SPEC "-m elf_i386 %{shared:-shared} \
129+ %{!shared: \
130+ %{!ibcs: \
131+ %{!static: \
132+ %{rdynamic:-export-dynamic} \
133+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
134+ %{static:-static}}}"
135+#else
136 #define LINK_SPEC "-m elf_i386 %{shared:-shared} \
137 %{!shared: \
138 %{!ibcs: \
139@@ -144,6 +153,7 @@
140 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
141 %{static:-static}}}"
142 #endif
143+#endif
144
145 /* A C statement (sans semicolon) to output to the stdio stream
146 FILE the assembler definition of uninitialized global DECL named
147diff -urN gcc-3.3.3/gcc/config/mips/linux.h gcc-3.3.3-new/gcc/config/mips/linux.h
148--- gcc-3.3.3/gcc/config/mips/linux.h 2003-12-23 02:58:00.000000000 -0600
149+++ gcc-3.3.3-new/gcc/config/mips/linux.h 2004-02-16 21:12:16.000000000 -0600
150@@ -175,6 +175,17 @@
151
152 /* Borrowed from sparc/linux.h */
153 #undef LINK_SPEC
154+#ifdef USE_UCLIBC
155+#define LINK_SPEC \
156+ "%(endian_spec) \
157+ %{shared:-shared} \
158+ %{!shared: \
159+ %{!ibcs: \
160+ %{!static: \
161+ %{rdynamic:-export-dynamic} \
162+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
163+ %{static:-static}}}"
164+#else
165 #define LINK_SPEC \
166 "%(endian_spec) \
167 %{shared:-shared} \
168@@ -184,6 +195,7 @@
169 %{rdynamic:-export-dynamic} \
170 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
171 %{static:-static}}}"
172+#endif
173
174 #undef SUBTARGET_ASM_SPEC
175 #define SUBTARGET_ASM_SPEC "\
176diff -urN gcc-3.3.3/gcc/config/sh/linux.h gcc-3.3.3-new/gcc/config/sh/linux.h
177--- gcc-3.3.3/gcc/config/sh/linux.h 2003-11-06 17:13:33.000000000 -0600
178+++ gcc-3.3.3-new/gcc/config/sh/linux.h 2004-02-16 21:12:16.000000000 -0600
179@@ -44,12 +44,21 @@
180 #undef SUBTARGET_LINK_EMUL_SUFFIX
181 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
182 #undef SUBTARGET_LINK_SPEC
183+#ifdef USE_UCLIBC
184+#define SUBTARGET_LINK_SPEC \
185+ "%{shared:-shared} \
186+ %{!static: \
187+ %{rdynamic:-export-dynamic} \
188+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
189+ %{static:-static}"
190+#else
191 #define SUBTARGET_LINK_SPEC \
192 "%{shared:-shared} \
193 %{!static: \
194 %{rdynamic:-export-dynamic} \
195 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
196 %{static:-static}"
197+#endif
198
199 /* The GNU C++ standard library requires that these macros be defined. */
200 #undef CPLUSPLUS_CPP_SPEC
201diff -urN gcc-3.3.3/gcc/config/sh/t-linux-uclibc gcc-3.3.3-new/gcc/config/sh/t-linux-uclibc
202--- gcc-3.3.3/gcc/config/sh/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600
203+++ gcc-3.3.3-new/gcc/config/sh/t-linux-uclibc 2004-02-16 21:12:16.000000000 -0600
204@@ -0,0 +1,16 @@
205+T_CFLAGS = -DUSE_UCLIBC
206+
207+# Don't run fixproto
208+STMP_FIXPROTO =
209+
210+TARGET_LIBGCC2_CFLAGS = -fpic
211+LIB1ASMFUNCS_CACHE = _ic_invalidate
212+
213+LIB2FUNCS_EXTRA=
214+
215+MULTILIB_OPTIONS= $(MULTILIB_ENDIAN) m3e/m4
216+MULTILIB_DIRNAMES=
217+MULTILIB_MATCHES =
218+MULTILIB_EXCEPTIONS=
219+
220+EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o
221diff -urN gcc-3.3.3/gcc/config/sh/t-sh64-uclibc gcc-3.3.3-new/gcc/config/sh/t-sh64-uclibc
222--- gcc-3.3.3/gcc/config/sh/t-sh64-uclibc 1969-12-31 18:00:00.000000000 -0600
223+++ gcc-3.3.3-new/gcc/config/sh/t-sh64-uclibc 2004-02-16 21:12:16.000000000 -0600
224@@ -0,0 +1,13 @@
225+EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o
226+
227+LIB1ASMFUNCS = \
228+ _sdivsi3 _sdivsi3_i4 _udivsi3 _udivsi3_i4 _set_fpscr \
229+ _shcompact_call_trampoline _shcompact_return_trampoline \
230+ _shcompact_incoming_args _ic_invalidate _nested_trampoline \
231+ _push_pop_shmedia_regs \
232+ _udivdi3 _divdi3 _umoddi3 _moddi3
233+
234+MULTILIB_OPTIONS = $(MULTILIB_ENDIAN) m5-32media-nofpu/m5-compact/m5-compact-nofpu/m5-64media/m5-64media-nofpu
235+MULTILIB_DIRNAMES= $(MULTILIB_ENDIAN) nofpu compact nofpu/compact media64 nofpu/media64
236+MULTILIB_MATCHES=
237+MULTILIB_EXCEPTIONS=
238diff -urN gcc-3.3.3/gcc/config/t-linux-uclibc gcc-3.3.3-new/gcc/config/t-linux-uclibc
239--- gcc-3.3.3/gcc/config/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600
240+++ gcc-3.3.3-new/gcc/config/t-linux-uclibc 2004-02-16 21:12:16.000000000 -0600
241@@ -0,0 +1,23 @@
242+T_CFLAGS = -DUSE_UCLIBC
243+
244+# Don't run fixproto
245+STMP_FIXPROTO =
246+
247+# Compile crtbeginS.o and crtendS.o with pic.
248+CRTSTUFF_T_CFLAGS_S = $(CRTSTUFF_T_CFLAGS) -fPIC
249+# Compile libgcc2.a with pic.
250+TARGET_LIBGCC2_CFLAGS = -fPIC
251+
252+# Override t-slibgcc-elf-ver to export some libgcc symbols with
253+# the symbol versions that glibc used.
254+SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver
255+
256+# Use unwind-dw2-fde-glibc
257+#LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-glibc.c \
258+# $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
259+#LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h unwind-dw2-fde.c
260+
261+# Use unwind-dw2-fde
262+LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \
263+ $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
264+LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h
265diff -urN gcc-3.3.3/gcc/config.gcc gcc-3.3.3-new/gcc/config.gcc
266--- gcc-3.3.3/gcc/config.gcc 2004-01-21 00:06:00.000000000 -0600
267+++ gcc-3.3.3-new/gcc/config.gcc 2004-02-16 21:12:16.000000000 -0600
268@@ -697,6 +697,17 @@
269 extra_parts=""
270 use_collect2=yes
271 ;;
272+arm*-*-linux-uclibc*) # ARM GNU/Linux with ELF - uClibc
273+ tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/linux-gas.h arm/linux-elf.h"
274+ tmake_file="t-slibgcc-elf-ver t-linux-uclibc arm/t-linux"
275+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
276+ gnu_ld=yes
277+ case x${enable_threads} in
278+ x | xyes | xpthreads | xposix)
279+ thread_file='posix'
280+ ;;
281+ esac
282+ ;;
283 arm*-*-linux*) # ARM GNU/Linux with ELF
284 tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/linux-gas.h arm/linux-elf.h"
285 tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux"
286@@ -772,6 +783,10 @@
287 tmake_file="cris/t-cris cris/t-elfmulti"
288 gas=yes
289 ;;
290+cris-*-linux-uclibc*)
291+ tm_file="dbxelf.h elfos.h svr4.h ${tm_file} linux.h cris/linux.h"
292+ tmake_file="cris/t-cris t-slibgcc-elf-ver cris/t-linux-uclibc"
293+ ;;
294 cris-*-linux*)
295 tm_file="dbxelf.h elfos.h svr4.h ${tm_file} linux.h cris/linux.h"
296 tmake_file="cris/t-cris t-slibgcc-elf-ver cris/t-linux"
297@@ -1173,6 +1188,11 @@
298 thread_file='single'
299 fi
300 ;;
301+i[34567]86-*-linux*uclibc*) # Intel 80386's running GNU/Linux
302+ # with ELF format using uClibc
303+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h i386/linux.h"
304+ tmake_file="t-slibgcc-elf-ver t-linux-uclibc i386/t-crtstuff"
305+ ;;
306 i[34567]86-*-linux*) # Intel 80386's running GNU/Linux
307 # with ELF format using glibc 2
308 # aka GNU/Linux C library 6
309@@ -1883,6 +1903,16 @@
310 tm_file="elfos.h ${tm_file} mips/netbsd.h"
311 tmake_file="${tmake_file} mips/t-netbsd"
312 ;;
313+mips*-*-linux-uclibc*) # Linux MIPS, either endian. uClibc
314+ tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h"
315+ case $machine in
316+ mipsisa32*-*)
317+ target_cpu_default="MASK_SOFT_FLOAT"
318+ tm_defines="MIPS_ISA_DEFAULT=32"
319+ ;;
320+ esac
321+ tmake_file="t-slibgcc-elf-ver t-linux-uclibc mips/t-linux"
322+ ;;
323 mips*-*-linux*) # Linux MIPS, either endian.
324 tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h"
325 case $machine in
326@@ -2129,6 +2159,11 @@
327 out_file=rs6000/rs6000.c
328 tmake_file="rs6000/t-ppcos t-slibgcc-elf-ver t-linux rs6000/t-ppccomm"
329 ;;
330+powerpc-*-linux-uclibc*)
331+ tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h"
332+ out_file=rs6000/rs6000.c
333+ tmake_file="rs6000/t-ppcos t-slibgcc-elf-ver t-linux-uclibc rs6000/t-ppccomm"
334+ ;;
335 powerpc-*-linux*)
336 tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h"
337 out_file=rs6000/rs6000.c
338@@ -2313,10 +2348,18 @@
339 tmake_file="${tmake_file} sh/t-le"
340 ;;
341 esac
342- tmake_file="${tmake_file} sh/t-linux"
343+ case $machine in
344+ *-*-linux-uclibc*) tmake_file="${tmake_file} sh/t-linux-uclibc" ;;
345+ *) tmake_file="${tmake_file} sh/t-linux" ;;
346+ esac
347 tm_file="${tm_file} dbxelf.h elfos.h svr4.h sh/elf.h sh/linux.h"
348 gas=yes gnu_ld=yes
349 case $machine in
350+ sh64*-*-linux-uclibc*)
351+ tmake_file="${tmake_file} sh/t-sh64-uclibc"
352+ tm_file="${tm_file} sh/sh64.h"
353+ extra_headers="shmedia.h ushmedia.h sshmedia.h"
354+ ;;
355 sh64*)
356 tmake_file="${tmake_file} sh/t-sh64"
357 tm_file="${tm_file} sh/sh64.h"
358diff -urN gcc-3.3.3/libstdc++-v3/aclocal.m4 gcc-3.3.3-new/libstdc++-v3/aclocal.m4
359--- gcc-3.3.3/libstdc++-v3/aclocal.m4 2004-01-12 10:18:44.000000000 -0600
360+++ gcc-3.3.3-new/libstdc++-v3/aclocal.m4 2004-02-16 21:12:16.000000000 -0600
361@@ -1216,6 +1216,9 @@
362 dnl Default to "generic"
363 if test x$enable_clocale_flag = xno; then
364 case x${target_os} in
365+ xlinux-uclibc*)
366+ enable_clocale_flag=uclibc
367+ ;;
368 xlinux* | xgnu*)
369 AC_EGREP_CPP([_GLIBCPP_ok], [
370 #include <features.h>
371@@ -1339,6 +1342,41 @@
372 CTIME_CC=config/locale/generic/time_members.cc
373 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
374 ;;
375+ xuclibc)
376+ AC_MSG_RESULT(uclibc)
377+
378+ # Declare intention to use gettext, and add support for specific
379+ # languages.
380+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
381+ ALL_LINGUAS="de fr"
382+
383+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
384+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
385+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
386+ USE_NLS=yes
387+ fi
388+ # Export the build objects.
389+ for ling in $ALL_LINGUAS; do \
390+ glibcpp_MOFILES="$glibcpp_MOFILES $ling.mo"; \
391+ glibcpp_POFILES="$glibcpp_POFILES $ling.po"; \
392+ done
393+ AC_SUBST(glibcpp_MOFILES)
394+ AC_SUBST(glibcpp_POFILES)
395+
396+ CLOCALE_H=config/locale/uclibc/c_locale.h
397+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
398+ CCODECVT_H=config/locale/uclibc/codecvt_specializations.h
399+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
400+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
401+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
402+ CMESSAGES_H=config/locale/uclibc/messages_members.h
403+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
404+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
405+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
406+ CTIME_H=config/locale/uclibc/time_members.h
407+ CTIME_CC=config/locale/uclibc/time_members.cc
408+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
409+ ;;
410 *)
411 echo "$enable_clocale is an unknown locale package" 1>&2
412 exit 1
413diff -urN gcc-3.3.3/libstdc++-v3/configure gcc-3.3.3-new/libstdc++-v3/configure
414--- gcc-3.3.3/libstdc++-v3/configure 2004-01-12 10:18:45.000000000 -0600
415+++ gcc-3.3.3-new/libstdc++-v3/configure 2004-02-17 00:21:12.000000000 -0600
416@@ -2996,6 +2996,9 @@
417
418 if test x$enable_clocale_flag = xno; then
419 case x${target_os} in
420+ xlinux-uclibc*)
421+ enable_clocale_flag=uclibc
422+ ;;
423 xlinux* | xgnu*)
424 cat > conftest.$ac_ext <<EOF
425 #line 3002 "configure"
426@@ -3182,6 +3185,70 @@
427 CTIME_CC=config/locale/generic/time_members.cc
428 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
429 ;;
430+ xuclibc)
431+ echo "$ac_t""uclibc" 1>&6
432+
433+ # Declare intention to use gettext, and add support for specific
434+ # languages.
435+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
436+ ALL_LINGUAS="de fr"
437+
438+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
439+ # Extract the first word of "msgfmt", so it can be a program name with args.
440+set dummy msgfmt; ac_word=$2
441+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
442+echo "configure:3117: checking for $ac_word" >&5
443+if eval "test \"`echo '$''{'ac_cv_prog_check_msgfmt'+set}'`\" = set"; then
444+ echo $ac_n "(cached) $ac_c" 1>&6
445+else
446+ if test -n "$check_msgfmt"; then
447+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
448+else
449+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
450+ ac_dummy="$PATH"
451+ for ac_dir in $ac_dummy; do
452+ test -z "$ac_dir" && ac_dir=.
453+ if test -f $ac_dir/$ac_word; then
454+ ac_cv_prog_check_msgfmt="yes"
455+ break
456+ fi
457+ done
458+ IFS="$ac_save_ifs"
459+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
460+fi
461+fi
462+check_msgfmt="$ac_cv_prog_check_msgfmt"
463+if test -n "$check_msgfmt"; then
464+ echo "$ac_t""$check_msgfmt" 1>&6
465+else
466+ echo "$ac_t""no" 1>&6
467+fi
468+
469+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
470+ USE_NLS=yes
471+ fi
472+ # Export the build objects.
473+ for ling in $ALL_LINGUAS; do \
474+ glibcpp_MOFILES="$glibcpp_MOFILES $ling.mo"; \
475+ glibcpp_POFILES="$glibcpp_POFILES $ling.po"; \
476+ done
477+
478+
479+
480+ CLOCALE_H=config/locale/uclibc/c_locale.h
481+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
482+ CCODECVT_H=config/locale/uclibc/codecvt_specializations.h
483+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
484+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
485+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
486+ CMESSAGES_H=config/locale/uclibc/messages_members.h
487+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
488+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
489+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
490+ CTIME_H=config/locale/uclibc/time_members.h
491+ CTIME_CC=config/locale/uclibc/time_members.cc
492+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
493+ ;;
494 *)
495 echo "$enable_clocale is an unknown locale package" 1>&2
496 exit 1
497@@ -4212,6 +4279,968 @@
498 # GLIBCPP_CHECK_MATH_SUPPORT
499
500 case "$target" in
501+ *-uclibc*)
502+ os_include_dir="os/uclibc"
503+ for ac_hdr in nan.h ieeefp.h endian.h sys/isa_defs.h \
504+ machine/endian.h machine/param.h sys/machine.h sys/types.h \
505+ fp.h locale.h float.h inttypes.h
506+do
507+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
508+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
509+echo "configure:4224: checking for $ac_hdr" >&5
510+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
511+ echo $ac_n "(cached) $ac_c" 1>&6
512+else
513+ cat > conftest.$ac_ext <<EOF
514+#line 4229 "configure"
515+#include "confdefs.h"
516+#include <$ac_hdr>
517+EOF
518+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
519+{ (eval echo configure:4234: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
520+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
521+if test -z "$ac_err"; then
522+ rm -rf conftest*
523+ eval "ac_cv_header_$ac_safe=yes"
524+else
525+ echo "$ac_err" >&5
526+ echo "configure: failed program was:" >&5
527+ cat conftest.$ac_ext >&5
528+ rm -rf conftest*
529+ eval "ac_cv_header_$ac_safe=no"
530+fi
531+rm -f conftest*
532+fi
533+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
534+ echo "$ac_t""yes" 1>&6
535+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
536+ cat >> confdefs.h <<EOF
537+#define $ac_tr_hdr 1
538+EOF
539+
540+else
541+ echo "$ac_t""no" 1>&6
542+fi
543+done
544+
545+ SECTION_FLAGS='-ffunction-sections -fdata-sections'
546+
547+
548+ # If we're not using GNU ld, then there's no point in even trying these
549+ # tests. Check for that first. We should have already tested for gld
550+ # by now (in libtool), but require it now just to be safe...
551+ test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
552+ test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
553+
554+
555+ # The name set by libtool depends on the version of libtool. Shame on us
556+ # for depending on an impl detail, but c'est la vie. Older versions used
557+ # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
558+ # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
559+ # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
560+ # set (hence we're using an older libtool), then set it.
561+ if test x${with_gnu_ld+set} != xset; then
562+ if test x${ac_cv_prog_gnu_ld+set} != xset; then
563+ # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
564+ with_gnu_ld=no
565+ else
566+ with_gnu_ld=$ac_cv_prog_gnu_ld
567+ fi
568+ fi
569+
570+ # Start by getting the version number. I think the libtool test already
571+ # does some of this, but throws away the result.
572+
573+ ldver=`$LD --version 2>/dev/null | head -1 | \
574+ sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
575+
576+ glibcpp_gnu_ld_version=`echo $ldver | \
577+ $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
578+
579+ # Set --gc-sections.
580+ if test "$with_gnu_ld" = "notbroken"; then
581+ # GNU ld it is! Joy and bunny rabbits!
582+
583+ # All these tests are for C++; save the language and the compiler flags.
584+ # Need to do this so that g++ won't try to link in libstdc++
585+ ac_test_CFLAGS="${CFLAGS+set}"
586+ ac_save_CFLAGS="$CFLAGS"
587+ CFLAGS='-x c++ -Wl,--gc-sections'
588+
589+ # Check for -Wl,--gc-sections
590+ # XXX This test is broken at the moment, as symbols required for
591+ # linking are now in libsupc++ (not built yet.....). In addition,
592+ # this test has cored on solaris in the past. In addition,
593+ # --gc-sections doesn't really work at the moment (keeps on discarding
594+ # used sections, first .eh_frame and now some of the glibc sections for
595+ # iconv). Bzzzzt. Thanks for playing, maybe next time.
596+ echo $ac_n "checking for ld that supports -Wl,--gc-sections""... $ac_c" 1>&6
597+echo "configure:4312: checking for ld that supports -Wl,--gc-sections" >&5
598+ if test "$cross_compiling" = yes; then
599+ ac_sectionLDflags=yes
600+else
601+ cat > conftest.$ac_ext <<EOF
602+#line 4317 "configure"
603+#include "confdefs.h"
604+
605+ int main(void)
606+ {
607+ try { throw 1; }
608+ catch (...) { };
609+ return 0;
610+ }
611+
612+EOF
613+if { (eval echo configure:4328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
614+then
615+ ac_sectionLDflags=yes
616+else
617+ echo "configure: failed program was:" >&5
618+ cat conftest.$ac_ext >&5
619+ rm -fr conftest*
620+ ac_sectionLDflags=no
621+fi
622+rm -fr conftest*
623+fi
624+
625+ if test "$ac_test_CFLAGS" = set; then
626+ CFLAGS="$ac_save_CFLAGS"
627+ else
628+ # this is the suspicious part
629+ CFLAGS=''
630+ fi
631+ if test "$ac_sectionLDflags" = "yes"; then
632+ SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
633+ fi
634+ echo "$ac_t""$ac_sectionLDflags" 1>&6
635+ fi
636+
637+ # Set linker optimization flags.
638+ if test x"$with_gnu_ld" = x"yes"; then
639+ OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
640+ fi
641+
642+
643+
644+
645+
646+ echo $ac_n "checking for main in -lm""... $ac_c" 1>&6
647+echo "configure:4362: checking for main in -lm" >&5
648+ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'`
649+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
650+ echo $ac_n "(cached) $ac_c" 1>&6
651+else
652+ ac_save_LIBS="$LIBS"
653+LIBS="-lm $LIBS"
654+cat > conftest.$ac_ext <<EOF
655+#line 4370 "configure"
656+#include "confdefs.h"
657+
658+int main() {
659+main()
660+; return 0; }
661+EOF
662+if { (eval echo configure:4377: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
663+ rm -rf conftest*
664+ eval "ac_cv_lib_$ac_lib_var=yes"
665+else
666+ echo "configure: failed program was:" >&5
667+ cat conftest.$ac_ext >&5
668+ rm -rf conftest*
669+ eval "ac_cv_lib_$ac_lib_var=no"
670+fi
671+rm -f conftest*
672+LIBS="$ac_save_LIBS"
673+
674+fi
675+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
676+ echo "$ac_t""yes" 1>&6
677+ ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \
678+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
679+ cat >> confdefs.h <<EOF
680+#define $ac_tr_lib 1
681+EOF
682+
683+ LIBS="-lm $LIBS"
684+
685+else
686+ echo "$ac_t""no" 1>&6
687+fi
688+
689+ for ac_func in nan copysignf
690+do
691+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
692+echo "configure:4407: checking for $ac_func" >&5
693+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
694+ echo $ac_n "(cached) $ac_c" 1>&6
695+else
696+ cat > conftest.$ac_ext <<EOF
697+#line 4412 "configure"
698+#include "confdefs.h"
699+/* System header to define __stub macros and hopefully few prototypes,
700+ which can conflict with char $ac_func(); below. */
701+#include <assert.h>
702+/* Override any gcc2 internal prototype to avoid an error. */
703+/* We use char because int might match the return type of a gcc2
704+ builtin and then its argument prototype would still apply. */
705+char $ac_func();
706+
707+int main() {
708+
709+/* The GNU C library defines this for functions which it implements
710+ to always fail with ENOSYS. Some functions are actually named
711+ something starting with __ and the normal name is an alias. */
712+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
713+choke me
714+#else
715+$ac_func();
716+#endif
717+
718+; return 0; }
719+EOF
720+if { (eval echo configure:4435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
721+ rm -rf conftest*
722+ eval "ac_cv_func_$ac_func=yes"
723+else
724+ echo "configure: failed program was:" >&5
725+ cat conftest.$ac_ext >&5
726+ rm -rf conftest*
727+ eval "ac_cv_func_$ac_func=no"
728+fi
729+rm -f conftest*
730+fi
731+
732+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
733+ echo "$ac_t""yes" 1>&6
734+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
735+ cat >> confdefs.h <<EOF
736+#define $ac_tr_func 1
737+EOF
738+
739+else
740+ echo "$ac_t""no" 1>&6
741+LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"
742+fi
743+done
744+
745+
746+ for ac_func in __signbit
747+do
748+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
749+echo "configure:4464: checking for $ac_func" >&5
750+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
751+ echo $ac_n "(cached) $ac_c" 1>&6
752+else
753+ cat > conftest.$ac_ext <<EOF
754+#line 4469 "configure"
755+#include "confdefs.h"
756+/* System header to define __stub macros and hopefully few prototypes,
757+ which can conflict with char $ac_func(); below. */
758+#include <assert.h>
759+/* Override any gcc2 internal prototype to avoid an error. */
760+/* We use char because int might match the return type of a gcc2
761+ builtin and then its argument prototype would still apply. */
762+char $ac_func();
763+
764+int main() {
765+
766+/* The GNU C library defines this for functions which it implements
767+ to always fail with ENOSYS. Some functions are actually named
768+ something starting with __ and the normal name is an alias. */
769+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
770+choke me
771+#else
772+$ac_func();
773+#endif
774+
775+; return 0; }
776+EOF
777+if { (eval echo configure:4492: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
778+ rm -rf conftest*
779+ eval "ac_cv_func_$ac_func=yes"
780+else
781+ echo "configure: failed program was:" >&5
782+ cat conftest.$ac_ext >&5
783+ rm -rf conftest*
784+ eval "ac_cv_func_$ac_func=no"
785+fi
786+rm -f conftest*
787+fi
788+
789+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
790+ echo "$ac_t""yes" 1>&6
791+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
792+ cat >> confdefs.h <<EOF
793+#define $ac_tr_func 1
794+EOF
795+
796+else
797+ echo "$ac_t""no" 1>&6
798+LIBMATHOBJS="$LIBMATHOBJS signbit.lo"
799+fi
800+done
801+
802+ for ac_func in __signbitf
803+do
804+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
805+echo "configure:4520: checking for $ac_func" >&5
806+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
807+ echo $ac_n "(cached) $ac_c" 1>&6
808+else
809+ cat > conftest.$ac_ext <<EOF
810+#line 4525 "configure"
811+#include "confdefs.h"
812+/* System header to define __stub macros and hopefully few prototypes,
813+ which can conflict with char $ac_func(); below. */
814+#include <assert.h>
815+/* Override any gcc2 internal prototype to avoid an error. */
816+/* We use char because int might match the return type of a gcc2
817+ builtin and then its argument prototype would still apply. */
818+char $ac_func();
819+
820+int main() {
821+
822+/* The GNU C library defines this for functions which it implements
823+ to always fail with ENOSYS. Some functions are actually named
824+ something starting with __ and the normal name is an alias. */
825+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
826+choke me
827+#else
828+$ac_func();
829+#endif
830+
831+; return 0; }
832+EOF
833+if { (eval echo configure:4548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
834+ rm -rf conftest*
835+ eval "ac_cv_func_$ac_func=yes"
836+else
837+ echo "configure: failed program was:" >&5
838+ cat conftest.$ac_ext >&5
839+ rm -rf conftest*
840+ eval "ac_cv_func_$ac_func=no"
841+fi
842+rm -f conftest*
843+fi
844+
845+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
846+ echo "$ac_t""yes" 1>&6
847+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
848+ cat >> confdefs.h <<EOF
849+#define $ac_tr_func 1
850+EOF
851+
852+else
853+ echo "$ac_t""no" 1>&6
854+LIBMATHOBJS="$LIBMATHOBJS signbitf.lo"
855+fi
856+done
857+
858+
859+ if test x$ac_cv_func_copysignl = x"yes"; then
860+ for ac_func in __signbitl
861+do
862+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
863+echo "configure:4578: checking for $ac_func" >&5
864+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
865+ echo $ac_n "(cached) $ac_c" 1>&6
866+else
867+ cat > conftest.$ac_ext <<EOF
868+#line 4583 "configure"
869+#include "confdefs.h"
870+/* System header to define __stub macros and hopefully few prototypes,
871+ which can conflict with char $ac_func(); below. */
872+#include <assert.h>
873+/* Override any gcc2 internal prototype to avoid an error. */
874+/* We use char because int might match the return type of a gcc2
875+ builtin and then its argument prototype would still apply. */
876+char $ac_func();
877+
878+int main() {
879+
880+/* The GNU C library defines this for functions which it implements
881+ to always fail with ENOSYS. Some functions are actually named
882+ something starting with __ and the normal name is an alias. */
883+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
884+choke me
885+#else
886+$ac_func();
887+#endif
888+
889+; return 0; }
890+EOF
891+if { (eval echo configure:4606: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
892+ rm -rf conftest*
893+ eval "ac_cv_func_$ac_func=yes"
894+else
895+ echo "configure: failed program was:" >&5
896+ cat conftest.$ac_ext >&5
897+ rm -rf conftest*
898+ eval "ac_cv_func_$ac_func=no"
899+fi
900+rm -f conftest*
901+fi
902+
903+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
904+ echo "$ac_t""yes" 1>&6
905+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
906+ cat >> confdefs.h <<EOF
907+#define $ac_tr_func 1
908+EOF
909+
910+else
911+ echo "$ac_t""no" 1>&6
912+LIBMATHOBJS="$LIBMATHOBJS signbitl.lo"
913+fi
914+done
915+
916+ fi
917+
918+ if test -n "$LIBMATHOBJS"; then
919+ need_libmath=yes
920+ fi
921+
922+
923+
924+if test "$need_libmath" = yes; then
925+ GLIBCPP_BUILD_LIBMATH_TRUE=
926+ GLIBCPP_BUILD_LIBMATH_FALSE='#'
927+else
928+ GLIBCPP_BUILD_LIBMATH_TRUE='#'
929+ GLIBCPP_BUILD_LIBMATH_FALSE=
930+fi
931+
932+
933+ enable_wchar_t=no
934+
935+ echo $ac_n "checking for mbstate_t""... $ac_c" 1>&6
936+echo "configure:4651: checking for mbstate_t" >&5
937+ cat > conftest.$ac_ext <<EOF
938+#line 4653 "configure"
939+#include "confdefs.h"
940+#include <wchar.h>
941+int main() {
942+mbstate_t teststate;
943+; return 0; }
944+EOF
945+if { (eval echo configure:4660: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
946+ rm -rf conftest*
947+ have_mbstate_t=yes
948+else
949+ echo "configure: failed program was:" >&5
950+ cat conftest.$ac_ext >&5
951+ rm -rf conftest*
952+ have_mbstate_t=no
953+fi
954+rm -f conftest*
955+ echo "$ac_t""$have_mbstate_t" 1>&6
956+ if test x"$have_mbstate_t" = xyes; then
957+ cat >> confdefs.h <<\EOF
958+#define HAVE_MBSTATE_T 1
959+EOF
960+
961+ fi
962+
963+ for ac_hdr in wchar.h
964+do
965+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
966+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
967+echo "configure:4682: checking for $ac_hdr" >&5
968+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
969+ echo $ac_n "(cached) $ac_c" 1>&6
970+else
971+ cat > conftest.$ac_ext <<EOF
972+#line 4687 "configure"
973+#include "confdefs.h"
974+#include <$ac_hdr>
975+EOF
976+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
977+{ (eval echo configure:4692: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
978+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
979+if test -z "$ac_err"; then
980+ rm -rf conftest*
981+ eval "ac_cv_header_$ac_safe=yes"
982+else
983+ echo "$ac_err" >&5
984+ echo "configure: failed program was:" >&5
985+ cat conftest.$ac_ext >&5
986+ rm -rf conftest*
987+ eval "ac_cv_header_$ac_safe=no"
988+fi
989+rm -f conftest*
990+fi
991+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
992+ echo "$ac_t""yes" 1>&6
993+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
994+ cat >> confdefs.h <<EOF
995+#define $ac_tr_hdr 1
996+EOF
997+ ac_has_wchar_h=yes
998+else
999+ echo "$ac_t""no" 1>&6
1000+ac_has_wchar_h=no
1001+fi
1002+done
1003+
1004+ for ac_hdr in wctype.h
1005+do
1006+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
1007+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
1008+echo "configure:4723: checking for $ac_hdr" >&5
1009+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
1010+ echo $ac_n "(cached) $ac_c" 1>&6
1011+else
1012+ cat > conftest.$ac_ext <<EOF
1013+#line 4728 "configure"
1014+#include "confdefs.h"
1015+#include <$ac_hdr>
1016+EOF
1017+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1018+{ (eval echo configure:4733: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1019+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
1020+if test -z "$ac_err"; then
1021+ rm -rf conftest*
1022+ eval "ac_cv_header_$ac_safe=yes"
1023+else
1024+ echo "$ac_err" >&5
1025+ echo "configure: failed program was:" >&5
1026+ cat conftest.$ac_ext >&5
1027+ rm -rf conftest*
1028+ eval "ac_cv_header_$ac_safe=no"
1029+fi
1030+rm -f conftest*
1031+fi
1032+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
1033+ echo "$ac_t""yes" 1>&6
1034+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
1035+ cat >> confdefs.h <<EOF
1036+#define $ac_tr_hdr 1
1037+EOF
1038+ ac_has_wctype_h=yes
1039+else
1040+ echo "$ac_t""no" 1>&6
1041+ac_has_wctype_h=no
1042+fi
1043+done
1044+
1045+
1046+ if test x"$ac_has_wchar_h" = xyes &&
1047+ test x"$ac_has_wctype_h" = xyes &&
1048+ test x"$enable_c_mbchar" != xno; then
1049+
1050+ echo $ac_n "checking for WCHAR_MIN and WCHAR_MAX""... $ac_c" 1>&6
1051+echo "configure:4766: checking for WCHAR_MIN and WCHAR_MAX" >&5
1052+ cat > conftest.$ac_ext <<EOF
1053+#line 4768 "configure"
1054+#include "confdefs.h"
1055+#include <wchar.h>
1056+int main() {
1057+int i = WCHAR_MIN; int j = WCHAR_MAX;
1058+; return 0; }
1059+EOF
1060+if { (eval echo configure:4775: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1061+ rm -rf conftest*
1062+ has_wchar_minmax=yes
1063+else
1064+ echo "configure: failed program was:" >&5
1065+ cat conftest.$ac_ext >&5
1066+ rm -rf conftest*
1067+ has_wchar_minmax=no
1068+fi
1069+rm -f conftest*
1070+ echo "$ac_t""$has_wchar_minmax" 1>&6
1071+
1072+ echo $ac_n "checking for WEOF""... $ac_c" 1>&6
1073+echo "configure:4788: checking for WEOF" >&5
1074+ cat > conftest.$ac_ext <<EOF
1075+#line 4790 "configure"
1076+#include "confdefs.h"
1077+
1078+ #include <wchar.h>
1079+ #include <stddef.h>
1080+int main() {
1081+wint_t i = WEOF;
1082+; return 0; }
1083+EOF
1084+if { (eval echo configure:4799: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1085+ rm -rf conftest*
1086+ has_weof=yes
1087+else
1088+ echo "configure: failed program was:" >&5
1089+ cat conftest.$ac_ext >&5
1090+ rm -rf conftest*
1091+ has_weof=no
1092+fi
1093+rm -f conftest*
1094+ echo "$ac_t""$has_weof" 1>&6
1095+
1096+ ac_wfuncs=yes
1097+ for ac_func in wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset
1098+do
1099+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
1100+echo "configure:4815: checking for $ac_func" >&5
1101+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
1102+ echo $ac_n "(cached) $ac_c" 1>&6
1103+else
1104+ cat > conftest.$ac_ext <<EOF
1105+#line 4820 "configure"
1106+#include "confdefs.h"
1107+/* System header to define __stub macros and hopefully few prototypes,
1108+ which can conflict with char $ac_func(); below. */
1109+#include <assert.h>
1110+/* Override any gcc2 internal prototype to avoid an error. */
1111+/* We use char because int might match the return type of a gcc2
1112+ builtin and then its argument prototype would still apply. */
1113+char $ac_func();
1114+
1115+int main() {
1116+
1117+/* The GNU C library defines this for functions which it implements
1118+ to always fail with ENOSYS. Some functions are actually named
1119+ something starting with __ and the normal name is an alias. */
1120+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
1121+choke me
1122+#else
1123+$ac_func();
1124+#endif
1125+
1126+; return 0; }
1127+EOF
1128+if { (eval echo configure:4843: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1129+ rm -rf conftest*
1130+ eval "ac_cv_func_$ac_func=yes"
1131+else
1132+ echo "configure: failed program was:" >&5
1133+ cat conftest.$ac_ext >&5
1134+ rm -rf conftest*
1135+ eval "ac_cv_func_$ac_func=no"
1136+fi
1137+rm -f conftest*
1138+fi
1139+
1140+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
1141+ echo "$ac_t""yes" 1>&6
1142+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1143+ cat >> confdefs.h <<EOF
1144+#define $ac_tr_func 1
1145+EOF
1146+
1147+else
1148+ echo "$ac_t""no" 1>&6
1149+\
1150+ ac_wfuncs=no
1151+fi
1152+done
1153+
1154+
1155+ for ac_func in btowc wctob fgetwc fgetws fputwc fputws fwide \
1156+ fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
1157+ vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
1158+ mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \
1159+ wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
1160+ wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr
1161+do
1162+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
1163+echo "configure:4878: checking for $ac_func" >&5
1164+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
1165+ echo $ac_n "(cached) $ac_c" 1>&6
1166+else
1167+ cat > conftest.$ac_ext <<EOF
1168+#line 4883 "configure"
1169+#include "confdefs.h"
1170+/* System header to define __stub macros and hopefully few prototypes,
1171+ which can conflict with char $ac_func(); below. */
1172+#include <assert.h>
1173+/* Override any gcc2 internal prototype to avoid an error. */
1174+/* We use char because int might match the return type of a gcc2
1175+ builtin and then its argument prototype would still apply. */
1176+char $ac_func();
1177+
1178+int main() {
1179+
1180+/* The GNU C library defines this for functions which it implements
1181+ to always fail with ENOSYS. Some functions are actually named
1182+ something starting with __ and the normal name is an alias. */
1183+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
1184+choke me
1185+#else
1186+$ac_func();
1187+#endif
1188+
1189+; return 0; }
1190+EOF
1191+if { (eval echo configure:4906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1192+ rm -rf conftest*
1193+ eval "ac_cv_func_$ac_func=yes"
1194+else
1195+ echo "configure: failed program was:" >&5
1196+ cat conftest.$ac_ext >&5
1197+ rm -rf conftest*
1198+ eval "ac_cv_func_$ac_func=no"
1199+fi
1200+rm -f conftest*
1201+fi
1202+
1203+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
1204+ echo "$ac_t""yes" 1>&6
1205+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1206+ cat >> confdefs.h <<EOF
1207+#define $ac_tr_func 1
1208+EOF
1209+
1210+else
1211+ echo "$ac_t""no" 1>&6
1212+\
1213+ ac_wfuncs=no
1214+fi
1215+done
1216+
1217+
1218+ echo $ac_n "checking for ISO C99 wchar_t support""... $ac_c" 1>&6
1219+echo "configure:4934: checking for ISO C99 wchar_t support" >&5
1220+ if test x"$has_weof" = xyes &&
1221+ test x"$has_wchar_minmax" = xyes &&
1222+ test x"$ac_wfuncs" = xyes; then
1223+ ac_isoC99_wchar_t=yes
1224+ else
1225+ ac_isoC99_wchar_t=no
1226+ fi
1227+ echo "$ac_t""$ac_isoC99_wchar_t" 1>&6
1228+
1229+ ac_safe=`echo "iconv.h" | sed 'y%./+-%__p_%'`
1230+echo $ac_n "checking for iconv.h""... $ac_c" 1>&6
1231+echo "configure:4946: checking for iconv.h" >&5
1232+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
1233+ echo $ac_n "(cached) $ac_c" 1>&6
1234+else
1235+ cat > conftest.$ac_ext <<EOF
1236+#line 4951 "configure"
1237+#include "confdefs.h"
1238+#include <iconv.h>
1239+EOF
1240+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1241+{ (eval echo configure:4956: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1242+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
1243+if test -z "$ac_err"; then
1244+ rm -rf conftest*
1245+ eval "ac_cv_header_$ac_safe=yes"
1246+else
1247+ echo "$ac_err" >&5
1248+ echo "configure: failed program was:" >&5
1249+ cat conftest.$ac_ext >&5
1250+ rm -rf conftest*
1251+ eval "ac_cv_header_$ac_safe=no"
1252+fi
1253+rm -f conftest*
1254+fi
1255+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
1256+ echo "$ac_t""yes" 1>&6
1257+ ac_has_iconv_h=yes
1258+else
1259+ echo "$ac_t""no" 1>&6
1260+ac_has_iconv_h=no
1261+fi
1262+
1263+ ac_safe=`echo "langinfo.h" | sed 'y%./+-%__p_%'`
1264+echo $ac_n "checking for langinfo.h""... $ac_c" 1>&6
1265+echo "configure:4980: checking for langinfo.h" >&5
1266+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
1267+ echo $ac_n "(cached) $ac_c" 1>&6
1268+else
1269+ cat > conftest.$ac_ext <<EOF
1270+#line 4985 "configure"
1271+#include "confdefs.h"
1272+#include <langinfo.h>
1273+EOF
1274+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1275+{ (eval echo configure:4990: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1276+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
1277+if test -z "$ac_err"; then
1278+ rm -rf conftest*
1279+ eval "ac_cv_header_$ac_safe=yes"
1280+else
1281+ echo "$ac_err" >&5
1282+ echo "configure: failed program was:" >&5
1283+ cat conftest.$ac_ext >&5
1284+ rm -rf conftest*
1285+ eval "ac_cv_header_$ac_safe=no"
1286+fi
1287+rm -f conftest*
1288+fi
1289+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
1290+ echo "$ac_t""yes" 1>&6
1291+ ac_has_langinfo_h=yes
1292+else
1293+ echo "$ac_t""no" 1>&6
1294+ac_has_langinfo_h=no
1295+fi
1296+
1297+
1298+ echo $ac_n "checking for iconv in -liconv""... $ac_c" 1>&6
1299+echo "configure:5014: checking for iconv in -liconv" >&5
1300+ac_lib_var=`echo iconv'_'iconv | sed 'y%./+-%__p_%'`
1301+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
1302+ echo $ac_n "(cached) $ac_c" 1>&6
1303+else
1304+ ac_save_LIBS="$LIBS"
1305+LIBS="-liconv $LIBS"
1306+cat > conftest.$ac_ext <<EOF
1307+#line 5022 "configure"
1308+#include "confdefs.h"
1309+/* Override any gcc2 internal prototype to avoid an error. */
1310+/* We use char because int might match the return type of a gcc2
1311+ builtin and then its argument prototype would still apply. */
1312+char iconv();
1313+
1314+int main() {
1315+iconv()
1316+; return 0; }
1317+EOF
1318+if { (eval echo configure:5033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1319+ rm -rf conftest*
1320+ eval "ac_cv_lib_$ac_lib_var=yes"
1321+else
1322+ echo "configure: failed program was:" >&5
1323+ cat conftest.$ac_ext >&5
1324+ rm -rf conftest*
1325+ eval "ac_cv_lib_$ac_lib_var=no"
1326+fi
1327+rm -f conftest*
1328+LIBS="$ac_save_LIBS"
1329+
1330+fi
1331+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
1332+ echo "$ac_t""yes" 1>&6
1333+ libiconv="-liconv"
1334+else
1335+ echo "$ac_t""no" 1>&6
1336+fi
1337+
1338+ ac_save_LIBS="$LIBS"
1339+ LIBS="$LIBS $libiconv"
1340+
1341+ for ac_func in iconv_open iconv_close iconv nl_langinfo
1342+do
1343+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
1344+echo "configure:5059: checking for $ac_func" >&5
1345+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
1346+ echo $ac_n "(cached) $ac_c" 1>&6
1347+else
1348+ cat > conftest.$ac_ext <<EOF
1349+#line 5064 "configure"
1350+#include "confdefs.h"
1351+/* System header to define __stub macros and hopefully few prototypes,
1352+ which can conflict with char $ac_func(); below. */
1353+#include <assert.h>
1354+/* Override any gcc2 internal prototype to avoid an error. */
1355+/* We use char because int might match the return type of a gcc2
1356+ builtin and then its argument prototype would still apply. */
1357+char $ac_func();
1358+
1359+int main() {
1360+
1361+/* The GNU C library defines this for functions which it implements
1362+ to always fail with ENOSYS. Some functions are actually named
1363+ something starting with __ and the normal name is an alias. */
1364+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
1365+choke me
1366+#else
1367+$ac_func();
1368+#endif
1369+
1370+; return 0; }
1371+EOF
1372+if { (eval echo configure:5087: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1373+ rm -rf conftest*
1374+ eval "ac_cv_func_$ac_func=yes"
1375+else
1376+ echo "configure: failed program was:" >&5
1377+ cat conftest.$ac_ext >&5
1378+ rm -rf conftest*
1379+ eval "ac_cv_func_$ac_func=no"
1380+fi
1381+rm -f conftest*
1382+fi
1383+
1384+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
1385+ echo "$ac_t""yes" 1>&6
1386+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1387+ cat >> confdefs.h <<EOF
1388+#define $ac_tr_func 1
1389+EOF
1390+ \
1391+ ac_XPG2funcs=yes
1392+else
1393+ echo "$ac_t""no" 1>&6
1394+ac_XPG2funcs=no
1395+fi
1396+done
1397+
1398+
1399+ LIBS="$ac_save_LIBS"
1400+
1401+ echo $ac_n "checking for XPG2 wchar_t support""... $ac_c" 1>&6
1402+echo "configure:5117: checking for XPG2 wchar_t support" >&5
1403+ if test x"$ac_has_iconv_h" = xyes &&
1404+ test x"$ac_has_langinfo_h" = xyes &&
1405+ test x"$ac_XPG2funcs" = xyes; then
1406+ ac_XPG2_wchar_t=yes
1407+ else
1408+ ac_XPG2_wchar_t=no
1409+ fi
1410+ echo "$ac_t""$ac_XPG2_wchar_t" 1>&6
1411+
1412+ if test x"$ac_isoC99_wchar_t" = xyes &&
1413+ test x"$ac_XPG2_wchar_t" = xyes; then
1414+ cat >> confdefs.h <<\EOF
1415+#define _GLIBCPP_USE_WCHAR_T 1
1416+EOF
1417+
1418+ enable_wchar_t=yes
1419+ fi
1420+ fi
1421+ echo $ac_n "checking for enabled wchar_t specializations""... $ac_c" 1>&6
1422+echo "configure:5137: checking for enabled wchar_t specializations" >&5
1423+ echo "$ac_t""$enable_wchar_t" 1>&6
1424+
1425+
1426+if test "$enable_wchar_t" = yes; then
1427+ GLIBCPP_TEST_WCHAR_T_TRUE=
1428+ GLIBCPP_TEST_WCHAR_T_FALSE='#'
1429+else
1430+ GLIBCPP_TEST_WCHAR_T_TRUE='#'
1431+ GLIBCPP_TEST_WCHAR_T_FALSE=
1432+fi
1433+
1434+
1435+ cat >> confdefs.h <<\EOF
1436+#define HAVE_COPYSIGN 1
1437+EOF
1438+
1439+ cat >> confdefs.h <<\EOF
1440+#define HAVE_FINITE 1
1441+EOF
1442+
1443+ cat >> confdefs.h <<\EOF
1444+#define HAVE_FINITEF 1
1445+EOF
1446+
1447+ cat >> confdefs.h <<\EOF
1448+#define HAVE_ISINF 1
1449+EOF
1450+
1451+ cat >> confdefs.h <<\EOF
1452+#define HAVE_ISINFF 1
1453+EOF
1454+
1455+ cat >> confdefs.h <<\EOF
1456+#define HAVE_ISNAN 1
1457+EOF
1458+
1459+ cat >> confdefs.h <<\EOF
1460+#define HAVE_ISNANF 1
1461+EOF
1462+ ;;
1463 *-linux*)
1464 os_include_dir="os/gnu-linux"
1465 for ac_hdr in nan.h ieeefp.h endian.h sys/isa_defs.h \
1466diff -urN gcc-3.3.3/libstdc++-v3/configure.in gcc-3.3.3-new/libstdc++-v3/configure.in
1467--- gcc-3.3.3/libstdc++-v3/configure.in 2004-01-12 10:19:22.000000000 -0600
1468+++ gcc-3.3.3-new/libstdc++-v3/configure.in 2004-02-16 23:13:45.000000000 -0600
1469@@ -117,6 +117,36 @@
1470 # GLIBCPP_CHECK_MATH_SUPPORT
1471
1472 case "$target" in
1473+ *-uclibc*)
1474+ os_include_dir="os/uclibc"
1475+ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
1476+ machine/endian.h machine/param.h sys/machine.h sys/types.h \
1477+ fp.h locale.h float.h inttypes.h])
1478+ SECTION_FLAGS='-ffunction-sections -fdata-sections'
1479+ AC_SUBST(SECTION_FLAGS)
1480+ GLIBCPP_CHECK_LINKER_FEATURES
1481+ GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
1482+ GLIBCPP_CHECK_WCHAR_T_SUPPORT
1483+
1484+ AC_DEFINE(HAVE_COPYSIGN)
1485+ #AC_DEFINE(HAVE_COPYSIGNF)
1486+ AC_DEFINE(HAVE_FINITE)
1487+ AC_DEFINE(HAVE_FINITEF)
1488+ #AC_DEFINE(HAVE_FREXPF)
1489+ #AC_DEFINE(HAVE_HYPOTF)
1490+ AC_DEFINE(HAVE_ISINF)
1491+ AC_DEFINE(HAVE_ISINFF)
1492+ AC_DEFINE(HAVE_ISNAN)
1493+ AC_DEFINE(HAVE_ISNANF)
1494+ #AC_DEFINE(HAVE_SINCOS)
1495+ #AC_DEFINE(HAVE_SINCOSF)
1496+ #if test x"long_double_math_on_this_cpu" = x"yes"; then
1497+ #AC_DEFINE(HAVE_FINITEL)
1498+ #AC_DEFINE(HAVE_HYPOTL)
1499+ #AC_DEFINE(HAVE_ISINFL)
1500+ #AC_DEFINE(HAVE_ISNANL)
1501+ #fi
1502+ ;;
1503 *-linux*)
1504 os_include_dir="os/gnu-linux"
1505 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
1506diff -urN gcc-3.3.3/libstdc++-v3/configure.target gcc-3.3.3-new/libstdc++-v3/configure.target
1507--- gcc-3.3.3/libstdc++-v3/configure.target 2003-10-01 14:07:07.000000000 -0500
1508+++ gcc-3.3.3-new/libstdc++-v3/configure.target 2004-02-16 21:12:16.000000000 -0600
1509@@ -133,6 +133,9 @@
1510 freebsd*)
1511 os_include_dir="os/bsd/freebsd"
1512 ;;
1513+ linux-uclibc*)
1514+ os_include_dir="os/uclibc"
1515+ ;;
1516 gnu* | linux*)
1517 os_include_dir="os/gnu-linux"
1518 ;;
1519diff -urN gcc-3.3.3/libstdc++-v3/include/c_std/std_cstdlib.h gcc-3.3.3-new/libstdc++-v3/include/c_std/std_cstdlib.h
1520--- gcc-3.3.3/libstdc++-v3/include/c_std/std_cstdlib.h 2003-04-18 05:08:05.000000000 -0500
1521+++ gcc-3.3.3-new/libstdc++-v3/include/c_std/std_cstdlib.h 2004-02-16 21:12:16.000000000 -0600
1522@@ -101,9 +101,11 @@
1523 using ::labs;
1524 using ::ldiv;
1525 using ::malloc;
1526+#if _GLIBCPP_USE_WCHAR_T
1527 using ::mblen;
1528 using ::mbstowcs;
1529 using ::mbtowc;
1530+#endif
1531 using ::qsort;
1532 using ::rand;
1533 using ::realloc;
1534@@ -112,8 +114,10 @@
1535 using ::strtol;
1536 using ::strtoul;
1537 using ::system;
1538+#if _GLIBCPP_USE_WCHAR_T
1539 using ::wcstombs;
1540 using ::wctomb;
1541+#endif
1542
1543 inline long
1544 abs(long __i) { return labs(__i); }
1545diff -urN gcc-3.3.3/libstdc++-v3/include/c_std/std_cwchar.h gcc-3.3.3-new/libstdc++-v3/include/c_std/std_cwchar.h
1546--- gcc-3.3.3/libstdc++-v3/include/c_std/std_cwchar.h 2003-04-18 05:08:05.000000000 -0500
1547+++ gcc-3.3.3-new/libstdc++-v3/include/c_std/std_cwchar.h 2004-02-16 21:12:16.000000000 -0600
1548@@ -165,7 +165,9 @@
1549 using ::wcscoll;
1550 using ::wcscpy;
1551 using ::wcscspn;
1552+#ifdef HAVE_WCSFTIME
1553 using ::wcsftime;
1554+#endif
1555 using ::wcslen;
1556 using ::wcsncat;
1557 using ::wcsncmp;
1558diff -urN gcc-3.3.3/ltconfig gcc-3.3.3-new/ltconfig
1559--- gcc-3.3.3/ltconfig 2003-02-19 20:10:02.000000000 -0600
1560+++ gcc-3.3.3-new/ltconfig 2004-02-16 21:12:16.000000000 -0600
1561@@ -603,6 +603,7 @@
1562 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
1563 case $host_os in
1564 linux-gnu*) ;;
1565+linux-uclibc*) ;;
1566 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
1567 esac
1568
1569@@ -1247,6 +1248,24 @@
1570 dynamic_linker='GNU/Linux ld.so'
1571 ;;
1572
1573+linux-uclibc*)
1574+ version_type=linux
1575+ need_lib_prefix=no
1576+ need_version=no
1577+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1578+ soname_spec='${libname}${release}.so$major'
1579+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
1580+ shlibpath_var=LD_LIBRARY_PATH
1581+ shlibpath_overrides_runpath=no
1582+ # This implies no fast_install, which is unacceptable.
1583+ # Some rework will be needed to allow for fast_install
1584+ # before this can be enabled.
1585+ # Note: copied from linux-gnu, and may not be appropriate.
1586+ hardcode_into_libs=yes
1587+ # Assume using the uClibc dynamic linker.
1588+ dynamic_linker="uClibc ld.so"
1589+ ;;
1590+
1591 netbsd*)
1592 need_lib_prefix=no
1593 need_version=no
diff --git a/meta/packages/gcc/gcc-3.3.4/gcc-uclibc-3.3-110-conf.patch b/meta/packages/gcc/gcc-3.3.4/gcc-uclibc-3.3-110-conf.patch
new file mode 100644
index 0000000000..f297c3283f
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.3.4/gcc-uclibc-3.3-110-conf.patch
@@ -0,0 +1,55 @@
1Use the patch by Carl Miller <chaz@energoncube.net> for powerpc, with
2some minor modifications. Changed *os_uclibc to *os_linux_uclibc since
3at some point we might support other platforms. Also updated to 3.3.3.
4diff -urN gcc-3.3.3/gcc/config/rs6000/linux.h gcc-3.3.3-new/gcc/config/rs6000/linux.h
5--- gcc-3.3.3/gcc/config/rs6000/linux.h 2003-11-14 00:46:10.000000000 -0600
6+++ gcc-3.3.3-new/gcc/config/rs6000/linux.h 2004-02-16 21:13:40.000000000 -0600
7@@ -64,7 +64,11 @@
8 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
9
10 #undef LINK_OS_DEFAULT_SPEC
11+#ifdef USE_UCLIBC
12+#define LINK_OS_DEFAULT_SPEC "%(link_os_linux_uclibc)"
13+#else
14 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
15+#endif
16
17 #undef TARGET_VERSION
18 #define TARGET_VERSION fprintf (stderr, " (PowerPC GNU/Linux)");
19diff -urN gcc-3.3.3/gcc/config/rs6000/sysv4.h gcc-3.3.3-new/gcc/config/rs6000/sysv4.h
20--- gcc-3.3.3/gcc/config/rs6000/sysv4.h 2003-10-28 13:55:41.000000000 -0600
21+++ gcc-3.3.3-new/gcc/config/rs6000/sysv4.h 2004-02-16 21:13:40.000000000 -0600
22@@ -968,9 +968,11 @@
23 %{mcall-linux: %(link_os_linux) } \
24 %{mcall-gnu: %(link_os_gnu) } \
25 %{mcall-netbsd: %(link_os_netbsd) } \
26+%{mcall-uclibc: %(link_os_linux_uclibc) } \
27 %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: \
28 %{!mcall-freebsd: %{!mcall-linux: %{!mcall-gnu: \
29- %{!mcall-netbsd: %(link_os_default) }}}}}}}}}"
30+ %{!mcall-netbsd: %{!mcall-uclibc: \
31+ %(link_os_default) }}}}}}}}}}"
32
33 #define LINK_OS_DEFAULT_SPEC ""
34
35@@ -1307,6 +1309,12 @@
36
37 #define LINK_OS_WINDISS_SPEC ""
38
39+/* uClibc support for Linux. */
40+
41+#define LINK_OS_LINUX_UCLIBC_SPEC "-m elf32ppclinux %{!shared: %{!static: \
42+ %{rdynamic:-export-dynamic} \
43+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}}"
44+
45 /* Define any extra SPECS that the compiler needs to generate. */
46 /* Override rs6000.h definition. */
47 #undef SUBTARGET_EXTRA_SPECS
48@@ -1372,6 +1380,7 @@
49 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
50 { "link_os_vxworks", LINK_OS_VXWORKS_SPEC }, \
51 { "link_os_windiss", LINK_OS_WINDISS_SPEC }, \
52+ { "link_os_linux_uclibc", LINK_OS_LINUX_UCLIBC_SPEC }, \
53 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
54 { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \
55 { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
diff --git a/meta/packages/gcc/gcc-3.3.4/gcc-uclibc-3.3-120-softfloat.patch b/meta/packages/gcc/gcc-3.3.4/gcc-uclibc-3.3-120-softfloat.patch
new file mode 100644
index 0000000000..f2431896cf
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.3.4/gcc-uclibc-3.3-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.3.4/gcc-uclibc-3.3-200-code.patch b/meta/packages/gcc/gcc-3.3.4/gcc-uclibc-3.3-200-code.patch
new file mode 100644
index 0000000000..5880d834b4
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.3.4/gcc-uclibc-3.3-200-code.patch
@@ -0,0 +1,3021 @@
1Warning! This patch is not finished. The wide char time-related stuff
2is broken or non-functional. But it serves as a starting point to get
3things building while I continue to work on the uClibc locale internals.
4diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
5--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1969-12-31 18:00:00.000000000 -0600
6+++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2004-01-09 07:55:02.000000000 -0600
7@@ -0,0 +1,63 @@
8+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
9+
10+// Copyright (C) 2002 Free Software Foundation, Inc.
11+//
12+// This file is part of the GNU ISO C++ Library. This library is free
13+// software; you can redistribute it and/or modify it under the
14+// terms of the GNU General Public License as published by the
15+// Free Software Foundation; either version 2, or (at your option)
16+// any later version.
17+
18+// This library is distributed in the hope that it will be useful,
19+// but WITHOUT ANY WARRANTY; without even the implied warranty of
20+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+// GNU General Public License for more details.
22+
23+// You should have received a copy of the GNU General Public License along
24+// with this library; see the file COPYING. If not, write to the Free
25+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
26+// USA.
27+
28+// As a special exception, you may use this file as part of a free software
29+// library without restriction. Specifically, if other files instantiate
30+// templates or use macros or inline functions from this file, or you compile
31+// this file and link it with other files to produce an executable, this
32+// file does not by itself cause the resulting executable to be covered by
33+// the GNU General Public License. This exception does not however
34+// invalidate any other reasons why the executable file might be covered by
35+// the GNU General Public License.
36+
37+// Written by Jakub Jelinek <jakub@redhat.com>
38+
39+#include <clocale>
40+
41+#ifdef __UCLIBC_MJN3_ONLY__
42+#warning clean this up
43+#endif
44+
45+#ifdef __UCLIBC_HAS_XLOCALE__
46+
47+extern "C" __typeof(iswctype_l) __iswctype_l;
48+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
49+extern "C" __typeof(strcoll_l) __strcoll_l;
50+extern "C" __typeof(strftime_l) __strftime_l;
51+extern "C" __typeof(strtod_l) __strtod_l;
52+extern "C" __typeof(strtof_l) __strtof_l;
53+extern "C" __typeof(strtold_l) __strtold_l;
54+extern "C" __typeof(strtol_l) __strtol_l;
55+extern "C" __typeof(strtoll_l) __strtoll_l;
56+extern "C" __typeof(strtoul_l) __strtoul_l;
57+extern "C" __typeof(strtoull_l) __strtoull_l;
58+extern "C" __typeof(strxfrm_l) __strxfrm_l;
59+extern "C" __typeof(towlower_l) __towlower_l;
60+extern "C" __typeof(towupper_l) __towupper_l;
61+extern "C" __typeof(wcscoll_l) __wcscoll_l;
62+extern "C" __typeof(wcsftime_l) __wcsftime_l;
63+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
64+extern "C" __typeof(wctype_l) __wctype_l;
65+extern "C" __typeof(newlocale) __newlocale;
66+extern "C" __typeof(freelocale) __freelocale;
67+extern "C" __typeof(duplocale) __duplocale;
68+extern "C" __typeof(uselocale) __uselocale;
69+
70+#endif // GLIBC 2.3 and later
71diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/c_locale.cc
72--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/c_locale.cc 1969-12-31 18:00:00.000000000 -0600
73+++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/c_locale.cc 2004-01-09 08:37:55.000000000 -0600
74@@ -0,0 +1,231 @@
75+// Wrapper for underlying C-language localization -*- C++ -*-
76+
77+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
78+//
79+// This file is part of the GNU ISO C++ Library. This library is free
80+// software; you can redistribute it and/or modify it under the
81+// terms of the GNU General Public License as published by the
82+// Free Software Foundation; either version 2, or (at your option)
83+// any later version.
84+
85+// This library is distributed in the hope that it will be useful,
86+// but WITHOUT ANY WARRANTY; without even the implied warranty of
87+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
88+// GNU General Public License for more details.
89+
90+// You should have received a copy of the GNU General Public License along
91+// with this library; see the file COPYING. If not, write to the Free
92+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
93+// USA.
94+
95+// As a special exception, you may use this file as part of a free software
96+// library without restriction. Specifically, if other files instantiate
97+// templates or use macros or inline functions from this file, or you compile
98+// this file and link it with other files to produce an executable, this
99+// file does not by itself cause the resulting executable to be covered by
100+// the GNU General Public License. This exception does not however
101+// invalidate any other reasons why the executable file might be covered by
102+// the GNU General Public License.
103+
104+//
105+// ISO C++ 14882: 22.8 Standard locale categories.
106+//
107+
108+// Written by Benjamin Kosnik <bkoz@redhat.com>
109+
110+#include <locale>
111+#include <stdexcept>
112+#include <langinfo.h>
113+#include <bits/c++locale_internal.h>
114+
115+#ifndef __UCLIBC_HAS_XLOCALE__
116+#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
117+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
118+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
119+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
120+#define __strtof_l(S, E, L) strtof((S), (E))
121+#define __strtod_l(S, E, L) strtod((S), (E))
122+#define __strtold_l(S, E, L) strtold((S), (E))
123+#endif
124+
125+namespace std
126+{
127+ template<>
128+ void
129+ __convert_to_v(const char* __s, long& __v, ios_base::iostate& __err,
130+ const __c_locale& __cloc, int __base)
131+ {
132+ if (!(__err & ios_base::failbit))
133+ {
134+ char* __sanity;
135+ errno = 0;
136+ long __l = __strtol_l(__s, &__sanity, __base, __cloc);
137+ if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
138+ __v = __l;
139+ else
140+ __err |= ios_base::failbit;
141+ }
142+ }
143+
144+ template<>
145+ void
146+ __convert_to_v(const char* __s, unsigned long& __v,
147+ ios_base::iostate& __err, const __c_locale& __cloc,
148+ int __base)
149+ {
150+ if (!(__err & ios_base::failbit))
151+ {
152+ char* __sanity;
153+ errno = 0;
154+ unsigned long __ul = __strtoul_l(__s, &__sanity, __base, __cloc);
155+ if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
156+ __v = __ul;
157+ else
158+ __err |= ios_base::failbit;
159+ }
160+ }
161+
162+#ifdef _GLIBCPP_USE_LONG_LONG
163+ template<>
164+ void
165+ __convert_to_v(const char* __s, long long& __v, ios_base::iostate& __err,
166+ const __c_locale& __cloc, int __base)
167+ {
168+ if (!(__err & ios_base::failbit))
169+ {
170+ char* __sanity;
171+ errno = 0;
172+ long long __ll = __strtoll_l(__s, &__sanity, __base, __cloc);
173+ if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
174+ __v = __ll;
175+ else
176+ __err |= ios_base::failbit;
177+ }
178+ }
179+
180+ template<>
181+ void
182+ __convert_to_v(const char* __s, unsigned long long& __v,
183+ ios_base::iostate& __err, const __c_locale& __cloc,
184+ int __base)
185+ {
186+ if (!(__err & ios_base::failbit))
187+ {
188+ char* __sanity;
189+ errno = 0;
190+ unsigned long long __ull = __strtoull_l(__s, &__sanity, __base,
191+ __cloc);
192+ if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
193+ __v = __ull;
194+ else
195+ __err |= ios_base::failbit;
196+ }
197+ }
198+#endif
199+
200+ template<>
201+ void
202+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
203+ const __c_locale& __cloc, int)
204+ {
205+ if (!(__err & ios_base::failbit))
206+ {
207+ char* __sanity;
208+ errno = 0;
209+ float __f = __strtof_l(__s, &__sanity, __cloc);
210+ if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
211+ __v = __f;
212+ else
213+ __err |= ios_base::failbit;
214+ }
215+ }
216+
217+ template<>
218+ void
219+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
220+ const __c_locale& __cloc, int)
221+ {
222+ if (!(__err & ios_base::failbit))
223+ {
224+ char* __sanity;
225+ errno = 0;
226+ double __d = __strtod_l(__s, &__sanity, __cloc);
227+ if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
228+ __v = __d;
229+ else
230+ __err |= ios_base::failbit;
231+ }
232+ }
233+
234+ template<>
235+ void
236+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
237+ const __c_locale& __cloc, int)
238+ {
239+ if (!(__err & ios_base::failbit))
240+ {
241+ char* __sanity;
242+ errno = 0;
243+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
244+ if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)
245+ __v = __ld;
246+ else
247+ __err |= ios_base::failbit;
248+ }
249+ }
250+
251+ void
252+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
253+ __c_locale __old)
254+ {
255+#ifdef __UCLIBC_HAS_XLOCALE__
256+ __cloc = __newlocale(1 << LC_ALL, __s, __old);
257+ if (!__cloc)
258+ {
259+ // This named locale is not supported by the underlying OS.
260+ __throw_runtime_error("attempt to create locale from unknown name");
261+ }
262+#else
263+ __cloc = NULL;
264+#endif
265+ }
266+
267+ void
268+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
269+ {
270+#ifdef __UCLIBC_HAS_XLOCALE__
271+ if (_S_c_locale != __cloc)
272+ __freelocale(__cloc);
273+#else
274+ __cloc = NULL;
275+#endif
276+ }
277+
278+ __c_locale
279+ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
280+#ifdef __UCLIBC_HAS_XLOCALE__
281+ { return __duplocale(__cloc); }
282+#else
283+ { return __c_locale(); }
284+#endif
285+
286+ const char* locale::_S_categories[_S_categories_size
287+ + _S_extra_categories_size] =
288+ {
289+ "LC_CTYPE",
290+ "LC_NUMERIC",
291+ "LC_TIME",
292+ "LC_COLLATE",
293+ "LC_MONETARY",
294+ "LC_MESSAGES"
295+#if _GLIBCPP_NUM_CATEGORIES != 0
296+ ,
297+ "LC_PAPER",
298+ "LC_NAME",
299+ "LC_ADDRESS",
300+ "LC_TELEPHONE",
301+ "LC_MEASUREMENT",
302+ "LC_IDENTIFICATION"
303+#endif
304+ };
305+} // namespace std
306diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/c_locale.h
307--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/c_locale.h 1969-12-31 18:00:00.000000000 -0600
308+++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/c_locale.h 2004-01-09 07:51:06.000000000 -0600
309@@ -0,0 +1,118 @@
310+// Wrapper for underlying C-language localization -*- C++ -*-
311+
312+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
313+//
314+// This file is part of the GNU ISO C++ Library. This library is free
315+// software; you can redistribute it and/or modify it under the
316+// terms of the GNU General Public License as published by the
317+// Free Software Foundation; either version 2, or (at your option)
318+// any later version.
319+
320+// This library is distributed in the hope that it will be useful,
321+// but WITHOUT ANY WARRANTY; without even the implied warranty of
322+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
323+// GNU General Public License for more details.
324+
325+// You should have received a copy of the GNU General Public License along
326+// with this library; see the file COPYING. If not, write to the Free
327+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
328+// USA.
329+
330+// As a special exception, you may use this file as part of a free software
331+// library without restriction. Specifically, if other files instantiate
332+// templates or use macros or inline functions from this file, or you compile
333+// this file and link it with other files to produce an executable, this
334+// file does not by itself cause the resulting executable to be covered by
335+// the GNU General Public License. This exception does not however
336+// invalidate any other reasons why the executable file might be covered by
337+// the GNU General Public License.
338+
339+//
340+// ISO C++ 14882: 22.8 Standard locale categories.
341+//
342+
343+// Written by Benjamin Kosnik <bkoz@redhat.com>
344+
345+#ifndef _CPP_BITS_C_LOCALE_H
346+#define _CPP_BITS_C_LOCALE_H 1
347+
348+#pragma GCC system_header
349+
350+#include <clocale>
351+#include <langinfo.h> // For codecvt
352+#ifdef __UCLIBC_MJN3_ONLY__
353+#warning fix this
354+#endif
355+#ifdef __UCLIBC_HAS_LOCALE__
356+#include <iconv.h> // For codecvt using iconv, iconv_t
357+#endif
358+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
359+#include <libintl.h> // For messages
360+#endif
361+
362+#ifdef __UCLIBC_MJN3_ONLY__
363+#warning what is _GLIBCPP_C_LOCALE_GNU for
364+#endif
365+#define _GLIBCPP_C_LOCALE_GNU 1
366+
367+#ifdef __UCLIBC_MJN3_ONLY__
368+#warning fix categories
369+#endif
370+// #define _GLIBCPP_NUM_CATEGORIES 6
371+#define _GLIBCPP_NUM_CATEGORIES 0
372+
373+#ifdef __UCLIBC_HAS_XLOCALE__
374+namespace __gnu_cxx
375+{
376+ extern "C" __typeof(uselocale) __uselocale;
377+}
378+#endif
379+
380+namespace std
381+{
382+#ifdef __UCLIBC_HAS_XLOCALE__
383+ typedef __locale_t __c_locale;
384+#else
385+ typedef int* __c_locale;
386+#endif
387+
388+ // Convert numeric value of type _Tv to string and return length of
389+ // string. If snprintf is available use it, otherwise fall back to
390+ // the unsafe sprintf which, in general, can be dangerous and should
391+ // be avoided.
392+ template<typename _Tv>
393+ int
394+ __convert_from_v(char* __out, const int __size, const char* __fmt,
395+#ifdef __UCLIBC_HAS_XLOCALE__
396+ _Tv __v, const __c_locale& __cloc, int __prec = -1)
397+ {
398+ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
399+#else
400+ _Tv __v, const __c_locale&, int __prec = -1)
401+ {
402+# ifdef __UCLIBC_HAS_LOCALE__
403+ char* __old = setlocale(LC_ALL, NULL);
404+ char* __sav = static_cast<char*>(malloc(strlen(__old) + 1));
405+ if (__sav)
406+ strcpy(__sav, __old);
407+ setlocale(LC_ALL, "C");
408+# endif
409+#endif
410+
411+ int __ret;
412+ if (__prec >= 0)
413+ __ret = snprintf(__out, __size, __fmt, __prec, __v);
414+ else
415+ __ret = snprintf(__out, __size, __fmt, __v);
416+
417+#ifdef __UCLIBC_HAS_XLOCALE__
418+ __gnu_cxx::__uselocale(__old);
419+#elif defined __UCLIBC_HAS_LOCALE__
420+ setlocale(LC_ALL, __sav);
421+ free(__sav);
422+#endif
423+ return __ret;
424+ }
425+}
426+
427+#endif
428diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
429--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1969-12-31 18:00:00.000000000 -0600
430+++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2004-01-09 04:04:34.000000000 -0600
431@@ -0,0 +1,113 @@
432+// std::codecvt implementation details, GNU version -*- C++ -*-
433+
434+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
435+//
436+// This file is part of the GNU ISO C++ Library. This library is free
437+// software; you can redistribute it and/or modify it under the
438+// terms of the GNU General Public License as published by the
439+// Free Software Foundation; either version 2, or (at your option)
440+// any later version.
441+
442+// This library is distributed in the hope that it will be useful,
443+// but WITHOUT ANY WARRANTY; without even the implied warranty of
444+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
445+// GNU General Public License for more details.
446+
447+// You should have received a copy of the GNU General Public License along
448+// with this library; see the file COPYING. If not, write to the Free
449+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
450+// USA.
451+
452+// As a special exception, you may use this file as part of a free software
453+// library without restriction. Specifically, if other files instantiate
454+// templates or use macros or inline functions from this file, or you compile
455+// this file and link it with other files to produce an executable, this
456+// file does not by itself cause the resulting executable to be covered by
457+// the GNU General Public License. This exception does not however
458+// invalidate any other reasons why the executable file might be covered by
459+// the GNU General Public License.
460+
461+//
462+// ISO C++ 14882: 22.2.1.5 - Template class codecvt
463+//
464+
465+// Written by Benjamin Kosnik <bkoz@redhat.com>
466+
467+#include <locale>
468+#include <bits/c++locale_internal.h>
469+
470+namespace std
471+{
472+ // Specializations.
473+#ifdef _GLIBCPP_USE_WCHAR_T
474+ codecvt_base::result
475+ codecvt<wchar_t, char, mbstate_t>::
476+ do_out(state_type& __state, const intern_type* __from,
477+ const intern_type* __from_end, const intern_type*& __from_next,
478+ extern_type* __to, extern_type* __to_end,
479+ extern_type*& __to_next) const
480+ {
481+ result __ret = error;
482+ size_t __len = min(__from_end - __from, __to_end - __to);
483+#ifdef __UCLIBC_HAS_XLOCALE__
484+ __c_locale __old = __uselocale(_S_c_locale);
485+#endif
486+ size_t __conv = wcsrtombs(__to, &__from, __len, &__state);
487+#ifdef __UCLIBC_HAS_XLOCALE__
488+ __uselocale(__old);
489+#endif
490+
491+ if (__conv == __len)
492+ {
493+ __from_next = __from;
494+ __to_next = __to + __conv;
495+ __ret = ok;
496+ }
497+ else if (__conv > 0 && __conv < __len)
498+ {
499+ __from_next = __from;
500+ __to_next = __to + __conv;
501+ __ret = partial;
502+ }
503+ else
504+ __ret = error;
505+
506+ return __ret;
507+ }
508+
509+ codecvt_base::result
510+ codecvt<wchar_t, char, mbstate_t>::
511+ do_in(state_type& __state, const extern_type* __from,
512+ const extern_type* __from_end, const extern_type*& __from_next,
513+ intern_type* __to, intern_type* __to_end,
514+ intern_type*& __to_next) const
515+ {
516+ result __ret = error;
517+ size_t __len = min(__from_end - __from, __to_end - __to);
518+#ifdef __UCLIBC_HAS_XLOCALE__
519+ __c_locale __old = __uselocale(_S_c_locale);
520+#endif
521+ size_t __conv = mbsrtowcs(__to, &__from, __len, &__state);
522+#ifdef __UCLIBC_HAS_XLOCALE__
523+ __uselocale(__old);
524+#endif
525+
526+ if (__conv == __len)
527+ {
528+ __from_next = __from;
529+ __to_next = __to + __conv;
530+ __ret = ok;
531+ }
532+ else if (__conv > 0 && __conv < __len)
533+ {
534+ __from_next = __from;
535+ __to_next = __to + __conv;
536+ __ret = partial;
537+ }
538+ else
539+ __ret = error;
540+
541+ return __ret;
542+ }
543+#endif
544+}
545diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/codecvt_specializations.h gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/codecvt_specializations.h
546--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/codecvt_specializations.h 1969-12-31 18:00:00.000000000 -0600
547+++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/codecvt_specializations.h 2004-01-09 01:53:51.000000000 -0600
548@@ -0,0 +1,461 @@
549+// Locale support (codecvt) -*- C++ -*-
550+
551+// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
552+//
553+// This file is part of the GNU ISO C++ Library. This library is free
554+// software; you can redistribute it and/or modify it under the
555+// terms of the GNU General Public License as published by the
556+// Free Software Foundation; either version 2, or (at your option)
557+// any later version.
558+
559+// This library is distributed in the hope that it will be useful,
560+// but WITHOUT ANY WARRANTY; without even the implied warranty of
561+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
562+// GNU General Public License for more details.
563+
564+// You should have received a copy of the GNU General Public License along
565+// with this library; see the file COPYING. If not, write to the Free
566+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
567+// USA.
568+
569+// As a special exception, you may use this file as part of a free software
570+// library without restriction. Specifically, if other files instantiate
571+// templates or use macros or inline functions from this file, or you compile
572+// this file and link it with other files to produce an executable, this
573+// file does not by itself cause the resulting executable to be covered by
574+// the GNU General Public License. This exception does not however
575+// invalidate any other reasons why the executable file might be covered by
576+// the GNU General Public License.
577+
578+//
579+// ISO C++ 14882: 22.2.1.5 Template class codecvt
580+//
581+
582+// Warning: this file is not meant for user inclusion. Use <locale>.
583+
584+// Written by Benjamin Kosnik <bkoz@cygnus.com>
585+
586+ // XXX
587+ // Define this here to codecvt.cc can have _S_max_size definition.
588+#define _GLIBCPP_USE___ENC_TRAITS 1
589+
590+ // Extension to use icov for dealing with character encodings,
591+ // including conversions and comparisons between various character
592+ // sets. This object encapsulates data that may need to be shared between
593+ // char_traits, codecvt and ctype.
594+ class __enc_traits
595+ {
596+ public:
597+ // Types:
598+ // NB: A conversion descriptor subsumes and enhances the
599+ // functionality of a simple state type such as mbstate_t.
600+ typedef iconv_t __desc_type;
601+
602+ protected:
603+ // Data Members:
604+ // Max size of charset encoding name
605+ static const int _S_max_size = 32;
606+ // Name of internal character set encoding.
607+ char _M_int_enc[_S_max_size];
608+ // Name of external character set encoding.
609+ char _M_ext_enc[_S_max_size];
610+
611+ // Conversion descriptor between external encoding to internal encoding.
612+ __desc_type _M_in_desc;
613+ // Conversion descriptor between internal encoding to external encoding.
614+ __desc_type _M_out_desc;
615+
616+ // Details the byte-order marker for the external encoding, if necessary.
617+ int _M_ext_bom;
618+
619+ // Details the byte-order marker for the internal encoding, if necessary.
620+ int _M_int_bom;
621+
622+ public:
623+ explicit __enc_traits()
624+ : _M_in_desc(0), _M_out_desc(0), _M_ext_bom(0), _M_int_bom(0)
625+ {
626+ memset(_M_int_enc, 0, _S_max_size);
627+ memset(_M_ext_enc, 0, _S_max_size);
628+ }
629+
630+ explicit __enc_traits(const char* __int, const char* __ext,
631+ int __ibom = 0, int __ebom = 0)
632+ : _M_in_desc(0), _M_out_desc(0), _M_ext_bom(0), _M_int_bom(0)
633+ {
634+ strncpy(_M_int_enc, __int, _S_max_size);
635+ strncpy(_M_ext_enc, __ext, _S_max_size);
636+ }
637+
638+ // 21.1.2 traits typedefs
639+ // p4
640+ // typedef STATE_T state_type
641+ // requires: state_type shall meet the requirements of
642+ // CopyConstructible types (20.1.3)
643+ __enc_traits(const __enc_traits& __obj): _M_in_desc(0), _M_out_desc(0)
644+ {
645+ strncpy(_M_int_enc, __obj._M_int_enc, _S_max_size);
646+ strncpy(_M_ext_enc, __obj._M_ext_enc, _S_max_size);
647+ _M_ext_bom = __obj._M_ext_bom;
648+ _M_int_bom = __obj._M_int_bom;
649+ }
650+
651+ // Need assignment operator as well.
652+ __enc_traits&
653+ operator=(const __enc_traits& __obj)
654+ {
655+ strncpy(_M_int_enc, __obj._M_int_enc, _S_max_size);
656+ strncpy(_M_ext_enc, __obj._M_ext_enc, _S_max_size);
657+ _M_in_desc = 0;
658+ _M_out_desc = 0;
659+ _M_ext_bom = __obj._M_ext_bom;
660+ _M_int_bom = __obj._M_int_bom;
661+ return *this;
662+ }
663+
664+ ~__enc_traits()
665+ {
666+ __desc_type __err = reinterpret_cast<iconv_t>(-1);
667+ if (_M_in_desc && _M_in_desc != __err)
668+ iconv_close(_M_in_desc);
669+ if (_M_out_desc && _M_out_desc != __err)
670+ iconv_close(_M_out_desc);
671+ }
672+
673+ void
674+ _M_init()
675+ {
676+ const __desc_type __err = reinterpret_cast<iconv_t>(-1);
677+ if (!_M_in_desc)
678+ {
679+ _M_in_desc = iconv_open(_M_int_enc, _M_ext_enc);
680+ if (_M_in_desc == __err)
681+ __throw_runtime_error("creating iconv input descriptor failed.");
682+ }
683+ if (!_M_out_desc)
684+ {
685+ _M_out_desc = iconv_open(_M_ext_enc, _M_int_enc);
686+ if (_M_out_desc == __err)
687+ __throw_runtime_error("creating iconv output descriptor failed.");
688+ }
689+ }
690+
691+ bool
692+ _M_good()
693+ {
694+ const __desc_type __err = reinterpret_cast<iconv_t>(-1);
695+ bool __test = _M_in_desc && _M_in_desc != __err;
696+ __test &= _M_out_desc && _M_out_desc != __err;
697+ return __test;
698+ }
699+
700+ const __desc_type*
701+ _M_get_in_descriptor()
702+ { return &_M_in_desc; }
703+
704+ const __desc_type*
705+ _M_get_out_descriptor()
706+ { return &_M_out_desc; }
707+
708+ int
709+ _M_get_external_bom()
710+ { return _M_ext_bom; }
711+
712+ int
713+ _M_get_internal_bom()
714+ { return _M_int_bom; }
715+
716+ const char*
717+ _M_get_internal_enc()
718+ { return _M_int_enc; }
719+
720+ const char*
721+ _M_get_external_enc()
722+ { return _M_ext_enc; }
723+ };
724+
725+ // Partial specialization
726+ // This specialization takes advantage of iconv to provide code
727+ // conversions between a large number of character encodings.
728+ template<typename _InternT, typename _ExternT>
729+ class codecvt<_InternT, _ExternT, __enc_traits>
730+ : public __codecvt_abstract_base<_InternT, _ExternT, __enc_traits>
731+ {
732+ public:
733+ // Types:
734+ typedef codecvt_base::result result;
735+ typedef _InternT intern_type;
736+ typedef _ExternT extern_type;
737+ typedef __enc_traits state_type;
738+ typedef __enc_traits::__desc_type __desc_type;
739+ typedef __enc_traits __enc_type;
740+
741+ // Data Members:
742+ static locale::id id;
743+
744+ explicit
745+ codecvt(size_t __refs = 0)
746+ : __codecvt_abstract_base<intern_type, extern_type, state_type>(__refs)
747+ { }
748+
749+ explicit
750+ codecvt(__enc_type* __enc, size_t __refs = 0)
751+ : __codecvt_abstract_base<intern_type, extern_type, state_type>(__refs)
752+ { }
753+
754+ protected:
755+ virtual
756+ ~codecvt() { }
757+
758+ virtual result
759+ do_out(state_type& __state, const intern_type* __from,
760+ const intern_type* __from_end, const intern_type*& __from_next,
761+ extern_type* __to, extern_type* __to_end,
762+ extern_type*& __to_next) const;
763+
764+ virtual result
765+ do_unshift(state_type& __state, extern_type* __to,
766+ extern_type* __to_end, extern_type*& __to_next) const;
767+
768+ virtual result
769+ do_in(state_type& __state, const extern_type* __from,
770+ const extern_type* __from_end, const extern_type*& __from_next,
771+ intern_type* __to, intern_type* __to_end,
772+ intern_type*& __to_next) const;
773+
774+ virtual int
775+ do_encoding() const throw();
776+
777+ virtual bool
778+ do_always_noconv() const throw();
779+
780+ virtual int
781+ do_length(const state_type&, const extern_type* __from,
782+ const extern_type* __end, size_t __max) const;
783+
784+ virtual int
785+ do_max_length() const throw();
786+ };
787+
788+ template<typename _InternT, typename _ExternT>
789+ locale::id
790+ codecvt<_InternT, _ExternT, __enc_traits>::id;
791+
792+ // This adaptor works around the signature problems of the second
793+ // argument to iconv(): SUSv2 and others use 'const char**', but glibc 2.2
794+ // uses 'char**', which matches the POSIX 1003.1-2001 standard.
795+ // Using this adaptor, g++ will do the work for us.
796+ template<typename _T>
797+ inline size_t
798+ __iconv_adaptor(size_t(*__func)(iconv_t, _T, size_t*, char**, size_t*),
799+ iconv_t __cd, char** __inbuf, size_t* __inbytes,
800+ char** __outbuf, size_t* __outbytes)
801+ { return __func(__cd, (_T)__inbuf, __inbytes, __outbuf, __outbytes); }
802+
803+ template<typename _InternT, typename _ExternT>
804+ codecvt_base::result
805+ codecvt<_InternT, _ExternT, __enc_traits>::
806+ do_out(state_type& __state, const intern_type* __from,
807+ const intern_type* __from_end, const intern_type*& __from_next,
808+ extern_type* __to, extern_type* __to_end,
809+ extern_type*& __to_next) const
810+ {
811+ result __ret = codecvt_base::error;
812+ if (__state._M_good())
813+ {
814+ typedef state_type::__desc_type __desc_type;
815+ const __desc_type* __desc = __state._M_get_out_descriptor();
816+ const size_t __fmultiple = sizeof(intern_type);
817+ size_t __fbytes = __fmultiple * (__from_end - __from);
818+ const size_t __tmultiple = sizeof(extern_type);
819+ size_t __tbytes = __tmultiple * (__to_end - __to);
820+
821+ // Argument list for iconv specifies a byte sequence. Thus,
822+ // all to/from arrays must be brutally casted to char*.
823+ char* __cto = reinterpret_cast<char*>(__to);
824+ char* __cfrom;
825+ size_t __conv;
826+
827+ // Some encodings need a byte order marker as the first item
828+ // in the byte stream, to designate endian-ness. The default
829+ // value for the byte order marker is NULL, so if this is
830+ // the case, it's not necessary and we can just go on our
831+ // merry way.
832+ int __int_bom = __state._M_get_internal_bom();
833+ if (__int_bom)
834+ {
835+ size_t __size = __from_end - __from;
836+ intern_type* __cfixed = static_cast<intern_type*>(__builtin_alloca(sizeof(intern_type) * (__size + 1)));
837+ __cfixed[0] = static_cast<intern_type>(__int_bom);
838+ char_traits<intern_type>::copy(__cfixed + 1, __from, __size);
839+ __cfrom = reinterpret_cast<char*>(__cfixed);
840+ __conv = __iconv_adaptor(iconv, *__desc, &__cfrom,
841+ &__fbytes, &__cto, &__tbytes);
842+ }
843+ else
844+ {
845+ intern_type* __cfixed = const_cast<intern_type*>(__from);
846+ __cfrom = reinterpret_cast<char*>(__cfixed);
847+ __conv = __iconv_adaptor(iconv, *__desc, &__cfrom, &__fbytes,
848+ &__cto, &__tbytes);
849+ }
850+
851+ if (__conv != size_t(-1))
852+ {
853+ __from_next = reinterpret_cast<const intern_type*>(__cfrom);
854+ __to_next = reinterpret_cast<extern_type*>(__cto);
855+ __ret = codecvt_base::ok;
856+ }
857+ else
858+ {
859+ if (__fbytes < __fmultiple * (__from_end - __from))
860+ {
861+ __from_next = reinterpret_cast<const intern_type*>(__cfrom);
862+ __to_next = reinterpret_cast<extern_type*>(__cto);
863+ __ret = codecvt_base::partial;
864+ }
865+ else
866+ __ret = codecvt_base::error;
867+ }
868+ }
869+ return __ret;
870+ }
871+
872+ template<typename _InternT, typename _ExternT>
873+ codecvt_base::result
874+ codecvt<_InternT, _ExternT, __enc_traits>::
875+ do_unshift(state_type& __state, extern_type* __to,
876+ extern_type* __to_end, extern_type*& __to_next) const
877+ {
878+ result __ret = codecvt_base::error;
879+ if (__state._M_good())
880+ {
881+ typedef state_type::__desc_type __desc_type;
882+ const __desc_type* __desc = __state._M_get_in_descriptor();
883+ const size_t __tmultiple = sizeof(intern_type);
884+ size_t __tlen = __tmultiple * (__to_end - __to);
885+
886+ // Argument list for iconv specifies a byte sequence. Thus,
887+ // all to/from arrays must be brutally casted to char*.
888+ char* __cto = reinterpret_cast<char*>(__to);
889+ size_t __conv = __iconv_adaptor(iconv,*__desc, NULL, NULL,
890+ &__cto, &__tlen);
891+
892+ if (__conv != size_t(-1))
893+ {
894+ __to_next = reinterpret_cast<extern_type*>(__cto);
895+ if (__tlen == __tmultiple * (__to_end - __to))
896+ __ret = codecvt_base::noconv;
897+ else if (__tlen == 0)
898+ __ret = codecvt_base::ok;
899+ else
900+ __ret = codecvt_base::partial;
901+ }
902+ else
903+ __ret = codecvt_base::error;
904+ }
905+ return __ret;
906+ }
907+
908+ template<typename _InternT, typename _ExternT>
909+ codecvt_base::result
910+ codecvt<_InternT, _ExternT, __enc_traits>::
911+ do_in(state_type& __state, const extern_type* __from,
912+ const extern_type* __from_end, const extern_type*& __from_next,
913+ intern_type* __to, intern_type* __to_end,
914+ intern_type*& __to_next) const
915+ {
916+ result __ret = codecvt_base::error;
917+ if (__state._M_good())
918+ {
919+ typedef state_type::__desc_type __desc_type;
920+ const __desc_type* __desc = __state._M_get_in_descriptor();
921+ const size_t __fmultiple = sizeof(extern_type);
922+ size_t __flen = __fmultiple * (__from_end - __from);
923+ const size_t __tmultiple = sizeof(intern_type);
924+ size_t __tlen = __tmultiple * (__to_end - __to);
925+
926+ // Argument list for iconv specifies a byte sequence. Thus,
927+ // all to/from arrays must be brutally casted to char*.
928+ char* __cto = reinterpret_cast<char*>(__to);
929+ char* __cfrom;
930+ size_t __conv;
931+
932+ // Some encodings need a byte order marker as the first item
933+ // in the byte stream, to designate endian-ness. The default
934+ // value for the byte order marker is NULL, so if this is
935+ // the case, it's not necessary and we can just go on our
936+ // merry way.
937+ int __ext_bom = __state._M_get_external_bom();
938+ if (__ext_bom)
939+ {
940+ size_t __size = __from_end - __from;
941+ extern_type* __cfixed = static_cast<extern_type*>(__builtin_alloca(sizeof(extern_type) * (__size + 1)));
942+ __cfixed[0] = static_cast<extern_type>(__ext_bom);
943+ char_traits<extern_type>::copy(__cfixed + 1, __from, __size);
944+ __cfrom = reinterpret_cast<char*>(__cfixed);
945+ __conv = __iconv_adaptor(iconv, *__desc, &__cfrom,
946+ &__flen, &__cto, &__tlen);
947+ }
948+ else
949+ {
950+ extern_type* __cfixed = const_cast<extern_type*>(__from);
951+ __cfrom = reinterpret_cast<char*>(__cfixed);
952+ __conv = __iconv_adaptor(iconv, *__desc, &__cfrom,
953+ &__flen, &__cto, &__tlen);
954+ }
955+
956+
957+ if (__conv != size_t(-1))
958+ {
959+ __from_next = reinterpret_cast<const extern_type*>(__cfrom);
960+ __to_next = reinterpret_cast<intern_type*>(__cto);
961+ __ret = codecvt_base::ok;
962+ }
963+ else
964+ {
965+ if (__flen < static_cast<size_t>(__from_end - __from))
966+ {
967+ __from_next = reinterpret_cast<const extern_type*>(__cfrom);
968+ __to_next = reinterpret_cast<intern_type*>(__cto);
969+ __ret = codecvt_base::partial;
970+ }
971+ else
972+ __ret = codecvt_base::error;
973+ }
974+ }
975+ return __ret;
976+ }
977+
978+ template<typename _InternT, typename _ExternT>
979+ int
980+ codecvt<_InternT, _ExternT, __enc_traits>::
981+ do_encoding() const throw()
982+ {
983+ int __ret = 0;
984+ if (sizeof(_ExternT) <= sizeof(_InternT))
985+ __ret = sizeof(_InternT)/sizeof(_ExternT);
986+ return __ret;
987+ }
988+
989+ template<typename _InternT, typename _ExternT>
990+ bool
991+ codecvt<_InternT, _ExternT, __enc_traits>::
992+ do_always_noconv() const throw()
993+ { return false; }
994+
995+ template<typename _InternT, typename _ExternT>
996+ int
997+ codecvt<_InternT, _ExternT, __enc_traits>::
998+ do_length(const state_type&, const extern_type* __from,
999+ const extern_type* __end, size_t __max) const
1000+ { return min(__max, static_cast<size_t>(__end - __from)); }
1001+
1002+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
1003+// 74. Garbled text for codecvt::do_max_length
1004+ template<typename _InternT, typename _ExternT>
1005+ int
1006+ codecvt<_InternT, _ExternT, __enc_traits>::
1007+ do_max_length() const throw()
1008+ { return 1; }
1009+#endif
1010diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/collate_members.cc
1011--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/collate_members.cc 1969-12-31 18:00:00.000000000 -0600
1012+++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/collate_members.cc 2004-01-09 08:06:24.000000000 -0600
1013@@ -0,0 +1,80 @@
1014+// std::collate implementation details, GNU version -*- C++ -*-
1015+
1016+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1017+//
1018+// This file is part of the GNU ISO C++ Library. This library is free
1019+// software; you can redistribute it and/or modify it under the
1020+// terms of the GNU General Public License as published by the
1021+// Free Software Foundation; either version 2, or (at your option)
1022+// any later version.
1023+
1024+// This library is distributed in the hope that it will be useful,
1025+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1026+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1027+// GNU General Public License for more details.
1028+
1029+// You should have received a copy of the GNU General Public License along
1030+// with this library; see the file COPYING. If not, write to the Free
1031+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1032+// USA.
1033+
1034+// As a special exception, you may use this file as part of a free software
1035+// library without restriction. Specifically, if other files instantiate
1036+// templates or use macros or inline functions from this file, or you compile
1037+// this file and link it with other files to produce an executable, this
1038+// file does not by itself cause the resulting executable to be covered by
1039+// the GNU General Public License. This exception does not however
1040+// invalidate any other reasons why the executable file might be covered by
1041+// the GNU General Public License.
1042+
1043+//
1044+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
1045+//
1046+
1047+// Written by Benjamin Kosnik <bkoz@redhat.com>
1048+
1049+#include <locale>
1050+#include <bits/c++locale_internal.h>
1051+
1052+#ifndef __UCLIBC_HAS_XLOCALE__
1053+#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
1054+#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
1055+#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
1056+#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
1057+#endif
1058+
1059+namespace std
1060+{
1061+ // These are basically extensions to char_traits, and perhaps should
1062+ // be put there instead of here.
1063+ template<>
1064+ int
1065+ collate<char>::_M_compare(const char* __one, const char* __two) const
1066+ {
1067+ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
1068+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
1069+ }
1070+
1071+ template<>
1072+ size_t
1073+ collate<char>::_M_transform(char* __to, const char* __from,
1074+ size_t __n) const
1075+ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
1076+
1077+#ifdef _GLIBCPP_USE_WCHAR_T
1078+ template<>
1079+ int
1080+ collate<wchar_t>::_M_compare(const wchar_t* __one,
1081+ const wchar_t* __two) const
1082+ {
1083+ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
1084+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
1085+ }
1086+
1087+ template<>
1088+ size_t
1089+ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
1090+ size_t __n) const
1091+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
1092+#endif
1093+}
1094diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/ctype_members.cc
1095--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1969-12-31 18:00:00.000000000 -0600
1096+++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2004-01-09 08:15:41.000000000 -0600
1097@@ -0,0 +1,274 @@
1098+// std::ctype implementation details, GNU version -*- C++ -*-
1099+
1100+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
1101+//
1102+// This file is part of the GNU ISO C++ Library. This library is free
1103+// software; you can redistribute it and/or modify it under the
1104+// terms of the GNU General Public License as published by the
1105+// Free Software Foundation; either version 2, or (at your option)
1106+// any later version.
1107+
1108+// This library is distributed in the hope that it will be useful,
1109+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1110+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1111+// GNU General Public License for more details.
1112+
1113+// You should have received a copy of the GNU General Public License along
1114+// with this library; see the file COPYING. If not, write to the Free
1115+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1116+// USA.
1117+
1118+// As a special exception, you may use this file as part of a free software
1119+// library without restriction. Specifically, if other files instantiate
1120+// templates or use macros or inline functions from this file, or you compile
1121+// this file and link it with other files to produce an executable, this
1122+// file does not by itself cause the resulting executable to be covered by
1123+// the GNU General Public License. This exception does not however
1124+// invalidate any other reasons why the executable file might be covered by
1125+// the GNU General Public License.
1126+
1127+//
1128+// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
1129+//
1130+
1131+// Written by Benjamin Kosnik <bkoz@redhat.com>
1132+
1133+#define _LIBC
1134+#include <locale>
1135+#undef _LIBC
1136+#include <bits/c++locale_internal.h>
1137+
1138+#ifndef __UCLIBC_HAS_XLOCALE__
1139+#define __wctype_l(S, L) wctype((S))
1140+#define __towupper_l(C, L) towupper((C))
1141+#define __towlower_l(C, L) towlower((C))
1142+#define __iswctype_l(C, M, L) iswctype((C), (M))
1143+#endif
1144+
1145+namespace std
1146+{
1147+ // NB: The other ctype<char> specializations are in src/locale.cc and
1148+ // various /config/os/* files.
1149+ template<>
1150+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
1151+ : ctype<char>(0, false, __refs)
1152+ {
1153+ _S_destroy_c_locale(_M_c_locale_ctype);
1154+ _S_create_c_locale(_M_c_locale_ctype, __s);
1155+#ifdef __UCLIBC_HAS_XLOCALE__
1156+ _M_toupper = _M_c_locale_ctype->__ctype_toupper;
1157+ _M_tolower = _M_c_locale_ctype->__ctype_tolower;
1158+ _M_table = _M_c_locale_ctype->__ctype_b;
1159+#endif
1160+ }
1161+
1162+#ifdef _GLIBCPP_USE_WCHAR_T
1163+ ctype<wchar_t>::__wmask_type
1164+ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
1165+ {
1166+ __wmask_type __ret;
1167+ switch (__m)
1168+ {
1169+ case space:
1170+ __ret = __wctype_l("space", _M_c_locale_ctype);
1171+ break;
1172+ case print:
1173+ __ret = __wctype_l("print", _M_c_locale_ctype);
1174+ break;
1175+ case cntrl:
1176+ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
1177+ break;
1178+ case upper:
1179+ __ret = __wctype_l("upper", _M_c_locale_ctype);
1180+ break;
1181+ case lower:
1182+ __ret = __wctype_l("lower", _M_c_locale_ctype);
1183+ break;
1184+ case alpha:
1185+ __ret = __wctype_l("alpha", _M_c_locale_ctype);
1186+ break;
1187+ case digit:
1188+ __ret = __wctype_l("digit", _M_c_locale_ctype);
1189+ break;
1190+ case punct:
1191+ __ret = __wctype_l("punct", _M_c_locale_ctype);
1192+ break;
1193+ case xdigit:
1194+ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
1195+ break;
1196+ case alnum:
1197+ __ret = __wctype_l("alnum", _M_c_locale_ctype);
1198+ break;
1199+ case graph:
1200+ __ret = __wctype_l("graph", _M_c_locale_ctype);
1201+ break;
1202+ default:
1203+ __ret = 0;
1204+ }
1205+ return __ret;
1206+ };
1207+
1208+ wchar_t
1209+ ctype<wchar_t>::do_toupper(wchar_t __c) const
1210+ { return __towupper_l(__c, _M_c_locale_ctype); }
1211+
1212+ const wchar_t*
1213+ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
1214+ {
1215+ while (__lo < __hi)
1216+ {
1217+ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
1218+ ++__lo;
1219+ }
1220+ return __hi;
1221+ }
1222+
1223+ wchar_t
1224+ ctype<wchar_t>::do_tolower(wchar_t __c) const
1225+ { return __towlower_l(__c, _M_c_locale_ctype); }
1226+
1227+ const wchar_t*
1228+ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
1229+ {
1230+ while (__lo < __hi)
1231+ {
1232+ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
1233+ ++__lo;
1234+ }
1235+ return __hi;
1236+ }
1237+
1238+ bool
1239+ ctype<wchar_t>::
1240+ do_is(mask __m, wchar_t __c) const
1241+ {
1242+ // Highest bitmask in ctype_base == 10, but extra in "C"
1243+ // library for blank.
1244+ bool __ret = false;
1245+ const size_t __bitmasksize = 11;
1246+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
1247+ {
1248+ const mask __bit = static_cast<mask>(_ISbit(__bitcur));
1249+ if (__m & __bit)
1250+ __ret |= __iswctype_l(__c, _M_convert_to_wmask(__bit),
1251+ _M_c_locale_ctype);
1252+ }
1253+ return __ret;
1254+ }
1255+
1256+ const wchar_t*
1257+ ctype<wchar_t>::
1258+ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
1259+ {
1260+ for (;__lo < __hi; ++__vec, ++__lo)
1261+ {
1262+ // Highest bitmask in ctype_base == 10, but extra in "C"
1263+ // library for blank.
1264+ const size_t __bitmasksize = 11;
1265+ mask __m = 0;
1266+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
1267+ {
1268+ const mask __bit = static_cast<mask>(_ISbit(__bitcur));
1269+ if (__iswctype_l(*__lo, _M_convert_to_wmask(__bit),
1270+ _M_c_locale_ctype))
1271+ __m |= __bit;
1272+ }
1273+ *__vec = __m;
1274+ }
1275+ return __hi;
1276+ }
1277+
1278+ const wchar_t*
1279+ ctype<wchar_t>::
1280+ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
1281+ {
1282+ while (__lo < __hi && !this->do_is(__m, *__lo))
1283+ ++__lo;
1284+ return __lo;
1285+ }
1286+
1287+ const wchar_t*
1288+ ctype<wchar_t>::
1289+ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
1290+ {
1291+ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
1292+ ++__lo;
1293+ return __lo;
1294+ }
1295+
1296+ wchar_t
1297+ ctype<wchar_t>::
1298+ do_widen(char __c) const
1299+ {
1300+#ifdef __UCLIBC_HAS_XLOCALE__
1301+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1302+#endif
1303+ wchar_t __ret = btowc(__c);
1304+#ifdef __UCLIBC_HAS_XLOCALE__
1305+ __uselocale(__old);
1306+#endif
1307+ return __ret;
1308+ }
1309+
1310+ const char*
1311+ ctype<wchar_t>::
1312+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
1313+ {
1314+#ifdef __UCLIBC_HAS_XLOCALE__
1315+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1316+#endif
1317+ mbstate_t __state;
1318+ memset(static_cast<void*>(&__state), 0, sizeof(mbstate_t));
1319+ mbsrtowcs(__dest, &__lo, __hi - __lo, &__state);
1320+#ifdef __UCLIBC_HAS_XLOCALE__
1321+ __uselocale(__old);
1322+#endif
1323+ return __hi;
1324+ }
1325+
1326+ char
1327+ ctype<wchar_t>::
1328+ do_narrow(wchar_t __wc, char __dfault) const
1329+ {
1330+#ifdef __UCLIBC_HAS_XLOCALE__
1331+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1332+#endif
1333+ int __c = wctob(__wc);
1334+#ifdef __UCLIBC_HAS_XLOCALE__
1335+ __uselocale(__old);
1336+#endif
1337+ return (__c == EOF ? __dfault : static_cast<char>(__c));
1338+ }
1339+
1340+ const wchar_t*
1341+ ctype<wchar_t>::
1342+ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
1343+ char* __dest) const
1344+ {
1345+#ifdef __UCLIBC_HAS_XLOCALE__
1346+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1347+#endif
1348+ size_t __offset = 0;
1349+ while (true)
1350+ {
1351+ const wchar_t* __start = __lo + __offset;
1352+ size_t __len = __hi - __start;
1353+
1354+ mbstate_t __state;
1355+ memset(static_cast<void*>(&__state), 0, sizeof(mbstate_t));
1356+ size_t __con = wcsrtombs(__dest + __offset, &__start, __len, &__state);
1357+ if (__con != __len && __start != 0)
1358+ {
1359+ __offset = __start - __lo;
1360+ __dest[__offset++] = __dfault;
1361+ }
1362+ else
1363+ break;
1364+ }
1365+#ifdef __UCLIBC_HAS_XLOCALE__
1366+ __uselocale(__old);
1367+#endif
1368+ return __hi;
1369+ }
1370+#endif // _GLIBCPP_USE_WCHAR_T
1371+}
1372diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/messages_members.cc
1373--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/messages_members.cc 1969-12-31 18:00:00.000000000 -0600
1374+++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/messages_members.cc 2004-01-09 08:46:16.000000000 -0600
1375@@ -0,0 +1,100 @@
1376+// std::messages implementation details, GNU version -*- C++ -*-
1377+
1378+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1379+//
1380+// This file is part of the GNU ISO C++ Library. This library is free
1381+// software; you can redistribute it and/or modify it under the
1382+// terms of the GNU General Public License as published by the
1383+// Free Software Foundation; either version 2, or (at your option)
1384+// any later version.
1385+
1386+// This library is distributed in the hope that it will be useful,
1387+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1388+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1389+// GNU General Public License for more details.
1390+
1391+// You should have received a copy of the GNU General Public License along
1392+// with this library; see the file COPYING. If not, write to the Free
1393+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1394+// USA.
1395+
1396+// As a special exception, you may use this file as part of a free software
1397+// library without restriction. Specifically, if other files instantiate
1398+// templates or use macros or inline functions from this file, or you compile
1399+// this file and link it with other files to produce an executable, this
1400+// file does not by itself cause the resulting executable to be covered by
1401+// the GNU General Public License. This exception does not however
1402+// invalidate any other reasons why the executable file might be covered by
1403+// the GNU General Public License.
1404+
1405+//
1406+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
1407+//
1408+
1409+// Written by Benjamin Kosnik <bkoz@redhat.com>
1410+
1411+#include <locale>
1412+#include <bits/c++locale_internal.h>
1413+
1414+#ifdef __UCLIBC_MJN3_ONLY__
1415+#warning fix gettext stuff
1416+#endif
1417+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1418+extern "C" char *__dcgettext(const char *domainname,
1419+ const char *msgid, int category);
1420+#undef gettext
1421+#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
1422+#else
1423+#undef gettext
1424+#define gettext(msgid) (msgid)
1425+#endif
1426+
1427+namespace std
1428+{
1429+ // Specializations.
1430+ template<>
1431+ string
1432+ messages<char>::do_get(catalog, int, int, const string& __dfault) const
1433+ {
1434+#ifdef __UCLIBC_HAS_XLOCALE__
1435+ __c_locale __old = __uselocale(_M_c_locale_messages);
1436+ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
1437+ __uselocale(__old);
1438+ return string(__msg);
1439+#elif defined __UCLIBC_HAS_LOCALE__
1440+ char* __old = strdup(setlocale(LC_ALL, NULL));
1441+ setlocale(LC_ALL, _M_name_messages);
1442+ const char* __msg = gettext(__dfault.c_str());
1443+ setlocale(LC_ALL, __old);
1444+ free(__old);
1445+ return string(__msg);
1446+#else
1447+ const char* __msg = gettext(__dfault.c_str());
1448+ return string(__msg);
1449+#endif
1450+ }
1451+
1452+#ifdef _GLIBCPP_USE_WCHAR_T
1453+ template<>
1454+ wstring
1455+ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
1456+ {
1457+#ifdef __UCLIBC_HAS_XLOCALE__
1458+ __c_locale __old = __uselocale(_M_c_locale_messages);
1459+ char* __msg = gettext(_M_convert_to_char(__dfault));
1460+ __uselocale(__old);
1461+ return _M_convert_from_char(__msg);
1462+#elif defined __UCLIBC_HAS_LOCALE__
1463+ char* __old = strdup(setlocale(LC_ALL, NULL));
1464+ setlocale(LC_ALL, _M_name_messages);
1465+ char* __msg = gettext(_M_convert_to_char(__dfault));
1466+ setlocale(LC_ALL, __old);
1467+ free(__old);
1468+ return _M_convert_from_char(__msg);
1469+# else
1470+ char* __msg = gettext(_M_convert_to_char(__dfault));
1471+ return _M_convert_from_char(__msg);
1472+# endif
1473+ }
1474+#endif
1475+}
1476diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/messages_members.h
1477--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/messages_members.h 1969-12-31 18:00:00.000000000 -0600
1478+++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/messages_members.h 2004-01-09 08:52:48.000000000 -0600
1479@@ -0,0 +1,122 @@
1480+// std::messages implementation details, GNU version -*- C++ -*-
1481+
1482+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
1483+//
1484+// This file is part of the GNU ISO C++ Library. This library is free
1485+// software; you can redistribute it and/or modify it under the
1486+// terms of the GNU General Public License as published by the
1487+// Free Software Foundation; either version 2, or (at your option)
1488+// any later version.
1489+
1490+// This library is distributed in the hope that it will be useful,
1491+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1492+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1493+// GNU General Public License for more details.
1494+
1495+// You should have received a copy of the GNU General Public License along
1496+// with this library; see the file COPYING. If not, write to the Free
1497+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1498+// USA.
1499+
1500+// As a special exception, you may use this file as part of a free software
1501+// library without restriction. Specifically, if other files instantiate
1502+// templates or use macros or inline functions from this file, or you compile
1503+// this file and link it with other files to produce an executable, this
1504+// file does not by itself cause the resulting executable to be covered by
1505+// the GNU General Public License. This exception does not however
1506+// invalidate any other reasons why the executable file might be covered by
1507+// the GNU General Public License.
1508+
1509+//
1510+// ISO C++ 14882: 22.2.7.1.2 messages functions
1511+//
1512+
1513+// Written by Benjamin Kosnik <bkoz@redhat.com>
1514+
1515+#ifdef __UCLIBC_MJN3_ONLY__
1516+#warning fix prototypes for *textdomain funcs
1517+#endif
1518+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1519+extern "C" char *__textdomain(const char *domainname);
1520+extern "C" char *__bindtextdomain(const char *domainname,
1521+ const char *dirname);
1522+#else
1523+#undef __textdomain
1524+#undef __bindtextdomain
1525+#define __textdomain(D) ((void)0)
1526+#define __bindtextdomain(D,P) ((void)0)
1527+#endif
1528+
1529+ // Non-virtual member functions.
1530+ template<typename _CharT>
1531+ messages<_CharT>::messages(size_t __refs)
1532+ : locale::facet(__refs)
1533+ {
1534+#ifndef __UCLIBC_HAS_XLOCALE__
1535+ _M_name_messages = _S_c_name;
1536+#endif
1537+ _M_c_locale_messages = _S_c_locale;
1538+ }
1539+
1540+ template<typename _CharT>
1541+ messages<_CharT>::messages(__c_locale __cloc,
1542+ const char* __s, size_t __refs)
1543+ : locale::facet(__refs)
1544+ {
1545+#ifndef __UCLIBC_HAS_XLOCALE__
1546+ _M_name_messages = new char[strlen(__s) + 1];
1547+ strcpy(_M_name_messages, __s);
1548+#endif
1549+ _M_c_locale_messages = _S_clone_c_locale(__cloc);
1550+ }
1551+
1552+ template<typename _CharT>
1553+ typename messages<_CharT>::catalog
1554+ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
1555+ const char* __dir) const
1556+ {
1557+ __bindtextdomain(__s.c_str(), __dir);
1558+ return this->do_open(__s, __loc);
1559+ }
1560+
1561+ // Virtual member functions.
1562+ template<typename _CharT>
1563+ messages<_CharT>::~messages()
1564+ {
1565+#ifndef __UCLIBC_HAS_XLOCALE__
1566+ if (_S_c_name != _M_name_messages)
1567+ delete [] _M_name_messages;
1568+#endif
1569+ _S_destroy_c_locale(_M_c_locale_messages);
1570+ }
1571+
1572+ template<typename _CharT>
1573+ typename messages<_CharT>::catalog
1574+ messages<_CharT>::do_open(const basic_string<char>& __s,
1575+ const locale&) const
1576+ {
1577+ // No error checking is done, assume the catalog exists and can
1578+ // be used.
1579+ __textdomain(__s.c_str());
1580+ return 0;
1581+ }
1582+
1583+ template<typename _CharT>
1584+ void
1585+ messages<_CharT>::do_close(catalog) const
1586+ { }
1587+
1588+ // messages_byname
1589+ template<typename _CharT>
1590+ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
1591+ : messages<_CharT>(__refs)
1592+ {
1593+#ifndef __UCLIBC_HAS_XLOCALE__
1594+ if (_S_c_name != _M_name_messages)
1595+ delete [] _M_name_messages;
1596+ _M_name_messages = new char[strlen(__s) + 1];
1597+ strcpy(_M_name_messages, __s);
1598+#endif
1599+ _S_destroy_c_locale(_M_c_locale_messages);
1600+ _S_create_c_locale(_M_c_locale_messages, __s);
1601+ }
1602diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1603--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1969-12-31 18:00:00.000000000 -0600
1604+++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2004-01-09 18:20:23.000000000 -0600
1605@@ -0,0 +1,578 @@
1606+// std::moneypunct implementation details, GNU version -*- C++ -*-
1607+
1608+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1609+//
1610+// This file is part of the GNU ISO C++ Library. This library is free
1611+// software; you can redistribute it and/or modify it under the
1612+// terms of the GNU General Public License as published by the
1613+// Free Software Foundation; either version 2, or (at your option)
1614+// any later version.
1615+
1616+// This library is distributed in the hope that it will be useful,
1617+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1618+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1619+// GNU General Public License for more details.
1620+
1621+// You should have received a copy of the GNU General Public License along
1622+// with this library; see the file COPYING. If not, write to the Free
1623+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1624+// USA.
1625+
1626+// As a special exception, you may use this file as part of a free software
1627+// library without restriction. Specifically, if other files instantiate
1628+// templates or use macros or inline functions from this file, or you compile
1629+// this file and link it with other files to produce an executable, this
1630+// file does not by itself cause the resulting executable to be covered by
1631+// the GNU General Public License. This exception does not however
1632+// invalidate any other reasons why the executable file might be covered by
1633+// the GNU General Public License.
1634+
1635+//
1636+// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
1637+//
1638+
1639+// Written by Benjamin Kosnik <bkoz@redhat.com>
1640+
1641+#define _LIBC
1642+#include <locale>
1643+#undef _LIBC
1644+#include <bits/c++locale_internal.h>
1645+
1646+#ifdef __UCLIBC_MJN3_ONLY__
1647+#warning optimize this for uclibc
1648+#warning tailor for stub locale support
1649+#endif
1650+
1651+#ifndef __UCLIBC_HAS_XLOCALE__
1652+#define __nl_langinfo_l(N, L) nl_langinfo((N))
1653+#endif
1654+
1655+namespace std
1656+{
1657+ // Construct and return valid pattern consisting of some combination of:
1658+ // space none symbol sign value
1659+ money_base::pattern
1660+ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
1661+ {
1662+ pattern __ret;
1663+
1664+ // This insanely complicated routine attempts to construct a valid
1665+ // pattern for use with monyepunct. A couple of invariants:
1666+
1667+ // if (__precedes) symbol -> value
1668+ // else value -> symbol
1669+
1670+ // if (__space) space
1671+ // else none
1672+
1673+ // none == never first
1674+ // space never first or last
1675+
1676+ // Any elegant implementations of this are welcome.
1677+ switch (__posn)
1678+ {
1679+ case 0:
1680+ case 1:
1681+ // 1 The sign precedes the value and symbol.
1682+ if (__space)
1683+ {
1684+ // Pattern starts with sign.
1685+ if (__precedes)
1686+ {
1687+ __ret.field[1] = symbol;
1688+ __ret.field[2] = space;
1689+ __ret.field[3] = value;
1690+ }
1691+ else
1692+ {
1693+ __ret.field[1] = value;
1694+ __ret.field[2] = space;
1695+ __ret.field[3] = symbol;
1696+ }
1697+ __ret.field[0] = sign;
1698+ }
1699+ else
1700+ {
1701+ // Pattern starts with sign and ends with none.
1702+ if (__precedes)
1703+ {
1704+ __ret.field[1] = symbol;
1705+ __ret.field[2] = value;
1706+ }
1707+ else
1708+ {
1709+ __ret.field[1] = value;
1710+ __ret.field[2] = symbol;
1711+ }
1712+ __ret.field[0] = sign;
1713+ __ret.field[3] = none;
1714+ }
1715+ break;
1716+ case 2:
1717+ // 2 The sign follows the value and symbol.
1718+ if (__space)
1719+ {
1720+ // Pattern either ends with sign.
1721+ if (__precedes)
1722+ {
1723+ __ret.field[0] = symbol;
1724+ __ret.field[1] = space;
1725+ __ret.field[2] = value;
1726+ }
1727+ else
1728+ {
1729+ __ret.field[0] = value;
1730+ __ret.field[1] = space;
1731+ __ret.field[2] = symbol;
1732+ }
1733+ __ret.field[3] = sign;
1734+ }
1735+ else
1736+ {
1737+ // Pattern ends with sign then none.
1738+ if (__precedes)
1739+ {
1740+ __ret.field[0] = symbol;
1741+ __ret.field[1] = value;
1742+ }
1743+ else
1744+ {
1745+ __ret.field[0] = value;
1746+ __ret.field[1] = symbol;
1747+ }
1748+ __ret.field[2] = sign;
1749+ __ret.field[3] = none;
1750+ }
1751+ break;
1752+ case 3:
1753+ // 3 The sign immediately precedes the symbol.
1754+ if (__space)
1755+ {
1756+ // Have space.
1757+ if (__precedes)
1758+ {
1759+ __ret.field[0] = sign;
1760+ __ret.field[1] = symbol;
1761+ __ret.field[2] = space;
1762+ __ret.field[3] = value;
1763+ }
1764+ else
1765+ {
1766+ __ret.field[0] = value;
1767+ __ret.field[1] = space;
1768+ __ret.field[2] = sign;
1769+ __ret.field[3] = symbol;
1770+ }
1771+ }
1772+ else
1773+ {
1774+ // Have none.
1775+ if (__precedes)
1776+ {
1777+ __ret.field[0] = sign;
1778+ __ret.field[1] = symbol;
1779+ __ret.field[2] = value;
1780+ }
1781+ else
1782+ {
1783+ __ret.field[0] = value;
1784+ __ret.field[1] = sign;
1785+ __ret.field[2] = symbol;
1786+ }
1787+ __ret.field[3] = none;
1788+ }
1789+ break;
1790+ case 4:
1791+ // 4 The sign immediately follows the symbol.
1792+ if (__space)
1793+ {
1794+ // Have space.
1795+ if (__precedes)
1796+ {
1797+ __ret.field[0] = symbol;
1798+ __ret.field[1] = sign;
1799+ __ret.field[2] = space;
1800+ __ret.field[3] = value;
1801+ }
1802+ else
1803+ {
1804+ __ret.field[0] = value;
1805+ __ret.field[1] = space;
1806+ __ret.field[2] = symbol;
1807+ __ret.field[3] = sign;
1808+ }
1809+ }
1810+ else
1811+ {
1812+ // Have none.
1813+ if (__precedes)
1814+ {
1815+ __ret.field[0] = symbol;
1816+ __ret.field[1] = sign;
1817+ __ret.field[2] = value;
1818+ }
1819+ else
1820+ {
1821+ __ret.field[0] = value;
1822+ __ret.field[1] = symbol;
1823+ __ret.field[2] = sign;
1824+ }
1825+ __ret.field[3] = none;
1826+ }
1827+ break;
1828+ default:
1829+ ;
1830+ }
1831+ return __ret;
1832+ }
1833+
1834+ template<>
1835+ void
1836+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
1837+ const char*)
1838+ {
1839+ if (!__cloc)
1840+ {
1841+ // "C" locale
1842+ _M_decimal_point = '.';
1843+ _M_thousands_sep = ',';
1844+ _M_grouping = "";
1845+ _M_curr_symbol = "";
1846+ _M_positive_sign = "";
1847+ _M_negative_sign = "";
1848+ _M_frac_digits = 0;
1849+ _M_pos_format = money_base::_S_default_pattern;
1850+ _M_neg_format = money_base::_S_default_pattern;
1851+ }
1852+ else
1853+ {
1854+ // Named locale.
1855+ _M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, __cloc));
1856+ _M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, __cloc));
1857+ _M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1858+ _M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1859+
1860+ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1861+ if (!__nposn)
1862+ _M_negative_sign = "()";
1863+ else
1864+ _M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1865+
1866+ // _Intl == true
1867+ _M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1868+ _M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, __cloc));
1869+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1870+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1871+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1872+ _M_pos_format = _S_construct_pattern(__pprecedes, __pspace, __pposn);
1873+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1874+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1875+ _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn);
1876+ }
1877+ }
1878+
1879+ template<>
1880+ void
1881+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
1882+ const char*)
1883+ {
1884+ if (!__cloc)
1885+ {
1886+ // "C" locale
1887+ _M_decimal_point = '.';
1888+ _M_thousands_sep = ',';
1889+ _M_grouping = "";
1890+ _M_curr_symbol = "";
1891+ _M_positive_sign = "";
1892+ _M_negative_sign = "";
1893+ _M_frac_digits = 0;
1894+ _M_pos_format = money_base::_S_default_pattern;
1895+ _M_neg_format = money_base::_S_default_pattern;
1896+ }
1897+ else
1898+ {
1899+ // Named locale.
1900+ _M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, __cloc));
1901+ _M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, __cloc));
1902+ _M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1903+ _M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1904+
1905+ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1906+ if (!__nposn)
1907+ _M_negative_sign = "()";
1908+ else
1909+ _M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1910+
1911+ // _Intl == false
1912+ _M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1913+ _M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1914+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1915+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1916+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1917+ _M_pos_format = _S_construct_pattern(__pprecedes, __pspace, __pposn);
1918+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1919+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1920+ _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn);
1921+ }
1922+ }
1923+
1924+ template<>
1925+ moneypunct<char, true>::~moneypunct()
1926+ { }
1927+
1928+ template<>
1929+ moneypunct<char, false>::~moneypunct()
1930+ { }
1931+
1932+#ifdef _GLIBCPP_USE_WCHAR_T
1933+ template<>
1934+ void
1935+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
1936+#ifdef __UCLIBC_HAS_XLOCALE__
1937+ const char*)
1938+#else
1939+ const char* __name)
1940+#endif
1941+ {
1942+ if (!__cloc)
1943+ {
1944+ // "C" locale
1945+ _M_decimal_point = L'.';
1946+ _M_thousands_sep = L',';
1947+ _M_grouping = "";
1948+ _M_curr_symbol = L"";
1949+ _M_positive_sign = L"";
1950+ _M_negative_sign = L"";
1951+ _M_frac_digits = 0;
1952+ _M_pos_format = money_base::_S_default_pattern;
1953+ _M_neg_format = money_base::_S_default_pattern;
1954+ }
1955+ else
1956+ {
1957+ // Named locale.
1958+#ifdef __UCLIBC_HAS_XLOCALE__
1959+ __c_locale __old = __uselocale(__cloc);
1960+#else
1961+ // Switch to named locale so that mbsrtowcs will work.
1962+ char* __old = strdup(setlocale(LC_ALL, NULL));
1963+ setlocale(LC_ALL, __name);
1964+#endif
1965+
1966+#ifdef __UCLIBC_MJN3_ONLY__
1967+#warning fix this
1968+#endif
1969+#ifdef __UCLIBC__
1970+# ifdef __UCLIBC_HAS_XLOCALE__
1971+ _M_decimal_point = __cloc->decimal_point_wc;
1972+ _M_thousands_sep = __cloc->thousands_sep_wc;
1973+# else
1974+ _M_decimal_point = __global_locale->decimal_point_wc;
1975+ _M_thousands_sep = __global_locale->thousands_sep_wc;
1976+# endif
1977+#else
1978+ _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w);
1979+
1980+ _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w);
1981+#endif
1982+ _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
1983+
1984+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1985+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1986+ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1987+
1988+ mbstate_t __state;
1989+ size_t __len = strlen(__cpossign);
1990+ if (__len)
1991+ {
1992+ ++__len;
1993+ memset(&__state, 0, sizeof(mbstate_t));
1994+ wchar_t* __wcs = new wchar_t[__len];
1995+ mbsrtowcs(__wcs, &__cpossign, __len, &__state);
1996+ _M_positive_sign = __wcs;
1997+ }
1998+ else
1999+ _M_positive_sign = L"";
2000+
2001+ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
2002+ __len = strlen(__cnegsign);
2003+ if (!__nposn)
2004+ _M_negative_sign = L"()";
2005+ else if (__len)
2006+ {
2007+ ++__len;
2008+ memset(&__state, 0, sizeof(mbstate_t));
2009+ wchar_t* __wcs = new wchar_t[__len];
2010+ mbsrtowcs(__wcs, &__cnegsign, __len, &__state);
2011+ _M_negative_sign = __wcs;
2012+ }
2013+ else
2014+ _M_negative_sign = L"";
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_curr_symbol = __wcs;
2025+ }
2026+ else
2027+ _M_curr_symbol = L"";
2028+
2029+ _M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, __cloc));
2030+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
2031+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
2032+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
2033+ _M_pos_format = _S_construct_pattern(__pprecedes, __pspace, __pposn);
2034+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
2035+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
2036+ _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn);
2037+
2038+#ifdef __UCLIBC_HAS_XLOCALE__
2039+ __uselocale(__old);
2040+#else
2041+ setlocale(LC_ALL, __old);
2042+ free(__old);
2043+#endif
2044+ }
2045+ }
2046+
2047+ template<>
2048+ void
2049+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
2050+#ifdef __UCLIBC_HAS_XLOCALE__
2051+ const char*)
2052+#else
2053+ const char* __name)
2054+#endif
2055+ {
2056+ if (!__cloc)
2057+ {
2058+ // "C" locale
2059+ _M_decimal_point = L'.';
2060+ _M_thousands_sep = L',';
2061+ _M_grouping = "";
2062+ _M_curr_symbol = L"";
2063+ _M_positive_sign = L"";
2064+ _M_negative_sign = L"";
2065+ _M_frac_digits = 0;
2066+ _M_pos_format = money_base::_S_default_pattern;
2067+ _M_neg_format = money_base::_S_default_pattern;
2068+ }
2069+ else
2070+ {
2071+ // Named locale.
2072+#ifdef __UCLIBC_HAS_XLOCALE__
2073+ __c_locale __old = __uselocale(__cloc);
2074+#else
2075+ // Switch to named locale so that mbsrtowcs will work.
2076+ char* __old = strdup(setlocale(LC_ALL, NULL));
2077+ setlocale(LC_ALL, __name);
2078+#endif
2079+
2080+#ifdef __UCLIBC_MJN3_ONLY__
2081+#warning fix this
2082+#endif
2083+#ifdef __UCLIBC__
2084+# ifdef __UCLIBC_HAS_XLOCALE__
2085+ _M_decimal_point = __cloc->decimal_point_wc;
2086+ _M_thousands_sep = __cloc->thousands_sep_wc;
2087+# else
2088+ _M_decimal_point = __global_locale->decimal_point_wc;
2089+ _M_thousands_sep = __global_locale->thousands_sep_wc;
2090+# endif
2091+#else
2092+ _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w);
2093+ _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w);
2094+#endif
2095+ _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2096+
2097+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
2098+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
2099+ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
2100+
2101+ mbstate_t __state;
2102+ size_t __len;
2103+ __len = strlen(__cpossign);
2104+ if (__len)
2105+ {
2106+ ++__len;
2107+ memset(&__state, 0, sizeof(mbstate_t));
2108+ wchar_t* __wcs = new wchar_t[__len];
2109+ mbsrtowcs(__wcs, &__cpossign, __len, &__state);
2110+ _M_positive_sign = __wcs;
2111+ }
2112+ else
2113+ _M_positive_sign = L"";
2114+
2115+ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
2116+ __len = strlen(__cnegsign);
2117+ if (!__nposn)
2118+ _M_negative_sign = L"()";
2119+ else if (__len)
2120+ {
2121+ ++__len;
2122+ memset(&__state, 0, sizeof(mbstate_t));
2123+ wchar_t* __wcs = new wchar_t[__len];
2124+ mbsrtowcs(__wcs, &__cnegsign, __len, &__state);
2125+ _M_negative_sign = __wcs;
2126+ }
2127+ else
2128+ _M_negative_sign = L"";
2129+
2130+ // _Intl == true.
2131+ __len = strlen(__ccurr);
2132+ if (__len)
2133+ {
2134+ ++__len;
2135+ memset(&__state, 0, sizeof(mbstate_t));
2136+ wchar_t* __wcs = new wchar_t[__len];
2137+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
2138+ _M_curr_symbol = __wcs;
2139+ }
2140+ else
2141+ _M_curr_symbol = L"";
2142+
2143+ _M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
2144+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
2145+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
2146+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
2147+ _M_pos_format = _S_construct_pattern(__pprecedes, __pspace, __pposn);
2148+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
2149+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
2150+ _M_neg_format = _S_construct_pattern(__nprecedes, __nspace, __nposn);
2151+
2152+#ifdef __UCLIBC_HAS_XLOCALE__
2153+ __uselocale(__old);
2154+#else
2155+ setlocale(LC_ALL, __old);
2156+ free(__old);
2157+#endif
2158+ }
2159+ }
2160+
2161+ template<>
2162+ moneypunct<wchar_t, true>::~moneypunct()
2163+ {
2164+ if (wcslen(_M_positive_sign))
2165+ delete [] _M_positive_sign;
2166+ if (wcslen(_M_negative_sign) && (wcscmp(_M_negative_sign, L"()") != 0))
2167+ delete [] _M_negative_sign;
2168+ if (wcslen(_M_curr_symbol))
2169+ delete [] _M_curr_symbol;
2170+ }
2171+
2172+ template<>
2173+ moneypunct<wchar_t, false>::~moneypunct()
2174+ {
2175+ if (wcslen(_M_positive_sign))
2176+ delete [] _M_positive_sign;
2177+ if (wcslen(_M_negative_sign) && (wcscmp(_M_negative_sign, L"()") != 0))
2178+ delete [] _M_negative_sign;
2179+ if (wcslen(_M_curr_symbol))
2180+ delete [] _M_curr_symbol;
2181+ }
2182+#endif
2183+}
2184diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2185--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1969-12-31 18:00:00.000000000 -0600
2186+++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2004-01-09 18:20:59.000000000 -0600
2187@@ -0,0 +1,129 @@
2188+// std::numpunct implementation details, GNU version -*- C++ -*-
2189+
2190+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
2191+//
2192+// This file is part of the GNU ISO C++ Library. This library is free
2193+// software; you can redistribute it and/or modify it under the
2194+// terms of the GNU General Public License as published by the
2195+// Free Software Foundation; either version 2, or (at your option)
2196+// any later version.
2197+
2198+// This library is distributed in the hope that it will be useful,
2199+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2200+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2201+// GNU General Public License for more details.
2202+
2203+// You should have received a copy of the GNU General Public License along
2204+// with this library; see the file COPYING. If not, write to the Free
2205+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2206+// USA.
2207+
2208+// As a special exception, you may use this file as part of a free software
2209+// library without restriction. Specifically, if other files instantiate
2210+// templates or use macros or inline functions from this file, or you compile
2211+// this file and link it with other files to produce an executable, this
2212+// file does not by itself cause the resulting executable to be covered by
2213+// the GNU General Public License. This exception does not however
2214+// invalidate any other reasons why the executable file might be covered by
2215+// the GNU General Public License.
2216+
2217+//
2218+// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
2219+//
2220+
2221+// Written by Benjamin Kosnik <bkoz@redhat.com>
2222+
2223+#define _LIBC
2224+#include <locale>
2225+#undef _LIBC
2226+#include <bits/c++locale_internal.h>
2227+
2228+#ifdef __UCLIBC_MJN3_ONLY__
2229+#warning tailor for stub locale support
2230+#endif
2231+#ifndef __UCLIBC_HAS_XLOCALE__
2232+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2233+#endif
2234+
2235+namespace std
2236+{
2237+ template<>
2238+ void
2239+ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
2240+ {
2241+ if (!__cloc)
2242+ {
2243+ // "C" locale
2244+ _M_decimal_point = '.';
2245+ _M_thousands_sep = ',';
2246+ _M_grouping = "";
2247+ }
2248+ else
2249+ {
2250+ // Named locale.
2251+ _M_decimal_point = *(__nl_langinfo_l(RADIXCHAR, __cloc));
2252+ _M_thousands_sep = *(__nl_langinfo_l(THOUSEP, __cloc));
2253+ // Check for NUL, which implies no grouping.
2254+ if (_M_thousands_sep == '\0')
2255+ _M_grouping = "";
2256+ else
2257+ _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2258+ }
2259+ // NB: There is no way to extact this info from posix locales.
2260+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2261+ _M_truename = "true";
2262+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2263+ _M_falsename = "false";
2264+ }
2265+
2266+ template<>
2267+ numpunct<char>::~numpunct()
2268+ { }
2269+
2270+#ifdef _GLIBCPP_USE_WCHAR_T
2271+ template<>
2272+ void
2273+ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
2274+ {
2275+ if (!__cloc)
2276+ {
2277+ // "C" locale
2278+ _M_decimal_point = L'.';
2279+ _M_thousands_sep = L',';
2280+ _M_grouping = "";
2281+ }
2282+ else
2283+ {
2284+ // Named locale.
2285+#ifdef __UCLIBC_MJN3_ONLY__
2286+#warning fix this
2287+#endif
2288+#ifdef __UCLIBC__
2289+# ifdef __UCLIBC_HAS_XLOCALE__
2290+ _M_decimal_point = __cloc->decimal_point_wc;
2291+ _M_thousands_sep = __cloc->thousands_sep_wc;
2292+# else
2293+ _M_decimal_point = __global_locale->decimal_point_wc;
2294+ _M_thousands_sep = __global_locale->thousands_sep_wc;
2295+# endif
2296+#else
2297+ _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w);
2298+ _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w);
2299+#endif
2300+ if (_M_thousands_sep == L'\0')
2301+ _M_grouping = "";
2302+ else
2303+ _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2304+ }
2305+ // NB: There is no way to extact this info from posix locales.
2306+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2307+ _M_truename = L"true";
2308+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2309+ _M_falsename = L"false";
2310+ }
2311+
2312+ template<>
2313+ numpunct<wchar_t>::~numpunct()
2314+ { }
2315+ #endif
2316+}
2317diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/time_members.cc
2318--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/time_members.cc 1969-12-31 18:00:00.000000000 -0600
2319+++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/time_members.cc 2004-01-09 08:25:03.000000000 -0600
2320@@ -0,0 +1,341 @@
2321+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2322+
2323+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
2324+//
2325+// This file is part of the GNU ISO C++ Library. This library is free
2326+// software; you can redistribute it and/or modify it under the
2327+// terms of the GNU General Public License as published by the
2328+// Free Software Foundation; either version 2, or (at your option)
2329+// any later version.
2330+
2331+// This library is distributed in the hope that it will be useful,
2332+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2333+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2334+// GNU General Public License for more details.
2335+
2336+// You should have received a copy of the GNU General Public License along
2337+// with this library; see the file COPYING. If not, write to the Free
2338+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2339+// USA.
2340+
2341+// As a special exception, you may use this file as part of a free software
2342+// library without restriction. Specifically, if other files instantiate
2343+// templates or use macros or inline functions from this file, or you compile
2344+// this file and link it with other files to produce an executable, this
2345+// file does not by itself cause the resulting executable to be covered by
2346+// the GNU General Public License. This exception does not however
2347+// invalidate any other reasons why the executable file might be covered by
2348+// the GNU General Public License.
2349+
2350+//
2351+// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
2352+// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
2353+//
2354+
2355+// Written by Benjamin Kosnik <bkoz@redhat.com>
2356+
2357+#include <locale>
2358+#include <bits/c++locale_internal.h>
2359+
2360+#ifdef __UCLIBC_MJN3_ONLY__
2361+#warning tailor for stub locale support
2362+#endif
2363+#ifndef __UCLIBC_HAS_XLOCALE__
2364+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2365+#endif
2366+
2367+namespace std
2368+{
2369+ template<>
2370+ void
2371+ __timepunct<char>::
2372+ _M_put(char* __s, size_t __maxlen, const char* __format,
2373+ const tm* __tm) const
2374+ {
2375+#ifdef __UCLIBC_HAS_XLOCALE__
2376+ __strftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
2377+#else
2378+ char* __old = strdup(setlocale(LC_ALL, NULL));
2379+ setlocale(LC_ALL, _M_name_timepunct);
2380+ strftime(__s, __maxlen, __format, __tm);
2381+ setlocale(LC_ALL, __old);
2382+ free(__old);
2383+#endif
2384+ }
2385+
2386+ template<>
2387+ void
2388+ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
2389+ {
2390+ if (!__cloc)
2391+ {
2392+ // "C" locale
2393+ _M_c_locale_timepunct = _S_c_locale;
2394+
2395+ _M_date_format = "%m/%d/%y";
2396+ _M_date_era_format = "%m/%d/%y";
2397+ _M_time_format = "%H:%M:%S";
2398+ _M_time_era_format = "%H:%M:%S";
2399+ _M_date_time_format = "";
2400+ _M_date_time_era_format = "";
2401+ _M_am = "AM";
2402+ _M_pm = "PM";
2403+ _M_am_pm_format = "";
2404+
2405+ // Day names, starting with "C"'s Sunday.
2406+ _M_day1 = "Sunday";
2407+ _M_day2 = "Monday";
2408+ _M_day3 = "Tuesday";
2409+ _M_day4 = "Wednesday";
2410+ _M_day5 = "Thursday";
2411+ _M_day6 = "Friday";
2412+ _M_day7 = "Saturday";
2413+
2414+ // Abbreviated day names, starting with "C"'s Sun.
2415+ _M_day_a1 = "Sun";
2416+ _M_day_a2 = "Mon";
2417+ _M_day_a3 = "Tue";
2418+ _M_day_a4 = "Wed";
2419+ _M_day_a5 = "Thu";
2420+ _M_day_a6 = "Fri";
2421+ _M_day_a7 = "Sat";
2422+
2423+ // Month names, starting with "C"'s January.
2424+ _M_month01 = "January";
2425+ _M_month02 = "February";
2426+ _M_month03 = "March";
2427+ _M_month04 = "April";
2428+ _M_month05 = "May";
2429+ _M_month06 = "June";
2430+ _M_month07 = "July";
2431+ _M_month08 = "August";
2432+ _M_month09 = "September";
2433+ _M_month10 = "October";
2434+ _M_month11 = "November";
2435+ _M_month12 = "December";
2436+
2437+ // Abbreviated month names, starting with "C"'s Jan.
2438+ _M_month_a01 = "Jan";
2439+ _M_month_a02 = "Feb";
2440+ _M_month_a03 = "Mar";
2441+ _M_month_a04 = "Apr";
2442+ _M_month_a05 = "May";
2443+ _M_month_a06 = "Jun";
2444+ _M_month_a07 = "July";
2445+ _M_month_a08 = "Aug";
2446+ _M_month_a09 = "Sep";
2447+ _M_month_a10 = "Oct";
2448+ _M_month_a11 = "Nov";
2449+ _M_month_a12 = "Dec";
2450+ }
2451+ else
2452+ {
2453+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2454+
2455+ _M_date_format = __nl_langinfo_l(D_FMT, __cloc);
2456+ _M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
2457+ _M_time_format = __nl_langinfo_l(T_FMT, __cloc);
2458+ _M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
2459+ _M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
2460+ _M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT, __cloc);
2461+ _M_am = __nl_langinfo_l(AM_STR, __cloc);
2462+ _M_pm = __nl_langinfo_l(PM_STR, __cloc);
2463+ _M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
2464+
2465+ // Day names, starting with "C"'s Sunday.
2466+ _M_day1 = __nl_langinfo_l(DAY_1, __cloc);
2467+ _M_day2 = __nl_langinfo_l(DAY_2, __cloc);
2468+ _M_day3 = __nl_langinfo_l(DAY_3, __cloc);
2469+ _M_day4 = __nl_langinfo_l(DAY_4, __cloc);
2470+ _M_day5 = __nl_langinfo_l(DAY_5, __cloc);
2471+ _M_day6 = __nl_langinfo_l(DAY_6, __cloc);
2472+ _M_day7 = __nl_langinfo_l(DAY_7, __cloc);
2473+
2474+ // Abbreviated day names, starting with "C"'s Sun.
2475+ _M_day_a1 = __nl_langinfo_l(ABDAY_1, __cloc);
2476+ _M_day_a2 = __nl_langinfo_l(ABDAY_2, __cloc);
2477+ _M_day_a3 = __nl_langinfo_l(ABDAY_3, __cloc);
2478+ _M_day_a4 = __nl_langinfo_l(ABDAY_4, __cloc);
2479+ _M_day_a5 = __nl_langinfo_l(ABDAY_5, __cloc);
2480+ _M_day_a6 = __nl_langinfo_l(ABDAY_6, __cloc);
2481+ _M_day_a7 = __nl_langinfo_l(ABDAY_7, __cloc);
2482+
2483+ // Month names, starting with "C"'s January.
2484+ _M_month01 = __nl_langinfo_l(MON_1, __cloc);
2485+ _M_month02 = __nl_langinfo_l(MON_2, __cloc);
2486+ _M_month03 = __nl_langinfo_l(MON_3, __cloc);
2487+ _M_month04 = __nl_langinfo_l(MON_4, __cloc);
2488+ _M_month05 = __nl_langinfo_l(MON_5, __cloc);
2489+ _M_month06 = __nl_langinfo_l(MON_6, __cloc);
2490+ _M_month07 = __nl_langinfo_l(MON_7, __cloc);
2491+ _M_month08 = __nl_langinfo_l(MON_8, __cloc);
2492+ _M_month09 = __nl_langinfo_l(MON_9, __cloc);
2493+ _M_month10 = __nl_langinfo_l(MON_10, __cloc);
2494+ _M_month11 = __nl_langinfo_l(MON_11, __cloc);
2495+ _M_month12 = __nl_langinfo_l(MON_12, __cloc);
2496+
2497+ // Abbreviated month names, starting with "C"'s Jan.
2498+ _M_month_a01 = __nl_langinfo_l(ABMON_1, __cloc);
2499+ _M_month_a02 = __nl_langinfo_l(ABMON_2, __cloc);
2500+ _M_month_a03 = __nl_langinfo_l(ABMON_3, __cloc);
2501+ _M_month_a04 = __nl_langinfo_l(ABMON_4, __cloc);
2502+ _M_month_a05 = __nl_langinfo_l(ABMON_5, __cloc);
2503+ _M_month_a06 = __nl_langinfo_l(ABMON_6, __cloc);
2504+ _M_month_a07 = __nl_langinfo_l(ABMON_7, __cloc);
2505+ _M_month_a08 = __nl_langinfo_l(ABMON_8, __cloc);
2506+ _M_month_a09 = __nl_langinfo_l(ABMON_9, __cloc);
2507+ _M_month_a10 = __nl_langinfo_l(ABMON_10, __cloc);
2508+ _M_month_a11 = __nl_langinfo_l(ABMON_11, __cloc);
2509+ _M_month_a12 = __nl_langinfo_l(ABMON_12, __cloc);
2510+ }
2511+ }
2512+
2513+#ifdef _GLIBCPP_USE_WCHAR_T
2514+ template<>
2515+ void
2516+ __timepunct<wchar_t>::
2517+ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
2518+ const tm* __tm) const
2519+ {
2520+#ifdef __UCLIBC_HAS_XLOCALE__
2521+ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
2522+#else
2523+ char* __old = strdup(setlocale(LC_ALL, NULL));
2524+ setlocale(LC_ALL, _M_name_timepunct);
2525+ wcsftime(__s, __maxlen, __format, __tm);
2526+ setlocale(LC_ALL, __old);
2527+ free(__old);
2528+#endif
2529+ }
2530+
2531+ template<>
2532+ void
2533+ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
2534+ {
2535+#warning wide time stuff
2536+// if (!__cloc)
2537+ {
2538+ // "C" locale
2539+ _M_c_locale_timepunct = _S_c_locale;
2540+
2541+ _M_date_format = L"%m/%d/%y";
2542+ _M_date_era_format = L"%m/%d/%y";
2543+ _M_time_format = L"%H:%M:%S";
2544+ _M_time_era_format = L"%H:%M:%S";
2545+ _M_date_time_format = L"";
2546+ _M_date_time_era_format = L"";
2547+ _M_am = L"AM";
2548+ _M_pm = L"PM";
2549+ _M_am_pm_format = L"";
2550+
2551+ // Day names, starting with "C"'s Sunday.
2552+ _M_day1 = L"Sunday";
2553+ _M_day2 = L"Monday";
2554+ _M_day3 = L"Tuesday";
2555+ _M_day4 = L"Wednesday";
2556+ _M_day5 = L"Thursday";
2557+ _M_day6 = L"Friday";
2558+ _M_day7 = L"Saturday";
2559+
2560+ // Abbreviated day names, starting with "C"'s Sun.
2561+ _M_day_a1 = L"Sun";
2562+ _M_day_a2 = L"Mon";
2563+ _M_day_a3 = L"Tue";
2564+ _M_day_a4 = L"Wed";
2565+ _M_day_a5 = L"Thu";
2566+ _M_day_a6 = L"Fri";
2567+ _M_day_a7 = L"Sat";
2568+
2569+ // Month names, starting with "C"'s January.
2570+ _M_month01 = L"January";
2571+ _M_month02 = L"February";
2572+ _M_month03 = L"March";
2573+ _M_month04 = L"April";
2574+ _M_month05 = L"May";
2575+ _M_month06 = L"June";
2576+ _M_month07 = L"July";
2577+ _M_month08 = L"August";
2578+ _M_month09 = L"September";
2579+ _M_month10 = L"October";
2580+ _M_month11 = L"November";
2581+ _M_month12 = L"December";
2582+
2583+ // Abbreviated month names, starting with "C"'s Jan.
2584+ _M_month_a01 = L"Jan";
2585+ _M_month_a02 = L"Feb";
2586+ _M_month_a03 = L"Mar";
2587+ _M_month_a04 = L"Apr";
2588+ _M_month_a05 = L"May";
2589+ _M_month_a06 = L"Jun";
2590+ _M_month_a07 = L"July";
2591+ _M_month_a08 = L"Aug";
2592+ _M_month_a09 = L"Sep";
2593+ _M_month_a10 = L"Oct";
2594+ _M_month_a11 = L"Nov";
2595+ _M_month_a12 = L"Dec";
2596+ }
2597+#if 0
2598+ else
2599+ {
2600+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2601+
2602+ _M_date_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WD_FMT, __cloc));
2603+ _M_date_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_D_FMT, __cloc));
2604+ _M_time_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WT_FMT, __cloc));
2605+ _M_time_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_T_FMT, __cloc));
2606+ _M_date_time_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WD_T_FMT, __cloc));
2607+ _M_date_time_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc));
2608+ _M_am = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WAM_STR, __cloc));
2609+ _M_pm = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WPM_STR, __cloc));
2610+ _M_am_pm_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc));
2611+
2612+ // Day names, starting with "C"'s Sunday.
2613+ _M_day1 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_1, __cloc));
2614+ _M_day2 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_2, __cloc));
2615+ _M_day3 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_3, __cloc));
2616+ _M_day4 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_4, __cloc));
2617+ _M_day5 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_5, __cloc));
2618+ _M_day6 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_6, __cloc));
2619+ _M_day7 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_7, __cloc));
2620+
2621+ // Abbreviated day names, starting with "C"'s Sun.
2622+ _M_day_a1 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_1, __cloc));
2623+ _M_day_a2 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_2, __cloc));
2624+ _M_day_a3 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_3, __cloc));
2625+ _M_day_a4 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_4, __cloc));
2626+ _M_day_a5 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_5, __cloc));
2627+ _M_day_a6 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_6, __cloc));
2628+ _M_day_a7 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_7, __cloc));
2629+
2630+ // Month names, starting with "C"'s January.
2631+ _M_month01 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_1, __cloc));
2632+ _M_month02 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_2, __cloc));
2633+ _M_month03 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_3, __cloc));
2634+ _M_month04 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_4, __cloc));
2635+ _M_month05 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_5, __cloc));
2636+ _M_month06 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_6, __cloc));
2637+ _M_month07 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_7, __cloc));
2638+ _M_month08 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_8, __cloc));
2639+ _M_month09 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_9, __cloc));
2640+ _M_month10 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_10, __cloc));
2641+ _M_month11 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_11, __cloc));
2642+ _M_month12 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_12, __cloc));
2643+
2644+ // Abbreviated month names, starting with "C"'s Jan.
2645+ _M_month_a01 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_1, __cloc));
2646+ _M_month_a02 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_2, __cloc));
2647+ _M_month_a03 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_3, __cloc));
2648+ _M_month_a04 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_4, __cloc));
2649+ _M_month_a05 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_5, __cloc));
2650+ _M_month_a06 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_6, __cloc));
2651+ _M_month_a07 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_7, __cloc));
2652+ _M_month_a08 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_8, __cloc));
2653+ _M_month_a09 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_9, __cloc));
2654+ _M_month_a10 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_10, __cloc));
2655+ _M_month_a11 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_11, __cloc));
2656+ _M_month_a12 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_12, __cloc));
2657+ }
2658+#endif // 0
2659+ }
2660+#endif
2661+}
2662diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/time_members.h gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/time_members.h
2663--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/time_members.h 1969-12-31 18:00:00.000000000 -0600
2664+++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/time_members.h 2004-01-09 04:26:21.000000000 -0600
2665@@ -0,0 +1,68 @@
2666+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2667+
2668+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
2669+//
2670+// This file is part of the GNU ISO C++ Library. This library is free
2671+// software; you can redistribute it and/or modify it under the
2672+// terms of the GNU General Public License as published by the
2673+// Free Software Foundation; either version 2, or (at your option)
2674+// any later version.
2675+
2676+// This library is distributed in the hope that it will be useful,
2677+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2678+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2679+// GNU General Public License for more details.
2680+
2681+// You should have received a copy of the GNU General Public License along
2682+// with this library; see the file COPYING. If not, write to the Free
2683+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2684+// USA.
2685+
2686+// As a special exception, you may use this file as part of a free software
2687+// library without restriction. Specifically, if other files instantiate
2688+// templates or use macros or inline functions from this file, or you compile
2689+// this file and link it with other files to produce an executable, this
2690+// file does not by itself cause the resulting executable to be covered by
2691+// the GNU General Public License. This exception does not however
2692+// invalidate any other reasons why the executable file might be covered by
2693+// the GNU General Public License.
2694+
2695+//
2696+// ISO C++ 14882: 22.2.5.1.2 - time_get functions
2697+// ISO C++ 14882: 22.2.5.3.2 - time_put functions
2698+//
2699+
2700+// Written by Benjamin Kosnik <bkoz@redhat.com>
2701+
2702+ template<typename _CharT>
2703+ __timepunct<_CharT>::__timepunct(size_t __refs)
2704+ : locale::facet(__refs)
2705+ {
2706+#ifndef __UCLIBC_HAS_XLOCALE__
2707+ _M_name_timepunct = _S_c_name;
2708+#endif
2709+ _M_initialize_timepunct();
2710+ }
2711+
2712+ template<typename _CharT>
2713+ __timepunct<_CharT>::__timepunct(__c_locale __cloc,
2714+ const char* __s,
2715+ size_t __refs)
2716+ : locale::facet(__refs)
2717+ {
2718+#ifndef __UCLIBC_HAS_XLOCALE__
2719+ _M_name_timepunct = new char[strlen(__s) + 1];
2720+ strcpy(_M_name_timepunct, __s);
2721+#endif
2722+ _M_initialize_timepunct(__cloc);
2723+ }
2724+
2725+ template<typename _CharT>
2726+ __timepunct<_CharT>::~__timepunct()
2727+ {
2728+#ifndef __UCLIBC_HAS_XLOCALE__
2729+ if (_S_c_name != _M_name_timepunct)
2730+ delete [] _M_name_timepunct;
2731+#endif
2732+ _S_destroy_c_locale(_M_c_locale_timepunct);
2733+ }
2734diff -urN gcc-3.3.2/libstdc++-v3/config/os/uclibc/ctype_base.h gcc-3.3.2-uClibc/libstdc++-v3/config/os/uclibc/ctype_base.h
2735--- gcc-3.3.2/libstdc++-v3/config/os/uclibc/ctype_base.h 1969-12-31 18:00:00.000000000 -0600
2736+++ gcc-3.3.2-uClibc/libstdc++-v3/config/os/uclibc/ctype_base.h 2004-01-09 02:54:54.000000000 -0600
2737@@ -0,0 +1,57 @@
2738+// Locale support -*- C++ -*-
2739+
2740+// Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
2741+//
2742+// This file is part of the GNU ISO C++ Library. This library is free
2743+// software; you can redistribute it and/or modify it under the
2744+// terms of the GNU General Public License as published by the
2745+// Free Software Foundation; either version 2, or (at your option)
2746+// any later version.
2747+
2748+// This library is distributed in the hope that it will be useful,
2749+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2750+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2751+// GNU General Public License for more details.
2752+
2753+// You should have received a copy of the GNU General Public License along
2754+// with this library; see the file COPYING. If not, write to the Free
2755+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2756+// USA.
2757+
2758+// As a special exception, you may use this file as part of a free software
2759+// library without restriction. Specifically, if other files instantiate
2760+// templates or use macros or inline functions from this file, or you compile
2761+// this file and link it with other files to produce an executable, this
2762+// file does not by itself cause the resulting executable to be covered by
2763+// the GNU General Public License. This exception does not however
2764+// invalidate any other reasons why the executable file might be covered by
2765+// the GNU General Public License.
2766+
2767+//
2768+// ISO C++ 14882: 22.1 Locales
2769+//
2770+
2771+// Information as gleaned from /usr/include/ctype.h
2772+
2773+ struct ctype_base
2774+ {
2775+ // Note: In uClibc, the following two types depend on configuration.
2776+
2777+ // Non-standard typedefs.
2778+ typedef const __ctype_touplow_t* __to_type;
2779+ // NB: Offsets into ctype<char>::_M_table force a particular size
2780+ // on the mask type. Because of this, we don't use an enum.
2781+ typedef __ctype_mask_t mask;
2782+
2783+ static const mask upper = _ISupper;
2784+ static const mask lower = _ISlower;
2785+ static const mask alpha = _ISalpha;
2786+ static const mask digit = _ISdigit;
2787+ static const mask xdigit = _ISxdigit;
2788+ static const mask space = _ISspace;
2789+ static const mask print = _ISprint;
2790+ static const mask graph = _ISgraph;
2791+ static const mask cntrl = _IScntrl;
2792+ static const mask punct = _ISpunct;
2793+ static const mask alnum = _ISalnum;
2794+ };
2795diff -urN gcc-3.3.2/libstdc++-v3/config/os/uclibc/ctype_inline.h gcc-3.3.2-uClibc/libstdc++-v3/config/os/uclibc/ctype_inline.h
2796--- gcc-3.3.2/libstdc++-v3/config/os/uclibc/ctype_inline.h 1969-12-31 18:00:00.000000000 -0600
2797+++ gcc-3.3.2-uClibc/libstdc++-v3/config/os/uclibc/ctype_inline.h 2002-06-24 00:49:19.000000000 -0500
2798@@ -0,0 +1,69 @@
2799+// Locale support -*- C++ -*-
2800+
2801+// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
2802+//
2803+// This file is part of the GNU ISO C++ Library. This library is free
2804+// software; you can redistribute it and/or modify it under the
2805+// terms of the GNU General Public License as published by the
2806+// Free Software Foundation; either version 2, or (at your option)
2807+// any later version.
2808+
2809+// This library is distributed in the hope that it will be useful,
2810+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2811+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2812+// GNU General Public License for more details.
2813+
2814+// You should have received a copy of the GNU General Public License along
2815+// with this library; see the file COPYING. If not, write to the Free
2816+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2817+// USA.
2818+
2819+// As a special exception, you may use this file as part of a free software
2820+// library without restriction. Specifically, if other files instantiate
2821+// templates or use macros or inline functions from this file, or you compile
2822+// this file and link it with other files to produce an executable, this
2823+// file does not by itself cause the resulting executable to be covered by
2824+// the GNU General Public License. This exception does not however
2825+// invalidate any other reasons why the executable file might be covered by
2826+// the GNU General Public License.
2827+
2828+//
2829+// ISO C++ 14882: 22.1 Locales
2830+//
2831+
2832+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
2833+// functions go in ctype.cc
2834+
2835+ bool
2836+ ctype<char>::
2837+ is(mask __m, char __c) const
2838+ { return _M_table[static_cast<unsigned char>(__c)] & __m; }
2839+
2840+ const char*
2841+ ctype<char>::
2842+ is(const char* __low, const char* __high, mask* __vec) const
2843+ {
2844+ while (__low < __high)
2845+ *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
2846+ return __high;
2847+ }
2848+
2849+ const char*
2850+ ctype<char>::
2851+ scan_is(mask __m, const char* __low, const char* __high) const
2852+ {
2853+ while (__low < __high
2854+ && !(_M_table[static_cast<unsigned char>(*__low)] & __m))
2855+ ++__low;
2856+ return __low;
2857+ }
2858+
2859+ const char*
2860+ ctype<char>::
2861+ scan_not(mask __m, const char* __low, const char* __high) const
2862+ {
2863+ while (__low < __high
2864+ && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
2865+ ++__low;
2866+ return __low;
2867+ }
2868diff -urN gcc-3.3.2/libstdc++-v3/config/os/uclibc/ctype_noninline.h gcc-3.3.2-uClibc/libstdc++-v3/config/os/uclibc/ctype_noninline.h
2869--- gcc-3.3.2/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1969-12-31 18:00:00.000000000 -0600
2870+++ gcc-3.3.2-uClibc/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2004-01-09 03:34:53.000000000 -0600
2871@@ -0,0 +1,90 @@
2872+// Locale support -*- C++ -*-
2873+
2874+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
2875+// Free Software Foundation, Inc.
2876+//
2877+// This file is part of the GNU ISO C++ Library. This library is free
2878+// software; you can redistribute it and/or modify it under the
2879+// terms of the GNU General Public License as published by the
2880+// Free Software Foundation; either version 2, or (at your option)
2881+// any later version.
2882+
2883+// This library is distributed in the hope that it will be useful,
2884+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2885+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2886+// GNU General Public License for more details.
2887+
2888+// You should have received a copy of the GNU General Public License along
2889+// with this library; see the file COPYING. If not, write to the Free
2890+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2891+// USA.
2892+
2893+// As a special exception, you may use this file as part of a free software
2894+// library without restriction. Specifically, if other files instantiate
2895+// templates or use macros or inline functions from this file, or you compile
2896+// this file and link it with other files to produce an executable, this
2897+// file does not by itself cause the resulting executable to be covered by
2898+// the GNU General Public License. This exception does not however
2899+// invalidate any other reasons why the executable file might be covered by
2900+// the GNU General Public License.
2901+
2902+//
2903+// ISO C++ 14882: 22.1 Locales
2904+//
2905+
2906+// Information as gleaned from /usr/include/ctype.h
2907+
2908+ const ctype_base::mask*
2909+ ctype<char>::classic_table() throw()
2910+ {
2911+ return __C_ctype_b;
2912+ }
2913+
2914+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
2915+ size_t __refs)
2916+ : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del)
2917+ {
2918+ _M_toupper = __C_ctype_toupper;
2919+ _M_tolower = __C_ctype_tolower;
2920+ _M_table = __table ? __table : __C_ctype_b;
2921+ _M_c_locale_ctype = _S_c_locale;
2922+ }
2923+
2924+ ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) :
2925+ __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del)
2926+ {
2927+ _M_toupper = __C_ctype_toupper;
2928+ _M_tolower = __C_ctype_tolower;
2929+ _M_table = __table ? __table : __C_ctype_b;
2930+ _M_c_locale_ctype = _S_c_locale;
2931+ }
2932+
2933+ char
2934+ ctype<char>::do_toupper(char __c) const
2935+ { return _M_toupper[static_cast<unsigned char>(__c)]; }
2936+
2937+ const char*
2938+ ctype<char>::do_toupper(char* __low, const char* __high) const
2939+ {
2940+ while (__low < __high)
2941+ {
2942+ *__low = _M_toupper[static_cast<unsigned char>(*__low)];
2943+ ++__low;
2944+ }
2945+ return __high;
2946+ }
2947+
2948+ char
2949+ ctype<char>::do_tolower(char __c) const
2950+ { return _M_tolower[static_cast<unsigned char>(__c)]; }
2951+
2952+ const char*
2953+ ctype<char>::do_tolower(char* __low, const char* __high) const
2954+ {
2955+ while (__low < __high)
2956+ {
2957+ *__low = _M_tolower[static_cast<unsigned char>(*__low)];
2958+ ++__low;
2959+ }
2960+ return __high;
2961+ }
2962diff -urN gcc-3.3.2/libstdc++-v3/config/os/uclibc/os_defines.h gcc-3.3.2-uClibc/libstdc++-v3/config/os/uclibc/os_defines.h
2963--- gcc-3.3.2/libstdc++-v3/config/os/uclibc/os_defines.h 1969-12-31 18:00:00.000000000 -0600
2964+++ gcc-3.3.2-uClibc/libstdc++-v3/config/os/uclibc/os_defines.h 2004-01-09 04:56:13.000000000 -0600
2965@@ -0,0 +1,56 @@
2966+// Specific definitions for GNU/Linux -*- C++ -*-
2967+
2968+// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
2969+//
2970+// This file is part of the GNU ISO C++ Library. This library is free
2971+// software; you can redistribute it and/or modify it under the
2972+// terms of the GNU General Public License as published by the
2973+// Free Software Foundation; either version 2, or (at your option)
2974+// any later version.
2975+
2976+// This library is distributed in the hope that it will be useful,
2977+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2978+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2979+// GNU General Public License for more details.
2980+
2981+// You should have received a copy of the GNU General Public License along
2982+// with this library; see the file COPYING. If not, write to the Free
2983+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2984+// USA.
2985+
2986+// As a special exception, you may use this file as part of a free software
2987+// library without restriction. Specifically, if other files instantiate
2988+// templates or use macros or inline functions from this file, or you compile
2989+// this file and link it with other files to produce an executable, this
2990+// file does not by itself cause the resulting executable to be covered by
2991+// the GNU General Public License. This exception does not however
2992+// invalidate any other reasons why the executable file might be covered by
2993+// the GNU General Public License.
2994+
2995+#ifndef _GLIBCPP_OS_DEFINES
2996+#define _GLIBCPP_OS_DEFINES 1
2997+
2998+// System-specific #define, typedefs, corrections, etc, go here. This
2999+// file will come before all others.
3000+
3001+// This keeps isanum, et al from being propagated as macros.
3002+#define __NO_CTYPE 1
3003+
3004+#include <features.h>
3005+
3006+// These systems have declarations mismatching those in libio.h by
3007+// omitting throw qualifiers. Cleanest way out is to not provide
3008+// throw-qualifiers at all. Defining it as empty here will make libio.h
3009+// not define it.
3010+#undef __THROW
3011+#define __THROW
3012+
3013+// Tell Glibc not to try to provide its own inline versions of
3014+// some math functions. Those cause assembly-time clashes with
3015+// our definitions.
3016+#define __NO_MATH_INLINES
3017+
3018+// We must not see the optimized string functions GNU libc defines.
3019+#define __NO_STRING_INLINES
3020+
3021+#endif
diff --git a/meta/packages/gcc/gcc-3.3.4/gcc34-15089.patch b/meta/packages/gcc/gcc-3.3.4/gcc34-15089.patch
new file mode 100644
index 0000000000..3b7a056e63
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.3.4/gcc34-15089.patch
@@ -0,0 +1,19 @@
12004-04-29 Philip Blundell <philb@gnu.org>
2
3 * loop.c (scan_loop): Don't delete SET of a hard register.
4
5Index: loop.c
6===================================================================
7RCS file: /cvs/gcc/gcc/gcc/loop.c,v
8retrieving revision 1.488.2.3
9diff -u -r1.488.2.3 loop.c
10--- gcc/gcc/loop.c 14 Feb 2004 14:46:03 -0000 1.488.2.3
11+++ gcc/gcc/loop.c 28 Apr 2004 22:02:53 -0000
12@@ -929,6 +929,7 @@
13 || (! (GET_CODE (SET_SRC (set)) == REG
14 && (REGNO (SET_SRC (set))
15 < FIRST_PSEUDO_REGISTER))))
16+ && regno >= FIRST_PSEUDO_REGISTER
17 /* This test is not redundant; SET_SRC (set) might be
18 a call-clobbered register and the life of REGNO
19 might span a call. */
diff --git a/meta/packages/gcc/gcc-3.3.4/libibery-crosstool.patch b/meta/packages/gcc/gcc-3.3.4/libibery-crosstool.patch
new file mode 100644
index 0000000000..2898cf18ff
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.3.4/libibery-crosstool.patch
@@ -0,0 +1,683 @@
1diff -urN gcc-3.3.3.orig/libiberty/configure gcc-3.3.3/libiberty/configure
2--- gcc-3.3.3.orig/libiberty/configure 2003-11-12 12:32:29.000000000 -0500
3+++ gcc-3.3.3/libiberty/configure 2004-04-09 23:04:23.000000000 -0400
4@@ -1000,13 +1000,60 @@
5 fi
6
7
8+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
9+echo "configure:1005: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
10+
11+ac_ext=c
12+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
13+ac_cpp='$CPP $CPPFLAGS'
14+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
15+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
16+cross_compiling=$ac_cv_prog_cc_cross
17+
18+cat > conftest.$ac_ext << EOF
19+
20+#line 1016 "configure"
21+#include "confdefs.h"
22+
23+main(){return(0);}
24+EOF
25+if { (eval echo configure:1021: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
26+ ac_cv_prog_cc_works=yes
27+ # If we can't run a trivial program, we are probably using a cross compiler.
28+ if (./conftest; exit) 2>/dev/null; then
29+ ac_cv_prog_cc_cross=no
30+ else
31+ ac_cv_prog_cc_cross=yes
32+ fi
33+else
34+ echo "configure: failed program was:" >&5
35+ cat conftest.$ac_ext >&5
36+ ac_cv_prog_cc_works=no
37+fi
38+rm -fr conftest*
39+ac_ext=c
40+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
41+ac_cpp='$CPP $CPPFLAGS'
42+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
43+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
44+cross_compiling=$ac_cv_prog_cc_cross
45+
46+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
47+if test $ac_cv_prog_cc_works = no; then
48+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
49+fi
50+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
51+echo "configure:1047: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
52+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
53+cross_compiling=$ac_cv_prog_cc_cross
54+
55
56 if test "x$CC" != xcc; then
57 echo $ac_n "checking whether $CC and cc understand -c and -o together""... $ac_c" 1>&6
58-echo "configure:1007: checking whether $CC and cc understand -c and -o together" >&5
59+echo "configure:1054: checking whether $CC and cc understand -c and -o together" >&5
60 else
61 echo $ac_n "checking whether cc understands -c and -o together""... $ac_c" 1>&6
62-echo "configure:1010: checking whether cc understands -c and -o together" >&5
63+echo "configure:1057: checking whether cc understands -c and -o together" >&5
64 fi
65 set dummy $CC; ac_cc="`echo $2 |
66 sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`"
67@@ -1018,16 +1065,16 @@
68 # We do the test twice because some compilers refuse to overwrite an
69 # existing .o file with -o, though they will create one.
70 ac_try='${CC-cc} -c conftest.c -o conftest.o 1>&5'
71-if { (eval echo configure:1022: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } &&
72- test -f conftest.o && { (eval echo configure:1023: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; };
73+if { (eval echo configure:1069: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } &&
74+ test -f conftest.o && { (eval echo configure:1070: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; };
75 then
76 eval ac_cv_prog_cc_${ac_cc}_c_o=yes
77 if test "x$CC" != xcc; then
78 # Test first that cc exists at all.
79- if { ac_try='cc -c conftest.c 1>&5'; { (eval echo configure:1028: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
80+ if { ac_try='cc -c conftest.c 1>&5'; { (eval echo configure:1075: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
81 ac_try='cc -c conftest.c -o conftest.o 1>&5'
82- if { (eval echo configure:1030: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } &&
83- test -f conftest.o && { (eval echo configure:1031: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; };
84+ if { (eval echo configure:1077: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } &&
85+ test -f conftest.o && { (eval echo configure:1078: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; };
86 then
87 # cc works too.
88 :
89@@ -1063,7 +1110,7 @@
90
91
92 echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
93-echo "configure:1067: checking for POSIXized ISC" >&5
94+echo "configure:1114: checking for POSIXized ISC" >&5
95 if test -d /etc/conf/kconfig.d &&
96 grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
97 then
98@@ -1084,12 +1131,12 @@
99 fi
100
101 echo $ac_n "checking for working const""... $ac_c" 1>&6
102-echo "configure:1088: checking for working const" >&5
103+echo "configure:1135: checking for working const" >&5
104 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
105 echo $ac_n "(cached) $ac_c" 1>&6
106 else
107 cat > conftest.$ac_ext <<EOF
108-#line 1093 "configure"
109+#line 1140 "configure"
110 #include "confdefs.h"
111
112 int main() {
113@@ -1138,7 +1185,7 @@
114
115 ; return 0; }
116 EOF
117-if { (eval echo configure:1142: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
118+if { (eval echo configure:1189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
119 rm -rf conftest*
120 ac_cv_c_const=yes
121 else
122@@ -1159,21 +1206,21 @@
123 fi
124
125 echo $ac_n "checking for inline""... $ac_c" 1>&6
126-echo "configure:1163: checking for inline" >&5
127+echo "configure:1210: checking for inline" >&5
128 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
129 echo $ac_n "(cached) $ac_c" 1>&6
130 else
131 ac_cv_c_inline=no
132 for ac_kw in inline __inline__ __inline; do
133 cat > conftest.$ac_ext <<EOF
134-#line 1170 "configure"
135+#line 1217 "configure"
136 #include "confdefs.h"
137
138 int main() {
139 } $ac_kw foo() {
140 ; return 0; }
141 EOF
142-if { (eval echo configure:1177: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
143+if { (eval echo configure:1224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
144 rm -rf conftest*
145 ac_cv_c_inline=$ac_kw; break
146 else
147@@ -1216,7 +1263,7 @@
148 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
149 # ./install, which can be erroneously created by make from ./install.sh.
150 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
151-echo "configure:1220: checking for a BSD compatible install" >&5
152+echo "configure:1267: checking for a BSD compatible install" >&5
153 if test -z "$INSTALL"; then
154 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
155 echo $ac_n "(cached) $ac_c" 1>&6
156@@ -1277,7 +1324,7 @@
157 # able to link anything, it had better be able to at least compile
158 # something.
159 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
160-echo "configure:1281: checking how to run the C preprocessor" >&5
161+echo "configure:1328: checking how to run the C preprocessor" >&5
162 # On Suns, sometimes $CPP names a directory.
163 if test -n "$CPP" && test -d "$CPP"; then
164 CPP=
165@@ -1292,13 +1339,13 @@
166 # On the NeXT, cc -E runs the code through the compiler's parser,
167 # not just through cpp.
168 cat > conftest.$ac_ext <<EOF
169-#line 1296 "configure"
170+#line 1343 "configure"
171 #include "confdefs.h"
172 #include <assert.h>
173 Syntax Error
174 EOF
175 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
176-{ (eval echo configure:1302: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
177+{ (eval echo configure:1349: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
178 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
179 if test -z "$ac_err"; then
180 :
181@@ -1309,13 +1356,13 @@
182 rm -rf conftest*
183 CPP="${CC-cc} -E -traditional-cpp"
184 cat > conftest.$ac_ext <<EOF
185-#line 1313 "configure"
186+#line 1360 "configure"
187 #include "confdefs.h"
188 #include <assert.h>
189 Syntax Error
190 EOF
191 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
192-{ (eval echo configure:1319: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
193+{ (eval echo configure:1366: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
194 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
195 if test -z "$ac_err"; then
196 :
197@@ -1326,13 +1373,13 @@
198 rm -rf conftest*
199 CPP="${CC-cc} -nologo -E"
200 cat > conftest.$ac_ext <<EOF
201-#line 1330 "configure"
202+#line 1377 "configure"
203 #include "confdefs.h"
204 #include <assert.h>
205 Syntax Error
206 EOF
207 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
208-{ (eval echo configure:1336: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
209+{ (eval echo configure:1383: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
210 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
211 if test -z "$ac_err"; then
212 :
213@@ -1360,17 +1407,17 @@
214 do
215 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
216 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
217-echo "configure:1364: checking for $ac_hdr" >&5
218+echo "configure:1411: checking for $ac_hdr" >&5
219 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
220 echo $ac_n "(cached) $ac_c" 1>&6
221 else
222 cat > conftest.$ac_ext <<EOF
223-#line 1369 "configure"
224+#line 1416 "configure"
225 #include "confdefs.h"
226 #include <$ac_hdr>
227 EOF
228 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
229-{ (eval echo configure:1374: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
230+{ (eval echo configure:1421: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
231 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
232 if test -z "$ac_err"; then
233 rm -rf conftest*
234@@ -1397,12 +1444,12 @@
235 done
236
237 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
238-echo "configure:1401: checking for sys/wait.h that is POSIX.1 compatible" >&5
239+echo "configure:1448: checking for sys/wait.h that is POSIX.1 compatible" >&5
240 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
241 echo $ac_n "(cached) $ac_c" 1>&6
242 else
243 cat > conftest.$ac_ext <<EOF
244-#line 1406 "configure"
245+#line 1453 "configure"
246 #include "confdefs.h"
247 #include <sys/types.h>
248 #include <sys/wait.h>
249@@ -1418,7 +1465,7 @@
250 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
251 ; return 0; }
252 EOF
253-if { (eval echo configure:1422: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
254+if { (eval echo configure:1469: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
255 rm -rf conftest*
256 ac_cv_header_sys_wait_h=yes
257 else
258@@ -1439,12 +1486,12 @@
259 fi
260
261 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
262-echo "configure:1443: checking whether time.h and sys/time.h may both be included" >&5
263+echo "configure:1490: checking whether time.h and sys/time.h may both be included" >&5
264 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
265 echo $ac_n "(cached) $ac_c" 1>&6
266 else
267 cat > conftest.$ac_ext <<EOF
268-#line 1448 "configure"
269+#line 1495 "configure"
270 #include "confdefs.h"
271 #include <sys/types.h>
272 #include <sys/time.h>
273@@ -1453,7 +1500,7 @@
274 struct tm *tp;
275 ; return 0; }
276 EOF
277-if { (eval echo configure:1457: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
278+if { (eval echo configure:1504: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
279 rm -rf conftest*
280 ac_cv_header_time=yes
281 else
282@@ -1475,19 +1522,19 @@
283
284
285 echo $ac_n "checking whether errno must be declared""... $ac_c" 1>&6
286-echo "configure:1479: checking whether errno must be declared" >&5
287+echo "configure:1526: checking whether errno must be declared" >&5
288 if eval "test \"`echo '$''{'libiberty_cv_declare_errno'+set}'`\" = set"; then
289 echo $ac_n "(cached) $ac_c" 1>&6
290 else
291 cat > conftest.$ac_ext <<EOF
292-#line 1484 "configure"
293+#line 1531 "configure"
294 #include "confdefs.h"
295 #include <errno.h>
296 int main() {
297 int x = errno;
298 ; return 0; }
299 EOF
300-if { (eval echo configure:1491: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
301+if { (eval echo configure:1538: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
302 rm -rf conftest*
303 libiberty_cv_declare_errno=no
304 else
305@@ -1509,12 +1556,12 @@
306
307
308 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
309-echo "configure:1513: checking for ANSI C header files" >&5
310+echo "configure:1560: checking for ANSI C header files" >&5
311 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
312 echo $ac_n "(cached) $ac_c" 1>&6
313 else
314 cat > conftest.$ac_ext <<EOF
315-#line 1518 "configure"
316+#line 1565 "configure"
317 #include "confdefs.h"
318 #include <stdlib.h>
319 #include <stdarg.h>
320@@ -1522,7 +1569,7 @@
321 #include <float.h>
322 EOF
323 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
324-{ (eval echo configure:1526: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
325+{ (eval echo configure:1573: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
326 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
327 if test -z "$ac_err"; then
328 rm -rf conftest*
329@@ -1539,7 +1586,7 @@
330 if test $ac_cv_header_stdc = yes; then
331 # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
332 cat > conftest.$ac_ext <<EOF
333-#line 1543 "configure"
334+#line 1590 "configure"
335 #include "confdefs.h"
336 #include <string.h>
337 EOF
338@@ -1557,7 +1604,7 @@
339 if test $ac_cv_header_stdc = yes; then
340 # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
341 cat > conftest.$ac_ext <<EOF
342-#line 1561 "configure"
343+#line 1608 "configure"
344 #include "confdefs.h"
345 #include <stdlib.h>
346 EOF
347@@ -1578,7 +1625,7 @@
348 :
349 else
350 cat > conftest.$ac_ext <<EOF
351-#line 1582 "configure"
352+#line 1629 "configure"
353 #include "confdefs.h"
354 #include <ctype.h>
355 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
356@@ -1589,7 +1636,7 @@
357 exit (0); }
358
359 EOF
360-if { (eval echo configure:1593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
361+if { (eval echo configure:1640: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
362 then
363 :
364 else
365@@ -1613,12 +1660,12 @@
366 fi
367
368 echo $ac_n "checking for uintptr_t""... $ac_c" 1>&6
369-echo "configure:1617: checking for uintptr_t" >&5
370+echo "configure:1664: checking for uintptr_t" >&5
371 if eval "test \"`echo '$''{'ac_cv_type_uintptr_t'+set}'`\" = set"; then
372 echo $ac_n "(cached) $ac_c" 1>&6
373 else
374 cat > conftest.$ac_ext <<EOF
375-#line 1622 "configure"
376+#line 1669 "configure"
377 #include "confdefs.h"
378 #include <sys/types.h>
379 #if STDC_HEADERS
380@@ -1654,12 +1701,12 @@
381
382
383 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
384-echo "configure:1658: checking for pid_t" >&5
385+echo "configure:1705: checking for pid_t" >&5
386 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
387 echo $ac_n "(cached) $ac_c" 1>&6
388 else
389 cat > conftest.$ac_ext <<EOF
390-#line 1663 "configure"
391+#line 1710 "configure"
392 #include "confdefs.h"
393 #include <sys/types.h>
394 #if STDC_HEADERS
395@@ -1746,12 +1793,12 @@
396 for ac_func in asprintf atexit basename bcmp bcopy bsearch bzero calloc clock
397 do
398 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
399-echo "configure:1750: checking for $ac_func" >&5
400+echo "configure:1797: checking for $ac_func" >&5
401 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
402 echo $ac_n "(cached) $ac_c" 1>&6
403 else
404 cat > conftest.$ac_ext <<EOF
405-#line 1755 "configure"
406+#line 1802 "configure"
407 #include "confdefs.h"
408 /* System header to define __stub macros and hopefully few prototypes,
409 which can conflict with char $ac_func(); below. */
410@@ -1774,7 +1821,7 @@
411
412 ; return 0; }
413 EOF
414-if { (eval echo configure:1778: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
415+if { (eval echo configure:1825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
416 rm -rf conftest*
417 eval "ac_cv_func_$ac_func=yes"
418 else
419@@ -1801,12 +1848,12 @@
420 for ac_func in getcwd getpagesize index insque mkstemps memchr memcmp memcpy
421 do
422 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
423-echo "configure:1805: checking for $ac_func" >&5
424+echo "configure:1852: checking for $ac_func" >&5
425 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
426 echo $ac_n "(cached) $ac_c" 1>&6
427 else
428 cat > conftest.$ac_ext <<EOF
429-#line 1810 "configure"
430+#line 1857 "configure"
431 #include "confdefs.h"
432 /* System header to define __stub macros and hopefully few prototypes,
433 which can conflict with char $ac_func(); below. */
434@@ -1829,7 +1876,7 @@
435
436 ; return 0; }
437 EOF
438-if { (eval echo configure:1833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
439+if { (eval echo configure:1880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
440 rm -rf conftest*
441 eval "ac_cv_func_$ac_func=yes"
442 else
443@@ -1856,12 +1903,12 @@
444 for ac_func in memmove memset putenv random rename rindex sigsetmask
445 do
446 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
447-echo "configure:1860: checking for $ac_func" >&5
448+echo "configure:1907: checking for $ac_func" >&5
449 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
450 echo $ac_n "(cached) $ac_c" 1>&6
451 else
452 cat > conftest.$ac_ext <<EOF
453-#line 1865 "configure"
454+#line 1912 "configure"
455 #include "confdefs.h"
456 /* System header to define __stub macros and hopefully few prototypes,
457 which can conflict with char $ac_func(); below. */
458@@ -1884,7 +1931,7 @@
459
460 ; return 0; }
461 EOF
462-if { (eval echo configure:1888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
463+if { (eval echo configure:1935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
464 rm -rf conftest*
465 eval "ac_cv_func_$ac_func=yes"
466 else
467@@ -1911,12 +1958,12 @@
468 for ac_func in strcasecmp setenv strchr strdup strncasecmp strrchr strstr
469 do
470 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
471-echo "configure:1915: checking for $ac_func" >&5
472+echo "configure:1962: checking for $ac_func" >&5
473 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
474 echo $ac_n "(cached) $ac_c" 1>&6
475 else
476 cat > conftest.$ac_ext <<EOF
477-#line 1920 "configure"
478+#line 1967 "configure"
479 #include "confdefs.h"
480 /* System header to define __stub macros and hopefully few prototypes,
481 which can conflict with char $ac_func(); below. */
482@@ -1939,7 +1986,7 @@
483
484 ; return 0; }
485 EOF
486-if { (eval echo configure:1943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
487+if { (eval echo configure:1990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
488 rm -rf conftest*
489 eval "ac_cv_func_$ac_func=yes"
490 else
491@@ -1966,12 +2013,12 @@
492 for ac_func in strtod strtol strtoul tmpnam vasprintf vfprintf vprintf
493 do
494 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
495-echo "configure:1970: checking for $ac_func" >&5
496+echo "configure:2017: checking for $ac_func" >&5
497 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
498 echo $ac_n "(cached) $ac_c" 1>&6
499 else
500 cat > conftest.$ac_ext <<EOF
501-#line 1975 "configure"
502+#line 2022 "configure"
503 #include "confdefs.h"
504 /* System header to define __stub macros and hopefully few prototypes,
505 which can conflict with char $ac_func(); below. */
506@@ -1994,7 +2041,7 @@
507
508 ; return 0; }
509 EOF
510-if { (eval echo configure:1998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
511+if { (eval echo configure:2045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
512 rm -rf conftest*
513 eval "ac_cv_func_$ac_func=yes"
514 else
515@@ -2021,12 +2068,12 @@
516 for ac_func in vsprintf waitpid getrusage on_exit psignal strerror strsignal
517 do
518 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
519-echo "configure:2025: checking for $ac_func" >&5
520+echo "configure:2072: checking for $ac_func" >&5
521 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
522 echo $ac_n "(cached) $ac_c" 1>&6
523 else
524 cat > conftest.$ac_ext <<EOF
525-#line 2030 "configure"
526+#line 2077 "configure"
527 #include "confdefs.h"
528 /* System header to define __stub macros and hopefully few prototypes,
529 which can conflict with char $ac_func(); below. */
530@@ -2049,7 +2096,7 @@
531
532 ; return 0; }
533 EOF
534-if { (eval echo configure:2053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
535+if { (eval echo configure:2100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
536 rm -rf conftest*
537 eval "ac_cv_func_$ac_func=yes"
538 else
539@@ -2076,12 +2123,12 @@
540 for ac_func in sysconf times sbrk gettimeofday ffs
541 do
542 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
543-echo "configure:2080: checking for $ac_func" >&5
544+echo "configure:2127: checking for $ac_func" >&5
545 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
546 echo $ac_n "(cached) $ac_c" 1>&6
547 else
548 cat > conftest.$ac_ext <<EOF
549-#line 2085 "configure"
550+#line 2132 "configure"
551 #include "confdefs.h"
552 /* System header to define __stub macros and hopefully few prototypes,
553 which can conflict with char $ac_func(); below. */
554@@ -2104,7 +2151,7 @@
555
556 ; return 0; }
557 EOF
558-if { (eval echo configure:2108: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
559+if { (eval echo configure:2155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
560 rm -rf conftest*
561 eval "ac_cv_func_$ac_func=yes"
562 else
563@@ -2131,12 +2178,12 @@
564 for ac_func in realpath canonicalize_file_name
565 do
566 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
567-echo "configure:2135: checking for $ac_func" >&5
568+echo "configure:2182: checking for $ac_func" >&5
569 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
570 echo $ac_n "(cached) $ac_c" 1>&6
571 else
572 cat > conftest.$ac_ext <<EOF
573-#line 2140 "configure"
574+#line 2187 "configure"
575 #include "confdefs.h"
576 /* System header to define __stub macros and hopefully few prototypes,
577 which can conflict with char $ac_func(); below. */
578@@ -2159,7 +2206,7 @@
579
580 ; return 0; }
581 EOF
582-if { (eval echo configure:2163: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
583+if { (eval echo configure:2210: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
584 rm -rf conftest*
585 eval "ac_cv_func_$ac_func=yes"
586 else
587@@ -2186,12 +2233,12 @@
588 for ac_func in pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl
589 do
590 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
591-echo "configure:2190: checking for $ac_func" >&5
592+echo "configure:2237: checking for $ac_func" >&5
593 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
594 echo $ac_n "(cached) $ac_c" 1>&6
595 else
596 cat > conftest.$ac_ext <<EOF
597-#line 2195 "configure"
598+#line 2242 "configure"
599 #include "confdefs.h"
600 /* System header to define __stub macros and hopefully few prototypes,
601 which can conflict with char $ac_func(); below. */
602@@ -2214,7 +2261,7 @@
603
604 ; return 0; }
605 EOF
606-if { (eval echo configure:2218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
607+if { (eval echo configure:2265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
608 rm -rf conftest*
609 eval "ac_cv_func_$ac_func=yes"
610 else
611@@ -2443,53 +2490,6 @@
612
613 # We haven't set the list of objects yet. Use the standard autoconf
614 # tests. This will only work if the compiler works.
615- echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
616-echo "configure:2448: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
617-
618-ac_ext=c
619-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
620-ac_cpp='$CPP $CPPFLAGS'
621-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
622-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
623-cross_compiling=$ac_cv_prog_cc_cross
624-
625-cat > conftest.$ac_ext << EOF
626-
627-#line 2459 "configure"
628-#include "confdefs.h"
629-
630-main(){return(0);}
631-EOF
632-if { (eval echo configure:2464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
633- ac_cv_prog_cc_works=yes
634- # If we can't run a trivial program, we are probably using a cross compiler.
635- if (./conftest; exit) 2>/dev/null; then
636- ac_cv_prog_cc_cross=no
637- else
638- ac_cv_prog_cc_cross=yes
639- fi
640-else
641- echo "configure: failed program was:" >&5
642- cat conftest.$ac_ext >&5
643- ac_cv_prog_cc_works=no
644-fi
645-rm -fr conftest*
646-ac_ext=c
647-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
648-ac_cpp='$CPP $CPPFLAGS'
649-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
650-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
651-cross_compiling=$ac_cv_prog_cc_cross
652-
653-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
654-if test $ac_cv_prog_cc_works = no; then
655- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
656-fi
657-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
658-echo "configure:2490: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
659-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
660-cross_compiling=$ac_cv_prog_cc_cross
661-
662 for ac_func in $funcs
663 do
664 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
665diff -urN gcc-3.3.3.orig/libiberty/configure.in gcc-3.3.3/libiberty/configure.in
666--- gcc-3.3.3.orig/libiberty/configure.in 2003-11-12 12:32:30.000000000 -0500
667+++ gcc-3.3.3/libiberty/configure.in 2004-04-09 23:04:05.000000000 -0400
668@@ -100,6 +100,7 @@
669 AC_CHECK_TOOL(RANLIB, ranlib, :)
670
671 LIB_AC_PROG_CC
672+AC_PROG_CC_WORKS
673
674 AC_PROG_CC_C_O
675 # autoconf is lame and doesn't give us any substitution variable for this.
676@@ -396,7 +397,6 @@
677
678 # We haven't set the list of objects yet. Use the standard autoconf
679 # tests. This will only work if the compiler works.
680- AC_PROG_CC_WORKS
681 AC_REPLACE_FUNCS($funcs)
682 libiberty_AC_FUNC_C_ALLOCA
683 AC_FUNC_VFORK
diff --git a/meta/packages/gcc/gcc-3.3.4/reverse-compare.patch b/meta/packages/gcc/gcc-3.3.4/reverse-compare.patch
new file mode 100644
index 0000000000..7b6c1b6425
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.3.4/reverse-compare.patch
@@ -0,0 +1,31 @@
1--- gcc-3.3.3/gcc/flow.c~ 2003-07-30 01:57:24.000000000 +0100
2+++ gcc-3.3.3/gcc/flow.c 2004-04-23 19:23:43.000000000 +0100
3@@ -1904,6 +1904,7 @@
4 regset diff = INITIALIZE_REG_SET (diff_head);
5 basic_block bb_true, bb_false;
6 rtx cond_true, cond_false, set_src;
7+ enum rtx_code reversed_code;
8 int i;
9
10 /* Identify the successor blocks. */
11@@ -1934,7 +1935,11 @@
12 /* Extract the condition from the branch. */
13 set_src = SET_SRC (pc_set (bb->end));
14 cond_true = XEXP (set_src, 0);
15- cond_false = gen_rtx_fmt_ee (reverse_condition (GET_CODE (cond_true)),
16+ reversed_code = reverse_condition (GET_CODE (cond_true));
17+ if (reversed_code == UNKNOWN)
18+ goto skip;
19+
20+ cond_false = gen_rtx_fmt_ee (reversed_code,
21 GET_MODE (cond_true), XEXP (cond_true, 0),
22 XEXP (cond_true, 1));
23 if (GET_CODE (XEXP (set_src, 1)) == PC)
24@@ -1980,6 +1985,7 @@
25 });
26 }
27
28+ skip:
29 FREE_REG_SET (diff);
30 }
31 #endif
diff --git a/meta/packages/gcc/gcc-3.3.4/sdk-libstdc++-includes.patch b/meta/packages/gcc/gcc-3.3.4/sdk-libstdc++-includes.patch
new file mode 100644
index 0000000000..9eb7d01fce
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.3.4/sdk-libstdc++-includes.patch
@@ -0,0 +1,48 @@
1--- gcc-3.3.4/libstdc++-v3/testsuite/Makefile.am~ 2003-12-10 21:53:55.000000000 +0000
2+++ gcc-3.3.4/libstdc++-v3/testsuite/Makefile.am 2004-08-22 11:43:54.676189984 +0100
3@@ -53,7 +53,8 @@
4
5 INCLUDES = \
6 -nostdinc++ \
7- @GLIBCPP_INCLUDES@ @LIBSUPCXX_INCLUDES@ @TOPLEVEL_INCLUDES@
8+ @GLIBCPP_INCLUDES@ @LIBSUPCXX_INCLUDES@ @TOPLEVEL_INCLUDES@ \
9+ -I$(toplevel_srcdir)/include
10
11 ## Build support library.
12 noinst_LIBRARIES = libv3test.a
13--- gcc-3.3.4/libstdc++-v3/src/Makefile.am~ 2004-01-12 23:00:30.000000000 +0000
14+++ gcc-3.3.4/libstdc++-v3/src/Makefile.am 2004-08-22 11:12:34.838968680 +0100
15@@ -191,7 +191,8 @@
16 $(LIBSUPCXX_CXXFLAGS) \
17 $(WARN_CXXFLAGS) \
18 $(OPTIMIZE_CXXFLAGS) \
19- $(CONFIG_CXXFLAGS)
20+ $(CONFIG_CXXFLAGS) \
21+ -I$(toplevel_srcdir)/include
22
23
24 # libstdc++ libtool notes
25--- gcc-3.3.4/libstdc++-v3/testsuite/Makefile.in~ 2003-12-10 21:53:55.000000000 +0000
26+++ gcc-3.3.4/libstdc++-v3/testsuite/Makefile.in 2004-08-22 11:44:09.634915912 +0100
27@@ -175,7 +175,8 @@
28
29 INCLUDES = \
30 -nostdinc++ \
31- @GLIBCPP_INCLUDES@ @LIBSUPCXX_INCLUDES@ @TOPLEVEL_INCLUDES@
32+ @GLIBCPP_INCLUDES@ @LIBSUPCXX_INCLUDES@ @TOPLEVEL_INCLUDES@ \
33+ -I$(toplevel_srcdir)/include
34
35
36 noinst_LIBRARIES = libv3test.a
37--- gcc-3.3.4/libstdc++-v3/src/Makefile.in~ 2004-01-12 23:00:29.000000000 +0000
38+++ gcc-3.3.4/libstdc++-v3/src/Makefile.in 2004-08-22 11:27:29.380977624 +0100
39@@ -263,7 +263,8 @@
40 $(LIBSUPCXX_CXXFLAGS) \
41 $(WARN_CXXFLAGS) \
42 $(OPTIMIZE_CXXFLAGS) \
43- $(CONFIG_CXXFLAGS)
44+ $(CONFIG_CXXFLAGS) \
45+ -I$(toplevel_srcdir)/include
46
47
48 # libstdc++ libtool notes
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
diff --git a/meta/packages/gcc/gcc-3.4.4/15342.patch b/meta/packages/gcc/gcc-3.4.4/15342.patch
new file mode 100644
index 0000000000..d0f3e72d47
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/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.4/GCC3.4.0VisibilityPatch.diff b/meta/packages/gcc/gcc-3.4.4/GCC3.4.0VisibilityPatch.diff
new file mode 100644
index 0000000000..d51da7157d
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/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.4/always-fixincperm.patch b/meta/packages/gcc/gcc-3.4.4/always-fixincperm.patch
new file mode 100644
index 0000000000..59e5e2edeb
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/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.4/gcc-3.4.0-arm-bigendian-uclibc.patch b/meta/packages/gcc/gcc-3.4.4/gcc-3.4.0-arm-bigendian-uclibc.patch
new file mode 100644
index 0000000000..8fa9af880a
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/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.4/gcc-3.4.0-arm-bigendian.patch b/meta/packages/gcc/gcc-3.4.4/gcc-3.4.0-arm-bigendian.patch
new file mode 100644
index 0000000000..c9288c6c15
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/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.4/gcc-3.4.0-arm-lib1asm.patch b/meta/packages/gcc/gcc-3.4.4/gcc-3.4.0-arm-lib1asm.patch
new file mode 100644
index 0000000000..ca42bfbc0a
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/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.4/gcc-3.4.0-arm-nolibfloat.patch b/meta/packages/gcc/gcc-3.4.4/gcc-3.4.0-arm-nolibfloat.patch
new file mode 100644
index 0000000000..43eed3ef28
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/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.4/gcc-3.4.0-arm-softfloat.patch b/meta/packages/gcc/gcc-3.4.4/gcc-3.4.0-arm-softfloat.patch
new file mode 100644
index 0000000000..f53d64b374
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/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.4/gcc-3.4.1-uclibc-100-conf.patch b/meta/packages/gcc/gcc-3.4.4/gcc-3.4.1-uclibc-100-conf.patch
new file mode 100644
index 0000000000..29e4c802e2
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/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.4/gcc-3.4.1-uclibc-200-locale.patch b/meta/packages/gcc/gcc-3.4.4/gcc-3.4.1-uclibc-200-locale.patch
new file mode 100644
index 0000000000..3fc4900b06
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/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.4/gcc-uclibc-3.4.0-120-softfloat.patch b/meta/packages/gcc/gcc-3.4.4/gcc-uclibc-3.4.0-120-softfloat.patch
new file mode 100644
index 0000000000..f2431896cf
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/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.4/gcc34-arm-ldm-peephole.patch b/meta/packages/gcc/gcc-3.4.4/gcc34-arm-ldm-peephole.patch
new file mode 100644
index 0000000000..92ad25d09c
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/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/genpeep.c.arm-ldm-peephole 2003-07-05 01:27:22.000000000 -0400
31+++ gcc-3.4.0/gcc/genpeep.c 2004-04-24 18:18:04.000000000 -0400
32@@ -381,6 +381,7 @@
33 printf ("#include \"recog.h\"\n");
34 printf ("#include \"except.h\"\n\n");
35 printf ("#include \"function.h\"\n\n");
36+ printf ("#include \"flags.h\"\n\n");
37
38 printf ("#ifdef HAVE_peephole\n");
39 printf ("extern rtx peep_operand[];\n\n");
40--- gcc/gcc/config/arm/arm.c.orig 2005-06-02 22:40:40.000000000 +0100
41+++ gcc/gcc/config/arm/arm.c 2005-06-02 22:45:45.000000000 +0100
42@@ -4610,9 +4610,12 @@
43 if (arm_eliminable_register (reg0))
44 return 0;
45
46+ /* For Harvard cores, only accept pairs where one offset is zero.
47+ See comment in load_multiple_sequence. */
48 val_diff = val1 - val0;
49 return ((REGNO (reg0) == REGNO (reg1))
50- && (val_diff == 4 || val_diff == -4));
51+ && (val_diff == 4 || val_diff == -4))
52+ && (!arm_ld_sched || val0 == 0 || val1 == 0);
53 }
54
55 return 0;
56@@ -4857,6 +4860,11 @@
57 *load_offset = unsorted_offsets[order[0]];
58 }
59
60+ /* For XScale a two-word LDM is a performance loss, so only do this if
61+ size is more important. See comments in arm_gen_load_multiple. */
62+ if (nops == 2 && arm_tune_xscale && !optimize_size)
63+ return 0;
64+
65 if (unsorted_offsets[order[0]] == 0)
66 return 1; /* ldmia */
67
68@@ -5083,6 +5091,11 @@
69 *load_offset = unsorted_offsets[order[0]];
70 }
71
72+ /* For XScale a two-word LDM is a performance loss, so only do this if
73+ size is more important. See comments in arm_gen_load_multiple. */
74+ if (nops == 2 && arm_tune_xscale && !optimize_size)
75+ return 0;
76+
77 if (unsorted_offsets[order[0]] == 0)
78 return 1; /* stmia */
79
diff --git a/meta/packages/gcc/gcc-3.4.4/gcc34-arm-ldm.patch b/meta/packages/gcc/gcc-3.4.4/gcc34-arm-ldm.patch
new file mode 100644
index 0000000000..142052fdf0
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/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.4/gcc34-arm-tune.patch b/meta/packages/gcc/gcc-3.4.4/gcc34-arm-tune.patch
new file mode 100644
index 0000000000..cdb20bef9b
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/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.4/gcc34-configure.in.patch b/meta/packages/gcc/gcc-3.4.4/gcc34-configure.in.patch
new file mode 100644
index 0000000000..3d33bcb978
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/gcc34-configure.in.patch
@@ -0,0 +1,22 @@
1--- gcc-3.4.4/configure.in.orig 2005-08-09 19:57:51.504323183 -0700
2+++ gcc-3.4.4/configure.in 2005-08-09 20:00:12.073168623 -0700
3@@ -1907,7 +1907,7 @@
4 *) gxx_include_dir=${with_gxx_include_dir} ;;
5 esac
6
7-FLAGS_FOR_TARGET=
8+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
9 case " $target_configdirs " in
10 *" newlib "*)
11 case " $target_configargs " in
12--- gcc-3.4.4/configure.orig 2005-08-09 21:02:29.668360660 -0700
13+++ gcc-3.4.4/configure 2005-08-09 21:02:50.157649970 -0700
14@@ -2669,7 +2669,7 @@
15 *) gxx_include_dir=${with_gxx_include_dir} ;;
16 esac
17
18-FLAGS_FOR_TARGET=
19+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
20 case " $target_configdirs " in
21 *" newlib "*)
22 case " $target_configargs " in
diff --git a/meta/packages/gcc/gcc-3.4.4/gcc34-reverse-compare.patch b/meta/packages/gcc/gcc-3.4.4/gcc34-reverse-compare.patch
new file mode 100644
index 0000000000..c3c40dd183
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/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.4/gcc34-thumb-support.patch b/meta/packages/gcc/gcc-3.4.4/gcc34-thumb-support.patch
new file mode 100644
index 0000000000..a4f156f8db
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/gcc34-thumb-support.patch
@@ -0,0 +1,156 @@
1# This patch contains various fixes for the thumb code handling in GCC 3.4.4
2#
3# Most of these are minor fixes to code which is either missing (Linux thumb
4# div0, thumb clear instruction cache) or uses the wrong return mechanism
5# (libffi)
6#
7# There is also a significant design problem with the _call_via_rx code -
8# it cannot be in a shared library because a call via PLT simply won't
9# work (for _call_via_ip) and is very inefficient anyway.
10#
11# This is fixed in uclibc simply by incorporating the code into crti.S
12# (an extra 30 bytes for the 15 functions) even though not all link units
13# require all the code - there is so little of it. That doesn't work with
14# the crti.asm here because it is linked with libgcc.a which already defines
15# these symbols
16#
17--- gcc-3.4.4/gcc/config/arm/t-linux.orig 2005-08-09 08:55:02.181797492 -0700
18+++ gcc-3.4.4/gcc/config/arm/t-linux 2005-08-09 08:58:22.766419486 -0700
19@@ -7,6 +7,7 @@
20 LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
21 _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
22 _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
23+ _call_via_rX \
24 _fixsfsi _fixunssfsi
25
26 # MULTILIB_OPTIONS = mhard-float/msoft-float
27--- gcc-3.4.4/.pc/gcc34-thumb-support.patch/gcc/config/arm/lib1funcs.asm 2004-01-15 08:56:34.000000000 -0800
28+++ gcc-3.4.4/gcc/config/arm/lib1funcs.asm 2005-09-21 21:32:03.376927755 -0700
29@@ -811,13 +811,18 @@
30
31 /* Constants taken from <asm/unistd.h> and <asm/signal.h> */
32 #define SIGFPE 8
33+#if !defined __thumb__
34 #define __NR_SYSCALL_BASE 0x900000
35+#else
36+#define __NR_SYSCALL_BASE 0
37+#endif
38 #define __NR_getpid (__NR_SYSCALL_BASE+ 20)
39 #define __NR_kill (__NR_SYSCALL_BASE+ 37)
40
41 .code 32
42 FUNC_START div0
43
44+#if ! defined __thumb__
45 stmfd sp!, {r1, lr}
46 swi __NR_getpid
47 cmn r0, #1000
48@@ -825,6 +830,28 @@
49 mov r1, #SIGFPE
50 swi __NR_kill
51 RETLDM r1
52+#else
53+ push {r1, r7, lr}
54+ mov r7, #__NR_getpid
55+ swi 0
56+ @ above the compare is with -1000, but the standard syscall
57+ @ macro checks for -1..-125
58+ add r0, #125
59+ bcs 90f
60+ sub r0, #125
61+ mov r1, #SIGFPE
62+ mov r7, #__NR_kill
63+ swi 0
64+90:
65+#if __ARM_ARCH__ > 4
66+ pop {r1, r7, pc}
67+#else
68+ @ on 4T that won't work
69+ pop {r1, r7}
70+ pop {r3}
71+ bx r3
72+#endif
73+#endif
74
75 FUNC_END div0
76
77@@ -845,14 +872,14 @@
78 code here switches to the correct mode before executing the function. */
79
80 .text
81- .align 0
82+ .align 1
83 .force_thumb
84
85 .macro call_via register
86 THUMB_FUNC_START _call_via_\register
87+ .hidden SYM (_call_via_\register)
88
89 bx \register
90- nop
91
92 SIZE (_call_via_\register)
93 .endm
94@@ -903,6 +930,7 @@
95 .code 16
96
97 THUMB_FUNC_START _interwork_call_via_\register
98+ .hidden SYM (_interwork_call_via_\register)
99
100 bx pc
101 nop
102--- gcc-3.4.4/.pc/gcc34-thumb-support.patch/gcc/config/arm/linux-gas.h 2003-06-19 14:47:06.000000000 -0700
103+++ gcc-3.4.4/gcc/config/arm/linux-gas.h 2005-09-20 16:09:55.027862200 -0700
104@@ -56,6 +56,7 @@
105
106 /* Clear the instruction cache from `beg' to `end'. This makes an
107 inline system call to SYS_cacheflush. */
108+#if !defined(__thumb__)
109 #define CLEAR_INSN_CACHE(BEG, END) \
110 { \
111 register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \
112@@ -65,3 +66,18 @@
113 : "=r" (_beg) \
114 : "0" (_beg), "r" (_end), "r" (_flg)); \
115 }
116+#else
117+#define CLEAR_INSN_CACHE(BEG, END) \
118+{ \
119+ register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \
120+ register unsigned long _end __asm ("a2") = (unsigned long) (END); \
121+ register unsigned long _flg __asm ("a3") = 0; \
122+ register unsigned long _swi __asm ("a4") = 0xf0002; \
123+ __asm __volatile ("push {r7}\n" \
124+ " mov r7,a4\n" \
125+ " swi 0 @ sys_cacheflush\n" \
126+ " pop {r7}\n" \
127+ : "=r" (_beg) \
128+ : "0" (_beg), "r" (_end), "r" (_flg), "r" (_swi)); \
129+}
130+#endif
131--- gcc-3.4.4/.pc/gcc34-thumb-support.patch/libffi/src/arm/sysv.S 2003-10-21 12:01:55.000000000 -0700
132+++ gcc-3.4.4/libffi/src/arm/sysv.S 2005-09-20 16:09:55.027862200 -0700
133@@ -41,6 +41,14 @@
134 #define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x):
135 #endif
136
137+/* Get the correct return instruction */
138+#if defined(__ARM_ARCH_4T__) || defined(__ARM_ARCH_5__) \
139+ || defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5TE__)
140+#define RET bx r
141+#else
142+#define RET mov pc,
143+#endif
144+
145 .text
146
147 # a1: ffi_prep_args
148@@ -66,7 +74,7 @@
149
150 # And call
151 mov lr, pc
152- mov pc, ip
153+ RET ip
154
155 # move first 4 parameters in registers
156 ldr a1, [sp, #0]
diff --git a/meta/packages/gcc/gcc-3.4.4/sdk-libstdc++-includes.patch b/meta/packages/gcc/gcc-3.4.4/sdk-libstdc++-includes.patch
new file mode 100644
index 0000000000..4377c2143b
--- /dev/null
+++ b/meta/packages/gcc/gcc-3.4.4/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
diff --git a/meta/packages/gcc/gcc-4.0.2/100-uclibc-conf.patch b/meta/packages/gcc/gcc-4.0.2/100-uclibc-conf.patch
new file mode 100644
index 0000000000..35445522f8
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.0.2/100-uclibc-conf.patch
@@ -0,0 +1,556 @@
1From:
2http://buildroot.uclibc.org/cgi-bin/viewcvs.cgi/*checkout*/trunk/buildroot/toolchain/gcc/4.0.2/100-uclibc-conf.patch?rev=13898
3
4--- gcc-4.0.2/gcc/config/t-linux-uclibc
5+++ gcc-4.0.2/gcc/config/t-linux-uclibc
6@@ -0,0 +1,5 @@
7+# Remove glibc specific files added in t-linux
8+SHLIB_MAPFILES := $(filter-out $(srcdir)/config/libgcc-glibc.ver, $(SHLIB_MAPFILES))
9+
10+# Use unwind-dw2-fde instead of unwind-dw2-fde-glibc
11+LIB2ADDEH := $(subst unwind-dw2-fde-glibc.c,unwind-dw2-fde.c,$(LIB2ADDEH))
12--- gcc-4.0.2/gcc/config.gcc
13+++ gcc-4.0.2/gcc/config.gcc
14@@ -1778,7 +1778,7 @@
15 ;;
16 sh-*-elf* | sh[12346l]*-*-elf* | sh*-*-kaos* | \
17 sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
18- sh-*-linux* | sh[346lbe]*-*-linux* | \
19+ sh*-*-linux* | sh[346lbe]*-*-linux* | \
20 sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
21 sh64-*-netbsd* | sh64l*-*-netbsd*)
22 tmake_file="${tmake_file} sh/t-sh sh/t-elf"
23@@ -2234,10 +2234,16 @@
24 *)
25 echo "*** Configuration ${target} not supported" 1>&2
26 exit 1
27 ;;
28 esac
29+
30+# Rather than hook into each target, just do it after all the linux
31+# targets have been processed
32+case ${target} in
33+*-linux-uclibc*) tm_defines="${tm_defines} USE_UCLIBC" ; tmake_file="${tmake_file} t-linux-uclibc"
34+esac
35
36 case ${target} in
37 i[34567]86-*-linux*aout* | i[34567]86-*-linux*libc1)
38 tmake_file="${tmake_file} i386/t-gmm_malloc"
39 ;;
40--- gcc-4.0.2/gcc/config/alpha/linux-elf.h
41+++ gcc-4.0.2/gcc/config/alpha/linux-elf.h
42@@ -27,7 +27,11 @@
43 #define SUBTARGET_EXTRA_SPECS \
44 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
45
46+#ifdef USE_UCLIBC
47+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
48+#else
49 #define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
50+#endif
51
52 #define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \
53 %{O*:-O3} %{!O*:-O1} \
54--- gcc-4.0.2/gcc/config/arm/linux-elf.h
55+++ gcc-4.0.2/gcc/config/arm/linux-elf.h
56@@ -81,14 +81,19 @@
57 #define ENDFILE_SPEC \
58 "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
59
60+#ifdef USE_UCLIBC
61+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
62+#else
63+#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
64+#endif
65 #undef LINK_SPEC
66 #define LINK_SPEC "%{h*} %{version:-v} \
67 %{b} %{Wl,*:%*} \
68 %{static:-Bstatic} \
69 %{shared:-shared} \
70 %{symbolic:-Bsymbolic} \
71 %{rdynamic:-export-dynamic} \
72- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
73+ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "} \
74 -X \
75 %{mbig-endian:-EB}" \
76 SUBTARGET_EXTRA_LINK_SPEC
77--- gcc-4.0.2/gcc/config/cris/linux.h
78+++ gcc-4.0.2/gcc/config/cris/linux.h
79@@ -79,6 +79,25 @@
80 #undef CRIS_DEFAULT_CPU_VERSION
81 #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
82
83+#ifdef USE_UCLIBC
84+
85+#undef CRIS_SUBTARGET_VERSION
86+#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc"
87+
88+#undef CRIS_LINK_SUBTARGET_SPEC
89+#define CRIS_LINK_SUBTARGET_SPEC \
90+ "-mcrislinux\
91+ -rpath-link include/asm/../..%s\
92+ %{shared} %{static}\
93+ %{symbolic:-Bdynamic} %{shlib:-Bdynamic} %{static:-Bstatic}\
94+ %{!shared: \
95+ %{!static: \
96+ %{rdynamic:-export-dynamic} \
97+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} \
98+ %{!r:%{O2|O3: --gc-sections}}"
99+
100+#else /* USE_UCLIBC */
101+
102 #undef CRIS_SUBTARGET_VERSION
103 #define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
104
105@@ -93,6 +112,8 @@
106 %{!shared:%{!static:%{rdynamic:-export-dynamic}}}\
107 %{!r:%{O2|O3: --gc-sections}}"
108
109+#endif /* USE_UCLIBC */
110+
111
112 /* Node: Run-time Target */
113
114--- gcc-4.0.2/gcc/config/i386/linux.h
115+++ gcc-4.0.2/gcc/config/i386/linux.h
116@@ -107,6 +107,11 @@
117 #define LINK_EMULATION "elf_i386"
118 #define DYNAMIC_LINKER "/lib/ld-linux.so.2"
119
120+#ifdef USE_UCLIBC
121+#undef DYNAMIC_LINKER
122+#define DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
123+#endif
124+
125 #undef SUBTARGET_EXTRA_SPECS
126 #define SUBTARGET_EXTRA_SPECS \
127 { "link_emulation", LINK_EMULATION },\
128--- gcc-4.0.2/gcc/config/i386/linux64.h
129+++ gcc-4.0.2/gcc/config/i386/linux64.h
130@@ -54,14 +54,21 @@
131 When the -shared link option is used a final link is not being
132 done. */
133
134+#ifdef USE_UCLIBC
135+#define ELF32_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
136+#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0"
137+#else
138+#define ELF32_DYNAMIC_LINKER "/lib/ld-linux.so.2"
139+#define ELF64_DYNAMIC_LINKER "/lib64/ld-linux-x86-64.so.2"
140+#endif
141 #undef LINK_SPEC
142 #define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \
143 %{shared:-shared} \
144 %{!shared: \
145 %{!static: \
146 %{rdynamic:-export-dynamic} \
147- %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
148- %{!m32:%{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}}} \
149+ %{m32:%{!dynamic-linker:-dynamic-linker " ELF32_DYNAMIC_LINKER "}} \
150+ %{!m32:%{!dynamic-linker:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}} \
151 %{static:-static}}"
152
153 #define MULTILIB_DEFAULTS { "m64" }
154--- gcc-4.0.2/gcc/config/ia64/linux.h
155+++ gcc-4.0.2/gcc/config/ia64/linux.h
156@@ -37,13 +37,18 @@
157 /* Define this for shared library support because it isn't in the main
158 linux.h file. */
159
160+#ifdef USE_UCLIBC
161+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
162+#else
163+#define ELF_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
164+#endif
165 #undef LINK_SPEC
166 #define LINK_SPEC "\
167 %{shared:-shared} \
168 %{!shared: \
169 %{!static: \
170 %{rdynamic:-export-dynamic} \
171- %{!dynamic-linker:-dynamic-linker /lib/ld-linux-ia64.so.2}} \
172+ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
173 %{static:-static}}"
174
175
176--- gcc-4.0.2/gcc/config/m68k/linux.h
177+++ gcc-4.0.2/gcc/config/m68k/linux.h
178@@ -127,12 +127,17 @@
179
180 /* If ELF is the default format, we should not use /lib/elf. */
181
182+#ifdef USE_UCLIBC
183+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
184+#else
185+#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
186+#endif
187 #undef LINK_SPEC
188 #define LINK_SPEC "-m m68kelf %{shared} \
189 %{!shared: \
190 %{!static: \
191 %{rdynamic:-export-dynamic} \
192- %{!dynamic-linker*:-dynamic-linker /lib/ld.so.1}} \
193+ %{!dynamic-linker*:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
194 %{static}}"
195
196 /* For compatibility with linux/a.out */
197--- gcc-4.0.2/gcc/config/mips/linux.h
198+++ gcc-4.0.2/gcc/config/mips/linux.h
199@@ -108,14 +108,19 @@
200
201 /* Borrowed from sparc/linux.h */
202 #undef LINK_SPEC
203+#ifdef USE_UCLIBC
204+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
205+#else
206+#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
207+#endif
208 #define LINK_SPEC \
209 "%(endian_spec) \
210 %{shared:-shared} \
211 %{!shared: \
212 %{!ibcs: \
213 %{!static: \
214 %{rdynamic:-export-dynamic} \
215- %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
216+ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
217 %{static:-static}}}"
218
219 #undef SUBTARGET_ASM_SPEC
220--- gcc-4.0.2/gcc/config/pa/pa-linux.h
221+++ gcc-4.0.2/gcc/config/pa/pa-linux.h
222@@ -82,13 +82,18 @@
223 /* Define this for shared library support because it isn't in the main
224 linux.h file. */
225
226+#ifdef USE_UCLIBC
227+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
228+#else
229+#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
230+#endif
231 #undef LINK_SPEC
232 #define LINK_SPEC "\
233 %{shared:-shared} \
234 %{!shared: \
235 %{!static: \
236 %{rdynamic:-export-dynamic} \
237- %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
238+ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
239 %{static:-static}}"
240
241 /* glibc's profiling functions don't need gcc to allocate counters. */
242--- gcc-4.0.2/gcc/config/rs6000/linux.h
243+++ gcc-4.0.2/gcc/config/rs6000/linux.h
244@@ -69,7 +69,11 @@
245 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
246
247 #undef LINK_OS_DEFAULT_SPEC
248+#ifdef USE_UCLIBC
249+#define LINK_OS_DEFAULT_SPEC "%(link_os_linux_uclibc)"
250+#else
251 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
252+#endif
253
254 #define LINK_GCC_C_SEQUENCE_SPEC \
255 "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
256--- gcc-4.0.2/gcc/config/rs6000/sysv4.h
257+++ gcc-4.0.2/gcc/config/rs6000/sysv4.h
258@@ -949,6 +949,7 @@
259 mcall-linux : %(link_os_linux) ; \
260 mcall-gnu : %(link_os_gnu) ; \
261 mcall-netbsd : %(link_os_netbsd) ; \
262+ mcall-linux-uclibc : %(link_os_linux_uclibc); \
263 mcall-openbsd: %(link_os_openbsd) ; \
264 : %(link_os_default) }"
265
266@@ -1127,6 +1128,10 @@
267 %{rdynamic:-export-dynamic} \
268 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
269
270+#define LINK_OS_LINUX_UCLIBC_SPEC "-m elf32ppclinux %{!shared: %{!static: \
271+ %{rdynamic:-export-dynamic} \
272+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}}"
273+
274 #if defined(HAVE_LD_EH_FRAME_HDR)
275 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
276 #endif
277@@ -1293,6 +1298,7 @@
278 { "link_os_sim", LINK_OS_SIM_SPEC }, \
279 { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
280 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
281+ { "link_os_linux_uclibc", LINK_OS_LINUX_UCLIBC_SPEC }, \
282 { "link_os_gnu", LINK_OS_GNU_SPEC }, \
283 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
284 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
285--- gcc-4.0.2/gcc/config/s390/linux.h
286+++ gcc-4.0.2/gcc/config/s390/linux.h
287@@ -77,6 +77,13 @@
288 #define MULTILIB_DEFAULTS { "m31" }
289 #endif
290
291+#ifdef USE_UCLIBC
292+#define ELF31_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
293+#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0"
294+#else
295+#define ELF31_DYNAMIC_LINKER "/lib/ld.so.1"
296+#define ELF64_DYNAMIC_LINKER "/lib/ld64.so.1"
297+#endif
298 #undef LINK_SPEC
299 #define LINK_SPEC \
300 "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
301@@ -86,8 +93,8 @@
302 %{!static: \
303 %{rdynamic:-export-dynamic} \
304 %{!dynamic-linker: \
305- %{m31:-dynamic-linker /lib/ld.so.1} \
306- %{m64:-dynamic-linker /lib/ld64.so.1}}}}"
307+ %{m31:-dynamic-linker " ELF31_DYNAMIC_LINKER "} \
308+ %{m64:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}}}"
309
310
311 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
312--- gcc-4.0.2/gcc/config/sh/linux.h
313+++ gcc-4.0.2/gcc/config/sh/linux.h
314@@ -67,11 +67,16 @@
315 #undef SUBTARGET_LINK_EMUL_SUFFIX
316 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
317 #undef SUBTARGET_LINK_SPEC
318+#ifdef USE_UCLIBC
319+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
320+#else
321+#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
322+#endif
323 #define SUBTARGET_LINK_SPEC \
324 "%{shared:-shared} \
325 %{!static: \
326 %{rdynamic:-export-dynamic} \
327- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
328+ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
329 %{static:-static}"
330
331 #undef LIB_SPEC
332--- gcc-4.0.2/gcc/config/sparc/linux.h
333+++ gcc-4.0.2/gcc/config/sparc/linux.h
334@@ -130,14 +130,19 @@
335
336 /* If ELF is the default format, we should not use /lib/elf. */
337
338+#ifdef USE_UCLIBC
339+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
340+#else
341+#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
342+#endif
343 #undef LINK_SPEC
344 #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
345 %{!mno-relax:%{!r:-relax}} \
346 %{!shared: \
347 %{!ibcs: \
348 %{!static: \
349 %{rdynamic:-export-dynamic} \
350- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
351+ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
352 %{static:-static}}}"
353
354 /* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
355--- gcc-4.0.2/gcc/config/sparc/linux64.h
356+++ gcc-4.0.2/gcc/config/sparc/linux64.h
357@@ -167,12 +166,17 @@
358 { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
359 { "link_arch", LINK_ARCH_SPEC },
360
361+#ifdef USE_UCLIBC
362+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
363+#else
364+#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
365+#endif
366 #define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
367 %{!shared: \
368 %{!ibcs: \
369 %{!static: \
370 %{rdynamic:-export-dynamic} \
371- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
372+ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
373 %{static:-static}}} \
374 "
375
376--- gcc-4.0.2/libtool.m4
377+++ gcc-4.0.2/libtool.m4
378@@ -682,6 +682,11 @@
379 lt_cv_deplibs_check_method=pass_all
380 ;;
381
382+linux-uclibc*)
383+ lt_cv_deplibs_check_method=pass_all
384+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
385+ ;;
386+
387 netbsd* | knetbsd*-gnu)
388 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
389 [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
390--- gcc-4.0.2/ltconfig
391+++ gcc-4.0.2/ltconfig
392@@ -603,6 +603,7 @@
393
394 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
395 case $host_os in
396+linux-uclibc*) ;;
397 linux-gnu*) ;;
398 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
399 esac
400@@ -1274,6 +1275,23 @@
401 dynamic_linker='GNU/Linux ld.so'
402 ;;
403
404+linux-uclibc*)
405+ version_type=linux
406+ need_lib_prefix=no
407+ need_version=no
408+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
409+ soname_spec='${libname}${release}.so$major'
410+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
411+ shlibpath_var=LD_LIBRARY_PATH
412+ shlibpath_overrides_runpath=no
413+ # This implies no fast_install, which is unacceptable.
414+ # Some rework will be needed to allow for fast_install
415+ # before this can be enabled.
416+ hardcode_into_libs=yes
417+ # Assume using the uClibc dynamic linker.
418+ dynamic_linker="uClibc ld.so"
419+ ;;
420+
421 netbsd*)
422 need_lib_prefix=no
423 need_version=no
424--- gcc-4.0.2/libffi/configure
425+++ gcc-4.0.2/libffi/configure
426@@ -3457,6 +3457,11 @@
427 lt_cv_deplibs_check_method=pass_all
428 ;;
429
430+linux-uclibc*)
431+ lt_cv_deplibs_check_method=pass_all
432+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
433+ ;;
434+
435 netbsd* | knetbsd*-gnu)
436 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
437 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
438--- gcc-4.0.2/libgfortran/configure
439+++ gcc-4.0.2/libgfortran/configure
440@@ -3681,6 +3681,11 @@
441 lt_cv_deplibs_check_method=pass_all
442 ;;
443
444+linux-uclibc*)
445+ lt_cv_deplibs_check_method=pass_all
446+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
447+ ;;
448+
449 netbsd* | knetbsd*-gnu)
450 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
451 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
452--- gcc-4.0.2/libjava/configure
453+++ gcc-4.0.2/libjava/configure
454@@ -4351,6 +4351,11 @@
455 lt_cv_deplibs_check_method=pass_all
456 ;;
457
458+linux-uclibc*)
459+ lt_cv_deplibs_check_method=pass_all
460+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
461+ ;;
462+
463 netbsd* | knetbsd*-gnu)
464 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
465 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
466--- gcc-4.0.2/libmudflap/configure
467+++ gcc-4.0.2/libmudflap/configure
468@@ -5380,6 +5380,11 @@
469 lt_cv_deplibs_check_method=pass_all
470 ;;
471
472+linux-uclibc*)
473+ lt_cv_deplibs_check_method=pass_all
474+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
475+ ;;
476+
477 netbsd* | knetbsd*-gnu)
478 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
479 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
480--- gcc-4.0.2/libobjc/configure
481+++ gcc-4.0.2/libobjc/configure
482@@ -3283,6 +3283,11 @@
483 lt_cv_deplibs_check_method=pass_all
484 ;;
485
486+linux-uclibc*)
487+ lt_cv_deplibs_check_method=pass_all
488+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
489+ ;;
490+
491 netbsd* | knetbsd*-gnu)
492 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
493 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
494--- gcc-4.0.2/boehm-gc/configure
495+++ gcc-4.0.2/boehm-gc/configure
496@@ -4320,6 +4320,11 @@
497 lt_cv_deplibs_check_method=pass_all
498 ;;
499
500+linux-uclibc*)
501+ lt_cv_deplibs_check_method=pass_all
502+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
503+ ;;
504+
505 netbsd* | knetbsd*-gnu)
506 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
507 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
508--- gcc-4.0.2/configure
509+++ gcc-4.0.2/configure
510@@ -1141,7 +1141,7 @@
511 ;;
512 "")
513 case "${target}" in
514- *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu)
515+ *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*)
516 # Enable libmudflap by default in GNU and friends.
517 ;;
518 *-*-freebsd*)
519--- gcc-4.0.2/configure.in
520+++ gcc-4.0.2/configure.in
521@@ -350,7 +350,7 @@
522 ;;
523 "")
524 case "${target}" in
525- *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu)
526+ *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*)
527 # Enable libmudflap by default in GNU and friends.
528 ;;
529 *-*-freebsd*)
530--- gcc-4.0.2/contrib/regression/objs-gcc.sh
531+++ gcc-4.0.2/contrib/regression/objs-gcc.sh
532@@ -105,6 +105,10 @@
533 then
534 make all-gdb all-dejagnu all-ld || exit 1
535 make install-gdb install-dejagnu install-ld || exit 1
536+elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
537+ then
538+ make all-gdb all-dejagnu all-ld || exit 1
539+ make install-gdb install-dejagnu install-ld || exit 1
540 elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
541 make bootstrap || exit 1
542 make install || exit 1
543--- gcc-4.0.2/zlib/configure
544+++ gcc-4.0.2/zlib/configure
545@@ -3426,6 +3426,11 @@
546 lt_cv_deplibs_check_method=pass_all
547 ;;
548
549+linux-uclibc*)
550+ lt_cv_deplibs_check_method=pass_all
551+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
552+ ;;
553+
554 netbsd* | knetbsd*-gnu)
555 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
556 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
diff --git a/meta/packages/gcc/gcc-4.0.2/200-uclibc-locale.patch b/meta/packages/gcc/gcc-4.0.2/200-uclibc-locale.patch
new file mode 100644
index 0000000000..8be03a5446
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.0.2/200-uclibc-locale.patch
@@ -0,0 +1,3240 @@
1From:
2http://buildroot.uclibc.org/cgi-bin/viewcvs.cgi/*checkout*/trunk/buildroot/toolchain/gcc/4.0.2/200-uclibc-locale.patch?rev=11715
3
4diff -urN gcc-4.0.0-100/libstdc++-v3/acinclude.m4 gcc-4.0.0/libstdc++-v3/acinclude.m4
5--- gcc-4.0.0-100/libstdc++-v3/acinclude.m4 2005-04-30 13:06:53.000000000 -0500
6+++ gcc-4.0.0/libstdc++-v3/acinclude.m4 2005-04-28 20:19:01.000000000 -0500
7@@ -1104,7 +1104,7 @@
8 AC_MSG_CHECKING([for C locale to use])
9 GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
10 [use MODEL for target locale package],
11- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
12+ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
13
14 # If they didn't use this option switch, or if they specified --enable
15 # with no specific model, we'll have to look for one. If they
16@@ -1120,6 +1120,9 @@
17 # Default to "generic".
18 if test $enable_clocale_flag = auto; then
19 case ${target_os} in
20+ *-uclibc*)
21+ enable_clocale_flag=uclibc
22+ ;;
23 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
24 AC_EGREP_CPP([_GLIBCXX_ok], [
25 #include <features.h>
26@@ -1263,6 +1266,40 @@
27 CTIME_CC=config/locale/generic/time_members.cc
28 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
29 ;;
30+ uclibc)
31+ AC_MSG_RESULT(uclibc)
32+
33+ # Declare intention to use gettext, and add support for specific
34+ # languages.
35+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
36+ ALL_LINGUAS="de fr"
37+
38+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
39+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
40+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
41+ USE_NLS=yes
42+ fi
43+ # Export the build objects.
44+ for ling in $ALL_LINGUAS; do \
45+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
46+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
47+ done
48+ AC_SUBST(glibcxx_MOFILES)
49+ AC_SUBST(glibcxx_POFILES)
50+
51+ CLOCALE_H=config/locale/uclibc/c_locale.h
52+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
53+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
54+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
55+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
56+ CMESSAGES_H=config/locale/uclibc/messages_members.h
57+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
58+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
59+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
60+ CTIME_H=config/locale/uclibc/time_members.h
61+ CTIME_CC=config/locale/uclibc/time_members.cc
62+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
63+ ;;
64 esac
65
66 # This is where the testsuite looks for locale catalogs, using the
67diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
68--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1969-12-31 18:00:00.000000000 -0600
69+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2005-04-28 01:13:15.000000000 -0500
70@@ -0,0 +1,59 @@
71+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
72+
73+// Copyright (C) 2002, 2004 Free Software Foundation, Inc.
74+//
75+// This file is part of the GNU ISO C++ Library. This library is free
76+// software; you can redistribute it and/or modify it under the
77+// terms of the GNU General Public License as published by the
78+// Free Software Foundation; either version 2, or (at your option)
79+// any later version.
80+
81+// This library is distributed in the hope that it will be useful,
82+// but WITHOUT ANY WARRANTY; without even the implied warranty of
83+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
84+// GNU General Public License for more details.
85+
86+// You should have received a copy of the GNU General Public License along
87+// with this library; see the file COPYING. If not, write to the Free
88+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
89+// USA.
90+
91+// As a special exception, you may use this file as part of a free software
92+// library without restriction. Specifically, if other files instantiate
93+// templates or use macros or inline functions from this file, or you compile
94+// this file and link it with other files to produce an executable, this
95+// file does not by itself cause the resulting executable to be covered by
96+// the GNU General Public License. This exception does not however
97+// invalidate any other reasons why the executable file might be covered by
98+// the GNU General Public License.
99+
100+// Written by Jakub Jelinek <jakub@redhat.com>
101+
102+#include <clocale>
103+
104+#ifdef __UCLIBC_MJN3_ONLY__
105+#warning clean this up
106+#endif
107+
108+#ifdef __UCLIBC_HAS_XLOCALE__
109+
110+extern "C" __typeof(iswctype_l) __iswctype_l;
111+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
112+extern "C" __typeof(strcoll_l) __strcoll_l;
113+extern "C" __typeof(strftime_l) __strftime_l;
114+extern "C" __typeof(strtod_l) __strtod_l;
115+extern "C" __typeof(strtof_l) __strtof_l;
116+extern "C" __typeof(strtold_l) __strtold_l;
117+extern "C" __typeof(strxfrm_l) __strxfrm_l;
118+extern "C" __typeof(towlower_l) __towlower_l;
119+extern "C" __typeof(towupper_l) __towupper_l;
120+extern "C" __typeof(wcscoll_l) __wcscoll_l;
121+extern "C" __typeof(wcsftime_l) __wcsftime_l;
122+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
123+extern "C" __typeof(wctype_l) __wctype_l;
124+extern "C" __typeof(newlocale) __newlocale;
125+extern "C" __typeof(freelocale) __freelocale;
126+extern "C" __typeof(duplocale) __duplocale;
127+extern "C" __typeof(uselocale) __uselocale;
128+
129+#endif // GLIBC 2.3 and later
130diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
131--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.cc 1969-12-31 18:00:00.000000000 -0600
132+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.cc 2005-04-28 01:13:15.000000000 -0500
133@@ -0,0 +1,160 @@
134+// Wrapper for underlying C-language localization -*- C++ -*-
135+
136+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
137+//
138+// This file is part of the GNU ISO C++ Library. This library is free
139+// software; you can redistribute it and/or modify it under the
140+// terms of the GNU General Public License as published by the
141+// Free Software Foundation; either version 2, or (at your option)
142+// any later version.
143+
144+// This library is distributed in the hope that it will be useful,
145+// but WITHOUT ANY WARRANTY; without even the implied warranty of
146+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
147+// GNU General Public License for more details.
148+
149+// You should have received a copy of the GNU General Public License along
150+// with this library; see the file COPYING. If not, write to the Free
151+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
152+// USA.
153+
154+// As a special exception, you may use this file as part of a free software
155+// library without restriction. Specifically, if other files instantiate
156+// templates or use macros or inline functions from this file, or you compile
157+// this file and link it with other files to produce an executable, this
158+// file does not by itself cause the resulting executable to be covered by
159+// the GNU General Public License. This exception does not however
160+// invalidate any other reasons why the executable file might be covered by
161+// the GNU General Public License.
162+
163+//
164+// ISO C++ 14882: 22.8 Standard locale categories.
165+//
166+
167+// Written by Benjamin Kosnik <bkoz@redhat.com>
168+
169+#include <cerrno> // For errno
170+#include <locale>
171+#include <stdexcept>
172+#include <langinfo.h>
173+#include <bits/c++locale_internal.h>
174+
175+#ifndef __UCLIBC_HAS_XLOCALE__
176+#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
177+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
178+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
179+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
180+#define __strtof_l(S, E, L) strtof((S), (E))
181+#define __strtod_l(S, E, L) strtod((S), (E))
182+#define __strtold_l(S, E, L) strtold((S), (E))
183+#warning should dummy __newlocale check for C|POSIX ?
184+#define __newlocale(a, b, c) NULL
185+#define __freelocale(a) ((void)0)
186+#define __duplocale(a) __c_locale()
187+#endif
188+
189+namespace std
190+{
191+ template<>
192+ void
193+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
194+ const __c_locale& __cloc)
195+ {
196+ if (!(__err & ios_base::failbit))
197+ {
198+ char* __sanity;
199+ errno = 0;
200+ float __f = __strtof_l(__s, &__sanity, __cloc);
201+ if (__sanity != __s && errno != ERANGE)
202+ __v = __f;
203+ else
204+ __err |= ios_base::failbit;
205+ }
206+ }
207+
208+ template<>
209+ void
210+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
211+ const __c_locale& __cloc)
212+ {
213+ if (!(__err & ios_base::failbit))
214+ {
215+ char* __sanity;
216+ errno = 0;
217+ double __d = __strtod_l(__s, &__sanity, __cloc);
218+ if (__sanity != __s && errno != ERANGE)
219+ __v = __d;
220+ else
221+ __err |= ios_base::failbit;
222+ }
223+ }
224+
225+ template<>
226+ void
227+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
228+ const __c_locale& __cloc)
229+ {
230+ if (!(__err & ios_base::failbit))
231+ {
232+ char* __sanity;
233+ errno = 0;
234+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
235+ if (__sanity != __s && errno != ERANGE)
236+ __v = __ld;
237+ else
238+ __err |= ios_base::failbit;
239+ }
240+ }
241+
242+ void
243+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
244+ __c_locale __old)
245+ {
246+ __cloc = __newlocale(1 << LC_ALL, __s, __old);
247+#ifdef __UCLIBC_HAS_XLOCALE__
248+ if (!__cloc)
249+ {
250+ // This named locale is not supported by the underlying OS.
251+ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
252+ "name not valid"));
253+ }
254+#endif
255+ }
256+
257+ void
258+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
259+ {
260+ if (_S_get_c_locale() != __cloc)
261+ __freelocale(__cloc);
262+ }
263+
264+ __c_locale
265+ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
266+ { return __duplocale(__cloc); }
267+} // namespace std
268+
269+namespace __gnu_cxx
270+{
271+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
272+ {
273+ "LC_CTYPE",
274+ "LC_NUMERIC",
275+ "LC_TIME",
276+ "LC_COLLATE",
277+ "LC_MONETARY",
278+ "LC_MESSAGES",
279+#if _GLIBCXX_NUM_CATEGORIES != 0
280+ "LC_PAPER",
281+ "LC_NAME",
282+ "LC_ADDRESS",
283+ "LC_TELEPHONE",
284+ "LC_MEASUREMENT",
285+ "LC_IDENTIFICATION"
286+#endif
287+ };
288+}
289+
290+namespace std
291+{
292+ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
293+} // namespace std
294diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.h
295--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.h 1969-12-31 18:00:00.000000000 -0600
296+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.h 2005-04-28 01:13:15.000000000 -0500
297@@ -0,0 +1,115 @@
298+// Wrapper for underlying C-language localization -*- C++ -*-
299+
300+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
301+//
302+// This file is part of the GNU ISO C++ Library. This library is free
303+// software; you can redistribute it and/or modify it under the
304+// terms of the GNU General Public License as published by the
305+// Free Software Foundation; either version 2, or (at your option)
306+// any later version.
307+
308+// This library is distributed in the hope that it will be useful,
309+// but WITHOUT ANY WARRANTY; without even the implied warranty of
310+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
311+// GNU General Public License for more details.
312+
313+// You should have received a copy of the GNU General Public License along
314+// with this library; see the file COPYING. If not, write to the Free
315+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
316+// USA.
317+
318+// As a special exception, you may use this file as part of a free software
319+// library without restriction. Specifically, if other files instantiate
320+// templates or use macros or inline functions from this file, or you compile
321+// this file and link it with other files to produce an executable, this
322+// file does not by itself cause the resulting executable to be covered by
323+// the GNU General Public License. This exception does not however
324+// invalidate any other reasons why the executable file might be covered by
325+// the GNU General Public License.
326+
327+//
328+// ISO C++ 14882: 22.8 Standard locale categories.
329+//
330+
331+// Written by Benjamin Kosnik <bkoz@redhat.com>
332+
333+#ifndef _C_LOCALE_H
334+#define _C_LOCALE_H 1
335+
336+#pragma GCC system_header
337+
338+#include <cstring> // get std::strlen
339+#include <cstdio> // get std::snprintf or std::sprintf
340+#include <clocale>
341+#include <langinfo.h> // For codecvt
342+#ifdef __UCLIBC_MJN3_ONLY__
343+#warning fix this
344+#endif
345+#ifdef __UCLIBC_HAS_LOCALE__
346+#include <iconv.h> // For codecvt using iconv, iconv_t
347+#endif
348+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
349+#include <libintl.h> // For messages
350+#endif
351+
352+#ifdef __UCLIBC_MJN3_ONLY__
353+#warning what is _GLIBCXX_C_LOCALE_GNU for
354+#endif
355+#define _GLIBCXX_C_LOCALE_GNU 1
356+
357+#ifdef __UCLIBC_MJN3_ONLY__
358+#warning fix categories
359+#endif
360+// #define _GLIBCXX_NUM_CATEGORIES 6
361+#define _GLIBCXX_NUM_CATEGORIES 0
362+
363+#ifdef __UCLIBC_HAS_XLOCALE__
364+namespace __gnu_cxx
365+{
366+ extern "C" __typeof(uselocale) __uselocale;
367+}
368+#endif
369+
370+namespace std
371+{
372+#ifdef __UCLIBC_HAS_XLOCALE__
373+ typedef __locale_t __c_locale;
374+#else
375+ typedef int* __c_locale;
376+#endif
377+
378+ // Convert numeric value of type _Tv to string and return length of
379+ // string. If snprintf is available use it, otherwise fall back to
380+ // the unsafe sprintf which, in general, can be dangerous and should
381+ // be avoided.
382+ template<typename _Tv>
383+ int
384+ __convert_from_v(char* __out, const int __size, const char* __fmt,
385+#ifdef __UCLIBC_HAS_XLOCALE__
386+ _Tv __v, const __c_locale& __cloc, int __prec)
387+ {
388+ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
389+#else
390+ _Tv __v, const __c_locale&, int __prec)
391+ {
392+# ifdef __UCLIBC_HAS_LOCALE__
393+ char* __old = std::setlocale(LC_ALL, NULL);
394+ char* __sav = new char[std::strlen(__old) + 1];
395+ std::strcpy(__sav, __old);
396+ std::setlocale(LC_ALL, "C");
397+# endif
398+#endif
399+
400+ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
401+
402+#ifdef __UCLIBC_HAS_XLOCALE__
403+ __gnu_cxx::__uselocale(__old);
404+#elif defined __UCLIBC_HAS_LOCALE__
405+ std::setlocale(LC_ALL, __sav);
406+ delete [] __sav;
407+#endif
408+ return __ret;
409+ }
410+}
411+
412+#endif
413diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
414--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1969-12-31 18:00:00.000000000 -0600
415+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2005-04-28 01:13:15.000000000 -0500
416@@ -0,0 +1,306 @@
417+// std::codecvt implementation details, GNU version -*- C++ -*-
418+
419+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
420+//
421+// This file is part of the GNU ISO C++ Library. This library is free
422+// software; you can redistribute it and/or modify it under the
423+// terms of the GNU General Public License as published by the
424+// Free Software Foundation; either version 2, or (at your option)
425+// any later version.
426+
427+// This library is distributed in the hope that it will be useful,
428+// but WITHOUT ANY WARRANTY; without even the implied warranty of
429+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
430+// GNU General Public License for more details.
431+
432+// You should have received a copy of the GNU General Public License along
433+// with this library; see the file COPYING. If not, write to the Free
434+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
435+// USA.
436+
437+// As a special exception, you may use this file as part of a free software
438+// library without restriction. Specifically, if other files instantiate
439+// templates or use macros or inline functions from this file, or you compile
440+// this file and link it with other files to produce an executable, this
441+// file does not by itself cause the resulting executable to be covered by
442+// the GNU General Public License. This exception does not however
443+// invalidate any other reasons why the executable file might be covered by
444+// the GNU General Public License.
445+
446+//
447+// ISO C++ 14882: 22.2.1.5 - Template class codecvt
448+//
449+
450+// Written by Benjamin Kosnik <bkoz@redhat.com>
451+
452+#include <locale>
453+#include <bits/c++locale_internal.h>
454+
455+namespace std
456+{
457+ // Specializations.
458+#ifdef _GLIBCXX_USE_WCHAR_T
459+ codecvt_base::result
460+ codecvt<wchar_t, char, mbstate_t>::
461+ do_out(state_type& __state, const intern_type* __from,
462+ const intern_type* __from_end, const intern_type*& __from_next,
463+ extern_type* __to, extern_type* __to_end,
464+ extern_type*& __to_next) const
465+ {
466+ result __ret = ok;
467+ state_type __tmp_state(__state);
468+
469+#ifdef __UCLIBC_HAS_XLOCALE__
470+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
471+#endif
472+
473+ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
474+ // in case we fall back to wcrtomb and then continue, in a loop.
475+ // NB: wcsnrtombs is a GNU extension
476+ for (__from_next = __from, __to_next = __to;
477+ __from_next < __from_end && __to_next < __to_end
478+ && __ret == ok;)
479+ {
480+ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
481+ __from_end - __from_next);
482+ if (!__from_chunk_end)
483+ __from_chunk_end = __from_end;
484+
485+ __from = __from_next;
486+ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
487+ __from_chunk_end - __from_next,
488+ __to_end - __to_next, &__state);
489+ if (__conv == static_cast<size_t>(-1))
490+ {
491+ // In case of error, in order to stop at the exact place we
492+ // have to start again from the beginning with a series of
493+ // wcrtomb.
494+ for (; __from < __from_next; ++__from)
495+ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
496+ __state = __tmp_state;
497+ __ret = error;
498+ }
499+ else if (__from_next && __from_next < __from_chunk_end)
500+ {
501+ __to_next += __conv;
502+ __ret = partial;
503+ }
504+ else
505+ {
506+ __from_next = __from_chunk_end;
507+ __to_next += __conv;
508+ }
509+
510+ if (__from_next < __from_end && __ret == ok)
511+ {
512+ extern_type __buf[MB_LEN_MAX];
513+ __tmp_state = __state;
514+ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
515+ if (__conv > static_cast<size_t>(__to_end - __to_next))
516+ __ret = partial;
517+ else
518+ {
519+ memcpy(__to_next, __buf, __conv);
520+ __state = __tmp_state;
521+ __to_next += __conv;
522+ ++__from_next;
523+ }
524+ }
525+ }
526+
527+#ifdef __UCLIBC_HAS_XLOCALE__
528+ __uselocale(__old);
529+#endif
530+
531+ return __ret;
532+ }
533+
534+ codecvt_base::result
535+ codecvt<wchar_t, char, mbstate_t>::
536+ do_in(state_type& __state, const extern_type* __from,
537+ const extern_type* __from_end, const extern_type*& __from_next,
538+ intern_type* __to, intern_type* __to_end,
539+ intern_type*& __to_next) const
540+ {
541+ result __ret = ok;
542+ state_type __tmp_state(__state);
543+
544+#ifdef __UCLIBC_HAS_XLOCALE__
545+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
546+#endif
547+
548+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
549+ // in case we store a L'\0' and then continue, in a loop.
550+ // NB: mbsnrtowcs is a GNU extension
551+ for (__from_next = __from, __to_next = __to;
552+ __from_next < __from_end && __to_next < __to_end
553+ && __ret == ok;)
554+ {
555+ const extern_type* __from_chunk_end;
556+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
557+ __from_end
558+ - __from_next));
559+ if (!__from_chunk_end)
560+ __from_chunk_end = __from_end;
561+
562+ __from = __from_next;
563+ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
564+ __from_chunk_end - __from_next,
565+ __to_end - __to_next, &__state);
566+ if (__conv == static_cast<size_t>(-1))
567+ {
568+ // In case of error, in order to stop at the exact place we
569+ // have to start again from the beginning with a series of
570+ // mbrtowc.
571+ for (;; ++__to_next, __from += __conv)
572+ {
573+ __conv = mbrtowc(__to_next, __from, __from_end - __from,
574+ &__tmp_state);
575+ if (__conv == static_cast<size_t>(-1)
576+ || __conv == static_cast<size_t>(-2))
577+ break;
578+ }
579+ __from_next = __from;
580+ __state = __tmp_state;
581+ __ret = error;
582+ }
583+ else if (__from_next && __from_next < __from_chunk_end)
584+ {
585+ // It is unclear what to return in this case (see DR 382).
586+ __to_next += __conv;
587+ __ret = partial;
588+ }
589+ else
590+ {
591+ __from_next = __from_chunk_end;
592+ __to_next += __conv;
593+ }
594+
595+ if (__from_next < __from_end && __ret == ok)
596+ {
597+ if (__to_next < __to_end)
598+ {
599+ // XXX Probably wrong for stateful encodings
600+ __tmp_state = __state;
601+ ++__from_next;
602+ *__to_next++ = L'\0';
603+ }
604+ else
605+ __ret = partial;
606+ }
607+ }
608+
609+#ifdef __UCLIBC_HAS_XLOCALE__
610+ __uselocale(__old);
611+#endif
612+
613+ return __ret;
614+ }
615+
616+ int
617+ codecvt<wchar_t, char, mbstate_t>::
618+ do_encoding() const throw()
619+ {
620+ // XXX This implementation assumes that the encoding is
621+ // stateless and is either single-byte or variable-width.
622+ int __ret = 0;
623+#ifdef __UCLIBC_HAS_XLOCALE__
624+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
625+#endif
626+ if (MB_CUR_MAX == 1)
627+ __ret = 1;
628+#ifdef __UCLIBC_HAS_XLOCALE__
629+ __uselocale(__old);
630+#endif
631+ return __ret;
632+ }
633+
634+ int
635+ codecvt<wchar_t, char, mbstate_t>::
636+ do_max_length() const throw()
637+ {
638+#ifdef __UCLIBC_HAS_XLOCALE__
639+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
640+#endif
641+ // XXX Probably wrong for stateful encodings.
642+ int __ret = MB_CUR_MAX;
643+#ifdef __UCLIBC_HAS_XLOCALE__
644+ __uselocale(__old);
645+#endif
646+ return __ret;
647+ }
648+
649+ int
650+ codecvt<wchar_t, char, mbstate_t>::
651+ do_length(state_type& __state, const extern_type* __from,
652+ const extern_type* __end, size_t __max) const
653+ {
654+ int __ret = 0;
655+ state_type __tmp_state(__state);
656+
657+#ifdef __UCLIBC_HAS_XLOCALE__
658+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
659+#endif
660+
661+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
662+ // in case we advance past it and then continue, in a loop.
663+ // NB: mbsnrtowcs is a GNU extension
664+
665+ // A dummy internal buffer is needed in order for mbsnrtocws to consider
666+ // its fourth parameter (it wouldn't with NULL as first parameter).
667+ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
668+ * __max));
669+ while (__from < __end && __max)
670+ {
671+ const extern_type* __from_chunk_end;
672+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
673+ __end
674+ - __from));
675+ if (!__from_chunk_end)
676+ __from_chunk_end = __end;
677+
678+ const extern_type* __tmp_from = __from;
679+ size_t __conv = mbsnrtowcs(__to, &__from,
680+ __from_chunk_end - __from,
681+ __max, &__state);
682+ if (__conv == static_cast<size_t>(-1))
683+ {
684+ // In case of error, in order to stop at the exact place we
685+ // have to start again from the beginning with a series of
686+ // mbrtowc.
687+ for (__from = __tmp_from;; __from += __conv)
688+ {
689+ __conv = mbrtowc(NULL, __from, __end - __from,
690+ &__tmp_state);
691+ if (__conv == static_cast<size_t>(-1)
692+ || __conv == static_cast<size_t>(-2))
693+ break;
694+ }
695+ __state = __tmp_state;
696+ __ret += __from - __tmp_from;
697+ break;
698+ }
699+ if (!__from)
700+ __from = __from_chunk_end;
701+
702+ __ret += __from - __tmp_from;
703+ __max -= __conv;
704+
705+ if (__from < __end && __max)
706+ {
707+ // XXX Probably wrong for stateful encodings
708+ __tmp_state = __state;
709+ ++__from;
710+ ++__ret;
711+ --__max;
712+ }
713+ }
714+
715+#ifdef __UCLIBC_HAS_XLOCALE__
716+ __uselocale(__old);
717+#endif
718+
719+ return __ret;
720+ }
721+#endif
722+}
723diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/collate_members.cc
724--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/collate_members.cc 1969-12-31 18:00:00.000000000 -0600
725+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/collate_members.cc 2005-04-28 01:13:15.000000000 -0500
726@@ -0,0 +1,80 @@
727+// std::collate implementation details, GNU version -*- C++ -*-
728+
729+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
730+//
731+// This file is part of the GNU ISO C++ Library. This library is free
732+// software; you can redistribute it and/or modify it under the
733+// terms of the GNU General Public License as published by the
734+// Free Software Foundation; either version 2, or (at your option)
735+// any later version.
736+
737+// This library is distributed in the hope that it will be useful,
738+// but WITHOUT ANY WARRANTY; without even the implied warranty of
739+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
740+// GNU General Public License for more details.
741+
742+// You should have received a copy of the GNU General Public License along
743+// with this library; see the file COPYING. If not, write to the Free
744+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
745+// USA.
746+
747+// As a special exception, you may use this file as part of a free software
748+// library without restriction. Specifically, if other files instantiate
749+// templates or use macros or inline functions from this file, or you compile
750+// this file and link it with other files to produce an executable, this
751+// file does not by itself cause the resulting executable to be covered by
752+// the GNU General Public License. This exception does not however
753+// invalidate any other reasons why the executable file might be covered by
754+// the GNU General Public License.
755+
756+//
757+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
758+//
759+
760+// Written by Benjamin Kosnik <bkoz@redhat.com>
761+
762+#include <locale>
763+#include <bits/c++locale_internal.h>
764+
765+#ifndef __UCLIBC_HAS_XLOCALE__
766+#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
767+#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
768+#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
769+#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
770+#endif
771+
772+namespace std
773+{
774+ // These are basically extensions to char_traits, and perhaps should
775+ // be put there instead of here.
776+ template<>
777+ int
778+ collate<char>::_M_compare(const char* __one, const char* __two) const
779+ {
780+ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
781+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
782+ }
783+
784+ template<>
785+ size_t
786+ collate<char>::_M_transform(char* __to, const char* __from,
787+ size_t __n) const
788+ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
789+
790+#ifdef _GLIBCXX_USE_WCHAR_T
791+ template<>
792+ int
793+ collate<wchar_t>::_M_compare(const wchar_t* __one,
794+ const wchar_t* __two) const
795+ {
796+ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
797+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
798+ }
799+
800+ template<>
801+ size_t
802+ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
803+ size_t __n) const
804+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
805+#endif
806+}
807diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
808--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1969-12-31 18:00:00.000000000 -0600
809+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2005-04-28 01:13:15.000000000 -0500
810@@ -0,0 +1,300 @@
811+// std::ctype implementation details, GNU version -*- C++ -*-
812+
813+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
814+//
815+// This file is part of the GNU ISO C++ Library. This library is free
816+// software; you can redistribute it and/or modify it under the
817+// terms of the GNU General Public License as published by the
818+// Free Software Foundation; either version 2, or (at your option)
819+// any later version.
820+
821+// This library is distributed in the hope that it will be useful,
822+// but WITHOUT ANY WARRANTY; without even the implied warranty of
823+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
824+// GNU General Public License for more details.
825+
826+// You should have received a copy of the GNU General Public License along
827+// with this library; see the file COPYING. If not, write to the Free
828+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
829+// USA.
830+
831+// As a special exception, you may use this file as part of a free software
832+// library without restriction. Specifically, if other files instantiate
833+// templates or use macros or inline functions from this file, or you compile
834+// this file and link it with other files to produce an executable, this
835+// file does not by itself cause the resulting executable to be covered by
836+// the GNU General Public License. This exception does not however
837+// invalidate any other reasons why the executable file might be covered by
838+// the GNU General Public License.
839+
840+//
841+// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
842+//
843+
844+// Written by Benjamin Kosnik <bkoz@redhat.com>
845+
846+#define _LIBC
847+#include <locale>
848+#undef _LIBC
849+#include <bits/c++locale_internal.h>
850+
851+#ifndef __UCLIBC_HAS_XLOCALE__
852+#define __wctype_l(S, L) wctype((S))
853+#define __towupper_l(C, L) towupper((C))
854+#define __towlower_l(C, L) towlower((C))
855+#define __iswctype_l(C, M, L) iswctype((C), (M))
856+#endif
857+
858+namespace std
859+{
860+ // NB: The other ctype<char> specializations are in src/locale.cc and
861+ // various /config/os/* files.
862+ template<>
863+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
864+ : ctype<char>(0, false, __refs)
865+ {
866+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
867+ {
868+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
869+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
870+#ifdef __UCLIBC_HAS_XLOCALE__
871+ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
872+ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
873+ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
874+#endif
875+ }
876+ }
877+
878+#ifdef _GLIBCXX_USE_WCHAR_T
879+ ctype<wchar_t>::__wmask_type
880+ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
881+ {
882+ __wmask_type __ret;
883+ switch (__m)
884+ {
885+ case space:
886+ __ret = __wctype_l("space", _M_c_locale_ctype);
887+ break;
888+ case print:
889+ __ret = __wctype_l("print", _M_c_locale_ctype);
890+ break;
891+ case cntrl:
892+ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
893+ break;
894+ case upper:
895+ __ret = __wctype_l("upper", _M_c_locale_ctype);
896+ break;
897+ case lower:
898+ __ret = __wctype_l("lower", _M_c_locale_ctype);
899+ break;
900+ case alpha:
901+ __ret = __wctype_l("alpha", _M_c_locale_ctype);
902+ break;
903+ case digit:
904+ __ret = __wctype_l("digit", _M_c_locale_ctype);
905+ break;
906+ case punct:
907+ __ret = __wctype_l("punct", _M_c_locale_ctype);
908+ break;
909+ case xdigit:
910+ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
911+ break;
912+ case alnum:
913+ __ret = __wctype_l("alnum", _M_c_locale_ctype);
914+ break;
915+ case graph:
916+ __ret = __wctype_l("graph", _M_c_locale_ctype);
917+ break;
918+ default:
919+ __ret = __wmask_type();
920+ }
921+ return __ret;
922+ }
923+
924+ wchar_t
925+ ctype<wchar_t>::do_toupper(wchar_t __c) const
926+ { return __towupper_l(__c, _M_c_locale_ctype); }
927+
928+ const wchar_t*
929+ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
930+ {
931+ while (__lo < __hi)
932+ {
933+ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
934+ ++__lo;
935+ }
936+ return __hi;
937+ }
938+
939+ wchar_t
940+ ctype<wchar_t>::do_tolower(wchar_t __c) const
941+ { return __towlower_l(__c, _M_c_locale_ctype); }
942+
943+ const wchar_t*
944+ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
945+ {
946+ while (__lo < __hi)
947+ {
948+ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
949+ ++__lo;
950+ }
951+ return __hi;
952+ }
953+
954+ bool
955+ ctype<wchar_t>::
956+ do_is(mask __m, wchar_t __c) const
957+ {
958+ // Highest bitmask in ctype_base == 10, but extra in "C"
959+ // library for blank.
960+ bool __ret = false;
961+ const size_t __bitmasksize = 11;
962+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
963+ if (__m & _M_bit[__bitcur]
964+ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
965+ {
966+ __ret = true;
967+ break;
968+ }
969+ return __ret;
970+ }
971+
972+ const wchar_t*
973+ ctype<wchar_t>::
974+ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
975+ {
976+ for (; __lo < __hi; ++__vec, ++__lo)
977+ {
978+ // Highest bitmask in ctype_base == 10, but extra in "C"
979+ // library for blank.
980+ const size_t __bitmasksize = 11;
981+ mask __m = 0;
982+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
983+ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
984+ __m |= _M_bit[__bitcur];
985+ *__vec = __m;
986+ }
987+ return __hi;
988+ }
989+
990+ const wchar_t*
991+ ctype<wchar_t>::
992+ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
993+ {
994+ while (__lo < __hi && !this->do_is(__m, *__lo))
995+ ++__lo;
996+ return __lo;
997+ }
998+
999+ const wchar_t*
1000+ ctype<wchar_t>::
1001+ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
1002+ {
1003+ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
1004+ ++__lo;
1005+ return __lo;
1006+ }
1007+
1008+ wchar_t
1009+ ctype<wchar_t>::
1010+ do_widen(char __c) const
1011+ { return _M_widen[static_cast<unsigned char>(__c)]; }
1012+
1013+ const char*
1014+ ctype<wchar_t>::
1015+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
1016+ {
1017+ while (__lo < __hi)
1018+ {
1019+ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
1020+ ++__lo;
1021+ ++__dest;
1022+ }
1023+ return __hi;
1024+ }
1025+
1026+ char
1027+ ctype<wchar_t>::
1028+ do_narrow(wchar_t __wc, char __dfault) const
1029+ {
1030+ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
1031+ return _M_narrow[__wc];
1032+#ifdef __UCLIBC_HAS_XLOCALE__
1033+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1034+#endif
1035+ const int __c = wctob(__wc);
1036+#ifdef __UCLIBC_HAS_XLOCALE__
1037+ __uselocale(__old);
1038+#endif
1039+ return (__c == EOF ? __dfault : static_cast<char>(__c));
1040+ }
1041+
1042+ const wchar_t*
1043+ ctype<wchar_t>::
1044+ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
1045+ char* __dest) const
1046+ {
1047+#ifdef __UCLIBC_HAS_XLOCALE__
1048+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1049+#endif
1050+ if (_M_narrow_ok)
1051+ while (__lo < __hi)
1052+ {
1053+ if (*__lo >= 0 && *__lo < 128)
1054+ *__dest = _M_narrow[*__lo];
1055+ else
1056+ {
1057+ const int __c = wctob(*__lo);
1058+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1059+ }
1060+ ++__lo;
1061+ ++__dest;
1062+ }
1063+ else
1064+ while (__lo < __hi)
1065+ {
1066+ const int __c = wctob(*__lo);
1067+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1068+ ++__lo;
1069+ ++__dest;
1070+ }
1071+#ifdef __UCLIBC_HAS_XLOCALE__
1072+ __uselocale(__old);
1073+#endif
1074+ return __hi;
1075+ }
1076+
1077+ void
1078+ ctype<wchar_t>::_M_initialize_ctype()
1079+ {
1080+#ifdef __UCLIBC_HAS_XLOCALE__
1081+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1082+#endif
1083+ wint_t __i;
1084+ for (__i = 0; __i < 128; ++__i)
1085+ {
1086+ const int __c = wctob(__i);
1087+ if (__c == EOF)
1088+ break;
1089+ else
1090+ _M_narrow[__i] = static_cast<char>(__c);
1091+ }
1092+ if (__i == 128)
1093+ _M_narrow_ok = true;
1094+ else
1095+ _M_narrow_ok = false;
1096+ for (size_t __j = 0;
1097+ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
1098+ _M_widen[__j] = btowc(__j);
1099+
1100+ for (size_t __k = 0; __k <= 11; ++__k)
1101+ {
1102+ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
1103+ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
1104+ }
1105+#ifdef __UCLIBC_HAS_XLOCALE__
1106+ __uselocale(__old);
1107+#endif
1108+ }
1109+#endif // _GLIBCXX_USE_WCHAR_T
1110+}
1111diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.cc
1112--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.cc 1969-12-31 18:00:00.000000000 -0600
1113+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.cc 2005-04-28 01:13:15.000000000 -0500
1114@@ -0,0 +1,100 @@
1115+// std::messages implementation details, GNU version -*- C++ -*-
1116+
1117+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1118+//
1119+// This file is part of the GNU ISO C++ Library. This library is free
1120+// software; you can redistribute it and/or modify it under the
1121+// terms of the GNU General Public License as published by the
1122+// Free Software Foundation; either version 2, or (at your option)
1123+// any later version.
1124+
1125+// This library is distributed in the hope that it will be useful,
1126+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1127+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1128+// GNU General Public License for more details.
1129+
1130+// You should have received a copy of the GNU General Public License along
1131+// with this library; see the file COPYING. If not, write to the Free
1132+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1133+// USA.
1134+
1135+// As a special exception, you may use this file as part of a free software
1136+// library without restriction. Specifically, if other files instantiate
1137+// templates or use macros or inline functions from this file, or you compile
1138+// this file and link it with other files to produce an executable, this
1139+// file does not by itself cause the resulting executable to be covered by
1140+// the GNU General Public License. This exception does not however
1141+// invalidate any other reasons why the executable file might be covered by
1142+// the GNU General Public License.
1143+
1144+//
1145+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
1146+//
1147+
1148+// Written by Benjamin Kosnik <bkoz@redhat.com>
1149+
1150+#include <locale>
1151+#include <bits/c++locale_internal.h>
1152+
1153+#ifdef __UCLIBC_MJN3_ONLY__
1154+#warning fix gettext stuff
1155+#endif
1156+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1157+extern "C" char *__dcgettext(const char *domainname,
1158+ const char *msgid, int category);
1159+#undef gettext
1160+#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
1161+#else
1162+#undef gettext
1163+#define gettext(msgid) (msgid)
1164+#endif
1165+
1166+namespace std
1167+{
1168+ // Specializations.
1169+ template<>
1170+ string
1171+ messages<char>::do_get(catalog, int, int, const string& __dfault) const
1172+ {
1173+#ifdef __UCLIBC_HAS_XLOCALE__
1174+ __c_locale __old = __uselocale(_M_c_locale_messages);
1175+ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
1176+ __uselocale(__old);
1177+ return string(__msg);
1178+#elif defined __UCLIBC_HAS_LOCALE__
1179+ char* __old = strdup(setlocale(LC_ALL, NULL));
1180+ setlocale(LC_ALL, _M_name_messages);
1181+ const char* __msg = gettext(__dfault.c_str());
1182+ setlocale(LC_ALL, __old);
1183+ free(__old);
1184+ return string(__msg);
1185+#else
1186+ const char* __msg = gettext(__dfault.c_str());
1187+ return string(__msg);
1188+#endif
1189+ }
1190+
1191+#ifdef _GLIBCXX_USE_WCHAR_T
1192+ template<>
1193+ wstring
1194+ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
1195+ {
1196+# ifdef __UCLIBC_HAS_XLOCALE__
1197+ __c_locale __old = __uselocale(_M_c_locale_messages);
1198+ char* __msg = gettext(_M_convert_to_char(__dfault));
1199+ __uselocale(__old);
1200+ return _M_convert_from_char(__msg);
1201+# elif defined __UCLIBC_HAS_LOCALE__
1202+ char* __old = strdup(setlocale(LC_ALL, NULL));
1203+ setlocale(LC_ALL, _M_name_messages);
1204+ char* __msg = gettext(_M_convert_to_char(__dfault));
1205+ setlocale(LC_ALL, __old);
1206+ free(__old);
1207+ return _M_convert_from_char(__msg);
1208+# else
1209+ char* __msg = gettext(_M_convert_to_char(__dfault));
1210+ return _M_convert_from_char(__msg);
1211+# endif
1212+ }
1213+#endif
1214+}
1215diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.h
1216--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.h 1969-12-31 18:00:00.000000000 -0600
1217+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2005-04-28 01:13:15.000000000 -0500
1218@@ -0,0 +1,118 @@
1219+// std::messages implementation details, GNU version -*- C++ -*-
1220+
1221+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1222+//
1223+// This file is part of the GNU ISO C++ Library. This library is free
1224+// software; you can redistribute it and/or modify it under the
1225+// terms of the GNU General Public License as published by the
1226+// Free Software Foundation; either version 2, or (at your option)
1227+// any later version.
1228+
1229+// This library is distributed in the hope that it will be useful,
1230+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1231+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1232+// GNU General Public License for more details.
1233+
1234+// You should have received a copy of the GNU General Public License along
1235+// with this library; see the file COPYING. If not, write to the Free
1236+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1237+// USA.
1238+
1239+// As a special exception, you may use this file as part of a free software
1240+// library without restriction. Specifically, if other files instantiate
1241+// templates or use macros or inline functions from this file, or you compile
1242+// this file and link it with other files to produce an executable, this
1243+// file does not by itself cause the resulting executable to be covered by
1244+// the GNU General Public License. This exception does not however
1245+// invalidate any other reasons why the executable file might be covered by
1246+// the GNU General Public License.
1247+
1248+//
1249+// ISO C++ 14882: 22.2.7.1.2 messages functions
1250+//
1251+
1252+// Written by Benjamin Kosnik <bkoz@redhat.com>
1253+
1254+#ifdef __UCLIBC_MJN3_ONLY__
1255+#warning fix prototypes for *textdomain funcs
1256+#endif
1257+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1258+extern "C" char *__textdomain(const char *domainname);
1259+extern "C" char *__bindtextdomain(const char *domainname,
1260+ const char *dirname);
1261+#else
1262+#undef __textdomain
1263+#undef __bindtextdomain
1264+#define __textdomain(D) ((void)0)
1265+#define __bindtextdomain(D,P) ((void)0)
1266+#endif
1267+
1268+ // Non-virtual member functions.
1269+ template<typename _CharT>
1270+ messages<_CharT>::messages(size_t __refs)
1271+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
1272+ _M_name_messages(_S_get_c_name())
1273+ { }
1274+
1275+ template<typename _CharT>
1276+ messages<_CharT>::messages(__c_locale __cloc, const char* __s,
1277+ size_t __refs)
1278+ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
1279+ _M_name_messages(__s)
1280+ {
1281+ char* __tmp = new char[std::strlen(__s) + 1];
1282+ std::strcpy(__tmp, __s);
1283+ _M_name_messages = __tmp;
1284+ }
1285+
1286+ template<typename _CharT>
1287+ typename messages<_CharT>::catalog
1288+ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
1289+ const char* __dir) const
1290+ {
1291+ __bindtextdomain(__s.c_str(), __dir);
1292+ return this->do_open(__s, __loc);
1293+ }
1294+
1295+ // Virtual member functions.
1296+ template<typename _CharT>
1297+ messages<_CharT>::~messages()
1298+ {
1299+ if (_M_name_messages != _S_get_c_name())
1300+ delete [] _M_name_messages;
1301+ _S_destroy_c_locale(_M_c_locale_messages);
1302+ }
1303+
1304+ template<typename _CharT>
1305+ typename messages<_CharT>::catalog
1306+ messages<_CharT>::do_open(const basic_string<char>& __s,
1307+ const locale&) const
1308+ {
1309+ // No error checking is done, assume the catalog exists and can
1310+ // be used.
1311+ __textdomain(__s.c_str());
1312+ return 0;
1313+ }
1314+
1315+ template<typename _CharT>
1316+ void
1317+ messages<_CharT>::do_close(catalog) const
1318+ { }
1319+
1320+ // messages_byname
1321+ template<typename _CharT>
1322+ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
1323+ : messages<_CharT>(__refs)
1324+ {
1325+ if (this->_M_name_messages != locale::facet::_S_get_c_name())
1326+ delete [] this->_M_name_messages;
1327+ char* __tmp = new char[std::strlen(__s) + 1];
1328+ std::strcpy(__tmp, __s);
1329+ this->_M_name_messages = __tmp;
1330+
1331+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
1332+ {
1333+ this->_S_destroy_c_locale(this->_M_c_locale_messages);
1334+ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
1335+ }
1336+ }
1337diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1338--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1969-12-31 18:00:00.000000000 -0600
1339+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2005-04-28 01:23:02.000000000 -0500
1340@@ -0,0 +1,692 @@
1341+// std::moneypunct implementation details, GNU version -*- C++ -*-
1342+
1343+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1344+//
1345+// This file is part of the GNU ISO C++ Library. This library is free
1346+// software; you can redistribute it and/or modify it under the
1347+// terms of the GNU General Public License as published by the
1348+// Free Software Foundation; either version 2, or (at your option)
1349+// any later version.
1350+
1351+// This library is distributed in the hope that it will be useful,
1352+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1353+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1354+// GNU General Public License for more details.
1355+
1356+// You should have received a copy of the GNU General Public License along
1357+// with this library; see the file COPYING. If not, write to the Free
1358+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1359+// USA.
1360+
1361+// As a special exception, you may use this file as part of a free software
1362+// library without restriction. Specifically, if other files instantiate
1363+// templates or use macros or inline functions from this file, or you compile
1364+// this file and link it with other files to produce an executable, this
1365+// file does not by itself cause the resulting executable to be covered by
1366+// the GNU General Public License. This exception does not however
1367+// invalidate any other reasons why the executable file might be covered by
1368+// the GNU General Public License.
1369+
1370+//
1371+// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
1372+//
1373+
1374+// Written by Benjamin Kosnik <bkoz@redhat.com>
1375+
1376+#define _LIBC
1377+#include <locale>
1378+#undef _LIBC
1379+#include <bits/c++locale_internal.h>
1380+
1381+#ifdef __UCLIBC_MJN3_ONLY__
1382+#warning optimize this for uclibc
1383+#warning tailor for stub locale support
1384+#endif
1385+
1386+#ifndef __UCLIBC_HAS_XLOCALE__
1387+#define __nl_langinfo_l(N, L) nl_langinfo((N))
1388+#endif
1389+
1390+namespace std
1391+{
1392+ // Construct and return valid pattern consisting of some combination of:
1393+ // space none symbol sign value
1394+ money_base::pattern
1395+ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
1396+ {
1397+ pattern __ret;
1398+
1399+ // This insanely complicated routine attempts to construct a valid
1400+ // pattern for use with monyepunct. A couple of invariants:
1401+
1402+ // if (__precedes) symbol -> value
1403+ // else value -> symbol
1404+
1405+ // if (__space) space
1406+ // else none
1407+
1408+ // none == never first
1409+ // space never first or last
1410+
1411+ // Any elegant implementations of this are welcome.
1412+ switch (__posn)
1413+ {
1414+ case 0:
1415+ case 1:
1416+ // 1 The sign precedes the value and symbol.
1417+ __ret.field[0] = sign;
1418+ if (__space)
1419+ {
1420+ // Pattern starts with sign.
1421+ if (__precedes)
1422+ {
1423+ __ret.field[1] = symbol;
1424+ __ret.field[3] = value;
1425+ }
1426+ else
1427+ {
1428+ __ret.field[1] = value;
1429+ __ret.field[3] = symbol;
1430+ }
1431+ __ret.field[2] = space;
1432+ }
1433+ else
1434+ {
1435+ // Pattern starts with sign and ends with none.
1436+ if (__precedes)
1437+ {
1438+ __ret.field[1] = symbol;
1439+ __ret.field[2] = value;
1440+ }
1441+ else
1442+ {
1443+ __ret.field[1] = value;
1444+ __ret.field[2] = symbol;
1445+ }
1446+ __ret.field[3] = none;
1447+ }
1448+ break;
1449+ case 2:
1450+ // 2 The sign follows the value and symbol.
1451+ if (__space)
1452+ {
1453+ // Pattern either ends with sign.
1454+ if (__precedes)
1455+ {
1456+ __ret.field[0] = symbol;
1457+ __ret.field[2] = value;
1458+ }
1459+ else
1460+ {
1461+ __ret.field[0] = value;
1462+ __ret.field[2] = symbol;
1463+ }
1464+ __ret.field[1] = space;
1465+ __ret.field[3] = sign;
1466+ }
1467+ else
1468+ {
1469+ // Pattern ends with sign then none.
1470+ if (__precedes)
1471+ {
1472+ __ret.field[0] = symbol;
1473+ __ret.field[1] = value;
1474+ }
1475+ else
1476+ {
1477+ __ret.field[0] = value;
1478+ __ret.field[1] = symbol;
1479+ }
1480+ __ret.field[2] = sign;
1481+ __ret.field[3] = none;
1482+ }
1483+ break;
1484+ case 3:
1485+ // 3 The sign immediately precedes the symbol.
1486+ if (__precedes)
1487+ {
1488+ __ret.field[0] = sign;
1489+ __ret.field[1] = symbol;
1490+ if (__space)
1491+ {
1492+ __ret.field[2] = space;
1493+ __ret.field[3] = value;
1494+ }
1495+ else
1496+ {
1497+ __ret.field[2] = value;
1498+ __ret.field[3] = none;
1499+ }
1500+ }
1501+ else
1502+ {
1503+ __ret.field[0] = value;
1504+ if (__space)
1505+ {
1506+ __ret.field[1] = space;
1507+ __ret.field[2] = sign;
1508+ __ret.field[3] = symbol;
1509+ }
1510+ else
1511+ {
1512+ __ret.field[1] = sign;
1513+ __ret.field[2] = symbol;
1514+ __ret.field[3] = none;
1515+ }
1516+ }
1517+ break;
1518+ case 4:
1519+ // 4 The sign immediately follows the symbol.
1520+ if (__precedes)
1521+ {
1522+ __ret.field[0] = symbol;
1523+ __ret.field[1] = sign;
1524+ if (__space)
1525+ {
1526+ __ret.field[2] = space;
1527+ __ret.field[3] = value;
1528+ }
1529+ else
1530+ {
1531+ __ret.field[2] = value;
1532+ __ret.field[3] = none;
1533+ }
1534+ }
1535+ else
1536+ {
1537+ __ret.field[0] = value;
1538+ if (__space)
1539+ {
1540+ __ret.field[1] = space;
1541+ __ret.field[2] = symbol;
1542+ __ret.field[3] = sign;
1543+ }
1544+ else
1545+ {
1546+ __ret.field[1] = symbol;
1547+ __ret.field[2] = sign;
1548+ __ret.field[3] = none;
1549+ }
1550+ }
1551+ break;
1552+ default:
1553+ __ret = pattern();
1554+ }
1555+ return __ret;
1556+ }
1557+
1558+ template<>
1559+ void
1560+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
1561+ const char*)
1562+ {
1563+ if (!_M_data)
1564+ _M_data = new __moneypunct_cache<char, true>;
1565+
1566+ if (!__cloc)
1567+ {
1568+ // "C" locale
1569+ _M_data->_M_decimal_point = '.';
1570+ _M_data->_M_thousands_sep = ',';
1571+ _M_data->_M_grouping = "";
1572+ _M_data->_M_grouping_size = 0;
1573+ _M_data->_M_curr_symbol = "";
1574+ _M_data->_M_curr_symbol_size = 0;
1575+ _M_data->_M_positive_sign = "";
1576+ _M_data->_M_positive_sign_size = 0;
1577+ _M_data->_M_negative_sign = "";
1578+ _M_data->_M_negative_sign_size = 0;
1579+ _M_data->_M_frac_digits = 0;
1580+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1581+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1582+
1583+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1584+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1585+ }
1586+ else
1587+ {
1588+ // Named locale.
1589+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1590+ __cloc));
1591+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1592+ __cloc));
1593+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1594+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1595+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1596+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1597+
1598+ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1599+ if (!__nposn)
1600+ _M_data->_M_negative_sign = "()";
1601+ else
1602+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1603+ __cloc);
1604+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1605+
1606+ // _Intl == true
1607+ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1608+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1609+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1610+ __cloc));
1611+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1612+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1613+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1614+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1615+ __pposn);
1616+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1617+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1618+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1619+ __nposn);
1620+ }
1621+ }
1622+
1623+ template<>
1624+ void
1625+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
1626+ const char*)
1627+ {
1628+ if (!_M_data)
1629+ _M_data = new __moneypunct_cache<char, false>;
1630+
1631+ if (!__cloc)
1632+ {
1633+ // "C" locale
1634+ _M_data->_M_decimal_point = '.';
1635+ _M_data->_M_thousands_sep = ',';
1636+ _M_data->_M_grouping = "";
1637+ _M_data->_M_grouping_size = 0;
1638+ _M_data->_M_curr_symbol = "";
1639+ _M_data->_M_curr_symbol_size = 0;
1640+ _M_data->_M_positive_sign = "";
1641+ _M_data->_M_positive_sign_size = 0;
1642+ _M_data->_M_negative_sign = "";
1643+ _M_data->_M_negative_sign_size = 0;
1644+ _M_data->_M_frac_digits = 0;
1645+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1646+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1647+
1648+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1649+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1650+ }
1651+ else
1652+ {
1653+ // Named locale.
1654+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1655+ __cloc));
1656+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1657+ __cloc));
1658+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1659+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1660+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1661+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1662+
1663+ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1664+ if (!__nposn)
1665+ _M_data->_M_negative_sign = "()";
1666+ else
1667+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1668+ __cloc);
1669+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1670+
1671+ // _Intl == false
1672+ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1673+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1674+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1675+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1676+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1677+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1678+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1679+ __pposn);
1680+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1681+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1682+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1683+ __nposn);
1684+ }
1685+ }
1686+
1687+ template<>
1688+ moneypunct<char, true>::~moneypunct()
1689+ { delete _M_data; }
1690+
1691+ template<>
1692+ moneypunct<char, false>::~moneypunct()
1693+ { delete _M_data; }
1694+
1695+#ifdef _GLIBCXX_USE_WCHAR_T
1696+ template<>
1697+ void
1698+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
1699+#ifdef __UCLIBC_HAS_XLOCALE__
1700+ const char*)
1701+#else
1702+ const char* __name)
1703+#endif
1704+ {
1705+ if (!_M_data)
1706+ _M_data = new __moneypunct_cache<wchar_t, true>;
1707+
1708+ if (!__cloc)
1709+ {
1710+ // "C" locale
1711+ _M_data->_M_decimal_point = L'.';
1712+ _M_data->_M_thousands_sep = L',';
1713+ _M_data->_M_grouping = "";
1714+ _M_data->_M_grouping_size = 0;
1715+ _M_data->_M_curr_symbol = L"";
1716+ _M_data->_M_curr_symbol_size = 0;
1717+ _M_data->_M_positive_sign = L"";
1718+ _M_data->_M_positive_sign_size = 0;
1719+ _M_data->_M_negative_sign = L"";
1720+ _M_data->_M_negative_sign_size = 0;
1721+ _M_data->_M_frac_digits = 0;
1722+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1723+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1724+
1725+ // Use ctype::widen code without the facet...
1726+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1727+ _M_data->_M_atoms[__i] =
1728+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1729+ }
1730+ else
1731+ {
1732+ // Named locale.
1733+#ifdef __UCLIBC_HAS_XLOCALE__
1734+ __c_locale __old = __uselocale(__cloc);
1735+#else
1736+ // Switch to named locale so that mbsrtowcs will work.
1737+ char* __old = strdup(setlocale(LC_ALL, NULL));
1738+ setlocale(LC_ALL, __name);
1739+#endif
1740+
1741+#ifdef __UCLIBC_MJN3_ONLY__
1742+#warning fix this... should be monetary
1743+#endif
1744+#ifdef __UCLIBC__
1745+# ifdef __UCLIBC_HAS_XLOCALE__
1746+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1747+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1748+# else
1749+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1750+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1751+# endif
1752+#else
1753+ union { char *__s; wchar_t __w; } __u;
1754+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1755+ _M_data->_M_decimal_point = __u.__w;
1756+
1757+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1758+ _M_data->_M_thousands_sep = __u.__w;
1759+#endif
1760+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1761+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1762+
1763+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1764+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1765+ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1766+
1767+ wchar_t* __wcs_ps = 0;
1768+ wchar_t* __wcs_ns = 0;
1769+ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1770+ try
1771+ {
1772+ mbstate_t __state;
1773+ size_t __len = strlen(__cpossign);
1774+ if (__len)
1775+ {
1776+ ++__len;
1777+ memset(&__state, 0, sizeof(mbstate_t));
1778+ __wcs_ps = new wchar_t[__len];
1779+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1780+ _M_data->_M_positive_sign = __wcs_ps;
1781+ }
1782+ else
1783+ _M_data->_M_positive_sign = L"";
1784+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1785+
1786+ __len = strlen(__cnegsign);
1787+ if (!__nposn)
1788+ _M_data->_M_negative_sign = L"()";
1789+ else if (__len)
1790+ {
1791+ ++__len;
1792+ memset(&__state, 0, sizeof(mbstate_t));
1793+ __wcs_ns = new wchar_t[__len];
1794+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1795+ _M_data->_M_negative_sign = __wcs_ns;
1796+ }
1797+ else
1798+ _M_data->_M_negative_sign = L"";
1799+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1800+
1801+ // _Intl == true.
1802+ __len = strlen(__ccurr);
1803+ if (__len)
1804+ {
1805+ ++__len;
1806+ memset(&__state, 0, sizeof(mbstate_t));
1807+ wchar_t* __wcs = new wchar_t[__len];
1808+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1809+ _M_data->_M_curr_symbol = __wcs;
1810+ }
1811+ else
1812+ _M_data->_M_curr_symbol = L"";
1813+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1814+ }
1815+ catch (...)
1816+ {
1817+ delete _M_data;
1818+ _M_data = 0;
1819+ delete __wcs_ps;
1820+ delete __wcs_ns;
1821+#ifdef __UCLIBC_HAS_XLOCALE__
1822+ __uselocale(__old);
1823+#else
1824+ setlocale(LC_ALL, __old);
1825+ free(__old);
1826+#endif
1827+ __throw_exception_again;
1828+ }
1829+
1830+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1831+ __cloc));
1832+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1833+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1834+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1835+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1836+ __pposn);
1837+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1838+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1839+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1840+ __nposn);
1841+
1842+#ifdef __UCLIBC_HAS_XLOCALE__
1843+ __uselocale(__old);
1844+#else
1845+ setlocale(LC_ALL, __old);
1846+ free(__old);
1847+#endif
1848+ }
1849+ }
1850+
1851+ template<>
1852+ void
1853+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
1854+#ifdef __UCLIBC_HAS_XLOCALE__
1855+ const char*)
1856+#else
1857+ const char* __name)
1858+#endif
1859+ {
1860+ if (!_M_data)
1861+ _M_data = new __moneypunct_cache<wchar_t, false>;
1862+
1863+ if (!__cloc)
1864+ {
1865+ // "C" locale
1866+ _M_data->_M_decimal_point = L'.';
1867+ _M_data->_M_thousands_sep = L',';
1868+ _M_data->_M_grouping = "";
1869+ _M_data->_M_grouping_size = 0;
1870+ _M_data->_M_curr_symbol = L"";
1871+ _M_data->_M_curr_symbol_size = 0;
1872+ _M_data->_M_positive_sign = L"";
1873+ _M_data->_M_positive_sign_size = 0;
1874+ _M_data->_M_negative_sign = L"";
1875+ _M_data->_M_negative_sign_size = 0;
1876+ _M_data->_M_frac_digits = 0;
1877+ _M_data->_M_pos_format = money_base::_S_default_pattern;
1878+ _M_data->_M_neg_format = money_base::_S_default_pattern;
1879+
1880+ // Use ctype::widen code without the facet...
1881+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1882+ _M_data->_M_atoms[__i] =
1883+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
1884+ }
1885+ else
1886+ {
1887+ // Named locale.
1888+#ifdef __UCLIBC_HAS_XLOCALE__
1889+ __c_locale __old = __uselocale(__cloc);
1890+#else
1891+ // Switch to named locale so that mbsrtowcs will work.
1892+ char* __old = strdup(setlocale(LC_ALL, NULL));
1893+ setlocale(LC_ALL, __name);
1894+#endif
1895+
1896+#ifdef __UCLIBC_MJN3_ONLY__
1897+#warning fix this... should be monetary
1898+#endif
1899+#ifdef __UCLIBC__
1900+# ifdef __UCLIBC_HAS_XLOCALE__
1901+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1902+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1903+# else
1904+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1905+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1906+# endif
1907+#else
1908+ union { char *__s; wchar_t __w; } __u;
1909+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1910+ _M_data->_M_decimal_point = __u.__w;
1911+
1912+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1913+ _M_data->_M_thousands_sep = __u.__w;
1914+#endif
1915+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1916+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1917+
1918+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1919+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1920+ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1921+
1922+ wchar_t* __wcs_ps = 0;
1923+ wchar_t* __wcs_ns = 0;
1924+ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1925+ try
1926+ {
1927+ mbstate_t __state;
1928+ size_t __len;
1929+ __len = strlen(__cpossign);
1930+ if (__len)
1931+ {
1932+ ++__len;
1933+ memset(&__state, 0, sizeof(mbstate_t));
1934+ __wcs_ps = new wchar_t[__len];
1935+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1936+ _M_data->_M_positive_sign = __wcs_ps;
1937+ }
1938+ else
1939+ _M_data->_M_positive_sign = L"";
1940+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1941+
1942+ __len = strlen(__cnegsign);
1943+ if (!__nposn)
1944+ _M_data->_M_negative_sign = L"()";
1945+ else if (__len)
1946+ {
1947+ ++__len;
1948+ memset(&__state, 0, sizeof(mbstate_t));
1949+ __wcs_ns = new wchar_t[__len];
1950+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1951+ _M_data->_M_negative_sign = __wcs_ns;
1952+ }
1953+ else
1954+ _M_data->_M_negative_sign = L"";
1955+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1956+
1957+ // _Intl == true.
1958+ __len = strlen(__ccurr);
1959+ if (__len)
1960+ {
1961+ ++__len;
1962+ memset(&__state, 0, sizeof(mbstate_t));
1963+ wchar_t* __wcs = new wchar_t[__len];
1964+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1965+ _M_data->_M_curr_symbol = __wcs;
1966+ }
1967+ else
1968+ _M_data->_M_curr_symbol = L"";
1969+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1970+ }
1971+ catch (...)
1972+ {
1973+ delete _M_data;
1974+ _M_data = 0;
1975+ delete __wcs_ps;
1976+ delete __wcs_ns;
1977+#ifdef __UCLIBC_HAS_XLOCALE__
1978+ __uselocale(__old);
1979+#else
1980+ setlocale(LC_ALL, __old);
1981+ free(__old);
1982+#endif
1983+ __throw_exception_again;
1984+ }
1985+
1986+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1987+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1988+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1989+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1990+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1991+ __pposn);
1992+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1993+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1994+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1995+ __nposn);
1996+
1997+#ifdef __UCLIBC_HAS_XLOCALE__
1998+ __uselocale(__old);
1999+#else
2000+ setlocale(LC_ALL, __old);
2001+ free(__old);
2002+#endif
2003+ }
2004+ }
2005+
2006+ template<>
2007+ moneypunct<wchar_t, true>::~moneypunct()
2008+ {
2009+ if (_M_data->_M_positive_sign_size)
2010+ delete [] _M_data->_M_positive_sign;
2011+ if (_M_data->_M_negative_sign_size
2012+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2013+ delete [] _M_data->_M_negative_sign;
2014+ if (_M_data->_M_curr_symbol_size)
2015+ delete [] _M_data->_M_curr_symbol;
2016+ delete _M_data;
2017+ }
2018+
2019+ template<>
2020+ moneypunct<wchar_t, false>::~moneypunct()
2021+ {
2022+ if (_M_data->_M_positive_sign_size)
2023+ delete [] _M_data->_M_positive_sign;
2024+ if (_M_data->_M_negative_sign_size
2025+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2026+ delete [] _M_data->_M_negative_sign;
2027+ if (_M_data->_M_curr_symbol_size)
2028+ delete [] _M_data->_M_curr_symbol;
2029+ delete _M_data;
2030+ }
2031+#endif
2032+}
2033diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2034--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1969-12-31 18:00:00.000000000 -0600
2035+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2005-04-28 01:20:20.000000000 -0500
2036@@ -0,0 +1,173 @@
2037+// std::numpunct implementation details, GNU version -*- C++ -*-
2038+
2039+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2040+//
2041+// This file is part of the GNU ISO C++ Library. This library is free
2042+// software; you can redistribute it and/or modify it under the
2043+// terms of the GNU General Public License as published by the
2044+// Free Software Foundation; either version 2, or (at your option)
2045+// any later version.
2046+
2047+// This library is distributed in the hope that it will be useful,
2048+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2049+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2050+// GNU General Public License for more details.
2051+
2052+// You should have received a copy of the GNU General Public License along
2053+// with this library; see the file COPYING. If not, write to the Free
2054+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2055+// USA.
2056+
2057+// As a special exception, you may use this file as part of a free software
2058+// library without restriction. Specifically, if other files instantiate
2059+// templates or use macros or inline functions from this file, or you compile
2060+// this file and link it with other files to produce an executable, this
2061+// file does not by itself cause the resulting executable to be covered by
2062+// the GNU General Public License. This exception does not however
2063+// invalidate any other reasons why the executable file might be covered by
2064+// the GNU General Public License.
2065+
2066+//
2067+// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
2068+//
2069+
2070+// Written by Benjamin Kosnik <bkoz@redhat.com>
2071+
2072+#define _LIBC
2073+#include <locale>
2074+#undef _LIBC
2075+#include <bits/c++locale_internal.h>
2076+
2077+#ifdef __UCLIBC_MJN3_ONLY__
2078+#warning tailor for stub locale support
2079+#endif
2080+#ifndef __UCLIBC_HAS_XLOCALE__
2081+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2082+#endif
2083+
2084+namespace std
2085+{
2086+ template<>
2087+ void
2088+ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
2089+ {
2090+ if (!_M_data)
2091+ _M_data = new __numpunct_cache<char>;
2092+
2093+ if (!__cloc)
2094+ {
2095+ // "C" locale
2096+ _M_data->_M_grouping = "";
2097+ _M_data->_M_grouping_size = 0;
2098+ _M_data->_M_use_grouping = false;
2099+
2100+ _M_data->_M_decimal_point = '.';
2101+ _M_data->_M_thousands_sep = ',';
2102+
2103+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2104+ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
2105+
2106+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2107+ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
2108+ }
2109+ else
2110+ {
2111+ // Named locale.
2112+ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
2113+ __cloc));
2114+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
2115+ __cloc));
2116+
2117+ // Check for NULL, which implies no grouping.
2118+ if (_M_data->_M_thousands_sep == '\0')
2119+ _M_data->_M_grouping = "";
2120+ else
2121+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2122+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2123+ }
2124+
2125+ // NB: There is no way to extact this info from posix locales.
2126+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2127+ _M_data->_M_truename = "true";
2128+ _M_data->_M_truename_size = 4;
2129+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2130+ _M_data->_M_falsename = "false";
2131+ _M_data->_M_falsename_size = 5;
2132+ }
2133+
2134+ template<>
2135+ numpunct<char>::~numpunct()
2136+ { delete _M_data; }
2137+
2138+#ifdef _GLIBCXX_USE_WCHAR_T
2139+ template<>
2140+ void
2141+ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
2142+ {
2143+ if (!_M_data)
2144+ _M_data = new __numpunct_cache<wchar_t>;
2145+
2146+ if (!__cloc)
2147+ {
2148+ // "C" locale
2149+ _M_data->_M_grouping = "";
2150+ _M_data->_M_grouping_size = 0;
2151+ _M_data->_M_use_grouping = false;
2152+
2153+ _M_data->_M_decimal_point = L'.';
2154+ _M_data->_M_thousands_sep = L',';
2155+
2156+ // Use ctype::widen code without the facet...
2157+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2158+ _M_data->_M_atoms_out[__i] =
2159+ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
2160+
2161+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2162+ _M_data->_M_atoms_in[__j] =
2163+ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
2164+ }
2165+ else
2166+ {
2167+ // Named locale.
2168+ // NB: In the GNU model wchar_t is always 32 bit wide.
2169+#ifdef __UCLIBC_MJN3_ONLY__
2170+#warning fix this
2171+#endif
2172+#ifdef __UCLIBC__
2173+# ifdef __UCLIBC_HAS_XLOCALE__
2174+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
2175+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
2176+# else
2177+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
2178+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
2179+# endif
2180+#else
2181+ union { char *__s; wchar_t __w; } __u;
2182+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
2183+ _M_data->_M_decimal_point = __u.__w;
2184+
2185+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
2186+ _M_data->_M_thousands_sep = __u.__w;
2187+#endif
2188+
2189+ if (_M_data->_M_thousands_sep == L'\0')
2190+ _M_data->_M_grouping = "";
2191+ else
2192+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2193+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2194+ }
2195+
2196+ // NB: There is no way to extact this info from posix locales.
2197+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2198+ _M_data->_M_truename = L"true";
2199+ _M_data->_M_truename_size = 4;
2200+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2201+ _M_data->_M_falsename = L"false";
2202+ _M_data->_M_falsename_size = 5;
2203+ }
2204+
2205+ template<>
2206+ numpunct<wchar_t>::~numpunct()
2207+ { delete _M_data; }
2208+ #endif
2209+}
2210diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.cc
2211--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.cc 1969-12-31 18:00:00.000000000 -0600
2212+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.cc 2005-04-28 01:13:15.000000000 -0500
2213@@ -0,0 +1,406 @@
2214+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2215+
2216+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2217+//
2218+// This file is part of the GNU ISO C++ Library. This library is free
2219+// software; you can redistribute it and/or modify it under the
2220+// terms of the GNU General Public License as published by the
2221+// Free Software Foundation; either version 2, or (at your option)
2222+// any later version.
2223+
2224+// This library is distributed in the hope that it will be useful,
2225+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2226+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2227+// GNU General Public License for more details.
2228+
2229+// You should have received a copy of the GNU General Public License along
2230+// with this library; see the file COPYING. If not, write to the Free
2231+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2232+// USA.
2233+
2234+// As a special exception, you may use this file as part of a free software
2235+// library without restriction. Specifically, if other files instantiate
2236+// templates or use macros or inline functions from this file, or you compile
2237+// this file and link it with other files to produce an executable, this
2238+// file does not by itself cause the resulting executable to be covered by
2239+// the GNU General Public License. This exception does not however
2240+// invalidate any other reasons why the executable file might be covered by
2241+// the GNU General Public License.
2242+
2243+//
2244+// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
2245+// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
2246+//
2247+
2248+// Written by Benjamin Kosnik <bkoz@redhat.com>
2249+
2250+#include <locale>
2251+#include <bits/c++locale_internal.h>
2252+
2253+#ifdef __UCLIBC_MJN3_ONLY__
2254+#warning tailor for stub locale support
2255+#endif
2256+#ifndef __UCLIBC_HAS_XLOCALE__
2257+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2258+#endif
2259+
2260+namespace std
2261+{
2262+ template<>
2263+ void
2264+ __timepunct<char>::
2265+ _M_put(char* __s, size_t __maxlen, const char* __format,
2266+ const tm* __tm) const
2267+ {
2268+#ifdef __UCLIBC_HAS_XLOCALE__
2269+ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
2270+ _M_c_locale_timepunct);
2271+#else
2272+ char* __old = strdup(setlocale(LC_ALL, NULL));
2273+ setlocale(LC_ALL, _M_name_timepunct);
2274+ const size_t __len = strftime(__s, __maxlen, __format, __tm);
2275+ setlocale(LC_ALL, __old);
2276+ free(__old);
2277+#endif
2278+ // Make sure __s is null terminated.
2279+ if (__len == 0)
2280+ __s[0] = '\0';
2281+ }
2282+
2283+ template<>
2284+ void
2285+ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
2286+ {
2287+ if (!_M_data)
2288+ _M_data = new __timepunct_cache<char>;
2289+
2290+ if (!__cloc)
2291+ {
2292+ // "C" locale
2293+ _M_c_locale_timepunct = _S_get_c_locale();
2294+
2295+ _M_data->_M_date_format = "%m/%d/%y";
2296+ _M_data->_M_date_era_format = "%m/%d/%y";
2297+ _M_data->_M_time_format = "%H:%M:%S";
2298+ _M_data->_M_time_era_format = "%H:%M:%S";
2299+ _M_data->_M_date_time_format = "";
2300+ _M_data->_M_date_time_era_format = "";
2301+ _M_data->_M_am = "AM";
2302+ _M_data->_M_pm = "PM";
2303+ _M_data->_M_am_pm_format = "";
2304+
2305+ // Day names, starting with "C"'s Sunday.
2306+ _M_data->_M_day1 = "Sunday";
2307+ _M_data->_M_day2 = "Monday";
2308+ _M_data->_M_day3 = "Tuesday";
2309+ _M_data->_M_day4 = "Wednesday";
2310+ _M_data->_M_day5 = "Thursday";
2311+ _M_data->_M_day6 = "Friday";
2312+ _M_data->_M_day7 = "Saturday";
2313+
2314+ // Abbreviated day names, starting with "C"'s Sun.
2315+ _M_data->_M_aday1 = "Sun";
2316+ _M_data->_M_aday2 = "Mon";
2317+ _M_data->_M_aday3 = "Tue";
2318+ _M_data->_M_aday4 = "Wed";
2319+ _M_data->_M_aday5 = "Thu";
2320+ _M_data->_M_aday6 = "Fri";
2321+ _M_data->_M_aday7 = "Sat";
2322+
2323+ // Month names, starting with "C"'s January.
2324+ _M_data->_M_month01 = "January";
2325+ _M_data->_M_month02 = "February";
2326+ _M_data->_M_month03 = "March";
2327+ _M_data->_M_month04 = "April";
2328+ _M_data->_M_month05 = "May";
2329+ _M_data->_M_month06 = "June";
2330+ _M_data->_M_month07 = "July";
2331+ _M_data->_M_month08 = "August";
2332+ _M_data->_M_month09 = "September";
2333+ _M_data->_M_month10 = "October";
2334+ _M_data->_M_month11 = "November";
2335+ _M_data->_M_month12 = "December";
2336+
2337+ // Abbreviated month names, starting with "C"'s Jan.
2338+ _M_data->_M_amonth01 = "Jan";
2339+ _M_data->_M_amonth02 = "Feb";
2340+ _M_data->_M_amonth03 = "Mar";
2341+ _M_data->_M_amonth04 = "Apr";
2342+ _M_data->_M_amonth05 = "May";
2343+ _M_data->_M_amonth06 = "Jun";
2344+ _M_data->_M_amonth07 = "Jul";
2345+ _M_data->_M_amonth08 = "Aug";
2346+ _M_data->_M_amonth09 = "Sep";
2347+ _M_data->_M_amonth10 = "Oct";
2348+ _M_data->_M_amonth11 = "Nov";
2349+ _M_data->_M_amonth12 = "Dec";
2350+ }
2351+ else
2352+ {
2353+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2354+
2355+ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
2356+ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
2357+ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
2358+ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
2359+ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
2360+ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
2361+ __cloc);
2362+ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
2363+ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
2364+ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
2365+
2366+ // Day names, starting with "C"'s Sunday.
2367+ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
2368+ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
2369+ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
2370+ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
2371+ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
2372+ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
2373+ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
2374+
2375+ // Abbreviated day names, starting with "C"'s Sun.
2376+ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
2377+ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
2378+ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
2379+ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
2380+ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
2381+ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
2382+ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
2383+
2384+ // Month names, starting with "C"'s January.
2385+ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
2386+ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
2387+ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
2388+ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
2389+ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
2390+ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
2391+ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
2392+ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
2393+ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
2394+ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
2395+ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
2396+ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
2397+
2398+ // Abbreviated month names, starting with "C"'s Jan.
2399+ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
2400+ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
2401+ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
2402+ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
2403+ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
2404+ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
2405+ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
2406+ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
2407+ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
2408+ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
2409+ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
2410+ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
2411+ }
2412+ }
2413+
2414+#ifdef _GLIBCXX_USE_WCHAR_T
2415+ template<>
2416+ void
2417+ __timepunct<wchar_t>::
2418+ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
2419+ const tm* __tm) const
2420+ {
2421+#ifdef __UCLIBC_HAS_XLOCALE__
2422+ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
2423+ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
2424+ _M_c_locale_timepunct);
2425+#else
2426+ char* __old = strdup(setlocale(LC_ALL, NULL));
2427+ setlocale(LC_ALL, _M_name_timepunct);
2428+ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
2429+ setlocale(LC_ALL, __old);
2430+ free(__old);
2431+#endif
2432+ // Make sure __s is null terminated.
2433+ if (__len == 0)
2434+ __s[0] = L'\0';
2435+ }
2436+
2437+ template<>
2438+ void
2439+ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
2440+ {
2441+ if (!_M_data)
2442+ _M_data = new __timepunct_cache<wchar_t>;
2443+
2444+#warning wide time stuff
2445+// if (!__cloc)
2446+ {
2447+ // "C" locale
2448+ _M_c_locale_timepunct = _S_get_c_locale();
2449+
2450+ _M_data->_M_date_format = L"%m/%d/%y";
2451+ _M_data->_M_date_era_format = L"%m/%d/%y";
2452+ _M_data->_M_time_format = L"%H:%M:%S";
2453+ _M_data->_M_time_era_format = L"%H:%M:%S";
2454+ _M_data->_M_date_time_format = L"";
2455+ _M_data->_M_date_time_era_format = L"";
2456+ _M_data->_M_am = L"AM";
2457+ _M_data->_M_pm = L"PM";
2458+ _M_data->_M_am_pm_format = L"";
2459+
2460+ // Day names, starting with "C"'s Sunday.
2461+ _M_data->_M_day1 = L"Sunday";
2462+ _M_data->_M_day2 = L"Monday";
2463+ _M_data->_M_day3 = L"Tuesday";
2464+ _M_data->_M_day4 = L"Wednesday";
2465+ _M_data->_M_day5 = L"Thursday";
2466+ _M_data->_M_day6 = L"Friday";
2467+ _M_data->_M_day7 = L"Saturday";
2468+
2469+ // Abbreviated day names, starting with "C"'s Sun.
2470+ _M_data->_M_aday1 = L"Sun";
2471+ _M_data->_M_aday2 = L"Mon";
2472+ _M_data->_M_aday3 = L"Tue";
2473+ _M_data->_M_aday4 = L"Wed";
2474+ _M_data->_M_aday5 = L"Thu";
2475+ _M_data->_M_aday6 = L"Fri";
2476+ _M_data->_M_aday7 = L"Sat";
2477+
2478+ // Month names, starting with "C"'s January.
2479+ _M_data->_M_month01 = L"January";
2480+ _M_data->_M_month02 = L"February";
2481+ _M_data->_M_month03 = L"March";
2482+ _M_data->_M_month04 = L"April";
2483+ _M_data->_M_month05 = L"May";
2484+ _M_data->_M_month06 = L"June";
2485+ _M_data->_M_month07 = L"July";
2486+ _M_data->_M_month08 = L"August";
2487+ _M_data->_M_month09 = L"September";
2488+ _M_data->_M_month10 = L"October";
2489+ _M_data->_M_month11 = L"November";
2490+ _M_data->_M_month12 = L"December";
2491+
2492+ // Abbreviated month names, starting with "C"'s Jan.
2493+ _M_data->_M_amonth01 = L"Jan";
2494+ _M_data->_M_amonth02 = L"Feb";
2495+ _M_data->_M_amonth03 = L"Mar";
2496+ _M_data->_M_amonth04 = L"Apr";
2497+ _M_data->_M_amonth05 = L"May";
2498+ _M_data->_M_amonth06 = L"Jun";
2499+ _M_data->_M_amonth07 = L"Jul";
2500+ _M_data->_M_amonth08 = L"Aug";
2501+ _M_data->_M_amonth09 = L"Sep";
2502+ _M_data->_M_amonth10 = L"Oct";
2503+ _M_data->_M_amonth11 = L"Nov";
2504+ _M_data->_M_amonth12 = L"Dec";
2505+ }
2506+#if 0
2507+ else
2508+ {
2509+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2510+
2511+ union { char *__s; wchar_t *__w; } __u;
2512+
2513+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
2514+ _M_data->_M_date_format = __u.__w;
2515+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
2516+ _M_data->_M_date_era_format = __u.__w;
2517+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
2518+ _M_data->_M_time_format = __u.__w;
2519+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
2520+ _M_data->_M_time_era_format = __u.__w;
2521+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
2522+ _M_data->_M_date_time_format = __u.__w;
2523+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
2524+ _M_data->_M_date_time_era_format = __u.__w;
2525+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
2526+ _M_data->_M_am = __u.__w;
2527+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
2528+ _M_data->_M_pm = __u.__w;
2529+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
2530+ _M_data->_M_am_pm_format = __u.__w;
2531+
2532+ // Day names, starting with "C"'s Sunday.
2533+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
2534+ _M_data->_M_day1 = __u.__w;
2535+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
2536+ _M_data->_M_day2 = __u.__w;
2537+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
2538+ _M_data->_M_day3 = __u.__w;
2539+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
2540+ _M_data->_M_day4 = __u.__w;
2541+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
2542+ _M_data->_M_day5 = __u.__w;
2543+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
2544+ _M_data->_M_day6 = __u.__w;
2545+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
2546+ _M_data->_M_day7 = __u.__w;
2547+
2548+ // Abbreviated day names, starting with "C"'s Sun.
2549+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
2550+ _M_data->_M_aday1 = __u.__w;
2551+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
2552+ _M_data->_M_aday2 = __u.__w;
2553+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
2554+ _M_data->_M_aday3 = __u.__w;
2555+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
2556+ _M_data->_M_aday4 = __u.__w;
2557+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
2558+ _M_data->_M_aday5 = __u.__w;
2559+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
2560+ _M_data->_M_aday6 = __u.__w;
2561+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
2562+ _M_data->_M_aday7 = __u.__w;
2563+
2564+ // Month names, starting with "C"'s January.
2565+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
2566+ _M_data->_M_month01 = __u.__w;
2567+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
2568+ _M_data->_M_month02 = __u.__w;
2569+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
2570+ _M_data->_M_month03 = __u.__w;
2571+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
2572+ _M_data->_M_month04 = __u.__w;
2573+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
2574+ _M_data->_M_month05 = __u.__w;
2575+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
2576+ _M_data->_M_month06 = __u.__w;
2577+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
2578+ _M_data->_M_month07 = __u.__w;
2579+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
2580+ _M_data->_M_month08 = __u.__w;
2581+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
2582+ _M_data->_M_month09 = __u.__w;
2583+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
2584+ _M_data->_M_month10 = __u.__w;
2585+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
2586+ _M_data->_M_month11 = __u.__w;
2587+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
2588+ _M_data->_M_month12 = __u.__w;
2589+
2590+ // Abbreviated month names, starting with "C"'s Jan.
2591+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
2592+ _M_data->_M_amonth01 = __u.__w;
2593+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
2594+ _M_data->_M_amonth02 = __u.__w;
2595+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
2596+ _M_data->_M_amonth03 = __u.__w;
2597+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
2598+ _M_data->_M_amonth04 = __u.__w;
2599+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
2600+ _M_data->_M_amonth05 = __u.__w;
2601+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
2602+ _M_data->_M_amonth06 = __u.__w;
2603+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
2604+ _M_data->_M_amonth07 = __u.__w;
2605+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
2606+ _M_data->_M_amonth08 = __u.__w;
2607+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
2608+ _M_data->_M_amonth09 = __u.__w;
2609+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
2610+ _M_data->_M_amonth10 = __u.__w;
2611+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
2612+ _M_data->_M_amonth11 = __u.__w;
2613+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
2614+ _M_data->_M_amonth12 = __u.__w;
2615+ }
2616+#endif // 0
2617+ }
2618+#endif
2619+}
2620diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.h
2621--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.h 1969-12-31 18:00:00.000000000 -0600
2622+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.h 2004-05-22 18:46:31.000000000 -0500
2623@@ -0,0 +1,68 @@
2624+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2625+
2626+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2627+//
2628+// This file is part of the GNU ISO C++ Library. This library is free
2629+// software; you can redistribute it and/or modify it under the
2630+// terms of the GNU General Public License as published by the
2631+// Free Software Foundation; either version 2, or (at your option)
2632+// any later version.
2633+
2634+// This library is distributed in the hope that it will be useful,
2635+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2636+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2637+// GNU General Public License for more details.
2638+
2639+// You should have received a copy of the GNU General Public License along
2640+// with this library; see the file COPYING. If not, write to the Free
2641+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2642+// USA.
2643+
2644+// As a special exception, you may use this file as part of a free software
2645+// library without restriction. Specifically, if other files instantiate
2646+// templates or use macros or inline functions from this file, or you compile
2647+// this file and link it with other files to produce an executable, this
2648+// file does not by itself cause the resulting executable to be covered by
2649+// the GNU General Public License. This exception does not however
2650+// invalidate any other reasons why the executable file might be covered by
2651+// the GNU General Public License.
2652+
2653+//
2654+// ISO C++ 14882: 22.2.5.1.2 - time_get functions
2655+// ISO C++ 14882: 22.2.5.3.2 - time_put functions
2656+//
2657+
2658+// Written by Benjamin Kosnik <bkoz@redhat.com>
2659+
2660+ template<typename _CharT>
2661+ __timepunct<_CharT>::__timepunct(size_t __refs)
2662+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2663+ _M_name_timepunct(_S_get_c_name())
2664+ { _M_initialize_timepunct(); }
2665+
2666+ template<typename _CharT>
2667+ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
2668+ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
2669+ _M_name_timepunct(_S_get_c_name())
2670+ { _M_initialize_timepunct(); }
2671+
2672+ template<typename _CharT>
2673+ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
2674+ size_t __refs)
2675+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2676+ _M_name_timepunct(__s)
2677+ {
2678+ char* __tmp = new char[std::strlen(__s) + 1];
2679+ std::strcpy(__tmp, __s);
2680+ _M_name_timepunct = __tmp;
2681+ _M_initialize_timepunct(__cloc);
2682+ }
2683+
2684+ template<typename _CharT>
2685+ __timepunct<_CharT>::~__timepunct()
2686+ {
2687+ if (_M_name_timepunct != _S_get_c_name())
2688+ delete [] _M_name_timepunct;
2689+ delete _M_data;
2690+ _S_destroy_c_locale(_M_c_locale_timepunct);
2691+ }
2692diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_base.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_base.h
2693--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_base.h 1969-12-31 18:00:00.000000000 -0600
2694+++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_base.h 2005-04-28 01:10:27.000000000 -0500
2695@@ -0,0 +1,64 @@
2696+// Locale support -*- C++ -*-
2697+
2698+// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004
2699+// Free Software Foundation, Inc.
2700+//
2701+// This file is part of the GNU ISO C++ Library. This library is free
2702+// software; you can redistribute it and/or modify it under the
2703+// terms of the GNU General Public License as published by the
2704+// Free Software Foundation; either version 2, or (at your option)
2705+// any later version.
2706+
2707+// This library is distributed in the hope that it will be useful,
2708+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2709+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2710+// GNU General Public License for more details.
2711+
2712+// You should have received a copy of the GNU General Public License along
2713+// with this library; see the file COPYING. If not, write to the Free
2714+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2715+// USA.
2716+
2717+// As a special exception, you may use this file as part of a free software
2718+// library without restriction. Specifically, if other files instantiate
2719+// templates or use macros or inline functions from this file, or you compile
2720+// this file and link it with other files to produce an executable, this
2721+// file does not by itself cause the resulting executable to be covered by
2722+// the GNU General Public License. This exception does not however
2723+// invalidate any other reasons why the executable file might be covered by
2724+// the GNU General Public License.
2725+
2726+//
2727+// ISO C++ 14882: 22.1 Locales
2728+//
2729+
2730+/** @file ctype_base.h
2731+ * This is an internal header file, included by other library headers.
2732+ * You should not attempt to use it directly.
2733+ */
2734+
2735+// Information as gleaned from /usr/include/ctype.h
2736+
2737+ /// @brief Base class for ctype.
2738+ struct ctype_base
2739+ {
2740+ // Note: In uClibc, the following two types depend on configuration.
2741+
2742+ // Non-standard typedefs.
2743+ typedef const __ctype_touplow_t* __to_type;
2744+
2745+ // NB: Offsets into ctype<char>::_M_table force a particular size
2746+ // on the mask type. Because of this, we don't use an enum.
2747+ typedef __ctype_mask_t mask;
2748+ static const mask upper = _ISupper;
2749+ static const mask lower = _ISlower;
2750+ static const mask alpha = _ISalpha;
2751+ static const mask digit = _ISdigit;
2752+ static const mask xdigit = _ISxdigit;
2753+ static const mask space = _ISspace;
2754+ static const mask print = _ISprint;
2755+ static const mask graph = _ISalpha | _ISdigit | _ISpunct;
2756+ static const mask cntrl = _IScntrl;
2757+ static const mask punct = _ISpunct;
2758+ static const mask alnum = _ISalpha | _ISdigit;
2759+ };
2760diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_inline.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_inline.h
2761--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_inline.h 1969-12-31 18:00:00.000000000 -0600
2762+++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_inline.h 2002-06-24 00:49:19.000000000 -0500
2763@@ -0,0 +1,69 @@
2764+// Locale support -*- C++ -*-
2765+
2766+// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
2767+//
2768+// This file is part of the GNU ISO C++ Library. This library is free
2769+// software; you can redistribute it and/or modify it under the
2770+// terms of the GNU General Public License as published by the
2771+// Free Software Foundation; either version 2, or (at your option)
2772+// any later version.
2773+
2774+// This library is distributed in the hope that it will be useful,
2775+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2776+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2777+// GNU General Public License for more details.
2778+
2779+// You should have received a copy of the GNU General Public License along
2780+// with this library; see the file COPYING. If not, write to the Free
2781+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2782+// USA.
2783+
2784+// As a special exception, you may use this file as part of a free software
2785+// library without restriction. Specifically, if other files instantiate
2786+// templates or use macros or inline functions from this file, or you compile
2787+// this file and link it with other files to produce an executable, this
2788+// file does not by itself cause the resulting executable to be covered by
2789+// the GNU General Public License. This exception does not however
2790+// invalidate any other reasons why the executable file might be covered by
2791+// the GNU General Public License.
2792+
2793+//
2794+// ISO C++ 14882: 22.1 Locales
2795+//
2796+
2797+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
2798+// functions go in ctype.cc
2799+
2800+ bool
2801+ ctype<char>::
2802+ is(mask __m, char __c) const
2803+ { return _M_table[static_cast<unsigned char>(__c)] & __m; }
2804+
2805+ const char*
2806+ ctype<char>::
2807+ is(const char* __low, const char* __high, mask* __vec) const
2808+ {
2809+ while (__low < __high)
2810+ *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
2811+ return __high;
2812+ }
2813+
2814+ const char*
2815+ ctype<char>::
2816+ scan_is(mask __m, const char* __low, const char* __high) const
2817+ {
2818+ while (__low < __high
2819+ && !(_M_table[static_cast<unsigned char>(*__low)] & __m))
2820+ ++__low;
2821+ return __low;
2822+ }
2823+
2824+ const char*
2825+ ctype<char>::
2826+ scan_not(mask __m, const char* __low, const char* __high) const
2827+ {
2828+ while (__low < __high
2829+ && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
2830+ ++__low;
2831+ return __low;
2832+ }
2833diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_noninline.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h
2834--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1969-12-31 18:00:00.000000000 -0600
2835+++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2005-04-28 01:10:27.000000000 -0500
2836@@ -0,0 +1,92 @@
2837+// Locale support -*- C++ -*-
2838+
2839+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
2840+// Free Software Foundation, Inc.
2841+//
2842+// This file is part of the GNU ISO C++ Library. This library is free
2843+// software; you can redistribute it and/or modify it under the
2844+// terms of the GNU General Public License as published by the
2845+// Free Software Foundation; either version 2, or (at your option)
2846+// any later version.
2847+
2848+// This library is distributed in the hope that it will be useful,
2849+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2850+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2851+// GNU General Public License for more details.
2852+
2853+// You should have received a copy of the GNU General Public License along
2854+// with this library; see the file COPYING. If not, write to the Free
2855+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2856+// USA.
2857+
2858+// As a special exception, you may use this file as part of a free software
2859+// library without restriction. Specifically, if other files instantiate
2860+// templates or use macros or inline functions from this file, or you compile
2861+// this file and link it with other files to produce an executable, this
2862+// file does not by itself cause the resulting executable to be covered by
2863+// the GNU General Public License. This exception does not however
2864+// invalidate any other reasons why the executable file might be covered by
2865+// the GNU General Public License.
2866+
2867+//
2868+// ISO C++ 14882: 22.1 Locales
2869+//
2870+
2871+// Information as gleaned from /usr/include/ctype.h
2872+
2873+ const ctype_base::mask*
2874+ ctype<char>::classic_table() throw()
2875+ { return __C_ctype_b; }
2876+
2877+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
2878+ size_t __refs)
2879+ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
2880+ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
2881+ {
2882+ _M_toupper = __C_ctype_toupper;
2883+ _M_tolower = __C_ctype_tolower;
2884+ _M_table = __table ? __table : __C_ctype_b;
2885+ memset(_M_widen, 0, sizeof(_M_widen));
2886+ memset(_M_narrow, 0, sizeof(_M_narrow));
2887+ }
2888+
2889+ ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
2890+ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
2891+ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
2892+ {
2893+ _M_toupper = __C_ctype_toupper;
2894+ _M_tolower = __C_ctype_tolower;
2895+ _M_table = __table ? __table : __C_ctype_b;
2896+ memset(_M_widen, 0, sizeof(_M_widen));
2897+ memset(_M_narrow, 0, sizeof(_M_narrow));
2898+ }
2899+
2900+ char
2901+ ctype<char>::do_toupper(char __c) const
2902+ { return _M_toupper[static_cast<unsigned char>(__c)]; }
2903+
2904+ const char*
2905+ ctype<char>::do_toupper(char* __low, const char* __high) const
2906+ {
2907+ while (__low < __high)
2908+ {
2909+ *__low = _M_toupper[static_cast<unsigned char>(*__low)];
2910+ ++__low;
2911+ }
2912+ return __high;
2913+ }
2914+
2915+ char
2916+ ctype<char>::do_tolower(char __c) const
2917+ { return _M_tolower[static_cast<unsigned char>(__c)]; }
2918+
2919+ const char*
2920+ ctype<char>::do_tolower(char* __low, const char* __high) const
2921+ {
2922+ while (__low < __high)
2923+ {
2924+ *__low = _M_tolower[static_cast<unsigned char>(*__low)];
2925+ ++__low;
2926+ }
2927+ return __high;
2928+ }
2929diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/os_defines.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/os_defines.h
2930--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/os_defines.h 1969-12-31 18:00:00.000000000 -0600
2931+++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/os_defines.h 2005-04-28 01:10:27.000000000 -0500
2932@@ -0,0 +1,44 @@
2933+// Specific definitions for GNU/Linux -*- C++ -*-
2934+
2935+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
2936+//
2937+// This file is part of the GNU ISO C++ Library. This library is free
2938+// software; you can redistribute it and/or modify it under the
2939+// terms of the GNU General Public License as published by the
2940+// Free Software Foundation; either version 2, or (at your option)
2941+// any later version.
2942+
2943+// This library is distributed in the hope that it will be useful,
2944+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2945+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2946+// GNU General Public License for more details.
2947+
2948+// You should have received a copy of the GNU General Public License along
2949+// with this library; see the file COPYING. If not, write to the Free
2950+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2951+// USA.
2952+
2953+// As a special exception, you may use this file as part of a free software
2954+// library without restriction. Specifically, if other files instantiate
2955+// templates or use macros or inline functions from this file, or you compile
2956+// this file and link it with other files to produce an executable, this
2957+// file does not by itself cause the resulting executable to be covered by
2958+// the GNU General Public License. This exception does not however
2959+// invalidate any other reasons why the executable file might be covered by
2960+// the GNU General Public License.
2961+
2962+#ifndef _GLIBCXX_OS_DEFINES
2963+#define _GLIBCXX_OS_DEFINES 1
2964+
2965+// System-specific #define, typedefs, corrections, etc, go here. This
2966+// file will come before all others.
2967+
2968+// This keeps isanum, et al from being propagated as macros.
2969+#define __NO_CTYPE 1
2970+
2971+#include <features.h>
2972+
2973+// We must not see the optimized string functions GNU libc defines.
2974+#define __NO_STRING_INLINES
2975+
2976+#endif
2977diff -urN gcc-4.0.0-100/libstdc++-v3/configure gcc-4.0.0/libstdc++-v3/configure
2978--- gcc-4.0.0-100/libstdc++-v3/configure 2005-04-30 13:06:53.683055232 -0500
2979+++ gcc-4.0.0/libstdc++-v3/configure 2005-04-30 12:24:24.000000000 -0500
2980@@ -3998,6 +3998,11 @@
2981 lt_cv_deplibs_check_method=pass_all
2982 ;;
2983
2984+linux-uclibc*)
2985+ lt_cv_deplibs_check_method=pass_all
2986+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
2987+ ;;
2988+
2989 netbsd* | knetbsd*-gnu)
2990 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
2991 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
2992@@ -5672,7 +5677,7 @@
2993 enableval="$enable_clocale"
2994
2995 case "$enableval" in
2996- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;;
2997+ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;;
2998 *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5
2999 echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;}
3000 { (exit 1); exit 1; }; } ;;
3001@@ -5697,6 +5702,9 @@
3002 # Default to "generic".
3003 if test $enable_clocale_flag = auto; then
3004 case ${target_os} in
3005+ linux-uclibc*)
3006+ enable_clocale_flag=uclibc
3007+ ;;
3008 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
3009 cat >conftest.$ac_ext <<_ACEOF
3010 /* confdefs.h. */
3011@@ -5927,6 +5935,76 @@
3012 CTIME_CC=config/locale/generic/time_members.cc
3013 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
3014 ;;
3015+ uclibc)
3016+ echo "$as_me:$LINENO: result: uclibc" >&5
3017+echo "${ECHO_T}uclibc" >&6
3018+
3019+ # Declare intention to use gettext, and add support for specific
3020+ # languages.
3021+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
3022+ ALL_LINGUAS="de fr"
3023+
3024+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
3025+ # Extract the first word of "msgfmt", so it can be a program name with args.
3026+set dummy msgfmt; ac_word=$2
3027+echo "$as_me:$LINENO: checking for $ac_word" >&5
3028+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
3029+if test "${ac_cv_prog_check_msgfmt+set}" = set; then
3030+ echo $ECHO_N "(cached) $ECHO_C" >&6
3031+else
3032+ if test -n "$check_msgfmt"; then
3033+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
3034+else
3035+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3036+for as_dir in $PATH
3037+do
3038+ IFS=$as_save_IFS
3039+ test -z "$as_dir" && as_dir=.
3040+ for ac_exec_ext in '' $ac_executable_extensions; do
3041+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
3042+ ac_cv_prog_check_msgfmt="yes"
3043+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
3044+ break 2
3045+ fi
3046+done
3047+done
3048+
3049+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
3050+fi
3051+fi
3052+check_msgfmt=$ac_cv_prog_check_msgfmt
3053+if test -n "$check_msgfmt"; then
3054+ echo "$as_me:$LINENO: result: $check_msgfmt" >&5
3055+echo "${ECHO_T}$check_msgfmt" >&6
3056+else
3057+ echo "$as_me:$LINENO: result: no" >&5
3058+echo "${ECHO_T}no" >&6
3059+fi
3060+
3061+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
3062+ USE_NLS=yes
3063+ fi
3064+ # Export the build objects.
3065+ for ling in $ALL_LINGUAS; do \
3066+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
3067+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
3068+ done
3069+
3070+
3071+
3072+ CLOCALE_H=config/locale/uclibc/c_locale.h
3073+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
3074+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
3075+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
3076+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
3077+ CMESSAGES_H=config/locale/uclibc/messages_members.h
3078+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
3079+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
3080+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
3081+ CTIME_H=config/locale/uclibc/time_members.h
3082+ CTIME_CC=config/locale/uclibc/time_members.cc
3083+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
3084+ ;;
3085 esac
3086
3087 # This is where the testsuite looks for locale catalogs, using the
3088diff -urN gcc-4.0.0-100/libstdc++-v3/configure.host gcc-4.0.0/libstdc++-v3/configure.host
3089--- gcc-4.0.0-100/libstdc++-v3/configure.host 2005-04-30 13:06:53.688054472 -0500
3090+++ gcc-4.0.0/libstdc++-v3/configure.host 2005-04-28 20:20:32.000000000 -0500
3091@@ -249,6 +249,12 @@
3092 ;;
3093 esac
3094
3095+# Override for uClibc since linux-uclibc gets mishandled above.
3096+case "${host_os}" in
3097+ *-uclibc*)
3098+ os_include_dir="os/uclibc"
3099+ ;;
3100+esac
3101
3102 # Set any OS-dependent and CPU-dependent bits.
3103 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
3104diff -urN gcc-4.0.0-100/libstdc++-v3/crossconfig.m4 gcc-4.0.0/libstdc++-v3/crossconfig.m4
3105--- gcc-4.0.0-100/libstdc++-v3/crossconfig.m4 2005-04-30 13:06:53.689054320 -0500
3106+++ gcc-4.0.0/libstdc++-v3/crossconfig.m4 2005-04-28 20:27:15.000000000 -0500
3107@@ -142,6 +142,98 @@
3108 ;;
3109 esac
3110 ;;
3111+ *-uclibc*)
3112+# Temporary hack until we implement the float versions of the libm funcs
3113+ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
3114+ machine/endian.h machine/param.h sys/machine.h sys/types.h \
3115+ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h])
3116+ SECTION_FLAGS='-ffunction-sections -fdata-sections'
3117+ AC_SUBST(SECTION_FLAGS)
3118+ GLIBCXX_CHECK_LINKER_FEATURES
3119+ GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
3120+ GLIBCXX_CHECK_WCHAR_T_SUPPORT
3121+
3122+ # For LFS.
3123+ AC_DEFINE(HAVE_INT64_T)
3124+ case "$target" in
3125+ *-uclinux*)
3126+ # Don't enable LFS with uClinux
3127+ ;;
3128+ *)
3129+ AC_DEFINE(_GLIBCXX_USE_LFS)
3130+ esac
3131+
3132+ # For showmanyc_helper().
3133+ AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
3134+ GLIBCXX_CHECK_POLL
3135+ GLIBCXX_CHECK_S_ISREG_OR_S_IFREG
3136+
3137+ # For xsputn_2().
3138+ AC_CHECK_HEADERS(sys/uio.h)
3139+ GLIBCXX_CHECK_WRITEV
3140+
3141+# AC_DEFINE(HAVE_ACOSF)
3142+# AC_DEFINE(HAVE_ASINF)
3143+# AC_DEFINE(HAVE_ATANF)
3144+# AC_DEFINE(HAVE_ATAN2F)
3145+ AC_DEFINE(HAVE_CEILF)
3146+ AC_DEFINE(HAVE_COPYSIGN)
3147+# AC_DEFINE(HAVE_COPYSIGNF)
3148+# AC_DEFINE(HAVE_COSF)
3149+# AC_DEFINE(HAVE_COSHF)
3150+# AC_DEFINE(HAVE_EXPF)
3151+# AC_DEFINE(HAVE_FABSF)
3152+ AC_DEFINE(HAVE_FINITE)
3153+ AC_DEFINE(HAVE_FINITEF)
3154+ AC_DEFINE(HAVE_FLOORF)
3155+# AC_DEFINE(HAVE_FMODF)
3156+# AC_DEFINE(HAVE_FREXPF)
3157+ AC_DEFINE(HAVE_HYPOT)
3158+# AC_DEFINE(HAVE_HYPOTF)
3159+ AC_DEFINE(HAVE_ISINF)
3160+ AC_DEFINE(HAVE_ISINFF)
3161+ AC_DEFINE(HAVE_ISNAN)
3162+ AC_DEFINE(HAVE_ISNANF)
3163+# AC_DEFINE(HAVE_LOGF)
3164+# AC_DEFINE(HAVE_LOG10F)
3165+# AC_DEFINE(HAVE_MODFF)
3166+# AC_DEFINE(HAVE_SINF)
3167+# AC_DEFINE(HAVE_SINHF)
3168+# AC_DEFINE(HAVE_SINCOS)
3169+# AC_DEFINE(HAVE_SINCOSF)
3170+ AC_DEFINE(HAVE_SQRTF)
3171+# AC_DEFINE(HAVE_TANF)
3172+# AC_DEFINE(HAVE_TANHF)
3173+ if test x"long_double_math_on_this_cpu" = x"yes"; then
3174+# AC_DEFINE(HAVE_ACOSL)
3175+# AC_DEFINE(HAVE_ASINL)
3176+# AC_DEFINE(HAVE_ATANL)
3177+# AC_DEFINE(HAVE_ATAN2L)
3178+# AC_DEFINE(HAVE_CEILL)
3179+# AC_DEFINE(HAVE_COPYSIGNL)
3180+# AC_DEFINE(HAVE_COSL)
3181+# AC_DEFINE(HAVE_COSHL)
3182+# AC_DEFINE(HAVE_EXPL)
3183+# AC_DEFINE(HAVE_FABSL)
3184+# AC_DEFINE(HAVE_FINITEL)
3185+# AC_DEFINE(HAVE_FLOORL)
3186+# AC_DEFINE(HAVE_FMODL)
3187+# AC_DEFINE(HAVE_FREXPL)
3188+# AC_DEFINE(HAVE_HYPOTL)
3189+# AC_DEFINE(HAVE_ISINFL)
3190+# AC_DEFINE(HAVE_ISNANL)
3191+# AC_DEFINE(HAVE_LOGL)
3192+# AC_DEFINE(HAVE_LOG10L)
3193+# AC_DEFINE(HAVE_MODFL)
3194+# AC_DEFINE(HAVE_POWL)
3195+# AC_DEFINE(HAVE_SINL)
3196+# AC_DEFINE(HAVE_SINHL)
3197+# AC_DEFINE(HAVE_SINCOSL)
3198+# AC_DEFINE(HAVE_SQRTL)
3199+# AC_DEFINE(HAVE_TANL)
3200+# AC_DEFINE(HAVE_TANHL)
3201+ fi
3202+ ;;
3203 *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu)
3204 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
3205 machine/endian.h machine/param.h sys/machine.h sys/types.h \
3206@@ -156,7 +248,7 @@
3207 AC_DEFINE(HAVE_INT64_T)
3208 case "$target" in
3209 *-uclinux*)
3210- # Don't enable LFS with uClibc
3211+ # Don't enable LFS with uClinux
3212 ;;
3213 *)
3214 AC_DEFINE(_GLIBCXX_USE_LFS)
3215diff -urN gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h
3216--- gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h 2005-04-30 13:06:53.690054168 -0500
3217+++ gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h 2005-04-28 20:15:56.000000000 -0500
3218@@ -101,7 +101,9 @@
3219 using std::wmemcpy;
3220 using std::wmemmove;
3221 using std::wmemset;
3222+#if _GLIBCXX_HAVE_WCSFTIME
3223 using std::wcsftime;
3224+#endif
3225
3226 #if _GLIBCXX_USE_C99
3227 using std::wcstold;
3228diff -urN gcc-4.0.0-100/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.0.0/libstdc++-v3/include/c_std/std_cwchar.h
3229--- gcc-4.0.0-100/libstdc++-v3/include/c_std/std_cwchar.h 2005-04-30 13:06:53.691054016 -0500
3230+++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cwchar.h 2005-04-28 20:15:56.000000000 -0500
3231@@ -179,7 +179,9 @@
3232 using ::wcscoll;
3233 using ::wcscpy;
3234 using ::wcscspn;
3235+#if _GLIBCXX_HAVE_WCSFTIME
3236 using ::wcsftime;
3237+#endif
3238 using ::wcslen;
3239 using ::wcsncat;
3240 using ::wcsncmp;
diff --git a/meta/packages/gcc/gcc-4.0.2/301-missing-execinfo_h.patch b/meta/packages/gcc/gcc-4.0.2/301-missing-execinfo_h.patch
new file mode 100644
index 0000000000..8867593819
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.0.2/301-missing-execinfo_h.patch
@@ -0,0 +1,14 @@
1From:
2http://buildroot.uclibc.org/cgi-bin/viewcvs.cgi/*checkout*/trunk/buildroot/toolchain/gcc/4.0.2/301-missing-execinfo_h.patch?rev=11715
3
4--- gcc-4.0.0/boehm-gc/include/gc.h-orig 2005-04-28 22:28:57.000000000 -0500
5+++ gcc-4.0.0/boehm-gc/include/gc.h 2005-04-28 22:30:38.000000000 -0500
6@@ -500,7 +500,7 @@
7 #ifdef __linux__
8 # include <features.h>
9 # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
10- && !defined(__ia64__)
11+ && !defined(__ia64__) && !defined(__UCLIBC__)
12 # ifndef GC_HAVE_BUILTIN_BACKTRACE
13 # define GC_HAVE_BUILTIN_BACKTRACE
14 # endif
diff --git a/meta/packages/gcc/gcc-4.0.2/302-c99-snprintf.patch b/meta/packages/gcc/gcc-4.0.2/302-c99-snprintf.patch
new file mode 100644
index 0000000000..5159a52cd7
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.0.2/302-c99-snprintf.patch
@@ -0,0 +1,14 @@
1From:
2http://buildroot.uclibc.org/cgi-bin/viewcvs.cgi/*checkout*/trunk/buildroot/toolchain/gcc/4.0.2/302-c99-snprintf.patch?rev=11715
3
4--- gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h-orig 2005-04-29 00:08:41.000000000 -0500
5+++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h 2005-04-29 00:08:45.000000000 -0500
6@@ -142,7 +142,7 @@
7 using ::vsprintf;
8 }
9
10-#if _GLIBCXX_USE_C99
11+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
12
13 #undef snprintf
14 #undef vfscanf
diff --git a/meta/packages/gcc/gcc-4.0.2/303-c99-complex-ugly-hack.patch b/meta/packages/gcc/gcc-4.0.2/303-c99-complex-ugly-hack.patch
new file mode 100644
index 0000000000..0ba0a89b4f
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.0.2/303-c99-complex-ugly-hack.patch
@@ -0,0 +1,15 @@
1From:
2http://buildroot.uclibc.org/cgi-bin/viewcvs.cgi/*checkout*/trunk/buildroot/toolchain/gcc/4.0.2/303-c99-complex-ugly-hack.patch?rev=11715
3
4--- gcc-4.0.0/libstdc++-v3/configure-old 2005-04-30 22:04:48.061603912 -0500
5+++ gcc-4.0.0/libstdc++-v3/configure 2005-04-30 22:06:13.678588152 -0500
6@@ -7194,6 +7194,9 @@
7 cat >>conftest.$ac_ext <<_ACEOF
8 /* end confdefs.h. */
9 #include <complex.h>
10+#ifdef __UCLIBC__
11+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
12+#endif
13 int
14 main ()
15 {
diff --git a/meta/packages/gcc/gcc-4.0.2/800-arm-bigendian.patch b/meta/packages/gcc/gcc-4.0.2/800-arm-bigendian.patch
new file mode 100644
index 0000000000..e5fc413485
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.0.2/800-arm-bigendian.patch
@@ -0,0 +1,70 @@
1From:
2http://buildroot.uclibc.org/cgi-bin/viewcvs.cgi/trunk/buildroot/toolchain/gcc/4.0.2/800-arm-bigendian.patch?rev=14828&view=markup
3
4By Lennert Buytenhek <buytenh@wantstofly.org>
5Adds support for arm*b-linux* big-endian ARM targets
6
7See http://gcc.gnu.org/PR16350
8
9--- gcc-4.0.3/gcc/config/arm/linux-elf.h
10+++ gcc-4.0.3/gcc/config/arm/linux-elf.h
11@@ -31,19 +31,33 @@
12 /* Do not assume anything about header files. */
13 #define NO_IMPLICIT_EXTERN_C
14
15+/*
16+ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
17+ * (big endian) configurations.
18+ */
19+#if TARGET_BIG_ENDIAN_DEFAULT
20+#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END
21+#define TARGET_ENDIAN_OPTION "mbig-endian"
22+#define TARGET_LINKER_EMULATION "armelfb_linux"
23+#else
24+#define TARGET_ENDIAN_DEFAULT 0
25+#define TARGET_ENDIAN_OPTION "mlittle-endian"
26+#define TARGET_LINKER_EMULATION "armelf_linux"
27+#endif
28+
29 #undef TARGET_DEFAULT_FLOAT_ABI
30 #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
31
32 #undef TARGET_DEFAULT
33-#define TARGET_DEFAULT (0)
34+#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
35
36 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
37
38-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
39+#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
40
41 #undef MULTILIB_DEFAULTS
42 #define MULTILIB_DEFAULTS \
43- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
44+ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
45
46 /* The GNU C++ standard library requires that these macros be defined. */
47 #undef CPLUSPLUS_CPP_SPEC
48@@ -90,7 +104,7 @@
49 %{rdynamic:-export-dynamic} \
50 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
51 -X \
52- %{mbig-endian:-EB}" \
53+ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
54 SUBTARGET_EXTRA_LINK_SPEC
55
56 #define TARGET_OS_CPP_BUILTINS() \
57--- gcc-4.0.3/gcc/config.gcc
58+++ gcc-4.0.3/gcc/config.gcc
59@@ -672,6 +672,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="${tmake_file} arm/t-arm 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-4.0.2/arm-nolibfloat.patch b/meta/packages/gcc/gcc-4.0.2/arm-nolibfloat.patch
new file mode 100644
index 0000000000..c4897c0330
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.0.2/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
12Index: gcc-4.0.2/gcc/config/arm/linux-elf.h
13===================================================================
14--- gcc-4.0.2.orig/gcc/config/arm/linux-elf.h 2005-03-04 16:14:01.000000000 +0000
15+++ gcc-4.0.2/gcc/config/arm/linux-elf.h 2005-11-11 18:02:54.000000000 +0000
16@@ -56,7 +56,7 @@
17 %{shared:-lc} \
18 %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
19
20-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
21+#define LIBGCC_SPEC "-lgcc"
22
23 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add
24 the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
diff --git a/meta/packages/gcc/gcc-4.0.2/arm-softfloat.patch b/meta/packages/gcc/gcc-4.0.2/arm-softfloat.patch
new file mode 100644
index 0000000000..c86c83ed15
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.0.2/arm-softfloat.patch
@@ -0,0 +1,16 @@
1Index: gcc-4.0.2/gcc/config/arm/t-linux
2===================================================================
3--- gcc-4.0.2.orig/gcc/config/arm/t-linux 2004-05-15 12:41:35.000000000 +0000
4+++ gcc-4.0.2/gcc/config/arm/t-linux 2005-11-11 16:07:53.000000000 +0000
5@@ -4,7 +4,10 @@
6 LIBGCC2_DEBUG_CFLAGS = -g0
7
8 LIB1ASMSRC = arm/lib1funcs.asm
9-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx
10+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
11+ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
12+ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
13+ _fixsfsi _fixunssfsi _floatdidf _floatdisf
14
15 # MULTILIB_OPTIONS = mhard-float/msoft-float
16 # MULTILIB_DIRNAMES = hard-float soft-float
diff --git a/meta/packages/gcc/gcc-4.0.2/ldflags.patch b/meta/packages/gcc/gcc-4.0.2/ldflags.patch
new file mode 100644
index 0000000000..1196bf0c8e
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.0.2/ldflags.patch
@@ -0,0 +1,22 @@
1--- gcc-4.0.0/Makefile.tpl.old 2005-06-10 13:05:09.000000000 +0100
2+++ gcc-4.0.0/Makefile.tpl 2005-06-10 13:05:10.000000000 +0100
3@@ -339,7 +339,7 @@
4 NM = @NM@
5
6 LD = @LD@
7-LDFLAGS =
8+LDFLAGS = @LDFLAGS@
9
10 RANLIB = @RANLIB@
11
12--- gcc-4.0.0/Makefile.in.old 2005-06-10 17:13:12.000000000 +0100
13+++ gcc-4.0.0/Makefile.in 2005-06-10 17:13:22.000000000 +0100
14@@ -336,7 +336,7 @@
15 NM = @NM@
16
17 LD = @LD@
18-LDFLAGS =
19+LDFLAGS = @LDFLAGS@
20
21 RANLIB = @RANLIB@
22
diff --git a/meta/packages/gcc/gcc-4.0.2/zecke-host-cpp-ac-hack.patch b/meta/packages/gcc/gcc-4.0.2/zecke-host-cpp-ac-hack.patch
new file mode 100644
index 0000000000..3f26dce71f
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.0.2/zecke-host-cpp-ac-hack.patch
@@ -0,0 +1,140 @@
1gcc (AC_CHECK_HEADERS) is using $CPP to check if the header pass
2the precompiler, if compiling with $CC failed.
3Sadly $CC is xgcc of gcc, and $CPP is 'gcc -E'. And as you build
4on a glibc machine, precompiling of the headers (execinfo.h and
5iconv.h will succeed). As a dirty hack we will handle this case
6as failure.
7This fixes the libmudflap build for uclibc which lacks execinfo.h
8but has HAVE_EXECINFO_H defined
9
10Index: gcc-4.0.2/libmudflap/configure
11===================================================================
12--- gcc-4.0.2.orig/libmudflap/configure 2006-04-30 16:57:47.000000000 +0200
13+++ gcc-4.0.2/libmudflap/configure 2006-04-30 17:00:59.000000000 +0200
14@@ -3719,6 +3719,8 @@
15 ac_header_preproc=yes
16 ;;
17 no:yes:* )
18+ # hack, hack, hack
19+ ac_header_preproc=no
20 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
21 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
22 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
23@@ -3731,6 +3733,8 @@
24 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
25 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
26 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
27+ { echo "$as_me:$LINENO: WARNING: $ac_header: Zecke says do not trust the wrong cpp! Ignoring." >&5
28+echo "$as_me: WARNING: $ac_header: Zecke says do not trust the wrong cpp! Ignoring." >&2;}
29 (
30 cat <<\_ASBOX
31 ## ------------------------------------- ##
32Index: gcc-4.0.2/libstdc++-v3/configure
33===================================================================
34--- gcc-4.0.2.orig/libstdc++-v3/configure 2006-04-30 16:57:53.000000000 +0200
35+++ gcc-4.0.2/libstdc++-v3/configure 2006-04-30 22:59:00.000000000 +0200
36@@ -30513,6 +30513,7 @@
37 ac_header_preproc=yes
38 ;;
39 no:yes:* )
40+ ac_header_preproc=no
41 { echo "$as_me:$LINENO: WARNING: iconv.h: present but cannot be compiled" >&5
42 echo "$as_me: WARNING: iconv.h: present but cannot be compiled" >&2;}
43 { echo "$as_me:$LINENO: WARNING: iconv.h: check for missing prerequisite headers?" >&5
44@@ -30525,6 +30526,8 @@
45 echo "$as_me: WARNING: iconv.h: proceeding with the preprocessor's result" >&2;}
46 { echo "$as_me:$LINENO: WARNING: iconv.h: in the future, the compiler will take precedence" >&5
47 echo "$as_me: WARNING: iconv.h: in the future, the compiler will take precedence" >&2;}
48+ { echo "$as_me:$LINENO: WARNING: $ac_header: Zecke says do not trust the wrong cpp! Ignoring." >&5
49+echo "$as_me: WARNING: $ac_header: Zecke says do not trust the wrong cpp! Ignoring." >&2;}
50 (
51 cat <<\_ASBOX
52 ## ----------------------------------------- ##
53@@ -53622,6 +53625,7 @@
54 ac_header_preproc=yes
55 ;;
56 no:yes:* )
57+ ac_header_preproc=no
58 { echo "$as_me:$LINENO: WARNING: iconv.h: present but cannot be compiled" >&5
59 echo "$as_me: WARNING: iconv.h: present but cannot be compiled" >&2;}
60 { echo "$as_me:$LINENO: WARNING: iconv.h: check for missing prerequisite headers?" >&5
61@@ -75885,6 +75889,7 @@
62 ac_header_preproc=yes
63 ;;
64 no:yes:* )
65+ ac_header_preproc=no
66 { echo "$as_me:$LINENO: WARNING: iconv.h: present but cannot be compiled" >&5
67 echo "$as_me: WARNING: iconv.h: present but cannot be compiled" >&2;}
68 { echo "$as_me:$LINENO: WARNING: iconv.h: check for missing prerequisite headers?" >&5
69@@ -78600,6 +78605,7 @@
70 ac_header_preproc=yes
71 ;;
72 no:yes:* )
73+ ac_header_preproc=no
74 { echo "$as_me:$LINENO: WARNING: iconv.h: present but cannot be compiled" >&5
75 echo "$as_me: WARNING: iconv.h: present but cannot be compiled" >&2;}
76 { echo "$as_me:$LINENO: WARNING: iconv.h: check for missing prerequisite headers?" >&5
77@@ -80969,6 +80975,7 @@
78 ac_header_preproc=yes
79 ;;
80 no:yes:* )
81+ ac_header_preproc=no
82 { echo "$as_me:$LINENO: WARNING: iconv.h: present but cannot be compiled" >&5
83 echo "$as_me: WARNING: iconv.h: present but cannot be compiled" >&2;}
84 { echo "$as_me:$LINENO: WARNING: iconv.h: check for missing prerequisite headers?" >&5
85@@ -83214,6 +83221,7 @@
86 ac_header_preproc=yes
87 ;;
88 no:yes:* )
89+ ac_header_preproc=no
90 { echo "$as_me:$LINENO: WARNING: iconv.h: present but cannot be compiled" >&5
91 echo "$as_me: WARNING: iconv.h: present but cannot be compiled" >&2;}
92 { echo "$as_me:$LINENO: WARNING: iconv.h: check for missing prerequisite headers?" >&5
93@@ -86227,6 +86235,7 @@
94 ac_header_preproc=yes
95 ;;
96 no:yes:* )
97+ ac_header_preproc=no
98 { echo "$as_me:$LINENO: WARNING: iconv.h: present but cannot be compiled" >&5
99 echo "$as_me: WARNING: iconv.h: present but cannot be compiled" >&2;}
100 { echo "$as_me:$LINENO: WARNING: iconv.h: check for missing prerequisite headers?" >&5
101@@ -88425,6 +88434,7 @@
102 ac_header_preproc=yes
103 ;;
104 no:yes:* )
105+ ac_header_preproc=no
106 { echo "$as_me:$LINENO: WARNING: iconv.h: present but cannot be compiled" >&5
107 echo "$as_me: WARNING: iconv.h: present but cannot be compiled" >&2;}
108 { echo "$as_me:$LINENO: WARNING: iconv.h: check for missing prerequisite headers?" >&5
109@@ -90672,6 +90682,7 @@
110 ac_header_preproc=yes
111 ;;
112 no:yes:* )
113+ ac_header_preproc=no
114 { echo "$as_me:$LINENO: WARNING: iconv.h: present but cannot be compiled" >&5
115 echo "$as_me: WARNING: iconv.h: present but cannot be compiled" >&2;}
116 { echo "$as_me:$LINENO: WARNING: iconv.h: check for missing prerequisite headers?" >&5
117@@ -93280,6 +93291,7 @@
118 ac_header_preproc=yes
119 ;;
120 no:yes:* )
121+ ac_header_preproc=no
122 { echo "$as_me:$LINENO: WARNING: iconv.h: present but cannot be compiled" >&5
123 echo "$as_me: WARNING: iconv.h: present but cannot be compiled" >&2;}
124 { echo "$as_me:$LINENO: WARNING: iconv.h: check for missing prerequisite headers?" >&5
125@@ -94996,6 +95008,7 @@
126 ac_header_preproc=yes
127 ;;
128 no:yes:* )
129+ ac_header_preproc=no
130 { echo "$as_me:$LINENO: WARNING: iconv.h: present but cannot be compiled" >&5
131 echo "$as_me: WARNING: iconv.h: present but cannot be compiled" >&2;}
132 { echo "$as_me:$LINENO: WARNING: iconv.h: check for missing prerequisite headers?" >&5
133@@ -97337,6 +97350,7 @@
134 ac_header_preproc=yes
135 ;;
136 no:yes:* )
137+ ac_header_preproc=no
138 { echo "$as_me:$LINENO: WARNING: iconv.h: present but cannot be compiled" >&5
139 echo "$as_me: WARNING: iconv.h: present but cannot be compiled" >&2;}
140 { echo "$as_me:$LINENO: WARNING: iconv.h: check for missing prerequisite headers?" >&5
diff --git a/meta/packages/gcc/gcc-cross-initial_3.3.4.bb b/meta/packages/gcc/gcc-cross-initial_3.3.4.bb
new file mode 100644
index 0000000000..e3b365da18
--- /dev/null
+++ b/meta/packages/gcc/gcc-cross-initial_3.3.4.bb
@@ -0,0 +1,28 @@
1SECTION = "devel"
2include gcc-cross_${PV}.bb
3
4DEPENDS = "virtual/${TARGET_PREFIX}binutils"
5DEPENDS += "${@['virtual/${TARGET_PREFIX}libc-initial',''][bb.data.getVar('TARGET_ARCH', d, 1) in ['arm', 'armeb', 'mips', 'mipsel']]}"
6PROVIDES = "virtual/${TARGET_PREFIX}gcc-initial"
7
8# This is intended to be a -very- basic config
9EXTRA_OECONF = "--with-local-prefix=${CROSS_DIR}/${TARGET_SYS} \
10 --with-newlib \
11 --disable-shared \
12 --disable-threads \
13 --disable-multilib \
14 --disable-__cxa_atexit \
15 --enable-languages=c \
16 --enable-target-optspace \
17 --program-prefix=${TARGET_PREFIX} \
18 ${@get_gcc_fpu_setting(bb, d)}"
19
20do_stage_prepend () {
21 mkdir -p ${CROSS_DIR}/lib/gcc-lib/${TARGET_SYS}/${PV}
22 ln -sf libgcc.a ${CROSS_DIR}/lib/gcc-lib/${TARGET_SYS}/${PV}/libgcc_eh.a
23}
24
25# Override the method from gcc-cross so we don't try to install libgcc
26do_install () {
27 oe_runmake 'DESTDIR=${D}' install
28}
diff --git a/meta/packages/gcc/gcc-cross-initial_3.4.3.bb b/meta/packages/gcc/gcc-cross-initial_3.4.3.bb
new file mode 100644
index 0000000000..48c80864e2
--- /dev/null
+++ b/meta/packages/gcc/gcc-cross-initial_3.4.3.bb
@@ -0,0 +1,28 @@
1include gcc-cross_${PV}.bb
2
3DEPENDS = "virtual/${TARGET_PREFIX}binutils"
4DEPENDS += "${@['virtual/${TARGET_PREFIX}libc-initial',''][bb.data.getVar('TARGET_ARCH', d, 1) in ['arm', 'armeb', 'mips', 'mipsel']]}"
5PROVIDES = "virtual/${TARGET_PREFIX}gcc-initial"
6PACKAGES = ""
7
8# This is intended to be a -very- basic config
9EXTRA_OECONF = "--with-local-prefix=${CROSS_DIR}/${TARGET_SYS} \
10 --with-newlib \
11 --disable-shared \
12 --disable-threads \
13 --disable-multilib \
14 --disable-__cxa_atexit \
15 --enable-languages=c \
16 --enable-target-optspace \
17 --program-prefix=${TARGET_PREFIX} \
18 ${@get_gcc_fpu_setting(bb, d)}"
19
20do_stage_prepend () {
21 mkdir -p ${CROSS_DIR}/lib/gcc/${TARGET_SYS}/${BINV}
22 ln -sf libgcc.a ${CROSS_DIR}/lib/gcc/${TARGET_SYS}/${BINV}/libgcc_eh.a
23}
24
25# Override the method from gcc-cross so we don't try to install libgcc
26do_install () {
27 oe_runmake 'DESTDIR=${D}' install
28}
diff --git a/meta/packages/gcc/gcc-cross-initial_3.4.4.bb b/meta/packages/gcc/gcc-cross-initial_3.4.4.bb
new file mode 100644
index 0000000000..48c80864e2
--- /dev/null
+++ b/meta/packages/gcc/gcc-cross-initial_3.4.4.bb
@@ -0,0 +1,28 @@
1include gcc-cross_${PV}.bb
2
3DEPENDS = "virtual/${TARGET_PREFIX}binutils"
4DEPENDS += "${@['virtual/${TARGET_PREFIX}libc-initial',''][bb.data.getVar('TARGET_ARCH', d, 1) in ['arm', 'armeb', 'mips', 'mipsel']]}"
5PROVIDES = "virtual/${TARGET_PREFIX}gcc-initial"
6PACKAGES = ""
7
8# This is intended to be a -very- basic config
9EXTRA_OECONF = "--with-local-prefix=${CROSS_DIR}/${TARGET_SYS} \
10 --with-newlib \
11 --disable-shared \
12 --disable-threads \
13 --disable-multilib \
14 --disable-__cxa_atexit \
15 --enable-languages=c \
16 --enable-target-optspace \
17 --program-prefix=${TARGET_PREFIX} \
18 ${@get_gcc_fpu_setting(bb, d)}"
19
20do_stage_prepend () {
21 mkdir -p ${CROSS_DIR}/lib/gcc/${TARGET_SYS}/${BINV}
22 ln -sf libgcc.a ${CROSS_DIR}/lib/gcc/${TARGET_SYS}/${BINV}/libgcc_eh.a
23}
24
25# Override the method from gcc-cross so we don't try to install libgcc
26do_install () {
27 oe_runmake 'DESTDIR=${D}' install
28}
diff --git a/meta/packages/gcc/gcc-cross-initial_4.0.2.bb b/meta/packages/gcc/gcc-cross-initial_4.0.2.bb
new file mode 100644
index 0000000000..68dafe3f1a
--- /dev/null
+++ b/meta/packages/gcc/gcc-cross-initial_4.0.2.bb
@@ -0,0 +1,29 @@
1include gcc-cross_${PV}.bb
2
3DEPENDS = "virtual/${TARGET_PREFIX}binutils"
4DEPENDS += "${@['virtual/${TARGET_PREFIX}libc-initial',''][bb.data.getVar('TARGET_ARCH', d, 1) in ['arm', 'armeb', 'mips', 'mipsel']]}"
5PROVIDES = "virtual/${TARGET_PREFIX}gcc-initial"
6PACKAGES = ""
7
8# This is intended to be a -very- basic config
9EXTRA_OECONF = "--with-local-prefix=${CROSS_DIR}/${TARGET_SYS} \
10 --with-newlib \
11 --disable-shared \
12 --disable-threads \
13 --disable-multilib \
14 --disable-__cxa_atexit \
15 --disable-libmudflap \
16 --enable-languages=c \
17 --enable-target-optspace \
18 --program-prefix=${TARGET_PREFIX} \
19 ${@get_gcc_fpu_setting(bb, d)}"
20
21do_stage_prepend () {
22 mkdir -p ${CROSS_DIR}/lib/gcc/${TARGET_SYS}/${BINV}
23 ln -sf libgcc.a ${CROSS_DIR}/lib/gcc/${TARGET_SYS}/${BINV}/libgcc_eh.a
24}
25
26# Override the method from gcc-cross so we don't try to install libgcc
27do_install () {
28 oe_runmake 'DESTDIR=${D}' install
29}
diff --git a/meta/packages/gcc/gcc-cross-initial_csl-arm-2005q3.bb b/meta/packages/gcc/gcc-cross-initial_csl-arm-2005q3.bb
new file mode 100644
index 0000000000..48c80864e2
--- /dev/null
+++ b/meta/packages/gcc/gcc-cross-initial_csl-arm-2005q3.bb
@@ -0,0 +1,28 @@
1include gcc-cross_${PV}.bb
2
3DEPENDS = "virtual/${TARGET_PREFIX}binutils"
4DEPENDS += "${@['virtual/${TARGET_PREFIX}libc-initial',''][bb.data.getVar('TARGET_ARCH', d, 1) in ['arm', 'armeb', 'mips', 'mipsel']]}"
5PROVIDES = "virtual/${TARGET_PREFIX}gcc-initial"
6PACKAGES = ""
7
8# This is intended to be a -very- basic config
9EXTRA_OECONF = "--with-local-prefix=${CROSS_DIR}/${TARGET_SYS} \
10 --with-newlib \
11 --disable-shared \
12 --disable-threads \
13 --disable-multilib \
14 --disable-__cxa_atexit \
15 --enable-languages=c \
16 --enable-target-optspace \
17 --program-prefix=${TARGET_PREFIX} \
18 ${@get_gcc_fpu_setting(bb, d)}"
19
20do_stage_prepend () {
21 mkdir -p ${CROSS_DIR}/lib/gcc/${TARGET_SYS}/${BINV}
22 ln -sf libgcc.a ${CROSS_DIR}/lib/gcc/${TARGET_SYS}/${BINV}/libgcc_eh.a
23}
24
25# Override the method from gcc-cross so we don't try to install libgcc
26do_install () {
27 oe_runmake 'DESTDIR=${D}' install
28}
diff --git a/meta/packages/gcc/gcc-cross_3.3.4.bb b/meta/packages/gcc/gcc-cross_3.3.4.bb
new file mode 100644
index 0000000000..597b47fba8
--- /dev/null
+++ b/meta/packages/gcc/gcc-cross_3.3.4.bb
@@ -0,0 +1,13 @@
1SECTION = "devel"
2include gcc_${PV}.bb
3include gcc-paths-cross.inc
4inherit cross
5FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}"
6
7PR="r3"
8
9DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc"
10PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
11
12include gcc3-build-cross.inc
13include gcc-package-cross.inc \ No newline at end of file
diff --git a/meta/packages/gcc/gcc-cross_3.4.3.bb b/meta/packages/gcc/gcc-cross_3.4.3.bb
new file mode 100644
index 0000000000..a5d1bda170
--- /dev/null
+++ b/meta/packages/gcc/gcc-cross_3.4.3.bb
@@ -0,0 +1,16 @@
1include gcc_${PV}.bb
2# path mangling, needed by the cross packaging
3include gcc-paths-cross.inc
4inherit cross
5FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}"
6# NOTE: split PR. If the main .oe changes something that affects its *build*
7# remember to increment this one too.
8PR = "r10"
9
10DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc"
11PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
12
13# cross build
14include gcc3-build-cross.inc
15# cross packaging
16include gcc-package-cross.inc
diff --git a/meta/packages/gcc/gcc-cross_3.4.4.bb b/meta/packages/gcc/gcc-cross_3.4.4.bb
new file mode 100644
index 0000000000..d965e5b399
--- /dev/null
+++ b/meta/packages/gcc/gcc-cross_3.4.4.bb
@@ -0,0 +1,16 @@
1include gcc_${PV}.bb
2# path mangling, needed by the cross packaging
3include gcc-paths-cross.inc
4inherit cross
5FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}"
6# NOTE: split PR. If the main .oe changes something that affects its *build*
7# remember to increment this one too.
8PR = "r3"
9
10DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc"
11PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
12
13# cross build
14include gcc3-build-cross.inc
15# cross packaging
16include gcc-package-cross.inc
diff --git a/meta/packages/gcc/gcc-cross_4.0.2.bb b/meta/packages/gcc/gcc-cross_4.0.2.bb
new file mode 100644
index 0000000000..6e299e8299
--- /dev/null
+++ b/meta/packages/gcc/gcc-cross_4.0.2.bb
@@ -0,0 +1,16 @@
1include gcc_${PV}.bb
2# path mangling, needed by the cross packaging
3include gcc-paths-cross.inc
4inherit cross
5FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}"
6# NOTE: split PR. If the main .oe changes something that affects its *build*
7# remember to increment this one too.
8PR = "r1"
9
10DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc gmp-native mpfr-native"
11PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
12
13# cross build
14include gcc3-build-cross.inc
15# cross packaging
16include gcc-package-cross.inc
diff --git a/meta/packages/gcc/gcc-cross_csl-arm-2005q3.bb b/meta/packages/gcc/gcc-cross_csl-arm-2005q3.bb
new file mode 100644
index 0000000000..93c58aca53
--- /dev/null
+++ b/meta/packages/gcc/gcc-cross_csl-arm-2005q3.bb
@@ -0,0 +1,15 @@
1include gcc_csl-arm-2005q3.bb
2# path mangling, needed by the cross packaging
3include gcc-paths-cross.inc
4inherit cross
5# NOTE: split PR. If the main .oe changes something that affects its *build*
6# remember to increment this one too.
7PR = "r0"
8
9DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc"
10PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
11
12# cross build
13include gcc3-cross-build.inc
14# cross packaging
15include gcc-package-cross.inc
diff --git a/meta/packages/gcc/gcc-csl-arm/15342.patch b/meta/packages/gcc/gcc-csl-arm/15342.patch
new file mode 100644
index 0000000000..d0f3e72d47
--- /dev/null
+++ b/meta/packages/gcc/gcc-csl-arm/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-csl-arm/gcc-3.4.0-arm-lib1asm.patch b/meta/packages/gcc/gcc-csl-arm/gcc-3.4.0-arm-lib1asm.patch
new file mode 100644
index 0000000000..cf17da6a02
--- /dev/null
+++ b/meta/packages/gcc/gcc-csl-arm/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 _floatdidf _floatdisf
22
23 # MULTILIB_OPTIONS = mhard-float/msoft-float
24 # MULTILIB_DIRNAMES = hard-float soft-float
diff --git a/meta/packages/gcc/gcc-csl-arm/gcc34-arm-tune.patch b/meta/packages/gcc/gcc-csl-arm/gcc34-arm-tune.patch
new file mode 100644
index 0000000000..cdb20bef9b
--- /dev/null
+++ b/meta/packages/gcc/gcc-csl-arm/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-csl-arm/gcc_optab_arm.patch b/meta/packages/gcc/gcc-csl-arm/gcc_optab_arm.patch
new file mode 100644
index 0000000000..fa21b26554
--- /dev/null
+++ b/meta/packages/gcc/gcc-csl-arm/gcc_optab_arm.patch
@@ -0,0 +1,95 @@
1ARM is the only architecture that has a helper function that returns
2an unbiased result. This fix is trivial enough that we can show it
3doesn't effect any of the other arches. Can we consider this a
4regression fix since it used to work until the helper was added :}
5
6Tested with no regressions on x86_64-pc-linux-gnu and arm-none-eabi.
7
8Cheers,
9Carlos.
10--
11Carlos O'Donell
12CodeSourcery
13carlos@codesourcery.com
14(650) 331-3385 x716
15
16gcc/
17
182006-01-27 Carlos O'Donell <carlos@codesourcery.com>
19
20 * optabs.c (prepare_cmp_insn): If unbaised and unsigned then bias
21 the comparison routine return.
22
23gcc/testsuite/
24
252006-01-27 Carlos O'Donell <carlos@codesourcery.com>
26
27 * gcc.dg/unsigned-long-compare.c: New test.
28
29Index: gcc/optabs.c
30===================================================================
31--- 1/gcc/optabs.c (revision 110300)
32+++ 2/gcc/optabs.c (working copy)
33@@ -3711,18 +3711,24 @@
34 result = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST_MAKE_BLOCK,
35 word_mode, 2, x, mode, y, mode);
36
37+ /* There are two kinds of comparison routines. Biased routines
38+ return 0/1/2, and unbiased routines return -1/0/1. Other parts
39+ of gcc expect that the comparison operation is equivalent
40+ to the modified comparison. For signed comparisons compare the
41+ result against 1 in the unbiased case, and zero in the biased
42+ case. For unsigned comparisons always compare against 1 after
43+ biasing the unbased result by adding 1. This gives us a way to
44+ represent LTU. */
45 *px = result;
46 *pmode = word_mode;
47- if (TARGET_LIB_INT_CMP_BIASED)
48- /* Integer comparison returns a result that must be compared
49- against 1, so that even if we do an unsigned compare
50- afterward, there is still a value that can represent the
51- result "less than". */
52- *py = const1_rtx;
53- else
54+ *py = const1_rtx;
55+
56+ if (!TARGET_LIB_INT_CMP_BIASED)
57 {
58- *py = const0_rtx;
59- *punsignedp = 1;
60+ if (*punsignedp)
61+ *px = plus_constant (result, 1);
62+ else
63+ *py = const0_rtx;
64 }
65 return;
66 }
67Index: gcc/testsuite/gcc.dg/unsigned-long-compare.c
68===================================================================
69--- 1/gcc/testsuite/gcc.dg/unsigned-long-compare.c (revision 0)
70+++ 2/gcc/testsuite/gcc.dg/unsigned-long-compare.c (revision 0)
71@@ -0,0 +1,24 @@
72+/* Copyright (C) 2006 Free Software Foundation, Inc. */
73+/* Contributed by Carlos O'Donell on 2006-01-27 */
74+
75+/* Test a division corner case where the expression simplifies
76+ to a comparison, and the optab expansion is wrong. The optab
77+ expansion emits a function whose return is unbiased and needs
78+ adjustment. */
79+/* Origin: Carlos O'Donell <carlos@codesourcery.com> */
80+/* { dg-do run { target arm-*-*eabi* } } */
81+/* { dg-options "" } */
82+#include <stdlib.h>
83+
84+#define BIG_CONSTANT 0xFFFFFFFF80000000ULL
85+
86+int main (void)
87+{
88+ unsigned long long OneULL = 1ULL;
89+ unsigned long long result;
90+
91+ result = OneULL / BIG_CONSTANT;
92+ if (result)
93+ abort ();
94+ exit (0);
95+}
diff --git a/meta/packages/gcc/gcc-csl-arm/no-libfloat.patch b/meta/packages/gcc/gcc-csl-arm/no-libfloat.patch
new file mode 100644
index 0000000000..e5d12cfb4f
--- /dev/null
+++ b/meta/packages/gcc/gcc-csl-arm/no-libfloat.patch
@@ -0,0 +1,11 @@
1--- gcc/gcc/config/arm/linux-elf.h.old 2005-04-20 00:46:28.923375320 +0100
2+++ gcc/gcc/config/arm/linux-elf.h 2005-04-20 00:46:34.181575952 +0100
3@@ -56,7 +56,7 @@
4 %{shared:-lc} \
5 %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
6
7-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
8+#define LIBGCC_SPEC "-lgcc"
9
10 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add
11 the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
diff --git a/meta/packages/gcc/gcc-csl-arm/pic-without-sl.patch b/meta/packages/gcc/gcc-csl-arm/pic-without-sl.patch
new file mode 100644
index 0000000000..9a49794da4
--- /dev/null
+++ b/meta/packages/gcc/gcc-csl-arm/pic-without-sl.patch
@@ -0,0 +1,303 @@
1Index: gcc/config/arm/arm-protos.h
2===================================================================
3RCS file: /cvsroot/gcc/gcc/gcc/config/arm/arm-protos.h,v
4retrieving revision 1.60.4.20
5diff -u -r1.60.4.20 arm-protos.h
6--- gcc/config/arm/arm-protos.h 29 Mar 2005 03:00:11 -0000 1.60.4.20
7+++ gcc/config/arm/arm-protos.h 23 Apr 2005 04:41:06 -0000
8@@ -64,6 +64,7 @@
9 extern enum reg_class vfp_secondary_reload_class (enum machine_mode, rtx);
10 extern int tls_symbolic_operand (rtx, enum machine_mode);
11 extern bool arm_tls_operand_p (rtx x);
12+extern bool arm_pc_pic_operand_p (rtx x);
13
14 /* Predicates. */
15 extern int s_register_operand (rtx, enum machine_mode);
16Index: gcc/config/arm/arm.c
17===================================================================
18RCS file: /cvsroot/gcc/gcc/gcc/config/arm/arm.c,v
19retrieving revision 1.303.2.79
20diff -u -r1.303.2.79 arm.c
21--- gcc/config/arm/arm.c 12 Apr 2005 06:17:07 -0000 1.303.2.79
22+++ gcc/config/arm/arm.c 23 Apr 2005 04:41:09 -0000
23@@ -1003,7 +1003,7 @@
24
25 /* If stack checking is disabled, we can use r10 as the PIC register,
26 which keeps r9 available. */
27- if (flag_pic)
28+ if (0 && flag_pic)
29 arm_pic_register = TARGET_APCS_STACK ? 9 : 10;
30
31 if (TARGET_APCS_FLOAT)
32@@ -3120,6 +3120,10 @@
33 rtx
34 legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg)
35 {
36+ if (GET_CODE (orig) == UNSPEC
37+ && XINT (orig, 1) == UNSPEC_GOTSLOTPC)
38+ abort ();
39+
40 if (GET_CODE (orig) == SYMBOL_REF
41 || GET_CODE (orig) == LABEL_REF)
42 {
43@@ -3149,27 +3153,80 @@
44 else
45 address = reg;
46
47- if (TARGET_ARM)
48- emit_insn (gen_pic_load_addr_arm (address, orig));
49- else
50- emit_insn (gen_pic_load_addr_thumb (address, orig));
51+ if (arm_pic_register != INVALID_REGNUM)
52+ {
53+ /* Using GP-based PIC addressing. */
54+ if (TARGET_ARM)
55+ emit_insn (gen_pic_load_addr_arm (address, orig));
56+ else
57+ emit_insn (gen_pic_load_addr_thumb (address, orig));
58+
59+ if ((GET_CODE (orig) == LABEL_REF
60+ || (GET_CODE (orig) == SYMBOL_REF &&
61+ SYMBOL_REF_LOCAL_P (orig)))
62+ && NEED_GOT_RELOC)
63+ pic_ref = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, address);
64+ else
65+ {
66+ pic_ref = gen_rtx_MEM (Pmode,
67+ gen_rtx_PLUS (Pmode, pic_offset_table_rtx,
68+ address));
69+ RTX_UNCHANGING_P (pic_ref) = 1;
70+ }
71
72- if ((GET_CODE (orig) == LABEL_REF
73- || (GET_CODE (orig) == SYMBOL_REF &&
74- SYMBOL_REF_LOCAL_P (orig)))
75- && NEED_GOT_RELOC)
76- pic_ref = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, address);
77+ current_function_uses_pic_offset_table = 1;
78+ }
79 else
80 {
81- pic_ref = gen_rtx_MEM (Pmode,
82- gen_rtx_PLUS (Pmode, pic_offset_table_rtx,
83- address));
84- RTX_UNCHANGING_P (pic_ref) = 1;
85+ /* Using PC-based PIC addressing. */
86+ rtx label, tmp;
87+ int offset;
88+
89+ label = gen_label_rtx ();
90+ offset = TARGET_ARM ? 8 : 4;
91+
92+ if (GET_CODE (orig) == LABEL_REF
93+ || (GET_CODE (orig) == SYMBOL_REF && SYMBOL_REF_LOCAL_P (orig)))
94+ {
95+ /* This symbol is defined locally. We don't need a GOT entry. */
96+ tmp = gen_rtx_MINUS (Pmode, gen_rtx_UNSPEC (Pmode, gen_rtvec (1, orig), UNSPEC_PIC_SYM), gen_rtx_PLUS (Pmode,
97+ gen_rtx_LABEL_REF (Pmode, label),
98+ GEN_INT (offset)));
99+
100+ load_tls_operand (tmp, address);
101+
102+ if (TARGET_ARM)
103+ emit_insn (gen_pic_add_dot_plus_eight (address, label));
104+ else
105+ emit_insn (gen_pic_add_dot_plus_four (address, label));
106+ }
107+ else
108+ {
109+ rtx x = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, orig), UNSPEC_GOTSLOTPC);
110+ rtx dummy_label;
111+
112+ dummy_label = gen_label_rtx ();
113+ LABEL_PRESERVE_P (dummy_label) = 1;
114+ LABEL_NUSES (dummy_label) = 1;
115+
116+ tmp = gen_rtx_MINUS (Pmode, x, gen_rtx_PLUS (Pmode,
117+ gen_rtx_LABEL_REF (Pmode, label),
118+ GEN_INT (offset)));
119+
120+ load_tls_operand (tmp, address);
121+
122+ if (TARGET_ARM)
123+ emit_insn (gen_tls_load_dot_plus_eight (address, address, label, dummy_label));
124+ else
125+ emit_insn (gen_tls_load_dot_plus_four (address, address, label, dummy_label));
126+ }
127+
128+ pic_ref = address;
129 }
130
131 insn = emit_move_insn (reg, pic_ref);
132 #endif
133- current_function_uses_pic_offset_table = 1;
134+
135 /* Put a REG_EQUAL note on this insn, so that it can be optimized
136 by loop. */
137 REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, orig,
138@@ -3179,11 +3236,17 @@
139 else if (GET_CODE (orig) == CONST)
140 {
141 rtx base, offset;
142+ bool minus = FALSE;
143
144 if (GET_CODE (XEXP (orig, 0)) == PLUS
145 && XEXP (XEXP (orig, 0), 0) == pic_offset_table_rtx)
146 return orig;
147
148+ if (GET_CODE (XEXP (orig, 0)) == MINUS
149+ && GET_CODE (XEXP (XEXP (orig, 0), 0)) == UNSPEC
150+ && XINT (XEXP (XEXP (orig, 0), 0), 1) == UNSPEC_GOTSLOTPC)
151+ return orig;
152+
153 if (GET_CODE (XEXP (orig, 0)) == UNSPEC)
154 return orig;
155
156@@ -3201,6 +3264,13 @@
157 offset = legitimize_pic_address (XEXP (XEXP (orig, 0), 1), Pmode,
158 base == reg ? 0 : reg);
159 }
160+ else if (GET_CODE (XEXP (orig, 0)) == MINUS)
161+ {
162+ minus = TRUE;
163+ base = legitimize_pic_address (XEXP (XEXP (orig, 0), 0), Pmode, reg);
164+ offset = legitimize_pic_address (XEXP (XEXP (orig, 0), 1), Pmode,
165+ base == reg ? 0 : reg);
166+ }
167 else
168 abort ();
169
170@@ -3228,7 +3298,7 @@
171 return reg;
172 }
173
174- return gen_rtx_PLUS (Pmode, base, offset);
175+ return minus ? gen_rtx_MINUS (Pmode, base, offset) : gen_rtx_PLUS (Pmode, base, offset);
176 }
177
178 return orig;
179@@ -3267,7 +3337,7 @@
180 rtx l1, pic_tmp, pic_tmp2, pic_rtx;
181 rtx global_offset_table;
182
183- if (current_function_uses_pic_offset_table == 0 || TARGET_SINGLE_PIC_BASE)
184+ if (current_function_uses_pic_offset_table == 0 || TARGET_SINGLE_PIC_BASE || arm_pic_register == INVALID_REGNUM)
185 return;
186
187 if (!flag_pic)
188@@ -3341,8 +3411,11 @@
189 static int
190 pcrel_constant_p (rtx x)
191 {
192+ if (GET_CODE (x) == CONST)
193+ return pcrel_constant_p (XEXP (x, 0));
194+
195 if (GET_CODE (x) == MINUS)
196- return symbol_mentioned_p (XEXP (x, 0)) && label_mentioned_p (XEXP (x, 1));
197+ return (((GET_CODE (XEXP (x, 0)) == UNSPEC && XINT (XEXP (x, 0), 1) == UNSPEC_PIC_SYM)) || symbol_mentioned_p (XEXP (x, 0))) && label_mentioned_p (XEXP (x, 1));
198
199 if (GET_CODE (x) == UNSPEC
200 && XINT (x, 1) == UNSPEC_TLS
201@@ -3946,12 +4019,32 @@
202 return SYMBOL_REF_TLS_MODEL (op);
203 }
204
205+bool
206+arm_pc_pic_operand_p (rtx op)
207+{
208+ if (GET_CODE (op) == CONST
209+ && GET_CODE (XEXP (op, 0)) == MINUS
210+ && GET_CODE (XEXP (XEXP (op, 0), 0)) == UNSPEC
211+ && XINT (XEXP (XEXP (op, 0), 0), 1) == UNSPEC_GOTSLOTPC)
212+ return 1;
213+
214+ if (GET_CODE (op) == CONST
215+ && GET_CODE (XEXP (op, 0)) == MINUS
216+ && GET_CODE (XEXP (XEXP (op, 0), 0)) == UNSPEC
217+ && XINT (XEXP (XEXP (op, 0), 0), 1) == UNSPEC_PIC_SYM)
218+ return 1;
219+
220+ return 0;
221+}
222+
223 /* Valid input to a move instruction. */
224 int
225 move_input_operand (rtx op, enum machine_mode mode)
226 {
227 if (tls_symbolic_operand (op, mode))
228 return 0;
229+ if (pcrel_constant_p (op))
230+ return 1;
231 return general_operand (op, mode);
232 }
233
234@@ -15634,11 +15727,34 @@
235 return TRUE;
236 }
237
238+static bool
239+arm_emit_got_decoration (FILE *fp, rtx x)
240+{
241+ rtx val;
242+
243+ val = XVECEXP (x, 0, 0);
244+
245+ fputs ("_gotslotpc_(", fp);
246+
247+ output_addr_const (fp, val);
248+
249+ fputc (')', fp);
250+
251+ return TRUE;
252+}
253+
254 bool
255 arm_output_addr_const_extra (FILE *fp, rtx x)
256 {
257 if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_TLS)
258 return arm_emit_tls_decoration (fp, x);
259+ else if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_GOTSLOTPC)
260+ return arm_emit_got_decoration (fp, x);
261+ else if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_PIC_SYM)
262+ {
263+ output_addr_const (fp, XVECEXP (x, 0, 0));
264+ return TRUE;
265+ }
266 else if (GET_CODE (x) == CONST_VECTOR)
267 return arm_emit_vector_const (fp, x);
268
269Index: gcc/config/arm/arm.md
270===================================================================
271RCS file: /cvsroot/gcc/gcc/gcc/config/arm/arm.md,v
272retrieving revision 1.145.2.31
273diff -u -r1.145.2.31 arm.md
274--- gcc/config/arm/arm.md 28 Mar 2005 19:04:37 -0000 1.145.2.31
275+++ gcc/config/arm/arm.md 23 Apr 2005 04:41:11 -0000
276@@ -88,6 +88,7 @@
277 (UNSPEC_WMADDS 18) ; Used by the intrinsic form of the iWMMXt WMADDS instruction.
278 (UNSPEC_WMADDU 19) ; Used by the intrinsic form of the iWMMXt WMADDU instruction.
279 (UNSPEC_TLS 20) ; A symbol that has been treated properly for TLS usage.
280+ (UNSPEC_GOTSLOTPC 21)
281 ]
282 )
283
284@@ -4179,7 +4180,8 @@
285 && (CONSTANT_P (operands[1])
286 || symbol_mentioned_p (operands[1])
287 || label_mentioned_p (operands[1]))
288- && ! tls_mentioned_p (operands[1]))
289+ && ! tls_mentioned_p (operands[1])
290+ && ! arm_pc_pic_operand_p (operands[1]))
291 operands[1] = legitimize_pic_address (operands[1], SImode,
292 (no_new_pseudos ? operands[0] : 0));
293 }
294@@ -4412,7 +4414,8 @@
295 (mem:SI (unspec:SI [(plus:SI (match_dup 0)
296 (const (plus:SI (pc) (const_int 8))))]
297 UNSPEC_PIC_BASE)))
298- (use (label_ref (match_operand 1 "" "")))])]
299+ (use (label_ref (match_operand 1 "" "")))
300+ (use (label_ref (match_operand 1 "" "")))])]
301 ""
302 )
303
diff --git a/meta/packages/gcc/gcc-package-cross.inc b/meta/packages/gcc/gcc-package-cross.inc
new file mode 100644
index 0000000000..4b1f8f68e8
--- /dev/null
+++ b/meta/packages/gcc/gcc-package-cross.inc
@@ -0,0 +1,77 @@
1# Packages emitted by our gcc-cross builds.
2#
3INHIBIT_PACKAGE_STRIP ?= ""
4HAS_G2C ?= "yes"
5HAS_GFORTRAN ?= "no"
6OLD_INHIBIT_PACKAGE_STRIP := "${INHIBIT_PACKAGE_STRIP}"
7INHIBIT_PACKAGE_STRIP = "1"
8
9PACKAGES = "libgcc libstdc++ libg2c libg2c-dev libgfortran libgfortran-dev"
10
11PACKAGE_ARCH_libg2c = "${TARGET_ARCH}"
12PACKAGE_ARCH_libg2c-dev = "${TARGET_ARCH}"
13PACKAGE_ARCH_libgfortran = "${TARGET_ARCH}"
14PACKAGE_ARCH_libgfortran-dev = "${TARGET_ARCH}"
15
16# Called from within gcc-cross, so libdir is set wrong
17FILES_libg2c = "${target_libdir}/libg2c.so.*"
18FILES_libg2c-dev = "${target_libdir}/libg2c.so \
19 ${target_libdir}/libg2c.a \
20 ${target_libdir}/libfrtbegin.a"
21
22FILES_libgfortran = "${target_libdir}/libgfortran.so.*"
23FILES_libgfortran-dev = "${target_libdir}/libgfortran.a \
24 ${target_libdir}/libgfortran.so \
25 ${target_libdir}/libgfortranbegin.a"
26
27PACKAGE_ARCH_libgcc = "${TARGET_ARCH}"
28FILES_libgcc = "${target_base_libdir}/libgcc_s.so.1"
29
30PACKAGE_ARCH_libstdc++ = "${TARGET_ARCH}"
31PACKAGE_ARCH_libstdc++-dev = "${TARGET_ARCH}"
32FILES_libstdc++ = "${target_libdir}/libstdc++.so.*"
33FILES_libstdc++-dev = "${target_includedir}/c++/${PV} \
34 ${target_libdir}/libstdc++.so \
35 ${target_libdir}/libstdc++.la \
36 ${target_libdir}/libstdc++.a \
37 ${target_libdir}/libsupc++.la \
38 ${target_libdir}/libsupc++.a"
39
40python do_package() {
41 if bb.data.getVar('DEBIAN_NAMES', d, 1):
42 bb.data.setVar('PKG_libgcc', 'libgcc1', d)
43 bb.build.exec_func('package_do_package', d)
44}
45
46do_install () {
47 oe_runmake 'DESTDIR=${D}' install
48
49 # Move libgcc_s into /lib
50 mkdir -p ${D}${target_base_libdir}
51 if [ -f ${D}${target_base_libdir}/libgcc_s.so.? ]; then
52 # Already in the right location
53 :
54 elif [ -f ${D}${prefix}/lib/libgcc_s.so.? ]; then
55 mv -f ${D}${prefix}/lib/libgcc_s.so.* ${D}${target_base_libdir}
56 else
57 mv -f ${D}${prefix}/*/lib/libgcc_s.so.* ${D}${target_base_libdir}
58 fi
59
60 # Move libstdc++ and libg2c into libdir (resetting our prefix to /usr
61 mkdir -p ${D}${target_libdir}
62 mv -f ${D}${prefix}/*/lib/libstdc++.so.* ${D}${target_libdir}
63 if [ "${HAS_G2C}" = "yes" ]; then
64 mv -f ${D}${prefix}/*/lib/libg2c.so.* ${D}${target_libdir}
65 fi
66 if [ "${HAS_GFORTRAN}" = "yes" ]; then
67 mv -f ${D}${prefix}/*/lib/libgfortran*.so.* ${D}${target_libdir}
68 fi
69
70 # Manually run the target stripper since we won't get it run by
71 # the packaging.
72 if [ "x${OLD_INHIBIT_PACKAGE_STRIP}" != "x1" ]; then
73 ${TARGET_PREFIX}strip ${D}${target_libdir}/libstdc++.so.*
74 ${TARGET_PREFIX}strip ${D}${target_libdir}/libg2c.so.*
75 ${TARGET_PREFIX}strip ${D}${target_base_libdir}/libgcc_s.so.*
76 fi
77}
diff --git a/meta/packages/gcc/gcc-package.inc b/meta/packages/gcc/gcc-package.inc
new file mode 100644
index 0000000000..4dcc72e879
--- /dev/null
+++ b/meta/packages/gcc/gcc-package.inc
@@ -0,0 +1,111 @@
1gcclibdir ?= "${libdir}/gcc"
2BINV ?= "${PV}"
3
4# libgcc libstdc++ libg2c are listed in our FILES_*, but are actually
5# packaged in the respective cross packages.
6PACKAGES = "${PN} ${PN}-symlinks \
7 g++ g++-symlinks \
8 cpp cpp-symlinks \
9 g77 g77-symlinks \
10 gcov gcov-symlinks \
11 libstdc++-dev libg2c-dev \
12 ${PN}-doc"
13
14FILES_${PN} = "${bindir}/${TARGET_PREFIX}gcc \
15 ${bindir}/${TARGET_PREFIX}gccbug \
16 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1 \
17 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/collect2 \
18 ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \
19 ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \
20 ${gcclibdir}/${TARGET_SYS}/${BINV}/lib* \
21 ${gcclibdir}/${TARGET_SYS}/${BINV}/include"
22FILES_${PN}-symlinks = "${bindir}/cc \
23 ${bindir}/gcc \
24 ${bindir}/gccbug"
25
26FILES_g77 = "${bindir}/${TARGET_PREFIX}g77 \
27 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f771"
28FILES_g77-symlinks = "${bindir}/g77 \
29 ${bindir}/f77"
30
31FILES_cpp = "${bindir}/${TARGET_PREFIX}cpp \
32 ${base_libdir}/cpp"
33FILES_cpp-symlinks = "${bindir}/cpp"
34
35FILES_gcov = "${bindir}/${TARGET_PREFIX}gcov"
36FILES_gcov-symlinks = "${bindir}/gcov"
37
38PACKAGE_ARCH_libg2c-dev = "${TARGET_ARCH}"
39# Called from within gcc-cross, so libdir is set wrong
40FILES_libg2c-dev = "${libdir}/libg2c.so \
41 ${libdir}/libg2c.a \
42 ${libdir}/libfrtbegin.a"
43
44FILES_g++ = "${bindir}/${TARGET_PREFIX}g++ \
45 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus"
46FILES_g++-symlinks = "${bindir}/c++ \
47 ${bindir}/g++"
48
49PACKAGE_ARCH_libstdc++-dev = "${TARGET_ARCH}"
50FILES_libstdc++-dev = "${includedir}/c++/${BINV} \
51 ${libdir}/libstdc++.so \
52 ${libdir}/libstdc++.la \
53 ${libdir}/libstdc++.a \
54 ${libdir}/libsupc++.la \
55 ${libdir}/libsupc++.a"
56
57FILES_${PN}-doc = "${infodir} \
58 ${mandir} \
59 ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README"
60
61
62do_install () {
63 autotools_do_install
64
65 # Cleanup some of the ${libdir}{,exec}/gcc stuff ...
66 rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
67 rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
68
69 # Hack around specs file assumptions
70 sed -i -e '/^*cross_compile:$/ { n; s/1/0/; }' ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/specs &>/dev/null || true
71
72 # Move libgcc_s into /lib
73 mkdir -p ${D}${base_libdir}
74 mv ${D}${libdir}/libgcc_s.so.* ${D}${base_libdir}
75 rm ${D}${libdir}/libgcc_s.so
76 ln -sf `echo ${libdir}/gcc/${TARGET_SYS}/${BINV} \
77 | tr -s / \
78 | sed -e 's,^/,,' -e 's,[^/]*,..,g'`/lib/libgcc_s.so.1 \
79 ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/libgcc_s.so
80
81 # We don't need libtool libraries
82 rm ${D}${libdir}/libg2c.la &>/dev/null || true
83
84
85 # Cleanup manpages..
86 rm -r ${D}${mandir}/man7
87
88 # We use libiberty from binutils
89 rm ${D}${libdir}/libiberty.a
90
91 cd ${D}${bindir}
92
93 # We care about g++ not c++
94 rm *c++
95
96 # We don't care about the gcc-<version> ones for this
97 rm *gcc-?.?*
98
99 # These sometimes show up, they are strange, we remove them
100 rm -f ${TARGET_ARCH}-*${TARGET_ARCH}-*
101
102 # Symlinks so we can use these trivially on the target
103 ln -sf ${TARGET_SYS}-g77 g77
104 ln -sf ${TARGET_SYS}-g++ g++
105 ln -sf ${TARGET_SYS}-gcc gcc
106 ln -sf g77 f77
107 ln -sf g++ c++
108 ln -sf gcc cc
109 ln -sf ${bindir}/${TARGET_SYS}-cpp ${D}${base_libdir}/cpp
110 ln -sf ${bindir}/${TARGET_SYS}-cpp ${D}${bindir}/cpp
111}
diff --git a/meta/packages/gcc/gcc-paths-cross.inc b/meta/packages/gcc/gcc-paths-cross.inc
new file mode 100644
index 0000000000..3c08b1805d
--- /dev/null
+++ b/meta/packages/gcc/gcc-paths-cross.inc
@@ -0,0 +1,7 @@
1# Note that we use := here, and require that this
2# is included at the correct point (before inheriting
3# cross) to ensure that libdir and includedir are
4# target paths, not CROSS_DIR paths.
5target_libdir := "${libdir}"
6target_includedir := "${includedir}"
7target_base_libdir := "${base_libdir}"
diff --git a/meta/packages/gcc/gcc3-build-cross.inc b/meta/packages/gcc/gcc3-build-cross.inc
new file mode 100644
index 0000000000..384886c76e
--- /dev/null
+++ b/meta/packages/gcc/gcc3-build-cross.inc
@@ -0,0 +1,47 @@
1USE_NLS = '${@base_conditional( "TARGET_OS", "linux-uclibc", "no", "", d )}'
2
3EXTRA_OECONF_PATHS = "--with-local-prefix=${CROSS_DIR}/${TARGET_SYS} \
4 --with-gxx-include-dir=${CROSS_DIR}/${TARGET_SYS}/include/c++"
5
6do_configure_prepend () {
7 rm -f ${CROSS_DIR}/lib/gcc/${TARGET_SYS}/${BINV}/libgcc_eh.a
8}
9
10do_compile_prepend () {
11 export CC="${BUILD_CC}"
12 export AR_FOR_TARGET="${TARGET_SYS}-ar"
13 export RANLIB_FOR_TARGET="${TARGET_SYS}-ranlib"
14 export LD_FOR_TARGET="${TARGET_SYS}-ld"
15 export NM_FOR_TARGET="${TARGET_SYS}-nm"
16 export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc ${TARGET_CC_ARCH}"
17}
18
19do_stage_append () {
20 for d in info man share/doc share/locale ; do
21 rm -rf ${CROSS_DIR}/$d
22 done
23
24 # These aren't useful on the cross toolchain
25 rm -f ${CROSS_DIR}/bin/*gcov
26 rm -f ${CROSS_DIR}/bin/*gccbug
27
28 # Fix a few include links so cross builds are happier
29 if [ ! -e ${STAGING_INCDIR}/c++ ]; then
30 mkdir -p ${STAGING_INCDIR}
31 ln -sf ${CROSS_DIR}/${TARGET_SYS}/include/c++ \
32 ${STAGING_INCDIR}/
33 fi
34
35 # We use libiberty from binutils
36 rm -f ${CROSS_DIR}/lib/libiberty.a
37
38 # We probably don't need these
39 rmdir ${CROSS_DIR}/include || :
40
41 # We don't really need to keep this around
42 # rm -rf ${CROSS_DIR}/share but leave java there
43 for d in share/man share/info;
44 do
45 rm -rf ${CROSS_DIR}/$d
46 done
47}
diff --git a/meta/packages/gcc/gcc3-build.inc b/meta/packages/gcc/gcc3-build.inc
new file mode 100644
index 0000000000..8048b45fba
--- /dev/null
+++ b/meta/packages/gcc/gcc3-build.inc
@@ -0,0 +1,95 @@
1MIRRORS_prepend () {
2${GNU_MIRROR}/gcc/releases/ ftp://gcc.gnu.org/pub/gcc/releases/
3${GNU_MIRROR}/gcc/ http://mirrors.rcn.net/pub/sourceware/gcc/releases/
4${GNU_MIRROR}/gcc/releases/ http://gcc.get-software.com/releases/
5${GNU_MIRROR}/gcc/ http://gcc.get-software.com/releases/
6}
7
8gcclibdir ?= "${libdir}/gcc"
9S = "${WORKDIR}/gcc-${PV}"
10B = "${S}/build.${HOST_SYS}.${TARGET_SYS}"
11BINV ?= "${PV}"
12
13# gcj doesn't work on some architectures
14JAVA = ",java"
15JAVA_arm = ""
16JAVA_armeb = ""
17JAVA_mipsel = ""
18JAVA_sh3 = ""
19# gcc4-build sets this to f95
20FORTRAN ?= "f77"
21LANGUAGES ?= "c,c++,${FORTRAN}${JAVA}"
22
23EXTRA_OECONF = "${@['--enable-clocale=generic', ''][bb.data.getVar('USE_NLS', d, 1) != 'no']} \
24 --with-gnu-ld \
25 --enable-shared \
26 --enable-target-optspace \
27 --enable-languages=${LANGUAGES} \
28 --enable-threads=posix \
29 --enable-multilib \
30 --enable-c99 \
31 --enable-long-long \
32 --enable-symvers=gnu \
33 --enable-libstdcxx-pch \
34 --program-prefix=${TARGET_PREFIX} \
35 ${EXTRA_OECONF_PATHS} \
36 ${EXTRA_OECONF_DEP}"
37
38EXTRA_OECONF_PATHS = " \
39 --with-local-prefix=${prefix}/local \
40 --with-gxx-include-dir=${includedir}/c++/${BINV}"
41
42EXTRA_OECONF_DEP = ""
43EXTRA_OECONF_uclibc = "--disable-__cxa_atexit"
44EXTRA_OECONF_glibc = "--enable-__cxa_atexit"
45EXTRA_OECONF += "${@get_gcc_fpu_setting(bb, d)}"
46CPPFLAGS = ""
47
48# Used by configure to define additional values for FLAGS_FOR_TARGET -
49# passed to all the compilers.
50ARCH_FLAGS_FOR_TARGET = ""
51#NOTE: not tested on other platforms, the following is probably correct
52# everywhere!
53ARCH_FLAGS_FOR_TARGET_slugos = "${TARGET_CC_ARCH}"
54ARCH_FLAGS_FOR_TARGET_unslung = "${TARGET_CC_ARCH}"
55EXTRA_OEMAKE += "ARCH_FLAGS_FOR_TARGET='${ARCH_FLAGS_FOR_TARGET}'"
56
57def get_gcc_fpu_setting(bb, d):
58 if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]:
59 return "--with-float=soft"
60 return ""
61
62python __anonymous () {
63 import bb, re
64 if (re.match('linux-uclibc$', bb.data.getVar('TARGET_OS', d, 1)) != None):
65 bb.data.setVar('EXTRA_OECONF_DEP', '${EXTRA_OECONF_uclibc}', d)
66 elif (re.match('linux$', bb.data.getVar('TARGET_OS', d, 1)) != None):
67 bb.data.setVar('EXTRA_OECONF_DEP', '${EXTRA_OECONF_glibc}', d)
68}
69
70do_configure () {
71 # Setup these vars for cross building only
72 # ... because foo_FOR_TARGET apparently gets misinterpreted inside the
73 # gcc build stuff when the build is producing a cross compiler - i.e.
74 # when the 'current' target is the 'host' system, and the host is not
75 # the target (because the build is actually making a cross compiler!)
76 if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
77 export CC_FOR_TARGET="${CC}"
78 export GCC_FOR_TARGET="${CC}"
79 export CXX_FOR_TARGET="${CXX}"
80 export AS_FOR_TARGET="${HOST_PREFIX}as"
81 export LD_FOR_TARGET="${HOST_PREFIX}ld"
82 export NM_FOR_TARGET="${HOST_PREFIX}nm"
83 export AR_FOR_TARGET="${HOST_PREFIX}ar"
84 export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
85 fi
86 export CC_FOR_BUILD="${BUILD_CC}"
87 export CXX_FOR_BUILD="${BUILD_CXX}"
88 export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
89 export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
90 export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
91 export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
92 export ARCH_FLAGS_FOR_TARGET="${ARCH_FLAGS_FOR_TARGET}"
93 (cd ${S} && gnu-configize) || die "failure running gnu-configize"
94 oe_runconf
95}
diff --git a/meta/packages/gcc/gcc4-build.inc b/meta/packages/gcc/gcc4-build.inc
new file mode 100644
index 0000000000..8b80f4820a
--- /dev/null
+++ b/meta/packages/gcc/gcc4-build.inc
@@ -0,0 +1,6 @@
1FORTRAN = "f95"
2HAS_GFORTRAN = "yes"
3HAS_G2C = "no"
4
5include gcc3-build.inc
6
diff --git a/meta/packages/gcc/gcc_3.3.4.bb b/meta/packages/gcc/gcc_3.3.4.bb
new file mode 100644
index 0000000000..dc3a66cd29
--- /dev/null
+++ b/meta/packages/gcc/gcc_3.3.4.bb
@@ -0,0 +1,176 @@
1SECTION = "devel"
2PR = "r2"
3inherit autotools gettext
4
5DESCRIPTION = "The GNU cc and gcc C compilers."
6HOMEPAGE = "http://www.gnu.org/software/gcc/"
7LICENSE = "GPL"
8MAINTAINER = "Gerald Britton <gbritton@doomcom.org>"
9
10# libgcc libstdc++ libg2c are listed in our FILES_*, but are actually
11# packaged in the respective cross packages.
12PACKAGES = "${PN} ${PN}-symlinks \
13 ${PN}-c++ ${PN}-c++-symlinks \
14 ${PN}-f77 ${PN}-f77-symlinks \
15 libstdc++-dev libg2c-dev \
16 ${PN}-doc"
17
18FILES_${PN} = "${bindir}/${TARGET_PREFIX}gcc \
19 ${bindir}/${TARGET_PREFIX}cpp \
20 ${bindir}/${TARGET_PREFIX}gcov \
21 ${bindir}/${TARGET_PREFIX}gccbug \
22 ${libdir}/gcc-lib/${TARGET_SYS}/${PV}/cc1 \
23 ${libdir}/gcc-lib/${TARGET_SYS}/${PV}/collect2 \
24 ${libdir}/gcc-lib/${TARGET_SYS}/${PV}/crt* \
25 ${libdir}/gcc-lib/${TARGET_SYS}/${PV}/specs \
26 ${libdir}/gcc-lib/${TARGET_SYS}/${PV}/lib* \
27 ${libdir}/gcc-lib/${TARGET_SYS}/${PV}/include"
28
29FILES_${PN}-symlinks = "${bindir}/cc \
30 ${bindir}/gcc \
31 ${bindir}/cpp \
32 ${bindir}/gcov \
33 ${bindir}/gccbug"
34
35FILES_${PN}-c++ = "${bindir}/${TARGET_PREFIX}g++ \
36 ${libdir}/gcc-lib/${TARGET_SYS}/${PV}/cc1plus"
37
38FILES_${PN}-c++-symlinks = "${bindir}/c++ \
39 ${bindir}/g++"
40
41PACKAGE_ARCH_libgcc = "${TARGET_ARCH}"
42FILES_libgcc = "/lib/libgcc_s.so.*"
43
44PACKAGE_ARCH_libstdc++ = "${TARGET_ARCH}"
45PACKAGE_ARCH_libstdc++-dev = "${TARGET_ARCH}"
46# Called from within gcc-cross, so libdir is set wrong
47#FILES_libstdc++ = "${libdir}/libstdc++.so.*"
48FILES_libstdc++ = "${libdir}/libstdc++.so.*"
49
50FILES_libstdc++-dev = "${includedir}/c++/${PV} \
51 ${libdir}/libstdc++.so \
52 ${libdir}/libstdc++.la \
53 ${libdir}/libstdc++.a \
54 ${libdir}/libsupc++.la \
55 ${libdir}/libsupc++.a"
56
57FILES_${PN}-doc = "${infodir} \
58 ${mandir} \
59 ${libdir}/gcc-lib/${TARGET_SYS}/${PV}/include/README"
60
61SRC_URI = "${GNU_MIRROR}/gcc/releases/gcc-${PV}/gcc-${PV}.tar.bz2 \
62 file://arm-gotoff.dpatch;patch=1;pnum=0 \
63 file://arm-ldm.dpatch;patch=1;pnum=0 \
64 file://arm-tune.patch;patch=1;pnum=0 \
65 file://arm-ldm-peephole.patch;patch=1;pnum=0 \
66 file://libibery-crosstool.patch;patch=1;pnum=1 \
67 file://reverse-compare.patch;patch=1 \
68 file://gcc34-15089.patch;patch=1 \
69 file://gcc-uclibc-3.3-100-conf.patch;patch=1 \
70 file://gcc-uclibc-3.3-110-conf.patch;patch=1 \
71 file://gcc-uclibc-3.3-120-softfloat.patch;patch=1 \
72 file://gcc-uclibc-3.3-200-code.patch;patch=1 \
73 file://bash3.patch;patch=1"
74
75PREMIRRORS_prepend () {
76${GNU_MIRROR}/gcc/releases/ ftp://gcc.gnu.org/pub/gcc/releases/
77${GNU_MIRROR}/gcc/releases/ http://gcc.get-software.com/releases/
78}
79
80S = "${WORKDIR}/gcc-${PV}"
81B = "${S}/build.${HOST_SYS}.${TARGET_SYS}"
82
83EXTRA_OECONF = "${@['--enable-clocale=generic', ''][bb.data.getVar('USE_NLS', d, 1) != 'no']} \
84 --with-gnu-ld \
85 --enable-shared \
86 --enable-multilib \
87 --enable-target-optspace \
88 --enable-languages=c,c++,f77 \
89 --enable-threads=posix \
90 --enable-c99 \
91 --enable-long-long \
92 --enable-symvers=gnu \
93 --program-prefix=${TARGET_PREFIX} \
94 ${EXTRA_OECONF_PATHS} \
95 ${EXTRA_OECONF_DEP}"
96
97EXTRA_OECONF_PATHS = "--with-local-prefix=${prefix}/local \
98 --with-gxx-include-dir=${includedir}/c++/${PV}"
99
100EXTRA_OECONF_DEP = ""
101EXTRA_OECONF_uclibc = "--disable-__cxa_atexit"
102EXTRA_OECONF_glibc = "--enable-__cxa_atexit"
103EXTRA_OECONF += "${@get_gcc_fpu_setting(bb, d)}"
104
105def get_gcc_fpu_setting(bb, d):
106 if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]:
107 return "--with-float=soft"
108 return ""
109
110python __anonymous () {
111 import bb, re
112 if (re.match('linux-uclibc$', bb.data.getVar('TARGET_OS', d, 1)) != None):
113 bb.data.setVar('EXTRA_OECONF_DEP', '${EXTRA_OECONF_uclibc}', d)
114 elif (re.match('linux$', bb.data.getVar('TARGET_OS', d, 1)) != None):
115 bb.data.setVar('EXTRA_OECONF_DEP', '${EXTRA_OECONF_glibc}', d)
116}
117
118do_configure () {
119 # Setup these vars for cross building only
120 if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
121 export CC_FOR_TARGET="${CCACHE} ${HOST_PREFIX}gcc"
122 export GCC_FOR_TARGET="${CCACHE} ${HOST_PREFIX}gcc"
123 export CXX_FOR_TARGET="${CCACHE} ${HOST_PREFIX}g++"
124 export AS_FOR_TARGET="${HOST_PREFIX}as"
125 export LD_FOR_TARGET="${HOST_PREFIX}ld"
126 export NM_FOR_TARGET="${HOST_PREFIX}nm"
127 export AR_FOR_TARGET="${HOST_PREFIX}ar"
128 export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
129 fi
130 (cd ${S} && gnu-configize) || die "failure running gnu-configize"
131 oe_runconf
132}
133
134do_install () {
135 autotools_do_install
136
137 # Cleanup some of the gcc-lib stuff
138 rm -rf ${D}${libdir}/gcc-lib/${TARGET_SYS}/${PV}/install-tools
139
140 # Move libgcc_s into /lib
141 mkdir -p ${D}${base_libdir}
142 mv -f ${D}${libdir}/libgcc_s.so.* ${D}${base_libdir}
143 rm -f ${D}${libdir}/libgcc_s.so
144 ln -sf `echo ${libdir}/gcc-lib/${TARGET_SYS}/${PV} | tr -s / |
145 sed -e 's,^/,,' -e 's,[^/]*,..,g'`/lib/libgcc_s.so.? \
146 ${D}${libdir}/gcc-lib/${TARGET_SYS}/${PV}/libgcc_s.so
147
148 # Cleanup manpages..
149 rm -rf ${D}${mandir}/man7
150 mv ${D}${mandir}/man1/cpp.1 \
151 ${D}${mandir}/man1/${TARGET_SYS}-cpp.1
152 mv ${D}${mandir}/man1/gcov.1 \
153 ${D}${mandir}/man1/${TARGET_SYS}-gcov.1
154
155 # We use libiberty from binutils
156 rm -f ${D}${libdir}/libiberty.a
157
158 cd ${D}${bindir}
159
160 # We care about g++ not c++
161 rm -f *c++
162
163 # We don't care about the gcc-<version> ones for this
164 rm -f *gcc-?.?*
165
166 # These sometimes show up, they are strange, we remove them
167 rm -f ${TARGET_ARCH}-*${TARGET_ARCH}-*
168
169 # Symlinks so we can use these trivially on the target
170 ln -sf ${TARGET_SYS}-g77 g77
171 ln -sf ${TARGET_SYS}-g++ g++
172 ln -sf ${TARGET_SYS}-gcc gcc
173 ln -sf g77 f77
174 ln -sf g++ c++
175 ln -sf gcc cc
176}
diff --git a/meta/packages/gcc/gcc_3.4.3.bb b/meta/packages/gcc/gcc_3.4.3.bb
new file mode 100644
index 0000000000..c92746be58
--- /dev/null
+++ b/meta/packages/gcc/gcc_3.4.3.bb
@@ -0,0 +1,27 @@
1PR = "r11"
2DESCRIPTION = "The GNU cc and gcc C compilers."
3HOMEPAGE = "http://www.gnu.org/software/gcc/"
4SECTION = "devel"
5LICENSE = "GPL"
6MAINTAINER = "Gerald Britton <gbritton@doomcom.org>"
7
8inherit autotools gettext
9
10include gcc-package.inc
11
12SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
13 file://gcc34-reverse-compare.patch;patch=1 \
14 file://gcc34-arm-ldm.patch;patch=1 \
15 file://gcc34-arm-ldm-peephole.patch;patch=1 \
16 file://gcc34-arm-tune.patch;patch=1 \
17 file://gcc-3.4.1-uclibc-100-conf.patch;patch=1 \
18 file://gcc-3.4.1-uclibc-200-locale.patch;patch=1 \
19 file://gcc-3.4.0-arm-lib1asm.patch;patch=1 \
20 file://gcc-3.4.0-arm-nolibfloat.patch;patch=1 \
21 file://gcc-3.4.0-arm-bigendian.patch;patch=1 \
22 file://gcc-3.4.0-arm-bigendian-uclibc.patch;patch=1 \
23 file://GCC3.4.0VisibilityPatch.diff;patch=1 \
24 file://15342.patch;patch=1 \
25 file://always-fixincperm.patch;patch=1"
26
27include gcc3-build.inc
diff --git a/meta/packages/gcc/gcc_3.4.4.bb b/meta/packages/gcc/gcc_3.4.4.bb
new file mode 100644
index 0000000000..5be603f2ca
--- /dev/null
+++ b/meta/packages/gcc/gcc_3.4.4.bb
@@ -0,0 +1,30 @@
1PR = "r5"
2DESCRIPTION = "The GNU cc and gcc C compilers."
3HOMEPAGE = "http://www.gnu.org/software/gcc/"
4SECTION = "devel"
5LICENSE = "GPL"
6MAINTAINER = "Gerald Britton <gbritton@doomcom.org>"
7
8inherit autotools gettext
9
10include gcc-package.inc
11
12SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
13 file://gcc34-reverse-compare.patch;patch=1 \
14 file://gcc34-arm-ldm.patch;patch=1 \
15 file://gcc34-arm-ldm-peephole.patch;patch=1 \
16 file://gcc34-arm-tune.patch;patch=1 \
17 file://gcc-3.4.1-uclibc-100-conf.patch;patch=1 \
18 file://gcc-3.4.1-uclibc-200-locale.patch;patch=1 \
19 file://gcc-3.4.0-arm-lib1asm.patch;patch=1 \
20 file://gcc-3.4.0-arm-nolibfloat.patch;patch=1 \
21 file://gcc-3.4.0-arm-bigendian.patch;patch=1 \
22 file://gcc-3.4.0-arm-bigendian-uclibc.patch;patch=1 \
23 file://GCC3.4.0VisibilityPatch.diff;patch=1 \
24 file://15342.patch;patch=1 \
25 file://always-fixincperm.patch;patch=1"
26
27SRC_URI += "file://gcc34-configure.in.patch;patch=1"
28SRC_URI += "file://gcc34-thumb-support.patch;patch=1"
29
30include gcc3-build.inc
diff --git a/meta/packages/gcc/gcc_4.0.2.bb b/meta/packages/gcc/gcc_4.0.2.bb
new file mode 100644
index 0000000000..f4eeb9bdef
--- /dev/null
+++ b/meta/packages/gcc/gcc_4.0.2.bb
@@ -0,0 +1,28 @@
1DESCRIPTION = "The GNU cc and gcc C compilers."
2HOMEPAGE = "http://www.gnu.org/software/gcc/"
3SECTION = "devel"
4LICENSE = "GPL"
5MAINTAINER = "Gerald Britton <gbritton@doomcom.org>"
6DEPENDS = "mpfr gmp"
7PR = "r1"
8
9inherit autotools gettext
10
11include gcc-package.inc
12
13SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
14 file://arm-nolibfloat.patch;patch=1 \
15 file://arm-softfloat.patch;patch=1 \
16 file://ldflags.patch;patch=1"
17
18# uclibc patches below
19SRC_URI_append = " file://100-uclibc-conf.patch;patch=1 \
20 file://200-uclibc-locale.patch;patch=1 \
21 file://301-missing-execinfo_h.patch;patch=1 \
22 file://302-c99-snprintf.patch;patch=1 \
23 file://303-c99-complex-ugly-hack.patch;patch=1 \
24 file://800-arm-bigendian.patch;patch=1 \
25 file://zecke-host-cpp-ac-hack.patch;patch=1 "
26
27
28include gcc4-build.inc
diff --git a/meta/packages/gcc/gcc_csl-arm-2005q3.bb b/meta/packages/gcc/gcc_csl-arm-2005q3.bb
new file mode 100644
index 0000000000..62bacda147
--- /dev/null
+++ b/meta/packages/gcc/gcc_csl-arm-2005q3.bb
@@ -0,0 +1,27 @@
1DESCRIPTION = "The GNU cc and gcc C compilers."
2HOMEPAGE = "http://www.gnu.org/software/gcc/"
3SECTION = "devel"
4LICENSE = "GPL"
5BINV = "3.4.4"
6PV = "3.4.4+csl-arm-2005q3"
7PR = "r1"
8
9FILESDIR = "${FILE_DIRNAME}/gcc-csl-arm"
10
11inherit autotools gettext
12
13include gcc-package.inc
14
15SRC_URI = "http://www.codesourcery.com/public/gnu_toolchain/arm/2005q3-2/arm-2005q3-2-arm-none-linux-gnueabi.src.tar.bz2 \
16 file://gcc_optab_arm.patch;patch=1"
17
18do_unpack2() {
19 cd ${WORKDIR}
20 tar -xvjf ./arm-2005q3-2-arm-none-linux-gnueabi/gcc-2005q3-2.tar.bz2
21}
22
23addtask unpack2 after do_unpack before do_patch
24
25include gcc3-build.inc
26
27S = "${WORKDIR}/gcc-2005q3"