diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2008-05-16 09:33:59 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@rpsys.net> | 2008-05-16 09:33:59 +0000 |
commit | 34c347b9448e1c752c885cf312ec730e1176af9d (patch) | |
tree | fc42277ca7ffcb555be479eb4c36134a7ce3c68c /packages/gcc | |
parent | e4068ea40e02f149c1d4fbd7ec4b7686bf056f80 (diff) |
Add gcc 4.2.3 and gcc 3.4.6-native from Poky
Diffstat (limited to 'packages/gcc')
102 files changed, 14187 insertions, 1 deletions
diff --git a/packages/gcc/gcc-3.4.6/.mtn2git_empty b/packages/gcc/gcc-3.4.6/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/gcc/gcc-3.4.6/.mtn2git_empty diff --git a/packages/gcc/gcc-3.4.6/GCC3.4.0VisibilityPatch.diff b/packages/gcc/gcc-3.4.6/GCC3.4.0VisibilityPatch.diff new file mode 100644 index 0000000000..d51da7157d --- /dev/null +++ b/packages/gcc/gcc-3.4.6/GCC3.4.0VisibilityPatch.diff @@ -0,0 +1,1100 @@ + +diff -aur gcc-3.4.0orig/gcc/c-common.c gcc-3.4.0/gcc/c-common.c +--- gcc-3.4.0orig/gcc/c-common.c 2004-03-19 01:32:59.000000000 +0000 ++++ gcc-3.4.0/gcc/c-common.c 2004-05-10 21:05:33.000000000 +0100 +@@ -833,7 +833,7 @@ + handle_deprecated_attribute }, + { "vector_size", 1, 1, false, true, false, + handle_vector_size_attribute }, +- { "visibility", 1, 1, true, false, false, ++ { "visibility", 1, 1, false, false, false, + handle_visibility_attribute }, + { "tls_model", 1, 1, true, false, false, + handle_tls_model_attribute }, +@@ -4886,7 +4886,16 @@ + + *no_add_attrs = true; + +- if (decl_function_context (decl) != 0 || ! TREE_PUBLIC (decl)) ++ if (TYPE_P (*node)) ++ { ++ if (TREE_CODE (*node) != RECORD_TYPE && TREE_CODE (*node) != UNION_TYPE) ++ { ++ warning ("`%s' attribute ignored on non-class types", ++ IDENTIFIER_POINTER (name)); ++ return NULL_TREE; ++ } ++ } ++ else if (decl_function_context (decl) != 0 || ! TREE_PUBLIC (decl)) + { + warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); + return NULL_TREE; +@@ -4897,6 +4906,14 @@ + error ("visibility arg not a string"); + return NULL_TREE; + } ++ ++ /* If this is a type, set the visibility on the type decl. */ ++ if (TYPE_P (decl)) ++ { ++ decl = TYPE_NAME (decl); ++ if (! decl) ++ return NULL_TREE; ++ } + + if (strcmp (TREE_STRING_POINTER (id), "default") == 0) + DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT; +@@ -4908,6 +4925,14 @@ + DECL_VISIBILITY (decl) = VISIBILITY_PROTECTED; + else + error ("visibility arg must be one of \"default\", \"hidden\", \"protected\" or \"internal\""); ++ DECL_VISIBILITYSPECIFIED (decl) = 1; ++ ++ /* For decls only, go ahead and attach the attribute to the node as well. ++ This is needed so we can determine whether we have VISIBILITY_DEFAULT ++ because the visibility was not specified, or because it was explicitly ++ overridden from the class visibility. */ ++ if (DECL_P (*node)) ++ *no_add_attrs = false; + + return NULL_TREE; + } + +diff -aur gcc-3.4.0orig/gcc/c-decl.c gcc-3.4.0/gcc/c-decl.c +--- gcc-3.4.0orig/gcc/c-decl.c 2004-03-22 17:58:18.000000000 +0000 ++++ gcc-3.4.0/gcc/c-decl.c 2004-05-10 15:16:27.000000000 +0100 +@@ -1164,9 +1164,8 @@ + } + + /* warnings */ +- /* All decls must agree on a non-default visibility. */ +- if (DECL_VISIBILITY (newdecl) != VISIBILITY_DEFAULT +- && DECL_VISIBILITY (olddecl) != VISIBILITY_DEFAULT ++ /* All decls must agree on a visibility. */ ++ if (DECL_VISIBILITYSPECIFIED (newdecl) && DECL_VISIBILITYSPECIFIED (olddecl) + && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl)) + { + warning ("%Jredeclaration of '%D' with different visibility " +@@ -1361,9 +1360,12 @@ + Currently, it can only be defined in the prototype. */ + COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl); + +- /* If either declaration has a nondefault visibility, use it. */ +- if (DECL_VISIBILITY (olddecl) != VISIBILITY_DEFAULT) +- DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl); ++ /* Use visibility of whichever declaration had it specified */ ++ if (DECL_VISIBILITYSPECIFIED (olddecl)) ++ { ++ DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl); ++ DECL_VISIBILITYSPECIFIED (newdecl) = 1; ++ } + + if (TREE_CODE (newdecl) == FUNCTION_DECL) + { + +diff -aur gcc-3.4.0orig/gcc/common.opt gcc-3.4.0/gcc/common.opt +--- gcc-3.4.0orig/gcc/common.opt 2004-02-18 00:09:04.000000000 +0000 ++++ gcc-3.4.0/gcc/common.opt 2004-05-09 08:10:50.000000000 +0100 +@@ -718,6 +718,11 @@ + Common + Add extra commentary to assembler output + ++fvisibility= ++Common Joined RejectNegative ++-fvisibility=[default|internal|hidden|protected] Set the default symbol visibility ++ ++ + fvpt + Common + Use expression value profiles in optimizations + +diff -aur gcc-3.4.0orig/gcc/c.opt gcc-3.4.0/gcc/c.opt +--- gcc-3.4.0orig/gcc/c.opt 2004-02-18 00:09:03.000000000 +0000 ++++ gcc-3.4.0/gcc/c.opt 2004-05-09 08:10:50.000000000 +0100 +@@ -656,6 +656,10 @@ + C++ ObjC++ + Use __cxa_atexit to register destructors + ++fvisibility-inlines-hidden ++C++ ++Marks all inlined methods as having hidden visibility ++ + fvtable-gc + C++ ObjC++ + Discard unused virtual functions +diff -aur gcc-3.4.0orig/gcc/c-opts.c gcc-3.4.0/gcc/c-opts.c +--- gcc-3.4.0orig/gcc/c-opts.c 2004-02-18 00:09:03.000000000 +0000 ++++ gcc-3.4.0/gcc/c-opts.c 2004-05-09 08:10:50.000000000 +0100 +@@ -912,6 +912,10 @@ + case OPT_fuse_cxa_atexit: + flag_use_cxa_atexit = value; + break; ++ ++ case OPT_fvisibility_inlines_hidden: ++ visibility_options.inlineshidden = value; ++ break; + + case OPT_fweak: + flag_weak = value; + +diff -aur gcc-3.4.0orig/gcc/cp/class.c gcc-3.4.0/gcc/cp/class.c +--- gcc-3.4.0orig/gcc/cp/class.c 2004-03-09 07:27:23.000000000 +0000 ++++ gcc-3.4.0/gcc/cp/class.c 2004-05-10 21:06:50.000000000 +0100 +@@ -524,6 +524,10 @@ + DECL_ALIGN (decl) = MAX (TYPE_ALIGN (double_type_node), + DECL_ALIGN (decl)); + ++ /* The vtable's visibility is the class visibility. There is no way ++ to override the visibility for just the vtable. */ ++ DECL_VISIBILITY (decl) = CLASSTYPE_VISIBILITY (class_type); ++ DECL_VISIBILITYSPECIFIED (decl) = CLASSTYPE_VISIBILITYSPECIFIED (class_type); + import_export_vtable (decl, class_type, 0); + + return decl; +@@ -2971,7 +2975,25 @@ + continue; + + if (TREE_CODE (x) == CONST_DECL || TREE_CODE (x) == VAR_DECL) +- continue; ++ { ++ /* Apply the class's visibility attribute to static members ++ which do not have a visibility attribute. */ ++ if (! lookup_attribute ("visibility", DECL_ATTRIBUTES (x))) ++ { ++ if (visibility_options.inlineshidden && DECL_INLINE (x)) ++ { ++ DECL_VISIBILITY (x) = VISIBILITY_HIDDEN; ++ DECL_VISIBILITYSPECIFIED (x) = 1; ++ } ++ else ++ { ++ DECL_VISIBILITY (x) = CLASSTYPE_VISIBILITY (current_class_type); ++ DECL_VISIBILITYSPECIFIED (x) = CLASSTYPE_VISIBILITYSPECIFIED (current_class_type); ++ } ++ } ++ ++ continue; ++ } + + /* Now it can only be a FIELD_DECL. */ + +@@ -3708,6 +3730,22 @@ + check_for_override (x, t); + if (DECL_PURE_VIRTUAL_P (x) && ! DECL_VINDEX (x)) + cp_error_at ("initializer specified for non-virtual method `%D'", x); ++ ++ /* Apply the class's visibility attribute to methods which do ++ not have a visibility attribute. */ ++ if (! lookup_attribute ("visibility", DECL_ATTRIBUTES (x))) ++ { ++ if (visibility_options.inlineshidden && DECL_INLINE (x)) ++ { ++ DECL_VISIBILITY (x) = VISIBILITY_HIDDEN; ++ DECL_VISIBILITYSPECIFIED (x) = 1; ++ } ++ else ++ { ++ DECL_VISIBILITY (x) = CLASSTYPE_VISIBILITY (current_class_type); ++ DECL_VISIBILITYSPECIFIED (x) = CLASSTYPE_VISIBILITYSPECIFIED (current_class_type); ++ } ++ } + + /* The name of the field is the original field name + Save this in auxiliary field for later overloading. */ +@@ -7830,3 +7868,4 @@ + *vid->last_init = build_tree_list (NULL_TREE, init); + vid->last_init = &TREE_CHAIN (*vid->last_init); + } ++ + +diff -aur gcc-3.4.0orig/gcc/cp/cp-tree.h gcc-3.4.0/gcc/cp/cp-tree.h +--- gcc-3.4.0orig/gcc/cp/cp-tree.h 2004-03-20 00:13:08.000000000 +0000 ++++ gcc-3.4.0/gcc/cp/cp-tree.h 2004-05-10 20:56:56.000000000 +0100 +@@ -1008,7 +1008,12 @@ + #define PUBLICLY_UNIQUELY_DERIVED_P(PARENT, TYPE) \ + (lookup_base ((TYPE), (PARENT), ba_not_special | ba_quiet, NULL) \ + != NULL_TREE) +- ++ ++/* Gives the visibility specification for a class type. */ ++#define CLASSTYPE_VISIBILITY(TYPE) DECL_VISIBILITY (TYPE_NAME (TYPE)) ++#define CLASSTYPE_VISIBILITYSPECIFIED(TYPE) DECL_VISIBILITYSPECIFIED (TYPE_NAME (TYPE)) ++ ++ + /* This is a few header flags for 'struct lang_type'. Actually, + all but the first are used only for lang_type_class; they + are put in this structure to save space. */ + +diff -aur gcc-3.4.0orig/gcc/cp/decl.c gcc-3.4.0/gcc/cp/decl.c +--- gcc-3.4.0orig/gcc/cp/decl.c 2004-04-01 21:47:21.000000000 +0100 ++++ gcc-3.4.0/gcc/cp/decl.c 2004-05-28 21:16:11.000000000 +0100 +@@ -1869,17 +1869,34 @@ + DECL_COMMON (newdecl) = DECL_COMMON (olddecl); + COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl); + +- /* If either declaration has a nondefault visibility, use it. */ +- if (DECL_VISIBILITY (olddecl) != VISIBILITY_DEFAULT) ++ /* Warn about conflicting visibility specifications. */ ++ if (DECL_VISIBILITYSPECIFIED (olddecl) && DECL_VISIBILITYSPECIFIED (newdecl) ++ && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl)) ++ { ++ warning ("%J'%D': visibility attribute ignored because it", ++ newdecl, newdecl); ++ warning ("%Jconflicts with previous declaration here", olddecl); ++ } ++ /* Choose the declaration which specified visibility. */ ++ if (DECL_VISIBILITYSPECIFIED (olddecl)) + { +- if (DECL_VISIBILITY (newdecl) != VISIBILITY_DEFAULT +- && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl)) +- { +- warning ("%J'%D': visibility attribute ignored because it", +- newdecl, newdecl); +- warning ("%Jconflicts with previous declaration here", olddecl); +- } + DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl); ++ DECL_VISIBILITYSPECIFIED (newdecl) = 1; ++ } ++ /* If it's a definition of a global operator new or operator ++ delete, it must be default visibility. */ ++ if (NEW_DELETE_OPNAME_P (DECL_NAME (newdecl)) && DECL_INITIAL (newdecl) != NULL_TREE) ++ { ++ if (!DECL_FUNCTION_MEMBER_P (newdecl) && VISIBILITY_DEFAULT != DECL_VISIBILITY (newdecl)) ++ { ++ warning ("%J`%D': ignoring non-default symbol", ++ newdecl, newdecl); ++ warning ("%Jvisibility on global operator new or delete", newdecl); ++ DECL_VISIBILITY (olddecl) = VISIBILITY_DEFAULT; ++ DECL_VISIBILITYSPECIFIED (olddecl) = 1; ++ DECL_VISIBILITY (newdecl) = VISIBILITY_DEFAULT; ++ DECL_VISIBILITYSPECIFIED (newdecl) = 1; ++ } + } + + if (TREE_CODE (newdecl) == FUNCTION_DECL) + +diff -aur gcc-3.4.0orig/gcc/cp/method.c gcc-3.4.0/gcc/cp/method.c +--- gcc-3.4.0orig/gcc/cp/method.c 2004-04-08 23:15:58.000000000 +0100 ++++ gcc-3.4.0/gcc/cp/method.c 2004-05-09 08:10:52.000000000 +0100 +@@ -394,6 +394,7 @@ + rewrite. */ + TREE_PUBLIC (thunk_fndecl) = TREE_PUBLIC (function); + DECL_VISIBILITY (thunk_fndecl) = DECL_VISIBILITY (function); ++ DECL_VISIBILITYSPECIFIED (thunk_fndecl) = DECL_VISIBILITYSPECIFIED (function); + + if (flag_syntax_only) + { + +diff -aur gcc-3.4.0orig/gcc/cp/optimize.c gcc-3.4.0/gcc/cp/optimize.c +--- gcc-3.4.0orig/gcc/cp/optimize.c 2004-02-08 01:52:50.000000000 +0000 ++++ gcc-3.4.0/gcc/cp/optimize.c 2004-05-09 08:10:52.000000000 +0100 +@@ -155,6 +155,7 @@ + DECL_NOT_REALLY_EXTERN (clone) = DECL_NOT_REALLY_EXTERN (fn); + TREE_PUBLIC (clone) = TREE_PUBLIC (fn); + DECL_VISIBILITY (clone) = DECL_VISIBILITY (fn); ++ DECL_VISIBILITYSPECIFIED (clone) = DECL_VISIBILITYSPECIFIED (fn); + + /* Adjust the parameter names and locations. */ + parm = DECL_ARGUMENTS (fn); + +diff -aur gcc-3.4.0orig/gcc/cp/rtti.c gcc-3.4.0/gcc/cp/rtti.c +--- gcc-3.4.0orig/gcc/cp/rtti.c 2004-03-08 23:00:26.000000000 +0000 ++++ gcc-3.4.0/gcc/cp/rtti.c 2004-05-10 21:09:21.000000000 +0100 +@@ -361,7 +361,11 @@ + pushdecl_top_level_and_finish (d, NULL_TREE); + + if (CLASS_TYPE_P (type)) +- CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type)) = d; ++ { ++ CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type)) = d; ++ DECL_VISIBILITY (d) = CLASSTYPE_VISIBILITY (type); ++ DECL_VISIBILITYSPECIFIED (d) = CLASSTYPE_VISIBILITYSPECIFIED (type); ++ } + + /* Remember the type it is for. */ + TREE_TYPE (name) = type; +@@ -759,6 +763,11 @@ + TREE_STATIC (name_decl) = 1; + DECL_EXTERNAL (name_decl) = 0; + TREE_PUBLIC (name_decl) = 1; ++ if (CLASS_TYPE_P (target)) ++ { ++ DECL_VISIBILITY (name_decl) = CLASSTYPE_VISIBILITY (target); ++ DECL_VISIBILITYSPECIFIED (name_decl) = CLASSTYPE_VISIBILITYSPECIFIED (target); ++ } + import_export_tinfo (name_decl, target, typeinfo_in_lib_p (target)); + /* External name of the string containing the type's name has a + special name. */ + +diff -aur gcc-3.4.0orig/gcc/c-pragma.c gcc-3.4.0/gcc/c-pragma.c +--- gcc-3.4.0orig/gcc/c-pragma.c 2004-01-23 23:35:53.000000000 +0000 ++++ gcc-3.4.0/gcc/c-pragma.c 2004-05-09 08:10:52.000000000 +0100 +@@ -480,6 +480,86 @@ + return asmname; + } + ++ ++#ifdef HANDLE_PRAGMA_VISIBILITY ++static void handle_pragma_visibility (cpp_reader *); ++ ++/* Sets the default visibility for symbols to something other than that ++ specified on the command line. */ ++static void ++handle_pragma_visibility (cpp_reader *dummy ATTRIBUTE_UNUSED) ++{ /* Form is #pragma GCC visibility push(hidden)|pop */ ++ static int visstack [16], visidx; ++ tree x; ++ enum cpp_ttype token; ++ enum { bad, push, pop } action = bad; ++ ++ token = c_lex (&x); ++ if (token == CPP_NAME) ++ { ++ const char *op = IDENTIFIER_POINTER (x); ++ if (!strcmp (op, "push")) ++ action = push; ++ else if (!strcmp (op, "pop")) ++ action = pop; ++ } ++ if (bad == action) ++ GCC_BAD ("#pragma GCC visibility must be followed by push or pop"); ++ else ++ { ++ if (pop == action) ++ { ++ if (!visidx) ++ { ++ GCC_BAD ("No matching push for '#pragma GCC visibility pop'"); ++ } ++ else ++ { ++ default_visibility = visstack[--visidx]; ++ visibility_options.inpragma = (visidx>0); ++ } ++ } ++ else ++ { ++ if (c_lex (&x) != CPP_OPEN_PAREN) ++ GCC_BAD ("missing '(' after '#pragma GCC visibility push' - ignored"); ++ token = c_lex (&x); ++ if (token != CPP_NAME) ++ { ++ GCC_BAD ("malformed #pragma GCC visibility push"); ++ } ++ else if (visidx >= 16) ++ { ++ GCC_BAD ("No more than sixteen #pragma GCC visibility pushes allowed at once"); ++ } ++ else ++ { ++ const char *str = IDENTIFIER_POINTER (x); ++ visstack[visidx++] = default_visibility; ++ if (!strcmp (str, "default")) ++ default_visibility = VISIBILITY_DEFAULT; ++ else if (!strcmp (str, "internal")) ++ default_visibility = VISIBILITY_INTERNAL; ++ else if (!strcmp (str, "hidden")) ++ default_visibility = VISIBILITY_HIDDEN; ++ else if (!strcmp (str, "protected")) ++ default_visibility = VISIBILITY_PROTECTED; ++ else ++ { ++ GCC_BAD ("#pragma GCC visibility push() must specify default, internal, hidden or protected"); ++ } ++ visibility_options.inpragma = 1; ++ } ++ if (c_lex (&x) != CPP_CLOSE_PAREN) ++ GCC_BAD ("missing '(' after '#pragma GCC visibility push' - ignored"); ++ } ++ } ++ if (c_lex (&x) != CPP_EOF) ++ warning ("junk at end of '#pragma GCC visibility'"); ++} ++ ++#endif ++ + /* Front-end wrapper for pragma registration to avoid dragging + cpplib.h in almost everywhere. */ + void +@@ -505,6 +585,9 @@ + #ifdef HANDLE_PRAGMA_EXTERN_PREFIX + c_register_pragma (0, "extern_prefix", handle_pragma_extern_prefix); + #endif ++#ifdef HANDLE_PRAGMA_VISIBILITY ++ c_register_pragma ("GCC", "visibility", handle_pragma_visibility); ++#endif + + #ifdef REGISTER_TARGET_PRAGMAS + REGISTER_TARGET_PRAGMAS (); +diff -aur gcc-3.4.0orig/gcc/c-pragma.h gcc-3.4.0/gcc/c-pragma.h +--- gcc-3.4.0orig/gcc/c-pragma.h 2004-01-31 06:18:05.000000000 +0000 ++++ gcc-3.4.0/gcc/c-pragma.h 2004-05-09 08:10:53.000000000 +0100 +@@ -44,6 +44,11 @@ + #define HANDLE_PRAGMA_PACK 1 + #endif /* HANDLE_PRAGMA_PACK_PUSH_POP */ + ++/* It's safe to always leave visibility pragma enabled as if ++ visibility is not supported on the host OS platform the ++ statements are ignored. */ ++#define HANDLE_PRAGMA_VISIBILITY 1 ++ + extern void init_pragma (void); + + /* Front-end wrapper for pragma registration to avoid dragging + + +diff -aur gcc-3.4.0orig/gcc/doc/invoke.texi gcc-3.4.0/gcc/doc/invoke.texi +--- gcc-3.4.0orig/gcc/doc/invoke.texi 2004-04-19 00:05:36.000000000 +0100 ++++ gcc-3.4.0/gcc/doc/invoke.texi 2004-05-28 21:29:36.000000000 +0100 +@@ -183,7 +183,8 @@ + -fno-optional-diags -fpermissive @gol + -frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol + -fuse-cxa-atexit -fno-weak -nostdinc++ @gol +--fno-default-inline -Wabi -Wctor-dtor-privacy @gol ++-fno-default-inline -fvisibility-inlines-hidden @gol ++-Wabi -Wctor-dtor-privacy @gol + -Wnon-virtual-dtor -Wreorder @gol + -Weffc++ -Wno-deprecated @gol + -Wno-non-template-friend -Wold-style-cast @gol +@@ -674,7 +675,8 @@ + -fargument-alias -fargument-noalias @gol + -fargument-noalias-global -fleading-underscore @gol + -ftls-model=@var{model} @gol +--ftrapv -fwrapv -fbounds-check} ++-ftrapv -fwrapv -fbounds-check @gol ++-fvisibility} + @end table + + @menu +@@ -1433,6 +1435,20 @@ + destructors, but will only work if your C library supports + @code{__cxa_atexit}. + ++@item -fvisibility-inlines-hidden ++@opindex fvisibility-inlines-hidden ++Causes all inlined methods to be marked with ++@code{__attribute__ ((visibility ("hidden")))} so that they do not ++appear in the export table of a DSO and do not require a PLT indirection ++when used within the DSO. Enabling this option can have a dramatic effect ++on load and link times of a DSO as it massively reduces the size of the ++dynamic export table when the library makes heavy use of templates. While ++it can cause bloating through duplication of code within each DSO where ++it is used, often the wastage is less than the considerable space occupied ++by a long symbol name in the export table which is typical when using ++templates and namespaces. For even more savings, combine with the ++@code{-fvisibility=hidden} switch. ++ + @item -fno-weak + @opindex fno-weak + Do not use weak symbol support, even if it is provided by the linker. +@@ -11198,6 +11214,54 @@ + + The default without @option{-fpic} is @code{initial-exec}; with + @option{-fpic} the default is @code{global-dynamic}. ++ ++@item -fvisibility=@var{default|internal|hidden|protected} ++@opindex fvisibility ++Set the default ELF image symbol visibility to the specified option - all ++symbols will be marked with this unless overrided within the code. ++Using this feature can very substantially improve linking and ++load times of shared object libraries, produce more optimised ++code, provide near-perfect API export and prevent symbol clashes. ++It is @strong{strongly} recommended that you use this in any shared objects ++you distribute. ++ ++Despite the nomenclature, @code{default} always means public ie; ++available to be linked against from outside the shared object. ++@code{protected} and @code{internal} are pretty useless in real-world ++usage so the only other commonly used option will be @code{hidden}. ++The default if -fvisibility isn't specified is @code{default} ie; make every ++symbol public - this causes the same behaviour as previous versions of ++GCC. ++ ++A good explanation of the benefits offered by ensuring ELF ++symbols have the correct visibility is given by ``How To Write ++Shared Libraries'' by Ulrich Drepper (which can be found at ++@w{@uref{http://people.redhat.com/~drepper/}}) - however a superior ++solution made possible by this option to marking things hidden when ++the default is public is to make the default hidden and mark things ++public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden} ++and @code{__attribute__ ((visibility("default")))} instead of ++@code{__declspec(dllexport)} you get almost identical semantics with ++identical syntax. This is a great boon to those working with ++cross-platform projects. ++ ++For those adding visibility support to existing code, you may find ++@samp{#pragma GCC visibility} of use. This works by you enclosing ++the declarations you wish to set visibility for with (for example) ++@samp{#pragma GCC visibility push(hidden)} and ++@samp{#pragma GCC visibility pop}. These can be nested up to sixteen ++times. Bear in mind that symbol visibility should be viewed @strong{as ++part of the API interface contract} and thus all new code should ++always specify visibility when it is not the default ie; declarations ++only for use within the local DSO should @strong{always} be marked explicitly ++as hidden as so to avoid PLT indirection overheads - making this ++abundantly clear also aids readability and self-documentation of the code. ++Note that due to ISO C++ specification requirements, operator new and ++operator delete must always be of default visibility. ++ ++An overview of these techniques, their benefits and how to use them ++is at @w{@uref{http://www.nedprod.com/programs/gccvisibility.html}}. ++ + @end table + + @c man end + +diff -aur gcc-3.4.0orig/gcc/flags.h gcc-3.4.0/gcc/flags.h +--- gcc-3.4.0orig/gcc/flags.h 2004-02-18 00:09:04.000000000 +0000 ++++ gcc-3.4.0/gcc/flags.h 2004-05-09 08:10:53.000000000 +0100 +@@ -60,6 +60,30 @@ + /* Nonzero means emit debugging information only for symbols which are used. */ + extern int flag_debug_only_used_symbols; + ++/* Enumerate visibility settings. */ ++#ifndef SYMBOL_VISIBILITY_DEFINED ++#define SYMBOL_VISIBILITY_DEFINED ++enum symbol_visibility ++{ ++ VISIBILITY_DEFAULT, ++ VISIBILITY_INTERNAL, ++ VISIBILITY_HIDDEN, ++ VISIBILITY_PROTECTED ++}; ++#endif ++ ++/* The default visibility for all symbols (unless overridden). */ ++extern enum symbol_visibility default_visibility; ++ ++struct visibility_flags ++{ ++ unsigned inpragma : 1; /* True when in #pragma GCC visibility. */ ++ unsigned inlineshidden : 1; /* True when -finlineshidden in effect. */ ++}; ++ ++/* Global visibility options. */ ++extern struct visibility_flags visibility_options; ++ + /* Nonzero means do optimizations. -opt. */ + + extern int optimize; + +diff -aur gcc-3.4.0orig/gcc/opts.c gcc-3.4.0/gcc/opts.c +--- gcc-3.4.0orig/gcc/opts.c 2004-02-18 00:09:04.000000000 +0000 ++++ gcc-3.4.0/gcc/opts.c 2004-05-09 08:10:53.000000000 +0100 +@@ -142,6 +142,12 @@ + write_symbols is set to DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */ + bool use_gnu_debug_info_extensions; + ++/* The default visibility for all symbols (unless overridden) */ ++enum symbol_visibility default_visibility = VISIBILITY_DEFAULT; ++ ++/* Global visibility options. */ ++struct visibility_flags visibility_options; ++ + /* Columns of --help display. */ + static unsigned int columns = 80; + +@@ -1440,6 +1446,21 @@ + flag_verbose_asm = value; + break; + ++ case OPT_fvisibility_: ++ { ++ if(!strcmp(arg, "default")) ++ default_visibility=VISIBILITY_DEFAULT; ++ else if(!strcmp(arg, "internal")) ++ default_visibility=VISIBILITY_INTERNAL; ++ else if(!strcmp(arg, "hidden")) ++ default_visibility=VISIBILITY_HIDDEN; ++ else if(!strcmp(arg, "protected")) ++ default_visibility=VISIBILITY_PROTECTED; ++ else ++ error("unrecognised visibility value \"%s\"", arg); ++ } ++ break; ++ + case OPT_fweb: + flag_web = value; + break; + +diff -aur gcc-3.4.0orig/gcc/tree.c gcc-3.4.0/gcc/tree.c +--- gcc-3.4.0orig/gcc/tree.c 2004-02-05 22:01:35.000000000 +0000 ++++ gcc-3.4.0/gcc/tree.c 2004-05-10 15:22:52.000000000 +0100 +@@ -2563,6 +2563,11 @@ + layout_decl (t, 0); + else if (code == FUNCTION_DECL) + DECL_MODE (t) = FUNCTION_MODE; ++ ++ /* Set default visibility to whatever the user supplied with ++ visibility_specified depending on #pragma GCC visibility. */ ++ DECL_VISIBILITY (t) = default_visibility; ++ DECL_VISIBILITYSPECIFIED (t) = visibility_options.inpragma; + + return t; + } + +diff -aur gcc-3.4.0orig/gcc/tree.h gcc-3.4.0/gcc/tree.h +--- gcc-3.4.0orig/gcc/tree.h 2004-02-08 01:52:43.000000000 +0000 ++++ gcc-3.4.0/gcc/tree.h 2004-05-09 08:10:54.000000000 +0100 +@@ -1499,6 +1499,10 @@ + /* Value of the decls's visibility attribute */ + #define DECL_VISIBILITY(NODE) (DECL_CHECK (NODE)->decl.visibility) + ++/* Nonzero means that the decl had its visibility specified rather than ++ being inferred. */ ++#define DECL_VISIBILITYSPECIFIED(NODE) (DECL_CHECK (NODE)->decl.visibility_specified) ++ + /* In a FUNCTION_DECL, nonzero if the function cannot be inlined. */ + #define DECL_UNINLINABLE(NODE) (FUNCTION_DECL_CHECK (NODE)->decl.uninlinable) + +@@ -1633,7 +1637,8 @@ + || TREE_CODE (DECL_CONTEXT (EXP)) == TRANSLATION_UNIT_DECL) + + /* Enumerate visibility settings. */ +- ++#ifndef SYMBOL_VISIBILITY_DEFINED ++#define SYMBOL_VISIBILITY_DEFINED + enum symbol_visibility + { + VISIBILITY_DEFAULT, +@@ -1641,6 +1646,7 @@ + VISIBILITY_HIDDEN, + VISIBILITY_PROTECTED + }; ++#endif + + struct function; + +@@ -1684,8 +1690,7 @@ + unsigned thread_local_flag : 1; + unsigned declared_inline_flag : 1; + ENUM_BITFIELD(symbol_visibility) visibility : 2; +- unsigned unused : 1; +- /* one unused bit. */ ++ unsigned visibility_specified : 1; + + unsigned lang_flag_0 : 1; + unsigned lang_flag_1 : 1; + +diff -aur gcc-3.4.0orig/gcc/varasm.c gcc-3.4.0/gcc/varasm.c +--- gcc-3.4.0orig/gcc/varasm.c 2004-04-14 22:14:08.000000000 +0100 ++++ gcc-3.4.0/gcc/varasm.c 2004-05-09 08:10:54.000000000 +0100 +@@ -5150,8 +5150,8 @@ + /* Static variables are always local. */ + else if (! TREE_PUBLIC (exp)) + local_p = true; +- /* A variable is local if the user tells us so. */ +- else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT) ++ /* A variable is local if the user explicitly tells us so. */ ++ else if (DECL_VISIBILITYSPECIFIED (exp) && DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT) + local_p = true; + /* Otherwise, variables defined outside this object may not be local. */ + else if (DECL_EXTERNAL (exp)) +@@ -5159,6 +5159,9 @@ + /* Linkonce and weak data are never local. */ + else if (DECL_ONE_ONLY (exp) || DECL_WEAK (exp)) + local_p = false; ++ /* If none of the above and visibility is not default, make local. */ ++ else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT) ++ local_p = true; + /* If PIC, then assume that any global name can be overridden by + symbols resolved from other modules. */ + else if (shlib) + +diff -Naur gcc-3.4.0orig/gcc/testsuite/gcc.dg/visibility-9.c gcc-3.4.0/gcc/testsuite/gcc.dg/visibility-9.c +--- gcc-3.4.0orig/gcc/testsuite/gcc.dg/visibility-9.c 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/gcc.dg/visibility-9.c 2004-05-09 12:40:39.000000000 +0100 +@@ -0,0 +1,9 @@ ++/* Test that -fvisibility works. */ ++/* { dg-do compile } */ ++/* { dg-require-visibility "" } */ ++/* { dg-options "-fvisibility=hidden" } */ ++/* { dg-final { scan-assembler "\\.hidden.*foo" } } */ ++ ++void foo(); ++ ++void foo() { } +diff -Naur gcc-3.4.0orig/gcc/testsuite/gcc.dg/visibility-a.c gcc-3.4.0/gcc/testsuite/gcc.dg/visibility-a.c +--- gcc-3.4.0orig/gcc/testsuite/gcc.dg/visibility-a.c 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/gcc.dg/visibility-a.c 2004-05-09 12:55:04.000000000 +0100 +@@ -0,0 +1,10 @@ ++/* Test that #pragma GCC visibility works. */ ++/* { dg-do compile } */ ++/* { dg-require-visibility "" } */ ++/* { dg-final { scan-assembler "\\.hidden.*foo" } } */ ++ ++#pragma GCC visibility push(hidden) ++void foo(); ++#pragma GCC visibility pop ++ ++void foo() { } +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility.C 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility.C 2004-05-09 19:17:13.000000000 +0100 +@@ -0,0 +1,12 @@ ++/* Test that -fvisibility affects class members. */ ++/* { dg-do compile } */ ++/* { dg-require-visibility "" } */ ++/* { dg-options "-fvisibility=hidden" } */ ++/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */ ++ ++class Foo ++{ ++ void method(); ++}; ++ ++void Foo::method() { } +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden.C 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-inlines-hidden.C 2004-05-09 19:17:59.000000000 +0100 +@@ -0,0 +1,18 @@ ++/* Test that -fvisibility-inlines-hidden affects class members. */ ++/* { dg-do compile } */ ++/* { dg-require-visibility "" } */ ++/* { dg-options "-fvisibility-inlines-hidden" } */ ++/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */ ++ ++class Foo ++{ ++public: ++ void method() { } ++}; ++ ++int main(void) ++{ ++ Foo f; ++ f.method(); ++ return 0; ++} +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override1.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override1.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override1.C 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override1.C 2004-05-09 19:18:06.000000000 +0100 +@@ -0,0 +1,12 @@ ++/* Test that -fvisibility does not override class member specific settings. */ ++/* { dg-do compile } */ ++/* { dg-require-visibility "" } */ ++/* { dg-options "-fvisibility=hidden" } */ ++/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */ ++ ++class __attribute__ ((visibility ("internal"))) Foo ++{ ++ void method(); ++}; ++ ++void Foo::method() { } +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override2.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override2.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override2.C 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/fvisibility-override2.C 2004-05-09 19:18:12.000000000 +0100 +@@ -0,0 +1,12 @@ ++/* Test that -fvisibility does not override class member specific settings. */ ++/* { dg-do compile } */ ++/* { dg-require-visibility "" } */ ++/* { dg-options "-fvisibility=hidden" } */ ++/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */ ++ ++class Foo ++{ ++ __attribute__ ((visibility ("internal"))) void method(); ++}; ++ ++void Foo::method() { } +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/memfuncts.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/memfuncts.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/memfuncts.C 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/memfuncts.C 2004-05-09 19:18:19.000000000 +0100 +@@ -0,0 +1,11 @@ ++/* Test that setting visibility for class member functions works. */ ++/* { dg-do compile } */ ++/* { dg-require-visibility "" } */ ++/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */ ++ ++class __attribute__ ((visibility ("hidden"))) Foo ++{ ++ void method(); ++}; ++ ++void Foo::method() { } +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/noPLT.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/noPLT.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/noPLT.C 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/noPLT.C 2004-05-09 19:21:49.000000000 +0100 +@@ -0,0 +1,20 @@ ++/* Test that -fvisibility=hidden prevents PLT. */ ++/* { dg-do compile } */ ++/* { dg-require-visibility "" } */ ++/* { dg-options "-fPIC -fvisibility=hidden" } */ ++/* { dg-final { scan-assembler-not "methodEv@PLT" } } */ ++ ++class Foo ++{ ++public: ++ void method(); ++}; ++ ++void Foo::method() { } ++ ++int main(void) ++{ ++ Foo f; ++ f.method(); ++ return 0; ++} +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma.C 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma.C 2004-05-09 19:18:30.000000000 +0100 +@@ -0,0 +1,13 @@ ++/* Test that #pragma GCC visibility affects class members. */ ++/* { dg-do compile } */ ++/* { dg-require-visibility "" } */ ++/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */ ++ ++#pragma GCC visibility push(hidden) ++class Foo ++{ ++ void method(); ++}; ++#pragma GCC visibility pop ++ ++void Foo::method() { } +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C 2004-05-09 19:18:36.000000000 +0100 +@@ -0,0 +1,13 @@ ++/* Test that #pragma GCC visibility does not override class member specific settings. */ ++/* { dg-do compile } */ ++/* { dg-require-visibility "" } */ ++/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */ ++ ++#pragma GCC visibility push(hidden) ++class __attribute__ ((visibility ("internal"))) Foo ++{ ++ void method(); ++}; ++#pragma GCC visibility pop ++ ++void Foo::method() { } +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C 2004-05-09 19:18:44.000000000 +0100 +@@ -0,0 +1,13 @@ ++/* Test that #pragma GCC visibility does not override class member specific settings. */ ++/* { dg-do compile } */ ++/* { dg-require-visibility "" } */ ++/* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */ ++ ++#pragma GCC visibility push(hidden) ++class Foo ++{ ++ __attribute__ ((visibility ("internal"))) void method(); ++}; ++#pragma GCC visibility pop ++ ++void Foo::method() { } +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/staticmemfuncts.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/staticmemfuncts.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/staticmemfuncts.C 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/staticmemfuncts.C 2004-05-09 19:18:50.000000000 +0100 +@@ -0,0 +1,11 @@ ++/* Test that setting visibility for static class member functions works. */ ++/* { dg-do compile } */ ++/* { dg-require-visibility "" } */ ++/* { dg-final { scan-assembler "\\.hidden.*Foo.methodEv" } } */ ++ ++class __attribute__ ((visibility ("hidden"))) Foo ++{ ++ static void method(); ++}; ++ ++void Foo::method() { } +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/virtual.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/virtual.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/virtual.C 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/virtual.C 2004-05-09 13:24:06.000000000 +0100 +@@ -0,0 +1,11 @@ ++/* Test that setting visibility for class affects virtual table. */ ++/* { dg-do compile } */ ++/* { dg-require-visibility "" } */ ++/* { dg-final { scan-assembler "\\.hidden.*ZTV3Foo" } } */ ++ ++class __attribute__ ((visibility ("hidden"))) Foo ++{ ++ virtual void method(); ++}; ++ ++void Foo::method() { } +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-1.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-1.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-1.C 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-1.C 2003-12-10 06:34:44.000000000 +0000 +@@ -0,0 +1,8 @@ ++/* Test visibility attribute on function definition. */ ++/* { dg-do compile { target *86-*-linux* } } */ ++/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */ ++ ++void ++__attribute__((visibility ("hidden"))) ++foo() ++{ } +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-2.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-2.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-2.C 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-2.C 2003-12-10 06:34:44.000000000 +0000 +@@ -0,0 +1,7 @@ ++/* Test that visibility attribute on declaration extends to definition. */ ++/* { dg-do compile { target *86-*-linux* } } */ ++/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */ ++ ++void __attribute__((visibility ("hidden"))) foo(); ++ ++void foo() { } +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-3.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-3.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-3.C 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-3.C 2003-12-10 06:34:45.000000000 +0000 +@@ -0,0 +1,7 @@ ++/* Test visibility attribute on forward declaration of global variable */ ++/* { dg-do compile { target *86-*-linux* } } */ ++/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */ ++ ++int ++__attribute__((visibility ("hidden"))) ++xyzzy = 5; +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-4.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-4.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-4.C 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-4.C 2003-12-10 06:34:45.000000000 +0000 +@@ -0,0 +1,8 @@ ++/* Test visibility attribute on forward declaration of global variable */ ++/* { dg-do compile { target *86-*-linux* } } */ ++/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */ ++ ++extern int __attribute__ ((visibility ("hidden"))) ++xyzzy; ++ ++int xyzzy = 5; +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-5.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-5.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-5.C 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-5.C 2003-12-10 06:34:45.000000000 +0000 +@@ -0,0 +1,11 @@ ++/* Test visibility attribute on definition of a function that has ++ already had a forward declaration. */ ++/* { dg-do compile { target *86-*-linux* } } */ ++/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */ ++ ++void foo(); ++ ++void ++ __attribute__((visibility ("hidden"))) ++foo() ++{ } +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-6.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-6.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-6.C 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-6.C 2003-12-10 06:34:45.000000000 +0000 +@@ -0,0 +1,10 @@ ++/* Test visibility attribute on definition of global variable that has ++ already had a forward declaration. */ ++/* { dg-do compile { target *86-*-linux* } } */ ++/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */ ++ ++extern int xyzzy; ++ ++int ++__attribute__((visibility ("hidden"))) ++xyzzy = 5; +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C 2003-12-10 06:34:45.000000000 +0000 +@@ -0,0 +1,11 @@ ++/* Test warning from conflicting visibility specifications. */ ++/* { dg-do compile { target *86-*-linux* } } */ ++/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */ ++ ++extern int ++__attribute__((visibility ("hidden"))) ++xyzzy; /* { dg-warning "previous declaration here" "" } */ ++ ++int ++__attribute__((visibility ("protected"))) ++xyzzy = 5; /* { dg-warning "visibility attribute ignored" "" } */ +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-1.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-1.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-1.C 2003-12-10 06:34:44.000000000 +0000 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-1.C 1970-01-01 01:00:00.000000000 +0100 +@@ -1,8 +0,0 @@ +-/* Test visibility attribute on function definition. */ +-/* { dg-do compile { target *86-*-linux* } } */ +-/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */ +- +-void +-__attribute__((visibility ("hidden"))) +-foo() +-{ } +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-2.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-2.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-2.C 2003-12-10 06:34:44.000000000 +0000 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-2.C 1970-01-01 01:00:00.000000000 +0100 +@@ -1,7 +0,0 @@ +-/* Test that visibility attribute on declaration extends to definition. */ +-/* { dg-do compile { target *86-*-linux* } } */ +-/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */ +- +-void __attribute__((visibility ("hidden"))) foo(); +- +-void foo() { } +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-3.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-3.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-3.C 2003-12-10 06:34:45.000000000 +0000 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-3.C 1970-01-01 01:00:00.000000000 +0100 +@@ -1,7 +0,0 @@ +-/* Test visibility attribute on forward declaration of global variable */ +-/* { dg-do compile { target *86-*-linux* } } */ +-/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */ +- +-int +-__attribute__((visibility ("hidden"))) +-xyzzy = 5; +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-4.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-4.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-4.C 2003-12-10 06:34:45.000000000 +0000 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-4.C 1970-01-01 01:00:00.000000000 +0100 +@@ -1,8 +0,0 @@ +-/* Test visibility attribute on forward declaration of global variable */ +-/* { dg-do compile { target *86-*-linux* } } */ +-/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */ +- +-extern int __attribute__ ((visibility ("hidden"))) +-xyzzy; +- +-int xyzzy = 5; +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-5.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-5.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-5.C 2003-12-10 06:34:45.000000000 +0000 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-5.C 1970-01-01 01:00:00.000000000 +0100 +@@ -1,11 +0,0 @@ +-/* Test visibility attribute on definition of a function that has +- already had a forward declaration. */ +-/* { dg-do compile { target *86-*-linux* } } */ +-/* { dg-final { scan-assembler "\\.hidden.*_Z3foov" } } */ +- +-void foo(); +- +-void +- __attribute__((visibility ("hidden"))) +-foo() +-{ } +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-6.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-6.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-6.C 2003-12-10 06:34:45.000000000 +0000 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-6.C 1970-01-01 01:00:00.000000000 +0100 +@@ -1,10 +0,0 @@ +-/* Test visibility attribute on definition of global variable that has +- already had a forward declaration. */ +-/* { dg-do compile { target *86-*-linux* } } */ +-/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */ +- +-extern int xyzzy; +- +-int +-__attribute__((visibility ("hidden"))) +-xyzzy = 5; +diff -Naur gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-7.C gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-7.C +--- gcc-3.4.0orig/gcc/testsuite/g++.dg/ext/visibility-7.C 2003-12-10 06:34:45.000000000 +0000 ++++ gcc-3.4.0/gcc/testsuite/g++.dg/ext/visibility-7.C 1970-01-01 01:00:00.000000000 +0100 +@@ -1,11 +0,0 @@ +-/* Test warning from conflicting visibility specifications. */ +-/* { dg-do compile { target *86-*-linux* } } */ +-/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */ +- +-extern int +-__attribute__((visibility ("hidden"))) +-xyzzy; /* { dg-warning "previous declaration here" "" } */ +- +-int +-__attribute__((visibility ("protected"))) +-xyzzy = 5; /* { dg-warning "visibility attribute ignored" "" } */ diff --git a/packages/gcc/gcc-3.4.6/GCOV_PREFIX_STRIP-cross-profile_3.4.patch b/packages/gcc/gcc-3.4.6/GCOV_PREFIX_STRIP-cross-profile_3.4.patch new file mode 100644 index 0000000000..701a687e05 --- /dev/null +++ b/packages/gcc/gcc-3.4.6/GCOV_PREFIX_STRIP-cross-profile_3.4.patch @@ -0,0 +1,389 @@ +2005-05-04 Grigory Zagorodnev <grigory.zagorodnev@intel.com> + H.J. Lu <hongjiu.lu@intel.com> + + + Cross-profiling support: relocate .gcda files when + running at system other than executable been built on. + + + * gcov-io.c (gcov_open): When in libgcov library + use given data file relocation prefix to build file name. + * gcov-io.h (gcov_open): Updated proto to accept + data file relocation prefix. + * libgcov.c (create_file_directory): New function. + (gcov_prefix): New static variable to hold data file + relocation prefix. + (gcov_version): Use relocation prefix. + (gcov_exit): Always try to create directory for output + file. Relocate filename at each use. + (__gcov_init): Initialize directory relocation prefix + if required. Strip off leading directories from + the initial filename. + * tsystem.h: include filenames.h + (DIR_SEPARATOR): Macro copied from system.h. + (DIR_SEPARATOR_2): Likewise. + * doc/gcov.texi (Cross-profiling): New node documenting + cross-profiling management. + * doc/invoke.texi (-fprofile-arcs): xref to cross-profiling. + +Grigory Zagorodnev +Intel Corporation + +--- gcc-3.4/gcc/gcov-io.c.prefix 2004-02-26 13:54:47.000000000 -0800 ++++ gcc-3.4/gcc/gcov-io.c 2005-05-04 11:46:01.000000000 -0700 +@@ -55,13 +55,14 @@ static inline gcov_unsigned_t from_file + + GCOV_LINKAGE int + #if IN_LIBGCOV +-gcov_open (const char *name) ++gcov_open (const char *prefix, const char *name) + #else + gcov_open (const char *name, int mode) + #endif + { + #if IN_LIBGCOV + const int mode = 0; ++ char *tmp; + #endif + #if GCOV_LOCKED + struct flock s_flock; +@@ -83,6 +84,14 @@ gcov_open (const char *name, int mode) + #if !IN_LIBGCOV + gcov_var.endian = 0; + #endif ++ ++#if IN_LIBGCOV ++ /* Build complete filename with prefix */ ++ tmp = alloca( strlen(prefix) + strlen(name) + 1); ++ *tmp = '\0'; ++ name = strcat( strcat(tmp, prefix), name); ++#endif ++ + #if GCOV_LOCKED + if (mode > 0) + fd = open (name, O_RDWR); +--- gcc-3.4/gcc/gcov-io.h.prefix 2005-05-02 15:37:58.000000000 -0700 ++++ gcc-3.4/gcc/gcov-io.h 2005-05-04 11:46:01.000000000 -0700 +@@ -502,7 +502,7 @@ GCOV_LINKAGE struct gcov_var + functions for writing. Your file may become corrupted if you break + these invariants. */ + #if IN_LIBGCOV +-GCOV_LINKAGE int gcov_open (const char */*name*/) ATTRIBUTE_HIDDEN; ++GCOV_LINKAGE int gcov_open (const char */*prefix*/, const char */*name*/) ATTRIBUTE_HIDDEN; + #else + GCOV_LINKAGE int gcov_open (const char */*name*/, int /*direction*/); + GCOV_LINKAGE int gcov_magic (gcov_unsigned_t, gcov_unsigned_t); +--- gcc-3.4/gcc/libgcov.c.prefix 2004-02-26 13:54:47.000000000 -0800 ++++ gcc-3.4/gcc/libgcov.c 2005-05-04 12:01:58.000000000 -0700 +@@ -92,6 +92,70 @@ static struct gcov_info *gcov_list; + object file included in multiple programs. */ + static gcov_unsigned_t gcov_crc32; + ++/* Directory prefix to relocate coverage data file names */ ++static char *gcov_prefix = 0; ++ ++/* Level of dirs to strip off the initial filename to relocate */ ++static int gcov_prefix_strip = 0; ++ ++static int ++create_file_directory (const char *prefix, const char *filename) ++{ ++ char *dname; ++ char sep, *r, *s; ++ size_t plen, flen; ++ ++ /* Detect directory separator */ ++ s = strrchr (prefix, DIR_SEPARATOR); ++#ifdef DIR_SEPARATOR_2 ++ if (! s) ++ s = strrchr (prefix, DIR_SEPARATOR_2); ++#endif ++ if (s) ++ sep = *s; ++ else ++ sep = DIR_SEPARATOR; ++ ++ /* join prefix and filename, split path */ ++ plen = strlen(prefix); ++ flen = strlen(filename); ++ r = alloca(plen + flen + 1); ++ strncpy(r, prefix, plen); ++ strncpy(r + plen, filename, flen); ++ r[plen + flen] = '\0'; ++ s = strrchr(r, sep); ++ if (s) ++ *(s + 1) = '\0'; ++ ++ if (access (r, F_OK) == 0) ++ return 0; ++ ++ /* Skip consecutive separators. */ ++ for (dname = r; *dname && *dname == sep; ++dname); ++ while (1) ++ { ++ char *s = strchr (dname, sep); ++ if (s == 0) ++ break; ++ *s = '\0'; ++ /* Try to make directory if it doesn't already exist. */ ++ if (access (r, F_OK) == -1 ++ && mkdir (r, 0755) == -1 ++ /* The directory might have been made by another process. */ ++ && errno != EEXIST) ++ { ++ *s = sep; ++ fprintf (stderr, "profiling:%s:Cannot create directory\n", r); ++ return -1; ++ }; ++ *s = sep; ++ /* Skip consecutive separators. */ ++ for (dname = s + 1; *dname && *dname == sep; ++dname) ++ ; ++ } ++ return 0; ++} ++ + static int + gcov_version (struct gcov_info *ptr, gcov_unsigned_t version) + { +@@ -103,8 +167,8 @@ gcov_version (struct gcov_info *ptr, gco + GCOV_UNSIGNED2STRING (e, GCOV_VERSION); + + fprintf (stderr, +- "profiling:%s:Version mismatch - expected %.4s got %.4s\n", +- ptr->filename, e, v); ++ "profiling:%s%s:Version mismatch - expected %.4s got %.4s\n", ++ gcov_prefix, ptr->filename, e, v); + return 0; + } + return 1; +@@ -204,9 +268,14 @@ gcov_exit (void) + fi_stride &= ~(__alignof__ (struct gcov_fn_info) - 1); + } + +- if (!gcov_open (gi_ptr->filename)) ++ if (create_file_directory (gcov_prefix, gi_ptr->filename)) + { +- fprintf (stderr, "profiling:%s:Cannot open\n", gi_ptr->filename); ++ fprintf (stderr, "profiling:%s%s:Skip\n", gcov_prefix, gi_ptr->filename); ++ continue; ++ } ++ else if (!gcov_open (gcov_prefix, gi_ptr->filename)) ++ { ++ fprintf (stderr, "profiling:%s%s:Cannot open\n", gcov_prefix, gi_ptr->filename); + continue; + } + +@@ -216,8 +285,8 @@ gcov_exit (void) + /* Merge data from file. */ + if (tag != GCOV_DATA_MAGIC) + { +- fprintf (stderr, "profiling:%s:Not a gcov data file\n", +- gi_ptr->filename); ++ fprintf (stderr, "profiling:%s%s:Not a gcov data file\n", ++ gcov_prefix, gi_ptr->filename); + read_fatal:; + gcov_close (); + continue; +@@ -250,8 +319,8 @@ gcov_exit (void) + || gcov_read_unsigned () != fi_ptr->checksum) + { + read_mismatch:; +- fprintf (stderr, "profiling:%s:Merge mismatch for %s\n", +- gi_ptr->filename, ++ fprintf (stderr, "profiling:%s%s:Merge mismatch for %s\n", ++ gcov_prefix, gi_ptr->filename, + f_ix + 1 ? "function" : "summaries"); + goto read_fatal; + } +@@ -309,8 +378,8 @@ gcov_exit (void) + if (!gcov_is_eof ()) + { + read_error:; +- fprintf (stderr, error < 0 ? "profiling:%s:Overflow merging\n" +- : "profiling:%s:Error merging\n", gi_ptr->filename); ++ fprintf (stderr, error < 0 ? "profiling:%s%s:Overflow merging\n" ++ : "profiling:%s%s:Error merging\n", gcov_prefix, gi_ptr->filename); + goto read_fatal; + } + rewrite:; +@@ -357,8 +426,8 @@ gcov_exit (void) + && (!GCOV_LOCKED || cs_all->runs == cs_prg->runs) + && memcmp (cs_all, cs_prg, sizeof (*cs_all))) + { +- fprintf (stderr, "profiling:%s:Invocation mismatch - some data files may have been removed%s", +- gi_ptr->filename, GCOV_LOCKED ++ fprintf (stderr, "profiling:%s%s:Invocation mismatch - some data files may have been removed%s", ++ gcov_prefix, gi_ptr->filename, GCOV_LOCKED + ? "" : " or concurrent update without locking support"); + all.checksum = ~0u; + } +@@ -418,9 +487,9 @@ gcov_exit (void) + gcov_write_summary (GCOV_TAG_PROGRAM_SUMMARY, &program); + if ((error = gcov_close ())) + fprintf (stderr, error < 0 ? +- "profiling:%s:Overflow writing\n" : +- "profiling:%s:Error writing\n", +- gi_ptr->filename); ++ "profiling:%s%s:Overflow writing\n" : ++ "profiling:%s%s:Error writing\n", ++ gcov_prefix, gi_ptr->filename); + } + } + +@@ -430,11 +499,69 @@ gcov_exit (void) + void + __gcov_init (struct gcov_info *info) + { ++ /* Save initial filename pointer to calculate CRC. */ ++ const char *ptr = info->filename; ++ + if (!info->version) + return; ++ ++ /* Initialize directory prefix if requred */ ++ if (gcov_prefix == 0) ++ { ++ if ((gcov_prefix = getenv("GCOV_PREFIX"))) ++ { ++ char *tmp; ++ ++ /* Normalize prefix: take off trailing separator. */ ++ tmp = gcov_prefix + strlen(gcov_prefix) - 1; ++ if (IS_DIR_SEPARATOR(*tmp)) ++ *tmp = '\0'; ++ ++ /* Check if the level of dirs to strip off specified */ ++ if ((tmp = getenv("GCOV_PREFIX_STRIP"))) ++ { ++ gcov_prefix_strip = atoi (tmp); ++ /* Do not consider negative values. */ ++ if (gcov_prefix_strip < 0) ++ gcov_prefix_strip = 0; ++ }; ++ } ++ else ++ gcov_prefix = (char *) ""; ++ }; ++ ++ /* Strip off leading directories from the initial filename */ ++ if (gcov_prefix_strip > 0) ++ { ++ char sep, *s; ++ int level; ++ const char *fname = info->filename; ++ ++ /* Detect directory separator */ ++ s = strrchr (fname, DIR_SEPARATOR); ++#ifdef DIR_SEPARATOR_2 ++ if (! s) ++ s = strrchr (fname, DIR_SEPARATOR_2); ++#endif ++ if (s) ++ sep = *s; ++ else ++ sep = DIR_SEPARATOR; ++ ++ /* Skip selected directory levels */ ++ for ( level = gcov_prefix_strip; level > 0; level--) ++ if ((s = strchr(fname + 1, sep))) ++ fname = s; ++ else ++ break; ++ ++ /* From this point info block refers stripped file name and ++ further operations must add prefix to get complete name.*/ ++ info->filename = fname; ++ }; ++ + if (gcov_version (info, info->version)) + { +- const char *ptr = info->filename; + gcov_unsigned_t crc32 = gcov_crc32; + + do +--- gcc-3.4/gcc/tsystem.h.prefix 2003-11-12 16:07:48.000000000 -0800 ++++ gcc-3.4/gcc/tsystem.h 2005-05-04 12:12:08.000000000 -0700 +@@ -106,4 +106,15 @@ extern int errno; + #define NULL 0 + #endif + ++/* Filename handling macros. */ ++#include "filenames.h" ++ ++/* These should be phased out in favor of IS_DIR_SEPARATOR, where possible. */ ++#ifndef DIR_SEPARATOR ++# define DIR_SEPARATOR '/' ++# ifdef HAVE_DOS_BASED_FILE_SYSTEM ++# define DIR_SEPARATOR_2 '\\' ++# endif ++#endif ++ + #endif /* ! GCC_TSYSTEM_H */ +Index: gcc-3.4/gcc/doc/gcov.texi +=================================================================== +RCS file: /cvsroot/gcc/gcc/gcc/doc/gcov.texi,v +retrieving revision 1.19.4.3 +diff -u -p -r1.19.4.3 gcov.texi +--- gcc-3.4/gcc/doc/gcov.texi 14 Mar 2004 22:31:20 -0000 1.19.4.3 ++++ gcc-3.4/gcc/doc/gcov.texi 4 May 2005 13:44:25 -0000 +@@ -42,6 +42,7 @@ test code coverage in your programs. + * Invoking Gcov:: How to use gcov. + * Gcov and Optimization:: Using gcov with GCC optimization. + * Gcov Data Files:: The files used by gcov. ++* Cross-profiling:: Data files relocation. + @end menu + + @node Gcov Intro +@@ -510,3 +511,36 @@ information. + The full details of the file format is specified in @file{gcov-io.h}, + and functions provided in that header file should be used to access the + coverage files. ++ ++@node Cross-profiling ++@section Data files relocation to support cross-profiling ++ ++Running the program will cause profile output to be generated. For each ++source file compiled with @option{-fprofile-arcs}, an accompanying @file{.gcda} ++file will be placed in the object file directory. That implicitly requires ++running the program at the same system as it was build or having same ++absolute directory structure on the target system (program will try ++to create needed directory structure). ++ ++To support cross-profiling, program compiled with @option{-fprofile-arcs} ++performs data file relocation basing on two environment variables: ++ ++@itemize @bullet ++@item ++GCOV_PREFIX contains the prefix to add to the absolute paths ++in the object file. ++ ++@item ++GCOV_PREFIX_STRIP indicates the how many initial directory names to strip off ++the hardwired absolute paths. Default value is 0. ++@end itemize ++ ++For example, if object file @file{/user/build/foo.o} was build with ++@option{-fprofile-arcs}, the final executable will try to create data file ++@file{/user/build/foo.gcda} when running at the target system and will ++fail if corresponding directory does not exists and is not allowed to create. ++ ++In this case, manipulating environment variables you can relocate data file ++to the suitable local directory. For our example, setting @samp{GCOV_PREFIX=/target/run} ++and @samp{GCOV_PREFIX_STRIP=1} values will force use of @file{/target/run/build/foo.gcda} ++file name. +Index: gcc-3.4/gcc/doc/invoke.texi +=================================================================== +RCS file: /cvsroot/gcc/gcc/gcc/doc/invoke.texi,v +retrieving revision 1.390.2.40 +diff -u -p -r1.390.2.40 invoke.texi +--- gcc-3.4/gcc/doc/invoke.texi 22 Apr 2005 06:49:59 -0000 1.390.2.40 ++++ gcc-3.4/gcc/doc/invoke.texi 4 May 2005 13:44:25 -0000 +@@ -3158,6 +3158,7 @@ explicitly specified and it is not the f + the basename of the source file. In both cases any suffix is removed + (e.g. @file{foo.gcda} for input file @file{dir/foo.c}, or + @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}). ++@xref{Cross-profiling}. + + @itemize + diff --git a/packages/gcc/gcc-3.4.6/always-fixincperm.patch b/packages/gcc/gcc-3.4.6/always-fixincperm.patch new file mode 100644 index 0000000000..59e5e2edeb --- /dev/null +++ b/packages/gcc/gcc-3.4.6/always-fixincperm.patch @@ -0,0 +1,32 @@ +Index: gcc-3.4.3/gcc/configure +=================================================================== +--- gcc-3.4.3.orig/gcc/configure 2004-11-04 23:14:05.000000000 -0500 ++++ gcc-3.4.3/gcc/configure 2005-03-11 14:41:06.373910320 -0500 +@@ -9916,11 +9916,6 @@ + BUILD_PREFIX=build- + BUILD_PREFIX_1=build- + BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)' +- +- if test "x$TARGET_SYSTEM_ROOT" = x; then +- STMP_FIXINC= +- STMP_FIXPROTO= +- fi + fi + + # Expand extra_headers to include complete path. +Index: gcc-3.4.3/gcc/configure.ac +=================================================================== +--- gcc-3.4.3.orig/gcc/configure.ac 2004-09-23 20:43:53.000000000 -0400 ++++ gcc-3.4.3/gcc/configure.ac 2005-03-11 14:40:55.256600408 -0500 +@@ -1524,11 +1524,6 @@ + BUILD_PREFIX=build- + BUILD_PREFIX_1=build- + BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)' +- +- if test "x$TARGET_SYSTEM_ROOT" = x; then +- STMP_FIXINC= +- STMP_FIXPROTO= +- fi + fi + + # Expand extra_headers to include complete path. diff --git a/packages/gcc/gcc-3.4.6/gcc-3.4.0-arm-bigendian-uclibc.patch b/packages/gcc/gcc-3.4.6/gcc-3.4.0-arm-bigendian-uclibc.patch new file mode 100644 index 0000000000..8fa9af880a --- /dev/null +++ b/packages/gcc/gcc-3.4.6/gcc-3.4.0-arm-bigendian-uclibc.patch @@ -0,0 +1,30 @@ + +# +# Patch managed by http://www.holgerschurig.de/patcher.html +# + +--- gcc-3.4.1/gcc/config.gcc~gcc-3.4.0-arm-bigendian-uclibc ++++ gcc-3.4.1/gcc/config.gcc +@@ -666,6 +666,11 @@ + ;; + arm*-*-linux-uclibc*) # ARM GNU/Linux with ELF - uClibc + 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-uclibc arm/t-linux" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes +--- gcc-3.4.1/gcc/config/arm/linux-elf.h~gcc-3.4.0-arm-bigendian-uclibc ++++ gcc-3.4.1/gcc/config/arm/linux-elf.h +@@ -120,7 +120,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 + #endif + diff --git a/packages/gcc/gcc-3.4.6/gcc-3.4.0-arm-bigendian.patch b/packages/gcc/gcc-3.4.6/gcc-3.4.0-arm-bigendian.patch new file mode 100644 index 0000000000..c9288c6c15 --- /dev/null +++ b/packages/gcc/gcc-3.4.6/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/packages/gcc/gcc-3.4.6/gcc-3.4.0-arm-lib1asm.patch b/packages/gcc/gcc-3.4.6/gcc-3.4.0-arm-lib1asm.patch new file mode 100644 index 0000000000..ca42bfbc0a --- /dev/null +++ b/packages/gcc/gcc-3.4.6/gcc-3.4.0-arm-lib1asm.patch @@ -0,0 +1,24 @@ +# 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/packages/gcc/gcc-3.4.6/gcc-3.4.0-arm-nolibfloat.patch b/packages/gcc/gcc-3.4.6/gcc-3.4.0-arm-nolibfloat.patch new file mode 100644 index 0000000000..43eed3ef28 --- /dev/null +++ b/packages/gcc/gcc-3.4.6/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/packages/gcc/gcc-3.4.6/gcc-3.4.0-arm-softfloat.patch b/packages/gcc/gcc-3.4.6/gcc-3.4.0-arm-softfloat.patch new file mode 100644 index 0000000000..f53d64b374 --- /dev/null +++ b/packages/gcc/gcc-3.4.6/gcc-3.4.0-arm-softfloat.patch @@ -0,0 +1,256 @@ +# +# 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 -urNd gcc-3.4.0-orig/gcc/config/arm/coff.h gcc-3.4.0/gcc/config/arm/coff.h +--- gcc-3.4.0-orig/gcc/config/arm/coff.h 2004-02-24 15:25:22.000000000 +0100 ++++ gcc-3.4.0/gcc/config/arm/coff.h 2004-05-01 19:07:06.059409600 +0200 +@@ -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 -urNd gcc-3.4.0-orig/gcc/config/arm/elf.h gcc-3.4.0/gcc/config/arm/elf.h +--- gcc-3.4.0-orig/gcc/config/arm/elf.h 2004-02-24 15:25:22.000000000 +0100 ++++ gcc-3.4.0/gcc/config/arm/elf.h 2004-05-01 19:12:16.976486400 +0200 +@@ -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 -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 +@@ -30,9 +30,27 @@ + /* Do not assume anything about header files. */ + #define NO_IMPLICIT_EXTERN_C + +-/* 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) ++#define TARGET_DEFAULT \ ++ ( ARM_FLAG_APCS_32 \ ++ | ARM_FLAG_SOFT_FLOAT \ ++ | ARM_FLAG_VFP \ ++ | ARM_FLAG_MMU_TRAPS ) ++ ++#undef SUBTARGET_EXTRA_ASM_SPEC ++#define SUBTARGET_EXTRA_ASM_SPEC "\ ++%{!mcpu=*:-mcpu=xscale} \ ++%{mhard-float:-mfpu=fpa} \ ++%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}" + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +@@ -40,7 +58,7 @@ + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" } ++ { "marm", "mlittle-endian", "mapcs-32", "mno-thumb-interwork" } + + #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" + +@@ -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 -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 -urNd gcc-3.4.0-orig/gcc/config/arm/unknown-elf.h gcc-3.4.0/gcc/config/arm/unknown-elf.h +--- gcc-3.4.0-orig/gcc/config/arm/unknown-elf.h 2004-02-24 15:25:22.000000000 +0100 ++++ gcc-3.4.0/gcc/config/arm/unknown-elf.h 2004-05-01 19:09:09.016212800 +0200 +@@ -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 -urNd gcc-3.4.0-orig/gcc/config/arm/xscale-elf.h gcc-3.4.0/gcc/config/arm/xscale-elf.h +--- gcc-3.4.0-orig/gcc/config/arm/xscale-elf.h 2003-07-02 01:26:43.000000000 +0200 ++++ gcc-3.4.0/gcc/config/arm/xscale-elf.h 2004-05-01 20:15:36.620105600 +0200 +@@ -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/packages/gcc/gcc-3.4.6/gcc-3.4.1-uclibc-100-conf.patch b/packages/gcc/gcc-3.4.6/gcc-3.4.1-uclibc-100-conf.patch new file mode 100644 index 0000000000..29e4c802e2 --- /dev/null +++ b/packages/gcc/gcc-3.4.6/gcc-3.4.1-uclibc-100-conf.patch @@ -0,0 +1,442 @@ +diff -urN gcc-3.4.1-dist/boehm-gc/configure gcc-3.4.1/boehm-gc/configure +--- 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]+$' +diff -urN gcc-3.4.1-dist/boehm-gc/ltconfig gcc-3.4.1/boehm-gc/ltconfig +--- 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 -urN gcc-3.4.1-dist/gcc/config/arm/linux-elf.h gcc-3.4.1/gcc/config/arm/linux-elf.h +--- 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 +@@ -81,6 +81,18 @@ + "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" + + #undef LINK_SPEC ++#ifdef USE_UCLIBC ++#define LINK_SPEC "%{h*} %{version:-v} \ ++ %{b} %{Wl,*:%*} \ ++ %{static:-Bstatic} \ ++ %{shared:-shared} \ ++ %{symbolic:-Bsymbolic} \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0} \ ++ -X \ ++ %{mbig-endian:-EB}" \ ++ SUBTARGET_EXTRA_LINK_SPEC ++#else + #define LINK_SPEC "%{h*} %{version:-v} \ + %{b} %{Wl,*:%*} \ + %{static:-Bstatic} \ +@@ -91,6 +103,7 @@ + -X \ + %{mbig-endian:-EB}" \ + SUBTARGET_EXTRA_LINK_SPEC ++#endif + + #define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS() + +diff -urN gcc-3.4.1-dist/gcc/config/cris/linux.h gcc-3.4.1/gcc/config/cris/linux.h +--- 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 */ + +diff -urN gcc-3.4.1-dist/gcc/config/cris/t-linux-uclibc gcc-3.4.1/gcc/config/cris/t-linux-uclibc +--- gcc-3.4.1-dist/gcc/config/cris/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.1/gcc/config/cris/t-linux-uclibc 2004-08-12 15:54:43.000000000 -0500 +@@ -0,0 +1,3 @@ ++T_CFLAGS = -DUSE_UCLIBC ++TARGET_LIBGCC2_CFLAGS += -fPIC ++CRTSTUFF_T_CFLAGS_S = $(TARGET_LIBGCC2_CFLAGS) +diff -urN gcc-3.4.1-dist/gcc/config/i386/linux.h gcc-3.4.1/gcc/config/i386/linux.h +--- 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 +@@ -118,6 +118,15 @@ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \ + %{static:-static}}}" + #else ++#if defined USE_UCLIBC ++#define LINK_SPEC "-m elf_i386 %{shared:-shared} \ ++ %{!shared: \ ++ %{!ibcs: \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \ ++ %{static:-static}}}" ++#else + #define LINK_SPEC "-m elf_i386 %{shared:-shared} \ + %{!shared: \ + %{!ibcs: \ +@@ -126,6 +135,7 @@ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ + %{static:-static}}}" + #endif ++#endif + + /* A C statement (sans semicolon) to output to the stdio stream + FILE the assembler definition of uninitialized global DECL named +diff -urN gcc-3.4.1-dist/gcc/config/mips/linux.h gcc-3.4.1/gcc/config/mips/linux.h +--- 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,6 +109,17 @@ + + /* Borrowed from sparc/linux.h */ + #undef LINK_SPEC ++#ifdef USE_UCLIBC ++#define LINK_SPEC \ ++ "%(endian_spec) \ ++ %{shared:-shared} \ ++ %{!shared: \ ++ %{!ibcs: \ ++ %{!static: \ ++ %{rdynamic:-export-dynamic} \ ++ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \ ++ %{static:-static}}}" ++#else + #define LINK_SPEC \ + "%(endian_spec) \ + %{shared:-shared} \ +@@ -118,6 +129,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \ + %{static:-static}}}" ++#endif + + #undef SUBTARGET_ASM_SPEC + #define SUBTARGET_ASM_SPEC "\ +diff -urN gcc-3.4.1-dist/gcc/config/rs6000/linux.h gcc-3.4.1/gcc/config/rs6000/linux.h +--- 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 +@@ -61,7 +61,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}" +diff -urN gcc-3.4.1-dist/gcc/config/rs6000/sysv4.h gcc-3.4.1/gcc/config/rs6000/sysv4.h +--- 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) }" + +@@ -1124,6 +1125,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 +@@ -1290,6 +1295,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 }, \ +diff -urN gcc-3.4.1-dist/gcc/config/sh/linux.h gcc-3.4.1/gcc/config/sh/linux.h +--- 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,12 +73,21 @@ + #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 + + #undef LIB_SPEC + #define LIB_SPEC \ +diff -urN gcc-3.4.1-dist/gcc/config/sh/t-linux-uclibc gcc-3.4.1/gcc/config/sh/t-linux-uclibc +--- gcc-3.4.1-dist/gcc/config/sh/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.1/gcc/config/sh/t-linux-uclibc 2004-08-12 15:54:43.000000000 -0500 +@@ -0,0 +1,13 @@ ++T_CFLAGS = -DUSE_UCLIBC ++ ++TARGET_LIBGCC2_CFLAGS = -fpic -DNO_FPSCR_VALUES ++LIB1ASMFUNCS_CACHE = _ic_invalidate ++ ++LIB2FUNCS_EXTRA= ++ ++MULTILIB_OPTIONS= $(MULTILIB_ENDIAN) m3e/m4 ++MULTILIB_DIRNAMES= ++MULTILIB_MATCHES = ++MULTILIB_EXCEPTIONS= ++ ++EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o +diff -urN gcc-3.4.1-dist/gcc/config/sh/t-sh64-uclibc gcc-3.4.1/gcc/config/sh/t-sh64-uclibc +--- gcc-3.4.1-dist/gcc/config/sh/t-sh64-uclibc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.1/gcc/config/sh/t-sh64-uclibc 2004-08-12 15:54:43.000000000 -0500 +@@ -0,0 +1,13 @@ ++EXTRA_MULTILIB_PARTS= crt1.o crti.o crtn.o crtbegin.o crtend.o ++ ++LIB1ASMFUNCS = \ ++ _sdivsi3 _sdivsi3_i4 _udivsi3 _udivsi3_i4 _set_fpscr \ ++ _shcompact_call_trampoline _shcompact_return_trampoline \ ++ _shcompact_incoming_args _ic_invalidate _nested_trampoline \ ++ _push_pop_shmedia_regs \ ++ _udivdi3 _divdi3 _umoddi3 _moddi3 ++ ++MULTILIB_OPTIONS = $(MULTILIB_ENDIAN) m5-32media-nofpu/m5-compact/m5-compact-nofpu/m5-64media/m5-64media-nofpu ++MULTILIB_DIRNAMES= $(MULTILIB_ENDIAN) nofpu compact nofpu/compact media64 nofpu/media64 ++MULTILIB_MATCHES= ++MULTILIB_EXCEPTIONS= +diff -urN gcc-3.4.1-dist/gcc/config/t-linux-uclibc gcc-3.4.1/gcc/config/t-linux-uclibc +--- gcc-3.4.1-dist/gcc/config/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-3.4.1/gcc/config/t-linux-uclibc 2004-08-12 15:54:43.000000000 -0500 +@@ -0,0 +1,15 @@ ++T_CFLAGS = -DUSE_UCLIBC ++ ++# Compile crtbeginS.o and crtendS.o with pic. ++CRTSTUFF_T_CFLAGS_S = $(CRTSTUFF_T_CFLAGS) -fPIC ++# Compile libgcc2.a with pic. ++TARGET_LIBGCC2_CFLAGS = -fPIC ++ ++# Override t-slibgcc-elf-ver to export some libgcc symbols with ++# the symbol versions that glibc used. ++#SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver ++ ++# Use unwind-dw2-fde ++LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \ ++ $(srcdir)/unwind-sjlj.c $(srcdir)/gthr-gnat.c $(srcdir)/unwind-c.c ++LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h +diff -urN gcc-3.4.1-dist/gcc/config.gcc gcc-3.4.1/gcc/config.gcc +--- gcc-3.4.1-dist/gcc/config.gcc 2004-04-21 10:12:35.000000000 -0500 ++++ gcc-3.4.1/gcc/config.gcc 2004-08-12 15:59:46.000000000 -0500 +@@ -664,6 +664,12 @@ + extra_parts="" + use_collect2=yes + ;; ++arm*-*-linux-uclibc*) # ARM GNU/Linux with ELF - uClibc ++ 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" ++ tmake_file="t-slibgcc-elf-ver t-linux-uclibc arm/t-linux" ++ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" ++ gnu_ld=yes ++ ;; + 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" + tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux" +@@ -725,6 +731,10 @@ + tmake_file="cris/t-cris cris/t-elfmulti" + gas=yes + ;; ++cris-*-linux-uclibc*) ++ tm_file="dbxelf.h elfos.h svr4.h ${tm_file} linux.h cris/linux.h" ++ tmake_file="cris/t-cris t-slibgcc-elf-ver cris/t-linux-uclibc" ++ ;; + cris-*-linux*) + tm_file="dbxelf.h elfos.h svr4.h ${tm_file} linux.h cris/linux.h" + tmake_file="cris/t-cris t-slibgcc-elf-ver cris/t-linux" +@@ -988,6 +998,11 @@ + thread_file='single' + fi + ;; ++i[34567]86-*-linux*uclibc*) # Intel 80386's running GNU/Linux ++ # with ELF format using uClibc ++ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h i386/linux.h" ++ tmake_file="t-slibgcc-elf-ver t-linux-uclibc i386/t-crtstuff" ++ ;; + i[34567]86-*-linux*) # Intel 80386's running GNU/Linux + # with ELF format using glibc 2 + # aka GNU/Linux C library 6 +@@ -1547,6 +1562,16 @@ + gnu_ld=yes + gas=yes + ;; ++mips*-*-linux-uclibc*) # Linux MIPS, either endian. uClibc ++ tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h" ++ case ${target} in ++ mipsisa32*-*) ++ target_cpu_default="MASK_SOFT_FLOAT" ++ tm_defines="MIPS_ISA_DEFAULT=32" ++ ;; ++ esac ++ tmake_file="t-slibgcc-elf-ver t-linux-uclibc" ++ ;; + mips*-*-linux*) # Linux MIPS, either endian. + tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h" + case ${target} in +@@ -1764,6 +1789,10 @@ + tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h rs6000/linuxspe.h" + tmake_file="rs6000/t-fprules rs6000/t-ppcos t-slibgcc-elf-ver t-linux rs6000/t-ppccomm" + ;; ++powerpc-*-linux-uclibc*) ++ tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h" ++ tmake_file="rs6000/t-fprules rs6000/t-ppcos t-slibgcc-elf-ver t-linux-uclibc rs6000/t-ppccomm" ++ ;; + powerpc-*-linux*) + tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h" + tmake_file="rs6000/t-fprules rs6000/t-ppcos t-slibgcc-elf-ver t-linux rs6000/t-ppccomm" +@@ -1916,7 +1945,7 @@ + tm_file="${tm_file} dbxelf.h elfos.h svr4.h sh/elf.h sh/embed-elf.h sh/rtemself.h rtems.h" + ;; + sh-*-linux* | sh[2346lbe]*-*-linux*) +- tmake_file="sh/t-sh sh/t-elf t-slibgcc-elf-ver t-linux" ++ tmake_file="sh/t-sh sh/t-elf t-slibgcc-elf-ver" + case ${target} in + sh*be-*-* | sh*eb-*-*) ;; + *) +@@ -1924,9 +1953,17 @@ + tmake_file="${tmake_file} sh/t-le" + ;; + esac +- tmake_file="${tmake_file} sh/t-linux" ++ case ${target} in ++ *-*-linux-uclibc*) tmake_file="${tmake_file} t-linux-uclibc sh/t-linux-uclibc" ;; ++ *) tmake_file="${tmake_file} t-linux sh/t-linux" ;; ++ esac + tm_file="${tm_file} dbxelf.h elfos.h svr4.h sh/elf.h sh/linux.h" + case ${target} in ++ sh64*-*-linux-uclibc*) ++ tmake_file="${tmake_file} sh/t-sh64-uclibc" ++ tm_file="${tm_file} sh/sh64.h" ++ extra_headers="shmedia.h ushmedia.h sshmedia.h" ++ ;; + sh64*) + tmake_file="${tmake_file} sh/t-sh64" + tm_file="${tm_file} sh/sh64.h" +diff -urN gcc-3.4.1-dist/libtool.m4 gcc-3.4.1/libtool.m4 +--- 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]+$'] +diff -urN gcc-3.4.1-dist/ltconfig gcc-3.4.1/ltconfig +--- 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 diff --git a/packages/gcc/gcc-3.4.6/gcc-3.4.1-uclibc-200-locale.patch b/packages/gcc/gcc-3.4.6/gcc-3.4.1-uclibc-200-locale.patch new file mode 100644 index 0000000000..3fc4900b06 --- /dev/null +++ b/packages/gcc/gcc-3.4.6/gcc-3.4.1-uclibc-200-locale.patch @@ -0,0 +1,3246 @@ +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]+$' +@@ -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/packages/gcc/gcc-3.4.6/gcc-uclibc-3.4.0-120-softfloat.patch b/packages/gcc/gcc-3.4.6/gcc-uclibc-3.4.0-120-softfloat.patch new file mode 100644 index 0000000000..f2431896cf --- /dev/null +++ b/packages/gcc/gcc-3.4.6/gcc-uclibc-3.4.0-120-softfloat.patch @@ -0,0 +1,14 @@ +--- gcc-3.3.2-old/configure.in 2003-08-09 01:57:21.000000000 -0500 ++++ gcc-3.3.2/configure.in 2004-01-15 12:46:29.000000000 -0600 +@@ -1418,6 +1418,11 @@ + fi + + FLAGS_FOR_TARGET= ++case " $targargs " in ++ *" --nfp "* | *" --without-float "*) ++ FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -msoft-float' ++ ;; ++esac + case " $target_configdirs " in + *" newlib "*) + case " $targargs " in diff --git a/packages/gcc/gcc-3.4.6/gcc34-arm-ldm-peephole.patch b/packages/gcc/gcc-3.4.6/gcc34-arm-ldm-peephole.patch new file mode 100644 index 0000000000..92ad25d09c --- /dev/null +++ b/packages/gcc/gcc-3.4.6/gcc34-arm-ldm-peephole.patch @@ -0,0 +1,79 @@ +--- 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/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"); +--- gcc/gcc/config/arm/arm.c.orig 2005-06-02 22:40:40.000000000 +0100 ++++ gcc/gcc/config/arm/arm.c 2005-06-02 22:45:45.000000000 +0100 +@@ -4610,9 +4610,12 @@ + if (arm_eliminable_register (reg0)) + return 0; + ++ /* For Harvard cores, only accept pairs where one offset is zero. ++ See comment in load_multiple_sequence. */ + val_diff = val1 - val0; + return ((REGNO (reg0) == REGNO (reg1)) +- && (val_diff == 4 || val_diff == -4)); ++ && (val_diff == 4 || val_diff == -4)) ++ && (!arm_ld_sched || val0 == 0 || val1 == 0); + } + + return 0; +@@ -4857,6 +4860,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 */ + +@@ -5083,6 +5091,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 */ + diff --git a/packages/gcc/gcc-3.4.6/gcc34-arm-ldm.patch b/packages/gcc/gcc-3.4.6/gcc34-arm-ldm.patch new file mode 100644 index 0000000000..142052fdf0 --- /dev/null +++ b/packages/gcc/gcc-3.4.6/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/packages/gcc/gcc-3.4.6/gcc34-arm-tune.patch b/packages/gcc/gcc-3.4.6/gcc34-arm-tune.patch new file mode 100644 index 0000000000..cdb20bef9b --- /dev/null +++ b/packages/gcc/gcc-3.4.6/gcc34-arm-tune.patch @@ -0,0 +1,9 @@ +--- gcc-3.4.0/gcc/config/arm/linux-elf.h.arm-tune 2004-01-31 01:18:11.000000000 -0500 ++++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-04-24 18:19:10.000000000 -0400 +@@ -126,3 +126,6 @@ + + #define LINK_GCC_C_SEQUENCE_SPEC \ + "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" ++ ++/* Tune for XScale. */ ++#define TARGET_TUNE_DEFAULT TARGET_CPU_xscale diff --git a/packages/gcc/gcc-3.4.6/gcc34-configure.in.patch b/packages/gcc/gcc-3.4.6/gcc34-configure.in.patch new file mode 100644 index 0000000000..3d33bcb978 --- /dev/null +++ b/packages/gcc/gcc-3.4.6/gcc34-configure.in.patch @@ -0,0 +1,22 @@ +--- gcc-3.4.4/configure.in.orig 2005-08-09 19:57:51.504323183 -0700 ++++ gcc-3.4.4/configure.in 2005-08-09 20:00:12.073168623 -0700 +@@ -1907,7 +1907,7 @@ + *) gxx_include_dir=${with_gxx_include_dir} ;; + esac + +-FLAGS_FOR_TARGET= ++FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET" + case " $target_configdirs " in + *" newlib "*) + case " $target_configargs " in +--- gcc-3.4.4/configure.orig 2005-08-09 21:02:29.668360660 -0700 ++++ gcc-3.4.4/configure 2005-08-09 21:02:50.157649970 -0700 +@@ -2669,7 +2669,7 @@ + *) gxx_include_dir=${with_gxx_include_dir} ;; + esac + +-FLAGS_FOR_TARGET= ++FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET" + case " $target_configdirs " in + *" newlib "*) + case " $target_configargs " in diff --git a/packages/gcc/gcc-3.4.6/gcc34-reverse-compare.patch b/packages/gcc/gcc-3.4.6/gcc34-reverse-compare.patch new file mode 100644 index 0000000000..c3c40dd183 --- /dev/null +++ b/packages/gcc/gcc-3.4.6/gcc34-reverse-compare.patch @@ -0,0 +1,32 @@ +--- gcc-3.4.0/gcc/flow.c.reverse-compare 2004-02-27 22:39:19.000000000 -0500 ++++ gcc-3.4.0/gcc/flow.c 2004-04-24 16:36:00.000000000 -0400 +@@ -1843,6 +1843,7 @@ + regset_head diff_head; + regset diff = INITIALIZE_REG_SET (diff_head); + basic_block bb_true, bb_false; ++ enum rtx_code reversed_code; + int i; + + /* Identify the successor blocks. */ +@@ -1889,8 +1890,11 @@ + if (GET_CODE (reg) == REG + && XEXP (cond_true, 1) == const0_rtx) + { +- rtx cond_false +- = gen_rtx_fmt_ee (reverse_condition (GET_CODE (cond_true)), ++ rtx cond_false; ++ reversed_code = reverse_condition (GET_CODE (cond_true)); ++ if (reversed_code == UNKNOWN) ++ goto skip; ++ cond_false = gen_rtx_fmt_ee (reversed_code, + GET_MODE (cond_true), XEXP (cond_true, 0), + XEXP (cond_true, 1)); + if (GET_CODE (XEXP (set_src, 1)) == PC) +@@ -1925,6 +1929,7 @@ + } + } + ++ skip: + FREE_REG_SET (diff); + } + #endif diff --git a/packages/gcc/gcc-3.4.6/gcc34-thumb-support.patch b/packages/gcc/gcc-3.4.6/gcc34-thumb-support.patch new file mode 100644 index 0000000000..a4f156f8db --- /dev/null +++ b/packages/gcc/gcc-3.4.6/gcc34-thumb-support.patch @@ -0,0 +1,156 @@ +# This patch contains various fixes for the thumb code handling in GCC 3.4.4 +# +# Most of these are minor fixes to code which is either missing (Linux thumb +# div0, thumb clear instruction cache) or uses the wrong return mechanism +# (libffi) +# +# There is also a significant design problem with the _call_via_rx code - +# it cannot be in a shared library because a call via PLT simply won't +# work (for _call_via_ip) and is very inefficient anyway. +# +# This is fixed in uclibc simply by incorporating the code into crti.S +# (an extra 30 bytes for the 15 functions) even though not all link units +# require all the code - there is so little of it. That doesn't work with +# the crti.asm here because it is linked with libgcc.a which already defines +# these symbols +# +--- gcc-3.4.4/gcc/config/arm/t-linux.orig 2005-08-09 08:55:02.181797492 -0700 ++++ gcc-3.4.4/gcc/config/arm/t-linux 2005-08-09 08:58:22.766419486 -0700 +@@ -7,6 +7,7 @@ + LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \ + _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ + _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ ++ _call_via_rX \ + _fixsfsi _fixunssfsi + + # MULTILIB_OPTIONS = mhard-float/msoft-float +--- gcc-3.4.4/.pc/gcc34-thumb-support.patch/gcc/config/arm/lib1funcs.asm 2004-01-15 08:56:34.000000000 -0800 ++++ gcc-3.4.4/gcc/config/arm/lib1funcs.asm 2005-09-21 21:32:03.376927755 -0700 +@@ -811,13 +811,18 @@ + + /* Constants taken from <asm/unistd.h> and <asm/signal.h> */ + #define SIGFPE 8 ++#if !defined __thumb__ + #define __NR_SYSCALL_BASE 0x900000 ++#else ++#define __NR_SYSCALL_BASE 0 ++#endif + #define __NR_getpid (__NR_SYSCALL_BASE+ 20) + #define __NR_kill (__NR_SYSCALL_BASE+ 37) + + .code 32 + FUNC_START div0 + ++#if ! defined __thumb__ + stmfd sp!, {r1, lr} + swi __NR_getpid + cmn r0, #1000 +@@ -825,6 +830,28 @@ + mov r1, #SIGFPE + swi __NR_kill + RETLDM r1 ++#else ++ push {r1, r7, lr} ++ mov r7, #__NR_getpid ++ swi 0 ++ @ above the compare is with -1000, but the standard syscall ++ @ macro checks for -1..-125 ++ add r0, #125 ++ bcs 90f ++ sub r0, #125 ++ mov r1, #SIGFPE ++ mov r7, #__NR_kill ++ swi 0 ++90: ++#if __ARM_ARCH__ > 4 ++ pop {r1, r7, pc} ++#else ++ @ on 4T that won't work ++ pop {r1, r7} ++ pop {r3} ++ bx r3 ++#endif ++#endif + + FUNC_END div0 + +@@ -845,14 +872,14 @@ + code here switches to the correct mode before executing the function. */ + + .text +- .align 0 ++ .align 1 + .force_thumb + + .macro call_via register + THUMB_FUNC_START _call_via_\register ++ .hidden SYM (_call_via_\register) + + bx \register +- nop + + SIZE (_call_via_\register) + .endm +@@ -903,6 +930,7 @@ + .code 16 + + THUMB_FUNC_START _interwork_call_via_\register ++ .hidden SYM (_interwork_call_via_\register) + + bx pc + nop +--- gcc-3.4.4/.pc/gcc34-thumb-support.patch/gcc/config/arm/linux-gas.h 2003-06-19 14:47:06.000000000 -0700 ++++ gcc-3.4.4/gcc/config/arm/linux-gas.h 2005-09-20 16:09:55.027862200 -0700 +@@ -56,6 +56,7 @@ + + /* Clear the instruction cache from `beg' to `end'. This makes an + inline system call to SYS_cacheflush. */ ++#if !defined(__thumb__) + #define CLEAR_INSN_CACHE(BEG, END) \ + { \ + register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \ +@@ -65,3 +66,18 @@ + : "=r" (_beg) \ + : "0" (_beg), "r" (_end), "r" (_flg)); \ + } ++#else ++#define CLEAR_INSN_CACHE(BEG, END) \ ++{ \ ++ 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; \ ++ register unsigned long _swi __asm ("a4") = 0xf0002; \ ++ __asm __volatile ("push {r7}\n" \ ++ " mov r7,a4\n" \ ++ " swi 0 @ sys_cacheflush\n" \ ++ " pop {r7}\n" \ ++ : "=r" (_beg) \ ++ : "0" (_beg), "r" (_end), "r" (_flg), "r" (_swi)); \ ++} ++#endif +--- gcc-3.4.4/.pc/gcc34-thumb-support.patch/libffi/src/arm/sysv.S 2003-10-21 12:01:55.000000000 -0700 ++++ gcc-3.4.4/libffi/src/arm/sysv.S 2005-09-20 16:09:55.027862200 -0700 +@@ -41,6 +41,14 @@ + #define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): + #endif + ++/* Get the correct return instruction */ ++#if defined(__ARM_ARCH_4T__) || defined(__ARM_ARCH_5__) \ ++ || defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5TE__) ++#define RET bx r ++#else ++#define RET mov pc, ++#endif ++ + .text + + # a1: ffi_prep_args +@@ -66,7 +74,7 @@ + + # And call + mov lr, pc +- mov pc, ip ++ RET ip + + # move first 4 parameters in registers + ldr a1, [sp, #0] diff --git a/packages/gcc/gcc-3.4.6/gcc4-mtune-compat.patch b/packages/gcc/gcc-3.4.6/gcc4-mtune-compat.patch new file mode 100644 index 0000000000..0da2811d37 --- /dev/null +++ b/packages/gcc/gcc-3.4.6/gcc4-mtune-compat.patch @@ -0,0 +1,14 @@ +Patch for gcc3 to support gcc4-compatible (and consistent) values for -mtune= option. + +--- gcc-3.4.4/gcc/config/arm/arm.c.org 2007-12-15 23:58:35.000000000 +0200 ++++ gcc-3.4.4/gcc/config/arm/arm.c 2007-12-16 00:20:39.000000000 +0200 +@@ -432,7 +432,9 @@ + {"arm10tdmi", FL_MODE32 | FL_FAST_MULT | FL_ARCH4 | FL_THUMB | FL_LDSCHED | FL_ARCH5 }, + {"arm1020t", FL_MODE32 | FL_FAST_MULT | FL_ARCH4 | FL_THUMB | FL_LDSCHED | FL_ARCH5 }, + {"arm926ejs", FL_MODE32 | FL_FAST_MULT | FL_ARCH4 | FL_THUMB | FL_ARCH5 | FL_ARCH5E }, ++ {"arm926ej-s", FL_MODE32 | FL_FAST_MULT | FL_ARCH4 | FL_THUMB | FL_ARCH5 | FL_ARCH5E }, + {"arm1026ejs", FL_MODE32 | FL_FAST_MULT | FL_ARCH4 | FL_THUMB | FL_ARCH5 | FL_ARCH5E }, ++ {"arm1026ej-s", FL_MODE32 | FL_FAST_MULT | FL_ARCH4 | FL_THUMB | FL_ARCH5 | FL_ARCH5E }, + {"xscale", FL_MODE32 | FL_FAST_MULT | FL_ARCH4 | FL_THUMB | FL_LDSCHED | FL_STRONG | FL_ARCH5 | FL_ARCH5E | FL_XSCALE }, + {"iwmmxt", FL_MODE32 | FL_FAST_MULT | FL_ARCH4 | FL_THUMB | FL_LDSCHED | FL_STRONG | FL_ARCH5 | FL_ARCH5E | FL_XSCALE | FL_IWMMXT }, + /* V6 Architecture Processors */ diff --git a/packages/gcc/gcc-3.4.6/jarfix.patch b/packages/gcc/gcc-3.4.6/jarfix.patch new file mode 100644 index 0000000000..082daf4a7e --- /dev/null +++ b/packages/gcc/gcc-3.4.6/jarfix.patch @@ -0,0 +1,30 @@ + libjava/Makefile.am | 2 +- + libjava/Makefile.in | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +Index: gcc-3.4.4/libjava/Makefile.am +=================================================================== +--- gcc-3.4.4.orig/libjava/Makefile.am 2006-12-05 15:37:50.000000000 +0000 ++++ gcc-3.4.4/libjava/Makefile.am 2006-12-05 15:38:27.000000000 +0000 +@@ -77,7 +77,7 @@ if NULL_TARGET + ZIP = $(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar + GCJH = gcjh + else +-ZIP = jar ++ZIP = $(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar + GCJH = $(target_alias)-gcjh + endif + else # CANADIAN +Index: gcc-3.4.4/libjava/Makefile.in +=================================================================== +--- gcc-3.4.4.orig/libjava/Makefile.in 2006-12-05 15:39:08.000000000 +0000 ++++ gcc-3.4.4/libjava/Makefile.in 2006-12-05 15:39:21.000000000 +0000 +@@ -193,7 +193,7 @@ propdir = $(libdir) + + bin_SCRIPTS = addr2name.awk + @CANADIAN_TRUE@@NULL_TARGET_TRUE@ZIP = @CANADIAN_TRUE@@NULL_TARGET_TRUE@$(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar +-@CANADIAN_TRUE@@NULL_TARGET_FALSE@ZIP = @CANADIAN_TRUE@@NULL_TARGET_FALSE@jar ++@CANADIAN_TRUE@@NULL_TARGET_FALSE@ZIP = @CANADIAN_TRUE@@NULL_TARGET_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar + @CANADIAN_FALSE@ZIP = @CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar + @CANADIAN_TRUE@@NULL_TARGET_TRUE@GCJH = @CANADIAN_TRUE@@NULL_TARGET_TRUE@gcjh + @CANADIAN_TRUE@@NULL_TARGET_FALSE@GCJH = @CANADIAN_TRUE@@NULL_TARGET_FALSE@$(target_alias)-gcjh diff --git a/packages/gcc/gcc-3.4.6/sdk-libstdc++-includes.patch b/packages/gcc/gcc-3.4.6/sdk-libstdc++-includes.patch new file mode 100644 index 0000000000..4377c2143b --- /dev/null +++ b/packages/gcc/gcc-3.4.6/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/packages/gcc/gcc-3.4.6/zecke-no-host-includes.patch b/packages/gcc/gcc-3.4.6/zecke-no-host-includes.patch new file mode 100644 index 0000000000..069a965012 --- /dev/null +++ b/packages/gcc/gcc-3.4.6/zecke-no-host-includes.patch @@ -0,0 +1,32 @@ +Index: gcc-3.4.4/gcc/c-incpath.c +=================================================================== +--- gcc-3.4.4.orig/gcc/c-incpath.c 2004-05-31 12:37:47.000000000 +0200 ++++ gcc-3.4.4/gcc/c-incpath.c 2006-05-15 20:07:31.000000000 +0200 +@@ -328,6 +328,27 @@ + else + heads[chain] = p; + tails[chain] = p; ++ ++ ++#ifdef CROSS_COMPILE ++ /* A common error when cross compiling is including ++ host headers. This code below will try to fail fast ++ for cross compiling. Currently we consider /usr/include, ++ /opt/include and /sw/include as harmful. */ ++ { ++ /* printf("Adding Path: %s\n", p->name ); */ ++ if( strstr(p->name, "/usr/include" ) == p->name ) { ++ fprintf(stderr, _("CROSS COMPILE Badness: /usr/include in INCLUDEPATH: %s\n"), p->name); ++ abort(); ++ } else if( strstr(p->name, "/sw/include") == p->name ) { ++ fprintf(stderr, _("CROSS COMPILE Badness: /sw/include in INCLUDEPATH: %s\n"), p->name); ++ abort(); ++ } else if( strstr(p->name, "/opt/include") == p->name ) { ++ fprintf(stderr, _("CROSS COMPILE Badness: /opt/include in INCLUDEPATH: %s\n"), p->name); ++ abort(); ++ } ++ } ++#endif + } + + /* Exported function to handle include chain merging, duplicate diff --git a/packages/gcc/gcc-3.4.6/zecke-xgcc-cpp.patch b/packages/gcc/gcc-3.4.6/zecke-xgcc-cpp.patch new file mode 100644 index 0000000000..ab6a3fd771 --- /dev/null +++ b/packages/gcc/gcc-3.4.6/zecke-xgcc-cpp.patch @@ -0,0 +1,13 @@ +Index: gcc-3.4.4/Makefile.in +=================================================================== +--- gcc-3.4.4.orig/Makefile.in 2005-05-19 11:58:00.000000000 +0200 ++++ gcc-3.4.4/Makefile.in 2006-08-06 13:08:14.000000000 +0200 +@@ -21964,6 +21964,8 @@ + AS="$(AS_FOR_TARGET)"; export AS; \ + CC="$(CC_FOR_TARGET)"; export CC; \ + CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ ++ CPP="$(CC_FOR_TARGET) -E"; export CCP; \ ++ CPPFLAGS=""; export CPPFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ + CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ + CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ diff --git a/packages/gcc/gcc-4.2.3.inc b/packages/gcc/gcc-4.2.3.inc new file mode 100644 index 0000000000..7726030f20 --- /dev/null +++ b/packages/gcc/gcc-4.2.3.inc @@ -0,0 +1,73 @@ +require gcc-common.inc + +DEPENDS = "mpfr gmp" + +SRC_URI = "ftp://ftp.gnu.org/pub/gnu/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \ + file://100-uclibc-conf.patch;patch=1 \ + file://103-uclibc-conf-noupstream.patch;patch=1 \ + file://200-uclibc-locale.patch;patch=1 \ + file://203-uclibc-locale-no__x.patch;patch=1 \ + file://204-uclibc-locale-wchar_fix.patch;patch=1 \ + file://205-uclibc-locale-update.patch;patch=1 \ + file://300-libstdc++-pic.patch;patch=1 \ + file://301-missing-execinfo_h.patch;patch=1 \ + file://302-c99-snprintf.patch;patch=1 \ + file://303-c99-complex-ugly-hack.patch;patch=1 \ + file://304-index_macro.patch;patch=1 \ + file://305-libmudflap-susv3-legacy.patch;patch=1 \ + file://306-libstdc++-namespace.patch;patch=1 \ + file://307-locale_facets.patch;patch=1 \ + file://402-libbackend_dep_gcov-iov.h.patch;patch=1 \ + file://602-sdk-libstdc++-includes.patch;patch=1 \ + file://740-sh-pr24836.patch;patch=1 \ + file://800-arm-bigendian.patch;patch=1 \ + file://801-arm-bigendian-eabi.patch;patch=1 \ + file://904-flatten-switch-stmt-00.patch;patch=1 \ + file://arm-nolibfloat.patch;patch=1 \ + file://arm-softfloat.patch;patch=1 \ + file://gcc41-configure.in.patch;patch=1 \ + file://arm-thumb.patch;patch=1 \ + file://arm-thumb-cache.patch;patch=1 \ + file://ldflags.patch;patch=1 \ + file://zecke-xgcc-cpp.patch;patch=1 \ + file://unbreak-armv4t.patch;patch=1 \ + file://fix-ICE-in-arm_unwind_emit_set.diff;patch=1 \ + file://cache-amnesia.patch;patch=1 \ + file://gfortran.patch;patch=1 \ + file://gcc-4.0.2-e300c2c3.patch;patch=1 \ + file://fortran-static-linking.patch;patch=1 \ + file://intermask-bigendian.patch;patch=1 \ +" + +SRC_URI_append_ep93xx = " \ + file://arm-crunch-saveregs.patch;patch=1 \ + file://arm-crunch-20000320.patch;patch=1 \ + file://arm-crunch-compare.patch;patch=1 \ + file://arm-crunch-compare-unordered.patch;patch=1 \ + file://arm-crunch-compare-geu.patch;patch=1 \ + file://arm-crunch-eabi-ieee754.patch;patch=1 \ + file://arm-crunch-eabi-ieee754-div.patch;patch=1 \ + file://arm-crunch-64bit-disable0.patch;patch=1 \ + file://arm-crunch-offset.patch;patch=1 \ + file://arm-crunch-fp_consts.patch;patch=1 \ + file://arm-crunch-neg2.patch;patch=1 \ + file://arm-crunch-predicates3.patch;patch=1 \ + file://arm-crunch-cfcvtds-disable.patch;patch=1 \ + file://arm-crunch-floatsi-disable.patch;patch=1 \ + file://arm-crunch-truncsi-disable.patch;patch=1 \ + file://arm-crunch-cfcvt64-disable.patch;patch=1 \ + file://arm-crunch-cirrus-bugfixes.patch;patch=1 \ + " + +PACKAGE_ARCH_ep93xx = "${MACHINE_ARCH}" + +SRC_URI_append_sh3 = " file://sh3-installfix-fixheaders.patch;patch=1 " + +# Language Overrides +FORTRAN = "" +FORTRAN_linux-gnueabi = ",fortran" +JAVA = "" + +EXTRA_OECONF_BASE += " --disable-libssp --disable-bootstrap --disable-libgomp --disable-libmudflap" + +ARM_INSTRUCTION_SET = "arm" diff --git a/packages/gcc/gcc-4.2.3/.mtn2git_empty b/packages/gcc/gcc-4.2.3/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/.mtn2git_empty diff --git a/packages/gcc/gcc-4.2.3/100-uclibc-conf.patch b/packages/gcc/gcc-4.2.3/100-uclibc-conf.patch new file mode 100644 index 0000000000..4243ff7b91 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/100-uclibc-conf.patch @@ -0,0 +1,200 @@ +--- gcc/libgomp/configure ++++ gcc/libgomp/configure +@@ -3771,7 +3771,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +--- gcc/gcc/config/cris/linux.h ++++ gcc/gcc/config/cris/linux.h +@@ -74,7 +74,11 @@ + #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG + + #undef CRIS_SUBTARGET_VERSION +-#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu" ++#if UCLIBC_DEFAULT ++# define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc" ++#else ++# define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu" ++#endif + + #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" + +--- gcc/libstdc++-v3/configure ++++ gcc/libstdc++-v3/configure +@@ -4276,7 +4276,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +--- gcc/zlib/configure ++++ gcc/zlib/configure +@@ -3422,7 +3422,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +--- gcc/libobjc/configure ++++ gcc/libobjc/configure +@@ -3309,7 +3309,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +--- gcc/libgfortran/configure ++++ gcc/libgfortran/configure +@@ -3695,7 +3695,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +--- gcc/libmudflap/configure ++++ gcc/libmudflap/configure +@@ -5378,7 +5378,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +--- gcc/boehm-gc/configure ++++ gcc/boehm-gc/configure +@@ -4316,7 +4316,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +--- gcc/libffi/configure ++++ gcc/libffi/configure +@@ -3453,7 +3453,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +--- gcc/libssp/configure ++++ gcc/libssp/configure +@@ -4409,7 +4409,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +--- gcc/contrib/regression/objs-gcc.sh ++++ gcc/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/libjava/classpath/ltconfig ++++ gcc/libjava/classpath/ltconfig +@@ -603,7 +603,7 @@ + + # Transform linux* to *-*-linux-gnu*, to support old configure scripts. + case $host_os in +-linux-gnu*) ;; ++linux-gnu*|linux-uclibc*) ;; + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` + esac + +@@ -1251,7 +1251,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux*) + version_type=linux + need_lib_prefix=no + need_version=no +--- gcc/libjava/classpath/configure ++++ gcc/libjava/classpath/configure +@@ -4665,7 +4665,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +--- gcc/libjava/configure ++++ gcc/libjava/configure +@@ -5212,7 +5212,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +--- gcc/libtool.m4 ++++ gcc/libtool.m4 +@@ -739,7 +739,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +--- gcc/ltconfig ++++ gcc/ltconfig +@@ -603,7 +603,7 @@ + + # Transform linux* to *-*-linux-gnu*, to support old configure scripts. + case $host_os in +-linux-gnu*) ;; ++linux-gnu*|linux-uclibc*) ;; + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` + esac + +@@ -1251,7 +1251,7 @@ + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux*) + version_type=linux + need_lib_prefix=no + need_version=no diff --git a/packages/gcc/gcc-4.2.3/103-uclibc-conf-noupstream.patch b/packages/gcc/gcc-4.2.3/103-uclibc-conf-noupstream.patch new file mode 100644 index 0000000000..09c9bbecfb --- /dev/null +++ b/packages/gcc/gcc-4.2.3/103-uclibc-conf-noupstream.patch @@ -0,0 +1,11 @@ +--- gcc/gcc/config.gcc.uclibc100-sh~ 2006-03-06 20:46:56 +0100 ++++ gcc/gcc/config.gcc 2006-03-10 15:02:41 +0100 +@@ -1905,7 +1905,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" diff --git a/packages/gcc/gcc-4.2.3/110-arm-eabi.patch b/packages/gcc/gcc-4.2.3/110-arm-eabi.patch new file mode 100644 index 0000000000..acebe5308f --- /dev/null +++ b/packages/gcc/gcc-4.2.3/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/packages/gcc/gcc-4.2.3/200-uclibc-locale.patch b/packages/gcc/gcc-4.2.3/200-uclibc-locale.patch new file mode 100644 index 0000000000..ea21388b75 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/200-uclibc-locale.patch @@ -0,0 +1,2790 @@ +--- gcc/libstdc++-v3/acinclude.m4 ++++ gcc/libstdc++-v3/acinclude.m4 +@@ -1369,7 +1369,7 @@ + AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [ + 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]) + + # Deal with gettext issues. Default to not using it (=no) until we detect + # support for it later. Let the user turn it off via --e/d, but let that +@@ -1385,6 +1385,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> +@@ -1528,6 +1531,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/libstdc++-v3/config/locale/uclibc/c++locale_internal.h ++++ gcc/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, 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 <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/libstdc++-v3/config/locale/uclibc/c_locale.cc ++++ gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc +@@ -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 +--- gcc/libstdc++-v3/config/locale/uclibc/c_locale.h ++++ gcc/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, 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 __attribute__ ((__unused__)), ++ const char* __fmt, ++#ifdef __UCLIBC_HAS_XCLOCALE__ ++ _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_XCLOCALE__ ++ __gnu_cxx::__uselocale(__old); ++#elif defined __UCLIBC_HAS_LOCALE__ ++ std::setlocale(LC_ALL, __sav); ++ delete [] __sav; ++#endif ++ return __ret; ++ } ++} ++ ++#endif +--- gcc/libstdc++-v3/config/locale/uclibc/codecvt_members.cc ++++ gcc/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, 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 ++} +--- gcc/libstdc++-v3/config/locale/uclibc/collate_members.cc ++++ gcc/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, 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 ++} +--- gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc ++++ gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc +@@ -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 ++} +--- gcc/libstdc++-v3/config/locale/uclibc/messages_members.cc ++++ gcc/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, 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 ++} +--- gcc/libstdc++-v3/config/locale/uclibc/messages_members.h ++++ gcc/libstdc++-v3/config/locale/uclibc/messages_members.h +@@ -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); ++ } ++ } +--- gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc ++++ gcc/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, 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... ++ 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 ++} +--- gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc ++++ gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc +@@ -0,0 +1,160 @@ ++// 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. ++ 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; ++ ++ 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/libstdc++-v3/config/locale/uclibc/time_members.cc ++++ gcc/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, 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 ++} +--- gcc/libstdc++-v3/config/locale/uclibc/time_members.h ++++ gcc/libstdc++-v3/config/locale/uclibc/time_members.h +@@ -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); ++ } +--- gcc/libstdc++-v3/configure ++++ gcc/libstdc++-v3/configure +@@ -5764,7 +5764,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; }; } ;; +@@ -5789,6 +5789,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. */ +@@ -6019,6 +6022,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/libstdc++-v3/include/c_compatibility/wchar.h ++++ gcc/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/libstdc++-v3/include/c_std/std_cwchar.h ++++ gcc/libstdc++-v3/include/c_std/std_cwchar.h +@@ -182,7 +182,9 @@ + using ::wcscoll; + using ::wcscpy; + using ::wcscspn; ++#if _GLIBCXX_HAVE_WCSFTIME + using ::wcsftime; ++#endif + using ::wcslen; + using ::wcsncat; + using ::wcsncmp; diff --git a/packages/gcc/gcc-4.2.3/203-uclibc-locale-no__x.patch b/packages/gcc/gcc-4.2.3/203-uclibc-locale-no__x.patch new file mode 100644 index 0000000000..6ba47003b3 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/203-uclibc-locale-no__x.patch @@ -0,0 +1,213 @@ +--- gcc/libstdc++-v3/config/locale/uclibc/c++locale_internal.h.uclibc200no__x~ 2006-03-10 15:06:17 +0100 ++++ gcc/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2006-03-10 15:32:37 +0100 +@@ -60,4 +60,49 @@ + extern "C" __typeof(wctype_l) __wctype_l; + #endif + ++# define __nl_langinfo_l nl_langinfo_l ++# define __strcoll_l strcoll_l ++# define __strftime_l strftime_l ++# define __strtod_l strtod_l ++# define __strtof_l strtof_l ++# define __strtold_l strtold_l ++# define __strxfrm_l strxfrm_l ++# define __newlocale newlocale ++# define __freelocale freelocale ++# define __duplocale duplocale ++# define __uselocale uselocale ++ ++# ifdef _GLIBCXX_USE_WCHAR_T ++# define __iswctype_l iswctype_l ++# define __towlower_l towlower_l ++# define __towupper_l towupper_l ++# define __wcscoll_l wcscoll_l ++# define __wcsftime_l wcsftime_l ++# define __wcsxfrm_l wcsxfrm_l ++# define __wctype_l wctype_l ++# endif ++ ++#else ++# define __nl_langinfo_l(N, L) nl_langinfo((N)) ++# define __strcoll_l(S1, S2, L) strcoll((S1), (S2)) ++# define __strtod_l(S, E, L) strtod((S), (E)) ++# define __strtof_l(S, E, L) strtof((S), (E)) ++# define __strtold_l(S, E, L) strtold((S), (E)) ++# define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N)) ++# warning should dummy __newlocale check for C|POSIX ? ++# define __newlocale(a, b, c) NULL ++# define __freelocale(a) ((void)0) ++# define __duplocale(a) __c_locale() ++//# define __uselocale ? ++// ++# ifdef _GLIBCXX_USE_WCHAR_T ++# define __iswctype_l(C, M, L) iswctype((C), (M)) ++# define __towlower_l(C, L) towlower((C)) ++# define __towupper_l(C, L) towupper((C)) ++# define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2)) ++//# define __wcsftime_l(S, M, F, T, L) wcsftime((S), (M), (F), (T)) ++# define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N)) ++# define __wctype_l(S, L) wctype((S)) ++# endif ++ + #endif // GLIBC 2.3 and later +--- gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100 ++++ gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc 2006-03-10 15:32:37 +0100 +@@ -39,20 +39,6 @@ + #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<> +--- gcc/libstdc++-v3/config/locale/uclibc/collate_members.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100 ++++ gcc/libstdc++-v3/config/locale/uclibc/collate_members.cc 2006-03-10 15:32:37 +0100 +@@ -36,13 +36,6 @@ + #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 +--- gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100 ++++ gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2006-03-10 15:32:37 +0100 +@@ -43,10 +43,6 @@ + #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: +--- gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100 ++++ gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2006-03-10 15:32:37 +0100 +@@ -41,9 +41,6 @@ + #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 + { +--- gcc/libstdc++-v3/config/locale/uclibc/time_members.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100 ++++ gcc/libstdc++-v3/config/locale/uclibc/time_members.cc 2006-03-10 15:32:37 +0100 +@@ -40,9 +40,6 @@ + #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 + { +--- gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100 ++++ gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2006-03-10 15:32:37 +0100 +@@ -38,13 +38,6 @@ + #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 +--- gcc/libstdc++-v3/config/locale/uclibc/messages_members.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100 ++++ gcc/libstdc++-v3/config/locale/uclibc/messages_members.cc 2006-03-10 15:32:37 +0100 +@@ -39,13 +39,10 @@ + #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) ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#define gettext(msgid) dcgettext(NULL, msgid, LC_MESSAGES) + #else +-#undef gettext + #define gettext(msgid) (msgid) + #endif + +--- gcc/libstdc++-v3/config/locale/uclibc/messages_members.h.uclibc200no__x~ 2006-03-10 15:06:17 +0100 ++++ gcc/libstdc++-v3/config/locale/uclibc/messages_members.h 2006-03-10 15:32:37 +0100 +@@ -36,15 +36,11 @@ + #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) ++#ifndef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#undef textdomain ++#undef bindtextdomain ++#define textdomain(D) ((void)0) ++#define bindtextdomain(D,P) ((void)0) + #endif + + // Non-virtual member functions. +@@ -70,7 +66,7 @@ + messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, + const char* __dir) const + { +- __bindtextdomain(__s.c_str(), __dir); ++ bindtextdomain(__s.c_str(), __dir); + return this->do_open(__s, __loc); + } + +@@ -90,7 +86,7 @@ + { + // No error checking is done, assume the catalog exists and can + // be used. +- __textdomain(__s.c_str()); ++ textdomain(__s.c_str()); + return 0; + } + +--- gcc/libstdc++-v3/config/locale/uclibc/c_locale.h.uclibc200no__x~ 2006-03-10 15:06:17 +0100 ++++ gcc/libstdc++-v3/config/locale/uclibc/c_locale.h 2006-03-10 15:32:37 +0100 +@@ -68,6 +68,7 @@ + { + extern "C" __typeof(uselocale) __uselocale; + } ++#define __uselocale uselocale + #endif + + namespace std diff --git a/packages/gcc/gcc-4.2.3/204-uclibc-locale-wchar_fix.patch b/packages/gcc/gcc-4.2.3/204-uclibc-locale-wchar_fix.patch new file mode 100644 index 0000000000..160ab35bb3 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/204-uclibc-locale-wchar_fix.patch @@ -0,0 +1,48 @@ +--- gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc.uclibc200_wchar~ 2006-03-10 15:32:37 +0100 ++++ gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2006-03-10 15:37:27 +0100 +@@ -401,7 +401,7 @@ + # ifdef __UCLIBC_HAS_XLOCALE__ + _M_data->_M_decimal_point = __cloc->decimal_point_wc; + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; +-# else ++# 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 +@@ -556,7 +556,7 @@ + # ifdef __UCLIBC_HAS_XLOCALE__ + _M_data->_M_decimal_point = __cloc->decimal_point_wc; + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; +-# else ++# 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 +--- gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc.uclibc200_wchar~ 2006-03-10 15:32:37 +0100 ++++ gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2006-03-10 15:37:27 +0100 +@@ -127,12 +127,25 @@ + { + // Named locale. + // NB: In the GNU model wchar_t is always 32 bit wide. ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this... should be numeric ++#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 = ""; diff --git a/packages/gcc/gcc-4.2.3/205-uclibc-locale-update.patch b/packages/gcc/gcc-4.2.3/205-uclibc-locale-update.patch new file mode 100644 index 0000000000..86b2844554 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/205-uclibc-locale-update.patch @@ -0,0 +1,347 @@ +--- gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc.uclibc200_update~ 2006-03-10 15:32:37 +0100 ++++ gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc 2006-03-10 15:39:14 +0100 +@@ -46,16 +47,13 @@ + __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; +- } ++ char* __sanity; ++ errno = 0; ++ float __f = __strtof_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __f; ++ else ++ __err |= ios_base::failbit; + } + + template<> +@@ -63,16 +61,13 @@ + __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; +- } ++ char* __sanity; ++ errno = 0; ++ double __d = __strtod_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __d; ++ else ++ __err |= ios_base::failbit; + } + + template<> +@@ -80,16 +75,13 @@ + __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; +- } ++ 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 +@@ -110,7 +102,7 @@ + void + locale::facet::_S_destroy_c_locale(__c_locale& __cloc) + { +- if (_S_get_c_locale() != __cloc) ++ if (__cloc && _S_get_c_locale() != __cloc) + __freelocale(__cloc); + } + +--- gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc.uclibc200_update~ 2006-03-10 15:32:37 +0100 ++++ gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2006-03-10 15:39:14 +0100 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik <bkoz@redhat.com> + ++#include <features.h> ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include <locale> + #undef _LIBC ++#else ++#include <locale> ++#endif + #include <bits/c++locale_internal.h> + + namespace std +@@ -138,20 +143,34 @@ + ctype<wchar_t>:: + do_is(mask __m, wchar_t __c) const + { +- // Highest bitmask in ctype_base == 10, but extra in "C" +- // library for blank. ++ // 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; +- 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; +- } ++ 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 +--- gcc/libstdc++-v3/config/locale/uclibc/messages_members.h.uclibc200_update~ 2006-03-10 15:32:37 +0100 ++++ gcc/libstdc++-v3/config/locale/uclibc/messages_members.h 2006-03-10 15:39:14 +0100 +@@ -47,18 +47,21 @@ + 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()) ++ _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) ++ : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL) + { +- char* __tmp = new char[std::strlen(__s) + 1]; +- std::strcpy(__tmp, __s); ++ 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> +--- gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc.uclibc200_update~ 2006-03-10 15:37:27 +0100 ++++ gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2006-03-10 15:39:14 +0100 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik <bkoz@redhat.com> + ++#include <features.h> ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include <locale> + #undef _LIBC ++#else ++#include <locale> ++#endif + #include <bits/c++locale_internal.h> + + #ifdef __UCLIBC_MJN3_ONLY__ +@@ -206,7 +211,7 @@ + } + break; + default: +- ; ++ __ret = pattern(); + } + return __ret; + } +--- gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc.uclibc200_update~ 2006-03-10 15:37:27 +0100 ++++ gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2006-03-10 15:39:14 +0100 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik <bkoz@redhat.com> + ++#include <features.h> ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include <locale> + #undef _LIBC ++#else ++#include <locale> ++#endif + #include <bits/c++locale_internal.h> + + #ifdef __UCLIBC_MJN3_ONLY__ +--- gcc/libstdc++-v3/config/locale/uclibc/time_members.h.uclibc200_update~ 2006-03-10 15:06:17 +0100 ++++ gcc/libstdc++-v3/config/locale/uclibc/time_members.h 2006-03-10 15:39:14 +0100 +@@ -37,25 +37,33 @@ + 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_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_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) ++ _M_name_timepunct(NULL) + { +- char* __tmp = new char[std::strlen(__s) + 1]; +- std::strcpy(__tmp, __s); ++ const size_t __len = std::strlen(__s) + 1; ++ char* __tmp = new char[__len]; ++ std::memcpy(__tmp, __s, __len); + _M_name_timepunct = __tmp; +- _M_initialize_timepunct(__cloc); ++ ++ try ++ { _M_initialize_timepunct(__cloc); } ++ catch(...) ++ { ++ delete [] _M_name_timepunct; ++ __throw_exception_again; ++ } + } + + template<typename _CharT> +--- gcc-4.2/libstdc++-v3/config/locale/uclibc/c_locale.h.old 2006-09-28 11:39:00.000000000 +0200 ++++ gcc-4.2/libstdc++-v3/config/locale/uclibc/c_locale.h 2006-09-28 12:10:41.000000000 +0200 +@@ -39,21 +39,23 @@ + #pragma GCC system_header + + #include <cstring> // get std::strlen +-#include <cstdio> // get std::snprintf or std::sprintf ++#include <cstdio> // get std::vsnprintf or std::vsprintf + #include <clocale> + #include <langinfo.h> // For codecvt + #ifdef __UCLIBC_MJN3_ONLY__ + #warning fix this + #endif +-#ifdef __UCLIBC_HAS_LOCALE__ ++#ifdef _GLIBCXX_USE_ICONV + #include <iconv.h> // For codecvt using iconv, iconv_t + #endif +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ +-#include <libintl.h> // For messages ++#ifdef HAVE_LIBINTL_H ++#include <libintl.h> // For messages + #endif ++#include <cstdarg> + + #ifdef __UCLIBC_MJN3_ONLY__ + #warning what is _GLIBCXX_C_LOCALE_GNU for ++// psm: used in os/gnu-linux/ctype_noninline.h + #endif + #define _GLIBCXX_C_LOCALE_GNU 1 + +@@ -62,7 +64,7 @@ + #endif + // #define _GLIBCXX_NUM_CATEGORIES 6 + #define _GLIBCXX_NUM_CATEGORIES 0 +- ++ + #ifdef __UCLIBC_HAS_XLOCALE__ + namespace __gnu_cxx + { +@@ -79,22 +81,24 @@ + 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 ++ // Convert numeric value of type double to string and return length of ++ // string. If vsnprintf is available use it, otherwise fall back to ++ // the unsafe vsprintf 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_XCLOCALE__ +- _Tv __v, const __c_locale& __cloc, int __prec) ++ inline int ++ __convert_from_v(const __c_locale& ++#ifndef __UCLIBC_HAS_XCLOCALE__ ++ __cloc __attribute__ ((__unused__)) ++#endif ++ , ++ char* __out, ++ const int __size, ++ const char* __fmt, ...) + { ++ va_list __args; ++#ifdef __UCLIBC_HAS_XCLOCALE__ + __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]; +@@ -103,7 +107,9 @@ + # endif + #endif + +- const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v); ++ va_start(__args, __fmt); ++ const int __ret = std::vsnprintf(__out, __size, __fmt, __args); ++ va_end(__args); + + #ifdef __UCLIBC_HAS_XCLOCALE__ + __gnu_cxx::__uselocale(__old); diff --git a/packages/gcc/gcc-4.2.3/300-libstdc++-pic.patch b/packages/gcc/gcc-4.2.3/300-libstdc++-pic.patch new file mode 100644 index 0000000000..89d03a85e5 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/300-libstdc++-pic.patch @@ -0,0 +1,46 @@ +# DP: Build and install libstdc++_pic.a library. + +--- gcc-4.1.0/libstdc++-v3/src/Makefile.am 2004-11-15 17:33:05.000000000 -0600 ++++ gcc-4.1.0-patched/libstdc++-v3/src/Makefile.am 2005-04-25 20:05:59.186930896 -0500 +@@ -214,6 +214,10 @@ + $(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 + all-local: build_debug +--- gcc-4.1.0/libstdc++-v3/src/Makefile.in 2005-04-11 19:13:08.000000000 -0500 ++++ gcc-4.1.0-patched/libstdc++-v3/src/Makefile.in 2005-04-25 20:12:33.284316275 -0500 +@@ -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 \ +@@ -745,6 +746,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: diff --git a/packages/gcc/gcc-4.2.3/301-missing-execinfo_h.patch b/packages/gcc/gcc-4.2.3/301-missing-execinfo_h.patch new file mode 100644 index 0000000000..0e2092f3fb --- /dev/null +++ b/packages/gcc/gcc-4.2.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/packages/gcc/gcc-4.2.3/302-c99-snprintf.patch b/packages/gcc/gcc-4.2.3/302-c99-snprintf.patch new file mode 100644 index 0000000000..dfb22d681b --- /dev/null +++ b/packages/gcc/gcc-4.2.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/packages/gcc/gcc-4.2.3/303-c99-complex-ugly-hack.patch b/packages/gcc/gcc-4.2.3/303-c99-complex-ugly-hack.patch new file mode 100644 index 0000000000..2ccc80d9bb --- /dev/null +++ b/packages/gcc/gcc-4.2.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/packages/gcc/gcc-4.2.3/304-index_macro.patch b/packages/gcc/gcc-4.2.3/304-index_macro.patch new file mode 100644 index 0000000000..d8e476555d --- /dev/null +++ b/packages/gcc/gcc-4.2.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 ++ + _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + + using std::size_t; diff --git a/packages/gcc/gcc-4.2.3/305-libmudflap-susv3-legacy.patch b/packages/gcc/gcc-4.2.3/305-libmudflap-susv3-legacy.patch new file mode 100644 index 0000000000..374b1f8659 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/305-libmudflap-susv3-legacy.patch @@ -0,0 +1,49 @@ +Index: gcc-4.2/libmudflap/mf-hooks2.c +=================================================================== +--- gcc-4.2/libmudflap/mf-hooks2.c (revision 119834) ++++ gcc-4.2/libmudflap/mf-hooks2.c (working copy) +@@ -427,7 +427,7 @@ + { + TRACE ("%s\n", __PRETTY_FUNCTION__); + MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region"); +- bzero (s, n); ++ memset (s, 0, n); + } + + +@@ -437,7 +437,7 @@ + TRACE ("%s\n", __PRETTY_FUNCTION__); + MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src"); + MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest"); +- bcopy (src, dest, n); ++ memmove (dest, src, n); + } + + +@@ -447,7 +447,7 @@ + TRACE ("%s\n", __PRETTY_FUNCTION__); + MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg"); + MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg"); +- return bcmp (s1, s2, n); ++ return n == 0 ? 0 : memcmp (s1, s2, n); + } + + +@@ -456,7 +456,7 @@ + size_t n = strlen (s); + TRACE ("%s\n", __PRETTY_FUNCTION__); + MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region"); +- return index (s, c); ++ return strchr (s, c); + } + + +@@ -465,7 +465,7 @@ + size_t n = strlen (s); + TRACE ("%s\n", __PRETTY_FUNCTION__); + MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region"); +- return rindex (s, c); ++ return strrchr (s, c); + } + + /* XXX: stpcpy, memccpy */ diff --git a/packages/gcc/gcc-4.2.3/306-libstdc++-namespace.patch b/packages/gcc/gcc-4.2.3/306-libstdc++-namespace.patch new file mode 100644 index 0000000000..69587ca63a --- /dev/null +++ b/packages/gcc/gcc-4.2.3/306-libstdc++-namespace.patch @@ -0,0 +1,36 @@ +diff -rup gcc-4.2.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.2.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2006-12-22 13:06:56.000000000 +0100 ++++ gcc-4.2/libstdc++-v3/config/locale/uclibc/messages_members.h 2006-12-22 15:23:41.000000000 +0100 +@@ -32,7 +32,8 @@ + // + + // Written by Benjamin Kosnik <bkoz@redhat.com> +- ++namespace std ++{ + #ifdef __UCLIBC_MJN3_ONLY__ + #warning fix prototypes for *textdomain funcs + #endif +@@ -115,3 +116,4 @@ + this->_S_create_c_locale(this->_M_c_locale_messages, __s); + } + } ++} +diff -rup gcc-4.2.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.2.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2006-12-22 13:06:56.000000000 +0100 ++++ gcc-4.2/libstdc++-v3/config/locale/uclibc/time_members.h 2006-12-22 15:20:31.000000000 +0100 +@@ -33,7 +33,8 @@ + // + + // Written by Benjamin Kosnik <bkoz@redhat.com> +- ++namespace std ++{ + template<typename _CharT> + __timepunct<_CharT>::__timepunct(size_t __refs) + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), +@@ -74,3 +75,4 @@ + delete _M_data; + _S_destroy_c_locale(_M_c_locale_timepunct); + } ++} diff --git a/packages/gcc/gcc-4.2.3/307-locale_facets.patch b/packages/gcc/gcc-4.2.3/307-locale_facets.patch new file mode 100644 index 0000000000..412f8657dc --- /dev/null +++ b/packages/gcc/gcc-4.2.3/307-locale_facets.patch @@ -0,0 +1,26 @@ +This patch fixes a bug into ostream::operator<<(double) due to the wrong size +passed into the __convert_from_v method. The wrong size is then passed to +std::snprintf function, that, on uClibc, doens't handle sized 0 buffer. + +Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com> + +--- gcc-4.2.1/libstdc++-v3/include/bits/locale_facets.tcc 2006-10-17 18:43:47.000000000 +0200 ++++ gcc-4.2.1-st/libstdc++-v3/include/bits/locale_facets.tcc 2007-08-22 18:54:23.000000000 +0200 +@@ -1143,7 +1143,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE + const int __cs_size = __fixed ? __max_exp + __prec + 4 + : __max_digits * 2 + __prec; + char* __cs = static_cast<char*>(__builtin_alloca(__cs_size)); +- __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, __fbuf, ++ __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, __fbuf, + __prec, __v); + #endif + +@@ -1777,7 +1777,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE + // max_exponent10 + 1 for the integer part, + 2 for sign and '\0'. + const int __cs_size = numeric_limits<long double>::max_exponent10 + 3; + char* __cs = static_cast<char*>(__builtin_alloca(__cs_size)); +- int __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, "%.*Lf", ++ int __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, "%.*Lf", + 0, __units); + #endif + string_type __digits(__len, char_type()); diff --git a/packages/gcc/gcc-4.2.3/402-libbackend_dep_gcov-iov.h.patch b/packages/gcc/gcc-4.2.3/402-libbackend_dep_gcov-iov.h.patch new file mode 100644 index 0000000000..0bf115c45d --- /dev/null +++ b/packages/gcc/gcc-4.2.3/402-libbackend_dep_gcov-iov.h.patch @@ -0,0 +1,13 @@ +Index: gcc-4.2/gcc/Makefile.in +=================================================================== +--- gcc-4.2/gcc/Makefile.in (revision 121758) ++++ gcc-4.2/gcc/Makefile.in (working copy) +@@ -2658,7 +2658,7 @@ mips-tdump.o : mips-tdump.c $(CONFIG_H) + # 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/packages/gcc/gcc-4.2.3/602-sdk-libstdc++-includes.patch b/packages/gcc/gcc-4.2.3/602-sdk-libstdc++-includes.patch new file mode 100644 index 0000000000..23fce7544d --- /dev/null +++ b/packages/gcc/gcc-4.2.3/602-sdk-libstdc++-includes.patch @@ -0,0 +1,20 @@ +--- gcc-4.1.0/libstdc++-v3/fragment.am 2005-03-21 11:40:14.000000000 -0600 ++++ gcc-4.1.0-patched/libstdc++-v3/fragment.am 2005-04-25 20:14:39.856251785 -0500 +@@ -21,5 +21,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 + +--- gcc-4.1.0/libstdc++-v3/libmath/Makefile.am 2005-03-21 11:40:18.000000000 -0600 ++++ gcc-4.1.0-patched/libstdc++-v3/libmath/Makefile.am 2005-04-25 20:14:39.682280735 -0500 +@@ -35,7 +35,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/packages/gcc/gcc-4.2.3/740-sh-pr24836.patch b/packages/gcc/gcc-4.2.3/740-sh-pr24836.patch new file mode 100644 index 0000000000..7992282cff --- /dev/null +++ b/packages/gcc/gcc-4.2.3/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/packages/gcc/gcc-4.2.3/800-arm-bigendian.patch b/packages/gcc/gcc-4.2.3/800-arm-bigendian.patch new file mode 100644 index 0000000000..07c6093379 --- /dev/null +++ b/packages/gcc/gcc-4.2.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.2.0/gcc/config/arm/linux-elf.h ++++ gcc-4.2.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_DYNAMIC_LINKER "} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #undef LINK_SPEC +--- gcc-4.2.0/gcc/config.gcc.orig 2006-09-22 14:53:41.000000000 +0200 ++++ gcc-4.2.0/gcc/config.gcc 2006-09-25 10:45:21.000000000 +0200 +@@ -696,6 +696,11 @@ + 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*b-*) ++ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" ++ ;; ++ esac ++ case ${target} in + arm*-*-linux-*eabi) + 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" diff --git a/packages/gcc/gcc-4.2.3/801-arm-bigendian-eabi.patch b/packages/gcc/gcc-4.2.3/801-arm-bigendian-eabi.patch new file mode 100644 index 0000000000..54490fc24f --- /dev/null +++ b/packages/gcc/gcc-4.2.3/801-arm-bigendian-eabi.patch @@ -0,0 +1,14 @@ +Index: gcc-4.1.1/gcc/config/arm/linux-eabi.h +=================================================================== +--- gcc-4.1.1.orig/gcc/config/arm/linux-eabi.h 2007-02-20 14:51:33.416193250 +0100 ++++ gcc-4.1.1/gcc/config/arm/linux-eabi.h 2007-02-20 14:52:11.622581000 +0100 +@@ -48,7 +48,8 @@ + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi + + #undef SUBTARGET_EXTRA_LINK_SPEC +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi" ++#define SUBTARGET_EXTRA_LINK_SPEC \ ++ " %{mbig-endian:-m armelfb_linux_eabi} %{mlittle-endian:-m armelf_linux_eabi} " + + /* Use ld-linux.so.3 so that it will be possible to run "classic" + GNU/Linux binaries on an EABI system. */ diff --git a/packages/gcc/gcc-4.2.3/904-flatten-switch-stmt-00.patch b/packages/gcc/gcc-4.2.3/904-flatten-switch-stmt-00.patch new file mode 100644 index 0000000000..8fac37c4df --- /dev/null +++ b/packages/gcc/gcc-4.2.3/904-flatten-switch-stmt-00.patch @@ -0,0 +1,153 @@ +Hi, + +The attached patch makes sure that we create smaller object code for +simple switch statements. We just make sure to flatten the switch +statement into an if-else chain, basically. + +This fixes a size-regression as compared to gcc-3.4, as can be seen +below. + +2007-04-15 Bernhard Fischer <..> + + * stmt.c (expand_case): Do not create a complex binary tree when + optimizing for size but rather use the simple ordered list. + (emit_case_nodes): do not emit jumps to the default_label when + optimizing for size. + +Not regtested so far. +Comments? + +Attached is the test switch.c mentioned below. + +$ for i in 2.95 3.3 3.4 4.0 4.1 4.2.orig-HEAD 4.3.orig-HEAD 4.3-HEAD;do +gcc-$i -DCHAIN -Os -o switch-CHAIN-$i.o -c switch.c ;done +$ for i in 2.95 3.3 3.4 4.0 4.1 4.2.orig-HEAD 4.3.orig-HEAD 4.3-HEAD;do +gcc-$i -UCHAIN -Os -o switch-$i.o -c switch.c ;done + +$ size switch-*.o + text data bss dec hex filename + 169 0 0 169 a9 switch-2.95.o + 115 0 0 115 73 switch-3.3.o + 103 0 0 103 67 switch-3.4.o + 124 0 0 124 7c switch-4.0.o + 124 0 0 124 7c switch-4.1.o + 124 0 0 124 7c switch-4.2.orig-HEAD.o + 95 0 0 95 5f switch-4.3-HEAD.o + 124 0 0 124 7c switch-4.3.orig-HEAD.o + 166 0 0 166 a6 switch-CHAIN-2.95.o + 111 0 0 111 6f switch-CHAIN-3.3.o + 95 0 0 95 5f switch-CHAIN-3.4.o + 95 0 0 95 5f switch-CHAIN-4.0.o + 95 0 0 95 5f switch-CHAIN-4.1.o + 95 0 0 95 5f switch-CHAIN-4.2.orig-HEAD.o + 95 0 0 95 5f switch-CHAIN-4.3-HEAD.o + 95 0 0 95 5f switch-CHAIN-4.3.orig-HEAD.o + + +Content-Type: text/x-diff; charset=us-ascii +Content-Disposition: attachment; filename="gcc-4.3.gcc-flatten-switch-stmt.00.diff" + +Index: gcc-4.2.0/gcc/stmt.c +=================================================================== +--- gcc-4.2.0.orig/gcc/stmt.c (revision 123843) ++++ gcc-4.2.0/gcc/stmt.c (working copy) +@@ -2517,7 +2517,11 @@ expand_case (tree exp) + use_cost_table + = (TREE_CODE (orig_type) != ENUMERAL_TYPE + && estimate_case_costs (case_list)); +- balance_case_nodes (&case_list, NULL); ++ /* When optimizing for size, we want a straight list to avoid ++ jumps as much as possible. This basically creates an if-else ++ chain. */ ++ if (!optimize_size) ++ balance_case_nodes (&case_list, NULL); + emit_case_nodes (index, case_list, default_label, index_type); + emit_jump (default_label); + } +@@ -3075,6 +3079,7 @@ emit_case_nodes (rtx index, case_node_pt + { + if (!node_has_low_bound (node, index_type)) + { ++ if (!optimize_size) /* don't jl to the .default_label. */ + emit_cmp_and_jump_insns (index, + convert_modes + (mode, imode, + + +Content-Type: text/x-csrc; charset=us-ascii +Content-Disposition: attachment; filename="switch.c" + +int +commutative_tree_code (int code) +{ +#define CASE(val, ret) case val:/* __asm__("# val="#val ",ret="#ret);*/ return ret; +#ifndef CHAIN + switch (code) + { +# if 1 + CASE(1,3) + CASE(3,2) + CASE(5,8) + CASE(7,1) + CASE(33,4) + CASE(44,9) + CASE(55,10) + CASE(66,-1) + CASE(77,99) + CASE(666,0) +# else + case 1: + return 3; + case 3: + return 2; + case 5: + return 8; + case 7: + return 1; + case 33: + return 4; + case 44: + return 9; + case 55: + return 10; + case 66: + return -1; + case 77: + return 99; + case 666: + return 0; +# endif + default: + break; + } + return 4711; + +#else + if (code == 1) + return 3; + else if (code == 3) + return 2; + else if (code == 5) + return 8; + else if (code == 7) + return 1; + else if (code == 33) + return 4; + else if (code == 44) + return 9; + else if (code == 55) + return 10; + else if (code == 66) + return -1; + else if (code == 77) + return 99; + else if (code == 666) + return 0; + else + return 4711; +#endif +} + + +--AhhlLboLdkugWU4S-- + diff --git a/packages/gcc/gcc-4.2.3/README b/packages/gcc/gcc-4.2.3/README new file mode 100644 index 0000000000..b85840dc20 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/README @@ -0,0 +1,4 @@ +The numbered patches come from +http://www.uclibc.org/cgi-bin/viewcvs.cgi/trunk/buildroot/toolchain/gcc/4.1.1/ +Other patches are locally added to fix things (mostly inherited and reapplied +from gcc 3.4.4 where applicable) diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-20000320.patch b/packages/gcc/gcc-4.2.3/arm-crunch-20000320.patch new file mode 100644 index 0000000000..3fb0da7670 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-20000320.patch @@ -0,0 +1,11 @@ +--- gcc-4.1.2/gcc/testsuite/gcc.c-torture/execute/ieee/20000320-1.c.original 2007-06-07 16:33:44.000000000 +1000 ++++ gcc-4.1.2/gcc/testsuite/gcc.c-torture/execute/ieee/20000320-1.c 2007-06-07 16:34:05.000000000 +1000 +@@ -49,7 +49,7 @@ + exit (0); + + c(0x3690000000000000ULL, 0x00000000U); +-#if (defined __arm__ || defined __thumb__) && ! (defined __ARMEB__ || defined __VFP_FP__) ++#if (defined __arm__ || defined __thumb__) && ! (defined __ARMEB__ || defined __VFP_FP__) && ! (defined __MAVERICK__) + /* The ARM always stores FP numbers in big-wordian format, + even when running in little-byteian mode. */ + c(0x0000000136900000ULL, 0x00000001U); diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-32bit-disable.patch b/packages/gcc/gcc-4.2.3/arm-crunch-32bit-disable.patch new file mode 100644 index 0000000000..88eaee322d --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-32bit-disable.patch @@ -0,0 +1,85 @@ +--- gcc-4.1.2/gcc/config/arm/cirrus.md-integer 2007-06-15 09:01:37.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/cirrus.md 2007-06-15 09:04:45.000000000 +1000 +@@ -149,7 +149,7 @@ + (match_operand:SI 1 "cirrus_fp_register" "0") + (mult:SI (match_operand:SI 2 "cirrus_fp_register" "v") + (match_operand:SI 3 "cirrus_fp_register" "v"))))] +- "0 && TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "0 && TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfmsc32%?\\t%V0, %V2, %V3" + [(set_attr "type" "mav_farith") + (set_attr "cirrus" "normal")] +@@ -305,7 +305,7 @@ + [(set (match_operand:SF 0 "cirrus_fp_register" "=v") + (float:SF (match_operand:SI 1 "s_register_operand" "r"))) + (clobber (match_scratch:DF 2 "=v"))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfmv64lr%?\\t%Z2, %1\;cfcvt32s%?\\t%V0, %Y2" + [(set_attr "length" "8") + (set_attr "cirrus" "move")] +@@ -315,7 +315,7 @@ + [(set (match_operand:DF 0 "cirrus_fp_register" "=v") + (float:DF (match_operand:SI 1 "s_register_operand" "r"))) + (clobber (match_scratch:DF 2 "=v"))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfmv64lr%?\\t%Z2, %1\;cfcvt32d%?\\t%V0, %Y2" + [(set_attr "length" "8") + (set_attr "cirrus" "move")] +@@ -339,7 +339,7 @@ + [(set (match_operand:SI 0 "s_register_operand" "=r") + (fix:SI (fix:SF (match_operand:SF 1 "cirrus_fp_register" "v")))) + (clobber (match_scratch:DF 2 "=v"))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cftruncs32%?\\t%Y2, %V1\;cfmvr64l%?\\t%0, %Z2" + [(set_attr "length" "8") + (set_attr "cirrus" "normal")] +@@ -349,7 +349,7 @@ + [(set (match_operand:SI 0 "s_register_operand" "=r") + (fix:SI (fix:DF (match_operand:DF 1 "cirrus_fp_register" "v")))) + (clobber (match_scratch:DF 2 "=v"))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cftruncd32%?\\t%Y2, %V1\;cfmvr64l%?\\t%0, %Z2" + [(set_attr "length" "8") + (set_attr "cirrus" "normal")] +--- gcc-4.1.2/gcc/config/arm/arm.md-trunc 2007-06-15 10:56:13.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-15 11:01:22.000000000 +1000 +@@ -3130,7 +3130,7 @@ + (float:SF (match_operand:SI 1 "s_register_operand" "")))] + "TARGET_ARM && TARGET_HARD_FLOAT" + " +- if (TARGET_MAVERICK) ++ if (TARGET_MAVERICK && 0) + { + emit_insn (gen_cirrus_floatsisf2 (operands[0], operands[1])); + DONE; +@@ -3142,7 +3142,7 @@ + (float:DF (match_operand:SI 1 "s_register_operand" "")))] + "TARGET_ARM && TARGET_HARD_FLOAT" + " +- if (TARGET_MAVERICK) ++ if (TARGET_MAVERICK && 0) + { + emit_insn (gen_cirrus_floatsidf2 (operands[0], operands[1])); + DONE; +@@ -3154,7 +3154,7 @@ + (fix:SI (fix:SF (match_operand:SF 1 "s_register_operand" ""))))] + "TARGET_ARM && TARGET_HARD_FLOAT" + " +- if (TARGET_MAVERICK) ++ if (TARGET_MAVERICK && 0) + { + if (!cirrus_fp_register (operands[0], SImode)) + operands[0] = force_reg (SImode, operands[0]); +@@ -3170,7 +3170,7 @@ + (fix:SI (fix:DF (match_operand:DF 1 "s_register_operand" ""))))] + "TARGET_ARM && TARGET_HARD_FLOAT" + " +- if (TARGET_MAVERICK) ++ if (TARGET_MAVERICK && 0) + { + if (!cirrus_fp_register (operands[1], DFmode)) + operands[1] = force_reg (DFmode, operands[0]); diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-64bit-disable-4.2.0.patch b/packages/gcc/gcc-4.2.3/arm-crunch-64bit-disable-4.2.0.patch new file mode 100644 index 0000000000..60b17852bd --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-64bit-disable-4.2.0.patch @@ -0,0 +1,169 @@ +--- gcc-4.1.2/gcc/config/arm/cirrus.md-integer 2007-06-15 09:01:37.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/cirrus.md 2007-06-15 09:04:45.000000000 +1000 +@@ -34,7 +34,7 @@ + [(set (match_operand:DI 0 "cirrus_fp_register" "=v") + (plus:DI (match_operand:DI 1 "cirrus_fp_register" "v") + (match_operand:DI 2 "cirrus_fp_register" "v")))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfadd64%?\\t%V0, %V1, %V2" + [(set_attr "type" "mav_farith") + (set_attr "cirrus" "normal")] +@@ -74,7 +74,7 @@ + [(set (match_operand:DI 0 "cirrus_fp_register" "=v") + (minus:DI (match_operand:DI 1 "cirrus_fp_register" "v") + (match_operand:DI 2 "cirrus_fp_register" "v")))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfsub64%?\\t%V0, %V1, %V2" + [(set_attr "type" "mav_farith") + (set_attr "cirrus" "normal")] +@@ -124,7 +124,7 @@ + [(set (match_operand:DI 0 "cirrus_fp_register" "=v") + (mult:DI (match_operand:DI 2 "cirrus_fp_register" "v") + (match_operand:DI 1 "cirrus_fp_register" "v")))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfmul64%?\\t%V0, %V1, %V2" + [(set_attr "type" "mav_dmult") + (set_attr "cirrus" "normal")] +@@ -206,7 +206,7 @@ + [(set (match_operand:DI 0 "cirrus_fp_register" "=v") + (ashift:DI (match_operand:DI 1 "cirrus_fp_register" "v") + (match_operand:SI 2 "register_operand" "r")))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfrshl64%?\\t%V1, %V0, %s2" + [(set_attr "cirrus" "normal")] + ) +@@ -215,7 +215,7 @@ + [(set (match_operand:DI 0 "cirrus_fp_register" "=v") + (ashift:DI (match_operand:DI 1 "cirrus_fp_register" "v") + (match_operand:SI 2 "cirrus_shift_const" "")))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfsh64%?\\t%V0, %V1, #%s2" + [(set_attr "cirrus" "normal")] + ) +@@ -224,7 +224,7 @@ + [(set (match_operand:DI 0 "cirrus_fp_register" "=v") + (ashiftrt:DI (match_operand:DI 1 "cirrus_fp_register" "v") + (match_operand:SI 2 "cirrus_shift_const" "")))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfsh64%?\\t%V0, %V1, #-%s2" + [(set_attr "cirrus" "normal")] + ) +@@ -232,7 +232,7 @@ + (define_insn "*cirrus_absdi2" + [(set (match_operand:DI 0 "cirrus_fp_register" "=v") + (abs:DI (match_operand:DI 1 "cirrus_fp_register" "v")))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfabs64%?\\t%V0, %V1" + [(set_attr "cirrus" "normal")] + ) +@@ -238,11 +238,12 @@ + ) + + ;; This doesn't really clobber ``cc''. Fixme: aldyh. ++;; maybe buggy? + (define_insn "*cirrus_negdi2" + [(set (match_operand:DI 0 "cirrus_fp_register" "=v") + (neg:DI (match_operand:DI 1 "cirrus_fp_register" "v"))) + (clobber (reg:CC CC_REGNUM))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfneg64%?\\t%V0, %V1" + [(set_attr "cirrus" "normal")] + ) +@@ -324,14 +324,14 @@ + (define_insn "floatdisf2" + [(set (match_operand:SF 0 "cirrus_fp_register" "=v") + (float:SF (match_operand:DI 1 "cirrus_fp_register" "v")))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfcvt64s%?\\t%V0, %V1" + [(set_attr "cirrus" "normal")]) + + (define_insn "floatdidf2" + [(set (match_operand:DF 0 "cirrus_fp_register" "=v") + (float:DF (match_operand:DI 1 "cirrus_fp_register" "v")))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfcvt64d%?\\t%V0, %V1" + [(set_attr "cirrus" "normal")]) + +@@ -376,7 +376,7 @@ + (define_insn "*cirrus_arm_movdi" + [(set (match_operand:DI 0 "nonimmediate_di_operand" "=r,r,o<>,v,r,v,m,v") + (match_operand:DI 1 "di_operand" "rIK,mi,r,r,v,mi,v,v"))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "* + { + switch (which_alternative) +--- gcc-4.1.2/gcc/config/arm/arm.md-64 2007-06-15 11:37:42.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-15 11:40:45.000000000 +1000 +@@ -357,7 +357,7 @@ + (clobber (reg:CC CC_REGNUM))])] + "TARGET_EITHER" + " +- if (TARGET_HARD_FLOAT && TARGET_MAVERICK) ++ if (TARGET_HARD_FLOAT && TARGET_MAVERICK && 0) + { + if (!cirrus_fp_register (operands[0], DImode)) + operands[0] = force_reg (DImode, operands[0]); +@@ -393,7 +393,7 @@ + (plus:DI (match_operand:DI 1 "s_register_operand" "%0, 0") + (match_operand:DI 2 "s_register_operand" "r, 0"))) + (clobber (reg:CC CC_REGNUM))] +- "TARGET_ARM && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)" ++ "TARGET_ARM" + "#" + "TARGET_ARM && reload_completed" + [(parallel [(set (reg:CC_C CC_REGNUM) +@@ -421,7 +421,7 @@ + (match_operand:SI 2 "s_register_operand" "r,r")) + (match_operand:DI 1 "s_register_operand" "r,0"))) + (clobber (reg:CC CC_REGNUM))] +- "TARGET_ARM && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)" ++ "TARGET_ARM" + "#" + "TARGET_ARM && reload_completed" + [(parallel [(set (reg:CC_C CC_REGNUM) +@@ -450,7 +450,7 @@ + (match_operand:SI 2 "s_register_operand" "r,r")) + (match_operand:DI 1 "s_register_operand" "r,0"))) + (clobber (reg:CC CC_REGNUM))] +- "TARGET_ARM && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)" ++ "TARGET_ARM" + "#" + "TARGET_ARM && reload_completed" + [(parallel [(set (reg:CC_C CC_REGNUM) +@@ -838,7 +838,7 @@ + if (TARGET_HARD_FLOAT && TARGET_MAVERICK + && TARGET_ARM + && cirrus_fp_register (operands[0], DImode) +- && cirrus_fp_register (operands[1], DImode)) ++ && cirrus_fp_register (operands[1], DImode) && 0) + { + emit_insn (gen_cirrus_subdi3 (operands[0], operands[1], operands[2])); + DONE; +@@ -2599,7 +2599,7 @@ + values to iwmmxt regs and back. */ + FAIL; + } +- else if (!TARGET_REALLY_IWMMXT && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)) ++ else if (!TARGET_REALLY_IWMMXT) + FAIL; + " + ) +@@ -4215,7 +4215,6 @@ + [(set (match_operand:DI 0 "nonimmediate_operand" "=l,l,l,l,>,l, m,*r") + (match_operand:DI 1 "general_operand" "l, I,J,>,l,mi,l,*r"))] + "TARGET_THUMB +- && !(TARGET_HARD_FLOAT && TARGET_MAVERICK) + && ( register_operand (operands[0], DImode) + || register_operand (operands[1], DImode))" + "* diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-64bit-disable0.patch b/packages/gcc/gcc-4.2.3/arm-crunch-64bit-disable0.patch new file mode 100644 index 0000000000..95abf68a60 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-64bit-disable0.patch @@ -0,0 +1,47 @@ +diff -ruN /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.md gcc-4.1.2/gcc/config/arm/arm.md +--- /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.md 2006-09-28 03:10:22.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.md 2007-05-15 09:53:21.000000000 +1000 +@@ -6865,10 +6877,12 @@ + ) + + ;; Cirrus DI compare instruction ++;; This is disabled and left go through ARM core registers, because currently ++;; Crunch coprocessor does only signed comparison. + (define_expand "cmpdi" + [(match_operand:DI 0 "cirrus_fp_register" "") + (match_operand:DI 1 "cirrus_fp_register" "")] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK & 0" + "{ + arm_compare_op0 = operands[0]; + arm_compare_op1 = operands[1]; +@@ -6879,7 +6893,7 @@ + [(set (reg:CC CC_REGNUM) + (compare:CC (match_operand:DI 0 "cirrus_fp_register" "v") + (match_operand:DI 1 "cirrus_fp_register" "v")))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK & 0" + "cfcmp64%?\\tr15, %V0, %V1" + [(set_attr "type" "mav_farith") + (set_attr "cirrus" "compare")] +@@ -10105,6 +10119,7 @@ + [(unspec:SI [(match_operand:SI 0 "register_operand" "")] UNSPEC_PROLOGUE_USE)] + "" + "%@ %0 needed for prologue" ++ [(set_attr "length" "0")] + ) + + +diff -ruN /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/cirrus.md gcc-4.1.2/gcc/config/arm/cirrus.md +--- /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/cirrus.md 2005-06-25 11:22:41.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/cirrus.md 2007-05-15 09:55:29.000000000 +1000 +@@ -348,7 +348,8 @@ + (clobber (match_scratch:DF 2 "=v"))] + "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" + "cftruncd32%?\\t%Y2, %V1\;cfmvr64l%?\\t%0, %Z2" +- [(set_attr "length" "8")] ++ [(set_attr "length" "8") ++ (set_attr "cirrus" "normal")] + ) + + (define_insn "*cirrus_truncdfsf2" diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-and-or.patch b/packages/gcc/gcc-4.2.3/arm-crunch-and-or.patch new file mode 100644 index 0000000000..24357d316e --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-and-or.patch @@ -0,0 +1,67 @@ +--- gcc-4.1.2/gcc/config/arm/arm.md-original 2007-06-13 17:16:38.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-13 17:35:19.000000000 +1000 +@@ -8455,7 +8455,7 @@ + (and:SI (match_operator:SI 1 "arm_comparison_operator" + [(match_operand 3 "cc_register" "") (const_int 0)]) + (match_operand:SI 2 "s_register_operand" "r")))] +- "TARGET_ARM" ++ "TARGET_ARM && !TARGET_MAVERICK" + "mov%D1\\t%0, #0\;and%d1\\t%0, %2, #1" + [(set_attr "conds" "use") + (set_attr "length" "8")] +@@ -8466,7 +8466,7 @@ + (ior:SI (match_operator:SI 2 "arm_comparison_operator" + [(match_operand 3 "cc_register" "") (const_int 0)]) + (match_operand:SI 1 "s_register_operand" "0,?r")))] +- "TARGET_ARM" ++ "TARGET_ARM && !TARGET_MAVERICK" + "@ + orr%d2\\t%0, %1, #1 + mov%D2\\t%0, %1\;orr%d2\\t%0, %1, #1" +@@ -8734,7 +8734,8 @@ + (clobber (reg:CC CC_REGNUM))] + "TARGET_ARM + && (arm_select_dominance_cc_mode (operands[3], operands[6], DOM_CC_X_OR_Y) +- != CCmode)" ++ != CCmode) ++ && !TARGET_MAVERICK" + "#" + "TARGET_ARM && reload_completed" + [(set (match_dup 7) +@@ -8765,7 +8766,7 @@ + (set (match_operand:SI 7 "s_register_operand" "=r") + (ior:SI (match_op_dup 3 [(match_dup 1) (match_dup 2)]) + (match_op_dup 6 [(match_dup 4) (match_dup 5)])))] +- "TARGET_ARM" ++ "TARGET_ARM && !TARGET_MAVERICK" + "#" + "TARGET_ARM && reload_completed" + [(set (match_dup 0) +@@ -8790,7 +8791,8 @@ + (clobber (reg:CC CC_REGNUM))] + "TARGET_ARM + && (arm_select_dominance_cc_mode (operands[3], operands[6], DOM_CC_X_AND_Y) +- != CCmode)" ++ != CCmode) ++ && !TARGET_MAVERICK" + "#" + "TARGET_ARM && reload_completed + && (arm_select_dominance_cc_mode (operands[3], operands[6], DOM_CC_X_AND_Y) +@@ -8823,7 +8825,7 @@ + (set (match_operand:SI 7 "s_register_operand" "=r") + (and:SI (match_op_dup 3 [(match_dup 1) (match_dup 2)]) + (match_op_dup 6 [(match_dup 4) (match_dup 5)])))] +- "TARGET_ARM" ++ "TARGET_ARM && !TARGET_MAVERICK" + "#" + "TARGET_ARM && reload_completed" + [(set (match_dup 0) +@@ -8850,7 +8852,7 @@ + [(match_operand:SI 4 "s_register_operand" "r,r,r") + (match_operand:SI 5 "arm_add_operand" "rIL,rIL,rIL")]))) + (clobber (reg:CC CC_REGNUM))] +- "TARGET_ARM ++ "TARGET_ARM && !TARGET_MAVERICK + && (arm_select_dominance_cc_mode (operands[3], operands[6], DOM_CC_X_AND_Y) + == CCmode)" + "#" diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-cfcvt64-disable.patch b/packages/gcc/gcc-4.2.3/arm-crunch-cfcvt64-disable.patch new file mode 100644 index 0000000000..f9280b18b5 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-cfcvt64-disable.patch @@ -0,0 +1,19 @@ +--- gcc-4.2.0/gcc/config/arm/cirrus.md-original 2007-06-25 15:32:01.000000000 +1000 ++++ gcc-4.2.0/gcc/config/arm/cirrus.md 2007-06-25 15:32:14.000000000 +1000 +@@ -325,14 +325,14 @@ + (define_insn "floatdisf2" + [(set (match_operand:SF 0 "cirrus_fp_register" "=v") + (float:SF (match_operand:DI 1 "cirrus_fp_register" "v")))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfcvt64s%?\\t%V0, %V1" + [(set_attr "cirrus" "normal")]) + + (define_insn "floatdidf2" + [(set (match_operand:DF 0 "cirrus_fp_register" "=v") + (float:DF (match_operand:DI 1 "cirrus_fp_register" "v")))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfcvt64d%?\\t%V0, %V1" + [(set_attr "cirrus" "normal")]) + diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-cfcvtds-disable.patch b/packages/gcc/gcc-4.2.3/arm-crunch-cfcvtds-disable.patch new file mode 100644 index 0000000000..ec09ea16a1 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-cfcvtds-disable.patch @@ -0,0 +1,32 @@ +--- gcc-4.1.2/gcc/config/arm/cirrus.md-cfcvt 2007-06-15 10:06:24.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/cirrus.md 2007-06-15 10:07:21.000000000 +1000 +@@ -355,11 +355,12 @@ + (set_attr "cirrus" "normal")] + ) + ++; appears to be buggy - causes 20000320-1.c to fail in execute/ieee + (define_insn "*cirrus_truncdfsf2" + [(set (match_operand:SF 0 "cirrus_fp_register" "=v") + (float_truncate:SF + (match_operand:DF 1 "cirrus_fp_register" "v")))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfcvtds%?\\t%V0, %V1" + [(set_attr "cirrus" "normal")] + ) +--- gcc-4.1.2/gcc/config/arm/arm.md-truncdfsf2 2007-06-15 10:25:43.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-15 10:27:01.000000000 +1000 +@@ -3181,11 +3181,12 @@ + + ;; Truncation insns + ++;; Maverick Crunch truncdfsf2 is buggy - see cirrus.md + (define_expand "truncdfsf2" + [(set (match_operand:SF 0 "s_register_operand" "") + (float_truncate:SF + (match_operand:DF 1 "s_register_operand" "")))] +- "TARGET_ARM && TARGET_HARD_FLOAT" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" + "" + ) + diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-cirrus-bugfixes.patch b/packages/gcc/gcc-4.2.3/arm-crunch-cirrus-bugfixes.patch new file mode 100644 index 0000000000..cb0af8546d --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-cirrus-bugfixes.patch @@ -0,0 +1,573 @@ +diff -ruN /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.c gcc-4.1.2/gcc/config/arm/arm.c +--- /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.c 2007-05-09 16:32:29.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.c 2007-05-15 09:39:41.000000000 +1000 +@@ -4,6 +4,7 @@ + Contributed by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl) + and Martin Simmons (@harleqn.co.uk). + More major hacks by Richard Earnshaw (rearnsha@arm.com). ++ Cirrus Crunch bugfixes by Vladimir Ivanov (vladit@nucleusys.com) + + This file is part of GCC. + +@@ -131,9 +132,17 @@ + static bool arm_xscale_rtx_costs (rtx, int, int, int *); + static bool arm_9e_rtx_costs (rtx, int, int, int *); + static int arm_address_cost (rtx); +-static bool arm_memory_load_p (rtx); ++// static bool arm_memory_load_p (rtx); + static bool arm_cirrus_insn_p (rtx); +-static void cirrus_reorg (rtx); ++// static void cirrus_reorg (rtx); ++static bool arm_mem_access_p (rtx); ++static bool cirrus_dest_regn_p (rtx, int); ++static rtx cirrus_prev_next_mach_insn (rtx, int *, int); ++static rtx cirrus_prev_mach_insn (rtx, int *); ++static rtx cirrus_next_mach_insn (rtx, int *); ++static void cirrus_reorg_branch (rtx); ++static void cirrus_reorg_bug1 (rtx); ++static void cirrus_reorg_bug10_12 (rtx); + static void arm_init_builtins (void); + static rtx arm_expand_builtin (tree, rtx, rtx, enum machine_mode, int); + static void arm_init_iwmmxt_builtins (void); +@@ -5399,41 +5412,6 @@ + || TREE_CODE (valtype) == COMPLEX_TYPE)); + } + +-/* 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. */ +-static bool +-arm_memory_load_p (rtx insn) +-{ +- rtx body, lhs, rhs;; +- +- if (insn == NULL_RTX || GET_CODE (insn) != INSN) +- return false; +- +- body = PATTERN (insn); +- +- if (GET_CODE (body) != SET) +- return false; +- +- lhs = XEXP (body, 0); +- rhs = XEXP (body, 1); +- +- lhs = REG_OR_SUBREG_RTX (lhs); +- +- /* If the destination is not a general purpose +- register we do not have to worry. */ +- if (GET_CODE (lhs) != REG +- || REGNO_REG_CLASS (REGNO (lhs)) != GENERAL_REGS) +- return false; +- +- /* As well as loads from memory we also have to react +- to loads of invalid constants which will be turned +- into loads from the minipool. */ +- return (GET_CODE (rhs) == MEM +- || GET_CODE (rhs) == SYMBOL_REF +- || note_invalid_constants (insn, -1, false)); +-} +- + /* Return TRUE if INSN is a Cirrus instruction. */ + static bool + arm_cirrus_insn_p (rtx insn) +@@ -5452,124 +5433,218 @@ + return attr != CIRRUS_NOT; + } + +-/* Cirrus reorg for invalid instruction combinations. */ +-static void +-cirrus_reorg (rtx first) ++/* Return TRUE if ISN does memory access. */ ++static bool ++arm_mem_access_p (rtx insn) + { +- enum attr_cirrus attr; +- rtx body = PATTERN (first); +- rtx t; +- int nops; ++ enum attr_type attr; + +- /* Any branch must be followed by 2 non Cirrus instructions. */ +- if (GET_CODE (first) == JUMP_INSN && GET_CODE (body) != RETURN) +- { +- nops = 0; +- t = next_nonnote_insn (first); ++ /* get_attr aborts on USE and CLOBBER. */ ++ if (!insn ++ || GET_CODE (insn) != INSN ++ || GET_CODE (PATTERN (insn)) == USE ++ || GET_CODE (PATTERN (insn)) == CLOBBER) ++ return 0; + +- if (arm_cirrus_insn_p (t)) +- ++ nops; ++ attr = get_attr_type (insn); + +- if (arm_cirrus_insn_p (next_nonnote_insn (t))) +- ++ nops; ++ return attr == TYPE_LOAD_BYTE ++ || attr == TYPE_LOAD1 || attr == TYPE_LOAD2 || attr == TYPE_LOAD3 || attr == TYPE_LOAD4 ++ || attr == TYPE_F_CVT ++ || attr == TYPE_F_MEM_R || attr == TYPE_R_MEM_F || attr == TYPE_F_2_R || attr == TYPE_R_2_F ++ || attr == TYPE_F_LOAD || attr == TYPE_F_LOADS || attr == TYPE_F_LOADD ++ || attr == TYPE_F_STORE || attr == TYPE_F_STORES || attr == TYPE_F_STORED ++ || attr == TYPE_STORE1 || attr == TYPE_STORE2 || attr == TYPE_STORE3 || attr == TYPE_STORE4; ++ ++} + +- while (nops --) +- emit_insn_after (gen_nop (), first); ++/* Return TRUE if destination is certain Cirrus register. */ ++static bool ++cirrus_dest_regn_p (rtx body, int regn) ++{ ++ rtx lhs; ++ int reg; ++ lhs = XEXP (body, 0); ++ if (GET_CODE (lhs) != REG) ++ return 0; + +- return; +- } ++ reg = REGNO (lhs); ++ if (REGNO_REG_CLASS (reg) != CIRRUS_REGS) ++ return 0; + +- /* (float (blah)) is in parallel with a clobber. */ +- if (GET_CODE (body) == PARALLEL && XVECLEN (body, 0) > 0) +- body = XVECEXP (body, 0, 0); ++ return reg == regn; ++} ++ ++/* Get previous/next machine instruction during Cirrus workaround scans. ++ Assume worst case (for the purpose of Cirrus workarounds) ++ for JUMP / CALL instructions. */ ++static rtx ++cirrus_prev_next_mach_insn (rtx insn, int *len, int next) ++{ ++ rtx t; ++ int l = 0; + +- if (GET_CODE (body) == SET) ++ /* It seems that we can count only on INSN length. */ ++ for ( ; ; ) + { +- rtx lhs = XEXP (body, 0), rhs = XEXP (body, 1); ++ if (next) ++ insn = NEXT_INSN (insn); ++ else ++ insn = PREV_INSN (insn); ++ if (!insn) ++ break; + +- /* cfldrd, cfldr64, cfstrd, cfstr64 must +- be followed by a non Cirrus insn. */ +- if (get_attr_cirrus (first) == CIRRUS_DOUBLE) +- { +- if (arm_cirrus_insn_p (next_nonnote_insn (first))) +- emit_insn_after (gen_nop (), first); ++ if (GET_CODE (insn) == INSN) ++ { ++ l = get_attr_length (insn) / 4; ++ if (l) ++ break; ++ } ++ else if (GET_CODE (insn) == JUMP_INSN) ++ { ++ l = 1; ++ t = is_jump_table (insn); ++ if (t) ++ l += get_jump_table_size (t) / 4; ++ break; ++ } ++ else if (GET_CODE (insn) == CALL_INSN) ++ { ++ l = 1; ++ break; ++ } ++ } + +- return; +- } +- else if (arm_memory_load_p (first)) +- { +- unsigned int arm_regno; ++ if (len) ++ *len = l; + +- /* Any ldr/cfmvdlr, ldr/cfmvdhr, ldr/cfmvsr, ldr/cfmv64lr, +- ldr/cfmv64hr combination where the Rd field is the same +- in both instructions must be split with a non Cirrus +- insn. Example: +- +- ldr r0, blah +- nop +- cfmvsr mvf0, r0. */ +- +- /* Get Arm register number for ldr insn. */ +- if (GET_CODE (lhs) == REG) +- arm_regno = REGNO (lhs); +- else +- { +- gcc_assert (GET_CODE (rhs) == REG); +- arm_regno = REGNO (rhs); +- } ++ return insn; ++} + +- /* Next insn. */ +- first = next_nonnote_insn (first); ++static rtx ++cirrus_prev_mach_insn (rtx insn, int *len) ++{ ++ return cirrus_prev_next_mach_insn (insn, len, 0); ++} + +- if (! arm_cirrus_insn_p (first)) +- return; ++static rtx ++cirrus_next_mach_insn (rtx insn, int *len) ++{ ++ return cirrus_prev_next_mach_insn (insn, len, 1); ++} + +- body = PATTERN (first); ++/* Cirrus reorg for branch slots. */ ++static void ++cirrus_reorg_branch (rtx insn) ++{ ++ rtx t; ++ int nops, l; + +- /* (float (blah)) is in parallel with a clobber. */ +- if (GET_CODE (body) == PARALLEL && XVECLEN (body, 0)) +- body = XVECEXP (body, 0, 0); +- +- if (GET_CODE (body) == FLOAT) +- body = XEXP (body, 0); +- +- if (get_attr_cirrus (first) == CIRRUS_MOVE +- && GET_CODE (XEXP (body, 1)) == REG +- && arm_regno == REGNO (XEXP (body, 1))) +- emit_insn_after (gen_nop (), first); ++ /* TODO: handle jump-tables. */ ++ t = is_jump_table (insn); ++ if (t) ++ return; ++ ++ /* Any branch must be followed by 2 non Cirrus instructions. */ ++ t = insn; ++ for (nops = 2; nops > 0; ) ++ { ++ if (!cirrus_next_mach_insn (t, 0)) ++ { ++ insn = t; ++ break; ++ } ++ t = cirrus_next_mach_insn (t, &l); ++ if (arm_cirrus_insn_p (t)) ++ break; ++ nops -= l; + +- return; +- } + } + +- /* get_attr cannot accept USE or CLOBBER. */ +- if (!first +- || GET_CODE (first) != INSN +- || GET_CODE (PATTERN (first)) == USE +- || GET_CODE (PATTERN (first)) == CLOBBER) +- return; ++ while (nops-- > 0) ++ emit_insn_after (gen_nop (), insn); /* WARNING: this appears to cause "bad immediate value for offset" errors in the assembler */ ++} + +- attr = get_attr_cirrus (first); ++/* Cirrus reorg for bug #1 (cirrus + cfcmpxx). */ ++static void ++cirrus_reorg_bug1 (rtx insn) ++{ ++ rtx body = PATTERN (insn), body2; ++ rtx t; ++ int i, nops, l; ++ enum attr_cirrus attr; + +- /* Any coprocessor compare instruction (cfcmps, cfcmpd, ...) +- must be followed by a non-coprocessor instruction. */ +- if (attr == CIRRUS_COMPARE) ++ /* Check if destination or clobber is Cirrus register. */ ++ if (GET_CODE (body) == PARALLEL) + { +- nops = 0; +- +- t = next_nonnote_insn (first); ++ for (i = 0; i < XVECLEN (body, 0); i++) ++ { ++ body2 = XVECEXP (body, 0, i); ++ if (GET_CODE (body2) == SET) ++ { ++ if (cirrus_dest_regn_p (body2, LAST_CIRRUS_FP_REGNUM)) ++ { ++ nops = 5; ++ goto fix; ++ } ++ } ++ else if (GET_CODE (body2) == CLOBBER) ++ { ++ if (cirrus_dest_regn_p (body2, LAST_CIRRUS_FP_REGNUM)) ++ { ++ nops = 4; ++ goto fix; ++ } ++ } ++ } ++ } ++ else if (GET_CODE (body) == SET) ++ { ++ if (cirrus_dest_regn_p (body, LAST_CIRRUS_FP_REGNUM)) ++ { ++ nops = 5; ++ goto fix; ++ } ++ } ++ return; + +- if (arm_cirrus_insn_p (t)) +- ++ nops; ++fix: ++ t = insn; ++ for ( ; nops > 0; ) ++ { ++ t = cirrus_next_mach_insn (t, &l); ++ if (!t) ++ break; ++ if (GET_CODE (t) == JUMP_INSN ++ || GET_CODE (t) == CALL_INSN) ++ { ++ nops -= l; ++ break; ++ } ++ else if (arm_cirrus_insn_p (t)) ++ { ++ attr = get_attr_cirrus (t); ++ if (attr == CIRRUS_COMPARE) ++ break; ++ } ++ nops -= l; ++ } + +- if (arm_cirrus_insn_p (next_nonnote_insn (t))) +- ++ nops; ++ while (nops-- > 0) ++ emit_insn_after (gen_nop (), insn); /* WARNING: this appears to cause "bad immediate value for offset" errors in the assembler */ ++} + +- while (nops --) +- emit_insn_after (gen_nop (), first); ++/* Cirrus reorg for bugs #10 and #12 (data aborts). */ ++static void ++cirrus_reorg_bug10_12 (rtx insn) ++{ ++ rtx t; + +- return; +- } ++ t = cirrus_next_mach_insn (insn, 0); ++ if (arm_cirrus_insn_p (t)) ++ if (TARGET_CIRRUS_D0 || ++ get_attr_cirrus (t) == CIRRUS_DOUBLE) ++ emit_insn_after (gen_nop (), insn); /* WARNING: this appears to cause "bad immediate value for offset" errors in the assembler */ + } + + /* Return TRUE if X references a SYMBOL_REF. */ +@@ -7727,7 +7796,7 @@ + { + Mnode * mp; + Mnode * nmp; +- int align64 = 0; ++ int align64 = 0, stuffnop = 0; + + if (ARM_DOUBLEWORD_ALIGN) + for (mp = minipool_vector_head; mp != NULL; mp = mp->next) +@@ -7742,8 +7811,27 @@ + ";; Emitting minipool after insn %u; address %ld; align %d (bytes)\n", + INSN_UID (scan), (unsigned long) minipool_barrier->address, align64 ? 8 : 4); + ++ /* Check if branch before minipool is already stuffed with nops. */ ++ if (TARGET_CIRRUS_D0 || TARGET_CIRRUS_D1) ++ { ++ rtx t; ++ ++ t = prev_active_insn (scan); ++ if (GET_CODE (t) != INSN ++ || PATTERN (t) != const0_rtx) ++ stuffnop = 1; ++ } + scan = emit_label_after (gen_label_rtx (), scan); + scan = emit_insn_after (align64 ? gen_align_8 () : gen_align_4 (), scan); ++ /* Last instruction was branch, so put two non-Cirrus opcodes. */ ++ if (stuffnop) ++ { ++#if TARGET_CIRRUS /* This is doubling up on nops, so I don't think this is a good idea */ ++ emit_insn_before (gen_nop (), scan); /* WARNING: this appears to cause "bad immediate value for offset" errors in the assembler */ ++ emit_insn_before (gen_nop (), scan); /* WARNING: this appears to cause "bad immediate value for offset" errors in the assembler */ ++#endif ++ } ++ + scan = emit_label_after (minipool_vector_label, scan); + + for (mp = minipool_vector_head; mp != NULL; mp = nmp) +@@ -8151,15 +8239,38 @@ + gcc_assert (GET_CODE (insn) == NOTE); + minipool_pad = 0; + ++#if TARGET_CIRRUS /* I think this is a double-up */ ++ /* Scan all the insn and fix Cirrus issues. */ ++ if (TARGET_CIRRUS_D0 || TARGET_CIRRUS_D1) ++ { ++ rtx t, s; ++ ++ for (t = cirrus_next_mach_insn (insn, 0); t; t = cirrus_next_mach_insn (t, 0)) ++ if (arm_mem_access_p (t)) ++ cirrus_reorg_bug10_12 (t); ++ ++ if (TARGET_CIRRUS_D0) ++ for (t = cirrus_next_mach_insn (insn, 0); t; t = cirrus_next_mach_insn (t, 0)) ++ if (arm_cirrus_insn_p (t)) ++ cirrus_reorg_bug1 (t); ++ ++ /* Find last insn. */ ++ for (t = insn; ; t = s) ++ { ++ s = cirrus_next_mach_insn (t, 0); ++ if (!s) ++ break; ++ } ++ /* Scan backward and fix branches. - WARNING: appears to cause "bad immediate value for offset" problems! */ ++ for ( ; t; t = cirrus_prev_mach_insn (t, 0)) ++ if (GET_CODE (t) == JUMP_INSN ++ || GET_CODE (t) == CALL_INSN) ++ cirrus_reorg_branch (t); ++ } ++#endif + /* Scan all the insns and record the operands that will need fixing. */ + for (insn = next_nonnote_insn (insn); insn; insn = next_nonnote_insn (insn)) + { +- if (TARGET_CIRRUS_FIX_INVALID_INSNS +- && (arm_cirrus_insn_p (insn) +- || GET_CODE (insn) == JUMP_INSN +- || arm_memory_load_p (insn))) +- cirrus_reorg (insn); +- + if (GET_CODE (insn) == BARRIER) + push_minipool_barrier (insn, address); + else if (INSN_P (insn)) +@@ -11755,16 +11910,10 @@ + || get_attr_conds (this_insn) != CONDS_NOCOND) + fail = TRUE; + +- /* A conditional cirrus instruction must be followed by +- a non Cirrus instruction. However, since we +- conditionalize instructions in this function and by +- the time we get here we can't add instructions +- (nops), because shorten_branches() has already been +- called, we will disable conditionalizing Cirrus +- instructions to be safe. */ +- if (GET_CODE (scanbody) != USE +- && GET_CODE (scanbody) != CLOBBER +- && get_attr_cirrus (this_insn) != CIRRUS_NOT) ++ /* To avoid erratic behaviour, we avoid conditional Cirrus ++ instructions when doing workarounds. */ ++ if (arm_cirrus_insn_p(this_insn) ++ && (TARGET_CIRRUS_D0 || TARGET_CIRRUS_D1)) + fail = TRUE; + break; + +diff -ruN /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.h gcc-4.1.2/gcc/config/arm/arm.h +--- /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.h 2005-11-05 01:02:51.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.h 2007-05-15 10:15:05.000000000 +1000 +@@ -5,6 +5,7 @@ + and Martin Simmons (@harleqn.co.uk). + More major hacks by Richard Earnshaw (rearnsha@arm.com) + Minor hacks by Nick Clifton (nickc@cygnus.com) ++ Cirrus Crunch fixes by Vladimir Ivanov (vladitx@nucleusys.com) + + This file is part of GCC. + +@@ -140,7 +141,9 @@ + %{msoft-float:%{mhard-float: \ + %e-msoft-float and -mhard_float may not be used together}} \ + %{mbig-endian:%{mlittle-endian: \ +- %e-mbig-endian and -mlittle-endian may not be used together}}" ++ %e-mbig-endian and -mlittle-endian may not be used together}} \ ++%{mfix-crunch-d0:%{mfix-crunch-d1: \ ++ %e-mfix-crunch-d0 and -mfix-crunch-d1 may not be used together}}" + + #ifndef CC1_SPEC + #define CC1_SPEC "" +@@ -179,6 +182,9 @@ + #define TARGET_HARD_FLOAT_ABI (arm_float_abi == ARM_FLOAT_ABI_HARD) + #define TARGET_FPA (arm_fp_model == ARM_FP_MODEL_FPA) + #define TARGET_MAVERICK (arm_fp_model == ARM_FP_MODEL_MAVERICK) ++#define TARGET_CIRRUS (arm_arch_cirrus) ++#define TARGET_CIRRUS_D0 0 /* (target_flags & ARM_FLAG_CIRRUS_D0) */ ++#define TARGET_CIRRUS_D1 1 /* (target_flags & ARM_FLAG_CIRRUS_D1) */ + #define TARGET_VFP (arm_fp_model == ARM_FP_MODEL_VFP) + #define TARGET_IWMMXT (arm_arch_iwmmxt) + #define TARGET_REALLY_IWMMXT (TARGET_IWMMXT && TARGET_ARM) +diff -ruN /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.opt gcc-4.1.2/gcc/config/arm/arm.opt +--- /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.opt 2005-11-05 01:02:51.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.opt 2007-05-15 10:09:31.000000000 +1000 +@@ -68,6 +68,14 @@ + Target Report Mask(CIRRUS_FIX_INVALID_INSNS) + Cirrus: Place NOPs to avoid invalid instruction combinations + ++fix-crunch-d0 ++Target Report Mask(ARM_FLAG_CIRRUS_D0) ++Cirrus: workarounds for Crunch coprocessor revision D0 ++ ++fix-crunch-d1 ++Target Report Mask(ARM_FLAG_CIRRUS_D1) ++Cirrus: workarounds for Crunch coprocessor revision D1 ++ + mcpu= + Target RejectNegative Joined + Specify the name of the target CPU +diff -ruN /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/doc/invoke.texi gcc-4.1.2/gcc/doc/invoke.texi +--- /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/doc/invoke.texi 2006-09-26 07:21:58.000000000 +1000 ++++ gcc-4.1.2/gcc/doc/invoke.texi 2007-05-15 10:07:04.000000000 +1000 +@@ -408,7 +408,7 @@ + -msingle-pic-base -mno-single-pic-base @gol + -mpic-register=@var{reg} @gol + -mnop-fun-dllimport @gol +--mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol ++-mfix-crunch-d0 -mfix-crunch-d1 @gol + -mpoke-function-name @gol + -mthumb -marm @gol + -mtpcs-frame -mtpcs-leaf-frame @gol +@@ -7435,17 +7435,12 @@ + Specify the register to be used for PIC addressing. The default is R10 + unless stack-checking is enabled, when R9 is used. + +-@item -mcirrus-fix-invalid-insns +-@opindex mcirrus-fix-invalid-insns +-@opindex mno-cirrus-fix-invalid-insns +-Insert NOPs into the instruction stream to in order to work around +-problems with invalid Maverick instruction combinations. This option +-is only valid if the @option{-mcpu=ep9312} option has been used to +-enable generation of instructions for the Cirrus Maverick floating +-point co-processor. This option is not enabled by default, since the +-problem is only present in older Maverick implementations. The default +-can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns} +-switch. ++@item -mfix-crunch-d0 ++@itemx -mfix-crunch-d1 ++@opindex mfix-crunch-d0 ++@opindex mfix-crunch-d1 ++Enable workarounds for the Cirrus MaverickCrunch coprocessor revisions ++D0 and D1 respectively. + + @item -mpoke-function-name + @opindex mpoke-function-name diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-compare-geu.patch b/packages/gcc/gcc-4.2.3/arm-crunch-compare-geu.patch new file mode 100644 index 0000000000..3d27cc1d9d --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-compare-geu.patch @@ -0,0 +1,48 @@ +--- gcc-4.1.2/gcc/config/arm/arm.md-original 2007-06-08 06:39:41.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-08 06:41:00.000000000 +1000 +@@ -7125,6 +7125,22 @@ + (set_attr "length" "8")] + ) + ++; Special pattern to match GEU for MAVERICK. ++(define_insn "*arm_bgeu" ++ [(set (pc) ++ (if_then_else (geu (match_operand 1 "cc_register" "") (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "TARGET_ARM && (TARGET_MAVERICK)" ++ "* ++ gcc_assert (!arm_ccfsm_state); ++ if (get_attr_cirrus (prev_active_insn(insn)) == CIRRUS_COMPARE) ++ return \"beq\\t%l0\;bvs\\t%l0\"; else return \"bge\\t%l0\;nop\"; ++ " ++ [(set_attr "conds" "jump_clob") ++ (set_attr "length" "8")] ++) ++ + ; Special pattern to match UNLT for MAVERICK - UGLY since we need to test for Z=0 && V=0. + (define_insn "*arm_bunlt" + [(set (pc) +@@ -7240,6 +7256,22 @@ + (set_attr "length" "8")] + ) + ++; Special pattern to match reversed GEU for MAVERICK. ++(define_insn "*arm_bgeu_reversed" ++ [(set (pc) ++ (if_then_else (geu (match_operand 1 "cc_register" "") (const_int 0)) ++ (pc) ++ (label_ref (match_operand 0 "" ""))))] ++ "TARGET_ARM && (TARGET_MAVERICK)" ++ "* ++ gcc_assert (!arm_ccfsm_state); ++ ++ return \"beq\\t.+12\;bvs\\t.+8\;b\\t%l0\"; ++ " ++ [(set_attr "conds" "jump_clob") ++ (set_attr "length" "12")] ++) ++ + ; Special pattern to match reversed UNLT for MAVERICK. + (define_insn "*arm_bunlt_reversed" + [(set (pc) diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-compare-unordered.patch b/packages/gcc/gcc-4.2.3/arm-crunch-compare-unordered.patch new file mode 100644 index 0000000000..c4fcdb3746 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-compare-unordered.patch @@ -0,0 +1,98 @@ +--- gcc-4.1.2/gcc/config/arm/arm.md-original 2007-06-07 14:45:22.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-07 15:13:58.000000000 +1000 +@@ -7001,16 +7001,16 @@ + (if_then_else (unordered (match_dup 1) (const_int 0)) + (label_ref (match_operand 0 "" "")) + (pc)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (UNORDERED, arm_compare_op0, + arm_compare_op1);" + ) + + (define_expand "bordered" + [(set (pc) + (if_then_else (ordered (match_dup 1) (const_int 0)) + (label_ref (match_operand 0 "" "")) + (pc)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (ORDERED, arm_compare_op0, + arm_compare_op1);" +@@ -7141,6 +7141,38 @@ + (set_attr "length" "8")] + ) + ++; Special pattern to match UNORDERED for MAVERICK - UGLY since we need to test for Z=0 && N=0. ++(define_insn "*arm_bunordered" ++ [(set (pc) ++ (if_then_else (unordered (match_operand:CCFP 1 "cc_register" "") (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)" ++ "* ++ gcc_assert (!arm_ccfsm_state); ++ ++ return \"beq\\t.+12\;bmi\\t.+8\;b\\t%l0\"; ++ " ++ [(set_attr "conds" "jump_clob") ++ (set_attr "length" "12")] ++) ++ ++; Special pattern to match ORDERED for MAVERICK. ++(define_insn "*arm_bordered" ++ [(set (pc) ++ (if_then_else (ordered (match_operand:CCFP 1 "cc_register" "") (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)" ++ "* ++ gcc_assert (!arm_ccfsm_state); ++ ++ return \"beq\\t%l0\;bmi\\t%l0\"; ++ " ++ [(set_attr "conds" "jump_clob") ++ (set_attr "length" "8")] ++) ++ + (define_insn "*arm_cond_branch" + [(set (pc) + (if_then_else (match_operator 1 "arm_comparison_operator" +@@ -7224,6 +7256,37 @@ + (set_attr "length" "8")] + ) + ++; Special pattern to match reversed UNORDERED for MAVERICK. ++(define_insn "*arm_bunordered_reversed" ++ [(set (pc) ++ (if_then_else (unordered (match_operand:CCFP 1 "cc_register" "") (const_int 0)) ++ (pc) ++ (label_ref (match_operand 0 "" ""))))] ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)" ++ "* ++ gcc_assert (!arm_ccfsm_state); ++ ++ return \"beq\\t%l0\;bmi\\t%l0\"; ++ " ++ [(set_attr "conds" "jump_clob") ++ (set_attr "length" "8")] ++) ++ ++; Special pattern to match reversed ORDERED for MAVERICK - UGLY since we need to test for Z=0 && N=0. ++(define_insn "*arm_bordered_reversed" ++ [(set (pc) ++ (if_then_else (ordered (match_operand:CCFP 1 "cc_register" "") (const_int 0)) ++ (pc) ++ (label_ref (match_operand 0 "" ""))))] ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)" ++ "* ++ gcc_assert (!arm_ccfsm_state); ++ ++ return \"beq\\t.+12\;bmi\\t.+8\;b\\t%l0\"; ++ " ++ [(set_attr "conds" "jump_clob") ++ (set_attr "length" "12")] ++) + + (define_insn "*arm_cond_branch_reversed" + [(set (pc) diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-compare-unordered.patch-z-eq b/packages/gcc/gcc-4.2.3/arm-crunch-compare-unordered.patch-z-eq new file mode 100644 index 0000000000..715fb95086 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-compare-unordered.patch-z-eq @@ -0,0 +1,98 @@ +--- gcc-4.1.2/gcc/config/arm/arm.md-original 2007-06-07 14:45:22.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-07 15:13:58.000000000 +1000 +@@ -7001,16 +7001,16 @@ + (if_then_else (unordered (match_dup 1) (const_int 0)) + (label_ref (match_operand 0 "" "")) + (pc)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (UNORDERED, arm_compare_op0, + arm_compare_op1);" + ) + + (define_expand "bordered" + [(set (pc) + (if_then_else (ordered (match_dup 1) (const_int 0)) + (label_ref (match_operand 0 "" "")) + (pc)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (ORDERED, arm_compare_op0, + arm_compare_op1);" +@@ -7141,6 +7141,38 @@ + (set_attr "length" "8")] + ) + ++; Special pattern to match UNORDERED for MAVERICK - UGLY since we need to test for C=0 && N=0 ++(define_insn "*arm_bunordered" ++ [(set (pc) ++ (if_then_else (unordered (match_operand 1 "cc_register" "") (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)" ++ "* ++ gcc_assert (!arm_ccfsm_state); ++ ++ return \"bcs\\t.+12\;bmi\\t.+8\;b\\t%l0\"; ++ " ++ [(set_attr "conds" "jump_clob") ++ (set_attr "length" "12")] ++) ++ ++; Special pattern to match ORDERED for MAVERICK. ++(define_insn "*arm_bordered" ++ [(set (pc) ++ (if_then_else (ordered (match_operand 1 "cc_register" "") (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)" ++ "* ++ gcc_assert (!arm_ccfsm_state); ++ ++ return \"bcs\\t%l0\;bmi\\t%l0\"; ++ " ++ [(set_attr "conds" "jump_clob") ++ (set_attr "length" "8")] ++) ++ + (define_insn "*arm_cond_branch" + [(set (pc) + (if_then_else (match_operator 1 "arm_comparison_operator" +@@ -7224,6 +7256,37 @@ + (set_attr "length" "8")] + ) + ++; Special pattern to match reversed UNORDERED for MAVERICK. ++(define_insn "*arm_bunordered_reversed" ++ [(set (pc) ++ (if_then_else (unordered (match_operand 1 "cc_register" "") (const_int 0)) ++ (pc) ++ (label_ref (match_operand 0 "" ""))))] ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)" ++ "* ++ gcc_assert (!arm_ccfsm_state); ++ ++ return \"bcs\\t%l0\;bmi\\t%l0\"; ++ " ++ [(set_attr "conds" "jump_clob") ++ (set_attr "length" "8")] ++) ++ ++; Special pattern to match reversed ORDERED for MAVERICK - UGLY since we need to test for C=0 && N=0 ++(define_insn "*arm_bordered_reversed" ++ [(set (pc) ++ (if_then_else (ordered (match_operand 1 "cc_register" "") (const_int 0)) ++ (pc) ++ (label_ref (match_operand 0 "" ""))))] ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)" ++ "* ++ gcc_assert (!arm_ccfsm_state); ++ ++ return \"bcs\\t.+12\;bmi\\t.+8\;b\\t%l0\"; ++ " ++ [(set_attr "conds" "jump_clob") ++ (set_attr "length" "12")] ++) + + (define_insn "*arm_cond_branch_reversed" + [(set (pc) diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-compare.patch b/packages/gcc/gcc-4.2.3/arm-crunch-compare.patch new file mode 100644 index 0000000000..ccbb4854c3 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-compare.patch @@ -0,0 +1,400 @@ +diff -urN gcc-4.1.2/gcc/config/arm/arm.c ../../../../old-tmp/work/arm-oabi-angstrom-linux/gcc-cross-4.1.2-backup/gcc-4.1.2/gcc/config/arm/arm.c +--- gcc-4.1.2/gcc/config/arm/arm.c 2007-05-31 12:39:48.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.c 2007-05-29 17:19:38.000000000 +1000 +@@ -11427,26 +11427,53 @@ + /* These encodings assume that AC=1 in the FPA system control + byte. This allows us to handle all cases except UNEQ and + LTGT. */ +- switch (comp_code) +- { +- case GE: return ARM_GE; +- case GT: return ARM_GT; +- case LE: return ARM_LS; +- case LT: return ARM_MI; +- case NE: return ARM_NE; +- case EQ: return ARM_EQ; +- case ORDERED: return ARM_VC; +- case UNORDERED: return ARM_VS; +- case UNLT: return ARM_LT; +- case UNLE: return ARM_LE; +- case UNGT: return ARM_HI; +- case UNGE: return ARM_PL; +- /* UNEQ and LTGT do not have a representation. */ +- case UNEQ: /* Fall through. */ +- case LTGT: /* Fall through. */ +- default: gcc_unreachable (); +- } +- ++ if (!TARGET_MAVERICK) ++ { ++ switch (comp_code) ++ { ++ case GE: return ARM_GE; ++ case GT: return ARM_GT; ++ case LE: return ARM_LS; ++ case LT: return ARM_MI; ++ case NE: return ARM_NE; ++ case EQ: return ARM_EQ; ++ case ORDERED: return ARM_VC; ++ case UNORDERED: return ARM_VS; ++ case UNLT: return ARM_LT; ++ case UNLE: return ARM_LE; ++ case UNGT: return ARM_HI; ++ case UNGE: return ARM_PL; ++ /* UNEQ and LTGT do not have a representation. */ ++ case UNEQ: /* Fall through. */ ++ case LTGT: /* Fall through. */ ++ default: gcc_unreachable (); ++ } ++ } ++ else ++ { ++ /* CIRRUS */ ++ switch (comp_code) ++ { ++#if 1 ++ case GT: return ARM_VS; ++ case LE: return ARM_LE; ++ case LT: return ARM_LT; ++ case NE: return ARM_NE; ++ case EQ: return ARM_EQ; ++ case UNLE: return ARM_VC; ++ case UNGT: return ARM_GT; ++ case UNGE: return ARM_GE; ++ case UNEQ: return ARM_PL; ++ case LTGT: return ARM_MI; ++ /* These do not have a representation. */ ++ case GE: /* Fall through. -UNGE wrong atm */ ++ case UNLT: /* Fall through. -LT wrong atm */ ++ case ORDERED: /* Fall through. -AL wrong atm */ ++ case UNORDERED: /* Fall through. -AL wrong atm */ ++#endif ++ default: gcc_unreachable (); ++ } ++ } + case CC_SWPmode: + switch (comp_code) + { +diff -urN gcc-4.1.2/gcc/config/arm/arm.md ../../../../old-tmp/work/arm-oabi-angstrom-linux/gcc-cross-4.1.2-backup/gcc-4.1.2/gcc/config/arm/arm.md +--- gcc-4.1.2/gcc/config/arm/arm.md 2007-05-31 12:39:48.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.md 2007-05-29 15:17:18.000000000 +1000 +@@ -6952,10 +6952,11 @@ + "operands[1] = arm_gen_compare_reg (LE, arm_compare_op0, arm_compare_op1);" + ) + ++;broken on cirrus + (define_expand "bge" + [(set (pc) + (if_then_else (ge (match_dup 1) (const_int 0)) + (label_ref (match_operand 0 "" "")) + (pc)))] +- "TARGET_ARM" ++ "TARGET_ARM" ;; && !(TARGET_HARD_FLOAT && TARGET_MAVERICK) + "operands[1] = arm_gen_compare_reg (GE, arm_compare_op0, arm_compare_op1);" +@@ -6988,6 +6989,7 @@ + "operands[1] = arm_gen_compare_reg (LEU, arm_compare_op0, arm_compare_op1);" + ) + ++; broken on cirrus? + (define_expand "bgeu" + [(set (pc) + (if_then_else (geu (match_dup 1) (const_int 0)) +@@ -7031,14 +7033,15 @@ + (if_then_else (ungt (match_dup 1) (const_int 0)) + (label_ref (match_operand 0 "" "")) + (pc)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (UNGT, arm_compare_op0, arm_compare_op1);" + ) + +-(define_expand "bunlt" ++; broken for cirrus ++(define_expand "bunlt" + [(set (pc) + (if_then_else (unlt (match_dup 1) (const_int 0)) + (label_ref (match_operand 0 "" "")) + (pc)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (UNLT, arm_compare_op0, arm_compare_op1);" +@@ -7049,7 +7052,7 @@ + (if_then_else (unge (match_dup 1) (const_int 0)) + (label_ref (match_operand 0 "" "")) + (pc)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (UNGE, arm_compare_op0, arm_compare_op1);" + ) + +@@ -7058,7 +7061,7 @@ + (if_then_else (unle (match_dup 1) (const_int 0)) + (label_ref (match_operand 0 "" "")) + (pc)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (UNLE, arm_compare_op0, arm_compare_op1);" + ) + +@@ -7069,7 +7072,7 @@ + (if_then_else (uneq (match_dup 1) (const_int 0)) + (label_ref (match_operand 0 "" "")) + (pc)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ;; || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (UNEQ, arm_compare_op0, arm_compare_op1);" + ) + +@@ -7078,7 +7081,7 @@ + (if_then_else (ltgt (match_dup 1) (const_int 0)) + (label_ref (match_operand 0 "" "")) + (pc)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ;; || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (LTGT, arm_compare_op0, arm_compare_op1);" + ) + +@@ -7086,7 +7089,7 @@ + ;; Patterns to match conditional branch insns. + ;; + +-; Special pattern to match UNEQ. ++; Special pattern to match UNEQ for FPA and VFP. + (define_insn "*arm_buneq" + [(set (pc) + (if_then_else (uneq (match_operand 1 "cc_register" "") (const_int 0)) +@@ -7102,7 +7105,7 @@ + (set_attr "length" "8")] + ) + +-; Special pattern to match LTGT. ++; Special pattern to match LTGT for FPA and VFP. + (define_insn "*arm_bltgt" + [(set (pc) + (if_then_else (ltgt (match_operand 1 "cc_register" "") (const_int 0)) +@@ -7118,6 +7121,38 @@ + (set_attr "length" "8")] + ) + ++; Special pattern to match GE for MAVERICK. ++(define_insn "*arm_bge" ++ [(set (pc) ++ (if_then_else (ge (match_operand:CCFP 1 "cc_register" "") (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "* ++ gcc_assert (!arm_ccfsm_state); ++ ++ return \"beq\\t%l0\;bvs\\t%l0\"; ++ " ++ [(set_attr "conds" "jump_clob") ++ (set_attr "length" "8")] ++) ++ ++; Special pattern to match UNLT for MAVERICK - UGLY since we need to test for Z=0 && V=0. ++(define_insn "*arm_bunlt" ++ [(set (pc) ++ (if_then_else (unlt (match_operand:CCFP 1 "cc_register" "") (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "* ++ gcc_assert (!arm_ccfsm_state); ++ ++ return \"beq\\t.+12\;bvs\\t.+8\;b\\t%l0\"; ++ " ++ [(set_attr "conds" "jump_clob") ++ (set_attr "length" "12")] ++) ++ + (define_insn "*arm_cond_branch" + [(set (pc) + (if_then_else (match_operator 1 "arm_comparison_operator" +@@ -7137,7 +7172,7 @@ + (set_attr "type" "branch")] + ) + +-; Special pattern to match reversed UNEQ. ++; Special pattern to match reversed UNEQ for FPA and VFP. + (define_insn "*arm_buneq_reversed" + [(set (pc) + (if_then_else (uneq (match_operand 1 "cc_register" "") (const_int 0)) +@@ -7153,7 +7188,7 @@ + (set_attr "length" "8")] + ) + +-; Special pattern to match reversed LTGT. ++; Special pattern to match reversed LTGT for FPA and VFP. + (define_insn "*arm_bltgt_reversed" + [(set (pc) + (if_then_else (ltgt (match_operand 1 "cc_register" "") (const_int 0)) +@@ -7169,6 +7204,39 @@ + (set_attr "length" "8")] + ) + ++; Special pattern to match reversed GE for MAVERICK - UGLY since we need to tst for Z=0 && N=0. ++(define_insn "*arm_bge_reversed" ++ [(set (pc) ++ (if_then_else (ge (match_operand:CCFP 1 "cc_register" "") (const_int 0)) ++ (pc) ++ (label_ref (match_operand 0 "" ""))))] ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "* ++ gcc_assert (!arm_ccfsm_state); ++ ++ return \"beq\\t.+12\;bvs\\t.+8\;b\\t%l0\"; ++ " ++ [(set_attr "conds" "jump_clob") ++ (set_attr "length" "12")] ++) ++ ++; Special pattern to match reversed UNLT for MAVERICK. ++(define_insn "*arm_bunlt_reversed" ++ [(set (pc) ++ (if_then_else (unlt (match_operand:CCFP 1 "cc_register" "") (const_int 0)) ++ (pc) ++ (label_ref (match_operand 0 "" ""))))] ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "* ++ gcc_assert (!arm_ccfsm_state); ++ ++ return \"beq\\t%l0\;bvs\\t%l0\"; ++ " ++ [(set_attr "conds" "jump_clob") ++ (set_attr "length" "8")] ++) ++ ++ + (define_insn "*arm_cond_branch_reversed" + [(set (pc) + (if_then_else (match_operator 1 "arm_comparison_operator" +@@ -7220,8 +7288,9 @@ + "operands[1] = arm_gen_compare_reg (LE, arm_compare_op0, arm_compare_op1);" + ) + ++;; broken for cirrus - definitely + (define_expand "sge" + [(set (match_operand:SI 0 "s_register_operand" "") + (ge:SI (match_dup 1) (const_int 0)))] +- "TARGET_ARM" ++ "TARGET_ARM && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (GE, arm_compare_op0, arm_compare_op1);" +@@ -7227,6 +7296,14 @@ + "operands[1] = arm_gen_compare_reg (GE, arm_compare_op0, arm_compare_op1);" + ) + ++;;; DO NOT add patterns for SGE these can not be represented with MAVERICK ++; (define_expand "sge" ++; [(set (match_operand:SI 0 "s_register_operand" "") ++; (ge:SI (match_dup 1) (const_int 0)))] ++; "TARGET_ARM && (TARGET_MAVERICK)" ++; "gcc_unreachable ();" ++; ) ++ + (define_expand "slt" + [(set (match_operand:SI 0 "s_register_operand" "") + (lt:SI (match_dup 1) (const_int 0)))] +@@ -7248,6 +7325,7 @@ + "operands[1] = arm_gen_compare_reg (LEU, arm_compare_op0, arm_compare_op1);" + ) + ++;; broken for cirrus - maybe + (define_expand "sgeu" + [(set (match_operand:SI 0 "s_register_operand" "") + (geu:SI (match_dup 1) (const_int 0)))] +@@ -7255,6 +7333,14 @@ + "operands[1] = arm_gen_compare_reg (GEU, arm_compare_op0, arm_compare_op1);" + ) + ++;;; DO NOT add patterns for SGEU these may not be represented with MAVERICK? ++; (define_expand "sgeu" ++; [(set (match_operand:SI 0 "s_register_operand" "") ++; (ge:SI (match_dup 1) (const_int 0)))] ++; "TARGET_ARM && (TARGET_MAVERICK)" ++; "gcc_unreachable ();" ++; ) ++ + (define_expand "sltu" + [(set (match_operand:SI 0 "s_register_operand" "") + (ltu:SI (match_dup 1) (const_int 0)))] +@@ -7281,7 +7367,7 @@ + (define_expand "sungt" + [(set (match_operand:SI 0 "s_register_operand" "") + (ungt:SI (match_dup 1) (const_int 0)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (UNGT, arm_compare_op0, + arm_compare_op1);" + ) +@@ -7289,23 +7375,32 @@ + (define_expand "sunge" + [(set (match_operand:SI 0 "s_register_operand" "") + (unge:SI (match_dup 1) (const_int 0)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (UNGE, arm_compare_op0, + arm_compare_op1);" + ) + ++; broken for cirrus + (define_expand "sunlt" + [(set (match_operand:SI 0 "s_register_operand" "") + (unlt:SI (match_dup 1) (const_int 0)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" + "operands[1] = arm_gen_compare_reg (UNLT, arm_compare_op0, + arm_compare_op1);" + ) + ++;;; DO NOT add patterns for SUNLT these can't be represented with MAVERICK ++; (define_expand "sunlt" ++; [(set (match_operand:SI 0 "s_register_operand" "") ++; (unlt:SI (match_dup 1) (const_int 0)))] ++; "TARGET_ARM && (TARGET_MAVERICK)" ++; "gcc_unreachable ();" ++; ) ++ + (define_expand "sunle" + [(set (match_operand:SI 0 "s_register_operand" "") + (unle:SI (match_dup 1) (const_int 0)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (UNLE, arm_compare_op0, + arm_compare_op1);" + ) +@@ -7371,7 +7466,7 @@ + enum rtx_code code = GET_CODE (operands[1]); + rtx ccreg; + +- if (code == UNEQ || code == LTGT) ++ if ((code == UNEQ || code == LTGT) || (TARGET_MAVERICK && (code == GE || code == UNLT || code == ORDERED || code == UNORDERED))) + FAIL; + + ccreg = arm_gen_compare_reg (code, arm_compare_op0, arm_compare_op1); +@@ -7390,7 +7485,8 @@ + enum rtx_code code = GET_CODE (operands[1]); + rtx ccreg; + +- if (code == UNEQ || code == LTGT) ++ if ((code == UNEQ || code == LTGT) || (TARGET_MAVERICK && (code == GE || code == UNLT || code == ORDERED || code == UNORDERED))) ++ + FAIL; + + /* When compiling for SOFT_FLOAT, ensure both arms are in registers. +@@ -7409,13 +7505,13 @@ + (if_then_else:DF (match_operand 1 "arm_comparison_operator" "") + (match_operand:DF 2 "s_register_operand" "") + (match_operand:DF 3 "arm_float_add_operand" "")))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + " + { + enum rtx_code code = GET_CODE (operands[1]); + rtx ccreg; + +- if (code == UNEQ || code == LTGT) ++ if ((code == UNEQ || code == LTGT) || (TARGET_MAVERICK && (code==GE || code == UNLT || code == ORDERED || code == UNORDERED))) + FAIL; + + ccreg = arm_gen_compare_reg (code, arm_compare_op0, arm_compare_op1); diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-compare.patch-z-eq b/packages/gcc/gcc-4.2.3/arm-crunch-compare.patch-z-eq new file mode 100644 index 0000000000..bc40411be4 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-compare.patch-z-eq @@ -0,0 +1,400 @@ +diff -urN gcc-4.1.2/gcc/config/arm/arm.c ../../../../old-tmp/work/arm-oabi-angstrom-linux/gcc-cross-4.1.2-backup/gcc-4.1.2/gcc/config/arm/arm.c +--- gcc-4.1.2/gcc/config/arm/arm.c 2007-05-31 12:39:48.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.c 2007-05-29 17:19:38.000000000 +1000 +@@ -11427,26 +11427,53 @@ + /* These encodings assume that AC=1 in the FPA system control + byte. This allows us to handle all cases except UNEQ and + LTGT. */ +- switch (comp_code) +- { +- case GE: return ARM_GE; +- case GT: return ARM_GT; +- case LE: return ARM_LS; +- case LT: return ARM_MI; +- case NE: return ARM_NE; +- case EQ: return ARM_EQ; +- case ORDERED: return ARM_VC; +- case UNORDERED: return ARM_VS; +- case UNLT: return ARM_LT; +- case UNLE: return ARM_LE; +- case UNGT: return ARM_HI; +- case UNGE: return ARM_PL; +- /* UNEQ and LTGT do not have a representation. */ +- case UNEQ: /* Fall through. */ +- case LTGT: /* Fall through. */ +- default: gcc_unreachable (); +- } +- ++ if (!TARGET_MAVERICK) ++ { ++ switch (comp_code) ++ { ++ case GE: return ARM_GE; ++ case GT: return ARM_GT; ++ case LE: return ARM_LS; ++ case LT: return ARM_MI; ++ case NE: return ARM_NE; ++ case EQ: return ARM_EQ; ++ case ORDERED: return ARM_VC; ++ case UNORDERED: return ARM_VS; ++ case UNLT: return ARM_LT; ++ case UNLE: return ARM_LE; ++ case UNGT: return ARM_HI; ++ case UNGE: return ARM_PL; ++ /* UNEQ and LTGT do not have a representation. */ ++ case UNEQ: /* Fall through. */ ++ case LTGT: /* Fall through. */ ++ default: gcc_unreachable (); ++ } ++ } ++ else ++ { ++ /* CIRRUS */ ++ switch (comp_code) ++ { ++#if 1 ++ case GT: return ARM_VS; ++ case LE: return ARM_LE; ++ case LT: return ARM_LT; ++ case NE: return ARM_NE; ++ case EQ: return ARM_EQ; ++ case UNLE: return ARM_VC; ++ case UNGT: return ARM_GT; ++ case UNGE: return ARM_GE; ++ case UNEQ: return ARM_PL; ++ case LTGT: return ARM_MI; ++ /* These do not have a representation. */ ++ case GE: /* Fall through. -UNGE wrong atm */ ++ case UNLT: /* Fall through. -LT wrong atm */ ++ case ORDERED: /* Fall through. -AL wrong atm */ ++ case UNORDERED: /* Fall through. -AL wrong atm */ ++#endif ++ default: gcc_unreachable (); ++ } ++ } + case CC_SWPmode: + switch (comp_code) + { +diff -urN gcc-4.1.2/gcc/config/arm/arm.md ../../../../old-tmp/work/arm-oabi-angstrom-linux/gcc-cross-4.1.2-backup/gcc-4.1.2/gcc/config/arm/arm.md +--- gcc-4.1.2/gcc/config/arm/arm.md 2007-05-31 12:39:48.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.md 2007-05-29 15:17:18.000000000 +1000 +@@ -6952,10 +6952,11 @@ + "operands[1] = arm_gen_compare_reg (LE, arm_compare_op0, arm_compare_op1);" + ) + ++;broken on cirrus + (define_expand "bge" + [(set (pc) + (if_then_else (ge (match_dup 1) (const_int 0)) + (label_ref (match_operand 0 "" "")) + (pc)))] +- "TARGET_ARM" ++ "TARGET_ARM" + "operands[1] = arm_gen_compare_reg (GE, arm_compare_op0, arm_compare_op1);" +@@ -6988,6 +6989,7 @@ + "operands[1] = arm_gen_compare_reg (LEU, arm_compare_op0, arm_compare_op1);" + ) + ++; broken on cirrus? + (define_expand "bgeu" + [(set (pc) + (if_then_else (geu (match_dup 1) (const_int 0)) +@@ -7031,14 +7033,15 @@ + (if_then_else (ungt (match_dup 1) (const_int 0)) + (label_ref (match_operand 0 "" "")) + (pc)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (UNGT, arm_compare_op0, arm_compare_op1);" + ) + +-(define_expand "bunlt" ++; broken for cirrus ++(define_expand "bunlt" + [(set (pc) + (if_then_else (unlt (match_dup 1) (const_int 0)) + (label_ref (match_operand 0 "" "")) + (pc)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (UNLT, arm_compare_op0, arm_compare_op1);" +@@ -7049,7 +7052,7 @@ + (if_then_else (unge (match_dup 1) (const_int 0)) + (label_ref (match_operand 0 "" "")) + (pc)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (UNGE, arm_compare_op0, arm_compare_op1);" + ) + +@@ -7058,7 +7061,7 @@ + (if_then_else (unle (match_dup 1) (const_int 0)) + (label_ref (match_operand 0 "" "")) + (pc)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (UNLE, arm_compare_op0, arm_compare_op1);" + ) + +@@ -7069,7 +7072,7 @@ + (if_then_else (uneq (match_dup 1) (const_int 0)) + (label_ref (match_operand 0 "" "")) + (pc)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ;; || TARGET_MAVERICK + "operands[1] = arm_gen_compare_reg (UNEQ, arm_compare_op0, arm_compare_op1);" + ) + +@@ -7078,7 +7081,7 @@ + (if_then_else (ltgt (match_dup 1) (const_int 0)) + (label_ref (match_operand 0 "" "")) + (pc)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ;; || TARGET_MAVERICK + "operands[1] = arm_gen_compare_reg (LTGT, arm_compare_op0, arm_compare_op1);" + ) + +@@ -7086,7 +7089,7 @@ + ;; Patterns to match conditional branch insns. + ;; + +-; Special pattern to match UNEQ. ++; Special pattern to match UNEQ for FPA and VFP. + (define_insn "*arm_buneq" + [(set (pc) + (if_then_else (uneq (match_operand 1 "cc_register" "") (const_int 0)) +@@ -7102,7 +7105,7 @@ + (set_attr "length" "8")] + ) + +-; Special pattern to match LTGT. ++; Special pattern to match LTGT for FPA and VFP. + (define_insn "*arm_bltgt" + [(set (pc) + (if_then_else (ltgt (match_operand 1 "cc_register" "") (const_int 0)) +@@ -7118,6 +7121,38 @@ + (set_attr "length" "8")] + ) + ++; Special pattern to match GE for MAVERICK. ++(define_insn "*arm_bge" ++ [(set (pc) ++ (if_then_else (ge (match_operand 1 "cc_register" "") (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "TARGET_ARM && (TARGET_MAVERICK)" ++ "* ++ gcc_assert (!arm_ccfsm_state); ++ ++ return \"beq\\t%l0\;bvs\\t%l0\"; ++ " ++ [(set_attr "conds" "jump_clob") ++ (set_attr "length" "8")] ++) ++ ++; Special pattern to match UNLT for MAVERICK. ++(define_insn "*arm_bunlt" ++ [(set (pc) ++ (if_then_else (unlt (match_operand 1 "cc_register" "") (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "TARGET_ARM && (TARGET_MAVERICK)" ++ "* ++ gcc_assert (!arm_ccfsm_state); ++ ++ return \"bne\\t%l0\;bvc\\t%l0\"; ++ " ++ [(set_attr "conds" "jump_clob") ++ (set_attr "length" "8")] ++) ++ + (define_insn "*arm_cond_branch" + [(set (pc) + (if_then_else (match_operator 1 "arm_comparison_operator" +@@ -7137,7 +7172,7 @@ + (set_attr "type" "branch")] + ) + +-; Special pattern to match reversed UNEQ. ++; Special pattern to match reversed UNEQ for FPA and VFP. + (define_insn "*arm_buneq_reversed" + [(set (pc) + (if_then_else (uneq (match_operand 1 "cc_register" "") (const_int 0)) +@@ -7153,7 +7188,7 @@ + (set_attr "length" "8")] + ) + +-; Special pattern to match reversed LTGT. ++; Special pattern to match reversed LTGT for FPA and VFP. + (define_insn "*arm_bltgt_reversed" + [(set (pc) + (if_then_else (ltgt (match_operand 1 "cc_register" "") (const_int 0)) +@@ -7169,6 +7204,39 @@ + (set_attr "length" "8")] + ) + ++; Special pattern to match reversed GE for MAVERICK. ++(define_insn "*arm_bge_reversed" ++ [(set (pc) ++ (if_then_else (ge (match_operand 1 "cc_register" "") (const_int 0)) ++ (pc) ++ (label_ref (match_operand 0 "" ""))))] ++ "TARGET_ARM && (TARGET_MAVERICK)" ++ "* ++ gcc_assert (!arm_ccfsm_state); ++ ++ return \"bne\\t%l0\;bvc\\t%l0\"; ++ " ++ [(set_attr "conds" "jump_clob") ++ (set_attr "length" "8")] ++) ++ ++; Special pattern to match reversed UNLT for MAVERICK. ++(define_insn "*arm_bunlt_reversed" ++ [(set (pc) ++ (if_then_else (unlt (match_operand 1 "cc_register" "") (const_int 0)) ++ (pc) ++ (label_ref (match_operand 0 "" ""))))] ++ "TARGET_ARM && (TARGET_MAVERICK)" ++ "* ++ gcc_assert (!arm_ccfsm_state); ++ ++ return \"beq\\t%l0\;bvs\\t%l0\"; ++ " ++ [(set_attr "conds" "jump_clob") ++ (set_attr "length" "8")] ++) ++ ++ + (define_insn "*arm_cond_branch_reversed" + [(set (pc) + (if_then_else (match_operator 1 "arm_comparison_operator" +@@ -7220,8 +7288,9 @@ + "operands[1] = arm_gen_compare_reg (LE, arm_compare_op0, arm_compare_op1);" + ) + ++;; broken for cirrus - definitely + (define_expand "sge" + [(set (match_operand:SI 0 "s_register_operand" "") + (ge:SI (match_dup 1) (const_int 0)))] +- "TARGET_ARM" ++ "TARGET_ARM && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (GE, arm_compare_op0, arm_compare_op1);" +@@ -7227,6 +7296,14 @@ + "operands[1] = arm_gen_compare_reg (GE, arm_compare_op0, arm_compare_op1);" + ) + ++;;; DO NOT add patterns for SGE these can not be represented with MAVERICK ++; (define_expand "sge" ++; [(set (match_operand:SI 0 "s_register_operand" "") ++; (ge:SI (match_dup 1) (const_int 0)))] ++; "TARGET_ARM && (TARGET_MAVERICK)" ++; "gcc_unreachable ();" ++; ) ++ + (define_expand "slt" + [(set (match_operand:SI 0 "s_register_operand" "") + (lt:SI (match_dup 1) (const_int 0)))] +@@ -7248,6 +7325,7 @@ + "operands[1] = arm_gen_compare_reg (LEU, arm_compare_op0, arm_compare_op1);" + ) + ++;; broken for cirrus - maybe + (define_expand "sgeu" + [(set (match_operand:SI 0 "s_register_operand" "") + (geu:SI (match_dup 1) (const_int 0)))] +@@ -7255,6 +7333,14 @@ + "operands[1] = arm_gen_compare_reg (GEU, arm_compare_op0, arm_compare_op1);" + ) + ++;;; DO NOT add patterns for SGEU these may not be represented with MAVERICK? ++; (define_expand "sgeu" ++; [(set (match_operand:SI 0 "s_register_operand" "") ++; (ge:SI (match_dup 1) (const_int 0)))] ++; "TARGET_ARM && (TARGET_MAVERICK)" ++; "gcc_unreachable ();" ++; ) ++ + (define_expand "sltu" + [(set (match_operand:SI 0 "s_register_operand" "") + (ltu:SI (match_dup 1) (const_int 0)))] +@@ -7281,7 +7367,7 @@ + (define_expand "sungt" + [(set (match_operand:SI 0 "s_register_operand" "") + (ungt:SI (match_dup 1) (const_int 0)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (UNGT, arm_compare_op0, + arm_compare_op1);" + ) +@@ -7289,23 +7375,32 @@ + (define_expand "sunge" + [(set (match_operand:SI 0 "s_register_operand" "") + (unge:SI (match_dup 1) (const_int 0)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (UNGE, arm_compare_op0, + arm_compare_op1);" + ) + ++; broken for cirrus + (define_expand "sunlt" + [(set (match_operand:SI 0 "s_register_operand" "") + (unlt:SI (match_dup 1) (const_int 0)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" + "operands[1] = arm_gen_compare_reg (UNLT, arm_compare_op0, + arm_compare_op1);" + ) + ++;;; DO NOT add patterns for SUNLT these can't be represented with MAVERICK ++; (define_expand "sunlt" ++; [(set (match_operand:SI 0 "s_register_operand" "") ++; (unlt:SI (match_dup 1) (const_int 0)))] ++; "TARGET_ARM && (TARGET_MAVERICK)" ++; "gcc_unreachable ();" ++; ) ++ + (define_expand "sunle" + [(set (match_operand:SI 0 "s_register_operand" "") + (unle:SI (match_dup 1) (const_int 0)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (UNLE, arm_compare_op0, + arm_compare_op1);" + ) +@@ -7371,7 +7466,7 @@ + enum rtx_code code = GET_CODE (operands[1]); + rtx ccreg; + +- if (code == UNEQ || code == LTGT) ++ if (code == UNEQ || code == LTGT || code == GE || code == UNLT || code == ORDERED || code == UNORDERED) + FAIL; + + ccreg = arm_gen_compare_reg (code, arm_compare_op0, arm_compare_op1); +@@ -7390,7 +7485,8 @@ + enum rtx_code code = GET_CODE (operands[1]); + rtx ccreg; + +- if (code == UNEQ || code == LTGT) ++ if (code == UNEQ || code == LTGT || code == GE || code == UNLT || code == ORDERED || code == UNORDERED) ++ + FAIL; + + /* When compiling for SOFT_FLOAT, ensure both arms are in registers. +@@ -7409,13 +7505,13 @@ + (if_then_else:DF (match_operand 1 "arm_comparison_operator" "") + (match_operand:DF 2 "s_register_operand" "") + (match_operand:DF 3 "arm_float_add_operand" "")))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + " + { + enum rtx_code code = GET_CODE (operands[1]); + rtx ccreg; + +- if (code == UNEQ || code == LTGT) ++ if (code == UNEQ || code == LTGT || code == GE || code == UNLT || code == ORDERED || code == UNORDERED) + FAIL; + + ccreg = arm_gen_compare_reg (code, arm_compare_op0, arm_compare_op1); diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-dominance.patch b/packages/gcc/gcc-4.2.3/arm-crunch-dominance.patch new file mode 100644 index 0000000000..517ca8d80e --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-dominance.patch @@ -0,0 +1,12 @@ +--- gcc-4.1.2/gcc/config/arm/arm.c-original 2007-06-13 11:50:10.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.c 2007-06-13 11:50:56.000000000 +1000 +@@ -6556,6 +6556,9 @@ + enum rtx_code cond1, cond2; + int swapped = 0; + ++ if (TARGET_MAVERICK) // Simple hack for MAVERICK ++ return CCmode; ++ + /* Currently we will probably get the wrong result if the individual + comparisons are not simple. This also ensures that it is safe to + reverse a comparison if necessary. */ diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-eabi-ieee754-div.patch b/packages/gcc/gcc-4.2.3/arm-crunch-eabi-ieee754-div.patch new file mode 100644 index 0000000000..940f4a65ae --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-eabi-ieee754-div.patch @@ -0,0 +1,139 @@ +--- gcc-4.1.2/gcc/config/arm/ieee754-df-original.S 2007-06-25 10:22:06.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/ieee754-df.S 2007-06-25 10:27:17.000000000 +1000 +@@ -717,6 +717,10 @@ + cmn r4, #(53 + 1) + movle xl, #0 + bicle xh, xh, #0x7fffffff ++#ifdef __MAVERICK__ ++ cfmvdlr mvd0, xl ++ cfmvdhr mvd0, xh ++#endif + RETLDM "r4, r5, r6" le + + @ Find out proper shift value. +@@ -738,6 +742,10 @@ + adc xh, r2, xh, lsr r4 + orrs lr, lr, r3, lsl #1 + biceq xl, xl, r3, lsr #31 ++#ifdef __MAVERICK__ ++ cfmvdlr mvd0, xl ++ cfmvdhr mvd0, xh ++#endif + RETLDM "r4, r5, r6" + + @ shift result right of 21 to 31 bits, or left 11 to 1 bits after +@@ -752,6 +760,10 @@ + adc xh, xh, #0 + orrs lr, lr, r3, lsl #1 + biceq xl, xl, r3, lsr #31 ++#ifdef __MAVERICK__ ++ cfmvdlr mvd0, xl ++ cfmvdhr mvd0, xh ++#endif + RETLDM "r4, r5, r6" + + @ Shift value right of 32 to 64 bits, or 0 to 32 bits after a switch +@@ -766,6 +778,10 @@ + add xl, xl, r3, lsr #31 + orrs lr, lr, r3, lsl #1 + biceq xl, xl, r3, lsr #31 ++#ifdef __MAVERICK__ ++ cfmvdlr mvd0, xl ++ cfmvdhr mvd0, xh ++#endif + RETLDM "r4, r5, r6" + + @ One or both arguments are denormalized. +@@ -808,6 +824,10 @@ + eor xh, xh, yh + bic xh, xh, #0x7fffffff + mov xl, #0 ++#ifdef __MAVERICK__ ++ cfmvdlr mvd0, xl ++ cfmvdhr mvd0, xh ++#endif + RETLDM "r4, r5, r6" + + 1: @ One or both args are INF or NAN. +@@ -837,12 +857,20 @@ + orr xh, xh, #0x7f000000 + orr xh, xh, #0x00f00000 + mov xl, #0 ++#ifdef __MAVERICK__ ++ cfmvdlr mvd0, xl ++ cfmvdhr mvd0, xh ++#endif + RETLDM "r4, r5, r6" + + @ Return a quiet NAN. + LSYM(Lml_n): + orr xh, xh, #0x7f000000 + orr xh, xh, #0x00f80000 ++#ifdef __MAVERICK__ ++ cfmvdlr mvd0, xl ++ cfmvdhr mvd0, xh ++#endif + RETLDM "r4, r5, r6" + + FUNC_END aeabi_dmul +--- gcc-4.1.2/gcc/config/arm/ieee754-sf-original.S 2007-06-25 10:18:52.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/ieee754-sf.S 2007-06-25 10:40:25.000000000 +1000 +@@ -518,6 +518,9 @@ + @ Check if denormalized result is possible, otherwise return signed 0. + cmn r2, #(24 + 1) + bicle r0, r0, #0x7fffffff ++#ifdef __MAVERICK__ ++ cfmvsr mvf0, r0 ++#endif + RETc(le) + + @ Shift value right, round, etc. +@@ -530,6 +533,9 @@ + adc r0, r0, #0 + orrs r3, r3, ip, lsl #1 + biceq r0, r0, ip, lsr #31 ++#ifdef __MAVERICK__ ++ cfmvsr mvf0, r0 ++#endif + RET + + @ One or both arguments are denormalized. +@@ -567,6 +573,9 @@ + LSYM(Lml_z): + eor r0, r0, r1 + bic r0, r0, #0x7fffffff ++#ifdef __MAVERICK__ ++ cfmvsr mvf0, r0 ++#endif + RET + + 1: @ One or both args are INF or NAN. +@@ -595,12 +604,18 @@ + and r0, r0, #0x80000000 + orr r0, r0, #0x7f000000 + orr r0, r0, #0x00800000 ++#ifdef __MAVERICK__ ++ cfmvsr mvf0, r0 ++#endif + RET + + @ Return a quiet NAN. + LSYM(Lml_n): + orr r0, r0, #0x7f000000 + orr r0, r0, #0x00c00000 ++#ifdef __MAVERICK__ ++ cfmvsr mvf0, r0 ++#endif + RET + + FUNC_END aeabi_fmul +@@ -677,6 +692,9 @@ + adds r2, r2, #127 + rsbgts r3, r2, #255 + orrgt r0, r0, r2, lsl #23 ++#ifdef __MAVERICK__ ++ cfmvsr mvf0, r0 ++#endif + RETc(gt) + + orr r0, r0, #0x00800000 diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-eabi-ieee754.patch b/packages/gcc/gcc-4.2.3/arm-crunch-eabi-ieee754.patch new file mode 100644 index 0000000000..e4929fa20e --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-eabi-ieee754.patch @@ -0,0 +1,100 @@ +--- ../gcc-cross-4.1.2-r4-unpatched/gcc-4.1.2/gcc/config/arm/ieee754-df.S 2007-06-07 13:06:52.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/ieee754-df.S 2007-06-07 13:15:49.000000000 +1000 +@@ -42,8 +42,9 @@ + + + @ For FPA, float words are always big-endian. ++@ For MAVERICK, float words are always little-endian. + @ For VFP, floats words follow the memory system mode. +-#if defined(__VFP_FP__) && !defined(__ARMEB__) ++#if ((defined(__VFP_FP__) && !defined(__ARMEB__)) || defined(__MAVERICK__)) + #define xl r0 + #define xh r1 + #define yl r2 +@@ -451,8 +452,13 @@ + + orrs r2, r0, r1 + #if !defined (__VFP_FP__) && !defined(__SOFTFP__) ++#if defined (__FPA_FP__) + mvfeqd f0, #0.0 + #endif ++#if defined (__MAVERICK__) ++ cfstrd mvd0, #0.0 ++#endif ++#endif + RETc(eq) + + #if !defined (__VFP_FP__) && !defined(__SOFTFP__) +@@ -473,8 +479,13 @@ + + orrs r2, r0, r1 + #if !defined (__VFP_FP__) && !defined(__SOFTFP__) ++#if defined (__FPA_FP__) + mvfeqd f0, #0.0 + #endif ++#if defined (__MAVERICK__) ++ cfstrd mvd0, #0.0 ++#endif ++#endif + RETc(eq) + + #if !defined (__VFP_FP__) && !defined(__SOFTFP__) +@@ -526,8 +537,14 @@ + @ Legacy code expects the result to be returned in f0. Copy it + @ there as well. + LSYM(f0_ret): ++#if defined (__FPA_FP__) + stmfd sp!, {r0, r1} + ldfd f0, [sp], #8 ++#endif ++#if defined (__MAVERICK__) ++ cfmvdlr mvd0, xl ++ cfmvdhr mvd0, xh ++#endif + RETLDM + + #endif +--- ../gcc-cross-4.1.2-r4-unpatched/gcc-4.1.2/gcc/config/arm/ieee754-sf.S 2007-06-07 13:06:52.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/ieee754-sf.S 2007-06-07 13:21:43.000000000 +1000 +@@ -302,8 +302,13 @@ + + orrs r2, r0, r1 + #if !defined (__VFP_FP__) && !defined(__SOFTFP__) ++#if defined (__FPA_FP__) + mvfeqs f0, #0.0 + #endif ++#if defined (__MAVERICK__) ++ cfmvsr mvf0, #0.0 ++#endif ++#endif + RETc(eq) + + mov r3, #0 +@@ -314,8 +319,13 @@ + + orrs r2, r0, r1 + #if !defined (__VFP_FP__) && !defined(__SOFTFP__) ++#if defined (__FPA_FP__) + mvfeqs f0, #0.0 + #endif ++#if defined (__MAVERICK__) ++ cfmvsr mvf0, #0.0 ++#endif ++#endif + RETc(eq) + + ands r3, ah, #0x80000000 @ sign bit in r3 +@@ -387,8 +397,13 @@ + #if !defined (__VFP_FP__) && !defined(__SOFTFP__) + + LSYM(f0_ret): ++#if defined (__FPA_FP__) + str r0, [sp, #-4]! + ldfs f0, [sp], #4 ++#endif ++#if defined (__MAVERICK__) ++ cfmvsr mvf0, r0 ++#endif + RETLDM + + #endif diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-eabi.patch b/packages/gcc/gcc-4.2.3/arm-crunch-eabi.patch new file mode 100644 index 0000000000..f8992ed499 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-eabi.patch @@ -0,0 +1,64 @@ +--- /home/hwilliams/original/gcc-4.1.2/gcc/config/arm/t-linux-eabi 2005-10-10 11:04:31.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/t-linux-eabi 2007-05-15 13:53:05.000000000 +1000 +@@ -1,11 +1,21 @@ + # These functions are included in shared libraries. + TARGET_LIBGCC2_CFLAGS = -fPIC ++TARGET_LIBGCC2_CFLAGS += -mcpu=ep9312 -mfpu=maverick ++LIBGCC2_DEBUG_CFLAGS = -g0 + + # We do not build a Thumb multilib for Linux because the definition of + # CLEAR_INSN_CACHE in linux-gas.h does not work in Thumb mode. + MULTILIB_OPTIONS = + MULTILIB_DIRNAMES = + ++LIB1ASMSRC = arm/lib1funcs.asm ++LIB1ASMFUNCS += _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \ ++ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ ++ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ ++ _fixsfsi _fixunssfsi ++ ++CRTSTUFF_T_CFLAGS += -mcpu=ep9312 -mfpu=maverick ++ + # Use a version of div0 which raises SIGFPE. + LIB1ASMFUNCS := $(filter-out _dvmd_tls,$(LIB1ASMFUNCS)) _dvmd_lnx + +diff -ruN arm/elf.h gcc-3.4.3/gcc/config/arm/elf.h +--- ../gcc-4.1.2-orig/gcc/config/arm/elf.h 2004-02-24 16:25:22.000000000 +0200 ++++ gcc-4.1.2/gcc/config/arm/elf.h 2005-02-10 00:31:28.000000000 +0200 +@@ -46,7 +46,7 @@ + + #ifndef SUBTARGET_ASM_FLOAT_SPEC + #define SUBTARGET_ASM_FLOAT_SPEC "\ +-%{mapcs-float:-mfloat}" ++%{mapcs-float:-mfloat} %{msoft-float:-mfpu=softfpa} %{mcpu=ep9312:-mfpu=maverick}" + #endif + + #ifndef ASM_SPEC +diff -ruN t-linux gcc-4.1.2/gcc/config/arm/t-linux +--- t-linux 2007-05-09 16:32:28.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/t-linux 2007-05-25 11:02:17.000000000 +1000 +@@ -1,19 +1,22 @@ + # 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 += -mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -D__MAVERICK__ + LIBGCC2_DEBUG_CFLAGS = -g0 + + LIB1ASMSRC = arm/lib1funcs.asm + LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \ + _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ + _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ +- _call_via_rX \ +- _fixsfsi _fixunssfsi _floatdidf _floatdisf ++ _fixsfsi _fixunssfsi + + # MULTILIB_OPTIONS = mhard-float/msoft-float + # MULTILIB_DIRNAMES = hard-float soft-float + + # EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o + ++# EXTRA_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o ++CRTSTUFF_T_CFLAGS += -mcpu=ep9312 -mfpu=maverick -mfloat-abi=softfp -D__MAVERICK__ ++ + # LIBGCC = stmp-multilib + # INSTALL_LIBGCC = install-multilib diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-floatsi-disable-single.patch b/packages/gcc/gcc-4.2.3/arm-crunch-floatsi-disable-single.patch new file mode 100644 index 0000000000..cdd52244a6 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-floatsi-disable-single.patch @@ -0,0 +1,38 @@ +--- gcc-4.1.2/gcc/config/arm/cirrus.md-cfcvt 2007-06-25 12:12:39.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/cirrus.md 2007-06-25 12:16:13.000000000 +1000 +@@ -301,13 +301,14 @@ + ) + + ;; Convert Cirrus-SI to Cirrus-SF ++; appears to be buggy + (define_insn "cirrus_floatsisf2" + [(set (match_operand:SF 0 "cirrus_fp_register" "=v") + (float:SF (match_operand:SI 1 "s_register_operand" "r"))) + (clobber (match_scratch:DF 2 "=v"))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfmv64lr%?\\t%Z2, %1\;cfcvt32s%?\\t%V0, %Y2" + [(set_attr "length" "8") + (set_attr "cirrus" "move")] + ) + +--- gcc-4.1.2/gcc/config/arm/arm.md-cfcvt 2007-06-25 12:16:53.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-25 12:18:20.000000000 +1000 +@@ -3125,14 +3125,15 @@ + + ;; Fixed <--> Floating conversion insns + ++;; Maverick Crunch floatsisf2 is buggy - see cirrus.md + (define_expand "floatsisf2" + [(set (match_operand:SF 0 "s_register_operand" "") + (float:SF (match_operand:SI 1 "s_register_operand" "")))] +- "TARGET_ARM && TARGET_HARD_FLOAT" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" + " +- if (TARGET_MAVERICK) ++ if (TARGET_MAVERICK && 0) + { + emit_insn (gen_cirrus_floatsisf2 (operands[0], operands[1])); + DONE; + } + ") diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-floatsi-disable.patch b/packages/gcc/gcc-4.2.3/arm-crunch-floatsi-disable.patch new file mode 100644 index 0000000000..aa54ec3e04 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-floatsi-disable.patch @@ -0,0 +1,61 @@ +--- gcc-4.1.2/gcc/config/arm/cirrus.md-cfcvt 2007-06-25 12:12:39.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/cirrus.md 2007-06-25 12:16:13.000000000 +1000 +@@ -301,21 +301,23 @@ + ) + + ;; Convert Cirrus-SI to Cirrus-SF ++; appears to be buggy + (define_insn "cirrus_floatsisf2" + [(set (match_operand:SF 0 "cirrus_fp_register" "=v") + (float:SF (match_operand:SI 1 "s_register_operand" "r"))) + (clobber (match_scratch:DF 2 "=v"))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfmv64lr%?\\t%Z2, %1\;cfcvt32s%?\\t%V0, %Y2" + [(set_attr "length" "8") + (set_attr "cirrus" "move")] + ) + ++;appears to be buggy + (define_insn "cirrus_floatsidf2" + [(set (match_operand:DF 0 "cirrus_fp_register" "=v") + (float:DF (match_operand:SI 1 "s_register_operand" "r"))) + (clobber (match_scratch:DF 2 "=v"))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfmv64lr%?\\t%Z2, %1\;cfcvt32d%?\\t%V0, %Y2" + [(set_attr "length" "8") + (set_attr "cirrus" "move")] +--- gcc-4.1.2/gcc/config/arm/arm.md-cfcvt 2007-06-25 12:16:53.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-25 12:18:20.000000000 +1000 +@@ -3125,24 +3125,26 @@ + + ;; Fixed <--> Floating conversion insns + ++;; Maverick Crunch floatsisf2 is buggy - see cirrus.md + (define_expand "floatsisf2" + [(set (match_operand:SF 0 "s_register_operand" "") + (float:SF (match_operand:SI 1 "s_register_operand" "")))] +- "TARGET_ARM && TARGET_HARD_FLOAT" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" + " +- if (TARGET_MAVERICK) ++ if (TARGET_MAVERICK && 0) + { + emit_insn (gen_cirrus_floatsisf2 (operands[0], operands[1])); + DONE; + } + ") + ++;; Maverick Crunch floatsidf2 is buggy - see cirrus.md + (define_expand "floatsidf2" + [(set (match_operand:DF 0 "s_register_operand" "") + (float:DF (match_operand:SI 1 "s_register_operand" "")))] +- "TARGET_ARM && TARGET_HARD_FLOAT" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" + " +- if (TARGET_MAVERICK) ++ if (TARGET_MAVERICK && 0) + { + emit_insn (gen_cirrus_floatsidf2 (operands[0], operands[1])); + DONE; diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-floatunsidf.patch b/packages/gcc/gcc-4.2.3/arm-crunch-floatunsidf.patch new file mode 100644 index 0000000000..2fe2254db9 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-floatunsidf.patch @@ -0,0 +1,37 @@ +--- gcc-4.1.2/gcc/config/arm/ieee754-df-original.S 2007-06-25 14:05:35.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/ieee754-df.S 2007-06-25 14:08:03.000000000 +1000 +@@ -382,6 +382,8 @@ + FUNC_END aeabi_dadd + FUNC_END adddf3 + ++#ifndef __MAVERICK__ /* THIS IS A BAD HACK */ ++ + ARM_FUNC_START floatunsidf + ARM_FUNC_ALIAS aeabi_ui2d floatunsidf + +@@ -401,8 +403,14 @@ + FUNC_END aeabi_ui2d + FUNC_END floatunsidf + ++#endif ++ + ARM_FUNC_START floatsidf + ARM_FUNC_ALIAS aeabi_i2d floatsidf ++#ifdef __MAVERICK__ /* THIS IS A BAD HACK */ ++ARM_FUNC_ALIAS floatunsidf floatsidf ++ARM_FUNC_ALIAS aeabi_ui2d floatsidf ++#endif + + teq r0, #0 + moveq r1, #0 +@@ -418,6 +426,10 @@ + mov xh, #0 + b LSYM(Lad_l) + ++#ifdef __MAVERICK__ /* THIS IS A BAD HACK */ ++ FUNC_END aeabi_ui2d floatsidf ++ FUNC_END floatunsidf floatsidf ++#endif + FUNC_END aeabi_i2d + FUNC_END floatsidf + diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-fp_consts.patch b/packages/gcc/gcc-4.2.3/arm-crunch-fp_consts.patch new file mode 100644 index 0000000000..5f289bbebe --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-fp_consts.patch @@ -0,0 +1,13 @@ +--- gcc-4.1.2/gcc/config/arm/arm.c-original 2007-06-12 16:17:14.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.c 2007-06-12 16:17:28.000000000 +1000 +@@ -5218,7 +5218,9 @@ + int i; + REAL_VALUE_TYPE r; + ++ if (TARGET_MAVERICK) ++ fp_consts_inited = 0; +- if (TARGET_VFP) ++ else if (TARGET_VFP) + fp_consts_inited = 1; + else + fp_consts_inited = 8; diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-neg.patch b/packages/gcc/gcc-4.2.3/arm-crunch-neg.patch new file mode 100644 index 0000000000..f14ae0190e --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-neg.patch @@ -0,0 +1,30 @@ +WARNING: adding this patch causes copysign1.c and mzero3.c to fail... +diff -urN gcc-4.1.2/gcc/config/arm/arm.md-original gcc-4.1.2/gcc/config/arm/arm.md +--- gcc-4.1.2/gcc/config/arm/arm.md-original 2007-06-12 12:48:14.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-12 12:49:53.000000000 +1000 +@@ -2985,14 +2985,14 @@ + (define_expand "negsf2" + [(set (match_operand:SF 0 "s_register_operand" "") + (neg:SF (match_operand:SF 1 "s_register_operand" "")))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "" + ) + + (define_expand "negdf2" + [(set (match_operand:DF 0 "s_register_operand" "") + (neg:DF (match_operand:DF 1 "s_register_operand" "")))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "") + + ;; abssi2 doesn't really clobber the condition codes if a different register +@@ -4097,7 +4097,7 @@ + [(set (match_operand:DI 0 "nonimmediate_di_operand" "=r, r, r, r, m") + (match_operand:DI 1 "di_operand" "rDa,Db,Dc,mi,r"))] + "TARGET_ARM +- && !(TARGET_HARD_FLOAT && (TARGET_MAVERICK || TARGET_VFP)) ++ && !(TARGET_HARD_FLOAT && (TARGET_MAVERICK || TARGET_VFP || TARGET_MAVERICK)) + && !TARGET_IWMMXT" + "* + switch (which_alternative) diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-neg2.patch b/packages/gcc/gcc-4.2.3/arm-crunch-neg2.patch new file mode 100644 index 0000000000..4fd91f3215 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-neg2.patch @@ -0,0 +1,25 @@ +--- gcc-4.1.2/gcc/config/arm/cirrus.md-original 2007-06-12 17:01:24.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/cirrus.md 2007-06-12 17:03:26.000000000 +1000 +@@ -255,18 +256,20 @@ + [(set_attr "cirrus" "normal")] + ) + ++;; appears to be buggy: neg 0 != -0 + (define_insn "*cirrus_negsf2" + [(set (match_operand:SF 0 "cirrus_fp_register" "=v") + (neg:SF (match_operand:SF 1 "cirrus_fp_register" "v")))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfnegs%?\\t%V0, %V1" + [(set_attr "cirrus" "normal")] + ) + ++;; appears to be buggy: neg 0 != -0 + (define_insn "*cirrus_negdf2" + [(set (match_operand:DF 0 "cirrus_fp_register" "=v") + (neg:DF (match_operand:DF 1 "cirrus_fp_register" "v")))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cfnegd%?\\t%V0, %V1" + [(set_attr "cirrus" "normal")] + ) diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-offset.patch b/packages/gcc/gcc-4.2.3/arm-crunch-offset.patch new file mode 100644 index 0000000000..3a40f0d224 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-offset.patch @@ -0,0 +1,20 @@ +--- gcc-4.1.2/gcc/config/arm/arm.c-original 2007-06-12 14:46:20.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.c 2007-06-12 14:48:06.000000000 +1000 +@@ -3460,7 +3460,7 @@ + + use_ldrd = (TARGET_LDRD + && (mode == DImode +- || (mode == DFmode && (TARGET_SOFT_FLOAT || TARGET_VFP)))); ++ || (mode == DFmode && (TARGET_SOFT_FLOAT || TARGET_MAVERICK || TARGET_VFP)))); + + if (code == POST_INC || code == PRE_DEC + || ((code == PRE_INC || code == POST_DEC) +@@ -3960,7 +3960,7 @@ + /* VFP addressing modes actually allow greater offsets, but for + now we just stick with the lowest common denominator. */ + if (mode == DImode +- || ((TARGET_SOFT_FLOAT || TARGET_VFP) && mode == DFmode)) ++ || ((TARGET_SOFT_FLOAT || TARGET_MAVERICK || TARGET_VFP) && mode == DFmode)) + { + low_n = n & 0x0f; + n &= ~0x0f; diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-predicates.patch b/packages/gcc/gcc-4.2.3/arm-crunch-predicates.patch new file mode 100644 index 0000000000..4841ff8178 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-predicates.patch @@ -0,0 +1,20 @@ +diff -urN gcc-4.1.2/gcc/config/arm/predicates.md ../../../../old-tmp/work/arm-oabi-angstrom-linux/gcc-cross-4.1.2-backup/gcc-4.1.2/gcc/config/arm/predicates.md +--- gcc-4.1.2/gcc/config/arm/predicates.md 2005-09-11 17:38:02.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/predicates.md 2007-05-30 12:15:54.000000000 +1000 +@@ -171,8 +171,14 @@ + (match_code "eq,ne")) + + ;; True for comparisons other than LTGT or UNEQ. ++(define_special_predicate "arm_comparison_operator" ++; (match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltu,unordered,ordered,unlt,unle,unge,ungt")) ;; original - no LTGT or UNEQ ++; (match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltgt,ltu,unordered,ordered,uneq,unlt,unle,unge,ungt")) ;; everything? ++;; True for comparisons other than GE, GEU, UNLT, unordered or ordered. - Cirrus Version - must include ge? +-(define_special_predicate "arm_comparison_operator" ++;(define_special_predicate "arm_comparison_operator" +- (match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltu,unordered,ordered,unlt,unle,unge,ungt")) ++(match_code "eq,ne,le,lt,ge,geu,gt,gtu,leu,ltgt,ltu,uneq,unle,unge,ungt")) ;; bad codes removed? ++;(match_code "eq,ne,le,lt,gt,gtu,leu,ltgt,ltu,uneq,unle,unge,ungt")) ;; bad codes removed + ge / geu removed ++ + + (define_special_predicate "minmax_operator" + (and (match_code "smin,smax,umin,umax") diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-predicates2.patch b/packages/gcc/gcc-4.2.3/arm-crunch-predicates2.patch new file mode 100644 index 0000000000..3e01158fe1 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-predicates2.patch @@ -0,0 +1,10 @@ +--- gcc-4.1.2/gcc/config/arm/predicates.md-original 2007-06-13 12:25:35.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/predicates.md 2007-06-13 12:25:42.000000000 +1000 +@@ -206,7 +206,6 @@ + || mode == CC_DEQmode + || mode == CC_DLEmode + || mode == CC_DLTmode +- || mode == CC_DGEmode + || mode == CC_DGTmode + || mode == CC_DLEUmode + || mode == CC_DLTUmode diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-predicates3.patch b/packages/gcc/gcc-4.2.3/arm-crunch-predicates3.patch new file mode 100644 index 0000000000..99e1e6c88c --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-predicates3.patch @@ -0,0 +1,116 @@ +diff -urN ../gcc-cross-4.1.2-r4/gcc-4.1.2/gcc/config/arm/arm.md gcc-4.1.2/gcc/config/arm/arm.md +--- ../gcc-cross-4.1.2-r4/gcc-4.1.2/gcc/config/arm/arm.md 2007-06-14 11:50:53.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-14 11:43:17.000000000 +1000 +@@ -7488,6 +7488,22 @@ + arm_compare_op1);" + ) + ++;(define_expand "suneq" ++; [(set (match_operand:SI 0 "s_register_operand" "") ++; (uneq:SI (match_dup 1) (const_int 0)))] ++; "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)" ++; "operands[1] = arm_gen_compare_reg (UNEQ, arm_compare_op0, ++; arm_compare_op1);" ++;) ++ ++;(define_expand "sltgt" ++; [(set (match_operand:SI 0 "s_register_operand" "") ++; (ltgt:SI (match_dup 1) (const_int 0)))] ++; "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_MAVERICK)" ++; "operands[1] = arm_gen_compare_reg (LTGT, arm_compare_op0, ++; arm_compare_op1);" ++;) ++ + ;;; DO NOT add patterns for SUNEQ or SLTGT, these can't be represented with + ;;; simple ARM instructions. + ; +@@ -10284,13 +10284,73 @@ + "TARGET_ARM && arm_arch5e" + "pld\\t%a0") + ++;; Special predication pattern for Maverick Crunch floating-point ++ ++(define_cond_exec ++ [(match_operator 0 "maverick_comparison_operator" ++ [(match_operand:CCFP 1 "cc_register" "") ++ (const_int 0)])] ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "" ++) ++ ++;; Special predication pattern for Maverick Crunch - !CCFP ++ ++(define_cond_exec ++ [(match_operator 0 "arm_comparison_operator" ++ [(match_operand:CC_NOOV 1 "cc_register" "") ++ (const_int 0)])] ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "" ++) ++ ++(define_cond_exec ++ [(match_operator 0 "arm_comparison_operator" ++ [(match_operand:CC_Z 1 "cc_register" "") ++ (const_int 0)])] ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "" ++) ++ ++(define_cond_exec ++ [(match_operator 0 "arm_comparison_operator" ++ [(match_operand:CC_SWP 1 "cc_register" "") ++ (const_int 0)])] ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "" ++) ++ ++(define_cond_exec ++ [(match_operator 0 "arm_comparison_operator" ++ [(match_operand:CC_C 1 "cc_register" "") ++ (const_int 0)])] ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "" ++) ++ ++(define_cond_exec ++ [(match_operator 0 "arm_comparison_operator" ++ [(match_operand:CC_N 1 "cc_register" "") ++ (const_int 0)])] ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "" ++) ++ ++(define_cond_exec ++ [(match_operator 0 "arm_comparison_operator" ++ [(match_operand:CC 1 "cc_register" "") ++ (const_int 0)])] ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "" ++) ++ + ;; General predication pattern + + (define_cond_exec + [(match_operator 0 "arm_comparison_operator" + [(match_operand 1 "cc_register" "") + (const_int 0)])] +- "TARGET_ARM" ++ "TARGET_ARM && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)" + "" + ) + +diff -urN ../gcc-cross-4.1.2-r4/gcc-4.1.2/gcc/config/arm/predicates.md gcc-4.1.2/gcc/config/arm/predicates.md +--- ../gcc-cross-4.1.2-r4/gcc-4.1.2/gcc/config/arm/predicates.md 2005-09-11 17:38:02.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/predicates.md 2007-06-14 11:46:13.000000000 +1000 +@@ -172,7 +172,11 @@ + + ;; True for comparisons other than LTGT or UNEQ. + (define_special_predicate "arm_comparison_operator" + (match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltu,unordered,ordered,unlt,unle,unge,ungt")) ++ ++;; True for comparisons other than GE, GEU, UNLT, UNORDERED or ORDERED - TODO add LTGT and UNEQ - needs extra support elsewhere ++(define_special_predicate "maverick_comparison_operator" ++(match_code "eq,ne,le,lt,gt,gtu,leu,ltu,unle,unge,ungt")) + + (define_special_predicate "minmax_operator" + (and (match_code "smin,smax,umin,umax") diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-saveregs.patch b/packages/gcc/gcc-4.2.3/arm-crunch-saveregs.patch new file mode 100644 index 0000000000..531ae86610 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-saveregs.patch @@ -0,0 +1,153 @@ +diff -ruN /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.c gcc-4.1.2/gcc/config/arm/arm.c +--- /home/hwilliams/openembedded/build/tmp/work/ep9312-angstrom-linux-gnueabi/gcc-cross-4.1.2-r0/gcc-4.1.2/gcc/config/arm/arm.c 2007-05-09 16:32:29.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.c 2007-05-15 09:39:41.000000000 +1000 +@@ -426,7 +435,7 @@ + #define FL_STRONG (1 << 8) /* StrongARM */ + #define FL_ARCH5E (1 << 9) /* DSP extensions to v5 */ + #define FL_XSCALE (1 << 10) /* XScale */ +-#define FL_CIRRUS (1 << 11) /* Cirrus/DSP. */ ++#define FL_CIRRUS (1 << 11) /* Cirrus Crunch coprocessor. */ + #define FL_ARCH6 (1 << 12) /* Architecture rel 6. Adds + media instructions. */ + #define FL_VFPV2 (1 << 13) /* Vector Floating Point V2. */ +@@ -490,7 +499,7 @@ + /* Nonzero if this chip is a StrongARM. */ + int arm_tune_strongarm = 0; + +-/* Nonzero if this chip is a Cirrus variant. */ ++/* Nonzero if this chip supports Cirrus Crunch coprocessor. */ + int arm_arch_cirrus = 0; + + /* Nonzero if this chip supports Intel Wireless MMX technology. */ +@@ -1184,7 +1193,8 @@ + else + */ + if (arm_arch_cirrus) +- arm_fpu_arch = FPUTYPE_MAVERICK; ++ /* Cirrus crunch coprocessor still requires soft-float division. */ ++ arm_fpu_arch = FPUTYPE_MAVERICK; + else + arm_fpu_arch = FPUTYPE_FPA_EMU2; + #endif +@@ -1567,6 +1577,9 @@ + if (regs_ever_live[regno] && !call_used_regs[regno]) + return 0; + ++ if (TARGET_MAVERICK) ++ return 0; ++ + if (TARGET_REALLY_IWMMXT) + for (regno = FIRST_IWMMXT_REGNUM; regno <= LAST_IWMMXT_REGNUM; regno++) + if (regs_ever_live[regno] && ! call_used_regs [regno]) +@@ -9775,7 +9886,19 @@ + /* This variable is for the Virtual Frame Pointer, not VFP regs. */ + int vfp_offset = offsets->frame; + +- if (arm_fpu_arch == FPUTYPE_FPA_EMU2) ++ if (arm_fpu_arch == FPUTYPE_MAVERICK) ++ { ++ for (reg = LAST_CIRRUS_FP_REGNUM; reg >= FIRST_CIRRUS_FP_REGNUM; reg--) ++ if (regs_ever_live[reg] && !call_used_regs[reg]) ++ { ++ floats_offset += 8; /* more problems - futaris? */ ++ /* if (TARGET_CIRRUS_D0 || TARGET_CIRRUS_D1) */ ++ asm_fprintf (f, "\tnop\n"); ++ asm_fprintf (f, "\tcfldrd\tmvd%d, [%r, #-%d]\n", ++ reg - FIRST_CIRRUS_FP_REGNUM, FP_REGNUM, floats_offset - vfp_offset); ++ } ++ } ++ else if (arm_fpu_arch == FPUTYPE_FPA_EMU2) + { + for (reg = LAST_FPA_REGNUM; reg >= FIRST_FPA_REGNUM; reg--) + if (regs_ever_live[reg] && !call_used_regs[reg]) +@@ -9924,7 +10047,18 @@ + output_add_immediate (operands); + } + +- if (arm_fpu_arch == FPUTYPE_FPA_EMU2) ++ if (arm_fpu_arch == FPUTYPE_MAVERICK) ++ { /* order changed - futaris */ ++ for (reg = FIRST_CIRRUS_FP_REGNUM; reg <= LAST_CIRRUS_FP_REGNUM; reg++) ++ if (regs_ever_live[reg] && !call_used_regs[reg]) ++ { ++ /* if (TARGET_CIRRUS_D0 || TARGET_CIRRUS_D1) */ ++ asm_fprintf (f, "\tnop\n"); ++ asm_fprintf (f, "\tcfldrd\tmvd%u, [%r], #8\n", ++ reg - FIRST_CIRRUS_FP_REGNUM, SP_REGNUM); ++ } /* reg problems - futaris */ ++ } ++ else if (arm_fpu_arch == FPUTYPE_FPA_EMU2) + { + for (reg = FIRST_FPA_REGNUM; reg <= LAST_FPA_REGNUM; reg++) + if (regs_ever_live[reg] && !call_used_regs[reg]) +@@ -10429,9 +10563,19 @@ + if (! IS_VOLATILE (func_type)) + { ++ /* Space for saved MAVERICK registers. */ ++ if (arm_fpu_arch == FPUTYPE_MAVERICK) ++ { ++ for (regno = FIRST_CIRRUS_FP_REGNUM; regno <= LAST_CIRRUS_FP_REGNUM; regno++) ++ if (regs_ever_live[regno] && !call_used_regs[regno]) ++ saved += 8; // 8 in 3.4.3 patch - futaris; ++ } ++ else + /* Space for saved FPA registers. */ ++ { + for (regno = FIRST_FPA_REGNUM; regno <= LAST_FPA_REGNUM; regno++) + if (regs_ever_live[regno] && ! call_used_regs[regno]) + saved += 12; ++ } + + /* Space for saved VFP registers. */ + if (TARGET_HARD_FLOAT && TARGET_VFP) +@@ -10739,7 +10882,19 @@ + + /* Save any floating point call-saved registers used by this + function. */ +- if (arm_fpu_arch == FPUTYPE_FPA_EMU2) ++ if (arm_fpu_arch == FPUTYPE_MAVERICK) ++ { ++ for (reg = LAST_CIRRUS_FP_REGNUM; reg >= FIRST_CIRRUS_FP_REGNUM; reg--) ++ if (regs_ever_live[reg] && !call_used_regs[reg]) ++ { ++ insn = gen_rtx_PRE_DEC (DFmode, stack_pointer_rtx); /* think these causes problems */ ++ insn = gen_rtx_MEM (DFmode, insn); ++ insn = emit_insn (gen_rtx_SET (VOIDmode, insn, ++ gen_rtx_REG (DFmode, reg))); ++ RTX_FRAME_RELATED_P (insn) = 1; saved_regs += 8; /* added by futaris */ ++ } ++ } ++ else if (arm_fpu_arch == FPUTYPE_FPA_EMU2) + { + for (reg = LAST_FPA_REGNUM; reg >= FIRST_FPA_REGNUM; reg--) + if (regs_ever_live[reg] && !call_used_regs[reg]) +@@ -15179,6 +15331,9 @@ + if (IS_FPA_REGNUM (regno)) + return (TARGET_AAPCS_BASED ? 96 : 16) + regno - FIRST_FPA_REGNUM; + ++ if (IS_CIRRUS_REGNUM (regno)) ++ return 28 + regno - FIRST_CIRRUS_FP_REGNUM; ++ + if (IS_VFP_REGNUM (regno)) + return 64 + regno - FIRST_VFP_REGNUM; + +--- gcc-4.1.2/gcc/config/arm/arm.md-original 2007-06-28 15:42:36.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-28 15:42:48.000000000 +1000 +@@ -9800,7 +9800,7 @@ + return arm_output_epilogue (next_nonnote_insn (insn)); + " + ;; Length is absolute worst case +- [(set_attr "length" "44") ++ [(set_attr "length" "108") + (set_attr "type" "block") + ;; We don't clobber the conditions, but the potential length of this + ;; operation is sufficient to make conditionalizing the sequence +@@ -9818,7 +9818,7 @@ + return thumb_unexpanded_epilogue (); + " + ; Length is absolute worst case +- [(set_attr "length" "44") ++ [(set_attr "length" "108") + (set_attr "type" "block") + ;; We don't clobber the conditions, but the potential length of this + ;; operation is sufficient to make conditionalizing the sequence diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-scc.patch b/packages/gcc/gcc-4.2.3/arm-crunch-scc.patch new file mode 100644 index 0000000000..d1330f2543 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-scc.patch @@ -0,0 +1,38 @@ +--- gcc-4.1.2/gcc/config/arm/arm.md-original 2007-06-13 12:38:06.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-13 12:40:07.000000000 +1000 +@@ -7375,7 +7375,7 @@ + (define_expand "sge" + [(set (match_operand:SI 0 "s_register_operand" "") + (ge:SI (match_dup 1) (const_int 0)))] +- "TARGET_ARM && !(TARGET_HARD_FLOAT && TARGET_MAVERICK)" ++ "TARGET_ARM" + "operands[1] = arm_gen_compare_reg (GE, arm_compare_op0, arm_compare_op1);" + ) + +@@ -7434,7 +7434,7 @@ + (define_expand "sunordered" + [(set (match_operand:SI 0 "s_register_operand" "") + (unordered:SI (match_dup 1) (const_int 0)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (UNORDERED, arm_compare_op0, + arm_compare_op1);" + ) +@@ -7442,7 +7442,7 @@ + (define_expand "sordered" + [(set (match_operand:SI 0 "s_register_operand" "") + (ordered:SI (match_dup 1) (const_int 0)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (ORDERED, arm_compare_op0, + arm_compare_op1);" + ) +@@ -7467,7 +7467,7 @@ + (define_expand "sunlt" + [(set (match_operand:SI 0 "s_register_operand" "") + (unlt:SI (match_dup 1) (const_int 0)))] +- "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP || TARGET_MAVERICK)" + "operands[1] = arm_gen_compare_reg (UNLT, arm_compare_op0, + arm_compare_op1);" + ) diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-truncsi-disable-new.patch b/packages/gcc/gcc-4.2.3/arm-crunch-truncsi-disable-new.patch new file mode 100644 index 0000000000..6dea43fa7c --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-truncsi-disable-new.patch @@ -0,0 +1,33 @@ +--- gcc-4.1.2/gcc/config/arm/cirrus.md-cfcvt 2007-06-25 12:46:22.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/cirrus.md 2007-06-25 12:46:41.000000000 +1000 +@@ -337,13 +337,14 @@ + "cfcvt64d%?\\t%V0, %V1" + [(set_attr "cirrus" "normal")]) + ++; appears to be buggy + (define_insn "cirrus_truncsfsi2" + [(set (match_operand:SI 0 "s_register_operand" "=r") + (fix:SI (fix:SF (match_operand:SF 1 "cirrus_fp_register" "v")))) + (clobber (match_scratch:DF 2 "=v"))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cftruncs32%?\\t%Y2, %V1\;cfmvr64l%?\\t%0, %Z2" + [(set_attr "length" "8") + (set_attr "cirrus" "normal")] + ) + +--- gcc-4.1.2/gcc/config/arm/arm.md-cfcvt 2007-06-25 12:46:56.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-25 12:48:08.000000000 +1000 +@@ -3151,10 +3151,11 @@ + } + ") + ++; appears to be buggy for MAVERICK + (define_expand "fix_truncsfsi2" + [(set (match_operand:SI 0 "s_register_operand" "") + (fix:SI (fix:SF (match_operand:SF 1 "s_register_operand" ""))))] +- "TARGET_ARM && TARGET_HARD_FLOAT" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" + " + if (TARGET_MAVERICK) + { diff --git a/packages/gcc/gcc-4.2.3/arm-crunch-truncsi-disable.patch b/packages/gcc/gcc-4.2.3/arm-crunch-truncsi-disable.patch new file mode 100644 index 0000000000..a5d791a0a4 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-crunch-truncsi-disable.patch @@ -0,0 +1,56 @@ +--- gcc-4.1.2/gcc/config/arm/cirrus.md-cfcvt 2007-06-25 12:46:22.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/cirrus.md 2007-06-25 12:46:41.000000000 +1000 +@@ -337,21 +337,23 @@ + "cfcvt64d%?\\t%V0, %V1" + [(set_attr "cirrus" "normal")]) + ++; appears to be buggy + (define_insn "cirrus_truncsfsi2" + [(set (match_operand:SI 0 "s_register_operand" "=r") + (fix:SI (fix:SF (match_operand:SF 1 "cirrus_fp_register" "v")))) + (clobber (match_scratch:DF 2 "=v"))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cftruncs32%?\\t%Y2, %V1\;cfmvr64l%?\\t%0, %Z2" + [(set_attr "length" "8") + (set_attr "cirrus" "normal")] + ) + ++; appears to be buggy + (define_insn "cirrus_truncdfsi2" + [(set (match_operand:SI 0 "s_register_operand" "=r") + (fix:SI (fix:DF (match_operand:DF 1 "cirrus_fp_register" "v")))) + (clobber (match_scratch:DF 2 "=v"))] +- "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK" ++ "TARGET_ARM && TARGET_HARD_FLOAT && TARGET_MAVERICK && 0" + "cftruncd32%?\\t%Y2, %V1\;cfmvr64l%?\\t%0, %Z2" + [(set_attr "length" "8") + (set_attr "cirrus" "normal")] +--- gcc-4.1.2/gcc/config/arm/arm.md-cfcvt 2007-06-25 12:46:56.000000000 +1000 ++++ gcc-4.1.2/gcc/config/arm/arm.md 2007-06-25 12:48:08.000000000 +1000 +@@ -3151,10 +3151,11 @@ + } + ") + ++; appears to be buggy for MAVERICK + (define_expand "fix_truncsfsi2" + [(set (match_operand:SI 0 "s_register_operand" "") + (fix:SI (fix:SF (match_operand:SF 1 "s_register_operand" ""))))] +- "TARGET_ARM && TARGET_HARD_FLOAT" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" + " + if (TARGET_MAVERICK) + { +@@ -3167,10 +3168,11 @@ + } + ") + ++; appears to be buggy for MAVERICK + (define_expand "fix_truncdfsi2" + [(set (match_operand:SI 0 "s_register_operand" "") + (fix:SI (fix:DF (match_operand:DF 1 "s_register_operand" ""))))] +- "TARGET_ARM && TARGET_HARD_FLOAT" ++ "TARGET_ARM && TARGET_HARD_FLOAT && (TARGET_FPA || TARGET_VFP)" + " + if (TARGET_MAVERICK) + { diff --git a/packages/gcc/gcc-4.2.3/arm-nolibfloat.patch b/packages/gcc/gcc-4.2.3/arm-nolibfloat.patch new file mode 100644 index 0000000000..c4897c0330 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/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 + +Index: gcc-4.0.2/gcc/config/arm/linux-elf.h +=================================================================== +--- gcc-4.0.2.orig/gcc/config/arm/linux-elf.h 2005-03-04 16:14:01.000000000 +0000 ++++ gcc-4.0.2/gcc/config/arm/linux-elf.h 2005-11-11 18:02:54.000000000 +0000 +@@ -56,7 +56,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-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/packages/gcc/gcc-4.2.3/arm-softfloat.patch b/packages/gcc/gcc-4.2.3/arm-softfloat.patch new file mode 100644 index 0000000000..5e1edd9208 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-softfloat.patch @@ -0,0 +1,16 @@ +Index: gcc-4.0.2/gcc/config/arm/t-linux +=================================================================== +--- gcc-4.0.2.orig/gcc/config/arm/t-linux 2004-05-15 12:41:35.000000000 +0000 ++++ gcc-4.0.2/gcc/config/arm/t-linux 2005-11-11 16:07:53.000000000 +0000 +@@ -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 _floatdidf _floatdisf _floatundisf _floatundidf + + # MULTILIB_OPTIONS = mhard-float/msoft-float + # MULTILIB_DIRNAMES = hard-float soft-float diff --git a/packages/gcc/gcc-4.2.3/arm-thumb-cache.patch b/packages/gcc/gcc-4.2.3/arm-thumb-cache.patch new file mode 100644 index 0000000000..fa63846c8c --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-thumb-cache.patch @@ -0,0 +1,29 @@ +--- gcc-4.1.1/gcc/config/arm/linux-gas.h- 2005-06-25 03:22:41.000000000 +0200 ++++ gcc-4.1.1/gcc/config/arm/linux-gas.h 2006-06-18 10:23:46.000000000 +0200 +@@ -44,6 +44,7 @@ + + /* Clear the instruction cache from `beg' to `end'. This makes an + inline system call to SYS_cacheflush. */ ++#if !defined(__thumb__) + #define CLEAR_INSN_CACHE(BEG, END) \ + { \ + register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \ +@@ -53,3 +54,18 @@ + : "=r" (_beg) \ + : "0" (_beg), "r" (_end), "r" (_flg)); \ + } ++#else ++#define CLEAR_INSN_CACHE(BEG, END) \ ++{ \ ++ 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; \ ++ register unsigned long _swi __asm ("a4") = 0xf0002; \ ++ __asm __volatile ("push {r7}\n" \ ++ " mov r7,a4\n" \ ++ " swi 0 @ sys_cacheflush\n" \ ++ " pop {r7}\n" \ ++ : "=r" (_beg) \ ++ : "0" (_beg), "r" (_end), "r" (_flg), "r" (_swi)); \ ++} ++#endif diff --git a/packages/gcc/gcc-4.2.3/arm-thumb.patch b/packages/gcc/gcc-4.2.3/arm-thumb.patch new file mode 100644 index 0000000000..016a7a550b --- /dev/null +++ b/packages/gcc/gcc-4.2.3/arm-thumb.patch @@ -0,0 +1,64 @@ + +# +# Patch managed by http://www.holgerschurig.de/patcher.html +# + +--- gcc-4.1.1/gcc/config/arm/lib1funcs.asm~gcc ++++ gcc-4.1.1/gcc/config/arm/lib1funcs.asm +@@ -995,10 +995,24 @@ + .code 32 + FUNC_START div0 + ++#if ! defined __thumb__ + stmfd sp!, {r1, lr} + mov r0, #SIGFPE + bl SYM(raise) __PLT__ + RETLDM r1 ++#else ++ push {r1, lr} ++ mov r0, #SIGFPE ++ bl SYM(raise) __PLT__ ++#if __ARM_ARCH__ > 4 ++ pop {r1, pc} ++#else ++ @ on 4T that won't work ++ pop {r1} ++ pop {r3} ++ bx r3 ++#endif ++#endif + + FUNC_END div0 + +@@ -1141,11 +1155,12 @@ + code here switches to the correct mode before executing the function. */ + + .text +- .align 0 ++ .align 1 + .force_thumb + + .macro call_via register + THUMB_FUNC_START _call_via_\register ++ .hidden SYM (_call_via_\register) + + bx \register + nop +@@ -1242,6 +1257,7 @@ + .code 16 + + THUMB_FUNC_START _interwork_call_via_\register ++ .hidden SYM (_interwork_call_via_\register) + + bx pc + nop +--- gcc-4.1.1/gcc/config/arm/t-linux~gcc ++++ gcc-4.1.1/gcc/config/arm/t-linux +@@ -7,6 +7,7 @@ + LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \ + _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ + _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ ++ _call_via_rX \ + _fixsfsi _fixunssfsi _floatdidf _floatdisf _floatundisf _floatundidf + + # MULTILIB_OPTIONS = mhard-float/msoft-float diff --git a/packages/gcc/gcc-4.2.3/cache-amnesia.patch b/packages/gcc/gcc-4.2.3/cache-amnesia.patch new file mode 100644 index 0000000000..ef7cd111c5 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/cache-amnesia.patch @@ -0,0 +1,13 @@ +diff --git a/gcc/configure b/gcc/configure +index 44620ab..6e1830c 100755 +--- a/gcc/configure ++++ b/gcc/configure +@@ -12272,7 +12272,7 @@ else + esac + saved_CFLAGS="${CFLAGS}" + CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ +- ${realsrcdir}/configure \ ++ CONFIG_SITE= ${realsrcdir}/configure --cache-file=./other.cache \ + --enable-languages=${enable_languages-all} \ + --target=$target_alias --host=$build_alias --build=$build_alias + CFLAGS="${saved_CFLAGS}" diff --git a/packages/gcc/gcc-4.2.3/fix-ICE-in-arm_unwind_emit_set.diff b/packages/gcc/gcc-4.2.3/fix-ICE-in-arm_unwind_emit_set.diff new file mode 100644 index 0000000000..568e15abff --- /dev/null +++ b/packages/gcc/gcc-4.2.3/fix-ICE-in-arm_unwind_emit_set.diff @@ -0,0 +1,18 @@ +--- trunk/gcc/config/arm/arm.c 2006/09/19 13:18:27 117055 ++++ trunk/gcc/config/arm/arm.c 2006/09/19 13:19:24 117056 +@@ -15415,6 +15415,15 @@ + /* Move from sp to reg. */ + asm_fprintf (asm_out_file, "\t.movsp %r\n", REGNO (e0)); + } ++ else if (GET_CODE (e1) == PLUS ++ && GET_CODE (XEXP (e1, 0)) == REG ++ && REGNO (XEXP (e1, 0)) == SP_REGNUM ++ && GET_CODE (XEXP (e1, 1)) == CONST_INT) ++ { ++ /* Set reg to offset from sp. */ ++ asm_fprintf (asm_out_file, "\t.movsp %r, #%d\n", ++ REGNO (e0), (int)INTVAL(XEXP (e1, 1))); ++ } + else + abort (); + break; diff --git a/packages/gcc/gcc-4.2.3/fortran-cross-compile-hack.patch b/packages/gcc/gcc-4.2.3/fortran-cross-compile-hack.patch new file mode 100644 index 0000000000..b3d38ad983 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/fortran-cross-compile-hack.patch @@ -0,0 +1,30 @@ +* Fortran would have searched for arm-angstrom-gnueabi-gfortran but would have used + used gfortan. For gcc_4.2.2.bb we want to use the gfortran compiler from our cross + directory. + +diff --git a/libgfortran/configure b/libgfortran/configure +index f7d86fb..d0966ec 100755 +--- a/libgfortran/configure ++++ b/libgfortran/configure +@@ -4475,6 +4475,6 @@ exec 5>>./config.log + + # We need gfortran to compile parts of the library + #AC_PROG_FC(gfortran) +-FC="$GFORTRAN" ++#FC="$GFORTRAN" + ac_ext=${FC_SRCEXT-f} + ac_compile='$FC -c $FCFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext >&5' +\ No newline at end of file +diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac +index 4661306..9f83e55 100644 +--- a/libgfortran/configure.ac ++++ b/libgfortran/configure.ac +@@ -140,7 +140,7 @@ AC_SUBST(enable_static) + + # We need gfortran to compile parts of the library + #AC_PROG_FC(gfortran) +-FC="$GFORTRAN" ++#FC="$GFORTRAN" + AC_PROG_FC(gfortran) + + # extra LD Flags which are required for targets diff --git a/packages/gcc/gcc-4.2.3/fortran-static-linking.patch b/packages/gcc/gcc-4.2.3/fortran-static-linking.patch new file mode 100644 index 0000000000..3dd6321dc3 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/fortran-static-linking.patch @@ -0,0 +1,48 @@ +f951 (fortran) links to MPFR and GMP of our staging area but when executing +the command the libs can not be found. Use rpath like all the other apps in +our staging bin/ directory. + +Patch the configure to avoid the regeneration... + +Index: gcc-4.2.2/configure +=================================================================== +--- gcc-4.2.2.orig/configure 2008-01-15 23:23:41.000000000 +0100 ++++ gcc-4.2.2/configure 2008-01-15 23:25:20.000000000 +0100 +@@ -2278,14 +2278,14 @@ + + + if test "x$with_mpfr" != x; then +- gmplibs="-L$with_mpfr/lib $gmplibs" ++ gmplibs="-static -L$with_mpfr/lib $gmplibs" + gmpinc="-I$with_mpfr/include" + fi + if test "x$with_mpfr_include" != x; then + gmpinc="-I$with_mpfr_include" + fi + if test "x$with_mpfr_lib" != x; then +- gmplibs="-L$with_mpfr_lib $gmplibs" ++ gmplibs="-static -L$with_mpfr_lib $gmplibs" + fi + + # Specify a location for gmp +Index: gcc-4.2.2/configure.in +=================================================================== +--- gcc-4.2.2.orig/configure.in 2008-01-15 23:23:41.000000000 +0100 ++++ gcc-4.2.2/configure.in 2008-01-15 23:24:36.000000000 +0100 +@@ -1066,14 +1066,14 @@ + AC_ARG_WITH(mpfr_lib, [ --with-mpfr-lib=PATH Specify the directory for the installed MPFR library]) + + if test "x$with_mpfr" != x; then +- gmplibs="-L$with_mpfr/lib $gmplibs" ++ gmplibs="-static -L$with_mpfr/lib $gmplibs" + gmpinc="-I$with_mpfr/include" + fi + if test "x$with_mpfr_include" != x; then + gmpinc="-I$with_mpfr_include" + fi + if test "x$with_mpfr_lib" != x; then +- gmplibs="-L$with_mpfr_lib $gmplibs" ++ gmplibs="-static -L$with_mpfr_lib $gmplibs" + fi + + # Specify a location for gmp diff --git a/packages/gcc/gcc-4.2.3/gcc-4.0.2-e300c2c3.patch b/packages/gcc/gcc-4.2.3/gcc-4.0.2-e300c2c3.patch new file mode 100644 index 0000000000..736ac4b6b6 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/gcc-4.0.2-e300c2c3.patch @@ -0,0 +1,311 @@ +Adds support for Freescale Power architecture e300c2 and e300c3 cores. +http://www.bitshrine.org/gpp/tc-fsl-x86lnx-e300c3-nptl-4.0.2-2.src.rpm + +Leon Woestenberg <leonw@mailcan.com> + +Index: gcc-4.1.2/gcc/config/rs6000/e300c2c3.md +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gcc-4.1.2/gcc/config/rs6000/e300c2c3.md 2007-10-18 15:32:51.000000000 +0200 +@@ -0,0 +1,189 @@ ++;; Pipeline description for Motorola PowerPC e300c3 core. ++;; Copyright (C) 2003 Free Software Foundation, Inc. ++;; ++;; This file is part of GCC. ++ ++;; GCC 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. ++ ++;; GCC 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 GCC; see the file COPYING. If not, write to the ++;; Free Software Foundation, 59 Temple Place - Suite 330, Boston, ++;; MA 02111-1307, USA. ++ ++(define_automaton "ppce300c3_most,ppce300c3_long,ppce300c3_retire") ++(define_cpu_unit "ppce300c3_decode_0,ppce300c3_decode_1" "ppce300c3_most") ++ ++;; We don't simulate general issue queue (GIC). If we have SU insn ++;; and then SU1 insn, they can not be issued on the same cycle ++;; (although SU1 insn and then SU insn can be issued) because the SU ++;; insn will go to SU1 from GIC0 entry. Fortunately, the first cycle ++;; multipass insn scheduling will find the situation and issue the SU1 ++;; insn and then the SU insn. ++(define_cpu_unit "ppce300c3_issue_0,ppce300c3_issue_1" "ppce300c3_most") ++ ++;; We could describe completion buffers slots in combination with the ++;; retirement units and the order of completion but the result ++;; automaton would behave in the same way because we can not describe ++;; real latency time with taking in order completion into account. ++;; Actually we could define the real latency time by querying reserved ++;; automaton units but the current scheduler uses latency time before ++;; issuing insns and making any reservations. ++;; ++;; So our description is aimed to achieve a insn schedule in which the ++;; insns would not wait in the completion buffer. ++(define_cpu_unit "ppce300c3_retire_0,ppce300c3_retire_1" "ppce300c3_retire") ++ ++;; Branch unit: ++(define_cpu_unit "ppce300c3_bu" "ppce300c3_most") ++ ++;; IU: ++(define_cpu_unit "ppce300c3_iu0_stage0,ppce300c3_iu1_stage0" "ppce300c3_most") ++ ++;; IU: This used to describe non-pipelined division. ++(define_cpu_unit "ppce300c3_mu_div" "ppce300c3_long") ++ ++;; SRU: ++(define_cpu_unit "ppce300c3_sru_stage0" "ppce300c3_most") ++ ++;; Here we simplified LSU unit description not describing the stages. ++(define_cpu_unit "ppce300c3_lsu" "ppce300c3_most") ++ ++;; FPU: ++(define_cpu_unit "ppce300c3_fpu" "ppce300c3_most") ++ ++;; The following units are used to make automata deterministic ++(define_cpu_unit "present_ppce300c3_decode_0" "ppce300c3_most") ++(define_cpu_unit "present_ppce300c3_issue_0" "ppce300c3_most") ++(define_cpu_unit "present_ppce300c3_retire_0" "ppce300c3_retire") ++(define_cpu_unit "present_ppce300c3_iu0_stage0" "ppce300c3_most") ++ ++;; The following sets to make automata deterministic when option ndfa is used. ++(presence_set "present_ppce300c3_decode_0" "ppce300c3_decode_0") ++(presence_set "present_ppce300c3_issue_0" "ppce300c3_issue_0") ++(presence_set "present_ppce300c3_retire_0" "ppce300c3_retire_0") ++(presence_set "present_ppce300c3_iu0_stage0" "ppce300c3_iu0_stage0") ++ ++;; Some useful abbreviations. ++(define_reservation "ppce300c3_decode" ++ "ppce300c3_decode_0|ppce300c3_decode_1+present_ppce300c3_decode_0") ++(define_reservation "ppce300c3_issue" ++ "ppce300c3_issue_0|ppce300c3_issue_1+present_ppce300c3_issue_0") ++(define_reservation "ppce300c3_retire" ++ "ppce300c3_retire_0|ppce300c3_retire_1+present_ppce300c3_retire_0") ++(define_reservation "ppce300c3_iu_stage0" ++ "ppce300c3_iu0_stage0|ppce300c3_iu1_stage0+present_ppce300c3_iu0_stage0") ++ ++;; Compares can be executed either one of the IU or SRU ++(define_insn_reservation "ppce300c3_cmp" 1 ++ (and (eq_attr "type" "cmp,compare,delayed_compare,fast_compare") ++ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3"))) ++ "ppce300c3_decode,ppce300c3_issue+(ppce300c3_iu_stage0|ppce300c3_sru_stage0) \ ++ +ppce300c3_retire") ++ ++;; Other one cycle IU insns ++(define_insn_reservation "ppce300c3_iu" 1 ++ (and (eq_attr "type" "integer,insert_word") ++ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3"))) ++ "ppce300c3_decode,ppce300c3_issue+ppce300c3_iu_stage0+ppce300c3_retire") ++ ++;; Branch. Actually this latency time is not used by the scheduler. ++(define_insn_reservation "ppce300c3_branch" 1 ++ (and (eq_attr "type" "jmpreg,branch") ++ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3"))) ++ "ppce300c3_decode,ppce300c3_bu,ppce300c3_retire") ++ ++;; Multiply is non-pipelined but can be executed in any IU ++(define_insn_reservation "ppce300c3_multiply" 2 ++ (and (eq_attr "type" "imul,imul2,imul3,imul_compare") ++ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3"))) ++ "ppce300c3_decode,ppce300c3_issue+ppce300c3_iu_stage0, \ ++ ppce300c3_iu_stage0+ppce300c3_retire") ++ ++;; Divide. We use the average latency time here. We omit reserving a ++;; retire unit because of the result automata will be huge. ++(define_insn_reservation "ppce300c3_divide" 20 ++ (and (eq_attr "type" "idiv") ++ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3"))) ++ "ppce300c3_decode,ppce300c3_issue+ppce300c3_iu_stage0+ppce300c3_mu_div,\ ++ ppce300c3_mu_div*19") ++ ++;; CR logical ++(define_insn_reservation "ppce300c3_cr_logical" 1 ++ (and (eq_attr "type" "cr_logical,delayed_cr") ++ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3"))) ++ "ppce300c3_decode,ppce300c3_issue+ppce300c3_sru_stage0+ppce300c3_retire") ++ ++;; Mfcr ++(define_insn_reservation "ppce300c3_mfcr" 1 ++ (and (eq_attr "type" "mfcr") ++ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3"))) ++ "ppce300c3_decode,ppce300c3_issue+ppce300c3_sru_stage0+ppce300c3_retire") ++ ++;; Mtcrf ++(define_insn_reservation "ppce300c3_mtcrf" 1 ++ (and (eq_attr "type" "mtcr") ++ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3"))) ++ "ppce300c3_decode,ppce300c3_issue+ppce300c3_sru_stage0+ppce300c3_retire") ++ ++;; Mtjmpr ++(define_insn_reservation "ppce300c3_mtjmpr" 1 ++ (and (eq_attr "type" "mtjmpr,mfjmpr") ++ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3"))) ++ "ppce300c3_decode,ppce300c3_issue+ppce300c3_sru_stage0+ppce300c3_retire") ++ ++;; Float point instructions ++(define_insn_reservation "ppce300c3_fpcompare" 3 ++ (and (eq_attr "type" "fpcompare") ++ (eq_attr "cpu" "ppce300c3")) ++ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,nothing,ppce300c3_retire") ++ ++(define_insn_reservation "ppce300c3_fp" 3 ++ (and (eq_attr "type" "fp") ++ (eq_attr "cpu" "ppce300c3")) ++ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,nothing,ppce300c3_retire") ++ ++(define_insn_reservation "ppce300c3_dmul" 4 ++ (and (eq_attr "type" "dmul") ++ (eq_attr "cpu" "ppce300c3")) ++ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,ppce300c3_fpu,nothing,ppce300c3_retire") ++ ++; Divides are not pipelined ++(define_insn_reservation "ppce300c3_sdiv" 18 ++ (and (eq_attr "type" "sdiv") ++ (eq_attr "cpu" "ppce300c3")) ++ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,ppce300c3_fpu*17") ++ ++(define_insn_reservation "ppce300c3_ddiv" 33 ++ (and (eq_attr "type" "ddiv") ++ (eq_attr "cpu" "ppce300c3")) ++ "ppce300c3_decode,ppce300c3_issue+ppce300c3_fpu,ppce300c3_fpu*32") ++ ++;; Loads ++(define_insn_reservation "ppce300c3_load" 2 ++ (and (eq_attr "type" "load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u") ++ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3"))) ++ "ppce300c3_decode,ppce300c3_issue+ppce300c3_lsu,ppce300c3_retire") ++ ++(define_insn_reservation "ppce300c3_fpload" 2 ++ (and (eq_attr "type" "fpload,fpload_ux,fpload_u") ++ (eq_attr "cpu" "ppce300c3")) ++ "ppce300c3_decode,ppce300c3_issue+ppce300c3_lsu,ppce300c3_retire") ++ ++;; Stores. ++(define_insn_reservation "ppce300c3_store" 2 ++ (and (eq_attr "type" "store,store_ux,store_u") ++ (ior (eq_attr "cpu" "ppce300c2") (eq_attr "cpu" "ppce300c3"))) ++ "ppce300c3_decode,ppce300c3_issue+ppce300c3_lsu,ppce300c3_retire") ++ ++(define_insn_reservation "ppce300c3_fpstore" 2 ++ (and (eq_attr "type" "fpstore,fpstore_ux,fpstore_u") ++ (eq_attr "cpu" "ppce300c3")) ++ "ppce300c3_decode,ppce300c3_issue+ppce300c3_lsu,ppce300c3_retire") +Index: gcc-4.1.2/gcc/config/rs6000/rs6000.c +=================================================================== +--- gcc-4.1.2.orig/gcc/config/rs6000/rs6000.c 2006-12-16 20:24:56.000000000 +0100 ++++ gcc-4.1.2/gcc/config/rs6000/rs6000.c 2007-10-18 15:34:26.000000000 +0200 +@@ -557,6 +557,21 @@ + COSTS_N_INSNS (29), /* ddiv */ + }; + ++/* Instruction costs on E300C2 and E300C3 cores. */ ++static const ++struct processor_costs ppce300c2c3_cost = { ++ COSTS_N_INSNS (4), /* mulsi */ ++ COSTS_N_INSNS (4), /* mulsi_const */ ++ COSTS_N_INSNS (4), /* mulsi_const9 */ ++ COSTS_N_INSNS (4), /* muldi */ ++ COSTS_N_INSNS (19), /* divsi */ ++ COSTS_N_INSNS (19), /* divdi */ ++ COSTS_N_INSNS (3), /* fp */ ++ COSTS_N_INSNS (4), /* dmul */ ++ COSTS_N_INSNS (18), /* sdiv */ ++ COSTS_N_INSNS (33), /* ddiv */ ++}; ++ + /* Instruction costs on POWER4 and POWER5 processors. */ + static const + struct processor_costs power4_cost = { +@@ -1140,6 +1155,8 @@ + /* 8548 has a dummy entry for now. */ + {"8548", PROCESSOR_PPC8540, + POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_STRICT_ALIGN}, ++ {"e300c2", PROCESSOR_PPCE300C2, POWERPC_BASE_MASK | MASK_SOFT_FLOAT}, ++ {"e300c3", PROCESSOR_PPCE300C3, POWERPC_BASE_MASK}, + {"860", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT}, + {"970", PROCESSOR_POWER4, + POWERPC_7400_MASK | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64}, +@@ -1529,6 +1546,11 @@ + rs6000_cost = &ppc8540_cost; + break; + ++ case PROCESSOR_PPCE300C2: ++ case PROCESSOR_PPCE300C3: ++ rs6000_cost = &ppce300c2c3_cost; ++ break; ++ + case PROCESSOR_POWER4: + case PROCESSOR_POWER5: + rs6000_cost = &power4_cost; +@@ -16647,6 +16669,8 @@ + case CPU_PPC750: + case CPU_PPC7400: + case CPU_PPC8540: ++ case CPU_PPCE300C2: ++ case CPU_PPCE300C3: + return 2; + case CPU_RIOS2: + case CPU_PPC604: +Index: gcc-4.1.2/gcc/config/rs6000/rs6000.h +=================================================================== +--- gcc-4.1.2.orig/gcc/config/rs6000/rs6000.h 2006-11-18 01:25:49.000000000 +0100 ++++ gcc-4.1.2/gcc/config/rs6000/rs6000.h 2007-10-18 15:32:51.000000000 +0200 +@@ -111,6 +111,8 @@ + %{mcpu=970: -mpower4 -maltivec} \ + %{mcpu=G5: -mpower4 -maltivec} \ + %{mcpu=8540: -me500} \ ++%{mcpu=e300c2: -mppc} \ ++%{mcpu=e300c3: -mppc -mpmr} \ + %{maltivec: -maltivec} \ + -many" + +@@ -211,6 +213,8 @@ + PROCESSOR_PPC7400, + PROCESSOR_PPC7450, + PROCESSOR_PPC8540, ++ PROCESSOR_PPCE300C2, ++ PROCESSOR_PPCE300C3, + PROCESSOR_POWER4, + PROCESSOR_POWER5 + }; +Index: gcc-4.1.2/gcc/config/rs6000/rs6000.md +=================================================================== +--- gcc-4.1.2.orig/gcc/config/rs6000/rs6000.md 2006-12-16 20:24:56.000000000 +0100 ++++ gcc-4.1.2/gcc/config/rs6000/rs6000.md 2007-10-18 15:32:51.000000000 +0200 +@@ -103,7 +103,7 @@ + ;; Processor type -- this attribute must exactly match the processor_type + ;; enumeration in rs6000.h. + +-(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5" ++(define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppce300c2,ppce300c3,power4,power5" + (const (symbol_ref "rs6000_cpu_attr"))) + + (automata_option "ndfa") +@@ -119,6 +119,7 @@ + (include "7xx.md") + (include "7450.md") + (include "8540.md") ++(include "e300c2c3.md") + (include "power4.md") + (include "power5.md") + +Index: gcc-4.1.2/gcc/config.gcc +=================================================================== +--- gcc-4.1.2.orig/gcc/config.gcc 2007-10-18 15:26:23.000000000 +0200 ++++ gcc-4.1.2/gcc/config.gcc 2007-10-18 15:32:51.000000000 +0200 +@@ -2710,7 +2710,7 @@ + | rios | rios1 | rios2 | rsc | rsc1 | rs64a \ + | 401 | 403 | 405 | 405fp | 440 | 440fp | 505 \ + | 601 | 602 | 603 | 603e | ec603e | 604 \ +- | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 \ ++ | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 | e300c[23] \ + | 854[08] | 801 | 821 | 823 | 860 | 970 | G3 | G4 | G5) + # OK + ;; diff --git a/packages/gcc/gcc-4.2.3/gcc41-configure.in.patch b/packages/gcc/gcc-4.2.3/gcc41-configure.in.patch new file mode 100644 index 0000000000..3d33bcb978 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/gcc41-configure.in.patch @@ -0,0 +1,22 @@ +--- gcc-3.4.4/configure.in.orig 2005-08-09 19:57:51.504323183 -0700 ++++ gcc-3.4.4/configure.in 2005-08-09 20:00:12.073168623 -0700 +@@ -1907,7 +1907,7 @@ + *) gxx_include_dir=${with_gxx_include_dir} ;; + esac + +-FLAGS_FOR_TARGET= ++FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET" + case " $target_configdirs " in + *" newlib "*) + case " $target_configargs " in +--- gcc-3.4.4/configure.orig 2005-08-09 21:02:29.668360660 -0700 ++++ gcc-3.4.4/configure 2005-08-09 21:02:50.157649970 -0700 +@@ -2669,7 +2669,7 @@ + *) gxx_include_dir=${with_gxx_include_dir} ;; + esac + +-FLAGS_FOR_TARGET= ++FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET" + case " $target_configdirs " in + *" newlib "*) + case " $target_configargs " in diff --git a/packages/gcc/gcc-4.2.3/gfortran.patch b/packages/gcc/gcc-4.2.3/gfortran.patch new file mode 100644 index 0000000000..96905e5d7d --- /dev/null +++ b/packages/gcc/gcc-4.2.3/gfortran.patch @@ -0,0 +1,40 @@ +The patch below fixes a crash building libgfortran on arm-linux-gnueabi. + +This target doesn't really have a 128-bit integer type, however it does use +TImode to represent the return value of certain special ABI defined library +functions. This results in type_for_size(TImode) being called. + +Because TImode deosn't correspond to any gfortran integer kind +gfc_type_for_size returns NULL and we segfault shortly after. + +The patch below fixes this by making gfc_type_for_size handle TImode in the +same way as the C frontend. + +Tested on x86_64-linux and arm-linux-gnueabi. +Applied to trunk. + +Paul + +2007-05-15 Paul Brook <paul@codesourcery.com> + + gcc/fortran/ + * trans-types.c (gfc_type_for_size): Handle signed TImode. + +Index: gcc-4.2.1/gcc/fortran/trans-types.c +=================================================================== +--- gcc-4.2.1/gcc/fortran/trans-types.c (revision 170435) ++++ gcc-4.2.1/gcc/fortran/trans-types.c (working copy) +@@ -1800,6 +1800,13 @@ gfc_type_for_size (unsigned bits, int un + if (type && bits == TYPE_PRECISION (type)) + return type; + } ++ ++ /* Handle TImode as a special case because it is used by some backends ++ (eg. ARM) even though it is not available for normal use. */ ++#if HOST_BITS_PER_WIDE_INT >= 64 ++ if (bits == TYPE_PRECISION (intTI_type_node)) ++ return intTI_type_node; ++#endif + } + else + { diff --git a/packages/gcc/gcc-4.2.3/intermask-bigendian.patch b/packages/gcc/gcc-4.2.3/intermask-bigendian.patch new file mode 100644 index 0000000000..fdff3d3d86 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/intermask-bigendian.patch @@ -0,0 +1,24 @@ +--- gcc-4.2.0/gcc/config/arm/bpabi.h ++++ gcc-4.2.0/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. */ + diff --git a/packages/gcc/gcc-4.2.3/ldflags.patch b/packages/gcc/gcc-4.2.3/ldflags.patch new file mode 100644 index 0000000000..9576f60778 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/ldflags.patch @@ -0,0 +1,22 @@ +--- /tmp/Makefile.in 2006-02-23 20:56:01.399758728 +0100 ++++ gcc-4.1-20060217/Makefile.in 2006-02-23 20:56:16.874406224 +0100 +@@ -334,7 +334,7 @@ + CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) + LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) + LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates +-LDFLAGS_FOR_TARGET = ++LDFLAGS_FOR_TARGET = @LDFLAGS@ + PICFLAG_FOR_TARGET = + + # ------------------------------------ +--- /tmp/Makefile.tpl 2006-02-23 20:50:34.077519272 +0100 ++++ gcc-4.1-20060217/Makefile.tpl 2006-02-23 21:04:31.092273688 +0100 +@@ -337,7 +337,7 @@ + CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) + LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) + LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates +-LDFLAGS_FOR_TARGET = ++LDFLAGS_FOR_TARGET = @LDFLAGS@ + PICFLAG_FOR_TARGET = + + # ------------------------------------ diff --git a/packages/gcc/gcc-4.2.3/sdk-libstdc++-includes.patch b/packages/gcc/gcc-4.2.3/sdk-libstdc++-includes.patch new file mode 100644 index 0000000000..4377c2143b --- /dev/null +++ b/packages/gcc/gcc-4.2.3/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/packages/gcc/gcc-4.2.3/sh3-installfix-fixheaders.patch b/packages/gcc/gcc-4.2.3/sh3-installfix-fixheaders.patch new file mode 100644 index 0000000000..a06cd2e075 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/sh3-installfix-fixheaders.patch @@ -0,0 +1,11 @@ +--- gcc-4.1.1/gcc/Makefile.in_orig 2007-01-31 21:24:23.000000000 +0000 ++++ gcc-4.1.1/gcc/Makefile.in 2007-01-31 21:24:43.000000000 +0000 +@@ -3772,8 +3772,6 @@ + $(INSTALL_SCRIPT) $(mkinstalldirs) \ + $(DESTDIR)$(itoolsdir)/mkinstalldirs ; \ + $(INSTALL_SCRIPT) $(srcdir)/fixproto $(DESTDIR)$(itoolsdir)/fixproto ; \ +- $(INSTALL_PROGRAM) build/fix-header$(build_exeext) \ +- $(DESTDIR)$(itoolsdir)/fix-header$(build_exeext) ; \ + else :; fi + echo 'SYSTEM_HEADER_DIR="'"$(SYSTEM_HEADER_DIR)"'"' \ + > $(DESTDIR)$(itoolsdatadir)/mkheaders.conf diff --git a/packages/gcc/gcc-4.2.3/unbreak-armv4t.patch b/packages/gcc/gcc-4.2.3/unbreak-armv4t.patch new file mode 100644 index 0000000000..b3399abfdb --- /dev/null +++ b/packages/gcc/gcc-4.2.3/unbreak-armv4t.patch @@ -0,0 +1,12 @@ +diff -urN gcc-4.1.1/gcc/config/arm/linux-eabi.h gcc-4.1.1-arm9tdmi/gcc/config/arm/linux-eabi.h +--- gcc-4.1.1/gcc/config/arm/linux-eabi.h 2006-10-22 11:11:49.000000000 -0700 ++++ gcc-4.1.1-arm9tdmi/gcc/config/arm/linux-eabi.h 2006-10-24 21:34:01.000000000 -0700 +@@ -45,7 +45,7 @@ + The ARM10TDMI core is the default for armv5t, so set + SUBTARGET_CPU_DEFAULT to achieve this. */ + #undef SUBTARGET_CPU_DEFAULT +-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi ++#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi + + #undef SUBTARGET_EXTRA_LINK_SPEC + #define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi" diff --git a/packages/gcc/gcc-4.2.3/zecke-no-host-includes.patch b/packages/gcc/gcc-4.2.3/zecke-no-host-includes.patch new file mode 100644 index 0000000000..6afb10d6ef --- /dev/null +++ b/packages/gcc/gcc-4.2.3/zecke-no-host-includes.patch @@ -0,0 +1,31 @@ +Index: gcc-4.0.2/gcc/c-incpath.c +=================================================================== +--- gcc-4.0.2.orig/gcc/c-incpath.c 2005-01-23 16:05:27.000000000 +0100 ++++ gcc-4.0.2/gcc/c-incpath.c 2006-05-15 21:23:02.000000000 +0200 +@@ -350,6 +350,26 @@ + p->construct = 0; + p->user_supplied_p = user_supplied_p; + ++#ifdef CROSS_COMPILE ++ /* A common error when cross compiling is including ++ host headers. This code below will try to fail fast ++ for cross compiling. Currently we consider /usr/include, ++ /opt/include and /sw/include as harmful. */ ++ { ++ /* printf("Adding Path: %s\n", p->name ); */ ++ if( strstr(p->name, "/usr/include" ) == p->name ) { ++ fprintf(stderr, _("CROSS COMPILE Badness: /usr/include in INCLUDEPATH: %s\n"), p->name); ++ abort(); ++ } else if( strstr(p->name, "/sw/include") == p->name ) { ++ fprintf(stderr, _("CROSS COMPILE Badness: /sw/include in INCLUDEPATH: %s\n"), p->name); ++ abort(); ++ } else if( strstr(p->name, "/opt/include") == p->name ) { ++ fprintf(stderr, _("CROSS COMPILE Badness: /opt/include in INCLUDEPATH: %s\n"), p->name); ++ abort(); ++ } ++ } ++#endif ++ + add_cpp_dir_path (p, chain); + } + diff --git a/packages/gcc/gcc-4.2.3/zecke-xgcc-cpp.patch b/packages/gcc/gcc-4.2.3/zecke-xgcc-cpp.patch new file mode 100644 index 0000000000..921cab6e18 --- /dev/null +++ b/packages/gcc/gcc-4.2.3/zecke-xgcc-cpp.patch @@ -0,0 +1,16 @@ +upstream: n/a +comment: Use the preprocessor we have just compiled instead the one of +the system. There might be incompabilities between us and them. + +Index: gcc-4.1.1/Makefile.in +=================================================================== +--- gcc-4.1.1.orig/Makefile.in 2006-08-06 13:32:44.000000000 +0200 ++++ gcc-4.1.1/Makefile.in 2006-08-06 13:32:46.000000000 +0200 +@@ -194,6 +194,7 @@ + AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \ + CC="$(CC_FOR_TARGET)"; export CC; \ + CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ ++ CPP="$(CC_FOR_TARGET) -E"; export CCP; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ + CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \ + CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ diff --git a/packages/gcc/gcc-cross-initial_4.2.3.bb b/packages/gcc/gcc-cross-initial_4.2.3.bb new file mode 100644 index 0000000000..fe326d304b --- /dev/null +++ b/packages/gcc/gcc-cross-initial_4.2.3.bb @@ -0,0 +1,5 @@ +require gcc-cross_${PV}.bb +require gcc-cross-initial.inc + +EXTRA_OECONF += "--disable-libmudflap --disable-libgomp \ + --disable-libssp" diff --git a/packages/gcc/gcc-cross-sdk_4.2.3.bb b/packages/gcc/gcc-cross-sdk_4.2.3.bb new file mode 100644 index 0000000000..7e3a459ea8 --- /dev/null +++ b/packages/gcc/gcc-cross-sdk_4.2.3.bb @@ -0,0 +1,14 @@ +PR = "r3" + +inherit sdk + +require gcc-${PV}.inc +require gcc-cross-sdk.inc +require gcc-configure-sdk.inc +require gcc-package-sdk.inc + +DEPENDS += "gmp-native mpfr-native" + +EXTRA_OECONF += "--disable-libunwind-exceptions --disable-libssp \ + --disable-libgomp --disable-libmudflap \ + --with-mpfr=${STAGING_DIR_NATIVE}${layout_exec_prefix}" diff --git a/packages/gcc/gcc-cross_4.2.3.bb b/packages/gcc/gcc-cross_4.2.3.bb new file mode 100644 index 0000000000..11e04594fc --- /dev/null +++ b/packages/gcc/gcc-cross_4.2.3.bb @@ -0,0 +1,12 @@ +PR = "r6" + +require gcc-${PV}.inc +require gcc-cross4.inc +require gcc-configure-cross.inc +require gcc-package-cross.inc + +SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch;patch=1 " + +EXTRA_OECONF += "--disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${layout_exec_prefix}" + +ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${layout_includedir}" diff --git a/packages/gcc/gcc-native_3.4.6.bb b/packages/gcc/gcc-native_3.4.6.bb new file mode 100644 index 0000000000..6f74a1ea46 --- /dev/null +++ b/packages/gcc/gcc-native_3.4.6.bb @@ -0,0 +1,6 @@ +PR = "r7" + +require gcc-${PV}.inc +require gcc-configure-target.inc +require gcc-native.inc +PROVIDES += "gcc3-native" diff --git a/packages/gcc/gcc_4.2.3.bb b/packages/gcc/gcc_4.2.3.bb new file mode 100644 index 0000000000..7238aed4d7 --- /dev/null +++ b/packages/gcc/gcc_4.2.3.bb @@ -0,0 +1,10 @@ +PR = "r6" + +require gcc-${PV}.inc +require gcc-configure-target.inc +require gcc-package-target.inc + +SRC_URI_append = "file://fortran-cross-compile-hack.patch;patch=1" + +ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_INCDIR}" + diff --git a/packages/gcc/gcc_4.3.0.bb b/packages/gcc/gcc_4.3.0.bb index 7c10c5d08c..033f33f8d3 100644 --- a/packages/gcc/gcc_4.3.0.bb +++ b/packages/gcc/gcc_4.3.0.bb @@ -1,4 +1,3 @@ -# Split PR, don't forget to bump gcc-cross as well PR = "r3" require gcc-${PV}.inc |