diff options
author | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2007-02-24 11:00:05 +0000 |
---|---|---|
committer | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2007-02-24 11:00:05 +0000 |
commit | 1906cf93f86d8d66f45f90380a8d3da25c087ee5 (patch) | |
tree | 90916c99abe1f1ec26709ee420e6c349eda4670a /patches/gcc | |
parent | 2609573aede4ce198b3462976725b25eb1637d2e (diff) | |
download | crosstool-ng-1906cf93f86d8d66f45f90380a8d3da25c087ee5.tar.gz crosstool-ng-1906cf93f86d8d66f45f90380a8d3da25c087ee5.tar.bz2 crosstool-ng-1906cf93f86d8d66f45f90380a8d3da25c087ee5.zip |
Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
Diffstat (limited to 'patches/gcc')
200 files changed, 52564 insertions, 0 deletions
diff --git a/patches/gcc/2.95.3/arm-linux.patch b/patches/gcc/2.95.3/arm-linux.patch new file mode 100644 index 00000000..00974f6e --- /dev/null +++ b/patches/gcc/2.95.3/arm-linux.patch @@ -0,0 +1,647 @@ +--------- snip ------- +Downloaded from ftp://ftp.linux.org.uk/pub/armlinux/toolchain/src-2.95.3/gcc-2.95.3.diff.bz2 +Not sure what it fixes, but this appears to be The Patch used with gcc-2.95.3 on arm. +--------- snip ------- + +diff -urN gcc-2.95.3-orig/gcc/config/arm/arm.c gcc-2.95.3/gcc/config/arm/arm.c +--- gcc-2.95.3-orig/gcc/config/arm/arm.c Thu Jan 25 15:03:24 2001 ++++ gcc-2.95.3/gcc/config/arm/arm.c Fri Jul 20 19:39:11 2001 +@@ -1529,27 +1529,34 @@ + return gen_rtx_PLUS (Pmode, base, offset); + } + else if (GET_CODE (orig) == LABEL_REF) +- current_function_uses_pic_offset_table = 1; +- +- return orig; +-} ++ { ++ current_function_uses_pic_offset_table = 1; + +-static rtx pic_rtx; ++ if (NEED_PLT_GOT) ++ { ++ rtx pic_ref, address = gen_reg_rtx (Pmode); ++ ++ emit_insn (gen_pic_load_addr (address, orig)); ++ pic_ref = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, ++ address); ++ emit_move_insn (address, pic_ref); ++ return address; ++ } ++ } + +-int +-is_pic(x) +- rtx x; +-{ +- if (x == pic_rtx) +- return 1; +- return 0; ++ return orig; + } + ++/* Generate code to load the PIC register. PROLOGUE is true if ++ called from arm_expand_prologue (in which case we want the ++ generated insns at the start of the function); false if called ++ by an exception receiver that needs the PIC register reloaded ++ (in which case the insns are just dumped at the current location). */ + void +-arm_finalize_pic () ++arm_finalize_pic (int prologue) + { + #ifndef AOF_ASSEMBLER +- rtx l1, pic_tmp, pic_tmp2, seq; ++ rtx l1, pic_tmp, pic_tmp2, seq, pic_rtx; + rtx global_offset_table; + + if (current_function_uses_pic_offset_table == 0) +@@ -1578,7 +1585,10 @@ + + seq = gen_sequence (); + end_sequence (); +- emit_insn_after (seq, get_insns ()); ++ if (prologue) ++ emit_insn_after (seq, get_insns ()); ++ else ++ emit_insn (seq); + + /* Need to emit this whether or not we obey regdecls, + since setjmp/longjmp can cause life info to screw up. */ +@@ -5327,7 +5337,13 @@ + if (frame_pointer_needed) + live_regs += 4; + +- if (live_regs) ++ if (live_regs == 1 && regs_ever_live[LR_REGNUM] ++ && ! lr_save_eliminated && ! really_return) ++ { ++ output_asm_insn (reverse ? "ldr%?%D0\t%|lr, [%|sp}, #4" ++ : "ldr%?%d0\t%|lr, [%|sp], #4", &operand); ++ } ++ else if (live_regs) + { + if (lr_save_eliminated || ! regs_ever_live[14]) + live_regs++; +@@ -5446,7 +5462,7 @@ + rtx x; + + length = strlen (name); +- alignlength = (length + 1) + 3 & ~3; ++ alignlength = ((length + 1) + 3) & ~3; + + ASM_OUTPUT_ASCII (stream, name, length + 1); + ASM_OUTPUT_ALIGN (stream, 2); +@@ -5838,6 +5854,9 @@ + int store_arg_regs = 0; + int volatile_func = (optimize > 0 + && TREE_THIS_VOLATILE (current_function_decl)); ++ rtx ip_rtx; ++ int fp_offset = 0; ++ rtx insn; + + /* Naked functions don't have prologues. */ + if (arm_naked_function_p (current_function_decl)) +@@ -5859,11 +5878,59 @@ + live_regs_mask |= 0x4000; + } + ++ ip_rtx = gen_rtx_REG (SImode, IP_REGNUM); ++ + if (frame_pointer_needed) + { ++ if (current_function_needs_context) ++ { ++ /* The Static chain register is the same as the IP register ++ used as a scratch register during stack frame creation. ++ To get around this need to find somewhere to store IP ++ whilst the frame is being created. We try the following ++ places in order: ++ ++ 1. An unused argument register. ++ 2. A slot on the stack above the frame. (This only ++ works if the function is not a varargs function). ++ ++ If neither of these places is available, we abort (for now). */ ++ if (regs_ever_live[3] == 0) ++ { ++ insn = gen_rtx_REG (SImode, 3); ++ insn = gen_rtx_SET (SImode, insn, ip_rtx); ++ insn = emit_insn (insn); ++ RTX_FRAME_RELATED_P (insn) = 1; ++ } ++ else if (current_function_pretend_args_size == 0) ++ { ++ insn = gen_rtx_PRE_DEC (SImode, stack_pointer_rtx); ++ insn = gen_rtx_MEM (SImode, insn); ++ insn = gen_rtx_SET (VOIDmode, insn, ip_rtx); ++ insn = emit_insn (insn); ++ RTX_FRAME_RELATED_P (insn) = 1; ++ fp_offset = 4; ++ } ++ else ++ /* FIXME - the way to handle this situation is to allow ++ the pretend args to be dumped onto the stack, then ++ reuse r3 to save IP. This would involve moving the ++ copying os SP into IP until after the pretend args ++ have been dumped, but this is not too hard. */ ++ error ("Unable to find a temporary location for static chanin register"); ++ } ++ + live_regs_mask |= 0xD800; +- emit_insn (gen_movsi (gen_rtx_REG (SImode, 12), +- stack_pointer_rtx)); ++ if (fp_offset) ++ { ++ insn = gen_rtx_PLUS (SImode, stack_pointer_rtx, GEN_INT (fp_offset)); ++ insn = gen_rtx_SET (SImode, ip_rtx, insn); ++ } ++ else ++ insn = gen_movsi (ip_rtx, stack_pointer_rtx); ++ ++ insn = emit_insn (insn); ++ RTX_FRAME_RELATED_P (insn) = 1; + } + + if (current_function_pretend_args_size) +@@ -5927,9 +5994,31 @@ + } + + if (frame_pointer_needed) +- emit_insn (gen_addsi3 (hard_frame_pointer_rtx, gen_rtx_REG (SImode, 12), +- (GEN_INT +- (-(4 + current_function_pretend_args_size))))); ++ { ++ insn = GEN_INT (-(4 + current_function_pretend_args_size + fp_offset)); ++ insn = emit_insn (gen_addsi3 (hard_frame_pointer_rtx, ip_rtx, insn)); ++ RTX_FRAME_RELATED_P (insn) = 1; ++ ++ if (current_function_needs_context) ++ { ++ /* Recover the static chain register. */ ++ if (regs_ever_live [3] == 0) ++ { ++ insn = gen_rtx_REG (SImode, 3); ++ insn = gen_rtx_SET (SImode, ip_rtx, insn); ++ insn = emit_insn (insn); ++ RTX_FRAME_RELATED_P (insn) = 1; ++ } ++ else /* if (current_function_pretend_args_size == 0) */ ++ { ++ insn = gen_rtx_PLUS (SImode, hard_frame_pointer_rtx, GEN_INT (4)); ++ insn = gen_rtx_MEM (SImode, insn); ++ insn = gen_rtx_SET (SImode, ip_rtx, insn); ++ insn = emit_insn (insn); ++ RTX_FRAME_RELATED_P (insn) = 1; ++ } ++ } ++ } + + if (amount != const0_rtx) + { +diff -urN gcc-2.95.3-orig/gcc/config/arm/arm.h gcc-2.95.3/gcc/config/arm/arm.h +--- gcc-2.95.3-orig/gcc/config/arm/arm.h Thu Jan 25 15:03:26 2001 ++++ gcc-2.95.3/gcc/config/arm/arm.h Fri Jul 20 19:39:11 2001 +@@ -601,14 +601,20 @@ + (TREE_CODE (EXP) == STRING_CST \ + && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN)) + ++#ifndef STRUCTURE_SIZE_BOUNDARY + /* Every structures size must be a multiple of 32 bits. */ + /* This is for compatibility with ARMCC. ARM SDT Reference Manual + (ARM DUI 0020D) page 2-20 says "Structures are aligned on word + boundaries". */ +-#ifndef STRUCTURE_SIZE_BOUNDARY +-#define STRUCTURE_SIZE_BOUNDARY 32 ++/* Setting this to 32 produces more efficient code, but the value set in previous ++ versions of this toolchain was 8, which produces more compact structures. The ++ command line option -mstructure_size_boundary=<n> can be used to change this ++ value. */ ++#define STRUCTURE_SIZE_BOUNDARY arm_structure_size_boundary + #endif + ++extern int arm_structure_size_boundary; ++ + /* Used when parsing command line option -mstructure_size_boundary. */ + extern const char * structure_size_string; + +@@ -768,6 +774,9 @@ + /* Specify the registers used for certain standard purposes. + The values of these macros are register numbers. */ + ++/* Register which holds return address from a subroutine call. */ ++#define LR_REGNUM 14 ++ + /* Define this if the program counter is overloaded on a register. */ + #define PC_REGNUM 15 + +@@ -777,6 +786,9 @@ + /* Base register for access to local variables of the function. */ + #define FRAME_POINTER_REGNUM 25 + ++/* Scratch register - used in all kinds of places, eg trampolines. */ ++#define IP_REGNUM 12 ++ + /* Define this to be where the real frame pointer is if it is not possible to + work out the offset between the frame pointer and the automatic variables + until after register allocation has taken place. FRAME_POINTER_REGNUM +@@ -798,7 +810,7 @@ + /* The native (Norcroft) Pascal compiler for the ARM passes the static chain + as an invisible last argument (possible since varargs don't exist in + Pascal), so the following is not true. */ +-#define STATIC_CHAIN_REGNUM 8 ++#define STATIC_CHAIN_REGNUM 12 + + /* Register in which address to store a structure value + is passed to a function. */ +@@ -1248,7 +1260,12 @@ + { \ + int volatile_func = arm_volatile_func (); \ + if ((FROM) == ARG_POINTER_REGNUM && (TO) == HARD_FRAME_POINTER_REGNUM)\ +- (OFFSET) = 0; \ ++ { \ ++ if (! current_function_needs_context || ! frame_pointer_needed) \ ++ (OFFSET) = 0; \ ++ else \ ++ (OFFSET) = 4; \ ++ } \ + else if ((FROM) == FRAME_POINTER_REGNUM \ + && (TO) == STACK_POINTER_REGNUM) \ + (OFFSET) = (current_function_outgoing_args_size \ +@@ -1379,8 +1396,10 @@ + + On the ARM, allow any integer (invalid ones are removed later by insn + patterns), nice doubles and symbol_refs which refer to the function's +- constant pool XXX. */ +-#define LEGITIMATE_CONSTANT_P(X) (! label_mentioned_p (X)) ++ constant pool XXX. ++ ++ When generating PIC code, allow anything. */ ++#define LEGITIMATE_CONSTANT_P(X) (flag_pic || ! label_mentioned_p (X)) + + /* Symbols in the text segment can be accessed without indirecting via the + constant pool; it may take an extra binary operation, but this is still +@@ -1496,9 +1515,8 @@ + && INTVAL (op) <= 31) \ + goto LABEL; \ + } \ +- /* NASTY: Since this limits the addressing of unsigned byte loads */ \ + range = ((MODE) == HImode || (MODE) == QImode) \ +- ? (arm_arch4 ? 256 : 4095) : 4096; \ ++ ? (((MODE) == HImode && arm_arch4) ? 256 : 4095) : 4096; \ + if (code == CONST_INT && INTVAL (INDEX) < range \ + && INTVAL (INDEX) > -range) \ + goto LABEL; \ +@@ -1812,14 +1830,15 @@ + data addresses in memory. */ + #define PIC_OFFSET_TABLE_REGNUM arm_pic_register + +-#define FINALIZE_PIC arm_finalize_pic () ++#define FINALIZE_PIC arm_finalize_pic (1) + +-/* We can't directly access anything that contains a symbol, ++/* We can't directly access anything that contains a symbol or label, + nor can we indirect via the constant pool. */ + #define LEGITIMATE_PIC_OPERAND_P(X) \ +- (! symbol_mentioned_p (X) \ ++ (! symbol_mentioned_p (X) && ! label_mentioned_p (X) \ + && (! CONSTANT_POOL_ADDRESS_P (X) \ +- || ! symbol_mentioned_p (get_pool_constant (X)))) ++ || (! symbol_mentioned_p (get_pool_constant (X))) \ ++ && (! label_mentioned_p (get_pool_constant (X))))) + + /* We need to know when we are making a constant pool; this determines + whether data needs to be in the GOT or can be referenced via a GOT +@@ -2046,17 +2065,9 @@ + else output_addr_const(STREAM, X); \ + } + +-/* Handles PIC addr specially */ + #define OUTPUT_INT_ADDR_CONST(STREAM,X) \ + { \ +- if (flag_pic && GET_CODE(X) == CONST && is_pic(X)) \ +- { \ +- output_addr_const(STREAM, XEXP (XEXP (XEXP (X, 0), 0), 0)); \ +- fputs(" - (", STREAM); \ +- output_addr_const(STREAM, XEXP (XEXP (XEXP (X, 0), 1), 0)); \ +- fputs(")", STREAM); \ +- } \ +- else output_addr_const(STREAM, X); \ ++ output_addr_const(STREAM, X); \ + \ + /* Mark symbols as position independent. We only do this in the \ + .text segment, not in the .data segment. */ \ +@@ -2170,8 +2181,7 @@ + int arm_return_in_memory PROTO ((Tree)); + int legitimate_pic_operand_p PROTO ((Rtx)); + Rtx legitimize_pic_address PROTO ((Rtx, Mmode, Rtx)); +-int is_pic PROTO ((Rtx)); +-void arm_finalize_pic PROTO ((void)); ++void arm_finalize_pic PROTO ((int)); + int arm_rtx_costs RTX_CODE_PROTO ((Rtx, Rcode)); + int arm_adjust_cost PROTO ((Rtx, Rtx, Rtx, int)); + int const_double_rtx_ok_for_fpu PROTO ((Rtx)); +diff -urN gcc-2.95.3-orig/gcc/config/arm/arm.md gcc-2.95.3/gcc/config/arm/arm.md +--- gcc-2.95.3-orig/gcc/config/arm/arm.md Thu Jan 25 15:03:27 2001 ++++ gcc-2.95.3/gcc/config/arm/arm.md Fri Jul 20 19:39:11 2001 +@@ -2629,7 +2629,8 @@ + : preserve_subexpressions_p ())); + DONE; + } +- if (CONSTANT_P (operands[1]) && flag_pic) ++ if ((CONSTANT_P (operands[1]) || symbol_mentioned_p (operands[1]) ++ || label_mentioned_p (operands[1])) && flag_pic) + operands[1] = legitimize_pic_address (operands[1], SImode, + ((reload_in_progress + || reload_completed) +@@ -2721,6 +2722,15 @@ + return \"add%?\\t%0, %|pc, %0\"; + ") + ++(define_expand "builtin_setjmp_receiver" ++ [(label_ref (match_operand 0 "" ""))] ++ "flag_pic" ++ " ++{ ++ arm_finalize_pic (0); ++ DONE; ++}") ++ + ;; If copying one reg to another we can set the condition codes according to + ;; its value. Such a move is common after a return from subroutine and the + ;; result is being tested against zero. +@@ -6184,15 +6194,20 @@ + abort (); + return \"\"; + } +- strcpy (pattern, \"stmfd\\t%m0!, {%1\"); +- for (i = 1; i < XVECLEN (operands[2], 0); i++) ++ if (XVECLEN (operands[2], 0) > 1) + { +- strcat (pattern, \", %|\"); +- strcat (pattern, reg_names[REGNO (XEXP (XVECEXP (operands[2], 0, i), ++ strcpy (pattern, \"stmfd\\t%m0!, {%1\"); ++ for (i = 1; i < XVECLEN (operands[2], 0); i++) ++ { ++ strcat (pattern, \", %|\"); ++ strcat (pattern, reg_names[REGNO (XEXP (XVECEXP (operands[2], 0, i), + 0))]); ++ } ++ strcat (pattern, \"}\"); ++ output_asm_insn (pattern, operands); + } +- strcat (pattern, \"}\"); +- output_asm_insn (pattern, operands); ++ else ++ output_asm_insn (\"str\\t%1, [%m0, #-4]!\", operands); + return \"\"; + }" + [(set_attr "type" "store4")]) +diff -urN gcc-2.95.3-orig/gcc/config/arm/elf.h gcc-2.95.3/gcc/config/arm/elf.h +--- gcc-2.95.3-orig/gcc/config/arm/elf.h Mon May 31 10:21:53 1999 ++++ gcc-2.95.3/gcc/config/arm/elf.h Fri Jul 20 19:39:11 2001 +@@ -167,15 +167,6 @@ + #define MULTILIB_DEFAULTS { "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork" } + #endif + +-/* Setting this to 32 produces more efficient code, but the value set in previous +- versions of this toolchain was 8, which produces more compact structures. The +- command line option -mstructure_size_boundary=<n> can be used to change this +- value. */ +-#undef STRUCTURE_SIZE_BOUNDARY +-#define STRUCTURE_SIZE_BOUNDARY arm_structure_size_boundary +- +-extern int arm_structure_size_boundary; +- + /* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS + is a valid machine specific attribute for DECL. + The attributes in ATTRIBUTES have previously been assigned to DECL. */ +diff -urN gcc-2.95.3-orig/gcc/config/arm/linux-gas.h gcc-2.95.3/gcc/config/arm/linux-gas.h +--- gcc-2.95.3-orig/gcc/config/arm/linux-gas.h Mon Feb 22 17:47:57 1999 ++++ gcc-2.95.3/gcc/config/arm/linux-gas.h Fri Jul 20 19:39:11 2001 +@@ -1,6 +1,6 @@ + /* Definitions of target machine for GNU compiler. + ARM Linux-based GNU systems version. +- Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. ++ Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Contributed by Russell King <rmk92@ecs.soton.ac.uk>. + + This file is part of GNU CC. +@@ -79,5 +79,7 @@ + register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \ + register unsigned long _end __asm ("a2") = (unsigned long) (END); \ + register unsigned long _flg __asm ("a3") = 0; \ +- __asm __volatile ("swi 0x9f0002"); \ ++ __asm __volatile ("swi 0x9f0002 @ sys_cacheflush" \ ++ : "=r" (_beg) \ ++ : "0" (_beg), "r" (_end), "r" (_flg)); \ + } +diff -urN gcc-2.95.3-orig/gcc/config/arm/t-linux gcc-2.95.3/gcc/config/arm/t-linux +--- gcc-2.95.3-orig/gcc/config/arm/t-linux Fri Mar 26 16:30:20 1999 ++++ gcc-2.95.3/gcc/config/arm/t-linux Fri Jul 20 20:46:19 2001 +@@ -1,6 +1,6 @@ + # Just for these, we omit the frame pointer since it makes such a big + # difference. It is then pointless adding debugging. +-TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC ++TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC + LIBGCC2_DEBUG_CFLAGS = -g0 + + # Don't build enquire +diff -urN gcc-2.95.3-orig/gcc/final.c gcc-2.95.3/gcc/final.c +--- gcc-2.95.3-orig/gcc/final.c Mon Mar 12 13:07:59 2001 ++++ gcc-2.95.3/gcc/final.c Fri Jul 20 19:39:11 2001 +@@ -3652,8 +3652,9 @@ + + output_addr_const (file, XEXP (x, 0)); + fprintf (file, "-"); +- if (GET_CODE (XEXP (x, 1)) == CONST_INT +- && INTVAL (XEXP (x, 1)) < 0) ++ if ((GET_CODE (XEXP (x, 1)) == CONST_INT ++ && INTVAL (XEXP (x, 1)) < 0) ++ || GET_CODE (XEXP (x, 1)) != CONST_INT) + { + fprintf (file, ASM_OPEN_PAREN); + output_addr_const (file, XEXP (x, 1)); +diff -urN gcc-2.95.3-orig/gcc/function.c gcc-2.95.3/gcc/function.c +--- gcc-2.95.3-orig/gcc/function.c Thu Jan 25 15:03:15 2001 ++++ gcc-2.95.3/gcc/function.c Fri Jul 20 19:39:10 2001 +@@ -3053,6 +3053,105 @@ + extracted by usage MEM with narrower mode. */ + static rtx purge_addressof_replacements; + ++/* Return 1 if X and Y are identical-looking rtx's. ++ This is the Lisp function EQUAL for rtx arguments. */ ++ ++int ++rtx_equal_for_addressof_p (x, y) ++ rtx x, y; ++{ ++ register int i; ++ register int j; ++ register enum rtx_code code; ++ register char *fmt; ++ ++ if (x == y) ++ return 1; ++ if (x == 0 || y == 0) ++ return 0; ++ ++ code = GET_CODE (x); ++ /* Rtx's of different codes cannot be equal. */ ++ if (code != GET_CODE (y)) ++ return 0; ++ ++ /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent. ++ (REG:SI x) and (REG:HI x) are NOT equivalent. ++ But (MEM:SI x) and (MEM:HI x) are equivalent for our purposes. */ ++ ++ if (code != MEM && (GET_MODE (x) != GET_MODE (y))) ++ return 0; ++ ++ /* REG, LABEL_REF, and SYMBOL_REF can be compared nonrecursively. */ ++ ++ if (code == REG) ++ return REGNO (x) == REGNO (y); ++ else if (code == LABEL_REF) ++ return XEXP (x, 0) == XEXP (y, 0); ++ else if (code == SYMBOL_REF) ++ return XSTR (x, 0) == XSTR (y, 0); ++ else if (code == SCRATCH || code == CONST_DOUBLE) ++ return 0; ++ ++ /* Compare the elements. If any pair of corresponding elements ++ fail to match, return 0 for the whole things. */ ++ ++ fmt = GET_RTX_FORMAT (code); ++ for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) ++ { ++ switch (fmt[i]) ++ { ++ case 'w': ++ if (XWINT (x, i) != XWINT (y, i)) ++ return 0; ++ break; ++ ++ case 'n': ++ case 'i': ++ if (XINT (x, i) != XINT (y, i)) ++ return 0; ++ break; ++ ++ case 'V': ++ case 'E': ++ /* Two vectors must have the same length. */ ++ if (XVECLEN (x, i) != XVECLEN (y, i)) ++ return 0; ++ ++ /* And the corresponding elements must match. */ ++ for (j = 0; j < XVECLEN (x, i); j++) ++ if (rtx_equal_p (XVECEXP (x, i, j), XVECEXP (y, i, j)) == 0) ++ return 0; ++ break; ++ ++ case 'e': ++ if (rtx_equal_p (XEXP (x, i), XEXP (y, i)) == 0) ++ return 0; ++ break; ++ ++ case 'S': ++ case 's': ++ if (strcmp (XSTR (x, i), XSTR (y, i))) ++ return 0; ++ break; ++ ++ case 'u': ++ /* These are just backpointers, so they don't matter. */ ++ break; ++ ++ case '0': ++ break; ++ ++ /* It is believed that rtx's at this level will never ++ contain anything but integers and other rtx's, ++ except for within LABEL_REFs and SYMBOL_REFs. */ ++ default: ++ abort (); ++ } ++ } ++ return 1; ++} ++ + /* Helper function for purge_addressof. See if the rtx expression at *LOC + in INSN needs to be changed. If FORCE, always put any ADDRESSOFs into + the stack. */ +@@ -3133,7 +3232,7 @@ + for (tem = purge_bitfield_addressof_replacements; + tem != NULL_RTX; + tem = XEXP (XEXP (tem, 1), 1)) +- if (rtx_equal_p (x, XEXP (tem, 0))) ++ if (rtx_equal_for_addressof_p (x, XEXP (tem, 0))) + { + *loc = XEXP (XEXP (tem, 1), 0); + return; +@@ -3143,7 +3242,7 @@ + for (tem = purge_addressof_replacements; + tem != NULL_RTX; + tem = XEXP (XEXP (tem, 1), 1)) +- if (rtx_equal_p (XEXP (x, 0), XEXP (tem, 0))) ++ if (rtx_equal_for_addressof_p (XEXP (x, 0), XEXP (tem, 0))) + { + rtx z = XEXP (XEXP (tem, 1), 0); + +diff -urN gcc-2.95.3-orig/gcc/jump.c gcc-2.95.3/gcc/jump.c +--- gcc-2.95.3-orig/gcc/jump.c Thu Oct 21 08:24:03 1999 ++++ gcc-2.95.3/gcc/jump.c Fri Jul 20 19:39:10 2001 +@@ -115,7 +115,7 @@ + static rtx delete_unreferenced_labels PROTO((rtx)); + static void delete_noop_moves PROTO((rtx)); + static int calculate_can_reach_end PROTO((rtx, int, int)); +-static int duplicate_loop_exit_test PROTO((rtx)); ++static int duplicate_loop_exit_test PROTO((rtx, int)); + static void find_cross_jump PROTO((rtx, rtx, int, rtx *, rtx *)); + static void do_cross_jump PROTO((rtx, rtx, rtx)); + static int jump_back_p PROTO((rtx, rtx)); +@@ -338,7 +338,7 @@ + && simplejump_p (temp1)) + { + temp = PREV_INSN (insn); +- if (duplicate_loop_exit_test (insn)) ++ if (duplicate_loop_exit_test (insn, after_regscan)) + { + changed = 1; + next = NEXT_INSN (temp); +@@ -2548,8 +2548,9 @@ + values of regno_first_uid and regno_last_uid. */ + + static int +-duplicate_loop_exit_test (loop_start) ++duplicate_loop_exit_test (loop_start, after_regscan) + rtx loop_start; ++ int after_regscan; + { + rtx insn, set, reg, p, link; + rtx copy = 0, first_copy = 0; +@@ -2662,6 +2663,9 @@ + reg_map[REGNO (reg)] = gen_reg_rtx (GET_MODE (reg)); + } + } ++ ++ if (after_regscan) ++ reg_scan_update (exitcode, lastexit, max_reg); + + /* Now copy each insn. */ + for (insn = exitcode; insn != lastexit; insn = NEXT_INSN (insn)) +diff -urN gcc-2.95.3-orig/gcc/varasm.c gcc-2.95.3/gcc/varasm.c +--- gcc-2.95.3-orig/gcc/varasm.c Mon Feb 19 15:02:02 2001 ++++ gcc-2.95.3/gcc/varasm.c Fri Jul 20 19:39:11 2001 +@@ -3286,7 +3286,10 @@ + value->un.addr.offset = - INTVAL (XEXP (x, 1)); + } + else +- abort (); ++ { ++ value->un.addr.base = x; ++ value->un.addr.offset = 0; ++ } + break; + + default: diff --git a/patches/gcc/2.95.3/backport-config.gcc-1.4.patch b/patches/gcc/2.95.3/backport-config.gcc-1.4.patch new file mode 100644 index 00000000..141de0c7 --- /dev/null +++ b/patches/gcc/2.95.3/backport-config.gcc-1.4.patch @@ -0,0 +1,35 @@ +# Taken from http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config.gcc.diff?r1=1.3&r2=1.4 +# Should fix error +# Configuration powerpc-host_apple-darwin7.3.0 not supported +# when configuring gcc-2.95 on Mac OS X for i686 target +# Also create xm-darwin.h, seems to be required, else we get the error +# In file included from .../gcc-2.95.3/gcc/gencheck.c:21: +# hconfig.h:11:30: rs6000/xm-darwin.h: No such file or directory +# make[1]: *** [gencheck.o] Error 1 + + +--- gcc-2.95.3/gcc/configure.old 2004-03-24 12:17:44.000000000 -0800 ++++ gcc-2.95.3/gcc/configure 2004-03-24 17:14:38.000000000 -0800 +@@ -5079,6 +5079,10 @@ + tmake_file=rs6000/t-beos + xmake_file=rs6000/x-beos + ;; ++ powerpc-*-darwin*) ++ xm_file="rs6000/xm-rs6000.h rs6000/xm-darwin.h" ++ xmake_file=rs6000/x-darwin ++ ;; + powerpc-*-sysv* | powerpc-*-elf*) + tm_file=rs6000/sysv4.h + xm_file="xm-siglist.h rs6000/xm-sysv4.h" +--- /dev/null 2003-01-30 02:24:37.000000000 -0800 ++++ gcc-3.0.4/gcc/config/rs6000/xm-darwin.h 2000-11-20 19:02:09.000000000 -0800 +@@ -0,0 +1,9 @@ ++/* Undo the USG definition in xm-rs6000.h, Darwin is a BSD flavor. */ ++ ++#undef USG ++ ++/* Override the usual setting, since Apple's GCC has lame bugs and ++ can't handle the initializers. Someday the bugs will be fixed and ++ we can get rid of this silliness. */ ++ ++#define HAVE_DESIGNATED_INITIALIZERS 0 diff --git a/patches/gcc/2.95.3/backport-config.gcc-1.92.patch b/patches/gcc/2.95.3/backport-config.gcc-1.92.patch new file mode 100644 index 00000000..fc55681d --- /dev/null +++ b/patches/gcc/2.95.3/backport-config.gcc-1.92.patch @@ -0,0 +1,39 @@ +# Taken from http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config.gcc.diff?r1=1.91&r2=1.92 +# Should fix error +# Configuration x86_64-host_unknown-linux-gnu not supported +# when configuring gcc-2.95 on x86_64 build for i686 target +# It's a bit silly, since tm_file refers to files that don't exist, +# but as long as x86_64 is just the build machine, that doesn't matter. + +--- gcc-2.95.3/gcc/configure.old 2004-03-24 12:17:44.000000000 -0800 ++++ gcc-2.95.3/gcc/configure 2004-03-24 12:19:30.000000000 -0800 +@@ -2929,6 +2929,9 @@ + i[34567]86-*-*) + cpu_type=i386 + ;; ++ x86_64-*-*) ++ cpu_type=i386 ++ ;; + hppa*-*-*) + cpu_type=pa + ;; +@@ -3643,6 +3646,19 @@ + thread_file='posix' + fi + ;; ++ x86_64-*-linux*) ++ xmake_file=x-linux ++ tm_file="i386/biarch64.h i386/i386.h i386/att.h linux.h i386/x86-64.h \ ++ i386/linux64.h" ++ tmake_file="t-slibgcc-elf-ver t-linux i386/t-crtstuff" ++ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" ++ gnu_ld=yes ++ float_format=i386 ++ if test x$enable_threads = xyes; then ++ thread_file='posix' ++ fi ++ ;; ++ + i[34567]86-*-gnu*) + float_format=i386 + ;; diff --git a/patches/gcc/2.95.3/config.sub.patch b/patches/gcc/2.95.3/config.sub.patch new file mode 100644 index 00000000..c8189b59 --- /dev/null +++ b/patches/gcc/2.95.3/config.sub.patch @@ -0,0 +1,1257 @@ +# Backport from gcc-3.3.3 +# Fixes errors like +# Invalid configuration `x86_64-host_unknown-linux-gnu': machine `x86_64-host_unknown' not recognized +# Unrecognized host system name x86_64-host_unknown-linux-gnu. +# when configuring on chip types or operating systems like x86_64 or Darwin +# which are newer than gcc-2.95 + +--- gcc-2.95.3/config.sub.old 1999-08-04 01:09:26.000000000 -0700 ++++ gcc-2.95.3/config.sub 2004-03-24 11:28:24.000000000 -0800 +@@ -1,6 +1,10 @@ + #! /bin/sh +-# Configuration validation subroutine script, version 1.1. +-# Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc. ++# Configuration validation subroutine script. ++# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, ++# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. ++ ++timestamp='2003-01-28' ++ + # This file is (in principle) common to ALL GNU software. + # The presence of a machine in this file suggests that SOME GNU software + # can handle that machine. It does not imply ALL GNU software can. +@@ -25,6 +29,9 @@ + # configuration script generated by Autoconf, you may include it under + # the same distribution terms that you use for the rest of that program. + ++# Please send patches to <config-patches@gnu.org>. Submit a context ++# diff and a properly formatted ChangeLog entry. ++# + # Configuration subroutine to validate and canonicalize a configuration type. + # Supply the specified configuration type as an argument. + # If it is invalid, we print an error message on stderr and exit with code 1. +@@ -45,30 +52,73 @@ + # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM + # It is wrong to echo any other type of specification. + +-if [ x$1 = x ] +-then +- echo Configuration name missing. 1>&2 +- echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 +- echo "or $0 ALIAS" 1>&2 +- echo where ALIAS is a recognized configuration type. 1>&2 +- exit 1 +-fi ++me=`echo "$0" | sed -e 's,.*/,,'` + +-# First pass through any local machine types. +-case $1 in +- *local*) +- echo $1 +- exit 0 +- ;; +- *) +- ;; ++usage="\ ++Usage: $0 [OPTION] CPU-MFR-OPSYS ++ $0 [OPTION] ALIAS ++ ++Canonicalize a configuration name. ++ ++Operation modes: ++ -h, --help print this help, then exit ++ -t, --time-stamp print date of last modification, then exit ++ -v, --version print version number, then exit ++ ++Report bugs and patches to <config-patches@gnu.org>." ++ ++version="\ ++GNU config.sub ($timestamp) ++ ++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 ++Free Software Foundation, Inc. ++ ++This is free software; see the source for copying conditions. There is NO ++warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." ++ ++help=" ++Try \`$me --help' for more information." ++ ++# Parse command line ++while test $# -gt 0 ; do ++ case $1 in ++ --time-stamp | --time* | -t ) ++ echo "$timestamp" ; exit 0 ;; ++ --version | -v ) ++ echo "$version" ; exit 0 ;; ++ --help | --h* | -h ) ++ echo "$usage"; exit 0 ;; ++ -- ) # Stop option processing ++ shift; break ;; ++ - ) # Use stdin as input. ++ break ;; ++ -* ) ++ echo "$me: invalid option $1$help" ++ exit 1 ;; ++ ++ *local*) ++ # First pass through any local machine types. ++ echo $1 ++ exit 0;; ++ ++ * ) ++ break ;; ++ esac ++done ++ ++case $# in ++ 0) echo "$me: missing argument$help" >&2 ++ exit 1;; ++ 1) ;; ++ *) echo "$me: too many arguments$help" >&2 ++ exit 1;; + esac + + # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). + # Here we must recognize all the valid KERNEL-OS combinations. + maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` + case $maybe_os in +- linux-gnu*) ++ nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; +@@ -94,20 +144,28 @@ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ +- -apple) ++ -apple | -axis) + os= + basic_machine=$1 + ;; +- -sim | -cisco | -oki | -wec | -winbond ) # EGCS LOCAL ++ -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; +- -scout) # EGCS LOCAL ++ -scout) + ;; +- -wrs) # EGCS LOCAL ++ -wrs) + os=-vxworks + basic_machine=$1 + ;; ++ -chorusos*) ++ os=-chorusos ++ basic_machine=$1 ++ ;; ++ -chorusrdb) ++ os=-chorusrdb ++ basic_machine=$1 ++ ;; + -hiux*) + os=-hiuxwe2 + ;; +@@ -156,49 +214,72 @@ + -psos*) + os=-psos + ;; ++ -mint | -mint[0-9]*) ++ basic_machine=m68k-atari ++ os=-mint ++ ;; + esac + + # Decode aliases for certain CPU-COMPANY combinations. + case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. +- tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ +- | arme[lb] | pyramid | mn10200 | mn10300 \ +- | tron | a29k | 580 | i960 | h8300 \ +- | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ +- | alpha | alphaev5 | alphaev56 | alphapca56 | alphaev6 \ +- | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ +- | 1750a | dsp16xx | pdp11 \ +- | mips64 | mipsel | mips64el | mips64orion | mips64orionel \ +- | mipstx39 | mipstx39el \ +- | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x) +- basic_machine=$basic_machine-unknown +- ;; +- m88110 | m680[012346]0 | m683?2 | m68360 | m5200 | z8k | v70 \ +- | h8500 | w65) # EGCS LOCAL +- ;; +- thumb) +- basic_machine=$basic_machine-unknown +- ;; +- mips64vr4300 | mips64vr4300el) # EGCS LOCAL jsmith/vr4300 ++ 1750a | 580 \ ++ | a29k \ ++ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ ++ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ ++ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ ++ | clipper \ ++ | d10v | d30v | dlx | dsp16xx \ ++ | fr30 | frv \ ++ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ ++ | i370 | i860 | i960 | ia64 \ ++ | ip2k \ ++ | m32r | m68000 | m68k | m88k | mcore \ ++ | mips | mipsbe | mipseb | mipsel | mipsle \ ++ | mips16 \ ++ | mips64 | mips64el \ ++ | mips64vr | mips64vrel \ ++ | mips64orion | mips64orionel \ ++ | mips64vr4100 | mips64vr4100el \ ++ | mips64vr4300 | mips64vr4300el \ ++ | mips64vr5000 | mips64vr5000el \ ++ | mipsisa32 | mipsisa32el \ ++ | mipsisa32r2 | mipsisa32r2el \ ++ | mipsisa64 | mipsisa64el \ ++ | mipsisa64sb1 | mipsisa64sb1el \ ++ | mipsisa64sr71k | mipsisa64sr71kel \ ++ | mipstx39 | mipstx39el \ ++ | mn10200 | mn10300 \ ++ | msp430 \ ++ | ns16k | ns32k \ ++ | openrisc | or32 \ ++ | pdp10 | pdp11 | pj | pjl \ ++ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ ++ | pyramid \ ++ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ ++ | sh64 | sh64le \ ++ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ ++ | strongarm \ ++ | tahoe | thumb | tic80 | tron \ ++ | v850 | v850e \ ++ | we32k \ ++ | x86 | xscale | xstormy16 | xtensa \ ++ | z8k) + basic_machine=$basic_machine-unknown + ;; +- mips64vr4100 | mips64vr4100el) # EGCS LOCAL jsmith/vr4100 +- basic_machine=$basic_machine-unknown +- ;; +- mips64vr5000 | mips64vr5000el) # EGCS LOCAL ian/vr5000 +- basic_machine=$basic_machine-unknown +- ;; +- mips16) ++ m6811 | m68hc11 | m6812 | m68hc12) ++ # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown ++ os=-none + ;; +- d10v) +- basic_machine=$basic_machine-unknown ++ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; ++ + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. +- i[34567]86) ++ i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. +@@ -207,44 +288,62 @@ + exit 1 + ;; + # Recognize the basic CPU types with company name. +- vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ +- | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ +- | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ +- | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ +- | xmp-* | ymp-* \ +- | hppa-* | hppa1.0-* | hppa1.1-* \ +- | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \ +- | alpha-* | alphaev5-* | alphaev56-* | alphapca56-* \ +- | alphaev6-* | we32k-* | cydra-* | ns16k-* | pn-* | np1-* \ +- | xps100-* | clipper-* | orion-* \ +- | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ +- | sparc64-* | sparcv9-* | sparc86x-* | mips64-* | mipsel-* \ +- | mips64el-* | mips64orion-* | mips64orionel-* \ +- | mipstx39-* | mipstx39el-* \ +- | f301-* | arm*-*) +- ;; +- m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | h8500-* | d10v-*) # EGCS LOCAL +- ;; +- thumb-*) # EGCS LOCAL angela/thumb +- ;; +- v850-*) # EGCS LOCAL +- ;; +- d30v-*) # EGCS LOCAL +- ;; +- mips64vr4300-* | mips64vr4300el-*) # EGCS LOCAL jsmith/vr4300 +- ;; +- mips64vr4100-* | mips64vr4100el-*) # EGCS LOCAL jsmith/vr4100 +- ;; +- mips16-*) # EGCS LOCAL krk/mips16 +- ;; +- tic30-*) # EGCS LOCAL ian/tic30 +- ;; +- c30-*) # EGCS LOCAL ian/tic30 +- basic_machine=tic30-unknown ++ 580-* \ ++ | a29k-* \ ++ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ ++ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ ++ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ ++ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ ++ | avr-* \ ++ | bs2000-* \ ++ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \ ++ | clipper-* | cydra-* \ ++ | d10v-* | d30v-* | dlx-* \ ++ | elxsi-* \ ++ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ ++ | h8300-* | h8500-* \ ++ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ ++ | i*86-* | i860-* | i960-* | ia64-* \ ++ | ip2k-* \ ++ | m32r-* \ ++ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ ++ | m88110-* | m88k-* | mcore-* \ ++ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ ++ | mips16-* \ ++ | mips64-* | mips64el-* \ ++ | mips64vr-* | mips64vrel-* \ ++ | mips64orion-* | mips64orionel-* \ ++ | mips64vr4100-* | mips64vr4100el-* \ ++ | mips64vr4300-* | mips64vr4300el-* \ ++ | mips64vr5000-* | mips64vr5000el-* \ ++ | mipsisa32-* | mipsisa32el-* \ ++ | mipsisa32r2-* | mipsisa32r2el-* \ ++ | mipsisa64-* | mipsisa64el-* \ ++ | mipsisa64sb1-* | mipsisa64sb1el-* \ ++ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ ++ | mipstx39-* | mipstx39el-* \ ++ | msp430-* \ ++ | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ ++ | orion-* \ ++ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ ++ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ ++ | pyramid-* \ ++ | romp-* | rs6000-* \ ++ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ ++ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ ++ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ ++ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ ++ | tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \ ++ | v850-* | v850e-* | vax-* \ ++ | we32k-* \ ++ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ ++ | xtensa-* \ ++ | ymp-* \ ++ | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. +- 386bsd) # EGCS LOCAL ++ 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; +@@ -254,11 +353,11 @@ + 3b*) + basic_machine=we32k-att + ;; +- a29khif) # EGCS LOCAL ++ a29khif) + basic_machine=a29k-amd + os=-udi + ;; +- adobe68k) # EGCS LOCAL ++ adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; +@@ -277,21 +376,21 @@ + os=-sysv + ;; + amiga | amiga-*) +- basic_machine=m68k-cbm ++ basic_machine=m68k-unknown + ;; + amigaos | amigados) +- basic_machine=m68k-cbm ++ basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) +- basic_machine=m68k-cbm ++ basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; +- apollo68bsd) # EGCS LOCAL ++ apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; +@@ -303,6 +402,10 @@ + basic_machine=ns32k-sequent + os=-dynix + ;; ++ c90) ++ basic_machine=c90-cray ++ os=-unicos ++ ;; + convex-c1) + basic_machine=c1-convex + os=-bsd +@@ -323,27 +426,30 @@ + basic_machine=c38-convex + os=-bsd + ;; +- cray | ymp) +- basic_machine=ymp-cray +- os=-unicos +- ;; +- cray2) +- basic_machine=cray2-cray +- os=-unicos +- ;; +- [ctj]90-cray) +- basic_machine=c90-cray ++ cray | j90) ++ basic_machine=j90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; ++ cris | cris-* | etrax*) ++ basic_machine=cris-axis ++ ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; ++ decsystem10* | dec10*) ++ basic_machine=pdp10-dec ++ os=-tops10 ++ ;; ++ decsystem20* | dec20*) ++ basic_machine=pdp10-dec ++ os=-tops20 ++ ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola +@@ -371,7 +477,7 @@ + encore | umax | mmax) + basic_machine=ns32k-encore + ;; +- es1800 | OSE68k | ose68k | ose | OSE) # EGCS LOCAL ++ es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; +@@ -385,6 +491,10 @@ + basic_machine=tron-gmicro + os=-sysv + ;; ++ go32) ++ basic_machine=i386-pc ++ os=-go32 ++ ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 +@@ -393,11 +503,11 @@ + basic_machine=h8300-hitachi + os=-hms + ;; +- h8300xray) # EGCS LOCAL ++ h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; +- h8500hms) # EGCS LOCAL ++ h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; +@@ -416,22 +526,6 @@ + basic_machine=m68k-hp + os=-hpux + ;; +- w89k-*) # EGCS LOCAL +- basic_machine=hppa1.1-winbond +- os=-proelf +- ;; +- op50n-*) # EGCS LOCAL +- basic_machine=hppa1.1-oki +- os=-proelf +- ;; +- op60c-*) # EGCS LOCAL +- basic_machine=hppa1.1-oki +- os=-proelf +- ;; +- hppro) # EGCS LOCAL +- basic_machine=hppa1.1-hp +- os=-proelf +- ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; +@@ -441,22 +535,21 @@ + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; +- hp9k6[0-9][0-9] | hp6[0-9][0-9] ) ++ hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; +- hp9k7[0-79][0-9] | hp7[0-79][0-9] ) ++ hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; +- hp9k78[0-9] | hp78[0-9] ) ++ hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; +- hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | \ +- hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893 ) ++ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; +- hp9k8[0-9][13679] | hp8[0-9][13679] ) ++ hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) +@@ -465,47 +558,42 @@ + hppa-next) + os=-nextstep3 + ;; +- hppaosf) # EGCS LOCAL ++ hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; ++ hppro) ++ basic_machine=hppa1.1-hp ++ os=-proelf ++ ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm +- os=-mvs + ;; + # I'm not sure what "Sysv32" means. Should this be sysv3.2? +- i[34567]86v32) ++ i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; +- i[34567]86v4*) ++ i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; +- i[34567]86v) ++ i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; +- i[34567]86sol2) ++ i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; +- i386mach) # EGCS LOCAL ++ i386mach) + basic_machine=i386-mach + os=-mach + ;; +- i386-vsta | vsta) # EGCS LOCAL ++ i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; +- i386-go32 | go32) # EGCS LOCAL +- basic_machine=i386-unknown +- os=-go32 +- ;; +- i386-mingw32 | mingw32) +- basic_machine=i386-unknown +- os=-mingw32 +- ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in +@@ -531,16 +619,16 @@ + basic_machine=ns32k-utek + os=-sysv + ;; ++ mingw32) ++ basic_machine=i386-pc ++ os=-mingw32 ++ ;; + miniframe) + basic_machine=m68000-convergent + ;; +- mipsel*-linux*) +- basic_machine=mipsel-unknown +- os=-linux-gnu +- ;; +- mips*-linux*) +- basic_machine=mips-unknown +- os=-linux-gnu ++ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) ++ basic_machine=m68k-atari ++ os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` +@@ -548,24 +636,36 @@ + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; +- monitor) # EGCS LOCAL ++ mmix*) ++ basic_machine=mmix-knuth ++ os=-mmixware ++ ;; ++ monitor) + basic_machine=m68k-rom68k + os=-coff + ;; +- msdos) # EGCS LOCAL +- basic_machine=i386-unknown ++ morphos) ++ basic_machine=powerpc-unknown ++ os=-morphos ++ ;; ++ msdos) ++ basic_machine=i386-pc + os=-msdos + ;; ++ mvs) ++ basic_machine=i370-ibm ++ os=-mvs ++ ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) +- basic_machine=i386-unknown # EGCS LOCAL ++ basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) +- basic_machine=armv4l-corel ++ basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) +@@ -580,7 +680,7 @@ + basic_machine=mips-sony + os=-newsos + ;; +- necv70) # EGCS LOCAL ++ necv70) + basic_machine=v70-nec + os=-sysv + ;; +@@ -609,18 +709,37 @@ + basic_machine=i960-intel + os=-nindy + ;; +- mon960) # EGCS LOCAL ++ mon960) + basic_machine=i960-intel + os=-mon960 + ;; ++ nonstopux) ++ basic_machine=mips-compaq ++ os=-nonstopux ++ ;; + np1) + basic_machine=np1-gould + ;; +- OSE68000 | ose68000) # EGCS LOCAL ++ nv1) ++ basic_machine=nv1-cray ++ os=-unicosmp ++ ;; ++ nsr-tandem) ++ basic_machine=nsr-tandem ++ ;; ++ op50n-* | op60c-*) ++ basic_machine=hppa1.1-oki ++ os=-proelf ++ ;; ++ or32 | or32-*) ++ basic_machine=or32-unknown ++ os=-coff ++ ;; ++ OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; +- os68k) # EGCS LOCAL ++ os68k) + basic_machine=m68k-none + os=-os68k + ;; +@@ -638,46 +757,60 @@ + pbb) + basic_machine=m68k-tti + ;; +- pc532 | pc532-*) ++ pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; +- pentium | p5 | k5 | k6 | nexen) ++ pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; +- pentiumpro | p6 | 6x86) ++ pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2) +- basic_machine=i786-pc ++ basic_machine=i686-pc + ;; +- pentium-* | p5-* | k5-* | k6-* | nexen-*) ++ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; +- pentiumpro-* | p6-* | 6x86-*) ++ pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) +- basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ++ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; +- power) basic_machine=rs6000-ibm ++ power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown +- ;; ++ ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown +- ;; ++ ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; ++ ppc64) basic_machine=powerpc64-unknown ++ ;; ++ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; ++ ppc64le | powerpc64little | ppc64-le | powerpc64-little) ++ basic_machine=powerpc64le-unknown ++ ;; ++ ppc64le-* | powerpc64little-*) ++ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + ps2) + basic_machine=i386-ibm + ;; +- rom68k) # EGCS LOCAL ++ pw32) ++ basic_machine=i586-unknown ++ os=-pw32 ++ ;; ++ rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; +@@ -687,10 +820,22 @@ + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; +- sa29200) # EGCS LOCAL ++ s390 | s390-*) ++ basic_machine=s390-ibm ++ ;; ++ s390x | s390x-*) ++ basic_machine=s390x-ibm ++ ;; ++ sa29200) + basic_machine=a29k-amd + os=-udi + ;; ++ sb1) ++ basic_machine=mipsisa64sb1-unknown ++ ;; ++ sb1el) ++ basic_machine=mipsisa64sb1el-unknown ++ ;; + sequent) + basic_machine=i386-sequent + ;; +@@ -698,7 +843,7 @@ + basic_machine=sh-hitachi + os=-hms + ;; +- sparclite-wrs) # EGCS LOCAL ++ sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; +@@ -709,10 +854,10 @@ + spur) + basic_machine=spur-unknown + ;; +- st2000) # EGCS LOCAL ++ st2000) + basic_machine=m68k-tandem + ;; +- stratus) # EGCS LOCAL ++ stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; +@@ -756,16 +901,40 @@ + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; ++ sv1) ++ basic_machine=sv1-cray ++ os=-unicos ++ ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; ++ t3e) ++ basic_machine=alphaev5-cray ++ os=-unicos ++ ;; ++ t90) ++ basic_machine=t90-cray ++ os=-unicos ++ ;; ++ tic4x | c4x*) ++ basic_machine=tic4x-unknown ++ os=-coff ++ ;; ++ tic54x | c54x*) ++ basic_machine=tic54x-unknown ++ os=-coff ++ ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; ++ toad1) ++ basic_machine=pdp10-xkl ++ os=-tops20 ++ ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; +@@ -777,7 +946,7 @@ + basic_machine=a29k-nyu + os=-sym1 + ;; +- v810 | necv810) # EGCS LOCAL ++ v810 | necv810) + basic_machine=v810-nec + os=-none + ;; +@@ -790,8 +959,8 @@ + os=-vms + ;; + vpp*|vx|vx-*) +- basic_machine=f301-fujitsu +- ;; ++ basic_machine=f301-fujitsu ++ ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks +@@ -804,18 +973,22 @@ + basic_machine=a29k-wrs + os=-vxworks + ;; +- w65*) # EGCS LOCAL +- basic_machine=w65-wdc +- os=-none ++ w65*) ++ basic_machine=w65-wdc ++ os=-none + ;; +- xmp) +- basic_machine=xmp-cray +- os=-unicos ++ w89k-*) ++ basic_machine=hppa1.1-winbond ++ os=-proelf + ;; +- xps | xps100) ++ xps | xps100) + basic_machine=xps100-honeywell + ;; +- z8k-*-coff) # EGCS LOCAL ++ ymp) ++ basic_machine=ymp-cray ++ os=-unicos ++ ;; ++ z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; +@@ -826,22 +999,15 @@ + + # Here we handle the default manufacturer of certain CPU types. It is in + # some cases the only manufacturer, in others, it is the most popular. +- w89k) # EGCS LOCAL ++ w89k) + basic_machine=hppa1.1-winbond + ;; +- op50n) # EGCS LOCAL ++ op50n) + basic_machine=hppa1.1-oki + ;; +- op60c) # EGCS LOCAL ++ op60c) + basic_machine=hppa1.1-oki + ;; +- mips) +- if [ x$os = x-linux-gnu ]; then +- basic_machine=mips-unknown +- else +- basic_machine=mips-mips +- fi +- ;; + romp) + basic_machine=romp-ibm + ;; +@@ -851,16 +1017,26 @@ + vax) + basic_machine=vax-dec + ;; ++ pdp10) ++ # there are many clones, so DEC is not a safe bet ++ basic_machine=pdp10-unknown ++ ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; +- sparc | sparcv9) ++ sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) ++ basic_machine=sh-unknown ++ ;; ++ sh64) ++ basic_machine=sh64-unknown ++ ;; ++ sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; +- cydra) ++ cydra) + basic_machine=cydra-cydrome + ;; + orion) +@@ -869,16 +1045,15 @@ + orion105) + basic_machine=clipper-highlevel + ;; +- mac | mpw | mac-mpw) # EGCS LOCAL ++ mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; +- pmac | pmac-mpw) # EGCS LOCAL ++ pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; +- c4x*) +- basic_machine=c4x-none +- os=-coff +- ;; ++ *-unknown) ++ # Make sure to match an already-canonicalized machine name. ++ ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 +@@ -935,20 +1110,38 @@ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ ++ | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ +- | -interix* | -uwin* ) ++ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ ++ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ ++ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ ++ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ ++ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ ++ | -powermax* | -dnix* | -microbsd*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; +- # EGCS LOCAL ++ -qnx*) ++ case $basic_machine in ++ x86-* | i*86-*) ++ ;; ++ *) ++ os=-nto$os ++ ;; ++ esac ++ ;; ++ -nto-qnx*) ++ ;; ++ -nto*) ++ os=`echo $os | sed -e 's|nto|nto-qnx|'` ++ ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ +- | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ +- | -macos* | -mpw* | -magic* | -mon960* | -lnews* ) ++ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ ++ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; +- # END EGCS LOCAL + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; +@@ -958,6 +1151,12 @@ + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; ++ -opened*) ++ os=-openedition ++ ;; ++ -wince*) ++ os=-wince ++ ;; + -osfrose*) + os=-osfrose + ;; +@@ -973,14 +1172,23 @@ + -acis*) + os=-aos + ;; +- -386bsd) # EGCS LOCAL ++ -atheos*) ++ os=-atheos ++ ;; ++ -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; ++ -nova*) ++ os=-rtmk-nova ++ ;; + -ns2 ) +- os=-nextstep2 ++ os=-nextstep2 ++ ;; ++ -nsk*) ++ os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) +@@ -1007,15 +1215,21 @@ + # This must come after -sysvr4. + -sysv*) + ;; +- -ose*) # EGCS LOCAL ++ -ose*) + os=-ose + ;; +- -es1800*) # EGCS LOCAL ++ -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; ++ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) ++ os=-mint ++ ;; ++ -aros*) ++ os=-aros ++ ;; + -none) + ;; + *) +@@ -1041,13 +1255,17 @@ + *-acorn) + os=-riscix1.2 + ;; +- arm*-corel) ++ arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; +- pdp11-*) ++ # This must come before the *-dec entry. ++ pdp10-*) ++ os=-tops20 ++ ;; ++ pdp11-*) + os=-none + ;; + *-dec | vax-*) +@@ -1065,15 +1283,18 @@ + # default. + # os=-sunos4 + ;; +- m68*-cisco) # EGCS LOCAL ++ m68*-cisco) + os=-aout + ;; +- mips*-cisco) # EGCS LOCAL ++ mips*-cisco) + os=-elf + ;; +- mips*-*) # EGCS LOCAL +- os=-elf +- ;; ++ mips*-*) ++ os=-elf ++ ;; ++ or32-*) ++ os=-coff ++ ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; +@@ -1086,13 +1307,13 @@ + *-ibm) + os=-aix + ;; +- *-wec) # EGCS LOCAL ++ *-wec) + os=-proelf + ;; +- *-winbond) # EGCS LOCAL ++ *-winbond) + os=-proelf + ;; +- *-oki) # EGCS LOCAL ++ *-oki) + os=-proelf + ;; + *-hp) +@@ -1137,36 +1358,39 @@ + *-next) + os=-nextstep3 + ;; +- *-gould) ++ *-gould) + os=-sysv + ;; +- *-highlevel) ++ *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; +- *-sgi) ++ *-sgi) + os=-irix + ;; +- *-siemens) ++ *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; +- f301-fujitsu) ++ f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; +- *-rom68k) # EGCS LOCAL ++ *-rom68k) + os=-coff + ;; +- *-*bug) # EGCS LOCAL ++ *-*bug) + os=-coff + ;; +- *-apple) # EGCS LOCAL ++ *-apple) + os=-macos + ;; ++ *-atari*) ++ os=-mint ++ ;; + *) + os=-none + ;; +@@ -1212,27 +1436,41 @@ + -genix*) + vendor=ns + ;; +- -mvs*) ++ -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; +- -vxsim* | -vxworks*) ++ -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; +- -hms*) # EGCS LOCAL ++ -hms*) + vendor=hitachi + ;; +- -mpw* | -macos*) # EGCS LOCAL ++ -mpw* | -macos*) + vendor=apple + ;; ++ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) ++ vendor=atari ++ ;; ++ -vos*) ++ vendor=stratus ++ ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; + esac + + echo $basic_machine$os ++exit 0 ++ ++# Local variables: ++# eval: (add-hook 'write-file-hooks 'time-stamp) ++# time-stamp-start: "timestamp='" ++# time-stamp-format: "%:y-%02m-%02d" ++# time-stamp-end: "'" ++# End: diff --git a/patches/gcc/2.95.3/deque-leak-fix.patch b/patches/gcc/2.95.3/deque-leak-fix.patch new file mode 100644 index 00000000..44d2a012 --- /dev/null +++ b/patches/gcc/2.95.3/deque-leak-fix.patch @@ -0,0 +1,31 @@ +[See also http://gcc.gnu.org/ml/libstdc++/2001-11/msg00133.html ] + +Date: Fri, 16 Nov 2001 16:06:22 -0500 +From: Phil Edwards <pedwards at disaster dot jaj dot com> +To: gcc-patches at gcc dot gnu dot org +Subject: [libstdc++ trunk & 3.0] Fix deque memory leak +Message-ID: <20011116160622.A23094@disaster.jaj.com> + + +As discussed on the libstdc++ mailing list. Tested on i686/linux. + + + +2001-11-16 Paolo Carlini <pcarlini@unitus.it> + + * include/bits/stl_deque.h (deque::erase()): Fix memory leak. + + +[rediffed against 2.95.3 -- dank] + +--- gcc-2.95.3/libstdc++/stl/stl_deque.h.old 2001-01-01 09:48:22.000000000 -0800 ++++ gcc-2.95.3/libstdc++/stl/stl_deque.h 2006-02-18 15:24:17.000000000 -0800 +@@ -1052,7 +1052,7 @@ + copy_backward(_M_start, __first, __last); + iterator __new_start = _M_start + __n; + destroy(_M_start, __new_start); +- _M_destroy_nodes(__new_start._M_node, _M_start._M_node); ++ _M_destroy_nodes(_M_start._M_node, __new_start._M_node); /* fixed per http://gcc.gnu.org/ml/libstdc++/2001-11/msg00139.html */ + _M_start = __new_start; + } + else { diff --git a/patches/gcc/2.95.3/gcc-2.95.3-cygwin-020611.patch b/patches/gcc/2.95.3/gcc-2.95.3-cygwin-020611.patch new file mode 100644 index 00000000..fb2b8da9 --- /dev/null +++ b/patches/gcc/2.95.3/gcc-2.95.3-cygwin-020611.patch @@ -0,0 +1,33 @@ +[ Building gcc-2.95.3 on cygwin yields a compiler that sticks a .exe + on the end of every executable, even if they're linux executable. + This is highly annoying, and causes glibc build failures that look like this: + mv: `.../bin/makedb.new' and `.../bin/makedb' are the same file + make[2]: *** [.../bin/makedb] Error 1 + make[2]: Leaving directory `.../gcc-2.95.3-glibc-2.1.3/glibc-2.1.3/db2' + + The mainline solves this with http://gcc.gnu.org/ml/gcc-cvs/2001-04/msg00440.html, + but that doesn't apply cleanly to gcc-2.95.3. + + So, I'm using + http://www.uclinux.org/pub/uClinux/uclinux-elf-tools/tools-20030314/gcc-2.95.3-cygwin-020611.patch + This is the only patch in crosstool that *isn't* suitable for the mainline. + I can live with this patch simply because crosstool does not build + compilers that target cygwin or VAX/VMS. + If that ever changes, I might need to try applying the real patch. +] + + + +# +# This patch can be found at http://www.uclinux.org/pub/uClinux/m68k-elf-tools/ +# +--- gcc-2.95.3/gcc/config/i386/xm-cygwin.h 1999-04-22 16:40:56.000000000 +0200 ++++ gcc-2.95.3-cygwin/gcc/config/i386/xm-cygwin.h 2002-06-11 08:23:18.000000000 +0200 +@@ -19,7 +19,6 @@ + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +-#define EXECUTABLE_SUFFIX ".exe" + #define NO_SYS_SIGLIST 1 + + /* We support both "/" and "\" since everybody tests both but we diff --git a/patches/gcc/2.95.3/gcc-2.95.3-trap-posix.patch b/patches/gcc/2.95.3/gcc-2.95.3-trap-posix.patch new file mode 100644 index 00000000..1d180552 --- /dev/null +++ b/patches/gcc/2.95.3/gcc-2.95.3-trap-posix.patch @@ -0,0 +1,44 @@ +# +# Submitted-By: Marc Kleine-Budde <mkl@pengutronix.de>, 2005-04-20 +# +# Error: +# +# creating libintl.h +# Configuring etc... +# loading cache ../config.cache +# checking for a BSD compatible install... (cached) /usr/bin/install -c +# creating ./config.status +# creating Makefile +# trap: usage: trap [-lp] [[arg] signal_spec ...] +# +# Description: +# +# non-posix conform usage of trap causes bash >= 3.0 to fail +# e.g.: http://sourceware.org/ml/crossgcc/2004-12/msg00132.html +# +# Status: +# +# fixed in gcc >= 3.3.5 +# backport of gcc-3.3.5 fix +# +diff -ruN gcc-2.95.3-orig/configure gcc-2.95.3/configure +--- gcc-2.95.3-orig/configure 1999-04-02 16:17:40.000000000 +0200 ++++ gcc-2.95.3/configure 2005-04-20 18:25:45.030488235 +0200 +@@ -687,7 +687,7 @@ + if test -f skip-this-dir; then + # Perform the same cleanup as the trap handler, minus the "exit 1" of course, + # and reset the trap handler. +- trap 0 ++ trap '' 0 + rm -f Makefile* ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos + # Execute the final clean-up actions + ${config_shell} skip-this-dir +@@ -1599,7 +1599,7 @@ + # Perform the same cleanup as the trap handler, minus the "exit 1" of course, + # and reset the trap handler. + rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos +-trap 0 ++trap '' 0 + + exit 0 + diff --git a/patches/gcc/2.95.3/gcc-pr3106.patch b/patches/gcc/2.95.3/gcc-pr3106.patch new file mode 100644 index 00000000..0e077ea3 --- /dev/null +++ b/patches/gcc/2.95.3/gcc-pr3106.patch @@ -0,0 +1,28 @@ +See http://gcc.gnu.org/PR3106 +Backported from gcc-3.0.x + +Fixes error + .../binutils-2.11.2/libiberty/strerror.c:468: error: conflicting types for `sys_nerr' + /usr/include/stdio.h:258: error: previous declaration of `sys_nerr' + make[1]: *** [strerror.o] Error 1 + make: *** [all-libiberty] Error 2 +on Mac OS X. + +--- gcc-2.95.3/libiberty/strerror.c.old 2004-03-24 16:23:19.000000000 -0800 ++++ gcc-2.95.3/libiberty/strerror.c 2004-03-24 16:23:48.000000000 -0800 +@@ -13,6 +13,7 @@ + incompatible with our later declaration, perhaps by using const + attributes. So we hide the declaration in errno.h (if any) using a + macro. */ ++#define sys_nerr sys_nerr__ + #define sys_errlist sys_errlist__ + #endif + +@@ -20,6 +21,7 @@ + #include <errno.h> + + #ifdef HAVE_SYS_ERRLIST ++#undef sys_nerr + #undef sys_errlist + #endif + diff --git a/patches/gcc/2.95.3/threads_snafu.patch b/patches/gcc/2.95.3/threads_snafu.patch new file mode 100644 index 00000000..2c5297ef --- /dev/null +++ b/patches/gcc/2.95.3/threads_snafu.patch @@ -0,0 +1,28 @@ +This fixes the error + +In file included from gthr-default.h:1, + from /build/arm-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/gcc-2.95.3/gcc/gthr.h:98, + from /build/arm-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/gcc-2.95.3/gcc/libgcc2.c:3034: +/build/arm-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/gcc-2.95.3/gcc/gthr-posix.h:37: pthread.h: No such file or directory +make[3]: *** [libgcc2.a] Error 1 +make[3]: Leaving directory `/build/arm-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/build-gcc-core/gcc' + +in what I think is a nicer way than the patch used by the arm team, +i.e. "perl -pi -e 's/^(TARGET_LIBGCC2_CFLAGS.*)/$1 -Dinhibit_libc -D__gthr_posix_h/' gcc/config/arm/t-linux" +which seems a bit of a kludge. + +--- gcc-2.95.3/gcc/configure.old Fri Mar 16 06:13:48 2001 ++++ gcc-2.95.3/gcc/configure Sun Jun 8 13:02:20 2003 +@@ -853,9 +853,9 @@ + # Check whether --enable-threads or --disable-threads was given. + if test "${enable_threads+set}" = set; then + enableval="$enable_threads" +- if test x$enable_threads = xno; then +- enable_threads='' +-fi ++ #if test x$enable_threads = xno; then ++ #enable_threads='' ++ #fi + else + enable_threads='' + fi diff --git a/patches/gcc/3.2.3/README-mips b/patches/gcc/3.2.3/README-mips new file mode 100644 index 00000000..170b21d9 --- /dev/null +++ b/patches/gcc/3.2.3/README-mips @@ -0,0 +1,1648 @@ +See also http://www.spinics.net/lists/mips/msg12236.html + +ftp://ftp.linux-mips.org/pub/linux/mips/redhat/7.3/test/SRPMS/gcc-3.2-7.1.src.rpm +contains the following patches and spec file. +You may wish to investigate some of these patches; I haven't. +I think this is mostly the Red Hat 8.0 srpm for a prerelease gcc-3.2, plus a couple +mips specific fixes, but you'd have to ask H.J.Lu or compare with the regular +Red Hat 8.0 srpm to find out. +In any case, the spec file is interesting reading. +- Dan K. + +total 1164 + 4 boehm-gc-LINUX.patch + 4 boehm-gc-mips.patch + 4 contrib-touch.patch + 8 gcc-arch.patch + 4 gcc-c++-template.patch + 4 gcc-copy.patch + 4 gcc-cross-bfd.patch + 4 gcc-cross.patch + 4 gcc-gcj-cross.patch + 4 gcc-libffi-mips.patch + 4 gcc-libgcc.patch + 480 gcc-libstdc++-glibc-2.2.patch + 4 gcc-libstdc++-mips.patch + 4 gcc-linux-atexit.patch + 8 gcc-linux-crt.patch + 4 gcc-mips-coff.patch + 4 gcc-mips-file.patch + 4 gcc-mips-ieee.patch + 4 gcc-mips-return.patch + 4 gcc-ppc-linux.patch + 8 gcc-sizeof.patch + 4 gcc-test-atexit.patch + 4 gcc-testsuite-c++.patch + 4 gcc-var.patch + 8 gcc32-2.96-RH-compat.patch + 4 gcc32-ada-addr2line.patch + 8 gcc32-ada-link.patch + 12 gcc32-attr-visibility.patch + 4 gcc32-attr-visibility2.patch + 4 gcc32-attr-visibility3.patch + 4 gcc32-attr-visibility4.patch + 4 gcc32-attr-visibility5.patch + 8 gcc32-boehm-gc-libs.patch + 4 gcc32-bogus-inline.patch + 4 gcc32-c++-nrv-test.patch + 4 gcc32-c++-pretty_function.patch + 16 gcc32-c++-tail-pad-backout.patch + 4 gcc32-c++-tsubst-asm.patch + 4 gcc32-cfg-eh.patch + 4 gcc32-debug-pr7241.patch + 4 gcc32-doc-gcov.patch + 4 gcc32-duplicate-decl.patch + 4 gcc32-dwarf2-pr6381.patch + 4 gcc32-dwarf2-pr6436-test.patch + 4 gcc32-fde-merge-compat.patch + 4 gcc32-fold-const-associate.patch + 4 gcc32-fold-const2.patch + 24 gcc32-hard-reg-sharing.patch + 4 gcc32-hard-reg-sharing2.patch + 4 gcc32-i386-default-momit-leaf-frame-pointer.patch + 4 gcc32-i386-memtest-test.patch + 4 gcc32-i386-no-default-momit-leaf-frame-pointer.patch + 4 gcc32-i386-pic-label-thunk.patch + 4 gcc32-i386-pr7242.patch + 4 gcc32-i386-profile-olfp.patch + 4 gcc32-inline-label.patch + 4 gcc32-interface_only.patch + 4 gcc32-java-no-rpath.patch + 20 gcc32-libstdc++-glibc23-1.patch + 4 gcc32-libstdc++-glibc23-2.patch + 4 gcc32-libstdc++-glibc23-3.patch + 4 gcc32-libstdc++-glibc23-4.patch + 4 gcc32-loop-prefetch.patch + 4 gcc32-pr6842.patch + 8 gcc32-rh69989.patch + 40 gcc32-s390-java.patch + 4 gcc32-sparc-sll1.patch + 4 gcc32-test-rh65771.patch + 8 gcc32-test-rotate.patch + 12 gcc32-tls-dwarf2.patch + 140 gcc32-tls.patch + 4 gcc32-tls2.patch + 4 gcc32-tls3.patch + 4 gcc32-tls4.patch + 4 gcc32-tls5.patch + 24 gcc32-tree-code.patch + 4 gcc32-trunc_int_for_mode.patch + 4 gcc32-typeof-asm.patch + 4 gcc32-x86_64-libiberty-pic.patch + 4 gcc32-x86_64-pr7559.patch + 4 gcc32-x86_64-q_regs_operand.patch + 4 gcc32-x86_64-rip-lowercase.patch + 4 libjava-cross.patch + 4 libtool-libs.patch + 4 libtool-mips.patch + +---------- gcc32.spec --------- + +%if %{_arch} != %{_build_arch} +%define cross_compile 1 +%else +%define cross_compile 0 +%endif +%{?_with_crosscompile: %{expand: %%define cross_compile 1}} + +%if %{cross_compile} +%define make_check 0 +%else +%define make_check 1 +%endif +%{?_without_check: %{expand: %%define make_check 0}} +%{?_with_check: %{expand: %%define make_check 1}} + +%define default 0 +%{?_with_default: %{expand: %%define default 1}} + +%define gcconly 0 +%{?_with_gcconly: %{expand: %%define gcconly 1}} + +%define DATE 20020903 +%define gcc_version 3.2 +%define gcc_release 7.1 +%ifarch %{ix86} alpha ia64 ppc +%define build_ada 1 +%else +%define build_ada 0 +%endif +%{?_without_ada: %{expand: %%define build_ada 0}} +%if %{cross_compile} +%define build_ada 0 +%endif +Summary: Various compilers (C, C++, Objective-C, Java, ...) +%if !%{gcconly} +Name: gcc +Version: 3.2 +Release: %{gcc_release} +%else +Name: gcc-%{gcc_version} +Version: %{gcc_release} +Release: 1 +%endif +Copyright: GPL +Group: Development/Languages +Source0: gcc-%{version}-%{DATE}.tar.bz2 +URL: http://gcc.gnu.org +BuildRoot: %{_tmppath}/%{name}-%{version}-root +BuildRequires: binutils >= 2.12.90.0.9-1 +BuildRequires: zlib-devel, gettext, dejagnu +# Make sure pthread.h doesn't contain __thread tokens +BuildRequires: glibc-devel >= 2.2.5-36.2 +%if %{build_ada} +# Ada requires Ada to build +BuildRequires: gcc-gnat >= 3.1, libgnat >= 3.1 +%endif +Requires: cpp = %{version}-%{release} +# Need .eh_frame ld optimizations +# Need proper visibility support +Requires: binutils >= 2.12.90.0.7-1 +# Make sure gdb will understand DW_FORM_strp +Conflicts: gdb < 5.1-2 +Requires: glibc-devel >= 2.2.5-36.2 +Requires: libgcc >= %{version}-%{release} +%if !%{gcconly} +Obsoletes: gcc3 +%endif +Prereq: /sbin/install-info + +Patch1: gcc32-2.96-RH-compat.patch +Patch2: gcc32-boehm-gc-libs.patch +Patch3: gcc32-bogus-inline.patch +Patch6: gcc32-fde-merge-compat.patch +Patch7: gcc32-attr-visibility.patch +Patch8: gcc32-attr-visibility2.patch +Patch9: gcc32-duplicate-decl.patch +Patch10: gcc32-trunc_int_for_mode.patch +Patch11: gcc32-sparc-sll1.patch +Patch12: gcc32-x86_64-q_regs_operand.patch +Patch13: gcc32-dwarf2-pr6381.patch +Patch14: gcc32-dwarf2-pr6436-test.patch +Patch15: gcc32-c++-pretty_function.patch +Patch16: gcc32-c++-tsubst-asm.patch +Patch18: gcc32-i386-memtest-test.patch +Patch19: gcc32-fold-const2.patch +Patch21: gcc32-ada-addr2line.patch +Patch22: gcc32-ada-link.patch +Patch23: gcc32-java-no-rpath.patch +Patch25: gcc32-s390-java.patch +Patch26: gcc32-test-rotate.patch +Patch27: gcc32-x86_64-libiberty-pic.patch +Patch29: gcc32-test-rh65771.patch +Patch30: gcc32-i386-default-momit-leaf-frame-pointer.patch +Patch31: gcc32-i386-pic-label-thunk.patch +Patch34: gcc32-pr6842.patch +Patch35: gcc32-tls.patch +Patch36: gcc32-i386-profile-olfp.patch +Patch37: gcc32-tree-code.patch +Patch38: gcc32-hard-reg-sharing.patch +Patch39: gcc32-hard-reg-sharing2.patch +Patch40: gcc32-c++-nrv-test.patch +Patch41: gcc32-debug-pr7241.patch +Patch42: gcc32-i386-pr7242.patch +Patch43: gcc32-cfg-eh.patch +Patch44: gcc32-attr-visibility3.patch +Patch45: gcc32-tls2.patch +Patch46: gcc32-fold-const-associate.patch +Patch47: gcc32-inline-label.patch +Patch48: gcc32-typeof-asm.patch +Patch50: gcc32-rh69989.patch +Patch51: gcc32-tls3.patch +Patch52: gcc32-tls4.patch +Patch54: gcc32-tls5.patch +Patch55: gcc32-tls-dwarf2.patch +Patch56: gcc32-x86_64-pr7559.patch +Patch57: gcc32-loop-prefetch.patch +Patch58: gcc32-doc-gcov.patch +Patch59: gcc32-attr-visibility4.patch +Patch60: gcc32-c++-tail-pad-backout.patch +Patch61: gcc32-attr-visibility5.patch +Patch62: gcc32-i386-no-default-momit-leaf-frame-pointer.patch +Patch64: gcc32-x86_64-rip-lowercase.patch +Patch65: gcc32-libstdc++-glibc23-1.patch +Patch66: gcc32-libstdc++-glibc23-2.patch +Patch67: gcc32-libstdc++-glibc23-3.patch +Patch68: gcc32-libstdc++-glibc23-4.patch +Patch69: gcc32-interface_only.patch + +%define _gnu %{nil} + +Patch10000: boehm-gc-mips.patch +Patch10001: boehm-gc-LINUX.patch +Patch10002: gcc-libffi-mips.patch + +Patch11000: gcc-mips-coff.patch +Patch11001: gcc-mips-file.patch +Patch11002: gcc-mips-ieee.patch +Patch11003: gcc-mips-return.patch +Patch11004: gcc-libstdc++-mips.patch +Patch11005: libtool-mips.patch + +Patch12000: gcc-libgcc.patch + +Patch13000: gcc-ppc-linux.patch +Patch13001: gcc-linux-crt.patch + +Patch14000: gcc-linux-atexit.patch +Patch14001: gcc-test-atexit.patch + +Patch15000: gcc-var.patch +Patch15001: gcc-copy.patch + +Patch16000: gcc-c++-template.patch +Patch16001: gcc-testsuite-c++.patch + +Patch17000: gcc-cross.patch +Patch17001: gcc-cross-bfd.patch +Patch17002: gcc-sizeof.patch +Patch17003: gcc-arch.patch + +Patch18000: libjava-cross.patch +Patch18001: gcc-gcj-cross.patch + +Patch19000: contrib-touch.patch + +Patch20000: libtool-libs.patch + +Patch21000: gcc-libstdc++-glibc-2.2.patch + +%description +The gcc package contains the GNU Compiler Collection version 3.2. +You'll need this package in order to compile C code. + +%package -n libgcc +Summary: GCC version 3.2 shared support library +Group: System Environment/Libraries + +%description -n libgcc +This package contains GCC shared support library which is needed +e.g. for exception handling support. + +%package c++ +Summary: C++ support for GCC +Group: Development/Languages +Requires: gcc = %{version}-%{release} +Requires: libstdc++ = %{version} +Requires: libstdc++-devel = %{version} +Obsoletes: gcc3-c++ + +%description c++ +This package adds C++ support to the GNU Compiler Collection. +It includes support for most of the current C++ specification, +including templates and exception handling. + +%package -n libstdc++ +Summary: GNU Standard C++ Library +Group: System Environment/Libraries +Obsoletes: libstdc++3 + +%description -n libstdc++ +The libstdc++ package contains a rewritten standard compliant GCC Standard +C++ Library. + +%package -n libstdc++-devel +Summary: Header files and libraries for C++ development +Group: Development/Libraries +Requires: libstdc++ = %{version}-%{release} +Obsoletes: libstdc++3-devel + +%description -n libstdc++-devel +This is the GNU implementation of the standard C++ libraries. This +package includes the header files and libraries needed for C++ +development. This includes rewritten implementation of STL. + +%package objc +Summary: Objective-C support for GCC +Group: Development/Languages +Requires: gcc = %{version}-%{release} +Requires: libobjc = %{version}-%{release} +Obsoletes: gcc3-objc + +%description objc +gcc-objc provides Objective-C support for the GCC. +Mainly used on systems running NeXTSTEP, Objective-C is an +object-oriented derivative of the C language. + +%package -n libobjc +Summary: Objective-C runtime +Group: System Environment/Libraries + +%description -n libobjc +This package contains Objective-C shared library which is needed to run +Objective-C dynamically linked programs. + +%package g77 +Summary: Fortran 77 support +Group: Development/Languages +Requires: gcc = %{version}-%{release} +Requires: libf2c = %{version}-%{release} +Prereq: /sbin/install-info +Obsoletes: gcc3-g77 + +%description g77 +The gcc-g77 package provides support for compiling Fortran 77 +programs with the GNU Compiler Collection. + +%package -n libf2c +Summary: Fortran 77 runtime +Group: System Environment/Libraries + +%description -n libf2c +This package contains Fortran 77 shared library which is needed to run +Fortran 77 dynamically linked programs. + +%package java +Summary: Java support for GCC +Group: Development/Languages +Requires: gcc = %{version}-%{release} +Requires: libgcj >= %{version}, libgcj-devel >= %{version} +Obsoletes: gcc3-java +Prereq: /sbin/install-info + +%description java +This package adds support for compiling Java(tm) programs and +bytecode into native code. + +%package -n libgcj +Summary: Java runtime library for gcc +Group: System Environment/Libraries +Requires: zip >= 2.1 +Obsoletes: gcc-libgcj +Obsoletes: libgcj3 +# Kaffe includes jar too +Conflicts: kaffe + +%description -n libgcj +The Java(tm) runtime library. You will need this package to run your Java +programs compiled using the Java compiler from GNU Compiler Collection (gcj). + +%package -n libgcj-devel +Summary: Libraries for Java development using GCC +Group: Development/Languages +Requires: zip >= 2.1, libgcj = %{version} +Obsoletes: libgcj3-devel + +%description -n libgcj-devel +The Java(tm) static libraries and C header files. You will need this +package to compile your Java programs using the GCC Java compiler (gcj). + +%package -n cpp +Summary: The C Preprocessor. +Group: Development/Languages +Prereq: /sbin/install-info +%ifarch ia64 +Obsoletes: gnupro +%endif + +%description -n cpp +Cpp is the GNU C-Compatible Compiler Preprocessor. +Cpp is a macro processor which is used automatically +by the C compiler to transform your program before actual +compilation. It is called a macro processor because it allows +you to define macros, abbreviations for longer +constructs. + +The C preprocessor provides four separate functionalities: the +inclusion of header files (files of declarations that can be +substituted into your program); macro expansion (you can define macros, +and the C preprocessor will replace the macros with their definitions +throughout the program); conditional compilation (using special +preprocessing directives, you can include or exclude parts of the +program according to various conditions); and line control (if you use +a program to combine or rearrange source files into an intermediate +file which is then compiled, you can use line control to inform the +compiler about where each source line originated). + +You should install this package if you are a C programmer and you use +macros. + +%package gnat +Summary: Ada 95 support for GCC +Group: Development/Languages +Requires: gcc = %{version}-%{release}, libgnat = %{version}-%{release} +Obsoletes: gnat-devel, gcc3-gnat +Prereq: /sbin/install-info + +%description gnat +GNAT is a GNU Ada 95 front-end to GCC. This package includes development tools, +the documents and Ada 95 compiler. + +%package -n libgnat +Summary: GNU Ada 95 runtime shared libraries +Group: System Environment/Libraries +Obsoletes: gnat libgnat3 + +%description -n libgnat +GNAT is a GNU Ada 95 front-end to GCC. This package includes shared libraries, +which are required to run programs compiled with the GNAT. + +%prep +%setup -q -n gcc-%{version}-%{DATE} +%patch1 -p0 -b .2.96-RH-compat~ +%patch2 -p0 -b .boehm-gc-libs~ +%patch3 -p0 -b .bogus-inline~ +%patch6 -p0 -b .fde-merge-compat~ +%patch7 -p0 -b .attr-visibility~ +%patch8 -p0 -b .attr-visibility2~ +%patch9 -p0 -b .duplicate-decl~ +%patch10 -p0 -b .trunc_int_for_mode~ +%patch11 -p0 -b .sparc-sll1~ +%patch12 -p0 -b .x86_64-q_regs_operand~ +%patch13 -p0 -b .dwarf2-pr6381~ +%patch14 -p0 -b .dwarf2-pr6436-test~ +%patch15 -p0 -b .c++-pretty_function~ +%patch16 -p0 -b .c++-tsubst-asm~ +%patch18 -p0 -b .i386-memtest-test~ +%patch19 -p0 -b .fold-const2~ +%patch21 -p0 -b .ada-addr2line~ +%patch22 -p0 -b .ada-link~ +%patch23 -p0 -b .java-no-rpath~ +%patch25 -p0 -b .s390-java~ +%patch26 -p0 -b .test-rotate~ +%patch27 -p0 -b .x86_64-libiberty-pic~ +%patch29 -p0 -b .test-rh65771~ +%patch30 -p0 -b .i386-default-momit-leaf-frame-pointer~ +%patch31 -p0 -b .i386-pic-label-thunk~ +%patch34 -p0 -b .pr6842~ +%patch35 -p0 -b .tls~ +%patch36 -p0 -b .i386-profile-olfp~ +%patch37 -p0 -b .tree-code~ +%patch38 -p0 -b .hard-reg-sharing~ +%patch39 -p0 -b .hard-reg-sharing2~ +%patch40 -p0 -b .c++-nrv-test~ +%patch41 -p0 -b .debug-pr7241~ +%patch42 -p0 -b .i386-pr7242~ +%patch43 -p0 -b .cfg-eh~ +%patch44 -p0 -b .attr-visibility3~ +%patch45 -p0 -b .tls2~ +%patch46 -p0 -b .fold-const-associate~ +%patch47 -p0 -b .inline-label~ +%patch48 -p0 -b .typeof-asm~ +%patch50 -p0 -b .rh69989~ +%patch51 -p0 -b .tls3~ +%patch52 -p0 -b .tls4~ +%patch54 -p0 -b .tls5~ +%patch55 -p0 -b .tls-dwarf2~ +%patch56 -p0 -b .x86_64-pr7559~ +%patch57 -p0 -b .loop-prefetch~ +%patch58 -p0 -b .doc-gcov~ +%patch59 -p0 -b .attr-visibility4~ +%patch60 -p0 -b .c++-tail-pad-backout~ +%patch61 -p0 -b .attr-visibility5~ +%patch62 -p0 -b .i386-no-default-momit-leaf-frame-pointer~ +%patch64 -p0 -b .x86_64-rip-lowercase~ +%patch65 -p0 -b .libstdc++-glibc23-1~ +%patch66 -p0 -b .libstdc++-glibc23-2~ +%patch67 -p0 -b .libstdc++-glibc23-3~ +%patch68 -p0 -b .libstdc++-glibc23-4~ +%patch69 -p0 -b .interface_only + +%patch10000 -p0 -b .mips +%patch10001 -p0 -b .LINUX +%patch10002 -p0 -b .mips +pushd boehm-gc +autoconf +popd +pushd libffi +autoconf +# Ignore the error from automake +automake --cygnus Makefile || : +popd + +%patch11000 -p0 -b .coff +%patch11001 -p0 -b .file +%patch11002 -p0 -b .ieee +%patch11003 -p0 -b .return +%patch11004 -p0 -b .mips +%patch11005 -p1 -b .mips + +%patch12000 -p0 -b .libgcc + +%patch13000 -p0 -b .ppc +%patch13001 -p0 -b .crt + +%patch14000 -p0 -b .order +%patch14001 -p0 -b .order + +%patch15000 -p0 -b .var +%patch15001 -p0 -b .copy + +%patch16000 -p0 -b .template +%patch16001 -p0 -b .template + +%patch17000 -p1 -b .cross +%patch17001 -p0 -b .cross-bfd +%patch17002 -p1 -b .sizeof +%patch17003 -p0 -b .arch +pushd gcc +autoheader +autoconf +popd +pushd fastjar +aclocal +autoconf +popd +pushd libffi +aclocal +autoconf +popd + +%patch18000 -p0 -b .cross +%patch18001 -p0 -b .build +pushd libjava +autoconf +automake --foreign Makefile +popd + +%patch19000 -p0 -b .touch + +%patch20000 -p0 -b .libs + +%patch21000 -p0 -b .glibc-2.2 +pushd libstdc++-v3 +autoconf +popd + +perl -pi -e 's/3\.2\.1/3.2/' gcc/version.c gcc/f/version.c gcc/ada/gnatvsn.ads +perl -pi -e 's/"%{gcc_version}"/"%{gcc_version} \(release\)"/' gcc/version.c +perl -pi -e 's/\((prerelease|experimental|release)\)/\(Red Hat Linux 8.0 %{version}-%{gcc_release}\)/' gcc/version.c gcc/f/version.c +perl -pi -e 's/\((prerelease|experimental|release)\)/\(%{version}-%{gcc_release}\)/' gcc/ada/gnatvsn.ads +perl -pi -e 's/#define GCCBUGURL.*$/#define GCCBUGURL "<URL:http:\/\/bugzilla.redhat.com\/bugzilla\/>"/' gcc/system.h +# The version string is now longer than 32 bytes and the line containing it +# doesn't fit into 80 columns +#perl -pi -e 's/:= 32/:= 64/;s/(Gnat_Version_String.*:=)/\1\n /' gcc/ada/gnatvsn.ads + +./contrib/gcc_update --touch + +%build +rm -fr obj-%{_target_platform} +mkdir obj-%{_target_platform} +cd obj-%{_target_platform} + +%if %{_arch} != %{_build_arch} +%ifos linux +export ac_cv_func_mmap_anywhere=yes +export ac_cv_func_mmap_file=yes +export ac_cv_func_mmap_fixed_mapped=yes +export ac_cv_func_strncmp_works=yes +export gcc_cv_func_printf_ptr=yes +%endif +%endif + +DEFAULT_FLAGS= +%if %{default} +%ifarch %{ix86} +TARGET_CPU="%{_target_cpu}" +DEFAULT_FLAGS="--with-arch=$TARGET_CPU --with-cpu=$TARGET_CPU" +%endif +%endif + +CC=%{__cc} +OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g'` +CC="$CC" CFLAGS="$OPT_FLAGS" CXXFLAGS="$OPT_FLAGS" XCFLAGS="$OPT_FLAGS" TCFLAGS="$OPT_FLAGS" \ + ../configure --prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir} \ + --enable-shared --enable-threads=posix --disable-checking --host=%{_target_platform} \ + $DEFAULT_FLAGS \ +%if %{cross_compile} + --target=%{_target_platform} --build=%{_build_alias} \ +%endif + --with-system-zlib --enable-__cxa_atexit + +# We have to make sure all gcc configure files are up to date for +# parallel build. We have to do it twice due to the stupid Makefile. +make -C gcc cstamp-h +make -C gcc cstamp-h + +# if RPM_BUILD_NCPUS unset, set it +if [ -z "$RPM_BUILD_NCPUS" ] ; then + if [ -x /usr/bin/getconf ] ; then + RPM_BUILD_NCPUS=$(/usr/bin/getconf _NPROCESSORS_ONLN) + if [ $RPM_BUILD_NCPUS -eq 0 ]; then + RPM_BUILD_NCPUS=1 + fi + else + RPM_BUILD_NCPUS=1 + fi +fi + +RPM_BUILD_NCPUS=`expr $RPM_BUILD_NCPUS + $RPM_BUILD_NCPUS` + +cat <<EOF > makefile +MAKE=make -j $RPM_BUILD_NCPUS +include Makefile +CFLAGS:=\$(CFLAGS) -pipe +CXXFLAGS:=\$(CXXFLAGS) -pipe +EOF + +# FIXME: It is a kludge. +export GCJFLAGS="$OPT_FLAGS" + +%if %{cross_compile} +make -j$RPM_BUILD_NCPUS \ + CC=%{__cc} \ + CXX=%{__cxx} \ + AR=%{__ar} \ + AS=%{__as} \ + LD=%{__ld} \ + NM=%{__nm} \ + RANLIB=%{__ranlib} \ + CC_FOR_TARGET=%{__cc} \ + GCC_FOR_TARGET=%{__cc} \ + CXX_FOR_TARGET=%{__cxx} \ + AR_FOR_TARGET=%{__ar} \ + AS_FOR_TARGET=%{__as} \ + LD_FOR_TARGET=%{__ld} \ + NM_FOR_TARGET=%{__nm} \ + RANLIB_FOR_TARGET=%{__ranlib} \ + HOST_CC=cc \ + CFLAGS_FOR_TARGET="$RPM_OPT_FLAGS -pipe" \ + CFLAGS_FOR_BUILD="-O -pipe" \ + CFLAGS="$RPM_OPT_FLAGS -pipe" \ + CXXFLAGS="$RPM_OPT_FLAGS -pipe" +%else +make -j$RPM_BUILD_NCPUS bootstrap-lean +#make -j$RPM_BUILD_NCPUS bootstrap +%endif + +%if %{build_ada} +# This doesn't work with -j$RPM_BUILD_NCPUS +make -C gcc gnatlib-shared +make -C gcc gnattools +make -C gcc/ada doc +%endif + +%if %{make_check} +# run the tests. +make -j$RPM_BUILD_NCPUS -k check || : +%ifarch %{ix86} +ln -sf i686-pc-linux-gnu ../libstdc++-v3/config/abi/%{_target_platform} +ln -sf i686-pc-linux-gnu ../libstdc++-v3/config/abi/%{_target_platform}-gnu +%endif +echo ====================TESTING========================= +( ../contrib/test_summary || : ) 2>&1 | sed -n '/^cat.*EOF/,/^EOF/{/^cat.*EOF/d;/^EOF/d;/^LAST_UPDATED:/d;p;}' +%ifarch %{ix86} +make -C %{_target_platform}/libstdc++-v3 check-abi +%endif +echo ====================TESTING END===================== +#cd %{_target_platform}/libstdc++-v3 +#./mkcheck 0 +#cd ../.. +%endif + +%if !%{cross_compile} +# Make protoize +make -C gcc CC="./xgcc -B ./ -O2" proto +%endif + +# Make generated man pages even if Pod::Man is not new enough +perl -pi -e 's/head3/head2/' ../contrib/texi2pod.pl +for i in ../gcc/doc/*.texi; do + cp -a $i $i.orig; sed 's/ftable/table/' $i.orig > $i +done +make -C gcc generated-manpages +for i in ../gcc/doc/*.texi; do mv -f $i.orig $i; done + +# Copy various doc files here and there +cd .. +mkdir -p rpm.doc/g77 rpm.doc/objc +mkdir -p rpm.doc/boehm-gc rpm.doc/fastjar rpm.doc/libffi rpm.doc/libjava + +(cd gcc/f; for i in ChangeLog*; do + cp -p $i ../../rpm.doc/g77/$i.f +done) +(cd libf2c; for i in ChangeLog*; do + cp -p $i ../rpm.doc/g77/$i.libf2c +done) +(cd gcc/objc; for i in README*; do + cp -p $i ../../rpm.doc/objc/$i.objc +done) +(cd libobjc; for i in README*; do + cp -p $i ../rpm.doc/objc/$i.libobjc +done) +(cd boehm-gc; for i in ChangeLog*; do + cp -p $i ../rpm.doc/boehm-gc/$i.gc +done) +(cd fastjar; for i in ChangeLog* README*; do + cp -p $i ../rpm.doc/fastjar/$i.fastjar +done) +(cd libffi; for i in ChangeLog* README* LICENSE; do + cp -p $i ../rpm.doc/libffi/$i.libffi +done) +(cd libjava; for i in ChangeLog* README*; do + cp -p $i ../rpm.doc/libjava/$i.libjava +done) + +%install +rm -fr $RPM_BUILD_ROOT + +perl -pi -e \ + 's~href="l(ibstdc|atest)~href="http://gcc.gnu.org/onlinedocs/libstdc++/l\1~' \ + libstdc++-v3/docs/html/documentation.html +ln -sf documentation.html libstdc++-v3/docs/html/index.html +find libstdc++-v3/docs/html -name CVS | xargs rm -rf + +cd obj-%{_target_platform} +TARGET_PLATFORM=%{_target_platform} + +# There are some MP bugs in libstdc++ and libjava Makefiles +make -C %{_target_platform}/libstdc++-v3 +make -C %{_target_platform}/libjava + +make prefix=$RPM_BUILD_ROOT%{_prefix} mandir=$RPM_BUILD_ROOT%{_mandir} \ +%if %{cross_compile} + CC=%{__cc} \ + CXX=%{__cxx} \ + AR=%{__ar} \ + AS=%{__as} \ + LD=%{__ld} \ + NM=%{__nm} \ + RANLIB=%{__ranlib} \ + CC_FOR_TARGET=%{__cc} \ + GCC_FOR_TARGET=%{__cc} \ + CXX_FOR_TARGET=%{__cxx} \ + AR_FOR_TARGET=%{__ar} \ + AS_FOR_TARGET=%{__as} \ + LD_FOR_TARGET=%{__ld} \ + NM_FOR_TARGET=%{__nm} \ + RANLIB_FOR_TARGET=%{__ranlib} \ + HOST_CC=cc \ + CFLAGS_FOR_TARGET="$RPM_OPT_FLAGS -pipe" \ + CFLAGS_FOR_BUILD="-O -pipe" \ + CFLAGS="$RPM_OPT_FLAGS -pipe" \ + CXXFLAGS="$RPM_OPT_FLAGS -pipe" \ +%endif + infodir=$RPM_BUILD_ROOT%{_infodir} install +%if %{build_ada} +pushd gcc/ada +cp -a gnat-style.info* gnat_rm.info* $RPM_BUILD_ROOT%{_infodir}/ +for i in gnat_ug_unx.info*; do + sed 's/gnat_ug_unx/gnat_ug/g' $i > $RPM_BUILD_ROOT%{_infodir}/`echo $i | sed 's/gnat_ug_unx/gnat_ug/'` +done +chmod 644 $RPM_BUILD_ROOT%{_infodir}/gnat* +popd +%endif + +FULLPATH=$(dirname $RPM_BUILD_ROOT%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/cc1) + +file $RPM_BUILD_ROOT/%{_prefix}/bin/* | grep ELF | cut -d':' -f1 | xargs %{__strip} || : +%{__strip} $FULLPATH/{cc1,cc1obj,cc1plus,cpp0,tradcpp0,f771,jc1,jvgenmain} + +# fix some things +ln -sf gcc $RPM_BUILD_ROOT%{_prefix}/bin/cc +mkdir -p $RPM_BUILD_ROOT/lib +ln -sf ..%{_prefix}/bin/cpp $RPM_BUILD_ROOT/lib/cpp +ln -sf g77 $RPM_BUILD_ROOT%{_prefix}/bin/f77 +rm -f $RPM_BUILD_ROOT%{_infodir}/dir +gzip -9 $RPM_BUILD_ROOT%{_infodir}/*.info* +ln -sf gcc $RPM_BUILD_ROOT%{_prefix}/bin/gnatgcc + +mv $RPM_BUILD_ROOT%{_prefix}/lib/libgcj.*a $FULLPATH/ +sed 's/-lgcjgc//g;s/-lzgcj//g;s/-lpthread//g' $RPM_BUILD_ROOT%{_prefix}/lib/libgcj.spec > $FULLPATH/libgcj.spec +mv $RPM_BUILD_ROOT%{_prefix}/include/gc*.h $FULLPATH/include/ +mv $RPM_BUILD_ROOT%{_prefix}/include/j*.h $FULLPATH/include/ +mv -f $RPM_BUILD_ROOT%{_prefix}/include/{java,javax,gnu,org} $FULLPATH/include/ +mkdir -p $FULLPATH/include/gcj +mv -f $RPM_BUILD_ROOT%{_prefix}/include/gcj/* $FULLPATH/include/gcj/ +rmdir $RPM_BUILD_ROOT%{_prefix}/include/gcj + +mkdir -p $RPM_BUILD_ROOT/%{_lib} +mv -f `find $RPM_BUILD_ROOT%{_prefix}/lib -name libgcc_s.so.1` $RPM_BUILD_ROOT/%{_lib}/libgcc_s-%{gcc_version}-%{DATE}.so.1 +chmod 755 $RPM_BUILD_ROOT/%{_lib}/libgcc_s-%{gcc_version}-%{DATE}.so.1 +ln -sf libgcc_s-%{gcc_version}-%{DATE}.so.1 $RPM_BUILD_ROOT/%{_lib}/libgcc_s.so.1 +ln -sf ../../%{_lib}/libgcc_s.so.1 $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libgcc_s.so +#ln -sf `echo "%{_prefix}" | sed 's~/[^/]*~\.\./~g'`../%{_lib}/libgcc_s.so.1 \ +# $RPM_BUILD_ROOT%{_prefix}/%{_lib}/libgcc_s.so +#mv -f $FULLPATH/libobjc.so.1* $RPM_BUILD_ROOT%{_prefix}/%{_lib}/ +%if %{build_ada} +mv -f $FULLPATH/adalib/libgnarl-*.so.* $RPM_BUILD_ROOT%{_prefix}/%{_lib}/ +mv -f $FULLPATH/adalib/libgnat-*.so.* $RPM_BUILD_ROOT%{_prefix}/%{_lib}/ +rm -f $FULLPATH/adalib/libgnarl.so* $FULLPATH/adalib/libgnat.so* +%endif +pushd $FULLPATH +if [ "%{_lib}" = "lib" ]; then +ln -sf ../../../libobjc.so.1 libobjc.so +ln -sf ../../../libstdc++.so.5.* libstdc++.so +ln -sf ../../../libgcj.so.3.* libgcj.so +ln -sf ../../../libg2c.so.0.* libg2c.so +%if %{build_ada} +cd adalib +ln -sf ../../../../libgnarl-*.so.* libgnarl.so +ln -sf ../../../../libgnat-*.so.* libgnat.so +cd .. +%endif +else +ln -sf ../../../../%{_lib}/libobjc.so.1 libobjc.so +ln -sf ../../../../%{_lib}/libstdc++.so.5.* libstdc++.so +ln -sf ../../../../%{_lib}/libgcj.so.3.* libgcj.so +ln -sf ../../../../%{_lib}/libg2c.so.0.* libg2c.so +%if %{build_ada} +cd adalib +ln -sf ../../../../../%{_lib}/libgnarl-*.so.* libgnarl.so +ln -sf ../../../../../%{_lib}/libgnat-*.so.* libgnat.so +cd .. +%endif +fi +mv -f $RPM_BUILD_ROOT%{_prefix}/lib/libstdc++.*a . +mv -f $RPM_BUILD_ROOT%{_prefix}/lib/libsupc++.*a . +mv -f $RPM_BUILD_ROOT%{_prefix}/lib/libg2c.*a . +mv -f $RPM_BUILD_ROOT%{_prefix}/lib/libfrtbegin.*a . +mv -f $RPM_BUILD_ROOT%{_prefix}/lib/libobjc.*a . +# Strip debug info from Fortran/ObjC/Java static libraries +%{__strip} -g libg2c.a libobjc.a libgcj.a +# Fix up .la files +for i in *.la; do + sed -e '/^libdir/s_%{_prefix}/lib_%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}_' \ + -e '/^dependency_libs/s_%{_prefix}/lib_%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}_' \ + -e '/^dependency_libs/s~'\''$~ '\''~' \ + -e '/^dependency_libs/s~[ ][ ]*~ ~g' \ + -e '/^dependency_libs/s~-L[^ ]* ~~g' \ + -e '/^dependency_libs/s~-lgcc_s -lgcc -lc -lgcc_s -lgcc ~~g' \ + -e '/^dependency_libs/s~-lgcc -lc -lgcc ~~g' \ + -e '/^dependency_libs/s~-lc ~~g' \ + -e '/^dependency_libs/s~-lm \(-lm \)*~-lm ~g' \ + $i > $i.tmp + mv -f $i.tmp $i +done +popd +chmod 755 $RPM_BUILD_ROOT%{_prefix}/lib/libg2c.so.0.* +chmod 755 $RPM_BUILD_ROOT%{_prefix}/lib/libobjc.so.1.* +%if %{build_ada} +chmod 755 $RPM_BUILD_ROOT%{_prefix}/lib/libgnarl*so* +chmod 755 $RPM_BUILD_ROOT%{_prefix}/lib/libgnat*so* +%endif + +cat > $RPM_BUILD_ROOT%{_prefix}/bin/c89 <<"EOF" +#!/bin/sh +fl="-std=c89" +for opt; do + case "$opt" in + -ansi|-std=c89|-std=iso9899:1990) fl="";; + -std=*) echo "`basename $0` called with non ANSI/ISO C option $opt" >&2 + exit 1;; + esac +done +exec %{_prefix}/bin/gcc $fl ${1+"$@"} +EOF +cat > $RPM_BUILD_ROOT%{_prefix}/bin/c99 <<"EOF" +#!/bin/sh +fl="-std=c99" +for opt; do + case "$opt" in + -std=c99|-std=iso9899:1999) fl="";; + -std=*) echo "`basename $0` called with non ISO C99 option $opt" >&2 + exit 1;; + esac +done +exec %{_prefix}/bin/gcc $fl ${1+"$@"} +EOF +chmod 755 $RPM_BUILD_ROOT%{_prefix}/bin/c?9 + +cd .. +%find_lang %{name} + +%if %{cross_compile} +# Install syslimits.h for canadian cross compile. +pushd $RPM_BUILD_DIR/gcc-%{gcc_version}-%{DATE}/obj-%{_target_platform} +cp -af ../gcc/gsyslimits.h $FULLPATH/include/syslimits.h +# Fix the specs file. +cat gcc/specs | +awk ' +BEGIN { + cross=0; +} +/cross_compile/ { print; cross = 1; next; } +/^1$/ { + if (cross == 0) { + print; + } + else { + cross = 0; + print "0"; + } + next; +} +{ print; } +' > $FULLPATH/specs +popd +%endif + +%clean +rm -rf $RPM_BUILD_ROOT + +%post +/sbin/install-info \ + --info-dir=%{_infodir} %{_infodir}/gcc.info.gz + +%preun +if [ $1 = 0 ]; then + /sbin/install-info --delete \ + --info-dir=%{_infodir} %{_infodir}/gcc.info.gz +fi + +%post -n cpp +/sbin/install-info \ + --info-dir=%{_infodir} %{_infodir}/cpp.info.gz + +%preun -n cpp +if [ $1 = 0 ]; then + /sbin/install-info --delete \ + --info-dir=%{_infodir} %{_infodir}/cpp.info.gz +fi + +%post g77 +/sbin/install-info \ + --info-dir=%{_infodir} %{_infodir}/g77.info.gz + +%preun g77 +if [ $1 = 0 ]; then + /sbin/install-info --delete \ + --info-dir=%{_infodir} %{_infodir}/g77.info.gz +fi + +%post java +/sbin/install-info \ + --info-dir=%{_infodir} %{_infodir}/gcj.info.gz + +%preun java +if [ $1 = 0 ]; then + /sbin/install-info --delete \ + --info-dir=%{_infodir} %{_infodir}/gcj.info.gz +fi + +%post gnat +/sbin/install-info \ + --info-dir=%{_infodir} %{_infodir}/gnat_rm.info.gz +/sbin/install-info \ + --info-dir=%{_infodir} %{_infodir}/gnat_ug.info.gz + +%preun gnat +if [ $1 = 0 ]; then + /sbin/install-info --delete \ + --info-dir=%{_infodir} %{_infodir}/gnat_rm.info.gz + /sbin/install-info --delete \ + --info-dir=%{_infodir} %{_infodir}/gnat_ug.info.gz +fi + +%post -n libgcc -p /sbin/ldconfig + +%postun -n libgcc -p /sbin/ldconfig + +%post -n libstdc++ -p /sbin/ldconfig + +%postun -n libstdc++ -p /sbin/ldconfig + +%post -n libobjc -p /sbin/ldconfig + +%postun -n libobjc -p /sbin/ldconfig + +%post -n libgcj -p /sbin/ldconfig + +%postun -n libgcj -p /sbin/ldconfig + +%post -n libf2c -p /sbin/ldconfig + +%postun -n libf2c -p /sbin/ldconfig + +%post -n libgnat -p /sbin/ldconfig + +%postun -n libgnat -p /sbin/ldconfig + +%files -f %{name}.lang +%defattr(-,root,root) +%{_prefix}/bin/cc +%{_prefix}/bin/c89 +%{_prefix}/bin/c99 +%{_prefix}/bin/gcc +%{_prefix}/bin/gcov +%if !%{cross_compile} +%{_prefix}/bin/protoize +%{_prefix}/bin/unprotoize +%endif +%{_prefix}/bin/%{_target_platform}-gcc +%{_mandir}/man1/gcc.1* +%{_mandir}/man1/gcov.1* +%{_infodir}/gcc* +%dir %{_prefix}/lib/gcc-lib +%dir %{_prefix}/lib/gcc-lib/%{_target_platform} +%dir %{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version} +%dir %{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/stddef.h +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/stdarg.h +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/varargs.h +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/float.h +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/limits.h +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/stdbool.h +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/iso646.h +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/syslimits.h +%ifarch %{ix86} x86_64 +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/mmintrin.h +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/xmmintrin.h +%endif +%ifarch ia64 +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/ia64intrin.h +%endif +%ifarch ppc +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/ppc-asm.h +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/altivec.h +%endif +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/README +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/cc1 +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/collect2 +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/crt*.o +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/libgcc.a +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/libgcc_eh.a +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/specs +%{_prefix}/%{_lib}/libgcc_s.so +%doc gcc/README* gcc/*ChangeLog* + +%if !%{gcconly} +%files -n cpp +%defattr(-,root,root) +/lib/cpp +%endif +%{_prefix}/bin/cpp +%{_mandir}/man1/cpp.1* +%{_infodir}/cpp* +%dir %{_prefix}/lib/gcc-lib +%dir %{_prefix}/lib/gcc-lib/%{_target_platform} +%dir %{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version} +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/cpp0 +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/tradcpp0 + +%files -n libgcc +%defattr(-,root,root) +/%{_lib}/libgcc_s-%{gcc_version}-%{DATE}.so.1 +/%{_lib}/libgcc_s.so.1 + +%if !%{gcconly} +%files c++ +%defattr(-,root,root) +%{_prefix}/bin/%{_target_platform}-*++ +%{_prefix}/bin/g++ +%{_prefix}/bin/c++ +%{_prefix}/bin/c++filt +%{_mandir}/man1/g++.1* +%dir %{_prefix}/lib/gcc-lib +%dir %{_prefix}/lib/gcc-lib/%{_target_platform} +%dir %{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version} +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/cc1plus +%doc gcc/cp/ChangeLog* + +%files -n libstdc++ +%defattr(-,root,root) +%{_prefix}/%{_lib}/libstdc++.so.5* + +%files -n libstdc++-devel +%defattr(-,root,root) +%{_prefix}/include/c++ +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/libstdc++.so +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/libstdc++.a +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/libsupc++.a +%doc libstdc++-v3/ChangeLog* libstdc++-v3/README* libstdc++-v3/docs/html/ + +%files objc +%defattr(-,root,root) +%dir %{_prefix}/lib/gcc-lib +%dir %{_prefix}/lib/gcc-lib/%{_target_platform} +%dir %{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version} +%dir %{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/objc +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/cc1obj +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/libobjc.a +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/libobjc.so +%doc rpm.doc/objc/* +%doc libobjc/THREADS* libobjc/ChangeLog + +%files -n libobjc +%defattr(-,root,root) +%{_prefix}/%{_lib}/libobjc.so.1* + +%files g77 +%defattr(-,root,root) +%{_prefix}/bin/g77 +%{_prefix}/bin/f77 +%{_mandir}/man1/g77.1* +%{_infodir}/g77* +%dir %{_prefix}/lib/gcc-lib +%dir %{_prefix}/lib/gcc-lib/%{_target_platform} +%dir %{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version} +%dir %{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/f771 +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/libfrtbegin.a +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/libg2c.a +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/libg2c.so +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/g2c.h +%doc gcc/f/README rpm.doc/g77/* + +%files -n libf2c +%defattr(-,root,root) +%{_prefix}/%{_lib}/libg2c.so.0* + +%files java +%defattr(-,root,root) +%{_prefix}/bin/gcj +%{_prefix}/bin/gcjh +%{_prefix}/bin/jcf-dump +%{_prefix}/bin/jv-scan +%{_mandir}/man1/gcj.1* +%{_mandir}/man1/gcjh.1* +%{_mandir}/man1/jcf-dump.1* +%{_mandir}/man1/jv-scan.1* +%{_infodir}/gcj* +%dir %{_prefix}/lib/gcc-lib +%dir %{_prefix}/lib/gcc-lib/%{_target_platform} +%dir %{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version} +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/jc1 +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/jvgenmain +%doc gcc/java/ChangeLog* + +%files -n libgcj +%defattr(-,root,root) +%{_prefix}/bin/jv-convert +%{_prefix}/bin/gij +%{_prefix}/bin/jar +%{_prefix}/bin/grepjar +%{_prefix}/bin/rmic +%{_prefix}/bin/rmiregistry +%{_mandir}/man1/jv-convert.1* +%{_mandir}/man1/gij.1* +%{_mandir}/man1/rmic.1* +%{_mandir}/man1/rmiregistry.1* +%{_prefix}/%{_lib}/libgcj.so.* +%{_prefix}/share/java +%{_prefix}/lib/security + +%files -n libgcj-devel +%defattr(-,root,root) +%{_prefix}/bin/addr2name.awk +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/libgcj.a +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/libgcj.so +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/libgcj.spec +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/gc*.h +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/j*.h +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/java +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/javax +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/gnu +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/gcj +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/include/org +%doc rpm.doc/boehm-gc/* rpm.doc/fastjar/* rpm.doc/libffi/* +%doc rpm.doc/libjava/* + +%if %{build_ada} +%files gnat +%defattr(-,root,root) +%{_prefix}/bin/gnat* +%{_infodir}/gnat* +%dir %{_prefix}/lib/gcc-lib +%dir %{_prefix}/lib/gcc-lib/%{_target_platform} +%dir %{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version} +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/adainclude +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/adalib +%{_prefix}/lib/gcc-lib/%{_target_platform}/%{gcc_version}/gnat1 +%doc gcc/ada/ChangeLog + +%files -n libgnat +%defattr(-,root,root) +%{_prefix}/%{_lib}/libgnat-*.so.* +%{_prefix}/%{_lib}/libgnarl-*.so.* +%endif +%endif + +%changelog +* Tue Sep 3 2002 Bill Nottingham <notting@redhat.com> 3.2-7 +- fix calling of C++ destructors in certain cases + +* Tue Sep 3 2002 Jakub Jelinek <jakub@redhat.com> 3.2-6 +- update from CVS (but revert C++ tail padding patches + for now) +- further fixes to make libstdc++-v3 build on glibc 2.3 +- run libstdc++-v3 make check-abi on IA-32 during testing + +* Fri Aug 30 2002 Jakub Jelinek <jakub@redhat.com> 3.2-5 +- disable tail copy patches, they seem to still have problems +- make libstdc++-v3 build on glibc 2.3 (and use thread-local + locale model) +- fix c89 and c99 scripts (#73104) + +* Wed Aug 26 2002 Jakub Jelinek <jakub@redhat.com> 3.2-4 +- reorder alpha_encode_section_info checks slightly to fix an ICE + when building glibc and to take better advantage of visibility + attribute on Alpha +- as gdb is not there yet, disable -momit-leaf-frame-pointer + by default for now on IA-32 +- fix IA-64 bootstrap with tail padding patch (Jason Merrill, Daniel Berlin) +- fix x86-64 %RIP to %rip, only output (%rip) if no other relocation + is used (Richard Henderson) + +* Fri Aug 23 2002 Jakub Jelinek <jakub@redhat.com> 3.2-3 +- take advantage of __attribute__((visibility())) on Alpha +- avoid copying tail padding (Jason Merrill) + +* Thu Aug 22 2002 Jakub Jelinek <jakub@redhat.com> 3.2-2 +- fixed Dwarf2 DW_OP_GNU_push_tls_address patch from Richard Henderson +- don't mention removed -a and -ax options in the documentation + (Nathan Sidwell, #72233) +- fixed __typeof() followed by __asm() redirection from Alexandre Oliva + +* Wed Aug 14 2002 Jakub Jelinek <jakub@redhat.com> 3.2-1 +- update to 3.2 release +- fix x86-64 PR target/7559 (Jan Hubicka) +- fix -fprefetch-loop-arrays (Janis Johnson) +- fix x86-64 prefetch (Jan Hubicka) + +* Fri Aug 9 2002 Jakub Jelinek <jakub@redhat.com> 3.2-0.3 +- istream fix (Benjamin Kosnik) +- emit Dwarf2 DW_OP_GNU_push_tls_address extension for TLS (Richard Henderson) +- temporarily disable __typeof() + __asm() fix + +* Thu Aug 8 2002 Jakub Jelinek <jakub@redhat.com> 3.2-0.2 +- update from 3.2 branch + - ABI incompatible changes in libstdc++.so.5, long long bitfield + layout on IA-32 (both C and C++), oversized bitfields layout + on IA-32 and bitfields with base type with __attribute__((aligned ())) + - fix strstream segfaults (#68292, Benjamin Kosnik) +- fix __attribute__((visibility())) together with __asm__() + function redirection +- fix __typeof() followed by __asm() redirection (Alexandre Oliva) +- fix TLS ICE on glibc (#70061) +- fix K6 ICE on linux kernel (#69989, Richard Sandiford, Jan Hubicka) +- fix inlining bug with labels (#70941) +- fix fold-const bug (#70541) +- fix PR preprocessor/7358 (Neil Booth) +- error when mixing __thread and non-__thread declarations + (#70059, Aldy Hernandez) +- fix TLS bug on g++.dg/tls/diag-1.C (Jason Merrill) +- add -mcmodel= x86-64 documentation (Andreas Jaeger) +- avoid TLS emitting movl %gs:0, MEMORY on IA-32 (#71033) + +* Mon Jul 22 2002 Jakub Jelinek <jakub@redhat.com> 3.2-0.1 +- first attempt for gcc 3.2 +- remove .la files + +* Sat Jul 20 2002 Jakub Jelinek <jakub@redhat.com> 3.1-10 +- update from 3.1 branch + - add throw() to set_new_handler (Andreas Schwab) + - fixed PR optimization/7147, optimization/7153 +- make sure pic register is set up even when the only @PLT calls + are done in EH basic blocks (Richard Henderson) + +* Sun Jul 14 2002 Jakub Jelinek <jakub@redhat.com> 3.1-9 +- define %%_gnu to nothing for compatibility + +* Sat Jul 13 2002 Jakub Jelinek <jakub@redhat.com> 3.1-8 +- update from 3.1 branch + - fix OpenOffice miscompilation (PR c++/7279, Jason Merrill) + - PRs c++/7224, c++/6255, optimization/7145, c++/6706, preprocessor/7070, + middle-end/6963, target/6841, target/6770, target/6719, + other/6836, libstdc++/7057, libstdc++/7097, libstdc++/3946, + libstdc++/7173 + - fix a GC bug with named labels in C++ (Jim Wilson) + - fix ICE on Mesa (Bernd Schmidt, #65771) +- added some NRV tests +- fix typo in i386 specs (PR c/7242) +- fix IA-32 ICE with shifts by negative values followed by compare + (PR middle-end/7245, #68395) +- fixed DWARF-2 output for const char * (PR debug/7241) +- actually enable __cxa_atexit for standard compliance at configury time +- added PPC as Ada enabled architecture + +* Wed Jun 19 2002 Jakub Jelinek <jakub@redhat.com> 3.1-7 +- update from 3.1 branch + - PRs target/6922, opt/6722, c/7030, c/6677, objc/6834, c++/6892, + c++/6723, opt/6793 +- use __cxa_atexit for standard compliance: + if your C++ project knows it won't call atexit from within its + static constructors, use -fno-use-cxa-atexit to optimize it +- share hard register rtxs where possible to speed the compiler up (Jeff Law) +- optimize tree_code_* arrays (Kaveh Ghazi) +- don't link prefix.o into libgnat, link libgnat against libgcc_s and + libgnarl against libgnat +- fix typo in GNAT %%post (#66847, #66941, #66639) +- add TLS support + +* Fri Jun 7 2002 Jakub Jelinek <jakub@redhat.com> 3.1-6 +- add GNAT +- remove DT_RPATH from Java binaries (#66103) +- obsolete kaffe, install jar as %{_prefix}/bin/jar +- add include/org directory in java +- add rmic and rmiregistry programs to libgcj +- add info documentation for gcj and various man pages +- add message catalogues for da, el, es, fr, ja, nl, sv, tr +- don't put IA-64 vtables with relocations into read-only sections + with -fpic + +* Tue Jun 4 2002 Jakub Jelinek <jakub@redhat.com> 3.1-5 +- update from 3.1 branch + - PRs optimization/6822, preprocessor/6844, target/6838, target/6788, + libstdc++/6886, libstdc++/6795, libstdc++/6811 +- m$ compatibility for unnamed fields as typedef of struct/union + (PR c/6660) +- fix -fverbose-asm with unnamed fields (PR c/6809) +- fix -mmmx ICE (PR optimization/6842) +- default to -momit-leaf-frame-pointer on i386 (Richard Henderson) +- use linkonce section/hidden symbol for i686 pic getpc thunks + (Richard Henderson) + +* Tue May 28 2002 Jakub Jelinek <jakub@redhat.com> 3.1-4 +- rebuilt + +* Sat May 25 2002 Jakub Jelinek <jakub@redhat.com> 3.1-3 +- update from 3.1 branch + - PRs other/6782, preprocessor/6780, preprocessor/6517, + libstdc++/6282, libstdc++/6701, libstdc++/6701 + - fix out << "" bug (Ben Kosnik, #65409, PR libstdc++/6750) +- 3 new patches + - fix C++ __PRETTY_FUNCTION__ (PR c++/6794) + - fix ICE on jikes (#65379) + - add test for fixed mozilla miscompilation +- include intrinsic headers on IA-32/x86-64, include altivec.h on PPC + +* Wed May 22 2002 Jakub Jelinek <jakub@redhat.com> 3.1-2 +- update from 3.1 branch +- 8 new patches + - fix as version test for 2.12.1 and newer binutils non-CVS releases + - fix ICE in do_subst (#65049) + - fix SSE conditional move (PR target/6753) + - fix SPARC CSE ICE (PR optimization/6759) + - fix x86_64 dbx64_register_map typo (Jan Hubicka) + - fix DWARF-2 with flag_asynchronous_unwind_tables set for leaf + functions (Jan Hubicka) + - fix DWARF-2 x86_64 __builtin_dwarf_reg_sizes (Jan Hubicka) + - fix x86_64 movabsdi (Michael Matz) + +* Wed May 15 2002 Jakub Jelinek <jakub@redhat.com> 3.1-1 +- update to 3.1 final +- 15 new patches + - fix PR c/6643 + - fix fold-const.c typo + - fix unitialized pointer-to-member values (Alexandre Oliva) + - fix templates with asm inputs (Jason Merrill) + - fix -fdata-section (Andreas Schwab) + - readd warning about i386 -malign-double into documentation (Jan Hubicka) + - fix PR libstdc++/6594 (Ben Kosnik) + - fix PR PR libstdc++/6648 (Paolo Carlini) + - fix libstdc++ testsuite rlimits (Rainer Orth) + - s390 java support (Gerhard Tonn) + - rotate testcases (Tom Rix) + - build libiberty with -fpic on x86_64 (Andreas Schwab) + - fix x86_64 multilib build (Bo Thorsen) + - fix x86_64 ASM_OUTPUT_MI_THUNK (Jan Hubicka) + - fix loop-2[cd].c tests on i386 (Eric Botcazou) +- fix typo in g77 info files tweaking +- fix libgcj.so symlink + +* Thu May 9 2002 Jakub Jelinek <jakub@redhat.com> 3.1-0.28 +- update to CVS 3.1 branch + - PR c++/6212, target/6429, opt/6534, c/6543, target/6561, c/6569 +- fix x86_64 q_regs_operand (Jan Hubicka) +- better PR c++/6381 fix (Jason Merrill) + +* Fri May 3 2002 Jakub Jelinek <jakub@redhat.com> 3.1-0.27 +- update to CVS 3.1 branch + - PR target/5628, libstdc++/5820, c++/6396, preprocessor/6489, + libstdc++/6501, libstdc++/6511, target/6512, libstdc++/6513, + bootstrap/6514, opt/6516, bootstrap/6525, c++/6527, libstdc++/6533, + target/6540 +- fix PR target/6542, target/6522, libstdc++/6549 + +* Mon Apr 29 2002 Jakub Jelinek <jakub@redhat.com> 3.1-0.26 +- update to CVS 3.1 branch + - PR c/3581, libstdc++/4150, libstdc++/4164, c/5154, c/5430, c++/5504, + c++/5658, c++/5719, f/6138, libgcj/6158, middle-end/6205, c++/6256, + c/6300, c++/6331, c/6343, c/6344, c++/6352, c/6358, libstdc++/6360, + c++/6395, target/6413, libstdc++/6414, target/6422, bootstrap/6445, + optimization/6475, target/6476, c++/6477, c++/6479, c++/6486, c++/6492, + target/6494, target/6496, c/6497, target/6500 +- fix PR c++/6396 +- run make check as part of build process + +* Thu Apr 18 2002 Jakub Jelinek <jakub@redhat.com> 3.1-0.25 +- update to CVS 3.1 branch + - PR opt/420, c++/525, target/817, target/1538, opt/3967, target/3997, + opt/4120, bootstrap/4191, opt/4311, optimization/4328, c++/4884, c++/4934, + c/5078, c++/5104, opt/5120, c++/5189, c++/5373, target/5446, c/5484, + c++/5507, c++/5571, c++/5636, target/5672, target/5715, target/5886, + c++/5933, c++/5964, c++/5998, opt/6007, target/6032, target/6041, + target/6054, c++/6073, target/6082, optimization/6086, target/6087, + middle-end/6096, middle-end/6098, middle-end/6099, middle-end/6100, + middle-end/6102, fortran/6106, c++/6119, opt/6165, optimization/6177, + c++/6179, optimization/6189, c/6202, c/6223, optimization/6233, + middle-end/6279, c/6290, optimization/6305, target/6305, bootstrap/6315, + c++/6320... +- fix PR c++/6316 + +* Wed Mar 27 2002 Jakub Jelinek <jakub@redhat.com> 3.1-0.24 +- update to CVS 3.1 branch + - PRs c/5656, c/5972, bootstrap/4192, target/4792, bootstrap/4195, + optimization/5854, target/6043, c++/6037, bootstrap/4128, target/5740, + c/5597, optimization/5863, optimization/5742, target/3177, c/5354, + optimization/5999, target/5977, middle-end/5731, target/5312... + +* Fri Mar 15 2002 Jakub Jelinek <jakub@redhat.com> 3.1-0.23.1 +- fix info and man page generation + +* Thu Mar 14 2002 Jakub Jelinek <jakub@redhat.com> 3.1-0.23 +- update to CVS 3.1 branch + - fix IA-64 packet selection (PR optimization/5892) + - make highest_pow2_factor work for all constants (PR middle-end/5877) + - fix -Wunused (#61047) + - fix loop on mixed mode class assignments (#60923) + - fix wide character literals + - support SPARC v9 long distance branches (PR target/5626) + - fix SPARC leaf functions + - fix a rtl sharing problem (Richard Henderson, #60760, + PR optimization/5844) + - fix va_arg with variable size types (PR c/3711) + - PRs optimization/5901, optimization/5878, 5693, preprocessor/5899 +- fix C++ ?: at the end of stmt expr (PR c++/5373) +- fix loop unrolling with sibcalls (PR optimization/5891) + +* Thu Mar 7 2002 Jakub Jelinek <jakub@redhat.com> 3.1-0.22 +- update to CVS 3.1 branch + - fix ICE with volatile long long (#60650) + - fix tempbuf.h (Philipp Thomas, #60212) + - fix -fssa-ccp (Jeff Law, #60651) + - versioned libstdc++ + - backport __attribute__((visibility("..."))) patches from trunk +- include libstdc++ html documentation + +* Tue Feb 5 2002 Jakub Jelinek <jakub@redhat.com> 3.1-0.21 +- update to CVS HEAD + - fix demangler (H.J. Lu, #59300, #59310) + - fix typo in IA-32 specs file (#59081) + - support moving SFmode values in MMX regs if -mmmx (#59083) + - fix recog_for_combine (#59084) + - don't ICE when inserting insns on edge from bb0 to bb0 (Bernd Schmidt, + #59087) + - make sure configure has not time in the future (#59203) + - fix division/modulo by certain constants (#58065, PR c/5304) + - fix -Wswitch (PR c/4475) + +* Thu Jan 31 2002 Jakub Jelinek <jakub@redhat.com> 3.1-0.20 +- update to CVS HEAD + - fix jar (Tom Tromey) + - fix loop unrolling (Richard Henderson) + +* Wed Jan 30 2002 Jakub Jelinek <jakub@redhat.com> 3.1-0.19 +- update to CVS HEAD + - fix a reload bug on ia32 (#58579, #58648) + - issue error about unknown -W* options (#58909) + - fix ia64 libbfd miscompilation (#58694) + - register all pending unparsed_text structures with GC (#58647) + - fix __builtin_apply with ia32 -msse (#58447) + - prevent ia64 prologue insns saving regs required for eh from being + deleted (#58387) + +* Tue Jan 15 2002 Jakub Jelinek <jakub@redhat.com> 3.1-0.18 +- update to CVS HEAD + - handle static x[] = { [X...Y] = (foo) { Z } } (#58338) + - fix getdents.os miscompilation (Richard Henderson, #58308) + - fix ICE in try_forward_edges (#58125) + - fix ICE with -fexceptions -foptimize-sibling-calls + +* Tue Jan 8 2002 Jakub Jelinek <jakub@redhat.com> 3.1-0.17 +- avoid division by 0 when computing prediction probabilities (#57992) +- fix ICE due to store_expr not adjusting value back for mode +- increase -ftemplate-depth default value to 500 + +* Mon Jan 7 2002 Jakub Jelinek <jakub@redhat.com> 3.1-0.16 +- if using PT_GNU_EH_FRAME registry, work around assembler bug resp. feature + and don't provide weak prototypes of functions which won't be used +- on Alpha, fix a typo so that crtbeginT.o is built and installed +- fix glibc inl-tester miscompilation on ia32 + +* Sun Jan 6 2002 Jakub Jelinek <jakub@redhat.com> 3.1-0.15 +- update to CVS HEAD (fix glibc bootstrap failure) + +* Thu Jan 3 2002 Jakub Jelinek <jakub@redhat.com> 3.1-0.14 +- update to CVS HEAD (#57907) + - fix alpha bootstrap (Richard Henderson) +- fix simplification of (div:SI (???:DI ???) (const_int 1)) + (#57916) +- add contrib/gcc_update --touch + +* Tue Jan 1 2002 Jakub Jelinek <jakub@redhat.com> 3.1-0.13 +- update to CVS HEAD (fix glibc miscompilation on alpha) +- fix objc to not emit __objc_class_name_* without type and size + +* Mon Dec 31 2001 Jakub Jelinek <jakub@redhat.com> 3.1-0.12 +- update to CVS HEAD +- fix sed commands for .la files +- make Alpha use PT_GNU_EH_FRAME + +* Thu Dec 27 2001 Jakub Jelinek <jakub@redhat.com> 3.1-0.11 +- update to CVS HEAD (#57165, #57212, #57467, #57488, #57502, + #57505, #57574) +- readd .la files after fixing them up by sed +- add %%defattr(-,root,root) to libobjc subpackage + +* Mon Dec 3 2001 Jakub Jelinek <jakub@redhat.com> 3.1-0.10 +- one more gcc.spec fix for passing --gdwarf-2 resp. --gstabs to as +- fix conditional register dead computation on IA-64 +- fix extern array of incomplete structures handling +- fix gcc -xc - +- fix Fortran ICEs with SAVE_EXPRs (Richard Kenner) + +* Tue Nov 27 2001 Jakub Jelinek <jakub@redhat.com> 3.1-0.9 +- update to CVS HEAD +- make DWARF 2 preferred debugging format on Linux + +* Mon Nov 12 2001 Jakub Jelinek <jakub@redhat.com> 3.1-0.8 +- don't ship .la files (#56072) +- include libfrtbegin.a (#56098) + +* Mon Nov 12 2001 Jakub Jelinek <jakub@redhat.com> 3.1-0.7 +- update to CVS HEAD +- back out Nov 7th loop.c change for now + +* Fri Nov 9 2001 Jakub Jelinek <jakub@redhat.com> 3.1-0.6 +- update to CVS HEAD +- frame unwind compatibility with 7.[12] binutils + +* Tue Nov 6 2001 Jakub Jelinek <jakub@redhat.com> 3.1-0.5 +- update to CVS HEAD +- merge DW_EH_PE_indirect constants and their relocs + +* Thu Oct 25 2001 Jakub Jelinek <jakub@redhat.com> 3.1-0.4 +- don't loop forever or ICE on bogus array initializers (#53704) +- fix store motion with pure calls +- disable store motion for now + +* Tue Oct 23 2001 Jakub Jelinek <jakub@redhat.com> 3.1-0.3 +- fix inlining of C nested functions with auto prototypes + +* Mon Oct 22 2001 Jakub Jelinek <jakub@redhat.com> 3.1-0.2 +- update to CVS HEAD +- tree inlining fix from Alexandre Oliva +- fix anonymous union ICE on alpha + +* Mon Oct 15 2001 Jakub Jelinek <jakub@redhat.com> 3.1-0.1 +- switch package to main compiler from alternate compiler +- update to CVS HEAD +- early gcc-2.96-RH compatibility in __frame_state_for +- change weak function tests for functions always present in GLIBC 2.2 + into simple non-weak calls in crt*.o to avoid unnecessary symbol + lookups and prelink conflicts +- don't link against libgcc_s C shared libraries + +* Tue Oct 2 2001 Jakub Jelinek <jakub@redhat.com> 3.0.1-4 +- update from CVS 3.0 branch + - ia64 function descriptors in vtables +- handle large files in Fortran (#53328) +- allow Java programs to be statically linked (#53605) +- remove #include_next patch, Benjamin commited it + +* Thu Sep 6 2001 Jakub Jelinek <jakub@redhat.com> 3.0.1-3 +- don't use #include_next in <bits/std_c*> headers (Benjamin Kosnik, #53262) + +* Wed Sep 5 2001 Jakub Jelinek <jakub@redhat.com> 3.0.1-2 +- update from CVS 3.0 branch +- check all gcc-2.96-RH patches whether they have made it into 3.0.1, + and if not, whether they are appropriate for 3.0.1 +- 8 new patches + - add 36 testcases from gcc-2.96-RH + - fix ICE on very questionable C++ code from JDK (#39858, #52960) + - fix -frepo (Nathan Sidwell, #52877) + - avoid generating bogus .stabs (#49214) + - issue a clear error message about invalid ia32 floating point + asm constraints (#27137) + - fix some comment typos + - fix ADDRESSOF recognition (#29686) + +* Mon Aug 27 2001 Jakub Jelinek <jakub@redhat.com> 3.0.1-1 +- update from CVS (3.0.1 final) +- properly handle throw() exception specifiers in template decls (#51824) +- fix IA-64 varargs handling in presence of additional anonymous arguments + (#50757) +- fix boehm-gc for prelink +- fix a typo in gcc3-c++ description (#52323) +- remove Chill from package summary (#51764) + +* Tue Aug 7 2001 Jakub Jelinek <jakub@redhat.com> 3.0-6 +- update from CVS + - fix glibc vfprintf miscompilation +- don't warn about if (&foo) if foo is weak (H.J.Lu, #50855) + +* Wed Jul 25 2001 Jakub Jelinek <jakub@redhat.com> 3.0-5 +- include libgcjgc.a in libgcj3-devel +- include libgcjgc.so.* in libgcj3 on ia64 +- remove dependency on libgcj on ia64 +- add ldconfig to libgcj3 post/postun + +* Tue Jul 24 2001 Jakub Jelinek <jakub@redhat.com> 3.0-4 +- update from CVS +- make gcc3-java/libgcj3* packages, so that they can coexist + with 2.96-RH Java +- make sure shared Java libraries are built with proper dependencies + +* Wed Jul 11 2001 Jakub Jelinek <jakub@redhat.com> 3.0-3 +- fix libgcc_s.so and libstdc++.so symlinks +- don't ship jar + +* Tue Jul 10 2001 Jakub Jelinek <jakub@redhat.com> 3.0-2 +- move libstdc++.so into gcc-lib +- add libobjc.so symlink + +* Tue Jul 10 2001 Jakub Jelinek <jakub@redhat.com> 3.0-1 +- new rpm diff --git a/patches/gcc/3.2.3/README-sh b/patches/gcc/3.2.3/README-sh new file mode 100644 index 00000000..a75042a3 --- /dev/null +++ b/patches/gcc/3.2.3/README-sh @@ -0,0 +1,16 @@ +http://mirror.sh-linux.org/rpm-2003/SRPMS/gcc-3.2.3-3.src.rpm contains the following patches: + +gcc-20030210-sh-linux-1.patch +gcc-3.2.3-libffi-1.patch +gcc-3.2.3-sh-linux-dwarf2-1.patch (*not* applied by the spec file, it's in there by accident) + +gcc-3.2.3-libffi-1.patch was needed just to build, I think. + +After that was applied, sh4 gcc seemed to compile fine, but c++ programs +failed to execute because libstdc++.so.5 was built without version +info. This was caused directly by libstdc++-v3/configure setting +SYMVER_MAP=config/linker-map.dummy because it sees that +no libgcc_s.so was generated; configure says + checking for shared libgcc... no. + +Applying gcc-20030210-sh-linux-1.patch in hopes it makes those problems go away. diff --git a/patches/gcc/3.2.3/config.sub.patch b/patches/gcc/3.2.3/config.sub.patch new file mode 100644 index 00000000..928f9115 --- /dev/null +++ b/patches/gcc/3.2.3/config.sub.patch @@ -0,0 +1,72 @@ +When configuring a s390->s390 or cris->cris crosscompiler +(ok, I haven't hit this yet, but one of these days I'll get me an account +on an s390, and then I'll need this patch :-), you'll get the +following error: + ++ /build/s390-unknown-linux-gnu/gcc-3.3-glibc-2.3.2/gcc-3.3/configure +--target=s390-unknown-linux-gnu --host=s390-host_unknown-linux-gnu +--prefix=/result/s390-unknown-linux-gnu/gcc-3.3-glibc-2.3.2 +--enable-languages=c +--with-local-prefix=/result/s390-unknown-linux-gnu/gcc-3.3-glibc-2.3.2/s390- +unknown-linux-gnu --enable-threads=no --without-headers --with-newlib +--disable-shared +... +*** --with-headers is only supported when cross compiling + +This error pops up only when you're using Daniel Jacobowitz's technique +of slightly changing the target and host tuples to make them different +enough to force gcc's build system to not try to pull in system libraries +or headers. This technique is needed e.g. to build an x86 -> x86 +cross-compiler. +(The LFS developers ran into the same bug that prompted me to use +this technique; they point people who run into it to +http://linuxfromscratch.org/~greg/pure_lfs.txt, which is a different +way of avoiding this problem. I think the tuple tweak is the way to go, though.) + +config-patches@gnu.org rejected this patch, on the grounds that there +is only one vendor of each of those two architectures, so the +canonicalization is by definition correct. When I pointed out the +difficulty this causes for people building s390 -> s390 or +cris -> cris compilers that are incompatible with the system +libraries and thus must be built like cross-compilers, he grumped and said +"autoconf should let you specify a cross-compiler in some other way than +comparing tuple strings". + + + +--- gcc-3.3/config.sub.old Sun Jun 8 20:38:47 2003 ++++ gcc-3.3/config.sub Sun Jun 8 20:40:34 2003 +@@ -433,9 +433,12 @@ + crds | unos) + basic_machine=m68k-crds + ;; +- cris | cris-* | etrax*) ++ cris | etrax*) + basic_machine=cris-axis + ;; ++ cris-*) ++ basic_machine=cris-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; +@@ -820,11 +823,17 @@ + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; +- s390 | s390-*) ++ s390) + basic_machine=s390-ibm + ;; +- s390x | s390x-*) ++ s390-*) ++ basic_machine=s390-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; ++ s390x) + basic_machine=s390x-ibm ++ ;; ++ s390x-*) ++ basic_machine=s390x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + sa29200) + basic_machine=a29k-amd diff --git a/patches/gcc/3.2.3/gcc-20020722-ppc405erratum77.patch b/patches/gcc/3.2.3/gcc-20020722-ppc405erratum77.patch new file mode 100644 index 00000000..bd717f52 --- /dev/null +++ b/patches/gcc/3.2.3/gcc-20020722-ppc405erratum77.patch @@ -0,0 +1,105 @@ +# See http://gcc.gnu.org/PR7383, http://www.kegel.com/xgcc3/ppc405erratum77.html +# Fixed in gcc-3.3 + +diff -aur gcc-20020722.orig/gcc/config/rs6000/rs6000.h gcc-20020722/gcc/config/rs6000/rs6000.h +--- gcc-20020722.orig/gcc/config/rs6000/rs6000.h Thu Jul 25 09:32:21 2002 ++++ gcc-20020722/gcc/config/rs6000/rs6000.h Thu Jul 25 09:34:45 2002 +@@ -66,7 +66,7 @@ + %{mcpu=rsc1: -D_ARCH_PWR} \ + %{mcpu=401: -D_ARCH_PPC} \ + %{mcpu=403: -D_ARCH_PPC} \ +-%{mcpu=405: -D_ARCH_PPC} \ ++%{mcpu=405: -D_ARCH_PPC -D__PPC405__} \ + %{mcpu=505: -D_ARCH_PPC} \ + %{mcpu=601: -D_ARCH_PPC -D_ARCH_PWR} \ + %{mcpu=602: -D_ARCH_PPC} \ +diff -aur gcc-20020722.orig/libjava/sysdep/powerpc/locks.h gcc-20020722/libjava/sysdep/powerpc/locks.h +--- gcc-20020722.orig/libjava/sysdep/powerpc/locks.h Thu Jul 25 09:32:30 2002 ++++ gcc-20020722/libjava/sysdep/powerpc/locks.h Thu Jul 25 11:39:13 2002 +@@ -11,6 +11,17 @@ + #ifndef __SYSDEP_LOCKS_H__ + #define __SYSDEP_LOCKS_H__ + ++#ifdef __PPC405__ ++// workaround for PPC405 erratum #77 - 07/18/02 JRO, dank, NN. References: ++// http://www-3.ibm.com/chips/techlib/techlib.nsf/techdocs/89DED00DEBFF54BF87256A8000491BA2/$file/405CR_C_errata_1_2.pdf ++// http://ppc.bkbits.net:8080/linuxppc_2_4_devel/cset@1.489 ++// http://www.kegel.com/xgcc3/ppc405erratum77.html ++// FIXME: using dbct instead of sync would be faster ++#define __LIBGCJ_PPC405_ERR77_SYNC "sync \n\t" ++#else ++#define __LIBGCJ_PPC405_ERR77_SYNC ++#endif ++ + typedef size_t obj_addr_t; /* Integer type big enough for object */ + /* address. */ + +@@ -25,6 +36,7 @@ + "0: lwarx %0,0,%1 ;" + " xor. %0,%3,%0;" + " bne 1f;" ++ __LIBGCJ_PPC405_ERR77_SYNC + " stwcx. %2,0,%1;" + " bne- 0b;" + "1: " +@@ -58,6 +70,7 @@ + "0: lwarx %0,0,%1 ;" + " xor. %0,%3,%0;" + " bne 1f;" ++ __LIBGCJ_PPC405_ERR77_SYNC + " stwcx. %2,0,%1;" + " bne- 0b;" + "1: " +diff -aur gcc-20020722.orig/libstdc++-v3/config/cpu/powerpc/bits/atomicity.h gcc-20020722/libstdc++-v3/config/cpu/powerpc/bits/atomicity.h +--- gcc-20020722.orig/libstdc++-v3/config/cpu/powerpc/bits/atomicity.h Thu Jul 25 09:32:31 2002 ++++ gcc-20020722/libstdc++-v3/config/cpu/powerpc/bits/atomicity.h Thu Jul 25 09:34:45 2002 +@@ -32,6 +32,17 @@ + + typedef int _Atomic_word; + ++#ifdef __PPC405__ ++// workaround for PPC405 erratum #77 - 07/18/02 JRO & dank. References: ++// http://www-3.ibm.com/chips/techlib/techlib.nsf/techdocs/89DED00DEBFF54BF87256A8000491BA2/$file/405CR_C_errata_1_2.pdf ++// http://ppc.bkbits.net:8080/linuxppc_2_4_devel/cset@1.489 ++// http://www.kegel.com/xgcc3/ppc405erratum77.html ++// FIXME: using dbct instead of sync would be faster ++#define __LIBSTDCPP_PPC405_ERR77_SYNC "sync \n\t" ++#else ++#define __LIBSTDCPP_PPC405_ERR77_SYNC ++#endif ++ + static inline _Atomic_word + __attribute__ ((__unused__)) + __exchange_and_add (volatile _Atomic_word* __mem, int __val) +@@ -42,6 +53,7 @@ + "0:\t" + "lwarx %0,0,%2 \n\t" + "add%I3 %1,%0,%3 \n\t" ++ __LIBSTDCPP_PPC405_ERR77_SYNC + "stwcx. %1,0,%2 \n\t" + "bne- 0b \n\t" + "/* End exchange & add */" +@@ -61,6 +73,7 @@ + "0:\t" + "lwarx %0,0,%1 \n\t" + "add%I2 %0,%0,%2 \n\t" ++ __LIBSTDCPP_PPC405_ERR77_SYNC + "stwcx. %0,0,%1 \n\t" + "bne- 0b \n\t" + "/* End atomic add */" +@@ -78,6 +91,7 @@ + "/* Inline always swap */\n" + "0:\t" + "lwarx %0,0,%1 \n\t" ++ __LIBSTDCPP_PPC405_ERR77_SYNC + "stwcx. %2,0,%1 \n\t" + "bne- 0b \n\t" + "/* End always swap */" +@@ -98,6 +112,7 @@ + "lwarx %0,0,%1 \n\t" + "cmpwi %0,0 \n\t" + "bne- 1f \n\t" ++ __LIBSTDCPP_PPC405_ERR77_SYNC + "stwcx. %2,0,%1 \n\t" + "bne- 0b \n" + "1:\n\t" diff --git a/patches/gcc/3.2.3/gcc-20030210-sh-linux-1.patch b/patches/gcc/3.2.3/gcc-20030210-sh-linux-1.patch new file mode 100644 index 00000000..43930785 --- /dev/null +++ b/patches/gcc/3.2.3/gcc-20030210-sh-linux-1.patch @@ -0,0 +1,1761 @@ +diff -ruN gcc-20030210.orig/boehm-gc/configure gcc-20030210/boehm-gc/configure +--- gcc-20030210.orig/boehm-gc/configure Fri Jan 31 19:17:00 2003 ++++ gcc-20030210/boehm-gc/configure Sat Feb 22 01:40:14 2003 +@@ -1922,7 +1922,7 @@ + # This must be Linux ELF. + linux-gnu*) + case $host_cpu in +- alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) ++ alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | sh* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM +diff -ruN gcc-20030210.orig/config-ml.in gcc-20030210/config-ml.in +--- gcc-20030210.orig/config-ml.in Fri Jan 31 19:16:59 2003 ++++ gcc-20030210/config-ml.in Sat Feb 22 01:40:14 2003 +@@ -545,6 +545,7 @@ + if [ -d ../$${dir}/$${lib} ]; then \ + flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \ + if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \ ++ DESTDIR="$(DESTDIR)" \ + CFLAGS="$(CFLAGS) $${flags}" \ + prefix="$(prefix)" \ + exec_prefix="$(exec_prefix)" \ +diff -ruN gcc-20030210.orig/debian/edit-specs.in gcc-20030210/debian/edit-specs.in +--- gcc-20030210.orig/debian/edit-specs.in Thu Jan 1 09:00:00 1970 ++++ gcc-20030210/debian/edit-specs.in Sat Feb 22 01:40:14 2003 +@@ -0,0 +1,45 @@ ++/^*asm:$/ { ++n ++c\ ++@AS_ENDIAN_FLAG@ %{mrelax:-relax} ++} ++/^*cpp:$/ { ++n ++c\ ++%(cpp_default_cpu_spec) %(subtarget_cpp_spec) %(subtarget_cpp_ptr_spec) %(subtarget_cpp_endian_spec) ++} ++/^*cc1:$/ { ++n ++c\ ++-musermode @CC1_CPU_ENDIAN_FLAGS@ %{profile:-p} ++} ++/^*link:$/ { ++n ++c\ ++%{!static:--eh-frame-hdr} @LINKER_CPU_ENDIAN_FLAGS@ @LINKER_RPATH_LINK_FLAG@ %{mrelax:-relax} %{shared:-shared} %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} %{static:-static} ++} ++/^*multilib:$/ { ++n ++c\ ++. ; ++} ++/^*multilib_matches:$/ { ++n ++c\ ++ ++} ++/^*multilib_options:$/ { ++n ++c\ ++ ++} ++/^*subtarget_cpp_endian_spec:$/ { ++n ++c\ ++@CPP_ENDIAN_DEF@ ++} ++/^*cpp_default_cpu_spec:$/ { ++n ++c\ ++@CPP_CPU_DEFS@ ++} +diff -ruN gcc-20030210.orig/debian/install-CPU-linux gcc-20030210/debian/install-CPU-linux +--- gcc-20030210.orig/debian/install-CPU-linux Thu Jan 1 09:00:00 1970 ++++ gcc-20030210/debian/install-CPU-linux Sat Feb 22 01:40:14 2003 +@@ -0,0 +1,111 @@ ++#! /bin/sh ++ ++VERSION=$1; shift ++CPU=$1 ++ ++# literally (binary-ly) same ++PROGS_C="cpp gcc" ++PROGS_ADDITIONAL="c++ g++ g77 gcj" ++ ++DRIVERS_C="cc1 cpp0 tradcpp0" ++DRIVERS_ADDITIONAL="cc1obj cc1plus collect2 f771 jc1 jvgenmain" ++if [ -z "$STEP1_COMPILER_BUILD" ]; then ++ PROGS="$PROGS_C $PROGS_ADDITIONAL" ++ DRIVERS="$DRIVERS_C $DRIVERSADDITIONAL" ++ INITIAL="" ++else ++ PROGS=$PROGS_C ++ DRIVERS=$DRIVERS_C ++ INITIAL="-initial" ++fi ++ ++OBJS="crtbegin.o crtbeginS.o crtend.o crtendS.o" ++LIBS_C="libgcc.a" ++LIBS_1="libgcc_s.so libgcc_s.so.1 libstdc++.so libstdc++.so.3 libstdc++.so.3.0.2" ++LIBS_2="libobjc.a libstdc++.a libsupc++.a" ++INCLUDE="include" ++ ++cd debian/gcc-sh-linux-others${INITIAL} || exit 1 ++ ++# Make directories. ++mkdir -p usr/bin usr/share usr/share/man usr/share/man/man1 usr/lib \ ++ usr/lib/gcc-lib usr/lib/gcc-lib/${CPU}-linux \ ++ usr/lib/gcc-lib/${CPU}-linux/${VERSION} \ ++ usr/${CPU}-linux usr/${CPU}-linux/lib ++ ++# Make symbolic links for include dir. ++(cd usr/${CPU}-linux; ln -s ../sh-linux/include .) ++ ++# Make symbolic links for executables. ++(cd usr/bin; ++ for p in ${PROGS}; do ++ ln -s shCPU-linux-GCC ${CPU}-linux-$p ++ done) ++ ++case "${CPU}" in ++ sh3) ++ MULTILIBDIR= ++ AS_ENDIAN_FLAG="-little" ++ CPP_ENDIAN_DEF="-D__LITTLE_ENDIAN__" ++ CPP_CPU_DEFS="-D__SH3__ -D__sh3__" ++ CC1_CPU_ENDIAN_FLAGS="-ml -m3" ++ LINKER_CPU_ENDIAN_FLAGS="-m shlelf_linux -EL --architecture sh3" ++ LINKER_RPATH_LINK_FLAG="-rpath-link /usr/sh3-linux/lib" ++ ;; ++ sh3eb) ++ MULTILIBDIR=/mb ++ AS_ENDIAN_FLAG="-big" ++ CPP_ENDIAN_DEF="-D__BIG_ENDIAN__" ++ CPP_CPU_DEFS="-D__SH3__ -D__sh3__" ++ CC1_CPU_ENDIAN_FLAGS="-mb -m3" ++ LINKER_CPU_ENDIAN_FLAGS="-m shelf_linux -EB --architecture sh3" ++ LINKER_RPATH_LINK_FLAG="-rpath-link /usr/sh3eb-linux/lib" ++ ;; ++ sh4) ++ MULTILIBDIR=/m4 ++ AS_ENDIAN_FLAG="-little" ++ CPP_ENDIAN_DEF="-D__LITTLE_ENDIAN__" ++ CPP_CPU_DEFS="-D__SH4__" ++ CC1_CPU_ENDIAN_FLAGS="-ml -m4" ++ LINKER_CPU_ENDIAN_FLAGS="-m shlelf_linux -EL --architecture sh4" ++ LINKER_RPATH_LINK_FLAG="-rpath-link /usr/sh4-linux/lib" ++ ;; ++ sh4eb) ++ MULTILIBDIR=/mb/m4 ++ AS_ENDIAN_FLAG="-big" ++ CPP_ENDIAN_DEF="-D__BIG_ENDIAN__" ++ CPP_CPU_DEFS="-D__SH4__" ++ CC1_CPU_ENDIAN_FLAGS="-mb -m4" ++ LINKER_CPU_ENDIAN_FLAGS="-m shelf_linux -EB --architecture sh4" ++ LINKER_RPATH_LINK_FLAG="-rpath-link /usr/sh4eb-linux/lib" ++ ;; ++esac ++ ++# Make symbolic links for GCC drivers, objects, libraries, and include dir. ++(cd usr/lib/gcc-lib/${CPU}-linux/${VERSION}; ++ for f in ${DRIVERS} ${INCLUDE}; do ++ ln -s ../../sh-linux/${VERSION}/$f $f; ++ done ++ for f in ${OBJS} ${LIBS_C}; do ++ ln -s ../../sh-linux/${VERSION}${MULTILIBDIR}/$f $f; ++ done) ++ ++if [ -z "$STEP1_COMPILER_BUILD" ]; then ++ for f in ${LIBS_1} ${LIBS_2}; do ++ mv ../gcc-sh-linux/usr/sh-linux/lib${MULTILIBDIR}/$f usr/${CPU}-linux/lib/; ++ done ++fi ++ ++sed -e "s+@AS_ENDIAN_FLAG@+${AS_ENDIAN_FLAG}+" \ ++ -e "s+@CPP_ENDIAN_DEF@+${CPP_ENDIAN_DEF}+" \ ++ -e "s+@CPP_CPU_DEFS@+${CPP_CPU_DEFS}+" \ ++ -e "s+@CC1_CPU_ENDIAN_FLAGS@+${CC1_CPU_ENDIAN_FLAGS}+" \ ++ -e "s+@LINKER_CPU_ENDIAN_FLAGS@+${LINKER_CPU_ENDIAN_FLAGS}+" \ ++ -e "s+@LINKER_RPATH_LINK_FLAG@+${LINKER_RPATH_LINK_FLAG}+" \ ++ ../edit-specs.in >../edit-specs-${CPU}.sed ++ ++sed -f ../edit-specs-${CPU}.sed \ ++ ../gcc-sh-linux${INITIAL}/usr/lib/gcc-lib/sh-linux/${VERSION}/specs \ ++ > usr/lib/gcc-lib/${CPU}-linux/${VERSION}/specs ++ ++exit 0 +diff -ruN gcc-20030210.orig/debian/multilib-symlink gcc-20030210/debian/multilib-symlink +--- gcc-20030210.orig/debian/multilib-symlink Thu Jan 1 09:00:00 1970 ++++ gcc-20030210/debian/multilib-symlink Sat Feb 22 01:40:14 2003 +@@ -0,0 +1,10 @@ ++#! /bin/sh ++ ++cd /usr/sh-linux/lib ++ln -s ../../sh3-linux/lib/{*.a,*.so*,*.o} . ++cd m4 ++ln -s ../../../sh4-linux/lib/{*.a,*.so*,*.o} . ++cd ../mb ++ln -s ../../../sh3eb-linux/lib/{*.a,*.so*,*.o} . ++cd m4 ++ln -s ../../../../sh4eb-linux/lib/{*.a,*.so*,*.o} . +diff -ruN gcc-20030210.orig/debian/shCPU-linux-GCC gcc-20030210/debian/shCPU-linux-GCC +--- gcc-20030210.orig/debian/shCPU-linux-GCC Thu Jan 1 09:00:00 1970 ++++ gcc-20030210/debian/shCPU-linux-GCC Sat Feb 22 01:40:14 2003 +@@ -0,0 +1,59 @@ ++#! /bin/bash ++ ++BASENAME=${0##*/} ++PROG=${BASENAME##*-} ++CPU=${BASENAME%%-*} ++ ++if [ "$PROG" = gcc ]; then ++ if [ "$1" = "-b" -a "$2" = "i386-linux" ]; then ++ shift 2 ++ exec /usr/bin/gcc "$@" ++ elif [ "$1" = "-print-multi-lib" -o "$1" = "--print-multi-lib" ]; then ++ echo ".;" ++ exit 0 ++ elif [ "$1" = "-print-multi-os-directory" -o "$1" = "--print-multi-os-directory" ]; then ++ echo "." ++ exit 0 ++ elif [ "$1" = "-dumpspecs" ]; then ++ cat /usr/lib/gcc-lib/${CPU}-linux/@@VERSION@@/specs ++ exit 0 ++ fi ++fi ++ ++case "${CPU}" in ++ sh3) ++ ARCH=m3 ++ DEFINES="-D__sh3__ -D__SH3__ -D__LITTLE_ENDIAN__" ++ ENDIAN=ml ++ ;; ++ sh3eb) ++ ARCH=m3 ++ DEFINES="-D__sh3__ -D__SH3__ -D__BIG_ENDIAN__" ++ ENDIAN=mb ++ ;; ++ sh4) ++ ARCH=m4 ++ DEFINES="-D__SH4__ -D__LITTLE_ENDIAN__" ++ ENDIAN=ml ++ ;; ++ sh4eb) ++ ARCH=m4 ++ DEFINES="-D__SH4__ -D__BIG_ENDIAN__" ++ ENDIAN=mb ++ ;; ++esac ++ ++# Prepend the appropriate options ++# If user specifies some options, it will be overridden ++ ++case "${PROG}" in ++ cpp) ++ exec sh-linux-${PROG} $DEFINES "$@" ++ ;; ++ c++|g++|g77|gcc|gcj) ++ exec sh-linux-${PROG} -$ARCH -$ENDIAN "$@" ++ ;; ++esac ++ ++echo "Something wrong..." ++exit 1 +diff -ruN gcc-20030210.orig/gcc/config/sh/elf.h gcc-20030210/gcc/config/sh/elf.h +--- gcc-20030210.orig/gcc/config/sh/elf.h Fri Feb 22 01:42:28 2002 ++++ gcc-20030210/gcc/config/sh/elf.h Sat Feb 22 01:40:14 2003 +@@ -170,3 +170,7 @@ + #undef ENDFILE_SPEC + #define ENDFILE_SPEC \ + "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" ++ ++/* ASM_OUTPUT_CASE_LABEL is defined in elfos.h. With it, ++ redundant .align will be generated. */ ++#undef ASM_OUTPUT_CASE_LABEL +diff -ruN gcc-20030210.orig/gcc/config/sh/lib1funcs.asm gcc-20030210/gcc/config/sh/lib1funcs.asm +--- gcc-20030210.orig/gcc/config/sh/lib1funcs.asm Fri Feb 22 01:42:28 2002 ++++ gcc-20030210/gcc/config/sh/lib1funcs.asm Sat Feb 22 01:40:14 2003 +@@ -39,8 +39,13 @@ + + #ifdef __ELF__ + #define LOCAL(X) .L_##X ++#define FUNC(X) .type X,@function; .hidden X ++#define _ENDFUNC(X) .Lfe_##X: .size X,.Lfe_##X-X ++#define ENDFUNC(X) _ENDFUNC(X) + #else + #define LOCAL(X) L_##X ++#define FUNC(X) ++#define ENDFUNC(X) + #endif + + #ifdef __linux__ +@@ -91,6 +96,40 @@ + .global GLOBAL(ashiftrt_r4_31) + .global GLOBAL(ashiftrt_r4_32) + ++ FUNC(GLOBAL(ashiftrt_r4_0)) ++ FUNC(GLOBAL(ashiftrt_r4_1)) ++ FUNC(GLOBAL(ashiftrt_r4_2)) ++ FUNC(GLOBAL(ashiftrt_r4_3)) ++ FUNC(GLOBAL(ashiftrt_r4_4)) ++ FUNC(GLOBAL(ashiftrt_r4_5)) ++ FUNC(GLOBAL(ashiftrt_r4_6)) ++ FUNC(GLOBAL(ashiftrt_r4_7)) ++ FUNC(GLOBAL(ashiftrt_r4_8)) ++ FUNC(GLOBAL(ashiftrt_r4_9)) ++ FUNC(GLOBAL(ashiftrt_r4_10)) ++ FUNC(GLOBAL(ashiftrt_r4_11)) ++ FUNC(GLOBAL(ashiftrt_r4_12)) ++ FUNC(GLOBAL(ashiftrt_r4_13)) ++ FUNC(GLOBAL(ashiftrt_r4_14)) ++ FUNC(GLOBAL(ashiftrt_r4_15)) ++ FUNC(GLOBAL(ashiftrt_r4_16)) ++ FUNC(GLOBAL(ashiftrt_r4_17)) ++ FUNC(GLOBAL(ashiftrt_r4_18)) ++ FUNC(GLOBAL(ashiftrt_r4_19)) ++ FUNC(GLOBAL(ashiftrt_r4_20)) ++ FUNC(GLOBAL(ashiftrt_r4_21)) ++ FUNC(GLOBAL(ashiftrt_r4_22)) ++ FUNC(GLOBAL(ashiftrt_r4_23)) ++ FUNC(GLOBAL(ashiftrt_r4_24)) ++ FUNC(GLOBAL(ashiftrt_r4_25)) ++ FUNC(GLOBAL(ashiftrt_r4_26)) ++ FUNC(GLOBAL(ashiftrt_r4_27)) ++ FUNC(GLOBAL(ashiftrt_r4_28)) ++ FUNC(GLOBAL(ashiftrt_r4_29)) ++ FUNC(GLOBAL(ashiftrt_r4_30)) ++ FUNC(GLOBAL(ashiftrt_r4_31)) ++ FUNC(GLOBAL(ashiftrt_r4_32)) ++ + .align 1 + GLOBAL(ashiftrt_r4_32): + GLOBAL(ashiftrt_r4_31): +@@ -170,6 +209,41 @@ + GLOBAL(ashiftrt_r4_0): + rts + nop ++ ++ ENDFUNC(GLOBAL(ashiftrt_r4_0)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_1)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_2)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_3)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_4)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_5)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_6)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_7)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_8)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_9)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_10)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_11)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_12)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_13)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_14)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_15)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_16)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_17)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_18)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_19)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_20)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_21)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_22)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_23)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_24)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_25)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_26)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_27)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_28)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_29)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_30)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_31)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_32)) ++ + #endif + + #ifdef L_ashiftrt_n +@@ -192,6 +266,7 @@ + ! + + .global GLOBAL(ashrsi3) ++ FUNC(GLOBAL(ashrsi3)) + .align 2 + GLOBAL(ashrsi3): + mov #31,r0 +@@ -319,6 +394,8 @@ + rts + nop + ++ ENDFUNC(GLOBAL(ashrsi3)) ++ + #endif + + #ifdef L_ashiftlt +@@ -340,6 +417,7 @@ + ! (none) + ! + .global GLOBAL(ashlsi3) ++ FUNC(GLOBAL(ashlsi3)) + .align 2 + GLOBAL(ashlsi3): + mov #31,r0 +@@ -476,6 +554,8 @@ + rts + nop + ++ ENDFUNC(GLOBAL(ashlsi3)) ++ + #endif + + #ifdef L_lshiftrt +@@ -497,6 +577,7 @@ + ! (none) + ! + .global GLOBAL(lshrsi3) ++ FUNC(GLOBAL(lshrsi3)) + .align 2 + GLOBAL(lshrsi3): + mov #31,r0 +@@ -633,6 +714,8 @@ + rts + nop + ++ ENDFUNC(GLOBAL(lshrsi3)) ++ + #endif + + #ifdef L_movstr +@@ -649,76 +732,113 @@ + add #64,r4 + .align 4 + .global GLOBAL(movstrSI64) ++ FUNC(GLOBAL(movstrSI64)) + GLOBAL(movstrSI64): + mov.l @(60,r5),r0 + mov.l r0,@(60,r4) + .global GLOBAL(movstrSI60) ++ FUNC(GLOBAL(movstrSI60)) + GLOBAL(movstrSI60): + mov.l @(56,r5),r0 + mov.l r0,@(56,r4) + .global GLOBAL(movstrSI56) ++ FUNC(GLOBAL(movstrSI56)) + GLOBAL(movstrSI56): + mov.l @(52,r5),r0 + mov.l r0,@(52,r4) + .global GLOBAL(movstrSI52) ++ FUNC(GLOBAL(movstrSI52)) + GLOBAL(movstrSI52): + mov.l @(48,r5),r0 + mov.l r0,@(48,r4) + .global GLOBAL(movstrSI48) ++ FUNC(GLOBAL(movstrSI48)) + GLOBAL(movstrSI48): + mov.l @(44,r5),r0 + mov.l r0,@(44,r4) + .global GLOBAL(movstrSI44) ++ FUNC(GLOBAL(movstrSI44)) + GLOBAL(movstrSI44): + mov.l @(40,r5),r0 + mov.l r0,@(40,r4) + .global GLOBAL(movstrSI40) ++ FUNC(GLOBAL(movstrSI40)) + GLOBAL(movstrSI40): + mov.l @(36,r5),r0 + mov.l r0,@(36,r4) + .global GLOBAL(movstrSI36) ++ FUNC(GLOBAL(movstrSI36)) + GLOBAL(movstrSI36): + mov.l @(32,r5),r0 + mov.l r0,@(32,r4) + .global GLOBAL(movstrSI32) ++ FUNC(GLOBAL(movstrSI32)) + GLOBAL(movstrSI32): + mov.l @(28,r5),r0 + mov.l r0,@(28,r4) + .global GLOBAL(movstrSI28) ++ FUNC(GLOBAL(movstrSI28)) + GLOBAL(movstrSI28): + mov.l @(24,r5),r0 + mov.l r0,@(24,r4) + .global GLOBAL(movstrSI24) ++ FUNC(GLOBAL(movstrSI24)) + GLOBAL(movstrSI24): + mov.l @(20,r5),r0 + mov.l r0,@(20,r4) + .global GLOBAL(movstrSI20) ++ FUNC(GLOBAL(movstrSI20)) + GLOBAL(movstrSI20): + mov.l @(16,r5),r0 + mov.l r0,@(16,r4) + .global GLOBAL(movstrSI16) ++ FUNC(GLOBAL(movstrSI16)) + GLOBAL(movstrSI16): + mov.l @(12,r5),r0 + mov.l r0,@(12,r4) + .global GLOBAL(movstrSI12) ++ FUNC(GLOBAL(movstrSI12)) + GLOBAL(movstrSI12): + mov.l @(8,r5),r0 + mov.l r0,@(8,r4) + .global GLOBAL(movstrSI8) ++ FUNC(GLOBAL(movstrSI8)) + GLOBAL(movstrSI8): + mov.l @(4,r5),r0 + mov.l r0,@(4,r4) + .global GLOBAL(movstrSI4) ++ FUNC(GLOBAL(movstrSI4)) + GLOBAL(movstrSI4): + mov.l @(0,r5),r0 + mov.l r0,@(0,r4) ++ .global GLOBAL(movstrSI0) ++ FUNC(GLOBAL(movstrSI0)) + GLOBAL(movstrSI0): + rts + nop + ++ ENDFUNC(GLOBAL(movstrSI64)) ++ ENDFUNC(GLOBAL(movstrSI60)) ++ ENDFUNC(GLOBAL(movstrSI56)) ++ ENDFUNC(GLOBAL(movstrSI52)) ++ ENDFUNC(GLOBAL(movstrSI48)) ++ ENDFUNC(GLOBAL(movstrSI44)) ++ ENDFUNC(GLOBAL(movstrSI40)) ++ ENDFUNC(GLOBAL(movstrSI36)) ++ ENDFUNC(GLOBAL(movstrSI32)) ++ ENDFUNC(GLOBAL(movstrSI28)) ++ ENDFUNC(GLOBAL(movstrSI24)) ++ ENDFUNC(GLOBAL(movstrSI20)) ++ ENDFUNC(GLOBAL(movstrSI16)) ++ ENDFUNC(GLOBAL(movstrSI12)) ++ ENDFUNC(GLOBAL(movstrSI8)) ++ ENDFUNC(GLOBAL(movstrSI4)) ++ ENDFUNC(GLOBAL(movstrSI0)) ++ + .align 4 + + .global GLOBAL(movstr) ++ FUNC(GLOBAL(movstr)) + GLOBAL(movstr): + mov.l @(60,r5),r0 + mov.l r0,@(60,r4) +@@ -775,6 +895,8 @@ + add #64,r5 + bra GLOBAL(movstr) + add #64,r4 ++ ++ FUNC(GLOBAL(movstr)) + #endif + + #ifdef L_movstr_i4 +@@ -783,6 +905,10 @@ + .global GLOBAL(movstr_i4_odd) + .global GLOBAL(movstrSI12_i4) + ++ FUNC(GLOBAL(movstr_i4_even)) ++ FUNC(GLOBAL(movstr_i4_odd)) ++ FUNC(GLOBAL(movstrSI12_i4)) ++ + .p2align 5 + L_movstr_2mod4_end: + mov.l r0,@(16,r4) +@@ -791,6 +917,11 @@ + + .p2align 2 + ++GLOBAL(movstr_i4_even): ++ mov.l @r5+,r0 ++ bra L_movstr_start_even ++ mov.l @r5+,r1 ++ + GLOBAL(movstr_i4_odd): + mov.l @r5+,r1 + add #-4,r4 +@@ -817,10 +948,8 @@ + rts + mov.l r3,@(12,r4) + +-GLOBAL(movstr_i4_even): +- mov.l @r5+,r0 +- bra L_movstr_start_even +- mov.l @r5+,r1 ++ ENDFUNC(GLOBAL(movstr_i4_even)) ++ ENDFUNC(GLOBAL(movstr_i4_odd)) + + .p2align 4 + GLOBAL(movstrSI12_i4): +@@ -831,12 +960,16 @@ + mov.l r1,@(4,r4) + rts + mov.l r2,@(8,r4) ++ ++ ENDFUNC(GLOBAL(movstrSI12_i4)) ++ + #endif + + #ifdef L_mulsi3 + + + .global GLOBAL(mulsi3) ++ FUNC(GLOBAL(mulsi3)) + + ! r4 = aabb + ! r5 = ccdd +@@ -869,7 +1002,7 @@ + rts + add r2,r0 + +- ++ FUNC(GLOBAL(mulsi3)) + #endif + #endif /* ! __SH5__ */ + #ifdef L_sdivsi3_i4 +@@ -879,6 +1012,7 @@ + !! args in r4 and r5, result in fpul, clobber dr0, dr2 + + .global GLOBAL(sdivsi3_i4) ++ FUNC(GLOBAL(sdivsi3_i4)) + GLOBAL(sdivsi3_i4): + lds r4,fpul + float fpul,dr0 +@@ -888,6 +1022,8 @@ + rts + ftrc dr0,fpul + ++ ENDFUNC(GLOBAL(sdivsi3_i4)) ++ + #elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__) || (defined (__SH5__) && ! defined __SH4_NOFPU__) + !! args in r4 and r5, result in fpul, clobber r2, dr0, dr2 + +@@ -896,6 +1032,7 @@ + .mode SHcompact + #endif + .global GLOBAL(sdivsi3_i4) ++ FUNC(GLOBAL(sdivsi3_i4)) + GLOBAL(sdivsi3_i4): + sts.l fpscr,@-r15 + mov #8,r2 +@@ -910,6 +1047,8 @@ + rts + lds.l @r15+,fpscr + ++ ENDFUNC(GLOBAL(sdivsi3_i4)) ++ + #endif /* ! __SH5__ || __SH5__ == 32 */ + #endif /* ! __SH4__ */ + #endif +@@ -924,9 +1063,10 @@ + !! + !! + +-!! args in r4 and r5, result in r0 clobber r1,r2,r3 ++!! args in r4 and r5, result in r0 clobber r1, r2, r3, and t bit + + .global GLOBAL(sdivsi3) ++ FUNC(GLOBAL(sdivsi3)) + #if __SHMEDIA__ + #if __SH5__ == 32 + .section .text..SHmedia32,"ax" +@@ -1076,6 +1216,7 @@ + div0: rts + mov #0,r0 + ++ ENDFUNC(GLOBAL(sdivsi3)) + #endif /* ! __SHMEDIA__ */ + #endif /* ! __SH4__ */ + #endif +@@ -1084,9 +1225,11 @@ + .title "SH DIVIDE" + !! 4 byte integer Divide code for the Hitachi SH + #ifdef __SH4__ +-!! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4 ++!! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4, ++!! and t bit + + .global GLOBAL(udivsi3_i4) ++ FUNC(GLOBAL(udivsi3_i4)) + GLOBAL(udivsi3_i4): + mov #1,r1 + cmp/hi r1,r5 +@@ -1127,6 +1270,8 @@ + L1: + .double 2147483648 + ++ ENDFUNC(GLOBAL(udivsi3_i4)) ++ + #elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__) || (defined (__SH5__) && ! defined __SH4_NOFPU__) + !! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4 + +@@ -1135,6 +1280,7 @@ + .mode SHcompact + #endif + .global GLOBAL(udivsi3_i4) ++ FUNC(GLOBAL(udivsi3_i4)) + GLOBAL(udivsi3_i4): + mov #1,r1 + cmp/hi r1,r5 +@@ -1183,6 +1329,8 @@ + #endif + .double 2147483648 + ++ ENDFUNC(GLOBAL(udivsi3_i4)) ++ + #endif /* ! __SH5__ || __SH5__ == 32 */ + #endif /* ! __SH4__ */ + #endif +@@ -1199,6 +1347,7 @@ + + !! args in r4 and r5, result in r0, clobbers r4, pr, and t bit + .global GLOBAL(udivsi3) ++ FUNC(GLOBAL(udivsi3)) + + #if __SHMEDIA__ + #if __SH5__ == 32 +@@ -1299,6 +1448,8 @@ + ret: rts + mov r4,r0 + ++ ENDFUNC(GLOBAL(udivsi3)) ++ + #endif /* ! __SHMEDIA__ */ + #endif /* __SH4__ */ + #endif +@@ -1308,6 +1459,7 @@ + .mode SHcompact + #endif + .global GLOBAL(set_fpscr) ++ FUNC(GLOBAL(set_fpscr)) + GLOBAL(set_fpscr): + lds r4,fpscr + mov.l LOCAL(set_fpscr_L1),r1 +@@ -1340,11 +1492,16 @@ + .align 2 + LOCAL(set_fpscr_L1): + .long GLOBAL(fpscr_values) ++ ++ ENDFUNC(GLOBAL(set_fpscr)) ++ ++#ifndef NO_FPSCR_VALUES + #ifdef __ELF__ + .comm GLOBAL(fpscr_values),8,4 + #else + .comm GLOBAL(fpscr_values),8 + #endif /* ELF */ ++#endif /* NO_FPSCR_VALUES */ + #endif /* SH3E / SH4 */ + #endif /* L_set_fpscr */ + #ifdef L_ic_invalidate +@@ -1360,6 +1517,7 @@ + blink tr0, r63 + #elif defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) + .global GLOBAL(ic_invalidate) ++ FUNC(GLOBAL(ic_invalidate)) + GLOBAL(ic_invalidate): + ocbwb @r4 + mova 0f,r0 +@@ -1382,6 +1540,9 @@ + nop + .endr + .endr ++ ++ ENDFUNC(GLOBAL(ic_invalidate)) ++ + #endif /* SH4 */ + #endif /* L_ic_invalidate */ + +diff -ruN gcc-20030210.orig/gcc/config/sh/libgcc-glibc.ver gcc-20030210/gcc/config/sh/libgcc-glibc.ver +--- gcc-20030210.orig/gcc/config/sh/libgcc-glibc.ver Thu Jan 1 09:00:00 1970 ++++ gcc-20030210/gcc/config/sh/libgcc-glibc.ver Sat Feb 22 01:40:14 2003 +@@ -0,0 +1,21 @@ ++# In order to work around the very problems that force us to now generally ++# create a libgcc.so, glibc reexported a number of routines from libgcc.a. ++# By now choosing the same version tags for these specific routines, we ++# maintain enough binary compatibility to allow future versions of glibc ++# to defer implementation of these routines to libgcc.so via DT_AUXILIARY. ++ ++# Note that we cannot use the default libgcc-glibc.ver file on sh, ++# because GLIBC_2.0 does not exist on this architecture, as the first ++# ever glibc release on the platform was GLIBC_2.2. ++ ++%inherit GCC_3.0 GLIBC_2.2 ++GLIBC_2.2 { ++ __register_frame ++ __register_frame_table ++ __deregister_frame ++ __register_frame_info ++ __deregister_frame_info ++ __frame_state_for ++ __register_frame_info_table ++} ++ +diff -ruN gcc-20030210.orig/gcc/config/sh/linux.h gcc-20030210/gcc/config/sh/linux.h +--- gcc-20030210.orig/gcc/config/sh/linux.h Tue Apr 16 05:27:42 2002 ++++ gcc-20030210/gcc/config/sh/linux.h Sat Feb 22 01:40:14 2003 +@@ -19,6 +19,10 @@ + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + ++/* We're not SYSVR4, not having /usr/ccs */ ++#undef MD_EXEC_PREFIX ++#undef MD_STARTFILE_PREFIX ++ + /* Run-time Target Specification. */ + #undef TARGET_VERSION + #define TARGET_VERSION fputs (" (SH GNU/Linux with ELF)", stderr); +@@ -39,6 +43,28 @@ + #undef WCHAR_TYPE_SIZE + #define WCHAR_TYPE_SIZE BITS_PER_WORD + ++/* This was defined in linux.h. Define it here also. */ ++#undef DEFAULT_VTABLE_THUNKS ++#define DEFAULT_VTABLE_THUNKS 1 ++ ++/* Likewise. */ ++#define HANDLE_PRAGMA_PACK_PUSH_POP ++ ++/* Pick up the return address upon entry to a procedure. Used for ++ dwarf2 unwind information. This also enables the table driven ++ mechanism. */ ++ ++#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, PR_REG) ++#define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (PR_REG) ++ ++#undef CPP_SPEC ++#define CPP_SPEC "\ ++ %{m4:-D__SH4__} \ ++ %{!m4:%(cpp_default_cpu_spec)} \ ++ %(subtarget_cpp_spec) \ ++ %(subtarget_cpp_ptr_spec) \ ++ %(subtarget_cpp_endian_spec) " ++ + #undef SUBTARGET_CPP_SPEC + #define SUBTARGET_CPP_SPEC "\ + %{fPIC:-D__PIC__ -D__pic__} \ +@@ -55,36 +81,45 @@ + #undef CPP_DEFAULT_CPU_SPEC + #define CPP_DEFAULT_CPU_SPEC "-D__SH3__ -D__sh3__" + +- + #undef CPP_PREDEFINES + #define CPP_PREDEFINES "-D__ELF__ -Dunix -D__sh__ -D__gnu_linux__ -Dlinux -Asystem=posix" + ++/* The GNU C++ standard library requires that these macros be defined. */ ++#undef CPLUSPLUS_CPP_SPEC ++#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" ++ + #undef ASM_SPEC +-#define ASM_SPEC "%{!mb:-little} %{mrelax:-relax}" ++#define ASM_SPEC "%{mb:-big} %{!mb:-little} %{mrelax:-relax}" + + #undef CC1_SPEC + #define CC1_SPEC \ +- "-musermode %{!mb:-ml} %{!m3e:%{!m4:-m3}}" +- +-#undef CC1PLUS_SPEC +-#define CC1PLUS_SPEC \ +- "-musermode %{!mb:-ml} %{!m3e:%{!m4:-m3}}" ++ "-musermode %{!mb:-ml} %{!m4:-m3} %{profile:-p}" + ++/* XXX: It's wrong if prefix != /usr */ + #undef LINK_SPEC + #define LINK_SPEC \ +- "%{!mb:-m shlelf_linux} %{mrelax:-relax} \ ++ "%{!mb:-m shlelf_linux -EL} %{mb:-m shelf_linux -EB} %{mrelax:-relax} \ + %{shared:-shared} \ + %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ +- %{!rpath:-rpath /lib}} \ ++ %{!mb:%{!m4:-rpath-link /usr/sh-linux/lib }} \ ++ %{!mb:%{m4:-rpath-link /usr/sh-linux/lib/m4 }} \ ++ %{mb:%{!m4:-rpath-link /usr/sh-linux/lib/mb }} \ ++ %{mb:%{m4:-rpath-link /usr/sh-linux/lib/mb/m4 }}} \ + %{static:-static}" + + #undef LIB_SPEC ++#undef LIB_SPEC + #define LIB_SPEC \ + "%{shared: -lc} \ +- %{!shared: %{pthread:-lthread} \ +- %{profile:-lc_p} %{!profile: -lc}}" ++ %{!shared: %{mieee:-lieee} %{pthread:-lpthread} \ ++ %{profile:-lc_p} %{!profile: -lc}}" ++ ++#if defined(HAVE_LD_EH_FRAME_HDR) ++#undef LINK_EH_SPEC ++#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " ++#endif + + #undef STARTFILE_SPEC + #define STARTFILE_SPEC \ +@@ -92,4 +127,40 @@ + %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \ + %{!p:%{profile:gcrt1.o%s} \ + %{!profile:crt1.o%s}}}} \ +- crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" ++ crti.o%s %{static:crtbeginT.o%s}\ ++ %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}" ++ ++#undef FUNCTION_PROFILER ++#define FUNCTION_PROFILER(STREAM,LABELNO) \ ++do \ ++{ \ ++ if (flag_pic) \ ++ { \ ++ fprintf (STREAM, " mov.l 3f,r1\n"); \ ++ fprintf (STREAM, " mova 3f,r0\n"); \ ++ fprintf (STREAM, " add r1,r0\n"); \ ++ fprintf (STREAM, " mov.l 1f,r1\n"); \ ++ fprintf (STREAM, " mov.l @(r0,r1),r1\n"); \ ++ } \ ++ else \ ++ { \ ++ fprintf (STREAM, " mov.l 1f,r1\n"); \ ++ } \ ++ fprintf (STREAM, " sts.l pr,@-r15\n"); \ ++ fprintf (STREAM, " mova 2f,r0\n"); \ ++ fprintf (STREAM, " jmp @r1\n"); \ ++ fprintf (STREAM, " lds r0,pr\n"); \ ++ fprintf (STREAM, " .align 2\n"); \ ++ if (flag_pic) \ ++ { \ ++ fprintf (STREAM, "1: .long mcount@GOT\n"); \ ++ fprintf (STREAM, "3: .long _GLOBAL_OFFSET_TABLE_\n"); \ ++ } \ ++ else \ ++ { \ ++ fprintf (STREAM, "1: .long mcount\n"); \ ++ } \ ++ fprintf (STREAM, "2: lds.l @r15+,pr\n"); \ ++} while (0) ++ ++#define NO_SHARED_LIBGCC_MULTILIB +diff -ruN gcc-20030210.orig/gcc/config/sh/sh-protos.h gcc-20030210/gcc/config/sh/sh-protos.h +--- gcc-20030210.orig/gcc/config/sh/sh-protos.h Fri Feb 22 01:42:28 2002 ++++ gcc-20030210/gcc/config/sh/sh-protos.h Sat Feb 22 01:40:14 2003 +@@ -74,6 +74,7 @@ + extern int shl_sext_length PARAMS ((rtx)); + extern int gen_shl_sext PARAMS ((rtx, rtx, rtx, rtx)); + extern rtx gen_datalabel_ref PARAMS ((rtx)); ++extern int shl_casesi_worker_length PARAMS ((rtx)); + extern int regs_used PARAMS ((rtx, int)); + extern void fixup_addr_diff_vecs PARAMS ((rtx)); + extern int get_dest_uid PARAMS ((rtx, int)); +diff -ruN gcc-20030210.orig/gcc/config/sh/sh.c gcc-20030210/gcc/config/sh/sh.c +--- gcc-20030210.orig/gcc/config/sh/sh.c Fri Feb 22 01:42:28 2002 ++++ gcc-20030210/gcc/config/sh/sh.c Sat Feb 22 01:40:14 2003 +@@ -2143,6 +2143,48 @@ + return sym; + } + ++ ++/* Function to be used in the length attribute of the casesi_worker ++ instruction. Returns number of instructions, which is half of the ++ length of bytes. */ ++ ++int ++shl_casesi_worker_length (insn) ++ rtx insn; ++{ ++ rtx set_src, label; ++ rtx diff_vec; ++ ++ set_src = SET_SRC (XVECEXP (PATTERN (insn), 0, 0)); ++ if (!(GET_CODE (set_src) == UNSPEC ++ && XINT (set_src, 1) == UNSPEC_CASESI)) ++ abort (); ++ ++ label = XVECEXP (set_src, 0, 2); ++ if (GET_CODE (label) != LABEL_REF) ++ abort (); ++ ++ diff_vec = PATTERN (next_real_insn (XEXP (label, 0))); ++ ++ if (GET_CODE (diff_vec) != ADDR_DIFF_VEC) ++ abort (); ++ ++ switch (GET_MODE (diff_vec)) ++ { ++ case SImode: ++ return 2; ++ case HImode: ++ if (ADDR_DIFF_VEC_FLAGS (diff_vec).offset_unsigned) ++ return 3; ++ return 2; ++ case QImode: ++ if (ADDR_DIFF_VEC_FLAGS (diff_vec).offset_unsigned) ++ return 2; ++ return 1; ++ default: ++ abort (); ++ } ++} + + /* The SH cannot load a large constant into a register, constants have to + come from a pc relative load. The reference of a pc relative load +@@ -3190,7 +3232,7 @@ + vec_lab = XEXP (XEXP (pat, 0), 0); + + /* Search the matching casesi_jump_2. */ +- for (prev = vec_lab; ; prev = PREV_INSN (prev)) ++ for (prev = vec_lab; prev; prev = PREV_INSN (prev)) + { + if (GET_CODE (prev) != JUMP_INSN) + continue; +@@ -3205,6 +3247,13 @@ + break; + } + ++ if (prev == NULL) ++ { /* Switch statement has been optimized out. */ ++ delete_insn (PREV_INSN (insn)); ++ delete_insn (insn); ++ continue; ++ } ++ + /* Emit the reference label of the braf where it belongs, right after + the casesi_jump_2 (i.e. braf). */ + braf_label = XEXP (XEXP (SET_SRC (XVECEXP (prevpat, 0, 0)), 1), 0); +@@ -3223,7 +3272,7 @@ + rtx barrier_or_label; + { + rtx next = next_real_insn (barrier_or_label), pat, prev; +- int slot, credit, jump_to_next; ++ int slot, credit, jump_to_next = 0; + + if (! next) + return 0; +@@ -4507,7 +4556,8 @@ + if (current_function_varargs || current_function_stdarg) + { + /* This is not used by the SH3E calling convention */ +- if (TARGET_SH1 && ! TARGET_SH3E && ! TARGET_SH5 && ! TARGET_HITACHI) ++ if (TARGET_SH1 && ! TARGET_SH3E && ! TARGET_SH5 && ! TARGET_HITACHI ++ || TARGET_NO_IMPLICIT_FP) + { + /* Push arg regs as if they'd been provided by caller in stack. */ + for (i = 0; i < NPARM_REGS(SImode); i++) +@@ -5149,7 +5199,8 @@ + tree f_next_o, f_next_o_limit, f_next_fp, f_next_fp_limit, f_next_stack; + tree record; + +- if (TARGET_SH5 || (! TARGET_SH3E && ! TARGET_SH4) || TARGET_HITACHI) ++ if (TARGET_SH5 || (! TARGET_SH3E && ! TARGET_SH4) || TARGET_HITACHI ++ || TARGET_NO_IMPLICIT_FP) + return ptr_type_node; + + record = make_node (RECORD_TYPE); +@@ -5211,7 +5262,8 @@ + return; + } + +- if ((! TARGET_SH3E && ! TARGET_SH4) || TARGET_HITACHI) ++ if ((! TARGET_SH3E && ! TARGET_SH4) ++ || TARGET_HITACHI || TARGET_NO_IMPLICIT_FP) + { + std_expand_builtin_va_start (stdarg_p, valist, nextarg); + return; +@@ -5289,7 +5341,8 @@ + rsize = (size + UNITS_PER_WORD - 1) & -UNITS_PER_WORD; + pptr_type_node = build_pointer_type (ptr_type_node); + +- if (! TARGET_SH5 && (TARGET_SH3E || TARGET_SH4) && ! TARGET_HITACHI) ++ if (! TARGET_SH5 && (TARGET_SH3E || TARGET_SH4) ++ && ! TARGET_HITACHI && ! TARGET_NO_IMPLICIT_FP) + { + tree f_next_o, f_next_o_limit, f_next_fp, f_next_fp_limit, f_next_stack; + tree next_o, next_o_limit, next_fp, next_fp_limit, next_stack; +diff -ruN gcc-20030210.orig/gcc/config/sh/sh.h gcc-20030210/gcc/config/sh/sh.h +--- gcc-20030210.orig/gcc/config/sh/sh.h Fri Feb 22 01:42:28 2002 ++++ gcc-20030210/gcc/config/sh/sh.h Sat Feb 22 01:40:14 2003 +@@ -147,10 +147,10 @@ + #define HARD_SH4_BIT (1<<5) + #define FPU_SINGLE_BIT (1<<7) + #define SH4_BIT (1<<12) ++#define NO_IMPLICIT_FP_BIT (1<<3) + #define FMOVD_BIT (1<<4) + #define SH5_BIT (1<<0) + #define SPACE_BIT (1<<13) +-#define BIGTABLE_BIT (1<<14) + #define RELAX_BIT (1<<15) + #define USERMODE_BIT (1<<16) + #define HITACHI_BIT (1<<22) +@@ -205,6 +205,9 @@ + /* Nonzero if we should generate code for a SH5 CPU (either ISA). */ + #define TARGET_SH5 (target_flags & SH5_BIT) + ++/* Nonzero if we should not use FPU implicitly. */ ++#define TARGET_NO_IMPLICIT_FP (target_flags & NO_IMPLICIT_FP_BIT) ++ + /* Nonzero if we should generate code using the SHcompact instruction + set and 32-bit ABI. */ + #define TARGET_SHCOMPACT (TARGET_SH5 && TARGET_SH1) +@@ -225,6 +228,7 @@ + + /* Nonzero if we should generate code using SHmedia FPU instructions. */ + #define TARGET_SHMEDIA_FPU (TARGET_SHMEDIA && TARGET_FPU_DOUBLE) ++ + /* Nonzero if we should generate fmovd. */ + #define TARGET_FMOVD (target_flags & FMOVD_BIT) + +@@ -234,9 +238,6 @@ + /* Nonzero if we should generate smaller code rather than faster code. */ + #define TARGET_SMALLCODE (target_flags & SPACE_BIT) + +-/* Nonzero to use long jump tables. */ +-#define TARGET_BIGTABLE (target_flags & BIGTABLE_BIT) +- + /* Nonzero to generate pseudo-ops needed by the assembler and linker + to do function call relaxing. */ + #define TARGET_RELAX (target_flags & RELAX_BIT) +@@ -297,7 +298,6 @@ + {"5-compact-nofpu", TARGET_NONE, "" }, \ + {"5-compact-nofpu", SH5_BIT|SH3_BIT|SH2_BIT|SH1_BIT, "Generate FPU-less SHcompact code" }, \ + {"b", -LITTLE_ENDIAN_BIT, "" }, \ +- {"bigtable", BIGTABLE_BIT, "" }, \ + {"dalign", DALIGN_BIT, "" }, \ + {"fmovd", FMOVD_BIT, "" }, \ + {"hitachi", HITACHI_BIT, "" }, \ +@@ -306,6 +306,7 @@ + {"isize", ISIZE_BIT, "" }, \ + {"l", LITTLE_ENDIAN_BIT, "" }, \ + {"no-ieee", -IEEE_BIT, "" }, \ ++ {"no-implicit-fp", NO_IMPLICIT_FP_BIT, "" }, \ + {"padstruct", PADSTRUCT_BIT, "" }, \ + {"prefergot", PREFERGOT_BIT, "" }, \ + {"relax", RELAX_BIT, "" }, \ +@@ -2493,16 +2494,22 @@ + goto LABEL; \ + } + ++extern int optimize; /* needed for gen_casesi. */ ++extern int optimize_size; ++ + /* Specify the machine mode that this machine uses + for the index in the tablejump instruction. */ +-#define CASE_VECTOR_MODE (TARGET_BIGTABLE ? SImode : HImode) ++#define CASE_VECTOR_MODE SImode + + #define CASE_VECTOR_SHORTEN_MODE(MIN_OFFSET, MAX_OFFSET, BODY) \ + ((MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 127 \ + ? (ADDR_DIFF_VEC_FLAGS (BODY).offset_unsigned = 0, QImode) \ + : (MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 255 \ + ? (ADDR_DIFF_VEC_FLAGS (BODY).offset_unsigned = 1, QImode) \ +- : (MIN_OFFSET) >= -32768 && (MAX_OFFSET) <= 32767 ? HImode \ ++ : (MIN_OFFSET) >= -32768 && (MAX_OFFSET) <= 32767 \ ++ ? (ADDR_DIFF_VEC_FLAGS (BODY).offset_unsigned = 0, HImode) \ ++ : optimize_size && (MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 65535 \ ++ ? (ADDR_DIFF_VEC_FLAGS (BODY).offset_unsigned = 1, HImode) \ + : SImode) + + /* Define as C expression which evaluates to nonzero if the tablejump +@@ -3038,10 +3045,7 @@ + /* Output an absolute table element. */ + + #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM,VALUE) \ +- if (TARGET_BIGTABLE) \ +- asm_fprintf ((STREAM), "\t.long\t%LL%d\n", (VALUE)); \ +- else \ +- asm_fprintf ((STREAM), "\t.word\t%LL%d\n", (VALUE)); \ ++ asm_fprintf ((STREAM), "\t.long\t%LL%d\n", (VALUE)) + + /* Output various types of constants. */ + +@@ -3167,8 +3171,6 @@ + #define sh_cpu_attr ((enum attr_cpu)sh_cpu) + extern enum processor_type sh_cpu; + +-extern int optimize; /* needed for gen_casesi. */ +- + enum mdep_reorg_phase_e + { + SH_BEFORE_MDEP_REORG, +diff -ruN gcc-20030210.orig/gcc/config/sh/sh.md gcc-20030210/gcc/config/sh/sh.md +--- gcc-20030210.orig/gcc/config/sh/sh.md Sat Nov 23 04:58:06 2002 ++++ gcc-20030210/gcc/config/sh/sh.md Sat Feb 22 01:40:14 2003 +@@ -1242,7 +1242,7 @@ + (clobber (reg:SI PR_REG)) + (clobber (reg:SI R4_REG)) + (use (match_operand:SI 1 "arith_reg_operand" "r"))] +- "TARGET_SH1 && ! TARGET_SH4" ++ "TARGET_SH1 && ! TARGET_SH4 || TARGET_NO_IMPLICIT_FP" + "jsr @%1%#" + [(set_attr "type" "sfunc") + (set_attr "needs_delay_slot" "yes")]) +@@ -1336,7 +1336,7 @@ + + operands[3] = gen_reg_rtx (Pmode); + /* Emit the move of the address to a pseudo outside of the libcall. */ +- if (TARGET_HARD_SH4 && TARGET_SH3E) ++ if (TARGET_HARD_SH4 && TARGET_SH3E && !TARGET_NO_IMPLICIT_FP) + { + emit_move_insn (operands[3], + gen_rtx_SYMBOL_REF (SImode, \"__udivsi3_i4\")); +@@ -1391,7 +1391,7 @@ + (clobber (reg:SI R2_REG)) + (clobber (reg:SI R3_REG)) + (use (match_operand:SI 1 "arith_reg_operand" "r"))] +- "TARGET_SH1 && ! TARGET_SH4" ++ "TARGET_SH1 && ! TARGET_SH4 || TARGET_NO_IMPLICIT_FP" + "jsr @%1%#" + [(set_attr "type" "sfunc") + (set_attr "needs_delay_slot" "yes")]) +@@ -1476,7 +1476,7 @@ + + operands[3] = gen_reg_rtx (Pmode); + /* Emit the move of the address to a pseudo outside of the libcall. */ +- if (TARGET_HARD_SH4 && TARGET_SH3E) ++ if (TARGET_HARD_SH4 && TARGET_SH3E && !TARGET_NO_IMPLICIT_FP) + { + emit_move_insn (operands[3], + gen_rtx_SYMBOL_REF (SImode, \"__sdivsi3_i4\")); +@@ -6446,6 +6446,8 @@ + case SImode: + return \"shll2 %1\;mov.l @(r0,%1),%0\"; + case HImode: ++ if (ADDR_DIFF_VEC_FLAGS (diff_vec).offset_unsigned) ++ return \"add %1,%1\;mov.w @(r0,%1),%0\;extu.w %0,%0\"; + return \"add %1,%1\;mov.w @(r0,%1),%0\"; + case QImode: + if (ADDR_DIFF_VEC_FLAGS (diff_vec).offset_unsigned) +@@ -6455,7 +6457,15 @@ + abort (); + } + }" +- [(set_attr "length" "4")]) ++ [(set (attr "length") ++ (cond [(eq (symbol_ref "shl_casesi_worker_length (insn)") (const_int 1)) ++ (const_string "2") ++ (eq (symbol_ref "shl_casesi_worker_length (insn)") (const_int 2)) ++ (const_string "4") ++ ;; Put "match_dup" here so that insn_variable_length_p return 1. ++ (ne (match_dup 2) (match_dup 2)) ++ (const_string "4")] ++ (const_string "6")))]) + + (define_insn "casesi_shift_media" + [(set (match_operand 0 "arith_reg_operand" "=r") +diff -ruN gcc-20030210.orig/gcc/config/sh/sh3-linux.h gcc-20030210/gcc/config/sh/sh3-linux.h +--- gcc-20030210.orig/gcc/config/sh/sh3-linux.h Thu Jan 1 09:00:00 1970 ++++ gcc-20030210/gcc/config/sh/sh3-linux.h Sat Feb 22 01:40:14 2003 +@@ -0,0 +1,29 @@ ++#undef TARGET_VERSION ++#define TARGET_VERSION fputs (" (SH3 GNU/Linux with ELF)", stderr); ++ ++#undef CPP_SPEC ++#define CPP_SPEC \ ++ "-D__LITTLE_ENDIAN__ \ ++ -D__SH3__ -D__sh3__ \ ++ -D__SIZE_TYPE__=unsigned\\ int \ ++ -D__PTRDIFF_TYPE__=int \ ++ %{fPIC:-D__PIC__ -D__pic__} \ ++ %{fpic:-D__PIC__ -D__pic__} \ ++ %{posix:-D_POSIX_SOURCE} \ ++ %{pthread:-D_REENTRANT -D_PTHREADS}" ++ ++#undef ASM_SPEC ++#define ASM_SPEC "%{mrelax:-relax}" ++ ++#undef CC1_SPEC ++#define CC1_SPEC \ ++ "-musermode -ml -m3 %{profile:-p}" ++ ++#undef LINK_SPEC ++#define LINK_SPEC \ ++ "%{mrelax:-relax} \ ++ %{shared:-shared} \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ ++ %{static:-static}" +diff -ruN gcc-20030210.orig/gcc/config/sh/sh3eb-linux.h gcc-20030210/gcc/config/sh/sh3eb-linux.h +--- gcc-20030210.orig/gcc/config/sh/sh3eb-linux.h Thu Jan 1 09:00:00 1970 ++++ gcc-20030210/gcc/config/sh/sh3eb-linux.h Sat Feb 22 01:40:14 2003 +@@ -0,0 +1,29 @@ ++#undef TARGET_VERSION ++#define TARGET_VERSION fputs (" (SH3EB GNU/Linux with ELF)", stderr); ++ ++#undef CPP_SPEC ++#define CPP_SPEC \ ++ "-D__BIG_ENDIAN__ \ ++ -D__SH3__ -D__sh3__ \ ++ -D__SIZE_TYPE__=unsigned\\ int \ ++ -D__PTRDIFF_TYPE__=int \ ++ %{fPIC:-D__PIC__ -D__pic__} \ ++ %{fpic:-D__PIC__ -D__pic__} \ ++ %{posix:-D_POSIX_SOURCE} \ ++ %{pthread:-D_REENTRANT -D_PTHREADS}" ++ ++#undef ASM_SPEC ++#define ASM_SPEC "%{mrelax:-relax}" ++ ++#undef CC1_SPEC ++#define CC1_SPEC \ ++ "-musermode -mb -m3 %{profile:-p}" ++ ++#undef LINK_SPEC ++#define LINK_SPEC \ ++ "%{mrelax:-relax} \ ++ %{shared:-shared} \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ ++ %{static:-static}" +diff -ruN gcc-20030210.orig/gcc/config/sh/sh4-linux.h gcc-20030210/gcc/config/sh/sh4-linux.h +--- gcc-20030210.orig/gcc/config/sh/sh4-linux.h Thu Jan 1 09:00:00 1970 ++++ gcc-20030210/gcc/config/sh/sh4-linux.h Sat Feb 22 01:40:14 2003 +@@ -0,0 +1,29 @@ ++#undef TARGET_VERSION ++#define TARGET_VERSION fputs (" (SH4 GNU/Linux with ELF)", stderr); ++ ++#undef CPP_SPEC ++#define CPP_SPEC \ ++ "-D__LITTLE_ENDIAN__ \ ++ -D__SH4__ \ ++ -D__SIZE_TYPE__=unsigned\\ int \ ++ -D__PTRDIFF_TYPE__=int \ ++ %{fPIC:-D__PIC__ -D__pic__} \ ++ %{fpic:-D__PIC__ -D__pic__} \ ++ %{posix:-D_POSIX_SOURCE} \ ++ %{pthread:-D_REENTRANT -D_PTHREADS}" ++ ++#undef ASM_SPEC ++#define ASM_SPEC "%{mrelax:-relax}" ++ ++#undef CC1_SPEC ++#define CC1_SPEC \ ++ "-musermode -ml -m4 %{profile:-p}" ++ ++#undef LINK_SPEC ++#define LINK_SPEC \ ++ "%{mrelax:-relax} \ ++ %{shared:-shared} \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ ++ %{static:-static}" +diff -ruN gcc-20030210.orig/gcc/config/sh/sh4eb-linux.h gcc-20030210/gcc/config/sh/sh4eb-linux.h +--- gcc-20030210.orig/gcc/config/sh/sh4eb-linux.h Thu Jan 1 09:00:00 1970 ++++ gcc-20030210/gcc/config/sh/sh4eb-linux.h Sat Feb 22 01:40:14 2003 +@@ -0,0 +1,29 @@ ++#undef TARGET_VERSION ++#define TARGET_VERSION fputs (" (SH4EB GNU/Linux with ELF)", stderr); ++ ++#undef CPP_SPEC ++#define CPP_SPEC \ ++ "-D__BIG_ENDIAN__ \ ++ -D__SH4__ \ ++ -D__SIZE_TYPE__=unsigned\\ int \ ++ -D__PTRDIFF_TYPE__=int \ ++ %{fPIC:-D__PIC__ -D__pic__} \ ++ %{fpic:-D__PIC__ -D__pic__} \ ++ %{posix:-D_POSIX_SOURCE} \ ++ %{pthread:-D_REENTRANT -D_PTHREADS}" ++ ++#undef ASM_SPEC ++#define ASM_SPEC "%{mrelax:-relax}" ++ ++#undef CC1_SPEC ++#define CC1_SPEC \ ++ "-musermode -mb -m4 %{profile:-p}" ++ ++#undef LINK_SPEC ++#define LINK_SPEC \ ++ "%{mrelax:-relax} \ ++ %{shared:-shared} \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ ++ %{static:-static}" +diff -ruN gcc-20030210.orig/gcc/config/sh/t-linux gcc-20030210/gcc/config/sh/t-linux +--- gcc-20030210.orig/gcc/config/sh/t-linux Thu May 17 12:16:12 2001 ++++ gcc-20030210/gcc/config/sh/t-linux Sat Feb 22 01:40:14 2003 +@@ -1,10 +1,20 @@ +-TARGET_LIBGCC2_CFLAGS = -fpic ++TARGET_LIBGCC2_CFLAGS = -fpic -DNO_FPSCR_VALUES ++LIBGCC1 = libgcc1-asm.a ++CROSS_LIBGCC1 = libgcc1-asm.a ++LIBGCC1_TEST = libgcc1-test + LIB1ASMFUNCS = _ashiftrt _ashiftrt_n _ashiftlt _lshiftrt _movstr \ + _movstr_i4 _mulsi3 _sdivsi3 _sdivsi3_i4 _udivsi3 _udivsi3_i4 _set_fpscr \ + _ic_invalidate ++LIB2ADDEH = $(srcdir)/unwind-sjlj.c ++LIB2ADDEHDEP = unwind.inc unwind-sjlj.c + +-MULTILIB_OPTIONS= mb m3e/m4 ++MULTILIB_OPTIONS= mb m4 + MULTILIB_DIRNAMES= + MULTILIB_MATCHES = + +-EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o ++EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o ++ ++# Override t-slibgcc-elf-ver to export some libgcc symbols with ++# the symbol versions that glibc used and SH specific. ++SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver \ ++ $(srcdir)/config/sh/libgcc-glibc.ver +diff -ruN gcc-20030210.orig/gcc/config/sh/t-linux-nomulti gcc-20030210/gcc/config/sh/t-linux-nomulti +--- gcc-20030210.orig/gcc/config/sh/t-linux-nomulti Thu Jan 1 09:00:00 1970 ++++ gcc-20030210/gcc/config/sh/t-linux-nomulti Sat Feb 22 01:40:14 2003 +@@ -0,0 +1,9 @@ ++LIBGCC = libgcc.a ++EXTRA_PARTS = crtbegin.o crtbeginS.o crtend.o crtendS.o crtbeginT.o ++ ++INSTALL_LIBGCC = install-libgcc ++ ++MULTILIB_OPTIONS= ++MULTILIB_DIRNAMES= ++MULTILIB_MATCHES = ++EXTRA_MULTILIB_PARTS= +diff -ruN gcc-20030210.orig/gcc/config.gcc gcc-20030210/gcc/config.gcc +--- gcc-20030210.orig/gcc/config.gcc Fri Jan 31 19:17:13 2003 ++++ gcc-20030210/gcc/config.gcc Sat Feb 22 01:40:14 2003 +@@ -337,9 +337,9 @@ + sparc*-*-*) + cpu_type=sparc + ;; +-sh64-*-*) +- cpu_type=sh +- ;; ++sh*-*-*) ++ cpu_type=sh ++ ;; + esac + + tm_file=${cpu_type}/${cpu_type}.h +@@ -3018,9 +3018,31 @@ + thread_file='rtems' + fi + ;; +-sh-*-linux*) ++sh*-*-linux*) + tm_file="${tm_file} sh/elf.h sh/linux.h" +- tmake_file="sh/t-sh sh/t-elf sh/t-linux" ++ tmake_file="sh/t-sh sh/t-elf t-slibgcc-elf-ver t-linux sh/t-linux" ++ extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o" ++ case $machine in ++ sh3eb-*) ++ tm_file="${tm_file} sh/sh3eb-linux.h" ++ tmake_file="${tmake_file} sh/t-linux-nomulti" ++ ;; ++ sh4eb-*) ++ tm_file="${tm_file} sh/sh4eb-linux.h" ++ tmake_file="${tmake_file} sh/t-linux-nomulti" ++ ;; ++ sh3-*) ++ tm_file="${tm_file} sh/sh3-linux.h" ++ tmake_file="${tmake_file} sh/t-linux-nomulti" ++ ;; ++ sh4-*) ++ tm_file="${tm_file} sh/sh4-linux.h" ++ tmake_file="${tmake_file} sh/t-linux-nomulti" ++ ;; ++ *) ++ ;; ++ esac ++ xmake_file=x-linux + gas=yes gnu_ld=yes + float_format=sh + ;; +diff -ruN gcc-20030210.orig/gcc/dwarf2out.c gcc-20030210/gcc/dwarf2out.c +--- gcc-20030210.orig/gcc/dwarf2out.c Mon Feb 10 19:36:25 2003 ++++ gcc-20030210/gcc/dwarf2out.c Sat Feb 22 01:40:14 2003 +@@ -10224,7 +10224,9 @@ + /* We can have a normal definition following an inline one in the + case of redefinition of GNU C extern inlines. + It seems reasonable to use AT_specification in this case. */ +- && !get_AT_unsigned (old_die, DW_AT_inline)) ++ && !get_AT_unsigned (old_die, DW_AT_inline) ++ /* Skip the nested function. */ ++ && !decl_function_context (decl)) + { + /* ??? This can happen if there is a bug in the program, for + instance, if it has duplicate function definitions. Ideally, +diff -ruN gcc-20030210.orig/gcc/final.c gcc-20030210/gcc/final.c +--- gcc-20030210.orig/gcc/final.c Fri Jan 31 19:17:20 2003 ++++ gcc-20030210/gcc/final.c Sat Feb 22 01:40:14 2003 +@@ -1128,7 +1128,7 @@ + } + } + +- INSN_ADDRESSES (uid) = insn_current_address; ++ INSN_ADDRESSES (uid) = insn_current_address + insn_lengths[uid]; + + if (GET_CODE (insn) == NOTE || GET_CODE (insn) == BARRIER + || GET_CODE (insn) == CODE_LABEL) +diff -ruN gcc-20030210.orig/gcc/mkmap-symver.awk gcc-20030210/gcc/mkmap-symver.awk +--- gcc-20030210.orig/gcc/mkmap-symver.awk Fri Jan 31 19:17:26 2003 ++++ gcc-20030210/gcc/mkmap-symver.awk Sat Feb 22 01:40:14 2003 +@@ -89,7 +89,11 @@ + output(inherit[lib]); + + printf("%s {\n", lib); +- printf(" global:\n"); ++ for (sym in ver) ++ if ((ver[sym] == lib) && (sym in def)) ++ count++; ++ if (count > 0) ++ printf(" global:\n"); + for (sym in ver) + if ((ver[sym] == lib) && (sym in def)) + { +diff -ruN gcc-20030210.orig/gcc/reload1.c gcc-20030210/gcc/reload1.c +--- gcc-20030210.orig/gcc/reload1.c Fri Jan 31 19:17:29 2003 ++++ gcc-20030210/gcc/reload1.c Sat Feb 22 01:40:14 2003 +@@ -6103,6 +6103,7 @@ + for (j = 0; j < n_reloads; j++) + if (rld[j].in != 0 + && rld[j].when_needed != RELOAD_OTHER ++ && rld[j].when_needed != RELOAD_FOR_OUTPUT_ADDRESS + && reg_overlap_mentioned_for_reload_p (rld[j].in, + rld[i].in)) + rld[j].when_needed +diff -ruN gcc-20030210.orig/gcc/reorg.c gcc-20030210/gcc/reorg.c +--- gcc-20030210.orig/gcc/reorg.c Fri Jan 31 19:17:30 2003 ++++ gcc-20030210/gcc/reorg.c Sat Feb 22 01:40:14 2003 +@@ -3265,6 +3265,14 @@ + || condjump_in_parallel_p (XVECEXP (PATTERN (insn), 0, 0)))) + continue; + ++#ifdef MD_CAN_REDIRECT_BRANCH ++ /* On some targets, branches with delay slots can have a limited ++ displacement. Give the back end a chance to tell us we can't do ++ this. */ ++ if (! MD_CAN_REDIRECT_BRANCH (insn, delay_insn)) ++ continue; ++#endif ++ + target_label = JUMP_LABEL (delay_insn); + + if (target_label) +diff -ruN gcc-20030210.orig/gcc/tree-inline.c gcc-20030210/gcc/tree-inline.c +--- gcc-20030210.orig/gcc/tree-inline.c Fri Jan 31 19:17:33 2003 ++++ gcc-20030210/gcc/tree-inline.c Sat Feb 22 01:40:14 2003 +@@ -836,11 +836,17 @@ + + /* Don't try to inline functions that are not well-suited to + inlining. */ +- if (!inlinable_function_p (fn, id)) +- return NULL_TREE; ++ if (! inlinable_function_p (fn, id) ++ || ! (*lang_hooks.tree_inlining.start_inlining) (fn)) ++ { ++ if (DECL_INLINE (fn) && warn_inline && ! flag_really_no_inline) ++ { ++ warning_with_decl (fn, "inlining failed in call to `%s'"); ++ warning ("called from here"); ++ } + +- if (! (*lang_hooks.tree_inlining.start_inlining) (fn)) +- return NULL_TREE; ++ return NULL_TREE; ++ } + + /* Set the current filename and line number to the function we are + inlining so that when we create new _STMT nodes here they get +diff -ruN gcc-20030210.orig/libjava/Makefile.in gcc-20030210/libjava/Makefile.in +--- gcc-20030210.orig/libjava/Makefile.in Tue Jan 28 10:44:37 2003 ++++ gcc-20030210/libjava/Makefile.in Sat Feb 22 01:40:14 2003 +@@ -1637,6 +1637,7 @@ + "AS=$(AS)" \ + "CC=$(CC)" \ + "CXX=$(CXX)" \ ++ "GCJ=$(GCJ)" \ + "LD=$(LD)" \ + "LIBCFLAGS=$(LIBCFLAGS)" \ + "NM=$(NM)" \ +diff -ruN gcc-20030210.orig/libjava/configure gcc-20030210/libjava/configure +--- gcc-20030210.orig/libjava/configure Tue Jan 28 10:44:37 2003 ++++ gcc-20030210/libjava/configure Sat Feb 22 01:42:11 2003 +@@ -2031,7 +2031,7 @@ + # This must be Linux ELF. + linux-gnu*) + case $host_cpu in +- alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) ++ alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | sh* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM +diff -ruN gcc-20030210.orig/libjava/java/net/natInetAddress.cc gcc-20030210/libjava/java/net/natInetAddress.cc +--- gcc-20030210.orig/libjava/java/net/natInetAddress.cc Tue Mar 5 05:02:19 2002 ++++ gcc-20030210/libjava/java/net/natInetAddress.cc Sat Feb 22 01:40:14 2003 +@@ -56,7 +56,7 @@ + #endif + + #ifndef HAVE_GETHOSTNAME_DECL +-extern "C" int gethostname (char *name, int namelen); ++extern "C" int gethostname (char *name, unsigned int namelen); + #endif + + #ifdef DISABLE_JAVA_NET +diff -ruN gcc-20030210.orig/libjava/libltdl/aclocal.m4 gcc-20030210/libjava/libltdl/aclocal.m4 +--- gcc-20030210.orig/libjava/libltdl/aclocal.m4 Sun Sep 10 17:04:40 2000 ++++ gcc-20030210/libjava/libltdl/aclocal.m4 Sat Feb 22 01:40:14 2003 +@@ -573,7 +573,7 @@ + # This must be Linux ELF. + linux-gnu*) + case "$host_cpu" in +- alpha* | i*86 | powerpc* | sparc* | ia64* ) ++ alpha* | i*86 | powerpc* | sparc* | ia64* | sh*) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM +diff -ruN gcc-20030210.orig/libjava/sysdep/sh/locks.h gcc-20030210/libjava/sysdep/sh/locks.h +--- gcc-20030210.orig/libjava/sysdep/sh/locks.h Thu Jan 1 09:00:00 1970 ++++ gcc-20030210/libjava/sysdep/sh/locks.h Sat Feb 22 01:40:14 2003 +@@ -0,0 +1,72 @@ ++// locks.h - Thread synchronization primitives. SuperH implementation. ++ ++/* Copyright (C) 2002 Free Software Foundation ++ ++ This file is part of libgcj. ++ ++This software is copyrighted work licensed under the terms of the ++Libgcj License. Please consult the file "LIBGCJ_LICENSE" for ++details. */ ++ ++#ifndef __SYSDEP_LOCKS_H__ ++#define __SYSDEP_LOCKS_H__ ++ ++typedef size_t obj_addr_t; /* Integer type big enough for object */ ++ /* address. */ ++ ++static unsigned char __cas_lock = 0; ++ ++inline static void ++__cas_start_atomic (void) ++{ ++ unsigned int val; ++ ++ do ++ __asm__ __volatile__ ("tas.b @%1; movt %0" ++ : "=r" (val) ++ : "r" (&__cas_lock) ++ : "memory"); ++ while (val == 0); ++} ++ ++inline static void ++__cas_end_atomic (void) ++{ ++ __asm__ __volatile__ (" " : : : "memory"); ++ __cas_lock = 0; ++} ++ ++inline static bool ++compare_and_swap (volatile obj_addr_t *addr, obj_addr_t old, ++ obj_addr_t new_val) ++{ ++ bool ret; ++ ++ __cas_start_atomic (); ++ if (*addr != old) ++ ret = false; ++ else ++ { ++ *addr = new_val; ++ ret = true; ++ } ++ __cas_end_atomic (); ++ ++ return ret; ++} ++ ++inline static void ++release_set (volatile obj_addr_t *addr, obj_addr_t new_val) ++{ ++ __asm__ __volatile__ (" " : : : "memory"); ++ *(addr) = new_val; ++} ++ ++inline static bool ++compare_and_swap_release (volatile obj_addr_t *addr, obj_addr_t old, ++ obj_addr_t new_val) ++{ ++ return compare_and_swap (addr, old, new_val); ++} ++ ++#endif /* ! __SYSDEP_LOCKS_H__ */ +diff -ruN gcc-20030210.orig/libstdc++-v3/acinclude.m4 gcc-20030210/libstdc++-v3/acinclude.m4 +--- gcc-20030210.orig/libstdc++-v3/acinclude.m4 Tue Jan 28 02:30:41 2003 ++++ gcc-20030210/libstdc++-v3/acinclude.m4 Sat Feb 22 01:40:14 2003 +@@ -1828,9 +1828,10 @@ + GLIBCPP_INCLUDES="-I${glibcpp_builddir}/include/${target_alias} -I${glibcpp_builddir}/include" + + # Passed down for canadian crosses. +- if test x"$CANADIAN" = xyes; then +- TOPLEVEL_INCLUDES='-I$(includedir)' +- fi ++ #if test x"$CANADIAN" = xyes; then ++ # TOPLEVEL_INCLUDES='-I$(includedir)' ++ #fi ++ TOPLEVEL_INCLUDES='' + + LIBMATH_INCLUDES='-I$(top_srcdir)/libmath' + +diff -ruN gcc-20030210.orig/libstdc++-v3/aclocal.m4 gcc-20030210/libstdc++-v3/aclocal.m4 +--- gcc-20030210.orig/libstdc++-v3/aclocal.m4 Mon Feb 10 19:36:47 2003 ++++ gcc-20030210/libstdc++-v3/aclocal.m4 Sat Feb 22 01:40:14 2003 +@@ -1840,9 +1840,10 @@ + GLIBCPP_INCLUDES="-I${glibcpp_builddir}/include/${target_alias} -I${glibcpp_builddir}/include" + + # Passed down for canadian crosses. +- if test x"$CANADIAN" = xyes; then +- TOPLEVEL_INCLUDES='-I$(includedir)' +- fi ++ #if test x"$CANADIAN" = xyes; then ++ # TOPLEVEL_INCLUDES='-I$(includedir)' ++ #fi ++ TOPLEVEL_INCLUDES='' + + LIBMATH_INCLUDES='-I$(top_srcdir)/libmath' + +diff -ruN gcc-20030210.orig/libstdc++-v3/configure gcc-20030210/libstdc++-v3/configure +--- gcc-20030210.orig/libstdc++-v3/configure Mon Feb 10 19:37:17 2003 ++++ gcc-20030210/libstdc++-v3/configure Sat Feb 22 01:40:14 2003 +@@ -1982,7 +1982,7 @@ + # This must be Linux ELF. + linux-gnu*) + case $host_cpu in +- alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) ++ alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | sh*) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM +@@ -22340,9 +22340,10 @@ + GLIBCPP_INCLUDES="-I${glibcpp_builddir}/include/${target_alias} -I${glibcpp_builddir}/include" + + # Passed down for canadian crosses. +- if test x"$CANADIAN" = xyes; then +- TOPLEVEL_INCLUDES='-I$(includedir)' +- fi ++ #if test x"$CANADIAN" = xyes; then ++ # TOPLEVEL_INCLUDES='-I$(includedir)' ++ #fi ++ TOPLEVEL_INCLUDES='' + + LIBMATH_INCLUDES='-I$(top_srcdir)/libmath' + +diff -ruN gcc-20030210.orig/libtool.m4 gcc-20030210/libtool.m4 +--- gcc-20030210.orig/libtool.m4 Fri Jan 31 19:16:59 2003 ++++ gcc-20030210/libtool.m4 Sat Feb 22 01:40:14 2003 +@@ -597,7 +597,7 @@ + # This must be Linux ELF. + linux-gnu*) + case $host_cpu in +- alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) ++ alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | sh* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM +diff -ruN gcc-20030210.orig/zlib/configure gcc-20030210/zlib/configure +--- gcc-20030210.orig/zlib/configure Tue Jan 28 10:44:15 2003 ++++ gcc-20030210/zlib/configure Sat Feb 22 01:40:14 2003 +@@ -1571,7 +1571,7 @@ + # This must be Linux ELF. + linux-gnu*) + case $host_cpu in +- alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) ++ alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | sh* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM diff --git a/patches/gcc/3.2.3/gcc-3.2.3-g++.exp.patch b/patches/gcc/3.2.3/gcc-3.2.3-g++.exp.patch new file mode 100644 index 00000000..0de46fc4 --- /dev/null +++ b/patches/gcc/3.2.3/gcc-3.2.3-g++.exp.patch @@ -0,0 +1,98 @@ +g++ testsuite fixes for cross-compilers, Dan Kegel, Ixia Communications, 12 July 2003 + +The first hunk fixes the error + +/testsuite_flags: /testsuite_flags: No such file or directory + while executing +"exec sh ${odir_v3}/testsuite_flags --build-includes" + (procedure "g++_include_flags" line 21) + invoked from within +"g++_include_flags [get_multilibs] " + (procedure "g++_init" line 63) + invoked from within +"${tool}_init $test_file_name" + (procedure "runtest" line 19) + invoked from within +"runtest $test_name" + ("foreach" body line 42) + invoked from within +... +make[1]: [check-g++] Error 1 (ignored) + +The fix isn't especially pretty, but it worked for me, and can't hurt the +more common native compiler case. Maybe someone who knows the code better +can come up with a better fix. + +The second hunk fixes the error + +sh: error while loading shared libraries: /opt/cegl-2.0/powerpc-405-linux-gnu/gcc-3.2.3-glibc-2.2.5/powerpc-405-linux-gnu/./lib/libdl.so.2: ELF file data encoding not little-endian + +when trying to compile g++ testcases (!); setting up +the shared library environment when running crosstests of g++ +should either be done by a special board file, or by +setting up a remote chroot environment (see http://kegel.com/crosstool), +not by blithely setting LD_LIBRARY_PATH on the local system. + +--- gcc-3.2.3/gcc/testsuite/lib/g++.exp.old Fri Jul 11 15:42:47 2003 ++++ gcc-3.2.3/gcc/testsuite/lib/g++.exp Sat Jul 12 12:57:07 2003 +@@ -72,6 +72,8 @@ + # + proc g++_include_flags { paths } { + global srcdir ++ global objdir ++ global target_triplet + global HAVE_LIBSTDCXX_V3 + global TESTING_IN_BUILD_TREE + +@@ -90,6 +92,20 @@ + + if { ${HAVE_LIBSTDCXX_V3} } { + set odir_v3 [lookfor_file ${gccpath} libstdc++-v3] ++ if { $odir_v3 == "" } { ++ verbose "g++_include_flags: couldn't find libstdc++-v3 on first try, now looking in build directory $objdir" ++ # first assume no multilibs ++ set odir_v3 [lookfor_file ${objdir} "$target_triplet/libstdc++-v3"] ++ } ++ if { $odir_v3 == "" } { ++ verbose "g++_include_flags: couldn't find libstdc++-v3 on second try, trying multilib" ++ # assume multilib only one level deep ++ set multisub [file tail $gccpath] ++ set odir_v3 [lookfor_file ${objdir} "$target_triplet/$multisub/libstdc++-v3"] ++ } ++ if { $odir_v3 == "" } { ++ error "Can't find libstdc++-v3" ++ } + append flags [exec sh ${odir_v3}/testsuite_flags --build-includes] + } else { + set odir_v2 [lookfor_file ${gccpath} libstdc++] +@@ -192,16 +192,20 @@ + } + } + +- # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but +- # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH +- # (for the 64-bit ABI). The right way to do this would be to modify +- # unix.exp -- but that's not an option since it's part of DejaGNU +- # proper, so we do it here. We really only need to do +- # this on IRIX, but it shouldn't hurt to do it anywhere else. +- setenv LD_LIBRARY_PATH $ld_library_path +- setenv SHLIB_PATH $ld_library_path +- setenv LD_LIBRARYN32_PATH $ld_library_path +- setenv LD_LIBRARY64_PATH $ld_library_path ++ if {![is_remote target]} { ++ # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but ++ # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH ++ # (for the 64-bit ABI). The right way to do this would be to modify ++ # unix.exp -- but that's not an option since it's part of DejaGNU ++ # proper, so we do it here. We really only need to do ++ # this on IRIX, but it shouldn't hurt to do it anywhere else. ++ ++ # Doing this causes us to be unable to run cross-compilers. ++ setenv LD_LIBRARY_PATH $ld_library_path ++ setenv SHLIB_PATH $ld_library_path ++ setenv LD_LIBRARYN32_PATH $ld_library_path ++ setenv LD_LIBRARY64_PATH $ld_library_path ++ } + + return "$flags" + } diff --git a/patches/gcc/3.2.3/gcc-3.2.3-libffi-1.patch b/patches/gcc/3.2.3/gcc-3.2.3-libffi-1.patch new file mode 100644 index 00000000..db78ba1f --- /dev/null +++ b/patches/gcc/3.2.3/gcc-3.2.3-libffi-1.patch @@ -0,0 +1,6864 @@ +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/Makefile.am gcc/libffi/Makefile.am +--- gcc-3.2.2.orig/libffi/Makefile.am Tue Jan 28 10:43:56 2003 ++++ gcc/libffi/Makefile.am Tue Jan 28 10:48:33 2003 +@@ -8,14 +8,17 @@ + src/mips/n32.s src/mips/o32.S src/mips/o32.s \ + src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S \ + src/x86/ffi.c src/x86/sysv.S src/x86/win32.S \ ++ src/x86/ffi64.c src/x86/unix64.S \ + src/alpha/ffi.c src/alpha/osf.S \ + src/m68k/ffi.c src/m68k/sysv.S \ + src/powerpc/ffi.c src/powerpc/sysv.S \ + src/powerpc/ppc_closure.S src/powerpc/asm.h \ + src/powerpc/ffi_darwin.c \ + src/powerpc/darwin.S src/powerpc/aix.S \ +- src/powerpc/darwin_closure.S src/powerpc/aix_closures.S \ +- src/arm/ffi.c src/arm/sysv.S ++ src/powerpc/darwin_closure.S src/powerpc/aix_closure.S \ ++ src/arm/ffi.c src/arm/sysv.S \ ++ src/s390/ffi.c src/s390/sysv.S \ ++ src/sh/ffi.c src/sh/sysv.S + + VPATH = @srcdir@:@srcdir@/src:@srcdir@/src/@TARGETDIR@ + +@@ -83,6 +86,7 @@ + ffitest_LDFLAGS = -shared-libgcc + + TARGET_SRC_MIPS_GCC = src/mips/ffi.c src/mips/o32.S src/mips/n32.S ++TARGET_SRC_MIPS_LINUX = src/mips/ffi.c src/mips/o32.S + TARGET_SRC_MIPS_SGI = src/mips/ffi.c src/mips/o32.s src/mips/n32.s + TARGET_SRC_X86 = src/x86/ffi.c src/x86/sysv.S + TARGET_SRC_X86_WIN32 = src/x86/ffi.c src/x86/win32.S +@@ -91,9 +95,12 @@ + TARGET_SRC_IA64 = src/ia64/ffi.c src/ia64/unix.S + TARGET_SRC_M68K = src/m68k/ffi.c src/m68k/sysv.S + TARGET_SRC_POWERPC = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S +-TARGET_SRC_POWERPC_AIX = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closures.S ++TARGET_SRC_POWERPC_AIX = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S + TARGET_SRC_POWERPC_DARWIN = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S + TARGET_SRC_ARM = src/arm/sysv.S src/arm/ffi.c ++TARGET_SRC_S390 = src/s390/sysv.S src/s390/ffi.c ++TARGET_SRC_X86_64 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S ++TARGET_SRC_SH = src/sh/sysv.S src/sh/ffi.c + + ##libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c $(TARGET_SRC_@TARGET@) + ## Work around automake deficiency +@@ -103,6 +110,10 @@ + libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_GCC) + libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_GCC) + endif ++if MIPS_LINUX ++libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_LINUX) ++libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_LINUX) ++endif + if MIPS_SGI + libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_SGI) + libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_SGI) +@@ -147,6 +158,18 @@ + libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_ARM) + libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_ARM) + endif ++if S390 ++libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_S390) ++libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_S390) ++endif ++if X86_64 ++libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_X86_64) ++libffi_convenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_X86_64) ++endif ++if SH ++libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_SH) ++libfficonvenience_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_SH) ++endif + + AM_CFLAGS = -fexceptions + +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/Makefile.in gcc/libffi/Makefile.in +--- gcc-3.2.2.orig/libffi/Makefile.in Wed Jan 29 07:59:05 2003 ++++ gcc/libffi/Makefile.in Wed Jan 29 07:58:58 2003 +@@ -91,14 +91,17 @@ + src/mips/n32.s src/mips/o32.S src/mips/o32.s \ + src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S \ + src/x86/ffi.c src/x86/sysv.S src/x86/win32.S \ ++ src/x86/ffi64.c src/x86/unix64.S \ + src/alpha/ffi.c src/alpha/osf.S \ + src/m68k/ffi.c src/m68k/sysv.S \ + src/powerpc/ffi.c src/powerpc/sysv.S \ + src/powerpc/ppc_closure.S src/powerpc/asm.h \ + src/powerpc/ffi_darwin.c \ + src/powerpc/darwin.S src/powerpc/aix.S \ +- src/powerpc/darwin_closure.S src/powerpc/aix_closures.S \ +- src/arm/ffi.c src/arm/sysv.S ++ src/powerpc/darwin_closure.S src/powerpc/aix_closure.S \ ++ src/arm/ffi.c src/arm/sysv.S \ ++ src/s390/ffi.c src/s390/sysv.S \ ++ src/sh/ffi.c src/sh/sysv.S + + + VPATH = @srcdir@:@srcdir@/src:@srcdir@/src/@TARGETDIR@ +@@ -162,6 +165,7 @@ + ffitest_LDFLAGS = -shared-libgcc + + TARGET_SRC_MIPS_GCC = src/mips/ffi.c src/mips/o32.S src/mips/n32.S ++TARGET_SRC_MIPS_LINUX = src/mips/ffi.c src/mips/o32.S + TARGET_SRC_MIPS_SGI = src/mips/ffi.c src/mips/o32.s src/mips/n32.s + TARGET_SRC_X86 = src/x86/ffi.c src/x86/sysv.S + TARGET_SRC_X86_WIN32 = src/x86/ffi.c src/x86/win32.S +@@ -170,14 +174,18 @@ + TARGET_SRC_IA64 = src/ia64/ffi.c src/ia64/unix.S + TARGET_SRC_M68K = src/m68k/ffi.c src/m68k/sysv.S + TARGET_SRC_POWERPC = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S +-TARGET_SRC_POWERPC_AIX = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closures.S ++TARGET_SRC_POWERPC_AIX = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S + TARGET_SRC_POWERPC_DARWIN = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S + TARGET_SRC_ARM = src/arm/sysv.S src/arm/ffi.c ++TARGET_SRC_S390 = src/s390/sysv.S src/s390/ffi.c ++TARGET_SRC_X86_64 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S ++TARGET_SRC_SH = src/sh/sysv.S src/sh/ffi.c + + libffi_la_common_SOURCES = src/debug.c src/prep_cif.c src/types.c \ + src/raw_api.c src/java_raw_api.c + + @MIPS_GCC_TRUE@libffi_la_SOURCES = @MIPS_GCC_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_GCC) ++@MIPS_LINUX_TRUE@libffi_la_SOURCES = @MIPS_LINUX_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_LINUX) + @MIPS_SGI_TRUE@libffi_la_SOURCES = @MIPS_SGI_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_SGI) + @X86_TRUE@libffi_la_SOURCES = @X86_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_X86) + @X86_WIN32_TRUE@libffi_la_SOURCES = @X86_WIN32_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_X86_WIN32) +@@ -189,7 +197,11 @@ + @POWERPC_AIX_TRUE@libffi_la_SOURCES = @POWERPC_AIX_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_POWERPC_AIX) + @POWERPC_DARWIN_TRUE@libffi_la_SOURCES = @POWERPC_DARWIN_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_POWERPC_DARWIN) + @ARM_TRUE@libffi_la_SOURCES = @ARM_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_ARM) ++@S390_TRUE@libffi_la_SOURCES = @S390_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_S390) ++@X86_64_TRUE@libffi_la_SOURCES = @X86_64_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_X86_64) ++@SH_TRUE@libffi_la_SOURCES = @SH_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_SH) + @MIPS_GCC_TRUE@libffi_convenience_la_SOURCES = @MIPS_GCC_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_GCC) ++@MIPS_LINUX_TRUE@libffi_convenience_la_SOURCES = @MIPS_LINUX_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_LINUX) + @MIPS_SGI_TRUE@libffi_convenience_la_SOURCES = @MIPS_SGI_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_SGI) + @X86_TRUE@libffi_convenience_la_SOURCES = @X86_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_X86) + @X86_WIN32_TRUE@libffi_convenience_la_SOURCES = @X86_WIN32_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_X86_WIN32) +@@ -201,6 +213,9 @@ + @POWERPC_AIX_TRUE@libffi_convenience_la_SOURCES = @POWERPC_AIX_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_POWERPC_AIX) + @POWERPC_DARWIN_TRUE@libffi_convenience_la_SOURCES = @POWERPC_DARWIN_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_POWERPC_DARWIN) + @ARM_TRUE@libffi_convenience_la_SOURCES = @ARM_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_ARM) ++@S390_TRUE@libffi_convenience_la_SOURCES = @S390_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_S390) ++@X86_64_TRUE@libffi_convenience_la_SOURCES = @X86_64_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_X86_64) ++@SH_TRUE@libfficonvenience_la_SOURCES = @SH_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_SH) + + AM_CFLAGS = -fexceptions + +@@ -208,7 +223,7 @@ + + INCLUDES = -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src + ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +-mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs ++mkinstalldirs = $(SHELL) $(top_srcdir)/${libffi_basedir}/../mkinstalldirs + CONFIG_HEADER = fficonfig.h + CONFIG_CLEAN_FILES = + LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES) +@@ -220,10 +235,6 @@ + LIBS = @LIBS@ + libffi_convenience_la_LDFLAGS = + libffi_convenience_la_LIBADD = +-@POWERPC_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ +-@POWERPC_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ +-@POWERPC_TRUE@src/java_raw_api.lo src/powerpc/ffi.lo \ +-@POWERPC_TRUE@src/powerpc/sysv.lo src/powerpc/ppc_closure.lo + @ALPHA_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ + @ALPHA_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ + @ALPHA_TRUE@src/java_raw_api.lo src/alpha/ffi.lo src/alpha/osf.lo +@@ -234,12 +245,29 @@ + @MIPS_GCC_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ + @MIPS_GCC_TRUE@src/java_raw_api.lo src/mips/ffi.lo src/mips/o32.lo \ + @MIPS_GCC_TRUE@src/mips/n32.lo +-@X86_WIN32_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ +-@X86_WIN32_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ +-@X86_WIN32_TRUE@src/java_raw_api.lo src/x86/ffi.lo src/x86/win32.lo ++@S390_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \ ++@S390_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ ++@S390_TRUE@src/s390/sysv.lo src/s390/ffi.lo + @M68K_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \ + @M68K_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ + @M68K_TRUE@src/m68k/ffi.lo src/m68k/sysv.lo ++@X86_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \ ++@X86_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ ++@X86_TRUE@src/x86/ffi.lo src/x86/sysv.lo ++@POWERPC_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ ++@POWERPC_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ ++@POWERPC_TRUE@src/java_raw_api.lo src/powerpc/ffi.lo \ ++@POWERPC_TRUE@src/powerpc/sysv.lo src/powerpc/ppc_closure.lo ++@MIPS_LINUX_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ ++@MIPS_LINUX_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ ++@MIPS_LINUX_TRUE@src/java_raw_api.lo src/mips/ffi.lo src/mips/o32.lo ++@X86_WIN32_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ ++@X86_WIN32_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ ++@X86_WIN32_TRUE@src/java_raw_api.lo src/x86/ffi.lo src/x86/win32.lo ++@X86_64_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ ++@X86_64_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ ++@X86_64_TRUE@src/java_raw_api.lo src/x86/ffi64.lo src/x86/unix64.lo \ ++@X86_64_TRUE@src/x86/ffi.lo src/x86/sysv.lo + @SPARC_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ + @SPARC_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ + @SPARC_TRUE@src/java_raw_api.lo src/sparc/ffi.lo src/sparc/v8.lo \ +@@ -247,62 +275,75 @@ + @POWERPC_AIX_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ + @POWERPC_AIX_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ + @POWERPC_AIX_TRUE@src/java_raw_api.lo src/powerpc/ffi_darwin.lo \ +-@POWERPC_AIX_TRUE@src/powerpc/aix.lo src/powerpc/aix_closures.lo +-@X86_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +-@X86_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +-@X86_TRUE@src/x86/ffi.lo src/x86/sysv.lo +-@ARM_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +-@ARM_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +-@ARM_TRUE@src/arm/sysv.lo src/arm/ffi.lo ++@POWERPC_AIX_TRUE@src/powerpc/aix.lo src/powerpc/aix_closure.lo ++@MIPS_SGI_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ ++@MIPS_SGI_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ ++@MIPS_SGI_TRUE@src/java_raw_api.lo src/mips/ffi.lo src/mips/o32.lo \ ++@MIPS_SGI_TRUE@src/mips/n32.lo + @POWERPC_DARWIN_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ + @POWERPC_DARWIN_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ + @POWERPC_DARWIN_TRUE@src/java_raw_api.lo src/powerpc/ffi_darwin.lo \ + @POWERPC_DARWIN_TRUE@src/powerpc/darwin.lo \ + @POWERPC_DARWIN_TRUE@src/powerpc/darwin_closure.lo +-@MIPS_SGI_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ +-@MIPS_SGI_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ +-@MIPS_SGI_TRUE@src/java_raw_api.lo src/mips/ffi.lo src/mips/o32.lo \ +-@MIPS_SGI_TRUE@src/mips/n32.lo ++@ARM_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \ ++@ARM_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ ++@ARM_TRUE@src/arm/sysv.lo src/arm/ffi.lo ++@SH_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \ ++@SH_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ ++@SH_TRUE@src/sh/sysv.lo src/sh/ffi.lo + libffi_la_LIBADD = ++@SH_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \ ++@SH_TRUE@src/raw_api.lo src/java_raw_api.lo src/sh/sysv.lo \ ++@SH_TRUE@src/sh/ffi.lo ++@IA64_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ ++@IA64_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ ++@IA64_TRUE@src/ia64/ffi.lo src/ia64/unix.lo ++@X86_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \ ++@X86_TRUE@src/raw_api.lo src/java_raw_api.lo src/x86/ffi.lo \ ++@X86_TRUE@src/x86/sysv.lo + @POWERPC_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ + @POWERPC_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ + @POWERPC_TRUE@src/powerpc/ffi.lo src/powerpc/sysv.lo \ + @POWERPC_TRUE@src/powerpc/ppc_closure.lo +-@ALPHA_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +-@ALPHA_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +-@ALPHA_TRUE@src/alpha/ffi.lo src/alpha/osf.lo +-@IA64_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +-@IA64_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +-@IA64_TRUE@src/ia64/ffi.lo src/ia64/unix.lo +-@MIPS_GCC_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +-@MIPS_GCC_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +-@MIPS_GCC_TRUE@src/mips/ffi.lo src/mips/o32.lo src/mips/n32.lo +-@X86_WIN32_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +-@X86_WIN32_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +-@X86_WIN32_TRUE@src/x86/ffi.lo src/x86/win32.lo +-@M68K_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +-@M68K_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +-@M68K_TRUE@src/m68k/ffi.lo src/m68k/sysv.lo ++@MIPS_LINUX_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ ++@MIPS_LINUX_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ ++@MIPS_LINUX_TRUE@src/mips/ffi.lo src/mips/o32.lo + @SPARC_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ + @SPARC_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ + @SPARC_TRUE@src/sparc/ffi.lo src/sparc/v8.lo src/sparc/v9.lo + @POWERPC_AIX_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ + @POWERPC_AIX_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ + @POWERPC_AIX_TRUE@src/powerpc/ffi_darwin.lo src/powerpc/aix.lo \ +-@POWERPC_AIX_TRUE@src/powerpc/aix_closures.lo +-@X86_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \ +-@X86_TRUE@src/raw_api.lo src/java_raw_api.lo src/x86/ffi.lo \ +-@X86_TRUE@src/x86/sysv.lo ++@POWERPC_AIX_TRUE@src/powerpc/aix_closure.lo ++@MIPS_SGI_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ ++@MIPS_SGI_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ ++@MIPS_SGI_TRUE@src/mips/ffi.lo src/mips/o32.lo src/mips/n32.lo + @ARM_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \ + @ARM_TRUE@src/raw_api.lo src/java_raw_api.lo src/arm/sysv.lo \ + @ARM_TRUE@src/arm/ffi.lo ++@ALPHA_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ ++@ALPHA_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ ++@ALPHA_TRUE@src/alpha/ffi.lo src/alpha/osf.lo ++@MIPS_GCC_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ ++@MIPS_GCC_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ ++@MIPS_GCC_TRUE@src/mips/ffi.lo src/mips/o32.lo src/mips/n32.lo ++@S390_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ ++@S390_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ ++@S390_TRUE@src/s390/sysv.lo src/s390/ffi.lo ++@M68K_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ ++@M68K_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ ++@M68K_TRUE@src/m68k/ffi.lo src/m68k/sysv.lo ++@X86_WIN32_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ ++@X86_WIN32_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ ++@X86_WIN32_TRUE@src/x86/ffi.lo src/x86/win32.lo ++@X86_64_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ ++@X86_64_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ ++@X86_64_TRUE@src/x86/ffi64.lo src/x86/unix64.lo src/x86/ffi.lo \ ++@X86_64_TRUE@src/x86/sysv.lo + @POWERPC_DARWIN_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ + @POWERPC_DARWIN_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ + @POWERPC_DARWIN_TRUE@src/powerpc/ffi_darwin.lo src/powerpc/darwin.lo \ + @POWERPC_DARWIN_TRUE@src/powerpc/darwin_closure.lo +-@MIPS_SGI_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +-@MIPS_SGI_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +-@MIPS_SGI_TRUE@src/mips/ffi.lo src/mips/o32.lo src/mips/n32.lo + noinst_PROGRAMS = ffitest$(EXEEXT) + PROGRAMS = $(noinst_PROGRAMS) + +@@ -578,8 +616,8 @@ + -chmod 777 $(distdir) + $(mkinstalldirs) $(distdir)/src/alpha $(distdir)/src/arm \ + $(distdir)/src/m68k $(distdir)/src/mips \ +- $(distdir)/src/powerpc $(distdir)/src/sparc \ +- $(distdir)/src/x86 ++ $(distdir)/src/powerpc $(distdir)/src/s390 $(distdir)/src/sh \ ++ $(distdir)/src/sparc $(distdir)/src/x86 + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/acinclude.m4 gcc/libffi/acinclude.m4 +--- gcc-3.2.2.orig/libffi/acinclude.m4 Sun Sep 10 16:43:14 2000 ++++ gcc/libffi/acinclude.m4 Tue Dec 17 03:22:47 2002 +@@ -4,5 +4,8 @@ + dnl to add a definition of LIBTOOL to Makefile.in. + ifelse(yes,no,[ + AC_DEFUN([AC_PROG_LIBTOOL],) ++AC_DEFUN([AM_PROG_LIBTOOL],) + AC_SUBST(LIBTOOL) + ]) ++ ++sinclude(../config/accross.m4) +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/aclocal.m4 gcc/libffi/aclocal.m4 +--- gcc-3.2.2.orig/libffi/aclocal.m4 Fri Feb 1 07:25:31 2002 ++++ gcc/libffi/aclocal.m4 Tue Dec 17 03:22:47 2002 +@@ -1,6 +1,6 @@ +-dnl aclocal.m4 generated automatically by aclocal 1.4 ++dnl aclocal.m4 generated automatically by aclocal 1.4-p5 + +-dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. ++dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. +@@ -16,108 +16,15 @@ + dnl to add a definition of LIBTOOL to Makefile.in. + ifelse(yes,no,[ + AC_DEFUN([AC_PROG_LIBTOOL],) ++AC_DEFUN([AM_PROG_LIBTOOL],) + AC_SUBST(LIBTOOL) + ]) + +-AC_DEFUN([AC_COMPILE_CHECK_SIZEOF], +-[changequote(<<, >>)dnl +-dnl The name to #define. +-define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl +-dnl The cache variable name. +-define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl +-changequote([, ])dnl +-AC_MSG_CHECKING(size of $1) +-AC_CACHE_VAL(AC_CV_NAME, +-[for ac_size in 4 8 1 2 16 12 $2 ; do # List sizes in rough order of prevalence. +- AC_TRY_COMPILE([#include "confdefs.h" +-#include <sys/types.h> +-$2 +-], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size) +- if test x$AC_CV_NAME != x ; then break; fi +-done +-]) +-if test x$AC_CV_NAME = x ; then +- AC_MSG_ERROR([cannot determine a size for $1]) +-fi +-AC_MSG_RESULT($AC_CV_NAME) +-AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1]) +-undefine([AC_TYPE_NAME])dnl +-undefine([AC_CV_NAME])dnl +-]) +- +-AC_DEFUN([AC_C_BIGENDIAN_CROSS], +-[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian, +-[ac_cv_c_bigendian=unknown +-# See if sys/param.h defines the BYTE_ORDER macro. +-AC_TRY_COMPILE([#include <sys/types.h> +-#include <sys/param.h>], [ +-#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN +- bogus endian macros +-#endif], [# It does; now see whether it defined to BIG_ENDIAN or not. +-AC_TRY_COMPILE([#include <sys/types.h> +-#include <sys/param.h>], [ +-#if BYTE_ORDER != BIG_ENDIAN +- not big endian +-#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)]) +-if test $ac_cv_c_bigendian = unknown; then +-AC_TRY_RUN([main () { +- /* Are we little or big endian? From Harbison&Steele. */ +- union +- { +- long l; +- char c[sizeof (long)]; +- } u; +- u.l = 1; +- exit (u.c[sizeof (long) - 1] == 1); +-}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes, +-[ echo $ac_n "cross-compiling... " 2>&AC_FD_MSG ]) +-fi]) +-if test $ac_cv_c_bigendian = unknown; then +-AC_MSG_CHECKING(to probe for byte ordering) +-[ +-cat >conftest.c <<EOF +-short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +-short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +-void _ascii() { char* s = (char*) ascii_mm; s = (char*) ascii_ii; } +-short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +-short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +-void _ebcdic() { char* s = (char*) ebcdic_mm; s = (char*) ebcdic_ii; } +-int main() { _ascii (); _ebcdic (); return 0; } +-EOF +-] if test -f conftest.c ; then +- if ${CC-cc} ${CFLAGS} conftest.c -o conftest.o && test -f conftest.o ; then +- if test `grep -l BIGenDianSyS conftest.o` ; then +- echo $ac_n ' big endian probe OK, ' 1>&AC_FD_MSG +- ac_cv_c_bigendian=yes +- fi +- if test `grep -l LiTTleEnDian conftest.o` ; then +- echo $ac_n ' little endian probe OK, ' 1>&AC_FD_MSG +- if test $ac_cv_c_bigendian = yes ; then +- ac_cv_c_bigendian=unknown; +- else +- ac_cv_c_bigendian=no +- fi +- fi +- echo $ac_n 'guessing bigendian ... ' >&AC_FD_MSG +- fi +- fi +-AC_MSG_RESULT($ac_cv_c_bigendian) +-fi +-if test $ac_cv_c_bigendian = yes; then +- AC_DEFINE(WORDS_BIGENDIAN, 1, [whether byteorder is bigendian]) +- BYTEORDER=4321 +-else +- BYTEORDER=1234 +-fi +-AC_DEFINE_UNQUOTED(BYTEORDER, $BYTEORDER, [1234 = LIL_ENDIAN, 4321 = BIGENDIAN]) +-if test $ac_cv_c_bigendian = unknown; then +- AC_MSG_ERROR(unknown endianess - sorry, please pre-set ac_cv_c_bigendian) +-fi +-]) ++sinclude(../config/accross.m4) + + # Like AC_CONFIG_HEADER, but automatically create stamp file. + +-AC_DEFUN(AM_CONFIG_HEADER, ++AC_DEFUN([AM_CONFIG_HEADER], + [AC_PREREQ([2.12]) + AC_CONFIG_HEADER([$1]) + dnl When config.status generates a header, we must update the stamp-h file. +@@ -147,7 +54,7 @@ + dnl Usage: + dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +-AC_DEFUN(AM_INIT_AUTOMAKE, ++AC_DEFUN([AM_INIT_AUTOMAKE], + [AC_REQUIRE([AC_PROG_INSTALL]) + PACKAGE=[$1] + AC_SUBST(PACKAGE) +@@ -175,7 +82,7 @@ + # Check to make sure that the build environment is sane. + # + +-AC_DEFUN(AM_SANITY_CHECK, ++AC_DEFUN([AM_SANITY_CHECK], + [AC_MSG_CHECKING([whether build environment is sane]) + # Just in case + sleep 1 +@@ -216,7 +123,7 @@ + + dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) + dnl The program must properly implement --version. +-AC_DEFUN(AM_MISSING_PROG, ++AC_DEFUN([AM_MISSING_PROG], + [AC_MSG_CHECKING(for working $2) + # Run test in a subshell; some versions of sh will print an error if + # an executable is not found, even if stderr is redirected. +@@ -235,7 +142,7 @@ + + # serial 1 + +-AC_DEFUN(AM_MAINTAINER_MODE, ++AC_DEFUN([AM_MAINTAINER_MODE], + [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +@@ -252,7 +159,7 @@ + + # Define a conditional. + +-AC_DEFUN(AM_CONDITIONAL, ++AC_DEFUN([AM_CONDITIONAL], + [AC_SUBST($1_TRUE) + AC_SUBST($1_FALSE) + if $2; then +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/configure gcc/libffi/configure +--- gcc-3.2.2.orig/libffi/configure Wed Jan 29 07:59:05 2003 ++++ gcc/libffi/configure Sat Feb 1 20:16:19 2003 +@@ -633,17 +633,16 @@ + + if test "${srcdir}" = "."; then + if test "${with_target_subdir}" != "."; then +- libffi_basedir="${srcdir}/${with_multisrctop}.." ++ libffi_basedir="${with_multisrctop}../" + else +- libffi_basedir="${srcdir}/${with_multisrctop}" ++ libffi_basedir="${with_multisrctop}" + fi + else +- libffi_basedir="${srcdir}" ++ libffi_basedir= + fi + +- + ac_aux_dir= +-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do ++for ac_dir in ${libffi_basedir}.. $srcdir/${libffi_basedir}..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" +@@ -655,13 +654,14 @@ + fi + done + if test -z "$ac_aux_dir"; then +- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } ++ { echo "configure: error: can not find install-sh or install.sh in ${libffi_basedir}.. $srcdir/${libffi_basedir}.." 1>&2; exit 1; } + fi + ac_config_guess=$ac_aux_dir/config.guess + ac_config_sub=$ac_aux_dir/config.sub + ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + ++ + # Make sure we can run config.sub. + if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : + else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +@@ -1238,9 +1238,18 @@ + ;; + + hpux10.20*|hpux11*) +- lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' +- lt_cv_file_magic_cmd=/usr/bin/file +- lt_cv_file_magic_test_file=/usr/lib/libc.sl ++ case $host_cpu in ++ hppa*) ++ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' ++ lt_cv_file_magic_cmd=/usr/bin/file ++ lt_cv_file_magic_test_file=/usr/lib/libc.sl ++ ;; ++ ia64*) ++ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' ++ lt_cv_file_magic_cmd=/usr/bin/file ++ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ++ ;; ++ esac + ;; + + irix5* | irix6*) +@@ -1267,7 +1276,7 @@ + # This must be Linux ELF. + linux-gnu*) + case $host_cpu in +- alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) ++ alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | sh* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM +@@ -1330,13 +1339,13 @@ + deplibs_check_method=$lt_cv_deplibs_check_method + + echo $ac_n "checking for object suffix""... $ac_c" 1>&6 +-echo "configure:1334: checking for object suffix" >&5 ++echo "configure:1343: checking for object suffix" >&5 + if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + rm -f conftest* + echo 'int i = 1;' > conftest.$ac_ext +-if { (eval echo configure:1340: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++if { (eval echo configure:1349: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + for ac_file in conftest.*; do + case $ac_file in + *.c) ;; +@@ -1356,7 +1365,7 @@ + + + echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 +-echo "configure:1360: checking for executable suffix" >&5 ++echo "configure:1369: checking for executable suffix" >&5 + if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -1366,7 +1375,7 @@ + rm -f conftest* + echo 'int main () { return 0; }' > conftest.$ac_ext + ac_cv_exeext= +- if { (eval echo configure:1370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then ++ if { (eval echo configure:1379: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + for file in conftest.*; do + case $file in + *.c | *.o | *.obj) ;; +@@ -1399,7 +1408,7 @@ + file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 +-echo "configure:1403: checking for ${ac_tool_prefix}file" >&5 ++echo "configure:1412: checking for ${ac_tool_prefix}file" >&5 + if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -1461,7 +1470,7 @@ + if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + echo $ac_n "checking for file""... $ac_c" 1>&6 +-echo "configure:1465: checking for file" >&5 ++echo "configure:1474: checking for file" >&5 + if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -1532,7 +1541,7 @@ + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. + set dummy ${ac_tool_prefix}ranlib; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:1536: checking for $ac_word" >&5 ++echo "configure:1545: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -1564,7 +1573,7 @@ + # Extract the first word of "ranlib", so it can be a program name with args. + set dummy ranlib; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:1568: checking for $ac_word" >&5 ++echo "configure:1577: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -1599,7 +1608,7 @@ + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. + set dummy ${ac_tool_prefix}strip; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:1603: checking for $ac_word" >&5 ++echo "configure:1612: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -1631,7 +1640,7 @@ + # Extract the first word of "strip", so it can be a program name with args. + set dummy strip; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:1635: checking for $ac_word" >&5 ++echo "configure:1644: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -1698,8 +1707,8 @@ + case $host in + *-*-irix6*) + # Find out which ABI we are using. +- echo '#line 1702 "configure"' > conftest.$ac_ext +- if { (eval echo configure:1703: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++ echo '#line 1711 "configure"' > conftest.$ac_ext ++ if { (eval echo configure:1712: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" +@@ -1715,12 +1724,70 @@ + rm -rf conftest* + ;; + ++ia64-*-hpux*) ++ # Find out which ABI we are using. ++ echo 'int i;' > conftest.$ac_ext ++ if { (eval echo configure:1731: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++ case "`/usr/bin/file conftest.o`" in ++ *ELF-32*) ++ HPUX_IA64_MODE="32" ++ ;; ++ *ELF-64*) ++ HPUX_IA64_MODE="64" ++ ;; ++ esac ++ fi ++ rm -rf conftest* ++ ;; ++ ++x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) ++ # Find out which ABI we are using. ++ echo 'int i;' > conftest.$ac_ext ++ if { (eval echo configure:1747: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++ case "`/usr/bin/file conftest.o`" in ++ *32-bit*) ++ case $host in ++ x86_64-*linux*) ++ LD="${LD-ld} -m elf_i386" ++ ;; ++ ppc64-*linux*) ++ LD="${LD-ld} -m elf32ppclinux" ++ ;; ++ s390x-*linux*) ++ LD="${LD-ld} -m elf_s390" ++ ;; ++ sparc64-*linux*) ++ LD="${LD-ld} -m elf32_sparc" ++ ;; ++ esac ++ ;; ++ *64-bit*) ++ case $host in ++ x86_64-*linux*) ++ LD="${LD-ld} -m elf_x86_64" ++ ;; ++ ppc*-*linux*|powerpc*-*linux*) ++ LD="${LD-ld} -m elf64ppc" ++ ;; ++ s390*-*linux*) ++ LD="${LD-ld} -m elf64_s390" ++ ;; ++ sparc*-*linux*) ++ LD="${LD-ld} -m elf64_sparc" ++ ;; ++ esac ++ ;; ++ esac ++ fi ++ rm -rf conftest* ++ ;; ++ + *-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 +-echo "configure:1724: checking whether the C compiler needs -belf" >&5 ++echo "configure:1791: checking whether the C compiler needs -belf" >&5 + if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -1733,14 +1800,14 @@ + cross_compiling=$ac_cv_prog_cc_cross + + cat > conftest.$ac_ext <<EOF +-#line 1737 "configure" ++#line 1804 "configure" + #include "confdefs.h" + + int main() { + + ; return 0; } + EOF +-if { (eval echo configure:1744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:1811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + lt_cv_cc_needs_belf=yes + else +@@ -1868,7 +1935,7 @@ + # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" + # ./install, which can be erroneously created by make from ./install.sh. + echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +-echo "configure:1872: checking for a BSD compatible install" >&5 ++echo "configure:1939: checking for a BSD compatible install" >&5 + if test -z "$INSTALL"; then + if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +@@ -1921,7 +1988,7 @@ + test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +-echo "configure:1925: checking whether build environment is sane" >&5 ++echo "configure:1992: checking whether build environment is sane" >&5 + # Just in case + sleep 1 + echo timestamp > conftestfile +@@ -1978,7 +2045,7 @@ + test "$program_transform_name" = "" && program_transform_name="s,x,x," + + echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +-echo "configure:1982: checking whether ${MAKE-make} sets \${MAKE}" >&5 ++echo "configure:2049: checking whether ${MAKE-make} sets \${MAKE}" >&5 + set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` + if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +@@ -2017,7 +2084,7 @@ + + missing_dir=`cd $ac_aux_dir && pwd` + echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 +-echo "configure:2021: checking for working aclocal" >&5 ++echo "configure:2088: checking for working aclocal" >&5 + # Run test in a subshell; some versions of sh will print an error if + # an executable is not found, even if stderr is redirected. + # Redirect stdin to placate older versions of autoconf. Sigh. +@@ -2030,7 +2097,7 @@ + fi + + echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +-echo "configure:2034: checking for working autoconf" >&5 ++echo "configure:2101: checking for working autoconf" >&5 + # Run test in a subshell; some versions of sh will print an error if + # an executable is not found, even if stderr is redirected. + # Redirect stdin to placate older versions of autoconf. Sigh. +@@ -2043,7 +2110,7 @@ + fi + + echo $ac_n "checking for working automake""... $ac_c" 1>&6 +-echo "configure:2047: checking for working automake" >&5 ++echo "configure:2114: checking for working automake" >&5 + # Run test in a subshell; some versions of sh will print an error if + # an executable is not found, even if stderr is redirected. + # Redirect stdin to placate older versions of autoconf. Sigh. +@@ -2056,7 +2123,7 @@ + fi + + echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +-echo "configure:2060: checking for working autoheader" >&5 ++echo "configure:2127: checking for working autoheader" >&5 + # Run test in a subshell; some versions of sh will print an error if + # an executable is not found, even if stderr is redirected. + # Redirect stdin to placate older versions of autoconf. Sigh. +@@ -2069,7 +2136,7 @@ + fi + + echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +-echo "configure:2073: checking for working makeinfo" >&5 ++echo "configure:2140: checking for working makeinfo" >&5 + # Run test in a subshell; some versions of sh will print an error if + # an executable is not found, even if stderr is redirected. + # Redirect stdin to placate older versions of autoconf. Sigh. +@@ -2086,7 +2153,7 @@ + + + echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 +-echo "configure:2090: checking for executable suffix" >&5 ++echo "configure:2157: checking for executable suffix" >&5 + if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -2096,7 +2163,7 @@ + rm -f conftest* + echo 'int main () { return 0; }' > conftest.$ac_ext + ac_cv_exeext= +- if { (eval echo configure:2100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then ++ if { (eval echo configure:2167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + for file in conftest.*; do + case $file in + *.c | *.o | *.obj) ;; +@@ -2117,7 +2184,7 @@ + ac_exeext=$EXEEXT + + echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +-echo "configure:2121: checking whether to enable maintainer-specific portions of Makefiles" >&5 ++echo "configure:2188: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. + if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" +@@ -2143,7 +2210,7 @@ + # Extract the first word of "gcc", so it can be a program name with args. + set dummy gcc; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:2147: checking for $ac_word" >&5 ++echo "configure:2214: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -2173,7 +2240,7 @@ + # Extract the first word of "cc", so it can be a program name with args. + set dummy cc; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:2177: checking for $ac_word" >&5 ++echo "configure:2244: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -2224,7 +2291,7 @@ + # Extract the first word of "cl", so it can be a program name with args. + set dummy cl; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:2228: checking for $ac_word" >&5 ++echo "configure:2295: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -2256,7 +2323,7 @@ + fi + + echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +-echo "configure:2260: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ++echo "configure:2327: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + + ac_ext=c + # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +@@ -2267,12 +2334,12 @@ + + cat > conftest.$ac_ext << EOF + +-#line 2271 "configure" ++#line 2338 "configure" + #include "confdefs.h" + + main(){return(0);} + EOF +-if { (eval echo configure:2276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:2343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then +@@ -2298,12 +2365,12 @@ + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } + fi + echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +-echo "configure:2302: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 ++echo "configure:2369: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 + echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 + cross_compiling=$ac_cv_prog_cc_cross + + echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +-echo "configure:2307: checking whether we are using GNU C" >&5 ++echo "configure:2374: checking whether we are using GNU C" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -2312,7 +2379,7 @@ + yes; + #endif + EOF +-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2316: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ++if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2383: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes + else + ac_cv_prog_gcc=no +@@ -2331,7 +2398,7 @@ + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +-echo "configure:2335: checking whether ${CC-cc} accepts -g" >&5 ++echo "configure:2402: checking whether ${CC-cc} accepts -g" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -2381,17 +2448,23 @@ + i*86-*-mingw*) TARGET=X86_WIN32; TARGETDIR=x86;; + sparc-sun-4*) TARGET=SPARC; TARGETDIR=sparc;; + sparc*-sun-*) TARGET=SPARC; TARGETDIR=sparc;; +-sparc-*-linux*) TARGET=SPARC; TARGETDIR=sparc;; +-sparc64-*-linux*) TARGET=SPARC; TARGETDIR=sparc;; +-alpha*-*-linux* | alpha*-*-osf* | alpha*-*-freebsd*) TARGET=ALPHA; TARGETDIR=alpha;; ++sparc-*-linux* | sparc-*-netbsdelf*) TARGET=SPARC; TARGETDIR=sparc;; ++sparc64-*-linux* | sparc64-*-netbsd*) TARGET=SPARC; TARGETDIR=sparc;; ++alpha*-*-linux* | alpha*-*-osf* | alpha*-*-freebsd* | alpha*-*-netbsd*) TARGET=ALPHA; TARGETDIR=alpha;; + ia64*-*-*) TARGET=IA64; TARGETDIR=ia64;; + m68k-*-linux*) TARGET=M68K; TARGETDIR=m68k;; ++mips64*-*);; ++mips*-*-linux*) TARGET=MIPS_LINUX; TARGETDIR=mips;; + powerpc-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; TARGETDIR=powerpc;; + powerpc-*-beos*) TARGET=POWERPC; TARGETDIR=powerpc;; + powerpc-*-darwin*) TARGET=POWERPC_DARWIN; TARGETDIR=powerpc;; + powerpc-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc;; + rs6000-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc;; + arm*-*-linux-*) TARGET=ARM; TARGETDIR=arm;; ++s390-*-linux-*) TARGET=S390; TARGETDIR=s390;; ++s390x-*-linux-*) TARGET=S390; TARGETDIR=s390;; ++x86_64-*-linux*) TARGET=X86_64; TARGETDIR=x86;; ++sh-*-linux* | sh[34]*-*-linux*) TARGET=SH; TARGETDIR=sh;; + esac + + if test $TARGETDIR = unknown; then +@@ -2418,6 +2491,15 @@ + fi + + ++if test x$TARGET = xMIPS_LINUX; then ++ MIPS_LINUX_TRUE= ++ MIPS_LINUX_FALSE='#' ++else ++ MIPS_LINUX_TRUE='#' ++ MIPS_LINUX_FALSE= ++fi ++ ++ + if test x$TARGET = xSPARC; then + SPARC_TRUE= + SPARC_FALSE='#' +@@ -2507,8 +2589,39 @@ + ARM_FALSE= + fi + ++ ++if test x$TARGET = xS390; then ++ S390_TRUE= ++ S390_FALSE='#' ++else ++ S390_TRUE='#' ++ S390_FALSE= ++fi ++ ++ ++if test x$TARGET = xX86_64; then ++ X86_64_TRUE= ++ X86_64_FALSE='#' ++else ++ X86_64_TRUE='#' ++ X86_64_FALSE= ++fi ++ ++ ++if test x$TARGET = xSH; then ++ SH_TRUE= ++ SH_FALSE='#' ++else ++ SH_TRUE='#' ++ SH_FALSE= ++fi ++ ++if test x$TARGET = xMIPS_LINUX; then ++ TARGET=MIPS ++fi ++ + echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +-echo "configure:2512: checking how to run the C preprocessor" >&5 ++echo "configure:2625: checking how to run the C preprocessor" >&5 + # On Suns, sometimes $CPP names a directory. + if test -n "$CPP" && test -d "$CPP"; then + CPP= +@@ -2523,13 +2636,13 @@ + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext <<EOF +-#line 2527 "configure" ++#line 2640 "configure" + #include "confdefs.h" + #include <assert.h> + Syntax Error + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:2533: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++{ (eval echo configure:2646: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + : +@@ -2540,13 +2653,13 @@ + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext <<EOF +-#line 2544 "configure" ++#line 2657 "configure" + #include "confdefs.h" + #include <assert.h> + Syntax Error + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:2550: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++{ (eval echo configure:2663: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + : +@@ -2557,13 +2670,13 @@ + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext <<EOF +-#line 2561 "configure" ++#line 2674 "configure" + #include "confdefs.h" + #include <assert.h> + Syntax Error + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:2567: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++{ (eval echo configure:2680: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + : +@@ -2588,12 +2701,12 @@ + echo "$ac_t""$CPP" 1>&6 + + echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +-echo "configure:2592: checking for ANSI C header files" >&5 ++echo "configure:2705: checking for ANSI C header files" >&5 + if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <<EOF +-#line 2597 "configure" ++#line 2710 "configure" + #include "confdefs.h" + #include <stdlib.h> + #include <stdarg.h> +@@ -2601,7 +2714,7 @@ + #include <float.h> + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:2605: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++{ (eval echo configure:2718: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* +@@ -2618,7 +2731,7 @@ + if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat > conftest.$ac_ext <<EOF +-#line 2622 "configure" ++#line 2735 "configure" + #include "confdefs.h" + #include <string.h> + EOF +@@ -2636,7 +2749,7 @@ + if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat > conftest.$ac_ext <<EOF +-#line 2640 "configure" ++#line 2753 "configure" + #include "confdefs.h" + #include <stdlib.h> + EOF +@@ -2657,7 +2770,7 @@ + : + else + cat > conftest.$ac_ext <<EOF +-#line 2661 "configure" ++#line 2774 "configure" + #include "confdefs.h" + #include <ctype.h> + #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +@@ -2668,7 +2781,7 @@ + exit (0); } + + EOF +-if { (eval echo configure:2672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null ++if { (eval echo configure:2785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null + then + : + else +@@ -2694,12 +2807,12 @@ + for ac_func in memcpy + do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +-echo "configure:2698: checking for $ac_func" >&5 ++echo "configure:2811: checking for $ac_func" >&5 + if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <<EOF +-#line 2703 "configure" ++#line 2816 "configure" + #include "confdefs.h" + /* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +@@ -2722,7 +2835,7 @@ + + ; return 0; } + EOF +-if { (eval echo configure:2726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:2839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" + else +@@ -2749,19 +2862,19 @@ + # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works + # for constant arguments. Useless! + echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 +-echo "configure:2753: checking for working alloca.h" >&5 ++echo "configure:2866: checking for working alloca.h" >&5 + if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <<EOF +-#line 2758 "configure" ++#line 2871 "configure" + #include "confdefs.h" + #include <alloca.h> + int main() { + char *p = alloca(2 * sizeof(int)); + ; return 0; } + EOF +-if { (eval echo configure:2765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:2878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_header_alloca_h=yes + else +@@ -2782,12 +2895,12 @@ + fi + + echo $ac_n "checking for alloca""... $ac_c" 1>&6 +-echo "configure:2786: checking for alloca" >&5 ++echo "configure:2899: checking for alloca" >&5 + if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <<EOF +-#line 2791 "configure" ++#line 2904 "configure" + #include "confdefs.h" + + #ifdef __GNUC__ +@@ -2815,7 +2928,7 @@ + char *p = (char *) alloca(1); + ; return 0; } + EOF +-if { (eval echo configure:2819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:2932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_func_alloca_works=yes + else +@@ -2847,12 +2960,12 @@ + + + echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 +-echo "configure:2851: checking whether alloca needs Cray hooks" >&5 ++echo "configure:2964: checking whether alloca needs Cray hooks" >&5 + if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <<EOF +-#line 2856 "configure" ++#line 2969 "configure" + #include "confdefs.h" + #if defined(CRAY) && ! defined(CRAY2) + webecray +@@ -2877,12 +2990,12 @@ + if test $ac_cv_os_cray = yes; then + for ac_func in _getb67 GETB67 getb67; do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +-echo "configure:2881: checking for $ac_func" >&5 ++echo "configure:2994: checking for $ac_func" >&5 + if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <<EOF +-#line 2886 "configure" ++#line 2999 "configure" + #include "confdefs.h" + /* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +@@ -2905,7 +3018,7 @@ + + ; return 0; } + EOF +-if { (eval echo configure:2909: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:3022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" + else +@@ -2932,7 +3045,7 @@ + fi + + echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 +-echo "configure:2936: checking stack direction for C alloca" >&5 ++echo "configure:3049: checking stack direction for C alloca" >&5 + if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -2940,7 +3053,7 @@ + ac_cv_c_stack_direction=0 + else + cat > conftest.$ac_ext <<EOF +-#line 2944 "configure" ++#line 3057 "configure" + #include "confdefs.h" + find_stack_direction () + { +@@ -2959,7 +3072,7 @@ + exit (find_stack_direction() < 0); + } + EOF +-if { (eval echo configure:2963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null ++if { (eval echo configure:3076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null + then + ac_cv_c_stack_direction=1 + else +@@ -2982,13 +3095,13 @@ + + + echo $ac_n "checking size of short""... $ac_c" 1>&6 +-echo "configure:2986: checking size of short" >&5 ++echo "configure:3099: checking size of short" >&5 + if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. + cat > conftest.$ac_ext <<EOF +-#line 2992 "configure" ++#line 3105 "configure" + #include "confdefs.h" + #include "confdefs.h" + #include <sys/types.h> +@@ -2998,7 +3111,7 @@ + switch (0) case 0: case (sizeof (short) == $ac_size):; + ; return 0; } + EOF +-if { (eval echo configure:3002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++if { (eval echo configure:3115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sizeof_short=$ac_size + else +@@ -3021,13 +3134,13 @@ + + + echo $ac_n "checking size of int""... $ac_c" 1>&6 +-echo "configure:3025: checking size of int" >&5 ++echo "configure:3138: checking size of int" >&5 + if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. + cat > conftest.$ac_ext <<EOF +-#line 3031 "configure" ++#line 3144 "configure" + #include "confdefs.h" + #include "confdefs.h" + #include <sys/types.h> +@@ -3037,7 +3150,7 @@ + switch (0) case 0: case (sizeof (int) == $ac_size):; + ; return 0; } + EOF +-if { (eval echo configure:3041: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++if { (eval echo configure:3154: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sizeof_int=$ac_size + else +@@ -3060,13 +3173,13 @@ + + + echo $ac_n "checking size of long""... $ac_c" 1>&6 +-echo "configure:3064: checking size of long" >&5 ++echo "configure:3177: checking size of long" >&5 + if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. + cat > conftest.$ac_ext <<EOF +-#line 3070 "configure" ++#line 3183 "configure" + #include "confdefs.h" + #include "confdefs.h" + #include <sys/types.h> +@@ -3076,7 +3189,7 @@ + switch (0) case 0: case (sizeof (long) == $ac_size):; + ; return 0; } + EOF +-if { (eval echo configure:3080: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++if { (eval echo configure:3193: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sizeof_long=$ac_size + else +@@ -3099,13 +3212,13 @@ + + + echo $ac_n "checking size of long long""... $ac_c" 1>&6 +-echo "configure:3103: checking size of long long" >&5 ++echo "configure:3216: checking size of long long" >&5 + if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. + cat > conftest.$ac_ext <<EOF +-#line 3109 "configure" ++#line 3222 "configure" + #include "confdefs.h" + #include "confdefs.h" + #include <sys/types.h> +@@ -3115,7 +3228,7 @@ + switch (0) case 0: case (sizeof (long long) == $ac_size):; + ; return 0; } + EOF +-if { (eval echo configure:3119: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++if { (eval echo configure:3232: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sizeof_long_long=$ac_size + else +@@ -3138,13 +3251,13 @@ + + + echo $ac_n "checking size of float""... $ac_c" 1>&6 +-echo "configure:3142: checking size of float" >&5 ++echo "configure:3255: checking size of float" >&5 + if eval "test \"`echo '$''{'ac_cv_sizeof_float'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. + cat > conftest.$ac_ext <<EOF +-#line 3148 "configure" ++#line 3261 "configure" + #include "confdefs.h" + #include "confdefs.h" + #include <sys/types.h> +@@ -3154,7 +3267,7 @@ + switch (0) case 0: case (sizeof (float) == $ac_size):; + ; return 0; } + EOF +-if { (eval echo configure:3158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++if { (eval echo configure:3271: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sizeof_float=$ac_size + else +@@ -3177,13 +3290,13 @@ + + + echo $ac_n "checking size of double""... $ac_c" 1>&6 +-echo "configure:3181: checking size of double" >&5 ++echo "configure:3294: checking size of double" >&5 + if eval "test \"`echo '$''{'ac_cv_sizeof_double'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. + cat > conftest.$ac_ext <<EOF +-#line 3187 "configure" ++#line 3300 "configure" + #include "confdefs.h" + #include "confdefs.h" + #include <sys/types.h> +@@ -3193,7 +3306,7 @@ + switch (0) case 0: case (sizeof (double) == $ac_size):; + ; return 0; } + EOF +-if { (eval echo configure:3197: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++if { (eval echo configure:3310: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sizeof_double=$ac_size + else +@@ -3216,13 +3329,13 @@ + + + echo $ac_n "checking size of long double""... $ac_c" 1>&6 +-echo "configure:3220: checking size of long double" >&5 ++echo "configure:3333: checking size of long double" >&5 + if eval "test \"`echo '$''{'ac_cv_sizeof_long_double'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. + cat > conftest.$ac_ext <<EOF +-#line 3226 "configure" ++#line 3339 "configure" + #include "confdefs.h" + #include "confdefs.h" + #include <sys/types.h> +@@ -3232,7 +3345,7 @@ + switch (0) case 0: case (sizeof (long double) == $ac_size):; + ; return 0; } + EOF +-if { (eval echo configure:3236: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++if { (eval echo configure:3349: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sizeof_long_double=$ac_size + else +@@ -3256,13 +3369,13 @@ + + + echo $ac_n "checking size of void *""... $ac_c" 1>&6 +-echo "configure:3260: checking size of void *" >&5 ++echo "configure:3373: checking size of void *" >&5 + if eval "test \"`echo '$''{'ac_cv_sizeof_void_p'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. + cat > conftest.$ac_ext <<EOF +-#line 3266 "configure" ++#line 3379 "configure" + #include "confdefs.h" + #include "confdefs.h" + #include <sys/types.h> +@@ -3272,7 +3385,7 @@ + switch (0) case 0: case (sizeof (void *) == $ac_size):; + ; return 0; } + EOF +-if { (eval echo configure:3276: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++if { (eval echo configure:3389: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sizeof_void_p=$ac_size + else +@@ -3295,14 +3408,14 @@ + + + echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 +-echo "configure:3299: checking whether byte ordering is bigendian" >&5 ++echo "configure:3412: checking whether byte ordering is bigendian" >&5 + if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + ac_cv_c_bigendian=unknown + # See if sys/param.h defines the BYTE_ORDER macro. + cat > conftest.$ac_ext <<EOF +-#line 3306 "configure" ++#line 3419 "configure" + #include "confdefs.h" + #include <sys/types.h> + #include <sys/param.h> +@@ -3313,11 +3426,11 @@ + #endif + ; return 0; } + EOF +-if { (eval echo configure:3317: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++if { (eval echo configure:3430: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + # It does; now see whether it defined to BIG_ENDIAN or not. + cat > conftest.$ac_ext <<EOF +-#line 3321 "configure" ++#line 3434 "configure" + #include "confdefs.h" + #include <sys/types.h> + #include <sys/param.h> +@@ -3328,7 +3441,7 @@ + #endif + ; return 0; } + EOF +-if { (eval echo configure:3332: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++if { (eval echo configure:3445: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_bigendian=yes + else +@@ -3348,7 +3461,7 @@ + echo $ac_n "cross-compiling... " 2>&6 + else + cat > conftest.$ac_ext <<EOF +-#line 3352 "configure" ++#line 3465 "configure" + #include "confdefs.h" + main () { + /* Are we little or big endian? From Harbison&Steele. */ +@@ -3361,7 +3474,7 @@ + exit (u.c[sizeof (long) - 1] == 1); + } + EOF +-if { (eval echo configure:3365: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null ++if { (eval echo configure:3478: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null + then + ac_cv_c_bigendian=no + else +@@ -3379,7 +3492,7 @@ + echo "$ac_t""$ac_cv_c_bigendian" 1>&6 + if test $ac_cv_c_bigendian = unknown; then + echo $ac_n "checking to probe for byte ordering""... $ac_c" 1>&6 +-echo "configure:3383: checking to probe for byte ordering" >&5 ++echo "configure:3496: checking to probe for byte ordering" >&5 + + cat >conftest.c <<EOF + short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +@@ -3414,6 +3527,10 @@ + #define WORDS_BIGENDIAN 1 + EOF + ++ cat >> confdefs.h <<\EOF ++#define HOST_WORDS_BIG_ENDIAN 1 ++EOF ++ + BYTEORDER=4321 + else + BYTEORDER=1234 +@@ -3429,7 +3546,7 @@ + + if test x$TARGET = xSPARC; then + echo $ac_n "checking assembler and linker support unaligned pc related relocs""... $ac_c" 1>&6 +-echo "configure:3433: checking assembler and linker support unaligned pc related relocs" >&5 ++echo "configure:3550: checking assembler and linker support unaligned pc related relocs" >&5 + if eval "test \"`echo '$''{'libffi_cv_as_sparc_ua_pcrel'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else +@@ -3439,14 +3556,14 @@ + CFLAGS="$CFLAGS -fpic" + LDFLAGS="$LDFLAGS -shared" + cat > conftest.$ac_ext <<EOF +-#line 3443 "configure" ++#line 3560 "configure" + #include "confdefs.h" + asm (".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo); .text"); + int main() { + + ; return 0; } + EOF +-if { (eval echo configure:3450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ++if { (eval echo configure:3567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + libffi_cv_as_sparc_ua_pcrel=yes + else +@@ -3709,6 +3826,8 @@ + s%@MIPS_GCC_FALSE@%$MIPS_GCC_FALSE%g + s%@MIPS_SGI_TRUE@%$MIPS_SGI_TRUE%g + s%@MIPS_SGI_FALSE@%$MIPS_SGI_FALSE%g ++s%@MIPS_LINUX_TRUE@%$MIPS_LINUX_TRUE%g ++s%@MIPS_LINUX_FALSE@%$MIPS_LINUX_FALSE%g + s%@SPARC_TRUE@%$SPARC_TRUE%g + s%@SPARC_FALSE@%$SPARC_FALSE%g + s%@X86_TRUE@%$X86_TRUE%g +@@ -3729,6 +3848,12 @@ + s%@POWERPC_DARWIN_FALSE@%$POWERPC_DARWIN_FALSE%g + s%@ARM_TRUE@%$ARM_TRUE%g + s%@ARM_FALSE@%$ARM_FALSE%g ++s%@S390_TRUE@%$S390_TRUE%g ++s%@S390_FALSE@%$S390_FALSE%g ++s%@X86_64_TRUE@%$X86_64_TRUE%g ++s%@X86_64_FALSE@%$X86_64_FALSE%g ++s%@SH_TRUE@%$SH_TRUE%g ++s%@SH_FALSE@%$SH_FALSE%g + s%@CPP@%$CPP%g + s%@ALLOCA@%$ALLOCA%g + s%@TARGET@%$TARGET%g +@@ -3969,7 +4094,7 @@ + + if test -n "$CONFIG_FILES"; then + LD="${ORIGINAL_LD_FOR_MULTILIBS}" +- ac_file=Makefile . ${libffi_basedir}/../config-ml.in ++ ac_file=Makefile . ${srcdir}/${libffi_basedir}../config-ml.in + fi + + exit 0 +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/configure.in gcc/libffi/configure.in +--- gcc-3.2.2.orig/libffi/configure.in Tue Jan 28 10:43:56 2003 ++++ gcc/libffi/configure.in Sat Feb 1 20:16:19 2003 +@@ -22,14 +22,15 @@ + + if test "${srcdir}" = "."; then + if test "${with_target_subdir}" != "."; then +- libffi_basedir="${srcdir}/${with_multisrctop}.." ++ libffi_basedir="${with_multisrctop}../" + else +- libffi_basedir="${srcdir}/${with_multisrctop}" ++ libffi_basedir="${with_multisrctop}" + fi + else +- libffi_basedir="${srcdir}" ++ libffi_basedir= + fi + AC_SUBST(libffi_basedir) ++AC_CONFIG_AUX_DIR(${libffi_basedir}..) + + AC_CANONICAL_HOST + +@@ -56,17 +57,23 @@ + i*86-*-mingw*) TARGET=X86_WIN32; TARGETDIR=x86;; + sparc-sun-4*) TARGET=SPARC; TARGETDIR=sparc;; + sparc*-sun-*) TARGET=SPARC; TARGETDIR=sparc;; +-sparc-*-linux*) TARGET=SPARC; TARGETDIR=sparc;; +-sparc64-*-linux*) TARGET=SPARC; TARGETDIR=sparc;; +-alpha*-*-linux* | alpha*-*-osf* | alpha*-*-freebsd*) TARGET=ALPHA; TARGETDIR=alpha;; ++sparc-*-linux* | sparc-*-netbsdelf*) TARGET=SPARC; TARGETDIR=sparc;; ++sparc64-*-linux* | sparc64-*-netbsd*) TARGET=SPARC; TARGETDIR=sparc;; ++alpha*-*-linux* | alpha*-*-osf* | alpha*-*-freebsd* | alpha*-*-netbsd*) TARGET=ALPHA; TARGETDIR=alpha;; + ia64*-*-*) TARGET=IA64; TARGETDIR=ia64;; + m68k-*-linux*) TARGET=M68K; TARGETDIR=m68k;; ++mips64*-*);; ++mips*-*-linux*) TARGET=MIPS_LINUX; TARGETDIR=mips;; + powerpc-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; TARGETDIR=powerpc;; + powerpc-*-beos*) TARGET=POWERPC; TARGETDIR=powerpc;; + powerpc-*-darwin*) TARGET=POWERPC_DARWIN; TARGETDIR=powerpc;; + powerpc-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc;; + rs6000-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc;; + arm*-*-linux-*) TARGET=ARM; TARGETDIR=arm;; ++s390-*-linux-*) TARGET=S390; TARGETDIR=s390;; ++s390x-*-linux-*) TARGET=S390; TARGETDIR=s390;; ++x86_64-*-linux*) TARGET=X86_64; TARGETDIR=x86;; ++sh-*-linux* | sh[[34]]*-*-linux*) TARGET=SH; TARGETDIR=sh;; + esac + + if test $TARGETDIR = unknown; then +@@ -75,6 +82,7 @@ + + AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes) + AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno) ++AM_CONDITIONAL(MIPS_LINUX, test x$TARGET = xMIPS_LINUX) + AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) + AM_CONDITIONAL(X86, test x$TARGET = xX86) + AM_CONDITIONAL(X86_WIN32, test x$TARGET = xX86_WIN32) +@@ -85,6 +93,13 @@ + AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX) + AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN) + AM_CONDITIONAL(ARM, test x$TARGET = xARM) ++AM_CONDITIONAL(S390, test x$TARGET = xS390) ++AM_CONDITIONAL(X86_64, test x$TARGET = xX86_64) ++AM_CONDITIONAL(SH, test x$TARGET = xSH) ++ ++if test x$TARGET = xMIPS_LINUX; then ++ TARGET=MIPS ++fi + + AC_HEADER_STDC + AC_CHECK_FUNCS(memcpy) +@@ -171,7 +186,7 @@ + [ + if test -n "$CONFIG_FILES"; then + LD="${ORIGINAL_LD_FOR_MULTILIBS}" +- ac_file=Makefile . ${libffi_basedir}/../config-ml.in ++ ac_file=Makefile . ${srcdir}/${libffi_basedir}../config-ml.in + fi + ], + srcdir=${srcdir} +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/include/Makefile.in gcc/libffi/include/Makefile.in +--- gcc-3.2.2.orig/libffi/include/Makefile.in Tue Oct 9 14:32:16 2001 ++++ gcc/libffi/include/Makefile.in Mon Apr 29 13:14:44 2002 +@@ -99,7 +99,7 @@ + + DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +-TAR = gnutar ++TAR = gtar + GZIP_ENV = --best + all: all-redirect + .SUFFIXES: +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/include/ffi.h.in gcc/libffi/include/ffi.h.in +--- gcc-3.2.2.orig/libffi/include/ffi.h.in Wed Mar 13 07:35:56 2002 ++++ gcc/libffi/include/ffi.h.in Wed Jan 29 00:54:28 2003 +@@ -1,5 +1,5 @@ + /* -----------------------------------------------------------------*-C-*- +- libffi @VERSION@ - Copyright (c) 1996-2002 Cygnus Solutions ++ libffi @VERSION@ - Copyright (c) 1996-2003 Cygnus Solutions + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the +@@ -164,6 +164,12 @@ + #endif + #endif + ++#ifdef S390 ++#if defined (__s390x__) ++#define S390X ++#endif ++#endif ++ + #ifndef LIBFFI_ASM + + /* ---- Generic type definitions ----------------------------------------- */ +@@ -189,16 +195,23 @@ + #endif + #endif + +- /* ---- Intel x86 ---------------- */ +-#ifdef X86 ++ /* ---- Intel x86 Win32 ---------- */ ++#ifdef X86_WIN32 + FFI_SYSV, ++ FFI_STDCALL, ++ /* TODO: Add fastcall support for the sake of completeness */ + FFI_DEFAULT_ABI = FFI_SYSV, + #endif + +- /* ---- Intel x86 Win32 ---------- */ +-#ifdef X86_WIN32 ++ /* ---- Intel x86 and AMD x86-64 - */ ++#if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__)) + FFI_SYSV, ++ FFI_UNIX64, /* Unix variants all use the same ABI for x86-64 */ ++#ifdef __i386__ + FFI_DEFAULT_ABI = FFI_SYSV, ++#else ++ FFI_DEFAULT_ABI = FFI_UNIX64, ++#endif + #endif + + /* ---- Intel ia64 ---------------- */ +@@ -251,6 +264,18 @@ + FFI_DEFAULT_ABI = FFI_SYSV, + #endif + ++ /* ---- S390 --------------------- */ ++#ifdef S390 ++ FFI_SYSV, ++ FFI_DEFAULT_ABI = FFI_SYSV, ++#endif ++ ++ /* ---- SuperH ------------------- */ ++#ifdef SH ++ FFI_SYSV, ++ FFI_DEFAULT_ABI = FFI_SYSV, ++#endif ++ + /* Leave this for debugging purposes */ + FFI_LAST_ABI + +@@ -264,7 +289,7 @@ + /*@null@*/ struct _ffi_type **elements; + } ffi_type; + +-/* These are defined in ffi.c */ ++/* These are defined in types.c */ + extern ffi_type ffi_type_void; + extern ffi_type ffi_type_uint8; + extern ffi_type ffi_type_sint8; +@@ -373,13 +398,7 @@ + + /* ---- Definitions for closures ----------------------------------------- */ + +-#ifdef X86 +- +-#define FFI_CLOSURES 1 /* x86 supports closures */ +-#define FFI_TRAMPOLINE_SIZE 10 +-#define FFI_NATIVE_RAW_API 1 /* and has native raw api support */ +- +-#elif defined(X86_WIN32) ++#ifdef __i386__ + + #define FFI_CLOSURES 1 /* x86 supports closures */ + #define FFI_TRAMPOLINE_SIZE 10 +@@ -424,6 +443,40 @@ + #define FFI_TRAMPOLINE_SIZE 24 /* see struct below */ + #define FFI_NATIVE_RAW_API 0 + ++#elif defined(SPARC64) ++ ++#define FFI_CLOSURES 1 ++#define FFI_TRAMPOLINE_SIZE 24 ++#define FFI_NATIVE_RAW_API 0 ++ ++#elif defined(SPARC) ++ ++#define FFI_CLOSURES 1 ++#define FFI_TRAMPOLINE_SIZE 16 ++#define FFI_NATIVE_RAW_API 0 ++ ++#elif defined(S390) ++ ++#define FFI_CLOSURES 1 ++#ifdef S390X ++#define FFI_TRAMPOLINE_SIZE 32 ++#else ++#define FFI_TRAMPOLINE_SIZE 16 ++#endif ++#define FFI_NATIVE_RAW_API 0 ++ ++#elif defined(SH) ++ ++#define FFI_CLOSURES 1 ++#define FFI_TRAMPOLINE_SIZE 16 ++#define FFI_NATIVE_RAW_API 0 ++ ++#elif defined(__x86_64__) ++ ++#define FFI_CLOSURES 1 ++#define FFI_TRAMPOLINE_SIZE 24 ++#define FFI_NATIVE_RAW_API 0 ++ + #else + + #define FFI_CLOSURES 0 +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/arm/ffi.c gcc/libffi/src/arm/ffi.c +--- gcc-3.2.2.orig/libffi/src/arm/ffi.c Sat Mar 3 07:21:23 2001 ++++ gcc/libffi/src/arm/ffi.c Fri Jul 19 08:08:30 2002 +@@ -36,13 +36,10 @@ + /*@=exportheader@*/ + { + register unsigned int i; +- register int tmp; +- register unsigned int avn; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + +- tmp = 0; + argp = stack; + + if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT ) { +@@ -50,11 +47,10 @@ + argp += 4; + } + +- avn = ecif->cif->nargs; + p_argv = ecif->avalue; + + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; +- (i != 0) && (avn != 0); ++ (i != 0); + i--, p_arg++) + { + size_t z; +@@ -64,9 +60,6 @@ + argp = (char *) ALIGN(argp, (*p_arg)->alignment); + } + +- if (avn != 0) +- { +- avn--; + z = (*p_arg)->size; + if (z < sizeof(int)) + { +@@ -107,7 +100,6 @@ + } + p_argv++; + argp += z; +- } + } + + return; +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/arm/sysv.S gcc/libffi/src/arm/sysv.S +--- gcc-3.2.2.orig/libffi/src/arm/sysv.S Sat Mar 3 07:21:23 2001 ++++ gcc/libffi/src/arm/sysv.S Mon Sep 30 03:08:58 2002 +@@ -28,8 +28,15 @@ + #ifdef HAVE_MACHINE_ASM_H + #include <machine/asm.h> + #else +-/* XXX these lose for some platforms, I'm sure. */ ++#ifdef __USER_LABEL_PREFIX__ ++#define CONCAT1(a, b) CONCAT2(a, b) ++#define CONCAT2(a, b) a ## b ++ ++/* Use the right prefix for global labels. */ ++#define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x) ++#else + #define CNAME(x) x ++#endif + #define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): + #endif + +@@ -96,12 +103,20 @@ + + # return FLOAT + cmp a4, #FFI_TYPE_FLOAT ++#ifdef __SOFTFP__ ++ streq a1, [a3] ++#else + stfeqs f0, [a3] ++#endif + beq epilogue + + # return DOUBLE or LONGDOUBLE + cmp a4, #FFI_TYPE_DOUBLE ++#ifdef __SOFTFP__ ++ stmeqia a3, {a1, a2} ++#else + stfeqd f0, [a3] ++#endif + + epilogue: + ldmfd sp!, {a1-a4, fp, pc} +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/java_raw_api.c gcc/libffi/src/java_raw_api.c +--- gcc-3.2.2.orig/libffi/src/java_raw_api.c Tue Apr 9 07:31:14 2002 ++++ gcc/libffi/src/java_raw_api.c Tue Oct 8 23:55:02 2002 +@@ -81,21 +81,14 @@ + { + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: +- *args = (void*) ((char*)(raw++) + SIZEOF_ARG - 1); ++ *args = (void*) ((char*)(raw++) + 3); + break; + + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: +- *args = (void*) ((char*)(raw++) + SIZEOF_ARG - 2); ++ *args = (void*) ((char*)(raw++) + 2); + break; + +-#if SIZEOF_ARG >= 4 +- case FFI_TYPE_UINT32: +- case FFI_TYPE_SINT32: +- *args = (void*) ((char*)(raw++) + SIZEOF_ARG - 4); +- break; +-#endif +- + #if SIZEOF_ARG == 8 + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: +@@ -157,31 +150,54 @@ + switch ((*tp)->type) + { + case FFI_TYPE_UINT8: ++#if WORDS_BIGENDIAN ++ *(UINT32*)(raw++) = *(UINT8*) (*args); ++#else + (raw++)->uint = *(UINT8*) (*args); ++#endif + break; + + case FFI_TYPE_SINT8: ++#if WORDS_BIGENDIAN ++ *(SINT32*)(raw++) = *(SINT8*) (*args); ++#else + (raw++)->sint = *(SINT8*) (*args); ++#endif + break; + + case FFI_TYPE_UINT16: ++#if WORDS_BIGENDIAN ++ *(UINT32*)(raw++) = *(UINT16*) (*args); ++#else + (raw++)->uint = *(UINT16*) (*args); ++#endif + break; + + case FFI_TYPE_SINT16: ++#if WORDS_BIGENDIAN ++ *(SINT32*)(raw++) = *(SINT16*) (*args); ++#else + (raw++)->sint = *(SINT16*) (*args); ++#endif + break; + +-#if SIZEOF_ARG >= 4 + case FFI_TYPE_UINT32: ++#if WORDS_BIGENDIAN ++ *(UINT32*)(raw++) = *(UINT32*) (*args); ++#else + (raw++)->uint = *(UINT32*) (*args); ++#endif + break; + + case FFI_TYPE_SINT32: ++#if WORDS_BIGENDIAN ++ *(SINT32*)(raw++) = *(SINT32*) (*args); ++#else + (raw++)->sint = *(SINT32*) (*args); +- break; + #endif +- case FFI_TYPE_FLOAT: ++ break; ++ ++ case FFI_TYPE_FLOAT: + (raw++)->flt = *(FLOAT32*) (*args); + break; + +@@ -211,6 +227,55 @@ + + #if !FFI_NATIVE_RAW_API + ++static void ++ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue) ++{ ++#if WORDS_BIGENDIAN && SIZEOF_ARG == 8 ++ switch (cif->rtype->type) ++ { ++ case FFI_TYPE_UINT8: ++ case FFI_TYPE_UINT16: ++ case FFI_TYPE_UINT32: ++ *(UINT64 *)rvalue <<= 32; ++ break; ++ ++ case FFI_TYPE_SINT8: ++ case FFI_TYPE_SINT16: ++ case FFI_TYPE_SINT32: ++ case FFI_TYPE_INT: ++ *(SINT64 *)rvalue <<= 32; ++ break; ++ ++ default: ++ break; ++ } ++#endif ++} ++ ++static void ++ffi_java_raw_to_rvalue (ffi_cif *cif, void *rvalue) ++{ ++#if WORDS_BIGENDIAN && SIZEOF_ARG == 8 ++ switch (cif->rtype->type) ++ { ++ case FFI_TYPE_UINT8: ++ case FFI_TYPE_UINT16: ++ case FFI_TYPE_UINT32: ++ *(UINT64 *)rvalue >>= 32; ++ break; ++ ++ case FFI_TYPE_SINT8: ++ case FFI_TYPE_SINT16: ++ case FFI_TYPE_SINT32: ++ case FFI_TYPE_INT: ++ *(SINT64 *)rvalue >>= 32; ++ break; ++ ++ default: ++ break; ++ } ++#endif ++} + + /* This is a generic definition of ffi_raw_call, to be used if the + * native system does not provide a machine-specific implementation. +@@ -227,6 +292,7 @@ + void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); + ffi_java_raw_to_ptrarray (cif, raw, avalue); + ffi_call (cif, fn, rvalue, avalue); ++ ffi_java_rvalue_to_raw (cif, rvalue); + } + + #if FFI_CLOSURES /* base system provides closures */ +@@ -240,6 +306,7 @@ + + ffi_java_ptrarray_to_raw (cif, avalue, raw); + (*cl->fun) (cif, rvalue, raw, cl->user_data); ++ ffi_java_raw_to_rvalue (cif, rvalue); + } + + /* Again, here is the generic version of ffi_prep_raw_closure, which +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/m68k/ffi.c gcc/libffi/src/m68k/ffi.c +--- gcc-3.2.2.orig/libffi/src/m68k/ffi.c Sun Aug 8 22:27:19 1999 ++++ gcc/libffi/src/m68k/ffi.c Fri Jul 19 08:08:30 2002 +@@ -16,14 +16,11 @@ + ffi_prep_args (void *stack, extended_cif *ecif) + { + unsigned int i; +- int tmp; +- unsigned int avn; + void **p_argv; + char *argp; + ffi_type **p_arg; + void *struct_value_ptr; + +- tmp = 0; + argp = stack; + + if (ecif->cif->rtype->type == FFI_TYPE_STRUCT +@@ -32,11 +29,10 @@ + else + struct_value_ptr = NULL; + +- avn = ecif->cif->nargs; + p_argv = ecif->avalue; + + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; +- i != 0 && avn != 0; ++ i != 0; + i--, p_arg++) + { + size_t z; +@@ -45,9 +41,6 @@ + if (((*p_arg)->alignment - 1) & (unsigned) argp) + argp = (char *) ALIGN (argp, (*p_arg)->alignment); + +- if (avn != 0) +- { +- avn--; + z = (*p_arg)->size; + if (z < sizeof (int)) + { +@@ -82,7 +75,6 @@ + memcpy (argp, *p_argv, z); + p_argv++; + argp += z; +- } + } + + return struct_value_ptr; +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/mips/ffi.c gcc/libffi/src/mips/ffi.c +--- gcc-3.2.2.orig/libffi/src/mips/ffi.c Sat Mar 3 07:21:23 2001 ++++ gcc/libffi/src/mips/ffi.c Fri Jul 19 08:08:31 2002 +@@ -23,6 +23,7 @@ + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + ++#include <sgidefs.h> + #include <ffi.h> + #include <ffi_common.h> + +@@ -50,7 +51,6 @@ + int flags) + { + register int i; +- register int avn; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; +@@ -80,12 +80,9 @@ + FIX_ARGP; + } + +- avn = ecif->cif->nargs; + p_argv = ecif->avalue; + +- for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; +- i && avn; +- i--, p_arg++) ++ for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; i; i--, p_arg++) + { + size_t z; + +@@ -101,9 +98,6 @@ + #define OFFSET sizeof(int) + #endif + +- if (avn) +- { +- avn--; + z = (*p_arg)->size; + if (z < sizeof(SLOT_TYPE_UNSIGNED)) + { +@@ -179,7 +173,6 @@ + p_argv++; + argp += z; + FIX_ARGP; +- } + } + + return; +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/powerpc/darwin.S gcc/libffi/src/powerpc/darwin.S +--- gcc-3.2.2.orig/libffi/src/powerpc/darwin.S Sat Jan 19 01:22:34 2002 ++++ gcc/libffi/src/powerpc/darwin.S Thu Jan 23 03:21:55 2003 +@@ -3,8 +3,6 @@ + + PowerPC Assembly glue. + +- $Id: darwin.S,v 1.2 2002/01/18 16:22:34 dje Exp $ +- + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including +@@ -39,30 +37,34 @@ + .text + .align 2 + _ffi_call_DARWIN: +- mr r12,r8 // We only need r12 until the call, so it doesn't have to be saved... ++LFB0: ++ mr r12,r8 /* We only need r12 until the call, ++ so it doesn't have to be saved... */ ++LFB1: + /* Save the old stack pointer as AP. */ + mr r8,r1 +- ++LCFI0: + /* Allocate the stack space we need. */ + stwux r1,r1,r4 + + /* Save registers we use. */ + mflr r9 + +- stw r28,-16(r8) ++ stw r28,-16(r8) + stw r29,-12(r8) + stw r30, -8(r8) + stw r31, -4(r8) +- +- stw r9, 8(r8) ++ ++ stw r9, 8(r8) + stw r2, 20(r1) ++LCFI1: + + /* Save arguments over call... */ +- mr r31,r5 /* flags, */ +- mr r30,r6 /* rvalue, */ +- mr r29,r7 /* function address, */ +- mr r28,r8 /* our AP. */ +- ++ mr r31,r5 /* flags, */ ++ mr r30,r6 /* rvalue, */ ++ mr r29,r7 /* function address, */ ++ mr r28,r8 /* our AP. */ ++LCFI2: + /* Call ffi_prep_args. */ + mr r4,r1 + li r9,0 +@@ -145,7 +147,8 @@ + L(float_return_value): + stfs f1,0(r30) + b L(done_return_value) +-//END(_ffi_call_DARWIN) ++LFE1: ++/* END(_ffi_call_DARWIN) */ + + /* Provide a null definition of _ffi_call_AIX. */ + .text +@@ -155,5 +158,61 @@ + .align 2 + _ffi_call_AIX: + blr +-//END(_ffi_call_AIX) ++/* END(_ffi_call_AIX) */ + ++.data ++.section __TEXT,__eh_frame ++Lframe1: ++ .set L$set$0,LECIE1-LSCIE1 ++ .long L$set$0 ; Length of Common Information Entry ++LSCIE1: ++ .long 0x0 ; CIE Identifier Tag ++ .byte 0x1 ; CIE Version ++ .ascii "zR\0" ; CIE Augmentation ++ .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor ++ .byte 0x7c ; sleb128 -4; CIE Data Alignment Factor ++ .byte 0x41 ; CIE RA Column ++ .byte 0x1 ; uleb128 0x1; Augmentation size ++ .byte 0x10 ; FDE Encoding (pcrel) ++ .byte 0xc ; DW_CFA_def_cfa ++ .byte 0x1 ; uleb128 0x1 ++ .byte 0x0 ; uleb128 0x0 ++ .align 2 ++LECIE1: ++LSFDE1: ++ .set L$set$1,LEFDE1-LASFDE1 ++ .long L$set$1 ; FDE Length ++LASFDE1: ++ .set L$set$2,LASFDE1-Lframe1 ++ .long L$set$2 ; FDE CIE offset ++ .long LFB0-. ; FDE initial location ++ .set L$set$3,LFE1-LFB0 ++ .long L$set$3 ; FDE address range ++ .byte 0x0 ; uleb128 0x0; Augmentation size ++ .byte 0x4 ; DW_CFA_advance_loc4 ++ .set L$set$4,LCFI0-LFB1 ++ .long L$set$4 ++ .byte 0xd ; DW_CFA_def_cfa_register ++ .byte 0x08 ; uleb128 0x08 ++ .byte 0x4 ; DW_CFA_advance_loc4 ++ .set L$set$5,LCFI1-LCFI0 ++ .long L$set$5 ++ .byte 0x11 ; DW_CFA_offset_extended_sf ++ .byte 0x41 ; uleb128 0x41 ++ .byte 0x7e ; sleb128 -2 ++ .byte 0x9f ; DW_CFA_offset, column 0x1f ++ .byte 0x1 ; uleb128 0x1 ++ .byte 0x9e ; DW_CFA_offset, column 0x1e ++ .byte 0x2 ; uleb128 0x2 ++ .byte 0x9d ; DW_CFA_offset, column 0x1d ++ .byte 0x3 ; uleb128 0x3 ++ .byte 0x9c ; DW_CFA_offset, column 0x1c ++ .byte 0x4 ; uleb128 0x4 ++ .byte 0x4 ; DW_CFA_advance_loc4 ++ .set L$set$6,LCFI2-LCFI1 ++ .long L$set$6 ++ .byte 0xd ; DW_CFA_def_cfa_register ++ .byte 0x1c ; uleb128 0x1c ++ .align 2 ++LEFDE1: ++ +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/prep_cif.c gcc/libffi/src/prep_cif.c +--- gcc-3.2.2.orig/libffi/src/prep_cif.c Sat Mar 3 07:21:22 2001 ++++ gcc/libffi/src/prep_cif.c Mon Sep 30 20:59:42 2002 +@@ -103,7 +103,8 @@ + /* Perform a sanity check on the return type */ + FFI_ASSERT(ffi_type_test(cif->rtype)); + +-#ifndef M68K ++ /* x86-64 and s390 stack space allocation is handled in prep_machdep. */ ++#if !defined M68K && !defined __x86_64__ && !defined S390 + /* Make space for the return structure pointer */ + if (cif->rtype->type == FFI_TYPE_STRUCT + #ifdef SPARC +@@ -122,6 +123,7 @@ + if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) + return FFI_BAD_TYPEDEF; + ++#if !defined __x86_64__ && !defined S390 + #ifdef SPARC + if (((*ptr)->type == FFI_TYPE_STRUCT + && ((*ptr)->size > 16 || cif->abi != FFI_V9)) +@@ -137,6 +139,7 @@ + + bytes += STACK_ARG_SIZE((*ptr)->size); + } ++#endif + } + + cif->bytes = bytes; +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/s390/ffi.c gcc/libffi/src/s390/ffi.c +--- gcc-3.2.2.orig/libffi/src/s390/ffi.c Thu Jan 1 09:00:00 1970 ++++ gcc/libffi/src/s390/ffi.c Thu Feb 6 08:58:57 2003 +@@ -0,0 +1,753 @@ ++/* ----------------------------------------------------------------------- ++ ffi.c - Copyright (c) 2000 Software AG ++ ++ S390 Foreign Function Interface ++ ++ Permission is hereby granted, free of charge, to any person obtaining ++ a copy of this software and associated documentation files (the ++ ``Software''), to deal in the Software without restriction, including ++ without limitation the rights to use, copy, modify, merge, publish, ++ distribute, sublicense, and/or sell copies of the Software, and to ++ permit persons to whom the Software is furnished to do so, subject to ++ the following conditions: ++ ++ The above copyright notice and this permission notice shall be included ++ in all copies or substantial portions of the Software. ++ ++ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS ++ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ++ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR ++ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ++ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ++ OTHER DEALINGS IN THE SOFTWARE. ++ ----------------------------------------------------------------------- */ ++/*====================================================================*/ ++/* Includes */ ++/* -------- */ ++/*====================================================================*/ ++ ++#include <ffi.h> ++#include <ffi_common.h> ++ ++#include <stdlib.h> ++#include <stdio.h> ++ ++/*====================== End of Includes =============================*/ ++ ++/*====================================================================*/ ++/* Defines */ ++/* ------- */ ++/*====================================================================*/ ++ ++/* Maximum number of GPRs available for argument passing. */ ++#define MAX_GPRARGS 5 ++ ++/* Maximum number of FPRs available for argument passing. */ ++#ifdef __s390x__ ++#define MAX_FPRARGS 4 ++#else ++#define MAX_FPRARGS 2 ++#endif ++ ++/* Round to multiple of 16. */ ++#define ROUND_SIZE(size) (((size) + 15) & ~15) ++ ++/* If these values change, sysv.S must be adapted! */ ++#define FFI390_RET_VOID 0 ++#define FFI390_RET_STRUCT 1 ++#define FFI390_RET_FLOAT 2 ++#define FFI390_RET_DOUBLE 3 ++#define FFI390_RET_INT32 4 ++#define FFI390_RET_INT64 5 ++ ++/*===================== End of Defines ===============================*/ ++ ++/*====================================================================*/ ++/* Prototypes */ ++/* ---------- */ ++/*====================================================================*/ ++ ++static void ffi_prep_args (unsigned char *, extended_cif *); ++static int ffi_check_float_struct (ffi_type *); ++void ++#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) ++__attribute__ ((visibility ("hidden"))) ++#endif ++ffi_closure_helper_SYSV (ffi_closure *, unsigned long *, ++ unsigned long long *, unsigned long *); ++ ++/*====================== End of Prototypes ===========================*/ ++ ++/*====================================================================*/ ++/* Externals */ ++/* --------- */ ++/*====================================================================*/ ++ ++extern void ffi_call_SYSV(unsigned, ++ extended_cif *, ++ void (*)(unsigned char *, extended_cif *), ++ unsigned, ++ void *, ++ void (*fn)()); ++ ++extern void ffi_closure_SYSV(void); ++ ++/*====================== End of Externals ============================*/ ++ ++/*====================================================================*/ ++/* */ ++/* Name - ffi_check_struct_type. */ ++/* */ ++/* Function - Determine if a structure can be passed within a */ ++/* general purpose or floating point register. */ ++/* */ ++/*====================================================================*/ ++ ++static int ++ffi_check_struct_type (ffi_type *arg) ++{ ++ size_t size = arg->size; ++ ++ /* If the struct has just one element, look at that element ++ to find out whether to consider the struct as floating point. */ ++ while (arg->type == FFI_TYPE_STRUCT ++ && arg->elements[0] && !arg->elements[1]) ++ arg = arg->elements[0]; ++ ++ /* Structs of size 1, 2, 4, and 8 are passed in registers, ++ just like the corresponding int/float types. */ ++ switch (size) ++ { ++ case 1: ++ return FFI_TYPE_UINT8; ++ ++ case 2: ++ return FFI_TYPE_UINT16; ++ ++ case 4: ++ if (arg->type == FFI_TYPE_FLOAT) ++ return FFI_TYPE_FLOAT; ++ else ++ return FFI_TYPE_UINT32; ++ ++ case 8: ++ if (arg->type == FFI_TYPE_DOUBLE) ++ return FFI_TYPE_DOUBLE; ++ else ++ return FFI_TYPE_UINT64; ++ ++ default: ++ break; ++ } ++ ++ /* Other structs are passed via a pointer to the data. */ ++ return FFI_TYPE_POINTER; ++} ++ ++/*======================== End of Routine ============================*/ ++ ++/*====================================================================*/ ++/* */ ++/* Name - ffi_prep_args. */ ++/* */ ++/* Function - Prepare parameters for call to function. */ ++/* */ ++/* ffi_prep_args is called by the assembly routine once stack space */ ++/* has been allocated for the function's arguments. */ ++/* */ ++/*====================================================================*/ ++ ++static void ++ffi_prep_args (unsigned char *stack, extended_cif *ecif) ++{ ++ /* The stack space will be filled with those areas: ++ ++ FPR argument register save area (highest addresses) ++ GPR argument register save area ++ temporary struct copies ++ overflow argument area (lowest addresses) ++ ++ We set up the following pointers: ++ ++ p_fpr: bottom of the FPR area (growing upwards) ++ p_gpr: bottom of the GPR area (growing upwards) ++ p_ov: bottom of the overflow area (growing upwards) ++ p_struct: top of the struct copy area (growing downwards) ++ ++ All areas are kept aligned to twice the word size. */ ++ ++ int gpr_off = ecif->cif->bytes; ++ int fpr_off = gpr_off + ROUND_SIZE (MAX_GPRARGS * sizeof (long)); ++ ++ unsigned long long *p_fpr = (unsigned long long *)(stack + fpr_off); ++ unsigned long *p_gpr = (unsigned long *)(stack + gpr_off); ++ unsigned char *p_struct = (unsigned char *)p_gpr; ++ unsigned long *p_ov = (unsigned long *)stack; ++ ++ int n_fpr = 0; ++ int n_gpr = 0; ++ int n_ov = 0; ++ ++ ffi_type **ptr; ++ void **p_argv = ecif->avalue; ++ int i; ++ ++ /* If we returning a structure then we set the first parameter register ++ to the address of where we are returning this structure. */ ++ ++ if (ecif->cif->flags == FFI390_RET_STRUCT) ++ p_gpr[n_gpr++] = (unsigned long) ecif->rvalue; ++ ++ /* Now for the arguments. */ ++ ++ for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs; ++ i > 0; ++ i--, ptr++, p_argv++) ++ { ++ void *arg = *p_argv; ++ int type = (*ptr)->type; ++ ++ /* Check how a structure type is passed. */ ++ if (type == FFI_TYPE_STRUCT) ++ { ++ type = ffi_check_struct_type (*ptr); ++ ++ /* If we pass the struct via pointer, copy the data. */ ++ if (type == FFI_TYPE_POINTER) ++ { ++ p_struct -= ROUND_SIZE ((*ptr)->size); ++ memcpy (p_struct, (char *)arg, (*ptr)->size); ++ arg = &p_struct; ++ } ++ } ++ ++ /* Pointers are passed like UINTs of the same size. */ ++ if (type == FFI_TYPE_POINTER) ++#ifdef __s390x__ ++ type = FFI_TYPE_UINT64; ++#else ++ type = FFI_TYPE_UINT32; ++#endif ++ ++ /* Now handle all primitive int/float data types. */ ++ switch (type) ++ { ++ case FFI_TYPE_DOUBLE: ++ if (n_fpr < MAX_FPRARGS) ++ p_fpr[n_fpr++] = *(unsigned long long *) arg; ++ else ++#ifdef __s390x__ ++ p_ov[n_ov++] = *(unsigned long *) arg; ++#else ++ p_ov[n_ov++] = ((unsigned long *) arg)[0], ++ p_ov[n_ov++] = ((unsigned long *) arg)[1]; ++#endif ++ break; ++ ++ case FFI_TYPE_FLOAT: ++ if (n_fpr < MAX_FPRARGS) ++ p_fpr[n_fpr++] = (long long) *(unsigned int *) arg << 32; ++ else ++ p_ov[n_ov++] = *(unsigned int *) arg; ++ break; ++ ++ case FFI_TYPE_UINT64: ++ case FFI_TYPE_SINT64: ++#ifdef __s390x__ ++ if (n_gpr < MAX_GPRARGS) ++ p_gpr[n_gpr++] = *(unsigned long *) arg; ++ else ++ p_ov[n_ov++] = *(unsigned long *) arg; ++#else ++ if (n_gpr == MAX_GPRARGS-1) ++ n_gpr = MAX_GPRARGS; ++ if (n_gpr < MAX_GPRARGS) ++ p_gpr[n_gpr++] = ((unsigned long *) arg)[0], ++ p_gpr[n_gpr++] = ((unsigned long *) arg)[1]; ++ else ++ p_ov[n_ov++] = ((unsigned long *) arg)[0], ++ p_ov[n_ov++] = ((unsigned long *) arg)[1]; ++#endif ++ break; ++ ++ case FFI_TYPE_UINT32: ++ if (n_gpr < MAX_GPRARGS) ++ p_gpr[n_gpr++] = *(unsigned int *) arg; ++ else ++ p_ov[n_ov++] = *(unsigned int *) arg; ++ break; ++ ++ case FFI_TYPE_INT: ++ case FFI_TYPE_SINT32: ++ if (n_gpr < MAX_GPRARGS) ++ p_gpr[n_gpr++] = *(signed int *) arg; ++ else ++ p_ov[n_ov++] = *(signed int *) arg; ++ break; ++ ++ case FFI_TYPE_UINT16: ++ if (n_gpr < MAX_GPRARGS) ++ p_gpr[n_gpr++] = *(unsigned short *) arg; ++ else ++ p_ov[n_ov++] = *(unsigned short *) arg; ++ break; ++ ++ case FFI_TYPE_SINT16: ++ if (n_gpr < MAX_GPRARGS) ++ p_gpr[n_gpr++] = *(signed short *) arg; ++ else ++ p_ov[n_ov++] = *(signed short *) arg; ++ break; ++ ++ case FFI_TYPE_UINT8: ++ if (n_gpr < MAX_GPRARGS) ++ p_gpr[n_gpr++] = *(unsigned char *) arg; ++ else ++ p_ov[n_ov++] = *(unsigned char *) arg; ++ break; ++ ++ case FFI_TYPE_SINT8: ++ if (n_gpr < MAX_GPRARGS) ++ p_gpr[n_gpr++] = *(signed char *) arg; ++ else ++ p_ov[n_ov++] = *(signed char *) arg; ++ break; ++ ++ default: ++ FFI_ASSERT (0); ++ break; ++ } ++ } ++} ++ ++/*======================== End of Routine ============================*/ ++ ++/*====================================================================*/ ++/* */ ++/* Name - ffi_prep_cif_machdep. */ ++/* */ ++/* Function - Perform machine dependent CIF processing. */ ++/* */ ++/*====================================================================*/ ++ ++ffi_status ++ffi_prep_cif_machdep(ffi_cif *cif) ++{ ++ size_t struct_size = 0; ++ int n_gpr = 0; ++ int n_fpr = 0; ++ int n_ov = 0; ++ ++ ffi_type **ptr; ++ int i; ++ ++ /* Determine return value handling. */ ++ ++ switch (cif->rtype->type) ++ { ++ /* Void is easy. */ ++ case FFI_TYPE_VOID: ++ cif->flags = FFI390_RET_VOID; ++ break; ++ ++ /* Structures are returned via a hidden pointer. */ ++ case FFI_TYPE_STRUCT: ++ cif->flags = FFI390_RET_STRUCT; ++ n_gpr++; /* We need one GPR to pass the pointer. */ ++ break; ++ ++ /* Floating point values are returned in fpr 0. */ ++ case FFI_TYPE_FLOAT: ++ cif->flags = FFI390_RET_FLOAT; ++ break; ++ ++ case FFI_TYPE_DOUBLE: ++ cif->flags = FFI390_RET_DOUBLE; ++ break; ++ ++ /* Integer values are returned in gpr 2 (and gpr 3 ++ for 64-bit values on 31-bit machines). */ ++ case FFI_TYPE_UINT64: ++ case FFI_TYPE_SINT64: ++ cif->flags = FFI390_RET_INT64; ++ break; ++ ++ case FFI_TYPE_POINTER: ++ case FFI_TYPE_INT: ++ case FFI_TYPE_UINT32: ++ case FFI_TYPE_SINT32: ++ case FFI_TYPE_UINT16: ++ case FFI_TYPE_SINT16: ++ case FFI_TYPE_UINT8: ++ case FFI_TYPE_SINT8: ++ /* These are to be extended to word size. */ ++#ifdef __s390x__ ++ cif->flags = FFI390_RET_INT64; ++#else ++ cif->flags = FFI390_RET_INT32; ++#endif ++ break; ++ ++ default: ++ FFI_ASSERT (0); ++ break; ++ } ++ ++ /* Now for the arguments. */ ++ ++ for (ptr = cif->arg_types, i = cif->nargs; ++ i > 0; ++ i--, ptr++) ++ { ++ int type = (*ptr)->type; ++ ++ /* Check how a structure type is passed. */ ++ if (type == FFI_TYPE_STRUCT) ++ { ++ type = ffi_check_struct_type (*ptr); ++ ++ /* If we pass the struct via pointer, we must reserve space ++ to copy its data for proper call-by-value semantics. */ ++ if (type == FFI_TYPE_POINTER) ++ struct_size += ROUND_SIZE ((*ptr)->size); ++ } ++ ++ /* Now handle all primitive int/float data types. */ ++ switch (type) ++ { ++ /* The first MAX_FPRARGS floating point arguments ++ go in FPRs, the rest overflow to the stack. */ ++ ++ case FFI_TYPE_DOUBLE: ++ if (n_fpr < MAX_FPRARGS) ++ n_fpr++; ++ else ++ n_ov += sizeof (double) / sizeof (long); ++ break; ++ ++ case FFI_TYPE_FLOAT: ++ if (n_fpr < MAX_FPRARGS) ++ n_fpr++; ++ else ++ n_ov++; ++ break; ++ ++ /* On 31-bit machines, 64-bit integers are passed in GPR pairs, ++ if one is still available, or else on the stack. If only one ++ register is free, skip the register (it won't be used for any ++ subsequent argument either). */ ++ ++#ifndef __s390x__ ++ case FFI_TYPE_UINT64: ++ case FFI_TYPE_SINT64: ++ if (n_gpr == MAX_GPRARGS-1) ++ n_gpr = MAX_GPRARGS; ++ if (n_gpr < MAX_GPRARGS) ++ n_gpr += 2; ++ else ++ n_ov += 2; ++ break; ++#endif ++ ++ /* Everything else is passed in GPRs (until MAX_GPRARGS ++ have been used) or overflows to the stack. */ ++ ++ default: ++ if (n_gpr < MAX_GPRARGS) ++ n_gpr++; ++ else ++ n_ov++; ++ break; ++ } ++ } ++ ++ /* Total stack space as required for overflow arguments ++ and temporary structure copies. */ ++ ++ cif->bytes = ROUND_SIZE (n_ov * sizeof (long)) + struct_size; ++ ++ return FFI_OK; ++} ++ ++/*======================== End of Routine ============================*/ ++ ++/*====================================================================*/ ++/* */ ++/* Name - ffi_call. */ ++/* */ ++/* Function - Call the FFI routine. */ ++/* */ ++/*====================================================================*/ ++ ++void ++ffi_call(ffi_cif *cif, ++ void (*fn)(), ++ void *rvalue, ++ void **avalue) ++{ ++ int ret_type = cif->flags; ++ extended_cif ecif; ++ ++ ecif.cif = cif; ++ ecif.avalue = avalue; ++ ecif.rvalue = rvalue; ++ ++ /* If we don't have a return value, we need to fake one. */ ++ if (rvalue == NULL) ++ { ++ if (ret_type == FFI390_RET_STRUCT) ++ ecif.rvalue = alloca (cif->rtype->size); ++ else ++ ret_type = FFI390_RET_VOID; ++ } ++ ++ switch (cif->abi) ++ { ++ case FFI_SYSV: ++ ffi_call_SYSV (cif->bytes, &ecif, ffi_prep_args, ++ ret_type, ecif.rvalue, fn); ++ break; ++ ++ default: ++ FFI_ASSERT (0); ++ break; ++ } ++} ++ ++/*======================== End of Routine ============================*/ ++ ++/*====================================================================*/ ++/* */ ++/* Name - ffi_closure_helper_SYSV. */ ++/* */ ++/* Function - Call a FFI closure target function. */ ++/* */ ++/*====================================================================*/ ++ ++void ++ffi_closure_helper_SYSV (ffi_closure *closure, ++ unsigned long *p_gpr, ++ unsigned long long *p_fpr, ++ unsigned long *p_ov) ++{ ++ unsigned long long ret_buffer; ++ ++ void *rvalue = &ret_buffer; ++ void **avalue; ++ void **p_arg; ++ ++ int n_gpr = 0; ++ int n_fpr = 0; ++ int n_ov = 0; ++ ++ ffi_type **ptr; ++ int i; ++ ++ /* Allocate buffer for argument list pointers. */ ++ ++ p_arg = avalue = alloca (closure->cif->nargs * sizeof (void *)); ++ ++ /* If we returning a structure, pass the structure address ++ directly to the target function. Otherwise, have the target ++ function store the return value to the GPR save area. */ ++ ++ if (closure->cif->flags == FFI390_RET_STRUCT) ++ rvalue = (void *) p_gpr[n_gpr++]; ++ ++ /* Now for the arguments. */ ++ ++ for (ptr = closure->cif->arg_types, i = closure->cif->nargs; ++ i > 0; ++ i--, p_arg++, ptr++) ++ { ++ int deref_struct_pointer = 0; ++ int type = (*ptr)->type; ++ ++ /* Check how a structure type is passed. */ ++ if (type == FFI_TYPE_STRUCT) ++ { ++ type = ffi_check_struct_type (*ptr); ++ ++ /* If we pass the struct via pointer, remember to ++ retrieve the pointer later. */ ++ if (type == FFI_TYPE_POINTER) ++ deref_struct_pointer = 1; ++ } ++ ++ /* Pointers are passed like UINTs of the same size. */ ++ if (type == FFI_TYPE_POINTER) ++#ifdef __s390x__ ++ type = FFI_TYPE_UINT64; ++#else ++ type = FFI_TYPE_UINT32; ++#endif ++ ++ /* Now handle all primitive int/float data types. */ ++ switch (type) ++ { ++ case FFI_TYPE_DOUBLE: ++ if (n_fpr < MAX_FPRARGS) ++ *p_arg = &p_fpr[n_fpr++]; ++ else ++ *p_arg = &p_ov[n_ov], ++ n_ov += sizeof (double) / sizeof (long); ++ break; ++ ++ case FFI_TYPE_FLOAT: ++ if (n_fpr < MAX_FPRARGS) ++ *p_arg = &p_fpr[n_fpr++]; ++ else ++ *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 4; ++ break; ++ ++ case FFI_TYPE_UINT64: ++ case FFI_TYPE_SINT64: ++#ifdef __s390x__ ++ if (n_gpr < MAX_GPRARGS) ++ *p_arg = &p_gpr[n_gpr++]; ++ else ++ *p_arg = &p_ov[n_ov++]; ++#else ++ if (n_gpr == MAX_GPRARGS-1) ++ n_gpr = MAX_GPRARGS; ++ if (n_gpr < MAX_GPRARGS) ++ *p_arg = &p_gpr[n_gpr], n_gpr += 2; ++ else ++ *p_arg = &p_ov[n_ov], n_ov += 2; ++#endif ++ break; ++ ++ case FFI_TYPE_INT: ++ case FFI_TYPE_UINT32: ++ case FFI_TYPE_SINT32: ++ if (n_gpr < MAX_GPRARGS) ++ *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 4; ++ else ++ *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 4; ++ break; ++ ++ case FFI_TYPE_UINT16: ++ case FFI_TYPE_SINT16: ++ if (n_gpr < MAX_GPRARGS) ++ *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 2; ++ else ++ *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 2; ++ break; ++ ++ case FFI_TYPE_UINT8: ++ case FFI_TYPE_SINT8: ++ if (n_gpr < MAX_GPRARGS) ++ *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 1; ++ else ++ *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 1; ++ break; ++ ++ default: ++ FFI_ASSERT (0); ++ break; ++ } ++ ++ /* If this is a struct passed via pointer, we need to ++ actually retrieve that pointer. */ ++ if (deref_struct_pointer) ++ *p_arg = *(void **)*p_arg; ++ } ++ ++ ++ /* Call the target function. */ ++ (closure->fun) (closure->cif, rvalue, avalue, closure->user_data); ++ ++ /* Convert the return value. */ ++ switch (closure->cif->rtype->type) ++ { ++ /* Void is easy, and so is struct. */ ++ case FFI_TYPE_VOID: ++ case FFI_TYPE_STRUCT: ++ break; ++ ++ /* Floating point values are returned in fpr 0. */ ++ case FFI_TYPE_FLOAT: ++ p_fpr[0] = (long long) *(unsigned int *) rvalue << 32; ++ break; ++ ++ case FFI_TYPE_DOUBLE: ++ p_fpr[0] = *(unsigned long long *) rvalue; ++ break; ++ ++ /* Integer values are returned in gpr 2 (and gpr 3 ++ for 64-bit values on 31-bit machines). */ ++ case FFI_TYPE_UINT64: ++ case FFI_TYPE_SINT64: ++#ifdef __s390x__ ++ p_gpr[0] = *(unsigned long *) rvalue; ++#else ++ p_gpr[0] = ((unsigned long *) rvalue)[0], ++ p_gpr[1] = ((unsigned long *) rvalue)[1]; ++#endif ++ break; ++ ++ case FFI_TYPE_POINTER: ++ case FFI_TYPE_UINT32: ++ case FFI_TYPE_UINT16: ++ case FFI_TYPE_UINT8: ++ p_gpr[0] = *(unsigned long *) rvalue; ++ break; ++ ++ case FFI_TYPE_INT: ++ case FFI_TYPE_SINT32: ++ case FFI_TYPE_SINT16: ++ case FFI_TYPE_SINT8: ++ p_gpr[0] = *(signed long *) rvalue; ++ break; ++ ++ default: ++ FFI_ASSERT (0); ++ break; ++ } ++} ++ ++/*======================== End of Routine ============================*/ ++ ++/*====================================================================*/ ++/* */ ++/* Name - ffi_prep_closure. */ ++/* */ ++/* Function - Prepare a FFI closure. */ ++/* */ ++/*====================================================================*/ ++ ++ffi_status ++ffi_prep_closure (ffi_closure *closure, ++ ffi_cif *cif, ++ void (*fun) (ffi_cif *, void *, void **, void *), ++ void *user_data) ++{ ++ FFI_ASSERT (cif->abi == FFI_SYSV); ++ ++#ifndef __s390x__ ++ *(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */ ++ *(short *)&closure->tramp [2] = 0x9801; /* lm %r0,%r1,6(%r1) */ ++ *(short *)&closure->tramp [4] = 0x1006; ++ *(short *)&closure->tramp [6] = 0x07f1; /* br %r1 */ ++ *(long *)&closure->tramp [8] = (long)closure; ++ *(long *)&closure->tramp[12] = (long)&ffi_closure_SYSV; ++#else ++ *(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */ ++ *(short *)&closure->tramp [2] = 0xeb01; /* lmg %r0,%r1,14(%r1) */ ++ *(short *)&closure->tramp [4] = 0x100e; ++ *(short *)&closure->tramp [6] = 0x0004; ++ *(short *)&closure->tramp [8] = 0x07f1; /* br %r1 */ ++ *(long *)&closure->tramp[16] = (long)closure; ++ *(long *)&closure->tramp[24] = (long)&ffi_closure_SYSV; ++#endif ++ ++ closure->cif = cif; ++ closure->user_data = user_data; ++ closure->fun = fun; ++ ++ return FFI_OK; ++} ++ ++/*======================== End of Routine ============================*/ ++ +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/s390/sysv.S gcc/libffi/src/s390/sysv.S +--- gcc-3.2.2.orig/libffi/src/s390/sysv.S Thu Jan 1 09:00:00 1970 ++++ gcc/libffi/src/s390/sysv.S Thu Nov 28 01:44:35 2002 +@@ -0,0 +1,425 @@ ++/* ----------------------------------------------------------------------- ++ sysv.S - Copyright (c) 2000 Software AG ++ ++ S390 Foreign Function Interface ++ ++ Permission is hereby granted, free of charge, to any person obtaining ++ a copy of this software and associated documentation files (the ++ ``Software''), to deal in the Software without restriction, including ++ without limitation the rights to use, copy, modify, merge, publish, ++ distribute, sublicense, and/or sell copies of the Software, and to ++ permit persons to whom the Software is furnished to do so, subject to ++ the following conditions: ++ ++ The above copyright notice and this permission notice shall be included ++ in all copies or substantial portions of the Software. ++ ++ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS ++ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ++ IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR ++ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ++ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ++ OTHER DEALINGS IN THE SOFTWARE. ++ ----------------------------------------------------------------------- */ ++ ++#ifndef __s390x__ ++ ++.text ++ ++ # r2: cif->bytes ++ # r3: &ecif ++ # r4: ffi_prep_args ++ # r5: ret_type ++ # r6: ecif.rvalue ++ # ov: fn ++ ++ # This assumes we are using gas. ++ .globl ffi_call_SYSV ++ .type ffi_call_SYSV,%function ++ffi_call_SYSV: ++.LFB1: ++ stm %r6,%r15,24(%r15) # Save registers ++.LCFI0: ++ basr %r13,0 # Set up base register ++.Lbase: ++ lr %r11,%r15 # Set up frame pointer ++.LCFI1: ++ sr %r15,%r2 ++ ahi %r15,-96-48 # Allocate stack ++ lr %r8,%r6 # Save ecif.rvalue ++ sr %r9,%r9 ++ ic %r9,.Ltable-.Lbase(%r13,%r5) # Load epilog address ++ l %r7,96(%r11) # Load function address ++ st %r11,0(%r15) # Set up back chain ++ ahi %r11,-48 # Register save area ++.LCFI2: ++ ++ la %r2,96(%r15) # Save area ++ # r3 already holds &ecif ++ basr %r14,%r4 # Call ffi_prep_args ++ ++ lm %r2,%r6,0(%r11) # Load arguments ++ ld %f0,32(%r11) ++ ld %f2,40(%r11) ++ la %r14,0(%r13,%r9) # Set return address ++ br %r7 # ... and call function ++ ++.LretNone: # Return void ++ l %r4,48+56(%r11) ++ lm %r6,%r15,48+24(%r11) ++ br %r4 ++ ++.LretFloat: ++ l %r4,48+56(%r11) ++ ste %f0,0(%r8) # Return float ++ lm %r6,%r15,48+24(%r11) ++ br %r4 ++ ++.LretDouble: ++ l %r4,48+56(%r11) ++ std %f0,0(%r8) # Return double ++ lm %r6,%r15,48+24(%r11) ++ br %r4 ++ ++.LretInt32: ++ l %r4,48+56(%r11) ++ st %r2,0(%r8) # Return int ++ lm %r6,%r15,48+24(%r11) ++ br %r4 ++ ++.LretInt64: ++ l %r4,48+56(%r11) ++ stm %r2,%r3,0(%r8) # Return long long ++ lm %r6,%r15,48+24(%r11) ++ br %r4 ++ ++.Ltable: ++ .byte .LretNone-.Lbase # FFI390_RET_VOID ++ .byte .LretNone-.Lbase # FFI390_RET_STRUCT ++ .byte .LretFloat-.Lbase # FFI390_RET_FLOAT ++ .byte .LretDouble-.Lbase # FFI390_RET_DOUBLE ++ .byte .LretInt32-.Lbase # FFI390_RET_INT32 ++ .byte .LretInt64-.Lbase # FFI390_RET_INT64 ++ ++.LFE1: ++.ffi_call_SYSV_end: ++ .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV ++ ++ ++ .globl ffi_closure_SYSV ++ .type ffi_closure_SYSV,%function ++ffi_closure_SYSV: ++.LFB2: ++ stm %r12,%r15,48(%r15) # Save registers ++.LCFI10: ++ basr %r13,0 # Set up base register ++.Lcbase: ++ stm %r2,%r6,8(%r15) # Save arguments ++ std %f0,64(%r15) ++ std %f2,72(%r15) ++ lr %r1,%r15 # Set up stack frame ++ ahi %r15,-96 ++.LCFI11: ++ l %r12,.Lchelper-.Lcbase(%r13) # Get helper function ++ lr %r2,%r0 # Closure ++ la %r3,8(%r1) # GPRs ++ la %r4,64(%r1) # FPRs ++ la %r5,96(%r1) # Overflow ++ st %r1,0(%r15) # Set up back chain ++ ++ bas %r14,0(%r12,%r13) # Call helper ++ ++ l %r4,96+56(%r15) ++ ld %f0,96+64(%r15) # Load return registers ++ lm %r2,%r3,96+8(%r15) ++ lm %r12,%r15,96+48(%r15) ++ br %r4 ++ ++ .align 4 ++.Lchelper: ++ .long ffi_closure_helper_SYSV-.Lcbase ++ ++.LFE2: ++ ++.ffi_closure_SYSV_end: ++ .size ffi_closure_SYSV,.ffi_closure_SYSV_end-ffi_closure_SYSV ++ ++ ++ .section .eh_frame,"a",@progbits ++.Lframe1: ++ .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry ++.LSCIE1: ++ .4byte 0x0 # CIE Identifier Tag ++ .byte 0x1 # CIE Version ++ .ascii "zR\0" # CIE Augmentation ++ .uleb128 0x1 # CIE Code Alignment Factor ++ .sleb128 -4 # CIE Data Alignment Factor ++ .byte 0xe # CIE RA Column ++ .uleb128 0x1 # Augmentation size ++ .byte 0x1b # FDE Encoding (pcrel sdata4) ++ .byte 0xc # DW_CFA_def_cfa ++ .uleb128 0xf ++ .uleb128 0x60 ++ .align 4 ++.LECIE1: ++.LSFDE1: ++ .4byte .LEFDE1-.LASFDE1 # FDE Length ++.LASFDE1: ++ .4byte .LASFDE1-.Lframe1 # FDE CIE offset ++ .4byte .LFB1-. # FDE initial location ++ .4byte .LFE1-.LFB1 # FDE address range ++ .uleb128 0x0 # Augmentation size ++ .byte 0x4 # DW_CFA_advance_loc4 ++ .4byte .LCFI0-.LFB1 ++ .byte 0x8f # DW_CFA_offset, column 0xf ++ .uleb128 0x9 ++ .byte 0x8e # DW_CFA_offset, column 0xe ++ .uleb128 0xa ++ .byte 0x8d # DW_CFA_offset, column 0xd ++ .uleb128 0xb ++ .byte 0x8c # DW_CFA_offset, column 0xc ++ .uleb128 0xc ++ .byte 0x8b # DW_CFA_offset, column 0xb ++ .uleb128 0xd ++ .byte 0x8a # DW_CFA_offset, column 0xa ++ .uleb128 0xe ++ .byte 0x89 # DW_CFA_offset, column 0x9 ++ .uleb128 0xf ++ .byte 0x88 # DW_CFA_offset, column 0x8 ++ .uleb128 0x10 ++ .byte 0x87 # DW_CFA_offset, column 0x7 ++ .uleb128 0x11 ++ .byte 0x86 # DW_CFA_offset, column 0x6 ++ .uleb128 0x12 ++ .byte 0x4 # DW_CFA_advance_loc4 ++ .4byte .LCFI1-.LCFI0 ++ .byte 0xd # DW_CFA_def_cfa_register ++ .uleb128 0xb ++ .byte 0x4 # DW_CFA_advance_loc4 ++ .4byte .LCFI2-.LCFI1 ++ .byte 0xe # DW_CFA_def_cfa_offset ++ .uleb128 0x90 ++ .align 4 ++.LEFDE1: ++.LSFDE2: ++ .4byte .LEFDE2-.LASFDE2 # FDE Length ++.LASFDE2: ++ .4byte .LASFDE2-.Lframe1 # FDE CIE offset ++ .4byte .LFB2-. # FDE initial location ++ .4byte .LFE2-.LFB2 # FDE address range ++ .uleb128 0x0 # Augmentation size ++ .byte 0x4 # DW_CFA_advance_loc4 ++ .4byte .LCFI10-.LFB2 ++ .byte 0x8f # DW_CFA_offset, column 0xf ++ .uleb128 0x9 ++ .byte 0x8e # DW_CFA_offset, column 0xe ++ .uleb128 0xa ++ .byte 0x8d # DW_CFA_offset, column 0xd ++ .uleb128 0xb ++ .byte 0x8c # DW_CFA_offset, column 0xc ++ .uleb128 0xc ++ .byte 0x4 # DW_CFA_advance_loc4 ++ .4byte .LCFI11-.LCFI10 ++ .byte 0xe # DW_CFA_def_cfa_offset ++ .uleb128 0xc0 ++ .align 4 ++.LEFDE2: ++ ++#else ++ ++.text ++ ++ # r2: cif->bytes ++ # r3: &ecif ++ # r4: ffi_prep_args ++ # r5: ret_type ++ # r6: ecif.rvalue ++ # ov: fn ++ ++ # This assumes we are using gas. ++ .globl ffi_call_SYSV ++ .type ffi_call_SYSV,%function ++ffi_call_SYSV: ++.LFB1: ++ stmg %r6,%r15,48(%r15) # Save registers ++.LCFI0: ++ larl %r13,.Lbase # Set up base register ++ lgr %r11,%r15 # Set up frame pointer ++.LCFI1: ++ sgr %r15,%r2 ++ aghi %r15,-160-80 # Allocate stack ++ lgr %r8,%r6 # Save ecif.rvalue ++ llgc %r9,.Ltable-.Lbase(%r13,%r5) # Load epilog address ++ lg %r7,160(%r11) # Load function address ++ stg %r11,0(%r15) # Set up back chain ++ aghi %r11,-80 # Register save area ++.LCFI2: ++ ++ la %r2,160(%r15) # Save area ++ # r3 already holds &ecif ++ basr %r14,%r4 # Call ffi_prep_args ++ ++ lmg %r2,%r6,0(%r11) # Load arguments ++ ld %f0,48(%r11) ++ ld %f2,56(%r11) ++ ld %f4,64(%r11) ++ ld %f6,72(%r11) ++ la %r14,0(%r13,%r9) # Set return address ++ br %r7 # ... and call function ++ ++.Lbase: ++.LretNone: # Return void ++ lg %r4,80+112(%r11) ++ lmg %r6,%r15,80+48(%r11) ++ br %r4 ++ ++.LretFloat: ++ lg %r4,80+112(%r11) ++ ste %f0,0(%r8) # Return float ++ lmg %r6,%r15,80+48(%r11) ++ br %r4 ++ ++.LretDouble: ++ lg %r4,80+112(%r11) ++ std %f0,0(%r8) # Return double ++ lmg %r6,%r15,80+48(%r11) ++ br %r4 ++ ++.LretInt32: ++ lg %r4,80+112(%r11) ++ st %r2,0(%r8) # Return int ++ lmg %r6,%r15,80+48(%r11) ++ br %r4 ++ ++.LretInt64: ++ lg %r4,80+112(%r11) ++ stg %r2,0(%r8) # Return long ++ lmg %r6,%r15,80+48(%r11) ++ br %r4 ++ ++.Ltable: ++ .byte .LretNone-.Lbase # FFI390_RET_VOID ++ .byte .LretNone-.Lbase # FFI390_RET_STRUCT ++ .byte .LretFloat-.Lbase # FFI390_RET_FLOAT ++ .byte .LretDouble-.Lbase # FFI390_RET_DOUBLE ++ .byte .LretInt32-.Lbase # FFI390_RET_INT32 ++ .byte .LretInt64-.Lbase # FFI390_RET_INT64 ++ ++.LFE1: ++.ffi_call_SYSV_end: ++ .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV ++ ++ ++ .globl ffi_closure_SYSV ++ .type ffi_closure_SYSV,%function ++ffi_closure_SYSV: ++.LFB2: ++ stmg %r14,%r15,112(%r15) # Save registers ++.LCFI10: ++ stmg %r2,%r6,16(%r15) # Save arguments ++ std %f0,128(%r15) ++ std %f2,136(%r15) ++ std %f4,144(%r15) ++ std %f6,152(%r15) ++ lgr %r1,%r15 # Set up stack frame ++ aghi %r15,-160 ++.LCFI11: ++ lgr %r2,%r0 # Closure ++ la %r3,16(%r1) # GPRs ++ la %r4,128(%r1) # FPRs ++ la %r5,160(%r1) # Overflow ++ stg %r1,0(%r15) # Set up back chain ++ ++ brasl %r14,ffi_closure_helper_SYSV # Call helper ++ ++ lg %r14,160+112(%r15) ++ ld %f0,160+128(%r15) # Load return registers ++ lg %r2,160+16(%r15) ++ la %r15,160(%r15) ++ br %r14 ++.LFE2: ++ ++.ffi_closure_SYSV_end: ++ .size ffi_closure_SYSV,.ffi_closure_SYSV_end-ffi_closure_SYSV ++ ++ ++ ++ .section .eh_frame,"a",@progbits ++.Lframe1: ++ .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry ++.LSCIE1: ++ .4byte 0x0 # CIE Identifier Tag ++ .byte 0x1 # CIE Version ++ .ascii "zR\0" # CIE Augmentation ++ .uleb128 0x1 # CIE Code Alignment Factor ++ .sleb128 -8 # CIE Data Alignment Factor ++ .byte 0xe # CIE RA Column ++ .uleb128 0x1 # Augmentation size ++ .byte 0x1b # FDE Encoding (pcrel sdata4) ++ .byte 0xc # DW_CFA_def_cfa ++ .uleb128 0xf ++ .uleb128 0xa0 ++ .align 8 ++.LECIE1: ++.LSFDE1: ++ .4byte .LEFDE1-.LASFDE1 # FDE Length ++.LASFDE1: ++ .4byte .LASFDE1-.Lframe1 # FDE CIE offset ++ .4byte .LFB1-. # FDE initial location ++ .4byte .LFE1-.LFB1 # FDE address range ++ .uleb128 0x0 # Augmentation size ++ .byte 0x4 # DW_CFA_advance_loc4 ++ .4byte .LCFI0-.LFB1 ++ .byte 0x8f # DW_CFA_offset, column 0xf ++ .uleb128 0x5 ++ .byte 0x8e # DW_CFA_offset, column 0xe ++ .uleb128 0x6 ++ .byte 0x8d # DW_CFA_offset, column 0xd ++ .uleb128 0x7 ++ .byte 0x8c # DW_CFA_offset, column 0xc ++ .uleb128 0x8 ++ .byte 0x8b # DW_CFA_offset, column 0xb ++ .uleb128 0x9 ++ .byte 0x8a # DW_CFA_offset, column 0xa ++ .uleb128 0xa ++ .byte 0x89 # DW_CFA_offset, column 0x9 ++ .uleb128 0xb ++ .byte 0x88 # DW_CFA_offset, column 0x8 ++ .uleb128 0xc ++ .byte 0x87 # DW_CFA_offset, column 0x7 ++ .uleb128 0xd ++ .byte 0x86 # DW_CFA_offset, column 0x6 ++ .uleb128 0xe ++ .byte 0x4 # DW_CFA_advance_loc4 ++ .4byte .LCFI1-.LCFI0 ++ .byte 0xd # DW_CFA_def_cfa_register ++ .uleb128 0xb ++ .byte 0x4 # DW_CFA_advance_loc4 ++ .4byte .LCFI2-.LCFI1 ++ .byte 0xe # DW_CFA_def_cfa_offset ++ .uleb128 0xf0 ++ .align 8 ++.LEFDE1: ++.LSFDE2: ++ .4byte .LEFDE2-.LASFDE2 # FDE Length ++.LASFDE2: ++ .4byte .LASFDE2-.Lframe1 # FDE CIE offset ++ .4byte .LFB2-. # FDE initial location ++ .4byte .LFE2-.LFB2 # FDE address range ++ .uleb128 0x0 # Augmentation size ++ .byte 0x4 # DW_CFA_advance_loc4 ++ .4byte .LCFI10-.LFB2 ++ .byte 0x8f # DW_CFA_offset, column 0xf ++ .uleb128 0x5 ++ .byte 0x8e # DW_CFA_offset, column 0xe ++ .uleb128 0x6 ++ .byte 0x4 # DW_CFA_advance_loc4 ++ .4byte .LCFI11-.LCFI10 ++ .byte 0xe # DW_CFA_def_cfa_offset ++ .uleb128 0x140 ++ .align 8 ++.LEFDE2: ++ ++#endif ++ +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/sh/ffi.c gcc/libffi/src/sh/ffi.c +--- gcc-3.2.2.orig/libffi/src/sh/ffi.c Thu Jan 1 09:00:00 1970 ++++ gcc/libffi/src/sh/ffi.c Fri Jul 19 10:08:43 2002 +@@ -0,0 +1,722 @@ ++/* ----------------------------------------------------------------------- ++ ffi.c - Copyright (c) 2002 Kaz Kojima ++ ++ SuperH Foreign Function Interface ++ ++ Permission is hereby granted, free of charge, to any person obtaining ++ a copy of this software and associated documentation files (the ++ ``Software''), to deal in the Software without restriction, including ++ without limitation the rights to use, copy, modify, merge, publish, ++ distribute, sublicense, and/or sell copies of the Software, and to ++ permit persons to whom the Software is furnished to do so, subject to ++ the following conditions: ++ ++ The above copyright notice and this permission notice shall be included ++ in all copies or substantial portions of the Software. ++ ++ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS ++ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ++ IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR ++ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ++ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ++ OTHER DEALINGS IN THE SOFTWARE. ++ ----------------------------------------------------------------------- */ ++ ++#include <ffi.h> ++#include <ffi_common.h> ++ ++#include <stdlib.h> ++ ++#define NGREGARG 4 ++#if defined(__SH4__) ++#define NFREGARG 8 ++#endif ++ ++#if defined(__HITACHI__) ++#define STRUCT_VALUE_ADDRESS_WITH_ARG 1 ++#else ++#define STRUCT_VALUE_ADDRESS_WITH_ARG 0 ++#endif ++ ++/* If the structure has essentialy an unique element, return its type. */ ++static int ++simple_type (ffi_type *arg) ++{ ++ if (arg->type != FFI_TYPE_STRUCT) ++ return arg->type; ++ else if (arg->elements[1]) ++ return FFI_TYPE_STRUCT; ++ ++ return simple_type (arg->elements[0]); ++} ++ ++static int ++return_type (ffi_type *arg) ++{ ++ unsigned short type; ++ ++ if (arg->type != FFI_TYPE_STRUCT) ++ return arg->type; ++ ++ type = simple_type (arg->elements[0]); ++ if (! arg->elements[1]) ++ { ++ switch (type) ++ { ++ case FFI_TYPE_SINT8: ++ case FFI_TYPE_UINT8: ++ case FFI_TYPE_SINT16: ++ case FFI_TYPE_UINT16: ++ case FFI_TYPE_SINT32: ++ case FFI_TYPE_UINT32: ++ return FFI_TYPE_INT; ++ ++ default: ++ return type; ++ } ++ } ++ ++ /* gcc uses r0/r1 pair for some kind of structures. */ ++ if (arg->size <= 2 * sizeof (int)) ++ { ++ int i = 0; ++ ffi_type *e; ++ ++ while ((e = arg->elements[i++])) ++ { ++ type = simple_type (e); ++ switch (type) ++ { ++ case FFI_TYPE_SINT32: ++ case FFI_TYPE_UINT32: ++ case FFI_TYPE_INT: ++ case FFI_TYPE_FLOAT: ++ return FFI_TYPE_UINT64; ++ ++ default: ++ break; ++ } ++ } ++ } ++ ++ return FFI_TYPE_STRUCT; ++} ++ ++/* ffi_prep_args is called by the assembly routine once stack space ++ has been allocated for the function's arguments */ ++ ++/*@-exportheader@*/ ++void ffi_prep_args(char *stack, extended_cif *ecif) ++/*@=exportheader@*/ ++{ ++ register unsigned int i; ++ register int tmp; ++ register unsigned int avn; ++ register void **p_argv; ++ register char *argp; ++ register ffi_type **p_arg; ++ int greg, ireg; ++#if defined(__SH4__) ++ int freg = 0; ++#endif ++ ++ tmp = 0; ++ argp = stack; ++ ++ if (return_type (ecif->cif->rtype) == FFI_TYPE_STRUCT) ++ { ++ *(void **) argp = ecif->rvalue; ++ argp += 4; ++ ireg = STRUCT_VALUE_ADDRESS_WITH_ARG ? 1 : 0; ++ } ++ else ++ ireg = 0; ++ ++ /* Set arguments for registers. */ ++ greg = ireg; ++ avn = ecif->cif->nargs; ++ p_argv = ecif->avalue; ++ ++ for (i = 0, p_arg = ecif->cif->arg_types; i < avn; i++, p_arg++, p_argv++) ++ { ++ size_t z; ++ ++ z = (*p_arg)->size; ++ if (z < sizeof(int)) ++ { ++ if (greg++ >= NGREGARG) ++ continue; ++ ++ z = sizeof(int); ++ switch ((*p_arg)->type) ++ { ++ case FFI_TYPE_SINT8: ++ *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); ++ break; ++ ++ case FFI_TYPE_UINT8: ++ *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); ++ break; ++ ++ case FFI_TYPE_SINT16: ++ *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); ++ break; ++ ++ case FFI_TYPE_UINT16: ++ *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); ++ break; ++ ++ case FFI_TYPE_STRUCT: ++ *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); ++ break; ++ ++ default: ++ FFI_ASSERT(0); ++ } ++ argp += z; ++ } ++ else if (z == sizeof(int)) ++ { ++#if defined(__SH4__) ++ if ((*p_arg)->type == FFI_TYPE_FLOAT) ++ { ++ if (freg++ >= NFREGARG) ++ continue; ++ } ++ else ++#endif ++ { ++ if (greg++ >= NGREGARG) ++ continue; ++ } ++ *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); ++ argp += z; ++ } ++#if defined(__SH4__) ++ else if ((*p_arg)->type == FFI_TYPE_DOUBLE) ++ { ++ if (freg + 1 >= NFREGARG) ++ continue; ++ freg = (freg + 1) & ~1; ++ freg += 2; ++ memcpy (argp, *p_argv, z); ++ argp += z; ++ } ++#endif ++ else ++ { ++ int n = (z + sizeof (int) - 1) / sizeof (int); ++#if defined(__SH4__) ++ if (greg + n - 1 >= NGREGARG) ++ continue; ++ greg += n; ++#else ++ if (greg >= NGREGARG) ++ continue; ++ else if (greg + n - 1 >= NGREGARG) ++ greg = NGREGARG; ++ else ++ greg += n; ++#endif ++ memcpy (argp, *p_argv, z); ++ argp += z; ++ } ++ } ++ ++ /* Set arguments on stack. */ ++ greg = ireg; ++#if defined(__SH4__) ++ freg = 0; ++#endif ++ p_argv = ecif->avalue; ++ ++ for (i = 0, p_arg = ecif->cif->arg_types; i < avn; i++, p_arg++, p_argv++) ++ { ++ size_t z; ++ ++ z = (*p_arg)->size; ++ if (z < sizeof(int)) ++ { ++ if (greg++ < NGREGARG) ++ continue; ++ ++ z = sizeof(int); ++ switch ((*p_arg)->type) ++ { ++ case FFI_TYPE_SINT8: ++ *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); ++ break; ++ ++ case FFI_TYPE_UINT8: ++ *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); ++ break; ++ ++ case FFI_TYPE_SINT16: ++ *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); ++ break; ++ ++ case FFI_TYPE_UINT16: ++ *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); ++ break; ++ ++ case FFI_TYPE_STRUCT: ++ *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); ++ break; ++ ++ default: ++ FFI_ASSERT(0); ++ } ++ argp += z; ++ } ++ else if (z == sizeof(int)) ++ { ++#if defined(__SH4__) ++ if ((*p_arg)->type == FFI_TYPE_FLOAT) ++ { ++ if (freg++ < NFREGARG) ++ continue; ++ } ++ else ++#endif ++ { ++ if (greg++ < NGREGARG) ++ continue; ++ } ++ *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); ++ argp += z; ++ } ++#if defined(__SH4__) ++ else if ((*p_arg)->type == FFI_TYPE_DOUBLE) ++ { ++ if (freg + 1 < NFREGARG) ++ { ++ freg = (freg + 1) & ~1; ++ freg += 2; ++ continue; ++ } ++ memcpy (argp, *p_argv, z); ++ argp += z; ++ } ++#endif ++ else ++ { ++ int n = (z + sizeof (int) - 1) / sizeof (int); ++ if (greg + n - 1 < NGREGARG) ++ { ++ greg += n; ++ continue; ++ } ++#if (! defined(__SH4__)) ++ else if (greg < NGREGARG) ++ { ++ greg = NGREGARG; ++ continue; ++ } ++#endif ++ memcpy (argp, *p_argv, z); ++ argp += z; ++ } ++ } ++ ++ return; ++} ++ ++/* Perform machine dependent cif processing */ ++ffi_status ffi_prep_cif_machdep(ffi_cif *cif) ++{ ++ int i, j; ++ int size, type; ++ int n, m; ++ int greg; ++#if defined(__SH4__) ++ int freg = 0; ++#endif ++ ++ cif->flags = 0; ++ ++ greg = ((return_type (cif->rtype) == FFI_TYPE_STRUCT) && ++ STRUCT_VALUE_ADDRESS_WITH_ARG) ? 1 : 0; ++ ++#if defined(__SH4__) ++ for (i = j = 0; i < cif->nargs && j < 12; i++) ++ { ++ type = (cif->arg_types)[i]->type; ++ switch (type) ++ { ++ case FFI_TYPE_FLOAT: ++ if (freg >= NFREGARG) ++ continue; ++ freg++; ++ cif->flags += ((cif->arg_types)[i]->type) << (2 * j); ++ j++; ++ break; ++ ++ case FFI_TYPE_DOUBLE: ++ if ((freg + 1) >= NFREGARG) ++ continue; ++ freg = (freg + 1) & ~1; ++ freg += 2; ++ cif->flags += ((cif->arg_types)[i]->type) << (2 * j); ++ j++; ++ break; ++ ++ default: ++ size = (cif->arg_types)[i]->size; ++ n = (size + sizeof (int) - 1) / sizeof (int); ++ if (greg + n - 1 >= NGREGARG) ++ continue; ++ greg += n; ++ for (m = 0; m < n; m++) ++ cif->flags += FFI_TYPE_INT << (2 * j++); ++ break; ++ } ++ } ++#else ++ for (i = j = 0; i < cif->nargs && j < 4; i++) ++ { ++ size = (cif->arg_types)[i]->size; ++ n = (size + sizeof (int) - 1) / sizeof (int); ++ if (greg >= NGREGARG) ++ continue; ++ else if (greg + n - 1 >= NGREGARG) ++ greg = NGREGARG; ++ else ++ greg += n; ++ for (m = 0; m < n; m++) ++ cif->flags += FFI_TYPE_INT << (2 * j++); ++ } ++#endif ++ ++ /* Set the return type flag */ ++ switch (cif->rtype->type) ++ { ++ case FFI_TYPE_STRUCT: ++ cif->flags += (unsigned) (return_type (cif->rtype)) << 24; ++ break; ++ ++ case FFI_TYPE_VOID: ++ case FFI_TYPE_FLOAT: ++ case FFI_TYPE_DOUBLE: ++ case FFI_TYPE_SINT64: ++ case FFI_TYPE_UINT64: ++ cif->flags += (unsigned) cif->rtype->type << 24; ++ break; ++ ++ default: ++ cif->flags += FFI_TYPE_INT << 24; ++ break; ++ } ++ ++ return FFI_OK; ++} ++ ++/*@-declundef@*/ ++/*@-exportheader@*/ ++extern void ffi_call_SYSV(void (*)(char *, extended_cif *), ++ /*@out@*/ extended_cif *, ++ unsigned, unsigned, ++ /*@out@*/ unsigned *, ++ void (*fn)()); ++/*@=declundef@*/ ++/*@=exportheader@*/ ++ ++void ffi_call(/*@dependent@*/ ffi_cif *cif, ++ void (*fn)(), ++ /*@out@*/ void *rvalue, ++ /*@dependent@*/ void **avalue) ++{ ++ extended_cif ecif; ++ ++ ecif.cif = cif; ++ ecif.avalue = avalue; ++ ++ /* If the return value is a struct and we don't have a return */ ++ /* value address then we need to make one */ ++ ++ if ((rvalue == NULL) && ++ (cif->rtype->type == FFI_TYPE_STRUCT)) ++ { ++ /*@-sysunrecog@*/ ++ ecif.rvalue = alloca(cif->rtype->size); ++ /*@=sysunrecog@*/ ++ } ++ else ++ ecif.rvalue = rvalue; ++ ++ ++ switch (cif->abi) ++ { ++ case FFI_SYSV: ++ /*@-usedef@*/ ++ ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, ++ cif->flags, ecif.rvalue, fn); ++ /*@=usedef@*/ ++ break; ++ default: ++ FFI_ASSERT(0); ++ break; ++ } ++} ++ ++extern void ffi_closure_SYSV (void); ++#if defined(__SH4__) ++extern void __ic_invalidate (void *line); ++#endif ++ ++ffi_status ++ffi_prep_closure (ffi_closure* closure, ++ ffi_cif* cif, ++ void (*fun)(ffi_cif*, void*, void**, void*), ++ void *user_data) ++{ ++ unsigned int *tramp; ++ ++ FFI_ASSERT (cif->abi == FFI_GCC_SYSV); ++ ++ tramp = (unsigned int *) &closure->tramp[0]; ++#ifdef __LITTLE_ENDIAN__ ++ tramp[0] = 0xd301d202; ++ tramp[1] = 0x0009422b; ++#else ++ tramp[0] = 0xd202d301; ++ tramp[1] = 0x422b0009; ++#endif ++ *(void **) &tramp[2] = (void *)closure; /* ctx */ ++ *(void **) &tramp[3] = (void *)ffi_closure_SYSV; /* funaddr */ ++ ++ closure->cif = cif; ++ closure->fun = fun; ++ closure->user_data = user_data; ++ ++#if defined(__SH4__) ++ /* Flush the icache. */ ++ __ic_invalidate(&closure->tramp[0]); ++#endif ++ ++ return FFI_OK; ++} ++ ++/* Basically the trampoline invokes ffi_closure_SYSV, and on ++ * entry, r3 holds the address of the closure. ++ * After storing the registers that could possibly contain ++ * parameters to be passed into the stack frame and setting ++ * up space for a return value, ffi_closure_SYSV invokes the ++ * following helper function to do most of the work. ++ */ ++ ++#ifdef __LITTLE_ENDIAN__ ++#define OFS_INT8 0 ++#define OFS_INT16 2 ++#else ++#define OFS_INT8 3 ++#define OFS_INT16 2 ++#endif ++ ++int ++ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue, ++ unsigned long *pgr, unsigned long *pfr, ++ unsigned long *pst) ++{ ++ void **avalue; ++ ffi_type **p_arg; ++ int i, avn; ++ int ireg, greg = 0; ++#if defined(__SH4__) ++ int freg = 0; ++#endif ++ ffi_cif *cif; ++ double temp; ++ ++ cif = closure->cif; ++ avalue = alloca(cif->nargs * sizeof(void *)); ++ ++ /* Copy the caller's structure return value address so that the closure ++ returns the data directly to the caller. */ ++ if (cif->rtype->type == FFI_TYPE_STRUCT) ++ { ++ rvalue = *pgr++; ++ ireg = STRUCT_VALUE_ADDRESS_WITH_ARG ? 1 : 0; ++ } ++ else ++ ireg = 0; ++ ++ cif = closure->cif; ++ greg = ireg; ++ avn = cif->nargs; ++ ++ /* Grab the addresses of the arguments from the stack frame. */ ++ for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) ++ { ++ size_t z; ++ ++ z = (*p_arg)->size; ++ if (z < sizeof(int)) ++ { ++ if (greg++ >= NGREGARG) ++ continue; ++ ++ z = sizeof(int); ++ switch ((*p_arg)->type) ++ { ++ case FFI_TYPE_SINT8: ++ case FFI_TYPE_UINT8: ++ avalue[i] = (((char *)pgr) + OFS_INT8); ++ break; ++ ++ case FFI_TYPE_SINT16: ++ case FFI_TYPE_UINT16: ++ avalue[i] = (((char *)pgr) + OFS_INT16); ++ break; ++ ++ case FFI_TYPE_STRUCT: ++ avalue[i] = pgr; ++ break; ++ ++ default: ++ FFI_ASSERT(0); ++ } ++ pgr++; ++ } ++ else if (z == sizeof(int)) ++ { ++#if defined(__SH4__) ++ if ((*p_arg)->type == FFI_TYPE_FLOAT) ++ { ++ if (freg++ >= NFREGARG) ++ continue; ++ avalue[i] = pfr; ++ pfr++; ++ } ++ else ++#endif ++ { ++ if (greg++ >= NGREGARG) ++ continue; ++ avalue[i] = pgr; ++ pgr++; ++ } ++ } ++#if defined(__SH4__) ++ else if ((*p_arg)->type == FFI_TYPE_DOUBLE) ++ { ++ if (freg + 1 >= NFREGARG) ++ continue; ++ freg = (freg + 1) & ~1; ++ freg += 2; ++ avalue[i] = pfr; ++ pfr += 2; ++ } ++#endif ++ else ++ { ++ int n = (z + sizeof (int) - 1) / sizeof (int); ++#if defined(__SH4__) ++ if (greg + n - 1 >= NGREGARG) ++ continue; ++ greg += n; ++#else ++ if (greg >= NGREGARG) ++ continue; ++ else if (greg + n - 1 >= NGREGARG) ++ greg = NGREGARG; ++ else ++ greg += n; ++#endif ++ avalue[i] = pgr; ++ pgr += n; ++ } ++ } ++ ++ greg = ireg; ++#if defined(__SH4__) ++ freg = 0; ++#endif ++ ++ for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) ++ { ++ size_t z; ++ ++ z = (*p_arg)->size; ++ if (z < sizeof(int)) ++ { ++ if (greg++ < NGREGARG) ++ continue; ++ ++ z = sizeof(int); ++ switch ((*p_arg)->type) ++ { ++ case FFI_TYPE_SINT8: ++ case FFI_TYPE_UINT8: ++ avalue[i] = (((char *)pst) + OFS_INT8); ++ break; ++ ++ case FFI_TYPE_SINT16: ++ case FFI_TYPE_UINT16: ++ avalue[i] = (((char *)pst) + OFS_INT16); ++ break; ++ ++ case FFI_TYPE_STRUCT: ++ avalue[i] = pst; ++ break; ++ ++ default: ++ FFI_ASSERT(0); ++ } ++ pst++; ++ } ++ else if (z == sizeof(int)) ++ { ++#if defined(__SH4__) ++ if ((*p_arg)->type == FFI_TYPE_FLOAT) ++ { ++ if (freg++ < NFREGARG) ++ continue; ++ } ++ else ++#endif ++ { ++ if (greg++ < NGREGARG) ++ continue; ++ } ++ avalue[i] = pst; ++ pst++; ++ } ++#if defined(__SH4__) ++ else if ((*p_arg)->type == FFI_TYPE_DOUBLE) ++ { ++ if (freg + 1 < NFREGARG) ++ { ++ freg = (freg + 1) & ~1; ++ freg += 2; ++ continue; ++ } ++ avalue[i] = pst; ++ pst += 2; ++ } ++#endif ++ else ++ { ++ int n = (z + sizeof (int) - 1) / sizeof (int); ++ if (greg + n - 1 < NGREGARG) ++ { ++ greg += n; ++ continue; ++ } ++#if (! defined(__SH4__)) ++ else if (greg < NGREGARG) ++ { ++ greg = NGREGARG; ++ continue; ++ } ++#endif ++ avalue[i] = pst; ++ pst += n; ++ } ++ } ++ ++ (closure->fun) (cif, rvalue, avalue, closure->user_data); ++ ++ /* Tell ffi_closure_osf how to perform return type promotions. */ ++ return cif->rtype->type; ++} +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/sh/sysv.S gcc/libffi/src/sh/sysv.S +--- gcc-3.2.2.orig/libffi/src/sh/sysv.S Thu Jan 1 09:00:00 1970 ++++ gcc/libffi/src/sh/sysv.S Tue Dec 17 03:22:48 2002 +@@ -0,0 +1,773 @@ ++/* ----------------------------------------------------------------------- ++ sysv.S - Copyright (c) 2002 Kaz Kojima ++ ++ SuperH Foreign Function Interface ++ ++ Permission is hereby granted, free of charge, to any person obtaining ++ a copy of this software and associated documentation files (the ++ ``Software''), to deal in the Software without restriction, including ++ without limitation the rights to use, copy, modify, merge, publish, ++ distribute, sublicense, and/or sell copies of the Software, and to ++ permit persons to whom the Software is furnished to do so, subject to ++ the following conditions: ++ ++ The above copyright notice and this permission notice shall be included ++ in all copies or substantial portions of the Software. ++ ++ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS ++ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ++ IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR ++ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ++ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ++ OTHER DEALINGS IN THE SOFTWARE. ++ ----------------------------------------------------------------------- */ ++ ++#define LIBFFI_ASM ++#include <ffi.h> ++#ifdef HAVE_MACHINE_ASM_H ++#include <machine/asm.h> ++#else ++/* XXX these lose for some platforms, I'm sure. */ ++#define CNAME(x) x ++#define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): ++#endif ++ ++#if defined(__HITACHI__) ++#define STRUCT_VALUE_ADDRESS_WITH_ARG 1 ++#else ++#define STRUCT_VALUE_ADDRESS_WITH_ARG 0 ++#endif ++ ++.text ++ ++ # r4: ffi_prep_args ++ # r5: &ecif ++ # r6: bytes ++ # r7: flags ++ # sp+0: rvalue ++ # sp+4: fn ++ ++ # This assumes we are using gas. ++ENTRY(ffi_call_SYSV) ++ # Save registers ++.LFB1: ++ mov.l r8,@-r15 ++.LCFI0: ++ mov.l r9,@-r15 ++.LCFI1: ++ mov.l r10,@-r15 ++.LCFI2: ++ mov.l r12,@-r15 ++.LCFI3: ++ mov.l r14,@-r15 ++.LCFI4: ++ sts.l pr,@-r15 ++.LCFI5: ++ mov r15,r14 ++.LCFI6: ++#if defined(__SH4__) ++ mov r6,r8 ++ mov r7,r9 ++ ++ sub r6,r15 ++ add #-16,r15 ++ mov #~7,r0 ++ and r0,r15 ++ ++ mov r4,r0 ++ jsr @r0 ++ mov r15,r4 ++ ++ mov r9,r1 ++ shlr8 r9 ++ shlr8 r9 ++ shlr8 r9 ++ ++ mov #FFI_TYPE_STRUCT,r2 ++ cmp/eq r2,r9 ++ bf 1f ++#if STRUCT_VALUE_ADDRESS_WITH_ARG ++ mov.l @r15+,r4 ++ bra 2f ++ mov #5,r2 ++#else ++ mov.l @r15+,r10 ++#endif ++1: ++ mov #4,r2 ++2: ++ mov #4,r3 ++ ++L_pass: ++ cmp/pl r8 ++ bf L_call_it ++ ++ mov r1,r0 ++ and #3,r0 ++ ++L_pass_d: ++ cmp/eq #FFI_TYPE_DOUBLE,r0 ++ bf L_pass_f ++ ++ mov r3,r0 ++ and #1,r0 ++ tst r0,r0 ++ bt 1f ++ add #1,r3 ++1: ++ mov r15,r0 ++ and #7,r0 ++ tst r0,r0 ++ bt 2f ++ add #4,r15 ++2: ++ mov #12,r0 ++ cmp/hs r0,r3 ++ bt/s 3f ++ shlr2 r1 ++ bsr L_pop_d ++ nop ++3: ++ add #2,r3 ++ bra L_pass ++ add #-8,r8 ++ ++L_pop_d: ++ mov r3,r0 ++ add r0,r0 ++ add r3,r0 ++ add #-12,r0 ++ braf r0 ++ nop ++#ifdef __LITTLE_ENDIAN__ ++ fmov.s @r15+,fr5 ++ rts ++ fmov.s @r15+,fr4 ++ fmov.s @r15+,fr7 ++ rts ++ fmov.s @r15+,fr6 ++ fmov.s @r15+,fr9 ++ rts ++ fmov.s @r15+,fr8 ++ fmov.s @r15+,fr11 ++ rts ++ fmov.s @r15+,fr10 ++#else ++ fmov.s @r15+,fr4 ++ rts ++ fmov.s @r15+,fr5 ++ fmov.s @r15+,fr6 ++ rts ++ fmov.s @r15+,fr7 ++ fmov.s @r15+,fr8 ++ rts ++ fmov.s @r15+,fr9 ++ fmov.s @r15+,fr10 ++ rts ++ fmov.s @r15+,fr11 ++#endif ++ ++L_pass_f: ++ cmp/eq #FFI_TYPE_FLOAT,r0 ++ bf L_pass_i ++ ++ mov #12,r0 ++ cmp/hs r0,r3 ++ bt/s 2f ++ shlr2 r1 ++ bsr L_pop_f ++ nop ++2: ++ add #1,r3 ++ bra L_pass ++ add #-4,r8 ++ ++L_pop_f: ++ mov r3,r0 ++ shll2 r0 ++ add #-16,r0 ++ braf r0 ++ nop ++#ifdef __LITTLE_ENDIAN__ ++ rts ++ fmov.s @r15+,fr5 ++ rts ++ fmov.s @r15+,fr4 ++ rts ++ fmov.s @r15+,fr7 ++ rts ++ fmov.s @r15+,fr6 ++ rts ++ fmov.s @r15+,fr9 ++ rts ++ fmov.s @r15+,fr8 ++ rts ++ fmov.s @r15+,fr11 ++ rts ++ fmov.s @r15+,fr10 ++#else ++ rts ++ fmov.s @r15+,fr4 ++ rts ++ fmov.s @r15+,fr5 ++ rts ++ fmov.s @r15+,fr6 ++ rts ++ fmov.s @r15+,fr7 ++ rts ++ fmov.s @r15+,fr8 ++ rts ++ fmov.s @r15+,fr9 ++ rts ++ fmov.s @r15+,fr10 ++ rts ++ fmov.s @r15+,fr11 ++#endif ++ ++L_pass_i: ++ cmp/eq #FFI_TYPE_INT,r0 ++ bf L_call_it ++ ++ mov #8,r0 ++ cmp/hs r0,r2 ++ bt/s 2f ++ shlr2 r1 ++ bsr L_pop_i ++ nop ++2: ++ add #1,r2 ++ bra L_pass ++ add #-4,r8 ++ ++L_pop_i: ++ mov r2,r0 ++ shll2 r0 ++ add #-16,r0 ++ braf r0 ++ nop ++ rts ++ mov.l @r15+,r4 ++ rts ++ mov.l @r15+,r5 ++ rts ++ mov.l @r15+,r6 ++ rts ++ mov.l @r15+,r7 ++ ++L_call_it: ++ # call function ++#if (! STRUCT_VALUE_ADDRESS_WITH_ARG) ++ mov r10, r2 ++#endif ++ mov.l @(28,r14),r1 ++ jsr @r1 ++ nop ++ ++L_ret_d: ++ mov #FFI_TYPE_DOUBLE,r2 ++ cmp/eq r2,r9 ++ bf L_ret_ll ++ ++ mov.l @(24,r14),r1 ++#ifdef __LITTLE_ENDIAN__ ++ fmov.s fr1,@r1 ++ add #4,r1 ++ bra L_epilogue ++ fmov.s fr0,@r1 ++#else ++ fmov.s fr0,@r1 ++ add #4,r1 ++ bra L_epilogue ++ fmov.s fr1,@r1 ++#endif ++ ++L_ret_ll: ++ mov #FFI_TYPE_SINT64,r2 ++ cmp/eq r2,r9 ++ bt/s 1f ++ mov #FFI_TYPE_UINT64,r2 ++ cmp/eq r2,r9 ++ bf L_ret_f ++ ++1: ++ mov.l @(24,r14),r2 ++ mov.l r0,@r2 ++ bra L_epilogue ++ mov.l r1,@(4,r2) ++ ++L_ret_f: ++ mov #FFI_TYPE_FLOAT,r2 ++ cmp/eq r2,r9 ++ bf L_ret_i ++ ++ mov.l @(24,r14),r1 ++ bra L_epilogue ++ fmov.s fr0,@r1 ++ ++L_ret_i: ++ mov #FFI_TYPE_INT,r2 ++ cmp/eq r2,r9 ++ bf L_epilogue ++ ++ mov.l @(24,r14),r1 ++ bra L_epilogue ++ mov.l r0,@r1 ++ ++L_epilogue: ++ # Remove the space we pushed for the args ++ mov r14,r15 ++ ++ lds.l @r15+,pr ++ mov.l @r15+,r14 ++ mov.l @r15+,r12 ++ mov.l @r15+,r10 ++ mov.l @r15+,r9 ++ rts ++ mov.l @r15+,r8 ++#else ++ mov r6,r8 ++ mov r7,r9 ++ ++ sub r6,r15 ++ add #-16,r15 ++ mov #~7,r0 ++ and r0,r15 ++ ++ mov r4,r0 ++ jsr @r0 ++ mov r15,r4 ++ ++ mov r9,r3 ++ shlr8 r9 ++ shlr8 r9 ++ shlr8 r9 ++ ++ mov #FFI_TYPE_STRUCT,r2 ++ cmp/eq r2,r9 ++ bf 1f ++#if STRUCT_VALUE_ADDRESS_WITH_ARG ++ mov.l @r15+,r4 ++ bra 2f ++ mov #5,r2 ++#else ++ mov.l @r15+,r10 ++#endif ++1: ++ mov #4,r2 ++2: ++ ++L_pass: ++ cmp/pl r8 ++ bf L_call_it ++ ++ mov r3,r0 ++ and #3,r0 ++ ++L_pass_d: ++ cmp/eq #FFI_TYPE_DOUBLE,r0 ++ bf L_pass_i ++ ++ mov r15,r0 ++ and #7,r0 ++ tst r0,r0 ++ bt 1f ++ add #4,r15 ++1: ++ mov #8,r0 ++ cmp/hs r0,r2 ++ bt/s 2f ++ shlr2 r3 ++ bsr L_pop_d ++ nop ++2: ++ add #2,r2 ++ bra L_pass ++ add #-8,r8 ++ ++L_pop_d: ++ mov r2,r0 ++ add r0,r0 ++ add r2,r0 ++ add #-12,r0 ++ add r0,r0 ++ braf r0 ++ nop ++ mov.l @r15+,r4 ++ rts ++ mov.l @r15+,r5 ++ mov.l @r15+,r5 ++ rts ++ mov.l @r15+,r6 ++ mov.l @r15+,r6 ++ rts ++ mov.l @r15+,r7 ++ rts ++ mov.l @r15+,r7 ++ ++L_pass_i: ++ mov #8,r0 ++ cmp/hs r0,r2 ++ bt/s 2f ++ shlr2 r3 ++ bsr L_pop_i ++ nop ++2: ++ add #1,r2 ++ bra L_pass ++ add #-4,r8 ++ ++L_pop_i: ++ mov r2,r0 ++ shll2 r0 ++ add #-16,r0 ++ braf r0 ++ nop ++ rts ++ mov.l @r15+,r4 ++ rts ++ mov.l @r15+,r5 ++ rts ++ mov.l @r15+,r6 ++ rts ++ mov.l @r15+,r7 ++ ++L_call_it: ++ # call function ++#if (! STRUCT_VALUE_ADDRESS_WITH_ARG) ++ mov r10, r2 ++#endif ++ mov.l @(28,r14),r1 ++ jsr @r1 ++ nop ++ ++L_ret_d: ++ mov #FFI_TYPE_DOUBLE,r2 ++ cmp/eq r2,r9 ++ bf L_ret_ll ++ ++ mov.l @(24,r14),r2 ++ mov.l r0,@r2 ++ bra L_epilogue ++ mov.l r1,@(4,r2) ++ ++L_ret_ll: ++ mov #FFI_TYPE_SINT64,r2 ++ cmp/eq r2,r9 ++ bt/s 1f ++ mov #FFI_TYPE_UINT64,r2 ++ cmp/eq r2,r9 ++ bf L_ret_i ++ ++1: ++ mov.l @(24,r14),r2 ++ mov.l r0,@r2 ++ bra L_epilogue ++ mov.l r1,@(4,r2) ++ ++L_ret_i: ++ mov #FFI_TYPE_FLOAT,r2 ++ cmp/eq r2,r9 ++ bt 1f ++ mov #FFI_TYPE_INT,r2 ++ cmp/eq r2,r9 ++ bf L_epilogue ++1: ++ mov.l @(24,r14),r1 ++ bra L_epilogue ++ mov.l r0,@r1 ++ ++L_epilogue: ++ # Remove the space we pushed for the args ++ mov r14,r15 ++ ++ lds.l @r15+,pr ++ mov.l @r15+,r14 ++ mov.l @r15+,r12 ++ mov.l @r15+,r10 ++ mov.l @r15+,r9 ++ rts ++ mov.l @r15+,r8 ++#endif ++.LFE1: ++.ffi_call_SYSV_end: ++ .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) ++ ++.globl ffi_closure_helper_SYSV ++ ++ENTRY(ffi_closure_SYSV) ++.LFB2: ++ mov.l r14,@-r15 ++.LCFI7: ++ sts.l pr,@-r15 ++ ++ /* Stack layout: ++ ... ++ 32 bytes (floating register parameters, SH-4 only) ++ 16 bytes (register parameters) ++ 4 bytes (result) ++ 4 bytes (5th arg) ++ <- new stack pointer ++ */ ++.LCFI8: ++#if defined(__SH4__) ++ add #-56,r15 ++#else ++ add #-24,r15 ++#endif ++.LCFI9: ++ mov r15,r14 ++.LCFIA: ++ mov r14,r1 ++ add #24,r1 ++ mov.l r7,@-r1 ++ mov.l r6,@-r1 ++ mov.l r5,@-r1 ++ mov.l r4,@-r1 ++ mov r1,r6 ++ ++#if defined(__SH4__) ++ mov r14,r1 ++ add #56,r1 ++#ifdef __LITTLE_ENDIAN__ ++ fmov.s fr10,@-r1 ++ fmov.s fr11,@-r1 ++ fmov.s fr8,@-r1 ++ fmov.s fr9,@-r1 ++ fmov.s fr6,@-r1 ++ fmov.s fr7,@-r1 ++ fmov.s fr4,@-r1 ++ fmov.s fr5,@-r1 ++#else ++ fmov.s fr11,@-r1 ++ fmov.s fr10,@-r1 ++ fmov.s fr9,@-r1 ++ fmov.s fr8,@-r1 ++ fmov.s fr7,@-r1 ++ fmov.s fr6,@-r1 ++ fmov.s fr5,@-r1 ++ fmov.s fr4,@-r1 ++#endif ++ mov r1,r7 ++#endif ++ ++ mov r14,r1 ++ add #4,r1 ++ mov r1,r5 ++ ++ mov r14,r1 ++#if defined(__SH4__) ++ add #64,r1 ++#else ++ add #32,r1 ++#endif ++ mov.l r1,@r14 ++ ++ mov.l L_helper,r0 ++ jsr @r0 ++ mov r3,r4 ++ ++ shll r0 ++ mov r0,r1 ++ mova L_table,r0 ++ add r1,r0 ++ mov.w @r0,r0 ++ mov r14,r2 ++ braf r0 ++ add #4,r2 ++0: ++ .align 2 ++L_helper: ++ .long ffi_closure_helper_SYSV ++L_table: ++ .short L_case_v - 0b /* FFI_TYPE_VOID */ ++ .short L_case_i - 0b /* FFI_TYPE_INT */ ++#if defined(__SH4__) ++ .short L_case_f - 0b /* FFI_TYPE_FLOAT */ ++ .short L_case_d - 0b /* FFI_TYPE_DOUBLE */ ++ .short L_case_d - 0b /* FFI_TYPE_LONGDOUBLE */ ++#else ++ .short L_case_i - 0b /* FFI_TYPE_FLOAT */ ++ .short L_case_ll - 0b /* FFI_TYPE_DOUBLE */ ++ .short L_case_ll - 0b /* FFI_TYPE_LONGDOUBLE */ ++#endif ++ .short L_case_uq - 0b /* FFI_TYPE_UINT8 */ ++ .short L_case_q - 0b /* FFI_TYPE_SINT8 */ ++ .short L_case_uh - 0b /* FFI_TYPE_UINT16 */ ++ .short L_case_h - 0b /* FFI_TYPE_SINT16 */ ++ .short L_case_i - 0b /* FFI_TYPE_UINT32 */ ++ .short L_case_i - 0b /* FFI_TYPE_SINT32 */ ++ .short L_case_ll - 0b /* FFI_TYPE_UINT64 */ ++ .short L_case_ll - 0b /* FFI_TYPE_SINT64 */ ++ .short L_case_v - 0b /* FFI_TYPE_STRUCT */ ++ .short L_case_i - 0b /* FFI_TYPE_POINTER */ ++ ++#if defined(__SH4__) ++L_case_d: ++#ifdef __LITTLE_ENDIAN__ ++ fmov.s @r2+,fr1 ++ bra L_case_v ++ fmov.s @r2,fr0 ++#else ++ fmov.s @r2+,fr0 ++ bra L_case_v ++ fmov.s @r2,fr1 ++#endif ++ ++L_case_f: ++ bra L_case_v ++ fmov.s @r2,fr0 ++#endif ++ ++L_case_ll: ++ mov.l @r2+,r0 ++ bra L_case_v ++ mov.l @r2,r1 ++ ++L_case_i: ++ bra L_case_v ++ mov.l @r2,r0 ++ ++L_case_q: ++#ifdef __LITTLE_ENDIAN__ ++#else ++ add #3,r2 ++#endif ++ bra L_case_v ++ mov.b @r2,r0 ++ ++L_case_uq: ++#ifdef __LITTLE_ENDIAN__ ++#else ++ add #3,r2 ++#endif ++ mov.b @r2,r0 ++ bra L_case_v ++ extu.b r0,r0 ++ ++L_case_h: ++#ifdef __LITTLE_ENDIAN__ ++#else ++ add #2,r2 ++#endif ++ bra L_case_v ++ mov.w @r2,r0 ++ ++L_case_uh: ++#ifdef __LITTLE_ENDIAN__ ++#else ++ add #2,r2 ++#endif ++ mov.w @r2,r0 ++ extu.w r0,r0 ++ /* fall through */ ++ ++L_case_v: ++#if defined(__SH4__) ++ add #56,r15 ++#else ++ add #24,r15 ++#endif ++ lds.l @r15+,pr ++ rts ++ mov.l @r15+,r14 ++.LFE2: ++.ffi_closure_SYSV_end: ++ .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) ++ ++ .section ".eh_frame","aw",@progbits ++__FRAME_BEGIN__: ++ .4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */ ++.LSCIE1: ++ .4byte 0x0 /* CIE Identifier Tag */ ++ .byte 0x1 /* CIE Version */ ++ .byte 0x0 /* CIE Augmentation */ ++ .byte 0x1 /* uleb128 0x1; CIE Code Alignment Factor */ ++ .byte 0x7c /* sleb128 -4; CIE Data Alignment Factor */ ++ .byte 0x11 /* CIE RA Column */ ++ .byte 0xc /* DW_CFA_def_cfa */ ++ .byte 0xf /* uleb128 0xf */ ++ .byte 0x0 /* uleb128 0x0 */ ++ .align 2 ++.LECIE1: ++.LSFDE1: ++ .4byte .LEFDE1-.LASFDE1 /* FDE Length */ ++.LASFDE1: ++ .4byte .LASFDE1-__FRAME_BEGIN__ /* FDE CIE offset */ ++ .4byte .LFB1 /* FDE initial location */ ++ .4byte .LFE1-.LFB1 /* FDE address range */ ++ .byte 0x4 /* DW_CFA_advance_loc4 */ ++ .4byte .LCFI0-.LFB1 ++ .byte 0xe /* DW_CFA_def_cfa_offset */ ++ .byte 0x4 /* uleb128 0x4 */ ++ .byte 0x4 /* DW_CFA_advance_loc4 */ ++ .4byte .LCFI1-.LCFI0 ++ .byte 0xe /* DW_CFA_def_cfa_offset */ ++ .byte 0x8 /* uleb128 0x4 */ ++ .byte 0x4 /* DW_CFA_advance_loc4 */ ++ .4byte .LCFI2-.LCFI1 ++ .byte 0xe /* DW_CFA_def_cfa_offset */ ++ .byte 0xc /* uleb128 0x4 */ ++ .byte 0x4 /* DW_CFA_advance_loc4 */ ++ .4byte .LCFI3-.LCFI2 ++ .byte 0xe /* DW_CFA_def_cfa_offset */ ++ .byte 0x10 /* uleb128 0x4 */ ++ .byte 0x4 /* DW_CFA_advance_loc4 */ ++ .4byte .LCFI4-.LCFI3 ++ .byte 0xe /* DW_CFA_def_cfa_offset */ ++ .byte 0x14 /* uleb128 0x4 */ ++ .byte 0x4 /* DW_CFA_advance_loc4 */ ++ .4byte .LCFI5-.LCFI4 ++ .byte 0xe /* DW_CFA_def_cfa_offset */ ++ .byte 0x18 /* uleb128 0x4 */ ++ .byte 0x91 /* DW_CFA_offset, column 0x11 */ ++ .byte 0x6 /* uleb128 0x6 */ ++ .byte 0x8e /* DW_CFA_offset, column 0xe */ ++ .byte 0x5 /* uleb128 0x5 */ ++ .byte 0x8c /* DW_CFA_offset, column 0xc */ ++ .byte 0x4 /* uleb128 0x4 */ ++ .byte 0x8a /* DW_CFA_offset, column 0xa */ ++ .byte 0x3 /* uleb128 0x3 */ ++ .byte 0x89 /* DW_CFA_offset, column 0x9 */ ++ .byte 0x2 /* uleb128 0x2 */ ++ .byte 0x88 /* DW_CFA_offset, column 0x8 */ ++ .byte 0x1 /* uleb128 0x1 */ ++ .byte 0x4 /* DW_CFA_advance_loc4 */ ++ .4byte .LCFI6-.LCFI5 ++ .byte 0xd /* DW_CFA_def_cfa_register */ ++ .byte 0xe /* uleb128 0xe */ ++ .align 2 ++.LEFDE1: ++ ++.LSFDE3: ++ .4byte .LEFDE3-.LASFDE3 /* FDE Length */ ++.LASFDE3: ++ .4byte .LASFDE3-__FRAME_BEGIN__ /* FDE CIE offset */ ++ .4byte .LFB2 /* FDE initial location */ ++ .4byte .LFE2-.LFB2 /* FDE address range */ ++ .byte 0x4 /* DW_CFA_advance_loc4 */ ++ .4byte .LCFI7-.LFB2 ++ .byte 0xe /* DW_CFA_def_cfa_offset */ ++ .byte 0x4 /* uleb128 0x4 */ ++ .byte 0x4 /* DW_CFA_advance_loc4 */ ++ .4byte .LCFI8-.LCFI7 ++ .byte 0xe /* DW_CFA_def_cfa_offset */ ++ .byte 0x8 /* uleb128 0x8 */ ++ .byte 0x4 /* DW_CFA_advance_loc4 */ ++ .4byte .LCFI9-.LCFI8 ++ .byte 0xe /* DW_CFA_def_cfa_offset */ ++#if defined(__SH4__) ++ .byte 8+56 /* uleb128 8+56 */ ++#else ++ .byte 8+24 /* uleb128 8+24 */ ++#endif ++ .byte 0x91 /* DW_CFA_offset, column 0x11 */ ++ .byte 0x2 ++ .byte 0x8e /* DW_CFA_offset, column 0xe */ ++ .byte 0x1 ++ .byte 0x4 /* DW_CFA_advance_loc4 */ ++ .4byte .LCFIA-.LCFI9 ++ .byte 0xd /* DW_CFA_def_cfa_register */ ++ .byte 0xe /* uleb128 0xe */ ++ .align 2 ++.LEFDE3: +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/sparc/ffi.c gcc/libffi/src/sparc/ffi.c +--- gcc-3.2.2.orig/libffi/src/sparc/ffi.c Sat Mar 3 07:21:23 2001 ++++ gcc/libffi/src/sparc/ffi.c Sat Jan 4 08:08:56 2003 +@@ -1,5 +1,5 @@ + /* ----------------------------------------------------------------------- +- ffi.c - Copyright (c) 1996 Cygnus Solutions ++ ffi.c - Copyright (c) 1996, 2003 Cygnus Solutions + + Sparc Foreign Function Interface + +@@ -28,20 +28,22 @@ + + #include <stdlib.h> + ++#ifdef SPARC64 ++extern void ffi_closure_v9(void); ++#else ++extern void ffi_closure_v8(void); ++#endif ++ + /* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments */ + + void ffi_prep_args_v8(char *stack, extended_cif *ecif) + { + int i; +- int tmp; +- int avn; + void **p_argv; + char *argp; + ffi_type **p_arg; + +- tmp = 0; +- + /* Skip 16 words for the window save area */ + argp = stack + 16*sizeof(int); + +@@ -66,18 +68,12 @@ + ((int*)argp)[5] = 0; + #endif + +- avn = ecif->cif->nargs; + p_argv = ecif->avalue; + +- for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; +- i && avn; +- i--, p_arg++) ++ for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; i; i--, p_arg++) + { + size_t z; + +- if (avn) +- { +- avn--; + if ((*p_arg)->type == FFI_TYPE_STRUCT + #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + || (*p_arg)->type == FFI_TYPE_LONGDOUBLE +@@ -122,7 +118,6 @@ + } + p_argv++; + argp += z; +- } + } + + return; +@@ -420,3 +415,101 @@ + } + + } ++ ++ffi_status ++ffi_prep_closure (ffi_closure* closure, ++ ffi_cif* cif, ++ void (*fun)(ffi_cif*, void*, void**, void*), ++ void *user_data) ++{ ++ unsigned int *tramp = (unsigned int *) &closure->tramp[0]; ++ unsigned long fn; ++ unsigned long ctx = (unsigned long) closure; ++ ++#ifdef SPARC64 ++ /* Trampoline address is equal to the closure address. We take advantage ++ of that to reduce the trampoline size by 8 bytes. */ ++ FFI_ASSERT (cif->abi == FFI_V9); ++ fn = (unsigned long) ffi_closure_v9; ++ tramp[0] = 0x83414000; /* rd %pc, %g1 */ ++ tramp[1] = 0xca586010; /* ldx [%g1+16], %g5 */ ++ tramp[2] = 0x81c14000; /* jmp %g5 */ ++ tramp[3] = 0x01000000; /* nop */ ++ *((unsigned long *) &tramp[4]) = fn; ++#else ++ FFI_ASSERT (cif->abi == FFI_V8); ++ fn = (unsigned long) ffi_closure_v8; ++ tramp[0] = 0x03000000 | fn >> 10; /* sethi %hi(fn), %g1 */ ++ tramp[1] = 0x05000000 | ctx >> 10; /* sethi %hi(ctx), %g2 */ ++ tramp[2] = 0x81c06000 | (fn & 0x3ff); /* jmp %g1+%lo(fn) */ ++ tramp[3] = 0x8410a000 | (ctx & 0x3ff);/* or %g2, %lo(ctx) */ ++#endif ++ ++ closure->cif = cif; ++ closure->fun = fun; ++ closure->user_data = user_data; ++ ++ /* Flush the Icache. FIXME: alignment isn't certain, assume 8 bytes */ ++#ifdef SPARC64 ++ asm volatile ("flush %0" : : "r" (closure) : "memory"); ++ asm volatile ("flush %0" : : "r" (((char *) closure) + 8) : "memory"); ++#else ++ asm volatile ("iflush %0" : : "r" (closure) : "memory"); ++ asm volatile ("iflush %0" : : "r" (((char *) closure) + 8) : "memory"); ++#endif ++ ++ return FFI_OK; ++} ++ ++int ++ffi_closure_sparc_inner(ffi_closure *closure, ++ void *rvalue, unsigned long *gpr, double *fpr) ++{ ++ ffi_cif *cif; ++ void **avalue; ++ ffi_type **arg_types; ++ int i, avn, argn; ++ ++ cif = closure->cif; ++ avalue = alloca(cif->nargs * sizeof(void *)); ++ ++ argn = 0; ++ ++ /* Copy the caller's structure return address to that the closure ++ returns the data directly to the caller. */ ++ if (cif->flags == FFI_TYPE_STRUCT) ++ { ++ rvalue = (void *) gpr[0]; ++ argn = 1; ++ } ++ ++ i = 0; ++ avn = cif->nargs; ++ arg_types = cif->arg_types; ++ ++ /* Grab the addresses of the arguments from the stack frame. */ ++ while (i < avn) ++ { ++ /* Assume big-endian. FIXME */ ++ argn += ALIGN(arg_types[i]->size, SIZEOF_ARG) / SIZEOF_ARG; ++ ++#ifdef SPARC64 ++ if (i < 6 && (arg_types[i]->type == FFI_TYPE_FLOAT ++ || arg_types[i]->type == FFI_TYPE_DOUBLE ++#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE ++ || arg_types[i]->type == FFI_TYPE_LONGDOUBLE ++#endif ++ )) ++ avalue[i] = ((char *) &fpr[argn]) - arg_types[i]->size; ++ else ++#endif ++ avalue[i] = ((char *) &gpr[argn]) - arg_types[i]->size; ++ i++; ++ } ++ ++ /* Invoke the closure. */ ++ (closure->fun) (cif, rvalue, avalue, closure->user_data); ++ ++ /* Tell ffi_closure_sparc how to perform return type promotions. */ ++ return cif->rtype->type; ++} +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/sparc/v8.S gcc/libffi/src/sparc/v8.S +--- gcc-3.2.2.orig/libffi/src/sparc/v8.S Mon Apr 29 05:12:04 2002 ++++ gcc/libffi/src/sparc/v8.S Sat Jan 4 08:08:56 2003 +@@ -1,5 +1,5 @@ + /* ----------------------------------------------------------------------- +- v8.S - Copyright (c) 1996, 1997 Cygnus Solutions ++ v8.S - Copyright (c) 1996, 1997, 2003 Cygnus Solutions + + Sparc Foreign Function Interface + +@@ -94,6 +94,72 @@ + .ffi_call_V8_end: + .size ffi_call_V8,.ffi_call_V8_end-ffi_call_V8 + ++ ++#define STACKFRAME 104 /* 16*4 register window + ++ 1*4 struct return + ++ 6*4 args backing store + ++ 3*4 locals */ ++ ++/* ffi_closure_v8(...) ++ ++ Receives the closure argument in %g2. */ ++ ++ .text ++ .align 8 ++ .globl ffi_closure_v8 ++ ++ffi_closure_v8: ++ .register %g2, #scratch ++.LLFB2: ++ save %sp, -STACKFRAME, %sp ++.LLCFI1: ++ ++ ! Store all of the potential argument registers in va_list format. ++ st %i0, [%fp+68+0] ++ st %i1, [%fp+68+4] ++ st %i2, [%fp+68+8] ++ st %i3, [%fp+68+12] ++ st %i4, [%fp+68+16] ++ st %i5, [%fp+68+20] ++ ++ ! Call ffi_closure_sparc_inner to do the bulk of the work. ++ mov %g2, %o0 ++ add %fp, -8, %o1 ++ add %fp, 68, %o2 ++ call ffi_closure_sparc_inner ++ mov 0, %o3 ++ ++ ! Load up the return value in the proper type. ++ cmp %o0, FFI_TYPE_VOID ++ be done1 ++ ++ cmp %o0, FFI_TYPE_FLOAT ++ be,a done1 ++ ld [%fp-8], %f0 ++ ++ cmp %o0, FFI_TYPE_DOUBLE ++ be,a done1 ++ ldd [%fp-8], %f0 ++ ++ cmp %o0, FFI_TYPE_SINT64 ++ be,a integer ++ ld [%fp-4], %i1 ++ ++ cmp %o0, FFI_TYPE_UINT64 ++ be,a integer ++ ld [%fp-4], %i1 ++ ++integer: ++ ld [%fp-8], %i0 ++ ++done1: ++ ret ++ restore ++.LLFE2: ++ ++.ffi_closure_v8_end: ++ .size ffi_closure_v8,.ffi_closure_v8_end-ffi_closure_v8 ++ + #ifdef SPARC64 + #define WS 8 + #define nword xword +@@ -148,3 +214,26 @@ + .byte 0x1f ! uleb128 0x1f + .align WS + .LLEFDE1: ++.LLSFDE2: ++ .uaword .LLEFDE2-.LLASFDE2 ! FDE Length ++.LLASFDE2: ++ .uaword .LLASFDE2-.LLframe1 ! FDE CIE offset ++#ifdef HAVE_AS_SPARC_UA_PCREL ++ .uaword %r_disp32(.LLFB2) ++ .uaword .LLFE2-.LLFB2 ! FDE address range ++#else ++ .align WS ++ .nword .LLFB2 ++ .uanword .LLFE2-.LLFB2 ! FDE address range ++#endif ++ .byte 0x0 ! uleb128 0x0; Augmentation size ++ .byte 0x4 ! DW_CFA_advance_loc4 ++ .uaword .LLCFI1-.LLFB2 ++ .byte 0xd ! DW_CFA_def_cfa_register ++ .byte 0x1e ! uleb128 0x1e ++ .byte 0x2d ! DW_CFA_GNU_window_save ++ .byte 0x9 ! DW_CFA_register ++ .byte 0xf ! uleb128 0xf ++ .byte 0x1f ! uleb128 0x1f ++ .align WS ++.LLEFDE2: +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/sparc/v9.S gcc/libffi/src/sparc/v9.S +--- gcc-3.2.2.orig/libffi/src/sparc/v9.S Mon Apr 29 05:12:04 2002 ++++ gcc/libffi/src/sparc/v9.S Sat Jan 4 08:08:56 2003 +@@ -1,5 +1,5 @@ + /* ----------------------------------------------------------------------- +- v9.S - Copyright (c) 2000 Cygnus Solutions ++ v9.S - Copyright (c) 2000, 2003 Cygnus Solutions + + Sparc 64bit Foreign Function Interface + +@@ -99,7 +99,7 @@ + cmp %i3, FFI_TYPE_STRUCT + be,pn %icc, dostruct + +- cmp %i3, FFI_TYPE_LONGDOUBLE ++ cmp %i3, FFI_TYPE_LONGDOUBLE + bne,pt %icc, done + nop + std %f0, [%i4+0] +@@ -125,6 +125,88 @@ + .ffi_call_V9_end: + .size ffi_call_V9,.ffi_call_V9_end-ffi_call_V9 + ++ ++#define STACKFRAME 240 /* 16*8 register window + ++ 6*8 args backing store + ++ 8*8 locals */ ++#define FP %fp+STACK_BIAS ++ ++/* ffi_closure_v9(...) ++ ++ Receives the closure argument in %g1. */ ++ ++ .text ++ .align 8 ++ .globl ffi_closure_v9 ++ ++ffi_closure_v9: ++.LLFB2: ++ save %sp, -STACKFRAME, %sp ++.LLCFI1: ++ ++ ! Store all of the potential argument registers in va_list format. ++ stx %i0, [FP+128+0] ++ stx %i1, [FP+128+8] ++ stx %i2, [FP+128+16] ++ stx %i3, [FP+128+24] ++ stx %i4, [FP+128+32] ++ stx %i5, [FP+128+40] ++ ++ ! Store possible floating point argument registers too. ++ std %f0, [FP-48] ++ std %f2, [FP-40] ++ std %f4, [FP-32] ++ std %f6, [FP-24] ++ std %f8, [FP-16] ++ std %f10, [FP-8] ++ ++ ! Call ffi_closure_sparc_inner to do the bulk of the work. ++ mov %g1, %o0 ++ add %fp, STACK_BIAS-64, %o1 ++ add %fp, STACK_BIAS+128, %o2 ++ call ffi_closure_sparc_inner ++ add %fp, STACK_BIAS-48, %o3 ++ ++ ! Load up the return value in the proper type. ++ cmp %o0, FFI_TYPE_VOID ++ be,pn %icc, done1 ++ ++ cmp %o0, FFI_TYPE_FLOAT ++ be,a,pn %icc, done1 ++ ld [FP-64], %f0 ++ ++ cmp %o0, FFI_TYPE_DOUBLE ++ be,a,pn %icc, done1 ++ ldd [FP-64], %f0 ++ ++ cmp %o0, FFI_TYPE_LONGDOUBLE ++ be,a,pn %icc, longdouble1 ++ ldd [FP-64], %f0 ++ ++ cmp %o0, FFI_TYPE_STRUCT ++ be,pn %icc, struct1 ++ ++ ! FFI_TYPE_UINT64 | FFI_TYPE_SINT64 | FFI_TYPE_POINTER ++ ldx [FP-64], %i0 ++ ++done1: ++ ret ++ restore ++ ++struct1: ++ ldx [FP-56], %i2 ++ ret ++ restore ++ ++longdouble1: ++ ldd [FP-56], %f2 ++ ret ++ restore ++.LLFE2: ++ ++.ffi_closure_v9_end: ++ .size ffi_closure_v9,.ffi_closure_v9_end-ffi_closure_v9 ++ + .section ".eh_frame",#alloc,#write + .LLframe1: + .uaword .LLECIE1-.LLSCIE1 ! Length of Common Information Entry +@@ -169,5 +251,27 @@ + .byte 0x1f ! uleb128 0x1f + .align 8 + .LLEFDE1: +- ++.LLSFDE2: ++ .uaword .LLEFDE2-.LLASFDE2 ! FDE Length ++.LLASFDE2: ++ .uaword .LLASFDE2-.LLframe1 ! FDE CIE offset ++#ifdef HAVE_AS_SPARC_UA_PCREL ++ .uaword %r_disp32(.LLFB2) ++ .uaword .LLFE2-.LLFB2 ! FDE address range ++#else ++ .align 8 ++ .xword .LLFB2 ++ .uaxword .LLFE2-.LLFB2 ! FDE address range ++#endif ++ .byte 0x0 ! uleb128 0x0; Augmentation size ++ .byte 0x4 ! DW_CFA_advance_loc4 ++ .uaword .LLCFI1-.LLFB2 ++ .byte 0xd ! DW_CFA_def_cfa_register ++ .byte 0x1e ! uleb128 0x1e ++ .byte 0x2d ! DW_CFA_GNU_window_save ++ .byte 0x9 ! DW_CFA_register ++ .byte 0xf ! uleb128 0xf ++ .byte 0x1f ! uleb128 0x1f ++ .align 8 ++.LLEFDE2: + #endif +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/types.c gcc/libffi/src/types.c +--- gcc-3.2.2.orig/libffi/src/types.c Tue Mar 27 11:39:16 2001 ++++ gcc/libffi/src/types.c Wed Nov 27 07:24:05 2002 +@@ -42,7 +42,8 @@ + FFI_INTEGRAL_TYPEDEF(sint32, 4, 4, FFI_TYPE_SINT32); + FFI_INTEGRAL_TYPEDEF(float, 4, 4, FFI_TYPE_FLOAT); + +-#if defined ALPHA || defined SPARC64 ++#if defined ALPHA || defined SPARC64 || defined X86_64 || defined S390X \ ++ || defined IA64 + + FFI_INTEGRAL_TYPEDEF(pointer, 8, 8, FFI_TYPE_POINTER); + +@@ -52,22 +53,12 @@ + + #endif + +-#ifdef X86 ++#if defined X86 || defined X86_WIN32 || defined ARM || defined M68K + + FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64); + FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64); + +-#elif defined X86_WIN32 +- +-FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64); +-FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64); +- +-#elif defined ARM +- +-FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64); +-FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64); +- +-#elif defined M68K ++#elif defined SH + + FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64); + FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64); +@@ -80,12 +71,7 @@ + #endif + + +-#ifdef X86 +- +-FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE); +-FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE); +- +-#elif defined X86_WIN32 ++#if defined X86 || defined X86_WIN32 || defined M68K + + FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE); + FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE); +@@ -95,25 +81,25 @@ + FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE); + FFI_INTEGRAL_TYPEDEF(longdouble, 8, 4, FFI_TYPE_LONGDOUBLE); + +-#elif defined M68K ++#elif defined SH + + FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE); +-FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE); ++FFI_INTEGRAL_TYPEDEF(longdouble, 8, 4, FFI_TYPE_LONGDOUBLE); + + #elif defined SPARC + + FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE); +- + #ifdef SPARC64 +- + FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE); +- + #else +- + FFI_INTEGRAL_TYPEDEF(longdouble, 16, 8, FFI_TYPE_LONGDOUBLE); +- + #endif + ++#elif defined X86_64 ++ ++FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE); ++FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE); ++ + #else + + FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE); +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/x86/ffi.c gcc/libffi/src/x86/ffi.c +--- gcc-3.2.2.orig/libffi/src/x86/ffi.c Tue May 28 18:22:08 2002 ++++ gcc/libffi/src/x86/ffi.c Fri Dec 6 10:16:45 2002 +@@ -1,5 +1,8 @@ + /* ----------------------------------------------------------------------- +- ffi.c - Copyright (c) 1996, 1998, 1999 Cygnus Solutions ++ ffi.c - Copyright (c) 1996, 1998, 1999, 2001 Red Hat, Inc. ++ Copyright (c) 2002 Ranjit Mathew ++ Copyright (c) 2002 Bo Thorsen ++ Copyright (c) 2002 Roger Sayle + + x86 Foreign Function Interface + +@@ -23,6 +26,8 @@ + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + ++#ifndef __x86_64__ ++ + #include <ffi.h> + #include <ffi_common.h> + +@@ -36,12 +41,10 @@ + /*@=exportheader@*/ + { + register unsigned int i; +- register int tmp; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + +- tmp = 0; + argp = stack; + + if (ecif->cif->rtype->type == FFI_TYPE_STRUCT) +@@ -148,6 +151,18 @@ + /*@=declundef@*/ + /*@=exportheader@*/ + ++#ifdef X86_WIN32 ++/*@-declundef@*/ ++/*@-exportheader@*/ ++extern void ffi_call_STDCALL(void (*)(char *, extended_cif *), ++ /*@out@*/ extended_cif *, ++ unsigned, unsigned, ++ /*@out@*/ unsigned *, ++ void (*fn)()); ++/*@=declundef@*/ ++/*@=exportheader@*/ ++#endif /* X86_WIN32 */ ++ + void ffi_call(/*@dependent@*/ ffi_cif *cif, + void (*fn)(), + /*@out@*/ void *rvalue, +@@ -180,6 +195,14 @@ + cif->flags, ecif.rvalue, fn); + /*@=usedef@*/ + break; ++#ifdef X86_WIN32 ++ case FFI_STDCALL: ++ /*@-usedef@*/ ++ ffi_call_STDCALL(ffi_prep_args, &ecif, cif->bytes, ++ cif->flags, ecif.rvalue, fn); ++ /*@=usedef@*/ ++ break; ++#endif /* X86_WIN32 */ + default: + FFI_ASSERT(0); + break; +@@ -266,12 +289,10 @@ + /*@=exportheader@*/ + { + register unsigned int i; +- register int tmp; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + +- tmp = 0; + argp = stack; + + if ( cif->rtype->type == FFI_TYPE_STRUCT ) { +@@ -281,13 +302,14 @@ + + p_argv = avalue; + +- for (i = cif->nargs, p_arg = cif->arg_types; i != 0; i--, p_arg++) ++ for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) + { + size_t z; + + /* Align if necessary */ +- if (((*p_arg)->alignment - 1) & (unsigned) argp) ++ if (((*p_arg)->alignment - 1) & (unsigned) argp) { + argp = (char *) ALIGN(argp, (*p_arg)->alignment); ++ } + + z = (*p_arg)->size; + +@@ -298,7 +320,7 @@ + p_argv++; + argp += z; + } +- ++ + return; + } + +@@ -449,6 +471,15 @@ + /*@out@*/ unsigned *, + void (*fn)()); + ++#ifdef X86_WIN32 ++extern void ++ffi_call_STDCALL(void (*)(char *, extended_cif *), ++ /*@out@*/ extended_cif *, ++ unsigned, unsigned, ++ /*@out@*/ unsigned *, ++ void (*fn)()); ++#endif /* X86_WIN32 */ ++ + void + ffi_raw_call(/*@dependent@*/ ffi_cif *cif, + void (*fn)(), +@@ -483,6 +514,14 @@ + cif->flags, ecif.rvalue, fn); + /*@=usedef@*/ + break; ++#ifdef X86_WIN32 ++ case FFI_STDCALL: ++ /*@-usedef@*/ ++ ffi_call_STDCALL(ffi_prep_args_raw, &ecif, cif->bytes, ++ cif->flags, ecif.rvalue, fn); ++ /*@=usedef@*/ ++ break; ++#endif /* X86_WIN32 */ + default: + FFI_ASSERT(0); + break; +@@ -490,3 +529,5 @@ + } + + #endif ++ ++#endif /* __x86_64__ */ +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/x86/ffi64.c gcc/libffi/src/x86/ffi64.c +--- gcc-3.2.2.orig/libffi/src/x86/ffi64.c Thu Jan 1 09:00:00 1970 ++++ gcc/libffi/src/x86/ffi64.c Wed Jan 29 00:54:28 2003 +@@ -0,0 +1,706 @@ ++/* ----------------------------------------------------------------------- ++ ffi.c - Copyright (c) 2002 Bo Thorsen <bo@suse.de> ++ ++ x86-64 Foreign Function Interface ++ ++ Permission is hereby granted, free of charge, to any person obtaining ++ a copy of this software and associated documentation files (the ++ ``Software''), to deal in the Software without restriction, including ++ without limitation the rights to use, copy, modify, merge, publish, ++ distribute, sublicense, and/or sell copies of the Software, and to ++ permit persons to whom the Software is furnished to do so, subject to ++ the following conditions: ++ ++ The above copyright notice and this permission notice shall be included ++ in all copies or substantial portions of the Software. ++ ++ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS ++ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ++ IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR ++ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ++ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ++ OTHER DEALINGS IN THE SOFTWARE. ++ ----------------------------------------------------------------------- */ ++ ++#include <ffi.h> ++#include <ffi_common.h> ++ ++#include <stdlib.h> ++#include <stdarg.h> ++ ++/* ffi_prep_args is called by the assembly routine once stack space ++ has been allocated for the function's arguments */ ++ ++#ifdef __x86_64__ ++ ++#define MAX_GPR_REGS 6 ++#define MAX_SSE_REGS 8 ++typedef struct ++{ ++ /* Registers for argument passing. */ ++ long gpr[MAX_GPR_REGS]; ++ __int128_t sse[MAX_SSE_REGS]; ++ ++ /* Stack space for arguments. */ ++ char argspace[0]; ++} stackLayout; ++ ++/* All reference to register classes here is identical to the code in ++ gcc/config/i386/i386.c. Do *not* change one without the other. */ ++ ++/* Register class used for passing given 64bit part of the argument. ++ These represent classes as documented by the PS ABI, with the exception ++ of SSESF, SSEDF classes, that are basically SSE class, just gcc will ++ use SF or DFmode move instead of DImode to avoid reformating penalties. ++ ++ Similary we play games with INTEGERSI_CLASS to use cheaper SImode moves ++ whenever possible (upper half does contain padding). ++ */ ++enum x86_64_reg_class ++ { ++ X86_64_NO_CLASS, ++ X86_64_INTEGER_CLASS, ++ X86_64_INTEGERSI_CLASS, ++ X86_64_SSE_CLASS, ++ X86_64_SSESF_CLASS, ++ X86_64_SSEDF_CLASS, ++ X86_64_SSEUP_CLASS, ++ X86_64_X87_CLASS, ++ X86_64_X87UP_CLASS, ++ X86_64_MEMORY_CLASS ++ }; ++ ++#define MAX_CLASSES 4 ++ ++/* x86-64 register passing implementation. See x86-64 ABI for details. Goal ++ of this code is to classify each 8bytes of incoming argument by the register ++ class and assign registers accordingly. */ ++ ++/* Return the union class of CLASS1 and CLASS2. ++ See the x86-64 PS ABI for details. */ ++ ++static enum x86_64_reg_class ++merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2) ++{ ++ /* Rule #1: If both classes are equal, this is the resulting class. */ ++ if (class1 == class2) ++ return class1; ++ ++ /* Rule #2: If one of the classes is NO_CLASS, the resulting class is ++ the other class. */ ++ if (class1 == X86_64_NO_CLASS) ++ return class2; ++ if (class2 == X86_64_NO_CLASS) ++ return class1; ++ ++ /* Rule #3: If one of the classes is MEMORY, the result is MEMORY. */ ++ if (class1 == X86_64_MEMORY_CLASS || class2 == X86_64_MEMORY_CLASS) ++ return X86_64_MEMORY_CLASS; ++ ++ /* Rule #4: If one of the classes is INTEGER, the result is INTEGER. */ ++ if ((class1 == X86_64_INTEGERSI_CLASS && class2 == X86_64_SSESF_CLASS) ++ || (class2 == X86_64_INTEGERSI_CLASS && class1 == X86_64_SSESF_CLASS)) ++ return X86_64_INTEGERSI_CLASS; ++ if (class1 == X86_64_INTEGER_CLASS || class1 == X86_64_INTEGERSI_CLASS ++ || class2 == X86_64_INTEGER_CLASS || class2 == X86_64_INTEGERSI_CLASS) ++ return X86_64_INTEGER_CLASS; ++ ++ /* Rule #5: If one of the classes is X87 or X87UP class, MEMORY is used. */ ++ if (class1 == X86_64_X87_CLASS || class1 == X86_64_X87UP_CLASS ++ || class2 == X86_64_X87_CLASS || class2 == X86_64_X87UP_CLASS) ++ return X86_64_MEMORY_CLASS; ++ ++ /* Rule #6: Otherwise class SSE is used. */ ++ return X86_64_SSE_CLASS; ++} ++ ++/* Classify the argument of type TYPE and mode MODE. ++ CLASSES will be filled by the register class used to pass each word ++ of the operand. The number of words is returned. In case the parameter ++ should be passed in memory, 0 is returned. As a special case for zero ++ sized containers, classes[0] will be NO_CLASS and 1 is returned. ++ ++ See the x86-64 PS ABI for details. ++*/ ++static int ++classify_argument (ffi_type *type, enum x86_64_reg_class classes[], ++ int *byte_offset) ++{ ++ /* First, align to the right place. */ ++ *byte_offset = ALIGN(*byte_offset, type->alignment); ++ ++ switch (type->type) ++ { ++ case FFI_TYPE_UINT8: ++ case FFI_TYPE_SINT8: ++ case FFI_TYPE_UINT16: ++ case FFI_TYPE_SINT16: ++ case FFI_TYPE_UINT32: ++ case FFI_TYPE_SINT32: ++ case FFI_TYPE_UINT64: ++ case FFI_TYPE_SINT64: ++ case FFI_TYPE_POINTER: ++ if (((*byte_offset) % 8 + type->size) <= 4) ++ classes[0] = X86_64_INTEGERSI_CLASS; ++ else ++ classes[0] = X86_64_INTEGER_CLASS; ++ return 1; ++ case FFI_TYPE_FLOAT: ++ if (((*byte_offset) % 8) == 0) ++ classes[0] = X86_64_SSESF_CLASS; ++ else ++ classes[0] = X86_64_SSE_CLASS; ++ return 1; ++ case FFI_TYPE_DOUBLE: ++ classes[0] = X86_64_SSEDF_CLASS; ++ return 1; ++ case FFI_TYPE_LONGDOUBLE: ++ classes[0] = X86_64_X87_CLASS; ++ classes[1] = X86_64_X87UP_CLASS; ++ return 2; ++ case FFI_TYPE_STRUCT: ++ { ++ const int UNITS_PER_WORD = 8; ++ int words = (type->size + UNITS_PER_WORD - 1) / UNITS_PER_WORD; ++ ffi_type **ptr; ++ int i; ++ enum x86_64_reg_class subclasses[MAX_CLASSES]; ++ ++ /* If the struct is larger than 16 bytes, pass it on the stack. */ ++ if (type->size > 16) ++ return 0; ++ ++ for (i = 0; i < words; i++) ++ classes[i] = X86_64_NO_CLASS; ++ ++ /* Merge the fields of structure. */ ++ for (ptr=type->elements; (*ptr)!=NULL; ptr++) ++ { ++ int num; ++ ++ num = classify_argument (*ptr, subclasses, byte_offset); ++ if (num == 0) ++ return 0; ++ for (i = 0; i < num; i++) ++ { ++ int pos = *byte_offset / 8; ++ classes[i + pos] = ++ merge_classes (subclasses[i], classes[i + pos]); ++ } ++ ++ if ((*ptr)->type != FFI_TYPE_STRUCT) ++ *byte_offset += (*ptr)->size; ++ } ++ ++ /* Final merger cleanup. */ ++ for (i = 0; i < words; i++) ++ { ++ /* If one class is MEMORY, everything should be passed in ++ memory. */ ++ if (classes[i] == X86_64_MEMORY_CLASS) ++ return 0; ++ ++ /* The X86_64_SSEUP_CLASS should be always preceded by ++ X86_64_SSE_CLASS. */ ++ if (classes[i] == X86_64_SSEUP_CLASS ++ && (i == 0 || classes[i - 1] != X86_64_SSE_CLASS)) ++ classes[i] = X86_64_SSE_CLASS; ++ ++ /* X86_64_X87UP_CLASS should be preceded by X86_64_X87_CLASS. */ ++ if (classes[i] == X86_64_X87UP_CLASS ++ && (i == 0 || classes[i - 1] != X86_64_X87_CLASS)) ++ classes[i] = X86_64_SSE_CLASS; ++ } ++ return words; ++ } ++ ++ default: ++ FFI_ASSERT(0); ++ } ++ return 0; /* Never reached. */ ++} ++ ++/* Examine the argument and return set number of register required in each ++ class. Return 0 iff parameter should be passed in memory. */ ++static int ++examine_argument (ffi_type *type, int in_return, int *int_nregs,int *sse_nregs) ++{ ++ enum x86_64_reg_class class[MAX_CLASSES]; ++ int offset = 0; ++ int n; ++ ++ n = classify_argument (type, class, &offset); ++ ++ if (n == 0) ++ return 0; ++ ++ *int_nregs = 0; ++ *sse_nregs = 0; ++ for (n--; n>=0; n--) ++ switch (class[n]) ++ { ++ case X86_64_INTEGER_CLASS: ++ case X86_64_INTEGERSI_CLASS: ++ (*int_nregs)++; ++ break; ++ case X86_64_SSE_CLASS: ++ case X86_64_SSESF_CLASS: ++ case X86_64_SSEDF_CLASS: ++ (*sse_nregs)++; ++ break; ++ case X86_64_NO_CLASS: ++ case X86_64_SSEUP_CLASS: ++ break; ++ case X86_64_X87_CLASS: ++ case X86_64_X87UP_CLASS: ++ if (!in_return) ++ return 0; ++ break; ++ default: ++ abort (); ++ } ++ return 1; ++} ++ ++/* Functions to load floats and double to an SSE register placeholder. */ ++extern void float2sse (float, __int128_t *); ++extern void double2sse (double, __int128_t *); ++extern void floatfloat2sse (void *, __int128_t *); ++ ++/* Functions to put the floats and doubles back. */ ++extern float sse2float (__int128_t *); ++extern double sse2double (__int128_t *); ++extern void sse2floatfloat(__int128_t *, void *); ++ ++/*@-exportheader@*/ ++void ++ffi_prep_args (stackLayout *stack, extended_cif *ecif) ++/*@=exportheader@*/ ++{ ++ int gprcount, ssecount, i, g, s; ++ void **p_argv; ++ void *argp = &stack->argspace; ++ ffi_type **p_arg; ++ ++ /* First check if the return value should be passed in memory. If so, ++ pass the pointer as the first argument. */ ++ gprcount = ssecount = 0; ++ if (ecif->cif->rtype->type != FFI_TYPE_VOID ++ && examine_argument (ecif->cif->rtype, 1, &g, &s) == 0) ++ (void *)stack->gpr[gprcount++] = ecif->rvalue; ++ ++ for (i=ecif->cif->nargs, p_arg=ecif->cif->arg_types, p_argv = ecif->avalue; ++ i!=0; i--, p_arg++, p_argv++) ++ { ++ int in_register = 0; ++ ++ switch ((*p_arg)->type) ++ { ++ case FFI_TYPE_SINT8: ++ case FFI_TYPE_SINT16: ++ case FFI_TYPE_SINT32: ++ case FFI_TYPE_SINT64: ++ case FFI_TYPE_UINT8: ++ case FFI_TYPE_UINT16: ++ case FFI_TYPE_UINT32: ++ case FFI_TYPE_UINT64: ++ case FFI_TYPE_POINTER: ++ if (gprcount < MAX_GPR_REGS) ++ { ++ stack->gpr[gprcount] = 0; ++ stack->gpr[gprcount++] = *(long long *)(*p_argv); ++ in_register = 1; ++ } ++ break; ++ ++ case FFI_TYPE_FLOAT: ++ if (ssecount < MAX_SSE_REGS) ++ { ++ float2sse (*(float *)(*p_argv), &stack->sse[ssecount++]); ++ in_register = 1; ++ } ++ break; ++ ++ case FFI_TYPE_DOUBLE: ++ if (ssecount < MAX_SSE_REGS) ++ { ++ double2sse (*(double *)(*p_argv), &stack->sse[ssecount++]); ++ in_register = 1; ++ } ++ break; ++ } ++ ++ if (in_register) ++ continue; ++ ++ /* Either all places in registers where filled, or this is a ++ type that potentially goes into a memory slot. */ ++ if (examine_argument (*p_arg, 0, &g, &s) == 0 ++ || gprcount + g > MAX_GPR_REGS || ssecount + s > MAX_SSE_REGS) ++ { ++ /* Pass this argument in memory. */ ++ argp = (void *)ALIGN(argp, (*p_arg)->alignment); ++ memcpy (argp, *p_argv, (*p_arg)->size); ++ argp += (*p_arg)->size; ++ } ++ else ++ { ++ /* All easy cases are eliminated. Now fire the big guns. */ ++ ++ enum x86_64_reg_class classes[MAX_CLASSES]; ++ int offset = 0, j, num; ++ void *a; ++ ++ num = classify_argument (*p_arg, classes, &offset); ++ for (j=0, a=*p_argv; j<num; j++, a+=8) ++ { ++ switch (classes[j]) ++ { ++ case X86_64_INTEGER_CLASS: ++ case X86_64_INTEGERSI_CLASS: ++ stack->gpr[gprcount++] = *(long long *)a; ++ break; ++ case X86_64_SSE_CLASS: ++ floatfloat2sse (a, &stack->sse[ssecount++]); ++ break; ++ case X86_64_SSESF_CLASS: ++ float2sse (*(float *)a, &stack->sse[ssecount++]); ++ break; ++ case X86_64_SSEDF_CLASS: ++ double2sse (*(double *)a, &stack->sse[ssecount++]); ++ break; ++ default: ++ abort(); ++ } ++ } ++ } ++ } ++} ++ ++/* Perform machine dependent cif processing. */ ++ffi_status ++ffi_prep_cif_machdep (ffi_cif *cif) ++{ ++ int gprcount, ssecount, i, g, s; ++ ++ gprcount = ssecount = 0; ++ ++ /* Reset the byte count. We handle this size estimation here. */ ++ cif->bytes = 0; ++ ++ /* If the return value should be passed in memory, pass the pointer ++ as the first argument. The actual memory isn't allocated here. */ ++ if (cif->rtype->type != FFI_TYPE_VOID ++ && examine_argument (cif->rtype, 1, &g, &s) == 0) ++ gprcount = 1; ++ ++ /* Go over all arguments and determine the way they should be passed. ++ If it's in a register and there is space for it, let that be so. If ++ not, add it's size to the stack byte count. */ ++ for (i=0; i<cif->nargs; i++) ++ { ++ if (examine_argument (cif->arg_types[i], 0, &g, &s) == 0 ++ || gprcount + g > MAX_GPR_REGS || ssecount + s > MAX_SSE_REGS) ++ { ++ /* This is passed in memory. First align to the basic type. */ ++ cif->bytes = ALIGN(cif->bytes, cif->arg_types[i]->alignment); ++ ++ /* Stack arguments are *always* at least 8 byte aligned. */ ++ cif->bytes = ALIGN(cif->bytes, 8); ++ ++ /* Now add the size of this argument. */ ++ cif->bytes += cif->arg_types[i]->size; ++ } ++ else ++ { ++ gprcount += g; ++ ssecount += s; ++ } ++ } ++ ++ /* Set the flag for the closures return. */ ++ switch (cif->rtype->type) ++ { ++ case FFI_TYPE_VOID: ++ case FFI_TYPE_STRUCT: ++ case FFI_TYPE_SINT64: ++ case FFI_TYPE_FLOAT: ++ case FFI_TYPE_DOUBLE: ++ case FFI_TYPE_LONGDOUBLE: ++ cif->flags = (unsigned) cif->rtype->type; ++ break; ++ ++ case FFI_TYPE_UINT64: ++ cif->flags = FFI_TYPE_SINT64; ++ break; ++ ++ default: ++ cif->flags = FFI_TYPE_INT; ++ break; ++ } ++ ++ return FFI_OK; ++} ++ ++typedef struct ++{ ++ long gpr[2]; ++ __int128_t sse[2]; ++ long double st0; ++} return_value; ++ ++void ++ffi_fill_return_value (return_value *rv, extended_cif *ecif) ++{ ++ enum x86_64_reg_class classes[MAX_CLASSES]; ++ int i = 0, num; ++ long *gpr = rv->gpr; ++ __int128_t *sse = rv->sse; ++ signed char sc; ++ signed short ss; ++ ++ /* This is needed because of the way x86-64 handles signed short ++ integers. */ ++ switch (ecif->cif->rtype->type) ++ { ++ case FFI_TYPE_SINT8: ++ sc = *(signed char *)gpr; ++ *(long long *)ecif->rvalue = (long long)sc; ++ return; ++ case FFI_TYPE_SINT16: ++ ss = *(signed short *)gpr; ++ *(long long *)ecif->rvalue = (long long)ss; ++ return; ++ default: ++ /* Just continue. */ ++ ; ++ } ++ ++ num = classify_argument (ecif->cif->rtype, classes, &i); ++ ++ if (num == 0) ++ /* Return in memory. */ ++ ecif->rvalue = (void *) rv->gpr[0]; ++ else if (num == 2 && classes[0] == X86_64_X87_CLASS && ++ classes[1] == X86_64_X87UP_CLASS) ++ /* This is a long double (this is easiest to handle this way instead ++ of an eightbyte at a time as in the loop below. */ ++ *((long double *)ecif->rvalue) = rv->st0; ++ else ++ { ++ void *a; ++ ++ for (i=0, a=ecif->rvalue; i<num; i++, a+=8) ++ { ++ switch (classes[i]) ++ { ++ case X86_64_INTEGER_CLASS: ++ case X86_64_INTEGERSI_CLASS: ++ *(long long *)a = *gpr; ++ gpr++; ++ break; ++ case X86_64_SSE_CLASS: ++ sse2floatfloat (sse++, a); ++ break; ++ case X86_64_SSESF_CLASS: ++ *(float *)a = sse2float (sse++); ++ break; ++ case X86_64_SSEDF_CLASS: ++ *(double *)a = sse2double (sse++); ++ break; ++ default: ++ abort(); ++ } ++ } ++ } ++} ++ ++/*@-declundef@*/ ++/*@-exportheader@*/ ++extern void ffi_call_UNIX64(void (*)(stackLayout *, extended_cif *), ++ void (*) (return_value *, extended_cif *), ++ /*@out@*/ extended_cif *, ++ unsigned, /*@out@*/ unsigned *, void (*fn)()); ++/*@=declundef@*/ ++/*@=exportheader@*/ ++ ++void ffi_call(/*@dependent@*/ ffi_cif *cif, ++ void (*fn)(), ++ /*@out@*/ void *rvalue, ++ /*@dependent@*/ void **avalue) ++{ ++ extended_cif ecif; ++ int dummy; ++ ++ ecif.cif = cif; ++ ecif.avalue = avalue; ++ ++ /* If the return value is a struct and we don't have a return */ ++ /* value address then we need to make one */ ++ ++ if ((rvalue == NULL) && ++ (examine_argument (cif->rtype, 1, &dummy, &dummy) == 0)) ++ { ++ /*@-sysunrecog@*/ ++ ecif.rvalue = alloca(cif->rtype->size); ++ /*@=sysunrecog@*/ ++ } ++ else ++ ecif.rvalue = rvalue; ++ ++ /* Stack must always be 16byte aligned. Make it so. */ ++ cif->bytes = ALIGN(cif->bytes, 16); ++ ++ switch (cif->abi) ++ { ++ case FFI_SYSV: ++ /* Calling 32bit code from 64bit is not possible */ ++ FFI_ASSERT(0); ++ break; ++ ++ case FFI_UNIX64: ++ /*@-usedef@*/ ++ ffi_call_UNIX64 (ffi_prep_args, ffi_fill_return_value, &ecif, ++ cif->bytes, ecif.rvalue, fn); ++ /*@=usedef@*/ ++ break; ++ ++ default: ++ FFI_ASSERT(0); ++ break; ++ } ++} ++ ++extern void ffi_closure_UNIX64(void); ++ ++ffi_status ++ffi_prep_closure (ffi_closure* closure, ++ ffi_cif* cif, ++ void (*fun)(ffi_cif*, void*, void**, void*), ++ void *user_data) ++{ ++ volatile unsigned short *tramp; ++ ++ /* FFI_ASSERT (cif->abi == FFI_OSF); */ ++ ++ tramp = (volatile unsigned short *) &closure->tramp[0]; ++ tramp[0] = 0xbb49; /* mov <code>, %r11 */ ++ tramp[5] = 0xba49; /* mov <data>, %r10 */ ++ tramp[10] = 0xff49; /* jmp *%r11 */ ++ tramp[11] = 0x00e3; ++ *(void * volatile *) &tramp[1] = ffi_closure_UNIX64; ++ *(void * volatile *) &tramp[6] = closure; ++ ++ closure->cif = cif; ++ closure->fun = fun; ++ closure->user_data = user_data; ++ ++ return FFI_OK; ++} ++ ++int ++ffi_closure_UNIX64_inner(ffi_closure *closure, va_list l, void *rp) ++{ ++ ffi_cif *cif; ++ void **avalue; ++ ffi_type **arg_types; ++ long i, avn, argn; ++ ++ cif = closure->cif; ++ avalue = alloca(cif->nargs * sizeof(void *)); ++ ++ argn = 0; ++ ++ i = 0; ++ avn = cif->nargs; ++ arg_types = cif->arg_types; ++ ++ /* Grab the addresses of the arguments from the stack frame. */ ++ while (i < avn) ++ { ++ switch (arg_types[i]->type) ++ { ++ case FFI_TYPE_SINT8: ++ case FFI_TYPE_UINT8: ++ case FFI_TYPE_SINT16: ++ case FFI_TYPE_UINT16: ++ case FFI_TYPE_SINT32: ++ case FFI_TYPE_UINT32: ++ case FFI_TYPE_SINT64: ++ case FFI_TYPE_UINT64: ++ case FFI_TYPE_POINTER: ++ { ++ if (l->gp_offset > 48-8) ++ { ++ avalue[i] = l->overflow_arg_area; ++ l->overflow_arg_area = (char *)l->overflow_arg_area + 8; ++ } ++ else ++ { ++ avalue[i] = (char *)l->reg_save_area + l->gp_offset; ++ l->gp_offset += 8; ++ } ++ } ++ break; ++ ++ case FFI_TYPE_STRUCT: ++ /* FIXME */ ++ FFI_ASSERT(0); ++ break; ++ ++ case FFI_TYPE_DOUBLE: ++ { ++ if (l->fp_offset > 176-16) ++ { ++ avalue[i] = l->overflow_arg_area; ++ l->overflow_arg_area = (char *)l->overflow_arg_area + 8; ++ } ++ else ++ { ++ avalue[i] = (char *)l->reg_save_area + l->fp_offset; ++ l->fp_offset += 16; ++ } ++ } ++#if DEBUG_FFI ++ fprintf (stderr, "double arg %d = %g\n", i, *(double *)avalue[i]); ++#endif ++ break; ++ ++ case FFI_TYPE_FLOAT: ++ { ++ if (l->fp_offset > 176-16) ++ { ++ avalue[i] = l->overflow_arg_area; ++ l->overflow_arg_area = (char *)l->overflow_arg_area + 8; ++ } ++ else ++ { ++ avalue[i] = (char *)l->reg_save_area + l->fp_offset; ++ l->fp_offset += 16; ++ } ++ } ++#if DEBUG_FFI ++ fprintf (stderr, "float arg %d = %g\n", i, *(float *)avalue[i]); ++#endif ++ break; ++ ++ default: ++ FFI_ASSERT(0); ++ } ++ ++ argn += ALIGN(arg_types[i]->size, SIZEOF_ARG) / SIZEOF_ARG; ++ i++; ++ } ++ ++ /* Invoke the closure. */ ++ (closure->fun) (cif, rp, avalue, closure->user_data); ++ ++ /* FIXME: Structs not supported. */ ++ FFI_ASSERT(cif->rtype->type != FFI_TYPE_STRUCT); ++ ++ /* Tell ffi_closure_UNIX64 how to perform return type promotions. */ ++ ++ return cif->rtype->type; ++} ++#endif /* ifndef __x86_64__ */ +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/x86/sysv.S gcc/libffi/src/x86/sysv.S +--- gcc-3.2.2.orig/libffi/src/x86/sysv.S Tue Jul 17 02:10:53 2001 ++++ gcc/libffi/src/x86/sysv.S Fri Jul 19 08:08:31 2002 +@@ -1,5 +1,5 @@ + /* ----------------------------------------------------------------------- +- sysv.S - Copyright (c) 1996, 1998, 2001 Cygnus Solutions ++ sysv.S - Copyright (c) 1996, 1998, 2001, 2002 Cygnus Solutions + + X86 Foreign Function Interface + +@@ -23,6 +23,8 @@ + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + ++#ifndef __x86_64__ ++ + #define LIBFFI_ASM + #include <ffi.h> + +@@ -163,3 +165,5 @@ + .align 4 + .LEFDE1: + .set .LLFDE1,.LEFDE1-.LSFDE1 ++ ++#endif /* ifndef __x86_64__ */ +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/x86/unix64.S gcc/libffi/src/x86/unix64.S +--- gcc-3.2.2.orig/libffi/src/x86/unix64.S Thu Jan 1 09:00:00 1970 ++++ gcc/libffi/src/x86/unix64.S Wed Jan 29 00:54:28 2003 +@@ -0,0 +1,302 @@ ++/* ----------------------------------------------------------------------- ++ unix64.S - Copyright (c) 2002 Bo Thorsen <bo@suse.de> ++ ++ x86-64 Foreign Function Interface ++ ++ Permission is hereby granted, free of charge, to any person obtaining ++ a copy of this software and associated documentation files (the ++ ``Software''), to deal in the Software without restriction, including ++ without limitation the rights to use, copy, modify, merge, publish, ++ distribute, sublicense, and/or sell copies of the Software, and to ++ permit persons to whom the Software is furnished to do so, subject to ++ the following conditions: ++ ++ The above copyright notice and this permission notice shall be included ++ in all copies or substantial portions of the Software. ++ ++ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS ++ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ++ IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR ++ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ++ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ++ OTHER DEALINGS IN THE SOFTWARE. ++ ----------------------------------------------------------------------- */ ++ ++#ifdef __x86_64__ ++#define LIBFFI_ASM ++#include <ffi.h> ++ ++ .section .rodata ++.LC0: ++ .string "asm in progress %lld\n" ++.LC1: ++ .string "asm in progress\n" ++.text ++ .align 2 ++.globl ffi_call_UNIX64 ++ .type ffi_call_UNIX64,@function ++ ++ffi_call_UNIX64: ++.LFB1: ++ pushq %rbp ++.LCFI0: ++ movq %rsp, %rbp ++.LCFI1: ++ /* Save all arguments */ ++ subq $48, %rsp ++.LCFI2: ++ movq %rdi, -8(%rbp) /* ffi_prep_args */ ++ movq %rsi, -16(%rbp) /* ffi_fill_return_value */ ++ movq %rdx, -24(%rbp) /* ecif */ ++ movq %rcx, -32(%rbp) /* cif->bytes */ ++ movq %r8, -40(%rbp) /* ecif.rvalue */ ++ movq %r9, -48(%rbp) /* fn */ ++ ++ /* Make room for all of the new args and the register args */ ++ addl $176, %ecx ++.LCFI3: ++ subq %rcx, %rsp ++.LCFI4: ++ /* Setup the call to ffi_prep_args. */ ++ movq %rdi, %rax /* &ffi_prep_args */ ++ movq %rsp, %rdi /* stackLayout */ ++ movq %rdx, %rsi /* ecif */ ++ call *%rax /* ffi_prep_args(stackLayout, ecif);*/ ++ ++ /* ffi_prep_args have put all the register contents into the */ ++ /* stackLayout struct. Now put the register values in place. */ ++ movq (%rsp), %rdi ++ movq 8(%rsp), %rsi ++ movq 16(%rsp), %rdx ++ movq 24(%rsp), %rcx ++ movq 32(%rsp), %r8 ++ movq 40(%rsp), %r9 ++ movaps 48(%rsp), %xmm0 ++ movaps 64(%rsp), %xmm1 ++ movaps 80(%rsp), %xmm2 ++ movaps 96(%rsp), %xmm3 ++ movaps 112(%rsp), %xmm4 ++ movaps 128(%rsp), %xmm5 ++ movaps 144(%rsp), %xmm6 ++ movaps 160(%rsp), %xmm7 ++ ++ /* Remove space for stackLayout so stack arguments are placed ++ correctly for the call. */ ++.LCFI5: ++ addq $176, %rsp ++.LCFI6: ++ /* Call the user function. */ ++ call *-48(%rbp) ++ ++ /* Make stack space for the return_value struct. */ ++ subq $64, %rsp ++ ++ /* Fill in all potential return values to this struct. */ ++ movq %rax, (%rsp) ++ movq %rdx, 8(%rsp) ++ movaps %xmm0, 16(%rsp) ++ movaps %xmm1, 32(%rsp) ++ fstpt 48(%rsp) ++ ++ /* Now call ffi_fill_return_value. */ ++ movq %rsp, %rdi /* struct return_value */ ++ movq -24(%rbp), %rsi /* ecif */ ++ movq -16(%rbp), %rax /* &ffi_fill_return_value */ ++ call *%rax /* call it */ ++ ++ /* And the work is done. */ ++ leave ++ ret ++.LFE1: ++.ffi_call_UNIX64_end: ++ .size ffi_call_UNIX64,.ffi_call_UNIX64_end-ffi_call_UNIX64 ++ ++.text ++ .align 2 ++.globl float2sse ++ .type float2sse,@function ++float2sse: ++ /* Save the contents of this sse-float in a pointer. */ ++ movaps %xmm0, (%rdi) ++ ret ++ ++ .align 2 ++.globl floatfloat2sse ++ .type floatfloat2sse,@function ++floatfloat2sse: ++ /* Save the contents of these two sse-floats in a pointer. */ ++ movq (%rdi), %xmm0 ++ movaps %xmm0, (%rsi) ++ ret ++ ++ .align 2 ++.globl double2sse ++ .type double2sse,@function ++double2sse: ++ /* Save the contents of this sse-double in a pointer. */ ++ movaps %xmm0, (%rdi) ++ ret ++ ++ .align 2 ++.globl sse2float ++ .type sse2float,@function ++sse2float: ++ /* Save the contents of this sse-float in a pointer. */ ++ movaps (%rdi), %xmm0 ++ ret ++ ++ .align 2 ++.globl sse2double ++ .type sse2double,@function ++sse2double: ++ /* Save the contents of this pointer in a sse-double. */ ++ movaps (%rdi), %xmm0 ++ ret ++ ++ .align 2 ++.globl sse2floatfloat ++ .type sse2floatfloat,@function ++sse2floatfloat: ++ /* Save the contents of this pointer in two sse-floats. */ ++ movaps (%rdi), %xmm0 ++ movq %xmm0, (%rsi) ++ ret ++ ++ .align 2 ++.globl ffi_closure_UNIX64 ++ .type ffi_closure_UNIX64,@function ++ ++ffi_closure_UNIX64: ++.LFB2: ++ pushq %rbp ++.LCFI10: ++ movq %rsp, %rbp ++.LCFI11: ++ subq $240, %rsp ++.LCFI12: ++ movq %rdi, -176(%rbp) ++ movq %rsi, -168(%rbp) ++ movq %rdx, -160(%rbp) ++ movq %rcx, -152(%rbp) ++ movq %r8, -144(%rbp) ++ movq %r9, -136(%rbp) ++ /* FIXME: We can avoid all this stashing of XMM registers by ++ (in ffi_prep_closure) computing the number of ++ floating-point args and moving it into %rax before calling ++ this function. Once this is done, uncomment the next few ++ lines and only the essential XMM registers will be written ++ to memory. This is a significant saving. */ ++/* movzbl %al, %eax */ ++/* movq %rax, %rdx */ ++/* leaq 0(,%rdx,4), %rax */ ++/* leaq 2f(%rip), %rdx */ ++/* subq %rax, %rdx */ ++ leaq -1(%rbp), %rax ++/* jmp *%rdx */ ++ movaps %xmm7, -15(%rax) ++ movaps %xmm6, -31(%rax) ++ movaps %xmm5, -47(%rax) ++ movaps %xmm4, -63(%rax) ++ movaps %xmm3, -79(%rax) ++ movaps %xmm2, -95(%rax) ++ movaps %xmm1, -111(%rax) ++ movaps %xmm0, -127(%rax) ++2: ++ movl %edi, -180(%rbp) ++ movl $0, -224(%rbp) ++ movl $48, -220(%rbp) ++ leaq 16(%rbp), %rax ++ movq %rax, -216(%rbp) ++ leaq -176(%rbp), %rdx ++ movq %rdx, -208(%rbp) ++ leaq -224(%rbp), %rsi ++ movq %r10, %rdi ++ movq %rsp, %rdx ++ call ffi_closure_UNIX64_inner@PLT ++ ++ cmpl $FFI_TYPE_FLOAT, %eax ++ je 1f ++ cmpl $FFI_TYPE_DOUBLE, %eax ++ je 2f ++ cmpl $FFI_TYPE_LONGDOUBLE, %eax ++ je 3f ++ cmpl $FFI_TYPE_STRUCT, %eax ++ je 4f ++ popq %rax ++ leave ++ ret ++1: ++2: ++3: ++ movaps -240(%rbp), %xmm0 ++ leave ++ ret ++4: ++ leave ++ ret ++.LFE2: ++ ++ .section .eh_frame,"a",@progbits ++.Lframe0: ++ .long .LECIE1-.LSCIE1 ++.LSCIE1: ++ .long 0x0 ++ .byte 0x1 ++ .string "zR" ++ .uleb128 0x1 ++ .sleb128 -8 ++ .byte 0x10 ++ .uleb128 0x1 ++ .byte 0x1b ++ .byte 0xc ++ .uleb128 0x7 ++ .uleb128 0x8 ++ .byte 0x90 ++ .uleb128 0x1 ++ .align 8 ++.LECIE1: ++.LSFDE1: ++ .long .LEFDE1-.LASFDE1 ++.LASFDE1: ++ .long .LASFDE1-.Lframe0 ++ ++ .long .LFB1-. ++ .long .LFE1-.LFB1 ++ .uleb128 0x0 ++ .byte 0x4 # DW_CFA_advance_loc4 ++ .long .LCFI0-.LFB1 ++ .byte 0xe # DW_CFA_def_cfa_offset ++ .uleb128 0x10 ++ .byte 0x86 # DW_CFA_offset: r6 at cfa-16 ++ .uleb128 0x2 ++ .byte 0x4 # DW_CFA_advance_loc4 ++ .long .LCFI1-.LCFI0 ++ .byte 0x86 # DW_CFA_offset: r6 at cfa-16 ++ .uleb128 0x2 ++ .byte 0xd # DW_CFA_def_cfa_reg: r6 ++ .uleb128 0x6 ++ .align 8 ++.LEFDE1: ++.LSFDE3: ++ .long .LEFDE3-.LASFDE3 # FDE Length ++.LASFDE3: ++ .long .LASFDE3-.Lframe0 # FDE CIE offset ++ ++ .long .LFB2-. # FDE initial location ++ .long .LFE2-.LFB2 # FDE address range ++ .uleb128 0x0 # Augmentation size ++ .byte 0x4 # DW_CFA_advance_loc4 ++ .long .LCFI10-.LFB2 ++ .byte 0xe # DW_CFA_def_cfa_offset ++ .uleb128 0x10 ++ .byte 0x86 # DW_CFA_offset, column 0x6 ++ .uleb128 0x2 ++ .byte 0x4 # DW_CFA_advance_loc4 ++ .long .LCFI11-.LCFI10 ++ .byte 0xd # DW_CFA_def_cfa_register ++ .uleb128 0x6 ++ .align 8 ++.LEFDE3: ++ ++#endif /* __x86_64__ */ +diff -ruN --exclude=CVS gcc-3.2.2.orig/libffi/src/x86/win32.S gcc/libffi/src/x86/win32.S +--- gcc-3.2.2.orig/libffi/src/x86/win32.S Tue Mar 27 11:39:16 2001 ++++ gcc/libffi/src/x86/win32.S Fri Dec 6 10:16:45 2002 +@@ -1,5 +1,8 @@ + /* ----------------------------------------------------------------------- +- win32.S - Copyright (c) 1996, 1998, 2001 Cygnus Solutions ++ win32.S - Copyright (c) 1996, 1998, 2001, 2002 Red Hat, Inc. ++ Copyright (c) 2001 John Beniton ++ Copyright (c) 2002 Ranjit Mathew ++ + + X86 Foreign Function Interface + +@@ -52,7 +55,10 @@ + # Return stack to previous state and call the function + addl $8,%esp + +- call *28(%ebp) ++ # FIXME: Align the stack to a 128-bit boundary to avoid ++ # potential performance hits. ++ ++ call *28(%ebp) + + # Remove the space we pushed for the args + movl 16(%ebp),%ecx +@@ -123,3 +129,98 @@ + ret + + .ffi_call_SYSV_end: ++ ++ # This assumes we are using gas. ++ .balign 16 ++.globl _ffi_call_STDCALL ++ ++_ffi_call_STDCALL: ++ pushl %ebp ++ movl %esp,%ebp ++ ++ # Make room for all of the new args. ++ movl 16(%ebp),%ecx ++ subl %ecx,%esp ++ ++ movl %esp,%eax ++ ++ # Place all of the ffi_prep_args in position ++ pushl 12(%ebp) ++ pushl %eax ++ call *8(%ebp) ++ ++ # Return stack to previous state and call the function ++ addl $8,%esp ++ ++ # FIXME: Align the stack to a 128-bit boundary to avoid ++ # potential performance hits. ++ ++ call *28(%ebp) ++ ++ # stdcall functions pop arguments off the stack themselves ++ ++ # Load %ecx with the return type code ++ movl 20(%ebp),%ecx ++ ++ # If the return value pointer is NULL, assume no return value. ++ cmpl $0,24(%ebp) ++ jne sc_retint ++ ++ # Even if there is no space for the return value, we are ++ # obliged to handle floating-point values. ++ cmpl $FFI_TYPE_FLOAT,%ecx ++ jne sc_noretval ++ fstp %st(0) ++ ++ jmp sc_epilogue ++ ++sc_retint: ++ cmpl $FFI_TYPE_INT,%ecx ++ jne sc_retfloat ++ # Load %ecx with the pointer to storage for the return value ++ movl 24(%ebp),%ecx ++ movl %eax,0(%ecx) ++ jmp sc_epilogue ++ ++sc_retfloat: ++ cmpl $FFI_TYPE_FLOAT,%ecx ++ jne sc_retdouble ++ # Load %ecx with the pointer to storage for the return value ++ movl 24(%ebp),%ecx ++ fstps (%ecx) ++ jmp sc_epilogue ++ ++sc_retdouble: ++ cmpl $FFI_TYPE_DOUBLE,%ecx ++ jne sc_retlongdouble ++ # Load %ecx with the pointer to storage for the return value ++ movl 24(%ebp),%ecx ++ fstpl (%ecx) ++ jmp sc_epilogue ++ ++sc_retlongdouble: ++ cmpl $FFI_TYPE_LONGDOUBLE,%ecx ++ jne sc_retint64 ++ # Load %ecx with the pointer to storage for the return value ++ movl 24(%ebp),%ecx ++ fstpt (%ecx) ++ jmp sc_epilogue ++ ++sc_retint64: ++ cmpl $FFI_TYPE_SINT64,%ecx ++ jne sc_retstruct ++ # Load %ecx with the pointer to storage for the return value ++ movl 24(%ebp),%ecx ++ movl %eax,0(%ecx) ++ movl %edx,4(%ecx) ++ ++sc_retstruct: ++ # Nothing to do! ++ ++sc_noretval: ++sc_epilogue: ++ movl %ebp,%esp ++ popl %ebp ++ ret ++ ++.ffi_call_STDCALL_end: +--- gcc-3.2.2.orig/libjava/configure.host Mon Jun 10 13:15:26 2002 ++++ gcc-3.2.2/libjava/configure.host Sat Feb 15 19:57:25 2003 +@@ -115,6 +115,12 @@ + enable_getenv_properties_default=no + enable_main_args_default=no + ;; ++ sh-* | sh[34]*-*) ++ sysdeps_dir=sh ++ libgcj_flags="${libgcj_flags} -mieee" ++ libgcj_interpreter=yes ++ enable_hash_synchronization_default=yes ++ ;; + esac + + # This case statement supports generic port properties and may refine +@@ -126,7 +132,8 @@ + powerpc*-linux* | \ + alpha*-linux* | \ + sparc*-linux* | \ +- ia64-*) ++ ia64-* | \ ++ sh-linux* | sh[34]*-linux*) + can_unwind_signal=yes + ;; + *-*-darwin*) diff --git a/patches/gcc/3.2.3/gcc-3.2.3-ppc-asm-spec.patch b/patches/gcc/3.2.3/gcc-3.2.3-ppc-asm-spec.patch new file mode 100644 index 00000000..e0ccd9f1 --- /dev/null +++ b/patches/gcc/3.2.3/gcc-3.2.3-ppc-asm-spec.patch @@ -0,0 +1,54 @@ +Based on gcc-3.4.0/gcc-3.3.3h-ppc-asm-spec.patch + +Fixes the following errors when building gcc for ppc7450: + +/tmp/ccYph3gd.s: Assembler messages: +/tmp/ccYph3gd.s:3823: Error: Unrecognized opcode: `mfvrsave' +/tmp/ccYph3gd.s:3857: Error: Unrecognized opcode: `stvx' +/tmp/ccYph3gd.s:4026: Error: Unrecognized opcode: `lvx' +/tmp/ccYph3gd.s:4027: Error: Unrecognized opcode: `mtvrsave' +make[2]: *** [libgcc/./unwind-dw2.o] Error 1 +make[2]: Leaving directory `/opt/crosstool-0.28-rc35/build/powerpc-7450-linux-gnu/gcc-3.2.3-glibc-2.3.2/build-gcc-core/gcc' +make[1]: *** [stmp-multilib] Error 2 +make[1]: Leaving directory `/opt/crosstool-0.28-rc35/build/powerpc-7450-linux-gnu/gcc-3.2.3-glibc-2.3.2/build-gcc-core/gcc' +make: *** [all-gcc] Error 2 + +Note that the "-mcpu=7450" option must appear on the "gcc" command line in +order for "-maltivec" to be passed to the assembler. Or, "-maltivec" itself +may be passed to the "gcc" command. + +Contributed by Tom Warzeka <waz@quahog.npt.nuwc.navy.mil> + +=================================================================== +--- gcc-3.2.3/gcc/config/rs6000/rs6000.h~ 2003-03-29 07:39:20.000000000 -0500 ++++ gcc-3.2.3/gcc/config/rs6000/rs6000.h 2004-08-23 16:33:21.000000000 -0400 +@@ -77,8 +77,8 @@ + %{mcpu=604e: -D_ARCH_PPC} \ + %{mcpu=620: -D_ARCH_PPC} \ + %{mcpu=740: -D_ARCH_PPC} \ +-%{mcpu=7400: -D_ARCH_PPC} \ +-%{mcpu=7450: -D_ARCH_PPC} \ ++%{mcpu=7400: -D_ARCH_PPC -D__ALTIVEC__} \ ++%{mcpu=7450: -D_ARCH_PPC -D__ALTIVEC__} \ + %{mcpu=750: -D_ARCH_PPC} \ + %{mcpu=801: -D_ARCH_PPC} \ + %{mcpu=821: -D_ARCH_PPC} \ +@@ -117,14 +117,15 @@ + %{mcpu=604e: -mppc} \ + %{mcpu=620: -mppc} \ + %{mcpu=740: -mppc} \ +-%{mcpu=7400: -mppc} \ +-%{mcpu=7450: -mppc} \ ++%{mcpu=7400: -mppc -maltivec} \ ++%{mcpu=7450: -mppc -maltivec} \ + %{mcpu=750: -mppc} \ + %{mcpu=801: -mppc} \ + %{mcpu=821: -mppc} \ + %{mcpu=823: -mppc} \ + %{mcpu=860: -mppc} \ +-%{maltivec: -maltivec}" ++%{maltivec: -maltivec} \ ++-many" + + #define CPP_DEFAULT_SPEC "" + diff --git a/patches/gcc/3.2.3/gcc-3.2.3-trap-posix.patch b/patches/gcc/3.2.3/gcc-3.2.3-trap-posix.patch new file mode 100644 index 00000000..4751e9da --- /dev/null +++ b/patches/gcc/3.2.3/gcc-3.2.3-trap-posix.patch @@ -0,0 +1,45 @@ +# +# Submitted-By: Marc Kleine-Budde <mkl@pengutronix.de>, 2005-04-20 +# +# Error: +# +# creating libintl.h +# Configuring etc... +# loading cache ../config.cache +# checking for a BSD compatible install... (cached) /usr/bin/install -c +# creating ./config.status +# creating Makefile +# trap: usage: trap [-lp] [[arg] signal_spec ...] +# +# Description: +# +# non-posix conform usage of trap causes bash >= 3.0 to fail +# +# e.g.: http://sourceware.org/ml/crossgcc/2004-12/msg00132.html +# +# Status: +# +# fixed in gcc >= 3.3.5 +# backport of gcc-3.3.5 fix +# +diff -ruN gcc-3.2.3-orig/configure gcc-3.2.3/configure +--- gcc-3.2.3-orig/configure 2002-06-24 18:14:28.000000000 +0200 ++++ gcc-3.2.3/configure 2005-04-20 18:42:49.000000000 +0200 +@@ -697,7 +697,7 @@ + if test -f skip-this-dir; then + # Perform the same cleanup as the trap handler, minus the "exit 1" of course, + # and reset the trap handler. +- trap 0 ++ trap '' 0 + rm -rf Makefile* ${tmpdir} + # Execute the final clean-up actions + ${config_shell} skip-this-dir +@@ -1615,7 +1615,7 @@ + # Perform the same cleanup as the trap handler, minus the "exit 1" of course, + # and reset the trap handler. + rm -rf ${tmpdir} +-trap 0 ++trap '' 0 + + exit 0 + diff --git a/patches/gcc/3.2.3/gcc-3.3-libstdc++-v3-dg.exp.patch b/patches/gcc/3.2.3/gcc-3.3-libstdc++-v3-dg.exp.patch new file mode 100644 index 00000000..aafc1306 --- /dev/null +++ b/patches/gcc/3.2.3/gcc-3.3-libstdc++-v3-dg.exp.patch @@ -0,0 +1,54 @@ +Without this patch, the command + +RUNTESTFLAGS=--target=powerpc-750-linux-gnu -v -v -v -v make check-target-libstdc++-v3 + +fails in two ways: +1. the -L option meant to locate the testsuite directory is incorrect, and +2. the wrong compiler is invoked, causing all sorts of havoc, not least of which +is the native compiler is invoked when we really wanted to invoke the cross-compiler +we just built. + +Here's an example log of the problem in action. Every testcase fails, this shows just one: +------------- +Invoking the compiler as g++ -ggdb3 -DDEBUG_ASSERT -I/home3/dank/wk/ixos/dap_interim/linux/3rdParty/crosstool/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/libstdc++-v3/testsuite /home3/dank/wk/ixos/dap_interim/linux/3rdParty/crosstool/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/libstdc++-v3/testsuite/20_util/binders.cc -g -O2 -DDEBUG_ASSERT -L/testsuite -lv3test -lm -o ./binders.exe +compiler exited with status 1 +output is: +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_function.h: In method `void binder2nd<mem_fun1_ref_t<void,Elem,int> >::operator ()(const Elem &) const':^M +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_algo.h:83: instantiated from `for_each<Elem *, binder2nd<mem_fun1_ref_t<void,Elem,int> > >(Elem *, Elem *, binder2nd<mem_fun1_ref_t<void,Elem,int> >)'^M +/home3/dank/wk/ixos/dap_interim/linux/3rdParty/crosstool/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/libstdc++-v3/testsuite/20_util/binders.cc:43: instantiated from here^M +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_function.h:224: conversion from `const Elem' to `Elem &' discards qualifiers^M +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_function.h:622: in passing argument 1 of `mem_fun1_ref_t<void,Elem,int>::operator ()(Elem &, int) const'^M +... +FAIL: 20_util/binders.cc (test for excess errors) +WARNING: 20_util/binders.cc compilation failed to produce executable +------------- + +And here's the patch. I'm not happy with it, and it probably gets some cases wrong, +but it seems to work for the common native case and for my cross-compiler case. + +--- gcc-3.3/libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp.old Sun Jul 13 10:42:01 2003 ++++ gcc-3.3/libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp Sun Jul 13 11:39:54 2003 +@@ -46,8 +46,23 @@ + global gluefile wrap_flags + global ld_library_path + global tool_root_dir ++ global target_triplet + + set blddir [lookfor_file [get_multilibs] libstdc++-v3] ++ if { $blddir == "" } { ++ set multilibs [get_multilibs] ++ # FIXME: assume multilib only one level deep ++ set multisub [file tail $multilibs] ++ verbose "libstdc++-v3-init: couldn't find libstdc++-v3 in $multilibs, trying $objdir" ++ set blddir [lookfor_file ${objdir} "$target_triplet/$multisub/libstdc++-v3"] ++ } ++ if { $blddir == "" } { ++ verbose "libstdc++-v3-init: couldn't find libstdc++-v3, trying $objdir without multilibs" ++ set blddir [lookfor_file ${objdir} "$target_triplet/libstdc++-v3"] ++ } ++ if { $blddir == "" } { ++ error "Can't find libstdc++-v3" ++ } + + # By default, we assume we want to run program images. + global dg-do-what-default diff --git a/patches/gcc/3.2.3/gcc-sh-linux.spec b/patches/gcc/3.2.3/gcc-sh-linux.spec new file mode 100644 index 00000000..d647bb27 --- /dev/null +++ b/patches/gcc/3.2.3/gcc-sh-linux.spec @@ -0,0 +1,739 @@ +Summary: The GNU Compiler Collection for SuperH. +%define GCC_VERSION 3.2.3 +%define arch_list sh3-linux sh3eb-linux sh4-linux sh4eb-linux +%define TARGET_LIBSTDC 1 +%define TARGET_JAVA 1 + +Name: gcc +Version: 3.2.3 +Release: 3 + +Copyright: GPL +Group: Development/Languages +Source0: gcc-%{GCC_VERSION}.tar.bz2 +Patch1: gcc-20030210-sh-linux-1.patch +Patch2: gcc-3.2.3-libffi-1.patch +Patch3: gcc-3.2.3-sh-linux-dwarf2-1.patch +Buildroot: /var/tmp/gcc-%{_target}-root +ExclusiveArch: i386 sh3 sh3eb sh4 sh4eb + +%description +This package contains the GNU Compiler Collection: gcc and g++. +You'll need this package in order to compile C/C++ code. + +%ifarch i386 + +# ==================== Cross Compiler =============================== + +%package sh-linux +Summary: The GNU Compiler Collection for sh-linux. +Group: Development/Languages +Requires: binutils-sh-linux >= 2.13.2 +Provides: gcc-sh-linux +Obsoletes: gcc-sh3-linux gcc-sh3eb-linux gcc-sh4-linux gcc-sh4eb-linux +Obsoletes: gcc-sh3-linux-c++ gcc-sh3eb-linux-c++ gcc-sh4-linux-c++ gcc-sh4eb-linux-c++ +Obsoletes: libstdc++-sh3-linux libstdc++-sh3eb-linux libstdc++-sh4-linux libstdc++-sh4eb-linux +AutoReqProv: no + +%description sh-linux +The gcc-sh-linux package contains GNU Compiler Collection: gcc g++ and libstdc++-v3. + +It includes support for most of the current C++ specification, including templates and +exception handling. It does also include the standard C++ library and C++ header files. +You'll need this package in order to cross compile C/C++ code for sh-linux. + +%package -n libgcj-sh-linux +Summary: Header files and libraries for sh-linux Java development. +Group: Development/Libraries +Requires: gcc-sh-linux = %{version}-%{release} +AutoReqProv: no + +%description -n libgcj-sh-linux +The Java static libraries and C header files. You will need this +package to compile your Java programs for sh-linux using the gcc Java compiler (gcj). + +%else +# =========================== Native Compiler ================================= +%package libgcc +Summary: runtime libraries for the GNU Compiler Collection. +Group: System Environment/Libraries + +%description libgcc +This package contains libgcc shared libraries for the GNU C Compiler Collection. +You'll need this package in order to execute C,C++,JAVA code +that uses shared libgcc. + +%package c++ +Summary: C++ support for gcc +Group: Development/Languages +Requires: gcc = %{version}-%{release} + +%description c++ +This package adds C++ support to the GNU Compiler Collection. It includes +support for most of the current C++ specification, including templates and +exception handling. It does include the static standard C++ +library and C++ header files; the library for dynamically linking +programs is available separately. + +%package -n libstdc++ +Summary: GNU c++ library. +Group: System Environment/Libraries + +%description -n libstdc++ +The libstdc++ package contains a snapshot of the GCC Standard C++ +Library v3, an ongoing project to implement the ISO 14882 Standard C++ +library. + +%package -n libstdc++-devel +Summary: Header files and libraries for C++ development +Group: Development/Libraries +Requires: libstdc++ = %{version}-%{release}, gcc-c++ = %{version}-%{release} + +%description -n libstdc++-devel +This is the GNU implementation of the standard C++ libraries. This +package includes the header files and libraries needed for C++ +development. This includes SGI's implementation of the STL. + +%package java +Summary: Java support for gcc +Group: Development/Languages +Requires: gcc = %{version}-%{release}, libgcj = %{version}-%{release}, libgcj-devel = %{version}-%{release} + +%description java +This package adds experimental support for compiling Java(tm) programs and +bytecode into native code. To use this you will also need the libgcj and +libgcj-devel packages. + +%package -n libgcj +Summary: Java runtime library for gcc. +Group: System Environment/Libraries + +%description -n libgcj +The Java runtime library. You will need this package to run your Java +programs compiled using the gcc Java compiler (gcj). + +%package -n libgcj-devel +Summary: Header files and libraries for Java development. +Group: Development/Libraries +Requires: libgcj = %{version}-%{release} + +%description -n libgcj-devel +The Java static libraries and C header files. You will need this +package to compile your Java programs using the gcc Java compiler (gcj). + +%endif + +%prep +%setup -q -n gcc-%{GCC_VERSION} +%patch1 -p1 +%patch2 -p1 +##%patch3 -p1 + +%build +%ifarch i386 +# build cross compiler for i386-linux host +for arch in sh-linux; do + rm -rf ${arch} + mkdir ${arch} + + CONFIG_ARGS="\ + --prefix=%{_prefix} \ + --mandir=%{_mandir} \ + --infodir=%{_infodir} \ + --target=${arch} \ + --host=%{_host} \ + --build=%{_build} \ + --enable-languages=c,c++,java \ + --with-system-zlib \ + --with-gxx-include-dir=%{_prefix}/${arch}/include/g++-v3 \ + --includedir=%{_prefix}/${arch}/include \ + --disable-checking \ + --disable-shared \ + --enable-__cxa_atexit \ + --enable-c99 \ + --enable-threads=posix \ + --enable-long-long" + if [ %{TARGET_JAVA} -ne 0 ]; then + CONFIG_ARGS="$CONFIG_ARGS --enable-libgcj" + fi + ( cd $arch + ../configure ${CONFIG_ARGS} + ) + if [ %{TARGET_LIBSTDC} -ne 0 -o %{TARGET_JAVA} -ne 0 ]; then + sed -e s:-Dinhibit_libc::g ${arch}/gcc/Makefile >${arch}/gcc/Makefile.$$$ + mv -f ${arch}/gcc/Makefile.$$$ ${arch}/gcc/Makefile + fi + make all-gcc -C ${arch} + + if [ %{TARGET_LIBSTDC} -ne 0 ]; then + CONFIG_ARGS="`echo $CONFIG_ARGS | sed -e s/--disable-shared/--enable-shared/`" + make TARGET_CONFIGARGS="${CONFIG_ARGS} --with-cross-host" all-target-libstdc++-v3 -C ${arch} + fi + + if [ %{TARGET_JAVA} -ne 0 ]; then + make all-fastjar -C ${arch} + CONFIG_ARGS="`echo $CONFIG_ARGS | sed -e s/--host=%{_host}/--host=${arch}/`" + dir=`pwd` + + ac_cv_file__proc_self_exe=yes \ + ac_cv_prog_GCJ="$dir/$arch/gcc/gcj -B$dir/$arch/$arch/libjava/ -B$dir/$arch/gcc/ -B%{_prefix}/$arch/bin/ -B%{_prefix}/$arch/lib/ -isystem %{_prefix}/$arch/include" \ + make TARGET_CONFIGARGS="${CONFIG_ARGS} --with-cross-host --enable-multilib --with-target-subdir=${arch} --with-x=no" \ + all-target-libjava -C ${arch} + fi + +%else +# Canadian cross (build native compiler) +for arch in %{_target}; do + rm -rf ${arch} + mkdir -p ${arch} + CONFIG_ARGS="\ + --prefix=%{_prefix} \ + --mandir=%{_mandir} \ + --infodir=%{_infodir} \ + --target=${arch} \ + --host=${arch} \ + --build=%{_build} \ + --enable-languages=c,c++,java \ + --with-system-zlib \ + --with-gxx-include-dir=%{_prefix}/include/g++-v3 \ + --disable-checking \ + --disable-shared \ + --enable-__cxa_atexit \ + --enable-c99 \ + --enable-threads=posix \ + --enable-long-long" + + if [ %{TARGET_JAVA} -ne 0 ]; then + CONFIG_ARGS="$CONFIG_ARGS --enable-libgcj" + fi + + ( cd ${arch} + CC=${arch}-gcc AR=${arch}-ar RANLIB=${arch}-ranlib CXX=${arch}-g++ \ + ../configure $CONFIG_ARGS + ) + + if [ %{TARGET_LIBSTDC} -ne 0 -o %{TARGET_JAVA} -ne 0 ]; then + sed -e s:-Dinhibit_libc::g ${arch}/gcc/Makefile >${arch}/gcc/Makefile.$$$ + mv -f ${arch}/gcc/Makefile.$$$ ${arch}/gcc/Makefile + fi + + make all-build-libiberty all-gcc -C ${arch} + + if [ %{TARGET_LIBSTDC} -ne 0 ]; then + CONFIG_ARGS="`echo $CONFIG_ARGS | sed -e s/--disable-shared/--enable-shared/`" + make TARGET_CONFIGARGS="${CONFIG_ARGS}" all-target-libstdc++-v3 -C ${arch} + if [ %{TARGET_JAVA} -ne 0 ]; then + ( mkdir -p ${arch}/fastjar; cd ${arch}/fastjar; rm *; ../../fastjar/configure --with-system-zlib; make ) + ac_cv_file__proc_self_exe=yes \ + CC=${arch}-gcc AR=${arch}-ar RANLIB=${arch}-ranlib CXX=${arch}-g++ GCJ=${arch}-gcj \ + make TARGET_CONFIGARGS="${CONFIG_ARGS} --with-x=no" configure-target-libjava -C ${arch} + + make -C ${arch}/${arch}/libffi + make -C ${arch}/${arch}/boehm-gc + make -C ${arch}/${arch}/zlib + make GCJ=${arch}-gcj GCJH=${arch}-gcjh ZIP=${arch}-jar -C ${arch}/${arch}/libjava + ( + rm -rf ${arch}/${arch}/fastjar + mkdir -p ${arch}/${arch}/fastjar + cd ${arch}/${arch}/fastjar + + ac_cv_sizeof_char=1 \ + ac_cv_sizeof_short=2 \ + ac_cv_sizeof_int=4 \ + ac_cv_sizeof_long=4 \ + ac_cv_sizeof_long_long=8 \ + ac_cv_sizeof_float=4 \ + ac_cv_sizeof_double=8 \ + ac_cv_sizeof_long_double=8 \ + ac_cv_sizeof_void_p=4 \ + ac_cv_file__proc_self_exe=yes \ + ac_cv_header_langinfo_h=yes \ + CC=${arch}-gcc ../../../fastjar/configure $CONFIG_ARGS + + make + ) + + fi + fi +%endif +done + +%install +rm -rf $RPM_BUILD_ROOT +mkdir -p ${RPM_BUILD_ROOT}/{%{_prefix}/bin,lib} + +%ifarch i386 + ARCH_STRTIP=strip + EXESUFFIX="" + arch=sh-linux + TOOLPREFIX=${arch}- + mkdir -p ${RPM_BUILD_ROOT}%{_prefix}/${arch}/{bin,include,lib,share} + mkdir -p ${RPM_BUILD_ROOT}%{_prefix}/${arch}/lib/{m4,mb/m4} + make DESTDIR=${RPM_BUILD_ROOT} \ + install-gcc \ + install-fastjar \ + -C ${arch} +%if 0 + ( cd ${RPM_BUILD_ROOT}%{_prefix}/sh-linux/lib + rm -f libgcc_s_*.so + mv libgcc_s_mb.so.1 mb/libgcc_s.so.1 + mv libgcc_s_m4.so.1 m4/libgcc_s.so.1 + mv libgcc_s_mb_m4.so.1 mb/m4/libgcc_s.so.1 + ln -s libgcc_s.so.1 mb/libgcc_s.so + ln -s libgcc_s.so.1 m4/libgcc_s.so + ln -s libgcc_s.so.1 mb/m4/libgcc_s.so + ) +%endif + + if [ %{TARGET_LIBSTDC} -ne 0 ]; then + make DESTDIR=${RPM_BUILD_ROOT} \ + install-target-libstdc++-v3 \ + -C ${arch} + fi + if [ %{TARGET_JAVA} -ne 0 ]; then + make DESTDIR=${RPM_BUILD_ROOT} \ + install-target-libjava \ + install-target-boehm-gc \ + install-target-zlib \ + -C ${arch} + make DESTDIR=${RPM_BUILD_ROOT} prefix=%{_prefix}/${arch} \ + install -C ${arch}/${arch}/libffi + mv -f $RPM_BUILD_ROOT%{_prefix}/share/java $RPM_BUILD_ROOT%{_prefix}/sh-linux/share/ + fi + rm -f $RPM_BUILD_ROOT%{_prefix}/bin/{gcov,gccbug} + rm -f $RPM_BUILD_ROOT%{_prefix}/${arch}/bin/{gij,jv-convert} + sed -e 's/@@VERSION@@/%{GCC_VERSION}/g' debian/shCPU-linux-GCC >$RPM_BUILD_ROOT%{_prefix}/bin/shCPU-linux-GCC + chmod 0755 $RPM_BUILD_ROOT%{_prefix}/bin/shCPU-linux-GCC + + LIBSTDC=`cd $RPM_BUILD_ROOT%{_prefix}/sh-linux/lib; echo libstdc++.so*` + LIBGCJ=`cd $RPM_BUILD_ROOT%{_prefix}/sh-linux/lib; echo libgcj.so*` + LIBFFI=`cd $RPM_BUILD_ROOT%{_prefix}/sh-linux/lib; echo libffi*.so*` + # literally (binary-ly) same + PROGS="cpp c++ g++ g77 gcc gcj" + DRIVERS="cc1 cc1obj cc1plus collect2 cpp0 f771 jc1 tradcpp0 jvgenmain" + OBJS="crtbegin.o crtbeginS.o crtend.o crtendS.o crtbeginT.o" + LIBS="libgcc.a libgcc_eh.a libobjc.a" + LIBS_1="$LIBSTDC \ + $LIBGCJ libgcj.spec \ + $LIBFFI " + LIBS_2="libstdc++.a libstdc++.la \ + libsupc++.a libsupc++.la \ + libgcj.a libgcj.la \ + libffi.a libffi.la" + INCLUDE="include" + + for CPU in sh3 sh3eb sh4 sh4eb; do + mkdir -p ${RPM_BUILD_ROOT}%{_prefix}/lib/gcc-lib/${CPU}-linux/%{GCC_VERSION} + mkdir -p ${RPM_BUILD_ROOT}%{_prefix}/${CPU}-linux/{lib,share/java} + # Make symbolic links for include dir. + ln -s ../sh-linux/include $RPM_BUILD_ROOT%{_prefix}/${CPU}-linux/include + + # Make symbolic links for libgcj.jar + ln -s ../../sh-linux/share/java/libgcj-%{GCC_VERSION}.jar $RPM_BUILD_ROOT%{_prefix}/${CPU}-linux/share/java/libgcj-%{GCC_VERSION}.jar + + # Make symbolic links for executables. + for p in ${PROGS}; do + ln -s shCPU-linux-GCC $RPM_BUILD_ROOT%{_prefix}/bin/${CPU}-linux-$p + done + ln -s sh-linux-gcjh $RPM_BUILD_ROOT%{_prefix}/bin/${CPU}-linux-gcjh + + case "${CPU}" in + sh3) + MULTILIBDIR= + MULTIPARENTDIR= + AS_ENDIAN_FLAG="-little" + CPP_ENDIAN_DEF="-D__LITTLE_ENDIAN__" + CPP_CPU_DEFS='-D__SH3__ -D__sh3__' + CC1_CPU_ENDIAN_FLAGS="-ml -m3" + CC1PLUS_CPU_ENDIAN_FLAGS="-ml -m3" + LINKER_CPU_ENDIAN_FLAGS="-m shlelf_linux -EL --architecture sh3" + LINKER_RPATH_LINK_FLAG="-rpath-link %{_prefix}/sh3-linux/lib" + ;; + sh3eb) + MULTILIBDIR=/mb + MULTIPARENTDIR=../ + AS_ENDIAN_FLAG="-big" + CPP_ENDIAN_DEF="-D__BIG_ENDIAN__" + CPP_CPU_DEFS='-D__SH3__ -D__sh3__' + CC1_CPU_ENDIAN_FLAGS="-mb -m3" + CC1PLUS_CPU_ENDIAN_FLAGS="-mb -m3" + LINKER_CPU_ENDIAN_FLAGS="-m shelf_linux -EB --architecture sh3" + LINKER_RPATH_LINK_FLAG="-rpath-link %{_prefix}/sh3eb-linux/lib" + ;; + sh4) + MULTILIBDIR=/m4 + MULTIPARENTDIR=../ + AS_ENDIAN_FLAG="-little" + CPP_ENDIAN_DEF="-D__LITTLE_ENDIAN__" + CPP_CPU_DEFS="-D__SH4__" + CC1_CPU_ENDIAN_FLAGS="-ml -m4" + CC1PLUS_CPU_ENDIAN_FLAGS="-ml -m4" + LINKER_CPU_ENDIAN_FLAGS="-m shlelf_linux -EL --architecture sh4" + LINKER_RPATH_LINK_FLAG="-rpath-link %{_prefix}/sh4-linux/lib" + ;; + sh4eb) + MULTILIBDIR=/mb/m4 + MULTIPARENTDIR=../../ + AS_ENDIAN_FLAG="-big" + CPP_ENDIAN_DEF="-D__BIG_ENDIAN__" + CPP_CPU_DEFS="-D__SH4__" + CC1_CPU_ENDIAN_FLAGS="-mb -m4" + CC1PLUS_CPU_ENDIAN_FLAGS="-mb -m4" + LINKER_CPU_ENDIAN_FLAGS="-m shelf_linux -EB --architecture sh4" + LINKER_RPATH_LINK_FLAG="-rpath-link %{_prefix}/sh4eb-linux/lib" + ;; + esac + + # Make symbolic links for GCC drivers, objects, libraries, and include dir. + for f in ${DRIVERS} ${INCLUDE}; do + if [ -a $RPM_BUILD_ROOT%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/$f ]; then + ln -s ../../sh-linux/%{GCC_VERSION}/$f $RPM_BUILD_ROOT%{_prefix}/lib/gcc-lib/${CPU}-linux/%{GCC_VERSION}/$f + fi + done + for f in ${OBJS} ${LIBS}; do + if [ -a $RPM_BUILD_ROOT%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}${MULTILIBDIR}/$f ]; then + ln -s ../../sh-linux/%{GCC_VERSION}${MULTILIBDIR}/$f $RPM_BUILD_ROOT%{_prefix}/lib/gcc-lib/${CPU}-linux/%{GCC_VERSION}/$f + fi + done + + for f in ${LIBS_1} ${LIBS_2}; do + if [ -e $RPM_BUILD_ROOT%{_prefix}/sh-linux/lib${MULTILIBDIR}/$f ]; then + mv -f $RPM_BUILD_ROOT%{_prefix}/sh-linux/lib${MULTILIBDIR}/$f $RPM_BUILD_ROOT%{_prefix}/${CPU}-linux/lib + ln -s ${MULTIPARENTDIR}../../${CPU}-linux/lib/$f $RPM_BUILD_ROOT%{_prefix}/sh-linux/lib${MULTILIBDIR}/$f + fi + done + + sed -e "s+@AS_ENDIAN_FLAG@+${AS_ENDIAN_FLAG}+" \ + -e "s+@CPP_ENDIAN_DEF@+${CPP_ENDIAN_DEF}+" \ + -e "s+@CPP_CPU_DEFS@+${CPP_CPU_DEFS}+" \ + -e "s+@CC1_CPU_ENDIAN_FLAGS@+${CC1_CPU_ENDIAN_FLAGS}+" \ + -e "s+@CC1PLUS_CPU_ENDIAN_FLAGS@+${CC1PLUS_CPU_ENDIAN_FLAGS}+" \ + -e "s+@LINKER_CPU_ENDIAN_FLAGS@+${LINKER_CPU_ENDIAN_FLAGS}+" \ + -e "s+@LINKER_RPATH_LINK_FLAG@+${LINKER_RPATH_LINK_FLAG}+" \ + debian/edit-specs.in >${arch}/edit-specs-${CPU}.sed + + sed -f ${arch}/edit-specs-${CPU}.sed \ + $RPM_BUILD_ROOT%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/specs \ + > $RPM_BUILD_ROOT%{_prefix}/lib/gcc-lib/${CPU}-linux/%{GCC_VERSION}/specs + + done + +%else + ARCH_STRTIP=%{_target}-strip + EXESUFFIX="" + TOOLPREFIX="" + ln -s ..%{_prefix}/bin/cpp ${RPM_BUILD_ROOT}/lib/cpp + ln -s gcc ${RPM_BUILD_ROOT}%{_prefix}/bin/cc + arch=%{_target} + make DESTDIR=${RPM_BUILD_ROOT} \ + install -C ${arch} + if [ %{TARGET_JAVA} -ne 0 ]; then + make DESTDIR=${RPM_BUILD_ROOT} install -C ${arch}/${arch}/libffi + make DESTDIR=${RPM_BUILD_ROOT} install -C ${arch}/${arch}/fastjar + mv -f ${RPM_BUILD_ROOT}/%{_prefix}/%{_lib}/libgcj.spec \ + ${RPM_BUILD_ROOT}/%{_prefix}/lib/gcc-lib/${arch}/%{GCC_VERSION}/ + fi + $ARCH_STRTIP $RPM_BUILD_ROOT%{_prefix}/bin/gcov$EXESUFFIX || : + +cat >${arch}/edit-specs <<EOF +/^*cross_compile:$/ { +n +c\\ +0 +} +EOF + sed -f ${arch}/edit-specs -e 's#-rpath-link.*/usr/%{_target}/lib##' \ + ${RPM_BUILD_ROOT}%{_prefix}/lib/gcc-lib/${arch}/%{GCC_VERSION}/specs \ + >${RPM_BUILD_ROOT}%{_prefix}/lib/gcc-lib/${arch}/%{GCC_VERSION}/specs.$$ + mv -f ${RPM_BUILD_ROOT}%{_prefix}/lib/gcc-lib/${arch}/%{GCC_VERSION}/specs.$$ \ + ${RPM_BUILD_ROOT}%{_prefix}/lib/gcc-lib/${arch}/%{GCC_VERSION}/specs + + sed -e "s/dependency_libs=.*/dependency_libs='-lm -lgcc -lc -lgcc'/" \ + ${RPM_BUILD_ROOT}%{_prefix}/lib/libstdc++.la \ + >${RPM_BUILD_ROOT}%{_prefix}/lib/libstdc++.la.$$ + mv -f ${RPM_BUILD_ROOT}%{_prefix}/lib/libstdc++.la.$$ \ + ${RPM_BUILD_ROOT}%{_prefix}/lib/libstdc++.la + + sed -e "s/dependency_libs=.*/dependency_libs='-lpthread -ldl -lz -lm -lgcc -lc -lgcc'/" \ + ${RPM_BUILD_ROOT}%{_prefix}/lib/libgcj.la \ + >${RPM_BUILD_ROOT}%{_prefix}/lib/libgcj.la.$$ + mv -f ${RPM_BUILD_ROOT}%{_prefix}/lib/libgcj.la.$$ \ + ${RPM_BUILD_ROOT}%{_prefix}/lib/libgcj.la + +cat >$RPM_BUILD_ROOT%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/include/syslimits.h <<EOF +#define _GCC_NEXT_LIMITS_H /* tell gcc's limits.h to recurse */ +#include_next <limits.h> +#undef _GCC_NEXT_LIMITS_H +EOF + +%endif + + $ARCH_STRTIP $RPM_BUILD_ROOT%{_prefix}/bin/${TOOLPREFIX}{gcc,cpp,c++,c++filt,gcj,gcjh,gij,jar,grepjar,jcf-dump,jv-convert,jv-scan}$EXESUFFIX || : + FULLPATH=$(dirname $RPM_BUILD_ROOT%{_prefix}/lib/gcc-lib/${arch}/%{GCC_VERSION}/cc1${EXESUFFIX}) + $ARCH_STRTIP $FULLPATH/{cc1${EXESUFFIX},cc1plus${EXESUFFIX},cpp0${EXESUFFIX},tradcpp0${EXESUFFIX},collect2${EXESUFFIX},jc1${EXESUFFIX},jvgenmain${EXESUFFIX}} || : + + # Strip static libraries + sh-linux-strip -S -R .comment `find $RPM_BUILD_ROOT -type f -name "*.a"` || : + + # Strip ELF shared objects + for f in `find $RPM_BUILD_ROOT -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) `; do + if file $f | grep -q "shared object.*not stripped"; then + sh-linux-strip --strip-unneeded -R .comment $f + fi + done + +%clean +rm -rf $RPM_BUILD_ROOT + +# ==================== Cross Compiler =============================== +%ifarch i386 + +%files sh-linux +%defattr(-,root,root) +%{_prefix}/bin/sh* +%dir %{_prefix}/lib/gcc-lib/sh-linux +%dir %{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION} +%dir %{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/include +%dir %{_prefix}/lib/gcc-lib/sh3-linux +%dir %{_prefix}/lib/gcc-lib/sh3-linux/%{GCC_VERSION} +%dir %{_prefix}/lib/gcc-lib/sh3eb-linux +%dir %{_prefix}/lib/gcc-lib/sh3eb-linux/%{GCC_VERSION} +%dir %{_prefix}/lib/gcc-lib/sh4-linux +%dir %{_prefix}/lib/gcc-lib/sh4-linux/%{GCC_VERSION} +%dir %{_prefix}/lib/gcc-lib/sh4eb-linux +%dir %{_prefix}/lib/gcc-lib/sh4eb-linux/%{GCC_VERSION} +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/cc1 +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/cc1plus +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/collect2 +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/cpp0 +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/*.o +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/libgcc*.a +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/specs +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/tradcpp0 +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/jc1 +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/jvgenmain +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/m4 +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/mb +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/include/stddef.h +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/include/stdarg.h +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/include/varargs.h +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/include/float.h +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/include/limits.h +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/include/stdbool.h +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/include/iso646.h +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/include/syslimits.h +%{_prefix}/lib/gcc-lib/sh-linux/%{GCC_VERSION}/include/README +%{_prefix}/lib/gcc-lib/sh3-linux/%{GCC_VERSION}/* +%{_prefix}/lib/gcc-lib/sh3eb-linux/%{GCC_VERSION}/* +%{_prefix}/lib/gcc-lib/sh4-linux/%{GCC_VERSION}/* +%{_prefix}/lib/gcc-lib/sh4eb-linux/%{GCC_VERSION}/* +%{_mandir}/man1/sh-linux-* +%dir %{_prefix}/sh-linux/include +%{_prefix}/sh3-linux/include +%{_prefix}/sh3eb-linux/include +%{_prefix}/sh4-linux/include +%{_prefix}/sh4eb-linux/include +%endif + +%if %{TARGET_LIBSTDC} +%ifarch i386 +%{_prefix}/sh-linux/include/g++-v3 +%{_prefix}/sh-linux/lib/libs* +%{_prefix}/sh-linux/lib/m4/libs* +%{_prefix}/sh-linux/lib/mb/libs* +%{_prefix}/sh-linux/lib/mb/m4/libs* +%{_prefix}/sh3-linux/lib/libs* +%{_prefix}/sh4-linux/lib/libs* +%{_prefix}/sh3eb-linux/lib/libs* +%{_prefix}/sh4eb-linux/lib/libs* +%endif +%endif + +%if %{TARGET_JAVA} +%ifarch i386 +%files -n libgcj-sh-linux +%defattr(-,root,root) +%{_prefix}/sh-linux/include/*.h +%{_prefix}/sh-linux/include/gcj +%{_prefix}/sh-linux/include/gnu/* +%{_prefix}/sh-linux/include/java +%{_prefix}/sh-linux/lib/lib*gcj* +%{_prefix}/sh-linux/lib/m4/lib*gcj* +%{_prefix}/sh-linux/lib/mb/lib*gcj* +%{_prefix}/sh-linux/lib/mb/m4/lib*gcj* +%{_prefix}/sh-linux/lib/libffi* +%{_prefix}/sh-linux/lib/m4/libffi* +%{_prefix}/sh-linux/lib/mb/libffi* +%{_prefix}/sh-linux/lib/mb/m4/libffi* +%{_prefix}/sh-linux/share/java/libgcj-%{GCC_VERSION}.jar +%{_prefix}/sh3-linux/lib/lib*gcj* +%{_prefix}/sh3-linux/lib/libffi* +%{_prefix}/sh3-linux/share/java/libgcj-%{GCC_VERSION}.jar +%{_prefix}/sh4-linux/lib/lib*gcj* +%{_prefix}/sh4-linux/lib/libffi* +%{_prefix}/sh4-linux/share/java/libgcj-%{GCC_VERSION}.jar +%{_prefix}/sh3eb-linux/lib/lib*gcj* +%{_prefix}/sh3eb-linux/lib/libffi* +%{_prefix}/sh3eb-linux/share/java/libgcj-%{GCC_VERSION}.jar +%{_prefix}/sh4eb-linux/lib/lib*gcj* +%{_prefix}/sh4eb-linux/lib/libffi* +%{_prefix}/sh4eb-linux/share/java/libgcj-%{GCC_VERSION}.jar +%endif +%endif + +%ifarch sh3 sh3eb sh4 sh4eb +# =========================== Native Compiler ================================= +%files +%defattr(-,root,root) +%dir %{_prefix}/lib/gcc-lib/%{_target} +%dir %{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION} +%dir %{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/include +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/cc1 +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/collect2 +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/cpp0 +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/crt*.o +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/libgcc*.a +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/specs +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/tradcpp0 +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/include/stddef.h +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/include/stdarg.h +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/include/varargs.h +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/include/float.h +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/include/limits.h +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/include/stdbool.h +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/include/iso646.h +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/include/syslimits.h +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/include/README +%{_prefix}/bin/gcc +%{_prefix}/bin/%{_target}-gcc +%{_prefix}/bin/cpp +%{_prefix}/bin/gccbug +%{_prefix}/bin/gcov +%{_prefix}/bin/cc +/lib/cpp +%{_infodir}/cpp* +%{_infodir}/gcc* + +%if 0 +%files libgcc +%defattr(-,root,root) +/lib/libgcc_s.so* +%endif + +%files c++ +%defattr(-,root,root) +%{_prefix}/bin/c++ +%{_prefix}/bin/g++ +%{_prefix}/bin/c++filt +%{_prefix}/bin/%{_target}-c++ +%{_prefix}/bin/%{_target}-g++ +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/cc1plus +%endif + +%if %{TARGET_LIBSTDC} +%ifarch sh3 sh3eb sh4 sh4eb +%files -n libstdc++ +%defattr(-,root,root) +%{_prefix}/lib/libstdc++.so* + +%files -n libstdc++-devel +%defattr(-,root,root) +%{_prefix}/include/g++-v3 +%{_prefix}/lib/libstdc++.*a +%endif +%endif + +%if %{TARGET_JAVA} +%ifarch sh3 sh3eb sh4 sh4eb +%files java +%defattr(-,root,root) +%{_prefix}/bin/addr2name.awk +%{_prefix}/bin/gcj +%{_prefix}/bin/gcjh +%{_prefix}/bin/gij +%{_prefix}/bin/jar +%{_prefix}/bin/grepjar +%{_prefix}/bin/jcf-dump +%{_prefix}/bin/jv-convert +%{_prefix}/bin/jv-scan +%dir %{_prefix}/lib/gcc-lib +%dir %{_prefix}/lib/gcc-lib/%{_target} +%dir %{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION} +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/jc1 +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/jvgenmain +%{_infodir}/gcj* + +%files -n libgcj +%defattr(-,root,root) +%{_prefix}/%{_lib}/libgcj.so* +%{_prefix}/%{_lib}/libffi*.so* +%{_prefix}/lib/gcc-lib/%{_target}/%{GCC_VERSION}/libgcj.spec +%{_prefix}/share/java/libgcj-%{GCC_VERSION}.jar + +%files -n libgcj-devel +%defattr(-,root,root) +%{_prefix}/include/*.h +%{_prefix}/include/gcj +%{_prefix}/include/gnu/* +%{_prefix}/include/java +%{_prefix}/lib/libgcj.*a +%{_prefix}/lib/libffi.*a +%endif +%endif + +%changelog +* Wed Feb 19 2003 SUGIOKA Toshinobu <sugioka@itonet.co.jp> +- version 3.2.2. + +* Tue Feb 19 2002 SUGIOKA Toshinobu <sugioka@itonet.co.jp> +- version 3.0.4. + +* Tue Feb 12 2002 SUGIOKA Toshinobu <sugioka@itonet.co.jp> +- add java support. + +* Thu Feb 7 2002 SUGIOKA Toshinobu <sugioka@itonet.co.jp> +- follow debian/SH update. + +* Tue Feb 5 2002 SUGIOKA Toshinobu <sugioka@itonet.co.jp> +- follow debian/SH update. + +* Thu Jan 24 2002 SUGIOKA Toshinobu <sugioka@itonet.co.jp> +- rebuild with new binutils. + +* Tue Jan 22 2002 SUGIOKA Toshinobu <sugioka@itonet.co.jp> +- leaf function optimization fixed. + +* Thu Dec 06 2001 SUGIOKA Toshinobu <sugioka@itonet.co.jp> +- add gcc-ice-rml patch. + +* Tue Nov 13 2001 SUGIOKA Toshinobu <sugioka@itonet.co.jp> +- add configure option. + +* Thu Nov 01 2001 SUGIOKA Toshinobu <sugioka@itonet.co.jp> +- tablejump fix by gniibe. + +* Mon Oct 22 2001 SUGIOKA Toshinobu <sugioka@itonet.co.jp> +- updated gcc patch. + +* Wed Oct 17 2001 SUGIOKA Toshinobu <sugioka@itonet.co.jp> +- updated gcc patch. + +* Tue Oct 02 2001 SUGIOKA Toshinobu <sugioka@itonet.co.jp> +- gcc/config/sh/sh.c bug fix. + +* Fri Aug 24 2001 SUGIOKA Toshinobu <sugioka@itonet.co.jp> +- gcc version 3.0.1. + +* Thu Jun 28 2001 SUGIOKA Toshinobu <sugioka@itonet.co.jp> +- gcc version 3.0. +- Add libstdc++ package. + +* Mon Apr 23 2001 SUGIOKA Toshinobu <sugioka@itonet.co.jp> +- Add cygwin host. + +* Sat Dec 23 2000 SUGIOKA Toshinobu <sugioka@itonet.co.jp> +- fix file attribute. +- add asmspecs patch. + +* Sat Nov 11 2000 SUGIOKA Toshinobu <sugioka@itonet.co.jp> +- initial version. diff --git a/patches/gcc/3.3.1/compat.exp.patch b/patches/gcc/3.3.1/compat.exp.patch new file mode 100644 index 00000000..763b8a18 --- /dev/null +++ b/patches/gcc/3.3.1/compat.exp.patch @@ -0,0 +1,37 @@ +Fixes the following problem when testing a cross-compiler: + +============================================ +Testing g++.dg/compat/abi/bitfield1, +... +Invoking the compiler as /crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/build-gcc/gcc/testsuite/../g++ ... +/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/gcc/testsuite/g++.dg/compat/abi/bitfield1_main.C +pid is 16028 -16028 +compiler exited with status 1 +output is: +sh: error while loading shared libraries: /opt/cegl-2.0/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/powerpc-750-linux-gnu/./lib/libdl.so.2: ELF file data encoding not little-endian +/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/build-gcc/gcc/testsuite/../g++: error while loading shared libraries: /opt/cegl-2.0/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/powerpc-750-linux-gnu/./lib/libc.so.6: ELF file data encoding not little-endian + +FAIL: g++.dg/compat/abi/bitfield1 main_tst.o compile +============================================ + +--- gcc-3.3/gcc/testsuite/g++.dg/compat/compat.exp.old Thu Oct 17 17:22:57 2002 ++++ gcc-3.3/gcc/testsuite/g++.dg/compat/compat.exp Mon Jul 14 10:59:19 2003 +@@ -42,11 +42,13 @@ + proc compat-fix-library-path { } { + global ld_library_path + +- # See comments in lib/g++.exp for why this is needed. +- setenv LD_LIBRARY_PATH $ld_library_path +- setenv SHLIB_PATH $ld_library_path +- setenv LD_LIBRARYN32_PATH $ld_library_path +- setenv LD_LIBRARY64_PATH $ld_library_path ++ if {![is_remote target]} { ++ # See comments in lib/g++.exp for why this is needed. ++ setenv LD_LIBRARY_PATH $ld_library_path ++ setenv SHLIB_PATH $ld_library_path ++ setenv LD_LIBRARYN32_PATH $ld_library_path ++ setenv LD_LIBRARY64_PATH $ld_library_path ++ } + } + + # diff --git a/patches/gcc/3.3.1/config.sub.patch b/patches/gcc/3.3.1/config.sub.patch new file mode 100644 index 00000000..928f9115 --- /dev/null +++ b/patches/gcc/3.3.1/config.sub.patch @@ -0,0 +1,72 @@ +When configuring a s390->s390 or cris->cris crosscompiler +(ok, I haven't hit this yet, but one of these days I'll get me an account +on an s390, and then I'll need this patch :-), you'll get the +following error: + ++ /build/s390-unknown-linux-gnu/gcc-3.3-glibc-2.3.2/gcc-3.3/configure +--target=s390-unknown-linux-gnu --host=s390-host_unknown-linux-gnu +--prefix=/result/s390-unknown-linux-gnu/gcc-3.3-glibc-2.3.2 +--enable-languages=c +--with-local-prefix=/result/s390-unknown-linux-gnu/gcc-3.3-glibc-2.3.2/s390- +unknown-linux-gnu --enable-threads=no --without-headers --with-newlib +--disable-shared +... +*** --with-headers is only supported when cross compiling + +This error pops up only when you're using Daniel Jacobowitz's technique +of slightly changing the target and host tuples to make them different +enough to force gcc's build system to not try to pull in system libraries +or headers. This technique is needed e.g. to build an x86 -> x86 +cross-compiler. +(The LFS developers ran into the same bug that prompted me to use +this technique; they point people who run into it to +http://linuxfromscratch.org/~greg/pure_lfs.txt, which is a different +way of avoiding this problem. I think the tuple tweak is the way to go, though.) + +config-patches@gnu.org rejected this patch, on the grounds that there +is only one vendor of each of those two architectures, so the +canonicalization is by definition correct. When I pointed out the +difficulty this causes for people building s390 -> s390 or +cris -> cris compilers that are incompatible with the system +libraries and thus must be built like cross-compilers, he grumped and said +"autoconf should let you specify a cross-compiler in some other way than +comparing tuple strings". + + + +--- gcc-3.3/config.sub.old Sun Jun 8 20:38:47 2003 ++++ gcc-3.3/config.sub Sun Jun 8 20:40:34 2003 +@@ -433,9 +433,12 @@ + crds | unos) + basic_machine=m68k-crds + ;; +- cris | cris-* | etrax*) ++ cris | etrax*) + basic_machine=cris-axis + ;; ++ cris-*) ++ basic_machine=cris-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; +@@ -820,11 +823,17 @@ + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; +- s390 | s390-*) ++ s390) + basic_machine=s390-ibm + ;; +- s390x | s390x-*) ++ s390-*) ++ basic_machine=s390-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; ++ s390x) + basic_machine=s390x-ibm ++ ;; ++ s390x-*) ++ basic_machine=s390x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + sa29200) + basic_machine=a29k-amd diff --git a/patches/gcc/3.3.1/empty6.patch b/patches/gcc/3.3.1/empty6.patch new file mode 100644 index 00000000..1b0715ce --- /dev/null +++ b/patches/gcc/3.3.1/empty6.patch @@ -0,0 +1,21 @@ +From 3.4 branch. Fixes test failure +FAIL: g++.dg/abi/empty6.C (test for warnings, line 6) + +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/abi/empty6.C,v +retrieving revision 1.1 +retrieving revision 1.2 +diff -u -r1.1 -r1.2 +--- gcc/gcc/testsuite/g++.dg/abi/empty6.C 2002/09/25 19:07:35 1.1 ++++ gcc/gcc/testsuite/g++.dg/abi/empty6.C 2003/06/03 19:10:09 1.2 +@@ -5,4 +5,9 @@ + struct B { + A a; // { dg-warning "empty" } + virtual void f () {} +-}; ++} __attribute__((aligned(8))); ++/* The preceding attribute is necessary on targets with ++ BIGGEST_ALIGNMENT <= 32 to trigger the warning, as otherwise a 32 bit ++ offset is split into DECL_FIELD_OFFSET 4 and DECL_FIELD_BIT_OFFSET 0, ++ and then there is no discrepancy between DECL_FIELD_OFFSET and ++ byte_position to warn about. */ diff --git a/patches/gcc/3.3.1/gcc-3.2.3-g++.exp.patch b/patches/gcc/3.3.1/gcc-3.2.3-g++.exp.patch new file mode 100644 index 00000000..fb8e4f08 --- /dev/null +++ b/patches/gcc/3.3.1/gcc-3.2.3-g++.exp.patch @@ -0,0 +1,100 @@ +See http://gcc.gnu.org/PR12010 + +g++ testsuite fixes for cross-compilers, Dan Kegel, Ixia Communications, 12 July 2003 + +The first hunk fixes the error + +/testsuite_flags: /testsuite_flags: No such file or directory + while executing +"exec sh ${odir_v3}/testsuite_flags --build-includes" + (procedure "g++_include_flags" line 21) + invoked from within +"g++_include_flags [get_multilibs] " + (procedure "g++_init" line 63) + invoked from within +"${tool}_init $test_file_name" + (procedure "runtest" line 19) + invoked from within +"runtest $test_name" + ("foreach" body line 42) + invoked from within +... +make[1]: [check-g++] Error 1 (ignored) + +The fix isn't especially pretty, but it worked for me, and can't hurt the +more common native compiler case. Maybe someone who knows the code better +can come up with a better fix. + +The second hunk fixes the error + +sh: error while loading shared libraries: /opt/cegl-2.0/powerpc-405-linux-gnu/gcc-3.2.3-glibc-2.2.5/powerpc-405-linux-gnu/./lib/libdl.so.2: ELF file data encoding not little-endian + +when trying to compile g++ testcases (!); setting up +the shared library environment when running crosstests of g++ +should either be done by a special board file, or by +setting up a remote chroot environment (see http://kegel.com/crosstool), +not by blithely setting LD_LIBRARY_PATH on the local system. + +--- gcc-3.2.3/gcc/testsuite/lib/g++.exp.old Fri Jul 11 15:42:47 2003 ++++ gcc-3.2.3/gcc/testsuite/lib/g++.exp Sat Jul 12 12:57:07 2003 +@@ -72,6 +72,8 @@ + # + proc g++_include_flags { paths } { + global srcdir ++ global objdir ++ global target_triplet + global HAVE_LIBSTDCXX_V3 + global TESTING_IN_BUILD_TREE + +@@ -90,6 +92,20 @@ + + if { ${HAVE_LIBSTDCXX_V3} } { + set odir_v3 [lookfor_file ${gccpath} libstdc++-v3] ++ if { $odir_v3 == "" } { ++ verbose "g++_include_flags: couldn't find libstdc++-v3 on first try, now looking in build directory $objdir" ++ # first assume no multilibs ++ set odir_v3 [lookfor_file ${objdir} "$target_triplet/libstdc++-v3"] ++ } ++ if { $odir_v3 == "" } { ++ verbose "g++_include_flags: couldn't find libstdc++-v3 on second try, trying multilib" ++ # assume multilib only one level deep ++ set multisub [file tail $gccpath] ++ set odir_v3 [lookfor_file ${objdir} "$target_triplet/$multisub/libstdc++-v3"] ++ } ++ if { $odir_v3 == "" } { ++ error "Can't find libstdc++-v3" ++ } + append flags [exec sh ${odir_v3}/testsuite_flags --build-includes] + } else { + set odir_v2 [lookfor_file ${gccpath} libstdc++] +@@ -192,16 +192,20 @@ + } + } + +- # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but +- # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH +- # (for the 64-bit ABI). The right way to do this would be to modify +- # unix.exp -- but that's not an option since it's part of DejaGNU +- # proper, so we do it here. We really only need to do +- # this on IRIX, but it shouldn't hurt to do it anywhere else. +- setenv LD_LIBRARY_PATH $ld_library_path +- setenv SHLIB_PATH $ld_library_path +- setenv LD_LIBRARYN32_PATH $ld_library_path +- setenv LD_LIBRARY64_PATH $ld_library_path ++ if {![is_remote target]} { ++ # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but ++ # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH ++ # (for the 64-bit ABI). The right way to do this would be to modify ++ # unix.exp -- but that's not an option since it's part of DejaGNU ++ # proper, so we do it here. We really only need to do ++ # this on IRIX, but it shouldn't hurt to do it anywhere else. ++ ++ # Doing this causes us to be unable to run cross-compilers. ++ setenv LD_LIBRARY_PATH $ld_library_path ++ setenv SHLIB_PATH $ld_library_path ++ setenv LD_LIBRARYN32_PATH $ld_library_path ++ setenv LD_LIBRARY64_PATH $ld_library_path ++ } + + return "$flags" + } diff --git a/patches/gcc/3.3.1/gcc-3.3-libstdc++-v3-dg.exp.patch b/patches/gcc/3.3.1/gcc-3.3-libstdc++-v3-dg.exp.patch new file mode 100644 index 00000000..aafc1306 --- /dev/null +++ b/patches/gcc/3.3.1/gcc-3.3-libstdc++-v3-dg.exp.patch @@ -0,0 +1,54 @@ +Without this patch, the command + +RUNTESTFLAGS=--target=powerpc-750-linux-gnu -v -v -v -v make check-target-libstdc++-v3 + +fails in two ways: +1. the -L option meant to locate the testsuite directory is incorrect, and +2. the wrong compiler is invoked, causing all sorts of havoc, not least of which +is the native compiler is invoked when we really wanted to invoke the cross-compiler +we just built. + +Here's an example log of the problem in action. Every testcase fails, this shows just one: +------------- +Invoking the compiler as g++ -ggdb3 -DDEBUG_ASSERT -I/home3/dank/wk/ixos/dap_interim/linux/3rdParty/crosstool/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/libstdc++-v3/testsuite /home3/dank/wk/ixos/dap_interim/linux/3rdParty/crosstool/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/libstdc++-v3/testsuite/20_util/binders.cc -g -O2 -DDEBUG_ASSERT -L/testsuite -lv3test -lm -o ./binders.exe +compiler exited with status 1 +output is: +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_function.h: In method `void binder2nd<mem_fun1_ref_t<void,Elem,int> >::operator ()(const Elem &) const':^M +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_algo.h:83: instantiated from `for_each<Elem *, binder2nd<mem_fun1_ref_t<void,Elem,int> > >(Elem *, Elem *, binder2nd<mem_fun1_ref_t<void,Elem,int> >)'^M +/home3/dank/wk/ixos/dap_interim/linux/3rdParty/crosstool/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/libstdc++-v3/testsuite/20_util/binders.cc:43: instantiated from here^M +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_function.h:224: conversion from `const Elem' to `Elem &' discards qualifiers^M +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_function.h:622: in passing argument 1 of `mem_fun1_ref_t<void,Elem,int>::operator ()(Elem &, int) const'^M +... +FAIL: 20_util/binders.cc (test for excess errors) +WARNING: 20_util/binders.cc compilation failed to produce executable +------------- + +And here's the patch. I'm not happy with it, and it probably gets some cases wrong, +but it seems to work for the common native case and for my cross-compiler case. + +--- gcc-3.3/libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp.old Sun Jul 13 10:42:01 2003 ++++ gcc-3.3/libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp Sun Jul 13 11:39:54 2003 +@@ -46,8 +46,23 @@ + global gluefile wrap_flags + global ld_library_path + global tool_root_dir ++ global target_triplet + + set blddir [lookfor_file [get_multilibs] libstdc++-v3] ++ if { $blddir == "" } { ++ set multilibs [get_multilibs] ++ # FIXME: assume multilib only one level deep ++ set multisub [file tail $multilibs] ++ verbose "libstdc++-v3-init: couldn't find libstdc++-v3 in $multilibs, trying $objdir" ++ set blddir [lookfor_file ${objdir} "$target_triplet/$multisub/libstdc++-v3"] ++ } ++ if { $blddir == "" } { ++ verbose "libstdc++-v3-init: couldn't find libstdc++-v3, trying $objdir without multilibs" ++ set blddir [lookfor_file ${objdir} "$target_triplet/libstdc++-v3"] ++ } ++ if { $blddir == "" } { ++ error "Can't find libstdc++-v3" ++ } + + # By default, we assume we want to run program images. + global dg-do-what-default diff --git a/patches/gcc/3.3.1/gcc-3.3.1-trap-posix.patch b/patches/gcc/3.3.1/gcc-3.3.1-trap-posix.patch new file mode 100644 index 00000000..ce2baf37 --- /dev/null +++ b/patches/gcc/3.3.1/gcc-3.3.1-trap-posix.patch @@ -0,0 +1,44 @@ +# +# Submitted-By: Marc Kleine-Budde <mkl@pengutronix.de>, 2005-04-20 +# +# Error: +# +# creating libintl.h +# Configuring etc... +# loading cache ../config.cache +# checking for a BSD compatible install... (cached) /usr/bin/install -c +# creating ./config.status +# creating Makefile +# trap: usage: trap [-lp] [[arg] signal_spec ...] +# +# Description: +# +# non-posix conform usage of trap causes bash >= 3.0 to fail +# e.g.: http://sourceware.org/ml/crossgcc/2004-12/msg00132.html +# +# Status: +# +# fixed in gcc >= 3.3.5 +# backport of gcc-3.3.5 fix +# +diff -ruN gcc-3.3.1-orig/configure gcc-3.3.1/configure +--- gcc-3.3.1-orig/configure 2002-09-29 18:11:24.000000000 +0200 ++++ gcc-3.3.1/configure 2005-04-20 18:49:20.223220401 +0200 +@@ -697,7 +697,7 @@ + if test -f skip-this-dir; then + # Perform the same cleanup as the trap handler, minus the "exit 1" of course, + # and reset the trap handler. +- trap 0 ++ trap '' 0 + rm -rf Makefile* ${tmpdir} + # Execute the final clean-up actions + ${config_shell} skip-this-dir +@@ -1596,7 +1596,7 @@ + # Perform the same cleanup as the trap handler, minus the "exit 1" of course, + # and reset the trap handler. + rm -rf ${tmpdir} +-trap 0 ++trap '' 0 + + exit 0 + diff --git a/patches/gcc/3.3.1/pr10392-1-test.patch b/patches/gcc/3.3.1/pr10392-1-test.patch new file mode 100644 index 00000000..e94c8b9b --- /dev/null +++ b/patches/gcc/3.3.1/pr10392-1-test.patch @@ -0,0 +1,65 @@ +--- /dev/null Sat Dec 14 13:56:51 2002 ++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr10392-1.c Sun Sep 14 14:28:24 2003 +@@ -0,0 +1,62 @@ ++/* PR optimization/10392 ++ * Reporter: marcus@mc.pp.se ++ * Summary: [3.3/3.4 regression] [SH] optimizer generates faulty array indexing ++ * Description: ++ * The address calculation of an index operation on an array on the stack ++ * can _under some conditions_ get messed up completely ++ * ++ * Testcase tweaked by dank@kegel.com ++ * Problem only happens with -O2 -m4, so it should only happen on sh4, ++ * but what the heck, let's test other architectures, too. ++ * Not marked as xfail since it's a regression. ++*/ ++/* { dg-do run } */ ++/* { dg-options "-O2" } */ ++/* { dg-options "-O2 -m4" { target sh4-*-* } } */ ++const char *dont_optimize_function_away; ++ ++const char *use(const char *str) ++{ ++ dont_optimize_function_away = str; ++ if (str[0] != 'v') ++ abort(); ++ if (str[1] < '1' || str[1] > '6') ++ abort(); ++ if (str[2]) ++ abort(); ++ return str[2] ? "notused" : "v6"; ++} ++ ++const char *func(char *a, char *b) ++{ ++ char buf[128]; ++ unsigned char i; ++ const char *result; ++ ++ char *item[] = { ++ "v1", ++ "v2", ++ }; ++ ++ buf[0] = 'v'; ++ buf[1] = '3'; ++ buf[2] = 0; ++ ++ for (i = 0; i < 2; i++) { ++ /* bug is: following line passes wild pointer to use() on sh4 -O2 */ ++ result = use(item[i]); ++ ++ use(buf); ++ use(a); ++ use(b); ++ result = use(result); ++ } ++ return result; ++} ++ ++int main() ++{ ++ func("v4", "v5"); ++ return 0; ++} ++ diff --git a/patches/gcc/3.3.1/pr10412-1-test.patch b/patches/gcc/3.3.1/pr10412-1-test.patch new file mode 100644 index 00000000..6ca05258 --- /dev/null +++ b/patches/gcc/3.3.1/pr10412-1-test.patch @@ -0,0 +1,46 @@ +--- /dev/null Sat Dec 14 13:56:51 2002 ++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr10412-1.c Sun Sep 14 16:15:21 2003 +@@ -0,0 +1,43 @@ ++/* PR target/10412 ++ * Reporter: shrinivasa@kpitcummins.com ++ * Summary: Renesas SH - Incorrect code generation ++ * Description: ++ * When following code is compiled with ++ * sh-elf-gcc -S -mhitachi -m2 -O2 bug1.c ++ * generates an incorrect code. ++ * ++ * Testcase tweaked by dank@kegel.com ++ * Problem only happens with -mhitachi -m2. Not sure if I can give those ++ * options for all sh targets. They work on sh4, though. ++ * Not marked as xfail as it's a regression relative to hardhat 2.0 gcc-2.97. ++*/ ++/* { dg-do run } */ ++/* { dg-options "-O2" } */ ++int global_val; ++ ++int func0(int x) ++{ ++ global_val += x; ++ return (x != 99); ++} ++ ++int func1(unsigned long addr) ++{ ++ int err; ++ ++ err = func0(addr); ++ if (err) ++ return (err); ++ ++ err = func0(addr * 7); /* address of func0 is lost during multiplication -> probable SIGSEGV */ ++ return (err); ++} ++ ++int main(int argc, char **argv) ++{ ++ global_val = 0; ++ global_val += func1(99); ++ if (global_val != 99 * 8 + 1) ++ abort(); ++ return 0; ++} diff --git a/patches/gcc/3.3.1/pr10589-1-test.patch b/patches/gcc/3.3.1/pr10589-1-test.patch new file mode 100644 index 00000000..04882e51 --- /dev/null +++ b/patches/gcc/3.3.1/pr10589-1-test.patch @@ -0,0 +1,17 @@ +--- /dev/null Sat Dec 14 13:56:51 2002 ++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr10589-1.c Mon Sep 15 08:57:58 2003 +@@ -0,0 +1,14 @@ ++/* PR target/10589 ++ * Reporter: mathieu@thenesis.com ++ * Summary: For Hitachi SH target, GCC crashes when both -fomit-frame-pointer and -mdalign options are specified ++ * Keywords: ice-on-valid-code ++ * Testcase by Kazu Hirata, tweaked by dank@kegel.com ++ * Did not fail in Hard Hat 2.0 gcc-2.97, nor in dodes gcc-3.0.2, so this is a regression, so I'm not marking it xfail ++ */ ++/* { dg-do compile { target sh*-*-* } } */ ++/* { dg-options "-fomit-frame-pointer -mdalign" } */ ++ ++int foo(int a, int b) ++{ ++ return a / b; ++} diff --git a/patches/gcc/3.3.1/pr11162-1-test.patch b/patches/gcc/3.3.1/pr11162-1-test.patch new file mode 100644 index 00000000..9ab0d324 --- /dev/null +++ b/patches/gcc/3.3.1/pr11162-1-test.patch @@ -0,0 +1,25 @@ +--- /dev/null Sat Dec 14 13:56:51 2002 ++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr11162-1.c Sun Sep 14 16:24:41 2003 +@@ -0,0 +1,22 @@ ++/* ++ * PR optimization/11162 ++ * Reporter: Toshiyasu Morita <tm@kloo.net> ++ * Summary: [3.4 Regression] [-fnew-ra] ICE compiling channel.i on sh ++ * Keywords: ice-on-valid-code ++ * Description: ++ * [ICE] when channel.i from stress-1.17 is compiled with options: ++ * -O2 -m4 -fnew-ra ++ * ... ++ * The CFG code gets confused by the addition of a USE insn after a sibcall. ++ * Sibcalls are supposed to end the block (and the function!), so the fact ++ * that we have an instruction following one (even if its fake) is confusing. ++ * ++ * testcase tweaked by dank@kegel.com ++ */ ++/* { dg-do compile } */ ++/* { dg-options "-O2 -fnew-ra" } */ ++ ++int foo(char *p1) ++{ ++ return bar(p1); ++} diff --git a/patches/gcc/3.3.1/pr11587-1-test.patch b/patches/gcc/3.3.1/pr11587-1-test.patch new file mode 100644 index 00000000..f6dedde0 --- /dev/null +++ b/patches/gcc/3.3.1/pr11587-1-test.patch @@ -0,0 +1,39 @@ +--- /dev/null Sat Dec 14 13:56:51 2002 ++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr11587-1.c Mon Sep 15 08:46:00 2003 +@@ -0,0 +1,36 @@ ++/* PR optimization/11587 ++ * Reporter: Michael Eager <eager@mvista.com> ++ * Summary: [3.3/3.4 Regression] SH ICE in reload_cse_simplify_operand, postreload.c ++ * Keywords: ice-on-valid-code ++ * ++ * Note: a fix exists; see bugzilla ++ * ++ * Testcase tweaked by dank@kegel.com ++ * Not marked as xfail since it's a regression. ++ */ ++ ++/* { dg-do compile } */ ++/* { dg-options "-O1" } */ ++int foo1(void); ++int foo2(); ++int foo3(); ++ ++static int goo() ++{ ++ int i; ++ ++ if (i <= 0) ++ return i; ++ ++ if (foo1() > 1) { ++ i = foo2(); ++ if (i < 0) ++ return i; ++ if (i) { ++ if (foo3()) ++ return 1; ++ return 0; ++ } ++ } ++ ++} diff --git a/patches/gcc/3.3.1/pr11736-1-test.patch b/patches/gcc/3.3.1/pr11736-1-test.patch new file mode 100644 index 00000000..ea544b12 --- /dev/null +++ b/patches/gcc/3.3.1/pr11736-1-test.patch @@ -0,0 +1,48 @@ +--- /dev/null Sat Dec 14 13:56:51 2002 ++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr11736-1.c Sun Sep 14 14:26:33 2003 +@@ -0,0 +1,45 @@ ++/* PR optimization/11736 ++ * Reporter: marcus@mc.pp.se ++ * Summary: Stackpointer messed up on SuperH ++ * Keywords: wrong-code ++ * Description: ++ * When a function with 5 arguments is called in both branches of a ++ * conditional, and only the last argument differs, the code to push that ++ * last argument on the stack gets confused. ++ * Space for the fifth argument is reserved on the stack by the ++ * instruction I have marked as "A". However, if the else-branch is ++ * taken the stackpointer is decremented _again_ at "B". This ++ * decrementation is never restored, and it is only due to the ++ * restoration of r15 from r14 that the function works at all. With ++ * -fomit-frame-pointer it will crash. ++ * ++ * Testcase tweaked by dank@kegel.com ++ * Not marked as xfail since it's a regression from hardhat 2.0 gcc-2.97 ++ * and dodes gcc-3.0.2 ++ */ ++ ++/* { dg-do run } */ ++/* { dg-options "-O1 -fomit-frame-pointer" } */ ++ ++int expected_e; ++ ++void bar(int a, int b, int c, int d, int e) ++{ ++ if (e != expected_e) ++ abort(); ++} ++ ++void foo(int a) ++{ ++ if (a) ++ bar(0, 0, 0, 0, 1); ++ else ++ bar(0, 0, 0, 0, 0); /* stack pointer decremented extra time here, causing segfault */ ++} ++ ++int main(int argc, char **argv) ++{ ++ for (expected_e = 0; expected_e < 2; expected_e++) ++ foo(expected_e); ++ return 0; ++} diff --git a/patches/gcc/3.3.1/pr11864-1-test.patch b/patches/gcc/3.3.1/pr11864-1-test.patch new file mode 100644 index 00000000..f5b0d175 --- /dev/null +++ b/patches/gcc/3.3.1/pr11864-1-test.patch @@ -0,0 +1,45 @@ +--- /dev/null Sat Dec 14 13:56:51 2002 ++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr11864-1.c Sun Sep 14 14:32:24 2003 +@@ -0,0 +1,42 @@ ++/* PR optimization/11864 ++ * Reporter: Kazumoto Kojima <kkojima@gcc.gnu.org> ++ * Summary: [3.3/3.4 regression] miscompiles zero extension and test ++ * Description: ++ * gcc-3.3/3.4 -O2 for sh target may miscompile the combination of zero extension ++ * and test if it's zero. ++ * ++ * Testcase tweaked by dank@kegel.com. Not marked as xfail because it's a regression. ++ */ ++/* { dg-do run } */ ++/* { dg-options "-O2" } */ ++ ++extern void abort(void); ++ ++int val = 0xff00; ++ ++int f(void) ++{ ++ return val; ++} ++ ++unsigned char a[1]; ++ ++void foo(void) ++{ ++ a[0] = f() & 255; ++ ++ if (!a[0]) ++ a[0] = f() & 255; ++ ++ if (!a[0]) ++ a[0] = 1 + (f() & 127); ++} ++ ++int main(int argc, char **argv) ++{ ++ foo(); ++ if (!a[0]) ++ abort(); ++ ++ return 0; ++} diff --git a/patches/gcc/3.3.1/pr11949-fix.patch b/patches/gcc/3.3.1/pr11949-fix.patch new file mode 100644 index 00000000..7f60b954 --- /dev/null +++ b/patches/gcc/3.3.1/pr11949-fix.patch @@ -0,0 +1,61 @@ +Message-Id: 20030822160024.GA305@ftbfs.org +From: Matt Kraai kraai at alumni dot cmu dot edu +To: gcc-patches at gcc dot gnu dot org +Date: Fri, 22 Aug 2003 09:00:24 -0700 +Subject: PR 11949 + +Howdy, + +I've backported the following patch from the mainline to the 3.3 +branch to fix PR 11949. + +Bootstrapped and regression tested on powerpc-unknown-linux-gnu. + +OK to commit? + + PR c/11949 + Backport from mainline: + + 2003-05-05 Aldy Hernandez aldyh@redhat.com + + * testsuite/gcc.c-torture/compile/simd-6.c: New. + + * c-typeck.c (digest_init): Handle arrays of vector constants. + +Index: gcc/c-typeck.c +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/c-typeck.c,v +retrieving revision 1.213.2.8 +diff -3 -c -p -r1.213.2.8 c-typeck.c +*** gcc/gcc/c-typeck.c 19 Aug 2003 01:42:35 -0000 1.213.2.8 +--- gcc/gcc/c-typeck.c 22 Aug 2003 09:24:03 -0000 +*************** digest_init (type, init, require_constan +*** 4765,4772 **** + if (code == VECTOR_TYPE + && comptypes (TREE_TYPE (inside_init), type) + && TREE_CONSTANT (inside_init)) +! return build_vector (type, TREE_OPERAND (inside_init, 1)); +! + + /* Any type can be initialized + from an expression of the same type, optionally with braces. */ +--- 4765,4778 ---- + if (code == VECTOR_TYPE + && comptypes (TREE_TYPE (inside_init), type) + && TREE_CONSTANT (inside_init)) +! { +! if (TREE_CODE (inside_init) == VECTOR_CST +! && comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)), +! TYPE_MAIN_VARIANT (type))) +! return inside_init; +! else +! return build_vector (type, CONSTRUCTOR_ELTS (inside_init)); +! } + + /* Any type can be initialized + from an expression of the same type, optionally with braces. */ + +typedef int __attribute__((mode(V2SI))) vec; + +vec a[] = {(vec) {1, 2}, {3, 4}}; + diff --git a/patches/gcc/3.3.1/pr9365-1-test.patch b/patches/gcc/3.3.1/pr9365-1-test.patch new file mode 100644 index 00000000..ee7dfa7c --- /dev/null +++ b/patches/gcc/3.3.1/pr9365-1-test.patch @@ -0,0 +1,43 @@ +--- /dev/null Sat Dec 14 13:56:51 2002 ++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr9365-1.c Sun Sep 14 09:34:37 2003 +@@ -0,0 +1,40 @@ ++/* PR target/9365 ++ * Origin: marcus@mc.pp.se ++ * Testcase tweaked by dank@kegel.com ++ * [3.3 regression] [SH] segfault in gen_far_branch (config/sh/sh.c) ++ * ice-on-valid-code ++ * Not marked as xfail since it's a regression ++*/ ++/* { dg-do compile } */ ++/* { dg-options "-O2 -fomit-frame-pointer" } */ ++ ++ ++void foo(int n, int *p) ++{ ++ switch(n) { ++ case 100: case 110: case 120: case 130: case 140: ++ case 200: case 210: case 220: case 230: case 240: ++ case 300: case 310: case 320: case 330: case 340: ++ case 400: case 410: case 420: case 430: case 440: ++ case 500: case 510: case 520: case 530: case 540: ++ case 600: case 610: case 620: case 630: case 640: ++ case 700: case 710: case 720: case 730: case 740: ++ case 800: case 810: case 820: case 830: case 840: ++ case 900: case 910: case 920: case 930: case 940: ++ break; ++ default: ++ *p = n; ++ break; ++ } ++} ++ ++int main(int argc, char **argv) ++{ ++ int p; ++ ++ (void) argv; ++ ++ foo(argc, &p); ++ ++ return p; ++} diff --git a/patches/gcc/3.3.1/sh-pic-set_fpscr.patch b/patches/gcc/3.3.1/sh-pic-set_fpscr.patch new file mode 100644 index 00000000..e83f7283 --- /dev/null +++ b/patches/gcc/3.3.1/sh-pic-set_fpscr.patch @@ -0,0 +1,61 @@ +See http://gcc.gnu.org/PR11901 +Should fix +make[2]: *** [/gcc-3.3-glibc-2.3.2/build-glibc/elf/check-textrel.out] Error 1 +in glibc's "make tests". + +------------- + +Message-Id: <200307300255.h6U2tB906928@r-rr.iij4u.or.jp> +To: dank@kegel.com +Cc: linux-sh@m17n.org +Subject: Re: Writing PIC version of __udivsi3_i4? (was: Re: "make tests" fails + with "libc.so: text relocations used" in glibc-2.3.2 for sh4) +In-Reply-To: Your message of "Wed, 30 Jul 2003 11:20:49 +0900" + <200307300212.h6U2CH901209@r-rr.iij4u.or.jp> +References: <200307300212.h6U2CH901209@r-rr.iij4u.or.jp> +Date: Wed, 30 Jul 2003 12:03:01 +0900 +From: kaz Kojima <kkojima@rr.iij4u.or.jp> + +> I'll try to write the PIC version of it, + +Dan, does the attached patch work for you? + +[dank: original patch deleted; here's same thing rediffed against gcc-3.3 instead of HEAD] + +--- gcc-3.3/gcc/config/sh/lib1funcs.asm.old Tue Jul 29 21:37:29 2003 ++++ gcc-3.3/gcc/config/sh/lib1funcs.asm Tue Jul 29 21:40:58 2003 +@@ -1792,7 +1792,17 @@ + .global GLOBAL(set_fpscr) + GLOBAL(set_fpscr): + lds r4,fpscr ++#ifdef __PIC__ ++ mov.l r12,@-r15 ++ mova LOCAL(set_fpscr_L0),r0 ++ mov.l LOCAL(set_fpscr_L0),r12 ++ add r0,r12 ++ mov.l LOCAL(set_fpscr_L1),r0 ++ mov.l @(r0,r12),r1 ++ mov.l @r15+,r12 ++#else + mov.l LOCAL(set_fpscr_L1),r1 ++#endif + swap.w r4,r0 + or #24,r0 + #ifndef FMOVD_WORKS +@@ -1820,8 +1830,16 @@ + mov.l r3,@(4,r1) + #endif + .align 2 ++#ifdef __PIC__ ++LOCAL(set_fpscr_L0): ++ .long _GLOBAL_OFFSET_TABLE_ ++LOCAL(set_fpscr_L1): ++ .long GLOBAL(fpscr_values@GOT) ++#else + LOCAL(set_fpscr_L1): + .long GLOBAL(fpscr_values) ++#endif ++ + #ifdef __ELF__ + .comm GLOBAL(fpscr_values),8,4 + #else diff --git a/patches/gcc/3.3.1/sh-spec.patch b/patches/gcc/3.3.1/sh-spec.patch new file mode 100644 index 00000000..efd4243c --- /dev/null +++ b/patches/gcc/3.3.1/sh-spec.patch @@ -0,0 +1,52 @@ +See http://gcc.gnu.org/PR11902 + +Part of fix for abort on line + assert (info[DT_RPATH] == NULL); +in glibc-2.3.2's ld.so, which makes all dynamically-linked +programs crash. + +Message-Id: <200308020452.h724q0n01509@r-rr.iij4u.or.jp> +To: dank@kegel.com +Cc: kkojima@rr.iij4u.or.jp +Subject: Re: Writing PIC version of __udivsi3_i4? +In-Reply-To: Your message of "Fri, 01 Aug 2003 21:15:27 -0700" + <3F2B3ADF.6030206@kegel.com> +References: <3F2B3ADF.6030206@kegel.com> +Date: Sat, 02 Aug 2003 13:58:05 +0900 +From: kaz Kojima <kkojima@rr.iij4u.or.jp> + +Dan Kegel <dank@kegel.com> wrote: +> It seems it might be from gcc's spec file: +> +> *subtarget_link_spec: +> %{shared:-shared} %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} %{!rpath:-rpath /lib}} %{static:-static} +> +> as the only place -rpath showed up was in the output of gcc -v as it +> was linking libc.so. +> +> Well, that's a clue, anyway! Guess I'll dig through the spec files +> tomorrow to see if I can figure it out some more. + +I've grepped gcc/config/*/*.h and found only SH and old libc1 stuffs +of i386/alpha include %{!rpath:-rpath ... in 3.3 release and the +current CVS. And my sh-gcc's specs doesn't have this :-( +It would be the Right Thing to remove this stuff simply. How about +the gcc patch below? + +Regards, + kaz +-- +--- gcc-3.3/gcc/config/sh/linux.h.orig Sat Aug 2 13:20:57 2003 ++++ gcc-3.3/gcc/config/sh/linux.h Sat Aug 2 13:22:42 2003 +@@ -48,8 +48,7 @@ do { \ + "%{shared:-shared} \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ +- %{!rpath:-rpath /lib}} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ + %{static:-static}" + + /* The GNU C++ standard library requires that these macros be defined. */ + + diff --git a/patches/gcc/3.3.1/sh4-pthread.patch b/patches/gcc/3.3.1/sh4-pthread.patch new file mode 100644 index 00000000..95e1057b --- /dev/null +++ b/patches/gcc/3.3.1/sh4-pthread.patch @@ -0,0 +1,44 @@ +See http://gcc.gnu.org/PR11903 + +Patch to fix following test case failure: + + === libstdc++-v3 tests === +FAIL: thread/pthread1.cc (test for excess errors) +Excess errors: +/opt/cegl-2.0/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/sh4-unknown-linux-gnu/bin/ld: cannot find -lthread +collect2: ld returned 1 exit status + +Note that *any* program compiled with -pthread fails: + +/opt/cegl-2.0/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/bin/sh4-unknown-linux-gnu-gcc hello.c -pthread +/opt/cegl-2.0/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/lib/gcc-lib/sh4-unknown-linux-gnu/3.3.1/../../../../sh4-unknown-linux-gnu/bin/ld: cannot find -lthread +collect2: ld returned 1 exit status + +Compiling with -lpthread on the other hand works fine: +/opt/cegl-2.0/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/bin/sh4-unknown-linux-gnu-gcc hello.c -lpthread + +So -pthread is broken in some trivial way; it should invoke -lpthread, not -lthread, +at least when targeting Linux. + +http://www.sh-linux.org/rpm-2003/SRPMS/gcc-3.2.3-3.src.rpm contains a jumbo patch, +gcc-20030210-sh-linux-1.patch, that includes a fix for this. Here's the +appropriate hunk (brings in a fix for the documented -mieee option). +No idea if this fix is completely right, but it works for me... +- dank@kegel.com 20 Jul 2003 + +Index: linux.h +=================================================================== +RCS file: /cvsroot/gcc/gcc/gcc/config/sh/linux.h,v +retrieving revision 1.9.20.1 +diff -u -d -u -r1.9.20.1 linux.h +--- gcc-ss-3_3-20030714/gcc/config/sh/linux.h.old 6 Jun 2003 02:30:59 -0000 1.9.20.1 ++++ gcc-ss-3_3-20030714/gcc/config/sh/linux.h 20 Jul 2003 23:36:50 -0000 +@@ -59,7 +59,7 @@ + #undef LIB_SPEC + #define LIB_SPEC \ + "%{shared: -lc} \ +- %{!shared: %{pthread:-lthread} \ ++ %{!shared: %{mieee:-lieee} %{pthread:-lpthread} \ + %{profile:-lc_p} %{!profile: -lc}}" + + #undef STARTFILE_SPEC diff --git a/patches/gcc/3.3.1/thunk3.patch b/patches/gcc/3.3.1/thunk3.patch new file mode 100644 index 00000000..7974a0c0 --- /dev/null +++ b/patches/gcc/3.3.1/thunk3.patch @@ -0,0 +1,23 @@ +Fixes +FAIL: g++.jason/thunk3.C (test for excess errors) +on sh4-unknown-linux-gnu. + +Does any sh variant *not* use the generic thunk support? If so, the patch should be +more cautious. As it is, it excludes all sh processors from this test. + +Index: thunk3.C +=================================================================== +RCS file: /cvsroot/gcc/gcc/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C,v +retrieving revision 1.13 +diff -u -d -u -r1.13 thunk3.C +--- gcc-ss-3_3-20030714/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C.old 25 Mar 2002 17:57:03 -0000 1.13 ++++ gcc-ss-3_3-20030714/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C 20 Jul 2003 16:57:38 -0000 +@@ -2,7 +2,7 @@ + // Note that this will break on any target that uses the generic thunk + // support, because it doesn't support variadic functions. + +-// excess errors test - XFAIL mips*-*-* rs6000-*-* powerpc-*-eabi m68k-*-coff m68k-motorola-sysv m88k-motorola-sysv3 mn10300-*-* mn10200-*-* v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa-*-* ++// excess errors test - XFAIL mips*-*-* rs6000-*-* powerpc-*-eabi m68k-*-coff m68k-motorola-sysv m88k-motorola-sysv3 mn10300-*-* mn10200-*-* v850-*-* sh*-*-* h8*-*-* xtensa-*-* + + #include <stdarg.h> + diff --git a/patches/gcc/3.3.2/empty6.patch b/patches/gcc/3.3.2/empty6.patch new file mode 100644 index 00000000..1b0715ce --- /dev/null +++ b/patches/gcc/3.3.2/empty6.patch @@ -0,0 +1,21 @@ +From 3.4 branch. Fixes test failure +FAIL: g++.dg/abi/empty6.C (test for warnings, line 6) + +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/abi/empty6.C,v +retrieving revision 1.1 +retrieving revision 1.2 +diff -u -r1.1 -r1.2 +--- gcc/gcc/testsuite/g++.dg/abi/empty6.C 2002/09/25 19:07:35 1.1 ++++ gcc/gcc/testsuite/g++.dg/abi/empty6.C 2003/06/03 19:10:09 1.2 +@@ -5,4 +5,9 @@ + struct B { + A a; // { dg-warning "empty" } + virtual void f () {} +-}; ++} __attribute__((aligned(8))); ++/* The preceding attribute is necessary on targets with ++ BIGGEST_ALIGNMENT <= 32 to trigger the warning, as otherwise a 32 bit ++ offset is split into DECL_FIELD_OFFSET 4 and DECL_FIELD_BIT_OFFSET 0, ++ and then there is no discrepancy between DECL_FIELD_OFFSET and ++ byte_position to warn about. */ diff --git a/patches/gcc/3.3.2/gcc-3.2.3-g++.exp.patch b/patches/gcc/3.3.2/gcc-3.2.3-g++.exp.patch new file mode 100644 index 00000000..fb8e4f08 --- /dev/null +++ b/patches/gcc/3.3.2/gcc-3.2.3-g++.exp.patch @@ -0,0 +1,100 @@ +See http://gcc.gnu.org/PR12010 + +g++ testsuite fixes for cross-compilers, Dan Kegel, Ixia Communications, 12 July 2003 + +The first hunk fixes the error + +/testsuite_flags: /testsuite_flags: No such file or directory + while executing +"exec sh ${odir_v3}/testsuite_flags --build-includes" + (procedure "g++_include_flags" line 21) + invoked from within +"g++_include_flags [get_multilibs] " + (procedure "g++_init" line 63) + invoked from within +"${tool}_init $test_file_name" + (procedure "runtest" line 19) + invoked from within +"runtest $test_name" + ("foreach" body line 42) + invoked from within +... +make[1]: [check-g++] Error 1 (ignored) + +The fix isn't especially pretty, but it worked for me, and can't hurt the +more common native compiler case. Maybe someone who knows the code better +can come up with a better fix. + +The second hunk fixes the error + +sh: error while loading shared libraries: /opt/cegl-2.0/powerpc-405-linux-gnu/gcc-3.2.3-glibc-2.2.5/powerpc-405-linux-gnu/./lib/libdl.so.2: ELF file data encoding not little-endian + +when trying to compile g++ testcases (!); setting up +the shared library environment when running crosstests of g++ +should either be done by a special board file, or by +setting up a remote chroot environment (see http://kegel.com/crosstool), +not by blithely setting LD_LIBRARY_PATH on the local system. + +--- gcc-3.2.3/gcc/testsuite/lib/g++.exp.old Fri Jul 11 15:42:47 2003 ++++ gcc-3.2.3/gcc/testsuite/lib/g++.exp Sat Jul 12 12:57:07 2003 +@@ -72,6 +72,8 @@ + # + proc g++_include_flags { paths } { + global srcdir ++ global objdir ++ global target_triplet + global HAVE_LIBSTDCXX_V3 + global TESTING_IN_BUILD_TREE + +@@ -90,6 +92,20 @@ + + if { ${HAVE_LIBSTDCXX_V3} } { + set odir_v3 [lookfor_file ${gccpath} libstdc++-v3] ++ if { $odir_v3 == "" } { ++ verbose "g++_include_flags: couldn't find libstdc++-v3 on first try, now looking in build directory $objdir" ++ # first assume no multilibs ++ set odir_v3 [lookfor_file ${objdir} "$target_triplet/libstdc++-v3"] ++ } ++ if { $odir_v3 == "" } { ++ verbose "g++_include_flags: couldn't find libstdc++-v3 on second try, trying multilib" ++ # assume multilib only one level deep ++ set multisub [file tail $gccpath] ++ set odir_v3 [lookfor_file ${objdir} "$target_triplet/$multisub/libstdc++-v3"] ++ } ++ if { $odir_v3 == "" } { ++ error "Can't find libstdc++-v3" ++ } + append flags [exec sh ${odir_v3}/testsuite_flags --build-includes] + } else { + set odir_v2 [lookfor_file ${gccpath} libstdc++] +@@ -192,16 +192,20 @@ + } + } + +- # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but +- # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH +- # (for the 64-bit ABI). The right way to do this would be to modify +- # unix.exp -- but that's not an option since it's part of DejaGNU +- # proper, so we do it here. We really only need to do +- # this on IRIX, but it shouldn't hurt to do it anywhere else. +- setenv LD_LIBRARY_PATH $ld_library_path +- setenv SHLIB_PATH $ld_library_path +- setenv LD_LIBRARYN32_PATH $ld_library_path +- setenv LD_LIBRARY64_PATH $ld_library_path ++ if {![is_remote target]} { ++ # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but ++ # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH ++ # (for the 64-bit ABI). The right way to do this would be to modify ++ # unix.exp -- but that's not an option since it's part of DejaGNU ++ # proper, so we do it here. We really only need to do ++ # this on IRIX, but it shouldn't hurt to do it anywhere else. ++ ++ # Doing this causes us to be unable to run cross-compilers. ++ setenv LD_LIBRARY_PATH $ld_library_path ++ setenv SHLIB_PATH $ld_library_path ++ setenv LD_LIBRARYN32_PATH $ld_library_path ++ setenv LD_LIBRARY64_PATH $ld_library_path ++ } + + return "$flags" + } diff --git a/patches/gcc/3.3.2/gcc-3.3-libstdc++-v3-dg.exp.patch b/patches/gcc/3.3.2/gcc-3.3-libstdc++-v3-dg.exp.patch new file mode 100644 index 00000000..aafc1306 --- /dev/null +++ b/patches/gcc/3.3.2/gcc-3.3-libstdc++-v3-dg.exp.patch @@ -0,0 +1,54 @@ +Without this patch, the command + +RUNTESTFLAGS=--target=powerpc-750-linux-gnu -v -v -v -v make check-target-libstdc++-v3 + +fails in two ways: +1. the -L option meant to locate the testsuite directory is incorrect, and +2. the wrong compiler is invoked, causing all sorts of havoc, not least of which +is the native compiler is invoked when we really wanted to invoke the cross-compiler +we just built. + +Here's an example log of the problem in action. Every testcase fails, this shows just one: +------------- +Invoking the compiler as g++ -ggdb3 -DDEBUG_ASSERT -I/home3/dank/wk/ixos/dap_interim/linux/3rdParty/crosstool/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/libstdc++-v3/testsuite /home3/dank/wk/ixos/dap_interim/linux/3rdParty/crosstool/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/libstdc++-v3/testsuite/20_util/binders.cc -g -O2 -DDEBUG_ASSERT -L/testsuite -lv3test -lm -o ./binders.exe +compiler exited with status 1 +output is: +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_function.h: In method `void binder2nd<mem_fun1_ref_t<void,Elem,int> >::operator ()(const Elem &) const':^M +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_algo.h:83: instantiated from `for_each<Elem *, binder2nd<mem_fun1_ref_t<void,Elem,int> > >(Elem *, Elem *, binder2nd<mem_fun1_ref_t<void,Elem,int> >)'^M +/home3/dank/wk/ixos/dap_interim/linux/3rdParty/crosstool/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/libstdc++-v3/testsuite/20_util/binders.cc:43: instantiated from here^M +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_function.h:224: conversion from `const Elem' to `Elem &' discards qualifiers^M +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_function.h:622: in passing argument 1 of `mem_fun1_ref_t<void,Elem,int>::operator ()(Elem &, int) const'^M +... +FAIL: 20_util/binders.cc (test for excess errors) +WARNING: 20_util/binders.cc compilation failed to produce executable +------------- + +And here's the patch. I'm not happy with it, and it probably gets some cases wrong, +but it seems to work for the common native case and for my cross-compiler case. + +--- gcc-3.3/libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp.old Sun Jul 13 10:42:01 2003 ++++ gcc-3.3/libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp Sun Jul 13 11:39:54 2003 +@@ -46,8 +46,23 @@ + global gluefile wrap_flags + global ld_library_path + global tool_root_dir ++ global target_triplet + + set blddir [lookfor_file [get_multilibs] libstdc++-v3] ++ if { $blddir == "" } { ++ set multilibs [get_multilibs] ++ # FIXME: assume multilib only one level deep ++ set multisub [file tail $multilibs] ++ verbose "libstdc++-v3-init: couldn't find libstdc++-v3 in $multilibs, trying $objdir" ++ set blddir [lookfor_file ${objdir} "$target_triplet/$multisub/libstdc++-v3"] ++ } ++ if { $blddir == "" } { ++ verbose "libstdc++-v3-init: couldn't find libstdc++-v3, trying $objdir without multilibs" ++ set blddir [lookfor_file ${objdir} "$target_triplet/libstdc++-v3"] ++ } ++ if { $blddir == "" } { ++ error "Can't find libstdc++-v3" ++ } + + # By default, we assume we want to run program images. + global dg-do-what-default diff --git a/patches/gcc/3.3.2/gcc-3.3.2-arm-bigendian.patch b/patches/gcc/3.3.2/gcc-3.3.2-arm-bigendian.patch new file mode 100644 index 00000000..9ec6c53c --- /dev/null +++ b/patches/gcc/3.3.2/gcc-3.3.2-arm-bigendian.patch @@ -0,0 +1,65 @@ +By Lennert Buytenhek <buytenh@wantstofly.org> +Adds support for arm*b-linux* big-endian ARM targets + +See http://gcc.gnu.org/PR16350 + +diff -urN gcc-3.3.2.orig/gcc/config/arm/linux-elf.h gcc-3.3.2/gcc/config/arm/linux-elf.h +--- gcc-3.3.2.orig/gcc/config/arm/linux-elf.h 2003-09-16 17:39:23.000000000 +0200 ++++ gcc-3.3.2/gcc/config/arm/linux-elf.h 2004-07-07 14:03:54.329839922 +0200 +@@ -30,15 +30,29 @@ + /* Do not assume anything about header files. */ + #define NO_IMPLICIT_EXTERN_C + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END ++#define TARGET_ENDIAN_OPTION "mbig-endian" ++#define TARGET_LINKER_EMULATION "armelfb_linux" ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#define TARGET_ENDIAN_OPTION "mlittle-endian" ++#define TARGET_LINKER_EMULATION "armelf_linux" ++#endif ++ + /* Default is to use APCS-32 mode. */ + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS) ++#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS | TARGET_ENDIAN_DEFAULT) + +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" } + + #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" + +@@ -86,7 +100,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #define TARGET_OS_CPP_BUILTINS() \ +diff -urN gcc-3.3.2.orig/gcc/config.gcc gcc-3.3.2/gcc/config.gcc +--- gcc-3.3.2.orig/gcc/config.gcc 2003-10-01 21:07:01.000000000 +0200 ++++ gcc-3.3.2/gcc/config.gcc 2004-07-07 14:04:59.046716638 +0200 +@@ -699,6 +699,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + 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" ++ case $machine in ++ arm*b-*) ++ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" ++ ;; ++ esac + tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes diff --git a/patches/gcc/3.3.2/gcc-3.3.2-trap-posix.patch b/patches/gcc/3.3.2/gcc-3.3.2-trap-posix.patch new file mode 100644 index 00000000..c8bc2eae --- /dev/null +++ b/patches/gcc/3.3.2/gcc-3.3.2-trap-posix.patch @@ -0,0 +1,44 @@ +# +# Submitted-By: Marc Kleine-Budde <mkl@pengutronix.de>, 2005-04-20 +# +# Error: +# +# creating libintl.h +# Configuring etc... +# loading cache ../config.cache +# checking for a BSD compatible install... (cached) /usr/bin/install -c +# creating ./config.status +# creating Makefile +# trap: usage: trap [-lp] [[arg] signal_spec ...] +# +# Description: +# +# non-posix conform usage of trap causes bash >= 3.0 to fail +# e.g.: http://sourceware.org/ml/crossgcc/2004-12/msg00132.html +# +# Status: +# +# fixed in gcc >= 3.3.5 +# backport of gcc-3.3.5 fix +# +diff -ruN gcc-3.3.2-orig/configure gcc-3.3.2/configure +--- gcc-3.3.2-orig/configure 2002-09-29 18:11:24.000000000 +0200 ++++ gcc-3.3.2/configure 2005-04-20 20:55:51.000000000 +0200 +@@ -697,7 +697,7 @@ + if test -f skip-this-dir; then + # Perform the same cleanup as the trap handler, minus the "exit 1" of course, + # and reset the trap handler. +- trap 0 ++ trap '' 0 + rm -rf Makefile* ${tmpdir} + # Execute the final clean-up actions + ${config_shell} skip-this-dir +@@ -1596,7 +1596,7 @@ + # Perform the same cleanup as the trap handler, minus the "exit 1" of course, + # and reset the trap handler. + rm -rf ${tmpdir} +-trap 0 ++trap '' 0 + + exit 0 + diff --git a/patches/gcc/3.3.2/pr10392-1-test.patch b/patches/gcc/3.3.2/pr10392-1-test.patch new file mode 120000 index 00000000..f02b235f --- /dev/null +++ b/patches/gcc/3.3.2/pr10392-1-test.patch @@ -0,0 +1 @@ +../3.3.1/pr10392-1-test.patch
\ No newline at end of file diff --git a/patches/gcc/3.3.2/pr10412-1-test.patch b/patches/gcc/3.3.2/pr10412-1-test.patch new file mode 120000 index 00000000..195d7f51 --- /dev/null +++ b/patches/gcc/3.3.2/pr10412-1-test.patch @@ -0,0 +1 @@ +../3.3.1/pr10412-1-test.patch
\ No newline at end of file diff --git a/patches/gcc/3.3.2/pr10589-1-test.patch b/patches/gcc/3.3.2/pr10589-1-test.patch new file mode 120000 index 00000000..b7e0a6b1 --- /dev/null +++ b/patches/gcc/3.3.2/pr10589-1-test.patch @@ -0,0 +1 @@ +../3.3.1/pr10589-1-test.patch
\ No newline at end of file diff --git a/patches/gcc/3.3.2/pr11162-1-test.patch b/patches/gcc/3.3.2/pr11162-1-test.patch new file mode 120000 index 00000000..9f17500b --- /dev/null +++ b/patches/gcc/3.3.2/pr11162-1-test.patch @@ -0,0 +1 @@ +../3.3.1/pr11162-1-test.patch
\ No newline at end of file diff --git a/patches/gcc/3.3.2/pr11587-1-test.patch b/patches/gcc/3.3.2/pr11587-1-test.patch new file mode 120000 index 00000000..cdb9d8ed --- /dev/null +++ b/patches/gcc/3.3.2/pr11587-1-test.patch @@ -0,0 +1 @@ +../3.3.1/pr11587-1-test.patch
\ No newline at end of file diff --git a/patches/gcc/3.3.2/pr11608-fix.patch b/patches/gcc/3.3.2/pr11608-fix.patch new file mode 100644 index 00000000..b435126b --- /dev/null +++ b/patches/gcc/3.3.2/pr11608-fix.patch @@ -0,0 +1,31 @@ +pr11608 + +------------ +I'm building and testing an x86->sh4 crosscompiler with http://kegel.com/crosstool +With either gcc-3.3 or gcc-ss-3_3-20030714 I get: + +Testing debug/20020327-1.c, -gstabs1 +... +FAIL: gcc.dg/debug/20020327-1.c (test for excess errors) +Excess errors: +/tmp/cc8dFF7Y.s: Assembler messages: +/tmp/cc8dFF7Y.s:66: Error: symbol `Letext' is already defined + +------------ + +Index: elf.h +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/config/sh/elf.h,v +retrieving revision 1.32 +diff -u -p -r1.32 elf.h +--- gcc-orig/gcc/config/sh/elf.h 27 Sep 2003 04:48:28 -0000 1.32 ++++ gcc-new/gcc/config/sh/elf.h 2 Jan 2004 07:23:23 -0000 +@@ -95,7 +95,7 @@ while (0) + #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \ + do { \ + text_section (); \ +- fprintf ((FILE), "\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO); \ ++ asm_fprintf ((FILE), "\t.stabs \"\",%d,0,0,%LLetext\n%LLetext:\n", N_SO); \ + } while (0) + + #undef STARTFILE_SPEC diff --git a/patches/gcc/3.3.2/pr11736-1-test.patch b/patches/gcc/3.3.2/pr11736-1-test.patch new file mode 120000 index 00000000..04a0841c --- /dev/null +++ b/patches/gcc/3.3.2/pr11736-1-test.patch @@ -0,0 +1 @@ +../3.3.1/pr11736-1-test.patch
\ No newline at end of file diff --git a/patches/gcc/3.3.2/pr11864-1-test.patch b/patches/gcc/3.3.2/pr11864-1-test.patch new file mode 120000 index 00000000..b40aaa0a --- /dev/null +++ b/patches/gcc/3.3.2/pr11864-1-test.patch @@ -0,0 +1 @@ +../3.3.1/pr11864-1-test.patch
\ No newline at end of file diff --git a/patches/gcc/3.3.2/pr13260-test.patch b/patches/gcc/3.3.2/pr13260-test.patch new file mode 100644 index 00000000..d9cc3e45 --- /dev/null +++ b/patches/gcc/3.3.2/pr13260-test.patch @@ -0,0 +1,56 @@ +See http://gcc.gnu.org/PR13260 + +/cvs/gcc/gcc/gcc/testsuite/gcc.c-torture/execute/20031204-1.c,v --> standard output +revision 1.1 +--- - 1970-01-01 00:00:00.000000000 +0000 ++++ gcc/gcc/testsuite/gcc.c-torture/execute/20031204-1.c +@@ -0,0 +1,49 @@ ++/* PR optimization/13260 */ ++ ++#include <string.h> ++ ++typedef unsigned long u32; ++ ++u32 in_aton(const char* x) ++{ ++ return 0x0a0b0c0d; ++} ++ ++u32 root_nfs_parse_addr(char *name) ++{ ++ u32 addr; ++ int octets = 0; ++ char *cp, *cq; ++ ++ cp = cq = name; ++ while (octets < 4) { ++ while (*cp >= '0' && *cp <= '9') ++ cp++; ++ if (cp == cq || cp - cq > 3) ++ break; ++ if (*cp == '.' || octets == 3) ++ octets++; ++ if (octets < 4) ++ cp++; ++ cq = cp; ++ } ++ ++ if (octets == 4 && (*cp == ':' || *cp == '\0')) { ++ if (*cp == ':') ++ *cp++ = '\0'; ++ addr = in_aton(name); ++ strcpy(name, cp); ++ } else ++ addr = (-1); ++ ++ return addr; ++} ++ ++int ++main() ++{ ++ static char addr[] = "10.11.12.13:/hello"; ++ u32 result = root_nfs_parse_addr(addr); ++ if (result != 0x0a0b0c0d) { abort(); } ++ return 0; ++} diff --git a/patches/gcc/3.3.2/pr9365-1-test.patch b/patches/gcc/3.3.2/pr9365-1-test.patch new file mode 120000 index 00000000..a8eee166 --- /dev/null +++ b/patches/gcc/3.3.2/pr9365-1-test.patch @@ -0,0 +1 @@ +../3.3.1/pr9365-1-test.patch
\ No newline at end of file diff --git a/patches/gcc/3.3.2/sh-lib1funcs_sizeAndType.patch b/patches/gcc/3.3.2/sh-lib1funcs_sizeAndType.patch new file mode 100644 index 00000000..5c1895a4 --- /dev/null +++ b/patches/gcc/3.3.2/sh-lib1funcs_sizeAndType.patch @@ -0,0 +1,610 @@ +Fixes the problem + [ libdemo.so and main.o both use assignment on structures ] + $ sh4-unknown-linux-gnu-gcc libdemo.so main.o + sh4-unknown-linux-gnu/bin/ld: warning: type and size of dynamic symbol `__movstr_i4_even' are not defined + [ resulting app links, but crashes at runtime ] +See testcase at http://tsukuba.m17n.org/linux-sh/ml/linux-sh/2003-11/msg00016.html + +Patch was posted as http://gcc.gnu.org/ml/gcc-patches/2002-11/msg01641.html +and is in cvs as http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/lib1funcs.asm.diff?r1=1.29.4.1&r2=1.29.4.2 + +but see also sh-libgcc-hidden.patch + +=================================================================== + +--- gcc/gcc/config/sh/lib1funcs.asm 2002/09/20 01:29:21 1.29.4.1 ++++ gcc/gcc/config/sh/lib1funcs.asm 2003/11/18 12:27:31 +@@ -38,9 +38,14 @@ + amylaar@cygnus.com */ + + #ifdef __ELF__ +-#define LOCAL(X) .L_##X +-#else +-#define LOCAL(X) L_##X ++#define LOCAL(X) .L_##X ++#define FUNC(X) .type X,@function ++#define ENDFUNC0(X) .Lfe_##X: .size X,.Lfe_##X-X ++#define ENDFUNC(X) ENDFUNC0(X) ++#else ++#define LOCAL(X) L_##X ++#define FUNC(X) ++#define ENDFUNC(X) + #endif + + #define CONCAT(A,B) A##B +@@ -87,6 +92,40 @@ + .global GLOBAL(ashiftrt_r4_31) + .global GLOBAL(ashiftrt_r4_32) + ++ FUNC(GLOBAL(ashiftrt_r4_0)) ++ FUNC(GLOBAL(ashiftrt_r4_1)) ++ FUNC(GLOBAL(ashiftrt_r4_2)) ++ FUNC(GLOBAL(ashiftrt_r4_3)) ++ FUNC(GLOBAL(ashiftrt_r4_4)) ++ FUNC(GLOBAL(ashiftrt_r4_5)) ++ FUNC(GLOBAL(ashiftrt_r4_6)) ++ FUNC(GLOBAL(ashiftrt_r4_7)) ++ FUNC(GLOBAL(ashiftrt_r4_8)) ++ FUNC(GLOBAL(ashiftrt_r4_9)) ++ FUNC(GLOBAL(ashiftrt_r4_10)) ++ FUNC(GLOBAL(ashiftrt_r4_11)) ++ FUNC(GLOBAL(ashiftrt_r4_12)) ++ FUNC(GLOBAL(ashiftrt_r4_13)) ++ FUNC(GLOBAL(ashiftrt_r4_14)) ++ FUNC(GLOBAL(ashiftrt_r4_15)) ++ FUNC(GLOBAL(ashiftrt_r4_16)) ++ FUNC(GLOBAL(ashiftrt_r4_17)) ++ FUNC(GLOBAL(ashiftrt_r4_18)) ++ FUNC(GLOBAL(ashiftrt_r4_19)) ++ FUNC(GLOBAL(ashiftrt_r4_20)) ++ FUNC(GLOBAL(ashiftrt_r4_21)) ++ FUNC(GLOBAL(ashiftrt_r4_22)) ++ FUNC(GLOBAL(ashiftrt_r4_23)) ++ FUNC(GLOBAL(ashiftrt_r4_24)) ++ FUNC(GLOBAL(ashiftrt_r4_25)) ++ FUNC(GLOBAL(ashiftrt_r4_26)) ++ FUNC(GLOBAL(ashiftrt_r4_27)) ++ FUNC(GLOBAL(ashiftrt_r4_28)) ++ FUNC(GLOBAL(ashiftrt_r4_29)) ++ FUNC(GLOBAL(ashiftrt_r4_30)) ++ FUNC(GLOBAL(ashiftrt_r4_31)) ++ FUNC(GLOBAL(ashiftrt_r4_32)) ++ + .align 1 + GLOBAL(ashiftrt_r4_32): + GLOBAL(ashiftrt_r4_31): +@@ -166,6 +205,40 @@ + GLOBAL(ashiftrt_r4_0): + rts + nop ++ ++ ENDFUNC(GLOBAL(ashiftrt_r4_0)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_1)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_2)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_3)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_4)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_5)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_6)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_7)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_8)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_9)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_10)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_11)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_12)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_13)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_14)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_15)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_16)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_17)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_18)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_19)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_20)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_21)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_22)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_23)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_24)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_25)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_26)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_27)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_28)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_29)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_30)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_31)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_32)) + #endif + + #ifdef L_ashiftrt_n +@@ -188,6 +261,7 @@ + ! + + .global GLOBAL(ashrsi3) ++ FUNC(GLOBAL(ashrsi3)) + .align 2 + GLOBAL(ashrsi3): + mov #31,r0 +@@ -315,6 +389,7 @@ + rts + nop + ++ ENDFUNC(GLOBAL(ashrsi3)) + #endif + + #ifdef L_ashiftlt +@@ -336,6 +411,7 @@ + ! (none) + ! + .global GLOBAL(ashlsi3) ++ FUNC(GLOBAL(ashlsi3)) + .align 2 + GLOBAL(ashlsi3): + mov #31,r0 +@@ -472,6 +548,7 @@ + rts + nop + ++ ENDFUNC(GLOBAL(ashlsi3)) + #endif + + #ifdef L_lshiftrt +@@ -493,6 +570,7 @@ + ! (none) + ! + .global GLOBAL(lshrsi3) ++ FUNC(GLOBAL(lshrsi3)) + .align 2 + GLOBAL(lshrsi3): + mov #31,r0 +@@ -629,6 +707,7 @@ + rts + nop + ++ ENDFUNC(GLOBAL(lshrsi3)) + #endif + + #ifdef L_movstr +@@ -645,76 +724,113 @@ + add #64,r4 + .align 4 + .global GLOBAL(movstrSI64) ++ FUNC(GLOBAL(movstrSI64)) + GLOBAL(movstrSI64): + mov.l @(60,r5),r0 + mov.l r0,@(60,r4) + .global GLOBAL(movstrSI60) ++ FUNC(GLOBAL(movstrSI60)) + GLOBAL(movstrSI60): + mov.l @(56,r5),r0 + mov.l r0,@(56,r4) + .global GLOBAL(movstrSI56) ++ FUNC(GLOBAL(movstrSI56)) + GLOBAL(movstrSI56): + mov.l @(52,r5),r0 + mov.l r0,@(52,r4) + .global GLOBAL(movstrSI52) ++ FUNC(GLOBAL(movstrSI52)) + GLOBAL(movstrSI52): + mov.l @(48,r5),r0 + mov.l r0,@(48,r4) + .global GLOBAL(movstrSI48) ++ FUNC(GLOBAL(movstrSI48)) + GLOBAL(movstrSI48): + mov.l @(44,r5),r0 + mov.l r0,@(44,r4) + .global GLOBAL(movstrSI44) ++ FUNC(GLOBAL(movstrSI44)) + GLOBAL(movstrSI44): + mov.l @(40,r5),r0 + mov.l r0,@(40,r4) + .global GLOBAL(movstrSI40) ++ FUNC(GLOBAL(movstrSI40)) + GLOBAL(movstrSI40): + mov.l @(36,r5),r0 + mov.l r0,@(36,r4) + .global GLOBAL(movstrSI36) ++ FUNC(GLOBAL(movstrSI36)) + GLOBAL(movstrSI36): + mov.l @(32,r5),r0 + mov.l r0,@(32,r4) + .global GLOBAL(movstrSI32) ++ FUNC(GLOBAL(movstrSI32)) + GLOBAL(movstrSI32): + mov.l @(28,r5),r0 + mov.l r0,@(28,r4) + .global GLOBAL(movstrSI28) ++ FUNC(GLOBAL(movstrSI28)) + GLOBAL(movstrSI28): + mov.l @(24,r5),r0 + mov.l r0,@(24,r4) + .global GLOBAL(movstrSI24) ++ FUNC(GLOBAL(movstrSI24)) + GLOBAL(movstrSI24): + mov.l @(20,r5),r0 + mov.l r0,@(20,r4) + .global GLOBAL(movstrSI20) ++ FUNC(GLOBAL(movstrSI20)) + GLOBAL(movstrSI20): + mov.l @(16,r5),r0 + mov.l r0,@(16,r4) + .global GLOBAL(movstrSI16) ++ FUNC(GLOBAL(movstrSI16)) + GLOBAL(movstrSI16): + mov.l @(12,r5),r0 + mov.l r0,@(12,r4) + .global GLOBAL(movstrSI12) ++ FUNC(GLOBAL(movstrSI12)) + GLOBAL(movstrSI12): + mov.l @(8,r5),r0 + mov.l r0,@(8,r4) + .global GLOBAL(movstrSI8) ++ FUNC(GLOBAL(movstrSI8)) + GLOBAL(movstrSI8): + mov.l @(4,r5),r0 + mov.l r0,@(4,r4) + .global GLOBAL(movstrSI4) ++ FUNC(GLOBAL(movstrSI4)) + GLOBAL(movstrSI4): + mov.l @(0,r5),r0 + mov.l r0,@(0,r4) ++ .global GLOBAL(movstrSI0) ++ FUNC(GLOBAL(movstrSI0)) + GLOBAL(movstrSI0): + rts + nop + ++ ENDFUNC(GLOBAL(movstrSI64)) ++ ENDFUNC(GLOBAL(movstrSI60)) ++ ENDFUNC(GLOBAL(movstrSI56)) ++ ENDFUNC(GLOBAL(movstrSI52)) ++ ENDFUNC(GLOBAL(movstrSI48)) ++ ENDFUNC(GLOBAL(movstrSI44)) ++ ENDFUNC(GLOBAL(movstrSI40)) ++ ENDFUNC(GLOBAL(movstrSI36)) ++ ENDFUNC(GLOBAL(movstrSI32)) ++ ENDFUNC(GLOBAL(movstrSI28)) ++ ENDFUNC(GLOBAL(movstrSI24)) ++ ENDFUNC(GLOBAL(movstrSI20)) ++ ENDFUNC(GLOBAL(movstrSI16)) ++ ENDFUNC(GLOBAL(movstrSI12)) ++ ENDFUNC(GLOBAL(movstrSI8)) ++ ENDFUNC(GLOBAL(movstrSI4)) ++ ENDFUNC(GLOBAL(movstrSI0)) ++ + .align 4 + + .global GLOBAL(movstr) ++ FUNC(GLOBAL(movstr)) + GLOBAL(movstr): + mov.l @(60,r5),r0 + mov.l r0,@(60,r4) +@@ -771,6 +887,8 @@ + add #64,r5 + bra GLOBAL(movstr) + add #64,r4 ++ ++ FUNC(GLOBAL(movstr)) + #endif + + #ifdef L_movstr_i4 +@@ -779,6 +897,10 @@ + .global GLOBAL(movstr_i4_odd) + .global GLOBAL(movstrSI12_i4) + ++ FUNC(GLOBAL(movstr_i4_even)) ++ FUNC(GLOBAL(movstr_i4_odd)) ++ FUNC(GLOBAL(movstrSI12_i4)) ++ + .p2align 5 + L_movstr_2mod4_end: + mov.l r0,@(16,r4) +@@ -787,6 +909,11 @@ + + .p2align 2 + ++GLOBAL(movstr_i4_even): ++ mov.l @r5+,r0 ++ bra L_movstr_start_even ++ mov.l @r5+,r1 ++ + GLOBAL(movstr_i4_odd): + mov.l @r5+,r1 + add #-4,r4 +@@ -813,10 +940,8 @@ + rts + mov.l r3,@(12,r4) + +-GLOBAL(movstr_i4_even): +- mov.l @r5+,r0 +- bra L_movstr_start_even +- mov.l @r5+,r1 ++ ENDFUNC(GLOBAL(movstr_i4_even)) ++ ENDFUNC(GLOBAL(movstr_i4_odd)) + + .p2align 4 + GLOBAL(movstrSI12_i4): +@@ -827,12 +952,15 @@ + mov.l r1,@(4,r4) + rts + mov.l r2,@(8,r4) ++ ++ ENDFUNC(GLOBAL(movstrSI12_i4)) + #endif + + #ifdef L_mulsi3 + + + .global GLOBAL(mulsi3) ++ FUNC(GLOBAL(mulsi3)) + + ! r4 = aabb + ! r5 = ccdd +@@ -865,7 +993,7 @@ + rts + add r2,r0 + +- ++ FUNC(GLOBAL(mulsi3)) + #endif + #endif /* ! __SH5__ */ + #ifdef L_sdivsi3_i4 +@@ -875,6 +1003,7 @@ + !! args in r4 and r5, result in fpul, clobber dr0, dr2 + + .global GLOBAL(sdivsi3_i4) ++ FUNC(GLOBAL(sdivsi3_i4)) + GLOBAL(sdivsi3_i4): + lds r4,fpul + float fpul,dr0 +@@ -884,6 +1013,7 @@ + rts + ftrc dr0,fpul + ++ ENDFUNC(GLOBAL(sdivsi3_i4)) + #elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__) || (defined (__SH5__) && ! defined __SH4_NOFPU__) + !! args in r4 and r5, result in fpul, clobber r2, dr0, dr2 + +@@ -892,6 +1022,7 @@ + .mode SHcompact + #endif + .global GLOBAL(sdivsi3_i4) ++ FUNC(GLOBAL(sdivsi3_i4)) + GLOBAL(sdivsi3_i4): + sts.l fpscr,@-r15 + mov #8,r2 +@@ -906,6 +1037,7 @@ + rts + lds.l @r15+,fpscr + ++ ENDFUNC(GLOBAL(sdivsi3_i4)) + #endif /* ! __SH5__ || __SH5__ == 32 */ + #endif /* ! __SH4__ */ + #endif +@@ -920,9 +1052,10 @@ + !! + !! + +-!! args in r4 and r5, result in r0 clobber r1,r2,r3 ++!! args in r4 and r5, result in r0 clobber r1, r2, r3, and t bit + + .global GLOBAL(sdivsi3) ++ FUNC(GLOBAL(sdivsi3)) + #if __SHMEDIA__ + #if __SH5__ == 32 + .section .text..SHmedia32,"ax" +@@ -1166,6 +1299,7 @@ + div0: rts + mov #0,r0 + ++ ENDFUNC(GLOBAL(sdivsi3)) + #endif /* ! __SHMEDIA__ */ + #endif /* ! __SH4__ */ + #endif +@@ -1174,9 +1308,11 @@ + .title "SH DIVIDE" + !! 4 byte integer Divide code for the Hitachi SH + #ifdef __SH4__ +-!! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4 ++!! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4, ++!! and t bit + + .global GLOBAL(udivsi3_i4) ++ FUNC(GLOBAL(udivsi3_i4)) + GLOBAL(udivsi3_i4): + mov #1,r1 + cmp/hi r1,r5 +@@ -1217,11 +1353,13 @@ + L1: + .double 2147483648 + ++ ENDFUNC(GLOBAL(udivsi3_i4)) + #elif defined (__SH5__) && ! defined (__SH4_NOFPU__) + #if ! __SH5__ || __SH5__ == 32 + !! args in r4 and r5, result in fpul, clobber r20, r21, dr0, fr33 + .mode SHmedia + .global GLOBAL(udivsi3_i4) ++ FUNC(GLOBAL(udivsi3_i4)) + GLOBAL(udivsi3_i4): + addz.l r4,r63,r20 + addz.l r5,r63,r21 +@@ -1234,6 +1372,8 @@ + ftrc.dq dr0,dr32 + fmov.s fr33,fr32 + blink tr0,r63 ++ ++ ENDFUNC(GLOBAL(udivsi3_i4)) + #endif /* ! __SH5__ || __SH5__ == 32 */ + #elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__) + !! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4 +@@ -1287,6 +1427,7 @@ + #endif + .double 2147483648 + ++ ENDFUNC(GLOBAL(udivsi3_i4)) + #endif /* ! __SH4__ */ + #endif + +@@ -1297,6 +1438,7 @@ + + !! args in r4 and r5, result in r0, clobbers r4, pr, and t bit + .global GLOBAL(udivsi3) ++ FUNC(GLOBAL(udivsi3)) + + #if __SHMEDIA__ + #if __SH5__ == 32 +@@ -1485,6 +1627,7 @@ + rts + rotcl r0 + ++ ENDFUNC(GLOBAL(udivsi3)) + #endif /* ! __SHMEDIA__ */ + #endif /* __SH4__ */ + #endif /* L_udivsi3 */ +@@ -1790,6 +1933,7 @@ + .mode SHcompact + #endif + .global GLOBAL(set_fpscr) ++ FUNC(GLOBAL(set_fpscr)) + GLOBAL(set_fpscr): + lds r4,fpscr + mov.l LOCAL(set_fpscr_L1),r1 +@@ -1822,6 +1966,8 @@ + .align 2 + LOCAL(set_fpscr_L1): + .long GLOBAL(fpscr_values) ++ ++ ENDFUNC(GLOBAL(set_fpscr)) + #ifdef __ELF__ + .comm GLOBAL(fpscr_values),8,4 + #else +@@ -1860,6 +2006,7 @@ + blink tr0, r63 + #elif defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) + .global GLOBAL(ic_invalidate) ++ FUNC(GLOBAL(ic_invalidate)) + GLOBAL(ic_invalidate): + ocbwb @r4 + mova 0f,r0 +@@ -1882,6 +2029,8 @@ + nop + .endr + .endr ++ ++ ENDFUNC(GLOBAL(ic_invalidate)) + #endif /* SH4 */ + #endif /* L_ic_invalidate */ + +@@ -1940,6 +2089,7 @@ + will be expanded into r2/r3 upon return. */ + + .global GLOBAL(GCC_shcompact_call_trampoline) ++ FUNC(GLOBAL(GCC_shcompact_call_trampoline)) + GLOBAL(GCC_shcompact_call_trampoline): + ptabs/l r0, tr0 /* Prepare to call the actual function. */ + movi ((datalabel LOCAL(ct_main_table) - 31 * 2) >> 16) & 65535, r0 +@@ -2290,6 +2440,8 @@ + shari r2, 32, r2 + #endif + blink tr0, r63 ++ ++ ENDFUNC(GLOBAL(GCC_shcompact_call_trampoline)) + #endif /* L_shcompact_call_trampoline */ + + #ifdef L_shcompact_return_trampoline +@@ -2302,6 +2454,7 @@ + .section .text..SHmedia32, "ax" + .align 2 + .global GLOBAL(GCC_shcompact_return_trampoline) ++ FUNC(GLOBAL(GCC_shcompact_return_trampoline)) + GLOBAL(GCC_shcompact_return_trampoline): + ptabs/l r18, tr0 + #if __LITTLE_ENDIAN__ +@@ -2313,6 +2466,8 @@ + #endif + or r3, r2, r2 + blink tr0, r63 ++ ++ ENDFUNC(GLOBAL(GCC_shcompact_return_trampoline)) + #endif /* L_shcompact_return_trampoline */ + + #ifdef L_shcompact_incoming_args +@@ -2367,6 +2522,7 @@ + actual bit pattern. */ + + .global GLOBAL(GCC_shcompact_incoming_args) ++ FUNC(GLOBAL(GCC_shcompact_incoming_args)) + GLOBAL(GCC_shcompact_incoming_args): + ptabs/l r18, tr0 /* Prepare to return. */ + shlri r17, 32, r0 /* Load the cookie. */ +@@ -2519,6 +2675,7 @@ + LOCAL(ia_return): /* Return. */ + blink tr0, r63 + LOCAL(ia_end_of_push_seq): /* Label used to compute the first push instruction. */ ++ ENDFUNC(GLOBAL(GCC_shcompact_incoming_args)) + #endif /* L_shcompact_incoming_args */ + #endif + #if __SH5__ +@@ -2530,6 +2687,7 @@ + #endif + .align 3 /* It is copied in units of 8 bytes in SHmedia mode. */ + .global GLOBAL(GCC_nested_trampoline) ++ FUNC(GLOBAL(GCC_nested_trampoline)) + GLOBAL(GCC_nested_trampoline): + .mode SHmedia + ptrel/u r63, tr0 +@@ -2546,6 +2704,8 @@ + ld.l r0, 28, r1 + #endif + blink tr1, r63 ++ ++ ENDFUNC(GLOBAL(GCC_nested_trampoline)) + #endif /* L_nested_trampoline */ + #endif /* __SH5__ */ + #if __SH5__ == 32 +@@ -2555,6 +2715,7 @@ + .align 2 + #ifndef __SH4_NOFPU__ + .global GLOBAL(GCC_push_shmedia_regs) ++ FUNC(GLOBAL(GCC_push_shmedia_regs)) + GLOBAL(GCC_push_shmedia_regs): + addi.l r15, -14*8, r15 + fst.d r15, 13*8, dr62 +@@ -2573,6 +2734,7 @@ + fst.d r15, 0*8, dr36 + #endif + .global GLOBAL(GCC_push_shmedia_regs_nofpu) ++ FUNC(GLOBAL(GCC_push_shmedia_regs_nofpu)) + GLOBAL(GCC_push_shmedia_regs_nofpu): + ptabs/l r18, tr0 + addi.l r15, -27*8, r15 +@@ -2608,8 +2770,13 @@ + st.q r15, 0*8, r28 + blink tr0, r63 + ++#ifndef __SH4_NOFPU__ ++ ENDFUNC(GLOBAL(GCC_push_shmedia_regs)) ++#endif ++ ENDFUNC(GLOBAL(GCC_push_shmedia_regs_nofpu)) + #ifndef __SH4_NOFPU__ + .global GLOBAL(GCC_pop_shmedia_regs) ++ FUNC(GLOBAL(GCC_pop_shmedia_regs)) + GLOBAL(GCC_pop_shmedia_regs): + pt .L0, tr1 + movi 41*8, r0 +@@ -2630,6 +2797,7 @@ + blink tr1, r63 + #endif + .global GLOBAL(GCC_pop_shmedia_regs_nofpu) ++ FUNC(GLOBAL(GCC_pop_shmedia_regs_nofpu)) + GLOBAL(GCC_pop_shmedia_regs_nofpu): + movi 27*8, r0 + .L0: +@@ -2666,5 +2834,10 @@ + ld.q r15, 0*8, r28 + add.l r15, r0, r15 + blink tr0, r63 ++ ++#ifndef __SH4_NOFPU__ ++ ENDFUNC(GLOBAL(GCC_pop_shmedia_regs)) ++#endif ++ ENDFUNC(GLOBAL(GCC_pop_shmedia_regs_nofpu)) + #endif /* __SH5__ == 32 */ + #endif /* L_push_pop_shmedia_regs */ diff --git a/patches/gcc/3.3.2/sh-libgcc-hidden.patch b/patches/gcc/3.3.2/sh-libgcc-hidden.patch new file mode 100644 index 00000000..adccc0e2 --- /dev/null +++ b/patches/gcc/3.3.2/sh-libgcc-hidden.patch @@ -0,0 +1,122 @@ +[adjusted very slightly to apply to gcc-3.3.2 - dank] + +From: kaz Kojima <kkojima@rr.iij4u.or.jp> + +I've noticed one more problem about this issue. In the testcase given +by ZhouChang, libdemo.so exports __movstr_i4_even which is a function +in libgcc.a. This itself is not a problem but it means that some functions +in libgcc.a which should not be exported from shared objects might be +exported from shared libs + +Date: Wed, 19 Nov 2003 09:04:12 +0900 (JST) +From: kaz Kojima <kkojima@rr.iij4u.or.jp> +Subject: [linux-sh:03096] Re: [linux] Re: About tool chain in + http://kegel.com/crosstool/ +To: dank@kegel.com +Cc: zjuzhou@yahoo.com.cn, linux-sh@m17n.org, zhan_sh@yahoo.com.cn, + crossgcc@sources.redhat.com +Message-Id: <20031119.090412.85413542.kkojima@rr.iij4u.or.jp> + +Hi, + +Dan Kegel <dank@kegel.com> wrote: +> I'll try that, thanks. I notice that the '.hidden' isn't in cvs yet. +> I also notice you've been trying to get that into CVS for two years +> now (http://gcc.gnu.org/ml/gcc-patches/2001-10/msg00053.html). +> Time for another try? It'd be nice if gcc-3.4 (and maybe even gcc-3.3.3) +> didn't need a patch for this. + +The situation is a bit complicated. sh-linux target doesn't make +shared libgcc in gcc-3.3.x. +OTOH, I withdrew that .hidden patch because gcc-3.3 has a general +mechanism to make all libgcc functions .hidden. But I missed that +that mechanism was conditionalized later so that it's done only +when the target creates the shared libgcc. +In 3.4, sh-linux target becomes to use the shared libgcc like as +all other linux targets, so there is no problem. + +I inclined to backport 3.4 shared libgcc stuff to 3.3.3 rather +than the old .hidden patch. How do you think about it? +I'm happy if you or ZhouChang create a PR on gcc bugzilla about +this issue. + +Regards, + kaz +-- + This is a backport of 3.4 shared libgcc stuff to 3.3 branch. + * config.gcc (sh*-*-linux*): Add t-slibgcc-elf-ver and t-linux. + to tmake_file. * config/sh/libgcc-glibc.ver: New file. + * config/sh/t-linux (SHLIB_LINK): Override to use a linker script + libgcc_s.so. + (SHLIB_INSTALL): Likewise. + +diff -u3prN ORIG/gcc-3.3/gcc/config/sh/libgcc-glibc.ver gcc-3.3/gcc/config/sh/libgcc-glibc.ver +--- ORIG/gcc-3.3/gcc/config/sh/libgcc-glibc.ver Thu Jan 1 09:00:00 1970 ++++ gcc-3.3/gcc/config/sh/libgcc-glibc.ver Wed Nov 19 08:15:16 2003 +@@ -0,0 +1,21 @@ ++# In order to work around the very problems that force us to now generally ++# create a libgcc.so, glibc reexported a number of routines from libgcc.a. ++# By now choosing the same version tags for these specific routines, we ++# maintain enough binary compatibility to allow future versions of glibc ++# to defer implementation of these routines to libgcc.so via DT_AUXILIARY. ++ ++# Note that we cannot use the default libgcc-glibc.ver file on sh, ++# because GLIBC_2.0 does not exist on this architecture, as the first ++# ever glibc release on the platform was GLIBC_2.2. ++ ++%inherit GCC_3.0 GLIBC_2.2 ++GLIBC_2.2 { ++ __register_frame ++ __register_frame_table ++ __deregister_frame ++ __register_frame_info ++ __deregister_frame_info ++ __frame_state_for ++ __register_frame_info_table ++} ++ +diff -u3prN ORIG/gcc-3.3/gcc/config/sh/t-linux gcc-3.3/gcc/config/sh/t-linux +--- ORIG/gcc-3.3/gcc/config/sh/t-linux Fri Jun 6 11:07:14 2003 ++++ gcc-3.3/gcc/config/sh/t-linux Wed Nov 19 08:09:26 2003 +@@ -12,3 +12,27 @@ MULTILIB_MATCHES = + MULTILIB_EXCEPTIONS= + + EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o ++ ++# Override t-slibgcc-elf-ver to export some libgcc symbols with ++# the symbol versions that glibc used. ++SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver $(srcdir)/config/sh/libgcc-glibc.ver ++ ++# Override SHLIB_LINK and SHLIB_INSTALL to use linker script ++# libgcc_s.so. ++SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \ ++ -Wl,--soname=$(SHLIB_SONAME) \ ++ -Wl,--version-script=$(SHLIB_MAP) \ ++ -o $(SHLIB_NAME) @multilib_flags@ $(SHLIB_OBJS) $(SHLIB_LC) && \ ++ rm -f $(SHLIB_SOLINK) && \ ++ (echo "/* GNU ld script"; \ ++ echo " Use the shared library, but some functions are only in"; \ ++ echo " the static library. */"; \ ++ echo "GROUP ( $(SHLIB_SONAME) libgcc.a )" \ ++ ) > $(SHLIB_SOLINK) ++SHLIB_INSTALL = \ ++ $$(SHELL) $$(srcdir)/mkinstalldirs $$(slibdir)$(SHLIB_SLIBDIR_QUAL); \ ++ $(INSTALL_DATA) $(SHLIB_NAME) \ ++ $$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SONAME); \ ++ rm -f $$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK); \ ++ $(INSTALL_DATA) $(SHLIB_SOLINK) \ ++ $$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK) +diff -u3prN ORIG/gcc-3.3/gcc/config.gcc gcc-3.3/gcc/config.gcc +--- ORIG/gcc-3.3/gcc/config.gcc Sat Aug 9 07:19:07 2003 ++++ gcc-3.3/gcc/config.gcc Wed Nov 19 08:07:53 2003 +@@ -2308,7 +2308,7 @@ sh-*-rtems*) + fi + ;; + sh-*-linux* | sh[2346lbe]*-*-linux*) +- tmake_file="sh/t-sh sh/t-elf" ++ tmake_file="sh/t-sh sh/t-elf t-slibgcc-elf-ver t-linux" + case $machine in + sh*be-*-* | sh*eb-*-*) ;; + *) + + diff --git a/patches/gcc/3.3.2/sh-pic-set_fpscr-gcc-3.3.2.patch b/patches/gcc/3.3.2/sh-pic-set_fpscr-gcc-3.3.2.patch new file mode 100644 index 00000000..2a9d592b --- /dev/null +++ b/patches/gcc/3.3.2/sh-pic-set_fpscr-gcc-3.3.2.patch @@ -0,0 +1,67 @@ +See http://gcc.gnu.org/PR11901 +Should fix +make[2]: *** [/gcc-3.3-glibc-2.3.2/build-glibc/elf/check-textrel.out] Error 1 +in glibc's "make tests". + +Note: this patch is named +sh-pic-set_fpscr-gcc-3.3.2.patch +and must be applied after +sh-lib1funcs_sizeAndType.patch +but that'll happen naturally if you apply them in alphabetical order. + +------------- + +Date: Wed, 30 Jul 2003 12:03:01 +0900 +From: kaz Kojima <kkojima@rr.iij4u.or.jp> +Subject: [linux-sh:02916] Re: Writing PIC version of __udivsi3_i4? (was: Re: "make tests" fails + with "libc.so: text relocations used" in glibc-2.3.2 for sh4) +To: dank@kegel.com +Cc: linux-sh@m17n.org +Message-Id: <200307300255.h6U2tB906928@r-rr.iij4u.or.jp> + +> I'll try to write the PIC version of it, + +Dan, does the attached patch work for you? + +Regards, + kaz +-- +diff -u3prN ORIG/gcc/gcc/config/sh/lib1funcs.asm LOCAL/gcc/gcc/config/sh/lib1funcs.asm +--- ORIG/gcc/gcc/config/sh/lib1funcs.asm Thu Jun 19 07:38:59 2003 ++++ gcc-3.3.2/gcc/config/sh/lib1funcs.asm Wed Jul 30 11:08:49 2003 +@@ -1936,7 +1944,17 @@ GLOBAL(moddi3): + FUNC(GLOBAL(set_fpscr)) + GLOBAL(set_fpscr): + lds r4,fpscr ++#ifdef __PIC__ ++ mov.l r12,@-r15 ++ mova LOCAL(set_fpscr_L0),r0 ++ mov.l LOCAL(set_fpscr_L0),r12 ++ add r0,r12 ++ mov.l LOCAL(set_fpscr_L1),r0 ++ mov.l @(r0,r12),r1 ++ mov.l @r15+,r12 ++#else + mov.l LOCAL(set_fpscr_L1),r1 ++#endif + swap.w r4,r0 + or #24,r0 + #ifndef FMOVD_WORKS +@@ -1964,8 +1982,15 @@ GLOBAL(set_fpscr): + mov.l r3,@(4,r1) + #endif + .align 2 ++#ifdef __PIC__ ++LOCAL(set_fpscr_L0): ++ .long _GLOBAL_OFFSET_TABLE_ ++LOCAL(set_fpscr_L1): ++ .long GLOBAL(fpscr_values@GOT) ++#else + LOCAL(set_fpscr_L1): + .long GLOBAL(fpscr_values) ++#endif + + ENDFUNC(GLOBAL(set_fpscr)) + #ifndef NO_FPSCR_VALUES + + diff --git a/patches/gcc/3.3.2/thunk3.patch b/patches/gcc/3.3.2/thunk3.patch new file mode 100644 index 00000000..7974a0c0 --- /dev/null +++ b/patches/gcc/3.3.2/thunk3.patch @@ -0,0 +1,23 @@ +Fixes +FAIL: g++.jason/thunk3.C (test for excess errors) +on sh4-unknown-linux-gnu. + +Does any sh variant *not* use the generic thunk support? If so, the patch should be +more cautious. As it is, it excludes all sh processors from this test. + +Index: thunk3.C +=================================================================== +RCS file: /cvsroot/gcc/gcc/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C,v +retrieving revision 1.13 +diff -u -d -u -r1.13 thunk3.C +--- gcc-ss-3_3-20030714/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C.old 25 Mar 2002 17:57:03 -0000 1.13 ++++ gcc-ss-3_3-20030714/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C 20 Jul 2003 16:57:38 -0000 +@@ -2,7 +2,7 @@ + // Note that this will break on any target that uses the generic thunk + // support, because it doesn't support variadic functions. + +-// excess errors test - XFAIL mips*-*-* rs6000-*-* powerpc-*-eabi m68k-*-coff m68k-motorola-sysv m88k-motorola-sysv3 mn10300-*-* mn10200-*-* v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa-*-* ++// excess errors test - XFAIL mips*-*-* rs6000-*-* powerpc-*-eabi m68k-*-coff m68k-motorola-sysv m88k-motorola-sysv3 mn10300-*-* mn10200-*-* v850-*-* sh*-*-* h8*-*-* xtensa-*-* + + #include <stdarg.h> + diff --git a/patches/gcc/3.3.3/config.sub.patch b/patches/gcc/3.3.3/config.sub.patch new file mode 100644 index 00000000..928f9115 --- /dev/null +++ b/patches/gcc/3.3.3/config.sub.patch @@ -0,0 +1,72 @@ +When configuring a s390->s390 or cris->cris crosscompiler +(ok, I haven't hit this yet, but one of these days I'll get me an account +on an s390, and then I'll need this patch :-), you'll get the +following error: + ++ /build/s390-unknown-linux-gnu/gcc-3.3-glibc-2.3.2/gcc-3.3/configure +--target=s390-unknown-linux-gnu --host=s390-host_unknown-linux-gnu +--prefix=/result/s390-unknown-linux-gnu/gcc-3.3-glibc-2.3.2 +--enable-languages=c +--with-local-prefix=/result/s390-unknown-linux-gnu/gcc-3.3-glibc-2.3.2/s390- +unknown-linux-gnu --enable-threads=no --without-headers --with-newlib +--disable-shared +... +*** --with-headers is only supported when cross compiling + +This error pops up only when you're using Daniel Jacobowitz's technique +of slightly changing the target and host tuples to make them different +enough to force gcc's build system to not try to pull in system libraries +or headers. This technique is needed e.g. to build an x86 -> x86 +cross-compiler. +(The LFS developers ran into the same bug that prompted me to use +this technique; they point people who run into it to +http://linuxfromscratch.org/~greg/pure_lfs.txt, which is a different +way of avoiding this problem. I think the tuple tweak is the way to go, though.) + +config-patches@gnu.org rejected this patch, on the grounds that there +is only one vendor of each of those two architectures, so the +canonicalization is by definition correct. When I pointed out the +difficulty this causes for people building s390 -> s390 or +cris -> cris compilers that are incompatible with the system +libraries and thus must be built like cross-compilers, he grumped and said +"autoconf should let you specify a cross-compiler in some other way than +comparing tuple strings". + + + +--- gcc-3.3/config.sub.old Sun Jun 8 20:38:47 2003 ++++ gcc-3.3/config.sub Sun Jun 8 20:40:34 2003 +@@ -433,9 +433,12 @@ + crds | unos) + basic_machine=m68k-crds + ;; +- cris | cris-* | etrax*) ++ cris | etrax*) + basic_machine=cris-axis + ;; ++ cris-*) ++ basic_machine=cris-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; +@@ -820,11 +823,17 @@ + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; +- s390 | s390-*) ++ s390) + basic_machine=s390-ibm + ;; +- s390x | s390x-*) ++ s390-*) ++ basic_machine=s390-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; ++ s390x) + basic_machine=s390x-ibm ++ ;; ++ s390x-*) ++ basic_machine=s390x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + sa29200) + basic_machine=a29k-amd diff --git a/patches/gcc/3.3.3/empty6.patch b/patches/gcc/3.3.3/empty6.patch new file mode 100644 index 00000000..1b0715ce --- /dev/null +++ b/patches/gcc/3.3.3/empty6.patch @@ -0,0 +1,21 @@ +From 3.4 branch. Fixes test failure +FAIL: g++.dg/abi/empty6.C (test for warnings, line 6) + +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/abi/empty6.C,v +retrieving revision 1.1 +retrieving revision 1.2 +diff -u -r1.1 -r1.2 +--- gcc/gcc/testsuite/g++.dg/abi/empty6.C 2002/09/25 19:07:35 1.1 ++++ gcc/gcc/testsuite/g++.dg/abi/empty6.C 2003/06/03 19:10:09 1.2 +@@ -5,4 +5,9 @@ + struct B { + A a; // { dg-warning "empty" } + virtual void f () {} +-}; ++} __attribute__((aligned(8))); ++/* The preceding attribute is necessary on targets with ++ BIGGEST_ALIGNMENT <= 32 to trigger the warning, as otherwise a 32 bit ++ offset is split into DECL_FIELD_OFFSET 4 and DECL_FIELD_BIT_OFFSET 0, ++ and then there is no discrepancy between DECL_FIELD_OFFSET and ++ byte_position to warn about. */ diff --git a/patches/gcc/3.3.3/gcc-3.3.2-arm-bigendian.patch b/patches/gcc/3.3.3/gcc-3.3.2-arm-bigendian.patch new file mode 100644 index 00000000..9ec6c53c --- /dev/null +++ b/patches/gcc/3.3.3/gcc-3.3.2-arm-bigendian.patch @@ -0,0 +1,65 @@ +By Lennert Buytenhek <buytenh@wantstofly.org> +Adds support for arm*b-linux* big-endian ARM targets + +See http://gcc.gnu.org/PR16350 + +diff -urN gcc-3.3.2.orig/gcc/config/arm/linux-elf.h gcc-3.3.2/gcc/config/arm/linux-elf.h +--- gcc-3.3.2.orig/gcc/config/arm/linux-elf.h 2003-09-16 17:39:23.000000000 +0200 ++++ gcc-3.3.2/gcc/config/arm/linux-elf.h 2004-07-07 14:03:54.329839922 +0200 +@@ -30,15 +30,29 @@ + /* Do not assume anything about header files. */ + #define NO_IMPLICIT_EXTERN_C + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END ++#define TARGET_ENDIAN_OPTION "mbig-endian" ++#define TARGET_LINKER_EMULATION "armelfb_linux" ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#define TARGET_ENDIAN_OPTION "mlittle-endian" ++#define TARGET_LINKER_EMULATION "armelf_linux" ++#endif ++ + /* Default is to use APCS-32 mode. */ + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS) ++#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS | TARGET_ENDIAN_DEFAULT) + +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" } + + #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" + +@@ -86,7 +100,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #define TARGET_OS_CPP_BUILTINS() \ +diff -urN gcc-3.3.2.orig/gcc/config.gcc gcc-3.3.2/gcc/config.gcc +--- gcc-3.3.2.orig/gcc/config.gcc 2003-10-01 21:07:01.000000000 +0200 ++++ gcc-3.3.2/gcc/config.gcc 2004-07-07 14:04:59.046716638 +0200 +@@ -699,6 +699,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + 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" ++ case $machine in ++ arm*b-*) ++ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" ++ ;; ++ esac + tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes diff --git a/patches/gcc/3.3.3/gcc-3.3.3-trap-posix.patch b/patches/gcc/3.3.3/gcc-3.3.3-trap-posix.patch new file mode 100644 index 00000000..437c2a1e --- /dev/null +++ b/patches/gcc/3.3.3/gcc-3.3.3-trap-posix.patch @@ -0,0 +1,44 @@ +# +# Submitted-By: Marc Kleine-Budde <mkl@pengutronix.de>, 2005-04-20 +# +# Error: +# +# creating libintl.h +# Configuring etc... +# loading cache ../config.cache +# checking for a BSD compatible install... (cached) /usr/bin/install -c +# creating ./config.status +# creating Makefile +# trap: usage: trap [-lp] [[arg] signal_spec ...] +# +# Description: +# +# non-posix conform usage of trap causes bash >= 3.0 to fail +# e.g.: http://sourceware.org/ml/crossgcc/2004-12/msg00132.html +# +# Status: +# +# fixed in gcc >= 3.3.5 +# backport of gcc-3.3.5 fix +# +diff -ruN gcc-3.3.3-orig/configure gcc-3.3.3/configure +--- gcc-3.3.3-orig/configure 2002-09-29 18:11:24.000000000 +0200 ++++ gcc-3.3.3/configure 2005-04-20 21:03:51.000000000 +0200 +@@ -697,7 +697,7 @@ + if test -f skip-this-dir; then + # Perform the same cleanup as the trap handler, minus the "exit 1" of course, + # and reset the trap handler. +- trap 0 ++ trap '' 0 + rm -rf Makefile* ${tmpdir} + # Execute the final clean-up actions + ${config_shell} skip-this-dir +@@ -1596,7 +1596,7 @@ + # Perform the same cleanup as the trap handler, minus the "exit 1" of course, + # and reset the trap handler. + rm -rf ${tmpdir} +-trap 0 ++trap '' 0 + + exit 0 + diff --git a/patches/gcc/3.3.3/pr10392-1-test.patch b/patches/gcc/3.3.3/pr10392-1-test.patch new file mode 100644 index 00000000..e94c8b9b --- /dev/null +++ b/patches/gcc/3.3.3/pr10392-1-test.patch @@ -0,0 +1,65 @@ +--- /dev/null Sat Dec 14 13:56:51 2002 ++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr10392-1.c Sun Sep 14 14:28:24 2003 +@@ -0,0 +1,62 @@ ++/* PR optimization/10392 ++ * Reporter: marcus@mc.pp.se ++ * Summary: [3.3/3.4 regression] [SH] optimizer generates faulty array indexing ++ * Description: ++ * The address calculation of an index operation on an array on the stack ++ * can _under some conditions_ get messed up completely ++ * ++ * Testcase tweaked by dank@kegel.com ++ * Problem only happens with -O2 -m4, so it should only happen on sh4, ++ * but what the heck, let's test other architectures, too. ++ * Not marked as xfail since it's a regression. ++*/ ++/* { dg-do run } */ ++/* { dg-options "-O2" } */ ++/* { dg-options "-O2 -m4" { target sh4-*-* } } */ ++const char *dont_optimize_function_away; ++ ++const char *use(const char *str) ++{ ++ dont_optimize_function_away = str; ++ if (str[0] != 'v') ++ abort(); ++ if (str[1] < '1' || str[1] > '6') ++ abort(); ++ if (str[2]) ++ abort(); ++ return str[2] ? "notused" : "v6"; ++} ++ ++const char *func(char *a, char *b) ++{ ++ char buf[128]; ++ unsigned char i; ++ const char *result; ++ ++ char *item[] = { ++ "v1", ++ "v2", ++ }; ++ ++ buf[0] = 'v'; ++ buf[1] = '3'; ++ buf[2] = 0; ++ ++ for (i = 0; i < 2; i++) { ++ /* bug is: following line passes wild pointer to use() on sh4 -O2 */ ++ result = use(item[i]); ++ ++ use(buf); ++ use(a); ++ use(b); ++ result = use(result); ++ } ++ return result; ++} ++ ++int main() ++{ ++ func("v4", "v5"); ++ return 0; ++} ++ diff --git a/patches/gcc/3.3.3/pr10412-1-test.patch b/patches/gcc/3.3.3/pr10412-1-test.patch new file mode 100644 index 00000000..6ca05258 --- /dev/null +++ b/patches/gcc/3.3.3/pr10412-1-test.patch @@ -0,0 +1,46 @@ +--- /dev/null Sat Dec 14 13:56:51 2002 ++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr10412-1.c Sun Sep 14 16:15:21 2003 +@@ -0,0 +1,43 @@ ++/* PR target/10412 ++ * Reporter: shrinivasa@kpitcummins.com ++ * Summary: Renesas SH - Incorrect code generation ++ * Description: ++ * When following code is compiled with ++ * sh-elf-gcc -S -mhitachi -m2 -O2 bug1.c ++ * generates an incorrect code. ++ * ++ * Testcase tweaked by dank@kegel.com ++ * Problem only happens with -mhitachi -m2. Not sure if I can give those ++ * options for all sh targets. They work on sh4, though. ++ * Not marked as xfail as it's a regression relative to hardhat 2.0 gcc-2.97. ++*/ ++/* { dg-do run } */ ++/* { dg-options "-O2" } */ ++int global_val; ++ ++int func0(int x) ++{ ++ global_val += x; ++ return (x != 99); ++} ++ ++int func1(unsigned long addr) ++{ ++ int err; ++ ++ err = func0(addr); ++ if (err) ++ return (err); ++ ++ err = func0(addr * 7); /* address of func0 is lost during multiplication -> probable SIGSEGV */ ++ return (err); ++} ++ ++int main(int argc, char **argv) ++{ ++ global_val = 0; ++ global_val += func1(99); ++ if (global_val != 99 * 8 + 1) ++ abort(); ++ return 0; ++} diff --git a/patches/gcc/3.3.3/pr10589-1-test.patch b/patches/gcc/3.3.3/pr10589-1-test.patch new file mode 100644 index 00000000..04882e51 --- /dev/null +++ b/patches/gcc/3.3.3/pr10589-1-test.patch @@ -0,0 +1,17 @@ +--- /dev/null Sat Dec 14 13:56:51 2002 ++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr10589-1.c Mon Sep 15 08:57:58 2003 +@@ -0,0 +1,14 @@ ++/* PR target/10589 ++ * Reporter: mathieu@thenesis.com ++ * Summary: For Hitachi SH target, GCC crashes when both -fomit-frame-pointer and -mdalign options are specified ++ * Keywords: ice-on-valid-code ++ * Testcase by Kazu Hirata, tweaked by dank@kegel.com ++ * Did not fail in Hard Hat 2.0 gcc-2.97, nor in dodes gcc-3.0.2, so this is a regression, so I'm not marking it xfail ++ */ ++/* { dg-do compile { target sh*-*-* } } */ ++/* { dg-options "-fomit-frame-pointer -mdalign" } */ ++ ++int foo(int a, int b) ++{ ++ return a / b; ++} diff --git a/patches/gcc/3.3.3/pr11162-1-test.patch b/patches/gcc/3.3.3/pr11162-1-test.patch new file mode 100644 index 00000000..9ab0d324 --- /dev/null +++ b/patches/gcc/3.3.3/pr11162-1-test.patch @@ -0,0 +1,25 @@ +--- /dev/null Sat Dec 14 13:56:51 2002 ++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr11162-1.c Sun Sep 14 16:24:41 2003 +@@ -0,0 +1,22 @@ ++/* ++ * PR optimization/11162 ++ * Reporter: Toshiyasu Morita <tm@kloo.net> ++ * Summary: [3.4 Regression] [-fnew-ra] ICE compiling channel.i on sh ++ * Keywords: ice-on-valid-code ++ * Description: ++ * [ICE] when channel.i from stress-1.17 is compiled with options: ++ * -O2 -m4 -fnew-ra ++ * ... ++ * The CFG code gets confused by the addition of a USE insn after a sibcall. ++ * Sibcalls are supposed to end the block (and the function!), so the fact ++ * that we have an instruction following one (even if its fake) is confusing. ++ * ++ * testcase tweaked by dank@kegel.com ++ */ ++/* { dg-do compile } */ ++/* { dg-options "-O2 -fnew-ra" } */ ++ ++int foo(char *p1) ++{ ++ return bar(p1); ++} diff --git a/patches/gcc/3.3.3/pr11587-1-test.patch b/patches/gcc/3.3.3/pr11587-1-test.patch new file mode 100644 index 00000000..f6dedde0 --- /dev/null +++ b/patches/gcc/3.3.3/pr11587-1-test.patch @@ -0,0 +1,39 @@ +--- /dev/null Sat Dec 14 13:56:51 2002 ++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr11587-1.c Mon Sep 15 08:46:00 2003 +@@ -0,0 +1,36 @@ ++/* PR optimization/11587 ++ * Reporter: Michael Eager <eager@mvista.com> ++ * Summary: [3.3/3.4 Regression] SH ICE in reload_cse_simplify_operand, postreload.c ++ * Keywords: ice-on-valid-code ++ * ++ * Note: a fix exists; see bugzilla ++ * ++ * Testcase tweaked by dank@kegel.com ++ * Not marked as xfail since it's a regression. ++ */ ++ ++/* { dg-do compile } */ ++/* { dg-options "-O1" } */ ++int foo1(void); ++int foo2(); ++int foo3(); ++ ++static int goo() ++{ ++ int i; ++ ++ if (i <= 0) ++ return i; ++ ++ if (foo1() > 1) { ++ i = foo2(); ++ if (i < 0) ++ return i; ++ if (i) { ++ if (foo3()) ++ return 1; ++ return 0; ++ } ++ } ++ ++} diff --git a/patches/gcc/3.3.3/pr11608.patch b/patches/gcc/3.3.3/pr11608.patch new file mode 100644 index 00000000..b45959c3 --- /dev/null +++ b/patches/gcc/3.3.3/pr11608.patch @@ -0,0 +1,26 @@ +# See http://gcc.gnu.org/PR11608 +# Fixes following error when testing sh4 toolchain: +# +# Testing debug/20020327-1.c, -gstabs1 +# ... +# FAIL: gcc.dg/debug/20020327-1.c (test for excess errors) +# Excess errors: +# /tmp/cc8dFF7Y.s: Assembler messages: +# /tmp/cc8dFF7Y.s:66: Error: symbol `Letext' is already defined + +Index: elf.h +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/config/sh/elf.h,v +retrieving revision 1.32 +diff -u -p -r1.32 elf.h +--- gcc/gcc/config/sh/elf.h.old 27 Sep 2003 04:48:28 -0000 1.32 ++++ gcc/gcc/config/sh/elf.h 2 Jan 2004 07:23:23 -0000 +@@ -95,7 +95,7 @@ while (0) + #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \ + do { \ + text_section (); \ +- fprintf ((FILE), "\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO); \ ++ asm_fprintf ((FILE), "\t.stabs \"\",%d,0,0,%LLetext\n%LLetext:\n", N_SO); \ + } while (0) + + #undef STARTFILE_SPEC diff --git a/patches/gcc/3.3.3/pr11736-1-test.patch b/patches/gcc/3.3.3/pr11736-1-test.patch new file mode 100644 index 00000000..ea544b12 --- /dev/null +++ b/patches/gcc/3.3.3/pr11736-1-test.patch @@ -0,0 +1,48 @@ +--- /dev/null Sat Dec 14 13:56:51 2002 ++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr11736-1.c Sun Sep 14 14:26:33 2003 +@@ -0,0 +1,45 @@ ++/* PR optimization/11736 ++ * Reporter: marcus@mc.pp.se ++ * Summary: Stackpointer messed up on SuperH ++ * Keywords: wrong-code ++ * Description: ++ * When a function with 5 arguments is called in both branches of a ++ * conditional, and only the last argument differs, the code to push that ++ * last argument on the stack gets confused. ++ * Space for the fifth argument is reserved on the stack by the ++ * instruction I have marked as "A". However, if the else-branch is ++ * taken the stackpointer is decremented _again_ at "B". This ++ * decrementation is never restored, and it is only due to the ++ * restoration of r15 from r14 that the function works at all. With ++ * -fomit-frame-pointer it will crash. ++ * ++ * Testcase tweaked by dank@kegel.com ++ * Not marked as xfail since it's a regression from hardhat 2.0 gcc-2.97 ++ * and dodes gcc-3.0.2 ++ */ ++ ++/* { dg-do run } */ ++/* { dg-options "-O1 -fomit-frame-pointer" } */ ++ ++int expected_e; ++ ++void bar(int a, int b, int c, int d, int e) ++{ ++ if (e != expected_e) ++ abort(); ++} ++ ++void foo(int a) ++{ ++ if (a) ++ bar(0, 0, 0, 0, 1); ++ else ++ bar(0, 0, 0, 0, 0); /* stack pointer decremented extra time here, causing segfault */ ++} ++ ++int main(int argc, char **argv) ++{ ++ for (expected_e = 0; expected_e < 2; expected_e++) ++ foo(expected_e); ++ return 0; ++} diff --git a/patches/gcc/3.3.3/pr11864-1-test.patch b/patches/gcc/3.3.3/pr11864-1-test.patch new file mode 100644 index 00000000..f5b0d175 --- /dev/null +++ b/patches/gcc/3.3.3/pr11864-1-test.patch @@ -0,0 +1,45 @@ +--- /dev/null Sat Dec 14 13:56:51 2002 ++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr11864-1.c Sun Sep 14 14:32:24 2003 +@@ -0,0 +1,42 @@ ++/* PR optimization/11864 ++ * Reporter: Kazumoto Kojima <kkojima@gcc.gnu.org> ++ * Summary: [3.3/3.4 regression] miscompiles zero extension and test ++ * Description: ++ * gcc-3.3/3.4 -O2 for sh target may miscompile the combination of zero extension ++ * and test if it's zero. ++ * ++ * Testcase tweaked by dank@kegel.com. Not marked as xfail because it's a regression. ++ */ ++/* { dg-do run } */ ++/* { dg-options "-O2" } */ ++ ++extern void abort(void); ++ ++int val = 0xff00; ++ ++int f(void) ++{ ++ return val; ++} ++ ++unsigned char a[1]; ++ ++void foo(void) ++{ ++ a[0] = f() & 255; ++ ++ if (!a[0]) ++ a[0] = f() & 255; ++ ++ if (!a[0]) ++ a[0] = 1 + (f() & 127); ++} ++ ++int main(int argc, char **argv) ++{ ++ foo(); ++ if (!a[0]) ++ abort(); ++ ++ return 0; ++} diff --git a/patches/gcc/3.3.3/pr12009.patch b/patches/gcc/3.3.3/pr12009.patch new file mode 100644 index 00000000..cb294d57 --- /dev/null +++ b/patches/gcc/3.3.3/pr12009.patch @@ -0,0 +1,85 @@ +See http://gcc.gnu.org/PR12009 + +Fixes the following problems when testing a cross-compiler: + +============================================ +Testing g++.dg/compat/abi/bitfield1, +... +Invoking the compiler as /crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-gli +bc-2.2.5/build-gcc/gcc/testsuite/../g++ ... +/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/gcc/test +suite/g++.dg/compat/abi/bitfield1_main.C +pid is 16028 -16028 +compiler exited with status 1 +output is: +sh: error while loading shared libraries: /opt/cegl-2.0/powerpc-750-linux-gnu/gc +c-3.3-glibc-2.2.5/powerpc-750-linux-gnu/./lib/libdl.so.2: ELF file data encoding + not little-endian +/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/build-gcc/gcc/te +stsuite/../g++: error while loading shared libraries: /opt/cegl-2.0/powerpc-750- +linux-gnu/gcc-3.3-glibc-2.2.5/powerpc-750-linux-gnu/./lib/libc.so.6: ELF file da +ta encoding not little-endian + +FAIL: g++.dg/compat/abi/bitfield1 main_tst.o compile +============================================ + +and + +sh: error while loading shared libraries: /opt/cegl-2.0/powerpc-405-linux-gnu/gcc-3.2.3-glibc-2.2.5/powerpc-405-linux-gnu/./lib/libdl.so.2: ELF file data encoding not little-endian + + + +--- gcc-3.3/gcc/testsuite/g++.dg/compat/compat.exp.old Thu Oct 17 17:22:57 2002 ++++ gcc-3.3/gcc/testsuite/g++.dg/compat/compat.exp Mon Jul 14 10:59:19 2003 +@@ -42,11 +42,13 @@ + proc compat-fix-library-path { } { + global ld_library_path + +- # See comments in lib/g++.exp for why this is needed. +- setenv LD_LIBRARY_PATH $ld_library_path +- setenv SHLIB_PATH $ld_library_path +- setenv LD_LIBRARYN32_PATH $ld_library_path +- setenv LD_LIBRARY64_PATH $ld_library_path ++ if {![is_remote target]} { ++ # See comments in lib/g++.exp for why this is needed. ++ setenv LD_LIBRARY_PATH $ld_library_path ++ setenv SHLIB_PATH $ld_library_path ++ setenv LD_LIBRARYN32_PATH $ld_library_path ++ setenv LD_LIBRARY64_PATH $ld_library_path ++ } + } + + # +--- gcc-3.4-20030813/gcc/testsuite/lib/g++.exp.orig Tue Jun 17 18:56:45 2003 ++++ gcc-3.4-20030813/gcc/testsuite/lib/g++.exp Sun Aug 17 18:35:38 2003 +@@ -166,16 +182,20 @@ + } + } + +- # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but +- # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH +- # (for the 64-bit ABI). The right way to do this would be to modify +- # unix.exp -- but that's not an option since it's part of DejaGNU +- # proper, so we do it here. We really only need to do +- # this on IRIX, but it shouldn't hurt to do it anywhere else. +- setenv LD_LIBRARY_PATH $ld_library_path +- setenv SHLIB_PATH $ld_library_path +- setenv LD_LIBRARYN32_PATH $ld_library_path +- setenv LD_LIBRARY64_PATH $ld_library_path ++ if {![is_remote target]} { ++ # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but ++ # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH ++ # (for the 64-bit ABI). The right way to do this would be to modify ++ # unix.exp -- but that's not an option since it's part of DejaGNU ++ # proper, so we do it here. We really only need to do ++ # this on IRIX, but it shouldn't hurt to do it anywhere else. ++ ++ # Doing this causes us to be unable to run cross-compilers. ++ setenv LD_LIBRARY_PATH $ld_library_path ++ setenv SHLIB_PATH $ld_library_path ++ setenv LD_LIBRARYN32_PATH $ld_library_path ++ setenv LD_LIBRARY64_PATH $ld_library_path ++ } + + return "$flags" + } diff --git a/patches/gcc/3.3.3/pr12010.patch b/patches/gcc/3.3.3/pr12010.patch new file mode 100644 index 00000000..bb7f171e --- /dev/null +++ b/patches/gcc/3.3.3/pr12010.patch @@ -0,0 +1,81 @@ +Adjusted for gcc-3.3-20040119 + +See http://gcc.gnu.org/PR12010 + +Without this patch, one gets both compile and link time errors in +'make check' when configured for cross-compiling. + +In particular, 'make check' on a cross-compiler fails with + +/testsuite_flags: /testsuite_flags: No such file or directory + while executing +"exec sh ${odir_v3}/testsuite_flags --build-includes" + (procedure "g++_include_flags" line 21) + invoked from within +"g++_include_flags [get_multilibs] " + (procedure "g++_init" line 63) + invoked from within +"${tool}_init $test_file_name" + (procedure "runtest" line 19) +... +make[1]: [check-g++] Error 1 (ignored) + +--- gcc-3.3-20040119/gcc/testsuite/lib/g++.exp.orig 2004-01-25 17:56:24.000000000 -0800 ++++ gcc-3.3-20040119/gcc/testsuite/lib/g++.exp 2004-01-25 18:29:44.000000000 -0800 +@@ -72,6 +72,8 @@ proc g++_version { } { + # + proc g++_include_flags { paths } { + global srcdir ++ global objdir ++ global target_triplet + global HAVE_LIBSTDCXX_V3 + global TESTING_IN_BUILD_TREE + +@@ -90,6 +92,20 @@ proc g++_include_flags { paths } { + + if { ${HAVE_LIBSTDCXX_V3} } { + set odir_v3 [lookfor_file ${gccpath} libstdc++-v3] ++ if { $odir_v3 == "" } { ++ verbose "g++_include_flags: couldn't find libstdc++-v3 on first try, now looking in build directory $objdir" ++ # first assume no multilibs ++ set odir_v3 [lookfor_file ${objdir} "$target_triplet/libstdc++-v3"] ++ } ++ if { $odir_v3 == "" } { ++ verbose "g++_include_flags: couldn't find libstdc++-v3 on second try, trying multilib" ++ # assume multilib only one level deep ++ set multisub [file tail $gccpath] ++ set odir_v3 [lookfor_file ${objdir} "$target_triplet/$multisub/libstdc++-v3"] ++ } ++ if { $odir_v3 == "" } { ++ error "Can't find libstdc++-v3" ++ } + append flags [exec sh ${odir_v3}/testsuite_flags --build-includes] + } else { + set odir_v2 [lookfor_file ${gccpath} libstdc++] + +--- gcc-3.3-20040119/libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp.old Sun Jul 13 10:42:01 2003 ++++ gcc-3.3-20040119/libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp Sun Jul 13 11:39:54 2003 +@@ -48,8 +48,23 @@ + global ld_library_path + global original_ld_library_path + global tool_root_dir ++ global target_triplet + + set blddir [lookfor_file [get_multilibs] libstdc++-v3] ++ if { $blddir == "" } { ++ set multilibs [get_multilibs] ++ # FIXME: assume multilib only one level deep ++ set multisub [file tail $multilibs] ++ verbose "libstdc++-v3-init: couldn't find libstdc++-v3 in $multilibs, trying $objdir" ++ set blddir [lookfor_file ${objdir} "$target_triplet/$multisub/libstdc++-v3"] ++ } ++ if { $blddir == "" } { ++ verbose "libstdc++-v3-init: couldn't find libstdc++-v3, trying $objdir without multilibs" ++ set blddir [lookfor_file ${objdir} "$target_triplet/libstdc++-v3"] ++ } ++ if { $blddir == "" } { ++ error "Can't find libstdc++-v3" ++ } + + # By default, we assume we want to run program images. + global dg-do-what-default diff --git a/patches/gcc/3.3.3/pr13250-fix.patch b/patches/gcc/3.3.3/pr13250-fix.patch new file mode 100644 index 00000000..ce68bb1b --- /dev/null +++ b/patches/gcc/3.3.3/pr13250-fix.patch @@ -0,0 +1,19 @@ +See http://gcc.gnu.org/PR13250 +Fixes bad code generated when compiling SHA256 for SH processor + +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.md,v +retrieving revision 1.171 +retrieving revision 1.172 +diff -u -r1.171 -r1.172 +--- gcc/gcc/config/sh/sh.md 2004/05/10 23:25:13 1.171 ++++ gcc/gcc/config/sh/sh.md 2004/05/28 05:47:36 1.172 +@@ -2194,7 +2194,7 @@ + parts[0] = gen_reg_rtx (SImode); + parts[1] = gen_reg_rtx (SImode); + emit_insn (gen_rotlsi3_16 (parts[2-choice], operands[1])); +- parts[choice-1] = operands[1]; ++ emit_move_insn (parts[choice-1], operands[1]); + emit_insn (gen_ashlsi3 (parts[0], parts[0], GEN_INT (8))); + emit_insn (gen_lshrsi3 (parts[1], parts[1], GEN_INT (8))); + emit_insn (gen_iorsi3 (operands[0], parts[0], parts[1])); diff --git a/patches/gcc/3.3.3/pr13260-fix-3.3.3.patch b/patches/gcc/3.3.3/pr13260-fix-3.3.3.patch new file mode 100644 index 00000000..7587ad81 --- /dev/null +++ b/patches/gcc/3.3.3/pr13260-fix-3.3.3.patch @@ -0,0 +1,246 @@ +Date: Fri, 06 Feb 2004 12:35:58 +0900 +From: SUGIOKA Toshinobu <sugioka@itonet.co.jp> +Subject: [linux-sh:03150] Re: gcc 3.3 optimisation problem +To: linux-sh@m17n.org +Message-Id: <4.2.0.58.J.20040206122503.04fe3058@router.itonet.co.jp> +List-Help: <mailto:linux-sh-ctl@m17n.org?body=help> +List-Id: linux-sh.m17n.org + +At 19:40 03/12/01 +0000, Stuart Menefy <stuart.menefy@st.com> wrote: +>On Sat, 29 Nov 2003 20:19:08 +0900 kkojima@rr.iij4u.or.jp wrote: +> +>> Dan Kegel <dank@kegel.com> wrote: +>> > Stuart Menefy wrote: +>> >> I've just been trying to put together a gcc 3.3.2 based toolchain, and +>> >> appear to be hitting a gcc optimisation bug. I was just wondering if +>> >> anyone else had seen anything similar. +>> >> +>> >> The problem is seen when building the kernel, in the function +>> >> root_nfs_parse_addr(). I've extracted this into a small stand alone +>> >> program which demonstrates the problem. +>> > +>> > Excellent work. I haven't seen anything like this (doesn't mean much) +>> > and the sh-specific optimization bugs in the gcc bug database don't look +>> > similar. I think you should submit this as a bug report at +>> > http://gcc.gnu.org/bugzilla/ +>> > It would be good if you could make your test case call abort() if +>> > the problem is present, so the test case can be automated. +>> +>> Indeed. It'd be very nice to create a gcc PR for this issue. +> +>OK, I've done that. PR 13260. + +PR 13260 was fixed by amylaar@gcc.gnu.org at 2003-12-04 20:10:29 on mainline(gcc-3.4). +I have back-ported that patch to gcc-3.3.3 and seems fine for me. + + * sh-protos.h (sh_expand_t_scc): Declare. + * sh.h (PREDICATE_CODES): Add cmpsi_operand. + * sh.c (cmpsi_operand, sh_expand_t_scc): New functions. + * sh.md (cmpsi): Use cmpsi_operand. If T_REG is compared to + something that is not a CONST_INT, copy it into a pseudo register. + (subc): Fix description of new T value. + (slt, sgt, sge, sgtu): Don't clobber T after rtl generation is over. + (sltu, sleu, sgeu): Likewise. + (seq, sne): Likewise. Use sh_expand_t_scc. + +diff -ru gcc-3.3-20040126-1/gcc/config/sh/sh-protos.h gcc-3.3-20040126/gcc/config/sh/sh-protos.h +--- gcc-3.3-20040126-1/gcc/config/sh/sh-protos.h Tue Jan 13 02:03:24 2004 ++++ gcc-3.3-20040126/gcc/config/sh/sh-protos.h Fri Jan 30 17:54:04 2004 +@@ -102,6 +102,7 @@ + extern int sh_can_redirect_branch PARAMS ((rtx, rtx)); + extern void sh_expand_unop_v2sf PARAMS ((enum rtx_code, rtx, rtx)); + extern void sh_expand_binop_v2sf PARAMS ((enum rtx_code, rtx, rtx, rtx)); ++extern int sh_expand_t_scc (enum rtx_code code, rtx target); + #ifdef TREE_CODE + extern void sh_va_start PARAMS ((tree, rtx)); + extern rtx sh_va_arg PARAMS ((tree, tree)); +diff -ru gcc-3.3-20040126-1/gcc/config/sh/sh.c gcc-3.3-20040126/gcc/config/sh/sh.c +--- gcc-3.3-20040126-1/gcc/config/sh/sh.c Thu Jan 15 03:11:36 2004 ++++ gcc-3.3-20040126/gcc/config/sh/sh.c Fri Jan 30 17:53:58 2004 +@@ -7870,6 +7870,15 @@ + return register_operand (op, mode); + } + ++int ++cmpsi_operand (rtx op, enum machine_mode mode) ++{ ++ if (GET_CODE (op) == REG && REGNO (op) == T_REG ++ && GET_MODE (op) == SImode) ++ return 1; ++ return arith_operand (op, mode); ++} ++ + /* INSN is an sfunc; return the rtx that describes the address used. */ + static rtx + extract_sfunc_addr (rtx insn) +@@ -7917,4 +7926,33 @@ + abort (); + } + ++int ++sh_expand_t_scc (enum rtx_code code, rtx target) ++{ ++ rtx result = target; ++ HOST_WIDE_INT val; ++ ++ if (GET_CODE (sh_compare_op0) != REG || REGNO (sh_compare_op0) != T_REG ++ || GET_CODE (sh_compare_op1) != CONST_INT) ++ return 0; ++ if (GET_CODE (result) != REG) ++ result = gen_reg_rtx (SImode); ++ val = INTVAL (sh_compare_op1); ++ if ((code == EQ && val == 1) || (code == NE && val == 0)) ++ emit_insn (gen_movt (result)); ++ else if ((code == EQ && val == 0) || (code == NE && val == 1)) ++ { ++ emit_insn (gen_rtx_CLOBBER (VOIDmode, result)); ++ emit_insn (gen_subc (result, result, result)); ++ emit_insn (gen_addsi3 (result, result, GEN_INT (1))); ++ } ++ else if (code == EQ || code == NE) ++ emit_insn (gen_move_insn (result, GEN_INT (code == NE))); ++ else ++ return 0; ++ if (result != target) ++ emit_move_insn (target, result); ++ return 1; ++} ++ + #include "gt-sh.h" +diff -ru gcc-3.3-20040126-1/gcc/config/sh/sh.h gcc-3.3-20040126/gcc/config/sh/sh.h +--- gcc-3.3-20040126-1/gcc/config/sh/sh.h Wed Apr 16 02:06:09 2003 ++++ gcc-3.3-20040126/gcc/config/sh/sh.h Fri Jan 30 17:53:51 2004 +@@ -3231,6 +3231,7 @@ + {"arith_reg_or_0_operand", {SUBREG, REG, CONST_INT, CONST_VECTOR}}, \ + {"binary_float_operator", {PLUS, MINUS, MULT, DIV}}, \ + {"binary_logical_operator", {AND, IOR, XOR}}, \ ++ {"cmpsi_operand", {SUBREG, REG, CONST_INT}}, \ + {"commutative_float_operator", {PLUS, MULT}}, \ + {"equality_comparison_operator", {EQ,NE}}, \ + {"extend_reg_operand", {SUBREG, REG, TRUNCATE}}, \ +diff -ru gcc-3.3-20040126-1/gcc/config/sh/sh.md gcc-3.3-20040126/gcc/config/sh/sh.md +--- gcc-3.3-20040126-1/gcc/config/sh/sh.md Tue Jan 13 02:03:25 2004 ++++ gcc-3.3-20040126/gcc/config/sh/sh.md Fri Jan 30 17:54:20 2004 +@@ -685,11 +685,14 @@ + + (define_expand "cmpsi" + [(set (reg:SI T_REG) +- (compare (match_operand:SI 0 "arith_operand" "") ++ (compare (match_operand:SI 0 "cmpsi_operand" "") + (match_operand:SI 1 "arith_operand" "")))] + "TARGET_SH1" + " + { ++ if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == T_REG ++ && GET_CODE (operands[1]) != CONST_INT) ++ operands[0] = copy_to_mode_reg (SImode, operands[0]); + sh_compare_op0 = operands[0]; + sh_compare_op1 = operands[1]; + DONE; +@@ -1147,7 +1150,9 @@ + (match_operand:SI 2 "arith_reg_operand" "r")) + (reg:SI T_REG))) + (set (reg:SI T_REG) +- (gtu:SI (minus:SI (match_dup 1) (match_dup 2)) (match_dup 1)))] ++ (gtu:SI (minus:SI (minus:SI (match_dup 1) (match_dup 2)) ++ (reg:SI T_REG)) ++ (match_dup 1)))] + "TARGET_SH1" + "subc %2,%0" + [(set_attr "type" "arith")]) +@@ -7223,6 +7228,10 @@ + } + DONE; + } ++ if (sh_expand_t_scc (EQ, operands[0])) ++ DONE; ++ if (! rtx_equal_function_value_matters) ++ FAIL; + operands[1] = prepare_scc_operands (EQ); + }") + +@@ -7269,6 +7278,8 @@ + } + DONE; + } ++ if (! rtx_equal_function_value_matters) ++ FAIL; + operands[1] = prepare_scc_operands (LT); + }") + +@@ -7371,6 +7382,8 @@ + } + DONE; + } ++ if (! rtx_equal_function_value_matters) ++ FAIL; + operands[1] = prepare_scc_operands (GT); + }") + +@@ -7423,6 +7436,8 @@ + DONE; + } + ++ if (! rtx_equal_function_value_matters) ++ FAIL; + if (GET_MODE_CLASS (GET_MODE (sh_compare_op0)) == MODE_FLOAT) + { + if (TARGET_IEEE) +@@ -7462,6 +7477,8 @@ + sh_compare_op0, sh_compare_op1)); + DONE; + } ++ if (! rtx_equal_function_value_matters) ++ FAIL; + operands[1] = prepare_scc_operands (GTU); + }") + +@@ -7486,6 +7503,8 @@ + sh_compare_op1, sh_compare_op0)); + DONE; + } ++ if (! rtx_equal_function_value_matters) ++ FAIL; + operands[1] = prepare_scc_operands (LTU); + }") + +@@ -7515,6 +7534,8 @@ + + DONE; + } ++ if (! rtx_equal_function_value_matters) ++ FAIL; + operands[1] = prepare_scc_operands (LEU); + }") + +@@ -7545,6 +7566,8 @@ + DONE; + } + ++ if (! rtx_equal_function_value_matters) ++ FAIL; + operands[1] = prepare_scc_operands (GEU); + }") + +@@ -7592,8 +7615,12 @@ + DONE; + } + +- operands[1] = prepare_scc_operands (EQ); +- operands[2] = gen_reg_rtx (SImode); ++ if (sh_expand_t_scc (NE, operands[0])) ++ DONE; ++ if (! rtx_equal_function_value_matters) ++ FAIL; ++ operands[1] = prepare_scc_operands (EQ); ++ operands[2] = gen_reg_rtx (SImode); + }") + + (define_expand "sunordered" + +---- +SUGIOKA Toshinobu + + + + diff --git a/patches/gcc/3.3.3/pr13260-test.patch b/patches/gcc/3.3.3/pr13260-test.patch new file mode 100644 index 00000000..d9cc3e45 --- /dev/null +++ b/patches/gcc/3.3.3/pr13260-test.patch @@ -0,0 +1,56 @@ +See http://gcc.gnu.org/PR13260 + +/cvs/gcc/gcc/gcc/testsuite/gcc.c-torture/execute/20031204-1.c,v --> standard output +revision 1.1 +--- - 1970-01-01 00:00:00.000000000 +0000 ++++ gcc/gcc/testsuite/gcc.c-torture/execute/20031204-1.c +@@ -0,0 +1,49 @@ ++/* PR optimization/13260 */ ++ ++#include <string.h> ++ ++typedef unsigned long u32; ++ ++u32 in_aton(const char* x) ++{ ++ return 0x0a0b0c0d; ++} ++ ++u32 root_nfs_parse_addr(char *name) ++{ ++ u32 addr; ++ int octets = 0; ++ char *cp, *cq; ++ ++ cp = cq = name; ++ while (octets < 4) { ++ while (*cp >= '0' && *cp <= '9') ++ cp++; ++ if (cp == cq || cp - cq > 3) ++ break; ++ if (*cp == '.' || octets == 3) ++ octets++; ++ if (octets < 4) ++ cp++; ++ cq = cp; ++ } ++ ++ if (octets == 4 && (*cp == ':' || *cp == '\0')) { ++ if (*cp == ':') ++ *cp++ = '\0'; ++ addr = in_aton(name); ++ strcpy(name, cp); ++ } else ++ addr = (-1); ++ ++ return addr; ++} ++ ++int ++main() ++{ ++ static char addr[] = "10.11.12.13:/hello"; ++ u32 result = root_nfs_parse_addr(addr); ++ if (result != 0x0a0b0c0d) { abort(); } ++ return 0; ++} diff --git a/patches/gcc/3.3.3/pr15089-fix.patch b/patches/gcc/3.3.3/pr15089-fix.patch new file mode 100644 index 00000000..ceaf9577 --- /dev/null +++ b/patches/gcc/3.3.3/pr15089-fix.patch @@ -0,0 +1,25 @@ +See http://gcc.gnu.org/PR15089 +"In some cases the specified register for a local variable meant to be +used with inline assembly code is not respected. This breaks code +relying on this feature to implement non-standard calling convension." + +This fix is probably needed to properly implement linux syscalls in some architectures. + +First added to crosstool by Jamie Hicks, see +http://www.handhelds.org/hypermail/kernel-discuss/current/0066.html + +Index: gcc/loop.c +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/loop.c,v +retrieving revision 1.488.2.3 +diff -u -r1.488.2.3 loop.c +--- gcc-old/gcc/loop.c 14 Feb 2004 14:46:03 -0000 1.488.2.3 ++++ gcc-new/gcc/loop.c 28 Apr 2004 22:02:53 -0000 +@@ -929,6 +929,7 @@ + || (! (GET_CODE (SET_SRC (set)) == REG + && (REGNO (SET_SRC (set)) + < FIRST_PSEUDO_REGISTER)))) ++ && regno >= FIRST_PSEUDO_REGISTER + /* This test is not redundant; SET_SRC (set) might be + a call-clobbered register and the life of REGNO + might span a call. */ diff --git a/patches/gcc/3.3.3/pr9365-1-test.patch b/patches/gcc/3.3.3/pr9365-1-test.patch new file mode 100644 index 00000000..ee7dfa7c --- /dev/null +++ b/patches/gcc/3.3.3/pr9365-1-test.patch @@ -0,0 +1,43 @@ +--- /dev/null Sat Dec 14 13:56:51 2002 ++++ gcc-3.3.1/gcc/testsuite/gcc.dg/pr9365-1.c Sun Sep 14 09:34:37 2003 +@@ -0,0 +1,40 @@ ++/* PR target/9365 ++ * Origin: marcus@mc.pp.se ++ * Testcase tweaked by dank@kegel.com ++ * [3.3 regression] [SH] segfault in gen_far_branch (config/sh/sh.c) ++ * ice-on-valid-code ++ * Not marked as xfail since it's a regression ++*/ ++/* { dg-do compile } */ ++/* { dg-options "-O2 -fomit-frame-pointer" } */ ++ ++ ++void foo(int n, int *p) ++{ ++ switch(n) { ++ case 100: case 110: case 120: case 130: case 140: ++ case 200: case 210: case 220: case 230: case 240: ++ case 300: case 310: case 320: case 330: case 340: ++ case 400: case 410: case 420: case 430: case 440: ++ case 500: case 510: case 520: case 530: case 540: ++ case 600: case 610: case 620: case 630: case 640: ++ case 700: case 710: case 720: case 730: case 740: ++ case 800: case 810: case 820: case 830: case 840: ++ case 900: case 910: case 920: case 930: case 940: ++ break; ++ default: ++ *p = n; ++ break; ++ } ++} ++ ++int main(int argc, char **argv) ++{ ++ int p; ++ ++ (void) argv; ++ ++ foo(argc, &p); ++ ++ return p; ++} diff --git a/patches/gcc/3.3.3/sh-lib1funcs_sizeAndType.patch b/patches/gcc/3.3.3/sh-lib1funcs_sizeAndType.patch new file mode 100644 index 00000000..64d4fc4b --- /dev/null +++ b/patches/gcc/3.3.3/sh-lib1funcs_sizeAndType.patch @@ -0,0 +1,610 @@ +Fixes the problem + [ libdemo.so and main.o both use assignment on structures ] + $ sh4-unknown-linux-gnu-gcc libdemo.so main.o + sh4-unknown-linux-gnu/bin/ld: warning: type and size of dynamic symbol `__movstr_i4_even' are not defined + [ resulting app links, but crashes at runtime ] +See testcase at http://tsukuba.m17n.org/linux-sh/ml/linux-sh/2003-11/msg00016.html + +Patch was posted as http://gcc.gnu.org/ml/gcc-patches/2002-11/msg01641.html +and is in cvs as http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/lib1funcs.asm.diff?r1=1.29.4.1&r2=1.29.4.2 + +but see also sh-libgcc-hidden.patch (part of gcc-3.3.3 as of 20040119 or so) + +=================================================================== + +--- gcc/gcc/config/sh/lib1funcs.asm 2002/09/20 01:29:21 1.29.4.1 ++++ gcc/gcc/config/sh/lib1funcs.asm 2003/11/18 12:27:31 +@@ -38,9 +38,14 @@ + amylaar@cygnus.com */ + + #ifdef __ELF__ +-#define LOCAL(X) .L_##X +-#else +-#define LOCAL(X) L_##X ++#define LOCAL(X) .L_##X ++#define FUNC(X) .type X,@function ++#define ENDFUNC0(X) .Lfe_##X: .size X,.Lfe_##X-X ++#define ENDFUNC(X) ENDFUNC0(X) ++#else ++#define LOCAL(X) L_##X ++#define FUNC(X) ++#define ENDFUNC(X) + #endif + + #define CONCAT(A,B) A##B +@@ -87,6 +92,40 @@ + .global GLOBAL(ashiftrt_r4_31) + .global GLOBAL(ashiftrt_r4_32) + ++ FUNC(GLOBAL(ashiftrt_r4_0)) ++ FUNC(GLOBAL(ashiftrt_r4_1)) ++ FUNC(GLOBAL(ashiftrt_r4_2)) ++ FUNC(GLOBAL(ashiftrt_r4_3)) ++ FUNC(GLOBAL(ashiftrt_r4_4)) ++ FUNC(GLOBAL(ashiftrt_r4_5)) ++ FUNC(GLOBAL(ashiftrt_r4_6)) ++ FUNC(GLOBAL(ashiftrt_r4_7)) ++ FUNC(GLOBAL(ashiftrt_r4_8)) ++ FUNC(GLOBAL(ashiftrt_r4_9)) ++ FUNC(GLOBAL(ashiftrt_r4_10)) ++ FUNC(GLOBAL(ashiftrt_r4_11)) ++ FUNC(GLOBAL(ashiftrt_r4_12)) ++ FUNC(GLOBAL(ashiftrt_r4_13)) ++ FUNC(GLOBAL(ashiftrt_r4_14)) ++ FUNC(GLOBAL(ashiftrt_r4_15)) ++ FUNC(GLOBAL(ashiftrt_r4_16)) ++ FUNC(GLOBAL(ashiftrt_r4_17)) ++ FUNC(GLOBAL(ashiftrt_r4_18)) ++ FUNC(GLOBAL(ashiftrt_r4_19)) ++ FUNC(GLOBAL(ashiftrt_r4_20)) ++ FUNC(GLOBAL(ashiftrt_r4_21)) ++ FUNC(GLOBAL(ashiftrt_r4_22)) ++ FUNC(GLOBAL(ashiftrt_r4_23)) ++ FUNC(GLOBAL(ashiftrt_r4_24)) ++ FUNC(GLOBAL(ashiftrt_r4_25)) ++ FUNC(GLOBAL(ashiftrt_r4_26)) ++ FUNC(GLOBAL(ashiftrt_r4_27)) ++ FUNC(GLOBAL(ashiftrt_r4_28)) ++ FUNC(GLOBAL(ashiftrt_r4_29)) ++ FUNC(GLOBAL(ashiftrt_r4_30)) ++ FUNC(GLOBAL(ashiftrt_r4_31)) ++ FUNC(GLOBAL(ashiftrt_r4_32)) ++ + .align 1 + GLOBAL(ashiftrt_r4_32): + GLOBAL(ashiftrt_r4_31): +@@ -166,6 +205,40 @@ + GLOBAL(ashiftrt_r4_0): + rts + nop ++ ++ ENDFUNC(GLOBAL(ashiftrt_r4_0)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_1)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_2)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_3)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_4)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_5)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_6)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_7)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_8)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_9)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_10)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_11)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_12)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_13)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_14)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_15)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_16)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_17)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_18)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_19)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_20)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_21)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_22)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_23)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_24)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_25)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_26)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_27)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_28)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_29)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_30)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_31)) ++ ENDFUNC(GLOBAL(ashiftrt_r4_32)) + #endif + + #ifdef L_ashiftrt_n +@@ -188,6 +261,7 @@ + ! + + .global GLOBAL(ashrsi3) ++ FUNC(GLOBAL(ashrsi3)) + .align 2 + GLOBAL(ashrsi3): + mov #31,r0 +@@ -315,6 +389,7 @@ + rts + nop + ++ ENDFUNC(GLOBAL(ashrsi3)) + #endif + + #ifdef L_ashiftlt +@@ -336,6 +411,7 @@ + ! (none) + ! + .global GLOBAL(ashlsi3) ++ FUNC(GLOBAL(ashlsi3)) + .align 2 + GLOBAL(ashlsi3): + mov #31,r0 +@@ -472,6 +548,7 @@ + rts + nop + ++ ENDFUNC(GLOBAL(ashlsi3)) + #endif + + #ifdef L_lshiftrt +@@ -493,6 +570,7 @@ + ! (none) + ! + .global GLOBAL(lshrsi3) ++ FUNC(GLOBAL(lshrsi3)) + .align 2 + GLOBAL(lshrsi3): + mov #31,r0 +@@ -629,6 +707,7 @@ + rts + nop + ++ ENDFUNC(GLOBAL(lshrsi3)) + #endif + + #ifdef L_movstr +@@ -645,76 +724,113 @@ + add #64,r4 + .align 4 + .global GLOBAL(movstrSI64) ++ FUNC(GLOBAL(movstrSI64)) + GLOBAL(movstrSI64): + mov.l @(60,r5),r0 + mov.l r0,@(60,r4) + .global GLOBAL(movstrSI60) ++ FUNC(GLOBAL(movstrSI60)) + GLOBAL(movstrSI60): + mov.l @(56,r5),r0 + mov.l r0,@(56,r4) + .global GLOBAL(movstrSI56) ++ FUNC(GLOBAL(movstrSI56)) + GLOBAL(movstrSI56): + mov.l @(52,r5),r0 + mov.l r0,@(52,r4) + .global GLOBAL(movstrSI52) ++ FUNC(GLOBAL(movstrSI52)) + GLOBAL(movstrSI52): + mov.l @(48,r5),r0 + mov.l r0,@(48,r4) + .global GLOBAL(movstrSI48) ++ FUNC(GLOBAL(movstrSI48)) + GLOBAL(movstrSI48): + mov.l @(44,r5),r0 + mov.l r0,@(44,r4) + .global GLOBAL(movstrSI44) ++ FUNC(GLOBAL(movstrSI44)) + GLOBAL(movstrSI44): + mov.l @(40,r5),r0 + mov.l r0,@(40,r4) + .global GLOBAL(movstrSI40) ++ FUNC(GLOBAL(movstrSI40)) + GLOBAL(movstrSI40): + mov.l @(36,r5),r0 + mov.l r0,@(36,r4) + .global GLOBAL(movstrSI36) ++ FUNC(GLOBAL(movstrSI36)) + GLOBAL(movstrSI36): + mov.l @(32,r5),r0 + mov.l r0,@(32,r4) + .global GLOBAL(movstrSI32) ++ FUNC(GLOBAL(movstrSI32)) + GLOBAL(movstrSI32): + mov.l @(28,r5),r0 + mov.l r0,@(28,r4) + .global GLOBAL(movstrSI28) ++ FUNC(GLOBAL(movstrSI28)) + GLOBAL(movstrSI28): + mov.l @(24,r5),r0 + mov.l r0,@(24,r4) + .global GLOBAL(movstrSI24) ++ FUNC(GLOBAL(movstrSI24)) + GLOBAL(movstrSI24): + mov.l @(20,r5),r0 + mov.l r0,@(20,r4) + .global GLOBAL(movstrSI20) ++ FUNC(GLOBAL(movstrSI20)) + GLOBAL(movstrSI20): + mov.l @(16,r5),r0 + mov.l r0,@(16,r4) + .global GLOBAL(movstrSI16) ++ FUNC(GLOBAL(movstrSI16)) + GLOBAL(movstrSI16): + mov.l @(12,r5),r0 + mov.l r0,@(12,r4) + .global GLOBAL(movstrSI12) ++ FUNC(GLOBAL(movstrSI12)) + GLOBAL(movstrSI12): + mov.l @(8,r5),r0 + mov.l r0,@(8,r4) + .global GLOBAL(movstrSI8) ++ FUNC(GLOBAL(movstrSI8)) + GLOBAL(movstrSI8): + mov.l @(4,r5),r0 + mov.l r0,@(4,r4) + .global GLOBAL(movstrSI4) ++ FUNC(GLOBAL(movstrSI4)) + GLOBAL(movstrSI4): + mov.l @(0,r5),r0 + mov.l r0,@(0,r4) ++ .global GLOBAL(movstrSI0) ++ FUNC(GLOBAL(movstrSI0)) + GLOBAL(movstrSI0): + rts + nop + ++ ENDFUNC(GLOBAL(movstrSI64)) ++ ENDFUNC(GLOBAL(movstrSI60)) ++ ENDFUNC(GLOBAL(movstrSI56)) ++ ENDFUNC(GLOBAL(movstrSI52)) ++ ENDFUNC(GLOBAL(movstrSI48)) ++ ENDFUNC(GLOBAL(movstrSI44)) ++ ENDFUNC(GLOBAL(movstrSI40)) ++ ENDFUNC(GLOBAL(movstrSI36)) ++ ENDFUNC(GLOBAL(movstrSI32)) ++ ENDFUNC(GLOBAL(movstrSI28)) ++ ENDFUNC(GLOBAL(movstrSI24)) ++ ENDFUNC(GLOBAL(movstrSI20)) ++ ENDFUNC(GLOBAL(movstrSI16)) ++ ENDFUNC(GLOBAL(movstrSI12)) ++ ENDFUNC(GLOBAL(movstrSI8)) ++ ENDFUNC(GLOBAL(movstrSI4)) ++ ENDFUNC(GLOBAL(movstrSI0)) ++ + .align 4 + + .global GLOBAL(movstr) ++ FUNC(GLOBAL(movstr)) + GLOBAL(movstr): + mov.l @(60,r5),r0 + mov.l r0,@(60,r4) +@@ -771,6 +887,8 @@ + add #64,r5 + bra GLOBAL(movstr) + add #64,r4 ++ ++ FUNC(GLOBAL(movstr)) + #endif + + #ifdef L_movstr_i4 +@@ -779,6 +897,10 @@ + .global GLOBAL(movstr_i4_odd) + .global GLOBAL(movstrSI12_i4) + ++ FUNC(GLOBAL(movstr_i4_even)) ++ FUNC(GLOBAL(movstr_i4_odd)) ++ FUNC(GLOBAL(movstrSI12_i4)) ++ + .p2align 5 + L_movstr_2mod4_end: + mov.l r0,@(16,r4) +@@ -787,6 +909,11 @@ + + .p2align 2 + ++GLOBAL(movstr_i4_even): ++ mov.l @r5+,r0 ++ bra L_movstr_start_even ++ mov.l @r5+,r1 ++ + GLOBAL(movstr_i4_odd): + mov.l @r5+,r1 + add #-4,r4 +@@ -813,10 +940,8 @@ + rts + mov.l r3,@(12,r4) + +-GLOBAL(movstr_i4_even): +- mov.l @r5+,r0 +- bra L_movstr_start_even +- mov.l @r5+,r1 ++ ENDFUNC(GLOBAL(movstr_i4_even)) ++ ENDFUNC(GLOBAL(movstr_i4_odd)) + + .p2align 4 + GLOBAL(movstrSI12_i4): +@@ -827,12 +952,15 @@ + mov.l r1,@(4,r4) + rts + mov.l r2,@(8,r4) ++ ++ ENDFUNC(GLOBAL(movstrSI12_i4)) + #endif + + #ifdef L_mulsi3 + + + .global GLOBAL(mulsi3) ++ FUNC(GLOBAL(mulsi3)) + + ! r4 = aabb + ! r5 = ccdd +@@ -865,7 +993,7 @@ + rts + add r2,r0 + +- ++ FUNC(GLOBAL(mulsi3)) + #endif + #endif /* ! __SH5__ */ + #ifdef L_sdivsi3_i4 +@@ -875,6 +1003,7 @@ + !! args in r4 and r5, result in fpul, clobber dr0, dr2 + + .global GLOBAL(sdivsi3_i4) ++ FUNC(GLOBAL(sdivsi3_i4)) + GLOBAL(sdivsi3_i4): + lds r4,fpul + float fpul,dr0 +@@ -884,6 +1013,7 @@ + rts + ftrc dr0,fpul + ++ ENDFUNC(GLOBAL(sdivsi3_i4)) + #elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__) || (defined (__SH5__) && ! defined __SH4_NOFPU__) + !! args in r4 and r5, result in fpul, clobber r2, dr0, dr2 + +@@ -892,6 +1022,7 @@ + .mode SHcompact + #endif + .global GLOBAL(sdivsi3_i4) ++ FUNC(GLOBAL(sdivsi3_i4)) + GLOBAL(sdivsi3_i4): + sts.l fpscr,@-r15 + mov #8,r2 +@@ -906,6 +1037,7 @@ + rts + lds.l @r15+,fpscr + ++ ENDFUNC(GLOBAL(sdivsi3_i4)) + #endif /* ! __SH5__ || __SH5__ == 32 */ + #endif /* ! __SH4__ */ + #endif +@@ -920,9 +1052,10 @@ + !! + !! + +-!! args in r4 and r5, result in r0 clobber r1,r2,r3 ++!! args in r4 and r5, result in r0 clobber r1, r2, r3, and t bit + + .global GLOBAL(sdivsi3) ++ FUNC(GLOBAL(sdivsi3)) + #if __SHMEDIA__ + #if __SH5__ == 32 + .section .text..SHmedia32,"ax" +@@ -1166,6 +1299,7 @@ + div0: rts + mov #0,r0 + ++ ENDFUNC(GLOBAL(sdivsi3)) + #endif /* ! __SHMEDIA__ */ + #endif /* ! __SH4__ */ + #endif +@@ -1174,9 +1308,11 @@ + .title "SH DIVIDE" + !! 4 byte integer Divide code for the Hitachi SH + #ifdef __SH4__ +-!! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4 ++!! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4, ++!! and t bit + + .global GLOBAL(udivsi3_i4) ++ FUNC(GLOBAL(udivsi3_i4)) + GLOBAL(udivsi3_i4): + mov #1,r1 + cmp/hi r1,r5 +@@ -1217,11 +1353,13 @@ + L1: + .double 2147483648 + ++ ENDFUNC(GLOBAL(udivsi3_i4)) + #elif defined (__SH5__) && ! defined (__SH4_NOFPU__) + #if ! __SH5__ || __SH5__ == 32 + !! args in r4 and r5, result in fpul, clobber r20, r21, dr0, fr33 + .mode SHmedia + .global GLOBAL(udivsi3_i4) ++ FUNC(GLOBAL(udivsi3_i4)) + GLOBAL(udivsi3_i4): + addz.l r4,r63,r20 + addz.l r5,r63,r21 +@@ -1234,6 +1372,8 @@ + ftrc.dq dr0,dr32 + fmov.s fr33,fr32 + blink tr0,r63 ++ ++ ENDFUNC(GLOBAL(udivsi3_i4)) + #endif /* ! __SH5__ || __SH5__ == 32 */ + #elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__) + !! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4 +@@ -1287,6 +1427,7 @@ + #endif + .double 2147483648 + ++ ENDFUNC(GLOBAL(udivsi3_i4)) + #endif /* ! __SH4__ */ + #endif + +@@ -1297,6 +1438,7 @@ + + !! args in r4 and r5, result in r0, clobbers r4, pr, and t bit + .global GLOBAL(udivsi3) ++ FUNC(GLOBAL(udivsi3)) + + #if __SHMEDIA__ + #if __SH5__ == 32 +@@ -1485,6 +1627,7 @@ + rts + rotcl r0 + ++ ENDFUNC(GLOBAL(udivsi3)) + #endif /* ! __SHMEDIA__ */ + #endif /* __SH4__ */ + #endif /* L_udivsi3 */ +@@ -1790,6 +1933,7 @@ + .mode SHcompact + #endif + .global GLOBAL(set_fpscr) ++ FUNC(GLOBAL(set_fpscr)) + GLOBAL(set_fpscr): + lds r4,fpscr + mov.l LOCAL(set_fpscr_L1),r1 +@@ -1822,6 +1966,8 @@ + .align 2 + LOCAL(set_fpscr_L1): + .long GLOBAL(fpscr_values) ++ ++ ENDFUNC(GLOBAL(set_fpscr)) + #ifdef __ELF__ + .comm GLOBAL(fpscr_values),8,4 + #else +@@ -1860,6 +2006,7 @@ + blink tr0, r63 + #elif defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) + .global GLOBAL(ic_invalidate) ++ FUNC(GLOBAL(ic_invalidate)) + GLOBAL(ic_invalidate): + ocbwb @r4 + mova 0f,r0 +@@ -1882,6 +2029,8 @@ + nop + .endr + .endr ++ ++ ENDFUNC(GLOBAL(ic_invalidate)) + #endif /* SH4 */ + #endif /* L_ic_invalidate */ + +@@ -1940,6 +2089,7 @@ + will be expanded into r2/r3 upon return. */ + + .global GLOBAL(GCC_shcompact_call_trampoline) ++ FUNC(GLOBAL(GCC_shcompact_call_trampoline)) + GLOBAL(GCC_shcompact_call_trampoline): + ptabs/l r0, tr0 /* Prepare to call the actual function. */ + movi ((datalabel LOCAL(ct_main_table) - 31 * 2) >> 16) & 65535, r0 +@@ -2290,6 +2440,8 @@ + shari r2, 32, r2 + #endif + blink tr0, r63 ++ ++ ENDFUNC(GLOBAL(GCC_shcompact_call_trampoline)) + #endif /* L_shcompact_call_trampoline */ + + #ifdef L_shcompact_return_trampoline +@@ -2302,6 +2454,7 @@ + .section .text..SHmedia32, "ax" + .align 2 + .global GLOBAL(GCC_shcompact_return_trampoline) ++ FUNC(GLOBAL(GCC_shcompact_return_trampoline)) + GLOBAL(GCC_shcompact_return_trampoline): + ptabs/l r18, tr0 + #if __LITTLE_ENDIAN__ +@@ -2313,6 +2466,8 @@ + #endif + or r3, r2, r2 + blink tr0, r63 ++ ++ ENDFUNC(GLOBAL(GCC_shcompact_return_trampoline)) + #endif /* L_shcompact_return_trampoline */ + + #ifdef L_shcompact_incoming_args +@@ -2367,6 +2522,7 @@ + actual bit pattern. */ + + .global GLOBAL(GCC_shcompact_incoming_args) ++ FUNC(GLOBAL(GCC_shcompact_incoming_args)) + GLOBAL(GCC_shcompact_incoming_args): + ptabs/l r18, tr0 /* Prepare to return. */ + shlri r17, 32, r0 /* Load the cookie. */ +@@ -2519,6 +2675,7 @@ + LOCAL(ia_return): /* Return. */ + blink tr0, r63 + LOCAL(ia_end_of_push_seq): /* Label used to compute the first push instruction. */ ++ ENDFUNC(GLOBAL(GCC_shcompact_incoming_args)) + #endif /* L_shcompact_incoming_args */ + #endif + #if __SH5__ +@@ -2530,6 +2687,7 @@ + #endif + .align 3 /* It is copied in units of 8 bytes in SHmedia mode. */ + .global GLOBAL(GCC_nested_trampoline) ++ FUNC(GLOBAL(GCC_nested_trampoline)) + GLOBAL(GCC_nested_trampoline): + .mode SHmedia + ptrel/u r63, tr0 +@@ -2546,6 +2704,8 @@ + ld.l r0, 28, r1 + #endif + blink tr1, r63 ++ ++ ENDFUNC(GLOBAL(GCC_nested_trampoline)) + #endif /* L_nested_trampoline */ + #endif /* __SH5__ */ + #if __SH5__ == 32 +@@ -2555,6 +2715,7 @@ + .align 2 + #ifndef __SH4_NOFPU__ + .global GLOBAL(GCC_push_shmedia_regs) ++ FUNC(GLOBAL(GCC_push_shmedia_regs)) + GLOBAL(GCC_push_shmedia_regs): + addi.l r15, -14*8, r15 + fst.d r15, 13*8, dr62 +@@ -2573,6 +2734,7 @@ + fst.d r15, 0*8, dr36 + #endif + .global GLOBAL(GCC_push_shmedia_regs_nofpu) ++ FUNC(GLOBAL(GCC_push_shmedia_regs_nofpu)) + GLOBAL(GCC_push_shmedia_regs_nofpu): + ptabs/l r18, tr0 + addi.l r15, -27*8, r15 +@@ -2608,8 +2770,13 @@ + st.q r15, 0*8, r28 + blink tr0, r63 + ++#ifndef __SH4_NOFPU__ ++ ENDFUNC(GLOBAL(GCC_push_shmedia_regs)) ++#endif ++ ENDFUNC(GLOBAL(GCC_push_shmedia_regs_nofpu)) + #ifndef __SH4_NOFPU__ + .global GLOBAL(GCC_pop_shmedia_regs) ++ FUNC(GLOBAL(GCC_pop_shmedia_regs)) + GLOBAL(GCC_pop_shmedia_regs): + pt .L0, tr1 + movi 41*8, r0 +@@ -2630,6 +2797,7 @@ + blink tr1, r63 + #endif + .global GLOBAL(GCC_pop_shmedia_regs_nofpu) ++ FUNC(GLOBAL(GCC_pop_shmedia_regs_nofpu)) + GLOBAL(GCC_pop_shmedia_regs_nofpu): + movi 27*8, r0 + .L0: +@@ -2666,5 +2834,10 @@ + ld.q r15, 0*8, r28 + add.l r15, r0, r15 + blink tr0, r63 ++ ++#ifndef __SH4_NOFPU__ ++ ENDFUNC(GLOBAL(GCC_pop_shmedia_regs)) ++#endif ++ ENDFUNC(GLOBAL(GCC_pop_shmedia_regs_nofpu)) + #endif /* __SH5__ == 32 */ + #endif /* L_push_pop_shmedia_regs */ diff --git a/patches/gcc/3.3.3/sh-pic-set_fpscr-gcc-3.3.2.patch b/patches/gcc/3.3.3/sh-pic-set_fpscr-gcc-3.3.2.patch new file mode 100644 index 00000000..2a9d592b --- /dev/null +++ b/patches/gcc/3.3.3/sh-pic-set_fpscr-gcc-3.3.2.patch @@ -0,0 +1,67 @@ +See http://gcc.gnu.org/PR11901 +Should fix +make[2]: *** [/gcc-3.3-glibc-2.3.2/build-glibc/elf/check-textrel.out] Error 1 +in glibc's "make tests". + +Note: this patch is named +sh-pic-set_fpscr-gcc-3.3.2.patch +and must be applied after +sh-lib1funcs_sizeAndType.patch +but that'll happen naturally if you apply them in alphabetical order. + +------------- + +Date: Wed, 30 Jul 2003 12:03:01 +0900 +From: kaz Kojima <kkojima@rr.iij4u.or.jp> +Subject: [linux-sh:02916] Re: Writing PIC version of __udivsi3_i4? (was: Re: "make tests" fails + with "libc.so: text relocations used" in glibc-2.3.2 for sh4) +To: dank@kegel.com +Cc: linux-sh@m17n.org +Message-Id: <200307300255.h6U2tB906928@r-rr.iij4u.or.jp> + +> I'll try to write the PIC version of it, + +Dan, does the attached patch work for you? + +Regards, + kaz +-- +diff -u3prN ORIG/gcc/gcc/config/sh/lib1funcs.asm LOCAL/gcc/gcc/config/sh/lib1funcs.asm +--- ORIG/gcc/gcc/config/sh/lib1funcs.asm Thu Jun 19 07:38:59 2003 ++++ gcc-3.3.2/gcc/config/sh/lib1funcs.asm Wed Jul 30 11:08:49 2003 +@@ -1936,7 +1944,17 @@ GLOBAL(moddi3): + FUNC(GLOBAL(set_fpscr)) + GLOBAL(set_fpscr): + lds r4,fpscr ++#ifdef __PIC__ ++ mov.l r12,@-r15 ++ mova LOCAL(set_fpscr_L0),r0 ++ mov.l LOCAL(set_fpscr_L0),r12 ++ add r0,r12 ++ mov.l LOCAL(set_fpscr_L1),r0 ++ mov.l @(r0,r12),r1 ++ mov.l @r15+,r12 ++#else + mov.l LOCAL(set_fpscr_L1),r1 ++#endif + swap.w r4,r0 + or #24,r0 + #ifndef FMOVD_WORKS +@@ -1964,8 +1982,15 @@ GLOBAL(set_fpscr): + mov.l r3,@(4,r1) + #endif + .align 2 ++#ifdef __PIC__ ++LOCAL(set_fpscr_L0): ++ .long _GLOBAL_OFFSET_TABLE_ ++LOCAL(set_fpscr_L1): ++ .long GLOBAL(fpscr_values@GOT) ++#else + LOCAL(set_fpscr_L1): + .long GLOBAL(fpscr_values) ++#endif + + ENDFUNC(GLOBAL(set_fpscr)) + #ifndef NO_FPSCR_VALUES + + diff --git a/patches/gcc/3.3.3/thunk3.patch b/patches/gcc/3.3.3/thunk3.patch new file mode 100644 index 00000000..7974a0c0 --- /dev/null +++ b/patches/gcc/3.3.3/thunk3.patch @@ -0,0 +1,23 @@ +Fixes +FAIL: g++.jason/thunk3.C (test for excess errors) +on sh4-unknown-linux-gnu. + +Does any sh variant *not* use the generic thunk support? If so, the patch should be +more cautious. As it is, it excludes all sh processors from this test. + +Index: thunk3.C +=================================================================== +RCS file: /cvsroot/gcc/gcc/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C,v +retrieving revision 1.13 +diff -u -d -u -r1.13 thunk3.C +--- gcc-ss-3_3-20030714/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C.old 25 Mar 2002 17:57:03 -0000 1.13 ++++ gcc-ss-3_3-20030714/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C 20 Jul 2003 16:57:38 -0000 +@@ -2,7 +2,7 @@ + // Note that this will break on any target that uses the generic thunk + // support, because it doesn't support variadic functions. + +-// excess errors test - XFAIL mips*-*-* rs6000-*-* powerpc-*-eabi m68k-*-coff m68k-motorola-sysv m88k-motorola-sysv3 mn10300-*-* mn10200-*-* v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa-*-* ++// excess errors test - XFAIL mips*-*-* rs6000-*-* powerpc-*-eabi m68k-*-coff m68k-motorola-sysv m88k-motorola-sysv3 mn10300-*-* mn10200-*-* v850-*-* sh*-*-* h8*-*-* xtensa-*-* + + #include <stdarg.h> + diff --git a/patches/gcc/3.3.4/gcc-3.3.4-arm-bigendian.patch b/patches/gcc/3.3.4/gcc-3.3.4-arm-bigendian.patch new file mode 100644 index 00000000..0816b83e --- /dev/null +++ b/patches/gcc/3.3.4/gcc-3.3.4-arm-bigendian.patch @@ -0,0 +1,62 @@ +diff -urN gcc-3.3.4.orig/gcc/config/arm/linux-elf.h gcc-3.3.4/gcc/config/arm/linux-elf.h +--- gcc-3.3.4.orig/gcc/config/arm/linux-elf.h 2004-03-30 22:43:45.000000000 +0200 ++++ gcc-3.3.4/gcc/config/arm/linux-elf.h 2004-08-20 02:13:02.969084177 +0200 +@@ -30,17 +30,31 @@ + /* Do not assume anything about header files. */ + #define NO_IMPLICIT_EXTERN_C + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END ++#define TARGET_ENDIAN_OPTION "mbig-endian" ++#define TARGET_LINKER_EMULATION "armelfb_linux" ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#define TARGET_ENDIAN_OPTION "mlittle-endian" ++#define TARGET_LINKER_EMULATION "armelf_linux" ++#endif ++ + /* Default is to use APCS-32 mode. */ + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS) ++#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS | TARGET_ENDIAN_DEFAULT) + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" } + + #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" + +@@ -88,7 +102,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #define TARGET_OS_CPP_BUILTINS() \ +diff -urN gcc-3.3.4.orig/gcc/config.gcc gcc-3.3.4/gcc/config.gcc +--- gcc-3.3.4.orig/gcc/config.gcc 2004-04-29 06:42:47.000000000 +0200 ++++ gcc-3.3.4/gcc/config.gcc 2004-08-20 02:11:04.326143343 +0200 +@@ -699,6 +699,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + tm_file="dbxelf.h elfos.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h" ++ case $machine in ++ arm*b-*) ++ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" ++ ;; ++ esac + tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes diff --git a/patches/gcc/3.3.4/gcc-3.3.4-arm-pr22528.patch b/patches/gcc/3.3.4/gcc-3.3.4-arm-pr22528.patch new file mode 100644 index 00000000..0611e2c3 --- /dev/null +++ b/patches/gcc/3.3.4/gcc-3.3.4-arm-pr22528.patch @@ -0,0 +1,71 @@ +From http://gcc.gnu.org/ml/gcc-patches/2003-11/msg00832.html, by +Richard Earnshaw. Fixes http://gcc.gnu.org/PR22528 + +--- gcc-3.3.4/gcc/config/arm/arm.md.orig 2004-03-30 22:43:44.000000000 +0200 ++++ gcc-3.3.4/gcc/config/arm/arm.md 2005-08-15 12:21:55.000000000 +0200 +@@ -4275,7 +4275,7 @@ + (set (match_dup 2) + (ashiftrt:SI (match_operand 0 "" "") (const_int 8))) + ;; store the high byte +- (set (match_dup 4) (subreg:QI (match_dup 2) 0))] ;explicit subreg safe ++ (set (match_dup 4) (match_dup 5))] + "TARGET_ARM" + " + { +@@ -4291,7 +4291,8 @@ + operands[1] = adjust_address (operands[1], QImode, 0); + operands[3] = gen_lowpart (QImode, operands[0]); + operands[0] = gen_lowpart (SImode, operands[0]); +- operands[2] = gen_reg_rtx (SImode); ++ operands[2] = gen_reg_rtx (SImode); ++ operands[5] = gen_lowpart (QImode, operands[2]); + }" + ) + +@@ -4299,7 +4300,7 @@ + [(set (match_dup 4) (match_dup 3)) + (set (match_dup 2) + (ashiftrt:SI (match_operand 0 "" "") (const_int 8))) +- (set (match_operand 1 "" "") (subreg:QI (match_dup 2) 3))] ++ (set (match_operand 1 "" "") (match_dup 5))] + "TARGET_ARM" + " + { +@@ -4316,13 +4317,14 @@ + operands[3] = gen_lowpart (QImode, operands[0]); + operands[0] = gen_lowpart (SImode, operands[0]); + operands[2] = gen_reg_rtx (SImode); ++ operands[5] = gen_lowpart (QImode, operands[2]); + }" + ) + + ;; Subroutine to store a half word integer constant into memory. + (define_expand "storeinthi" + [(set (match_operand 0 "" "") +- (subreg:QI (match_operand 1 "" "") 0)) ++ (match_operand 1 "" "")) + (set (match_dup 3) (match_dup 2))] + "TARGET_ARM" + " +@@ -4363,6 +4365,7 @@ + operands[3] = adjust_address (op0, QImode, 1); + operands[0] = adjust_address (operands[0], QImode, 0); + operands[2] = gen_lowpart (QImode, operands[2]); ++ operands[1] = gen_lowpart (QImode, operands[1]); + }" + ) + +@@ -4682,11 +4685,12 @@ + (set (match_dup 3) + (ashiftrt:SI (match_dup 2) (const_int 16))) + (set (match_operand:HI 0 "s_register_operand" "") +- (subreg:HI (match_dup 3) 0))] ++ (match_dup 4))] + "TARGET_ARM" + " + operands[2] = gen_reg_rtx (SImode); + operands[3] = gen_reg_rtx (SImode); ++ operands[4] = gen_lowpart (HImode, operands[3]); + " + ) + diff --git a/patches/gcc/3.3.4/gcc-3.3.4-libstdcxx-sh.patch b/patches/gcc/3.3.4/gcc-3.3.4-libstdcxx-sh.patch new file mode 100644 index 00000000..4f21be33 --- /dev/null +++ b/patches/gcc/3.3.4/gcc-3.3.4-libstdcxx-sh.patch @@ -0,0 +1,38 @@ +Date: Tue, 06 Jul 2004 10:40:57 +0900 (JST) +Message-Id: <20040706.104057.48529182.kkojima@rr.iij4u.or.jp> +To: dank@kegel.com +Cc: linux-sh@m17n.org, linuxsh-dev@lists.sourceforge.net +Subject: gcc-3.4.1 (Was: The current kernel for a Jornada 680 SH3) +From: Kaz Kojima <kkojima@rr.iij4u.or.jp> +In-Reply-To: <20040529.175014.48668611.kkojima@rr.iij4u.or.jp> +References: <20040528.125858.50336810.kkojima@rr.iij4u.or.jp> + <40B8205D.8030200@kegel.com> + <20040529.175014.48668611.kkojima@rr.iij4u.or.jp> + +Hi, + +... + +BTW, gcc-3.3.4 was also released and there is a bad news :-( Someone +reverted wrongly a configury patch against libstdc++ for sh-linux at +the last moment. We have to regenerate gcc-3.3.4/libstdc++-v3/configure +with autoconf 2.13 or apply the one-line patch below manually: + +--- gcc-3.3.4-orig/libstdc++-v3/configure 2004-06-01 09:45:44.000000000 +0900 ++++ gcc-3.3.4/libstdc++-v3/configure 2004-06-29 22:38:05.000000000 +0900 +@@ -2009,7 +2009,7 @@ irix5* | irix6*) + # This must be Linux ELF. + linux-gnu*) + case $host_cpu in +- alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) ++ alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | sh* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + + +Regards, + kaz + + + diff --git a/patches/gcc/3.3.4/gcc-3.3.4-ppc-asm-spec.patch b/patches/gcc/3.3.4/gcc-3.3.4-ppc-asm-spec.patch new file mode 100644 index 00000000..9e459432 --- /dev/null +++ b/patches/gcc/3.3.4/gcc-3.3.4-ppc-asm-spec.patch @@ -0,0 +1,86 @@ +Based on gcc-3.4.0/gcc-3.3.3h-ppc-asm-spec.patch + +Fixes the following errors when building gcc for ppc7450: + +/tmp/ccj38uQs.s: Assembler messages: +/tmp/ccj38uQs.s:4370: Error: Unrecognized opcode: `mfvrsave' +/tmp/ccj38uQs.s:4404: Error: Unrecognized opcode: `stvx' +/tmp/ccj38uQs.s:4571: Error: Unrecognized opcode: `lvx' +/tmp/ccj38uQs.s:4572: Error: Unrecognized opcode: `mtvrsave' +make[2]: *** [libgcc/./unwind-dw2.o] Error 1 +make[2]: Leaving directory `/opt/crosstool-0.28-rc35/build/powerpc-7450-linux-gnu/gcc-3.3.4-glibc-2.3.2/build-gcc-core/gcc' +make[1]: *** [stmp-multilib] Error 2 +make[1]: Leaving directory `/opt/crosstool-0.28-rc35/build/powerpc-7450-linux-gnu/gcc-3.3.4-glibc-2.3.2/build-gcc-core/gcc' +make: *** [all-gcc] Error 2 + +Note that the "-mcpu=7450" option must appear on the "gcc" command line in +order for "-maltivec" to be passed to the assembler. Or, "-maltivec" itself +may be passed to the "gcc" command. + +Contributed by Tom Warzeka <waz@quahog.npt.nuwc.navy.mil> + +=================================================================== +--- gcc-3.3.4/gcc/config/rs6000/rs6000.h~ 2004-02-01 23:40:49.000000000 -0500 ++++ gcc-3.3.4/gcc/config/rs6000/rs6000.h 2004-08-18 14:15:57.000000000 -0400 +@@ -52,23 +52,29 @@ + "%{!mcpu*: \ + %{mpower: %{!mpower2: -mpwr}} \ + %{mpower2: -mpwrx} \ +- %{mpowerpc*: -mppc} \ ++ %{mpowerpc64*: -mppc64} \ ++ %{!mpowerpc64*: %{mpowerpc*: -mppc}} \ + %{mno-power: %{!mpowerpc*: -mcom}} \ +- %{!mno-power: %{!mpower2: %(asm_default)}}} \ ++ %{!mno-power: %{!mpower*: %(asm_default)}}} \ + %{mcpu=common: -mcom} \ + %{mcpu=power: -mpwr} \ + %{mcpu=power2: -mpwrx} \ +-%{mcpu=power3: -m604} \ ++%{mcpu=power3: -mppc64} \ + %{mcpu=power4: -mpower4} \ ++%{mcpu=power5: -mpower4} \ + %{mcpu=powerpc: -mppc} \ + %{mcpu=rios: -mpwr} \ + %{mcpu=rios1: -mpwr} \ + %{mcpu=rios2: -mpwrx} \ + %{mcpu=rsc: -mpwr} \ + %{mcpu=rsc1: -mpwr} \ ++%{mcpu=rs64a: -mppc64} \ + %{mcpu=401: -mppc} \ + %{mcpu=403: -m403} \ + %{mcpu=405: -m405} \ ++%{mcpu=405fp: -m405} \ ++%{mcpu=440: -m440} \ ++%{mcpu=440fp: -m440} \ + %{mcpu=505: -mppc} \ + %{mcpu=601: -m601} \ + %{mcpu=602: -mppc} \ +@@ -77,18 +83,23 @@ + %{mcpu=ec603e: -mppc} \ + %{mcpu=604: -mppc} \ + %{mcpu=604e: -mppc} \ +-%{mcpu=620: -mppc} \ +-%{mcpu=630: -m604} \ ++%{mcpu=620: -mppc64} \ ++%{mcpu=630: -mppc64} \ + %{mcpu=740: -mppc} \ +-%{mcpu=7400: -mppc} \ +-%{mcpu=7450: -mppc} \ + %{mcpu=750: -mppc} \ ++%{mcpu=G3: -mppc} \ ++%{mcpu=7400: -mppc -maltivec} \ ++%{mcpu=7450: -mppc -maltivec} \ ++%{mcpu=G4: -mppc -maltivec} \ + %{mcpu=801: -mppc} \ + %{mcpu=821: -mppc} \ + %{mcpu=823: -mppc} \ + %{mcpu=860: -mppc} \ ++%{mcpu=970: -mpower4 -maltivec} \ ++%{mcpu=G5: -mpower4 -maltivec} \ + %{mcpu=8540: -me500} \ +-%{maltivec: -maltivec}" ++%{maltivec: -maltivec} \ ++-many" + + #define CPP_DEFAULT_SPEC "" + diff --git a/patches/gcc/3.3.4/gcc-3.3.4-trap-posix.patch b/patches/gcc/3.3.4/gcc-3.3.4-trap-posix.patch new file mode 100644 index 00000000..eef35b5a --- /dev/null +++ b/patches/gcc/3.3.4/gcc-3.3.4-trap-posix.patch @@ -0,0 +1,44 @@ +# +# Submitted-By: Marc Kleine-Budde <mkl@pengutronix.de>, 2005-04-20 +# +# Error: +# +# creating libintl.h +# Configuring etc... +# loading cache ../config.cache +# checking for a BSD compatible install... (cached) /usr/bin/install -c +# creating ./config.status +# creating Makefile +# trap: usage: trap [-lp] [[arg] signal_spec ...] +# +# Description: +# +# non-posix conform usage of trap causes bash >= 3.0 to fail +# e.g.: http://sourceware.org/ml/crossgcc/2004-12/msg00132.html +# +# Status: +# +# fixed in gcc >= 3.3.5 +# backport of gcc-3.3.5 fix +# +diff -ruN gcc-3.3.4-orig/configure gcc-3.3.4/configure +--- gcc-3.3.4-orig/configure 2002-09-29 18:11:24.000000000 +0200 ++++ gcc-3.3.4/configure 2005-04-20 21:11:30.000000000 +0200 +@@ -697,7 +697,7 @@ + if test -f skip-this-dir; then + # Perform the same cleanup as the trap handler, minus the "exit 1" of course, + # and reset the trap handler. +- trap 0 ++ trap '' 0 + rm -rf Makefile* ${tmpdir} + # Execute the final clean-up actions + ${config_shell} skip-this-dir +@@ -1596,7 +1596,7 @@ + # Perform the same cleanup as the trap handler, minus the "exit 1" of course, + # and reset the trap handler. + rm -rf ${tmpdir} +-trap 0 ++trap '' 0 + + exit 0 + diff --git a/patches/gcc/3.3.5/gcc-3.3.4-arm-bigendian.patch b/patches/gcc/3.3.5/gcc-3.3.4-arm-bigendian.patch new file mode 100644 index 00000000..0816b83e --- /dev/null +++ b/patches/gcc/3.3.5/gcc-3.3.4-arm-bigendian.patch @@ -0,0 +1,62 @@ +diff -urN gcc-3.3.4.orig/gcc/config/arm/linux-elf.h gcc-3.3.4/gcc/config/arm/linux-elf.h +--- gcc-3.3.4.orig/gcc/config/arm/linux-elf.h 2004-03-30 22:43:45.000000000 +0200 ++++ gcc-3.3.4/gcc/config/arm/linux-elf.h 2004-08-20 02:13:02.969084177 +0200 +@@ -30,17 +30,31 @@ + /* Do not assume anything about header files. */ + #define NO_IMPLICIT_EXTERN_C + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END ++#define TARGET_ENDIAN_OPTION "mbig-endian" ++#define TARGET_LINKER_EMULATION "armelfb_linux" ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#define TARGET_ENDIAN_OPTION "mlittle-endian" ++#define TARGET_LINKER_EMULATION "armelf_linux" ++#endif ++ + /* Default is to use APCS-32 mode. */ + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS) ++#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS | TARGET_ENDIAN_DEFAULT) + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" } + + #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" + +@@ -88,7 +102,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #define TARGET_OS_CPP_BUILTINS() \ +diff -urN gcc-3.3.4.orig/gcc/config.gcc gcc-3.3.4/gcc/config.gcc +--- gcc-3.3.4.orig/gcc/config.gcc 2004-04-29 06:42:47.000000000 +0200 ++++ gcc-3.3.4/gcc/config.gcc 2004-08-20 02:11:04.326143343 +0200 +@@ -699,6 +699,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + tm_file="dbxelf.h elfos.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h" ++ case $machine in ++ arm*b-*) ++ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" ++ ;; ++ esac + tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes diff --git a/patches/gcc/3.3.5/gcc-3.3.4-arm-pr22528.patch b/patches/gcc/3.3.5/gcc-3.3.4-arm-pr22528.patch new file mode 100644 index 00000000..0611e2c3 --- /dev/null +++ b/patches/gcc/3.3.5/gcc-3.3.4-arm-pr22528.patch @@ -0,0 +1,71 @@ +From http://gcc.gnu.org/ml/gcc-patches/2003-11/msg00832.html, by +Richard Earnshaw. Fixes http://gcc.gnu.org/PR22528 + +--- gcc-3.3.4/gcc/config/arm/arm.md.orig 2004-03-30 22:43:44.000000000 +0200 ++++ gcc-3.3.4/gcc/config/arm/arm.md 2005-08-15 12:21:55.000000000 +0200 +@@ -4275,7 +4275,7 @@ + (set (match_dup 2) + (ashiftrt:SI (match_operand 0 "" "") (const_int 8))) + ;; store the high byte +- (set (match_dup 4) (subreg:QI (match_dup 2) 0))] ;explicit subreg safe ++ (set (match_dup 4) (match_dup 5))] + "TARGET_ARM" + " + { +@@ -4291,7 +4291,8 @@ + operands[1] = adjust_address (operands[1], QImode, 0); + operands[3] = gen_lowpart (QImode, operands[0]); + operands[0] = gen_lowpart (SImode, operands[0]); +- operands[2] = gen_reg_rtx (SImode); ++ operands[2] = gen_reg_rtx (SImode); ++ operands[5] = gen_lowpart (QImode, operands[2]); + }" + ) + +@@ -4299,7 +4300,7 @@ + [(set (match_dup 4) (match_dup 3)) + (set (match_dup 2) + (ashiftrt:SI (match_operand 0 "" "") (const_int 8))) +- (set (match_operand 1 "" "") (subreg:QI (match_dup 2) 3))] ++ (set (match_operand 1 "" "") (match_dup 5))] + "TARGET_ARM" + " + { +@@ -4316,13 +4317,14 @@ + operands[3] = gen_lowpart (QImode, operands[0]); + operands[0] = gen_lowpart (SImode, operands[0]); + operands[2] = gen_reg_rtx (SImode); ++ operands[5] = gen_lowpart (QImode, operands[2]); + }" + ) + + ;; Subroutine to store a half word integer constant into memory. + (define_expand "storeinthi" + [(set (match_operand 0 "" "") +- (subreg:QI (match_operand 1 "" "") 0)) ++ (match_operand 1 "" "")) + (set (match_dup 3) (match_dup 2))] + "TARGET_ARM" + " +@@ -4363,6 +4365,7 @@ + operands[3] = adjust_address (op0, QImode, 1); + operands[0] = adjust_address (operands[0], QImode, 0); + operands[2] = gen_lowpart (QImode, operands[2]); ++ operands[1] = gen_lowpart (QImode, operands[1]); + }" + ) + +@@ -4682,11 +4685,12 @@ + (set (match_dup 3) + (ashiftrt:SI (match_dup 2) (const_int 16))) + (set (match_operand:HI 0 "s_register_operand" "") +- (subreg:HI (match_dup 3) 0))] ++ (match_dup 4))] + "TARGET_ARM" + " + operands[2] = gen_reg_rtx (SImode); + operands[3] = gen_reg_rtx (SImode); ++ operands[4] = gen_lowpart (HImode, operands[3]); + " + ) + diff --git a/patches/gcc/3.3.6/fix-fixincl.patch b/patches/gcc/3.3.6/fix-fixincl.patch new file mode 100644 index 00000000..7936b19b --- /dev/null +++ b/patches/gcc/3.3.6/fix-fixincl.patch @@ -0,0 +1,70 @@ +See http://gcc.gnu.org/PR22541 + +From: Dan Kegel + +When building gcc-3.4.3 or gcc-4.0.0 as a cross into a clean $PREFIX +(the only two I've tried like this), the configure script happily copies +the glibc include files from include to sys-include; here's the line +from the log file (with $PREFIX instead of the real prefix): + +Copying $PREFIX/i686-unknown-linux-gnu/include to $PREFIX/i686-unknown-linux-gnu/sys-include + +But later, when running fixincludes, it gives the error message + The directory that should contain system headers does not exist: + $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/../../../../i686-unknown-linux-gnu/sys-include + +Nevertheless, it continues building; the header files it installs in + $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/include +do not include the boilerplate that would cause it to #include_next the +glibc headers in the system header directory. +Thus the resulting toolchain can't compile the following program: +#include <limits.h> +int x = PATH_MAX; +because its limits.h doesn't include the glibc header. + +That's not nice. I suspect the problem is that gcc/Makefile.in assumes that +it can refer to $PREFIX/i686-unknown-linux-gnu with the path + $PREFIX/lib/../i686-unknown-linux-gnu, but +that fails because the directory $PREFIX/lib doesn't exist during 'make all'; +it is only created later, during 'make install'. (Which makes this problem +confusing, since one only notices the breakage well after 'make install', +at which point the path configure complained about does exist, and has the +right stuff in it.) + +A possible fix is to replace the line in gcc/Makefile.in that says + SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@ +with a version that gets rid of extra ..'s, e.g. + SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,,;ta"` +(hey, that's the first time I've ever used a label in a sed script; thanks to the sed faq +for explaining the :a ... ta method of looping to repeat a search-and-replace until it doesn't match.) + + +--- gcc-3.4.3/gcc/Makefile.in.foo 2005-05-20 11:41:39.000000000 -0700 ++++ gcc-3.4.3/gcc/Makefile.in 2005-05-20 12:08:46.000000000 -0700 +@@ -350,7 +350,10 @@ + CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ + + # autoconf sets SYSTEM_HEADER_DIR to one of the above. +-SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@ ++# Purge it of unneccessary internal relative paths ++# to directories that might not exist yet. ++# The sed idiom for this is to repeat the search-and-replace until it doesn't match, using :a ... ta. ++SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta` + + # Control whether to run fixproto and fixincludes. + STMP_FIXPROTO = @STMP_FIXPROTO@ +@@ -2532,11 +2535,13 @@ + $(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(gcc_tooldir) + + # Build fixed copies of system files. ++# Abort if no system headers available, unless building a crosscompiler. ++# FIXME: abort unless building --without-headers would be more accurate and less ugly + stmp-fixinc: fixinc.sh gsyslimits.h + @if test ! -d ${SYSTEM_HEADER_DIR}; then \ + echo The directory that should contain system headers does not exist: >&2 ; \ + echo " ${SYSTEM_HEADER_DIR}" >&2 ; \ +- if test "x${SYSTEM_HEADER_DIR}" = "x${gcc_tooldir}/sys-include"; \ ++ if test "x${SYSTEM_HEADER_DIR}" = "x`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`"; \ + then sleep 1; else exit 1; fi; \ + fi + rm -rf include; mkdir include diff --git a/patches/gcc/3.3.6/gcc-3.3.4-arm-bigendian.patch b/patches/gcc/3.3.6/gcc-3.3.4-arm-bigendian.patch new file mode 100644 index 00000000..0816b83e --- /dev/null +++ b/patches/gcc/3.3.6/gcc-3.3.4-arm-bigendian.patch @@ -0,0 +1,62 @@ +diff -urN gcc-3.3.4.orig/gcc/config/arm/linux-elf.h gcc-3.3.4/gcc/config/arm/linux-elf.h +--- gcc-3.3.4.orig/gcc/config/arm/linux-elf.h 2004-03-30 22:43:45.000000000 +0200 ++++ gcc-3.3.4/gcc/config/arm/linux-elf.h 2004-08-20 02:13:02.969084177 +0200 +@@ -30,17 +30,31 @@ + /* Do not assume anything about header files. */ + #define NO_IMPLICIT_EXTERN_C + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END ++#define TARGET_ENDIAN_OPTION "mbig-endian" ++#define TARGET_LINKER_EMULATION "armelfb_linux" ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#define TARGET_ENDIAN_OPTION "mlittle-endian" ++#define TARGET_LINKER_EMULATION "armelf_linux" ++#endif ++ + /* Default is to use APCS-32 mode. */ + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS) ++#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS | TARGET_ENDIAN_DEFAULT) + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" } + + #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" + +@@ -88,7 +102,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #define TARGET_OS_CPP_BUILTINS() \ +diff -urN gcc-3.3.4.orig/gcc/config.gcc gcc-3.3.4/gcc/config.gcc +--- gcc-3.3.4.orig/gcc/config.gcc 2004-04-29 06:42:47.000000000 +0200 ++++ gcc-3.3.4/gcc/config.gcc 2004-08-20 02:11:04.326143343 +0200 +@@ -699,6 +699,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + tm_file="dbxelf.h elfos.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h" ++ case $machine in ++ arm*b-*) ++ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" ++ ;; ++ esac + tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes diff --git a/patches/gcc/3.3.6/gcc-3.3.4-arm-pr22528.patch b/patches/gcc/3.3.6/gcc-3.3.4-arm-pr22528.patch new file mode 100644 index 00000000..0611e2c3 --- /dev/null +++ b/patches/gcc/3.3.6/gcc-3.3.4-arm-pr22528.patch @@ -0,0 +1,71 @@ +From http://gcc.gnu.org/ml/gcc-patches/2003-11/msg00832.html, by +Richard Earnshaw. Fixes http://gcc.gnu.org/PR22528 + +--- gcc-3.3.4/gcc/config/arm/arm.md.orig 2004-03-30 22:43:44.000000000 +0200 ++++ gcc-3.3.4/gcc/config/arm/arm.md 2005-08-15 12:21:55.000000000 +0200 +@@ -4275,7 +4275,7 @@ + (set (match_dup 2) + (ashiftrt:SI (match_operand 0 "" "") (const_int 8))) + ;; store the high byte +- (set (match_dup 4) (subreg:QI (match_dup 2) 0))] ;explicit subreg safe ++ (set (match_dup 4) (match_dup 5))] + "TARGET_ARM" + " + { +@@ -4291,7 +4291,8 @@ + operands[1] = adjust_address (operands[1], QImode, 0); + operands[3] = gen_lowpart (QImode, operands[0]); + operands[0] = gen_lowpart (SImode, operands[0]); +- operands[2] = gen_reg_rtx (SImode); ++ operands[2] = gen_reg_rtx (SImode); ++ operands[5] = gen_lowpart (QImode, operands[2]); + }" + ) + +@@ -4299,7 +4300,7 @@ + [(set (match_dup 4) (match_dup 3)) + (set (match_dup 2) + (ashiftrt:SI (match_operand 0 "" "") (const_int 8))) +- (set (match_operand 1 "" "") (subreg:QI (match_dup 2) 3))] ++ (set (match_operand 1 "" "") (match_dup 5))] + "TARGET_ARM" + " + { +@@ -4316,13 +4317,14 @@ + operands[3] = gen_lowpart (QImode, operands[0]); + operands[0] = gen_lowpart (SImode, operands[0]); + operands[2] = gen_reg_rtx (SImode); ++ operands[5] = gen_lowpart (QImode, operands[2]); + }" + ) + + ;; Subroutine to store a half word integer constant into memory. + (define_expand "storeinthi" + [(set (match_operand 0 "" "") +- (subreg:QI (match_operand 1 "" "") 0)) ++ (match_operand 1 "" "")) + (set (match_dup 3) (match_dup 2))] + "TARGET_ARM" + " +@@ -4363,6 +4365,7 @@ + operands[3] = adjust_address (op0, QImode, 1); + operands[0] = adjust_address (operands[0], QImode, 0); + operands[2] = gen_lowpart (QImode, operands[2]); ++ operands[1] = gen_lowpart (QImode, operands[1]); + }" + ) + +@@ -4682,11 +4685,12 @@ + (set (match_dup 3) + (ashiftrt:SI (match_dup 2) (const_int 16))) + (set (match_operand:HI 0 "s_register_operand" "") +- (subreg:HI (match_dup 3) 0))] ++ (match_dup 4))] + "TARGET_ARM" + " + operands[2] = gen_reg_rtx (SImode); + operands[3] = gen_reg_rtx (SImode); ++ operands[4] = gen_lowpart (HImode, operands[3]); + " + ) + diff --git a/patches/gcc/3.3/compat.exp.patch b/patches/gcc/3.3/compat.exp.patch new file mode 100644 index 00000000..763b8a18 --- /dev/null +++ b/patches/gcc/3.3/compat.exp.patch @@ -0,0 +1,37 @@ +Fixes the following problem when testing a cross-compiler: + +============================================ +Testing g++.dg/compat/abi/bitfield1, +... +Invoking the compiler as /crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/build-gcc/gcc/testsuite/../g++ ... +/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/gcc/testsuite/g++.dg/compat/abi/bitfield1_main.C +pid is 16028 -16028 +compiler exited with status 1 +output is: +sh: error while loading shared libraries: /opt/cegl-2.0/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/powerpc-750-linux-gnu/./lib/libdl.so.2: ELF file data encoding not little-endian +/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/build-gcc/gcc/testsuite/../g++: error while loading shared libraries: /opt/cegl-2.0/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/powerpc-750-linux-gnu/./lib/libc.so.6: ELF file data encoding not little-endian + +FAIL: g++.dg/compat/abi/bitfield1 main_tst.o compile +============================================ + +--- gcc-3.3/gcc/testsuite/g++.dg/compat/compat.exp.old Thu Oct 17 17:22:57 2002 ++++ gcc-3.3/gcc/testsuite/g++.dg/compat/compat.exp Mon Jul 14 10:59:19 2003 +@@ -42,11 +42,13 @@ + proc compat-fix-library-path { } { + global ld_library_path + +- # See comments in lib/g++.exp for why this is needed. +- setenv LD_LIBRARY_PATH $ld_library_path +- setenv SHLIB_PATH $ld_library_path +- setenv LD_LIBRARYN32_PATH $ld_library_path +- setenv LD_LIBRARY64_PATH $ld_library_path ++ if {![is_remote target]} { ++ # See comments in lib/g++.exp for why this is needed. ++ setenv LD_LIBRARY_PATH $ld_library_path ++ setenv SHLIB_PATH $ld_library_path ++ setenv LD_LIBRARYN32_PATH $ld_library_path ++ setenv LD_LIBRARY64_PATH $ld_library_path ++ } + } + + # diff --git a/patches/gcc/3.3/config.sub.patch b/patches/gcc/3.3/config.sub.patch new file mode 100644 index 00000000..928f9115 --- /dev/null +++ b/patches/gcc/3.3/config.sub.patch @@ -0,0 +1,72 @@ +When configuring a s390->s390 or cris->cris crosscompiler +(ok, I haven't hit this yet, but one of these days I'll get me an account +on an s390, and then I'll need this patch :-), you'll get the +following error: + ++ /build/s390-unknown-linux-gnu/gcc-3.3-glibc-2.3.2/gcc-3.3/configure +--target=s390-unknown-linux-gnu --host=s390-host_unknown-linux-gnu +--prefix=/result/s390-unknown-linux-gnu/gcc-3.3-glibc-2.3.2 +--enable-languages=c +--with-local-prefix=/result/s390-unknown-linux-gnu/gcc-3.3-glibc-2.3.2/s390- +unknown-linux-gnu --enable-threads=no --without-headers --with-newlib +--disable-shared +... +*** --with-headers is only supported when cross compiling + +This error pops up only when you're using Daniel Jacobowitz's technique +of slightly changing the target and host tuples to make them different +enough to force gcc's build system to not try to pull in system libraries +or headers. This technique is needed e.g. to build an x86 -> x86 +cross-compiler. +(The LFS developers ran into the same bug that prompted me to use +this technique; they point people who run into it to +http://linuxfromscratch.org/~greg/pure_lfs.txt, which is a different +way of avoiding this problem. I think the tuple tweak is the way to go, though.) + +config-patches@gnu.org rejected this patch, on the grounds that there +is only one vendor of each of those two architectures, so the +canonicalization is by definition correct. When I pointed out the +difficulty this causes for people building s390 -> s390 or +cris -> cris compilers that are incompatible with the system +libraries and thus must be built like cross-compilers, he grumped and said +"autoconf should let you specify a cross-compiler in some other way than +comparing tuple strings". + + + +--- gcc-3.3/config.sub.old Sun Jun 8 20:38:47 2003 ++++ gcc-3.3/config.sub Sun Jun 8 20:40:34 2003 +@@ -433,9 +433,12 @@ + crds | unos) + basic_machine=m68k-crds + ;; +- cris | cris-* | etrax*) ++ cris | etrax*) + basic_machine=cris-axis + ;; ++ cris-*) ++ basic_machine=cris-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; +@@ -820,11 +823,17 @@ + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; +- s390 | s390-*) ++ s390) + basic_machine=s390-ibm + ;; +- s390x | s390x-*) ++ s390-*) ++ basic_machine=s390-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; ++ s390x) + basic_machine=s390x-ibm ++ ;; ++ s390x-*) ++ basic_machine=s390x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + sa29200) + basic_machine=a29k-amd diff --git a/patches/gcc/3.3/gcc-3.2.3-g++.exp.patch b/patches/gcc/3.3/gcc-3.2.3-g++.exp.patch new file mode 100644 index 00000000..0de46fc4 --- /dev/null +++ b/patches/gcc/3.3/gcc-3.2.3-g++.exp.patch @@ -0,0 +1,98 @@ +g++ testsuite fixes for cross-compilers, Dan Kegel, Ixia Communications, 12 July 2003 + +The first hunk fixes the error + +/testsuite_flags: /testsuite_flags: No such file or directory + while executing +"exec sh ${odir_v3}/testsuite_flags --build-includes" + (procedure "g++_include_flags" line 21) + invoked from within +"g++_include_flags [get_multilibs] " + (procedure "g++_init" line 63) + invoked from within +"${tool}_init $test_file_name" + (procedure "runtest" line 19) + invoked from within +"runtest $test_name" + ("foreach" body line 42) + invoked from within +... +make[1]: [check-g++] Error 1 (ignored) + +The fix isn't especially pretty, but it worked for me, and can't hurt the +more common native compiler case. Maybe someone who knows the code better +can come up with a better fix. + +The second hunk fixes the error + +sh: error while loading shared libraries: /opt/cegl-2.0/powerpc-405-linux-gnu/gcc-3.2.3-glibc-2.2.5/powerpc-405-linux-gnu/./lib/libdl.so.2: ELF file data encoding not little-endian + +when trying to compile g++ testcases (!); setting up +the shared library environment when running crosstests of g++ +should either be done by a special board file, or by +setting up a remote chroot environment (see http://kegel.com/crosstool), +not by blithely setting LD_LIBRARY_PATH on the local system. + +--- gcc-3.2.3/gcc/testsuite/lib/g++.exp.old Fri Jul 11 15:42:47 2003 ++++ gcc-3.2.3/gcc/testsuite/lib/g++.exp Sat Jul 12 12:57:07 2003 +@@ -72,6 +72,8 @@ + # + proc g++_include_flags { paths } { + global srcdir ++ global objdir ++ global target_triplet + global HAVE_LIBSTDCXX_V3 + global TESTING_IN_BUILD_TREE + +@@ -90,6 +92,20 @@ + + if { ${HAVE_LIBSTDCXX_V3} } { + set odir_v3 [lookfor_file ${gccpath} libstdc++-v3] ++ if { $odir_v3 == "" } { ++ verbose "g++_include_flags: couldn't find libstdc++-v3 on first try, now looking in build directory $objdir" ++ # first assume no multilibs ++ set odir_v3 [lookfor_file ${objdir} "$target_triplet/libstdc++-v3"] ++ } ++ if { $odir_v3 == "" } { ++ verbose "g++_include_flags: couldn't find libstdc++-v3 on second try, trying multilib" ++ # assume multilib only one level deep ++ set multisub [file tail $gccpath] ++ set odir_v3 [lookfor_file ${objdir} "$target_triplet/$multisub/libstdc++-v3"] ++ } ++ if { $odir_v3 == "" } { ++ error "Can't find libstdc++-v3" ++ } + append flags [exec sh ${odir_v3}/testsuite_flags --build-includes] + } else { + set odir_v2 [lookfor_file ${gccpath} libstdc++] +@@ -192,16 +192,20 @@ + } + } + +- # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but +- # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH +- # (for the 64-bit ABI). The right way to do this would be to modify +- # unix.exp -- but that's not an option since it's part of DejaGNU +- # proper, so we do it here. We really only need to do +- # this on IRIX, but it shouldn't hurt to do it anywhere else. +- setenv LD_LIBRARY_PATH $ld_library_path +- setenv SHLIB_PATH $ld_library_path +- setenv LD_LIBRARYN32_PATH $ld_library_path +- setenv LD_LIBRARY64_PATH $ld_library_path ++ if {![is_remote target]} { ++ # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but ++ # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH ++ # (for the 64-bit ABI). The right way to do this would be to modify ++ # unix.exp -- but that's not an option since it's part of DejaGNU ++ # proper, so we do it here. We really only need to do ++ # this on IRIX, but it shouldn't hurt to do it anywhere else. ++ ++ # Doing this causes us to be unable to run cross-compilers. ++ setenv LD_LIBRARY_PATH $ld_library_path ++ setenv SHLIB_PATH $ld_library_path ++ setenv LD_LIBRARYN32_PATH $ld_library_path ++ setenv LD_LIBRARY64_PATH $ld_library_path ++ } + + return "$flags" + } diff --git a/patches/gcc/3.3/gcc-3.3-libstdc++-v3-dg.exp.patch b/patches/gcc/3.3/gcc-3.3-libstdc++-v3-dg.exp.patch new file mode 100644 index 00000000..aafc1306 --- /dev/null +++ b/patches/gcc/3.3/gcc-3.3-libstdc++-v3-dg.exp.patch @@ -0,0 +1,54 @@ +Without this patch, the command + +RUNTESTFLAGS=--target=powerpc-750-linux-gnu -v -v -v -v make check-target-libstdc++-v3 + +fails in two ways: +1. the -L option meant to locate the testsuite directory is incorrect, and +2. the wrong compiler is invoked, causing all sorts of havoc, not least of which +is the native compiler is invoked when we really wanted to invoke the cross-compiler +we just built. + +Here's an example log of the problem in action. Every testcase fails, this shows just one: +------------- +Invoking the compiler as g++ -ggdb3 -DDEBUG_ASSERT -I/home3/dank/wk/ixos/dap_interim/linux/3rdParty/crosstool/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/libstdc++-v3/testsuite /home3/dank/wk/ixos/dap_interim/linux/3rdParty/crosstool/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/libstdc++-v3/testsuite/20_util/binders.cc -g -O2 -DDEBUG_ASSERT -L/testsuite -lv3test -lm -o ./binders.exe +compiler exited with status 1 +output is: +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_function.h: In method `void binder2nd<mem_fun1_ref_t<void,Elem,int> >::operator ()(const Elem &) const':^M +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_algo.h:83: instantiated from `for_each<Elem *, binder2nd<mem_fun1_ref_t<void,Elem,int> > >(Elem *, Elem *, binder2nd<mem_fun1_ref_t<void,Elem,int> >)'^M +/home3/dank/wk/ixos/dap_interim/linux/3rdParty/crosstool/crosstool-0.12/build/powerpc-750-linux-gnu/gcc-3.3-glibc-2.2.5/gcc-3.3/libstdc++-v3/testsuite/20_util/binders.cc:43: instantiated from here^M +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_function.h:224: conversion from `const Elem' to `Elem &' discards qualifiers^M +/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_function.h:622: in passing argument 1 of `mem_fun1_ref_t<void,Elem,int>::operator ()(Elem &, int) const'^M +... +FAIL: 20_util/binders.cc (test for excess errors) +WARNING: 20_util/binders.cc compilation failed to produce executable +------------- + +And here's the patch. I'm not happy with it, and it probably gets some cases wrong, +but it seems to work for the common native case and for my cross-compiler case. + +--- gcc-3.3/libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp.old Sun Jul 13 10:42:01 2003 ++++ gcc-3.3/libstdc++-v3/testsuite/lib/libstdc++-v3-dg.exp Sun Jul 13 11:39:54 2003 +@@ -46,8 +46,23 @@ + global gluefile wrap_flags + global ld_library_path + global tool_root_dir ++ global target_triplet + + set blddir [lookfor_file [get_multilibs] libstdc++-v3] ++ if { $blddir == "" } { ++ set multilibs [get_multilibs] ++ # FIXME: assume multilib only one level deep ++ set multisub [file tail $multilibs] ++ verbose "libstdc++-v3-init: couldn't find libstdc++-v3 in $multilibs, trying $objdir" ++ set blddir [lookfor_file ${objdir} "$target_triplet/$multisub/libstdc++-v3"] ++ } ++ if { $blddir == "" } { ++ verbose "libstdc++-v3-init: couldn't find libstdc++-v3, trying $objdir without multilibs" ++ set blddir [lookfor_file ${objdir} "$target_triplet/libstdc++-v3"] ++ } ++ if { $blddir == "" } { ++ error "Can't find libstdc++-v3" ++ } + + # By default, we assume we want to run program images. + global dg-do-what-default diff --git a/patches/gcc/3.3/sh-pic-set_fpscr.patch b/patches/gcc/3.3/sh-pic-set_fpscr.patch new file mode 100644 index 00000000..00cfb4cf --- /dev/null +++ b/patches/gcc/3.3/sh-pic-set_fpscr.patch @@ -0,0 +1,60 @@ +Should fix +make[2]: *** [/gcc-3.3-glibc-2.3.2/build-glibc/elf/check-textrel.out] Error 1 +in glibc's "make tests". + +------------- + +Message-Id: <200307300255.h6U2tB906928@r-rr.iij4u.or.jp> +To: dank@kegel.com +Cc: linux-sh@m17n.org +Subject: Re: Writing PIC version of __udivsi3_i4? (was: Re: "make tests" fails + with "libc.so: text relocations used" in glibc-2.3.2 for sh4) +In-Reply-To: Your message of "Wed, 30 Jul 2003 11:20:49 +0900" + <200307300212.h6U2CH901209@r-rr.iij4u.or.jp> +References: <200307300212.h6U2CH901209@r-rr.iij4u.or.jp> +Date: Wed, 30 Jul 2003 12:03:01 +0900 +From: kaz Kojima <kkojima@rr.iij4u.or.jp> + +> I'll try to write the PIC version of it, + +Dan, does the attached patch work for you? + +[dank: original patch deleted; here's same thing rediffed against gcc-3.3 instead of HEAD] + +--- gcc-3.3/gcc/config/sh/lib1funcs.asm.old Tue Jul 29 21:37:29 2003 ++++ gcc-3.3/gcc/config/sh/lib1funcs.asm Tue Jul 29 21:40:58 2003 +@@ -1792,7 +1792,17 @@ + .global GLOBAL(set_fpscr) + GLOBAL(set_fpscr): + lds r4,fpscr ++#ifdef __PIC__ ++ mov.l r12,@-r15 ++ mova LOCAL(set_fpscr_L0),r0 ++ mov.l LOCAL(set_fpscr_L0),r12 ++ add r0,r12 ++ mov.l LOCAL(set_fpscr_L1),r0 ++ mov.l @(r0,r12),r1 ++ mov.l @r15+,r12 ++#else + mov.l LOCAL(set_fpscr_L1),r1 ++#endif + swap.w r4,r0 + or #24,r0 + #ifndef FMOVD_WORKS +@@ -1820,8 +1830,16 @@ + mov.l r3,@(4,r1) + #endif + .align 2 ++#ifdef __PIC__ ++LOCAL(set_fpscr_L0): ++ .long _GLOBAL_OFFSET_TABLE_ ++LOCAL(set_fpscr_L1): ++ .long GLOBAL(fpscr_values@GOT) ++#else + LOCAL(set_fpscr_L1): + .long GLOBAL(fpscr_values) ++#endif ++ + #ifdef __ELF__ + .comm GLOBAL(fpscr_values),8,4 + #else diff --git a/patches/gcc/3.3/sh-predef-gnu_source.patch b/patches/gcc/3.3/sh-predef-gnu_source.patch new file mode 100644 index 00000000..dc94f4c2 --- /dev/null +++ b/patches/gcc/3.3/sh-predef-gnu_source.patch @@ -0,0 +1,15 @@ +See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11096 +and http://gcc.gnu.org/ml/gcc-patches/2003-06/msg00424.html + +--- gcc-3.3/gcc/config/sh/linux.h.old Wed Jun 4 17:37:40 2003 ++++ gcc-3.3/gcc/config/sh/linux.h Wed Jun 4 17:38:16 2003 +@@ -53,5 +53,9 @@ + %{static:-static}" + ++/* The GNU C++ standard library requires that these macros be defined. */ ++#undef CPLUSPLUS_CPP_SPEC ++#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" ++ + #undef LIB_SPEC + #define LIB_SPEC \ + "%{shared: -lc} \ diff --git a/patches/gcc/3.3/sh-spec.patch b/patches/gcc/3.3/sh-spec.patch new file mode 100644 index 00000000..6266c1f5 --- /dev/null +++ b/patches/gcc/3.3/sh-spec.patch @@ -0,0 +1,45 @@ +Message-Id: <200308020452.h724q0n01509@r-rr.iij4u.or.jp> +To: dank@kegel.com +Cc: kkojima@rr.iij4u.or.jp +Subject: Re: Writing PIC version of __udivsi3_i4? +In-Reply-To: Your message of "Fri, 01 Aug 2003 21:15:27 -0700" + <3F2B3ADF.6030206@kegel.com> +References: <3F2B3ADF.6030206@kegel.com> +Date: Sat, 02 Aug 2003 13:58:05 +0900 +From: kaz Kojima <kkojima@rr.iij4u.or.jp> + +Dan Kegel <dank@kegel.com> wrote: +> It seems it might be from gcc's spec file: +> +> *subtarget_link_spec: +> %{shared:-shared} %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} %{!rpath:-rpath /lib}} %{static:-static} +> +> as the only place -rpath showed up was in the output of gcc -v as it +> was linking libc.so. +> +> Well, that's a clue, anyway! Guess I'll dig through the spec files +> tomorrow to see if I can figure it out some more. + +I've grepped gcc/config/*/*.h and found only SH and old libc1 stuffs +of i386/alpha include %{!rpath:-rpath ... in 3.3 release and the +current CVS. And my sh-gcc's specs doesn't have this :-( +It would be the Right Thing to remove this stuff simply. How about +the gcc patch below? + +Regards, + kaz +-- +--- gcc-3.3/gcc/config/sh/linux.h.orig Sat Aug 2 13:20:57 2003 ++++ gcc-3.3/gcc/config/sh/linux.h Sat Aug 2 13:22:42 2003 +@@ -48,8 +48,7 @@ do { \ + "%{shared:-shared} \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ +- %{!rpath:-rpath /lib}} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ + %{static:-static}" + + /* The GNU C++ standard library requires that these macros be defined. */ + + diff --git a/patches/gcc/3.3/sh4-kaz-workaround.patch b/patches/gcc/3.3/sh4-kaz-workaround.patch new file mode 100644 index 00000000..189b1323 --- /dev/null +++ b/patches/gcc/3.3/sh4-kaz-workaround.patch @@ -0,0 +1,145 @@ +[lightly edited to fit my patch directory - dank] + +From: kaz Kojima <kkojima@rr.iij4u.or.jp> +Date: Sat, 09 Aug 2003 09:46:21 +0900 +To: dank@kegel.com + +Hi Dan, + +I've come back from the vacation and looked glibc string test +failures on sh4. This looks a gcc problem. gcc-3.3/3.4 doesn't +compile these tests correctly. The attached testcase aborts on +gcc-3.3/3.4 -O2 but exits normally gcc-3.2 and gcc-3.0. +The option -O2 is not essential but it makes the testcase small. +The failed string tests include the same pattern of the code with +f=random to generate ramdom strings but they get strings with +embedded NULL characters :-( + +... +I've got a workaround below for this bug, though it might merely +paper over the real bug. Anyway, I'd like to send a PR for this. + +Regards, + kaz +-- +int val = 0xff00; + +int f (void) { return val; } + +unsigned char a[1]; + +void +foo (void) +{ + a[0] = f () & 255; + + if (!a[0]) + a[0] = f () & 255; + + if (!a[0]) + a[0] = 1 + (f () & 127); +} + +int +main (int argc, char **argv) +{ + foo (); + if (!a[0]) + abort (); + + return 0; +} + +-- + +diff -u3prN ORIG/gcc/gcc/config/sh/sh.c LOCAL/gcc/gcc/config/sh/sh.c +--- gcc/gcc/config/sh/sh.c.old Fri Aug 8 18:39:02 2003 ++++ gcc/gcc/config/sh/sh.c Fri Aug 8 22:31:02 2003 +@@ -6657,6 +6657,19 @@ arith_reg_dest (op, mode) + return arith_reg_operand (op, mode); + } + ++/* Like above, but for SImode compare destinations: forbid paradoxical ++ subregs, because it would get the combiner confused. */ ++int ++arith_reg_cmp_dest (op, mode) ++ rtx op; ++ enum machine_mode mode; ++{ ++ if (mode == SImode && GET_CODE (op) == SUBREG ++ && GET_MODE_SIZE (GET_MODE (SUBREG_REG (op))) < 4) ++ return 0; ++ return arith_reg_operand (op, mode); ++} ++ + int + int_gpr_dest (op, mode) + rtx op; +diff -u3prN ORIG/gcc/gcc/config/sh/sh.h LOCAL/gcc/gcc/config/sh/sh.h +--- gcc/gcc/config/sh/sh.h.old Fri Aug 8 18:39:02 2003 ++++ gcc/gcc/config/sh/sh.h Fri Aug 8 22:31:02 2003 +@@ -3365,6 +3365,7 @@ extern int rtx_equal_function_value_matt + {"and_operand", {SUBREG, REG, CONST_INT}}, \ + {"any_register_operand", {SUBREG, REG}}, \ + {"arith_operand", {SUBREG, REG, CONST_INT}}, \ ++ {"arith_reg_cmp_dest", {SUBREG, REG}}, \ + {"arith_reg_dest", {SUBREG, REG}}, \ + {"arith_reg_operand", {SUBREG, REG}}, \ + {"arith_reg_or_0_operand", {SUBREG, REG, CONST_INT, CONST_VECTOR}}, \ + +--- gcc-3.3/gcc/config/sh/sh.md.orig Tue Apr 15 10:06:10 2003 ++++ gcc-3.3/gcc/config/sh/sh.md Sat Aug 9 22:31:13 2003 +@@ -616,7 +616,7 @@ + + (define_insn "" + [(set (reg:SI T_REG) +- (eq:SI (and:SI (match_operand:SI 0 "arith_reg_operand" "z,r") ++ (eq:SI (and:SI (match_operand:SI 0 "arith_reg_cmp_dest" "z,r") + (match_operand:SI 1 "arith_operand" "L,r")) + (const_int 0)))] + "TARGET_SH1" +@@ -631,7 +631,7 @@ + + (define_insn "cmpeqsi_t" + [(set (reg:SI T_REG) +- (eq:SI (match_operand:SI 0 "arith_reg_operand" "r,z,r") ++ (eq:SI (match_operand:SI 0 "arith_reg_cmp_dest" "r,z,r") + (match_operand:SI 1 "arith_operand" "N,rI,r")))] + "TARGET_SH1" + "@ +@@ -642,7 +642,7 @@ + + (define_insn "cmpgtsi_t" + [(set (reg:SI T_REG) +- (gt:SI (match_operand:SI 0 "arith_reg_operand" "r,r") ++ (gt:SI (match_operand:SI 0 "arith_reg_cmp_dest" "r,r") + (match_operand:SI 1 "arith_reg_or_0_operand" "r,N")))] + "TARGET_SH1" + "@ +@@ -652,7 +652,7 @@ + + (define_insn "cmpgesi_t" + [(set (reg:SI T_REG) +- (ge:SI (match_operand:SI 0 "arith_reg_operand" "r,r") ++ (ge:SI (match_operand:SI 0 "arith_reg_cmp_dest" "r,r") + (match_operand:SI 1 "arith_reg_or_0_operand" "r,N")))] + "TARGET_SH1" + "@ +@@ -666,7 +666,7 @@ + + (define_insn "cmpgeusi_t" + [(set (reg:SI T_REG) +- (geu:SI (match_operand:SI 0 "arith_reg_operand" "r") ++ (geu:SI (match_operand:SI 0 "arith_reg_cmp_dest" "r") + (match_operand:SI 1 "arith_reg_operand" "r")))] + "TARGET_SH1" + "cmp/hs %1,%0" +@@ -674,7 +674,7 @@ + + (define_insn "cmpgtusi_t" + [(set (reg:SI T_REG) +- (gtu:SI (match_operand:SI 0 "arith_reg_operand" "r") ++ (gtu:SI (match_operand:SI 0 "arith_reg_cmp_dest" "r") + (match_operand:SI 1 "arith_reg_operand" "r")))] + "TARGET_SH1" + "cmp/hi %1,%0" diff --git a/patches/gcc/3.3/sh4-no-fix-protos.patch b/patches/gcc/3.3/sh4-no-fix-protos.patch new file mode 100644 index 00000000..c3c478f2 --- /dev/null +++ b/patches/gcc/3.3/sh4-no-fix-protos.patch @@ -0,0 +1,12 @@ +See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10331 +and http://gcc.gnu.org/ml/gcc-patches/2003-06/msg00423.html + +--- gcc-3.3/gcc/config/sh/t-linux.old Wed Jun 4 13:01:39 2003 ++++ gcc-3.3/gcc/config/sh/t-linux Wed Jun 4 13:02:12 2003 +@@ -1,3 +1,6 @@ ++# Don't run fixproto ++STMP_FIXPROTO = ++ + TARGET_LIBGCC2_CFLAGS = -fpic + LIB1ASMFUNCS_CACHE = _ic_invalidate + diff --git a/patches/gcc/3.3/sh4-pthread.patch b/patches/gcc/3.3/sh4-pthread.patch new file mode 100644 index 00000000..a0c9233b --- /dev/null +++ b/patches/gcc/3.3/sh4-pthread.patch @@ -0,0 +1,42 @@ +Patch to fix following test case failure: + + === libstdc++-v3 tests === +FAIL: thread/pthread1.cc (test for excess errors) +Excess errors: +/opt/cegl-2.0/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/sh4-unknown-linux-gnu/bin/ld: cannot find -lthread +collect2: ld returned 1 exit status + +Note that *any* program compiled with -pthread fails: + +/opt/cegl-2.0/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/bin/sh4-unknown-linux-gnu-gcc hello.c -pthread +/opt/cegl-2.0/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/lib/gcc-lib/sh4-unknown-linux-gnu/3.3.1/../../../../sh4-unknown-linux-gnu/bin/ld: cannot find -lthread +collect2: ld returned 1 exit status + +Compiling with -lpthread on the other hand works fine: +/opt/cegl-2.0/sh4-unknown-linux-gnu/gcc-ss-3_3-20030714-glibc-2.2.5/bin/sh4-unknown-linux-gnu-gcc hello.c -lpthread + +So -pthread is broken in some trivial way; it should invoke -lpthread, not -lthread, +at least when targeting Linux. + +http://www.sh-linux.org/rpm-2003/SRPMS/gcc-3.2.3-3.src.rpm contains a jumbo patch, +gcc-20030210-sh-linux-1.patch, that includes a fix for this. Here's the +appropriate hunk (brings in a fix for the documented -mieee option). +No idea if this fix is completely right, but it works for me... +- dank@kegel.com 20 Jul 2003 + +Index: linux.h +=================================================================== +RCS file: /cvsroot/gcc/gcc/gcc/config/sh/linux.h,v +retrieving revision 1.9.20.1 +diff -u -d -u -r1.9.20.1 linux.h +--- gcc-ss-3_3-20030714/gcc/config/sh/linux.h.old 6 Jun 2003 02:30:59 -0000 1.9.20.1 ++++ gcc-ss-3_3-20030714/gcc/config/sh/linux.h 20 Jul 2003 23:36:50 -0000 +@@ -59,7 +59,7 @@ + #undef LIB_SPEC + #define LIB_SPEC \ + "%{shared: -lc} \ +- %{!shared: %{pthread:-lthread} \ ++ %{!shared: %{mieee:-lieee} %{pthread:-lpthread} \ + %{profile:-lc_p} %{!profile: -lc}}" + + #undef STARTFILE_SPEC diff --git a/patches/gcc/3.4.0/gcc-3.3.3h-ppc-asm-spec.patch b/patches/gcc/3.4.0/gcc-3.3.3h-ppc-asm-spec.patch new file mode 100644 index 00000000..870024da --- /dev/null +++ b/patches/gcc/3.4.0/gcc-3.3.3h-ppc-asm-spec.patch @@ -0,0 +1,88 @@ +Retrieved from http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.h.diff?r1=1.234.2.28&r2=1.234.2.29 + +Should fix following error building gcc for ppc7450: + +/tmp/ccmfQBT9.s:5197: Error: Unrecognized opcode: `lvx' +make[2]: *** [libgcc/./unwind-dw2.o] Error 1 +make[2]: Leaving directory `build-gcc-core/gcc' +make[1]: *** [stmp-multilib] Error 2 +make[1]: Leaving directory `build-gcc-core/gcc' +make: *** [all-gcc] Error 2 + +(I'm not so sure about the unconditional -many it sends to binutils; +that seems redundant?) + +Revision 1.234.2.29, Tue May 25 06:08:57 2004 UTC (6 days, 11 hours ago) by amodra +Branch: hammer-3_3-branch +Changes since 1.234.2.28: +15 -11 lines + + * config/rs6000/rs6000.h (ASM_CPU_SPEC): Handle -mpowerpc64 and -mcpu + for power5 and rs64a. Correct condition for default. Correct power3, + 620, 630, 7400, 7450, G4, 970 and G5 -mcpu entries. Add -many. + +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.h,v +retrieving revision 1.234.2.28 +retrieving revision 1.234.2.29 +diff -u -r1.234.2.28 -r1.234.2.29 +--- gcc/gcc/config/rs6000/rs6000.h 2004/05/18 14:26:57 1.234.2.28 ++++ gcc/gcc/config/rs6000/rs6000.h 2004/05/25 06:08:57 1.234.2.29 +@@ -51,20 +51,23 @@ + "%{!mcpu*: \ + %{mpower: %{!mpower2: -mpwr}} \ + %{mpower2: -mpwrx} \ +- %{mpowerpc*: -mppc} \ ++ %{mpowerpc64*: -mppc64} \ ++ %{!mpowerpc64*: %{mpowerpc*: -mppc}} \ + %{mno-power: %{!mpowerpc*: -mcom}} \ +- %{!mno-power: %{!mpower2: %(asm_default)}}} \ ++ %{!mno-power: %{!mpower*: %(asm_default)}}} \ + %{mcpu=common: -mcom} \ + %{mcpu=power: -mpwr} \ + %{mcpu=power2: -mpwrx} \ +-%{mcpu=power3: -m604} \ ++%{mcpu=power3: -mppc64} \ + %{mcpu=power4: -mpower4} \ ++%{mcpu=power5: -mpower4} \ + %{mcpu=powerpc: -mppc} \ + %{mcpu=rios: -mpwr} \ + %{mcpu=rios1: -mpwr} \ + %{mcpu=rios2: -mpwrx} \ + %{mcpu=rsc: -mpwr} \ + %{mcpu=rsc1: -mpwr} \ ++%{mcpu=rs64a: -mppc64} \ + %{mcpu=401: -mppc} \ + %{mcpu=403: -m403} \ + %{mcpu=405: -m405} \ +@@ -79,22 +82,23 @@ + %{mcpu=ec603e: -mppc} \ + %{mcpu=604: -mppc} \ + %{mcpu=604e: -mppc} \ +-%{mcpu=620: -mppc} \ +-%{mcpu=630: -m604} \ ++%{mcpu=620: -mppc64} \ ++%{mcpu=630: -mppc64} \ + %{mcpu=740: -mppc} \ +-%{mcpu=7400: -mppc} \ +-%{mcpu=7450: -mppc} \ +-%{mcpu=G4: -mppc} \ + %{mcpu=750: -mppc} \ + %{mcpu=G3: -mppc} \ ++%{mcpu=7400: -mppc -maltivec} \ ++%{mcpu=7450: -mppc -maltivec} \ ++%{mcpu=G4: -mppc -maltivec} \ + %{mcpu=801: -mppc} \ + %{mcpu=821: -mppc} \ + %{mcpu=823: -mppc} \ + %{mcpu=860: -mppc} \ +-%{mcpu=970: -mpower4} \ +-%{mcpu=G5: -mpower4} \ ++%{mcpu=970: -mpower4 -maltivec} \ ++%{mcpu=G5: -mpower4 -maltivec} \ + %{mcpu=8540: -me500} \ +-%{maltivec: -maltivec}" ++%{maltivec: -maltivec} \ ++-many" + + #define CPP_DEFAULT_SPEC "" + diff --git a/patches/gcc/3.4.0/gcc-3.4.0-arm-bigendian.patch b/patches/gcc/3.4.0/gcc-3.4.0-arm-bigendian.patch new file mode 100644 index 00000000..c9288c6c --- /dev/null +++ b/patches/gcc/3.4.0/gcc-3.4.0-arm-bigendian.patch @@ -0,0 +1,70 @@ +By Lennert Buytenhek <buytenh@wantstofly.org> +Adds support for arm*b-linux* big-endian ARM targets + +See http://gcc.gnu.org/PR16350 + +diff -urN gcc-3.4.0.orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h +--- gcc-3.4.0.orig/gcc/config/arm/linux-elf.h 2004-01-31 07:18:11.000000000 +0100 ++++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-07-02 14:46:29.225443757 +0200 +@@ -30,17 +30,34 @@ + /* Do not assume anything about header files. */ + #define NO_IMPLICIT_EXTERN_C + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END ++#define TARGET_ENDIAN_OPTION "mbig-endian" ++#define TARGET_LINKER_EMULATION "armelfb_linux" ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#define TARGET_ENDIAN_OPTION "mlittle-endian" ++#define TARGET_LINKER_EMULATION "armelf_linux" ++#endif ++ + /* Default is to use APCS-32 mode. */ + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS) ++#define TARGET_DEFAULT \ ++ ( ARM_FLAG_APCS_32 | \ ++ ARM_FLAG_MMU_TRAPS | \ ++ TARGET_ENDIAN_DEFAULT ) + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" } + + #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" + +@@ -89,7 +106,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS() +diff -urN gcc-3.4.0.orig/gcc/config.gcc gcc-3.4.0/gcc/config.gcc +--- gcc-3.4.0.orig/gcc/config.gcc 2004-04-17 04:28:24.000000000 +0200 ++++ gcc-3.4.0/gcc/config.gcc 2004-07-02 14:44:40.045822542 +0200 +@@ -666,6 +666,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + 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" ++ case $target in ++ arm*b-*) ++ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" ++ ;; ++ esac + tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes diff --git a/patches/gcc/3.4.0/gcc-3.4.0-arm-lib1asm.patch b/patches/gcc/3.4.0/gcc-3.4.0-arm-lib1asm.patch new file mode 100644 index 00000000..69a79d5d --- /dev/null +++ b/patches/gcc/3.4.0/gcc-3.4.0-arm-lib1asm.patch @@ -0,0 +1,27 @@ +# Origin: from a patch by Dimitry Andric <dimitry@andric.com>, 2004-05-01 +# See http://gcc.gnu.org/PR14352 and http://gcc.gnu.org/PR16314 +# See also http://gcc.gnu.org/ml/gcc-patches/2004-08/msg02568.html et seq for why this isn't in mainline +# Fixes errors like the following when building glibc (or any other executable +# or shared library) when using gcc 3.4.0 for ARM with softfloat: +# +# .../libc_pic.os(.text+0x15834): In function `__modf': undefined reference to `__subdf3' +# .../libc_pic.os(.text+0x158b8): In function `__modf': undefined reference to `__subdf3' +# .../libc_pic.os(.text+0x1590c): In function `scalbn': undefined reference to `__muldf3' +# .../libc_pic.os(.text+0x15e94): In function `__ldexpf': undefined reference to `__eqsf2' +# .../libc_pic.os(.text+0xcee4c): In function `monstartup': undefined reference to `__fixsfsi' + +diff -urNd gcc-3.4.0-orig/gcc/config/arm/t-linux gcc-3.4.0/gcc/config/arm/t-linux +--- gcc-3.4.0-orig/gcc/config/arm/t-linux 2003-09-20 23:09:07.000000000 +0200 ++++ gcc-3.4.0/gcc/config/arm/t-linux 2004-05-01 20:31:59.102846400 +0200 +@@ -4,7 +4,10 @@ + LIBGCC2_DEBUG_CFLAGS = -g0 + + LIB1ASMSRC = arm/lib1funcs.asm +-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx ++LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \ ++ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ ++ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ ++ _fixsfsi _fixunssfsi + + # MULTILIB_OPTIONS = mhard-float/msoft-float + # MULTILIB_DIRNAMES = hard-float soft-float diff --git a/patches/gcc/3.4.0/gcc-3.4.0-arm-nolibfloat.patch b/patches/gcc/3.4.0/gcc-3.4.0-arm-nolibfloat.patch new file mode 100644 index 00000000..43eed3ef --- /dev/null +++ b/patches/gcc/3.4.0/gcc-3.4.0-arm-nolibfloat.patch @@ -0,0 +1,24 @@ +# Dimitry Andric <dimitry@andric.com>, 2004-05-01 +# +# * Removed the extra -lfloat option from LIBGCC_SPEC, since it isn't needed +# anymore. (The required functions are now in libgcc.) +# +# Fixes errors like +# arm-softfloat-linux-gnu/3.4.0/../../../../arm-softfloat-linux-gnu/bin/ld: cannot find -lfloat +# collect2: ld returned 1 exit status +# make[2]: *** [arm-softfloat-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/iconvdata/ISO8859-1.so] Error 1 +# when building glibc-2.3.3 with gcc-3.4.0 for arm-softfloat + +diff -urNd gcc-3.4.0-orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h +--- gcc-3.4.0-orig/gcc/config/arm/linux-elf.h 2004-01-31 07:18:11.000000000 +0100 ++++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-05-01 19:19:06.935979200 +0200 +@@ -55,7 +73,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add + the GNU/Linux magical crtbegin.o file (see crtstuff.c) which + diff --git a/patches/gcc/3.4.0/gcc-3.4.0-pr14808-refix.patch b/patches/gcc/3.4.0/gcc-3.4.0-pr14808-refix.patch new file mode 100644 index 00000000..2a48c99c --- /dev/null +++ b/patches/gcc/3.4.0/gcc-3.4.0-pr14808-refix.patch @@ -0,0 +1,46 @@ +See http://gcc.gnu.org/ml/gcc/2004-06/msg00394.html +This might fix the error + +strstream.s: Assembler messages: +strstream.s:8390: Error: junk `(%ecx)' after expression +strstream.s:8402: Error: junk `(%ecx)' after expression +strstream.s:8551: Error: junk `(%ecx)' after expression +strstream.s:8563: Error: junk `(%ecx)' after expression +make[3]: *** [strstream.lo] Error 1 +make[3]: Leaving directory `i686-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-gcc/i686-unknown-linux-gnu/libstdc++-v3/src' + +when building a cygwin->linux cross-compiler with gcc-3.4.0, +probably caused by patch to fix http://gcc.gnu.org/PR14808 + + +--- gcc-3.4.0/gcc/cp/method.c.old Sun Jun 6 22:46:04 2004 ++++ gcc-3.4.0/gcc/cp/method.c Sun Jun 6 22:48:13 2004 +@@ -286,7 +286,7 @@ + tree alias; + char buf[256]; + +-#if defined (__CYGWIN__) || defined (__MINGW32__) ++#if defined (TARGET_IS_PE_COFF) + if (DECL_ONE_ONLY (function)) + return function; + #endif +@@ -404,7 +404,7 @@ + push_to_top_level (); + + #if defined (ASM_OUTPUT_DEF) \ +- && !(defined (__CYGWIN__) || defined (__MINGW32__)) ++ && !defined (TARGET_IS_PE_COFF) + if (targetm.have_named_sections) + { + resolve_unique_section (function, 0, flag_function_sections); +--- gcc-3.4.0/gcc/config/i386/cygming.h.old Sun Jun 6 22:50:46 2004 ++++ gcc-3.4.0/gcc/config/i386/cygming.h Sun Jun 6 22:52:10 2004 +@@ -27,6 +27,8 @@ + + #define TARGET_EXECUTABLE_SUFFIX ".exe" + ++#define TARGET_IS_PE_COFF 1 ++ + #include <stdio.h> + + /* Masks for subtarget switches used by other files. */ diff --git a/patches/gcc/3.4.0/gcc-3.4.0-ultrasparc3-default64.patch b/patches/gcc/3.4.0/gcc-3.4.0-ultrasparc3-default64.patch new file mode 100644 index 00000000..6357f568 --- /dev/null +++ b/patches/gcc/3.4.0/gcc-3.4.0-ultrasparc3-default64.patch @@ -0,0 +1,52 @@ +Date: Sat, 1 May 2004 21:08:10 +0200 +From: Jakub Jelinek <jakub@redhat.com> +To: Dan Kegel <dank@kegel.com>, mark@codesourcery.com +Cc: gcc-patches@gcc.gnu.org +Subject: [PATCH] sparc64-linux --with-cpu=ultrasparc fix +Message-ID: <20040501190810.GD5191@sunsite.ms.mff.cuni.cz> +Reply-To: Jakub Jelinek <jakub@redhat.com> +References: <40940B11.9080907@kegel.com> +In-Reply-To: <40940B11.9080907@kegel.com> + +On Sat, May 01, 2004 at 01:39:45PM -0700, Dan Kegel wrote: +> I'm having a bit of trouble configuring gcc-3.4.0 for sparc64-linux. +> The resulting compiler defaults to sparc32, which is a problem +> because it means having to figure out how to add +> -mcpu=ultrasparc3 -Wa,-Av9a -m64 to CFLAGS for everything I build. +> The worst part is that this even affects libgcc.a, which makes it +> pretty hard to link any sparc64 executables. I could figure out +> how mklibgcc and multilibbing work, and maybe thereby get a good 64 bit +> libgcc.a, +> but I'd kind of like to avoid that for the moment, and just really get +> gcc to default to 64 bit output. +> +> What's the right way to get gcc to default to building 64 bit executables +> when targeting sparc64-linux? + +There was TARGET_CPU_ultrasparc3 missing in linux64.h. +I've commited the following fix to the trunk, but as it is not a regression, +I'm not sure if Mark is ok with this for gcc-3_4-branch. + +2004-05-01 Jakub Jelinek <jakub@redhat.com> + + * config/sparc/linux64.h (TARGET_DEFAULT): Make 64-bit by default + also for TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3. + +--- gcc-3.4.0/gcc/config/sparc/linux64.h.jj 2004-05-01 22:59:52.000000000 +0200 ++++ gcc-3.4.0/gcc/config/sparc/linux64.h 2004-05-01 23:00:41.126176529 +0200 +@@ -39,7 +39,9 @@ Boston, MA 02111-1307, USA. */ + #undef MD_EXEC_PREFIX + #undef MD_STARTFILE_PREFIX + +-#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc ++#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \ ++ || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc \ ++ || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3 + /* A 64 bit v9 compiler with stack-bias, + in a Medium/Low code model environment. */ + + + Jakub + + + diff --git a/patches/gcc/3.4.0/pr13250-fix.patch b/patches/gcc/3.4.0/pr13250-fix.patch new file mode 100644 index 00000000..ce68bb1b --- /dev/null +++ b/patches/gcc/3.4.0/pr13250-fix.patch @@ -0,0 +1,19 @@ +See http://gcc.gnu.org/PR13250 +Fixes bad code generated when compiling SHA256 for SH processor + +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.md,v +retrieving revision 1.171 +retrieving revision 1.172 +diff -u -r1.171 -r1.172 +--- gcc/gcc/config/sh/sh.md 2004/05/10 23:25:13 1.171 ++++ gcc/gcc/config/sh/sh.md 2004/05/28 05:47:36 1.172 +@@ -2194,7 +2194,7 @@ + parts[0] = gen_reg_rtx (SImode); + parts[1] = gen_reg_rtx (SImode); + emit_insn (gen_rotlsi3_16 (parts[2-choice], operands[1])); +- parts[choice-1] = operands[1]; ++ emit_move_insn (parts[choice-1], operands[1]); + emit_insn (gen_ashlsi3 (parts[0], parts[0], GEN_INT (8))); + emit_insn (gen_lshrsi3 (parts[1], parts[1], GEN_INT (8))); + emit_insn (gen_iorsi3 (operands[0], parts[0], parts[1])); diff --git a/patches/gcc/3.4.0/pr15647-fix.patch b/patches/gcc/3.4.0/pr15647-fix.patch new file mode 100644 index 00000000..6a4265d6 --- /dev/null +++ b/patches/gcc/3.4.0/pr15647-fix.patch @@ -0,0 +1,288 @@ +Received: (qmail 11693 invoked from network); 26 May 2004 03:17:41 -0000 +Received: from unknown (HELO r-rr.iij4u.or.jp) (210.130.0.76) + by sourceware dot org with SMTP; 26 May 2004 03:17:41 -0000 +Received: from localhost (frgw.3in.ne.jp [210.251.121.226]) + by r-rr dot iij4u dot or dot jp (8 dot 11 dot 6+IIJ/8 dot 11 dot 6) with ESMTP id i4Q3HbJ21421; + Wed, 26 May 2004 12:17:37 +0900 (JST) +Date: Wed, 26 May 2004 12:13:58 +0900 (JST) +Message-Id: <20040526.121358.39460214.kkojima@rr.iij4u.or.jp> +To: gcc-patches at gcc dot gnu dot org +Cc: Mark Mitchell <mark at codesourcery dot com> +Subject: [PATCH] Fix PR target/15647 for sh-linux +From: Kaz Kojima <kkojima at rr dot iij4u dot or dot jp> +Mime-Version: 1.0 +Content-Type: Text/Plain; charset=us-ascii +Content-Transfer-Encoding: 7bit + +Hi, + +The appended patch is to fix PR target/15647 + http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15647 +for linux. +__udivsi3 is exported from libgcc_s.so.1 and gcc generates the code +which assumes r1 will be not clobbered when calling __udivsi3 in SH3 +case. This is bad because r1 is clobbered by PLT. +The another functions listed in the standard libgcc-std.ver which +possively have similar problem are __ashlsi3, __ashrsi3 and __lshrsi3, +though these are used only by SH1/2. +The patch below simply uses an SH specific libgcc-std.ver which drops +these functions. SH linux uses a linker script libgcc_s.so having +libgcc.a as a suppementary library, so these functions given by +libgcc.a when needed in the link time. +Although mainline has one failure in bulding zlib which can be avoided +with -fno-reorder-blocks for sh3-unknown-linux-gnu target, x86 cross +to sh3-unknown-linux-gnu can be build successfully on mainline with +this patch except the above failure. 3.4-branch successfully bootstraps +with it and there are no new failures on the native sh4-unknown-linux-gnu. +The patch is highly sh-linux specific and seems to be safe. I'll check +it into mainline. +The original PR is also for sh3 netbsd. I'd like to leave it for the +netbsd experts. + +I think that it's too late for 3.3.4. Mark, is it also late for +3.4.1? + +Regards, + kaz +-- +2004-05-26 Kaz Kojima <kkojima@gcc.gnu.org> + + * config/sh/t-linux (SHLIB_MAPFILES): Use sh specific + libgcc-std.ver. + * config/sh/libgcc-std.ver: New file. + +diff -u3prN ORIG-gcc/gcc/config/sh/t-linux LOCAL-gcc/gcc/config/sh/t-linux +--- ORIG-gcc/gcc/config/sh/t-linux Mon Feb 16 20:13:25 2004 ++++ LOCAL-gcc/gcc/config/sh/t-linux Tue May 25 18:25:48 2004 +@@ -11,8 +11,11 @@ MULTILIB_EXCEPTIONS= + EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o + + # Override t-slibgcc-elf-ver to export some libgcc symbols with +-# the symbol versions that glibc used. +-SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver $(srcdir)/config/sh/libgcc-glibc.ver ++# the symbol versions that glibc used. Also use an sh specific ++# libgcc-std.ver to avoid to export some lib1func routines which ++# should not be called via PLT. ++SHLIB_MAPFILES = $(srcdir)/config/sh/libgcc-std.ver \ ++ $(srcdir)/config/sh/libgcc-glibc.ver + + # Override SHLIB_LINK and SHLIB_INSTALL to use linker script + # libgcc_s.so. +diff -u3prN ORIG-gcc/gcc/config/sh/libgcc-std.ver LOCAL-gcc/gcc/config/sh/libgcc-std.ver +--- ORIG-gcc/gcc/config/sh/libgcc-std.ver Thu Jan 1 09:00:00 1970 ++++ LOCAL-gcc/gcc/config/sh/libgcc-std.ver Tue May 25 18:50:54 2004 +@@ -0,0 +1,213 @@ ++GCC_3.0 { ++ # libgcc1 integer symbols ++ __absvsi2 ++ __addvsi3 ++ # __ashlsi3 ++ # __ashrsi3 ++ __divsi3 ++ # __lshrsi3 ++ __modsi3 ++ __mulsi3 ++ __mulvsi3 ++ __negvsi2 ++ __subvsi3 ++ # __udivsi3 ++ __umodsi3 ++ ++ # libgcc1 floating point symbols ++ __addsf3 ++ __adddf3 ++ __addxf3 ++ __addtf3 ++ __divsf3 ++ __divdf3 ++ __divxf3 ++ __divtf3 ++ __eqsf2 ++ __eqdf2 ++ __eqxf2 ++ __eqtf2 ++ __extenddfxf2 ++ __extenddftf2 ++ __extendsfdf2 ++ __extendsfxf2 ++ __extendsftf2 ++ __fixsfsi ++ __fixdfsi ++ __fixxfsi ++ __fixtfsi ++ __floatsisf ++ __floatsidf ++ __floatsixf ++ __floatsitf ++ __gesf2 ++ __gedf2 ++ __gexf2 ++ __getf2 ++ __gtsf2 ++ __gtdf2 ++ __gtxf2 ++ __gttf2 ++ __lesf2 ++ __ledf2 ++ __lexf2 ++ __letf2 ++ __ltsf2 ++ __ltdf2 ++ __ltxf2 ++ __lttf2 ++ __mulsf3 ++ __muldf3 ++ __mulxf3 ++ __multf3 ++ __negsf2 ++ __negdf2 ++ __negxf2 ++ __negtf2 ++ __nesf2 ++ __nedf2 ++ __nexf2 ++ __netf2 ++ __subsf3 ++ __subdf3 ++ __subxf3 ++ __subtf3 ++ __truncdfsf2 ++ __truncxfsf2 ++ __trunctfsf2 ++ __truncxfdf2 ++ __trunctfdf2 ++ ++ # libgcc2 DImode arithmetic (for 32-bit targets). ++ __absvdi2 ++ __addvdi3 ++ __ashldi3 ++ __ashrdi3 ++ __cmpdi2 ++ __divdi3 ++ __ffsdi2 ++ __fixdfdi ++ __fixsfdi ++ __fixtfdi ++ __fixxfdi ++ __fixunsdfdi ++ __fixunsdfsi ++ __fixunssfsi ++ __fixunssfdi ++ __fixunstfdi ++ __fixunstfsi ++ __fixunsxfdi ++ __fixunsxfsi ++ __floatdidf ++ __floatdisf ++ __floatdixf ++ __floatditf ++ __lshrdi3 ++ __moddi3 ++ __muldi3 ++ __mulvdi3 ++ __negdi2 ++ __negvdi2 ++ __subvdi3 ++ __ucmpdi2 ++ __udivdi3 ++ __udivmoddi4 ++ __umoddi3 ++ ++ # libgcc2 TImode arithmetic (for 64-bit targets). ++ __ashlti3 ++ __ashrti3 ++ __cmpti2 ++ __divti3 ++ __ffsti2 ++ __fixdfti ++ __fixsfti ++ __fixtfti ++ __fixxfti ++ __lshrti3 ++ __modti3 ++ __multi3 ++ __negti2 ++ __ucmpti2 ++ __udivmodti4 ++ __udivti3 ++ __umodti3 ++ __fixunsdfti ++ __fixunssfti ++ __fixunstfti ++ __fixunsxfti ++ __floattidf ++ __floattisf ++ __floattixf ++ __floattitf ++ ++ # Used to deal with trampoline initialization on some platforms ++ __clear_cache ++ ++ # EH symbols ++ _Unwind_DeleteException ++ _Unwind_Find_FDE ++ _Unwind_ForcedUnwind ++ _Unwind_GetGR ++ _Unwind_GetIP ++ _Unwind_GetLanguageSpecificData ++ _Unwind_GetRegionStart ++ _Unwind_GetTextRelBase ++ _Unwind_GetDataRelBase ++ _Unwind_RaiseException ++ _Unwind_Resume ++ _Unwind_SetGR ++ _Unwind_SetIP ++ __deregister_frame ++ __deregister_frame_info ++ __deregister_frame_info_bases ++ __register_frame ++ __register_frame_info ++ __register_frame_info_bases ++ __register_frame_info_table ++ __register_frame_info_table_bases ++ __register_frame_table ++ ++ # SjLj EH symbols ++ _Unwind_SjLj_Register ++ _Unwind_SjLj_Unregister ++ _Unwind_SjLj_RaiseException ++ _Unwind_SjLj_ForcedUnwind ++ _Unwind_SjLj_Resume ++} ++ ++%inherit GCC_3.3 GCC_3.0 ++GCC_3.3 { ++ _Unwind_FindEnclosingFunction ++ _Unwind_GetCFA ++ _Unwind_Backtrace ++ _Unwind_Resume_or_Rethrow ++ _Unwind_SjLj_Resume_or_Rethrow ++} ++ ++%inherit GCC_3.3.1 GCC_3.3 ++GCC_3.3.1 { ++ __gcc_personality_sj0 ++ __gcc_personality_v0 ++} ++ ++%inherit GCC_3.3.2 GCC_3.3.1 ++GCC_3.3.2 { ++} ++ ++%inherit GCC_3.4 GCC_3.3.2 ++GCC_3.4 { ++ # bit scanning and counting built-ins ++ __clzsi2 ++ __clzdi2 ++ __clzti2 ++ __ctzsi2 ++ __ctzdi2 ++ __ctzti2 ++ __popcountsi2 ++ __popcountdi2 ++ __popcountti2 ++ __paritysi2 ++ __paritydi2 ++ __parityti2 ++} + diff --git a/patches/gcc/3.4.1/fix-fixincl.patch b/patches/gcc/3.4.1/fix-fixincl.patch new file mode 100644 index 00000000..7936b19b --- /dev/null +++ b/patches/gcc/3.4.1/fix-fixincl.patch @@ -0,0 +1,70 @@ +See http://gcc.gnu.org/PR22541 + +From: Dan Kegel + +When building gcc-3.4.3 or gcc-4.0.0 as a cross into a clean $PREFIX +(the only two I've tried like this), the configure script happily copies +the glibc include files from include to sys-include; here's the line +from the log file (with $PREFIX instead of the real prefix): + +Copying $PREFIX/i686-unknown-linux-gnu/include to $PREFIX/i686-unknown-linux-gnu/sys-include + +But later, when running fixincludes, it gives the error message + The directory that should contain system headers does not exist: + $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/../../../../i686-unknown-linux-gnu/sys-include + +Nevertheless, it continues building; the header files it installs in + $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/include +do not include the boilerplate that would cause it to #include_next the +glibc headers in the system header directory. +Thus the resulting toolchain can't compile the following program: +#include <limits.h> +int x = PATH_MAX; +because its limits.h doesn't include the glibc header. + +That's not nice. I suspect the problem is that gcc/Makefile.in assumes that +it can refer to $PREFIX/i686-unknown-linux-gnu with the path + $PREFIX/lib/../i686-unknown-linux-gnu, but +that fails because the directory $PREFIX/lib doesn't exist during 'make all'; +it is only created later, during 'make install'. (Which makes this problem +confusing, since one only notices the breakage well after 'make install', +at which point the path configure complained about does exist, and has the +right stuff in it.) + +A possible fix is to replace the line in gcc/Makefile.in that says + SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@ +with a version that gets rid of extra ..'s, e.g. + SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,,;ta"` +(hey, that's the first time I've ever used a label in a sed script; thanks to the sed faq +for explaining the :a ... ta method of looping to repeat a search-and-replace until it doesn't match.) + + +--- gcc-3.4.3/gcc/Makefile.in.foo 2005-05-20 11:41:39.000000000 -0700 ++++ gcc-3.4.3/gcc/Makefile.in 2005-05-20 12:08:46.000000000 -0700 +@@ -350,7 +350,10 @@ + CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ + + # autoconf sets SYSTEM_HEADER_DIR to one of the above. +-SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@ ++# Purge it of unneccessary internal relative paths ++# to directories that might not exist yet. ++# The sed idiom for this is to repeat the search-and-replace until it doesn't match, using :a ... ta. ++SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta` + + # Control whether to run fixproto and fixincludes. + STMP_FIXPROTO = @STMP_FIXPROTO@ +@@ -2532,11 +2535,13 @@ + $(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(gcc_tooldir) + + # Build fixed copies of system files. ++# Abort if no system headers available, unless building a crosscompiler. ++# FIXME: abort unless building --without-headers would be more accurate and less ugly + stmp-fixinc: fixinc.sh gsyslimits.h + @if test ! -d ${SYSTEM_HEADER_DIR}; then \ + echo The directory that should contain system headers does not exist: >&2 ; \ + echo " ${SYSTEM_HEADER_DIR}" >&2 ; \ +- if test "x${SYSTEM_HEADER_DIR}" = "x${gcc_tooldir}/sys-include"; \ ++ if test "x${SYSTEM_HEADER_DIR}" = "x`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`"; \ + then sleep 1; else exit 1; fi; \ + fi + rm -rf include; mkdir include diff --git a/patches/gcc/3.4.1/gcc-3.4-sparc-pr16430-fix.patch b/patches/gcc/3.4.1/gcc-3.4-sparc-pr16430-fix.patch new file mode 100644 index 00000000..2fc805b6 --- /dev/null +++ b/patches/gcc/3.4.1/gcc-3.4-sparc-pr16430-fix.patch @@ -0,0 +1,42 @@ +Message-ID: <33159.207.230.144.240.1093980498.squirrel@207.230.144.240> +Date: Tue, 31 Aug 2004 14:28:18 -0500 (CDT) +Subject: Crosstool 0.28-rc35 +From: "Jason Rothstein" <fdragon@fdragon.org> +To: dank@kegel.com + +Could you please add the patches in GCC PR 16430 to GCC 3.4.1? + +http://gcc.gnu.org/PR16430 + +These fix one of 2 current ICE conditions when building a sparc64 ada +compilers. + + +http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sparc/sparc.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.271.4.16&r2=1.271.4.17 + +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/config/sparc/sparc.c,v +retrieving revision 1.271.4.16 +retrieving revision 1.271.4.17 +diff -u -r1.271.4.16 -r1.271.4.17 +--- gcc/gcc/config/sparc/sparc.c 2004/07/08 13:00:56 1.271.4.16 ++++ gcc/gcc/config/sparc/sparc.c 2004/07/08 14:36:51 1.271.4.17 +@@ -5808,6 +5808,18 @@ + abort (); + + mode = mode_for_size (bytes * BITS_PER_UNIT, MODE_INT, 0); ++ ++ /* ??? We probably should have made the same ABI change in ++ 3.4.0 as the one we made for unions. The latter was ++ required by the SCD though, while the former is not ++ specified, so we favored compatibility and efficiency. ++ ++ Now we're stuck for aggregates larger than 16 bytes, ++ because OImode vanished in the meantime. Let's not ++ try to be unduly clever, and simply follow the ABI ++ for unions in that case. */ ++ if (mode == BLKmode) ++ return function_arg_union_value (bytes, mode, regbase); + } + else if (GET_MODE_CLASS (mode) == MODE_INT + && GET_MODE_SIZE (mode) < UNITS_PER_WORD) diff --git a/patches/gcc/3.4.1/gcc-3.4.0-arm-bigendian.patch b/patches/gcc/3.4.1/gcc-3.4.0-arm-bigendian.patch new file mode 100644 index 00000000..c9288c6c --- /dev/null +++ b/patches/gcc/3.4.1/gcc-3.4.0-arm-bigendian.patch @@ -0,0 +1,70 @@ +By Lennert Buytenhek <buytenh@wantstofly.org> +Adds support for arm*b-linux* big-endian ARM targets + +See http://gcc.gnu.org/PR16350 + +diff -urN gcc-3.4.0.orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h +--- gcc-3.4.0.orig/gcc/config/arm/linux-elf.h 2004-01-31 07:18:11.000000000 +0100 ++++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-07-02 14:46:29.225443757 +0200 +@@ -30,17 +30,34 @@ + /* Do not assume anything about header files. */ + #define NO_IMPLICIT_EXTERN_C + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END ++#define TARGET_ENDIAN_OPTION "mbig-endian" ++#define TARGET_LINKER_EMULATION "armelfb_linux" ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#define TARGET_ENDIAN_OPTION "mlittle-endian" ++#define TARGET_LINKER_EMULATION "armelf_linux" ++#endif ++ + /* Default is to use APCS-32 mode. */ + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS) ++#define TARGET_DEFAULT \ ++ ( ARM_FLAG_APCS_32 | \ ++ ARM_FLAG_MMU_TRAPS | \ ++ TARGET_ENDIAN_DEFAULT ) + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" } + + #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" + +@@ -89,7 +106,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS() +diff -urN gcc-3.4.0.orig/gcc/config.gcc gcc-3.4.0/gcc/config.gcc +--- gcc-3.4.0.orig/gcc/config.gcc 2004-04-17 04:28:24.000000000 +0200 ++++ gcc-3.4.0/gcc/config.gcc 2004-07-02 14:44:40.045822542 +0200 +@@ -666,6 +666,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + 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" ++ case $target in ++ arm*b-*) ++ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" ++ ;; ++ esac + tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes diff --git a/patches/gcc/3.4.1/gcc-3.4.0-arm-lib1asm.patch b/patches/gcc/3.4.1/gcc-3.4.0-arm-lib1asm.patch new file mode 100644 index 00000000..69a79d5d --- /dev/null +++ b/patches/gcc/3.4.1/gcc-3.4.0-arm-lib1asm.patch @@ -0,0 +1,27 @@ +# Origin: from a patch by Dimitry Andric <dimitry@andric.com>, 2004-05-01 +# See http://gcc.gnu.org/PR14352 and http://gcc.gnu.org/PR16314 +# See also http://gcc.gnu.org/ml/gcc-patches/2004-08/msg02568.html et seq for why this isn't in mainline +# Fixes errors like the following when building glibc (or any other executable +# or shared library) when using gcc 3.4.0 for ARM with softfloat: +# +# .../libc_pic.os(.text+0x15834): In function `__modf': undefined reference to `__subdf3' +# .../libc_pic.os(.text+0x158b8): In function `__modf': undefined reference to `__subdf3' +# .../libc_pic.os(.text+0x1590c): In function `scalbn': undefined reference to `__muldf3' +# .../libc_pic.os(.text+0x15e94): In function `__ldexpf': undefined reference to `__eqsf2' +# .../libc_pic.os(.text+0xcee4c): In function `monstartup': undefined reference to `__fixsfsi' + +diff -urNd gcc-3.4.0-orig/gcc/config/arm/t-linux gcc-3.4.0/gcc/config/arm/t-linux +--- gcc-3.4.0-orig/gcc/config/arm/t-linux 2003-09-20 23:09:07.000000000 +0200 ++++ gcc-3.4.0/gcc/config/arm/t-linux 2004-05-01 20:31:59.102846400 +0200 +@@ -4,7 +4,10 @@ + LIBGCC2_DEBUG_CFLAGS = -g0 + + LIB1ASMSRC = arm/lib1funcs.asm +-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx ++LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \ ++ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ ++ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ ++ _fixsfsi _fixunssfsi + + # MULTILIB_OPTIONS = mhard-float/msoft-float + # MULTILIB_DIRNAMES = hard-float soft-float diff --git a/patches/gcc/3.4.1/gcc-3.4.0-arm-nolibfloat.patch b/patches/gcc/3.4.1/gcc-3.4.0-arm-nolibfloat.patch new file mode 100644 index 00000000..43eed3ef --- /dev/null +++ b/patches/gcc/3.4.1/gcc-3.4.0-arm-nolibfloat.patch @@ -0,0 +1,24 @@ +# Dimitry Andric <dimitry@andric.com>, 2004-05-01 +# +# * Removed the extra -lfloat option from LIBGCC_SPEC, since it isn't needed +# anymore. (The required functions are now in libgcc.) +# +# Fixes errors like +# arm-softfloat-linux-gnu/3.4.0/../../../../arm-softfloat-linux-gnu/bin/ld: cannot find -lfloat +# collect2: ld returned 1 exit status +# make[2]: *** [arm-softfloat-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/iconvdata/ISO8859-1.so] Error 1 +# when building glibc-2.3.3 with gcc-3.4.0 for arm-softfloat + +diff -urNd gcc-3.4.0-orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h +--- gcc-3.4.0-orig/gcc/config/arm/linux-elf.h 2004-01-31 07:18:11.000000000 +0100 ++++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-05-01 19:19:06.935979200 +0200 +@@ -55,7 +73,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add + the GNU/Linux magical crtbegin.o file (see crtstuff.c) which + diff --git a/patches/gcc/3.4.1/pr15068-fix.patch b/patches/gcc/3.4.1/pr15068-fix.patch new file mode 100644 index 00000000..2977765c --- /dev/null +++ b/patches/gcc/3.4.1/pr15068-fix.patch @@ -0,0 +1,44 @@ +See http://gcc.gnu.org/PR15068 + +Fixes error + +../sysdeps/generic/s_fmax.c: In function `__fmax': +../sysdeps/generic/s_fmax.c:28: internal compiler error: in elim_reg_cond, at flow.c:3257 +Please submit a full bug report, +with preprocessed source if appropriate. +See <URL:http://gcc.gnu.org/bugs.html> for instructions. +make[2]: *** [/home/dank/wk/crosstool-0.28-rc35/build/arm-unknown-linux-gnu/gcc-3.4.1-glibc-20040822/build-glibc/math/s_fmax.o] Error 1 +make[2]: Leaving directory `/home/dank/wk/crosstool-0.28-rc35/build/arm-unknown-linux-gnu/gcc-3.4.1-glibc-20040822/glibc-20040822/math' +make[1]: *** [math/others] Error 2 +make[1]: Leaving directory `/home/dank/wk/crosstool-0.28-rc35/build/arm-unknown-linux-gnu/gcc-3.4.1-glibc-20040822/glibc-20040822' +make: *** [all] Error 2 + +[ rediffed against gcc-3.4.1, with elbow grease, ending up with same thing as +http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/flow.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.563.4.2&r2=1.563.4.3 ] + +--- gcc-3.4.1/gcc/flow.c.old 2004-02-27 19:39:19.000000000 -0800 ++++ gcc-3.4.1/gcc/flow.c 2004-08-26 07:29:46.000000000 -0700 +@@ -1878,6 +1878,7 @@ + rtx set_src = SET_SRC (pc_set (BB_END (bb))); + rtx cond_true = XEXP (set_src, 0); + rtx reg = XEXP (cond_true, 0); ++ enum rtx_code inv_cond; + + if (GET_CODE (reg) == SUBREG) + reg = SUBREG_REG (reg); +@@ -1886,11 +1887,13 @@ + in the form of a comparison of a register against zero. + If the condition is more complex than that, then it is safe + not to record any information. */ +- if (GET_CODE (reg) == REG ++ inv_cond = reversed_comparison_code (cond_true, BB_END (bb)); ++ if (inv_cond != UNKNOWN ++ && GET_CODE (reg) == REG + && XEXP (cond_true, 1) == const0_rtx) + { + rtx cond_false +- = gen_rtx_fmt_ee (reverse_condition (GET_CODE (cond_true)), ++ = gen_rtx_fmt_ee (inv_cond, + GET_MODE (cond_true), XEXP (cond_true, 0), + XEXP (cond_true, 1)); + if (GET_CODE (XEXP (set_src, 1)) == PC) diff --git a/patches/gcc/3.4.2/gcc-3.4.0-arm-bigendian.patch b/patches/gcc/3.4.2/gcc-3.4.0-arm-bigendian.patch new file mode 100644 index 00000000..f7178c19 --- /dev/null +++ b/patches/gcc/3.4.2/gcc-3.4.0-arm-bigendian.patch @@ -0,0 +1,82 @@ +By Lennert Buytenhek <buytenh@wantstofly.org> +Adds support for arm*b-linux* big-endian ARM targets + +Fixes build error + +/opt/crosstool/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/armeb-unknown-linux-gnu/bin/ld: unrecognised emulation mode: armelf_linux +Supported emulations: armelfb_linux armelfb +collect2: ld returned 1 exit status +make[2]: *** [/home/dank/wk/crosstool-0.28-rc36/build/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/build-glibc/csu/crt1.o] Error 1 +make[2]: Leaving directory `/home/dank/wk/crosstool-0.28-rc36/build/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/glibc-2.3.3/csu' +make[1]: *** [csu/subdir_lib] Error 2 +make[1]: Leaving directory `/home/dank/wk/crosstool-0.28-rc36/build/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/glibc-2.3.3' +make: *** [all] Error 2 + + +See http://gcc.gnu.org/PR16350 + +diff -urN gcc-3.4.0.orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h +--- gcc-3.4.0.orig/gcc/config/arm/linux-elf.h 2004-01-31 07:18:11.000000000 +0100 ++++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-07-02 14:46:29.225443757 +0200 +@@ -30,17 +30,34 @@ + /* Do not assume anything about header files. */ + #define NO_IMPLICIT_EXTERN_C + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END ++#define TARGET_ENDIAN_OPTION "mbig-endian" ++#define TARGET_LINKER_EMULATION "armelfb_linux" ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#define TARGET_ENDIAN_OPTION "mlittle-endian" ++#define TARGET_LINKER_EMULATION "armelf_linux" ++#endif ++ + /* Default is to use APCS-32 mode. */ + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS) ++#define TARGET_DEFAULT \ ++ ( ARM_FLAG_APCS_32 | \ ++ ARM_FLAG_MMU_TRAPS | \ ++ TARGET_ENDIAN_DEFAULT ) + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" } + + #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" + +@@ -89,7 +106,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS() +diff -urN gcc-3.4.0.orig/gcc/config.gcc gcc-3.4.0/gcc/config.gcc +--- gcc-3.4.0.orig/gcc/config.gcc 2004-04-17 04:28:24.000000000 +0200 ++++ gcc-3.4.0/gcc/config.gcc 2004-07-02 14:44:40.045822542 +0200 +@@ -666,6 +666,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + 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" ++ case $target in ++ arm*b-*) ++ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" ++ ;; ++ esac + tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes diff --git a/patches/gcc/3.4.2/gcc-3.4.0-arm-lib1asm.patch b/patches/gcc/3.4.2/gcc-3.4.0-arm-lib1asm.patch new file mode 100644 index 00000000..69a79d5d --- /dev/null +++ b/patches/gcc/3.4.2/gcc-3.4.0-arm-lib1asm.patch @@ -0,0 +1,27 @@ +# Origin: from a patch by Dimitry Andric <dimitry@andric.com>, 2004-05-01 +# See http://gcc.gnu.org/PR14352 and http://gcc.gnu.org/PR16314 +# See also http://gcc.gnu.org/ml/gcc-patches/2004-08/msg02568.html et seq for why this isn't in mainline +# Fixes errors like the following when building glibc (or any other executable +# or shared library) when using gcc 3.4.0 for ARM with softfloat: +# +# .../libc_pic.os(.text+0x15834): In function `__modf': undefined reference to `__subdf3' +# .../libc_pic.os(.text+0x158b8): In function `__modf': undefined reference to `__subdf3' +# .../libc_pic.os(.text+0x1590c): In function `scalbn': undefined reference to `__muldf3' +# .../libc_pic.os(.text+0x15e94): In function `__ldexpf': undefined reference to `__eqsf2' +# .../libc_pic.os(.text+0xcee4c): In function `monstartup': undefined reference to `__fixsfsi' + +diff -urNd gcc-3.4.0-orig/gcc/config/arm/t-linux gcc-3.4.0/gcc/config/arm/t-linux +--- gcc-3.4.0-orig/gcc/config/arm/t-linux 2003-09-20 23:09:07.000000000 +0200 ++++ gcc-3.4.0/gcc/config/arm/t-linux 2004-05-01 20:31:59.102846400 +0200 +@@ -4,7 +4,10 @@ + LIBGCC2_DEBUG_CFLAGS = -g0 + + LIB1ASMSRC = arm/lib1funcs.asm +-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx ++LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \ ++ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ ++ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ ++ _fixsfsi _fixunssfsi + + # MULTILIB_OPTIONS = mhard-float/msoft-float + # MULTILIB_DIRNAMES = hard-float soft-float diff --git a/patches/gcc/3.4.2/gcc-3.4.0-arm-nolibfloat.patch b/patches/gcc/3.4.2/gcc-3.4.0-arm-nolibfloat.patch new file mode 100644 index 00000000..43eed3ef --- /dev/null +++ b/patches/gcc/3.4.2/gcc-3.4.0-arm-nolibfloat.patch @@ -0,0 +1,24 @@ +# Dimitry Andric <dimitry@andric.com>, 2004-05-01 +# +# * Removed the extra -lfloat option from LIBGCC_SPEC, since it isn't needed +# anymore. (The required functions are now in libgcc.) +# +# Fixes errors like +# arm-softfloat-linux-gnu/3.4.0/../../../../arm-softfloat-linux-gnu/bin/ld: cannot find -lfloat +# collect2: ld returned 1 exit status +# make[2]: *** [arm-softfloat-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/iconvdata/ISO8859-1.so] Error 1 +# when building glibc-2.3.3 with gcc-3.4.0 for arm-softfloat + +diff -urNd gcc-3.4.0-orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h +--- gcc-3.4.0-orig/gcc/config/arm/linux-elf.h 2004-01-31 07:18:11.000000000 +0100 ++++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-05-01 19:19:06.935979200 +0200 +@@ -55,7 +73,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add + the GNU/Linux magical crtbegin.o file (see crtstuff.c) which + diff --git a/patches/gcc/3.4.3/fix-fixincl.patch b/patches/gcc/3.4.3/fix-fixincl.patch new file mode 100644 index 00000000..7936b19b --- /dev/null +++ b/patches/gcc/3.4.3/fix-fixincl.patch @@ -0,0 +1,70 @@ +See http://gcc.gnu.org/PR22541 + +From: Dan Kegel + +When building gcc-3.4.3 or gcc-4.0.0 as a cross into a clean $PREFIX +(the only two I've tried like this), the configure script happily copies +the glibc include files from include to sys-include; here's the line +from the log file (with $PREFIX instead of the real prefix): + +Copying $PREFIX/i686-unknown-linux-gnu/include to $PREFIX/i686-unknown-linux-gnu/sys-include + +But later, when running fixincludes, it gives the error message + The directory that should contain system headers does not exist: + $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/../../../../i686-unknown-linux-gnu/sys-include + +Nevertheless, it continues building; the header files it installs in + $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/include +do not include the boilerplate that would cause it to #include_next the +glibc headers in the system header directory. +Thus the resulting toolchain can't compile the following program: +#include <limits.h> +int x = PATH_MAX; +because its limits.h doesn't include the glibc header. + +That's not nice. I suspect the problem is that gcc/Makefile.in assumes that +it can refer to $PREFIX/i686-unknown-linux-gnu with the path + $PREFIX/lib/../i686-unknown-linux-gnu, but +that fails because the directory $PREFIX/lib doesn't exist during 'make all'; +it is only created later, during 'make install'. (Which makes this problem +confusing, since one only notices the breakage well after 'make install', +at which point the path configure complained about does exist, and has the +right stuff in it.) + +A possible fix is to replace the line in gcc/Makefile.in that says + SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@ +with a version that gets rid of extra ..'s, e.g. + SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,,;ta"` +(hey, that's the first time I've ever used a label in a sed script; thanks to the sed faq +for explaining the :a ... ta method of looping to repeat a search-and-replace until it doesn't match.) + + +--- gcc-3.4.3/gcc/Makefile.in.foo 2005-05-20 11:41:39.000000000 -0700 ++++ gcc-3.4.3/gcc/Makefile.in 2005-05-20 12:08:46.000000000 -0700 +@@ -350,7 +350,10 @@ + CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ + + # autoconf sets SYSTEM_HEADER_DIR to one of the above. +-SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@ ++# Purge it of unneccessary internal relative paths ++# to directories that might not exist yet. ++# The sed idiom for this is to repeat the search-and-replace until it doesn't match, using :a ... ta. ++SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta` + + # Control whether to run fixproto and fixincludes. + STMP_FIXPROTO = @STMP_FIXPROTO@ +@@ -2532,11 +2535,13 @@ + $(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(gcc_tooldir) + + # Build fixed copies of system files. ++# Abort if no system headers available, unless building a crosscompiler. ++# FIXME: abort unless building --without-headers would be more accurate and less ugly + stmp-fixinc: fixinc.sh gsyslimits.h + @if test ! -d ${SYSTEM_HEADER_DIR}; then \ + echo The directory that should contain system headers does not exist: >&2 ; \ + echo " ${SYSTEM_HEADER_DIR}" >&2 ; \ +- if test "x${SYSTEM_HEADER_DIR}" = "x${gcc_tooldir}/sys-include"; \ ++ if test "x${SYSTEM_HEADER_DIR}" = "x`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`"; \ + then sleep 1; else exit 1; fi; \ + fi + rm -rf include; mkdir include diff --git a/patches/gcc/3.4.3/gcc-3.4.0-arm-bigendian.patch b/patches/gcc/3.4.3/gcc-3.4.0-arm-bigendian.patch new file mode 100644 index 00000000..f7178c19 --- /dev/null +++ b/patches/gcc/3.4.3/gcc-3.4.0-arm-bigendian.patch @@ -0,0 +1,82 @@ +By Lennert Buytenhek <buytenh@wantstofly.org> +Adds support for arm*b-linux* big-endian ARM targets + +Fixes build error + +/opt/crosstool/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/armeb-unknown-linux-gnu/bin/ld: unrecognised emulation mode: armelf_linux +Supported emulations: armelfb_linux armelfb +collect2: ld returned 1 exit status +make[2]: *** [/home/dank/wk/crosstool-0.28-rc36/build/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/build-glibc/csu/crt1.o] Error 1 +make[2]: Leaving directory `/home/dank/wk/crosstool-0.28-rc36/build/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/glibc-2.3.3/csu' +make[1]: *** [csu/subdir_lib] Error 2 +make[1]: Leaving directory `/home/dank/wk/crosstool-0.28-rc36/build/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/glibc-2.3.3' +make: *** [all] Error 2 + + +See http://gcc.gnu.org/PR16350 + +diff -urN gcc-3.4.0.orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h +--- gcc-3.4.0.orig/gcc/config/arm/linux-elf.h 2004-01-31 07:18:11.000000000 +0100 ++++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-07-02 14:46:29.225443757 +0200 +@@ -30,17 +30,34 @@ + /* Do not assume anything about header files. */ + #define NO_IMPLICIT_EXTERN_C + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END ++#define TARGET_ENDIAN_OPTION "mbig-endian" ++#define TARGET_LINKER_EMULATION "armelfb_linux" ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#define TARGET_ENDIAN_OPTION "mlittle-endian" ++#define TARGET_LINKER_EMULATION "armelf_linux" ++#endif ++ + /* Default is to use APCS-32 mode. */ + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS) ++#define TARGET_DEFAULT \ ++ ( ARM_FLAG_APCS_32 | \ ++ ARM_FLAG_MMU_TRAPS | \ ++ TARGET_ENDIAN_DEFAULT ) + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" } + + #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" + +@@ -89,7 +106,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS() +diff -urN gcc-3.4.0.orig/gcc/config.gcc gcc-3.4.0/gcc/config.gcc +--- gcc-3.4.0.orig/gcc/config.gcc 2004-04-17 04:28:24.000000000 +0200 ++++ gcc-3.4.0/gcc/config.gcc 2004-07-02 14:44:40.045822542 +0200 +@@ -666,6 +666,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + 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" ++ case $target in ++ arm*b-*) ++ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" ++ ;; ++ esac + tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes diff --git a/patches/gcc/3.4.3/gcc-3.4.0-arm-lib1asm.patch b/patches/gcc/3.4.3/gcc-3.4.0-arm-lib1asm.patch new file mode 100644 index 00000000..69a79d5d --- /dev/null +++ b/patches/gcc/3.4.3/gcc-3.4.0-arm-lib1asm.patch @@ -0,0 +1,27 @@ +# Origin: from a patch by Dimitry Andric <dimitry@andric.com>, 2004-05-01 +# See http://gcc.gnu.org/PR14352 and http://gcc.gnu.org/PR16314 +# See also http://gcc.gnu.org/ml/gcc-patches/2004-08/msg02568.html et seq for why this isn't in mainline +# Fixes errors like the following when building glibc (or any other executable +# or shared library) when using gcc 3.4.0 for ARM with softfloat: +# +# .../libc_pic.os(.text+0x15834): In function `__modf': undefined reference to `__subdf3' +# .../libc_pic.os(.text+0x158b8): In function `__modf': undefined reference to `__subdf3' +# .../libc_pic.os(.text+0x1590c): In function `scalbn': undefined reference to `__muldf3' +# .../libc_pic.os(.text+0x15e94): In function `__ldexpf': undefined reference to `__eqsf2' +# .../libc_pic.os(.text+0xcee4c): In function `monstartup': undefined reference to `__fixsfsi' + +diff -urNd gcc-3.4.0-orig/gcc/config/arm/t-linux gcc-3.4.0/gcc/config/arm/t-linux +--- gcc-3.4.0-orig/gcc/config/arm/t-linux 2003-09-20 23:09:07.000000000 +0200 ++++ gcc-3.4.0/gcc/config/arm/t-linux 2004-05-01 20:31:59.102846400 +0200 +@@ -4,7 +4,10 @@ + LIBGCC2_DEBUG_CFLAGS = -g0 + + LIB1ASMSRC = arm/lib1funcs.asm +-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx ++LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \ ++ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ ++ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ ++ _fixsfsi _fixunssfsi + + # MULTILIB_OPTIONS = mhard-float/msoft-float + # MULTILIB_DIRNAMES = hard-float soft-float diff --git a/patches/gcc/3.4.3/gcc-3.4.0-arm-nolibfloat.patch b/patches/gcc/3.4.3/gcc-3.4.0-arm-nolibfloat.patch new file mode 100644 index 00000000..43eed3ef --- /dev/null +++ b/patches/gcc/3.4.3/gcc-3.4.0-arm-nolibfloat.patch @@ -0,0 +1,24 @@ +# Dimitry Andric <dimitry@andric.com>, 2004-05-01 +# +# * Removed the extra -lfloat option from LIBGCC_SPEC, since it isn't needed +# anymore. (The required functions are now in libgcc.) +# +# Fixes errors like +# arm-softfloat-linux-gnu/3.4.0/../../../../arm-softfloat-linux-gnu/bin/ld: cannot find -lfloat +# collect2: ld returned 1 exit status +# make[2]: *** [arm-softfloat-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/iconvdata/ISO8859-1.so] Error 1 +# when building glibc-2.3.3 with gcc-3.4.0 for arm-softfloat + +diff -urNd gcc-3.4.0-orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h +--- gcc-3.4.0-orig/gcc/config/arm/linux-elf.h 2004-01-31 07:18:11.000000000 +0100 ++++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-05-01 19:19:06.935979200 +0200 +@@ -55,7 +73,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add + the GNU/Linux magical crtbegin.o file (see crtstuff.c) which + diff --git a/patches/gcc/3.4.3/pr15068-fix.patch b/patches/gcc/3.4.3/pr15068-fix.patch new file mode 100644 index 00000000..2977765c --- /dev/null +++ b/patches/gcc/3.4.3/pr15068-fix.patch @@ -0,0 +1,44 @@ +See http://gcc.gnu.org/PR15068 + +Fixes error + +../sysdeps/generic/s_fmax.c: In function `__fmax': +../sysdeps/generic/s_fmax.c:28: internal compiler error: in elim_reg_cond, at flow.c:3257 +Please submit a full bug report, +with preprocessed source if appropriate. +See <URL:http://gcc.gnu.org/bugs.html> for instructions. +make[2]: *** [/home/dank/wk/crosstool-0.28-rc35/build/arm-unknown-linux-gnu/gcc-3.4.1-glibc-20040822/build-glibc/math/s_fmax.o] Error 1 +make[2]: Leaving directory `/home/dank/wk/crosstool-0.28-rc35/build/arm-unknown-linux-gnu/gcc-3.4.1-glibc-20040822/glibc-20040822/math' +make[1]: *** [math/others] Error 2 +make[1]: Leaving directory `/home/dank/wk/crosstool-0.28-rc35/build/arm-unknown-linux-gnu/gcc-3.4.1-glibc-20040822/glibc-20040822' +make: *** [all] Error 2 + +[ rediffed against gcc-3.4.1, with elbow grease, ending up with same thing as +http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/flow.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.563.4.2&r2=1.563.4.3 ] + +--- gcc-3.4.1/gcc/flow.c.old 2004-02-27 19:39:19.000000000 -0800 ++++ gcc-3.4.1/gcc/flow.c 2004-08-26 07:29:46.000000000 -0700 +@@ -1878,6 +1878,7 @@ + rtx set_src = SET_SRC (pc_set (BB_END (bb))); + rtx cond_true = XEXP (set_src, 0); + rtx reg = XEXP (cond_true, 0); ++ enum rtx_code inv_cond; + + if (GET_CODE (reg) == SUBREG) + reg = SUBREG_REG (reg); +@@ -1886,11 +1887,13 @@ + in the form of a comparison of a register against zero. + If the condition is more complex than that, then it is safe + not to record any information. */ +- if (GET_CODE (reg) == REG ++ inv_cond = reversed_comparison_code (cond_true, BB_END (bb)); ++ if (inv_cond != UNKNOWN ++ && GET_CODE (reg) == REG + && XEXP (cond_true, 1) == const0_rtx) + { + rtx cond_false +- = gen_rtx_fmt_ee (reverse_condition (GET_CODE (cond_true)), ++ = gen_rtx_fmt_ee (inv_cond, + GET_MODE (cond_true), XEXP (cond_true, 0), + XEXP (cond_true, 1)); + if (GET_CODE (XEXP (set_src, 1)) == PC) diff --git a/patches/gcc/3.4.3/pr16201-fix.patch b/patches/gcc/3.4.3/pr16201-fix.patch new file mode 100644 index 00000000..be3fec97 --- /dev/null +++ b/patches/gcc/3.4.3/pr16201-fix.patch @@ -0,0 +1,149 @@ +See http://gcc.gnu.org/PR16201 + +Should fix "bad immediate value for offset" errors for several flavors of arm, e.g. + +/tmp/ccmdoQyg.s: Assembler messages: +/tmp/ccmdoQyg.s:6235: Error: bad immediate value for offset (4096) +make[2]: *** [crosstool-0.32/build/arm-xscale-linux-gnu/gcc-3.4.3-glibc-2.3.3/build-glibc/locale/ld-collate.o] Error 1 + +/tmp/cc0c7qop.s: Assembler messages: +/tmp/cc0c7qop.s:6234: Error: bad immediate value for offset (4104) +make[2]: *** [crosstool-0.32/build/armv5b-softfloat-linux/gcc-3.4.3-glibc-2.3.3/build-glibc/locale/ld-collate.o] Error 1 + + +CVSROOT: /cvs/gcc +Module name: gcc +Branch: gcc-3_4-branch +Changes by: rearnsha@gcc.gnu.org 2005-02-01 15:07:05 + +Modified files: + gcc : ChangeLog + gcc/config/arm : arm-protos.h arm.c + +Log message: + PR target/16201 + * arm.c (arm_eliminable_register): New function. + (adjacent_mem_locations): Don't allow eliminable registers. Use + HOST_WIDE_INT for address offsets. + * arm-protos.h (arm_eliminable_register): Add prototype. + +Patches: +http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.790&r2=2.2326.2.791 +http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/arm/arm-protos.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.61&r2=1.61.4.1 +http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/arm/arm.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.317.4.8&r2=1.317.4.9 + +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/config/arm/arm-protos.h,v +retrieving revision 1.61 +retrieving revision 1.61.4.1 +diff -u -r1.61 -r1.61.4.1 +--- gcc/gcc/config/arm/arm-protos.h 2003/11/20 11:44:18 1.61 ++++ gcc/gcc/config/arm/arm-protos.h 2005/02/01 15:07:02 1.61.4.1 +@@ -1,5 +1,6 @@ + /* Prototypes for exported functions defined in arm.c and pe.c +- Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. ++ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005 ++ Free Software Foundation, Inc. + Contributed by Richard Earnshaw (rearnsha@arm.com) + Minor hacks by Nick Clifton (nickc@cygnus.com) + +@@ -138,6 +139,7 @@ + extern int arm_is_longcall_p (rtx, int, int); + extern int arm_emit_vector_const (FILE *, rtx); + extern const char * arm_output_load_gr (rtx *); ++extern int arm_eliminable_register (rtx); + + #if defined TREE_CODE + extern rtx arm_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int); +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.c,v +retrieving revision 1.317.4.8 +retrieving revision 1.317.4.9 +diff -u -r1.317.4.8 -r1.317.4.9 +--- gcc/gcc/config/arm/arm.c 2004/04/29 19:52:41 1.317.4.8 ++++ gcc/gcc/config/arm/arm.c 2005/02/01 15:07:02 1.317.4.9 +@@ -1,6 +1,6 @@ + /* Output routines for GCC for ARM. + Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +- 2002, 2003, 2004 Free Software Foundation, Inc. ++ 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Contributed by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl) + and Martin Simmons (@harleqn.co.uk). + More major hacks by Richard Earnshaw (rearnsha@arm.com). +@@ -4056,6 +4056,16 @@ + && INTVAL (op) < 64); + } + ++/* Return true if X is a register that will be eliminated later on. */ ++int ++arm_eliminable_register (rtx x) ++{ ++ return REG_P (x) && (REGNO (x) == FRAME_POINTER_REGNUM ++ || REGNO (x) == ARG_POINTER_REGNUM ++ || (REGNO (x) >= FIRST_VIRTUAL_REGISTER ++ && REGNO (x) <= LAST_VIRTUAL_REGISTER)); ++} ++ + /* Returns TRUE if INSN is an "LDR REG, ADDR" instruction. + Use by the Cirrus Maverick code which has to workaround + a hardware bug triggered by such instructions. */ +@@ -4569,33 +4579,42 @@ + || (GET_CODE (XEXP (b, 0)) == PLUS + && GET_CODE (XEXP (XEXP (b, 0), 1)) == CONST_INT))) + { +- int val0 = 0, val1 = 0; +- int reg0, reg1; +- ++ HOST_WIDE_INT val0 = 0, val1 = 0; ++ rtx reg0, reg1; ++ int val_diff; ++ + if (GET_CODE (XEXP (a, 0)) == PLUS) + { +- reg0 = REGNO (XEXP (XEXP (a, 0), 0)); ++ reg0 = XEXP (XEXP (a, 0), 0); + val0 = INTVAL (XEXP (XEXP (a, 0), 1)); + } + else +- reg0 = REGNO (XEXP (a, 0)); ++ reg0 = XEXP (a, 0); + + if (GET_CODE (XEXP (b, 0)) == PLUS) + { +- reg1 = REGNO (XEXP (XEXP (b, 0), 0)); ++ reg1 = XEXP (XEXP (b, 0), 0); + val1 = INTVAL (XEXP (XEXP (b, 0), 1)); + } + else +- reg1 = REGNO (XEXP (b, 0)); ++ reg1 = XEXP (b, 0); + + /* Don't accept any offset that will require multiple + instructions to handle, since this would cause the + arith_adjacentmem pattern to output an overlong sequence. */ + if (!const_ok_for_op (PLUS, val0) || !const_ok_for_op (PLUS, val1)) + return 0; +- +- return (reg0 == reg1) && ((val1 - val0) == 4 || (val0 - val1) == 4); ++ ++ /* Don't allow an eliminable register: register elimination can make ++ the offset too large. */ ++ if (arm_eliminable_register (reg0)) ++ return 0; ++ ++ val_diff = val1 - val0; ++ return ((REGNO (reg0) == REGNO (reg1)) ++ && (val_diff == 4 || val_diff == -4)); + } ++ + return 0; + } + +@@ -7301,7 +7320,6 @@ + return ""; + } + +- + /* Output a move from arm registers to an fpa registers. + OPERANDS[0] is an fpa register. + OPERANDS[1] is the first registers of an arm register pair. */ diff --git a/patches/gcc/3.4.3/pr18508-fix.patch b/patches/gcc/3.4.3/pr18508-fix.patch new file mode 100644 index 00000000..a438fee8 --- /dev/null +++ b/patches/gcc/3.4.3/pr18508-fix.patch @@ -0,0 +1,143 @@ +See http://gcc.gnu.org/PR18508 + +This should fix cygwin errors like: + +basename: missing operand +Try `basename --help' for more information. +mv: `libgcc_s_nof.so.1' and `libgcc_s_nof.so.1.' are the same file +make[2]: *** [nof/libgcc_s_nof.so] Error 1 +make[2]: Leaving directory `/home/cvachoucek/crosstool-0.32/build/powerpc-750-linux-gnu/gcc-3.4.3-glibc-2.3.5/build-gcc/gcc' +make[1]: *** [stmp-multilib] Error 2 +make[1]: Leaving directory `/home/cvachoucek/crosstool-0.32/build/powerpc-750-linux-gnu/gcc-3.4.3-glibc-2.3.5/build-gcc/gcc' +make: *** [install-gcc] Error 2 + +From gcc-patches-return-133821-listarch-gcc-patches=gcc dot gnu dot org at gcc dot gnu dot org Wed Nov 17 00:15:28 2004 +Return-Path: <gcc-patches-return-133821-listarch-gcc-patches=gcc dot gnu dot org at gcc dot gnu dot org> +Delivered-To: listarch-gcc-patches at gcc dot gnu dot org +Received: (qmail 12823 invoked by alias); 17 Nov 2004 00:15:19 -0000 +Mailing-List: contact gcc-patches-help at gcc dot gnu dot org; run by ezmlm +List-Archive: <http://gcc.gnu.org/ml/gcc-patches/> +List-Post: <mailto:gcc-patches at gcc dot gnu dot org> +List-Help: <mailto:gcc-patches-help at gcc dot gnu dot org> +Sender: gcc-patches-owner at gcc dot gnu dot org +Date: Tue, 16 Nov 2004 16:14:57 -0800 +From: "H dot J dot Lu" <hjl at lucon dot org> +To: gcc-patches at gcc dot gnu dot org +Subject: PATCH: PR other/18508: "basename: too few arguments" when building without bootstrap +Message-ID: <20041117001457.GA13610@lucon.org> + +I think it is safe to use `.backup' to backup the existing shared +library. No processes should be using the old shared library when +we get there. + + +H.J. +--- +2004-11-16 H.J. Lu <hongjiu.lu@intel.com> + + PR other/18508 + * config/alpha/t-osf4 (SHLIB_LINK): Use `.backup' as the suffix + to back up the existing shared library. + * config/arm/t-netbsd (SHLIB_LINK): Likewise. + * config/i386/t-nwld (SHLIB_LINK): Likewise. [deleted] + * config/mips/t-slibgcc-irix (SHLIB_LINK): Likewise. [deleted] + * config/pa/t-hpux-shlib (SHLIB_LINK): Likewise. + * config/sh/t-linux (SHLIB_LINK): Likewise. + * config/t-libunwind-elf (SHLIBUNWIND_LINK): Likewise. + * config/t-slibgcc-darwin (SHLIB_LINK): Likewise. + * config/t-slibgcc-elf-ver (SHLIB_LINK): Likewise. + * config/t-slibgcc-sld (SHLIB_LINK): Likewise. + +[ paths adjusted for patch -p1, rediffed agaainst gcc-3.4.3. + Looks like the t-iris5-6 hunk in cvs is missing here; this must + have been the mainline patch. ] + +--- gcc-3.4.3/gcc/config/alpha/t-osf4.stage 2004-10-18 09:14:39.000000000 -0700 ++++ gcc-3.4.3/gcc/config/alpha/t-osf4 2004-11-16 16:06:41.686905479 -0800 +@@ -19,7 +19,7 @@ SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2 + -o $(SHLIB_NAME).tmp @multilib_flags@ $(SHLIB_OBJS) -lc && \ + rm -f $(SHLIB_SONAME) && \ + if [ -f $(SHLIB_NAME) ]; then \ +- mv -f $(SHLIB_NAME) $(SHLIB_NAME).`basename $(STAGE_PREFIX)`; \ ++ mv -f $(SHLIB_NAME) $(SHLIB_NAME).backup; \ + else true; fi && \ + mv $(SHLIB_NAME).tmp $(SHLIB_NAME) && \ + $(LN_S) $(SHLIB_NAME) $(SHLIB_SONAME) +--- gcc-3.4.3/gcc/config/arm/t-netbsd.stage 2004-10-18 09:14:40.000000000 -0700 ++++ gcc-3.4.3/gcc/config/arm/t-netbsd 2004-11-16 16:06:46.016348194 -0800 +@@ -14,7 +14,7 @@ SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2 + -o $(SHLIB_NAME).tmp @multilib_flags@ $(SHLIB_OBJS) -lc && \ + rm -f $(SHLIB_SONAME) && \ + if [ -f $(SHLIB_NAME) ]; then \ +- mv -f $(SHLIB_NAME) $(SHLIB_NAME).`basename $(STAGE_PREFIX)`; \ ++ mv -f $(SHLIB_NAME) $(SHLIB_NAME).backup; \ + else true; fi && \ + mv $(SHLIB_NAME).tmp $(SHLIB_NAME) && \ + $(LN_S) $(SHLIB_NAME) $(SHLIB_SONAME) +--- gcc-3.4.3/gcc/config/pa/t-hpux-shlib.stage 2004-10-18 09:14:46.000000000 -0700 ++++ gcc-3.4.3/gcc/config/pa/t-hpux-shlib 2004-11-16 16:06:57.982807875 -0800 +@@ -8,7 +8,7 @@ SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2 + -o $(SHLIB_NAME).tmp @multilib_flags@ $(SHLIB_OBJS) -lc && \ + rm -f $(SHLIB_SONAME) && \ + if [ -f $(SHLIB_NAME) ]; then \ +- mv -f $(SHLIB_NAME) $(SHLIB_NAME).`basename $(STAGE_PREFIX)`; \ ++ mv -f $(SHLIB_NAME) $(SHLIB_NAME).backup; \ + else true; fi && \ + mv $(SHLIB_NAME).tmp $(SHLIB_NAME) && \ + $(LN_S) $(SHLIB_NAME) $(SHLIB_SONAME) +--- gcc-3.4.3/gcc/config/sh/t-linux.stage 2004-10-18 09:14:48.000000000 -0700 ++++ gcc-3.4.3/gcc/config/sh/t-linux 2004-11-16 16:07:00.787446863 -0800 +@@ -24,7 +24,7 @@ SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2 + -o $(SHLIB_NAME).tmp @multilib_flags@ $(SHLIB_OBJS) $(SHLIB_LC) && \ + rm -f $(SHLIB_SOLINK) && \ + if [ -f $(SHLIB_NAME) ]; then \ +- mv -f $(SHLIB_NAME) $(SHLIB_NAME).`basename $(STAGE_PREFIX)`; \ ++ mv -f $(SHLIB_NAME) $(SHLIB_NAME).backup; \ + else true; fi && \ + mv $(SHLIB_NAME).tmp $(SHLIB_NAME) && \ + (echo "/* GNU ld script"; \ +--- gcc-3.4.3/gcc/config/t-libunwind-elf.stage 2004-10-18 09:14:39.000000000 -0700 ++++ gcc-3.4.3/gcc/config/t-libunwind-elf 2004-11-16 16:07:08.133501281 -0800 +@@ -14,8 +14,7 @@ SHLIBUNWIND_LINK = $(GCC_FOR_TARGET) $(L + @multilib_flags@ $(SHLIB_OBJS) -lc && \ + rm -f $(SHLIB_SOLINK) && \ + if [ -f $(SHLIBUNWIND_NAME) ]; then \ +- mv -f $(SHLIBUNWIND_NAME) \ +- $(SHLIBUNWIND_NAME).`basename $(STAGE_PREFIX)`; \ ++ mv -f $(SHLIBUNWIND_NAME) $(SHLIBUNWIND_NAME).backup; \ + else true; fi && \ + mv $(SHLIBUNWIND_NAME).tmp $(SHLIBUNWIND_NAME) && \ + $(LN_S) $(SHLIBUNWIND_NAME) $(SHLIB_SOLINK) +--- gcc-3.4.3/gcc/config/t-slibgcc-darwin.stage 2004-10-18 09:14:39.000000000 -0700 ++++ gcc-3.4.3/gcc/config/t-slibgcc-darwin 2004-11-16 16:07:13.777774752 -0800 +@@ -17,7 +17,7 @@ SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2 + @multilib_flags@ $(SHLIB_OBJS) -lc && \ + rm -f $(SHLIB_SOLINK) && \ + if [ -f $(SHLIB_NAME) ]; then \ +- mv -f $(SHLIB_NAME) $(SHLIB_NAME).`basename $(STAGE_PREFIX)`; \ ++ mv -f $(SHLIB_NAME) $(SHLIB_NAME).backup; \ + else true; fi && \ + mv $(SHLIB_NAME).tmp $(SHLIB_NAME) && \ + $(LN_S) $(SHLIB_NAME) $(SHLIB_SOLINK) +--- gcc-3.4.3/gcc/config/t-slibgcc-elf-ver.stage 2004-10-18 09:14:39.000000000 -0700 ++++ gcc-3.4.3/gcc/config/t-slibgcc-elf-ver 2004-11-16 16:04:40.961445223 -0800 +@@ -17,7 +17,7 @@ SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2 + -o $(SHLIB_NAME).tmp @multilib_flags@ $(SHLIB_OBJS) $(SHLIB_LC) && \ + rm -f $(SHLIB_SOLINK) && \ + if [ -f $(SHLIB_NAME) ]; then \ +- mv -f $(SHLIB_NAME) $(SHLIB_NAME).`basename $(STAGE_PREFIX)`; \ ++ mv -f $(SHLIB_NAME) $(SHLIB_NAME).backup; \ + else true; fi && \ + mv $(SHLIB_NAME).tmp $(SHLIB_NAME) && \ + $(LN_S) $(SHLIB_NAME) $(SHLIB_SOLINK) +--- gcc-3.4.3/gcc/config/t-slibgcc-sld.old 2004-10-18 09:00:47.000000000 -0700 ++++ gcc-3.4.3/gcc/config/t-slibgcc-sld 2005-05-14 13:44:48.000000000 -0700 +@@ -14,7 +14,7 @@ + @multilib_flags@ $(SHLIB_OBJS) -lc && \ + rm -f $(SHLIB_SOLINK) && \ + if [ -f $(SHLIB_NAME) ]; then \ +- mv -f $(SHLIB_NAME) $(SHLIB_NAME).`basename $(STAGE_PREFIX)`; \ ++ mv -f $(SHLIB_NAME) $(SHLIB_NAME).backup; \ + else true; fi && \ + mv $(SHLIB_NAME).tmp $(SHLIB_NAME) && \ + $(LN_S) $(SHLIB_NAME) $(SHLIB_SOLINK) diff --git a/patches/gcc/3.4.4/100-uclibc-conf.patch b/patches/gcc/3.4.4/100-uclibc-conf.patch new file mode 100644 index 00000000..00ea4eeb --- /dev/null +++ b/patches/gcc/3.4.4/100-uclibc-conf.patch @@ -0,0 +1,470 @@ +--- gcc-3.4.1/gcc/config/t-linux-uclibc ++++ gcc-3.4.1/gcc/config/t-linux-uclibc +@@ -0,0 +1,5 @@ ++# Remove glibc specific files added in t-linux ++SHLIB_MAPFILES := $(filter-out $(srcdir)/config/libgcc-glibc.ver, $(SHLIB_MAPFILES)) ++ ++# Use unwind-dw2-fde instead of unwind-dw2-fde-glibc ++LIB2ADDEH := $(subst unwind-dw2-fde-glibc.c,unwind-dw2-fde.c,$(LIB2ADDEH)) +--- gcc-3.4.1/gcc/config.gcc ++++ gcc-3.4.1/gcc/config.gcc +@@ -2310,10 +2310,16 @@ + *) + echo "*** Configuration ${target} not supported" 1>&2 + exit 1 + ;; + esac ++ ++# Rather than hook into each target, just do it after all the linux ++# targets have been processed ++case ${target} in ++*-linux-uclibc*) tm_defines="${tm_defines} USE_UCLIBC" ; tmake_file="${tmake_file} t-linux-uclibc" ++esac + + # Support for --with-cpu and related options (and a few unrelated options, + # too). + case ${with_cpu} in + yes | no) +--- gcc-3.4.4/gcc/config/alpha/linux-elf.h ++++ gcc-3.4.4/gcc/config/alpha/linux-elf.h +@@ -27,7 +27,11 @@ + #define SUBTARGET_EXTRA_SPECS \ + { "elf_dynamic_linker", ELF_DYNAMIC_LINKER }, + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else + #define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + + #define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \ + %{O*:-O3} %{!O*:-O1} \ +--- gcc-3.4.1-dist/gcc/config/arm/linux-elf.h 2004-01-31 00:18:11.000000000 -0600 ++++ gcc-3.4.1/gcc/config/arm/linux-elf.h 2004-08-12 15:54:42.000000000 -0500 +@@ -80,14 +80,19 @@ + #define ENDFILE_SPEC \ + "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "%{h*} %{version:-v} \ + %{b} %{Wl,*:%*} \ + %{static:-Bstatic} \ + %{shared:-shared} \ + %{symbolic:-Bsymbolic} \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "} \ + -X \ + %{mbig-endian:-EB}" \ + SUBTARGET_EXTRA_LINK_SPEC +--- gcc-3.4.1-dist/gcc/config/cris/linux.h 2003-11-28 21:08:09.000000000 -0600 ++++ gcc-3.4.1/gcc/config/cris/linux.h 2004-08-12 15:54:43.000000000 -0500 +@@ -79,6 +79,25 @@ + #undef CRIS_DEFAULT_CPU_VERSION + #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG + ++#ifdef USE_UCLIBC ++ ++#undef CRIS_SUBTARGET_VERSION ++#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc" ++ ++#undef CRIS_LINK_SUBTARGET_SPEC ++#define CRIS_LINK_SUBTARGET_SPEC \ ++ "-mcrislinux\ ++ -rpath-link include/asm/../..%s\ ++ %{shared} %{static}\ ++ %{symbolic:-Bdynamic} %{shlib:-Bdynamic} %{static:-Bstatic}\ ++ %{!shared: \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} \ ++ %{!r:%{O2|O3: --gc-sections}}" ++ ++#else /* USE_UCLIBC */ ++ + #undef CRIS_SUBTARGET_VERSION + #define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu" + +@@ -93,6 +112,8 @@ + %{!shared:%{!static:%{rdynamic:-export-dynamic}}}\ + %{!r:%{O2|O3: --gc-sections}}" + ++#endif /* USE_UCLIBC */ ++ + + /* Node: Run-time Target */ + +--- gcc-3.4.1-dist/gcc/config/i386/linux.h 2003-11-28 21:08:10.000000000 -0600 ++++ gcc-3.4.1/gcc/config/i386/linux.h 2004-08-12 15:54:43.000000000 -0500 +@@ -110,22 +110,21 @@ + + #undef LINK_SPEC + #ifdef USE_GNULIBC_1 +-#define LINK_SPEC "-m elf_i386 %{shared:-shared} \ +- %{!shared: \ +- %{!ibcs: \ +- %{!static: \ +- %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \ +- %{static:-static}}}" ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.1" ++#else ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" + #else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif ++#endif + #define LINK_SPEC "-m elf_i386 %{shared:-shared} \ + %{!shared: \ + %{!ibcs: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}}" +-#endif + + /* A C statement (sans semicolon) to output to the stdio stream + FILE the assembler definition of uninitialized global DECL named +--- gcc-3.4.4/gcc/config/i386/linux64.h ++++ gcc-3.4.4/gcc/config/i386/linux64.h +@@ -54,14 +54,21 @@ + When the -shared link option is used a final link is not being + done. */ + ++#ifdef USE_UCLIBC ++#define ELF32_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0" ++#else ++#define ELF32_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#define ELF64_DYNAMIC_LINKER "/lib64/ld-linux-x86-64.so.2" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \ + %{shared:-shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ +- %{!m32:%{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}}} \ ++ %{m32:%{!dynamic-linker:-dynamic-linker " ELF32_DYNAMIC_LINKER "}} \ ++ %{!m32:%{!dynamic-linker:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}} \ + %{static:-static}}" + + #define MULTILIB_DEFAULTS { "m64" } +--- gcc-3.4.4/gcc/config/ia64/linux.h ++++ gcc-3.4.4/gcc/config/ia64/linux.h +@@ -37,13 +37,18 @@ + /* Define this for shared library support because it isn't in the main + linux.h file. */ + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "\ + %{shared:-shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux-ia64.so.2}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}" + + +--- gcc-3.4.4/gcc/config/m68k/linux.h ++++ gcc-3.4.4/gcc/config/m68k/linux.h +@@ -131,12 +131,17 @@ + + /* If ELF is the default format, we should not use /lib/elf. */ + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld.so.1" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "-m m68kelf %{shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker*:-dynamic-linker /lib/ld.so.1}} \ ++ %{!dynamic-linker*:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static}}" + + /* For compatibility with linux/a.out */ +--- gcc-3.4.1-dist/gcc/config/mips/linux.h 2004-06-15 20:42:24.000000000 -0500 ++++ gcc-3.4.1/gcc/config/mips/linux.h 2004-08-12 15:54:43.000000000 -0500 +@@ -109,14 +109,19 @@ + + /* Borrowed from sparc/linux.h */ + #undef LINK_SPEC ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld.so.1" ++#endif + #define LINK_SPEC \ + "%(endian_spec) \ + %{shared:-shared} \ + %{!shared: \ + %{!ibcs: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}}" + + #undef SUBTARGET_ASM_SPEC +--- gcc-3.4.4/gcc/config/pa/pa-linux.h ++++ gcc-3.4.4/gcc/config/pa/pa-linux.h +@@ -77,13 +77,18 @@ + /* Define this for shared library support because it isn't in the main + linux.h file. */ + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld.so.1" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "\ + %{shared:-shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}" + + /* glibc's profiling functions don't need gcc to allocate counters. */ +--- gcc-3.4.1-dist/gcc/config/rs6000/linux.h 2004-02-25 09:11:19.000000000 -0600 ++++ gcc-3.4.1/gcc/config/rs6000/linux.h 2004-08-12 15:54:43.000000000 -0500 +@@ -69,7 +69,11 @@ + #define LINK_START_DEFAULT_SPEC "%(link_start_linux)" + + #undef LINK_OS_DEFAULT_SPEC ++#ifdef USE_UCLIBC ++#define LINK_OS_DEFAULT_SPEC "%(link_os_linux_uclibc)" ++#else + #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)" ++#endif + + #define LINK_GCC_C_SEQUENCE_SPEC \ + "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" +--- gcc-3.4.1-dist/gcc/config/rs6000/sysv4.h 2004-06-10 01:39:50.000000000 -0500 ++++ gcc-3.4.1/gcc/config/rs6000/sysv4.h 2004-08-12 15:54:43.000000000 -0500 +@@ -947,6 +947,7 @@ + mcall-linux : %(link_os_linux) ; \ + mcall-gnu : %(link_os_gnu) ; \ + mcall-netbsd : %(link_os_netbsd) ; \ ++ mcall-linux-uclibc : %(link_os_linux_uclibc); \ + mcall-openbsd: %(link_os_openbsd) ; \ + : %(link_os_default) }" + +@@ -1125,6 +1126,10 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}" + ++#define LINK_OS_LINUX_UCLIBC_SPEC "-m elf32ppclinux %{!shared: %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}}" ++ + #if defined(HAVE_LD_EH_FRAME_HDR) + # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " + #endif +@@ -1291,6 +1296,7 @@ + { "link_os_sim", LINK_OS_SIM_SPEC }, \ + { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \ + { "link_os_linux", LINK_OS_LINUX_SPEC }, \ ++ { "link_os_linux_uclibc", LINK_OS_LINUX_UCLIBC_SPEC }, \ + { "link_os_gnu", LINK_OS_GNU_SPEC }, \ + { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \ + { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \ +--- gcc-3.4.4/gcc/config/s390/linux.h ++++ gcc-3.4.4/gcc/config/s390/linux.h +@@ -77,6 +77,13 @@ + #define MULTILIB_DEFAULTS { "m31" } + #endif + ++#ifdef USE_UCLIBC ++#define ELF31_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0" ++#else ++#define ELF31_DYNAMIC_LINKER "/lib/ld.so.1" ++#define ELF64_DYNAMIC_LINKER "/lib/ld64.so.1" ++#endif + #undef LINK_SPEC + #define LINK_SPEC \ + "%{m31:-m elf_s390}%{m64:-m elf64_s390} \ +@@ -86,8 +93,8 @@ + %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker: \ +- %{m31:-dynamic-linker /lib/ld.so.1} \ +- %{m64:-dynamic-linker /lib/ld64.so.1}}}}" ++ %{m31:-dynamic-linker " ELF31_DYNAMIC_LINKER "} \ ++ %{m64:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}}}" + + + #define TARGET_ASM_FILE_END file_end_indicate_exec_stack +--- gcc-3.4.1-dist/gcc/config/sh/linux.h 2004-01-11 20:29:13.000000000 -0600 ++++ gcc-3.4.1/gcc/config/sh/linux.h 2004-08-12 15:54:43.000000000 -0500 +@@ -73,11 +73,16 @@ + #undef SUBTARGET_LINK_EMUL_SUFFIX + #define SUBTARGET_LINK_EMUL_SUFFIX "_linux" + #undef SUBTARGET_LINK_SPEC ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + #define SUBTARGET_LINK_SPEC \ + "%{shared:-shared} \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}" + + #undef LIB_SPEC +--- gcc-3.4.4/gcc/config/sparc/linux.h ++++ gcc-3.4.4/gcc/config/sparc/linux.h +@@ -162,13 +162,18 @@ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \ + %{static:-static}}}" + #else ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ + %{!mno-relax:%{!r:-relax}} \ + %{!shared: \ + %{!ibcs: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}}" + #endif + +--- gcc-3.4.4/gcc/config/sparc/linux64.h ++++ gcc-3.4.4/gcc/config/sparc/linux64.h +@@ -167,12 +166,17 @@ + { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \ + { "link_arch", LINK_ARCH_SPEC }, + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + #define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ + %{!shared: \ + %{!ibcs: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}} \ + " + +--- gcc-3.4.1-dist/libtool.m4 2004-05-18 04:08:37.000000000 -0500 ++++ gcc-3.4.1/libtool.m4 2004-08-12 15:54:43.000000000 -0500 +@@ -689,6 +689,11 @@ + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'] +--- gcc-3.4.1-dist/ltconfig 2004-03-05 15:05:41.000000000 -0600 ++++ gcc-3.4.1/ltconfig 2004-08-12 15:55:48.000000000 -0500 +@@ -602,6 +602,7 @@ + + # Transform linux* to *-*-linux-gnu*, to support old configure scripts. + case $host_os in ++linux-uclibc*) ;; + linux-gnu*) ;; + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` + esac +@@ -1262,6 +1263,24 @@ + dynamic_linker='GNU/Linux ld.so' + ;; + ++linux-uclibc*) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' ++ soname_spec='${libname}${release}.so$major' ++ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=no ++ # This implies no fast_install, which is unacceptable. ++ # Some rework will be needed to allow for fast_install ++ # before this can be enabled. ++ # Note: copied from linux-gnu, and may not be appropriate. ++ hardcode_into_libs=yes ++ # Assume using the uClibc dynamic linker. ++ dynamic_linker="uClibc ld.so" ++ ;; ++ + netbsd*) + need_lib_prefix=no + need_version=no +--- gcc-3.4.1-dist/boehm-gc/configure 2004-07-01 14:14:03.000000000 -0500 ++++ gcc-3.4.1/boehm-gc/configure 2004-08-12 16:22:57.000000000 -0500 +@@ -1947,6 +1947,11 @@ + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-3.4.1-dist/boehm-gc/ltconfig 2002-11-20 09:59:06.000000000 -0600 ++++ gcc-3.4.1/boehm-gc/ltconfig 2004-08-12 15:54:42.000000000 -0500 +@@ -1981,6 +1981,23 @@ + fi + ;; + ++linux-uclibc*) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' ++ soname_spec='${libname}${release}.so$major' ++ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=no ++ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ++ file_magic_cmd=/usr/bin/file ++ file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ++ # Assume using the uClibc dynamic linker. ++ dynamic_linker="uClibc ld.so" ++ ;; ++ + netbsd*) + version_type=sunos + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then diff --git a/patches/gcc/3.4.4/200-uclibc-locale.patch b/patches/gcc/3.4.4/200-uclibc-locale.patch new file mode 100644 index 00000000..a97f22b4 --- /dev/null +++ b/patches/gcc/3.4.4/200-uclibc-locale.patch @@ -0,0 +1,3255 @@ +diff -urN gcc-3.4.2-dist/libstdc++-v3/acinclude.m4 gcc-3.4.2/libstdc++-v3/acinclude.m4 +--- gcc-3.4.2-dist/libstdc++-v3/acinclude.m4 2004-07-15 12:42:45.000000000 -0500 ++++ gcc-3.4.2/libstdc++-v3/acinclude.m4 2004-09-10 10:47:40.000000000 -0500 +@@ -996,7 +996,7 @@ + AC_MSG_CHECKING([for C locale to use]) + GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], + [use MODEL for target locale package], +- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto]) ++ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto]) + + # If they didn't use this option switch, or if they specified --enable + # with no specific model, we'll have to look for one. If they +@@ -1012,6 +1012,9 @@ + # Default to "generic". + if test $enable_clocale_flag = auto; then + case x${target_os} in ++ x*-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + xlinux* | xgnu* | xkfreebsd*-gnu | xknetbsd*-gnu) + AC_EGREP_CPP([_GLIBCXX_ok], [ + #include <features.h> +@@ -1138,6 +1141,41 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ AC_MSG_RESULT(uclibc) ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ AC_SUBST(glibcxx_MOFILES) ++ AC_SUBST(glibcxx_POFILES) ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -urN gcc-3.4.2-dist/libstdc++-v3/aclocal.m4 gcc-3.4.2/libstdc++-v3/aclocal.m4 +--- gcc-3.4.2-dist/libstdc++-v3/aclocal.m4 2004-08-13 15:44:03.000000000 -0500 ++++ gcc-3.4.2/libstdc++-v3/aclocal.m4 2004-09-10 10:47:40.000000000 -0500 +@@ -1025,6 +1025,9 @@ + # Default to "generic". + if test $enable_clocale_flag = auto; then + case x${target_os} in ++ x*-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + xlinux* | xgnu* | xkfreebsd*-gnu | xknetbsd*-gnu) + AC_EGREP_CPP([_GLIBCXX_ok], [ + #include <features.h> +@@ -1151,6 +1154,41 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ AC_MSG_RESULT(uclibc) ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ AC_SUBST(glibcxx_MOFILES) ++ AC_SUBST(glibcxx_POFILES) ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -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 +--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2004-09-10 10:47:40.000000000 -0500 +@@ -0,0 +1,59 @@ ++// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*- ++ ++// Copyright (C) 2002, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// Written by Jakub Jelinek <jakub@redhat.com> ++ ++#include <clocale> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning clean this up ++#endif ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ ++extern "C" __typeof(iswctype_l) __iswctype_l; ++extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l; ++extern "C" __typeof(strcoll_l) __strcoll_l; ++extern "C" __typeof(strftime_l) __strftime_l; ++extern "C" __typeof(strtod_l) __strtod_l; ++extern "C" __typeof(strtof_l) __strtof_l; ++extern "C" __typeof(strtold_l) __strtold_l; ++extern "C" __typeof(strxfrm_l) __strxfrm_l; ++extern "C" __typeof(towlower_l) __towlower_l; ++extern "C" __typeof(towupper_l) __towupper_l; ++extern "C" __typeof(wcscoll_l) __wcscoll_l; ++extern "C" __typeof(wcsftime_l) __wcsftime_l; ++extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l; ++extern "C" __typeof(wctype_l) __wctype_l; ++extern "C" __typeof(newlocale) __newlocale; ++extern "C" __typeof(freelocale) __freelocale; ++extern "C" __typeof(duplocale) __duplocale; ++extern "C" __typeof(uselocale) __uselocale; ++ ++#endif // GLIBC 2.3 and later +diff -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 +--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c_locale.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c_locale.cc 2004-09-10 10:47:40.000000000 -0500 +@@ -0,0 +1,160 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <cerrno> // For errno ++#include <locale> ++#include <stdexcept> ++#include <langinfo.h> ++#include <bits/c++locale_internal.h> ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __strtol_l(S, E, B, L) strtol((S), (E), (B)) ++#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B)) ++#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B)) ++#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B)) ++#define __strtof_l(S, E, L) strtof((S), (E)) ++#define __strtod_l(S, E, L) strtod((S), (E)) ++#define __strtold_l(S, E, L) strtold((S), (E)) ++#warning should dummy __newlocale check for C|POSIX ? ++#define __newlocale(a, b, c) NULL ++#define __freelocale(a) ((void)0) ++#define __duplocale(a) __c_locale() ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ float __f = __strtof_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __f; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ double __d = __strtod_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __d; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ long double __ld = __strtold_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __ld; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ void ++ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, ++ __c_locale __old) ++ { ++ __cloc = __newlocale(1 << LC_ALL, __s, __old); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ if (!__cloc) ++ { ++ // This named locale is not supported by the underlying OS. ++ __throw_runtime_error(__N("locale::facet::_S_create_c_locale " ++ "name not valid")); ++ } ++#endif ++ } ++ ++ void ++ locale::facet::_S_destroy_c_locale(__c_locale& __cloc) ++ { ++ if (_S_get_c_locale() != __cloc) ++ __freelocale(__cloc); ++ } ++ ++ __c_locale ++ locale::facet::_S_clone_c_locale(__c_locale& __cloc) ++ { return __duplocale(__cloc); } ++} // namespace std ++ ++namespace __gnu_cxx ++{ ++ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] = ++ { ++ "LC_CTYPE", ++ "LC_NUMERIC", ++ "LC_TIME", ++ "LC_COLLATE", ++ "LC_MONETARY", ++ "LC_MESSAGES", ++#if _GLIBCXX_NUM_CATEGORIES != 0 ++ "LC_PAPER", ++ "LC_NAME", ++ "LC_ADDRESS", ++ "LC_TELEPHONE", ++ "LC_MEASUREMENT", ++ "LC_IDENTIFICATION" ++#endif ++ }; ++} ++ ++namespace std ++{ ++ const char* const* const locale::_S_categories = __gnu_cxx::category_names; ++} // namespace std +diff -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 +--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c_locale.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c_locale.h 2004-09-10 10:48:08.000000000 -0500 +@@ -0,0 +1,115 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#ifndef _C_LOCALE_H ++#define _C_LOCALE_H 1 ++ ++#pragma GCC system_header ++ ++#include <cstring> // get std::strlen ++#include <cstdio> // get std::snprintf or std::sprintf ++#include <clocale> ++#include <langinfo.h> // For codecvt ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC_HAS_LOCALE__ ++#include <iconv.h> // For codecvt using iconv, iconv_t ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#include <libintl.h> // For messages ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning what is _GLIBCXX_C_LOCALE_GNU for ++#endif ++#define _GLIBCXX_C_LOCALE_GNU 1 ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix categories ++#endif ++// #define _GLIBCXX_NUM_CATEGORIES 6 ++#define _GLIBCXX_NUM_CATEGORIES 0 ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++namespace __gnu_cxx ++{ ++ extern "C" __typeof(uselocale) __uselocale; ++} ++#endif ++ ++namespace std ++{ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ typedef __locale_t __c_locale; ++#else ++ typedef int* __c_locale; ++#endif ++ ++ // Convert numeric value of type _Tv to string and return length of ++ // string. If snprintf is available use it, otherwise fall back to ++ // the unsafe sprintf which, in general, can be dangerous and should ++ // be avoided. ++ template<typename _Tv> ++ int ++ __convert_from_v(char* __out, const int __size, const char* __fmt, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ _Tv __v, const __c_locale& __cloc, int __prec) ++ { ++ __c_locale __old = __gnu_cxx::__uselocale(__cloc); ++#else ++ _Tv __v, const __c_locale&, int __prec) ++ { ++# ifdef __UCLIBC_HAS_LOCALE__ ++ char* __old = std::setlocale(LC_ALL, NULL); ++ char* __sav = new char[std::strlen(__old) + 1]; ++ std::strcpy(__sav, __old); ++ std::setlocale(LC_ALL, "C"); ++# endif ++#endif ++ ++ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __gnu_cxx::__uselocale(__old); ++#elif defined __UCLIBC_HAS_LOCALE__ ++ std::setlocale(LC_ALL, __sav); ++ delete [] __sav; ++#endif ++ return __ret; ++ } ++} ++ ++#endif +diff -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 +--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2004-09-10 10:47:40.000000000 -0500 +@@ -0,0 +1,306 @@ ++// std::codecvt implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.5 - Template class codecvt ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++namespace std ++{ ++ // Specializations. ++#ifdef _GLIBCXX_USE_WCHAR_T ++ codecvt_base::result ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_out(state_type& __state, const intern_type* __from, ++ const intern_type* __from_end, const intern_type*& __from_next, ++ extern_type* __to, extern_type* __to_end, ++ extern_type*& __to_next) const ++ { ++ result __ret = ok; ++ state_type __tmp_state(__state); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ ++ // wcsnrtombs is *very* fast but stops if encounters NUL characters: ++ // in case we fall back to wcrtomb and then continue, in a loop. ++ // NB: wcsnrtombs is a GNU extension ++ for (__from_next = __from, __to_next = __to; ++ __from_next < __from_end && __to_next < __to_end ++ && __ret == ok;) ++ { ++ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0', ++ __from_end - __from_next); ++ if (!__from_chunk_end) ++ __from_chunk_end = __from_end; ++ ++ __from = __from_next; ++ const size_t __conv = wcsnrtombs(__to_next, &__from_next, ++ __from_chunk_end - __from_next, ++ __to_end - __to_next, &__state); ++ if (__conv == static_cast<size_t>(-1)) ++ { ++ // In case of error, in order to stop at the exact place we ++ // have to start again from the beginning with a series of ++ // wcrtomb. ++ for (; __from < __from_next; ++__from) ++ __to_next += wcrtomb(__to_next, *__from, &__tmp_state); ++ __state = __tmp_state; ++ __ret = error; ++ } ++ else if (__from_next && __from_next < __from_chunk_end) ++ { ++ __to_next += __conv; ++ __ret = partial; ++ } ++ else ++ { ++ __from_next = __from_chunk_end; ++ __to_next += __conv; ++ } ++ ++ if (__from_next < __from_end && __ret == ok) ++ { ++ extern_type __buf[MB_LEN_MAX]; ++ __tmp_state = __state; ++ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state); ++ if (__conv > static_cast<size_t>(__to_end - __to_next)) ++ __ret = partial; ++ else ++ { ++ memcpy(__to_next, __buf, __conv); ++ __state = __tmp_state; ++ __to_next += __conv; ++ ++__from_next; ++ } ++ } ++ } ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ return __ret; ++ } ++ ++ codecvt_base::result ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_in(state_type& __state, const extern_type* __from, ++ const extern_type* __from_end, const extern_type*& __from_next, ++ intern_type* __to, intern_type* __to_end, ++ intern_type*& __to_next) const ++ { ++ result __ret = ok; ++ state_type __tmp_state(__state); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ ++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters: ++ // in case we store a L'\0' and then continue, in a loop. ++ // NB: mbsnrtowcs is a GNU extension ++ for (__from_next = __from, __to_next = __to; ++ __from_next < __from_end && __to_next < __to_end ++ && __ret == ok;) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0', ++ __from_end ++ - __from_next)); ++ if (!__from_chunk_end) ++ __from_chunk_end = __from_end; ++ ++ __from = __from_next; ++ size_t __conv = mbsnrtowcs(__to_next, &__from_next, ++ __from_chunk_end - __from_next, ++ __to_end - __to_next, &__state); ++ if (__conv == static_cast<size_t>(-1)) ++ { ++ // In case of error, in order to stop at the exact place we ++ // have to start again from the beginning with a series of ++ // mbrtowc. ++ for (;; ++__to_next, __from += __conv) ++ { ++ __conv = mbrtowc(__to_next, __from, __from_end - __from, ++ &__tmp_state); ++ if (__conv == static_cast<size_t>(-1) ++ || __conv == static_cast<size_t>(-2)) ++ break; ++ } ++ __from_next = __from; ++ __state = __tmp_state; ++ __ret = error; ++ } ++ else if (__from_next && __from_next < __from_chunk_end) ++ { ++ // It is unclear what to return in this case (see DR 382). ++ __to_next += __conv; ++ __ret = partial; ++ } ++ else ++ { ++ __from_next = __from_chunk_end; ++ __to_next += __conv; ++ } ++ ++ if (__from_next < __from_end && __ret == ok) ++ { ++ if (__to_next < __to_end) ++ { ++ // XXX Probably wrong for stateful encodings ++ __tmp_state = __state; ++ ++__from_next; ++ *__to_next++ = L'\0'; ++ } ++ else ++ __ret = partial; ++ } ++ } ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ return __ret; ++ } ++ ++ int ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_encoding() const throw() ++ { ++ // XXX This implementation assumes that the encoding is ++ // stateless and is either single-byte or variable-width. ++ int __ret = 0; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ if (MB_CUR_MAX == 1) ++ __ret = 1; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __ret; ++ } ++ ++ int ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_max_length() const throw() ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ // XXX Probably wrong for stateful encodings. ++ int __ret = MB_CUR_MAX; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __ret; ++ } ++ ++ int ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_length(state_type& __state, const extern_type* __from, ++ const extern_type* __end, size_t __max) const ++ { ++ int __ret = 0; ++ state_type __tmp_state(__state); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ ++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters: ++ // in case we advance past it and then continue, in a loop. ++ // NB: mbsnrtowcs is a GNU extension ++ ++ // A dummy internal buffer is needed in order for mbsnrtocws to consider ++ // its fourth parameter (it wouldn't with NULL as first parameter). ++ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t) ++ * __max)); ++ while (__from < __end && __max) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0', ++ __end ++ - __from)); ++ if (!__from_chunk_end) ++ __from_chunk_end = __end; ++ ++ const extern_type* __tmp_from = __from; ++ size_t __conv = mbsnrtowcs(__to, &__from, ++ __from_chunk_end - __from, ++ __max, &__state); ++ if (__conv == static_cast<size_t>(-1)) ++ { ++ // In case of error, in order to stop at the exact place we ++ // have to start again from the beginning with a series of ++ // mbrtowc. ++ for (__from = __tmp_from;; __from += __conv) ++ { ++ __conv = mbrtowc(NULL, __from, __end - __from, ++ &__tmp_state); ++ if (__conv == static_cast<size_t>(-1) ++ || __conv == static_cast<size_t>(-2)) ++ break; ++ } ++ __state = __tmp_state; ++ __ret += __from - __tmp_from; ++ break; ++ } ++ if (!__from) ++ __from = __from_chunk_end; ++ ++ __ret += __from - __tmp_from; ++ __max -= __conv; ++ ++ if (__from < __end && __max) ++ { ++ // XXX Probably wrong for stateful encodings ++ __tmp_state = __state; ++ ++__from; ++ ++__ret; ++ --__max; ++ } ++ } ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ return __ret; ++ } ++#endif ++} +diff -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 +--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/collate_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/collate_members.cc 2004-09-10 10:47:40.000000000 -0500 +@@ -0,0 +1,80 @@ ++// std::collate implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.4.1.2 collate virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __strcoll_l(S1, S2, L) strcoll((S1), (S2)) ++#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N)) ++#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2)) ++#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N)) ++#endif ++ ++namespace std ++{ ++ // These are basically extensions to char_traits, and perhaps should ++ // be put there instead of here. ++ template<> ++ int ++ collate<char>::_M_compare(const char* __one, const char* __two) const ++ { ++ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate); ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); ++ } ++ ++ template<> ++ size_t ++ collate<char>::_M_transform(char* __to, const char* __from, ++ size_t __n) const ++ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ int ++ collate<wchar_t>::_M_compare(const wchar_t* __one, ++ const wchar_t* __two) const ++ { ++ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate); ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); ++ } ++ ++ template<> ++ size_t ++ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from, ++ size_t __n) const ++ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); } ++#endif ++} +diff -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 +--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2004-09-10 10:47:40.000000000 -0500 +@@ -0,0 +1,300 @@ ++// std::ctype implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions. ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#define _LIBC ++#include <locale> ++#undef _LIBC ++#include <bits/c++locale_internal.h> ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __wctype_l(S, L) wctype((S)) ++#define __towupper_l(C, L) towupper((C)) ++#define __towlower_l(C, L) towlower((C)) ++#define __iswctype_l(C, M, L) iswctype((C), (M)) ++#endif ++ ++namespace std ++{ ++ // NB: The other ctype<char> specializations are in src/locale.cc and ++ // various /config/os/* files. ++ template<> ++ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs) ++ : ctype<char>(0, false, __refs) ++ { ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ++ { ++ this->_S_destroy_c_locale(this->_M_c_locale_ctype); ++ this->_S_create_c_locale(this->_M_c_locale_ctype, __s); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper; ++ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower; ++ this->_M_table = this->_M_c_locale_ctype->__ctype_b; ++#endif ++ } ++ } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ ctype<wchar_t>::__wmask_type ++ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const ++ { ++ __wmask_type __ret; ++ switch (__m) ++ { ++ case space: ++ __ret = __wctype_l("space", _M_c_locale_ctype); ++ break; ++ case print: ++ __ret = __wctype_l("print", _M_c_locale_ctype); ++ break; ++ case cntrl: ++ __ret = __wctype_l("cntrl", _M_c_locale_ctype); ++ break; ++ case upper: ++ __ret = __wctype_l("upper", _M_c_locale_ctype); ++ break; ++ case lower: ++ __ret = __wctype_l("lower", _M_c_locale_ctype); ++ break; ++ case alpha: ++ __ret = __wctype_l("alpha", _M_c_locale_ctype); ++ break; ++ case digit: ++ __ret = __wctype_l("digit", _M_c_locale_ctype); ++ break; ++ case punct: ++ __ret = __wctype_l("punct", _M_c_locale_ctype); ++ break; ++ case xdigit: ++ __ret = __wctype_l("xdigit", _M_c_locale_ctype); ++ break; ++ case alnum: ++ __ret = __wctype_l("alnum", _M_c_locale_ctype); ++ break; ++ case graph: ++ __ret = __wctype_l("graph", _M_c_locale_ctype); ++ break; ++ default: ++ __ret = 0; ++ } ++ return __ret; ++ } ++ ++ wchar_t ++ ctype<wchar_t>::do_toupper(wchar_t __c) const ++ { return __towupper_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const ++ { ++ while (__lo < __hi) ++ { ++ *__lo = __towupper_l(*__lo, _M_c_locale_ctype); ++ ++__lo; ++ } ++ return __hi; ++ } ++ ++ wchar_t ++ ctype<wchar_t>::do_tolower(wchar_t __c) const ++ { return __towlower_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const ++ { ++ while (__lo < __hi) ++ { ++ *__lo = __towlower_l(*__lo, _M_c_locale_ctype); ++ ++__lo; ++ } ++ return __hi; ++ } ++ ++ bool ++ ctype<wchar_t>:: ++ do_is(mask __m, wchar_t __c) const ++ { ++ // Highest bitmask in ctype_base == 10, but extra in "C" ++ // library for blank. ++ bool __ret = false; ++ const size_t __bitmasksize = 11; ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) ++ if (__m & _M_bit[__bitcur] ++ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype)) ++ { ++ __ret = true; ++ break; ++ } ++ return __ret; ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const ++ { ++ for (; __lo < __hi; ++__vec, ++__lo) ++ { ++ // Highest bitmask in ctype_base == 10, but extra in "C" ++ // library for blank. ++ const size_t __bitmasksize = 11; ++ mask __m = 0; ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) ++ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype)) ++ __m |= _M_bit[__bitcur]; ++ *__vec = __m; ++ } ++ return __hi; ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const ++ { ++ while (__lo < __hi && !this->do_is(__m, *__lo)) ++ ++__lo; ++ return __lo; ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const ++ { ++ while (__lo < __hi && this->do_is(__m, *__lo) != 0) ++ ++__lo; ++ return __lo; ++ } ++ ++ wchar_t ++ ctype<wchar_t>:: ++ do_widen(char __c) const ++ { return _M_widen[static_cast<unsigned char>(__c)]; } ++ ++ const char* ++ ctype<wchar_t>:: ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const ++ { ++ while (__lo < __hi) ++ { ++ *__dest = _M_widen[static_cast<unsigned char>(*__lo)]; ++ ++__lo; ++ ++__dest; ++ } ++ return __hi; ++ } ++ ++ char ++ ctype<wchar_t>:: ++ do_narrow(wchar_t __wc, char __dfault) const ++ { ++ if (__wc >= 0 && __wc < 128 && _M_narrow_ok) ++ return _M_narrow[__wc]; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_ctype); ++#endif ++ const int __c = wctob(__wc); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return (__c == EOF ? __dfault : static_cast<char>(__c)); ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault, ++ char* __dest) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_ctype); ++#endif ++ if (_M_narrow_ok) ++ while (__lo < __hi) ++ { ++ if (*__lo >= 0 && *__lo < 128) ++ *__dest = _M_narrow[*__lo]; ++ else ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c)); ++ } ++ ++__lo; ++ ++__dest; ++ } ++ else ++ while (__lo < __hi) ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c)); ++ ++__lo; ++ ++__dest; ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __hi; ++ } ++ ++ void ++ ctype<wchar_t>::_M_initialize_ctype() ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_ctype); ++#endif ++ wint_t __i; ++ for (__i = 0; __i < 128; ++__i) ++ { ++ const int __c = wctob(__i); ++ if (__c == EOF) ++ break; ++ else ++ _M_narrow[__i] = static_cast<char>(__c); ++ } ++ if (__i == 128) ++ _M_narrow_ok = true; ++ else ++ _M_narrow_ok = false; ++ for (size_t __j = 0; ++ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j) ++ _M_widen[__j] = btowc(__j); ++ ++ for (size_t __k = 0; __k <= 11; ++__k) ++ { ++ _M_bit[__k] = static_cast<mask>(_ISbit(__k)); ++ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]); ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ } ++#endif // _GLIBCXX_USE_WCHAR_T ++} +diff -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 +--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/messages_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/messages_members.cc 2004-09-10 10:47:40.000000000 -0500 +@@ -0,0 +1,100 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix gettext stuff ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++extern "C" char *__dcgettext(const char *domainname, ++ const char *msgid, int category); ++#undef gettext ++#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES) ++#else ++#undef gettext ++#define gettext(msgid) (msgid) ++#endif ++ ++namespace std ++{ ++ // Specializations. ++ template<> ++ string ++ messages<char>::do_get(catalog, int, int, const string& __dfault) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_messages); ++ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str())); ++ __uselocale(__old); ++ return string(__msg); ++#elif defined __UCLIBC_HAS_LOCALE__ ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_messages); ++ const char* __msg = gettext(__dfault.c_str()); ++ setlocale(LC_ALL, __old); ++ free(__old); ++ return string(__msg); ++#else ++ const char* __msg = gettext(__dfault.c_str()); ++ return string(__msg); ++#endif ++ } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ wstring ++ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const ++ { ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ __uselocale(__old); ++ return _M_convert_from_char(__msg); ++# elif defined __UCLIBC_HAS_LOCALE__ ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ setlocale(LC_ALL, __old); ++ free(__old); ++ return _M_convert_from_char(__msg); ++# else ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ return _M_convert_from_char(__msg); ++# endif ++ } ++#endif ++} +diff -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 +--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/messages_members.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/messages_members.h 2004-09-10 10:47:40.000000000 -0500 +@@ -0,0 +1,118 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix prototypes for *textdomain funcs ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++extern "C" char *__textdomain(const char *domainname); ++extern "C" char *__bindtextdomain(const char *domainname, ++ const char *dirname); ++#else ++#undef __textdomain ++#undef __bindtextdomain ++#define __textdomain(D) ((void)0) ++#define __bindtextdomain(D,P) ((void)0) ++#endif ++ ++ // Non-virtual member functions. ++ template<typename _CharT> ++ messages<_CharT>::messages(size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), ++ _M_name_messages(_S_get_c_name()) ++ { } ++ ++ template<typename _CharT> ++ messages<_CharT>::messages(__c_locale __cloc, const char* __s, ++ size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)), ++ _M_name_messages(__s) ++ { ++ char* __tmp = new char[std::strlen(__s) + 1]; ++ std::strcpy(__tmp, __s); ++ _M_name_messages = __tmp; ++ } ++ ++ template<typename _CharT> ++ typename messages<_CharT>::catalog ++ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, ++ const char* __dir) const ++ { ++ __bindtextdomain(__s.c_str(), __dir); ++ return this->do_open(__s, __loc); ++ } ++ ++ // Virtual member functions. ++ template<typename _CharT> ++ messages<_CharT>::~messages() ++ { ++ if (_M_name_messages != _S_get_c_name()) ++ delete [] _M_name_messages; ++ _S_destroy_c_locale(_M_c_locale_messages); ++ } ++ ++ template<typename _CharT> ++ typename messages<_CharT>::catalog ++ messages<_CharT>::do_open(const basic_string<char>& __s, ++ const locale&) const ++ { ++ // No error checking is done, assume the catalog exists and can ++ // be used. ++ __textdomain(__s.c_str()); ++ return 0; ++ } ++ ++ template<typename _CharT> ++ void ++ messages<_CharT>::do_close(catalog) const ++ { } ++ ++ // messages_byname ++ template<typename _CharT> ++ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) ++ : messages<_CharT>(__refs) ++ { ++ if (this->_M_name_messages != locale::facet::_S_get_c_name()) ++ delete [] this->_M_name_messages; ++ char* __tmp = new char[std::strlen(__s) + 1]; ++ std::strcpy(__tmp, __s); ++ this->_M_name_messages = __tmp; ++ ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ++ { ++ this->_S_destroy_c_locale(this->_M_c_locale_messages); ++ this->_S_create_c_locale(this->_M_c_locale_messages, __s); ++ } ++ } +diff -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 +--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2004-09-10 10:47:40.000000000 -0500 +@@ -0,0 +1,698 @@ ++// std::moneypunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#define _LIBC ++#include <locale> ++#undef _LIBC ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning optimize this for uclibc ++#warning tailor for stub locale support ++#endif ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ // Construct and return valid pattern consisting of some combination of: ++ // space none symbol sign value ++ money_base::pattern ++ money_base::_S_construct_pattern(char __precedes, char __space, char __posn) ++ { ++ pattern __ret; ++ ++ // This insanely complicated routine attempts to construct a valid ++ // pattern for use with monyepunct. A couple of invariants: ++ ++ // if (__precedes) symbol -> value ++ // else value -> symbol ++ ++ // if (__space) space ++ // else none ++ ++ // none == never first ++ // space never first or last ++ ++ // Any elegant implementations of this are welcome. ++ switch (__posn) ++ { ++ case 0: ++ case 1: ++ // 1 The sign precedes the value and symbol. ++ __ret.field[0] = sign; ++ if (__space) ++ { ++ // Pattern starts with sign. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[3] = symbol; ++ } ++ __ret.field[2] = space; ++ } ++ else ++ { ++ // Pattern starts with sign and ends with none. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[3] = none; ++ } ++ break; ++ case 2: ++ // 2 The sign follows the value and symbol. ++ if (__space) ++ { ++ // Pattern either ends with sign. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[1] = space; ++ __ret.field[3] = sign; ++ } ++ else ++ { ++ // Pattern ends with sign then none. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[1] = symbol; ++ } ++ __ret.field[2] = sign; ++ __ret.field[3] = none; ++ } ++ break; ++ case 3: ++ // 3 The sign immediately precedes the symbol. ++ if (__precedes) ++ { ++ __ret.field[0] = sign; ++ __ret.field[1] = symbol; ++ if (__space) ++ { ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[2] = value; ++ __ret.field[3] = none; ++ } ++ } ++ else ++ { ++ __ret.field[0] = value; ++ if (__space) ++ { ++ __ret.field[1] = space; ++ __ret.field[2] = sign; ++ __ret.field[3] = symbol; ++ } ++ else ++ { ++ __ret.field[1] = sign; ++ __ret.field[2] = symbol; ++ __ret.field[3] = none; ++ } ++ } ++ break; ++ case 4: ++ // 4 The sign immediately follows the symbol. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = sign; ++ if (__space) ++ { ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[2] = value; ++ __ret.field[3] = none; ++ } ++ } ++ else ++ { ++ __ret.field[0] = value; ++ if (__space) ++ { ++ __ret.field[1] = space; ++ __ret.field[2] = symbol; ++ __ret.field[3] = sign; ++ } ++ else ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = sign; ++ __ret.field[3] = none; ++ } ++ } ++ break; ++ default: ++ ; ++ } ++ return __ret; ++ } ++ ++ template<> ++ void ++ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<char, true>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = '.'; ++ _M_data->_M_thousands_sep = ','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = ""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = ""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = ""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i]; ++ } ++ else ++ { ++ // Named locale. ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, ++ __cloc)); ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, ++ __cloc)); ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign); ++ ++ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); ++ if (!__nposn) ++ _M_data->_M_negative_sign = "()"; ++ else ++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, ++ __cloc); ++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign); ++ ++ // _Intl == true ++ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); ++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol); ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, ++ __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ } ++ } ++ ++ template<> ++ void ++ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<char, false>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = '.'; ++ _M_data->_M_thousands_sep = ','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = ""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = ""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = ""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i]; ++ } ++ else ++ { ++ // Named locale. ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, ++ __cloc)); ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, ++ __cloc)); ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign); ++ ++ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); ++ if (!__nposn) ++ _M_data->_M_negative_sign = "()"; ++ else ++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, ++ __cloc); ++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign); ++ ++ // _Intl == false ++ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); ++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol); ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ } ++ } ++ ++ template<> ++ moneypunct<char, true>::~moneypunct() ++ { delete _M_data; } ++ ++ template<> ++ moneypunct<char, false>::~moneypunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ const char*) ++#else ++ const char* __name) ++#endif ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<wchar_t, true>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = L'.'; ++ _M_data->_M_thousands_sep = L','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ // Use ctype::widen code without the facet... ++ unsigned char uc; ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ { ++ uc = static_cast<unsigned char>(money_base::_S_atoms[__i]); ++ _M_data->_M_atoms[__i] = btowc(uc); ++ } ++ } ++ else ++ { ++ // Named locale. ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(__cloc); ++#else ++ // Switch to named locale so that mbsrtowcs will work. ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, __name); ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this... should be monetary ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# else ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union __s_and_w { const char *__s; unsigned int __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = static_cast<wchar_t>(__u.__w); ++ ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = static_cast<wchar_t>(__u.__w); ++#endif ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); ++ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); ++ ++ wchar_t* __wcs_ps = 0; ++ wchar_t* __wcs_ns = 0; ++ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); ++ try ++ { ++ mbstate_t __state; ++ size_t __len = strlen(__cpossign); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ps = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); ++ _M_data->_M_positive_sign = __wcs_ps; ++ } ++ else ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); ++ ++ __len = strlen(__cnegsign); ++ if (!__nposn) ++ _M_data->_M_negative_sign = L"()"; ++ else if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ns = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); ++ _M_data->_M_negative_sign = __wcs_ns; ++ } ++ else ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); ++ ++ // _Intl == true. ++ __len = strlen(__ccurr); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state); ++ _M_data->_M_curr_symbol = __wcs; ++ } ++ else ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); ++ } ++ catch (...) ++ { ++ delete _M_data; ++ _M_data = 0; ++ delete __wcs_ps; ++ delete __wcs_ns; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ __throw_exception_again; ++ } ++ ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, ++ __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ } ++ } ++ ++ template<> ++ void ++ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ const char*) ++#else ++ const char* __name) ++#endif ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<wchar_t, false>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = L'.'; ++ _M_data->_M_thousands_sep = L','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ // Use ctype::widen code without the facet... ++ unsigned char uc; ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ { ++ uc = static_cast<unsigned char>(money_base::_S_atoms[__i]); ++ _M_data->_M_atoms[__i] = btowc(uc); ++ } ++ } ++ else ++ { ++ // Named locale. ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(__cloc); ++#else ++ // Switch to named locale so that mbsrtowcs will work. ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, __name); ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this... should be monetary ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# else ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union __s_and_w { const char *__s; unsigned int __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = static_cast<wchar_t>(__u.__w); ++ ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = static_cast<wchar_t>(__u.__w); ++#endif ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); ++ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); ++ ++ wchar_t* __wcs_ps = 0; ++ wchar_t* __wcs_ns = 0; ++ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); ++ try ++ { ++ mbstate_t __state; ++ size_t __len; ++ __len = strlen(__cpossign); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ps = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); ++ _M_data->_M_positive_sign = __wcs_ps; ++ } ++ else ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); ++ ++ __len = strlen(__cnegsign); ++ if (!__nposn) ++ _M_data->_M_negative_sign = L"()"; ++ else if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ns = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); ++ _M_data->_M_negative_sign = __wcs_ns; ++ } ++ else ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); ++ ++ // _Intl == true. ++ __len = strlen(__ccurr); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state); ++ _M_data->_M_curr_symbol = __wcs; ++ } ++ else ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); ++ } ++ catch (...) ++ { ++ delete _M_data; ++ _M_data = 0; ++ delete __wcs_ps; ++ delete __wcs_ns; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ __throw_exception_again; ++ } ++ ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ } ++ } ++ ++ template<> ++ moneypunct<wchar_t, true>::~moneypunct() ++ { ++ if (_M_data->_M_positive_sign_size) ++ delete [] _M_data->_M_positive_sign; ++ if (_M_data->_M_negative_sign_size ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0) ++ delete [] _M_data->_M_negative_sign; ++ if (_M_data->_M_curr_symbol_size) ++ delete [] _M_data->_M_curr_symbol; ++ delete _M_data; ++ } ++ ++ template<> ++ moneypunct<wchar_t, false>::~moneypunct() ++ { ++ if (_M_data->_M_positive_sign_size) ++ delete [] _M_data->_M_positive_sign; ++ if (_M_data->_M_negative_sign_size ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0) ++ delete [] _M_data->_M_negative_sign; ++ if (_M_data->_M_curr_symbol_size) ++ delete [] _M_data->_M_curr_symbol; ++ delete _M_data; ++ } ++#endif ++} +diff -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 +--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2004-09-10 10:47:40.000000000 -0500 +@@ -0,0 +1,183 @@ ++// std::numpunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#define _LIBC ++#include <locale> ++#undef _LIBC ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning tailor for stub locale support ++#endif ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache<char>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_use_grouping = false; ++ ++ _M_data->_M_decimal_point = '.'; ++ _M_data->_M_thousands_sep = ','; ++ ++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) ++ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i]; ++ ++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j) ++ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j]; ++ } ++ else ++ { ++ // Named locale. ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT, ++ __cloc)); ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP, ++ __cloc)); ++ ++ // Check for NULL, which implies no grouping. ++ if (_M_data->_M_thousands_sep == '\0') ++ _M_data->_M_grouping = ""; ++ else ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ } ++ ++ // NB: There is no way to extact this info from posix locales. ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); ++ _M_data->_M_truename = "true"; ++ _M_data->_M_truename_size = strlen(_M_data->_M_truename); ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); ++ _M_data->_M_falsename = "false"; ++ _M_data->_M_falsename_size = strlen(_M_data->_M_falsename); ++ } ++ ++ template<> ++ numpunct<char>::~numpunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache<wchar_t>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_use_grouping = false; ++ ++ _M_data->_M_decimal_point = L'.'; ++ _M_data->_M_thousands_sep = L','; ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_S_get_c_locale()); ++#endif ++ // Use ctype::widen code without the facet... ++ unsigned char uc; ++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) ++ { ++ uc = static_cast<unsigned char>(__num_base::_S_atoms_out[__i]); ++ _M_data->_M_atoms_out[__i] = btowc(uc); ++ } ++ ++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j) ++ { ++ uc = static_cast<unsigned char>(__num_base::_S_atoms_in[__j]); ++ _M_data->_M_atoms_in[__j] = btowc(uc); ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ } ++ else ++ { ++ // Named locale. ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# else ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union __s_and_w { const char *__s; unsigned int __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = static_cast<wchar_t>(__u.__w); ++ ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = static_cast<wchar_t>(__u.__w); ++#endif ++ ++ if (_M_data->_M_thousands_sep == L'\0') ++ _M_data->_M_grouping = ""; ++ else ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ } ++ ++ // NB: There is no way to extact this info from posix locales. ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); ++ _M_data->_M_truename = L"true"; ++ _M_data->_M_truename_size = wcslen(_M_data->_M_truename); ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); ++ _M_data->_M_falsename = L"false"; ++ _M_data->_M_falsename_size = wcslen(_M_data->_M_falsename); ++ } ++ ++ template<> ++ numpunct<wchar_t>::~numpunct() ++ { delete _M_data; } ++ #endif ++} +diff -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 +--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/time_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/time_members.cc 2004-09-10 10:48:00.000000000 -0500 +@@ -0,0 +1,356 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning tailor for stub locale support ++#endif ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ __timepunct<char>:: ++ _M_put(char* __s, size_t __maxlen, const char* __format, ++ const tm* __tm) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm, ++ _M_c_locale_timepunct); ++#else ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_timepunct); ++ const size_t __len = strftime(__s, __maxlen, __format, __tm); ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ // Make sure __s is null terminated. ++ if (__len == 0) ++ __s[0] = '\0'; ++ } ++ ++ template<> ++ void ++ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache<char>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = "%m/%d/%y"; ++ _M_data->_M_date_era_format = "%m/%d/%y"; ++ _M_data->_M_time_format = "%H:%M:%S"; ++ _M_data->_M_time_era_format = "%H:%M:%S"; ++ _M_data->_M_date_time_format = ""; ++ _M_data->_M_date_time_era_format = ""; ++ _M_data->_M_am = "AM"; ++ _M_data->_M_pm = "PM"; ++ _M_data->_M_am_pm_format = ""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = "Sunday"; ++ _M_data->_M_day2 = "Monday"; ++ _M_data->_M_day3 = "Tuesday"; ++ _M_data->_M_day4 = "Wednesday"; ++ _M_data->_M_day5 = "Thursday"; ++ _M_data->_M_day6 = "Friday"; ++ _M_data->_M_day7 = "Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = "Sun"; ++ _M_data->_M_aday2 = "Mon"; ++ _M_data->_M_aday3 = "Tue"; ++ _M_data->_M_aday4 = "Wed"; ++ _M_data->_M_aday5 = "Thu"; ++ _M_data->_M_aday6 = "Fri"; ++ _M_data->_M_aday7 = "Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = "January"; ++ _M_data->_M_month02 = "February"; ++ _M_data->_M_month03 = "March"; ++ _M_data->_M_month04 = "April"; ++ _M_data->_M_month05 = "May"; ++ _M_data->_M_month06 = "June"; ++ _M_data->_M_month07 = "July"; ++ _M_data->_M_month08 = "August"; ++ _M_data->_M_month09 = "September"; ++ _M_data->_M_month10 = "October"; ++ _M_data->_M_month11 = "November"; ++ _M_data->_M_month12 = "December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = "Jan"; ++ _M_data->_M_amonth02 = "Feb"; ++ _M_data->_M_amonth03 = "Mar"; ++ _M_data->_M_amonth04 = "Apr"; ++ _M_data->_M_amonth05 = "May"; ++ _M_data->_M_amonth06 = "Jun"; ++ _M_data->_M_amonth07 = "Jul"; ++ _M_data->_M_amonth08 = "Aug"; ++ _M_data->_M_amonth09 = "Sep"; ++ _M_data->_M_amonth10 = "Oct"; ++ _M_data->_M_amonth11 = "Nov"; ++ _M_data->_M_amonth12 = "Dec"; ++ } ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc); ++ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc); ++ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc); ++ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc); ++ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc); ++ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT, __cloc); ++ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc); ++ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc); ++ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc); ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc); ++ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc); ++ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc); ++ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc); ++ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc); ++ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc); ++ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc); ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc); ++ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc); ++ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc); ++ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc); ++ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc); ++ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc); ++ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc); ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc); ++ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc); ++ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc); ++ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc); ++ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc); ++ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc); ++ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc); ++ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc); ++ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc); ++ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc); ++ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc); ++ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc); ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc); ++ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc); ++ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc); ++ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc); ++ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc); ++ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc); ++ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc); ++ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc); ++ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc); ++ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc); ++ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc); ++ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc); ++ } ++ } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ __timepunct<wchar_t>:: ++ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format, ++ const tm* __tm) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct); ++ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm, ++ _M_c_locale_timepunct); ++#else ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_timepunct); ++ const size_t __len = wcsftime(__s, __maxlen, __format, __tm); ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ // Make sure __s is null terminated. ++ if (__len == 0) ++ __s[0] = L'\0'; ++ } ++ ++ template<> ++ void ++ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache<wchar_t>; ++ ++#warning wide time stuff ++// if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = L"%m/%d/%y"; ++ _M_data->_M_date_era_format = L"%m/%d/%y"; ++ _M_data->_M_time_format = L"%H:%M:%S"; ++ _M_data->_M_time_era_format = L"%H:%M:%S"; ++ _M_data->_M_date_time_format = L""; ++ _M_data->_M_date_time_era_format = L""; ++ _M_data->_M_am = L"AM"; ++ _M_data->_M_pm = L"PM"; ++ _M_data->_M_am_pm_format = L""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = L"Sunday"; ++ _M_data->_M_day2 = L"Monday"; ++ _M_data->_M_day3 = L"Tuesday"; ++ _M_data->_M_day4 = L"Wednesday"; ++ _M_data->_M_day5 = L"Thursday"; ++ _M_data->_M_day6 = L"Friday"; ++ _M_data->_M_day7 = L"Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = L"Sun"; ++ _M_data->_M_aday2 = L"Mon"; ++ _M_data->_M_aday3 = L"Tue"; ++ _M_data->_M_aday4 = L"Wed"; ++ _M_data->_M_aday5 = L"Thu"; ++ _M_data->_M_aday6 = L"Fri"; ++ _M_data->_M_aday7 = L"Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = L"January"; ++ _M_data->_M_month02 = L"February"; ++ _M_data->_M_month03 = L"March"; ++ _M_data->_M_month04 = L"April"; ++ _M_data->_M_month05 = L"May"; ++ _M_data->_M_month06 = L"June"; ++ _M_data->_M_month07 = L"July"; ++ _M_data->_M_month08 = L"August"; ++ _M_data->_M_month09 = L"September"; ++ _M_data->_M_month10 = L"October"; ++ _M_data->_M_month11 = L"November"; ++ _M_data->_M_month12 = L"December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = L"Jan"; ++ _M_data->_M_amonth02 = L"Feb"; ++ _M_data->_M_amonth03 = L"Mar"; ++ _M_data->_M_amonth04 = L"Apr"; ++ _M_data->_M_amonth05 = L"May"; ++ _M_data->_M_amonth06 = L"Jun"; ++ _M_data->_M_amonth07 = L"Jul"; ++ _M_data->_M_amonth08 = L"Aug"; ++ _M_data->_M_amonth09 = L"Sep"; ++ _M_data->_M_amonth10 = L"Oct"; ++ _M_data->_M_amonth11 = L"Nov"; ++ _M_data->_M_amonth12 = L"Dec"; ++ } ++#if 0 ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ _M_data->_M_date_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WD_FMT, __cloc)); ++ _M_data->_M_date_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_D_FMT, __cloc)); ++ _M_data->_M_time_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WT_FMT, __cloc)); ++ _M_data->_M_time_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_T_FMT, __cloc)); ++ _M_data->_M_date_time_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WD_T_FMT, __cloc)); ++ _M_data->_M_date_time_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc)); ++ _M_data->_M_am = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WAM_STR, __cloc)); ++ _M_data->_M_pm = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WPM_STR, __cloc)); ++ _M_data->_M_am_pm_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc)); ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_1, __cloc)); ++ _M_data->_M_day2 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_2, __cloc)); ++ _M_data->_M_day3 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_3, __cloc)); ++ _M_data->_M_day4 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_4, __cloc)); ++ _M_data->_M_day5 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_5, __cloc)); ++ _M_data->_M_day6 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_6, __cloc)); ++ _M_data->_M_day7 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_7, __cloc)); ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_1, __cloc)); ++ _M_data->_M_aday2 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_2, __cloc)); ++ _M_data->_M_aday3 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_3, __cloc)); ++ _M_data->_M_aday4 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_4, __cloc)); ++ _M_data->_M_aday5 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_5, __cloc)); ++ _M_data->_M_aday6 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_6, __cloc)); ++ _M_data->_M_aday7 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_7, __cloc)); ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_1, __cloc)); ++ _M_data->_M_month02 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_2, __cloc)); ++ _M_data->_M_month03 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_3, __cloc)); ++ _M_data->_M_month04 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_4, __cloc)); ++ _M_data->_M_month05 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_5, __cloc)); ++ _M_data->_M_month06 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_6, __cloc)); ++ _M_data->_M_month07 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_7, __cloc)); ++ _M_data->_M_month08 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_8, __cloc)); ++ _M_data->_M_month09 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_9, __cloc)); ++ _M_data->_M_month10 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_10, __cloc)); ++ _M_data->_M_month11 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_11, __cloc)); ++ _M_data->_M_month12 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_12, __cloc)); ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_1, __cloc)); ++ _M_data->_M_amonth02 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_2, __cloc)); ++ _M_data->_M_amonth03 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_3, __cloc)); ++ _M_data->_M_amonth04 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_4, __cloc)); ++ _M_data->_M_amonth05 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_5, __cloc)); ++ _M_data->_M_amonth06 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_6, __cloc)); ++ _M_data->_M_amonth07 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_7, __cloc)); ++ _M_data->_M_amonth08 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_8, __cloc)); ++ _M_data->_M_amonth09 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_9, __cloc)); ++ _M_data->_M_amonth10 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_10, __cloc)); ++ _M_data->_M_amonth11 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_11, __cloc)); ++ _M_data->_M_amonth12 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_12, __cloc)); ++ } ++#endif // 0 ++ } ++#endif ++} +diff -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 +--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/time_members.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/time_members.h 2004-09-10 10:47:40.000000000 -0500 +@@ -0,0 +1,68 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::__timepunct(size_t __refs) ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), ++ _M_name_timepunct(_S_get_c_name()) ++ { _M_initialize_timepunct(); } ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) ++ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL), ++ _M_name_timepunct(_S_get_c_name()) ++ { _M_initialize_timepunct(); } ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, ++ size_t __refs) ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), ++ _M_name_timepunct(__s) ++ { ++ char* __tmp = new char[std::strlen(__s) + 1]; ++ std::strcpy(__tmp, __s); ++ _M_name_timepunct = __tmp; ++ _M_initialize_timepunct(__cloc); ++ } ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::~__timepunct() ++ { ++ if (_M_name_timepunct != _S_get_c_name()) ++ delete [] _M_name_timepunct; ++ delete _M_data; ++ _S_destroy_c_locale(_M_c_locale_timepunct); ++ } +diff -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 +--- gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/ctype_base.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.2/libstdc++-v3/config/os/uclibc/ctype_base.h 2004-09-10 10:47:40.000000000 -0500 +@@ -0,0 +1,58 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// Information as gleaned from /usr/include/ctype.h ++ ++ struct ctype_base ++ { ++ // Note: In uClibc, the following two types depend on configuration. ++ ++ // Non-standard typedefs. ++ typedef const __ctype_touplow_t* __to_type; ++ ++ // NB: Offsets into ctype<char>::_M_table force a particular size ++ // on the mask type. Because of this, we don't use an enum. ++ typedef __ctype_mask_t mask; ++ static const mask upper = _ISupper; ++ static const mask lower = _ISlower; ++ static const mask alpha = _ISalpha; ++ static const mask digit = _ISdigit; ++ static const mask xdigit = _ISxdigit; ++ static const mask space = _ISspace; ++ static const mask print = _ISprint; ++ static const mask graph = _ISalpha | _ISdigit | _ISpunct; ++ static const mask cntrl = _IScntrl; ++ static const mask punct = _ISpunct; ++ static const mask alnum = _ISalpha | _ISdigit; ++ }; +diff -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 +--- gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/ctype_inline.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.2/libstdc++-v3/config/os/uclibc/ctype_inline.h 2004-09-10 10:47:40.000000000 -0500 +@@ -0,0 +1,69 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 2000, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) ++// functions go in ctype.cc ++ ++ bool ++ ctype<char>:: ++ is(mask __m, char __c) const ++ { return _M_table[static_cast<unsigned char>(__c)] & __m; } ++ ++ const char* ++ ctype<char>:: ++ is(const char* __low, const char* __high, mask* __vec) const ++ { ++ while (__low < __high) ++ *__vec++ = _M_table[static_cast<unsigned char>(*__low++)]; ++ return __high; ++ } ++ ++ const char* ++ ctype<char>:: ++ scan_is(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && !(_M_table[static_cast<unsigned char>(*__low)] & __m)) ++ ++__low; ++ return __low; ++ } ++ ++ const char* ++ ctype<char>:: ++ scan_not(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0) ++ ++__low; ++ return __low; ++ } +diff -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 +--- gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.2/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2004-09-10 10:47:40.000000000 -0500 +@@ -0,0 +1,92 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// Information as gleaned from /usr/include/ctype.h ++ ++ const ctype_base::mask* ++ ctype<char>::classic_table() throw() ++ { return __C_ctype_b; } ++ ++ ctype<char>::ctype(__c_locale, const mask* __table, bool __del, ++ size_t __refs) ++ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), ++ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0) ++ { ++ _M_toupper = __C_ctype_toupper; ++ _M_tolower = __C_ctype_tolower; ++ _M_table = __table ? __table : __C_ctype_b; ++ memset(_M_widen, 0, sizeof(_M_widen)); ++ memset(_M_narrow, 0, sizeof(_M_narrow)); ++ } ++ ++ ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) ++ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), ++ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0) ++ { ++ _M_toupper = __C_ctype_toupper; ++ _M_tolower = __C_ctype_tolower; ++ _M_table = __table ? __table : __C_ctype_b; ++ memset(_M_widen, 0, sizeof(_M_widen)); ++ memset(_M_narrow, 0, sizeof(_M_narrow)); ++ } ++ ++ char ++ ctype<char>::do_toupper(char __c) const ++ { return _M_toupper[static_cast<unsigned char>(__c)]; } ++ ++ const char* ++ ctype<char>::do_toupper(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_toupper[static_cast<unsigned char>(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } ++ ++ char ++ ctype<char>::do_tolower(char __c) const ++ { return _M_tolower[static_cast<unsigned char>(__c)]; } ++ ++ const char* ++ ctype<char>::do_tolower(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_tolower[static_cast<unsigned char>(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } +diff -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 +--- gcc-3.4.2-dist/libstdc++-v3/config/os/uclibc/os_defines.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.2/libstdc++-v3/config/os/uclibc/os_defines.h 2004-09-10 10:47:40.000000000 -0500 +@@ -0,0 +1,44 @@ ++// Specific definitions for GNU/Linux -*- C++ -*- ++ ++// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++#ifndef _GLIBCXX_OS_DEFINES ++#define _GLIBCXX_OS_DEFINES 1 ++ ++// System-specific #define, typedefs, corrections, etc, go here. This ++// file will come before all others. ++ ++// This keeps isanum, et al from being propagated as macros. ++#define __NO_CTYPE 1 ++ ++#include <features.h> ++ ++// We must not see the optimized string functions GNU libc defines. ++#define __NO_STRING_INLINES ++ ++#endif +diff -urN gcc-3.4.2-dist/libstdc++-v3/configure gcc-3.4.2/libstdc++-v3/configure +--- gcc-3.4.2-dist/libstdc++-v3/configure 2004-08-13 15:44:04.000000000 -0500 ++++ gcc-3.4.2/libstdc++-v3/configure 2004-09-10 10:47:40.000000000 -0500 +@@ -3878,6 +3878,11 @@ + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +@@ -5479,7 +5479,7 @@ + enableval="$enable_clocale" + + case "$enableval" in +- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;; ++ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;; + *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5 + echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;} + { (exit 1); exit 1; }; } ;; +@@ -5545,6 +5550,9 @@ + # Default to "generic". + if test $enable_clocale_flag = auto; then + case x${target_os} in ++ xlinux-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + xlinux* | xgnu* | xkfreebsd*-gnu | xknetbsd*-gnu) + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" +@@ -5759,6 +5767,77 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ echo "$as_me:$LINENO: result: uclibc" >&5 ++echo "${ECHO_T}uclibc" >&6 ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ # Extract the first word of "msgfmt", so it can be a program name with args. ++set dummy msgfmt; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test -n "$check_msgfmt"; then ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_check_msgfmt="yes" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" ++fi ++fi ++check_msgfmt=$ac_cv_prog_check_msgfmt ++if test -n "$check_msgfmt"; then ++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 ++echo "${ECHO_T}$check_msgfmt" >&6 ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ ++ ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -urN gcc-3.4.2-dist/libstdc++-v3/configure.host gcc-3.4.2/libstdc++-v3/configure.host +--- gcc-3.4.2-dist/libstdc++-v3/configure.host 2004-08-27 14:52:30.000000000 -0500 ++++ gcc-3.4.2/libstdc++-v3/configure.host 2004-09-10 10:47:40.000000000 -0500 +@@ -217,6 +217,12 @@ + ;; + esac + ++# Override for uClibc since linux-uclibc gets mishandled above. ++case "${host_os}" in ++ *-uclibc*) ++ os_include_dir="os/uclibc" ++ ;; ++esac + + # Set any OS-dependent and CPU-dependent bits. + # THIS TABLE IS SORTED. KEEP IT THAT WAY. +diff -urN gcc-3.4.2-dist/libstdc++-v3/crossconfig.m4 gcc-3.4.2/libstdc++-v3/crossconfig.m4 +--- gcc-3.4.2-dist/libstdc++-v3/crossconfig.m4 2004-07-06 20:23:49.000000000 -0500 ++++ gcc-3.4.2/libstdc++-v3/crossconfig.m4 2004-09-10 10:47:40.000000000 -0500 +@@ -138,6 +138,99 @@ + ;; + esac + ;; ++ *-uclibc*) ++# Temporary hack until we implement the float versions of the libm funcs ++ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ ++ machine/endian.h machine/param.h sys/machine.h sys/types.h \ ++ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h]) ++ SECTION_FLAGS='-ffunction-sections -fdata-sections' ++ AC_SUBST(SECTION_FLAGS) ++ GLIBCXX_CHECK_LINKER_FEATURES ++ GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT ++ GLIBCXX_CHECK_WCHAR_T_SUPPORT ++ ++ # For LFS. ++ AC_DEFINE(HAVE_INT64_T) ++ case "$target" in ++ *-uclinux*) ++ # Don't enable LFS with uClinux ++ ;; ++ *) ++ AC_DEFINE(_GLIBCXX_USE_LFS) ++ esac ++ ++ # For showmanyc_helper(). ++ AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) ++ GLIBCXX_CHECK_POLL ++ GLIBCXX_CHECK_S_ISREG_OR_S_IFREG ++ ++ # For xsputn_2(). ++ AC_CHECK_HEADERS(sys/uio.h) ++ GLIBCXX_CHECK_WRITEV ++ ++# AC_DEFINE(HAVE_ACOSF) ++# AC_DEFINE(HAVE_ASINF) ++# AC_DEFINE(HAVE_ATANF) ++# AC_DEFINE(HAVE_ATAN2F) ++ AC_DEFINE(HAVE_CEILF) ++ AC_DEFINE(HAVE_COPYSIGN) ++# AC_DEFINE(HAVE_COPYSIGNF) ++# AC_DEFINE(HAVE_COSF) ++# AC_DEFINE(HAVE_COSHF) ++# AC_DEFINE(HAVE_EXPF) ++# AC_DEFINE(HAVE_FABSF) ++ AC_DEFINE(HAVE_FINITE) ++ AC_DEFINE(HAVE_FINITEF) ++ AC_DEFINE(HAVE_FLOORF) ++# AC_DEFINE(HAVE_FMODF) ++# AC_DEFINE(HAVE_FREXPF) ++ AC_DEFINE(HAVE_HYPOT) ++# AC_DEFINE(HAVE_HYPOTF) ++ AC_DEFINE(HAVE_ISINF) ++ AC_DEFINE(HAVE_ISINFF) ++ AC_DEFINE(HAVE_ISNAN) ++ AC_DEFINE(HAVE_ISNANF) ++# AC_DEFINE(HAVE_LOGF) ++# AC_DEFINE(HAVE_LOG10F) ++# AC_DEFINE(HAVE_MODFF) ++# AC_DEFINE(HAVE_SINF) ++# AC_DEFINE(HAVE_SINHF) ++# AC_DEFINE(HAVE_SINCOS) ++# AC_DEFINE(HAVE_SINCOSF) ++ AC_DEFINE(HAVE_SQRTF) ++# AC_DEFINE(HAVE_TANF) ++# AC_DEFINE(HAVE_TANHF) ++ if test x"long_double_math_on_this_cpu" = x"yes"; then ++ AC_MSG_ERROR([long_double_math_on_this_cpu is yes!]) ++# AC_DEFINE(HAVE_ACOSL) ++# AC_DEFINE(HAVE_ASINL) ++# AC_DEFINE(HAVE_ATANL) ++# AC_DEFINE(HAVE_ATAN2L) ++# AC_DEFINE(HAVE_CEILL) ++# AC_DEFINE(HAVE_COPYSIGNL) ++# AC_DEFINE(HAVE_COSL) ++# AC_DEFINE(HAVE_COSHL) ++# AC_DEFINE(HAVE_EXPL) ++# AC_DEFINE(HAVE_FABSL) ++# AC_DEFINE(HAVE_FINITEL) ++# AC_DEFINE(HAVE_FLOORL) ++# AC_DEFINE(HAVE_FMODL) ++# AC_DEFINE(HAVE_FREXPL) ++# AC_DEFINE(HAVE_HYPOTL) ++# AC_DEFINE(HAVE_ISINFL) ++# AC_DEFINE(HAVE_ISNANL) ++# AC_DEFINE(HAVE_LOGL) ++# AC_DEFINE(HAVE_LOG10L) ++# AC_DEFINE(HAVE_MODFL) ++# AC_DEFINE(HAVE_POWL) ++# AC_DEFINE(HAVE_SINL) ++# AC_DEFINE(HAVE_SINHL) ++# AC_DEFINE(HAVE_SINCOSL) ++# AC_DEFINE(HAVE_SQRTL) ++# AC_DEFINE(HAVE_TANL) ++# AC_DEFINE(HAVE_TANHL) ++ fi ++ ;; + *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu) + AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ + machine/endian.h machine/param.h sys/machine.h sys/types.h \ +@@ -152,7 +245,7 @@ + AC_DEFINE(HAVE_INT64_T) + case "$target" in + *-uclinux*) +- # Don't enable LFS with uClibc ++ # Don't enable LFS with uClinux + ;; + *) + AC_DEFINE(_GLIBCXX_USE_LFS) +diff -urN gcc-3.4.2-dist/libstdc++-v3/include/c_compatibility/wchar.h gcc-3.4.2/libstdc++-v3/include/c_compatibility/wchar.h +--- gcc-3.4.2-dist/libstdc++-v3/include/c_compatibility/wchar.h 2003-12-08 21:51:45.000000000 -0600 ++++ gcc-3.4.2/libstdc++-v3/include/c_compatibility/wchar.h 2004-09-10 10:47:40.000000000 -0500 +@@ -101,7 +101,9 @@ + using std::wmemcpy; + using std::wmemmove; + using std::wmemset; ++#if _GLIBCXX_HAVE_WCSFTIME + using std::wcsftime; ++#endif + + #if _GLIBCXX_USE_C99 + using std::wcstold; +diff -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 +--- gcc-3.4.2-dist/libstdc++-v3/include/c_std/std_cwchar.h 2004-07-20 03:52:12.000000000 -0500 ++++ gcc-3.4.2/libstdc++-v3/include/c_std/std_cwchar.h 2004-09-10 10:47:40.000000000 -0500 +@@ -179,7 +179,9 @@ + using ::wcscoll; + using ::wcscpy; + using ::wcscspn; ++#if _GLIBCXX_HAVE_WCSFTIME + using ::wcsftime; ++#endif + using ::wcslen; + using ::wcsncat; + using ::wcsncmp; diff --git a/patches/gcc/3.4.4/300-libstdc++-pic.patch b/patches/gcc/3.4.4/300-libstdc++-pic.patch new file mode 100644 index 00000000..0c41db91 --- /dev/null +++ b/patches/gcc/3.4.4/300-libstdc++-pic.patch @@ -0,0 +1,46 @@ +diff -dur gcc-3.4.4.orig/libstdc++-v3/src/Makefile.am gcc-3.4.4/libstdc++-v3/src/Makefile.am +--- gcc-3.4.4.orig/libstdc++-v3/src/Makefile.am 2004-04-16 21:08:35.000000000 +0200 ++++ gcc-3.4.4/libstdc++-v3/src/Makefile.am 2007-02-14 17:24:53.000000000 +0100 +@@ -209,6 +209,9 @@ + CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ + ++install-exec-local: ++ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) + + # Added bits to build debug library. + if GLIBCXX_BUILD_DEBUG +diff -dur gcc-3.4.4.orig/libstdc++-v3/src/Makefile.in gcc-3.4.4/libstdc++-v3/src/Makefile.in +--- gcc-3.4.4.orig/libstdc++-v3/src/Makefile.in 2004-04-16 21:08:35.000000000 +0200 ++++ gcc-3.4.4/libstdc++-v3/src/Makefile.in 2007-02-14 17:25:18.000000000 +0100 +@@ -592,7 +592,7 @@ + + install-data-am: install-data-local + +-install-exec-am: install-toolexeclibLTLIBRARIES ++install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local + + install-info: install-info-am + +@@ -625,6 +625,7 @@ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-data install-data-am install-data-local \ + install-exec install-exec-am install-info install-info-am \ ++ install-exec-local \ + install-man install-strip install-toolexeclibLTLIBRARIES \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ +@@ -709,6 +710,11 @@ + install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ++ ++install-exec-local: ++ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: +Only in gcc-3.4.4/libstdc++-v3/src: Makefile.in.orig diff --git a/patches/gcc/3.4.4/600-gcc34-arm-ldm-peephole.patch b/patches/gcc/3.4.4/600-gcc34-arm-ldm-peephole.patch new file mode 100644 index 00000000..0c370502 --- /dev/null +++ b/patches/gcc/3.4.4/600-gcc34-arm-ldm-peephole.patch @@ -0,0 +1,65 @@ +--- gcc-3.4.0/gcc/config/arm/arm.md.arm-ldm-peephole 2004-01-13 08:24:37.000000000 -0500 ++++ gcc-3.4.0/gcc/config/arm/arm.md 2004-04-24 18:18:04.000000000 -0400 +@@ -8810,13 +8810,16 @@ + (set_attr "length" "4,8,8")] + ) + ++; Try to convert LDR+LDR+arith into [add+]LDM+arith ++; On XScale, LDM is always slower than two LDRs, so only do this if ++; optimising for size. + (define_insn "*arith_adjacentmem" + [(set (match_operand:SI 0 "s_register_operand" "=r") + (match_operator:SI 1 "shiftable_operator" + [(match_operand:SI 2 "memory_operand" "m") + (match_operand:SI 3 "memory_operand" "m")])) + (clobber (match_scratch:SI 4 "=r"))] +- "TARGET_ARM && adjacent_mem_locations (operands[2], operands[3])" ++ "TARGET_ARM && (!arm_tune_xscale || optimize_size) && adjacent_mem_locations (operands[2], operands[3])" + "* + { + rtx ldm[3]; +@@ -8851,6 +8854,8 @@ + } + if (val1 && val2) + { ++ /* This would be a loss on a Harvard core, but adjacent_mem_locations() ++ will prevent it from happening. */ + rtx ops[3]; + ldm[0] = ops[0] = operands[4]; + ops[1] = XEXP (XEXP (operands[2], 0), 0); +--- gcc-3.4.0/gcc/config/arm/arm.c.arm-ldm-peephole 2004-04-24 18:16:25.000000000 -0400 ++++ gcc-3.4.0/gcc/config/arm/arm.c 2004-04-24 18:18:04.000000000 -0400 +@@ -4838,6 +4841,11 @@ + *load_offset = unsorted_offsets[order[0]]; + } + ++ /* For XScale a two-word LDM is a performance loss, so only do this if ++ size is more important. See comments in arm_gen_load_multiple. */ ++ if (nops == 2 && arm_tune_xscale && !optimize_size) ++ return 0; ++ + if (unsorted_offsets[order[0]] == 0) + return 1; /* ldmia */ + +@@ -5064,6 +5072,11 @@ + *load_offset = unsorted_offsets[order[0]]; + } + ++ /* For XScale a two-word LDM is a performance loss, so only do this if ++ size is more important. See comments in arm_gen_load_multiple. */ ++ if (nops == 2 && arm_tune_xscale && !optimize_size) ++ return 0; ++ + if (unsorted_offsets[order[0]] == 0) + return 1; /* stmia */ + +--- gcc-3.4.0/gcc/genpeep.c.arm-ldm-peephole 2003-07-05 01:27:22.000000000 -0400 ++++ gcc-3.4.0/gcc/genpeep.c 2004-04-24 18:18:04.000000000 -0400 +@@ -381,6 +381,7 @@ + printf ("#include \"recog.h\"\n"); + printf ("#include \"except.h\"\n\n"); + printf ("#include \"function.h\"\n\n"); ++ printf ("#include \"flags.h\"\n\n"); + + printf ("#ifdef HAVE_peephole\n"); + printf ("extern rtx peep_operand[];\n\n"); diff --git a/patches/gcc/3.4.4/601-gcc34-arm-ldm-peephole2.patch b/patches/gcc/3.4.4/601-gcc34-arm-ldm-peephole2.patch new file mode 100644 index 00000000..27f7c07d --- /dev/null +++ b/patches/gcc/3.4.4/601-gcc34-arm-ldm-peephole2.patch @@ -0,0 +1,42 @@ +The 30_all_gcc34-arm-ldm-peephole.patch from Debian was conflicting +with the newer 36_all_pr16201-fix.patch, so i cut out the hunk from +it that was causing problems and grabbed an updated version from +upstream cvs. + +Index: gcc/config/arm/arm.c +=================================================================== +RCS file: /cvsroot/gcc/gcc/gcc/config/arm/arm.c,v +retrieving revision 1.432 +retrieving revision 1.433 +diff -u -r1.432 -r1.433 +--- gcc-3.4.4/gcc/config/arm/arm.c 29 Mar 2005 03:00:23 -0000 1.432 ++++ gcc-3.4.4/gcc/config/arm/arm.c 1 Apr 2005 11:02:22 -0000 1.433 +@@ -5139,6 +5139,10 @@ + int + adjacent_mem_locations (rtx a, rtx b) + { ++ /* We don't guarantee to preserve the order of these memory refs. */ ++ if (volatile_refs_p (a) || volatile_refs_p (b)) ++ return 0; ++ + if ((GET_CODE (XEXP (a, 0)) == REG + || (GET_CODE (XEXP (a, 0)) == PLUS + && GET_CODE (XEXP (XEXP (a, 0), 1)) == CONST_INT)) +@@ -5178,6 +5182,17 @@ + return 0; + + val_diff = val1 - val0; ++ ++ if (arm_ld_sched) ++ { ++ /* If the target has load delay slots, then there's no benefit ++ to using an ldm instruction unless the offset is zero and ++ we are optimizing for size. */ ++ return (optimize_size && (REGNO (reg0) == REGNO (reg1)) ++ && (val0 == 0 || val1 == 0 || val0 == 4 || val1 == 4) ++ && (val_diff == 4 || val_diff == -4)); ++ } ++ + return ((REGNO (reg0) == REGNO (reg1)) + && (val_diff == 4 || val_diff == -4)); + } diff --git a/patches/gcc/3.4.4/601-gcc34-arm-ldm.patch b/patches/gcc/3.4.4/601-gcc34-arm-ldm.patch new file mode 100644 index 00000000..142052fd --- /dev/null +++ b/patches/gcc/3.4.4/601-gcc34-arm-ldm.patch @@ -0,0 +1,119 @@ +--- gcc-3.4.0/gcc/config/arm/arm.c.arm-ldm 2004-02-27 09:51:05.000000000 -0500 ++++ gcc-3.4.0/gcc/config/arm/arm.c 2004-04-24 18:16:25.000000000 -0400 +@@ -8520,6 +8520,26 @@ + return_used_this_function = 0; + } + ++/* Return the number (counting from 0) of ++ the least significant set bit in MASK. */ ++ ++#ifdef __GNUC__ ++inline ++#endif ++static int ++number_of_first_bit_set (mask) ++ int mask; ++{ ++ int bit; ++ ++ for (bit = 0; ++ (mask & (1 << bit)) == 0; ++ ++bit) ++ continue; ++ ++ return bit; ++} ++ + const char * + arm_output_epilogue (rtx sibling) + { +@@ -8753,27 +8773,47 @@ + saved_regs_mask |= (1 << PC_REGNUM); + } + +- /* Load the registers off the stack. If we only have one register +- to load use the LDR instruction - it is faster. */ +- if (saved_regs_mask == (1 << LR_REGNUM)) +- { +- /* The exception handler ignores the LR, so we do +- not really need to load it off the stack. */ +- if (eh_ofs) +- asm_fprintf (f, "\tadd\t%r, %r, #4\n", SP_REGNUM, SP_REGNUM); +- else +- asm_fprintf (f, "\tldr\t%r, [%r], #4\n", LR_REGNUM, SP_REGNUM); +- } +- else if (saved_regs_mask) ++ if (saved_regs_mask) + { +- if (saved_regs_mask & (1 << SP_REGNUM)) +- /* Note - write back to the stack register is not enabled +- (ie "ldmfd sp!..."). We know that the stack pointer is +- in the list of registers and if we add writeback the +- instruction becomes UNPREDICTABLE. */ +- print_multi_reg (f, "ldmfd\t%r", SP_REGNUM, saved_regs_mask); ++ /* Load the registers off the stack. If we only have one register ++ to load use the LDR instruction - it is faster. */ ++ if (bit_count (saved_regs_mask) == 1) ++ { ++ int reg = number_of_first_bit_set (saved_regs_mask); ++ ++ switch (reg) ++ { ++ case SP_REGNUM: ++ /* Mustn't use base writeback when loading SP. */ ++ asm_fprintf (f, "\tldr\t%r, [%r]\n", SP_REGNUM, SP_REGNUM); ++ break; ++ ++ case LR_REGNUM: ++ if (eh_ofs) ++ { ++ /* The exception handler ignores the LR, so we do ++ not really need to load it off the stack. */ ++ asm_fprintf (f, "\tadd\t%r, %r, #4\n", SP_REGNUM, SP_REGNUM); ++ break; ++ } ++ /* else fall through */ ++ ++ default: ++ asm_fprintf (f, "\tldr\t%r, [%r], #4\n", reg, SP_REGNUM); ++ break; ++ } ++ } + else +- print_multi_reg (f, "ldmfd\t%r!", SP_REGNUM, saved_regs_mask); ++ { ++ if (saved_regs_mask & (1 << SP_REGNUM)) ++ /* Note - write back to the stack register is not enabled ++ (ie "ldmfd sp!..."). We know that the stack pointer is ++ in the list of registers and if we add writeback the ++ instruction becomes UNPREDICTABLE. */ ++ print_multi_reg (f, "ldmfd\t%r", SP_REGNUM, saved_regs_mask); ++ else ++ print_multi_reg (f, "ldmfd\t%r!", SP_REGNUM, saved_regs_mask); ++ } + } + + if (current_function_pretend_args_size) +@@ -11401,22 +11441,6 @@ + } + } + +-/* Return the number (counting from 0) of +- the least significant set bit in MASK. */ +- +-inline static int +-number_of_first_bit_set (int mask) +-{ +- int bit; +- +- for (bit = 0; +- (mask & (1 << bit)) == 0; +- ++bit) +- continue; +- +- return bit; +-} +- + /* Generate code to return from a thumb function. + If 'reg_containing_return_addr' is -1, then the return address is + actually on the stack, at the stack pointer. */ diff --git a/patches/gcc/3.4.4/602-sdk-libstdc++-includes.patch b/patches/gcc/3.4.4/602-sdk-libstdc++-includes.patch new file mode 100644 index 00000000..4377c214 --- /dev/null +++ b/patches/gcc/3.4.4/602-sdk-libstdc++-includes.patch @@ -0,0 +1,22 @@ +--- gcc-3.4.1/libstdc++-v3/libmath/Makefile.am~ 2003-08-27 22:29:42.000000000 +0100 ++++ gcc-3.4.1/libstdc++-v3/libmath/Makefile.am 2004-07-22 16:41:45.152130128 +0100 +@@ -32,7 +32,7 @@ + + libmath_la_SOURCES = stubs.c + +-AM_CPPFLAGS = $(CANADIAN_INCLUDES) ++AM_CPPFLAGS = $(CANADIAN_INCLUDES) -I$(toplevel_srcdir)/include + + # Only compiling "C" sources in this directory. + LIBTOOL = @LIBTOOL@ --tag CC +--- gcc-3.4.1/libstdc++-v3/fragment.am.old 2004-07-22 18:24:58.024083656 +0100 ++++ gcc-3.4.1/libstdc++-v3/fragment.am 2004-07-22 18:24:59.019932264 +0100 +@@ -18,7 +18,7 @@ + $(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once + + # -I/-D flags to pass when compiling. +-AM_CPPFLAGS = $(GLIBCXX_INCLUDES) ++AM_CPPFLAGS = $(GLIBCXX_INCLUDES) -I$(toplevel_srcdir)/include + + + diff --git a/patches/gcc/3.4.4/700-pr15068-fix.patch b/patches/gcc/3.4.4/700-pr15068-fix.patch new file mode 100644 index 00000000..2977765c --- /dev/null +++ b/patches/gcc/3.4.4/700-pr15068-fix.patch @@ -0,0 +1,44 @@ +See http://gcc.gnu.org/PR15068 + +Fixes error + +../sysdeps/generic/s_fmax.c: In function `__fmax': +../sysdeps/generic/s_fmax.c:28: internal compiler error: in elim_reg_cond, at flow.c:3257 +Please submit a full bug report, +with preprocessed source if appropriate. +See <URL:http://gcc.gnu.org/bugs.html> for instructions. +make[2]: *** [/home/dank/wk/crosstool-0.28-rc35/build/arm-unknown-linux-gnu/gcc-3.4.1-glibc-20040822/build-glibc/math/s_fmax.o] Error 1 +make[2]: Leaving directory `/home/dank/wk/crosstool-0.28-rc35/build/arm-unknown-linux-gnu/gcc-3.4.1-glibc-20040822/glibc-20040822/math' +make[1]: *** [math/others] Error 2 +make[1]: Leaving directory `/home/dank/wk/crosstool-0.28-rc35/build/arm-unknown-linux-gnu/gcc-3.4.1-glibc-20040822/glibc-20040822' +make: *** [all] Error 2 + +[ rediffed against gcc-3.4.1, with elbow grease, ending up with same thing as +http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/flow.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.563.4.2&r2=1.563.4.3 ] + +--- gcc-3.4.1/gcc/flow.c.old 2004-02-27 19:39:19.000000000 -0800 ++++ gcc-3.4.1/gcc/flow.c 2004-08-26 07:29:46.000000000 -0700 +@@ -1878,6 +1878,7 @@ + rtx set_src = SET_SRC (pc_set (BB_END (bb))); + rtx cond_true = XEXP (set_src, 0); + rtx reg = XEXP (cond_true, 0); ++ enum rtx_code inv_cond; + + if (GET_CODE (reg) == SUBREG) + reg = SUBREG_REG (reg); +@@ -1886,11 +1887,13 @@ + in the form of a comparison of a register against zero. + If the condition is more complex than that, then it is safe + not to record any information. */ +- if (GET_CODE (reg) == REG ++ inv_cond = reversed_comparison_code (cond_true, BB_END (bb)); ++ if (inv_cond != UNKNOWN ++ && GET_CODE (reg) == REG + && XEXP (cond_true, 1) == const0_rtx) + { + rtx cond_false +- = gen_rtx_fmt_ee (reverse_condition (GET_CODE (cond_true)), ++ = gen_rtx_fmt_ee (inv_cond, + GET_MODE (cond_true), XEXP (cond_true, 0), + XEXP (cond_true, 1)); + if (GET_CODE (XEXP (set_src, 1)) == PC) diff --git a/patches/gcc/3.4.4/71_all_sh-pr16665-fix.patch b/patches/gcc/3.4.4/71_all_sh-pr16665-fix.patch new file mode 100644 index 00000000..680bb397 --- /dev/null +++ b/patches/gcc/3.4.4/71_all_sh-pr16665-fix.patch @@ -0,0 +1,43 @@ +--- gcc/gcc/config/sh/sh.c ++++ gcc/gcc/config/sh/sh.c +@@ -9106,6 +9106,15 @@ sh_output_mi_thunk (FILE *file, tree thu + } + this = FUNCTION_ARG (cum, Pmode, ptr_type_node, 1); + ++ /* In PIC case, we set PIC register to compute the target address. We ++ can use a scratch register to save and restore the original value ++ except for SHcompact. For SHcompact, use stack. */ ++ if (flag_pic && TARGET_SHCOMPACT) ++ { ++ push (PIC_OFFSET_TABLE_REGNUM); ++ emit_insn (gen_GOTaddr2picreg ()); ++ } ++ + /* For SHcompact, we only have r0 for a scratch register: r1 is the + static chain pointer (even if you can't have nested virtual functions + right now, someone might implement them sometime), and the rest of the +@@ -9188,8 +9197,24 @@ sh_output_mi_thunk (FILE *file, tree thu + assemble_external (function); + TREE_USED (function) = 1; + } ++ /* We can use scratch1 to save and restore the original value of ++ PIC register except for SHcompact. */ ++ if (flag_pic && ! TARGET_SHCOMPACT) ++ { ++ emit_move_insn (scratch1, ++ gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM)); ++ emit_insn (gen_GOTaddr2picreg ()); ++ } + funexp = XEXP (DECL_RTL (function), 0); + emit_move_insn (scratch2, funexp); ++ if (flag_pic) ++ { ++ if (! TARGET_SHCOMPACT) ++ emit_move_insn (gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM), ++ scratch1); ++ else ++ pop (PIC_OFFSET_TABLE_REGNUM); ++ } + funexp = gen_rtx_MEM (FUNCTION_MODE, scratch2); + sibcall = emit_call_insn (gen_sibcall (funexp, const0_rtx, NULL_RTX)); + SIBLING_CALL_P (sibcall) = 1; diff --git a/patches/gcc/3.4.4/72_all_sh-no-reorder-blocks.patch b/patches/gcc/3.4.4/72_all_sh-no-reorder-blocks.patch new file mode 100644 index 00000000..8b982683 --- /dev/null +++ b/patches/gcc/3.4.4/72_all_sh-no-reorder-blocks.patch @@ -0,0 +1,13 @@ +--- g/gcc/config/sh/sh.h ++++ g/gcc/config/sh/sh.h +@@ -422,6 +422,10 @@ + do { \ + if (LEVEL) \ + flag_omit_frame_pointer = -1; \ ++ if (LEVEL <= 2) \ ++ { \ ++ flag_reorder_blocks = 0; \ ++ } \ + if (SIZE) \ + target_flags |= SPACE_BIT; \ + if (TARGET_SHMEDIA && LEVEL > 1) \ diff --git a/patches/gcc/3.4.4/73_all_sh-pr20617.patch b/patches/gcc/3.4.4/73_all_sh-pr20617.patch new file mode 100644 index 00000000..6d8021cc --- /dev/null +++ b/patches/gcc/3.4.4/73_all_sh-pr20617.patch @@ -0,0 +1,28 @@ +2005-03-24 J"orn Rennecke <joern.rennecke@st.com> + + Band aid for PR target/20617: + * config/sh/lib1funcs.asm (FUNC, ALIAS): Add .hidden directive. + +--- g/gcc/config/sh/lib1funcs.asm ++++ g/gcc/config/sh/lib1funcs.asm +@@ -37,9 +37,19 @@ Boston, MA 02111-1307, USA. */ + ELF local label prefixes by J"orn Rennecke + amylaar@cygnus.com */ + ++#define ALIAS(X,Y) .global GLOBAL(X); .set GLOBAL(X),GLOBAL(Y) ++ + #ifdef __ELF__ + #define LOCAL(X) .L_##X +-#define FUNC(X) .type X,@function ++ ++#if 1 /* ??? The export list mechanism is broken, everything that is not ++ hidden is exported. */ ++#undef FUNC ++#define FUNC(X) .type X,@function; .hidden X ++#undef ALIAS ++#define ALIAS(X,Y) .global GLOBAL(X); .set GLOBAL(X),GLOBAL(Y); .hidden GLOBAL(X) ++#endif ++ + #define ENDFUNC0(X) .Lfe_##X: .size X,.Lfe_##X-X + #define ENDFUNC(X) ENDFUNC0(X) + #else diff --git a/patches/gcc/3.4.4/800-arm-bigendian.patch b/patches/gcc/3.4.4/800-arm-bigendian.patch new file mode 100644 index 00000000..625e3357 --- /dev/null +++ b/patches/gcc/3.4.4/800-arm-bigendian.patch @@ -0,0 +1,66 @@ +diff -dur gcc-3.4.4.orig/gcc/config/arm/linux-elf.h gcc-3.4.4/gcc/config/arm/linux-elf.h +--- gcc-3.4.4.orig/gcc/config/arm/linux-elf.h 2007-02-14 17:44:27.000000000 +0100 ++++ gcc-3.4.4/gcc/config/arm/linux-elf.h 2007-02-14 17:47:32.000000000 +0100 +@@ -30,17 +30,34 @@ + /* Do not assume anything about header files. */ + #define NO_IMPLICIT_EXTERN_C + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END ++#define TARGET_ENDIAN_OPTION "mbig-endian" ++#define TARGET_LINKER_EMULATION "armelfb_linux" ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#define TARGET_ENDIAN_OPTION "mlittle-endian" ++#define TARGET_LINKER_EMULATION "armelf_linux" ++#endif ++ + /* Default is to use APCS-32 mode. */ + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS) ++#define TARGET_DEFAULT \ ++ ( ARM_FLAG_APCS_32 | \ ++ ARM_FLAG_MMU_TRAPS | \ ++ TARGET_ENDIAN_DEFAULT ) + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" } + + #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" + +@@ -94,7 +111,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS() +Only in gcc-3.4.4/gcc/config/arm: linux-elf.h.orig +diff -dur gcc-3.4.4.orig/gcc/config.gcc gcc-3.4.4/gcc/config.gcc +--- gcc-3.4.4.orig/gcc/config.gcc 2007-02-14 17:44:27.000000000 +0100 ++++ gcc-3.4.4/gcc/config.gcc 2007-02-14 17:47:32.000000000 +0100 +@@ -672,6 +672,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + 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" ++ case $target in ++ arm*b-*) ++ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" ++ ;; ++ esac + tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes diff --git a/patches/gcc/3.4.4/800-powerpc-libc_stack_end-uclibc.patch b/patches/gcc/3.4.4/800-powerpc-libc_stack_end-uclibc.patch new file mode 100644 index 00000000..a209470f --- /dev/null +++ b/patches/gcc/3.4.4/800-powerpc-libc_stack_end-uclibc.patch @@ -0,0 +1,15 @@ +--- gcc-3.4.4/gcc/config/rs6000/linux-unwind.h.org 2005-06-23 17:50:34.000000000 -0600 ++++ gcc-3.4.4/gcc/config/rs6000/linux-unwind.h 2005-06-23 17:52:02.000000000 -0600 +@@ -32,6 +32,7 @@ + these structs elsewhere; Many fields are missing, particularly + from the end of the structures. */ + ++#ifndef inhibit_libc + struct gcc_vregs + { + __attribute__ ((vector_size (16))) int vr[32]; +@@ -320,3 +321,4 @@ + \ + goto SUCCESS; \ + } while (0) ++#endif diff --git a/patches/gcc/3.4.4/830-gcc-bug-num-22167.patch b/patches/gcc/3.4.4/830-gcc-bug-num-22167.patch new file mode 100644 index 00000000..c7419af9 --- /dev/null +++ b/patches/gcc/3.4.4/830-gcc-bug-num-22167.patch @@ -0,0 +1,16 @@ +Index: gcc/gcse.c +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/gcse.c,v +retrieving revision 1.288.2.9 +diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.288.2.9 gcse.c +--- gcc/gcc/gcse.c 30 Oct 2004 18:02:53 -0000 1.288.2.9 ++++ gcc/gcc/gcse.c 14 Jul 2005 13:19:57 -0000 +@@ -6445,7 +6445,7 @@ hoist_code (void) + insn_inserted_p = 0; + + /* These tests should be the same as the tests above. */ +- if (TEST_BIT (hoist_vbeout[bb->index], i)) ++ if (TEST_BIT (hoist_exprs[bb->index], i)) + { + /* We've found a potentially hoistable expression, now + we look at every block BB dominates to see if it diff --git a/patches/gcc/3.4.4/900-nios2.patch b/patches/gcc/3.4.4/900-nios2.patch new file mode 100644 index 00000000..bfa06a21 --- /dev/null +++ b/patches/gcc/3.4.4/900-nios2.patch @@ -0,0 +1,10211 @@ +--- gcc-3.4.3/gcc/Makefile.in ++++ gcc-3.4.3-nios2/gcc/Makefile.in +@@ -3085,7 +3085,7 @@ install-mkheaders: stmp-int-hdrs $(STMP_ + $(INSTALL_DATA) $(srcdir)/README-fixinc \ + $(DESTDIR)$(itoolsdatadir)/include/README ; \ + $(INSTALL_SCRIPT) fixinc.sh $(DESTDIR)$(itoolsdir)/fixinc.sh ; \ +- $(INSTALL_PROGRAM) fixinc/fixincl $(DESTDIR)$(itoolsdir)/fixincl ; \ ++ $(INSTALL_PROGRAM) fixinc/fixincl$(build_exeext) $(DESTDIR)$(itoolsdir)/fixincl$(build_exeext) ; \ + $(INSTALL_DATA) $(srcdir)/gsyslimits.h \ + $(DESTDIR)$(itoolsdatadir)/gsyslimits.h ; \ + else :; fi +--- gcc-3.4.3/gcc/combine.c ++++ gcc-3.4.3-nios2/gcc/combine.c +@@ -4380,6 +4380,14 @@ combine_simplify_rtx (rtx x, enum machin + mode); + } + ++#ifndef __nios2__ ++/* This screws up Nios II in this test case: ++ ++if (x & 1) ++ return 2; ++else ++ return 3; ++*/ + else if (STORE_FLAG_VALUE == 1 + && new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT + && op1 == const0_rtx +@@ -4391,6 +4399,7 @@ combine_simplify_rtx (rtx x, enum machin + gen_lowpart_for_combine (mode, op0), + const1_rtx); + } ++#endif + + else if (STORE_FLAG_VALUE == 1 + && new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT +--- gcc-3.4.3/gcc/config/nios2/crti.asm ++++ gcc-3.4.3-nios2/gcc/config/nios2/crti.asm +@@ -0,0 +1,88 @@ ++/* ++ Copyright (C) 2003 ++ by Jonah Graham (jgraham@altera.com) ++ ++This file is free software; you can redistribute it and/or modify it ++under the terms of the GNU General Public License as published by the ++Free Software Foundation; either version 2, or (at your option) any ++later version. ++ ++In addition to the permissions in the GNU General Public License, the ++Free Software Foundation gives you unlimited permission to link the ++compiled version of this file with other programs, and to distribute ++those programs without any restriction coming from the use of this ++file. (The General Public License restrictions do apply in other ++respects; for example, they cover modification of the file, and ++distribution when not linked into another program.) ++ ++This file is distributed in the hope that it will be useful, but ++WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with this program; see the file COPYING. If not, write to ++the Free Software Foundation, 59 Temple Place - Suite 330, ++Boston, MA 02111-1307, USA. ++ ++ As a special exception, if you link this library with files ++ compiled with GCC to produce an executable, this does not cause ++ the resulting executable to be covered by the GNU General Public License. ++ This exception does not however invalidate any other reasons why ++ the executable file might be covered by the GNU General Public License. ++ ++ ++This file just make a stack frame for the contents of the .fini and ++.init sections. Users may put any desired instructions in those ++sections. ++ ++ ++While technically any code can be put in the init and fini sections ++most stuff will not work other than stuff which obeys the call frame ++and ABI. All the call-preserved registers are saved, the call clobbered ++registers should have been saved by the code calling init and fini. ++ ++See crtstuff.c for an example of code that inserts itself in the ++init and fini sections. ++ ++See crt0.s for the code that calls init and fini. ++*/ ++ ++ .file "crti.asm" ++ ++ .section ".init" ++ .align 2 ++ .global _init ++_init: ++ addi sp, sp, -48 ++ stw ra, 44(sp) ++ stw r23, 40(sp) ++ stw r22, 36(sp) ++ stw r21, 32(sp) ++ stw r20, 28(sp) ++ stw r19, 24(sp) ++ stw r18, 20(sp) ++ stw r17, 16(sp) ++ stw r16, 12(sp) ++ stw fp, 8(sp) ++ mov fp, sp ++ ++ ++ .section ".fini" ++ .align 2 ++ .global _fini ++_fini: ++ addi sp, sp, -48 ++ stw ra, 44(sp) ++ stw r23, 40(sp) ++ stw r22, 36(sp) ++ stw r21, 32(sp) ++ stw r20, 28(sp) ++ stw r19, 24(sp) ++ stw r18, 20(sp) ++ stw r17, 16(sp) ++ stw r16, 12(sp) ++ stw fp, 8(sp) ++ mov fp, sp ++ ++ +--- gcc-3.4.3/gcc/config/nios2/crtn.asm ++++ gcc-3.4.3-nios2/gcc/config/nios2/crtn.asm +@@ -0,0 +1,70 @@ ++/* ++ Copyright (C) 2003 ++ by Jonah Graham (jgraham@altera.com) ++ ++This file is free software; you can redistribute it and/or modify it ++under the terms of the GNU General Public License as published by the ++Free Software Foundation; either version 2, or (at your option) any ++later version. ++ ++In addition to the permissions in the GNU General Public License, the ++Free Software Foundation gives you unlimited permission to link the ++compiled version of this file with other programs, and to distribute ++those programs without any restriction coming from the use of this ++file. (The General Public License restrictions do apply in other ++respects; for example, they cover modification of the file, and ++distribution when not linked into another program.) ++ ++This file is distributed in the hope that it will be useful, but ++WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with this program; see the file COPYING. If not, write to ++the Free Software Foundation, 59 Temple Place - Suite 330, ++Boston, MA 02111-1307, USA. ++ ++ As a special exception, if you link this library with files ++ compiled with GCC to produce an executable, this does not cause ++ the resulting executable to be covered by the GNU General Public License. ++ This exception does not however invalidate any other reasons why ++ the executable file might be covered by the GNU General Public License. ++ ++ ++This file just makes sure that the .fini and .init sections do in ++fact return. Users may put any desired instructions in those sections. ++This file is the last thing linked into any executable. ++*/ ++ .file "crtn.asm" ++ ++ ++ ++ .section ".init" ++ ldw ra, 44(sp) ++ ldw r23, 40(sp) ++ ldw r22, 36(sp) ++ ldw r21, 32(sp) ++ ldw r20, 28(sp) ++ ldw r19, 24(sp) ++ ldw r18, 20(sp) ++ ldw r17, 16(sp) ++ ldw r16, 12(sp) ++ ldw fp, 8(sp) ++ addi sp, sp, -48 ++ ret ++ ++ .section ".fini" ++ ldw ra, 44(sp) ++ ldw r23, 40(sp) ++ ldw r22, 36(sp) ++ ldw r21, 32(sp) ++ ldw r20, 28(sp) ++ ldw r19, 24(sp) ++ ldw r18, 20(sp) ++ ldw r17, 16(sp) ++ ldw r16, 12(sp) ++ ldw fp, 8(sp) ++ addi sp, sp, -48 ++ ret ++ +--- gcc-3.4.3/gcc/config/nios2/lib2-divmod-hi.c ++++ gcc-3.4.3-nios2/gcc/config/nios2/lib2-divmod-hi.c +@@ -0,0 +1,123 @@ ++ ++/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is ++ supposedly valid even though this is a "target" file. */ ++#include "auto-host.h" ++ ++ ++#include "tconfig.h" ++#include "tsystem.h" ++#include "coretypes.h" ++#include "tm.h" ++ ++ ++/* Don't use `fancy_abort' here even if config.h says to use it. */ ++#ifdef abort ++#undef abort ++#endif ++ ++ ++#ifdef HAVE_GAS_HIDDEN ++#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden"))) ++#else ++#define ATTRIBUTE_HIDDEN ++#endif ++ ++#include "libgcc2.h" ++ ++extern HItype __modhi3 (HItype, HItype); ++extern HItype __divhi3 (HItype, HItype); ++extern HItype __umodhi3 (HItype, HItype); ++extern HItype __udivhi3 (HItype, HItype); ++ ++static UHItype udivmodhi4(UHItype, UHItype, word_type); ++ ++static UHItype ++udivmodhi4(UHItype num, UHItype den, word_type modwanted) ++{ ++ UHItype bit = 1; ++ UHItype res = 0; ++ ++ while (den < num && bit && !(den & (1L<<15))) ++ { ++ den <<=1; ++ bit <<=1; ++ } ++ while (bit) ++ { ++ if (num >= den) ++ { ++ num -= den; ++ res |= bit; ++ } ++ bit >>=1; ++ den >>=1; ++ } ++ if (modwanted) return num; ++ return res; ++} ++ ++ ++HItype ++__divhi3 (HItype a, HItype b) ++{ ++ word_type neg = 0; ++ HItype res; ++ ++ if (a < 0) ++ { ++ a = -a; ++ neg = !neg; ++ } ++ ++ if (b < 0) ++ { ++ b = -b; ++ neg = !neg; ++ } ++ ++ res = udivmodhi4 (a, b, 0); ++ ++ if (neg) ++ res = -res; ++ ++ return res; ++} ++ ++ ++HItype ++__modhi3 (HItype a, HItype b) ++{ ++ word_type neg = 0; ++ HItype res; ++ ++ if (a < 0) ++ { ++ a = -a; ++ neg = 1; ++ } ++ ++ if (b < 0) ++ b = -b; ++ ++ res = udivmodhi4 (a, b, 1); ++ ++ if (neg) ++ res = -res; ++ ++ return res; ++} ++ ++ ++HItype ++__udivhi3 (HItype a, HItype b) ++{ ++ return udivmodhi4 (a, b, 0); ++} ++ ++ ++HItype ++__umodhi3 (HItype a, HItype b) ++{ ++ return udivmodhi4 (a, b, 1); ++} ++ +--- gcc-3.4.3/gcc/config/nios2/lib2-divmod.c ++++ gcc-3.4.3-nios2/gcc/config/nios2/lib2-divmod.c +@@ -0,0 +1,126 @@ ++ ++/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is ++ supposedly valid even though this is a "target" file. */ ++#include "auto-host.h" ++ ++ ++#include "tconfig.h" ++#include "tsystem.h" ++#include "coretypes.h" ++#include "tm.h" ++ ++ ++/* Don't use `fancy_abort' here even if config.h says to use it. */ ++#ifdef abort ++#undef abort ++#endif ++ ++ ++#ifdef HAVE_GAS_HIDDEN ++#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden"))) ++#else ++#define ATTRIBUTE_HIDDEN ++#endif ++ ++#include "libgcc2.h" ++ ++extern SItype __modsi3 (SItype, SItype); ++extern SItype __divsi3 (SItype, SItype); ++extern SItype __umodsi3 (SItype, SItype); ++extern SItype __udivsi3 (SItype, SItype); ++ ++static USItype udivmodsi4(USItype, USItype, word_type); ++ ++/* 16-bit SI divide and modulo as used in NIOS */ ++ ++ ++static USItype ++udivmodsi4(USItype num, USItype den, word_type modwanted) ++{ ++ USItype bit = 1; ++ USItype res = 0; ++ ++ while (den < num && bit && !(den & (1L<<31))) ++ { ++ den <<=1; ++ bit <<=1; ++ } ++ while (bit) ++ { ++ if (num >= den) ++ { ++ num -= den; ++ res |= bit; ++ } ++ bit >>=1; ++ den >>=1; ++ } ++ if (modwanted) return num; ++ return res; ++} ++ ++ ++SItype ++__divsi3 (SItype a, SItype b) ++{ ++ word_type neg = 0; ++ SItype res; ++ ++ if (a < 0) ++ { ++ a = -a; ++ neg = !neg; ++ } ++ ++ if (b < 0) ++ { ++ b = -b; ++ neg = !neg; ++ } ++ ++ res = udivmodsi4 (a, b, 0); ++ ++ if (neg) ++ res = -res; ++ ++ return res; ++} ++ ++ ++SItype ++__modsi3 (SItype a, SItype b) ++{ ++ word_type neg = 0; ++ SItype res; ++ ++ if (a < 0) ++ { ++ a = -a; ++ neg = 1; ++ } ++ ++ if (b < 0) ++ b = -b; ++ ++ res = udivmodsi4 (a, b, 1); ++ ++ if (neg) ++ res = -res; ++ ++ return res; ++} ++ ++ ++SItype ++__udivsi3 (SItype a, SItype b) ++{ ++ return udivmodsi4 (a, b, 0); ++} ++ ++ ++SItype ++__umodsi3 (SItype a, SItype b) ++{ ++ return udivmodsi4 (a, b, 1); ++} ++ +--- gcc-3.4.3/gcc/config/nios2/lib2-divtable.c ++++ gcc-3.4.3-nios2/gcc/config/nios2/lib2-divtable.c +@@ -0,0 +1,46 @@ ++ ++/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is ++ supposedly valid even though this is a "target" file. */ ++#include "auto-host.h" ++ ++ ++#include "tconfig.h" ++#include "tsystem.h" ++#include "coretypes.h" ++#include "tm.h" ++ ++ ++/* Don't use `fancy_abort' here even if config.h says to use it. */ ++#ifdef abort ++#undef abort ++#endif ++ ++ ++#ifdef HAVE_GAS_HIDDEN ++#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden"))) ++#else ++#define ATTRIBUTE_HIDDEN ++#endif ++ ++#include "libgcc2.h" ++ ++UQItype __divsi3_table[] = ++{ ++ 0, 0/1, 0/2, 0/3, 0/4, 0/5, 0/6, 0/7, 0/8, 0/9, 0/10, 0/11, 0/12, 0/13, 0/14, 0/15, ++ 0, 1/1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10, 1/11, 1/12, 1/13, 1/14, 1/15, ++ 0, 2/1, 2/2, 2/3, 2/4, 2/5, 2/6, 2/7, 2/8, 2/9, 2/10, 2/11, 2/12, 2/13, 2/14, 2/15, ++ 0, 3/1, 3/2, 3/3, 3/4, 3/5, 3/6, 3/7, 3/8, 3/9, 3/10, 3/11, 3/12, 3/13, 3/14, 3/15, ++ 0, 4/1, 4/2, 4/3, 4/4, 4/5, 4/6, 4/7, 4/8, 4/9, 4/10, 4/11, 4/12, 4/13, 4/14, 4/15, ++ 0, 5/1, 5/2, 5/3, 5/4, 5/5, 5/6, 5/7, 5/8, 5/9, 5/10, 5/11, 5/12, 5/13, 5/14, 5/15, ++ 0, 6/1, 6/2, 6/3, 6/4, 6/5, 6/6, 6/7, 6/8, 6/9, 6/10, 6/11, 6/12, 6/13, 6/14, 6/15, ++ 0, 7/1, 7/2, 7/3, 7/4, 7/5, 7/6, 7/7, 7/8, 7/9, 7/10, 7/11, 7/12, 7/13, 7/14, 7/15, ++ 0, 8/1, 8/2, 8/3, 8/4, 8/5, 8/6, 8/7, 8/8, 8/9, 8/10, 8/11, 8/12, 8/13, 8/14, 8/15, ++ 0, 9/1, 9/2, 9/3, 9/4, 9/5, 9/6, 9/7, 9/8, 9/9, 9/10, 9/11, 9/12, 9/13, 9/14, 9/15, ++ 0, 10/1, 10/2, 10/3, 10/4, 10/5, 10/6, 10/7, 10/8, 10/9, 10/10, 10/11, 10/12, 10/13, 10/14, 10/15, ++ 0, 11/1, 11/2, 11/3, 11/4, 11/5, 11/6, 11/7, 11/8, 11/9, 11/10, 11/11, 11/12, 11/13, 11/14, 11/15, ++ 0, 12/1, 12/2, 12/3, 12/4, 12/5, 12/6, 12/7, 12/8, 12/9, 12/10, 12/11, 12/12, 12/13, 12/14, 12/15, ++ 0, 13/1, 13/2, 13/3, 13/4, 13/5, 13/6, 13/7, 13/8, 13/9, 13/10, 13/11, 13/12, 13/13, 13/14, 13/15, ++ 0, 14/1, 14/2, 14/3, 14/4, 14/5, 14/6, 14/7, 14/8, 14/9, 14/10, 14/11, 14/12, 14/13, 14/14, 14/15, ++ 0, 15/1, 15/2, 15/3, 15/4, 15/5, 15/6, 15/7, 15/8, 15/9, 15/10, 15/11, 15/12, 15/13, 15/14, 15/15, ++}; ++ +--- gcc-3.4.3/gcc/config/nios2/lib2-mul.c ++++ gcc-3.4.3-nios2/gcc/config/nios2/lib2-mul.c +@@ -0,0 +1,103 @@ ++/* while we are debugging (ie compile outside of gcc build) ++ disable gcc specific headers */ ++#ifndef DEBUG_MULSI3 ++ ++ ++/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is ++ supposedly valid even though this is a "target" file. */ ++#include "auto-host.h" ++ ++ ++#include "tconfig.h" ++#include "tsystem.h" ++#include "coretypes.h" ++#include "tm.h" ++ ++ ++/* Don't use `fancy_abort' here even if config.h says to use it. */ ++#ifdef abort ++#undef abort ++#endif ++ ++ ++#ifdef HAVE_GAS_HIDDEN ++#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden"))) ++#else ++#define ATTRIBUTE_HIDDEN ++#endif ++ ++#include "libgcc2.h" ++ ++#else ++#define SItype int ++#define USItype unsigned int ++#endif ++ ++ ++extern SItype __mulsi3 (SItype, SItype); ++ ++SItype ++__mulsi3 (SItype a, SItype b) ++{ ++ SItype res = 0; ++ USItype cnt = a; ++ ++ while (cnt) ++ { ++ if (cnt & 1) ++ { ++ res += b; ++ } ++ b <<= 1; ++ cnt >>= 1; ++ } ++ ++ return res; ++} ++/* ++TODO: Choose best alternative implementation. ++ ++SItype ++__divsi3 (SItype a, SItype b) ++{ ++ SItype res = 0; ++ USItype cnt = 0; ++ ++ while (cnt < 32) ++ { ++ if (a & (1L << cnt)) ++ { ++ res += b; ++ } ++ b <<= 1; ++ cnt++; ++ } ++ ++ return res; ++} ++*/ ++ ++ ++#ifdef DEBUG_MULSI3 ++ ++int ++main () ++{ ++ int i, j; ++ int error = 0; ++ ++ for (i = -1000; i < 1000; i++) ++ for (j = -1000; j < 1000; j++) ++ { ++ int expect = i * j; ++ int actual = A__divsi3 (i, j); ++ if (expect != actual) ++ { ++ printf ("error: %d * %d = %d not %d\n", i, j, expect, actual); ++ error = 1; ++ } ++ } ++ ++ return error; ++} ++#endif +--- gcc-3.4.3/gcc/config/nios2/nios2-dp-bit.c ++++ gcc-3.4.3-nios2/gcc/config/nios2/nios2-dp-bit.c +@@ -0,0 +1,1652 @@ ++ ++/* This is a software floating point library which can be used ++ for targets without hardware floating point. ++ Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004 ++ Free Software Foundation, Inc. ++ ++This file is free software; you can redistribute it and/or modify it ++under the terms of the GNU General Public License as published by the ++Free Software Foundation; either version 2, or (at your option) any ++later version. ++ ++In addition to the permissions in the GNU General Public License, the ++Free Software Foundation gives you unlimited permission to link the ++compiled version of this file with other programs, and to distribute ++those programs without any restriction coming from the use of this ++file. (The General Public License restrictions do apply in other ++respects; for example, they cover modification of the file, and ++distribution when not linked into another program.) ++ ++This file is distributed in the hope that it will be useful, but ++WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with this program; see the file COPYING. If not, write to ++the Free Software Foundation, 59 Temple Place - Suite 330, ++Boston, MA 02111-1307, USA. */ ++ ++/* As a special exception, if you link this library with other files, ++ some of which are compiled with GCC, to produce an executable, ++ this library does not by itself cause the resulting executable ++ to be covered by the GNU General Public License. ++ This exception does not however invalidate any other reasons why ++ the executable file might be covered by the GNU General Public License. */ ++ ++/* This implements IEEE 754 format arithmetic, but does not provide a ++ mechanism for setting the rounding mode, or for generating or handling ++ exceptions. ++ ++ The original code by Steve Chamberlain, hacked by Mark Eichin and Jim ++ Wilson, all of Cygnus Support. */ ++ ++/* The intended way to use this file is to make two copies, add `#define FLOAT' ++ to one copy, then compile both copies and add them to libgcc.a. */ ++ ++#include "tconfig.h" ++#include "coretypes.h" ++#include "tm.h" ++#include "config/fp-bit.h" ++ ++/* The following macros can be defined to change the behavior of this file: ++ FLOAT: Implement a `float', aka SFmode, fp library. If this is not ++ defined, then this file implements a `double', aka DFmode, fp library. ++ FLOAT_ONLY: Used with FLOAT, to implement a `float' only library, i.e. ++ don't include float->double conversion which requires the double library. ++ This is useful only for machines which can't support doubles, e.g. some ++ 8-bit processors. ++ CMPtype: Specify the type that floating point compares should return. ++ This defaults to SItype, aka int. ++ US_SOFTWARE_GOFAST: This makes all entry points use the same names as the ++ US Software goFast library. ++ _DEBUG_BITFLOAT: This makes debugging the code a little easier, by adding ++ two integers to the FLO_union_type. ++ NO_DENORMALS: Disable handling of denormals. ++ NO_NANS: Disable nan and infinity handling ++ SMALL_MACHINE: Useful when operations on QIs and HIs are faster ++ than on an SI */ ++ ++/* We don't currently support extended floats (long doubles) on machines ++ without hardware to deal with them. ++ ++ These stubs are just to keep the linker from complaining about unresolved ++ references which can be pulled in from libio & libstdc++, even if the ++ user isn't using long doubles. However, they may generate an unresolved ++ external to abort if abort is not used by the function, and the stubs ++ are referenced from within libc, since libgcc goes before and after the ++ system library. */ ++ ++#ifdef DECLARE_LIBRARY_RENAMES ++ DECLARE_LIBRARY_RENAMES ++#endif ++ ++#ifdef EXTENDED_FLOAT_STUBS ++extern void abort (void); ++void __extendsfxf2 (void) { abort(); } ++void __extenddfxf2 (void) { abort(); } ++void __truncxfdf2 (void) { abort(); } ++void __truncxfsf2 (void) { abort(); } ++void __fixxfsi (void) { abort(); } ++void __floatsixf (void) { abort(); } ++void __addxf3 (void) { abort(); } ++void __subxf3 (void) { abort(); } ++void __mulxf3 (void) { abort(); } ++void __divxf3 (void) { abort(); } ++void __negxf2 (void) { abort(); } ++void __eqxf2 (void) { abort(); } ++void __nexf2 (void) { abort(); } ++void __gtxf2 (void) { abort(); } ++void __gexf2 (void) { abort(); } ++void __lexf2 (void) { abort(); } ++void __ltxf2 (void) { abort(); } ++ ++void __extendsftf2 (void) { abort(); } ++void __extenddftf2 (void) { abort(); } ++void __trunctfdf2 (void) { abort(); } ++void __trunctfsf2 (void) { abort(); } ++void __fixtfsi (void) { abort(); } ++void __floatsitf (void) { abort(); } ++void __addtf3 (void) { abort(); } ++void __subtf3 (void) { abort(); } ++void __multf3 (void) { abort(); } ++void __divtf3 (void) { abort(); } ++void __negtf2 (void) { abort(); } ++void __eqtf2 (void) { abort(); } ++void __netf2 (void) { abort(); } ++void __gttf2 (void) { abort(); } ++void __getf2 (void) { abort(); } ++void __letf2 (void) { abort(); } ++void __lttf2 (void) { abort(); } ++#else /* !EXTENDED_FLOAT_STUBS, rest of file */ ++ ++/* IEEE "special" number predicates */ ++ ++#ifdef NO_NANS ++ ++#define nan() 0 ++#define isnan(x) 0 ++#define isinf(x) 0 ++#else ++ ++#if defined L_thenan_sf ++const fp_number_type __thenan_sf = { CLASS_SNAN, 0, 0, {(fractype) 0} }; ++#elif defined L_thenan_df ++const fp_number_type __thenan_df = { CLASS_SNAN, 0, 0, {(fractype) 0} }; ++#elif defined L_thenan_tf ++const fp_number_type __thenan_tf = { CLASS_SNAN, 0, 0, {(fractype) 0} }; ++#elif defined TFLOAT ++extern const fp_number_type __thenan_tf; ++#elif defined FLOAT ++extern const fp_number_type __thenan_sf; ++#else ++extern const fp_number_type __thenan_df; ++#endif ++ ++INLINE ++static fp_number_type * ++nan (void) ++{ ++ /* Discard the const qualifier... */ ++#ifdef TFLOAT ++ return (fp_number_type *) (& __thenan_tf); ++#elif defined FLOAT ++ return (fp_number_type *) (& __thenan_sf); ++#else ++ return (fp_number_type *) (& __thenan_df); ++#endif ++} ++ ++INLINE ++static int ++isnan ( fp_number_type * x) ++{ ++ return x->class == CLASS_SNAN || x->class == CLASS_QNAN; ++} ++ ++INLINE ++static int ++isinf ( fp_number_type * x) ++{ ++ return x->class == CLASS_INFINITY; ++} ++ ++#endif /* NO_NANS */ ++ ++INLINE ++static int ++iszero ( fp_number_type * x) ++{ ++ return x->class == CLASS_ZERO; ++} ++ ++INLINE ++static void ++flip_sign ( fp_number_type * x) ++{ ++ x->sign = !x->sign; ++} ++ ++extern FLO_type pack_d ( fp_number_type * ); ++ ++#if defined(L_pack_df) || defined(L_pack_sf) || defined(L_pack_tf) ++FLO_type ++pack_d ( fp_number_type * src) ++{ ++ FLO_union_type dst; ++ fractype fraction = src->fraction.ll; /* wasn't unsigned before? */ ++ int sign = src->sign; ++ int exp = 0; ++ ++ if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && (isnan (src) || isinf (src))) ++ { ++ /* We can't represent these values accurately. By using the ++ largest possible magnitude, we guarantee that the conversion ++ of infinity is at least as big as any finite number. */ ++ exp = EXPMAX; ++ fraction = ((fractype) 1 << FRACBITS) - 1; ++ } ++ else if (isnan (src)) ++ { ++ exp = EXPMAX; ++ if (src->class == CLASS_QNAN || 1) ++ { ++#ifdef QUIET_NAN_NEGATED ++ fraction |= QUIET_NAN - 1; ++#else ++ fraction |= QUIET_NAN; ++#endif ++ } ++ } ++ else if (isinf (src)) ++ { ++ exp = EXPMAX; ++ fraction = 0; ++ } ++ else if (iszero (src)) ++ { ++ exp = 0; ++ fraction = 0; ++ } ++ else if (fraction == 0) ++ { ++ exp = 0; ++ } ++ else ++ { ++ if (src->normal_exp < NORMAL_EXPMIN) ++ { ++#ifdef NO_DENORMALS ++ /* Go straight to a zero representation if denormals are not ++ supported. The denormal handling would be harmless but ++ isn't unnecessary. */ ++ exp = 0; ++ fraction = 0; ++#else /* NO_DENORMALS */ ++ /* This number's exponent is too low to fit into the bits ++ available in the number, so we'll store 0 in the exponent and ++ shift the fraction to the right to make up for it. */ ++ ++ int shift = NORMAL_EXPMIN - src->normal_exp; ++ ++ exp = 0; ++ ++ if (shift > FRAC_NBITS - NGARDS) ++ { ++ /* No point shifting, since it's more that 64 out. */ ++ fraction = 0; ++ } ++ else ++ { ++ int lowbit = (fraction & (((fractype)1 << shift) - 1)) ? 1 : 0; ++ fraction = (fraction >> shift) | lowbit; ++ } ++ if ((fraction & GARDMASK) == GARDMSB) ++ { ++ if ((fraction & (1 << NGARDS))) ++ fraction += GARDROUND + 1; ++ } ++ else ++ { ++ /* Add to the guards to round up. */ ++ fraction += GARDROUND; ++ } ++ /* Perhaps the rounding means we now need to change the ++ exponent, because the fraction is no longer denormal. */ ++ if (fraction >= IMPLICIT_1) ++ { ++ exp += 1; ++ } ++ fraction >>= NGARDS; ++#endif /* NO_DENORMALS */ ++ } ++ else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) ++ && src->normal_exp > EXPBIAS) ++ { ++ exp = EXPMAX; ++ fraction = 0; ++ } ++ else ++ { ++ exp = src->normal_exp + EXPBIAS; ++ if (!ROUND_TOWARDS_ZERO) ++ { ++ /* IF the gard bits are the all zero, but the first, then we're ++ half way between two numbers, choose the one which makes the ++ lsb of the answer 0. */ ++ if ((fraction & GARDMASK) == GARDMSB) ++ { ++ if (fraction & (1 << NGARDS)) ++ fraction += GARDROUND + 1; ++ } ++ else ++ { ++ /* Add a one to the guards to round up */ ++ fraction += GARDROUND; ++ } ++ if (fraction >= IMPLICIT_2) ++ { ++ fraction >>= 1; ++ exp += 1; ++ } ++ } ++ fraction >>= NGARDS; ++ ++ if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && exp > EXPMAX) ++ { ++ /* Saturate on overflow. */ ++ exp = EXPMAX; ++ fraction = ((fractype) 1 << FRACBITS) - 1; ++ } ++ } ++ } ++ ++ /* We previously used bitfields to store the number, but this doesn't ++ handle little/big endian systems conveniently, so use shifts and ++ masks */ ++#ifdef FLOAT_BIT_ORDER_MISMATCH ++ dst.bits.fraction = fraction; ++ dst.bits.exp = exp; ++ dst.bits.sign = sign; ++#else ++# if defined TFLOAT && defined HALFFRACBITS ++ { ++ halffractype high, low, unity; ++ int lowsign, lowexp; ++ ++ unity = (halffractype) 1 << HALFFRACBITS; ++ ++ /* Set HIGH to the high double's significand, masking out the implicit 1. ++ Set LOW to the low double's full significand. */ ++ high = (fraction >> (FRACBITS - HALFFRACBITS)) & (unity - 1); ++ low = fraction & (unity * 2 - 1); ++ ++ /* Get the initial sign and exponent of the low double. */ ++ lowexp = exp - HALFFRACBITS - 1; ++ lowsign = sign; ++ ++ /* HIGH should be rounded like a normal double, making |LOW| <= ++ 0.5 ULP of HIGH. Assume round-to-nearest. */ ++ if (exp < EXPMAX) ++ if (low > unity || (low == unity && (high & 1) == 1)) ++ { ++ /* Round HIGH up and adjust LOW to match. */ ++ high++; ++ if (high == unity) ++ { ++ /* May make it infinite, but that's OK. */ ++ high = 0; ++ exp++; ++ } ++ low = unity * 2 - low; ++ lowsign ^= 1; ++ } ++ ++ high |= (halffractype) exp << HALFFRACBITS; ++ high |= (halffractype) sign << (HALFFRACBITS + EXPBITS); ++ ++ if (exp == EXPMAX || exp == 0 || low == 0) ++ low = 0; ++ else ++ { ++ while (lowexp > 0 && low < unity) ++ { ++ low <<= 1; ++ lowexp--; ++ } ++ ++ if (lowexp <= 0) ++ { ++ halffractype roundmsb, round; ++ int shift; ++ ++ shift = 1 - lowexp; ++ roundmsb = (1 << (shift - 1)); ++ round = low & ((roundmsb << 1) - 1); ++ ++ low >>= shift; ++ lowexp = 0; ++ ++ if (round > roundmsb || (round == roundmsb && (low & 1) == 1)) ++ { ++ low++; ++ if (low == unity) ++ /* LOW rounds up to the smallest normal number. */ ++ lowexp++; ++ } ++ } ++ ++ low &= unity - 1; ++ low |= (halffractype) lowexp << HALFFRACBITS; ++ low |= (halffractype) lowsign << (HALFFRACBITS + EXPBITS); ++ } ++ dst.value_raw = ((fractype) high << HALFSHIFT) | low; ++ } ++# else ++ dst.value_raw = fraction & ((((fractype)1) << FRACBITS) - (fractype)1); ++ dst.value_raw |= ((fractype) (exp & ((1 << EXPBITS) - 1))) << FRACBITS; ++ dst.value_raw |= ((fractype) (sign & 1)) << (FRACBITS | EXPBITS); ++# endif ++#endif ++ ++#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT) ++#ifdef TFLOAT ++ { ++ qrtrfractype tmp1 = dst.words[0]; ++ qrtrfractype tmp2 = dst.words[1]; ++ dst.words[0] = dst.words[3]; ++ dst.words[1] = dst.words[2]; ++ dst.words[2] = tmp2; ++ dst.words[3] = tmp1; ++ } ++#else ++ { ++ halffractype tmp = dst.words[0]; ++ dst.words[0] = dst.words[1]; ++ dst.words[1] = tmp; ++ } ++#endif ++#endif ++ ++ return dst.value; ++} ++#endif ++ ++#if defined(L_unpack_df) || defined(L_unpack_sf) || defined(L_unpack_tf) ++void ++unpack_d (FLO_union_type * src, fp_number_type * dst) ++{ ++ /* We previously used bitfields to store the number, but this doesn't ++ handle little/big endian systems conveniently, so use shifts and ++ masks */ ++ fractype fraction; ++ int exp; ++ int sign; ++ ++#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT) ++ FLO_union_type swapped; ++ ++#ifdef TFLOAT ++ swapped.words[0] = src->words[3]; ++ swapped.words[1] = src->words[2]; ++ swapped.words[2] = src->words[1]; ++ swapped.words[3] = src->words[0]; ++#else ++ swapped.words[0] = src->words[1]; ++ swapped.words[1] = src->words[0]; ++#endif ++ src = &swapped; ++#endif ++ ++#ifdef FLOAT_BIT_ORDER_MISMATCH ++ fraction = src->bits.fraction; ++ exp = src->bits.exp; ++ sign = src->bits.sign; ++#else ++# if defined TFLOAT && defined HALFFRACBITS ++ { ++ halffractype high, low; ++ ++ high = src->value_raw >> HALFSHIFT; ++ low = src->value_raw & (((fractype)1 << HALFSHIFT) - 1); ++ ++ fraction = high & ((((fractype)1) << HALFFRACBITS) - 1); ++ fraction <<= FRACBITS - HALFFRACBITS; ++ exp = ((int)(high >> HALFFRACBITS)) & ((1 << EXPBITS) - 1); ++ sign = ((int)(high >> (((HALFFRACBITS + EXPBITS))))) & 1; ++ ++ if (exp != EXPMAX && exp != 0 && low != 0) ++ { ++ int lowexp = ((int)(low >> HALFFRACBITS)) & ((1 << EXPBITS) - 1); ++ int lowsign = ((int)(low >> (((HALFFRACBITS + EXPBITS))))) & 1; ++ int shift; ++ fractype xlow; ++ ++ xlow = low & ((((fractype)1) << HALFFRACBITS) - 1); ++ if (lowexp) ++ xlow |= (((halffractype)1) << HALFFRACBITS); ++ else ++ lowexp = 1; ++ shift = (FRACBITS - HALFFRACBITS) - (exp - lowexp); ++ if (shift > 0) ++ xlow <<= shift; ++ else if (shift < 0) ++ xlow >>= -shift; ++ if (sign == lowsign) ++ fraction += xlow; ++ else if (fraction >= xlow) ++ fraction -= xlow; ++ else ++ { ++ /* The high part is a power of two but the full number is lower. ++ This code will leave the implicit 1 in FRACTION, but we'd ++ have added that below anyway. */ ++ fraction = (((fractype) 1 << FRACBITS) - xlow) << 1; ++ exp--; ++ } ++ } ++ } ++# else ++ fraction = src->value_raw & ((((fractype)1) << FRACBITS) - 1); ++ exp = ((int)(src->value_raw >> FRACBITS)) & ((1 << EXPBITS) - 1); ++ sign = ((int)(src->value_raw >> (FRACBITS + EXPBITS))) & 1; ++# endif ++#endif ++ ++ dst->sign = sign; ++ if (exp == 0) ++ { ++ /* Hmm. Looks like 0 */ ++ if (fraction == 0 ++#ifdef NO_DENORMALS ++ || 1 ++#endif ++ ) ++ { ++ /* tastes like zero */ ++ dst->class = CLASS_ZERO; ++ } ++ else ++ { ++ /* Zero exponent with nonzero fraction - it's denormalized, ++ so there isn't a leading implicit one - we'll shift it so ++ it gets one. */ ++ dst->normal_exp = exp - EXPBIAS + 1; ++ fraction <<= NGARDS; ++ ++ dst->class = CLASS_NUMBER; ++#if 1 ++ while (fraction < IMPLICIT_1) ++ { ++ fraction <<= 1; ++ dst->normal_exp--; ++ } ++#endif ++ dst->fraction.ll = fraction; ++ } ++ } ++ else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && exp == EXPMAX) ++ { ++ /* Huge exponent*/ ++ if (fraction == 0) ++ { ++ /* Attached to a zero fraction - means infinity */ ++ dst->class = CLASS_INFINITY; ++ } ++ else ++ { ++ /* Nonzero fraction, means nan */ ++#ifdef QUIET_NAN_NEGATED ++ if ((fraction & QUIET_NAN) == 0) ++#else ++ if (fraction & QUIET_NAN) ++#endif ++ { ++ dst->class = CLASS_QNAN; ++ } ++ else ++ { ++ dst->class = CLASS_SNAN; ++ } ++ /* Keep the fraction part as the nan number */ ++ dst->fraction.ll = fraction; ++ } ++ } ++ else ++ { ++ /* Nothing strange about this number */ ++ dst->normal_exp = exp - EXPBIAS; ++ dst->class = CLASS_NUMBER; ++ dst->fraction.ll = (fraction << NGARDS) | IMPLICIT_1; ++ } ++} ++#endif /* L_unpack_df || L_unpack_sf */ ++ ++#if defined(L_addsub_sf) || defined(L_addsub_df) || defined(L_addsub_tf) ++static fp_number_type * ++_fpadd_parts (fp_number_type * a, ++ fp_number_type * b, ++ fp_number_type * tmp) ++{ ++ intfrac tfraction; ++ ++ /* Put commonly used fields in local variables. */ ++ int a_normal_exp; ++ int b_normal_exp; ++ fractype a_fraction; ++ fractype b_fraction; ++ ++ if (isnan (a)) ++ { ++ return a; ++ } ++ if (isnan (b)) ++ { ++ return b; ++ } ++ if (isinf (a)) ++ { ++ /* Adding infinities with opposite signs yields a NaN. */ ++ if (isinf (b) && a->sign != b->sign) ++ return nan (); ++ return a; ++ } ++ if (isinf (b)) ++ { ++ return b; ++ } ++ if (iszero (b)) ++ { ++ if (iszero (a)) ++ { ++ *tmp = *a; ++ tmp->sign = a->sign & b->sign; ++ return tmp; ++ } ++ return a; ++ } ++ if (iszero (a)) ++ { ++ return b; ++ } ++ ++ /* Got two numbers. shift the smaller and increment the exponent till ++ they're the same */ ++ { ++ int diff; ++ ++ a_normal_exp = a->normal_exp; ++ b_normal_exp = b->normal_exp; ++ a_fraction = a->fraction.ll; ++ b_fraction = b->fraction.ll; ++ ++ diff = a_normal_exp - b_normal_exp; ++ ++ if (diff < 0) ++ diff = -diff; ++ if (diff < FRAC_NBITS) ++ { ++ /* ??? This does shifts one bit at a time. Optimize. */ ++ while (a_normal_exp > b_normal_exp) ++ { ++ b_normal_exp++; ++ LSHIFT (b_fraction); ++ } ++ while (b_normal_exp > a_normal_exp) ++ { ++ a_normal_exp++; ++ LSHIFT (a_fraction); ++ } ++ } ++ else ++ { ++ /* Somethings's up.. choose the biggest */ ++ if (a_normal_exp > b_normal_exp) ++ { ++ b_normal_exp = a_normal_exp; ++ b_fraction = 0; ++ } ++ else ++ { ++ a_normal_exp = b_normal_exp; ++ a_fraction = 0; ++ } ++ } ++ } ++ ++ if (a->sign != b->sign) ++ { ++ if (a->sign) ++ { ++ tfraction = -a_fraction + b_fraction; ++ } ++ else ++ { ++ tfraction = a_fraction - b_fraction; ++ } ++ if (tfraction >= 0) ++ { ++ tmp->sign = 0; ++ tmp->normal_exp = a_normal_exp; ++ tmp->fraction.ll = tfraction; ++ } ++ else ++ { ++ tmp->sign = 1; ++ tmp->normal_exp = a_normal_exp; ++ tmp->fraction.ll = -tfraction; ++ } ++ /* and renormalize it */ ++ ++ while (tmp->fraction.ll < IMPLICIT_1 && tmp->fraction.ll) ++ { ++ tmp->fraction.ll <<= 1; ++ tmp->normal_exp--; ++ } ++ } ++ else ++ { ++ tmp->sign = a->sign; ++ tmp->normal_exp = a_normal_exp; ++ tmp->fraction.ll = a_fraction + b_fraction; ++ } ++ tmp->class = CLASS_NUMBER; ++ /* Now the fraction is added, we have to shift down to renormalize the ++ number */ ++ ++ if (tmp->fraction.ll >= IMPLICIT_2) ++ { ++ LSHIFT (tmp->fraction.ll); ++ tmp->normal_exp++; ++ } ++ return tmp; ++ ++} ++ ++FLO_type ++add (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ fp_number_type tmp; ++ fp_number_type *res; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ res = _fpadd_parts (&a, &b, &tmp); ++ ++ return pack_d (res); ++} ++ ++FLO_type ++sub (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ fp_number_type tmp; ++ fp_number_type *res; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ b.sign ^= 1; ++ ++ res = _fpadd_parts (&a, &b, &tmp); ++ ++ return pack_d (res); ++} ++#endif /* L_addsub_sf || L_addsub_df */ ++ ++#if defined(L_mul_sf) || defined(L_mul_df) || defined(L_mul_tf) ++static inline __attribute__ ((__always_inline__)) fp_number_type * ++_fpmul_parts ( fp_number_type * a, ++ fp_number_type * b, ++ fp_number_type * tmp) ++{ ++ fractype low = 0; ++ fractype high = 0; ++ ++ if (isnan (a)) ++ { ++ a->sign = a->sign != b->sign; ++ return a; ++ } ++ if (isnan (b)) ++ { ++ b->sign = a->sign != b->sign; ++ return b; ++ } ++ if (isinf (a)) ++ { ++ if (iszero (b)) ++ return nan (); ++ a->sign = a->sign != b->sign; ++ return a; ++ } ++ if (isinf (b)) ++ { ++ if (iszero (a)) ++ { ++ return nan (); ++ } ++ b->sign = a->sign != b->sign; ++ return b; ++ } ++ if (iszero (a)) ++ { ++ a->sign = a->sign != b->sign; ++ return a; ++ } ++ if (iszero (b)) ++ { ++ b->sign = a->sign != b->sign; ++ return b; ++ } ++ ++ /* Calculate the mantissa by multiplying both numbers to get a ++ twice-as-wide number. */ ++ { ++#if defined(NO_DI_MODE) || defined(TFLOAT) ++ { ++ fractype x = a->fraction.ll; ++ fractype ylow = b->fraction.ll; ++ fractype yhigh = 0; ++ int bit; ++ ++ /* ??? This does multiplies one bit at a time. Optimize. */ ++ for (bit = 0; bit < FRAC_NBITS; bit++) ++ { ++ int carry; ++ ++ if (x & 1) ++ { ++ carry = (low += ylow) < ylow; ++ high += yhigh + carry; ++ } ++ yhigh <<= 1; ++ if (ylow & FRACHIGH) ++ { ++ yhigh |= 1; ++ } ++ ylow <<= 1; ++ x >>= 1; ++ } ++ } ++#elif defined(FLOAT) ++ /* Multiplying two USIs to get a UDI, we're safe. */ ++ { ++ UDItype answer = (UDItype)a->fraction.ll * (UDItype)b->fraction.ll; ++ ++ high = answer >> BITS_PER_SI; ++ low = answer; ++ } ++#else ++ /* fractype is DImode, but we need the result to be twice as wide. ++ Assuming a widening multiply from DImode to TImode is not ++ available, build one by hand. */ ++ { ++ USItype nl = a->fraction.ll; ++ USItype nh = a->fraction.ll >> BITS_PER_SI; ++ USItype ml = b->fraction.ll; ++ USItype mh = b->fraction.ll >> BITS_PER_SI; ++ UDItype pp_ll = (UDItype) ml * nl; ++ UDItype pp_hl = (UDItype) mh * nl; ++ UDItype pp_lh = (UDItype) ml * nh; ++ UDItype pp_hh = (UDItype) mh * nh; ++ UDItype res2 = 0; ++ UDItype res0 = 0; ++ UDItype ps_hh__ = pp_hl + pp_lh; ++ if (ps_hh__ < pp_hl) ++ res2 += (UDItype)1 << BITS_PER_SI; ++ pp_hl = (UDItype)(USItype)ps_hh__ << BITS_PER_SI; ++ res0 = pp_ll + pp_hl; ++ if (res0 < pp_ll) ++ res2++; ++ res2 += (ps_hh__ >> BITS_PER_SI) + pp_hh; ++ high = res2; ++ low = res0; ++ } ++#endif ++ } ++ ++ tmp->normal_exp = a->normal_exp + b->normal_exp ++ + FRAC_NBITS - (FRACBITS + NGARDS); ++ tmp->sign = a->sign != b->sign; ++ while (high >= IMPLICIT_2) ++ { ++ tmp->normal_exp++; ++ if (high & 1) ++ { ++ low >>= 1; ++ low |= FRACHIGH; ++ } ++ high >>= 1; ++ } ++ while (high < IMPLICIT_1) ++ { ++ tmp->normal_exp--; ++ ++ high <<= 1; ++ if (low & FRACHIGH) ++ high |= 1; ++ low <<= 1; ++ } ++ /* rounding is tricky. if we only round if it won't make us round later. */ ++#if 0 ++ if (low & FRACHIGH2) ++ { ++ if (((high & GARDMASK) != GARDMSB) ++ && (((high + 1) & GARDMASK) == GARDMSB)) ++ { ++ /* don't round, it gets done again later. */ ++ } ++ else ++ { ++ high++; ++ } ++ } ++#endif ++ if (!ROUND_TOWARDS_ZERO && (high & GARDMASK) == GARDMSB) ++ { ++ if (high & (1 << NGARDS)) ++ { ++ /* half way, so round to even */ ++ high += GARDROUND + 1; ++ } ++ else if (low) ++ { ++ /* but we really weren't half way */ ++ high += GARDROUND + 1; ++ } ++ } ++ tmp->fraction.ll = high; ++ tmp->class = CLASS_NUMBER; ++ return tmp; ++} ++ ++FLO_type ++multiply (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ fp_number_type tmp; ++ fp_number_type *res; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ res = _fpmul_parts (&a, &b, &tmp); ++ ++ return pack_d (res); ++} ++#endif /* L_mul_sf || L_mul_df */ ++ ++#if defined(L_div_sf) || defined(L_div_df) || defined(L_div_tf) ++static inline __attribute__ ((__always_inline__)) fp_number_type * ++_fpdiv_parts (fp_number_type * a, ++ fp_number_type * b) ++{ ++ fractype bit; ++ fractype numerator; ++ fractype denominator; ++ fractype quotient; ++ ++ if (isnan (a)) ++ { ++ return a; ++ } ++ if (isnan (b)) ++ { ++ return b; ++ } ++ ++ a->sign = a->sign ^ b->sign; ++ ++ if (isinf (a) || iszero (a)) ++ { ++ if (a->class == b->class) ++ return nan (); ++ return a; ++ } ++ ++ if (isinf (b)) ++ { ++ a->fraction.ll = 0; ++ a->normal_exp = 0; ++ return a; ++ } ++ if (iszero (b)) ++ { ++ a->class = CLASS_INFINITY; ++ return a; ++ } ++ ++ /* Calculate the mantissa by multiplying both 64bit numbers to get a ++ 128 bit number */ ++ { ++ /* quotient = ++ ( numerator / denominator) * 2^(numerator exponent - denominator exponent) ++ */ ++ ++ a->normal_exp = a->normal_exp - b->normal_exp; ++ numerator = a->fraction.ll; ++ denominator = b->fraction.ll; ++ ++ if (numerator < denominator) ++ { ++ /* Fraction will be less than 1.0 */ ++ numerator *= 2; ++ a->normal_exp--; ++ } ++ bit = IMPLICIT_1; ++ quotient = 0; ++ /* ??? Does divide one bit at a time. Optimize. */ ++ while (bit) ++ { ++ if (numerator >= denominator) ++ { ++ quotient |= bit; ++ numerator -= denominator; ++ } ++ bit >>= 1; ++ numerator *= 2; ++ } ++ ++ if (!ROUND_TOWARDS_ZERO && (quotient & GARDMASK) == GARDMSB) ++ { ++ if (quotient & (1 << NGARDS)) ++ { ++ /* half way, so round to even */ ++ quotient += GARDROUND + 1; ++ } ++ else if (numerator) ++ { ++ /* but we really weren't half way, more bits exist */ ++ quotient += GARDROUND + 1; ++ } ++ } ++ ++ a->fraction.ll = quotient; ++ return (a); ++ } ++} ++ ++FLO_type ++divide (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ fp_number_type *res; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ res = _fpdiv_parts (&a, &b); ++ ++ return pack_d (res); ++} ++#endif /* L_div_sf || L_div_df */ ++ ++#if defined(L_fpcmp_parts_sf) || defined(L_fpcmp_parts_df) \ ++ || defined(L_fpcmp_parts_tf) ++/* according to the demo, fpcmp returns a comparison with 0... thus ++ a<b -> -1 ++ a==b -> 0 ++ a>b -> +1 ++ */ ++ ++int ++__fpcmp_parts (fp_number_type * a, fp_number_type * b) ++{ ++#if 0 ++ /* either nan -> unordered. Must be checked outside of this routine. */ ++ if (isnan (a) && isnan (b)) ++ { ++ return 1; /* still unordered! */ ++ } ++#endif ++ ++ if (isnan (a) || isnan (b)) ++ { ++ return 1; /* how to indicate unordered compare? */ ++ } ++ if (isinf (a) && isinf (b)) ++ { ++ /* +inf > -inf, but +inf != +inf */ ++ /* b \a| +inf(0)| -inf(1) ++ ______\+--------+-------- ++ +inf(0)| a==b(0)| a<b(-1) ++ -------+--------+-------- ++ -inf(1)| a>b(1) | a==b(0) ++ -------+--------+-------- ++ So since unordered must be nonzero, just line up the columns... ++ */ ++ return b->sign - a->sign; ++ } ++ /* but not both... */ ++ if (isinf (a)) ++ { ++ return a->sign ? -1 : 1; ++ } ++ if (isinf (b)) ++ { ++ return b->sign ? 1 : -1; ++ } ++ if (iszero (a) && iszero (b)) ++ { ++ return 0; ++ } ++ if (iszero (a)) ++ { ++ return b->sign ? 1 : -1; ++ } ++ if (iszero (b)) ++ { ++ return a->sign ? -1 : 1; ++ } ++ /* now both are "normal". */ ++ if (a->sign != b->sign) ++ { ++ /* opposite signs */ ++ return a->sign ? -1 : 1; ++ } ++ /* same sign; exponents? */ ++ if (a->normal_exp > b->normal_exp) ++ { ++ return a->sign ? -1 : 1; ++ } ++ if (a->normal_exp < b->normal_exp) ++ { ++ return a->sign ? 1 : -1; ++ } ++ /* same exponents; check size. */ ++ if (a->fraction.ll > b->fraction.ll) ++ { ++ return a->sign ? -1 : 1; ++ } ++ if (a->fraction.ll < b->fraction.ll) ++ { ++ return a->sign ? 1 : -1; ++ } ++ /* after all that, they're equal. */ ++ return 0; ++} ++#endif ++ ++#if defined(L_compare_sf) || defined(L_compare_df) || defined(L_compoare_tf) ++CMPtype ++compare (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ return __fpcmp_parts (&a, &b); ++} ++#endif /* L_compare_sf || L_compare_df */ ++ ++#ifndef US_SOFTWARE_GOFAST ++ ++/* These should be optimized for their specific tasks someday. */ ++ ++#if defined(L_eq_sf) || defined(L_eq_df) || defined(L_eq_tf) ++CMPtype ++_eq_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return 1; /* false, truth == 0 */ ++ ++ return __fpcmp_parts (&a, &b) ; ++} ++#endif /* L_eq_sf || L_eq_df */ ++ ++#if defined(L_ne_sf) || defined(L_ne_df) || defined(L_ne_tf) ++CMPtype ++_ne_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return 1; /* true, truth != 0 */ ++ ++ return __fpcmp_parts (&a, &b) ; ++} ++#endif /* L_ne_sf || L_ne_df */ ++ ++#if defined(L_gt_sf) || defined(L_gt_df) || defined(L_gt_tf) ++CMPtype ++_gt_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return -1; /* false, truth > 0 */ ++ ++ return __fpcmp_parts (&a, &b); ++} ++#endif /* L_gt_sf || L_gt_df */ ++ ++#if defined(L_ge_sf) || defined(L_ge_df) || defined(L_ge_tf) ++CMPtype ++_ge_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return -1; /* false, truth >= 0 */ ++ return __fpcmp_parts (&a, &b) ; ++} ++#endif /* L_ge_sf || L_ge_df */ ++ ++#if defined(L_lt_sf) || defined(L_lt_df) || defined(L_lt_tf) ++CMPtype ++_lt_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return 1; /* false, truth < 0 */ ++ ++ return __fpcmp_parts (&a, &b); ++} ++#endif /* L_lt_sf || L_lt_df */ ++ ++#if defined(L_le_sf) || defined(L_le_df) || defined(L_le_tf) ++CMPtype ++_le_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return 1; /* false, truth <= 0 */ ++ ++ return __fpcmp_parts (&a, &b) ; ++} ++#endif /* L_le_sf || L_le_df */ ++ ++#endif /* ! US_SOFTWARE_GOFAST */ ++ ++#if defined(L_unord_sf) || defined(L_unord_df) || defined(L_unord_tf) ++CMPtype ++_unord_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ return (isnan (&a) || isnan (&b)); ++} ++#endif /* L_unord_sf || L_unord_df */ ++ ++#if defined(L_si_to_sf) || defined(L_si_to_df) || defined(L_si_to_tf) ++FLO_type ++si_to_float (SItype arg_a) ++{ ++ fp_number_type in; ++ ++ in.class = CLASS_NUMBER; ++ in.sign = arg_a < 0; ++ if (!arg_a) ++ { ++ in.class = CLASS_ZERO; ++ } ++ else ++ { ++ in.normal_exp = FRACBITS + NGARDS; ++ if (in.sign) ++ { ++ /* Special case for minint, since there is no +ve integer ++ representation for it */ ++ if (arg_a == (- MAX_SI_INT - 1)) ++ { ++ return (FLO_type)(- MAX_SI_INT - 1); ++ } ++ in.fraction.ll = (-arg_a); ++ } ++ else ++ in.fraction.ll = arg_a; ++ ++ while (in.fraction.ll < ((fractype)1 << (FRACBITS + NGARDS))) ++ { ++ in.fraction.ll <<= 1; ++ in.normal_exp -= 1; ++ } ++ } ++ return pack_d (&in); ++} ++#endif /* L_si_to_sf || L_si_to_df */ ++ ++#if defined(L_usi_to_sf) || defined(L_usi_to_df) || defined(L_usi_to_tf) ++FLO_type ++usi_to_float (USItype arg_a) ++{ ++ fp_number_type in; ++ ++ in.sign = 0; ++ if (!arg_a) ++ { ++ in.class = CLASS_ZERO; ++ } ++ else ++ { ++ in.class = CLASS_NUMBER; ++ in.normal_exp = FRACBITS + NGARDS; ++ in.fraction.ll = arg_a; ++ ++ while (in.fraction.ll > ((fractype)1 << (FRACBITS + NGARDS))) ++ { ++ in.fraction.ll >>= 1; ++ in.normal_exp += 1; ++ } ++ while (in.fraction.ll < ((fractype)1 << (FRACBITS + NGARDS))) ++ { ++ in.fraction.ll <<= 1; ++ in.normal_exp -= 1; ++ } ++ } ++ return pack_d (&in); ++} ++#endif ++ ++#if defined(L_sf_to_si) || defined(L_df_to_si) || defined(L_tf_to_si) ++SItype ++float_to_si (FLO_type arg_a) ++{ ++ fp_number_type a; ++ SItype tmp; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &a); ++ ++ if (iszero (&a)) ++ return 0; ++ if (isnan (&a)) ++ return 0; ++ /* get reasonable MAX_SI_INT... */ ++ if (isinf (&a)) ++ return a.sign ? (-MAX_SI_INT)-1 : MAX_SI_INT; ++ /* it is a number, but a small one */ ++ if (a.normal_exp < 0) ++ return 0; ++ if (a.normal_exp > BITS_PER_SI - 2) ++ return a.sign ? (-MAX_SI_INT)-1 : MAX_SI_INT; ++ tmp = a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp); ++ return a.sign ? (-tmp) : (tmp); ++} ++#endif /* L_sf_to_si || L_df_to_si */ ++ ++#if defined(L_sf_to_usi) || defined(L_df_to_usi) || defined(L_tf_to_usi) ++#if defined US_SOFTWARE_GOFAST || defined(L_tf_to_usi) ++/* While libgcc2.c defines its own __fixunssfsi and __fixunsdfsi routines, ++ we also define them for GOFAST because the ones in libgcc2.c have the ++ wrong names and I'd rather define these here and keep GOFAST CYG-LOC's ++ out of libgcc2.c. We can't define these here if not GOFAST because then ++ there'd be duplicate copies. */ ++ ++USItype ++float_to_usi (FLO_type arg_a) ++{ ++ fp_number_type a; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &a); ++ ++ if (iszero (&a)) ++ return 0; ++ if (isnan (&a)) ++ return 0; ++ /* it is a negative number */ ++ if (a.sign) ++ return 0; ++ /* get reasonable MAX_USI_INT... */ ++ if (isinf (&a)) ++ return MAX_USI_INT; ++ /* it is a number, but a small one */ ++ if (a.normal_exp < 0) ++ return 0; ++ if (a.normal_exp > BITS_PER_SI - 1) ++ return MAX_USI_INT; ++ else if (a.normal_exp > (FRACBITS + NGARDS)) ++ return a.fraction.ll << (a.normal_exp - (FRACBITS + NGARDS)); ++ else ++ return a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp); ++} ++#endif /* US_SOFTWARE_GOFAST */ ++#endif /* L_sf_to_usi || L_df_to_usi */ ++ ++#if defined(L_negate_sf) || defined(L_negate_df) || defined(L_negate_tf) ++FLO_type ++negate (FLO_type arg_a) ++{ ++ fp_number_type a; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &a); ++ ++ flip_sign (&a); ++ return pack_d (&a); ++} ++#endif /* L_negate_sf || L_negate_df */ ++ ++#ifdef FLOAT ++ ++#if defined(L_make_sf) ++SFtype ++__make_fp(fp_class_type class, ++ unsigned int sign, ++ int exp, ++ USItype frac) ++{ ++ fp_number_type in; ++ ++ in.class = class; ++ in.sign = sign; ++ in.normal_exp = exp; ++ in.fraction.ll = frac; ++ return pack_d (&in); ++} ++#endif /* L_make_sf */ ++ ++#ifndef FLOAT_ONLY ++ ++/* This enables one to build an fp library that supports float but not double. ++ Otherwise, we would get an undefined reference to __make_dp. ++ This is needed for some 8-bit ports that can't handle well values that ++ are 8-bytes in size, so we just don't support double for them at all. */ ++ ++#if defined(L_sf_to_df) ++DFtype ++sf_to_df (SFtype arg_a) ++{ ++ fp_number_type in; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ return __make_dp (in.class, in.sign, in.normal_exp, ++ ((UDItype) in.fraction.ll) << F_D_BITOFF); ++} ++#endif /* L_sf_to_df */ ++ ++#if defined(L_sf_to_tf) && defined(TMODES) ++TFtype ++sf_to_tf (SFtype arg_a) ++{ ++ fp_number_type in; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ return __make_tp (in.class, in.sign, in.normal_exp, ++ ((UTItype) in.fraction.ll) << F_T_BITOFF); ++} ++#endif /* L_sf_to_df */ ++ ++#endif /* ! FLOAT_ONLY */ ++#endif /* FLOAT */ ++ ++#ifndef FLOAT ++ ++extern SFtype __make_fp (fp_class_type, unsigned int, int, USItype); ++ ++#if defined(L_make_df) ++DFtype ++__make_dp (fp_class_type class, unsigned int sign, int exp, UDItype frac) ++{ ++ fp_number_type in; ++ ++ in.class = class; ++ in.sign = sign; ++ in.normal_exp = exp; ++ in.fraction.ll = frac; ++ return pack_d (&in); ++} ++#endif /* L_make_df */ ++ ++#if defined(L_df_to_sf) ++SFtype ++df_to_sf (DFtype arg_a) ++{ ++ fp_number_type in; ++ USItype sffrac; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ sffrac = in.fraction.ll >> F_D_BITOFF; ++ ++ /* We set the lowest guard bit in SFFRAC if we discarded any non ++ zero bits. */ ++ if ((in.fraction.ll & (((USItype) 1 << F_D_BITOFF) - 1)) != 0) ++ sffrac |= 1; ++ ++ return __make_fp (in.class, in.sign, in.normal_exp, sffrac); ++} ++#endif /* L_df_to_sf */ ++ ++#if defined(L_df_to_tf) && defined(TMODES) \ ++ && !defined(FLOAT) && !defined(TFLOAT) ++TFtype ++df_to_tf (DFtype arg_a) ++{ ++ fp_number_type in; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ return __make_tp (in.class, in.sign, in.normal_exp, ++ ((UTItype) in.fraction.ll) << D_T_BITOFF); ++} ++#endif /* L_sf_to_df */ ++ ++#ifdef TFLOAT ++#if defined(L_make_tf) ++TFtype ++__make_tp(fp_class_type class, ++ unsigned int sign, ++ int exp, ++ UTItype frac) ++{ ++ fp_number_type in; ++ ++ in.class = class; ++ in.sign = sign; ++ in.normal_exp = exp; ++ in.fraction.ll = frac; ++ return pack_d (&in); ++} ++#endif /* L_make_tf */ ++ ++#if defined(L_tf_to_df) ++DFtype ++tf_to_df (TFtype arg_a) ++{ ++ fp_number_type in; ++ UDItype sffrac; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ sffrac = in.fraction.ll >> D_T_BITOFF; ++ ++ /* We set the lowest guard bit in SFFRAC if we discarded any non ++ zero bits. */ ++ if ((in.fraction.ll & (((UTItype) 1 << D_T_BITOFF) - 1)) != 0) ++ sffrac |= 1; ++ ++ return __make_dp (in.class, in.sign, in.normal_exp, sffrac); ++} ++#endif /* L_tf_to_df */ ++ ++#if defined(L_tf_to_sf) ++SFtype ++tf_to_sf (TFtype arg_a) ++{ ++ fp_number_type in; ++ USItype sffrac; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ sffrac = in.fraction.ll >> F_T_BITOFF; ++ ++ /* We set the lowest guard bit in SFFRAC if we discarded any non ++ zero bits. */ ++ if ((in.fraction.ll & (((UTItype) 1 << F_T_BITOFF) - 1)) != 0) ++ sffrac |= 1; ++ ++ return __make_fp (in.class, in.sign, in.normal_exp, sffrac); ++} ++#endif /* L_tf_to_sf */ ++#endif /* TFLOAT */ ++ ++#endif /* ! FLOAT */ ++#endif /* !EXTENDED_FLOAT_STUBS */ +--- gcc-3.4.3/gcc/config/nios2/nios2-fp-bit.c ++++ gcc-3.4.3-nios2/gcc/config/nios2/nios2-fp-bit.c +@@ -0,0 +1,1652 @@ ++#define FLOAT ++/* This is a software floating point library which can be used ++ for targets without hardware floating point. ++ Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004 ++ Free Software Foundation, Inc. ++ ++This file is free software; you can redistribute it and/or modify it ++under the terms of the GNU General Public License as published by the ++Free Software Foundation; either version 2, or (at your option) any ++later version. ++ ++In addition to the permissions in the GNU General Public License, the ++Free Software Foundation gives you unlimited permission to link the ++compiled version of this file with other programs, and to distribute ++those programs without any restriction coming from the use of this ++file. (The General Public License restrictions do apply in other ++respects; for example, they cover modification of the file, and ++distribution when not linked into another program.) ++ ++This file is distributed in the hope that it will be useful, but ++WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with this program; see the file COPYING. If not, write to ++the Free Software Foundation, 59 Temple Place - Suite 330, ++Boston, MA 02111-1307, USA. */ ++ ++/* As a special exception, if you link this library with other files, ++ some of which are compiled with GCC, to produce an executable, ++ this library does not by itself cause the resulting executable ++ to be covered by the GNU General Public License. ++ This exception does not however invalidate any other reasons why ++ the executable file might be covered by the GNU General Public License. */ ++ ++/* This implements IEEE 754 format arithmetic, but does not provide a ++ mechanism for setting the rounding mode, or for generating or handling ++ exceptions. ++ ++ The original code by Steve Chamberlain, hacked by Mark Eichin and Jim ++ Wilson, all of Cygnus Support. */ ++ ++/* The intended way to use this file is to make two copies, add `#define FLOAT' ++ to one copy, then compile both copies and add them to libgcc.a. */ ++ ++#include "tconfig.h" ++#include "coretypes.h" ++#include "tm.h" ++#include "config/fp-bit.h" ++ ++/* The following macros can be defined to change the behavior of this file: ++ FLOAT: Implement a `float', aka SFmode, fp library. If this is not ++ defined, then this file implements a `double', aka DFmode, fp library. ++ FLOAT_ONLY: Used with FLOAT, to implement a `float' only library, i.e. ++ don't include float->double conversion which requires the double library. ++ This is useful only for machines which can't support doubles, e.g. some ++ 8-bit processors. ++ CMPtype: Specify the type that floating point compares should return. ++ This defaults to SItype, aka int. ++ US_SOFTWARE_GOFAST: This makes all entry points use the same names as the ++ US Software goFast library. ++ _DEBUG_BITFLOAT: This makes debugging the code a little easier, by adding ++ two integers to the FLO_union_type. ++ NO_DENORMALS: Disable handling of denormals. ++ NO_NANS: Disable nan and infinity handling ++ SMALL_MACHINE: Useful when operations on QIs and HIs are faster ++ than on an SI */ ++ ++/* We don't currently support extended floats (long doubles) on machines ++ without hardware to deal with them. ++ ++ These stubs are just to keep the linker from complaining about unresolved ++ references which can be pulled in from libio & libstdc++, even if the ++ user isn't using long doubles. However, they may generate an unresolved ++ external to abort if abort is not used by the function, and the stubs ++ are referenced from within libc, since libgcc goes before and after the ++ system library. */ ++ ++#ifdef DECLARE_LIBRARY_RENAMES ++ DECLARE_LIBRARY_RENAMES ++#endif ++ ++#ifdef EXTENDED_FLOAT_STUBS ++extern void abort (void); ++void __extendsfxf2 (void) { abort(); } ++void __extenddfxf2 (void) { abort(); } ++void __truncxfdf2 (void) { abort(); } ++void __truncxfsf2 (void) { abort(); } ++void __fixxfsi (void) { abort(); } ++void __floatsixf (void) { abort(); } ++void __addxf3 (void) { abort(); } ++void __subxf3 (void) { abort(); } ++void __mulxf3 (void) { abort(); } ++void __divxf3 (void) { abort(); } ++void __negxf2 (void) { abort(); } ++void __eqxf2 (void) { abort(); } ++void __nexf2 (void) { abort(); } ++void __gtxf2 (void) { abort(); } ++void __gexf2 (void) { abort(); } ++void __lexf2 (void) { abort(); } ++void __ltxf2 (void) { abort(); } ++ ++void __extendsftf2 (void) { abort(); } ++void __extenddftf2 (void) { abort(); } ++void __trunctfdf2 (void) { abort(); } ++void __trunctfsf2 (void) { abort(); } ++void __fixtfsi (void) { abort(); } ++void __floatsitf (void) { abort(); } ++void __addtf3 (void) { abort(); } ++void __subtf3 (void) { abort(); } ++void __multf3 (void) { abort(); } ++void __divtf3 (void) { abort(); } ++void __negtf2 (void) { abort(); } ++void __eqtf2 (void) { abort(); } ++void __netf2 (void) { abort(); } ++void __gttf2 (void) { abort(); } ++void __getf2 (void) { abort(); } ++void __letf2 (void) { abort(); } ++void __lttf2 (void) { abort(); } ++#else /* !EXTENDED_FLOAT_STUBS, rest of file */ ++ ++/* IEEE "special" number predicates */ ++ ++#ifdef NO_NANS ++ ++#define nan() 0 ++#define isnan(x) 0 ++#define isinf(x) 0 ++#else ++ ++#if defined L_thenan_sf ++const fp_number_type __thenan_sf = { CLASS_SNAN, 0, 0, {(fractype) 0} }; ++#elif defined L_thenan_df ++const fp_number_type __thenan_df = { CLASS_SNAN, 0, 0, {(fractype) 0} }; ++#elif defined L_thenan_tf ++const fp_number_type __thenan_tf = { CLASS_SNAN, 0, 0, {(fractype) 0} }; ++#elif defined TFLOAT ++extern const fp_number_type __thenan_tf; ++#elif defined FLOAT ++extern const fp_number_type __thenan_sf; ++#else ++extern const fp_number_type __thenan_df; ++#endif ++ ++INLINE ++static fp_number_type * ++nan (void) ++{ ++ /* Discard the const qualifier... */ ++#ifdef TFLOAT ++ return (fp_number_type *) (& __thenan_tf); ++#elif defined FLOAT ++ return (fp_number_type *) (& __thenan_sf); ++#else ++ return (fp_number_type *) (& __thenan_df); ++#endif ++} ++ ++INLINE ++static int ++isnan ( fp_number_type * x) ++{ ++ return x->class == CLASS_SNAN || x->class == CLASS_QNAN; ++} ++ ++INLINE ++static int ++isinf ( fp_number_type * x) ++{ ++ return x->class == CLASS_INFINITY; ++} ++ ++#endif /* NO_NANS */ ++ ++INLINE ++static int ++iszero ( fp_number_type * x) ++{ ++ return x->class == CLASS_ZERO; ++} ++ ++INLINE ++static void ++flip_sign ( fp_number_type * x) ++{ ++ x->sign = !x->sign; ++} ++ ++extern FLO_type pack_d ( fp_number_type * ); ++ ++#if defined(L_pack_df) || defined(L_pack_sf) || defined(L_pack_tf) ++FLO_type ++pack_d ( fp_number_type * src) ++{ ++ FLO_union_type dst; ++ fractype fraction = src->fraction.ll; /* wasn't unsigned before? */ ++ int sign = src->sign; ++ int exp = 0; ++ ++ if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && (isnan (src) || isinf (src))) ++ { ++ /* We can't represent these values accurately. By using the ++ largest possible magnitude, we guarantee that the conversion ++ of infinity is at least as big as any finite number. */ ++ exp = EXPMAX; ++ fraction = ((fractype) 1 << FRACBITS) - 1; ++ } ++ else if (isnan (src)) ++ { ++ exp = EXPMAX; ++ if (src->class == CLASS_QNAN || 1) ++ { ++#ifdef QUIET_NAN_NEGATED ++ fraction |= QUIET_NAN - 1; ++#else ++ fraction |= QUIET_NAN; ++#endif ++ } ++ } ++ else if (isinf (src)) ++ { ++ exp = EXPMAX; ++ fraction = 0; ++ } ++ else if (iszero (src)) ++ { ++ exp = 0; ++ fraction = 0; ++ } ++ else if (fraction == 0) ++ { ++ exp = 0; ++ } ++ else ++ { ++ if (src->normal_exp < NORMAL_EXPMIN) ++ { ++#ifdef NO_DENORMALS ++ /* Go straight to a zero representation if denormals are not ++ supported. The denormal handling would be harmless but ++ isn't unnecessary. */ ++ exp = 0; ++ fraction = 0; ++#else /* NO_DENORMALS */ ++ /* This number's exponent is too low to fit into the bits ++ available in the number, so we'll store 0 in the exponent and ++ shift the fraction to the right to make up for it. */ ++ ++ int shift = NORMAL_EXPMIN - src->normal_exp; ++ ++ exp = 0; ++ ++ if (shift > FRAC_NBITS - NGARDS) ++ { ++ /* No point shifting, since it's more that 64 out. */ ++ fraction = 0; ++ } ++ else ++ { ++ int lowbit = (fraction & (((fractype)1 << shift) - 1)) ? 1 : 0; ++ fraction = (fraction >> shift) | lowbit; ++ } ++ if ((fraction & GARDMASK) == GARDMSB) ++ { ++ if ((fraction & (1 << NGARDS))) ++ fraction += GARDROUND + 1; ++ } ++ else ++ { ++ /* Add to the guards to round up. */ ++ fraction += GARDROUND; ++ } ++ /* Perhaps the rounding means we now need to change the ++ exponent, because the fraction is no longer denormal. */ ++ if (fraction >= IMPLICIT_1) ++ { ++ exp += 1; ++ } ++ fraction >>= NGARDS; ++#endif /* NO_DENORMALS */ ++ } ++ else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) ++ && src->normal_exp > EXPBIAS) ++ { ++ exp = EXPMAX; ++ fraction = 0; ++ } ++ else ++ { ++ exp = src->normal_exp + EXPBIAS; ++ if (!ROUND_TOWARDS_ZERO) ++ { ++ /* IF the gard bits are the all zero, but the first, then we're ++ half way between two numbers, choose the one which makes the ++ lsb of the answer 0. */ ++ if ((fraction & GARDMASK) == GARDMSB) ++ { ++ if (fraction & (1 << NGARDS)) ++ fraction += GARDROUND + 1; ++ } ++ else ++ { ++ /* Add a one to the guards to round up */ ++ fraction += GARDROUND; ++ } ++ if (fraction >= IMPLICIT_2) ++ { ++ fraction >>= 1; ++ exp += 1; ++ } ++ } ++ fraction >>= NGARDS; ++ ++ if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && exp > EXPMAX) ++ { ++ /* Saturate on overflow. */ ++ exp = EXPMAX; ++ fraction = ((fractype) 1 << FRACBITS) - 1; ++ } ++ } ++ } ++ ++ /* We previously used bitfields to store the number, but this doesn't ++ handle little/big endian systems conveniently, so use shifts and ++ masks */ ++#ifdef FLOAT_BIT_ORDER_MISMATCH ++ dst.bits.fraction = fraction; ++ dst.bits.exp = exp; ++ dst.bits.sign = sign; ++#else ++# if defined TFLOAT && defined HALFFRACBITS ++ { ++ halffractype high, low, unity; ++ int lowsign, lowexp; ++ ++ unity = (halffractype) 1 << HALFFRACBITS; ++ ++ /* Set HIGH to the high double's significand, masking out the implicit 1. ++ Set LOW to the low double's full significand. */ ++ high = (fraction >> (FRACBITS - HALFFRACBITS)) & (unity - 1); ++ low = fraction & (unity * 2 - 1); ++ ++ /* Get the initial sign and exponent of the low double. */ ++ lowexp = exp - HALFFRACBITS - 1; ++ lowsign = sign; ++ ++ /* HIGH should be rounded like a normal double, making |LOW| <= ++ 0.5 ULP of HIGH. Assume round-to-nearest. */ ++ if (exp < EXPMAX) ++ if (low > unity || (low == unity && (high & 1) == 1)) ++ { ++ /* Round HIGH up and adjust LOW to match. */ ++ high++; ++ if (high == unity) ++ { ++ /* May make it infinite, but that's OK. */ ++ high = 0; ++ exp++; ++ } ++ low = unity * 2 - low; ++ lowsign ^= 1; ++ } ++ ++ high |= (halffractype) exp << HALFFRACBITS; ++ high |= (halffractype) sign << (HALFFRACBITS + EXPBITS); ++ ++ if (exp == EXPMAX || exp == 0 || low == 0) ++ low = 0; ++ else ++ { ++ while (lowexp > 0 && low < unity) ++ { ++ low <<= 1; ++ lowexp--; ++ } ++ ++ if (lowexp <= 0) ++ { ++ halffractype roundmsb, round; ++ int shift; ++ ++ shift = 1 - lowexp; ++ roundmsb = (1 << (shift - 1)); ++ round = low & ((roundmsb << 1) - 1); ++ ++ low >>= shift; ++ lowexp = 0; ++ ++ if (round > roundmsb || (round == roundmsb && (low & 1) == 1)) ++ { ++ low++; ++ if (low == unity) ++ /* LOW rounds up to the smallest normal number. */ ++ lowexp++; ++ } ++ } ++ ++ low &= unity - 1; ++ low |= (halffractype) lowexp << HALFFRACBITS; ++ low |= (halffractype) lowsign << (HALFFRACBITS + EXPBITS); ++ } ++ dst.value_raw = ((fractype) high << HALFSHIFT) | low; ++ } ++# else ++ dst.value_raw = fraction & ((((fractype)1) << FRACBITS) - (fractype)1); ++ dst.value_raw |= ((fractype) (exp & ((1 << EXPBITS) - 1))) << FRACBITS; ++ dst.value_raw |= ((fractype) (sign & 1)) << (FRACBITS | EXPBITS); ++# endif ++#endif ++ ++#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT) ++#ifdef TFLOAT ++ { ++ qrtrfractype tmp1 = dst.words[0]; ++ qrtrfractype tmp2 = dst.words[1]; ++ dst.words[0] = dst.words[3]; ++ dst.words[1] = dst.words[2]; ++ dst.words[2] = tmp2; ++ dst.words[3] = tmp1; ++ } ++#else ++ { ++ halffractype tmp = dst.words[0]; ++ dst.words[0] = dst.words[1]; ++ dst.words[1] = tmp; ++ } ++#endif ++#endif ++ ++ return dst.value; ++} ++#endif ++ ++#if defined(L_unpack_df) || defined(L_unpack_sf) || defined(L_unpack_tf) ++void ++unpack_d (FLO_union_type * src, fp_number_type * dst) ++{ ++ /* We previously used bitfields to store the number, but this doesn't ++ handle little/big endian systems conveniently, so use shifts and ++ masks */ ++ fractype fraction; ++ int exp; ++ int sign; ++ ++#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT) ++ FLO_union_type swapped; ++ ++#ifdef TFLOAT ++ swapped.words[0] = src->words[3]; ++ swapped.words[1] = src->words[2]; ++ swapped.words[2] = src->words[1]; ++ swapped.words[3] = src->words[0]; ++#else ++ swapped.words[0] = src->words[1]; ++ swapped.words[1] = src->words[0]; ++#endif ++ src = &swapped; ++#endif ++ ++#ifdef FLOAT_BIT_ORDER_MISMATCH ++ fraction = src->bits.fraction; ++ exp = src->bits.exp; ++ sign = src->bits.sign; ++#else ++# if defined TFLOAT && defined HALFFRACBITS ++ { ++ halffractype high, low; ++ ++ high = src->value_raw >> HALFSHIFT; ++ low = src->value_raw & (((fractype)1 << HALFSHIFT) - 1); ++ ++ fraction = high & ((((fractype)1) << HALFFRACBITS) - 1); ++ fraction <<= FRACBITS - HALFFRACBITS; ++ exp = ((int)(high >> HALFFRACBITS)) & ((1 << EXPBITS) - 1); ++ sign = ((int)(high >> (((HALFFRACBITS + EXPBITS))))) & 1; ++ ++ if (exp != EXPMAX && exp != 0 && low != 0) ++ { ++ int lowexp = ((int)(low >> HALFFRACBITS)) & ((1 << EXPBITS) - 1); ++ int lowsign = ((int)(low >> (((HALFFRACBITS + EXPBITS))))) & 1; ++ int shift; ++ fractype xlow; ++ ++ xlow = low & ((((fractype)1) << HALFFRACBITS) - 1); ++ if (lowexp) ++ xlow |= (((halffractype)1) << HALFFRACBITS); ++ else ++ lowexp = 1; ++ shift = (FRACBITS - HALFFRACBITS) - (exp - lowexp); ++ if (shift > 0) ++ xlow <<= shift; ++ else if (shift < 0) ++ xlow >>= -shift; ++ if (sign == lowsign) ++ fraction += xlow; ++ else if (fraction >= xlow) ++ fraction -= xlow; ++ else ++ { ++ /* The high part is a power of two but the full number is lower. ++ This code will leave the implicit 1 in FRACTION, but we'd ++ have added that below anyway. */ ++ fraction = (((fractype) 1 << FRACBITS) - xlow) << 1; ++ exp--; ++ } ++ } ++ } ++# else ++ fraction = src->value_raw & ((((fractype)1) << FRACBITS) - 1); ++ exp = ((int)(src->value_raw >> FRACBITS)) & ((1 << EXPBITS) - 1); ++ sign = ((int)(src->value_raw >> (FRACBITS + EXPBITS))) & 1; ++# endif ++#endif ++ ++ dst->sign = sign; ++ if (exp == 0) ++ { ++ /* Hmm. Looks like 0 */ ++ if (fraction == 0 ++#ifdef NO_DENORMALS ++ || 1 ++#endif ++ ) ++ { ++ /* tastes like zero */ ++ dst->class = CLASS_ZERO; ++ } ++ else ++ { ++ /* Zero exponent with nonzero fraction - it's denormalized, ++ so there isn't a leading implicit one - we'll shift it so ++ it gets one. */ ++ dst->normal_exp = exp - EXPBIAS + 1; ++ fraction <<= NGARDS; ++ ++ dst->class = CLASS_NUMBER; ++#if 1 ++ while (fraction < IMPLICIT_1) ++ { ++ fraction <<= 1; ++ dst->normal_exp--; ++ } ++#endif ++ dst->fraction.ll = fraction; ++ } ++ } ++ else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && exp == EXPMAX) ++ { ++ /* Huge exponent*/ ++ if (fraction == 0) ++ { ++ /* Attached to a zero fraction - means infinity */ ++ dst->class = CLASS_INFINITY; ++ } ++ else ++ { ++ /* Nonzero fraction, means nan */ ++#ifdef QUIET_NAN_NEGATED ++ if ((fraction & QUIET_NAN) == 0) ++#else ++ if (fraction & QUIET_NAN) ++#endif ++ { ++ dst->class = CLASS_QNAN; ++ } ++ else ++ { ++ dst->class = CLASS_SNAN; ++ } ++ /* Keep the fraction part as the nan number */ ++ dst->fraction.ll = fraction; ++ } ++ } ++ else ++ { ++ /* Nothing strange about this number */ ++ dst->normal_exp = exp - EXPBIAS; ++ dst->class = CLASS_NUMBER; ++ dst->fraction.ll = (fraction << NGARDS) | IMPLICIT_1; ++ } ++} ++#endif /* L_unpack_df || L_unpack_sf */ ++ ++#if defined(L_addsub_sf) || defined(L_addsub_df) || defined(L_addsub_tf) ++static fp_number_type * ++_fpadd_parts (fp_number_type * a, ++ fp_number_type * b, ++ fp_number_type * tmp) ++{ ++ intfrac tfraction; ++ ++ /* Put commonly used fields in local variables. */ ++ int a_normal_exp; ++ int b_normal_exp; ++ fractype a_fraction; ++ fractype b_fraction; ++ ++ if (isnan (a)) ++ { ++ return a; ++ } ++ if (isnan (b)) ++ { ++ return b; ++ } ++ if (isinf (a)) ++ { ++ /* Adding infinities with opposite signs yields a NaN. */ ++ if (isinf (b) && a->sign != b->sign) ++ return nan (); ++ return a; ++ } ++ if (isinf (b)) ++ { ++ return b; ++ } ++ if (iszero (b)) ++ { ++ if (iszero (a)) ++ { ++ *tmp = *a; ++ tmp->sign = a->sign & b->sign; ++ return tmp; ++ } ++ return a; ++ } ++ if (iszero (a)) ++ { ++ return b; ++ } ++ ++ /* Got two numbers. shift the smaller and increment the exponent till ++ they're the same */ ++ { ++ int diff; ++ ++ a_normal_exp = a->normal_exp; ++ b_normal_exp = b->normal_exp; ++ a_fraction = a->fraction.ll; ++ b_fraction = b->fraction.ll; ++ ++ diff = a_normal_exp - b_normal_exp; ++ ++ if (diff < 0) ++ diff = -diff; ++ if (diff < FRAC_NBITS) ++ { ++ /* ??? This does shifts one bit at a time. Optimize. */ ++ while (a_normal_exp > b_normal_exp) ++ { ++ b_normal_exp++; ++ LSHIFT (b_fraction); ++ } ++ while (b_normal_exp > a_normal_exp) ++ { ++ a_normal_exp++; ++ LSHIFT (a_fraction); ++ } ++ } ++ else ++ { ++ /* Somethings's up.. choose the biggest */ ++ if (a_normal_exp > b_normal_exp) ++ { ++ b_normal_exp = a_normal_exp; ++ b_fraction = 0; ++ } ++ else ++ { ++ a_normal_exp = b_normal_exp; ++ a_fraction = 0; ++ } ++ } ++ } ++ ++ if (a->sign != b->sign) ++ { ++ if (a->sign) ++ { ++ tfraction = -a_fraction + b_fraction; ++ } ++ else ++ { ++ tfraction = a_fraction - b_fraction; ++ } ++ if (tfraction >= 0) ++ { ++ tmp->sign = 0; ++ tmp->normal_exp = a_normal_exp; ++ tmp->fraction.ll = tfraction; ++ } ++ else ++ { ++ tmp->sign = 1; ++ tmp->normal_exp = a_normal_exp; ++ tmp->fraction.ll = -tfraction; ++ } ++ /* and renormalize it */ ++ ++ while (tmp->fraction.ll < IMPLICIT_1 && tmp->fraction.ll) ++ { ++ tmp->fraction.ll <<= 1; ++ tmp->normal_exp--; ++ } ++ } ++ else ++ { ++ tmp->sign = a->sign; ++ tmp->normal_exp = a_normal_exp; ++ tmp->fraction.ll = a_fraction + b_fraction; ++ } ++ tmp->class = CLASS_NUMBER; ++ /* Now the fraction is added, we have to shift down to renormalize the ++ number */ ++ ++ if (tmp->fraction.ll >= IMPLICIT_2) ++ { ++ LSHIFT (tmp->fraction.ll); ++ tmp->normal_exp++; ++ } ++ return tmp; ++ ++} ++ ++FLO_type ++add (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ fp_number_type tmp; ++ fp_number_type *res; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ res = _fpadd_parts (&a, &b, &tmp); ++ ++ return pack_d (res); ++} ++ ++FLO_type ++sub (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ fp_number_type tmp; ++ fp_number_type *res; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ b.sign ^= 1; ++ ++ res = _fpadd_parts (&a, &b, &tmp); ++ ++ return pack_d (res); ++} ++#endif /* L_addsub_sf || L_addsub_df */ ++ ++#if defined(L_mul_sf) || defined(L_mul_df) || defined(L_mul_tf) ++static inline __attribute__ ((__always_inline__)) fp_number_type * ++_fpmul_parts ( fp_number_type * a, ++ fp_number_type * b, ++ fp_number_type * tmp) ++{ ++ fractype low = 0; ++ fractype high = 0; ++ ++ if (isnan (a)) ++ { ++ a->sign = a->sign != b->sign; ++ return a; ++ } ++ if (isnan (b)) ++ { ++ b->sign = a->sign != b->sign; ++ return b; ++ } ++ if (isinf (a)) ++ { ++ if (iszero (b)) ++ return nan (); ++ a->sign = a->sign != b->sign; ++ return a; ++ } ++ if (isinf (b)) ++ { ++ if (iszero (a)) ++ { ++ return nan (); ++ } ++ b->sign = a->sign != b->sign; ++ return b; ++ } ++ if (iszero (a)) ++ { ++ a->sign = a->sign != b->sign; ++ return a; ++ } ++ if (iszero (b)) ++ { ++ b->sign = a->sign != b->sign; ++ return b; ++ } ++ ++ /* Calculate the mantissa by multiplying both numbers to get a ++ twice-as-wide number. */ ++ { ++#if defined(NO_DI_MODE) || defined(TFLOAT) ++ { ++ fractype x = a->fraction.ll; ++ fractype ylow = b->fraction.ll; ++ fractype yhigh = 0; ++ int bit; ++ ++ /* ??? This does multiplies one bit at a time. Optimize. */ ++ for (bit = 0; bit < FRAC_NBITS; bit++) ++ { ++ int carry; ++ ++ if (x & 1) ++ { ++ carry = (low += ylow) < ylow; ++ high += yhigh + carry; ++ } ++ yhigh <<= 1; ++ if (ylow & FRACHIGH) ++ { ++ yhigh |= 1; ++ } ++ ylow <<= 1; ++ x >>= 1; ++ } ++ } ++#elif defined(FLOAT) ++ /* Multiplying two USIs to get a UDI, we're safe. */ ++ { ++ UDItype answer = (UDItype)a->fraction.ll * (UDItype)b->fraction.ll; ++ ++ high = answer >> BITS_PER_SI; ++ low = answer; ++ } ++#else ++ /* fractype is DImode, but we need the result to be twice as wide. ++ Assuming a widening multiply from DImode to TImode is not ++ available, build one by hand. */ ++ { ++ USItype nl = a->fraction.ll; ++ USItype nh = a->fraction.ll >> BITS_PER_SI; ++ USItype ml = b->fraction.ll; ++ USItype mh = b->fraction.ll >> BITS_PER_SI; ++ UDItype pp_ll = (UDItype) ml * nl; ++ UDItype pp_hl = (UDItype) mh * nl; ++ UDItype pp_lh = (UDItype) ml * nh; ++ UDItype pp_hh = (UDItype) mh * nh; ++ UDItype res2 = 0; ++ UDItype res0 = 0; ++ UDItype ps_hh__ = pp_hl + pp_lh; ++ if (ps_hh__ < pp_hl) ++ res2 += (UDItype)1 << BITS_PER_SI; ++ pp_hl = (UDItype)(USItype)ps_hh__ << BITS_PER_SI; ++ res0 = pp_ll + pp_hl; ++ if (res0 < pp_ll) ++ res2++; ++ res2 += (ps_hh__ >> BITS_PER_SI) + pp_hh; ++ high = res2; ++ low = res0; ++ } ++#endif ++ } ++ ++ tmp->normal_exp = a->normal_exp + b->normal_exp ++ + FRAC_NBITS - (FRACBITS + NGARDS); ++ tmp->sign = a->sign != b->sign; ++ while (high >= IMPLICIT_2) ++ { ++ tmp->normal_exp++; ++ if (high & 1) ++ { ++ low >>= 1; ++ low |= FRACHIGH; ++ } ++ high >>= 1; ++ } ++ while (high < IMPLICIT_1) ++ { ++ tmp->normal_exp--; ++ ++ high <<= 1; ++ if (low & FRACHIGH) ++ high |= 1; ++ low <<= 1; ++ } ++ /* rounding is tricky. if we only round if it won't make us round later. */ ++#if 0 ++ if (low & FRACHIGH2) ++ { ++ if (((high & GARDMASK) != GARDMSB) ++ && (((high + 1) & GARDMASK) == GARDMSB)) ++ { ++ /* don't round, it gets done again later. */ ++ } ++ else ++ { ++ high++; ++ } ++ } ++#endif ++ if (!ROUND_TOWARDS_ZERO && (high & GARDMASK) == GARDMSB) ++ { ++ if (high & (1 << NGARDS)) ++ { ++ /* half way, so round to even */ ++ high += GARDROUND + 1; ++ } ++ else if (low) ++ { ++ /* but we really weren't half way */ ++ high += GARDROUND + 1; ++ } ++ } ++ tmp->fraction.ll = high; ++ tmp->class = CLASS_NUMBER; ++ return tmp; ++} ++ ++FLO_type ++multiply (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ fp_number_type tmp; ++ fp_number_type *res; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ res = _fpmul_parts (&a, &b, &tmp); ++ ++ return pack_d (res); ++} ++#endif /* L_mul_sf || L_mul_df */ ++ ++#if defined(L_div_sf) || defined(L_div_df) || defined(L_div_tf) ++static inline __attribute__ ((__always_inline__)) fp_number_type * ++_fpdiv_parts (fp_number_type * a, ++ fp_number_type * b) ++{ ++ fractype bit; ++ fractype numerator; ++ fractype denominator; ++ fractype quotient; ++ ++ if (isnan (a)) ++ { ++ return a; ++ } ++ if (isnan (b)) ++ { ++ return b; ++ } ++ ++ a->sign = a->sign ^ b->sign; ++ ++ if (isinf (a) || iszero (a)) ++ { ++ if (a->class == b->class) ++ return nan (); ++ return a; ++ } ++ ++ if (isinf (b)) ++ { ++ a->fraction.ll = 0; ++ a->normal_exp = 0; ++ return a; ++ } ++ if (iszero (b)) ++ { ++ a->class = CLASS_INFINITY; ++ return a; ++ } ++ ++ /* Calculate the mantissa by multiplying both 64bit numbers to get a ++ 128 bit number */ ++ { ++ /* quotient = ++ ( numerator / denominator) * 2^(numerator exponent - denominator exponent) ++ */ ++ ++ a->normal_exp = a->normal_exp - b->normal_exp; ++ numerator = a->fraction.ll; ++ denominator = b->fraction.ll; ++ ++ if (numerator < denominator) ++ { ++ /* Fraction will be less than 1.0 */ ++ numerator *= 2; ++ a->normal_exp--; ++ } ++ bit = IMPLICIT_1; ++ quotient = 0; ++ /* ??? Does divide one bit at a time. Optimize. */ ++ while (bit) ++ { ++ if (numerator >= denominator) ++ { ++ quotient |= bit; ++ numerator -= denominator; ++ } ++ bit >>= 1; ++ numerator *= 2; ++ } ++ ++ if (!ROUND_TOWARDS_ZERO && (quotient & GARDMASK) == GARDMSB) ++ { ++ if (quotient & (1 << NGARDS)) ++ { ++ /* half way, so round to even */ ++ quotient += GARDROUND + 1; ++ } ++ else if (numerator) ++ { ++ /* but we really weren't half way, more bits exist */ ++ quotient += GARDROUND + 1; ++ } ++ } ++ ++ a->fraction.ll = quotient; ++ return (a); ++ } ++} ++ ++FLO_type ++divide (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ fp_number_type *res; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ res = _fpdiv_parts (&a, &b); ++ ++ return pack_d (res); ++} ++#endif /* L_div_sf || L_div_df */ ++ ++#if defined(L_fpcmp_parts_sf) || defined(L_fpcmp_parts_df) \ ++ || defined(L_fpcmp_parts_tf) ++/* according to the demo, fpcmp returns a comparison with 0... thus ++ a<b -> -1 ++ a==b -> 0 ++ a>b -> +1 ++ */ ++ ++int ++__fpcmp_parts (fp_number_type * a, fp_number_type * b) ++{ ++#if 0 ++ /* either nan -> unordered. Must be checked outside of this routine. */ ++ if (isnan (a) && isnan (b)) ++ { ++ return 1; /* still unordered! */ ++ } ++#endif ++ ++ if (isnan (a) || isnan (b)) ++ { ++ return 1; /* how to indicate unordered compare? */ ++ } ++ if (isinf (a) && isinf (b)) ++ { ++ /* +inf > -inf, but +inf != +inf */ ++ /* b \a| +inf(0)| -inf(1) ++ ______\+--------+-------- ++ +inf(0)| a==b(0)| a<b(-1) ++ -------+--------+-------- ++ -inf(1)| a>b(1) | a==b(0) ++ -------+--------+-------- ++ So since unordered must be nonzero, just line up the columns... ++ */ ++ return b->sign - a->sign; ++ } ++ /* but not both... */ ++ if (isinf (a)) ++ { ++ return a->sign ? -1 : 1; ++ } ++ if (isinf (b)) ++ { ++ return b->sign ? 1 : -1; ++ } ++ if (iszero (a) && iszero (b)) ++ { ++ return 0; ++ } ++ if (iszero (a)) ++ { ++ return b->sign ? 1 : -1; ++ } ++ if (iszero (b)) ++ { ++ return a->sign ? -1 : 1; ++ } ++ /* now both are "normal". */ ++ if (a->sign != b->sign) ++ { ++ /* opposite signs */ ++ return a->sign ? -1 : 1; ++ } ++ /* same sign; exponents? */ ++ if (a->normal_exp > b->normal_exp) ++ { ++ return a->sign ? -1 : 1; ++ } ++ if (a->normal_exp < b->normal_exp) ++ { ++ return a->sign ? 1 : -1; ++ } ++ /* same exponents; check size. */ ++ if (a->fraction.ll > b->fraction.ll) ++ { ++ return a->sign ? -1 : 1; ++ } ++ if (a->fraction.ll < b->fraction.ll) ++ { ++ return a->sign ? 1 : -1; ++ } ++ /* after all that, they're equal. */ ++ return 0; ++} ++#endif ++ ++#if defined(L_compare_sf) || defined(L_compare_df) || defined(L_compoare_tf) ++CMPtype ++compare (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ return __fpcmp_parts (&a, &b); ++} ++#endif /* L_compare_sf || L_compare_df */ ++ ++#ifndef US_SOFTWARE_GOFAST ++ ++/* These should be optimized for their specific tasks someday. */ ++ ++#if defined(L_eq_sf) || defined(L_eq_df) || defined(L_eq_tf) ++CMPtype ++_eq_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return 1; /* false, truth == 0 */ ++ ++ return __fpcmp_parts (&a, &b) ; ++} ++#endif /* L_eq_sf || L_eq_df */ ++ ++#if defined(L_ne_sf) || defined(L_ne_df) || defined(L_ne_tf) ++CMPtype ++_ne_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return 1; /* true, truth != 0 */ ++ ++ return __fpcmp_parts (&a, &b) ; ++} ++#endif /* L_ne_sf || L_ne_df */ ++ ++#if defined(L_gt_sf) || defined(L_gt_df) || defined(L_gt_tf) ++CMPtype ++_gt_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return -1; /* false, truth > 0 */ ++ ++ return __fpcmp_parts (&a, &b); ++} ++#endif /* L_gt_sf || L_gt_df */ ++ ++#if defined(L_ge_sf) || defined(L_ge_df) || defined(L_ge_tf) ++CMPtype ++_ge_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return -1; /* false, truth >= 0 */ ++ return __fpcmp_parts (&a, &b) ; ++} ++#endif /* L_ge_sf || L_ge_df */ ++ ++#if defined(L_lt_sf) || defined(L_lt_df) || defined(L_lt_tf) ++CMPtype ++_lt_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return 1; /* false, truth < 0 */ ++ ++ return __fpcmp_parts (&a, &b); ++} ++#endif /* L_lt_sf || L_lt_df */ ++ ++#if defined(L_le_sf) || defined(L_le_df) || defined(L_le_tf) ++CMPtype ++_le_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return 1; /* false, truth <= 0 */ ++ ++ return __fpcmp_parts (&a, &b) ; ++} ++#endif /* L_le_sf || L_le_df */ ++ ++#endif /* ! US_SOFTWARE_GOFAST */ ++ ++#if defined(L_unord_sf) || defined(L_unord_df) || defined(L_unord_tf) ++CMPtype ++_unord_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ return (isnan (&a) || isnan (&b)); ++} ++#endif /* L_unord_sf || L_unord_df */ ++ ++#if defined(L_si_to_sf) || defined(L_si_to_df) || defined(L_si_to_tf) ++FLO_type ++si_to_float (SItype arg_a) ++{ ++ fp_number_type in; ++ ++ in.class = CLASS_NUMBER; ++ in.sign = arg_a < 0; ++ if (!arg_a) ++ { ++ in.class = CLASS_ZERO; ++ } ++ else ++ { ++ in.normal_exp = FRACBITS + NGARDS; ++ if (in.sign) ++ { ++ /* Special case for minint, since there is no +ve integer ++ representation for it */ ++ if (arg_a == (- MAX_SI_INT - 1)) ++ { ++ return (FLO_type)(- MAX_SI_INT - 1); ++ } ++ in.fraction.ll = (-arg_a); ++ } ++ else ++ in.fraction.ll = arg_a; ++ ++ while (in.fraction.ll < ((fractype)1 << (FRACBITS + NGARDS))) ++ { ++ in.fraction.ll <<= 1; ++ in.normal_exp -= 1; ++ } ++ } ++ return pack_d (&in); ++} ++#endif /* L_si_to_sf || L_si_to_df */ ++ ++#if defined(L_usi_to_sf) || defined(L_usi_to_df) || defined(L_usi_to_tf) ++FLO_type ++usi_to_float (USItype arg_a) ++{ ++ fp_number_type in; ++ ++ in.sign = 0; ++ if (!arg_a) ++ { ++ in.class = CLASS_ZERO; ++ } ++ else ++ { ++ in.class = CLASS_NUMBER; ++ in.normal_exp = FRACBITS + NGARDS; ++ in.fraction.ll = arg_a; ++ ++ while (in.fraction.ll > ((fractype)1 << (FRACBITS + NGARDS))) ++ { ++ in.fraction.ll >>= 1; ++ in.normal_exp += 1; ++ } ++ while (in.fraction.ll < ((fractype)1 << (FRACBITS + NGARDS))) ++ { ++ in.fraction.ll <<= 1; ++ in.normal_exp -= 1; ++ } ++ } ++ return pack_d (&in); ++} ++#endif ++ ++#if defined(L_sf_to_si) || defined(L_df_to_si) || defined(L_tf_to_si) ++SItype ++float_to_si (FLO_type arg_a) ++{ ++ fp_number_type a; ++ SItype tmp; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &a); ++ ++ if (iszero (&a)) ++ return 0; ++ if (isnan (&a)) ++ return 0; ++ /* get reasonable MAX_SI_INT... */ ++ if (isinf (&a)) ++ return a.sign ? (-MAX_SI_INT)-1 : MAX_SI_INT; ++ /* it is a number, but a small one */ ++ if (a.normal_exp < 0) ++ return 0; ++ if (a.normal_exp > BITS_PER_SI - 2) ++ return a.sign ? (-MAX_SI_INT)-1 : MAX_SI_INT; ++ tmp = a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp); ++ return a.sign ? (-tmp) : (tmp); ++} ++#endif /* L_sf_to_si || L_df_to_si */ ++ ++#if defined(L_sf_to_usi) || defined(L_df_to_usi) || defined(L_tf_to_usi) ++#if defined US_SOFTWARE_GOFAST || defined(L_tf_to_usi) ++/* While libgcc2.c defines its own __fixunssfsi and __fixunsdfsi routines, ++ we also define them for GOFAST because the ones in libgcc2.c have the ++ wrong names and I'd rather define these here and keep GOFAST CYG-LOC's ++ out of libgcc2.c. We can't define these here if not GOFAST because then ++ there'd be duplicate copies. */ ++ ++USItype ++float_to_usi (FLO_type arg_a) ++{ ++ fp_number_type a; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &a); ++ ++ if (iszero (&a)) ++ return 0; ++ if (isnan (&a)) ++ return 0; ++ /* it is a negative number */ ++ if (a.sign) ++ return 0; ++ /* get reasonable MAX_USI_INT... */ ++ if (isinf (&a)) ++ return MAX_USI_INT; ++ /* it is a number, but a small one */ ++ if (a.normal_exp < 0) ++ return 0; ++ if (a.normal_exp > BITS_PER_SI - 1) ++ return MAX_USI_INT; ++ else if (a.normal_exp > (FRACBITS + NGARDS)) ++ return a.fraction.ll << (a.normal_exp - (FRACBITS + NGARDS)); ++ else ++ return a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp); ++} ++#endif /* US_SOFTWARE_GOFAST */ ++#endif /* L_sf_to_usi || L_df_to_usi */ ++ ++#if defined(L_negate_sf) || defined(L_negate_df) || defined(L_negate_tf) ++FLO_type ++negate (FLO_type arg_a) ++{ ++ fp_number_type a; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &a); ++ ++ flip_sign (&a); ++ return pack_d (&a); ++} ++#endif /* L_negate_sf || L_negate_df */ ++ ++#ifdef FLOAT ++ ++#if defined(L_make_sf) ++SFtype ++__make_fp(fp_class_type class, ++ unsigned int sign, ++ int exp, ++ USItype frac) ++{ ++ fp_number_type in; ++ ++ in.class = class; ++ in.sign = sign; ++ in.normal_exp = exp; ++ in.fraction.ll = frac; ++ return pack_d (&in); ++} ++#endif /* L_make_sf */ ++ ++#ifndef FLOAT_ONLY ++ ++/* This enables one to build an fp library that supports float but not double. ++ Otherwise, we would get an undefined reference to __make_dp. ++ This is needed for some 8-bit ports that can't handle well values that ++ are 8-bytes in size, so we just don't support double for them at all. */ ++ ++#if defined(L_sf_to_df) ++DFtype ++sf_to_df (SFtype arg_a) ++{ ++ fp_number_type in; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ return __make_dp (in.class, in.sign, in.normal_exp, ++ ((UDItype) in.fraction.ll) << F_D_BITOFF); ++} ++#endif /* L_sf_to_df */ ++ ++#if defined(L_sf_to_tf) && defined(TMODES) ++TFtype ++sf_to_tf (SFtype arg_a) ++{ ++ fp_number_type in; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ return __make_tp (in.class, in.sign, in.normal_exp, ++ ((UTItype) in.fraction.ll) << F_T_BITOFF); ++} ++#endif /* L_sf_to_df */ ++ ++#endif /* ! FLOAT_ONLY */ ++#endif /* FLOAT */ ++ ++#ifndef FLOAT ++ ++extern SFtype __make_fp (fp_class_type, unsigned int, int, USItype); ++ ++#if defined(L_make_df) ++DFtype ++__make_dp (fp_class_type class, unsigned int sign, int exp, UDItype frac) ++{ ++ fp_number_type in; ++ ++ in.class = class; ++ in.sign = sign; ++ in.normal_exp = exp; ++ in.fraction.ll = frac; ++ return pack_d (&in); ++} ++#endif /* L_make_df */ ++ ++#if defined(L_df_to_sf) ++SFtype ++df_to_sf (DFtype arg_a) ++{ ++ fp_number_type in; ++ USItype sffrac; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ sffrac = in.fraction.ll >> F_D_BITOFF; ++ ++ /* We set the lowest guard bit in SFFRAC if we discarded any non ++ zero bits. */ ++ if ((in.fraction.ll & (((USItype) 1 << F_D_BITOFF) - 1)) != 0) ++ sffrac |= 1; ++ ++ return __make_fp (in.class, in.sign, in.normal_exp, sffrac); ++} ++#endif /* L_df_to_sf */ ++ ++#if defined(L_df_to_tf) && defined(TMODES) \ ++ && !defined(FLOAT) && !defined(TFLOAT) ++TFtype ++df_to_tf (DFtype arg_a) ++{ ++ fp_number_type in; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ return __make_tp (in.class, in.sign, in.normal_exp, ++ ((UTItype) in.fraction.ll) << D_T_BITOFF); ++} ++#endif /* L_sf_to_df */ ++ ++#ifdef TFLOAT ++#if defined(L_make_tf) ++TFtype ++__make_tp(fp_class_type class, ++ unsigned int sign, ++ int exp, ++ UTItype frac) ++{ ++ fp_number_type in; ++ ++ in.class = class; ++ in.sign = sign; ++ in.normal_exp = exp; ++ in.fraction.ll = frac; ++ return pack_d (&in); ++} ++#endif /* L_make_tf */ ++ ++#if defined(L_tf_to_df) ++DFtype ++tf_to_df (TFtype arg_a) ++{ ++ fp_number_type in; ++ UDItype sffrac; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ sffrac = in.fraction.ll >> D_T_BITOFF; ++ ++ /* We set the lowest guard bit in SFFRAC if we discarded any non ++ zero bits. */ ++ if ((in.fraction.ll & (((UTItype) 1 << D_T_BITOFF) - 1)) != 0) ++ sffrac |= 1; ++ ++ return __make_dp (in.class, in.sign, in.normal_exp, sffrac); ++} ++#endif /* L_tf_to_df */ ++ ++#if defined(L_tf_to_sf) ++SFtype ++tf_to_sf (TFtype arg_a) ++{ ++ fp_number_type in; ++ USItype sffrac; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ sffrac = in.fraction.ll >> F_T_BITOFF; ++ ++ /* We set the lowest guard bit in SFFRAC if we discarded any non ++ zero bits. */ ++ if ((in.fraction.ll & (((UTItype) 1 << F_T_BITOFF) - 1)) != 0) ++ sffrac |= 1; ++ ++ return __make_fp (in.class, in.sign, in.normal_exp, sffrac); ++} ++#endif /* L_tf_to_sf */ ++#endif /* TFLOAT */ ++ ++#endif /* ! FLOAT */ ++#endif /* !EXTENDED_FLOAT_STUBS */ +--- gcc-3.4.3/gcc/config/nios2/nios2-protos.h ++++ gcc-3.4.3-nios2/gcc/config/nios2/nios2-protos.h +@@ -0,0 +1,70 @@ ++/* Subroutines for assembler code output for Altera NIOS 2G NIOS2 version. ++ Copyright (C) 2003 Altera ++ Contributed by Jonah Graham (jgraham@altera.com). ++ ++This file is part of GNU CC. ++ ++GNU CC is free software; you can redistribute it and/or modify ++it under the terms of the GNU General Public License as published by ++the Free Software Foundation; either version 2, or (at your option) ++any later version. ++ ++GNU CC is distributed in the hope that it will be useful, ++but WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++GNU General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GNU CC; see the file COPYING. If not, write to ++the Free Software Foundation, 59 Temple Place - Suite 330, ++Boston, MA 02111-1307, USA. */ ++ ++extern void dump_frame_size (FILE *); ++extern HOST_WIDE_INT compute_frame_size (void); ++extern int nios2_initial_elimination_offset (int, int); ++extern void override_options (void); ++extern void optimization_options (int, int); ++extern int nios2_can_use_return_insn (void); ++extern void expand_prologue (void); ++extern void expand_epilogue (bool); ++extern void function_profiler (FILE *, int); ++ ++ ++#ifdef RTX_CODE ++extern int nios2_legitimate_address (rtx, enum machine_mode, int); ++extern void nios2_print_operand (FILE *, rtx, int); ++extern void nios2_print_operand_address (FILE *, rtx); ++ ++extern int nios2_emit_move_sequence (rtx *, enum machine_mode); ++extern int nios2_emit_expensive_div (rtx *, enum machine_mode); ++ ++extern void gen_int_relational (enum rtx_code, rtx, rtx, rtx, rtx); ++extern void gen_conditional_move (rtx *, enum machine_mode); ++extern const char *asm_output_opcode (FILE *, const char *); ++ ++/* predicates */ ++extern int arith_operand (rtx, enum machine_mode); ++extern int uns_arith_operand (rtx, enum machine_mode); ++extern int logical_operand (rtx, enum machine_mode); ++extern int shift_operand (rtx, enum machine_mode); ++extern int reg_or_0_operand (rtx, enum machine_mode); ++extern int equality_op (rtx, enum machine_mode); ++extern int custom_insn_opcode (rtx, enum machine_mode); ++extern int rdwrctl_operand (rtx, enum machine_mode); ++ ++# ifdef HAVE_MACHINE_MODES ++# if defined TREE_CODE ++extern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree, int); ++extern rtx function_arg (const CUMULATIVE_ARGS *, enum machine_mode, tree, int); ++extern int function_arg_partial_nregs (const CUMULATIVE_ARGS *, enum machine_mode, tree, int); ++extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, int); ++extern int nios2_setup_incoming_varargs (const CUMULATIVE_ARGS *, enum machine_mode, tree, int); ++ ++# endif /* TREE_CODE */ ++# endif /* HAVE_MACHINE_MODES */ ++#endif ++ ++#ifdef TREE_CODE ++extern int nios2_return_in_memory (tree); ++ ++#endif /* TREE_CODE */ +--- gcc-3.4.3/gcc/config/nios2/nios2.c ++++ gcc-3.4.3-nios2/gcc/config/nios2/nios2.c +@@ -0,0 +1,2853 @@ ++/* Subroutines for assembler code output for Altera NIOS 2G NIOS2 version. ++ Copyright (C) 2003 Altera ++ Contributed by Jonah Graham (jgraham@altera.com). ++ ++This file is part of GNU CC. ++ ++GNU CC is free software; you can redistribute it and/or modify ++it under the terms of the GNU General Public License as published by ++the Free Software Foundation; either version 2, or (at your option) ++any later version. ++ ++GNU CC is distributed in the hope that it will be useful, ++but WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++GNU General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GNU CC; see the file COPYING. If not, write to ++the Free Software Foundation, 59 Temple Place - Suite 330, ++Boston, MA 02111-1307, USA. */ ++ ++ ++#include <stdio.h> ++#include "config.h" ++#include "system.h" ++#include "coretypes.h" ++#include "tm.h" ++#include "rtl.h" ++#include "tree.h" ++#include "tm_p.h" ++#include "regs.h" ++#include "hard-reg-set.h" ++#include "real.h" ++#include "insn-config.h" ++#include "conditions.h" ++#include "output.h" ++#include "insn-attr.h" ++#include "flags.h" ++#include "recog.h" ++#include "expr.h" ++#include "toplev.h" ++#include "basic-block.h" ++#include "function.h" ++#include "ggc.h" ++#include "reload.h" ++#include "debug.h" ++#include "optabs.h" ++#include "target.h" ++#include "target-def.h" ++ ++/* local prototypes */ ++static bool nios2_rtx_costs (rtx, int, int, int *); ++ ++static void nios2_asm_function_prologue (FILE *, HOST_WIDE_INT); ++static int nios2_use_dfa_pipeline_interface (void); ++static int nios2_issue_rate (void); ++static struct machine_function *nios2_init_machine_status (void); ++static bool nios2_in_small_data_p (tree); ++static rtx save_reg (int, HOST_WIDE_INT, rtx); ++static rtx restore_reg (int, HOST_WIDE_INT); ++static unsigned int nios2_section_type_flags (tree, const char *, int); ++static void nios2_init_builtins (void); ++static rtx nios2_expand_builtin (tree, rtx, rtx, enum machine_mode, int); ++static bool nios2_function_ok_for_sibcall (tree, tree); ++static void nios2_encode_section_info (tree, rtx, int); ++ ++/* Initialize the GCC target structure. */ ++#undef TARGET_ASM_FUNCTION_PROLOGUE ++#define TARGET_ASM_FUNCTION_PROLOGUE nios2_asm_function_prologue ++ ++#undef TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE ++#define TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE \ ++ nios2_use_dfa_pipeline_interface ++#undef TARGET_SCHED_ISSUE_RATE ++#define TARGET_SCHED_ISSUE_RATE nios2_issue_rate ++#undef TARGET_IN_SMALL_DATA_P ++#define TARGET_IN_SMALL_DATA_P nios2_in_small_data_p ++#undef TARGET_ENCODE_SECTION_INFO ++#define TARGET_ENCODE_SECTION_INFO nios2_encode_section_info ++#undef TARGET_SECTION_TYPE_FLAGS ++#define TARGET_SECTION_TYPE_FLAGS nios2_section_type_flags ++ ++#undef TARGET_INIT_BUILTINS ++#define TARGET_INIT_BUILTINS nios2_init_builtins ++#undef TARGET_EXPAND_BUILTIN ++#define TARGET_EXPAND_BUILTIN nios2_expand_builtin ++ ++#undef TARGET_FUNCTION_OK_FOR_SIBCALL ++#define TARGET_FUNCTION_OK_FOR_SIBCALL nios2_function_ok_for_sibcall ++ ++#undef TARGET_RTX_COSTS ++#define TARGET_RTX_COSTS nios2_rtx_costs ++ ++ ++struct gcc_target targetm = TARGET_INITIALIZER; ++ ++ ++ ++/* Threshold for data being put into the small data/bss area, instead ++ of the normal data area (references to the small data/bss area take ++ 1 instruction, and use the global pointer, references to the normal ++ data area takes 2 instructions). */ ++unsigned HOST_WIDE_INT nios2_section_threshold = NIOS2_DEFAULT_GVALUE; ++ ++ ++/* Structure to be filled in by compute_frame_size with register ++ save masks, and offsets for the current function. */ ++ ++struct nios2_frame_info ++GTY (()) ++{ ++ long total_size; /* # bytes that the entire frame takes up */ ++ long var_size; /* # bytes that variables take up */ ++ long args_size; /* # bytes that outgoing arguments take up */ ++ int save_reg_size; /* # bytes needed to store gp regs */ ++ int save_reg_rounded; /* # bytes needed to store gp regs */ ++ long save_regs_offset; /* offset from new sp to store gp registers */ ++ int initialized; /* != 0 if frame size already calculated */ ++ int num_regs; /* number of gp registers saved */ ++}; ++ ++struct machine_function ++GTY (()) ++{ ++ ++ /* Current frame information, calculated by compute_frame_size. */ ++ struct nios2_frame_info frame; ++}; ++ ++ ++/*************************************** ++ * Section encodings ++ ***************************************/ ++ ++ ++ ++ ++ ++/*************************************** ++ * Stack Layout and Calling Conventions ++ ***************************************/ ++ ++ ++#define TOO_BIG_OFFSET(X) ((X) > ((1 << 15) - 1)) ++#define TEMP_REG_NUM 8 ++ ++static void ++nios2_asm_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED) ++{ ++ if (flag_verbose_asm || flag_debug_asm) ++ { ++ compute_frame_size (); ++ dump_frame_size (file); ++ } ++} ++ ++static rtx ++save_reg (int regno, HOST_WIDE_INT offset, rtx cfa_store_reg) ++{ ++ rtx insn, stack_slot; ++ ++ stack_slot = gen_rtx_PLUS (SImode, ++ cfa_store_reg, ++ GEN_INT (offset)); ++ ++ insn = emit_insn (gen_rtx_SET (SImode, ++ gen_rtx_MEM (SImode, stack_slot), ++ gen_rtx_REG (SImode, regno))); ++ ++ RTX_FRAME_RELATED_P (insn) = 1; ++ ++ return insn; ++} ++ ++static rtx ++restore_reg (int regno, HOST_WIDE_INT offset) ++{ ++ rtx insn, stack_slot; ++ ++ if (TOO_BIG_OFFSET (offset)) ++ { ++ stack_slot = gen_rtx_REG (SImode, TEMP_REG_NUM); ++ insn = emit_insn (gen_rtx_SET (SImode, ++ stack_slot, ++ GEN_INT (offset))); ++ ++ insn = emit_insn (gen_rtx_SET (SImode, ++ stack_slot, ++ gen_rtx_PLUS (SImode, ++ stack_slot, ++ stack_pointer_rtx))); ++ } ++ else ++ { ++ stack_slot = gen_rtx_PLUS (SImode, ++ stack_pointer_rtx, ++ GEN_INT (offset)); ++ } ++ ++ stack_slot = gen_rtx_MEM (SImode, stack_slot); ++ ++ insn = emit_move_insn (gen_rtx_REG (SImode, regno), stack_slot); ++ ++ return insn; ++} ++ ++ ++/* There are two possible paths for prologue expansion, ++- the first is if the total frame size is < 2^15-1. In that ++case all the immediates will fit into the 16-bit immediate ++fields. ++- the second is when the frame size is too big, in that ++case an additional temporary register is used, first ++as a cfa_temp to offset the sp, second as the cfa_store ++register. ++ ++See the comment above dwarf2out_frame_debug_expr in ++dwarf2out.c for more explanation of the "rules." ++ ++ ++Case 1: ++Rule # Example Insn Effect ++2 addi sp, sp, -total_frame_size cfa.reg=sp, cfa.offset=total_frame_size ++ cfa_store.reg=sp, cfa_store.offset=total_frame_size ++12 stw ra, offset(sp) ++12 stw r16, offset(sp) ++1 mov fp, sp ++ ++Case 2: ++Rule # Example Insn Effect ++6 movi r8, total_frame_size cfa_temp.reg=r8, cfa_temp.offset=total_frame_size ++2 sub sp, sp, r8 cfa.reg=sp, cfa.offset=total_frame_size ++ cfa_store.reg=sp, cfa_store.offset=total_frame_size ++5 add r8, r8, sp cfa_store.reg=r8, cfa_store.offset=0 ++12 stw ra, offset(r8) ++12 stw r16, offset(r8) ++1 mov fp, sp ++ ++*/ ++ ++void ++expand_prologue () ++{ ++ int i; ++ HOST_WIDE_INT total_frame_size; ++ int cfa_store_offset; ++ rtx insn; ++ rtx cfa_store_reg = 0; ++ ++ total_frame_size = compute_frame_size (); ++ ++ if (total_frame_size) ++ { ++ ++ if (TOO_BIG_OFFSET (total_frame_size)) ++ { ++ /* cfa_temp and cfa_store_reg are the same register, ++ cfa_store_reg overwrites cfa_temp */ ++ cfa_store_reg = gen_rtx_REG (SImode, TEMP_REG_NUM); ++ insn = emit_insn (gen_rtx_SET (SImode, ++ cfa_store_reg, ++ GEN_INT (total_frame_size))); ++ ++ RTX_FRAME_RELATED_P (insn) = 1; ++ ++ ++ insn = gen_rtx_SET (SImode, ++ stack_pointer_rtx, ++ gen_rtx_MINUS (SImode, ++ stack_pointer_rtx, ++ cfa_store_reg)); ++ ++ insn = emit_insn (insn); ++ RTX_FRAME_RELATED_P (insn) = 1; ++ ++ ++ /* if there are no registers to save, I don't need to ++ create a cfa_store */ ++ if (cfun->machine->frame.save_reg_size) ++ { ++ insn = gen_rtx_SET (SImode, ++ cfa_store_reg, ++ gen_rtx_PLUS (SImode, ++ cfa_store_reg, ++ stack_pointer_rtx)); ++ ++ insn = emit_insn (insn); ++ RTX_FRAME_RELATED_P (insn) = 1; ++ } ++ ++ cfa_store_offset ++ = total_frame_size ++ - (cfun->machine->frame.save_regs_offset ++ + cfun->machine->frame.save_reg_rounded); ++ } ++ else ++ { ++ insn = gen_rtx_SET (SImode, ++ stack_pointer_rtx, ++ gen_rtx_PLUS (SImode, ++ stack_pointer_rtx, ++ GEN_INT (-total_frame_size))); ++ insn = emit_insn (insn); ++ RTX_FRAME_RELATED_P (insn) = 1; ++ ++ cfa_store_reg = stack_pointer_rtx; ++ cfa_store_offset ++ = cfun->machine->frame.save_regs_offset ++ + cfun->machine->frame.save_reg_rounded; ++ } ++ } ++ ++ if (MUST_SAVE_REGISTER (RA_REGNO)) ++ { ++ cfa_store_offset -= 4; ++ save_reg (RA_REGNO, cfa_store_offset, cfa_store_reg); ++ } ++ if (MUST_SAVE_REGISTER (FP_REGNO)) ++ { ++ cfa_store_offset -= 4; ++ save_reg (FP_REGNO, cfa_store_offset, cfa_store_reg); ++ } ++ ++ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) ++ { ++ if (MUST_SAVE_REGISTER (i) && i != FP_REGNO && i != RA_REGNO) ++ { ++ cfa_store_offset -= 4; ++ save_reg (i, cfa_store_offset, cfa_store_reg); ++ } ++ } ++ ++ if (frame_pointer_needed) ++ { ++ insn = emit_insn (gen_rtx_SET (SImode, ++ gen_rtx_REG (SImode, FP_REGNO), ++ gen_rtx_REG (SImode, SP_REGNO))); ++ ++ RTX_FRAME_RELATED_P (insn) = 1; ++ } ++ ++ /* If we are profiling, make sure no instructions are scheduled before ++ the call to mcount. */ ++ if (current_function_profile) ++ emit_insn (gen_blockage ()); ++} ++ ++void ++expand_epilogue (bool sibcall_p) ++{ ++ rtx insn; ++ int i; ++ HOST_WIDE_INT total_frame_size; ++ int register_store_offset; ++ ++ total_frame_size = compute_frame_size (); ++ ++ if (!sibcall_p && nios2_can_use_return_insn ()) ++ { ++ insn = emit_jump_insn (gen_return ()); ++ return; ++ } ++ ++ emit_insn (gen_blockage ()); ++ ++ register_store_offset = ++ cfun->machine->frame.save_regs_offset + ++ cfun->machine->frame.save_reg_rounded; ++ ++ if (MUST_SAVE_REGISTER (RA_REGNO)) ++ { ++ register_store_offset -= 4; ++ restore_reg (RA_REGNO, register_store_offset); ++ } ++ ++ if (MUST_SAVE_REGISTER (FP_REGNO)) ++ { ++ register_store_offset -= 4; ++ restore_reg (FP_REGNO, register_store_offset); ++ } ++ ++ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) ++ { ++ if (MUST_SAVE_REGISTER (i) && i != FP_REGNO && i != RA_REGNO) ++ { ++ register_store_offset -= 4; ++ restore_reg (i, register_store_offset); ++ } ++ } ++ ++ if (total_frame_size) ++ { ++ rtx sp_adjust; ++ ++ if (TOO_BIG_OFFSET (total_frame_size)) ++ { ++ sp_adjust = gen_rtx_REG (SImode, TEMP_REG_NUM); ++ insn = emit_insn (gen_rtx_SET (SImode, ++ sp_adjust, ++ GEN_INT (total_frame_size))); ++ ++ } ++ else ++ { ++ sp_adjust = GEN_INT (total_frame_size); ++ } ++ ++ insn = gen_rtx_SET (SImode, ++ stack_pointer_rtx, ++ gen_rtx_PLUS (SImode, ++ stack_pointer_rtx, ++ sp_adjust)); ++ insn = emit_insn (insn); ++ } ++ ++ ++ if (!sibcall_p) ++ { ++ insn = emit_jump_insn (gen_return_from_epilogue (gen_rtx (REG, Pmode, ++ RA_REGNO))); ++ } ++} ++ ++ ++bool ++nios2_function_ok_for_sibcall (tree a ATTRIBUTE_UNUSED, tree b ATTRIBUTE_UNUSED) ++{ ++ return true; ++} ++ ++ ++ ++ ++ ++/* ----------------------- * ++ * Profiling ++ * ----------------------- */ ++ ++void ++function_profiler (FILE *file, int labelno) ++{ ++ fprintf (file, "\t%s mcount begin, label: .LP%d\n", ++ ASM_COMMENT_START, labelno); ++ fprintf (file, "\tnextpc\tr8\n"); ++ fprintf (file, "\tmov\tr9, ra\n"); ++ fprintf (file, "\tmovhi\tr10, %%hiadj(.LP%d)\n", labelno); ++ fprintf (file, "\taddi\tr10, r10, %%lo(.LP%d)\n", labelno); ++ fprintf (file, "\tcall\tmcount\n"); ++ fprintf (file, "\tmov\tra, r9\n"); ++ fprintf (file, "\t%s mcount end\n", ASM_COMMENT_START); ++} ++ ++ ++/*************************************** ++ * Stack Layout ++ ***************************************/ ++ ++ ++void ++dump_frame_size (FILE *file) ++{ ++ fprintf (file, "\t%s Current Frame Info\n", ASM_COMMENT_START); ++ ++ fprintf (file, "\t%s total_size = %ld\n", ASM_COMMENT_START, ++ cfun->machine->frame.total_size); ++ fprintf (file, "\t%s var_size = %ld\n", ASM_COMMENT_START, ++ cfun->machine->frame.var_size); ++ fprintf (file, "\t%s args_size = %ld\n", ASM_COMMENT_START, ++ cfun->machine->frame.args_size); ++ fprintf (file, "\t%s save_reg_size = %d\n", ASM_COMMENT_START, ++ cfun->machine->frame.save_reg_size); ++ fprintf (file, "\t%s save_reg_rounded = %d\n", ASM_COMMENT_START, ++ cfun->machine->frame.save_reg_rounded); ++ fprintf (file, "\t%s initialized = %d\n", ASM_COMMENT_START, ++ cfun->machine->frame.initialized); ++ fprintf (file, "\t%s num_regs = %d\n", ASM_COMMENT_START, ++ cfun->machine->frame.num_regs); ++ fprintf (file, "\t%s save_regs_offset = %ld\n", ASM_COMMENT_START, ++ cfun->machine->frame.save_regs_offset); ++ fprintf (file, "\t%s current_function_is_leaf = %d\n", ASM_COMMENT_START, ++ current_function_is_leaf); ++ fprintf (file, "\t%s frame_pointer_needed = %d\n", ASM_COMMENT_START, ++ frame_pointer_needed); ++ fprintf (file, "\t%s pretend_args_size = %d\n", ASM_COMMENT_START, ++ current_function_pretend_args_size); ++ ++} ++ ++ ++/* Return the bytes needed to compute the frame pointer from the current ++ stack pointer. ++*/ ++ ++HOST_WIDE_INT ++compute_frame_size () ++{ ++ unsigned int regno; ++ HOST_WIDE_INT var_size; /* # of var. bytes allocated */ ++ HOST_WIDE_INT total_size; /* # bytes that the entire frame takes up */ ++ HOST_WIDE_INT save_reg_size; /* # bytes needed to store callee save regs */ ++ HOST_WIDE_INT save_reg_rounded; ++ /* # bytes needed to store callee save regs (rounded) */ ++ HOST_WIDE_INT out_args_size; /* # bytes needed for outgoing args */ ++ ++ save_reg_size = 0; ++ var_size = STACK_ALIGN (get_frame_size ()); ++ out_args_size = STACK_ALIGN (current_function_outgoing_args_size); ++ ++ total_size = var_size + out_args_size; ++ ++ /* Calculate space needed for gp registers. */ ++ for (regno = 0; regno <= FIRST_PSEUDO_REGISTER; regno++) ++ { ++ if (MUST_SAVE_REGISTER (regno)) ++ { ++ save_reg_size += 4; ++ } ++ } ++ ++ save_reg_rounded = STACK_ALIGN (save_reg_size); ++ total_size += save_reg_rounded; ++ ++ total_size += STACK_ALIGN (current_function_pretend_args_size); ++ ++ /* Save other computed information. */ ++ cfun->machine->frame.total_size = total_size; ++ cfun->machine->frame.var_size = var_size; ++ cfun->machine->frame.args_size = current_function_outgoing_args_size; ++ cfun->machine->frame.save_reg_size = save_reg_size; ++ cfun->machine->frame.save_reg_rounded = save_reg_rounded; ++ cfun->machine->frame.initialized = reload_completed; ++ cfun->machine->frame.num_regs = save_reg_size / UNITS_PER_WORD; ++ ++ cfun->machine->frame.save_regs_offset ++ = save_reg_rounded ? current_function_outgoing_args_size + var_size : 0; ++ ++ return total_size; ++} ++ ++ ++int ++nios2_initial_elimination_offset (int from, int to ATTRIBUTE_UNUSED) ++{ ++ int offset; ++ ++ /* Set OFFSET to the offset from the stack pointer. */ ++ switch (from) ++ { ++ case FRAME_POINTER_REGNUM: ++ offset = 0; ++ break; ++ ++ case ARG_POINTER_REGNUM: ++ compute_frame_size (); ++ offset = cfun->machine->frame.total_size; ++ offset -= current_function_pretend_args_size; ++ break; ++ ++ case RETURN_ADDRESS_POINTER_REGNUM: ++ compute_frame_size (); ++ /* since the return address is always the first of the ++ saved registers, return the offset to the beginning ++ of the saved registers block */ ++ offset = cfun->machine->frame.save_regs_offset; ++ break; ++ ++ default: ++ abort (); ++ } ++ ++ return offset; ++} ++ ++/* Return nonzero if this function is known to have a null epilogue. ++ This allows the optimizer to omit jumps to jumps if no stack ++ was created. */ ++int ++nios2_can_use_return_insn () ++{ ++ if (!reload_completed) ++ return 0; ++ ++ if (regs_ever_live[RA_REGNO] || current_function_profile) ++ return 0; ++ ++ if (cfun->machine->frame.initialized) ++ return cfun->machine->frame.total_size == 0; ++ ++ return compute_frame_size () == 0; ++} ++ ++ ++ ++ ++ ++/*************************************** ++ * ++ ***************************************/ ++ ++const char *nios2_sys_nosys_string; /* for -msys=nosys */ ++const char *nios2_sys_lib_string; /* for -msys-lib= */ ++const char *nios2_sys_crt0_string; /* for -msys-crt0= */ ++ ++void ++override_options () ++{ ++ /* Function to allocate machine-dependent function status. */ ++ init_machine_status = &nios2_init_machine_status; ++ ++ nios2_section_threshold ++ = g_switch_set ? g_switch_value : NIOS2_DEFAULT_GVALUE; ++ ++ if (nios2_sys_nosys_string && *nios2_sys_nosys_string) ++ { ++ error ("invalid option '-msys=nosys%s'", nios2_sys_nosys_string); ++ } ++ ++ /* If we don't have mul, we don't have mulx either! */ ++ if (!TARGET_HAS_MUL && TARGET_HAS_MULX) ++ { ++ target_flags &= ~HAS_MULX_FLAG; ++ } ++ ++} ++ ++void ++optimization_options (int level, int size) ++{ ++ if (level || size) ++ { ++ target_flags |= INLINE_MEMCPY_FLAG; ++ } ++ ++ if (level >= 3 && !size) ++ { ++ target_flags |= FAST_SW_DIV_FLAG; ++ } ++} ++ ++/* Allocate a chunk of memory for per-function machine-dependent data. */ ++static struct machine_function * ++nios2_init_machine_status () ++{ ++ return ((struct machine_function *) ++ ggc_alloc_cleared (sizeof (struct machine_function))); ++} ++ ++ ++ ++/***************** ++ * Describing Relative Costs of Operations ++ *****************/ ++ ++/* Compute a (partial) cost for rtx X. Return true if the complete ++ cost has been computed, and false if subexpressions should be ++ scanned. In either case, *TOTAL contains the cost result. */ ++ ++ ++ ++static bool ++nios2_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) ++{ ++ switch (code) ++ { ++ case CONST_INT: ++ if (INTVAL (x) == 0) ++ { ++ *total = COSTS_N_INSNS (0); ++ return true; ++ } ++ else if (SMALL_INT (INTVAL (x)) ++ || SMALL_INT_UNSIGNED (INTVAL (x)) ++ || UPPER16_INT (INTVAL (x))) ++ { ++ *total = COSTS_N_INSNS (2); ++ return true; ++ } ++ else ++ { ++ *total = COSTS_N_INSNS (4); ++ return true; ++ } ++ ++ case LABEL_REF: ++ case SYMBOL_REF: ++ /* ??? gp relative stuff will fit in here */ ++ /* fall through */ ++ case CONST: ++ case CONST_DOUBLE: ++ { ++ *total = COSTS_N_INSNS (4); ++ return true; ++ } ++ ++ case MULT: ++ { ++ *total = COSTS_N_INSNS (1); ++ return false; ++ } ++ case SIGN_EXTEND: ++ { ++ *total = COSTS_N_INSNS (3); ++ return false; ++ } ++ case ZERO_EXTEND: ++ { ++ *total = COSTS_N_INSNS (1); ++ return false; ++ } ++ ++ default: ++ return false; ++ } ++} ++ ++ ++/*************************************** ++ * INSTRUCTION SUPPORT ++ * ++ * These functions are used within the Machine Description to ++ * handle common or complicated output and expansions from ++ * instructions. ++ ***************************************/ ++ ++int ++nios2_emit_move_sequence (rtx *operands, enum machine_mode mode) ++{ ++ rtx to = operands[0]; ++ rtx from = operands[1]; ++ ++ if (!register_operand (to, mode) && !reg_or_0_operand (from, mode)) ++ { ++ if (no_new_pseudos) ++ internal_error ("Trying to force_reg no_new_pseudos == 1"); ++ from = copy_to_mode_reg (mode, from); ++ } ++ ++ operands[0] = to; ++ operands[1] = from; ++ return 0; ++} ++ ++/* Divide Support */ ++ ++/* ++ If -O3 is used, we want to output a table lookup for ++ divides between small numbers (both num and den >= 0 ++ and < 0x10). The overhead of this method in the worse ++ case is 40 bytes in the text section (10 insns) and ++ 256 bytes in the data section. Additional divides do ++ not incur additional penalties in the data section. ++ ++ Code speed is improved for small divides by about 5x ++ when using this method in the worse case (~9 cycles ++ vs ~45). And in the worse case divides not within the ++ table are penalized by about 10% (~5 cycles vs ~45). ++ However in the typical case the penalty is not as bad ++ because doing the long divide in only 45 cycles is ++ quite optimistic. ++ ++ ??? It would be nice to have some benchmarks other ++ than Dhrystone to back this up. ++ ++ This bit of expansion is to create this instruction ++ sequence as rtl. ++ or $8, $4, $5 ++ slli $9, $4, 4 ++ cmpgeui $3, $8, 16 ++ beq $3, $0, .L3 ++ or $10, $9, $5 ++ add $12, $11, divide_table ++ ldbu $2, 0($12) ++ br .L1 ++.L3: ++ call slow_div ++.L1: ++# continue here with result in $2 ++ ++ ??? Ideally I would like the emit libcall block to contain ++ all of this code, but I don't know how to do that. What it ++ means is that if the divide can be eliminated, it may not ++ completely disappear. ++ ++ ??? The __divsi3_table label should ideally be moved out ++ of this block and into a global. If it is placed into the ++ sdata section we can save even more cycles by doing things ++ gp relative. ++*/ ++int ++nios2_emit_expensive_div (rtx *operands, enum machine_mode mode) ++{ ++ rtx or_result, shift_left_result; ++ rtx lookup_value; ++ rtx lab1, lab3; ++ rtx insns; ++ rtx libfunc; ++ rtx final_result; ++ rtx tmp; ++ ++ /* it may look a little generic, but only SImode ++ is supported for now */ ++ if (mode != SImode) ++ abort (); ++ ++ libfunc = sdiv_optab->handlers[(int) SImode].libfunc; ++ ++ ++ ++ lab1 = gen_label_rtx (); ++ lab3 = gen_label_rtx (); ++ ++ or_result = expand_simple_binop (SImode, IOR, ++ operands[1], operands[2], ++ 0, 0, OPTAB_LIB_WIDEN); ++ ++ emit_cmp_and_jump_insns (or_result, GEN_INT (15), GTU, 0, ++ GET_MODE (or_result), 0, lab3); ++ JUMP_LABEL (get_last_insn ()) = lab3; ++ ++ shift_left_result = expand_simple_binop (SImode, ASHIFT, ++ operands[1], GEN_INT (4), ++ 0, 0, OPTAB_LIB_WIDEN); ++ ++ lookup_value = expand_simple_binop (SImode, IOR, ++ shift_left_result, operands[2], ++ 0, 0, OPTAB_LIB_WIDEN); ++ ++ convert_move (operands[0], ++ gen_rtx (MEM, QImode, ++ gen_rtx (PLUS, SImode, ++ lookup_value, ++ gen_rtx_SYMBOL_REF (SImode, "__divsi3_table"))), ++ 1); ++ ++ ++ tmp = emit_jump_insn (gen_jump (lab1)); ++ JUMP_LABEL (tmp) = lab1; ++ emit_barrier (); ++ ++ emit_label (lab3); ++ LABEL_NUSES (lab3) = 1; ++ ++ start_sequence (); ++ final_result = emit_library_call_value (libfunc, NULL_RTX, ++ LCT_CONST, SImode, 2, ++ operands[1], SImode, ++ operands[2], SImode); ++ ++ ++ insns = get_insns (); ++ end_sequence (); ++ emit_libcall_block (insns, operands[0], final_result, ++ gen_rtx (DIV, SImode, operands[1], operands[2])); ++ ++ emit_label (lab1); ++ LABEL_NUSES (lab1) = 1; ++ return 1; ++} ++ ++/* Branches/Compares */ ++ ++/* the way of handling branches/compares ++ in gcc is heavily borrowed from MIPS */ ++ ++enum internal_test ++{ ++ ITEST_EQ, ++ ITEST_NE, ++ ITEST_GT, ++ ITEST_GE, ++ ITEST_LT, ++ ITEST_LE, ++ ITEST_GTU, ++ ITEST_GEU, ++ ITEST_LTU, ++ ITEST_LEU, ++ ITEST_MAX ++}; ++ ++static enum internal_test map_test_to_internal_test (enum rtx_code); ++ ++/* Cached operands, and operator to compare for use in set/branch/trap ++ on condition codes. */ ++rtx branch_cmp[2]; ++enum cmp_type branch_type; ++ ++/* Make normal rtx_code into something we can index from an array */ ++ ++static enum internal_test ++map_test_to_internal_test (enum rtx_code test_code) ++{ ++ enum internal_test test = ITEST_MAX; ++ ++ switch (test_code) ++ { ++ case EQ: ++ test = ITEST_EQ; ++ break; ++ case NE: ++ test = ITEST_NE; ++ break; ++ case GT: ++ test = ITEST_GT; ++ break; ++ case GE: ++ test = ITEST_GE; ++ break; ++ case LT: ++ test = ITEST_LT; ++ break; ++ case LE: ++ test = ITEST_LE; ++ break; ++ case GTU: ++ test = ITEST_GTU; ++ break; ++ case GEU: ++ test = ITEST_GEU; ++ break; ++ case LTU: ++ test = ITEST_LTU; ++ break; ++ case LEU: ++ test = ITEST_LEU; ++ break; ++ default: ++ break; ++ } ++ ++ return test; ++} ++ ++/* Generate the code to compare (and possibly branch) two integer values ++ TEST_CODE is the comparison code we are trying to emulate ++ (or implement directly) ++ RESULT is where to store the result of the comparison, ++ or null to emit a branch ++ CMP0 CMP1 are the two comparison operands ++ DESTINATION is the destination of the branch, or null to only compare ++ */ ++ ++void ++gen_int_relational (enum rtx_code test_code, /* relational test (EQ, etc) */ ++ rtx result, /* result to store comp. or 0 if branch */ ++ rtx cmp0, /* first operand to compare */ ++ rtx cmp1, /* second operand to compare */ ++ rtx destination) /* destination of the branch, or 0 if compare */ ++{ ++ struct cmp_info ++ { ++ /* for register (or 0) compares */ ++ enum rtx_code test_code_reg; /* code to use in instruction (LT vs. LTU) */ ++ int reverse_regs; /* reverse registers in test */ ++ ++ /* for immediate compares */ ++ enum rtx_code test_code_const; ++ /* code to use in instruction (LT vs. LTU) */ ++ int const_low; /* low bound of constant we can accept */ ++ int const_high; /* high bound of constant we can accept */ ++ int const_add; /* constant to add */ ++ ++ /* generic info */ ++ int unsignedp; /* != 0 for unsigned comparisons. */ ++ }; ++ ++ static const struct cmp_info info[(int) ITEST_MAX] = { ++ ++ {EQ, 0, EQ, -32768, 32767, 0, 0}, /* EQ */ ++ {NE, 0, NE, -32768, 32767, 0, 0}, /* NE */ ++ ++ {LT, 1, GE, -32769, 32766, 1, 0}, /* GT */ ++ {GE, 0, GE, -32768, 32767, 0, 0}, /* GE */ ++ {LT, 0, LT, -32768, 32767, 0, 0}, /* LT */ ++ {GE, 1, LT, -32769, 32766, 1, 0}, /* LE */ ++ ++ {LTU, 1, GEU, 0, 65534, 1, 0}, /* GTU */ ++ {GEU, 0, GEU, 0, 65535, 0, 0}, /* GEU */ ++ {LTU, 0, LTU, 0, 65535, 0, 0}, /* LTU */ ++ {GEU, 1, LTU, 0, 65534, 1, 0}, /* LEU */ ++ }; ++ ++ enum internal_test test; ++ enum machine_mode mode; ++ const struct cmp_info *p_info; ++ int branch_p; ++ ++ ++ ++ ++ test = map_test_to_internal_test (test_code); ++ if (test == ITEST_MAX) ++ abort (); ++ ++ p_info = &info[(int) test]; ++ ++ mode = GET_MODE (cmp0); ++ if (mode == VOIDmode) ++ mode = GET_MODE (cmp1); ++ ++ branch_p = (destination != 0); ++ ++ /* We can't, under any circumstances, have const_ints in cmp0 ++ ??? Actually we could have const0 */ ++ if (GET_CODE (cmp0) == CONST_INT) ++ cmp0 = force_reg (mode, cmp0); ++ ++ /* if the comparison is against an int not in legal range ++ move it into a register */ ++ if (GET_CODE (cmp1) == CONST_INT) ++ { ++ HOST_WIDE_INT value = INTVAL (cmp1); ++ ++ if (value < p_info->const_low || value > p_info->const_high) ++ cmp1 = force_reg (mode, cmp1); ++ } ++ ++ /* Comparison to constants, may involve adding 1 to change a GT into GE. ++ Comparison between two registers, may involve switching operands. */ ++ if (GET_CODE (cmp1) == CONST_INT) ++ { ++ if (p_info->const_add != 0) ++ { ++ HOST_WIDE_INT new = INTVAL (cmp1) + p_info->const_add; ++ ++ /* If modification of cmp1 caused overflow, ++ we would get the wrong answer if we follow the usual path; ++ thus, x > 0xffffffffU would turn into x > 0U. */ ++ if ((p_info->unsignedp ++ ? (unsigned HOST_WIDE_INT) new > ++ (unsigned HOST_WIDE_INT) INTVAL (cmp1) ++ : new > INTVAL (cmp1)) != (p_info->const_add > 0)) ++ { ++ /* ??? This case can never happen with the current numbers, ++ but I am paranoid and would rather an abort than ++ a bug I will never find */ ++ abort (); ++ } ++ else ++ cmp1 = GEN_INT (new); ++ } ++ } ++ ++ else if (p_info->reverse_regs) ++ { ++ rtx temp = cmp0; ++ cmp0 = cmp1; ++ cmp1 = temp; ++ } ++ ++ ++ ++ if (branch_p) ++ { ++ if (register_operand (cmp0, mode) && register_operand (cmp1, mode)) ++ { ++ rtx insn; ++ rtx cond = gen_rtx (p_info->test_code_reg, mode, cmp0, cmp1); ++ rtx label = gen_rtx_LABEL_REF (VOIDmode, destination); ++ ++ insn = gen_rtx_SET (VOIDmode, pc_rtx, ++ gen_rtx_IF_THEN_ELSE (VOIDmode, ++ cond, label, pc_rtx)); ++ emit_jump_insn (insn); ++ } ++ else ++ { ++ rtx cond, label; ++ ++ result = gen_reg_rtx (mode); ++ ++ emit_move_insn (result, ++ gen_rtx (p_info->test_code_const, mode, cmp0, ++ cmp1)); ++ ++ cond = gen_rtx (NE, mode, result, const0_rtx); ++ label = gen_rtx_LABEL_REF (VOIDmode, destination); ++ ++ emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, ++ gen_rtx_IF_THEN_ELSE (VOIDmode, ++ cond, ++ label, pc_rtx))); ++ } ++ } ++ else ++ { ++ if (register_operand (cmp0, mode) && register_operand (cmp1, mode)) ++ { ++ emit_move_insn (result, ++ gen_rtx (p_info->test_code_reg, mode, cmp0, cmp1)); ++ } ++ else ++ { ++ emit_move_insn (result, ++ gen_rtx (p_info->test_code_const, mode, cmp0, ++ cmp1)); ++ } ++ } ++ ++} ++ ++ ++/* ??? For now conditional moves are only supported ++ when the mode of the operands being compared are ++ the same as the ones being moved */ ++ ++void ++gen_conditional_move (rtx *operands, enum machine_mode mode) ++{ ++ rtx insn, cond; ++ rtx cmp_reg = gen_reg_rtx (mode); ++ enum rtx_code cmp_code = GET_CODE (operands[1]); ++ enum rtx_code move_code = EQ; ++ ++ /* emit a comparison if it is not "simple". ++ Simple comparisons are X eq 0 and X ne 0 */ ++ if ((cmp_code == EQ || cmp_code == NE) && branch_cmp[1] == const0_rtx) ++ { ++ cmp_reg = branch_cmp[0]; ++ move_code = cmp_code; ++ } ++ else if ((cmp_code == EQ || cmp_code == NE) && branch_cmp[0] == const0_rtx) ++ { ++ cmp_reg = branch_cmp[1]; ++ move_code = cmp_code == EQ ? NE : EQ; ++ } ++ else ++ gen_int_relational (cmp_code, cmp_reg, branch_cmp[0], branch_cmp[1], ++ NULL_RTX); ++ ++ cond = gen_rtx (move_code, VOIDmode, cmp_reg, CONST0_RTX (mode)); ++ insn = gen_rtx_SET (mode, operands[0], ++ gen_rtx_IF_THEN_ELSE (mode, ++ cond, operands[2], operands[3])); ++ emit_insn (insn); ++} ++ ++/******************* ++ * Addressing Modes ++ *******************/ ++ ++int ++nios2_legitimate_address (rtx operand, enum machine_mode mode ATTRIBUTE_UNUSED, ++ int strict) ++{ ++ int ret_val = 0; ++ ++ switch (GET_CODE (operand)) ++ { ++ /* direct. */ ++ case SYMBOL_REF: ++ if (SYMBOL_REF_IN_NIOS2_SMALL_DATA_P (operand)) ++ { ++ ret_val = 1; ++ break; ++ } ++ /* else, fall through */ ++ case LABEL_REF: ++ case CONST_INT: ++ case CONST: ++ case CONST_DOUBLE: ++ /* ??? In here I need to add gp addressing */ ++ ret_val = 0; ++ ++ break; ++ ++ /* Register indirect. */ ++ case REG: ++ ret_val = REG_OK_FOR_BASE_P2 (operand, strict); ++ break; ++ ++ /* Register indirect with displacement */ ++ case PLUS: ++ { ++ rtx op0 = XEXP (operand, 0); ++ rtx op1 = XEXP (operand, 1); ++ ++ if (REG_P (op0) && REG_P (op1)) ++ ret_val = 0; ++ else if (REG_P (op0) && CONSTANT_P (op1)) ++ ret_val = REG_OK_FOR_BASE_P2 (op0, strict) ++ && SMALL_INT (INTVAL (op1)); ++ else if (REG_P (op1) && CONSTANT_P (op0)) ++ ret_val = REG_OK_FOR_BASE_P2 (op1, strict) ++ && SMALL_INT (INTVAL (op0)); ++ else ++ ret_val = 0; ++ } ++ break; ++ ++ default: ++ ret_val = 0; ++ break; ++ } ++ ++ return ret_val; ++} ++ ++/* Return true if EXP should be placed in the small data section. */ ++ ++static bool ++nios2_in_small_data_p (tree exp) ++{ ++ /* We want to merge strings, so we never consider them small data. */ ++ if (TREE_CODE (exp) == STRING_CST) ++ return false; ++ ++ if (TREE_CODE (exp) == VAR_DECL && DECL_SECTION_NAME (exp)) ++ { ++ const char *section = TREE_STRING_POINTER (DECL_SECTION_NAME (exp)); ++ /* ??? these string names need moving into ++ an array in some header file */ ++ if (nios2_section_threshold > 0 ++ && (strcmp (section, ".sbss") == 0 ++ || strncmp (section, ".sbss.", 6) == 0 ++ || strcmp (section, ".sdata") == 0 ++ || strncmp (section, ".sdata.", 7) == 0)) ++ return true; ++ } ++ else if (TREE_CODE (exp) == VAR_DECL) ++ { ++ HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (exp)); ++ ++ /* If this is an incomplete type with size 0, then we can't put it ++ in sdata because it might be too big when completed. */ ++ if (size > 0 && size <= nios2_section_threshold) ++ return true; ++ } ++ ++ return false; ++} ++ ++static void ++nios2_encode_section_info (tree decl, rtx rtl, int first) ++{ ++ ++ rtx symbol; ++ int flags; ++ ++ default_encode_section_info (decl, rtl, first); ++ ++ /* Careful not to prod global register variables. */ ++ if (GET_CODE (rtl) != MEM) ++ return; ++ symbol = XEXP (rtl, 0); ++ if (GET_CODE (symbol) != SYMBOL_REF) ++ return; ++ ++ flags = SYMBOL_REF_FLAGS (symbol); ++ ++ /* We don't want weak variables to be addressed with gp in case they end up with ++ value 0 which is not within 2^15 of $gp */ ++ if (DECL_P (decl) && DECL_WEAK (decl)) ++ flags |= SYMBOL_FLAG_WEAK_DECL; ++ ++ SYMBOL_REF_FLAGS (symbol) = flags; ++} ++ ++ ++static unsigned int ++nios2_section_type_flags (tree decl, const char *name, int reloc) ++{ ++ unsigned int flags; ++ ++ flags = default_section_type_flags (decl, name, reloc); ++ ++ /* ??? these string names need moving into an array in some header file */ ++ if (strcmp (name, ".sbss") == 0 ++ || strncmp (name, ".sbss.", 6) == 0 ++ || strcmp (name, ".sdata") == 0 ++ || strncmp (name, ".sdata.", 7) == 0) ++ flags |= SECTION_SMALL; ++ ++ return flags; ++} ++ ++ ++ ++ ++/***************************************** ++ * Defining the Output Assembler Language ++ *****************************************/ ++ ++/* -------------- * ++ * Output of Data ++ * -------------- */ ++ ++ ++/* -------------------------------- * ++ * Output of Assembler Instructions ++ * -------------------------------- */ ++ ++ ++/* print the operand OP to file stream ++ FILE modified by LETTER. LETTER ++ can be one of: ++ i: print "i" if OP is an immediate, except 0 ++ o: print "io" if OP is volatile ++ ++ z: for const0_rtx print $0 instead of 0 ++ H: for %hiadj ++ L: for %lo ++ U: for upper half of 32 bit value ++ */ ++ ++void ++nios2_print_operand (FILE *file, rtx op, int letter) ++{ ++ ++ switch (letter) ++ { ++ case 'i': ++ if (CONSTANT_P (op) && (op != const0_rtx)) ++ fprintf (file, "i"); ++ return; ++ ++ case 'o': ++ if (GET_CODE (op) == MEM ++ && ((MEM_VOLATILE_P (op) && !TARGET_CACHE_VOLATILE) ++ || TARGET_BYPASS_CACHE)) ++ fprintf (file, "io"); ++ return; ++ ++ default: ++ break; ++ } ++ ++ if (comparison_operator (op, VOIDmode)) ++ { ++ if (letter == 0) ++ { ++ fprintf (file, "%s", GET_RTX_NAME (GET_CODE (op))); ++ return; ++ } ++ } ++ ++ ++ switch (GET_CODE (op)) ++ { ++ case REG: ++ if (letter == 0 || letter == 'z') ++ { ++ fprintf (file, "%s", reg_names[REGNO (op)]); ++ return; ++ } ++ ++ case CONST_INT: ++ if (INTVAL (op) == 0 && letter == 'z') ++ { ++ fprintf (file, "zero"); ++ return; ++ } ++ else if (letter == 'U') ++ { ++ HOST_WIDE_INT val = INTVAL (op); ++ rtx new_op; ++ val = (val / 65536) & 0xFFFF; ++ new_op = GEN_INT (val); ++ output_addr_const (file, new_op); ++ return; ++ } ++ ++ /* else, fall through */ ++ case CONST: ++ case LABEL_REF: ++ case SYMBOL_REF: ++ case CONST_DOUBLE: ++ if (letter == 0 || letter == 'z') ++ { ++ output_addr_const (file, op); ++ return; ++ } ++ else if (letter == 'H') ++ { ++ fprintf (file, "%%hiadj("); ++ output_addr_const (file, op); ++ fprintf (file, ")"); ++ return; ++ } ++ else if (letter == 'L') ++ { ++ fprintf (file, "%%lo("); ++ output_addr_const (file, op); ++ fprintf (file, ")"); ++ return; ++ } ++ ++ ++ case SUBREG: ++ case MEM: ++ if (letter == 0) ++ { ++ output_address (op); ++ return; ++ } ++ ++ case CODE_LABEL: ++ if (letter == 0) ++ { ++ output_addr_const (file, op); ++ return; ++ } ++ ++ default: ++ break; ++ } ++ ++ fprintf (stderr, "Missing way to print (%c) ", letter); ++ debug_rtx (op); ++ abort (); ++} ++ ++static int gprel_constant (rtx); ++ ++static int ++gprel_constant (rtx op) ++{ ++ if (GET_CODE (op) == SYMBOL_REF ++ && SYMBOL_REF_IN_NIOS2_SMALL_DATA_P (op)) ++ { ++ return 1; ++ } ++ else if (GET_CODE (op) == CONST ++ && GET_CODE (XEXP (op, 0)) == PLUS) ++ { ++ return gprel_constant (XEXP (XEXP (op, 0), 0)); ++ } ++ else ++ { ++ return 0; ++ } ++} ++ ++void ++nios2_print_operand_address (FILE *file, rtx op) ++{ ++ switch (GET_CODE (op)) ++ { ++ case CONST: ++ case CONST_INT: ++ case LABEL_REF: ++ case CONST_DOUBLE: ++ case SYMBOL_REF: ++ if (gprel_constant (op)) ++ { ++ fprintf (file, "%%gprel("); ++ output_addr_const (file, op); ++ fprintf (file, ")(%s)", reg_names[GP_REGNO]); ++ return; ++ } ++ ++ break; ++ ++ case PLUS: ++ { ++ rtx op0 = XEXP (op, 0); ++ rtx op1 = XEXP (op, 1); ++ ++ if (REG_P (op0) && CONSTANT_P (op1)) ++ { ++ output_addr_const (file, op1); ++ fprintf (file, "(%s)", reg_names[REGNO (op0)]); ++ return; ++ } ++ else if (REG_P (op1) && CONSTANT_P (op0)) ++ { ++ output_addr_const (file, op0); ++ fprintf (file, "(%s)", reg_names[REGNO (op1)]); ++ return; ++ } ++ } ++ break; ++ ++ case REG: ++ fprintf (file, "0(%s)", reg_names[REGNO (op)]); ++ return; ++ ++ case MEM: ++ { ++ rtx base = XEXP (op, 0); ++ PRINT_OPERAND_ADDRESS (file, base); ++ return; ++ } ++ default: ++ break; ++ } ++ ++ fprintf (stderr, "Missing way to print address\n"); ++ debug_rtx (op); ++ abort (); ++} ++ ++ ++ ++ ++ ++/**************************** ++ * Predicates ++ ****************************/ ++ ++int ++arith_operand (rtx op, enum machine_mode mode) ++{ ++ if (GET_CODE (op) == CONST_INT && SMALL_INT (INTVAL (op))) ++ return 1; ++ ++ return register_operand (op, mode); ++} ++ ++int ++uns_arith_operand (rtx op, enum machine_mode mode) ++{ ++ if (GET_CODE (op) == CONST_INT && SMALL_INT_UNSIGNED (INTVAL (op))) ++ return 1; ++ ++ return register_operand (op, mode); ++} ++ ++int ++logical_operand (rtx op, enum machine_mode mode) ++{ ++ if (GET_CODE (op) == CONST_INT ++ && (SMALL_INT_UNSIGNED (INTVAL (op)) || UPPER16_INT (INTVAL (op)))) ++ return 1; ++ ++ return register_operand (op, mode); ++} ++ ++int ++shift_operand (rtx op, enum machine_mode mode) ++{ ++ if (GET_CODE (op) == CONST_INT && SHIFT_INT (INTVAL (op))) ++ return 1; ++ ++ return register_operand (op, mode); ++} ++ ++int ++rdwrctl_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) ++{ ++ return GET_CODE (op) == CONST_INT && RDWRCTL_INT (INTVAL (op)); ++} ++ ++/* Return truth value of whether OP is a register or the constant 0. */ ++ ++int ++reg_or_0_operand (rtx op, enum machine_mode mode) ++{ ++ switch (GET_CODE (op)) ++ { ++ case CONST_INT: ++ return INTVAL (op) == 0; ++ ++ case CONST_DOUBLE: ++ return op == CONST0_RTX (mode); ++ ++ default: ++ break; ++ } ++ ++ return register_operand (op, mode); ++} ++ ++ ++int ++equality_op (rtx op, enum machine_mode mode) ++{ ++ if (mode != GET_MODE (op)) ++ return 0; ++ ++ return GET_CODE (op) == EQ || GET_CODE (op) == NE; ++} ++ ++int ++custom_insn_opcode (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) ++{ ++ return GET_CODE (op) == CONST_INT && CUSTOM_INSN_OPCODE (INTVAL (op)); ++} ++ ++ ++ ++ ++ ++ ++ ++/***************************************************************************** ++** ++** instruction scheduler ++** ++*****************************************************************************/ ++static int ++nios2_use_dfa_pipeline_interface () ++{ ++ return 1; ++} ++ ++ ++static int ++nios2_issue_rate () ++{ ++#ifdef MAX_DFA_ISSUE_RATE ++ return MAX_DFA_ISSUE_RATE; ++#else ++ return 1; ++#endif ++} ++ ++ ++const char * ++asm_output_opcode (FILE *file ATTRIBUTE_UNUSED, ++ const char *ptr ATTRIBUTE_UNUSED) ++{ ++ const char *p; ++ ++ p = ptr; ++ return ptr; ++} ++ ++ ++ ++/***************************************************************************** ++** ++** function arguments ++** ++*****************************************************************************/ ++ ++void ++init_cumulative_args (CUMULATIVE_ARGS *cum, ++ tree fntype ATTRIBUTE_UNUSED, ++ rtx libname ATTRIBUTE_UNUSED, ++ tree fndecl ATTRIBUTE_UNUSED, ++ int n_named_args ATTRIBUTE_UNUSED) ++{ ++ cum->regs_used = 0; ++} ++ ++ ++/* Update the data in CUM to advance over an argument ++ of mode MODE and data type TYPE. ++ (TYPE is null for libcalls where that information may not be available.) */ ++ ++void ++function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, ++ tree type ATTRIBUTE_UNUSED, int named ATTRIBUTE_UNUSED) ++{ ++ HOST_WIDE_INT param_size; ++ ++ if (mode == BLKmode) ++ { ++ param_size = int_size_in_bytes (type); ++ if (param_size < 0) ++ internal_error ++ ("Do not know how to handle large structs or variable length types"); ++ } ++ else ++ { ++ param_size = GET_MODE_SIZE (mode); ++ } ++ ++ /* convert to words (round up) */ ++ param_size = (3 + param_size) / 4; ++ ++ if (cum->regs_used + param_size > NUM_ARG_REGS) ++ { ++ cum->regs_used = NUM_ARG_REGS; ++ } ++ else ++ { ++ cum->regs_used += param_size; ++ } ++ ++ return; ++} ++ ++/* Define where to put the arguments to a function. Value is zero to ++ push the argument on the stack, or a hard register in which to ++ store the argument. ++ ++ MODE is the argument's machine mode. ++ TYPE is the data type of the argument (as a tree). ++ This is null for libcalls where that information may ++ not be available. ++ CUM is a variable of type CUMULATIVE_ARGS which gives info about ++ the preceding args and about the function being called. ++ NAMED is nonzero if this argument is a named parameter ++ (otherwise it is an extra parameter matching an ellipsis). */ ++rtx ++function_arg (const CUMULATIVE_ARGS *cum, enum machine_mode mode, ++ tree type ATTRIBUTE_UNUSED, int named ATTRIBUTE_UNUSED) ++{ ++ rtx return_rtx = NULL_RTX; ++ ++ if (cum->regs_used < NUM_ARG_REGS) ++ { ++ return_rtx = gen_rtx_REG (mode, FIRST_ARG_REGNO + cum->regs_used); ++ } ++ ++ return return_rtx; ++} ++ ++int ++function_arg_partial_nregs (const CUMULATIVE_ARGS *cum, ++ enum machine_mode mode, tree type, ++ int named ATTRIBUTE_UNUSED) ++{ ++ HOST_WIDE_INT param_size; ++ ++ if (mode == BLKmode) ++ { ++ param_size = int_size_in_bytes (type); ++ if (param_size < 0) ++ internal_error ++ ("Do not know how to handle large structs or variable length types"); ++ } ++ else ++ { ++ param_size = GET_MODE_SIZE (mode); ++ } ++ ++ /* convert to words (round up) */ ++ param_size = (3 + param_size) / 4; ++ ++ if (cum->regs_used < NUM_ARG_REGS ++ && cum->regs_used + param_size > NUM_ARG_REGS) ++ { ++ return NUM_ARG_REGS - cum->regs_used; ++ } ++ else ++ { ++ return 0; ++ } ++} ++ ++ ++int ++nios2_return_in_memory (tree type) ++{ ++ int res = ((int_size_in_bytes (type) > (2 * UNITS_PER_WORD)) ++ || (int_size_in_bytes (type) == -1)); ++ ++ return res; ++} ++ ++/* ??? It may be possible to eliminate the copyback and implement ++ my own va_arg type, but that is more work for now. */ ++int ++nios2_setup_incoming_varargs (const CUMULATIVE_ARGS *cum, ++ enum machine_mode mode, tree type, ++ int no_rtl) ++{ ++ CUMULATIVE_ARGS local_cum; ++ int regs_to_push; ++ ++ local_cum = *cum; ++ FUNCTION_ARG_ADVANCE (local_cum, mode, type, 1); ++ ++ regs_to_push = NUM_ARG_REGS - local_cum.regs_used; ++ ++ if (!no_rtl) ++ { ++ if (regs_to_push > 0) ++ { ++ rtx ptr, mem; ++ ++ ptr = virtual_incoming_args_rtx; ++ mem = gen_rtx_MEM (BLKmode, ptr); ++ ++ /* va_arg is an array access in this case, which causes ++ it to get MEM_IN_STRUCT_P set. We must set it here ++ so that the insn scheduler won't assume that these ++ stores can't possibly overlap with the va_arg loads. */ ++ MEM_SET_IN_STRUCT_P (mem, 1); ++ ++ emit_insn (gen_blockage ()); ++ move_block_from_reg (local_cum.regs_used + FIRST_ARG_REGNO, mem, ++ regs_to_push); ++ emit_insn (gen_blockage ()); ++ } ++ } ++ ++ return regs_to_push * UNITS_PER_WORD; ++ ++} ++ ++ ++ ++/***************************************************************************** ++** ++** builtins ++** ++** This method for handling builtins is from CSP where _many_ more types of ++** expanders have already been written. Check there first before writing ++** new ones. ++** ++*****************************************************************************/ ++ ++enum nios2_builtins ++{ ++ NIOS2_BUILTIN_LDBIO, ++ NIOS2_BUILTIN_LDBUIO, ++ NIOS2_BUILTIN_LDHIO, ++ NIOS2_BUILTIN_LDHUIO, ++ NIOS2_BUILTIN_LDWIO, ++ NIOS2_BUILTIN_STBIO, ++ NIOS2_BUILTIN_STHIO, ++ NIOS2_BUILTIN_STWIO, ++ NIOS2_BUILTIN_SYNC, ++ NIOS2_BUILTIN_RDCTL, ++ NIOS2_BUILTIN_WRCTL, ++ ++ NIOS2_BUILTIN_CUSTOM_N, ++ NIOS2_BUILTIN_CUSTOM_NI, ++ NIOS2_BUILTIN_CUSTOM_NF, ++ NIOS2_BUILTIN_CUSTOM_NP, ++ NIOS2_BUILTIN_CUSTOM_NII, ++ NIOS2_BUILTIN_CUSTOM_NIF, ++ NIOS2_BUILTIN_CUSTOM_NIP, ++ NIOS2_BUILTIN_CUSTOM_NFI, ++ NIOS2_BUILTIN_CUSTOM_NFF, ++ NIOS2_BUILTIN_CUSTOM_NFP, ++ NIOS2_BUILTIN_CUSTOM_NPI, ++ NIOS2_BUILTIN_CUSTOM_NPF, ++ NIOS2_BUILTIN_CUSTOM_NPP, ++ NIOS2_BUILTIN_CUSTOM_IN, ++ NIOS2_BUILTIN_CUSTOM_INI, ++ NIOS2_BUILTIN_CUSTOM_INF, ++ NIOS2_BUILTIN_CUSTOM_INP, ++ NIOS2_BUILTIN_CUSTOM_INII, ++ NIOS2_BUILTIN_CUSTOM_INIF, ++ NIOS2_BUILTIN_CUSTOM_INIP, ++ NIOS2_BUILTIN_CUSTOM_INFI, ++ NIOS2_BUILTIN_CUSTOM_INFF, ++ NIOS2_BUILTIN_CUSTOM_INFP, ++ NIOS2_BUILTIN_CUSTOM_INPI, ++ NIOS2_BUILTIN_CUSTOM_INPF, ++ NIOS2_BUILTIN_CUSTOM_INPP, ++ NIOS2_BUILTIN_CUSTOM_FN, ++ NIOS2_BUILTIN_CUSTOM_FNI, ++ NIOS2_BUILTIN_CUSTOM_FNF, ++ NIOS2_BUILTIN_CUSTOM_FNP, ++ NIOS2_BUILTIN_CUSTOM_FNII, ++ NIOS2_BUILTIN_CUSTOM_FNIF, ++ NIOS2_BUILTIN_CUSTOM_FNIP, ++ NIOS2_BUILTIN_CUSTOM_FNFI, ++ NIOS2_BUILTIN_CUSTOM_FNFF, ++ NIOS2_BUILTIN_CUSTOM_FNFP, ++ NIOS2_BUILTIN_CUSTOM_FNPI, ++ NIOS2_BUILTIN_CUSTOM_FNPF, ++ NIOS2_BUILTIN_CUSTOM_FNPP, ++ NIOS2_BUILTIN_CUSTOM_PN, ++ NIOS2_BUILTIN_CUSTOM_PNI, ++ NIOS2_BUILTIN_CUSTOM_PNF, ++ NIOS2_BUILTIN_CUSTOM_PNP, ++ NIOS2_BUILTIN_CUSTOM_PNII, ++ NIOS2_BUILTIN_CUSTOM_PNIF, ++ NIOS2_BUILTIN_CUSTOM_PNIP, ++ NIOS2_BUILTIN_CUSTOM_PNFI, ++ NIOS2_BUILTIN_CUSTOM_PNFF, ++ NIOS2_BUILTIN_CUSTOM_PNFP, ++ NIOS2_BUILTIN_CUSTOM_PNPI, ++ NIOS2_BUILTIN_CUSTOM_PNPF, ++ NIOS2_BUILTIN_CUSTOM_PNPP, ++ ++ ++ LIM_NIOS2_BUILTINS ++}; ++ ++struct builtin_description ++{ ++ const enum insn_code icode; ++ const char *const name; ++ const enum nios2_builtins code; ++ const tree *type; ++ rtx (* expander) PARAMS ((const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int)); ++}; ++ ++static rtx nios2_expand_STXIO (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++static rtx nios2_expand_LDXIO (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++static rtx nios2_expand_sync (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++static rtx nios2_expand_rdctl (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++static rtx nios2_expand_wrctl (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++ ++static rtx nios2_expand_custom_n (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++static rtx nios2_expand_custom_Xn (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++static rtx nios2_expand_custom_nX (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++static rtx nios2_expand_custom_XnX (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++static rtx nios2_expand_custom_nXX (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++static rtx nios2_expand_custom_XnXX (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++ ++static tree endlink; ++ ++/* int fn (volatile const void *) ++ */ ++static tree int_ftype_volatile_const_void_p; ++ ++/* int fn (int) ++ */ ++static tree int_ftype_int; ++ ++/* void fn (int, int) ++ */ ++static tree void_ftype_int_int; ++ ++/* void fn (volatile void *, int) ++ */ ++static tree void_ftype_volatile_void_p_int; ++ ++/* void fn (void) ++ */ ++static tree void_ftype_void; ++ ++static tree custom_n; ++static tree custom_ni; ++static tree custom_nf; ++static tree custom_np; ++static tree custom_nii; ++static tree custom_nif; ++static tree custom_nip; ++static tree custom_nfi; ++static tree custom_nff; ++static tree custom_nfp; ++static tree custom_npi; ++static tree custom_npf; ++static tree custom_npp; ++static tree custom_in; ++static tree custom_ini; ++static tree custom_inf; ++static tree custom_inp; ++static tree custom_inii; ++static tree custom_inif; ++static tree custom_inip; ++static tree custom_infi; ++static tree custom_inff; ++static tree custom_infp; ++static tree custom_inpi; ++static tree custom_inpf; ++static tree custom_inpp; ++static tree custom_fn; ++static tree custom_fni; ++static tree custom_fnf; ++static tree custom_fnp; ++static tree custom_fnii; ++static tree custom_fnif; ++static tree custom_fnip; ++static tree custom_fnfi; ++static tree custom_fnff; ++static tree custom_fnfp; ++static tree custom_fnpi; ++static tree custom_fnpf; ++static tree custom_fnpp; ++static tree custom_pn; ++static tree custom_pni; ++static tree custom_pnf; ++static tree custom_pnp; ++static tree custom_pnii; ++static tree custom_pnif; ++static tree custom_pnip; ++static tree custom_pnfi; ++static tree custom_pnff; ++static tree custom_pnfp; ++static tree custom_pnpi; ++static tree custom_pnpf; ++static tree custom_pnpp; ++ ++ ++static const struct builtin_description bdesc[] = { ++ {CODE_FOR_ldbio, "__builtin_ldbio", NIOS2_BUILTIN_LDBIO, &int_ftype_volatile_const_void_p, nios2_expand_LDXIO}, ++ {CODE_FOR_ldbuio, "__builtin_ldbuio", NIOS2_BUILTIN_LDBUIO, &int_ftype_volatile_const_void_p, nios2_expand_LDXIO}, ++ {CODE_FOR_ldhio, "__builtin_ldhio", NIOS2_BUILTIN_LDHIO, &int_ftype_volatile_const_void_p, nios2_expand_LDXIO}, ++ {CODE_FOR_ldhuio, "__builtin_ldhuio", NIOS2_BUILTIN_LDHUIO, &int_ftype_volatile_const_void_p, nios2_expand_LDXIO}, ++ {CODE_FOR_ldwio, "__builtin_ldwio", NIOS2_BUILTIN_LDWIO, &int_ftype_volatile_const_void_p, nios2_expand_LDXIO}, ++ ++ {CODE_FOR_stbio, "__builtin_stbio", NIOS2_BUILTIN_STBIO, &void_ftype_volatile_void_p_int, nios2_expand_STXIO}, ++ {CODE_FOR_sthio, "__builtin_sthio", NIOS2_BUILTIN_STHIO, &void_ftype_volatile_void_p_int, nios2_expand_STXIO}, ++ {CODE_FOR_stwio, "__builtin_stwio", NIOS2_BUILTIN_STWIO, &void_ftype_volatile_void_p_int, nios2_expand_STXIO}, ++ ++ {CODE_FOR_sync, "__builtin_sync", NIOS2_BUILTIN_SYNC, &void_ftype_void, nios2_expand_sync}, ++ {CODE_FOR_rdctl, "__builtin_rdctl", NIOS2_BUILTIN_RDCTL, &int_ftype_int, nios2_expand_rdctl}, ++ {CODE_FOR_wrctl, "__builtin_wrctl", NIOS2_BUILTIN_WRCTL, &void_ftype_int_int, nios2_expand_wrctl}, ++ ++ {CODE_FOR_custom_n, "__builtin_custom_n", NIOS2_BUILTIN_CUSTOM_N, &custom_n, nios2_expand_custom_n}, ++ {CODE_FOR_custom_ni, "__builtin_custom_ni", NIOS2_BUILTIN_CUSTOM_NI, &custom_ni, nios2_expand_custom_nX}, ++ {CODE_FOR_custom_nf, "__builtin_custom_nf", NIOS2_BUILTIN_CUSTOM_NF, &custom_nf, nios2_expand_custom_nX}, ++ {CODE_FOR_custom_np, "__builtin_custom_np", NIOS2_BUILTIN_CUSTOM_NP, &custom_np, nios2_expand_custom_nX}, ++ {CODE_FOR_custom_nii, "__builtin_custom_nii", NIOS2_BUILTIN_CUSTOM_NII, &custom_nii, nios2_expand_custom_nXX}, ++ {CODE_FOR_custom_nif, "__builtin_custom_nif", NIOS2_BUILTIN_CUSTOM_NIF, &custom_nif, nios2_expand_custom_nXX}, ++ {CODE_FOR_custom_nip, "__builtin_custom_nip", NIOS2_BUILTIN_CUSTOM_NIP, &custom_nip, nios2_expand_custom_nXX}, ++ {CODE_FOR_custom_nfi, "__builtin_custom_nfi", NIOS2_BUILTIN_CUSTOM_NFI, &custom_nfi, nios2_expand_custom_nXX}, ++ {CODE_FOR_custom_nff, "__builtin_custom_nff", NIOS2_BUILTIN_CUSTOM_NFF, &custom_nff, nios2_expand_custom_nXX}, ++ {CODE_FOR_custom_nfp, "__builtin_custom_nfp", NIOS2_BUILTIN_CUSTOM_NFP, &custom_nfp, nios2_expand_custom_nXX}, ++ {CODE_FOR_custom_npi, "__builtin_custom_npi", NIOS2_BUILTIN_CUSTOM_NPI, &custom_npi, nios2_expand_custom_nXX}, ++ {CODE_FOR_custom_npf, "__builtin_custom_npf", NIOS2_BUILTIN_CUSTOM_NPF, &custom_npf, nios2_expand_custom_nXX}, ++ {CODE_FOR_custom_npp, "__builtin_custom_npp", NIOS2_BUILTIN_CUSTOM_NPP, &custom_npp, nios2_expand_custom_nXX}, ++ {CODE_FOR_custom_in, "__builtin_custom_in", NIOS2_BUILTIN_CUSTOM_IN, &custom_in, nios2_expand_custom_Xn}, ++ {CODE_FOR_custom_ini, "__builtin_custom_ini", NIOS2_BUILTIN_CUSTOM_INI, &custom_ini, nios2_expand_custom_XnX}, ++ {CODE_FOR_custom_inf, "__builtin_custom_inf", NIOS2_BUILTIN_CUSTOM_INF, &custom_inf, nios2_expand_custom_XnX}, ++ {CODE_FOR_custom_inp, "__builtin_custom_inp", NIOS2_BUILTIN_CUSTOM_INP, &custom_inp, nios2_expand_custom_XnX}, ++ {CODE_FOR_custom_inii, "__builtin_custom_inii", NIOS2_BUILTIN_CUSTOM_INII, &custom_inii, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_inif, "__builtin_custom_inif", NIOS2_BUILTIN_CUSTOM_INIF, &custom_inif, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_inip, "__builtin_custom_inip", NIOS2_BUILTIN_CUSTOM_INIP, &custom_inip, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_infi, "__builtin_custom_infi", NIOS2_BUILTIN_CUSTOM_INFI, &custom_infi, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_inff, "__builtin_custom_inff", NIOS2_BUILTIN_CUSTOM_INFF, &custom_inff, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_infp, "__builtin_custom_infp", NIOS2_BUILTIN_CUSTOM_INFP, &custom_infp, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_inpi, "__builtin_custom_inpi", NIOS2_BUILTIN_CUSTOM_INPI, &custom_inpi, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_inpf, "__builtin_custom_inpf", NIOS2_BUILTIN_CUSTOM_INPF, &custom_inpf, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_inpp, "__builtin_custom_inpp", NIOS2_BUILTIN_CUSTOM_INPP, &custom_inpp, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_fn, "__builtin_custom_fn", NIOS2_BUILTIN_CUSTOM_FN, &custom_fn, nios2_expand_custom_Xn}, ++ {CODE_FOR_custom_fni, "__builtin_custom_fni", NIOS2_BUILTIN_CUSTOM_FNI, &custom_fni, nios2_expand_custom_XnX}, ++ {CODE_FOR_custom_fnf, "__builtin_custom_fnf", NIOS2_BUILTIN_CUSTOM_FNF, &custom_fnf, nios2_expand_custom_XnX}, ++ {CODE_FOR_custom_fnp, "__builtin_custom_fnp", NIOS2_BUILTIN_CUSTOM_FNP, &custom_fnp, nios2_expand_custom_XnX}, ++ {CODE_FOR_custom_fnii, "__builtin_custom_fnii", NIOS2_BUILTIN_CUSTOM_FNII, &custom_fnii, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_fnif, "__builtin_custom_fnif", NIOS2_BUILTIN_CUSTOM_FNIF, &custom_fnif, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_fnip, "__builtin_custom_fnip", NIOS2_BUILTIN_CUSTOM_FNIP, &custom_fnip, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_fnfi, "__builtin_custom_fnfi", NIOS2_BUILTIN_CUSTOM_FNFI, &custom_fnfi, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_fnff, "__builtin_custom_fnff", NIOS2_BUILTIN_CUSTOM_FNFF, &custom_fnff, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_fnfp, "__builtin_custom_fnfp", NIOS2_BUILTIN_CUSTOM_FNFP, &custom_fnfp, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_fnpi, "__builtin_custom_fnpi", NIOS2_BUILTIN_CUSTOM_FNPI, &custom_fnpi, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_fnpf, "__builtin_custom_fnpf", NIOS2_BUILTIN_CUSTOM_FNPF, &custom_fnpf, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_fnpp, "__builtin_custom_fnpp", NIOS2_BUILTIN_CUSTOM_FNPP, &custom_fnpp, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_pn, "__builtin_custom_pn", NIOS2_BUILTIN_CUSTOM_PN, &custom_pn, nios2_expand_custom_Xn}, ++ {CODE_FOR_custom_pni, "__builtin_custom_pni", NIOS2_BUILTIN_CUSTOM_PNI, &custom_pni, nios2_expand_custom_XnX}, ++ {CODE_FOR_custom_pnf, "__builtin_custom_pnf", NIOS2_BUILTIN_CUSTOM_PNF, &custom_pnf, nios2_expand_custom_XnX}, ++ {CODE_FOR_custom_pnp, "__builtin_custom_pnp", NIOS2_BUILTIN_CUSTOM_PNP, &custom_pnp, nios2_expand_custom_XnX}, ++ {CODE_FOR_custom_pnii, "__builtin_custom_pnii", NIOS2_BUILTIN_CUSTOM_PNII, &custom_pnii, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_pnif, "__builtin_custom_pnif", NIOS2_BUILTIN_CUSTOM_PNIF, &custom_pnif, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_pnip, "__builtin_custom_pnip", NIOS2_BUILTIN_CUSTOM_PNIP, &custom_pnip, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_pnfi, "__builtin_custom_pnfi", NIOS2_BUILTIN_CUSTOM_PNFI, &custom_pnfi, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_pnff, "__builtin_custom_pnff", NIOS2_BUILTIN_CUSTOM_PNFF, &custom_pnff, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_pnfp, "__builtin_custom_pnfp", NIOS2_BUILTIN_CUSTOM_PNFP, &custom_pnfp, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_pnpi, "__builtin_custom_pnpi", NIOS2_BUILTIN_CUSTOM_PNPI, &custom_pnpi, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_pnpf, "__builtin_custom_pnpf", NIOS2_BUILTIN_CUSTOM_PNPF, &custom_pnpf, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_pnpp, "__builtin_custom_pnpp", NIOS2_BUILTIN_CUSTOM_PNPP, &custom_pnpp, nios2_expand_custom_XnXX}, ++ ++ ++ {0, 0, 0, 0, 0}, ++}; ++ ++/* This does not have a closing bracket on purpose (see use) */ ++#define def_param(TYPE) \ ++ tree_cons (NULL_TREE, TYPE, ++ ++static void ++nios2_init_builtins () ++{ ++ const struct builtin_description *d; ++ ++ ++ endlink = void_list_node; ++ ++ /* Special indenting here because one of the brackets is in def_param */ ++ /* *INDENT-OFF* */ ++ ++ /* int fn (volatile const void *) ++ */ ++ int_ftype_volatile_const_void_p ++ = build_function_type (integer_type_node, ++ def_param (build_qualified_type (ptr_type_node, ++ TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) ++ endlink)); ++ ++ ++ /* void fn (volatile void *, int) ++ */ ++ void_ftype_volatile_void_p_int ++ = build_function_type (void_type_node, ++ def_param (build_qualified_type (ptr_type_node, ++ TYPE_QUAL_VOLATILE)) ++ def_param (integer_type_node) ++ endlink))); ++ ++ /* void fn (void) ++ */ ++ void_ftype_void ++ = build_function_type (void_type_node, ++ endlink); ++ ++ /* int fn (int) ++ */ ++ int_ftype_int ++ = build_function_type (integer_type_node, ++ def_param (integer_type_node) ++ endlink)); ++ ++ /* void fn (int, int) ++ */ ++ void_ftype_int_int ++ = build_function_type (void_type_node, ++ def_param (integer_type_node) ++ def_param (integer_type_node) ++ endlink))); ++ ++ ++#define CUSTOM_NUM def_param (integer_type_node) ++ ++ custom_n ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ endlink)); ++ custom_ni ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ endlink))); ++ custom_nf ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ endlink))); ++ custom_np ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ endlink))); ++ custom_nii ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_nif ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_nip ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ custom_nfi ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_nff ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_nfp ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ custom_npi ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_npf ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_npp ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ ++ custom_in ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ endlink)); ++ custom_ini ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ endlink))); ++ custom_inf ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ endlink))); ++ custom_inp ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ endlink))); ++ custom_inii ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_inif ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_inip ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ custom_infi ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_inff ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_infp ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ custom_inpi ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_inpf ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_inpp ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ ++ custom_fn ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ endlink)); ++ custom_fni ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ endlink))); ++ custom_fnf ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ endlink))); ++ custom_fnp ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ endlink))); ++ custom_fnii ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_fnif ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_fnip ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ custom_fnfi ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_fnff ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_fnfp ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ custom_fnpi ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_fnpf ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_fnpp ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ ++ ++ custom_pn ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ endlink)); ++ custom_pni ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ endlink))); ++ custom_pnf ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ endlink))); ++ custom_pnp ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ endlink))); ++ custom_pnii ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_pnif ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_pnip ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ custom_pnfi ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_pnff ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_pnfp ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ custom_pnpi ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_pnpf ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_pnpp ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ ++ ++ ++ /* *INDENT-ON* */ ++ ++ ++ for (d = bdesc; d->name; d++) ++ { ++ builtin_function (d->name, *d->type, d->code, ++ BUILT_IN_MD, NULL, NULL); ++ } ++} ++ ++/* Expand an expression EXP that calls a built-in function, ++ with result going to TARGET if that's convenient ++ (and in mode MODE if that's convenient). ++ SUBTARGET may be used as the target for computing one of EXP's operands. ++ IGNORE is nonzero if the value is to be ignored. */ ++ ++static rtx ++nios2_expand_builtin (tree exp, rtx target, rtx subtarget, ++ enum machine_mode mode, int ignore) ++{ ++ const struct builtin_description *d; ++ tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); ++ unsigned int fcode = DECL_FUNCTION_CODE (fndecl); ++ ++ for (d = bdesc; d->name; d++) ++ if (d->code == fcode) ++ return (d->expander) (d, exp, target, subtarget, mode, ignore); ++ ++ /* we should have seen one of the functins we registered */ ++ abort (); ++} ++ ++static rtx nios2_create_target (const struct builtin_description *, rtx); ++ ++ ++static rtx ++nios2_create_target (const struct builtin_description *d, rtx target) ++{ ++ if (!target ++ || !(*insn_data[d->icode].operand[0].predicate) (target, ++ insn_data[d->icode].operand[0].mode)) ++ { ++ target = gen_reg_rtx (insn_data[d->icode].operand[0].mode); ++ } ++ ++ return target; ++} ++ ++ ++static rtx nios2_extract_opcode (const struct builtin_description *, int, tree); ++static rtx nios2_extract_operand (const struct builtin_description *, int, int, tree); ++ ++static rtx ++nios2_extract_opcode (const struct builtin_description *d, int op, tree arglist) ++{ ++ enum machine_mode mode = insn_data[d->icode].operand[op].mode; ++ tree arg = TREE_VALUE (arglist); ++ rtx opcode = expand_expr (arg, NULL_RTX, mode, 0); ++ opcode = protect_from_queue (opcode, 0); ++ ++ if (!(*insn_data[d->icode].operand[op].predicate) (opcode, mode)) ++ error ("Custom instruction opcode must be compile time constant in the range 0-255 for %s", d->name); ++ ++ return opcode; ++} ++ ++static rtx ++nios2_extract_operand (const struct builtin_description *d, int op, int argnum, tree arglist) ++{ ++ enum machine_mode mode = insn_data[d->icode].operand[op].mode; ++ tree arg = TREE_VALUE (arglist); ++ rtx operand = expand_expr (arg, NULL_RTX, mode, 0); ++ operand = protect_from_queue (operand, 0); ++ ++ if (!(*insn_data[d->icode].operand[op].predicate) (operand, mode)) ++ operand = copy_to_mode_reg (mode, operand); ++ ++ /* ??? Better errors would be nice */ ++ if (!(*insn_data[d->icode].operand[op].predicate) (operand, mode)) ++ error ("Invalid argument %d to %s", argnum, d->name); ++ ++ return operand; ++} ++ ++ ++static rtx ++nios2_expand_custom_n (const struct builtin_description *d, tree exp, ++ rtx target ATTRIBUTE_UNUSED, rtx subtarget ATTRIBUTE_UNUSED, ++ enum machine_mode mode ATTRIBUTE_UNUSED, int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx opcode; ++ ++ /* custom_n should have exactly one operand */ ++ if (insn_data[d->icode].n_operands != 1) ++ abort (); ++ ++ opcode = nios2_extract_opcode (d, 0, arglist); ++ ++ pat = GEN_FCN (d->icode) (opcode); ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return 0; ++} ++ ++static rtx ++nios2_expand_custom_Xn (const struct builtin_description *d, tree exp, ++ rtx target, rtx subtarget ATTRIBUTE_UNUSED, ++ enum machine_mode mode ATTRIBUTE_UNUSED, ++ int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx opcode; ++ ++ /* custom_Xn should have exactly two operands */ ++ if (insn_data[d->icode].n_operands != 2) ++ abort (); ++ ++ target = nios2_create_target (d, target); ++ opcode = nios2_extract_opcode (d, 1, arglist); ++ ++ pat = GEN_FCN (d->icode) (target, opcode); ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return target; ++} ++ ++static rtx ++nios2_expand_custom_nX (const struct builtin_description *d, tree exp, ++ rtx target ATTRIBUTE_UNUSED, rtx subtarget ATTRIBUTE_UNUSED, ++ enum machine_mode mode ATTRIBUTE_UNUSED, int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx opcode; ++ rtx operands[1]; ++ int i; ++ ++ ++ /* custom_nX should have exactly two operands */ ++ if (insn_data[d->icode].n_operands != 2) ++ abort (); ++ ++ opcode = nios2_extract_opcode (d, 0, arglist); ++ for (i = 0; i < 1; i++) ++ { ++ arglist = TREE_CHAIN (arglist); ++ operands[i] = nios2_extract_operand (d, i + 1, i + 1, arglist); ++ } ++ ++ pat = GEN_FCN (d->icode) (opcode, operands[0]); ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return 0; ++} ++ ++static rtx ++nios2_expand_custom_XnX (const struct builtin_description *d, tree exp, rtx target, ++ rtx subtarget ATTRIBUTE_UNUSED, enum machine_mode mode ATTRIBUTE_UNUSED, ++ int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx opcode; ++ rtx operands[1]; ++ int i; ++ ++ /* custom_Xn should have exactly three operands */ ++ if (insn_data[d->icode].n_operands != 3) ++ abort (); ++ ++ target = nios2_create_target (d, target); ++ opcode = nios2_extract_opcode (d, 1, arglist); ++ ++ for (i = 0; i < 1; i++) ++ { ++ arglist = TREE_CHAIN (arglist); ++ operands[i] = nios2_extract_operand (d, i + 2, i + 1, arglist); ++ } ++ ++ pat = GEN_FCN (d->icode) (target, opcode, operands[0]); ++ ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return target; ++} ++ ++static rtx ++nios2_expand_custom_nXX (const struct builtin_description *d, tree exp, rtx target ATTRIBUTE_UNUSED, ++ rtx subtarget ATTRIBUTE_UNUSED, enum machine_mode mode ATTRIBUTE_UNUSED, ++ int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx opcode; ++ rtx operands[2]; ++ int i; ++ ++ ++ /* custom_nX should have exactly three operands */ ++ if (insn_data[d->icode].n_operands != 3) ++ abort (); ++ ++ opcode = nios2_extract_opcode (d, 0, arglist); ++ for (i = 0; i < 2; i++) ++ { ++ arglist = TREE_CHAIN (arglist); ++ operands[i] = nios2_extract_operand (d, i + 1, i + 1, arglist); ++ } ++ ++ pat = GEN_FCN (d->icode) (opcode, operands[0], operands[1]); ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return 0; ++} ++ ++static rtx ++nios2_expand_custom_XnXX (const struct builtin_description *d, tree exp, rtx target, ++ rtx subtarget ATTRIBUTE_UNUSED, enum machine_mode mode ATTRIBUTE_UNUSED, ++ int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx opcode; ++ rtx operands[2]; ++ int i; ++ ++ ++ /* custom_XnX should have exactly four operands */ ++ if (insn_data[d->icode].n_operands != 4) ++ abort (); ++ ++ target = nios2_create_target (d, target); ++ opcode = nios2_extract_opcode (d, 1, arglist); ++ for (i = 0; i < 2; i++) ++ { ++ arglist = TREE_CHAIN (arglist); ++ operands[i] = nios2_extract_operand (d, i + 2, i + 1, arglist); ++ } ++ ++ pat = GEN_FCN (d->icode) (target, opcode, operands[0], operands[1]); ++ ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return target; ++} ++ ++ ++ ++static rtx ++nios2_expand_STXIO (const struct builtin_description *d, tree exp, rtx target ATTRIBUTE_UNUSED, ++ rtx subtarget ATTRIBUTE_UNUSED, enum machine_mode mode ATTRIBUTE_UNUSED, ++ int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx store_dest, store_val; ++ enum insn_code icode = d->icode; ++ ++ /* stores should have exactly two operands */ ++ if (insn_data[icode].n_operands != 2) ++ abort (); ++ ++ /* process the destination of the store */ ++ { ++ enum machine_mode mode = insn_data[icode].operand[0].mode; ++ tree arg = TREE_VALUE (arglist); ++ store_dest = expand_expr (arg, NULL_RTX, VOIDmode, 0); ++ store_dest = protect_from_queue (store_dest, 0); ++ ++ store_dest = gen_rtx_MEM (mode, copy_to_mode_reg (Pmode, store_dest)); ++ ++ /* ??? Better errors would be nice */ ++ if (!(*insn_data[icode].operand[0].predicate) (store_dest, mode)) ++ error ("Invalid argument 1 to %s", d->name); ++ } ++ ++ ++ /* process the value to store */ ++ { ++ enum machine_mode mode = insn_data[icode].operand[1].mode; ++ tree arg = TREE_VALUE (TREE_CHAIN (arglist)); ++ store_val = expand_expr (arg, NULL_RTX, mode, 0); ++ store_val = protect_from_queue (store_val, 0); ++ ++ if (!(*insn_data[icode].operand[1].predicate) (store_val, mode)) ++ store_val = copy_to_mode_reg (mode, store_val); ++ ++ /* ??? Better errors would be nice */ ++ if (!(*insn_data[icode].operand[1].predicate) (store_val, mode)) ++ error ("Invalid argument 2 to %s", d->name); ++ } ++ ++ pat = GEN_FCN (d->icode) (store_dest, store_val); ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return 0; ++} ++ ++ ++static rtx ++nios2_expand_LDXIO (const struct builtin_description * d, tree exp, rtx target, ++ rtx subtarget ATTRIBUTE_UNUSED, enum machine_mode mode ATTRIBUTE_UNUSED, ++ int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx ld_src; ++ enum insn_code icode = d->icode; ++ ++ /* loads should have exactly two operands */ ++ if (insn_data[icode].n_operands != 2) ++ abort (); ++ ++ target = nios2_create_target (d, target); ++ ++ { ++ enum machine_mode mode = insn_data[icode].operand[1].mode; ++ tree arg = TREE_VALUE (arglist); ++ ld_src = expand_expr (arg, NULL_RTX, VOIDmode, 0); ++ ld_src = protect_from_queue (ld_src, 0); ++ ++ ld_src = gen_rtx_MEM (mode, copy_to_mode_reg (Pmode, ld_src)); ++ ++ /* ??? Better errors would be nice */ ++ if (!(*insn_data[icode].operand[1].predicate) (ld_src, mode)) ++ { ++ error ("Invalid argument 1 to %s", d->name); ++ } ++ } ++ ++ pat = GEN_FCN (d->icode) (target, ld_src); ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return target; ++} ++ ++ ++static rtx ++nios2_expand_sync (const struct builtin_description * d ATTRIBUTE_UNUSED, ++ tree exp ATTRIBUTE_UNUSED, rtx target ATTRIBUTE_UNUSED, ++ rtx subtarget ATTRIBUTE_UNUSED, ++ enum machine_mode mode ATTRIBUTE_UNUSED, ++ int ignore ATTRIBUTE_UNUSED) ++{ ++ emit_insn (gen_sync ()); ++ return 0; ++} ++ ++static rtx ++nios2_expand_rdctl (const struct builtin_description * d ATTRIBUTE_UNUSED, ++ tree exp ATTRIBUTE_UNUSED, rtx target ATTRIBUTE_UNUSED, ++ rtx subtarget ATTRIBUTE_UNUSED, ++ enum machine_mode mode ATTRIBUTE_UNUSED, ++ int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx rdctl_reg; ++ enum insn_code icode = d->icode; ++ ++ /* rdctl should have exactly two operands */ ++ if (insn_data[icode].n_operands != 2) ++ abort (); ++ ++ target = nios2_create_target (d, target); ++ ++ { ++ enum machine_mode mode = insn_data[icode].operand[1].mode; ++ tree arg = TREE_VALUE (arglist); ++ rdctl_reg = expand_expr (arg, NULL_RTX, VOIDmode, 0); ++ rdctl_reg = protect_from_queue (rdctl_reg, 0); ++ ++ if (!(*insn_data[icode].operand[1].predicate) (rdctl_reg, mode)) ++ { ++ error ("Control register number must be in range 0-31 for %s", d->name); ++ } ++ } ++ ++ pat = GEN_FCN (d->icode) (target, rdctl_reg); ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return target; ++} ++ ++static rtx ++nios2_expand_wrctl (const struct builtin_description * d ATTRIBUTE_UNUSED, ++ tree exp ATTRIBUTE_UNUSED, rtx target ATTRIBUTE_UNUSED, ++ rtx subtarget ATTRIBUTE_UNUSED, ++ enum machine_mode mode ATTRIBUTE_UNUSED, ++ int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx wrctl_reg, store_val; ++ enum insn_code icode = d->icode; ++ ++ /* stores should have exactly two operands */ ++ if (insn_data[icode].n_operands != 2) ++ abort (); ++ ++ /* process the destination of the store */ ++ { ++ enum machine_mode mode = insn_data[icode].operand[0].mode; ++ tree arg = TREE_VALUE (arglist); ++ wrctl_reg = expand_expr (arg, NULL_RTX, VOIDmode, 0); ++ wrctl_reg = protect_from_queue (wrctl_reg, 0); ++ ++ if (!(*insn_data[icode].operand[0].predicate) (wrctl_reg, mode)) ++ error ("Control register number must be in range 0-31 for %s", d->name); ++ } ++ ++ ++ /* process the value to store */ ++ { ++ enum machine_mode mode = insn_data[icode].operand[1].mode; ++ tree arg = TREE_VALUE (TREE_CHAIN (arglist)); ++ store_val = expand_expr (arg, NULL_RTX, mode, 0); ++ store_val = protect_from_queue (store_val, 0); ++ ++ if (!(*insn_data[icode].operand[1].predicate) (store_val, mode)) ++ store_val = copy_to_mode_reg (mode, store_val); ++ ++ /* ??? Better errors would be nice */ ++ if (!(*insn_data[icode].operand[1].predicate) (store_val, mode)) ++ error ("Invalid argument 2 to %s", d->name); ++ } ++ ++ pat = GEN_FCN (d->icode) (wrctl_reg, store_val); ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return 0; ++} ++ ++ ++#include "gt-nios2.h" ++ +--- gcc-3.4.3/gcc/config/nios2/nios2.h ++++ gcc-3.4.3-nios2/gcc/config/nios2/nios2.h +@@ -0,0 +1,824 @@ ++/* Definitions of target machine for Altera NIOS 2G NIOS2 version. ++ Copyright (C) 2003 Altera ++ Contributed by Jonah Graham (jgraham@altera.com). ++ ++This file is part of GNU CC. ++ ++GNU CC is free software; you can redistribute it and/or modify ++it under the terms of the GNU General Public License as published by ++the Free Software Foundation; either version 2, or (at your option) ++any later version. ++ ++GNU CC is distributed in the hope that it will be useful, ++but WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++GNU General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GNU CC; see the file COPYING. If not, write to ++the Free Software Foundation, 59 Temple Place - Suite 330, ++Boston, MA 02111-1307, USA. */ ++ ++ ++ ++#define TARGET_CPU_CPP_BUILTINS() \ ++ do \ ++ { \ ++ builtin_define_std ("NIOS2"); \ ++ builtin_define_std ("nios2"); \ ++ builtin_define ("_GNU_SOURCE"); \ ++ } \ ++ while (0) ++#define TARGET_VERSION fprintf (stderr, " (Altera Nios II)") ++ ++ ++ ++ ++ ++/********************************* ++ * Run-time Target Specification ++ *********************************/ ++ ++#define HAS_DIV_FLAG 0x0001 ++#define HAS_MUL_FLAG 0x0002 ++#define HAS_MULX_FLAG 0x0004 ++#define FAST_SW_DIV_FLAG 0x0008 ++#define INLINE_MEMCPY_FLAG 0x00010 ++#define CACHE_VOLATILE_FLAG 0x0020 ++#define BYPASS_CACHE_FLAG 0x0040 ++ ++extern int target_flags; ++#define TARGET_HAS_DIV (target_flags & HAS_DIV_FLAG) ++#define TARGET_HAS_MUL (target_flags & HAS_MUL_FLAG) ++#define TARGET_HAS_MULX (target_flags & HAS_MULX_FLAG) ++#define TARGET_FAST_SW_DIV (target_flags & FAST_SW_DIV_FLAG) ++#define TARGET_INLINE_MEMCPY (target_flags & INLINE_MEMCPY_FLAG) ++#define TARGET_CACHE_VOLATILE (target_flags & CACHE_VOLATILE_FLAG) ++#define TARGET_BYPASS_CACHE (target_flags & BYPASS_CACHE_FLAG) ++ ++#define TARGET_SWITCHES \ ++{ \ ++ { "hw-div", HAS_DIV_FLAG, \ ++ N_("Enable DIV, DIVU") }, \ ++ { "no-hw-div", -HAS_DIV_FLAG, \ ++ N_("Disable DIV, DIVU (default)") }, \ ++ { "hw-mul", HAS_MUL_FLAG, \ ++ N_("Enable MUL instructions (default)") }, \ ++ { "hw-mulx", HAS_MULX_FLAG, \ ++ N_("Enable MULX instructions, assume fast shifter") }, \ ++ { "no-hw-mul", -HAS_MUL_FLAG, \ ++ N_("Disable MUL instructions") }, \ ++ { "no-hw-mulx", -HAS_MULX_FLAG, \ ++ N_("Disable MULX instructions, assume slow shifter (default and implied by -mno-hw-mul)") }, \ ++ { "fast-sw-div", FAST_SW_DIV_FLAG, \ ++ N_("Use table based fast divide (default at -O3)") }, \ ++ { "no-fast-sw-div", -FAST_SW_DIV_FLAG, \ ++ N_("Don't use table based fast divide ever") }, \ ++ { "inline-memcpy", INLINE_MEMCPY_FLAG, \ ++ N_("Inline small memcpy (default when optimizing)") }, \ ++ { "no-inline-memcpy", -INLINE_MEMCPY_FLAG, \ ++ N_("Don't Inline small memcpy") }, \ ++ { "cache-volatile", CACHE_VOLATILE_FLAG, \ ++ N_("Volatile accesses use non-io variants of instructions (default)") }, \ ++ { "no-cache-volatile", -CACHE_VOLATILE_FLAG, \ ++ N_("Volatile accesses use io variants of instructions") }, \ ++ { "bypass-cache", BYPASS_CACHE_FLAG, \ ++ N_("All ld/st instructins use io variants") }, \ ++ { "no-bypass-cache", -BYPASS_CACHE_FLAG, \ ++ N_("All ld/st instructins do not use io variants (default)") }, \ ++ { "smallc", 0, \ ++ N_("Link with a limited version of the C library") }, \ ++ { "ctors-in-init", 0, \ ++ "" /* undocumented: N_("Link with static constructors and destructors in init") */ }, \ ++ { "", TARGET_DEFAULT, 0 } \ ++} ++ ++ ++extern const char *nios2_sys_nosys_string; /* for -msys=nosys */ ++extern const char *nios2_sys_lib_string; /* for -msys-lib= */ ++extern const char *nios2_sys_crt0_string; /* for -msys-crt0= */ ++ ++#define TARGET_OPTIONS \ ++{ \ ++ { "sys=nosys", &nios2_sys_nosys_string, \ ++ N_("Use stub versions of OS library calls (default)"), 0}, \ ++ { "sys-lib=", &nios2_sys_lib_string, \ ++ N_("Name of System Library to link against. (Converted to a -l option)"), 0}, \ ++ { "sys-crt0=", &nios2_sys_crt0_string, \ ++ N_("Name of the startfile. (default is a crt0 for the ISS only)"), 0}, \ ++} ++ ++ ++/* Default target_flags if no switches specified. */ ++#ifndef TARGET_DEFAULT ++# define TARGET_DEFAULT (HAS_MUL_FLAG | CACHE_VOLATILE_FLAG) ++#endif ++ ++/* Switch Recognition by gcc.c. Add -G xx support */ ++#undef SWITCH_TAKES_ARG ++#define SWITCH_TAKES_ARG(CHAR) \ ++ (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G') ++ ++#define OVERRIDE_OPTIONS override_options () ++#define OPTIMIZATION_OPTIONS(LEVEL, SIZE) optimization_options (LEVEL, SIZE) ++#define CAN_DEBUG_WITHOUT_FP ++ ++#define CC1_SPEC "\ ++%{G*}" ++ ++#undef LIB_SPEC ++#define LIB_SPEC \ ++"--start-group %{msmallc: -lsmallc} %{!msmallc: -lc} -lgcc \ ++ %{msys-lib=*: -l%*} \ ++ %{!msys-lib=*: -lc } \ ++ --end-group \ ++ %{msys-lib=: %eYou need a library name for -msys-lib=} \ ++" ++ ++ ++#undef STARTFILE_SPEC ++#define STARTFILE_SPEC \ ++"%{msys-crt0=*: %*} %{!msys-crt0=*: crt1%O%s} \ ++ %{msys-crt0=: %eYou need a C startup file for -msys-crt0=} \ ++ %{mctors-in-init: crti%O%s crtbegin%O%s} \ ++" ++ ++#undef ENDFILE_SPEC ++#define ENDFILE_SPEC \ ++ "%{mctors-in-init: crtend%O%s crtn%O%s}" ++ ++ ++/*********************** ++ * Storage Layout ++ ***********************/ ++ ++#define DEFAULT_SIGNED_CHAR 1 ++#define BITS_BIG_ENDIAN 0 ++#define BYTES_BIG_ENDIAN 0 ++#define WORDS_BIG_ENDIAN 0 ++#define BITS_PER_UNIT 8 ++#define BITS_PER_WORD 32 ++#define UNITS_PER_WORD 4 ++#define POINTER_SIZE 32 ++#define BIGGEST_ALIGNMENT 32 ++#define STRICT_ALIGNMENT 1 ++#define FUNCTION_BOUNDARY 32 ++#define PARM_BOUNDARY 32 ++#define STACK_BOUNDARY 32 ++#define PREFERRED_STACK_BOUNDARY 32 ++#define MAX_FIXED_MODE_SIZE 64 ++ ++#define CONSTANT_ALIGNMENT(EXP, ALIGN) \ ++ ((TREE_CODE (EXP) == STRING_CST) \ ++ && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN)) ++ ++ ++/********************** ++ * Layout of Source Language Data Types ++ **********************/ ++ ++#define INT_TYPE_SIZE 32 ++#define SHORT_TYPE_SIZE 16 ++#define LONG_TYPE_SIZE 32 ++#define LONG_LONG_TYPE_SIZE 64 ++#define FLOAT_TYPE_SIZE 32 ++#define DOUBLE_TYPE_SIZE 64 ++#define LONG_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE ++ ++ ++/************************* ++ * Condition Code Status ++ ************************/ ++ ++/* comparison type */ ++/* ??? currently only CMP_SI is used */ ++enum cmp_type { ++ CMP_SI, /* compare four byte integers */ ++ CMP_DI, /* compare eight byte integers */ ++ CMP_SF, /* compare single precision floats */ ++ CMP_DF, /* compare double precision floats */ ++ CMP_MAX /* max comparison type */ ++}; ++ ++extern GTY(()) rtx branch_cmp[2]; /* operands for compare */ ++extern enum cmp_type branch_type; /* what type of branch to use */ ++ ++/********************** ++ * Register Usage ++ **********************/ ++ ++/* ---------------------------------- * ++ * Basic Characteristics of Registers ++ * ---------------------------------- */ ++ ++/* ++Register Number ++ Register Name ++ Alternate Name ++ Purpose ++0 r0 zero always zero ++1 r1 at Assembler Temporary ++2-3 r2-r3 Return Location ++4-7 r4-r7 Register Arguments ++8-15 r8-r15 Caller Saved Registers ++16-22 r16-r22 Callee Saved Registers ++23 r23 sc Static Chain (Callee Saved) ++ ??? Does $sc want to be caller or callee ++ saved. If caller, 15, else 23. ++24 r24 Exception Temporary ++25 r25 Breakpoint Temporary ++26 r26 gp Global Pointer ++27 r27 sp Stack Pointer ++28 r28 fp Frame Pointer ++29 r29 ea Exception Return Address ++30 r30 ba Breakpoint Return Address ++31 r31 ra Return Address ++ ++32 ctl0 status ++33 ctl1 estatus STATUS saved by exception ? ++34 ctl2 bstatus STATUS saved by break ? ++35 ctl3 ipri Interrupt Priority Mask ? ++36 ctl4 ecause Exception Cause ? ++ ++37 pc Not an actual register ++ ++38 rap Return address pointer, this does not ++ actually exist and will be eliminated ++ ++39 fake_fp Fake Frame Pointer which will always be eliminated. ++40 fake_ap Fake Argument Pointer which will always be eliminated. ++ ++41 First Pseudo Register ++ ++ ++The definitions for all the hard register numbers ++are located in nios2.md. ++*/ ++ ++#define FIRST_PSEUDO_REGISTER 41 ++#define NUM_ARG_REGS (LAST_ARG_REGNO - FIRST_ARG_REGNO + 1) ++ ++ ++ ++/* also see CONDITIONAL_REGISTER_USAGE */ ++#define FIXED_REGISTERS \ ++ { \ ++/* +0 1 2 3 4 5 6 7 8 9 */ \ ++/* 0 */ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, \ ++/* 10 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ ++/* 20 */ 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, \ ++/* 30 */ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, \ ++/* 40 */ 1, \ ++ } ++ ++/* call used is the same as caller saved ++ + fixed regs + args + ret vals */ ++#define CALL_USED_REGISTERS \ ++ { \ ++/* +0 1 2 3 4 5 6 7 8 9 */ \ ++/* 0 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ ++/* 10 */ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, \ ++/* 20 */ 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, \ ++/* 30 */ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, \ ++/* 40 */ 1, \ ++ } ++ ++#define HARD_REGNO_NREGS(REGNO, MODE) \ ++ ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \ ++ / UNITS_PER_WORD) ++ ++/* --------------------------- * ++ * How Values Fit in Registers ++ * --------------------------- */ ++ ++#define HARD_REGNO_MODE_OK(REGNO, MODE) 1 ++ ++#define MODES_TIEABLE_P(MODE1, MODE2) 1 ++ ++ ++/************************* ++ * Register Classes ++ *************************/ ++ ++enum reg_class ++{ ++ NO_REGS, ++ ALL_REGS, ++ LIM_REG_CLASSES ++}; ++ ++#define N_REG_CLASSES (int) LIM_REG_CLASSES ++ ++#define REG_CLASS_NAMES \ ++ {"NO_REGS", \ ++ "ALL_REGS"} ++ ++#define GENERAL_REGS ALL_REGS ++ ++#define REG_CLASS_CONTENTS \ ++/* NO_REGS */ {{ 0, 0}, \ ++/* ALL_REGS */ {~0,~0}} \ ++ ++#define REGNO_REG_CLASS(REGNO) ALL_REGS ++ ++#define BASE_REG_CLASS ALL_REGS ++#define INDEX_REG_CLASS ALL_REGS ++ ++/* only one reg class, 'r', is handled automatically */ ++#define REG_CLASS_FROM_LETTER(CHAR) NO_REGS ++ ++#define REGNO_OK_FOR_BASE_P2(REGNO, STRICT) \ ++ ((STRICT) \ ++ ? (REGNO) < FIRST_PSEUDO_REGISTER \ ++ : (REGNO) < FIRST_PSEUDO_REGISTER || (reg_renumber && reg_renumber[REGNO] < FIRST_PSEUDO_REGISTER)) ++ ++#define REGNO_OK_FOR_INDEX_P2(REGNO, STRICT) \ ++ (REGNO_OK_FOR_BASE_P2 (REGNO, STRICT)) ++ ++#define REGNO_OK_FOR_BASE_P(REGNO) \ ++ (REGNO_OK_FOR_BASE_P2 (REGNO, 1)) ++ ++#define REGNO_OK_FOR_INDEX_P(REGNO) \ ++ (REGNO_OK_FOR_INDEX_P2 (REGNO, 1)) ++ ++#define REG_OK_FOR_BASE_P2(X, STRICT) \ ++ (STRICT \ ++ ? REGNO_OK_FOR_BASE_P2 (REGNO (X), 1) \ ++ : REGNO_OK_FOR_BASE_P2 (REGNO (X), 1) || REGNO(X) >= FIRST_PSEUDO_REGISTER) ++ ++#define REG_OK_FOR_INDEX_P2(X, STRICT) \ ++ (STRICT \ ++ ? REGNO_OK_FOR_INDEX_P2 (REGNO (X), 1) \ ++ : REGNO_OK_FOR_INDEX_P2 (REGNO (X), 1) || REGNO(X) >= FIRST_PSEUDO_REGISTER) ++ ++#define CLASS_MAX_NREGS(CLASS, MODE) \ ++ ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \ ++ / UNITS_PER_WORD) ++ ++ ++#define SMALL_INT(X) ((unsigned HOST_WIDE_INT) ((X) + 0x8000) < 0x10000) ++#define SMALL_INT_UNSIGNED(X) ((unsigned HOST_WIDE_INT) (X) < 0x10000) ++#define UPPER16_INT(X) (((X) & 0xffff) == 0) ++#define SHIFT_INT(X) ((X) >= 0 && (X) <= 31) ++#define RDWRCTL_INT(X) ((X) >= 0 && (X) <= 31) ++#define CUSTOM_INSN_OPCODE(X) ((X) >= 0 && (X) <= 255) ++ ++#define CONST_OK_FOR_LETTER_P(VALUE, C) \ ++ ( \ ++ (C) == 'I' ? SMALL_INT (VALUE) : \ ++ (C) == 'J' ? SMALL_INT_UNSIGNED (VALUE) : \ ++ (C) == 'K' ? UPPER16_INT (VALUE) : \ ++ (C) == 'L' ? SHIFT_INT (VALUE) : \ ++ (C) == 'M' ? (VALUE) == 0 : \ ++ (C) == 'N' ? CUSTOM_INSN_OPCODE (VALUE) : \ ++ (C) == 'O' ? RDWRCTL_INT (VALUE) : \ ++ 0) ++ ++#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0 ++ ++#define PREFERRED_RELOAD_CLASS(X, CLASS) \ ++ ((CLASS) == NO_REGS ? GENERAL_REGS : (CLASS)) ++ ++/* 'S' matches immediates which are in small data ++ and therefore can be added to gp to create a ++ 32-bit value. */ ++#define EXTRA_CONSTRAINT(VALUE, C) \ ++ ((C) == 'S' \ ++ && (GET_CODE (VALUE) == SYMBOL_REF) \ ++ && SYMBOL_REF_IN_NIOS2_SMALL_DATA_P (VALUE)) ++ ++ ++ ++ ++/* Say that the epilogue uses the return address register. Note that ++ in the case of sibcalls, the values "used by the epilogue" are ++ considered live at the start of the called function. */ ++#define EPILOGUE_USES(REGNO) ((REGNO) == RA_REGNO) ++ ++ ++#define DEFAULT_MAIN_RETURN c_expand_return (integer_zero_node) ++ ++/********************************** ++ * Trampolines for Nested Functions ++ ***********************************/ ++ ++#define TRAMPOLINE_TEMPLATE(FILE) \ ++ error ("trampolines not yet implemented") ++#define TRAMPOLINE_SIZE 20 ++#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ ++ error ("trampolines not yet implemented") ++ ++/*************************** ++ * Stack Layout and Calling Conventions ++ ***************************/ ++ ++/* ------------------ * ++ * Basic Stack Layout ++ * ------------------ */ ++ ++/* The downward variants are used by the compiler, ++ the upward ones serve as documentation */ ++#define STACK_GROWS_DOWNWARD ++#define FRAME_GROWS_UPWARD ++#define ARGS_GROW_UPWARD ++ ++#define STARTING_FRAME_OFFSET current_function_outgoing_args_size ++#define FIRST_PARM_OFFSET(FUNDECL) 0 ++ ++/* Before the prologue, RA lives in r31. */ ++#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (VOIDmode, RA_REGNO) ++ ++/* -------------------------------------- * ++ * Registers That Address the Stack Frame ++ * -------------------------------------- */ ++ ++#define STACK_POINTER_REGNUM SP_REGNO ++#define STATIC_CHAIN_REGNUM SC_REGNO ++#define PC_REGNUM PC_REGNO ++#define DWARF_FRAME_RETURN_COLUMN RA_REGNO ++ ++/* Base register for access to local variables of the function. We ++ pretend that the frame pointer is a non-existent hard register, and ++ then eliminate it to HARD_FRAME_POINTER_REGNUM. */ ++#define FRAME_POINTER_REGNUM FAKE_FP_REGNO ++ ++#define HARD_FRAME_POINTER_REGNUM FP_REGNO ++#define RETURN_ADDRESS_POINTER_REGNUM RAP_REGNO ++/* the argumnet pointer needs to always be eliminated ++ so it is set to a fake hard register. */ ++#define ARG_POINTER_REGNUM FAKE_AP_REGNO ++ ++/* ----------------------------------------- * ++ * Eliminating Frame Pointer and Arg Pointer ++ * ----------------------------------------- */ ++ ++#define FRAME_POINTER_REQUIRED 0 ++ ++#define ELIMINABLE_REGS \ ++{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ ++ { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ ++ { RETURN_ADDRESS_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ ++ { RETURN_ADDRESS_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ ++ { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ ++ { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}} ++ ++#define CAN_ELIMINATE(FROM, TO) 1 ++ ++#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ ++ (OFFSET) = nios2_initial_elimination_offset ((FROM), (TO)) ++ ++#define MUST_SAVE_REGISTER(regno) \ ++ ((regs_ever_live[regno] && !call_used_regs[regno]) \ ++ || (regno == HARD_FRAME_POINTER_REGNUM && frame_pointer_needed) \ ++ || (regno == RA_REGNO && regs_ever_live[RA_REGNO])) ++ ++/* Treat LOC as a byte offset from the stack pointer and round it up ++ to the next fully-aligned offset. */ ++#define STACK_ALIGN(LOC) \ ++ (((LOC) + ((PREFERRED_STACK_BOUNDARY / 8) - 1)) & ~((PREFERRED_STACK_BOUNDARY / 8) - 1)) ++ ++ ++/* ------------------------------ * ++ * Passing Arguments in Registers ++ * ------------------------------ */ ++ ++/* see nios2.c */ ++#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ ++ (function_arg (&CUM, MODE, TYPE, NAMED)) ++ ++#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \ ++ (function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)) ++ ++#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) 0 ++ ++#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) 0 ++ ++typedef struct nios2_args ++{ ++ int regs_used; ++} CUMULATIVE_ARGS; ++ ++/* This is to initialize the above unused CUM data type */ ++#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \ ++ (init_cumulative_args (&CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS)) ++ ++#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ ++ (function_arg_advance (&CUM, MODE, TYPE, NAMED)) ++ ++#define FUNCTION_ARG_REGNO_P(REGNO) \ ++ ((REGNO) >= FIRST_ARG_REGNO && (REGNO) <= LAST_ARG_REGNO) ++ ++#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \ ++ { \ ++ int pret_size = nios2_setup_incoming_varargs (&(CUM), (MODE), \ ++ (TYPE), (NO_RTL)); \ ++ if (pret_size) \ ++ (PRETEND_SIZE) = pret_size; \ ++ } ++ ++/* ----------------------------- * ++ * Generating Code for Profiling ++ * ----------------------------- */ ++ ++#define PROFILE_BEFORE_PROLOGUE ++ ++#define FUNCTION_PROFILER(FILE, LABELNO) \ ++ function_profiler ((FILE), (LABELNO)) ++ ++/* --------------------------------------- * ++ * Passing Function Arguments on the Stack ++ * --------------------------------------- */ ++ ++#define PROMOTE_PROTOTYPES 1 ++ ++#define PUSH_ARGS 0 ++#define ACCUMULATE_OUTGOING_ARGS 1 ++ ++#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACKSIZE) 0 ++ ++/* --------------------------------------- * ++ * How Scalar Function Values Are Returned ++ * --------------------------------------- */ ++ ++#define FUNCTION_VALUE(VALTYPE, FUNC) \ ++ gen_rtx(REG, TYPE_MODE(VALTYPE), FIRST_RETVAL_REGNO) ++ ++#define LIBCALL_VALUE(MODE) \ ++ gen_rtx(REG, MODE, FIRST_RETVAL_REGNO) ++ ++#define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO) == FIRST_RETVAL_REGNO) ++ ++/* ----------------------------- * ++ * How Large Values Are Returned ++ * ----------------------------- */ ++ ++ ++#define RETURN_IN_MEMORY(TYPE) \ ++ nios2_return_in_memory (TYPE) ++ ++ ++#define STRUCT_VALUE 0 ++ ++#define DEFAULT_PCC_STRUCT_RETURN 0 ++ ++/******************* ++ * Addressing Modes ++ *******************/ ++ ++ ++#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) ++ ++#define CONSTANT_ADDRESS_P(X) (CONSTANT_P (X)) ++ ++#define MAX_REGS_PER_ADDRESS 1 ++ ++/* Go to ADDR if X is a valid address. */ ++#ifndef REG_OK_STRICT ++#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ ++ { \ ++ if (nios2_legitimate_address ((X), (MODE), 0)) \ ++ goto ADDR; \ ++ } ++#else ++#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ ++ { \ ++ if (nios2_legitimate_address ((X), (MODE), 1)) \ ++ goto ADDR; \ ++ } ++#endif ++ ++#ifndef REG_OK_STRICT ++#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P2 (REGNO (X), 0) ++#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P2 (REGNO (X), 0) ++#else ++#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P2 (REGNO (X), 1) ++#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P2 (REGNO (X), 1) ++#endif ++ ++#define LEGITIMATE_CONSTANT_P(X) 1 ++ ++/* Nios II has no mode dependent addresses. */ ++#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) ++ ++/* Set if this has a weak declaration */ ++#define SYMBOL_FLAG_WEAK_DECL (1 << SYMBOL_FLAG_MACH_DEP_SHIFT) ++#define SYMBOL_REF_WEAK_DECL_P(RTX) \ ++ ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_WEAK_DECL) != 0) ++ ++ ++/* true if a symbol is both small and not weak. In this case, gp ++ relative access can be used */ ++#define SYMBOL_REF_IN_NIOS2_SMALL_DATA_P(RTX) \ ++ (SYMBOL_REF_SMALL_P(RTX) && !SYMBOL_REF_WEAK_DECL_P(RTX)) ++ ++/***************** ++ * Describing Relative Costs of Operations ++ *****************/ ++ ++#define SLOW_BYTE_ACCESS 1 ++ ++/* It is as good to call a constant function address as to call an address ++ kept in a register. ++ ??? Not true anymore really. Now that call cannot address full range ++ of memory callr may need to be used */ ++ ++#define NO_FUNCTION_CSE ++#define NO_RECURSIVE_FUNCTION_CSE ++ ++ ++ ++/***************************************** ++ * Defining the Output Assembler Language ++ *****************************************/ ++ ++/* ------------------------------------------ * ++ * The Overall Framework of an Assembler File ++ * ------------------------------------------ */ ++ ++#define ASM_APP_ON "#APP\n" ++#define ASM_APP_OFF "#NO_APP\n" ++ ++#define ASM_COMMENT_START "# " ++ ++/* ------------------------------- * ++ * Output and Generation of Labels ++ * ------------------------------- */ ++ ++#define GLOBAL_ASM_OP "\t.global\t" ++ ++ ++/* -------------- * ++ * Output of Data ++ * -------------- */ ++ ++#define DWARF2_UNWIND_INFO 0 ++ ++ ++/* -------------------------------- * ++ * Assembler Commands for Alignment ++ * -------------------------------- */ ++ ++#define ASM_OUTPUT_ALIGN(FILE, LOG) \ ++ do { \ ++ fprintf ((FILE), "%s%d\n", ALIGN_ASM_OP, (LOG)); \ ++ } while (0) ++ ++ ++/* -------------------------------- * ++ * Output of Assembler Instructions ++ * -------------------------------- */ ++ ++#define REGISTER_NAMES \ ++{ \ ++ "zero", \ ++ "at", \ ++ "r2", \ ++ "r3", \ ++ "r4", \ ++ "r5", \ ++ "r6", \ ++ "r7", \ ++ "r8", \ ++ "r9", \ ++ "r10", \ ++ "r11", \ ++ "r12", \ ++ "r13", \ ++ "r14", \ ++ "r15", \ ++ "r16", \ ++ "r17", \ ++ "r18", \ ++ "r19", \ ++ "r20", \ ++ "r21", \ ++ "r22", \ ++ "r23", \ ++ "r24", \ ++ "r25", \ ++ "gp", \ ++ "sp", \ ++ "fp", \ ++ "ta", \ ++ "ba", \ ++ "ra", \ ++ "status", \ ++ "estatus", \ ++ "bstatus", \ ++ "ipri", \ ++ "ecause", \ ++ "pc", \ ++ "rap", \ ++ "fake_fp", \ ++ "fake_ap", \ ++} ++ ++#define ASM_OUTPUT_OPCODE(STREAM, PTR)\ ++ (PTR) = asm_output_opcode (STREAM, PTR) ++ ++#define PRINT_OPERAND(STREAM, X, CODE) \ ++ nios2_print_operand (STREAM, X, CODE) ++ ++#define PRINT_OPERAND_ADDRESS(STREAM, X) \ ++ nios2_print_operand_address (STREAM, X) ++ ++#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ ++do { fputs (integer_asm_op (POINTER_SIZE / BITS_PER_UNIT, TRUE), FILE); \ ++ fprintf (FILE, ".L%u\n", (unsigned) (VALUE)); \ ++ } while (0) ++ ++ ++/* ------------ * ++ * Label Output ++ * ------------ */ ++ ++ ++/* ---------------------------------------------------- * ++ * Dividing the Output into Sections (Texts, Data, ...) ++ * ---------------------------------------------------- */ ++ ++/* Output before read-only data. */ ++#define TEXT_SECTION_ASM_OP ("\t.section\t.text") ++ ++/* Output before writable data. */ ++#define DATA_SECTION_ASM_OP ("\t.section\t.data") ++ ++ ++/* Default the definition of "small data" to 8 bytes. */ ++/* ??? How come I can't use HOST_WIDE_INT here? */ ++extern unsigned long nios2_section_threshold; ++#define NIOS2_DEFAULT_GVALUE 8 ++ ++ ++ ++/* This says how to output assembler code to declare an ++ uninitialized external linkage data object. Under SVR4, ++ the linker seems to want the alignment of data objects ++ to depend on their types. We do exactly that here. */ ++ ++#undef COMMON_ASM_OP ++#define COMMON_ASM_OP "\t.comm\t" ++ ++#undef ASM_OUTPUT_ALIGNED_COMMON ++#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ ++do \ ++{ \ ++ if ((SIZE) <= nios2_section_threshold) \ ++ { \ ++ named_section (0, ".sbss", 0); \ ++ (*targetm.asm_out.globalize_label) (FILE, NAME); \ ++ ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \ ++ if (!flag_inhibit_size_directive) \ ++ ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \ ++ ASM_OUTPUT_ALIGN ((FILE), exact_log2((ALIGN) / BITS_PER_UNIT)); \ ++ ASM_OUTPUT_LABEL(FILE, NAME); \ ++ ASM_OUTPUT_SKIP((FILE), (SIZE) ? (SIZE) : 1); \ ++ } \ ++ else \ ++ { \ ++ fprintf ((FILE), "%s", COMMON_ASM_OP); \ ++ assemble_name ((FILE), (NAME)); \ ++ fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \ ++ } \ ++} \ ++while (0) ++ ++ ++/* This says how to output assembler code to declare an ++ uninitialized internal linkage data object. Under SVR4, ++ the linker seems to want the alignment of data objects ++ to depend on their types. We do exactly that here. */ ++ ++#undef ASM_OUTPUT_ALIGNED_LOCAL ++#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ ++do { \ ++ if ((SIZE) <= nios2_section_threshold) \ ++ named_section (0, ".sbss", 0); \ ++ else \ ++ named_section (0, ".bss", 0); \ ++ ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \ ++ if (!flag_inhibit_size_directive) \ ++ ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \ ++ ASM_OUTPUT_ALIGN ((FILE), exact_log2((ALIGN) / BITS_PER_UNIT)); \ ++ ASM_OUTPUT_LABEL(FILE, NAME); \ ++ ASM_OUTPUT_SKIP((FILE), (SIZE) ? (SIZE) : 1); \ ++} while (0) ++ ++ ++ ++/*************************** ++ * Miscellaneous Parameters ++ ***************************/ ++ ++#define MOVE_MAX 4 ++ ++#define Pmode SImode ++#define FUNCTION_MODE QImode ++ ++#define CASE_VECTOR_MODE Pmode ++ ++#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 ++ ++#define LOAD_EXTEND_OP(MODE) (ZERO_EXTEND) ++ ++#define WORD_REGISTER_OPERATIONS +--- gcc-3.4.3/gcc/config/nios2/nios2.md ++++ gcc-3.4.3-nios2/gcc/config/nios2/nios2.md +@@ -0,0 +1,2078 @@ ++;; Machine Description for Altera NIOS 2G NIOS2 version. ++;; Copyright (C) 2003 Altera ++;; Contributed by Jonah Graham (jgraham@altera.com). ++;; ++;; This file is part of GNU CC. ++;; ++;; GNU CC is free software; you can redistribute it and/or modify ++;; it under the terms of the GNU General Public License as published by ++;; the Free Software Foundation; either version 2, or (at your option) ++;; any later version. ++;; ++;; GNU CC is distributed in the hope that it will be useful, ++;; but WITHOUT ANY WARRANTY; without even the implied warranty of ++;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++;; GNU General Public License for more details. ++;; ++;; You should have received a copy of the GNU General Public License ++;; along with GNU CC; see the file COPYING. If not, write to ++;; the Free Software Foundation, 59 Temple Place - Suite 330, ++;; Boston, MA 02111-1307, USA. */ ++ ++ ++ ++;***************************************************************************** ++;* ++;* constants ++;* ++;***************************************************************************** ++(define_constants [ ++ (GP_REGNO 26) ++ (SP_REGNO 27) ++ (FP_REGNO 28) ++ (RA_REGNO 31) ++ (RAP_REGNO 38) ++ (FIRST_RETVAL_REGNO 2) ++ (LAST_RETVAL_REGNO 3) ++ (FIRST_ARG_REGNO 4) ++ (LAST_ARG_REGNO 7) ++ (SC_REGNO 23) ++ (PC_REGNO 37) ++ (FAKE_FP_REGNO 39) ++ (FAKE_AP_REGNO 40) ++ ++ ++ (UNSPEC_BLOCKAGE 0) ++ (UNSPEC_LDBIO 1) ++ (UNSPEC_LDBUIO 2) ++ (UNSPEC_LDHIO 3) ++ (UNSPEC_LDHUIO 4) ++ (UNSPEC_LDWIO 5) ++ (UNSPEC_STBIO 6) ++ (UNSPEC_STHIO 7) ++ (UNSPEC_STWIO 8) ++ (UNSPEC_SYNC 9) ++ (UNSPEC_WRCTL 10) ++ (UNSPEC_RDCTL 11) ++ ++]) ++ ++ ++ ++;***************************************************************************** ++;* ++;* instruction scheduler ++;* ++;***************************************************************************** ++ ++; No schedule info is currently available, using an assumption that no ++; instruction can use the results of the previous instruction without ++; incuring a stall. ++ ++; length of an instruction (in bytes) ++(define_attr "length" "" (const_int 4)) ++(define_attr "type" "unknown,complex,control,alu,cond_alu,st,ld,shift,mul,div,custom" (const_string "complex")) ++ ++(define_asm_attributes ++ [(set_attr "length" "4") ++ (set_attr "type" "complex")]) ++ ++(define_automaton "nios2") ++(automata_option "v") ++;(automata_option "no-minimization") ++(automata_option "ndfa") ++ ++; The nios2 pipeline is fairly straightforward for the fast model. ++; Every alu operation is pipelined so that an instruction can ++; be issued every cycle. However, there are still potential ++; stalls which this description tries to deal with. ++ ++(define_cpu_unit "cpu" "nios2") ++ ++(define_insn_reservation "complex" 1 ++ (eq_attr "type" "complex") ++ "cpu") ++ ++(define_insn_reservation "control" 1 ++ (eq_attr "type" "control") ++ "cpu") ++ ++(define_insn_reservation "alu" 1 ++ (eq_attr "type" "alu") ++ "cpu") ++ ++(define_insn_reservation "cond_alu" 1 ++ (eq_attr "type" "cond_alu") ++ "cpu") ++ ++(define_insn_reservation "st" 1 ++ (eq_attr "type" "st") ++ "cpu") ++ ++(define_insn_reservation "custom" 1 ++ (eq_attr "type" "custom") ++ "cpu") ++ ++; shifts, muls and lds have three cycle latency ++(define_insn_reservation "ld" 3 ++ (eq_attr "type" "ld") ++ "cpu") ++ ++(define_insn_reservation "shift" 3 ++ (eq_attr "type" "shift") ++ "cpu") ++ ++(define_insn_reservation "mul" 3 ++ (eq_attr "type" "mul") ++ "cpu") ++ ++(define_insn_reservation "div" 1 ++ (eq_attr "type" "div") ++ "cpu") ++ ++ ++;***************************************************************************** ++;* ++;* MOV Instructions ++;* ++;***************************************************************************** ++ ++(define_expand "movqi" ++ [(set (match_operand:QI 0 "nonimmediate_operand" "") ++ (match_operand:QI 1 "general_operand" ""))] ++ "" ++{ ++ if (nios2_emit_move_sequence (operands, QImode)) ++ DONE; ++}) ++ ++(define_insn "movqi_internal" ++ [(set (match_operand:QI 0 "nonimmediate_operand" "=m, r,r, r") ++ (match_operand:QI 1 "general_operand" "rM,m,rM,I"))] ++ "(register_operand (operands[0], QImode) ++ || register_operand (operands[1], QImode) ++ || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))" ++ "@ ++ stb%o0\\t%z1, %0 ++ ldbu%o1\\t%0, %1 ++ mov\\t%0, %z1 ++ movi\\t%0, %1" ++ [(set_attr "type" "st,ld,alu,alu")]) ++ ++(define_insn "ldbio" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(const_int 0)] UNSPEC_LDBIO)) ++ (use (match_operand:SI 1 "memory_operand" "m"))] ++ "" ++ "ldbio\\t%0, %1" ++ [(set_attr "type" "ld")]) ++ ++(define_insn "ldbuio" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(const_int 0)] UNSPEC_LDBUIO)) ++ (use (match_operand:SI 1 "memory_operand" "m"))] ++ "" ++ "ldbuio\\t%0, %1" ++ [(set_attr "type" "ld")]) ++ ++(define_insn "stbio" ++ [(set (match_operand:SI 0 "memory_operand" "=m") ++ (match_operand:SI 1 "register_operand" "r")) ++ (unspec_volatile:SI [(const_int 0)] UNSPEC_STBIO)] ++ "" ++ "stbio\\t%z1, %0" ++ [(set_attr "type" "st")]) ++ ++ ++(define_expand "movhi" ++ [(set (match_operand:HI 0 "nonimmediate_operand" "") ++ (match_operand:HI 1 "general_operand" ""))] ++ "" ++{ ++ if (nios2_emit_move_sequence (operands, HImode)) ++ DONE; ++}) ++ ++(define_insn "movhi_internal" ++ [(set (match_operand:HI 0 "nonimmediate_operand" "=m, r,r, r,r") ++ (match_operand:HI 1 "general_operand" "rM,m,rM,I,J"))] ++ "(register_operand (operands[0], HImode) ++ || register_operand (operands[1], HImode) ++ || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))" ++ "@ ++ sth%o0\\t%z1, %0 ++ ldhu%o1\\t%0, %1 ++ mov\\t%0, %z1 ++ movi\\t%0, %1 ++ movui\\t%0, %1" ++ [(set_attr "type" "st,ld,alu,alu,alu")]) ++ ++(define_insn "ldhio" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(const_int 0)] UNSPEC_LDHIO)) ++ (use (match_operand:SI 1 "memory_operand" "m"))] ++ "" ++ "ldhio\\t%0, %1" ++ [(set_attr "type" "ld")]) ++ ++(define_insn "ldhuio" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(const_int 0)] UNSPEC_LDHUIO)) ++ (use (match_operand:SI 1 "memory_operand" "m"))] ++ "" ++ "ldhuio\\t%0, %1" ++ [(set_attr "type" "ld")]) ++ ++(define_insn "sthio" ++ [(set (match_operand:SI 0 "memory_operand" "=m") ++ (match_operand:SI 1 "register_operand" "r")) ++ (unspec_volatile:SI [(const_int 0)] UNSPEC_STHIO)] ++ "" ++ "sthio\\t%z1, %0" ++ [(set_attr "type" "st")]) ++ ++(define_expand "movsi" ++ [(set (match_operand:SI 0 "nonimmediate_operand" "") ++ (match_operand:SI 1 "general_operand" ""))] ++ "" ++{ ++ if (nios2_emit_move_sequence (operands, SImode)) ++ DONE; ++}) ++ ++(define_insn "movsi_internal" ++ [(set (match_operand:SI 0 "nonimmediate_operand" "=m, r,r, r,r,r,r") ++ (match_operand:SI 1 "general_operand" "rM,m,rM,I,J,S,i"))] ++ "(register_operand (operands[0], SImode) ++ || register_operand (operands[1], SImode) ++ || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))" ++ "@ ++ stw%o0\\t%z1, %0 ++ ldw%o1\\t%0, %1 ++ mov\\t%0, %z1 ++ movi\\t%0, %1 ++ movui\\t%0, %1 ++ addi\\t%0, gp, %%gprel(%1) ++ movhi\\t%0, %H1\;addi\\t%0, %0, %L1" ++ [(set_attr "type" "st,ld,alu,alu,alu,alu,alu")]) ++ ++(define_insn "ldwio" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(const_int 0)] UNSPEC_LDWIO)) ++ (use (match_operand:SI 1 "memory_operand" "m"))] ++ "" ++ "ldwio\\t%0, %1" ++ [(set_attr "type" "ld")]) ++ ++(define_insn "stwio" ++ [(set (match_operand:SI 0 "memory_operand" "=m") ++ (match_operand:SI 1 "register_operand" "r")) ++ (unspec_volatile:SI [(const_int 0)] UNSPEC_STWIO)] ++ "" ++ "stwio\\t%z1, %0" ++ [(set_attr "type" "st")]) ++ ++ ++ ++;***************************************************************************** ++;* ++;* zero extension ++;* ++;***************************************************************************** ++ ++ ++(define_insn "zero_extendhisi2" ++ [(set (match_operand:SI 0 "register_operand" "=r,r") ++ (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))] ++ "" ++ "@ ++ andi\\t%0, %1, 0xffff ++ ldhu%o1\\t%0, %1" ++ [(set_attr "type" "alu,ld")]) ++ ++(define_insn "zero_extendqihi2" ++ [(set (match_operand:HI 0 "register_operand" "=r,r") ++ (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "r,m")))] ++ "" ++ "@ ++ andi\\t%0, %1, 0xff ++ ldbu%o1\\t%0, %1" ++ [(set_attr "type" "alu,ld")]) ++ ++(define_insn "zero_extendqisi2" ++ [(set (match_operand:SI 0 "register_operand" "=r,r") ++ (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))] ++ "" ++ "@ ++ andi\\t%0, %1, 0xff ++ ldbu%o1\\t%0, %1" ++ [(set_attr "type" "alu,ld")]) ++ ++ ++ ++;***************************************************************************** ++;* ++;* sign extension ++;* ++;***************************************************************************** ++ ++(define_expand "extendhisi2" ++ [(set (match_operand:SI 0 "register_operand" "") ++ (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))] ++ "" ++{ ++ if (optimize && GET_CODE (operands[1]) == MEM) ++ operands[1] = force_not_mem (operands[1]); ++ ++ if (GET_CODE (operands[1]) != MEM) ++ { ++ rtx op1 = gen_lowpart (SImode, operands[1]); ++ rtx temp = gen_reg_rtx (SImode); ++ rtx shift = GEN_INT (16); ++ ++ emit_insn (gen_ashlsi3 (temp, op1, shift)); ++ emit_insn (gen_ashrsi3 (operands[0], temp, shift)); ++ DONE; ++ } ++}) ++ ++(define_insn "extendhisi2_internal" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (sign_extend:SI (match_operand:HI 1 "memory_operand" "m")))] ++ "" ++ "ldh%o1\\t%0, %1" ++ [(set_attr "type" "ld")]) ++ ++(define_expand "extendqihi2" ++ [(set (match_operand:HI 0 "register_operand" "") ++ (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))] ++ "" ++{ ++ if (optimize && GET_CODE (operands[1]) == MEM) ++ operands[1] = force_not_mem (operands[1]); ++ ++ if (GET_CODE (operands[1]) != MEM) ++ { ++ rtx op0 = gen_lowpart (SImode, operands[0]); ++ rtx op1 = gen_lowpart (SImode, operands[1]); ++ rtx temp = gen_reg_rtx (SImode); ++ rtx shift = GEN_INT (24); ++ ++ emit_insn (gen_ashlsi3 (temp, op1, shift)); ++ emit_insn (gen_ashrsi3 (op0, temp, shift)); ++ DONE; ++ } ++}) ++ ++(define_insn "extendqihi2_internal" ++ [(set (match_operand:HI 0 "register_operand" "=r") ++ (sign_extend:HI (match_operand:QI 1 "memory_operand" "m")))] ++ "" ++ "ldb%o1\\t%0, %1" ++ [(set_attr "type" "ld")]) ++ ++ ++(define_expand "extendqisi2" ++ [(set (match_operand:SI 0 "register_operand" "") ++ (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))] ++ "" ++{ ++ if (optimize && GET_CODE (operands[1]) == MEM) ++ operands[1] = force_not_mem (operands[1]); ++ ++ if (GET_CODE (operands[1]) != MEM) ++ { ++ rtx op1 = gen_lowpart (SImode, operands[1]); ++ rtx temp = gen_reg_rtx (SImode); ++ rtx shift = GEN_INT (24); ++ ++ emit_insn (gen_ashlsi3 (temp, op1, shift)); ++ emit_insn (gen_ashrsi3 (operands[0], temp, shift)); ++ DONE; ++ } ++}) ++ ++(define_insn "extendqisi2_insn" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))] ++ "" ++ "ldb%o1\\t%0, %1" ++ [(set_attr "type" "ld")]) ++ ++ ++ ++;***************************************************************************** ++;* ++;* Arithmetic Operations ++;* ++;***************************************************************************** ++ ++(define_insn "addsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r,r") ++ (plus:SI (match_operand:SI 1 "register_operand" "%r,r") ++ (match_operand:SI 2 "arith_operand" "r,I")))] ++ "" ++ "add%i2\\t%0, %1, %z2" ++ [(set_attr "type" "alu")]) ++ ++(define_insn "subsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rM") ++ (match_operand:SI 2 "register_operand" "r")))] ++ "" ++ "sub\\t%0, %z1, %2" ++ [(set_attr "type" "alu")]) ++ ++(define_insn "mulsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r,r") ++ (mult:SI (match_operand:SI 1 "register_operand" "r,r") ++ (match_operand:SI 2 "arith_operand" "r,I")))] ++ "TARGET_HAS_MUL" ++ "mul%i2\\t%0, %1, %z2" ++ [(set_attr "type" "mul")]) ++ ++(define_expand "divsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (div:SI (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SI 2 "register_operand" "r")))] ++ "" ++{ ++ if (!TARGET_HAS_DIV) ++ { ++ if (!TARGET_FAST_SW_DIV) ++ FAIL; ++ else ++ { ++ if (nios2_emit_expensive_div (operands, SImode)) ++ DONE; ++ } ++ } ++}) ++ ++(define_insn "divsi3_insn" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (div:SI (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SI 2 "register_operand" "r")))] ++ "TARGET_HAS_DIV" ++ "div\\t%0, %1, %2" ++ [(set_attr "type" "div")]) ++ ++(define_insn "udivsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (udiv:SI (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SI 2 "register_operand" "r")))] ++ "TARGET_HAS_DIV" ++ "divu\\t%0, %1, %2" ++ [(set_attr "type" "div")]) ++ ++(define_insn "smulsi3_highpart" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (truncate:SI ++ (lshiftrt:DI ++ (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r")) ++ (sign_extend:DI (match_operand:SI 2 "register_operand" "r"))) ++ (const_int 32))))] ++ "TARGET_HAS_MULX" ++ "mulxss\\t%0, %1, %2" ++ [(set_attr "type" "mul")]) ++ ++(define_insn "umulsi3_highpart" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (truncate:SI ++ (lshiftrt:DI ++ (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r")) ++ (zero_extend:DI (match_operand:SI 2 "register_operand" "r"))) ++ (const_int 32))))] ++ "TARGET_HAS_MULX" ++ "mulxuu\\t%0, %1, %2" ++ [(set_attr "type" "mul")]) ++ ++ ++(define_expand "mulsidi3" ++ [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 0) ++ (mult:SI (match_operand:SI 1 "register_operand" "") ++ (match_operand:SI 2 "register_operand" ""))) ++ (set (subreg:SI (match_dup 0) 4) ++ (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1)) ++ (sign_extend:DI (match_dup 2))) ++ (const_int 32))))] ++ "TARGET_HAS_MULX" ++ "") ++ ++(define_expand "umulsidi3" ++ [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 0) ++ (mult:SI (match_operand:SI 1 "register_operand" "") ++ (match_operand:SI 2 "register_operand" ""))) ++ (set (subreg:SI (match_dup 0) 4) ++ (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1)) ++ (zero_extend:DI (match_dup 2))) ++ (const_int 32))))] ++ "TARGET_HAS_MULX" ++ "") ++ ++ ++ ++;***************************************************************************** ++;* ++;* Negate and ones complement ++;* ++;***************************************************************************** ++ ++(define_insn "negsi2" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (neg:SI (match_operand:SI 1 "register_operand" "r")))] ++ "" ++{ ++ operands[2] = const0_rtx; ++ return "sub\\t%0, %z2, %1"; ++} ++ [(set_attr "type" "alu")]) ++ ++(define_insn "one_cmplsi2" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (not:SI (match_operand:SI 1 "register_operand" "r")))] ++ "" ++{ ++ operands[2] = const0_rtx; ++ return "nor\\t%0, %z2, %1"; ++} ++ [(set_attr "type" "alu")]) ++ ++ ++ ++; Logical Operantions ++ ++(define_insn "andsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r, r,r") ++ (and:SI (match_operand:SI 1 "register_operand" "%r, r,r") ++ (match_operand:SI 2 "logical_operand" "rM,J,K")))] ++ "" ++ "@ ++ and\\t%0, %1, %z2 ++ and%i2\\t%0, %1, %2 ++ andh%i2\\t%0, %1, %U2" ++ [(set_attr "type" "alu")]) ++ ++(define_insn "iorsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r, r,r") ++ (ior:SI (match_operand:SI 1 "register_operand" "%r, r,r") ++ (match_operand:SI 2 "logical_operand" "rM,J,K")))] ++ "" ++ "@ ++ or\\t%0, %1, %z2 ++ or%i2\\t%0, %1, %2 ++ orh%i2\\t%0, %1, %U2" ++ [(set_attr "type" "alu")]) ++ ++(define_insn "*norsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (and:SI (not:SI (match_operand:SI 1 "register_operand" "%r")) ++ (not:SI (match_operand:SI 2 "reg_or_0_operand" "rM"))))] ++ "" ++ "nor\\t%0, %1, %z2" ++ [(set_attr "type" "alu")]) ++ ++(define_insn "xorsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r, r,r") ++ (xor:SI (match_operand:SI 1 "register_operand" "%r, r,r") ++ (match_operand:SI 2 "logical_operand" "rM,J,K")))] ++ "" ++ "@ ++ xor\\t%0, %1, %z2 ++ xor%i2\\t%0, %1, %2 ++ xorh%i2\\t%0, %1, %U2" ++ [(set_attr "type" "alu")]) ++ ++ ++ ++;***************************************************************************** ++;* ++;* Shifts ++;* ++;***************************************************************************** ++ ++(define_insn "ashlsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r,r") ++ (ashift:SI (match_operand:SI 1 "register_operand" "r,r") ++ (match_operand:SI 2 "shift_operand" "r,L")))] ++ "" ++ "sll%i2\\t%0, %1, %z2" ++ [(set_attr "type" "shift")]) ++ ++(define_insn "ashrsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r,r") ++ (ashiftrt:SI (match_operand:SI 1 "register_operand" "r,r") ++ (match_operand:SI 2 "shift_operand" "r,L")))] ++ "" ++ "sra%i2\\t%0, %1, %z2" ++ [(set_attr "type" "shift")]) ++ ++(define_insn "lshrsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r,r") ++ (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r") ++ (match_operand:SI 2 "shift_operand" "r,L")))] ++ "" ++ "srl%i2\\t%0, %1, %z2" ++ [(set_attr "type" "shift")]) ++ ++(define_insn "rotlsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r,r") ++ (rotate:SI (match_operand:SI 1 "register_operand" "r,r") ++ (match_operand:SI 2 "shift_operand" "r,L")))] ++ "" ++ "rol%i2\\t%0, %1, %z2" ++ [(set_attr "type" "shift")]) ++ ++(define_insn "rotrsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r,r") ++ (rotatert:SI (match_operand:SI 1 "register_operand" "r,r") ++ (match_operand:SI 2 "register_operand" "r,r")))] ++ "" ++ "ror\\t%0, %1, %2" ++ [(set_attr "type" "shift")]) ++ ++(define_insn "*shift_mul_constants" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (ashift:SI (mult:SI (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SI 2 "const_int_operand" "I")) ++ (match_operand:SI 3 "const_int_operand" "I")))] ++ "TARGET_HAS_MUL && SMALL_INT (INTVAL (operands[2]) << INTVAL (operands[3]))" ++{ ++ HOST_WIDE_INT mul = INTVAL (operands[2]) << INTVAL (operands[3]); ++ rtx ops[3]; ++ ++ ops[0] = operands[0]; ++ ops[1] = operands[1]; ++ ops[2] = GEN_INT (mul); ++ ++ output_asm_insn ("muli\t%0, %1, %2", ops); ++ return ""; ++} ++ [(set_attr "type" "mul")]) ++ ++ ++ ++ ++;***************************************************************************** ++;* ++;* Prologue, Epilogue and Return ++;* ++;***************************************************************************** ++ ++(define_expand "prologue" ++ [(const_int 1)] ++ "" ++{ ++ expand_prologue (); ++ DONE; ++}) ++ ++(define_expand "epilogue" ++ [(return)] ++ "" ++{ ++ expand_epilogue (false); ++ DONE; ++}) ++ ++(define_expand "sibcall_epilogue" ++ [(return)] ++ "" ++{ ++ expand_epilogue (true); ++ DONE; ++}) ++ ++(define_insn "return" ++ [(return)] ++ "reload_completed && nios2_can_use_return_insn ()" ++ "ret\\t" ++) ++ ++(define_insn "return_from_epilogue" ++ [(use (match_operand 0 "pmode_register_operand" "")) ++ (return)] ++ "reload_completed" ++ "ret\\t" ++) ++ ++;; Block any insns from being moved before this point, since the ++;; profiling call to mcount can use various registers that aren't ++;; saved or used to pass arguments. ++ ++(define_insn "blockage" ++ [(unspec_volatile [(const_int 0)] UNSPEC_BLOCKAGE)] ++ "" ++ "" ++ [(set_attr "type" "unknown") ++ (set_attr "length" "0")]) ++ ++ ++ ++;***************************************************************************** ++;* ++;* Jumps and Calls ++;* ++;***************************************************************************** ++ ++(define_insn "indirect_jump" ++ [(set (pc) (match_operand:SI 0 "register_operand" "r"))] ++ "" ++ "jmp\\t%0" ++ [(set_attr "type" "control")]) ++ ++(define_insn "jump" ++ [(set (pc) ++ (label_ref (match_operand 0 "" "")))] ++ "" ++ "br\\t%0" ++ [(set_attr "type" "control")]) ++ ++ ++(define_insn "indirect_call" ++ [(call (mem:QI (match_operand:SI 0 "register_operand" "r")) ++ (match_operand 1 "" "")) ++ (clobber (reg:SI RA_REGNO))] ++ "" ++ "callr\\t%0" ++ [(set_attr "type" "control")]) ++ ++(define_insn "indirect_call_value" ++ [(set (match_operand 0 "" "") ++ (call (mem:QI (match_operand:SI 1 "register_operand" "r")) ++ (match_operand 2 "" ""))) ++ (clobber (reg:SI RA_REGNO))] ++ "" ++ "callr\\t%1" ++) ++ ++(define_expand "call" ++ [(parallel [(call (match_operand 0 "" "") ++ (match_operand 1 "" "")) ++ (clobber (reg:SI RA_REGNO))])] ++ "" ++ "") ++ ++(define_expand "call_value" ++ [(parallel [(set (match_operand 0 "" "") ++ (call (match_operand 1 "" "") ++ (match_operand 2 "" ""))) ++ (clobber (reg:SI RA_REGNO))])] ++ "" ++ "") ++ ++(define_insn "*call" ++ [(call (mem:QI (match_operand:SI 0 "immediate_operand" "i")) ++ (match_operand 1 "" "")) ++ (clobber (match_operand:SI 2 "register_operand" "=r"))] ++ "" ++ "call\\t%0" ++ [(set_attr "type" "control")]) ++ ++(define_insn "*call_value" ++ [(set (match_operand 0 "" "") ++ (call (mem:QI (match_operand:SI 1 "immediate_operand" "i")) ++ (match_operand 2 "" ""))) ++ (clobber (match_operand:SI 3 "register_operand" "=r"))] ++ "" ++ "call\\t%1" ++ [(set_attr "type" "control")]) ++ ++(define_expand "sibcall" ++ [(parallel [(call (match_operand 0 "" "") ++ (match_operand 1 "" "")) ++ (return) ++ (use (match_operand 2 "" ""))])] ++ "" ++ { ++ XEXP (operands[0], 0) = copy_to_mode_reg (SImode, XEXP (operands[0], 0)); ++ ++ if (operands[2] == NULL_RTX) ++ operands[2] = const0_rtx; ++ } ++) ++ ++(define_expand "sibcall_value" ++ [(parallel [(set (match_operand 0 "" "") ++ (call (match_operand 1 "" "") ++ (match_operand 2 "" ""))) ++ (return) ++ (use (match_operand 3 "" ""))])] ++ "" ++ { ++ XEXP (operands[1], 0) = copy_to_mode_reg (SImode, XEXP (operands[1], 0)); ++ ++ if (operands[3] == NULL_RTX) ++ operands[3] = const0_rtx; ++ } ++) ++ ++(define_insn "sibcall_insn" ++ [(call (mem:QI (match_operand:SI 0 "register_operand" "r")) ++ (match_operand 1 "" "")) ++ (return) ++ (use (match_operand 2 "" ""))] ++ "" ++ "jmp\\t%0" ++) ++ ++(define_insn "sibcall_value_insn" ++ [(set (match_operand 0 "register_operand" "") ++ (call (mem:QI (match_operand:SI 1 "register_operand" "r")) ++ (match_operand 2 "" ""))) ++ (return) ++ (use (match_operand 3 "" ""))] ++ "" ++ "jmp\\t%1" ++) ++ ++ ++ ++ ++(define_expand "tablejump" ++ [(parallel [(set (pc) (match_operand 0 "register_operand" "r")) ++ (use (label_ref (match_operand 1 "" "")))])] ++ "" ++ "" ++) ++ ++(define_insn "*tablejump" ++ [(set (pc) ++ (match_operand:SI 0 "register_operand" "r")) ++ (use (label_ref (match_operand 1 "" "")))] ++ "" ++ "jmp\\t%0" ++ [(set_attr "type" "control")]) ++ ++ ++ ++;***************************************************************************** ++;* ++;* Comparisons ++;* ++;***************************************************************************** ++;; Flow here is rather complex (based on MIPS): ++;; ++;; 1) The cmp{si,di,sf,df} routine is called. It deposits the ++;; arguments into the branch_cmp array, and the type into ++;; branch_type. No RTL is generated. ++;; ++;; 2) The appropriate branch define_expand is called, which then ++;; creates the appropriate RTL for the comparison and branch. ++;; Different CC modes are used, based on what type of branch is ++;; done, so that we can constrain things appropriately. There ++;; are assumptions in the rest of GCC that break if we fold the ++;; operands into the branchs for integer operations, and use cc0 ++;; for floating point, so we use the fp status register instead. ++;; If needed, an appropriate temporary is created to hold the ++;; of the integer compare. ++ ++(define_expand "cmpsi" ++ [(set (cc0) ++ (compare:CC (match_operand:SI 0 "register_operand" "") ++ (match_operand:SI 1 "arith_operand" "")))] ++ "" ++{ ++ branch_cmp[0] = operands[0]; ++ branch_cmp[1] = operands[1]; ++ branch_type = CMP_SI; ++ DONE; ++}) ++ ++(define_expand "tstsi" ++ [(set (cc0) ++ (match_operand:SI 0 "register_operand" ""))] ++ "" ++{ ++ branch_cmp[0] = operands[0]; ++ branch_cmp[1] = const0_rtx; ++ branch_type = CMP_SI; ++ DONE; ++}) ++ ++ ++;***************************************************************************** ++;* ++;* setting a register from a comparison ++;* ++;***************************************************************************** ++ ++(define_expand "seq" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (eq:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (EQ, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*seq" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (eq:SI (match_operand:SI 1 "reg_or_0_operand" "%rM") ++ (match_operand:SI 2 "arith_operand" "rI")))] ++ "" ++ "cmpeq%i2\\t%0, %z1, %z2" ++ [(set_attr "type" "alu")]) ++ ++ ++(define_expand "sne" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (ne:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (NE, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*sne" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (ne:SI (match_operand:SI 1 "reg_or_0_operand" "%rM") ++ (match_operand:SI 2 "arith_operand" "rI")))] ++ "" ++ "cmpne%i2\\t%0, %z1, %z2" ++ [(set_attr "type" "alu")]) ++ ++ ++(define_expand "sgt" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (gt:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (GT, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*sgt" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (gt:SI (match_operand:SI 1 "reg_or_0_operand" "rM") ++ (match_operand:SI 2 "reg_or_0_operand" "rM")))] ++ "" ++ "cmplt\\t%0, %z2, %z1" ++ [(set_attr "type" "alu")]) ++ ++ ++(define_expand "sge" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (ge:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (GE, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*sge" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (ge:SI (match_operand:SI 1 "reg_or_0_operand" "rM") ++ (match_operand:SI 2 "arith_operand" "rI")))] ++ "" ++ "cmpge%i2\\t%0, %z1, %z2" ++ [(set_attr "type" "alu")]) ++ ++(define_expand "sle" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (le:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (LE, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*sle" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (le:SI (match_operand:SI 1 "reg_or_0_operand" "rM") ++ (match_operand:SI 2 "reg_or_0_operand" "rM")))] ++ "" ++ "cmpge\\t%0, %z2, %z1" ++ [(set_attr "type" "alu")]) ++ ++ ++(define_expand "slt" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (lt:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (LT, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*slt" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (lt:SI (match_operand:SI 1 "reg_or_0_operand" "rM") ++ (match_operand:SI 2 "arith_operand" "rI")))] ++ "" ++ "cmplt%i2\\t%0, %z1, %z2" ++ [(set_attr "type" "alu")]) ++ ++ ++(define_expand "sgtu" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (gtu:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (GTU, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*sgtu" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (gtu:SI (match_operand:SI 1 "reg_or_0_operand" "rM") ++ (match_operand:SI 2 "reg_or_0_operand" "rM")))] ++ "" ++ "cmpltu\\t%0, %z2, %z1" ++ [(set_attr "type" "alu")]) ++ ++ ++(define_expand "sgeu" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (geu:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (GEU, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*sgeu" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (geu:SI (match_operand:SI 1 "reg_or_0_operand" "rM") ++ (match_operand:SI 2 "uns_arith_operand" "rJ")))] ++ "" ++ "cmpgeu%i2\\t%0, %z1, %z2" ++ [(set_attr "type" "alu")]) ++ ++(define_expand "sleu" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (leu:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (LEU, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*sleu" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (leu:SI (match_operand:SI 1 "reg_or_0_operand" "rM") ++ (match_operand:SI 2 "reg_or_0_operand" "rM")))] ++ "" ++ "cmpgeu\\t%0, %z2, %z1" ++ [(set_attr "type" "alu")]) ++ ++ ++(define_expand "sltu" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (ltu:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (LTU, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*sltu" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (ltu:SI (match_operand:SI 1 "reg_or_0_operand" "rM") ++ (match_operand:SI 2 "uns_arith_operand" "rJ")))] ++ "" ++ "cmpltu%i2\\t%0, %z1, %z2" ++ [(set_attr "type" "alu")]) ++ ++ ++ ++ ++;***************************************************************************** ++;* ++;* branches ++;* ++;***************************************************************************** ++ ++(define_insn "*cbranch" ++ [(set (pc) ++ (if_then_else ++ (match_operator:SI 0 "comparison_operator" ++ [(match_operand:SI 2 "reg_or_0_operand" "rM") ++ (match_operand:SI 3 "reg_or_0_operand" "rM")]) ++ (label_ref (match_operand 1 "" "")) ++ (pc)))] ++ "" ++ "b%0\\t%z2, %z3, %l1" ++ [(set_attr "type" "control")]) ++ ++ ++(define_expand "beq" ++ [(set (pc) ++ (if_then_else (eq:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (EQ, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++ ++(define_expand "bne" ++ [(set (pc) ++ (if_then_else (ne:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (NE, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++ ++(define_expand "bgt" ++ [(set (pc) ++ (if_then_else (gt:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (GT, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++(define_expand "bge" ++ [(set (pc) ++ (if_then_else (ge:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (GE, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++(define_expand "ble" ++ [(set (pc) ++ (if_then_else (le:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (LE, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++(define_expand "blt" ++ [(set (pc) ++ (if_then_else (lt:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (LT, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++ ++(define_expand "bgtu" ++ [(set (pc) ++ (if_then_else (gtu:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (GTU, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++(define_expand "bgeu" ++ [(set (pc) ++ (if_then_else (geu:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (GEU, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++(define_expand "bleu" ++ [(set (pc) ++ (if_then_else (leu:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (LEU, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++(define_expand "bltu" ++ [(set (pc) ++ (if_then_else (ltu:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (LTU, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++ ++;***************************************************************************** ++;* ++;* String and Block Operations ++;* ++;***************************************************************************** ++ ++; ??? This is all really a hack to get Dhrystone to work as fast as possible ++; things to be fixed: ++; * let the compiler core handle all of this, for that to work the extra ++; aliasing needs to be addressed. ++; * we use three temporary registers for loading and storing to ensure no ++; ld use stalls, this is excessive, because after the first ld/st only ++; two are needed. Only two would be needed all the way through if ++; we could schedule with other code. Consider: ++; 1 ld $1, 0($src) ++; 2 ld $2, 4($src) ++; 3 ld $3, 8($src) ++; 4 st $1, 0($dest) ++; 5 ld $1, 12($src) ++; 6 st $2, 4($src) ++; 7 etc. ++; The first store has to wait until 4. If it does not there will be one ++; cycle of stalling. However, if any other instruction could be placed ++; between 1 and 4, $3 would not be needed. ++; * In small we probably don't want to ever do this ourself because there ++; is no ld use stall. ++ ++(define_expand "movstrsi" ++ [(parallel [(set (match_operand:BLK 0 "general_operand" "") ++ (match_operand:BLK 1 "general_operand" "")) ++ (use (match_operand:SI 2 "const_int_operand" "")) ++ (use (match_operand:SI 3 "const_int_operand" "")) ++ (clobber (match_scratch:SI 4 "=&r")) ++ (clobber (match_scratch:SI 5 "=&r")) ++ (clobber (match_scratch:SI 6 "=&r"))])] ++ "TARGET_INLINE_MEMCPY" ++{ ++ rtx ld_addr_reg, st_addr_reg; ++ ++ /* If the predicate for op2 fails in expr.c:emit_block_move_via_movstr ++ it trys to copy to a register, but does not re-try the predicate. ++ ??? Intead of fixing expr.c, I fix it here. */ ++ if (!const_int_operand (operands[2], SImode)) ++ FAIL; ++ ++ /* ??? there are some magic numbers which need to be sorted out here. ++ the basis for them is not increasing code size hugely or going ++ out of range of offset addressing */ ++ if (INTVAL (operands[3]) < 4) ++ FAIL; ++ if (!optimize ++ || (optimize_size && INTVAL (operands[2]) > 12) ++ || (optimize < 3 && INTVAL (operands[2]) > 100) ++ || INTVAL (operands[2]) > 200) ++ FAIL; ++ ++ st_addr_reg ++ = replace_equiv_address (operands[0], ++ copy_to_mode_reg (Pmode, XEXP (operands[0], 0))); ++ ld_addr_reg ++ = replace_equiv_address (operands[1], ++ copy_to_mode_reg (Pmode, XEXP (operands[1], 0))); ++ emit_insn (gen_movstrsi_internal (st_addr_reg, ld_addr_reg, ++ operands[2], operands[3])); ++ ++ DONE; ++}) ++ ++ ++(define_insn "movstrsi_internal" ++ [(set (match_operand:BLK 0 "memory_operand" "=o") ++ (match_operand:BLK 1 "memory_operand" "o")) ++ (use (match_operand:SI 2 "const_int_operand" "i")) ++ (use (match_operand:SI 3 "const_int_operand" "i")) ++ (clobber (match_scratch:SI 4 "=&r")) ++ (clobber (match_scratch:SI 5 "=&r")) ++ (clobber (match_scratch:SI 6 "=&r"))] ++ "TARGET_INLINE_MEMCPY" ++{ ++ int ld_offset = INTVAL (operands[2]); ++ int ld_len = INTVAL (operands[2]); ++ int ld_reg = 0; ++ rtx ld_addr_reg = XEXP (operands[1], 0); ++ int st_offset = INTVAL (operands[2]); ++ int st_len = INTVAL (operands[2]); ++ int st_reg = 0; ++ rtx st_addr_reg = XEXP (operands[0], 0); ++ int delay_count = 0; ++ ++ /* ops[0] is the address used by the insn ++ ops[1] is the register being loaded or stored */ ++ rtx ops[2]; ++ ++ if (INTVAL (operands[3]) < 4) ++ abort (); ++ ++ while (ld_offset >= 4) ++ { ++ /* if the load use delay has been met, I can start ++ storing */ ++ if (delay_count >= 3) ++ { ++ ops[0] = gen_rtx (MEM, SImode, ++ plus_constant (st_addr_reg, st_len - st_offset)); ++ ops[1] = operands[st_reg + 4]; ++ output_asm_insn ("stw\t%1, %0", ops); ++ ++ st_reg = (st_reg + 1) % 3; ++ st_offset -= 4; ++ } ++ ++ ops[0] = gen_rtx (MEM, SImode, ++ plus_constant (ld_addr_reg, ld_len - ld_offset)); ++ ops[1] = operands[ld_reg + 4]; ++ output_asm_insn ("ldw\t%1, %0", ops); ++ ++ ld_reg = (ld_reg + 1) % 3; ++ ld_offset -= 4; ++ delay_count++; ++ } ++ ++ if (ld_offset >= 2) ++ { ++ /* if the load use delay has been met, I can start ++ storing */ ++ if (delay_count >= 3) ++ { ++ ops[0] = gen_rtx (MEM, SImode, ++ plus_constant (st_addr_reg, st_len - st_offset)); ++ ops[1] = operands[st_reg + 4]; ++ output_asm_insn ("stw\t%1, %0", ops); ++ ++ st_reg = (st_reg + 1) % 3; ++ st_offset -= 4; ++ } ++ ++ ops[0] = gen_rtx (MEM, HImode, ++ plus_constant (ld_addr_reg, ld_len - ld_offset)); ++ ops[1] = operands[ld_reg + 4]; ++ output_asm_insn ("ldh\t%1, %0", ops); ++ ++ ld_reg = (ld_reg + 1) % 3; ++ ld_offset -= 2; ++ delay_count++; ++ } ++ ++ if (ld_offset >= 1) ++ { ++ /* if the load use delay has been met, I can start ++ storing */ ++ if (delay_count >= 3) ++ { ++ ops[0] = gen_rtx (MEM, SImode, ++ plus_constant (st_addr_reg, st_len - st_offset)); ++ ops[1] = operands[st_reg + 4]; ++ output_asm_insn ("stw\t%1, %0", ops); ++ ++ st_reg = (st_reg + 1) % 3; ++ st_offset -= 4; ++ } ++ ++ ops[0] = gen_rtx (MEM, QImode, ++ plus_constant (ld_addr_reg, ld_len - ld_offset)); ++ ops[1] = operands[ld_reg + 4]; ++ output_asm_insn ("ldb\t%1, %0", ops); ++ ++ ld_reg = (ld_reg + 1) % 3; ++ ld_offset -= 1; ++ delay_count++; ++ } ++ ++ while (st_offset >= 4) ++ { ++ ops[0] = gen_rtx (MEM, SImode, ++ plus_constant (st_addr_reg, st_len - st_offset)); ++ ops[1] = operands[st_reg + 4]; ++ output_asm_insn ("stw\t%1, %0", ops); ++ ++ st_reg = (st_reg + 1) % 3; ++ st_offset -= 4; ++ } ++ ++ while (st_offset >= 2) ++ { ++ ops[0] = gen_rtx (MEM, HImode, ++ plus_constant (st_addr_reg, st_len - st_offset)); ++ ops[1] = operands[st_reg + 4]; ++ output_asm_insn ("sth\t%1, %0", ops); ++ ++ st_reg = (st_reg + 1) % 3; ++ st_offset -= 2; ++ } ++ ++ while (st_offset >= 1) ++ { ++ ops[0] = gen_rtx (MEM, QImode, ++ plus_constant (st_addr_reg, st_len - st_offset)); ++ ops[1] = operands[st_reg + 4]; ++ output_asm_insn ("stb\t%1, %0", ops); ++ ++ st_reg = (st_reg + 1) % 3; ++ st_offset -= 1; ++ } ++ ++ return ""; ++} ++; ??? lengths are not being used yet, but I will probably forget ++; to update this once I am using lengths, so set it to something ++; definetely big enough to cover it. 400 allows for 200 bytes ++; of motion. ++ [(set_attr "length" "400")]) ++ ++ ++ ++;***************************************************************************** ++;* ++;* Custom instructions ++;* ++;***************************************************************************** ++ ++(define_constants [ ++ (CUSTOM_N 100) ++ (CUSTOM_NI 101) ++ (CUSTOM_NF 102) ++ (CUSTOM_NP 103) ++ (CUSTOM_NII 104) ++ (CUSTOM_NIF 105) ++ (CUSTOM_NIP 106) ++ (CUSTOM_NFI 107) ++ (CUSTOM_NFF 108) ++ (CUSTOM_NFP 109) ++ (CUSTOM_NPI 110) ++ (CUSTOM_NPF 111) ++ (CUSTOM_NPP 112) ++ (CUSTOM_IN 113) ++ (CUSTOM_INI 114) ++ (CUSTOM_INF 115) ++ (CUSTOM_INP 116) ++ (CUSTOM_INII 117) ++ (CUSTOM_INIF 118) ++ (CUSTOM_INIP 119) ++ (CUSTOM_INFI 120) ++ (CUSTOM_INFF 121) ++ (CUSTOM_INFP 122) ++ (CUSTOM_INPI 123) ++ (CUSTOM_INPF 124) ++ (CUSTOM_INPP 125) ++ (CUSTOM_FN 126) ++ (CUSTOM_FNI 127) ++ (CUSTOM_FNF 128) ++ (CUSTOM_FNP 129) ++ (CUSTOM_FNII 130) ++ (CUSTOM_FNIF 131) ++ (CUSTOM_FNIP 132) ++ (CUSTOM_FNFI 133) ++ (CUSTOM_FNFF 134) ++ (CUSTOM_FNFP 135) ++ (CUSTOM_FNPI 136) ++ (CUSTOM_FNPF 137) ++ (CUSTOM_FNPP 138) ++ (CUSTOM_PN 139) ++ (CUSTOM_PNI 140) ++ (CUSTOM_PNF 141) ++ (CUSTOM_PNP 142) ++ (CUSTOM_PNII 143) ++ (CUSTOM_PNIF 144) ++ (CUSTOM_PNIP 145) ++ (CUSTOM_PNFI 146) ++ (CUSTOM_PNFF 147) ++ (CUSTOM_PNFP 148) ++ (CUSTOM_PNPI 149) ++ (CUSTOM_PNPF 150) ++ (CUSTOM_PNPP 151) ++]) ++ ++ ++(define_insn "custom_n" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N")] CUSTOM_N)] ++ "" ++ "custom\\t%0, zero, zero, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_ni" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SI 1 "register_operand" "r")] CUSTOM_NI)] ++ "" ++ "custom\\t%0, zero, %1, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_nf" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SF 1 "register_operand" "r")] CUSTOM_NF)] ++ "" ++ "custom\\t%0, zero, %1, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_np" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SI 1 "register_operand" "r")] CUSTOM_NP)] ++ "" ++ "custom\\t%0, zero, %1, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_nii" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_NII)] ++ "" ++ "custom\\t%0, zero, %1, %2" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_nif" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SF 2 "register_operand" "r")] CUSTOM_NIF)] ++ "" ++ "custom\\t%0, zero, %1, %2" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_nip" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_NIP)] ++ "" ++ "custom\\t%0, zero, %1, %2" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_nfi" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SF 1 "register_operand" "r") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_NFI)] ++ "" ++ "custom\\t%0, zero, %1, %2" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_nff" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SF 1 "register_operand" "r") ++ (match_operand:SF 2 "register_operand" "r")] CUSTOM_NFF)] ++ "" ++ "custom\\t%0, zero, %1, %2" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_nfp" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SF 1 "register_operand" "r") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_NFP)] ++ "" ++ "custom\\t%0, zero, %1, %2" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_npi" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_NPI)] ++ "" ++ "custom\\t%0, zero, %1, %2" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_npf" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SF 2 "register_operand" "r")] CUSTOM_NPF)] ++ "" ++ "custom\\t%0, zero, %1, %2" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_npp" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_NPP)] ++ "" ++ "custom\\t%0, zero, %1, %2" ++ [(set_attr "type" "custom")]) ++ ++ ++ ++(define_insn "custom_in" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N")] CUSTOM_IN))] ++ "" ++ "custom\\t%1, %0, zero, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_ini" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_INI))] ++ "" ++ "custom\\t%1, %0, %2, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_inf" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r")] CUSTOM_INF))] ++ "" ++ "custom\\t%1, %0, %2, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_inp" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_INP))] ++ "" ++ "custom\\t%1, %0, %2, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_inii" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_INII))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_inif" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SF 3 "register_operand" "r")] CUSTOM_INIF))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_inip" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_INIP))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_infi" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_INFI))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_inff" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r") ++ (match_operand:SF 3 "register_operand" "r")] CUSTOM_INFF))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_infp" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_INFP))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_inpi" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_INPI))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_inpf" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SF 3 "register_operand" "r")] CUSTOM_INPF))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_inpp" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_INPP))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++ ++ ++ ++ ++(define_insn "custom_fn" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N")] CUSTOM_FN))] ++ "" ++ "custom\\t%1, %0, zero, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fni" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_FNI))] ++ "" ++ "custom\\t%1, %0, %2, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnf" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r")] CUSTOM_FNF))] ++ "" ++ "custom\\t%1, %0, %2, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnp" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_FNP))] ++ "" ++ "custom\\t%1, %0, %2, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnii" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_FNII))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnif" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SF 3 "register_operand" "r")] CUSTOM_FNIF))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnip" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_FNIP))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnfi" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_FNFI))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnff" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r") ++ (match_operand:SF 3 "register_operand" "r")] CUSTOM_FNFF))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnfp" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_FNFP))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnpi" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_FNPI))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnpf" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SF 3 "register_operand" "r")] CUSTOM_FNPF))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnpp" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_FNPP))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++ ++ ++(define_insn "custom_pn" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N")] CUSTOM_PN))] ++ "" ++ "custom\\t%1, %0, zero, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pni" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_PNI))] ++ "" ++ "custom\\t%1, %0, %2, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnf" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r")] CUSTOM_PNF))] ++ "" ++ "custom\\t%1, %0, %2, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnp" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_PNP))] ++ "" ++ "custom\\t%1, %0, %2, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnii" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_PNII))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnif" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SF 3 "register_operand" "r")] CUSTOM_PNIF))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnip" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_PNIP))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnfi" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_PNFI))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnff" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r") ++ (match_operand:SF 3 "register_operand" "r")] CUSTOM_PNFF))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnfp" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_PNFP))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnpi" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_PNPI))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnpf" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SF 3 "register_operand" "r")] CUSTOM_PNPF))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnpp" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_PNPP))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++ ++ ++ ++ ++ ++;***************************************************************************** ++;* ++;* Misc ++;* ++;***************************************************************************** ++ ++(define_insn "nop" ++ [(const_int 0)] ++ "" ++ "nop\\t" ++ [(set_attr "type" "alu")]) ++ ++(define_insn "sync" ++ [(unspec_volatile [(const_int 0)] UNSPEC_SYNC)] ++ "" ++ "sync\\t" ++ [(set_attr "type" "control")]) ++ ++ ++(define_insn "rdctl" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "rdwrctl_operand" "O")] UNSPEC_RDCTL))] ++ "" ++ "rdctl\\t%0, ctl%1" ++ [(set_attr "type" "control")]) ++ ++(define_insn "wrctl" ++ [(unspec_volatile:SI [(match_operand:SI 0 "rdwrctl_operand" "O") ++ (match_operand:SI 1 "register_operand" "r")] UNSPEC_WRCTL)] ++ "" ++ "wrctl\\tctl%0, %1" ++ [(set_attr "type" "control")]) ++ ++ ++ ++;***************************************************************************** ++;* ++;* Peepholes ++;* ++;***************************************************************************** ++ ++ +--- gcc-3.4.3/gcc/config/nios2/t-nios2 ++++ gcc-3.4.3-nios2/gcc/config/nios2/t-nios2 +@@ -0,0 +1,123 @@ ++## ++## Compiler flags to use when compiling libgcc2.c. ++## ++## LIB2FUNCS_EXTRA ++## A list of source file names to be compiled or assembled and inserted into libgcc.a. ++ ++LIB2FUNCS_EXTRA=$(srcdir)/config/nios2/lib2-divmod.c \ ++ $(srcdir)/config/nios2/lib2-divmod-hi.c \ ++ $(srcdir)/config/nios2/lib2-divtable.c \ ++ $(srcdir)/config/nios2/lib2-mul.c ++ ++## ++## Floating Point Emulation ++## To have GCC include software floating point libraries in libgcc.a define FPBIT ++## and DPBIT along with a few rules as follows: ++## ++## # We want fine grained libraries, so use the new code ++## # to build the floating point emulation libraries. ++FPBIT=$(srcdir)/config/nios2/nios2-fp-bit.c ++DPBIT=$(srcdir)/config/nios2/nios2-dp-bit.c ++ ++TARGET_LIBGCC2_CFLAGS = -O2 ++ ++# FLOAT_ONLY - no doubles ++# SMALL_MACHINE - QI/HI is faster than SI ++# Actually SMALL_MACHINE uses chars and shorts instead of ints ++# since ints (16-bit ones as they are today) are at least as fast ++# as chars and shorts, don't define SMALL_MACHINE ++# CMPtype - type returned by FP compare, i.e. INT (hard coded in fp-bit - see code ) ++ ++$(FPBIT): $(srcdir)/config/fp-bit.c Makefile ++ echo '#define FLOAT' > ${FPBIT} ++ cat $(srcdir)/config/fp-bit.c >> ${FPBIT} ++ ++$(DPBIT): $(srcdir)/config/fp-bit.c Makefile ++ echo '' > ${DPBIT} ++ cat $(srcdir)/config/fp-bit.c >> ${DPBIT} ++ ++EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o ++ ++# Assemble startup files. ++$(T)crti.o: $(srcdir)/config/nios2/crti.asm $(GCC_PASSES) ++ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ ++ -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/nios2/crti.asm ++ ++$(T)crtn.o: $(srcdir)/config/nios2/crtn.asm $(GCC_PASSES) ++ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ ++ -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/nios2/crtn.asm ++ ++ ++## You may need to provide additional #defines at the beginning of ++## fp-bit.c and dp-bit.c to control target endianness and other options ++## ++## CRTSTUFF_T_CFLAGS ++## Special flags used when compiling crtstuff.c. See Initialization. ++## ++## CRTSTUFF_T_CFLAGS_S ++## Special flags used when compiling crtstuff.c for shared linking. Used ++## if you use crtbeginS.o and crtendS.o in EXTRA-PARTS. See Initialization. ++## ++## MULTILIB_OPTIONS ++## For some targets, invoking GCC in different ways produces objects that ++## can not be linked together. For example, for some targets GCC produces ++## both big and little endian code. For these targets, you must arrange ++## for multiple versions of libgcc.a to be compiled, one for each set of ++## incompatible options. When GCC invokes the linker, it arranges to link ++## in the right version of libgcc.a, based on the command line options ++## used. ++## The MULTILIB_OPTIONS macro lists the set of options for which special ++## versions of libgcc.a must be built. Write options that are mutually ++## incompatible side by side, separated by a slash. Write options that may ++## be used together separated by a space. The build procedure will build ++## all combinations of compatible options. ++## ++## For example, if you set MULTILIB_OPTIONS to m68000/m68020 msoft-float, ++## Makefile will build special versions of libgcc.a using the following ++## sets of options: -m68000, -m68020, -msoft-float, -m68000 -msoft-float, ++## and -m68020 -msoft-float. ++ ++MULTILIB_OPTIONS = mno-hw-mul mhw-mulx ++ ++## MULTILIB_DIRNAMES ++## If MULTILIB_OPTIONS is used, this variable specifies the directory names ++## that should be used to hold the various libraries. Write one element in ++## MULTILIB_DIRNAMES for each element in MULTILIB_OPTIONS. If ++## MULTILIB_DIRNAMES is not used, the default value will be ++## MULTILIB_OPTIONS, with all slashes treated as spaces. ++## For example, if MULTILIB_OPTIONS is set to m68000/m68020 msoft-float, ++## then the default value of MULTILIB_DIRNAMES is m68000 m68020 ++## msoft-float. You may specify a different value if you desire a ++## different set of directory names. ++ ++# MULTILIB_DIRNAMES = ++ ++## MULTILIB_MATCHES ++## Sometimes the same option may be written in two different ways. If an ++## option is listed in MULTILIB_OPTIONS, GCC needs to know about any ++## synonyms. In that case, set MULTILIB_MATCHES to a list of items of the ++## form option=option to describe all relevant synonyms. For example, ++## m68000=mc68000 m68020=mc68020. ++## ++## MULTILIB_EXCEPTIONS ++## Sometimes when there are multiple sets of MULTILIB_OPTIONS being ++## specified, there are combinations that should not be built. In that ++## case, set MULTILIB_EXCEPTIONS to be all of the switch exceptions in ++## shell case syntax that should not be built. ++## For example, in the PowerPC embedded ABI support, it is not desirable to ++## build libraries compiled with the -mcall-aix option and either of the ++## -fleading-underscore or -mlittle options at the same time. Therefore ++## MULTILIB_EXCEPTIONS is set to ++## ++## *mcall-aix/*fleading-underscore* *mlittle/*mcall-aix* ++## ++ ++MULTILIB_EXCEPTIONS = *mno-hw-mul/*mhw-mulx* ++ ++## ++## MULTILIB_EXTRA_OPTS Sometimes it is desirable that when building ++## multiple versions of libgcc.a certain options should always be passed on ++## to the compiler. In that case, set MULTILIB_EXTRA_OPTS to be the list ++## of options to be used for all builds. ++## ++ +--- gcc-3.4.3/gcc/config.gcc ++++ gcc-3.4.3-nios2/gcc/config.gcc +@@ -1321,6 +1321,10 @@ m32rle-*-linux*) + thread_file='posix' + fi + ;; ++# JBG ++nios2-*-* | nios2-*-*) ++ tm_file="elfos.h ${tm_file}" ++ ;; + # m68hc11 and m68hc12 share the same machine description. + m68hc11-*-*|m6811-*-*) + tm_file="dbxelf.h elfos.h m68hc11/m68hc11.h" +--- gcc-3.4.3/gcc/cse.c ++++ gcc-3.4.3-nios2/gcc/cse.c +@@ -3134,6 +3134,10 @@ find_comparison_args (enum rtx_code code + #ifdef FLOAT_STORE_FLAG_VALUE + REAL_VALUE_TYPE fsfv; + #endif ++#ifdef __nios2__ ++ if (p->is_const) ++ break; ++#endif + + /* If the entry isn't valid, skip it. */ + if (! exp_equiv_p (p->exp, p->exp, 1, 0)) +--- gcc-3.4.3/gcc/doc/extend.texi ++++ gcc-3.4.3-nios2/gcc/doc/extend.texi +@@ -5636,12 +5636,118 @@ to those machines. Generally these gene + instructions, but allow the compiler to schedule those calls. + + @menu ++* Altera Nios II Built-in Functions:: + * Alpha Built-in Functions:: + * ARM Built-in Functions:: + * X86 Built-in Functions:: + * PowerPC AltiVec Built-in Functions:: + @end menu + ++@node Altera Nios II Built-in Functions ++@subsection Altera Nios II Built-in Functions ++ ++These built-in functions are available for the Altera Nios II ++family of processors. ++ ++The following built-in functions are always available. They ++all generate the machine instruction that is part of the name. ++ ++@example ++int __builtin_ldbio (volatile const void *) ++int __builtin_ldbuio (volatile const void *) ++int __builtin_ldhio (volatile const void *) ++int __builtin_ldhuio (volatile const void *) ++int __builtin_ldwio (volatile const void *) ++void __builtin_stbio (volatile void *, int) ++void __builtin_sthio (volatile void *, int) ++void __builtin_stwio (volatile void *, int) ++void __builtin_sync (void) ++int __builtin_rdctl (int) ++void __builtin_wrctl (int, int) ++@end example ++ ++The following built-in functions are always available. They ++all generate a Nios II Custom Instruction. The name of the ++function represents the types that the function takes and ++returns. The letter before the @code{n} is the return type ++or void if absent. The @code{n} represnts the first parameter ++to all the custom instructions, the custom instruction number. ++The two letters after the @code{n} represent the up to two ++parameters to the function. ++ ++The letters reprsent the following data types: ++@table @code ++@item <no letter> ++@code{void} for return type and no parameter for parameter types. ++ ++@item i ++@code{int} for return type and parameter type ++ ++@item f ++@code{float} for return type and parameter type ++ ++@item p ++@code{void *} for return type and parameter type ++ ++@end table ++ ++And the function names are: ++@example ++void __builtin_custom_n (void) ++void __builtin_custom_ni (int) ++void __builtin_custom_nf (float) ++void __builtin_custom_np (void *) ++void __builtin_custom_nii (int, int) ++void __builtin_custom_nif (int, float) ++void __builtin_custom_nip (int, void *) ++void __builtin_custom_nfi (float, int) ++void __builtin_custom_nff (float, float) ++void __builtin_custom_nfp (float, void *) ++void __builtin_custom_npi (void *, int) ++void __builtin_custom_npf (void *, float) ++void __builtin_custom_npp (void *, void *) ++int __builtin_custom_in (void) ++int __builtin_custom_ini (int) ++int __builtin_custom_inf (float) ++int __builtin_custom_inp (void *) ++int __builtin_custom_inii (int, int) ++int __builtin_custom_inif (int, float) ++int __builtin_custom_inip (int, void *) ++int __builtin_custom_infi (float, int) ++int __builtin_custom_inff (float, float) ++int __builtin_custom_infp (float, void *) ++int __builtin_custom_inpi (void *, int) ++int __builtin_custom_inpf (void *, float) ++int __builtin_custom_inpp (void *, void *) ++float __builtin_custom_fn (void) ++float __builtin_custom_fni (int) ++float __builtin_custom_fnf (float) ++float __builtin_custom_fnp (void *) ++float __builtin_custom_fnii (int, int) ++float __builtin_custom_fnif (int, float) ++float __builtin_custom_fnip (int, void *) ++float __builtin_custom_fnfi (float, int) ++float __builtin_custom_fnff (float, float) ++float __builtin_custom_fnfp (float, void *) ++float __builtin_custom_fnpi (void *, int) ++float __builtin_custom_fnpf (void *, float) ++float __builtin_custom_fnpp (void *, void *) ++void * __builtin_custom_pn (void) ++void * __builtin_custom_pni (int) ++void * __builtin_custom_pnf (float) ++void * __builtin_custom_pnp (void *) ++void * __builtin_custom_pnii (int, int) ++void * __builtin_custom_pnif (int, float) ++void * __builtin_custom_pnip (int, void *) ++void * __builtin_custom_pnfi (float, int) ++void * __builtin_custom_pnff (float, float) ++void * __builtin_custom_pnfp (float, void *) ++void * __builtin_custom_pnpi (void *, int) ++void * __builtin_custom_pnpf (void *, float) ++void * __builtin_custom_pnpp (void *, void *) ++@end example ++ ++ + @node Alpha Built-in Functions + @subsection Alpha Built-in Functions + +--- gcc-3.4.3/gcc/doc/invoke.texi ++++ gcc-3.4.3-nios2/gcc/doc/invoke.texi +@@ -337,6 +337,14 @@ in the following sections. + @item Machine Dependent Options + @xref{Submodel Options,,Hardware Models and Configurations}. + ++@emph{Altera Nios II Options} ++@gccoptlist{-msmallc -mno-bypass-cache -mbypass-cache @gol ++-mno-cache-volatile -mcache-volatile -mno-inline-memcpy @gol ++-minline-memcpy -mno-fast-sw-div -mfast-sw-div @gol ++-mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx @gol ++-mno-hw-div -mhw-div @gol ++-msys-crt0= -msys-lib= -msys=nosys } ++ + @emph{M680x0 Options} + @gccoptlist{-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol + -m68060 -mcpu32 -m5200 -m68881 -mbitfield -mc68000 -mc68020 @gol +@@ -5836,6 +5844,7 @@ machine description. The default for th + that macro, which enables you to change the defaults. + + @menu ++* Altera Nios II Options:: + * M680x0 Options:: + * M68hc1x Options:: + * VAX Options:: +@@ -5871,6 +5880,103 @@ that macro, which enables you to change + * FRV Options:: + @end menu + ++ ++@node Altera Nios II Options ++@subsection Altera Nios II Options ++@cindex Altera Nios II options ++ ++These are the @samp{-m} options defined for the Altera Nios II ++processor. ++ ++@table @gcctabopt ++ ++@item -msmallc ++@opindex msmallc ++ ++Link with a limited version of the C library, -lsmallc. For more ++information see the C Library Documentation. ++ ++ ++@item -mbypass-cache ++@itemx -mno-bypass-cache ++@opindex mno-bypass-cache ++@opindex mbypass-cache ++ ++Force all load and store instructions to always bypass cache by ++using io variants of the instructions. The default is to not ++bypass the cache. ++ ++@item -mno-cache-volatile ++@itemx -mcache-volatile ++@opindex mcache-volatile ++@opindex mno-cache-volatile ++ ++Volatile memory access bypass the cache using the io variants of ++the ld and st instructions. The default is to cache volatile ++accesses. ++ ++-mno-cache-volatile is deprecated and will be deleted in a ++future GCC release. ++ ++ ++@item -mno-inline-memcpy ++@itemx -minline-memcpy ++@opindex mno-inline-memcpy ++@opindex minline-memcpy ++ ++Do not inline memcpy. The default is to inline when -O is on. ++ ++ ++@item -mno-fast-sw-div ++@itemx -mfast-sw-div ++@opindex mno-fast-sw-div ++@opindex mfast-sw-div ++ ++Do no use table based fast divide for small numbers. The default ++is to use the fast divide at -O3 and above. ++ ++ ++@item -mno-hw-mul ++@itemx -mhw-mul ++@itemx -mno-hw-mulx ++@itemx -mhw-mulx ++@itemx -mno-hw-div ++@itemx -mhw-div ++@opindex mno-hw-mul ++@opindex mhw-mul ++@opindex mno-hw-mulx ++@opindex mhw-mulx ++@opindex mno-hw-div ++@opindex mhw-div ++ ++Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of ++instructions by the compiler. The default is to emit @code{mul} ++and not emit @code{div} and @code{mulx}. ++ ++The different combinations of @code{mul} and @code{mulx} instructions ++generate a different multilib options. ++ ++ ++@item -msys-crt0=@var{startfile} ++@opindex msys-crt0 ++ ++@var{startfile} is the file name of the startfile (crt0) to use ++when linking. The default is crt0.o that comes with libgloss ++and is only suitable for use with the instruction set ++simulator. ++ ++@item -msys-lib=@var{systemlib} ++@itemx -msys-lib=nosys ++@opindex msys-lib ++ ++@var{systemlib} is the library name of the library which provides ++the system calls required by the C library, e.g. @code{read}, @code{write} ++etc. The default is to use nosys, this library provides ++stub implementations of the calls and is part of libgloss. ++ ++@end table ++ ++ + @node M680x0 Options + @subsection M680x0 Options + @cindex M680x0 options +--- gcc-3.4.3/gcc/doc/md.texi ++++ gcc-3.4.3-nios2/gcc/doc/md.texi +@@ -1335,6 +1335,49 @@ However, here is a summary of the machin + available on some particular machines. + + @table @emph ++ ++@item Altera Nios II family---@file{nios2.h} ++@table @code ++ ++@item I ++Integer that is valid as an immediate operand in an ++instruction taking a signed 16-bit number. Range ++@minus{}32768 to 32767. ++ ++@item J ++Integer that is valid as an immediate operand in an ++instruction taking an unsigned 16-bit number. Range ++0 to 65535. ++ ++@item K ++Integer that is valid as an immediate operand in an ++instruction taking only the upper 16-bits of a ++32-bit number. Range 32-bit numbers with the lower ++16-bits being 0. ++ ++@item L ++Integer that is valid as an immediate operand for a ++shift instruction. Range 0 to 31. ++ ++ ++@item M ++Integer that is valid as an immediate operand for ++only the value 0. Can be used in conjunction with ++the format modifier @code{z} to use @code{r0} ++instead of @code{0} in the assembly output. ++ ++@item N ++Integer that is valid as an immediate operand for ++a custom instruction opcode. Range 0 to 255. ++ ++@item S ++Matches immediates which are addresses in the small ++data section and therefore can be added to @code{gp} ++as a 16-bit immediate to re-create their 32-bit value. ++ ++@end table ++ ++ + @item ARM family---@file{arm.h} + @table @code + @item f diff --git a/patches/gcc/3.4.4/arm-softfloat.patch b/patches/gcc/3.4.4/arm-softfloat.patch new file mode 100644 index 00000000..19d1b90d --- /dev/null +++ b/patches/gcc/3.4.4/arm-softfloat.patch @@ -0,0 +1,270 @@ +Note... modified my mjn3 to not conflict with the big endian arm patch. +Warning!!! Only the linux target is aware of TARGET_ENDIAN_DEFAULT. +Also changed + #define SUBTARGET_EXTRA_ASM_SPEC "\ + %{!mcpu=*:-mcpu=xscale} \ + %{mhard-float:-mfpu=fpa} \ + %{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}" +to + #define SUBTARGET_EXTRA_ASM_SPEC "\ + %{mhard-float:-mfpu=fpa} \ + %{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}" +in gcc/config/arm/linux-elf.h. +# +# Submitted: +# +# Dimitry Andric <dimitry@andric.com>, 2004-05-01 +# +# Description: +# +# Nicholas Pitre released this patch for gcc soft-float support here: +# http://lists.arm.linux.org.uk/pipermail/linux-arm/2003-October/006436.html +# +# This version has been adapted to work with gcc 3.4.0. +# +# The original patch doesn't distinguish between softfpa and softvfp modes +# in the way Nicholas Pitre probably meant. His description is: +# +# "Default is to use APCS-32 mode with soft-vfp. The old Linux default for +# floats can be achieved with -mhard-float or with the configure +# --with-float=hard option. If -msoft-float or --with-float=soft is used then +# software float support will be used just like the default but with the legacy +# big endian word ordering for double float representation instead." +# +# Which means the following: +# +# * If you compile without -mhard-float or -msoft-float, you should get +# software floating point, using the VFP format. The produced object file +# should have these flags in its header: +# +# private flags = 600: [APCS-32] [VFP float format] [software FP] +# +# * If you compile with -mhard-float, you should get hardware floating point, +# which always uses the FPA format. Object file header flags should be: +# +# private flags = 0: [APCS-32] [FPA float format] +# +# * If you compile with -msoft-float, you should get software floating point, +# using the FPA format. This is done for compatibility reasons with many +# existing distributions. Object file header flags should be: +# +# private flags = 200: [APCS-32] [FPA float format] [software FP] +# +# The original patch from Nicholas Pitre contained the following constructs: +# +# #define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \ +# %{mhard-float:-mfpu=fpa} \ +# %{!mhard-float: %{msoft-float:-mfpu=softfpa;:-mfpu=softvfp}}" +# +# However, gcc doesn't accept this ";:" notation, used in the 3rd line. This +# is probably the reason Robert Schwebel modified it to: +# +# #define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \ +# %{mhard-float:-mfpu=fpa} \ +# %{!mhard-float: %{msoft-float:-mfpu=softfpa -mfpu=softvfp}}" +# +# But this causes the following behaviour: +# +# * If you compile without -mhard-float or -msoft-float, the compiler generates +# software floating point instructions, but *nothing* is passed to the +# assembler, which results in an object file which has flags: +# +# private flags = 0: [APCS-32] [FPA float format] +# +# This is not correct! +# +# * If you compile with -mhard-float, the compiler generates hardware floating +# point instructions, and passes "-mfpu=fpa" to the assembler, which results +# in an object file which has the same flags as in the previous item, but now +# those *are* correct. +# +# * If you compile with -msoft-float, the compiler generates software floating +# point instructions, and passes "-mfpu=softfpa -mfpu=softvfp" (in that +# order) to the assembler, which results in an object file with flags: +# +# private flags = 600: [APCS-32] [VFP float format] [software FP] +# +# This is not correct, because the last "-mfpu=" option on the assembler +# command line determines the actual FPU convention used (which should be FPA +# in this case). +# +# Therefore, I modified this patch to get the desired behaviour. Every +# instance of the notation: +# +# %{msoft-float:-mfpu=softfpa -mfpu=softvfp} +# +# was changed to: +# +# %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp} +# +# I also did the following: +# +# * Modified all TARGET_DEFAULT macros I could find to include ARM_FLAG_VFP, to +# be consistent with Nicholas' original patch. +# * Removed any "msoft-float" or "mhard-float" from all MULTILIB_DEFAULTS +# macros I could find. I think that if you compile without any options, you +# would like to get the defaults. :) +# * Removed the extra -lfloat option from LIBGCC_SPEC, since it isn't needed +# anymore. (The required functions are now in libgcc.) + +diff -urN gcc-3.4.1-old/gcc/config/arm/coff.h gcc-3.4.1/gcc/config/arm/coff.h +--- gcc-3.4.1-old/gcc/config/arm/coff.h 2004-02-24 08:25:22.000000000 -0600 ++++ gcc-3.4.1/gcc/config/arm/coff.h 2004-09-02 21:51:15.000000000 -0500 +@@ -31,11 +31,16 @@ + #define TARGET_VERSION fputs (" (ARM/coff)", stderr) + + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS) ++#define TARGET_DEFAULT \ ++ ( ARM_FLAG_SOFT_FLOAT \ ++ | ARM_FLAG_VFP \ ++ | ARM_FLAG_APCS_32 \ ++ | ARM_FLAG_APCS_FRAME \ ++ | ARM_FLAG_MMU_TRAPS ) + + #ifndef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork" } ++ { "marm", "mlittle-endian", "mapcs-32", "mno-thumb-interwork" } + #endif + + /* This is COFF, but prefer stabs. */ +diff -urN gcc-3.4.1-old/gcc/config/arm/elf.h gcc-3.4.1/gcc/config/arm/elf.h +--- gcc-3.4.1-old/gcc/config/arm/elf.h 2004-02-24 08:25:22.000000000 -0600 ++++ gcc-3.4.1/gcc/config/arm/elf.h 2004-09-02 21:51:15.000000000 -0500 +@@ -46,7 +46,9 @@ + + #ifndef SUBTARGET_ASM_FLOAT_SPEC + #define SUBTARGET_ASM_FLOAT_SPEC "\ +-%{mapcs-float:-mfloat} %{msoft-float:-mfpu=softfpa}" ++%{mapcs-float:-mfloat} \ ++%{mhard-float:-mfpu=fpa} \ ++%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}" + #endif + + #ifndef ASM_SPEC +@@ -106,12 +108,17 @@ + #endif + + #ifndef TARGET_DEFAULT +-#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS) ++#define TARGET_DEFAULT \ ++ ( ARM_FLAG_SOFT_FLOAT \ ++ | ARM_FLAG_VFP \ ++ | ARM_FLAG_APCS_32 \ ++ | ARM_FLAG_APCS_FRAME \ ++ | ARM_FLAG_MMU_TRAPS ) + #endif + + #ifndef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork", "fno-leading-underscore" } ++ { "marm", "mlittle-endian", "mapcs-32", "mno-thumb-interwork", "fno-leading-underscore" } + #endif + + #define TARGET_ASM_FILE_START_APP_OFF true +diff -urN gcc-3.4.1-old/gcc/config/arm/linux-elf.h gcc-3.4.1/gcc/config/arm/linux-elf.h +--- gcc-3.4.1-old/gcc/config/arm/linux-elf.h 2004-09-02 21:50:52.000000000 -0500 ++++ gcc-3.4.1/gcc/config/arm/linux-elf.h 2004-09-02 22:00:49.000000000 -0500 +@@ -44,12 +44,26 @@ + #define TARGET_LINKER_EMULATION "armelf_linux" + #endif + +-/* Default is to use APCS-32 mode. */ ++/* ++ * Default is to use APCS-32 mode with soft-vfp. ++ * The old Linux default for floats can be achieved with -mhard-float ++ * or with the configure --with-float=hard option. ++ * If -msoft-float or --with-float=soft is used then software float ++ * support will be used just like the default but with the legacy ++ * big endian word ordering for double float representation instead. ++ */ + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT \ +- ( ARM_FLAG_APCS_32 | \ +- ARM_FLAG_MMU_TRAPS | \ +- TARGET_ENDIAN_DEFAULT ) ++#define TARGET_DEFAULT \ ++ ( ARM_FLAG_APCS_32 \ ++ | ARM_FLAG_SOFT_FLOAT \ ++ | TARGET_ENDIAN_DEFAULT \ ++ | ARM_FLAG_VFP \ ++ | ARM_FLAG_MMU_TRAPS ) ++ ++#undef SUBTARGET_EXTRA_ASM_SPEC ++#define SUBTARGET_EXTRA_ASM_SPEC "\ ++%{mhard-float:-mfpu=fpa} \ ++%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}" + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +@@ -57,7 +71,7 @@ + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mapcs-32", "mno-thumb-interwork" } + + #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" + +@@ -72,7 +86,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add + the GNU/Linux magical crtbegin.o file (see crtstuff.c) which +diff -urN gcc-3.4.1-old/gcc/config/arm/t-linux gcc-3.4.1/gcc/config/arm/t-linux +--- gcc-3.4.1-old/gcc/config/arm/t-linux 2003-09-20 16:09:07.000000000 -0500 ++++ gcc-3.4.1/gcc/config/arm/t-linux 2004-09-02 21:51:15.000000000 -0500 +@@ -4,7 +4,10 @@ + LIBGCC2_DEBUG_CFLAGS = -g0 + + LIB1ASMSRC = arm/lib1funcs.asm +-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx ++LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \ ++ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ ++ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ ++ _fixsfsi _fixunssfsi + + # MULTILIB_OPTIONS = mhard-float/msoft-float + # MULTILIB_DIRNAMES = hard-float soft-float +diff -urN gcc-3.4.1-old/gcc/config/arm/unknown-elf.h gcc-3.4.1/gcc/config/arm/unknown-elf.h +--- gcc-3.4.1-old/gcc/config/arm/unknown-elf.h 2004-02-24 08:25:22.000000000 -0600 ++++ gcc-3.4.1/gcc/config/arm/unknown-elf.h 2004-09-02 21:51:15.000000000 -0500 +@@ -30,7 +30,12 @@ + + /* Default to using APCS-32 and software floating point. */ + #ifndef TARGET_DEFAULT +-#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS) ++#define TARGET_DEFAULT \ ++ ( ARM_FLAG_SOFT_FLOAT \ ++ | ARM_FLAG_VFP \ ++ | ARM_FLAG_APCS_32 \ ++ | ARM_FLAG_APCS_FRAME \ ++ | ARM_FLAG_MMU_TRAPS ) + #endif + + /* Now we define the strings used to build the spec file. */ +diff -urN gcc-3.4.1-old/gcc/config/arm/xscale-elf.h gcc-3.4.1/gcc/config/arm/xscale-elf.h +--- gcc-3.4.1-old/gcc/config/arm/xscale-elf.h 2003-07-01 18:26:43.000000000 -0500 ++++ gcc-3.4.1/gcc/config/arm/xscale-elf.h 2004-09-02 21:51:15.000000000 -0500 +@@ -49,11 +49,12 @@ + endian, regardless of the endian-ness of the memory + system. */ + +-#define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \ +- %{mhard-float:-mfpu=fpa} \ +- %{!mhard-float: %{msoft-float:-mfpu=softfpa;:-mfpu=softvfp}}" ++#define SUBTARGET_EXTRA_ASM_SPEC "\ ++%{!mcpu=*:-mcpu=xscale} \ ++%{mhard-float:-mfpu=fpa} \ ++%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}" + + #ifndef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "mlittle-endian", "mno-thumb-interwork", "marm", "msoft-float" } ++ { "mlittle-endian", "mno-thumb-interwork", "marm" } + #endif diff --git a/patches/gcc/3.4.4/fix-fixincl.patch b/patches/gcc/3.4.4/fix-fixincl.patch new file mode 100644 index 00000000..7936b19b --- /dev/null +++ b/patches/gcc/3.4.4/fix-fixincl.patch @@ -0,0 +1,70 @@ +See http://gcc.gnu.org/PR22541 + +From: Dan Kegel + +When building gcc-3.4.3 or gcc-4.0.0 as a cross into a clean $PREFIX +(the only two I've tried like this), the configure script happily copies +the glibc include files from include to sys-include; here's the line +from the log file (with $PREFIX instead of the real prefix): + +Copying $PREFIX/i686-unknown-linux-gnu/include to $PREFIX/i686-unknown-linux-gnu/sys-include + +But later, when running fixincludes, it gives the error message + The directory that should contain system headers does not exist: + $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/../../../../i686-unknown-linux-gnu/sys-include + +Nevertheless, it continues building; the header files it installs in + $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/include +do not include the boilerplate that would cause it to #include_next the +glibc headers in the system header directory. +Thus the resulting toolchain can't compile the following program: +#include <limits.h> +int x = PATH_MAX; +because its limits.h doesn't include the glibc header. + +That's not nice. I suspect the problem is that gcc/Makefile.in assumes that +it can refer to $PREFIX/i686-unknown-linux-gnu with the path + $PREFIX/lib/../i686-unknown-linux-gnu, but +that fails because the directory $PREFIX/lib doesn't exist during 'make all'; +it is only created later, during 'make install'. (Which makes this problem +confusing, since one only notices the breakage well after 'make install', +at which point the path configure complained about does exist, and has the +right stuff in it.) + +A possible fix is to replace the line in gcc/Makefile.in that says + SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@ +with a version that gets rid of extra ..'s, e.g. + SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,,;ta"` +(hey, that's the first time I've ever used a label in a sed script; thanks to the sed faq +for explaining the :a ... ta method of looping to repeat a search-and-replace until it doesn't match.) + + +--- gcc-3.4.3/gcc/Makefile.in.foo 2005-05-20 11:41:39.000000000 -0700 ++++ gcc-3.4.3/gcc/Makefile.in 2005-05-20 12:08:46.000000000 -0700 +@@ -350,7 +350,10 @@ + CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ + + # autoconf sets SYSTEM_HEADER_DIR to one of the above. +-SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@ ++# Purge it of unneccessary internal relative paths ++# to directories that might not exist yet. ++# The sed idiom for this is to repeat the search-and-replace until it doesn't match, using :a ... ta. ++SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta` + + # Control whether to run fixproto and fixincludes. + STMP_FIXPROTO = @STMP_FIXPROTO@ +@@ -2532,11 +2535,13 @@ + $(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(gcc_tooldir) + + # Build fixed copies of system files. ++# Abort if no system headers available, unless building a crosscompiler. ++# FIXME: abort unless building --without-headers would be more accurate and less ugly + stmp-fixinc: fixinc.sh gsyslimits.h + @if test ! -d ${SYSTEM_HEADER_DIR}; then \ + echo The directory that should contain system headers does not exist: >&2 ; \ + echo " ${SYSTEM_HEADER_DIR}" >&2 ; \ +- if test "x${SYSTEM_HEADER_DIR}" = "x${gcc_tooldir}/sys-include"; \ ++ if test "x${SYSTEM_HEADER_DIR}" = "x`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`"; \ + then sleep 1; else exit 1; fi; \ + fi + rm -rf include; mkdir include diff --git a/patches/gcc/3.4.5/fix-fixincl.patch b/patches/gcc/3.4.5/fix-fixincl.patch new file mode 100644 index 00000000..7936b19b --- /dev/null +++ b/patches/gcc/3.4.5/fix-fixincl.patch @@ -0,0 +1,70 @@ +See http://gcc.gnu.org/PR22541 + +From: Dan Kegel + +When building gcc-3.4.3 or gcc-4.0.0 as a cross into a clean $PREFIX +(the only two I've tried like this), the configure script happily copies +the glibc include files from include to sys-include; here's the line +from the log file (with $PREFIX instead of the real prefix): + +Copying $PREFIX/i686-unknown-linux-gnu/include to $PREFIX/i686-unknown-linux-gnu/sys-include + +But later, when running fixincludes, it gives the error message + The directory that should contain system headers does not exist: + $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/../../../../i686-unknown-linux-gnu/sys-include + +Nevertheless, it continues building; the header files it installs in + $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/include +do not include the boilerplate that would cause it to #include_next the +glibc headers in the system header directory. +Thus the resulting toolchain can't compile the following program: +#include <limits.h> +int x = PATH_MAX; +because its limits.h doesn't include the glibc header. + +That's not nice. I suspect the problem is that gcc/Makefile.in assumes that +it can refer to $PREFIX/i686-unknown-linux-gnu with the path + $PREFIX/lib/../i686-unknown-linux-gnu, but +that fails because the directory $PREFIX/lib doesn't exist during 'make all'; +it is only created later, during 'make install'. (Which makes this problem +confusing, since one only notices the breakage well after 'make install', +at which point the path configure complained about does exist, and has the +right stuff in it.) + +A possible fix is to replace the line in gcc/Makefile.in that says + SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@ +with a version that gets rid of extra ..'s, e.g. + SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,,;ta"` +(hey, that's the first time I've ever used a label in a sed script; thanks to the sed faq +for explaining the :a ... ta method of looping to repeat a search-and-replace until it doesn't match.) + + +--- gcc-3.4.3/gcc/Makefile.in.foo 2005-05-20 11:41:39.000000000 -0700 ++++ gcc-3.4.3/gcc/Makefile.in 2005-05-20 12:08:46.000000000 -0700 +@@ -350,7 +350,10 @@ + CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ + + # autoconf sets SYSTEM_HEADER_DIR to one of the above. +-SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@ ++# Purge it of unneccessary internal relative paths ++# to directories that might not exist yet. ++# The sed idiom for this is to repeat the search-and-replace until it doesn't match, using :a ... ta. ++SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta` + + # Control whether to run fixproto and fixincludes. + STMP_FIXPROTO = @STMP_FIXPROTO@ +@@ -2532,11 +2535,13 @@ + $(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(gcc_tooldir) + + # Build fixed copies of system files. ++# Abort if no system headers available, unless building a crosscompiler. ++# FIXME: abort unless building --without-headers would be more accurate and less ugly + stmp-fixinc: fixinc.sh gsyslimits.h + @if test ! -d ${SYSTEM_HEADER_DIR}; then \ + echo The directory that should contain system headers does not exist: >&2 ; \ + echo " ${SYSTEM_HEADER_DIR}" >&2 ; \ +- if test "x${SYSTEM_HEADER_DIR}" = "x${gcc_tooldir}/sys-include"; \ ++ if test "x${SYSTEM_HEADER_DIR}" = "x`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`"; \ + then sleep 1; else exit 1; fi; \ + fi + rm -rf include; mkdir include diff --git a/patches/gcc/3.4.5/gcc-3.4.0-arm-bigendian.patch b/patches/gcc/3.4.5/gcc-3.4.0-arm-bigendian.patch new file mode 100644 index 00000000..f7178c19 --- /dev/null +++ b/patches/gcc/3.4.5/gcc-3.4.0-arm-bigendian.patch @@ -0,0 +1,82 @@ +By Lennert Buytenhek <buytenh@wantstofly.org> +Adds support for arm*b-linux* big-endian ARM targets + +Fixes build error + +/opt/crosstool/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/armeb-unknown-linux-gnu/bin/ld: unrecognised emulation mode: armelf_linux +Supported emulations: armelfb_linux armelfb +collect2: ld returned 1 exit status +make[2]: *** [/home/dank/wk/crosstool-0.28-rc36/build/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/build-glibc/csu/crt1.o] Error 1 +make[2]: Leaving directory `/home/dank/wk/crosstool-0.28-rc36/build/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/glibc-2.3.3/csu' +make[1]: *** [csu/subdir_lib] Error 2 +make[1]: Leaving directory `/home/dank/wk/crosstool-0.28-rc36/build/armeb-unknown-linux-gnu/gcc-3.4.2-glibc-2.3.3/glibc-2.3.3' +make: *** [all] Error 2 + + +See http://gcc.gnu.org/PR16350 + +diff -urN gcc-3.4.0.orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h +--- gcc-3.4.0.orig/gcc/config/arm/linux-elf.h 2004-01-31 07:18:11.000000000 +0100 ++++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-07-02 14:46:29.225443757 +0200 +@@ -30,17 +30,34 @@ + /* Do not assume anything about header files. */ + #define NO_IMPLICIT_EXTERN_C + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END ++#define TARGET_ENDIAN_OPTION "mbig-endian" ++#define TARGET_LINKER_EMULATION "armelfb_linux" ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#define TARGET_ENDIAN_OPTION "mlittle-endian" ++#define TARGET_LINKER_EMULATION "armelf_linux" ++#endif ++ + /* Default is to use APCS-32 mode. */ + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS) ++#define TARGET_DEFAULT \ ++ ( ARM_FLAG_APCS_32 | \ ++ ARM_FLAG_MMU_TRAPS | \ ++ TARGET_ENDIAN_DEFAULT ) + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" } + + #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" + +@@ -89,7 +106,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS() +diff -urN gcc-3.4.0.orig/gcc/config.gcc gcc-3.4.0/gcc/config.gcc +--- gcc-3.4.0.orig/gcc/config.gcc 2004-04-17 04:28:24.000000000 +0200 ++++ gcc-3.4.0/gcc/config.gcc 2004-07-02 14:44:40.045822542 +0200 +@@ -666,6 +666,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + 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" ++ case $target in ++ arm*b-*) ++ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" ++ ;; ++ esac + tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes diff --git a/patches/gcc/3.4.5/gcc-3.4.0-arm-lib1asm.patch b/patches/gcc/3.4.5/gcc-3.4.0-arm-lib1asm.patch new file mode 100644 index 00000000..69a79d5d --- /dev/null +++ b/patches/gcc/3.4.5/gcc-3.4.0-arm-lib1asm.patch @@ -0,0 +1,27 @@ +# Origin: from a patch by Dimitry Andric <dimitry@andric.com>, 2004-05-01 +# See http://gcc.gnu.org/PR14352 and http://gcc.gnu.org/PR16314 +# See also http://gcc.gnu.org/ml/gcc-patches/2004-08/msg02568.html et seq for why this isn't in mainline +# Fixes errors like the following when building glibc (or any other executable +# or shared library) when using gcc 3.4.0 for ARM with softfloat: +# +# .../libc_pic.os(.text+0x15834): In function `__modf': undefined reference to `__subdf3' +# .../libc_pic.os(.text+0x158b8): In function `__modf': undefined reference to `__subdf3' +# .../libc_pic.os(.text+0x1590c): In function `scalbn': undefined reference to `__muldf3' +# .../libc_pic.os(.text+0x15e94): In function `__ldexpf': undefined reference to `__eqsf2' +# .../libc_pic.os(.text+0xcee4c): In function `monstartup': undefined reference to `__fixsfsi' + +diff -urNd gcc-3.4.0-orig/gcc/config/arm/t-linux gcc-3.4.0/gcc/config/arm/t-linux +--- gcc-3.4.0-orig/gcc/config/arm/t-linux 2003-09-20 23:09:07.000000000 +0200 ++++ gcc-3.4.0/gcc/config/arm/t-linux 2004-05-01 20:31:59.102846400 +0200 +@@ -4,7 +4,10 @@ + LIBGCC2_DEBUG_CFLAGS = -g0 + + LIB1ASMSRC = arm/lib1funcs.asm +-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx ++LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \ ++ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ ++ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ ++ _fixsfsi _fixunssfsi + + # MULTILIB_OPTIONS = mhard-float/msoft-float + # MULTILIB_DIRNAMES = hard-float soft-float diff --git a/patches/gcc/3.4.5/gcc-3.4.0-arm-nolibfloat.patch b/patches/gcc/3.4.5/gcc-3.4.0-arm-nolibfloat.patch new file mode 100644 index 00000000..43eed3ef --- /dev/null +++ b/patches/gcc/3.4.5/gcc-3.4.0-arm-nolibfloat.patch @@ -0,0 +1,24 @@ +# Dimitry Andric <dimitry@andric.com>, 2004-05-01 +# +# * Removed the extra -lfloat option from LIBGCC_SPEC, since it isn't needed +# anymore. (The required functions are now in libgcc.) +# +# Fixes errors like +# arm-softfloat-linux-gnu/3.4.0/../../../../arm-softfloat-linux-gnu/bin/ld: cannot find -lfloat +# collect2: ld returned 1 exit status +# make[2]: *** [arm-softfloat-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/iconvdata/ISO8859-1.so] Error 1 +# when building glibc-2.3.3 with gcc-3.4.0 for arm-softfloat + +diff -urNd gcc-3.4.0-orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h +--- gcc-3.4.0-orig/gcc/config/arm/linux-elf.h 2004-01-31 07:18:11.000000000 +0100 ++++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-05-01 19:19:06.935979200 +0200 +@@ -55,7 +73,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add + the GNU/Linux magical crtbegin.o file (see crtstuff.c) which + diff --git a/patches/gcc/3.4.5/pr15068-fix.patch b/patches/gcc/3.4.5/pr15068-fix.patch new file mode 100644 index 00000000..2977765c --- /dev/null +++ b/patches/gcc/3.4.5/pr15068-fix.patch @@ -0,0 +1,44 @@ +See http://gcc.gnu.org/PR15068 + +Fixes error + +../sysdeps/generic/s_fmax.c: In function `__fmax': +../sysdeps/generic/s_fmax.c:28: internal compiler error: in elim_reg_cond, at flow.c:3257 +Please submit a full bug report, +with preprocessed source if appropriate. +See <URL:http://gcc.gnu.org/bugs.html> for instructions. +make[2]: *** [/home/dank/wk/crosstool-0.28-rc35/build/arm-unknown-linux-gnu/gcc-3.4.1-glibc-20040822/build-glibc/math/s_fmax.o] Error 1 +make[2]: Leaving directory `/home/dank/wk/crosstool-0.28-rc35/build/arm-unknown-linux-gnu/gcc-3.4.1-glibc-20040822/glibc-20040822/math' +make[1]: *** [math/others] Error 2 +make[1]: Leaving directory `/home/dank/wk/crosstool-0.28-rc35/build/arm-unknown-linux-gnu/gcc-3.4.1-glibc-20040822/glibc-20040822' +make: *** [all] Error 2 + +[ rediffed against gcc-3.4.1, with elbow grease, ending up with same thing as +http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/flow.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.563.4.2&r2=1.563.4.3 ] + +--- gcc-3.4.1/gcc/flow.c.old 2004-02-27 19:39:19.000000000 -0800 ++++ gcc-3.4.1/gcc/flow.c 2004-08-26 07:29:46.000000000 -0700 +@@ -1878,6 +1878,7 @@ + rtx set_src = SET_SRC (pc_set (BB_END (bb))); + rtx cond_true = XEXP (set_src, 0); + rtx reg = XEXP (cond_true, 0); ++ enum rtx_code inv_cond; + + if (GET_CODE (reg) == SUBREG) + reg = SUBREG_REG (reg); +@@ -1886,11 +1887,13 @@ + in the form of a comparison of a register against zero. + If the condition is more complex than that, then it is safe + not to record any information. */ +- if (GET_CODE (reg) == REG ++ inv_cond = reversed_comparison_code (cond_true, BB_END (bb)); ++ if (inv_cond != UNKNOWN ++ && GET_CODE (reg) == REG + && XEXP (cond_true, 1) == const0_rtx) + { + rtx cond_false +- = gen_rtx_fmt_ee (reverse_condition (GET_CODE (cond_true)), ++ = gen_rtx_fmt_ee (inv_cond, + GET_MODE (cond_true), XEXP (cond_true, 0), + XEXP (cond_true, 1)); + if (GET_CODE (XEXP (set_src, 1)) == PC) diff --git a/patches/gcc/4.0.0/fix-fixincl.patch b/patches/gcc/4.0.0/fix-fixincl.patch new file mode 100644 index 00000000..8051f31c --- /dev/null +++ b/patches/gcc/4.0.0/fix-fixincl.patch @@ -0,0 +1,72 @@ +See http://gcc.gnu.org/PR22541 + +From: Dan Kegel + +When building gcc-3.4.3 or gcc-4.0.[01] into a clean $PREFIX (the only two I've tried like this), +the configure script happily copies the glibc include files from include to sys-include; +here's the line from the log file (with $PREFIX instead of the real prefix): + +Copying $PREFIX/i686-unknown-linux-gnu/include to $PREFIX/i686-unknown-linux-gnu/sys-include + +But later, when running fixincludes, it gives the error message + The directory that should contain system headers does not exist: + $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/../../../../i686-unknown-linux-gnu/sys-include + +Nevertheless, it continues building; the header files it installs in + $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/include +do not include the boilerplate that would cause it to #include_next the +glibc headers in the system header directory. +Thus the resulting toolchain can't compile the following program: +#include <limits.h> +int x = PATH_MAX; +because its limits.h doesn't include the glibc header. + +That's not nice. I suspect the problem is that gcc/Makefile.in assumes that +it can refer to $PREFIX/i686-unknown-linux-gnu with the path + $PREFIX/lib/../i686-unknown-linux-gnu, but +that fails because the directory $PREFIX/lib doesn't exist during 'make all'; +it is only created later, during 'make install'. (Which makes this problem +confusing, since one only notices the breakage well after 'make install', +at which point the path configure complained about does exist, and has the +right stuff in it.) + +A possible fix is to replace the line in gcc/Makefile.in that says + SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@ +with a version that gets rid of extra ..'s, e.g. + SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,,;ta"` +(hey, that's the first time I've ever used a label in a sed script; thanks to the sed faq +for explaining the :a ... ta method of looping to repeat a search-and-replace until it doesn't match.) + +[rediffed against gcc-4.0.0] + +--- gcc-4.0.0/gcc/Makefile.in.orig 2005-04-04 12:45:13.000000000 -0700 ++++ gcc-4.0.0/gcc/Makefile.in 2005-05-20 12:33:43.000000000 -0700 +@@ -378,7 +378,10 @@ + CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ + + # autoconf sets SYSTEM_HEADER_DIR to one of the above. +-SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@ ++# Purge it of unneccessary internal relative paths ++# to directories that might not exist yet. ++# The sed idiom for this is to repeat the search-and-replace until it doesn't match, using :a ... ta. ++SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta` + + # Control whether to run fixproto and fixincludes. + STMP_FIXPROTO = @STMP_FIXPROTO@ +@@ -2838,13 +2841,15 @@ + ../$(build_subdir)/fixincludes/fixincl: ; @ : + + # Build fixed copies of system files. ++# Abort if no system headers available, unless building a crosscompiler. ++# FIXME: abort unless building --without-headers would be more accurate and less ugly + stmp-fixinc: gsyslimits.h macro_list \ + ../$(build_subdir)/fixincludes/fixincl \ + ../$(build_subdir)/fixincludes/fixinc.sh + @if test ! -d ${SYSTEM_HEADER_DIR}; then \ + echo The directory that should contain system headers does not exist: >&2 ; \ + echo " ${SYSTEM_HEADER_DIR}" >&2 ; \ +- if test "x${SYSTEM_HEADER_DIR}" = "x${gcc_tooldir}/sys-include"; \ ++ if test "x${SYSTEM_HEADER_DIR}" = "x`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`"; \ + then sleep 1; else exit 1; fi; \ + fi + rm -rf include; mkdir include diff --git a/patches/gcc/4.0.0/gcc-4.0-arm-bigendian.patch b/patches/gcc/4.0.0/gcc-4.0-arm-bigendian.patch new file mode 100644 index 00000000..d9bcffeb --- /dev/null +++ b/patches/gcc/4.0.0/gcc-4.0-arm-bigendian.patch @@ -0,0 +1,79 @@ +By Lennert Buytenhek <buytenh@wantstofly.org> +Adds support for arm*b-linux* big-endian ARM targets + +Fixes following build error for big-endian ARM targets: + +armeb-unknown-linux-gnu/gcc-4.0.0-20050410-glibc-2.3.4/bin/../lib/gcc/armeb-unknown-linux-gnu/4.0.0/../../../../armeb-unknown-linux-gnu/bin/ld: unrecognised emulation mode: armelf_linux +Supported emulations: armelfb_linux armelfb +collect2: ld returned 1 exit status +make[2]: *** [crosstool-0.32/build/armeb-unknown-linux-gnu/gcc-4.0.0-20050410-glibc-2.3.4/build-glibc/csu/crt1.o] Error 1 +make[2]: Leaving directory `crosstool-0.32/build/armeb-unknown-linux-gnu/gcc-4.0.0-20050410-glibc-2.3.4/glibc-2.3.4/csu' +make[1]: *** [csu/subdir_lib] Error 2 +make[1]: Leaving directory `crosstool-0.32/build/armeb-unknown-linux-gnu/gcc-4.0.0-20050410-glibc-2.3.4/glibc-2.3.4' +make: *** [lib] Error 2 + + +See http://gcc.gnu.org/PR16350 + +--- gcc-4.0-20050305/gcc/config/arm/linux-elf.h.orig 2005-03-23 18:44:54.822707377 +0100 ++++ gcc-4.0-20050305/gcc/config/arm/linux-elf.h 2005-03-23 18:46:18.228560206 +0100 +@@ -31,19 +31,33 @@ + /* Do not assume anything about header files. */ + #define NO_IMPLICIT_EXTERN_C + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for ++ * arm*b-*-linux* (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END ++#define TARGET_ENDIAN_OPTION "mbig-endian" ++#define TARGET_LINKER_EMULATION "armelfb_linux" ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#define TARGET_ENDIAN_OPTION "mlittle-endian" ++#define TARGET_LINKER_EMULATION "armelf_linux" ++#endif ++ + #undef TARGET_DEFAULT_FLOAT_ABI + #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD + + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (0) ++#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT) + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" } + + /* The GNU C++ standard library requires that these macros be defined. */ + #undef CPLUSPLUS_CPP_SPEC +@@ -90,7 +104,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #define TARGET_OS_CPP_BUILTINS() \ +--- gcc-4.0-20050305/gcc/config.gcc.orig 2005-03-23 18:46:23.318105335 +0100 ++++ gcc-4.0-20050305/gcc/config.gcc 2005-03-23 18:47:41.592546386 +0100 +@@ -650,6 +650,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + 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" ++ case $target in ++ arm*b-*-linux*) ++ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" ++ ;; ++ esac + tmake_file="${tmake_file} arm/t-arm arm/t-linux" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes diff --git a/patches/gcc/4.0.0/pr20815-fix.patch b/patches/gcc/4.0.0/pr20815-fix.patch new file mode 100644 index 00000000..7ac8ab50 --- /dev/null +++ b/patches/gcc/4.0.0/pr20815-fix.patch @@ -0,0 +1,121 @@ +Date: 18 May 2005 22:47:59 -0000 +Message-ID: <20050518224759.7352.qmail@sourceware.org> +From: "hubicka at ucw dot cz" <gcc-bugzilla@gcc.gnu.org> +To: dank@kegel.com +References: <20050407215701.20815.dank@kegel.com> +Reply-To: gcc-bugzilla@gcc.gnu.org +Subject: [Bug gcov/profile/20815] -fprofile-use barfs with "coverage mismatch for function '...' while reading counter 'arcs'." + + +------- Additional Comments From hubicka at ucw dot cz 2005-05-18 22:47 ------- +Subject: Re: [Bug gcov/profile/20815] -fprofile-use barfs with "coverage mismatch for function '...' while reading counter 'arcs'." + +> +> ------- Additional Comments From hubicka at ucw dot cz 2005-05-18 22:22 ------- +> Subject: Re: [Bug gcov/profile/20815] -fprofile-use barfs with "coverage mismatch for function '...' while reading counter 'arcs'." +> +> coverage_checksum_string already knows a bit about ignoring random seed +> produced mess. It looks like this needs to be extended somehow to +> handle namespaces too... + +This seems to solve the missmatch. Would it be possible to test it on +bigger testcase and if it works distile a testcase that don't use +file IO so it is more suitable for gcc regtesting? + +Index: coverage.c +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/coverage.c,v +retrieving revision 1.6.2.12.2.12 +diff -c -3 -p -r1.6.2.12.2.12 coverage.c +*** gcc-old/gcc/coverage.c 18 May 2005 07:37:31 -0000 1.6.2.12.2.12 +--- gcc/gcc/coverage.c 18 May 2005 22:45:36 -0000 +*************** coverage_checksum_string (unsigned chksu +*** 471,505 **** + as the checksums are used only for sanity checking. */ + for (i = 0; string[i]; i++) + { + if (!strncmp (string + i, "_GLOBAL__", 9)) +! for (i = i + 9; string[i]; i++) +! if (string[i]=='_') +! { +! int y; +! unsigned seed; +! int scan; +! +! for (y = 1; y < 9; y++) +! if (!(string[i + y] >= '0' && string[i + y] <= '9') +! && !(string[i + y] >= 'A' && string[i + y] <= 'F')) +! break; +! if (y != 9 || string[i + 9] != '_') +! continue; +! for (y = 10; y < 18; y++) +! if (!(string[i + y] >= '0' && string[i + y] <= '9') +! && !(string[i + y] >= 'A' && string[i + y] <= 'F')) +! break; +! if (y != 18) +! continue; +! scan = sscanf (string + i + 10, "%X", &seed); +! gcc_assert (scan); +! if (seed != crc32_string (0, flag_random_seed)) +! continue; +! string = dup = xstrdup (string); +! for (y = 10; y < 18; y++) +! dup[i + y] = '0'; +! break; +! } + break; + } + +--- 471,511 ---- + as the checksums are used only for sanity checking. */ + for (i = 0; string[i]; i++) + { ++ int offset = 0; ++ if (!strncmp (string + i, "_GLOBAL__N_", 11)) ++ offset = 11; + if (!strncmp (string + i, "_GLOBAL__", 9)) +! offset = 9; +! +! /* C++ namespaces do have scheme: +! _GLOBAL__N_<filename>_<wrongmagicnumber>_<magicnumber>functionname +! since filename might contain extra underscores there seems +! to be no better chance then walk all possible offsets looking +! for magicnuber. */ +! if (offset) +! for (;string[offset]; offset++) +! for (i = i + offset; string[i]; i++) +! if (string[i]=='_') +! { +! int y; +! +! for (y = 1; y < 9; y++) +! if (!(string[i + y] >= '0' && string[i + y] <= '9') +! && !(string[i + y] >= 'A' && string[i + y] <= 'F')) +! break; +! if (y != 9 || string[i + 9] != '_') +! continue; +! for (y = 10; y < 18; y++) +! if (!(string[i + y] >= '0' && string[i + y] <= '9') +! && !(string[i + y] >= 'A' && string[i + y] <= 'F')) +! break; +! if (y != 18) +! continue; +! if (!dup) +! string = dup = xstrdup (string); +! for (y = 10; y < 18; y++) +! dup[i + y] = '0'; +! } + break; + } + + + +-- + + +http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20815 + +------- You are receiving this mail because: ------- +You reported the bug, or are watching the reporter. + + diff --git a/patches/gcc/4.0.0/pr20973-fix.patch b/patches/gcc/4.0.0/pr20973-fix.patch new file mode 100644 index 00000000..74512198 --- /dev/null +++ b/patches/gcc/4.0.0/pr20973-fix.patch @@ -0,0 +1,80 @@ +http://gcc.gnu.org/PR20973 + +"gcc 4 (about RC1) miscompiles khtml, in fact something in CSS, which basically +leads to all websites being misrendered. I can't easily reduce the testcase, +but have applied the whole preprocessed source of css/cssstyleselector.ii. + +It is to be compiled with g++ -O2 -fPIC -march=i586 -mtune=i686 +-fno-exceptions. A more detailed analysis will follow, as we've found out +some things already." + +--- + +Subject: Bug 20973 + +CVSROOT: /cvs/gcc +Module name: gcc +Branch: gcc-4_0-branch +Changes by: matz@gcc.gnu.org 2005-04-22 17:30:21 + +Modified files: + gcc : ChangeLog reload.c + +Log message: + PR middle-end/20973 + * reload.c (push_reload, find_dummy_reload): Check for uninitialized + pseudos. + +Patches: +http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.177&r2=2.7592.2.178 +http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/reload.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.268&r2=1.268.2.1 + +--- + +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/reload.c,v +retrieving revision 1.268 +retrieving revision 1.268.2.1 +diff -u -r1.268 -r1.268.2.1 +--- gcc/gcc/reload.c 2005/02/24 22:06:06 1.268 ++++ gcc/gcc/reload.c 2005/04/22 17:30:15 1.268.2.1 +@@ -1520,7 +1520,7 @@ + But if there is no spilling in this block, that is OK. + An explicitly used hard reg cannot be a spill reg. */ + +- if (rld[i].reg_rtx == 0 && in != 0) ++ if (rld[i].reg_rtx == 0 && in != 0 && hard_regs_live_known) + { + rtx note; + int regno; +@@ -1534,6 +1534,11 @@ + && REG_P (XEXP (note, 0)) + && (regno = REGNO (XEXP (note, 0))) < FIRST_PSEUDO_REGISTER + && reg_mentioned_p (XEXP (note, 0), in) ++ /* Check that we don't use a hardreg for an uninitialized ++ pseudo. See also find_dummy_reload(). */ ++ && (ORIGINAL_REGNO (XEXP (note, 0)) < FIRST_PSEUDO_REGISTER ++ || ! bitmap_bit_p (ENTRY_BLOCK_PTR->global_live_at_end, ++ ORIGINAL_REGNO (XEXP (note, 0)))) + && ! refers_to_regno_for_reload_p (regno, + (regno + + hard_regno_nregs[regno] +@@ -1997,7 +2002,17 @@ + is a subreg, and in that case, out + has a real mode. */ + (GET_MODE (out) != VOIDmode +- ? GET_MODE (out) : outmode))) ++ ? GET_MODE (out) : outmode)) ++ /* But only do all this if we can be sure, that this input ++ operand doesn't correspond with an uninitialized pseudoreg. ++ global can assign some hardreg to it, which is the same as ++ a different pseudo also currently live (as it can ignore the ++ conflict). So we never must introduce writes to such hardregs, ++ as they would clobber the other live pseudo using the same. ++ See also PR20973. */ ++ && (ORIGINAL_REGNO (in) < FIRST_PSEUDO_REGISTER ++ || ! bitmap_bit_p (ENTRY_BLOCK_PTR->global_live_at_end, ++ ORIGINAL_REGNO (in)))) + { + unsigned int regno = REGNO (in) + in_offset; + unsigned int nwords = hard_regno_nregs[regno][inmode]; diff --git a/patches/gcc/4.0.0/pr21173-fix.patch b/patches/gcc/4.0.0/pr21173-fix.patch new file mode 100644 index 00000000..0582d756 --- /dev/null +++ b/patches/gcc/4.0.0/pr21173-fix.patch @@ -0,0 +1,66 @@ +See http://gcc.gnu.org/PR21173 +This is a fix for a last minute brown-bag bug with gcc-4.0.0 + + ------- Additional Comment #24 From CVS Commits 2005-04-25 14:03 [reply] ------- +Subject: Bug 21173 + +CVSROOT: /cvs/gcc +Module name: gcc +Branch: gcc-4_0-branch +Changes by: dberlin@gcc.gnu.org 2005-04-25 14:02:38 + +Modified files: + gcc : ChangeLog tree-ssa-pre.c + +Log message: + 2005-04-25 Daniel Berlin <dberlin@dberlin.org> + + Fix PR tree-optimization/21173 + + * tree-ssa-pre.c (create_expression_by_pieces): Call unshare_expr + on things we pass to force_gimple_operand. Don't try to special + case min_invariants. + +Patches: +http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.192&r2=2.7592.2.193 +http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa-pre.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.65.4.2&r2=2.65.4.3 + +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/tree-ssa-pre.c,v +retrieving revision 2.65.4.2 +retrieving revision 2.65.4.3 +diff -u -r2.65.4.2 -r2.65.4.3 +--- gcc/gcc/tree-ssa-pre.c 2005/04/17 23:40:31 2.65.4.2 ++++ gcc/gcc/tree-ssa-pre.c 2005/04/25 14:02:31 2.65.4.3 +@@ -1330,7 +1330,8 @@ + + folded = fold (build (TREE_CODE (expr), TREE_TYPE (expr), + genop1, genop2)); +- newexpr = force_gimple_operand (folded, &forced_stmts, false, NULL); ++ newexpr = force_gimple_operand (unshare_expr (folded), ++ &forced_stmts, false, NULL); + if (forced_stmts) + { + tsi = tsi_start (forced_stmts); +@@ -1372,14 +1373,8 @@ + add_referenced_tmp_var (temp); + folded = fold (build (TREE_CODE (expr), TREE_TYPE (expr), + genop1)); +- /* If the generated operand is already GIMPLE min_invariant +- just use it instead of calling force_gimple_operand on it, +- since that may make it not invariant by copying it into an +- assignment. */ +- if (!is_gimple_min_invariant (genop1)) +- newexpr = force_gimple_operand (folded, &forced_stmts, false, NULL); +- else +- newexpr = genop1; ++ newexpr = force_gimple_operand (unshare_expr (folded), ++ &forced_stmts, false, NULL); + if (forced_stmts) + { + tsi = tsi_start (forced_stmts); + + 0K . 1.24 MB/s + +13:16:54 (1.24 MB/s) - `-' saved [1303] + diff --git a/patches/gcc/4.0.0/pr21951.patch b/patches/gcc/4.0.0/pr21951.patch new file mode 100644 index 00000000..8c5ffb9d --- /dev/null +++ b/patches/gcc/4.0.0/pr21951.patch @@ -0,0 +1,153 @@ +Workaround for buglet in std::vector etc. when compiling +with gcc-4.0.0 -Wall -O -fno-exceptions +Fixes: + +.../include/c++/4.0.0/bits/vector.tcc: In member function 'void std::vector<_Tp, +_Alloc>::reserve(size_t) [with _Tp = int, _Alloc = std::allocator<int>]': +.../include/c++/4.0.0/bits/vector.tcc:78: warning: control may reach end of +non-void function 'typename _Alloc::pointer std::vector<_Tp, +_Alloc>::_M_allocate_and_copy(size_t, _ForwardIterator, _ForwardIterator) [with +_ForwardIterator = int*, _Tp = int, _Alloc = std::allocator<int>]' being inlined + +See http://gcc.gnu.org/PR21951 + +--- gcc-4.0.1-20050607/libstdc++-v3/include/bits/stl_vector.h.old 2005-06-11 03:58:20.000000000 -0700 ++++ gcc-4.0.1-20050607/libstdc++-v3/include/bits/stl_vector.h 2005-06-11 04:01:21.000000000 -0700 +@@ -765,13 +765,13 @@ + { + std::__uninitialized_copy_a(__first, __last, __result, + this->get_allocator()); +- return __result; + } + catch(...) + { + _M_deallocate(__result, __n); + __throw_exception_again; + } ++ return __result; + } + + +--- gcc-4.0.1-20050607/libstdc++-v3/include/bits/stl_uninitialized.h.old 2005-06-11 03:58:20.000000000 -0700 ++++ gcc-4.0.1-20050607/libstdc++-v3/include/bits/stl_uninitialized.h 2005-06-11 04:05:18.990003248 -0700 +@@ -84,13 +84,13 @@ + { + for (; __first != __last; ++__first, ++__cur) + std::_Construct(&*__cur, *__first); +- return __cur; + } + catch(...) + { + std::_Destroy(__result, __cur); + __throw_exception_again; + } ++ return __cur; + } + + /** +@@ -236,13 +236,13 @@ + { + for (; __first != __last; ++__first, ++__cur) + __alloc.construct(&*__cur, *__first); +- return __cur; + } + catch(...) + { + std::_Destroy(__result, __cur, __alloc); + __throw_exception_again; + } ++ return __cur; + } + + template<typename _InputIterator, typename _ForwardIterator, typename _Tp> +@@ -337,11 +337,13 @@ + { + return std::__uninitialized_copy_a(__first2, __last2, __mid, __alloc); + } ++#ifdef __EXCEPTIONS // work around http://gcc.gnu.org/PR21951 in gcc-4.0 only + catch(...) + { + std::_Destroy(__result, __mid, __alloc); + __throw_exception_again; + } ++#endif + } + + // __uninitialized_fill_copy +@@ -360,11 +362,13 @@ + { + return std::__uninitialized_copy_a(__first, __last, __mid, __alloc); + } ++#ifdef __EXCEPTIONS // work around http://gcc.gnu.org/PR21951 in gcc-4.0 only + catch(...) + { + std::_Destroy(__result, __mid, __alloc); + __throw_exception_again; + } ++#endif + } + + // __uninitialized_copy_fill +--- gcc-4.0.1-20050607/libstdc++-v3/include/ext/rope.old 2005-06-11 03:58:20.000000000 -0700 ++++ gcc-4.0.1-20050607/libstdc++-v3/include/ext/rope 2005-06-11 04:13:26.628870872 -0700 +@@ -1645,11 +1645,13 @@ + _S_cond_store_eos(__buf[__size]); + try + { return _S_new_RopeLeaf(__buf, __size, __a); } ++#ifdef __EXCEPTIONS // work around http://gcc.gnu.org/PR21951 in gcc-4.0 only + catch(...) + { + _RopeRep::__STL_FREE_STRING(__buf, __size, __a); + __throw_exception_again; + } ++#endif + } + + // Concatenation of nonempty strings. +--- gcc-4.0.1-20050607/libstdc++-v3/include/ext/memory.old 2005-06-11 03:58:20.000000000 -0700 ++++ gcc-4.0.1-20050607/libstdc++-v3/include/ext/memory 2005-06-11 04:13:52.897877376 -0700 +@@ -85,11 +85,13 @@ + std::_Construct(&*__cur, *__first); + return pair<_InputIter, _ForwardIter>(__first, __cur); + } ++#ifdef __EXCEPTIONS // work around http://gcc.gnu.org/PR21951 in gcc-4.0 only + catch(...) + { + std::_Destroy(__result, __cur); + __throw_exception_again; + } ++#endif + } + + template<typename _RandomAccessIter, typename _Size, typename _ForwardIter> +@@ -144,11 +146,13 @@ + __alloc.construct(&*__cur, *__first); + return pair<_InputIter, _ForwardIter>(__first, __cur); + } ++#ifdef __EXCEPTIONS // work around http://gcc.gnu.org/PR21951 in gcc-4.0 only + catch(...) + { + std::_Destroy(__result, __cur, __alloc); + __throw_exception_again; + } ++#endif + } + + template<typename _InputIter, typename _Size, typename _ForwardIter, +--- gcc-4.0.1-20050607/libstdc++-v3/include/ext/hashtable.h.old 2005-06-11 03:58:20.000000000 -0700 ++++ gcc-4.0.1-20050607/libstdc++-v3/include/ext/hashtable.h 2005-06-11 04:14:28.384482592 -0700 +@@ -607,13 +607,13 @@ + try + { + this->get_allocator().construct(&__n->_M_val, __obj); +- return __n; + } + catch(...) + { + _M_put_node(__n); + __throw_exception_again; + } ++ return __n; + } + + void diff --git a/patches/gcc/4.0.1/fix-fixincl.patch b/patches/gcc/4.0.1/fix-fixincl.patch new file mode 100644 index 00000000..8051f31c --- /dev/null +++ b/patches/gcc/4.0.1/fix-fixincl.patch @@ -0,0 +1,72 @@ +See http://gcc.gnu.org/PR22541 + +From: Dan Kegel + +When building gcc-3.4.3 or gcc-4.0.[01] into a clean $PREFIX (the only two I've tried like this), +the configure script happily copies the glibc include files from include to sys-include; +here's the line from the log file (with $PREFIX instead of the real prefix): + +Copying $PREFIX/i686-unknown-linux-gnu/include to $PREFIX/i686-unknown-linux-gnu/sys-include + +But later, when running fixincludes, it gives the error message + The directory that should contain system headers does not exist: + $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/../../../../i686-unknown-linux-gnu/sys-include + +Nevertheless, it continues building; the header files it installs in + $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/include +do not include the boilerplate that would cause it to #include_next the +glibc headers in the system header directory. +Thus the resulting toolchain can't compile the following program: +#include <limits.h> +int x = PATH_MAX; +because its limits.h doesn't include the glibc header. + +That's not nice. I suspect the problem is that gcc/Makefile.in assumes that +it can refer to $PREFIX/i686-unknown-linux-gnu with the path + $PREFIX/lib/../i686-unknown-linux-gnu, but +that fails because the directory $PREFIX/lib doesn't exist during 'make all'; +it is only created later, during 'make install'. (Which makes this problem +confusing, since one only notices the breakage well after 'make install', +at which point the path configure complained about does exist, and has the +right stuff in it.) + +A possible fix is to replace the line in gcc/Makefile.in that says + SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@ +with a version that gets rid of extra ..'s, e.g. + SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,,;ta"` +(hey, that's the first time I've ever used a label in a sed script; thanks to the sed faq +for explaining the :a ... ta method of looping to repeat a search-and-replace until it doesn't match.) + +[rediffed against gcc-4.0.0] + +--- gcc-4.0.0/gcc/Makefile.in.orig 2005-04-04 12:45:13.000000000 -0700 ++++ gcc-4.0.0/gcc/Makefile.in 2005-05-20 12:33:43.000000000 -0700 +@@ -378,7 +378,10 @@ + CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ + + # autoconf sets SYSTEM_HEADER_DIR to one of the above. +-SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@ ++# Purge it of unneccessary internal relative paths ++# to directories that might not exist yet. ++# The sed idiom for this is to repeat the search-and-replace until it doesn't match, using :a ... ta. ++SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta` + + # Control whether to run fixproto and fixincludes. + STMP_FIXPROTO = @STMP_FIXPROTO@ +@@ -2838,13 +2841,15 @@ + ../$(build_subdir)/fixincludes/fixincl: ; @ : + + # Build fixed copies of system files. ++# Abort if no system headers available, unless building a crosscompiler. ++# FIXME: abort unless building --without-headers would be more accurate and less ugly + stmp-fixinc: gsyslimits.h macro_list \ + ../$(build_subdir)/fixincludes/fixincl \ + ../$(build_subdir)/fixincludes/fixinc.sh + @if test ! -d ${SYSTEM_HEADER_DIR}; then \ + echo The directory that should contain system headers does not exist: >&2 ; \ + echo " ${SYSTEM_HEADER_DIR}" >&2 ; \ +- if test "x${SYSTEM_HEADER_DIR}" = "x${gcc_tooldir}/sys-include"; \ ++ if test "x${SYSTEM_HEADER_DIR}" = "x`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`"; \ + then sleep 1; else exit 1; fi; \ + fi + rm -rf include; mkdir include diff --git a/patches/gcc/4.0.1/pr20815-fix.patch b/patches/gcc/4.0.1/pr20815-fix.patch new file mode 100644 index 00000000..7ac8ab50 --- /dev/null +++ b/patches/gcc/4.0.1/pr20815-fix.patch @@ -0,0 +1,121 @@ +Date: 18 May 2005 22:47:59 -0000 +Message-ID: <20050518224759.7352.qmail@sourceware.org> +From: "hubicka at ucw dot cz" <gcc-bugzilla@gcc.gnu.org> +To: dank@kegel.com +References: <20050407215701.20815.dank@kegel.com> +Reply-To: gcc-bugzilla@gcc.gnu.org +Subject: [Bug gcov/profile/20815] -fprofile-use barfs with "coverage mismatch for function '...' while reading counter 'arcs'." + + +------- Additional Comments From hubicka at ucw dot cz 2005-05-18 22:47 ------- +Subject: Re: [Bug gcov/profile/20815] -fprofile-use barfs with "coverage mismatch for function '...' while reading counter 'arcs'." + +> +> ------- Additional Comments From hubicka at ucw dot cz 2005-05-18 22:22 ------- +> Subject: Re: [Bug gcov/profile/20815] -fprofile-use barfs with "coverage mismatch for function '...' while reading counter 'arcs'." +> +> coverage_checksum_string already knows a bit about ignoring random seed +> produced mess. It looks like this needs to be extended somehow to +> handle namespaces too... + +This seems to solve the missmatch. Would it be possible to test it on +bigger testcase and if it works distile a testcase that don't use +file IO so it is more suitable for gcc regtesting? + +Index: coverage.c +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/coverage.c,v +retrieving revision 1.6.2.12.2.12 +diff -c -3 -p -r1.6.2.12.2.12 coverage.c +*** gcc-old/gcc/coverage.c 18 May 2005 07:37:31 -0000 1.6.2.12.2.12 +--- gcc/gcc/coverage.c 18 May 2005 22:45:36 -0000 +*************** coverage_checksum_string (unsigned chksu +*** 471,505 **** + as the checksums are used only for sanity checking. */ + for (i = 0; string[i]; i++) + { + if (!strncmp (string + i, "_GLOBAL__", 9)) +! for (i = i + 9; string[i]; i++) +! if (string[i]=='_') +! { +! int y; +! unsigned seed; +! int scan; +! +! for (y = 1; y < 9; y++) +! if (!(string[i + y] >= '0' && string[i + y] <= '9') +! && !(string[i + y] >= 'A' && string[i + y] <= 'F')) +! break; +! if (y != 9 || string[i + 9] != '_') +! continue; +! for (y = 10; y < 18; y++) +! if (!(string[i + y] >= '0' && string[i + y] <= '9') +! && !(string[i + y] >= 'A' && string[i + y] <= 'F')) +! break; +! if (y != 18) +! continue; +! scan = sscanf (string + i + 10, "%X", &seed); +! gcc_assert (scan); +! if (seed != crc32_string (0, flag_random_seed)) +! continue; +! string = dup = xstrdup (string); +! for (y = 10; y < 18; y++) +! dup[i + y] = '0'; +! break; +! } + break; + } + +--- 471,511 ---- + as the checksums are used only for sanity checking. */ + for (i = 0; string[i]; i++) + { ++ int offset = 0; ++ if (!strncmp (string + i, "_GLOBAL__N_", 11)) ++ offset = 11; + if (!strncmp (string + i, "_GLOBAL__", 9)) +! offset = 9; +! +! /* C++ namespaces do have scheme: +! _GLOBAL__N_<filename>_<wrongmagicnumber>_<magicnumber>functionname +! since filename might contain extra underscores there seems +! to be no better chance then walk all possible offsets looking +! for magicnuber. */ +! if (offset) +! for (;string[offset]; offset++) +! for (i = i + offset; string[i]; i++) +! if (string[i]=='_') +! { +! int y; +! +! for (y = 1; y < 9; y++) +! if (!(string[i + y] >= '0' && string[i + y] <= '9') +! && !(string[i + y] >= 'A' && string[i + y] <= 'F')) +! break; +! if (y != 9 || string[i + 9] != '_') +! continue; +! for (y = 10; y < 18; y++) +! if (!(string[i + y] >= '0' && string[i + y] <= '9') +! && !(string[i + y] >= 'A' && string[i + y] <= 'F')) +! break; +! if (y != 18) +! continue; +! if (!dup) +! string = dup = xstrdup (string); +! for (y = 10; y < 18; y++) +! dup[i + y] = '0'; +! } + break; + } + + + +-- + + +http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20815 + +------- You are receiving this mail because: ------- +You reported the bug, or are watching the reporter. + + diff --git a/patches/gcc/4.0.1/pr21951-fix2.patch b/patches/gcc/4.0.1/pr21951-fix2.patch new file mode 100644 index 00000000..5e35a1e9 --- /dev/null +++ b/patches/gcc/4.0.1/pr21951-fix2.patch @@ -0,0 +1,71 @@ +Workaround for buglet in std::vector etc. when compiling +with gcc-4.0.1 -Wall -O -fno-exceptions +Fixes: + +.../include/c++/4.0.0/bits/vector.tcc: In member function 'void std::vector<_Tp, +_Alloc>::reserve(size_t) [with _Tp = int, _Alloc = std::allocator<int>]': +.../include/c++/4.0.0/bits/vector.tcc:78: warning: control may reach end of +non-void function 'typename _Alloc::pointer std::vector<_Tp, +_Alloc>::_M_allocate_and_copy(size_t, _ForwardIterator, _ForwardIterator) [with +_ForwardIterator = int*, _Tp = int, _Alloc = std::allocator<int>]' being inlined + +See http://gcc.gnu.org/PR21951 + +To: gcc-patches at gcc dot gnu dot org +Subject: [4.0.x] may reach end warning in system headers +Message-Id: <20050701183024.E138714C16A9@geoffk5.apple.com> +Date: Fri, 1 Jul 2005 11:30:24 -0700 (PDT) +From: gkeating at apple dot com (Geoffrey Keating) + + +One of our users was getting + +/usr/include/gcc/darwin/4.0/c++/bits/stl_uninitialized.h:113: warning: +control may reach end of non-void function '_ForwardIterator +std::__uninitialized_copy_aux(_InputIterator, _InputIterator, +_ForwardIterator, __false_type) [with _InputIterator = +__gnu_cxx::__normal_iterator<TPoolAllocator::tAllocState*, +std::vector<TPoolAllocator::tAllocState, +std::allocator<TPoolAllocator::tAllocState> > >, _ForwardIterator = +__gnu_cxx::__normal_iterator<TPoolAllocator::tAllocState*, +std::vector<TPoolAllocator::tAllocState, +std::allocator<TPoolAllocator::tAllocState> > >]' being inlined + +which shouldn't be happening, he has no way to change a standard C++ +header. The warning is bogus anyway, but it's fixed in 4.1 through +the CFG changes, which I don't really want to backport to the 4.0 +branch, so instead I'll add this patch. Other warnings generated from +tree-inline.c check for DECL_SYSTEM_HEADER like this. + +Bootstrapped & tested on powerpc-darwin8, I'll commit when the branch +is unfrozen. + +-- +- Geoffrey Keating <geoffk@apple.com> + +===File ~/patches/gcc-40-4121982.patch====================== +Index: ChangeLog +2005-06-28 Geoffrey Keating <geoffk@apple.com> + + * tree-inline.c (expand_call_inline): Prevent 'may reach end' + warning in system headers. + +Index: tree-inline.c +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v +retrieving revision 1.170.8.4 +diff -u -p -u -p -r1.170.8.4 tree-inline.c +--- gcc-4.0.1/gcc/tree-inline.c.old 6 Jun 2005 19:20:32 -0000 1.170.8.4 ++++ gcc-4.0.1/gcc/tree-inline.c 1 Jul 2005 18:27:26 -0000 +@@ -1693,7 +1693,8 @@ expand_call_inline (tree *tp, int *walk_ + && !TREE_NO_WARNING (fn) + && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fn))) + && return_slot_addr == NULL_TREE +- && block_may_fallthru (copy)) ++ && block_may_fallthru (copy) ++ && !DECL_IN_SYSTEM_HEADER (fn)) + { + warning ("control may reach end of non-void function %qD being inlined", + fn); +============================================================ + diff --git a/patches/gcc/4.0.2/fix-fixincl.patch b/patches/gcc/4.0.2/fix-fixincl.patch new file mode 100644 index 00000000..8051f31c --- /dev/null +++ b/patches/gcc/4.0.2/fix-fixincl.patch @@ -0,0 +1,72 @@ +See http://gcc.gnu.org/PR22541 + +From: Dan Kegel + +When building gcc-3.4.3 or gcc-4.0.[01] into a clean $PREFIX (the only two I've tried like this), +the configure script happily copies the glibc include files from include to sys-include; +here's the line from the log file (with $PREFIX instead of the real prefix): + +Copying $PREFIX/i686-unknown-linux-gnu/include to $PREFIX/i686-unknown-linux-gnu/sys-include + +But later, when running fixincludes, it gives the error message + The directory that should contain system headers does not exist: + $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/../../../../i686-unknown-linux-gnu/sys-include + +Nevertheless, it continues building; the header files it installs in + $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/include +do not include the boilerplate that would cause it to #include_next the +glibc headers in the system header directory. +Thus the resulting toolchain can't compile the following program: +#include <limits.h> +int x = PATH_MAX; +because its limits.h doesn't include the glibc header. + +That's not nice. I suspect the problem is that gcc/Makefile.in assumes that +it can refer to $PREFIX/i686-unknown-linux-gnu with the path + $PREFIX/lib/../i686-unknown-linux-gnu, but +that fails because the directory $PREFIX/lib doesn't exist during 'make all'; +it is only created later, during 'make install'. (Which makes this problem +confusing, since one only notices the breakage well after 'make install', +at which point the path configure complained about does exist, and has the +right stuff in it.) + +A possible fix is to replace the line in gcc/Makefile.in that says + SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@ +with a version that gets rid of extra ..'s, e.g. + SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,,;ta"` +(hey, that's the first time I've ever used a label in a sed script; thanks to the sed faq +for explaining the :a ... ta method of looping to repeat a search-and-replace until it doesn't match.) + +[rediffed against gcc-4.0.0] + +--- gcc-4.0.0/gcc/Makefile.in.orig 2005-04-04 12:45:13.000000000 -0700 ++++ gcc-4.0.0/gcc/Makefile.in 2005-05-20 12:33:43.000000000 -0700 +@@ -378,7 +378,10 @@ + CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ + + # autoconf sets SYSTEM_HEADER_DIR to one of the above. +-SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@ ++# Purge it of unneccessary internal relative paths ++# to directories that might not exist yet. ++# The sed idiom for this is to repeat the search-and-replace until it doesn't match, using :a ... ta. ++SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta` + + # Control whether to run fixproto and fixincludes. + STMP_FIXPROTO = @STMP_FIXPROTO@ +@@ -2838,13 +2841,15 @@ + ../$(build_subdir)/fixincludes/fixincl: ; @ : + + # Build fixed copies of system files. ++# Abort if no system headers available, unless building a crosscompiler. ++# FIXME: abort unless building --without-headers would be more accurate and less ugly + stmp-fixinc: gsyslimits.h macro_list \ + ../$(build_subdir)/fixincludes/fixincl \ + ../$(build_subdir)/fixincludes/fixinc.sh + @if test ! -d ${SYSTEM_HEADER_DIR}; then \ + echo The directory that should contain system headers does not exist: >&2 ; \ + echo " ${SYSTEM_HEADER_DIR}" >&2 ; \ +- if test "x${SYSTEM_HEADER_DIR}" = "x${gcc_tooldir}/sys-include"; \ ++ if test "x${SYSTEM_HEADER_DIR}" = "x`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`"; \ + then sleep 1; else exit 1; fi; \ + fi + rm -rf include; mkdir include diff --git a/patches/gcc/4.0.2/pr20815-fix.patch b/patches/gcc/4.0.2/pr20815-fix.patch new file mode 100644 index 00000000..7ac8ab50 --- /dev/null +++ b/patches/gcc/4.0.2/pr20815-fix.patch @@ -0,0 +1,121 @@ +Date: 18 May 2005 22:47:59 -0000 +Message-ID: <20050518224759.7352.qmail@sourceware.org> +From: "hubicka at ucw dot cz" <gcc-bugzilla@gcc.gnu.org> +To: dank@kegel.com +References: <20050407215701.20815.dank@kegel.com> +Reply-To: gcc-bugzilla@gcc.gnu.org +Subject: [Bug gcov/profile/20815] -fprofile-use barfs with "coverage mismatch for function '...' while reading counter 'arcs'." + + +------- Additional Comments From hubicka at ucw dot cz 2005-05-18 22:47 ------- +Subject: Re: [Bug gcov/profile/20815] -fprofile-use barfs with "coverage mismatch for function '...' while reading counter 'arcs'." + +> +> ------- Additional Comments From hubicka at ucw dot cz 2005-05-18 22:22 ------- +> Subject: Re: [Bug gcov/profile/20815] -fprofile-use barfs with "coverage mismatch for function '...' while reading counter 'arcs'." +> +> coverage_checksum_string already knows a bit about ignoring random seed +> produced mess. It looks like this needs to be extended somehow to +> handle namespaces too... + +This seems to solve the missmatch. Would it be possible to test it on +bigger testcase and if it works distile a testcase that don't use +file IO so it is more suitable for gcc regtesting? + +Index: coverage.c +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/coverage.c,v +retrieving revision 1.6.2.12.2.12 +diff -c -3 -p -r1.6.2.12.2.12 coverage.c +*** gcc-old/gcc/coverage.c 18 May 2005 07:37:31 -0000 1.6.2.12.2.12 +--- gcc/gcc/coverage.c 18 May 2005 22:45:36 -0000 +*************** coverage_checksum_string (unsigned chksu +*** 471,505 **** + as the checksums are used only for sanity checking. */ + for (i = 0; string[i]; i++) + { + if (!strncmp (string + i, "_GLOBAL__", 9)) +! for (i = i + 9; string[i]; i++) +! if (string[i]=='_') +! { +! int y; +! unsigned seed; +! int scan; +! +! for (y = 1; y < 9; y++) +! if (!(string[i + y] >= '0' && string[i + y] <= '9') +! && !(string[i + y] >= 'A' && string[i + y] <= 'F')) +! break; +! if (y != 9 || string[i + 9] != '_') +! continue; +! for (y = 10; y < 18; y++) +! if (!(string[i + y] >= '0' && string[i + y] <= '9') +! && !(string[i + y] >= 'A' && string[i + y] <= 'F')) +! break; +! if (y != 18) +! continue; +! scan = sscanf (string + i + 10, "%X", &seed); +! gcc_assert (scan); +! if (seed != crc32_string (0, flag_random_seed)) +! continue; +! string = dup = xstrdup (string); +! for (y = 10; y < 18; y++) +! dup[i + y] = '0'; +! break; +! } + break; + } + +--- 471,511 ---- + as the checksums are used only for sanity checking. */ + for (i = 0; string[i]; i++) + { ++ int offset = 0; ++ if (!strncmp (string + i, "_GLOBAL__N_", 11)) ++ offset = 11; + if (!strncmp (string + i, "_GLOBAL__", 9)) +! offset = 9; +! +! /* C++ namespaces do have scheme: +! _GLOBAL__N_<filename>_<wrongmagicnumber>_<magicnumber>functionname +! since filename might contain extra underscores there seems +! to be no better chance then walk all possible offsets looking +! for magicnuber. */ +! if (offset) +! for (;string[offset]; offset++) +! for (i = i + offset; string[i]; i++) +! if (string[i]=='_') +! { +! int y; +! +! for (y = 1; y < 9; y++) +! if (!(string[i + y] >= '0' && string[i + y] <= '9') +! && !(string[i + y] >= 'A' && string[i + y] <= 'F')) +! break; +! if (y != 9 || string[i + 9] != '_') +! continue; +! for (y = 10; y < 18; y++) +! if (!(string[i + y] >= '0' && string[i + y] <= '9') +! && !(string[i + y] >= 'A' && string[i + y] <= 'F')) +! break; +! if (y != 18) +! continue; +! if (!dup) +! string = dup = xstrdup (string); +! for (y = 10; y < 18; y++) +! dup[i + y] = '0'; +! } + break; + } + + + +-- + + +http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20815 + +------- You are receiving this mail because: ------- +You reported the bug, or are watching the reporter. + + diff --git a/patches/gcc/4.0.2/pr21623-workaround.patch b/patches/gcc/4.0.2/pr21623-workaround.patch new file mode 100644 index 00000000..90453fb3 --- /dev/null +++ b/patches/gcc/4.0.2/pr21623-workaround.patch @@ -0,0 +1,53 @@ +Message-ID: <434576E1.6020305@sscd.de> +Date: Thu, 06 Oct 2005 21:11:29 +0200 +From: Alexander Sieb <sieb@sscd.de> +To: crossgcc@sourceware.org +Subject: Crosstool sh4-linux-gcc-4.0.2-glibc-2.3.5 patches + +Hi, + +attached you find the files I needed to add to crosstool-0.38 +in order to build a sh4-linux gcc-4.0.2-glibc-2.3.5 tool chain. + +Files attached: + +sh4-gcc4.dat: + * gcc4 needs --with-multilib-list=m4,m4-nofpu otherwise a linux + kernel won't build as it uses the -m4-nofpu option. + +gcc-pr21623.patch: + * Kaz Kojima provided a patch [really, a workaround -dank] for http://gcc.gnu.org/PR21623 + +glibc-2.3.5-sh-memset.patch: + * A patch for glibc-2.3.5 which corrects memset. From SUGIOKA Toshinobu. + See content for rationale. + +-- snip -- + +-- Here's patch 1 of 2, plus URLs showing where it is in CVS -- + +[http://gcc.gnu.org/ml/gcc-cvs/2005-10/msg00081.html] + +2005-09-30 Kaz Kojima <kkojima@gcc.gnu.org> + + * config/sh/sh.c (sh_register_move_cost): Add case for moving + from T_REGS to FP register class. + +[http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh.c.diff?cvsroot=gcc&r1=1.347&r2=1.348] + +RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.c,v +retrieving revision 1.347 +retrieving revision 1.348 +diff -u -r1.347 -r1.348 +--- gcc/gcc/config/sh/sh.c 2005/09/05 12:45:22 1.347 ++++ gcc/gcc/config/sh/sh.c 2005/10/03 22:07:08 1.348 +@@ -9491,6 +9491,9 @@ sh_register_move_cost (enum machine_mode + && REGCLASS_HAS_FP_REG (dstclass)) + return 4; + ++ if (REGCLASS_HAS_FP_REG (dstclass) && srcclass == T_REGS) ++ return ((TARGET_HARD_SH4 && !optimize_size) ? 10 : 7); ++ + if ((REGCLASS_HAS_FP_REG (dstclass) && srcclass == MAC_REGS) + || (dstclass == MAC_REGS && REGCLASS_HAS_FP_REG (srcclass))) + return 9; diff --git a/patches/gcc/4.0.3/100-uclibc-conf.patch b/patches/gcc/4.0.3/100-uclibc-conf.patch new file mode 100644 index 00000000..3be7d097 --- /dev/null +++ b/patches/gcc/4.0.3/100-uclibc-conf.patch @@ -0,0 +1,553 @@ +--- gcc-4.0.2/gcc/config/t-linux-uclibc ++++ gcc-4.0.2/gcc/config/t-linux-uclibc +@@ -0,0 +1,5 @@ ++# Remove glibc specific files added in t-linux ++SHLIB_MAPFILES := $(filter-out $(srcdir)/config/libgcc-glibc.ver, $(SHLIB_MAPFILES)) ++ ++# Use unwind-dw2-fde instead of unwind-dw2-fde-glibc ++LIB2ADDEH := $(subst unwind-dw2-fde-glibc.c,unwind-dw2-fde.c,$(LIB2ADDEH)) +--- gcc-4.0.2/gcc/config.gcc ++++ gcc-4.0.2/gcc/config.gcc +@@ -1778,7 +1778,7 @@ + ;; + sh-*-elf* | sh[12346l]*-*-elf* | sh*-*-kaos* | \ + sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \ +- sh-*-linux* | sh[346lbe]*-*-linux* | \ ++ sh*-*-linux* | sh[346lbe]*-*-linux* | \ + sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \ + sh64-*-netbsd* | sh64l*-*-netbsd*) + tmake_file="${tmake_file} sh/t-sh sh/t-elf" +@@ -2234,10 +2234,16 @@ + *) + echo "*** Configuration ${target} not supported" 1>&2 + exit 1 + ;; + esac ++ ++# Rather than hook into each target, just do it after all the linux ++# targets have been processed ++case ${target} in ++*-linux-uclibc*) tm_defines="${tm_defines} USE_UCLIBC" ; tmake_file="${tmake_file} t-linux-uclibc" ++esac + + case ${target} in + i[34567]86-*-linux*aout* | i[34567]86-*-linux*libc1) + tmake_file="${tmake_file} i386/t-gmm_malloc" + ;; +--- gcc-4.0.2/gcc/config/alpha/linux-elf.h ++++ gcc-4.0.2/gcc/config/alpha/linux-elf.h +@@ -27,7 +27,11 @@ + #define SUBTARGET_EXTRA_SPECS \ + { "elf_dynamic_linker", ELF_DYNAMIC_LINKER }, + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else + #define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + + #define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \ + %{O*:-O3} %{!O*:-O1} \ +--- gcc-4.0.2/gcc/config/arm/linux-elf.h ++++ gcc-4.0.2/gcc/config/arm/linux-elf.h +@@ -81,14 +81,19 @@ + #define ENDFILE_SPEC \ + "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "%{h*} %{version:-v} \ + %{b} %{Wl,*:%*} \ + %{static:-Bstatic} \ + %{shared:-shared} \ + %{symbolic:-Bsymbolic} \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "} \ + -X \ + %{mbig-endian:-EB}" \ + SUBTARGET_EXTRA_LINK_SPEC +--- gcc-4.0.2/gcc/config/cris/linux.h ++++ gcc-4.0.2/gcc/config/cris/linux.h +@@ -79,6 +79,25 @@ + #undef CRIS_DEFAULT_CPU_VERSION + #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG + ++#ifdef USE_UCLIBC ++ ++#undef CRIS_SUBTARGET_VERSION ++#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc" ++ ++#undef CRIS_LINK_SUBTARGET_SPEC ++#define CRIS_LINK_SUBTARGET_SPEC \ ++ "-mcrislinux\ ++ -rpath-link include/asm/../..%s\ ++ %{shared} %{static}\ ++ %{symbolic:-Bdynamic} %{shlib:-Bdynamic} %{static:-Bstatic}\ ++ %{!shared: \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} \ ++ %{!r:%{O2|O3: --gc-sections}}" ++ ++#else /* USE_UCLIBC */ ++ + #undef CRIS_SUBTARGET_VERSION + #define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu" + +@@ -93,6 +112,8 @@ + %{!shared:%{!static:%{rdynamic:-export-dynamic}}}\ + %{!r:%{O2|O3: --gc-sections}}" + ++#endif /* USE_UCLIBC */ ++ + + /* Node: Run-time Target */ + +--- gcc-4.0.2/gcc/config/i386/linux.h ++++ gcc-4.0.2/gcc/config/i386/linux.h +@@ -107,6 +107,11 @@ + #define LINK_EMULATION "elf_i386" + #define DYNAMIC_LINKER "/lib/ld-linux.so.2" + ++#ifdef USE_UCLIBC ++#undef DYNAMIC_LINKER ++#define DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#endif ++ + #undef SUBTARGET_EXTRA_SPECS + #define SUBTARGET_EXTRA_SPECS \ + { "link_emulation", LINK_EMULATION },\ +--- gcc-4.0.2/gcc/config/i386/linux64.h ++++ gcc-4.0.2/gcc/config/i386/linux64.h +@@ -54,14 +54,21 @@ + When the -shared link option is used a final link is not being + done. */ + ++#ifdef USE_UCLIBC ++#define ELF32_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0" ++#else ++#define ELF32_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#define ELF64_DYNAMIC_LINKER "/lib64/ld-linux-x86-64.so.2" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \ + %{shared:-shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ +- %{!m32:%{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}}} \ ++ %{m32:%{!dynamic-linker:-dynamic-linker " ELF32_DYNAMIC_LINKER "}} \ ++ %{!m32:%{!dynamic-linker:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}} \ + %{static:-static}}" + + #define MULTILIB_DEFAULTS { "m64" } +--- gcc-4.0.2/gcc/config/ia64/linux.h ++++ gcc-4.0.2/gcc/config/ia64/linux.h +@@ -37,13 +37,18 @@ + /* Define this for shared library support because it isn't in the main + linux.h file. */ + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "\ + %{shared:-shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux-ia64.so.2}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}" + + +--- gcc-4.0.2/gcc/config/m68k/linux.h ++++ gcc-4.0.2/gcc/config/m68k/linux.h +@@ -127,12 +127,17 @@ + + /* If ELF is the default format, we should not use /lib/elf. */ + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld.so.1" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "-m m68kelf %{shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker*:-dynamic-linker /lib/ld.so.1}} \ ++ %{!dynamic-linker*:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static}}" + + /* For compatibility with linux/a.out */ +--- gcc-4.0.2/gcc/config/mips/linux.h ++++ gcc-4.0.2/gcc/config/mips/linux.h +@@ -108,14 +108,19 @@ + + /* Borrowed from sparc/linux.h */ + #undef LINK_SPEC ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld.so.1" ++#endif + #define LINK_SPEC \ + "%(endian_spec) \ + %{shared:-shared} \ + %{!shared: \ + %{!ibcs: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}}" + + #undef SUBTARGET_ASM_SPEC +--- gcc-4.0.2/gcc/config/pa/pa-linux.h ++++ gcc-4.0.2/gcc/config/pa/pa-linux.h +@@ -82,13 +82,18 @@ + /* Define this for shared library support because it isn't in the main + linux.h file. */ + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld.so.1" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "\ + %{shared:-shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}" + + /* glibc's profiling functions don't need gcc to allocate counters. */ +--- gcc-4.0.2/gcc/config/rs6000/linux.h ++++ gcc-4.0.2/gcc/config/rs6000/linux.h +@@ -69,7 +69,11 @@ + #define LINK_START_DEFAULT_SPEC "%(link_start_linux)" + + #undef LINK_OS_DEFAULT_SPEC ++#ifdef USE_UCLIBC ++#define LINK_OS_DEFAULT_SPEC "%(link_os_linux_uclibc)" ++#else + #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)" ++#endif + + #define LINK_GCC_C_SEQUENCE_SPEC \ + "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" +--- gcc-4.0.2/gcc/config/rs6000/sysv4.h ++++ gcc-4.0.2/gcc/config/rs6000/sysv4.h +@@ -949,6 +949,7 @@ + mcall-linux : %(link_os_linux) ; \ + mcall-gnu : %(link_os_gnu) ; \ + mcall-netbsd : %(link_os_netbsd) ; \ ++ mcall-linux-uclibc : %(link_os_linux_uclibc); \ + mcall-openbsd: %(link_os_openbsd) ; \ + : %(link_os_default) }" + +@@ -1127,6 +1128,10 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}" + ++#define LINK_OS_LINUX_UCLIBC_SPEC "-m elf32ppclinux %{!shared: %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}}" ++ + #if defined(HAVE_LD_EH_FRAME_HDR) + # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " + #endif +@@ -1293,6 +1298,7 @@ + { "link_os_sim", LINK_OS_SIM_SPEC }, \ + { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \ + { "link_os_linux", LINK_OS_LINUX_SPEC }, \ ++ { "link_os_linux_uclibc", LINK_OS_LINUX_UCLIBC_SPEC }, \ + { "link_os_gnu", LINK_OS_GNU_SPEC }, \ + { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \ + { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \ +--- gcc-4.0.2/gcc/config/s390/linux.h ++++ gcc-4.0.2/gcc/config/s390/linux.h +@@ -77,6 +77,13 @@ + #define MULTILIB_DEFAULTS { "m31" } + #endif + ++#ifdef USE_UCLIBC ++#define ELF31_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0" ++#else ++#define ELF31_DYNAMIC_LINKER "/lib/ld.so.1" ++#define ELF64_DYNAMIC_LINKER "/lib/ld64.so.1" ++#endif + #undef LINK_SPEC + #define LINK_SPEC \ + "%{m31:-m elf_s390}%{m64:-m elf64_s390} \ +@@ -86,8 +93,8 @@ + %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker: \ +- %{m31:-dynamic-linker /lib/ld.so.1} \ +- %{m64:-dynamic-linker /lib/ld64.so.1}}}}" ++ %{m31:-dynamic-linker " ELF31_DYNAMIC_LINKER "} \ ++ %{m64:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}}}" + + + #define TARGET_ASM_FILE_END file_end_indicate_exec_stack +--- gcc-4.0.2/gcc/config/sh/linux.h ++++ gcc-4.0.2/gcc/config/sh/linux.h +@@ -67,11 +67,16 @@ + #undef SUBTARGET_LINK_EMUL_SUFFIX + #define SUBTARGET_LINK_EMUL_SUFFIX "_linux" + #undef SUBTARGET_LINK_SPEC ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + #define SUBTARGET_LINK_SPEC \ + "%{shared:-shared} \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}" + + #undef LIB_SPEC +--- gcc-4.0.2/gcc/config/sparc/linux.h ++++ gcc-4.0.2/gcc/config/sparc/linux.h +@@ -130,14 +130,19 @@ + + /* If ELF is the default format, we should not use /lib/elf. */ + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ + %{!mno-relax:%{!r:-relax}} \ + %{!shared: \ + %{!ibcs: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}}" + + /* The sun bundled assembler doesn't accept -Yd, (and neither does gas). +--- gcc-4.0.2/gcc/config/sparc/linux64.h ++++ gcc-4.0.2/gcc/config/sparc/linux64.h +@@ -167,12 +166,17 @@ + { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \ + { "link_arch", LINK_ARCH_SPEC }, + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + #define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ + %{!shared: \ + %{!ibcs: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}} \ + " + +--- gcc-4.0.2/libtool.m4 ++++ gcc-4.0.2/libtool.m4 +@@ -682,6 +682,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'] +--- gcc-4.0.2/ltconfig ++++ gcc-4.0.2/ltconfig +@@ -603,6 +603,7 @@ + + # Transform linux* to *-*-linux-gnu*, to support old configure scripts. + case $host_os in ++linux-uclibc*) ;; + linux-gnu*) ;; + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` + esac +@@ -1274,6 +1275,23 @@ + dynamic_linker='GNU/Linux ld.so' + ;; + ++linux-uclibc*) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' ++ soname_spec='${libname}${release}.so$major' ++ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=no ++ # This implies no fast_install, which is unacceptable. ++ # Some rework will be needed to allow for fast_install ++ # before this can be enabled. ++ hardcode_into_libs=yes ++ # Assume using the uClibc dynamic linker. ++ dynamic_linker="uClibc ld.so" ++ ;; ++ + netbsd*) + need_lib_prefix=no + need_version=no +--- gcc-4.0.2/libffi/configure ++++ gcc-4.0.2/libffi/configure +@@ -3457,6 +3457,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.0.2/libgfortran/configure ++++ gcc-4.0.2/libgfortran/configure +@@ -3681,6 +3681,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.0.2/libjava/configure ++++ gcc-4.0.2/libjava/configure +@@ -4351,6 +4351,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.0.2/libmudflap/configure ++++ gcc-4.0.2/libmudflap/configure +@@ -5380,6 +5380,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.0.2/libobjc/configure ++++ gcc-4.0.2/libobjc/configure +@@ -3283,6 +3283,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.0.2/boehm-gc/configure ++++ gcc-4.0.2/boehm-gc/configure +@@ -4320,6 +4320,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.0.2/configure ++++ gcc-4.0.2/configure +@@ -1141,7 +1141,7 @@ + ;; + "") + case "${target}" in +- *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu) ++ *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*) + # Enable libmudflap by default in GNU and friends. + ;; + *-*-freebsd*) +--- gcc-4.0.2/configure.in ++++ gcc-4.0.2/configure.in +@@ -350,7 +350,7 @@ + ;; + "") + case "${target}" in +- *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu) ++ *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*) + # Enable libmudflap by default in GNU and friends. + ;; + *-*-freebsd*) +--- gcc-4.0.2/contrib/regression/objs-gcc.sh ++++ gcc-4.0.2/contrib/regression/objs-gcc.sh +@@ -105,6 +105,10 @@ + then + make all-gdb all-dejagnu all-ld || exit 1 + make install-gdb install-dejagnu install-ld || exit 1 ++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ] ++ then ++ make all-gdb all-dejagnu all-ld || exit 1 ++ make install-gdb install-dejagnu install-ld || exit 1 + elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then + make bootstrap || exit 1 + make install || exit 1 +--- gcc-4.0.2/zlib/configure ++++ gcc-4.0.2/zlib/configure +@@ -3426,6 +3426,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' diff --git a/patches/gcc/4.0.3/200-uclibc-locale.patch b/patches/gcc/4.0.3/200-uclibc-locale.patch new file mode 100644 index 00000000..ac4cf972 --- /dev/null +++ b/patches/gcc/4.0.3/200-uclibc-locale.patch @@ -0,0 +1,3237 @@ +diff -urN gcc-4.0.0-100/libstdc++-v3/acinclude.m4 gcc-4.0.0/libstdc++-v3/acinclude.m4 +--- gcc-4.0.0-100/libstdc++-v3/acinclude.m4 2005-04-30 13:06:53.000000000 -0500 ++++ gcc-4.0.0/libstdc++-v3/acinclude.m4 2005-04-28 20:19:01.000000000 -0500 +@@ -1104,7 +1104,7 @@ + AC_MSG_CHECKING([for C locale to use]) + GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], + [use MODEL for target locale package], +- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto]) ++ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto]) + + # If they didn't use this option switch, or if they specified --enable + # with no specific model, we'll have to look for one. If they +@@ -1120,6 +1120,9 @@ + # Default to "generic". + if test $enable_clocale_flag = auto; then + case ${target_os} in ++ *-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) + AC_EGREP_CPP([_GLIBCXX_ok], [ + #include <features.h> +@@ -1263,6 +1266,40 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ AC_MSG_RESULT(uclibc) ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ AC_SUBST(glibcxx_MOFILES) ++ AC_SUBST(glibcxx_POFILES) ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,59 @@ ++// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*- ++ ++// Copyright (C) 2002, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// Written by Jakub Jelinek <jakub@redhat.com> ++ ++#include <clocale> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning clean this up ++#endif ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ ++extern "C" __typeof(iswctype_l) __iswctype_l; ++extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l; ++extern "C" __typeof(strcoll_l) __strcoll_l; ++extern "C" __typeof(strftime_l) __strftime_l; ++extern "C" __typeof(strtod_l) __strtod_l; ++extern "C" __typeof(strtof_l) __strtof_l; ++extern "C" __typeof(strtold_l) __strtold_l; ++extern "C" __typeof(strxfrm_l) __strxfrm_l; ++extern "C" __typeof(towlower_l) __towlower_l; ++extern "C" __typeof(towupper_l) __towupper_l; ++extern "C" __typeof(wcscoll_l) __wcscoll_l; ++extern "C" __typeof(wcsftime_l) __wcsftime_l; ++extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l; ++extern "C" __typeof(wctype_l) __wctype_l; ++extern "C" __typeof(newlocale) __newlocale; ++extern "C" __typeof(freelocale) __freelocale; ++extern "C" __typeof(duplocale) __duplocale; ++extern "C" __typeof(uselocale) __uselocale; ++ ++#endif // GLIBC 2.3 and later +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,160 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <cerrno> // For errno ++#include <locale> ++#include <stdexcept> ++#include <langinfo.h> ++#include <bits/c++locale_internal.h> ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __strtol_l(S, E, B, L) strtol((S), (E), (B)) ++#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B)) ++#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B)) ++#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B)) ++#define __strtof_l(S, E, L) strtof((S), (E)) ++#define __strtod_l(S, E, L) strtod((S), (E)) ++#define __strtold_l(S, E, L) strtold((S), (E)) ++#warning should dummy __newlocale check for C|POSIX ? ++#define __newlocale(a, b, c) NULL ++#define __freelocale(a) ((void)0) ++#define __duplocale(a) __c_locale() ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ float __f = __strtof_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __f; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ double __d = __strtod_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __d; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ long double __ld = __strtold_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __ld; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ void ++ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, ++ __c_locale __old) ++ { ++ __cloc = __newlocale(1 << LC_ALL, __s, __old); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ if (!__cloc) ++ { ++ // This named locale is not supported by the underlying OS. ++ __throw_runtime_error(__N("locale::facet::_S_create_c_locale " ++ "name not valid")); ++ } ++#endif ++ } ++ ++ void ++ locale::facet::_S_destroy_c_locale(__c_locale& __cloc) ++ { ++ if (_S_get_c_locale() != __cloc) ++ __freelocale(__cloc); ++ } ++ ++ __c_locale ++ locale::facet::_S_clone_c_locale(__c_locale& __cloc) ++ { return __duplocale(__cloc); } ++} // namespace std ++ ++namespace __gnu_cxx ++{ ++ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] = ++ { ++ "LC_CTYPE", ++ "LC_NUMERIC", ++ "LC_TIME", ++ "LC_COLLATE", ++ "LC_MONETARY", ++ "LC_MESSAGES", ++#if _GLIBCXX_NUM_CATEGORIES != 0 ++ "LC_PAPER", ++ "LC_NAME", ++ "LC_ADDRESS", ++ "LC_TELEPHONE", ++ "LC_MEASUREMENT", ++ "LC_IDENTIFICATION" ++#endif ++ }; ++} ++ ++namespace std ++{ ++ const char* const* const locale::_S_categories = __gnu_cxx::category_names; ++} // namespace std +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.h 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,115 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#ifndef _C_LOCALE_H ++#define _C_LOCALE_H 1 ++ ++#pragma GCC system_header ++ ++#include <cstring> // get std::strlen ++#include <cstdio> // get std::snprintf or std::sprintf ++#include <clocale> ++#include <langinfo.h> // For codecvt ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC_HAS_LOCALE__ ++#include <iconv.h> // For codecvt using iconv, iconv_t ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#include <libintl.h> // For messages ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning what is _GLIBCXX_C_LOCALE_GNU for ++#endif ++#define _GLIBCXX_C_LOCALE_GNU 1 ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix categories ++#endif ++// #define _GLIBCXX_NUM_CATEGORIES 6 ++#define _GLIBCXX_NUM_CATEGORIES 0 ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++namespace __gnu_cxx ++{ ++ extern "C" __typeof(uselocale) __uselocale; ++} ++#endif ++ ++namespace std ++{ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ typedef __locale_t __c_locale; ++#else ++ typedef int* __c_locale; ++#endif ++ ++ // Convert numeric value of type _Tv to string and return length of ++ // string. If snprintf is available use it, otherwise fall back to ++ // the unsafe sprintf which, in general, can be dangerous and should ++ // be avoided. ++ template<typename _Tv> ++ int ++ __convert_from_v(char* __out, const int __size, const char* __fmt, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ _Tv __v, const __c_locale& __cloc, int __prec) ++ { ++ __c_locale __old = __gnu_cxx::__uselocale(__cloc); ++#else ++ _Tv __v, const __c_locale&, int __prec) ++ { ++# ifdef __UCLIBC_HAS_LOCALE__ ++ char* __old = std::setlocale(LC_ALL, NULL); ++ char* __sav = new char[std::strlen(__old) + 1]; ++ std::strcpy(__sav, __old); ++ std::setlocale(LC_ALL, "C"); ++# endif ++#endif ++ ++ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __gnu_cxx::__uselocale(__old); ++#elif defined __UCLIBC_HAS_LOCALE__ ++ std::setlocale(LC_ALL, __sav); ++ delete [] __sav; ++#endif ++ return __ret; ++ } ++} ++ ++#endif +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,306 @@ ++// std::codecvt implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.5 - Template class codecvt ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++namespace std ++{ ++ // Specializations. ++#ifdef _GLIBCXX_USE_WCHAR_T ++ codecvt_base::result ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_out(state_type& __state, const intern_type* __from, ++ const intern_type* __from_end, const intern_type*& __from_next, ++ extern_type* __to, extern_type* __to_end, ++ extern_type*& __to_next) const ++ { ++ result __ret = ok; ++ state_type __tmp_state(__state); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ ++ // wcsnrtombs is *very* fast but stops if encounters NUL characters: ++ // in case we fall back to wcrtomb and then continue, in a loop. ++ // NB: wcsnrtombs is a GNU extension ++ for (__from_next = __from, __to_next = __to; ++ __from_next < __from_end && __to_next < __to_end ++ && __ret == ok;) ++ { ++ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0', ++ __from_end - __from_next); ++ if (!__from_chunk_end) ++ __from_chunk_end = __from_end; ++ ++ __from = __from_next; ++ const size_t __conv = wcsnrtombs(__to_next, &__from_next, ++ __from_chunk_end - __from_next, ++ __to_end - __to_next, &__state); ++ if (__conv == static_cast<size_t>(-1)) ++ { ++ // In case of error, in order to stop at the exact place we ++ // have to start again from the beginning with a series of ++ // wcrtomb. ++ for (; __from < __from_next; ++__from) ++ __to_next += wcrtomb(__to_next, *__from, &__tmp_state); ++ __state = __tmp_state; ++ __ret = error; ++ } ++ else if (__from_next && __from_next < __from_chunk_end) ++ { ++ __to_next += __conv; ++ __ret = partial; ++ } ++ else ++ { ++ __from_next = __from_chunk_end; ++ __to_next += __conv; ++ } ++ ++ if (__from_next < __from_end && __ret == ok) ++ { ++ extern_type __buf[MB_LEN_MAX]; ++ __tmp_state = __state; ++ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state); ++ if (__conv > static_cast<size_t>(__to_end - __to_next)) ++ __ret = partial; ++ else ++ { ++ memcpy(__to_next, __buf, __conv); ++ __state = __tmp_state; ++ __to_next += __conv; ++ ++__from_next; ++ } ++ } ++ } ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ return __ret; ++ } ++ ++ codecvt_base::result ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_in(state_type& __state, const extern_type* __from, ++ const extern_type* __from_end, const extern_type*& __from_next, ++ intern_type* __to, intern_type* __to_end, ++ intern_type*& __to_next) const ++ { ++ result __ret = ok; ++ state_type __tmp_state(__state); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ ++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters: ++ // in case we store a L'\0' and then continue, in a loop. ++ // NB: mbsnrtowcs is a GNU extension ++ for (__from_next = __from, __to_next = __to; ++ __from_next < __from_end && __to_next < __to_end ++ && __ret == ok;) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0', ++ __from_end ++ - __from_next)); ++ if (!__from_chunk_end) ++ __from_chunk_end = __from_end; ++ ++ __from = __from_next; ++ size_t __conv = mbsnrtowcs(__to_next, &__from_next, ++ __from_chunk_end - __from_next, ++ __to_end - __to_next, &__state); ++ if (__conv == static_cast<size_t>(-1)) ++ { ++ // In case of error, in order to stop at the exact place we ++ // have to start again from the beginning with a series of ++ // mbrtowc. ++ for (;; ++__to_next, __from += __conv) ++ { ++ __conv = mbrtowc(__to_next, __from, __from_end - __from, ++ &__tmp_state); ++ if (__conv == static_cast<size_t>(-1) ++ || __conv == static_cast<size_t>(-2)) ++ break; ++ } ++ __from_next = __from; ++ __state = __tmp_state; ++ __ret = error; ++ } ++ else if (__from_next && __from_next < __from_chunk_end) ++ { ++ // It is unclear what to return in this case (see DR 382). ++ __to_next += __conv; ++ __ret = partial; ++ } ++ else ++ { ++ __from_next = __from_chunk_end; ++ __to_next += __conv; ++ } ++ ++ if (__from_next < __from_end && __ret == ok) ++ { ++ if (__to_next < __to_end) ++ { ++ // XXX Probably wrong for stateful encodings ++ __tmp_state = __state; ++ ++__from_next; ++ *__to_next++ = L'\0'; ++ } ++ else ++ __ret = partial; ++ } ++ } ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ return __ret; ++ } ++ ++ int ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_encoding() const throw() ++ { ++ // XXX This implementation assumes that the encoding is ++ // stateless and is either single-byte or variable-width. ++ int __ret = 0; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ if (MB_CUR_MAX == 1) ++ __ret = 1; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __ret; ++ } ++ ++ int ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_max_length() const throw() ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ // XXX Probably wrong for stateful encodings. ++ int __ret = MB_CUR_MAX; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __ret; ++ } ++ ++ int ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_length(state_type& __state, const extern_type* __from, ++ const extern_type* __end, size_t __max) const ++ { ++ int __ret = 0; ++ state_type __tmp_state(__state); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ ++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters: ++ // in case we advance past it and then continue, in a loop. ++ // NB: mbsnrtowcs is a GNU extension ++ ++ // A dummy internal buffer is needed in order for mbsnrtocws to consider ++ // its fourth parameter (it wouldn't with NULL as first parameter). ++ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t) ++ * __max)); ++ while (__from < __end && __max) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0', ++ __end ++ - __from)); ++ if (!__from_chunk_end) ++ __from_chunk_end = __end; ++ ++ const extern_type* __tmp_from = __from; ++ size_t __conv = mbsnrtowcs(__to, &__from, ++ __from_chunk_end - __from, ++ __max, &__state); ++ if (__conv == static_cast<size_t>(-1)) ++ { ++ // In case of error, in order to stop at the exact place we ++ // have to start again from the beginning with a series of ++ // mbrtowc. ++ for (__from = __tmp_from;; __from += __conv) ++ { ++ __conv = mbrtowc(NULL, __from, __end - __from, ++ &__tmp_state); ++ if (__conv == static_cast<size_t>(-1) ++ || __conv == static_cast<size_t>(-2)) ++ break; ++ } ++ __state = __tmp_state; ++ __ret += __from - __tmp_from; ++ break; ++ } ++ if (!__from) ++ __from = __from_chunk_end; ++ ++ __ret += __from - __tmp_from; ++ __max -= __conv; ++ ++ if (__from < __end && __max) ++ { ++ // XXX Probably wrong for stateful encodings ++ __tmp_state = __state; ++ ++__from; ++ ++__ret; ++ --__max; ++ } ++ } ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ return __ret; ++ } ++#endif ++} +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/collate_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/collate_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,80 @@ ++// std::collate implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.4.1.2 collate virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __strcoll_l(S1, S2, L) strcoll((S1), (S2)) ++#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N)) ++#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2)) ++#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N)) ++#endif ++ ++namespace std ++{ ++ // These are basically extensions to char_traits, and perhaps should ++ // be put there instead of here. ++ template<> ++ int ++ collate<char>::_M_compare(const char* __one, const char* __two) const ++ { ++ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate); ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); ++ } ++ ++ template<> ++ size_t ++ collate<char>::_M_transform(char* __to, const char* __from, ++ size_t __n) const ++ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ int ++ collate<wchar_t>::_M_compare(const wchar_t* __one, ++ const wchar_t* __two) const ++ { ++ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate); ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); ++ } ++ ++ template<> ++ size_t ++ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from, ++ size_t __n) const ++ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); } ++#endif ++} +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,300 @@ ++// std::ctype implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions. ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#define _LIBC ++#include <locale> ++#undef _LIBC ++#include <bits/c++locale_internal.h> ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __wctype_l(S, L) wctype((S)) ++#define __towupper_l(C, L) towupper((C)) ++#define __towlower_l(C, L) towlower((C)) ++#define __iswctype_l(C, M, L) iswctype((C), (M)) ++#endif ++ ++namespace std ++{ ++ // NB: The other ctype<char> specializations are in src/locale.cc and ++ // various /config/os/* files. ++ template<> ++ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs) ++ : ctype<char>(0, false, __refs) ++ { ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ++ { ++ this->_S_destroy_c_locale(this->_M_c_locale_ctype); ++ this->_S_create_c_locale(this->_M_c_locale_ctype, __s); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper; ++ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower; ++ this->_M_table = this->_M_c_locale_ctype->__ctype_b; ++#endif ++ } ++ } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ ctype<wchar_t>::__wmask_type ++ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const ++ { ++ __wmask_type __ret; ++ switch (__m) ++ { ++ case space: ++ __ret = __wctype_l("space", _M_c_locale_ctype); ++ break; ++ case print: ++ __ret = __wctype_l("print", _M_c_locale_ctype); ++ break; ++ case cntrl: ++ __ret = __wctype_l("cntrl", _M_c_locale_ctype); ++ break; ++ case upper: ++ __ret = __wctype_l("upper", _M_c_locale_ctype); ++ break; ++ case lower: ++ __ret = __wctype_l("lower", _M_c_locale_ctype); ++ break; ++ case alpha: ++ __ret = __wctype_l("alpha", _M_c_locale_ctype); ++ break; ++ case digit: ++ __ret = __wctype_l("digit", _M_c_locale_ctype); ++ break; ++ case punct: ++ __ret = __wctype_l("punct", _M_c_locale_ctype); ++ break; ++ case xdigit: ++ __ret = __wctype_l("xdigit", _M_c_locale_ctype); ++ break; ++ case alnum: ++ __ret = __wctype_l("alnum", _M_c_locale_ctype); ++ break; ++ case graph: ++ __ret = __wctype_l("graph", _M_c_locale_ctype); ++ break; ++ default: ++ __ret = __wmask_type(); ++ } ++ return __ret; ++ } ++ ++ wchar_t ++ ctype<wchar_t>::do_toupper(wchar_t __c) const ++ { return __towupper_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const ++ { ++ while (__lo < __hi) ++ { ++ *__lo = __towupper_l(*__lo, _M_c_locale_ctype); ++ ++__lo; ++ } ++ return __hi; ++ } ++ ++ wchar_t ++ ctype<wchar_t>::do_tolower(wchar_t __c) const ++ { return __towlower_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const ++ { ++ while (__lo < __hi) ++ { ++ *__lo = __towlower_l(*__lo, _M_c_locale_ctype); ++ ++__lo; ++ } ++ return __hi; ++ } ++ ++ bool ++ ctype<wchar_t>:: ++ do_is(mask __m, wchar_t __c) const ++ { ++ // Highest bitmask in ctype_base == 10, but extra in "C" ++ // library for blank. ++ bool __ret = false; ++ const size_t __bitmasksize = 11; ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) ++ if (__m & _M_bit[__bitcur] ++ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype)) ++ { ++ __ret = true; ++ break; ++ } ++ return __ret; ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const ++ { ++ for (; __lo < __hi; ++__vec, ++__lo) ++ { ++ // Highest bitmask in ctype_base == 10, but extra in "C" ++ // library for blank. ++ const size_t __bitmasksize = 11; ++ mask __m = 0; ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) ++ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype)) ++ __m |= _M_bit[__bitcur]; ++ *__vec = __m; ++ } ++ return __hi; ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const ++ { ++ while (__lo < __hi && !this->do_is(__m, *__lo)) ++ ++__lo; ++ return __lo; ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const ++ { ++ while (__lo < __hi && this->do_is(__m, *__lo) != 0) ++ ++__lo; ++ return __lo; ++ } ++ ++ wchar_t ++ ctype<wchar_t>:: ++ do_widen(char __c) const ++ { return _M_widen[static_cast<unsigned char>(__c)]; } ++ ++ const char* ++ ctype<wchar_t>:: ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const ++ { ++ while (__lo < __hi) ++ { ++ *__dest = _M_widen[static_cast<unsigned char>(*__lo)]; ++ ++__lo; ++ ++__dest; ++ } ++ return __hi; ++ } ++ ++ char ++ ctype<wchar_t>:: ++ do_narrow(wchar_t __wc, char __dfault) const ++ { ++ if (__wc >= 0 && __wc < 128 && _M_narrow_ok) ++ return _M_narrow[__wc]; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_ctype); ++#endif ++ const int __c = wctob(__wc); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return (__c == EOF ? __dfault : static_cast<char>(__c)); ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault, ++ char* __dest) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_ctype); ++#endif ++ if (_M_narrow_ok) ++ while (__lo < __hi) ++ { ++ if (*__lo >= 0 && *__lo < 128) ++ *__dest = _M_narrow[*__lo]; ++ else ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c)); ++ } ++ ++__lo; ++ ++__dest; ++ } ++ else ++ while (__lo < __hi) ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c)); ++ ++__lo; ++ ++__dest; ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __hi; ++ } ++ ++ void ++ ctype<wchar_t>::_M_initialize_ctype() ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_ctype); ++#endif ++ wint_t __i; ++ for (__i = 0; __i < 128; ++__i) ++ { ++ const int __c = wctob(__i); ++ if (__c == EOF) ++ break; ++ else ++ _M_narrow[__i] = static_cast<char>(__c); ++ } ++ if (__i == 128) ++ _M_narrow_ok = true; ++ else ++ _M_narrow_ok = false; ++ for (size_t __j = 0; ++ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j) ++ _M_widen[__j] = btowc(__j); ++ ++ for (size_t __k = 0; __k <= 11; ++__k) ++ { ++ _M_bit[__k] = static_cast<mask>(_ISbit(__k)); ++ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]); ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ } ++#endif // _GLIBCXX_USE_WCHAR_T ++} +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,100 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix gettext stuff ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++extern "C" char *__dcgettext(const char *domainname, ++ const char *msgid, int category); ++#undef gettext ++#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES) ++#else ++#undef gettext ++#define gettext(msgid) (msgid) ++#endif ++ ++namespace std ++{ ++ // Specializations. ++ template<> ++ string ++ messages<char>::do_get(catalog, int, int, const string& __dfault) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_messages); ++ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str())); ++ __uselocale(__old); ++ return string(__msg); ++#elif defined __UCLIBC_HAS_LOCALE__ ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_messages); ++ const char* __msg = gettext(__dfault.c_str()); ++ setlocale(LC_ALL, __old); ++ free(__old); ++ return string(__msg); ++#else ++ const char* __msg = gettext(__dfault.c_str()); ++ return string(__msg); ++#endif ++ } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ wstring ++ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const ++ { ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ __uselocale(__old); ++ return _M_convert_from_char(__msg); ++# elif defined __UCLIBC_HAS_LOCALE__ ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ setlocale(LC_ALL, __old); ++ free(__old); ++ return _M_convert_from_char(__msg); ++# else ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ return _M_convert_from_char(__msg); ++# endif ++ } ++#endif ++} +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,118 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix prototypes for *textdomain funcs ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++extern "C" char *__textdomain(const char *domainname); ++extern "C" char *__bindtextdomain(const char *domainname, ++ const char *dirname); ++#else ++#undef __textdomain ++#undef __bindtextdomain ++#define __textdomain(D) ((void)0) ++#define __bindtextdomain(D,P) ((void)0) ++#endif ++ ++ // Non-virtual member functions. ++ template<typename _CharT> ++ messages<_CharT>::messages(size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), ++ _M_name_messages(_S_get_c_name()) ++ { } ++ ++ template<typename _CharT> ++ messages<_CharT>::messages(__c_locale __cloc, const char* __s, ++ size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)), ++ _M_name_messages(__s) ++ { ++ char* __tmp = new char[std::strlen(__s) + 1]; ++ std::strcpy(__tmp, __s); ++ _M_name_messages = __tmp; ++ } ++ ++ template<typename _CharT> ++ typename messages<_CharT>::catalog ++ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, ++ const char* __dir) const ++ { ++ __bindtextdomain(__s.c_str(), __dir); ++ return this->do_open(__s, __loc); ++ } ++ ++ // Virtual member functions. ++ template<typename _CharT> ++ messages<_CharT>::~messages() ++ { ++ if (_M_name_messages != _S_get_c_name()) ++ delete [] _M_name_messages; ++ _S_destroy_c_locale(_M_c_locale_messages); ++ } ++ ++ template<typename _CharT> ++ typename messages<_CharT>::catalog ++ messages<_CharT>::do_open(const basic_string<char>& __s, ++ const locale&) const ++ { ++ // No error checking is done, assume the catalog exists and can ++ // be used. ++ __textdomain(__s.c_str()); ++ return 0; ++ } ++ ++ template<typename _CharT> ++ void ++ messages<_CharT>::do_close(catalog) const ++ { } ++ ++ // messages_byname ++ template<typename _CharT> ++ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) ++ : messages<_CharT>(__refs) ++ { ++ if (this->_M_name_messages != locale::facet::_S_get_c_name()) ++ delete [] this->_M_name_messages; ++ char* __tmp = new char[std::strlen(__s) + 1]; ++ std::strcpy(__tmp, __s); ++ this->_M_name_messages = __tmp; ++ ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ++ { ++ this->_S_destroy_c_locale(this->_M_c_locale_messages); ++ this->_S_create_c_locale(this->_M_c_locale_messages, __s); ++ } ++ } +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2005-04-28 01:23:02.000000000 -0500 +@@ -0,0 +1,692 @@ ++// std::moneypunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#define _LIBC ++#include <locale> ++#undef _LIBC ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning optimize this for uclibc ++#warning tailor for stub locale support ++#endif ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ // Construct and return valid pattern consisting of some combination of: ++ // space none symbol sign value ++ money_base::pattern ++ money_base::_S_construct_pattern(char __precedes, char __space, char __posn) ++ { ++ pattern __ret; ++ ++ // This insanely complicated routine attempts to construct a valid ++ // pattern for use with monyepunct. A couple of invariants: ++ ++ // if (__precedes) symbol -> value ++ // else value -> symbol ++ ++ // if (__space) space ++ // else none ++ ++ // none == never first ++ // space never first or last ++ ++ // Any elegant implementations of this are welcome. ++ switch (__posn) ++ { ++ case 0: ++ case 1: ++ // 1 The sign precedes the value and symbol. ++ __ret.field[0] = sign; ++ if (__space) ++ { ++ // Pattern starts with sign. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[3] = symbol; ++ } ++ __ret.field[2] = space; ++ } ++ else ++ { ++ // Pattern starts with sign and ends with none. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[3] = none; ++ } ++ break; ++ case 2: ++ // 2 The sign follows the value and symbol. ++ if (__space) ++ { ++ // Pattern either ends with sign. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[1] = space; ++ __ret.field[3] = sign; ++ } ++ else ++ { ++ // Pattern ends with sign then none. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[1] = symbol; ++ } ++ __ret.field[2] = sign; ++ __ret.field[3] = none; ++ } ++ break; ++ case 3: ++ // 3 The sign immediately precedes the symbol. ++ if (__precedes) ++ { ++ __ret.field[0] = sign; ++ __ret.field[1] = symbol; ++ if (__space) ++ { ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[2] = value; ++ __ret.field[3] = none; ++ } ++ } ++ else ++ { ++ __ret.field[0] = value; ++ if (__space) ++ { ++ __ret.field[1] = space; ++ __ret.field[2] = sign; ++ __ret.field[3] = symbol; ++ } ++ else ++ { ++ __ret.field[1] = sign; ++ __ret.field[2] = symbol; ++ __ret.field[3] = none; ++ } ++ } ++ break; ++ case 4: ++ // 4 The sign immediately follows the symbol. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = sign; ++ if (__space) ++ { ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[2] = value; ++ __ret.field[3] = none; ++ } ++ } ++ else ++ { ++ __ret.field[0] = value; ++ if (__space) ++ { ++ __ret.field[1] = space; ++ __ret.field[2] = symbol; ++ __ret.field[3] = sign; ++ } ++ else ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = sign; ++ __ret.field[3] = none; ++ } ++ } ++ break; ++ default: ++ __ret = pattern(); ++ } ++ return __ret; ++ } ++ ++ template<> ++ void ++ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<char, true>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = '.'; ++ _M_data->_M_thousands_sep = ','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = ""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = ""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = ""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i]; ++ } ++ else ++ { ++ // Named locale. ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, ++ __cloc)); ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, ++ __cloc)); ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign); ++ ++ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); ++ if (!__nposn) ++ _M_data->_M_negative_sign = "()"; ++ else ++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, ++ __cloc); ++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign); ++ ++ // _Intl == true ++ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); ++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol); ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, ++ __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ } ++ } ++ ++ template<> ++ void ++ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<char, false>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = '.'; ++ _M_data->_M_thousands_sep = ','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = ""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = ""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = ""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i]; ++ } ++ else ++ { ++ // Named locale. ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, ++ __cloc)); ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, ++ __cloc)); ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign); ++ ++ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); ++ if (!__nposn) ++ _M_data->_M_negative_sign = "()"; ++ else ++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, ++ __cloc); ++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign); ++ ++ // _Intl == false ++ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); ++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol); ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ } ++ } ++ ++ template<> ++ moneypunct<char, true>::~moneypunct() ++ { delete _M_data; } ++ ++ template<> ++ moneypunct<char, false>::~moneypunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ const char*) ++#else ++ const char* __name) ++#endif ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<wchar_t, true>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = L'.'; ++ _M_data->_M_thousands_sep = L','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ // Use ctype::widen code without the facet... ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ _M_data->_M_atoms[__i] = ++ static_cast<wchar_t>(money_base::_S_atoms[__i]); ++ } ++ else ++ { ++ // Named locale. ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(__cloc); ++#else ++ // Switch to named locale so that mbsrtowcs will work. ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, __name); ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this... should be monetary ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# else ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); ++ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); ++ ++ wchar_t* __wcs_ps = 0; ++ wchar_t* __wcs_ns = 0; ++ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); ++ try ++ { ++ mbstate_t __state; ++ size_t __len = strlen(__cpossign); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ps = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); ++ _M_data->_M_positive_sign = __wcs_ps; ++ } ++ else ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); ++ ++ __len = strlen(__cnegsign); ++ if (!__nposn) ++ _M_data->_M_negative_sign = L"()"; ++ else if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ns = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); ++ _M_data->_M_negative_sign = __wcs_ns; ++ } ++ else ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); ++ ++ // _Intl == true. ++ __len = strlen(__ccurr); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state); ++ _M_data->_M_curr_symbol = __wcs; ++ } ++ else ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); ++ } ++ catch (...) ++ { ++ delete _M_data; ++ _M_data = 0; ++ delete __wcs_ps; ++ delete __wcs_ns; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ __throw_exception_again; ++ } ++ ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, ++ __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ } ++ } ++ ++ template<> ++ void ++ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ const char*) ++#else ++ const char* __name) ++#endif ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<wchar_t, false>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = L'.'; ++ _M_data->_M_thousands_sep = L','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ // Use ctype::widen code without the facet... ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ _M_data->_M_atoms[__i] = ++ static_cast<wchar_t>(money_base::_S_atoms[__i]); ++ } ++ else ++ { ++ // Named locale. ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(__cloc); ++#else ++ // Switch to named locale so that mbsrtowcs will work. ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, __name); ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this... should be monetary ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# else ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); ++ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); ++ ++ wchar_t* __wcs_ps = 0; ++ wchar_t* __wcs_ns = 0; ++ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); ++ try ++ { ++ mbstate_t __state; ++ size_t __len; ++ __len = strlen(__cpossign); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ps = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); ++ _M_data->_M_positive_sign = __wcs_ps; ++ } ++ else ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); ++ ++ __len = strlen(__cnegsign); ++ if (!__nposn) ++ _M_data->_M_negative_sign = L"()"; ++ else if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ns = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); ++ _M_data->_M_negative_sign = __wcs_ns; ++ } ++ else ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); ++ ++ // _Intl == true. ++ __len = strlen(__ccurr); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state); ++ _M_data->_M_curr_symbol = __wcs; ++ } ++ else ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); ++ } ++ catch (...) ++ { ++ delete _M_data; ++ _M_data = 0; ++ delete __wcs_ps; ++ delete __wcs_ns; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ __throw_exception_again; ++ } ++ ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ } ++ } ++ ++ template<> ++ moneypunct<wchar_t, true>::~moneypunct() ++ { ++ if (_M_data->_M_positive_sign_size) ++ delete [] _M_data->_M_positive_sign; ++ if (_M_data->_M_negative_sign_size ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0) ++ delete [] _M_data->_M_negative_sign; ++ if (_M_data->_M_curr_symbol_size) ++ delete [] _M_data->_M_curr_symbol; ++ delete _M_data; ++ } ++ ++ template<> ++ moneypunct<wchar_t, false>::~moneypunct() ++ { ++ if (_M_data->_M_positive_sign_size) ++ delete [] _M_data->_M_positive_sign; ++ if (_M_data->_M_negative_sign_size ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0) ++ delete [] _M_data->_M_negative_sign; ++ if (_M_data->_M_curr_symbol_size) ++ delete [] _M_data->_M_curr_symbol; ++ delete _M_data; ++ } ++#endif ++} +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2005-04-28 01:20:20.000000000 -0500 +@@ -0,0 +1,173 @@ ++// std::numpunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#define _LIBC ++#include <locale> ++#undef _LIBC ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning tailor for stub locale support ++#endif ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache<char>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_use_grouping = false; ++ ++ _M_data->_M_decimal_point = '.'; ++ _M_data->_M_thousands_sep = ','; ++ ++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) ++ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i]; ++ ++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j) ++ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j]; ++ } ++ else ++ { ++ // Named locale. ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT, ++ __cloc)); ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP, ++ __cloc)); ++ ++ // Check for NULL, which implies no grouping. ++ if (_M_data->_M_thousands_sep == '\0') ++ _M_data->_M_grouping = ""; ++ else ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ } ++ ++ // NB: There is no way to extact this info from posix locales. ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); ++ _M_data->_M_truename = "true"; ++ _M_data->_M_truename_size = 4; ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); ++ _M_data->_M_falsename = "false"; ++ _M_data->_M_falsename_size = 5; ++ } ++ ++ template<> ++ numpunct<char>::~numpunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache<wchar_t>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_use_grouping = false; ++ ++ _M_data->_M_decimal_point = L'.'; ++ _M_data->_M_thousands_sep = L','; ++ ++ // Use ctype::widen code without the facet... ++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) ++ _M_data->_M_atoms_out[__i] = ++ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]); ++ ++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j) ++ _M_data->_M_atoms_in[__j] = ++ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]); ++ } ++ else ++ { ++ // Named locale. ++ // NB: In the GNU model wchar_t is always 32 bit wide. ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# else ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ ++ if (_M_data->_M_thousands_sep == L'\0') ++ _M_data->_M_grouping = ""; ++ else ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ } ++ ++ // NB: There is no way to extact this info from posix locales. ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); ++ _M_data->_M_truename = L"true"; ++ _M_data->_M_truename_size = 4; ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); ++ _M_data->_M_falsename = L"false"; ++ _M_data->_M_falsename_size = 5; ++ } ++ ++ template<> ++ numpunct<wchar_t>::~numpunct() ++ { delete _M_data; } ++ #endif ++} +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,406 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning tailor for stub locale support ++#endif ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ __timepunct<char>:: ++ _M_put(char* __s, size_t __maxlen, const char* __format, ++ const tm* __tm) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm, ++ _M_c_locale_timepunct); ++#else ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_timepunct); ++ const size_t __len = strftime(__s, __maxlen, __format, __tm); ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ // Make sure __s is null terminated. ++ if (__len == 0) ++ __s[0] = '\0'; ++ } ++ ++ template<> ++ void ++ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache<char>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = "%m/%d/%y"; ++ _M_data->_M_date_era_format = "%m/%d/%y"; ++ _M_data->_M_time_format = "%H:%M:%S"; ++ _M_data->_M_time_era_format = "%H:%M:%S"; ++ _M_data->_M_date_time_format = ""; ++ _M_data->_M_date_time_era_format = ""; ++ _M_data->_M_am = "AM"; ++ _M_data->_M_pm = "PM"; ++ _M_data->_M_am_pm_format = ""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = "Sunday"; ++ _M_data->_M_day2 = "Monday"; ++ _M_data->_M_day3 = "Tuesday"; ++ _M_data->_M_day4 = "Wednesday"; ++ _M_data->_M_day5 = "Thursday"; ++ _M_data->_M_day6 = "Friday"; ++ _M_data->_M_day7 = "Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = "Sun"; ++ _M_data->_M_aday2 = "Mon"; ++ _M_data->_M_aday3 = "Tue"; ++ _M_data->_M_aday4 = "Wed"; ++ _M_data->_M_aday5 = "Thu"; ++ _M_data->_M_aday6 = "Fri"; ++ _M_data->_M_aday7 = "Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = "January"; ++ _M_data->_M_month02 = "February"; ++ _M_data->_M_month03 = "March"; ++ _M_data->_M_month04 = "April"; ++ _M_data->_M_month05 = "May"; ++ _M_data->_M_month06 = "June"; ++ _M_data->_M_month07 = "July"; ++ _M_data->_M_month08 = "August"; ++ _M_data->_M_month09 = "September"; ++ _M_data->_M_month10 = "October"; ++ _M_data->_M_month11 = "November"; ++ _M_data->_M_month12 = "December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = "Jan"; ++ _M_data->_M_amonth02 = "Feb"; ++ _M_data->_M_amonth03 = "Mar"; ++ _M_data->_M_amonth04 = "Apr"; ++ _M_data->_M_amonth05 = "May"; ++ _M_data->_M_amonth06 = "Jun"; ++ _M_data->_M_amonth07 = "Jul"; ++ _M_data->_M_amonth08 = "Aug"; ++ _M_data->_M_amonth09 = "Sep"; ++ _M_data->_M_amonth10 = "Oct"; ++ _M_data->_M_amonth11 = "Nov"; ++ _M_data->_M_amonth12 = "Dec"; ++ } ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc); ++ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc); ++ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc); ++ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc); ++ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc); ++ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT, ++ __cloc); ++ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc); ++ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc); ++ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc); ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc); ++ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc); ++ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc); ++ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc); ++ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc); ++ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc); ++ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc); ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc); ++ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc); ++ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc); ++ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc); ++ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc); ++ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc); ++ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc); ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc); ++ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc); ++ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc); ++ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc); ++ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc); ++ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc); ++ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc); ++ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc); ++ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc); ++ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc); ++ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc); ++ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc); ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc); ++ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc); ++ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc); ++ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc); ++ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc); ++ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc); ++ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc); ++ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc); ++ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc); ++ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc); ++ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc); ++ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc); ++ } ++ } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ __timepunct<wchar_t>:: ++ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format, ++ const tm* __tm) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct); ++ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm, ++ _M_c_locale_timepunct); ++#else ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_timepunct); ++ const size_t __len = wcsftime(__s, __maxlen, __format, __tm); ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ // Make sure __s is null terminated. ++ if (__len == 0) ++ __s[0] = L'\0'; ++ } ++ ++ template<> ++ void ++ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache<wchar_t>; ++ ++#warning wide time stuff ++// if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = L"%m/%d/%y"; ++ _M_data->_M_date_era_format = L"%m/%d/%y"; ++ _M_data->_M_time_format = L"%H:%M:%S"; ++ _M_data->_M_time_era_format = L"%H:%M:%S"; ++ _M_data->_M_date_time_format = L""; ++ _M_data->_M_date_time_era_format = L""; ++ _M_data->_M_am = L"AM"; ++ _M_data->_M_pm = L"PM"; ++ _M_data->_M_am_pm_format = L""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = L"Sunday"; ++ _M_data->_M_day2 = L"Monday"; ++ _M_data->_M_day3 = L"Tuesday"; ++ _M_data->_M_day4 = L"Wednesday"; ++ _M_data->_M_day5 = L"Thursday"; ++ _M_data->_M_day6 = L"Friday"; ++ _M_data->_M_day7 = L"Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = L"Sun"; ++ _M_data->_M_aday2 = L"Mon"; ++ _M_data->_M_aday3 = L"Tue"; ++ _M_data->_M_aday4 = L"Wed"; ++ _M_data->_M_aday5 = L"Thu"; ++ _M_data->_M_aday6 = L"Fri"; ++ _M_data->_M_aday7 = L"Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = L"January"; ++ _M_data->_M_month02 = L"February"; ++ _M_data->_M_month03 = L"March"; ++ _M_data->_M_month04 = L"April"; ++ _M_data->_M_month05 = L"May"; ++ _M_data->_M_month06 = L"June"; ++ _M_data->_M_month07 = L"July"; ++ _M_data->_M_month08 = L"August"; ++ _M_data->_M_month09 = L"September"; ++ _M_data->_M_month10 = L"October"; ++ _M_data->_M_month11 = L"November"; ++ _M_data->_M_month12 = L"December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = L"Jan"; ++ _M_data->_M_amonth02 = L"Feb"; ++ _M_data->_M_amonth03 = L"Mar"; ++ _M_data->_M_amonth04 = L"Apr"; ++ _M_data->_M_amonth05 = L"May"; ++ _M_data->_M_amonth06 = L"Jun"; ++ _M_data->_M_amonth07 = L"Jul"; ++ _M_data->_M_amonth08 = L"Aug"; ++ _M_data->_M_amonth09 = L"Sep"; ++ _M_data->_M_amonth10 = L"Oct"; ++ _M_data->_M_amonth11 = L"Nov"; ++ _M_data->_M_amonth12 = L"Dec"; ++ } ++#if 0 ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ union { char *__s; wchar_t *__w; } __u; ++ ++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); ++ _M_data->_M_date_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); ++ _M_data->_M_date_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); ++ _M_data->_M_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); ++ _M_data->_M_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); ++ _M_data->_M_date_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); ++ _M_data->_M_date_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); ++ _M_data->_M_am = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); ++ _M_data->_M_pm = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); ++ _M_data->_M_am_pm_format = __u.__w; ++ ++ // Day names, starting with "C"'s Sunday. ++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); ++ _M_data->_M_day1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); ++ _M_data->_M_day2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); ++ _M_data->_M_day3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); ++ _M_data->_M_day4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); ++ _M_data->_M_day5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); ++ _M_data->_M_day6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); ++ _M_data->_M_day7 = __u.__w; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); ++ _M_data->_M_aday1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); ++ _M_data->_M_aday2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); ++ _M_data->_M_aday3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); ++ _M_data->_M_aday4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); ++ _M_data->_M_aday5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); ++ _M_data->_M_aday6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); ++ _M_data->_M_aday7 = __u.__w; ++ ++ // Month names, starting with "C"'s January. ++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); ++ _M_data->_M_month01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); ++ _M_data->_M_month02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); ++ _M_data->_M_month03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); ++ _M_data->_M_month04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); ++ _M_data->_M_month05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); ++ _M_data->_M_month06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); ++ _M_data->_M_month07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); ++ _M_data->_M_month08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); ++ _M_data->_M_month09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); ++ _M_data->_M_month10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); ++ _M_data->_M_month11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); ++ _M_data->_M_month12 = __u.__w; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); ++ _M_data->_M_amonth01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); ++ _M_data->_M_amonth02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); ++ _M_data->_M_amonth03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); ++ _M_data->_M_amonth04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); ++ _M_data->_M_amonth05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); ++ _M_data->_M_amonth06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); ++ _M_data->_M_amonth07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); ++ _M_data->_M_amonth08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); ++ _M_data->_M_amonth09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); ++ _M_data->_M_amonth10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); ++ _M_data->_M_amonth11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); ++ _M_data->_M_amonth12 = __u.__w; ++ } ++#endif // 0 ++ } ++#endif ++} +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.h 2004-05-22 18:46:31.000000000 -0500 +@@ -0,0 +1,68 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::__timepunct(size_t __refs) ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), ++ _M_name_timepunct(_S_get_c_name()) ++ { _M_initialize_timepunct(); } ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) ++ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL), ++ _M_name_timepunct(_S_get_c_name()) ++ { _M_initialize_timepunct(); } ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, ++ size_t __refs) ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), ++ _M_name_timepunct(__s) ++ { ++ char* __tmp = new char[std::strlen(__s) + 1]; ++ std::strcpy(__tmp, __s); ++ _M_name_timepunct = __tmp; ++ _M_initialize_timepunct(__cloc); ++ } ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::~__timepunct() ++ { ++ if (_M_name_timepunct != _S_get_c_name()) ++ delete [] _M_name_timepunct; ++ delete _M_data; ++ _S_destroy_c_locale(_M_c_locale_timepunct); ++ } +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_base.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_base.h 2005-04-28 01:10:27.000000000 -0500 +@@ -0,0 +1,64 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++/** @file ctype_base.h ++ * This is an internal header file, included by other library headers. ++ * You should not attempt to use it directly. ++ */ ++ ++// Information as gleaned from /usr/include/ctype.h ++ ++ /// @brief Base class for ctype. ++ struct ctype_base ++ { ++ // Note: In uClibc, the following two types depend on configuration. ++ ++ // Non-standard typedefs. ++ typedef const __ctype_touplow_t* __to_type; ++ ++ // NB: Offsets into ctype<char>::_M_table force a particular size ++ // on the mask type. Because of this, we don't use an enum. ++ typedef __ctype_mask_t mask; ++ static const mask upper = _ISupper; ++ static const mask lower = _ISlower; ++ static const mask alpha = _ISalpha; ++ static const mask digit = _ISdigit; ++ static const mask xdigit = _ISxdigit; ++ static const mask space = _ISspace; ++ static const mask print = _ISprint; ++ static const mask graph = _ISalpha | _ISdigit | _ISpunct; ++ static const mask cntrl = _IScntrl; ++ static const mask punct = _ISpunct; ++ static const mask alnum = _ISalpha | _ISdigit; ++ }; +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_inline.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_inline.h 2002-06-24 00:49:19.000000000 -0500 +@@ -0,0 +1,69 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 2000, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) ++// functions go in ctype.cc ++ ++ bool ++ ctype<char>:: ++ is(mask __m, char __c) const ++ { return _M_table[static_cast<unsigned char>(__c)] & __m; } ++ ++ const char* ++ ctype<char>:: ++ is(const char* __low, const char* __high, mask* __vec) const ++ { ++ while (__low < __high) ++ *__vec++ = _M_table[static_cast<unsigned char>(*__low++)]; ++ return __high; ++ } ++ ++ const char* ++ ctype<char>:: ++ scan_is(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && !(_M_table[static_cast<unsigned char>(*__low)] & __m)) ++ ++__low; ++ return __low; ++ } ++ ++ const char* ++ ctype<char>:: ++ scan_not(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0) ++ ++__low; ++ return __low; ++ } +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2005-04-28 01:10:27.000000000 -0500 +@@ -0,0 +1,92 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// Information as gleaned from /usr/include/ctype.h ++ ++ const ctype_base::mask* ++ ctype<char>::classic_table() throw() ++ { return __C_ctype_b; } ++ ++ ctype<char>::ctype(__c_locale, const mask* __table, bool __del, ++ size_t __refs) ++ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), ++ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0) ++ { ++ _M_toupper = __C_ctype_toupper; ++ _M_tolower = __C_ctype_tolower; ++ _M_table = __table ? __table : __C_ctype_b; ++ memset(_M_widen, 0, sizeof(_M_widen)); ++ memset(_M_narrow, 0, sizeof(_M_narrow)); ++ } ++ ++ ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) ++ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), ++ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0) ++ { ++ _M_toupper = __C_ctype_toupper; ++ _M_tolower = __C_ctype_tolower; ++ _M_table = __table ? __table : __C_ctype_b; ++ memset(_M_widen, 0, sizeof(_M_widen)); ++ memset(_M_narrow, 0, sizeof(_M_narrow)); ++ } ++ ++ char ++ ctype<char>::do_toupper(char __c) const ++ { return _M_toupper[static_cast<unsigned char>(__c)]; } ++ ++ const char* ++ ctype<char>::do_toupper(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_toupper[static_cast<unsigned char>(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } ++ ++ char ++ ctype<char>::do_tolower(char __c) const ++ { return _M_tolower[static_cast<unsigned char>(__c)]; } ++ ++ const char* ++ ctype<char>::do_tolower(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_tolower[static_cast<unsigned char>(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/os_defines.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/os_defines.h 2005-04-28 01:10:27.000000000 -0500 +@@ -0,0 +1,44 @@ ++// Specific definitions for GNU/Linux -*- C++ -*- ++ ++// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++#ifndef _GLIBCXX_OS_DEFINES ++#define _GLIBCXX_OS_DEFINES 1 ++ ++// System-specific #define, typedefs, corrections, etc, go here. This ++// file will come before all others. ++ ++// This keeps isanum, et al from being propagated as macros. ++#define __NO_CTYPE 1 ++ ++#include <features.h> ++ ++// We must not see the optimized string functions GNU libc defines. ++#define __NO_STRING_INLINES ++ ++#endif +diff -urN gcc-4.0.0-100/libstdc++-v3/configure gcc-4.0.0/libstdc++-v3/configure +--- gcc-4.0.0-100/libstdc++-v3/configure 2005-04-30 13:06:53.683055232 -0500 ++++ gcc-4.0.0/libstdc++-v3/configure 2005-04-30 12:24:24.000000000 -0500 +@@ -3998,6 +3998,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +@@ -5672,7 +5677,7 @@ + enableval="$enable_clocale" + + case "$enableval" in +- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;; ++ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;; + *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5 + echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;} + { (exit 1); exit 1; }; } ;; +@@ -5697,6 +5702,9 @@ + # Default to "generic". + if test $enable_clocale_flag = auto; then + case ${target_os} in ++ linux-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ +@@ -5927,6 +5935,76 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ echo "$as_me:$LINENO: result: uclibc" >&5 ++echo "${ECHO_T}uclibc" >&6 ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ # Extract the first word of "msgfmt", so it can be a program name with args. ++set dummy msgfmt; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test -n "$check_msgfmt"; then ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_check_msgfmt="yes" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" ++fi ++fi ++check_msgfmt=$ac_cv_prog_check_msgfmt ++if test -n "$check_msgfmt"; then ++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 ++echo "${ECHO_T}$check_msgfmt" >&6 ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ ++ ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -urN gcc-4.0.0-100/libstdc++-v3/configure.host gcc-4.0.0/libstdc++-v3/configure.host +--- gcc-4.0.0-100/libstdc++-v3/configure.host 2005-04-30 13:06:53.688054472 -0500 ++++ gcc-4.0.0/libstdc++-v3/configure.host 2005-04-28 20:20:32.000000000 -0500 +@@ -249,6 +249,12 @@ + ;; + esac + ++# Override for uClibc since linux-uclibc gets mishandled above. ++case "${host_os}" in ++ *-uclibc*) ++ os_include_dir="os/uclibc" ++ ;; ++esac + + # Set any OS-dependent and CPU-dependent bits. + # THIS TABLE IS SORTED. KEEP IT THAT WAY. +diff -urN gcc-4.0.0-100/libstdc++-v3/crossconfig.m4 gcc-4.0.0/libstdc++-v3/crossconfig.m4 +--- gcc-4.0.0-100/libstdc++-v3/crossconfig.m4 2005-04-30 13:06:53.689054320 -0500 ++++ gcc-4.0.0/libstdc++-v3/crossconfig.m4 2005-04-28 20:27:15.000000000 -0500 +@@ -142,6 +142,98 @@ + ;; + esac + ;; ++ *-uclibc*) ++# Temporary hack until we implement the float versions of the libm funcs ++ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ ++ machine/endian.h machine/param.h sys/machine.h sys/types.h \ ++ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h]) ++ SECTION_FLAGS='-ffunction-sections -fdata-sections' ++ AC_SUBST(SECTION_FLAGS) ++ GLIBCXX_CHECK_LINKER_FEATURES ++ GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT ++ GLIBCXX_CHECK_WCHAR_T_SUPPORT ++ ++ # For LFS. ++ AC_DEFINE(HAVE_INT64_T) ++ case "$target" in ++ *-uclinux*) ++ # Don't enable LFS with uClinux ++ ;; ++ *) ++ AC_DEFINE(_GLIBCXX_USE_LFS) ++ esac ++ ++ # For showmanyc_helper(). ++ AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) ++ GLIBCXX_CHECK_POLL ++ GLIBCXX_CHECK_S_ISREG_OR_S_IFREG ++ ++ # For xsputn_2(). ++ AC_CHECK_HEADERS(sys/uio.h) ++ GLIBCXX_CHECK_WRITEV ++ ++# AC_DEFINE(HAVE_ACOSF) ++# AC_DEFINE(HAVE_ASINF) ++# AC_DEFINE(HAVE_ATANF) ++# AC_DEFINE(HAVE_ATAN2F) ++ AC_DEFINE(HAVE_CEILF) ++ AC_DEFINE(HAVE_COPYSIGN) ++# AC_DEFINE(HAVE_COPYSIGNF) ++# AC_DEFINE(HAVE_COSF) ++# AC_DEFINE(HAVE_COSHF) ++# AC_DEFINE(HAVE_EXPF) ++# AC_DEFINE(HAVE_FABSF) ++ AC_DEFINE(HAVE_FINITE) ++ AC_DEFINE(HAVE_FINITEF) ++ AC_DEFINE(HAVE_FLOORF) ++# AC_DEFINE(HAVE_FMODF) ++# AC_DEFINE(HAVE_FREXPF) ++ AC_DEFINE(HAVE_HYPOT) ++# AC_DEFINE(HAVE_HYPOTF) ++ AC_DEFINE(HAVE_ISINF) ++ AC_DEFINE(HAVE_ISINFF) ++ AC_DEFINE(HAVE_ISNAN) ++ AC_DEFINE(HAVE_ISNANF) ++# AC_DEFINE(HAVE_LOGF) ++# AC_DEFINE(HAVE_LOG10F) ++# AC_DEFINE(HAVE_MODFF) ++# AC_DEFINE(HAVE_SINF) ++# AC_DEFINE(HAVE_SINHF) ++# AC_DEFINE(HAVE_SINCOS) ++# AC_DEFINE(HAVE_SINCOSF) ++ AC_DEFINE(HAVE_SQRTF) ++# AC_DEFINE(HAVE_TANF) ++# AC_DEFINE(HAVE_TANHF) ++ if test x"long_double_math_on_this_cpu" = x"yes"; then ++# AC_DEFINE(HAVE_ACOSL) ++# AC_DEFINE(HAVE_ASINL) ++# AC_DEFINE(HAVE_ATANL) ++# AC_DEFINE(HAVE_ATAN2L) ++# AC_DEFINE(HAVE_CEILL) ++# AC_DEFINE(HAVE_COPYSIGNL) ++# AC_DEFINE(HAVE_COSL) ++# AC_DEFINE(HAVE_COSHL) ++# AC_DEFINE(HAVE_EXPL) ++# AC_DEFINE(HAVE_FABSL) ++# AC_DEFINE(HAVE_FINITEL) ++# AC_DEFINE(HAVE_FLOORL) ++# AC_DEFINE(HAVE_FMODL) ++# AC_DEFINE(HAVE_FREXPL) ++# AC_DEFINE(HAVE_HYPOTL) ++# AC_DEFINE(HAVE_ISINFL) ++# AC_DEFINE(HAVE_ISNANL) ++# AC_DEFINE(HAVE_LOGL) ++# AC_DEFINE(HAVE_LOG10L) ++# AC_DEFINE(HAVE_MODFL) ++# AC_DEFINE(HAVE_POWL) ++# AC_DEFINE(HAVE_SINL) ++# AC_DEFINE(HAVE_SINHL) ++# AC_DEFINE(HAVE_SINCOSL) ++# AC_DEFINE(HAVE_SQRTL) ++# AC_DEFINE(HAVE_TANL) ++# AC_DEFINE(HAVE_TANHL) ++ fi ++ ;; + *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu) + AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ + machine/endian.h machine/param.h sys/machine.h sys/types.h \ +@@ -156,7 +248,7 @@ + AC_DEFINE(HAVE_INT64_T) + case "$target" in + *-uclinux*) +- # Don't enable LFS with uClibc ++ # Don't enable LFS with uClinux + ;; + *) + AC_DEFINE(_GLIBCXX_USE_LFS) +diff -urN gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h +--- gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h 2005-04-30 13:06:53.690054168 -0500 ++++ gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h 2005-04-28 20:15:56.000000000 -0500 +@@ -101,7 +101,9 @@ + using std::wmemcpy; + using std::wmemmove; + using std::wmemset; ++#if _GLIBCXX_HAVE_WCSFTIME + using std::wcsftime; ++#endif + + #if _GLIBCXX_USE_C99 + using std::wcstold; +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/include/c_std/std_cwchar.h 2005-04-30 13:06:53.691054016 -0500 ++++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cwchar.h 2005-04-28 20:15:56.000000000 -0500 +@@ -179,7 +179,9 @@ + using ::wcscoll; + using ::wcscpy; + using ::wcscspn; ++#if _GLIBCXX_HAVE_WCSFTIME + using ::wcsftime; ++#endif + using ::wcslen; + using ::wcsncat; + using ::wcsncmp; diff --git a/patches/gcc/4.0.3/300-libstdc++-pic.patch b/patches/gcc/4.0.3/300-libstdc++-pic.patch new file mode 100644 index 00000000..a9d6e718 --- /dev/null +++ b/patches/gcc/4.0.3/300-libstdc++-pic.patch @@ -0,0 +1,45 @@ +--- gcc-4.0.0/libstdc++-v3/src/Makefile.am ++++ gcc-4.0.0/libstdc++-v3/src/Makefile.am +@@ -214,6 +214,10 @@ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ + + ++install-exec-local: ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++ + # Added bits to build debug library. + if GLIBCXX_BUILD_DEBUG + all-local: build_debug +--- gcc-4.0.0/libstdc++-v3/src/Makefile.in ++++ gcc-4.0.0/libstdc++-v3/src/Makefile.in +@@ -625,7 +625,7 @@ + + install-data-am: install-data-local + +-install-exec-am: install-toolexeclibLTLIBRARIES ++install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local + + install-info: install-info-am + +@@ -664,7 +664,7 @@ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ +- uninstall-toolexeclibLTLIBRARIES ++ uninstall-toolexeclibLTLIBRARIES install-exec-local + + @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP) + @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver +@@ -743,6 +743,11 @@ + install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ++ ++install-exec-local: ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff --git a/patches/gcc/4.0.3/301-missing-execinfo_h.patch b/patches/gcc/4.0.3/301-missing-execinfo_h.patch new file mode 100644 index 00000000..0e2092f3 --- /dev/null +++ b/patches/gcc/4.0.3/301-missing-execinfo_h.patch @@ -0,0 +1,11 @@ +--- gcc-4.0.0/boehm-gc/include/gc.h-orig 2005-04-28 22:28:57.000000000 -0500 ++++ gcc-4.0.0/boehm-gc/include/gc.h 2005-04-28 22:30:38.000000000 -0500 +@@ -500,7 +500,7 @@ + #ifdef __linux__ + # include <features.h> + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/patches/gcc/4.0.3/302-c99-snprintf.patch b/patches/gcc/4.0.3/302-c99-snprintf.patch new file mode 100644 index 00000000..dfb22d68 --- /dev/null +++ b/patches/gcc/4.0.3/302-c99-snprintf.patch @@ -0,0 +1,11 @@ +--- gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h-orig 2005-04-29 00:08:41.000000000 -0500 ++++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h 2005-04-29 00:08:45.000000000 -0500 +@@ -142,7 +142,7 @@ + using ::vsprintf; + } + +-#if _GLIBCXX_USE_C99 ++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf diff --git a/patches/gcc/4.0.3/303-c99-complex-ugly-hack.patch b/patches/gcc/4.0.3/303-c99-complex-ugly-hack.patch new file mode 100644 index 00000000..2ccc80d9 --- /dev/null +++ b/patches/gcc/4.0.3/303-c99-complex-ugly-hack.patch @@ -0,0 +1,12 @@ +--- gcc-4.0.0/libstdc++-v3/configure-old 2005-04-30 22:04:48.061603912 -0500 ++++ gcc-4.0.0/libstdc++-v3/configure 2005-04-30 22:06:13.678588152 -0500 +@@ -7194,6 +7194,9 @@ + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + #include <complex.h> ++#ifdef __UCLIBC__ ++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs ++#endif + int + main () + { diff --git a/patches/gcc/4.0.3/304-index_macro.patch b/patches/gcc/4.0.3/304-index_macro.patch new file mode 100644 index 00000000..1fac112f --- /dev/null +++ b/patches/gcc/4.0.3/304-index_macro.patch @@ -0,0 +1,24 @@ +--- gcc-4.1.0/libstdc++-v3/include/ext/rope.mps 2006-03-24 01:49:51 +0100 ++++ gcc-4.1.0/libstdc++-v3/include/ext/rope 2006-03-24 01:49:37 +0100 +@@ -59,6 +59,9 @@ + #include <bits/allocator.h> + #include <ext/hash_fun.h> + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + # ifdef __GC + # define __GC_CONST const + # else +--- gcc-4.1.0/libstdc++-v3/include/ext/ropeimpl.h.mps 2006-03-24 01:50:04 +0100 ++++ gcc-4.1.0/libstdc++-v3/include/ext/ropeimpl.h 2006-03-24 01:50:28 +0100 +@@ -53,6 +53,9 @@ + #include <ext/memory> // For uninitialized_copy_n + #include <ext/numeric> // For power + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + namespace __gnu_cxx + { + using std::size_t; diff --git a/patches/gcc/4.0.3/602-sdk-libstdc++-includes.patch b/patches/gcc/4.0.3/602-sdk-libstdc++-includes.patch new file mode 100644 index 00000000..c7676ae6 --- /dev/null +++ b/patches/gcc/4.0.3/602-sdk-libstdc++-includes.patch @@ -0,0 +1,22 @@ +diff -urN gcc-4.0.0-100/libstdc++-v3/fragment.am gcc-4.0.0/libstdc++-v3/fragment.am +--- gcc-4.0.0-100/libstdc++-v3/fragment.am 2004-10-25 15:32:40.000000000 -0500 ++++ gcc-4.0.0/libstdc++-v3/fragment.am 2005-04-28 21:48:43.000000000 -0500 +@@ -18,5 +18,5 @@ + $(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once + + # -I/-D flags to pass when compiling. +-AM_CPPFLAGS = $(GLIBCXX_INCLUDES) ++AM_CPPFLAGS = $(GLIBCXX_INCLUDES) -I$(toplevel_srcdir)/include + +diff -urN gcc-4.0.0-100/libstdc++-v3/libmath/Makefile.am gcc-4.0.0/libstdc++-v3/libmath/Makefile.am +--- gcc-4.0.0-100/libstdc++-v3/libmath/Makefile.am 2003-08-27 16:29:42.000000000 -0500 ++++ gcc-4.0.0/libstdc++-v3/libmath/Makefile.am 2005-04-28 21:48:43.000000000 -0500 +@@ -32,7 +32,7 @@ + + libmath_la_SOURCES = stubs.c + +-AM_CPPFLAGS = $(CANADIAN_INCLUDES) ++AM_CPPFLAGS = $(CANADIAN_INCLUDES) -I$(toplevel_srcdir)/include + + # Only compiling "C" sources in this directory. + LIBTOOL = @LIBTOOL@ --tag CC diff --git a/patches/gcc/4.0.3/800-arm-bigendian.patch b/patches/gcc/4.0.3/800-arm-bigendian.patch new file mode 100644 index 00000000..307aea3e --- /dev/null +++ b/patches/gcc/4.0.3/800-arm-bigendian.patch @@ -0,0 +1,67 @@ +By Lennert Buytenhek <buytenh@wantstofly.org> +Adds support for arm*b-linux* big-endian ARM targets + +See http://gcc.gnu.org/PR16350 + +--- gcc-4.0.3/gcc/config/arm/linux-elf.h ++++ gcc-4.0.3/gcc/config/arm/linux-elf.h +@@ -31,19 +31,33 @@ + /* Do not assume anything about header files. */ + #define NO_IMPLICIT_EXTERN_C + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END ++#define TARGET_ENDIAN_OPTION "mbig-endian" ++#define TARGET_LINKER_EMULATION "armelfb_linux" ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#define TARGET_ENDIAN_OPTION "mlittle-endian" ++#define TARGET_LINKER_EMULATION "armelf_linux" ++#endif ++ + #undef TARGET_DEFAULT_FLOAT_ABI + #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD + + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (0) ++#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT) + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" } + + /* The GNU C++ standard library requires that these macros be defined. */ + #undef CPLUSPLUS_CPP_SPEC +@@ -90,7 +104,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #define TARGET_OS_CPP_BUILTINS() \ +--- gcc-4.0.3/gcc/config.gcc ++++ gcc-4.0.3/gcc/config.gcc +@@ -672,6 +672,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + 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" ++ case $target in ++ arm*b-*) ++ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" ++ ;; ++ esac + tmake_file="${tmake_file} arm/t-arm arm/t-linux" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes diff --git a/patches/gcc/4.0.4/100-uclibc-conf.patch b/patches/gcc/4.0.4/100-uclibc-conf.patch new file mode 100644 index 00000000..3be7d097 --- /dev/null +++ b/patches/gcc/4.0.4/100-uclibc-conf.patch @@ -0,0 +1,553 @@ +--- gcc-4.0.2/gcc/config/t-linux-uclibc ++++ gcc-4.0.2/gcc/config/t-linux-uclibc +@@ -0,0 +1,5 @@ ++# Remove glibc specific files added in t-linux ++SHLIB_MAPFILES := $(filter-out $(srcdir)/config/libgcc-glibc.ver, $(SHLIB_MAPFILES)) ++ ++# Use unwind-dw2-fde instead of unwind-dw2-fde-glibc ++LIB2ADDEH := $(subst unwind-dw2-fde-glibc.c,unwind-dw2-fde.c,$(LIB2ADDEH)) +--- gcc-4.0.2/gcc/config.gcc ++++ gcc-4.0.2/gcc/config.gcc +@@ -1778,7 +1778,7 @@ + ;; + sh-*-elf* | sh[12346l]*-*-elf* | sh*-*-kaos* | \ + sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \ +- sh-*-linux* | sh[346lbe]*-*-linux* | \ ++ sh*-*-linux* | sh[346lbe]*-*-linux* | \ + sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \ + sh64-*-netbsd* | sh64l*-*-netbsd*) + tmake_file="${tmake_file} sh/t-sh sh/t-elf" +@@ -2234,10 +2234,16 @@ + *) + echo "*** Configuration ${target} not supported" 1>&2 + exit 1 + ;; + esac ++ ++# Rather than hook into each target, just do it after all the linux ++# targets have been processed ++case ${target} in ++*-linux-uclibc*) tm_defines="${tm_defines} USE_UCLIBC" ; tmake_file="${tmake_file} t-linux-uclibc" ++esac + + case ${target} in + i[34567]86-*-linux*aout* | i[34567]86-*-linux*libc1) + tmake_file="${tmake_file} i386/t-gmm_malloc" + ;; +--- gcc-4.0.2/gcc/config/alpha/linux-elf.h ++++ gcc-4.0.2/gcc/config/alpha/linux-elf.h +@@ -27,7 +27,11 @@ + #define SUBTARGET_EXTRA_SPECS \ + { "elf_dynamic_linker", ELF_DYNAMIC_LINKER }, + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else + #define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + + #define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \ + %{O*:-O3} %{!O*:-O1} \ +--- gcc-4.0.2/gcc/config/arm/linux-elf.h ++++ gcc-4.0.2/gcc/config/arm/linux-elf.h +@@ -81,14 +81,19 @@ + #define ENDFILE_SPEC \ + "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "%{h*} %{version:-v} \ + %{b} %{Wl,*:%*} \ + %{static:-Bstatic} \ + %{shared:-shared} \ + %{symbolic:-Bsymbolic} \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "} \ + -X \ + %{mbig-endian:-EB}" \ + SUBTARGET_EXTRA_LINK_SPEC +--- gcc-4.0.2/gcc/config/cris/linux.h ++++ gcc-4.0.2/gcc/config/cris/linux.h +@@ -79,6 +79,25 @@ + #undef CRIS_DEFAULT_CPU_VERSION + #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG + ++#ifdef USE_UCLIBC ++ ++#undef CRIS_SUBTARGET_VERSION ++#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc" ++ ++#undef CRIS_LINK_SUBTARGET_SPEC ++#define CRIS_LINK_SUBTARGET_SPEC \ ++ "-mcrislinux\ ++ -rpath-link include/asm/../..%s\ ++ %{shared} %{static}\ ++ %{symbolic:-Bdynamic} %{shlib:-Bdynamic} %{static:-Bstatic}\ ++ %{!shared: \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} \ ++ %{!r:%{O2|O3: --gc-sections}}" ++ ++#else /* USE_UCLIBC */ ++ + #undef CRIS_SUBTARGET_VERSION + #define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu" + +@@ -93,6 +112,8 @@ + %{!shared:%{!static:%{rdynamic:-export-dynamic}}}\ + %{!r:%{O2|O3: --gc-sections}}" + ++#endif /* USE_UCLIBC */ ++ + + /* Node: Run-time Target */ + +--- gcc-4.0.2/gcc/config/i386/linux.h ++++ gcc-4.0.2/gcc/config/i386/linux.h +@@ -107,6 +107,11 @@ + #define LINK_EMULATION "elf_i386" + #define DYNAMIC_LINKER "/lib/ld-linux.so.2" + ++#ifdef USE_UCLIBC ++#undef DYNAMIC_LINKER ++#define DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#endif ++ + #undef SUBTARGET_EXTRA_SPECS + #define SUBTARGET_EXTRA_SPECS \ + { "link_emulation", LINK_EMULATION },\ +--- gcc-4.0.2/gcc/config/i386/linux64.h ++++ gcc-4.0.2/gcc/config/i386/linux64.h +@@ -54,14 +54,21 @@ + When the -shared link option is used a final link is not being + done. */ + ++#ifdef USE_UCLIBC ++#define ELF32_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0" ++#else ++#define ELF32_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#define ELF64_DYNAMIC_LINKER "/lib64/ld-linux-x86-64.so.2" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \ + %{shared:-shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ +- %{!m32:%{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}}} \ ++ %{m32:%{!dynamic-linker:-dynamic-linker " ELF32_DYNAMIC_LINKER "}} \ ++ %{!m32:%{!dynamic-linker:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}} \ + %{static:-static}}" + + #define MULTILIB_DEFAULTS { "m64" } +--- gcc-4.0.2/gcc/config/ia64/linux.h ++++ gcc-4.0.2/gcc/config/ia64/linux.h +@@ -37,13 +37,18 @@ + /* Define this for shared library support because it isn't in the main + linux.h file. */ + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "\ + %{shared:-shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux-ia64.so.2}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}" + + +--- gcc-4.0.2/gcc/config/m68k/linux.h ++++ gcc-4.0.2/gcc/config/m68k/linux.h +@@ -127,12 +127,17 @@ + + /* If ELF is the default format, we should not use /lib/elf. */ + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld.so.1" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "-m m68kelf %{shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker*:-dynamic-linker /lib/ld.so.1}} \ ++ %{!dynamic-linker*:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static}}" + + /* For compatibility with linux/a.out */ +--- gcc-4.0.2/gcc/config/mips/linux.h ++++ gcc-4.0.2/gcc/config/mips/linux.h +@@ -108,14 +108,19 @@ + + /* Borrowed from sparc/linux.h */ + #undef LINK_SPEC ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld.so.1" ++#endif + #define LINK_SPEC \ + "%(endian_spec) \ + %{shared:-shared} \ + %{!shared: \ + %{!ibcs: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}}" + + #undef SUBTARGET_ASM_SPEC +--- gcc-4.0.2/gcc/config/pa/pa-linux.h ++++ gcc-4.0.2/gcc/config/pa/pa-linux.h +@@ -82,13 +82,18 @@ + /* Define this for shared library support because it isn't in the main + linux.h file. */ + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld.so.1" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "\ + %{shared:-shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}" + + /* glibc's profiling functions don't need gcc to allocate counters. */ +--- gcc-4.0.2/gcc/config/rs6000/linux.h ++++ gcc-4.0.2/gcc/config/rs6000/linux.h +@@ -69,7 +69,11 @@ + #define LINK_START_DEFAULT_SPEC "%(link_start_linux)" + + #undef LINK_OS_DEFAULT_SPEC ++#ifdef USE_UCLIBC ++#define LINK_OS_DEFAULT_SPEC "%(link_os_linux_uclibc)" ++#else + #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)" ++#endif + + #define LINK_GCC_C_SEQUENCE_SPEC \ + "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" +--- gcc-4.0.2/gcc/config/rs6000/sysv4.h ++++ gcc-4.0.2/gcc/config/rs6000/sysv4.h +@@ -949,6 +949,7 @@ + mcall-linux : %(link_os_linux) ; \ + mcall-gnu : %(link_os_gnu) ; \ + mcall-netbsd : %(link_os_netbsd) ; \ ++ mcall-linux-uclibc : %(link_os_linux_uclibc); \ + mcall-openbsd: %(link_os_openbsd) ; \ + : %(link_os_default) }" + +@@ -1127,6 +1128,10 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}" + ++#define LINK_OS_LINUX_UCLIBC_SPEC "-m elf32ppclinux %{!shared: %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}}" ++ + #if defined(HAVE_LD_EH_FRAME_HDR) + # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " + #endif +@@ -1293,6 +1298,7 @@ + { "link_os_sim", LINK_OS_SIM_SPEC }, \ + { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \ + { "link_os_linux", LINK_OS_LINUX_SPEC }, \ ++ { "link_os_linux_uclibc", LINK_OS_LINUX_UCLIBC_SPEC }, \ + { "link_os_gnu", LINK_OS_GNU_SPEC }, \ + { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \ + { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \ +--- gcc-4.0.2/gcc/config/s390/linux.h ++++ gcc-4.0.2/gcc/config/s390/linux.h +@@ -77,6 +77,13 @@ + #define MULTILIB_DEFAULTS { "m31" } + #endif + ++#ifdef USE_UCLIBC ++#define ELF31_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0" ++#else ++#define ELF31_DYNAMIC_LINKER "/lib/ld.so.1" ++#define ELF64_DYNAMIC_LINKER "/lib/ld64.so.1" ++#endif + #undef LINK_SPEC + #define LINK_SPEC \ + "%{m31:-m elf_s390}%{m64:-m elf64_s390} \ +@@ -86,8 +93,8 @@ + %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker: \ +- %{m31:-dynamic-linker /lib/ld.so.1} \ +- %{m64:-dynamic-linker /lib/ld64.so.1}}}}" ++ %{m31:-dynamic-linker " ELF31_DYNAMIC_LINKER "} \ ++ %{m64:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}}}" + + + #define TARGET_ASM_FILE_END file_end_indicate_exec_stack +--- gcc-4.0.2/gcc/config/sh/linux.h ++++ gcc-4.0.2/gcc/config/sh/linux.h +@@ -67,11 +67,16 @@ + #undef SUBTARGET_LINK_EMUL_SUFFIX + #define SUBTARGET_LINK_EMUL_SUFFIX "_linux" + #undef SUBTARGET_LINK_SPEC ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + #define SUBTARGET_LINK_SPEC \ + "%{shared:-shared} \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}" + + #undef LIB_SPEC +--- gcc-4.0.2/gcc/config/sparc/linux.h ++++ gcc-4.0.2/gcc/config/sparc/linux.h +@@ -130,14 +130,19 @@ + + /* If ELF is the default format, we should not use /lib/elf. */ + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ + %{!mno-relax:%{!r:-relax}} \ + %{!shared: \ + %{!ibcs: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}}" + + /* The sun bundled assembler doesn't accept -Yd, (and neither does gas). +--- gcc-4.0.2/gcc/config/sparc/linux64.h ++++ gcc-4.0.2/gcc/config/sparc/linux64.h +@@ -167,12 +166,17 @@ + { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \ + { "link_arch", LINK_ARCH_SPEC }, + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + #define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ + %{!shared: \ + %{!ibcs: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}} \ + " + +--- gcc-4.0.2/libtool.m4 ++++ gcc-4.0.2/libtool.m4 +@@ -682,6 +682,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'] +--- gcc-4.0.2/ltconfig ++++ gcc-4.0.2/ltconfig +@@ -603,6 +603,7 @@ + + # Transform linux* to *-*-linux-gnu*, to support old configure scripts. + case $host_os in ++linux-uclibc*) ;; + linux-gnu*) ;; + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` + esac +@@ -1274,6 +1275,23 @@ + dynamic_linker='GNU/Linux ld.so' + ;; + ++linux-uclibc*) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' ++ soname_spec='${libname}${release}.so$major' ++ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=no ++ # This implies no fast_install, which is unacceptable. ++ # Some rework will be needed to allow for fast_install ++ # before this can be enabled. ++ hardcode_into_libs=yes ++ # Assume using the uClibc dynamic linker. ++ dynamic_linker="uClibc ld.so" ++ ;; ++ + netbsd*) + need_lib_prefix=no + need_version=no +--- gcc-4.0.2/libffi/configure ++++ gcc-4.0.2/libffi/configure +@@ -3457,6 +3457,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.0.2/libgfortran/configure ++++ gcc-4.0.2/libgfortran/configure +@@ -3681,6 +3681,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.0.2/libjava/configure ++++ gcc-4.0.2/libjava/configure +@@ -4351,6 +4351,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.0.2/libmudflap/configure ++++ gcc-4.0.2/libmudflap/configure +@@ -5380,6 +5380,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.0.2/libobjc/configure ++++ gcc-4.0.2/libobjc/configure +@@ -3283,6 +3283,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.0.2/boehm-gc/configure ++++ gcc-4.0.2/boehm-gc/configure +@@ -4320,6 +4320,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.0.2/configure ++++ gcc-4.0.2/configure +@@ -1141,7 +1141,7 @@ + ;; + "") + case "${target}" in +- *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu) ++ *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*) + # Enable libmudflap by default in GNU and friends. + ;; + *-*-freebsd*) +--- gcc-4.0.2/configure.in ++++ gcc-4.0.2/configure.in +@@ -350,7 +350,7 @@ + ;; + "") + case "${target}" in +- *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu) ++ *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*) + # Enable libmudflap by default in GNU and friends. + ;; + *-*-freebsd*) +--- gcc-4.0.2/contrib/regression/objs-gcc.sh ++++ gcc-4.0.2/contrib/regression/objs-gcc.sh +@@ -105,6 +105,10 @@ + then + make all-gdb all-dejagnu all-ld || exit 1 + make install-gdb install-dejagnu install-ld || exit 1 ++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ] ++ then ++ make all-gdb all-dejagnu all-ld || exit 1 ++ make install-gdb install-dejagnu install-ld || exit 1 + elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then + make bootstrap || exit 1 + make install || exit 1 +--- gcc-4.0.2/zlib/configure ++++ gcc-4.0.2/zlib/configure +@@ -3426,6 +3426,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' diff --git a/patches/gcc/4.0.4/200-uclibc-locale.patch b/patches/gcc/4.0.4/200-uclibc-locale.patch new file mode 100644 index 00000000..ac4cf972 --- /dev/null +++ b/patches/gcc/4.0.4/200-uclibc-locale.patch @@ -0,0 +1,3237 @@ +diff -urN gcc-4.0.0-100/libstdc++-v3/acinclude.m4 gcc-4.0.0/libstdc++-v3/acinclude.m4 +--- gcc-4.0.0-100/libstdc++-v3/acinclude.m4 2005-04-30 13:06:53.000000000 -0500 ++++ gcc-4.0.0/libstdc++-v3/acinclude.m4 2005-04-28 20:19:01.000000000 -0500 +@@ -1104,7 +1104,7 @@ + AC_MSG_CHECKING([for C locale to use]) + GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], + [use MODEL for target locale package], +- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto]) ++ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto]) + + # If they didn't use this option switch, or if they specified --enable + # with no specific model, we'll have to look for one. If they +@@ -1120,6 +1120,9 @@ + # Default to "generic". + if test $enable_clocale_flag = auto; then + case ${target_os} in ++ *-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) + AC_EGREP_CPP([_GLIBCXX_ok], [ + #include <features.h> +@@ -1263,6 +1266,40 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ AC_MSG_RESULT(uclibc) ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ AC_SUBST(glibcxx_MOFILES) ++ AC_SUBST(glibcxx_POFILES) ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,59 @@ ++// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*- ++ ++// Copyright (C) 2002, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// Written by Jakub Jelinek <jakub@redhat.com> ++ ++#include <clocale> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning clean this up ++#endif ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ ++extern "C" __typeof(iswctype_l) __iswctype_l; ++extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l; ++extern "C" __typeof(strcoll_l) __strcoll_l; ++extern "C" __typeof(strftime_l) __strftime_l; ++extern "C" __typeof(strtod_l) __strtod_l; ++extern "C" __typeof(strtof_l) __strtof_l; ++extern "C" __typeof(strtold_l) __strtold_l; ++extern "C" __typeof(strxfrm_l) __strxfrm_l; ++extern "C" __typeof(towlower_l) __towlower_l; ++extern "C" __typeof(towupper_l) __towupper_l; ++extern "C" __typeof(wcscoll_l) __wcscoll_l; ++extern "C" __typeof(wcsftime_l) __wcsftime_l; ++extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l; ++extern "C" __typeof(wctype_l) __wctype_l; ++extern "C" __typeof(newlocale) __newlocale; ++extern "C" __typeof(freelocale) __freelocale; ++extern "C" __typeof(duplocale) __duplocale; ++extern "C" __typeof(uselocale) __uselocale; ++ ++#endif // GLIBC 2.3 and later +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,160 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <cerrno> // For errno ++#include <locale> ++#include <stdexcept> ++#include <langinfo.h> ++#include <bits/c++locale_internal.h> ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __strtol_l(S, E, B, L) strtol((S), (E), (B)) ++#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B)) ++#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B)) ++#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B)) ++#define __strtof_l(S, E, L) strtof((S), (E)) ++#define __strtod_l(S, E, L) strtod((S), (E)) ++#define __strtold_l(S, E, L) strtold((S), (E)) ++#warning should dummy __newlocale check for C|POSIX ? ++#define __newlocale(a, b, c) NULL ++#define __freelocale(a) ((void)0) ++#define __duplocale(a) __c_locale() ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ float __f = __strtof_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __f; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ double __d = __strtod_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __d; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ long double __ld = __strtold_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __ld; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ void ++ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, ++ __c_locale __old) ++ { ++ __cloc = __newlocale(1 << LC_ALL, __s, __old); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ if (!__cloc) ++ { ++ // This named locale is not supported by the underlying OS. ++ __throw_runtime_error(__N("locale::facet::_S_create_c_locale " ++ "name not valid")); ++ } ++#endif ++ } ++ ++ void ++ locale::facet::_S_destroy_c_locale(__c_locale& __cloc) ++ { ++ if (_S_get_c_locale() != __cloc) ++ __freelocale(__cloc); ++ } ++ ++ __c_locale ++ locale::facet::_S_clone_c_locale(__c_locale& __cloc) ++ { return __duplocale(__cloc); } ++} // namespace std ++ ++namespace __gnu_cxx ++{ ++ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] = ++ { ++ "LC_CTYPE", ++ "LC_NUMERIC", ++ "LC_TIME", ++ "LC_COLLATE", ++ "LC_MONETARY", ++ "LC_MESSAGES", ++#if _GLIBCXX_NUM_CATEGORIES != 0 ++ "LC_PAPER", ++ "LC_NAME", ++ "LC_ADDRESS", ++ "LC_TELEPHONE", ++ "LC_MEASUREMENT", ++ "LC_IDENTIFICATION" ++#endif ++ }; ++} ++ ++namespace std ++{ ++ const char* const* const locale::_S_categories = __gnu_cxx::category_names; ++} // namespace std +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.h 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,115 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#ifndef _C_LOCALE_H ++#define _C_LOCALE_H 1 ++ ++#pragma GCC system_header ++ ++#include <cstring> // get std::strlen ++#include <cstdio> // get std::snprintf or std::sprintf ++#include <clocale> ++#include <langinfo.h> // For codecvt ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC_HAS_LOCALE__ ++#include <iconv.h> // For codecvt using iconv, iconv_t ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#include <libintl.h> // For messages ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning what is _GLIBCXX_C_LOCALE_GNU for ++#endif ++#define _GLIBCXX_C_LOCALE_GNU 1 ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix categories ++#endif ++// #define _GLIBCXX_NUM_CATEGORIES 6 ++#define _GLIBCXX_NUM_CATEGORIES 0 ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++namespace __gnu_cxx ++{ ++ extern "C" __typeof(uselocale) __uselocale; ++} ++#endif ++ ++namespace std ++{ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ typedef __locale_t __c_locale; ++#else ++ typedef int* __c_locale; ++#endif ++ ++ // Convert numeric value of type _Tv to string and return length of ++ // string. If snprintf is available use it, otherwise fall back to ++ // the unsafe sprintf which, in general, can be dangerous and should ++ // be avoided. ++ template<typename _Tv> ++ int ++ __convert_from_v(char* __out, const int __size, const char* __fmt, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ _Tv __v, const __c_locale& __cloc, int __prec) ++ { ++ __c_locale __old = __gnu_cxx::__uselocale(__cloc); ++#else ++ _Tv __v, const __c_locale&, int __prec) ++ { ++# ifdef __UCLIBC_HAS_LOCALE__ ++ char* __old = std::setlocale(LC_ALL, NULL); ++ char* __sav = new char[std::strlen(__old) + 1]; ++ std::strcpy(__sav, __old); ++ std::setlocale(LC_ALL, "C"); ++# endif ++#endif ++ ++ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __gnu_cxx::__uselocale(__old); ++#elif defined __UCLIBC_HAS_LOCALE__ ++ std::setlocale(LC_ALL, __sav); ++ delete [] __sav; ++#endif ++ return __ret; ++ } ++} ++ ++#endif +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,306 @@ ++// std::codecvt implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.5 - Template class codecvt ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++namespace std ++{ ++ // Specializations. ++#ifdef _GLIBCXX_USE_WCHAR_T ++ codecvt_base::result ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_out(state_type& __state, const intern_type* __from, ++ const intern_type* __from_end, const intern_type*& __from_next, ++ extern_type* __to, extern_type* __to_end, ++ extern_type*& __to_next) const ++ { ++ result __ret = ok; ++ state_type __tmp_state(__state); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ ++ // wcsnrtombs is *very* fast but stops if encounters NUL characters: ++ // in case we fall back to wcrtomb and then continue, in a loop. ++ // NB: wcsnrtombs is a GNU extension ++ for (__from_next = __from, __to_next = __to; ++ __from_next < __from_end && __to_next < __to_end ++ && __ret == ok;) ++ { ++ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0', ++ __from_end - __from_next); ++ if (!__from_chunk_end) ++ __from_chunk_end = __from_end; ++ ++ __from = __from_next; ++ const size_t __conv = wcsnrtombs(__to_next, &__from_next, ++ __from_chunk_end - __from_next, ++ __to_end - __to_next, &__state); ++ if (__conv == static_cast<size_t>(-1)) ++ { ++ // In case of error, in order to stop at the exact place we ++ // have to start again from the beginning with a series of ++ // wcrtomb. ++ for (; __from < __from_next; ++__from) ++ __to_next += wcrtomb(__to_next, *__from, &__tmp_state); ++ __state = __tmp_state; ++ __ret = error; ++ } ++ else if (__from_next && __from_next < __from_chunk_end) ++ { ++ __to_next += __conv; ++ __ret = partial; ++ } ++ else ++ { ++ __from_next = __from_chunk_end; ++ __to_next += __conv; ++ } ++ ++ if (__from_next < __from_end && __ret == ok) ++ { ++ extern_type __buf[MB_LEN_MAX]; ++ __tmp_state = __state; ++ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state); ++ if (__conv > static_cast<size_t>(__to_end - __to_next)) ++ __ret = partial; ++ else ++ { ++ memcpy(__to_next, __buf, __conv); ++ __state = __tmp_state; ++ __to_next += __conv; ++ ++__from_next; ++ } ++ } ++ } ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ return __ret; ++ } ++ ++ codecvt_base::result ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_in(state_type& __state, const extern_type* __from, ++ const extern_type* __from_end, const extern_type*& __from_next, ++ intern_type* __to, intern_type* __to_end, ++ intern_type*& __to_next) const ++ { ++ result __ret = ok; ++ state_type __tmp_state(__state); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ ++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters: ++ // in case we store a L'\0' and then continue, in a loop. ++ // NB: mbsnrtowcs is a GNU extension ++ for (__from_next = __from, __to_next = __to; ++ __from_next < __from_end && __to_next < __to_end ++ && __ret == ok;) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0', ++ __from_end ++ - __from_next)); ++ if (!__from_chunk_end) ++ __from_chunk_end = __from_end; ++ ++ __from = __from_next; ++ size_t __conv = mbsnrtowcs(__to_next, &__from_next, ++ __from_chunk_end - __from_next, ++ __to_end - __to_next, &__state); ++ if (__conv == static_cast<size_t>(-1)) ++ { ++ // In case of error, in order to stop at the exact place we ++ // have to start again from the beginning with a series of ++ // mbrtowc. ++ for (;; ++__to_next, __from += __conv) ++ { ++ __conv = mbrtowc(__to_next, __from, __from_end - __from, ++ &__tmp_state); ++ if (__conv == static_cast<size_t>(-1) ++ || __conv == static_cast<size_t>(-2)) ++ break; ++ } ++ __from_next = __from; ++ __state = __tmp_state; ++ __ret = error; ++ } ++ else if (__from_next && __from_next < __from_chunk_end) ++ { ++ // It is unclear what to return in this case (see DR 382). ++ __to_next += __conv; ++ __ret = partial; ++ } ++ else ++ { ++ __from_next = __from_chunk_end; ++ __to_next += __conv; ++ } ++ ++ if (__from_next < __from_end && __ret == ok) ++ { ++ if (__to_next < __to_end) ++ { ++ // XXX Probably wrong for stateful encodings ++ __tmp_state = __state; ++ ++__from_next; ++ *__to_next++ = L'\0'; ++ } ++ else ++ __ret = partial; ++ } ++ } ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ return __ret; ++ } ++ ++ int ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_encoding() const throw() ++ { ++ // XXX This implementation assumes that the encoding is ++ // stateless and is either single-byte or variable-width. ++ int __ret = 0; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ if (MB_CUR_MAX == 1) ++ __ret = 1; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __ret; ++ } ++ ++ int ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_max_length() const throw() ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ // XXX Probably wrong for stateful encodings. ++ int __ret = MB_CUR_MAX; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __ret; ++ } ++ ++ int ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_length(state_type& __state, const extern_type* __from, ++ const extern_type* __end, size_t __max) const ++ { ++ int __ret = 0; ++ state_type __tmp_state(__state); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ ++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters: ++ // in case we advance past it and then continue, in a loop. ++ // NB: mbsnrtowcs is a GNU extension ++ ++ // A dummy internal buffer is needed in order for mbsnrtocws to consider ++ // its fourth parameter (it wouldn't with NULL as first parameter). ++ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t) ++ * __max)); ++ while (__from < __end && __max) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0', ++ __end ++ - __from)); ++ if (!__from_chunk_end) ++ __from_chunk_end = __end; ++ ++ const extern_type* __tmp_from = __from; ++ size_t __conv = mbsnrtowcs(__to, &__from, ++ __from_chunk_end - __from, ++ __max, &__state); ++ if (__conv == static_cast<size_t>(-1)) ++ { ++ // In case of error, in order to stop at the exact place we ++ // have to start again from the beginning with a series of ++ // mbrtowc. ++ for (__from = __tmp_from;; __from += __conv) ++ { ++ __conv = mbrtowc(NULL, __from, __end - __from, ++ &__tmp_state); ++ if (__conv == static_cast<size_t>(-1) ++ || __conv == static_cast<size_t>(-2)) ++ break; ++ } ++ __state = __tmp_state; ++ __ret += __from - __tmp_from; ++ break; ++ } ++ if (!__from) ++ __from = __from_chunk_end; ++ ++ __ret += __from - __tmp_from; ++ __max -= __conv; ++ ++ if (__from < __end && __max) ++ { ++ // XXX Probably wrong for stateful encodings ++ __tmp_state = __state; ++ ++__from; ++ ++__ret; ++ --__max; ++ } ++ } ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ return __ret; ++ } ++#endif ++} +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/collate_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/collate_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,80 @@ ++// std::collate implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.4.1.2 collate virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __strcoll_l(S1, S2, L) strcoll((S1), (S2)) ++#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N)) ++#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2)) ++#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N)) ++#endif ++ ++namespace std ++{ ++ // These are basically extensions to char_traits, and perhaps should ++ // be put there instead of here. ++ template<> ++ int ++ collate<char>::_M_compare(const char* __one, const char* __two) const ++ { ++ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate); ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); ++ } ++ ++ template<> ++ size_t ++ collate<char>::_M_transform(char* __to, const char* __from, ++ size_t __n) const ++ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ int ++ collate<wchar_t>::_M_compare(const wchar_t* __one, ++ const wchar_t* __two) const ++ { ++ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate); ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); ++ } ++ ++ template<> ++ size_t ++ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from, ++ size_t __n) const ++ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); } ++#endif ++} +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,300 @@ ++// std::ctype implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions. ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#define _LIBC ++#include <locale> ++#undef _LIBC ++#include <bits/c++locale_internal.h> ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __wctype_l(S, L) wctype((S)) ++#define __towupper_l(C, L) towupper((C)) ++#define __towlower_l(C, L) towlower((C)) ++#define __iswctype_l(C, M, L) iswctype((C), (M)) ++#endif ++ ++namespace std ++{ ++ // NB: The other ctype<char> specializations are in src/locale.cc and ++ // various /config/os/* files. ++ template<> ++ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs) ++ : ctype<char>(0, false, __refs) ++ { ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ++ { ++ this->_S_destroy_c_locale(this->_M_c_locale_ctype); ++ this->_S_create_c_locale(this->_M_c_locale_ctype, __s); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper; ++ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower; ++ this->_M_table = this->_M_c_locale_ctype->__ctype_b; ++#endif ++ } ++ } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ ctype<wchar_t>::__wmask_type ++ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const ++ { ++ __wmask_type __ret; ++ switch (__m) ++ { ++ case space: ++ __ret = __wctype_l("space", _M_c_locale_ctype); ++ break; ++ case print: ++ __ret = __wctype_l("print", _M_c_locale_ctype); ++ break; ++ case cntrl: ++ __ret = __wctype_l("cntrl", _M_c_locale_ctype); ++ break; ++ case upper: ++ __ret = __wctype_l("upper", _M_c_locale_ctype); ++ break; ++ case lower: ++ __ret = __wctype_l("lower", _M_c_locale_ctype); ++ break; ++ case alpha: ++ __ret = __wctype_l("alpha", _M_c_locale_ctype); ++ break; ++ case digit: ++ __ret = __wctype_l("digit", _M_c_locale_ctype); ++ break; ++ case punct: ++ __ret = __wctype_l("punct", _M_c_locale_ctype); ++ break; ++ case xdigit: ++ __ret = __wctype_l("xdigit", _M_c_locale_ctype); ++ break; ++ case alnum: ++ __ret = __wctype_l("alnum", _M_c_locale_ctype); ++ break; ++ case graph: ++ __ret = __wctype_l("graph", _M_c_locale_ctype); ++ break; ++ default: ++ __ret = __wmask_type(); ++ } ++ return __ret; ++ } ++ ++ wchar_t ++ ctype<wchar_t>::do_toupper(wchar_t __c) const ++ { return __towupper_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const ++ { ++ while (__lo < __hi) ++ { ++ *__lo = __towupper_l(*__lo, _M_c_locale_ctype); ++ ++__lo; ++ } ++ return __hi; ++ } ++ ++ wchar_t ++ ctype<wchar_t>::do_tolower(wchar_t __c) const ++ { return __towlower_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const ++ { ++ while (__lo < __hi) ++ { ++ *__lo = __towlower_l(*__lo, _M_c_locale_ctype); ++ ++__lo; ++ } ++ return __hi; ++ } ++ ++ bool ++ ctype<wchar_t>:: ++ do_is(mask __m, wchar_t __c) const ++ { ++ // Highest bitmask in ctype_base == 10, but extra in "C" ++ // library for blank. ++ bool __ret = false; ++ const size_t __bitmasksize = 11; ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) ++ if (__m & _M_bit[__bitcur] ++ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype)) ++ { ++ __ret = true; ++ break; ++ } ++ return __ret; ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const ++ { ++ for (; __lo < __hi; ++__vec, ++__lo) ++ { ++ // Highest bitmask in ctype_base == 10, but extra in "C" ++ // library for blank. ++ const size_t __bitmasksize = 11; ++ mask __m = 0; ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) ++ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype)) ++ __m |= _M_bit[__bitcur]; ++ *__vec = __m; ++ } ++ return __hi; ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const ++ { ++ while (__lo < __hi && !this->do_is(__m, *__lo)) ++ ++__lo; ++ return __lo; ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const ++ { ++ while (__lo < __hi && this->do_is(__m, *__lo) != 0) ++ ++__lo; ++ return __lo; ++ } ++ ++ wchar_t ++ ctype<wchar_t>:: ++ do_widen(char __c) const ++ { return _M_widen[static_cast<unsigned char>(__c)]; } ++ ++ const char* ++ ctype<wchar_t>:: ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const ++ { ++ while (__lo < __hi) ++ { ++ *__dest = _M_widen[static_cast<unsigned char>(*__lo)]; ++ ++__lo; ++ ++__dest; ++ } ++ return __hi; ++ } ++ ++ char ++ ctype<wchar_t>:: ++ do_narrow(wchar_t __wc, char __dfault) const ++ { ++ if (__wc >= 0 && __wc < 128 && _M_narrow_ok) ++ return _M_narrow[__wc]; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_ctype); ++#endif ++ const int __c = wctob(__wc); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return (__c == EOF ? __dfault : static_cast<char>(__c)); ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault, ++ char* __dest) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_ctype); ++#endif ++ if (_M_narrow_ok) ++ while (__lo < __hi) ++ { ++ if (*__lo >= 0 && *__lo < 128) ++ *__dest = _M_narrow[*__lo]; ++ else ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c)); ++ } ++ ++__lo; ++ ++__dest; ++ } ++ else ++ while (__lo < __hi) ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c)); ++ ++__lo; ++ ++__dest; ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __hi; ++ } ++ ++ void ++ ctype<wchar_t>::_M_initialize_ctype() ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_ctype); ++#endif ++ wint_t __i; ++ for (__i = 0; __i < 128; ++__i) ++ { ++ const int __c = wctob(__i); ++ if (__c == EOF) ++ break; ++ else ++ _M_narrow[__i] = static_cast<char>(__c); ++ } ++ if (__i == 128) ++ _M_narrow_ok = true; ++ else ++ _M_narrow_ok = false; ++ for (size_t __j = 0; ++ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j) ++ _M_widen[__j] = btowc(__j); ++ ++ for (size_t __k = 0; __k <= 11; ++__k) ++ { ++ _M_bit[__k] = static_cast<mask>(_ISbit(__k)); ++ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]); ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ } ++#endif // _GLIBCXX_USE_WCHAR_T ++} +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,100 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix gettext stuff ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++extern "C" char *__dcgettext(const char *domainname, ++ const char *msgid, int category); ++#undef gettext ++#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES) ++#else ++#undef gettext ++#define gettext(msgid) (msgid) ++#endif ++ ++namespace std ++{ ++ // Specializations. ++ template<> ++ string ++ messages<char>::do_get(catalog, int, int, const string& __dfault) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_messages); ++ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str())); ++ __uselocale(__old); ++ return string(__msg); ++#elif defined __UCLIBC_HAS_LOCALE__ ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_messages); ++ const char* __msg = gettext(__dfault.c_str()); ++ setlocale(LC_ALL, __old); ++ free(__old); ++ return string(__msg); ++#else ++ const char* __msg = gettext(__dfault.c_str()); ++ return string(__msg); ++#endif ++ } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ wstring ++ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const ++ { ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ __uselocale(__old); ++ return _M_convert_from_char(__msg); ++# elif defined __UCLIBC_HAS_LOCALE__ ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ setlocale(LC_ALL, __old); ++ free(__old); ++ return _M_convert_from_char(__msg); ++# else ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ return _M_convert_from_char(__msg); ++# endif ++ } ++#endif ++} +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,118 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix prototypes for *textdomain funcs ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++extern "C" char *__textdomain(const char *domainname); ++extern "C" char *__bindtextdomain(const char *domainname, ++ const char *dirname); ++#else ++#undef __textdomain ++#undef __bindtextdomain ++#define __textdomain(D) ((void)0) ++#define __bindtextdomain(D,P) ((void)0) ++#endif ++ ++ // Non-virtual member functions. ++ template<typename _CharT> ++ messages<_CharT>::messages(size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), ++ _M_name_messages(_S_get_c_name()) ++ { } ++ ++ template<typename _CharT> ++ messages<_CharT>::messages(__c_locale __cloc, const char* __s, ++ size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)), ++ _M_name_messages(__s) ++ { ++ char* __tmp = new char[std::strlen(__s) + 1]; ++ std::strcpy(__tmp, __s); ++ _M_name_messages = __tmp; ++ } ++ ++ template<typename _CharT> ++ typename messages<_CharT>::catalog ++ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, ++ const char* __dir) const ++ { ++ __bindtextdomain(__s.c_str(), __dir); ++ return this->do_open(__s, __loc); ++ } ++ ++ // Virtual member functions. ++ template<typename _CharT> ++ messages<_CharT>::~messages() ++ { ++ if (_M_name_messages != _S_get_c_name()) ++ delete [] _M_name_messages; ++ _S_destroy_c_locale(_M_c_locale_messages); ++ } ++ ++ template<typename _CharT> ++ typename messages<_CharT>::catalog ++ messages<_CharT>::do_open(const basic_string<char>& __s, ++ const locale&) const ++ { ++ // No error checking is done, assume the catalog exists and can ++ // be used. ++ __textdomain(__s.c_str()); ++ return 0; ++ } ++ ++ template<typename _CharT> ++ void ++ messages<_CharT>::do_close(catalog) const ++ { } ++ ++ // messages_byname ++ template<typename _CharT> ++ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) ++ : messages<_CharT>(__refs) ++ { ++ if (this->_M_name_messages != locale::facet::_S_get_c_name()) ++ delete [] this->_M_name_messages; ++ char* __tmp = new char[std::strlen(__s) + 1]; ++ std::strcpy(__tmp, __s); ++ this->_M_name_messages = __tmp; ++ ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ++ { ++ this->_S_destroy_c_locale(this->_M_c_locale_messages); ++ this->_S_create_c_locale(this->_M_c_locale_messages, __s); ++ } ++ } +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2005-04-28 01:23:02.000000000 -0500 +@@ -0,0 +1,692 @@ ++// std::moneypunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#define _LIBC ++#include <locale> ++#undef _LIBC ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning optimize this for uclibc ++#warning tailor for stub locale support ++#endif ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ // Construct and return valid pattern consisting of some combination of: ++ // space none symbol sign value ++ money_base::pattern ++ money_base::_S_construct_pattern(char __precedes, char __space, char __posn) ++ { ++ pattern __ret; ++ ++ // This insanely complicated routine attempts to construct a valid ++ // pattern for use with monyepunct. A couple of invariants: ++ ++ // if (__precedes) symbol -> value ++ // else value -> symbol ++ ++ // if (__space) space ++ // else none ++ ++ // none == never first ++ // space never first or last ++ ++ // Any elegant implementations of this are welcome. ++ switch (__posn) ++ { ++ case 0: ++ case 1: ++ // 1 The sign precedes the value and symbol. ++ __ret.field[0] = sign; ++ if (__space) ++ { ++ // Pattern starts with sign. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[3] = symbol; ++ } ++ __ret.field[2] = space; ++ } ++ else ++ { ++ // Pattern starts with sign and ends with none. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[3] = none; ++ } ++ break; ++ case 2: ++ // 2 The sign follows the value and symbol. ++ if (__space) ++ { ++ // Pattern either ends with sign. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[1] = space; ++ __ret.field[3] = sign; ++ } ++ else ++ { ++ // Pattern ends with sign then none. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[1] = symbol; ++ } ++ __ret.field[2] = sign; ++ __ret.field[3] = none; ++ } ++ break; ++ case 3: ++ // 3 The sign immediately precedes the symbol. ++ if (__precedes) ++ { ++ __ret.field[0] = sign; ++ __ret.field[1] = symbol; ++ if (__space) ++ { ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[2] = value; ++ __ret.field[3] = none; ++ } ++ } ++ else ++ { ++ __ret.field[0] = value; ++ if (__space) ++ { ++ __ret.field[1] = space; ++ __ret.field[2] = sign; ++ __ret.field[3] = symbol; ++ } ++ else ++ { ++ __ret.field[1] = sign; ++ __ret.field[2] = symbol; ++ __ret.field[3] = none; ++ } ++ } ++ break; ++ case 4: ++ // 4 The sign immediately follows the symbol. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = sign; ++ if (__space) ++ { ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[2] = value; ++ __ret.field[3] = none; ++ } ++ } ++ else ++ { ++ __ret.field[0] = value; ++ if (__space) ++ { ++ __ret.field[1] = space; ++ __ret.field[2] = symbol; ++ __ret.field[3] = sign; ++ } ++ else ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = sign; ++ __ret.field[3] = none; ++ } ++ } ++ break; ++ default: ++ __ret = pattern(); ++ } ++ return __ret; ++ } ++ ++ template<> ++ void ++ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<char, true>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = '.'; ++ _M_data->_M_thousands_sep = ','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = ""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = ""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = ""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i]; ++ } ++ else ++ { ++ // Named locale. ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, ++ __cloc)); ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, ++ __cloc)); ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign); ++ ++ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); ++ if (!__nposn) ++ _M_data->_M_negative_sign = "()"; ++ else ++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, ++ __cloc); ++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign); ++ ++ // _Intl == true ++ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); ++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol); ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, ++ __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ } ++ } ++ ++ template<> ++ void ++ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<char, false>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = '.'; ++ _M_data->_M_thousands_sep = ','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = ""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = ""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = ""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i]; ++ } ++ else ++ { ++ // Named locale. ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, ++ __cloc)); ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, ++ __cloc)); ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign); ++ ++ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); ++ if (!__nposn) ++ _M_data->_M_negative_sign = "()"; ++ else ++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, ++ __cloc); ++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign); ++ ++ // _Intl == false ++ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); ++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol); ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ } ++ } ++ ++ template<> ++ moneypunct<char, true>::~moneypunct() ++ { delete _M_data; } ++ ++ template<> ++ moneypunct<char, false>::~moneypunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ const char*) ++#else ++ const char* __name) ++#endif ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<wchar_t, true>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = L'.'; ++ _M_data->_M_thousands_sep = L','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ // Use ctype::widen code without the facet... ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ _M_data->_M_atoms[__i] = ++ static_cast<wchar_t>(money_base::_S_atoms[__i]); ++ } ++ else ++ { ++ // Named locale. ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(__cloc); ++#else ++ // Switch to named locale so that mbsrtowcs will work. ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, __name); ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this... should be monetary ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# else ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); ++ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); ++ ++ wchar_t* __wcs_ps = 0; ++ wchar_t* __wcs_ns = 0; ++ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); ++ try ++ { ++ mbstate_t __state; ++ size_t __len = strlen(__cpossign); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ps = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); ++ _M_data->_M_positive_sign = __wcs_ps; ++ } ++ else ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); ++ ++ __len = strlen(__cnegsign); ++ if (!__nposn) ++ _M_data->_M_negative_sign = L"()"; ++ else if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ns = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); ++ _M_data->_M_negative_sign = __wcs_ns; ++ } ++ else ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); ++ ++ // _Intl == true. ++ __len = strlen(__ccurr); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state); ++ _M_data->_M_curr_symbol = __wcs; ++ } ++ else ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); ++ } ++ catch (...) ++ { ++ delete _M_data; ++ _M_data = 0; ++ delete __wcs_ps; ++ delete __wcs_ns; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ __throw_exception_again; ++ } ++ ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, ++ __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ } ++ } ++ ++ template<> ++ void ++ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ const char*) ++#else ++ const char* __name) ++#endif ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<wchar_t, false>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = L'.'; ++ _M_data->_M_thousands_sep = L','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ // Use ctype::widen code without the facet... ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ _M_data->_M_atoms[__i] = ++ static_cast<wchar_t>(money_base::_S_atoms[__i]); ++ } ++ else ++ { ++ // Named locale. ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(__cloc); ++#else ++ // Switch to named locale so that mbsrtowcs will work. ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, __name); ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this... should be monetary ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# else ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); ++ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); ++ ++ wchar_t* __wcs_ps = 0; ++ wchar_t* __wcs_ns = 0; ++ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); ++ try ++ { ++ mbstate_t __state; ++ size_t __len; ++ __len = strlen(__cpossign); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ps = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); ++ _M_data->_M_positive_sign = __wcs_ps; ++ } ++ else ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); ++ ++ __len = strlen(__cnegsign); ++ if (!__nposn) ++ _M_data->_M_negative_sign = L"()"; ++ else if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ns = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); ++ _M_data->_M_negative_sign = __wcs_ns; ++ } ++ else ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); ++ ++ // _Intl == true. ++ __len = strlen(__ccurr); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state); ++ _M_data->_M_curr_symbol = __wcs; ++ } ++ else ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); ++ } ++ catch (...) ++ { ++ delete _M_data; ++ _M_data = 0; ++ delete __wcs_ps; ++ delete __wcs_ns; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ __throw_exception_again; ++ } ++ ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ } ++ } ++ ++ template<> ++ moneypunct<wchar_t, true>::~moneypunct() ++ { ++ if (_M_data->_M_positive_sign_size) ++ delete [] _M_data->_M_positive_sign; ++ if (_M_data->_M_negative_sign_size ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0) ++ delete [] _M_data->_M_negative_sign; ++ if (_M_data->_M_curr_symbol_size) ++ delete [] _M_data->_M_curr_symbol; ++ delete _M_data; ++ } ++ ++ template<> ++ moneypunct<wchar_t, false>::~moneypunct() ++ { ++ if (_M_data->_M_positive_sign_size) ++ delete [] _M_data->_M_positive_sign; ++ if (_M_data->_M_negative_sign_size ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0) ++ delete [] _M_data->_M_negative_sign; ++ if (_M_data->_M_curr_symbol_size) ++ delete [] _M_data->_M_curr_symbol; ++ delete _M_data; ++ } ++#endif ++} +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2005-04-28 01:20:20.000000000 -0500 +@@ -0,0 +1,173 @@ ++// std::numpunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#define _LIBC ++#include <locale> ++#undef _LIBC ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning tailor for stub locale support ++#endif ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache<char>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_use_grouping = false; ++ ++ _M_data->_M_decimal_point = '.'; ++ _M_data->_M_thousands_sep = ','; ++ ++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) ++ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i]; ++ ++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j) ++ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j]; ++ } ++ else ++ { ++ // Named locale. ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT, ++ __cloc)); ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP, ++ __cloc)); ++ ++ // Check for NULL, which implies no grouping. ++ if (_M_data->_M_thousands_sep == '\0') ++ _M_data->_M_grouping = ""; ++ else ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ } ++ ++ // NB: There is no way to extact this info from posix locales. ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); ++ _M_data->_M_truename = "true"; ++ _M_data->_M_truename_size = 4; ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); ++ _M_data->_M_falsename = "false"; ++ _M_data->_M_falsename_size = 5; ++ } ++ ++ template<> ++ numpunct<char>::~numpunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache<wchar_t>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_use_grouping = false; ++ ++ _M_data->_M_decimal_point = L'.'; ++ _M_data->_M_thousands_sep = L','; ++ ++ // Use ctype::widen code without the facet... ++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) ++ _M_data->_M_atoms_out[__i] = ++ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]); ++ ++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j) ++ _M_data->_M_atoms_in[__j] = ++ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]); ++ } ++ else ++ { ++ // Named locale. ++ // NB: In the GNU model wchar_t is always 32 bit wide. ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# else ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ ++ if (_M_data->_M_thousands_sep == L'\0') ++ _M_data->_M_grouping = ""; ++ else ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ } ++ ++ // NB: There is no way to extact this info from posix locales. ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); ++ _M_data->_M_truename = L"true"; ++ _M_data->_M_truename_size = 4; ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); ++ _M_data->_M_falsename = L"false"; ++ _M_data->_M_falsename_size = 5; ++ } ++ ++ template<> ++ numpunct<wchar_t>::~numpunct() ++ { delete _M_data; } ++ #endif ++} +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,406 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning tailor for stub locale support ++#endif ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ __timepunct<char>:: ++ _M_put(char* __s, size_t __maxlen, const char* __format, ++ const tm* __tm) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm, ++ _M_c_locale_timepunct); ++#else ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_timepunct); ++ const size_t __len = strftime(__s, __maxlen, __format, __tm); ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ // Make sure __s is null terminated. ++ if (__len == 0) ++ __s[0] = '\0'; ++ } ++ ++ template<> ++ void ++ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache<char>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = "%m/%d/%y"; ++ _M_data->_M_date_era_format = "%m/%d/%y"; ++ _M_data->_M_time_format = "%H:%M:%S"; ++ _M_data->_M_time_era_format = "%H:%M:%S"; ++ _M_data->_M_date_time_format = ""; ++ _M_data->_M_date_time_era_format = ""; ++ _M_data->_M_am = "AM"; ++ _M_data->_M_pm = "PM"; ++ _M_data->_M_am_pm_format = ""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = "Sunday"; ++ _M_data->_M_day2 = "Monday"; ++ _M_data->_M_day3 = "Tuesday"; ++ _M_data->_M_day4 = "Wednesday"; ++ _M_data->_M_day5 = "Thursday"; ++ _M_data->_M_day6 = "Friday"; ++ _M_data->_M_day7 = "Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = "Sun"; ++ _M_data->_M_aday2 = "Mon"; ++ _M_data->_M_aday3 = "Tue"; ++ _M_data->_M_aday4 = "Wed"; ++ _M_data->_M_aday5 = "Thu"; ++ _M_data->_M_aday6 = "Fri"; ++ _M_data->_M_aday7 = "Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = "January"; ++ _M_data->_M_month02 = "February"; ++ _M_data->_M_month03 = "March"; ++ _M_data->_M_month04 = "April"; ++ _M_data->_M_month05 = "May"; ++ _M_data->_M_month06 = "June"; ++ _M_data->_M_month07 = "July"; ++ _M_data->_M_month08 = "August"; ++ _M_data->_M_month09 = "September"; ++ _M_data->_M_month10 = "October"; ++ _M_data->_M_month11 = "November"; ++ _M_data->_M_month12 = "December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = "Jan"; ++ _M_data->_M_amonth02 = "Feb"; ++ _M_data->_M_amonth03 = "Mar"; ++ _M_data->_M_amonth04 = "Apr"; ++ _M_data->_M_amonth05 = "May"; ++ _M_data->_M_amonth06 = "Jun"; ++ _M_data->_M_amonth07 = "Jul"; ++ _M_data->_M_amonth08 = "Aug"; ++ _M_data->_M_amonth09 = "Sep"; ++ _M_data->_M_amonth10 = "Oct"; ++ _M_data->_M_amonth11 = "Nov"; ++ _M_data->_M_amonth12 = "Dec"; ++ } ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc); ++ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc); ++ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc); ++ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc); ++ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc); ++ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT, ++ __cloc); ++ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc); ++ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc); ++ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc); ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc); ++ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc); ++ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc); ++ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc); ++ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc); ++ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc); ++ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc); ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc); ++ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc); ++ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc); ++ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc); ++ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc); ++ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc); ++ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc); ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc); ++ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc); ++ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc); ++ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc); ++ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc); ++ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc); ++ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc); ++ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc); ++ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc); ++ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc); ++ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc); ++ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc); ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc); ++ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc); ++ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc); ++ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc); ++ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc); ++ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc); ++ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc); ++ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc); ++ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc); ++ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc); ++ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc); ++ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc); ++ } ++ } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ __timepunct<wchar_t>:: ++ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format, ++ const tm* __tm) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct); ++ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm, ++ _M_c_locale_timepunct); ++#else ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_timepunct); ++ const size_t __len = wcsftime(__s, __maxlen, __format, __tm); ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ // Make sure __s is null terminated. ++ if (__len == 0) ++ __s[0] = L'\0'; ++ } ++ ++ template<> ++ void ++ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache<wchar_t>; ++ ++#warning wide time stuff ++// if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = L"%m/%d/%y"; ++ _M_data->_M_date_era_format = L"%m/%d/%y"; ++ _M_data->_M_time_format = L"%H:%M:%S"; ++ _M_data->_M_time_era_format = L"%H:%M:%S"; ++ _M_data->_M_date_time_format = L""; ++ _M_data->_M_date_time_era_format = L""; ++ _M_data->_M_am = L"AM"; ++ _M_data->_M_pm = L"PM"; ++ _M_data->_M_am_pm_format = L""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = L"Sunday"; ++ _M_data->_M_day2 = L"Monday"; ++ _M_data->_M_day3 = L"Tuesday"; ++ _M_data->_M_day4 = L"Wednesday"; ++ _M_data->_M_day5 = L"Thursday"; ++ _M_data->_M_day6 = L"Friday"; ++ _M_data->_M_day7 = L"Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = L"Sun"; ++ _M_data->_M_aday2 = L"Mon"; ++ _M_data->_M_aday3 = L"Tue"; ++ _M_data->_M_aday4 = L"Wed"; ++ _M_data->_M_aday5 = L"Thu"; ++ _M_data->_M_aday6 = L"Fri"; ++ _M_data->_M_aday7 = L"Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = L"January"; ++ _M_data->_M_month02 = L"February"; ++ _M_data->_M_month03 = L"March"; ++ _M_data->_M_month04 = L"April"; ++ _M_data->_M_month05 = L"May"; ++ _M_data->_M_month06 = L"June"; ++ _M_data->_M_month07 = L"July"; ++ _M_data->_M_month08 = L"August"; ++ _M_data->_M_month09 = L"September"; ++ _M_data->_M_month10 = L"October"; ++ _M_data->_M_month11 = L"November"; ++ _M_data->_M_month12 = L"December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = L"Jan"; ++ _M_data->_M_amonth02 = L"Feb"; ++ _M_data->_M_amonth03 = L"Mar"; ++ _M_data->_M_amonth04 = L"Apr"; ++ _M_data->_M_amonth05 = L"May"; ++ _M_data->_M_amonth06 = L"Jun"; ++ _M_data->_M_amonth07 = L"Jul"; ++ _M_data->_M_amonth08 = L"Aug"; ++ _M_data->_M_amonth09 = L"Sep"; ++ _M_data->_M_amonth10 = L"Oct"; ++ _M_data->_M_amonth11 = L"Nov"; ++ _M_data->_M_amonth12 = L"Dec"; ++ } ++#if 0 ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ union { char *__s; wchar_t *__w; } __u; ++ ++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); ++ _M_data->_M_date_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); ++ _M_data->_M_date_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); ++ _M_data->_M_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); ++ _M_data->_M_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); ++ _M_data->_M_date_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); ++ _M_data->_M_date_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); ++ _M_data->_M_am = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); ++ _M_data->_M_pm = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); ++ _M_data->_M_am_pm_format = __u.__w; ++ ++ // Day names, starting with "C"'s Sunday. ++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); ++ _M_data->_M_day1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); ++ _M_data->_M_day2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); ++ _M_data->_M_day3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); ++ _M_data->_M_day4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); ++ _M_data->_M_day5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); ++ _M_data->_M_day6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); ++ _M_data->_M_day7 = __u.__w; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); ++ _M_data->_M_aday1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); ++ _M_data->_M_aday2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); ++ _M_data->_M_aday3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); ++ _M_data->_M_aday4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); ++ _M_data->_M_aday5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); ++ _M_data->_M_aday6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); ++ _M_data->_M_aday7 = __u.__w; ++ ++ // Month names, starting with "C"'s January. ++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); ++ _M_data->_M_month01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); ++ _M_data->_M_month02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); ++ _M_data->_M_month03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); ++ _M_data->_M_month04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); ++ _M_data->_M_month05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); ++ _M_data->_M_month06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); ++ _M_data->_M_month07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); ++ _M_data->_M_month08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); ++ _M_data->_M_month09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); ++ _M_data->_M_month10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); ++ _M_data->_M_month11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); ++ _M_data->_M_month12 = __u.__w; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); ++ _M_data->_M_amonth01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); ++ _M_data->_M_amonth02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); ++ _M_data->_M_amonth03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); ++ _M_data->_M_amonth04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); ++ _M_data->_M_amonth05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); ++ _M_data->_M_amonth06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); ++ _M_data->_M_amonth07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); ++ _M_data->_M_amonth08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); ++ _M_data->_M_amonth09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); ++ _M_data->_M_amonth10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); ++ _M_data->_M_amonth11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); ++ _M_data->_M_amonth12 = __u.__w; ++ } ++#endif // 0 ++ } ++#endif ++} +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.h 2004-05-22 18:46:31.000000000 -0500 +@@ -0,0 +1,68 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::__timepunct(size_t __refs) ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), ++ _M_name_timepunct(_S_get_c_name()) ++ { _M_initialize_timepunct(); } ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) ++ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL), ++ _M_name_timepunct(_S_get_c_name()) ++ { _M_initialize_timepunct(); } ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, ++ size_t __refs) ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), ++ _M_name_timepunct(__s) ++ { ++ char* __tmp = new char[std::strlen(__s) + 1]; ++ std::strcpy(__tmp, __s); ++ _M_name_timepunct = __tmp; ++ _M_initialize_timepunct(__cloc); ++ } ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::~__timepunct() ++ { ++ if (_M_name_timepunct != _S_get_c_name()) ++ delete [] _M_name_timepunct; ++ delete _M_data; ++ _S_destroy_c_locale(_M_c_locale_timepunct); ++ } +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_base.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_base.h 2005-04-28 01:10:27.000000000 -0500 +@@ -0,0 +1,64 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++/** @file ctype_base.h ++ * This is an internal header file, included by other library headers. ++ * You should not attempt to use it directly. ++ */ ++ ++// Information as gleaned from /usr/include/ctype.h ++ ++ /// @brief Base class for ctype. ++ struct ctype_base ++ { ++ // Note: In uClibc, the following two types depend on configuration. ++ ++ // Non-standard typedefs. ++ typedef const __ctype_touplow_t* __to_type; ++ ++ // NB: Offsets into ctype<char>::_M_table force a particular size ++ // on the mask type. Because of this, we don't use an enum. ++ typedef __ctype_mask_t mask; ++ static const mask upper = _ISupper; ++ static const mask lower = _ISlower; ++ static const mask alpha = _ISalpha; ++ static const mask digit = _ISdigit; ++ static const mask xdigit = _ISxdigit; ++ static const mask space = _ISspace; ++ static const mask print = _ISprint; ++ static const mask graph = _ISalpha | _ISdigit | _ISpunct; ++ static const mask cntrl = _IScntrl; ++ static const mask punct = _ISpunct; ++ static const mask alnum = _ISalpha | _ISdigit; ++ }; +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_inline.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_inline.h 2002-06-24 00:49:19.000000000 -0500 +@@ -0,0 +1,69 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 2000, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) ++// functions go in ctype.cc ++ ++ bool ++ ctype<char>:: ++ is(mask __m, char __c) const ++ { return _M_table[static_cast<unsigned char>(__c)] & __m; } ++ ++ const char* ++ ctype<char>:: ++ is(const char* __low, const char* __high, mask* __vec) const ++ { ++ while (__low < __high) ++ *__vec++ = _M_table[static_cast<unsigned char>(*__low++)]; ++ return __high; ++ } ++ ++ const char* ++ ctype<char>:: ++ scan_is(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && !(_M_table[static_cast<unsigned char>(*__low)] & __m)) ++ ++__low; ++ return __low; ++ } ++ ++ const char* ++ ctype<char>:: ++ scan_not(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0) ++ ++__low; ++ return __low; ++ } +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2005-04-28 01:10:27.000000000 -0500 +@@ -0,0 +1,92 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// Information as gleaned from /usr/include/ctype.h ++ ++ const ctype_base::mask* ++ ctype<char>::classic_table() throw() ++ { return __C_ctype_b; } ++ ++ ctype<char>::ctype(__c_locale, const mask* __table, bool __del, ++ size_t __refs) ++ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), ++ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0) ++ { ++ _M_toupper = __C_ctype_toupper; ++ _M_tolower = __C_ctype_tolower; ++ _M_table = __table ? __table : __C_ctype_b; ++ memset(_M_widen, 0, sizeof(_M_widen)); ++ memset(_M_narrow, 0, sizeof(_M_narrow)); ++ } ++ ++ ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) ++ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), ++ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0) ++ { ++ _M_toupper = __C_ctype_toupper; ++ _M_tolower = __C_ctype_tolower; ++ _M_table = __table ? __table : __C_ctype_b; ++ memset(_M_widen, 0, sizeof(_M_widen)); ++ memset(_M_narrow, 0, sizeof(_M_narrow)); ++ } ++ ++ char ++ ctype<char>::do_toupper(char __c) const ++ { return _M_toupper[static_cast<unsigned char>(__c)]; } ++ ++ const char* ++ ctype<char>::do_toupper(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_toupper[static_cast<unsigned char>(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } ++ ++ char ++ ctype<char>::do_tolower(char __c) const ++ { return _M_tolower[static_cast<unsigned char>(__c)]; } ++ ++ const char* ++ ctype<char>::do_tolower(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_tolower[static_cast<unsigned char>(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/os_defines.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/os_defines.h 2005-04-28 01:10:27.000000000 -0500 +@@ -0,0 +1,44 @@ ++// Specific definitions for GNU/Linux -*- C++ -*- ++ ++// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++#ifndef _GLIBCXX_OS_DEFINES ++#define _GLIBCXX_OS_DEFINES 1 ++ ++// System-specific #define, typedefs, corrections, etc, go here. This ++// file will come before all others. ++ ++// This keeps isanum, et al from being propagated as macros. ++#define __NO_CTYPE 1 ++ ++#include <features.h> ++ ++// We must not see the optimized string functions GNU libc defines. ++#define __NO_STRING_INLINES ++ ++#endif +diff -urN gcc-4.0.0-100/libstdc++-v3/configure gcc-4.0.0/libstdc++-v3/configure +--- gcc-4.0.0-100/libstdc++-v3/configure 2005-04-30 13:06:53.683055232 -0500 ++++ gcc-4.0.0/libstdc++-v3/configure 2005-04-30 12:24:24.000000000 -0500 +@@ -3998,6 +3998,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +@@ -5672,7 +5677,7 @@ + enableval="$enable_clocale" + + case "$enableval" in +- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;; ++ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;; + *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5 + echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;} + { (exit 1); exit 1; }; } ;; +@@ -5697,6 +5702,9 @@ + # Default to "generic". + if test $enable_clocale_flag = auto; then + case ${target_os} in ++ linux-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ +@@ -5927,6 +5935,76 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ echo "$as_me:$LINENO: result: uclibc" >&5 ++echo "${ECHO_T}uclibc" >&6 ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ # Extract the first word of "msgfmt", so it can be a program name with args. ++set dummy msgfmt; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test -n "$check_msgfmt"; then ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_check_msgfmt="yes" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" ++fi ++fi ++check_msgfmt=$ac_cv_prog_check_msgfmt ++if test -n "$check_msgfmt"; then ++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 ++echo "${ECHO_T}$check_msgfmt" >&6 ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ ++ ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -urN gcc-4.0.0-100/libstdc++-v3/configure.host gcc-4.0.0/libstdc++-v3/configure.host +--- gcc-4.0.0-100/libstdc++-v3/configure.host 2005-04-30 13:06:53.688054472 -0500 ++++ gcc-4.0.0/libstdc++-v3/configure.host 2005-04-28 20:20:32.000000000 -0500 +@@ -249,6 +249,12 @@ + ;; + esac + ++# Override for uClibc since linux-uclibc gets mishandled above. ++case "${host_os}" in ++ *-uclibc*) ++ os_include_dir="os/uclibc" ++ ;; ++esac + + # Set any OS-dependent and CPU-dependent bits. + # THIS TABLE IS SORTED. KEEP IT THAT WAY. +diff -urN gcc-4.0.0-100/libstdc++-v3/crossconfig.m4 gcc-4.0.0/libstdc++-v3/crossconfig.m4 +--- gcc-4.0.0-100/libstdc++-v3/crossconfig.m4 2005-04-30 13:06:53.689054320 -0500 ++++ gcc-4.0.0/libstdc++-v3/crossconfig.m4 2005-04-28 20:27:15.000000000 -0500 +@@ -142,6 +142,98 @@ + ;; + esac + ;; ++ *-uclibc*) ++# Temporary hack until we implement the float versions of the libm funcs ++ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ ++ machine/endian.h machine/param.h sys/machine.h sys/types.h \ ++ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h]) ++ SECTION_FLAGS='-ffunction-sections -fdata-sections' ++ AC_SUBST(SECTION_FLAGS) ++ GLIBCXX_CHECK_LINKER_FEATURES ++ GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT ++ GLIBCXX_CHECK_WCHAR_T_SUPPORT ++ ++ # For LFS. ++ AC_DEFINE(HAVE_INT64_T) ++ case "$target" in ++ *-uclinux*) ++ # Don't enable LFS with uClinux ++ ;; ++ *) ++ AC_DEFINE(_GLIBCXX_USE_LFS) ++ esac ++ ++ # For showmanyc_helper(). ++ AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) ++ GLIBCXX_CHECK_POLL ++ GLIBCXX_CHECK_S_ISREG_OR_S_IFREG ++ ++ # For xsputn_2(). ++ AC_CHECK_HEADERS(sys/uio.h) ++ GLIBCXX_CHECK_WRITEV ++ ++# AC_DEFINE(HAVE_ACOSF) ++# AC_DEFINE(HAVE_ASINF) ++# AC_DEFINE(HAVE_ATANF) ++# AC_DEFINE(HAVE_ATAN2F) ++ AC_DEFINE(HAVE_CEILF) ++ AC_DEFINE(HAVE_COPYSIGN) ++# AC_DEFINE(HAVE_COPYSIGNF) ++# AC_DEFINE(HAVE_COSF) ++# AC_DEFINE(HAVE_COSHF) ++# AC_DEFINE(HAVE_EXPF) ++# AC_DEFINE(HAVE_FABSF) ++ AC_DEFINE(HAVE_FINITE) ++ AC_DEFINE(HAVE_FINITEF) ++ AC_DEFINE(HAVE_FLOORF) ++# AC_DEFINE(HAVE_FMODF) ++# AC_DEFINE(HAVE_FREXPF) ++ AC_DEFINE(HAVE_HYPOT) ++# AC_DEFINE(HAVE_HYPOTF) ++ AC_DEFINE(HAVE_ISINF) ++ AC_DEFINE(HAVE_ISINFF) ++ AC_DEFINE(HAVE_ISNAN) ++ AC_DEFINE(HAVE_ISNANF) ++# AC_DEFINE(HAVE_LOGF) ++# AC_DEFINE(HAVE_LOG10F) ++# AC_DEFINE(HAVE_MODFF) ++# AC_DEFINE(HAVE_SINF) ++# AC_DEFINE(HAVE_SINHF) ++# AC_DEFINE(HAVE_SINCOS) ++# AC_DEFINE(HAVE_SINCOSF) ++ AC_DEFINE(HAVE_SQRTF) ++# AC_DEFINE(HAVE_TANF) ++# AC_DEFINE(HAVE_TANHF) ++ if test x"long_double_math_on_this_cpu" = x"yes"; then ++# AC_DEFINE(HAVE_ACOSL) ++# AC_DEFINE(HAVE_ASINL) ++# AC_DEFINE(HAVE_ATANL) ++# AC_DEFINE(HAVE_ATAN2L) ++# AC_DEFINE(HAVE_CEILL) ++# AC_DEFINE(HAVE_COPYSIGNL) ++# AC_DEFINE(HAVE_COSL) ++# AC_DEFINE(HAVE_COSHL) ++# AC_DEFINE(HAVE_EXPL) ++# AC_DEFINE(HAVE_FABSL) ++# AC_DEFINE(HAVE_FINITEL) ++# AC_DEFINE(HAVE_FLOORL) ++# AC_DEFINE(HAVE_FMODL) ++# AC_DEFINE(HAVE_FREXPL) ++# AC_DEFINE(HAVE_HYPOTL) ++# AC_DEFINE(HAVE_ISINFL) ++# AC_DEFINE(HAVE_ISNANL) ++# AC_DEFINE(HAVE_LOGL) ++# AC_DEFINE(HAVE_LOG10L) ++# AC_DEFINE(HAVE_MODFL) ++# AC_DEFINE(HAVE_POWL) ++# AC_DEFINE(HAVE_SINL) ++# AC_DEFINE(HAVE_SINHL) ++# AC_DEFINE(HAVE_SINCOSL) ++# AC_DEFINE(HAVE_SQRTL) ++# AC_DEFINE(HAVE_TANL) ++# AC_DEFINE(HAVE_TANHL) ++ fi ++ ;; + *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu) + AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ + machine/endian.h machine/param.h sys/machine.h sys/types.h \ +@@ -156,7 +248,7 @@ + AC_DEFINE(HAVE_INT64_T) + case "$target" in + *-uclinux*) +- # Don't enable LFS with uClibc ++ # Don't enable LFS with uClinux + ;; + *) + AC_DEFINE(_GLIBCXX_USE_LFS) +diff -urN gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h +--- gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h 2005-04-30 13:06:53.690054168 -0500 ++++ gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h 2005-04-28 20:15:56.000000000 -0500 +@@ -101,7 +101,9 @@ + using std::wmemcpy; + using std::wmemmove; + using std::wmemset; ++#if _GLIBCXX_HAVE_WCSFTIME + using std::wcsftime; ++#endif + + #if _GLIBCXX_USE_C99 + using std::wcstold; +diff -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 +--- gcc-4.0.0-100/libstdc++-v3/include/c_std/std_cwchar.h 2005-04-30 13:06:53.691054016 -0500 ++++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cwchar.h 2005-04-28 20:15:56.000000000 -0500 +@@ -179,7 +179,9 @@ + using ::wcscoll; + using ::wcscpy; + using ::wcscspn; ++#if _GLIBCXX_HAVE_WCSFTIME + using ::wcsftime; ++#endif + using ::wcslen; + using ::wcsncat; + using ::wcsncmp; diff --git a/patches/gcc/4.0.4/300-libstdc++-pic.patch b/patches/gcc/4.0.4/300-libstdc++-pic.patch new file mode 100644 index 00000000..a9d6e718 --- /dev/null +++ b/patches/gcc/4.0.4/300-libstdc++-pic.patch @@ -0,0 +1,45 @@ +--- gcc-4.0.0/libstdc++-v3/src/Makefile.am ++++ gcc-4.0.0/libstdc++-v3/src/Makefile.am +@@ -214,6 +214,10 @@ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ + + ++install-exec-local: ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++ + # Added bits to build debug library. + if GLIBCXX_BUILD_DEBUG + all-local: build_debug +--- gcc-4.0.0/libstdc++-v3/src/Makefile.in ++++ gcc-4.0.0/libstdc++-v3/src/Makefile.in +@@ -625,7 +625,7 @@ + + install-data-am: install-data-local + +-install-exec-am: install-toolexeclibLTLIBRARIES ++install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local + + install-info: install-info-am + +@@ -664,7 +664,7 @@ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ +- uninstall-toolexeclibLTLIBRARIES ++ uninstall-toolexeclibLTLIBRARIES install-exec-local + + @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP) + @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver +@@ -743,6 +743,11 @@ + install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ++ ++install-exec-local: ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff --git a/patches/gcc/4.0.4/301-missing-execinfo_h.patch b/patches/gcc/4.0.4/301-missing-execinfo_h.patch new file mode 100644 index 00000000..0e2092f3 --- /dev/null +++ b/patches/gcc/4.0.4/301-missing-execinfo_h.patch @@ -0,0 +1,11 @@ +--- gcc-4.0.0/boehm-gc/include/gc.h-orig 2005-04-28 22:28:57.000000000 -0500 ++++ gcc-4.0.0/boehm-gc/include/gc.h 2005-04-28 22:30:38.000000000 -0500 +@@ -500,7 +500,7 @@ + #ifdef __linux__ + # include <features.h> + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/patches/gcc/4.0.4/302-c99-snprintf.patch b/patches/gcc/4.0.4/302-c99-snprintf.patch new file mode 100644 index 00000000..dfb22d68 --- /dev/null +++ b/patches/gcc/4.0.4/302-c99-snprintf.patch @@ -0,0 +1,11 @@ +--- gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h-orig 2005-04-29 00:08:41.000000000 -0500 ++++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h 2005-04-29 00:08:45.000000000 -0500 +@@ -142,7 +142,7 @@ + using ::vsprintf; + } + +-#if _GLIBCXX_USE_C99 ++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf diff --git a/patches/gcc/4.0.4/303-c99-complex-ugly-hack.patch b/patches/gcc/4.0.4/303-c99-complex-ugly-hack.patch new file mode 100644 index 00000000..2ccc80d9 --- /dev/null +++ b/patches/gcc/4.0.4/303-c99-complex-ugly-hack.patch @@ -0,0 +1,12 @@ +--- gcc-4.0.0/libstdc++-v3/configure-old 2005-04-30 22:04:48.061603912 -0500 ++++ gcc-4.0.0/libstdc++-v3/configure 2005-04-30 22:06:13.678588152 -0500 +@@ -7194,6 +7194,9 @@ + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + #include <complex.h> ++#ifdef __UCLIBC__ ++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs ++#endif + int + main () + { diff --git a/patches/gcc/4.0.4/304-index_macro.patch b/patches/gcc/4.0.4/304-index_macro.patch new file mode 100644 index 00000000..1fac112f --- /dev/null +++ b/patches/gcc/4.0.4/304-index_macro.patch @@ -0,0 +1,24 @@ +--- gcc-4.1.0/libstdc++-v3/include/ext/rope.mps 2006-03-24 01:49:51 +0100 ++++ gcc-4.1.0/libstdc++-v3/include/ext/rope 2006-03-24 01:49:37 +0100 +@@ -59,6 +59,9 @@ + #include <bits/allocator.h> + #include <ext/hash_fun.h> + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + # ifdef __GC + # define __GC_CONST const + # else +--- gcc-4.1.0/libstdc++-v3/include/ext/ropeimpl.h.mps 2006-03-24 01:50:04 +0100 ++++ gcc-4.1.0/libstdc++-v3/include/ext/ropeimpl.h 2006-03-24 01:50:28 +0100 +@@ -53,6 +53,9 @@ + #include <ext/memory> // For uninitialized_copy_n + #include <ext/numeric> // For power + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + namespace __gnu_cxx + { + using std::size_t; diff --git a/patches/gcc/4.0.4/602-sdk-libstdc++-includes.patch b/patches/gcc/4.0.4/602-sdk-libstdc++-includes.patch new file mode 100644 index 00000000..c7676ae6 --- /dev/null +++ b/patches/gcc/4.0.4/602-sdk-libstdc++-includes.patch @@ -0,0 +1,22 @@ +diff -urN gcc-4.0.0-100/libstdc++-v3/fragment.am gcc-4.0.0/libstdc++-v3/fragment.am +--- gcc-4.0.0-100/libstdc++-v3/fragment.am 2004-10-25 15:32:40.000000000 -0500 ++++ gcc-4.0.0/libstdc++-v3/fragment.am 2005-04-28 21:48:43.000000000 -0500 +@@ -18,5 +18,5 @@ + $(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once + + # -I/-D flags to pass when compiling. +-AM_CPPFLAGS = $(GLIBCXX_INCLUDES) ++AM_CPPFLAGS = $(GLIBCXX_INCLUDES) -I$(toplevel_srcdir)/include + +diff -urN gcc-4.0.0-100/libstdc++-v3/libmath/Makefile.am gcc-4.0.0/libstdc++-v3/libmath/Makefile.am +--- gcc-4.0.0-100/libstdc++-v3/libmath/Makefile.am 2003-08-27 16:29:42.000000000 -0500 ++++ gcc-4.0.0/libstdc++-v3/libmath/Makefile.am 2005-04-28 21:48:43.000000000 -0500 +@@ -32,7 +32,7 @@ + + libmath_la_SOURCES = stubs.c + +-AM_CPPFLAGS = $(CANADIAN_INCLUDES) ++AM_CPPFLAGS = $(CANADIAN_INCLUDES) -I$(toplevel_srcdir)/include + + # Only compiling "C" sources in this directory. + LIBTOOL = @LIBTOOL@ --tag CC diff --git a/patches/gcc/4.0.4/800-arm-bigendian.patch b/patches/gcc/4.0.4/800-arm-bigendian.patch new file mode 100644 index 00000000..fd2c9bfc --- /dev/null +++ b/patches/gcc/4.0.4/800-arm-bigendian.patch @@ -0,0 +1,65 @@ +diff -dur gcc-4.0.4.orig/gcc/config/arm/linux-elf.h gcc-4.0.4/gcc/config/arm/linux-elf.h +--- gcc-4.0.4.orig/gcc/config/arm/linux-elf.h 2007-02-02 19:24:50.000000000 +0100 ++++ gcc-4.0.4/gcc/config/arm/linux-elf.h 2007-02-02 19:26:12.000000000 +0100 +@@ -31,19 +31,33 @@ + /* Do not assume anything about header files. */ + #define NO_IMPLICIT_EXTERN_C + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END ++#define TARGET_ENDIAN_OPTION "mbig-endian" ++#define TARGET_LINKER_EMULATION "armelfb_linux" ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#define TARGET_ENDIAN_OPTION "mlittle-endian" ++#define TARGET_LINKER_EMULATION "armelf_linux" ++#endif ++ + #undef TARGET_DEFAULT_FLOAT_ABI + #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD + + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (0) ++#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT) + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" } + + /* The GNU C++ standard library requires that these macros be defined. */ + #undef CPLUSPLUS_CPP_SPEC +@@ -95,7 +109,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #define TARGET_OS_CPP_BUILTINS() \ +Only in gcc-4.0.4/gcc/config/arm: linux-elf.h.orig +diff -dur gcc-4.0.4.orig/gcc/config.gcc gcc-4.0.4/gcc/config.gcc +--- gcc-4.0.4.orig/gcc/config.gcc 2007-02-02 19:24:50.000000000 +0100 ++++ gcc-4.0.4/gcc/config.gcc 2007-02-02 19:26:12.000000000 +0100 +@@ -672,6 +672,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + 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" ++ case $target in ++ arm*b-*) ++ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" ++ ;; ++ esac + tmake_file="${tmake_file} arm/t-arm arm/t-linux" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes diff --git a/patches/gcc/4.0.4/801-arm-softfloat.patch b/patches/gcc/4.0.4/801-arm-softfloat.patch new file mode 100644 index 00000000..9ae921e3 --- /dev/null +++ b/patches/gcc/4.0.4/801-arm-softfloat.patch @@ -0,0 +1,14 @@ +Enable building a pure soft-float compiler without the need for libfloat. + +diff -dur gcc-4.0.4.orig/gcc/config.gcc gcc-4.0.4/gcc/config.gcc +--- gcc-4.0.4.orig/gcc/config.gcc 2007-02-02 19:12:28.000000000 +0100 ++++ gcc-4.0.4/gcc/config.gcc 2007-02-02 19:12:07.000000000 +0100 +@@ -677,7 +677,7 @@ + tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" + ;; + esac +- tmake_file="${tmake_file} arm/t-arm arm/t-linux" ++ tmake_file="${tmake_file} arm/t-arm arm/t-linux arm/t-arm-elf" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes + ;; diff --git a/patches/gcc/4.1.0/gcc-4.1-fix-fixincl.patch b/patches/gcc/4.1.0/gcc-4.1-fix-fixincl.patch new file mode 100644 index 00000000..39287056 --- /dev/null +++ b/patches/gcc/4.1.0/gcc-4.1-fix-fixincl.patch @@ -0,0 +1,71 @@ +See http://gcc.gnu.org/PR22541 + +From: Dan Kegel + +When building gcc-3.4.3 or gcc-4.x into a clean $PREFIX, +the configure script happily copies the glibc include files from include to sys-include; +here's the line from the log file (with $PREFIX instead of the real prefix): + +Copying $PREFIX/i686-unknown-linux-gnu/include to $PREFIX/i686-unknown-linux-gnu/sys-include + +But later, when running fixincludes, it gives the error message + The directory that should contain system headers does not exist: + $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/../../../../i686-unknown-linux-gnu/sys-include + +Nevertheless, it continues building; the header files it installs in + $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/include +do not include the boilerplate that would cause it to #include_next the +glibc headers in the system header directory. +Thus the resulting toolchain can't compile the following program: +#include <limits.h> +int x = PATH_MAX; +because its limits.h doesn't include the glibc header. + +The problem is that gcc/Makefile.in assumes that +it can refer to $PREFIX/i686-unknown-linux-gnu with the path + $PREFIX/lib/../i686-unknown-linux-gnu, but +that fails because the directory $PREFIX/lib doesn't exist during 'make all'; +it is only created later, during 'make install'. (Which makes this problem +confusing, since one only notices the breakage well after 'make install', +at which point the path configure complained about does exist, and has the +right stuff in it.) + +A fix that I've been using for a while is to use sed to canonicalize +the path. The sed syntax is a bit obtuse, but it works. + +(hey, that's the first time I've ever used a label in a sed script; thanks to the sed faq +for explaining the :a ... ta method of looping to repeat a search-and-replace until it doesn't match.) + +[rediffed against gcc-4.1-20060210] + +--- gcc-4.1-20060210/gcc/Makefile.in.old 2006-01-11 06:29:29.000000000 -0800 ++++ gcc-4.1-20060210/gcc/Makefile.in 2006-02-14 16:08:54.000000000 -0800 +@@ -388,7 +388,10 @@ + CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ + + # autoconf sets SYSTEM_HEADER_DIR to one of the above. +-SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@ ++# Purge it of unneccessary internal relative paths ++# to directories that might not exist yet. ++# The sed idiom for this is to repeat the search-and-replace until it doesn't match, using :a ... ta. ++SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta` + + # Control whether to run fixproto and fixincludes. + STMP_FIXPROTO = @STMP_FIXPROTO@ +@@ -3167,13 +3170,15 @@ + ../$(build_subdir)/fixincludes/fixincl: ; @ : + + # Build fixed copies of system files. ++# Abort if no system headers available, unless building a crosscompiler. ++# Canonicalize $gcc_tooldir/sys-include in same way as $SYSTEM_HEADER_DIR was canonicalized so test still works + stmp-fixinc: gsyslimits.h macro_list \ + $(build_objdir)/fixincludes/fixincl \ + $(build_objdir)/fixincludes/fixinc.sh + @if ! $(inhibit_libc) && test ! -d ${SYSTEM_HEADER_DIR}; then \ + echo The directory that should contain system headers does not exist: >&2 ; \ + echo " ${SYSTEM_HEADER_DIR}" >&2 ; \ +- if test "x${SYSTEM_HEADER_DIR}" = "x${gcc_tooldir}/sys-include"; \ ++ if test "x${SYSTEM_HEADER_DIR}" = "x`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`"; \ + then sleep 1; else exit 1; fi; \ + fi + rm -rf include; mkdir include diff --git a/patches/gcc/4.1.1/100-uclibc-conf.patch b/patches/gcc/4.1.1/100-uclibc-conf.patch new file mode 100644 index 00000000..49d576c7 --- /dev/null +++ b/patches/gcc/4.1.1/100-uclibc-conf.patch @@ -0,0 +1,544 @@ +--- gcc-4.1.0/gcc/config/t-linux-uclibc ++++ gcc-4.1.0/gcc/config/t-linux-uclibc +@@ -0,0 +1,5 @@ ++# Remove glibc specific files added in t-linux ++SHLIB_MAPFILES := $(filter-out $(srcdir)/config/libgcc-glibc.ver, $(SHLIB_MAPFILES)) ++ ++# Use unwind-dw2-fde instead of unwind-dw2-fde-glibc ++LIB2ADDEH := $(subst unwind-dw2-fde-glibc.c,unwind-dw2-fde.c,$(LIB2ADDEH)) +--- gcc-4.1.0/gcc/config.gcc ++++ gcc-4.1.0/gcc/config.gcc +@@ -1887,7 +1887,7 @@ s390x-ibm-tpf*) + ;; + sh-*-elf* | sh[12346l]*-*-elf* | sh*-*-kaos* | \ + sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \ +- sh-*-linux* | sh[346lbe]*-*-linux* | \ ++ sh*-*-linux* | sh[346lbe]*-*-linux* | \ + sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \ + sh64-*-netbsd* | sh64l*-*-netbsd*) + tmake_file="${tmake_file} sh/t-sh sh/t-elf" +@@ -2341,6 +2341,12 @@ m32c-*-elf*) + ;; + esac + ++# Rather than hook into each target, just do it after all the linux ++# targets have been processed ++case ${target} in ++*-linux-uclibc*) tm_defines="${tm_defines} USE_UCLIBC" ; tmake_file="${tmake_file} t-linux-uclibc" ++esac ++ + case ${target} in + i[34567]86-*-linux*aout* | i[34567]86-*-linux*libc1) + tmake_file="${tmake_file} i386/t-gmm_malloc" +--- gcc-4.1.0/boehm-gc/configure ++++ gcc-4.1.0/boehm-gc/configure +@@ -4320,6 +4320,11 @@ linux-gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.1.0/configure ++++ gcc-4.1.0/configure +@@ -1133,7 +1133,7 @@ no) + ;; + "") + case "${target}" in +- *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu) ++ *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*) + # Enable libmudflap by default in GNU and friends. + ;; + *-*-freebsd*) +--- gcc-4.1.0/configure.in ++++ gcc-4.1.0/configure.in +@@ -341,7 +341,7 @@ no) + ;; + "") + case "${target}" in +- *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu) ++ *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*) + # Enable libmudflap by default in GNU and friends. + ;; + *-*-freebsd*) +--- gcc-4.1.0/contrib/regression/objs-gcc.sh ++++ gcc-4.1.0/contrib/regression/objs-gcc.sh +@@ -105,6 +105,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H + then + make all-gdb all-dejagnu all-ld || exit 1 + make install-gdb install-dejagnu install-ld || exit 1 ++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ] ++ then ++ make all-gdb all-dejagnu all-ld || exit 1 ++ make install-gdb install-dejagnu install-ld || exit 1 + elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then + make bootstrap || exit 1 + make install || exit 1 +--- gcc-4.1.0/gcc/config/alpha/linux-elf.h ++++ gcc-4.1.0/gcc/config/alpha/linux-elf.h +@@ -27,7 +27,11 @@ Boston, MA 02110-1301, USA. */ + #define SUBTARGET_EXTRA_SPECS \ + { "elf_dynamic_linker", ELF_DYNAMIC_LINKER }, + ++#if defined USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else + #define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + + #define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \ + %{O*:-O3} %{!O*:-O1} \ +--- gcc-4.1.0/gcc/config/arm/linux-elf.h ++++ gcc-4.1.0/gcc/config/arm/linux-elf.h +@@ -51,7 +51,11 @@ + + #define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" + ++#ifdef USE_UCLIBC ++#define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0" ++#else + #define LINUX_TARGET_INTERPRETER "/lib/ld-linux.so.2" ++#endif + + #define LINUX_TARGET_LINK_SPEC "%{h*} %{version:-v} \ + %{b} \ +--- gcc-4.1.0/gcc/config/cris/linux.h ++++ gcc-4.1.0/gcc/config/cris/linux.h +@@ -73,6 +73,25 @@ Boston, MA 02110-1301, USA. */ + #undef CRIS_DEFAULT_CPU_VERSION + #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG + ++#ifdef USE_UCLIBC ++ ++#undef CRIS_SUBTARGET_VERSION ++#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc" ++ ++#undef CRIS_LINK_SUBTARGET_SPEC ++#define CRIS_LINK_SUBTARGET_SPEC \ ++ "-mcrislinux\ ++ -rpath-link include/asm/../..%s\ ++ %{shared} %{static}\ ++ %{symbolic:-Bdynamic} %{shlib:-Bdynamic} %{static:-Bstatic}\ ++ %{!shared: \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} \ ++ %{!r:%{O2|O3: --gc-sections}}" ++ ++#else /* USE_UCLIBC */ ++ + #undef CRIS_SUBTARGET_VERSION + #define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu" + +@@ -87,6 +106,8 @@ Boston, MA 02110-1301, USA. */ + %{!shared:%{!static:%{rdynamic:-export-dynamic}}}\ + %{!r:%{O2|O3: --gc-sections}}" + ++#endif /* USE_UCLIBC */ ++ + + /* Node: Run-time Target */ + +--- gcc-4.1.0/gcc/config/i386/linux.h ++++ gcc-4.1.0/gcc/config/i386/linux.h +@@ -107,6 +107,11 @@ Boston, MA 02110-1301, USA. */ + #define LINK_EMULATION "elf_i386" + #define DYNAMIC_LINKER "/lib/ld-linux.so.2" + ++#if defined USE_UCLIBC ++#undef DYNAMIC_LINKER ++#define DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#endif ++ + #undef SUBTARGET_EXTRA_SPECS + #define SUBTARGET_EXTRA_SPECS \ + { "link_emulation", LINK_EMULATION },\ +--- gcc-4.1.0/gcc/config/i386/linux64.h ++++ gcc-4.1.0/gcc/config/i386/linux64.h +@@ -54,14 +54,21 @@ Boston, MA 02110-1301, USA. */ + When the -shared link option is used a final link is not being + done. */ + ++#ifdef USE_UCLIBC ++#define ELF32_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0" ++#else ++#define ELF32_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#define ELF64_DYNAMIC_LINKER "/lib64/ld-linux-x86-64.so.2" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \ + %{shared:-shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ +- %{!m32:%{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}}} \ ++ %{m32:%{!dynamic-linker:-dynamic-linker " ELF32_DYNAMIC_LINKER "}} \ ++ %{!m32:%{!dynamic-linker:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}} \ + %{static:-static}}" + + /* Similar to standard Linux, but adding -ffast-math support. */ +--- gcc-4.1.0/gcc/config/ia64/linux.h ++++ gcc-4.1.0/gcc/config/ia64/linux.h +@@ -37,13 +37,18 @@ do { \ + /* Define this for shared library support because it isn't in the main + linux.h file. */ + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "\ + %{shared:-shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux-ia64.so.2}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}" + + +--- gcc-4.1.0/gcc/config/m68k/linux.h ++++ gcc-4.1.0/gcc/config/m68k/linux.h +@@ -123,12 +123,17 @@ Boston, MA 02110-1301, USA. */ + + /* If ELF is the default format, we should not use /lib/elf. */ + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld.so.1" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "-m m68kelf %{shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker*:-dynamic-linker /lib/ld.so.1}} \ ++ %{!dynamic-linker*:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static}}" + + /* For compatibility with linux/a.out */ +--- gcc-4.1.0/gcc/config/mips/linux.h ++++ gcc-4.1.0/gcc/config/mips/linux.h +@@ -105,6 +105,11 @@ Boston, MA 02110-1301, USA. */ + + /* Borrowed from sparc/linux.h */ + #undef LINK_SPEC ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld.so.1" ++#endif + #define LINK_SPEC \ + "%(endian_spec) \ + %{shared:-shared} \ +@@ -112,7 +117,7 @@ Boston, MA 02110-1301, USA. */ + %{!ibcs: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}}" + + #undef SUBTARGET_ASM_SPEC +--- gcc-4.1.0/gcc/config/pa/pa-linux.h ++++ gcc-4.1.0/gcc/config/pa/pa-linux.h +@@ -49,13 +49,18 @@ Boston, MA 02110-1301, USA. */ + /* Define this for shared library support because it isn't in the main + linux.h file. */ + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld.so.1" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "\ + %{shared:-shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}" + + /* glibc's profiling functions don't need gcc to allocate counters. */ +--- gcc-4.1.0/gcc/config/rs6000/linux.h ++++ gcc-4.1.0/gcc/config/rs6000/linux.h +@@ -72,7 +72,11 @@ + #define LINK_START_DEFAULT_SPEC "%(link_start_linux)" + + #undef LINK_OS_DEFAULT_SPEC ++#ifdef USE_UCLIBC ++#define LINK_OS_DEFAULT_SPEC "%(link_os_linux_uclibc)" ++#else + #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)" ++#endif + + #define LINK_GCC_C_SEQUENCE_SPEC \ + "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" +--- gcc-4.1.0/gcc/config/rs6000/sysv4.h ++++ gcc-4.1.0/gcc/config/rs6000/sysv4.h +@@ -866,6 +866,7 @@ extern int fixuplabelno; + mcall-linux : %(link_os_linux) ; \ + mcall-gnu : %(link_os_gnu) ; \ + mcall-netbsd : %(link_os_netbsd) ; \ ++ mcall-linux-uclibc : %(link_os_linux_uclibc); \ + mcall-openbsd: %(link_os_openbsd) ; \ + : %(link_os_default) }" + +@@ -1043,6 +1044,10 @@ extern int fixuplabelno; + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}" + ++#define LINK_OS_LINUX_UCLIBC_SPEC "-m elf32ppclinux %{!shared: %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}}" ++ + #if defined(HAVE_LD_EH_FRAME_HDR) + # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " + #endif +@@ -1209,6 +1214,7 @@ ncrtn.o%s" + { "link_os_sim", LINK_OS_SIM_SPEC }, \ + { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \ + { "link_os_linux", LINK_OS_LINUX_SPEC }, \ ++ { "link_os_linux_uclibc", LINK_OS_LINUX_UCLIBC_SPEC }, \ + { "link_os_gnu", LINK_OS_GNU_SPEC }, \ + { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \ + { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \ +--- gcc-4.1.0/gcc/config/s390/linux.h ++++ gcc-4.1.0/gcc/config/s390/linux.h +@@ -77,6 +77,13 @@ Software Foundation, 51 Franklin Street, + #define MULTILIB_DEFAULTS { "m31" } + #endif + ++#ifdef USE_UCLIBC ++#define ELF31_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0" ++#else ++#define ELF31_DYNAMIC_LINKER "/lib/ld.so.1" ++#define ELF64_DYNAMIC_LINKER "/lib/ld64.so.1" ++#endif + #undef LINK_SPEC + #define LINK_SPEC \ + "%{m31:-m elf_s390}%{m64:-m elf64_s390} \ +@@ -86,8 +93,8 @@ Software Foundation, 51 Franklin Street, + %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker: \ +- %{m31:-dynamic-linker /lib/ld.so.1} \ +- %{m64:-dynamic-linker /lib/ld64.so.1}}}}" ++ %{m31:-dynamic-linker " ELF31_DYNAMIC_LINKER "} \ ++ %{m64:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}}}" + + + #define TARGET_ASM_FILE_END file_end_indicate_exec_stack +--- gcc-4.1.0/gcc/config/sh/linux.h ++++ gcc-4.1.0/gcc/config/sh/linux.h +@@ -56,12 +56,21 @@ Boston, MA 02110-1301, USA. */ + #undef SUBTARGET_LINK_EMUL_SUFFIX + #define SUBTARGET_LINK_EMUL_SUFFIX "_linux" + #undef SUBTARGET_LINK_SPEC ++#ifdef USE_UCLIBC ++#define SUBTARGET_LINK_SPEC \ ++ "%{shared:-shared} \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \ ++ %{static:-static}" ++#else + #define SUBTARGET_LINK_SPEC \ + "%{shared:-shared} \ + %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ + %{static:-static}" ++#endif + + /* Output assembler code to STREAM to call the profiler. */ + +--- gcc-4.1.0/gcc/config/sparc/linux.h ++++ gcc-4.1.0/gcc/config/sparc/linux.h +@@ -125,6 +125,11 @@ Boston, MA 02110-1301, USA. */ + + /* If ELF is the default format, we should not use /lib/elf. */ + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ + %{!mno-relax:%{!r:-relax}} \ +@@ -132,7 +137,7 @@ Boston, MA 02110-1301, USA. */ + %{!ibcs: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}}" + + /* The sun bundled assembler doesn't accept -Yd, (and neither does gas). +--- gcc-4.1.0/gcc/config/sparc/linux64.h ++++ gcc-4.1.0/gcc/config/sparc/linux64.h +@@ -162,12 +162,17 @@ Boston, MA 02110-1301, USA. */ + { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \ + { "link_arch", LINK_ARCH_SPEC }, + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + #define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ + %{!shared: \ + %{!ibcs: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}} \ + " + +--- gcc-4.1.0/libffi/configure ++++ gcc-4.1.0/libffi/configure +@@ -3457,6 +3457,11 @@ linux-gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.1.0/libgfortran/configure ++++ gcc-4.1.0/libgfortran/configure +@@ -3699,6 +3699,11 @@ linux-gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.1.0/libjava/configure ++++ gcc-4.1.0/libjava/configure +@@ -5137,6 +5137,11 @@ linux-gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.1.0/libmudflap/configure ++++ gcc-4.1.0/libmudflap/configure +@@ -5382,6 +5382,11 @@ linux-gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.1.0/libobjc/configure ++++ gcc-4.1.0/libobjc/configure +@@ -3312,6 +3312,11 @@ linux-gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.1.0/libtool.m4 ++++ gcc-4.1.0/libtool.m4 +@@ -743,6 +743,11 @@ linux-gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'] +--- gcc-4.1.0/ltconfig ++++ gcc-4.1.0/ltconfig +@@ -603,6 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)- + + # Transform linux* to *-*-linux-gnu*, to support old configure scripts. + case $host_os in ++linux-uclibc*) ;; + linux-gnu*) ;; + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` + esac +@@ -1274,6 +1275,23 @@ linux-gnu*) + dynamic_linker='GNU/Linux ld.so' + ;; + ++linux-uclibc*) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' ++ soname_spec='${libname}${release}.so$major' ++ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=no ++ # This implies no fast_install, which is unacceptable. ++ # Some rework will be needed to allow for fast_install ++ # before this can be enabled. ++ hardcode_into_libs=yes ++ # Assume using the uClibc dynamic linker. ++ dynamic_linker="uClibc ld.so" ++ ;; ++ + netbsd*) + need_lib_prefix=no + need_version=no +--- gcc-4.1.0/zlib/configure ++++ gcc-4.1.0/zlib/configure +@@ -3426,6 +3426,11 @@ linux-gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' diff --git a/patches/gcc/4.1.1/110-arm-eabi.patch b/patches/gcc/4.1.1/110-arm-eabi.patch new file mode 100644 index 00000000..1657e7ba --- /dev/null +++ b/patches/gcc/4.1.1/110-arm-eabi.patch @@ -0,0 +1,27 @@ +--- gcc-2005q3-1.orig/gcc/config.gcc 2005-10-31 19:02:54.000000000 +0300 ++++ gcc-2005q3-1/gcc/config.gcc 2006-01-27 01:09:09.000000000 +0300 +@@ -674,7 +674,7 @@ + tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" + tmake_file="${tmake_file} t-linux arm/t-arm" + case ${target} in +- arm*-*-linux-gnueabi) ++ arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi) + tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h" + tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi" + # The BPABI long long divmod functions return a 128-bit value in + +diff -urN gcc-2005q3-2/gcc/config/arm/linux-eabi.h gcc-2005q3-2.new/gcc/config/arm/linux-eabi.h +--- gcc-2005q3-2/gcc/config/arm/linux-eabi.h 2005-12-07 23:14:16.000000000 +0300 ++++ gcc-2005q3-2.new/gcc/config/arm/linux-eabi.h 2006-03-29 19:02:34.000000000 +0400 +@@ -53,7 +53,11 @@ + /* Use ld-linux.so.3 so that it will be possible to run "classic" + GNU/Linux binaries on an EABI system. */ + #undef LINUX_TARGET_INTERPRETER ++#ifdef USE_UCLIBC ++#define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0" ++#else + #define LINUX_TARGET_INTERPRETER "/lib/ld-linux.so.3" ++#endif + + /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to + use the GNU/Linux version, not the generic BPABI version. */ diff --git a/patches/gcc/4.1.1/200-uclibc-locale.patch b/patches/gcc/4.1.1/200-uclibc-locale.patch new file mode 100644 index 00000000..e5d712e7 --- /dev/null +++ b/patches/gcc/4.1.1/200-uclibc-locale.patch @@ -0,0 +1,3239 @@ +--- gcc-4.1.0-dist/libstdc++-v3/acinclude.m4 ++++ gcc-4.1.0/libstdc++-v3/acinclude.m4 +@@ -1071,7 +1071,7 @@ + AC_MSG_CHECKING([for C locale to use]) + GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], + [use MODEL for target locale package], +- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto]) ++ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto]) + + # If they didn't use this option switch, or if they specified --enable + # with no specific model, we'll have to look for one. If they +@@ -1087,6 +1087,9 @@ + # Default to "generic". + if test $enable_clocale_flag = auto; then + case ${target_os} in ++ *-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) + AC_EGREP_CPP([_GLIBCXX_ok], [ + #include <features.h> +@@ -1230,6 +1233,40 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ AC_MSG_RESULT(uclibc) ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ AC_SUBST(glibcxx_MOFILES) ++ AC_SUBST(glibcxx_POFILES) ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c++locale_internal.h ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h +@@ -0,0 +1,63 @@ ++// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*- ++ ++// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// Written by Jakub Jelinek <jakub@redhat.com> ++ ++#include <bits/c++config.h> ++#include <clocale> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning clean this up ++#endif ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ ++extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l; ++extern "C" __typeof(strcoll_l) __strcoll_l; ++extern "C" __typeof(strftime_l) __strftime_l; ++extern "C" __typeof(strtod_l) __strtod_l; ++extern "C" __typeof(strtof_l) __strtof_l; ++extern "C" __typeof(strtold_l) __strtold_l; ++extern "C" __typeof(strxfrm_l) __strxfrm_l; ++extern "C" __typeof(newlocale) __newlocale; ++extern "C" __typeof(freelocale) __freelocale; ++extern "C" __typeof(duplocale) __duplocale; ++extern "C" __typeof(uselocale) __uselocale; ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++extern "C" __typeof(iswctype_l) __iswctype_l; ++extern "C" __typeof(towlower_l) __towlower_l; ++extern "C" __typeof(towupper_l) __towupper_l; ++extern "C" __typeof(wcscoll_l) __wcscoll_l; ++extern "C" __typeof(wcsftime_l) __wcsftime_l; ++extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l; ++extern "C" __typeof(wctype_l) __wctype_l; ++#endif ++ ++#endif // GLIBC 2.3 and later +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c_locale.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c_locale.cc +@@ -0,0 +1,152 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <cerrno> // For errno ++#include <locale> ++#include <stdexcept> ++#include <langinfo.h> ++#include <bits/c++locale_internal.h> ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __strtol_l(S, E, B, L) strtol((S), (E), (B)) ++#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B)) ++#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B)) ++#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B)) ++#define __strtof_l(S, E, L) strtof((S), (E)) ++#define __strtod_l(S, E, L) strtod((S), (E)) ++#define __strtold_l(S, E, L) strtold((S), (E)) ++#warning should dummy __newlocale check for C|POSIX ? ++#define __newlocale(a, b, c) NULL ++#define __freelocale(a) ((void)0) ++#define __duplocale(a) __c_locale() ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ char* __sanity; ++ errno = 0; ++ float __f = __strtof_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __f; ++ else ++ __err |= ios_base::failbit; ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ char* __sanity; ++ errno = 0; ++ double __d = __strtod_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __d; ++ else ++ __err |= ios_base::failbit; ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ char* __sanity; ++ errno = 0; ++ long double __ld = __strtold_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __ld; ++ else ++ __err |= ios_base::failbit; ++ } ++ ++ void ++ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, ++ __c_locale __old) ++ { ++ __cloc = __newlocale(1 << LC_ALL, __s, __old); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ if (!__cloc) ++ { ++ // This named locale is not supported by the underlying OS. ++ __throw_runtime_error(__N("locale::facet::_S_create_c_locale " ++ "name not valid")); ++ } ++#endif ++ } ++ ++ void ++ locale::facet::_S_destroy_c_locale(__c_locale& __cloc) ++ { ++ if (__cloc && _S_get_c_locale() != __cloc) ++ __freelocale(__cloc); ++ } ++ ++ __c_locale ++ locale::facet::_S_clone_c_locale(__c_locale& __cloc) ++ { return __duplocale(__cloc); } ++} // namespace std ++ ++namespace __gnu_cxx ++{ ++ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] = ++ { ++ "LC_CTYPE", ++ "LC_NUMERIC", ++ "LC_TIME", ++ "LC_COLLATE", ++ "LC_MONETARY", ++ "LC_MESSAGES", ++#if _GLIBCXX_NUM_CATEGORIES != 0 ++ "LC_PAPER", ++ "LC_NAME", ++ "LC_ADDRESS", ++ "LC_TELEPHONE", ++ "LC_MEASUREMENT", ++ "LC_IDENTIFICATION" ++#endif ++ }; ++} ++ ++namespace std ++{ ++ const char* const* const locale::_S_categories = __gnu_cxx::category_names; ++} // namespace std +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c_locale.h ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c_locale.h +@@ -0,0 +1,117 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#ifndef _C_LOCALE_H ++#define _C_LOCALE_H 1 ++ ++#pragma GCC system_header ++ ++#include <cstring> // get std::strlen ++#include <cstdio> // get std::snprintf or std::sprintf ++#include <clocale> ++#include <langinfo.h> // For codecvt ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC_HAS_LOCALE__ ++#include <iconv.h> // For codecvt using iconv, iconv_t ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#include <libintl.h> // For messages ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning what is _GLIBCXX_C_LOCALE_GNU for ++#endif ++#define _GLIBCXX_C_LOCALE_GNU 1 ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix categories ++#endif ++// #define _GLIBCXX_NUM_CATEGORIES 6 ++#define _GLIBCXX_NUM_CATEGORIES 0 ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++namespace __gnu_cxx ++{ ++ extern "C" __typeof(uselocale) __uselocale; ++} ++#endif ++ ++namespace std ++{ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ typedef __locale_t __c_locale; ++#else ++ typedef int* __c_locale; ++#endif ++ ++ // Convert numeric value of type _Tv to string and return length of ++ // string. If snprintf is available use it, otherwise fall back to ++ // the unsafe sprintf which, in general, can be dangerous and should ++ // be avoided. ++ template<typename _Tv> ++ int ++ __convert_from_v(char* __out, ++ const int __size __attribute__ ((__unused__)), ++ const char* __fmt, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ _Tv __v, const __c_locale& __cloc, int __prec) ++ { ++ __c_locale __old = __gnu_cxx::__uselocale(__cloc); ++#else ++ _Tv __v, const __c_locale&, int __prec) ++ { ++# ifdef __UCLIBC_HAS_LOCALE__ ++ char* __old = std::setlocale(LC_ALL, NULL); ++ char* __sav = new char[std::strlen(__old) + 1]; ++ std::strcpy(__sav, __old); ++ std::setlocale(LC_ALL, "C"); ++# endif ++#endif ++ ++ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __gnu_cxx::__uselocale(__old); ++#elif defined __UCLIBC_HAS_LOCALE__ ++ std::setlocale(LC_ALL, __sav); ++ delete [] __sav; ++#endif ++ return __ret; ++ } ++} ++ ++#endif +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/codecvt_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc +@@ -0,0 +1,306 @@ ++// std::codecvt implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.5 - Template class codecvt ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++namespace std ++{ ++ // Specializations. ++#ifdef _GLIBCXX_USE_WCHAR_T ++ codecvt_base::result ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_out(state_type& __state, const intern_type* __from, ++ const intern_type* __from_end, const intern_type*& __from_next, ++ extern_type* __to, extern_type* __to_end, ++ extern_type*& __to_next) const ++ { ++ result __ret = ok; ++ state_type __tmp_state(__state); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ ++ // wcsnrtombs is *very* fast but stops if encounters NUL characters: ++ // in case we fall back to wcrtomb and then continue, in a loop. ++ // NB: wcsnrtombs is a GNU extension ++ for (__from_next = __from, __to_next = __to; ++ __from_next < __from_end && __to_next < __to_end ++ && __ret == ok;) ++ { ++ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0', ++ __from_end - __from_next); ++ if (!__from_chunk_end) ++ __from_chunk_end = __from_end; ++ ++ __from = __from_next; ++ const size_t __conv = wcsnrtombs(__to_next, &__from_next, ++ __from_chunk_end - __from_next, ++ __to_end - __to_next, &__state); ++ if (__conv == static_cast<size_t>(-1)) ++ { ++ // In case of error, in order to stop at the exact place we ++ // have to start again from the beginning with a series of ++ // wcrtomb. ++ for (; __from < __from_next; ++__from) ++ __to_next += wcrtomb(__to_next, *__from, &__tmp_state); ++ __state = __tmp_state; ++ __ret = error; ++ } ++ else if (__from_next && __from_next < __from_chunk_end) ++ { ++ __to_next += __conv; ++ __ret = partial; ++ } ++ else ++ { ++ __from_next = __from_chunk_end; ++ __to_next += __conv; ++ } ++ ++ if (__from_next < __from_end && __ret == ok) ++ { ++ extern_type __buf[MB_LEN_MAX]; ++ __tmp_state = __state; ++ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state); ++ if (__conv > static_cast<size_t>(__to_end - __to_next)) ++ __ret = partial; ++ else ++ { ++ memcpy(__to_next, __buf, __conv); ++ __state = __tmp_state; ++ __to_next += __conv; ++ ++__from_next; ++ } ++ } ++ } ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ return __ret; ++ } ++ ++ codecvt_base::result ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_in(state_type& __state, const extern_type* __from, ++ const extern_type* __from_end, const extern_type*& __from_next, ++ intern_type* __to, intern_type* __to_end, ++ intern_type*& __to_next) const ++ { ++ result __ret = ok; ++ state_type __tmp_state(__state); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ ++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters: ++ // in case we store a L'\0' and then continue, in a loop. ++ // NB: mbsnrtowcs is a GNU extension ++ for (__from_next = __from, __to_next = __to; ++ __from_next < __from_end && __to_next < __to_end ++ && __ret == ok;) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0', ++ __from_end ++ - __from_next)); ++ if (!__from_chunk_end) ++ __from_chunk_end = __from_end; ++ ++ __from = __from_next; ++ size_t __conv = mbsnrtowcs(__to_next, &__from_next, ++ __from_chunk_end - __from_next, ++ __to_end - __to_next, &__state); ++ if (__conv == static_cast<size_t>(-1)) ++ { ++ // In case of error, in order to stop at the exact place we ++ // have to start again from the beginning with a series of ++ // mbrtowc. ++ for (;; ++__to_next, __from += __conv) ++ { ++ __conv = mbrtowc(__to_next, __from, __from_end - __from, ++ &__tmp_state); ++ if (__conv == static_cast<size_t>(-1) ++ || __conv == static_cast<size_t>(-2)) ++ break; ++ } ++ __from_next = __from; ++ __state = __tmp_state; ++ __ret = error; ++ } ++ else if (__from_next && __from_next < __from_chunk_end) ++ { ++ // It is unclear what to return in this case (see DR 382). ++ __to_next += __conv; ++ __ret = partial; ++ } ++ else ++ { ++ __from_next = __from_chunk_end; ++ __to_next += __conv; ++ } ++ ++ if (__from_next < __from_end && __ret == ok) ++ { ++ if (__to_next < __to_end) ++ { ++ // XXX Probably wrong for stateful encodings ++ __tmp_state = __state; ++ ++__from_next; ++ *__to_next++ = L'\0'; ++ } ++ else ++ __ret = partial; ++ } ++ } ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ return __ret; ++ } ++ ++ int ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_encoding() const throw() ++ { ++ // XXX This implementation assumes that the encoding is ++ // stateless and is either single-byte or variable-width. ++ int __ret = 0; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ if (MB_CUR_MAX == 1) ++ __ret = 1; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __ret; ++ } ++ ++ int ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_max_length() const throw() ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ // XXX Probably wrong for stateful encodings. ++ int __ret = MB_CUR_MAX; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __ret; ++ } ++ ++ int ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_length(state_type& __state, const extern_type* __from, ++ const extern_type* __end, size_t __max) const ++ { ++ int __ret = 0; ++ state_type __tmp_state(__state); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ ++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters: ++ // in case we advance past it and then continue, in a loop. ++ // NB: mbsnrtowcs is a GNU extension ++ ++ // A dummy internal buffer is needed in order for mbsnrtocws to consider ++ // its fourth parameter (it wouldn't with NULL as first parameter). ++ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t) ++ * __max)); ++ while (__from < __end && __max) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0', ++ __end ++ - __from)); ++ if (!__from_chunk_end) ++ __from_chunk_end = __end; ++ ++ const extern_type* __tmp_from = __from; ++ size_t __conv = mbsnrtowcs(__to, &__from, ++ __from_chunk_end - __from, ++ __max, &__state); ++ if (__conv == static_cast<size_t>(-1)) ++ { ++ // In case of error, in order to stop at the exact place we ++ // have to start again from the beginning with a series of ++ // mbrtowc. ++ for (__from = __tmp_from;; __from += __conv) ++ { ++ __conv = mbrtowc(NULL, __from, __end - __from, ++ &__tmp_state); ++ if (__conv == static_cast<size_t>(-1) ++ || __conv == static_cast<size_t>(-2)) ++ break; ++ } ++ __state = __tmp_state; ++ __ret += __from - __tmp_from; ++ break; ++ } ++ if (!__from) ++ __from = __from_chunk_end; ++ ++ __ret += __from - __tmp_from; ++ __max -= __conv; ++ ++ if (__from < __end && __max) ++ { ++ // XXX Probably wrong for stateful encodings ++ __tmp_state = __state; ++ ++__from; ++ ++__ret; ++ --__max; ++ } ++ } ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ return __ret; ++ } ++#endif ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/collate_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/collate_members.cc +@@ -0,0 +1,80 @@ ++// std::collate implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.4.1.2 collate virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __strcoll_l(S1, S2, L) strcoll((S1), (S2)) ++#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N)) ++#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2)) ++#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N)) ++#endif ++ ++namespace std ++{ ++ // These are basically extensions to char_traits, and perhaps should ++ // be put there instead of here. ++ template<> ++ int ++ collate<char>::_M_compare(const char* __one, const char* __two) const ++ { ++ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate); ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); ++ } ++ ++ template<> ++ size_t ++ collate<char>::_M_transform(char* __to, const char* __from, ++ size_t __n) const ++ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ int ++ collate<wchar_t>::_M_compare(const wchar_t* __one, ++ const wchar_t* __two) const ++ { ++ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate); ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); ++ } ++ ++ template<> ++ size_t ++ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from, ++ size_t __n) const ++ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); } ++#endif ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/ctype_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc +@@ -0,0 +1,314 @@ ++// std::ctype implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions. ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#define _LIBC ++#include <locale> ++#undef _LIBC ++#include <bits/c++locale_internal.h> ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __wctype_l(S, L) wctype((S)) ++#define __towupper_l(C, L) towupper((C)) ++#define __towlower_l(C, L) towlower((C)) ++#define __iswctype_l(C, M, L) iswctype((C), (M)) ++#endif ++ ++namespace std ++{ ++ // NB: The other ctype<char> specializations are in src/locale.cc and ++ // various /config/os/* files. ++ template<> ++ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs) ++ : ctype<char>(0, false, __refs) ++ { ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ++ { ++ this->_S_destroy_c_locale(this->_M_c_locale_ctype); ++ this->_S_create_c_locale(this->_M_c_locale_ctype, __s); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper; ++ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower; ++ this->_M_table = this->_M_c_locale_ctype->__ctype_b; ++#endif ++ } ++ } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ ctype<wchar_t>::__wmask_type ++ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const ++ { ++ __wmask_type __ret; ++ switch (__m) ++ { ++ case space: ++ __ret = __wctype_l("space", _M_c_locale_ctype); ++ break; ++ case print: ++ __ret = __wctype_l("print", _M_c_locale_ctype); ++ break; ++ case cntrl: ++ __ret = __wctype_l("cntrl", _M_c_locale_ctype); ++ break; ++ case upper: ++ __ret = __wctype_l("upper", _M_c_locale_ctype); ++ break; ++ case lower: ++ __ret = __wctype_l("lower", _M_c_locale_ctype); ++ break; ++ case alpha: ++ __ret = __wctype_l("alpha", _M_c_locale_ctype); ++ break; ++ case digit: ++ __ret = __wctype_l("digit", _M_c_locale_ctype); ++ break; ++ case punct: ++ __ret = __wctype_l("punct", _M_c_locale_ctype); ++ break; ++ case xdigit: ++ __ret = __wctype_l("xdigit", _M_c_locale_ctype); ++ break; ++ case alnum: ++ __ret = __wctype_l("alnum", _M_c_locale_ctype); ++ break; ++ case graph: ++ __ret = __wctype_l("graph", _M_c_locale_ctype); ++ break; ++ default: ++ __ret = __wmask_type(); ++ } ++ return __ret; ++ } ++ ++ wchar_t ++ ctype<wchar_t>::do_toupper(wchar_t __c) const ++ { return __towupper_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const ++ { ++ while (__lo < __hi) ++ { ++ *__lo = __towupper_l(*__lo, _M_c_locale_ctype); ++ ++__lo; ++ } ++ return __hi; ++ } ++ ++ wchar_t ++ ctype<wchar_t>::do_tolower(wchar_t __c) const ++ { return __towlower_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const ++ { ++ while (__lo < __hi) ++ { ++ *__lo = __towlower_l(*__lo, _M_c_locale_ctype); ++ ++__lo; ++ } ++ return __hi; ++ } ++ ++ bool ++ ctype<wchar_t>:: ++ do_is(mask __m, wchar_t __c) const ++ { ++ // The case of __m == ctype_base::space is particularly important, ++ // due to its use in many istream functions. Therefore we deal with ++ // it first, exploiting the knowledge that on GNU systems _M_bit[5] ++ // is the mask corresponding to ctype_base::space. NB: an encoding ++ // change would not affect correctness! ++ bool __ret = false; ++ if (__m == _M_bit[5]) ++ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype); ++ else ++ { ++ // Highest bitmask in ctype_base == 10, but extra in "C" ++ // library for blank. ++ const size_t __bitmasksize = 11; ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) ++ if (__m & _M_bit[__bitcur]) ++ { ++ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype)) ++ { ++ __ret = true; ++ break; ++ } ++ else if (__m == _M_bit[__bitcur]) ++ break; ++ } ++ } ++ return __ret; ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const ++ { ++ for (; __lo < __hi; ++__vec, ++__lo) ++ { ++ // Highest bitmask in ctype_base == 10, but extra in "C" ++ // library for blank. ++ const size_t __bitmasksize = 11; ++ mask __m = 0; ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) ++ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype)) ++ __m |= _M_bit[__bitcur]; ++ *__vec = __m; ++ } ++ return __hi; ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const ++ { ++ while (__lo < __hi && !this->do_is(__m, *__lo)) ++ ++__lo; ++ return __lo; ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const ++ { ++ while (__lo < __hi && this->do_is(__m, *__lo) != 0) ++ ++__lo; ++ return __lo; ++ } ++ ++ wchar_t ++ ctype<wchar_t>:: ++ do_widen(char __c) const ++ { return _M_widen[static_cast<unsigned char>(__c)]; } ++ ++ const char* ++ ctype<wchar_t>:: ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const ++ { ++ while (__lo < __hi) ++ { ++ *__dest = _M_widen[static_cast<unsigned char>(*__lo)]; ++ ++__lo; ++ ++__dest; ++ } ++ return __hi; ++ } ++ ++ char ++ ctype<wchar_t>:: ++ do_narrow(wchar_t __wc, char __dfault) const ++ { ++ if (__wc >= 0 && __wc < 128 && _M_narrow_ok) ++ return _M_narrow[__wc]; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_ctype); ++#endif ++ const int __c = wctob(__wc); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return (__c == EOF ? __dfault : static_cast<char>(__c)); ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault, ++ char* __dest) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_ctype); ++#endif ++ if (_M_narrow_ok) ++ while (__lo < __hi) ++ { ++ if (*__lo >= 0 && *__lo < 128) ++ *__dest = _M_narrow[*__lo]; ++ else ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c)); ++ } ++ ++__lo; ++ ++__dest; ++ } ++ else ++ while (__lo < __hi) ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c)); ++ ++__lo; ++ ++__dest; ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __hi; ++ } ++ ++ void ++ ctype<wchar_t>::_M_initialize_ctype() ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_ctype); ++#endif ++ wint_t __i; ++ for (__i = 0; __i < 128; ++__i) ++ { ++ const int __c = wctob(__i); ++ if (__c == EOF) ++ break; ++ else ++ _M_narrow[__i] = static_cast<char>(__c); ++ } ++ if (__i == 128) ++ _M_narrow_ok = true; ++ else ++ _M_narrow_ok = false; ++ for (size_t __j = 0; ++ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j) ++ _M_widen[__j] = btowc(__j); ++ ++ for (size_t __k = 0; __k <= 11; ++__k) ++ { ++ _M_bit[__k] = static_cast<mask>(_ISbit(__k)); ++ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]); ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ } ++#endif // _GLIBCXX_USE_WCHAR_T ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/messages_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/messages_members.cc +@@ -0,0 +1,100 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix gettext stuff ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++extern "C" char *__dcgettext(const char *domainname, ++ const char *msgid, int category); ++#undef gettext ++#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES) ++#else ++#undef gettext ++#define gettext(msgid) (msgid) ++#endif ++ ++namespace std ++{ ++ // Specializations. ++ template<> ++ string ++ messages<char>::do_get(catalog, int, int, const string& __dfault) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_messages); ++ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str())); ++ __uselocale(__old); ++ return string(__msg); ++#elif defined __UCLIBC_HAS_LOCALE__ ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_messages); ++ const char* __msg = gettext(__dfault.c_str()); ++ setlocale(LC_ALL, __old); ++ free(__old); ++ return string(__msg); ++#else ++ const char* __msg = gettext(__dfault.c_str()); ++ return string(__msg); ++#endif ++ } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ wstring ++ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const ++ { ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ __uselocale(__old); ++ return _M_convert_from_char(__msg); ++# elif defined __UCLIBC_HAS_LOCALE__ ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ setlocale(LC_ALL, __old); ++ free(__old); ++ return _M_convert_from_char(__msg); ++# else ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ return _M_convert_from_char(__msg); ++# endif ++ } ++#endif ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/messages_members.h ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/messages_members.h +@@ -0,0 +1,121 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix prototypes for *textdomain funcs ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++extern "C" char *__textdomain(const char *domainname); ++extern "C" char *__bindtextdomain(const char *domainname, ++ const char *dirname); ++#else ++#undef __textdomain ++#undef __bindtextdomain ++#define __textdomain(D) ((void)0) ++#define __bindtextdomain(D,P) ((void)0) ++#endif ++ ++ // Non-virtual member functions. ++ template<typename _CharT> ++ messages<_CharT>::messages(size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), ++ _M_name_messages(_S_get_c_name()) ++ { } ++ ++ template<typename _CharT> ++ messages<_CharT>::messages(__c_locale __cloc, const char* __s, ++ size_t __refs) ++ : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL) ++ { ++ const size_t __len = std::strlen(__s) + 1; ++ char* __tmp = new char[__len]; ++ std::memcpy(__tmp, __s, __len); ++ _M_name_messages = __tmp; ++ ++ // Last to avoid leaking memory if new throws. ++ _M_c_locale_messages = _S_clone_c_locale(__cloc); ++ } ++ ++ template<typename _CharT> ++ typename messages<_CharT>::catalog ++ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, ++ const char* __dir) const ++ { ++ __bindtextdomain(__s.c_str(), __dir); ++ return this->do_open(__s, __loc); ++ } ++ ++ // Virtual member functions. ++ template<typename _CharT> ++ messages<_CharT>::~messages() ++ { ++ if (_M_name_messages != _S_get_c_name()) ++ delete [] _M_name_messages; ++ _S_destroy_c_locale(_M_c_locale_messages); ++ } ++ ++ template<typename _CharT> ++ typename messages<_CharT>::catalog ++ messages<_CharT>::do_open(const basic_string<char>& __s, ++ const locale&) const ++ { ++ // No error checking is done, assume the catalog exists and can ++ // be used. ++ __textdomain(__s.c_str()); ++ return 0; ++ } ++ ++ template<typename _CharT> ++ void ++ messages<_CharT>::do_close(catalog) const ++ { } ++ ++ // messages_byname ++ template<typename _CharT> ++ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) ++ : messages<_CharT>(__refs) ++ { ++ if (this->_M_name_messages != locale::facet::_S_get_c_name()) ++ delete [] this->_M_name_messages; ++ char* __tmp = new char[std::strlen(__s) + 1]; ++ std::strcpy(__tmp, __s); ++ this->_M_name_messages = __tmp; ++ ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ++ { ++ this->_S_destroy_c_locale(this->_M_c_locale_messages); ++ this->_S_create_c_locale(this->_M_c_locale_messages, __s); ++ } ++ } +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/monetary_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc +@@ -0,0 +1,692 @@ ++// std::moneypunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#define _LIBC ++#include <locale> ++#undef _LIBC ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning optimize this for uclibc ++#warning tailor for stub locale support ++#endif ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ // Construct and return valid pattern consisting of some combination of: ++ // space none symbol sign value ++ money_base::pattern ++ money_base::_S_construct_pattern(char __precedes, char __space, char __posn) ++ { ++ pattern __ret; ++ ++ // This insanely complicated routine attempts to construct a valid ++ // pattern for use with monyepunct. A couple of invariants: ++ ++ // if (__precedes) symbol -> value ++ // else value -> symbol ++ ++ // if (__space) space ++ // else none ++ ++ // none == never first ++ // space never first or last ++ ++ // Any elegant implementations of this are welcome. ++ switch (__posn) ++ { ++ case 0: ++ case 1: ++ // 1 The sign precedes the value and symbol. ++ __ret.field[0] = sign; ++ if (__space) ++ { ++ // Pattern starts with sign. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[3] = symbol; ++ } ++ __ret.field[2] = space; ++ } ++ else ++ { ++ // Pattern starts with sign and ends with none. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[3] = none; ++ } ++ break; ++ case 2: ++ // 2 The sign follows the value and symbol. ++ if (__space) ++ { ++ // Pattern either ends with sign. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[1] = space; ++ __ret.field[3] = sign; ++ } ++ else ++ { ++ // Pattern ends with sign then none. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[1] = symbol; ++ } ++ __ret.field[2] = sign; ++ __ret.field[3] = none; ++ } ++ break; ++ case 3: ++ // 3 The sign immediately precedes the symbol. ++ if (__precedes) ++ { ++ __ret.field[0] = sign; ++ __ret.field[1] = symbol; ++ if (__space) ++ { ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[2] = value; ++ __ret.field[3] = none; ++ } ++ } ++ else ++ { ++ __ret.field[0] = value; ++ if (__space) ++ { ++ __ret.field[1] = space; ++ __ret.field[2] = sign; ++ __ret.field[3] = symbol; ++ } ++ else ++ { ++ __ret.field[1] = sign; ++ __ret.field[2] = symbol; ++ __ret.field[3] = none; ++ } ++ } ++ break; ++ case 4: ++ // 4 The sign immediately follows the symbol. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = sign; ++ if (__space) ++ { ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[2] = value; ++ __ret.field[3] = none; ++ } ++ } ++ else ++ { ++ __ret.field[0] = value; ++ if (__space) ++ { ++ __ret.field[1] = space; ++ __ret.field[2] = symbol; ++ __ret.field[3] = sign; ++ } ++ else ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = sign; ++ __ret.field[3] = none; ++ } ++ } ++ break; ++ default: ++ __ret = pattern(); ++ } ++ return __ret; ++ } ++ ++ template<> ++ void ++ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<char, true>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = '.'; ++ _M_data->_M_thousands_sep = ','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = ""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = ""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = ""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i]; ++ } ++ else ++ { ++ // Named locale. ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, ++ __cloc)); ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, ++ __cloc)); ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign); ++ ++ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); ++ if (!__nposn) ++ _M_data->_M_negative_sign = "()"; ++ else ++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, ++ __cloc); ++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign); ++ ++ // _Intl == true ++ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); ++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol); ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, ++ __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ } ++ } ++ ++ template<> ++ void ++ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<char, false>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = '.'; ++ _M_data->_M_thousands_sep = ','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = ""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = ""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = ""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i]; ++ } ++ else ++ { ++ // Named locale. ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, ++ __cloc)); ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, ++ __cloc)); ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign); ++ ++ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); ++ if (!__nposn) ++ _M_data->_M_negative_sign = "()"; ++ else ++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, ++ __cloc); ++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign); ++ ++ // _Intl == false ++ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); ++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol); ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ } ++ } ++ ++ template<> ++ moneypunct<char, true>::~moneypunct() ++ { delete _M_data; } ++ ++ template<> ++ moneypunct<char, false>::~moneypunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ const char*) ++#else ++ const char* __name) ++#endif ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<wchar_t, true>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = L'.'; ++ _M_data->_M_thousands_sep = L','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ // Use ctype::widen code without the facet... ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ _M_data->_M_atoms[__i] = ++ static_cast<wchar_t>(money_base::_S_atoms[__i]); ++ } ++ else ++ { ++ // Named locale. ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(__cloc); ++#else ++ // Switch to named locale so that mbsrtowcs will work. ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, __name); ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this... should be monetary ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# elif defined __UCLIBC_HAS_LOCALE__ ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); ++ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); ++ ++ wchar_t* __wcs_ps = 0; ++ wchar_t* __wcs_ns = 0; ++ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); ++ try ++ { ++ mbstate_t __state; ++ size_t __len = strlen(__cpossign); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ps = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); ++ _M_data->_M_positive_sign = __wcs_ps; ++ } ++ else ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); ++ ++ __len = strlen(__cnegsign); ++ if (!__nposn) ++ _M_data->_M_negative_sign = L"()"; ++ else if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ns = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); ++ _M_data->_M_negative_sign = __wcs_ns; ++ } ++ else ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); ++ ++ // _Intl == true. ++ __len = strlen(__ccurr); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state); ++ _M_data->_M_curr_symbol = __wcs; ++ } ++ else ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); ++ } ++ catch (...) ++ { ++ delete _M_data; ++ _M_data = 0; ++ delete __wcs_ps; ++ delete __wcs_ns; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ __throw_exception_again; ++ } ++ ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, ++ __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ } ++ } ++ ++ template<> ++ void ++ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ const char*) ++#else ++ const char* __name) ++#endif ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<wchar_t, false>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = L'.'; ++ _M_data->_M_thousands_sep = L','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ // Use ctype::widen code without the facet... ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ _M_data->_M_atoms[__i] = ++ static_cast<wchar_t>(money_base::_S_atoms[__i]); ++ } ++ else ++ { ++ // Named locale. ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(__cloc); ++#else ++ // Switch to named locale so that mbsrtowcs will work. ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, __name); ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this... should be monetary ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# elif defined __UCLIBC_HAS_LOCALE__ ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); ++ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); ++ ++ wchar_t* __wcs_ps = 0; ++ wchar_t* __wcs_ns = 0; ++ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); ++ try ++ { ++ mbstate_t __state; ++ size_t __len; ++ __len = strlen(__cpossign); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ps = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); ++ _M_data->_M_positive_sign = __wcs_ps; ++ } ++ else ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); ++ ++ __len = strlen(__cnegsign); ++ if (!__nposn) ++ _M_data->_M_negative_sign = L"()"; ++ else if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ns = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); ++ _M_data->_M_negative_sign = __wcs_ns; ++ } ++ else ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); ++ ++ // _Intl == true. ++ __len = strlen(__ccurr); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state); ++ _M_data->_M_curr_symbol = __wcs; ++ } ++ else ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); ++ } ++ catch (...) ++ { ++ delete _M_data; ++ _M_data = 0; ++ delete __wcs_ps; ++ delete __wcs_ns; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ __throw_exception_again; ++ } ++ ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ } ++ } ++ ++ template<> ++ moneypunct<wchar_t, true>::~moneypunct() ++ { ++ if (_M_data->_M_positive_sign_size) ++ delete [] _M_data->_M_positive_sign; ++ if (_M_data->_M_negative_sign_size ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0) ++ delete [] _M_data->_M_negative_sign; ++ if (_M_data->_M_curr_symbol_size) ++ delete [] _M_data->_M_curr_symbol; ++ delete _M_data; ++ } ++ ++ template<> ++ moneypunct<wchar_t, false>::~moneypunct() ++ { ++ if (_M_data->_M_positive_sign_size) ++ delete [] _M_data->_M_positive_sign; ++ if (_M_data->_M_negative_sign_size ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0) ++ delete [] _M_data->_M_negative_sign; ++ if (_M_data->_M_curr_symbol_size) ++ delete [] _M_data->_M_curr_symbol; ++ delete _M_data; ++ } ++#endif ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/numeric_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc +@@ -0,0 +1,173 @@ ++// std::numpunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#define _LIBC ++#include <locale> ++#undef _LIBC ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning tailor for stub locale support ++#endif ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache<char>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_use_grouping = false; ++ ++ _M_data->_M_decimal_point = '.'; ++ _M_data->_M_thousands_sep = ','; ++ ++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) ++ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i]; ++ ++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j) ++ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j]; ++ } ++ else ++ { ++ // Named locale. ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT, ++ __cloc)); ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP, ++ __cloc)); ++ ++ // Check for NULL, which implies no grouping. ++ if (_M_data->_M_thousands_sep == '\0') ++ _M_data->_M_grouping = ""; ++ else ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ } ++ ++ // NB: There is no way to extact this info from posix locales. ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); ++ _M_data->_M_truename = "true"; ++ _M_data->_M_truename_size = 4; ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); ++ _M_data->_M_falsename = "false"; ++ _M_data->_M_falsename_size = 5; ++ } ++ ++ template<> ++ numpunct<char>::~numpunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache<wchar_t>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_use_grouping = false; ++ ++ _M_data->_M_decimal_point = L'.'; ++ _M_data->_M_thousands_sep = L','; ++ ++ // Use ctype::widen code without the facet... ++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) ++ _M_data->_M_atoms_out[__i] = ++ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]); ++ ++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j) ++ _M_data->_M_atoms_in[__j] = ++ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]); ++ } ++ else ++ { ++ // Named locale. ++ // NB: In the GNU model wchar_t is always 32 bit wide. ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# elif defined __UCLIBC_HAS_LOCALE__ ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ ++ if (_M_data->_M_thousands_sep == L'\0') ++ _M_data->_M_grouping = ""; ++ else ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ } ++ ++ // NB: There is no way to extact this info from posix locales. ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); ++ _M_data->_M_truename = L"true"; ++ _M_data->_M_truename_size = 4; ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); ++ _M_data->_M_falsename = L"false"; ++ _M_data->_M_falsename_size = 5; ++ } ++ ++ template<> ++ numpunct<wchar_t>::~numpunct() ++ { delete _M_data; } ++ #endif ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/time_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/time_members.cc +@@ -0,0 +1,406 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning tailor for stub locale support ++#endif ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ __timepunct<char>:: ++ _M_put(char* __s, size_t __maxlen, const char* __format, ++ const tm* __tm) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm, ++ _M_c_locale_timepunct); ++#else ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_timepunct); ++ const size_t __len = strftime(__s, __maxlen, __format, __tm); ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ // Make sure __s is null terminated. ++ if (__len == 0) ++ __s[0] = '\0'; ++ } ++ ++ template<> ++ void ++ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache<char>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = "%m/%d/%y"; ++ _M_data->_M_date_era_format = "%m/%d/%y"; ++ _M_data->_M_time_format = "%H:%M:%S"; ++ _M_data->_M_time_era_format = "%H:%M:%S"; ++ _M_data->_M_date_time_format = ""; ++ _M_data->_M_date_time_era_format = ""; ++ _M_data->_M_am = "AM"; ++ _M_data->_M_pm = "PM"; ++ _M_data->_M_am_pm_format = ""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = "Sunday"; ++ _M_data->_M_day2 = "Monday"; ++ _M_data->_M_day3 = "Tuesday"; ++ _M_data->_M_day4 = "Wednesday"; ++ _M_data->_M_day5 = "Thursday"; ++ _M_data->_M_day6 = "Friday"; ++ _M_data->_M_day7 = "Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = "Sun"; ++ _M_data->_M_aday2 = "Mon"; ++ _M_data->_M_aday3 = "Tue"; ++ _M_data->_M_aday4 = "Wed"; ++ _M_data->_M_aday5 = "Thu"; ++ _M_data->_M_aday6 = "Fri"; ++ _M_data->_M_aday7 = "Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = "January"; ++ _M_data->_M_month02 = "February"; ++ _M_data->_M_month03 = "March"; ++ _M_data->_M_month04 = "April"; ++ _M_data->_M_month05 = "May"; ++ _M_data->_M_month06 = "June"; ++ _M_data->_M_month07 = "July"; ++ _M_data->_M_month08 = "August"; ++ _M_data->_M_month09 = "September"; ++ _M_data->_M_month10 = "October"; ++ _M_data->_M_month11 = "November"; ++ _M_data->_M_month12 = "December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = "Jan"; ++ _M_data->_M_amonth02 = "Feb"; ++ _M_data->_M_amonth03 = "Mar"; ++ _M_data->_M_amonth04 = "Apr"; ++ _M_data->_M_amonth05 = "May"; ++ _M_data->_M_amonth06 = "Jun"; ++ _M_data->_M_amonth07 = "Jul"; ++ _M_data->_M_amonth08 = "Aug"; ++ _M_data->_M_amonth09 = "Sep"; ++ _M_data->_M_amonth10 = "Oct"; ++ _M_data->_M_amonth11 = "Nov"; ++ _M_data->_M_amonth12 = "Dec"; ++ } ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc); ++ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc); ++ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc); ++ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc); ++ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc); ++ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT, ++ __cloc); ++ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc); ++ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc); ++ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc); ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc); ++ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc); ++ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc); ++ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc); ++ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc); ++ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc); ++ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc); ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc); ++ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc); ++ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc); ++ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc); ++ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc); ++ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc); ++ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc); ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc); ++ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc); ++ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc); ++ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc); ++ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc); ++ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc); ++ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc); ++ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc); ++ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc); ++ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc); ++ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc); ++ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc); ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc); ++ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc); ++ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc); ++ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc); ++ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc); ++ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc); ++ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc); ++ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc); ++ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc); ++ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc); ++ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc); ++ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc); ++ } ++ } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ __timepunct<wchar_t>:: ++ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format, ++ const tm* __tm) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct); ++ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm, ++ _M_c_locale_timepunct); ++#else ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_timepunct); ++ const size_t __len = wcsftime(__s, __maxlen, __format, __tm); ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ // Make sure __s is null terminated. ++ if (__len == 0) ++ __s[0] = L'\0'; ++ } ++ ++ template<> ++ void ++ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache<wchar_t>; ++ ++#warning wide time stuff ++// if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = L"%m/%d/%y"; ++ _M_data->_M_date_era_format = L"%m/%d/%y"; ++ _M_data->_M_time_format = L"%H:%M:%S"; ++ _M_data->_M_time_era_format = L"%H:%M:%S"; ++ _M_data->_M_date_time_format = L""; ++ _M_data->_M_date_time_era_format = L""; ++ _M_data->_M_am = L"AM"; ++ _M_data->_M_pm = L"PM"; ++ _M_data->_M_am_pm_format = L""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = L"Sunday"; ++ _M_data->_M_day2 = L"Monday"; ++ _M_data->_M_day3 = L"Tuesday"; ++ _M_data->_M_day4 = L"Wednesday"; ++ _M_data->_M_day5 = L"Thursday"; ++ _M_data->_M_day6 = L"Friday"; ++ _M_data->_M_day7 = L"Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = L"Sun"; ++ _M_data->_M_aday2 = L"Mon"; ++ _M_data->_M_aday3 = L"Tue"; ++ _M_data->_M_aday4 = L"Wed"; ++ _M_data->_M_aday5 = L"Thu"; ++ _M_data->_M_aday6 = L"Fri"; ++ _M_data->_M_aday7 = L"Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = L"January"; ++ _M_data->_M_month02 = L"February"; ++ _M_data->_M_month03 = L"March"; ++ _M_data->_M_month04 = L"April"; ++ _M_data->_M_month05 = L"May"; ++ _M_data->_M_month06 = L"June"; ++ _M_data->_M_month07 = L"July"; ++ _M_data->_M_month08 = L"August"; ++ _M_data->_M_month09 = L"September"; ++ _M_data->_M_month10 = L"October"; ++ _M_data->_M_month11 = L"November"; ++ _M_data->_M_month12 = L"December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = L"Jan"; ++ _M_data->_M_amonth02 = L"Feb"; ++ _M_data->_M_amonth03 = L"Mar"; ++ _M_data->_M_amonth04 = L"Apr"; ++ _M_data->_M_amonth05 = L"May"; ++ _M_data->_M_amonth06 = L"Jun"; ++ _M_data->_M_amonth07 = L"Jul"; ++ _M_data->_M_amonth08 = L"Aug"; ++ _M_data->_M_amonth09 = L"Sep"; ++ _M_data->_M_amonth10 = L"Oct"; ++ _M_data->_M_amonth11 = L"Nov"; ++ _M_data->_M_amonth12 = L"Dec"; ++ } ++#if 0 ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ union { char *__s; wchar_t *__w; } __u; ++ ++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); ++ _M_data->_M_date_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); ++ _M_data->_M_date_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); ++ _M_data->_M_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); ++ _M_data->_M_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); ++ _M_data->_M_date_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); ++ _M_data->_M_date_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); ++ _M_data->_M_am = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); ++ _M_data->_M_pm = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); ++ _M_data->_M_am_pm_format = __u.__w; ++ ++ // Day names, starting with "C"'s Sunday. ++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); ++ _M_data->_M_day1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); ++ _M_data->_M_day2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); ++ _M_data->_M_day3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); ++ _M_data->_M_day4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); ++ _M_data->_M_day5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); ++ _M_data->_M_day6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); ++ _M_data->_M_day7 = __u.__w; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); ++ _M_data->_M_aday1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); ++ _M_data->_M_aday2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); ++ _M_data->_M_aday3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); ++ _M_data->_M_aday4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); ++ _M_data->_M_aday5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); ++ _M_data->_M_aday6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); ++ _M_data->_M_aday7 = __u.__w; ++ ++ // Month names, starting with "C"'s January. ++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); ++ _M_data->_M_month01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); ++ _M_data->_M_month02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); ++ _M_data->_M_month03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); ++ _M_data->_M_month04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); ++ _M_data->_M_month05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); ++ _M_data->_M_month06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); ++ _M_data->_M_month07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); ++ _M_data->_M_month08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); ++ _M_data->_M_month09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); ++ _M_data->_M_month10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); ++ _M_data->_M_month11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); ++ _M_data->_M_month12 = __u.__w; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); ++ _M_data->_M_amonth01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); ++ _M_data->_M_amonth02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); ++ _M_data->_M_amonth03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); ++ _M_data->_M_amonth04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); ++ _M_data->_M_amonth05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); ++ _M_data->_M_amonth06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); ++ _M_data->_M_amonth07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); ++ _M_data->_M_amonth08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); ++ _M_data->_M_amonth09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); ++ _M_data->_M_amonth10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); ++ _M_data->_M_amonth11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); ++ _M_data->_M_amonth12 = __u.__w; ++ } ++#endif // 0 ++ } ++#endif ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/time_members.h ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/time_members.h +@@ -0,0 +1,76 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::__timepunct(size_t __refs) ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), ++ _M_name_timepunct(_S_get_c_name()) ++ { _M_initialize_timepunct(); } ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) ++ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL), ++ _M_name_timepunct(_S_get_c_name()) ++ { _M_initialize_timepunct(); } ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, ++ size_t __refs) ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), ++ _M_name_timepunct(NULL) ++ { ++ const size_t __len = std::strlen(__s) + 1; ++ char* __tmp = new char[__len]; ++ std::memcpy(__tmp, __s, __len); ++ _M_name_timepunct = __tmp; ++ ++ try ++ { _M_initialize_timepunct(__cloc); } ++ catch(...) ++ { ++ delete [] _M_name_timepunct; ++ __throw_exception_again; ++ } ++ } ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::~__timepunct() ++ { ++ if (_M_name_timepunct != _S_get_c_name()) ++ delete [] _M_name_timepunct; ++ delete _M_data; ++ _S_destroy_c_locale(_M_c_locale_timepunct); ++ } +--- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_base.h ++++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_base.h +@@ -0,0 +1,64 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++/** @file ctype_base.h ++ * This is an internal header file, included by other library headers. ++ * You should not attempt to use it directly. ++ */ ++ ++// Information as gleaned from /usr/include/ctype.h ++ ++ /// @brief Base class for ctype. ++ struct ctype_base ++ { ++ // Note: In uClibc, the following two types depend on configuration. ++ ++ // Non-standard typedefs. ++ typedef const __ctype_touplow_t* __to_type; ++ ++ // NB: Offsets into ctype<char>::_M_table force a particular size ++ // on the mask type. Because of this, we don't use an enum. ++ typedef __ctype_mask_t mask; ++ static const mask upper = _ISupper; ++ static const mask lower = _ISlower; ++ static const mask alpha = _ISalpha; ++ static const mask digit = _ISdigit; ++ static const mask xdigit = _ISxdigit; ++ static const mask space = _ISspace; ++ static const mask print = _ISprint; ++ static const mask graph = _ISalpha | _ISdigit | _ISpunct; ++ static const mask cntrl = _IScntrl; ++ static const mask punct = _ISpunct; ++ static const mask alnum = _ISalpha | _ISdigit; ++ }; +--- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_inline.h ++++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_inline.h +@@ -0,0 +1,69 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 2000, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) ++// functions go in ctype.cc ++ ++ bool ++ ctype<char>:: ++ is(mask __m, char __c) const ++ { return _M_table[static_cast<unsigned char>(__c)] & __m; } ++ ++ const char* ++ ctype<char>:: ++ is(const char* __low, const char* __high, mask* __vec) const ++ { ++ while (__low < __high) ++ *__vec++ = _M_table[static_cast<unsigned char>(*__low++)]; ++ return __high; ++ } ++ ++ const char* ++ ctype<char>:: ++ scan_is(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && !(_M_table[static_cast<unsigned char>(*__low)] & __m)) ++ ++__low; ++ return __low; ++ } ++ ++ const char* ++ ctype<char>:: ++ scan_not(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0) ++ ++__low; ++ return __low; ++ } +--- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_noninline.h ++++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h +@@ -0,0 +1,92 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// Information as gleaned from /usr/include/ctype.h ++ ++ const ctype_base::mask* ++ ctype<char>::classic_table() throw() ++ { return __C_ctype_b; } ++ ++ ctype<char>::ctype(__c_locale, const mask* __table, bool __del, ++ size_t __refs) ++ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), ++ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0) ++ { ++ _M_toupper = __C_ctype_toupper; ++ _M_tolower = __C_ctype_tolower; ++ _M_table = __table ? __table : __C_ctype_b; ++ memset(_M_widen, 0, sizeof(_M_widen)); ++ memset(_M_narrow, 0, sizeof(_M_narrow)); ++ } ++ ++ ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) ++ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), ++ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0) ++ { ++ _M_toupper = __C_ctype_toupper; ++ _M_tolower = __C_ctype_tolower; ++ _M_table = __table ? __table : __C_ctype_b; ++ memset(_M_widen, 0, sizeof(_M_widen)); ++ memset(_M_narrow, 0, sizeof(_M_narrow)); ++ } ++ ++ char ++ ctype<char>::do_toupper(char __c) const ++ { return _M_toupper[static_cast<unsigned char>(__c)]; } ++ ++ const char* ++ ctype<char>::do_toupper(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_toupper[static_cast<unsigned char>(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } ++ ++ char ++ ctype<char>::do_tolower(char __c) const ++ { return _M_tolower[static_cast<unsigned char>(__c)]; } ++ ++ const char* ++ ctype<char>::do_tolower(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_tolower[static_cast<unsigned char>(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } +--- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/os_defines.h ++++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/os_defines.h +@@ -0,0 +1,44 @@ ++// Specific definitions for GNU/Linux -*- C++ -*- ++ ++// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++#ifndef _GLIBCXX_OS_DEFINES ++#define _GLIBCXX_OS_DEFINES 1 ++ ++// System-specific #define, typedefs, corrections, etc, go here. This ++// file will come before all others. ++ ++// This keeps isanum, et al from being propagated as macros. ++#define __NO_CTYPE 1 ++ ++#include <features.h> ++ ++// We must not see the optimized string functions GNU libc defines. ++#define __NO_STRING_INLINES ++ ++#endif +--- gcc-4.1.0-dist/libstdc++-v3/configure ++++ gcc-4.1.0/libstdc++-v3/configure +@@ -4005,6 +4005,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +@@ -5740,7 +5745,7 @@ + enableval="$enable_clocale" + + case "$enableval" in +- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;; ++ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;; + *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5 + echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;} + { (exit 1); exit 1; }; } ;; +@@ -5765,6 +5770,9 @@ + # Default to "generic". + if test $enable_clocale_flag = auto; then + case ${target_os} in ++ linux-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ +@@ -5995,6 +6003,76 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ echo "$as_me:$LINENO: result: uclibc" >&5 ++echo "${ECHO_T}uclibc" >&6 ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ # Extract the first word of "msgfmt", so it can be a program name with args. ++set dummy msgfmt; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test -n "$check_msgfmt"; then ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_check_msgfmt="yes" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" ++fi ++fi ++check_msgfmt=$ac_cv_prog_check_msgfmt ++if test -n "$check_msgfmt"; then ++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 ++echo "${ECHO_T}$check_msgfmt" >&6 ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ ++ ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +--- gcc-4.1.0-dist/libstdc++-v3/configure.host ++++ gcc-4.1.0/libstdc++-v3/configure.host +@@ -261,6 +261,12 @@ + ;; + esac + ++# Override for uClibc since linux-uclibc gets mishandled above. ++case "${host_os}" in ++ *-uclibc*) ++ os_include_dir="os/uclibc" ++ ;; ++esac + + # Set any OS-dependent and CPU-dependent bits. + # THIS TABLE IS SORTED. KEEP IT THAT WAY. +--- gcc-4.1.0-dist/libstdc++-v3/crossconfig.m4 ++++ gcc-4.1.0/libstdc++-v3/crossconfig.m4 +@@ -143,6 +143,99 @@ + ;; + esac + ;; ++ *-uclibc*) ++# Temporary hack until we implement the float versions of the libm funcs ++ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ ++ machine/endian.h machine/param.h sys/machine.h sys/types.h \ ++ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h]) ++ SECTION_FLAGS='-ffunction-sections -fdata-sections' ++ AC_SUBST(SECTION_FLAGS) ++ GLIBCXX_CHECK_LINKER_FEATURES ++ GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT ++ GLIBCXX_CHECK_WCHAR_T_SUPPORT ++ ++ # For LFS. ++ AC_DEFINE(HAVE_INT64_T) ++ case "$target" in ++ *-uclinux*) ++ # Don't enable LFS with uClinux ++ ;; ++ *) ++ AC_DEFINE(_GLIBCXX_USE_LFS) ++ esac ++ ++ # For showmanyc_helper(). ++ AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) ++ GLIBCXX_CHECK_POLL ++ GLIBCXX_CHECK_S_ISREG_OR_S_IFREG ++ ++ # For xsputn_2(). ++ AC_CHECK_HEADERS(sys/uio.h) ++ GLIBCXX_CHECK_WRITEV ++ ++# AC_DEFINE(HAVE_ACOSF) ++# AC_DEFINE(HAVE_ASINF) ++# AC_DEFINE(HAVE_ATANF) ++# AC_DEFINE(HAVE_ATAN2F) ++ AC_DEFINE(HAVE_CEILF) ++ AC_DEFINE(HAVE_COPYSIGN) ++# AC_DEFINE(HAVE_COPYSIGNF) ++# AC_DEFINE(HAVE_COSF) ++# AC_DEFINE(HAVE_COSHF) ++# AC_DEFINE(HAVE_EXPF) ++# AC_DEFINE(HAVE_FABSF) ++ AC_DEFINE(HAVE_FINITE) ++ AC_DEFINE(HAVE_FINITEF) ++ AC_DEFINE(HAVE_FLOORF) ++# AC_DEFINE(HAVE_FMODF) ++# AC_DEFINE(HAVE_FREXPF) ++ AC_DEFINE(HAVE_HYPOT) ++# AC_DEFINE(HAVE_HYPOTF) ++ AC_DEFINE(HAVE_ISINF) ++ AC_DEFINE(HAVE_ISINFF) ++ AC_DEFINE(HAVE_ISNAN) ++ AC_DEFINE(HAVE_ISNANF) ++# AC_DEFINE(HAVE_LOGF) ++# AC_DEFINE(HAVE_LOG10F) ++# AC_DEFINE(HAVE_MODFF) ++# AC_DEFINE(HAVE_SINF) ++# AC_DEFINE(HAVE_SINHF) ++# AC_DEFINE(HAVE_SINCOS) ++# AC_DEFINE(HAVE_SINCOSF) ++ AC_DEFINE(HAVE_SQRTF) ++# AC_DEFINE(HAVE_TANF) ++# AC_DEFINE(HAVE_TANHF) ++ if test x"long_double_math_on_this_cpu" = x"yes"; then ++ AC_MSG_ERROR([long_double_math_on_this_cpu is yes!]) ++# AC_DEFINE(HAVE_ACOSL) ++# AC_DEFINE(HAVE_ASINL) ++# AC_DEFINE(HAVE_ATANL) ++# AC_DEFINE(HAVE_ATAN2L) ++# AC_DEFINE(HAVE_CEILL) ++# AC_DEFINE(HAVE_COPYSIGNL) ++# AC_DEFINE(HAVE_COSL) ++# AC_DEFINE(HAVE_COSHL) ++# AC_DEFINE(HAVE_EXPL) ++# AC_DEFINE(HAVE_FABSL) ++# AC_DEFINE(HAVE_FINITEL) ++# AC_DEFINE(HAVE_FLOORL) ++# AC_DEFINE(HAVE_FMODL) ++# AC_DEFINE(HAVE_FREXPL) ++# AC_DEFINE(HAVE_HYPOTL) ++# AC_DEFINE(HAVE_ISINFL) ++# AC_DEFINE(HAVE_ISNANL) ++# AC_DEFINE(HAVE_LOGL) ++# AC_DEFINE(HAVE_LOG10L) ++# AC_DEFINE(HAVE_MODFL) ++# AC_DEFINE(HAVE_POWL) ++# AC_DEFINE(HAVE_SINL) ++# AC_DEFINE(HAVE_SINHL) ++# AC_DEFINE(HAVE_SINCOSL) ++# AC_DEFINE(HAVE_SQRTL) ++# AC_DEFINE(HAVE_TANL) ++# AC_DEFINE(HAVE_TANHL) ++ fi ++ ;; + *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu) + AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ + machine/endian.h machine/param.h sys/machine.h sys/types.h \ +@@ -157,7 +250,7 @@ + AC_DEFINE(HAVE_INT64_T) + case "$target" in + *-uclinux*) +- # Don't enable LFS with uClibc ++ # Don't enable LFS with uClinux + ;; + *) + AC_DEFINE(_GLIBCXX_USE_LFS) +--- gcc-4.1.0-dist/libstdc++-v3/include/c_compatibility/wchar.h ++++ gcc-4.1.0/libstdc++-v3/include/c_compatibility/wchar.h +@@ -101,7 +101,9 @@ + using std::wmemcpy; + using std::wmemmove; + using std::wmemset; ++#if _GLIBCXX_HAVE_WCSFTIME + using std::wcsftime; ++#endif + + #if _GLIBCXX_USE_C99 + using std::wcstold; +--- gcc-4.1.0-dist/libstdc++-v3/include/c_std/std_cwchar.h ++++ gcc-4.1.0/libstdc++-v3/include/c_std/std_cwchar.h +@@ -180,7 +180,9 @@ + using ::wcscoll; + using ::wcscpy; + using ::wcscspn; ++#if _GLIBCXX_HAVE_WCSFTIME + using ::wcsftime; ++#endif + using ::wcslen; + using ::wcsncat; + using ::wcsncmp; diff --git a/patches/gcc/4.1.1/300-libstdc++-pic.patch b/patches/gcc/4.1.1/300-libstdc++-pic.patch new file mode 100644 index 00000000..560bcb23 --- /dev/null +++ b/patches/gcc/4.1.1/300-libstdc++-pic.patch @@ -0,0 +1,50 @@ +# DP: Build and install libstdc++_pic.a library. + +--- gcc/libstdc++-v3/src/Makefile.am ++++ gcc/libstdc++-v3/src/Makefile.am +@@ -214,6 +214,12 @@ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ + + ++install-exec-local: ++ifeq ($(enable_shared),yes) ++ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++endif ++ + # Added bits to build debug library. + if GLIBCXX_BUILD_DEBUG + all-local: build_debug +--- gcc/libstdc++-v3/src/Makefile.in ++++ gcc/libstdc++-v3/src/Makefile.in +@@ -627,7 +627,7 @@ + + install-data-am: install-data-local + +-install-exec-am: install-toolexeclibLTLIBRARIES ++install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local + + install-info: install-info-am + +@@ -660,6 +660,7 @@ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-data-local install-exec \ ++ install-exec-local \ + install-exec-am install-info install-info-am install-man \ + install-strip install-toolexeclibLTLIBRARIES installcheck \ + installcheck-am installdirs maintainer-clean \ +@@ -743,6 +743,13 @@ + install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ++ ++install-exec-local: ++ifeq ($(enable_shared),yes) ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++endif ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff --git a/patches/gcc/4.1.1/301-missing-execinfo_h.patch b/patches/gcc/4.1.1/301-missing-execinfo_h.patch new file mode 100644 index 00000000..0e2092f3 --- /dev/null +++ b/patches/gcc/4.1.1/301-missing-execinfo_h.patch @@ -0,0 +1,11 @@ +--- gcc-4.0.0/boehm-gc/include/gc.h-orig 2005-04-28 22:28:57.000000000 -0500 ++++ gcc-4.0.0/boehm-gc/include/gc.h 2005-04-28 22:30:38.000000000 -0500 +@@ -500,7 +500,7 @@ + #ifdef __linux__ + # include <features.h> + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/patches/gcc/4.1.1/302-c99-snprintf.patch b/patches/gcc/4.1.1/302-c99-snprintf.patch new file mode 100644 index 00000000..dfb22d68 --- /dev/null +++ b/patches/gcc/4.1.1/302-c99-snprintf.patch @@ -0,0 +1,11 @@ +--- gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h-orig 2005-04-29 00:08:41.000000000 -0500 ++++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h 2005-04-29 00:08:45.000000000 -0500 +@@ -142,7 +142,7 @@ + using ::vsprintf; + } + +-#if _GLIBCXX_USE_C99 ++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf diff --git a/patches/gcc/4.1.1/303-c99-complex-ugly-hack.patch b/patches/gcc/4.1.1/303-c99-complex-ugly-hack.patch new file mode 100644 index 00000000..2ccc80d9 --- /dev/null +++ b/patches/gcc/4.1.1/303-c99-complex-ugly-hack.patch @@ -0,0 +1,12 @@ +--- gcc-4.0.0/libstdc++-v3/configure-old 2005-04-30 22:04:48.061603912 -0500 ++++ gcc-4.0.0/libstdc++-v3/configure 2005-04-30 22:06:13.678588152 -0500 +@@ -7194,6 +7194,9 @@ + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + #include <complex.h> ++#ifdef __UCLIBC__ ++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs ++#endif + int + main () + { diff --git a/patches/gcc/4.1.1/304-index_macro.patch b/patches/gcc/4.1.1/304-index_macro.patch new file mode 100644 index 00000000..1fac112f --- /dev/null +++ b/patches/gcc/4.1.1/304-index_macro.patch @@ -0,0 +1,24 @@ +--- gcc-4.1.0/libstdc++-v3/include/ext/rope.mps 2006-03-24 01:49:51 +0100 ++++ gcc-4.1.0/libstdc++-v3/include/ext/rope 2006-03-24 01:49:37 +0100 +@@ -59,6 +59,9 @@ + #include <bits/allocator.h> + #include <ext/hash_fun.h> + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + # ifdef __GC + # define __GC_CONST const + # else +--- gcc-4.1.0/libstdc++-v3/include/ext/ropeimpl.h.mps 2006-03-24 01:50:04 +0100 ++++ gcc-4.1.0/libstdc++-v3/include/ext/ropeimpl.h 2006-03-24 01:50:28 +0100 +@@ -53,6 +53,9 @@ + #include <ext/memory> // For uninitialized_copy_n + #include <ext/numeric> // For power + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + namespace __gnu_cxx + { + using std::size_t; diff --git a/patches/gcc/4.1.1/740-sh-pr24836.patch b/patches/gcc/4.1.1/740-sh-pr24836.patch new file mode 100644 index 00000000..7992282c --- /dev/null +++ b/patches/gcc/4.1.1/740-sh-pr24836.patch @@ -0,0 +1,25 @@ +http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348 +http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24836 + +--- gcc/gcc/configure.ac (revision 106699) ++++ gcc/gcc/configure.ac (working copy) +@@ -2446,7 +2446,7 @@ + tls_first_minor=14 + tls_as_opt="-m64 -Aesame --fatal-warnings" + ;; +- sh-*-* | sh[34]-*-*) ++ sh-*-* | sh[34]*-*-*) + conftest_s=' + .section ".tdata","awT",@progbits + foo: .long 25 +--- gcc/gcc/configure ++++ gcc/gcc/configure +@@ -14846,7 +14846,7 @@ + tls_first_minor=14 + tls_as_opt="-m64 -Aesame --fatal-warnings" + ;; +- sh-*-* | sh[34]-*-*) ++ sh-*-* | sh[34]*-*-*) + conftest_s=' + .section ".tdata","awT",@progbits + foo: .long 25 diff --git a/patches/gcc/4.1.1/800-arm-bigendian.patch b/patches/gcc/4.1.1/800-arm-bigendian.patch new file mode 100644 index 00000000..1fa5ae1c --- /dev/null +++ b/patches/gcc/4.1.1/800-arm-bigendian.patch @@ -0,0 +1,67 @@ +By Lennert Buytenhek <buytenh@wantstofly.org> +Adds support for arm*b-linux* big-endian ARM targets + +See http://gcc.gnu.org/PR16350 + +--- gcc-4.1.0/gcc/config/arm/linux-elf.h ++++ gcc-4.1.0/gcc/config/arm/linux-elf.h +@@ -28,19 +28,33 @@ + #undef TARGET_VERSION + #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr); + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT MASK_BIG_END ++#define TARGET_ENDIAN_OPTION "mbig-endian" ++#define TARGET_LINKER_EMULATION "armelfb_linux" ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#define TARGET_ENDIAN_OPTION "mlittle-endian" ++#define TARGET_LINKER_EMULATION "armelf_linux" ++#endif ++ + #undef TARGET_DEFAULT_FLOAT_ABI + #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD + + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (0) ++#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT) + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" } + + /* Now we define the strings used to build the spec file. */ + #undef LIB_SPEC +@@ -61,7 +75,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker " LINUX_TARGET_INTERPRETER "} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #undef LINK_SPEC +--- gcc-4.1.0/gcc/config.gcc ++++ gcc-4.1.0/gcc/config.gcc +@@ -672,6 +672,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" ++ case $target in ++ arm*b-*) ++ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" ++ ;; ++ esac + tmake_file="${tmake_file} t-linux arm/t-arm" + case ${target} in + arm*-*-linux-gnueabi) diff --git a/patches/gcc/4.1.1/801-softfloat-fix.patch b/patches/gcc/4.1.1/801-softfloat-fix.patch new file mode 100644 index 00000000..844c9a06 --- /dev/null +++ b/patches/gcc/4.1.1/801-softfloat-fix.patch @@ -0,0 +1,58 @@ +This patch (C) 2007 Yann E. MORIN +Licensed under GPL v2. + +First hunk of this patch solves compiling uClibc-0.9.28{,.1} : + +make[1]: Entering directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' + LD libuClibc-0.9.29.so +libc/libc_so.a(difftime.os): In function `difftime': +difftime.c:(.text+0x8): undefined reference to `__floatsidf' +difftime.c:(.text+0x2c): undefined reference to `__subdf3' +libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr': +_fpmaxtostr.c:(.text+0xd4): undefined reference to `__nedf2' +_fpmaxtostr.c:(.text+0xf8): undefined reference to `__eqdf2' +_fpmaxtostr.c:(.text+0x114): undefined reference to `__divdf3' +_fpmaxtostr.c:(.text+0x120): undefined reference to `__ltdf2' +_fpmaxtostr.c:(.text+0x1c4): undefined reference to `__muldf3' +_fpmaxtostr.c:(.text+0x388): undefined reference to `__gedf2' +_fpmaxtostr.c:(.text+0x430): undefined reference to `__adddf3' +libc/libc_so.a(__psfs_do_numeric.os): In function `__psfs_do_numeric': +__psfs_do_numeric.c:(.text+0x520): undefined reference to `__truncdfsf2' +libc/libc_so.a(strtof.os): In function `strtof': +strtof.c:(.text+0x1c): undefined reference to `__extendsfdf2' +/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/cc_core_prefix/lib/gcc/arm-linux-uclibc/4.1.1/libgcc.a(_fixunsdfsi.o): +In function `__fixunsdfsi': +libgcc2.c:(.text+0x34): undefined reference to `__fixdfsi' +make[2]: *** [lib/libc.so] Error 1 +make[1]: *** [lib/libc.so.0] Error 2 +make[1]: Leaving directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' +make: *** [/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc/lib/libc.a] +Error 2 + +The second hunk fixes building final gcc because soft-float implies using -lfloat (which we don't have). + + +diff -dur gcc-4.1.1.no-softfloat-fix/gcc/config.gcc gcc-4.1.1/gcc/config.gcc +--- gcc-4.1.1.no-softfloat-fix/gcc/config.gcc 2007-02-01 21:57:17.000000000 +0100 ++++ gcc-4.1.1/gcc/config.gcc 2007-02-01 22:11:06.000000000 +0100 +@@ -690,7 +690,7 @@ + default_use_cxa_atexit=yes + ;; + *) +- tmake_file="$tmake_file arm/t-linux" ++ tmake_file="$tmake_file arm/t-linux arm/t-arm-elf" + ;; + esac + tm_file="$tm_file arm/aout.h arm/arm.h" +diff -dur gcc-4.1.1.-lfloat/gcc/config/arm/linux-elf.h gcc-4.1.1/gcc/config/arm/linux-elf.h +--- gcc-4.1.1.-lfloat/gcc/config/arm/linux-elf.h 2007-02-01 21:57:17.000000000 +0100 ++++ gcc-4.1.1/gcc/config/arm/linux-elf.h 2007-02-01 23:00:42.000000000 +0100 +@@ -63,7 +63,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + #ifdef USE_UCLIBC + #define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0" diff --git a/patches/gcc/4.1.2/100-uclibc-conf.patch b/patches/gcc/4.1.2/100-uclibc-conf.patch new file mode 100644 index 00000000..49d576c7 --- /dev/null +++ b/patches/gcc/4.1.2/100-uclibc-conf.patch @@ -0,0 +1,544 @@ +--- gcc-4.1.0/gcc/config/t-linux-uclibc ++++ gcc-4.1.0/gcc/config/t-linux-uclibc +@@ -0,0 +1,5 @@ ++# Remove glibc specific files added in t-linux ++SHLIB_MAPFILES := $(filter-out $(srcdir)/config/libgcc-glibc.ver, $(SHLIB_MAPFILES)) ++ ++# Use unwind-dw2-fde instead of unwind-dw2-fde-glibc ++LIB2ADDEH := $(subst unwind-dw2-fde-glibc.c,unwind-dw2-fde.c,$(LIB2ADDEH)) +--- gcc-4.1.0/gcc/config.gcc ++++ gcc-4.1.0/gcc/config.gcc +@@ -1887,7 +1887,7 @@ s390x-ibm-tpf*) + ;; + sh-*-elf* | sh[12346l]*-*-elf* | sh*-*-kaos* | \ + sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \ +- sh-*-linux* | sh[346lbe]*-*-linux* | \ ++ sh*-*-linux* | sh[346lbe]*-*-linux* | \ + sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \ + sh64-*-netbsd* | sh64l*-*-netbsd*) + tmake_file="${tmake_file} sh/t-sh sh/t-elf" +@@ -2341,6 +2341,12 @@ m32c-*-elf*) + ;; + esac + ++# Rather than hook into each target, just do it after all the linux ++# targets have been processed ++case ${target} in ++*-linux-uclibc*) tm_defines="${tm_defines} USE_UCLIBC" ; tmake_file="${tmake_file} t-linux-uclibc" ++esac ++ + case ${target} in + i[34567]86-*-linux*aout* | i[34567]86-*-linux*libc1) + tmake_file="${tmake_file} i386/t-gmm_malloc" +--- gcc-4.1.0/boehm-gc/configure ++++ gcc-4.1.0/boehm-gc/configure +@@ -4320,6 +4320,11 @@ linux-gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.1.0/configure ++++ gcc-4.1.0/configure +@@ -1133,7 +1133,7 @@ no) + ;; + "") + case "${target}" in +- *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu) ++ *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*) + # Enable libmudflap by default in GNU and friends. + ;; + *-*-freebsd*) +--- gcc-4.1.0/configure.in ++++ gcc-4.1.0/configure.in +@@ -341,7 +341,7 @@ no) + ;; + "") + case "${target}" in +- *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu) ++ *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*) + # Enable libmudflap by default in GNU and friends. + ;; + *-*-freebsd*) +--- gcc-4.1.0/contrib/regression/objs-gcc.sh ++++ gcc-4.1.0/contrib/regression/objs-gcc.sh +@@ -105,6 +105,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H + then + make all-gdb all-dejagnu all-ld || exit 1 + make install-gdb install-dejagnu install-ld || exit 1 ++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ] ++ then ++ make all-gdb all-dejagnu all-ld || exit 1 ++ make install-gdb install-dejagnu install-ld || exit 1 + elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then + make bootstrap || exit 1 + make install || exit 1 +--- gcc-4.1.0/gcc/config/alpha/linux-elf.h ++++ gcc-4.1.0/gcc/config/alpha/linux-elf.h +@@ -27,7 +27,11 @@ Boston, MA 02110-1301, USA. */ + #define SUBTARGET_EXTRA_SPECS \ + { "elf_dynamic_linker", ELF_DYNAMIC_LINKER }, + ++#if defined USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else + #define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + + #define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \ + %{O*:-O3} %{!O*:-O1} \ +--- gcc-4.1.0/gcc/config/arm/linux-elf.h ++++ gcc-4.1.0/gcc/config/arm/linux-elf.h +@@ -51,7 +51,11 @@ + + #define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" + ++#ifdef USE_UCLIBC ++#define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0" ++#else + #define LINUX_TARGET_INTERPRETER "/lib/ld-linux.so.2" ++#endif + + #define LINUX_TARGET_LINK_SPEC "%{h*} %{version:-v} \ + %{b} \ +--- gcc-4.1.0/gcc/config/cris/linux.h ++++ gcc-4.1.0/gcc/config/cris/linux.h +@@ -73,6 +73,25 @@ Boston, MA 02110-1301, USA. */ + #undef CRIS_DEFAULT_CPU_VERSION + #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG + ++#ifdef USE_UCLIBC ++ ++#undef CRIS_SUBTARGET_VERSION ++#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc" ++ ++#undef CRIS_LINK_SUBTARGET_SPEC ++#define CRIS_LINK_SUBTARGET_SPEC \ ++ "-mcrislinux\ ++ -rpath-link include/asm/../..%s\ ++ %{shared} %{static}\ ++ %{symbolic:-Bdynamic} %{shlib:-Bdynamic} %{static:-Bstatic}\ ++ %{!shared: \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} \ ++ %{!r:%{O2|O3: --gc-sections}}" ++ ++#else /* USE_UCLIBC */ ++ + #undef CRIS_SUBTARGET_VERSION + #define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu" + +@@ -87,6 +106,8 @@ Boston, MA 02110-1301, USA. */ + %{!shared:%{!static:%{rdynamic:-export-dynamic}}}\ + %{!r:%{O2|O3: --gc-sections}}" + ++#endif /* USE_UCLIBC */ ++ + + /* Node: Run-time Target */ + +--- gcc-4.1.0/gcc/config/i386/linux.h ++++ gcc-4.1.0/gcc/config/i386/linux.h +@@ -107,6 +107,11 @@ Boston, MA 02110-1301, USA. */ + #define LINK_EMULATION "elf_i386" + #define DYNAMIC_LINKER "/lib/ld-linux.so.2" + ++#if defined USE_UCLIBC ++#undef DYNAMIC_LINKER ++#define DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#endif ++ + #undef SUBTARGET_EXTRA_SPECS + #define SUBTARGET_EXTRA_SPECS \ + { "link_emulation", LINK_EMULATION },\ +--- gcc-4.1.0/gcc/config/i386/linux64.h ++++ gcc-4.1.0/gcc/config/i386/linux64.h +@@ -54,14 +54,21 @@ Boston, MA 02110-1301, USA. */ + When the -shared link option is used a final link is not being + done. */ + ++#ifdef USE_UCLIBC ++#define ELF32_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0" ++#else ++#define ELF32_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#define ELF64_DYNAMIC_LINKER "/lib64/ld-linux-x86-64.so.2" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \ + %{shared:-shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ +- %{!m32:%{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}}} \ ++ %{m32:%{!dynamic-linker:-dynamic-linker " ELF32_DYNAMIC_LINKER "}} \ ++ %{!m32:%{!dynamic-linker:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}} \ + %{static:-static}}" + + /* Similar to standard Linux, but adding -ffast-math support. */ +--- gcc-4.1.0/gcc/config/ia64/linux.h ++++ gcc-4.1.0/gcc/config/ia64/linux.h +@@ -37,13 +37,18 @@ do { \ + /* Define this for shared library support because it isn't in the main + linux.h file. */ + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "\ + %{shared:-shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux-ia64.so.2}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}" + + +--- gcc-4.1.0/gcc/config/m68k/linux.h ++++ gcc-4.1.0/gcc/config/m68k/linux.h +@@ -123,12 +123,17 @@ Boston, MA 02110-1301, USA. */ + + /* If ELF is the default format, we should not use /lib/elf. */ + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld.so.1" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "-m m68kelf %{shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker*:-dynamic-linker /lib/ld.so.1}} \ ++ %{!dynamic-linker*:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static}}" + + /* For compatibility with linux/a.out */ +--- gcc-4.1.0/gcc/config/mips/linux.h ++++ gcc-4.1.0/gcc/config/mips/linux.h +@@ -105,6 +105,11 @@ Boston, MA 02110-1301, USA. */ + + /* Borrowed from sparc/linux.h */ + #undef LINK_SPEC ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld.so.1" ++#endif + #define LINK_SPEC \ + "%(endian_spec) \ + %{shared:-shared} \ +@@ -112,7 +117,7 @@ Boston, MA 02110-1301, USA. */ + %{!ibcs: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}}" + + #undef SUBTARGET_ASM_SPEC +--- gcc-4.1.0/gcc/config/pa/pa-linux.h ++++ gcc-4.1.0/gcc/config/pa/pa-linux.h +@@ -49,13 +49,18 @@ Boston, MA 02110-1301, USA. */ + /* Define this for shared library support because it isn't in the main + linux.h file. */ + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld.so.1" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "\ + %{shared:-shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}" + + /* glibc's profiling functions don't need gcc to allocate counters. */ +--- gcc-4.1.0/gcc/config/rs6000/linux.h ++++ gcc-4.1.0/gcc/config/rs6000/linux.h +@@ -72,7 +72,11 @@ + #define LINK_START_DEFAULT_SPEC "%(link_start_linux)" + + #undef LINK_OS_DEFAULT_SPEC ++#ifdef USE_UCLIBC ++#define LINK_OS_DEFAULT_SPEC "%(link_os_linux_uclibc)" ++#else + #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)" ++#endif + + #define LINK_GCC_C_SEQUENCE_SPEC \ + "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" +--- gcc-4.1.0/gcc/config/rs6000/sysv4.h ++++ gcc-4.1.0/gcc/config/rs6000/sysv4.h +@@ -866,6 +866,7 @@ extern int fixuplabelno; + mcall-linux : %(link_os_linux) ; \ + mcall-gnu : %(link_os_gnu) ; \ + mcall-netbsd : %(link_os_netbsd) ; \ ++ mcall-linux-uclibc : %(link_os_linux_uclibc); \ + mcall-openbsd: %(link_os_openbsd) ; \ + : %(link_os_default) }" + +@@ -1043,6 +1044,10 @@ extern int fixuplabelno; + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}" + ++#define LINK_OS_LINUX_UCLIBC_SPEC "-m elf32ppclinux %{!shared: %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}}" ++ + #if defined(HAVE_LD_EH_FRAME_HDR) + # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " + #endif +@@ -1209,6 +1214,7 @@ ncrtn.o%s" + { "link_os_sim", LINK_OS_SIM_SPEC }, \ + { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \ + { "link_os_linux", LINK_OS_LINUX_SPEC }, \ ++ { "link_os_linux_uclibc", LINK_OS_LINUX_UCLIBC_SPEC }, \ + { "link_os_gnu", LINK_OS_GNU_SPEC }, \ + { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \ + { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \ +--- gcc-4.1.0/gcc/config/s390/linux.h ++++ gcc-4.1.0/gcc/config/s390/linux.h +@@ -77,6 +77,13 @@ Software Foundation, 51 Franklin Street, + #define MULTILIB_DEFAULTS { "m31" } + #endif + ++#ifdef USE_UCLIBC ++#define ELF31_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0" ++#else ++#define ELF31_DYNAMIC_LINKER "/lib/ld.so.1" ++#define ELF64_DYNAMIC_LINKER "/lib/ld64.so.1" ++#endif + #undef LINK_SPEC + #define LINK_SPEC \ + "%{m31:-m elf_s390}%{m64:-m elf64_s390} \ +@@ -86,8 +93,8 @@ Software Foundation, 51 Franklin Street, + %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker: \ +- %{m31:-dynamic-linker /lib/ld.so.1} \ +- %{m64:-dynamic-linker /lib/ld64.so.1}}}}" ++ %{m31:-dynamic-linker " ELF31_DYNAMIC_LINKER "} \ ++ %{m64:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}}}" + + + #define TARGET_ASM_FILE_END file_end_indicate_exec_stack +--- gcc-4.1.0/gcc/config/sh/linux.h ++++ gcc-4.1.0/gcc/config/sh/linux.h +@@ -56,12 +56,21 @@ Boston, MA 02110-1301, USA. */ + #undef SUBTARGET_LINK_EMUL_SUFFIX + #define SUBTARGET_LINK_EMUL_SUFFIX "_linux" + #undef SUBTARGET_LINK_SPEC ++#ifdef USE_UCLIBC ++#define SUBTARGET_LINK_SPEC \ ++ "%{shared:-shared} \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \ ++ %{static:-static}" ++#else + #define SUBTARGET_LINK_SPEC \ + "%{shared:-shared} \ + %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ + %{static:-static}" ++#endif + + /* Output assembler code to STREAM to call the profiler. */ + +--- gcc-4.1.0/gcc/config/sparc/linux.h ++++ gcc-4.1.0/gcc/config/sparc/linux.h +@@ -125,6 +125,11 @@ Boston, MA 02110-1301, USA. */ + + /* If ELF is the default format, we should not use /lib/elf. */ + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + #undef LINK_SPEC + #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ + %{!mno-relax:%{!r:-relax}} \ +@@ -132,7 +137,7 @@ Boston, MA 02110-1301, USA. */ + %{!ibcs: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}}" + + /* The sun bundled assembler doesn't accept -Yd, (and neither does gas). +--- gcc-4.1.0/gcc/config/sparc/linux64.h ++++ gcc-4.1.0/gcc/config/sparc/linux64.h +@@ -162,12 +162,17 @@ Boston, MA 02110-1301, USA. */ + { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \ + { "link_arch", LINK_ARCH_SPEC }, + ++#ifdef USE_UCLIBC ++#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#else ++#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#endif + #define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ + %{!shared: \ + %{!ibcs: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ +- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ ++ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ + %{static:-static}}} \ + " + +--- gcc-4.1.0/libffi/configure ++++ gcc-4.1.0/libffi/configure +@@ -3457,6 +3457,11 @@ linux-gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.1.0/libgfortran/configure ++++ gcc-4.1.0/libgfortran/configure +@@ -3699,6 +3699,11 @@ linux-gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.1.0/libjava/configure ++++ gcc-4.1.0/libjava/configure +@@ -5137,6 +5137,11 @@ linux-gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.1.0/libmudflap/configure ++++ gcc-4.1.0/libmudflap/configure +@@ -5382,6 +5382,11 @@ linux-gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.1.0/libobjc/configure ++++ gcc-4.1.0/libobjc/configure +@@ -3312,6 +3312,11 @@ linux-gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +--- gcc-4.1.0/libtool.m4 ++++ gcc-4.1.0/libtool.m4 +@@ -743,6 +743,11 @@ linux-gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'] +--- gcc-4.1.0/ltconfig ++++ gcc-4.1.0/ltconfig +@@ -603,6 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)- + + # Transform linux* to *-*-linux-gnu*, to support old configure scripts. + case $host_os in ++linux-uclibc*) ;; + linux-gnu*) ;; + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` + esac +@@ -1274,6 +1275,23 @@ linux-gnu*) + dynamic_linker='GNU/Linux ld.so' + ;; + ++linux-uclibc*) ++ version_type=linux ++ need_lib_prefix=no ++ need_version=no ++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' ++ soname_spec='${libname}${release}.so$major' ++ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' ++ shlibpath_var=LD_LIBRARY_PATH ++ shlibpath_overrides_runpath=no ++ # This implies no fast_install, which is unacceptable. ++ # Some rework will be needed to allow for fast_install ++ # before this can be enabled. ++ hardcode_into_libs=yes ++ # Assume using the uClibc dynamic linker. ++ dynamic_linker="uClibc ld.so" ++ ;; ++ + netbsd*) + need_lib_prefix=no + need_version=no +--- gcc-4.1.0/zlib/configure ++++ gcc-4.1.0/zlib/configure +@@ -3426,6 +3426,11 @@ linux-gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' diff --git a/patches/gcc/4.1.2/110-arm-eabi.patch b/patches/gcc/4.1.2/110-arm-eabi.patch new file mode 100644 index 00000000..acebe530 --- /dev/null +++ b/patches/gcc/4.1.2/110-arm-eabi.patch @@ -0,0 +1,27 @@ +--- gcc-2005q3-1.orig/gcc/config.gcc 2005-10-31 19:02:54.000000000 +0300 ++++ gcc-2005q3-1/gcc/config.gcc 2006-01-27 01:09:09.000000000 +0300 +@@ -674,7 +674,7 @@ + tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" + tmake_file="t-slibgcc-elf-ver t-linux arm/t-arm" + case ${target} in +- arm*-*-linux-gnueabi) ++ arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi) + tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h" + tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi" + # The BPABI long long divmod functions return a 128-bit value in + +diff -urN gcc-2005q3-2/gcc/config/arm/linux-eabi.h gcc-2005q3-2.new/gcc/config/arm/linux-eabi.h +--- gcc-2005q3-2/gcc/config/arm/linux-eabi.h 2005-12-07 23:14:16.000000000 +0300 ++++ gcc-2005q3-2.new/gcc/config/arm/linux-eabi.h 2006-03-29 19:02:34.000000000 +0400 +@@ -53,7 +53,11 @@ + /* Use ld-linux.so.3 so that it will be possible to run "classic" + GNU/Linux binaries on an EABI system. */ + #undef LINUX_TARGET_INTERPRETER ++#ifdef USE_UCLIBC ++#define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0" ++#else + #define LINUX_TARGET_INTERPRETER "/lib/ld-linux.so.3" ++#endif + + /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to + use the GNU/Linux version, not the generic BPABI version. */ diff --git a/patches/gcc/4.1.2/200-uclibc-locale.patch b/patches/gcc/4.1.2/200-uclibc-locale.patch new file mode 100644 index 00000000..e5d712e7 --- /dev/null +++ b/patches/gcc/4.1.2/200-uclibc-locale.patch @@ -0,0 +1,3239 @@ +--- gcc-4.1.0-dist/libstdc++-v3/acinclude.m4 ++++ gcc-4.1.0/libstdc++-v3/acinclude.m4 +@@ -1071,7 +1071,7 @@ + AC_MSG_CHECKING([for C locale to use]) + GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], + [use MODEL for target locale package], +- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto]) ++ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto]) + + # If they didn't use this option switch, or if they specified --enable + # with no specific model, we'll have to look for one. If they +@@ -1087,6 +1087,9 @@ + # Default to "generic". + if test $enable_clocale_flag = auto; then + case ${target_os} in ++ *-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) + AC_EGREP_CPP([_GLIBCXX_ok], [ + #include <features.h> +@@ -1230,6 +1233,40 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ AC_MSG_RESULT(uclibc) ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ AC_SUBST(glibcxx_MOFILES) ++ AC_SUBST(glibcxx_POFILES) ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c++locale_internal.h ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h +@@ -0,0 +1,63 @@ ++// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*- ++ ++// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// Written by Jakub Jelinek <jakub@redhat.com> ++ ++#include <bits/c++config.h> ++#include <clocale> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning clean this up ++#endif ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ ++extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l; ++extern "C" __typeof(strcoll_l) __strcoll_l; ++extern "C" __typeof(strftime_l) __strftime_l; ++extern "C" __typeof(strtod_l) __strtod_l; ++extern "C" __typeof(strtof_l) __strtof_l; ++extern "C" __typeof(strtold_l) __strtold_l; ++extern "C" __typeof(strxfrm_l) __strxfrm_l; ++extern "C" __typeof(newlocale) __newlocale; ++extern "C" __typeof(freelocale) __freelocale; ++extern "C" __typeof(duplocale) __duplocale; ++extern "C" __typeof(uselocale) __uselocale; ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++extern "C" __typeof(iswctype_l) __iswctype_l; ++extern "C" __typeof(towlower_l) __towlower_l; ++extern "C" __typeof(towupper_l) __towupper_l; ++extern "C" __typeof(wcscoll_l) __wcscoll_l; ++extern "C" __typeof(wcsftime_l) __wcsftime_l; ++extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l; ++extern "C" __typeof(wctype_l) __wctype_l; ++#endif ++ ++#endif // GLIBC 2.3 and later +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c_locale.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c_locale.cc +@@ -0,0 +1,152 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <cerrno> // For errno ++#include <locale> ++#include <stdexcept> ++#include <langinfo.h> ++#include <bits/c++locale_internal.h> ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __strtol_l(S, E, B, L) strtol((S), (E), (B)) ++#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B)) ++#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B)) ++#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B)) ++#define __strtof_l(S, E, L) strtof((S), (E)) ++#define __strtod_l(S, E, L) strtod((S), (E)) ++#define __strtold_l(S, E, L) strtold((S), (E)) ++#warning should dummy __newlocale check for C|POSIX ? ++#define __newlocale(a, b, c) NULL ++#define __freelocale(a) ((void)0) ++#define __duplocale(a) __c_locale() ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ char* __sanity; ++ errno = 0; ++ float __f = __strtof_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __f; ++ else ++ __err |= ios_base::failbit; ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ char* __sanity; ++ errno = 0; ++ double __d = __strtod_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __d; ++ else ++ __err |= ios_base::failbit; ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ char* __sanity; ++ errno = 0; ++ long double __ld = __strtold_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __ld; ++ else ++ __err |= ios_base::failbit; ++ } ++ ++ void ++ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, ++ __c_locale __old) ++ { ++ __cloc = __newlocale(1 << LC_ALL, __s, __old); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ if (!__cloc) ++ { ++ // This named locale is not supported by the underlying OS. ++ __throw_runtime_error(__N("locale::facet::_S_create_c_locale " ++ "name not valid")); ++ } ++#endif ++ } ++ ++ void ++ locale::facet::_S_destroy_c_locale(__c_locale& __cloc) ++ { ++ if (__cloc && _S_get_c_locale() != __cloc) ++ __freelocale(__cloc); ++ } ++ ++ __c_locale ++ locale::facet::_S_clone_c_locale(__c_locale& __cloc) ++ { return __duplocale(__cloc); } ++} // namespace std ++ ++namespace __gnu_cxx ++{ ++ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] = ++ { ++ "LC_CTYPE", ++ "LC_NUMERIC", ++ "LC_TIME", ++ "LC_COLLATE", ++ "LC_MONETARY", ++ "LC_MESSAGES", ++#if _GLIBCXX_NUM_CATEGORIES != 0 ++ "LC_PAPER", ++ "LC_NAME", ++ "LC_ADDRESS", ++ "LC_TELEPHONE", ++ "LC_MEASUREMENT", ++ "LC_IDENTIFICATION" ++#endif ++ }; ++} ++ ++namespace std ++{ ++ const char* const* const locale::_S_categories = __gnu_cxx::category_names; ++} // namespace std +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c_locale.h ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c_locale.h +@@ -0,0 +1,117 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#ifndef _C_LOCALE_H ++#define _C_LOCALE_H 1 ++ ++#pragma GCC system_header ++ ++#include <cstring> // get std::strlen ++#include <cstdio> // get std::snprintf or std::sprintf ++#include <clocale> ++#include <langinfo.h> // For codecvt ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC_HAS_LOCALE__ ++#include <iconv.h> // For codecvt using iconv, iconv_t ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#include <libintl.h> // For messages ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning what is _GLIBCXX_C_LOCALE_GNU for ++#endif ++#define _GLIBCXX_C_LOCALE_GNU 1 ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix categories ++#endif ++// #define _GLIBCXX_NUM_CATEGORIES 6 ++#define _GLIBCXX_NUM_CATEGORIES 0 ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++namespace __gnu_cxx ++{ ++ extern "C" __typeof(uselocale) __uselocale; ++} ++#endif ++ ++namespace std ++{ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ typedef __locale_t __c_locale; ++#else ++ typedef int* __c_locale; ++#endif ++ ++ // Convert numeric value of type _Tv to string and return length of ++ // string. If snprintf is available use it, otherwise fall back to ++ // the unsafe sprintf which, in general, can be dangerous and should ++ // be avoided. ++ template<typename _Tv> ++ int ++ __convert_from_v(char* __out, ++ const int __size __attribute__ ((__unused__)), ++ const char* __fmt, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ _Tv __v, const __c_locale& __cloc, int __prec) ++ { ++ __c_locale __old = __gnu_cxx::__uselocale(__cloc); ++#else ++ _Tv __v, const __c_locale&, int __prec) ++ { ++# ifdef __UCLIBC_HAS_LOCALE__ ++ char* __old = std::setlocale(LC_ALL, NULL); ++ char* __sav = new char[std::strlen(__old) + 1]; ++ std::strcpy(__sav, __old); ++ std::setlocale(LC_ALL, "C"); ++# endif ++#endif ++ ++ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __gnu_cxx::__uselocale(__old); ++#elif defined __UCLIBC_HAS_LOCALE__ ++ std::setlocale(LC_ALL, __sav); ++ delete [] __sav; ++#endif ++ return __ret; ++ } ++} ++ ++#endif +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/codecvt_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc +@@ -0,0 +1,306 @@ ++// std::codecvt implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.5 - Template class codecvt ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++namespace std ++{ ++ // Specializations. ++#ifdef _GLIBCXX_USE_WCHAR_T ++ codecvt_base::result ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_out(state_type& __state, const intern_type* __from, ++ const intern_type* __from_end, const intern_type*& __from_next, ++ extern_type* __to, extern_type* __to_end, ++ extern_type*& __to_next) const ++ { ++ result __ret = ok; ++ state_type __tmp_state(__state); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ ++ // wcsnrtombs is *very* fast but stops if encounters NUL characters: ++ // in case we fall back to wcrtomb and then continue, in a loop. ++ // NB: wcsnrtombs is a GNU extension ++ for (__from_next = __from, __to_next = __to; ++ __from_next < __from_end && __to_next < __to_end ++ && __ret == ok;) ++ { ++ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0', ++ __from_end - __from_next); ++ if (!__from_chunk_end) ++ __from_chunk_end = __from_end; ++ ++ __from = __from_next; ++ const size_t __conv = wcsnrtombs(__to_next, &__from_next, ++ __from_chunk_end - __from_next, ++ __to_end - __to_next, &__state); ++ if (__conv == static_cast<size_t>(-1)) ++ { ++ // In case of error, in order to stop at the exact place we ++ // have to start again from the beginning with a series of ++ // wcrtomb. ++ for (; __from < __from_next; ++__from) ++ __to_next += wcrtomb(__to_next, *__from, &__tmp_state); ++ __state = __tmp_state; ++ __ret = error; ++ } ++ else if (__from_next && __from_next < __from_chunk_end) ++ { ++ __to_next += __conv; ++ __ret = partial; ++ } ++ else ++ { ++ __from_next = __from_chunk_end; ++ __to_next += __conv; ++ } ++ ++ if (__from_next < __from_end && __ret == ok) ++ { ++ extern_type __buf[MB_LEN_MAX]; ++ __tmp_state = __state; ++ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state); ++ if (__conv > static_cast<size_t>(__to_end - __to_next)) ++ __ret = partial; ++ else ++ { ++ memcpy(__to_next, __buf, __conv); ++ __state = __tmp_state; ++ __to_next += __conv; ++ ++__from_next; ++ } ++ } ++ } ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ return __ret; ++ } ++ ++ codecvt_base::result ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_in(state_type& __state, const extern_type* __from, ++ const extern_type* __from_end, const extern_type*& __from_next, ++ intern_type* __to, intern_type* __to_end, ++ intern_type*& __to_next) const ++ { ++ result __ret = ok; ++ state_type __tmp_state(__state); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ ++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters: ++ // in case we store a L'\0' and then continue, in a loop. ++ // NB: mbsnrtowcs is a GNU extension ++ for (__from_next = __from, __to_next = __to; ++ __from_next < __from_end && __to_next < __to_end ++ && __ret == ok;) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0', ++ __from_end ++ - __from_next)); ++ if (!__from_chunk_end) ++ __from_chunk_end = __from_end; ++ ++ __from = __from_next; ++ size_t __conv = mbsnrtowcs(__to_next, &__from_next, ++ __from_chunk_end - __from_next, ++ __to_end - __to_next, &__state); ++ if (__conv == static_cast<size_t>(-1)) ++ { ++ // In case of error, in order to stop at the exact place we ++ // have to start again from the beginning with a series of ++ // mbrtowc. ++ for (;; ++__to_next, __from += __conv) ++ { ++ __conv = mbrtowc(__to_next, __from, __from_end - __from, ++ &__tmp_state); ++ if (__conv == static_cast<size_t>(-1) ++ || __conv == static_cast<size_t>(-2)) ++ break; ++ } ++ __from_next = __from; ++ __state = __tmp_state; ++ __ret = error; ++ } ++ else if (__from_next && __from_next < __from_chunk_end) ++ { ++ // It is unclear what to return in this case (see DR 382). ++ __to_next += __conv; ++ __ret = partial; ++ } ++ else ++ { ++ __from_next = __from_chunk_end; ++ __to_next += __conv; ++ } ++ ++ if (__from_next < __from_end && __ret == ok) ++ { ++ if (__to_next < __to_end) ++ { ++ // XXX Probably wrong for stateful encodings ++ __tmp_state = __state; ++ ++__from_next; ++ *__to_next++ = L'\0'; ++ } ++ else ++ __ret = partial; ++ } ++ } ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ return __ret; ++ } ++ ++ int ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_encoding() const throw() ++ { ++ // XXX This implementation assumes that the encoding is ++ // stateless and is either single-byte or variable-width. ++ int __ret = 0; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ if (MB_CUR_MAX == 1) ++ __ret = 1; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __ret; ++ } ++ ++ int ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_max_length() const throw() ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ // XXX Probably wrong for stateful encodings. ++ int __ret = MB_CUR_MAX; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __ret; ++ } ++ ++ int ++ codecvt<wchar_t, char, mbstate_t>:: ++ do_length(state_type& __state, const extern_type* __from, ++ const extern_type* __end, size_t __max) const ++ { ++ int __ret = 0; ++ state_type __tmp_state(__state); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_codecvt); ++#endif ++ ++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters: ++ // in case we advance past it and then continue, in a loop. ++ // NB: mbsnrtowcs is a GNU extension ++ ++ // A dummy internal buffer is needed in order for mbsnrtocws to consider ++ // its fourth parameter (it wouldn't with NULL as first parameter). ++ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t) ++ * __max)); ++ while (__from < __end && __max) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0', ++ __end ++ - __from)); ++ if (!__from_chunk_end) ++ __from_chunk_end = __end; ++ ++ const extern_type* __tmp_from = __from; ++ size_t __conv = mbsnrtowcs(__to, &__from, ++ __from_chunk_end - __from, ++ __max, &__state); ++ if (__conv == static_cast<size_t>(-1)) ++ { ++ // In case of error, in order to stop at the exact place we ++ // have to start again from the beginning with a series of ++ // mbrtowc. ++ for (__from = __tmp_from;; __from += __conv) ++ { ++ __conv = mbrtowc(NULL, __from, __end - __from, ++ &__tmp_state); ++ if (__conv == static_cast<size_t>(-1) ++ || __conv == static_cast<size_t>(-2)) ++ break; ++ } ++ __state = __tmp_state; ++ __ret += __from - __tmp_from; ++ break; ++ } ++ if (!__from) ++ __from = __from_chunk_end; ++ ++ __ret += __from - __tmp_from; ++ __max -= __conv; ++ ++ if (__from < __end && __max) ++ { ++ // XXX Probably wrong for stateful encodings ++ __tmp_state = __state; ++ ++__from; ++ ++__ret; ++ --__max; ++ } ++ } ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ return __ret; ++ } ++#endif ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/collate_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/collate_members.cc +@@ -0,0 +1,80 @@ ++// std::collate implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.4.1.2 collate virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __strcoll_l(S1, S2, L) strcoll((S1), (S2)) ++#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N)) ++#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2)) ++#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N)) ++#endif ++ ++namespace std ++{ ++ // These are basically extensions to char_traits, and perhaps should ++ // be put there instead of here. ++ template<> ++ int ++ collate<char>::_M_compare(const char* __one, const char* __two) const ++ { ++ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate); ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); ++ } ++ ++ template<> ++ size_t ++ collate<char>::_M_transform(char* __to, const char* __from, ++ size_t __n) const ++ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ int ++ collate<wchar_t>::_M_compare(const wchar_t* __one, ++ const wchar_t* __two) const ++ { ++ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate); ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); ++ } ++ ++ template<> ++ size_t ++ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from, ++ size_t __n) const ++ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); } ++#endif ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/ctype_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc +@@ -0,0 +1,314 @@ ++// std::ctype implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions. ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#define _LIBC ++#include <locale> ++#undef _LIBC ++#include <bits/c++locale_internal.h> ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __wctype_l(S, L) wctype((S)) ++#define __towupper_l(C, L) towupper((C)) ++#define __towlower_l(C, L) towlower((C)) ++#define __iswctype_l(C, M, L) iswctype((C), (M)) ++#endif ++ ++namespace std ++{ ++ // NB: The other ctype<char> specializations are in src/locale.cc and ++ // various /config/os/* files. ++ template<> ++ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs) ++ : ctype<char>(0, false, __refs) ++ { ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ++ { ++ this->_S_destroy_c_locale(this->_M_c_locale_ctype); ++ this->_S_create_c_locale(this->_M_c_locale_ctype, __s); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper; ++ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower; ++ this->_M_table = this->_M_c_locale_ctype->__ctype_b; ++#endif ++ } ++ } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ ctype<wchar_t>::__wmask_type ++ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const ++ { ++ __wmask_type __ret; ++ switch (__m) ++ { ++ case space: ++ __ret = __wctype_l("space", _M_c_locale_ctype); ++ break; ++ case print: ++ __ret = __wctype_l("print", _M_c_locale_ctype); ++ break; ++ case cntrl: ++ __ret = __wctype_l("cntrl", _M_c_locale_ctype); ++ break; ++ case upper: ++ __ret = __wctype_l("upper", _M_c_locale_ctype); ++ break; ++ case lower: ++ __ret = __wctype_l("lower", _M_c_locale_ctype); ++ break; ++ case alpha: ++ __ret = __wctype_l("alpha", _M_c_locale_ctype); ++ break; ++ case digit: ++ __ret = __wctype_l("digit", _M_c_locale_ctype); ++ break; ++ case punct: ++ __ret = __wctype_l("punct", _M_c_locale_ctype); ++ break; ++ case xdigit: ++ __ret = __wctype_l("xdigit", _M_c_locale_ctype); ++ break; ++ case alnum: ++ __ret = __wctype_l("alnum", _M_c_locale_ctype); ++ break; ++ case graph: ++ __ret = __wctype_l("graph", _M_c_locale_ctype); ++ break; ++ default: ++ __ret = __wmask_type(); ++ } ++ return __ret; ++ } ++ ++ wchar_t ++ ctype<wchar_t>::do_toupper(wchar_t __c) const ++ { return __towupper_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const ++ { ++ while (__lo < __hi) ++ { ++ *__lo = __towupper_l(*__lo, _M_c_locale_ctype); ++ ++__lo; ++ } ++ return __hi; ++ } ++ ++ wchar_t ++ ctype<wchar_t>::do_tolower(wchar_t __c) const ++ { return __towlower_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const ++ { ++ while (__lo < __hi) ++ { ++ *__lo = __towlower_l(*__lo, _M_c_locale_ctype); ++ ++__lo; ++ } ++ return __hi; ++ } ++ ++ bool ++ ctype<wchar_t>:: ++ do_is(mask __m, wchar_t __c) const ++ { ++ // The case of __m == ctype_base::space is particularly important, ++ // due to its use in many istream functions. Therefore we deal with ++ // it first, exploiting the knowledge that on GNU systems _M_bit[5] ++ // is the mask corresponding to ctype_base::space. NB: an encoding ++ // change would not affect correctness! ++ bool __ret = false; ++ if (__m == _M_bit[5]) ++ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype); ++ else ++ { ++ // Highest bitmask in ctype_base == 10, but extra in "C" ++ // library for blank. ++ const size_t __bitmasksize = 11; ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) ++ if (__m & _M_bit[__bitcur]) ++ { ++ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype)) ++ { ++ __ret = true; ++ break; ++ } ++ else if (__m == _M_bit[__bitcur]) ++ break; ++ } ++ } ++ return __ret; ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const ++ { ++ for (; __lo < __hi; ++__vec, ++__lo) ++ { ++ // Highest bitmask in ctype_base == 10, but extra in "C" ++ // library for blank. ++ const size_t __bitmasksize = 11; ++ mask __m = 0; ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) ++ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype)) ++ __m |= _M_bit[__bitcur]; ++ *__vec = __m; ++ } ++ return __hi; ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const ++ { ++ while (__lo < __hi && !this->do_is(__m, *__lo)) ++ ++__lo; ++ return __lo; ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const ++ { ++ while (__lo < __hi && this->do_is(__m, *__lo) != 0) ++ ++__lo; ++ return __lo; ++ } ++ ++ wchar_t ++ ctype<wchar_t>:: ++ do_widen(char __c) const ++ { return _M_widen[static_cast<unsigned char>(__c)]; } ++ ++ const char* ++ ctype<wchar_t>:: ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const ++ { ++ while (__lo < __hi) ++ { ++ *__dest = _M_widen[static_cast<unsigned char>(*__lo)]; ++ ++__lo; ++ ++__dest; ++ } ++ return __hi; ++ } ++ ++ char ++ ctype<wchar_t>:: ++ do_narrow(wchar_t __wc, char __dfault) const ++ { ++ if (__wc >= 0 && __wc < 128 && _M_narrow_ok) ++ return _M_narrow[__wc]; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_ctype); ++#endif ++ const int __c = wctob(__wc); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return (__c == EOF ? __dfault : static_cast<char>(__c)); ++ } ++ ++ const wchar_t* ++ ctype<wchar_t>:: ++ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault, ++ char* __dest) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_ctype); ++#endif ++ if (_M_narrow_ok) ++ while (__lo < __hi) ++ { ++ if (*__lo >= 0 && *__lo < 128) ++ *__dest = _M_narrow[*__lo]; ++ else ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c)); ++ } ++ ++__lo; ++ ++__dest; ++ } ++ else ++ while (__lo < __hi) ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c)); ++ ++__lo; ++ ++__dest; ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __hi; ++ } ++ ++ void ++ ctype<wchar_t>::_M_initialize_ctype() ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_ctype); ++#endif ++ wint_t __i; ++ for (__i = 0; __i < 128; ++__i) ++ { ++ const int __c = wctob(__i); ++ if (__c == EOF) ++ break; ++ else ++ _M_narrow[__i] = static_cast<char>(__c); ++ } ++ if (__i == 128) ++ _M_narrow_ok = true; ++ else ++ _M_narrow_ok = false; ++ for (size_t __j = 0; ++ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j) ++ _M_widen[__j] = btowc(__j); ++ ++ for (size_t __k = 0; __k <= 11; ++__k) ++ { ++ _M_bit[__k] = static_cast<mask>(_ISbit(__k)); ++ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]); ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ } ++#endif // _GLIBCXX_USE_WCHAR_T ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/messages_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/messages_members.cc +@@ -0,0 +1,100 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix gettext stuff ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++extern "C" char *__dcgettext(const char *domainname, ++ const char *msgid, int category); ++#undef gettext ++#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES) ++#else ++#undef gettext ++#define gettext(msgid) (msgid) ++#endif ++ ++namespace std ++{ ++ // Specializations. ++ template<> ++ string ++ messages<char>::do_get(catalog, int, int, const string& __dfault) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_messages); ++ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str())); ++ __uselocale(__old); ++ return string(__msg); ++#elif defined __UCLIBC_HAS_LOCALE__ ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_messages); ++ const char* __msg = gettext(__dfault.c_str()); ++ setlocale(LC_ALL, __old); ++ free(__old); ++ return string(__msg); ++#else ++ const char* __msg = gettext(__dfault.c_str()); ++ return string(__msg); ++#endif ++ } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ wstring ++ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const ++ { ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ __uselocale(__old); ++ return _M_convert_from_char(__msg); ++# elif defined __UCLIBC_HAS_LOCALE__ ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ setlocale(LC_ALL, __old); ++ free(__old); ++ return _M_convert_from_char(__msg); ++# else ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ return _M_convert_from_char(__msg); ++# endif ++ } ++#endif ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/messages_members.h ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/messages_members.h +@@ -0,0 +1,121 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix prototypes for *textdomain funcs ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++extern "C" char *__textdomain(const char *domainname); ++extern "C" char *__bindtextdomain(const char *domainname, ++ const char *dirname); ++#else ++#undef __textdomain ++#undef __bindtextdomain ++#define __textdomain(D) ((void)0) ++#define __bindtextdomain(D,P) ((void)0) ++#endif ++ ++ // Non-virtual member functions. ++ template<typename _CharT> ++ messages<_CharT>::messages(size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), ++ _M_name_messages(_S_get_c_name()) ++ { } ++ ++ template<typename _CharT> ++ messages<_CharT>::messages(__c_locale __cloc, const char* __s, ++ size_t __refs) ++ : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL) ++ { ++ const size_t __len = std::strlen(__s) + 1; ++ char* __tmp = new char[__len]; ++ std::memcpy(__tmp, __s, __len); ++ _M_name_messages = __tmp; ++ ++ // Last to avoid leaking memory if new throws. ++ _M_c_locale_messages = _S_clone_c_locale(__cloc); ++ } ++ ++ template<typename _CharT> ++ typename messages<_CharT>::catalog ++ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, ++ const char* __dir) const ++ { ++ __bindtextdomain(__s.c_str(), __dir); ++ return this->do_open(__s, __loc); ++ } ++ ++ // Virtual member functions. ++ template<typename _CharT> ++ messages<_CharT>::~messages() ++ { ++ if (_M_name_messages != _S_get_c_name()) ++ delete [] _M_name_messages; ++ _S_destroy_c_locale(_M_c_locale_messages); ++ } ++ ++ template<typename _CharT> ++ typename messages<_CharT>::catalog ++ messages<_CharT>::do_open(const basic_string<char>& __s, ++ const locale&) const ++ { ++ // No error checking is done, assume the catalog exists and can ++ // be used. ++ __textdomain(__s.c_str()); ++ return 0; ++ } ++ ++ template<typename _CharT> ++ void ++ messages<_CharT>::do_close(catalog) const ++ { } ++ ++ // messages_byname ++ template<typename _CharT> ++ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) ++ : messages<_CharT>(__refs) ++ { ++ if (this->_M_name_messages != locale::facet::_S_get_c_name()) ++ delete [] this->_M_name_messages; ++ char* __tmp = new char[std::strlen(__s) + 1]; ++ std::strcpy(__tmp, __s); ++ this->_M_name_messages = __tmp; ++ ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ++ { ++ this->_S_destroy_c_locale(this->_M_c_locale_messages); ++ this->_S_create_c_locale(this->_M_c_locale_messages, __s); ++ } ++ } +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/monetary_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc +@@ -0,0 +1,692 @@ ++// std::moneypunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#define _LIBC ++#include <locale> ++#undef _LIBC ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning optimize this for uclibc ++#warning tailor for stub locale support ++#endif ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ // Construct and return valid pattern consisting of some combination of: ++ // space none symbol sign value ++ money_base::pattern ++ money_base::_S_construct_pattern(char __precedes, char __space, char __posn) ++ { ++ pattern __ret; ++ ++ // This insanely complicated routine attempts to construct a valid ++ // pattern for use with monyepunct. A couple of invariants: ++ ++ // if (__precedes) symbol -> value ++ // else value -> symbol ++ ++ // if (__space) space ++ // else none ++ ++ // none == never first ++ // space never first or last ++ ++ // Any elegant implementations of this are welcome. ++ switch (__posn) ++ { ++ case 0: ++ case 1: ++ // 1 The sign precedes the value and symbol. ++ __ret.field[0] = sign; ++ if (__space) ++ { ++ // Pattern starts with sign. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[3] = symbol; ++ } ++ __ret.field[2] = space; ++ } ++ else ++ { ++ // Pattern starts with sign and ends with none. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[3] = none; ++ } ++ break; ++ case 2: ++ // 2 The sign follows the value and symbol. ++ if (__space) ++ { ++ // Pattern either ends with sign. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[1] = space; ++ __ret.field[3] = sign; ++ } ++ else ++ { ++ // Pattern ends with sign then none. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[1] = symbol; ++ } ++ __ret.field[2] = sign; ++ __ret.field[3] = none; ++ } ++ break; ++ case 3: ++ // 3 The sign immediately precedes the symbol. ++ if (__precedes) ++ { ++ __ret.field[0] = sign; ++ __ret.field[1] = symbol; ++ if (__space) ++ { ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[2] = value; ++ __ret.field[3] = none; ++ } ++ } ++ else ++ { ++ __ret.field[0] = value; ++ if (__space) ++ { ++ __ret.field[1] = space; ++ __ret.field[2] = sign; ++ __ret.field[3] = symbol; ++ } ++ else ++ { ++ __ret.field[1] = sign; ++ __ret.field[2] = symbol; ++ __ret.field[3] = none; ++ } ++ } ++ break; ++ case 4: ++ // 4 The sign immediately follows the symbol. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = sign; ++ if (__space) ++ { ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[2] = value; ++ __ret.field[3] = none; ++ } ++ } ++ else ++ { ++ __ret.field[0] = value; ++ if (__space) ++ { ++ __ret.field[1] = space; ++ __ret.field[2] = symbol; ++ __ret.field[3] = sign; ++ } ++ else ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = sign; ++ __ret.field[3] = none; ++ } ++ } ++ break; ++ default: ++ __ret = pattern(); ++ } ++ return __ret; ++ } ++ ++ template<> ++ void ++ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<char, true>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = '.'; ++ _M_data->_M_thousands_sep = ','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = ""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = ""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = ""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i]; ++ } ++ else ++ { ++ // Named locale. ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, ++ __cloc)); ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, ++ __cloc)); ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign); ++ ++ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); ++ if (!__nposn) ++ _M_data->_M_negative_sign = "()"; ++ else ++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, ++ __cloc); ++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign); ++ ++ // _Intl == true ++ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); ++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol); ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, ++ __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ } ++ } ++ ++ template<> ++ void ++ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<char, false>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = '.'; ++ _M_data->_M_thousands_sep = ','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = ""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = ""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = ""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i]; ++ } ++ else ++ { ++ // Named locale. ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, ++ __cloc)); ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, ++ __cloc)); ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign); ++ ++ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); ++ if (!__nposn) ++ _M_data->_M_negative_sign = "()"; ++ else ++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, ++ __cloc); ++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign); ++ ++ // _Intl == false ++ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); ++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol); ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ } ++ } ++ ++ template<> ++ moneypunct<char, true>::~moneypunct() ++ { delete _M_data; } ++ ++ template<> ++ moneypunct<char, false>::~moneypunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ const char*) ++#else ++ const char* __name) ++#endif ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<wchar_t, true>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = L'.'; ++ _M_data->_M_thousands_sep = L','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ // Use ctype::widen code without the facet... ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ _M_data->_M_atoms[__i] = ++ static_cast<wchar_t>(money_base::_S_atoms[__i]); ++ } ++ else ++ { ++ // Named locale. ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(__cloc); ++#else ++ // Switch to named locale so that mbsrtowcs will work. ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, __name); ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this... should be monetary ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# elif defined __UCLIBC_HAS_LOCALE__ ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); ++ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); ++ ++ wchar_t* __wcs_ps = 0; ++ wchar_t* __wcs_ns = 0; ++ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); ++ try ++ { ++ mbstate_t __state; ++ size_t __len = strlen(__cpossign); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ps = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); ++ _M_data->_M_positive_sign = __wcs_ps; ++ } ++ else ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); ++ ++ __len = strlen(__cnegsign); ++ if (!__nposn) ++ _M_data->_M_negative_sign = L"()"; ++ else if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ns = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); ++ _M_data->_M_negative_sign = __wcs_ns; ++ } ++ else ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); ++ ++ // _Intl == true. ++ __len = strlen(__ccurr); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state); ++ _M_data->_M_curr_symbol = __wcs; ++ } ++ else ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); ++ } ++ catch (...) ++ { ++ delete _M_data; ++ _M_data = 0; ++ delete __wcs_ps; ++ delete __wcs_ns; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ __throw_exception_again; ++ } ++ ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, ++ __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ } ++ } ++ ++ template<> ++ void ++ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ const char*) ++#else ++ const char* __name) ++#endif ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache<wchar_t, false>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_decimal_point = L'.'; ++ _M_data->_M_thousands_sep = L','; ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = 0; ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = 0; ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = 0; ++ _M_data->_M_frac_digits = 0; ++ _M_data->_M_pos_format = money_base::_S_default_pattern; ++ _M_data->_M_neg_format = money_base::_S_default_pattern; ++ ++ // Use ctype::widen code without the facet... ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i) ++ _M_data->_M_atoms[__i] = ++ static_cast<wchar_t>(money_base::_S_atoms[__i]); ++ } ++ else ++ { ++ // Named locale. ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(__cloc); ++#else ++ // Switch to named locale so that mbsrtowcs will work. ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, __name); ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this... should be monetary ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# elif defined __UCLIBC_HAS_LOCALE__ ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); ++ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); ++ ++ wchar_t* __wcs_ps = 0; ++ wchar_t* __wcs_ns = 0; ++ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); ++ try ++ { ++ mbstate_t __state; ++ size_t __len; ++ __len = strlen(__cpossign); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ps = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); ++ _M_data->_M_positive_sign = __wcs_ps; ++ } ++ else ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); ++ ++ __len = strlen(__cnegsign); ++ if (!__nposn) ++ _M_data->_M_negative_sign = L"()"; ++ else if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ns = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); ++ _M_data->_M_negative_sign = __wcs_ns; ++ } ++ else ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); ++ ++ // _Intl == true. ++ __len = strlen(__ccurr); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state); ++ _M_data->_M_curr_symbol = __wcs; ++ } ++ else ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); ++ } ++ catch (...) ++ { ++ delete _M_data; ++ _M_data = 0; ++ delete __wcs_ps; ++ delete __wcs_ns; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ __throw_exception_again; ++ } ++ ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ } ++ } ++ ++ template<> ++ moneypunct<wchar_t, true>::~moneypunct() ++ { ++ if (_M_data->_M_positive_sign_size) ++ delete [] _M_data->_M_positive_sign; ++ if (_M_data->_M_negative_sign_size ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0) ++ delete [] _M_data->_M_negative_sign; ++ if (_M_data->_M_curr_symbol_size) ++ delete [] _M_data->_M_curr_symbol; ++ delete _M_data; ++ } ++ ++ template<> ++ moneypunct<wchar_t, false>::~moneypunct() ++ { ++ if (_M_data->_M_positive_sign_size) ++ delete [] _M_data->_M_positive_sign; ++ if (_M_data->_M_negative_sign_size ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0) ++ delete [] _M_data->_M_negative_sign; ++ if (_M_data->_M_curr_symbol_size) ++ delete [] _M_data->_M_curr_symbol; ++ delete _M_data; ++ } ++#endif ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/numeric_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc +@@ -0,0 +1,173 @@ ++// std::numpunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#define _LIBC ++#include <locale> ++#undef _LIBC ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning tailor for stub locale support ++#endif ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache<char>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_use_grouping = false; ++ ++ _M_data->_M_decimal_point = '.'; ++ _M_data->_M_thousands_sep = ','; ++ ++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) ++ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i]; ++ ++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j) ++ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j]; ++ } ++ else ++ { ++ // Named locale. ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT, ++ __cloc)); ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP, ++ __cloc)); ++ ++ // Check for NULL, which implies no grouping. ++ if (_M_data->_M_thousands_sep == '\0') ++ _M_data->_M_grouping = ""; ++ else ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ } ++ ++ // NB: There is no way to extact this info from posix locales. ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); ++ _M_data->_M_truename = "true"; ++ _M_data->_M_truename_size = 4; ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); ++ _M_data->_M_falsename = "false"; ++ _M_data->_M_falsename_size = 5; ++ } ++ ++ template<> ++ numpunct<char>::~numpunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache<wchar_t>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_data->_M_grouping = ""; ++ _M_data->_M_grouping_size = 0; ++ _M_data->_M_use_grouping = false; ++ ++ _M_data->_M_decimal_point = L'.'; ++ _M_data->_M_thousands_sep = L','; ++ ++ // Use ctype::widen code without the facet... ++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) ++ _M_data->_M_atoms_out[__i] = ++ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]); ++ ++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j) ++ _M_data->_M_atoms_in[__j] = ++ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]); ++ } ++ else ++ { ++ // Named locale. ++ // NB: In the GNU model wchar_t is always 32 bit wide. ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# elif defined __UCLIBC_HAS_LOCALE__ ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ ++ if (_M_data->_M_thousands_sep == L'\0') ++ _M_data->_M_grouping = ""; ++ else ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ } ++ ++ // NB: There is no way to extact this info from posix locales. ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); ++ _M_data->_M_truename = L"true"; ++ _M_data->_M_truename_size = 4; ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); ++ _M_data->_M_falsename = L"false"; ++ _M_data->_M_falsename_size = 5; ++ } ++ ++ template<> ++ numpunct<wchar_t>::~numpunct() ++ { delete _M_data; } ++ #endif ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/time_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/time_members.cc +@@ -0,0 +1,406 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++#include <locale> ++#include <bits/c++locale_internal.h> ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning tailor for stub locale support ++#endif ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ __timepunct<char>:: ++ _M_put(char* __s, size_t __maxlen, const char* __format, ++ const tm* __tm) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm, ++ _M_c_locale_timepunct); ++#else ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_timepunct); ++ const size_t __len = strftime(__s, __maxlen, __format, __tm); ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ // Make sure __s is null terminated. ++ if (__len == 0) ++ __s[0] = '\0'; ++ } ++ ++ template<> ++ void ++ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache<char>; ++ ++ if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = "%m/%d/%y"; ++ _M_data->_M_date_era_format = "%m/%d/%y"; ++ _M_data->_M_time_format = "%H:%M:%S"; ++ _M_data->_M_time_era_format = "%H:%M:%S"; ++ _M_data->_M_date_time_format = ""; ++ _M_data->_M_date_time_era_format = ""; ++ _M_data->_M_am = "AM"; ++ _M_data->_M_pm = "PM"; ++ _M_data->_M_am_pm_format = ""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = "Sunday"; ++ _M_data->_M_day2 = "Monday"; ++ _M_data->_M_day3 = "Tuesday"; ++ _M_data->_M_day4 = "Wednesday"; ++ _M_data->_M_day5 = "Thursday"; ++ _M_data->_M_day6 = "Friday"; ++ _M_data->_M_day7 = "Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = "Sun"; ++ _M_data->_M_aday2 = "Mon"; ++ _M_data->_M_aday3 = "Tue"; ++ _M_data->_M_aday4 = "Wed"; ++ _M_data->_M_aday5 = "Thu"; ++ _M_data->_M_aday6 = "Fri"; ++ _M_data->_M_aday7 = "Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = "January"; ++ _M_data->_M_month02 = "February"; ++ _M_data->_M_month03 = "March"; ++ _M_data->_M_month04 = "April"; ++ _M_data->_M_month05 = "May"; ++ _M_data->_M_month06 = "June"; ++ _M_data->_M_month07 = "July"; ++ _M_data->_M_month08 = "August"; ++ _M_data->_M_month09 = "September"; ++ _M_data->_M_month10 = "October"; ++ _M_data->_M_month11 = "November"; ++ _M_data->_M_month12 = "December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = "Jan"; ++ _M_data->_M_amonth02 = "Feb"; ++ _M_data->_M_amonth03 = "Mar"; ++ _M_data->_M_amonth04 = "Apr"; ++ _M_data->_M_amonth05 = "May"; ++ _M_data->_M_amonth06 = "Jun"; ++ _M_data->_M_amonth07 = "Jul"; ++ _M_data->_M_amonth08 = "Aug"; ++ _M_data->_M_amonth09 = "Sep"; ++ _M_data->_M_amonth10 = "Oct"; ++ _M_data->_M_amonth11 = "Nov"; ++ _M_data->_M_amonth12 = "Dec"; ++ } ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc); ++ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc); ++ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc); ++ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc); ++ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc); ++ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT, ++ __cloc); ++ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc); ++ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc); ++ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc); ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc); ++ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc); ++ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc); ++ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc); ++ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc); ++ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc); ++ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc); ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc); ++ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc); ++ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc); ++ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc); ++ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc); ++ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc); ++ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc); ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc); ++ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc); ++ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc); ++ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc); ++ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc); ++ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc); ++ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc); ++ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc); ++ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc); ++ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc); ++ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc); ++ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc); ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc); ++ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc); ++ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc); ++ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc); ++ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc); ++ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc); ++ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc); ++ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc); ++ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc); ++ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc); ++ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc); ++ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc); ++ } ++ } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ __timepunct<wchar_t>:: ++ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format, ++ const tm* __tm) const ++ { ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct); ++ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm, ++ _M_c_locale_timepunct); ++#else ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_timepunct); ++ const size_t __len = wcsftime(__s, __maxlen, __format, __tm); ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ // Make sure __s is null terminated. ++ if (__len == 0) ++ __s[0] = L'\0'; ++ } ++ ++ template<> ++ void ++ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache<wchar_t>; ++ ++#warning wide time stuff ++// if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = L"%m/%d/%y"; ++ _M_data->_M_date_era_format = L"%m/%d/%y"; ++ _M_data->_M_time_format = L"%H:%M:%S"; ++ _M_data->_M_time_era_format = L"%H:%M:%S"; ++ _M_data->_M_date_time_format = L""; ++ _M_data->_M_date_time_era_format = L""; ++ _M_data->_M_am = L"AM"; ++ _M_data->_M_pm = L"PM"; ++ _M_data->_M_am_pm_format = L""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = L"Sunday"; ++ _M_data->_M_day2 = L"Monday"; ++ _M_data->_M_day3 = L"Tuesday"; ++ _M_data->_M_day4 = L"Wednesday"; ++ _M_data->_M_day5 = L"Thursday"; ++ _M_data->_M_day6 = L"Friday"; ++ _M_data->_M_day7 = L"Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = L"Sun"; ++ _M_data->_M_aday2 = L"Mon"; ++ _M_data->_M_aday3 = L"Tue"; ++ _M_data->_M_aday4 = L"Wed"; ++ _M_data->_M_aday5 = L"Thu"; ++ _M_data->_M_aday6 = L"Fri"; ++ _M_data->_M_aday7 = L"Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = L"January"; ++ _M_data->_M_month02 = L"February"; ++ _M_data->_M_month03 = L"March"; ++ _M_data->_M_month04 = L"April"; ++ _M_data->_M_month05 = L"May"; ++ _M_data->_M_month06 = L"June"; ++ _M_data->_M_month07 = L"July"; ++ _M_data->_M_month08 = L"August"; ++ _M_data->_M_month09 = L"September"; ++ _M_data->_M_month10 = L"October"; ++ _M_data->_M_month11 = L"November"; ++ _M_data->_M_month12 = L"December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = L"Jan"; ++ _M_data->_M_amonth02 = L"Feb"; ++ _M_data->_M_amonth03 = L"Mar"; ++ _M_data->_M_amonth04 = L"Apr"; ++ _M_data->_M_amonth05 = L"May"; ++ _M_data->_M_amonth06 = L"Jun"; ++ _M_data->_M_amonth07 = L"Jul"; ++ _M_data->_M_amonth08 = L"Aug"; ++ _M_data->_M_amonth09 = L"Sep"; ++ _M_data->_M_amonth10 = L"Oct"; ++ _M_data->_M_amonth11 = L"Nov"; ++ _M_data->_M_amonth12 = L"Dec"; ++ } ++#if 0 ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ union { char *__s; wchar_t *__w; } __u; ++ ++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); ++ _M_data->_M_date_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); ++ _M_data->_M_date_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); ++ _M_data->_M_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); ++ _M_data->_M_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); ++ _M_data->_M_date_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); ++ _M_data->_M_date_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); ++ _M_data->_M_am = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); ++ _M_data->_M_pm = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); ++ _M_data->_M_am_pm_format = __u.__w; ++ ++ // Day names, starting with "C"'s Sunday. ++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); ++ _M_data->_M_day1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); ++ _M_data->_M_day2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); ++ _M_data->_M_day3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); ++ _M_data->_M_day4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); ++ _M_data->_M_day5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); ++ _M_data->_M_day6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); ++ _M_data->_M_day7 = __u.__w; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); ++ _M_data->_M_aday1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); ++ _M_data->_M_aday2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); ++ _M_data->_M_aday3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); ++ _M_data->_M_aday4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); ++ _M_data->_M_aday5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); ++ _M_data->_M_aday6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); ++ _M_data->_M_aday7 = __u.__w; ++ ++ // Month names, starting with "C"'s January. ++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); ++ _M_data->_M_month01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); ++ _M_data->_M_month02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); ++ _M_data->_M_month03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); ++ _M_data->_M_month04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); ++ _M_data->_M_month05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); ++ _M_data->_M_month06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); ++ _M_data->_M_month07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); ++ _M_data->_M_month08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); ++ _M_data->_M_month09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); ++ _M_data->_M_month10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); ++ _M_data->_M_month11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); ++ _M_data->_M_month12 = __u.__w; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); ++ _M_data->_M_amonth01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); ++ _M_data->_M_amonth02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); ++ _M_data->_M_amonth03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); ++ _M_data->_M_amonth04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); ++ _M_data->_M_amonth05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); ++ _M_data->_M_amonth06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); ++ _M_data->_M_amonth07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); ++ _M_data->_M_amonth08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); ++ _M_data->_M_amonth09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); ++ _M_data->_M_amonth10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); ++ _M_data->_M_amonth11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); ++ _M_data->_M_amonth12 = __u.__w; ++ } ++#endif // 0 ++ } ++#endif ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/time_members.h ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/time_members.h +@@ -0,0 +1,76 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put functions ++// ++ ++// Written by Benjamin Kosnik <bkoz@redhat.com> ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::__timepunct(size_t __refs) ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), ++ _M_name_timepunct(_S_get_c_name()) ++ { _M_initialize_timepunct(); } ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) ++ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL), ++ _M_name_timepunct(_S_get_c_name()) ++ { _M_initialize_timepunct(); } ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, ++ size_t __refs) ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), ++ _M_name_timepunct(NULL) ++ { ++ const size_t __len = std::strlen(__s) + 1; ++ char* __tmp = new char[__len]; ++ std::memcpy(__tmp, __s, __len); ++ _M_name_timepunct = __tmp; ++ ++ try ++ { _M_initialize_timepunct(__cloc); } ++ catch(...) ++ { ++ delete [] _M_name_timepunct; ++ __throw_exception_again; ++ } ++ } ++ ++ template<typename _CharT> ++ __timepunct<_CharT>::~__timepunct() ++ { ++ if (_M_name_timepunct != _S_get_c_name()) ++ delete [] _M_name_timepunct; ++ delete _M_data; ++ _S_destroy_c_locale(_M_c_locale_timepunct); ++ } +--- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_base.h ++++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_base.h +@@ -0,0 +1,64 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++/** @file ctype_base.h ++ * This is an internal header file, included by other library headers. ++ * You should not attempt to use it directly. ++ */ ++ ++// Information as gleaned from /usr/include/ctype.h ++ ++ /// @brief Base class for ctype. ++ struct ctype_base ++ { ++ // Note: In uClibc, the following two types depend on configuration. ++ ++ // Non-standard typedefs. ++ typedef const __ctype_touplow_t* __to_type; ++ ++ // NB: Offsets into ctype<char>::_M_table force a particular size ++ // on the mask type. Because of this, we don't use an enum. ++ typedef __ctype_mask_t mask; ++ static const mask upper = _ISupper; ++ static const mask lower = _ISlower; ++ static const mask alpha = _ISalpha; ++ static const mask digit = _ISdigit; ++ static const mask xdigit = _ISxdigit; ++ static const mask space = _ISspace; ++ static const mask print = _ISprint; ++ static const mask graph = _ISalpha | _ISdigit | _ISpunct; ++ static const mask cntrl = _IScntrl; ++ static const mask punct = _ISpunct; ++ static const mask alnum = _ISalpha | _ISdigit; ++ }; +--- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_inline.h ++++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_inline.h +@@ -0,0 +1,69 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 2000, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) ++// functions go in ctype.cc ++ ++ bool ++ ctype<char>:: ++ is(mask __m, char __c) const ++ { return _M_table[static_cast<unsigned char>(__c)] & __m; } ++ ++ const char* ++ ctype<char>:: ++ is(const char* __low, const char* __high, mask* __vec) const ++ { ++ while (__low < __high) ++ *__vec++ = _M_table[static_cast<unsigned char>(*__low++)]; ++ return __high; ++ } ++ ++ const char* ++ ctype<char>:: ++ scan_is(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && !(_M_table[static_cast<unsigned char>(*__low)] & __m)) ++ ++__low; ++ return __low; ++ } ++ ++ const char* ++ ctype<char>:: ++ scan_not(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0) ++ ++__low; ++ return __low; ++ } +--- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_noninline.h ++++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h +@@ -0,0 +1,92 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// Information as gleaned from /usr/include/ctype.h ++ ++ const ctype_base::mask* ++ ctype<char>::classic_table() throw() ++ { return __C_ctype_b; } ++ ++ ctype<char>::ctype(__c_locale, const mask* __table, bool __del, ++ size_t __refs) ++ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), ++ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0) ++ { ++ _M_toupper = __C_ctype_toupper; ++ _M_tolower = __C_ctype_tolower; ++ _M_table = __table ? __table : __C_ctype_b; ++ memset(_M_widen, 0, sizeof(_M_widen)); ++ memset(_M_narrow, 0, sizeof(_M_narrow)); ++ } ++ ++ ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) ++ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), ++ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0) ++ { ++ _M_toupper = __C_ctype_toupper; ++ _M_tolower = __C_ctype_tolower; ++ _M_table = __table ? __table : __C_ctype_b; ++ memset(_M_widen, 0, sizeof(_M_widen)); ++ memset(_M_narrow, 0, sizeof(_M_narrow)); ++ } ++ ++ char ++ ctype<char>::do_toupper(char __c) const ++ { return _M_toupper[static_cast<unsigned char>(__c)]; } ++ ++ const char* ++ ctype<char>::do_toupper(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_toupper[static_cast<unsigned char>(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } ++ ++ char ++ ctype<char>::do_tolower(char __c) const ++ { return _M_tolower[static_cast<unsigned char>(__c)]; } ++ ++ const char* ++ ctype<char>::do_tolower(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_tolower[static_cast<unsigned char>(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } +--- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/os_defines.h ++++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/os_defines.h +@@ -0,0 +1,44 @@ ++// Specific definitions for GNU/Linux -*- C++ -*- ++ ++// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++#ifndef _GLIBCXX_OS_DEFINES ++#define _GLIBCXX_OS_DEFINES 1 ++ ++// System-specific #define, typedefs, corrections, etc, go here. This ++// file will come before all others. ++ ++// This keeps isanum, et al from being propagated as macros. ++#define __NO_CTYPE 1 ++ ++#include <features.h> ++ ++// We must not see the optimized string functions GNU libc defines. ++#define __NO_STRING_INLINES ++ ++#endif +--- gcc-4.1.0-dist/libstdc++-v3/configure ++++ gcc-4.1.0/libstdc++-v3/configure +@@ -4005,6 +4005,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +@@ -5740,7 +5745,7 @@ + enableval="$enable_clocale" + + case "$enableval" in +- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;; ++ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;; + *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5 + echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;} + { (exit 1); exit 1; }; } ;; +@@ -5765,6 +5770,9 @@ + # Default to "generic". + if test $enable_clocale_flag = auto; then + case ${target_os} in ++ linux-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ +@@ -5995,6 +6003,76 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ echo "$as_me:$LINENO: result: uclibc" >&5 ++echo "${ECHO_T}uclibc" >&6 ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ # Extract the first word of "msgfmt", so it can be a program name with args. ++set dummy msgfmt; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test -n "$check_msgfmt"; then ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_check_msgfmt="yes" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" ++fi ++fi ++check_msgfmt=$ac_cv_prog_check_msgfmt ++if test -n "$check_msgfmt"; then ++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 ++echo "${ECHO_T}$check_msgfmt" >&6 ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ ++ ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +--- gcc-4.1.0-dist/libstdc++-v3/configure.host ++++ gcc-4.1.0/libstdc++-v3/configure.host +@@ -261,6 +261,12 @@ + ;; + esac + ++# Override for uClibc since linux-uclibc gets mishandled above. ++case "${host_os}" in ++ *-uclibc*) ++ os_include_dir="os/uclibc" ++ ;; ++esac + + # Set any OS-dependent and CPU-dependent bits. + # THIS TABLE IS SORTED. KEEP IT THAT WAY. +--- gcc-4.1.0-dist/libstdc++-v3/crossconfig.m4 ++++ gcc-4.1.0/libstdc++-v3/crossconfig.m4 +@@ -143,6 +143,99 @@ + ;; + esac + ;; ++ *-uclibc*) ++# Temporary hack until we implement the float versions of the libm funcs ++ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ ++ machine/endian.h machine/param.h sys/machine.h sys/types.h \ ++ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h]) ++ SECTION_FLAGS='-ffunction-sections -fdata-sections' ++ AC_SUBST(SECTION_FLAGS) ++ GLIBCXX_CHECK_LINKER_FEATURES ++ GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT ++ GLIBCXX_CHECK_WCHAR_T_SUPPORT ++ ++ # For LFS. ++ AC_DEFINE(HAVE_INT64_T) ++ case "$target" in ++ *-uclinux*) ++ # Don't enable LFS with uClinux ++ ;; ++ *) ++ AC_DEFINE(_GLIBCXX_USE_LFS) ++ esac ++ ++ # For showmanyc_helper(). ++ AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) ++ GLIBCXX_CHECK_POLL ++ GLIBCXX_CHECK_S_ISREG_OR_S_IFREG ++ ++ # For xsputn_2(). ++ AC_CHECK_HEADERS(sys/uio.h) ++ GLIBCXX_CHECK_WRITEV ++ ++# AC_DEFINE(HAVE_ACOSF) ++# AC_DEFINE(HAVE_ASINF) ++# AC_DEFINE(HAVE_ATANF) ++# AC_DEFINE(HAVE_ATAN2F) ++ AC_DEFINE(HAVE_CEILF) ++ AC_DEFINE(HAVE_COPYSIGN) ++# AC_DEFINE(HAVE_COPYSIGNF) ++# AC_DEFINE(HAVE_COSF) ++# AC_DEFINE(HAVE_COSHF) ++# AC_DEFINE(HAVE_EXPF) ++# AC_DEFINE(HAVE_FABSF) ++ AC_DEFINE(HAVE_FINITE) ++ AC_DEFINE(HAVE_FINITEF) ++ AC_DEFINE(HAVE_FLOORF) ++# AC_DEFINE(HAVE_FMODF) ++# AC_DEFINE(HAVE_FREXPF) ++ AC_DEFINE(HAVE_HYPOT) ++# AC_DEFINE(HAVE_HYPOTF) ++ AC_DEFINE(HAVE_ISINF) ++ AC_DEFINE(HAVE_ISINFF) ++ AC_DEFINE(HAVE_ISNAN) ++ AC_DEFINE(HAVE_ISNANF) ++# AC_DEFINE(HAVE_LOGF) ++# AC_DEFINE(HAVE_LOG10F) ++# AC_DEFINE(HAVE_MODFF) ++# AC_DEFINE(HAVE_SINF) ++# AC_DEFINE(HAVE_SINHF) ++# AC_DEFINE(HAVE_SINCOS) ++# AC_DEFINE(HAVE_SINCOSF) ++ AC_DEFINE(HAVE_SQRTF) ++# AC_DEFINE(HAVE_TANF) ++# AC_DEFINE(HAVE_TANHF) ++ if test x"long_double_math_on_this_cpu" = x"yes"; then ++ AC_MSG_ERROR([long_double_math_on_this_cpu is yes!]) ++# AC_DEFINE(HAVE_ACOSL) ++# AC_DEFINE(HAVE_ASINL) ++# AC_DEFINE(HAVE_ATANL) ++# AC_DEFINE(HAVE_ATAN2L) ++# AC_DEFINE(HAVE_CEILL) ++# AC_DEFINE(HAVE_COPYSIGNL) ++# AC_DEFINE(HAVE_COSL) ++# AC_DEFINE(HAVE_COSHL) ++# AC_DEFINE(HAVE_EXPL) ++# AC_DEFINE(HAVE_FABSL) ++# AC_DEFINE(HAVE_FINITEL) ++# AC_DEFINE(HAVE_FLOORL) ++# AC_DEFINE(HAVE_FMODL) ++# AC_DEFINE(HAVE_FREXPL) ++# AC_DEFINE(HAVE_HYPOTL) ++# AC_DEFINE(HAVE_ISINFL) ++# AC_DEFINE(HAVE_ISNANL) ++# AC_DEFINE(HAVE_LOGL) ++# AC_DEFINE(HAVE_LOG10L) ++# AC_DEFINE(HAVE_MODFL) ++# AC_DEFINE(HAVE_POWL) ++# AC_DEFINE(HAVE_SINL) ++# AC_DEFINE(HAVE_SINHL) ++# AC_DEFINE(HAVE_SINCOSL) ++# AC_DEFINE(HAVE_SQRTL) ++# AC_DEFINE(HAVE_TANL) ++# AC_DEFINE(HAVE_TANHL) ++ fi ++ ;; + *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu) + AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ + machine/endian.h machine/param.h sys/machine.h sys/types.h \ +@@ -157,7 +250,7 @@ + AC_DEFINE(HAVE_INT64_T) + case "$target" in + *-uclinux*) +- # Don't enable LFS with uClibc ++ # Don't enable LFS with uClinux + ;; + *) + AC_DEFINE(_GLIBCXX_USE_LFS) +--- gcc-4.1.0-dist/libstdc++-v3/include/c_compatibility/wchar.h ++++ gcc-4.1.0/libstdc++-v3/include/c_compatibility/wchar.h +@@ -101,7 +101,9 @@ + using std::wmemcpy; + using std::wmemmove; + using std::wmemset; ++#if _GLIBCXX_HAVE_WCSFTIME + using std::wcsftime; ++#endif + + #if _GLIBCXX_USE_C99 + using std::wcstold; +--- gcc-4.1.0-dist/libstdc++-v3/include/c_std/std_cwchar.h ++++ gcc-4.1.0/libstdc++-v3/include/c_std/std_cwchar.h +@@ -180,7 +180,9 @@ + using ::wcscoll; + using ::wcscpy; + using ::wcscspn; ++#if _GLIBCXX_HAVE_WCSFTIME + using ::wcsftime; ++#endif + using ::wcslen; + using ::wcsncat; + using ::wcsncmp; diff --git a/patches/gcc/4.1.2/300-libstdc++-pic.patch b/patches/gcc/4.1.2/300-libstdc++-pic.patch new file mode 100644 index 00000000..560bcb23 --- /dev/null +++ b/patches/gcc/4.1.2/300-libstdc++-pic.patch @@ -0,0 +1,50 @@ +# DP: Build and install libstdc++_pic.a library. + +--- gcc/libstdc++-v3/src/Makefile.am ++++ gcc/libstdc++-v3/src/Makefile.am +@@ -214,6 +214,12 @@ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ + + ++install-exec-local: ++ifeq ($(enable_shared),yes) ++ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++endif ++ + # Added bits to build debug library. + if GLIBCXX_BUILD_DEBUG + all-local: build_debug +--- gcc/libstdc++-v3/src/Makefile.in ++++ gcc/libstdc++-v3/src/Makefile.in +@@ -627,7 +627,7 @@ + + install-data-am: install-data-local + +-install-exec-am: install-toolexeclibLTLIBRARIES ++install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local + + install-info: install-info-am + +@@ -660,6 +660,7 @@ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-data-local install-exec \ ++ install-exec-local \ + install-exec-am install-info install-info-am install-man \ + install-strip install-toolexeclibLTLIBRARIES installcheck \ + installcheck-am installdirs maintainer-clean \ +@@ -743,6 +743,13 @@ + install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ++ ++install-exec-local: ++ifeq ($(enable_shared),yes) ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++endif ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff --git a/patches/gcc/4.1.2/301-missing-execinfo_h.patch b/patches/gcc/4.1.2/301-missing-execinfo_h.patch new file mode 100644 index 00000000..0e2092f3 --- /dev/null +++ b/patches/gcc/4.1.2/301-missing-execinfo_h.patch @@ -0,0 +1,11 @@ +--- gcc-4.0.0/boehm-gc/include/gc.h-orig 2005-04-28 22:28:57.000000000 -0500 ++++ gcc-4.0.0/boehm-gc/include/gc.h 2005-04-28 22:30:38.000000000 -0500 +@@ -500,7 +500,7 @@ + #ifdef __linux__ + # include <features.h> + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/patches/gcc/4.1.2/302-c99-snprintf.patch b/patches/gcc/4.1.2/302-c99-snprintf.patch new file mode 100644 index 00000000..dfb22d68 --- /dev/null +++ b/patches/gcc/4.1.2/302-c99-snprintf.patch @@ -0,0 +1,11 @@ +--- gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h-orig 2005-04-29 00:08:41.000000000 -0500 ++++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h 2005-04-29 00:08:45.000000000 -0500 +@@ -142,7 +142,7 @@ + using ::vsprintf; + } + +-#if _GLIBCXX_USE_C99 ++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf diff --git a/patches/gcc/4.1.2/303-c99-complex-ugly-hack.patch b/patches/gcc/4.1.2/303-c99-complex-ugly-hack.patch new file mode 100644 index 00000000..2ccc80d9 --- /dev/null +++ b/patches/gcc/4.1.2/303-c99-complex-ugly-hack.patch @@ -0,0 +1,12 @@ +--- gcc-4.0.0/libstdc++-v3/configure-old 2005-04-30 22:04:48.061603912 -0500 ++++ gcc-4.0.0/libstdc++-v3/configure 2005-04-30 22:06:13.678588152 -0500 +@@ -7194,6 +7194,9 @@ + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + #include <complex.h> ++#ifdef __UCLIBC__ ++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs ++#endif + int + main () + { diff --git a/patches/gcc/4.1.2/304-index_macro.patch b/patches/gcc/4.1.2/304-index_macro.patch new file mode 100644 index 00000000..1fac112f --- /dev/null +++ b/patches/gcc/4.1.2/304-index_macro.patch @@ -0,0 +1,24 @@ +--- gcc-4.1.0/libstdc++-v3/include/ext/rope.mps 2006-03-24 01:49:51 +0100 ++++ gcc-4.1.0/libstdc++-v3/include/ext/rope 2006-03-24 01:49:37 +0100 +@@ -59,6 +59,9 @@ + #include <bits/allocator.h> + #include <ext/hash_fun.h> + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + # ifdef __GC + # define __GC_CONST const + # else +--- gcc-4.1.0/libstdc++-v3/include/ext/ropeimpl.h.mps 2006-03-24 01:50:04 +0100 ++++ gcc-4.1.0/libstdc++-v3/include/ext/ropeimpl.h 2006-03-24 01:50:28 +0100 +@@ -53,6 +53,9 @@ + #include <ext/memory> // For uninitialized_copy_n + #include <ext/numeric> // For power + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + namespace __gnu_cxx + { + using std::size_t; diff --git a/patches/gcc/4.1.2/402-libbackend_dep_gcov-iov.h.patch b/patches/gcc/4.1.2/402-libbackend_dep_gcov-iov.h.patch new file mode 100644 index 00000000..b7d9bb99 --- /dev/null +++ b/patches/gcc/4.1.2/402-libbackend_dep_gcov-iov.h.patch @@ -0,0 +1,12 @@ +# gcc.gnu.org/PR30620 +--- gcc-4.1.2-20070208.orig/gcc/Makefile.in 2006-11-01 15:40:44.000000000 +0100 ++++ gcc-4.1.2-20070208/gcc/Makefile.in 2007-02-13 19:23:31.000000000 +0100 +@@ -2522,7 +2522,7 @@ + # FIXME: writing proper dependencies for this is a *LOT* of work. + libbackend.o : $(OBJS-common:.o=.c) $(out_file) \ + insn-config.h insn-flags.h insn-codes.h insn-constants.h \ +- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) ++ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ + -DTARGET_NAME=\"$(target_noncanonical)\" \ + -DLOCALEDIR=\"$(localedir)\" \ diff --git a/patches/gcc/4.1.2/740-sh-pr24836.patch b/patches/gcc/4.1.2/740-sh-pr24836.patch new file mode 100644 index 00000000..7992282c --- /dev/null +++ b/patches/gcc/4.1.2/740-sh-pr24836.patch @@ -0,0 +1,25 @@ +http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348 +http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24836 + +--- gcc/gcc/configure.ac (revision 106699) ++++ gcc/gcc/configure.ac (working copy) +@@ -2446,7 +2446,7 @@ + tls_first_minor=14 + tls_as_opt="-m64 -Aesame --fatal-warnings" + ;; +- sh-*-* | sh[34]-*-*) ++ sh-*-* | sh[34]*-*-*) + conftest_s=' + .section ".tdata","awT",@progbits + foo: .long 25 +--- gcc/gcc/configure ++++ gcc/gcc/configure +@@ -14846,7 +14846,7 @@ + tls_first_minor=14 + tls_as_opt="-m64 -Aesame --fatal-warnings" + ;; +- sh-*-* | sh[34]-*-*) ++ sh-*-* | sh[34]*-*-*) + conftest_s=' + .section ".tdata","awT",@progbits + foo: .long 25 diff --git a/patches/gcc/4.1.2/800-arm-bigendian.patch b/patches/gcc/4.1.2/800-arm-bigendian.patch new file mode 100644 index 00000000..0a941741 --- /dev/null +++ b/patches/gcc/4.1.2/800-arm-bigendian.patch @@ -0,0 +1,127 @@ +By Lennert Buytenhek <buytenh@wantstofly.org> +Adds support for arm*b-linux* big-endian ARM targets + +See http://gcc.gnu.org/PR16350 + +Index: gcc-4.1.1/gcc/config/arm/linux-elf.h +=================================================================== +--- gcc-4.1.1.orig/gcc/config/arm/linux-elf.h ++++ gcc-4.1.1/gcc/config/arm/linux-elf.h +@@ -28,19 +28,33 @@ + #undef TARGET_VERSION + #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr); + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT MASK_BIG_END ++#define TARGET_ENDIAN_OPTION "mbig-endian" ++#define TARGET_LINKER_EMULATION "armelfb_linux" ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#define TARGET_ENDIAN_OPTION "mlittle-endian" ++#define TARGET_LINKER_EMULATION "armelf_linux" ++#endif ++ + #undef TARGET_DEFAULT_FLOAT_ABI + #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD + + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (0) ++#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT) + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" } + + /* Now we define the strings used to build the spec file. */ + #undef LIB_SPEC +@@ -61,7 +75,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker " LINUX_TARGET_INTERPRETER "} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #undef LINK_SPEC +Index: gcc-4.1.1/gcc/config.gcc +=================================================================== +--- gcc-4.1.1.orig/gcc/config.gcc ++++ gcc-4.1.1/gcc/config.gcc +@@ -672,6 +672,11 @@ arm*-*-netbsd*) + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" ++ case $target in ++ arm*b-*) ++ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" ++ ;; ++ esac + tmake_file="${tmake_file} t-linux arm/t-arm" + case ${target} in + arm*-*-linux-gnueabi) +Index: gcc-4.1.1/gcc/config/arm/linux-eabi.h +=================================================================== +--- gcc-4.1.1.orig/gcc/config/arm/linux-eabi.h ++++ gcc-4.1.1/gcc/config/arm/linux-eabi.h +@@ -20,6 +20,17 @@ + the Free Software Foundation, 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#undef TARGET_LINKER_EMULATION ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_LINKER_EMULATION "armelfb_linux_eabi" ++#else ++#define TARGET_LINKER_EMULATION "armelf_linux_eabi" ++#endif ++ + /* On EABI GNU/Linux, we want both the BPABI builtins and the + GNU/Linux builtins. */ + #undef TARGET_OS_CPP_BUILTINS +@@ -48,7 +59,7 @@ + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi + + #undef SUBTARGET_EXTRA_LINK_SPEC +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION + + /* Use ld-linux.so.3 so that it will be possible to run "classic" + GNU/Linux binaries on an EABI system. */ +Index: gcc-4.1.1/gcc/config/arm/bpabi.h +=================================================================== +--- gcc-4.1.1.orig/gcc/config/arm/bpabi.h ++++ gcc-4.1.1/gcc/config/arm/bpabi.h +@@ -33,9 +33,19 @@ + #undef FPUTYPE_DEFAULT + #define FPUTYPE_DEFAULT FPUTYPE_VFP + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT MASK_BIG_END ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#endif ++ + /* EABI targets should enable interworking by default. */ + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT MASK_INTERWORK ++#define TARGET_DEFAULT (MASK_INTERWORK | TARGET_ENDIAN_DEFAULT) + + /* The ARM BPABI functions return a boolean; they use no special + calling convention. */ |