From 6317df47791e1e35b78dc69a636445dbc22d5c21 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Mon, 28 Jul 2008 21:32:33 +0000 Subject: Fourth step at renaming patches: renumber all patches with a 10-step. diff --git a/patches/binutils/2.15/002-uclibc.patch b/patches/binutils/2.15/002-uclibc.patch deleted file mode 100644 index c64e74f..0000000 --- a/patches/binutils/2.15/002-uclibc.patch +++ /dev/null @@ -1,144 +0,0 @@ -diff -uNr binutils-2.15-pristine/bfd/configure binutils-2.15/bfd/configure ---- binutils-2.15-pristine/bfd/configure 2004-05-17 12:35:57.000000000 -0700 -+++ binutils-2.15/bfd/configure 2004-07-19 16:36:19.000000000 -0700 -@@ -1009,7 +1009,7 @@ - bfd_version_string="\"${VERSION}\"" - if test x${is_release} = x; then - bfd_version_date=`sed -n -e 's/.*DATE //p' < ${srcdir}/version.h` -- bfd_version_string="\"${VERSION} ${bfd_version_date}\"" -+ bfd_version_string="\"${VERSION} ${bfd_version_date} uClibc\"" - fi - - -diff -uNr binutils-2.15-pristine/bfd/elf32-arm.h binutils-2.15/bfd/elf32-arm.h ---- binutils-2.15-pristine/bfd/elf32-arm.h 2004-05-17 12:35:58.000000000 -0700 -+++ binutils-2.15/bfd/elf32-arm.h 2004-07-19 16:37:06.000000000 -0700 -@@ -124,7 +124,7 @@ - - /* The name of the dynamic interpreter. This is put in the .interp - section. */ --#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" -+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" - - #ifdef FOUR_WORD_PLT - -diff -uNr binutils-2.15-pristine/bfd/elf32-cris.c binutils-2.15/bfd/elf32-cris.c ---- binutils-2.15-pristine/bfd/elf32-cris.c 2004-05-17 12:35:58.000000000 -0700 -+++ binutils-2.15/bfd/elf32-cris.c 2004-07-19 16:49:59.000000000 -0700 -@@ -536,7 +536,7 @@ - /* The name of the dynamic interpreter. This is put in the .interp - section. */ - --#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1" -+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" - - /* The size in bytes of an entry in the procedure linkage table. */ - -diff -uNr binutils-2.15-pristine/bfd/elf32-frv.c binutils-2.15/bfd/elf32-frv.c ---- binutils-2.15-pristine/bfd/elf32-frv.c 2004-05-17 12:35:58.000000000 -0700 -+++ binutils-2.15/bfd/elf32-frv.c 2004-07-19 16:49:59.000000000 -0700 -@@ -2913,7 +2913,7 @@ - /* The name of the dynamic interpreter. This is put in the .interp - section. */ - --#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1" -+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" - - #define DEFAULT_STACK_SIZE 0x20000 - -diff -uNr binutils-2.15-pristine/bfd/elf32-hppa.c binutils-2.15/bfd/elf32-hppa.c ---- binutils-2.15-pristine/bfd/elf32-hppa.c 2004-05-17 12:35:58.000000000 -0700 -+++ binutils-2.15/bfd/elf32-hppa.c 2004-07-19 16:49:59.000000000 -0700 -@@ -115,7 +115,7 @@ - - #define PLT_ENTRY_SIZE 8 - #define GOT_ENTRY_SIZE 4 --#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1" -+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" - - static const bfd_byte plt_stub[] = - { -diff -uNr binutils-2.15-pristine/bfd/elf32-ppc.c binutils-2.15/bfd/elf32-ppc.c ---- binutils-2.15-pristine/bfd/elf32-ppc.c 2004-05-17 12:35:59.000000000 -0700 -+++ binutils-2.15/bfd/elf32-ppc.c 2004-07-19 16:49:59.000000000 -0700 -@@ -49,7 +49,7 @@ - - /* The name of the dynamic interpreter. This is put in the .interp - section. */ --#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" -+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" - - /* The size in bytes of an entry in the procedure linkage table. */ - #define PLT_ENTRY_SIZE 12 -diff -uNr binutils-2.15-pristine/bfd/elf32-s390.c binutils-2.15/bfd/elf32-s390.c ---- binutils-2.15-pristine/bfd/elf32-s390.c 2004-05-17 12:35:59.000000000 -0700 -+++ binutils-2.15/bfd/elf32-s390.c 2004-07-19 16:49:59.000000000 -0700 -@@ -452,7 +452,7 @@ - /* The name of the dynamic interpreter. This is put in the .interp - section. */ - --#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" -+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" - - /* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid - copying dynamic variables from a shared lib into an app's dynbss -diff -uNr binutils-2.15-pristine/bfd/elf32-sparc.c binutils-2.15/bfd/elf32-sparc.c ---- binutils-2.15-pristine/bfd/elf32-sparc.c 2004-05-17 12:36:00.000000000 -0700 -+++ binutils-2.15/bfd/elf32-sparc.c 2004-07-19 16:49:59.000000000 -0700 -@@ -536,7 +536,7 @@ - /* The name of the dynamic interpreter. This is put in the .interp - section. */ - --#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" -+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" - - /* The nop opcode we use. */ - -diff -uNr binutils-2.15-pristine/bfd/elf64-ppc.c binutils-2.15/bfd/elf64-ppc.c ---- binutils-2.15-pristine/bfd/elf64-ppc.c 2004-05-17 12:36:01.000000000 -0700 -+++ binutils-2.15/bfd/elf64-ppc.c 2004-07-19 16:49:59.000000000 -0700 -@@ -99,7 +99,7 @@ - - /* The name of the dynamic interpreter. This is put in the .interp - section. */ --#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" -+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" - - /* The size in bytes of an entry in the procedure linkage table. */ - #define PLT_ENTRY_SIZE 24 -diff -uNr binutils-2.15-pristine/bfd/elf64-s390.c binutils-2.15/bfd/elf64-s390.c ---- binutils-2.15-pristine/bfd/elf64-s390.c 2004-05-17 12:36:01.000000000 -0700 -+++ binutils-2.15/bfd/elf64-s390.c 2004-07-19 16:49:59.000000000 -0700 -@@ -473,7 +473,7 @@ - /* The name of the dynamic interpreter. This is put in the .interp - section. */ - --#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" -+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" - - /* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid - copying dynamic variables from a shared lib into an app's dynbss -diff -uNr binutils-2.15-pristine/bfd/elf-m10300.c binutils-2.15/bfd/elf-m10300.c ---- binutils-2.15-pristine/bfd/elf-m10300.c 2004-05-17 12:35:57.000000000 -0700 -+++ binutils-2.15/bfd/elf-m10300.c 2004-07-19 16:49:59.000000000 -0700 -@@ -4026,7 +4026,7 @@ - /* The name of the dynamic interpreter. This is put in the .interp - section. */ - --#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1" -+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" - - /* Create dynamic sections when linking against a dynamic object. */ - -diff -uNr binutils-2.15-pristine/bfd/elfxx-ia64.c binutils-2.15/bfd/elfxx-ia64.c ---- binutils-2.15-pristine/bfd/elfxx-ia64.c 2004-05-17 12:36:02.000000000 -0700 -+++ binutils-2.15/bfd/elfxx-ia64.c 2004-07-19 16:49:59.000000000 -0700 -@@ -643,7 +643,7 @@ - 0x60, 0x00, 0x80, 0x00 /* br.few b6;; */ - }; - --#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" -+#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" - - static const bfd_byte oor_brl[16] = - { diff --git a/patches/binutils/2.15/100-uclibc-conf.patch b/patches/binutils/2.15/100-uclibc-conf.patch deleted file mode 100644 index 1c7fa4a..0000000 --- a/patches/binutils/2.15/100-uclibc-conf.patch +++ /dev/null @@ -1,692 +0,0 @@ -diff -urN binutils-2.15-dist/bfd/config.bfd binutils-2.15/bfd/config.bfd ---- binutils-2.15-dist/bfd/config.bfd 2004-05-17 14:35:56.000000000 -0500 -+++ binutils-2.15/bfd/config.bfd 2004-08-04 12:01:44.000000000 -0500 -@@ -126,7 +126,7 @@ - targ_defvec=ecoffalpha_little_vec - targ_selvecs=bfd_elf64_alpha_vec - ;; -- alpha*-*-linux-gnu* | alpha*-*-elf*) -+ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc* | alpha*-*-elf*) - targ_defvec=bfd_elf64_alpha_vec - targ_selvecs=ecoffalpha_little_vec - ;; -@@ -136,7 +136,7 @@ - alpha*-*-*) - targ_defvec=ecoffalpha_little_vec - ;; -- ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu) -+ ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-linux-uclibc* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu) - targ_defvec=bfd_elf64_ia64_little_vec - targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec" - ;; -@@ -213,7 +213,7 @@ - targ_defvec=bfd_elf32_littlearm_vec - targ_selvecs=bfd_elf32_bigarm_vec - ;; -- armeb-*-elf | arm*b-*-linux-gnu*) -+ armeb-*-elf | arm*b-*-linux-gnu* | arm*b-*-linux-uclibc*) - targ_defvec=bfd_elf32_bigarm_vec - targ_selvecs=bfd_elf32_littlearm_vec - ;; -@@ -221,7 +221,7 @@ - targ_defvec=bfd_elf32_littlearm_vec - targ_selvecs=bfd_elf32_bigarm_vec - ;; -- arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | \ -+ arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-linux-uclibc* | arm*-*-conix* | \ - arm*-*-uclinux* | arm-*-kfreebsd*-gnu | arm-*-vxworks) - targ_defvec=bfd_elf32_littlearm_vec - targ_selvecs=bfd_elf32_bigarm_vec -@@ -360,7 +360,7 @@ - ;; - - #ifdef BFD64 -- hppa*64*-*-linux-gnu*) -+ hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*) - targ_defvec=bfd_elf64_hppa_linux_vec - targ_selvecs=bfd_elf64_hppa_vec - ;; -@@ -371,7 +371,7 @@ - ;; - #endif - -- hppa*-*-linux-gnu* | hppa*-*-netbsd*) -+ hppa*-*-linux-gnu* | hppa*-*-linux-uclibc* | hppa*-*-netbsd*) - targ_defvec=bfd_elf32_hppa_linux_vec - targ_selvecs=bfd_elf32_hppa_vec - ;; -@@ -494,7 +494,7 @@ - targ_selvecs=bfd_elf32_i386_vec - targ_underscore=yes - ;; -- i[3-7]86-*-linux-gnu*) -+ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) - targ_defvec=bfd_elf32_i386_vec - targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec" - targ64_selvecs=bfd_elf64_x86_64_vec -@@ -508,7 +508,7 @@ - targ_defvec=bfd_elf64_x86_64_vec - targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec" - ;; -- x86_64-*-linux-gnu*) -+ x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*) - targ_defvec=bfd_elf64_x86_64_vec - targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec" - ;; -@@ -683,7 +683,7 @@ - targ_selvecs=bfd_elf32_m68k_vec - targ_underscore=yes - ;; -- m68*-*-linux-gnu*) -+ m68*-*-linux-gnu* | m68*-*-linux-uclibc*) - targ_defvec=bfd_elf32_m68k_vec - targ_selvecs=m68klinux_vec - ;; -@@ -955,7 +955,8 @@ - ;; - #endif - powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \ -- powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \ -+ powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-linux-uclibc* | \ -+ powerpc-*-rtems* | \ - powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss*) - targ_defvec=bfd_elf32_powerpc_vec - targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec" -@@ -987,8 +988,8 @@ - targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec" - ;; - powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \ -- powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks* |\ -- powerpcle-*-rtems*) -+ powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-linux-uclibc* |\ -+ powerpcle-*-vxworks* | powerpcle-*-rtems*) - targ_defvec=bfd_elf32_powerpcle_vec - targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec" - targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec" -@@ -1149,7 +1150,7 @@ - targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec" - targ_underscore=yes - ;; -- sparc-*-linux-gnu*) -+ sparc-*-linux-gnu* | sparc-*-linux-uclibc*) - targ_defvec=bfd_elf32_sparc_vec - targ_selvecs="sparclinux_vec bfd_elf64_sparc_vec sunos_big_vec" - ;; -@@ -1196,7 +1197,7 @@ - targ_defvec=sunos_big_vec - targ_underscore=yes - ;; -- sparc64-*-linux-gnu*) -+ sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*) - targ_defvec=bfd_elf64_sparc_vec - targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec" - ;; -@@ -1265,7 +1266,7 @@ - targ_underscore=yes - ;; - -- vax-*-linux-gnu*) -+ vax-*-linux-gnu* | vax-*-linux-uclibc*) - targ_defvec=bfd_elf32_vax_vec - ;; - -diff -urN binutils-2.15-dist/bfd/configure binutils-2.15/bfd/configure ---- binutils-2.15-dist/bfd/configure 2004-05-17 14:35:57.000000000 -0500 -+++ binutils-2.15/bfd/configure 2004-08-04 12:01:44.000000000 -0500 -@@ -1699,6 +1699,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]+$' -@@ -5278,7 +5283,7 @@ - alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu) - COREFILE='' - ;; -- alpha*-*-linux-gnu*) -+ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*) - COREFILE=trad-core.lo - TRAD_HEADER='"hosts/alphalinux.h"' - ;; -@@ -5338,7 +5343,7 @@ - COREFILE=trad-core.lo - TRAD_HEADER='"hosts/i386mach3.h"' - ;; -- i[3-7]86-*-linux-gnu*) -+ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) - COREFILE=trad-core.lo - TRAD_HEADER='"hosts/i386linux.h"' - ;; -@@ -5376,7 +5381,7 @@ - COREFILE=trad-core.lo - TRAD_HEADER='"hosts/hp300bsd.h"' - ;; -- m68*-*-linux-gnu*) -+ m68*-*-linux-gnu* | m68*-*-linux-uclibc*) - COREFILE=trad-core.lo - TRAD_HEADER='"hosts/m68klinux.h"' - ;; -@@ -5477,7 +5482,7 @@ - COREFILE=trad-core.lo - TRAD_HEADER='"hosts/vaxult2.h"' - ;; -- vax-*-linux-gnu*) -+ vax-*-linux-gnu* | vax-*-linux-uclibc*) - COREFILE=trad-core.lo - TRAD_HEADER='"hosts/vaxlinux.h"' - ;; -diff -urN binutils-2.15-dist/bfd/configure.in binutils-2.15/bfd/configure.in ---- binutils-2.15-dist/bfd/configure.in 2004-05-17 14:35:57.000000000 -0500 -+++ binutils-2.15/bfd/configure.in 2004-08-04 12:01:44.000000000 -0500 -@@ -178,7 +178,7 @@ - alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu) - COREFILE='' - ;; -- alpha*-*-linux-gnu*) -+ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*) - COREFILE=trad-core.lo - TRAD_HEADER='"hosts/alphalinux.h"' - ;; -@@ -259,7 +259,7 @@ - TRAD_HEADER='"hosts/i386mach3.h"' - ;; - changequote(,)dnl -- i[3-7]86-*-linux-gnu*) -+ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) - changequote([,])dnl - COREFILE=trad-core.lo - TRAD_HEADER='"hosts/i386linux.h"' -@@ -300,7 +300,7 @@ - COREFILE=trad-core.lo - TRAD_HEADER='"hosts/hp300bsd.h"' - ;; -- m68*-*-linux-gnu*) -+ m68*-*-linux-gnu* | m68*-*-linux-uclibc*) - COREFILE=trad-core.lo - TRAD_HEADER='"hosts/m68klinux.h"' - ;; -@@ -385,7 +385,7 @@ - COREFILE=trad-core.lo - TRAD_HEADER='"hosts/vaxult2.h"' - ;; -- vax-*-linux-gnu*) -+ vax-*-linux-gnu* | vax-*-linux-uclibc*) - COREFILE=trad-core.lo - TRAD_HEADER='"hosts/vaxlinux.h"' - ;; -diff -urN binutils-2.15-dist/binutils/configure binutils-2.15/binutils/configure ---- binutils-2.15-dist/binutils/configure 2004-01-02 11:08:04.000000000 -0600 -+++ binutils-2.15/binutils/configure 2004-08-04 12:01:44.000000000 -0500 -@@ -1585,6 +1585,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 binutils-2.15-dist/configure binutils-2.15/configure ---- binutils-2.15-dist/configure 2004-05-17 14:36:20.000000000 -0500 -+++ binutils-2.15/configure 2004-08-04 12:01:44.000000000 -0500 -@@ -1288,6 +1288,18 @@ - i[3456789]86-*-freebsd* | i[3456789]86-*-kfreebsd*-gnu) - noconfigdirs="$noconfigdirs target-newlib target-libgloss" - ;; -+ i[3456789]86-*-linux-uclibc*) -+ # This section makes it possible to build newlib natively on linux. -+ # If we are using a cross compiler then don't configure newlib. -+ if test x${is_cross_compiler} != xno ; then -+ noconfigdirs="$noconfigdirs target-newlib" -+ fi -+ noconfigdirs="$noconfigdirs target-libgloss" -+ # If we are not using a cross compiler, do configure newlib. -+ # Note however, that newlib will only be configured in this situation -+ # if the --with-newlib option has been given, because otherwise -+ # 'target-newlib' will appear in skipdirs. -+ ;; - i[3456789]86-*-linux*) - # The GCC port for glibc1 has no MD_FALLBACK_FRAME_STATE_FOR, so let's - # not build java stuff by default. -diff -urN binutils-2.15-dist/configure.in binutils-2.15/configure.in ---- binutils-2.15-dist/configure.in 2004-05-17 14:40:54.000000000 -0500 -+++ binutils-2.15/configure.in 2004-08-04 12:01:44.000000000 -0500 -@@ -521,6 +521,18 @@ - i[[3456789]]86-*-freebsd* | i[[3456789]]86-*-kfreebsd*-gnu) - noconfigdirs="$noconfigdirs target-newlib target-libgloss" - ;; -+ i[[3456789]]86-*-linux-uclibc*) -+ # This section makes it possible to build newlib natively on linux. -+ # If we are using a cross compiler then don't configure newlib. -+ if test x${is_cross_compiler} != xno ; then -+ noconfigdirs="$noconfigdirs target-newlib" -+ fi -+ noconfigdirs="$noconfigdirs target-libgloss" -+ # If we are not using a cross compiler, do configure newlib. -+ # Note however, that newlib will only be configured in this situation -+ # if the --with-newlib option has been given, because otherwise -+ # 'target-newlib' will appear in skipdirs. -+ ;; - i[[3456789]]86-*-linux*) - # The GCC port for glibc1 has no MD_FALLBACK_FRAME_STATE_FOR, so let's - # not build java stuff by default. -diff -urN binutils-2.15-dist/gas/configure binutils-2.15/gas/configure ---- binutils-2.15-dist/gas/configure 2004-05-17 14:36:07.000000000 -0500 -+++ binutils-2.15/gas/configure 2004-08-04 12:07:50.000000000 -0500 -@@ -3400,6 +3400,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]+$' -@@ -4224,6 +4229,7 @@ - alpha*-*-osf*) fmt=ecoff ;; - alpha*-*-linuxecoff*) fmt=ecoff ;; - alpha*-*-linux-gnu*) fmt=elf em=linux ;; -+ alpha*-*-linux-uclibc*) fmt=elf em=linux ;; - alpha*-*-netbsd*) fmt=elf em=nbsd ;; - alpha*-*-openbsd*) fmt=elf em=obsd ;; - -@@ -4240,6 +4246,7 @@ - arm*-*-conix*) fmt=elf ;; - arm-*-linux*aout*) fmt=aout em=linux ;; - arm*-*-linux-gnu*) fmt=elf em=linux ;; -+ arm*-*-linux-uclibc*) fmt=elf em=linux ;; - arm*-*-uclinux*) fmt=elf em=linux ;; - arm-*-netbsdelf*) fmt=elf em=nbsd ;; - arm-*-*n*bsd*) fmt=aout em=nbsd ;; -@@ -4253,6 +4260,7 @@ - avr-*-*) fmt=elf ;; - - cris-*-linux-gnu*) fmt=multi bfd_gas=yes em=linux ;; -+ cris-*-linux-uclibc*) fmt=multi bfd_gas=yes em=linux ;; - cris-*-*) fmt=multi bfd_gas=yes ;; - - d10v-*-*) fmt=elf ;; -@@ -4310,7 +4318,9 @@ - i386-*-linux*oldld) fmt=aout em=linux ;; - i386-*-linux*coff*) fmt=coff em=linux ;; - i386-*-linux-gnu*) fmt=elf em=linux ;; -+ i386-*-linux-uclibc*) fmt=elf em=linux ;; - x86_64-*-linux-gnu*) fmt=elf em=linux ;; -+ x86_64-*-linux-uclibc*) fmt=elf em=linux ;; - i386-*-lynxos*) fmt=coff em=lynx ;; - i386-*-sysv[45]*) fmt=elf ;; - i386-*-solaris*) fmt=elf ;; -@@ -4370,6 +4380,7 @@ - ia64-*-elf*) fmt=elf ;; - ia64-*-aix*) fmt=elf em=ia64aix ;; - ia64-*-linux-gnu*) fmt=elf em=linux ;; -+ ia64-*-linux-uclibc*) fmt=elf em=linux ;; - ia64-*-hpux*) fmt=elf em=hpux ;; - ia64-*-netbsd*) fmt=elf em=nbsd ;; - -@@ -4397,6 +4408,7 @@ - m68k-*-hpux*) fmt=hp300 em=hp300 ;; - m68k-*-linux*aout*) fmt=aout em=linux ;; - m68k-*-linux-gnu*) fmt=elf em=linux ;; -+ m68k-*-linux-uclibc*) fmt=elf em=linux ;; - m68k-*-uclinux*) fmt=elf ;; - m68k-*-gnu*) fmt=elf ;; - m68k-*-lynxos*) fmt=coff em=lynx ;; -@@ -4459,6 +4471,7 @@ - ppc-*-beos*) fmt=coff ;; - ppc-*-*n*bsd* | ppc-*-elf*) fmt=elf ;; - ppc-*-eabi* | ppc-*-sysv4*) fmt=elf ;; -+ ppc-*-linux-uclibc* | \ - ppc-*-linux-gnu*) fmt=elf em=linux - case "$endian" in - big) ;; -@@ -4486,7 +4499,9 @@ - ppc-*-kaos*) fmt=elf ;; - - s390x-*-linux-gnu*) fmt=elf em=linux ;; -+ s390x-*-linux-uclibc*) fmt=elf em=linux ;; - s390-*-linux-gnu*) fmt=elf em=linux ;; -+ s390-*-linux-uclibc*) fmt=elf em=linux ;; - - sh*-*-linux*) fmt=elf em=linux - case ${cpu} in -@@ -4519,6 +4534,7 @@ - sparc-*-coff) fmt=coff ;; - sparc-*-linux*aout*) fmt=aout em=linux ;; - sparc-*-linux-gnu*) fmt=elf em=linux ;; -+ sparc-*-linux-uclibc*) fmt=elf em=linux ;; - sparc-*-lynxos*) fmt=coff em=lynx ;; - sparc-fujitsu-none) fmt=aout ;; - sparc-*-elf) fmt=elf ;; -diff -urN binutils-2.15-dist/gas/configure.in binutils-2.15/gas/configure.in ---- binutils-2.15-dist/gas/configure.in 2004-05-17 14:36:07.000000000 -0500 -+++ binutils-2.15/gas/configure.in 2004-08-04 12:07:21.000000000 -0500 -@@ -194,6 +194,7 @@ - alpha*-*-osf*) fmt=ecoff ;; - alpha*-*-linuxecoff*) fmt=ecoff ;; - alpha*-*-linux-gnu*) fmt=elf em=linux ;; -+ alpha*-*-linux-uclibc*) fmt=elf em=linux ;; - alpha*-*-netbsd*) fmt=elf em=nbsd ;; - alpha*-*-openbsd*) fmt=elf em=obsd ;; - -@@ -210,6 +211,7 @@ - arm*-*-conix*) fmt=elf ;; - arm-*-linux*aout*) fmt=aout em=linux ;; - arm*-*-linux-gnu*) fmt=elf em=linux ;; -+ arm*-*-linux-uclibc*) fmt=elf em=linux ;; - arm*-*-uclinux*) fmt=elf em=linux ;; - arm-*-netbsdelf*) fmt=elf em=nbsd ;; - arm-*-*n*bsd*) fmt=aout em=nbsd ;; -@@ -223,6 +225,7 @@ - avr-*-*) fmt=elf ;; - - cris-*-linux-gnu*) fmt=multi bfd_gas=yes em=linux ;; -+ cris-*-linux-uclibc*) fmt=multi bfd_gas=yes em=linux ;; - cris-*-*) fmt=multi bfd_gas=yes ;; - - d10v-*-*) fmt=elf ;; -@@ -280,7 +283,9 @@ - i386-*-linux*oldld) fmt=aout em=linux ;; - i386-*-linux*coff*) fmt=coff em=linux ;; - i386-*-linux-gnu*) fmt=elf em=linux ;; -+ i386-*-linux-uclibc*) fmt=elf em=linux ;; - x86_64-*-linux-gnu*) fmt=elf em=linux ;; -+ x86_64-*-linux-uclibc*) fmt=elf em=linux ;; - i386-*-lynxos*) fmt=coff em=lynx ;; - changequote(,)dnl - i386-*-sysv[45]*) fmt=elf ;; -@@ -333,6 +338,7 @@ - ia64-*-elf*) fmt=elf ;; - ia64-*-aix*) fmt=elf em=ia64aix ;; - ia64-*-linux-gnu*) fmt=elf em=linux ;; -+ ia64-*-linux-uclibc*) fmt=elf em=linux ;; - ia64-*-hpux*) fmt=elf em=hpux ;; - ia64-*-netbsd*) fmt=elf em=nbsd ;; - -@@ -360,6 +366,7 @@ - m68k-*-hpux*) fmt=hp300 em=hp300 ;; - m68k-*-linux*aout*) fmt=aout em=linux ;; - m68k-*-linux-gnu*) fmt=elf em=linux ;; -+ m68k-*-linux-uclibc*) fmt=elf em=linux ;; - m68k-*-uclinux*) fmt=elf ;; - m68k-*-gnu*) fmt=elf ;; - m68k-*-lynxos*) fmt=coff em=lynx ;; -@@ -419,6 +426,7 @@ - ppc-*-beos*) fmt=coff ;; - ppc-*-*n*bsd* | ppc-*-elf*) fmt=elf ;; - ppc-*-eabi* | ppc-*-sysv4*) fmt=elf ;; -+ ppc-*-linux-uclibc* | \ - ppc-*-linux-gnu*) fmt=elf em=linux - case "$endian" in - big) ;; -@@ -439,7 +447,9 @@ - ppc-*-kaos*) fmt=elf ;; - - s390x-*-linux-gnu*) fmt=elf em=linux ;; -+ s390x-*-linux-uclibc*) fmt=elf em=linux ;; - s390-*-linux-gnu*) fmt=elf em=linux ;; -+ s390-*-linux-uclibc*) fmt=elf em=linux ;; - - sh*-*-linux*) fmt=elf em=linux - case ${cpu} in -@@ -472,6 +482,7 @@ - sparc-*-coff) fmt=coff ;; - sparc-*-linux*aout*) fmt=aout em=linux ;; - sparc-*-linux-gnu*) fmt=elf em=linux ;; -+ sparc-*-linux-uclibc*) fmt=elf em=linux ;; - sparc-*-lynxos*) fmt=coff em=lynx ;; - sparc-fujitsu-none) fmt=aout ;; - sparc-*-elf) fmt=elf ;; -diff -urN binutils-2.15-dist/gprof/configure binutils-2.15/gprof/configure ---- binutils-2.15-dist/gprof/configure 2003-08-26 12:19:19.000000000 -0500 -+++ binutils-2.15/gprof/configure 2004-08-04 12:01:45.000000000 -0500 -@@ -1581,6 +1581,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 binutils-2.15-dist/ld/configure binutils-2.15/ld/configure ---- binutils-2.15-dist/ld/configure 2003-04-24 07:36:07.000000000 -0500 -+++ binutils-2.15/ld/configure 2004-08-04 12:01:45.000000000 -0500 -@@ -1589,6 +1589,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 binutils-2.15-dist/ld/configure.tgt binutils-2.15/ld/configure.tgt ---- binutils-2.15-dist/ld/configure.tgt 2004-05-17 14:36:15.000000000 -0500 -+++ binutils-2.15/ld/configure.tgt 2004-08-04 12:01:45.000000000 -0500 -@@ -30,6 +30,7 @@ - targ_extra_emuls="criself crislinux" - targ_extra_libpath=$targ_extra_emuls ;; - cris-*-linux-gnu*) targ_emul=crislinux ;; -+cris-*-linux-uclibc*) targ_emul=crislinux ;; - cris-*-*) targ_emul=criself - targ_extra_emuls="crisaout crislinux" - targ_extra_libpath=$targ_extra_emuls ;; -@@ -59,14 +60,16 @@ - tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/aout//'` - tdir_sun4=sparc-sun-sunos4 - ;; --sparc64-*-linux-gnu*) targ_emul=elf64_sparc -+sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*) \ -+ targ_emul=elf64_sparc - targ_extra_emuls="elf32_sparc sparclinux sun4" - targ_extra_libpath=elf32_sparc - tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'` - tdir_sparclinux=${tdir_elf32_sparc}aout - tdir_sun4=sparc-sun-sunos4 - ;; --sparc*-*-linux-gnu*) targ_emul=elf32_sparc -+sparc*-*-linux-gnu* | sparc*-*-linux-uclibc*) \ -+ targ_emul=elf32_sparc - targ_extra_emuls="sparclinux elf64_sparc sun4" - targ_extra_libpath=elf64_sparc - tdir_sparclinux=${targ_alias}aout -@@ -118,7 +121,9 @@ - m32r*le-*-elf*) targ_emul=m32rlelf ;; - m32r*-*-elf*) targ_emul=m32relf ;; - m32r*le-*-linux-gnu*) targ_emul=m32rlelf_linux ;; -+m32r*le-*-linux-uclibc*) targ_emul=m32rlelf_linux ;; - m32r*-*-linux-gnu*) targ_emul=m32relf_linux ;; -+m32r*-*-linux-uclibc*) targ_emul=m32relf_linux ;; - m68hc11-*-*|m6811-*-*) targ_emul=m68hc11elf - targ_extra_emuls="m68hc11elfb m68hc12elf m68hc12elfb" ;; - m68hc12-*-*|m6812-*-*) targ_emul=m68hc12elf -@@ -128,7 +133,7 @@ - m68*-ericsson-ose) targ_emul=sun3 ;; - m68*-apple-aux*) targ_emul=m68kaux ;; - *-tandem-none) targ_emul=st2000 ;; --i370-*-elf* | i370-*-linux-gnu*) targ_emul=elf32i370 ;; -+i370-*-elf* | i370-*-linux-gnu* | i370-*-linux-uclibc*) targ_emul=elf32i370 ;; - i[3-7]86-*-nto-qnx*) targ_emul=i386nto ;; - i[3-7]86-*-vsta) targ_emul=vsta ;; - i[3-7]86-go32-rtems*) targ_emul=i386go32 ;; -@@ -152,14 +157,16 @@ - tdir_elf_i386=`echo ${targ_alias} | sed -e 's/aout//'` - ;; - i[3-7]86-*-linux*oldld) targ_emul=i386linux; targ_extra_emuls=elf_i386 ;; --i[3-7]86-*-linux-gnu*) targ_emul=elf_i386 -+i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) \ -+ targ_emul=elf_i386 - targ_extra_emuls=i386linux - if test x${want64} = xtrue; then - targ_extra_emuls="$targ_extra_emuls elf_x86_64" - fi - tdir_i386linux=${targ_alias}aout - ;; --x86_64-*-linux-gnu*) targ_emul=elf_x86_64 -+x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*) \ -+ targ_emul=elf_x86_64 - targ_extra_emuls="elf_i386 i386linux" - targ_extra_libpath=elf_i386 - tdir_i386linux=`echo ${targ_alias}aout | sed -e 's/x86_64/i386/'` -@@ -259,10 +266,13 @@ - arm9e-*-elf) targ_emul=armelf ;; - arm-*-oabi) targ_emul=armelf_oabi ;; - arm*b-*-linux-gnu*) targ_emul=armelfb_linux; targ_extra_emuls=armelfb ;; -+arm*b-*-linux-uclibc*) targ_emul=armelfb_linux; targ_extra_emuls=armelfb ;; - arm*-*-linux-gnu*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;; -+arm*-*-linux-uclibc*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;; - arm*-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;; - arm*-*-conix*) targ_emul=armelf ;; --thumb-*-linux-gnu* | thumb-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;; -+thumb-*-linux-gnu* | thumb-*-linux-uclibc* | thumb-*-uclinux*) \ -+ targ_emul=armelf_linux; targ_extra_emuls=armelf ;; - strongarm-*-coff) targ_emul=armcoff ;; - strongarm-*-elf) targ_emul=armelf ;; - strongarm-*-kaos*) targ_emul=armelf ;; -@@ -364,7 +374,8 @@ - targ_extra_emuls=m68kelf - tdir_m68kelf=`echo ${targ_alias} | sed -e 's/aout//'` - ;; --m68k-*-linux-gnu*) targ_emul=m68kelf -+m68k-*-linux-gnu* | m68k-*-linux-uclibc*) \ -+ targ_emul=m68kelf - targ_extra_emuls=m68klinux - tdir_m68klinux=`echo ${targ_alias} | sed -e 's/linux/linuxaout/'` - ;; -@@ -381,9 +392,9 @@ - m68*-*-psos*) targ_emul=m68kpsos ;; - m68*-*-rtemscoff*) targ_emul=m68kcoff ;; - m68*-*-rtems*) targ_emul=m68kelf ;; --hppa*64*-*-linux-gnu*) targ_emul=hppa64linux ;; -+hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*) targ_emul=hppa64linux ;; - hppa*64*-*) targ_emul=elf64hppa ;; --hppa*-*-linux-gnu*) targ_emul=hppalinux ;; -+hppa*-*-linux-gnu* | hppa*-*-linux-uclibc*) targ_emul=hppalinux ;; - hppa*-*-*elf*) targ_emul=hppaelf ;; - hppa*-*-lites*) targ_emul=hppaelf ;; - hppa*-*-netbsd*) targ_emul=hppanbsd ;; -@@ -396,6 +407,7 @@ - targ_emul=vaxnbsd - targ_extra_emuls=elf32vax ;; - vax-*-linux-gnu*) targ_emul=elf32vax ;; -+vax-*-linux-uclibc*) targ_emul=elf32vax ;; - mips*-*-pe) targ_emul=mipspe ; - targ_extra_ofiles="deffilep.o pe-dll.o" ;; - mips*-dec-ultrix*) targ_emul=mipslit ;; -@@ -429,16 +441,16 @@ - mips*-*-vxworks*) targ_emul=elf32ebmip - targ_extra_emuls="elf32elmip" ;; - mips*-*-windiss) targ_emul=elf32mipswindiss ;; --mips64*el-*-linux-gnu*) targ_emul=elf32ltsmipn32 -+mips64*el-*-linux-gnu* | mips64*el-*-linux-uclibc*) targ_emul=elf32ltsmipn32 - targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip" - ;; --mips64*-*-linux-gnu*) targ_emul=elf32btsmipn32 -+mips64*-*-linux-gnu* | mips64*-*-linux-uclibc*) targ_emul=elf32btsmipn32 - targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip" - ;; --mips*el-*-linux-gnu*) targ_emul=elf32ltsmip -+mips*el-*-linux-gnu* | mips*el-*-linux-uclibc*) targ_emul=elf32ltsmip - targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip" - ;; --mips*-*-linux-gnu*) targ_emul=elf32btsmip -+mips*-*-linux-gnu* | mips*-*-linux-uclibc*) targ_emul=elf32btsmip - targ_extra_emuls="elf32ltsmip elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip" - ;; - mips*-*-lnews*) targ_emul=mipslnews ;; -@@ -461,6 +473,10 @@ - alpha*-*-linux-gnu*) targ_emul=elf64alpha targ_extra_emuls=alpha - tdir_alpha=`echo ${targ_alias} | sed -e 's/linux/linuxecoff/'` - ;; -+alpha*-*-linux-uclibc*) targ_emul=elf64alpha targ_extra_emuls=alpha -+ # The following needs to be checked... -+ tdir_alpha=`echo ${targ_alias} | sed -e 's/linux/linuxecoff/'` -+ ;; - alpha*-*-osf*) targ_emul=alpha ;; - alpha*-*-gnu*) targ_emul=elf64alpha ;; - alpha*-*-netware*) targ_emul=alpha ;; -diff -urN binutils-2.15-dist/libtool.m4 binutils-2.15/libtool.m4 ---- binutils-2.15-dist/libtool.m4 2003-04-10 22:58:39.000000000 -0500 -+++ binutils-2.15/libtool.m4 2004-08-04 12:01:45.000000000 -0500 -@@ -645,6 +645,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 binutils-2.15-dist/ltconfig binutils-2.15/ltconfig ---- binutils-2.15-dist/ltconfig 2003-10-03 23:54:47.000000000 -0500 -+++ binutils-2.15/ltconfig 2004-08-04 12:01:45.000000000 -0500 -@@ -603,6 +603,7 @@ - # Transform linux* to *-*-linux-gnu*, to support old configure scripts. - case $host_os in - linux-gnu*) ;; -+linux-uclibc*) ;; - linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` - esac - -@@ -1259,6 +1260,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 -urN binutils-2.15-dist/opcodes/configure binutils-2.15/opcodes/configure ---- binutils-2.15-dist/opcodes/configure 2003-08-05 04:39:31.000000000 -0500 -+++ binutils-2.15/opcodes/configure 2004-08-04 12:01:45.000000000 -0500 -@@ -1700,6 +1700,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 --git a/patches/binutils/2.15/100-uclibc.patch b/patches/binutils/2.15/100-uclibc.patch new file mode 100644 index 0000000..c64e74f --- /dev/null +++ b/patches/binutils/2.15/100-uclibc.patch @@ -0,0 +1,144 @@ +diff -uNr binutils-2.15-pristine/bfd/configure binutils-2.15/bfd/configure +--- binutils-2.15-pristine/bfd/configure 2004-05-17 12:35:57.000000000 -0700 ++++ binutils-2.15/bfd/configure 2004-07-19 16:36:19.000000000 -0700 +@@ -1009,7 +1009,7 @@ + bfd_version_string="\"${VERSION}\"" + if test x${is_release} = x; then + bfd_version_date=`sed -n -e 's/.*DATE //p' < ${srcdir}/version.h` +- bfd_version_string="\"${VERSION} ${bfd_version_date}\"" ++ bfd_version_string="\"${VERSION} ${bfd_version_date} uClibc\"" + fi + + +diff -uNr binutils-2.15-pristine/bfd/elf32-arm.h binutils-2.15/bfd/elf32-arm.h +--- binutils-2.15-pristine/bfd/elf32-arm.h 2004-05-17 12:35:58.000000000 -0700 ++++ binutils-2.15/bfd/elf32-arm.h 2004-07-19 16:37:06.000000000 -0700 +@@ -124,7 +124,7 @@ + + /* The name of the dynamic interpreter. This is put in the .interp + section. */ +-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" ++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" + + #ifdef FOUR_WORD_PLT + +diff -uNr binutils-2.15-pristine/bfd/elf32-cris.c binutils-2.15/bfd/elf32-cris.c +--- binutils-2.15-pristine/bfd/elf32-cris.c 2004-05-17 12:35:58.000000000 -0700 ++++ binutils-2.15/bfd/elf32-cris.c 2004-07-19 16:49:59.000000000 -0700 +@@ -536,7 +536,7 @@ + /* The name of the dynamic interpreter. This is put in the .interp + section. */ + +-#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1" ++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" + + /* The size in bytes of an entry in the procedure linkage table. */ + +diff -uNr binutils-2.15-pristine/bfd/elf32-frv.c binutils-2.15/bfd/elf32-frv.c +--- binutils-2.15-pristine/bfd/elf32-frv.c 2004-05-17 12:35:58.000000000 -0700 ++++ binutils-2.15/bfd/elf32-frv.c 2004-07-19 16:49:59.000000000 -0700 +@@ -2913,7 +2913,7 @@ + /* The name of the dynamic interpreter. This is put in the .interp + section. */ + +-#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1" ++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" + + #define DEFAULT_STACK_SIZE 0x20000 + +diff -uNr binutils-2.15-pristine/bfd/elf32-hppa.c binutils-2.15/bfd/elf32-hppa.c +--- binutils-2.15-pristine/bfd/elf32-hppa.c 2004-05-17 12:35:58.000000000 -0700 ++++ binutils-2.15/bfd/elf32-hppa.c 2004-07-19 16:49:59.000000000 -0700 +@@ -115,7 +115,7 @@ + + #define PLT_ENTRY_SIZE 8 + #define GOT_ENTRY_SIZE 4 +-#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1" ++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" + + static const bfd_byte plt_stub[] = + { +diff -uNr binutils-2.15-pristine/bfd/elf32-ppc.c binutils-2.15/bfd/elf32-ppc.c +--- binutils-2.15-pristine/bfd/elf32-ppc.c 2004-05-17 12:35:59.000000000 -0700 ++++ binutils-2.15/bfd/elf32-ppc.c 2004-07-19 16:49:59.000000000 -0700 +@@ -49,7 +49,7 @@ + + /* The name of the dynamic interpreter. This is put in the .interp + section. */ +-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" ++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" + + /* The size in bytes of an entry in the procedure linkage table. */ + #define PLT_ENTRY_SIZE 12 +diff -uNr binutils-2.15-pristine/bfd/elf32-s390.c binutils-2.15/bfd/elf32-s390.c +--- binutils-2.15-pristine/bfd/elf32-s390.c 2004-05-17 12:35:59.000000000 -0700 ++++ binutils-2.15/bfd/elf32-s390.c 2004-07-19 16:49:59.000000000 -0700 +@@ -452,7 +452,7 @@ + /* The name of the dynamic interpreter. This is put in the .interp + section. */ + +-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" ++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" + + /* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid + copying dynamic variables from a shared lib into an app's dynbss +diff -uNr binutils-2.15-pristine/bfd/elf32-sparc.c binutils-2.15/bfd/elf32-sparc.c +--- binutils-2.15-pristine/bfd/elf32-sparc.c 2004-05-17 12:36:00.000000000 -0700 ++++ binutils-2.15/bfd/elf32-sparc.c 2004-07-19 16:49:59.000000000 -0700 +@@ -536,7 +536,7 @@ + /* The name of the dynamic interpreter. This is put in the .interp + section. */ + +-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" ++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" + + /* The nop opcode we use. */ + +diff -uNr binutils-2.15-pristine/bfd/elf64-ppc.c binutils-2.15/bfd/elf64-ppc.c +--- binutils-2.15-pristine/bfd/elf64-ppc.c 2004-05-17 12:36:01.000000000 -0700 ++++ binutils-2.15/bfd/elf64-ppc.c 2004-07-19 16:49:59.000000000 -0700 +@@ -99,7 +99,7 @@ + + /* The name of the dynamic interpreter. This is put in the .interp + section. */ +-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" ++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" + + /* The size in bytes of an entry in the procedure linkage table. */ + #define PLT_ENTRY_SIZE 24 +diff -uNr binutils-2.15-pristine/bfd/elf64-s390.c binutils-2.15/bfd/elf64-s390.c +--- binutils-2.15-pristine/bfd/elf64-s390.c 2004-05-17 12:36:01.000000000 -0700 ++++ binutils-2.15/bfd/elf64-s390.c 2004-07-19 16:49:59.000000000 -0700 +@@ -473,7 +473,7 @@ + /* The name of the dynamic interpreter. This is put in the .interp + section. */ + +-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" ++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" + + /* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid + copying dynamic variables from a shared lib into an app's dynbss +diff -uNr binutils-2.15-pristine/bfd/elf-m10300.c binutils-2.15/bfd/elf-m10300.c +--- binutils-2.15-pristine/bfd/elf-m10300.c 2004-05-17 12:35:57.000000000 -0700 ++++ binutils-2.15/bfd/elf-m10300.c 2004-07-19 16:49:59.000000000 -0700 +@@ -4026,7 +4026,7 @@ + /* The name of the dynamic interpreter. This is put in the .interp + section. */ + +-#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1" ++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" + + /* Create dynamic sections when linking against a dynamic object. */ + +diff -uNr binutils-2.15-pristine/bfd/elfxx-ia64.c binutils-2.15/bfd/elfxx-ia64.c +--- binutils-2.15-pristine/bfd/elfxx-ia64.c 2004-05-17 12:36:02.000000000 -0700 ++++ binutils-2.15/bfd/elfxx-ia64.c 2004-07-19 16:49:59.000000000 -0700 +@@ -643,7 +643,7 @@ + 0x60, 0x00, 0x80, 0x00 /* br.few b6;; */ + }; + +-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" ++#define ELF_DYNAMIC_INTERPRETER "/lib/ld-uClibc.so.0" + + static const bfd_byte oor_brl[16] = + { diff --git a/patches/binutils/2.15/110-uclibc-conf.patch b/patches/binutils/2.15/110-uclibc-conf.patch new file mode 100644 index 0000000..1c7fa4a --- /dev/null +++ b/patches/binutils/2.15/110-uclibc-conf.patch @@ -0,0 +1,692 @@ +diff -urN binutils-2.15-dist/bfd/config.bfd binutils-2.15/bfd/config.bfd +--- binutils-2.15-dist/bfd/config.bfd 2004-05-17 14:35:56.000000000 -0500 ++++ binutils-2.15/bfd/config.bfd 2004-08-04 12:01:44.000000000 -0500 +@@ -126,7 +126,7 @@ + targ_defvec=ecoffalpha_little_vec + targ_selvecs=bfd_elf64_alpha_vec + ;; +- alpha*-*-linux-gnu* | alpha*-*-elf*) ++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc* | alpha*-*-elf*) + targ_defvec=bfd_elf64_alpha_vec + targ_selvecs=ecoffalpha_little_vec + ;; +@@ -136,7 +136,7 @@ + alpha*-*-*) + targ_defvec=ecoffalpha_little_vec + ;; +- ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu) ++ ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-linux-uclibc* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu) + targ_defvec=bfd_elf64_ia64_little_vec + targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec" + ;; +@@ -213,7 +213,7 @@ + targ_defvec=bfd_elf32_littlearm_vec + targ_selvecs=bfd_elf32_bigarm_vec + ;; +- armeb-*-elf | arm*b-*-linux-gnu*) ++ armeb-*-elf | arm*b-*-linux-gnu* | arm*b-*-linux-uclibc*) + targ_defvec=bfd_elf32_bigarm_vec + targ_selvecs=bfd_elf32_littlearm_vec + ;; +@@ -221,7 +221,7 @@ + targ_defvec=bfd_elf32_littlearm_vec + targ_selvecs=bfd_elf32_bigarm_vec + ;; +- arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | \ ++ arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-linux-uclibc* | arm*-*-conix* | \ + arm*-*-uclinux* | arm-*-kfreebsd*-gnu | arm-*-vxworks) + targ_defvec=bfd_elf32_littlearm_vec + targ_selvecs=bfd_elf32_bigarm_vec +@@ -360,7 +360,7 @@ + ;; + + #ifdef BFD64 +- hppa*64*-*-linux-gnu*) ++ hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*) + targ_defvec=bfd_elf64_hppa_linux_vec + targ_selvecs=bfd_elf64_hppa_vec + ;; +@@ -371,7 +371,7 @@ + ;; + #endif + +- hppa*-*-linux-gnu* | hppa*-*-netbsd*) ++ hppa*-*-linux-gnu* | hppa*-*-linux-uclibc* | hppa*-*-netbsd*) + targ_defvec=bfd_elf32_hppa_linux_vec + targ_selvecs=bfd_elf32_hppa_vec + ;; +@@ -494,7 +494,7 @@ + targ_selvecs=bfd_elf32_i386_vec + targ_underscore=yes + ;; +- i[3-7]86-*-linux-gnu*) ++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) + targ_defvec=bfd_elf32_i386_vec + targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec" + targ64_selvecs=bfd_elf64_x86_64_vec +@@ -508,7 +508,7 @@ + targ_defvec=bfd_elf64_x86_64_vec + targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec" + ;; +- x86_64-*-linux-gnu*) ++ x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*) + targ_defvec=bfd_elf64_x86_64_vec + targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec" + ;; +@@ -683,7 +683,7 @@ + targ_selvecs=bfd_elf32_m68k_vec + targ_underscore=yes + ;; +- m68*-*-linux-gnu*) ++ m68*-*-linux-gnu* | m68*-*-linux-uclibc*) + targ_defvec=bfd_elf32_m68k_vec + targ_selvecs=m68klinux_vec + ;; +@@ -955,7 +955,8 @@ + ;; + #endif + powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \ +- powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \ ++ powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-linux-uclibc* | \ ++ powerpc-*-rtems* | \ + powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss*) + targ_defvec=bfd_elf32_powerpc_vec + targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec" +@@ -987,8 +988,8 @@ + targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec" + ;; + powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \ +- powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks* |\ +- powerpcle-*-rtems*) ++ powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-linux-uclibc* |\ ++ powerpcle-*-vxworks* | powerpcle-*-rtems*) + targ_defvec=bfd_elf32_powerpcle_vec + targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec" + targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec" +@@ -1149,7 +1150,7 @@ + targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec" + targ_underscore=yes + ;; +- sparc-*-linux-gnu*) ++ sparc-*-linux-gnu* | sparc-*-linux-uclibc*) + targ_defvec=bfd_elf32_sparc_vec + targ_selvecs="sparclinux_vec bfd_elf64_sparc_vec sunos_big_vec" + ;; +@@ -1196,7 +1197,7 @@ + targ_defvec=sunos_big_vec + targ_underscore=yes + ;; +- sparc64-*-linux-gnu*) ++ sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*) + targ_defvec=bfd_elf64_sparc_vec + targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec" + ;; +@@ -1265,7 +1266,7 @@ + targ_underscore=yes + ;; + +- vax-*-linux-gnu*) ++ vax-*-linux-gnu* | vax-*-linux-uclibc*) + targ_defvec=bfd_elf32_vax_vec + ;; + +diff -urN binutils-2.15-dist/bfd/configure binutils-2.15/bfd/configure +--- binutils-2.15-dist/bfd/configure 2004-05-17 14:35:57.000000000 -0500 ++++ binutils-2.15/bfd/configure 2004-08-04 12:01:44.000000000 -0500 +@@ -1699,6 +1699,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]+$' +@@ -5278,7 +5283,7 @@ + alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu) + COREFILE='' + ;; +- alpha*-*-linux-gnu*) ++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/alphalinux.h"' + ;; +@@ -5338,7 +5343,7 @@ + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/i386mach3.h"' + ;; +- i[3-7]86-*-linux-gnu*) ++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/i386linux.h"' + ;; +@@ -5376,7 +5381,7 @@ + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/hp300bsd.h"' + ;; +- m68*-*-linux-gnu*) ++ m68*-*-linux-gnu* | m68*-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/m68klinux.h"' + ;; +@@ -5477,7 +5482,7 @@ + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/vaxult2.h"' + ;; +- vax-*-linux-gnu*) ++ vax-*-linux-gnu* | vax-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/vaxlinux.h"' + ;; +diff -urN binutils-2.15-dist/bfd/configure.in binutils-2.15/bfd/configure.in +--- binutils-2.15-dist/bfd/configure.in 2004-05-17 14:35:57.000000000 -0500 ++++ binutils-2.15/bfd/configure.in 2004-08-04 12:01:44.000000000 -0500 +@@ -178,7 +178,7 @@ + alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu) + COREFILE='' + ;; +- alpha*-*-linux-gnu*) ++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/alphalinux.h"' + ;; +@@ -259,7 +259,7 @@ + TRAD_HEADER='"hosts/i386mach3.h"' + ;; + changequote(,)dnl +- i[3-7]86-*-linux-gnu*) ++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) + changequote([,])dnl + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/i386linux.h"' +@@ -300,7 +300,7 @@ + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/hp300bsd.h"' + ;; +- m68*-*-linux-gnu*) ++ m68*-*-linux-gnu* | m68*-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/m68klinux.h"' + ;; +@@ -385,7 +385,7 @@ + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/vaxult2.h"' + ;; +- vax-*-linux-gnu*) ++ vax-*-linux-gnu* | vax-*-linux-uclibc*) + COREFILE=trad-core.lo + TRAD_HEADER='"hosts/vaxlinux.h"' + ;; +diff -urN binutils-2.15-dist/binutils/configure binutils-2.15/binutils/configure +--- binutils-2.15-dist/binutils/configure 2004-01-02 11:08:04.000000000 -0600 ++++ binutils-2.15/binutils/configure 2004-08-04 12:01:44.000000000 -0500 +@@ -1585,6 +1585,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 binutils-2.15-dist/configure binutils-2.15/configure +--- binutils-2.15-dist/configure 2004-05-17 14:36:20.000000000 -0500 ++++ binutils-2.15/configure 2004-08-04 12:01:44.000000000 -0500 +@@ -1288,6 +1288,18 @@ + i[3456789]86-*-freebsd* | i[3456789]86-*-kfreebsd*-gnu) + noconfigdirs="$noconfigdirs target-newlib target-libgloss" + ;; ++ i[3456789]86-*-linux-uclibc*) ++ # This section makes it possible to build newlib natively on linux. ++ # If we are using a cross compiler then don't configure newlib. ++ if test x${is_cross_compiler} != xno ; then ++ noconfigdirs="$noconfigdirs target-newlib" ++ fi ++ noconfigdirs="$noconfigdirs target-libgloss" ++ # If we are not using a cross compiler, do configure newlib. ++ # Note however, that newlib will only be configured in this situation ++ # if the --with-newlib option has been given, because otherwise ++ # 'target-newlib' will appear in skipdirs. ++ ;; + i[3456789]86-*-linux*) + # The GCC port for glibc1 has no MD_FALLBACK_FRAME_STATE_FOR, so let's + # not build java stuff by default. +diff -urN binutils-2.15-dist/configure.in binutils-2.15/configure.in +--- binutils-2.15-dist/configure.in 2004-05-17 14:40:54.000000000 -0500 ++++ binutils-2.15/configure.in 2004-08-04 12:01:44.000000000 -0500 +@@ -521,6 +521,18 @@ + i[[3456789]]86-*-freebsd* | i[[3456789]]86-*-kfreebsd*-gnu) + noconfigdirs="$noconfigdirs target-newlib target-libgloss" + ;; ++ i[[3456789]]86-*-linux-uclibc*) ++ # This section makes it possible to build newlib natively on linux. ++ # If we are using a cross compiler then don't configure newlib. ++ if test x${is_cross_compiler} != xno ; then ++ noconfigdirs="$noconfigdirs target-newlib" ++ fi ++ noconfigdirs="$noconfigdirs target-libgloss" ++ # If we are not using a cross compiler, do configure newlib. ++ # Note however, that newlib will only be configured in this situation ++ # if the --with-newlib option has been given, because otherwise ++ # 'target-newlib' will appear in skipdirs. ++ ;; + i[[3456789]]86-*-linux*) + # The GCC port for glibc1 has no MD_FALLBACK_FRAME_STATE_FOR, so let's + # not build java stuff by default. +diff -urN binutils-2.15-dist/gas/configure binutils-2.15/gas/configure +--- binutils-2.15-dist/gas/configure 2004-05-17 14:36:07.000000000 -0500 ++++ binutils-2.15/gas/configure 2004-08-04 12:07:50.000000000 -0500 +@@ -3400,6 +3400,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]+$' +@@ -4224,6 +4229,7 @@ + alpha*-*-osf*) fmt=ecoff ;; + alpha*-*-linuxecoff*) fmt=ecoff ;; + alpha*-*-linux-gnu*) fmt=elf em=linux ;; ++ alpha*-*-linux-uclibc*) fmt=elf em=linux ;; + alpha*-*-netbsd*) fmt=elf em=nbsd ;; + alpha*-*-openbsd*) fmt=elf em=obsd ;; + +@@ -4240,6 +4246,7 @@ + arm*-*-conix*) fmt=elf ;; + arm-*-linux*aout*) fmt=aout em=linux ;; + arm*-*-linux-gnu*) fmt=elf em=linux ;; ++ arm*-*-linux-uclibc*) fmt=elf em=linux ;; + arm*-*-uclinux*) fmt=elf em=linux ;; + arm-*-netbsdelf*) fmt=elf em=nbsd ;; + arm-*-*n*bsd*) fmt=aout em=nbsd ;; +@@ -4253,6 +4260,7 @@ + avr-*-*) fmt=elf ;; + + cris-*-linux-gnu*) fmt=multi bfd_gas=yes em=linux ;; ++ cris-*-linux-uclibc*) fmt=multi bfd_gas=yes em=linux ;; + cris-*-*) fmt=multi bfd_gas=yes ;; + + d10v-*-*) fmt=elf ;; +@@ -4310,7 +4318,9 @@ + i386-*-linux*oldld) fmt=aout em=linux ;; + i386-*-linux*coff*) fmt=coff em=linux ;; + i386-*-linux-gnu*) fmt=elf em=linux ;; ++ i386-*-linux-uclibc*) fmt=elf em=linux ;; + x86_64-*-linux-gnu*) fmt=elf em=linux ;; ++ x86_64-*-linux-uclibc*) fmt=elf em=linux ;; + i386-*-lynxos*) fmt=coff em=lynx ;; + i386-*-sysv[45]*) fmt=elf ;; + i386-*-solaris*) fmt=elf ;; +@@ -4370,6 +4380,7 @@ + ia64-*-elf*) fmt=elf ;; + ia64-*-aix*) fmt=elf em=ia64aix ;; + ia64-*-linux-gnu*) fmt=elf em=linux ;; ++ ia64-*-linux-uclibc*) fmt=elf em=linux ;; + ia64-*-hpux*) fmt=elf em=hpux ;; + ia64-*-netbsd*) fmt=elf em=nbsd ;; + +@@ -4397,6 +4408,7 @@ + m68k-*-hpux*) fmt=hp300 em=hp300 ;; + m68k-*-linux*aout*) fmt=aout em=linux ;; + m68k-*-linux-gnu*) fmt=elf em=linux ;; ++ m68k-*-linux-uclibc*) fmt=elf em=linux ;; + m68k-*-uclinux*) fmt=elf ;; + m68k-*-gnu*) fmt=elf ;; + m68k-*-lynxos*) fmt=coff em=lynx ;; +@@ -4459,6 +4471,7 @@ + ppc-*-beos*) fmt=coff ;; + ppc-*-*n*bsd* | ppc-*-elf*) fmt=elf ;; + ppc-*-eabi* | ppc-*-sysv4*) fmt=elf ;; ++ ppc-*-linux-uclibc* | \ + ppc-*-linux-gnu*) fmt=elf em=linux + case "$endian" in + big) ;; +@@ -4486,7 +4499,9 @@ + ppc-*-kaos*) fmt=elf ;; + + s390x-*-linux-gnu*) fmt=elf em=linux ;; ++ s390x-*-linux-uclibc*) fmt=elf em=linux ;; + s390-*-linux-gnu*) fmt=elf em=linux ;; ++ s390-*-linux-uclibc*) fmt=elf em=linux ;; + + sh*-*-linux*) fmt=elf em=linux + case ${cpu} in +@@ -4519,6 +4534,7 @@ + sparc-*-coff) fmt=coff ;; + sparc-*-linux*aout*) fmt=aout em=linux ;; + sparc-*-linux-gnu*) fmt=elf em=linux ;; ++ sparc-*-linux-uclibc*) fmt=elf em=linux ;; + sparc-*-lynxos*) fmt=coff em=lynx ;; + sparc-fujitsu-none) fmt=aout ;; + sparc-*-elf) fmt=elf ;; +diff -urN binutils-2.15-dist/gas/configure.in binutils-2.15/gas/configure.in +--- binutils-2.15-dist/gas/configure.in 2004-05-17 14:36:07.000000000 -0500 ++++ binutils-2.15/gas/configure.in 2004-08-04 12:07:21.000000000 -0500 +@@ -194,6 +194,7 @@ + alpha*-*-osf*) fmt=ecoff ;; + alpha*-*-linuxecoff*) fmt=ecoff ;; + alpha*-*-linux-gnu*) fmt=elf em=linux ;; ++ alpha*-*-linux-uclibc*) fmt=elf em=linux ;; + alpha*-*-netbsd*) fmt=elf em=nbsd ;; + alpha*-*-openbsd*) fmt=elf em=obsd ;; + +@@ -210,6 +211,7 @@ + arm*-*-conix*) fmt=elf ;; + arm-*-linux*aout*) fmt=aout em=linux ;; + arm*-*-linux-gnu*) fmt=elf em=linux ;; ++ arm*-*-linux-uclibc*) fmt=elf em=linux ;; + arm*-*-uclinux*) fmt=elf em=linux ;; + arm-*-netbsdelf*) fmt=elf em=nbsd ;; + arm-*-*n*bsd*) fmt=aout em=nbsd ;; +@@ -223,6 +225,7 @@ + avr-*-*) fmt=elf ;; + + cris-*-linux-gnu*) fmt=multi bfd_gas=yes em=linux ;; ++ cris-*-linux-uclibc*) fmt=multi bfd_gas=yes em=linux ;; + cris-*-*) fmt=multi bfd_gas=yes ;; + + d10v-*-*) fmt=elf ;; +@@ -280,7 +283,9 @@ + i386-*-linux*oldld) fmt=aout em=linux ;; + i386-*-linux*coff*) fmt=coff em=linux ;; + i386-*-linux-gnu*) fmt=elf em=linux ;; ++ i386-*-linux-uclibc*) fmt=elf em=linux ;; + x86_64-*-linux-gnu*) fmt=elf em=linux ;; ++ x86_64-*-linux-uclibc*) fmt=elf em=linux ;; + i386-*-lynxos*) fmt=coff em=lynx ;; + changequote(,)dnl + i386-*-sysv[45]*) fmt=elf ;; +@@ -333,6 +338,7 @@ + ia64-*-elf*) fmt=elf ;; + ia64-*-aix*) fmt=elf em=ia64aix ;; + ia64-*-linux-gnu*) fmt=elf em=linux ;; ++ ia64-*-linux-uclibc*) fmt=elf em=linux ;; + ia64-*-hpux*) fmt=elf em=hpux ;; + ia64-*-netbsd*) fmt=elf em=nbsd ;; + +@@ -360,6 +366,7 @@ + m68k-*-hpux*) fmt=hp300 em=hp300 ;; + m68k-*-linux*aout*) fmt=aout em=linux ;; + m68k-*-linux-gnu*) fmt=elf em=linux ;; ++ m68k-*-linux-uclibc*) fmt=elf em=linux ;; + m68k-*-uclinux*) fmt=elf ;; + m68k-*-gnu*) fmt=elf ;; + m68k-*-lynxos*) fmt=coff em=lynx ;; +@@ -419,6 +426,7 @@ + ppc-*-beos*) fmt=coff ;; + ppc-*-*n*bsd* | ppc-*-elf*) fmt=elf ;; + ppc-*-eabi* | ppc-*-sysv4*) fmt=elf ;; ++ ppc-*-linux-uclibc* | \ + ppc-*-linux-gnu*) fmt=elf em=linux + case "$endian" in + big) ;; +@@ -439,7 +447,9 @@ + ppc-*-kaos*) fmt=elf ;; + + s390x-*-linux-gnu*) fmt=elf em=linux ;; ++ s390x-*-linux-uclibc*) fmt=elf em=linux ;; + s390-*-linux-gnu*) fmt=elf em=linux ;; ++ s390-*-linux-uclibc*) fmt=elf em=linux ;; + + sh*-*-linux*) fmt=elf em=linux + case ${cpu} in +@@ -472,6 +482,7 @@ + sparc-*-coff) fmt=coff ;; + sparc-*-linux*aout*) fmt=aout em=linux ;; + sparc-*-linux-gnu*) fmt=elf em=linux ;; ++ sparc-*-linux-uclibc*) fmt=elf em=linux ;; + sparc-*-lynxos*) fmt=coff em=lynx ;; + sparc-fujitsu-none) fmt=aout ;; + sparc-*-elf) fmt=elf ;; +diff -urN binutils-2.15-dist/gprof/configure binutils-2.15/gprof/configure +--- binutils-2.15-dist/gprof/configure 2003-08-26 12:19:19.000000000 -0500 ++++ binutils-2.15/gprof/configure 2004-08-04 12:01:45.000000000 -0500 +@@ -1581,6 +1581,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 binutils-2.15-dist/ld/configure binutils-2.15/ld/configure +--- binutils-2.15-dist/ld/configure 2003-04-24 07:36:07.000000000 -0500 ++++ binutils-2.15/ld/configure 2004-08-04 12:01:45.000000000 -0500 +@@ -1589,6 +1589,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 binutils-2.15-dist/ld/configure.tgt binutils-2.15/ld/configure.tgt +--- binutils-2.15-dist/ld/configure.tgt 2004-05-17 14:36:15.000000000 -0500 ++++ binutils-2.15/ld/configure.tgt 2004-08-04 12:01:45.000000000 -0500 +@@ -30,6 +30,7 @@ + targ_extra_emuls="criself crislinux" + targ_extra_libpath=$targ_extra_emuls ;; + cris-*-linux-gnu*) targ_emul=crislinux ;; ++cris-*-linux-uclibc*) targ_emul=crislinux ;; + cris-*-*) targ_emul=criself + targ_extra_emuls="crisaout crislinux" + targ_extra_libpath=$targ_extra_emuls ;; +@@ -59,14 +60,16 @@ + tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/aout//'` + tdir_sun4=sparc-sun-sunos4 + ;; +-sparc64-*-linux-gnu*) targ_emul=elf64_sparc ++sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*) \ ++ targ_emul=elf64_sparc + targ_extra_emuls="elf32_sparc sparclinux sun4" + targ_extra_libpath=elf32_sparc + tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'` + tdir_sparclinux=${tdir_elf32_sparc}aout + tdir_sun4=sparc-sun-sunos4 + ;; +-sparc*-*-linux-gnu*) targ_emul=elf32_sparc ++sparc*-*-linux-gnu* | sparc*-*-linux-uclibc*) \ ++ targ_emul=elf32_sparc + targ_extra_emuls="sparclinux elf64_sparc sun4" + targ_extra_libpath=elf64_sparc + tdir_sparclinux=${targ_alias}aout +@@ -118,7 +121,9 @@ + m32r*le-*-elf*) targ_emul=m32rlelf ;; + m32r*-*-elf*) targ_emul=m32relf ;; + m32r*le-*-linux-gnu*) targ_emul=m32rlelf_linux ;; ++m32r*le-*-linux-uclibc*) targ_emul=m32rlelf_linux ;; + m32r*-*-linux-gnu*) targ_emul=m32relf_linux ;; ++m32r*-*-linux-uclibc*) targ_emul=m32relf_linux ;; + m68hc11-*-*|m6811-*-*) targ_emul=m68hc11elf + targ_extra_emuls="m68hc11elfb m68hc12elf m68hc12elfb" ;; + m68hc12-*-*|m6812-*-*) targ_emul=m68hc12elf +@@ -128,7 +133,7 @@ + m68*-ericsson-ose) targ_emul=sun3 ;; + m68*-apple-aux*) targ_emul=m68kaux ;; + *-tandem-none) targ_emul=st2000 ;; +-i370-*-elf* | i370-*-linux-gnu*) targ_emul=elf32i370 ;; ++i370-*-elf* | i370-*-linux-gnu* | i370-*-linux-uclibc*) targ_emul=elf32i370 ;; + i[3-7]86-*-nto-qnx*) targ_emul=i386nto ;; + i[3-7]86-*-vsta) targ_emul=vsta ;; + i[3-7]86-go32-rtems*) targ_emul=i386go32 ;; +@@ -152,14 +157,16 @@ + tdir_elf_i386=`echo ${targ_alias} | sed -e 's/aout//'` + ;; + i[3-7]86-*-linux*oldld) targ_emul=i386linux; targ_extra_emuls=elf_i386 ;; +-i[3-7]86-*-linux-gnu*) targ_emul=elf_i386 ++i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*) \ ++ targ_emul=elf_i386 + targ_extra_emuls=i386linux + if test x${want64} = xtrue; then + targ_extra_emuls="$targ_extra_emuls elf_x86_64" + fi + tdir_i386linux=${targ_alias}aout + ;; +-x86_64-*-linux-gnu*) targ_emul=elf_x86_64 ++x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*) \ ++ targ_emul=elf_x86_64 + targ_extra_emuls="elf_i386 i386linux" + targ_extra_libpath=elf_i386 + tdir_i386linux=`echo ${targ_alias}aout | sed -e 's/x86_64/i386/'` +@@ -259,10 +266,13 @@ + arm9e-*-elf) targ_emul=armelf ;; + arm-*-oabi) targ_emul=armelf_oabi ;; + arm*b-*-linux-gnu*) targ_emul=armelfb_linux; targ_extra_emuls=armelfb ;; ++arm*b-*-linux-uclibc*) targ_emul=armelfb_linux; targ_extra_emuls=armelfb ;; + arm*-*-linux-gnu*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;; ++arm*-*-linux-uclibc*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;; + arm*-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;; + arm*-*-conix*) targ_emul=armelf ;; +-thumb-*-linux-gnu* | thumb-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;; ++thumb-*-linux-gnu* | thumb-*-linux-uclibc* | thumb-*-uclinux*) \ ++ targ_emul=armelf_linux; targ_extra_emuls=armelf ;; + strongarm-*-coff) targ_emul=armcoff ;; + strongarm-*-elf) targ_emul=armelf ;; + strongarm-*-kaos*) targ_emul=armelf ;; +@@ -364,7 +374,8 @@ + targ_extra_emuls=m68kelf + tdir_m68kelf=`echo ${targ_alias} | sed -e 's/aout//'` + ;; +-m68k-*-linux-gnu*) targ_emul=m68kelf ++m68k-*-linux-gnu* | m68k-*-linux-uclibc*) \ ++ targ_emul=m68kelf + targ_extra_emuls=m68klinux + tdir_m68klinux=`echo ${targ_alias} | sed -e 's/linux/linuxaout/'` + ;; +@@ -381,9 +392,9 @@ + m68*-*-psos*) targ_emul=m68kpsos ;; + m68*-*-rtemscoff*) targ_emul=m68kcoff ;; + m68*-*-rtems*) targ_emul=m68kelf ;; +-hppa*64*-*-linux-gnu*) targ_emul=hppa64linux ;; ++hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*) targ_emul=hppa64linux ;; + hppa*64*-*) targ_emul=elf64hppa ;; +-hppa*-*-linux-gnu*) targ_emul=hppalinux ;; ++hppa*-*-linux-gnu* | hppa*-*-linux-uclibc*) targ_emul=hppalinux ;; + hppa*-*-*elf*) targ_emul=hppaelf ;; + hppa*-*-lites*) targ_emul=hppaelf ;; + hppa*-*-netbsd*) targ_emul=hppanbsd ;; +@@ -396,6 +407,7 @@ + targ_emul=vaxnbsd + targ_extra_emuls=elf32vax ;; + vax-*-linux-gnu*) targ_emul=elf32vax ;; ++vax-*-linux-uclibc*) targ_emul=elf32vax ;; + mips*-*-pe) targ_emul=mipspe ; + targ_extra_ofiles="deffilep.o pe-dll.o" ;; + mips*-dec-ultrix*) targ_emul=mipslit ;; +@@ -429,16 +441,16 @@ + mips*-*-vxworks*) targ_emul=elf32ebmip + targ_extra_emuls="elf32elmip" ;; + mips*-*-windiss) targ_emul=elf32mipswindiss ;; +-mips64*el-*-linux-gnu*) targ_emul=elf32ltsmipn32 ++mips64*el-*-linux-gnu* | mips64*el-*-linux-uclibc*) targ_emul=elf32ltsmipn32 + targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip" + ;; +-mips64*-*-linux-gnu*) targ_emul=elf32btsmipn32 ++mips64*-*-linux-gnu* | mips64*-*-linux-uclibc*) targ_emul=elf32btsmipn32 + targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip" + ;; +-mips*el-*-linux-gnu*) targ_emul=elf32ltsmip ++mips*el-*-linux-gnu* | mips*el-*-linux-uclibc*) targ_emul=elf32ltsmip + targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip" + ;; +-mips*-*-linux-gnu*) targ_emul=elf32btsmip ++mips*-*-linux-gnu* | mips*-*-linux-uclibc*) targ_emul=elf32btsmip + targ_extra_emuls="elf32ltsmip elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip" + ;; + mips*-*-lnews*) targ_emul=mipslnews ;; +@@ -461,6 +473,10 @@ + alpha*-*-linux-gnu*) targ_emul=elf64alpha targ_extra_emuls=alpha + tdir_alpha=`echo ${targ_alias} | sed -e 's/linux/linuxecoff/'` + ;; ++alpha*-*-linux-uclibc*) targ_emul=elf64alpha targ_extra_emuls=alpha ++ # The following needs to be checked... ++ tdir_alpha=`echo ${targ_alias} | sed -e 's/linux/linuxecoff/'` ++ ;; + alpha*-*-osf*) targ_emul=alpha ;; + alpha*-*-gnu*) targ_emul=elf64alpha ;; + alpha*-*-netware*) targ_emul=alpha ;; +diff -urN binutils-2.15-dist/libtool.m4 binutils-2.15/libtool.m4 +--- binutils-2.15-dist/libtool.m4 2003-04-10 22:58:39.000000000 -0500 ++++ binutils-2.15/libtool.m4 2004-08-04 12:01:45.000000000 -0500 +@@ -645,6 +645,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 binutils-2.15-dist/ltconfig binutils-2.15/ltconfig +--- binutils-2.15-dist/ltconfig 2003-10-03 23:54:47.000000000 -0500 ++++ binutils-2.15/ltconfig 2004-08-04 12:01:45.000000000 -0500 +@@ -603,6 +603,7 @@ + # Transform linux* to *-*-linux-gnu*, to support old configure scripts. + case $host_os in + linux-gnu*) ;; ++linux-uclibc*) ;; + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` + esac + +@@ -1259,6 +1260,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 -urN binutils-2.15-dist/opcodes/configure binutils-2.15/opcodes/configure +--- binutils-2.15-dist/opcodes/configure 2003-08-05 04:39:31.000000000 -0500 ++++ binutils-2.15/opcodes/configure 2004-08-04 12:01:45.000000000 -0500 +@@ -1700,6 +1700,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 --git a/patches/binutils/2.15/120-cflags.patch b/patches/binutils/2.15/120-cflags.patch new file mode 100644 index 0000000..dc67d3c --- /dev/null +++ b/patches/binutils/2.15/120-cflags.patch @@ -0,0 +1,32 @@ +diff -urN binutils-2.14.90.0.6/bfd/doc/Makefile.am binutils-2.14.90.0.6.new/bfd/doc/Makefile.am +--- binutils-2.14.90.0.6/bfd/doc/Makefile.am 2003-07-23 10:08:09.000000000 -0500 ++++ binutils-2.14.90.0.6.new/bfd/doc/Makefile.am 2004-03-01 16:05:16.000000000 -0600 +@@ -55,10 +55,10 @@ + MKDOC = chew$(EXEEXT_FOR_BUILD) + + $(MKDOC): chew.o +- $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS) $(LOADLIBES) $(LDFLAGS) ++ $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS_FOR_BUILD) $(LOADLIBES) $(LDFLAGS) + + chew.o: chew.c +- $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c ++ $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/chew.c + + protos: libbfd.h libcoff.h bfd.h + +diff -urN binutils-2.14.90.0.6/bfd/doc/Makefile.in binutils-2.14.90.0.6.new/bfd/doc/Makefile.in +--- binutils-2.14.90.0.6/bfd/doc/Makefile.in 2003-07-23 10:08:09.000000000 -0500 ++++ binutils-2.14.90.0.6.new/bfd/doc/Makefile.in 2004-03-01 16:05:03.000000000 -0600 +@@ -469,10 +469,10 @@ + + + $(MKDOC): chew.o +- $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS) $(LOADLIBES) $(LDFLAGS) ++ $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS_FOR_BUILD) $(LOADLIBES) $(LDFLAGS) + + chew.o: chew.c +- $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c ++ $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/chew.c + + protos: libbfd.h libcoff.h bfd.h + diff --git a/patches/binutils/2.15/130-mips-ELF_MAXPAGESIZE-4K.patch b/patches/binutils/2.15/130-mips-ELF_MAXPAGESIZE-4K.patch new file mode 100644 index 0000000..e07a7e8 --- /dev/null +++ b/patches/binutils/2.15/130-mips-ELF_MAXPAGESIZE-4K.patch @@ -0,0 +1,26 @@ +--- binutils/bfd/elf32-mips.c~ ++++ binutils/bfd/elf32-mips.c +@@ -1611,7 +1611,9 @@ + + /* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses + page sizes of up to that limit, so we need to respect it. */ +-#define ELF_MAXPAGESIZE 0x10000 ++/*#define ELF_MAXPAGESIZE 0x10000*/ ++/* Use 4K to shrink the elf header. NOT for general use! */ ++#define ELF_MAXPAGESIZE 0x1000 + #define elf32_bed elf32_tradbed + + /* Include the target file again for this target. */ +--- binutils/bfd/elfn32-mips.c~ ++++ binutils/bfd/elfn32-mips.c +@@ -1976,7 +1976,9 @@ + + /* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses + page sizes of up to that limit, so we need to respect it. */ +-#define ELF_MAXPAGESIZE 0x10000 ++/*#define ELF_MAXPAGESIZE 0x10000*/ ++/* Use 4K to shrink the elf header. NOT for general use! */ ++#define ELF_MAXPAGESIZE 0x1000 + #define elf32_bed elf32_tradbed + + /* Include the target file again for this target. */ diff --git a/patches/binutils/2.15/140-arm-textrel.patch b/patches/binutils/2.15/140-arm-textrel.patch new file mode 100644 index 0000000..73d5b9d --- /dev/null +++ b/patches/binutils/2.15/140-arm-textrel.patch @@ -0,0 +1,63 @@ +http://sources.redhat.com/ml/binutils/2004-06/msg00010.html +--- binutils-2.15.90.0.3-old/bfd/elf32-arm.h 2004-04-12 14:56:33.000000000 -0500 ++++ binutils-2.15.90.0.3/bfd/elf32-arm.h 2004-09-03 06:56:40.000000000 -0500 +@@ -87,6 +87,8 @@ + #endif + static bfd_boolean allocate_dynrelocs + PARAMS ((struct elf_link_hash_entry *h, PTR inf)); ++static bfd_boolean elf32_arm_readonly_dynrelocs ++ PARAMS ((struct elf_link_hash_entry *, PTR)); + static bfd_boolean create_got_section + PARAMS ((bfd * dynobj, struct bfd_link_info * info)); + static bfd_boolean elf32_arm_create_dynamic_sections +@@ -3531,6 +3533,37 @@ + return TRUE; + } + ++/* Find any dynamic relocs that apply to read-only sections. */ ++ ++static bfd_boolean ++elf32_arm_readonly_dynrelocs (h, inf) ++ struct elf_link_hash_entry *h; ++ PTR inf; ++{ ++ struct elf32_arm_link_hash_entry *eh; ++ struct elf32_arm_relocs_copied *p; ++ ++ if (h->root.type == bfd_link_hash_warning) ++ h = (struct elf_link_hash_entry *) h->root.u.i.link; ++ ++ eh = (struct elf32_arm_link_hash_entry *) h; ++ for (p = eh->relocs_copied; p != NULL; p = p->next) ++ { ++ asection *s = p->section; ++ ++ if (s != NULL && (s->flags & SEC_READONLY) != 0) ++ { ++ struct bfd_link_info *info = (struct bfd_link_info *) inf; ++ ++ info->flags |= DF_TEXTREL; ++ ++ /* Not an error, just cut short the traversal. */ ++ return FALSE; ++ } ++ } ++ return TRUE; ++} ++ + /* Set the sizes of the dynamic sections. */ + + static bfd_boolean +@@ -3740,6 +3773,12 @@ + return FALSE; + } + ++ /* If any dynamic relocs apply to a read-only section, ++ then we need a DT_TEXTREL entry. */ ++ if ((info->flags & DF_TEXTREL) == 0) ++ elf_link_hash_traverse (&htab->root, elf32_arm_readonly_dynrelocs, ++ (PTR) info); ++ + if ((info->flags & DF_TEXTREL) != 0) + { + if (!add_dynamic_entry (DT_TEXTREL, 0)) diff --git a/patches/binutils/2.15/150-bfd-hash-tweak.patch b/patches/binutils/2.15/150-bfd-hash-tweak.patch new file mode 100644 index 0000000..6b8fc41 --- /dev/null +++ b/patches/binutils/2.15/150-bfd-hash-tweak.patch @@ -0,0 +1,24 @@ +Signed-off-by: dank@kegel.com + +Raising the size of the hash table is a noticable win when linking +at least one large app. + +There was a patch, +http://sources.redhat.com/ml/binutils/2004-06/msg00165.html +to do this dynamically. No idea why that didn't make it in. +So this tiny change to raise the default size is just +a stopgap for now. + + +--- binutils-2.15/bfd/hash.c.old 2003-12-01 01:33:01.000000000 -0500 ++++ binutils-2.15/bfd/hash.c 2006-03-01 16:26:26.701991000 -0500 +@@ -295,7 +295,7 @@ + */ + + /* The default number of entries to use when creating a hash table. */ +-#define DEFAULT_SIZE (4051) ++#define DEFAULT_SIZE (32749) + + /* Create a new hash table, given a number of entries. */ + + diff --git a/patches/binutils/2.15/160-allow-gcc-4.0.patch b/patches/binutils/2.15/160-allow-gcc-4.0.patch new file mode 100644 index 0000000..26e5a12 --- /dev/null +++ b/patches/binutils/2.15/160-allow-gcc-4.0.patch @@ -0,0 +1,75 @@ +Fix found here: http://www.freelists.org/archives/openbeos/11-2005/msg00090.html + +Fixes: +In file included from ./targ-cpu.h:1, + from /home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/config/obj-elf.h:42, + from ./obj-format.h:1, + from /home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/config/te-linux.h:4, + from ./targ-env.h:1, + from /home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/as.h:626, + from /home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/app.c:30: +/home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/config/tc-i386.h:451: error: array type has incomplete element type +make[3]: *** [app.o] Error 1 +make[3]: Leaving directory `/home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/build-binutils/gas' + +when building binutils-2.15 with gcc-4.0 + + +diff -ur binutils-2.15.old/gas/as.h binutils-2.15/gas/as.h +--- binutils-2.15.old/gas/as.h 2003-11-22 18:14:21.000000000 -0800 ++++ binutils-2.15/gas/as.h 2006-02-14 22:05:35.000000000 -0800 +@@ -605,7 +605,26 @@ + struct expressionS; + struct fix; + typedef struct symbol symbolS; +-struct relax_type; ++ ++/* JF moved this here from as.h under the theory that nobody except MACHINE.c ++ and write.c care about it anyway. */ ++/* [zooey]: the above no longer holds with gcc4, as it keeps bugging about ++ incomplete element types in arrays, if relax_type isn't defined ++ here. So I moved the definition back from tc.h to here. */ ++struct relax_type ++{ ++ /* Forward reach. Signed number. > 0. */ ++ long rlx_forward; ++ /* Backward reach. Signed number. < 0. */ ++ long rlx_backward; ++ ++ /* Bytes length of this address. */ ++ unsigned char rlx_length; ++ ++ /* Next longer relax-state. 0 means there is no 'next' relax-state. */ ++ relax_substateT rlx_more; ++}; ++ + typedef struct frag fragS; + + #ifdef BFD_ASSEMBLER +diff -ur binutils-2.15.old/gas/tc.h binutils-2.15/gas/tc.h +--- binutils-2.15.old/gas/tc.h 2003-12-03 15:39:38.000000000 -0800 ++++ binutils-2.15/gas/tc.h 2006-02-14 22:03:35.000000000 -0800 +@@ -24,23 +24,6 @@ + + extern const pseudo_typeS md_pseudo_table[]; + +-/* JF moved this here from as.h under the theory that nobody except MACHINE.c +- and write.c care about it anyway. */ +- +-struct relax_type +-{ +- /* Forward reach. Signed number. > 0. */ +- long rlx_forward; +- /* Backward reach. Signed number. < 0. */ +- long rlx_backward; +- +- /* Bytes length of this address. */ +- unsigned char rlx_length; +- +- /* Next longer relax-state. 0 means there is no 'next' relax-state. */ +- relax_substateT rlx_more; +-}; +- + typedef struct relax_type relax_typeS; + + extern const int md_reloc_size; /* Size of a relocation record */ diff --git a/patches/binutils/2.15/170-psignal.patch b/patches/binutils/2.15/170-psignal.patch new file mode 100644 index 0000000..98fa600 --- /dev/null +++ b/patches/binutils/2.15/170-psignal.patch @@ -0,0 +1,40 @@ +Make psignal prototype in libiberty match that in glibc. + +Fixes: + +gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c: In function `psignal': +gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `signo' doesn't match prototype +/usr/include/signal.h:131: prototype declaration +gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `message' doesn't match prototype +/usr/include/signal.h:131: prototype declaration +gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:568: warning: comparison between signed and unsigned +mprotect... make[1]: *** [strsignal.o] Error 1 +make[1]: Leaving directory `/export/hda3/dkegel/queue/jobdir.produser_cpsm17/crosstool-0.32/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.1.3/build-binutils/libiberty' +make: *** [all-libiberty] Error 2 + +when building on red hat 7.1 +though it's a bit of a mystery why libiberty's psignal is being compiled at +all, since red hat 7.1's glibc supports psignal (hence the error message) + +--- binutils-2.15/libiberty/strsignal.c.old 2005-04-18 13:57:40.000000000 -0700 ++++ binutils-2.15/libiberty/strsignal.c 2005-04-18 13:59:09.000000000 -0700 +@@ -544,7 +544,7 @@ + + /* + +-@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message}) ++@deftypefn Supplemental void psignal (int @var{signo}, const char *@var{message}) + + Print @var{message} to the standard error, followed by a colon, + followed by the description of the signal specified by @var{signo}, +@@ -557,9 +557,7 @@ + #ifndef HAVE_PSIGNAL + + void +-psignal (signo, message) +- unsigned signo; +- char *message; ++psignal (int signo, const char *message) + { + if (signal_names == NULL) + { diff --git a/patches/binutils/2.15/180-solaris-qsort.patch b/patches/binutils/2.15/180-solaris-qsort.patch new file mode 100644 index 0000000..5fe3623 --- /dev/null +++ b/patches/binutils/2.15/180-solaris-qsort.patch @@ -0,0 +1,22 @@ +See http://sources.redhat.com/ml/binutils/2004-06/msg00114.html + +--- src/bfd/elflink.c.org 2004-07-05 09:11:42.920597000 -0400 ++++ src/bfd/elflink.c 2004-07-05 09:12:59.240847000 -0400 +@@ -2700,7 +2700,7 @@ + return vdiff > 0 ? 1 : -1; + else + { +- long sdiff = h1->root.u.def.section - h2->root.u.def.section; ++ long sdiff = h1->root.u.def.section->id - h2->root.u.def.section->id; + if (sdiff != 0) + return sdiff > 0 ? 1 : -1; + } +@@ -3954,7 +3954,7 @@ + i = idx + 1; + else + { +- long sdiff = slook - h->root.u.def.section; ++ long sdiff = slook->id - h->root.u.def.section->id; + if (sdiff < 0) + j = idx; + else if (sdiff > 0) diff --git a/patches/binutils/2.15/190-vmx.patch b/patches/binutils/2.15/190-vmx.patch new file mode 100644 index 0000000..5ae9efe --- /dev/null +++ b/patches/binutils/2.15/190-vmx.patch @@ -0,0 +1,45 @@ +Grabbed with +wget 'http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/opcodes/ppc-opc.c.diff?r1=1.70&r2=1.71&cvsroot=src' +See +http://mail.gnu.org/archive/html/bug-binutils/2004-05/msg00071.html +and +http://sources.redhat.com/ml/binutils-cvs/2004-05/msg00111.html + +This fixes problems like +{standard input}: Assembler messages: +{standard input}:1: Error: Unrecognized opcode: `dssall' +which show up in binutils-2.15 when building the Linux kernel, +or possibly failed compilations when building setjmp/longjmp in glibc. + +An alternative fix would be to pass -many to the assembler. +A patch to do that for glibc is at +wget 'http://sources.redhat.com/cgi-bin/get-raw-msg?listname=libc-alpha&date=2004-05&msgid=40B36E8C.9030609%40us.ibm.com' +Yet another, better, fix would be for gcc to generate assembly +that told the assembler which processor type to use. +Presumably the Linux kernel sources would need a fix, too. +Probably better to just fix binutils to accept sources that it used to. + + +=================================================================== +RCS file: /cvs/src/src/opcodes/ppc-opc.c,v +retrieving revision 1.70 +retrieving revision 1.71 +diff -u -r1.70 -r1.71 +--- src/opcodes/ppc-opc.c 2004/05/05 13:43:36 1.70 ++++ src/opcodes/ppc-opc.c 2004/05/19 05:11:48 1.71 +@@ -1004,8 +1004,13 @@ + + /* If only one bit of the FXM field is set, we can use the new form + of the instruction, which is faster. Unlike the Power4 branch hint +- encoding, this is not backward compatible. */ +- else if ((dialect & PPC_OPCODE_POWER4) != 0 && (value & -value) == value) ++ encoding, this is not backward compatible. Do not generate the ++ new form unless -mpower4 has been given, or -many and the two ++ operand form of mfcr was used. */ ++ else if ((value & -value) == value ++ && ((dialect & PPC_OPCODE_POWER4) != 0 ++ || ((dialect & PPC_OPCODE_ANY) != 0 ++ && (insn & (0x3ff << 1)) == 19 << 1))) + insn |= 1 << 20; + + /* Any other value on mfcr is an error. */ diff --git a/patches/binutils/2.15/200-arm-undef-imm.patch b/patches/binutils/2.15/200-arm-undef-imm.patch new file mode 100644 index 0000000..6bf403c --- /dev/null +++ b/patches/binutils/2.15/200-arm-undef-imm.patch @@ -0,0 +1,51 @@ +From http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/config/tc-arm.c.diff?r1=1.168&r2=1.169&cvsroot=src +See also http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2004-July/023128.html, +"[CRITICAL PATCH] 2.6: fix silent build error]" + +Revision 1.169, Fri Jul 2 11:12:29 2004 UTC (19 hours, 4 minutes ago) by nickc +Branch: MAIN +CVS Tags: binutils_latest_snapshot, HEAD +Changes since 1.168: +14 -1 lines + +(md_apply_fix3:BFD_RELOC_ARM_IMMEDIATE): Do not allow values which have come +from undefined symbols. +Always consider this fixup to have been processed as a reloc cannot be +generated for it. + + +=================================================================== +RCS file: /cvs/src/src/gas/config/tc-arm.c,v +retrieving revision 1.168 +retrieving revision 1.169 +diff -u -r1.168 -r1.169 +--- src/gas/config/tc-arm.c 2004/04/30 10:51:12 1.168 ++++ src/gas/config/tc-arm.c 2004/07/02 11:12:29 1.169 +@@ -12186,6 +12186,20 @@ + switch (fixP->fx_r_type) + { + case BFD_RELOC_ARM_IMMEDIATE: ++ /* We claim that this fixup has been processed here, ++ even if in fact we generate an error because we do ++ not have a reloc for it, so tc_gen_reloc will reject it. */ ++ fixP->fx_done = 1; ++ ++ if (fixP->fx_addsy ++ && ! S_IS_DEFINED (fixP->fx_addsy)) ++ { ++ as_bad_where (fixP->fx_file, fixP->fx_line, ++ _("undefined symbol %s used as an immediate value"), ++ S_GET_NAME (fixP->fx_addsy)); ++ break; ++ } ++ + newimm = validate_immediate (value); + temp = md_chars_to_number (buf, INSN_SIZE); + +@@ -12202,7 +12216,6 @@ + + newimm |= (temp & 0xfffff000); + md_number_to_chars (buf, (valueT) newimm, INSN_SIZE); +- fixP->fx_done = 1; + break; + + case BFD_RELOC_ARM_ADRL_IMMEDIATE: diff --git a/patches/binutils/2.15/210-cflags.patch b/patches/binutils/2.15/210-cflags.patch deleted file mode 100644 index dc67d3c..0000000 --- a/patches/binutils/2.15/210-cflags.patch +++ /dev/null @@ -1,32 +0,0 @@ -diff -urN binutils-2.14.90.0.6/bfd/doc/Makefile.am binutils-2.14.90.0.6.new/bfd/doc/Makefile.am ---- binutils-2.14.90.0.6/bfd/doc/Makefile.am 2003-07-23 10:08:09.000000000 -0500 -+++ binutils-2.14.90.0.6.new/bfd/doc/Makefile.am 2004-03-01 16:05:16.000000000 -0600 -@@ -55,10 +55,10 @@ - MKDOC = chew$(EXEEXT_FOR_BUILD) - - $(MKDOC): chew.o -- $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS) $(LOADLIBES) $(LDFLAGS) -+ $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS_FOR_BUILD) $(LOADLIBES) $(LDFLAGS) - - chew.o: chew.c -- $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c -+ $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/chew.c - - protos: libbfd.h libcoff.h bfd.h - -diff -urN binutils-2.14.90.0.6/bfd/doc/Makefile.in binutils-2.14.90.0.6.new/bfd/doc/Makefile.in ---- binutils-2.14.90.0.6/bfd/doc/Makefile.in 2003-07-23 10:08:09.000000000 -0500 -+++ binutils-2.14.90.0.6.new/bfd/doc/Makefile.in 2004-03-01 16:05:03.000000000 -0600 -@@ -469,10 +469,10 @@ - - - $(MKDOC): chew.o -- $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS) $(LOADLIBES) $(LDFLAGS) -+ $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS_FOR_BUILD) $(LOADLIBES) $(LDFLAGS) - - chew.o: chew.c -- $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c -+ $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/chew.c - - protos: libbfd.h libcoff.h bfd.h - diff --git a/patches/binutils/2.15/210-skip-comments.patch b/patches/binutils/2.15/210-skip-comments.patch new file mode 100644 index 0000000..804a17e --- /dev/null +++ b/patches/binutils/2.15/210-skip-comments.patch @@ -0,0 +1,101 @@ +Retrieved from http://sources.redhat.com/ml/binutils/2004-04/msg00646.html +Fixes +localealias.s:544: Error: junk at end of line, first unrecognized character is `,' +when building glibc-2.3.2 with gcc-3.4.0 and binutils-2.15.90.0.3 + +Paths adjusted to match crosstool's patcher. + +Message-Id: m3n052qw2g.fsf@whitebox.m5r.de +From: Andreas Schwab +To: Nathan Sidwell +Cc: Ian Lance Taylor , binutils at sources dot redhat dot com +Date: Fri, 23 Apr 2004 22:27:19 +0200 +Subject: Re: demand_empty_rest_of_line and ignore_rest_of_line + +Nathan Sidwell writes: + +> Index: read.c +> =================================================================== +> RCS file: /cvs/src/src/gas/read.c,v +> retrieving revision 1.76 +> diff -c -3 -p -r1.76 read.c +> *** read.c 12 Mar 2004 17:48:12 -0000 1.76 +> --- read.c 18 Mar 2004 09:56:05 -0000 +> *************** read_a_source_file (char *name) +> *** 1053,1059 **** +> #endif +> input_line_pointer--; +> /* Report unknown char as ignored. */ +> ! ignore_rest_of_line (); +> } +> +> #ifdef md_after_pass_hook +> --- 1053,1059 ---- +> #endif +> input_line_pointer--; +> /* Report unknown char as ignored. */ +> ! demand_empty_rest_of_line (); +> } +> +> #ifdef md_after_pass_hook + +This means that the unknown character is no longer ignored, despite the +comment. As a side effect a line starting with a line comment character +not followed by APP in NO_APP mode now triggers an error instead of just a +warning, breaking builds of glibc on m68k-linux. Earlier in +read_a_source_file where #APP is handled there is another comment that +claims that unknown comments are ignored, when in fact they aren't (only +the initial line comment character is skipped). + +Note that the presence of #APP will mess up the line counters, but +that appears to be difficult to fix. + +Andreas. + +2004-04-23 Andreas Schwab + + * read.c (read_a_source_file): Ignore unknown text after line + comment character. Fix misleading comment. + +--- binutils/gas/read.c.~1.78.~ 2004-04-23 08:58:23.000000000 +0200 ++++ binutils/gas/read.c 2004-04-23 21:49:01.000000000 +0200 +@@ -1,6 +1,6 @@ + /* read.c - read a source file - + Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, +- 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. ++ 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + +@@ -950,10 +950,14 @@ read_a_source_file (char *name) + unsigned int new_length; + char *tmp_buf = 0; + +- bump_line_counters (); + s = input_line_pointer; + if (strncmp (s, "APP\n", 4)) +- continue; /* We ignore it */ ++ { ++ /* We ignore it */ ++ ignore_rest_of_line (); ++ continue; ++ } ++ bump_line_counters (); + s += 4; + + sb_new (&sbuf); +@@ -1052,7 +1056,7 @@ read_a_source_file (char *name) + continue; + #endif + input_line_pointer--; +- /* Report unknown char as ignored. */ ++ /* Report unknown char as error. */ + demand_empty_rest_of_line (); + } + + +-- +Andreas Schwab, SuSE Labs, schwab@suse.de +SuSE Linux AG, MaxfeldstraÃe 5, 90409 NÃrnberg, Germany +Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 +"And now for something completely different." diff --git a/patches/binutils/2.15/220-cross-gprof.patch b/patches/binutils/2.15/220-cross-gprof.patch new file mode 100644 index 0000000..ea6c18f --- /dev/null +++ b/patches/binutils/2.15/220-cross-gprof.patch @@ -0,0 +1,22 @@ +--- binutils-2.15/configure.old 2004-07-21 21:36:47.000000000 -0700 ++++ binutils-2.15/configure 2004-07-21 21:37:08.000000000 -0700 +@@ -999,7 +999,7 @@ + + # Some tools are only suitable for building in a "native" situation. + # Remove these if host!=target. +-native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf" ++native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf" + + # Similarly, some are only suitable for cross toolchains. + # Remove these if host=target. +--- binutils-2.15/configure.in.old 2004-07-21 21:37:19.000000000 -0700 ++++ binutils-2.15/configure.in 2004-07-21 21:37:34.000000000 -0700 +@@ -236,7 +236,7 @@ + + # Some tools are only suitable for building in a "native" situation. + # Remove these if host!=target. +-native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf" ++native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf" + + # Similarly, some are only suitable for cross toolchains. + # Remove these if host=target. diff --git a/patches/binutils/2.15/230-gccpr15247-fix.patch b/patches/binutils/2.15/230-gccpr15247-fix.patch new file mode 100644 index 0000000..967bf7f --- /dev/null +++ b/patches/binutils/2.15/230-gccpr15247-fix.patch @@ -0,0 +1,192 @@ +See +http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15247 + +Fixes spurious error +/tmp/ccvNi4ou.s: Assembler messages: +/tmp/ccvNi4ou.s:2310: Error: Illegal operands: There are only 32 single precision f registers; [0-31] +make[2]: *** [/home/dank/wk/crosstool-0.28-rc10/build/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/math/dosincos.o] Error 1 + +when compiling glibc's dosincos.c with gcc-3.4.0 + +=================================================================== +RCS file: /cvs/src/src/opcodes/sparc-opc.c,v +retrieving revision 1.9 +retrieving revision 1.10 +diff -u -r1.9 -r1.10 +--- src/opcodes/sparc-opc.c 2004/01/18 23:46:32 1.9 ++++ src/opcodes/sparc-opc.c 2004/04/20 10:23:51 1.10 +@@ -1273,110 +1273,72 @@ + #define FM_DF 2 /* v9 */ + #define FM_QF 3 /* v9 */ + +-#define fmovicc(opcode, fpsize, cond, flags) /* v9 */ \ +-{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z,f,g", flags, v9 }, \ +-{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z,f,g", flags, v9 } +- +-#define fmovfcc(opcode, fpsize, fcond, flags) /* v9 */ \ +-{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6,f,g", flags, v9 }, \ +-{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7,f,g", flags, v9 }, \ +-{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8,f,g", flags, v9 }, \ +-{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9,f,g", flags, v9 } ++#define fmoviccx(opcode, fpsize, args, cond, flags) /* v9 */ \ ++{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z," args, flags, v9 }, \ ++{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z," args, flags, v9 } ++ ++#define fmovfccx(opcode, fpsize, args, fcond, flags) /* v9 */ \ ++{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6," args, flags, v9 }, \ ++{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7," args, flags, v9 }, \ ++{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8," args, flags, v9 }, \ ++{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9," args, flags, v9 } + + /* FIXME: use fmovicc/fmovfcc? */ /* v9 */ +-#define fmovcc(opcode, fpsize, cond, fcond, flags) /* v9 */ \ +-{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z,f,g", flags | F_FLOAT, v9 }, \ +-{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6,f,g", flags | F_FLOAT, v9 }, \ +-{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z,f,g", flags | F_FLOAT, v9 }, \ +-{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7,f,g", flags | F_FLOAT, v9 }, \ +-{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8,f,g", flags | F_FLOAT, v9 }, \ +-{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9,f,g", flags | F_FLOAT, v9 } +- +-/* v9 */ fmovcc ("fmovda", FM_DF, CONDA, FCONDA, 0), +-/* v9 */ fmovcc ("fmovqa", FM_QF, CONDA, FCONDA, 0), +-/* v9 */ fmovcc ("fmovsa", FM_SF, CONDA, FCONDA, 0), +-/* v9 */ fmovicc ("fmovdcc", FM_DF, CONDCC, 0), +-/* v9 */ fmovicc ("fmovqcc", FM_QF, CONDCC, 0), +-/* v9 */ fmovicc ("fmovscc", FM_SF, CONDCC, 0), +-/* v9 */ fmovicc ("fmovdcs", FM_DF, CONDCS, 0), +-/* v9 */ fmovicc ("fmovqcs", FM_QF, CONDCS, 0), +-/* v9 */ fmovicc ("fmovscs", FM_SF, CONDCS, 0), +-/* v9 */ fmovcc ("fmovde", FM_DF, CONDE, FCONDE, 0), +-/* v9 */ fmovcc ("fmovqe", FM_QF, CONDE, FCONDE, 0), +-/* v9 */ fmovcc ("fmovse", FM_SF, CONDE, FCONDE, 0), +-/* v9 */ fmovcc ("fmovdg", FM_DF, CONDG, FCONDG, 0), +-/* v9 */ fmovcc ("fmovqg", FM_QF, CONDG, FCONDG, 0), +-/* v9 */ fmovcc ("fmovsg", FM_SF, CONDG, FCONDG, 0), +-/* v9 */ fmovcc ("fmovdge", FM_DF, CONDGE, FCONDGE, 0), +-/* v9 */ fmovcc ("fmovqge", FM_QF, CONDGE, FCONDGE, 0), +-/* v9 */ fmovcc ("fmovsge", FM_SF, CONDGE, FCONDGE, 0), +-/* v9 */ fmovicc ("fmovdgeu", FM_DF, CONDGEU, F_ALIAS), +-/* v9 */ fmovicc ("fmovqgeu", FM_QF, CONDGEU, F_ALIAS), +-/* v9 */ fmovicc ("fmovsgeu", FM_SF, CONDGEU, F_ALIAS), +-/* v9 */ fmovicc ("fmovdgu", FM_DF, CONDGU, 0), +-/* v9 */ fmovicc ("fmovqgu", FM_QF, CONDGU, 0), +-/* v9 */ fmovicc ("fmovsgu", FM_SF, CONDGU, 0), +-/* v9 */ fmovcc ("fmovdl", FM_DF, CONDL, FCONDL, 0), +-/* v9 */ fmovcc ("fmovql", FM_QF, CONDL, FCONDL, 0), +-/* v9 */ fmovcc ("fmovsl", FM_SF, CONDL, FCONDL, 0), +-/* v9 */ fmovcc ("fmovdle", FM_DF, CONDLE, FCONDLE, 0), +-/* v9 */ fmovcc ("fmovqle", FM_QF, CONDLE, FCONDLE, 0), +-/* v9 */ fmovcc ("fmovsle", FM_SF, CONDLE, FCONDLE, 0), +-/* v9 */ fmovicc ("fmovdleu", FM_DF, CONDLEU, 0), +-/* v9 */ fmovicc ("fmovqleu", FM_QF, CONDLEU, 0), +-/* v9 */ fmovicc ("fmovsleu", FM_SF, CONDLEU, 0), +-/* v9 */ fmovfcc ("fmovdlg", FM_DF, FCONDLG, 0), +-/* v9 */ fmovfcc ("fmovqlg", FM_QF, FCONDLG, 0), +-/* v9 */ fmovfcc ("fmovslg", FM_SF, FCONDLG, 0), +-/* v9 */ fmovicc ("fmovdlu", FM_DF, CONDLU, F_ALIAS), +-/* v9 */ fmovicc ("fmovqlu", FM_QF, CONDLU, F_ALIAS), +-/* v9 */ fmovicc ("fmovslu", FM_SF, CONDLU, F_ALIAS), +-/* v9 */ fmovcc ("fmovdn", FM_DF, CONDN, FCONDN, 0), +-/* v9 */ fmovcc ("fmovqn", FM_QF, CONDN, FCONDN, 0), +-/* v9 */ fmovcc ("fmovsn", FM_SF, CONDN, FCONDN, 0), +-/* v9 */ fmovcc ("fmovdne", FM_DF, CONDNE, FCONDNE, 0), +-/* v9 */ fmovcc ("fmovqne", FM_QF, CONDNE, FCONDNE, 0), +-/* v9 */ fmovcc ("fmovsne", FM_SF, CONDNE, FCONDNE, 0), +-/* v9 */ fmovicc ("fmovdneg", FM_DF, CONDNEG, 0), +-/* v9 */ fmovicc ("fmovqneg", FM_QF, CONDNEG, 0), +-/* v9 */ fmovicc ("fmovsneg", FM_SF, CONDNEG, 0), +-/* v9 */ fmovcc ("fmovdnz", FM_DF, CONDNZ, FCONDNZ, F_ALIAS), +-/* v9 */ fmovcc ("fmovqnz", FM_QF, CONDNZ, FCONDNZ, F_ALIAS), +-/* v9 */ fmovcc ("fmovsnz", FM_SF, CONDNZ, FCONDNZ, F_ALIAS), +-/* v9 */ fmovfcc ("fmovdo", FM_DF, FCONDO, 0), +-/* v9 */ fmovfcc ("fmovqo", FM_QF, FCONDO, 0), +-/* v9 */ fmovfcc ("fmovso", FM_SF, FCONDO, 0), +-/* v9 */ fmovicc ("fmovdpos", FM_DF, CONDPOS, 0), +-/* v9 */ fmovicc ("fmovqpos", FM_QF, CONDPOS, 0), +-/* v9 */ fmovicc ("fmovspos", FM_SF, CONDPOS, 0), +-/* v9 */ fmovfcc ("fmovdu", FM_DF, FCONDU, 0), +-/* v9 */ fmovfcc ("fmovqu", FM_QF, FCONDU, 0), +-/* v9 */ fmovfcc ("fmovsu", FM_SF, FCONDU, 0), +-/* v9 */ fmovfcc ("fmovdue", FM_DF, FCONDUE, 0), +-/* v9 */ fmovfcc ("fmovque", FM_QF, FCONDUE, 0), +-/* v9 */ fmovfcc ("fmovsue", FM_SF, FCONDUE, 0), +-/* v9 */ fmovfcc ("fmovdug", FM_DF, FCONDUG, 0), +-/* v9 */ fmovfcc ("fmovqug", FM_QF, FCONDUG, 0), +-/* v9 */ fmovfcc ("fmovsug", FM_SF, FCONDUG, 0), +-/* v9 */ fmovfcc ("fmovduge", FM_DF, FCONDUGE, 0), +-/* v9 */ fmovfcc ("fmovquge", FM_QF, FCONDUGE, 0), +-/* v9 */ fmovfcc ("fmovsuge", FM_SF, FCONDUGE, 0), +-/* v9 */ fmovfcc ("fmovdul", FM_DF, FCONDUL, 0), +-/* v9 */ fmovfcc ("fmovqul", FM_QF, FCONDUL, 0), +-/* v9 */ fmovfcc ("fmovsul", FM_SF, FCONDUL, 0), +-/* v9 */ fmovfcc ("fmovdule", FM_DF, FCONDULE, 0), +-/* v9 */ fmovfcc ("fmovqule", FM_QF, FCONDULE, 0), +-/* v9 */ fmovfcc ("fmovsule", FM_SF, FCONDULE, 0), +-/* v9 */ fmovicc ("fmovdvc", FM_DF, CONDVC, 0), +-/* v9 */ fmovicc ("fmovqvc", FM_QF, CONDVC, 0), +-/* v9 */ fmovicc ("fmovsvc", FM_SF, CONDVC, 0), +-/* v9 */ fmovicc ("fmovdvs", FM_DF, CONDVS, 0), +-/* v9 */ fmovicc ("fmovqvs", FM_QF, CONDVS, 0), +-/* v9 */ fmovicc ("fmovsvs", FM_SF, CONDVS, 0), +-/* v9 */ fmovcc ("fmovdz", FM_DF, CONDZ, FCONDZ, F_ALIAS), +-/* v9 */ fmovcc ("fmovqz", FM_QF, CONDZ, FCONDZ, F_ALIAS), +-/* v9 */ fmovcc ("fmovsz", FM_SF, CONDZ, FCONDZ, F_ALIAS), +- ++#define fmovccx(opcode, fpsize, args, cond, fcond, flags) /* v9 */ \ ++{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z," args, flags | F_FLOAT, v9 }, \ ++{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6," args, flags | F_FLOAT, v9 }, \ ++{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z," args, flags | F_FLOAT, v9 }, \ ++{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7," args, flags | F_FLOAT, v9 }, \ ++{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8," args, flags | F_FLOAT, v9 }, \ ++{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9," args, flags | F_FLOAT, v9 } ++ ++#define fmovicc(suffix, cond, flags) /* v9 */ \ ++fmoviccx("fmovd" suffix, FM_DF, "B,H", cond, flags), \ ++fmoviccx("fmovq" suffix, FM_QF, "R,J", cond, flags), \ ++fmoviccx("fmovs" suffix, FM_SF, "f,g", cond, flags) ++ ++#define fmovfcc(suffix, fcond, flags) /* v9 */ \ ++fmovfccx("fmovd" suffix, FM_DF, "B,H", fcond, flags), \ ++fmovfccx("fmovq" suffix, FM_QF, "R,J", fcond, flags), \ ++fmovfccx("fmovs" suffix, FM_SF, "f,g", fcond, flags) ++ ++#define fmovcc(suffix, cond, fcond, flags) /* v9 */ \ ++fmovccx("fmovd" suffix, FM_DF, "B,H", cond, fcond, flags), \ ++fmovccx("fmovq" suffix, FM_QF, "R,J", cond, fcond, flags), \ ++fmovccx("fmovs" suffix, FM_SF, "f,g", cond, fcond, flags) ++ ++/* v9 */ fmovcc ("a", CONDA, FCONDA, 0), ++/* v9 */ fmovicc ("cc", CONDCC, 0), ++/* v9 */ fmovicc ("cs", CONDCS, 0), ++/* v9 */ fmovcc ("e", CONDE, FCONDE, 0), ++/* v9 */ fmovcc ("g", CONDG, FCONDG, 0), ++/* v9 */ fmovcc ("ge", CONDGE, FCONDGE, 0), ++/* v9 */ fmovicc ("geu", CONDGEU, F_ALIAS), ++/* v9 */ fmovicc ("gu", CONDGU, 0), ++/* v9 */ fmovcc ("l", CONDL, FCONDL, 0), ++/* v9 */ fmovcc ("le", CONDLE, FCONDLE, 0), ++/* v9 */ fmovicc ("leu", CONDLEU, 0), ++/* v9 */ fmovfcc ("lg", FCONDLG, 0), ++/* v9 */ fmovicc ("lu", CONDLU, F_ALIAS), ++/* v9 */ fmovcc ("n", CONDN, FCONDN, 0), ++/* v9 */ fmovcc ("ne", CONDNE, FCONDNE, 0), ++/* v9 */ fmovicc ("neg", CONDNEG, 0), ++/* v9 */ fmovcc ("nz", CONDNZ, FCONDNZ, F_ALIAS), ++/* v9 */ fmovfcc ("o", FCONDO, 0), ++/* v9 */ fmovicc ("pos", CONDPOS, 0), ++/* v9 */ fmovfcc ("u", FCONDU, 0), ++/* v9 */ fmovfcc ("ue", FCONDUE, 0), ++/* v9 */ fmovfcc ("ug", FCONDUG, 0), ++/* v9 */ fmovfcc ("uge", FCONDUGE, 0), ++/* v9 */ fmovfcc ("ul", FCONDUL, 0), ++/* v9 */ fmovfcc ("ule", FCONDULE, 0), ++/* v9 */ fmovicc ("vc", CONDVC, 0), ++/* v9 */ fmovicc ("vs", CONDVS, 0), ++/* v9 */ fmovcc ("z", CONDZ, FCONDZ, F_ALIAS), ++ ++#undef fmoviccx /* v9 */ ++#undef fmovfccx /* v9 */ ++#undef fmovccx /* v9 */ + #undef fmovicc /* v9 */ + #undef fmovfcc /* v9 */ + #undef fmovcc /* v9 */ diff --git a/patches/binutils/2.15/240-ld-callahan.patch b/patches/binutils/2.15/240-ld-callahan.patch new file mode 100644 index 0000000..bb4a69c --- /dev/null +++ b/patches/binutils/2.15/240-ld-callahan.patch @@ -0,0 +1,677 @@ +Signed-off-by: dank@kegel.com +Fixes ld speed issue. +See http://weblogs.mozillazine.org/roc/archives/2005/02/optimizing_gnu.html +See thread "Re: optimizations for 3x speedup in ld", +http://sources.redhat.com/ml/binutils/2005-03/msg00847.html + +Wildcard section matching enhancement, backported from the binutils CVS tree. +Here's the CVS log comment from the original change to ldlang.c: + +revision 1.177 +date: 2005/04/06 15:33:02; author: jakub; state: Exp; lines: +438 -51 +2005-04-06 Jakub Jelinek + + * ldlang.c: Formatting. + (walk_wild_consider_section): Remember return value from wildcardp. + (is_simple_wild): Use strcspn instead of 2 strpbrk calls and strlen. + (wild_spec_can_overlap): Use strcspn instead of strpbrk and strlen. + +2005-04-06 Robert O'Callahan + + * ld.h (lean_section_userdata_type): Remove. + (fat_section_userdata_type): Remove file field. + (SECTION_USERDATA_SIZE): Remove. + * ldlang.c (init_os): Eliminate initialization of unused + lean_section_userdata_type. + + * ldlang.h (callback_t, walk_wild_section_handler_t): New + typedefs. + (struct lang_wild_statement_struct): Add walk_wild_section_handler + and handler_data fields. + * ldlang.c (callback_t): Removed. + (walk_wild_consider_section, walk_wild_section_general, + section_iterator_callback, find_section, is_simple_wild, + match_simple_wild, walk_wild_section_specs1_wild0, + walk_wild_section_specs1_wild1, walk_wild_section_specs2_wild1, + walk_wild_section_specs3_wild2, walk_wild_section_specs4_wild2, + wild_spec_can_overlap, analyze_walk_wild_section_handler): New + functions. + (lang_add_wild): Call analyze_walk_wild_section_handler. + (walk_wild_section): Renamed to walk_wild_section_general and + created a wrapper function. + (section_iterator_callback_data): New typedef. + +Note that bfd_get_section_by_name_if didn't exist in 2.15, so it was backported +as well. + +--- binutils-2.15/bfd/bfd-in2.h.old 2004-05-17 15:35:56.000000000 -0400 ++++ binutils-2.15/bfd/bfd-in2.h 2006-02-09 11:54:45.989940000 -0500 +@@ -1425,6 +1425,10 @@ + + asection *bfd_get_section_by_name (bfd *abfd, const char *name); + ++asection *bfd_get_section_by_name_if (bfd *abfd, const char *name, ++ bfd_boolean (*operation) (bfd *, asection *, void *), ++ void *user_storage); ++ + char *bfd_get_unique_section_name + (bfd *abfd, const char *templat, int *count); + +--- binutils-2.15/bfd/section.c.old 2003-12-01 01:33:01.000000000 -0500 ++++ binutils-2.15/bfd/section.c 2006-01-23 14:16:54.768993000 -0500 +@@ -801,6 +801,57 @@ + + /* + FUNCTION ++ bfd_get_section_by_name_if ++ ++SYNOPSIS ++ asection *bfd_get_section_by_name_if ++ (bfd *abfd, ++ const char *name, ++ bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj), ++ void *obj); ++ ++DESCRIPTION ++ Call the provided function @var{func} for each section ++ attached to the BFD @var{abfd} whose name matches @var{name}, ++ passing @var{obj} as an argument. The function will be called ++ as if by ++ ++| func (abfd, the_section, obj); ++ ++ It returns the first section for which @var{func} returns true, ++ otherwise <>. ++ ++*/ ++ ++asection * ++bfd_get_section_by_name_if (bfd *abfd, const char *name, ++ bfd_boolean (*operation) (bfd *, ++ asection *, ++ void *), ++ void *user_storage) ++{ ++ struct section_hash_entry *sh; ++ unsigned long hash; ++ ++ sh = section_hash_lookup (&abfd->section_htab, name, FALSE, FALSE); ++ if (sh == NULL) ++ return NULL; ++ ++ hash = sh->root.hash; ++ do ++ { ++ if ((*operation) (abfd, &sh->section, user_storage)) ++ return &sh->section; ++ sh = (struct section_hash_entry *) sh->root.next; ++ } ++ while (sh != NULL && sh->root.hash == hash ++ && strcmp (sh->root.string, name) == 0); ++ ++ return NULL; ++} ++ ++/* ++FUNCTION + bfd_get_unique_section_name + + SYNOPSIS +--- binutils-2.15/ld/ldlang.c.old 2004-05-17 15:36:16.000000000 -0400 ++++ binutils-2.15/ld/ldlang.c 2006-01-23 13:40:12.745499000 -0500 +@@ -81,9 +81,6 @@ + static void lang_record_phdrs (void); + static void lang_do_version_exports_section (void); + +-typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *, +- asection *, lang_input_statement_type *, void *); +- + /* Exported variables. */ + lang_output_section_statement_type *abs_output_section; + lang_statement_list_type lang_output_section_statement; +@@ -138,21 +135,71 @@ + + /* Generic traversal routines for finding matching sections. */ + ++/* Try processing a section against a wildcard. This just calls ++ the callback unless the filename exclusion list is present ++ and excludes the file. It's hardly ever present so this ++ function is very fast. */ ++ ++static void ++walk_wild_consider_section (lang_wild_statement_type *ptr, ++ lang_input_statement_type *file, ++ asection *s, ++ struct wildcard_list *sec, ++ callback_t callback, ++ void *data) ++{ ++ bfd_boolean skip = FALSE; ++ struct name_list *list_tmp; ++ ++ /* Don't process sections from files which were ++ excluded. */ ++ for (list_tmp = sec->spec.exclude_name_list; ++ list_tmp; ++ list_tmp = list_tmp->next) ++ { ++ bfd_boolean is_wildcard = wildcardp (list_tmp->name); ++ if (is_wildcard) ++ skip = fnmatch (list_tmp->name, file->filename, 0) == 0; ++ else ++ skip = strcmp (list_tmp->name, file->filename) == 0; ++ ++ /* If this file is part of an archive, and the archive is ++ excluded, exclude this file. */ ++ if (! skip && file->the_bfd != NULL ++ && file->the_bfd->my_archive != NULL ++ && file->the_bfd->my_archive->filename != NULL) ++ { ++ if (is_wildcard) ++ skip = fnmatch (list_tmp->name, ++ file->the_bfd->my_archive->filename, ++ 0) == 0; ++ else ++ skip = strcmp (list_tmp->name, ++ file->the_bfd->my_archive->filename) == 0; ++ } ++ ++ if (skip) ++ break; ++ } ++ ++ if (!skip) ++ (*callback) (ptr, sec, s, file, data); ++} ++ ++/* Lowest common denominator routine that can handle everything correctly, ++ but slowly. */ ++ + static void +-walk_wild_section (lang_wild_statement_type *ptr, +- lang_input_statement_type *file, +- callback_t callback, +- void *data) ++walk_wild_section_general (lang_wild_statement_type *ptr, ++ lang_input_statement_type *file, ++ callback_t callback, ++ void *data) + { + asection *s; +- +- if (file->just_syms_flag) +- return; ++ struct wildcard_list *sec; + + for (s = file->the_bfd->sections; s != NULL; s = s->next) + { +- struct wildcard_list *sec; +- + sec = ptr->section_list; + if (sec == NULL) + (*callback) (ptr, sec, s, file, data); +@@ -160,39 +207,8 @@ + while (sec != NULL) + { + bfd_boolean skip = FALSE; +- struct name_list *list_tmp; +- +- /* Don't process sections from files which were +- excluded. */ +- for (list_tmp = sec->spec.exclude_name_list; +- list_tmp; +- list_tmp = list_tmp->next) +- { +- if (wildcardp (list_tmp->name)) +- skip = fnmatch (list_tmp->name, file->filename, 0) == 0; +- else +- skip = strcmp (list_tmp->name, file->filename) == 0; +- +- /* If this file is part of an archive, and the archive is +- excluded, exclude this file. */ +- if (! skip && file->the_bfd != NULL +- && file->the_bfd->my_archive != NULL +- && file->the_bfd->my_archive->filename != NULL) +- { +- if (wildcardp (list_tmp->name)) +- skip = fnmatch (list_tmp->name, +- file->the_bfd->my_archive->filename, +- 0) == 0; +- else +- skip = strcmp (list_tmp->name, +- file->the_bfd->my_archive->filename) == 0; +- } +- +- if (skip) +- break; +- } + +- if (!skip && sec->spec.name != NULL) ++ if (sec->spec.name != NULL) + { + const char *sname = bfd_get_section_name (file->the_bfd, s); + +@@ -203,13 +219,381 @@ + } + + if (!skip) +- (*callback) (ptr, sec, s, file, data); ++ walk_wild_consider_section (ptr, file, s, sec, callback, data); + + sec = sec->next; + } + } + } + ++/* Routines to find a single section given its name. If there's more ++ than one section with that name, we report that. */ ++ ++typedef struct ++{ ++ asection *found_section; ++ bfd_boolean multiple_sections_found; ++} section_iterator_callback_data; ++ ++static bfd_boolean ++section_iterator_callback (bfd *bfd ATTRIBUTE_UNUSED, asection *s, void *data) ++{ ++ section_iterator_callback_data *d = data; ++ ++ if (d->found_section != NULL) ++ { ++ d->multiple_sections_found = TRUE; ++ return TRUE; ++ } ++ ++ d->found_section = s; ++ return FALSE; ++} ++ ++static asection * ++find_section (lang_input_statement_type *file, ++ struct wildcard_list *sec, ++ bfd_boolean *multiple_sections_found) ++{ ++ section_iterator_callback_data cb_data = { NULL, FALSE }; ++ ++ bfd_get_section_by_name_if (file->the_bfd, sec->spec.name, ++ section_iterator_callback, &cb_data); ++ *multiple_sections_found = cb_data.multiple_sections_found; ++ return cb_data.found_section; ++} ++ ++/* Code for handling simple wildcards without going through fnmatch, ++ which can be expensive because of charset translations etc. */ ++ ++/* A simple wild is a literal string followed by a single '*', ++ where the literal part is at least 4 characters long. */ ++ ++static bfd_boolean ++is_simple_wild (const char *name) ++{ ++ size_t len = strcspn (name, "*?["); ++ return len >= 4 && name[len] == '*' && name[len + 1] == '\0'; ++} ++ ++static bfd_boolean ++match_simple_wild (const char *pattern, const char *name) ++{ ++ /* The first four characters of the pattern are guaranteed valid ++ non-wildcard characters. So we can go faster. */ ++ if (pattern[0] != name[0] || pattern[1] != name[1] ++ || pattern[2] != name[2] || pattern[3] != name[3]) ++ return FALSE; ++ ++ pattern += 4; ++ name += 4; ++ while (*pattern != '*') ++ if (*name++ != *pattern++) ++ return FALSE; ++ ++ return TRUE; ++} ++ ++/* Specialized, optimized routines for handling different kinds of ++ wildcards */ ++ ++static void ++walk_wild_section_specs1_wild0 (lang_wild_statement_type *ptr, ++ lang_input_statement_type *file, ++ callback_t callback, ++ void *data) ++{ ++ /* We can just do a hash lookup for the section with the right name. ++ But if that lookup discovers more than one section with the name ++ (should be rare), we fall back to the general algorithm because ++ we would otherwise have to sort the sections to make sure they ++ get processed in the bfd's order. */ ++ bfd_boolean multiple_sections_found; ++ struct wildcard_list *sec0 = ptr->handler_data[0]; ++ asection *s0 = find_section (file, sec0, &multiple_sections_found); ++ ++ if (multiple_sections_found) ++ walk_wild_section_general (ptr, file, callback, data); ++ else if (s0) ++ walk_wild_consider_section (ptr, file, s0, sec0, callback, data); ++} ++ ++static void ++walk_wild_section_specs1_wild1 (lang_wild_statement_type *ptr, ++ lang_input_statement_type *file, ++ callback_t callback, ++ void *data) ++{ ++ asection *s; ++ struct wildcard_list *wildsec0 = ptr->handler_data[0]; ++ ++ for (s = file->the_bfd->sections; s != NULL; s = s->next) ++ { ++ const char *sname = bfd_get_section_name (file->the_bfd, s); ++ bfd_boolean skip = !match_simple_wild (wildsec0->spec.name, sname); ++ ++ if (!skip) ++ walk_wild_consider_section (ptr, file, s, wildsec0, callback, data); ++ } ++} ++ ++static void ++walk_wild_section_specs2_wild1 (lang_wild_statement_type *ptr, ++ lang_input_statement_type *file, ++ callback_t callback, ++ void *data) ++{ ++ asection *s; ++ struct wildcard_list *sec0 = ptr->handler_data[0]; ++ struct wildcard_list *wildsec1 = ptr->handler_data[1]; ++ bfd_boolean multiple_sections_found; ++ asection *s0 = find_section (file, sec0, &multiple_sections_found); ++ ++ if (multiple_sections_found) ++ { ++ walk_wild_section_general (ptr, file, callback, data); ++ return; ++ } ++ ++ /* Note that if the section was not found, s0 is NULL and ++ we'll simply never succeed the s == s0 test below. */ ++ for (s = file->the_bfd->sections; s != NULL; s = s->next) ++ { ++ /* Recall that in this code path, a section cannot satisfy more ++ than one spec, so if s == s0 then it cannot match ++ wildspec1. */ ++ if (s == s0) ++ walk_wild_consider_section (ptr, file, s, sec0, callback, data); ++ else ++ { ++ const char *sname = bfd_get_section_name (file->the_bfd, s); ++ bfd_boolean skip = !match_simple_wild (wildsec1->spec.name, sname); ++ ++ if (!skip) ++ walk_wild_consider_section (ptr, file, s, wildsec1, callback, ++ data); ++ } ++ } ++} ++ ++static void ++walk_wild_section_specs3_wild2 (lang_wild_statement_type *ptr, ++ lang_input_statement_type *file, ++ callback_t callback, ++ void *data) ++{ ++ asection *s; ++ struct wildcard_list *sec0 = ptr->handler_data[0]; ++ struct wildcard_list *wildsec1 = ptr->handler_data[1]; ++ struct wildcard_list *wildsec2 = ptr->handler_data[2]; ++ bfd_boolean multiple_sections_found; ++ asection *s0 = find_section (file, sec0, &multiple_sections_found); ++ ++ if (multiple_sections_found) ++ { ++ walk_wild_section_general (ptr, file, callback, data); ++ return; ++ } ++ ++ for (s = file->the_bfd->sections; s != NULL; s = s->next) ++ { ++ if (s == s0) ++ walk_wild_consider_section (ptr, file, s, sec0, callback, data); ++ else ++ { ++ const char *sname = bfd_get_section_name (file->the_bfd, s); ++ bfd_boolean skip = !match_simple_wild (wildsec1->spec.name, sname); ++ ++ if (!skip) ++ walk_wild_consider_section (ptr, file, s, wildsec1, callback, data); ++ else ++ { ++ skip = !match_simple_wild (wildsec2->spec.name, sname); ++ if (!skip) ++ walk_wild_consider_section (ptr, file, s, wildsec2, callback, ++ data); ++ } ++ } ++ } ++} ++ ++static void ++walk_wild_section_specs4_wild2 (lang_wild_statement_type *ptr, ++ lang_input_statement_type *file, ++ callback_t callback, ++ void *data) ++{ ++ asection *s; ++ struct wildcard_list *sec0 = ptr->handler_data[0]; ++ struct wildcard_list *sec1 = ptr->handler_data[1]; ++ struct wildcard_list *wildsec2 = ptr->handler_data[2]; ++ struct wildcard_list *wildsec3 = ptr->handler_data[3]; ++ bfd_boolean multiple_sections_found; ++ asection *s0 = find_section (file, sec0, &multiple_sections_found), *s1; ++ ++ if (multiple_sections_found) ++ { ++ walk_wild_section_general (ptr, file, callback, data); ++ return; ++ } ++ ++ s1 = find_section (file, sec1, &multiple_sections_found); ++ if (multiple_sections_found) ++ { ++ walk_wild_section_general (ptr, file, callback, data); ++ return; ++ } ++ ++ for (s = file->the_bfd->sections; s != NULL; s = s->next) ++ { ++ if (s == s0) ++ walk_wild_consider_section (ptr, file, s, sec0, callback, data); ++ else ++ if (s == s1) ++ walk_wild_consider_section (ptr, file, s, sec1, callback, data); ++ else ++ { ++ const char *sname = bfd_get_section_name (file->the_bfd, s); ++ bfd_boolean skip = !match_simple_wild (wildsec2->spec.name, ++ sname); ++ ++ if (!skip) ++ walk_wild_consider_section (ptr, file, s, wildsec2, callback, ++ data); ++ else ++ { ++ skip = !match_simple_wild (wildsec3->spec.name, sname); ++ if (!skip) ++ walk_wild_consider_section (ptr, file, s, wildsec3, ++ callback, data); ++ } ++ } ++ } ++} ++ ++static void ++walk_wild_section (lang_wild_statement_type *ptr, ++ lang_input_statement_type *file, ++ callback_t callback, ++ void *data) ++{ ++ if (file->just_syms_flag) ++ return; ++ ++ (*ptr->walk_wild_section_handler) (ptr, file, callback, data); ++} ++ ++/* Returns TRUE when name1 is a wildcard spec that might match ++ something name2 can match. We're conservative: we return FALSE ++ only if the prefixes of name1 and name2 are different up to the ++ first wildcard character. */ ++ ++static bfd_boolean ++wild_spec_can_overlap (const char *name1, const char *name2) ++{ ++ size_t prefix1_len = strcspn (name1, "?*["); ++ size_t prefix2_len = strcspn (name2, "?*["); ++ size_t min_prefix_len; ++ ++ /* Note that if there is no wildcard character, then we treat the ++ terminating 0 as part of the prefix. Thus ".text" won't match ++ ".text." or ".text.*", for example. */ ++ if (name1[prefix1_len] == '\0') ++ prefix1_len++; ++ if (name2[prefix2_len] == '\0') ++ prefix2_len++; ++ ++ min_prefix_len = prefix1_len < prefix2_len ? prefix1_len : prefix2_len; ++ ++ return memcmp (name1, name2, min_prefix_len) == 0; ++} ++ ++/* Select specialized code to handle various kinds of wildcard ++ statements. */ ++ ++static void ++analyze_walk_wild_section_handler (lang_wild_statement_type *ptr) ++{ ++ int sec_count = 0; ++ int wild_name_count = 0; ++ struct wildcard_list *sec; ++ int signature; ++ int data_counter; ++ ++ ptr->walk_wild_section_handler = walk_wild_section_general; ++ ++ /* Count how many wildcard_specs there are, and how many of those ++ actually use wildcards in the name. Also, bail out if any of the ++ wildcard names are NULL. (Can this actually happen? ++ walk_wild_section used to test for it.) And bail out if any ++ of the wildcards are more complex than a simple string ++ ending in a single '*'. */ ++ for (sec = ptr->section_list; sec != NULL; sec = sec->next) ++ { ++ ++sec_count; ++ if (sec->spec.name == NULL) ++ return; ++ if (wildcardp (sec->spec.name)) ++ { ++ ++wild_name_count; ++ if (!is_simple_wild (sec->spec.name)) ++ return; ++ } ++ } ++ ++ /* The zero-spec case would be easy to optimize but it doesn't ++ happen in practice. Likewise, more than 4 specs doesn't ++ happen in practice. */ ++ if (sec_count == 0 || sec_count > 4) ++ return; ++ ++ /* Check that no two specs can match the same section. */ ++ for (sec = ptr->section_list; sec != NULL; sec = sec->next) ++ { ++ struct wildcard_list *sec2; ++ for (sec2 = sec->next; sec2 != NULL; sec2 = sec2->next) ++ { ++ if (wild_spec_can_overlap (sec->spec.name, sec2->spec.name)) ++ return; ++ } ++ } ++ ++ signature = (sec_count << 8) + wild_name_count; ++ switch (signature) ++ { ++ case 0x0100: ++ ptr->walk_wild_section_handler = walk_wild_section_specs1_wild0; ++ break; ++ case 0x0101: ++ ptr->walk_wild_section_handler = walk_wild_section_specs1_wild1; ++ break; ++ case 0x0201: ++ ptr->walk_wild_section_handler = walk_wild_section_specs2_wild1; ++ break; ++ case 0x0302: ++ ptr->walk_wild_section_handler = walk_wild_section_specs3_wild2; ++ break; ++ case 0x0402: ++ ptr->walk_wild_section_handler = walk_wild_section_specs4_wild2; ++ break; ++ default: ++ return; ++ } ++ ++ /* Now fill the data array with pointers to the specs, first the ++ specs with non-wildcard names, then the specs with wildcard ++ names. It's OK to process the specs in different order from the ++ given order, because we've already determined that no section ++ will match more than one spec. */ ++ data_counter = 0; ++ for (sec = ptr->section_list; sec != NULL; sec = sec->next) ++ if (!wildcardp (sec->spec.name)) ++ ptr->handler_data[data_counter++] = sec; ++ for (sec = ptr->section_list; sec != NULL; sec = sec->next) ++ if (wildcardp (sec->spec.name)) ++ ptr->handler_data[data_counter++] = sec; ++} ++ + /* Handle a wild statement for a single file F. */ + + static void +@@ -4353,6 +4737,7 @@ + new->section_list = section_list; + new->keep_sections = keep_sections; + lang_list_init (&new->children); ++ analyze_walk_wild_section_handler (new); + } + + void +--- binutils-2.15/ld/ldlang.h.old 2004-05-17 15:36:16.000000000 -0400 ++++ binutils-2.15/ld/ldlang.h 2006-01-23 13:32:33.653292000 -0500 +@@ -295,7 +295,17 @@ + union lang_statement_union *file; + } lang_afile_asection_pair_statement_type; + +-typedef struct lang_wild_statement_struct ++typedef struct lang_wild_statement_struct lang_wild_statement_type; ++ ++typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *, ++ asection *, lang_input_statement_type *, void *); ++ ++typedef void (*walk_wild_section_handler_t) (lang_wild_statement_type *, ++ lang_input_statement_type *, ++ callback_t callback, ++ void *data); ++ ++struct lang_wild_statement_struct + { + lang_statement_header_type header; + const char *filename; +@@ -303,7 +313,10 @@ + struct wildcard_list *section_list; + bfd_boolean keep_sections; + lang_statement_list_type children; +-} lang_wild_statement_type; ++ ++ walk_wild_section_handler_t walk_wild_section_handler; ++ struct wildcard_list *handler_data[4]; ++}; + + typedef struct lang_address_statement_struct + { diff --git a/patches/binutils/2.15/250-ld-stabs-tweak.patch b/patches/binutils/2.15/250-ld-stabs-tweak.patch new file mode 100644 index 0000000..bd6ae7a --- /dev/null +++ b/patches/binutils/2.15/250-ld-stabs-tweak.patch @@ -0,0 +1,33 @@ +Signed-off-by: dank@kegel.com + +See http://sourceware.org/ml/binutils/2005-12/msg00270.html +http://sourceware.org/ml/binutils-cvs/2005-12/msg00139.html + +STABS hash table size change, backported from the binutils CVS tree. Here's +the CVS log comment for the original change: + +revision 1.25 +date: 2005/12/29 10:29:23; author: nickc; state: Exp; lines: +2 -3 +(_bfd_link_section_stabs): Use bfd_hash_table_init rather than +bfd_hash_table_init_n(...,251) so that the size of the hash table can be +controlled by the user. + +Note that tunable hash table size changes were added after 2.15. The effect +of this change is to make bfd use its default hash table size for the stabs +hash as well. + + +--- binutils-2.15/bfd/stabs.c.old 2004-05-17 15:36:04.000000000 -0400 ++++ binutils-2.15/bfd/stabs.c 2006-02-09 15:21:56.567014000 -0500 +@@ -241,9 +241,8 @@ + goto error_return; + /* Make sure the first byte is zero. */ + (void) _bfd_stringtab_add (sinfo->strings, "", TRUE, TRUE); +- if (! bfd_hash_table_init_n (&sinfo->includes.root, +- stab_link_includes_newfunc, +- 251)) ++ if (! bfd_hash_table_init (&sinfo->includes.root, ++ stab_link_includes_newfunc)) + goto error_return; + sinfo->stabstr = bfd_make_section_anyway (abfd, ".stabstr"); + sinfo->stabstr->flags |= SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING; diff --git a/patches/binutils/2.15/260-s390-invalid-insn-format.patch b/patches/binutils/2.15/260-s390-invalid-insn-format.patch new file mode 100644 index 0000000..3296201 --- /dev/null +++ b/patches/binutils/2.15/260-s390-invalid-insn-format.patch @@ -0,0 +1,42 @@ +Message-ID: <000801c48f60$cec16630$9103a8c0@ULOC5012> +From: "Michael Geiger" +To: +Subject: Patch for cross compiling s/390 kernel on linux host +Date: Tue, 31 Aug 2004 15:45:41 +0200 + +Dear Dan, + +I had big problems compiling a kernel for s/390 on my linux host - I tried +different chains from crosstool-0.28-rc34 and finally succeded with +gcc-3.3.4-glibc-2.3.2 after applying another patch to binutils-2.15 +(attached). +All compilations of the different kernel versions I tried stopped with +"Invalid .insn format" somewhere. I checked the recent cvs version of +binutils and applied the latest diff to gas/config/tc-s390.c and that solved +it. + +Greetings + +Michael Geiger + + +diff -u -r1.39 -r1.40 +--- src/gas/config/tc-s390.c 2004/05/06 11:01:48 1.39 ++++ src/gas/config/tc-s390.c 2004/06/15 12:38:08 1.40 +@@ -1596,13 +1596,13 @@ + if (exp.X_op == O_constant) + { + if ( ( opformat->oplen == 6 +- && exp.X_add_number >= 0 ++ && (addressT) exp.X_add_number >= 0 + && (addressT) exp.X_add_number < (1ULL << 48)) + || ( opformat->oplen == 4 +- && exp.X_add_number >= 0 ++ && (addressT) exp.X_add_number >= 0 + && (addressT) exp.X_add_number < (1ULL << 32)) + || ( opformat->oplen == 2 +- && exp.X_add_number >= 0 ++ && (addressT) exp.X_add_number >= 0 + && (addressT) exp.X_add_number < (1ULL << 16))) + md_number_to_chars (insn, exp.X_add_number, opformat->oplen); + else diff --git a/patches/binutils/2.15/400-mips-ELF_MAXPAGESIZE-4K.patch b/patches/binutils/2.15/400-mips-ELF_MAXPAGESIZE-4K.patch deleted file mode 100644 index e07a7e8..0000000 --- a/patches/binutils/2.15/400-mips-ELF_MAXPAGESIZE-4K.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- binutils/bfd/elf32-mips.c~ -+++ binutils/bfd/elf32-mips.c -@@ -1611,7 +1611,9 @@ - - /* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses - page sizes of up to that limit, so we need to respect it. */ --#define ELF_MAXPAGESIZE 0x10000 -+/*#define ELF_MAXPAGESIZE 0x10000*/ -+/* Use 4K to shrink the elf header. NOT for general use! */ -+#define ELF_MAXPAGESIZE 0x1000 - #define elf32_bed elf32_tradbed - - /* Include the target file again for this target. */ ---- binutils/bfd/elfn32-mips.c~ -+++ binutils/bfd/elfn32-mips.c -@@ -1976,7 +1976,9 @@ - - /* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses - page sizes of up to that limit, so we need to respect it. */ --#define ELF_MAXPAGESIZE 0x10000 -+/*#define ELF_MAXPAGESIZE 0x10000*/ -+/* Use 4K to shrink the elf header. NOT for general use! */ -+#define ELF_MAXPAGESIZE 0x1000 - #define elf32_bed elf32_tradbed - - /* Include the target file again for this target. */ diff --git a/patches/binutils/2.15/600-arm-textrel.patch b/patches/binutils/2.15/600-arm-textrel.patch deleted file mode 100644 index 73d5b9d..0000000 --- a/patches/binutils/2.15/600-arm-textrel.patch +++ /dev/null @@ -1,63 +0,0 @@ -http://sources.redhat.com/ml/binutils/2004-06/msg00010.html ---- binutils-2.15.90.0.3-old/bfd/elf32-arm.h 2004-04-12 14:56:33.000000000 -0500 -+++ binutils-2.15.90.0.3/bfd/elf32-arm.h 2004-09-03 06:56:40.000000000 -0500 -@@ -87,6 +87,8 @@ - #endif - static bfd_boolean allocate_dynrelocs - PARAMS ((struct elf_link_hash_entry *h, PTR inf)); -+static bfd_boolean elf32_arm_readonly_dynrelocs -+ PARAMS ((struct elf_link_hash_entry *, PTR)); - static bfd_boolean create_got_section - PARAMS ((bfd * dynobj, struct bfd_link_info * info)); - static bfd_boolean elf32_arm_create_dynamic_sections -@@ -3531,6 +3533,37 @@ - return TRUE; - } - -+/* Find any dynamic relocs that apply to read-only sections. */ -+ -+static bfd_boolean -+elf32_arm_readonly_dynrelocs (h, inf) -+ struct elf_link_hash_entry *h; -+ PTR inf; -+{ -+ struct elf32_arm_link_hash_entry *eh; -+ struct elf32_arm_relocs_copied *p; -+ -+ if (h->root.type == bfd_link_hash_warning) -+ h = (struct elf_link_hash_entry *) h->root.u.i.link; -+ -+ eh = (struct elf32_arm_link_hash_entry *) h; -+ for (p = eh->relocs_copied; p != NULL; p = p->next) -+ { -+ asection *s = p->section; -+ -+ if (s != NULL && (s->flags & SEC_READONLY) != 0) -+ { -+ struct bfd_link_info *info = (struct bfd_link_info *) inf; -+ -+ info->flags |= DF_TEXTREL; -+ -+ /* Not an error, just cut short the traversal. */ -+ return FALSE; -+ } -+ } -+ return TRUE; -+} -+ - /* Set the sizes of the dynamic sections. */ - - static bfd_boolean -@@ -3740,6 +3773,12 @@ - return FALSE; - } - -+ /* If any dynamic relocs apply to a read-only section, -+ then we need a DT_TEXTREL entry. */ -+ if ((info->flags & DF_TEXTREL) == 0) -+ elf_link_hash_traverse (&htab->root, elf32_arm_readonly_dynrelocs, -+ (PTR) info); -+ - if ((info->flags & DF_TEXTREL) != 0) - { - if (!add_dynamic_entry (DT_TEXTREL, 0)) diff --git a/patches/binutils/2.15/700-bfd-hash-tweak.patch b/patches/binutils/2.15/700-bfd-hash-tweak.patch deleted file mode 100644 index 6b8fc41..0000000 --- a/patches/binutils/2.15/700-bfd-hash-tweak.patch +++ /dev/null @@ -1,24 +0,0 @@ -Signed-off-by: dank@kegel.com - -Raising the size of the hash table is a noticable win when linking -at least one large app. - -There was a patch, -http://sources.redhat.com/ml/binutils/2004-06/msg00165.html -to do this dynamically. No idea why that didn't make it in. -So this tiny change to raise the default size is just -a stopgap for now. - - ---- binutils-2.15/bfd/hash.c.old 2003-12-01 01:33:01.000000000 -0500 -+++ binutils-2.15/bfd/hash.c 2006-03-01 16:26:26.701991000 -0500 -@@ -295,7 +295,7 @@ - */ - - /* The default number of entries to use when creating a hash table. */ --#define DEFAULT_SIZE (4051) -+#define DEFAULT_SIZE (32749) - - /* Create a new hash table, given a number of entries. */ - - diff --git a/patches/binutils/2.15/710-allow-gcc-4.0.patch b/patches/binutils/2.15/710-allow-gcc-4.0.patch deleted file mode 100644 index 26e5a12..0000000 --- a/patches/binutils/2.15/710-allow-gcc-4.0.patch +++ /dev/null @@ -1,75 +0,0 @@ -Fix found here: http://www.freelists.org/archives/openbeos/11-2005/msg00090.html - -Fixes: -In file included from ./targ-cpu.h:1, - from /home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/config/obj-elf.h:42, - from ./obj-format.h:1, - from /home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/config/te-linux.h:4, - from ./targ-env.h:1, - from /home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/as.h:626, - from /home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/app.c:30: -/home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/binutils-2.15/gas/config/tc-i386.h:451: error: array type has incomplete element type -make[3]: *** [app.o] Error 1 -make[3]: Leaving directory `/home/dank/crosstool-new/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.2.2/build-binutils/gas' - -when building binutils-2.15 with gcc-4.0 - - -diff -ur binutils-2.15.old/gas/as.h binutils-2.15/gas/as.h ---- binutils-2.15.old/gas/as.h 2003-11-22 18:14:21.000000000 -0800 -+++ binutils-2.15/gas/as.h 2006-02-14 22:05:35.000000000 -0800 -@@ -605,7 +605,26 @@ - struct expressionS; - struct fix; - typedef struct symbol symbolS; --struct relax_type; -+ -+/* JF moved this here from as.h under the theory that nobody except MACHINE.c -+ and write.c care about it anyway. */ -+/* [zooey]: the above no longer holds with gcc4, as it keeps bugging about -+ incomplete element types in arrays, if relax_type isn't defined -+ here. So I moved the definition back from tc.h to here. */ -+struct relax_type -+{ -+ /* Forward reach. Signed number. > 0. */ -+ long rlx_forward; -+ /* Backward reach. Signed number. < 0. */ -+ long rlx_backward; -+ -+ /* Bytes length of this address. */ -+ unsigned char rlx_length; -+ -+ /* Next longer relax-state. 0 means there is no 'next' relax-state. */ -+ relax_substateT rlx_more; -+}; -+ - typedef struct frag fragS; - - #ifdef BFD_ASSEMBLER -diff -ur binutils-2.15.old/gas/tc.h binutils-2.15/gas/tc.h ---- binutils-2.15.old/gas/tc.h 2003-12-03 15:39:38.000000000 -0800 -+++ binutils-2.15/gas/tc.h 2006-02-14 22:03:35.000000000 -0800 -@@ -24,23 +24,6 @@ - - extern const pseudo_typeS md_pseudo_table[]; - --/* JF moved this here from as.h under the theory that nobody except MACHINE.c -- and write.c care about it anyway. */ -- --struct relax_type --{ -- /* Forward reach. Signed number. > 0. */ -- long rlx_forward; -- /* Backward reach. Signed number. < 0. */ -- long rlx_backward; -- -- /* Bytes length of this address. */ -- unsigned char rlx_length; -- -- /* Next longer relax-state. 0 means there is no 'next' relax-state. */ -- relax_substateT rlx_more; --}; -- - typedef struct relax_type relax_typeS; - - extern const int md_reloc_size; /* Size of a relocation record */ diff --git a/patches/binutils/2.15/720-psignal.patch b/patches/binutils/2.15/720-psignal.patch deleted file mode 100644 index 98fa600..0000000 --- a/patches/binutils/2.15/720-psignal.patch +++ /dev/null @@ -1,40 +0,0 @@ -Make psignal prototype in libiberty match that in glibc. - -Fixes: - -gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c: In function `psignal': -gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `signo' doesn't match prototype -/usr/include/signal.h:131: prototype declaration -gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `message' doesn't match prototype -/usr/include/signal.h:131: prototype declaration -gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:568: warning: comparison between signed and unsigned -mprotect... make[1]: *** [strsignal.o] Error 1 -make[1]: Leaving directory `/export/hda3/dkegel/queue/jobdir.produser_cpsm17/crosstool-0.32/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.1.3/build-binutils/libiberty' -make: *** [all-libiberty] Error 2 - -when building on red hat 7.1 -though it's a bit of a mystery why libiberty's psignal is being compiled at -all, since red hat 7.1's glibc supports psignal (hence the error message) - ---- binutils-2.15/libiberty/strsignal.c.old 2005-04-18 13:57:40.000000000 -0700 -+++ binutils-2.15/libiberty/strsignal.c 2005-04-18 13:59:09.000000000 -0700 -@@ -544,7 +544,7 @@ - - /* - --@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message}) -+@deftypefn Supplemental void psignal (int @var{signo}, const char *@var{message}) - - Print @var{message} to the standard error, followed by a colon, - followed by the description of the signal specified by @var{signo}, -@@ -557,9 +557,7 @@ - #ifndef HAVE_PSIGNAL - - void --psignal (signo, message) -- unsigned signo; -- char *message; -+psignal (int signo, const char *message) - { - if (signal_names == NULL) - { diff --git a/patches/binutils/2.15/730-solaris-qsort.patch b/patches/binutils/2.15/730-solaris-qsort.patch deleted file mode 100644 index 5fe3623..0000000 --- a/patches/binutils/2.15/730-solaris-qsort.patch +++ /dev/null @@ -1,22 +0,0 @@ -See http://sources.redhat.com/ml/binutils/2004-06/msg00114.html - ---- src/bfd/elflink.c.org 2004-07-05 09:11:42.920597000 -0400 -+++ src/bfd/elflink.c 2004-07-05 09:12:59.240847000 -0400 -@@ -2700,7 +2700,7 @@ - return vdiff > 0 ? 1 : -1; - else - { -- long sdiff = h1->root.u.def.section - h2->root.u.def.section; -+ long sdiff = h1->root.u.def.section->id - h2->root.u.def.section->id; - if (sdiff != 0) - return sdiff > 0 ? 1 : -1; - } -@@ -3954,7 +3954,7 @@ - i = idx + 1; - else - { -- long sdiff = slook - h->root.u.def.section; -+ long sdiff = slook->id - h->root.u.def.section->id; - if (sdiff < 0) - j = idx; - else if (sdiff > 0) diff --git a/patches/binutils/2.15/740-vmx.patch b/patches/binutils/2.15/740-vmx.patch deleted file mode 100644 index 5ae9efe..0000000 --- a/patches/binutils/2.15/740-vmx.patch +++ /dev/null @@ -1,45 +0,0 @@ -Grabbed with -wget 'http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/opcodes/ppc-opc.c.diff?r1=1.70&r2=1.71&cvsroot=src' -See -http://mail.gnu.org/archive/html/bug-binutils/2004-05/msg00071.html -and -http://sources.redhat.com/ml/binutils-cvs/2004-05/msg00111.html - -This fixes problems like -{standard input}: Assembler messages: -{standard input}:1: Error: Unrecognized opcode: `dssall' -which show up in binutils-2.15 when building the Linux kernel, -or possibly failed compilations when building setjmp/longjmp in glibc. - -An alternative fix would be to pass -many to the assembler. -A patch to do that for glibc is at -wget 'http://sources.redhat.com/cgi-bin/get-raw-msg?listname=libc-alpha&date=2004-05&msgid=40B36E8C.9030609%40us.ibm.com' -Yet another, better, fix would be for gcc to generate assembly -that told the assembler which processor type to use. -Presumably the Linux kernel sources would need a fix, too. -Probably better to just fix binutils to accept sources that it used to. - - -=================================================================== -RCS file: /cvs/src/src/opcodes/ppc-opc.c,v -retrieving revision 1.70 -retrieving revision 1.71 -diff -u -r1.70 -r1.71 ---- src/opcodes/ppc-opc.c 2004/05/05 13:43:36 1.70 -+++ src/opcodes/ppc-opc.c 2004/05/19 05:11:48 1.71 -@@ -1004,8 +1004,13 @@ - - /* If only one bit of the FXM field is set, we can use the new form - of the instruction, which is faster. Unlike the Power4 branch hint -- encoding, this is not backward compatible. */ -- else if ((dialect & PPC_OPCODE_POWER4) != 0 && (value & -value) == value) -+ encoding, this is not backward compatible. Do not generate the -+ new form unless -mpower4 has been given, or -many and the two -+ operand form of mfcr was used. */ -+ else if ((value & -value) == value -+ && ((dialect & PPC_OPCODE_POWER4) != 0 -+ || ((dialect & PPC_OPCODE_ANY) != 0 -+ && (insn & (0x3ff << 1)) == 19 << 1))) - insn |= 1 << 20; - - /* Any other value on mfcr is an error. */ diff --git a/patches/binutils/2.15/750-arm-undef-imm.patch b/patches/binutils/2.15/750-arm-undef-imm.patch deleted file mode 100644 index 6bf403c..0000000 --- a/patches/binutils/2.15/750-arm-undef-imm.patch +++ /dev/null @@ -1,51 +0,0 @@ -From http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/config/tc-arm.c.diff?r1=1.168&r2=1.169&cvsroot=src -See also http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2004-July/023128.html, -"[CRITICAL PATCH] 2.6: fix silent build error]" - -Revision 1.169, Fri Jul 2 11:12:29 2004 UTC (19 hours, 4 minutes ago) by nickc -Branch: MAIN -CVS Tags: binutils_latest_snapshot, HEAD -Changes since 1.168: +14 -1 lines - -(md_apply_fix3:BFD_RELOC_ARM_IMMEDIATE): Do not allow values which have come -from undefined symbols. -Always consider this fixup to have been processed as a reloc cannot be -generated for it. - - -=================================================================== -RCS file: /cvs/src/src/gas/config/tc-arm.c,v -retrieving revision 1.168 -retrieving revision 1.169 -diff -u -r1.168 -r1.169 ---- src/gas/config/tc-arm.c 2004/04/30 10:51:12 1.168 -+++ src/gas/config/tc-arm.c 2004/07/02 11:12:29 1.169 -@@ -12186,6 +12186,20 @@ - switch (fixP->fx_r_type) - { - case BFD_RELOC_ARM_IMMEDIATE: -+ /* We claim that this fixup has been processed here, -+ even if in fact we generate an error because we do -+ not have a reloc for it, so tc_gen_reloc will reject it. */ -+ fixP->fx_done = 1; -+ -+ if (fixP->fx_addsy -+ && ! S_IS_DEFINED (fixP->fx_addsy)) -+ { -+ as_bad_where (fixP->fx_file, fixP->fx_line, -+ _("undefined symbol %s used as an immediate value"), -+ S_GET_NAME (fixP->fx_addsy)); -+ break; -+ } -+ - newimm = validate_immediate (value); - temp = md_chars_to_number (buf, INSN_SIZE); - -@@ -12202,7 +12216,6 @@ - - newimm |= (temp & 0xfffff000); - md_number_to_chars (buf, (valueT) newimm, INSN_SIZE); -- fixP->fx_done = 1; - break; - - case BFD_RELOC_ARM_ADRL_IMMEDIATE: diff --git a/patches/binutils/2.15/760-skip-comments.patch b/patches/binutils/2.15/760-skip-comments.patch deleted file mode 100644 index 804a17e..0000000 --- a/patches/binutils/2.15/760-skip-comments.patch +++ /dev/null @@ -1,101 +0,0 @@ -Retrieved from http://sources.redhat.com/ml/binutils/2004-04/msg00646.html -Fixes -localealias.s:544: Error: junk at end of line, first unrecognized character is `,' -when building glibc-2.3.2 with gcc-3.4.0 and binutils-2.15.90.0.3 - -Paths adjusted to match crosstool's patcher. - -Message-Id: m3n052qw2g.fsf@whitebox.m5r.de -From: Andreas Schwab -To: Nathan Sidwell -Cc: Ian Lance Taylor , binutils at sources dot redhat dot com -Date: Fri, 23 Apr 2004 22:27:19 +0200 -Subject: Re: demand_empty_rest_of_line and ignore_rest_of_line - -Nathan Sidwell writes: - -> Index: read.c -> =================================================================== -> RCS file: /cvs/src/src/gas/read.c,v -> retrieving revision 1.76 -> diff -c -3 -p -r1.76 read.c -> *** read.c 12 Mar 2004 17:48:12 -0000 1.76 -> --- read.c 18 Mar 2004 09:56:05 -0000 -> *************** read_a_source_file (char *name) -> *** 1053,1059 **** -> #endif -> input_line_pointer--; -> /* Report unknown char as ignored. */ -> ! ignore_rest_of_line (); -> } -> -> #ifdef md_after_pass_hook -> --- 1053,1059 ---- -> #endif -> input_line_pointer--; -> /* Report unknown char as ignored. */ -> ! demand_empty_rest_of_line (); -> } -> -> #ifdef md_after_pass_hook - -This means that the unknown character is no longer ignored, despite the -comment. As a side effect a line starting with a line comment character -not followed by APP in NO_APP mode now triggers an error instead of just a -warning, breaking builds of glibc on m68k-linux. Earlier in -read_a_source_file where #APP is handled there is another comment that -claims that unknown comments are ignored, when in fact they aren't (only -the initial line comment character is skipped). - -Note that the presence of #APP will mess up the line counters, but -that appears to be difficult to fix. - -Andreas. - -2004-04-23 Andreas Schwab - - * read.c (read_a_source_file): Ignore unknown text after line - comment character. Fix misleading comment. - ---- binutils/gas/read.c.~1.78.~ 2004-04-23 08:58:23.000000000 +0200 -+++ binutils/gas/read.c 2004-04-23 21:49:01.000000000 +0200 -@@ -1,6 +1,6 @@ - /* read.c - read a source file - - Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, -- 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -+ 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. - - This file is part of GAS, the GNU Assembler. - -@@ -950,10 +950,14 @@ read_a_source_file (char *name) - unsigned int new_length; - char *tmp_buf = 0; - -- bump_line_counters (); - s = input_line_pointer; - if (strncmp (s, "APP\n", 4)) -- continue; /* We ignore it */ -+ { -+ /* We ignore it */ -+ ignore_rest_of_line (); -+ continue; -+ } -+ bump_line_counters (); - s += 4; - - sb_new (&sbuf); -@@ -1052,7 +1056,7 @@ read_a_source_file (char *name) - continue; - #endif - input_line_pointer--; -- /* Report unknown char as ignored. */ -+ /* Report unknown char as error. */ - demand_empty_rest_of_line (); - } - - --- -Andreas Schwab, SuSE Labs, schwab@suse.de -SuSE Linux AG, MaxfeldstraÃe 5, 90409 NÃrnberg, Germany -Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 -"And now for something completely different." diff --git a/patches/binutils/2.15/770-cross-gprof.patch b/patches/binutils/2.15/770-cross-gprof.patch deleted file mode 100644 index ea6c18f..0000000 --- a/patches/binutils/2.15/770-cross-gprof.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- binutils-2.15/configure.old 2004-07-21 21:36:47.000000000 -0700 -+++ binutils-2.15/configure 2004-07-21 21:37:08.000000000 -0700 -@@ -999,7 +999,7 @@ - - # Some tools are only suitable for building in a "native" situation. - # Remove these if host!=target. --native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf" -+native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf" - - # Similarly, some are only suitable for cross toolchains. - # Remove these if host=target. ---- binutils-2.15/configure.in.old 2004-07-21 21:37:19.000000000 -0700 -+++ binutils-2.15/configure.in 2004-07-21 21:37:34.000000000 -0700 -@@ -236,7 +236,7 @@ - - # Some tools are only suitable for building in a "native" situation. - # Remove these if host!=target. --native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf" -+native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf" - - # Similarly, some are only suitable for cross toolchains. - # Remove these if host=target. diff --git a/patches/binutils/2.15/780-gccpr15247-fix.patch b/patches/binutils/2.15/780-gccpr15247-fix.patch deleted file mode 100644 index 967bf7f..0000000 --- a/patches/binutils/2.15/780-gccpr15247-fix.patch +++ /dev/null @@ -1,192 +0,0 @@ -See -http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15247 - -Fixes spurious error -/tmp/ccvNi4ou.s: Assembler messages: -/tmp/ccvNi4ou.s:2310: Error: Illegal operands: There are only 32 single precision f registers; [0-31] -make[2]: *** [/home/dank/wk/crosstool-0.28-rc10/build/sparc64-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/math/dosincos.o] Error 1 - -when compiling glibc's dosincos.c with gcc-3.4.0 - -=================================================================== -RCS file: /cvs/src/src/opcodes/sparc-opc.c,v -retrieving revision 1.9 -retrieving revision 1.10 -diff -u -r1.9 -r1.10 ---- src/opcodes/sparc-opc.c 2004/01/18 23:46:32 1.9 -+++ src/opcodes/sparc-opc.c 2004/04/20 10:23:51 1.10 -@@ -1273,110 +1273,72 @@ - #define FM_DF 2 /* v9 */ - #define FM_QF 3 /* v9 */ - --#define fmovicc(opcode, fpsize, cond, flags) /* v9 */ \ --{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z,f,g", flags, v9 }, \ --{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z,f,g", flags, v9 } -- --#define fmovfcc(opcode, fpsize, fcond, flags) /* v9 */ \ --{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6,f,g", flags, v9 }, \ --{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7,f,g", flags, v9 }, \ --{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8,f,g", flags, v9 }, \ --{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9,f,g", flags, v9 } -+#define fmoviccx(opcode, fpsize, args, cond, flags) /* v9 */ \ -+{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z," args, flags, v9 }, \ -+{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z," args, flags, v9 } -+ -+#define fmovfccx(opcode, fpsize, args, fcond, flags) /* v9 */ \ -+{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6," args, flags, v9 }, \ -+{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7," args, flags, v9 }, \ -+{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8," args, flags, v9 }, \ -+{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9," args, flags, v9 } - - /* FIXME: use fmovicc/fmovfcc? */ /* v9 */ --#define fmovcc(opcode, fpsize, cond, fcond, flags) /* v9 */ \ --{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z,f,g", flags | F_FLOAT, v9 }, \ --{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6,f,g", flags | F_FLOAT, v9 }, \ --{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z,f,g", flags | F_FLOAT, v9 }, \ --{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7,f,g", flags | F_FLOAT, v9 }, \ --{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8,f,g", flags | F_FLOAT, v9 }, \ --{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9,f,g", flags | F_FLOAT, v9 } -- --/* v9 */ fmovcc ("fmovda", FM_DF, CONDA, FCONDA, 0), --/* v9 */ fmovcc ("fmovqa", FM_QF, CONDA, FCONDA, 0), --/* v9 */ fmovcc ("fmovsa", FM_SF, CONDA, FCONDA, 0), --/* v9 */ fmovicc ("fmovdcc", FM_DF, CONDCC, 0), --/* v9 */ fmovicc ("fmovqcc", FM_QF, CONDCC, 0), --/* v9 */ fmovicc ("fmovscc", FM_SF, CONDCC, 0), --/* v9 */ fmovicc ("fmovdcs", FM_DF, CONDCS, 0), --/* v9 */ fmovicc ("fmovqcs", FM_QF, CONDCS, 0), --/* v9 */ fmovicc ("fmovscs", FM_SF, CONDCS, 0), --/* v9 */ fmovcc ("fmovde", FM_DF, CONDE, FCONDE, 0), --/* v9 */ fmovcc ("fmovqe", FM_QF, CONDE, FCONDE, 0), --/* v9 */ fmovcc ("fmovse", FM_SF, CONDE, FCONDE, 0), --/* v9 */ fmovcc ("fmovdg", FM_DF, CONDG, FCONDG, 0), --/* v9 */ fmovcc ("fmovqg", FM_QF, CONDG, FCONDG, 0), --/* v9 */ fmovcc ("fmovsg", FM_SF, CONDG, FCONDG, 0), --/* v9 */ fmovcc ("fmovdge", FM_DF, CONDGE, FCONDGE, 0), --/* v9 */ fmovcc ("fmovqge", FM_QF, CONDGE, FCONDGE, 0), --/* v9 */ fmovcc ("fmovsge", FM_SF, CONDGE, FCONDGE, 0), --/* v9 */ fmovicc ("fmovdgeu", FM_DF, CONDGEU, F_ALIAS), --/* v9 */ fmovicc ("fmovqgeu", FM_QF, CONDGEU, F_ALIAS), --/* v9 */ fmovicc ("fmovsgeu", FM_SF, CONDGEU, F_ALIAS), --/* v9 */ fmovicc ("fmovdgu", FM_DF, CONDGU, 0), --/* v9 */ fmovicc ("fmovqgu", FM_QF, CONDGU, 0), --/* v9 */ fmovicc ("fmovsgu", FM_SF, CONDGU, 0), --/* v9 */ fmovcc ("fmovdl", FM_DF, CONDL, FCONDL, 0), --/* v9 */ fmovcc ("fmovql", FM_QF, CONDL, FCONDL, 0), --/* v9 */ fmovcc ("fmovsl", FM_SF, CONDL, FCONDL, 0), --/* v9 */ fmovcc ("fmovdle", FM_DF, CONDLE, FCONDLE, 0), --/* v9 */ fmovcc ("fmovqle", FM_QF, CONDLE, FCONDLE, 0), --/* v9 */ fmovcc ("fmovsle", FM_SF, CONDLE, FCONDLE, 0), --/* v9 */ fmovicc ("fmovdleu", FM_DF, CONDLEU, 0), --/* v9 */ fmovicc ("fmovqleu", FM_QF, CONDLEU, 0), --/* v9 */ fmovicc ("fmovsleu", FM_SF, CONDLEU, 0), --/* v9 */ fmovfcc ("fmovdlg", FM_DF, FCONDLG, 0), --/* v9 */ fmovfcc ("fmovqlg", FM_QF, FCONDLG, 0), --/* v9 */ fmovfcc ("fmovslg", FM_SF, FCONDLG, 0), --/* v9 */ fmovicc ("fmovdlu", FM_DF, CONDLU, F_ALIAS), --/* v9 */ fmovicc ("fmovqlu", FM_QF, CONDLU, F_ALIAS), --/* v9 */ fmovicc ("fmovslu", FM_SF, CONDLU, F_ALIAS), --/* v9 */ fmovcc ("fmovdn", FM_DF, CONDN, FCONDN, 0), --/* v9 */ fmovcc ("fmovqn", FM_QF, CONDN, FCONDN, 0), --/* v9 */ fmovcc ("fmovsn", FM_SF, CONDN, FCONDN, 0), --/* v9 */ fmovcc ("fmovdne", FM_DF, CONDNE, FCONDNE, 0), --/* v9 */ fmovcc ("fmovqne", FM_QF, CONDNE, FCONDNE, 0), --/* v9 */ fmovcc ("fmovsne", FM_SF, CONDNE, FCONDNE, 0), --/* v9 */ fmovicc ("fmovdneg", FM_DF, CONDNEG, 0), --/* v9 */ fmovicc ("fmovqneg", FM_QF, CONDNEG, 0), --/* v9 */ fmovicc ("fmovsneg", FM_SF, CONDNEG, 0), --/* v9 */ fmovcc ("fmovdnz", FM_DF, CONDNZ, FCONDNZ, F_ALIAS), --/* v9 */ fmovcc ("fmovqnz", FM_QF, CONDNZ, FCONDNZ, F_ALIAS), --/* v9 */ fmovcc ("fmovsnz", FM_SF, CONDNZ, FCONDNZ, F_ALIAS), --/* v9 */ fmovfcc ("fmovdo", FM_DF, FCONDO, 0), --/* v9 */ fmovfcc ("fmovqo", FM_QF, FCONDO, 0), --/* v9 */ fmovfcc ("fmovso", FM_SF, FCONDO, 0), --/* v9 */ fmovicc ("fmovdpos", FM_DF, CONDPOS, 0), --/* v9 */ fmovicc ("fmovqpos", FM_QF, CONDPOS, 0), --/* v9 */ fmovicc ("fmovspos", FM_SF, CONDPOS, 0), --/* v9 */ fmovfcc ("fmovdu", FM_DF, FCONDU, 0), --/* v9 */ fmovfcc ("fmovqu", FM_QF, FCONDU, 0), --/* v9 */ fmovfcc ("fmovsu", FM_SF, FCONDU, 0), --/* v9 */ fmovfcc ("fmovdue", FM_DF, FCONDUE, 0), --/* v9 */ fmovfcc ("fmovque", FM_QF, FCONDUE, 0), --/* v9 */ fmovfcc ("fmovsue", FM_SF, FCONDUE, 0), --/* v9 */ fmovfcc ("fmovdug", FM_DF, FCONDUG, 0), --/* v9 */ fmovfcc ("fmovqug", FM_QF, FCONDUG, 0), --/* v9 */ fmovfcc ("fmovsug", FM_SF, FCONDUG, 0), --/* v9 */ fmovfcc ("fmovduge", FM_DF, FCONDUGE, 0), --/* v9 */ fmovfcc ("fmovquge", FM_QF, FCONDUGE, 0), --/* v9 */ fmovfcc ("fmovsuge", FM_SF, FCONDUGE, 0), --/* v9 */ fmovfcc ("fmovdul", FM_DF, FCONDUL, 0), --/* v9 */ fmovfcc ("fmovqul", FM_QF, FCONDUL, 0), --/* v9 */ fmovfcc ("fmovsul", FM_SF, FCONDUL, 0), --/* v9 */ fmovfcc ("fmovdule", FM_DF, FCONDULE, 0), --/* v9 */ fmovfcc ("fmovqule", FM_QF, FCONDULE, 0), --/* v9 */ fmovfcc ("fmovsule", FM_SF, FCONDULE, 0), --/* v9 */ fmovicc ("fmovdvc", FM_DF, CONDVC, 0), --/* v9 */ fmovicc ("fmovqvc", FM_QF, CONDVC, 0), --/* v9 */ fmovicc ("fmovsvc", FM_SF, CONDVC, 0), --/* v9 */ fmovicc ("fmovdvs", FM_DF, CONDVS, 0), --/* v9 */ fmovicc ("fmovqvs", FM_QF, CONDVS, 0), --/* v9 */ fmovicc ("fmovsvs", FM_SF, CONDVS, 0), --/* v9 */ fmovcc ("fmovdz", FM_DF, CONDZ, FCONDZ, F_ALIAS), --/* v9 */ fmovcc ("fmovqz", FM_QF, CONDZ, FCONDZ, F_ALIAS), --/* v9 */ fmovcc ("fmovsz", FM_SF, CONDZ, FCONDZ, F_ALIAS), -- -+#define fmovccx(opcode, fpsize, args, cond, fcond, flags) /* v9 */ \ -+{ opcode, F3F(2, 0x35, 0x100+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x100+fpsize))|MCOND(~cond,~0), "z," args, flags | F_FLOAT, v9 }, \ -+{ opcode, F3F(2, 0x35, 0x000+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x000+fpsize))|MCOND(~fcond,~0), "6," args, flags | F_FLOAT, v9 }, \ -+{ opcode, F3F(2, 0x35, 0x180+fpsize)|MCOND(cond,0), F3F(~2, ~0x35, ~(0x180+fpsize))|MCOND(~cond,~0), "Z," args, flags | F_FLOAT, v9 }, \ -+{ opcode, F3F(2, 0x35, 0x040+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x040+fpsize))|MCOND(~fcond,~0), "7," args, flags | F_FLOAT, v9 }, \ -+{ opcode, F3F(2, 0x35, 0x080+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x080+fpsize))|MCOND(~fcond,~0), "8," args, flags | F_FLOAT, v9 }, \ -+{ opcode, F3F(2, 0x35, 0x0c0+fpsize)|MCOND(fcond,0), F3F(~2, ~0x35, ~(0x0c0+fpsize))|MCOND(~fcond,~0), "9," args, flags | F_FLOAT, v9 } -+ -+#define fmovicc(suffix, cond, flags) /* v9 */ \ -+fmoviccx("fmovd" suffix, FM_DF, "B,H", cond, flags), \ -+fmoviccx("fmovq" suffix, FM_QF, "R,J", cond, flags), \ -+fmoviccx("fmovs" suffix, FM_SF, "f,g", cond, flags) -+ -+#define fmovfcc(suffix, fcond, flags) /* v9 */ \ -+fmovfccx("fmovd" suffix, FM_DF, "B,H", fcond, flags), \ -+fmovfccx("fmovq" suffix, FM_QF, "R,J", fcond, flags), \ -+fmovfccx("fmovs" suffix, FM_SF, "f,g", fcond, flags) -+ -+#define fmovcc(suffix, cond, fcond, flags) /* v9 */ \ -+fmovccx("fmovd" suffix, FM_DF, "B,H", cond, fcond, flags), \ -+fmovccx("fmovq" suffix, FM_QF, "R,J", cond, fcond, flags), \ -+fmovccx("fmovs" suffix, FM_SF, "f,g", cond, fcond, flags) -+ -+/* v9 */ fmovcc ("a", CONDA, FCONDA, 0), -+/* v9 */ fmovicc ("cc", CONDCC, 0), -+/* v9 */ fmovicc ("cs", CONDCS, 0), -+/* v9 */ fmovcc ("e", CONDE, FCONDE, 0), -+/* v9 */ fmovcc ("g", CONDG, FCONDG, 0), -+/* v9 */ fmovcc ("ge", CONDGE, FCONDGE, 0), -+/* v9 */ fmovicc ("geu", CONDGEU, F_ALIAS), -+/* v9 */ fmovicc ("gu", CONDGU, 0), -+/* v9 */ fmovcc ("l", CONDL, FCONDL, 0), -+/* v9 */ fmovcc ("le", CONDLE, FCONDLE, 0), -+/* v9 */ fmovicc ("leu", CONDLEU, 0), -+/* v9 */ fmovfcc ("lg", FCONDLG, 0), -+/* v9 */ fmovicc ("lu", CONDLU, F_ALIAS), -+/* v9 */ fmovcc ("n", CONDN, FCONDN, 0), -+/* v9 */ fmovcc ("ne", CONDNE, FCONDNE, 0), -+/* v9 */ fmovicc ("neg", CONDNEG, 0), -+/* v9 */ fmovcc ("nz", CONDNZ, FCONDNZ, F_ALIAS), -+/* v9 */ fmovfcc ("o", FCONDO, 0), -+/* v9 */ fmovicc ("pos", CONDPOS, 0), -+/* v9 */ fmovfcc ("u", FCONDU, 0), -+/* v9 */ fmovfcc ("ue", FCONDUE, 0), -+/* v9 */ fmovfcc ("ug", FCONDUG, 0), -+/* v9 */ fmovfcc ("uge", FCONDUGE, 0), -+/* v9 */ fmovfcc ("ul", FCONDUL, 0), -+/* v9 */ fmovfcc ("ule", FCONDULE, 0), -+/* v9 */ fmovicc ("vc", CONDVC, 0), -+/* v9 */ fmovicc ("vs", CONDVS, 0), -+/* v9 */ fmovcc ("z", CONDZ, FCONDZ, F_ALIAS), -+ -+#undef fmoviccx /* v9 */ -+#undef fmovfccx /* v9 */ -+#undef fmovccx /* v9 */ - #undef fmovicc /* v9 */ - #undef fmovfcc /* v9 */ - #undef fmovcc /* v9 */ diff --git a/patches/binutils/2.15/790-ld-callahan.patch b/patches/binutils/2.15/790-ld-callahan.patch deleted file mode 100644 index bb4a69c..0000000 --- a/patches/binutils/2.15/790-ld-callahan.patch +++ /dev/null @@ -1,677 +0,0 @@ -Signed-off-by: dank@kegel.com -Fixes ld speed issue. -See http://weblogs.mozillazine.org/roc/archives/2005/02/optimizing_gnu.html -See thread "Re: optimizations for 3x speedup in ld", -http://sources.redhat.com/ml/binutils/2005-03/msg00847.html - -Wildcard section matching enhancement, backported from the binutils CVS tree. -Here's the CVS log comment from the original change to ldlang.c: - -revision 1.177 -date: 2005/04/06 15:33:02; author: jakub; state: Exp; lines: +438 -51 -2005-04-06 Jakub Jelinek - - * ldlang.c: Formatting. - (walk_wild_consider_section): Remember return value from wildcardp. - (is_simple_wild): Use strcspn instead of 2 strpbrk calls and strlen. - (wild_spec_can_overlap): Use strcspn instead of strpbrk and strlen. - -2005-04-06 Robert O'Callahan - - * ld.h (lean_section_userdata_type): Remove. - (fat_section_userdata_type): Remove file field. - (SECTION_USERDATA_SIZE): Remove. - * ldlang.c (init_os): Eliminate initialization of unused - lean_section_userdata_type. - - * ldlang.h (callback_t, walk_wild_section_handler_t): New - typedefs. - (struct lang_wild_statement_struct): Add walk_wild_section_handler - and handler_data fields. - * ldlang.c (callback_t): Removed. - (walk_wild_consider_section, walk_wild_section_general, - section_iterator_callback, find_section, is_simple_wild, - match_simple_wild, walk_wild_section_specs1_wild0, - walk_wild_section_specs1_wild1, walk_wild_section_specs2_wild1, - walk_wild_section_specs3_wild2, walk_wild_section_specs4_wild2, - wild_spec_can_overlap, analyze_walk_wild_section_handler): New - functions. - (lang_add_wild): Call analyze_walk_wild_section_handler. - (walk_wild_section): Renamed to walk_wild_section_general and - created a wrapper function. - (section_iterator_callback_data): New typedef. - -Note that bfd_get_section_by_name_if didn't exist in 2.15, so it was backported -as well. - ---- binutils-2.15/bfd/bfd-in2.h.old 2004-05-17 15:35:56.000000000 -0400 -+++ binutils-2.15/bfd/bfd-in2.h 2006-02-09 11:54:45.989940000 -0500 -@@ -1425,6 +1425,10 @@ - - asection *bfd_get_section_by_name (bfd *abfd, const char *name); - -+asection *bfd_get_section_by_name_if (bfd *abfd, const char *name, -+ bfd_boolean (*operation) (bfd *, asection *, void *), -+ void *user_storage); -+ - char *bfd_get_unique_section_name - (bfd *abfd, const char *templat, int *count); - ---- binutils-2.15/bfd/section.c.old 2003-12-01 01:33:01.000000000 -0500 -+++ binutils-2.15/bfd/section.c 2006-01-23 14:16:54.768993000 -0500 -@@ -801,6 +801,57 @@ - - /* - FUNCTION -+ bfd_get_section_by_name_if -+ -+SYNOPSIS -+ asection *bfd_get_section_by_name_if -+ (bfd *abfd, -+ const char *name, -+ bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj), -+ void *obj); -+ -+DESCRIPTION -+ Call the provided function @var{func} for each section -+ attached to the BFD @var{abfd} whose name matches @var{name}, -+ passing @var{obj} as an argument. The function will be called -+ as if by -+ -+| func (abfd, the_section, obj); -+ -+ It returns the first section for which @var{func} returns true, -+ otherwise <>. -+ -+*/ -+ -+asection * -+bfd_get_section_by_name_if (bfd *abfd, const char *name, -+ bfd_boolean (*operation) (bfd *, -+ asection *, -+ void *), -+ void *user_storage) -+{ -+ struct section_hash_entry *sh; -+ unsigned long hash; -+ -+ sh = section_hash_lookup (&abfd->section_htab, name, FALSE, FALSE); -+ if (sh == NULL) -+ return NULL; -+ -+ hash = sh->root.hash; -+ do -+ { -+ if ((*operation) (abfd, &sh->section, user_storage)) -+ return &sh->section; -+ sh = (struct section_hash_entry *) sh->root.next; -+ } -+ while (sh != NULL && sh->root.hash == hash -+ && strcmp (sh->root.string, name) == 0); -+ -+ return NULL; -+} -+ -+/* -+FUNCTION - bfd_get_unique_section_name - - SYNOPSIS ---- binutils-2.15/ld/ldlang.c.old 2004-05-17 15:36:16.000000000 -0400 -+++ binutils-2.15/ld/ldlang.c 2006-01-23 13:40:12.745499000 -0500 -@@ -81,9 +81,6 @@ - static void lang_record_phdrs (void); - static void lang_do_version_exports_section (void); - --typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *, -- asection *, lang_input_statement_type *, void *); -- - /* Exported variables. */ - lang_output_section_statement_type *abs_output_section; - lang_statement_list_type lang_output_section_statement; -@@ -138,21 +135,71 @@ - - /* Generic traversal routines for finding matching sections. */ - -+/* Try processing a section against a wildcard. This just calls -+ the callback unless the filename exclusion list is present -+ and excludes the file. It's hardly ever present so this -+ function is very fast. */ -+ -+static void -+walk_wild_consider_section (lang_wild_statement_type *ptr, -+ lang_input_statement_type *file, -+ asection *s, -+ struct wildcard_list *sec, -+ callback_t callback, -+ void *data) -+{ -+ bfd_boolean skip = FALSE; -+ struct name_list *list_tmp; -+ -+ /* Don't process sections from files which were -+ excluded. */ -+ for (list_tmp = sec->spec.exclude_name_list; -+ list_tmp; -+ list_tmp = list_tmp->next) -+ { -+ bfd_boolean is_wildcard = wildcardp (list_tmp->name); -+ if (is_wildcard) -+ skip = fnmatch (list_tmp->name, file->filename, 0) == 0; -+ else -+ skip = strcmp (list_tmp->name, file->filename) == 0; -+ -+ /* If this file is part of an archive, and the archive is -+ excluded, exclude this file. */ -+ if (! skip && file->the_bfd != NULL -+ && file->the_bfd->my_archive != NULL -+ && file->the_bfd->my_archive->filename != NULL) -+ { -+ if (is_wildcard) -+ skip = fnmatch (list_tmp->name, -+ file->the_bfd->my_archive->filename, -+ 0) == 0; -+ else -+ skip = strcmp (list_tmp->name, -+ file->the_bfd->my_archive->filename) == 0; -+ } -+ -+ if (skip) -+ break; -+ } -+ -+ if (!skip) -+ (*callback) (ptr, sec, s, file, data); -+} -+ -+/* Lowest common denominator routine that can handle everything correctly, -+ but slowly. */ -+ - static void --walk_wild_section (lang_wild_statement_type *ptr, -- lang_input_statement_type *file, -- callback_t callback, -- void *data) -+walk_wild_section_general (lang_wild_statement_type *ptr, -+ lang_input_statement_type *file, -+ callback_t callback, -+ void *data) - { - asection *s; -- -- if (file->just_syms_flag) -- return; -+ struct wildcard_list *sec; - - for (s = file->the_bfd->sections; s != NULL; s = s->next) - { -- struct wildcard_list *sec; -- - sec = ptr->section_list; - if (sec == NULL) - (*callback) (ptr, sec, s, file, data); -@@ -160,39 +207,8 @@ - while (sec != NULL) - { - bfd_boolean skip = FALSE; -- struct name_list *list_tmp; -- -- /* Don't process sections from files which were -- excluded. */ -- for (list_tmp = sec->spec.exclude_name_list; -- list_tmp; -- list_tmp = list_tmp->next) -- { -- if (wildcardp (list_tmp->name)) -- skip = fnmatch (list_tmp->name, file->filename, 0) == 0; -- else -- skip = strcmp (list_tmp->name, file->filename) == 0; -- -- /* If this file is part of an archive, and the archive is -- excluded, exclude this file. */ -- if (! skip && file->the_bfd != NULL -- && file->the_bfd->my_archive != NULL -- && file->the_bfd->my_archive->filename != NULL) -- { -- if (wildcardp (list_tmp->name)) -- skip = fnmatch (list_tmp->name, -- file->the_bfd->my_archive->filename, -- 0) == 0; -- else -- skip = strcmp (list_tmp->name, -- file->the_bfd->my_archive->filename) == 0; -- } -- -- if (skip) -- break; -- } - -- if (!skip && sec->spec.name != NULL) -+ if (sec->spec.name != NULL) - { - const char *sname = bfd_get_section_name (file->the_bfd, s); - -@@ -203,13 +219,381 @@ - } - - if (!skip) -- (*callback) (ptr, sec, s, file, data); -+ walk_wild_consider_section (ptr, file, s, sec, callback, data); - - sec = sec->next; - } - } - } - -+/* Routines to find a single section given its name. If there's more -+ than one section with that name, we report that. */ -+ -+typedef struct -+{ -+ asection *found_section; -+ bfd_boolean multiple_sections_found; -+} section_iterator_callback_data; -+ -+static bfd_boolean -+section_iterator_callback (bfd *bfd ATTRIBUTE_UNUSED, asection *s, void *data) -+{ -+ section_iterator_callback_data *d = data; -+ -+ if (d->found_section != NULL) -+ { -+ d->multiple_sections_found = TRUE; -+ return TRUE; -+ } -+ -+ d->found_section = s; -+ return FALSE; -+} -+ -+static asection * -+find_section (lang_input_statement_type *file, -+ struct wildcard_list *sec, -+ bfd_boolean *multiple_sections_found) -+{ -+ section_iterator_callback_data cb_data = { NULL, FALSE }; -+ -+ bfd_get_section_by_name_if (file->the_bfd, sec->spec.name, -+ section_iterator_callback, &cb_data); -+ *multiple_sections_found = cb_data.multiple_sections_found; -+ return cb_data.found_section; -+} -+ -+/* Code for handling simple wildcards without going through fnmatch, -+ which can be expensive because of charset translations etc. */ -+ -+/* A simple wild is a literal string followed by a single '*', -+ where the literal part is at least 4 characters long. */ -+ -+static bfd_boolean -+is_simple_wild (const char *name) -+{ -+ size_t len = strcspn (name, "*?["); -+ return len >= 4 && name[len] == '*' && name[len + 1] == '\0'; -+} -+ -+static bfd_boolean -+match_simple_wild (const char *pattern, const char *name) -+{ -+ /* The first four characters of the pattern are guaranteed valid -+ non-wildcard characters. So we can go faster. */ -+ if (pattern[0] != name[0] || pattern[1] != name[1] -+ || pattern[2] != name[2] || pattern[3] != name[3]) -+ return FALSE; -+ -+ pattern += 4; -+ name += 4; -+ while (*pattern != '*') -+ if (*name++ != *pattern++) -+ return FALSE; -+ -+ return TRUE; -+} -+ -+/* Specialized, optimized routines for handling different kinds of -+ wildcards */ -+ -+static void -+walk_wild_section_specs1_wild0 (lang_wild_statement_type *ptr, -+ lang_input_statement_type *file, -+ callback_t callback, -+ void *data) -+{ -+ /* We can just do a hash lookup for the section with the right name. -+ But if that lookup discovers more than one section with the name -+ (should be rare), we fall back to the general algorithm because -+ we would otherwise have to sort the sections to make sure they -+ get processed in the bfd's order. */ -+ bfd_boolean multiple_sections_found; -+ struct wildcard_list *sec0 = ptr->handler_data[0]; -+ asection *s0 = find_section (file, sec0, &multiple_sections_found); -+ -+ if (multiple_sections_found) -+ walk_wild_section_general (ptr, file, callback, data); -+ else if (s0) -+ walk_wild_consider_section (ptr, file, s0, sec0, callback, data); -+} -+ -+static void -+walk_wild_section_specs1_wild1 (lang_wild_statement_type *ptr, -+ lang_input_statement_type *file, -+ callback_t callback, -+ void *data) -+{ -+ asection *s; -+ struct wildcard_list *wildsec0 = ptr->handler_data[0]; -+ -+ for (s = file->the_bfd->sections; s != NULL; s = s->next) -+ { -+ const char *sname = bfd_get_section_name (file->the_bfd, s); -+ bfd_boolean skip = !match_simple_wild (wildsec0->spec.name, sname); -+ -+ if (!skip) -+ walk_wild_consider_section (ptr, file, s, wildsec0, callback, data); -+ } -+} -+ -+static void -+walk_wild_section_specs2_wild1 (lang_wild_statement_type *ptr, -+ lang_input_statement_type *file, -+ callback_t callback, -+ void *data) -+{ -+ asection *s; -+ struct wildcard_list *sec0 = ptr->handler_data[0]; -+ struct wildcard_list *wildsec1 = ptr->handler_data[1]; -+ bfd_boolean multiple_sections_found; -+ asection *s0 = find_section (file, sec0, &multiple_sections_found); -+ -+ if (multiple_sections_found) -+ { -+ walk_wild_section_general (ptr, file, callback, data); -+ return; -+ } -+ -+ /* Note that if the section was not found, s0 is NULL and -+ we'll simply never succeed the s == s0 test below. */ -+ for (s = file->the_bfd->sections; s != NULL; s = s->next) -+ { -+ /* Recall that in this code path, a section cannot satisfy more -+ than one spec, so if s == s0 then it cannot match -+ wildspec1. */ -+ if (s == s0) -+ walk_wild_consider_section (ptr, file, s, sec0, callback, data); -+ else -+ { -+ const char *sname = bfd_get_section_name (file->the_bfd, s); -+ bfd_boolean skip = !match_simple_wild (wildsec1->spec.name, sname); -+ -+ if (!skip) -+ walk_wild_consider_section (ptr, file, s, wildsec1, callback, -+ data); -+ } -+ } -+} -+ -+static void -+walk_wild_section_specs3_wild2 (lang_wild_statement_type *ptr, -+ lang_input_statement_type *file, -+ callback_t callback, -+ void *data) -+{ -+ asection *s; -+ struct wildcard_list *sec0 = ptr->handler_data[0]; -+ struct wildcard_list *wildsec1 = ptr->handler_data[1]; -+ struct wildcard_list *wildsec2 = ptr->handler_data[2]; -+ bfd_boolean multiple_sections_found; -+ asection *s0 = find_section (file, sec0, &multiple_sections_found); -+ -+ if (multiple_sections_found) -+ { -+ walk_wild_section_general (ptr, file, callback, data); -+ return; -+ } -+ -+ for (s = file->the_bfd->sections; s != NULL; s = s->next) -+ { -+ if (s == s0) -+ walk_wild_consider_section (ptr, file, s, sec0, callback, data); -+ else -+ { -+ const char *sname = bfd_get_section_name (file->the_bfd, s); -+ bfd_boolean skip = !match_simple_wild (wildsec1->spec.name, sname); -+ -+ if (!skip) -+ walk_wild_consider_section (ptr, file, s, wildsec1, callback, data); -+ else -+ { -+ skip = !match_simple_wild (wildsec2->spec.name, sname); -+ if (!skip) -+ walk_wild_consider_section (ptr, file, s, wildsec2, callback, -+ data); -+ } -+ } -+ } -+} -+ -+static void -+walk_wild_section_specs4_wild2 (lang_wild_statement_type *ptr, -+ lang_input_statement_type *file, -+ callback_t callback, -+ void *data) -+{ -+ asection *s; -+ struct wildcard_list *sec0 = ptr->handler_data[0]; -+ struct wildcard_list *sec1 = ptr->handler_data[1]; -+ struct wildcard_list *wildsec2 = ptr->handler_data[2]; -+ struct wildcard_list *wildsec3 = ptr->handler_data[3]; -+ bfd_boolean multiple_sections_found; -+ asection *s0 = find_section (file, sec0, &multiple_sections_found), *s1; -+ -+ if (multiple_sections_found) -+ { -+ walk_wild_section_general (ptr, file, callback, data); -+ return; -+ } -+ -+ s1 = find_section (file, sec1, &multiple_sections_found); -+ if (multiple_sections_found) -+ { -+ walk_wild_section_general (ptr, file, callback, data); -+ return; -+ } -+ -+ for (s = file->the_bfd->sections; s != NULL; s = s->next) -+ { -+ if (s == s0) -+ walk_wild_consider_section (ptr, file, s, sec0, callback, data); -+ else -+ if (s == s1) -+ walk_wild_consider_section (ptr, file, s, sec1, callback, data); -+ else -+ { -+ const char *sname = bfd_get_section_name (file->the_bfd, s); -+ bfd_boolean skip = !match_simple_wild (wildsec2->spec.name, -+ sname); -+ -+ if (!skip) -+ walk_wild_consider_section (ptr, file, s, wildsec2, callback, -+ data); -+ else -+ { -+ skip = !match_simple_wild (wildsec3->spec.name, sname); -+ if (!skip) -+ walk_wild_consider_section (ptr, file, s, wildsec3, -+ callback, data); -+ } -+ } -+ } -+} -+ -+static void -+walk_wild_section (lang_wild_statement_type *ptr, -+ lang_input_statement_type *file, -+ callback_t callback, -+ void *data) -+{ -+ if (file->just_syms_flag) -+ return; -+ -+ (*ptr->walk_wild_section_handler) (ptr, file, callback, data); -+} -+ -+/* Returns TRUE when name1 is a wildcard spec that might match -+ something name2 can match. We're conservative: we return FALSE -+ only if the prefixes of name1 and name2 are different up to the -+ first wildcard character. */ -+ -+static bfd_boolean -+wild_spec_can_overlap (const char *name1, const char *name2) -+{ -+ size_t prefix1_len = strcspn (name1, "?*["); -+ size_t prefix2_len = strcspn (name2, "?*["); -+ size_t min_prefix_len; -+ -+ /* Note that if there is no wildcard character, then we treat the -+ terminating 0 as part of the prefix. Thus ".text" won't match -+ ".text." or ".text.*", for example. */ -+ if (name1[prefix1_len] == '\0') -+ prefix1_len++; -+ if (name2[prefix2_len] == '\0') -+ prefix2_len++; -+ -+ min_prefix_len = prefix1_len < prefix2_len ? prefix1_len : prefix2_len; -+ -+ return memcmp (name1, name2, min_prefix_len) == 0; -+} -+ -+/* Select specialized code to handle various kinds of wildcard -+ statements. */ -+ -+static void -+analyze_walk_wild_section_handler (lang_wild_statement_type *ptr) -+{ -+ int sec_count = 0; -+ int wild_name_count = 0; -+ struct wildcard_list *sec; -+ int signature; -+ int data_counter; -+ -+ ptr->walk_wild_section_handler = walk_wild_section_general; -+ -+ /* Count how many wildcard_specs there are, and how many of those -+ actually use wildcards in the name. Also, bail out if any of the -+ wildcard names are NULL. (Can this actually happen? -+ walk_wild_section used to test for it.) And bail out if any -+ of the wildcards are more complex than a simple string -+ ending in a single '*'. */ -+ for (sec = ptr->section_list; sec != NULL; sec = sec->next) -+ { -+ ++sec_count; -+ if (sec->spec.name == NULL) -+ return; -+ if (wildcardp (sec->spec.name)) -+ { -+ ++wild_name_count; -+ if (!is_simple_wild (sec->spec.name)) -+ return; -+ } -+ } -+ -+ /* The zero-spec case would be easy to optimize but it doesn't -+ happen in practice. Likewise, more than 4 specs doesn't -+ happen in practice. */ -+ if (sec_count == 0 || sec_count > 4) -+ return; -+ -+ /* Check that no two specs can match the same section. */ -+ for (sec = ptr->section_list; sec != NULL; sec = sec->next) -+ { -+ struct wildcard_list *sec2; -+ for (sec2 = sec->next; sec2 != NULL; sec2 = sec2->next) -+ { -+ if (wild_spec_can_overlap (sec->spec.name, sec2->spec.name)) -+ return; -+ } -+ } -+ -+ signature = (sec_count << 8) + wild_name_count; -+ switch (signature) -+ { -+ case 0x0100: -+ ptr->walk_wild_section_handler = walk_wild_section_specs1_wild0; -+ break; -+ case 0x0101: -+ ptr->walk_wild_section_handler = walk_wild_section_specs1_wild1; -+ break; -+ case 0x0201: -+ ptr->walk_wild_section_handler = walk_wild_section_specs2_wild1; -+ break; -+ case 0x0302: -+ ptr->walk_wild_section_handler = walk_wild_section_specs3_wild2; -+ break; -+ case 0x0402: -+ ptr->walk_wild_section_handler = walk_wild_section_specs4_wild2; -+ break; -+ default: -+ return; -+ } -+ -+ /* Now fill the data array with pointers to the specs, first the -+ specs with non-wildcard names, then the specs with wildcard -+ names. It's OK to process the specs in different order from the -+ given order, because we've already determined that no section -+ will match more than one spec. */ -+ data_counter = 0; -+ for (sec = ptr->section_list; sec != NULL; sec = sec->next) -+ if (!wildcardp (sec->spec.name)) -+ ptr->handler_data[data_counter++] = sec; -+ for (sec = ptr->section_list; sec != NULL; sec = sec->next) -+ if (wildcardp (sec->spec.name)) -+ ptr->handler_data[data_counter++] = sec; -+} -+ - /* Handle a wild statement for a single file F. */ - - static void -@@ -4353,6 +4737,7 @@ - new->section_list = section_list; - new->keep_sections = keep_sections; - lang_list_init (&new->children); -+ analyze_walk_wild_section_handler (new); - } - - void ---- binutils-2.15/ld/ldlang.h.old 2004-05-17 15:36:16.000000000 -0400 -+++ binutils-2.15/ld/ldlang.h 2006-01-23 13:32:33.653292000 -0500 -@@ -295,7 +295,17 @@ - union lang_statement_union *file; - } lang_afile_asection_pair_statement_type; - --typedef struct lang_wild_statement_struct -+typedef struct lang_wild_statement_struct lang_wild_statement_type; -+ -+typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *, -+ asection *, lang_input_statement_type *, void *); -+ -+typedef void (*walk_wild_section_handler_t) (lang_wild_statement_type *, -+ lang_input_statement_type *, -+ callback_t callback, -+ void *data); -+ -+struct lang_wild_statement_struct - { - lang_statement_header_type header; - const char *filename; -@@ -303,7 +313,10 @@ - struct wildcard_list *section_list; - bfd_boolean keep_sections; - lang_statement_list_type children; --} lang_wild_statement_type; -+ -+ walk_wild_section_handler_t walk_wild_section_handler; -+ struct wildcard_list *handler_data[4]; -+}; - - typedef struct lang_address_statement_struct - { diff --git a/patches/binutils/2.15/800-ld-stabs-tweak.patch b/patches/binutils/2.15/800-ld-stabs-tweak.patch deleted file mode 100644 index bd6ae7a..0000000 --- a/patches/binutils/2.15/800-ld-stabs-tweak.patch +++ /dev/null @@ -1,33 +0,0 @@ -Signed-off-by: dank@kegel.com - -See http://sourceware.org/ml/binutils/2005-12/msg00270.html -http://sourceware.org/ml/binutils-cvs/2005-12/msg00139.html - -STABS hash table size change, backported from the binutils CVS tree. Here's -the CVS log comment for the original change: - -revision 1.25 -date: 2005/12/29 10:29:23; author: nickc; state: Exp; lines: +2 -3 -(_bfd_link_section_stabs): Use bfd_hash_table_init rather than -bfd_hash_table_init_n(...,251) so that the size of the hash table can be -controlled by the user. - -Note that tunable hash table size changes were added after 2.15. The effect -of this change is to make bfd use its default hash table size for the stabs -hash as well. - - ---- binutils-2.15/bfd/stabs.c.old 2004-05-17 15:36:04.000000000 -0400 -+++ binutils-2.15/bfd/stabs.c 2006-02-09 15:21:56.567014000 -0500 -@@ -241,9 +241,8 @@ - goto error_return; - /* Make sure the first byte is zero. */ - (void) _bfd_stringtab_add (sinfo->strings, "", TRUE, TRUE); -- if (! bfd_hash_table_init_n (&sinfo->includes.root, -- stab_link_includes_newfunc, -- 251)) -+ if (! bfd_hash_table_init (&sinfo->includes.root, -+ stab_link_includes_newfunc)) - goto error_return; - sinfo->stabstr = bfd_make_section_anyway (abfd, ".stabstr"); - sinfo->stabstr->flags |= SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING; diff --git a/patches/binutils/2.15/810-s390-invalid-insn-format.patch b/patches/binutils/2.15/810-s390-invalid-insn-format.patch deleted file mode 100644 index 3296201..0000000 --- a/patches/binutils/2.15/810-s390-invalid-insn-format.patch +++ /dev/null @@ -1,42 +0,0 @@ -Message-ID: <000801c48f60$cec16630$9103a8c0@ULOC5012> -From: "Michael Geiger" -To: -Subject: Patch for cross compiling s/390 kernel on linux host -Date: Tue, 31 Aug 2004 15:45:41 +0200 - -Dear Dan, - -I had big problems compiling a kernel for s/390 on my linux host - I tried -different chains from crosstool-0.28-rc34 and finally succeded with -gcc-3.3.4-glibc-2.3.2 after applying another patch to binutils-2.15 -(attached). -All compilations of the different kernel versions I tried stopped with -"Invalid .insn format" somewhere. I checked the recent cvs version of -binutils and applied the latest diff to gas/config/tc-s390.c and that solved -it. - -Greetings - -Michael Geiger - - -diff -u -r1.39 -r1.40 ---- src/gas/config/tc-s390.c 2004/05/06 11:01:48 1.39 -+++ src/gas/config/tc-s390.c 2004/06/15 12:38:08 1.40 -@@ -1596,13 +1596,13 @@ - if (exp.X_op == O_constant) - { - if ( ( opformat->oplen == 6 -- && exp.X_add_number >= 0 -+ && (addressT) exp.X_add_number >= 0 - && (addressT) exp.X_add_number < (1ULL << 48)) - || ( opformat->oplen == 4 -- && exp.X_add_number >= 0 -+ && (addressT) exp.X_add_number >= 0 - && (addressT) exp.X_add_number < (1ULL << 32)) - || ( opformat->oplen == 2 -- && exp.X_add_number >= 0 -+ && (addressT) exp.X_add_number >= 0 - && (addressT) exp.X_add_number < (1ULL << 16))) - md_number_to_chars (insn, exp.X_add_number, opformat->oplen); - else diff --git a/patches/binutils/2.17/130-ld_makefile_patch.patch b/patches/binutils/2.17/130-ld_makefile_patch.patch new file mode 100644 index 0000000..b40ec67 --- /dev/null +++ b/patches/binutils/2.17/130-ld_makefile_patch.patch @@ -0,0 +1,24 @@ +diff -dur binutils-2.17.old/ld/Makefile.am binutils-2.17/ld/Makefile.am +--- binutils-2.17.old/ld/Makefile.am 2006-06-03 06:45:50.000000000 +0200 ++++ binutils-2.17/ld/Makefile.am 2007-05-01 18:26:09.000000000 +0200 +@@ -20,7 +20,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ +diff -dur binutils-2.17.old/ld/Makefile.in binutils-2.17/ld/Makefile.in +--- binutils-2.17.old/ld/Makefile.in 2006-06-03 06:45:50.000000000 +0200 ++++ binutils-2.17/ld/Makefile.in 2007-05-01 18:26:09.000000000 +0200 +@@ -269,7 +269,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + BASEDIR = $(srcdir)/.. + BFDDIR = $(BASEDIR)/bfd + INCDIR = $(BASEDIR)/include diff --git a/patches/binutils/2.17/140-better_file_error.patch b/patches/binutils/2.17/140-better_file_error.patch new file mode 100644 index 0000000..7900f17 --- /dev/null +++ b/patches/binutils/2.17/140-better_file_error.patch @@ -0,0 +1,17 @@ +diff -dur binutils-2.17.old/bfd/opncls.c binutils-2.17/bfd/opncls.c +--- binutils-2.17.old/bfd/opncls.c 2006-03-16 13:20:16.000000000 +0100 ++++ binutils-2.17/bfd/opncls.c 2007-05-01 18:26:11.000000000 +0200 +@@ -158,6 +158,13 @@ + { + bfd *nbfd; + const bfd_target *target_vec; ++ struct stat s; ++ ++ if (stat (filename, &s) == 0) ++ if (S_ISDIR(s.st_mode)) { ++ bfd_set_error (bfd_error_file_not_recognized); ++ return NULL; ++ } + + nbfd = _bfd_new_bfd (); + if (nbfd == NULL) diff --git a/patches/binutils/2.17/150-check_ldrunpath_length.patch b/patches/binutils/2.17/150-check_ldrunpath_length.patch new file mode 100644 index 0000000..7c24796 --- /dev/null +++ b/patches/binutils/2.17/150-check_ldrunpath_length.patch @@ -0,0 +1,21 @@ +diff -dur binutils-2.17.old/ld/emultempl/elf32.em binutils-2.17/ld/emultempl/elf32.em +--- binutils-2.17.old/ld/emultempl/elf32.em 2006-06-12 15:05:04.000000000 +0200 ++++ binutils-2.17/ld/emultempl/elf32.em 2007-05-01 18:26:13.000000000 +0200 +@@ -970,6 +970,8 @@ + && command_line.rpath == NULL) + { + lib_path = (const char *) getenv ("LD_RUN_PATH"); ++ if ((lib_path) && (strlen (lib_path) == 0)) ++ lib_path = NULL; + if (gld${EMULATION_NAME}_search_needed (lib_path, &n, + force)) + break; +@@ -1154,6 +1156,8 @@ + rpath = command_line.rpath; + if (rpath == NULL) + rpath = (const char *) getenv ("LD_RUN_PATH"); ++ if ((rpath) && (strlen (rpath) == 0)) ++ rpath = NULL; + if (! (bfd_elf_size_dynamic_sections + (output_bfd, command_line.soname, rpath, + command_line.filter_shlib, diff --git a/patches/binutils/2.17/160-mips-ELF_MAXPAGESIZE-4K.patch b/patches/binutils/2.17/160-mips-ELF_MAXPAGESIZE-4K.patch new file mode 100644 index 0000000..0a4980b --- /dev/null +++ b/patches/binutils/2.17/160-mips-ELF_MAXPAGESIZE-4K.patch @@ -0,0 +1,28 @@ +diff -dur binutils-2.17.old/bfd/elf32-mips.c binutils-2.17/bfd/elf32-mips.c +--- binutils-2.17.old/bfd/elf32-mips.c 2006-03-22 10:28:13.000000000 +0100 ++++ binutils-2.17/bfd/elf32-mips.c 2007-05-01 18:26:15.000000000 +0200 +@@ -1617,7 +1617,9 @@ + + /* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses + page sizes of up to that limit, so we need to respect it. */ +-#define ELF_MAXPAGESIZE 0x10000 ++/*#define ELF_MAXPAGESIZE 0x10000*/ ++/* Use 4K to shrink the elf header. NOT for general use! */ ++#define ELF_MAXPAGESIZE 0x1000 + #define elf32_bed elf32_tradbed + + /* Include the target file again for this target. */ +diff -dur binutils-2.17.old/bfd/elfn32-mips.c binutils-2.17/bfd/elfn32-mips.c +--- binutils-2.17.old/bfd/elfn32-mips.c 2005-11-23 15:04:17.000000000 +0100 ++++ binutils-2.17/bfd/elfn32-mips.c 2007-05-01 18:26:15.000000000 +0200 +@@ -2402,7 +2402,9 @@ + + /* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses + page sizes of up to that limit, so we need to respect it. */ +-#define ELF_MAXPAGESIZE 0x10000 ++/*#define ELF_MAXPAGESIZE 0x10000*/ ++/* Use 4K to shrink the elf header. NOT for general use! */ ++#define ELF_MAXPAGESIZE 0x1000 + #define elf32_bed elf32_tradbed + + /* Include the target file again for this target. */ diff --git a/patches/binutils/2.17/170-bfd-hash-tweak.patch b/patches/binutils/2.17/170-bfd-hash-tweak.patch new file mode 100644 index 0000000..c878282 --- /dev/null +++ b/patches/binutils/2.17/170-bfd-hash-tweak.patch @@ -0,0 +1,23 @@ +Signed-off-by: dank@kegel.com + +Raising the size of the hash table is a noticable win when linking +at least one large app. + +There was a patch, +http://sources.redhat.com/ml/binutils/2004-06/msg00165.html +to do this dynamically. No idea why that didn't make it in. +So this tiny change to raise the default size is just +a stopgap for now. + + +--- binutils-2.17/bfd/hash.c.old 2006-03-02 23:01:39.000000000 -0800 ++++ binutils-2.17/bfd/hash.c 2006-03-02 23:01:58.000000000 -0800 +@@ -298,7 +298,7 @@ + */ + + /* The default number of entries to use when creating a hash table. */ +-#define DEFAULT_SIZE 4051 ++#define DEFAULT_SIZE 32749 + static size_t bfd_default_hash_table_size = DEFAULT_SIZE; + + /* Create a new hash table, given a number of entries. */ diff --git a/patches/binutils/2.17/180-psignal.patch b/patches/binutils/2.17/180-psignal.patch new file mode 100644 index 0000000..2506ff2 --- /dev/null +++ b/patches/binutils/2.17/180-psignal.patch @@ -0,0 +1,29 @@ +Make psignal prototype in libiberty match that in glibc. + +Fixes: + +gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c: In function `psignal': +gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `signo' doesn't match prototype +/usr/include/signal.h:131: prototype declaration +gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `message' doesn't match prototype +/usr/include/signal.h:131: prototype declaration +gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:568: warning: comparison between signed and unsigned +mprotect... make[1]: *** [strsignal.o] Error 1 +make[1]: Leaving directory `/export/hda3/dkegel/queue/jobdir.produser_cpsm17/crosstool-0.32/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.1.3/build-binutils/libiberty' +make: *** [all-libiberty] Error 2 + +when building on red hat 7.1 +though it's a bit of a mystery why libiberty's psignal is being compiled at +all, since red hat 7.1's glibc supports psignal (hence the error message) + +--- binutils-2.17/libiberty/strsignal.c.old 2005-04-18 13:57:40.000000000 -0700 ++++ binutils-2.17/libiberty/strsignal.c 2005-04-18 13:59:09.000000000 -0700 +@@ -536,7 +536,7 @@ + + /* + +-@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message}) ++@deftypefn Supplemental void psignal (int @var{signo}, const char *@var{message}) + + Print @var{message} to the standard error, followed by a colon, + followed by the description of the signal specified by @var{signo}, diff --git a/patches/binutils/2.17/190-skip-comments.patch b/patches/binutils/2.17/190-skip-comments.patch new file mode 100644 index 0000000..df49ad3 --- /dev/null +++ b/patches/binutils/2.17/190-skip-comments.patch @@ -0,0 +1,95 @@ +[removed first hunk so it would apply to 2.16.1 - copyright date already updated - dank] + +Retrieved from http://sources.redhat.com/ml/binutils/2004-04/msg00646.html +Fixes +localealias.s:544: Error: junk at end of line, first unrecognized character is `,' +when building glibc-2.3.2 with gcc-3.4.0 and binutils-2.15.90.0.3 + +Paths adjusted to match crosstool's patcher. + +Message-Id: m3n052qw2g.fsf@whitebox.m5r.de +From: Andreas Schwab +To: Nathan Sidwell +Cc: Ian Lance Taylor , binutils at sources dot redhat dot com +Date: Fri, 23 Apr 2004 22:27:19 +0200 +Subject: Re: demand_empty_rest_of_line and ignore_rest_of_line + +Nathan Sidwell writes: + +> Index: read.c +> =================================================================== +> RCS file: /cvs/src/src/gas/read.c,v +> retrieving revision 1.76 +> diff -c -3 -p -r1.76 read.c +> *** read.c 12 Mar 2004 17:48:12 -0000 1.76 +> --- read.c 18 Mar 2004 09:56:05 -0000 +> *************** read_a_source_file (char *name) +> *** 1053,1059 **** +> #endif +> input_line_pointer--; +> /* Report unknown char as ignored. */ +> ! ignore_rest_of_line (); +> } +> +> #ifdef md_after_pass_hook +> --- 1053,1059 ---- +> #endif +> input_line_pointer--; +> /* Report unknown char as ignored. */ +> ! demand_empty_rest_of_line (); +> } +> +> #ifdef md_after_pass_hook + +This means that the unknown character is no longer ignored, despite the +comment. As a side effect a line starting with a line comment character +not followed by APP in NO_APP mode now triggers an error instead of just a +warning, breaking builds of glibc on m68k-linux. Earlier in +read_a_source_file where #APP is handled there is another comment that +claims that unknown comments are ignored, when in fact they aren't (only +the initial line comment character is skipped). + +Note that the presence of #APP will mess up the line counters, but +that appears to be difficult to fix. + +Andreas. + +2004-04-23 Andreas Schwab + + * read.c (read_a_source_file): Ignore unknown text after line + comment character. Fix misleading comment. + +--- binutils/gas/read.c.~1.78.~ 2004-04-23 08:58:23.000000000 +0200 ++++ binutils/gas/read.c 2004-04-23 21:49:01.000000000 +0200 +@@ -1008,10 +1008,14 @@ read_a_source_file (char *name) + unsigned int new_length; + char *tmp_buf = 0; + +- bump_line_counters (); + s = input_line_pointer; + if (strncmp (s, "APP\n", 4)) +- continue; /* We ignore it */ ++ { ++ /* We ignore it */ ++ ignore_rest_of_line (); ++ continue; ++ } ++ bump_line_counters (); + s += 4; + + sb_new (&sbuf); +@@ -1110,7 +1110,7 @@ read_a_source_file (char *name) + continue; + #endif + input_line_pointer--; +- /* Report unknown char as ignored. */ ++ /* Report unknown char as error. */ + demand_empty_rest_of_line (); + } + + +-- +Andreas Schwab, SuSE Labs, schwab@suse.de +SuSE Linux AG, MaxfeldstraÃe 5, 90409 NÃrnberg, Germany +Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 +"And now for something completely different." diff --git a/patches/binutils/2.17/200-cross-gprof.patch b/patches/binutils/2.17/200-cross-gprof.patch new file mode 100644 index 0000000..eda79b3 --- /dev/null +++ b/patches/binutils/2.17/200-cross-gprof.patch @@ -0,0 +1,22 @@ +--- binutils-2.17/configure.old 2004-07-21 21:36:47.000000000 -0700 ++++ binutils-2.17/configure 2004-07-21 21:37:08.000000000 -0700 +@@ -1022,7 +1022,7 @@ + + # Some tools are only suitable for building in a "native" situation. + # Remove these if host!=target. +-native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf" ++native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf" + + # Similarly, some are only suitable for cross toolchains. + # Remove these if host=target. +--- binutils-2.17/configure.in.old 2004-07-21 21:37:19.000000000 -0700 ++++ binutils-2.17/configure.in 2004-07-21 21:37:34.000000000 -0700 +@@ -227,7 +227,7 @@ + + # Some tools are only suitable for building in a "native" situation. + # Remove these if host!=target. +-native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf" ++native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf" + + # Similarly, some are only suitable for cross toolchains. + # Remove these if host=target. diff --git a/patches/binutils/2.17/300-ld_makefile_patch.patch b/patches/binutils/2.17/300-ld_makefile_patch.patch deleted file mode 100644 index b40ec67..0000000 --- a/patches/binutils/2.17/300-ld_makefile_patch.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -dur binutils-2.17.old/ld/Makefile.am binutils-2.17/ld/Makefile.am ---- binutils-2.17.old/ld/Makefile.am 2006-06-03 06:45:50.000000000 +0200 -+++ binutils-2.17/ld/Makefile.am 2007-05-01 18:26:09.000000000 +0200 -@@ -20,7 +20,7 @@ - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - - EMUL = @EMUL@ - EMULATION_OFILES = @EMULATION_OFILES@ -diff -dur binutils-2.17.old/ld/Makefile.in binutils-2.17/ld/Makefile.in ---- binutils-2.17.old/ld/Makefile.in 2006-06-03 06:45:50.000000000 +0200 -+++ binutils-2.17/ld/Makefile.in 2007-05-01 18:26:09.000000000 +0200 -@@ -269,7 +269,7 @@ - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - BASEDIR = $(srcdir)/.. - BFDDIR = $(BASEDIR)/bfd - INCDIR = $(BASEDIR)/include diff --git a/patches/binutils/2.17/301-better_file_error.patch b/patches/binutils/2.17/301-better_file_error.patch deleted file mode 100644 index 7900f17..0000000 --- a/patches/binutils/2.17/301-better_file_error.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -dur binutils-2.17.old/bfd/opncls.c binutils-2.17/bfd/opncls.c ---- binutils-2.17.old/bfd/opncls.c 2006-03-16 13:20:16.000000000 +0100 -+++ binutils-2.17/bfd/opncls.c 2007-05-01 18:26:11.000000000 +0200 -@@ -158,6 +158,13 @@ - { - bfd *nbfd; - const bfd_target *target_vec; -+ struct stat s; -+ -+ if (stat (filename, &s) == 0) -+ if (S_ISDIR(s.st_mode)) { -+ bfd_set_error (bfd_error_file_not_recognized); -+ return NULL; -+ } - - nbfd = _bfd_new_bfd (); - if (nbfd == NULL) diff --git a/patches/binutils/2.17/302-check_ldrunpath_length.patch b/patches/binutils/2.17/302-check_ldrunpath_length.patch deleted file mode 100644 index 7c24796..0000000 --- a/patches/binutils/2.17/302-check_ldrunpath_length.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -dur binutils-2.17.old/ld/emultempl/elf32.em binutils-2.17/ld/emultempl/elf32.em ---- binutils-2.17.old/ld/emultempl/elf32.em 2006-06-12 15:05:04.000000000 +0200 -+++ binutils-2.17/ld/emultempl/elf32.em 2007-05-01 18:26:13.000000000 +0200 -@@ -970,6 +970,8 @@ - && command_line.rpath == NULL) - { - lib_path = (const char *) getenv ("LD_RUN_PATH"); -+ if ((lib_path) && (strlen (lib_path) == 0)) -+ lib_path = NULL; - if (gld${EMULATION_NAME}_search_needed (lib_path, &n, - force)) - break; -@@ -1154,6 +1156,8 @@ - rpath = command_line.rpath; - if (rpath == NULL) - rpath = (const char *) getenv ("LD_RUN_PATH"); -+ if ((rpath) && (strlen (rpath) == 0)) -+ rpath = NULL; - if (! (bfd_elf_size_dynamic_sections - (output_bfd, command_line.soname, rpath, - command_line.filter_shlib, diff --git a/patches/binutils/2.17/400-mips-ELF_MAXPAGESIZE-4K.patch b/patches/binutils/2.17/400-mips-ELF_MAXPAGESIZE-4K.patch deleted file mode 100644 index 0a4980b..0000000 --- a/patches/binutils/2.17/400-mips-ELF_MAXPAGESIZE-4K.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff -dur binutils-2.17.old/bfd/elf32-mips.c binutils-2.17/bfd/elf32-mips.c ---- binutils-2.17.old/bfd/elf32-mips.c 2006-03-22 10:28:13.000000000 +0100 -+++ binutils-2.17/bfd/elf32-mips.c 2007-05-01 18:26:15.000000000 +0200 -@@ -1617,7 +1617,9 @@ - - /* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses - page sizes of up to that limit, so we need to respect it. */ --#define ELF_MAXPAGESIZE 0x10000 -+/*#define ELF_MAXPAGESIZE 0x10000*/ -+/* Use 4K to shrink the elf header. NOT for general use! */ -+#define ELF_MAXPAGESIZE 0x1000 - #define elf32_bed elf32_tradbed - - /* Include the target file again for this target. */ -diff -dur binutils-2.17.old/bfd/elfn32-mips.c binutils-2.17/bfd/elfn32-mips.c ---- binutils-2.17.old/bfd/elfn32-mips.c 2005-11-23 15:04:17.000000000 +0100 -+++ binutils-2.17/bfd/elfn32-mips.c 2007-05-01 18:26:15.000000000 +0200 -@@ -2402,7 +2402,9 @@ - - /* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses - page sizes of up to that limit, so we need to respect it. */ --#define ELF_MAXPAGESIZE 0x10000 -+/*#define ELF_MAXPAGESIZE 0x10000*/ -+/* Use 4K to shrink the elf header. NOT for general use! */ -+#define ELF_MAXPAGESIZE 0x1000 - #define elf32_bed elf32_tradbed - - /* Include the target file again for this target. */ diff --git a/patches/binutils/2.17/500-bfd-hash-tweak.patch b/patches/binutils/2.17/500-bfd-hash-tweak.patch deleted file mode 100644 index c878282..0000000 --- a/patches/binutils/2.17/500-bfd-hash-tweak.patch +++ /dev/null @@ -1,23 +0,0 @@ -Signed-off-by: dank@kegel.com - -Raising the size of the hash table is a noticable win when linking -at least one large app. - -There was a patch, -http://sources.redhat.com/ml/binutils/2004-06/msg00165.html -to do this dynamically. No idea why that didn't make it in. -So this tiny change to raise the default size is just -a stopgap for now. - - ---- binutils-2.17/bfd/hash.c.old 2006-03-02 23:01:39.000000000 -0800 -+++ binutils-2.17/bfd/hash.c 2006-03-02 23:01:58.000000000 -0800 -@@ -298,7 +298,7 @@ - */ - - /* The default number of entries to use when creating a hash table. */ --#define DEFAULT_SIZE 4051 -+#define DEFAULT_SIZE 32749 - static size_t bfd_default_hash_table_size = DEFAULT_SIZE; - - /* Create a new hash table, given a number of entries. */ diff --git a/patches/binutils/2.17/501-psignal.patch b/patches/binutils/2.17/501-psignal.patch deleted file mode 100644 index 2506ff2..0000000 --- a/patches/binutils/2.17/501-psignal.patch +++ /dev/null @@ -1,29 +0,0 @@ -Make psignal prototype in libiberty match that in glibc. - -Fixes: - -gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c: In function `psignal': -gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `signo' doesn't match prototype -/usr/include/signal.h:131: prototype declaration -gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:563: argument `message' doesn't match prototype -/usr/include/signal.h:131: prototype declaration -gcc-2.95.3-glibc-2.1.3/binutils-2.15/libiberty/strsignal.c:568: warning: comparison between signed and unsigned -mprotect... make[1]: *** [strsignal.o] Error 1 -make[1]: Leaving directory `/export/hda3/dkegel/queue/jobdir.produser_cpsm17/crosstool-0.32/build/i686-unknown-linux-gnu/gcc-2.95.3-glibc-2.1.3/build-binutils/libiberty' -make: *** [all-libiberty] Error 2 - -when building on red hat 7.1 -though it's a bit of a mystery why libiberty's psignal is being compiled at -all, since red hat 7.1's glibc supports psignal (hence the error message) - ---- binutils-2.17/libiberty/strsignal.c.old 2005-04-18 13:57:40.000000000 -0700 -+++ binutils-2.17/libiberty/strsignal.c 2005-04-18 13:59:09.000000000 -0700 -@@ -536,7 +536,7 @@ - - /* - --@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message}) -+@deftypefn Supplemental void psignal (int @var{signo}, const char *@var{message}) - - Print @var{message} to the standard error, followed by a colon, - followed by the description of the signal specified by @var{signo}, diff --git a/patches/binutils/2.17/502-skip-comments.patch b/patches/binutils/2.17/502-skip-comments.patch deleted file mode 100644 index df49ad3..0000000 --- a/patches/binutils/2.17/502-skip-comments.patch +++ /dev/null @@ -1,95 +0,0 @@ -[removed first hunk so it would apply to 2.16.1 - copyright date already updated - dank] - -Retrieved from http://sources.redhat.com/ml/binutils/2004-04/msg00646.html -Fixes -localealias.s:544: Error: junk at end of line, first unrecognized character is `,' -when building glibc-2.3.2 with gcc-3.4.0 and binutils-2.15.90.0.3 - -Paths adjusted to match crosstool's patcher. - -Message-Id: m3n052qw2g.fsf@whitebox.m5r.de -From: Andreas Schwab -To: Nathan Sidwell -Cc: Ian Lance Taylor , binutils at sources dot redhat dot com -Date: Fri, 23 Apr 2004 22:27:19 +0200 -Subject: Re: demand_empty_rest_of_line and ignore_rest_of_line - -Nathan Sidwell writes: - -> Index: read.c -> =================================================================== -> RCS file: /cvs/src/src/gas/read.c,v -> retrieving revision 1.76 -> diff -c -3 -p -r1.76 read.c -> *** read.c 12 Mar 2004 17:48:12 -0000 1.76 -> --- read.c 18 Mar 2004 09:56:05 -0000 -> *************** read_a_source_file (char *name) -> *** 1053,1059 **** -> #endif -> input_line_pointer--; -> /* Report unknown char as ignored. */ -> ! ignore_rest_of_line (); -> } -> -> #ifdef md_after_pass_hook -> --- 1053,1059 ---- -> #endif -> input_line_pointer--; -> /* Report unknown char as ignored. */ -> ! demand_empty_rest_of_line (); -> } -> -> #ifdef md_after_pass_hook - -This means that the unknown character is no longer ignored, despite the -comment. As a side effect a line starting with a line comment character -not followed by APP in NO_APP mode now triggers an error instead of just a -warning, breaking builds of glibc on m68k-linux. Earlier in -read_a_source_file where #APP is handled there is another comment that -claims that unknown comments are ignored, when in fact they aren't (only -the initial line comment character is skipped). - -Note that the presence of #APP will mess up the line counters, but -that appears to be difficult to fix. - -Andreas. - -2004-04-23 Andreas Schwab - - * read.c (read_a_source_file): Ignore unknown text after line - comment character. Fix misleading comment. - ---- binutils/gas/read.c.~1.78.~ 2004-04-23 08:58:23.000000000 +0200 -+++ binutils/gas/read.c 2004-04-23 21:49:01.000000000 +0200 -@@ -1008,10 +1008,14 @@ read_a_source_file (char *name) - unsigned int new_length; - char *tmp_buf = 0; - -- bump_line_counters (); - s = input_line_pointer; - if (strncmp (s, "APP\n", 4)) -- continue; /* We ignore it */ -+ { -+ /* We ignore it */ -+ ignore_rest_of_line (); -+ continue; -+ } -+ bump_line_counters (); - s += 4; - - sb_new (&sbuf); -@@ -1110,7 +1110,7 @@ read_a_source_file (char *name) - continue; - #endif - input_line_pointer--; -- /* Report unknown char as ignored. */ -+ /* Report unknown char as error. */ - demand_empty_rest_of_line (); - } - - --- -Andreas Schwab, SuSE Labs, schwab@suse.de -SuSE Linux AG, MaxfeldstraÃe 5, 90409 NÃrnberg, Germany -Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 -"And now for something completely different." diff --git a/patches/binutils/2.17/503-cross-gprof.patch b/patches/binutils/2.17/503-cross-gprof.patch deleted file mode 100644 index eda79b3..0000000 --- a/patches/binutils/2.17/503-cross-gprof.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- binutils-2.17/configure.old 2004-07-21 21:36:47.000000000 -0700 -+++ binutils-2.17/configure 2004-07-21 21:37:08.000000000 -0700 -@@ -1022,7 +1022,7 @@ - - # Some tools are only suitable for building in a "native" situation. - # Remove these if host!=target. --native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf" -+native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf" - - # Similarly, some are only suitable for cross toolchains. - # Remove these if host=target. ---- binutils-2.17/configure.in.old 2004-07-21 21:37:19.000000000 -0700 -+++ binutils-2.17/configure.in 2004-07-21 21:37:34.000000000 -0700 -@@ -227,7 +227,7 @@ - - # Some tools are only suitable for building in a "native" situation. - # Remove these if host!=target. --native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf" -+native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf" - - # Similarly, some are only suitable for cross toolchains. - # Remove these if host=target. diff --git a/patches/binutils/2.18.50.0.4/110-ld-makefile-path.patch b/patches/binutils/2.18.50.0.4/110-ld-makefile-path.patch new file mode 100644 index 0000000..9eea2a1 --- /dev/null +++ b/patches/binutils/2.18.50.0.4/110-ld-makefile-path.patch @@ -0,0 +1,30 @@ +Fix ld scripts path, copied from buildroot. + + binutils-2.18.50.0.6/ld/Makefile.am | 2 1 1 0 +- + binutils-2.18.50.0.6/ld/Makefile.in | 2 1 1 0 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff -durN binutils-2.18.50.0.6.orig/ld/Makefile.am binutils-2.18.50.0.6/ld/Makefile.am +--- binutils-2.18.50.0.6.orig/ld/Makefile.am 2008-04-03 18:54:05.000000000 +0200 ++++ binutils-2.18.50.0.6/ld/Makefile.am 2008-05-02 23:25:14.000000000 +0200 +@@ -18,7 +18,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ +diff -durN binutils-2.18.50.0.6.orig/ld/Makefile.in binutils-2.18.50.0.6/ld/Makefile.in +--- binutils-2.18.50.0.6.orig/ld/Makefile.in 2008-04-03 18:54:05.000000000 +0200 ++++ binutils-2.18.50.0.6/ld/Makefile.in 2008-05-02 23:25:14.000000000 +0200 +@@ -288,7 +288,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + BASEDIR = $(srcdir)/.. + BFDDIR = $(BASEDIR)/bfd + INCDIR = $(BASEDIR)/include diff --git a/patches/binutils/2.18.50.0.4/120-check-ldrunpath-length.patch b/patches/binutils/2.18.50.0.4/120-check-ldrunpath-length.patch new file mode 100644 index 0000000..7b3e7e1 --- /dev/null +++ b/patches/binutils/2.18.50.0.4/120-check-ldrunpath-length.patch @@ -0,0 +1,26 @@ +Check LD_RUN_PATH length, copied from buildroot. + + binutils-2.18.50.0.6/ld/emultempl/elf32.em | 4 4 0 0 ++++ + 1 file changed, 4 insertions(+) + +diff -durN binutils-2.18.50.0.6.orig/ld/emultempl/elf32.em binutils-2.18.50.0.6/ld/emultempl/elf32.em +--- binutils-2.18.50.0.6.orig/ld/emultempl/elf32.em 2008-04-03 18:54:25.000000000 +0200 ++++ binutils-2.18.50.0.6/ld/emultempl/elf32.em 2008-05-02 23:30:08.000000000 +0200 +@@ -1220,6 +1220,8 @@ + && command_line.rpath == NULL) + { + lib_path = (const char *) getenv ("LD_RUN_PATH"); ++ if ((lib_path) && (strlen (lib_path) == 0)) ++ lib_path = NULL; + if (gld${EMULATION_NAME}_search_needed (lib_path, &n, + force)) + break; +@@ -1405,6 +1407,8 @@ + rpath = command_line.rpath; + if (rpath == NULL) + rpath = (const char *) getenv ("LD_RUN_PATH"); ++ if ((rpath) && (strlen (rpath) == 0)) ++ rpath = NULL; + if (! (bfd_elf_size_dynamic_sections + (link_info.output_bfd, command_line.soname, rpath, + command_line.filter_shlib, diff --git a/patches/binutils/2.18.50.0.4/200-ld-makefile-path.patch b/patches/binutils/2.18.50.0.4/200-ld-makefile-path.patch deleted file mode 100644 index 9eea2a1..0000000 --- a/patches/binutils/2.18.50.0.4/200-ld-makefile-path.patch +++ /dev/null @@ -1,30 +0,0 @@ -Fix ld scripts path, copied from buildroot. - - binutils-2.18.50.0.6/ld/Makefile.am | 2 1 1 0 +- - binutils-2.18.50.0.6/ld/Makefile.in | 2 1 1 0 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff -durN binutils-2.18.50.0.6.orig/ld/Makefile.am binutils-2.18.50.0.6/ld/Makefile.am ---- binutils-2.18.50.0.6.orig/ld/Makefile.am 2008-04-03 18:54:05.000000000 +0200 -+++ binutils-2.18.50.0.6/ld/Makefile.am 2008-05-02 23:25:14.000000000 +0200 -@@ -18,7 +18,7 @@ - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - - EMUL = @EMUL@ - EMULATION_OFILES = @EMULATION_OFILES@ -diff -durN binutils-2.18.50.0.6.orig/ld/Makefile.in binutils-2.18.50.0.6/ld/Makefile.in ---- binutils-2.18.50.0.6.orig/ld/Makefile.in 2008-04-03 18:54:05.000000000 +0200 -+++ binutils-2.18.50.0.6/ld/Makefile.in 2008-05-02 23:25:14.000000000 +0200 -@@ -288,7 +288,7 @@ - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - BASEDIR = $(srcdir)/.. - BFDDIR = $(BASEDIR)/bfd - INCDIR = $(BASEDIR)/include diff --git a/patches/binutils/2.18.50.0.4/300-check-ldrunpath-length.patch b/patches/binutils/2.18.50.0.4/300-check-ldrunpath-length.patch deleted file mode 100644 index 7b3e7e1..0000000 --- a/patches/binutils/2.18.50.0.4/300-check-ldrunpath-length.patch +++ /dev/null @@ -1,26 +0,0 @@ -Check LD_RUN_PATH length, copied from buildroot. - - binutils-2.18.50.0.6/ld/emultempl/elf32.em | 4 4 0 0 ++++ - 1 file changed, 4 insertions(+) - -diff -durN binutils-2.18.50.0.6.orig/ld/emultempl/elf32.em binutils-2.18.50.0.6/ld/emultempl/elf32.em ---- binutils-2.18.50.0.6.orig/ld/emultempl/elf32.em 2008-04-03 18:54:25.000000000 +0200 -+++ binutils-2.18.50.0.6/ld/emultempl/elf32.em 2008-05-02 23:30:08.000000000 +0200 -@@ -1220,6 +1220,8 @@ - && command_line.rpath == NULL) - { - lib_path = (const char *) getenv ("LD_RUN_PATH"); -+ if ((lib_path) && (strlen (lib_path) == 0)) -+ lib_path = NULL; - if (gld${EMULATION_NAME}_search_needed (lib_path, &n, - force)) - break; -@@ -1405,6 +1407,8 @@ - rpath = command_line.rpath; - if (rpath == NULL) - rpath = (const char *) getenv ("LD_RUN_PATH"); -+ if ((rpath) && (strlen (rpath) == 0)) -+ rpath = NULL; - if (! (bfd_elf_size_dynamic_sections - (link_info.output_bfd, command_line.soname, rpath, - command_line.filter_shlib, diff --git a/patches/binutils/2.18.50.0.6/110-ld-makefile-path.patch b/patches/binutils/2.18.50.0.6/110-ld-makefile-path.patch new file mode 100644 index 0000000..9eea2a1 --- /dev/null +++ b/patches/binutils/2.18.50.0.6/110-ld-makefile-path.patch @@ -0,0 +1,30 @@ +Fix ld scripts path, copied from buildroot. + + binutils-2.18.50.0.6/ld/Makefile.am | 2 1 1 0 +- + binutils-2.18.50.0.6/ld/Makefile.in | 2 1 1 0 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff -durN binutils-2.18.50.0.6.orig/ld/Makefile.am binutils-2.18.50.0.6/ld/Makefile.am +--- binutils-2.18.50.0.6.orig/ld/Makefile.am 2008-04-03 18:54:05.000000000 +0200 ++++ binutils-2.18.50.0.6/ld/Makefile.am 2008-05-02 23:25:14.000000000 +0200 +@@ -18,7 +18,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ +diff -durN binutils-2.18.50.0.6.orig/ld/Makefile.in binutils-2.18.50.0.6/ld/Makefile.in +--- binutils-2.18.50.0.6.orig/ld/Makefile.in 2008-04-03 18:54:05.000000000 +0200 ++++ binutils-2.18.50.0.6/ld/Makefile.in 2008-05-02 23:25:14.000000000 +0200 +@@ -288,7 +288,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + BASEDIR = $(srcdir)/.. + BFDDIR = $(BASEDIR)/bfd + INCDIR = $(BASEDIR)/include diff --git a/patches/binutils/2.18.50.0.6/120-check-ldrunpath-length.patch b/patches/binutils/2.18.50.0.6/120-check-ldrunpath-length.patch new file mode 100644 index 0000000..7b3e7e1 --- /dev/null +++ b/patches/binutils/2.18.50.0.6/120-check-ldrunpath-length.patch @@ -0,0 +1,26 @@ +Check LD_RUN_PATH length, copied from buildroot. + + binutils-2.18.50.0.6/ld/emultempl/elf32.em | 4 4 0 0 ++++ + 1 file changed, 4 insertions(+) + +diff -durN binutils-2.18.50.0.6.orig/ld/emultempl/elf32.em binutils-2.18.50.0.6/ld/emultempl/elf32.em +--- binutils-2.18.50.0.6.orig/ld/emultempl/elf32.em 2008-04-03 18:54:25.000000000 +0200 ++++ binutils-2.18.50.0.6/ld/emultempl/elf32.em 2008-05-02 23:30:08.000000000 +0200 +@@ -1220,6 +1220,8 @@ + && command_line.rpath == NULL) + { + lib_path = (const char *) getenv ("LD_RUN_PATH"); ++ if ((lib_path) && (strlen (lib_path) == 0)) ++ lib_path = NULL; + if (gld${EMULATION_NAME}_search_needed (lib_path, &n, + force)) + break; +@@ -1405,6 +1407,8 @@ + rpath = command_line.rpath; + if (rpath == NULL) + rpath = (const char *) getenv ("LD_RUN_PATH"); ++ if ((rpath) && (strlen (rpath) == 0)) ++ rpath = NULL; + if (! (bfd_elf_size_dynamic_sections + (link_info.output_bfd, command_line.soname, rpath, + command_line.filter_shlib, diff --git a/patches/binutils/2.18.50.0.6/200-ld-makefile-path.patch b/patches/binutils/2.18.50.0.6/200-ld-makefile-path.patch deleted file mode 100644 index 9eea2a1..0000000 --- a/patches/binutils/2.18.50.0.6/200-ld-makefile-path.patch +++ /dev/null @@ -1,30 +0,0 @@ -Fix ld scripts path, copied from buildroot. - - binutils-2.18.50.0.6/ld/Makefile.am | 2 1 1 0 +- - binutils-2.18.50.0.6/ld/Makefile.in | 2 1 1 0 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff -durN binutils-2.18.50.0.6.orig/ld/Makefile.am binutils-2.18.50.0.6/ld/Makefile.am ---- binutils-2.18.50.0.6.orig/ld/Makefile.am 2008-04-03 18:54:05.000000000 +0200 -+++ binutils-2.18.50.0.6/ld/Makefile.am 2008-05-02 23:25:14.000000000 +0200 -@@ -18,7 +18,7 @@ - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - - EMUL = @EMUL@ - EMULATION_OFILES = @EMULATION_OFILES@ -diff -durN binutils-2.18.50.0.6.orig/ld/Makefile.in binutils-2.18.50.0.6/ld/Makefile.in ---- binutils-2.18.50.0.6.orig/ld/Makefile.in 2008-04-03 18:54:05.000000000 +0200 -+++ binutils-2.18.50.0.6/ld/Makefile.in 2008-05-02 23:25:14.000000000 +0200 -@@ -288,7 +288,7 @@ - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - BASEDIR = $(srcdir)/.. - BFDDIR = $(BASEDIR)/bfd - INCDIR = $(BASEDIR)/include diff --git a/patches/binutils/2.18.50.0.6/300-check-ldrunpath-length.patch b/patches/binutils/2.18.50.0.6/300-check-ldrunpath-length.patch deleted file mode 100644 index 7b3e7e1..0000000 --- a/patches/binutils/2.18.50.0.6/300-check-ldrunpath-length.patch +++ /dev/null @@ -1,26 +0,0 @@ -Check LD_RUN_PATH length, copied from buildroot. - - binutils-2.18.50.0.6/ld/emultempl/elf32.em | 4 4 0 0 ++++ - 1 file changed, 4 insertions(+) - -diff -durN binutils-2.18.50.0.6.orig/ld/emultempl/elf32.em binutils-2.18.50.0.6/ld/emultempl/elf32.em ---- binutils-2.18.50.0.6.orig/ld/emultempl/elf32.em 2008-04-03 18:54:25.000000000 +0200 -+++ binutils-2.18.50.0.6/ld/emultempl/elf32.em 2008-05-02 23:30:08.000000000 +0200 -@@ -1220,6 +1220,8 @@ - && command_line.rpath == NULL) - { - lib_path = (const char *) getenv ("LD_RUN_PATH"); -+ if ((lib_path) && (strlen (lib_path) == 0)) -+ lib_path = NULL; - if (gld${EMULATION_NAME}_search_needed (lib_path, &n, - force)) - break; -@@ -1405,6 +1407,8 @@ - rpath = command_line.rpath; - if (rpath == NULL) - rpath = (const char *) getenv ("LD_RUN_PATH"); -+ if ((rpath) && (strlen (rpath) == 0)) -+ rpath = NULL; - if (! (bfd_elf_size_dynamic_sections - (link_info.output_bfd, command_line.soname, rpath, - command_line.filter_shlib, diff --git a/patches/binutils/2.18.50.0.7/110-ld-makefile-path.patch b/patches/binutils/2.18.50.0.7/110-ld-makefile-path.patch new file mode 100644 index 0000000..9eea2a1 --- /dev/null +++ b/patches/binutils/2.18.50.0.7/110-ld-makefile-path.patch @@ -0,0 +1,30 @@ +Fix ld scripts path, copied from buildroot. + + binutils-2.18.50.0.6/ld/Makefile.am | 2 1 1 0 +- + binutils-2.18.50.0.6/ld/Makefile.in | 2 1 1 0 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff -durN binutils-2.18.50.0.6.orig/ld/Makefile.am binutils-2.18.50.0.6/ld/Makefile.am +--- binutils-2.18.50.0.6.orig/ld/Makefile.am 2008-04-03 18:54:05.000000000 +0200 ++++ binutils-2.18.50.0.6/ld/Makefile.am 2008-05-02 23:25:14.000000000 +0200 +@@ -18,7 +18,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ +diff -durN binutils-2.18.50.0.6.orig/ld/Makefile.in binutils-2.18.50.0.6/ld/Makefile.in +--- binutils-2.18.50.0.6.orig/ld/Makefile.in 2008-04-03 18:54:05.000000000 +0200 ++++ binutils-2.18.50.0.6/ld/Makefile.in 2008-05-02 23:25:14.000000000 +0200 +@@ -288,7 +288,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + BASEDIR = $(srcdir)/.. + BFDDIR = $(BASEDIR)/bfd + INCDIR = $(BASEDIR)/include diff --git a/patches/binutils/2.18.50.0.7/120-check-ldrunpath-length.patch b/patches/binutils/2.18.50.0.7/120-check-ldrunpath-length.patch new file mode 100644 index 0000000..7b3e7e1 --- /dev/null +++ b/patches/binutils/2.18.50.0.7/120-check-ldrunpath-length.patch @@ -0,0 +1,26 @@ +Check LD_RUN_PATH length, copied from buildroot. + + binutils-2.18.50.0.6/ld/emultempl/elf32.em | 4 4 0 0 ++++ + 1 file changed, 4 insertions(+) + +diff -durN binutils-2.18.50.0.6.orig/ld/emultempl/elf32.em binutils-2.18.50.0.6/ld/emultempl/elf32.em +--- binutils-2.18.50.0.6.orig/ld/emultempl/elf32.em 2008-04-03 18:54:25.000000000 +0200 ++++ binutils-2.18.50.0.6/ld/emultempl/elf32.em 2008-05-02 23:30:08.000000000 +0200 +@@ -1220,6 +1220,8 @@ + && command_line.rpath == NULL) + { + lib_path = (const char *) getenv ("LD_RUN_PATH"); ++ if ((lib_path) && (strlen (lib_path) == 0)) ++ lib_path = NULL; + if (gld${EMULATION_NAME}_search_needed (lib_path, &n, + force)) + break; +@@ -1405,6 +1407,8 @@ + rpath = command_line.rpath; + if (rpath == NULL) + rpath = (const char *) getenv ("LD_RUN_PATH"); ++ if ((rpath) && (strlen (rpath) == 0)) ++ rpath = NULL; + if (! (bfd_elf_size_dynamic_sections + (link_info.output_bfd, command_line.soname, rpath, + command_line.filter_shlib, diff --git a/patches/binutils/2.18.50.0.7/200-ld-makefile-path.patch b/patches/binutils/2.18.50.0.7/200-ld-makefile-path.patch deleted file mode 100644 index 9eea2a1..0000000 --- a/patches/binutils/2.18.50.0.7/200-ld-makefile-path.patch +++ /dev/null @@ -1,30 +0,0 @@ -Fix ld scripts path, copied from buildroot. - - binutils-2.18.50.0.6/ld/Makefile.am | 2 1 1 0 +- - binutils-2.18.50.0.6/ld/Makefile.in | 2 1 1 0 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff -durN binutils-2.18.50.0.6.orig/ld/Makefile.am binutils-2.18.50.0.6/ld/Makefile.am ---- binutils-2.18.50.0.6.orig/ld/Makefile.am 2008-04-03 18:54:05.000000000 +0200 -+++ binutils-2.18.50.0.6/ld/Makefile.am 2008-05-02 23:25:14.000000000 +0200 -@@ -18,7 +18,7 @@ - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - - EMUL = @EMUL@ - EMULATION_OFILES = @EMULATION_OFILES@ -diff -durN binutils-2.18.50.0.6.orig/ld/Makefile.in binutils-2.18.50.0.6/ld/Makefile.in ---- binutils-2.18.50.0.6.orig/ld/Makefile.in 2008-04-03 18:54:05.000000000 +0200 -+++ binutils-2.18.50.0.6/ld/Makefile.in 2008-05-02 23:25:14.000000000 +0200 -@@ -288,7 +288,7 @@ - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - BASEDIR = $(srcdir)/.. - BFDDIR = $(BASEDIR)/bfd - INCDIR = $(BASEDIR)/include diff --git a/patches/binutils/2.18.50.0.7/300-check-ldrunpath-length.patch b/patches/binutils/2.18.50.0.7/300-check-ldrunpath-length.patch deleted file mode 100644 index 7b3e7e1..0000000 --- a/patches/binutils/2.18.50.0.7/300-check-ldrunpath-length.patch +++ /dev/null @@ -1,26 +0,0 @@ -Check LD_RUN_PATH length, copied from buildroot. - - binutils-2.18.50.0.6/ld/emultempl/elf32.em | 4 4 0 0 ++++ - 1 file changed, 4 insertions(+) - -diff -durN binutils-2.18.50.0.6.orig/ld/emultempl/elf32.em binutils-2.18.50.0.6/ld/emultempl/elf32.em ---- binutils-2.18.50.0.6.orig/ld/emultempl/elf32.em 2008-04-03 18:54:25.000000000 +0200 -+++ binutils-2.18.50.0.6/ld/emultempl/elf32.em 2008-05-02 23:30:08.000000000 +0200 -@@ -1220,6 +1220,8 @@ - && command_line.rpath == NULL) - { - lib_path = (const char *) getenv ("LD_RUN_PATH"); -+ if ((lib_path) && (strlen (lib_path) == 0)) -+ lib_path = NULL; - if (gld${EMULATION_NAME}_search_needed (lib_path, &n, - force)) - break; -@@ -1405,6 +1407,8 @@ - rpath = command_line.rpath; - if (rpath == NULL) - rpath = (const char *) getenv ("LD_RUN_PATH"); -+ if ((rpath) && (strlen (rpath) == 0)) -+ rpath = NULL; - if (! (bfd_elf_size_dynamic_sections - (link_info.output_bfd, command_line.soname, rpath, - command_line.filter_shlib, diff --git a/patches/binutils/2.18.50.0.8/110-ld-makefile-path.patch b/patches/binutils/2.18.50.0.8/110-ld-makefile-path.patch new file mode 100644 index 0000000..41a2249 --- /dev/null +++ b/patches/binutils/2.18.50.0.8/110-ld-makefile-path.patch @@ -0,0 +1,24 @@ +diff -durN binutils-2.18.50.0.8.orig/ld/Makefile.am binutils-2.18.50.0.8/ld/Makefile.am +--- binutils-2.18.50.0.8.orig/ld/Makefile.am 2008-04-03 18:54:05.000000000 +0200 ++++ binutils-2.18.50.0.8/ld/Makefile.am 2008-07-13 23:15:40.000000000 +0200 +@@ -18,7 +18,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ +diff -durN binutils-2.18.50.0.8.orig/ld/Makefile.in binutils-2.18.50.0.8/ld/Makefile.in +--- binutils-2.18.50.0.8.orig/ld/Makefile.in 2008-07-10 17:32:58.000000000 +0200 ++++ binutils-2.18.50.0.8/ld/Makefile.in 2008-07-13 23:15:40.000000000 +0200 +@@ -290,7 +290,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + BASEDIR = $(srcdir)/.. + BFDDIR = $(BASEDIR)/bfd + INCDIR = $(BASEDIR)/include diff --git a/patches/binutils/2.18.50.0.8/120-check-ldrunpath-length.patch b/patches/binutils/2.18.50.0.8/120-check-ldrunpath-length.patch new file mode 100644 index 0000000..f2f096d --- /dev/null +++ b/patches/binutils/2.18.50.0.8/120-check-ldrunpath-length.patch @@ -0,0 +1,21 @@ +diff -durN binutils-2.18.50.0.8.orig/ld/emultempl/elf32.em binutils-2.18.50.0.8/ld/emultempl/elf32.em +--- binutils-2.18.50.0.8.orig/ld/emultempl/elf32.em 2008-07-10 17:33:23.000000000 +0200 ++++ binutils-2.18.50.0.8/ld/emultempl/elf32.em 2008-07-13 23:19:29.000000000 +0200 +@@ -1220,6 +1220,8 @@ + && command_line.rpath == NULL) + { + lib_path = (const char *) getenv ("LD_RUN_PATH"); ++ if ((lib_path) && (strlen (lib_path) == 0)) ++ lib_path = NULL; + if (gld${EMULATION_NAME}_search_needed (lib_path, &n, + force)) + break; +@@ -1405,6 +1407,8 @@ + rpath = command_line.rpath; + if (rpath == NULL) + rpath = (const char *) getenv ("LD_RUN_PATH"); ++ if ((rpath) && (strlen (rpath) == 0)) ++ rpath = NULL; + if (! (bfd_elf_size_dynamic_sections + (link_info.output_bfd, command_line.soname, rpath, + command_line.filter_shlib, diff --git a/patches/binutils/2.18.50.0.8/200-ld-makefile-path.patch b/patches/binutils/2.18.50.0.8/200-ld-makefile-path.patch deleted file mode 100644 index 41a2249..0000000 --- a/patches/binutils/2.18.50.0.8/200-ld-makefile-path.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -durN binutils-2.18.50.0.8.orig/ld/Makefile.am binutils-2.18.50.0.8/ld/Makefile.am ---- binutils-2.18.50.0.8.orig/ld/Makefile.am 2008-04-03 18:54:05.000000000 +0200 -+++ binutils-2.18.50.0.8/ld/Makefile.am 2008-07-13 23:15:40.000000000 +0200 -@@ -18,7 +18,7 @@ - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - - EMUL = @EMUL@ - EMULATION_OFILES = @EMULATION_OFILES@ -diff -durN binutils-2.18.50.0.8.orig/ld/Makefile.in binutils-2.18.50.0.8/ld/Makefile.in ---- binutils-2.18.50.0.8.orig/ld/Makefile.in 2008-07-10 17:32:58.000000000 +0200 -+++ binutils-2.18.50.0.8/ld/Makefile.in 2008-07-13 23:15:40.000000000 +0200 -@@ -290,7 +290,7 @@ - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - BASEDIR = $(srcdir)/.. - BFDDIR = $(BASEDIR)/bfd - INCDIR = $(BASEDIR)/include diff --git a/patches/binutils/2.18.50.0.8/300-check-ldrunpath-length.patch b/patches/binutils/2.18.50.0.8/300-check-ldrunpath-length.patch deleted file mode 100644 index f2f096d..0000000 --- a/patches/binutils/2.18.50.0.8/300-check-ldrunpath-length.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -durN binutils-2.18.50.0.8.orig/ld/emultempl/elf32.em binutils-2.18.50.0.8/ld/emultempl/elf32.em ---- binutils-2.18.50.0.8.orig/ld/emultempl/elf32.em 2008-07-10 17:33:23.000000000 +0200 -+++ binutils-2.18.50.0.8/ld/emultempl/elf32.em 2008-07-13 23:19:29.000000000 +0200 -@@ -1220,6 +1220,8 @@ - && command_line.rpath == NULL) - { - lib_path = (const char *) getenv ("LD_RUN_PATH"); -+ if ((lib_path) && (strlen (lib_path) == 0)) -+ lib_path = NULL; - if (gld${EMULATION_NAME}_search_needed (lib_path, &n, - force)) - break; -@@ -1405,6 +1407,8 @@ - rpath = command_line.rpath; - if (rpath == NULL) - rpath = (const char *) getenv ("LD_RUN_PATH"); -+ if ((rpath) && (strlen (rpath) == 0)) -+ rpath = NULL; - if (! (bfd_elf_size_dynamic_sections - (link_info.output_bfd, command_line.soname, rpath, - command_line.filter_shlib, diff --git a/patches/dmalloc/5.5.2/130-mips.patch b/patches/dmalloc/5.5.2/130-mips.patch new file mode 100644 index 0000000..69f0e45 --- /dev/null +++ b/patches/dmalloc/5.5.2/130-mips.patch @@ -0,0 +1,64 @@ +Patch to correctly handle the MIPS case. + +It was build up by Yann E. MORIN from some +bits gathered from buildroot, which is LGPL v2.1 +License for dmalloc is: + * Permission to use, copy, modify, and distribute this software for + * any purpose and without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all + * copies, and that the name of Gray Watson not be used in advertising + * or publicity pertaining to distribution of the document or software + * without specific, written prior permission. + * + * Gray Watson makes no representations about the suitability of the + * software described herein for any purpose. It is provided "as is" + * without express or implied warranty. + +I personnaly believe that the resulting code should therefore be +LGPL v2.1, but don't believe me, ask your lawyers! + +diff -dur dmalloc-5.5.2.orig/configure dmalloc-5.5.2/configure +--- dmalloc-5.5.2.orig/configure 2007-05-18 12:15:39.000000000 +0200 ++++ dmalloc-5.5.2/configure 2007-05-18 12:15:48.000000000 +0200 +@@ -7107,7 +7107,7 @@ + echo $ECHO_N "checking return.h macros work... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + cat >>confdefs.h <<\_ACEOF +-#define RETURN_MACROS_WORK 0 ++#define RETURN_MACROS_WORK 1 + _ACEOF + echo "$as_me:$LINENO: result: no" >&5 + echo "${ECHO_T}no" >&6 +diff -dur dmalloc-5.5.2.orig/return.h dmalloc-5.5.2/return.h +--- dmalloc-5.5.2.orig/return.h 2007-05-14 19:26:14.000000000 +0200 ++++ dmalloc-5.5.2/return.h 2007-05-18 12:15:48.000000000 +0200 +@@ -106,26 +106,16 @@ + /*************************************/ + + /* +- * For DEC Mips machines running Ultrix ++ * For Mips machines running Linux + */ + #if __mips + + /* +- * I have no idea how to get inline assembly with the default cc. +- * Anyone know how? +- */ +- +-#if 0 +- +-/* + * NOTE: we assume here that file is global. + * +- * $31 is the frame pointer. $2 looks to be the return address but maybe +- * not consistently. ++ * $31 is the return address. + */ +-#define GET_RET_ADDR(file) asm("sw $2, file") +- +-#endif ++#define GET_RET_ADDR(file) asm("sw $31, %0" : "=m" (file)) + + #endif /* __mips */ + diff --git a/patches/dmalloc/5.5.2/140-shared_library.patch b/patches/dmalloc/5.5.2/140-shared_library.patch new file mode 100644 index 0000000..ccf2bb2 --- /dev/null +++ b/patches/dmalloc/5.5.2/140-shared_library.patch @@ -0,0 +1,44 @@ +This patch makes building the shared library possible. + +Copyright 2007 Yann E. MORIN +Licensed to you as dmalloc-5.5.2 is. + +diff -dur dmalloc-5.5.2.orig/Makefile.in dmalloc-5.5.2/Makefile.in +--- dmalloc-5.5.2.orig/Makefile.in 2007-05-14 19:26:14.000000000 +0200 ++++ dmalloc-5.5.2/Makefile.in 2007-05-18 15:54:04.000000000 +0200 +@@ -257,7 +257,7 @@ + # via: http://256.com/gray/email.html + $(LIB_SL) : $(LIBRARY) + rm -f $@ $@.t +- @shlinkargs@ $(LIBRARY) $(OBJS) $(NORMAL_OBJS) ++ @shlinkargs@ $(LIBRARY) + mv $@.t $@ + + $(LIBRARY) : $(OBJS) $(NORMAL_OBJS) +@@ -270,7 +270,7 @@ + + $(LIB_TH_SL) : $(LIB_TH) + rm -f $@ $@.t +- @shlinkargs@ $(LIB_TH) $(OBJS) $(THREAD_OBJS) ++ @shlinkargs@ $(LIB_TH) + mv $@.t $@ + + $(LIB_CXX) : $(OBJS) $(NORMAL_OBJS) $(CXX_OBJS) +@@ -279,7 +279,7 @@ + + $(LIB_CXX_SL) : $(LIB_CXX) + rm -f $@ $@.t +- @shlinkargs@ $(LIB_CXX) $(OBJS) $(NORMAL_OBJS) $(CXX_OBJS) ++ @shlinkargs@ $(LIB_CXX) + mv $@.t $@ + + $(LIB_TH_CXX) : $(OBJS) $(THREAD_OBJS) $(CXX_OBJS) +@@ -288,7 +288,7 @@ + + $(LIB_TH_CXX_SL) : $(LIB_TH_CXX) + rm -f $@ $@.t +- @shlinkargs@ $(LIB_TH_CXX) $(OBJS) $(THREAD_OBJS) $(CXX_OBJS) ++ @shlinkargs@ $(LIB_TH_CXX) + mv $@.t $@ + + threadssl : $(LIB_TH_SL) diff --git a/patches/dmalloc/5.5.2/150-use_DESTDIR.patch b/patches/dmalloc/5.5.2/150-use_DESTDIR.patch new file mode 100644 index 0000000..072e3a7 --- /dev/null +++ b/patches/dmalloc/5.5.2/150-use_DESTDIR.patch @@ -0,0 +1,105 @@ +Make install rules use DESTDIR. +Split installation of the utilitity from the global install. + +Copyright 2007 Yann E. MORIN +Licensed to you as dmalloc-5.5.2 is. + +diff -dur dmalloc-5.5.2.orig/Makefile.in dmalloc-5.5.2/Makefile.in +--- dmalloc-5.5.2.orig/Makefile.in 2007-05-18 16:03:31.000000000 +0200 ++++ dmalloc-5.5.2/Makefile.in 2007-05-18 16:22:59.000000000 +0200 +@@ -174,66 +174,67 @@ + # rm -f configure + + installdirs : +- $(srcdir)/mkinstalldirs $(includedir) $(libdir) $(bindir) ++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(includedir) $(DESTDIR)/$(libdir) $(DESTDIR)/$(bindir) + + installincs : $(HFLS) +- $(srcdir)/mkinstalldirs $(includedir) +- $(INSTALL_DATA) $(HFLS) $(includedir) ++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(includedir) ++ $(INSTALL_DATA) $(HFLS) $(DESTDIR)/$(includedir) + + installthsl : $(LIB_TH_SL) +- $(srcdir)/mkinstalldirs $(libdir) +- $(INSTALL_PROGRAM) $(LIB_TH_SL) $(libdir) ++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(libdir) ++ $(INSTALL_PROGRAM) $(LIB_TH_SL) $(DESTDIR)/$(libdir) + + installth : $(INSTALL_THREADS) +- $(srcdir)/mkinstalldirs $(libdir) +- $(INSTALL_PROGRAM) $(LIB_TH) $(libdir) ++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(libdir) ++ $(INSTALL_PROGRAM) $(LIB_TH) $(DESTDIR)/$(libdir) + @CXX_OFF@ @echo "Enter 'make installthcxx' to install the threaded C++ library" + @SL_OFF@ @echo "Enter 'make installthsl' to install the threaded shared-library" + + installthcxxsl : $(LIB_TH_CXX_SL) +- $(srcdir)/mkinstalldirs $(shlibdir) +- $(INSTALL_PROGRAM) $(LIB_TH_CXX_SL) $(shlibdir) ++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(shlibdir) ++ $(INSTALL_PROGRAM) $(LIB_TH_CXX_SL) $(DESTDIR)/$(shlibdir) + + installthcxx : $(INSTALL_TH_CXX) +- $(srcdir)/mkinstalldirs $(libdir) +- $(INSTALL_PROGRAM) $(LIB_TH_CXX) $(libdir) ++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(libdir) ++ $(INSTALL_PROGRAM) $(LIB_TH_CXX) $(DESTDIR)/$(libdir) + @SL_OFF@ @echo "Enter 'make installthcxxsl' to install the threaded C++ shared-library" + + installcxxsl : $(LIB_CXX_SL) +- $(srcdir)/mkinstalldirs $(libdir) +- $(INSTALL_PROGRAM) $(LIB_CXX_SL) $(libdir) ++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(libdir) ++ $(INSTALL_PROGRAM) $(LIB_CXX_SL) $(DESTDIR)/$(libdir) + + installcxx : $(INSTALL_CXX) +- $(srcdir)/mkinstalldirs $(libdir) +- $(INSTALL_PROGRAM) $(LIB_CXX) $(libdir) ++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(libdir) ++ $(INSTALL_PROGRAM) $(LIB_CXX) $(DESTDIR)/$(libdir) + @TH_OFF@ @echo "Enter 'make installthcxx' to install the threaded C++ library" + @SL_OFF@ @echo "Enter 'make installcxxsl' to install the C++ shared-library" + + installsl : $(LIB_SL) +- $(srcdir)/mkinstalldirs $(shlibdir) +- $(INSTALL_PROGRAM) $(LIB_SL) $(shlibdir) ++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(shlibdir) ++ $(INSTALL_PROGRAM) $(LIB_SL) $(DESTDIR)/$(shlibdir) + @CXX_OFF@ @echo "Enter 'make installcxxsl' to install the C++ shared-library" + @TH_OFF@ @echo "Enter 'make installthsl' to install thread shared-library" + + installlib : $(INSTALL_LIB) +- $(srcdir)/mkinstalldirs $(libdir) +- $(INSTALL_PROGRAM) $(LIBRARY) $(libdir) +- @RANLIB@ $(libdir)/$(LIBRARY) ++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(libdir) ++ $(INSTALL_PROGRAM) $(LIBRARY) $(DESTDIR)/$(libdir) ++ @RANLIB@ $(DESTDIR)/$(libdir)/$(LIBRARY) + @SL_OFF@ @echo "Enter 'make installsl' to install $(LIB_SL) in $(shlibdir)" + @CXX_OFF@ @echo "Enter 'make installcxx' to install the C++ library" + @TH_OFF@ @echo "Enter 'make installth' to install thread library" + + installdocs : $(srcdir)/docs/$(HTMLFILE) $(srcdir)/docs/$(TEXIFILE) \ + $(srcdir)/docs/$(PDFFILE) +- $(srcdir)/mkinstalldirs $(docdir) +- $(INSTALL_DATA) $(srcdir)/docs/$(HTMLFILE) $(docdir) +- $(INSTALL_DATA) $(srcdir)/docs/$(TEXIFILE) $(docdir) +- $(INSTALL_DATA) $(srcdir)/docs/$(PDFFILE) $(docdir) ++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(docdir) ++ $(INSTALL_DATA) $(srcdir)/docs/$(HTMLFILE) $(DESTDIR)/$(docdir) ++ $(INSTALL_DATA) $(srcdir)/docs/$(TEXIFILE) $(DESTDIR)/$(docdir) ++ $(INSTALL_DATA) $(srcdir)/docs/$(PDFFILE) $(DESTDIR)/$(docdir) + +-install : installincs installlib $(UTIL) +- $(srcdir)/mkinstalldirs $(bindir) +- $(INSTALL_PROGRAM) $(UTIL) $(bindir) +- @echo "Enter 'make installdocs' to install $(DOCFILES) in $(docdir)" ++installutil : $(UTIL) ++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(bindir) ++ $(INSTALL_PROGRAM) $(UTIL) $(DESTDIR)/$(bindir) ++ ++install : installincs installlib installutil installdocs + + dmalloc.h.2 : $(srcdir)/configure + $(SHELL) $(srcdir)/configure diff --git a/patches/dmalloc/5.5.2/160-strdup_macro.patch b/patches/dmalloc/5.5.2/160-strdup_macro.patch new file mode 100644 index 0000000..4974d14 --- /dev/null +++ b/patches/dmalloc/5.5.2/160-strdup_macro.patch @@ -0,0 +1,39 @@ +--- dmalloc-5.5.2.orig/configure 2008-06-17 13:10:09.000000000 +0200 ++++ dmalloc-5.5.2/configure 2008-06-17 13:11:25.000000000 +0200 +@@ -4691,8 +4691,35 @@ + echo "$as_me:$LINENO: checking strdup macro" >&5 + echo $ECHO_N "checking strdup macro... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then +- ac_cv_strdup_macro=no ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++ ++#if HAVE_STDLIB_H ++# include ++#endif ++ ++#ifndef strdup ++ choke me ++#endif + ++main() { exit(0); } ++ ++_ACEOF ++rm -f conftest.o conftest.obj ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; then ++ ac_cv_strdup_macro=yes ++else ++ ac_cv_strdup_macro=no ++fi ++ + else + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ diff --git a/patches/dmalloc/5.5.2/200-mips.patch b/patches/dmalloc/5.5.2/200-mips.patch deleted file mode 100644 index 69f0e45..0000000 --- a/patches/dmalloc/5.5.2/200-mips.patch +++ /dev/null @@ -1,64 +0,0 @@ -Patch to correctly handle the MIPS case. - -It was build up by Yann E. MORIN from some -bits gathered from buildroot, which is LGPL v2.1 -License for dmalloc is: - * Permission to use, copy, modify, and distribute this software for - * any purpose and without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all - * copies, and that the name of Gray Watson not be used in advertising - * or publicity pertaining to distribution of the document or software - * without specific, written prior permission. - * - * Gray Watson makes no representations about the suitability of the - * software described herein for any purpose. It is provided "as is" - * without express or implied warranty. - -I personnaly believe that the resulting code should therefore be -LGPL v2.1, but don't believe me, ask your lawyers! - -diff -dur dmalloc-5.5.2.orig/configure dmalloc-5.5.2/configure ---- dmalloc-5.5.2.orig/configure 2007-05-18 12:15:39.000000000 +0200 -+++ dmalloc-5.5.2/configure 2007-05-18 12:15:48.000000000 +0200 -@@ -7107,7 +7107,7 @@ - echo $ECHO_N "checking return.h macros work... $ECHO_C" >&6 - if test "$cross_compiling" = yes; then - cat >>confdefs.h <<\_ACEOF --#define RETURN_MACROS_WORK 0 -+#define RETURN_MACROS_WORK 1 - _ACEOF - echo "$as_me:$LINENO: result: no" >&5 - echo "${ECHO_T}no" >&6 -diff -dur dmalloc-5.5.2.orig/return.h dmalloc-5.5.2/return.h ---- dmalloc-5.5.2.orig/return.h 2007-05-14 19:26:14.000000000 +0200 -+++ dmalloc-5.5.2/return.h 2007-05-18 12:15:48.000000000 +0200 -@@ -106,26 +106,16 @@ - /*************************************/ - - /* -- * For DEC Mips machines running Ultrix -+ * For Mips machines running Linux - */ - #if __mips - - /* -- * I have no idea how to get inline assembly with the default cc. -- * Anyone know how? -- */ -- --#if 0 -- --/* - * NOTE: we assume here that file is global. - * -- * $31 is the frame pointer. $2 looks to be the return address but maybe -- * not consistently. -+ * $31 is the return address. - */ --#define GET_RET_ADDR(file) asm("sw $2, file") -- --#endif -+#define GET_RET_ADDR(file) asm("sw $31, %0" : "=m" (file)) - - #endif /* __mips */ - diff --git a/patches/dmalloc/5.5.2/300-shared_library.patch b/patches/dmalloc/5.5.2/300-shared_library.patch deleted file mode 100644 index ccf2bb2..0000000 --- a/patches/dmalloc/5.5.2/300-shared_library.patch +++ /dev/null @@ -1,44 +0,0 @@ -This patch makes building the shared library possible. - -Copyright 2007 Yann E. MORIN -Licensed to you as dmalloc-5.5.2 is. - -diff -dur dmalloc-5.5.2.orig/Makefile.in dmalloc-5.5.2/Makefile.in ---- dmalloc-5.5.2.orig/Makefile.in 2007-05-14 19:26:14.000000000 +0200 -+++ dmalloc-5.5.2/Makefile.in 2007-05-18 15:54:04.000000000 +0200 -@@ -257,7 +257,7 @@ - # via: http://256.com/gray/email.html - $(LIB_SL) : $(LIBRARY) - rm -f $@ $@.t -- @shlinkargs@ $(LIBRARY) $(OBJS) $(NORMAL_OBJS) -+ @shlinkargs@ $(LIBRARY) - mv $@.t $@ - - $(LIBRARY) : $(OBJS) $(NORMAL_OBJS) -@@ -270,7 +270,7 @@ - - $(LIB_TH_SL) : $(LIB_TH) - rm -f $@ $@.t -- @shlinkargs@ $(LIB_TH) $(OBJS) $(THREAD_OBJS) -+ @shlinkargs@ $(LIB_TH) - mv $@.t $@ - - $(LIB_CXX) : $(OBJS) $(NORMAL_OBJS) $(CXX_OBJS) -@@ -279,7 +279,7 @@ - - $(LIB_CXX_SL) : $(LIB_CXX) - rm -f $@ $@.t -- @shlinkargs@ $(LIB_CXX) $(OBJS) $(NORMAL_OBJS) $(CXX_OBJS) -+ @shlinkargs@ $(LIB_CXX) - mv $@.t $@ - - $(LIB_TH_CXX) : $(OBJS) $(THREAD_OBJS) $(CXX_OBJS) -@@ -288,7 +288,7 @@ - - $(LIB_TH_CXX_SL) : $(LIB_TH_CXX) - rm -f $@ $@.t -- @shlinkargs@ $(LIB_TH_CXX) $(OBJS) $(THREAD_OBJS) $(CXX_OBJS) -+ @shlinkargs@ $(LIB_TH_CXX) - mv $@.t $@ - - threadssl : $(LIB_TH_SL) diff --git a/patches/dmalloc/5.5.2/400-use_DESTDIR.patch b/patches/dmalloc/5.5.2/400-use_DESTDIR.patch deleted file mode 100644 index 072e3a7..0000000 --- a/patches/dmalloc/5.5.2/400-use_DESTDIR.patch +++ /dev/null @@ -1,105 +0,0 @@ -Make install rules use DESTDIR. -Split installation of the utilitity from the global install. - -Copyright 2007 Yann E. MORIN -Licensed to you as dmalloc-5.5.2 is. - -diff -dur dmalloc-5.5.2.orig/Makefile.in dmalloc-5.5.2/Makefile.in ---- dmalloc-5.5.2.orig/Makefile.in 2007-05-18 16:03:31.000000000 +0200 -+++ dmalloc-5.5.2/Makefile.in 2007-05-18 16:22:59.000000000 +0200 -@@ -174,66 +174,67 @@ - # rm -f configure - - installdirs : -- $(srcdir)/mkinstalldirs $(includedir) $(libdir) $(bindir) -+ $(srcdir)/mkinstalldirs $(DESTDIR)/$(includedir) $(DESTDIR)/$(libdir) $(DESTDIR)/$(bindir) - - installincs : $(HFLS) -- $(srcdir)/mkinstalldirs $(includedir) -- $(INSTALL_DATA) $(HFLS) $(includedir) -+ $(srcdir)/mkinstalldirs $(DESTDIR)/$(includedir) -+ $(INSTALL_DATA) $(HFLS) $(DESTDIR)/$(includedir) - - installthsl : $(LIB_TH_SL) -- $(srcdir)/mkinstalldirs $(libdir) -- $(INSTALL_PROGRAM) $(LIB_TH_SL) $(libdir) -+ $(srcdir)/mkinstalldirs $(DESTDIR)/$(libdir) -+ $(INSTALL_PROGRAM) $(LIB_TH_SL) $(DESTDIR)/$(libdir) - - installth : $(INSTALL_THREADS) -- $(srcdir)/mkinstalldirs $(libdir) -- $(INSTALL_PROGRAM) $(LIB_TH) $(libdir) -+ $(srcdir)/mkinstalldirs $(DESTDIR)/$(libdir) -+ $(INSTALL_PROGRAM) $(LIB_TH) $(DESTDIR)/$(libdir) - @CXX_OFF@ @echo "Enter 'make installthcxx' to install the threaded C++ library" - @SL_OFF@ @echo "Enter 'make installthsl' to install the threaded shared-library" - - installthcxxsl : $(LIB_TH_CXX_SL) -- $(srcdir)/mkinstalldirs $(shlibdir) -- $(INSTALL_PROGRAM) $(LIB_TH_CXX_SL) $(shlibdir) -+ $(srcdir)/mkinstalldirs $(DESTDIR)/$(shlibdir) -+ $(INSTALL_PROGRAM) $(LIB_TH_CXX_SL) $(DESTDIR)/$(shlibdir) - - installthcxx : $(INSTALL_TH_CXX) -- $(srcdir)/mkinstalldirs $(libdir) -- $(INSTALL_PROGRAM) $(LIB_TH_CXX) $(libdir) -+ $(srcdir)/mkinstalldirs $(DESTDIR)/$(libdir) -+ $(INSTALL_PROGRAM) $(LIB_TH_CXX) $(DESTDIR)/$(libdir) - @SL_OFF@ @echo "Enter 'make installthcxxsl' to install the threaded C++ shared-library" - - installcxxsl : $(LIB_CXX_SL) -- $(srcdir)/mkinstalldirs $(libdir) -- $(INSTALL_PROGRAM) $(LIB_CXX_SL) $(libdir) -+ $(srcdir)/mkinstalldirs $(DESTDIR)/$(libdir) -+ $(INSTALL_PROGRAM) $(LIB_CXX_SL) $(DESTDIR)/$(libdir) - - installcxx : $(INSTALL_CXX) -- $(srcdir)/mkinstalldirs $(libdir) -- $(INSTALL_PROGRAM) $(LIB_CXX) $(libdir) -+ $(srcdir)/mkinstalldirs $(DESTDIR)/$(libdir) -+ $(INSTALL_PROGRAM) $(LIB_CXX) $(DESTDIR)/$(libdir) - @TH_OFF@ @echo "Enter 'make installthcxx' to install the threaded C++ library" - @SL_OFF@ @echo "Enter 'make installcxxsl' to install the C++ shared-library" - - installsl : $(LIB_SL) -- $(srcdir)/mkinstalldirs $(shlibdir) -- $(INSTALL_PROGRAM) $(LIB_SL) $(shlibdir) -+ $(srcdir)/mkinstalldirs $(DESTDIR)/$(shlibdir) -+ $(INSTALL_PROGRAM) $(LIB_SL) $(DESTDIR)/$(shlibdir) - @CXX_OFF@ @echo "Enter 'make installcxxsl' to install the C++ shared-library" - @TH_OFF@ @echo "Enter 'make installthsl' to install thread shared-library" - - installlib : $(INSTALL_LIB) -- $(srcdir)/mkinstalldirs $(libdir) -- $(INSTALL_PROGRAM) $(LIBRARY) $(libdir) -- @RANLIB@ $(libdir)/$(LIBRARY) -+ $(srcdir)/mkinstalldirs $(DESTDIR)/$(libdir) -+ $(INSTALL_PROGRAM) $(LIBRARY) $(DESTDIR)/$(libdir) -+ @RANLIB@ $(DESTDIR)/$(libdir)/$(LIBRARY) - @SL_OFF@ @echo "Enter 'make installsl' to install $(LIB_SL) in $(shlibdir)" - @CXX_OFF@ @echo "Enter 'make installcxx' to install the C++ library" - @TH_OFF@ @echo "Enter 'make installth' to install thread library" - - installdocs : $(srcdir)/docs/$(HTMLFILE) $(srcdir)/docs/$(TEXIFILE) \ - $(srcdir)/docs/$(PDFFILE) -- $(srcdir)/mkinstalldirs $(docdir) -- $(INSTALL_DATA) $(srcdir)/docs/$(HTMLFILE) $(docdir) -- $(INSTALL_DATA) $(srcdir)/docs/$(TEXIFILE) $(docdir) -- $(INSTALL_DATA) $(srcdir)/docs/$(PDFFILE) $(docdir) -+ $(srcdir)/mkinstalldirs $(DESTDIR)/$(docdir) -+ $(INSTALL_DATA) $(srcdir)/docs/$(HTMLFILE) $(DESTDIR)/$(docdir) -+ $(INSTALL_DATA) $(srcdir)/docs/$(TEXIFILE) $(DESTDIR)/$(docdir) -+ $(INSTALL_DATA) $(srcdir)/docs/$(PDFFILE) $(DESTDIR)/$(docdir) - --install : installincs installlib $(UTIL) -- $(srcdir)/mkinstalldirs $(bindir) -- $(INSTALL_PROGRAM) $(UTIL) $(bindir) -- @echo "Enter 'make installdocs' to install $(DOCFILES) in $(docdir)" -+installutil : $(UTIL) -+ $(srcdir)/mkinstalldirs $(DESTDIR)/$(bindir) -+ $(INSTALL_PROGRAM) $(UTIL) $(DESTDIR)/$(bindir) -+ -+install : installincs installlib installutil installdocs - - dmalloc.h.2 : $(srcdir)/configure - $(SHELL) $(srcdir)/configure diff --git a/patches/dmalloc/5.5.2/500-strdup_macro.patch b/patches/dmalloc/5.5.2/500-strdup_macro.patch deleted file mode 100644 index 4974d14..0000000 --- a/patches/dmalloc/5.5.2/500-strdup_macro.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- dmalloc-5.5.2.orig/configure 2008-06-17 13:10:09.000000000 +0200 -+++ dmalloc-5.5.2/configure 2008-06-17 13:11:25.000000000 +0200 -@@ -4691,8 +4691,35 @@ - echo "$as_me:$LINENO: checking strdup macro" >&5 - echo $ECHO_N "checking strdup macro... $ECHO_C" >&6 - if test "$cross_compiling" = yes; then -- ac_cv_strdup_macro=no -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+#if HAVE_STDLIB_H -+# include -+#endif -+ -+#ifndef strdup -+ choke me -+#endif - -+main() { exit(0); } -+ -+_ACEOF -+rm -f conftest.o conftest.obj -+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 -+ (eval $ac_compile) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; then -+ ac_cv_strdup_macro=yes -+else -+ ac_cv_strdup_macro=no -+fi -+ - else - cat >conftest.$ac_ext <<_ACEOF - /* confdefs.h. */ diff --git a/patches/duma/2_5_1/110-separate_cpp.patch b/patches/duma/2_5_1/110-separate_cpp.patch new file mode 100644 index 0000000..d228731 --- /dev/null +++ b/patches/duma/2_5_1/110-separate_cpp.patch @@ -0,0 +1,20 @@ +diff -dur duma_2_5_1.orig/Makefile duma_2_5_1/Makefile +--- duma_2_5_1.orig/Makefile 2007-07-11 17:49:43.000000000 +0200 ++++ duma_2_5_1/Makefile 2007-07-11 17:50:46.000000000 +0200 +@@ -115,9 +115,14 @@ + dumatest.c tstheap.c dumatestpp.cpp testoperators.cpp \ + createconf.c + +-OBJECTS = dumapp.o duma.o sem_inc.o print.o ++OBJECTS = duma.o sem_inc.o print.o ++SO_OBJECTS = duma_so.o sem_inc_so.o print_so.o ++ ++ifeq ($(DUMA_CPP),1) ++OBJECTS += dumapp.o ++SO_OBJECTS += dumapp_so.o ++endif + +-SO_OBJECTS = dumapp_so.o duma_so.o sem_inc_so.o print_so.o + + all: libduma.a $(DUMASO) tstheap dumatest dumatestpp testoperators tstheap_so dumatestpp_so + @ echo "Testing DUMA." diff --git a/patches/duma/2_5_1/200-separate_cpp.patch b/patches/duma/2_5_1/200-separate_cpp.patch deleted file mode 100644 index d228731..0000000 --- a/patches/duma/2_5_1/200-separate_cpp.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff -dur duma_2_5_1.orig/Makefile duma_2_5_1/Makefile ---- duma_2_5_1.orig/Makefile 2007-07-11 17:49:43.000000000 +0200 -+++ duma_2_5_1/Makefile 2007-07-11 17:50:46.000000000 +0200 -@@ -115,9 +115,14 @@ - dumatest.c tstheap.c dumatestpp.cpp testoperators.cpp \ - createconf.c - --OBJECTS = dumapp.o duma.o sem_inc.o print.o -+OBJECTS = duma.o sem_inc.o print.o -+SO_OBJECTS = duma_so.o sem_inc_so.o print_so.o -+ -+ifeq ($(DUMA_CPP),1) -+OBJECTS += dumapp.o -+SO_OBJECTS += dumapp_so.o -+endif - --SO_OBJECTS = dumapp_so.o duma_so.o sem_inc_so.o print_so.o - - all: libduma.a $(DUMASO) tstheap dumatest dumatestpp testoperators tstheap_so dumatestpp_so - @ echo "Testing DUMA." diff --git a/patches/duma/2_5_12/110-separate_cpp.patch b/patches/duma/2_5_12/110-separate_cpp.patch new file mode 100644 index 0000000..df2d377 --- /dev/null +++ b/patches/duma/2_5_12/110-separate_cpp.patch @@ -0,0 +1,19 @@ +diff -durN duma_2_5_12.orig/Makefile duma_2_5_12/Makefile +--- duma_2_5_12.orig/Makefile 2007-09-07 21:57:45.000000000 +0200 ++++ duma_2_5_12/Makefile 2007-09-07 21:58:35.000000000 +0200 +@@ -231,9 +231,13 @@ + dumatest.c tstheap.c thread-test.c testmt.c dumatestpp.cpp testoperators.cpp \ + createconf.c + +-OBJECTS = dumapp.o duma.o sem_inc.o print.o ++OBJECTS = duma.o sem_inc.o print.o ++SO_OBJECTS = duma_so.o sem_inc_so.o print_so.o + +-SO_OBJECTS = dumapp_so.o duma_so.o sem_inc_so.o print_so.o ++ifeq ($(DUMA_CPP),1) ++OBJECTS += dumapp.o ++SO_OBJECTS += dumapp_so.o ++endif + + all: libduma.a tstheap$(EXEPOSTFIX) dumatest$(EXEPOSTFIX) thread-test$(EXEPOSTFIX) testmt$(EXEPOSTFIX) dumatestpp$(EXEPOSTFIX) testoperators$(EXEPOSTFIX) $(DUMA_DYN_DEPS) + @ $(ECHOLF) diff --git a/patches/duma/2_5_12/200-separate_cpp.patch b/patches/duma/2_5_12/200-separate_cpp.patch deleted file mode 100644 index df2d377..0000000 --- a/patches/duma/2_5_12/200-separate_cpp.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff -durN duma_2_5_12.orig/Makefile duma_2_5_12/Makefile ---- duma_2_5_12.orig/Makefile 2007-09-07 21:57:45.000000000 +0200 -+++ duma_2_5_12/Makefile 2007-09-07 21:58:35.000000000 +0200 -@@ -231,9 +231,13 @@ - dumatest.c tstheap.c thread-test.c testmt.c dumatestpp.cpp testoperators.cpp \ - createconf.c - --OBJECTS = dumapp.o duma.o sem_inc.o print.o -+OBJECTS = duma.o sem_inc.o print.o -+SO_OBJECTS = duma_so.o sem_inc_so.o print_so.o - --SO_OBJECTS = dumapp_so.o duma_so.o sem_inc_so.o print_so.o -+ifeq ($(DUMA_CPP),1) -+OBJECTS += dumapp.o -+SO_OBJECTS += dumapp_so.o -+endif - - all: libduma.a tstheap$(EXEPOSTFIX) dumatest$(EXEPOSTFIX) thread-test$(EXEPOSTFIX) testmt$(EXEPOSTFIX) dumatestpp$(EXEPOSTFIX) testoperators$(EXEPOSTFIX) $(DUMA_DYN_DEPS) - @ $(ECHOLF) diff --git a/patches/duma/2_5_14/110-separate_cpp.patch b/patches/duma/2_5_14/110-separate_cpp.patch new file mode 100644 index 0000000..bc287c4 --- /dev/null +++ b/patches/duma/2_5_14/110-separate_cpp.patch @@ -0,0 +1,19 @@ +diff -durN duma_2_5_14.orig/Makefile duma_2_5_14/Makefile +--- duma_2_5_14.orig/Makefile 2008-06-17 10:30:40.000000000 +0200 ++++ duma_2_5_14/Makefile 2008-06-17 10:30:17.000000000 +0200 +@@ -228,9 +228,13 @@ + dumatest.c tstheap.c thread-test.c testmt.c dumatestpp.cpp testoperators.cpp \ + createconf.c + +-OBJECTS = dumapp.o duma.o sem_inc.o print.o ++OBJECTS = duma.o sem_inc.o print.o ++SO_OBJECTS = duma_so.o sem_inc_so.o print_so.o + +-SO_OBJECTS = dumapp_so.o duma_so.o sem_inc_so.o print_so.o ++ifeq ($(DUMA_CPP),1) ++OBJECTS += dumapp.o ++SO_OBJECTS += dumapp_so.o ++endif + + all: libduma.a tstheap$(EXEPOSTFIX) dumatest$(EXEPOSTFIX) thread-test$(EXEPOSTFIX) testmt$(EXEPOSTFIX) dumatestpp$(EXEPOSTFIX) testoperators$(EXEPOSTFIX) $(DUMA_DYN_DEPS) + diff --git a/patches/duma/2_5_14/200-separate_cpp.patch b/patches/duma/2_5_14/200-separate_cpp.patch deleted file mode 100644 index bc287c4..0000000 --- a/patches/duma/2_5_14/200-separate_cpp.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff -durN duma_2_5_14.orig/Makefile duma_2_5_14/Makefile ---- duma_2_5_14.orig/Makefile 2008-06-17 10:30:40.000000000 +0200 -+++ duma_2_5_14/Makefile 2008-06-17 10:30:17.000000000 +0200 -@@ -228,9 +228,13 @@ - dumatest.c tstheap.c thread-test.c testmt.c dumatestpp.cpp testoperators.cpp \ - createconf.c - --OBJECTS = dumapp.o duma.o sem_inc.o print.o -+OBJECTS = duma.o sem_inc.o print.o -+SO_OBJECTS = duma_so.o sem_inc_so.o print_so.o - --SO_OBJECTS = dumapp_so.o duma_so.o sem_inc_so.o print_so.o -+ifeq ($(DUMA_CPP),1) -+OBJECTS += dumapp.o -+SO_OBJECTS += dumapp_so.o -+endif - - all: libduma.a tstheap$(EXEPOSTFIX) dumatest$(EXEPOSTFIX) thread-test$(EXEPOSTFIX) testmt$(EXEPOSTFIX) dumatestpp$(EXEPOSTFIX) testoperators$(EXEPOSTFIX) $(DUMA_DYN_DEPS) - diff --git a/patches/duma/2_5_8/110-separate_cpp.patch b/patches/duma/2_5_8/110-separate_cpp.patch new file mode 100644 index 0000000..86aa6c0 --- /dev/null +++ b/patches/duma/2_5_8/110-separate_cpp.patch @@ -0,0 +1,19 @@ +diff -durN duma_2_5_8.orig/Makefile duma_2_5_8/Makefile +--- duma_2_5_8.orig/Makefile 2007-09-07 21:57:45.000000000 +0200 ++++ duma_2_5_8/Makefile 2007-09-07 21:58:35.000000000 +0200 +@@ -216,9 +216,13 @@ + dumatest.c tstheap.c testmt.c dumatestpp.cpp testoperators.cpp \ + createconf.c + +-OBJECTS = dumapp.o duma.o sem_inc.o print.o ++OBJECTS = duma.o sem_inc.o print.o ++SO_OBJECTS = duma_so.o sem_inc_so.o print_so.o + +-SO_OBJECTS = dumapp_so.o duma_so.o sem_inc_so.o print_so.o ++ifeq ($(DUMA_CPP),1) ++OBJECTS += dumapp.o ++SO_OBJECTS += dumapp_so.o ++endif + + all: libduma.a tstheap$(EXEPOSTFIX) dumatest$(EXEPOSTFIX) testmt$(EXEPOSTFIX) dumatestpp$(EXEPOSTFIX) testoperators$(EXEPOSTFIX) $(DUMA_DYN_DEPS) + @ $(ECHOLF) diff --git a/patches/duma/2_5_8/200-separate_cpp.patch b/patches/duma/2_5_8/200-separate_cpp.patch deleted file mode 100644 index 86aa6c0..0000000 --- a/patches/duma/2_5_8/200-separate_cpp.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff -durN duma_2_5_8.orig/Makefile duma_2_5_8/Makefile ---- duma_2_5_8.orig/Makefile 2007-09-07 21:57:45.000000000 +0200 -+++ duma_2_5_8/Makefile 2007-09-07 21:58:35.000000000 +0200 -@@ -216,9 +216,13 @@ - dumatest.c tstheap.c testmt.c dumatestpp.cpp testoperators.cpp \ - createconf.c - --OBJECTS = dumapp.o duma.o sem_inc.o print.o -+OBJECTS = duma.o sem_inc.o print.o -+SO_OBJECTS = duma_so.o sem_inc_so.o print_so.o - --SO_OBJECTS = dumapp_so.o duma_so.o sem_inc_so.o print_so.o -+ifeq ($(DUMA_CPP),1) -+OBJECTS += dumapp.o -+SO_OBJECTS += dumapp_so.o -+endif - - all: libduma.a tstheap$(EXEPOSTFIX) dumatest$(EXEPOSTFIX) testmt$(EXEPOSTFIX) dumatestpp$(EXEPOSTFIX) testoperators$(EXEPOSTFIX) $(DUMA_DYN_DEPS) - @ $(ECHOLF) diff --git a/patches/gcc/3.4.6/110-uclibc-locale.patch b/patches/gcc/3.4.6/110-uclibc-locale.patch new file mode 100644 index 0000000..444fcf9 --- /dev/null +++ b/patches/gcc/3.4.6/110-uclibc-locale.patch @@ -0,0 +1,3255 @@ +diff -durN gcc-3.4.6.orig/libstdc++-v3/acinclude.m4 gcc-3.4.6/libstdc++-v3/acinclude.m4 +--- gcc-3.4.6.orig/libstdc++-v3/acinclude.m4 2004-10-28 23:52:41.000000000 +0200 ++++ gcc-3.4.6/libstdc++-v3/acinclude.m4 2007-08-15 22:51:01.000000000 +0200 +@@ -1015,7 +1015,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 +@@ -1031,6 +1031,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 +@@ -1157,6 +1160,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 -durN gcc-3.4.6.orig/libstdc++-v3/aclocal.m4 gcc-3.4.6/libstdc++-v3/aclocal.m4 +--- gcc-3.4.6.orig/libstdc++-v3/aclocal.m4 2004-10-28 23:52:41.000000000 +0200 ++++ gcc-3.4.6/libstdc++-v3/aclocal.m4 2007-08-15 22:51:01.000000000 +0200 +@@ -1044,6 +1044,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 +@@ -1170,6 +1173,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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-3.4.6/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-15 22:51:01.000000000 +0200 +@@ -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 ++ ++#include // For errno ++#include ++#include ++#include ++#include ++ ++#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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-3.4.6/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-15 22:51:01.000000000 +0200 +@@ -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 ++ ++#ifndef _C_LOCALE_H ++#define _C_LOCALE_H 1 ++ ++#pragma GCC system_header ++ ++#include // get std::strlen ++#include // get std::snprintf or std::sprintf ++#include ++#include // For codecvt ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC_HAS_LOCALE__ ++#include // For codecvt using iconv, iconv_t ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#include // 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 ++ 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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-3.4.6/libstdc++-v3/config/locale/uclibc/c++locale_internal.h +--- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-15 22:51:01.000000000 +0200 +@@ -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 ++ ++#include ++ ++#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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-3.4.6/libstdc++-v3/config/locale/uclibc/codecvt_members.cc +--- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2007-08-15 22:51:01.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++namespace std ++{ ++ // Specializations. ++#ifdef _GLIBCXX_USE_WCHAR_T ++ codecvt_base::result ++ codecvt:: ++ 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(-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(__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:: ++ 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(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(-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(-1) ++ || __conv == static_cast(-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:: ++ 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:: ++ 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:: ++ 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(__builtin_alloca(sizeof(wchar_t) ++ * __max)); ++ while (__from < __end && __max) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast(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(-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(-1) ++ || __conv == static_cast(-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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-3.4.6/libstdc++-v3/config/locale/uclibc/collate_members.cc +--- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-15 22:51:01.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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::_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::_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::_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::_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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-3.4.6/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-15 22:51:01.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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 specializations are in src/locale.cc and ++ // various /config/os/* files. ++ template<> ++ ctype_byname::ctype_byname(const char* __s, size_t __refs) ++ : ctype(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::__wmask_type ++ ctype::_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::do_toupper(wchar_t __c) const ++ { return __towupper_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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::do_tolower(wchar_t __c) const ++ { return __towlower_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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:: ++ 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:: ++ 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:: ++ 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:: ++ 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:: ++ do_widen(char __c) const ++ { return _M_widen[static_cast(__c)]; } ++ ++ const char* ++ ctype:: ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const ++ { ++ while (__lo < __hi) ++ { ++ *__dest = _M_widen[static_cast(*__lo)]; ++ ++__lo; ++ ++__dest; ++ } ++ return __hi; ++ } ++ ++ char ++ ctype:: ++ 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(__c)); ++ } ++ ++ const wchar_t* ++ ctype:: ++ 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(__c)); ++ } ++ ++__lo; ++ ++__dest; ++ } ++ else ++ while (__lo < __hi) ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast(__c)); ++ ++__lo; ++ ++__dest; ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __hi; ++ } ++ ++ void ++ ctype::_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(__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(_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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-3.4.6/libstdc++-v3/config/locale/uclibc/messages_members.cc +--- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-15 22:51:01.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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::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(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::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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-3.4.6/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-15 22:51:01.000000000 +0200 +@@ -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 ++ ++#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 ++ messages<_CharT>::messages(size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), ++ _M_name_messages(_S_get_c_name()) ++ { } ++ ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::open(const basic_string& __s, const locale& __loc, ++ const char* __dir) const ++ { ++ __bindtextdomain(__s.c_str(), __dir); ++ return this->do_open(__s, __loc); ++ } ++ ++ // Virtual member functions. ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::do_open(const basic_string& __s, ++ const locale&) const ++ { ++ // No error checking is done, assume the catalog exists and can ++ // be used. ++ __textdomain(__s.c_str()); ++ return 0; ++ } ++ ++ template ++ void ++ messages<_CharT>::do_close(catalog) const ++ { } ++ ++ // messages_byname ++ template ++ 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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-3.4.6/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-15 22:51:01.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::~moneypunct() ++ { delete _M_data; } ++ ++ template<> ++ moneypunct::~moneypunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ moneypunct::_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; ++ ++ 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(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(__u.__w); ++ ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = static_cast(__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::_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; ++ ++ 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(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(__u.__w); ++ ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = static_cast(__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::~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::~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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-3.4.6/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-15 22:51:01.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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::~numpunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ numpunct::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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(__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(__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(__u.__w); ++ ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = static_cast(__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::~numpunct() ++ { delete _M_data; } ++ #endif ++} +diff -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-3.4.6/libstdc++-v3/config/locale/uclibc/time_members.cc +--- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-15 22:51:01.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++ 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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++#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(__nl_langinfo_l(_NL_WD_FMT, __cloc)); ++ _M_data->_M_date_era_format = reinterpret_cast(__nl_langinfo_l(_NL_WERA_D_FMT, __cloc)); ++ _M_data->_M_time_format = reinterpret_cast(__nl_langinfo_l(_NL_WT_FMT, __cloc)); ++ _M_data->_M_time_era_format = reinterpret_cast(__nl_langinfo_l(_NL_WERA_T_FMT, __cloc)); ++ _M_data->_M_date_time_format = reinterpret_cast(__nl_langinfo_l(_NL_WD_T_FMT, __cloc)); ++ _M_data->_M_date_time_era_format = reinterpret_cast(__nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc)); ++ _M_data->_M_am = reinterpret_cast(__nl_langinfo_l(_NL_WAM_STR, __cloc)); ++ _M_data->_M_pm = reinterpret_cast(__nl_langinfo_l(_NL_WPM_STR, __cloc)); ++ _M_data->_M_am_pm_format = reinterpret_cast(__nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc)); ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_1, __cloc)); ++ _M_data->_M_day2 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_2, __cloc)); ++ _M_data->_M_day3 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_3, __cloc)); ++ _M_data->_M_day4 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_4, __cloc)); ++ _M_data->_M_day5 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_5, __cloc)); ++ _M_data->_M_day6 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_6, __cloc)); ++ _M_data->_M_day7 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_7, __cloc)); ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_1, __cloc)); ++ _M_data->_M_aday2 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_2, __cloc)); ++ _M_data->_M_aday3 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_3, __cloc)); ++ _M_data->_M_aday4 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_4, __cloc)); ++ _M_data->_M_aday5 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_5, __cloc)); ++ _M_data->_M_aday6 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_6, __cloc)); ++ _M_data->_M_aday7 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_7, __cloc)); ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_1, __cloc)); ++ _M_data->_M_month02 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_2, __cloc)); ++ _M_data->_M_month03 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_3, __cloc)); ++ _M_data->_M_month04 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_4, __cloc)); ++ _M_data->_M_month05 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_5, __cloc)); ++ _M_data->_M_month06 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_6, __cloc)); ++ _M_data->_M_month07 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_7, __cloc)); ++ _M_data->_M_month08 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_8, __cloc)); ++ _M_data->_M_month09 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_9, __cloc)); ++ _M_data->_M_month10 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_10, __cloc)); ++ _M_data->_M_month11 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_11, __cloc)); ++ _M_data->_M_month12 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_12, __cloc)); ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_1, __cloc)); ++ _M_data->_M_amonth02 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_2, __cloc)); ++ _M_data->_M_amonth03 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_3, __cloc)); ++ _M_data->_M_amonth04 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_4, __cloc)); ++ _M_data->_M_amonth05 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_5, __cloc)); ++ _M_data->_M_amonth06 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_6, __cloc)); ++ _M_data->_M_amonth07 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_7, __cloc)); ++ _M_data->_M_amonth08 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_8, __cloc)); ++ _M_data->_M_amonth09 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_9, __cloc)); ++ _M_data->_M_amonth10 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_10, __cloc)); ++ _M_data->_M_amonth11 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_11, __cloc)); ++ _M_data->_M_amonth12 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_12, __cloc)); ++ } ++#endif // 0 ++ } ++#endif ++} +diff -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-3.4.6/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-15 22:51:01.000000000 +0200 +@@ -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 ++ ++ template ++ __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 ++ __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 ++ __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 ++ __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 -durN gcc-3.4.6.orig/libstdc++-v3/config/os/uclibc/ctype_base.h gcc-3.4.6/libstdc++-v3/config/os/uclibc/ctype_base.h +--- gcc-3.4.6.orig/libstdc++-v3/config/os/uclibc/ctype_base.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/config/os/uclibc/ctype_base.h 2007-08-15 22:51:01.000000000 +0200 +@@ -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::_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 -durN gcc-3.4.6.orig/libstdc++-v3/config/os/uclibc/ctype_inline.h gcc-3.4.6/libstdc++-v3/config/os/uclibc/ctype_inline.h +--- gcc-3.4.6.orig/libstdc++-v3/config/os/uclibc/ctype_inline.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/config/os/uclibc/ctype_inline.h 2007-08-15 22:51:01.000000000 +0200 +@@ -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:: ++ is(mask __m, char __c) const ++ { return _M_table[static_cast(__c)] & __m; } ++ ++ const char* ++ ctype:: ++ is(const char* __low, const char* __high, mask* __vec) const ++ { ++ while (__low < __high) ++ *__vec++ = _M_table[static_cast(*__low++)]; ++ return __high; ++ } ++ ++ const char* ++ ctype:: ++ scan_is(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && !(_M_table[static_cast(*__low)] & __m)) ++ ++__low; ++ return __low; ++ } ++ ++ const char* ++ ctype:: ++ scan_not(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && (_M_table[static_cast(*__low)] & __m) != 0) ++ ++__low; ++ return __low; ++ } +diff -durN gcc-3.4.6.orig/libstdc++-v3/config/os/uclibc/ctype_noninline.h gcc-3.4.6/libstdc++-v3/config/os/uclibc/ctype_noninline.h +--- gcc-3.4.6.orig/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2007-08-15 22:51:01.000000000 +0200 +@@ -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::classic_table() throw() ++ { return __C_ctype_b; } ++ ++ ctype::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::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::do_toupper(char __c) const ++ { return _M_toupper[static_cast(__c)]; } ++ ++ const char* ++ ctype::do_toupper(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_toupper[static_cast(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } ++ ++ char ++ ctype::do_tolower(char __c) const ++ { return _M_tolower[static_cast(__c)]; } ++ ++ const char* ++ ctype::do_tolower(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_tolower[static_cast(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } +diff -durN gcc-3.4.6.orig/libstdc++-v3/config/os/uclibc/os_defines.h gcc-3.4.6/libstdc++-v3/config/os/uclibc/os_defines.h +--- gcc-3.4.6.orig/libstdc++-v3/config/os/uclibc/os_defines.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/config/os/uclibc/os_defines.h 2007-08-15 22:51:01.000000000 +0200 +@@ -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 ++ ++// We must not see the optimized string functions GNU libc defines. ++#define __NO_STRING_INLINES ++ ++#endif +diff -durN gcc-3.4.6.orig/libstdc++-v3/configure gcc-3.4.6/libstdc++-v3/configure +--- gcc-3.4.6.orig/libstdc++-v3/configure 2005-02-01 07:31:23.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/configure 2007-08-15 22:51:01.000000000 +0200 +@@ -4012,6 +4012,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]+$' +@@ -5679,7 +5684,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; }; } ;; +@@ -5704,6 +5709,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 + /* confdefs.h. */ +@@ -5916,6 +5924,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 -durN gcc-3.4.6.orig/libstdc++-v3/configure.host gcc-3.4.6/libstdc++-v3/configure.host +--- gcc-3.4.6.orig/libstdc++-v3/configure.host 2004-10-05 18:32:49.000000000 +0200 ++++ gcc-3.4.6/libstdc++-v3/configure.host 2007-08-15 22:51:01.000000000 +0200 +@@ -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 -durN gcc-3.4.6.orig/libstdc++-v3/crossconfig.m4 gcc-3.4.6/libstdc++-v3/crossconfig.m4 +--- gcc-3.4.6.orig/libstdc++-v3/crossconfig.m4 2005-02-01 07:31:23.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/crossconfig.m4 2007-08-15 22:51:01.000000000 +0200 +@@ -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 -durN gcc-3.4.6.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-3.4.6/libstdc++-v3/include/c_compatibility/wchar.h +--- gcc-3.4.6.orig/libstdc++-v3/include/c_compatibility/wchar.h 2003-12-09 04:51:46.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/include/c_compatibility/wchar.h 2007-08-15 22:51:01.000000000 +0200 +@@ -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 -durN gcc-3.4.6.orig/libstdc++-v3/include/c_std/std_cwchar.h gcc-3.4.6/libstdc++-v3/include/c_std/std_cwchar.h +--- gcc-3.4.6.orig/libstdc++-v3/include/c_std/std_cwchar.h 2004-07-20 10:52:12.000000000 +0200 ++++ gcc-3.4.6/libstdc++-v3/include/c_std/std_cwchar.h 2007-08-15 22:51:01.000000000 +0200 +@@ -179,7 +179,9 @@ + using ::wcscoll; + using ::wcscpy; + using ::wcscspn; ++#if _GLIBCXX_HAVE_WCSFTIME + using ::wcsftime; ++#endif + using ::wcslen; + using ::wcsncat; + using ::wcsncmp; diff --git a/patches/gcc/3.4.6/120-libstdc++-pic.patch b/patches/gcc/3.4.6/120-libstdc++-pic.patch new file mode 100644 index 0000000..2b55a47 --- /dev/null +++ b/patches/gcc/3.4.6/120-libstdc++-pic.patch @@ -0,0 +1,46 @@ +diff -durN gcc-3.4.6.orig/libstdc++-v3/src/Makefile.am gcc-3.4.6/libstdc++-v3/src/Makefile.am +--- gcc-3.4.6.orig/libstdc++-v3/src/Makefile.am 2004-04-16 21:08:35.000000000 +0200 ++++ gcc-3.4.6/libstdc++-v3/src/Makefile.am 2007-08-15 22:52:23.000000000 +0200 +@@ -210,6 +210,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 +diff -durN gcc-3.4.6.orig/libstdc++-v3/src/Makefile.in gcc-3.4.6/libstdc++-v3/src/Makefile.in +--- gcc-3.4.6.orig/libstdc++-v3/src/Makefile.in 2004-04-16 21:08:35.000000000 +0200 ++++ gcc-3.4.6/libstdc++-v3/src/Makefile.in 2007-08-15 22:52:23.000000000 +0200 +@@ -592,7 +592,7 @@ + + install-data-am: install-data-local + +-install-exec-am: install-toolexeclibLTLIBRARIES ++install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local + + install-info: install-info-am + +@@ -625,6 +625,7 @@ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-data install-data-am install-data-local \ + install-exec install-exec-am install-info install-info-am \ ++ install-exec-local \ + install-man install-strip install-toolexeclibLTLIBRARIES \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ +@@ -709,6 +710,11 @@ + install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ++ ++install-exec-local: ++ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff --git a/patches/gcc/3.4.6/130-index_macro.patch b/patches/gcc/3.4.6/130-index_macro.patch new file mode 100644 index 0000000..6f4d57a --- /dev/null +++ b/patches/gcc/3.4.6/130-index_macro.patch @@ -0,0 +1,26 @@ +diff -durN gcc-3.4.6.orig/libstdc++-v3/include/ext/rope gcc-3.4.6/libstdc++-v3/include/ext/rope +--- gcc-3.4.6.orig/libstdc++-v3/include/ext/rope 2005-01-16 23:08:43.000000000 +0100 ++++ gcc-3.4.6/libstdc++-v3/include/ext/rope 2007-08-15 22:53:37.000000000 +0200 +@@ -58,6 +58,9 @@ + #include + #include + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + # ifdef __GC + # define __GC_CONST const + # else +diff -durN gcc-3.4.6.orig/libstdc++-v3/include/ext/ropeimpl.h gcc-3.4.6/libstdc++-v3/include/ext/ropeimpl.h +--- gcc-3.4.6.orig/libstdc++-v3/include/ext/ropeimpl.h 2004-09-08 15:36:04.000000000 +0200 ++++ gcc-3.4.6/libstdc++-v3/include/ext/ropeimpl.h 2007-08-15 22:53:37.000000000 +0200 +@@ -53,6 +53,9 @@ + #include // For uninitialized_copy_n + #include // For power + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + namespace __gnu_cxx + { + using std::size_t; diff --git a/patches/gcc/3.4.6/140-arm-ldm-peephole.patch b/patches/gcc/3.4.6/140-arm-ldm-peephole.patch new file mode 100644 index 0000000..81a0ac8 --- /dev/null +++ b/patches/gcc/3.4.6/140-arm-ldm-peephole.patch @@ -0,0 +1,68 @@ +diff -durN gcc-3.4.6.orig/gcc/config/arm/arm.c gcc-3.4.6/gcc/config/arm/arm.c +--- gcc-3.4.6.orig/gcc/config/arm/arm.c 2005-10-01 15:31:38.000000000 +0200 ++++ gcc-3.4.6/gcc/config/arm/arm.c 2007-08-15 22:54:59.000000000 +0200 +@@ -4857,6 +4857,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 +5088,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 -durN gcc-3.4.6.orig/gcc/config/arm/arm.md gcc-3.4.6/gcc/config/arm/arm.md +--- gcc-3.4.6.orig/gcc/config/arm/arm.md 2005-10-01 15:31:38.000000000 +0200 ++++ gcc-3.4.6/gcc/config/arm/arm.md 2007-08-15 22:54:59.000000000 +0200 +@@ -8811,13 +8811,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]; +@@ -8852,6 +8855,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); +diff -durN gcc-3.4.6.orig/gcc/genpeep.c gcc-3.4.6/gcc/genpeep.c +--- gcc-3.4.6.orig/gcc/genpeep.c 2003-07-05 07:27:22.000000000 +0200 ++++ gcc-3.4.6/gcc/genpeep.c 2007-08-15 22:54:59.000000000 +0200 +@@ -381,6 +381,7 @@ + printf ("#include \"recog.h\"\n"); + printf ("#include \"except.h\"\n\n"); + printf ("#include \"function.h\"\n\n"); ++ printf ("#include \"flags.h\"\n\n"); + + printf ("#ifdef HAVE_peephole\n"); + printf ("extern rtx peep_operand[];\n\n"); diff --git a/patches/gcc/3.4.6/150-arm-ldm.patch b/patches/gcc/3.4.6/150-arm-ldm.patch new file mode 100644 index 0000000..18ea493 --- /dev/null +++ b/patches/gcc/3.4.6/150-arm-ldm.patch @@ -0,0 +1,120 @@ +diff -durN gcc-3.4.6.orig/gcc/config/arm/arm.c gcc-3.4.6/gcc/config/arm/arm.c +--- gcc-3.4.6.orig/gcc/config/arm/arm.c 2007-08-15 22:56:20.000000000 +0200 ++++ gcc-3.4.6/gcc/config/arm/arm.c 2007-08-15 22:56:20.000000000 +0200 +@@ -8524,6 +8524,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) + { +@@ -8757,27 +8777,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) +@@ -11405,22 +11445,6 @@ + } + } + +-/* Return the number (counting from 0) of +- the least significant set bit in MASK. */ +- +-inline static int +-number_of_first_bit_set (int mask) +-{ +- int bit; +- +- for (bit = 0; +- (mask & (1 << bit)) == 0; +- ++bit) +- continue; +- +- return bit; +-} +- + /* Generate code to return from a thumb function. + If 'reg_containing_return_addr' is -1, then the return address is + actually on the stack, at the stack pointer. */ diff --git a/patches/gcc/3.4.6/160-arm-ldm-peephole2.patch b/patches/gcc/3.4.6/160-arm-ldm-peephole2.patch new file mode 100644 index 0000000..395c516 --- /dev/null +++ b/patches/gcc/3.4.6/160-arm-ldm-peephole2.patch @@ -0,0 +1,32 @@ +diff -durN gcc-3.4.6.orig/gcc/config/arm/arm.c gcc-3.4.6/gcc/config/arm/arm.c +--- gcc-3.4.6.orig/gcc/config/arm/arm.c 2007-08-15 22:57:51.000000000 +0200 ++++ gcc-3.4.6/gcc/config/arm/arm.c 2007-08-15 22:57:51.000000000 +0200 +@@ -4572,6 +4572,10 @@ + int + adjacent_mem_locations (rtx a, rtx b) + { ++ /* We don't guarantee to preserve the order of these memory refs. */ ++ if (volatile_refs_p (a) || volatile_refs_p (b)) ++ return 0; ++ + if ((GET_CODE (XEXP (a, 0)) == REG + || (GET_CODE (XEXP (a, 0)) == PLUS + && GET_CODE (XEXP (XEXP (a, 0), 1)) == CONST_INT)) +@@ -4611,6 +4615,17 @@ + return 0; + + val_diff = val1 - val0; ++ ++ if (arm_ld_sched) ++ { ++ /* If the target has load delay slots, then there's no benefit ++ to using an ldm instruction unless the offset is zero and ++ we are optimizing for size. */ ++ return (optimize_size && (REGNO (reg0) == REGNO (reg1)) ++ && (val0 == 0 || val1 == 0 || val0 == 4 || val1 == 4) ++ && (val_diff == 4 || val_diff == -4)); ++ } ++ + return ((REGNO (reg0) == REGNO (reg1)) + && (val_diff == 4 || val_diff == -4)); + } diff --git a/patches/gcc/3.4.6/170-sdk-libstdc++-includes.patch b/patches/gcc/3.4.6/170-sdk-libstdc++-includes.patch new file mode 100644 index 0000000..f599b59 --- /dev/null +++ b/patches/gcc/3.4.6/170-sdk-libstdc++-includes.patch @@ -0,0 +1,24 @@ +diff -durN gcc-3.4.6.orig/libstdc++-v3/fragment.am gcc-3.4.6/libstdc++-v3/fragment.am +--- gcc-3.4.6.orig/libstdc++-v3/fragment.am 2003-08-27 02:38:28.000000000 +0200 ++++ gcc-3.4.6/libstdc++-v3/fragment.am 2007-08-15 22:59:09.000000000 +0200 +@@ -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 -durN gcc-3.4.6.orig/libstdc++-v3/libmath/Makefile.am gcc-3.4.6/libstdc++-v3/libmath/Makefile.am +--- gcc-3.4.6.orig/libstdc++-v3/libmath/Makefile.am 2003-08-27 23:29:43.000000000 +0200 ++++ gcc-3.4.6/libstdc++-v3/libmath/Makefile.am 2007-08-15 22:59:09.000000000 +0200 +@@ -32,7 +32,7 @@ + + libmath_la_SOURCES = stubs.c + +-AM_CPPFLAGS = $(CANADIAN_INCLUDES) ++AM_CPPFLAGS = $(CANADIAN_INCLUDES) -I$(toplevel_srcdir)/include + + # Only compiling "C" sources in this directory. + LIBTOOL = @LIBTOOL@ --tag CC diff --git a/patches/gcc/3.4.6/180-pr15068-fix.patch b/patches/gcc/3.4.6/180-pr15068-fix.patch new file mode 100644 index 0000000..308f35b --- /dev/null +++ b/patches/gcc/3.4.6/180-pr15068-fix.patch @@ -0,0 +1,27 @@ +diff -durN gcc-3.4.6.orig/gcc/flow.c gcc-3.4.6/gcc/flow.c +--- gcc-3.4.6.orig/gcc/flow.c 2005-09-01 22:51:09.000000000 +0200 ++++ gcc-3.4.6/gcc/flow.c 2007-08-15 23:00:30.000000000 +0200 +@@ -1884,6 +1884,7 @@ + rtx set_src = SET_SRC (pc_set (BB_END (bb))); + rtx cond_true = XEXP (set_src, 0); + rtx reg = XEXP (cond_true, 0); ++ enum rtx_code inv_cond; + + if (GET_CODE (reg) == SUBREG) + reg = SUBREG_REG (reg); +@@ -1892,11 +1893,13 @@ + in the form of a comparison of a register against zero. + If the condition is more complex than that, then it is safe + not to record any information. */ +- if (GET_CODE (reg) == REG ++ inv_cond = reversed_comparison_code (cond_true, BB_END (bb)); ++ if (inv_cond != UNKNOWN ++ && GET_CODE (reg) == REG + && XEXP (cond_true, 1) == const0_rtx) + { + rtx cond_false +- = gen_rtx_fmt_ee (reverse_condition (GET_CODE (cond_true)), ++ = gen_rtx_fmt_ee (inv_cond, + GET_MODE (cond_true), XEXP (cond_true, 0), + XEXP (cond_true, 1)); + if (GET_CODE (XEXP (set_src, 1)) == PC) diff --git a/patches/gcc/3.4.6/190-all_sh-pr16665-fix.patch b/patches/gcc/3.4.6/190-all_sh-pr16665-fix.patch new file mode 100644 index 0000000..7297fca --- /dev/null +++ b/patches/gcc/3.4.6/190-all_sh-pr16665-fix.patch @@ -0,0 +1,44 @@ +diff -durN gcc-3.4.6.orig/gcc/config/sh/sh.c gcc-3.4.6/gcc/config/sh/sh.c +--- gcc-3.4.6.orig/gcc/config/sh/sh.c 2004-09-03 08:51:30.000000000 +0200 ++++ gcc-3.4.6/gcc/config/sh/sh.c 2007-08-15 23:01:48.000000000 +0200 +@@ -9107,6 +9107,15 @@ + } + this = FUNCTION_ARG (cum, Pmode, ptr_type_node, 1); + ++ /* In PIC case, we set PIC register to compute the target address. We ++ can use a scratch register to save and restore the original value ++ except for SHcompact. For SHcompact, use stack. */ ++ if (flag_pic && TARGET_SHCOMPACT) ++ { ++ push (PIC_OFFSET_TABLE_REGNUM); ++ emit_insn (gen_GOTaddr2picreg ()); ++ } ++ + /* For SHcompact, we only have r0 for a scratch register: r1 is the + static chain pointer (even if you can't have nested virtual functions + right now, someone might implement them sometime), and the rest of the +@@ -9189,8 +9198,24 @@ + assemble_external (function); + TREE_USED (function) = 1; + } ++ /* We can use scratch1 to save and restore the original value of ++ PIC register except for SHcompact. */ ++ if (flag_pic && ! TARGET_SHCOMPACT) ++ { ++ emit_move_insn (scratch1, ++ gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM)); ++ emit_insn (gen_GOTaddr2picreg ()); ++ } + funexp = XEXP (DECL_RTL (function), 0); + emit_move_insn (scratch2, funexp); ++ if (flag_pic) ++ { ++ if (! TARGET_SHCOMPACT) ++ emit_move_insn (gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM), ++ scratch1); ++ else ++ pop (PIC_OFFSET_TABLE_REGNUM); ++ } + funexp = gen_rtx_MEM (FUNCTION_MODE, scratch2); + sibcall = emit_call_insn (gen_sibcall (funexp, const0_rtx, NULL_RTX)); + SIBLING_CALL_P (sibcall) = 1; diff --git a/patches/gcc/3.4.6/200-all_sh-no-reorder-blocks.patch b/patches/gcc/3.4.6/200-all_sh-no-reorder-blocks.patch new file mode 100644 index 0000000..fed1424 --- /dev/null +++ b/patches/gcc/3.4.6/200-all_sh-no-reorder-blocks.patch @@ -0,0 +1,14 @@ +diff -durN gcc-3.4.6.orig/gcc/config/sh/sh.h gcc-3.4.6/gcc/config/sh/sh.h +--- gcc-3.4.6.orig/gcc/config/sh/sh.h 2006-01-12 02:20:32.000000000 +0100 ++++ gcc-3.4.6/gcc/config/sh/sh.h 2007-08-15 23:03:09.000000000 +0200 +@@ -422,6 +422,10 @@ + do { \ + if (LEVEL) \ + flag_omit_frame_pointer = -1; \ ++ if (LEVEL <= 2) \ ++ { \ ++ flag_reorder_blocks = 0; \ ++ } \ + if (SIZE) \ + target_flags |= SPACE_BIT; \ + if (TARGET_SHMEDIA && LEVEL > 1) \ diff --git a/patches/gcc/3.4.6/200-uclibc-locale.patch b/patches/gcc/3.4.6/200-uclibc-locale.patch deleted file mode 100644 index 444fcf9..0000000 --- a/patches/gcc/3.4.6/200-uclibc-locale.patch +++ /dev/null @@ -1,3255 +0,0 @@ -diff -durN gcc-3.4.6.orig/libstdc++-v3/acinclude.m4 gcc-3.4.6/libstdc++-v3/acinclude.m4 ---- gcc-3.4.6.orig/libstdc++-v3/acinclude.m4 2004-10-28 23:52:41.000000000 +0200 -+++ gcc-3.4.6/libstdc++-v3/acinclude.m4 2007-08-15 22:51:01.000000000 +0200 -@@ -1015,7 +1015,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 -@@ -1031,6 +1031,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 -@@ -1157,6 +1160,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 -durN gcc-3.4.6.orig/libstdc++-v3/aclocal.m4 gcc-3.4.6/libstdc++-v3/aclocal.m4 ---- gcc-3.4.6.orig/libstdc++-v3/aclocal.m4 2004-10-28 23:52:41.000000000 +0200 -+++ gcc-3.4.6/libstdc++-v3/aclocal.m4 2007-08-15 22:51:01.000000000 +0200 -@@ -1044,6 +1044,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 -@@ -1170,6 +1173,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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-3.4.6/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-15 22:51:01.000000000 +0200 -@@ -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 -+ -+#include // For errno -+#include -+#include -+#include -+#include -+ -+#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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-3.4.6/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-15 22:51:01.000000000 +0200 -@@ -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 -+ -+#ifndef _C_LOCALE_H -+#define _C_LOCALE_H 1 -+ -+#pragma GCC system_header -+ -+#include // get std::strlen -+#include // get std::snprintf or std::sprintf -+#include -+#include // For codecvt -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this -+#endif -+#ifdef __UCLIBC_HAS_LOCALE__ -+#include // For codecvt using iconv, iconv_t -+#endif -+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ -+#include // 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 -+ 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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-3.4.6/libstdc++-v3/config/locale/uclibc/c++locale_internal.h ---- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-15 22:51:01.000000000 +0200 -@@ -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 -+ -+#include -+ -+#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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-3.4.6/libstdc++-v3/config/locale/uclibc/codecvt_members.cc ---- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2007-08-15 22:51:01.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+namespace std -+{ -+ // Specializations. -+#ifdef _GLIBCXX_USE_WCHAR_T -+ codecvt_base::result -+ codecvt:: -+ 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(-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(__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:: -+ 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(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(-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(-1) -+ || __conv == static_cast(-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:: -+ 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:: -+ 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:: -+ 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(__builtin_alloca(sizeof(wchar_t) -+ * __max)); -+ while (__from < __end && __max) -+ { -+ const extern_type* __from_chunk_end; -+ __from_chunk_end = static_cast(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(-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(-1) -+ || __conv == static_cast(-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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-3.4.6/libstdc++-v3/config/locale/uclibc/collate_members.cc ---- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-15 22:51:01.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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::_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::_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::_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::_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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-3.4.6/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-15 22:51:01.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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 specializations are in src/locale.cc and -+ // various /config/os/* files. -+ template<> -+ ctype_byname::ctype_byname(const char* __s, size_t __refs) -+ : ctype(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::__wmask_type -+ ctype::_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::do_toupper(wchar_t __c) const -+ { return __towupper_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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::do_tolower(wchar_t __c) const -+ { return __towlower_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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:: -+ 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:: -+ 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:: -+ 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:: -+ 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:: -+ do_widen(char __c) const -+ { return _M_widen[static_cast(__c)]; } -+ -+ const char* -+ ctype:: -+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const -+ { -+ while (__lo < __hi) -+ { -+ *__dest = _M_widen[static_cast(*__lo)]; -+ ++__lo; -+ ++__dest; -+ } -+ return __hi; -+ } -+ -+ char -+ ctype:: -+ 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(__c)); -+ } -+ -+ const wchar_t* -+ ctype:: -+ 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(__c)); -+ } -+ ++__lo; -+ ++__dest; -+ } -+ else -+ while (__lo < __hi) -+ { -+ const int __c = wctob(*__lo); -+ *__dest = (__c == EOF ? __dfault : static_cast(__c)); -+ ++__lo; -+ ++__dest; -+ } -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ return __hi; -+ } -+ -+ void -+ ctype::_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(__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(_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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-3.4.6/libstdc++-v3/config/locale/uclibc/messages_members.cc ---- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-15 22:51:01.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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::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(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::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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-3.4.6/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-15 22:51:01.000000000 +0200 -@@ -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 -+ -+#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 -+ messages<_CharT>::messages(size_t __refs) -+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), -+ _M_name_messages(_S_get_c_name()) -+ { } -+ -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::open(const basic_string& __s, const locale& __loc, -+ const char* __dir) const -+ { -+ __bindtextdomain(__s.c_str(), __dir); -+ return this->do_open(__s, __loc); -+ } -+ -+ // Virtual member functions. -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::do_open(const basic_string& __s, -+ const locale&) const -+ { -+ // No error checking is done, assume the catalog exists and can -+ // be used. -+ __textdomain(__s.c_str()); -+ return 0; -+ } -+ -+ template -+ void -+ messages<_CharT>::do_close(catalog) const -+ { } -+ -+ // messages_byname -+ template -+ 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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-3.4.6/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-15 22:51:01.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::~moneypunct() -+ { delete _M_data; } -+ -+ template<> -+ moneypunct::~moneypunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ moneypunct::_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; -+ -+ 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(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(__u.__w); -+ -+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); -+ _M_data->_M_thousands_sep = static_cast(__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::_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; -+ -+ 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(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(__u.__w); -+ -+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); -+ _M_data->_M_thousands_sep = static_cast(__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::~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::~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 -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-3.4.6/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-15 22:51:01.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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::~numpunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ numpunct::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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(__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(__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(__u.__w); -+ -+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc); -+ _M_data->_M_thousands_sep = static_cast(__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::~numpunct() -+ { delete _M_data; } -+ #endif -+} -diff -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-3.4.6/libstdc++-v3/config/locale/uclibc/time_members.cc ---- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-15 22:51:01.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+ 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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+#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(__nl_langinfo_l(_NL_WD_FMT, __cloc)); -+ _M_data->_M_date_era_format = reinterpret_cast(__nl_langinfo_l(_NL_WERA_D_FMT, __cloc)); -+ _M_data->_M_time_format = reinterpret_cast(__nl_langinfo_l(_NL_WT_FMT, __cloc)); -+ _M_data->_M_time_era_format = reinterpret_cast(__nl_langinfo_l(_NL_WERA_T_FMT, __cloc)); -+ _M_data->_M_date_time_format = reinterpret_cast(__nl_langinfo_l(_NL_WD_T_FMT, __cloc)); -+ _M_data->_M_date_time_era_format = reinterpret_cast(__nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc)); -+ _M_data->_M_am = reinterpret_cast(__nl_langinfo_l(_NL_WAM_STR, __cloc)); -+ _M_data->_M_pm = reinterpret_cast(__nl_langinfo_l(_NL_WPM_STR, __cloc)); -+ _M_data->_M_am_pm_format = reinterpret_cast(__nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc)); -+ -+ // Day names, starting with "C"'s Sunday. -+ _M_data->_M_day1 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_1, __cloc)); -+ _M_data->_M_day2 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_2, __cloc)); -+ _M_data->_M_day3 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_3, __cloc)); -+ _M_data->_M_day4 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_4, __cloc)); -+ _M_data->_M_day5 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_5, __cloc)); -+ _M_data->_M_day6 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_6, __cloc)); -+ _M_data->_M_day7 = reinterpret_cast(__nl_langinfo_l(_NL_WDAY_7, __cloc)); -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ _M_data->_M_aday1 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_1, __cloc)); -+ _M_data->_M_aday2 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_2, __cloc)); -+ _M_data->_M_aday3 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_3, __cloc)); -+ _M_data->_M_aday4 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_4, __cloc)); -+ _M_data->_M_aday5 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_5, __cloc)); -+ _M_data->_M_aday6 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_6, __cloc)); -+ _M_data->_M_aday7 = reinterpret_cast(__nl_langinfo_l(_NL_WABDAY_7, __cloc)); -+ -+ // Month names, starting with "C"'s January. -+ _M_data->_M_month01 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_1, __cloc)); -+ _M_data->_M_month02 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_2, __cloc)); -+ _M_data->_M_month03 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_3, __cloc)); -+ _M_data->_M_month04 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_4, __cloc)); -+ _M_data->_M_month05 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_5, __cloc)); -+ _M_data->_M_month06 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_6, __cloc)); -+ _M_data->_M_month07 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_7, __cloc)); -+ _M_data->_M_month08 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_8, __cloc)); -+ _M_data->_M_month09 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_9, __cloc)); -+ _M_data->_M_month10 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_10, __cloc)); -+ _M_data->_M_month11 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_11, __cloc)); -+ _M_data->_M_month12 = reinterpret_cast(__nl_langinfo_l(_NL_WMON_12, __cloc)); -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ _M_data->_M_amonth01 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_1, __cloc)); -+ _M_data->_M_amonth02 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_2, __cloc)); -+ _M_data->_M_amonth03 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_3, __cloc)); -+ _M_data->_M_amonth04 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_4, __cloc)); -+ _M_data->_M_amonth05 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_5, __cloc)); -+ _M_data->_M_amonth06 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_6, __cloc)); -+ _M_data->_M_amonth07 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_7, __cloc)); -+ _M_data->_M_amonth08 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_8, __cloc)); -+ _M_data->_M_amonth09 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_9, __cloc)); -+ _M_data->_M_amonth10 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_10, __cloc)); -+ _M_data->_M_amonth11 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_11, __cloc)); -+ _M_data->_M_amonth12 = reinterpret_cast(__nl_langinfo_l(_NL_WABMON_12, __cloc)); -+ } -+#endif // 0 -+ } -+#endif -+} -diff -durN gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-3.4.6/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-3.4.6.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-15 22:51:01.000000000 +0200 -@@ -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 -+ -+ template -+ __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 -+ __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 -+ __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 -+ __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 -durN gcc-3.4.6.orig/libstdc++-v3/config/os/uclibc/ctype_base.h gcc-3.4.6/libstdc++-v3/config/os/uclibc/ctype_base.h ---- gcc-3.4.6.orig/libstdc++-v3/config/os/uclibc/ctype_base.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/config/os/uclibc/ctype_base.h 2007-08-15 22:51:01.000000000 +0200 -@@ -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::_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 -durN gcc-3.4.6.orig/libstdc++-v3/config/os/uclibc/ctype_inline.h gcc-3.4.6/libstdc++-v3/config/os/uclibc/ctype_inline.h ---- gcc-3.4.6.orig/libstdc++-v3/config/os/uclibc/ctype_inline.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/config/os/uclibc/ctype_inline.h 2007-08-15 22:51:01.000000000 +0200 -@@ -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:: -+ is(mask __m, char __c) const -+ { return _M_table[static_cast(__c)] & __m; } -+ -+ const char* -+ ctype:: -+ is(const char* __low, const char* __high, mask* __vec) const -+ { -+ while (__low < __high) -+ *__vec++ = _M_table[static_cast(*__low++)]; -+ return __high; -+ } -+ -+ const char* -+ ctype:: -+ scan_is(mask __m, const char* __low, const char* __high) const -+ { -+ while (__low < __high -+ && !(_M_table[static_cast(*__low)] & __m)) -+ ++__low; -+ return __low; -+ } -+ -+ const char* -+ ctype:: -+ scan_not(mask __m, const char* __low, const char* __high) const -+ { -+ while (__low < __high -+ && (_M_table[static_cast(*__low)] & __m) != 0) -+ ++__low; -+ return __low; -+ } -diff -durN gcc-3.4.6.orig/libstdc++-v3/config/os/uclibc/ctype_noninline.h gcc-3.4.6/libstdc++-v3/config/os/uclibc/ctype_noninline.h ---- gcc-3.4.6.orig/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2007-08-15 22:51:01.000000000 +0200 -@@ -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::classic_table() throw() -+ { return __C_ctype_b; } -+ -+ ctype::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::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::do_toupper(char __c) const -+ { return _M_toupper[static_cast(__c)]; } -+ -+ const char* -+ ctype::do_toupper(char* __low, const char* __high) const -+ { -+ while (__low < __high) -+ { -+ *__low = _M_toupper[static_cast(*__low)]; -+ ++__low; -+ } -+ return __high; -+ } -+ -+ char -+ ctype::do_tolower(char __c) const -+ { return _M_tolower[static_cast(__c)]; } -+ -+ const char* -+ ctype::do_tolower(char* __low, const char* __high) const -+ { -+ while (__low < __high) -+ { -+ *__low = _M_tolower[static_cast(*__low)]; -+ ++__low; -+ } -+ return __high; -+ } -diff -durN gcc-3.4.6.orig/libstdc++-v3/config/os/uclibc/os_defines.h gcc-3.4.6/libstdc++-v3/config/os/uclibc/os_defines.h ---- gcc-3.4.6.orig/libstdc++-v3/config/os/uclibc/os_defines.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/config/os/uclibc/os_defines.h 2007-08-15 22:51:01.000000000 +0200 -@@ -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 -+ -+// We must not see the optimized string functions GNU libc defines. -+#define __NO_STRING_INLINES -+ -+#endif -diff -durN gcc-3.4.6.orig/libstdc++-v3/configure gcc-3.4.6/libstdc++-v3/configure ---- gcc-3.4.6.orig/libstdc++-v3/configure 2005-02-01 07:31:23.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/configure 2007-08-15 22:51:01.000000000 +0200 -@@ -4012,6 +4012,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]+$' -@@ -5679,7 +5684,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; }; } ;; -@@ -5704,6 +5709,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 - /* confdefs.h. */ -@@ -5916,6 +5924,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 -durN gcc-3.4.6.orig/libstdc++-v3/configure.host gcc-3.4.6/libstdc++-v3/configure.host ---- gcc-3.4.6.orig/libstdc++-v3/configure.host 2004-10-05 18:32:49.000000000 +0200 -+++ gcc-3.4.6/libstdc++-v3/configure.host 2007-08-15 22:51:01.000000000 +0200 -@@ -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 -durN gcc-3.4.6.orig/libstdc++-v3/crossconfig.m4 gcc-3.4.6/libstdc++-v3/crossconfig.m4 ---- gcc-3.4.6.orig/libstdc++-v3/crossconfig.m4 2005-02-01 07:31:23.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/crossconfig.m4 2007-08-15 22:51:01.000000000 +0200 -@@ -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 -durN gcc-3.4.6.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-3.4.6/libstdc++-v3/include/c_compatibility/wchar.h ---- gcc-3.4.6.orig/libstdc++-v3/include/c_compatibility/wchar.h 2003-12-09 04:51:46.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/include/c_compatibility/wchar.h 2007-08-15 22:51:01.000000000 +0200 -@@ -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 -durN gcc-3.4.6.orig/libstdc++-v3/include/c_std/std_cwchar.h gcc-3.4.6/libstdc++-v3/include/c_std/std_cwchar.h ---- gcc-3.4.6.orig/libstdc++-v3/include/c_std/std_cwchar.h 2004-07-20 10:52:12.000000000 +0200 -+++ gcc-3.4.6/libstdc++-v3/include/c_std/std_cwchar.h 2007-08-15 22:51:01.000000000 +0200 -@@ -179,7 +179,9 @@ - using ::wcscoll; - using ::wcscpy; - using ::wcscspn; -+#if _GLIBCXX_HAVE_WCSFTIME - using ::wcsftime; -+#endif - using ::wcslen; - using ::wcsncat; - using ::wcsncmp; diff --git a/patches/gcc/3.4.6/210-all_sh-pr20617.patch b/patches/gcc/3.4.6/210-all_sh-pr20617.patch new file mode 100644 index 0000000..80d0d90 --- /dev/null +++ b/patches/gcc/3.4.6/210-all_sh-pr20617.patch @@ -0,0 +1,24 @@ +diff -durN gcc-3.4.6.orig/gcc/config/sh/lib1funcs.asm gcc-3.4.6/gcc/config/sh/lib1funcs.asm +--- gcc-3.4.6.orig/gcc/config/sh/lib1funcs.asm 2003-08-12 03:25:07.000000000 +0200 ++++ gcc-3.4.6/gcc/config/sh/lib1funcs.asm 2007-08-15 23:04:26.000000000 +0200 +@@ -37,9 +37,19 @@ + ELF local label prefixes by J"orn Rennecke + amylaar@cygnus.com */ + ++#define ALIAS(X,Y) .global GLOBAL(X); .set GLOBAL(X),GLOBAL(Y) ++ + #ifdef __ELF__ + #define LOCAL(X) .L_##X +-#define FUNC(X) .type X,@function ++ ++#if 1 /* ??? The export list mechanism is broken, everything that is not ++ hidden is exported. */ ++#undef FUNC ++#define FUNC(X) .type X,@function; .hidden X ++#undef ALIAS ++#define ALIAS(X,Y) .global GLOBAL(X); .set GLOBAL(X),GLOBAL(Y); .hidden GLOBAL(X) ++#endif ++ + #define ENDFUNC0(X) .Lfe_##X: .size X,.Lfe_##X-X + #define ENDFUNC(X) ENDFUNC0(X) + #else diff --git a/patches/gcc/3.4.6/220-arm-bigendian.patch b/patches/gcc/3.4.6/220-arm-bigendian.patch new file mode 100644 index 0000000..bb27636 --- /dev/null +++ b/patches/gcc/3.4.6/220-arm-bigendian.patch @@ -0,0 +1,65 @@ +diff -durN gcc-3.4.6.orig/gcc/config/arm/linux-elf.h gcc-3.4.6/gcc/config/arm/linux-elf.h +--- gcc-3.4.6.orig/gcc/config/arm/linux-elf.h 2007-08-15 22:51:01.000000000 +0200 ++++ gcc-3.4.6/gcc/config/arm/linux-elf.h 2007-08-15 23:05:42.000000000 +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__" + +@@ -94,7 +111,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS() +diff -durN gcc-3.4.6.orig/gcc/config.gcc gcc-3.4.6/gcc/config.gcc +--- gcc-3.4.6.orig/gcc/config.gcc 2007-08-15 22:51:01.000000000 +0200 ++++ gcc-3.4.6/gcc/config.gcc 2007-08-15 23:05:42.000000000 +0200 +@@ -678,6 +678,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h" ++ case $target in ++ arm*b-*) ++ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" ++ ;; ++ esac + tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes diff --git a/patches/gcc/3.4.6/230-powerpc-libc_stack_end-uclibc.patch b/patches/gcc/3.4.6/230-powerpc-libc_stack_end-uclibc.patch new file mode 100644 index 0000000..941974e --- /dev/null +++ b/patches/gcc/3.4.6/230-powerpc-libc_stack_end-uclibc.patch @@ -0,0 +1,16 @@ +diff -durN gcc-3.4.6.orig/gcc/config/rs6000/linux-unwind.h gcc-3.4.6/gcc/config/rs6000/linux-unwind.h +--- gcc-3.4.6.orig/gcc/config/rs6000/linux-unwind.h 2005-03-17 11:41:18.000000000 +0100 ++++ gcc-3.4.6/gcc/config/rs6000/linux-unwind.h 2007-08-15 23:07:00.000000000 +0200 +@@ -32,6 +32,7 @@ + these structs elsewhere; Many fields are missing, particularly + from the end of the structures. */ + ++#ifndef inhibit_libc + struct gcc_vregs + { + __attribute__ ((vector_size (16))) int vr[32]; +@@ -320,3 +321,4 @@ + \ + goto SUCCESS; \ + } while (0) ++#endif diff --git a/patches/gcc/3.4.6/240-mips-xgot.patch b/patches/gcc/3.4.6/240-mips-xgot.patch new file mode 100644 index 0000000..e294670 --- /dev/null +++ b/patches/gcc/3.4.6/240-mips-xgot.patch @@ -0,0 +1,7 @@ +diff -durN gcc-3.4.6.orig/gcc/config/mips/t-linux gcc-3.4.6/gcc/config/mips/t-linux +--- gcc-3.4.6.orig/gcc/config/mips/t-linux 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/gcc/config/mips/t-linux 2007-08-15 23:08:15.000000000 +0200 +@@ -0,0 +1,3 @@ ++# Compile crtbegin/end with xgot so it works for both ++# normal and large GOTs. ++CRTSTUFF_T_CFLAGS = -mxgot diff --git a/patches/gcc/3.4.6/250-nios2.patch b/patches/gcc/3.4.6/250-nios2.patch new file mode 100644 index 0000000..5f0cc14 --- /dev/null +++ b/patches/gcc/3.4.6/250-nios2.patch @@ -0,0 +1,10231 @@ +diff -durN gcc-3.4.6.orig/gcc/combine.c gcc-3.4.6/gcc/combine.c +--- gcc-3.4.6.orig/gcc/combine.c 2005-08-08 20:41:04.000000000 +0200 ++++ gcc-3.4.6/gcc/combine.c 2007-08-15 23:09:36.000000000 +0200 +@@ -4381,6 +4381,14 @@ + mode); + } + ++#ifndef __nios2__ ++/* This screws up Nios II in this test case: ++ ++if (x & 1) ++ return 2; ++else ++ return 3; ++*/ + else if (STORE_FLAG_VALUE == 1 + && new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT + && op1 == const0_rtx +@@ -4392,6 +4400,7 @@ + gen_lowpart_for_combine (mode, op0), + const1_rtx); + } ++#endif + + else if (STORE_FLAG_VALUE == 1 + && new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT +diff -durN gcc-3.4.6.orig/gcc/config/nios2/crti.asm gcc-3.4.6/gcc/config/nios2/crti.asm +--- gcc-3.4.6.orig/gcc/config/nios2/crti.asm 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/gcc/config/nios2/crti.asm 2007-08-15 23:09:36.000000000 +0200 +@@ -0,0 +1,88 @@ ++/* ++ Copyright (C) 2003 ++ by Jonah Graham (jgraham@altera.com) ++ ++This file is free software; you can redistribute it and/or modify it ++under the terms of the GNU General Public License as published by the ++Free Software Foundation; either version 2, or (at your option) any ++later version. ++ ++In addition to the permissions in the GNU General Public License, the ++Free Software Foundation gives you unlimited permission to link the ++compiled version of this file with other programs, and to distribute ++those programs without any restriction coming from the use of this ++file. (The General Public License restrictions do apply in other ++respects; for example, they cover modification of the file, and ++distribution when not linked into another program.) ++ ++This file is distributed in the hope that it will be useful, but ++WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with this program; see the file COPYING. If not, write to ++the Free Software Foundation, 59 Temple Place - Suite 330, ++Boston, MA 02111-1307, USA. ++ ++ As a special exception, if you link this library with files ++ compiled with GCC to produce an executable, this does not cause ++ the resulting executable to be covered by the GNU General Public License. ++ This exception does not however invalidate any other reasons why ++ the executable file might be covered by the GNU General Public License. ++ ++ ++This file just make a stack frame for the contents of the .fini and ++.init sections. Users may put any desired instructions in those ++sections. ++ ++ ++While technically any code can be put in the init and fini sections ++most stuff will not work other than stuff which obeys the call frame ++and ABI. All the call-preserved registers are saved, the call clobbered ++registers should have been saved by the code calling init and fini. ++ ++See crtstuff.c for an example of code that inserts itself in the ++init and fini sections. ++ ++See crt0.s for the code that calls init and fini. ++*/ ++ ++ .file "crti.asm" ++ ++ .section ".init" ++ .align 2 ++ .global _init ++_init: ++ addi sp, sp, -48 ++ stw ra, 44(sp) ++ stw r23, 40(sp) ++ stw r22, 36(sp) ++ stw r21, 32(sp) ++ stw r20, 28(sp) ++ stw r19, 24(sp) ++ stw r18, 20(sp) ++ stw r17, 16(sp) ++ stw r16, 12(sp) ++ stw fp, 8(sp) ++ mov fp, sp ++ ++ ++ .section ".fini" ++ .align 2 ++ .global _fini ++_fini: ++ addi sp, sp, -48 ++ stw ra, 44(sp) ++ stw r23, 40(sp) ++ stw r22, 36(sp) ++ stw r21, 32(sp) ++ stw r20, 28(sp) ++ stw r19, 24(sp) ++ stw r18, 20(sp) ++ stw r17, 16(sp) ++ stw r16, 12(sp) ++ stw fp, 8(sp) ++ mov fp, sp ++ ++ +diff -durN gcc-3.4.6.orig/gcc/config/nios2/crtn.asm gcc-3.4.6/gcc/config/nios2/crtn.asm +--- gcc-3.4.6.orig/gcc/config/nios2/crtn.asm 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/gcc/config/nios2/crtn.asm 2007-08-15 23:09:36.000000000 +0200 +@@ -0,0 +1,70 @@ ++/* ++ Copyright (C) 2003 ++ by Jonah Graham (jgraham@altera.com) ++ ++This file is free software; you can redistribute it and/or modify it ++under the terms of the GNU General Public License as published by the ++Free Software Foundation; either version 2, or (at your option) any ++later version. ++ ++In addition to the permissions in the GNU General Public License, the ++Free Software Foundation gives you unlimited permission to link the ++compiled version of this file with other programs, and to distribute ++those programs without any restriction coming from the use of this ++file. (The General Public License restrictions do apply in other ++respects; for example, they cover modification of the file, and ++distribution when not linked into another program.) ++ ++This file is distributed in the hope that it will be useful, but ++WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with this program; see the file COPYING. If not, write to ++the Free Software Foundation, 59 Temple Place - Suite 330, ++Boston, MA 02111-1307, USA. ++ ++ As a special exception, if you link this library with files ++ compiled with GCC to produce an executable, this does not cause ++ the resulting executable to be covered by the GNU General Public License. ++ This exception does not however invalidate any other reasons why ++ the executable file might be covered by the GNU General Public License. ++ ++ ++This file just makes sure that the .fini and .init sections do in ++fact return. Users may put any desired instructions in those sections. ++This file is the last thing linked into any executable. ++*/ ++ .file "crtn.asm" ++ ++ ++ ++ .section ".init" ++ ldw ra, 44(sp) ++ ldw r23, 40(sp) ++ ldw r22, 36(sp) ++ ldw r21, 32(sp) ++ ldw r20, 28(sp) ++ ldw r19, 24(sp) ++ ldw r18, 20(sp) ++ ldw r17, 16(sp) ++ ldw r16, 12(sp) ++ ldw fp, 8(sp) ++ addi sp, sp, -48 ++ ret ++ ++ .section ".fini" ++ ldw ra, 44(sp) ++ ldw r23, 40(sp) ++ ldw r22, 36(sp) ++ ldw r21, 32(sp) ++ ldw r20, 28(sp) ++ ldw r19, 24(sp) ++ ldw r18, 20(sp) ++ ldw r17, 16(sp) ++ ldw r16, 12(sp) ++ ldw fp, 8(sp) ++ addi sp, sp, -48 ++ ret ++ +diff -durN gcc-3.4.6.orig/gcc/config/nios2/lib2-divmod.c gcc-3.4.6/gcc/config/nios2/lib2-divmod.c +--- gcc-3.4.6.orig/gcc/config/nios2/lib2-divmod.c 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/gcc/config/nios2/lib2-divmod.c 2007-08-15 23:09:36.000000000 +0200 +@@ -0,0 +1,126 @@ ++ ++/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is ++ supposedly valid even though this is a "target" file. */ ++#include "auto-host.h" ++ ++ ++#include "tconfig.h" ++#include "tsystem.h" ++#include "coretypes.h" ++#include "tm.h" ++ ++ ++/* Don't use `fancy_abort' here even if config.h says to use it. */ ++#ifdef abort ++#undef abort ++#endif ++ ++ ++#ifdef HAVE_GAS_HIDDEN ++#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden"))) ++#else ++#define ATTRIBUTE_HIDDEN ++#endif ++ ++#include "libgcc2.h" ++ ++extern SItype __modsi3 (SItype, SItype); ++extern SItype __divsi3 (SItype, SItype); ++extern SItype __umodsi3 (SItype, SItype); ++extern SItype __udivsi3 (SItype, SItype); ++ ++static USItype udivmodsi4(USItype, USItype, word_type); ++ ++/* 16-bit SI divide and modulo as used in NIOS */ ++ ++ ++static USItype ++udivmodsi4(USItype num, USItype den, word_type modwanted) ++{ ++ USItype bit = 1; ++ USItype res = 0; ++ ++ while (den < num && bit && !(den & (1L<<31))) ++ { ++ den <<=1; ++ bit <<=1; ++ } ++ while (bit) ++ { ++ if (num >= den) ++ { ++ num -= den; ++ res |= bit; ++ } ++ bit >>=1; ++ den >>=1; ++ } ++ if (modwanted) return num; ++ return res; ++} ++ ++ ++SItype ++__divsi3 (SItype a, SItype b) ++{ ++ word_type neg = 0; ++ SItype res; ++ ++ if (a < 0) ++ { ++ a = -a; ++ neg = !neg; ++ } ++ ++ if (b < 0) ++ { ++ b = -b; ++ neg = !neg; ++ } ++ ++ res = udivmodsi4 (a, b, 0); ++ ++ if (neg) ++ res = -res; ++ ++ return res; ++} ++ ++ ++SItype ++__modsi3 (SItype a, SItype b) ++{ ++ word_type neg = 0; ++ SItype res; ++ ++ if (a < 0) ++ { ++ a = -a; ++ neg = 1; ++ } ++ ++ if (b < 0) ++ b = -b; ++ ++ res = udivmodsi4 (a, b, 1); ++ ++ if (neg) ++ res = -res; ++ ++ return res; ++} ++ ++ ++SItype ++__udivsi3 (SItype a, SItype b) ++{ ++ return udivmodsi4 (a, b, 0); ++} ++ ++ ++SItype ++__umodsi3 (SItype a, SItype b) ++{ ++ return udivmodsi4 (a, b, 1); ++} ++ +diff -durN gcc-3.4.6.orig/gcc/config/nios2/lib2-divmod-hi.c gcc-3.4.6/gcc/config/nios2/lib2-divmod-hi.c +--- gcc-3.4.6.orig/gcc/config/nios2/lib2-divmod-hi.c 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/gcc/config/nios2/lib2-divmod-hi.c 2007-08-15 23:09:36.000000000 +0200 +@@ -0,0 +1,123 @@ ++ ++/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is ++ supposedly valid even though this is a "target" file. */ ++#include "auto-host.h" ++ ++ ++#include "tconfig.h" ++#include "tsystem.h" ++#include "coretypes.h" ++#include "tm.h" ++ ++ ++/* Don't use `fancy_abort' here even if config.h says to use it. */ ++#ifdef abort ++#undef abort ++#endif ++ ++ ++#ifdef HAVE_GAS_HIDDEN ++#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden"))) ++#else ++#define ATTRIBUTE_HIDDEN ++#endif ++ ++#include "libgcc2.h" ++ ++extern HItype __modhi3 (HItype, HItype); ++extern HItype __divhi3 (HItype, HItype); ++extern HItype __umodhi3 (HItype, HItype); ++extern HItype __udivhi3 (HItype, HItype); ++ ++static UHItype udivmodhi4(UHItype, UHItype, word_type); ++ ++static UHItype ++udivmodhi4(UHItype num, UHItype den, word_type modwanted) ++{ ++ UHItype bit = 1; ++ UHItype res = 0; ++ ++ while (den < num && bit && !(den & (1L<<15))) ++ { ++ den <<=1; ++ bit <<=1; ++ } ++ while (bit) ++ { ++ if (num >= den) ++ { ++ num -= den; ++ res |= bit; ++ } ++ bit >>=1; ++ den >>=1; ++ } ++ if (modwanted) return num; ++ return res; ++} ++ ++ ++HItype ++__divhi3 (HItype a, HItype b) ++{ ++ word_type neg = 0; ++ HItype res; ++ ++ if (a < 0) ++ { ++ a = -a; ++ neg = !neg; ++ } ++ ++ if (b < 0) ++ { ++ b = -b; ++ neg = !neg; ++ } ++ ++ res = udivmodhi4 (a, b, 0); ++ ++ if (neg) ++ res = -res; ++ ++ return res; ++} ++ ++ ++HItype ++__modhi3 (HItype a, HItype b) ++{ ++ word_type neg = 0; ++ HItype res; ++ ++ if (a < 0) ++ { ++ a = -a; ++ neg = 1; ++ } ++ ++ if (b < 0) ++ b = -b; ++ ++ res = udivmodhi4 (a, b, 1); ++ ++ if (neg) ++ res = -res; ++ ++ return res; ++} ++ ++ ++HItype ++__udivhi3 (HItype a, HItype b) ++{ ++ return udivmodhi4 (a, b, 0); ++} ++ ++ ++HItype ++__umodhi3 (HItype a, HItype b) ++{ ++ return udivmodhi4 (a, b, 1); ++} ++ +diff -durN gcc-3.4.6.orig/gcc/config/nios2/lib2-divtable.c gcc-3.4.6/gcc/config/nios2/lib2-divtable.c +--- gcc-3.4.6.orig/gcc/config/nios2/lib2-divtable.c 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/gcc/config/nios2/lib2-divtable.c 2007-08-15 23:09:36.000000000 +0200 +@@ -0,0 +1,46 @@ ++ ++/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is ++ supposedly valid even though this is a "target" file. */ ++#include "auto-host.h" ++ ++ ++#include "tconfig.h" ++#include "tsystem.h" ++#include "coretypes.h" ++#include "tm.h" ++ ++ ++/* Don't use `fancy_abort' here even if config.h says to use it. */ ++#ifdef abort ++#undef abort ++#endif ++ ++ ++#ifdef HAVE_GAS_HIDDEN ++#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden"))) ++#else ++#define ATTRIBUTE_HIDDEN ++#endif ++ ++#include "libgcc2.h" ++ ++UQItype __divsi3_table[] = ++{ ++ 0, 0/1, 0/2, 0/3, 0/4, 0/5, 0/6, 0/7, 0/8, 0/9, 0/10, 0/11, 0/12, 0/13, 0/14, 0/15, ++ 0, 1/1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10, 1/11, 1/12, 1/13, 1/14, 1/15, ++ 0, 2/1, 2/2, 2/3, 2/4, 2/5, 2/6, 2/7, 2/8, 2/9, 2/10, 2/11, 2/12, 2/13, 2/14, 2/15, ++ 0, 3/1, 3/2, 3/3, 3/4, 3/5, 3/6, 3/7, 3/8, 3/9, 3/10, 3/11, 3/12, 3/13, 3/14, 3/15, ++ 0, 4/1, 4/2, 4/3, 4/4, 4/5, 4/6, 4/7, 4/8, 4/9, 4/10, 4/11, 4/12, 4/13, 4/14, 4/15, ++ 0, 5/1, 5/2, 5/3, 5/4, 5/5, 5/6, 5/7, 5/8, 5/9, 5/10, 5/11, 5/12, 5/13, 5/14, 5/15, ++ 0, 6/1, 6/2, 6/3, 6/4, 6/5, 6/6, 6/7, 6/8, 6/9, 6/10, 6/11, 6/12, 6/13, 6/14, 6/15, ++ 0, 7/1, 7/2, 7/3, 7/4, 7/5, 7/6, 7/7, 7/8, 7/9, 7/10, 7/11, 7/12, 7/13, 7/14, 7/15, ++ 0, 8/1, 8/2, 8/3, 8/4, 8/5, 8/6, 8/7, 8/8, 8/9, 8/10, 8/11, 8/12, 8/13, 8/14, 8/15, ++ 0, 9/1, 9/2, 9/3, 9/4, 9/5, 9/6, 9/7, 9/8, 9/9, 9/10, 9/11, 9/12, 9/13, 9/14, 9/15, ++ 0, 10/1, 10/2, 10/3, 10/4, 10/5, 10/6, 10/7, 10/8, 10/9, 10/10, 10/11, 10/12, 10/13, 10/14, 10/15, ++ 0, 11/1, 11/2, 11/3, 11/4, 11/5, 11/6, 11/7, 11/8, 11/9, 11/10, 11/11, 11/12, 11/13, 11/14, 11/15, ++ 0, 12/1, 12/2, 12/3, 12/4, 12/5, 12/6, 12/7, 12/8, 12/9, 12/10, 12/11, 12/12, 12/13, 12/14, 12/15, ++ 0, 13/1, 13/2, 13/3, 13/4, 13/5, 13/6, 13/7, 13/8, 13/9, 13/10, 13/11, 13/12, 13/13, 13/14, 13/15, ++ 0, 14/1, 14/2, 14/3, 14/4, 14/5, 14/6, 14/7, 14/8, 14/9, 14/10, 14/11, 14/12, 14/13, 14/14, 14/15, ++ 0, 15/1, 15/2, 15/3, 15/4, 15/5, 15/6, 15/7, 15/8, 15/9, 15/10, 15/11, 15/12, 15/13, 15/14, 15/15, ++}; ++ +diff -durN gcc-3.4.6.orig/gcc/config/nios2/lib2-mul.c gcc-3.4.6/gcc/config/nios2/lib2-mul.c +--- gcc-3.4.6.orig/gcc/config/nios2/lib2-mul.c 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/gcc/config/nios2/lib2-mul.c 2007-08-15 23:09:36.000000000 +0200 +@@ -0,0 +1,103 @@ ++/* while we are debugging (ie compile outside of gcc build) ++ disable gcc specific headers */ ++#ifndef DEBUG_MULSI3 ++ ++ ++/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is ++ supposedly valid even though this is a "target" file. */ ++#include "auto-host.h" ++ ++ ++#include "tconfig.h" ++#include "tsystem.h" ++#include "coretypes.h" ++#include "tm.h" ++ ++ ++/* Don't use `fancy_abort' here even if config.h says to use it. */ ++#ifdef abort ++#undef abort ++#endif ++ ++ ++#ifdef HAVE_GAS_HIDDEN ++#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden"))) ++#else ++#define ATTRIBUTE_HIDDEN ++#endif ++ ++#include "libgcc2.h" ++ ++#else ++#define SItype int ++#define USItype unsigned int ++#endif ++ ++ ++extern SItype __mulsi3 (SItype, SItype); ++ ++SItype ++__mulsi3 (SItype a, SItype b) ++{ ++ SItype res = 0; ++ USItype cnt = a; ++ ++ while (cnt) ++ { ++ if (cnt & 1) ++ { ++ res += b; ++ } ++ b <<= 1; ++ cnt >>= 1; ++ } ++ ++ return res; ++} ++/* ++TODO: Choose best alternative implementation. ++ ++SItype ++__divsi3 (SItype a, SItype b) ++{ ++ SItype res = 0; ++ USItype cnt = 0; ++ ++ while (cnt < 32) ++ { ++ if (a & (1L << cnt)) ++ { ++ res += b; ++ } ++ b <<= 1; ++ cnt++; ++ } ++ ++ return res; ++} ++*/ ++ ++ ++#ifdef DEBUG_MULSI3 ++ ++int ++main () ++{ ++ int i, j; ++ int error = 0; ++ ++ for (i = -1000; i < 1000; i++) ++ for (j = -1000; j < 1000; j++) ++ { ++ int expect = i * j; ++ int actual = A__divsi3 (i, j); ++ if (expect != actual) ++ { ++ printf ("error: %d * %d = %d not %d\n", i, j, expect, actual); ++ error = 1; ++ } ++ } ++ ++ return error; ++} ++#endif +diff -durN gcc-3.4.6.orig/gcc/config/nios2/nios2.c gcc-3.4.6/gcc/config/nios2/nios2.c +--- gcc-3.4.6.orig/gcc/config/nios2/nios2.c 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/gcc/config/nios2/nios2.c 2007-08-15 23:09:36.000000000 +0200 +@@ -0,0 +1,2853 @@ ++/* Subroutines for assembler code output for Altera NIOS 2G NIOS2 version. ++ Copyright (C) 2003 Altera ++ Contributed by Jonah Graham (jgraham@altera.com). ++ ++This file is part of GNU CC. ++ ++GNU CC is free software; you can redistribute it and/or modify ++it under the terms of the GNU General Public License as published by ++the Free Software Foundation; either version 2, or (at your option) ++any later version. ++ ++GNU CC is distributed in the hope that it will be useful, ++but WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++GNU General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GNU CC; see the file COPYING. If not, write to ++the Free Software Foundation, 59 Temple Place - Suite 330, ++Boston, MA 02111-1307, USA. */ ++ ++ ++#include ++#include "config.h" ++#include "system.h" ++#include "coretypes.h" ++#include "tm.h" ++#include "rtl.h" ++#include "tree.h" ++#include "tm_p.h" ++#include "regs.h" ++#include "hard-reg-set.h" ++#include "real.h" ++#include "insn-config.h" ++#include "conditions.h" ++#include "output.h" ++#include "insn-attr.h" ++#include "flags.h" ++#include "recog.h" ++#include "expr.h" ++#include "toplev.h" ++#include "basic-block.h" ++#include "function.h" ++#include "ggc.h" ++#include "reload.h" ++#include "debug.h" ++#include "optabs.h" ++#include "target.h" ++#include "target-def.h" ++ ++/* local prototypes */ ++static bool nios2_rtx_costs (rtx, int, int, int *); ++ ++static void nios2_asm_function_prologue (FILE *, HOST_WIDE_INT); ++static int nios2_use_dfa_pipeline_interface (void); ++static int nios2_issue_rate (void); ++static struct machine_function *nios2_init_machine_status (void); ++static bool nios2_in_small_data_p (tree); ++static rtx save_reg (int, HOST_WIDE_INT, rtx); ++static rtx restore_reg (int, HOST_WIDE_INT); ++static unsigned int nios2_section_type_flags (tree, const char *, int); ++static void nios2_init_builtins (void); ++static rtx nios2_expand_builtin (tree, rtx, rtx, enum machine_mode, int); ++static bool nios2_function_ok_for_sibcall (tree, tree); ++static void nios2_encode_section_info (tree, rtx, int); ++ ++/* Initialize the GCC target structure. */ ++#undef TARGET_ASM_FUNCTION_PROLOGUE ++#define TARGET_ASM_FUNCTION_PROLOGUE nios2_asm_function_prologue ++ ++#undef TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE ++#define TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE \ ++ nios2_use_dfa_pipeline_interface ++#undef TARGET_SCHED_ISSUE_RATE ++#define TARGET_SCHED_ISSUE_RATE nios2_issue_rate ++#undef TARGET_IN_SMALL_DATA_P ++#define TARGET_IN_SMALL_DATA_P nios2_in_small_data_p ++#undef TARGET_ENCODE_SECTION_INFO ++#define TARGET_ENCODE_SECTION_INFO nios2_encode_section_info ++#undef TARGET_SECTION_TYPE_FLAGS ++#define TARGET_SECTION_TYPE_FLAGS nios2_section_type_flags ++ ++#undef TARGET_INIT_BUILTINS ++#define TARGET_INIT_BUILTINS nios2_init_builtins ++#undef TARGET_EXPAND_BUILTIN ++#define TARGET_EXPAND_BUILTIN nios2_expand_builtin ++ ++#undef TARGET_FUNCTION_OK_FOR_SIBCALL ++#define TARGET_FUNCTION_OK_FOR_SIBCALL nios2_function_ok_for_sibcall ++ ++#undef TARGET_RTX_COSTS ++#define TARGET_RTX_COSTS nios2_rtx_costs ++ ++ ++struct gcc_target targetm = TARGET_INITIALIZER; ++ ++ ++ ++/* Threshold for data being put into the small data/bss area, instead ++ of the normal data area (references to the small data/bss area take ++ 1 instruction, and use the global pointer, references to the normal ++ data area takes 2 instructions). */ ++unsigned HOST_WIDE_INT nios2_section_threshold = NIOS2_DEFAULT_GVALUE; ++ ++ ++/* Structure to be filled in by compute_frame_size with register ++ save masks, and offsets for the current function. */ ++ ++struct nios2_frame_info ++GTY (()) ++{ ++ long total_size; /* # bytes that the entire frame takes up */ ++ long var_size; /* # bytes that variables take up */ ++ long args_size; /* # bytes that outgoing arguments take up */ ++ int save_reg_size; /* # bytes needed to store gp regs */ ++ int save_reg_rounded; /* # bytes needed to store gp regs */ ++ long save_regs_offset; /* offset from new sp to store gp registers */ ++ int initialized; /* != 0 if frame size already calculated */ ++ int num_regs; /* number of gp registers saved */ ++}; ++ ++struct machine_function ++GTY (()) ++{ ++ ++ /* Current frame information, calculated by compute_frame_size. */ ++ struct nios2_frame_info frame; ++}; ++ ++ ++/*************************************** ++ * Section encodings ++ ***************************************/ ++ ++ ++ ++ ++ ++/*************************************** ++ * Stack Layout and Calling Conventions ++ ***************************************/ ++ ++ ++#define TOO_BIG_OFFSET(X) ((X) > ((1 << 15) - 1)) ++#define TEMP_REG_NUM 8 ++ ++static void ++nios2_asm_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED) ++{ ++ if (flag_verbose_asm || flag_debug_asm) ++ { ++ compute_frame_size (); ++ dump_frame_size (file); ++ } ++} ++ ++static rtx ++save_reg (int regno, HOST_WIDE_INT offset, rtx cfa_store_reg) ++{ ++ rtx insn, stack_slot; ++ ++ stack_slot = gen_rtx_PLUS (SImode, ++ cfa_store_reg, ++ GEN_INT (offset)); ++ ++ insn = emit_insn (gen_rtx_SET (SImode, ++ gen_rtx_MEM (SImode, stack_slot), ++ gen_rtx_REG (SImode, regno))); ++ ++ RTX_FRAME_RELATED_P (insn) = 1; ++ ++ return insn; ++} ++ ++static rtx ++restore_reg (int regno, HOST_WIDE_INT offset) ++{ ++ rtx insn, stack_slot; ++ ++ if (TOO_BIG_OFFSET (offset)) ++ { ++ stack_slot = gen_rtx_REG (SImode, TEMP_REG_NUM); ++ insn = emit_insn (gen_rtx_SET (SImode, ++ stack_slot, ++ GEN_INT (offset))); ++ ++ insn = emit_insn (gen_rtx_SET (SImode, ++ stack_slot, ++ gen_rtx_PLUS (SImode, ++ stack_slot, ++ stack_pointer_rtx))); ++ } ++ else ++ { ++ stack_slot = gen_rtx_PLUS (SImode, ++ stack_pointer_rtx, ++ GEN_INT (offset)); ++ } ++ ++ stack_slot = gen_rtx_MEM (SImode, stack_slot); ++ ++ insn = emit_move_insn (gen_rtx_REG (SImode, regno), stack_slot); ++ ++ return insn; ++} ++ ++ ++/* There are two possible paths for prologue expansion, ++- the first is if the total frame size is < 2^15-1. In that ++case all the immediates will fit into the 16-bit immediate ++fields. ++- the second is when the frame size is too big, in that ++case an additional temporary register is used, first ++as a cfa_temp to offset the sp, second as the cfa_store ++register. ++ ++See the comment above dwarf2out_frame_debug_expr in ++dwarf2out.c for more explanation of the "rules." ++ ++ ++Case 1: ++Rule # Example Insn Effect ++2 addi sp, sp, -total_frame_size cfa.reg=sp, cfa.offset=total_frame_size ++ cfa_store.reg=sp, cfa_store.offset=total_frame_size ++12 stw ra, offset(sp) ++12 stw r16, offset(sp) ++1 mov fp, sp ++ ++Case 2: ++Rule # Example Insn Effect ++6 movi r8, total_frame_size cfa_temp.reg=r8, cfa_temp.offset=total_frame_size ++2 sub sp, sp, r8 cfa.reg=sp, cfa.offset=total_frame_size ++ cfa_store.reg=sp, cfa_store.offset=total_frame_size ++5 add r8, r8, sp cfa_store.reg=r8, cfa_store.offset=0 ++12 stw ra, offset(r8) ++12 stw r16, offset(r8) ++1 mov fp, sp ++ ++*/ ++ ++void ++expand_prologue () ++{ ++ int i; ++ HOST_WIDE_INT total_frame_size; ++ int cfa_store_offset; ++ rtx insn; ++ rtx cfa_store_reg = 0; ++ ++ total_frame_size = compute_frame_size (); ++ ++ if (total_frame_size) ++ { ++ ++ if (TOO_BIG_OFFSET (total_frame_size)) ++ { ++ /* cfa_temp and cfa_store_reg are the same register, ++ cfa_store_reg overwrites cfa_temp */ ++ cfa_store_reg = gen_rtx_REG (SImode, TEMP_REG_NUM); ++ insn = emit_insn (gen_rtx_SET (SImode, ++ cfa_store_reg, ++ GEN_INT (total_frame_size))); ++ ++ RTX_FRAME_RELATED_P (insn) = 1; ++ ++ ++ insn = gen_rtx_SET (SImode, ++ stack_pointer_rtx, ++ gen_rtx_MINUS (SImode, ++ stack_pointer_rtx, ++ cfa_store_reg)); ++ ++ insn = emit_insn (insn); ++ RTX_FRAME_RELATED_P (insn) = 1; ++ ++ ++ /* if there are no registers to save, I don't need to ++ create a cfa_store */ ++ if (cfun->machine->frame.save_reg_size) ++ { ++ insn = gen_rtx_SET (SImode, ++ cfa_store_reg, ++ gen_rtx_PLUS (SImode, ++ cfa_store_reg, ++ stack_pointer_rtx)); ++ ++ insn = emit_insn (insn); ++ RTX_FRAME_RELATED_P (insn) = 1; ++ } ++ ++ cfa_store_offset ++ = total_frame_size ++ - (cfun->machine->frame.save_regs_offset ++ + cfun->machine->frame.save_reg_rounded); ++ } ++ else ++ { ++ insn = gen_rtx_SET (SImode, ++ stack_pointer_rtx, ++ gen_rtx_PLUS (SImode, ++ stack_pointer_rtx, ++ GEN_INT (-total_frame_size))); ++ insn = emit_insn (insn); ++ RTX_FRAME_RELATED_P (insn) = 1; ++ ++ cfa_store_reg = stack_pointer_rtx; ++ cfa_store_offset ++ = cfun->machine->frame.save_regs_offset ++ + cfun->machine->frame.save_reg_rounded; ++ } ++ } ++ ++ if (MUST_SAVE_REGISTER (RA_REGNO)) ++ { ++ cfa_store_offset -= 4; ++ save_reg (RA_REGNO, cfa_store_offset, cfa_store_reg); ++ } ++ if (MUST_SAVE_REGISTER (FP_REGNO)) ++ { ++ cfa_store_offset -= 4; ++ save_reg (FP_REGNO, cfa_store_offset, cfa_store_reg); ++ } ++ ++ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) ++ { ++ if (MUST_SAVE_REGISTER (i) && i != FP_REGNO && i != RA_REGNO) ++ { ++ cfa_store_offset -= 4; ++ save_reg (i, cfa_store_offset, cfa_store_reg); ++ } ++ } ++ ++ if (frame_pointer_needed) ++ { ++ insn = emit_insn (gen_rtx_SET (SImode, ++ gen_rtx_REG (SImode, FP_REGNO), ++ gen_rtx_REG (SImode, SP_REGNO))); ++ ++ RTX_FRAME_RELATED_P (insn) = 1; ++ } ++ ++ /* If we are profiling, make sure no instructions are scheduled before ++ the call to mcount. */ ++ if (current_function_profile) ++ emit_insn (gen_blockage ()); ++} ++ ++void ++expand_epilogue (bool sibcall_p) ++{ ++ rtx insn; ++ int i; ++ HOST_WIDE_INT total_frame_size; ++ int register_store_offset; ++ ++ total_frame_size = compute_frame_size (); ++ ++ if (!sibcall_p && nios2_can_use_return_insn ()) ++ { ++ insn = emit_jump_insn (gen_return ()); ++ return; ++ } ++ ++ emit_insn (gen_blockage ()); ++ ++ register_store_offset = ++ cfun->machine->frame.save_regs_offset + ++ cfun->machine->frame.save_reg_rounded; ++ ++ if (MUST_SAVE_REGISTER (RA_REGNO)) ++ { ++ register_store_offset -= 4; ++ restore_reg (RA_REGNO, register_store_offset); ++ } ++ ++ if (MUST_SAVE_REGISTER (FP_REGNO)) ++ { ++ register_store_offset -= 4; ++ restore_reg (FP_REGNO, register_store_offset); ++ } ++ ++ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) ++ { ++ if (MUST_SAVE_REGISTER (i) && i != FP_REGNO && i != RA_REGNO) ++ { ++ register_store_offset -= 4; ++ restore_reg (i, register_store_offset); ++ } ++ } ++ ++ if (total_frame_size) ++ { ++ rtx sp_adjust; ++ ++ if (TOO_BIG_OFFSET (total_frame_size)) ++ { ++ sp_adjust = gen_rtx_REG (SImode, TEMP_REG_NUM); ++ insn = emit_insn (gen_rtx_SET (SImode, ++ sp_adjust, ++ GEN_INT (total_frame_size))); ++ ++ } ++ else ++ { ++ sp_adjust = GEN_INT (total_frame_size); ++ } ++ ++ insn = gen_rtx_SET (SImode, ++ stack_pointer_rtx, ++ gen_rtx_PLUS (SImode, ++ stack_pointer_rtx, ++ sp_adjust)); ++ insn = emit_insn (insn); ++ } ++ ++ ++ if (!sibcall_p) ++ { ++ insn = emit_jump_insn (gen_return_from_epilogue (gen_rtx (REG, Pmode, ++ RA_REGNO))); ++ } ++} ++ ++ ++bool ++nios2_function_ok_for_sibcall (tree a ATTRIBUTE_UNUSED, tree b ATTRIBUTE_UNUSED) ++{ ++ return true; ++} ++ ++ ++ ++ ++ ++/* ----------------------- * ++ * Profiling ++ * ----------------------- */ ++ ++void ++function_profiler (FILE *file, int labelno) ++{ ++ fprintf (file, "\t%s mcount begin, label: .LP%d\n", ++ ASM_COMMENT_START, labelno); ++ fprintf (file, "\tnextpc\tr8\n"); ++ fprintf (file, "\tmov\tr9, ra\n"); ++ fprintf (file, "\tmovhi\tr10, %%hiadj(.LP%d)\n", labelno); ++ fprintf (file, "\taddi\tr10, r10, %%lo(.LP%d)\n", labelno); ++ fprintf (file, "\tcall\tmcount\n"); ++ fprintf (file, "\tmov\tra, r9\n"); ++ fprintf (file, "\t%s mcount end\n", ASM_COMMENT_START); ++} ++ ++ ++/*************************************** ++ * Stack Layout ++ ***************************************/ ++ ++ ++void ++dump_frame_size (FILE *file) ++{ ++ fprintf (file, "\t%s Current Frame Info\n", ASM_COMMENT_START); ++ ++ fprintf (file, "\t%s total_size = %ld\n", ASM_COMMENT_START, ++ cfun->machine->frame.total_size); ++ fprintf (file, "\t%s var_size = %ld\n", ASM_COMMENT_START, ++ cfun->machine->frame.var_size); ++ fprintf (file, "\t%s args_size = %ld\n", ASM_COMMENT_START, ++ cfun->machine->frame.args_size); ++ fprintf (file, "\t%s save_reg_size = %d\n", ASM_COMMENT_START, ++ cfun->machine->frame.save_reg_size); ++ fprintf (file, "\t%s save_reg_rounded = %d\n", ASM_COMMENT_START, ++ cfun->machine->frame.save_reg_rounded); ++ fprintf (file, "\t%s initialized = %d\n", ASM_COMMENT_START, ++ cfun->machine->frame.initialized); ++ fprintf (file, "\t%s num_regs = %d\n", ASM_COMMENT_START, ++ cfun->machine->frame.num_regs); ++ fprintf (file, "\t%s save_regs_offset = %ld\n", ASM_COMMENT_START, ++ cfun->machine->frame.save_regs_offset); ++ fprintf (file, "\t%s current_function_is_leaf = %d\n", ASM_COMMENT_START, ++ current_function_is_leaf); ++ fprintf (file, "\t%s frame_pointer_needed = %d\n", ASM_COMMENT_START, ++ frame_pointer_needed); ++ fprintf (file, "\t%s pretend_args_size = %d\n", ASM_COMMENT_START, ++ current_function_pretend_args_size); ++ ++} ++ ++ ++/* Return the bytes needed to compute the frame pointer from the current ++ stack pointer. ++*/ ++ ++HOST_WIDE_INT ++compute_frame_size () ++{ ++ unsigned int regno; ++ HOST_WIDE_INT var_size; /* # of var. bytes allocated */ ++ HOST_WIDE_INT total_size; /* # bytes that the entire frame takes up */ ++ HOST_WIDE_INT save_reg_size; /* # bytes needed to store callee save regs */ ++ HOST_WIDE_INT save_reg_rounded; ++ /* # bytes needed to store callee save regs (rounded) */ ++ HOST_WIDE_INT out_args_size; /* # bytes needed for outgoing args */ ++ ++ save_reg_size = 0; ++ var_size = STACK_ALIGN (get_frame_size ()); ++ out_args_size = STACK_ALIGN (current_function_outgoing_args_size); ++ ++ total_size = var_size + out_args_size; ++ ++ /* Calculate space needed for gp registers. */ ++ for (regno = 0; regno <= FIRST_PSEUDO_REGISTER; regno++) ++ { ++ if (MUST_SAVE_REGISTER (regno)) ++ { ++ save_reg_size += 4; ++ } ++ } ++ ++ save_reg_rounded = STACK_ALIGN (save_reg_size); ++ total_size += save_reg_rounded; ++ ++ total_size += STACK_ALIGN (current_function_pretend_args_size); ++ ++ /* Save other computed information. */ ++ cfun->machine->frame.total_size = total_size; ++ cfun->machine->frame.var_size = var_size; ++ cfun->machine->frame.args_size = current_function_outgoing_args_size; ++ cfun->machine->frame.save_reg_size = save_reg_size; ++ cfun->machine->frame.save_reg_rounded = save_reg_rounded; ++ cfun->machine->frame.initialized = reload_completed; ++ cfun->machine->frame.num_regs = save_reg_size / UNITS_PER_WORD; ++ ++ cfun->machine->frame.save_regs_offset ++ = save_reg_rounded ? current_function_outgoing_args_size + var_size : 0; ++ ++ return total_size; ++} ++ ++ ++int ++nios2_initial_elimination_offset (int from, int to ATTRIBUTE_UNUSED) ++{ ++ int offset; ++ ++ /* Set OFFSET to the offset from the stack pointer. */ ++ switch (from) ++ { ++ case FRAME_POINTER_REGNUM: ++ offset = 0; ++ break; ++ ++ case ARG_POINTER_REGNUM: ++ compute_frame_size (); ++ offset = cfun->machine->frame.total_size; ++ offset -= current_function_pretend_args_size; ++ break; ++ ++ case RETURN_ADDRESS_POINTER_REGNUM: ++ compute_frame_size (); ++ /* since the return address is always the first of the ++ saved registers, return the offset to the beginning ++ of the saved registers block */ ++ offset = cfun->machine->frame.save_regs_offset; ++ break; ++ ++ default: ++ abort (); ++ } ++ ++ return offset; ++} ++ ++/* Return nonzero if this function is known to have a null epilogue. ++ This allows the optimizer to omit jumps to jumps if no stack ++ was created. */ ++int ++nios2_can_use_return_insn () ++{ ++ if (!reload_completed) ++ return 0; ++ ++ if (regs_ever_live[RA_REGNO] || current_function_profile) ++ return 0; ++ ++ if (cfun->machine->frame.initialized) ++ return cfun->machine->frame.total_size == 0; ++ ++ return compute_frame_size () == 0; ++} ++ ++ ++ ++ ++ ++/*************************************** ++ * ++ ***************************************/ ++ ++const char *nios2_sys_nosys_string; /* for -msys=nosys */ ++const char *nios2_sys_lib_string; /* for -msys-lib= */ ++const char *nios2_sys_crt0_string; /* for -msys-crt0= */ ++ ++void ++override_options () ++{ ++ /* Function to allocate machine-dependent function status. */ ++ init_machine_status = &nios2_init_machine_status; ++ ++ nios2_section_threshold ++ = g_switch_set ? g_switch_value : NIOS2_DEFAULT_GVALUE; ++ ++ if (nios2_sys_nosys_string && *nios2_sys_nosys_string) ++ { ++ error ("invalid option '-msys=nosys%s'", nios2_sys_nosys_string); ++ } ++ ++ /* If we don't have mul, we don't have mulx either! */ ++ if (!TARGET_HAS_MUL && TARGET_HAS_MULX) ++ { ++ target_flags &= ~HAS_MULX_FLAG; ++ } ++ ++} ++ ++void ++optimization_options (int level, int size) ++{ ++ if (level || size) ++ { ++ target_flags |= INLINE_MEMCPY_FLAG; ++ } ++ ++ if (level >= 3 && !size) ++ { ++ target_flags |= FAST_SW_DIV_FLAG; ++ } ++} ++ ++/* Allocate a chunk of memory for per-function machine-dependent data. */ ++static struct machine_function * ++nios2_init_machine_status () ++{ ++ return ((struct machine_function *) ++ ggc_alloc_cleared (sizeof (struct machine_function))); ++} ++ ++ ++ ++/***************** ++ * Describing Relative Costs of Operations ++ *****************/ ++ ++/* Compute a (partial) cost for rtx X. Return true if the complete ++ cost has been computed, and false if subexpressions should be ++ scanned. In either case, *TOTAL contains the cost result. */ ++ ++ ++ ++static bool ++nios2_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) ++{ ++ switch (code) ++ { ++ case CONST_INT: ++ if (INTVAL (x) == 0) ++ { ++ *total = COSTS_N_INSNS (0); ++ return true; ++ } ++ else if (SMALL_INT (INTVAL (x)) ++ || SMALL_INT_UNSIGNED (INTVAL (x)) ++ || UPPER16_INT (INTVAL (x))) ++ { ++ *total = COSTS_N_INSNS (2); ++ return true; ++ } ++ else ++ { ++ *total = COSTS_N_INSNS (4); ++ return true; ++ } ++ ++ case LABEL_REF: ++ case SYMBOL_REF: ++ /* ??? gp relative stuff will fit in here */ ++ /* fall through */ ++ case CONST: ++ case CONST_DOUBLE: ++ { ++ *total = COSTS_N_INSNS (4); ++ return true; ++ } ++ ++ case MULT: ++ { ++ *total = COSTS_N_INSNS (1); ++ return false; ++ } ++ case SIGN_EXTEND: ++ { ++ *total = COSTS_N_INSNS (3); ++ return false; ++ } ++ case ZERO_EXTEND: ++ { ++ *total = COSTS_N_INSNS (1); ++ return false; ++ } ++ ++ default: ++ return false; ++ } ++} ++ ++ ++/*************************************** ++ * INSTRUCTION SUPPORT ++ * ++ * These functions are used within the Machine Description to ++ * handle common or complicated output and expansions from ++ * instructions. ++ ***************************************/ ++ ++int ++nios2_emit_move_sequence (rtx *operands, enum machine_mode mode) ++{ ++ rtx to = operands[0]; ++ rtx from = operands[1]; ++ ++ if (!register_operand (to, mode) && !reg_or_0_operand (from, mode)) ++ { ++ if (no_new_pseudos) ++ internal_error ("Trying to force_reg no_new_pseudos == 1"); ++ from = copy_to_mode_reg (mode, from); ++ } ++ ++ operands[0] = to; ++ operands[1] = from; ++ return 0; ++} ++ ++/* Divide Support */ ++ ++/* ++ If -O3 is used, we want to output a table lookup for ++ divides between small numbers (both num and den >= 0 ++ and < 0x10). The overhead of this method in the worse ++ case is 40 bytes in the text section (10 insns) and ++ 256 bytes in the data section. Additional divides do ++ not incur additional penalties in the data section. ++ ++ Code speed is improved for small divides by about 5x ++ when using this method in the worse case (~9 cycles ++ vs ~45). And in the worse case divides not within the ++ table are penalized by about 10% (~5 cycles vs ~45). ++ However in the typical case the penalty is not as bad ++ because doing the long divide in only 45 cycles is ++ quite optimistic. ++ ++ ??? It would be nice to have some benchmarks other ++ than Dhrystone to back this up. ++ ++ This bit of expansion is to create this instruction ++ sequence as rtl. ++ or $8, $4, $5 ++ slli $9, $4, 4 ++ cmpgeui $3, $8, 16 ++ beq $3, $0, .L3 ++ or $10, $9, $5 ++ add $12, $11, divide_table ++ ldbu $2, 0($12) ++ br .L1 ++.L3: ++ call slow_div ++.L1: ++# continue here with result in $2 ++ ++ ??? Ideally I would like the emit libcall block to contain ++ all of this code, but I don't know how to do that. What it ++ means is that if the divide can be eliminated, it may not ++ completely disappear. ++ ++ ??? The __divsi3_table label should ideally be moved out ++ of this block and into a global. If it is placed into the ++ sdata section we can save even more cycles by doing things ++ gp relative. ++*/ ++int ++nios2_emit_expensive_div (rtx *operands, enum machine_mode mode) ++{ ++ rtx or_result, shift_left_result; ++ rtx lookup_value; ++ rtx lab1, lab3; ++ rtx insns; ++ rtx libfunc; ++ rtx final_result; ++ rtx tmp; ++ ++ /* it may look a little generic, but only SImode ++ is supported for now */ ++ if (mode != SImode) ++ abort (); ++ ++ libfunc = sdiv_optab->handlers[(int) SImode].libfunc; ++ ++ ++ ++ lab1 = gen_label_rtx (); ++ lab3 = gen_label_rtx (); ++ ++ or_result = expand_simple_binop (SImode, IOR, ++ operands[1], operands[2], ++ 0, 0, OPTAB_LIB_WIDEN); ++ ++ emit_cmp_and_jump_insns (or_result, GEN_INT (15), GTU, 0, ++ GET_MODE (or_result), 0, lab3); ++ JUMP_LABEL (get_last_insn ()) = lab3; ++ ++ shift_left_result = expand_simple_binop (SImode, ASHIFT, ++ operands[1], GEN_INT (4), ++ 0, 0, OPTAB_LIB_WIDEN); ++ ++ lookup_value = expand_simple_binop (SImode, IOR, ++ shift_left_result, operands[2], ++ 0, 0, OPTAB_LIB_WIDEN); ++ ++ convert_move (operands[0], ++ gen_rtx (MEM, QImode, ++ gen_rtx (PLUS, SImode, ++ lookup_value, ++ gen_rtx_SYMBOL_REF (SImode, "__divsi3_table"))), ++ 1); ++ ++ ++ tmp = emit_jump_insn (gen_jump (lab1)); ++ JUMP_LABEL (tmp) = lab1; ++ emit_barrier (); ++ ++ emit_label (lab3); ++ LABEL_NUSES (lab3) = 1; ++ ++ start_sequence (); ++ final_result = emit_library_call_value (libfunc, NULL_RTX, ++ LCT_CONST, SImode, 2, ++ operands[1], SImode, ++ operands[2], SImode); ++ ++ ++ insns = get_insns (); ++ end_sequence (); ++ emit_libcall_block (insns, operands[0], final_result, ++ gen_rtx (DIV, SImode, operands[1], operands[2])); ++ ++ emit_label (lab1); ++ LABEL_NUSES (lab1) = 1; ++ return 1; ++} ++ ++/* Branches/Compares */ ++ ++/* the way of handling branches/compares ++ in gcc is heavily borrowed from MIPS */ ++ ++enum internal_test ++{ ++ ITEST_EQ, ++ ITEST_NE, ++ ITEST_GT, ++ ITEST_GE, ++ ITEST_LT, ++ ITEST_LE, ++ ITEST_GTU, ++ ITEST_GEU, ++ ITEST_LTU, ++ ITEST_LEU, ++ ITEST_MAX ++}; ++ ++static enum internal_test map_test_to_internal_test (enum rtx_code); ++ ++/* Cached operands, and operator to compare for use in set/branch/trap ++ on condition codes. */ ++rtx branch_cmp[2]; ++enum cmp_type branch_type; ++ ++/* Make normal rtx_code into something we can index from an array */ ++ ++static enum internal_test ++map_test_to_internal_test (enum rtx_code test_code) ++{ ++ enum internal_test test = ITEST_MAX; ++ ++ switch (test_code) ++ { ++ case EQ: ++ test = ITEST_EQ; ++ break; ++ case NE: ++ test = ITEST_NE; ++ break; ++ case GT: ++ test = ITEST_GT; ++ break; ++ case GE: ++ test = ITEST_GE; ++ break; ++ case LT: ++ test = ITEST_LT; ++ break; ++ case LE: ++ test = ITEST_LE; ++ break; ++ case GTU: ++ test = ITEST_GTU; ++ break; ++ case GEU: ++ test = ITEST_GEU; ++ break; ++ case LTU: ++ test = ITEST_LTU; ++ break; ++ case LEU: ++ test = ITEST_LEU; ++ break; ++ default: ++ break; ++ } ++ ++ return test; ++} ++ ++/* Generate the code to compare (and possibly branch) two integer values ++ TEST_CODE is the comparison code we are trying to emulate ++ (or implement directly) ++ RESULT is where to store the result of the comparison, ++ or null to emit a branch ++ CMP0 CMP1 are the two comparison operands ++ DESTINATION is the destination of the branch, or null to only compare ++ */ ++ ++void ++gen_int_relational (enum rtx_code test_code, /* relational test (EQ, etc) */ ++ rtx result, /* result to store comp. or 0 if branch */ ++ rtx cmp0, /* first operand to compare */ ++ rtx cmp1, /* second operand to compare */ ++ rtx destination) /* destination of the branch, or 0 if compare */ ++{ ++ struct cmp_info ++ { ++ /* for register (or 0) compares */ ++ enum rtx_code test_code_reg; /* code to use in instruction (LT vs. LTU) */ ++ int reverse_regs; /* reverse registers in test */ ++ ++ /* for immediate compares */ ++ enum rtx_code test_code_const; ++ /* code to use in instruction (LT vs. LTU) */ ++ int const_low; /* low bound of constant we can accept */ ++ int const_high; /* high bound of constant we can accept */ ++ int const_add; /* constant to add */ ++ ++ /* generic info */ ++ int unsignedp; /* != 0 for unsigned comparisons. */ ++ }; ++ ++ static const struct cmp_info info[(int) ITEST_MAX] = { ++ ++ {EQ, 0, EQ, -32768, 32767, 0, 0}, /* EQ */ ++ {NE, 0, NE, -32768, 32767, 0, 0}, /* NE */ ++ ++ {LT, 1, GE, -32769, 32766, 1, 0}, /* GT */ ++ {GE, 0, GE, -32768, 32767, 0, 0}, /* GE */ ++ {LT, 0, LT, -32768, 32767, 0, 0}, /* LT */ ++ {GE, 1, LT, -32769, 32766, 1, 0}, /* LE */ ++ ++ {LTU, 1, GEU, 0, 65534, 1, 0}, /* GTU */ ++ {GEU, 0, GEU, 0, 65535, 0, 0}, /* GEU */ ++ {LTU, 0, LTU, 0, 65535, 0, 0}, /* LTU */ ++ {GEU, 1, LTU, 0, 65534, 1, 0}, /* LEU */ ++ }; ++ ++ enum internal_test test; ++ enum machine_mode mode; ++ const struct cmp_info *p_info; ++ int branch_p; ++ ++ ++ ++ ++ test = map_test_to_internal_test (test_code); ++ if (test == ITEST_MAX) ++ abort (); ++ ++ p_info = &info[(int) test]; ++ ++ mode = GET_MODE (cmp0); ++ if (mode == VOIDmode) ++ mode = GET_MODE (cmp1); ++ ++ branch_p = (destination != 0); ++ ++ /* We can't, under any circumstances, have const_ints in cmp0 ++ ??? Actually we could have const0 */ ++ if (GET_CODE (cmp0) == CONST_INT) ++ cmp0 = force_reg (mode, cmp0); ++ ++ /* if the comparison is against an int not in legal range ++ move it into a register */ ++ if (GET_CODE (cmp1) == CONST_INT) ++ { ++ HOST_WIDE_INT value = INTVAL (cmp1); ++ ++ if (value < p_info->const_low || value > p_info->const_high) ++ cmp1 = force_reg (mode, cmp1); ++ } ++ ++ /* Comparison to constants, may involve adding 1 to change a GT into GE. ++ Comparison between two registers, may involve switching operands. */ ++ if (GET_CODE (cmp1) == CONST_INT) ++ { ++ if (p_info->const_add != 0) ++ { ++ HOST_WIDE_INT new = INTVAL (cmp1) + p_info->const_add; ++ ++ /* If modification of cmp1 caused overflow, ++ we would get the wrong answer if we follow the usual path; ++ thus, x > 0xffffffffU would turn into x > 0U. */ ++ if ((p_info->unsignedp ++ ? (unsigned HOST_WIDE_INT) new > ++ (unsigned HOST_WIDE_INT) INTVAL (cmp1) ++ : new > INTVAL (cmp1)) != (p_info->const_add > 0)) ++ { ++ /* ??? This case can never happen with the current numbers, ++ but I am paranoid and would rather an abort than ++ a bug I will never find */ ++ abort (); ++ } ++ else ++ cmp1 = GEN_INT (new); ++ } ++ } ++ ++ else if (p_info->reverse_regs) ++ { ++ rtx temp = cmp0; ++ cmp0 = cmp1; ++ cmp1 = temp; ++ } ++ ++ ++ ++ if (branch_p) ++ { ++ if (register_operand (cmp0, mode) && register_operand (cmp1, mode)) ++ { ++ rtx insn; ++ rtx cond = gen_rtx (p_info->test_code_reg, mode, cmp0, cmp1); ++ rtx label = gen_rtx_LABEL_REF (VOIDmode, destination); ++ ++ insn = gen_rtx_SET (VOIDmode, pc_rtx, ++ gen_rtx_IF_THEN_ELSE (VOIDmode, ++ cond, label, pc_rtx)); ++ emit_jump_insn (insn); ++ } ++ else ++ { ++ rtx cond, label; ++ ++ result = gen_reg_rtx (mode); ++ ++ emit_move_insn (result, ++ gen_rtx (p_info->test_code_const, mode, cmp0, ++ cmp1)); ++ ++ cond = gen_rtx (NE, mode, result, const0_rtx); ++ label = gen_rtx_LABEL_REF (VOIDmode, destination); ++ ++ emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, ++ gen_rtx_IF_THEN_ELSE (VOIDmode, ++ cond, ++ label, pc_rtx))); ++ } ++ } ++ else ++ { ++ if (register_operand (cmp0, mode) && register_operand (cmp1, mode)) ++ { ++ emit_move_insn (result, ++ gen_rtx (p_info->test_code_reg, mode, cmp0, cmp1)); ++ } ++ else ++ { ++ emit_move_insn (result, ++ gen_rtx (p_info->test_code_const, mode, cmp0, ++ cmp1)); ++ } ++ } ++ ++} ++ ++ ++/* ??? For now conditional moves are only supported ++ when the mode of the operands being compared are ++ the same as the ones being moved */ ++ ++void ++gen_conditional_move (rtx *operands, enum machine_mode mode) ++{ ++ rtx insn, cond; ++ rtx cmp_reg = gen_reg_rtx (mode); ++ enum rtx_code cmp_code = GET_CODE (operands[1]); ++ enum rtx_code move_code = EQ; ++ ++ /* emit a comparison if it is not "simple". ++ Simple comparisons are X eq 0 and X ne 0 */ ++ if ((cmp_code == EQ || cmp_code == NE) && branch_cmp[1] == const0_rtx) ++ { ++ cmp_reg = branch_cmp[0]; ++ move_code = cmp_code; ++ } ++ else if ((cmp_code == EQ || cmp_code == NE) && branch_cmp[0] == const0_rtx) ++ { ++ cmp_reg = branch_cmp[1]; ++ move_code = cmp_code == EQ ? NE : EQ; ++ } ++ else ++ gen_int_relational (cmp_code, cmp_reg, branch_cmp[0], branch_cmp[1], ++ NULL_RTX); ++ ++ cond = gen_rtx (move_code, VOIDmode, cmp_reg, CONST0_RTX (mode)); ++ insn = gen_rtx_SET (mode, operands[0], ++ gen_rtx_IF_THEN_ELSE (mode, ++ cond, operands[2], operands[3])); ++ emit_insn (insn); ++} ++ ++/******************* ++ * Addressing Modes ++ *******************/ ++ ++int ++nios2_legitimate_address (rtx operand, enum machine_mode mode ATTRIBUTE_UNUSED, ++ int strict) ++{ ++ int ret_val = 0; ++ ++ switch (GET_CODE (operand)) ++ { ++ /* direct. */ ++ case SYMBOL_REF: ++ if (SYMBOL_REF_IN_NIOS2_SMALL_DATA_P (operand)) ++ { ++ ret_val = 1; ++ break; ++ } ++ /* else, fall through */ ++ case LABEL_REF: ++ case CONST_INT: ++ case CONST: ++ case CONST_DOUBLE: ++ /* ??? In here I need to add gp addressing */ ++ ret_val = 0; ++ ++ break; ++ ++ /* Register indirect. */ ++ case REG: ++ ret_val = REG_OK_FOR_BASE_P2 (operand, strict); ++ break; ++ ++ /* Register indirect with displacement */ ++ case PLUS: ++ { ++ rtx op0 = XEXP (operand, 0); ++ rtx op1 = XEXP (operand, 1); ++ ++ if (REG_P (op0) && REG_P (op1)) ++ ret_val = 0; ++ else if (REG_P (op0) && CONSTANT_P (op1)) ++ ret_val = REG_OK_FOR_BASE_P2 (op0, strict) ++ && SMALL_INT (INTVAL (op1)); ++ else if (REG_P (op1) && CONSTANT_P (op0)) ++ ret_val = REG_OK_FOR_BASE_P2 (op1, strict) ++ && SMALL_INT (INTVAL (op0)); ++ else ++ ret_val = 0; ++ } ++ break; ++ ++ default: ++ ret_val = 0; ++ break; ++ } ++ ++ return ret_val; ++} ++ ++/* Return true if EXP should be placed in the small data section. */ ++ ++static bool ++nios2_in_small_data_p (tree exp) ++{ ++ /* We want to merge strings, so we never consider them small data. */ ++ if (TREE_CODE (exp) == STRING_CST) ++ return false; ++ ++ if (TREE_CODE (exp) == VAR_DECL && DECL_SECTION_NAME (exp)) ++ { ++ const char *section = TREE_STRING_POINTER (DECL_SECTION_NAME (exp)); ++ /* ??? these string names need moving into ++ an array in some header file */ ++ if (nios2_section_threshold > 0 ++ && (strcmp (section, ".sbss") == 0 ++ || strncmp (section, ".sbss.", 6) == 0 ++ || strcmp (section, ".sdata") == 0 ++ || strncmp (section, ".sdata.", 7) == 0)) ++ return true; ++ } ++ else if (TREE_CODE (exp) == VAR_DECL) ++ { ++ HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (exp)); ++ ++ /* If this is an incomplete type with size 0, then we can't put it ++ in sdata because it might be too big when completed. */ ++ if (size > 0 && size <= nios2_section_threshold) ++ return true; ++ } ++ ++ return false; ++} ++ ++static void ++nios2_encode_section_info (tree decl, rtx rtl, int first) ++{ ++ ++ rtx symbol; ++ int flags; ++ ++ default_encode_section_info (decl, rtl, first); ++ ++ /* Careful not to prod global register variables. */ ++ if (GET_CODE (rtl) != MEM) ++ return; ++ symbol = XEXP (rtl, 0); ++ if (GET_CODE (symbol) != SYMBOL_REF) ++ return; ++ ++ flags = SYMBOL_REF_FLAGS (symbol); ++ ++ /* We don't want weak variables to be addressed with gp in case they end up with ++ value 0 which is not within 2^15 of $gp */ ++ if (DECL_P (decl) && DECL_WEAK (decl)) ++ flags |= SYMBOL_FLAG_WEAK_DECL; ++ ++ SYMBOL_REF_FLAGS (symbol) = flags; ++} ++ ++ ++static unsigned int ++nios2_section_type_flags (tree decl, const char *name, int reloc) ++{ ++ unsigned int flags; ++ ++ flags = default_section_type_flags (decl, name, reloc); ++ ++ /* ??? these string names need moving into an array in some header file */ ++ if (strcmp (name, ".sbss") == 0 ++ || strncmp (name, ".sbss.", 6) == 0 ++ || strcmp (name, ".sdata") == 0 ++ || strncmp (name, ".sdata.", 7) == 0) ++ flags |= SECTION_SMALL; ++ ++ return flags; ++} ++ ++ ++ ++ ++/***************************************** ++ * Defining the Output Assembler Language ++ *****************************************/ ++ ++/* -------------- * ++ * Output of Data ++ * -------------- */ ++ ++ ++/* -------------------------------- * ++ * Output of Assembler Instructions ++ * -------------------------------- */ ++ ++ ++/* print the operand OP to file stream ++ FILE modified by LETTER. LETTER ++ can be one of: ++ i: print "i" if OP is an immediate, except 0 ++ o: print "io" if OP is volatile ++ ++ z: for const0_rtx print $0 instead of 0 ++ H: for %hiadj ++ L: for %lo ++ U: for upper half of 32 bit value ++ */ ++ ++void ++nios2_print_operand (FILE *file, rtx op, int letter) ++{ ++ ++ switch (letter) ++ { ++ case 'i': ++ if (CONSTANT_P (op) && (op != const0_rtx)) ++ fprintf (file, "i"); ++ return; ++ ++ case 'o': ++ if (GET_CODE (op) == MEM ++ && ((MEM_VOLATILE_P (op) && !TARGET_CACHE_VOLATILE) ++ || TARGET_BYPASS_CACHE)) ++ fprintf (file, "io"); ++ return; ++ ++ default: ++ break; ++ } ++ ++ if (comparison_operator (op, VOIDmode)) ++ { ++ if (letter == 0) ++ { ++ fprintf (file, "%s", GET_RTX_NAME (GET_CODE (op))); ++ return; ++ } ++ } ++ ++ ++ switch (GET_CODE (op)) ++ { ++ case REG: ++ if (letter == 0 || letter == 'z') ++ { ++ fprintf (file, "%s", reg_names[REGNO (op)]); ++ return; ++ } ++ ++ case CONST_INT: ++ if (INTVAL (op) == 0 && letter == 'z') ++ { ++ fprintf (file, "zero"); ++ return; ++ } ++ else if (letter == 'U') ++ { ++ HOST_WIDE_INT val = INTVAL (op); ++ rtx new_op; ++ val = (val / 65536) & 0xFFFF; ++ new_op = GEN_INT (val); ++ output_addr_const (file, new_op); ++ return; ++ } ++ ++ /* else, fall through */ ++ case CONST: ++ case LABEL_REF: ++ case SYMBOL_REF: ++ case CONST_DOUBLE: ++ if (letter == 0 || letter == 'z') ++ { ++ output_addr_const (file, op); ++ return; ++ } ++ else if (letter == 'H') ++ { ++ fprintf (file, "%%hiadj("); ++ output_addr_const (file, op); ++ fprintf (file, ")"); ++ return; ++ } ++ else if (letter == 'L') ++ { ++ fprintf (file, "%%lo("); ++ output_addr_const (file, op); ++ fprintf (file, ")"); ++ return; ++ } ++ ++ ++ case SUBREG: ++ case MEM: ++ if (letter == 0) ++ { ++ output_address (op); ++ return; ++ } ++ ++ case CODE_LABEL: ++ if (letter == 0) ++ { ++ output_addr_const (file, op); ++ return; ++ } ++ ++ default: ++ break; ++ } ++ ++ fprintf (stderr, "Missing way to print (%c) ", letter); ++ debug_rtx (op); ++ abort (); ++} ++ ++static int gprel_constant (rtx); ++ ++static int ++gprel_constant (rtx op) ++{ ++ if (GET_CODE (op) == SYMBOL_REF ++ && SYMBOL_REF_IN_NIOS2_SMALL_DATA_P (op)) ++ { ++ return 1; ++ } ++ else if (GET_CODE (op) == CONST ++ && GET_CODE (XEXP (op, 0)) == PLUS) ++ { ++ return gprel_constant (XEXP (XEXP (op, 0), 0)); ++ } ++ else ++ { ++ return 0; ++ } ++} ++ ++void ++nios2_print_operand_address (FILE *file, rtx op) ++{ ++ switch (GET_CODE (op)) ++ { ++ case CONST: ++ case CONST_INT: ++ case LABEL_REF: ++ case CONST_DOUBLE: ++ case SYMBOL_REF: ++ if (gprel_constant (op)) ++ { ++ fprintf (file, "%%gprel("); ++ output_addr_const (file, op); ++ fprintf (file, ")(%s)", reg_names[GP_REGNO]); ++ return; ++ } ++ ++ break; ++ ++ case PLUS: ++ { ++ rtx op0 = XEXP (op, 0); ++ rtx op1 = XEXP (op, 1); ++ ++ if (REG_P (op0) && CONSTANT_P (op1)) ++ { ++ output_addr_const (file, op1); ++ fprintf (file, "(%s)", reg_names[REGNO (op0)]); ++ return; ++ } ++ else if (REG_P (op1) && CONSTANT_P (op0)) ++ { ++ output_addr_const (file, op0); ++ fprintf (file, "(%s)", reg_names[REGNO (op1)]); ++ return; ++ } ++ } ++ break; ++ ++ case REG: ++ fprintf (file, "0(%s)", reg_names[REGNO (op)]); ++ return; ++ ++ case MEM: ++ { ++ rtx base = XEXP (op, 0); ++ PRINT_OPERAND_ADDRESS (file, base); ++ return; ++ } ++ default: ++ break; ++ } ++ ++ fprintf (stderr, "Missing way to print address\n"); ++ debug_rtx (op); ++ abort (); ++} ++ ++ ++ ++ ++ ++/**************************** ++ * Predicates ++ ****************************/ ++ ++int ++arith_operand (rtx op, enum machine_mode mode) ++{ ++ if (GET_CODE (op) == CONST_INT && SMALL_INT (INTVAL (op))) ++ return 1; ++ ++ return register_operand (op, mode); ++} ++ ++int ++uns_arith_operand (rtx op, enum machine_mode mode) ++{ ++ if (GET_CODE (op) == CONST_INT && SMALL_INT_UNSIGNED (INTVAL (op))) ++ return 1; ++ ++ return register_operand (op, mode); ++} ++ ++int ++logical_operand (rtx op, enum machine_mode mode) ++{ ++ if (GET_CODE (op) == CONST_INT ++ && (SMALL_INT_UNSIGNED (INTVAL (op)) || UPPER16_INT (INTVAL (op)))) ++ return 1; ++ ++ return register_operand (op, mode); ++} ++ ++int ++shift_operand (rtx op, enum machine_mode mode) ++{ ++ if (GET_CODE (op) == CONST_INT && SHIFT_INT (INTVAL (op))) ++ return 1; ++ ++ return register_operand (op, mode); ++} ++ ++int ++rdwrctl_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) ++{ ++ return GET_CODE (op) == CONST_INT && RDWRCTL_INT (INTVAL (op)); ++} ++ ++/* Return truth value of whether OP is a register or the constant 0. */ ++ ++int ++reg_or_0_operand (rtx op, enum machine_mode mode) ++{ ++ switch (GET_CODE (op)) ++ { ++ case CONST_INT: ++ return INTVAL (op) == 0; ++ ++ case CONST_DOUBLE: ++ return op == CONST0_RTX (mode); ++ ++ default: ++ break; ++ } ++ ++ return register_operand (op, mode); ++} ++ ++ ++int ++equality_op (rtx op, enum machine_mode mode) ++{ ++ if (mode != GET_MODE (op)) ++ return 0; ++ ++ return GET_CODE (op) == EQ || GET_CODE (op) == NE; ++} ++ ++int ++custom_insn_opcode (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) ++{ ++ return GET_CODE (op) == CONST_INT && CUSTOM_INSN_OPCODE (INTVAL (op)); ++} ++ ++ ++ ++ ++ ++ ++ ++/***************************************************************************** ++** ++** instruction scheduler ++** ++*****************************************************************************/ ++static int ++nios2_use_dfa_pipeline_interface () ++{ ++ return 1; ++} ++ ++ ++static int ++nios2_issue_rate () ++{ ++#ifdef MAX_DFA_ISSUE_RATE ++ return MAX_DFA_ISSUE_RATE; ++#else ++ return 1; ++#endif ++} ++ ++ ++const char * ++asm_output_opcode (FILE *file ATTRIBUTE_UNUSED, ++ const char *ptr ATTRIBUTE_UNUSED) ++{ ++ const char *p; ++ ++ p = ptr; ++ return ptr; ++} ++ ++ ++ ++/***************************************************************************** ++** ++** function arguments ++** ++*****************************************************************************/ ++ ++void ++init_cumulative_args (CUMULATIVE_ARGS *cum, ++ tree fntype ATTRIBUTE_UNUSED, ++ rtx libname ATTRIBUTE_UNUSED, ++ tree fndecl ATTRIBUTE_UNUSED, ++ int n_named_args ATTRIBUTE_UNUSED) ++{ ++ cum->regs_used = 0; ++} ++ ++ ++/* Update the data in CUM to advance over an argument ++ of mode MODE and data type TYPE. ++ (TYPE is null for libcalls where that information may not be available.) */ ++ ++void ++function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, ++ tree type ATTRIBUTE_UNUSED, int named ATTRIBUTE_UNUSED) ++{ ++ HOST_WIDE_INT param_size; ++ ++ if (mode == BLKmode) ++ { ++ param_size = int_size_in_bytes (type); ++ if (param_size < 0) ++ internal_error ++ ("Do not know how to handle large structs or variable length types"); ++ } ++ else ++ { ++ param_size = GET_MODE_SIZE (mode); ++ } ++ ++ /* convert to words (round up) */ ++ param_size = (3 + param_size) / 4; ++ ++ if (cum->regs_used + param_size > NUM_ARG_REGS) ++ { ++ cum->regs_used = NUM_ARG_REGS; ++ } ++ else ++ { ++ cum->regs_used += param_size; ++ } ++ ++ return; ++} ++ ++/* Define where to put the arguments to a function. Value is zero to ++ push the argument on the stack, or a hard register in which to ++ store the argument. ++ ++ MODE is the argument's machine mode. ++ TYPE is the data type of the argument (as a tree). ++ This is null for libcalls where that information may ++ not be available. ++ CUM is a variable of type CUMULATIVE_ARGS which gives info about ++ the preceding args and about the function being called. ++ NAMED is nonzero if this argument is a named parameter ++ (otherwise it is an extra parameter matching an ellipsis). */ ++rtx ++function_arg (const CUMULATIVE_ARGS *cum, enum machine_mode mode, ++ tree type ATTRIBUTE_UNUSED, int named ATTRIBUTE_UNUSED) ++{ ++ rtx return_rtx = NULL_RTX; ++ ++ if (cum->regs_used < NUM_ARG_REGS) ++ { ++ return_rtx = gen_rtx_REG (mode, FIRST_ARG_REGNO + cum->regs_used); ++ } ++ ++ return return_rtx; ++} ++ ++int ++function_arg_partial_nregs (const CUMULATIVE_ARGS *cum, ++ enum machine_mode mode, tree type, ++ int named ATTRIBUTE_UNUSED) ++{ ++ HOST_WIDE_INT param_size; ++ ++ if (mode == BLKmode) ++ { ++ param_size = int_size_in_bytes (type); ++ if (param_size < 0) ++ internal_error ++ ("Do not know how to handle large structs or variable length types"); ++ } ++ else ++ { ++ param_size = GET_MODE_SIZE (mode); ++ } ++ ++ /* convert to words (round up) */ ++ param_size = (3 + param_size) / 4; ++ ++ if (cum->regs_used < NUM_ARG_REGS ++ && cum->regs_used + param_size > NUM_ARG_REGS) ++ { ++ return NUM_ARG_REGS - cum->regs_used; ++ } ++ else ++ { ++ return 0; ++ } ++} ++ ++ ++int ++nios2_return_in_memory (tree type) ++{ ++ int res = ((int_size_in_bytes (type) > (2 * UNITS_PER_WORD)) ++ || (int_size_in_bytes (type) == -1)); ++ ++ return res; ++} ++ ++/* ??? It may be possible to eliminate the copyback and implement ++ my own va_arg type, but that is more work for now. */ ++int ++nios2_setup_incoming_varargs (const CUMULATIVE_ARGS *cum, ++ enum machine_mode mode, tree type, ++ int no_rtl) ++{ ++ CUMULATIVE_ARGS local_cum; ++ int regs_to_push; ++ ++ local_cum = *cum; ++ FUNCTION_ARG_ADVANCE (local_cum, mode, type, 1); ++ ++ regs_to_push = NUM_ARG_REGS - local_cum.regs_used; ++ ++ if (!no_rtl) ++ { ++ if (regs_to_push > 0) ++ { ++ rtx ptr, mem; ++ ++ ptr = virtual_incoming_args_rtx; ++ mem = gen_rtx_MEM (BLKmode, ptr); ++ ++ /* va_arg is an array access in this case, which causes ++ it to get MEM_IN_STRUCT_P set. We must set it here ++ so that the insn scheduler won't assume that these ++ stores can't possibly overlap with the va_arg loads. */ ++ MEM_SET_IN_STRUCT_P (mem, 1); ++ ++ emit_insn (gen_blockage ()); ++ move_block_from_reg (local_cum.regs_used + FIRST_ARG_REGNO, mem, ++ regs_to_push); ++ emit_insn (gen_blockage ()); ++ } ++ } ++ ++ return regs_to_push * UNITS_PER_WORD; ++ ++} ++ ++ ++ ++/***************************************************************************** ++** ++** builtins ++** ++** This method for handling builtins is from CSP where _many_ more types of ++** expanders have already been written. Check there first before writing ++** new ones. ++** ++*****************************************************************************/ ++ ++enum nios2_builtins ++{ ++ NIOS2_BUILTIN_LDBIO, ++ NIOS2_BUILTIN_LDBUIO, ++ NIOS2_BUILTIN_LDHIO, ++ NIOS2_BUILTIN_LDHUIO, ++ NIOS2_BUILTIN_LDWIO, ++ NIOS2_BUILTIN_STBIO, ++ NIOS2_BUILTIN_STHIO, ++ NIOS2_BUILTIN_STWIO, ++ NIOS2_BUILTIN_SYNC, ++ NIOS2_BUILTIN_RDCTL, ++ NIOS2_BUILTIN_WRCTL, ++ ++ NIOS2_BUILTIN_CUSTOM_N, ++ NIOS2_BUILTIN_CUSTOM_NI, ++ NIOS2_BUILTIN_CUSTOM_NF, ++ NIOS2_BUILTIN_CUSTOM_NP, ++ NIOS2_BUILTIN_CUSTOM_NII, ++ NIOS2_BUILTIN_CUSTOM_NIF, ++ NIOS2_BUILTIN_CUSTOM_NIP, ++ NIOS2_BUILTIN_CUSTOM_NFI, ++ NIOS2_BUILTIN_CUSTOM_NFF, ++ NIOS2_BUILTIN_CUSTOM_NFP, ++ NIOS2_BUILTIN_CUSTOM_NPI, ++ NIOS2_BUILTIN_CUSTOM_NPF, ++ NIOS2_BUILTIN_CUSTOM_NPP, ++ NIOS2_BUILTIN_CUSTOM_IN, ++ NIOS2_BUILTIN_CUSTOM_INI, ++ NIOS2_BUILTIN_CUSTOM_INF, ++ NIOS2_BUILTIN_CUSTOM_INP, ++ NIOS2_BUILTIN_CUSTOM_INII, ++ NIOS2_BUILTIN_CUSTOM_INIF, ++ NIOS2_BUILTIN_CUSTOM_INIP, ++ NIOS2_BUILTIN_CUSTOM_INFI, ++ NIOS2_BUILTIN_CUSTOM_INFF, ++ NIOS2_BUILTIN_CUSTOM_INFP, ++ NIOS2_BUILTIN_CUSTOM_INPI, ++ NIOS2_BUILTIN_CUSTOM_INPF, ++ NIOS2_BUILTIN_CUSTOM_INPP, ++ NIOS2_BUILTIN_CUSTOM_FN, ++ NIOS2_BUILTIN_CUSTOM_FNI, ++ NIOS2_BUILTIN_CUSTOM_FNF, ++ NIOS2_BUILTIN_CUSTOM_FNP, ++ NIOS2_BUILTIN_CUSTOM_FNII, ++ NIOS2_BUILTIN_CUSTOM_FNIF, ++ NIOS2_BUILTIN_CUSTOM_FNIP, ++ NIOS2_BUILTIN_CUSTOM_FNFI, ++ NIOS2_BUILTIN_CUSTOM_FNFF, ++ NIOS2_BUILTIN_CUSTOM_FNFP, ++ NIOS2_BUILTIN_CUSTOM_FNPI, ++ NIOS2_BUILTIN_CUSTOM_FNPF, ++ NIOS2_BUILTIN_CUSTOM_FNPP, ++ NIOS2_BUILTIN_CUSTOM_PN, ++ NIOS2_BUILTIN_CUSTOM_PNI, ++ NIOS2_BUILTIN_CUSTOM_PNF, ++ NIOS2_BUILTIN_CUSTOM_PNP, ++ NIOS2_BUILTIN_CUSTOM_PNII, ++ NIOS2_BUILTIN_CUSTOM_PNIF, ++ NIOS2_BUILTIN_CUSTOM_PNIP, ++ NIOS2_BUILTIN_CUSTOM_PNFI, ++ NIOS2_BUILTIN_CUSTOM_PNFF, ++ NIOS2_BUILTIN_CUSTOM_PNFP, ++ NIOS2_BUILTIN_CUSTOM_PNPI, ++ NIOS2_BUILTIN_CUSTOM_PNPF, ++ NIOS2_BUILTIN_CUSTOM_PNPP, ++ ++ ++ LIM_NIOS2_BUILTINS ++}; ++ ++struct builtin_description ++{ ++ const enum insn_code icode; ++ const char *const name; ++ const enum nios2_builtins code; ++ const tree *type; ++ rtx (* expander) PARAMS ((const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int)); ++}; ++ ++static rtx nios2_expand_STXIO (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++static rtx nios2_expand_LDXIO (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++static rtx nios2_expand_sync (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++static rtx nios2_expand_rdctl (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++static rtx nios2_expand_wrctl (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++ ++static rtx nios2_expand_custom_n (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++static rtx nios2_expand_custom_Xn (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++static rtx nios2_expand_custom_nX (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++static rtx nios2_expand_custom_XnX (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++static rtx nios2_expand_custom_nXX (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++static rtx nios2_expand_custom_XnXX (const struct builtin_description *, ++ tree, rtx, rtx, enum machine_mode, int); ++ ++static tree endlink; ++ ++/* int fn (volatile const void *) ++ */ ++static tree int_ftype_volatile_const_void_p; ++ ++/* int fn (int) ++ */ ++static tree int_ftype_int; ++ ++/* void fn (int, int) ++ */ ++static tree void_ftype_int_int; ++ ++/* void fn (volatile void *, int) ++ */ ++static tree void_ftype_volatile_void_p_int; ++ ++/* void fn (void) ++ */ ++static tree void_ftype_void; ++ ++static tree custom_n; ++static tree custom_ni; ++static tree custom_nf; ++static tree custom_np; ++static tree custom_nii; ++static tree custom_nif; ++static tree custom_nip; ++static tree custom_nfi; ++static tree custom_nff; ++static tree custom_nfp; ++static tree custom_npi; ++static tree custom_npf; ++static tree custom_npp; ++static tree custom_in; ++static tree custom_ini; ++static tree custom_inf; ++static tree custom_inp; ++static tree custom_inii; ++static tree custom_inif; ++static tree custom_inip; ++static tree custom_infi; ++static tree custom_inff; ++static tree custom_infp; ++static tree custom_inpi; ++static tree custom_inpf; ++static tree custom_inpp; ++static tree custom_fn; ++static tree custom_fni; ++static tree custom_fnf; ++static tree custom_fnp; ++static tree custom_fnii; ++static tree custom_fnif; ++static tree custom_fnip; ++static tree custom_fnfi; ++static tree custom_fnff; ++static tree custom_fnfp; ++static tree custom_fnpi; ++static tree custom_fnpf; ++static tree custom_fnpp; ++static tree custom_pn; ++static tree custom_pni; ++static tree custom_pnf; ++static tree custom_pnp; ++static tree custom_pnii; ++static tree custom_pnif; ++static tree custom_pnip; ++static tree custom_pnfi; ++static tree custom_pnff; ++static tree custom_pnfp; ++static tree custom_pnpi; ++static tree custom_pnpf; ++static tree custom_pnpp; ++ ++ ++static const struct builtin_description bdesc[] = { ++ {CODE_FOR_ldbio, "__builtin_ldbio", NIOS2_BUILTIN_LDBIO, &int_ftype_volatile_const_void_p, nios2_expand_LDXIO}, ++ {CODE_FOR_ldbuio, "__builtin_ldbuio", NIOS2_BUILTIN_LDBUIO, &int_ftype_volatile_const_void_p, nios2_expand_LDXIO}, ++ {CODE_FOR_ldhio, "__builtin_ldhio", NIOS2_BUILTIN_LDHIO, &int_ftype_volatile_const_void_p, nios2_expand_LDXIO}, ++ {CODE_FOR_ldhuio, "__builtin_ldhuio", NIOS2_BUILTIN_LDHUIO, &int_ftype_volatile_const_void_p, nios2_expand_LDXIO}, ++ {CODE_FOR_ldwio, "__builtin_ldwio", NIOS2_BUILTIN_LDWIO, &int_ftype_volatile_const_void_p, nios2_expand_LDXIO}, ++ ++ {CODE_FOR_stbio, "__builtin_stbio", NIOS2_BUILTIN_STBIO, &void_ftype_volatile_void_p_int, nios2_expand_STXIO}, ++ {CODE_FOR_sthio, "__builtin_sthio", NIOS2_BUILTIN_STHIO, &void_ftype_volatile_void_p_int, nios2_expand_STXIO}, ++ {CODE_FOR_stwio, "__builtin_stwio", NIOS2_BUILTIN_STWIO, &void_ftype_volatile_void_p_int, nios2_expand_STXIO}, ++ ++ {CODE_FOR_sync, "__builtin_sync", NIOS2_BUILTIN_SYNC, &void_ftype_void, nios2_expand_sync}, ++ {CODE_FOR_rdctl, "__builtin_rdctl", NIOS2_BUILTIN_RDCTL, &int_ftype_int, nios2_expand_rdctl}, ++ {CODE_FOR_wrctl, "__builtin_wrctl", NIOS2_BUILTIN_WRCTL, &void_ftype_int_int, nios2_expand_wrctl}, ++ ++ {CODE_FOR_custom_n, "__builtin_custom_n", NIOS2_BUILTIN_CUSTOM_N, &custom_n, nios2_expand_custom_n}, ++ {CODE_FOR_custom_ni, "__builtin_custom_ni", NIOS2_BUILTIN_CUSTOM_NI, &custom_ni, nios2_expand_custom_nX}, ++ {CODE_FOR_custom_nf, "__builtin_custom_nf", NIOS2_BUILTIN_CUSTOM_NF, &custom_nf, nios2_expand_custom_nX}, ++ {CODE_FOR_custom_np, "__builtin_custom_np", NIOS2_BUILTIN_CUSTOM_NP, &custom_np, nios2_expand_custom_nX}, ++ {CODE_FOR_custom_nii, "__builtin_custom_nii", NIOS2_BUILTIN_CUSTOM_NII, &custom_nii, nios2_expand_custom_nXX}, ++ {CODE_FOR_custom_nif, "__builtin_custom_nif", NIOS2_BUILTIN_CUSTOM_NIF, &custom_nif, nios2_expand_custom_nXX}, ++ {CODE_FOR_custom_nip, "__builtin_custom_nip", NIOS2_BUILTIN_CUSTOM_NIP, &custom_nip, nios2_expand_custom_nXX}, ++ {CODE_FOR_custom_nfi, "__builtin_custom_nfi", NIOS2_BUILTIN_CUSTOM_NFI, &custom_nfi, nios2_expand_custom_nXX}, ++ {CODE_FOR_custom_nff, "__builtin_custom_nff", NIOS2_BUILTIN_CUSTOM_NFF, &custom_nff, nios2_expand_custom_nXX}, ++ {CODE_FOR_custom_nfp, "__builtin_custom_nfp", NIOS2_BUILTIN_CUSTOM_NFP, &custom_nfp, nios2_expand_custom_nXX}, ++ {CODE_FOR_custom_npi, "__builtin_custom_npi", NIOS2_BUILTIN_CUSTOM_NPI, &custom_npi, nios2_expand_custom_nXX}, ++ {CODE_FOR_custom_npf, "__builtin_custom_npf", NIOS2_BUILTIN_CUSTOM_NPF, &custom_npf, nios2_expand_custom_nXX}, ++ {CODE_FOR_custom_npp, "__builtin_custom_npp", NIOS2_BUILTIN_CUSTOM_NPP, &custom_npp, nios2_expand_custom_nXX}, ++ {CODE_FOR_custom_in, "__builtin_custom_in", NIOS2_BUILTIN_CUSTOM_IN, &custom_in, nios2_expand_custom_Xn}, ++ {CODE_FOR_custom_ini, "__builtin_custom_ini", NIOS2_BUILTIN_CUSTOM_INI, &custom_ini, nios2_expand_custom_XnX}, ++ {CODE_FOR_custom_inf, "__builtin_custom_inf", NIOS2_BUILTIN_CUSTOM_INF, &custom_inf, nios2_expand_custom_XnX}, ++ {CODE_FOR_custom_inp, "__builtin_custom_inp", NIOS2_BUILTIN_CUSTOM_INP, &custom_inp, nios2_expand_custom_XnX}, ++ {CODE_FOR_custom_inii, "__builtin_custom_inii", NIOS2_BUILTIN_CUSTOM_INII, &custom_inii, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_inif, "__builtin_custom_inif", NIOS2_BUILTIN_CUSTOM_INIF, &custom_inif, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_inip, "__builtin_custom_inip", NIOS2_BUILTIN_CUSTOM_INIP, &custom_inip, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_infi, "__builtin_custom_infi", NIOS2_BUILTIN_CUSTOM_INFI, &custom_infi, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_inff, "__builtin_custom_inff", NIOS2_BUILTIN_CUSTOM_INFF, &custom_inff, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_infp, "__builtin_custom_infp", NIOS2_BUILTIN_CUSTOM_INFP, &custom_infp, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_inpi, "__builtin_custom_inpi", NIOS2_BUILTIN_CUSTOM_INPI, &custom_inpi, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_inpf, "__builtin_custom_inpf", NIOS2_BUILTIN_CUSTOM_INPF, &custom_inpf, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_inpp, "__builtin_custom_inpp", NIOS2_BUILTIN_CUSTOM_INPP, &custom_inpp, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_fn, "__builtin_custom_fn", NIOS2_BUILTIN_CUSTOM_FN, &custom_fn, nios2_expand_custom_Xn}, ++ {CODE_FOR_custom_fni, "__builtin_custom_fni", NIOS2_BUILTIN_CUSTOM_FNI, &custom_fni, nios2_expand_custom_XnX}, ++ {CODE_FOR_custom_fnf, "__builtin_custom_fnf", NIOS2_BUILTIN_CUSTOM_FNF, &custom_fnf, nios2_expand_custom_XnX}, ++ {CODE_FOR_custom_fnp, "__builtin_custom_fnp", NIOS2_BUILTIN_CUSTOM_FNP, &custom_fnp, nios2_expand_custom_XnX}, ++ {CODE_FOR_custom_fnii, "__builtin_custom_fnii", NIOS2_BUILTIN_CUSTOM_FNII, &custom_fnii, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_fnif, "__builtin_custom_fnif", NIOS2_BUILTIN_CUSTOM_FNIF, &custom_fnif, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_fnip, "__builtin_custom_fnip", NIOS2_BUILTIN_CUSTOM_FNIP, &custom_fnip, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_fnfi, "__builtin_custom_fnfi", NIOS2_BUILTIN_CUSTOM_FNFI, &custom_fnfi, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_fnff, "__builtin_custom_fnff", NIOS2_BUILTIN_CUSTOM_FNFF, &custom_fnff, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_fnfp, "__builtin_custom_fnfp", NIOS2_BUILTIN_CUSTOM_FNFP, &custom_fnfp, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_fnpi, "__builtin_custom_fnpi", NIOS2_BUILTIN_CUSTOM_FNPI, &custom_fnpi, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_fnpf, "__builtin_custom_fnpf", NIOS2_BUILTIN_CUSTOM_FNPF, &custom_fnpf, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_fnpp, "__builtin_custom_fnpp", NIOS2_BUILTIN_CUSTOM_FNPP, &custom_fnpp, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_pn, "__builtin_custom_pn", NIOS2_BUILTIN_CUSTOM_PN, &custom_pn, nios2_expand_custom_Xn}, ++ {CODE_FOR_custom_pni, "__builtin_custom_pni", NIOS2_BUILTIN_CUSTOM_PNI, &custom_pni, nios2_expand_custom_XnX}, ++ {CODE_FOR_custom_pnf, "__builtin_custom_pnf", NIOS2_BUILTIN_CUSTOM_PNF, &custom_pnf, nios2_expand_custom_XnX}, ++ {CODE_FOR_custom_pnp, "__builtin_custom_pnp", NIOS2_BUILTIN_CUSTOM_PNP, &custom_pnp, nios2_expand_custom_XnX}, ++ {CODE_FOR_custom_pnii, "__builtin_custom_pnii", NIOS2_BUILTIN_CUSTOM_PNII, &custom_pnii, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_pnif, "__builtin_custom_pnif", NIOS2_BUILTIN_CUSTOM_PNIF, &custom_pnif, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_pnip, "__builtin_custom_pnip", NIOS2_BUILTIN_CUSTOM_PNIP, &custom_pnip, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_pnfi, "__builtin_custom_pnfi", NIOS2_BUILTIN_CUSTOM_PNFI, &custom_pnfi, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_pnff, "__builtin_custom_pnff", NIOS2_BUILTIN_CUSTOM_PNFF, &custom_pnff, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_pnfp, "__builtin_custom_pnfp", NIOS2_BUILTIN_CUSTOM_PNFP, &custom_pnfp, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_pnpi, "__builtin_custom_pnpi", NIOS2_BUILTIN_CUSTOM_PNPI, &custom_pnpi, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_pnpf, "__builtin_custom_pnpf", NIOS2_BUILTIN_CUSTOM_PNPF, &custom_pnpf, nios2_expand_custom_XnXX}, ++ {CODE_FOR_custom_pnpp, "__builtin_custom_pnpp", NIOS2_BUILTIN_CUSTOM_PNPP, &custom_pnpp, nios2_expand_custom_XnXX}, ++ ++ ++ {0, 0, 0, 0, 0}, ++}; ++ ++/* This does not have a closing bracket on purpose (see use) */ ++#define def_param(TYPE) \ ++ tree_cons (NULL_TREE, TYPE, ++ ++static void ++nios2_init_builtins () ++{ ++ const struct builtin_description *d; ++ ++ ++ endlink = void_list_node; ++ ++ /* Special indenting here because one of the brackets is in def_param */ ++ /* *INDENT-OFF* */ ++ ++ /* int fn (volatile const void *) ++ */ ++ int_ftype_volatile_const_void_p ++ = build_function_type (integer_type_node, ++ def_param (build_qualified_type (ptr_type_node, ++ TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) ++ endlink)); ++ ++ ++ /* void fn (volatile void *, int) ++ */ ++ void_ftype_volatile_void_p_int ++ = build_function_type (void_type_node, ++ def_param (build_qualified_type (ptr_type_node, ++ TYPE_QUAL_VOLATILE)) ++ def_param (integer_type_node) ++ endlink))); ++ ++ /* void fn (void) ++ */ ++ void_ftype_void ++ = build_function_type (void_type_node, ++ endlink); ++ ++ /* int fn (int) ++ */ ++ int_ftype_int ++ = build_function_type (integer_type_node, ++ def_param (integer_type_node) ++ endlink)); ++ ++ /* void fn (int, int) ++ */ ++ void_ftype_int_int ++ = build_function_type (void_type_node, ++ def_param (integer_type_node) ++ def_param (integer_type_node) ++ endlink))); ++ ++ ++#define CUSTOM_NUM def_param (integer_type_node) ++ ++ custom_n ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ endlink)); ++ custom_ni ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ endlink))); ++ custom_nf ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ endlink))); ++ custom_np ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ endlink))); ++ custom_nii ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_nif ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_nip ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ custom_nfi ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_nff ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_nfp ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ custom_npi ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_npf ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_npp ++ = build_function_type (void_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ ++ custom_in ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ endlink)); ++ custom_ini ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ endlink))); ++ custom_inf ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ endlink))); ++ custom_inp ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ endlink))); ++ custom_inii ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_inif ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_inip ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ custom_infi ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_inff ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_infp ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ custom_inpi ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_inpf ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_inpp ++ = build_function_type (integer_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ ++ custom_fn ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ endlink)); ++ custom_fni ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ endlink))); ++ custom_fnf ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ endlink))); ++ custom_fnp ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ endlink))); ++ custom_fnii ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_fnif ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_fnip ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ custom_fnfi ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_fnff ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_fnfp ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ custom_fnpi ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_fnpf ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_fnpp ++ = build_function_type (float_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ ++ ++ custom_pn ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ endlink)); ++ custom_pni ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ endlink))); ++ custom_pnf ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ endlink))); ++ custom_pnp ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ endlink))); ++ custom_pnii ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_pnif ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_pnip ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (integer_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ custom_pnfi ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_pnff ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_pnfp ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (float_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ custom_pnpi ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (integer_type_node) ++ endlink)))); ++ custom_pnpf ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (float_type_node) ++ endlink)))); ++ custom_pnpp ++ = build_function_type (ptr_type_node, ++ CUSTOM_NUM ++ def_param (ptr_type_node) ++ def_param (ptr_type_node) ++ endlink)))); ++ ++ ++ ++ /* *INDENT-ON* */ ++ ++ ++ for (d = bdesc; d->name; d++) ++ { ++ builtin_function (d->name, *d->type, d->code, ++ BUILT_IN_MD, NULL, NULL); ++ } ++} ++ ++/* Expand an expression EXP that calls a built-in function, ++ with result going to TARGET if that's convenient ++ (and in mode MODE if that's convenient). ++ SUBTARGET may be used as the target for computing one of EXP's operands. ++ IGNORE is nonzero if the value is to be ignored. */ ++ ++static rtx ++nios2_expand_builtin (tree exp, rtx target, rtx subtarget, ++ enum machine_mode mode, int ignore) ++{ ++ const struct builtin_description *d; ++ tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); ++ unsigned int fcode = DECL_FUNCTION_CODE (fndecl); ++ ++ for (d = bdesc; d->name; d++) ++ if (d->code == fcode) ++ return (d->expander) (d, exp, target, subtarget, mode, ignore); ++ ++ /* we should have seen one of the functins we registered */ ++ abort (); ++} ++ ++static rtx nios2_create_target (const struct builtin_description *, rtx); ++ ++ ++static rtx ++nios2_create_target (const struct builtin_description *d, rtx target) ++{ ++ if (!target ++ || !(*insn_data[d->icode].operand[0].predicate) (target, ++ insn_data[d->icode].operand[0].mode)) ++ { ++ target = gen_reg_rtx (insn_data[d->icode].operand[0].mode); ++ } ++ ++ return target; ++} ++ ++ ++static rtx nios2_extract_opcode (const struct builtin_description *, int, tree); ++static rtx nios2_extract_operand (const struct builtin_description *, int, int, tree); ++ ++static rtx ++nios2_extract_opcode (const struct builtin_description *d, int op, tree arglist) ++{ ++ enum machine_mode mode = insn_data[d->icode].operand[op].mode; ++ tree arg = TREE_VALUE (arglist); ++ rtx opcode = expand_expr (arg, NULL_RTX, mode, 0); ++ opcode = protect_from_queue (opcode, 0); ++ ++ if (!(*insn_data[d->icode].operand[op].predicate) (opcode, mode)) ++ error ("Custom instruction opcode must be compile time constant in the range 0-255 for %s", d->name); ++ ++ return opcode; ++} ++ ++static rtx ++nios2_extract_operand (const struct builtin_description *d, int op, int argnum, tree arglist) ++{ ++ enum machine_mode mode = insn_data[d->icode].operand[op].mode; ++ tree arg = TREE_VALUE (arglist); ++ rtx operand = expand_expr (arg, NULL_RTX, mode, 0); ++ operand = protect_from_queue (operand, 0); ++ ++ if (!(*insn_data[d->icode].operand[op].predicate) (operand, mode)) ++ operand = copy_to_mode_reg (mode, operand); ++ ++ /* ??? Better errors would be nice */ ++ if (!(*insn_data[d->icode].operand[op].predicate) (operand, mode)) ++ error ("Invalid argument %d to %s", argnum, d->name); ++ ++ return operand; ++} ++ ++ ++static rtx ++nios2_expand_custom_n (const struct builtin_description *d, tree exp, ++ rtx target ATTRIBUTE_UNUSED, rtx subtarget ATTRIBUTE_UNUSED, ++ enum machine_mode mode ATTRIBUTE_UNUSED, int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx opcode; ++ ++ /* custom_n should have exactly one operand */ ++ if (insn_data[d->icode].n_operands != 1) ++ abort (); ++ ++ opcode = nios2_extract_opcode (d, 0, arglist); ++ ++ pat = GEN_FCN (d->icode) (opcode); ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return 0; ++} ++ ++static rtx ++nios2_expand_custom_Xn (const struct builtin_description *d, tree exp, ++ rtx target, rtx subtarget ATTRIBUTE_UNUSED, ++ enum machine_mode mode ATTRIBUTE_UNUSED, ++ int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx opcode; ++ ++ /* custom_Xn should have exactly two operands */ ++ if (insn_data[d->icode].n_operands != 2) ++ abort (); ++ ++ target = nios2_create_target (d, target); ++ opcode = nios2_extract_opcode (d, 1, arglist); ++ ++ pat = GEN_FCN (d->icode) (target, opcode); ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return target; ++} ++ ++static rtx ++nios2_expand_custom_nX (const struct builtin_description *d, tree exp, ++ rtx target ATTRIBUTE_UNUSED, rtx subtarget ATTRIBUTE_UNUSED, ++ enum machine_mode mode ATTRIBUTE_UNUSED, int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx opcode; ++ rtx operands[1]; ++ int i; ++ ++ ++ /* custom_nX should have exactly two operands */ ++ if (insn_data[d->icode].n_operands != 2) ++ abort (); ++ ++ opcode = nios2_extract_opcode (d, 0, arglist); ++ for (i = 0; i < 1; i++) ++ { ++ arglist = TREE_CHAIN (arglist); ++ operands[i] = nios2_extract_operand (d, i + 1, i + 1, arglist); ++ } ++ ++ pat = GEN_FCN (d->icode) (opcode, operands[0]); ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return 0; ++} ++ ++static rtx ++nios2_expand_custom_XnX (const struct builtin_description *d, tree exp, rtx target, ++ rtx subtarget ATTRIBUTE_UNUSED, enum machine_mode mode ATTRIBUTE_UNUSED, ++ int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx opcode; ++ rtx operands[1]; ++ int i; ++ ++ /* custom_Xn should have exactly three operands */ ++ if (insn_data[d->icode].n_operands != 3) ++ abort (); ++ ++ target = nios2_create_target (d, target); ++ opcode = nios2_extract_opcode (d, 1, arglist); ++ ++ for (i = 0; i < 1; i++) ++ { ++ arglist = TREE_CHAIN (arglist); ++ operands[i] = nios2_extract_operand (d, i + 2, i + 1, arglist); ++ } ++ ++ pat = GEN_FCN (d->icode) (target, opcode, operands[0]); ++ ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return target; ++} ++ ++static rtx ++nios2_expand_custom_nXX (const struct builtin_description *d, tree exp, rtx target ATTRIBUTE_UNUSED, ++ rtx subtarget ATTRIBUTE_UNUSED, enum machine_mode mode ATTRIBUTE_UNUSED, ++ int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx opcode; ++ rtx operands[2]; ++ int i; ++ ++ ++ /* custom_nX should have exactly three operands */ ++ if (insn_data[d->icode].n_operands != 3) ++ abort (); ++ ++ opcode = nios2_extract_opcode (d, 0, arglist); ++ for (i = 0; i < 2; i++) ++ { ++ arglist = TREE_CHAIN (arglist); ++ operands[i] = nios2_extract_operand (d, i + 1, i + 1, arglist); ++ } ++ ++ pat = GEN_FCN (d->icode) (opcode, operands[0], operands[1]); ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return 0; ++} ++ ++static rtx ++nios2_expand_custom_XnXX (const struct builtin_description *d, tree exp, rtx target, ++ rtx subtarget ATTRIBUTE_UNUSED, enum machine_mode mode ATTRIBUTE_UNUSED, ++ int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx opcode; ++ rtx operands[2]; ++ int i; ++ ++ ++ /* custom_XnX should have exactly four operands */ ++ if (insn_data[d->icode].n_operands != 4) ++ abort (); ++ ++ target = nios2_create_target (d, target); ++ opcode = nios2_extract_opcode (d, 1, arglist); ++ for (i = 0; i < 2; i++) ++ { ++ arglist = TREE_CHAIN (arglist); ++ operands[i] = nios2_extract_operand (d, i + 2, i + 1, arglist); ++ } ++ ++ pat = GEN_FCN (d->icode) (target, opcode, operands[0], operands[1]); ++ ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return target; ++} ++ ++ ++ ++static rtx ++nios2_expand_STXIO (const struct builtin_description *d, tree exp, rtx target ATTRIBUTE_UNUSED, ++ rtx subtarget ATTRIBUTE_UNUSED, enum machine_mode mode ATTRIBUTE_UNUSED, ++ int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx store_dest, store_val; ++ enum insn_code icode = d->icode; ++ ++ /* stores should have exactly two operands */ ++ if (insn_data[icode].n_operands != 2) ++ abort (); ++ ++ /* process the destination of the store */ ++ { ++ enum machine_mode mode = insn_data[icode].operand[0].mode; ++ tree arg = TREE_VALUE (arglist); ++ store_dest = expand_expr (arg, NULL_RTX, VOIDmode, 0); ++ store_dest = protect_from_queue (store_dest, 0); ++ ++ store_dest = gen_rtx_MEM (mode, copy_to_mode_reg (Pmode, store_dest)); ++ ++ /* ??? Better errors would be nice */ ++ if (!(*insn_data[icode].operand[0].predicate) (store_dest, mode)) ++ error ("Invalid argument 1 to %s", d->name); ++ } ++ ++ ++ /* process the value to store */ ++ { ++ enum machine_mode mode = insn_data[icode].operand[1].mode; ++ tree arg = TREE_VALUE (TREE_CHAIN (arglist)); ++ store_val = expand_expr (arg, NULL_RTX, mode, 0); ++ store_val = protect_from_queue (store_val, 0); ++ ++ if (!(*insn_data[icode].operand[1].predicate) (store_val, mode)) ++ store_val = copy_to_mode_reg (mode, store_val); ++ ++ /* ??? Better errors would be nice */ ++ if (!(*insn_data[icode].operand[1].predicate) (store_val, mode)) ++ error ("Invalid argument 2 to %s", d->name); ++ } ++ ++ pat = GEN_FCN (d->icode) (store_dest, store_val); ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return 0; ++} ++ ++ ++static rtx ++nios2_expand_LDXIO (const struct builtin_description * d, tree exp, rtx target, ++ rtx subtarget ATTRIBUTE_UNUSED, enum machine_mode mode ATTRIBUTE_UNUSED, ++ int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx ld_src; ++ enum insn_code icode = d->icode; ++ ++ /* loads should have exactly two operands */ ++ if (insn_data[icode].n_operands != 2) ++ abort (); ++ ++ target = nios2_create_target (d, target); ++ ++ { ++ enum machine_mode mode = insn_data[icode].operand[1].mode; ++ tree arg = TREE_VALUE (arglist); ++ ld_src = expand_expr (arg, NULL_RTX, VOIDmode, 0); ++ ld_src = protect_from_queue (ld_src, 0); ++ ++ ld_src = gen_rtx_MEM (mode, copy_to_mode_reg (Pmode, ld_src)); ++ ++ /* ??? Better errors would be nice */ ++ if (!(*insn_data[icode].operand[1].predicate) (ld_src, mode)) ++ { ++ error ("Invalid argument 1 to %s", d->name); ++ } ++ } ++ ++ pat = GEN_FCN (d->icode) (target, ld_src); ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return target; ++} ++ ++ ++static rtx ++nios2_expand_sync (const struct builtin_description * d ATTRIBUTE_UNUSED, ++ tree exp ATTRIBUTE_UNUSED, rtx target ATTRIBUTE_UNUSED, ++ rtx subtarget ATTRIBUTE_UNUSED, ++ enum machine_mode mode ATTRIBUTE_UNUSED, ++ int ignore ATTRIBUTE_UNUSED) ++{ ++ emit_insn (gen_sync ()); ++ return 0; ++} ++ ++static rtx ++nios2_expand_rdctl (const struct builtin_description * d ATTRIBUTE_UNUSED, ++ tree exp ATTRIBUTE_UNUSED, rtx target ATTRIBUTE_UNUSED, ++ rtx subtarget ATTRIBUTE_UNUSED, ++ enum machine_mode mode ATTRIBUTE_UNUSED, ++ int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx rdctl_reg; ++ enum insn_code icode = d->icode; ++ ++ /* rdctl should have exactly two operands */ ++ if (insn_data[icode].n_operands != 2) ++ abort (); ++ ++ target = nios2_create_target (d, target); ++ ++ { ++ enum machine_mode mode = insn_data[icode].operand[1].mode; ++ tree arg = TREE_VALUE (arglist); ++ rdctl_reg = expand_expr (arg, NULL_RTX, VOIDmode, 0); ++ rdctl_reg = protect_from_queue (rdctl_reg, 0); ++ ++ if (!(*insn_data[icode].operand[1].predicate) (rdctl_reg, mode)) ++ { ++ error ("Control register number must be in range 0-31 for %s", d->name); ++ } ++ } ++ ++ pat = GEN_FCN (d->icode) (target, rdctl_reg); ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return target; ++} ++ ++static rtx ++nios2_expand_wrctl (const struct builtin_description * d ATTRIBUTE_UNUSED, ++ tree exp ATTRIBUTE_UNUSED, rtx target ATTRIBUTE_UNUSED, ++ rtx subtarget ATTRIBUTE_UNUSED, ++ enum machine_mode mode ATTRIBUTE_UNUSED, ++ int ignore ATTRIBUTE_UNUSED) ++{ ++ tree arglist = TREE_OPERAND (exp, 1); ++ rtx pat; ++ rtx wrctl_reg, store_val; ++ enum insn_code icode = d->icode; ++ ++ /* stores should have exactly two operands */ ++ if (insn_data[icode].n_operands != 2) ++ abort (); ++ ++ /* process the destination of the store */ ++ { ++ enum machine_mode mode = insn_data[icode].operand[0].mode; ++ tree arg = TREE_VALUE (arglist); ++ wrctl_reg = expand_expr (arg, NULL_RTX, VOIDmode, 0); ++ wrctl_reg = protect_from_queue (wrctl_reg, 0); ++ ++ if (!(*insn_data[icode].operand[0].predicate) (wrctl_reg, mode)) ++ error ("Control register number must be in range 0-31 for %s", d->name); ++ } ++ ++ ++ /* process the value to store */ ++ { ++ enum machine_mode mode = insn_data[icode].operand[1].mode; ++ tree arg = TREE_VALUE (TREE_CHAIN (arglist)); ++ store_val = expand_expr (arg, NULL_RTX, mode, 0); ++ store_val = protect_from_queue (store_val, 0); ++ ++ if (!(*insn_data[icode].operand[1].predicate) (store_val, mode)) ++ store_val = copy_to_mode_reg (mode, store_val); ++ ++ /* ??? Better errors would be nice */ ++ if (!(*insn_data[icode].operand[1].predicate) (store_val, mode)) ++ error ("Invalid argument 2 to %s", d->name); ++ } ++ ++ pat = GEN_FCN (d->icode) (wrctl_reg, store_val); ++ if (!pat) ++ return 0; ++ emit_insn (pat); ++ return 0; ++} ++ ++ ++#include "gt-nios2.h" ++ +diff -durN gcc-3.4.6.orig/gcc/config/nios2/nios2-dp-bit.c gcc-3.4.6/gcc/config/nios2/nios2-dp-bit.c +--- gcc-3.4.6.orig/gcc/config/nios2/nios2-dp-bit.c 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/gcc/config/nios2/nios2-dp-bit.c 2007-08-15 23:09:36.000000000 +0200 +@@ -0,0 +1,1652 @@ ++ ++/* This is a software floating point library which can be used ++ for targets without hardware floating point. ++ Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004 ++ Free Software Foundation, Inc. ++ ++This file is free software; you can redistribute it and/or modify it ++under the terms of the GNU General Public License as published by the ++Free Software Foundation; either version 2, or (at your option) any ++later version. ++ ++In addition to the permissions in the GNU General Public License, the ++Free Software Foundation gives you unlimited permission to link the ++compiled version of this file with other programs, and to distribute ++those programs without any restriction coming from the use of this ++file. (The General Public License restrictions do apply in other ++respects; for example, they cover modification of the file, and ++distribution when not linked into another program.) ++ ++This file is distributed in the hope that it will be useful, but ++WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with this program; see the file COPYING. If not, write to ++the Free Software Foundation, 59 Temple Place - Suite 330, ++Boston, MA 02111-1307, USA. */ ++ ++/* As a special exception, if you link this library with other files, ++ some of which are compiled with GCC, to produce an executable, ++ this library does not by itself cause the resulting executable ++ to be covered by the GNU General Public License. ++ This exception does not however invalidate any other reasons why ++ the executable file might be covered by the GNU General Public License. */ ++ ++/* This implements IEEE 754 format arithmetic, but does not provide a ++ mechanism for setting the rounding mode, or for generating or handling ++ exceptions. ++ ++ The original code by Steve Chamberlain, hacked by Mark Eichin and Jim ++ Wilson, all of Cygnus Support. */ ++ ++/* The intended way to use this file is to make two copies, add `#define FLOAT' ++ to one copy, then compile both copies and add them to libgcc.a. */ ++ ++#include "tconfig.h" ++#include "coretypes.h" ++#include "tm.h" ++#include "config/fp-bit.h" ++ ++/* The following macros can be defined to change the behavior of this file: ++ FLOAT: Implement a `float', aka SFmode, fp library. If this is not ++ defined, then this file implements a `double', aka DFmode, fp library. ++ FLOAT_ONLY: Used with FLOAT, to implement a `float' only library, i.e. ++ don't include float->double conversion which requires the double library. ++ This is useful only for machines which can't support doubles, e.g. some ++ 8-bit processors. ++ CMPtype: Specify the type that floating point compares should return. ++ This defaults to SItype, aka int. ++ US_SOFTWARE_GOFAST: This makes all entry points use the same names as the ++ US Software goFast library. ++ _DEBUG_BITFLOAT: This makes debugging the code a little easier, by adding ++ two integers to the FLO_union_type. ++ NO_DENORMALS: Disable handling of denormals. ++ NO_NANS: Disable nan and infinity handling ++ SMALL_MACHINE: Useful when operations on QIs and HIs are faster ++ than on an SI */ ++ ++/* We don't currently support extended floats (long doubles) on machines ++ without hardware to deal with them. ++ ++ These stubs are just to keep the linker from complaining about unresolved ++ references which can be pulled in from libio & libstdc++, even if the ++ user isn't using long doubles. However, they may generate an unresolved ++ external to abort if abort is not used by the function, and the stubs ++ are referenced from within libc, since libgcc goes before and after the ++ system library. */ ++ ++#ifdef DECLARE_LIBRARY_RENAMES ++ DECLARE_LIBRARY_RENAMES ++#endif ++ ++#ifdef EXTENDED_FLOAT_STUBS ++extern void abort (void); ++void __extendsfxf2 (void) { abort(); } ++void __extenddfxf2 (void) { abort(); } ++void __truncxfdf2 (void) { abort(); } ++void __truncxfsf2 (void) { abort(); } ++void __fixxfsi (void) { abort(); } ++void __floatsixf (void) { abort(); } ++void __addxf3 (void) { abort(); } ++void __subxf3 (void) { abort(); } ++void __mulxf3 (void) { abort(); } ++void __divxf3 (void) { abort(); } ++void __negxf2 (void) { abort(); } ++void __eqxf2 (void) { abort(); } ++void __nexf2 (void) { abort(); } ++void __gtxf2 (void) { abort(); } ++void __gexf2 (void) { abort(); } ++void __lexf2 (void) { abort(); } ++void __ltxf2 (void) { abort(); } ++ ++void __extendsftf2 (void) { abort(); } ++void __extenddftf2 (void) { abort(); } ++void __trunctfdf2 (void) { abort(); } ++void __trunctfsf2 (void) { abort(); } ++void __fixtfsi (void) { abort(); } ++void __floatsitf (void) { abort(); } ++void __addtf3 (void) { abort(); } ++void __subtf3 (void) { abort(); } ++void __multf3 (void) { abort(); } ++void __divtf3 (void) { abort(); } ++void __negtf2 (void) { abort(); } ++void __eqtf2 (void) { abort(); } ++void __netf2 (void) { abort(); } ++void __gttf2 (void) { abort(); } ++void __getf2 (void) { abort(); } ++void __letf2 (void) { abort(); } ++void __lttf2 (void) { abort(); } ++#else /* !EXTENDED_FLOAT_STUBS, rest of file */ ++ ++/* IEEE "special" number predicates */ ++ ++#ifdef NO_NANS ++ ++#define nan() 0 ++#define isnan(x) 0 ++#define isinf(x) 0 ++#else ++ ++#if defined L_thenan_sf ++const fp_number_type __thenan_sf = { CLASS_SNAN, 0, 0, {(fractype) 0} }; ++#elif defined L_thenan_df ++const fp_number_type __thenan_df = { CLASS_SNAN, 0, 0, {(fractype) 0} }; ++#elif defined L_thenan_tf ++const fp_number_type __thenan_tf = { CLASS_SNAN, 0, 0, {(fractype) 0} }; ++#elif defined TFLOAT ++extern const fp_number_type __thenan_tf; ++#elif defined FLOAT ++extern const fp_number_type __thenan_sf; ++#else ++extern const fp_number_type __thenan_df; ++#endif ++ ++INLINE ++static fp_number_type * ++nan (void) ++{ ++ /* Discard the const qualifier... */ ++#ifdef TFLOAT ++ return (fp_number_type *) (& __thenan_tf); ++#elif defined FLOAT ++ return (fp_number_type *) (& __thenan_sf); ++#else ++ return (fp_number_type *) (& __thenan_df); ++#endif ++} ++ ++INLINE ++static int ++isnan ( fp_number_type * x) ++{ ++ return x->class == CLASS_SNAN || x->class == CLASS_QNAN; ++} ++ ++INLINE ++static int ++isinf ( fp_number_type * x) ++{ ++ return x->class == CLASS_INFINITY; ++} ++ ++#endif /* NO_NANS */ ++ ++INLINE ++static int ++iszero ( fp_number_type * x) ++{ ++ return x->class == CLASS_ZERO; ++} ++ ++INLINE ++static void ++flip_sign ( fp_number_type * x) ++{ ++ x->sign = !x->sign; ++} ++ ++extern FLO_type pack_d ( fp_number_type * ); ++ ++#if defined(L_pack_df) || defined(L_pack_sf) || defined(L_pack_tf) ++FLO_type ++pack_d ( fp_number_type * src) ++{ ++ FLO_union_type dst; ++ fractype fraction = src->fraction.ll; /* wasn't unsigned before? */ ++ int sign = src->sign; ++ int exp = 0; ++ ++ if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && (isnan (src) || isinf (src))) ++ { ++ /* We can't represent these values accurately. By using the ++ largest possible magnitude, we guarantee that the conversion ++ of infinity is at least as big as any finite number. */ ++ exp = EXPMAX; ++ fraction = ((fractype) 1 << FRACBITS) - 1; ++ } ++ else if (isnan (src)) ++ { ++ exp = EXPMAX; ++ if (src->class == CLASS_QNAN || 1) ++ { ++#ifdef QUIET_NAN_NEGATED ++ fraction |= QUIET_NAN - 1; ++#else ++ fraction |= QUIET_NAN; ++#endif ++ } ++ } ++ else if (isinf (src)) ++ { ++ exp = EXPMAX; ++ fraction = 0; ++ } ++ else if (iszero (src)) ++ { ++ exp = 0; ++ fraction = 0; ++ } ++ else if (fraction == 0) ++ { ++ exp = 0; ++ } ++ else ++ { ++ if (src->normal_exp < NORMAL_EXPMIN) ++ { ++#ifdef NO_DENORMALS ++ /* Go straight to a zero representation if denormals are not ++ supported. The denormal handling would be harmless but ++ isn't unnecessary. */ ++ exp = 0; ++ fraction = 0; ++#else /* NO_DENORMALS */ ++ /* This number's exponent is too low to fit into the bits ++ available in the number, so we'll store 0 in the exponent and ++ shift the fraction to the right to make up for it. */ ++ ++ int shift = NORMAL_EXPMIN - src->normal_exp; ++ ++ exp = 0; ++ ++ if (shift > FRAC_NBITS - NGARDS) ++ { ++ /* No point shifting, since it's more that 64 out. */ ++ fraction = 0; ++ } ++ else ++ { ++ int lowbit = (fraction & (((fractype)1 << shift) - 1)) ? 1 : 0; ++ fraction = (fraction >> shift) | lowbit; ++ } ++ if ((fraction & GARDMASK) == GARDMSB) ++ { ++ if ((fraction & (1 << NGARDS))) ++ fraction += GARDROUND + 1; ++ } ++ else ++ { ++ /* Add to the guards to round up. */ ++ fraction += GARDROUND; ++ } ++ /* Perhaps the rounding means we now need to change the ++ exponent, because the fraction is no longer denormal. */ ++ if (fraction >= IMPLICIT_1) ++ { ++ exp += 1; ++ } ++ fraction >>= NGARDS; ++#endif /* NO_DENORMALS */ ++ } ++ else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) ++ && src->normal_exp > EXPBIAS) ++ { ++ exp = EXPMAX; ++ fraction = 0; ++ } ++ else ++ { ++ exp = src->normal_exp + EXPBIAS; ++ if (!ROUND_TOWARDS_ZERO) ++ { ++ /* IF the gard bits are the all zero, but the first, then we're ++ half way between two numbers, choose the one which makes the ++ lsb of the answer 0. */ ++ if ((fraction & GARDMASK) == GARDMSB) ++ { ++ if (fraction & (1 << NGARDS)) ++ fraction += GARDROUND + 1; ++ } ++ else ++ { ++ /* Add a one to the guards to round up */ ++ fraction += GARDROUND; ++ } ++ if (fraction >= IMPLICIT_2) ++ { ++ fraction >>= 1; ++ exp += 1; ++ } ++ } ++ fraction >>= NGARDS; ++ ++ if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && exp > EXPMAX) ++ { ++ /* Saturate on overflow. */ ++ exp = EXPMAX; ++ fraction = ((fractype) 1 << FRACBITS) - 1; ++ } ++ } ++ } ++ ++ /* We previously used bitfields to store the number, but this doesn't ++ handle little/big endian systems conveniently, so use shifts and ++ masks */ ++#ifdef FLOAT_BIT_ORDER_MISMATCH ++ dst.bits.fraction = fraction; ++ dst.bits.exp = exp; ++ dst.bits.sign = sign; ++#else ++# if defined TFLOAT && defined HALFFRACBITS ++ { ++ halffractype high, low, unity; ++ int lowsign, lowexp; ++ ++ unity = (halffractype) 1 << HALFFRACBITS; ++ ++ /* Set HIGH to the high double's significand, masking out the implicit 1. ++ Set LOW to the low double's full significand. */ ++ high = (fraction >> (FRACBITS - HALFFRACBITS)) & (unity - 1); ++ low = fraction & (unity * 2 - 1); ++ ++ /* Get the initial sign and exponent of the low double. */ ++ lowexp = exp - HALFFRACBITS - 1; ++ lowsign = sign; ++ ++ /* HIGH should be rounded like a normal double, making |LOW| <= ++ 0.5 ULP of HIGH. Assume round-to-nearest. */ ++ if (exp < EXPMAX) ++ if (low > unity || (low == unity && (high & 1) == 1)) ++ { ++ /* Round HIGH up and adjust LOW to match. */ ++ high++; ++ if (high == unity) ++ { ++ /* May make it infinite, but that's OK. */ ++ high = 0; ++ exp++; ++ } ++ low = unity * 2 - low; ++ lowsign ^= 1; ++ } ++ ++ high |= (halffractype) exp << HALFFRACBITS; ++ high |= (halffractype) sign << (HALFFRACBITS + EXPBITS); ++ ++ if (exp == EXPMAX || exp == 0 || low == 0) ++ low = 0; ++ else ++ { ++ while (lowexp > 0 && low < unity) ++ { ++ low <<= 1; ++ lowexp--; ++ } ++ ++ if (lowexp <= 0) ++ { ++ halffractype roundmsb, round; ++ int shift; ++ ++ shift = 1 - lowexp; ++ roundmsb = (1 << (shift - 1)); ++ round = low & ((roundmsb << 1) - 1); ++ ++ low >>= shift; ++ lowexp = 0; ++ ++ if (round > roundmsb || (round == roundmsb && (low & 1) == 1)) ++ { ++ low++; ++ if (low == unity) ++ /* LOW rounds up to the smallest normal number. */ ++ lowexp++; ++ } ++ } ++ ++ low &= unity - 1; ++ low |= (halffractype) lowexp << HALFFRACBITS; ++ low |= (halffractype) lowsign << (HALFFRACBITS + EXPBITS); ++ } ++ dst.value_raw = ((fractype) high << HALFSHIFT) | low; ++ } ++# else ++ dst.value_raw = fraction & ((((fractype)1) << FRACBITS) - (fractype)1); ++ dst.value_raw |= ((fractype) (exp & ((1 << EXPBITS) - 1))) << FRACBITS; ++ dst.value_raw |= ((fractype) (sign & 1)) << (FRACBITS | EXPBITS); ++# endif ++#endif ++ ++#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT) ++#ifdef TFLOAT ++ { ++ qrtrfractype tmp1 = dst.words[0]; ++ qrtrfractype tmp2 = dst.words[1]; ++ dst.words[0] = dst.words[3]; ++ dst.words[1] = dst.words[2]; ++ dst.words[2] = tmp2; ++ dst.words[3] = tmp1; ++ } ++#else ++ { ++ halffractype tmp = dst.words[0]; ++ dst.words[0] = dst.words[1]; ++ dst.words[1] = tmp; ++ } ++#endif ++#endif ++ ++ return dst.value; ++} ++#endif ++ ++#if defined(L_unpack_df) || defined(L_unpack_sf) || defined(L_unpack_tf) ++void ++unpack_d (FLO_union_type * src, fp_number_type * dst) ++{ ++ /* We previously used bitfields to store the number, but this doesn't ++ handle little/big endian systems conveniently, so use shifts and ++ masks */ ++ fractype fraction; ++ int exp; ++ int sign; ++ ++#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT) ++ FLO_union_type swapped; ++ ++#ifdef TFLOAT ++ swapped.words[0] = src->words[3]; ++ swapped.words[1] = src->words[2]; ++ swapped.words[2] = src->words[1]; ++ swapped.words[3] = src->words[0]; ++#else ++ swapped.words[0] = src->words[1]; ++ swapped.words[1] = src->words[0]; ++#endif ++ src = &swapped; ++#endif ++ ++#ifdef FLOAT_BIT_ORDER_MISMATCH ++ fraction = src->bits.fraction; ++ exp = src->bits.exp; ++ sign = src->bits.sign; ++#else ++# if defined TFLOAT && defined HALFFRACBITS ++ { ++ halffractype high, low; ++ ++ high = src->value_raw >> HALFSHIFT; ++ low = src->value_raw & (((fractype)1 << HALFSHIFT) - 1); ++ ++ fraction = high & ((((fractype)1) << HALFFRACBITS) - 1); ++ fraction <<= FRACBITS - HALFFRACBITS; ++ exp = ((int)(high >> HALFFRACBITS)) & ((1 << EXPBITS) - 1); ++ sign = ((int)(high >> (((HALFFRACBITS + EXPBITS))))) & 1; ++ ++ if (exp != EXPMAX && exp != 0 && low != 0) ++ { ++ int lowexp = ((int)(low >> HALFFRACBITS)) & ((1 << EXPBITS) - 1); ++ int lowsign = ((int)(low >> (((HALFFRACBITS + EXPBITS))))) & 1; ++ int shift; ++ fractype xlow; ++ ++ xlow = low & ((((fractype)1) << HALFFRACBITS) - 1); ++ if (lowexp) ++ xlow |= (((halffractype)1) << HALFFRACBITS); ++ else ++ lowexp = 1; ++ shift = (FRACBITS - HALFFRACBITS) - (exp - lowexp); ++ if (shift > 0) ++ xlow <<= shift; ++ else if (shift < 0) ++ xlow >>= -shift; ++ if (sign == lowsign) ++ fraction += xlow; ++ else if (fraction >= xlow) ++ fraction -= xlow; ++ else ++ { ++ /* The high part is a power of two but the full number is lower. ++ This code will leave the implicit 1 in FRACTION, but we'd ++ have added that below anyway. */ ++ fraction = (((fractype) 1 << FRACBITS) - xlow) << 1; ++ exp--; ++ } ++ } ++ } ++# else ++ fraction = src->value_raw & ((((fractype)1) << FRACBITS) - 1); ++ exp = ((int)(src->value_raw >> FRACBITS)) & ((1 << EXPBITS) - 1); ++ sign = ((int)(src->value_raw >> (FRACBITS + EXPBITS))) & 1; ++# endif ++#endif ++ ++ dst->sign = sign; ++ if (exp == 0) ++ { ++ /* Hmm. Looks like 0 */ ++ if (fraction == 0 ++#ifdef NO_DENORMALS ++ || 1 ++#endif ++ ) ++ { ++ /* tastes like zero */ ++ dst->class = CLASS_ZERO; ++ } ++ else ++ { ++ /* Zero exponent with nonzero fraction - it's denormalized, ++ so there isn't a leading implicit one - we'll shift it so ++ it gets one. */ ++ dst->normal_exp = exp - EXPBIAS + 1; ++ fraction <<= NGARDS; ++ ++ dst->class = CLASS_NUMBER; ++#if 1 ++ while (fraction < IMPLICIT_1) ++ { ++ fraction <<= 1; ++ dst->normal_exp--; ++ } ++#endif ++ dst->fraction.ll = fraction; ++ } ++ } ++ else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && exp == EXPMAX) ++ { ++ /* Huge exponent*/ ++ if (fraction == 0) ++ { ++ /* Attached to a zero fraction - means infinity */ ++ dst->class = CLASS_INFINITY; ++ } ++ else ++ { ++ /* Nonzero fraction, means nan */ ++#ifdef QUIET_NAN_NEGATED ++ if ((fraction & QUIET_NAN) == 0) ++#else ++ if (fraction & QUIET_NAN) ++#endif ++ { ++ dst->class = CLASS_QNAN; ++ } ++ else ++ { ++ dst->class = CLASS_SNAN; ++ } ++ /* Keep the fraction part as the nan number */ ++ dst->fraction.ll = fraction; ++ } ++ } ++ else ++ { ++ /* Nothing strange about this number */ ++ dst->normal_exp = exp - EXPBIAS; ++ dst->class = CLASS_NUMBER; ++ dst->fraction.ll = (fraction << NGARDS) | IMPLICIT_1; ++ } ++} ++#endif /* L_unpack_df || L_unpack_sf */ ++ ++#if defined(L_addsub_sf) || defined(L_addsub_df) || defined(L_addsub_tf) ++static fp_number_type * ++_fpadd_parts (fp_number_type * a, ++ fp_number_type * b, ++ fp_number_type * tmp) ++{ ++ intfrac tfraction; ++ ++ /* Put commonly used fields in local variables. */ ++ int a_normal_exp; ++ int b_normal_exp; ++ fractype a_fraction; ++ fractype b_fraction; ++ ++ if (isnan (a)) ++ { ++ return a; ++ } ++ if (isnan (b)) ++ { ++ return b; ++ } ++ if (isinf (a)) ++ { ++ /* Adding infinities with opposite signs yields a NaN. */ ++ if (isinf (b) && a->sign != b->sign) ++ return nan (); ++ return a; ++ } ++ if (isinf (b)) ++ { ++ return b; ++ } ++ if (iszero (b)) ++ { ++ if (iszero (a)) ++ { ++ *tmp = *a; ++ tmp->sign = a->sign & b->sign; ++ return tmp; ++ } ++ return a; ++ } ++ if (iszero (a)) ++ { ++ return b; ++ } ++ ++ /* Got two numbers. shift the smaller and increment the exponent till ++ they're the same */ ++ { ++ int diff; ++ ++ a_normal_exp = a->normal_exp; ++ b_normal_exp = b->normal_exp; ++ a_fraction = a->fraction.ll; ++ b_fraction = b->fraction.ll; ++ ++ diff = a_normal_exp - b_normal_exp; ++ ++ if (diff < 0) ++ diff = -diff; ++ if (diff < FRAC_NBITS) ++ { ++ /* ??? This does shifts one bit at a time. Optimize. */ ++ while (a_normal_exp > b_normal_exp) ++ { ++ b_normal_exp++; ++ LSHIFT (b_fraction); ++ } ++ while (b_normal_exp > a_normal_exp) ++ { ++ a_normal_exp++; ++ LSHIFT (a_fraction); ++ } ++ } ++ else ++ { ++ /* Somethings's up.. choose the biggest */ ++ if (a_normal_exp > b_normal_exp) ++ { ++ b_normal_exp = a_normal_exp; ++ b_fraction = 0; ++ } ++ else ++ { ++ a_normal_exp = b_normal_exp; ++ a_fraction = 0; ++ } ++ } ++ } ++ ++ if (a->sign != b->sign) ++ { ++ if (a->sign) ++ { ++ tfraction = -a_fraction + b_fraction; ++ } ++ else ++ { ++ tfraction = a_fraction - b_fraction; ++ } ++ if (tfraction >= 0) ++ { ++ tmp->sign = 0; ++ tmp->normal_exp = a_normal_exp; ++ tmp->fraction.ll = tfraction; ++ } ++ else ++ { ++ tmp->sign = 1; ++ tmp->normal_exp = a_normal_exp; ++ tmp->fraction.ll = -tfraction; ++ } ++ /* and renormalize it */ ++ ++ while (tmp->fraction.ll < IMPLICIT_1 && tmp->fraction.ll) ++ { ++ tmp->fraction.ll <<= 1; ++ tmp->normal_exp--; ++ } ++ } ++ else ++ { ++ tmp->sign = a->sign; ++ tmp->normal_exp = a_normal_exp; ++ tmp->fraction.ll = a_fraction + b_fraction; ++ } ++ tmp->class = CLASS_NUMBER; ++ /* Now the fraction is added, we have to shift down to renormalize the ++ number */ ++ ++ if (tmp->fraction.ll >= IMPLICIT_2) ++ { ++ LSHIFT (tmp->fraction.ll); ++ tmp->normal_exp++; ++ } ++ return tmp; ++ ++} ++ ++FLO_type ++add (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ fp_number_type tmp; ++ fp_number_type *res; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ res = _fpadd_parts (&a, &b, &tmp); ++ ++ return pack_d (res); ++} ++ ++FLO_type ++sub (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ fp_number_type tmp; ++ fp_number_type *res; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ b.sign ^= 1; ++ ++ res = _fpadd_parts (&a, &b, &tmp); ++ ++ return pack_d (res); ++} ++#endif /* L_addsub_sf || L_addsub_df */ ++ ++#if defined(L_mul_sf) || defined(L_mul_df) || defined(L_mul_tf) ++static inline __attribute__ ((__always_inline__)) fp_number_type * ++_fpmul_parts ( fp_number_type * a, ++ fp_number_type * b, ++ fp_number_type * tmp) ++{ ++ fractype low = 0; ++ fractype high = 0; ++ ++ if (isnan (a)) ++ { ++ a->sign = a->sign != b->sign; ++ return a; ++ } ++ if (isnan (b)) ++ { ++ b->sign = a->sign != b->sign; ++ return b; ++ } ++ if (isinf (a)) ++ { ++ if (iszero (b)) ++ return nan (); ++ a->sign = a->sign != b->sign; ++ return a; ++ } ++ if (isinf (b)) ++ { ++ if (iszero (a)) ++ { ++ return nan (); ++ } ++ b->sign = a->sign != b->sign; ++ return b; ++ } ++ if (iszero (a)) ++ { ++ a->sign = a->sign != b->sign; ++ return a; ++ } ++ if (iszero (b)) ++ { ++ b->sign = a->sign != b->sign; ++ return b; ++ } ++ ++ /* Calculate the mantissa by multiplying both numbers to get a ++ twice-as-wide number. */ ++ { ++#if defined(NO_DI_MODE) || defined(TFLOAT) ++ { ++ fractype x = a->fraction.ll; ++ fractype ylow = b->fraction.ll; ++ fractype yhigh = 0; ++ int bit; ++ ++ /* ??? This does multiplies one bit at a time. Optimize. */ ++ for (bit = 0; bit < FRAC_NBITS; bit++) ++ { ++ int carry; ++ ++ if (x & 1) ++ { ++ carry = (low += ylow) < ylow; ++ high += yhigh + carry; ++ } ++ yhigh <<= 1; ++ if (ylow & FRACHIGH) ++ { ++ yhigh |= 1; ++ } ++ ylow <<= 1; ++ x >>= 1; ++ } ++ } ++#elif defined(FLOAT) ++ /* Multiplying two USIs to get a UDI, we're safe. */ ++ { ++ UDItype answer = (UDItype)a->fraction.ll * (UDItype)b->fraction.ll; ++ ++ high = answer >> BITS_PER_SI; ++ low = answer; ++ } ++#else ++ /* fractype is DImode, but we need the result to be twice as wide. ++ Assuming a widening multiply from DImode to TImode is not ++ available, build one by hand. */ ++ { ++ USItype nl = a->fraction.ll; ++ USItype nh = a->fraction.ll >> BITS_PER_SI; ++ USItype ml = b->fraction.ll; ++ USItype mh = b->fraction.ll >> BITS_PER_SI; ++ UDItype pp_ll = (UDItype) ml * nl; ++ UDItype pp_hl = (UDItype) mh * nl; ++ UDItype pp_lh = (UDItype) ml * nh; ++ UDItype pp_hh = (UDItype) mh * nh; ++ UDItype res2 = 0; ++ UDItype res0 = 0; ++ UDItype ps_hh__ = pp_hl + pp_lh; ++ if (ps_hh__ < pp_hl) ++ res2 += (UDItype)1 << BITS_PER_SI; ++ pp_hl = (UDItype)(USItype)ps_hh__ << BITS_PER_SI; ++ res0 = pp_ll + pp_hl; ++ if (res0 < pp_ll) ++ res2++; ++ res2 += (ps_hh__ >> BITS_PER_SI) + pp_hh; ++ high = res2; ++ low = res0; ++ } ++#endif ++ } ++ ++ tmp->normal_exp = a->normal_exp + b->normal_exp ++ + FRAC_NBITS - (FRACBITS + NGARDS); ++ tmp->sign = a->sign != b->sign; ++ while (high >= IMPLICIT_2) ++ { ++ tmp->normal_exp++; ++ if (high & 1) ++ { ++ low >>= 1; ++ low |= FRACHIGH; ++ } ++ high >>= 1; ++ } ++ while (high < IMPLICIT_1) ++ { ++ tmp->normal_exp--; ++ ++ high <<= 1; ++ if (low & FRACHIGH) ++ high |= 1; ++ low <<= 1; ++ } ++ /* rounding is tricky. if we only round if it won't make us round later. */ ++#if 0 ++ if (low & FRACHIGH2) ++ { ++ if (((high & GARDMASK) != GARDMSB) ++ && (((high + 1) & GARDMASK) == GARDMSB)) ++ { ++ /* don't round, it gets done again later. */ ++ } ++ else ++ { ++ high++; ++ } ++ } ++#endif ++ if (!ROUND_TOWARDS_ZERO && (high & GARDMASK) == GARDMSB) ++ { ++ if (high & (1 << NGARDS)) ++ { ++ /* half way, so round to even */ ++ high += GARDROUND + 1; ++ } ++ else if (low) ++ { ++ /* but we really weren't half way */ ++ high += GARDROUND + 1; ++ } ++ } ++ tmp->fraction.ll = high; ++ tmp->class = CLASS_NUMBER; ++ return tmp; ++} ++ ++FLO_type ++multiply (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ fp_number_type tmp; ++ fp_number_type *res; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ res = _fpmul_parts (&a, &b, &tmp); ++ ++ return pack_d (res); ++} ++#endif /* L_mul_sf || L_mul_df */ ++ ++#if defined(L_div_sf) || defined(L_div_df) || defined(L_div_tf) ++static inline __attribute__ ((__always_inline__)) fp_number_type * ++_fpdiv_parts (fp_number_type * a, ++ fp_number_type * b) ++{ ++ fractype bit; ++ fractype numerator; ++ fractype denominator; ++ fractype quotient; ++ ++ if (isnan (a)) ++ { ++ return a; ++ } ++ if (isnan (b)) ++ { ++ return b; ++ } ++ ++ a->sign = a->sign ^ b->sign; ++ ++ if (isinf (a) || iszero (a)) ++ { ++ if (a->class == b->class) ++ return nan (); ++ return a; ++ } ++ ++ if (isinf (b)) ++ { ++ a->fraction.ll = 0; ++ a->normal_exp = 0; ++ return a; ++ } ++ if (iszero (b)) ++ { ++ a->class = CLASS_INFINITY; ++ return a; ++ } ++ ++ /* Calculate the mantissa by multiplying both 64bit numbers to get a ++ 128 bit number */ ++ { ++ /* quotient = ++ ( numerator / denominator) * 2^(numerator exponent - denominator exponent) ++ */ ++ ++ a->normal_exp = a->normal_exp - b->normal_exp; ++ numerator = a->fraction.ll; ++ denominator = b->fraction.ll; ++ ++ if (numerator < denominator) ++ { ++ /* Fraction will be less than 1.0 */ ++ numerator *= 2; ++ a->normal_exp--; ++ } ++ bit = IMPLICIT_1; ++ quotient = 0; ++ /* ??? Does divide one bit at a time. Optimize. */ ++ while (bit) ++ { ++ if (numerator >= denominator) ++ { ++ quotient |= bit; ++ numerator -= denominator; ++ } ++ bit >>= 1; ++ numerator *= 2; ++ } ++ ++ if (!ROUND_TOWARDS_ZERO && (quotient & GARDMASK) == GARDMSB) ++ { ++ if (quotient & (1 << NGARDS)) ++ { ++ /* half way, so round to even */ ++ quotient += GARDROUND + 1; ++ } ++ else if (numerator) ++ { ++ /* but we really weren't half way, more bits exist */ ++ quotient += GARDROUND + 1; ++ } ++ } ++ ++ a->fraction.ll = quotient; ++ return (a); ++ } ++} ++ ++FLO_type ++divide (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ fp_number_type *res; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ res = _fpdiv_parts (&a, &b); ++ ++ return pack_d (res); ++} ++#endif /* L_div_sf || L_div_df */ ++ ++#if defined(L_fpcmp_parts_sf) || defined(L_fpcmp_parts_df) \ ++ || defined(L_fpcmp_parts_tf) ++/* according to the demo, fpcmp returns a comparison with 0... thus ++ a -1 ++ a==b -> 0 ++ a>b -> +1 ++ */ ++ ++int ++__fpcmp_parts (fp_number_type * a, fp_number_type * b) ++{ ++#if 0 ++ /* either nan -> unordered. Must be checked outside of this routine. */ ++ if (isnan (a) && isnan (b)) ++ { ++ return 1; /* still unordered! */ ++ } ++#endif ++ ++ if (isnan (a) || isnan (b)) ++ { ++ return 1; /* how to indicate unordered compare? */ ++ } ++ if (isinf (a) && isinf (b)) ++ { ++ /* +inf > -inf, but +inf != +inf */ ++ /* b \a| +inf(0)| -inf(1) ++ ______\+--------+-------- ++ +inf(0)| a==b(0)| ab(1) | a==b(0) ++ -------+--------+-------- ++ So since unordered must be nonzero, just line up the columns... ++ */ ++ return b->sign - a->sign; ++ } ++ /* but not both... */ ++ if (isinf (a)) ++ { ++ return a->sign ? -1 : 1; ++ } ++ if (isinf (b)) ++ { ++ return b->sign ? 1 : -1; ++ } ++ if (iszero (a) && iszero (b)) ++ { ++ return 0; ++ } ++ if (iszero (a)) ++ { ++ return b->sign ? 1 : -1; ++ } ++ if (iszero (b)) ++ { ++ return a->sign ? -1 : 1; ++ } ++ /* now both are "normal". */ ++ if (a->sign != b->sign) ++ { ++ /* opposite signs */ ++ return a->sign ? -1 : 1; ++ } ++ /* same sign; exponents? */ ++ if (a->normal_exp > b->normal_exp) ++ { ++ return a->sign ? -1 : 1; ++ } ++ if (a->normal_exp < b->normal_exp) ++ { ++ return a->sign ? 1 : -1; ++ } ++ /* same exponents; check size. */ ++ if (a->fraction.ll > b->fraction.ll) ++ { ++ return a->sign ? -1 : 1; ++ } ++ if (a->fraction.ll < b->fraction.ll) ++ { ++ return a->sign ? 1 : -1; ++ } ++ /* after all that, they're equal. */ ++ return 0; ++} ++#endif ++ ++#if defined(L_compare_sf) || defined(L_compare_df) || defined(L_compoare_tf) ++CMPtype ++compare (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ return __fpcmp_parts (&a, &b); ++} ++#endif /* L_compare_sf || L_compare_df */ ++ ++#ifndef US_SOFTWARE_GOFAST ++ ++/* These should be optimized for their specific tasks someday. */ ++ ++#if defined(L_eq_sf) || defined(L_eq_df) || defined(L_eq_tf) ++CMPtype ++_eq_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return 1; /* false, truth == 0 */ ++ ++ return __fpcmp_parts (&a, &b) ; ++} ++#endif /* L_eq_sf || L_eq_df */ ++ ++#if defined(L_ne_sf) || defined(L_ne_df) || defined(L_ne_tf) ++CMPtype ++_ne_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return 1; /* true, truth != 0 */ ++ ++ return __fpcmp_parts (&a, &b) ; ++} ++#endif /* L_ne_sf || L_ne_df */ ++ ++#if defined(L_gt_sf) || defined(L_gt_df) || defined(L_gt_tf) ++CMPtype ++_gt_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return -1; /* false, truth > 0 */ ++ ++ return __fpcmp_parts (&a, &b); ++} ++#endif /* L_gt_sf || L_gt_df */ ++ ++#if defined(L_ge_sf) || defined(L_ge_df) || defined(L_ge_tf) ++CMPtype ++_ge_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return -1; /* false, truth >= 0 */ ++ return __fpcmp_parts (&a, &b) ; ++} ++#endif /* L_ge_sf || L_ge_df */ ++ ++#if defined(L_lt_sf) || defined(L_lt_df) || defined(L_lt_tf) ++CMPtype ++_lt_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return 1; /* false, truth < 0 */ ++ ++ return __fpcmp_parts (&a, &b); ++} ++#endif /* L_lt_sf || L_lt_df */ ++ ++#if defined(L_le_sf) || defined(L_le_df) || defined(L_le_tf) ++CMPtype ++_le_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return 1; /* false, truth <= 0 */ ++ ++ return __fpcmp_parts (&a, &b) ; ++} ++#endif /* L_le_sf || L_le_df */ ++ ++#endif /* ! US_SOFTWARE_GOFAST */ ++ ++#if defined(L_unord_sf) || defined(L_unord_df) || defined(L_unord_tf) ++CMPtype ++_unord_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ return (isnan (&a) || isnan (&b)); ++} ++#endif /* L_unord_sf || L_unord_df */ ++ ++#if defined(L_si_to_sf) || defined(L_si_to_df) || defined(L_si_to_tf) ++FLO_type ++si_to_float (SItype arg_a) ++{ ++ fp_number_type in; ++ ++ in.class = CLASS_NUMBER; ++ in.sign = arg_a < 0; ++ if (!arg_a) ++ { ++ in.class = CLASS_ZERO; ++ } ++ else ++ { ++ in.normal_exp = FRACBITS + NGARDS; ++ if (in.sign) ++ { ++ /* Special case for minint, since there is no +ve integer ++ representation for it */ ++ if (arg_a == (- MAX_SI_INT - 1)) ++ { ++ return (FLO_type)(- MAX_SI_INT - 1); ++ } ++ in.fraction.ll = (-arg_a); ++ } ++ else ++ in.fraction.ll = arg_a; ++ ++ while (in.fraction.ll < ((fractype)1 << (FRACBITS + NGARDS))) ++ { ++ in.fraction.ll <<= 1; ++ in.normal_exp -= 1; ++ } ++ } ++ return pack_d (&in); ++} ++#endif /* L_si_to_sf || L_si_to_df */ ++ ++#if defined(L_usi_to_sf) || defined(L_usi_to_df) || defined(L_usi_to_tf) ++FLO_type ++usi_to_float (USItype arg_a) ++{ ++ fp_number_type in; ++ ++ in.sign = 0; ++ if (!arg_a) ++ { ++ in.class = CLASS_ZERO; ++ } ++ else ++ { ++ in.class = CLASS_NUMBER; ++ in.normal_exp = FRACBITS + NGARDS; ++ in.fraction.ll = arg_a; ++ ++ while (in.fraction.ll > ((fractype)1 << (FRACBITS + NGARDS))) ++ { ++ in.fraction.ll >>= 1; ++ in.normal_exp += 1; ++ } ++ while (in.fraction.ll < ((fractype)1 << (FRACBITS + NGARDS))) ++ { ++ in.fraction.ll <<= 1; ++ in.normal_exp -= 1; ++ } ++ } ++ return pack_d (&in); ++} ++#endif ++ ++#if defined(L_sf_to_si) || defined(L_df_to_si) || defined(L_tf_to_si) ++SItype ++float_to_si (FLO_type arg_a) ++{ ++ fp_number_type a; ++ SItype tmp; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &a); ++ ++ if (iszero (&a)) ++ return 0; ++ if (isnan (&a)) ++ return 0; ++ /* get reasonable MAX_SI_INT... */ ++ if (isinf (&a)) ++ return a.sign ? (-MAX_SI_INT)-1 : MAX_SI_INT; ++ /* it is a number, but a small one */ ++ if (a.normal_exp < 0) ++ return 0; ++ if (a.normal_exp > BITS_PER_SI - 2) ++ return a.sign ? (-MAX_SI_INT)-1 : MAX_SI_INT; ++ tmp = a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp); ++ return a.sign ? (-tmp) : (tmp); ++} ++#endif /* L_sf_to_si || L_df_to_si */ ++ ++#if defined(L_sf_to_usi) || defined(L_df_to_usi) || defined(L_tf_to_usi) ++#if defined US_SOFTWARE_GOFAST || defined(L_tf_to_usi) ++/* While libgcc2.c defines its own __fixunssfsi and __fixunsdfsi routines, ++ we also define them for GOFAST because the ones in libgcc2.c have the ++ wrong names and I'd rather define these here and keep GOFAST CYG-LOC's ++ out of libgcc2.c. We can't define these here if not GOFAST because then ++ there'd be duplicate copies. */ ++ ++USItype ++float_to_usi (FLO_type arg_a) ++{ ++ fp_number_type a; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &a); ++ ++ if (iszero (&a)) ++ return 0; ++ if (isnan (&a)) ++ return 0; ++ /* it is a negative number */ ++ if (a.sign) ++ return 0; ++ /* get reasonable MAX_USI_INT... */ ++ if (isinf (&a)) ++ return MAX_USI_INT; ++ /* it is a number, but a small one */ ++ if (a.normal_exp < 0) ++ return 0; ++ if (a.normal_exp > BITS_PER_SI - 1) ++ return MAX_USI_INT; ++ else if (a.normal_exp > (FRACBITS + NGARDS)) ++ return a.fraction.ll << (a.normal_exp - (FRACBITS + NGARDS)); ++ else ++ return a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp); ++} ++#endif /* US_SOFTWARE_GOFAST */ ++#endif /* L_sf_to_usi || L_df_to_usi */ ++ ++#if defined(L_negate_sf) || defined(L_negate_df) || defined(L_negate_tf) ++FLO_type ++negate (FLO_type arg_a) ++{ ++ fp_number_type a; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &a); ++ ++ flip_sign (&a); ++ return pack_d (&a); ++} ++#endif /* L_negate_sf || L_negate_df */ ++ ++#ifdef FLOAT ++ ++#if defined(L_make_sf) ++SFtype ++__make_fp(fp_class_type class, ++ unsigned int sign, ++ int exp, ++ USItype frac) ++{ ++ fp_number_type in; ++ ++ in.class = class; ++ in.sign = sign; ++ in.normal_exp = exp; ++ in.fraction.ll = frac; ++ return pack_d (&in); ++} ++#endif /* L_make_sf */ ++ ++#ifndef FLOAT_ONLY ++ ++/* This enables one to build an fp library that supports float but not double. ++ Otherwise, we would get an undefined reference to __make_dp. ++ This is needed for some 8-bit ports that can't handle well values that ++ are 8-bytes in size, so we just don't support double for them at all. */ ++ ++#if defined(L_sf_to_df) ++DFtype ++sf_to_df (SFtype arg_a) ++{ ++ fp_number_type in; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ return __make_dp (in.class, in.sign, in.normal_exp, ++ ((UDItype) in.fraction.ll) << F_D_BITOFF); ++} ++#endif /* L_sf_to_df */ ++ ++#if defined(L_sf_to_tf) && defined(TMODES) ++TFtype ++sf_to_tf (SFtype arg_a) ++{ ++ fp_number_type in; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ return __make_tp (in.class, in.sign, in.normal_exp, ++ ((UTItype) in.fraction.ll) << F_T_BITOFF); ++} ++#endif /* L_sf_to_df */ ++ ++#endif /* ! FLOAT_ONLY */ ++#endif /* FLOAT */ ++ ++#ifndef FLOAT ++ ++extern SFtype __make_fp (fp_class_type, unsigned int, int, USItype); ++ ++#if defined(L_make_df) ++DFtype ++__make_dp (fp_class_type class, unsigned int sign, int exp, UDItype frac) ++{ ++ fp_number_type in; ++ ++ in.class = class; ++ in.sign = sign; ++ in.normal_exp = exp; ++ in.fraction.ll = frac; ++ return pack_d (&in); ++} ++#endif /* L_make_df */ ++ ++#if defined(L_df_to_sf) ++SFtype ++df_to_sf (DFtype arg_a) ++{ ++ fp_number_type in; ++ USItype sffrac; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ sffrac = in.fraction.ll >> F_D_BITOFF; ++ ++ /* We set the lowest guard bit in SFFRAC if we discarded any non ++ zero bits. */ ++ if ((in.fraction.ll & (((USItype) 1 << F_D_BITOFF) - 1)) != 0) ++ sffrac |= 1; ++ ++ return __make_fp (in.class, in.sign, in.normal_exp, sffrac); ++} ++#endif /* L_df_to_sf */ ++ ++#if defined(L_df_to_tf) && defined(TMODES) \ ++ && !defined(FLOAT) && !defined(TFLOAT) ++TFtype ++df_to_tf (DFtype arg_a) ++{ ++ fp_number_type in; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ return __make_tp (in.class, in.sign, in.normal_exp, ++ ((UTItype) in.fraction.ll) << D_T_BITOFF); ++} ++#endif /* L_sf_to_df */ ++ ++#ifdef TFLOAT ++#if defined(L_make_tf) ++TFtype ++__make_tp(fp_class_type class, ++ unsigned int sign, ++ int exp, ++ UTItype frac) ++{ ++ fp_number_type in; ++ ++ in.class = class; ++ in.sign = sign; ++ in.normal_exp = exp; ++ in.fraction.ll = frac; ++ return pack_d (&in); ++} ++#endif /* L_make_tf */ ++ ++#if defined(L_tf_to_df) ++DFtype ++tf_to_df (TFtype arg_a) ++{ ++ fp_number_type in; ++ UDItype sffrac; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ sffrac = in.fraction.ll >> D_T_BITOFF; ++ ++ /* We set the lowest guard bit in SFFRAC if we discarded any non ++ zero bits. */ ++ if ((in.fraction.ll & (((UTItype) 1 << D_T_BITOFF) - 1)) != 0) ++ sffrac |= 1; ++ ++ return __make_dp (in.class, in.sign, in.normal_exp, sffrac); ++} ++#endif /* L_tf_to_df */ ++ ++#if defined(L_tf_to_sf) ++SFtype ++tf_to_sf (TFtype arg_a) ++{ ++ fp_number_type in; ++ USItype sffrac; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ sffrac = in.fraction.ll >> F_T_BITOFF; ++ ++ /* We set the lowest guard bit in SFFRAC if we discarded any non ++ zero bits. */ ++ if ((in.fraction.ll & (((UTItype) 1 << F_T_BITOFF) - 1)) != 0) ++ sffrac |= 1; ++ ++ return __make_fp (in.class, in.sign, in.normal_exp, sffrac); ++} ++#endif /* L_tf_to_sf */ ++#endif /* TFLOAT */ ++ ++#endif /* ! FLOAT */ ++#endif /* !EXTENDED_FLOAT_STUBS */ +diff -durN gcc-3.4.6.orig/gcc/config/nios2/nios2-fp-bit.c gcc-3.4.6/gcc/config/nios2/nios2-fp-bit.c +--- gcc-3.4.6.orig/gcc/config/nios2/nios2-fp-bit.c 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/gcc/config/nios2/nios2-fp-bit.c 2007-08-15 23:09:36.000000000 +0200 +@@ -0,0 +1,1652 @@ ++#define FLOAT ++/* This is a software floating point library which can be used ++ for targets without hardware floating point. ++ Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004 ++ Free Software Foundation, Inc. ++ ++This file is free software; you can redistribute it and/or modify it ++under the terms of the GNU General Public License as published by the ++Free Software Foundation; either version 2, or (at your option) any ++later version. ++ ++In addition to the permissions in the GNU General Public License, the ++Free Software Foundation gives you unlimited permission to link the ++compiled version of this file with other programs, and to distribute ++those programs without any restriction coming from the use of this ++file. (The General Public License restrictions do apply in other ++respects; for example, they cover modification of the file, and ++distribution when not linked into another program.) ++ ++This file is distributed in the hope that it will be useful, but ++WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with this program; see the file COPYING. If not, write to ++the Free Software Foundation, 59 Temple Place - Suite 330, ++Boston, MA 02111-1307, USA. */ ++ ++/* As a special exception, if you link this library with other files, ++ some of which are compiled with GCC, to produce an executable, ++ this library does not by itself cause the resulting executable ++ to be covered by the GNU General Public License. ++ This exception does not however invalidate any other reasons why ++ the executable file might be covered by the GNU General Public License. */ ++ ++/* This implements IEEE 754 format arithmetic, but does not provide a ++ mechanism for setting the rounding mode, or for generating or handling ++ exceptions. ++ ++ The original code by Steve Chamberlain, hacked by Mark Eichin and Jim ++ Wilson, all of Cygnus Support. */ ++ ++/* The intended way to use this file is to make two copies, add `#define FLOAT' ++ to one copy, then compile both copies and add them to libgcc.a. */ ++ ++#include "tconfig.h" ++#include "coretypes.h" ++#include "tm.h" ++#include "config/fp-bit.h" ++ ++/* The following macros can be defined to change the behavior of this file: ++ FLOAT: Implement a `float', aka SFmode, fp library. If this is not ++ defined, then this file implements a `double', aka DFmode, fp library. ++ FLOAT_ONLY: Used with FLOAT, to implement a `float' only library, i.e. ++ don't include float->double conversion which requires the double library. ++ This is useful only for machines which can't support doubles, e.g. some ++ 8-bit processors. ++ CMPtype: Specify the type that floating point compares should return. ++ This defaults to SItype, aka int. ++ US_SOFTWARE_GOFAST: This makes all entry points use the same names as the ++ US Software goFast library. ++ _DEBUG_BITFLOAT: This makes debugging the code a little easier, by adding ++ two integers to the FLO_union_type. ++ NO_DENORMALS: Disable handling of denormals. ++ NO_NANS: Disable nan and infinity handling ++ SMALL_MACHINE: Useful when operations on QIs and HIs are faster ++ than on an SI */ ++ ++/* We don't currently support extended floats (long doubles) on machines ++ without hardware to deal with them. ++ ++ These stubs are just to keep the linker from complaining about unresolved ++ references which can be pulled in from libio & libstdc++, even if the ++ user isn't using long doubles. However, they may generate an unresolved ++ external to abort if abort is not used by the function, and the stubs ++ are referenced from within libc, since libgcc goes before and after the ++ system library. */ ++ ++#ifdef DECLARE_LIBRARY_RENAMES ++ DECLARE_LIBRARY_RENAMES ++#endif ++ ++#ifdef EXTENDED_FLOAT_STUBS ++extern void abort (void); ++void __extendsfxf2 (void) { abort(); } ++void __extenddfxf2 (void) { abort(); } ++void __truncxfdf2 (void) { abort(); } ++void __truncxfsf2 (void) { abort(); } ++void __fixxfsi (void) { abort(); } ++void __floatsixf (void) { abort(); } ++void __addxf3 (void) { abort(); } ++void __subxf3 (void) { abort(); } ++void __mulxf3 (void) { abort(); } ++void __divxf3 (void) { abort(); } ++void __negxf2 (void) { abort(); } ++void __eqxf2 (void) { abort(); } ++void __nexf2 (void) { abort(); } ++void __gtxf2 (void) { abort(); } ++void __gexf2 (void) { abort(); } ++void __lexf2 (void) { abort(); } ++void __ltxf2 (void) { abort(); } ++ ++void __extendsftf2 (void) { abort(); } ++void __extenddftf2 (void) { abort(); } ++void __trunctfdf2 (void) { abort(); } ++void __trunctfsf2 (void) { abort(); } ++void __fixtfsi (void) { abort(); } ++void __floatsitf (void) { abort(); } ++void __addtf3 (void) { abort(); } ++void __subtf3 (void) { abort(); } ++void __multf3 (void) { abort(); } ++void __divtf3 (void) { abort(); } ++void __negtf2 (void) { abort(); } ++void __eqtf2 (void) { abort(); } ++void __netf2 (void) { abort(); } ++void __gttf2 (void) { abort(); } ++void __getf2 (void) { abort(); } ++void __letf2 (void) { abort(); } ++void __lttf2 (void) { abort(); } ++#else /* !EXTENDED_FLOAT_STUBS, rest of file */ ++ ++/* IEEE "special" number predicates */ ++ ++#ifdef NO_NANS ++ ++#define nan() 0 ++#define isnan(x) 0 ++#define isinf(x) 0 ++#else ++ ++#if defined L_thenan_sf ++const fp_number_type __thenan_sf = { CLASS_SNAN, 0, 0, {(fractype) 0} }; ++#elif defined L_thenan_df ++const fp_number_type __thenan_df = { CLASS_SNAN, 0, 0, {(fractype) 0} }; ++#elif defined L_thenan_tf ++const fp_number_type __thenan_tf = { CLASS_SNAN, 0, 0, {(fractype) 0} }; ++#elif defined TFLOAT ++extern const fp_number_type __thenan_tf; ++#elif defined FLOAT ++extern const fp_number_type __thenan_sf; ++#else ++extern const fp_number_type __thenan_df; ++#endif ++ ++INLINE ++static fp_number_type * ++nan (void) ++{ ++ /* Discard the const qualifier... */ ++#ifdef TFLOAT ++ return (fp_number_type *) (& __thenan_tf); ++#elif defined FLOAT ++ return (fp_number_type *) (& __thenan_sf); ++#else ++ return (fp_number_type *) (& __thenan_df); ++#endif ++} ++ ++INLINE ++static int ++isnan ( fp_number_type * x) ++{ ++ return x->class == CLASS_SNAN || x->class == CLASS_QNAN; ++} ++ ++INLINE ++static int ++isinf ( fp_number_type * x) ++{ ++ return x->class == CLASS_INFINITY; ++} ++ ++#endif /* NO_NANS */ ++ ++INLINE ++static int ++iszero ( fp_number_type * x) ++{ ++ return x->class == CLASS_ZERO; ++} ++ ++INLINE ++static void ++flip_sign ( fp_number_type * x) ++{ ++ x->sign = !x->sign; ++} ++ ++extern FLO_type pack_d ( fp_number_type * ); ++ ++#if defined(L_pack_df) || defined(L_pack_sf) || defined(L_pack_tf) ++FLO_type ++pack_d ( fp_number_type * src) ++{ ++ FLO_union_type dst; ++ fractype fraction = src->fraction.ll; /* wasn't unsigned before? */ ++ int sign = src->sign; ++ int exp = 0; ++ ++ if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && (isnan (src) || isinf (src))) ++ { ++ /* We can't represent these values accurately. By using the ++ largest possible magnitude, we guarantee that the conversion ++ of infinity is at least as big as any finite number. */ ++ exp = EXPMAX; ++ fraction = ((fractype) 1 << FRACBITS) - 1; ++ } ++ else if (isnan (src)) ++ { ++ exp = EXPMAX; ++ if (src->class == CLASS_QNAN || 1) ++ { ++#ifdef QUIET_NAN_NEGATED ++ fraction |= QUIET_NAN - 1; ++#else ++ fraction |= QUIET_NAN; ++#endif ++ } ++ } ++ else if (isinf (src)) ++ { ++ exp = EXPMAX; ++ fraction = 0; ++ } ++ else if (iszero (src)) ++ { ++ exp = 0; ++ fraction = 0; ++ } ++ else if (fraction == 0) ++ { ++ exp = 0; ++ } ++ else ++ { ++ if (src->normal_exp < NORMAL_EXPMIN) ++ { ++#ifdef NO_DENORMALS ++ /* Go straight to a zero representation if denormals are not ++ supported. The denormal handling would be harmless but ++ isn't unnecessary. */ ++ exp = 0; ++ fraction = 0; ++#else /* NO_DENORMALS */ ++ /* This number's exponent is too low to fit into the bits ++ available in the number, so we'll store 0 in the exponent and ++ shift the fraction to the right to make up for it. */ ++ ++ int shift = NORMAL_EXPMIN - src->normal_exp; ++ ++ exp = 0; ++ ++ if (shift > FRAC_NBITS - NGARDS) ++ { ++ /* No point shifting, since it's more that 64 out. */ ++ fraction = 0; ++ } ++ else ++ { ++ int lowbit = (fraction & (((fractype)1 << shift) - 1)) ? 1 : 0; ++ fraction = (fraction >> shift) | lowbit; ++ } ++ if ((fraction & GARDMASK) == GARDMSB) ++ { ++ if ((fraction & (1 << NGARDS))) ++ fraction += GARDROUND + 1; ++ } ++ else ++ { ++ /* Add to the guards to round up. */ ++ fraction += GARDROUND; ++ } ++ /* Perhaps the rounding means we now need to change the ++ exponent, because the fraction is no longer denormal. */ ++ if (fraction >= IMPLICIT_1) ++ { ++ exp += 1; ++ } ++ fraction >>= NGARDS; ++#endif /* NO_DENORMALS */ ++ } ++ else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) ++ && src->normal_exp > EXPBIAS) ++ { ++ exp = EXPMAX; ++ fraction = 0; ++ } ++ else ++ { ++ exp = src->normal_exp + EXPBIAS; ++ if (!ROUND_TOWARDS_ZERO) ++ { ++ /* IF the gard bits are the all zero, but the first, then we're ++ half way between two numbers, choose the one which makes the ++ lsb of the answer 0. */ ++ if ((fraction & GARDMASK) == GARDMSB) ++ { ++ if (fraction & (1 << NGARDS)) ++ fraction += GARDROUND + 1; ++ } ++ else ++ { ++ /* Add a one to the guards to round up */ ++ fraction += GARDROUND; ++ } ++ if (fraction >= IMPLICIT_2) ++ { ++ fraction >>= 1; ++ exp += 1; ++ } ++ } ++ fraction >>= NGARDS; ++ ++ if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && exp > EXPMAX) ++ { ++ /* Saturate on overflow. */ ++ exp = EXPMAX; ++ fraction = ((fractype) 1 << FRACBITS) - 1; ++ } ++ } ++ } ++ ++ /* We previously used bitfields to store the number, but this doesn't ++ handle little/big endian systems conveniently, so use shifts and ++ masks */ ++#ifdef FLOAT_BIT_ORDER_MISMATCH ++ dst.bits.fraction = fraction; ++ dst.bits.exp = exp; ++ dst.bits.sign = sign; ++#else ++# if defined TFLOAT && defined HALFFRACBITS ++ { ++ halffractype high, low, unity; ++ int lowsign, lowexp; ++ ++ unity = (halffractype) 1 << HALFFRACBITS; ++ ++ /* Set HIGH to the high double's significand, masking out the implicit 1. ++ Set LOW to the low double's full significand. */ ++ high = (fraction >> (FRACBITS - HALFFRACBITS)) & (unity - 1); ++ low = fraction & (unity * 2 - 1); ++ ++ /* Get the initial sign and exponent of the low double. */ ++ lowexp = exp - HALFFRACBITS - 1; ++ lowsign = sign; ++ ++ /* HIGH should be rounded like a normal double, making |LOW| <= ++ 0.5 ULP of HIGH. Assume round-to-nearest. */ ++ if (exp < EXPMAX) ++ if (low > unity || (low == unity && (high & 1) == 1)) ++ { ++ /* Round HIGH up and adjust LOW to match. */ ++ high++; ++ if (high == unity) ++ { ++ /* May make it infinite, but that's OK. */ ++ high = 0; ++ exp++; ++ } ++ low = unity * 2 - low; ++ lowsign ^= 1; ++ } ++ ++ high |= (halffractype) exp << HALFFRACBITS; ++ high |= (halffractype) sign << (HALFFRACBITS + EXPBITS); ++ ++ if (exp == EXPMAX || exp == 0 || low == 0) ++ low = 0; ++ else ++ { ++ while (lowexp > 0 && low < unity) ++ { ++ low <<= 1; ++ lowexp--; ++ } ++ ++ if (lowexp <= 0) ++ { ++ halffractype roundmsb, round; ++ int shift; ++ ++ shift = 1 - lowexp; ++ roundmsb = (1 << (shift - 1)); ++ round = low & ((roundmsb << 1) - 1); ++ ++ low >>= shift; ++ lowexp = 0; ++ ++ if (round > roundmsb || (round == roundmsb && (low & 1) == 1)) ++ { ++ low++; ++ if (low == unity) ++ /* LOW rounds up to the smallest normal number. */ ++ lowexp++; ++ } ++ } ++ ++ low &= unity - 1; ++ low |= (halffractype) lowexp << HALFFRACBITS; ++ low |= (halffractype) lowsign << (HALFFRACBITS + EXPBITS); ++ } ++ dst.value_raw = ((fractype) high << HALFSHIFT) | low; ++ } ++# else ++ dst.value_raw = fraction & ((((fractype)1) << FRACBITS) - (fractype)1); ++ dst.value_raw |= ((fractype) (exp & ((1 << EXPBITS) - 1))) << FRACBITS; ++ dst.value_raw |= ((fractype) (sign & 1)) << (FRACBITS | EXPBITS); ++# endif ++#endif ++ ++#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT) ++#ifdef TFLOAT ++ { ++ qrtrfractype tmp1 = dst.words[0]; ++ qrtrfractype tmp2 = dst.words[1]; ++ dst.words[0] = dst.words[3]; ++ dst.words[1] = dst.words[2]; ++ dst.words[2] = tmp2; ++ dst.words[3] = tmp1; ++ } ++#else ++ { ++ halffractype tmp = dst.words[0]; ++ dst.words[0] = dst.words[1]; ++ dst.words[1] = tmp; ++ } ++#endif ++#endif ++ ++ return dst.value; ++} ++#endif ++ ++#if defined(L_unpack_df) || defined(L_unpack_sf) || defined(L_unpack_tf) ++void ++unpack_d (FLO_union_type * src, fp_number_type * dst) ++{ ++ /* We previously used bitfields to store the number, but this doesn't ++ handle little/big endian systems conveniently, so use shifts and ++ masks */ ++ fractype fraction; ++ int exp; ++ int sign; ++ ++#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT) ++ FLO_union_type swapped; ++ ++#ifdef TFLOAT ++ swapped.words[0] = src->words[3]; ++ swapped.words[1] = src->words[2]; ++ swapped.words[2] = src->words[1]; ++ swapped.words[3] = src->words[0]; ++#else ++ swapped.words[0] = src->words[1]; ++ swapped.words[1] = src->words[0]; ++#endif ++ src = &swapped; ++#endif ++ ++#ifdef FLOAT_BIT_ORDER_MISMATCH ++ fraction = src->bits.fraction; ++ exp = src->bits.exp; ++ sign = src->bits.sign; ++#else ++# if defined TFLOAT && defined HALFFRACBITS ++ { ++ halffractype high, low; ++ ++ high = src->value_raw >> HALFSHIFT; ++ low = src->value_raw & (((fractype)1 << HALFSHIFT) - 1); ++ ++ fraction = high & ((((fractype)1) << HALFFRACBITS) - 1); ++ fraction <<= FRACBITS - HALFFRACBITS; ++ exp = ((int)(high >> HALFFRACBITS)) & ((1 << EXPBITS) - 1); ++ sign = ((int)(high >> (((HALFFRACBITS + EXPBITS))))) & 1; ++ ++ if (exp != EXPMAX && exp != 0 && low != 0) ++ { ++ int lowexp = ((int)(low >> HALFFRACBITS)) & ((1 << EXPBITS) - 1); ++ int lowsign = ((int)(low >> (((HALFFRACBITS + EXPBITS))))) & 1; ++ int shift; ++ fractype xlow; ++ ++ xlow = low & ((((fractype)1) << HALFFRACBITS) - 1); ++ if (lowexp) ++ xlow |= (((halffractype)1) << HALFFRACBITS); ++ else ++ lowexp = 1; ++ shift = (FRACBITS - HALFFRACBITS) - (exp - lowexp); ++ if (shift > 0) ++ xlow <<= shift; ++ else if (shift < 0) ++ xlow >>= -shift; ++ if (sign == lowsign) ++ fraction += xlow; ++ else if (fraction >= xlow) ++ fraction -= xlow; ++ else ++ { ++ /* The high part is a power of two but the full number is lower. ++ This code will leave the implicit 1 in FRACTION, but we'd ++ have added that below anyway. */ ++ fraction = (((fractype) 1 << FRACBITS) - xlow) << 1; ++ exp--; ++ } ++ } ++ } ++# else ++ fraction = src->value_raw & ((((fractype)1) << FRACBITS) - 1); ++ exp = ((int)(src->value_raw >> FRACBITS)) & ((1 << EXPBITS) - 1); ++ sign = ((int)(src->value_raw >> (FRACBITS + EXPBITS))) & 1; ++# endif ++#endif ++ ++ dst->sign = sign; ++ if (exp == 0) ++ { ++ /* Hmm. Looks like 0 */ ++ if (fraction == 0 ++#ifdef NO_DENORMALS ++ || 1 ++#endif ++ ) ++ { ++ /* tastes like zero */ ++ dst->class = CLASS_ZERO; ++ } ++ else ++ { ++ /* Zero exponent with nonzero fraction - it's denormalized, ++ so there isn't a leading implicit one - we'll shift it so ++ it gets one. */ ++ dst->normal_exp = exp - EXPBIAS + 1; ++ fraction <<= NGARDS; ++ ++ dst->class = CLASS_NUMBER; ++#if 1 ++ while (fraction < IMPLICIT_1) ++ { ++ fraction <<= 1; ++ dst->normal_exp--; ++ } ++#endif ++ dst->fraction.ll = fraction; ++ } ++ } ++ else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && exp == EXPMAX) ++ { ++ /* Huge exponent*/ ++ if (fraction == 0) ++ { ++ /* Attached to a zero fraction - means infinity */ ++ dst->class = CLASS_INFINITY; ++ } ++ else ++ { ++ /* Nonzero fraction, means nan */ ++#ifdef QUIET_NAN_NEGATED ++ if ((fraction & QUIET_NAN) == 0) ++#else ++ if (fraction & QUIET_NAN) ++#endif ++ { ++ dst->class = CLASS_QNAN; ++ } ++ else ++ { ++ dst->class = CLASS_SNAN; ++ } ++ /* Keep the fraction part as the nan number */ ++ dst->fraction.ll = fraction; ++ } ++ } ++ else ++ { ++ /* Nothing strange about this number */ ++ dst->normal_exp = exp - EXPBIAS; ++ dst->class = CLASS_NUMBER; ++ dst->fraction.ll = (fraction << NGARDS) | IMPLICIT_1; ++ } ++} ++#endif /* L_unpack_df || L_unpack_sf */ ++ ++#if defined(L_addsub_sf) || defined(L_addsub_df) || defined(L_addsub_tf) ++static fp_number_type * ++_fpadd_parts (fp_number_type * a, ++ fp_number_type * b, ++ fp_number_type * tmp) ++{ ++ intfrac tfraction; ++ ++ /* Put commonly used fields in local variables. */ ++ int a_normal_exp; ++ int b_normal_exp; ++ fractype a_fraction; ++ fractype b_fraction; ++ ++ if (isnan (a)) ++ { ++ return a; ++ } ++ if (isnan (b)) ++ { ++ return b; ++ } ++ if (isinf (a)) ++ { ++ /* Adding infinities with opposite signs yields a NaN. */ ++ if (isinf (b) && a->sign != b->sign) ++ return nan (); ++ return a; ++ } ++ if (isinf (b)) ++ { ++ return b; ++ } ++ if (iszero (b)) ++ { ++ if (iszero (a)) ++ { ++ *tmp = *a; ++ tmp->sign = a->sign & b->sign; ++ return tmp; ++ } ++ return a; ++ } ++ if (iszero (a)) ++ { ++ return b; ++ } ++ ++ /* Got two numbers. shift the smaller and increment the exponent till ++ they're the same */ ++ { ++ int diff; ++ ++ a_normal_exp = a->normal_exp; ++ b_normal_exp = b->normal_exp; ++ a_fraction = a->fraction.ll; ++ b_fraction = b->fraction.ll; ++ ++ diff = a_normal_exp - b_normal_exp; ++ ++ if (diff < 0) ++ diff = -diff; ++ if (diff < FRAC_NBITS) ++ { ++ /* ??? This does shifts one bit at a time. Optimize. */ ++ while (a_normal_exp > b_normal_exp) ++ { ++ b_normal_exp++; ++ LSHIFT (b_fraction); ++ } ++ while (b_normal_exp > a_normal_exp) ++ { ++ a_normal_exp++; ++ LSHIFT (a_fraction); ++ } ++ } ++ else ++ { ++ /* Somethings's up.. choose the biggest */ ++ if (a_normal_exp > b_normal_exp) ++ { ++ b_normal_exp = a_normal_exp; ++ b_fraction = 0; ++ } ++ else ++ { ++ a_normal_exp = b_normal_exp; ++ a_fraction = 0; ++ } ++ } ++ } ++ ++ if (a->sign != b->sign) ++ { ++ if (a->sign) ++ { ++ tfraction = -a_fraction + b_fraction; ++ } ++ else ++ { ++ tfraction = a_fraction - b_fraction; ++ } ++ if (tfraction >= 0) ++ { ++ tmp->sign = 0; ++ tmp->normal_exp = a_normal_exp; ++ tmp->fraction.ll = tfraction; ++ } ++ else ++ { ++ tmp->sign = 1; ++ tmp->normal_exp = a_normal_exp; ++ tmp->fraction.ll = -tfraction; ++ } ++ /* and renormalize it */ ++ ++ while (tmp->fraction.ll < IMPLICIT_1 && tmp->fraction.ll) ++ { ++ tmp->fraction.ll <<= 1; ++ tmp->normal_exp--; ++ } ++ } ++ else ++ { ++ tmp->sign = a->sign; ++ tmp->normal_exp = a_normal_exp; ++ tmp->fraction.ll = a_fraction + b_fraction; ++ } ++ tmp->class = CLASS_NUMBER; ++ /* Now the fraction is added, we have to shift down to renormalize the ++ number */ ++ ++ if (tmp->fraction.ll >= IMPLICIT_2) ++ { ++ LSHIFT (tmp->fraction.ll); ++ tmp->normal_exp++; ++ } ++ return tmp; ++ ++} ++ ++FLO_type ++add (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ fp_number_type tmp; ++ fp_number_type *res; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ res = _fpadd_parts (&a, &b, &tmp); ++ ++ return pack_d (res); ++} ++ ++FLO_type ++sub (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ fp_number_type tmp; ++ fp_number_type *res; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ b.sign ^= 1; ++ ++ res = _fpadd_parts (&a, &b, &tmp); ++ ++ return pack_d (res); ++} ++#endif /* L_addsub_sf || L_addsub_df */ ++ ++#if defined(L_mul_sf) || defined(L_mul_df) || defined(L_mul_tf) ++static inline __attribute__ ((__always_inline__)) fp_number_type * ++_fpmul_parts ( fp_number_type * a, ++ fp_number_type * b, ++ fp_number_type * tmp) ++{ ++ fractype low = 0; ++ fractype high = 0; ++ ++ if (isnan (a)) ++ { ++ a->sign = a->sign != b->sign; ++ return a; ++ } ++ if (isnan (b)) ++ { ++ b->sign = a->sign != b->sign; ++ return b; ++ } ++ if (isinf (a)) ++ { ++ if (iszero (b)) ++ return nan (); ++ a->sign = a->sign != b->sign; ++ return a; ++ } ++ if (isinf (b)) ++ { ++ if (iszero (a)) ++ { ++ return nan (); ++ } ++ b->sign = a->sign != b->sign; ++ return b; ++ } ++ if (iszero (a)) ++ { ++ a->sign = a->sign != b->sign; ++ return a; ++ } ++ if (iszero (b)) ++ { ++ b->sign = a->sign != b->sign; ++ return b; ++ } ++ ++ /* Calculate the mantissa by multiplying both numbers to get a ++ twice-as-wide number. */ ++ { ++#if defined(NO_DI_MODE) || defined(TFLOAT) ++ { ++ fractype x = a->fraction.ll; ++ fractype ylow = b->fraction.ll; ++ fractype yhigh = 0; ++ int bit; ++ ++ /* ??? This does multiplies one bit at a time. Optimize. */ ++ for (bit = 0; bit < FRAC_NBITS; bit++) ++ { ++ int carry; ++ ++ if (x & 1) ++ { ++ carry = (low += ylow) < ylow; ++ high += yhigh + carry; ++ } ++ yhigh <<= 1; ++ if (ylow & FRACHIGH) ++ { ++ yhigh |= 1; ++ } ++ ylow <<= 1; ++ x >>= 1; ++ } ++ } ++#elif defined(FLOAT) ++ /* Multiplying two USIs to get a UDI, we're safe. */ ++ { ++ UDItype answer = (UDItype)a->fraction.ll * (UDItype)b->fraction.ll; ++ ++ high = answer >> BITS_PER_SI; ++ low = answer; ++ } ++#else ++ /* fractype is DImode, but we need the result to be twice as wide. ++ Assuming a widening multiply from DImode to TImode is not ++ available, build one by hand. */ ++ { ++ USItype nl = a->fraction.ll; ++ USItype nh = a->fraction.ll >> BITS_PER_SI; ++ USItype ml = b->fraction.ll; ++ USItype mh = b->fraction.ll >> BITS_PER_SI; ++ UDItype pp_ll = (UDItype) ml * nl; ++ UDItype pp_hl = (UDItype) mh * nl; ++ UDItype pp_lh = (UDItype) ml * nh; ++ UDItype pp_hh = (UDItype) mh * nh; ++ UDItype res2 = 0; ++ UDItype res0 = 0; ++ UDItype ps_hh__ = pp_hl + pp_lh; ++ if (ps_hh__ < pp_hl) ++ res2 += (UDItype)1 << BITS_PER_SI; ++ pp_hl = (UDItype)(USItype)ps_hh__ << BITS_PER_SI; ++ res0 = pp_ll + pp_hl; ++ if (res0 < pp_ll) ++ res2++; ++ res2 += (ps_hh__ >> BITS_PER_SI) + pp_hh; ++ high = res2; ++ low = res0; ++ } ++#endif ++ } ++ ++ tmp->normal_exp = a->normal_exp + b->normal_exp ++ + FRAC_NBITS - (FRACBITS + NGARDS); ++ tmp->sign = a->sign != b->sign; ++ while (high >= IMPLICIT_2) ++ { ++ tmp->normal_exp++; ++ if (high & 1) ++ { ++ low >>= 1; ++ low |= FRACHIGH; ++ } ++ high >>= 1; ++ } ++ while (high < IMPLICIT_1) ++ { ++ tmp->normal_exp--; ++ ++ high <<= 1; ++ if (low & FRACHIGH) ++ high |= 1; ++ low <<= 1; ++ } ++ /* rounding is tricky. if we only round if it won't make us round later. */ ++#if 0 ++ if (low & FRACHIGH2) ++ { ++ if (((high & GARDMASK) != GARDMSB) ++ && (((high + 1) & GARDMASK) == GARDMSB)) ++ { ++ /* don't round, it gets done again later. */ ++ } ++ else ++ { ++ high++; ++ } ++ } ++#endif ++ if (!ROUND_TOWARDS_ZERO && (high & GARDMASK) == GARDMSB) ++ { ++ if (high & (1 << NGARDS)) ++ { ++ /* half way, so round to even */ ++ high += GARDROUND + 1; ++ } ++ else if (low) ++ { ++ /* but we really weren't half way */ ++ high += GARDROUND + 1; ++ } ++ } ++ tmp->fraction.ll = high; ++ tmp->class = CLASS_NUMBER; ++ return tmp; ++} ++ ++FLO_type ++multiply (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ fp_number_type tmp; ++ fp_number_type *res; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ res = _fpmul_parts (&a, &b, &tmp); ++ ++ return pack_d (res); ++} ++#endif /* L_mul_sf || L_mul_df */ ++ ++#if defined(L_div_sf) || defined(L_div_df) || defined(L_div_tf) ++static inline __attribute__ ((__always_inline__)) fp_number_type * ++_fpdiv_parts (fp_number_type * a, ++ fp_number_type * b) ++{ ++ fractype bit; ++ fractype numerator; ++ fractype denominator; ++ fractype quotient; ++ ++ if (isnan (a)) ++ { ++ return a; ++ } ++ if (isnan (b)) ++ { ++ return b; ++ } ++ ++ a->sign = a->sign ^ b->sign; ++ ++ if (isinf (a) || iszero (a)) ++ { ++ if (a->class == b->class) ++ return nan (); ++ return a; ++ } ++ ++ if (isinf (b)) ++ { ++ a->fraction.ll = 0; ++ a->normal_exp = 0; ++ return a; ++ } ++ if (iszero (b)) ++ { ++ a->class = CLASS_INFINITY; ++ return a; ++ } ++ ++ /* Calculate the mantissa by multiplying both 64bit numbers to get a ++ 128 bit number */ ++ { ++ /* quotient = ++ ( numerator / denominator) * 2^(numerator exponent - denominator exponent) ++ */ ++ ++ a->normal_exp = a->normal_exp - b->normal_exp; ++ numerator = a->fraction.ll; ++ denominator = b->fraction.ll; ++ ++ if (numerator < denominator) ++ { ++ /* Fraction will be less than 1.0 */ ++ numerator *= 2; ++ a->normal_exp--; ++ } ++ bit = IMPLICIT_1; ++ quotient = 0; ++ /* ??? Does divide one bit at a time. Optimize. */ ++ while (bit) ++ { ++ if (numerator >= denominator) ++ { ++ quotient |= bit; ++ numerator -= denominator; ++ } ++ bit >>= 1; ++ numerator *= 2; ++ } ++ ++ if (!ROUND_TOWARDS_ZERO && (quotient & GARDMASK) == GARDMSB) ++ { ++ if (quotient & (1 << NGARDS)) ++ { ++ /* half way, so round to even */ ++ quotient += GARDROUND + 1; ++ } ++ else if (numerator) ++ { ++ /* but we really weren't half way, more bits exist */ ++ quotient += GARDROUND + 1; ++ } ++ } ++ ++ a->fraction.ll = quotient; ++ return (a); ++ } ++} ++ ++FLO_type ++divide (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ fp_number_type *res; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ res = _fpdiv_parts (&a, &b); ++ ++ return pack_d (res); ++} ++#endif /* L_div_sf || L_div_df */ ++ ++#if defined(L_fpcmp_parts_sf) || defined(L_fpcmp_parts_df) \ ++ || defined(L_fpcmp_parts_tf) ++/* according to the demo, fpcmp returns a comparison with 0... thus ++ a -1 ++ a==b -> 0 ++ a>b -> +1 ++ */ ++ ++int ++__fpcmp_parts (fp_number_type * a, fp_number_type * b) ++{ ++#if 0 ++ /* either nan -> unordered. Must be checked outside of this routine. */ ++ if (isnan (a) && isnan (b)) ++ { ++ return 1; /* still unordered! */ ++ } ++#endif ++ ++ if (isnan (a) || isnan (b)) ++ { ++ return 1; /* how to indicate unordered compare? */ ++ } ++ if (isinf (a) && isinf (b)) ++ { ++ /* +inf > -inf, but +inf != +inf */ ++ /* b \a| +inf(0)| -inf(1) ++ ______\+--------+-------- ++ +inf(0)| a==b(0)| ab(1) | a==b(0) ++ -------+--------+-------- ++ So since unordered must be nonzero, just line up the columns... ++ */ ++ return b->sign - a->sign; ++ } ++ /* but not both... */ ++ if (isinf (a)) ++ { ++ return a->sign ? -1 : 1; ++ } ++ if (isinf (b)) ++ { ++ return b->sign ? 1 : -1; ++ } ++ if (iszero (a) && iszero (b)) ++ { ++ return 0; ++ } ++ if (iszero (a)) ++ { ++ return b->sign ? 1 : -1; ++ } ++ if (iszero (b)) ++ { ++ return a->sign ? -1 : 1; ++ } ++ /* now both are "normal". */ ++ if (a->sign != b->sign) ++ { ++ /* opposite signs */ ++ return a->sign ? -1 : 1; ++ } ++ /* same sign; exponents? */ ++ if (a->normal_exp > b->normal_exp) ++ { ++ return a->sign ? -1 : 1; ++ } ++ if (a->normal_exp < b->normal_exp) ++ { ++ return a->sign ? 1 : -1; ++ } ++ /* same exponents; check size. */ ++ if (a->fraction.ll > b->fraction.ll) ++ { ++ return a->sign ? -1 : 1; ++ } ++ if (a->fraction.ll < b->fraction.ll) ++ { ++ return a->sign ? 1 : -1; ++ } ++ /* after all that, they're equal. */ ++ return 0; ++} ++#endif ++ ++#if defined(L_compare_sf) || defined(L_compare_df) || defined(L_compoare_tf) ++CMPtype ++compare (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ return __fpcmp_parts (&a, &b); ++} ++#endif /* L_compare_sf || L_compare_df */ ++ ++#ifndef US_SOFTWARE_GOFAST ++ ++/* These should be optimized for their specific tasks someday. */ ++ ++#if defined(L_eq_sf) || defined(L_eq_df) || defined(L_eq_tf) ++CMPtype ++_eq_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return 1; /* false, truth == 0 */ ++ ++ return __fpcmp_parts (&a, &b) ; ++} ++#endif /* L_eq_sf || L_eq_df */ ++ ++#if defined(L_ne_sf) || defined(L_ne_df) || defined(L_ne_tf) ++CMPtype ++_ne_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return 1; /* true, truth != 0 */ ++ ++ return __fpcmp_parts (&a, &b) ; ++} ++#endif /* L_ne_sf || L_ne_df */ ++ ++#if defined(L_gt_sf) || defined(L_gt_df) || defined(L_gt_tf) ++CMPtype ++_gt_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return -1; /* false, truth > 0 */ ++ ++ return __fpcmp_parts (&a, &b); ++} ++#endif /* L_gt_sf || L_gt_df */ ++ ++#if defined(L_ge_sf) || defined(L_ge_df) || defined(L_ge_tf) ++CMPtype ++_ge_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return -1; /* false, truth >= 0 */ ++ return __fpcmp_parts (&a, &b) ; ++} ++#endif /* L_ge_sf || L_ge_df */ ++ ++#if defined(L_lt_sf) || defined(L_lt_df) || defined(L_lt_tf) ++CMPtype ++_lt_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return 1; /* false, truth < 0 */ ++ ++ return __fpcmp_parts (&a, &b); ++} ++#endif /* L_lt_sf || L_lt_df */ ++ ++#if defined(L_le_sf) || defined(L_le_df) || defined(L_le_tf) ++CMPtype ++_le_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ if (isnan (&a) || isnan (&b)) ++ return 1; /* false, truth <= 0 */ ++ ++ return __fpcmp_parts (&a, &b) ; ++} ++#endif /* L_le_sf || L_le_df */ ++ ++#endif /* ! US_SOFTWARE_GOFAST */ ++ ++#if defined(L_unord_sf) || defined(L_unord_df) || defined(L_unord_tf) ++CMPtype ++_unord_f2 (FLO_type arg_a, FLO_type arg_b) ++{ ++ fp_number_type a; ++ fp_number_type b; ++ FLO_union_type au, bu; ++ ++ au.value = arg_a; ++ bu.value = arg_b; ++ ++ unpack_d (&au, &a); ++ unpack_d (&bu, &b); ++ ++ return (isnan (&a) || isnan (&b)); ++} ++#endif /* L_unord_sf || L_unord_df */ ++ ++#if defined(L_si_to_sf) || defined(L_si_to_df) || defined(L_si_to_tf) ++FLO_type ++si_to_float (SItype arg_a) ++{ ++ fp_number_type in; ++ ++ in.class = CLASS_NUMBER; ++ in.sign = arg_a < 0; ++ if (!arg_a) ++ { ++ in.class = CLASS_ZERO; ++ } ++ else ++ { ++ in.normal_exp = FRACBITS + NGARDS; ++ if (in.sign) ++ { ++ /* Special case for minint, since there is no +ve integer ++ representation for it */ ++ if (arg_a == (- MAX_SI_INT - 1)) ++ { ++ return (FLO_type)(- MAX_SI_INT - 1); ++ } ++ in.fraction.ll = (-arg_a); ++ } ++ else ++ in.fraction.ll = arg_a; ++ ++ while (in.fraction.ll < ((fractype)1 << (FRACBITS + NGARDS))) ++ { ++ in.fraction.ll <<= 1; ++ in.normal_exp -= 1; ++ } ++ } ++ return pack_d (&in); ++} ++#endif /* L_si_to_sf || L_si_to_df */ ++ ++#if defined(L_usi_to_sf) || defined(L_usi_to_df) || defined(L_usi_to_tf) ++FLO_type ++usi_to_float (USItype arg_a) ++{ ++ fp_number_type in; ++ ++ in.sign = 0; ++ if (!arg_a) ++ { ++ in.class = CLASS_ZERO; ++ } ++ else ++ { ++ in.class = CLASS_NUMBER; ++ in.normal_exp = FRACBITS + NGARDS; ++ in.fraction.ll = arg_a; ++ ++ while (in.fraction.ll > ((fractype)1 << (FRACBITS + NGARDS))) ++ { ++ in.fraction.ll >>= 1; ++ in.normal_exp += 1; ++ } ++ while (in.fraction.ll < ((fractype)1 << (FRACBITS + NGARDS))) ++ { ++ in.fraction.ll <<= 1; ++ in.normal_exp -= 1; ++ } ++ } ++ return pack_d (&in); ++} ++#endif ++ ++#if defined(L_sf_to_si) || defined(L_df_to_si) || defined(L_tf_to_si) ++SItype ++float_to_si (FLO_type arg_a) ++{ ++ fp_number_type a; ++ SItype tmp; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &a); ++ ++ if (iszero (&a)) ++ return 0; ++ if (isnan (&a)) ++ return 0; ++ /* get reasonable MAX_SI_INT... */ ++ if (isinf (&a)) ++ return a.sign ? (-MAX_SI_INT)-1 : MAX_SI_INT; ++ /* it is a number, but a small one */ ++ if (a.normal_exp < 0) ++ return 0; ++ if (a.normal_exp > BITS_PER_SI - 2) ++ return a.sign ? (-MAX_SI_INT)-1 : MAX_SI_INT; ++ tmp = a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp); ++ return a.sign ? (-tmp) : (tmp); ++} ++#endif /* L_sf_to_si || L_df_to_si */ ++ ++#if defined(L_sf_to_usi) || defined(L_df_to_usi) || defined(L_tf_to_usi) ++#if defined US_SOFTWARE_GOFAST || defined(L_tf_to_usi) ++/* While libgcc2.c defines its own __fixunssfsi and __fixunsdfsi routines, ++ we also define them for GOFAST because the ones in libgcc2.c have the ++ wrong names and I'd rather define these here and keep GOFAST CYG-LOC's ++ out of libgcc2.c. We can't define these here if not GOFAST because then ++ there'd be duplicate copies. */ ++ ++USItype ++float_to_usi (FLO_type arg_a) ++{ ++ fp_number_type a; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &a); ++ ++ if (iszero (&a)) ++ return 0; ++ if (isnan (&a)) ++ return 0; ++ /* it is a negative number */ ++ if (a.sign) ++ return 0; ++ /* get reasonable MAX_USI_INT... */ ++ if (isinf (&a)) ++ return MAX_USI_INT; ++ /* it is a number, but a small one */ ++ if (a.normal_exp < 0) ++ return 0; ++ if (a.normal_exp > BITS_PER_SI - 1) ++ return MAX_USI_INT; ++ else if (a.normal_exp > (FRACBITS + NGARDS)) ++ return a.fraction.ll << (a.normal_exp - (FRACBITS + NGARDS)); ++ else ++ return a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp); ++} ++#endif /* US_SOFTWARE_GOFAST */ ++#endif /* L_sf_to_usi || L_df_to_usi */ ++ ++#if defined(L_negate_sf) || defined(L_negate_df) || defined(L_negate_tf) ++FLO_type ++negate (FLO_type arg_a) ++{ ++ fp_number_type a; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &a); ++ ++ flip_sign (&a); ++ return pack_d (&a); ++} ++#endif /* L_negate_sf || L_negate_df */ ++ ++#ifdef FLOAT ++ ++#if defined(L_make_sf) ++SFtype ++__make_fp(fp_class_type class, ++ unsigned int sign, ++ int exp, ++ USItype frac) ++{ ++ fp_number_type in; ++ ++ in.class = class; ++ in.sign = sign; ++ in.normal_exp = exp; ++ in.fraction.ll = frac; ++ return pack_d (&in); ++} ++#endif /* L_make_sf */ ++ ++#ifndef FLOAT_ONLY ++ ++/* This enables one to build an fp library that supports float but not double. ++ Otherwise, we would get an undefined reference to __make_dp. ++ This is needed for some 8-bit ports that can't handle well values that ++ are 8-bytes in size, so we just don't support double for them at all. */ ++ ++#if defined(L_sf_to_df) ++DFtype ++sf_to_df (SFtype arg_a) ++{ ++ fp_number_type in; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ return __make_dp (in.class, in.sign, in.normal_exp, ++ ((UDItype) in.fraction.ll) << F_D_BITOFF); ++} ++#endif /* L_sf_to_df */ ++ ++#if defined(L_sf_to_tf) && defined(TMODES) ++TFtype ++sf_to_tf (SFtype arg_a) ++{ ++ fp_number_type in; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ return __make_tp (in.class, in.sign, in.normal_exp, ++ ((UTItype) in.fraction.ll) << F_T_BITOFF); ++} ++#endif /* L_sf_to_df */ ++ ++#endif /* ! FLOAT_ONLY */ ++#endif /* FLOAT */ ++ ++#ifndef FLOAT ++ ++extern SFtype __make_fp (fp_class_type, unsigned int, int, USItype); ++ ++#if defined(L_make_df) ++DFtype ++__make_dp (fp_class_type class, unsigned int sign, int exp, UDItype frac) ++{ ++ fp_number_type in; ++ ++ in.class = class; ++ in.sign = sign; ++ in.normal_exp = exp; ++ in.fraction.ll = frac; ++ return pack_d (&in); ++} ++#endif /* L_make_df */ ++ ++#if defined(L_df_to_sf) ++SFtype ++df_to_sf (DFtype arg_a) ++{ ++ fp_number_type in; ++ USItype sffrac; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ sffrac = in.fraction.ll >> F_D_BITOFF; ++ ++ /* We set the lowest guard bit in SFFRAC if we discarded any non ++ zero bits. */ ++ if ((in.fraction.ll & (((USItype) 1 << F_D_BITOFF) - 1)) != 0) ++ sffrac |= 1; ++ ++ return __make_fp (in.class, in.sign, in.normal_exp, sffrac); ++} ++#endif /* L_df_to_sf */ ++ ++#if defined(L_df_to_tf) && defined(TMODES) \ ++ && !defined(FLOAT) && !defined(TFLOAT) ++TFtype ++df_to_tf (DFtype arg_a) ++{ ++ fp_number_type in; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ return __make_tp (in.class, in.sign, in.normal_exp, ++ ((UTItype) in.fraction.ll) << D_T_BITOFF); ++} ++#endif /* L_sf_to_df */ ++ ++#ifdef TFLOAT ++#if defined(L_make_tf) ++TFtype ++__make_tp(fp_class_type class, ++ unsigned int sign, ++ int exp, ++ UTItype frac) ++{ ++ fp_number_type in; ++ ++ in.class = class; ++ in.sign = sign; ++ in.normal_exp = exp; ++ in.fraction.ll = frac; ++ return pack_d (&in); ++} ++#endif /* L_make_tf */ ++ ++#if defined(L_tf_to_df) ++DFtype ++tf_to_df (TFtype arg_a) ++{ ++ fp_number_type in; ++ UDItype sffrac; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ sffrac = in.fraction.ll >> D_T_BITOFF; ++ ++ /* We set the lowest guard bit in SFFRAC if we discarded any non ++ zero bits. */ ++ if ((in.fraction.ll & (((UTItype) 1 << D_T_BITOFF) - 1)) != 0) ++ sffrac |= 1; ++ ++ return __make_dp (in.class, in.sign, in.normal_exp, sffrac); ++} ++#endif /* L_tf_to_df */ ++ ++#if defined(L_tf_to_sf) ++SFtype ++tf_to_sf (TFtype arg_a) ++{ ++ fp_number_type in; ++ USItype sffrac; ++ FLO_union_type au; ++ ++ au.value = arg_a; ++ unpack_d (&au, &in); ++ ++ sffrac = in.fraction.ll >> F_T_BITOFF; ++ ++ /* We set the lowest guard bit in SFFRAC if we discarded any non ++ zero bits. */ ++ if ((in.fraction.ll & (((UTItype) 1 << F_T_BITOFF) - 1)) != 0) ++ sffrac |= 1; ++ ++ return __make_fp (in.class, in.sign, in.normal_exp, sffrac); ++} ++#endif /* L_tf_to_sf */ ++#endif /* TFLOAT */ ++ ++#endif /* ! FLOAT */ ++#endif /* !EXTENDED_FLOAT_STUBS */ +diff -durN gcc-3.4.6.orig/gcc/config/nios2/nios2.h gcc-3.4.6/gcc/config/nios2/nios2.h +--- gcc-3.4.6.orig/gcc/config/nios2/nios2.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/gcc/config/nios2/nios2.h 2007-08-15 23:09:36.000000000 +0200 +@@ -0,0 +1,824 @@ ++/* Definitions of target machine for Altera NIOS 2G NIOS2 version. ++ Copyright (C) 2003 Altera ++ Contributed by Jonah Graham (jgraham@altera.com). ++ ++This file is part of GNU CC. ++ ++GNU CC is free software; you can redistribute it and/or modify ++it under the terms of the GNU General Public License as published by ++the Free Software Foundation; either version 2, or (at your option) ++any later version. ++ ++GNU CC is distributed in the hope that it will be useful, ++but WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++GNU General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GNU CC; see the file COPYING. If not, write to ++the Free Software Foundation, 59 Temple Place - Suite 330, ++Boston, MA 02111-1307, USA. */ ++ ++ ++ ++#define TARGET_CPU_CPP_BUILTINS() \ ++ do \ ++ { \ ++ builtin_define_std ("NIOS2"); \ ++ builtin_define_std ("nios2"); \ ++ builtin_define ("_GNU_SOURCE"); \ ++ } \ ++ while (0) ++#define TARGET_VERSION fprintf (stderr, " (Altera Nios II)") ++ ++ ++ ++ ++ ++/********************************* ++ * Run-time Target Specification ++ *********************************/ ++ ++#define HAS_DIV_FLAG 0x0001 ++#define HAS_MUL_FLAG 0x0002 ++#define HAS_MULX_FLAG 0x0004 ++#define FAST_SW_DIV_FLAG 0x0008 ++#define INLINE_MEMCPY_FLAG 0x00010 ++#define CACHE_VOLATILE_FLAG 0x0020 ++#define BYPASS_CACHE_FLAG 0x0040 ++ ++extern int target_flags; ++#define TARGET_HAS_DIV (target_flags & HAS_DIV_FLAG) ++#define TARGET_HAS_MUL (target_flags & HAS_MUL_FLAG) ++#define TARGET_HAS_MULX (target_flags & HAS_MULX_FLAG) ++#define TARGET_FAST_SW_DIV (target_flags & FAST_SW_DIV_FLAG) ++#define TARGET_INLINE_MEMCPY (target_flags & INLINE_MEMCPY_FLAG) ++#define TARGET_CACHE_VOLATILE (target_flags & CACHE_VOLATILE_FLAG) ++#define TARGET_BYPASS_CACHE (target_flags & BYPASS_CACHE_FLAG) ++ ++#define TARGET_SWITCHES \ ++{ \ ++ { "hw-div", HAS_DIV_FLAG, \ ++ N_("Enable DIV, DIVU") }, \ ++ { "no-hw-div", -HAS_DIV_FLAG, \ ++ N_("Disable DIV, DIVU (default)") }, \ ++ { "hw-mul", HAS_MUL_FLAG, \ ++ N_("Enable MUL instructions (default)") }, \ ++ { "hw-mulx", HAS_MULX_FLAG, \ ++ N_("Enable MULX instructions, assume fast shifter") }, \ ++ { "no-hw-mul", -HAS_MUL_FLAG, \ ++ N_("Disable MUL instructions") }, \ ++ { "no-hw-mulx", -HAS_MULX_FLAG, \ ++ N_("Disable MULX instructions, assume slow shifter (default and implied by -mno-hw-mul)") }, \ ++ { "fast-sw-div", FAST_SW_DIV_FLAG, \ ++ N_("Use table based fast divide (default at -O3)") }, \ ++ { "no-fast-sw-div", -FAST_SW_DIV_FLAG, \ ++ N_("Don't use table based fast divide ever") }, \ ++ { "inline-memcpy", INLINE_MEMCPY_FLAG, \ ++ N_("Inline small memcpy (default when optimizing)") }, \ ++ { "no-inline-memcpy", -INLINE_MEMCPY_FLAG, \ ++ N_("Don't Inline small memcpy") }, \ ++ { "cache-volatile", CACHE_VOLATILE_FLAG, \ ++ N_("Volatile accesses use non-io variants of instructions (default)") }, \ ++ { "no-cache-volatile", -CACHE_VOLATILE_FLAG, \ ++ N_("Volatile accesses use io variants of instructions") }, \ ++ { "bypass-cache", BYPASS_CACHE_FLAG, \ ++ N_("All ld/st instructins use io variants") }, \ ++ { "no-bypass-cache", -BYPASS_CACHE_FLAG, \ ++ N_("All ld/st instructins do not use io variants (default)") }, \ ++ { "smallc", 0, \ ++ N_("Link with a limited version of the C library") }, \ ++ { "ctors-in-init", 0, \ ++ "" /* undocumented: N_("Link with static constructors and destructors in init") */ }, \ ++ { "", TARGET_DEFAULT, 0 } \ ++} ++ ++ ++extern const char *nios2_sys_nosys_string; /* for -msys=nosys */ ++extern const char *nios2_sys_lib_string; /* for -msys-lib= */ ++extern const char *nios2_sys_crt0_string; /* for -msys-crt0= */ ++ ++#define TARGET_OPTIONS \ ++{ \ ++ { "sys=nosys", &nios2_sys_nosys_string, \ ++ N_("Use stub versions of OS library calls (default)"), 0}, \ ++ { "sys-lib=", &nios2_sys_lib_string, \ ++ N_("Name of System Library to link against. (Converted to a -l option)"), 0}, \ ++ { "sys-crt0=", &nios2_sys_crt0_string, \ ++ N_("Name of the startfile. (default is a crt0 for the ISS only)"), 0}, \ ++} ++ ++ ++/* Default target_flags if no switches specified. */ ++#ifndef TARGET_DEFAULT ++# define TARGET_DEFAULT (HAS_MUL_FLAG | CACHE_VOLATILE_FLAG) ++#endif ++ ++/* Switch Recognition by gcc.c. Add -G xx support */ ++#undef SWITCH_TAKES_ARG ++#define SWITCH_TAKES_ARG(CHAR) \ ++ (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G') ++ ++#define OVERRIDE_OPTIONS override_options () ++#define OPTIMIZATION_OPTIONS(LEVEL, SIZE) optimization_options (LEVEL, SIZE) ++#define CAN_DEBUG_WITHOUT_FP ++ ++#define CC1_SPEC "\ ++%{G*}" ++ ++#undef LIB_SPEC ++#define LIB_SPEC \ ++"--start-group %{msmallc: -lsmallc} %{!msmallc: -lc} -lgcc \ ++ %{msys-lib=*: -l%*} \ ++ %{!msys-lib=*: -lc } \ ++ --end-group \ ++ %{msys-lib=: %eYou need a library name for -msys-lib=} \ ++" ++ ++ ++#undef STARTFILE_SPEC ++#define STARTFILE_SPEC \ ++"%{msys-crt0=*: %*} %{!msys-crt0=*: crt1%O%s} \ ++ %{msys-crt0=: %eYou need a C startup file for -msys-crt0=} \ ++ %{mctors-in-init: crti%O%s crtbegin%O%s} \ ++" ++ ++#undef ENDFILE_SPEC ++#define ENDFILE_SPEC \ ++ "%{mctors-in-init: crtend%O%s crtn%O%s}" ++ ++ ++/*********************** ++ * Storage Layout ++ ***********************/ ++ ++#define DEFAULT_SIGNED_CHAR 1 ++#define BITS_BIG_ENDIAN 0 ++#define BYTES_BIG_ENDIAN 0 ++#define WORDS_BIG_ENDIAN 0 ++#define BITS_PER_UNIT 8 ++#define BITS_PER_WORD 32 ++#define UNITS_PER_WORD 4 ++#define POINTER_SIZE 32 ++#define BIGGEST_ALIGNMENT 32 ++#define STRICT_ALIGNMENT 1 ++#define FUNCTION_BOUNDARY 32 ++#define PARM_BOUNDARY 32 ++#define STACK_BOUNDARY 32 ++#define PREFERRED_STACK_BOUNDARY 32 ++#define MAX_FIXED_MODE_SIZE 64 ++ ++#define CONSTANT_ALIGNMENT(EXP, ALIGN) \ ++ ((TREE_CODE (EXP) == STRING_CST) \ ++ && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN)) ++ ++ ++/********************** ++ * Layout of Source Language Data Types ++ **********************/ ++ ++#define INT_TYPE_SIZE 32 ++#define SHORT_TYPE_SIZE 16 ++#define LONG_TYPE_SIZE 32 ++#define LONG_LONG_TYPE_SIZE 64 ++#define FLOAT_TYPE_SIZE 32 ++#define DOUBLE_TYPE_SIZE 64 ++#define LONG_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE ++ ++ ++/************************* ++ * Condition Code Status ++ ************************/ ++ ++/* comparison type */ ++/* ??? currently only CMP_SI is used */ ++enum cmp_type { ++ CMP_SI, /* compare four byte integers */ ++ CMP_DI, /* compare eight byte integers */ ++ CMP_SF, /* compare single precision floats */ ++ CMP_DF, /* compare double precision floats */ ++ CMP_MAX /* max comparison type */ ++}; ++ ++extern GTY(()) rtx branch_cmp[2]; /* operands for compare */ ++extern enum cmp_type branch_type; /* what type of branch to use */ ++ ++/********************** ++ * Register Usage ++ **********************/ ++ ++/* ---------------------------------- * ++ * Basic Characteristics of Registers ++ * ---------------------------------- */ ++ ++/* ++Register Number ++ Register Name ++ Alternate Name ++ Purpose ++0 r0 zero always zero ++1 r1 at Assembler Temporary ++2-3 r2-r3 Return Location ++4-7 r4-r7 Register Arguments ++8-15 r8-r15 Caller Saved Registers ++16-22 r16-r22 Callee Saved Registers ++23 r23 sc Static Chain (Callee Saved) ++ ??? Does $sc want to be caller or callee ++ saved. If caller, 15, else 23. ++24 r24 Exception Temporary ++25 r25 Breakpoint Temporary ++26 r26 gp Global Pointer ++27 r27 sp Stack Pointer ++28 r28 fp Frame Pointer ++29 r29 ea Exception Return Address ++30 r30 ba Breakpoint Return Address ++31 r31 ra Return Address ++ ++32 ctl0 status ++33 ctl1 estatus STATUS saved by exception ? ++34 ctl2 bstatus STATUS saved by break ? ++35 ctl3 ipri Interrupt Priority Mask ? ++36 ctl4 ecause Exception Cause ? ++ ++37 pc Not an actual register ++ ++38 rap Return address pointer, this does not ++ actually exist and will be eliminated ++ ++39 fake_fp Fake Frame Pointer which will always be eliminated. ++40 fake_ap Fake Argument Pointer which will always be eliminated. ++ ++41 First Pseudo Register ++ ++ ++The definitions for all the hard register numbers ++are located in nios2.md. ++*/ ++ ++#define FIRST_PSEUDO_REGISTER 41 ++#define NUM_ARG_REGS (LAST_ARG_REGNO - FIRST_ARG_REGNO + 1) ++ ++ ++ ++/* also see CONDITIONAL_REGISTER_USAGE */ ++#define FIXED_REGISTERS \ ++ { \ ++/* +0 1 2 3 4 5 6 7 8 9 */ \ ++/* 0 */ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, \ ++/* 10 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ ++/* 20 */ 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, \ ++/* 30 */ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, \ ++/* 40 */ 1, \ ++ } ++ ++/* call used is the same as caller saved ++ + fixed regs + args + ret vals */ ++#define CALL_USED_REGISTERS \ ++ { \ ++/* +0 1 2 3 4 5 6 7 8 9 */ \ ++/* 0 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ ++/* 10 */ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, \ ++/* 20 */ 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, \ ++/* 30 */ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, \ ++/* 40 */ 1, \ ++ } ++ ++#define HARD_REGNO_NREGS(REGNO, MODE) \ ++ ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \ ++ / UNITS_PER_WORD) ++ ++/* --------------------------- * ++ * How Values Fit in Registers ++ * --------------------------- */ ++ ++#define HARD_REGNO_MODE_OK(REGNO, MODE) 1 ++ ++#define MODES_TIEABLE_P(MODE1, MODE2) 1 ++ ++ ++/************************* ++ * Register Classes ++ *************************/ ++ ++enum reg_class ++{ ++ NO_REGS, ++ ALL_REGS, ++ LIM_REG_CLASSES ++}; ++ ++#define N_REG_CLASSES (int) LIM_REG_CLASSES ++ ++#define REG_CLASS_NAMES \ ++ {"NO_REGS", \ ++ "ALL_REGS"} ++ ++#define GENERAL_REGS ALL_REGS ++ ++#define REG_CLASS_CONTENTS \ ++/* NO_REGS */ {{ 0, 0}, \ ++/* ALL_REGS */ {~0,~0}} \ ++ ++#define REGNO_REG_CLASS(REGNO) ALL_REGS ++ ++#define BASE_REG_CLASS ALL_REGS ++#define INDEX_REG_CLASS ALL_REGS ++ ++/* only one reg class, 'r', is handled automatically */ ++#define REG_CLASS_FROM_LETTER(CHAR) NO_REGS ++ ++#define REGNO_OK_FOR_BASE_P2(REGNO, STRICT) \ ++ ((STRICT) \ ++ ? (REGNO) < FIRST_PSEUDO_REGISTER \ ++ : (REGNO) < FIRST_PSEUDO_REGISTER || (reg_renumber && reg_renumber[REGNO] < FIRST_PSEUDO_REGISTER)) ++ ++#define REGNO_OK_FOR_INDEX_P2(REGNO, STRICT) \ ++ (REGNO_OK_FOR_BASE_P2 (REGNO, STRICT)) ++ ++#define REGNO_OK_FOR_BASE_P(REGNO) \ ++ (REGNO_OK_FOR_BASE_P2 (REGNO, 1)) ++ ++#define REGNO_OK_FOR_INDEX_P(REGNO) \ ++ (REGNO_OK_FOR_INDEX_P2 (REGNO, 1)) ++ ++#define REG_OK_FOR_BASE_P2(X, STRICT) \ ++ (STRICT \ ++ ? REGNO_OK_FOR_BASE_P2 (REGNO (X), 1) \ ++ : REGNO_OK_FOR_BASE_P2 (REGNO (X), 1) || REGNO(X) >= FIRST_PSEUDO_REGISTER) ++ ++#define REG_OK_FOR_INDEX_P2(X, STRICT) \ ++ (STRICT \ ++ ? REGNO_OK_FOR_INDEX_P2 (REGNO (X), 1) \ ++ : REGNO_OK_FOR_INDEX_P2 (REGNO (X), 1) || REGNO(X) >= FIRST_PSEUDO_REGISTER) ++ ++#define CLASS_MAX_NREGS(CLASS, MODE) \ ++ ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \ ++ / UNITS_PER_WORD) ++ ++ ++#define SMALL_INT(X) ((unsigned HOST_WIDE_INT) ((X) + 0x8000) < 0x10000) ++#define SMALL_INT_UNSIGNED(X) ((unsigned HOST_WIDE_INT) (X) < 0x10000) ++#define UPPER16_INT(X) (((X) & 0xffff) == 0) ++#define SHIFT_INT(X) ((X) >= 0 && (X) <= 31) ++#define RDWRCTL_INT(X) ((X) >= 0 && (X) <= 31) ++#define CUSTOM_INSN_OPCODE(X) ((X) >= 0 && (X) <= 255) ++ ++#define CONST_OK_FOR_LETTER_P(VALUE, C) \ ++ ( \ ++ (C) == 'I' ? SMALL_INT (VALUE) : \ ++ (C) == 'J' ? SMALL_INT_UNSIGNED (VALUE) : \ ++ (C) == 'K' ? UPPER16_INT (VALUE) : \ ++ (C) == 'L' ? SHIFT_INT (VALUE) : \ ++ (C) == 'M' ? (VALUE) == 0 : \ ++ (C) == 'N' ? CUSTOM_INSN_OPCODE (VALUE) : \ ++ (C) == 'O' ? RDWRCTL_INT (VALUE) : \ ++ 0) ++ ++#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0 ++ ++#define PREFERRED_RELOAD_CLASS(X, CLASS) \ ++ ((CLASS) == NO_REGS ? GENERAL_REGS : (CLASS)) ++ ++/* 'S' matches immediates which are in small data ++ and therefore can be added to gp to create a ++ 32-bit value. */ ++#define EXTRA_CONSTRAINT(VALUE, C) \ ++ ((C) == 'S' \ ++ && (GET_CODE (VALUE) == SYMBOL_REF) \ ++ && SYMBOL_REF_IN_NIOS2_SMALL_DATA_P (VALUE)) ++ ++ ++ ++ ++/* Say that the epilogue uses the return address register. Note that ++ in the case of sibcalls, the values "used by the epilogue" are ++ considered live at the start of the called function. */ ++#define EPILOGUE_USES(REGNO) ((REGNO) == RA_REGNO) ++ ++ ++#define DEFAULT_MAIN_RETURN c_expand_return (integer_zero_node) ++ ++/********************************** ++ * Trampolines for Nested Functions ++ ***********************************/ ++ ++#define TRAMPOLINE_TEMPLATE(FILE) \ ++ error ("trampolines not yet implemented") ++#define TRAMPOLINE_SIZE 20 ++#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ ++ error ("trampolines not yet implemented") ++ ++/*************************** ++ * Stack Layout and Calling Conventions ++ ***************************/ ++ ++/* ------------------ * ++ * Basic Stack Layout ++ * ------------------ */ ++ ++/* The downward variants are used by the compiler, ++ the upward ones serve as documentation */ ++#define STACK_GROWS_DOWNWARD ++#define FRAME_GROWS_UPWARD ++#define ARGS_GROW_UPWARD ++ ++#define STARTING_FRAME_OFFSET current_function_outgoing_args_size ++#define FIRST_PARM_OFFSET(FUNDECL) 0 ++ ++/* Before the prologue, RA lives in r31. */ ++#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (VOIDmode, RA_REGNO) ++ ++/* -------------------------------------- * ++ * Registers That Address the Stack Frame ++ * -------------------------------------- */ ++ ++#define STACK_POINTER_REGNUM SP_REGNO ++#define STATIC_CHAIN_REGNUM SC_REGNO ++#define PC_REGNUM PC_REGNO ++#define DWARF_FRAME_RETURN_COLUMN RA_REGNO ++ ++/* Base register for access to local variables of the function. We ++ pretend that the frame pointer is a non-existent hard register, and ++ then eliminate it to HARD_FRAME_POINTER_REGNUM. */ ++#define FRAME_POINTER_REGNUM FAKE_FP_REGNO ++ ++#define HARD_FRAME_POINTER_REGNUM FP_REGNO ++#define RETURN_ADDRESS_POINTER_REGNUM RAP_REGNO ++/* the argumnet pointer needs to always be eliminated ++ so it is set to a fake hard register. */ ++#define ARG_POINTER_REGNUM FAKE_AP_REGNO ++ ++/* ----------------------------------------- * ++ * Eliminating Frame Pointer and Arg Pointer ++ * ----------------------------------------- */ ++ ++#define FRAME_POINTER_REQUIRED 0 ++ ++#define ELIMINABLE_REGS \ ++{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ ++ { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ ++ { RETURN_ADDRESS_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ ++ { RETURN_ADDRESS_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ ++ { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ ++ { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}} ++ ++#define CAN_ELIMINATE(FROM, TO) 1 ++ ++#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ ++ (OFFSET) = nios2_initial_elimination_offset ((FROM), (TO)) ++ ++#define MUST_SAVE_REGISTER(regno) \ ++ ((regs_ever_live[regno] && !call_used_regs[regno]) \ ++ || (regno == HARD_FRAME_POINTER_REGNUM && frame_pointer_needed) \ ++ || (regno == RA_REGNO && regs_ever_live[RA_REGNO])) ++ ++/* Treat LOC as a byte offset from the stack pointer and round it up ++ to the next fully-aligned offset. */ ++#define STACK_ALIGN(LOC) \ ++ (((LOC) + ((PREFERRED_STACK_BOUNDARY / 8) - 1)) & ~((PREFERRED_STACK_BOUNDARY / 8) - 1)) ++ ++ ++/* ------------------------------ * ++ * Passing Arguments in Registers ++ * ------------------------------ */ ++ ++/* see nios2.c */ ++#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ ++ (function_arg (&CUM, MODE, TYPE, NAMED)) ++ ++#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \ ++ (function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)) ++ ++#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) 0 ++ ++#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) 0 ++ ++typedef struct nios2_args ++{ ++ int regs_used; ++} CUMULATIVE_ARGS; ++ ++/* This is to initialize the above unused CUM data type */ ++#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \ ++ (init_cumulative_args (&CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS)) ++ ++#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ ++ (function_arg_advance (&CUM, MODE, TYPE, NAMED)) ++ ++#define FUNCTION_ARG_REGNO_P(REGNO) \ ++ ((REGNO) >= FIRST_ARG_REGNO && (REGNO) <= LAST_ARG_REGNO) ++ ++#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \ ++ { \ ++ int pret_size = nios2_setup_incoming_varargs (&(CUM), (MODE), \ ++ (TYPE), (NO_RTL)); \ ++ if (pret_size) \ ++ (PRETEND_SIZE) = pret_size; \ ++ } ++ ++/* ----------------------------- * ++ * Generating Code for Profiling ++ * ----------------------------- */ ++ ++#define PROFILE_BEFORE_PROLOGUE ++ ++#define FUNCTION_PROFILER(FILE, LABELNO) \ ++ function_profiler ((FILE), (LABELNO)) ++ ++/* --------------------------------------- * ++ * Passing Function Arguments on the Stack ++ * --------------------------------------- */ ++ ++#define PROMOTE_PROTOTYPES 1 ++ ++#define PUSH_ARGS 0 ++#define ACCUMULATE_OUTGOING_ARGS 1 ++ ++#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACKSIZE) 0 ++ ++/* --------------------------------------- * ++ * How Scalar Function Values Are Returned ++ * --------------------------------------- */ ++ ++#define FUNCTION_VALUE(VALTYPE, FUNC) \ ++ gen_rtx(REG, TYPE_MODE(VALTYPE), FIRST_RETVAL_REGNO) ++ ++#define LIBCALL_VALUE(MODE) \ ++ gen_rtx(REG, MODE, FIRST_RETVAL_REGNO) ++ ++#define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO) == FIRST_RETVAL_REGNO) ++ ++/* ----------------------------- * ++ * How Large Values Are Returned ++ * ----------------------------- */ ++ ++ ++#define RETURN_IN_MEMORY(TYPE) \ ++ nios2_return_in_memory (TYPE) ++ ++ ++#define STRUCT_VALUE 0 ++ ++#define DEFAULT_PCC_STRUCT_RETURN 0 ++ ++/******************* ++ * Addressing Modes ++ *******************/ ++ ++ ++#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) ++ ++#define CONSTANT_ADDRESS_P(X) (CONSTANT_P (X)) ++ ++#define MAX_REGS_PER_ADDRESS 1 ++ ++/* Go to ADDR if X is a valid address. */ ++#ifndef REG_OK_STRICT ++#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ ++ { \ ++ if (nios2_legitimate_address ((X), (MODE), 0)) \ ++ goto ADDR; \ ++ } ++#else ++#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ ++ { \ ++ if (nios2_legitimate_address ((X), (MODE), 1)) \ ++ goto ADDR; \ ++ } ++#endif ++ ++#ifndef REG_OK_STRICT ++#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P2 (REGNO (X), 0) ++#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P2 (REGNO (X), 0) ++#else ++#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P2 (REGNO (X), 1) ++#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P2 (REGNO (X), 1) ++#endif ++ ++#define LEGITIMATE_CONSTANT_P(X) 1 ++ ++/* Nios II has no mode dependent addresses. */ ++#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) ++ ++/* Set if this has a weak declaration */ ++#define SYMBOL_FLAG_WEAK_DECL (1 << SYMBOL_FLAG_MACH_DEP_SHIFT) ++#define SYMBOL_REF_WEAK_DECL_P(RTX) \ ++ ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_WEAK_DECL) != 0) ++ ++ ++/* true if a symbol is both small and not weak. In this case, gp ++ relative access can be used */ ++#define SYMBOL_REF_IN_NIOS2_SMALL_DATA_P(RTX) \ ++ (SYMBOL_REF_SMALL_P(RTX) && !SYMBOL_REF_WEAK_DECL_P(RTX)) ++ ++/***************** ++ * Describing Relative Costs of Operations ++ *****************/ ++ ++#define SLOW_BYTE_ACCESS 1 ++ ++/* It is as good to call a constant function address as to call an address ++ kept in a register. ++ ??? Not true anymore really. Now that call cannot address full range ++ of memory callr may need to be used */ ++ ++#define NO_FUNCTION_CSE ++#define NO_RECURSIVE_FUNCTION_CSE ++ ++ ++ ++/***************************************** ++ * Defining the Output Assembler Language ++ *****************************************/ ++ ++/* ------------------------------------------ * ++ * The Overall Framework of an Assembler File ++ * ------------------------------------------ */ ++ ++#define ASM_APP_ON "#APP\n" ++#define ASM_APP_OFF "#NO_APP\n" ++ ++#define ASM_COMMENT_START "# " ++ ++/* ------------------------------- * ++ * Output and Generation of Labels ++ * ------------------------------- */ ++ ++#define GLOBAL_ASM_OP "\t.global\t" ++ ++ ++/* -------------- * ++ * Output of Data ++ * -------------- */ ++ ++#define DWARF2_UNWIND_INFO 0 ++ ++ ++/* -------------------------------- * ++ * Assembler Commands for Alignment ++ * -------------------------------- */ ++ ++#define ASM_OUTPUT_ALIGN(FILE, LOG) \ ++ do { \ ++ fprintf ((FILE), "%s%d\n", ALIGN_ASM_OP, (LOG)); \ ++ } while (0) ++ ++ ++/* -------------------------------- * ++ * Output of Assembler Instructions ++ * -------------------------------- */ ++ ++#define REGISTER_NAMES \ ++{ \ ++ "zero", \ ++ "at", \ ++ "r2", \ ++ "r3", \ ++ "r4", \ ++ "r5", \ ++ "r6", \ ++ "r7", \ ++ "r8", \ ++ "r9", \ ++ "r10", \ ++ "r11", \ ++ "r12", \ ++ "r13", \ ++ "r14", \ ++ "r15", \ ++ "r16", \ ++ "r17", \ ++ "r18", \ ++ "r19", \ ++ "r20", \ ++ "r21", \ ++ "r22", \ ++ "r23", \ ++ "r24", \ ++ "r25", \ ++ "gp", \ ++ "sp", \ ++ "fp", \ ++ "ta", \ ++ "ba", \ ++ "ra", \ ++ "status", \ ++ "estatus", \ ++ "bstatus", \ ++ "ipri", \ ++ "ecause", \ ++ "pc", \ ++ "rap", \ ++ "fake_fp", \ ++ "fake_ap", \ ++} ++ ++#define ASM_OUTPUT_OPCODE(STREAM, PTR)\ ++ (PTR) = asm_output_opcode (STREAM, PTR) ++ ++#define PRINT_OPERAND(STREAM, X, CODE) \ ++ nios2_print_operand (STREAM, X, CODE) ++ ++#define PRINT_OPERAND_ADDRESS(STREAM, X) \ ++ nios2_print_operand_address (STREAM, X) ++ ++#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ ++do { fputs (integer_asm_op (POINTER_SIZE / BITS_PER_UNIT, TRUE), FILE); \ ++ fprintf (FILE, ".L%u\n", (unsigned) (VALUE)); \ ++ } while (0) ++ ++ ++/* ------------ * ++ * Label Output ++ * ------------ */ ++ ++ ++/* ---------------------------------------------------- * ++ * Dividing the Output into Sections (Texts, Data, ...) ++ * ---------------------------------------------------- */ ++ ++/* Output before read-only data. */ ++#define TEXT_SECTION_ASM_OP ("\t.section\t.text") ++ ++/* Output before writable data. */ ++#define DATA_SECTION_ASM_OP ("\t.section\t.data") ++ ++ ++/* Default the definition of "small data" to 8 bytes. */ ++/* ??? How come I can't use HOST_WIDE_INT here? */ ++extern unsigned long nios2_section_threshold; ++#define NIOS2_DEFAULT_GVALUE 8 ++ ++ ++ ++/* This says how to output assembler code to declare an ++ uninitialized external linkage data object. Under SVR4, ++ the linker seems to want the alignment of data objects ++ to depend on their types. We do exactly that here. */ ++ ++#undef COMMON_ASM_OP ++#define COMMON_ASM_OP "\t.comm\t" ++ ++#undef ASM_OUTPUT_ALIGNED_COMMON ++#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ ++do \ ++{ \ ++ if ((SIZE) <= nios2_section_threshold) \ ++ { \ ++ named_section (0, ".sbss", 0); \ ++ (*targetm.asm_out.globalize_label) (FILE, NAME); \ ++ ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \ ++ if (!flag_inhibit_size_directive) \ ++ ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \ ++ ASM_OUTPUT_ALIGN ((FILE), exact_log2((ALIGN) / BITS_PER_UNIT)); \ ++ ASM_OUTPUT_LABEL(FILE, NAME); \ ++ ASM_OUTPUT_SKIP((FILE), (SIZE) ? (SIZE) : 1); \ ++ } \ ++ else \ ++ { \ ++ fprintf ((FILE), "%s", COMMON_ASM_OP); \ ++ assemble_name ((FILE), (NAME)); \ ++ fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \ ++ } \ ++} \ ++while (0) ++ ++ ++/* This says how to output assembler code to declare an ++ uninitialized internal linkage data object. Under SVR4, ++ the linker seems to want the alignment of data objects ++ to depend on their types. We do exactly that here. */ ++ ++#undef ASM_OUTPUT_ALIGNED_LOCAL ++#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ ++do { \ ++ if ((SIZE) <= nios2_section_threshold) \ ++ named_section (0, ".sbss", 0); \ ++ else \ ++ named_section (0, ".bss", 0); \ ++ ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \ ++ if (!flag_inhibit_size_directive) \ ++ ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \ ++ ASM_OUTPUT_ALIGN ((FILE), exact_log2((ALIGN) / BITS_PER_UNIT)); \ ++ ASM_OUTPUT_LABEL(FILE, NAME); \ ++ ASM_OUTPUT_SKIP((FILE), (SIZE) ? (SIZE) : 1); \ ++} while (0) ++ ++ ++ ++/*************************** ++ * Miscellaneous Parameters ++ ***************************/ ++ ++#define MOVE_MAX 4 ++ ++#define Pmode SImode ++#define FUNCTION_MODE QImode ++ ++#define CASE_VECTOR_MODE Pmode ++ ++#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 ++ ++#define LOAD_EXTEND_OP(MODE) (ZERO_EXTEND) ++ ++#define WORD_REGISTER_OPERATIONS +diff -durN gcc-3.4.6.orig/gcc/config/nios2/nios2.md gcc-3.4.6/gcc/config/nios2/nios2.md +--- gcc-3.4.6.orig/gcc/config/nios2/nios2.md 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/gcc/config/nios2/nios2.md 2007-08-15 23:09:36.000000000 +0200 +@@ -0,0 +1,2078 @@ ++;; Machine Description for Altera NIOS 2G NIOS2 version. ++;; Copyright (C) 2003 Altera ++;; Contributed by Jonah Graham (jgraham@altera.com). ++;; ++;; This file is part of GNU CC. ++;; ++;; GNU CC is free software; you can redistribute it and/or modify ++;; it under the terms of the GNU General Public License as published by ++;; the Free Software Foundation; either version 2, or (at your option) ++;; any later version. ++;; ++;; GNU CC is distributed in the hope that it will be useful, ++;; but WITHOUT ANY WARRANTY; without even the implied warranty of ++;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++;; GNU General Public License for more details. ++;; ++;; You should have received a copy of the GNU General Public License ++;; along with GNU CC; see the file COPYING. If not, write to ++;; the Free Software Foundation, 59 Temple Place - Suite 330, ++;; Boston, MA 02111-1307, USA. */ ++ ++ ++ ++;***************************************************************************** ++;* ++;* constants ++;* ++;***************************************************************************** ++(define_constants [ ++ (GP_REGNO 26) ++ (SP_REGNO 27) ++ (FP_REGNO 28) ++ (RA_REGNO 31) ++ (RAP_REGNO 38) ++ (FIRST_RETVAL_REGNO 2) ++ (LAST_RETVAL_REGNO 3) ++ (FIRST_ARG_REGNO 4) ++ (LAST_ARG_REGNO 7) ++ (SC_REGNO 23) ++ (PC_REGNO 37) ++ (FAKE_FP_REGNO 39) ++ (FAKE_AP_REGNO 40) ++ ++ ++ (UNSPEC_BLOCKAGE 0) ++ (UNSPEC_LDBIO 1) ++ (UNSPEC_LDBUIO 2) ++ (UNSPEC_LDHIO 3) ++ (UNSPEC_LDHUIO 4) ++ (UNSPEC_LDWIO 5) ++ (UNSPEC_STBIO 6) ++ (UNSPEC_STHIO 7) ++ (UNSPEC_STWIO 8) ++ (UNSPEC_SYNC 9) ++ (UNSPEC_WRCTL 10) ++ (UNSPEC_RDCTL 11) ++ ++]) ++ ++ ++ ++;***************************************************************************** ++;* ++;* instruction scheduler ++;* ++;***************************************************************************** ++ ++; No schedule info is currently available, using an assumption that no ++; instruction can use the results of the previous instruction without ++; incuring a stall. ++ ++; length of an instruction (in bytes) ++(define_attr "length" "" (const_int 4)) ++(define_attr "type" "unknown,complex,control,alu,cond_alu,st,ld,shift,mul,div,custom" (const_string "complex")) ++ ++(define_asm_attributes ++ [(set_attr "length" "4") ++ (set_attr "type" "complex")]) ++ ++(define_automaton "nios2") ++(automata_option "v") ++;(automata_option "no-minimization") ++(automata_option "ndfa") ++ ++; The nios2 pipeline is fairly straightforward for the fast model. ++; Every alu operation is pipelined so that an instruction can ++; be issued every cycle. However, there are still potential ++; stalls which this description tries to deal with. ++ ++(define_cpu_unit "cpu" "nios2") ++ ++(define_insn_reservation "complex" 1 ++ (eq_attr "type" "complex") ++ "cpu") ++ ++(define_insn_reservation "control" 1 ++ (eq_attr "type" "control") ++ "cpu") ++ ++(define_insn_reservation "alu" 1 ++ (eq_attr "type" "alu") ++ "cpu") ++ ++(define_insn_reservation "cond_alu" 1 ++ (eq_attr "type" "cond_alu") ++ "cpu") ++ ++(define_insn_reservation "st" 1 ++ (eq_attr "type" "st") ++ "cpu") ++ ++(define_insn_reservation "custom" 1 ++ (eq_attr "type" "custom") ++ "cpu") ++ ++; shifts, muls and lds have three cycle latency ++(define_insn_reservation "ld" 3 ++ (eq_attr "type" "ld") ++ "cpu") ++ ++(define_insn_reservation "shift" 3 ++ (eq_attr "type" "shift") ++ "cpu") ++ ++(define_insn_reservation "mul" 3 ++ (eq_attr "type" "mul") ++ "cpu") ++ ++(define_insn_reservation "div" 1 ++ (eq_attr "type" "div") ++ "cpu") ++ ++ ++;***************************************************************************** ++;* ++;* MOV Instructions ++;* ++;***************************************************************************** ++ ++(define_expand "movqi" ++ [(set (match_operand:QI 0 "nonimmediate_operand" "") ++ (match_operand:QI 1 "general_operand" ""))] ++ "" ++{ ++ if (nios2_emit_move_sequence (operands, QImode)) ++ DONE; ++}) ++ ++(define_insn "movqi_internal" ++ [(set (match_operand:QI 0 "nonimmediate_operand" "=m, r,r, r") ++ (match_operand:QI 1 "general_operand" "rM,m,rM,I"))] ++ "(register_operand (operands[0], QImode) ++ || register_operand (operands[1], QImode) ++ || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))" ++ "@ ++ stb%o0\\t%z1, %0 ++ ldbu%o1\\t%0, %1 ++ mov\\t%0, %z1 ++ movi\\t%0, %1" ++ [(set_attr "type" "st,ld,alu,alu")]) ++ ++(define_insn "ldbio" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(const_int 0)] UNSPEC_LDBIO)) ++ (use (match_operand:SI 1 "memory_operand" "m"))] ++ "" ++ "ldbio\\t%0, %1" ++ [(set_attr "type" "ld")]) ++ ++(define_insn "ldbuio" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(const_int 0)] UNSPEC_LDBUIO)) ++ (use (match_operand:SI 1 "memory_operand" "m"))] ++ "" ++ "ldbuio\\t%0, %1" ++ [(set_attr "type" "ld")]) ++ ++(define_insn "stbio" ++ [(set (match_operand:SI 0 "memory_operand" "=m") ++ (match_operand:SI 1 "register_operand" "r")) ++ (unspec_volatile:SI [(const_int 0)] UNSPEC_STBIO)] ++ "" ++ "stbio\\t%z1, %0" ++ [(set_attr "type" "st")]) ++ ++ ++(define_expand "movhi" ++ [(set (match_operand:HI 0 "nonimmediate_operand" "") ++ (match_operand:HI 1 "general_operand" ""))] ++ "" ++{ ++ if (nios2_emit_move_sequence (operands, HImode)) ++ DONE; ++}) ++ ++(define_insn "movhi_internal" ++ [(set (match_operand:HI 0 "nonimmediate_operand" "=m, r,r, r,r") ++ (match_operand:HI 1 "general_operand" "rM,m,rM,I,J"))] ++ "(register_operand (operands[0], HImode) ++ || register_operand (operands[1], HImode) ++ || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))" ++ "@ ++ sth%o0\\t%z1, %0 ++ ldhu%o1\\t%0, %1 ++ mov\\t%0, %z1 ++ movi\\t%0, %1 ++ movui\\t%0, %1" ++ [(set_attr "type" "st,ld,alu,alu,alu")]) ++ ++(define_insn "ldhio" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(const_int 0)] UNSPEC_LDHIO)) ++ (use (match_operand:SI 1 "memory_operand" "m"))] ++ "" ++ "ldhio\\t%0, %1" ++ [(set_attr "type" "ld")]) ++ ++(define_insn "ldhuio" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(const_int 0)] UNSPEC_LDHUIO)) ++ (use (match_operand:SI 1 "memory_operand" "m"))] ++ "" ++ "ldhuio\\t%0, %1" ++ [(set_attr "type" "ld")]) ++ ++(define_insn "sthio" ++ [(set (match_operand:SI 0 "memory_operand" "=m") ++ (match_operand:SI 1 "register_operand" "r")) ++ (unspec_volatile:SI [(const_int 0)] UNSPEC_STHIO)] ++ "" ++ "sthio\\t%z1, %0" ++ [(set_attr "type" "st")]) ++ ++(define_expand "movsi" ++ [(set (match_operand:SI 0 "nonimmediate_operand" "") ++ (match_operand:SI 1 "general_operand" ""))] ++ "" ++{ ++ if (nios2_emit_move_sequence (operands, SImode)) ++ DONE; ++}) ++ ++(define_insn "movsi_internal" ++ [(set (match_operand:SI 0 "nonimmediate_operand" "=m, r,r, r,r,r,r") ++ (match_operand:SI 1 "general_operand" "rM,m,rM,I,J,S,i"))] ++ "(register_operand (operands[0], SImode) ++ || register_operand (operands[1], SImode) ++ || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))" ++ "@ ++ stw%o0\\t%z1, %0 ++ ldw%o1\\t%0, %1 ++ mov\\t%0, %z1 ++ movi\\t%0, %1 ++ movui\\t%0, %1 ++ addi\\t%0, gp, %%gprel(%1) ++ movhi\\t%0, %H1\;addi\\t%0, %0, %L1" ++ [(set_attr "type" "st,ld,alu,alu,alu,alu,alu")]) ++ ++(define_insn "ldwio" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(const_int 0)] UNSPEC_LDWIO)) ++ (use (match_operand:SI 1 "memory_operand" "m"))] ++ "" ++ "ldwio\\t%0, %1" ++ [(set_attr "type" "ld")]) ++ ++(define_insn "stwio" ++ [(set (match_operand:SI 0 "memory_operand" "=m") ++ (match_operand:SI 1 "register_operand" "r")) ++ (unspec_volatile:SI [(const_int 0)] UNSPEC_STWIO)] ++ "" ++ "stwio\\t%z1, %0" ++ [(set_attr "type" "st")]) ++ ++ ++ ++;***************************************************************************** ++;* ++;* zero extension ++;* ++;***************************************************************************** ++ ++ ++(define_insn "zero_extendhisi2" ++ [(set (match_operand:SI 0 "register_operand" "=r,r") ++ (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))] ++ "" ++ "@ ++ andi\\t%0, %1, 0xffff ++ ldhu%o1\\t%0, %1" ++ [(set_attr "type" "alu,ld")]) ++ ++(define_insn "zero_extendqihi2" ++ [(set (match_operand:HI 0 "register_operand" "=r,r") ++ (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "r,m")))] ++ "" ++ "@ ++ andi\\t%0, %1, 0xff ++ ldbu%o1\\t%0, %1" ++ [(set_attr "type" "alu,ld")]) ++ ++(define_insn "zero_extendqisi2" ++ [(set (match_operand:SI 0 "register_operand" "=r,r") ++ (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))] ++ "" ++ "@ ++ andi\\t%0, %1, 0xff ++ ldbu%o1\\t%0, %1" ++ [(set_attr "type" "alu,ld")]) ++ ++ ++ ++;***************************************************************************** ++;* ++;* sign extension ++;* ++;***************************************************************************** ++ ++(define_expand "extendhisi2" ++ [(set (match_operand:SI 0 "register_operand" "") ++ (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))] ++ "" ++{ ++ if (optimize && GET_CODE (operands[1]) == MEM) ++ operands[1] = force_not_mem (operands[1]); ++ ++ if (GET_CODE (operands[1]) != MEM) ++ { ++ rtx op1 = gen_lowpart (SImode, operands[1]); ++ rtx temp = gen_reg_rtx (SImode); ++ rtx shift = GEN_INT (16); ++ ++ emit_insn (gen_ashlsi3 (temp, op1, shift)); ++ emit_insn (gen_ashrsi3 (operands[0], temp, shift)); ++ DONE; ++ } ++}) ++ ++(define_insn "extendhisi2_internal" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (sign_extend:SI (match_operand:HI 1 "memory_operand" "m")))] ++ "" ++ "ldh%o1\\t%0, %1" ++ [(set_attr "type" "ld")]) ++ ++(define_expand "extendqihi2" ++ [(set (match_operand:HI 0 "register_operand" "") ++ (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))] ++ "" ++{ ++ if (optimize && GET_CODE (operands[1]) == MEM) ++ operands[1] = force_not_mem (operands[1]); ++ ++ if (GET_CODE (operands[1]) != MEM) ++ { ++ rtx op0 = gen_lowpart (SImode, operands[0]); ++ rtx op1 = gen_lowpart (SImode, operands[1]); ++ rtx temp = gen_reg_rtx (SImode); ++ rtx shift = GEN_INT (24); ++ ++ emit_insn (gen_ashlsi3 (temp, op1, shift)); ++ emit_insn (gen_ashrsi3 (op0, temp, shift)); ++ DONE; ++ } ++}) ++ ++(define_insn "extendqihi2_internal" ++ [(set (match_operand:HI 0 "register_operand" "=r") ++ (sign_extend:HI (match_operand:QI 1 "memory_operand" "m")))] ++ "" ++ "ldb%o1\\t%0, %1" ++ [(set_attr "type" "ld")]) ++ ++ ++(define_expand "extendqisi2" ++ [(set (match_operand:SI 0 "register_operand" "") ++ (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))] ++ "" ++{ ++ if (optimize && GET_CODE (operands[1]) == MEM) ++ operands[1] = force_not_mem (operands[1]); ++ ++ if (GET_CODE (operands[1]) != MEM) ++ { ++ rtx op1 = gen_lowpart (SImode, operands[1]); ++ rtx temp = gen_reg_rtx (SImode); ++ rtx shift = GEN_INT (24); ++ ++ emit_insn (gen_ashlsi3 (temp, op1, shift)); ++ emit_insn (gen_ashrsi3 (operands[0], temp, shift)); ++ DONE; ++ } ++}) ++ ++(define_insn "extendqisi2_insn" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))] ++ "" ++ "ldb%o1\\t%0, %1" ++ [(set_attr "type" "ld")]) ++ ++ ++ ++;***************************************************************************** ++;* ++;* Arithmetic Operations ++;* ++;***************************************************************************** ++ ++(define_insn "addsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r,r") ++ (plus:SI (match_operand:SI 1 "register_operand" "%r,r") ++ (match_operand:SI 2 "arith_operand" "r,I")))] ++ "" ++ "add%i2\\t%0, %1, %z2" ++ [(set_attr "type" "alu")]) ++ ++(define_insn "subsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rM") ++ (match_operand:SI 2 "register_operand" "r")))] ++ "" ++ "sub\\t%0, %z1, %2" ++ [(set_attr "type" "alu")]) ++ ++(define_insn "mulsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r,r") ++ (mult:SI (match_operand:SI 1 "register_operand" "r,r") ++ (match_operand:SI 2 "arith_operand" "r,I")))] ++ "TARGET_HAS_MUL" ++ "mul%i2\\t%0, %1, %z2" ++ [(set_attr "type" "mul")]) ++ ++(define_expand "divsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (div:SI (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SI 2 "register_operand" "r")))] ++ "" ++{ ++ if (!TARGET_HAS_DIV) ++ { ++ if (!TARGET_FAST_SW_DIV) ++ FAIL; ++ else ++ { ++ if (nios2_emit_expensive_div (operands, SImode)) ++ DONE; ++ } ++ } ++}) ++ ++(define_insn "divsi3_insn" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (div:SI (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SI 2 "register_operand" "r")))] ++ "TARGET_HAS_DIV" ++ "div\\t%0, %1, %2" ++ [(set_attr "type" "div")]) ++ ++(define_insn "udivsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (udiv:SI (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SI 2 "register_operand" "r")))] ++ "TARGET_HAS_DIV" ++ "divu\\t%0, %1, %2" ++ [(set_attr "type" "div")]) ++ ++(define_insn "smulsi3_highpart" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (truncate:SI ++ (lshiftrt:DI ++ (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r")) ++ (sign_extend:DI (match_operand:SI 2 "register_operand" "r"))) ++ (const_int 32))))] ++ "TARGET_HAS_MULX" ++ "mulxss\\t%0, %1, %2" ++ [(set_attr "type" "mul")]) ++ ++(define_insn "umulsi3_highpart" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (truncate:SI ++ (lshiftrt:DI ++ (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r")) ++ (zero_extend:DI (match_operand:SI 2 "register_operand" "r"))) ++ (const_int 32))))] ++ "TARGET_HAS_MULX" ++ "mulxuu\\t%0, %1, %2" ++ [(set_attr "type" "mul")]) ++ ++ ++(define_expand "mulsidi3" ++ [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 0) ++ (mult:SI (match_operand:SI 1 "register_operand" "") ++ (match_operand:SI 2 "register_operand" ""))) ++ (set (subreg:SI (match_dup 0) 4) ++ (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1)) ++ (sign_extend:DI (match_dup 2))) ++ (const_int 32))))] ++ "TARGET_HAS_MULX" ++ "") ++ ++(define_expand "umulsidi3" ++ [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 0) ++ (mult:SI (match_operand:SI 1 "register_operand" "") ++ (match_operand:SI 2 "register_operand" ""))) ++ (set (subreg:SI (match_dup 0) 4) ++ (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1)) ++ (zero_extend:DI (match_dup 2))) ++ (const_int 32))))] ++ "TARGET_HAS_MULX" ++ "") ++ ++ ++ ++;***************************************************************************** ++;* ++;* Negate and ones complement ++;* ++;***************************************************************************** ++ ++(define_insn "negsi2" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (neg:SI (match_operand:SI 1 "register_operand" "r")))] ++ "" ++{ ++ operands[2] = const0_rtx; ++ return "sub\\t%0, %z2, %1"; ++} ++ [(set_attr "type" "alu")]) ++ ++(define_insn "one_cmplsi2" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (not:SI (match_operand:SI 1 "register_operand" "r")))] ++ "" ++{ ++ operands[2] = const0_rtx; ++ return "nor\\t%0, %z2, %1"; ++} ++ [(set_attr "type" "alu")]) ++ ++ ++ ++; Logical Operantions ++ ++(define_insn "andsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r, r,r") ++ (and:SI (match_operand:SI 1 "register_operand" "%r, r,r") ++ (match_operand:SI 2 "logical_operand" "rM,J,K")))] ++ "" ++ "@ ++ and\\t%0, %1, %z2 ++ and%i2\\t%0, %1, %2 ++ andh%i2\\t%0, %1, %U2" ++ [(set_attr "type" "alu")]) ++ ++(define_insn "iorsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r, r,r") ++ (ior:SI (match_operand:SI 1 "register_operand" "%r, r,r") ++ (match_operand:SI 2 "logical_operand" "rM,J,K")))] ++ "" ++ "@ ++ or\\t%0, %1, %z2 ++ or%i2\\t%0, %1, %2 ++ orh%i2\\t%0, %1, %U2" ++ [(set_attr "type" "alu")]) ++ ++(define_insn "*norsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (and:SI (not:SI (match_operand:SI 1 "register_operand" "%r")) ++ (not:SI (match_operand:SI 2 "reg_or_0_operand" "rM"))))] ++ "" ++ "nor\\t%0, %1, %z2" ++ [(set_attr "type" "alu")]) ++ ++(define_insn "xorsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r, r,r") ++ (xor:SI (match_operand:SI 1 "register_operand" "%r, r,r") ++ (match_operand:SI 2 "logical_operand" "rM,J,K")))] ++ "" ++ "@ ++ xor\\t%0, %1, %z2 ++ xor%i2\\t%0, %1, %2 ++ xorh%i2\\t%0, %1, %U2" ++ [(set_attr "type" "alu")]) ++ ++ ++ ++;***************************************************************************** ++;* ++;* Shifts ++;* ++;***************************************************************************** ++ ++(define_insn "ashlsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r,r") ++ (ashift:SI (match_operand:SI 1 "register_operand" "r,r") ++ (match_operand:SI 2 "shift_operand" "r,L")))] ++ "" ++ "sll%i2\\t%0, %1, %z2" ++ [(set_attr "type" "shift")]) ++ ++(define_insn "ashrsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r,r") ++ (ashiftrt:SI (match_operand:SI 1 "register_operand" "r,r") ++ (match_operand:SI 2 "shift_operand" "r,L")))] ++ "" ++ "sra%i2\\t%0, %1, %z2" ++ [(set_attr "type" "shift")]) ++ ++(define_insn "lshrsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r,r") ++ (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r") ++ (match_operand:SI 2 "shift_operand" "r,L")))] ++ "" ++ "srl%i2\\t%0, %1, %z2" ++ [(set_attr "type" "shift")]) ++ ++(define_insn "rotlsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r,r") ++ (rotate:SI (match_operand:SI 1 "register_operand" "r,r") ++ (match_operand:SI 2 "shift_operand" "r,L")))] ++ "" ++ "rol%i2\\t%0, %1, %z2" ++ [(set_attr "type" "shift")]) ++ ++(define_insn "rotrsi3" ++ [(set (match_operand:SI 0 "register_operand" "=r,r") ++ (rotatert:SI (match_operand:SI 1 "register_operand" "r,r") ++ (match_operand:SI 2 "register_operand" "r,r")))] ++ "" ++ "ror\\t%0, %1, %2" ++ [(set_attr "type" "shift")]) ++ ++(define_insn "*shift_mul_constants" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (ashift:SI (mult:SI (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SI 2 "const_int_operand" "I")) ++ (match_operand:SI 3 "const_int_operand" "I")))] ++ "TARGET_HAS_MUL && SMALL_INT (INTVAL (operands[2]) << INTVAL (operands[3]))" ++{ ++ HOST_WIDE_INT mul = INTVAL (operands[2]) << INTVAL (operands[3]); ++ rtx ops[3]; ++ ++ ops[0] = operands[0]; ++ ops[1] = operands[1]; ++ ops[2] = GEN_INT (mul); ++ ++ output_asm_insn ("muli\t%0, %1, %2", ops); ++ return ""; ++} ++ [(set_attr "type" "mul")]) ++ ++ ++ ++ ++;***************************************************************************** ++;* ++;* Prologue, Epilogue and Return ++;* ++;***************************************************************************** ++ ++(define_expand "prologue" ++ [(const_int 1)] ++ "" ++{ ++ expand_prologue (); ++ DONE; ++}) ++ ++(define_expand "epilogue" ++ [(return)] ++ "" ++{ ++ expand_epilogue (false); ++ DONE; ++}) ++ ++(define_expand "sibcall_epilogue" ++ [(return)] ++ "" ++{ ++ expand_epilogue (true); ++ DONE; ++}) ++ ++(define_insn "return" ++ [(return)] ++ "reload_completed && nios2_can_use_return_insn ()" ++ "ret\\t" ++) ++ ++(define_insn "return_from_epilogue" ++ [(use (match_operand 0 "pmode_register_operand" "")) ++ (return)] ++ "reload_completed" ++ "ret\\t" ++) ++ ++;; Block any insns from being moved before this point, since the ++;; profiling call to mcount can use various registers that aren't ++;; saved or used to pass arguments. ++ ++(define_insn "blockage" ++ [(unspec_volatile [(const_int 0)] UNSPEC_BLOCKAGE)] ++ "" ++ "" ++ [(set_attr "type" "unknown") ++ (set_attr "length" "0")]) ++ ++ ++ ++;***************************************************************************** ++;* ++;* Jumps and Calls ++;* ++;***************************************************************************** ++ ++(define_insn "indirect_jump" ++ [(set (pc) (match_operand:SI 0 "register_operand" "r"))] ++ "" ++ "jmp\\t%0" ++ [(set_attr "type" "control")]) ++ ++(define_insn "jump" ++ [(set (pc) ++ (label_ref (match_operand 0 "" "")))] ++ "" ++ "br\\t%0" ++ [(set_attr "type" "control")]) ++ ++ ++(define_insn "indirect_call" ++ [(call (mem:QI (match_operand:SI 0 "register_operand" "r")) ++ (match_operand 1 "" "")) ++ (clobber (reg:SI RA_REGNO))] ++ "" ++ "callr\\t%0" ++ [(set_attr "type" "control")]) ++ ++(define_insn "indirect_call_value" ++ [(set (match_operand 0 "" "") ++ (call (mem:QI (match_operand:SI 1 "register_operand" "r")) ++ (match_operand 2 "" ""))) ++ (clobber (reg:SI RA_REGNO))] ++ "" ++ "callr\\t%1" ++) ++ ++(define_expand "call" ++ [(parallel [(call (match_operand 0 "" "") ++ (match_operand 1 "" "")) ++ (clobber (reg:SI RA_REGNO))])] ++ "" ++ "") ++ ++(define_expand "call_value" ++ [(parallel [(set (match_operand 0 "" "") ++ (call (match_operand 1 "" "") ++ (match_operand 2 "" ""))) ++ (clobber (reg:SI RA_REGNO))])] ++ "" ++ "") ++ ++(define_insn "*call" ++ [(call (mem:QI (match_operand:SI 0 "immediate_operand" "i")) ++ (match_operand 1 "" "")) ++ (clobber (match_operand:SI 2 "register_operand" "=r"))] ++ "" ++ "call\\t%0" ++ [(set_attr "type" "control")]) ++ ++(define_insn "*call_value" ++ [(set (match_operand 0 "" "") ++ (call (mem:QI (match_operand:SI 1 "immediate_operand" "i")) ++ (match_operand 2 "" ""))) ++ (clobber (match_operand:SI 3 "register_operand" "=r"))] ++ "" ++ "call\\t%1" ++ [(set_attr "type" "control")]) ++ ++(define_expand "sibcall" ++ [(parallel [(call (match_operand 0 "" "") ++ (match_operand 1 "" "")) ++ (return) ++ (use (match_operand 2 "" ""))])] ++ "" ++ { ++ XEXP (operands[0], 0) = copy_to_mode_reg (SImode, XEXP (operands[0], 0)); ++ ++ if (operands[2] == NULL_RTX) ++ operands[2] = const0_rtx; ++ } ++) ++ ++(define_expand "sibcall_value" ++ [(parallel [(set (match_operand 0 "" "") ++ (call (match_operand 1 "" "") ++ (match_operand 2 "" ""))) ++ (return) ++ (use (match_operand 3 "" ""))])] ++ "" ++ { ++ XEXP (operands[1], 0) = copy_to_mode_reg (SImode, XEXP (operands[1], 0)); ++ ++ if (operands[3] == NULL_RTX) ++ operands[3] = const0_rtx; ++ } ++) ++ ++(define_insn "sibcall_insn" ++ [(call (mem:QI (match_operand:SI 0 "register_operand" "r")) ++ (match_operand 1 "" "")) ++ (return) ++ (use (match_operand 2 "" ""))] ++ "" ++ "jmp\\t%0" ++) ++ ++(define_insn "sibcall_value_insn" ++ [(set (match_operand 0 "register_operand" "") ++ (call (mem:QI (match_operand:SI 1 "register_operand" "r")) ++ (match_operand 2 "" ""))) ++ (return) ++ (use (match_operand 3 "" ""))] ++ "" ++ "jmp\\t%1" ++) ++ ++ ++ ++ ++(define_expand "tablejump" ++ [(parallel [(set (pc) (match_operand 0 "register_operand" "r")) ++ (use (label_ref (match_operand 1 "" "")))])] ++ "" ++ "" ++) ++ ++(define_insn "*tablejump" ++ [(set (pc) ++ (match_operand:SI 0 "register_operand" "r")) ++ (use (label_ref (match_operand 1 "" "")))] ++ "" ++ "jmp\\t%0" ++ [(set_attr "type" "control")]) ++ ++ ++ ++;***************************************************************************** ++;* ++;* Comparisons ++;* ++;***************************************************************************** ++;; Flow here is rather complex (based on MIPS): ++;; ++;; 1) The cmp{si,di,sf,df} routine is called. It deposits the ++;; arguments into the branch_cmp array, and the type into ++;; branch_type. No RTL is generated. ++;; ++;; 2) The appropriate branch define_expand is called, which then ++;; creates the appropriate RTL for the comparison and branch. ++;; Different CC modes are used, based on what type of branch is ++;; done, so that we can constrain things appropriately. There ++;; are assumptions in the rest of GCC that break if we fold the ++;; operands into the branchs for integer operations, and use cc0 ++;; for floating point, so we use the fp status register instead. ++;; If needed, an appropriate temporary is created to hold the ++;; of the integer compare. ++ ++(define_expand "cmpsi" ++ [(set (cc0) ++ (compare:CC (match_operand:SI 0 "register_operand" "") ++ (match_operand:SI 1 "arith_operand" "")))] ++ "" ++{ ++ branch_cmp[0] = operands[0]; ++ branch_cmp[1] = operands[1]; ++ branch_type = CMP_SI; ++ DONE; ++}) ++ ++(define_expand "tstsi" ++ [(set (cc0) ++ (match_operand:SI 0 "register_operand" ""))] ++ "" ++{ ++ branch_cmp[0] = operands[0]; ++ branch_cmp[1] = const0_rtx; ++ branch_type = CMP_SI; ++ DONE; ++}) ++ ++ ++;***************************************************************************** ++;* ++;* setting a register from a comparison ++;* ++;***************************************************************************** ++ ++(define_expand "seq" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (eq:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (EQ, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*seq" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (eq:SI (match_operand:SI 1 "reg_or_0_operand" "%rM") ++ (match_operand:SI 2 "arith_operand" "rI")))] ++ "" ++ "cmpeq%i2\\t%0, %z1, %z2" ++ [(set_attr "type" "alu")]) ++ ++ ++(define_expand "sne" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (ne:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (NE, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*sne" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (ne:SI (match_operand:SI 1 "reg_or_0_operand" "%rM") ++ (match_operand:SI 2 "arith_operand" "rI")))] ++ "" ++ "cmpne%i2\\t%0, %z1, %z2" ++ [(set_attr "type" "alu")]) ++ ++ ++(define_expand "sgt" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (gt:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (GT, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*sgt" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (gt:SI (match_operand:SI 1 "reg_or_0_operand" "rM") ++ (match_operand:SI 2 "reg_or_0_operand" "rM")))] ++ "" ++ "cmplt\\t%0, %z2, %z1" ++ [(set_attr "type" "alu")]) ++ ++ ++(define_expand "sge" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (ge:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (GE, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*sge" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (ge:SI (match_operand:SI 1 "reg_or_0_operand" "rM") ++ (match_operand:SI 2 "arith_operand" "rI")))] ++ "" ++ "cmpge%i2\\t%0, %z1, %z2" ++ [(set_attr "type" "alu")]) ++ ++(define_expand "sle" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (le:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (LE, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*sle" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (le:SI (match_operand:SI 1 "reg_or_0_operand" "rM") ++ (match_operand:SI 2 "reg_or_0_operand" "rM")))] ++ "" ++ "cmpge\\t%0, %z2, %z1" ++ [(set_attr "type" "alu")]) ++ ++ ++(define_expand "slt" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (lt:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (LT, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*slt" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (lt:SI (match_operand:SI 1 "reg_or_0_operand" "rM") ++ (match_operand:SI 2 "arith_operand" "rI")))] ++ "" ++ "cmplt%i2\\t%0, %z1, %z2" ++ [(set_attr "type" "alu")]) ++ ++ ++(define_expand "sgtu" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (gtu:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (GTU, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*sgtu" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (gtu:SI (match_operand:SI 1 "reg_or_0_operand" "rM") ++ (match_operand:SI 2 "reg_or_0_operand" "rM")))] ++ "" ++ "cmpltu\\t%0, %z2, %z1" ++ [(set_attr "type" "alu")]) ++ ++ ++(define_expand "sgeu" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (geu:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (GEU, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*sgeu" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (geu:SI (match_operand:SI 1 "reg_or_0_operand" "rM") ++ (match_operand:SI 2 "uns_arith_operand" "rJ")))] ++ "" ++ "cmpgeu%i2\\t%0, %z1, %z2" ++ [(set_attr "type" "alu")]) ++ ++(define_expand "sleu" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (leu:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (LEU, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*sleu" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (leu:SI (match_operand:SI 1 "reg_or_0_operand" "rM") ++ (match_operand:SI 2 "reg_or_0_operand" "rM")))] ++ "" ++ "cmpgeu\\t%0, %z2, %z1" ++ [(set_attr "type" "alu")]) ++ ++ ++(define_expand "sltu" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (ltu:SI (match_dup 1) ++ (match_dup 2)))] ++ "" ++{ ++ if (branch_type != CMP_SI) ++ FAIL; ++ ++ /* set up operands from compare. */ ++ operands[1] = branch_cmp[0]; ++ operands[2] = branch_cmp[1]; ++ ++ gen_int_relational (LTU, operands[0], operands[1], operands[2], NULL_RTX); ++ DONE; ++}) ++ ++ ++(define_insn "*sltu" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (ltu:SI (match_operand:SI 1 "reg_or_0_operand" "rM") ++ (match_operand:SI 2 "uns_arith_operand" "rJ")))] ++ "" ++ "cmpltu%i2\\t%0, %z1, %z2" ++ [(set_attr "type" "alu")]) ++ ++ ++ ++ ++;***************************************************************************** ++;* ++;* branches ++;* ++;***************************************************************************** ++ ++(define_insn "*cbranch" ++ [(set (pc) ++ (if_then_else ++ (match_operator:SI 0 "comparison_operator" ++ [(match_operand:SI 2 "reg_or_0_operand" "rM") ++ (match_operand:SI 3 "reg_or_0_operand" "rM")]) ++ (label_ref (match_operand 1 "" "")) ++ (pc)))] ++ "" ++ "b%0\\t%z2, %z3, %l1" ++ [(set_attr "type" "control")]) ++ ++ ++(define_expand "beq" ++ [(set (pc) ++ (if_then_else (eq:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (EQ, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++ ++(define_expand "bne" ++ [(set (pc) ++ (if_then_else (ne:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (NE, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++ ++(define_expand "bgt" ++ [(set (pc) ++ (if_then_else (gt:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (GT, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++(define_expand "bge" ++ [(set (pc) ++ (if_then_else (ge:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (GE, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++(define_expand "ble" ++ [(set (pc) ++ (if_then_else (le:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (LE, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++(define_expand "blt" ++ [(set (pc) ++ (if_then_else (lt:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (LT, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++ ++(define_expand "bgtu" ++ [(set (pc) ++ (if_then_else (gtu:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (GTU, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++(define_expand "bgeu" ++ [(set (pc) ++ (if_then_else (geu:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (GEU, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++(define_expand "bleu" ++ [(set (pc) ++ (if_then_else (leu:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (LEU, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++(define_expand "bltu" ++ [(set (pc) ++ (if_then_else (ltu:CC (cc0) ++ (const_int 0)) ++ (label_ref (match_operand 0 "" "")) ++ (pc)))] ++ "" ++{ ++ gen_int_relational (LTU, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); ++ DONE; ++}) ++ ++ ++;***************************************************************************** ++;* ++;* String and Block Operations ++;* ++;***************************************************************************** ++ ++; ??? This is all really a hack to get Dhrystone to work as fast as possible ++; things to be fixed: ++; * let the compiler core handle all of this, for that to work the extra ++; aliasing needs to be addressed. ++; * we use three temporary registers for loading and storing to ensure no ++; ld use stalls, this is excessive, because after the first ld/st only ++; two are needed. Only two would be needed all the way through if ++; we could schedule with other code. Consider: ++; 1 ld $1, 0($src) ++; 2 ld $2, 4($src) ++; 3 ld $3, 8($src) ++; 4 st $1, 0($dest) ++; 5 ld $1, 12($src) ++; 6 st $2, 4($src) ++; 7 etc. ++; The first store has to wait until 4. If it does not there will be one ++; cycle of stalling. However, if any other instruction could be placed ++; between 1 and 4, $3 would not be needed. ++; * In small we probably don't want to ever do this ourself because there ++; is no ld use stall. ++ ++(define_expand "movstrsi" ++ [(parallel [(set (match_operand:BLK 0 "general_operand" "") ++ (match_operand:BLK 1 "general_operand" "")) ++ (use (match_operand:SI 2 "const_int_operand" "")) ++ (use (match_operand:SI 3 "const_int_operand" "")) ++ (clobber (match_scratch:SI 4 "=&r")) ++ (clobber (match_scratch:SI 5 "=&r")) ++ (clobber (match_scratch:SI 6 "=&r"))])] ++ "TARGET_INLINE_MEMCPY" ++{ ++ rtx ld_addr_reg, st_addr_reg; ++ ++ /* If the predicate for op2 fails in expr.c:emit_block_move_via_movstr ++ it trys to copy to a register, but does not re-try the predicate. ++ ??? Intead of fixing expr.c, I fix it here. */ ++ if (!const_int_operand (operands[2], SImode)) ++ FAIL; ++ ++ /* ??? there are some magic numbers which need to be sorted out here. ++ the basis for them is not increasing code size hugely or going ++ out of range of offset addressing */ ++ if (INTVAL (operands[3]) < 4) ++ FAIL; ++ if (!optimize ++ || (optimize_size && INTVAL (operands[2]) > 12) ++ || (optimize < 3 && INTVAL (operands[2]) > 100) ++ || INTVAL (operands[2]) > 200) ++ FAIL; ++ ++ st_addr_reg ++ = replace_equiv_address (operands[0], ++ copy_to_mode_reg (Pmode, XEXP (operands[0], 0))); ++ ld_addr_reg ++ = replace_equiv_address (operands[1], ++ copy_to_mode_reg (Pmode, XEXP (operands[1], 0))); ++ emit_insn (gen_movstrsi_internal (st_addr_reg, ld_addr_reg, ++ operands[2], operands[3])); ++ ++ DONE; ++}) ++ ++ ++(define_insn "movstrsi_internal" ++ [(set (match_operand:BLK 0 "memory_operand" "=o") ++ (match_operand:BLK 1 "memory_operand" "o")) ++ (use (match_operand:SI 2 "const_int_operand" "i")) ++ (use (match_operand:SI 3 "const_int_operand" "i")) ++ (clobber (match_scratch:SI 4 "=&r")) ++ (clobber (match_scratch:SI 5 "=&r")) ++ (clobber (match_scratch:SI 6 "=&r"))] ++ "TARGET_INLINE_MEMCPY" ++{ ++ int ld_offset = INTVAL (operands[2]); ++ int ld_len = INTVAL (operands[2]); ++ int ld_reg = 0; ++ rtx ld_addr_reg = XEXP (operands[1], 0); ++ int st_offset = INTVAL (operands[2]); ++ int st_len = INTVAL (operands[2]); ++ int st_reg = 0; ++ rtx st_addr_reg = XEXP (operands[0], 0); ++ int delay_count = 0; ++ ++ /* ops[0] is the address used by the insn ++ ops[1] is the register being loaded or stored */ ++ rtx ops[2]; ++ ++ if (INTVAL (operands[3]) < 4) ++ abort (); ++ ++ while (ld_offset >= 4) ++ { ++ /* if the load use delay has been met, I can start ++ storing */ ++ if (delay_count >= 3) ++ { ++ ops[0] = gen_rtx (MEM, SImode, ++ plus_constant (st_addr_reg, st_len - st_offset)); ++ ops[1] = operands[st_reg + 4]; ++ output_asm_insn ("stw\t%1, %0", ops); ++ ++ st_reg = (st_reg + 1) % 3; ++ st_offset -= 4; ++ } ++ ++ ops[0] = gen_rtx (MEM, SImode, ++ plus_constant (ld_addr_reg, ld_len - ld_offset)); ++ ops[1] = operands[ld_reg + 4]; ++ output_asm_insn ("ldw\t%1, %0", ops); ++ ++ ld_reg = (ld_reg + 1) % 3; ++ ld_offset -= 4; ++ delay_count++; ++ } ++ ++ if (ld_offset >= 2) ++ { ++ /* if the load use delay has been met, I can start ++ storing */ ++ if (delay_count >= 3) ++ { ++ ops[0] = gen_rtx (MEM, SImode, ++ plus_constant (st_addr_reg, st_len - st_offset)); ++ ops[1] = operands[st_reg + 4]; ++ output_asm_insn ("stw\t%1, %0", ops); ++ ++ st_reg = (st_reg + 1) % 3; ++ st_offset -= 4; ++ } ++ ++ ops[0] = gen_rtx (MEM, HImode, ++ plus_constant (ld_addr_reg, ld_len - ld_offset)); ++ ops[1] = operands[ld_reg + 4]; ++ output_asm_insn ("ldh\t%1, %0", ops); ++ ++ ld_reg = (ld_reg + 1) % 3; ++ ld_offset -= 2; ++ delay_count++; ++ } ++ ++ if (ld_offset >= 1) ++ { ++ /* if the load use delay has been met, I can start ++ storing */ ++ if (delay_count >= 3) ++ { ++ ops[0] = gen_rtx (MEM, SImode, ++ plus_constant (st_addr_reg, st_len - st_offset)); ++ ops[1] = operands[st_reg + 4]; ++ output_asm_insn ("stw\t%1, %0", ops); ++ ++ st_reg = (st_reg + 1) % 3; ++ st_offset -= 4; ++ } ++ ++ ops[0] = gen_rtx (MEM, QImode, ++ plus_constant (ld_addr_reg, ld_len - ld_offset)); ++ ops[1] = operands[ld_reg + 4]; ++ output_asm_insn ("ldb\t%1, %0", ops); ++ ++ ld_reg = (ld_reg + 1) % 3; ++ ld_offset -= 1; ++ delay_count++; ++ } ++ ++ while (st_offset >= 4) ++ { ++ ops[0] = gen_rtx (MEM, SImode, ++ plus_constant (st_addr_reg, st_len - st_offset)); ++ ops[1] = operands[st_reg + 4]; ++ output_asm_insn ("stw\t%1, %0", ops); ++ ++ st_reg = (st_reg + 1) % 3; ++ st_offset -= 4; ++ } ++ ++ while (st_offset >= 2) ++ { ++ ops[0] = gen_rtx (MEM, HImode, ++ plus_constant (st_addr_reg, st_len - st_offset)); ++ ops[1] = operands[st_reg + 4]; ++ output_asm_insn ("sth\t%1, %0", ops); ++ ++ st_reg = (st_reg + 1) % 3; ++ st_offset -= 2; ++ } ++ ++ while (st_offset >= 1) ++ { ++ ops[0] = gen_rtx (MEM, QImode, ++ plus_constant (st_addr_reg, st_len - st_offset)); ++ ops[1] = operands[st_reg + 4]; ++ output_asm_insn ("stb\t%1, %0", ops); ++ ++ st_reg = (st_reg + 1) % 3; ++ st_offset -= 1; ++ } ++ ++ return ""; ++} ++; ??? lengths are not being used yet, but I will probably forget ++; to update this once I am using lengths, so set it to something ++; definetely big enough to cover it. 400 allows for 200 bytes ++; of motion. ++ [(set_attr "length" "400")]) ++ ++ ++ ++;***************************************************************************** ++;* ++;* Custom instructions ++;* ++;***************************************************************************** ++ ++(define_constants [ ++ (CUSTOM_N 100) ++ (CUSTOM_NI 101) ++ (CUSTOM_NF 102) ++ (CUSTOM_NP 103) ++ (CUSTOM_NII 104) ++ (CUSTOM_NIF 105) ++ (CUSTOM_NIP 106) ++ (CUSTOM_NFI 107) ++ (CUSTOM_NFF 108) ++ (CUSTOM_NFP 109) ++ (CUSTOM_NPI 110) ++ (CUSTOM_NPF 111) ++ (CUSTOM_NPP 112) ++ (CUSTOM_IN 113) ++ (CUSTOM_INI 114) ++ (CUSTOM_INF 115) ++ (CUSTOM_INP 116) ++ (CUSTOM_INII 117) ++ (CUSTOM_INIF 118) ++ (CUSTOM_INIP 119) ++ (CUSTOM_INFI 120) ++ (CUSTOM_INFF 121) ++ (CUSTOM_INFP 122) ++ (CUSTOM_INPI 123) ++ (CUSTOM_INPF 124) ++ (CUSTOM_INPP 125) ++ (CUSTOM_FN 126) ++ (CUSTOM_FNI 127) ++ (CUSTOM_FNF 128) ++ (CUSTOM_FNP 129) ++ (CUSTOM_FNII 130) ++ (CUSTOM_FNIF 131) ++ (CUSTOM_FNIP 132) ++ (CUSTOM_FNFI 133) ++ (CUSTOM_FNFF 134) ++ (CUSTOM_FNFP 135) ++ (CUSTOM_FNPI 136) ++ (CUSTOM_FNPF 137) ++ (CUSTOM_FNPP 138) ++ (CUSTOM_PN 139) ++ (CUSTOM_PNI 140) ++ (CUSTOM_PNF 141) ++ (CUSTOM_PNP 142) ++ (CUSTOM_PNII 143) ++ (CUSTOM_PNIF 144) ++ (CUSTOM_PNIP 145) ++ (CUSTOM_PNFI 146) ++ (CUSTOM_PNFF 147) ++ (CUSTOM_PNFP 148) ++ (CUSTOM_PNPI 149) ++ (CUSTOM_PNPF 150) ++ (CUSTOM_PNPP 151) ++]) ++ ++ ++(define_insn "custom_n" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N")] CUSTOM_N)] ++ "" ++ "custom\\t%0, zero, zero, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_ni" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SI 1 "register_operand" "r")] CUSTOM_NI)] ++ "" ++ "custom\\t%0, zero, %1, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_nf" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SF 1 "register_operand" "r")] CUSTOM_NF)] ++ "" ++ "custom\\t%0, zero, %1, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_np" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SI 1 "register_operand" "r")] CUSTOM_NP)] ++ "" ++ "custom\\t%0, zero, %1, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_nii" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_NII)] ++ "" ++ "custom\\t%0, zero, %1, %2" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_nif" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SF 2 "register_operand" "r")] CUSTOM_NIF)] ++ "" ++ "custom\\t%0, zero, %1, %2" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_nip" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_NIP)] ++ "" ++ "custom\\t%0, zero, %1, %2" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_nfi" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SF 1 "register_operand" "r") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_NFI)] ++ "" ++ "custom\\t%0, zero, %1, %2" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_nff" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SF 1 "register_operand" "r") ++ (match_operand:SF 2 "register_operand" "r")] CUSTOM_NFF)] ++ "" ++ "custom\\t%0, zero, %1, %2" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_nfp" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SF 1 "register_operand" "r") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_NFP)] ++ "" ++ "custom\\t%0, zero, %1, %2" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_npi" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_NPI)] ++ "" ++ "custom\\t%0, zero, %1, %2" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_npf" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SF 2 "register_operand" "r")] CUSTOM_NPF)] ++ "" ++ "custom\\t%0, zero, %1, %2" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_npp" ++ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") ++ (match_operand:SI 1 "register_operand" "r") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_NPP)] ++ "" ++ "custom\\t%0, zero, %1, %2" ++ [(set_attr "type" "custom")]) ++ ++ ++ ++(define_insn "custom_in" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N")] CUSTOM_IN))] ++ "" ++ "custom\\t%1, %0, zero, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_ini" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_INI))] ++ "" ++ "custom\\t%1, %0, %2, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_inf" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r")] CUSTOM_INF))] ++ "" ++ "custom\\t%1, %0, %2, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_inp" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_INP))] ++ "" ++ "custom\\t%1, %0, %2, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_inii" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_INII))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_inif" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SF 3 "register_operand" "r")] CUSTOM_INIF))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_inip" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_INIP))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_infi" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_INFI))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_inff" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r") ++ (match_operand:SF 3 "register_operand" "r")] CUSTOM_INFF))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_infp" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_INFP))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_inpi" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_INPI))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_inpf" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SF 3 "register_operand" "r")] CUSTOM_INPF))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_inpp" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_INPP))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++ ++ ++ ++ ++(define_insn "custom_fn" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N")] CUSTOM_FN))] ++ "" ++ "custom\\t%1, %0, zero, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fni" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_FNI))] ++ "" ++ "custom\\t%1, %0, %2, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnf" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r")] CUSTOM_FNF))] ++ "" ++ "custom\\t%1, %0, %2, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnp" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_FNP))] ++ "" ++ "custom\\t%1, %0, %2, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnii" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_FNII))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnif" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SF 3 "register_operand" "r")] CUSTOM_FNIF))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnip" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_FNIP))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnfi" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_FNFI))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnff" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r") ++ (match_operand:SF 3 "register_operand" "r")] CUSTOM_FNFF))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnfp" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_FNFP))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnpi" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_FNPI))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnpf" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SF 3 "register_operand" "r")] CUSTOM_FNPF))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_fnpp" ++ [(set (match_operand:SF 0 "register_operand" "=r") ++ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_FNPP))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++ ++ ++(define_insn "custom_pn" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N")] CUSTOM_PN))] ++ "" ++ "custom\\t%1, %0, zero, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pni" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_PNI))] ++ "" ++ "custom\\t%1, %0, %2, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnf" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r")] CUSTOM_PNF))] ++ "" ++ "custom\\t%1, %0, %2, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnp" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r")] CUSTOM_PNP))] ++ "" ++ "custom\\t%1, %0, %2, zero" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnii" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_PNII))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnif" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SF 3 "register_operand" "r")] CUSTOM_PNIF))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnip" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_PNIP))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnfi" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_PNFI))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnff" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r") ++ (match_operand:SF 3 "register_operand" "r")] CUSTOM_PNFF))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnfp" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SF 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_PNFP))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnpi" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_PNPI))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnpf" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SF 3 "register_operand" "r")] CUSTOM_PNPF))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++(define_insn "custom_pnpp" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") ++ (match_operand:SI 2 "register_operand" "r") ++ (match_operand:SI 3 "register_operand" "r")] CUSTOM_PNPP))] ++ "" ++ "custom\\t%1, %0, %2, %3" ++ [(set_attr "type" "custom")]) ++ ++ ++ ++ ++ ++ ++;***************************************************************************** ++;* ++;* Misc ++;* ++;***************************************************************************** ++ ++(define_insn "nop" ++ [(const_int 0)] ++ "" ++ "nop\\t" ++ [(set_attr "type" "alu")]) ++ ++(define_insn "sync" ++ [(unspec_volatile [(const_int 0)] UNSPEC_SYNC)] ++ "" ++ "sync\\t" ++ [(set_attr "type" "control")]) ++ ++ ++(define_insn "rdctl" ++ [(set (match_operand:SI 0 "register_operand" "=r") ++ (unspec_volatile:SI [(match_operand:SI 1 "rdwrctl_operand" "O")] UNSPEC_RDCTL))] ++ "" ++ "rdctl\\t%0, ctl%1" ++ [(set_attr "type" "control")]) ++ ++(define_insn "wrctl" ++ [(unspec_volatile:SI [(match_operand:SI 0 "rdwrctl_operand" "O") ++ (match_operand:SI 1 "register_operand" "r")] UNSPEC_WRCTL)] ++ "" ++ "wrctl\\tctl%0, %1" ++ [(set_attr "type" "control")]) ++ ++ ++ ++;***************************************************************************** ++;* ++;* Peepholes ++;* ++;***************************************************************************** ++ ++ +diff -durN gcc-3.4.6.orig/gcc/config/nios2/nios2-protos.h gcc-3.4.6/gcc/config/nios2/nios2-protos.h +--- gcc-3.4.6.orig/gcc/config/nios2/nios2-protos.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/gcc/config/nios2/nios2-protos.h 2007-08-15 23:09:36.000000000 +0200 +@@ -0,0 +1,70 @@ ++/* Subroutines for assembler code output for Altera NIOS 2G NIOS2 version. ++ Copyright (C) 2003 Altera ++ Contributed by Jonah Graham (jgraham@altera.com). ++ ++This file is part of GNU CC. ++ ++GNU CC is free software; you can redistribute it and/or modify ++it under the terms of the GNU General Public License as published by ++the Free Software Foundation; either version 2, or (at your option) ++any later version. ++ ++GNU CC is distributed in the hope that it will be useful, ++but WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++GNU General Public License for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GNU CC; see the file COPYING. If not, write to ++the Free Software Foundation, 59 Temple Place - Suite 330, ++Boston, MA 02111-1307, USA. */ ++ ++extern void dump_frame_size (FILE *); ++extern HOST_WIDE_INT compute_frame_size (void); ++extern int nios2_initial_elimination_offset (int, int); ++extern void override_options (void); ++extern void optimization_options (int, int); ++extern int nios2_can_use_return_insn (void); ++extern void expand_prologue (void); ++extern void expand_epilogue (bool); ++extern void function_profiler (FILE *, int); ++ ++ ++#ifdef RTX_CODE ++extern int nios2_legitimate_address (rtx, enum machine_mode, int); ++extern void nios2_print_operand (FILE *, rtx, int); ++extern void nios2_print_operand_address (FILE *, rtx); ++ ++extern int nios2_emit_move_sequence (rtx *, enum machine_mode); ++extern int nios2_emit_expensive_div (rtx *, enum machine_mode); ++ ++extern void gen_int_relational (enum rtx_code, rtx, rtx, rtx, rtx); ++extern void gen_conditional_move (rtx *, enum machine_mode); ++extern const char *asm_output_opcode (FILE *, const char *); ++ ++/* predicates */ ++extern int arith_operand (rtx, enum machine_mode); ++extern int uns_arith_operand (rtx, enum machine_mode); ++extern int logical_operand (rtx, enum machine_mode); ++extern int shift_operand (rtx, enum machine_mode); ++extern int reg_or_0_operand (rtx, enum machine_mode); ++extern int equality_op (rtx, enum machine_mode); ++extern int custom_insn_opcode (rtx, enum machine_mode); ++extern int rdwrctl_operand (rtx, enum machine_mode); ++ ++# ifdef HAVE_MACHINE_MODES ++# if defined TREE_CODE ++extern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree, int); ++extern rtx function_arg (const CUMULATIVE_ARGS *, enum machine_mode, tree, int); ++extern int function_arg_partial_nregs (const CUMULATIVE_ARGS *, enum machine_mode, tree, int); ++extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, int); ++extern int nios2_setup_incoming_varargs (const CUMULATIVE_ARGS *, enum machine_mode, tree, int); ++ ++# endif /* TREE_CODE */ ++# endif /* HAVE_MACHINE_MODES */ ++#endif ++ ++#ifdef TREE_CODE ++extern int nios2_return_in_memory (tree); ++ ++#endif /* TREE_CODE */ +diff -durN gcc-3.4.6.orig/gcc/config/nios2/t-nios2 gcc-3.4.6/gcc/config/nios2/t-nios2 +--- gcc-3.4.6.orig/gcc/config/nios2/t-nios2 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-3.4.6/gcc/config/nios2/t-nios2 2007-08-15 23:09:36.000000000 +0200 +@@ -0,0 +1,123 @@ ++## ++## Compiler flags to use when compiling libgcc2.c. ++## ++## LIB2FUNCS_EXTRA ++## A list of source file names to be compiled or assembled and inserted into libgcc.a. ++ ++LIB2FUNCS_EXTRA=$(srcdir)/config/nios2/lib2-divmod.c \ ++ $(srcdir)/config/nios2/lib2-divmod-hi.c \ ++ $(srcdir)/config/nios2/lib2-divtable.c \ ++ $(srcdir)/config/nios2/lib2-mul.c ++ ++## ++## Floating Point Emulation ++## To have GCC include software floating point libraries in libgcc.a define FPBIT ++## and DPBIT along with a few rules as follows: ++## ++## # We want fine grained libraries, so use the new code ++## # to build the floating point emulation libraries. ++FPBIT=$(srcdir)/config/nios2/nios2-fp-bit.c ++DPBIT=$(srcdir)/config/nios2/nios2-dp-bit.c ++ ++TARGET_LIBGCC2_CFLAGS = -O2 ++ ++# FLOAT_ONLY - no doubles ++# SMALL_MACHINE - QI/HI is faster than SI ++# Actually SMALL_MACHINE uses chars and shorts instead of ints ++# since ints (16-bit ones as they are today) are at least as fast ++# as chars and shorts, don't define SMALL_MACHINE ++# CMPtype - type returned by FP compare, i.e. INT (hard coded in fp-bit - see code ) ++ ++$(FPBIT): $(srcdir)/config/fp-bit.c Makefile ++ echo '#define FLOAT' > ${FPBIT} ++ cat $(srcdir)/config/fp-bit.c >> ${FPBIT} ++ ++$(DPBIT): $(srcdir)/config/fp-bit.c Makefile ++ echo '' > ${DPBIT} ++ cat $(srcdir)/config/fp-bit.c >> ${DPBIT} ++ ++EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o ++ ++# Assemble startup files. ++$(T)crti.o: $(srcdir)/config/nios2/crti.asm $(GCC_PASSES) ++ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ ++ -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/nios2/crti.asm ++ ++$(T)crtn.o: $(srcdir)/config/nios2/crtn.asm $(GCC_PASSES) ++ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ ++ -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/nios2/crtn.asm ++ ++ ++## You may need to provide additional #defines at the beginning of ++## fp-bit.c and dp-bit.c to control target endianness and other options ++## ++## CRTSTUFF_T_CFLAGS ++## Special flags used when compiling crtstuff.c. See Initialization. ++## ++## CRTSTUFF_T_CFLAGS_S ++## Special flags used when compiling crtstuff.c for shared linking. Used ++## if you use crtbeginS.o and crtendS.o in EXTRA-PARTS. See Initialization. ++## ++## MULTILIB_OPTIONS ++## For some targets, invoking GCC in different ways produces objects that ++## can not be linked together. For example, for some targets GCC produces ++## both big and little endian code. For these targets, you must arrange ++## for multiple versions of libgcc.a to be compiled, one for each set of ++## incompatible options. When GCC invokes the linker, it arranges to link ++## in the right version of libgcc.a, based on the command line options ++## used. ++## The MULTILIB_OPTIONS macro lists the set of options for which special ++## versions of libgcc.a must be built. Write options that are mutually ++## incompatible side by side, separated by a slash. Write options that may ++## be used together separated by a space. The build procedure will build ++## all combinations of compatible options. ++## ++## For example, if you set MULTILIB_OPTIONS to m68000/m68020 msoft-float, ++## Makefile will build special versions of libgcc.a using the following ++## sets of options: -m68000, -m68020, -msoft-float, -m68000 -msoft-float, ++## and -m68020 -msoft-float. ++ ++MULTILIB_OPTIONS = mno-hw-mul mhw-mulx ++ ++## MULTILIB_DIRNAMES ++## If MULTILIB_OPTIONS is used, this variable specifies the directory names ++## that should be used to hold the various libraries. Write one element in ++## MULTILIB_DIRNAMES for each element in MULTILIB_OPTIONS. If ++## MULTILIB_DIRNAMES is not used, the default value will be ++## MULTILIB_OPTIONS, with all slashes treated as spaces. ++## For example, if MULTILIB_OPTIONS is set to m68000/m68020 msoft-float, ++## then the default value of MULTILIB_DIRNAMES is m68000 m68020 ++## msoft-float. You may specify a different value if you desire a ++## different set of directory names. ++ ++# MULTILIB_DIRNAMES = ++ ++## MULTILIB_MATCHES ++## Sometimes the same option may be written in two different ways. If an ++## option is listed in MULTILIB_OPTIONS, GCC needs to know about any ++## synonyms. In that case, set MULTILIB_MATCHES to a list of items of the ++## form option=option to describe all relevant synonyms. For example, ++## m68000=mc68000 m68020=mc68020. ++## ++## MULTILIB_EXCEPTIONS ++## Sometimes when there are multiple sets of MULTILIB_OPTIONS being ++## specified, there are combinations that should not be built. In that ++## case, set MULTILIB_EXCEPTIONS to be all of the switch exceptions in ++## shell case syntax that should not be built. ++## For example, in the PowerPC embedded ABI support, it is not desirable to ++## build libraries compiled with the -mcall-aix option and either of the ++## -fleading-underscore or -mlittle options at the same time. Therefore ++## MULTILIB_EXCEPTIONS is set to ++## ++## *mcall-aix/*fleading-underscore* *mlittle/*mcall-aix* ++## ++ ++MULTILIB_EXCEPTIONS = *mno-hw-mul/*mhw-mulx* ++ ++## ++## MULTILIB_EXTRA_OPTS Sometimes it is desirable that when building ++## multiple versions of libgcc.a certain options should always be passed on ++## to the compiler. In that case, set MULTILIB_EXTRA_OPTS to be the list ++## of options to be used for all builds. ++## ++ +diff -durN gcc-3.4.6.orig/gcc/config.gcc gcc-3.4.6/gcc/config.gcc +--- gcc-3.4.6.orig/gcc/config.gcc 2007-08-15 23:07:00.000000000 +0200 ++++ gcc-3.4.6/gcc/config.gcc 2007-08-15 23:09:36.000000000 +0200 +@@ -1342,6 +1342,10 @@ + thread_file='posix' + fi + ;; ++# JBG ++nios2-*-* | nios2-*-*) ++ tm_file="elfos.h ${tm_file}" ++ ;; + # m68hc11 and m68hc12 share the same machine description. + m68hc11-*-*|m6811-*-*) + tm_file="dbxelf.h elfos.h m68hc11/m68hc11.h" +diff -durN gcc-3.4.6.orig/gcc/cse.c gcc-3.4.6/gcc/cse.c +--- gcc-3.4.6.orig/gcc/cse.c 2005-12-31 01:39:42.000000000 +0100 ++++ gcc-3.4.6/gcc/cse.c 2007-08-15 23:09:36.000000000 +0200 +@@ -3134,6 +3134,10 @@ + #ifdef FLOAT_STORE_FLAG_VALUE + REAL_VALUE_TYPE fsfv; + #endif ++#ifdef __nios2__ ++ if (p->is_const) ++ break; ++#endif + + /* If the entry isn't valid, skip it. */ + if (! exp_equiv_p (p->exp, p->exp, 1, 0)) +diff -durN gcc-3.4.6.orig/gcc/doc/extend.texi gcc-3.4.6/gcc/doc/extend.texi +--- gcc-3.4.6.orig/gcc/doc/extend.texi 2005-02-26 23:17:26.000000000 +0100 ++++ gcc-3.4.6/gcc/doc/extend.texi 2007-08-15 23:09:36.000000000 +0200 +@@ -5638,12 +5638,118 @@ + instructions, but allow the compiler to schedule those calls. + + @menu ++* Altera Nios II Built-in Functions:: + * Alpha Built-in Functions:: + * ARM Built-in Functions:: + * X86 Built-in Functions:: + * PowerPC AltiVec Built-in Functions:: + @end menu + ++@node Altera Nios II Built-in Functions ++@subsection Altera Nios II Built-in Functions ++ ++These built-in functions are available for the Altera Nios II ++family of processors. ++ ++The following built-in functions are always available. They ++all generate the machine instruction that is part of the name. ++ ++@example ++int __builtin_ldbio (volatile const void *) ++int __builtin_ldbuio (volatile const void *) ++int __builtin_ldhio (volatile const void *) ++int __builtin_ldhuio (volatile const void *) ++int __builtin_ldwio (volatile const void *) ++void __builtin_stbio (volatile void *, int) ++void __builtin_sthio (volatile void *, int) ++void __builtin_stwio (volatile void *, int) ++void __builtin_sync (void) ++int __builtin_rdctl (int) ++void __builtin_wrctl (int, int) ++@end example ++ ++The following built-in functions are always available. They ++all generate a Nios II Custom Instruction. The name of the ++function represents the types that the function takes and ++returns. The letter before the @code{n} is the return type ++or void if absent. The @code{n} represnts the first parameter ++to all the custom instructions, the custom instruction number. ++The two letters after the @code{n} represent the up to two ++parameters to the function. ++ ++The letters reprsent the following data types: ++@table @code ++@item ++@code{void} for return type and no parameter for parameter types. ++ ++@item i ++@code{int} for return type and parameter type ++ ++@item f ++@code{float} for return type and parameter type ++ ++@item p ++@code{void *} for return type and parameter type ++ ++@end table ++ ++And the function names are: ++@example ++void __builtin_custom_n (void) ++void __builtin_custom_ni (int) ++void __builtin_custom_nf (float) ++void __builtin_custom_np (void *) ++void __builtin_custom_nii (int, int) ++void __builtin_custom_nif (int, float) ++void __builtin_custom_nip (int, void *) ++void __builtin_custom_nfi (float, int) ++void __builtin_custom_nff (float, float) ++void __builtin_custom_nfp (float, void *) ++void __builtin_custom_npi (void *, int) ++void __builtin_custom_npf (void *, float) ++void __builtin_custom_npp (void *, void *) ++int __builtin_custom_in (void) ++int __builtin_custom_ini (int) ++int __builtin_custom_inf (float) ++int __builtin_custom_inp (void *) ++int __builtin_custom_inii (int, int) ++int __builtin_custom_inif (int, float) ++int __builtin_custom_inip (int, void *) ++int __builtin_custom_infi (float, int) ++int __builtin_custom_inff (float, float) ++int __builtin_custom_infp (float, void *) ++int __builtin_custom_inpi (void *, int) ++int __builtin_custom_inpf (void *, float) ++int __builtin_custom_inpp (void *, void *) ++float __builtin_custom_fn (void) ++float __builtin_custom_fni (int) ++float __builtin_custom_fnf (float) ++float __builtin_custom_fnp (void *) ++float __builtin_custom_fnii (int, int) ++float __builtin_custom_fnif (int, float) ++float __builtin_custom_fnip (int, void *) ++float __builtin_custom_fnfi (float, int) ++float __builtin_custom_fnff (float, float) ++float __builtin_custom_fnfp (float, void *) ++float __builtin_custom_fnpi (void *, int) ++float __builtin_custom_fnpf (void *, float) ++float __builtin_custom_fnpp (void *, void *) ++void * __builtin_custom_pn (void) ++void * __builtin_custom_pni (int) ++void * __builtin_custom_pnf (float) ++void * __builtin_custom_pnp (void *) ++void * __builtin_custom_pnii (int, int) ++void * __builtin_custom_pnif (int, float) ++void * __builtin_custom_pnip (int, void *) ++void * __builtin_custom_pnfi (float, int) ++void * __builtin_custom_pnff (float, float) ++void * __builtin_custom_pnfp (float, void *) ++void * __builtin_custom_pnpi (void *, int) ++void * __builtin_custom_pnpf (void *, float) ++void * __builtin_custom_pnpp (void *, void *) ++@end example ++ ++ + @node Alpha Built-in Functions + @subsection Alpha Built-in Functions + +diff -durN gcc-3.4.6.orig/gcc/doc/invoke.texi gcc-3.4.6/gcc/doc/invoke.texi +--- gcc-3.4.6.orig/gcc/doc/invoke.texi 2005-10-08 02:22:20.000000000 +0200 ++++ gcc-3.4.6/gcc/doc/invoke.texi 2007-08-15 23:09:36.000000000 +0200 +@@ -337,6 +337,14 @@ + @item Machine Dependent Options + @xref{Submodel Options,,Hardware Models and Configurations}. + ++@emph{Altera Nios II Options} ++@gccoptlist{-msmallc -mno-bypass-cache -mbypass-cache @gol ++-mno-cache-volatile -mcache-volatile -mno-inline-memcpy @gol ++-minline-memcpy -mno-fast-sw-div -mfast-sw-div @gol ++-mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx @gol ++-mno-hw-div -mhw-div @gol ++-msys-crt0= -msys-lib= -msys=nosys } ++ + @emph{M680x0 Options} + @gccoptlist{-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol + -m68060 -mcpu32 -m5200 -m68881 -mbitfield -mc68000 -mc68020 @gol +@@ -5839,6 +5847,7 @@ + that macro, which enables you to change the defaults. + + @menu ++* Altera Nios II Options:: + * M680x0 Options:: + * M68hc1x Options:: + * VAX Options:: +@@ -5874,6 +5883,103 @@ + * FRV Options:: + @end menu + ++ ++@node Altera Nios II Options ++@subsection Altera Nios II Options ++@cindex Altera Nios II options ++ ++These are the @samp{-m} options defined for the Altera Nios II ++processor. ++ ++@table @gcctabopt ++ ++@item -msmallc ++@opindex msmallc ++ ++Link with a limited version of the C library, -lsmallc. For more ++information see the C Library Documentation. ++ ++ ++@item -mbypass-cache ++@itemx -mno-bypass-cache ++@opindex mno-bypass-cache ++@opindex mbypass-cache ++ ++Force all load and store instructions to always bypass cache by ++using io variants of the instructions. The default is to not ++bypass the cache. ++ ++@item -mno-cache-volatile ++@itemx -mcache-volatile ++@opindex mcache-volatile ++@opindex mno-cache-volatile ++ ++Volatile memory access bypass the cache using the io variants of ++the ld and st instructions. The default is to cache volatile ++accesses. ++ ++-mno-cache-volatile is deprecated and will be deleted in a ++future GCC release. ++ ++ ++@item -mno-inline-memcpy ++@itemx -minline-memcpy ++@opindex mno-inline-memcpy ++@opindex minline-memcpy ++ ++Do not inline memcpy. The default is to inline when -O is on. ++ ++ ++@item -mno-fast-sw-div ++@itemx -mfast-sw-div ++@opindex mno-fast-sw-div ++@opindex mfast-sw-div ++ ++Do no use table based fast divide for small numbers. The default ++is to use the fast divide at -O3 and above. ++ ++ ++@item -mno-hw-mul ++@itemx -mhw-mul ++@itemx -mno-hw-mulx ++@itemx -mhw-mulx ++@itemx -mno-hw-div ++@itemx -mhw-div ++@opindex mno-hw-mul ++@opindex mhw-mul ++@opindex mno-hw-mulx ++@opindex mhw-mulx ++@opindex mno-hw-div ++@opindex mhw-div ++ ++Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of ++instructions by the compiler. The default is to emit @code{mul} ++and not emit @code{div} and @code{mulx}. ++ ++The different combinations of @code{mul} and @code{mulx} instructions ++generate a different multilib options. ++ ++ ++@item -msys-crt0=@var{startfile} ++@opindex msys-crt0 ++ ++@var{startfile} is the file name of the startfile (crt0) to use ++when linking. The default is crt0.o that comes with libgloss ++and is only suitable for use with the instruction set ++simulator. ++ ++@item -msys-lib=@var{systemlib} ++@itemx -msys-lib=nosys ++@opindex msys-lib ++ ++@var{systemlib} is the library name of the library which provides ++the system calls required by the C library, e.g. @code{read}, @code{write} ++etc. The default is to use nosys, this library provides ++stub implementations of the calls and is part of libgloss. ++ ++@end table ++ ++ + @node M680x0 Options + @subsection M680x0 Options + @cindex M680x0 options +diff -durN gcc-3.4.6.orig/gcc/doc/md.texi gcc-3.4.6/gcc/doc/md.texi +--- gcc-3.4.6.orig/gcc/doc/md.texi 2004-11-13 23:31:42.000000000 +0100 ++++ gcc-3.4.6/gcc/doc/md.texi 2007-08-15 23:09:36.000000000 +0200 +@@ -1337,6 +1337,49 @@ + available on some particular machines. + + @table @emph ++ ++@item Altera Nios II family---@file{nios2.h} ++@table @code ++ ++@item I ++Integer that is valid as an immediate operand in an ++instruction taking a signed 16-bit number. Range ++@minus{}32768 to 32767. ++ ++@item J ++Integer that is valid as an immediate operand in an ++instruction taking an unsigned 16-bit number. Range ++0 to 65535. ++ ++@item K ++Integer that is valid as an immediate operand in an ++instruction taking only the upper 16-bits of a ++32-bit number. Range 32-bit numbers with the lower ++16-bits being 0. ++ ++@item L ++Integer that is valid as an immediate operand for a ++shift instruction. Range 0 to 31. ++ ++ ++@item M ++Integer that is valid as an immediate operand for ++only the value 0. Can be used in conjunction with ++the format modifier @code{z} to use @code{r0} ++instead of @code{0} in the assembly output. ++ ++@item N ++Integer that is valid as an immediate operand for ++a custom instruction opcode. Range 0 to 255. ++ ++@item S ++Matches immediates which are addresses in the small ++data section and therefore can be added to @code{gp} ++as a 16-bit immediate to re-create their 32-bit value. ++ ++@end table ++ ++ + @item ARM family---@file{arm.h} + @table @code + @item f +diff -durN gcc-3.4.6.orig/gcc/Makefile.in gcc-3.4.6/gcc/Makefile.in +--- gcc-3.4.6.orig/gcc/Makefile.in 2005-02-24 10:26:59.000000000 +0100 ++++ gcc-3.4.6/gcc/Makefile.in 2007-08-15 23:09:36.000000000 +0200 +@@ -3094,7 +3094,7 @@ + $(INSTALL_DATA) $(srcdir)/README-fixinc \ + $(DESTDIR)$(itoolsdatadir)/include/README ; \ + $(INSTALL_SCRIPT) fixinc.sh $(DESTDIR)$(itoolsdir)/fixinc.sh ; \ +- $(INSTALL_PROGRAM) fixinc/fixincl $(DESTDIR)$(itoolsdir)/fixincl ; \ ++ $(INSTALL_PROGRAM) fixinc/fixincl$(build_exeext) $(DESTDIR)$(itoolsdir)/fixincl$(build_exeext) ; \ + $(INSTALL_DATA) $(srcdir)/gsyslimits.h \ + $(DESTDIR)$(itoolsdatadir)/gsyslimits.h ; \ + else :; fi diff --git a/patches/gcc/3.4.6/260-arm-softfloat.patch b/patches/gcc/3.4.6/260-arm-softfloat.patch new file mode 100644 index 0000000..b0ef614 --- /dev/null +++ b/patches/gcc/3.4.6/260-arm-softfloat.patch @@ -0,0 +1,161 @@ +diff -durN gcc-3.4.6.orig/gcc/config/arm/coff.h gcc-3.4.6/gcc/config/arm/coff.h +--- gcc-3.4.6.orig/gcc/config/arm/coff.h 2004-02-24 15:25:22.000000000 +0100 ++++ gcc-3.4.6/gcc/config/arm/coff.h 2007-08-15 23:10:54.000000000 +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 -durN gcc-3.4.6.orig/gcc/config/arm/elf.h gcc-3.4.6/gcc/config/arm/elf.h +--- gcc-3.4.6.orig/gcc/config/arm/elf.h 2004-02-24 15:25:22.000000000 +0100 ++++ gcc-3.4.6/gcc/config/arm/elf.h 2007-08-15 23:10:54.000000000 +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 -durN gcc-3.4.6.orig/gcc/config/arm/linux-elf.h gcc-3.4.6/gcc/config/arm/linux-elf.h +--- gcc-3.4.6.orig/gcc/config/arm/linux-elf.h 2007-08-15 23:07:00.000000000 +0200 ++++ gcc-3.4.6/gcc/config/arm/linux-elf.h 2007-08-15 23:10:54.000000000 +0200 +@@ -44,12 +44,26 @@ + #define TARGET_LINKER_EMULATION "armelf_linux" + #endif + +-/* Default is to use APCS-32 mode. */ ++/* ++ * Default is to use APCS-32 mode with soft-vfp. ++ * The old Linux default for floats can be achieved with -mhard-float ++ * or with the configure --with-float=hard option. ++ * If -msoft-float or --with-float=soft is used then software float ++ * support will be used just like the default but with the legacy ++ * big endian word ordering for double float representation instead. ++ */ + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT \ +- ( ARM_FLAG_APCS_32 | \ +- ARM_FLAG_MMU_TRAPS | \ +- TARGET_ENDIAN_DEFAULT ) ++#define TARGET_DEFAULT \ ++ ( ARM_FLAG_APCS_32 \ ++ | ARM_FLAG_SOFT_FLOAT \ ++ | TARGET_ENDIAN_DEFAULT \ ++ | ARM_FLAG_VFP \ ++ | ARM_FLAG_MMU_TRAPS ) ++ ++#undef SUBTARGET_EXTRA_ASM_SPEC ++#define SUBTARGET_EXTRA_ASM_SPEC "\ ++%{mhard-float:-mfpu=fpa} \ ++%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}" + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +@@ -57,7 +71,7 @@ + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mapcs-32", "mno-thumb-interwork" } + + #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" + +@@ -72,7 +86,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add + the GNU/Linux magical crtbegin.o file (see crtstuff.c) which +diff -durN gcc-3.4.6.orig/gcc/config/arm/t-linux gcc-3.4.6/gcc/config/arm/t-linux +--- gcc-3.4.6.orig/gcc/config/arm/t-linux 2003-09-20 23:09:07.000000000 +0200 ++++ gcc-3.4.6/gcc/config/arm/t-linux 2007-08-15 23:10:54.000000000 +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 -durN gcc-3.4.6.orig/gcc/config/arm/unknown-elf.h gcc-3.4.6/gcc/config/arm/unknown-elf.h +--- gcc-3.4.6.orig/gcc/config/arm/unknown-elf.h 2004-02-24 15:25:22.000000000 +0100 ++++ gcc-3.4.6/gcc/config/arm/unknown-elf.h 2007-08-15 23:10:54.000000000 +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 -durN gcc-3.4.6.orig/gcc/config/arm/xscale-elf.h gcc-3.4.6/gcc/config/arm/xscale-elf.h +--- gcc-3.4.6.orig/gcc/config/arm/xscale-elf.h 2003-07-02 01:26:43.000000000 +0200 ++++ gcc-3.4.6/gcc/config/arm/xscale-elf.h 2007-08-15 23:10:54.000000000 +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/patches/gcc/3.4.6/300-libstdc++-pic.patch b/patches/gcc/3.4.6/300-libstdc++-pic.patch deleted file mode 100644 index 2b55a47..0000000 --- a/patches/gcc/3.4.6/300-libstdc++-pic.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff -durN gcc-3.4.6.orig/libstdc++-v3/src/Makefile.am gcc-3.4.6/libstdc++-v3/src/Makefile.am ---- gcc-3.4.6.orig/libstdc++-v3/src/Makefile.am 2004-04-16 21:08:35.000000000 +0200 -+++ gcc-3.4.6/libstdc++-v3/src/Makefile.am 2007-08-15 22:52:23.000000000 +0200 -@@ -210,6 +210,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 -diff -durN gcc-3.4.6.orig/libstdc++-v3/src/Makefile.in gcc-3.4.6/libstdc++-v3/src/Makefile.in ---- gcc-3.4.6.orig/libstdc++-v3/src/Makefile.in 2004-04-16 21:08:35.000000000 +0200 -+++ gcc-3.4.6/libstdc++-v3/src/Makefile.in 2007-08-15 22:52:23.000000000 +0200 -@@ -592,7 +592,7 @@ - - install-data-am: install-data-local - --install-exec-am: install-toolexeclibLTLIBRARIES -+install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local - - install-info: install-info-am - -@@ -625,6 +625,7 @@ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-data-local \ - install-exec install-exec-am install-info install-info-am \ -+ install-exec-local \ - install-man install-strip install-toolexeclibLTLIBRARIES \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ -@@ -709,6 +710,11 @@ - install_debug: - (cd ${debugdir} && $(MAKE) \ - toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) -+ -+install-exec-local: -+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) -+ - # Tell versions [3.59,3.63) of GNU make to not export all variables. - # Otherwise a system limit (for SysV at least) may be exceeded. - .NOEXPORT: diff --git a/patches/gcc/3.4.6/304-index_macro.patch b/patches/gcc/3.4.6/304-index_macro.patch deleted file mode 100644 index 6f4d57a..0000000 --- a/patches/gcc/3.4.6/304-index_macro.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff -durN gcc-3.4.6.orig/libstdc++-v3/include/ext/rope gcc-3.4.6/libstdc++-v3/include/ext/rope ---- gcc-3.4.6.orig/libstdc++-v3/include/ext/rope 2005-01-16 23:08:43.000000000 +0100 -+++ gcc-3.4.6/libstdc++-v3/include/ext/rope 2007-08-15 22:53:37.000000000 +0200 -@@ -58,6 +58,9 @@ - #include - #include - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - # ifdef __GC - # define __GC_CONST const - # else -diff -durN gcc-3.4.6.orig/libstdc++-v3/include/ext/ropeimpl.h gcc-3.4.6/libstdc++-v3/include/ext/ropeimpl.h ---- gcc-3.4.6.orig/libstdc++-v3/include/ext/ropeimpl.h 2004-09-08 15:36:04.000000000 +0200 -+++ gcc-3.4.6/libstdc++-v3/include/ext/ropeimpl.h 2007-08-15 22:53:37.000000000 +0200 -@@ -53,6 +53,9 @@ - #include // For uninitialized_copy_n - #include // For power - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - namespace __gnu_cxx - { - using std::size_t; diff --git a/patches/gcc/3.4.6/600-arm-ldm-peephole.patch b/patches/gcc/3.4.6/600-arm-ldm-peephole.patch deleted file mode 100644 index 81a0ac8..0000000 --- a/patches/gcc/3.4.6/600-arm-ldm-peephole.patch +++ /dev/null @@ -1,68 +0,0 @@ -diff -durN gcc-3.4.6.orig/gcc/config/arm/arm.c gcc-3.4.6/gcc/config/arm/arm.c ---- gcc-3.4.6.orig/gcc/config/arm/arm.c 2005-10-01 15:31:38.000000000 +0200 -+++ gcc-3.4.6/gcc/config/arm/arm.c 2007-08-15 22:54:59.000000000 +0200 -@@ -4857,6 +4857,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 +5088,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 -durN gcc-3.4.6.orig/gcc/config/arm/arm.md gcc-3.4.6/gcc/config/arm/arm.md ---- gcc-3.4.6.orig/gcc/config/arm/arm.md 2005-10-01 15:31:38.000000000 +0200 -+++ gcc-3.4.6/gcc/config/arm/arm.md 2007-08-15 22:54:59.000000000 +0200 -@@ -8811,13 +8811,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]; -@@ -8852,6 +8855,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); -diff -durN gcc-3.4.6.orig/gcc/genpeep.c gcc-3.4.6/gcc/genpeep.c ---- gcc-3.4.6.orig/gcc/genpeep.c 2003-07-05 07:27:22.000000000 +0200 -+++ gcc-3.4.6/gcc/genpeep.c 2007-08-15 22:54:59.000000000 +0200 -@@ -381,6 +381,7 @@ - printf ("#include \"recog.h\"\n"); - printf ("#include \"except.h\"\n\n"); - printf ("#include \"function.h\"\n\n"); -+ printf ("#include \"flags.h\"\n\n"); - - printf ("#ifdef HAVE_peephole\n"); - printf ("extern rtx peep_operand[];\n\n"); diff --git a/patches/gcc/3.4.6/601-arm-ldm.patch b/patches/gcc/3.4.6/601-arm-ldm.patch deleted file mode 100644 index 18ea493..0000000 --- a/patches/gcc/3.4.6/601-arm-ldm.patch +++ /dev/null @@ -1,120 +0,0 @@ -diff -durN gcc-3.4.6.orig/gcc/config/arm/arm.c gcc-3.4.6/gcc/config/arm/arm.c ---- gcc-3.4.6.orig/gcc/config/arm/arm.c 2007-08-15 22:56:20.000000000 +0200 -+++ gcc-3.4.6/gcc/config/arm/arm.c 2007-08-15 22:56:20.000000000 +0200 -@@ -8524,6 +8524,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) - { -@@ -8757,27 +8777,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) -@@ -11405,22 +11445,6 @@ - } - } - --/* Return the number (counting from 0) of -- the least significant set bit in MASK. */ -- --inline static int --number_of_first_bit_set (int mask) --{ -- int bit; -- -- for (bit = 0; -- (mask & (1 << bit)) == 0; -- ++bit) -- continue; -- -- return bit; --} -- - /* Generate code to return from a thumb function. - If 'reg_containing_return_addr' is -1, then the return address is - actually on the stack, at the stack pointer. */ diff --git a/patches/gcc/3.4.6/602-arm-ldm-peephole2.patch b/patches/gcc/3.4.6/602-arm-ldm-peephole2.patch deleted file mode 100644 index 395c516..0000000 --- a/patches/gcc/3.4.6/602-arm-ldm-peephole2.patch +++ /dev/null @@ -1,32 +0,0 @@ -diff -durN gcc-3.4.6.orig/gcc/config/arm/arm.c gcc-3.4.6/gcc/config/arm/arm.c ---- gcc-3.4.6.orig/gcc/config/arm/arm.c 2007-08-15 22:57:51.000000000 +0200 -+++ gcc-3.4.6/gcc/config/arm/arm.c 2007-08-15 22:57:51.000000000 +0200 -@@ -4572,6 +4572,10 @@ - int - adjacent_mem_locations (rtx a, rtx b) - { -+ /* We don't guarantee to preserve the order of these memory refs. */ -+ if (volatile_refs_p (a) || volatile_refs_p (b)) -+ return 0; -+ - if ((GET_CODE (XEXP (a, 0)) == REG - || (GET_CODE (XEXP (a, 0)) == PLUS - && GET_CODE (XEXP (XEXP (a, 0), 1)) == CONST_INT)) -@@ -4611,6 +4615,17 @@ - return 0; - - val_diff = val1 - val0; -+ -+ if (arm_ld_sched) -+ { -+ /* If the target has load delay slots, then there's no benefit -+ to using an ldm instruction unless the offset is zero and -+ we are optimizing for size. */ -+ return (optimize_size && (REGNO (reg0) == REGNO (reg1)) -+ && (val0 == 0 || val1 == 0 || val0 == 4 || val1 == 4) -+ && (val_diff == 4 || val_diff == -4)); -+ } -+ - return ((REGNO (reg0) == REGNO (reg1)) - && (val_diff == 4 || val_diff == -4)); - } diff --git a/patches/gcc/3.4.6/602-sdk-libstdc++-includes.patch b/patches/gcc/3.4.6/602-sdk-libstdc++-includes.patch deleted file mode 100644 index f599b59..0000000 --- a/patches/gcc/3.4.6/602-sdk-libstdc++-includes.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -durN gcc-3.4.6.orig/libstdc++-v3/fragment.am gcc-3.4.6/libstdc++-v3/fragment.am ---- gcc-3.4.6.orig/libstdc++-v3/fragment.am 2003-08-27 02:38:28.000000000 +0200 -+++ gcc-3.4.6/libstdc++-v3/fragment.am 2007-08-15 22:59:09.000000000 +0200 -@@ -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 -durN gcc-3.4.6.orig/libstdc++-v3/libmath/Makefile.am gcc-3.4.6/libstdc++-v3/libmath/Makefile.am ---- gcc-3.4.6.orig/libstdc++-v3/libmath/Makefile.am 2003-08-27 23:29:43.000000000 +0200 -+++ gcc-3.4.6/libstdc++-v3/libmath/Makefile.am 2007-08-15 22:59:09.000000000 +0200 -@@ -32,7 +32,7 @@ - - libmath_la_SOURCES = stubs.c - --AM_CPPFLAGS = $(CANADIAN_INCLUDES) -+AM_CPPFLAGS = $(CANADIAN_INCLUDES) -I$(toplevel_srcdir)/include - - # Only compiling "C" sources in this directory. - LIBTOOL = @LIBTOOL@ --tag CC diff --git a/patches/gcc/3.4.6/700-pr15068-fix.patch b/patches/gcc/3.4.6/700-pr15068-fix.patch deleted file mode 100644 index 308f35b..0000000 --- a/patches/gcc/3.4.6/700-pr15068-fix.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff -durN gcc-3.4.6.orig/gcc/flow.c gcc-3.4.6/gcc/flow.c ---- gcc-3.4.6.orig/gcc/flow.c 2005-09-01 22:51:09.000000000 +0200 -+++ gcc-3.4.6/gcc/flow.c 2007-08-15 23:00:30.000000000 +0200 -@@ -1884,6 +1884,7 @@ - rtx set_src = SET_SRC (pc_set (BB_END (bb))); - rtx cond_true = XEXP (set_src, 0); - rtx reg = XEXP (cond_true, 0); -+ enum rtx_code inv_cond; - - if (GET_CODE (reg) == SUBREG) - reg = SUBREG_REG (reg); -@@ -1892,11 +1893,13 @@ - in the form of a comparison of a register against zero. - If the condition is more complex than that, then it is safe - not to record any information. */ -- if (GET_CODE (reg) == REG -+ inv_cond = reversed_comparison_code (cond_true, BB_END (bb)); -+ if (inv_cond != UNKNOWN -+ && GET_CODE (reg) == REG - && XEXP (cond_true, 1) == const0_rtx) - { - rtx cond_false -- = gen_rtx_fmt_ee (reverse_condition (GET_CODE (cond_true)), -+ = gen_rtx_fmt_ee (inv_cond, - GET_MODE (cond_true), XEXP (cond_true, 0), - XEXP (cond_true, 1)); - if (GET_CODE (XEXP (set_src, 1)) == PC) diff --git a/patches/gcc/3.4.6/710-all_sh-pr16665-fix.patch b/patches/gcc/3.4.6/710-all_sh-pr16665-fix.patch deleted file mode 100644 index 7297fca..0000000 --- a/patches/gcc/3.4.6/710-all_sh-pr16665-fix.patch +++ /dev/null @@ -1,44 +0,0 @@ -diff -durN gcc-3.4.6.orig/gcc/config/sh/sh.c gcc-3.4.6/gcc/config/sh/sh.c ---- gcc-3.4.6.orig/gcc/config/sh/sh.c 2004-09-03 08:51:30.000000000 +0200 -+++ gcc-3.4.6/gcc/config/sh/sh.c 2007-08-15 23:01:48.000000000 +0200 -@@ -9107,6 +9107,15 @@ - } - this = FUNCTION_ARG (cum, Pmode, ptr_type_node, 1); - -+ /* In PIC case, we set PIC register to compute the target address. We -+ can use a scratch register to save and restore the original value -+ except for SHcompact. For SHcompact, use stack. */ -+ if (flag_pic && TARGET_SHCOMPACT) -+ { -+ push (PIC_OFFSET_TABLE_REGNUM); -+ emit_insn (gen_GOTaddr2picreg ()); -+ } -+ - /* For SHcompact, we only have r0 for a scratch register: r1 is the - static chain pointer (even if you can't have nested virtual functions - right now, someone might implement them sometime), and the rest of the -@@ -9189,8 +9198,24 @@ - assemble_external (function); - TREE_USED (function) = 1; - } -+ /* We can use scratch1 to save and restore the original value of -+ PIC register except for SHcompact. */ -+ if (flag_pic && ! TARGET_SHCOMPACT) -+ { -+ emit_move_insn (scratch1, -+ gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM)); -+ emit_insn (gen_GOTaddr2picreg ()); -+ } - funexp = XEXP (DECL_RTL (function), 0); - emit_move_insn (scratch2, funexp); -+ if (flag_pic) -+ { -+ if (! TARGET_SHCOMPACT) -+ emit_move_insn (gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM), -+ scratch1); -+ else -+ pop (PIC_OFFSET_TABLE_REGNUM); -+ } - funexp = gen_rtx_MEM (FUNCTION_MODE, scratch2); - sibcall = emit_call_insn (gen_sibcall (funexp, const0_rtx, NULL_RTX)); - SIBLING_CALL_P (sibcall) = 1; diff --git a/patches/gcc/3.4.6/720-all_sh-no-reorder-blocks.patch b/patches/gcc/3.4.6/720-all_sh-no-reorder-blocks.patch deleted file mode 100644 index fed1424..0000000 --- a/patches/gcc/3.4.6/720-all_sh-no-reorder-blocks.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -durN gcc-3.4.6.orig/gcc/config/sh/sh.h gcc-3.4.6/gcc/config/sh/sh.h ---- gcc-3.4.6.orig/gcc/config/sh/sh.h 2006-01-12 02:20:32.000000000 +0100 -+++ gcc-3.4.6/gcc/config/sh/sh.h 2007-08-15 23:03:09.000000000 +0200 -@@ -422,6 +422,10 @@ - do { \ - if (LEVEL) \ - flag_omit_frame_pointer = -1; \ -+ if (LEVEL <= 2) \ -+ { \ -+ flag_reorder_blocks = 0; \ -+ } \ - if (SIZE) \ - target_flags |= SPACE_BIT; \ - if (TARGET_SHMEDIA && LEVEL > 1) \ diff --git a/patches/gcc/3.4.6/730-all_sh-pr20617.patch b/patches/gcc/3.4.6/730-all_sh-pr20617.patch deleted file mode 100644 index 80d0d90..0000000 --- a/patches/gcc/3.4.6/730-all_sh-pr20617.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -durN gcc-3.4.6.orig/gcc/config/sh/lib1funcs.asm gcc-3.4.6/gcc/config/sh/lib1funcs.asm ---- gcc-3.4.6.orig/gcc/config/sh/lib1funcs.asm 2003-08-12 03:25:07.000000000 +0200 -+++ gcc-3.4.6/gcc/config/sh/lib1funcs.asm 2007-08-15 23:04:26.000000000 +0200 -@@ -37,9 +37,19 @@ - ELF local label prefixes by J"orn Rennecke - amylaar@cygnus.com */ - -+#define ALIAS(X,Y) .global GLOBAL(X); .set GLOBAL(X),GLOBAL(Y) -+ - #ifdef __ELF__ - #define LOCAL(X) .L_##X --#define FUNC(X) .type X,@function -+ -+#if 1 /* ??? The export list mechanism is broken, everything that is not -+ hidden is exported. */ -+#undef FUNC -+#define FUNC(X) .type X,@function; .hidden X -+#undef ALIAS -+#define ALIAS(X,Y) .global GLOBAL(X); .set GLOBAL(X),GLOBAL(Y); .hidden GLOBAL(X) -+#endif -+ - #define ENDFUNC0(X) .Lfe_##X: .size X,.Lfe_##X-X - #define ENDFUNC(X) ENDFUNC0(X) - #else diff --git a/patches/gcc/3.4.6/800-arm-bigendian.patch b/patches/gcc/3.4.6/800-arm-bigendian.patch deleted file mode 100644 index bb27636..0000000 --- a/patches/gcc/3.4.6/800-arm-bigendian.patch +++ /dev/null @@ -1,65 +0,0 @@ -diff -durN gcc-3.4.6.orig/gcc/config/arm/linux-elf.h gcc-3.4.6/gcc/config/arm/linux-elf.h ---- gcc-3.4.6.orig/gcc/config/arm/linux-elf.h 2007-08-15 22:51:01.000000000 +0200 -+++ gcc-3.4.6/gcc/config/arm/linux-elf.h 2007-08-15 23:05:42.000000000 +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__" - -@@ -94,7 +111,7 @@ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "} \ - -X \ -- %{mbig-endian:-EB}" \ -+ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ - SUBTARGET_EXTRA_LINK_SPEC - - #define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS() -diff -durN gcc-3.4.6.orig/gcc/config.gcc gcc-3.4.6/gcc/config.gcc ---- gcc-3.4.6.orig/gcc/config.gcc 2007-08-15 22:51:01.000000000 +0200 -+++ gcc-3.4.6/gcc/config.gcc 2007-08-15 23:05:42.000000000 +0200 -@@ -678,6 +678,11 @@ - ;; - arm*-*-linux*) # ARM GNU/Linux with ELF - tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h" -+ case $target in -+ arm*b-*) -+ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" -+ ;; -+ esac - tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - gnu_ld=yes diff --git a/patches/gcc/3.4.6/800-powerpc-libc_stack_end-uclibc.patch b/patches/gcc/3.4.6/800-powerpc-libc_stack_end-uclibc.patch deleted file mode 100644 index 941974e..0000000 --- a/patches/gcc/3.4.6/800-powerpc-libc_stack_end-uclibc.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff -durN gcc-3.4.6.orig/gcc/config/rs6000/linux-unwind.h gcc-3.4.6/gcc/config/rs6000/linux-unwind.h ---- gcc-3.4.6.orig/gcc/config/rs6000/linux-unwind.h 2005-03-17 11:41:18.000000000 +0100 -+++ gcc-3.4.6/gcc/config/rs6000/linux-unwind.h 2007-08-15 23:07:00.000000000 +0200 -@@ -32,6 +32,7 @@ - these structs elsewhere; Many fields are missing, particularly - from the end of the structures. */ - -+#ifndef inhibit_libc - struct gcc_vregs - { - __attribute__ ((vector_size (16))) int vr[32]; -@@ -320,3 +321,4 @@ - \ - goto SUCCESS; \ - } while (0) -+#endif diff --git a/patches/gcc/3.4.6/810-mips-xgot.patch b/patches/gcc/3.4.6/810-mips-xgot.patch deleted file mode 100644 index e294670..0000000 --- a/patches/gcc/3.4.6/810-mips-xgot.patch +++ /dev/null @@ -1,7 +0,0 @@ -diff -durN gcc-3.4.6.orig/gcc/config/mips/t-linux gcc-3.4.6/gcc/config/mips/t-linux ---- gcc-3.4.6.orig/gcc/config/mips/t-linux 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/gcc/config/mips/t-linux 2007-08-15 23:08:15.000000000 +0200 -@@ -0,0 +1,3 @@ -+# Compile crtbegin/end with xgot so it works for both -+# normal and large GOTs. -+CRTSTUFF_T_CFLAGS = -mxgot diff --git a/patches/gcc/3.4.6/900-nios2.patch b/patches/gcc/3.4.6/900-nios2.patch deleted file mode 100644 index 5f0cc14..0000000 --- a/patches/gcc/3.4.6/900-nios2.patch +++ /dev/null @@ -1,10231 +0,0 @@ -diff -durN gcc-3.4.6.orig/gcc/combine.c gcc-3.4.6/gcc/combine.c ---- gcc-3.4.6.orig/gcc/combine.c 2005-08-08 20:41:04.000000000 +0200 -+++ gcc-3.4.6/gcc/combine.c 2007-08-15 23:09:36.000000000 +0200 -@@ -4381,6 +4381,14 @@ - mode); - } - -+#ifndef __nios2__ -+/* This screws up Nios II in this test case: -+ -+if (x & 1) -+ return 2; -+else -+ return 3; -+*/ - else if (STORE_FLAG_VALUE == 1 - && new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT - && op1 == const0_rtx -@@ -4392,6 +4400,7 @@ - gen_lowpart_for_combine (mode, op0), - const1_rtx); - } -+#endif - - else if (STORE_FLAG_VALUE == 1 - && new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT -diff -durN gcc-3.4.6.orig/gcc/config/nios2/crti.asm gcc-3.4.6/gcc/config/nios2/crti.asm ---- gcc-3.4.6.orig/gcc/config/nios2/crti.asm 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/gcc/config/nios2/crti.asm 2007-08-15 23:09:36.000000000 +0200 -@@ -0,0 +1,88 @@ -+/* -+ Copyright (C) 2003 -+ by Jonah Graham (jgraham@altera.com) -+ -+This file is free software; you can redistribute it and/or modify it -+under the terms of the GNU General Public License as published by the -+Free Software Foundation; either version 2, or (at your option) any -+later version. -+ -+In addition to the permissions in the GNU General Public License, the -+Free Software Foundation gives you unlimited permission to link the -+compiled version of this file with other programs, and to distribute -+those programs without any restriction coming from the use of this -+file. (The General Public License restrictions do apply in other -+respects; for example, they cover modification of the file, and -+distribution when not linked into another program.) -+ -+This file is distributed in the hope that it will be useful, but -+WITHOUT ANY WARRANTY; without even the implied warranty of -+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+General Public License for more details. -+ -+You should have received a copy of the GNU General Public License -+along with this program; see the file COPYING. If not, write to -+the Free Software Foundation, 59 Temple Place - Suite 330, -+Boston, MA 02111-1307, USA. -+ -+ As a special exception, if you link this library with files -+ compiled with GCC to produce an executable, this does not cause -+ the resulting executable to be covered by the GNU General Public License. -+ This exception does not however invalidate any other reasons why -+ the executable file might be covered by the GNU General Public License. -+ -+ -+This file just make a stack frame for the contents of the .fini and -+.init sections. Users may put any desired instructions in those -+sections. -+ -+ -+While technically any code can be put in the init and fini sections -+most stuff will not work other than stuff which obeys the call frame -+and ABI. All the call-preserved registers are saved, the call clobbered -+registers should have been saved by the code calling init and fini. -+ -+See crtstuff.c for an example of code that inserts itself in the -+init and fini sections. -+ -+See crt0.s for the code that calls init and fini. -+*/ -+ -+ .file "crti.asm" -+ -+ .section ".init" -+ .align 2 -+ .global _init -+_init: -+ addi sp, sp, -48 -+ stw ra, 44(sp) -+ stw r23, 40(sp) -+ stw r22, 36(sp) -+ stw r21, 32(sp) -+ stw r20, 28(sp) -+ stw r19, 24(sp) -+ stw r18, 20(sp) -+ stw r17, 16(sp) -+ stw r16, 12(sp) -+ stw fp, 8(sp) -+ mov fp, sp -+ -+ -+ .section ".fini" -+ .align 2 -+ .global _fini -+_fini: -+ addi sp, sp, -48 -+ stw ra, 44(sp) -+ stw r23, 40(sp) -+ stw r22, 36(sp) -+ stw r21, 32(sp) -+ stw r20, 28(sp) -+ stw r19, 24(sp) -+ stw r18, 20(sp) -+ stw r17, 16(sp) -+ stw r16, 12(sp) -+ stw fp, 8(sp) -+ mov fp, sp -+ -+ -diff -durN gcc-3.4.6.orig/gcc/config/nios2/crtn.asm gcc-3.4.6/gcc/config/nios2/crtn.asm ---- gcc-3.4.6.orig/gcc/config/nios2/crtn.asm 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/gcc/config/nios2/crtn.asm 2007-08-15 23:09:36.000000000 +0200 -@@ -0,0 +1,70 @@ -+/* -+ Copyright (C) 2003 -+ by Jonah Graham (jgraham@altera.com) -+ -+This file is free software; you can redistribute it and/or modify it -+under the terms of the GNU General Public License as published by the -+Free Software Foundation; either version 2, or (at your option) any -+later version. -+ -+In addition to the permissions in the GNU General Public License, the -+Free Software Foundation gives you unlimited permission to link the -+compiled version of this file with other programs, and to distribute -+those programs without any restriction coming from the use of this -+file. (The General Public License restrictions do apply in other -+respects; for example, they cover modification of the file, and -+distribution when not linked into another program.) -+ -+This file is distributed in the hope that it will be useful, but -+WITHOUT ANY WARRANTY; without even the implied warranty of -+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+General Public License for more details. -+ -+You should have received a copy of the GNU General Public License -+along with this program; see the file COPYING. If not, write to -+the Free Software Foundation, 59 Temple Place - Suite 330, -+Boston, MA 02111-1307, USA. -+ -+ As a special exception, if you link this library with files -+ compiled with GCC to produce an executable, this does not cause -+ the resulting executable to be covered by the GNU General Public License. -+ This exception does not however invalidate any other reasons why -+ the executable file might be covered by the GNU General Public License. -+ -+ -+This file just makes sure that the .fini and .init sections do in -+fact return. Users may put any desired instructions in those sections. -+This file is the last thing linked into any executable. -+*/ -+ .file "crtn.asm" -+ -+ -+ -+ .section ".init" -+ ldw ra, 44(sp) -+ ldw r23, 40(sp) -+ ldw r22, 36(sp) -+ ldw r21, 32(sp) -+ ldw r20, 28(sp) -+ ldw r19, 24(sp) -+ ldw r18, 20(sp) -+ ldw r17, 16(sp) -+ ldw r16, 12(sp) -+ ldw fp, 8(sp) -+ addi sp, sp, -48 -+ ret -+ -+ .section ".fini" -+ ldw ra, 44(sp) -+ ldw r23, 40(sp) -+ ldw r22, 36(sp) -+ ldw r21, 32(sp) -+ ldw r20, 28(sp) -+ ldw r19, 24(sp) -+ ldw r18, 20(sp) -+ ldw r17, 16(sp) -+ ldw r16, 12(sp) -+ ldw fp, 8(sp) -+ addi sp, sp, -48 -+ ret -+ -diff -durN gcc-3.4.6.orig/gcc/config/nios2/lib2-divmod.c gcc-3.4.6/gcc/config/nios2/lib2-divmod.c ---- gcc-3.4.6.orig/gcc/config/nios2/lib2-divmod.c 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/gcc/config/nios2/lib2-divmod.c 2007-08-15 23:09:36.000000000 +0200 -@@ -0,0 +1,126 @@ -+ -+/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is -+ supposedly valid even though this is a "target" file. */ -+#include "auto-host.h" -+ -+ -+#include "tconfig.h" -+#include "tsystem.h" -+#include "coretypes.h" -+#include "tm.h" -+ -+ -+/* Don't use `fancy_abort' here even if config.h says to use it. */ -+#ifdef abort -+#undef abort -+#endif -+ -+ -+#ifdef HAVE_GAS_HIDDEN -+#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden"))) -+#else -+#define ATTRIBUTE_HIDDEN -+#endif -+ -+#include "libgcc2.h" -+ -+extern SItype __modsi3 (SItype, SItype); -+extern SItype __divsi3 (SItype, SItype); -+extern SItype __umodsi3 (SItype, SItype); -+extern SItype __udivsi3 (SItype, SItype); -+ -+static USItype udivmodsi4(USItype, USItype, word_type); -+ -+/* 16-bit SI divide and modulo as used in NIOS */ -+ -+ -+static USItype -+udivmodsi4(USItype num, USItype den, word_type modwanted) -+{ -+ USItype bit = 1; -+ USItype res = 0; -+ -+ while (den < num && bit && !(den & (1L<<31))) -+ { -+ den <<=1; -+ bit <<=1; -+ } -+ while (bit) -+ { -+ if (num >= den) -+ { -+ num -= den; -+ res |= bit; -+ } -+ bit >>=1; -+ den >>=1; -+ } -+ if (modwanted) return num; -+ return res; -+} -+ -+ -+SItype -+__divsi3 (SItype a, SItype b) -+{ -+ word_type neg = 0; -+ SItype res; -+ -+ if (a < 0) -+ { -+ a = -a; -+ neg = !neg; -+ } -+ -+ if (b < 0) -+ { -+ b = -b; -+ neg = !neg; -+ } -+ -+ res = udivmodsi4 (a, b, 0); -+ -+ if (neg) -+ res = -res; -+ -+ return res; -+} -+ -+ -+SItype -+__modsi3 (SItype a, SItype b) -+{ -+ word_type neg = 0; -+ SItype res; -+ -+ if (a < 0) -+ { -+ a = -a; -+ neg = 1; -+ } -+ -+ if (b < 0) -+ b = -b; -+ -+ res = udivmodsi4 (a, b, 1); -+ -+ if (neg) -+ res = -res; -+ -+ return res; -+} -+ -+ -+SItype -+__udivsi3 (SItype a, SItype b) -+{ -+ return udivmodsi4 (a, b, 0); -+} -+ -+ -+SItype -+__umodsi3 (SItype a, SItype b) -+{ -+ return udivmodsi4 (a, b, 1); -+} -+ -diff -durN gcc-3.4.6.orig/gcc/config/nios2/lib2-divmod-hi.c gcc-3.4.6/gcc/config/nios2/lib2-divmod-hi.c ---- gcc-3.4.6.orig/gcc/config/nios2/lib2-divmod-hi.c 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/gcc/config/nios2/lib2-divmod-hi.c 2007-08-15 23:09:36.000000000 +0200 -@@ -0,0 +1,123 @@ -+ -+/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is -+ supposedly valid even though this is a "target" file. */ -+#include "auto-host.h" -+ -+ -+#include "tconfig.h" -+#include "tsystem.h" -+#include "coretypes.h" -+#include "tm.h" -+ -+ -+/* Don't use `fancy_abort' here even if config.h says to use it. */ -+#ifdef abort -+#undef abort -+#endif -+ -+ -+#ifdef HAVE_GAS_HIDDEN -+#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden"))) -+#else -+#define ATTRIBUTE_HIDDEN -+#endif -+ -+#include "libgcc2.h" -+ -+extern HItype __modhi3 (HItype, HItype); -+extern HItype __divhi3 (HItype, HItype); -+extern HItype __umodhi3 (HItype, HItype); -+extern HItype __udivhi3 (HItype, HItype); -+ -+static UHItype udivmodhi4(UHItype, UHItype, word_type); -+ -+static UHItype -+udivmodhi4(UHItype num, UHItype den, word_type modwanted) -+{ -+ UHItype bit = 1; -+ UHItype res = 0; -+ -+ while (den < num && bit && !(den & (1L<<15))) -+ { -+ den <<=1; -+ bit <<=1; -+ } -+ while (bit) -+ { -+ if (num >= den) -+ { -+ num -= den; -+ res |= bit; -+ } -+ bit >>=1; -+ den >>=1; -+ } -+ if (modwanted) return num; -+ return res; -+} -+ -+ -+HItype -+__divhi3 (HItype a, HItype b) -+{ -+ word_type neg = 0; -+ HItype res; -+ -+ if (a < 0) -+ { -+ a = -a; -+ neg = !neg; -+ } -+ -+ if (b < 0) -+ { -+ b = -b; -+ neg = !neg; -+ } -+ -+ res = udivmodhi4 (a, b, 0); -+ -+ if (neg) -+ res = -res; -+ -+ return res; -+} -+ -+ -+HItype -+__modhi3 (HItype a, HItype b) -+{ -+ word_type neg = 0; -+ HItype res; -+ -+ if (a < 0) -+ { -+ a = -a; -+ neg = 1; -+ } -+ -+ if (b < 0) -+ b = -b; -+ -+ res = udivmodhi4 (a, b, 1); -+ -+ if (neg) -+ res = -res; -+ -+ return res; -+} -+ -+ -+HItype -+__udivhi3 (HItype a, HItype b) -+{ -+ return udivmodhi4 (a, b, 0); -+} -+ -+ -+HItype -+__umodhi3 (HItype a, HItype b) -+{ -+ return udivmodhi4 (a, b, 1); -+} -+ -diff -durN gcc-3.4.6.orig/gcc/config/nios2/lib2-divtable.c gcc-3.4.6/gcc/config/nios2/lib2-divtable.c ---- gcc-3.4.6.orig/gcc/config/nios2/lib2-divtable.c 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/gcc/config/nios2/lib2-divtable.c 2007-08-15 23:09:36.000000000 +0200 -@@ -0,0 +1,46 @@ -+ -+/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is -+ supposedly valid even though this is a "target" file. */ -+#include "auto-host.h" -+ -+ -+#include "tconfig.h" -+#include "tsystem.h" -+#include "coretypes.h" -+#include "tm.h" -+ -+ -+/* Don't use `fancy_abort' here even if config.h says to use it. */ -+#ifdef abort -+#undef abort -+#endif -+ -+ -+#ifdef HAVE_GAS_HIDDEN -+#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden"))) -+#else -+#define ATTRIBUTE_HIDDEN -+#endif -+ -+#include "libgcc2.h" -+ -+UQItype __divsi3_table[] = -+{ -+ 0, 0/1, 0/2, 0/3, 0/4, 0/5, 0/6, 0/7, 0/8, 0/9, 0/10, 0/11, 0/12, 0/13, 0/14, 0/15, -+ 0, 1/1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10, 1/11, 1/12, 1/13, 1/14, 1/15, -+ 0, 2/1, 2/2, 2/3, 2/4, 2/5, 2/6, 2/7, 2/8, 2/9, 2/10, 2/11, 2/12, 2/13, 2/14, 2/15, -+ 0, 3/1, 3/2, 3/3, 3/4, 3/5, 3/6, 3/7, 3/8, 3/9, 3/10, 3/11, 3/12, 3/13, 3/14, 3/15, -+ 0, 4/1, 4/2, 4/3, 4/4, 4/5, 4/6, 4/7, 4/8, 4/9, 4/10, 4/11, 4/12, 4/13, 4/14, 4/15, -+ 0, 5/1, 5/2, 5/3, 5/4, 5/5, 5/6, 5/7, 5/8, 5/9, 5/10, 5/11, 5/12, 5/13, 5/14, 5/15, -+ 0, 6/1, 6/2, 6/3, 6/4, 6/5, 6/6, 6/7, 6/8, 6/9, 6/10, 6/11, 6/12, 6/13, 6/14, 6/15, -+ 0, 7/1, 7/2, 7/3, 7/4, 7/5, 7/6, 7/7, 7/8, 7/9, 7/10, 7/11, 7/12, 7/13, 7/14, 7/15, -+ 0, 8/1, 8/2, 8/3, 8/4, 8/5, 8/6, 8/7, 8/8, 8/9, 8/10, 8/11, 8/12, 8/13, 8/14, 8/15, -+ 0, 9/1, 9/2, 9/3, 9/4, 9/5, 9/6, 9/7, 9/8, 9/9, 9/10, 9/11, 9/12, 9/13, 9/14, 9/15, -+ 0, 10/1, 10/2, 10/3, 10/4, 10/5, 10/6, 10/7, 10/8, 10/9, 10/10, 10/11, 10/12, 10/13, 10/14, 10/15, -+ 0, 11/1, 11/2, 11/3, 11/4, 11/5, 11/6, 11/7, 11/8, 11/9, 11/10, 11/11, 11/12, 11/13, 11/14, 11/15, -+ 0, 12/1, 12/2, 12/3, 12/4, 12/5, 12/6, 12/7, 12/8, 12/9, 12/10, 12/11, 12/12, 12/13, 12/14, 12/15, -+ 0, 13/1, 13/2, 13/3, 13/4, 13/5, 13/6, 13/7, 13/8, 13/9, 13/10, 13/11, 13/12, 13/13, 13/14, 13/15, -+ 0, 14/1, 14/2, 14/3, 14/4, 14/5, 14/6, 14/7, 14/8, 14/9, 14/10, 14/11, 14/12, 14/13, 14/14, 14/15, -+ 0, 15/1, 15/2, 15/3, 15/4, 15/5, 15/6, 15/7, 15/8, 15/9, 15/10, 15/11, 15/12, 15/13, 15/14, 15/15, -+}; -+ -diff -durN gcc-3.4.6.orig/gcc/config/nios2/lib2-mul.c gcc-3.4.6/gcc/config/nios2/lib2-mul.c ---- gcc-3.4.6.orig/gcc/config/nios2/lib2-mul.c 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/gcc/config/nios2/lib2-mul.c 2007-08-15 23:09:36.000000000 +0200 -@@ -0,0 +1,103 @@ -+/* while we are debugging (ie compile outside of gcc build) -+ disable gcc specific headers */ -+#ifndef DEBUG_MULSI3 -+ -+ -+/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is -+ supposedly valid even though this is a "target" file. */ -+#include "auto-host.h" -+ -+ -+#include "tconfig.h" -+#include "tsystem.h" -+#include "coretypes.h" -+#include "tm.h" -+ -+ -+/* Don't use `fancy_abort' here even if config.h says to use it. */ -+#ifdef abort -+#undef abort -+#endif -+ -+ -+#ifdef HAVE_GAS_HIDDEN -+#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden"))) -+#else -+#define ATTRIBUTE_HIDDEN -+#endif -+ -+#include "libgcc2.h" -+ -+#else -+#define SItype int -+#define USItype unsigned int -+#endif -+ -+ -+extern SItype __mulsi3 (SItype, SItype); -+ -+SItype -+__mulsi3 (SItype a, SItype b) -+{ -+ SItype res = 0; -+ USItype cnt = a; -+ -+ while (cnt) -+ { -+ if (cnt & 1) -+ { -+ res += b; -+ } -+ b <<= 1; -+ cnt >>= 1; -+ } -+ -+ return res; -+} -+/* -+TODO: Choose best alternative implementation. -+ -+SItype -+__divsi3 (SItype a, SItype b) -+{ -+ SItype res = 0; -+ USItype cnt = 0; -+ -+ while (cnt < 32) -+ { -+ if (a & (1L << cnt)) -+ { -+ res += b; -+ } -+ b <<= 1; -+ cnt++; -+ } -+ -+ return res; -+} -+*/ -+ -+ -+#ifdef DEBUG_MULSI3 -+ -+int -+main () -+{ -+ int i, j; -+ int error = 0; -+ -+ for (i = -1000; i < 1000; i++) -+ for (j = -1000; j < 1000; j++) -+ { -+ int expect = i * j; -+ int actual = A__divsi3 (i, j); -+ if (expect != actual) -+ { -+ printf ("error: %d * %d = %d not %d\n", i, j, expect, actual); -+ error = 1; -+ } -+ } -+ -+ return error; -+} -+#endif -diff -durN gcc-3.4.6.orig/gcc/config/nios2/nios2.c gcc-3.4.6/gcc/config/nios2/nios2.c ---- gcc-3.4.6.orig/gcc/config/nios2/nios2.c 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/gcc/config/nios2/nios2.c 2007-08-15 23:09:36.000000000 +0200 -@@ -0,0 +1,2853 @@ -+/* Subroutines for assembler code output for Altera NIOS 2G NIOS2 version. -+ Copyright (C) 2003 Altera -+ Contributed by Jonah Graham (jgraham@altera.com). -+ -+This file is part of GNU CC. -+ -+GNU CC is free software; you can redistribute it and/or modify -+it under the terms of the GNU General Public License as published by -+the Free Software Foundation; either version 2, or (at your option) -+any later version. -+ -+GNU CC is distributed in the hope that it will be useful, -+but WITHOUT ANY WARRANTY; without even the implied warranty of -+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+GNU General Public License for more details. -+ -+You should have received a copy of the GNU General Public License -+along with GNU CC; see the file COPYING. If not, write to -+the Free Software Foundation, 59 Temple Place - Suite 330, -+Boston, MA 02111-1307, USA. */ -+ -+ -+#include -+#include "config.h" -+#include "system.h" -+#include "coretypes.h" -+#include "tm.h" -+#include "rtl.h" -+#include "tree.h" -+#include "tm_p.h" -+#include "regs.h" -+#include "hard-reg-set.h" -+#include "real.h" -+#include "insn-config.h" -+#include "conditions.h" -+#include "output.h" -+#include "insn-attr.h" -+#include "flags.h" -+#include "recog.h" -+#include "expr.h" -+#include "toplev.h" -+#include "basic-block.h" -+#include "function.h" -+#include "ggc.h" -+#include "reload.h" -+#include "debug.h" -+#include "optabs.h" -+#include "target.h" -+#include "target-def.h" -+ -+/* local prototypes */ -+static bool nios2_rtx_costs (rtx, int, int, int *); -+ -+static void nios2_asm_function_prologue (FILE *, HOST_WIDE_INT); -+static int nios2_use_dfa_pipeline_interface (void); -+static int nios2_issue_rate (void); -+static struct machine_function *nios2_init_machine_status (void); -+static bool nios2_in_small_data_p (tree); -+static rtx save_reg (int, HOST_WIDE_INT, rtx); -+static rtx restore_reg (int, HOST_WIDE_INT); -+static unsigned int nios2_section_type_flags (tree, const char *, int); -+static void nios2_init_builtins (void); -+static rtx nios2_expand_builtin (tree, rtx, rtx, enum machine_mode, int); -+static bool nios2_function_ok_for_sibcall (tree, tree); -+static void nios2_encode_section_info (tree, rtx, int); -+ -+/* Initialize the GCC target structure. */ -+#undef TARGET_ASM_FUNCTION_PROLOGUE -+#define TARGET_ASM_FUNCTION_PROLOGUE nios2_asm_function_prologue -+ -+#undef TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE -+#define TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE \ -+ nios2_use_dfa_pipeline_interface -+#undef TARGET_SCHED_ISSUE_RATE -+#define TARGET_SCHED_ISSUE_RATE nios2_issue_rate -+#undef TARGET_IN_SMALL_DATA_P -+#define TARGET_IN_SMALL_DATA_P nios2_in_small_data_p -+#undef TARGET_ENCODE_SECTION_INFO -+#define TARGET_ENCODE_SECTION_INFO nios2_encode_section_info -+#undef TARGET_SECTION_TYPE_FLAGS -+#define TARGET_SECTION_TYPE_FLAGS nios2_section_type_flags -+ -+#undef TARGET_INIT_BUILTINS -+#define TARGET_INIT_BUILTINS nios2_init_builtins -+#undef TARGET_EXPAND_BUILTIN -+#define TARGET_EXPAND_BUILTIN nios2_expand_builtin -+ -+#undef TARGET_FUNCTION_OK_FOR_SIBCALL -+#define TARGET_FUNCTION_OK_FOR_SIBCALL nios2_function_ok_for_sibcall -+ -+#undef TARGET_RTX_COSTS -+#define TARGET_RTX_COSTS nios2_rtx_costs -+ -+ -+struct gcc_target targetm = TARGET_INITIALIZER; -+ -+ -+ -+/* Threshold for data being put into the small data/bss area, instead -+ of the normal data area (references to the small data/bss area take -+ 1 instruction, and use the global pointer, references to the normal -+ data area takes 2 instructions). */ -+unsigned HOST_WIDE_INT nios2_section_threshold = NIOS2_DEFAULT_GVALUE; -+ -+ -+/* Structure to be filled in by compute_frame_size with register -+ save masks, and offsets for the current function. */ -+ -+struct nios2_frame_info -+GTY (()) -+{ -+ long total_size; /* # bytes that the entire frame takes up */ -+ long var_size; /* # bytes that variables take up */ -+ long args_size; /* # bytes that outgoing arguments take up */ -+ int save_reg_size; /* # bytes needed to store gp regs */ -+ int save_reg_rounded; /* # bytes needed to store gp regs */ -+ long save_regs_offset; /* offset from new sp to store gp registers */ -+ int initialized; /* != 0 if frame size already calculated */ -+ int num_regs; /* number of gp registers saved */ -+}; -+ -+struct machine_function -+GTY (()) -+{ -+ -+ /* Current frame information, calculated by compute_frame_size. */ -+ struct nios2_frame_info frame; -+}; -+ -+ -+/*************************************** -+ * Section encodings -+ ***************************************/ -+ -+ -+ -+ -+ -+/*************************************** -+ * Stack Layout and Calling Conventions -+ ***************************************/ -+ -+ -+#define TOO_BIG_OFFSET(X) ((X) > ((1 << 15) - 1)) -+#define TEMP_REG_NUM 8 -+ -+static void -+nios2_asm_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED) -+{ -+ if (flag_verbose_asm || flag_debug_asm) -+ { -+ compute_frame_size (); -+ dump_frame_size (file); -+ } -+} -+ -+static rtx -+save_reg (int regno, HOST_WIDE_INT offset, rtx cfa_store_reg) -+{ -+ rtx insn, stack_slot; -+ -+ stack_slot = gen_rtx_PLUS (SImode, -+ cfa_store_reg, -+ GEN_INT (offset)); -+ -+ insn = emit_insn (gen_rtx_SET (SImode, -+ gen_rtx_MEM (SImode, stack_slot), -+ gen_rtx_REG (SImode, regno))); -+ -+ RTX_FRAME_RELATED_P (insn) = 1; -+ -+ return insn; -+} -+ -+static rtx -+restore_reg (int regno, HOST_WIDE_INT offset) -+{ -+ rtx insn, stack_slot; -+ -+ if (TOO_BIG_OFFSET (offset)) -+ { -+ stack_slot = gen_rtx_REG (SImode, TEMP_REG_NUM); -+ insn = emit_insn (gen_rtx_SET (SImode, -+ stack_slot, -+ GEN_INT (offset))); -+ -+ insn = emit_insn (gen_rtx_SET (SImode, -+ stack_slot, -+ gen_rtx_PLUS (SImode, -+ stack_slot, -+ stack_pointer_rtx))); -+ } -+ else -+ { -+ stack_slot = gen_rtx_PLUS (SImode, -+ stack_pointer_rtx, -+ GEN_INT (offset)); -+ } -+ -+ stack_slot = gen_rtx_MEM (SImode, stack_slot); -+ -+ insn = emit_move_insn (gen_rtx_REG (SImode, regno), stack_slot); -+ -+ return insn; -+} -+ -+ -+/* There are two possible paths for prologue expansion, -+- the first is if the total frame size is < 2^15-1. In that -+case all the immediates will fit into the 16-bit immediate -+fields. -+- the second is when the frame size is too big, in that -+case an additional temporary register is used, first -+as a cfa_temp to offset the sp, second as the cfa_store -+register. -+ -+See the comment above dwarf2out_frame_debug_expr in -+dwarf2out.c for more explanation of the "rules." -+ -+ -+Case 1: -+Rule # Example Insn Effect -+2 addi sp, sp, -total_frame_size cfa.reg=sp, cfa.offset=total_frame_size -+ cfa_store.reg=sp, cfa_store.offset=total_frame_size -+12 stw ra, offset(sp) -+12 stw r16, offset(sp) -+1 mov fp, sp -+ -+Case 2: -+Rule # Example Insn Effect -+6 movi r8, total_frame_size cfa_temp.reg=r8, cfa_temp.offset=total_frame_size -+2 sub sp, sp, r8 cfa.reg=sp, cfa.offset=total_frame_size -+ cfa_store.reg=sp, cfa_store.offset=total_frame_size -+5 add r8, r8, sp cfa_store.reg=r8, cfa_store.offset=0 -+12 stw ra, offset(r8) -+12 stw r16, offset(r8) -+1 mov fp, sp -+ -+*/ -+ -+void -+expand_prologue () -+{ -+ int i; -+ HOST_WIDE_INT total_frame_size; -+ int cfa_store_offset; -+ rtx insn; -+ rtx cfa_store_reg = 0; -+ -+ total_frame_size = compute_frame_size (); -+ -+ if (total_frame_size) -+ { -+ -+ if (TOO_BIG_OFFSET (total_frame_size)) -+ { -+ /* cfa_temp and cfa_store_reg are the same register, -+ cfa_store_reg overwrites cfa_temp */ -+ cfa_store_reg = gen_rtx_REG (SImode, TEMP_REG_NUM); -+ insn = emit_insn (gen_rtx_SET (SImode, -+ cfa_store_reg, -+ GEN_INT (total_frame_size))); -+ -+ RTX_FRAME_RELATED_P (insn) = 1; -+ -+ -+ insn = gen_rtx_SET (SImode, -+ stack_pointer_rtx, -+ gen_rtx_MINUS (SImode, -+ stack_pointer_rtx, -+ cfa_store_reg)); -+ -+ insn = emit_insn (insn); -+ RTX_FRAME_RELATED_P (insn) = 1; -+ -+ -+ /* if there are no registers to save, I don't need to -+ create a cfa_store */ -+ if (cfun->machine->frame.save_reg_size) -+ { -+ insn = gen_rtx_SET (SImode, -+ cfa_store_reg, -+ gen_rtx_PLUS (SImode, -+ cfa_store_reg, -+ stack_pointer_rtx)); -+ -+ insn = emit_insn (insn); -+ RTX_FRAME_RELATED_P (insn) = 1; -+ } -+ -+ cfa_store_offset -+ = total_frame_size -+ - (cfun->machine->frame.save_regs_offset -+ + cfun->machine->frame.save_reg_rounded); -+ } -+ else -+ { -+ insn = gen_rtx_SET (SImode, -+ stack_pointer_rtx, -+ gen_rtx_PLUS (SImode, -+ stack_pointer_rtx, -+ GEN_INT (-total_frame_size))); -+ insn = emit_insn (insn); -+ RTX_FRAME_RELATED_P (insn) = 1; -+ -+ cfa_store_reg = stack_pointer_rtx; -+ cfa_store_offset -+ = cfun->machine->frame.save_regs_offset -+ + cfun->machine->frame.save_reg_rounded; -+ } -+ } -+ -+ if (MUST_SAVE_REGISTER (RA_REGNO)) -+ { -+ cfa_store_offset -= 4; -+ save_reg (RA_REGNO, cfa_store_offset, cfa_store_reg); -+ } -+ if (MUST_SAVE_REGISTER (FP_REGNO)) -+ { -+ cfa_store_offset -= 4; -+ save_reg (FP_REGNO, cfa_store_offset, cfa_store_reg); -+ } -+ -+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) -+ { -+ if (MUST_SAVE_REGISTER (i) && i != FP_REGNO && i != RA_REGNO) -+ { -+ cfa_store_offset -= 4; -+ save_reg (i, cfa_store_offset, cfa_store_reg); -+ } -+ } -+ -+ if (frame_pointer_needed) -+ { -+ insn = emit_insn (gen_rtx_SET (SImode, -+ gen_rtx_REG (SImode, FP_REGNO), -+ gen_rtx_REG (SImode, SP_REGNO))); -+ -+ RTX_FRAME_RELATED_P (insn) = 1; -+ } -+ -+ /* If we are profiling, make sure no instructions are scheduled before -+ the call to mcount. */ -+ if (current_function_profile) -+ emit_insn (gen_blockage ()); -+} -+ -+void -+expand_epilogue (bool sibcall_p) -+{ -+ rtx insn; -+ int i; -+ HOST_WIDE_INT total_frame_size; -+ int register_store_offset; -+ -+ total_frame_size = compute_frame_size (); -+ -+ if (!sibcall_p && nios2_can_use_return_insn ()) -+ { -+ insn = emit_jump_insn (gen_return ()); -+ return; -+ } -+ -+ emit_insn (gen_blockage ()); -+ -+ register_store_offset = -+ cfun->machine->frame.save_regs_offset + -+ cfun->machine->frame.save_reg_rounded; -+ -+ if (MUST_SAVE_REGISTER (RA_REGNO)) -+ { -+ register_store_offset -= 4; -+ restore_reg (RA_REGNO, register_store_offset); -+ } -+ -+ if (MUST_SAVE_REGISTER (FP_REGNO)) -+ { -+ register_store_offset -= 4; -+ restore_reg (FP_REGNO, register_store_offset); -+ } -+ -+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) -+ { -+ if (MUST_SAVE_REGISTER (i) && i != FP_REGNO && i != RA_REGNO) -+ { -+ register_store_offset -= 4; -+ restore_reg (i, register_store_offset); -+ } -+ } -+ -+ if (total_frame_size) -+ { -+ rtx sp_adjust; -+ -+ if (TOO_BIG_OFFSET (total_frame_size)) -+ { -+ sp_adjust = gen_rtx_REG (SImode, TEMP_REG_NUM); -+ insn = emit_insn (gen_rtx_SET (SImode, -+ sp_adjust, -+ GEN_INT (total_frame_size))); -+ -+ } -+ else -+ { -+ sp_adjust = GEN_INT (total_frame_size); -+ } -+ -+ insn = gen_rtx_SET (SImode, -+ stack_pointer_rtx, -+ gen_rtx_PLUS (SImode, -+ stack_pointer_rtx, -+ sp_adjust)); -+ insn = emit_insn (insn); -+ } -+ -+ -+ if (!sibcall_p) -+ { -+ insn = emit_jump_insn (gen_return_from_epilogue (gen_rtx (REG, Pmode, -+ RA_REGNO))); -+ } -+} -+ -+ -+bool -+nios2_function_ok_for_sibcall (tree a ATTRIBUTE_UNUSED, tree b ATTRIBUTE_UNUSED) -+{ -+ return true; -+} -+ -+ -+ -+ -+ -+/* ----------------------- * -+ * Profiling -+ * ----------------------- */ -+ -+void -+function_profiler (FILE *file, int labelno) -+{ -+ fprintf (file, "\t%s mcount begin, label: .LP%d\n", -+ ASM_COMMENT_START, labelno); -+ fprintf (file, "\tnextpc\tr8\n"); -+ fprintf (file, "\tmov\tr9, ra\n"); -+ fprintf (file, "\tmovhi\tr10, %%hiadj(.LP%d)\n", labelno); -+ fprintf (file, "\taddi\tr10, r10, %%lo(.LP%d)\n", labelno); -+ fprintf (file, "\tcall\tmcount\n"); -+ fprintf (file, "\tmov\tra, r9\n"); -+ fprintf (file, "\t%s mcount end\n", ASM_COMMENT_START); -+} -+ -+ -+/*************************************** -+ * Stack Layout -+ ***************************************/ -+ -+ -+void -+dump_frame_size (FILE *file) -+{ -+ fprintf (file, "\t%s Current Frame Info\n", ASM_COMMENT_START); -+ -+ fprintf (file, "\t%s total_size = %ld\n", ASM_COMMENT_START, -+ cfun->machine->frame.total_size); -+ fprintf (file, "\t%s var_size = %ld\n", ASM_COMMENT_START, -+ cfun->machine->frame.var_size); -+ fprintf (file, "\t%s args_size = %ld\n", ASM_COMMENT_START, -+ cfun->machine->frame.args_size); -+ fprintf (file, "\t%s save_reg_size = %d\n", ASM_COMMENT_START, -+ cfun->machine->frame.save_reg_size); -+ fprintf (file, "\t%s save_reg_rounded = %d\n", ASM_COMMENT_START, -+ cfun->machine->frame.save_reg_rounded); -+ fprintf (file, "\t%s initialized = %d\n", ASM_COMMENT_START, -+ cfun->machine->frame.initialized); -+ fprintf (file, "\t%s num_regs = %d\n", ASM_COMMENT_START, -+ cfun->machine->frame.num_regs); -+ fprintf (file, "\t%s save_regs_offset = %ld\n", ASM_COMMENT_START, -+ cfun->machine->frame.save_regs_offset); -+ fprintf (file, "\t%s current_function_is_leaf = %d\n", ASM_COMMENT_START, -+ current_function_is_leaf); -+ fprintf (file, "\t%s frame_pointer_needed = %d\n", ASM_COMMENT_START, -+ frame_pointer_needed); -+ fprintf (file, "\t%s pretend_args_size = %d\n", ASM_COMMENT_START, -+ current_function_pretend_args_size); -+ -+} -+ -+ -+/* Return the bytes needed to compute the frame pointer from the current -+ stack pointer. -+*/ -+ -+HOST_WIDE_INT -+compute_frame_size () -+{ -+ unsigned int regno; -+ HOST_WIDE_INT var_size; /* # of var. bytes allocated */ -+ HOST_WIDE_INT total_size; /* # bytes that the entire frame takes up */ -+ HOST_WIDE_INT save_reg_size; /* # bytes needed to store callee save regs */ -+ HOST_WIDE_INT save_reg_rounded; -+ /* # bytes needed to store callee save regs (rounded) */ -+ HOST_WIDE_INT out_args_size; /* # bytes needed for outgoing args */ -+ -+ save_reg_size = 0; -+ var_size = STACK_ALIGN (get_frame_size ()); -+ out_args_size = STACK_ALIGN (current_function_outgoing_args_size); -+ -+ total_size = var_size + out_args_size; -+ -+ /* Calculate space needed for gp registers. */ -+ for (regno = 0; regno <= FIRST_PSEUDO_REGISTER; regno++) -+ { -+ if (MUST_SAVE_REGISTER (regno)) -+ { -+ save_reg_size += 4; -+ } -+ } -+ -+ save_reg_rounded = STACK_ALIGN (save_reg_size); -+ total_size += save_reg_rounded; -+ -+ total_size += STACK_ALIGN (current_function_pretend_args_size); -+ -+ /* Save other computed information. */ -+ cfun->machine->frame.total_size = total_size; -+ cfun->machine->frame.var_size = var_size; -+ cfun->machine->frame.args_size = current_function_outgoing_args_size; -+ cfun->machine->frame.save_reg_size = save_reg_size; -+ cfun->machine->frame.save_reg_rounded = save_reg_rounded; -+ cfun->machine->frame.initialized = reload_completed; -+ cfun->machine->frame.num_regs = save_reg_size / UNITS_PER_WORD; -+ -+ cfun->machine->frame.save_regs_offset -+ = save_reg_rounded ? current_function_outgoing_args_size + var_size : 0; -+ -+ return total_size; -+} -+ -+ -+int -+nios2_initial_elimination_offset (int from, int to ATTRIBUTE_UNUSED) -+{ -+ int offset; -+ -+ /* Set OFFSET to the offset from the stack pointer. */ -+ switch (from) -+ { -+ case FRAME_POINTER_REGNUM: -+ offset = 0; -+ break; -+ -+ case ARG_POINTER_REGNUM: -+ compute_frame_size (); -+ offset = cfun->machine->frame.total_size; -+ offset -= current_function_pretend_args_size; -+ break; -+ -+ case RETURN_ADDRESS_POINTER_REGNUM: -+ compute_frame_size (); -+ /* since the return address is always the first of the -+ saved registers, return the offset to the beginning -+ of the saved registers block */ -+ offset = cfun->machine->frame.save_regs_offset; -+ break; -+ -+ default: -+ abort (); -+ } -+ -+ return offset; -+} -+ -+/* Return nonzero if this function is known to have a null epilogue. -+ This allows the optimizer to omit jumps to jumps if no stack -+ was created. */ -+int -+nios2_can_use_return_insn () -+{ -+ if (!reload_completed) -+ return 0; -+ -+ if (regs_ever_live[RA_REGNO] || current_function_profile) -+ return 0; -+ -+ if (cfun->machine->frame.initialized) -+ return cfun->machine->frame.total_size == 0; -+ -+ return compute_frame_size () == 0; -+} -+ -+ -+ -+ -+ -+/*************************************** -+ * -+ ***************************************/ -+ -+const char *nios2_sys_nosys_string; /* for -msys=nosys */ -+const char *nios2_sys_lib_string; /* for -msys-lib= */ -+const char *nios2_sys_crt0_string; /* for -msys-crt0= */ -+ -+void -+override_options () -+{ -+ /* Function to allocate machine-dependent function status. */ -+ init_machine_status = &nios2_init_machine_status; -+ -+ nios2_section_threshold -+ = g_switch_set ? g_switch_value : NIOS2_DEFAULT_GVALUE; -+ -+ if (nios2_sys_nosys_string && *nios2_sys_nosys_string) -+ { -+ error ("invalid option '-msys=nosys%s'", nios2_sys_nosys_string); -+ } -+ -+ /* If we don't have mul, we don't have mulx either! */ -+ if (!TARGET_HAS_MUL && TARGET_HAS_MULX) -+ { -+ target_flags &= ~HAS_MULX_FLAG; -+ } -+ -+} -+ -+void -+optimization_options (int level, int size) -+{ -+ if (level || size) -+ { -+ target_flags |= INLINE_MEMCPY_FLAG; -+ } -+ -+ if (level >= 3 && !size) -+ { -+ target_flags |= FAST_SW_DIV_FLAG; -+ } -+} -+ -+/* Allocate a chunk of memory for per-function machine-dependent data. */ -+static struct machine_function * -+nios2_init_machine_status () -+{ -+ return ((struct machine_function *) -+ ggc_alloc_cleared (sizeof (struct machine_function))); -+} -+ -+ -+ -+/***************** -+ * Describing Relative Costs of Operations -+ *****************/ -+ -+/* Compute a (partial) cost for rtx X. Return true if the complete -+ cost has been computed, and false if subexpressions should be -+ scanned. In either case, *TOTAL contains the cost result. */ -+ -+ -+ -+static bool -+nios2_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total) -+{ -+ switch (code) -+ { -+ case CONST_INT: -+ if (INTVAL (x) == 0) -+ { -+ *total = COSTS_N_INSNS (0); -+ return true; -+ } -+ else if (SMALL_INT (INTVAL (x)) -+ || SMALL_INT_UNSIGNED (INTVAL (x)) -+ || UPPER16_INT (INTVAL (x))) -+ { -+ *total = COSTS_N_INSNS (2); -+ return true; -+ } -+ else -+ { -+ *total = COSTS_N_INSNS (4); -+ return true; -+ } -+ -+ case LABEL_REF: -+ case SYMBOL_REF: -+ /* ??? gp relative stuff will fit in here */ -+ /* fall through */ -+ case CONST: -+ case CONST_DOUBLE: -+ { -+ *total = COSTS_N_INSNS (4); -+ return true; -+ } -+ -+ case MULT: -+ { -+ *total = COSTS_N_INSNS (1); -+ return false; -+ } -+ case SIGN_EXTEND: -+ { -+ *total = COSTS_N_INSNS (3); -+ return false; -+ } -+ case ZERO_EXTEND: -+ { -+ *total = COSTS_N_INSNS (1); -+ return false; -+ } -+ -+ default: -+ return false; -+ } -+} -+ -+ -+/*************************************** -+ * INSTRUCTION SUPPORT -+ * -+ * These functions are used within the Machine Description to -+ * handle common or complicated output and expansions from -+ * instructions. -+ ***************************************/ -+ -+int -+nios2_emit_move_sequence (rtx *operands, enum machine_mode mode) -+{ -+ rtx to = operands[0]; -+ rtx from = operands[1]; -+ -+ if (!register_operand (to, mode) && !reg_or_0_operand (from, mode)) -+ { -+ if (no_new_pseudos) -+ internal_error ("Trying to force_reg no_new_pseudos == 1"); -+ from = copy_to_mode_reg (mode, from); -+ } -+ -+ operands[0] = to; -+ operands[1] = from; -+ return 0; -+} -+ -+/* Divide Support */ -+ -+/* -+ If -O3 is used, we want to output a table lookup for -+ divides between small numbers (both num and den >= 0 -+ and < 0x10). The overhead of this method in the worse -+ case is 40 bytes in the text section (10 insns) and -+ 256 bytes in the data section. Additional divides do -+ not incur additional penalties in the data section. -+ -+ Code speed is improved for small divides by about 5x -+ when using this method in the worse case (~9 cycles -+ vs ~45). And in the worse case divides not within the -+ table are penalized by about 10% (~5 cycles vs ~45). -+ However in the typical case the penalty is not as bad -+ because doing the long divide in only 45 cycles is -+ quite optimistic. -+ -+ ??? It would be nice to have some benchmarks other -+ than Dhrystone to back this up. -+ -+ This bit of expansion is to create this instruction -+ sequence as rtl. -+ or $8, $4, $5 -+ slli $9, $4, 4 -+ cmpgeui $3, $8, 16 -+ beq $3, $0, .L3 -+ or $10, $9, $5 -+ add $12, $11, divide_table -+ ldbu $2, 0($12) -+ br .L1 -+.L3: -+ call slow_div -+.L1: -+# continue here with result in $2 -+ -+ ??? Ideally I would like the emit libcall block to contain -+ all of this code, but I don't know how to do that. What it -+ means is that if the divide can be eliminated, it may not -+ completely disappear. -+ -+ ??? The __divsi3_table label should ideally be moved out -+ of this block and into a global. If it is placed into the -+ sdata section we can save even more cycles by doing things -+ gp relative. -+*/ -+int -+nios2_emit_expensive_div (rtx *operands, enum machine_mode mode) -+{ -+ rtx or_result, shift_left_result; -+ rtx lookup_value; -+ rtx lab1, lab3; -+ rtx insns; -+ rtx libfunc; -+ rtx final_result; -+ rtx tmp; -+ -+ /* it may look a little generic, but only SImode -+ is supported for now */ -+ if (mode != SImode) -+ abort (); -+ -+ libfunc = sdiv_optab->handlers[(int) SImode].libfunc; -+ -+ -+ -+ lab1 = gen_label_rtx (); -+ lab3 = gen_label_rtx (); -+ -+ or_result = expand_simple_binop (SImode, IOR, -+ operands[1], operands[2], -+ 0, 0, OPTAB_LIB_WIDEN); -+ -+ emit_cmp_and_jump_insns (or_result, GEN_INT (15), GTU, 0, -+ GET_MODE (or_result), 0, lab3); -+ JUMP_LABEL (get_last_insn ()) = lab3; -+ -+ shift_left_result = expand_simple_binop (SImode, ASHIFT, -+ operands[1], GEN_INT (4), -+ 0, 0, OPTAB_LIB_WIDEN); -+ -+ lookup_value = expand_simple_binop (SImode, IOR, -+ shift_left_result, operands[2], -+ 0, 0, OPTAB_LIB_WIDEN); -+ -+ convert_move (operands[0], -+ gen_rtx (MEM, QImode, -+ gen_rtx (PLUS, SImode, -+ lookup_value, -+ gen_rtx_SYMBOL_REF (SImode, "__divsi3_table"))), -+ 1); -+ -+ -+ tmp = emit_jump_insn (gen_jump (lab1)); -+ JUMP_LABEL (tmp) = lab1; -+ emit_barrier (); -+ -+ emit_label (lab3); -+ LABEL_NUSES (lab3) = 1; -+ -+ start_sequence (); -+ final_result = emit_library_call_value (libfunc, NULL_RTX, -+ LCT_CONST, SImode, 2, -+ operands[1], SImode, -+ operands[2], SImode); -+ -+ -+ insns = get_insns (); -+ end_sequence (); -+ emit_libcall_block (insns, operands[0], final_result, -+ gen_rtx (DIV, SImode, operands[1], operands[2])); -+ -+ emit_label (lab1); -+ LABEL_NUSES (lab1) = 1; -+ return 1; -+} -+ -+/* Branches/Compares */ -+ -+/* the way of handling branches/compares -+ in gcc is heavily borrowed from MIPS */ -+ -+enum internal_test -+{ -+ ITEST_EQ, -+ ITEST_NE, -+ ITEST_GT, -+ ITEST_GE, -+ ITEST_LT, -+ ITEST_LE, -+ ITEST_GTU, -+ ITEST_GEU, -+ ITEST_LTU, -+ ITEST_LEU, -+ ITEST_MAX -+}; -+ -+static enum internal_test map_test_to_internal_test (enum rtx_code); -+ -+/* Cached operands, and operator to compare for use in set/branch/trap -+ on condition codes. */ -+rtx branch_cmp[2]; -+enum cmp_type branch_type; -+ -+/* Make normal rtx_code into something we can index from an array */ -+ -+static enum internal_test -+map_test_to_internal_test (enum rtx_code test_code) -+{ -+ enum internal_test test = ITEST_MAX; -+ -+ switch (test_code) -+ { -+ case EQ: -+ test = ITEST_EQ; -+ break; -+ case NE: -+ test = ITEST_NE; -+ break; -+ case GT: -+ test = ITEST_GT; -+ break; -+ case GE: -+ test = ITEST_GE; -+ break; -+ case LT: -+ test = ITEST_LT; -+ break; -+ case LE: -+ test = ITEST_LE; -+ break; -+ case GTU: -+ test = ITEST_GTU; -+ break; -+ case GEU: -+ test = ITEST_GEU; -+ break; -+ case LTU: -+ test = ITEST_LTU; -+ break; -+ case LEU: -+ test = ITEST_LEU; -+ break; -+ default: -+ break; -+ } -+ -+ return test; -+} -+ -+/* Generate the code to compare (and possibly branch) two integer values -+ TEST_CODE is the comparison code we are trying to emulate -+ (or implement directly) -+ RESULT is where to store the result of the comparison, -+ or null to emit a branch -+ CMP0 CMP1 are the two comparison operands -+ DESTINATION is the destination of the branch, or null to only compare -+ */ -+ -+void -+gen_int_relational (enum rtx_code test_code, /* relational test (EQ, etc) */ -+ rtx result, /* result to store comp. or 0 if branch */ -+ rtx cmp0, /* first operand to compare */ -+ rtx cmp1, /* second operand to compare */ -+ rtx destination) /* destination of the branch, or 0 if compare */ -+{ -+ struct cmp_info -+ { -+ /* for register (or 0) compares */ -+ enum rtx_code test_code_reg; /* code to use in instruction (LT vs. LTU) */ -+ int reverse_regs; /* reverse registers in test */ -+ -+ /* for immediate compares */ -+ enum rtx_code test_code_const; -+ /* code to use in instruction (LT vs. LTU) */ -+ int const_low; /* low bound of constant we can accept */ -+ int const_high; /* high bound of constant we can accept */ -+ int const_add; /* constant to add */ -+ -+ /* generic info */ -+ int unsignedp; /* != 0 for unsigned comparisons. */ -+ }; -+ -+ static const struct cmp_info info[(int) ITEST_MAX] = { -+ -+ {EQ, 0, EQ, -32768, 32767, 0, 0}, /* EQ */ -+ {NE, 0, NE, -32768, 32767, 0, 0}, /* NE */ -+ -+ {LT, 1, GE, -32769, 32766, 1, 0}, /* GT */ -+ {GE, 0, GE, -32768, 32767, 0, 0}, /* GE */ -+ {LT, 0, LT, -32768, 32767, 0, 0}, /* LT */ -+ {GE, 1, LT, -32769, 32766, 1, 0}, /* LE */ -+ -+ {LTU, 1, GEU, 0, 65534, 1, 0}, /* GTU */ -+ {GEU, 0, GEU, 0, 65535, 0, 0}, /* GEU */ -+ {LTU, 0, LTU, 0, 65535, 0, 0}, /* LTU */ -+ {GEU, 1, LTU, 0, 65534, 1, 0}, /* LEU */ -+ }; -+ -+ enum internal_test test; -+ enum machine_mode mode; -+ const struct cmp_info *p_info; -+ int branch_p; -+ -+ -+ -+ -+ test = map_test_to_internal_test (test_code); -+ if (test == ITEST_MAX) -+ abort (); -+ -+ p_info = &info[(int) test]; -+ -+ mode = GET_MODE (cmp0); -+ if (mode == VOIDmode) -+ mode = GET_MODE (cmp1); -+ -+ branch_p = (destination != 0); -+ -+ /* We can't, under any circumstances, have const_ints in cmp0 -+ ??? Actually we could have const0 */ -+ if (GET_CODE (cmp0) == CONST_INT) -+ cmp0 = force_reg (mode, cmp0); -+ -+ /* if the comparison is against an int not in legal range -+ move it into a register */ -+ if (GET_CODE (cmp1) == CONST_INT) -+ { -+ HOST_WIDE_INT value = INTVAL (cmp1); -+ -+ if (value < p_info->const_low || value > p_info->const_high) -+ cmp1 = force_reg (mode, cmp1); -+ } -+ -+ /* Comparison to constants, may involve adding 1 to change a GT into GE. -+ Comparison between two registers, may involve switching operands. */ -+ if (GET_CODE (cmp1) == CONST_INT) -+ { -+ if (p_info->const_add != 0) -+ { -+ HOST_WIDE_INT new = INTVAL (cmp1) + p_info->const_add; -+ -+ /* If modification of cmp1 caused overflow, -+ we would get the wrong answer if we follow the usual path; -+ thus, x > 0xffffffffU would turn into x > 0U. */ -+ if ((p_info->unsignedp -+ ? (unsigned HOST_WIDE_INT) new > -+ (unsigned HOST_WIDE_INT) INTVAL (cmp1) -+ : new > INTVAL (cmp1)) != (p_info->const_add > 0)) -+ { -+ /* ??? This case can never happen with the current numbers, -+ but I am paranoid and would rather an abort than -+ a bug I will never find */ -+ abort (); -+ } -+ else -+ cmp1 = GEN_INT (new); -+ } -+ } -+ -+ else if (p_info->reverse_regs) -+ { -+ rtx temp = cmp0; -+ cmp0 = cmp1; -+ cmp1 = temp; -+ } -+ -+ -+ -+ if (branch_p) -+ { -+ if (register_operand (cmp0, mode) && register_operand (cmp1, mode)) -+ { -+ rtx insn; -+ rtx cond = gen_rtx (p_info->test_code_reg, mode, cmp0, cmp1); -+ rtx label = gen_rtx_LABEL_REF (VOIDmode, destination); -+ -+ insn = gen_rtx_SET (VOIDmode, pc_rtx, -+ gen_rtx_IF_THEN_ELSE (VOIDmode, -+ cond, label, pc_rtx)); -+ emit_jump_insn (insn); -+ } -+ else -+ { -+ rtx cond, label; -+ -+ result = gen_reg_rtx (mode); -+ -+ emit_move_insn (result, -+ gen_rtx (p_info->test_code_const, mode, cmp0, -+ cmp1)); -+ -+ cond = gen_rtx (NE, mode, result, const0_rtx); -+ label = gen_rtx_LABEL_REF (VOIDmode, destination); -+ -+ emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, -+ gen_rtx_IF_THEN_ELSE (VOIDmode, -+ cond, -+ label, pc_rtx))); -+ } -+ } -+ else -+ { -+ if (register_operand (cmp0, mode) && register_operand (cmp1, mode)) -+ { -+ emit_move_insn (result, -+ gen_rtx (p_info->test_code_reg, mode, cmp0, cmp1)); -+ } -+ else -+ { -+ emit_move_insn (result, -+ gen_rtx (p_info->test_code_const, mode, cmp0, -+ cmp1)); -+ } -+ } -+ -+} -+ -+ -+/* ??? For now conditional moves are only supported -+ when the mode of the operands being compared are -+ the same as the ones being moved */ -+ -+void -+gen_conditional_move (rtx *operands, enum machine_mode mode) -+{ -+ rtx insn, cond; -+ rtx cmp_reg = gen_reg_rtx (mode); -+ enum rtx_code cmp_code = GET_CODE (operands[1]); -+ enum rtx_code move_code = EQ; -+ -+ /* emit a comparison if it is not "simple". -+ Simple comparisons are X eq 0 and X ne 0 */ -+ if ((cmp_code == EQ || cmp_code == NE) && branch_cmp[1] == const0_rtx) -+ { -+ cmp_reg = branch_cmp[0]; -+ move_code = cmp_code; -+ } -+ else if ((cmp_code == EQ || cmp_code == NE) && branch_cmp[0] == const0_rtx) -+ { -+ cmp_reg = branch_cmp[1]; -+ move_code = cmp_code == EQ ? NE : EQ; -+ } -+ else -+ gen_int_relational (cmp_code, cmp_reg, branch_cmp[0], branch_cmp[1], -+ NULL_RTX); -+ -+ cond = gen_rtx (move_code, VOIDmode, cmp_reg, CONST0_RTX (mode)); -+ insn = gen_rtx_SET (mode, operands[0], -+ gen_rtx_IF_THEN_ELSE (mode, -+ cond, operands[2], operands[3])); -+ emit_insn (insn); -+} -+ -+/******************* -+ * Addressing Modes -+ *******************/ -+ -+int -+nios2_legitimate_address (rtx operand, enum machine_mode mode ATTRIBUTE_UNUSED, -+ int strict) -+{ -+ int ret_val = 0; -+ -+ switch (GET_CODE (operand)) -+ { -+ /* direct. */ -+ case SYMBOL_REF: -+ if (SYMBOL_REF_IN_NIOS2_SMALL_DATA_P (operand)) -+ { -+ ret_val = 1; -+ break; -+ } -+ /* else, fall through */ -+ case LABEL_REF: -+ case CONST_INT: -+ case CONST: -+ case CONST_DOUBLE: -+ /* ??? In here I need to add gp addressing */ -+ ret_val = 0; -+ -+ break; -+ -+ /* Register indirect. */ -+ case REG: -+ ret_val = REG_OK_FOR_BASE_P2 (operand, strict); -+ break; -+ -+ /* Register indirect with displacement */ -+ case PLUS: -+ { -+ rtx op0 = XEXP (operand, 0); -+ rtx op1 = XEXP (operand, 1); -+ -+ if (REG_P (op0) && REG_P (op1)) -+ ret_val = 0; -+ else if (REG_P (op0) && CONSTANT_P (op1)) -+ ret_val = REG_OK_FOR_BASE_P2 (op0, strict) -+ && SMALL_INT (INTVAL (op1)); -+ else if (REG_P (op1) && CONSTANT_P (op0)) -+ ret_val = REG_OK_FOR_BASE_P2 (op1, strict) -+ && SMALL_INT (INTVAL (op0)); -+ else -+ ret_val = 0; -+ } -+ break; -+ -+ default: -+ ret_val = 0; -+ break; -+ } -+ -+ return ret_val; -+} -+ -+/* Return true if EXP should be placed in the small data section. */ -+ -+static bool -+nios2_in_small_data_p (tree exp) -+{ -+ /* We want to merge strings, so we never consider them small data. */ -+ if (TREE_CODE (exp) == STRING_CST) -+ return false; -+ -+ if (TREE_CODE (exp) == VAR_DECL && DECL_SECTION_NAME (exp)) -+ { -+ const char *section = TREE_STRING_POINTER (DECL_SECTION_NAME (exp)); -+ /* ??? these string names need moving into -+ an array in some header file */ -+ if (nios2_section_threshold > 0 -+ && (strcmp (section, ".sbss") == 0 -+ || strncmp (section, ".sbss.", 6) == 0 -+ || strcmp (section, ".sdata") == 0 -+ || strncmp (section, ".sdata.", 7) == 0)) -+ return true; -+ } -+ else if (TREE_CODE (exp) == VAR_DECL) -+ { -+ HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (exp)); -+ -+ /* If this is an incomplete type with size 0, then we can't put it -+ in sdata because it might be too big when completed. */ -+ if (size > 0 && size <= nios2_section_threshold) -+ return true; -+ } -+ -+ return false; -+} -+ -+static void -+nios2_encode_section_info (tree decl, rtx rtl, int first) -+{ -+ -+ rtx symbol; -+ int flags; -+ -+ default_encode_section_info (decl, rtl, first); -+ -+ /* Careful not to prod global register variables. */ -+ if (GET_CODE (rtl) != MEM) -+ return; -+ symbol = XEXP (rtl, 0); -+ if (GET_CODE (symbol) != SYMBOL_REF) -+ return; -+ -+ flags = SYMBOL_REF_FLAGS (symbol); -+ -+ /* We don't want weak variables to be addressed with gp in case they end up with -+ value 0 which is not within 2^15 of $gp */ -+ if (DECL_P (decl) && DECL_WEAK (decl)) -+ flags |= SYMBOL_FLAG_WEAK_DECL; -+ -+ SYMBOL_REF_FLAGS (symbol) = flags; -+} -+ -+ -+static unsigned int -+nios2_section_type_flags (tree decl, const char *name, int reloc) -+{ -+ unsigned int flags; -+ -+ flags = default_section_type_flags (decl, name, reloc); -+ -+ /* ??? these string names need moving into an array in some header file */ -+ if (strcmp (name, ".sbss") == 0 -+ || strncmp (name, ".sbss.", 6) == 0 -+ || strcmp (name, ".sdata") == 0 -+ || strncmp (name, ".sdata.", 7) == 0) -+ flags |= SECTION_SMALL; -+ -+ return flags; -+} -+ -+ -+ -+ -+/***************************************** -+ * Defining the Output Assembler Language -+ *****************************************/ -+ -+/* -------------- * -+ * Output of Data -+ * -------------- */ -+ -+ -+/* -------------------------------- * -+ * Output of Assembler Instructions -+ * -------------------------------- */ -+ -+ -+/* print the operand OP to file stream -+ FILE modified by LETTER. LETTER -+ can be one of: -+ i: print "i" if OP is an immediate, except 0 -+ o: print "io" if OP is volatile -+ -+ z: for const0_rtx print $0 instead of 0 -+ H: for %hiadj -+ L: for %lo -+ U: for upper half of 32 bit value -+ */ -+ -+void -+nios2_print_operand (FILE *file, rtx op, int letter) -+{ -+ -+ switch (letter) -+ { -+ case 'i': -+ if (CONSTANT_P (op) && (op != const0_rtx)) -+ fprintf (file, "i"); -+ return; -+ -+ case 'o': -+ if (GET_CODE (op) == MEM -+ && ((MEM_VOLATILE_P (op) && !TARGET_CACHE_VOLATILE) -+ || TARGET_BYPASS_CACHE)) -+ fprintf (file, "io"); -+ return; -+ -+ default: -+ break; -+ } -+ -+ if (comparison_operator (op, VOIDmode)) -+ { -+ if (letter == 0) -+ { -+ fprintf (file, "%s", GET_RTX_NAME (GET_CODE (op))); -+ return; -+ } -+ } -+ -+ -+ switch (GET_CODE (op)) -+ { -+ case REG: -+ if (letter == 0 || letter == 'z') -+ { -+ fprintf (file, "%s", reg_names[REGNO (op)]); -+ return; -+ } -+ -+ case CONST_INT: -+ if (INTVAL (op) == 0 && letter == 'z') -+ { -+ fprintf (file, "zero"); -+ return; -+ } -+ else if (letter == 'U') -+ { -+ HOST_WIDE_INT val = INTVAL (op); -+ rtx new_op; -+ val = (val / 65536) & 0xFFFF; -+ new_op = GEN_INT (val); -+ output_addr_const (file, new_op); -+ return; -+ } -+ -+ /* else, fall through */ -+ case CONST: -+ case LABEL_REF: -+ case SYMBOL_REF: -+ case CONST_DOUBLE: -+ if (letter == 0 || letter == 'z') -+ { -+ output_addr_const (file, op); -+ return; -+ } -+ else if (letter == 'H') -+ { -+ fprintf (file, "%%hiadj("); -+ output_addr_const (file, op); -+ fprintf (file, ")"); -+ return; -+ } -+ else if (letter == 'L') -+ { -+ fprintf (file, "%%lo("); -+ output_addr_const (file, op); -+ fprintf (file, ")"); -+ return; -+ } -+ -+ -+ case SUBREG: -+ case MEM: -+ if (letter == 0) -+ { -+ output_address (op); -+ return; -+ } -+ -+ case CODE_LABEL: -+ if (letter == 0) -+ { -+ output_addr_const (file, op); -+ return; -+ } -+ -+ default: -+ break; -+ } -+ -+ fprintf (stderr, "Missing way to print (%c) ", letter); -+ debug_rtx (op); -+ abort (); -+} -+ -+static int gprel_constant (rtx); -+ -+static int -+gprel_constant (rtx op) -+{ -+ if (GET_CODE (op) == SYMBOL_REF -+ && SYMBOL_REF_IN_NIOS2_SMALL_DATA_P (op)) -+ { -+ return 1; -+ } -+ else if (GET_CODE (op) == CONST -+ && GET_CODE (XEXP (op, 0)) == PLUS) -+ { -+ return gprel_constant (XEXP (XEXP (op, 0), 0)); -+ } -+ else -+ { -+ return 0; -+ } -+} -+ -+void -+nios2_print_operand_address (FILE *file, rtx op) -+{ -+ switch (GET_CODE (op)) -+ { -+ case CONST: -+ case CONST_INT: -+ case LABEL_REF: -+ case CONST_DOUBLE: -+ case SYMBOL_REF: -+ if (gprel_constant (op)) -+ { -+ fprintf (file, "%%gprel("); -+ output_addr_const (file, op); -+ fprintf (file, ")(%s)", reg_names[GP_REGNO]); -+ return; -+ } -+ -+ break; -+ -+ case PLUS: -+ { -+ rtx op0 = XEXP (op, 0); -+ rtx op1 = XEXP (op, 1); -+ -+ if (REG_P (op0) && CONSTANT_P (op1)) -+ { -+ output_addr_const (file, op1); -+ fprintf (file, "(%s)", reg_names[REGNO (op0)]); -+ return; -+ } -+ else if (REG_P (op1) && CONSTANT_P (op0)) -+ { -+ output_addr_const (file, op0); -+ fprintf (file, "(%s)", reg_names[REGNO (op1)]); -+ return; -+ } -+ } -+ break; -+ -+ case REG: -+ fprintf (file, "0(%s)", reg_names[REGNO (op)]); -+ return; -+ -+ case MEM: -+ { -+ rtx base = XEXP (op, 0); -+ PRINT_OPERAND_ADDRESS (file, base); -+ return; -+ } -+ default: -+ break; -+ } -+ -+ fprintf (stderr, "Missing way to print address\n"); -+ debug_rtx (op); -+ abort (); -+} -+ -+ -+ -+ -+ -+/**************************** -+ * Predicates -+ ****************************/ -+ -+int -+arith_operand (rtx op, enum machine_mode mode) -+{ -+ if (GET_CODE (op) == CONST_INT && SMALL_INT (INTVAL (op))) -+ return 1; -+ -+ return register_operand (op, mode); -+} -+ -+int -+uns_arith_operand (rtx op, enum machine_mode mode) -+{ -+ if (GET_CODE (op) == CONST_INT && SMALL_INT_UNSIGNED (INTVAL (op))) -+ return 1; -+ -+ return register_operand (op, mode); -+} -+ -+int -+logical_operand (rtx op, enum machine_mode mode) -+{ -+ if (GET_CODE (op) == CONST_INT -+ && (SMALL_INT_UNSIGNED (INTVAL (op)) || UPPER16_INT (INTVAL (op)))) -+ return 1; -+ -+ return register_operand (op, mode); -+} -+ -+int -+shift_operand (rtx op, enum machine_mode mode) -+{ -+ if (GET_CODE (op) == CONST_INT && SHIFT_INT (INTVAL (op))) -+ return 1; -+ -+ return register_operand (op, mode); -+} -+ -+int -+rdwrctl_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) -+{ -+ return GET_CODE (op) == CONST_INT && RDWRCTL_INT (INTVAL (op)); -+} -+ -+/* Return truth value of whether OP is a register or the constant 0. */ -+ -+int -+reg_or_0_operand (rtx op, enum machine_mode mode) -+{ -+ switch (GET_CODE (op)) -+ { -+ case CONST_INT: -+ return INTVAL (op) == 0; -+ -+ case CONST_DOUBLE: -+ return op == CONST0_RTX (mode); -+ -+ default: -+ break; -+ } -+ -+ return register_operand (op, mode); -+} -+ -+ -+int -+equality_op (rtx op, enum machine_mode mode) -+{ -+ if (mode != GET_MODE (op)) -+ return 0; -+ -+ return GET_CODE (op) == EQ || GET_CODE (op) == NE; -+} -+ -+int -+custom_insn_opcode (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) -+{ -+ return GET_CODE (op) == CONST_INT && CUSTOM_INSN_OPCODE (INTVAL (op)); -+} -+ -+ -+ -+ -+ -+ -+ -+/***************************************************************************** -+** -+** instruction scheduler -+** -+*****************************************************************************/ -+static int -+nios2_use_dfa_pipeline_interface () -+{ -+ return 1; -+} -+ -+ -+static int -+nios2_issue_rate () -+{ -+#ifdef MAX_DFA_ISSUE_RATE -+ return MAX_DFA_ISSUE_RATE; -+#else -+ return 1; -+#endif -+} -+ -+ -+const char * -+asm_output_opcode (FILE *file ATTRIBUTE_UNUSED, -+ const char *ptr ATTRIBUTE_UNUSED) -+{ -+ const char *p; -+ -+ p = ptr; -+ return ptr; -+} -+ -+ -+ -+/***************************************************************************** -+** -+** function arguments -+** -+*****************************************************************************/ -+ -+void -+init_cumulative_args (CUMULATIVE_ARGS *cum, -+ tree fntype ATTRIBUTE_UNUSED, -+ rtx libname ATTRIBUTE_UNUSED, -+ tree fndecl ATTRIBUTE_UNUSED, -+ int n_named_args ATTRIBUTE_UNUSED) -+{ -+ cum->regs_used = 0; -+} -+ -+ -+/* Update the data in CUM to advance over an argument -+ of mode MODE and data type TYPE. -+ (TYPE is null for libcalls where that information may not be available.) */ -+ -+void -+function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, -+ tree type ATTRIBUTE_UNUSED, int named ATTRIBUTE_UNUSED) -+{ -+ HOST_WIDE_INT param_size; -+ -+ if (mode == BLKmode) -+ { -+ param_size = int_size_in_bytes (type); -+ if (param_size < 0) -+ internal_error -+ ("Do not know how to handle large structs or variable length types"); -+ } -+ else -+ { -+ param_size = GET_MODE_SIZE (mode); -+ } -+ -+ /* convert to words (round up) */ -+ param_size = (3 + param_size) / 4; -+ -+ if (cum->regs_used + param_size > NUM_ARG_REGS) -+ { -+ cum->regs_used = NUM_ARG_REGS; -+ } -+ else -+ { -+ cum->regs_used += param_size; -+ } -+ -+ return; -+} -+ -+/* Define where to put the arguments to a function. Value is zero to -+ push the argument on the stack, or a hard register in which to -+ store the argument. -+ -+ MODE is the argument's machine mode. -+ TYPE is the data type of the argument (as a tree). -+ This is null for libcalls where that information may -+ not be available. -+ CUM is a variable of type CUMULATIVE_ARGS which gives info about -+ the preceding args and about the function being called. -+ NAMED is nonzero if this argument is a named parameter -+ (otherwise it is an extra parameter matching an ellipsis). */ -+rtx -+function_arg (const CUMULATIVE_ARGS *cum, enum machine_mode mode, -+ tree type ATTRIBUTE_UNUSED, int named ATTRIBUTE_UNUSED) -+{ -+ rtx return_rtx = NULL_RTX; -+ -+ if (cum->regs_used < NUM_ARG_REGS) -+ { -+ return_rtx = gen_rtx_REG (mode, FIRST_ARG_REGNO + cum->regs_used); -+ } -+ -+ return return_rtx; -+} -+ -+int -+function_arg_partial_nregs (const CUMULATIVE_ARGS *cum, -+ enum machine_mode mode, tree type, -+ int named ATTRIBUTE_UNUSED) -+{ -+ HOST_WIDE_INT param_size; -+ -+ if (mode == BLKmode) -+ { -+ param_size = int_size_in_bytes (type); -+ if (param_size < 0) -+ internal_error -+ ("Do not know how to handle large structs or variable length types"); -+ } -+ else -+ { -+ param_size = GET_MODE_SIZE (mode); -+ } -+ -+ /* convert to words (round up) */ -+ param_size = (3 + param_size) / 4; -+ -+ if (cum->regs_used < NUM_ARG_REGS -+ && cum->regs_used + param_size > NUM_ARG_REGS) -+ { -+ return NUM_ARG_REGS - cum->regs_used; -+ } -+ else -+ { -+ return 0; -+ } -+} -+ -+ -+int -+nios2_return_in_memory (tree type) -+{ -+ int res = ((int_size_in_bytes (type) > (2 * UNITS_PER_WORD)) -+ || (int_size_in_bytes (type) == -1)); -+ -+ return res; -+} -+ -+/* ??? It may be possible to eliminate the copyback and implement -+ my own va_arg type, but that is more work for now. */ -+int -+nios2_setup_incoming_varargs (const CUMULATIVE_ARGS *cum, -+ enum machine_mode mode, tree type, -+ int no_rtl) -+{ -+ CUMULATIVE_ARGS local_cum; -+ int regs_to_push; -+ -+ local_cum = *cum; -+ FUNCTION_ARG_ADVANCE (local_cum, mode, type, 1); -+ -+ regs_to_push = NUM_ARG_REGS - local_cum.regs_used; -+ -+ if (!no_rtl) -+ { -+ if (regs_to_push > 0) -+ { -+ rtx ptr, mem; -+ -+ ptr = virtual_incoming_args_rtx; -+ mem = gen_rtx_MEM (BLKmode, ptr); -+ -+ /* va_arg is an array access in this case, which causes -+ it to get MEM_IN_STRUCT_P set. We must set it here -+ so that the insn scheduler won't assume that these -+ stores can't possibly overlap with the va_arg loads. */ -+ MEM_SET_IN_STRUCT_P (mem, 1); -+ -+ emit_insn (gen_blockage ()); -+ move_block_from_reg (local_cum.regs_used + FIRST_ARG_REGNO, mem, -+ regs_to_push); -+ emit_insn (gen_blockage ()); -+ } -+ } -+ -+ return regs_to_push * UNITS_PER_WORD; -+ -+} -+ -+ -+ -+/***************************************************************************** -+** -+** builtins -+** -+** This method for handling builtins is from CSP where _many_ more types of -+** expanders have already been written. Check there first before writing -+** new ones. -+** -+*****************************************************************************/ -+ -+enum nios2_builtins -+{ -+ NIOS2_BUILTIN_LDBIO, -+ NIOS2_BUILTIN_LDBUIO, -+ NIOS2_BUILTIN_LDHIO, -+ NIOS2_BUILTIN_LDHUIO, -+ NIOS2_BUILTIN_LDWIO, -+ NIOS2_BUILTIN_STBIO, -+ NIOS2_BUILTIN_STHIO, -+ NIOS2_BUILTIN_STWIO, -+ NIOS2_BUILTIN_SYNC, -+ NIOS2_BUILTIN_RDCTL, -+ NIOS2_BUILTIN_WRCTL, -+ -+ NIOS2_BUILTIN_CUSTOM_N, -+ NIOS2_BUILTIN_CUSTOM_NI, -+ NIOS2_BUILTIN_CUSTOM_NF, -+ NIOS2_BUILTIN_CUSTOM_NP, -+ NIOS2_BUILTIN_CUSTOM_NII, -+ NIOS2_BUILTIN_CUSTOM_NIF, -+ NIOS2_BUILTIN_CUSTOM_NIP, -+ NIOS2_BUILTIN_CUSTOM_NFI, -+ NIOS2_BUILTIN_CUSTOM_NFF, -+ NIOS2_BUILTIN_CUSTOM_NFP, -+ NIOS2_BUILTIN_CUSTOM_NPI, -+ NIOS2_BUILTIN_CUSTOM_NPF, -+ NIOS2_BUILTIN_CUSTOM_NPP, -+ NIOS2_BUILTIN_CUSTOM_IN, -+ NIOS2_BUILTIN_CUSTOM_INI, -+ NIOS2_BUILTIN_CUSTOM_INF, -+ NIOS2_BUILTIN_CUSTOM_INP, -+ NIOS2_BUILTIN_CUSTOM_INII, -+ NIOS2_BUILTIN_CUSTOM_INIF, -+ NIOS2_BUILTIN_CUSTOM_INIP, -+ NIOS2_BUILTIN_CUSTOM_INFI, -+ NIOS2_BUILTIN_CUSTOM_INFF, -+ NIOS2_BUILTIN_CUSTOM_INFP, -+ NIOS2_BUILTIN_CUSTOM_INPI, -+ NIOS2_BUILTIN_CUSTOM_INPF, -+ NIOS2_BUILTIN_CUSTOM_INPP, -+ NIOS2_BUILTIN_CUSTOM_FN, -+ NIOS2_BUILTIN_CUSTOM_FNI, -+ NIOS2_BUILTIN_CUSTOM_FNF, -+ NIOS2_BUILTIN_CUSTOM_FNP, -+ NIOS2_BUILTIN_CUSTOM_FNII, -+ NIOS2_BUILTIN_CUSTOM_FNIF, -+ NIOS2_BUILTIN_CUSTOM_FNIP, -+ NIOS2_BUILTIN_CUSTOM_FNFI, -+ NIOS2_BUILTIN_CUSTOM_FNFF, -+ NIOS2_BUILTIN_CUSTOM_FNFP, -+ NIOS2_BUILTIN_CUSTOM_FNPI, -+ NIOS2_BUILTIN_CUSTOM_FNPF, -+ NIOS2_BUILTIN_CUSTOM_FNPP, -+ NIOS2_BUILTIN_CUSTOM_PN, -+ NIOS2_BUILTIN_CUSTOM_PNI, -+ NIOS2_BUILTIN_CUSTOM_PNF, -+ NIOS2_BUILTIN_CUSTOM_PNP, -+ NIOS2_BUILTIN_CUSTOM_PNII, -+ NIOS2_BUILTIN_CUSTOM_PNIF, -+ NIOS2_BUILTIN_CUSTOM_PNIP, -+ NIOS2_BUILTIN_CUSTOM_PNFI, -+ NIOS2_BUILTIN_CUSTOM_PNFF, -+ NIOS2_BUILTIN_CUSTOM_PNFP, -+ NIOS2_BUILTIN_CUSTOM_PNPI, -+ NIOS2_BUILTIN_CUSTOM_PNPF, -+ NIOS2_BUILTIN_CUSTOM_PNPP, -+ -+ -+ LIM_NIOS2_BUILTINS -+}; -+ -+struct builtin_description -+{ -+ const enum insn_code icode; -+ const char *const name; -+ const enum nios2_builtins code; -+ const tree *type; -+ rtx (* expander) PARAMS ((const struct builtin_description *, -+ tree, rtx, rtx, enum machine_mode, int)); -+}; -+ -+static rtx nios2_expand_STXIO (const struct builtin_description *, -+ tree, rtx, rtx, enum machine_mode, int); -+static rtx nios2_expand_LDXIO (const struct builtin_description *, -+ tree, rtx, rtx, enum machine_mode, int); -+static rtx nios2_expand_sync (const struct builtin_description *, -+ tree, rtx, rtx, enum machine_mode, int); -+static rtx nios2_expand_rdctl (const struct builtin_description *, -+ tree, rtx, rtx, enum machine_mode, int); -+static rtx nios2_expand_wrctl (const struct builtin_description *, -+ tree, rtx, rtx, enum machine_mode, int); -+ -+static rtx nios2_expand_custom_n (const struct builtin_description *, -+ tree, rtx, rtx, enum machine_mode, int); -+static rtx nios2_expand_custom_Xn (const struct builtin_description *, -+ tree, rtx, rtx, enum machine_mode, int); -+static rtx nios2_expand_custom_nX (const struct builtin_description *, -+ tree, rtx, rtx, enum machine_mode, int); -+static rtx nios2_expand_custom_XnX (const struct builtin_description *, -+ tree, rtx, rtx, enum machine_mode, int); -+static rtx nios2_expand_custom_nXX (const struct builtin_description *, -+ tree, rtx, rtx, enum machine_mode, int); -+static rtx nios2_expand_custom_XnXX (const struct builtin_description *, -+ tree, rtx, rtx, enum machine_mode, int); -+ -+static tree endlink; -+ -+/* int fn (volatile const void *) -+ */ -+static tree int_ftype_volatile_const_void_p; -+ -+/* int fn (int) -+ */ -+static tree int_ftype_int; -+ -+/* void fn (int, int) -+ */ -+static tree void_ftype_int_int; -+ -+/* void fn (volatile void *, int) -+ */ -+static tree void_ftype_volatile_void_p_int; -+ -+/* void fn (void) -+ */ -+static tree void_ftype_void; -+ -+static tree custom_n; -+static tree custom_ni; -+static tree custom_nf; -+static tree custom_np; -+static tree custom_nii; -+static tree custom_nif; -+static tree custom_nip; -+static tree custom_nfi; -+static tree custom_nff; -+static tree custom_nfp; -+static tree custom_npi; -+static tree custom_npf; -+static tree custom_npp; -+static tree custom_in; -+static tree custom_ini; -+static tree custom_inf; -+static tree custom_inp; -+static tree custom_inii; -+static tree custom_inif; -+static tree custom_inip; -+static tree custom_infi; -+static tree custom_inff; -+static tree custom_infp; -+static tree custom_inpi; -+static tree custom_inpf; -+static tree custom_inpp; -+static tree custom_fn; -+static tree custom_fni; -+static tree custom_fnf; -+static tree custom_fnp; -+static tree custom_fnii; -+static tree custom_fnif; -+static tree custom_fnip; -+static tree custom_fnfi; -+static tree custom_fnff; -+static tree custom_fnfp; -+static tree custom_fnpi; -+static tree custom_fnpf; -+static tree custom_fnpp; -+static tree custom_pn; -+static tree custom_pni; -+static tree custom_pnf; -+static tree custom_pnp; -+static tree custom_pnii; -+static tree custom_pnif; -+static tree custom_pnip; -+static tree custom_pnfi; -+static tree custom_pnff; -+static tree custom_pnfp; -+static tree custom_pnpi; -+static tree custom_pnpf; -+static tree custom_pnpp; -+ -+ -+static const struct builtin_description bdesc[] = { -+ {CODE_FOR_ldbio, "__builtin_ldbio", NIOS2_BUILTIN_LDBIO, &int_ftype_volatile_const_void_p, nios2_expand_LDXIO}, -+ {CODE_FOR_ldbuio, "__builtin_ldbuio", NIOS2_BUILTIN_LDBUIO, &int_ftype_volatile_const_void_p, nios2_expand_LDXIO}, -+ {CODE_FOR_ldhio, "__builtin_ldhio", NIOS2_BUILTIN_LDHIO, &int_ftype_volatile_const_void_p, nios2_expand_LDXIO}, -+ {CODE_FOR_ldhuio, "__builtin_ldhuio", NIOS2_BUILTIN_LDHUIO, &int_ftype_volatile_const_void_p, nios2_expand_LDXIO}, -+ {CODE_FOR_ldwio, "__builtin_ldwio", NIOS2_BUILTIN_LDWIO, &int_ftype_volatile_const_void_p, nios2_expand_LDXIO}, -+ -+ {CODE_FOR_stbio, "__builtin_stbio", NIOS2_BUILTIN_STBIO, &void_ftype_volatile_void_p_int, nios2_expand_STXIO}, -+ {CODE_FOR_sthio, "__builtin_sthio", NIOS2_BUILTIN_STHIO, &void_ftype_volatile_void_p_int, nios2_expand_STXIO}, -+ {CODE_FOR_stwio, "__builtin_stwio", NIOS2_BUILTIN_STWIO, &void_ftype_volatile_void_p_int, nios2_expand_STXIO}, -+ -+ {CODE_FOR_sync, "__builtin_sync", NIOS2_BUILTIN_SYNC, &void_ftype_void, nios2_expand_sync}, -+ {CODE_FOR_rdctl, "__builtin_rdctl", NIOS2_BUILTIN_RDCTL, &int_ftype_int, nios2_expand_rdctl}, -+ {CODE_FOR_wrctl, "__builtin_wrctl", NIOS2_BUILTIN_WRCTL, &void_ftype_int_int, nios2_expand_wrctl}, -+ -+ {CODE_FOR_custom_n, "__builtin_custom_n", NIOS2_BUILTIN_CUSTOM_N, &custom_n, nios2_expand_custom_n}, -+ {CODE_FOR_custom_ni, "__builtin_custom_ni", NIOS2_BUILTIN_CUSTOM_NI, &custom_ni, nios2_expand_custom_nX}, -+ {CODE_FOR_custom_nf, "__builtin_custom_nf", NIOS2_BUILTIN_CUSTOM_NF, &custom_nf, nios2_expand_custom_nX}, -+ {CODE_FOR_custom_np, "__builtin_custom_np", NIOS2_BUILTIN_CUSTOM_NP, &custom_np, nios2_expand_custom_nX}, -+ {CODE_FOR_custom_nii, "__builtin_custom_nii", NIOS2_BUILTIN_CUSTOM_NII, &custom_nii, nios2_expand_custom_nXX}, -+ {CODE_FOR_custom_nif, "__builtin_custom_nif", NIOS2_BUILTIN_CUSTOM_NIF, &custom_nif, nios2_expand_custom_nXX}, -+ {CODE_FOR_custom_nip, "__builtin_custom_nip", NIOS2_BUILTIN_CUSTOM_NIP, &custom_nip, nios2_expand_custom_nXX}, -+ {CODE_FOR_custom_nfi, "__builtin_custom_nfi", NIOS2_BUILTIN_CUSTOM_NFI, &custom_nfi, nios2_expand_custom_nXX}, -+ {CODE_FOR_custom_nff, "__builtin_custom_nff", NIOS2_BUILTIN_CUSTOM_NFF, &custom_nff, nios2_expand_custom_nXX}, -+ {CODE_FOR_custom_nfp, "__builtin_custom_nfp", NIOS2_BUILTIN_CUSTOM_NFP, &custom_nfp, nios2_expand_custom_nXX}, -+ {CODE_FOR_custom_npi, "__builtin_custom_npi", NIOS2_BUILTIN_CUSTOM_NPI, &custom_npi, nios2_expand_custom_nXX}, -+ {CODE_FOR_custom_npf, "__builtin_custom_npf", NIOS2_BUILTIN_CUSTOM_NPF, &custom_npf, nios2_expand_custom_nXX}, -+ {CODE_FOR_custom_npp, "__builtin_custom_npp", NIOS2_BUILTIN_CUSTOM_NPP, &custom_npp, nios2_expand_custom_nXX}, -+ {CODE_FOR_custom_in, "__builtin_custom_in", NIOS2_BUILTIN_CUSTOM_IN, &custom_in, nios2_expand_custom_Xn}, -+ {CODE_FOR_custom_ini, "__builtin_custom_ini", NIOS2_BUILTIN_CUSTOM_INI, &custom_ini, nios2_expand_custom_XnX}, -+ {CODE_FOR_custom_inf, "__builtin_custom_inf", NIOS2_BUILTIN_CUSTOM_INF, &custom_inf, nios2_expand_custom_XnX}, -+ {CODE_FOR_custom_inp, "__builtin_custom_inp", NIOS2_BUILTIN_CUSTOM_INP, &custom_inp, nios2_expand_custom_XnX}, -+ {CODE_FOR_custom_inii, "__builtin_custom_inii", NIOS2_BUILTIN_CUSTOM_INII, &custom_inii, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_inif, "__builtin_custom_inif", NIOS2_BUILTIN_CUSTOM_INIF, &custom_inif, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_inip, "__builtin_custom_inip", NIOS2_BUILTIN_CUSTOM_INIP, &custom_inip, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_infi, "__builtin_custom_infi", NIOS2_BUILTIN_CUSTOM_INFI, &custom_infi, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_inff, "__builtin_custom_inff", NIOS2_BUILTIN_CUSTOM_INFF, &custom_inff, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_infp, "__builtin_custom_infp", NIOS2_BUILTIN_CUSTOM_INFP, &custom_infp, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_inpi, "__builtin_custom_inpi", NIOS2_BUILTIN_CUSTOM_INPI, &custom_inpi, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_inpf, "__builtin_custom_inpf", NIOS2_BUILTIN_CUSTOM_INPF, &custom_inpf, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_inpp, "__builtin_custom_inpp", NIOS2_BUILTIN_CUSTOM_INPP, &custom_inpp, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_fn, "__builtin_custom_fn", NIOS2_BUILTIN_CUSTOM_FN, &custom_fn, nios2_expand_custom_Xn}, -+ {CODE_FOR_custom_fni, "__builtin_custom_fni", NIOS2_BUILTIN_CUSTOM_FNI, &custom_fni, nios2_expand_custom_XnX}, -+ {CODE_FOR_custom_fnf, "__builtin_custom_fnf", NIOS2_BUILTIN_CUSTOM_FNF, &custom_fnf, nios2_expand_custom_XnX}, -+ {CODE_FOR_custom_fnp, "__builtin_custom_fnp", NIOS2_BUILTIN_CUSTOM_FNP, &custom_fnp, nios2_expand_custom_XnX}, -+ {CODE_FOR_custom_fnii, "__builtin_custom_fnii", NIOS2_BUILTIN_CUSTOM_FNII, &custom_fnii, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_fnif, "__builtin_custom_fnif", NIOS2_BUILTIN_CUSTOM_FNIF, &custom_fnif, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_fnip, "__builtin_custom_fnip", NIOS2_BUILTIN_CUSTOM_FNIP, &custom_fnip, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_fnfi, "__builtin_custom_fnfi", NIOS2_BUILTIN_CUSTOM_FNFI, &custom_fnfi, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_fnff, "__builtin_custom_fnff", NIOS2_BUILTIN_CUSTOM_FNFF, &custom_fnff, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_fnfp, "__builtin_custom_fnfp", NIOS2_BUILTIN_CUSTOM_FNFP, &custom_fnfp, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_fnpi, "__builtin_custom_fnpi", NIOS2_BUILTIN_CUSTOM_FNPI, &custom_fnpi, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_fnpf, "__builtin_custom_fnpf", NIOS2_BUILTIN_CUSTOM_FNPF, &custom_fnpf, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_fnpp, "__builtin_custom_fnpp", NIOS2_BUILTIN_CUSTOM_FNPP, &custom_fnpp, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_pn, "__builtin_custom_pn", NIOS2_BUILTIN_CUSTOM_PN, &custom_pn, nios2_expand_custom_Xn}, -+ {CODE_FOR_custom_pni, "__builtin_custom_pni", NIOS2_BUILTIN_CUSTOM_PNI, &custom_pni, nios2_expand_custom_XnX}, -+ {CODE_FOR_custom_pnf, "__builtin_custom_pnf", NIOS2_BUILTIN_CUSTOM_PNF, &custom_pnf, nios2_expand_custom_XnX}, -+ {CODE_FOR_custom_pnp, "__builtin_custom_pnp", NIOS2_BUILTIN_CUSTOM_PNP, &custom_pnp, nios2_expand_custom_XnX}, -+ {CODE_FOR_custom_pnii, "__builtin_custom_pnii", NIOS2_BUILTIN_CUSTOM_PNII, &custom_pnii, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_pnif, "__builtin_custom_pnif", NIOS2_BUILTIN_CUSTOM_PNIF, &custom_pnif, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_pnip, "__builtin_custom_pnip", NIOS2_BUILTIN_CUSTOM_PNIP, &custom_pnip, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_pnfi, "__builtin_custom_pnfi", NIOS2_BUILTIN_CUSTOM_PNFI, &custom_pnfi, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_pnff, "__builtin_custom_pnff", NIOS2_BUILTIN_CUSTOM_PNFF, &custom_pnff, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_pnfp, "__builtin_custom_pnfp", NIOS2_BUILTIN_CUSTOM_PNFP, &custom_pnfp, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_pnpi, "__builtin_custom_pnpi", NIOS2_BUILTIN_CUSTOM_PNPI, &custom_pnpi, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_pnpf, "__builtin_custom_pnpf", NIOS2_BUILTIN_CUSTOM_PNPF, &custom_pnpf, nios2_expand_custom_XnXX}, -+ {CODE_FOR_custom_pnpp, "__builtin_custom_pnpp", NIOS2_BUILTIN_CUSTOM_PNPP, &custom_pnpp, nios2_expand_custom_XnXX}, -+ -+ -+ {0, 0, 0, 0, 0}, -+}; -+ -+/* This does not have a closing bracket on purpose (see use) */ -+#define def_param(TYPE) \ -+ tree_cons (NULL_TREE, TYPE, -+ -+static void -+nios2_init_builtins () -+{ -+ const struct builtin_description *d; -+ -+ -+ endlink = void_list_node; -+ -+ /* Special indenting here because one of the brackets is in def_param */ -+ /* *INDENT-OFF* */ -+ -+ /* int fn (volatile const void *) -+ */ -+ int_ftype_volatile_const_void_p -+ = build_function_type (integer_type_node, -+ def_param (build_qualified_type (ptr_type_node, -+ TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) -+ endlink)); -+ -+ -+ /* void fn (volatile void *, int) -+ */ -+ void_ftype_volatile_void_p_int -+ = build_function_type (void_type_node, -+ def_param (build_qualified_type (ptr_type_node, -+ TYPE_QUAL_VOLATILE)) -+ def_param (integer_type_node) -+ endlink))); -+ -+ /* void fn (void) -+ */ -+ void_ftype_void -+ = build_function_type (void_type_node, -+ endlink); -+ -+ /* int fn (int) -+ */ -+ int_ftype_int -+ = build_function_type (integer_type_node, -+ def_param (integer_type_node) -+ endlink)); -+ -+ /* void fn (int, int) -+ */ -+ void_ftype_int_int -+ = build_function_type (void_type_node, -+ def_param (integer_type_node) -+ def_param (integer_type_node) -+ endlink))); -+ -+ -+#define CUSTOM_NUM def_param (integer_type_node) -+ -+ custom_n -+ = build_function_type (void_type_node, -+ CUSTOM_NUM -+ endlink)); -+ custom_ni -+ = build_function_type (void_type_node, -+ CUSTOM_NUM -+ def_param (integer_type_node) -+ endlink))); -+ custom_nf -+ = build_function_type (void_type_node, -+ CUSTOM_NUM -+ def_param (float_type_node) -+ endlink))); -+ custom_np -+ = build_function_type (void_type_node, -+ CUSTOM_NUM -+ def_param (ptr_type_node) -+ endlink))); -+ custom_nii -+ = build_function_type (void_type_node, -+ CUSTOM_NUM -+ def_param (integer_type_node) -+ def_param (integer_type_node) -+ endlink)))); -+ custom_nif -+ = build_function_type (void_type_node, -+ CUSTOM_NUM -+ def_param (integer_type_node) -+ def_param (float_type_node) -+ endlink)))); -+ custom_nip -+ = build_function_type (void_type_node, -+ CUSTOM_NUM -+ def_param (integer_type_node) -+ def_param (ptr_type_node) -+ endlink)))); -+ custom_nfi -+ = build_function_type (void_type_node, -+ CUSTOM_NUM -+ def_param (float_type_node) -+ def_param (integer_type_node) -+ endlink)))); -+ custom_nff -+ = build_function_type (void_type_node, -+ CUSTOM_NUM -+ def_param (float_type_node) -+ def_param (float_type_node) -+ endlink)))); -+ custom_nfp -+ = build_function_type (void_type_node, -+ CUSTOM_NUM -+ def_param (float_type_node) -+ def_param (ptr_type_node) -+ endlink)))); -+ custom_npi -+ = build_function_type (void_type_node, -+ CUSTOM_NUM -+ def_param (ptr_type_node) -+ def_param (integer_type_node) -+ endlink)))); -+ custom_npf -+ = build_function_type (void_type_node, -+ CUSTOM_NUM -+ def_param (ptr_type_node) -+ def_param (float_type_node) -+ endlink)))); -+ custom_npp -+ = build_function_type (void_type_node, -+ CUSTOM_NUM -+ def_param (ptr_type_node) -+ def_param (ptr_type_node) -+ endlink)))); -+ -+ custom_in -+ = build_function_type (integer_type_node, -+ CUSTOM_NUM -+ endlink)); -+ custom_ini -+ = build_function_type (integer_type_node, -+ CUSTOM_NUM -+ def_param (integer_type_node) -+ endlink))); -+ custom_inf -+ = build_function_type (integer_type_node, -+ CUSTOM_NUM -+ def_param (float_type_node) -+ endlink))); -+ custom_inp -+ = build_function_type (integer_type_node, -+ CUSTOM_NUM -+ def_param (ptr_type_node) -+ endlink))); -+ custom_inii -+ = build_function_type (integer_type_node, -+ CUSTOM_NUM -+ def_param (integer_type_node) -+ def_param (integer_type_node) -+ endlink)))); -+ custom_inif -+ = build_function_type (integer_type_node, -+ CUSTOM_NUM -+ def_param (integer_type_node) -+ def_param (float_type_node) -+ endlink)))); -+ custom_inip -+ = build_function_type (integer_type_node, -+ CUSTOM_NUM -+ def_param (integer_type_node) -+ def_param (ptr_type_node) -+ endlink)))); -+ custom_infi -+ = build_function_type (integer_type_node, -+ CUSTOM_NUM -+ def_param (float_type_node) -+ def_param (integer_type_node) -+ endlink)))); -+ custom_inff -+ = build_function_type (integer_type_node, -+ CUSTOM_NUM -+ def_param (float_type_node) -+ def_param (float_type_node) -+ endlink)))); -+ custom_infp -+ = build_function_type (integer_type_node, -+ CUSTOM_NUM -+ def_param (float_type_node) -+ def_param (ptr_type_node) -+ endlink)))); -+ custom_inpi -+ = build_function_type (integer_type_node, -+ CUSTOM_NUM -+ def_param (ptr_type_node) -+ def_param (integer_type_node) -+ endlink)))); -+ custom_inpf -+ = build_function_type (integer_type_node, -+ CUSTOM_NUM -+ def_param (ptr_type_node) -+ def_param (float_type_node) -+ endlink)))); -+ custom_inpp -+ = build_function_type (integer_type_node, -+ CUSTOM_NUM -+ def_param (ptr_type_node) -+ def_param (ptr_type_node) -+ endlink)))); -+ -+ custom_fn -+ = build_function_type (float_type_node, -+ CUSTOM_NUM -+ endlink)); -+ custom_fni -+ = build_function_type (float_type_node, -+ CUSTOM_NUM -+ def_param (integer_type_node) -+ endlink))); -+ custom_fnf -+ = build_function_type (float_type_node, -+ CUSTOM_NUM -+ def_param (float_type_node) -+ endlink))); -+ custom_fnp -+ = build_function_type (float_type_node, -+ CUSTOM_NUM -+ def_param (ptr_type_node) -+ endlink))); -+ custom_fnii -+ = build_function_type (float_type_node, -+ CUSTOM_NUM -+ def_param (integer_type_node) -+ def_param (integer_type_node) -+ endlink)))); -+ custom_fnif -+ = build_function_type (float_type_node, -+ CUSTOM_NUM -+ def_param (integer_type_node) -+ def_param (float_type_node) -+ endlink)))); -+ custom_fnip -+ = build_function_type (float_type_node, -+ CUSTOM_NUM -+ def_param (integer_type_node) -+ def_param (ptr_type_node) -+ endlink)))); -+ custom_fnfi -+ = build_function_type (float_type_node, -+ CUSTOM_NUM -+ def_param (float_type_node) -+ def_param (integer_type_node) -+ endlink)))); -+ custom_fnff -+ = build_function_type (float_type_node, -+ CUSTOM_NUM -+ def_param (float_type_node) -+ def_param (float_type_node) -+ endlink)))); -+ custom_fnfp -+ = build_function_type (float_type_node, -+ CUSTOM_NUM -+ def_param (float_type_node) -+ def_param (ptr_type_node) -+ endlink)))); -+ custom_fnpi -+ = build_function_type (float_type_node, -+ CUSTOM_NUM -+ def_param (ptr_type_node) -+ def_param (integer_type_node) -+ endlink)))); -+ custom_fnpf -+ = build_function_type (float_type_node, -+ CUSTOM_NUM -+ def_param (ptr_type_node) -+ def_param (float_type_node) -+ endlink)))); -+ custom_fnpp -+ = build_function_type (float_type_node, -+ CUSTOM_NUM -+ def_param (ptr_type_node) -+ def_param (ptr_type_node) -+ endlink)))); -+ -+ -+ custom_pn -+ = build_function_type (ptr_type_node, -+ CUSTOM_NUM -+ endlink)); -+ custom_pni -+ = build_function_type (ptr_type_node, -+ CUSTOM_NUM -+ def_param (integer_type_node) -+ endlink))); -+ custom_pnf -+ = build_function_type (ptr_type_node, -+ CUSTOM_NUM -+ def_param (float_type_node) -+ endlink))); -+ custom_pnp -+ = build_function_type (ptr_type_node, -+ CUSTOM_NUM -+ def_param (ptr_type_node) -+ endlink))); -+ custom_pnii -+ = build_function_type (ptr_type_node, -+ CUSTOM_NUM -+ def_param (integer_type_node) -+ def_param (integer_type_node) -+ endlink)))); -+ custom_pnif -+ = build_function_type (ptr_type_node, -+ CUSTOM_NUM -+ def_param (integer_type_node) -+ def_param (float_type_node) -+ endlink)))); -+ custom_pnip -+ = build_function_type (ptr_type_node, -+ CUSTOM_NUM -+ def_param (integer_type_node) -+ def_param (ptr_type_node) -+ endlink)))); -+ custom_pnfi -+ = build_function_type (ptr_type_node, -+ CUSTOM_NUM -+ def_param (float_type_node) -+ def_param (integer_type_node) -+ endlink)))); -+ custom_pnff -+ = build_function_type (ptr_type_node, -+ CUSTOM_NUM -+ def_param (float_type_node) -+ def_param (float_type_node) -+ endlink)))); -+ custom_pnfp -+ = build_function_type (ptr_type_node, -+ CUSTOM_NUM -+ def_param (float_type_node) -+ def_param (ptr_type_node) -+ endlink)))); -+ custom_pnpi -+ = build_function_type (ptr_type_node, -+ CUSTOM_NUM -+ def_param (ptr_type_node) -+ def_param (integer_type_node) -+ endlink)))); -+ custom_pnpf -+ = build_function_type (ptr_type_node, -+ CUSTOM_NUM -+ def_param (ptr_type_node) -+ def_param (float_type_node) -+ endlink)))); -+ custom_pnpp -+ = build_function_type (ptr_type_node, -+ CUSTOM_NUM -+ def_param (ptr_type_node) -+ def_param (ptr_type_node) -+ endlink)))); -+ -+ -+ -+ /* *INDENT-ON* */ -+ -+ -+ for (d = bdesc; d->name; d++) -+ { -+ builtin_function (d->name, *d->type, d->code, -+ BUILT_IN_MD, NULL, NULL); -+ } -+} -+ -+/* Expand an expression EXP that calls a built-in function, -+ with result going to TARGET if that's convenient -+ (and in mode MODE if that's convenient). -+ SUBTARGET may be used as the target for computing one of EXP's operands. -+ IGNORE is nonzero if the value is to be ignored. */ -+ -+static rtx -+nios2_expand_builtin (tree exp, rtx target, rtx subtarget, -+ enum machine_mode mode, int ignore) -+{ -+ const struct builtin_description *d; -+ tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); -+ unsigned int fcode = DECL_FUNCTION_CODE (fndecl); -+ -+ for (d = bdesc; d->name; d++) -+ if (d->code == fcode) -+ return (d->expander) (d, exp, target, subtarget, mode, ignore); -+ -+ /* we should have seen one of the functins we registered */ -+ abort (); -+} -+ -+static rtx nios2_create_target (const struct builtin_description *, rtx); -+ -+ -+static rtx -+nios2_create_target (const struct builtin_description *d, rtx target) -+{ -+ if (!target -+ || !(*insn_data[d->icode].operand[0].predicate) (target, -+ insn_data[d->icode].operand[0].mode)) -+ { -+ target = gen_reg_rtx (insn_data[d->icode].operand[0].mode); -+ } -+ -+ return target; -+} -+ -+ -+static rtx nios2_extract_opcode (const struct builtin_description *, int, tree); -+static rtx nios2_extract_operand (const struct builtin_description *, int, int, tree); -+ -+static rtx -+nios2_extract_opcode (const struct builtin_description *d, int op, tree arglist) -+{ -+ enum machine_mode mode = insn_data[d->icode].operand[op].mode; -+ tree arg = TREE_VALUE (arglist); -+ rtx opcode = expand_expr (arg, NULL_RTX, mode, 0); -+ opcode = protect_from_queue (opcode, 0); -+ -+ if (!(*insn_data[d->icode].operand[op].predicate) (opcode, mode)) -+ error ("Custom instruction opcode must be compile time constant in the range 0-255 for %s", d->name); -+ -+ return opcode; -+} -+ -+static rtx -+nios2_extract_operand (const struct builtin_description *d, int op, int argnum, tree arglist) -+{ -+ enum machine_mode mode = insn_data[d->icode].operand[op].mode; -+ tree arg = TREE_VALUE (arglist); -+ rtx operand = expand_expr (arg, NULL_RTX, mode, 0); -+ operand = protect_from_queue (operand, 0); -+ -+ if (!(*insn_data[d->icode].operand[op].predicate) (operand, mode)) -+ operand = copy_to_mode_reg (mode, operand); -+ -+ /* ??? Better errors would be nice */ -+ if (!(*insn_data[d->icode].operand[op].predicate) (operand, mode)) -+ error ("Invalid argument %d to %s", argnum, d->name); -+ -+ return operand; -+} -+ -+ -+static rtx -+nios2_expand_custom_n (const struct builtin_description *d, tree exp, -+ rtx target ATTRIBUTE_UNUSED, rtx subtarget ATTRIBUTE_UNUSED, -+ enum machine_mode mode ATTRIBUTE_UNUSED, int ignore ATTRIBUTE_UNUSED) -+{ -+ tree arglist = TREE_OPERAND (exp, 1); -+ rtx pat; -+ rtx opcode; -+ -+ /* custom_n should have exactly one operand */ -+ if (insn_data[d->icode].n_operands != 1) -+ abort (); -+ -+ opcode = nios2_extract_opcode (d, 0, arglist); -+ -+ pat = GEN_FCN (d->icode) (opcode); -+ if (!pat) -+ return 0; -+ emit_insn (pat); -+ return 0; -+} -+ -+static rtx -+nios2_expand_custom_Xn (const struct builtin_description *d, tree exp, -+ rtx target, rtx subtarget ATTRIBUTE_UNUSED, -+ enum machine_mode mode ATTRIBUTE_UNUSED, -+ int ignore ATTRIBUTE_UNUSED) -+{ -+ tree arglist = TREE_OPERAND (exp, 1); -+ rtx pat; -+ rtx opcode; -+ -+ /* custom_Xn should have exactly two operands */ -+ if (insn_data[d->icode].n_operands != 2) -+ abort (); -+ -+ target = nios2_create_target (d, target); -+ opcode = nios2_extract_opcode (d, 1, arglist); -+ -+ pat = GEN_FCN (d->icode) (target, opcode); -+ if (!pat) -+ return 0; -+ emit_insn (pat); -+ return target; -+} -+ -+static rtx -+nios2_expand_custom_nX (const struct builtin_description *d, tree exp, -+ rtx target ATTRIBUTE_UNUSED, rtx subtarget ATTRIBUTE_UNUSED, -+ enum machine_mode mode ATTRIBUTE_UNUSED, int ignore ATTRIBUTE_UNUSED) -+{ -+ tree arglist = TREE_OPERAND (exp, 1); -+ rtx pat; -+ rtx opcode; -+ rtx operands[1]; -+ int i; -+ -+ -+ /* custom_nX should have exactly two operands */ -+ if (insn_data[d->icode].n_operands != 2) -+ abort (); -+ -+ opcode = nios2_extract_opcode (d, 0, arglist); -+ for (i = 0; i < 1; i++) -+ { -+ arglist = TREE_CHAIN (arglist); -+ operands[i] = nios2_extract_operand (d, i + 1, i + 1, arglist); -+ } -+ -+ pat = GEN_FCN (d->icode) (opcode, operands[0]); -+ if (!pat) -+ return 0; -+ emit_insn (pat); -+ return 0; -+} -+ -+static rtx -+nios2_expand_custom_XnX (const struct builtin_description *d, tree exp, rtx target, -+ rtx subtarget ATTRIBUTE_UNUSED, enum machine_mode mode ATTRIBUTE_UNUSED, -+ int ignore ATTRIBUTE_UNUSED) -+{ -+ tree arglist = TREE_OPERAND (exp, 1); -+ rtx pat; -+ rtx opcode; -+ rtx operands[1]; -+ int i; -+ -+ /* custom_Xn should have exactly three operands */ -+ if (insn_data[d->icode].n_operands != 3) -+ abort (); -+ -+ target = nios2_create_target (d, target); -+ opcode = nios2_extract_opcode (d, 1, arglist); -+ -+ for (i = 0; i < 1; i++) -+ { -+ arglist = TREE_CHAIN (arglist); -+ operands[i] = nios2_extract_operand (d, i + 2, i + 1, arglist); -+ } -+ -+ pat = GEN_FCN (d->icode) (target, opcode, operands[0]); -+ -+ if (!pat) -+ return 0; -+ emit_insn (pat); -+ return target; -+} -+ -+static rtx -+nios2_expand_custom_nXX (const struct builtin_description *d, tree exp, rtx target ATTRIBUTE_UNUSED, -+ rtx subtarget ATTRIBUTE_UNUSED, enum machine_mode mode ATTRIBUTE_UNUSED, -+ int ignore ATTRIBUTE_UNUSED) -+{ -+ tree arglist = TREE_OPERAND (exp, 1); -+ rtx pat; -+ rtx opcode; -+ rtx operands[2]; -+ int i; -+ -+ -+ /* custom_nX should have exactly three operands */ -+ if (insn_data[d->icode].n_operands != 3) -+ abort (); -+ -+ opcode = nios2_extract_opcode (d, 0, arglist); -+ for (i = 0; i < 2; i++) -+ { -+ arglist = TREE_CHAIN (arglist); -+ operands[i] = nios2_extract_operand (d, i + 1, i + 1, arglist); -+ } -+ -+ pat = GEN_FCN (d->icode) (opcode, operands[0], operands[1]); -+ if (!pat) -+ return 0; -+ emit_insn (pat); -+ return 0; -+} -+ -+static rtx -+nios2_expand_custom_XnXX (const struct builtin_description *d, tree exp, rtx target, -+ rtx subtarget ATTRIBUTE_UNUSED, enum machine_mode mode ATTRIBUTE_UNUSED, -+ int ignore ATTRIBUTE_UNUSED) -+{ -+ tree arglist = TREE_OPERAND (exp, 1); -+ rtx pat; -+ rtx opcode; -+ rtx operands[2]; -+ int i; -+ -+ -+ /* custom_XnX should have exactly four operands */ -+ if (insn_data[d->icode].n_operands != 4) -+ abort (); -+ -+ target = nios2_create_target (d, target); -+ opcode = nios2_extract_opcode (d, 1, arglist); -+ for (i = 0; i < 2; i++) -+ { -+ arglist = TREE_CHAIN (arglist); -+ operands[i] = nios2_extract_operand (d, i + 2, i + 1, arglist); -+ } -+ -+ pat = GEN_FCN (d->icode) (target, opcode, operands[0], operands[1]); -+ -+ if (!pat) -+ return 0; -+ emit_insn (pat); -+ return target; -+} -+ -+ -+ -+static rtx -+nios2_expand_STXIO (const struct builtin_description *d, tree exp, rtx target ATTRIBUTE_UNUSED, -+ rtx subtarget ATTRIBUTE_UNUSED, enum machine_mode mode ATTRIBUTE_UNUSED, -+ int ignore ATTRIBUTE_UNUSED) -+{ -+ tree arglist = TREE_OPERAND (exp, 1); -+ rtx pat; -+ rtx store_dest, store_val; -+ enum insn_code icode = d->icode; -+ -+ /* stores should have exactly two operands */ -+ if (insn_data[icode].n_operands != 2) -+ abort (); -+ -+ /* process the destination of the store */ -+ { -+ enum machine_mode mode = insn_data[icode].operand[0].mode; -+ tree arg = TREE_VALUE (arglist); -+ store_dest = expand_expr (arg, NULL_RTX, VOIDmode, 0); -+ store_dest = protect_from_queue (store_dest, 0); -+ -+ store_dest = gen_rtx_MEM (mode, copy_to_mode_reg (Pmode, store_dest)); -+ -+ /* ??? Better errors would be nice */ -+ if (!(*insn_data[icode].operand[0].predicate) (store_dest, mode)) -+ error ("Invalid argument 1 to %s", d->name); -+ } -+ -+ -+ /* process the value to store */ -+ { -+ enum machine_mode mode = insn_data[icode].operand[1].mode; -+ tree arg = TREE_VALUE (TREE_CHAIN (arglist)); -+ store_val = expand_expr (arg, NULL_RTX, mode, 0); -+ store_val = protect_from_queue (store_val, 0); -+ -+ if (!(*insn_data[icode].operand[1].predicate) (store_val, mode)) -+ store_val = copy_to_mode_reg (mode, store_val); -+ -+ /* ??? Better errors would be nice */ -+ if (!(*insn_data[icode].operand[1].predicate) (store_val, mode)) -+ error ("Invalid argument 2 to %s", d->name); -+ } -+ -+ pat = GEN_FCN (d->icode) (store_dest, store_val); -+ if (!pat) -+ return 0; -+ emit_insn (pat); -+ return 0; -+} -+ -+ -+static rtx -+nios2_expand_LDXIO (const struct builtin_description * d, tree exp, rtx target, -+ rtx subtarget ATTRIBUTE_UNUSED, enum machine_mode mode ATTRIBUTE_UNUSED, -+ int ignore ATTRIBUTE_UNUSED) -+{ -+ tree arglist = TREE_OPERAND (exp, 1); -+ rtx pat; -+ rtx ld_src; -+ enum insn_code icode = d->icode; -+ -+ /* loads should have exactly two operands */ -+ if (insn_data[icode].n_operands != 2) -+ abort (); -+ -+ target = nios2_create_target (d, target); -+ -+ { -+ enum machine_mode mode = insn_data[icode].operand[1].mode; -+ tree arg = TREE_VALUE (arglist); -+ ld_src = expand_expr (arg, NULL_RTX, VOIDmode, 0); -+ ld_src = protect_from_queue (ld_src, 0); -+ -+ ld_src = gen_rtx_MEM (mode, copy_to_mode_reg (Pmode, ld_src)); -+ -+ /* ??? Better errors would be nice */ -+ if (!(*insn_data[icode].operand[1].predicate) (ld_src, mode)) -+ { -+ error ("Invalid argument 1 to %s", d->name); -+ } -+ } -+ -+ pat = GEN_FCN (d->icode) (target, ld_src); -+ if (!pat) -+ return 0; -+ emit_insn (pat); -+ return target; -+} -+ -+ -+static rtx -+nios2_expand_sync (const struct builtin_description * d ATTRIBUTE_UNUSED, -+ tree exp ATTRIBUTE_UNUSED, rtx target ATTRIBUTE_UNUSED, -+ rtx subtarget ATTRIBUTE_UNUSED, -+ enum machine_mode mode ATTRIBUTE_UNUSED, -+ int ignore ATTRIBUTE_UNUSED) -+{ -+ emit_insn (gen_sync ()); -+ return 0; -+} -+ -+static rtx -+nios2_expand_rdctl (const struct builtin_description * d ATTRIBUTE_UNUSED, -+ tree exp ATTRIBUTE_UNUSED, rtx target ATTRIBUTE_UNUSED, -+ rtx subtarget ATTRIBUTE_UNUSED, -+ enum machine_mode mode ATTRIBUTE_UNUSED, -+ int ignore ATTRIBUTE_UNUSED) -+{ -+ tree arglist = TREE_OPERAND (exp, 1); -+ rtx pat; -+ rtx rdctl_reg; -+ enum insn_code icode = d->icode; -+ -+ /* rdctl should have exactly two operands */ -+ if (insn_data[icode].n_operands != 2) -+ abort (); -+ -+ target = nios2_create_target (d, target); -+ -+ { -+ enum machine_mode mode = insn_data[icode].operand[1].mode; -+ tree arg = TREE_VALUE (arglist); -+ rdctl_reg = expand_expr (arg, NULL_RTX, VOIDmode, 0); -+ rdctl_reg = protect_from_queue (rdctl_reg, 0); -+ -+ if (!(*insn_data[icode].operand[1].predicate) (rdctl_reg, mode)) -+ { -+ error ("Control register number must be in range 0-31 for %s", d->name); -+ } -+ } -+ -+ pat = GEN_FCN (d->icode) (target, rdctl_reg); -+ if (!pat) -+ return 0; -+ emit_insn (pat); -+ return target; -+} -+ -+static rtx -+nios2_expand_wrctl (const struct builtin_description * d ATTRIBUTE_UNUSED, -+ tree exp ATTRIBUTE_UNUSED, rtx target ATTRIBUTE_UNUSED, -+ rtx subtarget ATTRIBUTE_UNUSED, -+ enum machine_mode mode ATTRIBUTE_UNUSED, -+ int ignore ATTRIBUTE_UNUSED) -+{ -+ tree arglist = TREE_OPERAND (exp, 1); -+ rtx pat; -+ rtx wrctl_reg, store_val; -+ enum insn_code icode = d->icode; -+ -+ /* stores should have exactly two operands */ -+ if (insn_data[icode].n_operands != 2) -+ abort (); -+ -+ /* process the destination of the store */ -+ { -+ enum machine_mode mode = insn_data[icode].operand[0].mode; -+ tree arg = TREE_VALUE (arglist); -+ wrctl_reg = expand_expr (arg, NULL_RTX, VOIDmode, 0); -+ wrctl_reg = protect_from_queue (wrctl_reg, 0); -+ -+ if (!(*insn_data[icode].operand[0].predicate) (wrctl_reg, mode)) -+ error ("Control register number must be in range 0-31 for %s", d->name); -+ } -+ -+ -+ /* process the value to store */ -+ { -+ enum machine_mode mode = insn_data[icode].operand[1].mode; -+ tree arg = TREE_VALUE (TREE_CHAIN (arglist)); -+ store_val = expand_expr (arg, NULL_RTX, mode, 0); -+ store_val = protect_from_queue (store_val, 0); -+ -+ if (!(*insn_data[icode].operand[1].predicate) (store_val, mode)) -+ store_val = copy_to_mode_reg (mode, store_val); -+ -+ /* ??? Better errors would be nice */ -+ if (!(*insn_data[icode].operand[1].predicate) (store_val, mode)) -+ error ("Invalid argument 2 to %s", d->name); -+ } -+ -+ pat = GEN_FCN (d->icode) (wrctl_reg, store_val); -+ if (!pat) -+ return 0; -+ emit_insn (pat); -+ return 0; -+} -+ -+ -+#include "gt-nios2.h" -+ -diff -durN gcc-3.4.6.orig/gcc/config/nios2/nios2-dp-bit.c gcc-3.4.6/gcc/config/nios2/nios2-dp-bit.c ---- gcc-3.4.6.orig/gcc/config/nios2/nios2-dp-bit.c 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/gcc/config/nios2/nios2-dp-bit.c 2007-08-15 23:09:36.000000000 +0200 -@@ -0,0 +1,1652 @@ -+ -+/* This is a software floating point library which can be used -+ for targets without hardware floating point. -+ Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004 -+ Free Software Foundation, Inc. -+ -+This file is free software; you can redistribute it and/or modify it -+under the terms of the GNU General Public License as published by the -+Free Software Foundation; either version 2, or (at your option) any -+later version. -+ -+In addition to the permissions in the GNU General Public License, the -+Free Software Foundation gives you unlimited permission to link the -+compiled version of this file with other programs, and to distribute -+those programs without any restriction coming from the use of this -+file. (The General Public License restrictions do apply in other -+respects; for example, they cover modification of the file, and -+distribution when not linked into another program.) -+ -+This file is distributed in the hope that it will be useful, but -+WITHOUT ANY WARRANTY; without even the implied warranty of -+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+General Public License for more details. -+ -+You should have received a copy of the GNU General Public License -+along with this program; see the file COPYING. If not, write to -+the Free Software Foundation, 59 Temple Place - Suite 330, -+Boston, MA 02111-1307, USA. */ -+ -+/* As a special exception, if you link this library with other files, -+ some of which are compiled with GCC, to produce an executable, -+ this library does not by itself cause the resulting executable -+ to be covered by the GNU General Public License. -+ This exception does not however invalidate any other reasons why -+ the executable file might be covered by the GNU General Public License. */ -+ -+/* This implements IEEE 754 format arithmetic, but does not provide a -+ mechanism for setting the rounding mode, or for generating or handling -+ exceptions. -+ -+ The original code by Steve Chamberlain, hacked by Mark Eichin and Jim -+ Wilson, all of Cygnus Support. */ -+ -+/* The intended way to use this file is to make two copies, add `#define FLOAT' -+ to one copy, then compile both copies and add them to libgcc.a. */ -+ -+#include "tconfig.h" -+#include "coretypes.h" -+#include "tm.h" -+#include "config/fp-bit.h" -+ -+/* The following macros can be defined to change the behavior of this file: -+ FLOAT: Implement a `float', aka SFmode, fp library. If this is not -+ defined, then this file implements a `double', aka DFmode, fp library. -+ FLOAT_ONLY: Used with FLOAT, to implement a `float' only library, i.e. -+ don't include float->double conversion which requires the double library. -+ This is useful only for machines which can't support doubles, e.g. some -+ 8-bit processors. -+ CMPtype: Specify the type that floating point compares should return. -+ This defaults to SItype, aka int. -+ US_SOFTWARE_GOFAST: This makes all entry points use the same names as the -+ US Software goFast library. -+ _DEBUG_BITFLOAT: This makes debugging the code a little easier, by adding -+ two integers to the FLO_union_type. -+ NO_DENORMALS: Disable handling of denormals. -+ NO_NANS: Disable nan and infinity handling -+ SMALL_MACHINE: Useful when operations on QIs and HIs are faster -+ than on an SI */ -+ -+/* We don't currently support extended floats (long doubles) on machines -+ without hardware to deal with them. -+ -+ These stubs are just to keep the linker from complaining about unresolved -+ references which can be pulled in from libio & libstdc++, even if the -+ user isn't using long doubles. However, they may generate an unresolved -+ external to abort if abort is not used by the function, and the stubs -+ are referenced from within libc, since libgcc goes before and after the -+ system library. */ -+ -+#ifdef DECLARE_LIBRARY_RENAMES -+ DECLARE_LIBRARY_RENAMES -+#endif -+ -+#ifdef EXTENDED_FLOAT_STUBS -+extern void abort (void); -+void __extendsfxf2 (void) { abort(); } -+void __extenddfxf2 (void) { abort(); } -+void __truncxfdf2 (void) { abort(); } -+void __truncxfsf2 (void) { abort(); } -+void __fixxfsi (void) { abort(); } -+void __floatsixf (void) { abort(); } -+void __addxf3 (void) { abort(); } -+void __subxf3 (void) { abort(); } -+void __mulxf3 (void) { abort(); } -+void __divxf3 (void) { abort(); } -+void __negxf2 (void) { abort(); } -+void __eqxf2 (void) { abort(); } -+void __nexf2 (void) { abort(); } -+void __gtxf2 (void) { abort(); } -+void __gexf2 (void) { abort(); } -+void __lexf2 (void) { abort(); } -+void __ltxf2 (void) { abort(); } -+ -+void __extendsftf2 (void) { abort(); } -+void __extenddftf2 (void) { abort(); } -+void __trunctfdf2 (void) { abort(); } -+void __trunctfsf2 (void) { abort(); } -+void __fixtfsi (void) { abort(); } -+void __floatsitf (void) { abort(); } -+void __addtf3 (void) { abort(); } -+void __subtf3 (void) { abort(); } -+void __multf3 (void) { abort(); } -+void __divtf3 (void) { abort(); } -+void __negtf2 (void) { abort(); } -+void __eqtf2 (void) { abort(); } -+void __netf2 (void) { abort(); } -+void __gttf2 (void) { abort(); } -+void __getf2 (void) { abort(); } -+void __letf2 (void) { abort(); } -+void __lttf2 (void) { abort(); } -+#else /* !EXTENDED_FLOAT_STUBS, rest of file */ -+ -+/* IEEE "special" number predicates */ -+ -+#ifdef NO_NANS -+ -+#define nan() 0 -+#define isnan(x) 0 -+#define isinf(x) 0 -+#else -+ -+#if defined L_thenan_sf -+const fp_number_type __thenan_sf = { CLASS_SNAN, 0, 0, {(fractype) 0} }; -+#elif defined L_thenan_df -+const fp_number_type __thenan_df = { CLASS_SNAN, 0, 0, {(fractype) 0} }; -+#elif defined L_thenan_tf -+const fp_number_type __thenan_tf = { CLASS_SNAN, 0, 0, {(fractype) 0} }; -+#elif defined TFLOAT -+extern const fp_number_type __thenan_tf; -+#elif defined FLOAT -+extern const fp_number_type __thenan_sf; -+#else -+extern const fp_number_type __thenan_df; -+#endif -+ -+INLINE -+static fp_number_type * -+nan (void) -+{ -+ /* Discard the const qualifier... */ -+#ifdef TFLOAT -+ return (fp_number_type *) (& __thenan_tf); -+#elif defined FLOAT -+ return (fp_number_type *) (& __thenan_sf); -+#else -+ return (fp_number_type *) (& __thenan_df); -+#endif -+} -+ -+INLINE -+static int -+isnan ( fp_number_type * x) -+{ -+ return x->class == CLASS_SNAN || x->class == CLASS_QNAN; -+} -+ -+INLINE -+static int -+isinf ( fp_number_type * x) -+{ -+ return x->class == CLASS_INFINITY; -+} -+ -+#endif /* NO_NANS */ -+ -+INLINE -+static int -+iszero ( fp_number_type * x) -+{ -+ return x->class == CLASS_ZERO; -+} -+ -+INLINE -+static void -+flip_sign ( fp_number_type * x) -+{ -+ x->sign = !x->sign; -+} -+ -+extern FLO_type pack_d ( fp_number_type * ); -+ -+#if defined(L_pack_df) || defined(L_pack_sf) || defined(L_pack_tf) -+FLO_type -+pack_d ( fp_number_type * src) -+{ -+ FLO_union_type dst; -+ fractype fraction = src->fraction.ll; /* wasn't unsigned before? */ -+ int sign = src->sign; -+ int exp = 0; -+ -+ if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && (isnan (src) || isinf (src))) -+ { -+ /* We can't represent these values accurately. By using the -+ largest possible magnitude, we guarantee that the conversion -+ of infinity is at least as big as any finite number. */ -+ exp = EXPMAX; -+ fraction = ((fractype) 1 << FRACBITS) - 1; -+ } -+ else if (isnan (src)) -+ { -+ exp = EXPMAX; -+ if (src->class == CLASS_QNAN || 1) -+ { -+#ifdef QUIET_NAN_NEGATED -+ fraction |= QUIET_NAN - 1; -+#else -+ fraction |= QUIET_NAN; -+#endif -+ } -+ } -+ else if (isinf (src)) -+ { -+ exp = EXPMAX; -+ fraction = 0; -+ } -+ else if (iszero (src)) -+ { -+ exp = 0; -+ fraction = 0; -+ } -+ else if (fraction == 0) -+ { -+ exp = 0; -+ } -+ else -+ { -+ if (src->normal_exp < NORMAL_EXPMIN) -+ { -+#ifdef NO_DENORMALS -+ /* Go straight to a zero representation if denormals are not -+ supported. The denormal handling would be harmless but -+ isn't unnecessary. */ -+ exp = 0; -+ fraction = 0; -+#else /* NO_DENORMALS */ -+ /* This number's exponent is too low to fit into the bits -+ available in the number, so we'll store 0 in the exponent and -+ shift the fraction to the right to make up for it. */ -+ -+ int shift = NORMAL_EXPMIN - src->normal_exp; -+ -+ exp = 0; -+ -+ if (shift > FRAC_NBITS - NGARDS) -+ { -+ /* No point shifting, since it's more that 64 out. */ -+ fraction = 0; -+ } -+ else -+ { -+ int lowbit = (fraction & (((fractype)1 << shift) - 1)) ? 1 : 0; -+ fraction = (fraction >> shift) | lowbit; -+ } -+ if ((fraction & GARDMASK) == GARDMSB) -+ { -+ if ((fraction & (1 << NGARDS))) -+ fraction += GARDROUND + 1; -+ } -+ else -+ { -+ /* Add to the guards to round up. */ -+ fraction += GARDROUND; -+ } -+ /* Perhaps the rounding means we now need to change the -+ exponent, because the fraction is no longer denormal. */ -+ if (fraction >= IMPLICIT_1) -+ { -+ exp += 1; -+ } -+ fraction >>= NGARDS; -+#endif /* NO_DENORMALS */ -+ } -+ else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) -+ && src->normal_exp > EXPBIAS) -+ { -+ exp = EXPMAX; -+ fraction = 0; -+ } -+ else -+ { -+ exp = src->normal_exp + EXPBIAS; -+ if (!ROUND_TOWARDS_ZERO) -+ { -+ /* IF the gard bits are the all zero, but the first, then we're -+ half way between two numbers, choose the one which makes the -+ lsb of the answer 0. */ -+ if ((fraction & GARDMASK) == GARDMSB) -+ { -+ if (fraction & (1 << NGARDS)) -+ fraction += GARDROUND + 1; -+ } -+ else -+ { -+ /* Add a one to the guards to round up */ -+ fraction += GARDROUND; -+ } -+ if (fraction >= IMPLICIT_2) -+ { -+ fraction >>= 1; -+ exp += 1; -+ } -+ } -+ fraction >>= NGARDS; -+ -+ if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && exp > EXPMAX) -+ { -+ /* Saturate on overflow. */ -+ exp = EXPMAX; -+ fraction = ((fractype) 1 << FRACBITS) - 1; -+ } -+ } -+ } -+ -+ /* We previously used bitfields to store the number, but this doesn't -+ handle little/big endian systems conveniently, so use shifts and -+ masks */ -+#ifdef FLOAT_BIT_ORDER_MISMATCH -+ dst.bits.fraction = fraction; -+ dst.bits.exp = exp; -+ dst.bits.sign = sign; -+#else -+# if defined TFLOAT && defined HALFFRACBITS -+ { -+ halffractype high, low, unity; -+ int lowsign, lowexp; -+ -+ unity = (halffractype) 1 << HALFFRACBITS; -+ -+ /* Set HIGH to the high double's significand, masking out the implicit 1. -+ Set LOW to the low double's full significand. */ -+ high = (fraction >> (FRACBITS - HALFFRACBITS)) & (unity - 1); -+ low = fraction & (unity * 2 - 1); -+ -+ /* Get the initial sign and exponent of the low double. */ -+ lowexp = exp - HALFFRACBITS - 1; -+ lowsign = sign; -+ -+ /* HIGH should be rounded like a normal double, making |LOW| <= -+ 0.5 ULP of HIGH. Assume round-to-nearest. */ -+ if (exp < EXPMAX) -+ if (low > unity || (low == unity && (high & 1) == 1)) -+ { -+ /* Round HIGH up and adjust LOW to match. */ -+ high++; -+ if (high == unity) -+ { -+ /* May make it infinite, but that's OK. */ -+ high = 0; -+ exp++; -+ } -+ low = unity * 2 - low; -+ lowsign ^= 1; -+ } -+ -+ high |= (halffractype) exp << HALFFRACBITS; -+ high |= (halffractype) sign << (HALFFRACBITS + EXPBITS); -+ -+ if (exp == EXPMAX || exp == 0 || low == 0) -+ low = 0; -+ else -+ { -+ while (lowexp > 0 && low < unity) -+ { -+ low <<= 1; -+ lowexp--; -+ } -+ -+ if (lowexp <= 0) -+ { -+ halffractype roundmsb, round; -+ int shift; -+ -+ shift = 1 - lowexp; -+ roundmsb = (1 << (shift - 1)); -+ round = low & ((roundmsb << 1) - 1); -+ -+ low >>= shift; -+ lowexp = 0; -+ -+ if (round > roundmsb || (round == roundmsb && (low & 1) == 1)) -+ { -+ low++; -+ if (low == unity) -+ /* LOW rounds up to the smallest normal number. */ -+ lowexp++; -+ } -+ } -+ -+ low &= unity - 1; -+ low |= (halffractype) lowexp << HALFFRACBITS; -+ low |= (halffractype) lowsign << (HALFFRACBITS + EXPBITS); -+ } -+ dst.value_raw = ((fractype) high << HALFSHIFT) | low; -+ } -+# else -+ dst.value_raw = fraction & ((((fractype)1) << FRACBITS) - (fractype)1); -+ dst.value_raw |= ((fractype) (exp & ((1 << EXPBITS) - 1))) << FRACBITS; -+ dst.value_raw |= ((fractype) (sign & 1)) << (FRACBITS | EXPBITS); -+# endif -+#endif -+ -+#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT) -+#ifdef TFLOAT -+ { -+ qrtrfractype tmp1 = dst.words[0]; -+ qrtrfractype tmp2 = dst.words[1]; -+ dst.words[0] = dst.words[3]; -+ dst.words[1] = dst.words[2]; -+ dst.words[2] = tmp2; -+ dst.words[3] = tmp1; -+ } -+#else -+ { -+ halffractype tmp = dst.words[0]; -+ dst.words[0] = dst.words[1]; -+ dst.words[1] = tmp; -+ } -+#endif -+#endif -+ -+ return dst.value; -+} -+#endif -+ -+#if defined(L_unpack_df) || defined(L_unpack_sf) || defined(L_unpack_tf) -+void -+unpack_d (FLO_union_type * src, fp_number_type * dst) -+{ -+ /* We previously used bitfields to store the number, but this doesn't -+ handle little/big endian systems conveniently, so use shifts and -+ masks */ -+ fractype fraction; -+ int exp; -+ int sign; -+ -+#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT) -+ FLO_union_type swapped; -+ -+#ifdef TFLOAT -+ swapped.words[0] = src->words[3]; -+ swapped.words[1] = src->words[2]; -+ swapped.words[2] = src->words[1]; -+ swapped.words[3] = src->words[0]; -+#else -+ swapped.words[0] = src->words[1]; -+ swapped.words[1] = src->words[0]; -+#endif -+ src = &swapped; -+#endif -+ -+#ifdef FLOAT_BIT_ORDER_MISMATCH -+ fraction = src->bits.fraction; -+ exp = src->bits.exp; -+ sign = src->bits.sign; -+#else -+# if defined TFLOAT && defined HALFFRACBITS -+ { -+ halffractype high, low; -+ -+ high = src->value_raw >> HALFSHIFT; -+ low = src->value_raw & (((fractype)1 << HALFSHIFT) - 1); -+ -+ fraction = high & ((((fractype)1) << HALFFRACBITS) - 1); -+ fraction <<= FRACBITS - HALFFRACBITS; -+ exp = ((int)(high >> HALFFRACBITS)) & ((1 << EXPBITS) - 1); -+ sign = ((int)(high >> (((HALFFRACBITS + EXPBITS))))) & 1; -+ -+ if (exp != EXPMAX && exp != 0 && low != 0) -+ { -+ int lowexp = ((int)(low >> HALFFRACBITS)) & ((1 << EXPBITS) - 1); -+ int lowsign = ((int)(low >> (((HALFFRACBITS + EXPBITS))))) & 1; -+ int shift; -+ fractype xlow; -+ -+ xlow = low & ((((fractype)1) << HALFFRACBITS) - 1); -+ if (lowexp) -+ xlow |= (((halffractype)1) << HALFFRACBITS); -+ else -+ lowexp = 1; -+ shift = (FRACBITS - HALFFRACBITS) - (exp - lowexp); -+ if (shift > 0) -+ xlow <<= shift; -+ else if (shift < 0) -+ xlow >>= -shift; -+ if (sign == lowsign) -+ fraction += xlow; -+ else if (fraction >= xlow) -+ fraction -= xlow; -+ else -+ { -+ /* The high part is a power of two but the full number is lower. -+ This code will leave the implicit 1 in FRACTION, but we'd -+ have added that below anyway. */ -+ fraction = (((fractype) 1 << FRACBITS) - xlow) << 1; -+ exp--; -+ } -+ } -+ } -+# else -+ fraction = src->value_raw & ((((fractype)1) << FRACBITS) - 1); -+ exp = ((int)(src->value_raw >> FRACBITS)) & ((1 << EXPBITS) - 1); -+ sign = ((int)(src->value_raw >> (FRACBITS + EXPBITS))) & 1; -+# endif -+#endif -+ -+ dst->sign = sign; -+ if (exp == 0) -+ { -+ /* Hmm. Looks like 0 */ -+ if (fraction == 0 -+#ifdef NO_DENORMALS -+ || 1 -+#endif -+ ) -+ { -+ /* tastes like zero */ -+ dst->class = CLASS_ZERO; -+ } -+ else -+ { -+ /* Zero exponent with nonzero fraction - it's denormalized, -+ so there isn't a leading implicit one - we'll shift it so -+ it gets one. */ -+ dst->normal_exp = exp - EXPBIAS + 1; -+ fraction <<= NGARDS; -+ -+ dst->class = CLASS_NUMBER; -+#if 1 -+ while (fraction < IMPLICIT_1) -+ { -+ fraction <<= 1; -+ dst->normal_exp--; -+ } -+#endif -+ dst->fraction.ll = fraction; -+ } -+ } -+ else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && exp == EXPMAX) -+ { -+ /* Huge exponent*/ -+ if (fraction == 0) -+ { -+ /* Attached to a zero fraction - means infinity */ -+ dst->class = CLASS_INFINITY; -+ } -+ else -+ { -+ /* Nonzero fraction, means nan */ -+#ifdef QUIET_NAN_NEGATED -+ if ((fraction & QUIET_NAN) == 0) -+#else -+ if (fraction & QUIET_NAN) -+#endif -+ { -+ dst->class = CLASS_QNAN; -+ } -+ else -+ { -+ dst->class = CLASS_SNAN; -+ } -+ /* Keep the fraction part as the nan number */ -+ dst->fraction.ll = fraction; -+ } -+ } -+ else -+ { -+ /* Nothing strange about this number */ -+ dst->normal_exp = exp - EXPBIAS; -+ dst->class = CLASS_NUMBER; -+ dst->fraction.ll = (fraction << NGARDS) | IMPLICIT_1; -+ } -+} -+#endif /* L_unpack_df || L_unpack_sf */ -+ -+#if defined(L_addsub_sf) || defined(L_addsub_df) || defined(L_addsub_tf) -+static fp_number_type * -+_fpadd_parts (fp_number_type * a, -+ fp_number_type * b, -+ fp_number_type * tmp) -+{ -+ intfrac tfraction; -+ -+ /* Put commonly used fields in local variables. */ -+ int a_normal_exp; -+ int b_normal_exp; -+ fractype a_fraction; -+ fractype b_fraction; -+ -+ if (isnan (a)) -+ { -+ return a; -+ } -+ if (isnan (b)) -+ { -+ return b; -+ } -+ if (isinf (a)) -+ { -+ /* Adding infinities with opposite signs yields a NaN. */ -+ if (isinf (b) && a->sign != b->sign) -+ return nan (); -+ return a; -+ } -+ if (isinf (b)) -+ { -+ return b; -+ } -+ if (iszero (b)) -+ { -+ if (iszero (a)) -+ { -+ *tmp = *a; -+ tmp->sign = a->sign & b->sign; -+ return tmp; -+ } -+ return a; -+ } -+ if (iszero (a)) -+ { -+ return b; -+ } -+ -+ /* Got two numbers. shift the smaller and increment the exponent till -+ they're the same */ -+ { -+ int diff; -+ -+ a_normal_exp = a->normal_exp; -+ b_normal_exp = b->normal_exp; -+ a_fraction = a->fraction.ll; -+ b_fraction = b->fraction.ll; -+ -+ diff = a_normal_exp - b_normal_exp; -+ -+ if (diff < 0) -+ diff = -diff; -+ if (diff < FRAC_NBITS) -+ { -+ /* ??? This does shifts one bit at a time. Optimize. */ -+ while (a_normal_exp > b_normal_exp) -+ { -+ b_normal_exp++; -+ LSHIFT (b_fraction); -+ } -+ while (b_normal_exp > a_normal_exp) -+ { -+ a_normal_exp++; -+ LSHIFT (a_fraction); -+ } -+ } -+ else -+ { -+ /* Somethings's up.. choose the biggest */ -+ if (a_normal_exp > b_normal_exp) -+ { -+ b_normal_exp = a_normal_exp; -+ b_fraction = 0; -+ } -+ else -+ { -+ a_normal_exp = b_normal_exp; -+ a_fraction = 0; -+ } -+ } -+ } -+ -+ if (a->sign != b->sign) -+ { -+ if (a->sign) -+ { -+ tfraction = -a_fraction + b_fraction; -+ } -+ else -+ { -+ tfraction = a_fraction - b_fraction; -+ } -+ if (tfraction >= 0) -+ { -+ tmp->sign = 0; -+ tmp->normal_exp = a_normal_exp; -+ tmp->fraction.ll = tfraction; -+ } -+ else -+ { -+ tmp->sign = 1; -+ tmp->normal_exp = a_normal_exp; -+ tmp->fraction.ll = -tfraction; -+ } -+ /* and renormalize it */ -+ -+ while (tmp->fraction.ll < IMPLICIT_1 && tmp->fraction.ll) -+ { -+ tmp->fraction.ll <<= 1; -+ tmp->normal_exp--; -+ } -+ } -+ else -+ { -+ tmp->sign = a->sign; -+ tmp->normal_exp = a_normal_exp; -+ tmp->fraction.ll = a_fraction + b_fraction; -+ } -+ tmp->class = CLASS_NUMBER; -+ /* Now the fraction is added, we have to shift down to renormalize the -+ number */ -+ -+ if (tmp->fraction.ll >= IMPLICIT_2) -+ { -+ LSHIFT (tmp->fraction.ll); -+ tmp->normal_exp++; -+ } -+ return tmp; -+ -+} -+ -+FLO_type -+add (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ fp_number_type tmp; -+ fp_number_type *res; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ res = _fpadd_parts (&a, &b, &tmp); -+ -+ return pack_d (res); -+} -+ -+FLO_type -+sub (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ fp_number_type tmp; -+ fp_number_type *res; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ b.sign ^= 1; -+ -+ res = _fpadd_parts (&a, &b, &tmp); -+ -+ return pack_d (res); -+} -+#endif /* L_addsub_sf || L_addsub_df */ -+ -+#if defined(L_mul_sf) || defined(L_mul_df) || defined(L_mul_tf) -+static inline __attribute__ ((__always_inline__)) fp_number_type * -+_fpmul_parts ( fp_number_type * a, -+ fp_number_type * b, -+ fp_number_type * tmp) -+{ -+ fractype low = 0; -+ fractype high = 0; -+ -+ if (isnan (a)) -+ { -+ a->sign = a->sign != b->sign; -+ return a; -+ } -+ if (isnan (b)) -+ { -+ b->sign = a->sign != b->sign; -+ return b; -+ } -+ if (isinf (a)) -+ { -+ if (iszero (b)) -+ return nan (); -+ a->sign = a->sign != b->sign; -+ return a; -+ } -+ if (isinf (b)) -+ { -+ if (iszero (a)) -+ { -+ return nan (); -+ } -+ b->sign = a->sign != b->sign; -+ return b; -+ } -+ if (iszero (a)) -+ { -+ a->sign = a->sign != b->sign; -+ return a; -+ } -+ if (iszero (b)) -+ { -+ b->sign = a->sign != b->sign; -+ return b; -+ } -+ -+ /* Calculate the mantissa by multiplying both numbers to get a -+ twice-as-wide number. */ -+ { -+#if defined(NO_DI_MODE) || defined(TFLOAT) -+ { -+ fractype x = a->fraction.ll; -+ fractype ylow = b->fraction.ll; -+ fractype yhigh = 0; -+ int bit; -+ -+ /* ??? This does multiplies one bit at a time. Optimize. */ -+ for (bit = 0; bit < FRAC_NBITS; bit++) -+ { -+ int carry; -+ -+ if (x & 1) -+ { -+ carry = (low += ylow) < ylow; -+ high += yhigh + carry; -+ } -+ yhigh <<= 1; -+ if (ylow & FRACHIGH) -+ { -+ yhigh |= 1; -+ } -+ ylow <<= 1; -+ x >>= 1; -+ } -+ } -+#elif defined(FLOAT) -+ /* Multiplying two USIs to get a UDI, we're safe. */ -+ { -+ UDItype answer = (UDItype)a->fraction.ll * (UDItype)b->fraction.ll; -+ -+ high = answer >> BITS_PER_SI; -+ low = answer; -+ } -+#else -+ /* fractype is DImode, but we need the result to be twice as wide. -+ Assuming a widening multiply from DImode to TImode is not -+ available, build one by hand. */ -+ { -+ USItype nl = a->fraction.ll; -+ USItype nh = a->fraction.ll >> BITS_PER_SI; -+ USItype ml = b->fraction.ll; -+ USItype mh = b->fraction.ll >> BITS_PER_SI; -+ UDItype pp_ll = (UDItype) ml * nl; -+ UDItype pp_hl = (UDItype) mh * nl; -+ UDItype pp_lh = (UDItype) ml * nh; -+ UDItype pp_hh = (UDItype) mh * nh; -+ UDItype res2 = 0; -+ UDItype res0 = 0; -+ UDItype ps_hh__ = pp_hl + pp_lh; -+ if (ps_hh__ < pp_hl) -+ res2 += (UDItype)1 << BITS_PER_SI; -+ pp_hl = (UDItype)(USItype)ps_hh__ << BITS_PER_SI; -+ res0 = pp_ll + pp_hl; -+ if (res0 < pp_ll) -+ res2++; -+ res2 += (ps_hh__ >> BITS_PER_SI) + pp_hh; -+ high = res2; -+ low = res0; -+ } -+#endif -+ } -+ -+ tmp->normal_exp = a->normal_exp + b->normal_exp -+ + FRAC_NBITS - (FRACBITS + NGARDS); -+ tmp->sign = a->sign != b->sign; -+ while (high >= IMPLICIT_2) -+ { -+ tmp->normal_exp++; -+ if (high & 1) -+ { -+ low >>= 1; -+ low |= FRACHIGH; -+ } -+ high >>= 1; -+ } -+ while (high < IMPLICIT_1) -+ { -+ tmp->normal_exp--; -+ -+ high <<= 1; -+ if (low & FRACHIGH) -+ high |= 1; -+ low <<= 1; -+ } -+ /* rounding is tricky. if we only round if it won't make us round later. */ -+#if 0 -+ if (low & FRACHIGH2) -+ { -+ if (((high & GARDMASK) != GARDMSB) -+ && (((high + 1) & GARDMASK) == GARDMSB)) -+ { -+ /* don't round, it gets done again later. */ -+ } -+ else -+ { -+ high++; -+ } -+ } -+#endif -+ if (!ROUND_TOWARDS_ZERO && (high & GARDMASK) == GARDMSB) -+ { -+ if (high & (1 << NGARDS)) -+ { -+ /* half way, so round to even */ -+ high += GARDROUND + 1; -+ } -+ else if (low) -+ { -+ /* but we really weren't half way */ -+ high += GARDROUND + 1; -+ } -+ } -+ tmp->fraction.ll = high; -+ tmp->class = CLASS_NUMBER; -+ return tmp; -+} -+ -+FLO_type -+multiply (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ fp_number_type tmp; -+ fp_number_type *res; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ res = _fpmul_parts (&a, &b, &tmp); -+ -+ return pack_d (res); -+} -+#endif /* L_mul_sf || L_mul_df */ -+ -+#if defined(L_div_sf) || defined(L_div_df) || defined(L_div_tf) -+static inline __attribute__ ((__always_inline__)) fp_number_type * -+_fpdiv_parts (fp_number_type * a, -+ fp_number_type * b) -+{ -+ fractype bit; -+ fractype numerator; -+ fractype denominator; -+ fractype quotient; -+ -+ if (isnan (a)) -+ { -+ return a; -+ } -+ if (isnan (b)) -+ { -+ return b; -+ } -+ -+ a->sign = a->sign ^ b->sign; -+ -+ if (isinf (a) || iszero (a)) -+ { -+ if (a->class == b->class) -+ return nan (); -+ return a; -+ } -+ -+ if (isinf (b)) -+ { -+ a->fraction.ll = 0; -+ a->normal_exp = 0; -+ return a; -+ } -+ if (iszero (b)) -+ { -+ a->class = CLASS_INFINITY; -+ return a; -+ } -+ -+ /* Calculate the mantissa by multiplying both 64bit numbers to get a -+ 128 bit number */ -+ { -+ /* quotient = -+ ( numerator / denominator) * 2^(numerator exponent - denominator exponent) -+ */ -+ -+ a->normal_exp = a->normal_exp - b->normal_exp; -+ numerator = a->fraction.ll; -+ denominator = b->fraction.ll; -+ -+ if (numerator < denominator) -+ { -+ /* Fraction will be less than 1.0 */ -+ numerator *= 2; -+ a->normal_exp--; -+ } -+ bit = IMPLICIT_1; -+ quotient = 0; -+ /* ??? Does divide one bit at a time. Optimize. */ -+ while (bit) -+ { -+ if (numerator >= denominator) -+ { -+ quotient |= bit; -+ numerator -= denominator; -+ } -+ bit >>= 1; -+ numerator *= 2; -+ } -+ -+ if (!ROUND_TOWARDS_ZERO && (quotient & GARDMASK) == GARDMSB) -+ { -+ if (quotient & (1 << NGARDS)) -+ { -+ /* half way, so round to even */ -+ quotient += GARDROUND + 1; -+ } -+ else if (numerator) -+ { -+ /* but we really weren't half way, more bits exist */ -+ quotient += GARDROUND + 1; -+ } -+ } -+ -+ a->fraction.ll = quotient; -+ return (a); -+ } -+} -+ -+FLO_type -+divide (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ fp_number_type *res; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ res = _fpdiv_parts (&a, &b); -+ -+ return pack_d (res); -+} -+#endif /* L_div_sf || L_div_df */ -+ -+#if defined(L_fpcmp_parts_sf) || defined(L_fpcmp_parts_df) \ -+ || defined(L_fpcmp_parts_tf) -+/* according to the demo, fpcmp returns a comparison with 0... thus -+ a -1 -+ a==b -> 0 -+ a>b -> +1 -+ */ -+ -+int -+__fpcmp_parts (fp_number_type * a, fp_number_type * b) -+{ -+#if 0 -+ /* either nan -> unordered. Must be checked outside of this routine. */ -+ if (isnan (a) && isnan (b)) -+ { -+ return 1; /* still unordered! */ -+ } -+#endif -+ -+ if (isnan (a) || isnan (b)) -+ { -+ return 1; /* how to indicate unordered compare? */ -+ } -+ if (isinf (a) && isinf (b)) -+ { -+ /* +inf > -inf, but +inf != +inf */ -+ /* b \a| +inf(0)| -inf(1) -+ ______\+--------+-------- -+ +inf(0)| a==b(0)| ab(1) | a==b(0) -+ -------+--------+-------- -+ So since unordered must be nonzero, just line up the columns... -+ */ -+ return b->sign - a->sign; -+ } -+ /* but not both... */ -+ if (isinf (a)) -+ { -+ return a->sign ? -1 : 1; -+ } -+ if (isinf (b)) -+ { -+ return b->sign ? 1 : -1; -+ } -+ if (iszero (a) && iszero (b)) -+ { -+ return 0; -+ } -+ if (iszero (a)) -+ { -+ return b->sign ? 1 : -1; -+ } -+ if (iszero (b)) -+ { -+ return a->sign ? -1 : 1; -+ } -+ /* now both are "normal". */ -+ if (a->sign != b->sign) -+ { -+ /* opposite signs */ -+ return a->sign ? -1 : 1; -+ } -+ /* same sign; exponents? */ -+ if (a->normal_exp > b->normal_exp) -+ { -+ return a->sign ? -1 : 1; -+ } -+ if (a->normal_exp < b->normal_exp) -+ { -+ return a->sign ? 1 : -1; -+ } -+ /* same exponents; check size. */ -+ if (a->fraction.ll > b->fraction.ll) -+ { -+ return a->sign ? -1 : 1; -+ } -+ if (a->fraction.ll < b->fraction.ll) -+ { -+ return a->sign ? 1 : -1; -+ } -+ /* after all that, they're equal. */ -+ return 0; -+} -+#endif -+ -+#if defined(L_compare_sf) || defined(L_compare_df) || defined(L_compoare_tf) -+CMPtype -+compare (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ return __fpcmp_parts (&a, &b); -+} -+#endif /* L_compare_sf || L_compare_df */ -+ -+#ifndef US_SOFTWARE_GOFAST -+ -+/* These should be optimized for their specific tasks someday. */ -+ -+#if defined(L_eq_sf) || defined(L_eq_df) || defined(L_eq_tf) -+CMPtype -+_eq_f2 (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ if (isnan (&a) || isnan (&b)) -+ return 1; /* false, truth == 0 */ -+ -+ return __fpcmp_parts (&a, &b) ; -+} -+#endif /* L_eq_sf || L_eq_df */ -+ -+#if defined(L_ne_sf) || defined(L_ne_df) || defined(L_ne_tf) -+CMPtype -+_ne_f2 (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ if (isnan (&a) || isnan (&b)) -+ return 1; /* true, truth != 0 */ -+ -+ return __fpcmp_parts (&a, &b) ; -+} -+#endif /* L_ne_sf || L_ne_df */ -+ -+#if defined(L_gt_sf) || defined(L_gt_df) || defined(L_gt_tf) -+CMPtype -+_gt_f2 (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ if (isnan (&a) || isnan (&b)) -+ return -1; /* false, truth > 0 */ -+ -+ return __fpcmp_parts (&a, &b); -+} -+#endif /* L_gt_sf || L_gt_df */ -+ -+#if defined(L_ge_sf) || defined(L_ge_df) || defined(L_ge_tf) -+CMPtype -+_ge_f2 (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ if (isnan (&a) || isnan (&b)) -+ return -1; /* false, truth >= 0 */ -+ return __fpcmp_parts (&a, &b) ; -+} -+#endif /* L_ge_sf || L_ge_df */ -+ -+#if defined(L_lt_sf) || defined(L_lt_df) || defined(L_lt_tf) -+CMPtype -+_lt_f2 (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ if (isnan (&a) || isnan (&b)) -+ return 1; /* false, truth < 0 */ -+ -+ return __fpcmp_parts (&a, &b); -+} -+#endif /* L_lt_sf || L_lt_df */ -+ -+#if defined(L_le_sf) || defined(L_le_df) || defined(L_le_tf) -+CMPtype -+_le_f2 (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ if (isnan (&a) || isnan (&b)) -+ return 1; /* false, truth <= 0 */ -+ -+ return __fpcmp_parts (&a, &b) ; -+} -+#endif /* L_le_sf || L_le_df */ -+ -+#endif /* ! US_SOFTWARE_GOFAST */ -+ -+#if defined(L_unord_sf) || defined(L_unord_df) || defined(L_unord_tf) -+CMPtype -+_unord_f2 (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ return (isnan (&a) || isnan (&b)); -+} -+#endif /* L_unord_sf || L_unord_df */ -+ -+#if defined(L_si_to_sf) || defined(L_si_to_df) || defined(L_si_to_tf) -+FLO_type -+si_to_float (SItype arg_a) -+{ -+ fp_number_type in; -+ -+ in.class = CLASS_NUMBER; -+ in.sign = arg_a < 0; -+ if (!arg_a) -+ { -+ in.class = CLASS_ZERO; -+ } -+ else -+ { -+ in.normal_exp = FRACBITS + NGARDS; -+ if (in.sign) -+ { -+ /* Special case for minint, since there is no +ve integer -+ representation for it */ -+ if (arg_a == (- MAX_SI_INT - 1)) -+ { -+ return (FLO_type)(- MAX_SI_INT - 1); -+ } -+ in.fraction.ll = (-arg_a); -+ } -+ else -+ in.fraction.ll = arg_a; -+ -+ while (in.fraction.ll < ((fractype)1 << (FRACBITS + NGARDS))) -+ { -+ in.fraction.ll <<= 1; -+ in.normal_exp -= 1; -+ } -+ } -+ return pack_d (&in); -+} -+#endif /* L_si_to_sf || L_si_to_df */ -+ -+#if defined(L_usi_to_sf) || defined(L_usi_to_df) || defined(L_usi_to_tf) -+FLO_type -+usi_to_float (USItype arg_a) -+{ -+ fp_number_type in; -+ -+ in.sign = 0; -+ if (!arg_a) -+ { -+ in.class = CLASS_ZERO; -+ } -+ else -+ { -+ in.class = CLASS_NUMBER; -+ in.normal_exp = FRACBITS + NGARDS; -+ in.fraction.ll = arg_a; -+ -+ while (in.fraction.ll > ((fractype)1 << (FRACBITS + NGARDS))) -+ { -+ in.fraction.ll >>= 1; -+ in.normal_exp += 1; -+ } -+ while (in.fraction.ll < ((fractype)1 << (FRACBITS + NGARDS))) -+ { -+ in.fraction.ll <<= 1; -+ in.normal_exp -= 1; -+ } -+ } -+ return pack_d (&in); -+} -+#endif -+ -+#if defined(L_sf_to_si) || defined(L_df_to_si) || defined(L_tf_to_si) -+SItype -+float_to_si (FLO_type arg_a) -+{ -+ fp_number_type a; -+ SItype tmp; -+ FLO_union_type au; -+ -+ au.value = arg_a; -+ unpack_d (&au, &a); -+ -+ if (iszero (&a)) -+ return 0; -+ if (isnan (&a)) -+ return 0; -+ /* get reasonable MAX_SI_INT... */ -+ if (isinf (&a)) -+ return a.sign ? (-MAX_SI_INT)-1 : MAX_SI_INT; -+ /* it is a number, but a small one */ -+ if (a.normal_exp < 0) -+ return 0; -+ if (a.normal_exp > BITS_PER_SI - 2) -+ return a.sign ? (-MAX_SI_INT)-1 : MAX_SI_INT; -+ tmp = a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp); -+ return a.sign ? (-tmp) : (tmp); -+} -+#endif /* L_sf_to_si || L_df_to_si */ -+ -+#if defined(L_sf_to_usi) || defined(L_df_to_usi) || defined(L_tf_to_usi) -+#if defined US_SOFTWARE_GOFAST || defined(L_tf_to_usi) -+/* While libgcc2.c defines its own __fixunssfsi and __fixunsdfsi routines, -+ we also define them for GOFAST because the ones in libgcc2.c have the -+ wrong names and I'd rather define these here and keep GOFAST CYG-LOC's -+ out of libgcc2.c. We can't define these here if not GOFAST because then -+ there'd be duplicate copies. */ -+ -+USItype -+float_to_usi (FLO_type arg_a) -+{ -+ fp_number_type a; -+ FLO_union_type au; -+ -+ au.value = arg_a; -+ unpack_d (&au, &a); -+ -+ if (iszero (&a)) -+ return 0; -+ if (isnan (&a)) -+ return 0; -+ /* it is a negative number */ -+ if (a.sign) -+ return 0; -+ /* get reasonable MAX_USI_INT... */ -+ if (isinf (&a)) -+ return MAX_USI_INT; -+ /* it is a number, but a small one */ -+ if (a.normal_exp < 0) -+ return 0; -+ if (a.normal_exp > BITS_PER_SI - 1) -+ return MAX_USI_INT; -+ else if (a.normal_exp > (FRACBITS + NGARDS)) -+ return a.fraction.ll << (a.normal_exp - (FRACBITS + NGARDS)); -+ else -+ return a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp); -+} -+#endif /* US_SOFTWARE_GOFAST */ -+#endif /* L_sf_to_usi || L_df_to_usi */ -+ -+#if defined(L_negate_sf) || defined(L_negate_df) || defined(L_negate_tf) -+FLO_type -+negate (FLO_type arg_a) -+{ -+ fp_number_type a; -+ FLO_union_type au; -+ -+ au.value = arg_a; -+ unpack_d (&au, &a); -+ -+ flip_sign (&a); -+ return pack_d (&a); -+} -+#endif /* L_negate_sf || L_negate_df */ -+ -+#ifdef FLOAT -+ -+#if defined(L_make_sf) -+SFtype -+__make_fp(fp_class_type class, -+ unsigned int sign, -+ int exp, -+ USItype frac) -+{ -+ fp_number_type in; -+ -+ in.class = class; -+ in.sign = sign; -+ in.normal_exp = exp; -+ in.fraction.ll = frac; -+ return pack_d (&in); -+} -+#endif /* L_make_sf */ -+ -+#ifndef FLOAT_ONLY -+ -+/* This enables one to build an fp library that supports float but not double. -+ Otherwise, we would get an undefined reference to __make_dp. -+ This is needed for some 8-bit ports that can't handle well values that -+ are 8-bytes in size, so we just don't support double for them at all. */ -+ -+#if defined(L_sf_to_df) -+DFtype -+sf_to_df (SFtype arg_a) -+{ -+ fp_number_type in; -+ FLO_union_type au; -+ -+ au.value = arg_a; -+ unpack_d (&au, &in); -+ -+ return __make_dp (in.class, in.sign, in.normal_exp, -+ ((UDItype) in.fraction.ll) << F_D_BITOFF); -+} -+#endif /* L_sf_to_df */ -+ -+#if defined(L_sf_to_tf) && defined(TMODES) -+TFtype -+sf_to_tf (SFtype arg_a) -+{ -+ fp_number_type in; -+ FLO_union_type au; -+ -+ au.value = arg_a; -+ unpack_d (&au, &in); -+ -+ return __make_tp (in.class, in.sign, in.normal_exp, -+ ((UTItype) in.fraction.ll) << F_T_BITOFF); -+} -+#endif /* L_sf_to_df */ -+ -+#endif /* ! FLOAT_ONLY */ -+#endif /* FLOAT */ -+ -+#ifndef FLOAT -+ -+extern SFtype __make_fp (fp_class_type, unsigned int, int, USItype); -+ -+#if defined(L_make_df) -+DFtype -+__make_dp (fp_class_type class, unsigned int sign, int exp, UDItype frac) -+{ -+ fp_number_type in; -+ -+ in.class = class; -+ in.sign = sign; -+ in.normal_exp = exp; -+ in.fraction.ll = frac; -+ return pack_d (&in); -+} -+#endif /* L_make_df */ -+ -+#if defined(L_df_to_sf) -+SFtype -+df_to_sf (DFtype arg_a) -+{ -+ fp_number_type in; -+ USItype sffrac; -+ FLO_union_type au; -+ -+ au.value = arg_a; -+ unpack_d (&au, &in); -+ -+ sffrac = in.fraction.ll >> F_D_BITOFF; -+ -+ /* We set the lowest guard bit in SFFRAC if we discarded any non -+ zero bits. */ -+ if ((in.fraction.ll & (((USItype) 1 << F_D_BITOFF) - 1)) != 0) -+ sffrac |= 1; -+ -+ return __make_fp (in.class, in.sign, in.normal_exp, sffrac); -+} -+#endif /* L_df_to_sf */ -+ -+#if defined(L_df_to_tf) && defined(TMODES) \ -+ && !defined(FLOAT) && !defined(TFLOAT) -+TFtype -+df_to_tf (DFtype arg_a) -+{ -+ fp_number_type in; -+ FLO_union_type au; -+ -+ au.value = arg_a; -+ unpack_d (&au, &in); -+ -+ return __make_tp (in.class, in.sign, in.normal_exp, -+ ((UTItype) in.fraction.ll) << D_T_BITOFF); -+} -+#endif /* L_sf_to_df */ -+ -+#ifdef TFLOAT -+#if defined(L_make_tf) -+TFtype -+__make_tp(fp_class_type class, -+ unsigned int sign, -+ int exp, -+ UTItype frac) -+{ -+ fp_number_type in; -+ -+ in.class = class; -+ in.sign = sign; -+ in.normal_exp = exp; -+ in.fraction.ll = frac; -+ return pack_d (&in); -+} -+#endif /* L_make_tf */ -+ -+#if defined(L_tf_to_df) -+DFtype -+tf_to_df (TFtype arg_a) -+{ -+ fp_number_type in; -+ UDItype sffrac; -+ FLO_union_type au; -+ -+ au.value = arg_a; -+ unpack_d (&au, &in); -+ -+ sffrac = in.fraction.ll >> D_T_BITOFF; -+ -+ /* We set the lowest guard bit in SFFRAC if we discarded any non -+ zero bits. */ -+ if ((in.fraction.ll & (((UTItype) 1 << D_T_BITOFF) - 1)) != 0) -+ sffrac |= 1; -+ -+ return __make_dp (in.class, in.sign, in.normal_exp, sffrac); -+} -+#endif /* L_tf_to_df */ -+ -+#if defined(L_tf_to_sf) -+SFtype -+tf_to_sf (TFtype arg_a) -+{ -+ fp_number_type in; -+ USItype sffrac; -+ FLO_union_type au; -+ -+ au.value = arg_a; -+ unpack_d (&au, &in); -+ -+ sffrac = in.fraction.ll >> F_T_BITOFF; -+ -+ /* We set the lowest guard bit in SFFRAC if we discarded any non -+ zero bits. */ -+ if ((in.fraction.ll & (((UTItype) 1 << F_T_BITOFF) - 1)) != 0) -+ sffrac |= 1; -+ -+ return __make_fp (in.class, in.sign, in.normal_exp, sffrac); -+} -+#endif /* L_tf_to_sf */ -+#endif /* TFLOAT */ -+ -+#endif /* ! FLOAT */ -+#endif /* !EXTENDED_FLOAT_STUBS */ -diff -durN gcc-3.4.6.orig/gcc/config/nios2/nios2-fp-bit.c gcc-3.4.6/gcc/config/nios2/nios2-fp-bit.c ---- gcc-3.4.6.orig/gcc/config/nios2/nios2-fp-bit.c 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/gcc/config/nios2/nios2-fp-bit.c 2007-08-15 23:09:36.000000000 +0200 -@@ -0,0 +1,1652 @@ -+#define FLOAT -+/* This is a software floating point library which can be used -+ for targets without hardware floating point. -+ Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004 -+ Free Software Foundation, Inc. -+ -+This file is free software; you can redistribute it and/or modify it -+under the terms of the GNU General Public License as published by the -+Free Software Foundation; either version 2, or (at your option) any -+later version. -+ -+In addition to the permissions in the GNU General Public License, the -+Free Software Foundation gives you unlimited permission to link the -+compiled version of this file with other programs, and to distribute -+those programs without any restriction coming from the use of this -+file. (The General Public License restrictions do apply in other -+respects; for example, they cover modification of the file, and -+distribution when not linked into another program.) -+ -+This file is distributed in the hope that it will be useful, but -+WITHOUT ANY WARRANTY; without even the implied warranty of -+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+General Public License for more details. -+ -+You should have received a copy of the GNU General Public License -+along with this program; see the file COPYING. If not, write to -+the Free Software Foundation, 59 Temple Place - Suite 330, -+Boston, MA 02111-1307, USA. */ -+ -+/* As a special exception, if you link this library with other files, -+ some of which are compiled with GCC, to produce an executable, -+ this library does not by itself cause the resulting executable -+ to be covered by the GNU General Public License. -+ This exception does not however invalidate any other reasons why -+ the executable file might be covered by the GNU General Public License. */ -+ -+/* This implements IEEE 754 format arithmetic, but does not provide a -+ mechanism for setting the rounding mode, or for generating or handling -+ exceptions. -+ -+ The original code by Steve Chamberlain, hacked by Mark Eichin and Jim -+ Wilson, all of Cygnus Support. */ -+ -+/* The intended way to use this file is to make two copies, add `#define FLOAT' -+ to one copy, then compile both copies and add them to libgcc.a. */ -+ -+#include "tconfig.h" -+#include "coretypes.h" -+#include "tm.h" -+#include "config/fp-bit.h" -+ -+/* The following macros can be defined to change the behavior of this file: -+ FLOAT: Implement a `float', aka SFmode, fp library. If this is not -+ defined, then this file implements a `double', aka DFmode, fp library. -+ FLOAT_ONLY: Used with FLOAT, to implement a `float' only library, i.e. -+ don't include float->double conversion which requires the double library. -+ This is useful only for machines which can't support doubles, e.g. some -+ 8-bit processors. -+ CMPtype: Specify the type that floating point compares should return. -+ This defaults to SItype, aka int. -+ US_SOFTWARE_GOFAST: This makes all entry points use the same names as the -+ US Software goFast library. -+ _DEBUG_BITFLOAT: This makes debugging the code a little easier, by adding -+ two integers to the FLO_union_type. -+ NO_DENORMALS: Disable handling of denormals. -+ NO_NANS: Disable nan and infinity handling -+ SMALL_MACHINE: Useful when operations on QIs and HIs are faster -+ than on an SI */ -+ -+/* We don't currently support extended floats (long doubles) on machines -+ without hardware to deal with them. -+ -+ These stubs are just to keep the linker from complaining about unresolved -+ references which can be pulled in from libio & libstdc++, even if the -+ user isn't using long doubles. However, they may generate an unresolved -+ external to abort if abort is not used by the function, and the stubs -+ are referenced from within libc, since libgcc goes before and after the -+ system library. */ -+ -+#ifdef DECLARE_LIBRARY_RENAMES -+ DECLARE_LIBRARY_RENAMES -+#endif -+ -+#ifdef EXTENDED_FLOAT_STUBS -+extern void abort (void); -+void __extendsfxf2 (void) { abort(); } -+void __extenddfxf2 (void) { abort(); } -+void __truncxfdf2 (void) { abort(); } -+void __truncxfsf2 (void) { abort(); } -+void __fixxfsi (void) { abort(); } -+void __floatsixf (void) { abort(); } -+void __addxf3 (void) { abort(); } -+void __subxf3 (void) { abort(); } -+void __mulxf3 (void) { abort(); } -+void __divxf3 (void) { abort(); } -+void __negxf2 (void) { abort(); } -+void __eqxf2 (void) { abort(); } -+void __nexf2 (void) { abort(); } -+void __gtxf2 (void) { abort(); } -+void __gexf2 (void) { abort(); } -+void __lexf2 (void) { abort(); } -+void __ltxf2 (void) { abort(); } -+ -+void __extendsftf2 (void) { abort(); } -+void __extenddftf2 (void) { abort(); } -+void __trunctfdf2 (void) { abort(); } -+void __trunctfsf2 (void) { abort(); } -+void __fixtfsi (void) { abort(); } -+void __floatsitf (void) { abort(); } -+void __addtf3 (void) { abort(); } -+void __subtf3 (void) { abort(); } -+void __multf3 (void) { abort(); } -+void __divtf3 (void) { abort(); } -+void __negtf2 (void) { abort(); } -+void __eqtf2 (void) { abort(); } -+void __netf2 (void) { abort(); } -+void __gttf2 (void) { abort(); } -+void __getf2 (void) { abort(); } -+void __letf2 (void) { abort(); } -+void __lttf2 (void) { abort(); } -+#else /* !EXTENDED_FLOAT_STUBS, rest of file */ -+ -+/* IEEE "special" number predicates */ -+ -+#ifdef NO_NANS -+ -+#define nan() 0 -+#define isnan(x) 0 -+#define isinf(x) 0 -+#else -+ -+#if defined L_thenan_sf -+const fp_number_type __thenan_sf = { CLASS_SNAN, 0, 0, {(fractype) 0} }; -+#elif defined L_thenan_df -+const fp_number_type __thenan_df = { CLASS_SNAN, 0, 0, {(fractype) 0} }; -+#elif defined L_thenan_tf -+const fp_number_type __thenan_tf = { CLASS_SNAN, 0, 0, {(fractype) 0} }; -+#elif defined TFLOAT -+extern const fp_number_type __thenan_tf; -+#elif defined FLOAT -+extern const fp_number_type __thenan_sf; -+#else -+extern const fp_number_type __thenan_df; -+#endif -+ -+INLINE -+static fp_number_type * -+nan (void) -+{ -+ /* Discard the const qualifier... */ -+#ifdef TFLOAT -+ return (fp_number_type *) (& __thenan_tf); -+#elif defined FLOAT -+ return (fp_number_type *) (& __thenan_sf); -+#else -+ return (fp_number_type *) (& __thenan_df); -+#endif -+} -+ -+INLINE -+static int -+isnan ( fp_number_type * x) -+{ -+ return x->class == CLASS_SNAN || x->class == CLASS_QNAN; -+} -+ -+INLINE -+static int -+isinf ( fp_number_type * x) -+{ -+ return x->class == CLASS_INFINITY; -+} -+ -+#endif /* NO_NANS */ -+ -+INLINE -+static int -+iszero ( fp_number_type * x) -+{ -+ return x->class == CLASS_ZERO; -+} -+ -+INLINE -+static void -+flip_sign ( fp_number_type * x) -+{ -+ x->sign = !x->sign; -+} -+ -+extern FLO_type pack_d ( fp_number_type * ); -+ -+#if defined(L_pack_df) || defined(L_pack_sf) || defined(L_pack_tf) -+FLO_type -+pack_d ( fp_number_type * src) -+{ -+ FLO_union_type dst; -+ fractype fraction = src->fraction.ll; /* wasn't unsigned before? */ -+ int sign = src->sign; -+ int exp = 0; -+ -+ if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && (isnan (src) || isinf (src))) -+ { -+ /* We can't represent these values accurately. By using the -+ largest possible magnitude, we guarantee that the conversion -+ of infinity is at least as big as any finite number. */ -+ exp = EXPMAX; -+ fraction = ((fractype) 1 << FRACBITS) - 1; -+ } -+ else if (isnan (src)) -+ { -+ exp = EXPMAX; -+ if (src->class == CLASS_QNAN || 1) -+ { -+#ifdef QUIET_NAN_NEGATED -+ fraction |= QUIET_NAN - 1; -+#else -+ fraction |= QUIET_NAN; -+#endif -+ } -+ } -+ else if (isinf (src)) -+ { -+ exp = EXPMAX; -+ fraction = 0; -+ } -+ else if (iszero (src)) -+ { -+ exp = 0; -+ fraction = 0; -+ } -+ else if (fraction == 0) -+ { -+ exp = 0; -+ } -+ else -+ { -+ if (src->normal_exp < NORMAL_EXPMIN) -+ { -+#ifdef NO_DENORMALS -+ /* Go straight to a zero representation if denormals are not -+ supported. The denormal handling would be harmless but -+ isn't unnecessary. */ -+ exp = 0; -+ fraction = 0; -+#else /* NO_DENORMALS */ -+ /* This number's exponent is too low to fit into the bits -+ available in the number, so we'll store 0 in the exponent and -+ shift the fraction to the right to make up for it. */ -+ -+ int shift = NORMAL_EXPMIN - src->normal_exp; -+ -+ exp = 0; -+ -+ if (shift > FRAC_NBITS - NGARDS) -+ { -+ /* No point shifting, since it's more that 64 out. */ -+ fraction = 0; -+ } -+ else -+ { -+ int lowbit = (fraction & (((fractype)1 << shift) - 1)) ? 1 : 0; -+ fraction = (fraction >> shift) | lowbit; -+ } -+ if ((fraction & GARDMASK) == GARDMSB) -+ { -+ if ((fraction & (1 << NGARDS))) -+ fraction += GARDROUND + 1; -+ } -+ else -+ { -+ /* Add to the guards to round up. */ -+ fraction += GARDROUND; -+ } -+ /* Perhaps the rounding means we now need to change the -+ exponent, because the fraction is no longer denormal. */ -+ if (fraction >= IMPLICIT_1) -+ { -+ exp += 1; -+ } -+ fraction >>= NGARDS; -+#endif /* NO_DENORMALS */ -+ } -+ else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) -+ && src->normal_exp > EXPBIAS) -+ { -+ exp = EXPMAX; -+ fraction = 0; -+ } -+ else -+ { -+ exp = src->normal_exp + EXPBIAS; -+ if (!ROUND_TOWARDS_ZERO) -+ { -+ /* IF the gard bits are the all zero, but the first, then we're -+ half way between two numbers, choose the one which makes the -+ lsb of the answer 0. */ -+ if ((fraction & GARDMASK) == GARDMSB) -+ { -+ if (fraction & (1 << NGARDS)) -+ fraction += GARDROUND + 1; -+ } -+ else -+ { -+ /* Add a one to the guards to round up */ -+ fraction += GARDROUND; -+ } -+ if (fraction >= IMPLICIT_2) -+ { -+ fraction >>= 1; -+ exp += 1; -+ } -+ } -+ fraction >>= NGARDS; -+ -+ if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && exp > EXPMAX) -+ { -+ /* Saturate on overflow. */ -+ exp = EXPMAX; -+ fraction = ((fractype) 1 << FRACBITS) - 1; -+ } -+ } -+ } -+ -+ /* We previously used bitfields to store the number, but this doesn't -+ handle little/big endian systems conveniently, so use shifts and -+ masks */ -+#ifdef FLOAT_BIT_ORDER_MISMATCH -+ dst.bits.fraction = fraction; -+ dst.bits.exp = exp; -+ dst.bits.sign = sign; -+#else -+# if defined TFLOAT && defined HALFFRACBITS -+ { -+ halffractype high, low, unity; -+ int lowsign, lowexp; -+ -+ unity = (halffractype) 1 << HALFFRACBITS; -+ -+ /* Set HIGH to the high double's significand, masking out the implicit 1. -+ Set LOW to the low double's full significand. */ -+ high = (fraction >> (FRACBITS - HALFFRACBITS)) & (unity - 1); -+ low = fraction & (unity * 2 - 1); -+ -+ /* Get the initial sign and exponent of the low double. */ -+ lowexp = exp - HALFFRACBITS - 1; -+ lowsign = sign; -+ -+ /* HIGH should be rounded like a normal double, making |LOW| <= -+ 0.5 ULP of HIGH. Assume round-to-nearest. */ -+ if (exp < EXPMAX) -+ if (low > unity || (low == unity && (high & 1) == 1)) -+ { -+ /* Round HIGH up and adjust LOW to match. */ -+ high++; -+ if (high == unity) -+ { -+ /* May make it infinite, but that's OK. */ -+ high = 0; -+ exp++; -+ } -+ low = unity * 2 - low; -+ lowsign ^= 1; -+ } -+ -+ high |= (halffractype) exp << HALFFRACBITS; -+ high |= (halffractype) sign << (HALFFRACBITS + EXPBITS); -+ -+ if (exp == EXPMAX || exp == 0 || low == 0) -+ low = 0; -+ else -+ { -+ while (lowexp > 0 && low < unity) -+ { -+ low <<= 1; -+ lowexp--; -+ } -+ -+ if (lowexp <= 0) -+ { -+ halffractype roundmsb, round; -+ int shift; -+ -+ shift = 1 - lowexp; -+ roundmsb = (1 << (shift - 1)); -+ round = low & ((roundmsb << 1) - 1); -+ -+ low >>= shift; -+ lowexp = 0; -+ -+ if (round > roundmsb || (round == roundmsb && (low & 1) == 1)) -+ { -+ low++; -+ if (low == unity) -+ /* LOW rounds up to the smallest normal number. */ -+ lowexp++; -+ } -+ } -+ -+ low &= unity - 1; -+ low |= (halffractype) lowexp << HALFFRACBITS; -+ low |= (halffractype) lowsign << (HALFFRACBITS + EXPBITS); -+ } -+ dst.value_raw = ((fractype) high << HALFSHIFT) | low; -+ } -+# else -+ dst.value_raw = fraction & ((((fractype)1) << FRACBITS) - (fractype)1); -+ dst.value_raw |= ((fractype) (exp & ((1 << EXPBITS) - 1))) << FRACBITS; -+ dst.value_raw |= ((fractype) (sign & 1)) << (FRACBITS | EXPBITS); -+# endif -+#endif -+ -+#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT) -+#ifdef TFLOAT -+ { -+ qrtrfractype tmp1 = dst.words[0]; -+ qrtrfractype tmp2 = dst.words[1]; -+ dst.words[0] = dst.words[3]; -+ dst.words[1] = dst.words[2]; -+ dst.words[2] = tmp2; -+ dst.words[3] = tmp1; -+ } -+#else -+ { -+ halffractype tmp = dst.words[0]; -+ dst.words[0] = dst.words[1]; -+ dst.words[1] = tmp; -+ } -+#endif -+#endif -+ -+ return dst.value; -+} -+#endif -+ -+#if defined(L_unpack_df) || defined(L_unpack_sf) || defined(L_unpack_tf) -+void -+unpack_d (FLO_union_type * src, fp_number_type * dst) -+{ -+ /* We previously used bitfields to store the number, but this doesn't -+ handle little/big endian systems conveniently, so use shifts and -+ masks */ -+ fractype fraction; -+ int exp; -+ int sign; -+ -+#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT) -+ FLO_union_type swapped; -+ -+#ifdef TFLOAT -+ swapped.words[0] = src->words[3]; -+ swapped.words[1] = src->words[2]; -+ swapped.words[2] = src->words[1]; -+ swapped.words[3] = src->words[0]; -+#else -+ swapped.words[0] = src->words[1]; -+ swapped.words[1] = src->words[0]; -+#endif -+ src = &swapped; -+#endif -+ -+#ifdef FLOAT_BIT_ORDER_MISMATCH -+ fraction = src->bits.fraction; -+ exp = src->bits.exp; -+ sign = src->bits.sign; -+#else -+# if defined TFLOAT && defined HALFFRACBITS -+ { -+ halffractype high, low; -+ -+ high = src->value_raw >> HALFSHIFT; -+ low = src->value_raw & (((fractype)1 << HALFSHIFT) - 1); -+ -+ fraction = high & ((((fractype)1) << HALFFRACBITS) - 1); -+ fraction <<= FRACBITS - HALFFRACBITS; -+ exp = ((int)(high >> HALFFRACBITS)) & ((1 << EXPBITS) - 1); -+ sign = ((int)(high >> (((HALFFRACBITS + EXPBITS))))) & 1; -+ -+ if (exp != EXPMAX && exp != 0 && low != 0) -+ { -+ int lowexp = ((int)(low >> HALFFRACBITS)) & ((1 << EXPBITS) - 1); -+ int lowsign = ((int)(low >> (((HALFFRACBITS + EXPBITS))))) & 1; -+ int shift; -+ fractype xlow; -+ -+ xlow = low & ((((fractype)1) << HALFFRACBITS) - 1); -+ if (lowexp) -+ xlow |= (((halffractype)1) << HALFFRACBITS); -+ else -+ lowexp = 1; -+ shift = (FRACBITS - HALFFRACBITS) - (exp - lowexp); -+ if (shift > 0) -+ xlow <<= shift; -+ else if (shift < 0) -+ xlow >>= -shift; -+ if (sign == lowsign) -+ fraction += xlow; -+ else if (fraction >= xlow) -+ fraction -= xlow; -+ else -+ { -+ /* The high part is a power of two but the full number is lower. -+ This code will leave the implicit 1 in FRACTION, but we'd -+ have added that below anyway. */ -+ fraction = (((fractype) 1 << FRACBITS) - xlow) << 1; -+ exp--; -+ } -+ } -+ } -+# else -+ fraction = src->value_raw & ((((fractype)1) << FRACBITS) - 1); -+ exp = ((int)(src->value_raw >> FRACBITS)) & ((1 << EXPBITS) - 1); -+ sign = ((int)(src->value_raw >> (FRACBITS + EXPBITS))) & 1; -+# endif -+#endif -+ -+ dst->sign = sign; -+ if (exp == 0) -+ { -+ /* Hmm. Looks like 0 */ -+ if (fraction == 0 -+#ifdef NO_DENORMALS -+ || 1 -+#endif -+ ) -+ { -+ /* tastes like zero */ -+ dst->class = CLASS_ZERO; -+ } -+ else -+ { -+ /* Zero exponent with nonzero fraction - it's denormalized, -+ so there isn't a leading implicit one - we'll shift it so -+ it gets one. */ -+ dst->normal_exp = exp - EXPBIAS + 1; -+ fraction <<= NGARDS; -+ -+ dst->class = CLASS_NUMBER; -+#if 1 -+ while (fraction < IMPLICIT_1) -+ { -+ fraction <<= 1; -+ dst->normal_exp--; -+ } -+#endif -+ dst->fraction.ll = fraction; -+ } -+ } -+ else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && exp == EXPMAX) -+ { -+ /* Huge exponent*/ -+ if (fraction == 0) -+ { -+ /* Attached to a zero fraction - means infinity */ -+ dst->class = CLASS_INFINITY; -+ } -+ else -+ { -+ /* Nonzero fraction, means nan */ -+#ifdef QUIET_NAN_NEGATED -+ if ((fraction & QUIET_NAN) == 0) -+#else -+ if (fraction & QUIET_NAN) -+#endif -+ { -+ dst->class = CLASS_QNAN; -+ } -+ else -+ { -+ dst->class = CLASS_SNAN; -+ } -+ /* Keep the fraction part as the nan number */ -+ dst->fraction.ll = fraction; -+ } -+ } -+ else -+ { -+ /* Nothing strange about this number */ -+ dst->normal_exp = exp - EXPBIAS; -+ dst->class = CLASS_NUMBER; -+ dst->fraction.ll = (fraction << NGARDS) | IMPLICIT_1; -+ } -+} -+#endif /* L_unpack_df || L_unpack_sf */ -+ -+#if defined(L_addsub_sf) || defined(L_addsub_df) || defined(L_addsub_tf) -+static fp_number_type * -+_fpadd_parts (fp_number_type * a, -+ fp_number_type * b, -+ fp_number_type * tmp) -+{ -+ intfrac tfraction; -+ -+ /* Put commonly used fields in local variables. */ -+ int a_normal_exp; -+ int b_normal_exp; -+ fractype a_fraction; -+ fractype b_fraction; -+ -+ if (isnan (a)) -+ { -+ return a; -+ } -+ if (isnan (b)) -+ { -+ return b; -+ } -+ if (isinf (a)) -+ { -+ /* Adding infinities with opposite signs yields a NaN. */ -+ if (isinf (b) && a->sign != b->sign) -+ return nan (); -+ return a; -+ } -+ if (isinf (b)) -+ { -+ return b; -+ } -+ if (iszero (b)) -+ { -+ if (iszero (a)) -+ { -+ *tmp = *a; -+ tmp->sign = a->sign & b->sign; -+ return tmp; -+ } -+ return a; -+ } -+ if (iszero (a)) -+ { -+ return b; -+ } -+ -+ /* Got two numbers. shift the smaller and increment the exponent till -+ they're the same */ -+ { -+ int diff; -+ -+ a_normal_exp = a->normal_exp; -+ b_normal_exp = b->normal_exp; -+ a_fraction = a->fraction.ll; -+ b_fraction = b->fraction.ll; -+ -+ diff = a_normal_exp - b_normal_exp; -+ -+ if (diff < 0) -+ diff = -diff; -+ if (diff < FRAC_NBITS) -+ { -+ /* ??? This does shifts one bit at a time. Optimize. */ -+ while (a_normal_exp > b_normal_exp) -+ { -+ b_normal_exp++; -+ LSHIFT (b_fraction); -+ } -+ while (b_normal_exp > a_normal_exp) -+ { -+ a_normal_exp++; -+ LSHIFT (a_fraction); -+ } -+ } -+ else -+ { -+ /* Somethings's up.. choose the biggest */ -+ if (a_normal_exp > b_normal_exp) -+ { -+ b_normal_exp = a_normal_exp; -+ b_fraction = 0; -+ } -+ else -+ { -+ a_normal_exp = b_normal_exp; -+ a_fraction = 0; -+ } -+ } -+ } -+ -+ if (a->sign != b->sign) -+ { -+ if (a->sign) -+ { -+ tfraction = -a_fraction + b_fraction; -+ } -+ else -+ { -+ tfraction = a_fraction - b_fraction; -+ } -+ if (tfraction >= 0) -+ { -+ tmp->sign = 0; -+ tmp->normal_exp = a_normal_exp; -+ tmp->fraction.ll = tfraction; -+ } -+ else -+ { -+ tmp->sign = 1; -+ tmp->normal_exp = a_normal_exp; -+ tmp->fraction.ll = -tfraction; -+ } -+ /* and renormalize it */ -+ -+ while (tmp->fraction.ll < IMPLICIT_1 && tmp->fraction.ll) -+ { -+ tmp->fraction.ll <<= 1; -+ tmp->normal_exp--; -+ } -+ } -+ else -+ { -+ tmp->sign = a->sign; -+ tmp->normal_exp = a_normal_exp; -+ tmp->fraction.ll = a_fraction + b_fraction; -+ } -+ tmp->class = CLASS_NUMBER; -+ /* Now the fraction is added, we have to shift down to renormalize the -+ number */ -+ -+ if (tmp->fraction.ll >= IMPLICIT_2) -+ { -+ LSHIFT (tmp->fraction.ll); -+ tmp->normal_exp++; -+ } -+ return tmp; -+ -+} -+ -+FLO_type -+add (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ fp_number_type tmp; -+ fp_number_type *res; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ res = _fpadd_parts (&a, &b, &tmp); -+ -+ return pack_d (res); -+} -+ -+FLO_type -+sub (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ fp_number_type tmp; -+ fp_number_type *res; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ b.sign ^= 1; -+ -+ res = _fpadd_parts (&a, &b, &tmp); -+ -+ return pack_d (res); -+} -+#endif /* L_addsub_sf || L_addsub_df */ -+ -+#if defined(L_mul_sf) || defined(L_mul_df) || defined(L_mul_tf) -+static inline __attribute__ ((__always_inline__)) fp_number_type * -+_fpmul_parts ( fp_number_type * a, -+ fp_number_type * b, -+ fp_number_type * tmp) -+{ -+ fractype low = 0; -+ fractype high = 0; -+ -+ if (isnan (a)) -+ { -+ a->sign = a->sign != b->sign; -+ return a; -+ } -+ if (isnan (b)) -+ { -+ b->sign = a->sign != b->sign; -+ return b; -+ } -+ if (isinf (a)) -+ { -+ if (iszero (b)) -+ return nan (); -+ a->sign = a->sign != b->sign; -+ return a; -+ } -+ if (isinf (b)) -+ { -+ if (iszero (a)) -+ { -+ return nan (); -+ } -+ b->sign = a->sign != b->sign; -+ return b; -+ } -+ if (iszero (a)) -+ { -+ a->sign = a->sign != b->sign; -+ return a; -+ } -+ if (iszero (b)) -+ { -+ b->sign = a->sign != b->sign; -+ return b; -+ } -+ -+ /* Calculate the mantissa by multiplying both numbers to get a -+ twice-as-wide number. */ -+ { -+#if defined(NO_DI_MODE) || defined(TFLOAT) -+ { -+ fractype x = a->fraction.ll; -+ fractype ylow = b->fraction.ll; -+ fractype yhigh = 0; -+ int bit; -+ -+ /* ??? This does multiplies one bit at a time. Optimize. */ -+ for (bit = 0; bit < FRAC_NBITS; bit++) -+ { -+ int carry; -+ -+ if (x & 1) -+ { -+ carry = (low += ylow) < ylow; -+ high += yhigh + carry; -+ } -+ yhigh <<= 1; -+ if (ylow & FRACHIGH) -+ { -+ yhigh |= 1; -+ } -+ ylow <<= 1; -+ x >>= 1; -+ } -+ } -+#elif defined(FLOAT) -+ /* Multiplying two USIs to get a UDI, we're safe. */ -+ { -+ UDItype answer = (UDItype)a->fraction.ll * (UDItype)b->fraction.ll; -+ -+ high = answer >> BITS_PER_SI; -+ low = answer; -+ } -+#else -+ /* fractype is DImode, but we need the result to be twice as wide. -+ Assuming a widening multiply from DImode to TImode is not -+ available, build one by hand. */ -+ { -+ USItype nl = a->fraction.ll; -+ USItype nh = a->fraction.ll >> BITS_PER_SI; -+ USItype ml = b->fraction.ll; -+ USItype mh = b->fraction.ll >> BITS_PER_SI; -+ UDItype pp_ll = (UDItype) ml * nl; -+ UDItype pp_hl = (UDItype) mh * nl; -+ UDItype pp_lh = (UDItype) ml * nh; -+ UDItype pp_hh = (UDItype) mh * nh; -+ UDItype res2 = 0; -+ UDItype res0 = 0; -+ UDItype ps_hh__ = pp_hl + pp_lh; -+ if (ps_hh__ < pp_hl) -+ res2 += (UDItype)1 << BITS_PER_SI; -+ pp_hl = (UDItype)(USItype)ps_hh__ << BITS_PER_SI; -+ res0 = pp_ll + pp_hl; -+ if (res0 < pp_ll) -+ res2++; -+ res2 += (ps_hh__ >> BITS_PER_SI) + pp_hh; -+ high = res2; -+ low = res0; -+ } -+#endif -+ } -+ -+ tmp->normal_exp = a->normal_exp + b->normal_exp -+ + FRAC_NBITS - (FRACBITS + NGARDS); -+ tmp->sign = a->sign != b->sign; -+ while (high >= IMPLICIT_2) -+ { -+ tmp->normal_exp++; -+ if (high & 1) -+ { -+ low >>= 1; -+ low |= FRACHIGH; -+ } -+ high >>= 1; -+ } -+ while (high < IMPLICIT_1) -+ { -+ tmp->normal_exp--; -+ -+ high <<= 1; -+ if (low & FRACHIGH) -+ high |= 1; -+ low <<= 1; -+ } -+ /* rounding is tricky. if we only round if it won't make us round later. */ -+#if 0 -+ if (low & FRACHIGH2) -+ { -+ if (((high & GARDMASK) != GARDMSB) -+ && (((high + 1) & GARDMASK) == GARDMSB)) -+ { -+ /* don't round, it gets done again later. */ -+ } -+ else -+ { -+ high++; -+ } -+ } -+#endif -+ if (!ROUND_TOWARDS_ZERO && (high & GARDMASK) == GARDMSB) -+ { -+ if (high & (1 << NGARDS)) -+ { -+ /* half way, so round to even */ -+ high += GARDROUND + 1; -+ } -+ else if (low) -+ { -+ /* but we really weren't half way */ -+ high += GARDROUND + 1; -+ } -+ } -+ tmp->fraction.ll = high; -+ tmp->class = CLASS_NUMBER; -+ return tmp; -+} -+ -+FLO_type -+multiply (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ fp_number_type tmp; -+ fp_number_type *res; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ res = _fpmul_parts (&a, &b, &tmp); -+ -+ return pack_d (res); -+} -+#endif /* L_mul_sf || L_mul_df */ -+ -+#if defined(L_div_sf) || defined(L_div_df) || defined(L_div_tf) -+static inline __attribute__ ((__always_inline__)) fp_number_type * -+_fpdiv_parts (fp_number_type * a, -+ fp_number_type * b) -+{ -+ fractype bit; -+ fractype numerator; -+ fractype denominator; -+ fractype quotient; -+ -+ if (isnan (a)) -+ { -+ return a; -+ } -+ if (isnan (b)) -+ { -+ return b; -+ } -+ -+ a->sign = a->sign ^ b->sign; -+ -+ if (isinf (a) || iszero (a)) -+ { -+ if (a->class == b->class) -+ return nan (); -+ return a; -+ } -+ -+ if (isinf (b)) -+ { -+ a->fraction.ll = 0; -+ a->normal_exp = 0; -+ return a; -+ } -+ if (iszero (b)) -+ { -+ a->class = CLASS_INFINITY; -+ return a; -+ } -+ -+ /* Calculate the mantissa by multiplying both 64bit numbers to get a -+ 128 bit number */ -+ { -+ /* quotient = -+ ( numerator / denominator) * 2^(numerator exponent - denominator exponent) -+ */ -+ -+ a->normal_exp = a->normal_exp - b->normal_exp; -+ numerator = a->fraction.ll; -+ denominator = b->fraction.ll; -+ -+ if (numerator < denominator) -+ { -+ /* Fraction will be less than 1.0 */ -+ numerator *= 2; -+ a->normal_exp--; -+ } -+ bit = IMPLICIT_1; -+ quotient = 0; -+ /* ??? Does divide one bit at a time. Optimize. */ -+ while (bit) -+ { -+ if (numerator >= denominator) -+ { -+ quotient |= bit; -+ numerator -= denominator; -+ } -+ bit >>= 1; -+ numerator *= 2; -+ } -+ -+ if (!ROUND_TOWARDS_ZERO && (quotient & GARDMASK) == GARDMSB) -+ { -+ if (quotient & (1 << NGARDS)) -+ { -+ /* half way, so round to even */ -+ quotient += GARDROUND + 1; -+ } -+ else if (numerator) -+ { -+ /* but we really weren't half way, more bits exist */ -+ quotient += GARDROUND + 1; -+ } -+ } -+ -+ a->fraction.ll = quotient; -+ return (a); -+ } -+} -+ -+FLO_type -+divide (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ fp_number_type *res; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ res = _fpdiv_parts (&a, &b); -+ -+ return pack_d (res); -+} -+#endif /* L_div_sf || L_div_df */ -+ -+#if defined(L_fpcmp_parts_sf) || defined(L_fpcmp_parts_df) \ -+ || defined(L_fpcmp_parts_tf) -+/* according to the demo, fpcmp returns a comparison with 0... thus -+ a -1 -+ a==b -> 0 -+ a>b -> +1 -+ */ -+ -+int -+__fpcmp_parts (fp_number_type * a, fp_number_type * b) -+{ -+#if 0 -+ /* either nan -> unordered. Must be checked outside of this routine. */ -+ if (isnan (a) && isnan (b)) -+ { -+ return 1; /* still unordered! */ -+ } -+#endif -+ -+ if (isnan (a) || isnan (b)) -+ { -+ return 1; /* how to indicate unordered compare? */ -+ } -+ if (isinf (a) && isinf (b)) -+ { -+ /* +inf > -inf, but +inf != +inf */ -+ /* b \a| +inf(0)| -inf(1) -+ ______\+--------+-------- -+ +inf(0)| a==b(0)| ab(1) | a==b(0) -+ -------+--------+-------- -+ So since unordered must be nonzero, just line up the columns... -+ */ -+ return b->sign - a->sign; -+ } -+ /* but not both... */ -+ if (isinf (a)) -+ { -+ return a->sign ? -1 : 1; -+ } -+ if (isinf (b)) -+ { -+ return b->sign ? 1 : -1; -+ } -+ if (iszero (a) && iszero (b)) -+ { -+ return 0; -+ } -+ if (iszero (a)) -+ { -+ return b->sign ? 1 : -1; -+ } -+ if (iszero (b)) -+ { -+ return a->sign ? -1 : 1; -+ } -+ /* now both are "normal". */ -+ if (a->sign != b->sign) -+ { -+ /* opposite signs */ -+ return a->sign ? -1 : 1; -+ } -+ /* same sign; exponents? */ -+ if (a->normal_exp > b->normal_exp) -+ { -+ return a->sign ? -1 : 1; -+ } -+ if (a->normal_exp < b->normal_exp) -+ { -+ return a->sign ? 1 : -1; -+ } -+ /* same exponents; check size. */ -+ if (a->fraction.ll > b->fraction.ll) -+ { -+ return a->sign ? -1 : 1; -+ } -+ if (a->fraction.ll < b->fraction.ll) -+ { -+ return a->sign ? 1 : -1; -+ } -+ /* after all that, they're equal. */ -+ return 0; -+} -+#endif -+ -+#if defined(L_compare_sf) || defined(L_compare_df) || defined(L_compoare_tf) -+CMPtype -+compare (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ return __fpcmp_parts (&a, &b); -+} -+#endif /* L_compare_sf || L_compare_df */ -+ -+#ifndef US_SOFTWARE_GOFAST -+ -+/* These should be optimized for their specific tasks someday. */ -+ -+#if defined(L_eq_sf) || defined(L_eq_df) || defined(L_eq_tf) -+CMPtype -+_eq_f2 (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ if (isnan (&a) || isnan (&b)) -+ return 1; /* false, truth == 0 */ -+ -+ return __fpcmp_parts (&a, &b) ; -+} -+#endif /* L_eq_sf || L_eq_df */ -+ -+#if defined(L_ne_sf) || defined(L_ne_df) || defined(L_ne_tf) -+CMPtype -+_ne_f2 (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ if (isnan (&a) || isnan (&b)) -+ return 1; /* true, truth != 0 */ -+ -+ return __fpcmp_parts (&a, &b) ; -+} -+#endif /* L_ne_sf || L_ne_df */ -+ -+#if defined(L_gt_sf) || defined(L_gt_df) || defined(L_gt_tf) -+CMPtype -+_gt_f2 (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ if (isnan (&a) || isnan (&b)) -+ return -1; /* false, truth > 0 */ -+ -+ return __fpcmp_parts (&a, &b); -+} -+#endif /* L_gt_sf || L_gt_df */ -+ -+#if defined(L_ge_sf) || defined(L_ge_df) || defined(L_ge_tf) -+CMPtype -+_ge_f2 (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ if (isnan (&a) || isnan (&b)) -+ return -1; /* false, truth >= 0 */ -+ return __fpcmp_parts (&a, &b) ; -+} -+#endif /* L_ge_sf || L_ge_df */ -+ -+#if defined(L_lt_sf) || defined(L_lt_df) || defined(L_lt_tf) -+CMPtype -+_lt_f2 (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ if (isnan (&a) || isnan (&b)) -+ return 1; /* false, truth < 0 */ -+ -+ return __fpcmp_parts (&a, &b); -+} -+#endif /* L_lt_sf || L_lt_df */ -+ -+#if defined(L_le_sf) || defined(L_le_df) || defined(L_le_tf) -+CMPtype -+_le_f2 (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ if (isnan (&a) || isnan (&b)) -+ return 1; /* false, truth <= 0 */ -+ -+ return __fpcmp_parts (&a, &b) ; -+} -+#endif /* L_le_sf || L_le_df */ -+ -+#endif /* ! US_SOFTWARE_GOFAST */ -+ -+#if defined(L_unord_sf) || defined(L_unord_df) || defined(L_unord_tf) -+CMPtype -+_unord_f2 (FLO_type arg_a, FLO_type arg_b) -+{ -+ fp_number_type a; -+ fp_number_type b; -+ FLO_union_type au, bu; -+ -+ au.value = arg_a; -+ bu.value = arg_b; -+ -+ unpack_d (&au, &a); -+ unpack_d (&bu, &b); -+ -+ return (isnan (&a) || isnan (&b)); -+} -+#endif /* L_unord_sf || L_unord_df */ -+ -+#if defined(L_si_to_sf) || defined(L_si_to_df) || defined(L_si_to_tf) -+FLO_type -+si_to_float (SItype arg_a) -+{ -+ fp_number_type in; -+ -+ in.class = CLASS_NUMBER; -+ in.sign = arg_a < 0; -+ if (!arg_a) -+ { -+ in.class = CLASS_ZERO; -+ } -+ else -+ { -+ in.normal_exp = FRACBITS + NGARDS; -+ if (in.sign) -+ { -+ /* Special case for minint, since there is no +ve integer -+ representation for it */ -+ if (arg_a == (- MAX_SI_INT - 1)) -+ { -+ return (FLO_type)(- MAX_SI_INT - 1); -+ } -+ in.fraction.ll = (-arg_a); -+ } -+ else -+ in.fraction.ll = arg_a; -+ -+ while (in.fraction.ll < ((fractype)1 << (FRACBITS + NGARDS))) -+ { -+ in.fraction.ll <<= 1; -+ in.normal_exp -= 1; -+ } -+ } -+ return pack_d (&in); -+} -+#endif /* L_si_to_sf || L_si_to_df */ -+ -+#if defined(L_usi_to_sf) || defined(L_usi_to_df) || defined(L_usi_to_tf) -+FLO_type -+usi_to_float (USItype arg_a) -+{ -+ fp_number_type in; -+ -+ in.sign = 0; -+ if (!arg_a) -+ { -+ in.class = CLASS_ZERO; -+ } -+ else -+ { -+ in.class = CLASS_NUMBER; -+ in.normal_exp = FRACBITS + NGARDS; -+ in.fraction.ll = arg_a; -+ -+ while (in.fraction.ll > ((fractype)1 << (FRACBITS + NGARDS))) -+ { -+ in.fraction.ll >>= 1; -+ in.normal_exp += 1; -+ } -+ while (in.fraction.ll < ((fractype)1 << (FRACBITS + NGARDS))) -+ { -+ in.fraction.ll <<= 1; -+ in.normal_exp -= 1; -+ } -+ } -+ return pack_d (&in); -+} -+#endif -+ -+#if defined(L_sf_to_si) || defined(L_df_to_si) || defined(L_tf_to_si) -+SItype -+float_to_si (FLO_type arg_a) -+{ -+ fp_number_type a; -+ SItype tmp; -+ FLO_union_type au; -+ -+ au.value = arg_a; -+ unpack_d (&au, &a); -+ -+ if (iszero (&a)) -+ return 0; -+ if (isnan (&a)) -+ return 0; -+ /* get reasonable MAX_SI_INT... */ -+ if (isinf (&a)) -+ return a.sign ? (-MAX_SI_INT)-1 : MAX_SI_INT; -+ /* it is a number, but a small one */ -+ if (a.normal_exp < 0) -+ return 0; -+ if (a.normal_exp > BITS_PER_SI - 2) -+ return a.sign ? (-MAX_SI_INT)-1 : MAX_SI_INT; -+ tmp = a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp); -+ return a.sign ? (-tmp) : (tmp); -+} -+#endif /* L_sf_to_si || L_df_to_si */ -+ -+#if defined(L_sf_to_usi) || defined(L_df_to_usi) || defined(L_tf_to_usi) -+#if defined US_SOFTWARE_GOFAST || defined(L_tf_to_usi) -+/* While libgcc2.c defines its own __fixunssfsi and __fixunsdfsi routines, -+ we also define them for GOFAST because the ones in libgcc2.c have the -+ wrong names and I'd rather define these here and keep GOFAST CYG-LOC's -+ out of libgcc2.c. We can't define these here if not GOFAST because then -+ there'd be duplicate copies. */ -+ -+USItype -+float_to_usi (FLO_type arg_a) -+{ -+ fp_number_type a; -+ FLO_union_type au; -+ -+ au.value = arg_a; -+ unpack_d (&au, &a); -+ -+ if (iszero (&a)) -+ return 0; -+ if (isnan (&a)) -+ return 0; -+ /* it is a negative number */ -+ if (a.sign) -+ return 0; -+ /* get reasonable MAX_USI_INT... */ -+ if (isinf (&a)) -+ return MAX_USI_INT; -+ /* it is a number, but a small one */ -+ if (a.normal_exp < 0) -+ return 0; -+ if (a.normal_exp > BITS_PER_SI - 1) -+ return MAX_USI_INT; -+ else if (a.normal_exp > (FRACBITS + NGARDS)) -+ return a.fraction.ll << (a.normal_exp - (FRACBITS + NGARDS)); -+ else -+ return a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp); -+} -+#endif /* US_SOFTWARE_GOFAST */ -+#endif /* L_sf_to_usi || L_df_to_usi */ -+ -+#if defined(L_negate_sf) || defined(L_negate_df) || defined(L_negate_tf) -+FLO_type -+negate (FLO_type arg_a) -+{ -+ fp_number_type a; -+ FLO_union_type au; -+ -+ au.value = arg_a; -+ unpack_d (&au, &a); -+ -+ flip_sign (&a); -+ return pack_d (&a); -+} -+#endif /* L_negate_sf || L_negate_df */ -+ -+#ifdef FLOAT -+ -+#if defined(L_make_sf) -+SFtype -+__make_fp(fp_class_type class, -+ unsigned int sign, -+ int exp, -+ USItype frac) -+{ -+ fp_number_type in; -+ -+ in.class = class; -+ in.sign = sign; -+ in.normal_exp = exp; -+ in.fraction.ll = frac; -+ return pack_d (&in); -+} -+#endif /* L_make_sf */ -+ -+#ifndef FLOAT_ONLY -+ -+/* This enables one to build an fp library that supports float but not double. -+ Otherwise, we would get an undefined reference to __make_dp. -+ This is needed for some 8-bit ports that can't handle well values that -+ are 8-bytes in size, so we just don't support double for them at all. */ -+ -+#if defined(L_sf_to_df) -+DFtype -+sf_to_df (SFtype arg_a) -+{ -+ fp_number_type in; -+ FLO_union_type au; -+ -+ au.value = arg_a; -+ unpack_d (&au, &in); -+ -+ return __make_dp (in.class, in.sign, in.normal_exp, -+ ((UDItype) in.fraction.ll) << F_D_BITOFF); -+} -+#endif /* L_sf_to_df */ -+ -+#if defined(L_sf_to_tf) && defined(TMODES) -+TFtype -+sf_to_tf (SFtype arg_a) -+{ -+ fp_number_type in; -+ FLO_union_type au; -+ -+ au.value = arg_a; -+ unpack_d (&au, &in); -+ -+ return __make_tp (in.class, in.sign, in.normal_exp, -+ ((UTItype) in.fraction.ll) << F_T_BITOFF); -+} -+#endif /* L_sf_to_df */ -+ -+#endif /* ! FLOAT_ONLY */ -+#endif /* FLOAT */ -+ -+#ifndef FLOAT -+ -+extern SFtype __make_fp (fp_class_type, unsigned int, int, USItype); -+ -+#if defined(L_make_df) -+DFtype -+__make_dp (fp_class_type class, unsigned int sign, int exp, UDItype frac) -+{ -+ fp_number_type in; -+ -+ in.class = class; -+ in.sign = sign; -+ in.normal_exp = exp; -+ in.fraction.ll = frac; -+ return pack_d (&in); -+} -+#endif /* L_make_df */ -+ -+#if defined(L_df_to_sf) -+SFtype -+df_to_sf (DFtype arg_a) -+{ -+ fp_number_type in; -+ USItype sffrac; -+ FLO_union_type au; -+ -+ au.value = arg_a; -+ unpack_d (&au, &in); -+ -+ sffrac = in.fraction.ll >> F_D_BITOFF; -+ -+ /* We set the lowest guard bit in SFFRAC if we discarded any non -+ zero bits. */ -+ if ((in.fraction.ll & (((USItype) 1 << F_D_BITOFF) - 1)) != 0) -+ sffrac |= 1; -+ -+ return __make_fp (in.class, in.sign, in.normal_exp, sffrac); -+} -+#endif /* L_df_to_sf */ -+ -+#if defined(L_df_to_tf) && defined(TMODES) \ -+ && !defined(FLOAT) && !defined(TFLOAT) -+TFtype -+df_to_tf (DFtype arg_a) -+{ -+ fp_number_type in; -+ FLO_union_type au; -+ -+ au.value = arg_a; -+ unpack_d (&au, &in); -+ -+ return __make_tp (in.class, in.sign, in.normal_exp, -+ ((UTItype) in.fraction.ll) << D_T_BITOFF); -+} -+#endif /* L_sf_to_df */ -+ -+#ifdef TFLOAT -+#if defined(L_make_tf) -+TFtype -+__make_tp(fp_class_type class, -+ unsigned int sign, -+ int exp, -+ UTItype frac) -+{ -+ fp_number_type in; -+ -+ in.class = class; -+ in.sign = sign; -+ in.normal_exp = exp; -+ in.fraction.ll = frac; -+ return pack_d (&in); -+} -+#endif /* L_make_tf */ -+ -+#if defined(L_tf_to_df) -+DFtype -+tf_to_df (TFtype arg_a) -+{ -+ fp_number_type in; -+ UDItype sffrac; -+ FLO_union_type au; -+ -+ au.value = arg_a; -+ unpack_d (&au, &in); -+ -+ sffrac = in.fraction.ll >> D_T_BITOFF; -+ -+ /* We set the lowest guard bit in SFFRAC if we discarded any non -+ zero bits. */ -+ if ((in.fraction.ll & (((UTItype) 1 << D_T_BITOFF) - 1)) != 0) -+ sffrac |= 1; -+ -+ return __make_dp (in.class, in.sign, in.normal_exp, sffrac); -+} -+#endif /* L_tf_to_df */ -+ -+#if defined(L_tf_to_sf) -+SFtype -+tf_to_sf (TFtype arg_a) -+{ -+ fp_number_type in; -+ USItype sffrac; -+ FLO_union_type au; -+ -+ au.value = arg_a; -+ unpack_d (&au, &in); -+ -+ sffrac = in.fraction.ll >> F_T_BITOFF; -+ -+ /* We set the lowest guard bit in SFFRAC if we discarded any non -+ zero bits. */ -+ if ((in.fraction.ll & (((UTItype) 1 << F_T_BITOFF) - 1)) != 0) -+ sffrac |= 1; -+ -+ return __make_fp (in.class, in.sign, in.normal_exp, sffrac); -+} -+#endif /* L_tf_to_sf */ -+#endif /* TFLOAT */ -+ -+#endif /* ! FLOAT */ -+#endif /* !EXTENDED_FLOAT_STUBS */ -diff -durN gcc-3.4.6.orig/gcc/config/nios2/nios2.h gcc-3.4.6/gcc/config/nios2/nios2.h ---- gcc-3.4.6.orig/gcc/config/nios2/nios2.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/gcc/config/nios2/nios2.h 2007-08-15 23:09:36.000000000 +0200 -@@ -0,0 +1,824 @@ -+/* Definitions of target machine for Altera NIOS 2G NIOS2 version. -+ Copyright (C) 2003 Altera -+ Contributed by Jonah Graham (jgraham@altera.com). -+ -+This file is part of GNU CC. -+ -+GNU CC is free software; you can redistribute it and/or modify -+it under the terms of the GNU General Public License as published by -+the Free Software Foundation; either version 2, or (at your option) -+any later version. -+ -+GNU CC is distributed in the hope that it will be useful, -+but WITHOUT ANY WARRANTY; without even the implied warranty of -+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+GNU General Public License for more details. -+ -+You should have received a copy of the GNU General Public License -+along with GNU CC; see the file COPYING. If not, write to -+the Free Software Foundation, 59 Temple Place - Suite 330, -+Boston, MA 02111-1307, USA. */ -+ -+ -+ -+#define TARGET_CPU_CPP_BUILTINS() \ -+ do \ -+ { \ -+ builtin_define_std ("NIOS2"); \ -+ builtin_define_std ("nios2"); \ -+ builtin_define ("_GNU_SOURCE"); \ -+ } \ -+ while (0) -+#define TARGET_VERSION fprintf (stderr, " (Altera Nios II)") -+ -+ -+ -+ -+ -+/********************************* -+ * Run-time Target Specification -+ *********************************/ -+ -+#define HAS_DIV_FLAG 0x0001 -+#define HAS_MUL_FLAG 0x0002 -+#define HAS_MULX_FLAG 0x0004 -+#define FAST_SW_DIV_FLAG 0x0008 -+#define INLINE_MEMCPY_FLAG 0x00010 -+#define CACHE_VOLATILE_FLAG 0x0020 -+#define BYPASS_CACHE_FLAG 0x0040 -+ -+extern int target_flags; -+#define TARGET_HAS_DIV (target_flags & HAS_DIV_FLAG) -+#define TARGET_HAS_MUL (target_flags & HAS_MUL_FLAG) -+#define TARGET_HAS_MULX (target_flags & HAS_MULX_FLAG) -+#define TARGET_FAST_SW_DIV (target_flags & FAST_SW_DIV_FLAG) -+#define TARGET_INLINE_MEMCPY (target_flags & INLINE_MEMCPY_FLAG) -+#define TARGET_CACHE_VOLATILE (target_flags & CACHE_VOLATILE_FLAG) -+#define TARGET_BYPASS_CACHE (target_flags & BYPASS_CACHE_FLAG) -+ -+#define TARGET_SWITCHES \ -+{ \ -+ { "hw-div", HAS_DIV_FLAG, \ -+ N_("Enable DIV, DIVU") }, \ -+ { "no-hw-div", -HAS_DIV_FLAG, \ -+ N_("Disable DIV, DIVU (default)") }, \ -+ { "hw-mul", HAS_MUL_FLAG, \ -+ N_("Enable MUL instructions (default)") }, \ -+ { "hw-mulx", HAS_MULX_FLAG, \ -+ N_("Enable MULX instructions, assume fast shifter") }, \ -+ { "no-hw-mul", -HAS_MUL_FLAG, \ -+ N_("Disable MUL instructions") }, \ -+ { "no-hw-mulx", -HAS_MULX_FLAG, \ -+ N_("Disable MULX instructions, assume slow shifter (default and implied by -mno-hw-mul)") }, \ -+ { "fast-sw-div", FAST_SW_DIV_FLAG, \ -+ N_("Use table based fast divide (default at -O3)") }, \ -+ { "no-fast-sw-div", -FAST_SW_DIV_FLAG, \ -+ N_("Don't use table based fast divide ever") }, \ -+ { "inline-memcpy", INLINE_MEMCPY_FLAG, \ -+ N_("Inline small memcpy (default when optimizing)") }, \ -+ { "no-inline-memcpy", -INLINE_MEMCPY_FLAG, \ -+ N_("Don't Inline small memcpy") }, \ -+ { "cache-volatile", CACHE_VOLATILE_FLAG, \ -+ N_("Volatile accesses use non-io variants of instructions (default)") }, \ -+ { "no-cache-volatile", -CACHE_VOLATILE_FLAG, \ -+ N_("Volatile accesses use io variants of instructions") }, \ -+ { "bypass-cache", BYPASS_CACHE_FLAG, \ -+ N_("All ld/st instructins use io variants") }, \ -+ { "no-bypass-cache", -BYPASS_CACHE_FLAG, \ -+ N_("All ld/st instructins do not use io variants (default)") }, \ -+ { "smallc", 0, \ -+ N_("Link with a limited version of the C library") }, \ -+ { "ctors-in-init", 0, \ -+ "" /* undocumented: N_("Link with static constructors and destructors in init") */ }, \ -+ { "", TARGET_DEFAULT, 0 } \ -+} -+ -+ -+extern const char *nios2_sys_nosys_string; /* for -msys=nosys */ -+extern const char *nios2_sys_lib_string; /* for -msys-lib= */ -+extern const char *nios2_sys_crt0_string; /* for -msys-crt0= */ -+ -+#define TARGET_OPTIONS \ -+{ \ -+ { "sys=nosys", &nios2_sys_nosys_string, \ -+ N_("Use stub versions of OS library calls (default)"), 0}, \ -+ { "sys-lib=", &nios2_sys_lib_string, \ -+ N_("Name of System Library to link against. (Converted to a -l option)"), 0}, \ -+ { "sys-crt0=", &nios2_sys_crt0_string, \ -+ N_("Name of the startfile. (default is a crt0 for the ISS only)"), 0}, \ -+} -+ -+ -+/* Default target_flags if no switches specified. */ -+#ifndef TARGET_DEFAULT -+# define TARGET_DEFAULT (HAS_MUL_FLAG | CACHE_VOLATILE_FLAG) -+#endif -+ -+/* Switch Recognition by gcc.c. Add -G xx support */ -+#undef SWITCH_TAKES_ARG -+#define SWITCH_TAKES_ARG(CHAR) \ -+ (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G') -+ -+#define OVERRIDE_OPTIONS override_options () -+#define OPTIMIZATION_OPTIONS(LEVEL, SIZE) optimization_options (LEVEL, SIZE) -+#define CAN_DEBUG_WITHOUT_FP -+ -+#define CC1_SPEC "\ -+%{G*}" -+ -+#undef LIB_SPEC -+#define LIB_SPEC \ -+"--start-group %{msmallc: -lsmallc} %{!msmallc: -lc} -lgcc \ -+ %{msys-lib=*: -l%*} \ -+ %{!msys-lib=*: -lc } \ -+ --end-group \ -+ %{msys-lib=: %eYou need a library name for -msys-lib=} \ -+" -+ -+ -+#undef STARTFILE_SPEC -+#define STARTFILE_SPEC \ -+"%{msys-crt0=*: %*} %{!msys-crt0=*: crt1%O%s} \ -+ %{msys-crt0=: %eYou need a C startup file for -msys-crt0=} \ -+ %{mctors-in-init: crti%O%s crtbegin%O%s} \ -+" -+ -+#undef ENDFILE_SPEC -+#define ENDFILE_SPEC \ -+ "%{mctors-in-init: crtend%O%s crtn%O%s}" -+ -+ -+/*********************** -+ * Storage Layout -+ ***********************/ -+ -+#define DEFAULT_SIGNED_CHAR 1 -+#define BITS_BIG_ENDIAN 0 -+#define BYTES_BIG_ENDIAN 0 -+#define WORDS_BIG_ENDIAN 0 -+#define BITS_PER_UNIT 8 -+#define BITS_PER_WORD 32 -+#define UNITS_PER_WORD 4 -+#define POINTER_SIZE 32 -+#define BIGGEST_ALIGNMENT 32 -+#define STRICT_ALIGNMENT 1 -+#define FUNCTION_BOUNDARY 32 -+#define PARM_BOUNDARY 32 -+#define STACK_BOUNDARY 32 -+#define PREFERRED_STACK_BOUNDARY 32 -+#define MAX_FIXED_MODE_SIZE 64 -+ -+#define CONSTANT_ALIGNMENT(EXP, ALIGN) \ -+ ((TREE_CODE (EXP) == STRING_CST) \ -+ && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN)) -+ -+ -+/********************** -+ * Layout of Source Language Data Types -+ **********************/ -+ -+#define INT_TYPE_SIZE 32 -+#define SHORT_TYPE_SIZE 16 -+#define LONG_TYPE_SIZE 32 -+#define LONG_LONG_TYPE_SIZE 64 -+#define FLOAT_TYPE_SIZE 32 -+#define DOUBLE_TYPE_SIZE 64 -+#define LONG_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE -+ -+ -+/************************* -+ * Condition Code Status -+ ************************/ -+ -+/* comparison type */ -+/* ??? currently only CMP_SI is used */ -+enum cmp_type { -+ CMP_SI, /* compare four byte integers */ -+ CMP_DI, /* compare eight byte integers */ -+ CMP_SF, /* compare single precision floats */ -+ CMP_DF, /* compare double precision floats */ -+ CMP_MAX /* max comparison type */ -+}; -+ -+extern GTY(()) rtx branch_cmp[2]; /* operands for compare */ -+extern enum cmp_type branch_type; /* what type of branch to use */ -+ -+/********************** -+ * Register Usage -+ **********************/ -+ -+/* ---------------------------------- * -+ * Basic Characteristics of Registers -+ * ---------------------------------- */ -+ -+/* -+Register Number -+ Register Name -+ Alternate Name -+ Purpose -+0 r0 zero always zero -+1 r1 at Assembler Temporary -+2-3 r2-r3 Return Location -+4-7 r4-r7 Register Arguments -+8-15 r8-r15 Caller Saved Registers -+16-22 r16-r22 Callee Saved Registers -+23 r23 sc Static Chain (Callee Saved) -+ ??? Does $sc want to be caller or callee -+ saved. If caller, 15, else 23. -+24 r24 Exception Temporary -+25 r25 Breakpoint Temporary -+26 r26 gp Global Pointer -+27 r27 sp Stack Pointer -+28 r28 fp Frame Pointer -+29 r29 ea Exception Return Address -+30 r30 ba Breakpoint Return Address -+31 r31 ra Return Address -+ -+32 ctl0 status -+33 ctl1 estatus STATUS saved by exception ? -+34 ctl2 bstatus STATUS saved by break ? -+35 ctl3 ipri Interrupt Priority Mask ? -+36 ctl4 ecause Exception Cause ? -+ -+37 pc Not an actual register -+ -+38 rap Return address pointer, this does not -+ actually exist and will be eliminated -+ -+39 fake_fp Fake Frame Pointer which will always be eliminated. -+40 fake_ap Fake Argument Pointer which will always be eliminated. -+ -+41 First Pseudo Register -+ -+ -+The definitions for all the hard register numbers -+are located in nios2.md. -+*/ -+ -+#define FIRST_PSEUDO_REGISTER 41 -+#define NUM_ARG_REGS (LAST_ARG_REGNO - FIRST_ARG_REGNO + 1) -+ -+ -+ -+/* also see CONDITIONAL_REGISTER_USAGE */ -+#define FIXED_REGISTERS \ -+ { \ -+/* +0 1 2 3 4 5 6 7 8 9 */ \ -+/* 0 */ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, \ -+/* 10 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ -+/* 20 */ 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, \ -+/* 30 */ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, \ -+/* 40 */ 1, \ -+ } -+ -+/* call used is the same as caller saved -+ + fixed regs + args + ret vals */ -+#define CALL_USED_REGISTERS \ -+ { \ -+/* +0 1 2 3 4 5 6 7 8 9 */ \ -+/* 0 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ -+/* 10 */ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, \ -+/* 20 */ 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, \ -+/* 30 */ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, \ -+/* 40 */ 1, \ -+ } -+ -+#define HARD_REGNO_NREGS(REGNO, MODE) \ -+ ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \ -+ / UNITS_PER_WORD) -+ -+/* --------------------------- * -+ * How Values Fit in Registers -+ * --------------------------- */ -+ -+#define HARD_REGNO_MODE_OK(REGNO, MODE) 1 -+ -+#define MODES_TIEABLE_P(MODE1, MODE2) 1 -+ -+ -+/************************* -+ * Register Classes -+ *************************/ -+ -+enum reg_class -+{ -+ NO_REGS, -+ ALL_REGS, -+ LIM_REG_CLASSES -+}; -+ -+#define N_REG_CLASSES (int) LIM_REG_CLASSES -+ -+#define REG_CLASS_NAMES \ -+ {"NO_REGS", \ -+ "ALL_REGS"} -+ -+#define GENERAL_REGS ALL_REGS -+ -+#define REG_CLASS_CONTENTS \ -+/* NO_REGS */ {{ 0, 0}, \ -+/* ALL_REGS */ {~0,~0}} \ -+ -+#define REGNO_REG_CLASS(REGNO) ALL_REGS -+ -+#define BASE_REG_CLASS ALL_REGS -+#define INDEX_REG_CLASS ALL_REGS -+ -+/* only one reg class, 'r', is handled automatically */ -+#define REG_CLASS_FROM_LETTER(CHAR) NO_REGS -+ -+#define REGNO_OK_FOR_BASE_P2(REGNO, STRICT) \ -+ ((STRICT) \ -+ ? (REGNO) < FIRST_PSEUDO_REGISTER \ -+ : (REGNO) < FIRST_PSEUDO_REGISTER || (reg_renumber && reg_renumber[REGNO] < FIRST_PSEUDO_REGISTER)) -+ -+#define REGNO_OK_FOR_INDEX_P2(REGNO, STRICT) \ -+ (REGNO_OK_FOR_BASE_P2 (REGNO, STRICT)) -+ -+#define REGNO_OK_FOR_BASE_P(REGNO) \ -+ (REGNO_OK_FOR_BASE_P2 (REGNO, 1)) -+ -+#define REGNO_OK_FOR_INDEX_P(REGNO) \ -+ (REGNO_OK_FOR_INDEX_P2 (REGNO, 1)) -+ -+#define REG_OK_FOR_BASE_P2(X, STRICT) \ -+ (STRICT \ -+ ? REGNO_OK_FOR_BASE_P2 (REGNO (X), 1) \ -+ : REGNO_OK_FOR_BASE_P2 (REGNO (X), 1) || REGNO(X) >= FIRST_PSEUDO_REGISTER) -+ -+#define REG_OK_FOR_INDEX_P2(X, STRICT) \ -+ (STRICT \ -+ ? REGNO_OK_FOR_INDEX_P2 (REGNO (X), 1) \ -+ : REGNO_OK_FOR_INDEX_P2 (REGNO (X), 1) || REGNO(X) >= FIRST_PSEUDO_REGISTER) -+ -+#define CLASS_MAX_NREGS(CLASS, MODE) \ -+ ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \ -+ / UNITS_PER_WORD) -+ -+ -+#define SMALL_INT(X) ((unsigned HOST_WIDE_INT) ((X) + 0x8000) < 0x10000) -+#define SMALL_INT_UNSIGNED(X) ((unsigned HOST_WIDE_INT) (X) < 0x10000) -+#define UPPER16_INT(X) (((X) & 0xffff) == 0) -+#define SHIFT_INT(X) ((X) >= 0 && (X) <= 31) -+#define RDWRCTL_INT(X) ((X) >= 0 && (X) <= 31) -+#define CUSTOM_INSN_OPCODE(X) ((X) >= 0 && (X) <= 255) -+ -+#define CONST_OK_FOR_LETTER_P(VALUE, C) \ -+ ( \ -+ (C) == 'I' ? SMALL_INT (VALUE) : \ -+ (C) == 'J' ? SMALL_INT_UNSIGNED (VALUE) : \ -+ (C) == 'K' ? UPPER16_INT (VALUE) : \ -+ (C) == 'L' ? SHIFT_INT (VALUE) : \ -+ (C) == 'M' ? (VALUE) == 0 : \ -+ (C) == 'N' ? CUSTOM_INSN_OPCODE (VALUE) : \ -+ (C) == 'O' ? RDWRCTL_INT (VALUE) : \ -+ 0) -+ -+#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 0 -+ -+#define PREFERRED_RELOAD_CLASS(X, CLASS) \ -+ ((CLASS) == NO_REGS ? GENERAL_REGS : (CLASS)) -+ -+/* 'S' matches immediates which are in small data -+ and therefore can be added to gp to create a -+ 32-bit value. */ -+#define EXTRA_CONSTRAINT(VALUE, C) \ -+ ((C) == 'S' \ -+ && (GET_CODE (VALUE) == SYMBOL_REF) \ -+ && SYMBOL_REF_IN_NIOS2_SMALL_DATA_P (VALUE)) -+ -+ -+ -+ -+/* Say that the epilogue uses the return address register. Note that -+ in the case of sibcalls, the values "used by the epilogue" are -+ considered live at the start of the called function. */ -+#define EPILOGUE_USES(REGNO) ((REGNO) == RA_REGNO) -+ -+ -+#define DEFAULT_MAIN_RETURN c_expand_return (integer_zero_node) -+ -+/********************************** -+ * Trampolines for Nested Functions -+ ***********************************/ -+ -+#define TRAMPOLINE_TEMPLATE(FILE) \ -+ error ("trampolines not yet implemented") -+#define TRAMPOLINE_SIZE 20 -+#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ -+ error ("trampolines not yet implemented") -+ -+/*************************** -+ * Stack Layout and Calling Conventions -+ ***************************/ -+ -+/* ------------------ * -+ * Basic Stack Layout -+ * ------------------ */ -+ -+/* The downward variants are used by the compiler, -+ the upward ones serve as documentation */ -+#define STACK_GROWS_DOWNWARD -+#define FRAME_GROWS_UPWARD -+#define ARGS_GROW_UPWARD -+ -+#define STARTING_FRAME_OFFSET current_function_outgoing_args_size -+#define FIRST_PARM_OFFSET(FUNDECL) 0 -+ -+/* Before the prologue, RA lives in r31. */ -+#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (VOIDmode, RA_REGNO) -+ -+/* -------------------------------------- * -+ * Registers That Address the Stack Frame -+ * -------------------------------------- */ -+ -+#define STACK_POINTER_REGNUM SP_REGNO -+#define STATIC_CHAIN_REGNUM SC_REGNO -+#define PC_REGNUM PC_REGNO -+#define DWARF_FRAME_RETURN_COLUMN RA_REGNO -+ -+/* Base register for access to local variables of the function. We -+ pretend that the frame pointer is a non-existent hard register, and -+ then eliminate it to HARD_FRAME_POINTER_REGNUM. */ -+#define FRAME_POINTER_REGNUM FAKE_FP_REGNO -+ -+#define HARD_FRAME_POINTER_REGNUM FP_REGNO -+#define RETURN_ADDRESS_POINTER_REGNUM RAP_REGNO -+/* the argumnet pointer needs to always be eliminated -+ so it is set to a fake hard register. */ -+#define ARG_POINTER_REGNUM FAKE_AP_REGNO -+ -+/* ----------------------------------------- * -+ * Eliminating Frame Pointer and Arg Pointer -+ * ----------------------------------------- */ -+ -+#define FRAME_POINTER_REQUIRED 0 -+ -+#define ELIMINABLE_REGS \ -+{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ -+ { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ -+ { RETURN_ADDRESS_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ -+ { RETURN_ADDRESS_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ -+ { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ -+ { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}} -+ -+#define CAN_ELIMINATE(FROM, TO) 1 -+ -+#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ -+ (OFFSET) = nios2_initial_elimination_offset ((FROM), (TO)) -+ -+#define MUST_SAVE_REGISTER(regno) \ -+ ((regs_ever_live[regno] && !call_used_regs[regno]) \ -+ || (regno == HARD_FRAME_POINTER_REGNUM && frame_pointer_needed) \ -+ || (regno == RA_REGNO && regs_ever_live[RA_REGNO])) -+ -+/* Treat LOC as a byte offset from the stack pointer and round it up -+ to the next fully-aligned offset. */ -+#define STACK_ALIGN(LOC) \ -+ (((LOC) + ((PREFERRED_STACK_BOUNDARY / 8) - 1)) & ~((PREFERRED_STACK_BOUNDARY / 8) - 1)) -+ -+ -+/* ------------------------------ * -+ * Passing Arguments in Registers -+ * ------------------------------ */ -+ -+/* see nios2.c */ -+#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ -+ (function_arg (&CUM, MODE, TYPE, NAMED)) -+ -+#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \ -+ (function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)) -+ -+#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) 0 -+ -+#define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) 0 -+ -+typedef struct nios2_args -+{ -+ int regs_used; -+} CUMULATIVE_ARGS; -+ -+/* This is to initialize the above unused CUM data type */ -+#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \ -+ (init_cumulative_args (&CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS)) -+ -+#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ -+ (function_arg_advance (&CUM, MODE, TYPE, NAMED)) -+ -+#define FUNCTION_ARG_REGNO_P(REGNO) \ -+ ((REGNO) >= FIRST_ARG_REGNO && (REGNO) <= LAST_ARG_REGNO) -+ -+#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \ -+ { \ -+ int pret_size = nios2_setup_incoming_varargs (&(CUM), (MODE), \ -+ (TYPE), (NO_RTL)); \ -+ if (pret_size) \ -+ (PRETEND_SIZE) = pret_size; \ -+ } -+ -+/* ----------------------------- * -+ * Generating Code for Profiling -+ * ----------------------------- */ -+ -+#define PROFILE_BEFORE_PROLOGUE -+ -+#define FUNCTION_PROFILER(FILE, LABELNO) \ -+ function_profiler ((FILE), (LABELNO)) -+ -+/* --------------------------------------- * -+ * Passing Function Arguments on the Stack -+ * --------------------------------------- */ -+ -+#define PROMOTE_PROTOTYPES 1 -+ -+#define PUSH_ARGS 0 -+#define ACCUMULATE_OUTGOING_ARGS 1 -+ -+#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACKSIZE) 0 -+ -+/* --------------------------------------- * -+ * How Scalar Function Values Are Returned -+ * --------------------------------------- */ -+ -+#define FUNCTION_VALUE(VALTYPE, FUNC) \ -+ gen_rtx(REG, TYPE_MODE(VALTYPE), FIRST_RETVAL_REGNO) -+ -+#define LIBCALL_VALUE(MODE) \ -+ gen_rtx(REG, MODE, FIRST_RETVAL_REGNO) -+ -+#define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO) == FIRST_RETVAL_REGNO) -+ -+/* ----------------------------- * -+ * How Large Values Are Returned -+ * ----------------------------- */ -+ -+ -+#define RETURN_IN_MEMORY(TYPE) \ -+ nios2_return_in_memory (TYPE) -+ -+ -+#define STRUCT_VALUE 0 -+ -+#define DEFAULT_PCC_STRUCT_RETURN 0 -+ -+/******************* -+ * Addressing Modes -+ *******************/ -+ -+ -+#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) -+ -+#define CONSTANT_ADDRESS_P(X) (CONSTANT_P (X)) -+ -+#define MAX_REGS_PER_ADDRESS 1 -+ -+/* Go to ADDR if X is a valid address. */ -+#ifndef REG_OK_STRICT -+#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ -+ { \ -+ if (nios2_legitimate_address ((X), (MODE), 0)) \ -+ goto ADDR; \ -+ } -+#else -+#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ -+ { \ -+ if (nios2_legitimate_address ((X), (MODE), 1)) \ -+ goto ADDR; \ -+ } -+#endif -+ -+#ifndef REG_OK_STRICT -+#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P2 (REGNO (X), 0) -+#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P2 (REGNO (X), 0) -+#else -+#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P2 (REGNO (X), 1) -+#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P2 (REGNO (X), 1) -+#endif -+ -+#define LEGITIMATE_CONSTANT_P(X) 1 -+ -+/* Nios II has no mode dependent addresses. */ -+#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) -+ -+/* Set if this has a weak declaration */ -+#define SYMBOL_FLAG_WEAK_DECL (1 << SYMBOL_FLAG_MACH_DEP_SHIFT) -+#define SYMBOL_REF_WEAK_DECL_P(RTX) \ -+ ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_WEAK_DECL) != 0) -+ -+ -+/* true if a symbol is both small and not weak. In this case, gp -+ relative access can be used */ -+#define SYMBOL_REF_IN_NIOS2_SMALL_DATA_P(RTX) \ -+ (SYMBOL_REF_SMALL_P(RTX) && !SYMBOL_REF_WEAK_DECL_P(RTX)) -+ -+/***************** -+ * Describing Relative Costs of Operations -+ *****************/ -+ -+#define SLOW_BYTE_ACCESS 1 -+ -+/* It is as good to call a constant function address as to call an address -+ kept in a register. -+ ??? Not true anymore really. Now that call cannot address full range -+ of memory callr may need to be used */ -+ -+#define NO_FUNCTION_CSE -+#define NO_RECURSIVE_FUNCTION_CSE -+ -+ -+ -+/***************************************** -+ * Defining the Output Assembler Language -+ *****************************************/ -+ -+/* ------------------------------------------ * -+ * The Overall Framework of an Assembler File -+ * ------------------------------------------ */ -+ -+#define ASM_APP_ON "#APP\n" -+#define ASM_APP_OFF "#NO_APP\n" -+ -+#define ASM_COMMENT_START "# " -+ -+/* ------------------------------- * -+ * Output and Generation of Labels -+ * ------------------------------- */ -+ -+#define GLOBAL_ASM_OP "\t.global\t" -+ -+ -+/* -------------- * -+ * Output of Data -+ * -------------- */ -+ -+#define DWARF2_UNWIND_INFO 0 -+ -+ -+/* -------------------------------- * -+ * Assembler Commands for Alignment -+ * -------------------------------- */ -+ -+#define ASM_OUTPUT_ALIGN(FILE, LOG) \ -+ do { \ -+ fprintf ((FILE), "%s%d\n", ALIGN_ASM_OP, (LOG)); \ -+ } while (0) -+ -+ -+/* -------------------------------- * -+ * Output of Assembler Instructions -+ * -------------------------------- */ -+ -+#define REGISTER_NAMES \ -+{ \ -+ "zero", \ -+ "at", \ -+ "r2", \ -+ "r3", \ -+ "r4", \ -+ "r5", \ -+ "r6", \ -+ "r7", \ -+ "r8", \ -+ "r9", \ -+ "r10", \ -+ "r11", \ -+ "r12", \ -+ "r13", \ -+ "r14", \ -+ "r15", \ -+ "r16", \ -+ "r17", \ -+ "r18", \ -+ "r19", \ -+ "r20", \ -+ "r21", \ -+ "r22", \ -+ "r23", \ -+ "r24", \ -+ "r25", \ -+ "gp", \ -+ "sp", \ -+ "fp", \ -+ "ta", \ -+ "ba", \ -+ "ra", \ -+ "status", \ -+ "estatus", \ -+ "bstatus", \ -+ "ipri", \ -+ "ecause", \ -+ "pc", \ -+ "rap", \ -+ "fake_fp", \ -+ "fake_ap", \ -+} -+ -+#define ASM_OUTPUT_OPCODE(STREAM, PTR)\ -+ (PTR) = asm_output_opcode (STREAM, PTR) -+ -+#define PRINT_OPERAND(STREAM, X, CODE) \ -+ nios2_print_operand (STREAM, X, CODE) -+ -+#define PRINT_OPERAND_ADDRESS(STREAM, X) \ -+ nios2_print_operand_address (STREAM, X) -+ -+#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ -+do { fputs (integer_asm_op (POINTER_SIZE / BITS_PER_UNIT, TRUE), FILE); \ -+ fprintf (FILE, ".L%u\n", (unsigned) (VALUE)); \ -+ } while (0) -+ -+ -+/* ------------ * -+ * Label Output -+ * ------------ */ -+ -+ -+/* ---------------------------------------------------- * -+ * Dividing the Output into Sections (Texts, Data, ...) -+ * ---------------------------------------------------- */ -+ -+/* Output before read-only data. */ -+#define TEXT_SECTION_ASM_OP ("\t.section\t.text") -+ -+/* Output before writable data. */ -+#define DATA_SECTION_ASM_OP ("\t.section\t.data") -+ -+ -+/* Default the definition of "small data" to 8 bytes. */ -+/* ??? How come I can't use HOST_WIDE_INT here? */ -+extern unsigned long nios2_section_threshold; -+#define NIOS2_DEFAULT_GVALUE 8 -+ -+ -+ -+/* This says how to output assembler code to declare an -+ uninitialized external linkage data object. Under SVR4, -+ the linker seems to want the alignment of data objects -+ to depend on their types. We do exactly that here. */ -+ -+#undef COMMON_ASM_OP -+#define COMMON_ASM_OP "\t.comm\t" -+ -+#undef ASM_OUTPUT_ALIGNED_COMMON -+#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ -+do \ -+{ \ -+ if ((SIZE) <= nios2_section_threshold) \ -+ { \ -+ named_section (0, ".sbss", 0); \ -+ (*targetm.asm_out.globalize_label) (FILE, NAME); \ -+ ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \ -+ if (!flag_inhibit_size_directive) \ -+ ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \ -+ ASM_OUTPUT_ALIGN ((FILE), exact_log2((ALIGN) / BITS_PER_UNIT)); \ -+ ASM_OUTPUT_LABEL(FILE, NAME); \ -+ ASM_OUTPUT_SKIP((FILE), (SIZE) ? (SIZE) : 1); \ -+ } \ -+ else \ -+ { \ -+ fprintf ((FILE), "%s", COMMON_ASM_OP); \ -+ assemble_name ((FILE), (NAME)); \ -+ fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \ -+ } \ -+} \ -+while (0) -+ -+ -+/* This says how to output assembler code to declare an -+ uninitialized internal linkage data object. Under SVR4, -+ the linker seems to want the alignment of data objects -+ to depend on their types. We do exactly that here. */ -+ -+#undef ASM_OUTPUT_ALIGNED_LOCAL -+#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ -+do { \ -+ if ((SIZE) <= nios2_section_threshold) \ -+ named_section (0, ".sbss", 0); \ -+ else \ -+ named_section (0, ".bss", 0); \ -+ ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \ -+ if (!flag_inhibit_size_directive) \ -+ ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \ -+ ASM_OUTPUT_ALIGN ((FILE), exact_log2((ALIGN) / BITS_PER_UNIT)); \ -+ ASM_OUTPUT_LABEL(FILE, NAME); \ -+ ASM_OUTPUT_SKIP((FILE), (SIZE) ? (SIZE) : 1); \ -+} while (0) -+ -+ -+ -+/*************************** -+ * Miscellaneous Parameters -+ ***************************/ -+ -+#define MOVE_MAX 4 -+ -+#define Pmode SImode -+#define FUNCTION_MODE QImode -+ -+#define CASE_VECTOR_MODE Pmode -+ -+#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 -+ -+#define LOAD_EXTEND_OP(MODE) (ZERO_EXTEND) -+ -+#define WORD_REGISTER_OPERATIONS -diff -durN gcc-3.4.6.orig/gcc/config/nios2/nios2.md gcc-3.4.6/gcc/config/nios2/nios2.md ---- gcc-3.4.6.orig/gcc/config/nios2/nios2.md 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/gcc/config/nios2/nios2.md 2007-08-15 23:09:36.000000000 +0200 -@@ -0,0 +1,2078 @@ -+;; Machine Description for Altera NIOS 2G NIOS2 version. -+;; Copyright (C) 2003 Altera -+;; Contributed by Jonah Graham (jgraham@altera.com). -+;; -+;; This file is part of GNU CC. -+;; -+;; GNU CC is free software; you can redistribute it and/or modify -+;; it under the terms of the GNU General Public License as published by -+;; the Free Software Foundation; either version 2, or (at your option) -+;; any later version. -+;; -+;; GNU CC is distributed in the hope that it will be useful, -+;; but WITHOUT ANY WARRANTY; without even the implied warranty of -+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+;; GNU General Public License for more details. -+;; -+;; You should have received a copy of the GNU General Public License -+;; along with GNU CC; see the file COPYING. If not, write to -+;; the Free Software Foundation, 59 Temple Place - Suite 330, -+;; Boston, MA 02111-1307, USA. */ -+ -+ -+ -+;***************************************************************************** -+;* -+;* constants -+;* -+;***************************************************************************** -+(define_constants [ -+ (GP_REGNO 26) -+ (SP_REGNO 27) -+ (FP_REGNO 28) -+ (RA_REGNO 31) -+ (RAP_REGNO 38) -+ (FIRST_RETVAL_REGNO 2) -+ (LAST_RETVAL_REGNO 3) -+ (FIRST_ARG_REGNO 4) -+ (LAST_ARG_REGNO 7) -+ (SC_REGNO 23) -+ (PC_REGNO 37) -+ (FAKE_FP_REGNO 39) -+ (FAKE_AP_REGNO 40) -+ -+ -+ (UNSPEC_BLOCKAGE 0) -+ (UNSPEC_LDBIO 1) -+ (UNSPEC_LDBUIO 2) -+ (UNSPEC_LDHIO 3) -+ (UNSPEC_LDHUIO 4) -+ (UNSPEC_LDWIO 5) -+ (UNSPEC_STBIO 6) -+ (UNSPEC_STHIO 7) -+ (UNSPEC_STWIO 8) -+ (UNSPEC_SYNC 9) -+ (UNSPEC_WRCTL 10) -+ (UNSPEC_RDCTL 11) -+ -+]) -+ -+ -+ -+;***************************************************************************** -+;* -+;* instruction scheduler -+;* -+;***************************************************************************** -+ -+; No schedule info is currently available, using an assumption that no -+; instruction can use the results of the previous instruction without -+; incuring a stall. -+ -+; length of an instruction (in bytes) -+(define_attr "length" "" (const_int 4)) -+(define_attr "type" "unknown,complex,control,alu,cond_alu,st,ld,shift,mul,div,custom" (const_string "complex")) -+ -+(define_asm_attributes -+ [(set_attr "length" "4") -+ (set_attr "type" "complex")]) -+ -+(define_automaton "nios2") -+(automata_option "v") -+;(automata_option "no-minimization") -+(automata_option "ndfa") -+ -+; The nios2 pipeline is fairly straightforward for the fast model. -+; Every alu operation is pipelined so that an instruction can -+; be issued every cycle. However, there are still potential -+; stalls which this description tries to deal with. -+ -+(define_cpu_unit "cpu" "nios2") -+ -+(define_insn_reservation "complex" 1 -+ (eq_attr "type" "complex") -+ "cpu") -+ -+(define_insn_reservation "control" 1 -+ (eq_attr "type" "control") -+ "cpu") -+ -+(define_insn_reservation "alu" 1 -+ (eq_attr "type" "alu") -+ "cpu") -+ -+(define_insn_reservation "cond_alu" 1 -+ (eq_attr "type" "cond_alu") -+ "cpu") -+ -+(define_insn_reservation "st" 1 -+ (eq_attr "type" "st") -+ "cpu") -+ -+(define_insn_reservation "custom" 1 -+ (eq_attr "type" "custom") -+ "cpu") -+ -+; shifts, muls and lds have three cycle latency -+(define_insn_reservation "ld" 3 -+ (eq_attr "type" "ld") -+ "cpu") -+ -+(define_insn_reservation "shift" 3 -+ (eq_attr "type" "shift") -+ "cpu") -+ -+(define_insn_reservation "mul" 3 -+ (eq_attr "type" "mul") -+ "cpu") -+ -+(define_insn_reservation "div" 1 -+ (eq_attr "type" "div") -+ "cpu") -+ -+ -+;***************************************************************************** -+;* -+;* MOV Instructions -+;* -+;***************************************************************************** -+ -+(define_expand "movqi" -+ [(set (match_operand:QI 0 "nonimmediate_operand" "") -+ (match_operand:QI 1 "general_operand" ""))] -+ "" -+{ -+ if (nios2_emit_move_sequence (operands, QImode)) -+ DONE; -+}) -+ -+(define_insn "movqi_internal" -+ [(set (match_operand:QI 0 "nonimmediate_operand" "=m, r,r, r") -+ (match_operand:QI 1 "general_operand" "rM,m,rM,I"))] -+ "(register_operand (operands[0], QImode) -+ || register_operand (operands[1], QImode) -+ || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))" -+ "@ -+ stb%o0\\t%z1, %0 -+ ldbu%o1\\t%0, %1 -+ mov\\t%0, %z1 -+ movi\\t%0, %1" -+ [(set_attr "type" "st,ld,alu,alu")]) -+ -+(define_insn "ldbio" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(const_int 0)] UNSPEC_LDBIO)) -+ (use (match_operand:SI 1 "memory_operand" "m"))] -+ "" -+ "ldbio\\t%0, %1" -+ [(set_attr "type" "ld")]) -+ -+(define_insn "ldbuio" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(const_int 0)] UNSPEC_LDBUIO)) -+ (use (match_operand:SI 1 "memory_operand" "m"))] -+ "" -+ "ldbuio\\t%0, %1" -+ [(set_attr "type" "ld")]) -+ -+(define_insn "stbio" -+ [(set (match_operand:SI 0 "memory_operand" "=m") -+ (match_operand:SI 1 "register_operand" "r")) -+ (unspec_volatile:SI [(const_int 0)] UNSPEC_STBIO)] -+ "" -+ "stbio\\t%z1, %0" -+ [(set_attr "type" "st")]) -+ -+ -+(define_expand "movhi" -+ [(set (match_operand:HI 0 "nonimmediate_operand" "") -+ (match_operand:HI 1 "general_operand" ""))] -+ "" -+{ -+ if (nios2_emit_move_sequence (operands, HImode)) -+ DONE; -+}) -+ -+(define_insn "movhi_internal" -+ [(set (match_operand:HI 0 "nonimmediate_operand" "=m, r,r, r,r") -+ (match_operand:HI 1 "general_operand" "rM,m,rM,I,J"))] -+ "(register_operand (operands[0], HImode) -+ || register_operand (operands[1], HImode) -+ || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))" -+ "@ -+ sth%o0\\t%z1, %0 -+ ldhu%o1\\t%0, %1 -+ mov\\t%0, %z1 -+ movi\\t%0, %1 -+ movui\\t%0, %1" -+ [(set_attr "type" "st,ld,alu,alu,alu")]) -+ -+(define_insn "ldhio" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(const_int 0)] UNSPEC_LDHIO)) -+ (use (match_operand:SI 1 "memory_operand" "m"))] -+ "" -+ "ldhio\\t%0, %1" -+ [(set_attr "type" "ld")]) -+ -+(define_insn "ldhuio" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(const_int 0)] UNSPEC_LDHUIO)) -+ (use (match_operand:SI 1 "memory_operand" "m"))] -+ "" -+ "ldhuio\\t%0, %1" -+ [(set_attr "type" "ld")]) -+ -+(define_insn "sthio" -+ [(set (match_operand:SI 0 "memory_operand" "=m") -+ (match_operand:SI 1 "register_operand" "r")) -+ (unspec_volatile:SI [(const_int 0)] UNSPEC_STHIO)] -+ "" -+ "sthio\\t%z1, %0" -+ [(set_attr "type" "st")]) -+ -+(define_expand "movsi" -+ [(set (match_operand:SI 0 "nonimmediate_operand" "") -+ (match_operand:SI 1 "general_operand" ""))] -+ "" -+{ -+ if (nios2_emit_move_sequence (operands, SImode)) -+ DONE; -+}) -+ -+(define_insn "movsi_internal" -+ [(set (match_operand:SI 0 "nonimmediate_operand" "=m, r,r, r,r,r,r") -+ (match_operand:SI 1 "general_operand" "rM,m,rM,I,J,S,i"))] -+ "(register_operand (operands[0], SImode) -+ || register_operand (operands[1], SImode) -+ || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))" -+ "@ -+ stw%o0\\t%z1, %0 -+ ldw%o1\\t%0, %1 -+ mov\\t%0, %z1 -+ movi\\t%0, %1 -+ movui\\t%0, %1 -+ addi\\t%0, gp, %%gprel(%1) -+ movhi\\t%0, %H1\;addi\\t%0, %0, %L1" -+ [(set_attr "type" "st,ld,alu,alu,alu,alu,alu")]) -+ -+(define_insn "ldwio" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(const_int 0)] UNSPEC_LDWIO)) -+ (use (match_operand:SI 1 "memory_operand" "m"))] -+ "" -+ "ldwio\\t%0, %1" -+ [(set_attr "type" "ld")]) -+ -+(define_insn "stwio" -+ [(set (match_operand:SI 0 "memory_operand" "=m") -+ (match_operand:SI 1 "register_operand" "r")) -+ (unspec_volatile:SI [(const_int 0)] UNSPEC_STWIO)] -+ "" -+ "stwio\\t%z1, %0" -+ [(set_attr "type" "st")]) -+ -+ -+ -+;***************************************************************************** -+;* -+;* zero extension -+;* -+;***************************************************************************** -+ -+ -+(define_insn "zero_extendhisi2" -+ [(set (match_operand:SI 0 "register_operand" "=r,r") -+ (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))] -+ "" -+ "@ -+ andi\\t%0, %1, 0xffff -+ ldhu%o1\\t%0, %1" -+ [(set_attr "type" "alu,ld")]) -+ -+(define_insn "zero_extendqihi2" -+ [(set (match_operand:HI 0 "register_operand" "=r,r") -+ (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "r,m")))] -+ "" -+ "@ -+ andi\\t%0, %1, 0xff -+ ldbu%o1\\t%0, %1" -+ [(set_attr "type" "alu,ld")]) -+ -+(define_insn "zero_extendqisi2" -+ [(set (match_operand:SI 0 "register_operand" "=r,r") -+ (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))] -+ "" -+ "@ -+ andi\\t%0, %1, 0xff -+ ldbu%o1\\t%0, %1" -+ [(set_attr "type" "alu,ld")]) -+ -+ -+ -+;***************************************************************************** -+;* -+;* sign extension -+;* -+;***************************************************************************** -+ -+(define_expand "extendhisi2" -+ [(set (match_operand:SI 0 "register_operand" "") -+ (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))] -+ "" -+{ -+ if (optimize && GET_CODE (operands[1]) == MEM) -+ operands[1] = force_not_mem (operands[1]); -+ -+ if (GET_CODE (operands[1]) != MEM) -+ { -+ rtx op1 = gen_lowpart (SImode, operands[1]); -+ rtx temp = gen_reg_rtx (SImode); -+ rtx shift = GEN_INT (16); -+ -+ emit_insn (gen_ashlsi3 (temp, op1, shift)); -+ emit_insn (gen_ashrsi3 (operands[0], temp, shift)); -+ DONE; -+ } -+}) -+ -+(define_insn "extendhisi2_internal" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (sign_extend:SI (match_operand:HI 1 "memory_operand" "m")))] -+ "" -+ "ldh%o1\\t%0, %1" -+ [(set_attr "type" "ld")]) -+ -+(define_expand "extendqihi2" -+ [(set (match_operand:HI 0 "register_operand" "") -+ (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))] -+ "" -+{ -+ if (optimize && GET_CODE (operands[1]) == MEM) -+ operands[1] = force_not_mem (operands[1]); -+ -+ if (GET_CODE (operands[1]) != MEM) -+ { -+ rtx op0 = gen_lowpart (SImode, operands[0]); -+ rtx op1 = gen_lowpart (SImode, operands[1]); -+ rtx temp = gen_reg_rtx (SImode); -+ rtx shift = GEN_INT (24); -+ -+ emit_insn (gen_ashlsi3 (temp, op1, shift)); -+ emit_insn (gen_ashrsi3 (op0, temp, shift)); -+ DONE; -+ } -+}) -+ -+(define_insn "extendqihi2_internal" -+ [(set (match_operand:HI 0 "register_operand" "=r") -+ (sign_extend:HI (match_operand:QI 1 "memory_operand" "m")))] -+ "" -+ "ldb%o1\\t%0, %1" -+ [(set_attr "type" "ld")]) -+ -+ -+(define_expand "extendqisi2" -+ [(set (match_operand:SI 0 "register_operand" "") -+ (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))] -+ "" -+{ -+ if (optimize && GET_CODE (operands[1]) == MEM) -+ operands[1] = force_not_mem (operands[1]); -+ -+ if (GET_CODE (operands[1]) != MEM) -+ { -+ rtx op1 = gen_lowpart (SImode, operands[1]); -+ rtx temp = gen_reg_rtx (SImode); -+ rtx shift = GEN_INT (24); -+ -+ emit_insn (gen_ashlsi3 (temp, op1, shift)); -+ emit_insn (gen_ashrsi3 (operands[0], temp, shift)); -+ DONE; -+ } -+}) -+ -+(define_insn "extendqisi2_insn" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))] -+ "" -+ "ldb%o1\\t%0, %1" -+ [(set_attr "type" "ld")]) -+ -+ -+ -+;***************************************************************************** -+;* -+;* Arithmetic Operations -+;* -+;***************************************************************************** -+ -+(define_insn "addsi3" -+ [(set (match_operand:SI 0 "register_operand" "=r,r") -+ (plus:SI (match_operand:SI 1 "register_operand" "%r,r") -+ (match_operand:SI 2 "arith_operand" "r,I")))] -+ "" -+ "add%i2\\t%0, %1, %z2" -+ [(set_attr "type" "alu")]) -+ -+(define_insn "subsi3" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rM") -+ (match_operand:SI 2 "register_operand" "r")))] -+ "" -+ "sub\\t%0, %z1, %2" -+ [(set_attr "type" "alu")]) -+ -+(define_insn "mulsi3" -+ [(set (match_operand:SI 0 "register_operand" "=r,r") -+ (mult:SI (match_operand:SI 1 "register_operand" "r,r") -+ (match_operand:SI 2 "arith_operand" "r,I")))] -+ "TARGET_HAS_MUL" -+ "mul%i2\\t%0, %1, %z2" -+ [(set_attr "type" "mul")]) -+ -+(define_expand "divsi3" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (div:SI (match_operand:SI 1 "register_operand" "r") -+ (match_operand:SI 2 "register_operand" "r")))] -+ "" -+{ -+ if (!TARGET_HAS_DIV) -+ { -+ if (!TARGET_FAST_SW_DIV) -+ FAIL; -+ else -+ { -+ if (nios2_emit_expensive_div (operands, SImode)) -+ DONE; -+ } -+ } -+}) -+ -+(define_insn "divsi3_insn" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (div:SI (match_operand:SI 1 "register_operand" "r") -+ (match_operand:SI 2 "register_operand" "r")))] -+ "TARGET_HAS_DIV" -+ "div\\t%0, %1, %2" -+ [(set_attr "type" "div")]) -+ -+(define_insn "udivsi3" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (udiv:SI (match_operand:SI 1 "register_operand" "r") -+ (match_operand:SI 2 "register_operand" "r")))] -+ "TARGET_HAS_DIV" -+ "divu\\t%0, %1, %2" -+ [(set_attr "type" "div")]) -+ -+(define_insn "smulsi3_highpart" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (truncate:SI -+ (lshiftrt:DI -+ (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r")) -+ (sign_extend:DI (match_operand:SI 2 "register_operand" "r"))) -+ (const_int 32))))] -+ "TARGET_HAS_MULX" -+ "mulxss\\t%0, %1, %2" -+ [(set_attr "type" "mul")]) -+ -+(define_insn "umulsi3_highpart" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (truncate:SI -+ (lshiftrt:DI -+ (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r")) -+ (zero_extend:DI (match_operand:SI 2 "register_operand" "r"))) -+ (const_int 32))))] -+ "TARGET_HAS_MULX" -+ "mulxuu\\t%0, %1, %2" -+ [(set_attr "type" "mul")]) -+ -+ -+(define_expand "mulsidi3" -+ [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 0) -+ (mult:SI (match_operand:SI 1 "register_operand" "") -+ (match_operand:SI 2 "register_operand" ""))) -+ (set (subreg:SI (match_dup 0) 4) -+ (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1)) -+ (sign_extend:DI (match_dup 2))) -+ (const_int 32))))] -+ "TARGET_HAS_MULX" -+ "") -+ -+(define_expand "umulsidi3" -+ [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 0) -+ (mult:SI (match_operand:SI 1 "register_operand" "") -+ (match_operand:SI 2 "register_operand" ""))) -+ (set (subreg:SI (match_dup 0) 4) -+ (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1)) -+ (zero_extend:DI (match_dup 2))) -+ (const_int 32))))] -+ "TARGET_HAS_MULX" -+ "") -+ -+ -+ -+;***************************************************************************** -+;* -+;* Negate and ones complement -+;* -+;***************************************************************************** -+ -+(define_insn "negsi2" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (neg:SI (match_operand:SI 1 "register_operand" "r")))] -+ "" -+{ -+ operands[2] = const0_rtx; -+ return "sub\\t%0, %z2, %1"; -+} -+ [(set_attr "type" "alu")]) -+ -+(define_insn "one_cmplsi2" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (not:SI (match_operand:SI 1 "register_operand" "r")))] -+ "" -+{ -+ operands[2] = const0_rtx; -+ return "nor\\t%0, %z2, %1"; -+} -+ [(set_attr "type" "alu")]) -+ -+ -+ -+; Logical Operantions -+ -+(define_insn "andsi3" -+ [(set (match_operand:SI 0 "register_operand" "=r, r,r") -+ (and:SI (match_operand:SI 1 "register_operand" "%r, r,r") -+ (match_operand:SI 2 "logical_operand" "rM,J,K")))] -+ "" -+ "@ -+ and\\t%0, %1, %z2 -+ and%i2\\t%0, %1, %2 -+ andh%i2\\t%0, %1, %U2" -+ [(set_attr "type" "alu")]) -+ -+(define_insn "iorsi3" -+ [(set (match_operand:SI 0 "register_operand" "=r, r,r") -+ (ior:SI (match_operand:SI 1 "register_operand" "%r, r,r") -+ (match_operand:SI 2 "logical_operand" "rM,J,K")))] -+ "" -+ "@ -+ or\\t%0, %1, %z2 -+ or%i2\\t%0, %1, %2 -+ orh%i2\\t%0, %1, %U2" -+ [(set_attr "type" "alu")]) -+ -+(define_insn "*norsi3" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (and:SI (not:SI (match_operand:SI 1 "register_operand" "%r")) -+ (not:SI (match_operand:SI 2 "reg_or_0_operand" "rM"))))] -+ "" -+ "nor\\t%0, %1, %z2" -+ [(set_attr "type" "alu")]) -+ -+(define_insn "xorsi3" -+ [(set (match_operand:SI 0 "register_operand" "=r, r,r") -+ (xor:SI (match_operand:SI 1 "register_operand" "%r, r,r") -+ (match_operand:SI 2 "logical_operand" "rM,J,K")))] -+ "" -+ "@ -+ xor\\t%0, %1, %z2 -+ xor%i2\\t%0, %1, %2 -+ xorh%i2\\t%0, %1, %U2" -+ [(set_attr "type" "alu")]) -+ -+ -+ -+;***************************************************************************** -+;* -+;* Shifts -+;* -+;***************************************************************************** -+ -+(define_insn "ashlsi3" -+ [(set (match_operand:SI 0 "register_operand" "=r,r") -+ (ashift:SI (match_operand:SI 1 "register_operand" "r,r") -+ (match_operand:SI 2 "shift_operand" "r,L")))] -+ "" -+ "sll%i2\\t%0, %1, %z2" -+ [(set_attr "type" "shift")]) -+ -+(define_insn "ashrsi3" -+ [(set (match_operand:SI 0 "register_operand" "=r,r") -+ (ashiftrt:SI (match_operand:SI 1 "register_operand" "r,r") -+ (match_operand:SI 2 "shift_operand" "r,L")))] -+ "" -+ "sra%i2\\t%0, %1, %z2" -+ [(set_attr "type" "shift")]) -+ -+(define_insn "lshrsi3" -+ [(set (match_operand:SI 0 "register_operand" "=r,r") -+ (lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r") -+ (match_operand:SI 2 "shift_operand" "r,L")))] -+ "" -+ "srl%i2\\t%0, %1, %z2" -+ [(set_attr "type" "shift")]) -+ -+(define_insn "rotlsi3" -+ [(set (match_operand:SI 0 "register_operand" "=r,r") -+ (rotate:SI (match_operand:SI 1 "register_operand" "r,r") -+ (match_operand:SI 2 "shift_operand" "r,L")))] -+ "" -+ "rol%i2\\t%0, %1, %z2" -+ [(set_attr "type" "shift")]) -+ -+(define_insn "rotrsi3" -+ [(set (match_operand:SI 0 "register_operand" "=r,r") -+ (rotatert:SI (match_operand:SI 1 "register_operand" "r,r") -+ (match_operand:SI 2 "register_operand" "r,r")))] -+ "" -+ "ror\\t%0, %1, %2" -+ [(set_attr "type" "shift")]) -+ -+(define_insn "*shift_mul_constants" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (ashift:SI (mult:SI (match_operand:SI 1 "register_operand" "r") -+ (match_operand:SI 2 "const_int_operand" "I")) -+ (match_operand:SI 3 "const_int_operand" "I")))] -+ "TARGET_HAS_MUL && SMALL_INT (INTVAL (operands[2]) << INTVAL (operands[3]))" -+{ -+ HOST_WIDE_INT mul = INTVAL (operands[2]) << INTVAL (operands[3]); -+ rtx ops[3]; -+ -+ ops[0] = operands[0]; -+ ops[1] = operands[1]; -+ ops[2] = GEN_INT (mul); -+ -+ output_asm_insn ("muli\t%0, %1, %2", ops); -+ return ""; -+} -+ [(set_attr "type" "mul")]) -+ -+ -+ -+ -+;***************************************************************************** -+;* -+;* Prologue, Epilogue and Return -+;* -+;***************************************************************************** -+ -+(define_expand "prologue" -+ [(const_int 1)] -+ "" -+{ -+ expand_prologue (); -+ DONE; -+}) -+ -+(define_expand "epilogue" -+ [(return)] -+ "" -+{ -+ expand_epilogue (false); -+ DONE; -+}) -+ -+(define_expand "sibcall_epilogue" -+ [(return)] -+ "" -+{ -+ expand_epilogue (true); -+ DONE; -+}) -+ -+(define_insn "return" -+ [(return)] -+ "reload_completed && nios2_can_use_return_insn ()" -+ "ret\\t" -+) -+ -+(define_insn "return_from_epilogue" -+ [(use (match_operand 0 "pmode_register_operand" "")) -+ (return)] -+ "reload_completed" -+ "ret\\t" -+) -+ -+;; Block any insns from being moved before this point, since the -+;; profiling call to mcount can use various registers that aren't -+;; saved or used to pass arguments. -+ -+(define_insn "blockage" -+ [(unspec_volatile [(const_int 0)] UNSPEC_BLOCKAGE)] -+ "" -+ "" -+ [(set_attr "type" "unknown") -+ (set_attr "length" "0")]) -+ -+ -+ -+;***************************************************************************** -+;* -+;* Jumps and Calls -+;* -+;***************************************************************************** -+ -+(define_insn "indirect_jump" -+ [(set (pc) (match_operand:SI 0 "register_operand" "r"))] -+ "" -+ "jmp\\t%0" -+ [(set_attr "type" "control")]) -+ -+(define_insn "jump" -+ [(set (pc) -+ (label_ref (match_operand 0 "" "")))] -+ "" -+ "br\\t%0" -+ [(set_attr "type" "control")]) -+ -+ -+(define_insn "indirect_call" -+ [(call (mem:QI (match_operand:SI 0 "register_operand" "r")) -+ (match_operand 1 "" "")) -+ (clobber (reg:SI RA_REGNO))] -+ "" -+ "callr\\t%0" -+ [(set_attr "type" "control")]) -+ -+(define_insn "indirect_call_value" -+ [(set (match_operand 0 "" "") -+ (call (mem:QI (match_operand:SI 1 "register_operand" "r")) -+ (match_operand 2 "" ""))) -+ (clobber (reg:SI RA_REGNO))] -+ "" -+ "callr\\t%1" -+) -+ -+(define_expand "call" -+ [(parallel [(call (match_operand 0 "" "") -+ (match_operand 1 "" "")) -+ (clobber (reg:SI RA_REGNO))])] -+ "" -+ "") -+ -+(define_expand "call_value" -+ [(parallel [(set (match_operand 0 "" "") -+ (call (match_operand 1 "" "") -+ (match_operand 2 "" ""))) -+ (clobber (reg:SI RA_REGNO))])] -+ "" -+ "") -+ -+(define_insn "*call" -+ [(call (mem:QI (match_operand:SI 0 "immediate_operand" "i")) -+ (match_operand 1 "" "")) -+ (clobber (match_operand:SI 2 "register_operand" "=r"))] -+ "" -+ "call\\t%0" -+ [(set_attr "type" "control")]) -+ -+(define_insn "*call_value" -+ [(set (match_operand 0 "" "") -+ (call (mem:QI (match_operand:SI 1 "immediate_operand" "i")) -+ (match_operand 2 "" ""))) -+ (clobber (match_operand:SI 3 "register_operand" "=r"))] -+ "" -+ "call\\t%1" -+ [(set_attr "type" "control")]) -+ -+(define_expand "sibcall" -+ [(parallel [(call (match_operand 0 "" "") -+ (match_operand 1 "" "")) -+ (return) -+ (use (match_operand 2 "" ""))])] -+ "" -+ { -+ XEXP (operands[0], 0) = copy_to_mode_reg (SImode, XEXP (operands[0], 0)); -+ -+ if (operands[2] == NULL_RTX) -+ operands[2] = const0_rtx; -+ } -+) -+ -+(define_expand "sibcall_value" -+ [(parallel [(set (match_operand 0 "" "") -+ (call (match_operand 1 "" "") -+ (match_operand 2 "" ""))) -+ (return) -+ (use (match_operand 3 "" ""))])] -+ "" -+ { -+ XEXP (operands[1], 0) = copy_to_mode_reg (SImode, XEXP (operands[1], 0)); -+ -+ if (operands[3] == NULL_RTX) -+ operands[3] = const0_rtx; -+ } -+) -+ -+(define_insn "sibcall_insn" -+ [(call (mem:QI (match_operand:SI 0 "register_operand" "r")) -+ (match_operand 1 "" "")) -+ (return) -+ (use (match_operand 2 "" ""))] -+ "" -+ "jmp\\t%0" -+) -+ -+(define_insn "sibcall_value_insn" -+ [(set (match_operand 0 "register_operand" "") -+ (call (mem:QI (match_operand:SI 1 "register_operand" "r")) -+ (match_operand 2 "" ""))) -+ (return) -+ (use (match_operand 3 "" ""))] -+ "" -+ "jmp\\t%1" -+) -+ -+ -+ -+ -+(define_expand "tablejump" -+ [(parallel [(set (pc) (match_operand 0 "register_operand" "r")) -+ (use (label_ref (match_operand 1 "" "")))])] -+ "" -+ "" -+) -+ -+(define_insn "*tablejump" -+ [(set (pc) -+ (match_operand:SI 0 "register_operand" "r")) -+ (use (label_ref (match_operand 1 "" "")))] -+ "" -+ "jmp\\t%0" -+ [(set_attr "type" "control")]) -+ -+ -+ -+;***************************************************************************** -+;* -+;* Comparisons -+;* -+;***************************************************************************** -+;; Flow here is rather complex (based on MIPS): -+;; -+;; 1) The cmp{si,di,sf,df} routine is called. It deposits the -+;; arguments into the branch_cmp array, and the type into -+;; branch_type. No RTL is generated. -+;; -+;; 2) The appropriate branch define_expand is called, which then -+;; creates the appropriate RTL for the comparison and branch. -+;; Different CC modes are used, based on what type of branch is -+;; done, so that we can constrain things appropriately. There -+;; are assumptions in the rest of GCC that break if we fold the -+;; operands into the branchs for integer operations, and use cc0 -+;; for floating point, so we use the fp status register instead. -+;; If needed, an appropriate temporary is created to hold the -+;; of the integer compare. -+ -+(define_expand "cmpsi" -+ [(set (cc0) -+ (compare:CC (match_operand:SI 0 "register_operand" "") -+ (match_operand:SI 1 "arith_operand" "")))] -+ "" -+{ -+ branch_cmp[0] = operands[0]; -+ branch_cmp[1] = operands[1]; -+ branch_type = CMP_SI; -+ DONE; -+}) -+ -+(define_expand "tstsi" -+ [(set (cc0) -+ (match_operand:SI 0 "register_operand" ""))] -+ "" -+{ -+ branch_cmp[0] = operands[0]; -+ branch_cmp[1] = const0_rtx; -+ branch_type = CMP_SI; -+ DONE; -+}) -+ -+ -+;***************************************************************************** -+;* -+;* setting a register from a comparison -+;* -+;***************************************************************************** -+ -+(define_expand "seq" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (eq:SI (match_dup 1) -+ (match_dup 2)))] -+ "" -+{ -+ if (branch_type != CMP_SI) -+ FAIL; -+ -+ /* set up operands from compare. */ -+ operands[1] = branch_cmp[0]; -+ operands[2] = branch_cmp[1]; -+ -+ gen_int_relational (EQ, operands[0], operands[1], operands[2], NULL_RTX); -+ DONE; -+}) -+ -+ -+(define_insn "*seq" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (eq:SI (match_operand:SI 1 "reg_or_0_operand" "%rM") -+ (match_operand:SI 2 "arith_operand" "rI")))] -+ "" -+ "cmpeq%i2\\t%0, %z1, %z2" -+ [(set_attr "type" "alu")]) -+ -+ -+(define_expand "sne" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (ne:SI (match_dup 1) -+ (match_dup 2)))] -+ "" -+{ -+ if (branch_type != CMP_SI) -+ FAIL; -+ -+ /* set up operands from compare. */ -+ operands[1] = branch_cmp[0]; -+ operands[2] = branch_cmp[1]; -+ -+ gen_int_relational (NE, operands[0], operands[1], operands[2], NULL_RTX); -+ DONE; -+}) -+ -+ -+(define_insn "*sne" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (ne:SI (match_operand:SI 1 "reg_or_0_operand" "%rM") -+ (match_operand:SI 2 "arith_operand" "rI")))] -+ "" -+ "cmpne%i2\\t%0, %z1, %z2" -+ [(set_attr "type" "alu")]) -+ -+ -+(define_expand "sgt" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (gt:SI (match_dup 1) -+ (match_dup 2)))] -+ "" -+{ -+ if (branch_type != CMP_SI) -+ FAIL; -+ -+ /* set up operands from compare. */ -+ operands[1] = branch_cmp[0]; -+ operands[2] = branch_cmp[1]; -+ -+ gen_int_relational (GT, operands[0], operands[1], operands[2], NULL_RTX); -+ DONE; -+}) -+ -+ -+(define_insn "*sgt" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (gt:SI (match_operand:SI 1 "reg_or_0_operand" "rM") -+ (match_operand:SI 2 "reg_or_0_operand" "rM")))] -+ "" -+ "cmplt\\t%0, %z2, %z1" -+ [(set_attr "type" "alu")]) -+ -+ -+(define_expand "sge" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (ge:SI (match_dup 1) -+ (match_dup 2)))] -+ "" -+{ -+ if (branch_type != CMP_SI) -+ FAIL; -+ -+ /* set up operands from compare. */ -+ operands[1] = branch_cmp[0]; -+ operands[2] = branch_cmp[1]; -+ -+ gen_int_relational (GE, operands[0], operands[1], operands[2], NULL_RTX); -+ DONE; -+}) -+ -+ -+(define_insn "*sge" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (ge:SI (match_operand:SI 1 "reg_or_0_operand" "rM") -+ (match_operand:SI 2 "arith_operand" "rI")))] -+ "" -+ "cmpge%i2\\t%0, %z1, %z2" -+ [(set_attr "type" "alu")]) -+ -+(define_expand "sle" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (le:SI (match_dup 1) -+ (match_dup 2)))] -+ "" -+{ -+ if (branch_type != CMP_SI) -+ FAIL; -+ -+ /* set up operands from compare. */ -+ operands[1] = branch_cmp[0]; -+ operands[2] = branch_cmp[1]; -+ -+ gen_int_relational (LE, operands[0], operands[1], operands[2], NULL_RTX); -+ DONE; -+}) -+ -+ -+(define_insn "*sle" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (le:SI (match_operand:SI 1 "reg_or_0_operand" "rM") -+ (match_operand:SI 2 "reg_or_0_operand" "rM")))] -+ "" -+ "cmpge\\t%0, %z2, %z1" -+ [(set_attr "type" "alu")]) -+ -+ -+(define_expand "slt" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (lt:SI (match_dup 1) -+ (match_dup 2)))] -+ "" -+{ -+ if (branch_type != CMP_SI) -+ FAIL; -+ -+ /* set up operands from compare. */ -+ operands[1] = branch_cmp[0]; -+ operands[2] = branch_cmp[1]; -+ -+ gen_int_relational (LT, operands[0], operands[1], operands[2], NULL_RTX); -+ DONE; -+}) -+ -+ -+(define_insn "*slt" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (lt:SI (match_operand:SI 1 "reg_or_0_operand" "rM") -+ (match_operand:SI 2 "arith_operand" "rI")))] -+ "" -+ "cmplt%i2\\t%0, %z1, %z2" -+ [(set_attr "type" "alu")]) -+ -+ -+(define_expand "sgtu" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (gtu:SI (match_dup 1) -+ (match_dup 2)))] -+ "" -+{ -+ if (branch_type != CMP_SI) -+ FAIL; -+ -+ /* set up operands from compare. */ -+ operands[1] = branch_cmp[0]; -+ operands[2] = branch_cmp[1]; -+ -+ gen_int_relational (GTU, operands[0], operands[1], operands[2], NULL_RTX); -+ DONE; -+}) -+ -+ -+(define_insn "*sgtu" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (gtu:SI (match_operand:SI 1 "reg_or_0_operand" "rM") -+ (match_operand:SI 2 "reg_or_0_operand" "rM")))] -+ "" -+ "cmpltu\\t%0, %z2, %z1" -+ [(set_attr "type" "alu")]) -+ -+ -+(define_expand "sgeu" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (geu:SI (match_dup 1) -+ (match_dup 2)))] -+ "" -+{ -+ if (branch_type != CMP_SI) -+ FAIL; -+ -+ /* set up operands from compare. */ -+ operands[1] = branch_cmp[0]; -+ operands[2] = branch_cmp[1]; -+ -+ gen_int_relational (GEU, operands[0], operands[1], operands[2], NULL_RTX); -+ DONE; -+}) -+ -+ -+(define_insn "*sgeu" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (geu:SI (match_operand:SI 1 "reg_or_0_operand" "rM") -+ (match_operand:SI 2 "uns_arith_operand" "rJ")))] -+ "" -+ "cmpgeu%i2\\t%0, %z1, %z2" -+ [(set_attr "type" "alu")]) -+ -+(define_expand "sleu" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (leu:SI (match_dup 1) -+ (match_dup 2)))] -+ "" -+{ -+ if (branch_type != CMP_SI) -+ FAIL; -+ -+ /* set up operands from compare. */ -+ operands[1] = branch_cmp[0]; -+ operands[2] = branch_cmp[1]; -+ -+ gen_int_relational (LEU, operands[0], operands[1], operands[2], NULL_RTX); -+ DONE; -+}) -+ -+ -+(define_insn "*sleu" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (leu:SI (match_operand:SI 1 "reg_or_0_operand" "rM") -+ (match_operand:SI 2 "reg_or_0_operand" "rM")))] -+ "" -+ "cmpgeu\\t%0, %z2, %z1" -+ [(set_attr "type" "alu")]) -+ -+ -+(define_expand "sltu" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (ltu:SI (match_dup 1) -+ (match_dup 2)))] -+ "" -+{ -+ if (branch_type != CMP_SI) -+ FAIL; -+ -+ /* set up operands from compare. */ -+ operands[1] = branch_cmp[0]; -+ operands[2] = branch_cmp[1]; -+ -+ gen_int_relational (LTU, operands[0], operands[1], operands[2], NULL_RTX); -+ DONE; -+}) -+ -+ -+(define_insn "*sltu" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (ltu:SI (match_operand:SI 1 "reg_or_0_operand" "rM") -+ (match_operand:SI 2 "uns_arith_operand" "rJ")))] -+ "" -+ "cmpltu%i2\\t%0, %z1, %z2" -+ [(set_attr "type" "alu")]) -+ -+ -+ -+ -+;***************************************************************************** -+;* -+;* branches -+;* -+;***************************************************************************** -+ -+(define_insn "*cbranch" -+ [(set (pc) -+ (if_then_else -+ (match_operator:SI 0 "comparison_operator" -+ [(match_operand:SI 2 "reg_or_0_operand" "rM") -+ (match_operand:SI 3 "reg_or_0_operand" "rM")]) -+ (label_ref (match_operand 1 "" "")) -+ (pc)))] -+ "" -+ "b%0\\t%z2, %z3, %l1" -+ [(set_attr "type" "control")]) -+ -+ -+(define_expand "beq" -+ [(set (pc) -+ (if_then_else (eq:CC (cc0) -+ (const_int 0)) -+ (label_ref (match_operand 0 "" "")) -+ (pc)))] -+ "" -+{ -+ gen_int_relational (EQ, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); -+ DONE; -+}) -+ -+ -+(define_expand "bne" -+ [(set (pc) -+ (if_then_else (ne:CC (cc0) -+ (const_int 0)) -+ (label_ref (match_operand 0 "" "")) -+ (pc)))] -+ "" -+{ -+ gen_int_relational (NE, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); -+ DONE; -+}) -+ -+ -+(define_expand "bgt" -+ [(set (pc) -+ (if_then_else (gt:CC (cc0) -+ (const_int 0)) -+ (label_ref (match_operand 0 "" "")) -+ (pc)))] -+ "" -+{ -+ gen_int_relational (GT, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); -+ DONE; -+}) -+ -+(define_expand "bge" -+ [(set (pc) -+ (if_then_else (ge:CC (cc0) -+ (const_int 0)) -+ (label_ref (match_operand 0 "" "")) -+ (pc)))] -+ "" -+{ -+ gen_int_relational (GE, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); -+ DONE; -+}) -+ -+(define_expand "ble" -+ [(set (pc) -+ (if_then_else (le:CC (cc0) -+ (const_int 0)) -+ (label_ref (match_operand 0 "" "")) -+ (pc)))] -+ "" -+{ -+ gen_int_relational (LE, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); -+ DONE; -+}) -+ -+(define_expand "blt" -+ [(set (pc) -+ (if_then_else (lt:CC (cc0) -+ (const_int 0)) -+ (label_ref (match_operand 0 "" "")) -+ (pc)))] -+ "" -+{ -+ gen_int_relational (LT, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); -+ DONE; -+}) -+ -+ -+(define_expand "bgtu" -+ [(set (pc) -+ (if_then_else (gtu:CC (cc0) -+ (const_int 0)) -+ (label_ref (match_operand 0 "" "")) -+ (pc)))] -+ "" -+{ -+ gen_int_relational (GTU, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); -+ DONE; -+}) -+ -+(define_expand "bgeu" -+ [(set (pc) -+ (if_then_else (geu:CC (cc0) -+ (const_int 0)) -+ (label_ref (match_operand 0 "" "")) -+ (pc)))] -+ "" -+{ -+ gen_int_relational (GEU, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); -+ DONE; -+}) -+ -+(define_expand "bleu" -+ [(set (pc) -+ (if_then_else (leu:CC (cc0) -+ (const_int 0)) -+ (label_ref (match_operand 0 "" "")) -+ (pc)))] -+ "" -+{ -+ gen_int_relational (LEU, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); -+ DONE; -+}) -+ -+(define_expand "bltu" -+ [(set (pc) -+ (if_then_else (ltu:CC (cc0) -+ (const_int 0)) -+ (label_ref (match_operand 0 "" "")) -+ (pc)))] -+ "" -+{ -+ gen_int_relational (LTU, NULL_RTX, branch_cmp[0], branch_cmp[1], operands[0]); -+ DONE; -+}) -+ -+ -+;***************************************************************************** -+;* -+;* String and Block Operations -+;* -+;***************************************************************************** -+ -+; ??? This is all really a hack to get Dhrystone to work as fast as possible -+; things to be fixed: -+; * let the compiler core handle all of this, for that to work the extra -+; aliasing needs to be addressed. -+; * we use three temporary registers for loading and storing to ensure no -+; ld use stalls, this is excessive, because after the first ld/st only -+; two are needed. Only two would be needed all the way through if -+; we could schedule with other code. Consider: -+; 1 ld $1, 0($src) -+; 2 ld $2, 4($src) -+; 3 ld $3, 8($src) -+; 4 st $1, 0($dest) -+; 5 ld $1, 12($src) -+; 6 st $2, 4($src) -+; 7 etc. -+; The first store has to wait until 4. If it does not there will be one -+; cycle of stalling. However, if any other instruction could be placed -+; between 1 and 4, $3 would not be needed. -+; * In small we probably don't want to ever do this ourself because there -+; is no ld use stall. -+ -+(define_expand "movstrsi" -+ [(parallel [(set (match_operand:BLK 0 "general_operand" "") -+ (match_operand:BLK 1 "general_operand" "")) -+ (use (match_operand:SI 2 "const_int_operand" "")) -+ (use (match_operand:SI 3 "const_int_operand" "")) -+ (clobber (match_scratch:SI 4 "=&r")) -+ (clobber (match_scratch:SI 5 "=&r")) -+ (clobber (match_scratch:SI 6 "=&r"))])] -+ "TARGET_INLINE_MEMCPY" -+{ -+ rtx ld_addr_reg, st_addr_reg; -+ -+ /* If the predicate for op2 fails in expr.c:emit_block_move_via_movstr -+ it trys to copy to a register, but does not re-try the predicate. -+ ??? Intead of fixing expr.c, I fix it here. */ -+ if (!const_int_operand (operands[2], SImode)) -+ FAIL; -+ -+ /* ??? there are some magic numbers which need to be sorted out here. -+ the basis for them is not increasing code size hugely or going -+ out of range of offset addressing */ -+ if (INTVAL (operands[3]) < 4) -+ FAIL; -+ if (!optimize -+ || (optimize_size && INTVAL (operands[2]) > 12) -+ || (optimize < 3 && INTVAL (operands[2]) > 100) -+ || INTVAL (operands[2]) > 200) -+ FAIL; -+ -+ st_addr_reg -+ = replace_equiv_address (operands[0], -+ copy_to_mode_reg (Pmode, XEXP (operands[0], 0))); -+ ld_addr_reg -+ = replace_equiv_address (operands[1], -+ copy_to_mode_reg (Pmode, XEXP (operands[1], 0))); -+ emit_insn (gen_movstrsi_internal (st_addr_reg, ld_addr_reg, -+ operands[2], operands[3])); -+ -+ DONE; -+}) -+ -+ -+(define_insn "movstrsi_internal" -+ [(set (match_operand:BLK 0 "memory_operand" "=o") -+ (match_operand:BLK 1 "memory_operand" "o")) -+ (use (match_operand:SI 2 "const_int_operand" "i")) -+ (use (match_operand:SI 3 "const_int_operand" "i")) -+ (clobber (match_scratch:SI 4 "=&r")) -+ (clobber (match_scratch:SI 5 "=&r")) -+ (clobber (match_scratch:SI 6 "=&r"))] -+ "TARGET_INLINE_MEMCPY" -+{ -+ int ld_offset = INTVAL (operands[2]); -+ int ld_len = INTVAL (operands[2]); -+ int ld_reg = 0; -+ rtx ld_addr_reg = XEXP (operands[1], 0); -+ int st_offset = INTVAL (operands[2]); -+ int st_len = INTVAL (operands[2]); -+ int st_reg = 0; -+ rtx st_addr_reg = XEXP (operands[0], 0); -+ int delay_count = 0; -+ -+ /* ops[0] is the address used by the insn -+ ops[1] is the register being loaded or stored */ -+ rtx ops[2]; -+ -+ if (INTVAL (operands[3]) < 4) -+ abort (); -+ -+ while (ld_offset >= 4) -+ { -+ /* if the load use delay has been met, I can start -+ storing */ -+ if (delay_count >= 3) -+ { -+ ops[0] = gen_rtx (MEM, SImode, -+ plus_constant (st_addr_reg, st_len - st_offset)); -+ ops[1] = operands[st_reg + 4]; -+ output_asm_insn ("stw\t%1, %0", ops); -+ -+ st_reg = (st_reg + 1) % 3; -+ st_offset -= 4; -+ } -+ -+ ops[0] = gen_rtx (MEM, SImode, -+ plus_constant (ld_addr_reg, ld_len - ld_offset)); -+ ops[1] = operands[ld_reg + 4]; -+ output_asm_insn ("ldw\t%1, %0", ops); -+ -+ ld_reg = (ld_reg + 1) % 3; -+ ld_offset -= 4; -+ delay_count++; -+ } -+ -+ if (ld_offset >= 2) -+ { -+ /* if the load use delay has been met, I can start -+ storing */ -+ if (delay_count >= 3) -+ { -+ ops[0] = gen_rtx (MEM, SImode, -+ plus_constant (st_addr_reg, st_len - st_offset)); -+ ops[1] = operands[st_reg + 4]; -+ output_asm_insn ("stw\t%1, %0", ops); -+ -+ st_reg = (st_reg + 1) % 3; -+ st_offset -= 4; -+ } -+ -+ ops[0] = gen_rtx (MEM, HImode, -+ plus_constant (ld_addr_reg, ld_len - ld_offset)); -+ ops[1] = operands[ld_reg + 4]; -+ output_asm_insn ("ldh\t%1, %0", ops); -+ -+ ld_reg = (ld_reg + 1) % 3; -+ ld_offset -= 2; -+ delay_count++; -+ } -+ -+ if (ld_offset >= 1) -+ { -+ /* if the load use delay has been met, I can start -+ storing */ -+ if (delay_count >= 3) -+ { -+ ops[0] = gen_rtx (MEM, SImode, -+ plus_constant (st_addr_reg, st_len - st_offset)); -+ ops[1] = operands[st_reg + 4]; -+ output_asm_insn ("stw\t%1, %0", ops); -+ -+ st_reg = (st_reg + 1) % 3; -+ st_offset -= 4; -+ } -+ -+ ops[0] = gen_rtx (MEM, QImode, -+ plus_constant (ld_addr_reg, ld_len - ld_offset)); -+ ops[1] = operands[ld_reg + 4]; -+ output_asm_insn ("ldb\t%1, %0", ops); -+ -+ ld_reg = (ld_reg + 1) % 3; -+ ld_offset -= 1; -+ delay_count++; -+ } -+ -+ while (st_offset >= 4) -+ { -+ ops[0] = gen_rtx (MEM, SImode, -+ plus_constant (st_addr_reg, st_len - st_offset)); -+ ops[1] = operands[st_reg + 4]; -+ output_asm_insn ("stw\t%1, %0", ops); -+ -+ st_reg = (st_reg + 1) % 3; -+ st_offset -= 4; -+ } -+ -+ while (st_offset >= 2) -+ { -+ ops[0] = gen_rtx (MEM, HImode, -+ plus_constant (st_addr_reg, st_len - st_offset)); -+ ops[1] = operands[st_reg + 4]; -+ output_asm_insn ("sth\t%1, %0", ops); -+ -+ st_reg = (st_reg + 1) % 3; -+ st_offset -= 2; -+ } -+ -+ while (st_offset >= 1) -+ { -+ ops[0] = gen_rtx (MEM, QImode, -+ plus_constant (st_addr_reg, st_len - st_offset)); -+ ops[1] = operands[st_reg + 4]; -+ output_asm_insn ("stb\t%1, %0", ops); -+ -+ st_reg = (st_reg + 1) % 3; -+ st_offset -= 1; -+ } -+ -+ return ""; -+} -+; ??? lengths are not being used yet, but I will probably forget -+; to update this once I am using lengths, so set it to something -+; definetely big enough to cover it. 400 allows for 200 bytes -+; of motion. -+ [(set_attr "length" "400")]) -+ -+ -+ -+;***************************************************************************** -+;* -+;* Custom instructions -+;* -+;***************************************************************************** -+ -+(define_constants [ -+ (CUSTOM_N 100) -+ (CUSTOM_NI 101) -+ (CUSTOM_NF 102) -+ (CUSTOM_NP 103) -+ (CUSTOM_NII 104) -+ (CUSTOM_NIF 105) -+ (CUSTOM_NIP 106) -+ (CUSTOM_NFI 107) -+ (CUSTOM_NFF 108) -+ (CUSTOM_NFP 109) -+ (CUSTOM_NPI 110) -+ (CUSTOM_NPF 111) -+ (CUSTOM_NPP 112) -+ (CUSTOM_IN 113) -+ (CUSTOM_INI 114) -+ (CUSTOM_INF 115) -+ (CUSTOM_INP 116) -+ (CUSTOM_INII 117) -+ (CUSTOM_INIF 118) -+ (CUSTOM_INIP 119) -+ (CUSTOM_INFI 120) -+ (CUSTOM_INFF 121) -+ (CUSTOM_INFP 122) -+ (CUSTOM_INPI 123) -+ (CUSTOM_INPF 124) -+ (CUSTOM_INPP 125) -+ (CUSTOM_FN 126) -+ (CUSTOM_FNI 127) -+ (CUSTOM_FNF 128) -+ (CUSTOM_FNP 129) -+ (CUSTOM_FNII 130) -+ (CUSTOM_FNIF 131) -+ (CUSTOM_FNIP 132) -+ (CUSTOM_FNFI 133) -+ (CUSTOM_FNFF 134) -+ (CUSTOM_FNFP 135) -+ (CUSTOM_FNPI 136) -+ (CUSTOM_FNPF 137) -+ (CUSTOM_FNPP 138) -+ (CUSTOM_PN 139) -+ (CUSTOM_PNI 140) -+ (CUSTOM_PNF 141) -+ (CUSTOM_PNP 142) -+ (CUSTOM_PNII 143) -+ (CUSTOM_PNIF 144) -+ (CUSTOM_PNIP 145) -+ (CUSTOM_PNFI 146) -+ (CUSTOM_PNFF 147) -+ (CUSTOM_PNFP 148) -+ (CUSTOM_PNPI 149) -+ (CUSTOM_PNPF 150) -+ (CUSTOM_PNPP 151) -+]) -+ -+ -+(define_insn "custom_n" -+ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N")] CUSTOM_N)] -+ "" -+ "custom\\t%0, zero, zero, zero" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_ni" -+ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") -+ (match_operand:SI 1 "register_operand" "r")] CUSTOM_NI)] -+ "" -+ "custom\\t%0, zero, %1, zero" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_nf" -+ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") -+ (match_operand:SF 1 "register_operand" "r")] CUSTOM_NF)] -+ "" -+ "custom\\t%0, zero, %1, zero" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_np" -+ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") -+ (match_operand:SI 1 "register_operand" "r")] CUSTOM_NP)] -+ "" -+ "custom\\t%0, zero, %1, zero" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_nii" -+ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") -+ (match_operand:SI 1 "register_operand" "r") -+ (match_operand:SI 2 "register_operand" "r")] CUSTOM_NII)] -+ "" -+ "custom\\t%0, zero, %1, %2" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_nif" -+ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") -+ (match_operand:SI 1 "register_operand" "r") -+ (match_operand:SF 2 "register_operand" "r")] CUSTOM_NIF)] -+ "" -+ "custom\\t%0, zero, %1, %2" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_nip" -+ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") -+ (match_operand:SI 1 "register_operand" "r") -+ (match_operand:SI 2 "register_operand" "r")] CUSTOM_NIP)] -+ "" -+ "custom\\t%0, zero, %1, %2" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_nfi" -+ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") -+ (match_operand:SF 1 "register_operand" "r") -+ (match_operand:SI 2 "register_operand" "r")] CUSTOM_NFI)] -+ "" -+ "custom\\t%0, zero, %1, %2" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_nff" -+ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") -+ (match_operand:SF 1 "register_operand" "r") -+ (match_operand:SF 2 "register_operand" "r")] CUSTOM_NFF)] -+ "" -+ "custom\\t%0, zero, %1, %2" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_nfp" -+ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") -+ (match_operand:SF 1 "register_operand" "r") -+ (match_operand:SI 2 "register_operand" "r")] CUSTOM_NFP)] -+ "" -+ "custom\\t%0, zero, %1, %2" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_npi" -+ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") -+ (match_operand:SI 1 "register_operand" "r") -+ (match_operand:SI 2 "register_operand" "r")] CUSTOM_NPI)] -+ "" -+ "custom\\t%0, zero, %1, %2" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_npf" -+ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") -+ (match_operand:SI 1 "register_operand" "r") -+ (match_operand:SF 2 "register_operand" "r")] CUSTOM_NPF)] -+ "" -+ "custom\\t%0, zero, %1, %2" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_npp" -+ [(unspec_volatile [(match_operand:SI 0 "custom_insn_opcode" "N") -+ (match_operand:SI 1 "register_operand" "r") -+ (match_operand:SI 2 "register_operand" "r")] CUSTOM_NPP)] -+ "" -+ "custom\\t%0, zero, %1, %2" -+ [(set_attr "type" "custom")]) -+ -+ -+ -+(define_insn "custom_in" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N")] CUSTOM_IN))] -+ "" -+ "custom\\t%1, %0, zero, zero" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_ini" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r")] CUSTOM_INI))] -+ "" -+ "custom\\t%1, %0, %2, zero" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_inf" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SF 2 "register_operand" "r")] CUSTOM_INF))] -+ "" -+ "custom\\t%1, %0, %2, zero" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_inp" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r")] CUSTOM_INP))] -+ "" -+ "custom\\t%1, %0, %2, zero" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_inii" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r") -+ (match_operand:SI 3 "register_operand" "r")] CUSTOM_INII))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_inif" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r") -+ (match_operand:SF 3 "register_operand" "r")] CUSTOM_INIF))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_inip" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r") -+ (match_operand:SI 3 "register_operand" "r")] CUSTOM_INIP))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_infi" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SF 2 "register_operand" "r") -+ (match_operand:SI 3 "register_operand" "r")] CUSTOM_INFI))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_inff" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SF 2 "register_operand" "r") -+ (match_operand:SF 3 "register_operand" "r")] CUSTOM_INFF))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_infp" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SF 2 "register_operand" "r") -+ (match_operand:SI 3 "register_operand" "r")] CUSTOM_INFP))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_inpi" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r") -+ (match_operand:SI 3 "register_operand" "r")] CUSTOM_INPI))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_inpf" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r") -+ (match_operand:SF 3 "register_operand" "r")] CUSTOM_INPF))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_inpp" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r") -+ (match_operand:SI 3 "register_operand" "r")] CUSTOM_INPP))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+ -+ -+ -+ -+(define_insn "custom_fn" -+ [(set (match_operand:SF 0 "register_operand" "=r") -+ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N")] CUSTOM_FN))] -+ "" -+ "custom\\t%1, %0, zero, zero" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_fni" -+ [(set (match_operand:SF 0 "register_operand" "=r") -+ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r")] CUSTOM_FNI))] -+ "" -+ "custom\\t%1, %0, %2, zero" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_fnf" -+ [(set (match_operand:SF 0 "register_operand" "=r") -+ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SF 2 "register_operand" "r")] CUSTOM_FNF))] -+ "" -+ "custom\\t%1, %0, %2, zero" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_fnp" -+ [(set (match_operand:SF 0 "register_operand" "=r") -+ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r")] CUSTOM_FNP))] -+ "" -+ "custom\\t%1, %0, %2, zero" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_fnii" -+ [(set (match_operand:SF 0 "register_operand" "=r") -+ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r") -+ (match_operand:SI 3 "register_operand" "r")] CUSTOM_FNII))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_fnif" -+ [(set (match_operand:SF 0 "register_operand" "=r") -+ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r") -+ (match_operand:SF 3 "register_operand" "r")] CUSTOM_FNIF))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_fnip" -+ [(set (match_operand:SF 0 "register_operand" "=r") -+ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r") -+ (match_operand:SI 3 "register_operand" "r")] CUSTOM_FNIP))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_fnfi" -+ [(set (match_operand:SF 0 "register_operand" "=r") -+ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SF 2 "register_operand" "r") -+ (match_operand:SI 3 "register_operand" "r")] CUSTOM_FNFI))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_fnff" -+ [(set (match_operand:SF 0 "register_operand" "=r") -+ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SF 2 "register_operand" "r") -+ (match_operand:SF 3 "register_operand" "r")] CUSTOM_FNFF))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_fnfp" -+ [(set (match_operand:SF 0 "register_operand" "=r") -+ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SF 2 "register_operand" "r") -+ (match_operand:SI 3 "register_operand" "r")] CUSTOM_FNFP))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_fnpi" -+ [(set (match_operand:SF 0 "register_operand" "=r") -+ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r") -+ (match_operand:SI 3 "register_operand" "r")] CUSTOM_FNPI))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_fnpf" -+ [(set (match_operand:SF 0 "register_operand" "=r") -+ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r") -+ (match_operand:SF 3 "register_operand" "r")] CUSTOM_FNPF))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_fnpp" -+ [(set (match_operand:SF 0 "register_operand" "=r") -+ (unspec_volatile:SF [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r") -+ (match_operand:SI 3 "register_operand" "r")] CUSTOM_FNPP))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+ -+ -+(define_insn "custom_pn" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N")] CUSTOM_PN))] -+ "" -+ "custom\\t%1, %0, zero, zero" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_pni" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r")] CUSTOM_PNI))] -+ "" -+ "custom\\t%1, %0, %2, zero" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_pnf" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SF 2 "register_operand" "r")] CUSTOM_PNF))] -+ "" -+ "custom\\t%1, %0, %2, zero" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_pnp" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r")] CUSTOM_PNP))] -+ "" -+ "custom\\t%1, %0, %2, zero" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_pnii" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r") -+ (match_operand:SI 3 "register_operand" "r")] CUSTOM_PNII))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_pnif" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r") -+ (match_operand:SF 3 "register_operand" "r")] CUSTOM_PNIF))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_pnip" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r") -+ (match_operand:SI 3 "register_operand" "r")] CUSTOM_PNIP))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_pnfi" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SF 2 "register_operand" "r") -+ (match_operand:SI 3 "register_operand" "r")] CUSTOM_PNFI))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_pnff" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SF 2 "register_operand" "r") -+ (match_operand:SF 3 "register_operand" "r")] CUSTOM_PNFF))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_pnfp" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SF 2 "register_operand" "r") -+ (match_operand:SI 3 "register_operand" "r")] CUSTOM_PNFP))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_pnpi" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r") -+ (match_operand:SI 3 "register_operand" "r")] CUSTOM_PNPI))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_pnpf" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r") -+ (match_operand:SF 3 "register_operand" "r")] CUSTOM_PNPF))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+(define_insn "custom_pnpp" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "custom_insn_opcode" "N") -+ (match_operand:SI 2 "register_operand" "r") -+ (match_operand:SI 3 "register_operand" "r")] CUSTOM_PNPP))] -+ "" -+ "custom\\t%1, %0, %2, %3" -+ [(set_attr "type" "custom")]) -+ -+ -+ -+ -+ -+ -+;***************************************************************************** -+;* -+;* Misc -+;* -+;***************************************************************************** -+ -+(define_insn "nop" -+ [(const_int 0)] -+ "" -+ "nop\\t" -+ [(set_attr "type" "alu")]) -+ -+(define_insn "sync" -+ [(unspec_volatile [(const_int 0)] UNSPEC_SYNC)] -+ "" -+ "sync\\t" -+ [(set_attr "type" "control")]) -+ -+ -+(define_insn "rdctl" -+ [(set (match_operand:SI 0 "register_operand" "=r") -+ (unspec_volatile:SI [(match_operand:SI 1 "rdwrctl_operand" "O")] UNSPEC_RDCTL))] -+ "" -+ "rdctl\\t%0, ctl%1" -+ [(set_attr "type" "control")]) -+ -+(define_insn "wrctl" -+ [(unspec_volatile:SI [(match_operand:SI 0 "rdwrctl_operand" "O") -+ (match_operand:SI 1 "register_operand" "r")] UNSPEC_WRCTL)] -+ "" -+ "wrctl\\tctl%0, %1" -+ [(set_attr "type" "control")]) -+ -+ -+ -+;***************************************************************************** -+;* -+;* Peepholes -+;* -+;***************************************************************************** -+ -+ -diff -durN gcc-3.4.6.orig/gcc/config/nios2/nios2-protos.h gcc-3.4.6/gcc/config/nios2/nios2-protos.h ---- gcc-3.4.6.orig/gcc/config/nios2/nios2-protos.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/gcc/config/nios2/nios2-protos.h 2007-08-15 23:09:36.000000000 +0200 -@@ -0,0 +1,70 @@ -+/* Subroutines for assembler code output for Altera NIOS 2G NIOS2 version. -+ Copyright (C) 2003 Altera -+ Contributed by Jonah Graham (jgraham@altera.com). -+ -+This file is part of GNU CC. -+ -+GNU CC is free software; you can redistribute it and/or modify -+it under the terms of the GNU General Public License as published by -+the Free Software Foundation; either version 2, or (at your option) -+any later version. -+ -+GNU CC is distributed in the hope that it will be useful, -+but WITHOUT ANY WARRANTY; without even the implied warranty of -+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+GNU General Public License for more details. -+ -+You should have received a copy of the GNU General Public License -+along with GNU CC; see the file COPYING. If not, write to -+the Free Software Foundation, 59 Temple Place - Suite 330, -+Boston, MA 02111-1307, USA. */ -+ -+extern void dump_frame_size (FILE *); -+extern HOST_WIDE_INT compute_frame_size (void); -+extern int nios2_initial_elimination_offset (int, int); -+extern void override_options (void); -+extern void optimization_options (int, int); -+extern int nios2_can_use_return_insn (void); -+extern void expand_prologue (void); -+extern void expand_epilogue (bool); -+extern void function_profiler (FILE *, int); -+ -+ -+#ifdef RTX_CODE -+extern int nios2_legitimate_address (rtx, enum machine_mode, int); -+extern void nios2_print_operand (FILE *, rtx, int); -+extern void nios2_print_operand_address (FILE *, rtx); -+ -+extern int nios2_emit_move_sequence (rtx *, enum machine_mode); -+extern int nios2_emit_expensive_div (rtx *, enum machine_mode); -+ -+extern void gen_int_relational (enum rtx_code, rtx, rtx, rtx, rtx); -+extern void gen_conditional_move (rtx *, enum machine_mode); -+extern const char *asm_output_opcode (FILE *, const char *); -+ -+/* predicates */ -+extern int arith_operand (rtx, enum machine_mode); -+extern int uns_arith_operand (rtx, enum machine_mode); -+extern int logical_operand (rtx, enum machine_mode); -+extern int shift_operand (rtx, enum machine_mode); -+extern int reg_or_0_operand (rtx, enum machine_mode); -+extern int equality_op (rtx, enum machine_mode); -+extern int custom_insn_opcode (rtx, enum machine_mode); -+extern int rdwrctl_operand (rtx, enum machine_mode); -+ -+# ifdef HAVE_MACHINE_MODES -+# if defined TREE_CODE -+extern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree, int); -+extern rtx function_arg (const CUMULATIVE_ARGS *, enum machine_mode, tree, int); -+extern int function_arg_partial_nregs (const CUMULATIVE_ARGS *, enum machine_mode, tree, int); -+extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, int); -+extern int nios2_setup_incoming_varargs (const CUMULATIVE_ARGS *, enum machine_mode, tree, int); -+ -+# endif /* TREE_CODE */ -+# endif /* HAVE_MACHINE_MODES */ -+#endif -+ -+#ifdef TREE_CODE -+extern int nios2_return_in_memory (tree); -+ -+#endif /* TREE_CODE */ -diff -durN gcc-3.4.6.orig/gcc/config/nios2/t-nios2 gcc-3.4.6/gcc/config/nios2/t-nios2 ---- gcc-3.4.6.orig/gcc/config/nios2/t-nios2 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-3.4.6/gcc/config/nios2/t-nios2 2007-08-15 23:09:36.000000000 +0200 -@@ -0,0 +1,123 @@ -+## -+## Compiler flags to use when compiling libgcc2.c. -+## -+## LIB2FUNCS_EXTRA -+## A list of source file names to be compiled or assembled and inserted into libgcc.a. -+ -+LIB2FUNCS_EXTRA=$(srcdir)/config/nios2/lib2-divmod.c \ -+ $(srcdir)/config/nios2/lib2-divmod-hi.c \ -+ $(srcdir)/config/nios2/lib2-divtable.c \ -+ $(srcdir)/config/nios2/lib2-mul.c -+ -+## -+## Floating Point Emulation -+## To have GCC include software floating point libraries in libgcc.a define FPBIT -+## and DPBIT along with a few rules as follows: -+## -+## # We want fine grained libraries, so use the new code -+## # to build the floating point emulation libraries. -+FPBIT=$(srcdir)/config/nios2/nios2-fp-bit.c -+DPBIT=$(srcdir)/config/nios2/nios2-dp-bit.c -+ -+TARGET_LIBGCC2_CFLAGS = -O2 -+ -+# FLOAT_ONLY - no doubles -+# SMALL_MACHINE - QI/HI is faster than SI -+# Actually SMALL_MACHINE uses chars and shorts instead of ints -+# since ints (16-bit ones as they are today) are at least as fast -+# as chars and shorts, don't define SMALL_MACHINE -+# CMPtype - type returned by FP compare, i.e. INT (hard coded in fp-bit - see code ) -+ -+$(FPBIT): $(srcdir)/config/fp-bit.c Makefile -+ echo '#define FLOAT' > ${FPBIT} -+ cat $(srcdir)/config/fp-bit.c >> ${FPBIT} -+ -+$(DPBIT): $(srcdir)/config/fp-bit.c Makefile -+ echo '' > ${DPBIT} -+ cat $(srcdir)/config/fp-bit.c >> ${DPBIT} -+ -+EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o -+ -+# Assemble startup files. -+$(T)crti.o: $(srcdir)/config/nios2/crti.asm $(GCC_PASSES) -+ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ -+ -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/nios2/crti.asm -+ -+$(T)crtn.o: $(srcdir)/config/nios2/crtn.asm $(GCC_PASSES) -+ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ -+ -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/nios2/crtn.asm -+ -+ -+## You may need to provide additional #defines at the beginning of -+## fp-bit.c and dp-bit.c to control target endianness and other options -+## -+## CRTSTUFF_T_CFLAGS -+## Special flags used when compiling crtstuff.c. See Initialization. -+## -+## CRTSTUFF_T_CFLAGS_S -+## Special flags used when compiling crtstuff.c for shared linking. Used -+## if you use crtbeginS.o and crtendS.o in EXTRA-PARTS. See Initialization. -+## -+## MULTILIB_OPTIONS -+## For some targets, invoking GCC in different ways produces objects that -+## can not be linked together. For example, for some targets GCC produces -+## both big and little endian code. For these targets, you must arrange -+## for multiple versions of libgcc.a to be compiled, one for each set of -+## incompatible options. When GCC invokes the linker, it arranges to link -+## in the right version of libgcc.a, based on the command line options -+## used. -+## The MULTILIB_OPTIONS macro lists the set of options for which special -+## versions of libgcc.a must be built. Write options that are mutually -+## incompatible side by side, separated by a slash. Write options that may -+## be used together separated by a space. The build procedure will build -+## all combinations of compatible options. -+## -+## For example, if you set MULTILIB_OPTIONS to m68000/m68020 msoft-float, -+## Makefile will build special versions of libgcc.a using the following -+## sets of options: -m68000, -m68020, -msoft-float, -m68000 -msoft-float, -+## and -m68020 -msoft-float. -+ -+MULTILIB_OPTIONS = mno-hw-mul mhw-mulx -+ -+## MULTILIB_DIRNAMES -+## If MULTILIB_OPTIONS is used, this variable specifies the directory names -+## that should be used to hold the various libraries. Write one element in -+## MULTILIB_DIRNAMES for each element in MULTILIB_OPTIONS. If -+## MULTILIB_DIRNAMES is not used, the default value will be -+## MULTILIB_OPTIONS, with all slashes treated as spaces. -+## For example, if MULTILIB_OPTIONS is set to m68000/m68020 msoft-float, -+## then the default value of MULTILIB_DIRNAMES is m68000 m68020 -+## msoft-float. You may specify a different value if you desire a -+## different set of directory names. -+ -+# MULTILIB_DIRNAMES = -+ -+## MULTILIB_MATCHES -+## Sometimes the same option may be written in two different ways. If an -+## option is listed in MULTILIB_OPTIONS, GCC needs to know about any -+## synonyms. In that case, set MULTILIB_MATCHES to a list of items of the -+## form option=option to describe all relevant synonyms. For example, -+## m68000=mc68000 m68020=mc68020. -+## -+## MULTILIB_EXCEPTIONS -+## Sometimes when there are multiple sets of MULTILIB_OPTIONS being -+## specified, there are combinations that should not be built. In that -+## case, set MULTILIB_EXCEPTIONS to be all of the switch exceptions in -+## shell case syntax that should not be built. -+## For example, in the PowerPC embedded ABI support, it is not desirable to -+## build libraries compiled with the -mcall-aix option and either of the -+## -fleading-underscore or -mlittle options at the same time. Therefore -+## MULTILIB_EXCEPTIONS is set to -+## -+## *mcall-aix/*fleading-underscore* *mlittle/*mcall-aix* -+## -+ -+MULTILIB_EXCEPTIONS = *mno-hw-mul/*mhw-mulx* -+ -+## -+## MULTILIB_EXTRA_OPTS Sometimes it is desirable that when building -+## multiple versions of libgcc.a certain options should always be passed on -+## to the compiler. In that case, set MULTILIB_EXTRA_OPTS to be the list -+## of options to be used for all builds. -+## -+ -diff -durN gcc-3.4.6.orig/gcc/config.gcc gcc-3.4.6/gcc/config.gcc ---- gcc-3.4.6.orig/gcc/config.gcc 2007-08-15 23:07:00.000000000 +0200 -+++ gcc-3.4.6/gcc/config.gcc 2007-08-15 23:09:36.000000000 +0200 -@@ -1342,6 +1342,10 @@ - thread_file='posix' - fi - ;; -+# JBG -+nios2-*-* | nios2-*-*) -+ tm_file="elfos.h ${tm_file}" -+ ;; - # m68hc11 and m68hc12 share the same machine description. - m68hc11-*-*|m6811-*-*) - tm_file="dbxelf.h elfos.h m68hc11/m68hc11.h" -diff -durN gcc-3.4.6.orig/gcc/cse.c gcc-3.4.6/gcc/cse.c ---- gcc-3.4.6.orig/gcc/cse.c 2005-12-31 01:39:42.000000000 +0100 -+++ gcc-3.4.6/gcc/cse.c 2007-08-15 23:09:36.000000000 +0200 -@@ -3134,6 +3134,10 @@ - #ifdef FLOAT_STORE_FLAG_VALUE - REAL_VALUE_TYPE fsfv; - #endif -+#ifdef __nios2__ -+ if (p->is_const) -+ break; -+#endif - - /* If the entry isn't valid, skip it. */ - if (! exp_equiv_p (p->exp, p->exp, 1, 0)) -diff -durN gcc-3.4.6.orig/gcc/doc/extend.texi gcc-3.4.6/gcc/doc/extend.texi ---- gcc-3.4.6.orig/gcc/doc/extend.texi 2005-02-26 23:17:26.000000000 +0100 -+++ gcc-3.4.6/gcc/doc/extend.texi 2007-08-15 23:09:36.000000000 +0200 -@@ -5638,12 +5638,118 @@ - instructions, but allow the compiler to schedule those calls. - - @menu -+* Altera Nios II Built-in Functions:: - * Alpha Built-in Functions:: - * ARM Built-in Functions:: - * X86 Built-in Functions:: - * PowerPC AltiVec Built-in Functions:: - @end menu - -+@node Altera Nios II Built-in Functions -+@subsection Altera Nios II Built-in Functions -+ -+These built-in functions are available for the Altera Nios II -+family of processors. -+ -+The following built-in functions are always available. They -+all generate the machine instruction that is part of the name. -+ -+@example -+int __builtin_ldbio (volatile const void *) -+int __builtin_ldbuio (volatile const void *) -+int __builtin_ldhio (volatile const void *) -+int __builtin_ldhuio (volatile const void *) -+int __builtin_ldwio (volatile const void *) -+void __builtin_stbio (volatile void *, int) -+void __builtin_sthio (volatile void *, int) -+void __builtin_stwio (volatile void *, int) -+void __builtin_sync (void) -+int __builtin_rdctl (int) -+void __builtin_wrctl (int, int) -+@end example -+ -+The following built-in functions are always available. They -+all generate a Nios II Custom Instruction. The name of the -+function represents the types that the function takes and -+returns. The letter before the @code{n} is the return type -+or void if absent. The @code{n} represnts the first parameter -+to all the custom instructions, the custom instruction number. -+The two letters after the @code{n} represent the up to two -+parameters to the function. -+ -+The letters reprsent the following data types: -+@table @code -+@item -+@code{void} for return type and no parameter for parameter types. -+ -+@item i -+@code{int} for return type and parameter type -+ -+@item f -+@code{float} for return type and parameter type -+ -+@item p -+@code{void *} for return type and parameter type -+ -+@end table -+ -+And the function names are: -+@example -+void __builtin_custom_n (void) -+void __builtin_custom_ni (int) -+void __builtin_custom_nf (float) -+void __builtin_custom_np (void *) -+void __builtin_custom_nii (int, int) -+void __builtin_custom_nif (int, float) -+void __builtin_custom_nip (int, void *) -+void __builtin_custom_nfi (float, int) -+void __builtin_custom_nff (float, float) -+void __builtin_custom_nfp (float, void *) -+void __builtin_custom_npi (void *, int) -+void __builtin_custom_npf (void *, float) -+void __builtin_custom_npp (void *, void *) -+int __builtin_custom_in (void) -+int __builtin_custom_ini (int) -+int __builtin_custom_inf (float) -+int __builtin_custom_inp (void *) -+int __builtin_custom_inii (int, int) -+int __builtin_custom_inif (int, float) -+int __builtin_custom_inip (int, void *) -+int __builtin_custom_infi (float, int) -+int __builtin_custom_inff (float, float) -+int __builtin_custom_infp (float, void *) -+int __builtin_custom_inpi (void *, int) -+int __builtin_custom_inpf (void *, float) -+int __builtin_custom_inpp (void *, void *) -+float __builtin_custom_fn (void) -+float __builtin_custom_fni (int) -+float __builtin_custom_fnf (float) -+float __builtin_custom_fnp (void *) -+float __builtin_custom_fnii (int, int) -+float __builtin_custom_fnif (int, float) -+float __builtin_custom_fnip (int, void *) -+float __builtin_custom_fnfi (float, int) -+float __builtin_custom_fnff (float, float) -+float __builtin_custom_fnfp (float, void *) -+float __builtin_custom_fnpi (void *, int) -+float __builtin_custom_fnpf (void *, float) -+float __builtin_custom_fnpp (void *, void *) -+void * __builtin_custom_pn (void) -+void * __builtin_custom_pni (int) -+void * __builtin_custom_pnf (float) -+void * __builtin_custom_pnp (void *) -+void * __builtin_custom_pnii (int, int) -+void * __builtin_custom_pnif (int, float) -+void * __builtin_custom_pnip (int, void *) -+void * __builtin_custom_pnfi (float, int) -+void * __builtin_custom_pnff (float, float) -+void * __builtin_custom_pnfp (float, void *) -+void * __builtin_custom_pnpi (void *, int) -+void * __builtin_custom_pnpf (void *, float) -+void * __builtin_custom_pnpp (void *, void *) -+@end example -+ -+ - @node Alpha Built-in Functions - @subsection Alpha Built-in Functions - -diff -durN gcc-3.4.6.orig/gcc/doc/invoke.texi gcc-3.4.6/gcc/doc/invoke.texi ---- gcc-3.4.6.orig/gcc/doc/invoke.texi 2005-10-08 02:22:20.000000000 +0200 -+++ gcc-3.4.6/gcc/doc/invoke.texi 2007-08-15 23:09:36.000000000 +0200 -@@ -337,6 +337,14 @@ - @item Machine Dependent Options - @xref{Submodel Options,,Hardware Models and Configurations}. - -+@emph{Altera Nios II Options} -+@gccoptlist{-msmallc -mno-bypass-cache -mbypass-cache @gol -+-mno-cache-volatile -mcache-volatile -mno-inline-memcpy @gol -+-minline-memcpy -mno-fast-sw-div -mfast-sw-div @gol -+-mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx @gol -+-mno-hw-div -mhw-div @gol -+-msys-crt0= -msys-lib= -msys=nosys } -+ - @emph{M680x0 Options} - @gccoptlist{-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol - -m68060 -mcpu32 -m5200 -m68881 -mbitfield -mc68000 -mc68020 @gol -@@ -5839,6 +5847,7 @@ - that macro, which enables you to change the defaults. - - @menu -+* Altera Nios II Options:: - * M680x0 Options:: - * M68hc1x Options:: - * VAX Options:: -@@ -5874,6 +5883,103 @@ - * FRV Options:: - @end menu - -+ -+@node Altera Nios II Options -+@subsection Altera Nios II Options -+@cindex Altera Nios II options -+ -+These are the @samp{-m} options defined for the Altera Nios II -+processor. -+ -+@table @gcctabopt -+ -+@item -msmallc -+@opindex msmallc -+ -+Link with a limited version of the C library, -lsmallc. For more -+information see the C Library Documentation. -+ -+ -+@item -mbypass-cache -+@itemx -mno-bypass-cache -+@opindex mno-bypass-cache -+@opindex mbypass-cache -+ -+Force all load and store instructions to always bypass cache by -+using io variants of the instructions. The default is to not -+bypass the cache. -+ -+@item -mno-cache-volatile -+@itemx -mcache-volatile -+@opindex mcache-volatile -+@opindex mno-cache-volatile -+ -+Volatile memory access bypass the cache using the io variants of -+the ld and st instructions. The default is to cache volatile -+accesses. -+ -+-mno-cache-volatile is deprecated and will be deleted in a -+future GCC release. -+ -+ -+@item -mno-inline-memcpy -+@itemx -minline-memcpy -+@opindex mno-inline-memcpy -+@opindex minline-memcpy -+ -+Do not inline memcpy. The default is to inline when -O is on. -+ -+ -+@item -mno-fast-sw-div -+@itemx -mfast-sw-div -+@opindex mno-fast-sw-div -+@opindex mfast-sw-div -+ -+Do no use table based fast divide for small numbers. The default -+is to use the fast divide at -O3 and above. -+ -+ -+@item -mno-hw-mul -+@itemx -mhw-mul -+@itemx -mno-hw-mulx -+@itemx -mhw-mulx -+@itemx -mno-hw-div -+@itemx -mhw-div -+@opindex mno-hw-mul -+@opindex mhw-mul -+@opindex mno-hw-mulx -+@opindex mhw-mulx -+@opindex mno-hw-div -+@opindex mhw-div -+ -+Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of -+instructions by the compiler. The default is to emit @code{mul} -+and not emit @code{div} and @code{mulx}. -+ -+The different combinations of @code{mul} and @code{mulx} instructions -+generate a different multilib options. -+ -+ -+@item -msys-crt0=@var{startfile} -+@opindex msys-crt0 -+ -+@var{startfile} is the file name of the startfile (crt0) to use -+when linking. The default is crt0.o that comes with libgloss -+and is only suitable for use with the instruction set -+simulator. -+ -+@item -msys-lib=@var{systemlib} -+@itemx -msys-lib=nosys -+@opindex msys-lib -+ -+@var{systemlib} is the library name of the library which provides -+the system calls required by the C library, e.g. @code{read}, @code{write} -+etc. The default is to use nosys, this library provides -+stub implementations of the calls and is part of libgloss. -+ -+@end table -+ -+ - @node M680x0 Options - @subsection M680x0 Options - @cindex M680x0 options -diff -durN gcc-3.4.6.orig/gcc/doc/md.texi gcc-3.4.6/gcc/doc/md.texi ---- gcc-3.4.6.orig/gcc/doc/md.texi 2004-11-13 23:31:42.000000000 +0100 -+++ gcc-3.4.6/gcc/doc/md.texi 2007-08-15 23:09:36.000000000 +0200 -@@ -1337,6 +1337,49 @@ - available on some particular machines. - - @table @emph -+ -+@item Altera Nios II family---@file{nios2.h} -+@table @code -+ -+@item I -+Integer that is valid as an immediate operand in an -+instruction taking a signed 16-bit number. Range -+@minus{}32768 to 32767. -+ -+@item J -+Integer that is valid as an immediate operand in an -+instruction taking an unsigned 16-bit number. Range -+0 to 65535. -+ -+@item K -+Integer that is valid as an immediate operand in an -+instruction taking only the upper 16-bits of a -+32-bit number. Range 32-bit numbers with the lower -+16-bits being 0. -+ -+@item L -+Integer that is valid as an immediate operand for a -+shift instruction. Range 0 to 31. -+ -+ -+@item M -+Integer that is valid as an immediate operand for -+only the value 0. Can be used in conjunction with -+the format modifier @code{z} to use @code{r0} -+instead of @code{0} in the assembly output. -+ -+@item N -+Integer that is valid as an immediate operand for -+a custom instruction opcode. Range 0 to 255. -+ -+@item S -+Matches immediates which are addresses in the small -+data section and therefore can be added to @code{gp} -+as a 16-bit immediate to re-create their 32-bit value. -+ -+@end table -+ -+ - @item ARM family---@file{arm.h} - @table @code - @item f -diff -durN gcc-3.4.6.orig/gcc/Makefile.in gcc-3.4.6/gcc/Makefile.in ---- gcc-3.4.6.orig/gcc/Makefile.in 2005-02-24 10:26:59.000000000 +0100 -+++ gcc-3.4.6/gcc/Makefile.in 2007-08-15 23:09:36.000000000 +0200 -@@ -3094,7 +3094,7 @@ - $(INSTALL_DATA) $(srcdir)/README-fixinc \ - $(DESTDIR)$(itoolsdatadir)/include/README ; \ - $(INSTALL_SCRIPT) fixinc.sh $(DESTDIR)$(itoolsdir)/fixinc.sh ; \ -- $(INSTALL_PROGRAM) fixinc/fixincl $(DESTDIR)$(itoolsdir)/fixincl ; \ -+ $(INSTALL_PROGRAM) fixinc/fixincl$(build_exeext) $(DESTDIR)$(itoolsdir)/fixincl$(build_exeext) ; \ - $(INSTALL_DATA) $(srcdir)/gsyslimits.h \ - $(DESTDIR)$(itoolsdatadir)/gsyslimits.h ; \ - else :; fi diff --git a/patches/gcc/3.4.6/910-arm-softfloat.patch b/patches/gcc/3.4.6/910-arm-softfloat.patch deleted file mode 100644 index b0ef614..0000000 --- a/patches/gcc/3.4.6/910-arm-softfloat.patch +++ /dev/null @@ -1,161 +0,0 @@ -diff -durN gcc-3.4.6.orig/gcc/config/arm/coff.h gcc-3.4.6/gcc/config/arm/coff.h ---- gcc-3.4.6.orig/gcc/config/arm/coff.h 2004-02-24 15:25:22.000000000 +0100 -+++ gcc-3.4.6/gcc/config/arm/coff.h 2007-08-15 23:10:54.000000000 +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 -durN gcc-3.4.6.orig/gcc/config/arm/elf.h gcc-3.4.6/gcc/config/arm/elf.h ---- gcc-3.4.6.orig/gcc/config/arm/elf.h 2004-02-24 15:25:22.000000000 +0100 -+++ gcc-3.4.6/gcc/config/arm/elf.h 2007-08-15 23:10:54.000000000 +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 -durN gcc-3.4.6.orig/gcc/config/arm/linux-elf.h gcc-3.4.6/gcc/config/arm/linux-elf.h ---- gcc-3.4.6.orig/gcc/config/arm/linux-elf.h 2007-08-15 23:07:00.000000000 +0200 -+++ gcc-3.4.6/gcc/config/arm/linux-elf.h 2007-08-15 23:10:54.000000000 +0200 -@@ -44,12 +44,26 @@ - #define TARGET_LINKER_EMULATION "armelf_linux" - #endif - --/* Default is to use APCS-32 mode. */ -+/* -+ * Default is to use APCS-32 mode with soft-vfp. -+ * The old Linux default for floats can be achieved with -mhard-float -+ * or with the configure --with-float=hard option. -+ * If -msoft-float or --with-float=soft is used then software float -+ * support will be used just like the default but with the legacy -+ * big endian word ordering for double float representation instead. -+ */ - #undef TARGET_DEFAULT --#define TARGET_DEFAULT \ -- ( ARM_FLAG_APCS_32 | \ -- ARM_FLAG_MMU_TRAPS | \ -- TARGET_ENDIAN_DEFAULT ) -+#define TARGET_DEFAULT \ -+ ( ARM_FLAG_APCS_32 \ -+ | ARM_FLAG_SOFT_FLOAT \ -+ | TARGET_ENDIAN_DEFAULT \ -+ | ARM_FLAG_VFP \ -+ | ARM_FLAG_MMU_TRAPS ) -+ -+#undef SUBTARGET_EXTRA_ASM_SPEC -+#define SUBTARGET_EXTRA_ASM_SPEC "\ -+%{mhard-float:-mfpu=fpa} \ -+%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}" - - #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 - -@@ -57,7 +71,7 @@ - - #undef MULTILIB_DEFAULTS - #define MULTILIB_DEFAULTS \ -- { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" } -+ { "marm", TARGET_ENDIAN_OPTION, "mapcs-32", "mno-thumb-interwork" } - - #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" - -@@ -72,7 +86,7 @@ - %{shared:-lc} \ - %{!shared:%{profile:-lc_p}%{!profile:-lc}}" - --#define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc" -+#define LIBGCC_SPEC "-lgcc" - - /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add - the GNU/Linux magical crtbegin.o file (see crtstuff.c) which -diff -durN gcc-3.4.6.orig/gcc/config/arm/t-linux gcc-3.4.6/gcc/config/arm/t-linux ---- gcc-3.4.6.orig/gcc/config/arm/t-linux 2003-09-20 23:09:07.000000000 +0200 -+++ gcc-3.4.6/gcc/config/arm/t-linux 2007-08-15 23:10:54.000000000 +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 -durN gcc-3.4.6.orig/gcc/config/arm/unknown-elf.h gcc-3.4.6/gcc/config/arm/unknown-elf.h ---- gcc-3.4.6.orig/gcc/config/arm/unknown-elf.h 2004-02-24 15:25:22.000000000 +0100 -+++ gcc-3.4.6/gcc/config/arm/unknown-elf.h 2007-08-15 23:10:54.000000000 +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 -durN gcc-3.4.6.orig/gcc/config/arm/xscale-elf.h gcc-3.4.6/gcc/config/arm/xscale-elf.h ---- gcc-3.4.6.orig/gcc/config/arm/xscale-elf.h 2003-07-02 01:26:43.000000000 +0200 -+++ gcc-3.4.6/gcc/config/arm/xscale-elf.h 2007-08-15 23:10:54.000000000 +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/patches/gcc/4.0.3/110-uclibc-locale.patch b/patches/gcc/4.0.3/110-uclibc-locale.patch new file mode 100644 index 0000000..ac4cf97 --- /dev/null +++ b/patches/gcc/4.0.3/110-uclibc-locale.patch @@ -0,0 +1,3237 @@ +diff -urN gcc-4.0.0-100/libstdc++-v3/acinclude.m4 gcc-4.0.0/libstdc++-v3/acinclude.m4 +--- gcc-4.0.0-100/libstdc++-v3/acinclude.m4 2005-04-30 13:06:53.000000000 -0500 ++++ gcc-4.0.0/libstdc++-v3/acinclude.m4 2005-04-28 20:19:01.000000000 -0500 +@@ -1104,7 +1104,7 @@ + AC_MSG_CHECKING([for C locale to use]) + GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], + [use MODEL for target locale package], +- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto]) ++ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto]) + + # If they didn't use this option switch, or if they specified --enable + # with no specific model, we'll have to look for one. If they +@@ -1120,6 +1120,9 @@ + # Default to "generic". + if test $enable_clocale_flag = auto; then + case ${target_os} in ++ *-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) + AC_EGREP_CPP([_GLIBCXX_ok], [ + #include +@@ -1263,6 +1266,40 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ AC_MSG_RESULT(uclibc) ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ AC_SUBST(glibcxx_MOFILES) ++ AC_SUBST(glibcxx_POFILES) ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,59 @@ ++// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*- ++ ++// Copyright (C) 2002, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// Written by Jakub Jelinek ++ ++#include ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning clean this up ++#endif ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ ++extern "C" __typeof(iswctype_l) __iswctype_l; ++extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l; ++extern "C" __typeof(strcoll_l) __strcoll_l; ++extern "C" __typeof(strftime_l) __strftime_l; ++extern "C" __typeof(strtod_l) __strtod_l; ++extern "C" __typeof(strtof_l) __strtof_l; ++extern "C" __typeof(strtold_l) __strtold_l; ++extern "C" __typeof(strxfrm_l) __strxfrm_l; ++extern "C" __typeof(towlower_l) __towlower_l; ++extern "C" __typeof(towupper_l) __towupper_l; ++extern "C" __typeof(wcscoll_l) __wcscoll_l; ++extern "C" __typeof(wcsftime_l) __wcsftime_l; ++extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l; ++extern "C" __typeof(wctype_l) __wctype_l; ++extern "C" __typeof(newlocale) __newlocale; ++extern "C" __typeof(freelocale) __freelocale; ++extern "C" __typeof(duplocale) __duplocale; ++extern "C" __typeof(uselocale) __uselocale; ++ ++#endif // GLIBC 2.3 and later +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,160 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik ++ ++#include // For errno ++#include ++#include ++#include ++#include ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __strtol_l(S, E, B, L) strtol((S), (E), (B)) ++#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B)) ++#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B)) ++#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B)) ++#define __strtof_l(S, E, L) strtof((S), (E)) ++#define __strtod_l(S, E, L) strtod((S), (E)) ++#define __strtold_l(S, E, L) strtold((S), (E)) ++#warning should dummy __newlocale check for C|POSIX ? ++#define __newlocale(a, b, c) NULL ++#define __freelocale(a) ((void)0) ++#define __duplocale(a) __c_locale() ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ float __f = __strtof_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __f; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ double __d = __strtod_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __d; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ long double __ld = __strtold_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __ld; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ void ++ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, ++ __c_locale __old) ++ { ++ __cloc = __newlocale(1 << LC_ALL, __s, __old); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ if (!__cloc) ++ { ++ // This named locale is not supported by the underlying OS. ++ __throw_runtime_error(__N("locale::facet::_S_create_c_locale " ++ "name not valid")); ++ } ++#endif ++ } ++ ++ void ++ locale::facet::_S_destroy_c_locale(__c_locale& __cloc) ++ { ++ if (_S_get_c_locale() != __cloc) ++ __freelocale(__cloc); ++ } ++ ++ __c_locale ++ locale::facet::_S_clone_c_locale(__c_locale& __cloc) ++ { return __duplocale(__cloc); } ++} // namespace std ++ ++namespace __gnu_cxx ++{ ++ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] = ++ { ++ "LC_CTYPE", ++ "LC_NUMERIC", ++ "LC_TIME", ++ "LC_COLLATE", ++ "LC_MONETARY", ++ "LC_MESSAGES", ++#if _GLIBCXX_NUM_CATEGORIES != 0 ++ "LC_PAPER", ++ "LC_NAME", ++ "LC_ADDRESS", ++ "LC_TELEPHONE", ++ "LC_MEASUREMENT", ++ "LC_IDENTIFICATION" ++#endif ++ }; ++} ++ ++namespace std ++{ ++ const char* const* const locale::_S_categories = __gnu_cxx::category_names; ++} // namespace std +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.h 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,115 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik ++ ++#ifndef _C_LOCALE_H ++#define _C_LOCALE_H 1 ++ ++#pragma GCC system_header ++ ++#include // get std::strlen ++#include // get std::snprintf or std::sprintf ++#include ++#include // For codecvt ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC_HAS_LOCALE__ ++#include // For codecvt using iconv, iconv_t ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#include // 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 ++ int ++ __convert_from_v(char* __out, const int __size, const char* __fmt, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ _Tv __v, const __c_locale& __cloc, int __prec) ++ { ++ __c_locale __old = __gnu_cxx::__uselocale(__cloc); ++#else ++ _Tv __v, const __c_locale&, int __prec) ++ { ++# ifdef __UCLIBC_HAS_LOCALE__ ++ char* __old = std::setlocale(LC_ALL, NULL); ++ char* __sav = new char[std::strlen(__old) + 1]; ++ std::strcpy(__sav, __old); ++ std::setlocale(LC_ALL, "C"); ++# endif ++#endif ++ ++ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __gnu_cxx::__uselocale(__old); ++#elif defined __UCLIBC_HAS_LOCALE__ ++ std::setlocale(LC_ALL, __sav); ++ delete [] __sav; ++#endif ++ return __ret; ++ } ++} ++ ++#endif +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,306 @@ ++// std::codecvt implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.5 - Template class codecvt ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++namespace std ++{ ++ // Specializations. ++#ifdef _GLIBCXX_USE_WCHAR_T ++ codecvt_base::result ++ codecvt:: ++ 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(-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(__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:: ++ 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(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(-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(-1) ++ || __conv == static_cast(-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:: ++ 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:: ++ 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:: ++ 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(__builtin_alloca(sizeof(wchar_t) ++ * __max)); ++ while (__from < __end && __max) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast(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(-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(-1) ++ || __conv == static_cast(-2)) ++ break; ++ } ++ __state = __tmp_state; ++ __ret += __from - __tmp_from; ++ break; ++ } ++ if (!__from) ++ __from = __from_chunk_end; ++ ++ __ret += __from - __tmp_from; ++ __max -= __conv; ++ ++ if (__from < __end && __max) ++ { ++ // XXX Probably wrong for stateful encodings ++ __tmp_state = __state; ++ ++__from; ++ ++__ret; ++ --__max; ++ } ++ } ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ return __ret; ++ } ++#endif ++} +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/collate_members.cc +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/collate_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/collate_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,80 @@ ++// std::collate implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.4.1.2 collate virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++#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::_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::_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::_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::_M_transform(wchar_t* __to, const wchar_t* __from, ++ size_t __n) const ++ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); } ++#endif ++} +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,300 @@ ++// std::ctype implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions. ++// ++ ++// Written by Benjamin Kosnik ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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 specializations are in src/locale.cc and ++ // various /config/os/* files. ++ template<> ++ ctype_byname::ctype_byname(const char* __s, size_t __refs) ++ : ctype(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::__wmask_type ++ ctype::_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::do_toupper(wchar_t __c) const ++ { return __towupper_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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::do_tolower(wchar_t __c) const ++ { return __towlower_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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:: ++ 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:: ++ 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:: ++ 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:: ++ 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:: ++ do_widen(char __c) const ++ { return _M_widen[static_cast(__c)]; } ++ ++ const char* ++ ctype:: ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const ++ { ++ while (__lo < __hi) ++ { ++ *__dest = _M_widen[static_cast(*__lo)]; ++ ++__lo; ++ ++__dest; ++ } ++ return __hi; ++ } ++ ++ char ++ ctype:: ++ 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(__c)); ++ } ++ ++ const wchar_t* ++ ctype:: ++ 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(__c)); ++ } ++ ++__lo; ++ ++__dest; ++ } ++ else ++ while (__lo < __hi) ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast(__c)); ++ ++__lo; ++ ++__dest; ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __hi; ++ } ++ ++ void ++ ctype::_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(__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(_ISbit(__k)); ++ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]); ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ } ++#endif // _GLIBCXX_USE_WCHAR_T ++} +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.cc +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,100 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++#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::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(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::do_get(catalog, int, int, const wstring& __dfault) const ++ { ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ __uselocale(__old); ++ return _M_convert_from_char(__msg); ++# elif defined __UCLIBC_HAS_LOCALE__ ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ setlocale(LC_ALL, __old); ++ free(__old); ++ return _M_convert_from_char(__msg); ++# else ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ return _M_convert_from_char(__msg); ++# endif ++ } ++#endif ++} +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,118 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#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 ++ messages<_CharT>::messages(size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), ++ _M_name_messages(_S_get_c_name()) ++ { } ++ ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::open(const basic_string& __s, const locale& __loc, ++ const char* __dir) const ++ { ++ __bindtextdomain(__s.c_str(), __dir); ++ return this->do_open(__s, __loc); ++ } ++ ++ // Virtual member functions. ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::do_open(const basic_string& __s, ++ const locale&) const ++ { ++ // No error checking is done, assume the catalog exists and can ++ // be used. ++ __textdomain(__s.c_str()); ++ return 0; ++ } ++ ++ template ++ void ++ messages<_CharT>::do_close(catalog) const ++ { } ++ ++ // messages_byname ++ template ++ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) ++ : messages<_CharT>(__refs) ++ { ++ if (this->_M_name_messages != locale::facet::_S_get_c_name()) ++ delete [] this->_M_name_messages; ++ char* __tmp = new char[std::strlen(__s) + 1]; ++ std::strcpy(__tmp, __s); ++ this->_M_name_messages = __tmp; ++ ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ++ { ++ this->_S_destroy_c_locale(this->_M_c_locale_messages); ++ this->_S_create_c_locale(this->_M_c_locale_messages, __s); ++ } ++ } +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2005-04-28 01:23:02.000000000 -0500 +@@ -0,0 +1,692 @@ ++// std::moneypunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning optimize this for uclibc ++#warning tailor for stub locale support ++#endif ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ // Construct and return valid pattern consisting of some combination of: ++ // space none symbol sign value ++ money_base::pattern ++ money_base::_S_construct_pattern(char __precedes, char __space, char __posn) ++ { ++ pattern __ret; ++ ++ // This insanely complicated routine attempts to construct a valid ++ // pattern for use with monyepunct. A couple of invariants: ++ ++ // if (__precedes) symbol -> value ++ // else value -> symbol ++ ++ // if (__space) space ++ // else none ++ ++ // none == never first ++ // space never first or last ++ ++ // Any elegant implementations of this are welcome. ++ switch (__posn) ++ { ++ case 0: ++ case 1: ++ // 1 The sign precedes the value and symbol. ++ __ret.field[0] = sign; ++ if (__space) ++ { ++ // Pattern starts with sign. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[3] = symbol; ++ } ++ __ret.field[2] = space; ++ } ++ else ++ { ++ // Pattern starts with sign and ends with none. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[3] = none; ++ } ++ break; ++ case 2: ++ // 2 The sign follows the value and symbol. ++ if (__space) ++ { ++ // Pattern either ends with sign. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[1] = space; ++ __ret.field[3] = sign; ++ } ++ else ++ { ++ // Pattern ends with sign then none. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[1] = symbol; ++ } ++ __ret.field[2] = sign; ++ __ret.field[3] = none; ++ } ++ break; ++ case 3: ++ // 3 The sign immediately precedes the symbol. ++ if (__precedes) ++ { ++ __ret.field[0] = sign; ++ __ret.field[1] = symbol; ++ if (__space) ++ { ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[2] = value; ++ __ret.field[3] = none; ++ } ++ } ++ else ++ { ++ __ret.field[0] = value; ++ if (__space) ++ { ++ __ret.field[1] = space; ++ __ret.field[2] = sign; ++ __ret.field[3] = symbol; ++ } ++ else ++ { ++ __ret.field[1] = sign; ++ __ret.field[2] = symbol; ++ __ret.field[3] = none; ++ } ++ } ++ break; ++ case 4: ++ // 4 The sign immediately follows the symbol. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = sign; ++ if (__space) ++ { ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[2] = value; ++ __ret.field[3] = none; ++ } ++ } ++ else ++ { ++ __ret.field[0] = value; ++ if (__space) ++ { ++ __ret.field[1] = space; ++ __ret.field[2] = symbol; ++ __ret.field[3] = sign; ++ } ++ else ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = sign; ++ __ret.field[3] = none; ++ } ++ } ++ break; ++ default: ++ __ret = pattern(); ++ } ++ return __ret; ++ } ++ ++ template<> ++ void ++ moneypunct::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::~moneypunct() ++ { delete _M_data; } ++ ++ template<> ++ moneypunct::~moneypunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ moneypunct::_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; ++ ++ 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(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::_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; ++ ++ 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(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::~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::~moneypunct() ++ { ++ if (_M_data->_M_positive_sign_size) ++ delete [] _M_data->_M_positive_sign; ++ if (_M_data->_M_negative_sign_size ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0) ++ delete [] _M_data->_M_negative_sign; ++ if (_M_data->_M_curr_symbol_size) ++ delete [] _M_data->_M_curr_symbol; ++ delete _M_data; ++ } ++#endif ++} +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2005-04-28 01:20:20.000000000 -0500 +@@ -0,0 +1,173 @@ ++// std::numpunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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::~numpunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ numpunct::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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(__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(__num_base::_S_atoms_in[__j]); ++ } ++ else ++ { ++ // Named locale. ++ // NB: In the GNU model wchar_t is always 32 bit wide. ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# else ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ ++ if (_M_data->_M_thousands_sep == L'\0') ++ _M_data->_M_grouping = ""; ++ else ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ } ++ ++ // NB: There is no way to extact this info from posix locales. ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); ++ _M_data->_M_truename = L"true"; ++ _M_data->_M_truename_size = 4; ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); ++ _M_data->_M_falsename = L"false"; ++ _M_data->_M_falsename_size = 5; ++ } ++ ++ template<> ++ numpunct::~numpunct() ++ { delete _M_data; } ++ #endif ++} +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.cc +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,406 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++#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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++ 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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++#warning wide time stuff ++// if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = L"%m/%d/%y"; ++ _M_data->_M_date_era_format = L"%m/%d/%y"; ++ _M_data->_M_time_format = L"%H:%M:%S"; ++ _M_data->_M_time_era_format = L"%H:%M:%S"; ++ _M_data->_M_date_time_format = L""; ++ _M_data->_M_date_time_era_format = L""; ++ _M_data->_M_am = L"AM"; ++ _M_data->_M_pm = L"PM"; ++ _M_data->_M_am_pm_format = L""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = L"Sunday"; ++ _M_data->_M_day2 = L"Monday"; ++ _M_data->_M_day3 = L"Tuesday"; ++ _M_data->_M_day4 = L"Wednesday"; ++ _M_data->_M_day5 = L"Thursday"; ++ _M_data->_M_day6 = L"Friday"; ++ _M_data->_M_day7 = L"Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = L"Sun"; ++ _M_data->_M_aday2 = L"Mon"; ++ _M_data->_M_aday3 = L"Tue"; ++ _M_data->_M_aday4 = L"Wed"; ++ _M_data->_M_aday5 = L"Thu"; ++ _M_data->_M_aday6 = L"Fri"; ++ _M_data->_M_aday7 = L"Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = L"January"; ++ _M_data->_M_month02 = L"February"; ++ _M_data->_M_month03 = L"March"; ++ _M_data->_M_month04 = L"April"; ++ _M_data->_M_month05 = L"May"; ++ _M_data->_M_month06 = L"June"; ++ _M_data->_M_month07 = L"July"; ++ _M_data->_M_month08 = L"August"; ++ _M_data->_M_month09 = L"September"; ++ _M_data->_M_month10 = L"October"; ++ _M_data->_M_month11 = L"November"; ++ _M_data->_M_month12 = L"December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = L"Jan"; ++ _M_data->_M_amonth02 = L"Feb"; ++ _M_data->_M_amonth03 = L"Mar"; ++ _M_data->_M_amonth04 = L"Apr"; ++ _M_data->_M_amonth05 = L"May"; ++ _M_data->_M_amonth06 = L"Jun"; ++ _M_data->_M_amonth07 = L"Jul"; ++ _M_data->_M_amonth08 = L"Aug"; ++ _M_data->_M_amonth09 = L"Sep"; ++ _M_data->_M_amonth10 = L"Oct"; ++ _M_data->_M_amonth11 = L"Nov"; ++ _M_data->_M_amonth12 = L"Dec"; ++ } ++#if 0 ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ union { char *__s; wchar_t *__w; } __u; ++ ++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); ++ _M_data->_M_date_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); ++ _M_data->_M_date_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); ++ _M_data->_M_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); ++ _M_data->_M_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); ++ _M_data->_M_date_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); ++ _M_data->_M_date_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); ++ _M_data->_M_am = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); ++ _M_data->_M_pm = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); ++ _M_data->_M_am_pm_format = __u.__w; ++ ++ // Day names, starting with "C"'s Sunday. ++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); ++ _M_data->_M_day1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); ++ _M_data->_M_day2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); ++ _M_data->_M_day3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); ++ _M_data->_M_day4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); ++ _M_data->_M_day5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); ++ _M_data->_M_day6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); ++ _M_data->_M_day7 = __u.__w; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); ++ _M_data->_M_aday1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); ++ _M_data->_M_aday2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); ++ _M_data->_M_aday3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); ++ _M_data->_M_aday4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); ++ _M_data->_M_aday5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); ++ _M_data->_M_aday6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); ++ _M_data->_M_aday7 = __u.__w; ++ ++ // Month names, starting with "C"'s January. ++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); ++ _M_data->_M_month01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); ++ _M_data->_M_month02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); ++ _M_data->_M_month03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); ++ _M_data->_M_month04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); ++ _M_data->_M_month05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); ++ _M_data->_M_month06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); ++ _M_data->_M_month07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); ++ _M_data->_M_month08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); ++ _M_data->_M_month09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); ++ _M_data->_M_month10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); ++ _M_data->_M_month11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); ++ _M_data->_M_month12 = __u.__w; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); ++ _M_data->_M_amonth01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); ++ _M_data->_M_amonth02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); ++ _M_data->_M_amonth03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); ++ _M_data->_M_amonth04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); ++ _M_data->_M_amonth05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); ++ _M_data->_M_amonth06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); ++ _M_data->_M_amonth07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); ++ _M_data->_M_amonth08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); ++ _M_data->_M_amonth09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); ++ _M_data->_M_amonth10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); ++ _M_data->_M_amonth11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); ++ _M_data->_M_amonth12 = __u.__w; ++ } ++#endif // 0 ++ } ++#endif ++} +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.h 2004-05-22 18:46:31.000000000 -0500 +@@ -0,0 +1,68 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put functions ++// ++ ++// Written by Benjamin Kosnik ++ ++ template ++ __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 ++ __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 ++ __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 ++ __timepunct<_CharT>::~__timepunct() ++ { ++ if (_M_name_timepunct != _S_get_c_name()) ++ delete [] _M_name_timepunct; ++ delete _M_data; ++ _S_destroy_c_locale(_M_c_locale_timepunct); ++ } +diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_base.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_base.h +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_base.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_base.h 2005-04-28 01:10:27.000000000 -0500 +@@ -0,0 +1,64 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++/** @file ctype_base.h ++ * This is an internal header file, included by other library headers. ++ * You should not attempt to use it directly. ++ */ ++ ++// Information as gleaned from /usr/include/ctype.h ++ ++ /// @brief Base class for ctype. ++ struct ctype_base ++ { ++ // Note: In uClibc, the following two types depend on configuration. ++ ++ // Non-standard typedefs. ++ typedef const __ctype_touplow_t* __to_type; ++ ++ // NB: Offsets into ctype::_M_table force a particular size ++ // on the mask type. Because of this, we don't use an enum. ++ typedef __ctype_mask_t mask; ++ static const mask upper = _ISupper; ++ static const mask lower = _ISlower; ++ static const mask alpha = _ISalpha; ++ static const mask digit = _ISdigit; ++ static const mask xdigit = _ISxdigit; ++ static const mask space = _ISspace; ++ static const mask print = _ISprint; ++ static const mask graph = _ISalpha | _ISdigit | _ISpunct; ++ static const mask cntrl = _IScntrl; ++ static const mask punct = _ISpunct; ++ static const mask alnum = _ISalpha | _ISdigit; ++ }; +diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_inline.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_inline.h +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_inline.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_inline.h 2002-06-24 00:49:19.000000000 -0500 +@@ -0,0 +1,69 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 2000, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) ++// functions go in ctype.cc ++ ++ bool ++ ctype:: ++ is(mask __m, char __c) const ++ { return _M_table[static_cast(__c)] & __m; } ++ ++ const char* ++ ctype:: ++ is(const char* __low, const char* __high, mask* __vec) const ++ { ++ while (__low < __high) ++ *__vec++ = _M_table[static_cast(*__low++)]; ++ return __high; ++ } ++ ++ const char* ++ ctype:: ++ scan_is(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && !(_M_table[static_cast(*__low)] & __m)) ++ ++__low; ++ return __low; ++ } ++ ++ const char* ++ ctype:: ++ scan_not(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && (_M_table[static_cast(*__low)] & __m) != 0) ++ ++__low; ++ return __low; ++ } +diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_noninline.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2005-04-28 01:10:27.000000000 -0500 +@@ -0,0 +1,92 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// Information as gleaned from /usr/include/ctype.h ++ ++ const ctype_base::mask* ++ ctype::classic_table() throw() ++ { return __C_ctype_b; } ++ ++ ctype::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::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::do_toupper(char __c) const ++ { return _M_toupper[static_cast(__c)]; } ++ ++ const char* ++ ctype::do_toupper(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_toupper[static_cast(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } ++ ++ char ++ ctype::do_tolower(char __c) const ++ { return _M_tolower[static_cast(__c)]; } ++ ++ const char* ++ ctype::do_tolower(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_tolower[static_cast(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } +diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/os_defines.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/os_defines.h +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/os_defines.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/os_defines.h 2005-04-28 01:10:27.000000000 -0500 +@@ -0,0 +1,44 @@ ++// Specific definitions for GNU/Linux -*- C++ -*- ++ ++// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++#ifndef _GLIBCXX_OS_DEFINES ++#define _GLIBCXX_OS_DEFINES 1 ++ ++// System-specific #define, typedefs, corrections, etc, go here. This ++// file will come before all others. ++ ++// This keeps isanum, et al from being propagated as macros. ++#define __NO_CTYPE 1 ++ ++#include ++ ++// We must not see the optimized string functions GNU libc defines. ++#define __NO_STRING_INLINES ++ ++#endif +diff -urN gcc-4.0.0-100/libstdc++-v3/configure gcc-4.0.0/libstdc++-v3/configure +--- gcc-4.0.0-100/libstdc++-v3/configure 2005-04-30 13:06:53.683055232 -0500 ++++ gcc-4.0.0/libstdc++-v3/configure 2005-04-30 12:24:24.000000000 -0500 +@@ -3998,6 +3998,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +@@ -5672,7 +5677,7 @@ + enableval="$enable_clocale" + + case "$enableval" in +- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;; ++ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;; + *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5 + echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;} + { (exit 1); exit 1; }; } ;; +@@ -5697,6 +5702,9 @@ + # Default to "generic". + if test $enable_clocale_flag = auto; then + case ${target_os} in ++ linux-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ +@@ -5927,6 +5935,76 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ echo "$as_me:$LINENO: result: uclibc" >&5 ++echo "${ECHO_T}uclibc" >&6 ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ # Extract the first word of "msgfmt", so it can be a program name with args. ++set dummy msgfmt; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test -n "$check_msgfmt"; then ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_check_msgfmt="yes" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" ++fi ++fi ++check_msgfmt=$ac_cv_prog_check_msgfmt ++if test -n "$check_msgfmt"; then ++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 ++echo "${ECHO_T}$check_msgfmt" >&6 ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ ++ ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -urN gcc-4.0.0-100/libstdc++-v3/configure.host gcc-4.0.0/libstdc++-v3/configure.host +--- gcc-4.0.0-100/libstdc++-v3/configure.host 2005-04-30 13:06:53.688054472 -0500 ++++ gcc-4.0.0/libstdc++-v3/configure.host 2005-04-28 20:20:32.000000000 -0500 +@@ -249,6 +249,12 @@ + ;; + esac + ++# Override for uClibc since linux-uclibc gets mishandled above. ++case "${host_os}" in ++ *-uclibc*) ++ os_include_dir="os/uclibc" ++ ;; ++esac + + # Set any OS-dependent and CPU-dependent bits. + # THIS TABLE IS SORTED. KEEP IT THAT WAY. +diff -urN gcc-4.0.0-100/libstdc++-v3/crossconfig.m4 gcc-4.0.0/libstdc++-v3/crossconfig.m4 +--- gcc-4.0.0-100/libstdc++-v3/crossconfig.m4 2005-04-30 13:06:53.689054320 -0500 ++++ gcc-4.0.0/libstdc++-v3/crossconfig.m4 2005-04-28 20:27:15.000000000 -0500 +@@ -142,6 +142,98 @@ + ;; + esac + ;; ++ *-uclibc*) ++# Temporary hack until we implement the float versions of the libm funcs ++ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ ++ machine/endian.h machine/param.h sys/machine.h sys/types.h \ ++ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h]) ++ SECTION_FLAGS='-ffunction-sections -fdata-sections' ++ AC_SUBST(SECTION_FLAGS) ++ GLIBCXX_CHECK_LINKER_FEATURES ++ GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT ++ GLIBCXX_CHECK_WCHAR_T_SUPPORT ++ ++ # For LFS. ++ AC_DEFINE(HAVE_INT64_T) ++ case "$target" in ++ *-uclinux*) ++ # Don't enable LFS with uClinux ++ ;; ++ *) ++ AC_DEFINE(_GLIBCXX_USE_LFS) ++ esac ++ ++ # For showmanyc_helper(). ++ AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) ++ GLIBCXX_CHECK_POLL ++ GLIBCXX_CHECK_S_ISREG_OR_S_IFREG ++ ++ # For xsputn_2(). ++ AC_CHECK_HEADERS(sys/uio.h) ++ GLIBCXX_CHECK_WRITEV ++ ++# AC_DEFINE(HAVE_ACOSF) ++# AC_DEFINE(HAVE_ASINF) ++# AC_DEFINE(HAVE_ATANF) ++# AC_DEFINE(HAVE_ATAN2F) ++ AC_DEFINE(HAVE_CEILF) ++ AC_DEFINE(HAVE_COPYSIGN) ++# AC_DEFINE(HAVE_COPYSIGNF) ++# AC_DEFINE(HAVE_COSF) ++# AC_DEFINE(HAVE_COSHF) ++# AC_DEFINE(HAVE_EXPF) ++# AC_DEFINE(HAVE_FABSF) ++ AC_DEFINE(HAVE_FINITE) ++ AC_DEFINE(HAVE_FINITEF) ++ AC_DEFINE(HAVE_FLOORF) ++# AC_DEFINE(HAVE_FMODF) ++# AC_DEFINE(HAVE_FREXPF) ++ AC_DEFINE(HAVE_HYPOT) ++# AC_DEFINE(HAVE_HYPOTF) ++ AC_DEFINE(HAVE_ISINF) ++ AC_DEFINE(HAVE_ISINFF) ++ AC_DEFINE(HAVE_ISNAN) ++ AC_DEFINE(HAVE_ISNANF) ++# AC_DEFINE(HAVE_LOGF) ++# AC_DEFINE(HAVE_LOG10F) ++# AC_DEFINE(HAVE_MODFF) ++# AC_DEFINE(HAVE_SINF) ++# AC_DEFINE(HAVE_SINHF) ++# AC_DEFINE(HAVE_SINCOS) ++# AC_DEFINE(HAVE_SINCOSF) ++ AC_DEFINE(HAVE_SQRTF) ++# AC_DEFINE(HAVE_TANF) ++# AC_DEFINE(HAVE_TANHF) ++ if test x"long_double_math_on_this_cpu" = x"yes"; then ++# AC_DEFINE(HAVE_ACOSL) ++# AC_DEFINE(HAVE_ASINL) ++# AC_DEFINE(HAVE_ATANL) ++# AC_DEFINE(HAVE_ATAN2L) ++# AC_DEFINE(HAVE_CEILL) ++# AC_DEFINE(HAVE_COPYSIGNL) ++# AC_DEFINE(HAVE_COSL) ++# AC_DEFINE(HAVE_COSHL) ++# AC_DEFINE(HAVE_EXPL) ++# AC_DEFINE(HAVE_FABSL) ++# AC_DEFINE(HAVE_FINITEL) ++# AC_DEFINE(HAVE_FLOORL) ++# AC_DEFINE(HAVE_FMODL) ++# AC_DEFINE(HAVE_FREXPL) ++# AC_DEFINE(HAVE_HYPOTL) ++# AC_DEFINE(HAVE_ISINFL) ++# AC_DEFINE(HAVE_ISNANL) ++# AC_DEFINE(HAVE_LOGL) ++# AC_DEFINE(HAVE_LOG10L) ++# AC_DEFINE(HAVE_MODFL) ++# AC_DEFINE(HAVE_POWL) ++# AC_DEFINE(HAVE_SINL) ++# AC_DEFINE(HAVE_SINHL) ++# AC_DEFINE(HAVE_SINCOSL) ++# AC_DEFINE(HAVE_SQRTL) ++# AC_DEFINE(HAVE_TANL) ++# AC_DEFINE(HAVE_TANHL) ++ fi ++ ;; + *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu) + AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ + machine/endian.h machine/param.h sys/machine.h sys/types.h \ +@@ -156,7 +248,7 @@ + AC_DEFINE(HAVE_INT64_T) + case "$target" in + *-uclinux*) +- # Don't enable LFS with uClibc ++ # Don't enable LFS with uClinux + ;; + *) + AC_DEFINE(_GLIBCXX_USE_LFS) +diff -urN gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h +--- gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h 2005-04-30 13:06:53.690054168 -0500 ++++ gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h 2005-04-28 20:15:56.000000000 -0500 +@@ -101,7 +101,9 @@ + using std::wmemcpy; + using std::wmemmove; + using std::wmemset; ++#if _GLIBCXX_HAVE_WCSFTIME + using std::wcsftime; ++#endif + + #if _GLIBCXX_USE_C99 + using std::wcstold; +diff -urN gcc-4.0.0-100/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.0.0/libstdc++-v3/include/c_std/std_cwchar.h +--- gcc-4.0.0-100/libstdc++-v3/include/c_std/std_cwchar.h 2005-04-30 13:06:53.691054016 -0500 ++++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cwchar.h 2005-04-28 20:15:56.000000000 -0500 +@@ -179,7 +179,9 @@ + using ::wcscoll; + using ::wcscpy; + using ::wcscspn; ++#if _GLIBCXX_HAVE_WCSFTIME + using ::wcsftime; ++#endif + using ::wcslen; + using ::wcsncat; + using ::wcsncmp; diff --git a/patches/gcc/4.0.3/120-libstdc++-pic.patch b/patches/gcc/4.0.3/120-libstdc++-pic.patch new file mode 100644 index 0000000..a9d6e71 --- /dev/null +++ b/patches/gcc/4.0.3/120-libstdc++-pic.patch @@ -0,0 +1,45 @@ +--- gcc-4.0.0/libstdc++-v3/src/Makefile.am ++++ gcc-4.0.0/libstdc++-v3/src/Makefile.am +@@ -214,6 +214,10 @@ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ + + ++install-exec-local: ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++ + # Added bits to build debug library. + if GLIBCXX_BUILD_DEBUG + all-local: build_debug +--- gcc-4.0.0/libstdc++-v3/src/Makefile.in ++++ gcc-4.0.0/libstdc++-v3/src/Makefile.in +@@ -625,7 +625,7 @@ + + install-data-am: install-data-local + +-install-exec-am: install-toolexeclibLTLIBRARIES ++install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local + + install-info: install-info-am + +@@ -664,7 +664,7 @@ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ +- uninstall-toolexeclibLTLIBRARIES ++ uninstall-toolexeclibLTLIBRARIES install-exec-local + + @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP) + @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver +@@ -743,6 +743,11 @@ + install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ++ ++install-exec-local: ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff --git a/patches/gcc/4.0.3/130-missing-execinfo_h.patch b/patches/gcc/4.0.3/130-missing-execinfo_h.patch new file mode 100644 index 0000000..0e2092f --- /dev/null +++ b/patches/gcc/4.0.3/130-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 + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/patches/gcc/4.0.3/140-c99-snprintf.patch b/patches/gcc/4.0.3/140-c99-snprintf.patch new file mode 100644 index 0000000..dfb22d6 --- /dev/null +++ b/patches/gcc/4.0.3/140-c99-snprintf.patch @@ -0,0 +1,11 @@ +--- gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h-orig 2005-04-29 00:08:41.000000000 -0500 ++++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h 2005-04-29 00:08:45.000000000 -0500 +@@ -142,7 +142,7 @@ + using ::vsprintf; + } + +-#if _GLIBCXX_USE_C99 ++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf diff --git a/patches/gcc/4.0.3/150-c99-complex-ugly-hack.patch b/patches/gcc/4.0.3/150-c99-complex-ugly-hack.patch new file mode 100644 index 0000000..2ccc80d --- /dev/null +++ b/patches/gcc/4.0.3/150-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 ++#ifdef __UCLIBC__ ++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs ++#endif + int + main () + { diff --git a/patches/gcc/4.0.3/160-index_macro.patch b/patches/gcc/4.0.3/160-index_macro.patch new file mode 100644 index 0000000..1fac112 --- /dev/null +++ b/patches/gcc/4.0.3/160-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 + #include + ++/* 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 // For uninitialized_copy_n + #include // For power + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + namespace __gnu_cxx + { + using std::size_t; diff --git a/patches/gcc/4.0.3/170-sdk-libstdc++-includes.patch b/patches/gcc/4.0.3/170-sdk-libstdc++-includes.patch new file mode 100644 index 0000000..c7676ae --- /dev/null +++ b/patches/gcc/4.0.3/170-sdk-libstdc++-includes.patch @@ -0,0 +1,22 @@ +diff -urN gcc-4.0.0-100/libstdc++-v3/fragment.am gcc-4.0.0/libstdc++-v3/fragment.am +--- gcc-4.0.0-100/libstdc++-v3/fragment.am 2004-10-25 15:32:40.000000000 -0500 ++++ gcc-4.0.0/libstdc++-v3/fragment.am 2005-04-28 21:48:43.000000000 -0500 +@@ -18,5 +18,5 @@ + $(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once + + # -I/-D flags to pass when compiling. +-AM_CPPFLAGS = $(GLIBCXX_INCLUDES) ++AM_CPPFLAGS = $(GLIBCXX_INCLUDES) -I$(toplevel_srcdir)/include + +diff -urN gcc-4.0.0-100/libstdc++-v3/libmath/Makefile.am gcc-4.0.0/libstdc++-v3/libmath/Makefile.am +--- gcc-4.0.0-100/libstdc++-v3/libmath/Makefile.am 2003-08-27 16:29:42.000000000 -0500 ++++ gcc-4.0.0/libstdc++-v3/libmath/Makefile.am 2005-04-28 21:48:43.000000000 -0500 +@@ -32,7 +32,7 @@ + + libmath_la_SOURCES = stubs.c + +-AM_CPPFLAGS = $(CANADIAN_INCLUDES) ++AM_CPPFLAGS = $(CANADIAN_INCLUDES) -I$(toplevel_srcdir)/include + + # Only compiling "C" sources in this directory. + LIBTOOL = @LIBTOOL@ --tag CC diff --git a/patches/gcc/4.0.3/180-arm-bigendian.patch b/patches/gcc/4.0.3/180-arm-bigendian.patch new file mode 100644 index 0000000..307aea3 --- /dev/null +++ b/patches/gcc/4.0.3/180-arm-bigendian.patch @@ -0,0 +1,67 @@ +By Lennert Buytenhek +Adds support for arm*b-linux* big-endian ARM targets + +See http://gcc.gnu.org/PR16350 + +--- gcc-4.0.3/gcc/config/arm/linux-elf.h ++++ gcc-4.0.3/gcc/config/arm/linux-elf.h +@@ -31,19 +31,33 @@ + /* Do not assume anything about header files. */ + #define NO_IMPLICIT_EXTERN_C + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END ++#define TARGET_ENDIAN_OPTION "mbig-endian" ++#define TARGET_LINKER_EMULATION "armelfb_linux" ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#define TARGET_ENDIAN_OPTION "mlittle-endian" ++#define TARGET_LINKER_EMULATION "armelf_linux" ++#endif ++ + #undef TARGET_DEFAULT_FLOAT_ABI + #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD + + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (0) ++#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT) + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" } + + /* The GNU C++ standard library requires that these macros be defined. */ + #undef CPLUSPLUS_CPP_SPEC +@@ -90,7 +104,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #define TARGET_OS_CPP_BUILTINS() \ +--- gcc-4.0.3/gcc/config.gcc ++++ gcc-4.0.3/gcc/config.gcc +@@ -672,6 +672,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h" ++ case $target in ++ arm*b-*) ++ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" ++ ;; ++ esac + tmake_file="${tmake_file} arm/t-arm arm/t-linux" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes diff --git a/patches/gcc/4.0.3/200-uclibc-locale.patch b/patches/gcc/4.0.3/200-uclibc-locale.patch deleted file mode 100644 index ac4cf97..0000000 --- a/patches/gcc/4.0.3/200-uclibc-locale.patch +++ /dev/null @@ -1,3237 +0,0 @@ -diff -urN gcc-4.0.0-100/libstdc++-v3/acinclude.m4 gcc-4.0.0/libstdc++-v3/acinclude.m4 ---- gcc-4.0.0-100/libstdc++-v3/acinclude.m4 2005-04-30 13:06:53.000000000 -0500 -+++ gcc-4.0.0/libstdc++-v3/acinclude.m4 2005-04-28 20:19:01.000000000 -0500 -@@ -1104,7 +1104,7 @@ - AC_MSG_CHECKING([for C locale to use]) - GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], - [use MODEL for target locale package], -- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto]) -+ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto]) - - # If they didn't use this option switch, or if they specified --enable - # with no specific model, we'll have to look for one. If they -@@ -1120,6 +1120,9 @@ - # Default to "generic". - if test $enable_clocale_flag = auto; then - case ${target_os} in -+ *-uclibc*) -+ enable_clocale_flag=uclibc -+ ;; - linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) - AC_EGREP_CPP([_GLIBCXX_ok], [ - #include -@@ -1263,6 +1266,40 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ AC_MSG_RESULT(uclibc) -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ AC_SUBST(glibcxx_MOFILES) -+ AC_SUBST(glibcxx_POFILES) -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2005-04-28 01:13:15.000000000 -0500 -@@ -0,0 +1,59 @@ -+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*- -+ -+// Copyright (C) 2002, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// Written by Jakub Jelinek -+ -+#include -+ -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning clean this up -+#endif -+ -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ -+extern "C" __typeof(iswctype_l) __iswctype_l; -+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l; -+extern "C" __typeof(strcoll_l) __strcoll_l; -+extern "C" __typeof(strftime_l) __strftime_l; -+extern "C" __typeof(strtod_l) __strtod_l; -+extern "C" __typeof(strtof_l) __strtof_l; -+extern "C" __typeof(strtold_l) __strtold_l; -+extern "C" __typeof(strxfrm_l) __strxfrm_l; -+extern "C" __typeof(towlower_l) __towlower_l; -+extern "C" __typeof(towupper_l) __towupper_l; -+extern "C" __typeof(wcscoll_l) __wcscoll_l; -+extern "C" __typeof(wcsftime_l) __wcsftime_l; -+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l; -+extern "C" __typeof(wctype_l) __wctype_l; -+extern "C" __typeof(newlocale) __newlocale; -+extern "C" __typeof(freelocale) __freelocale; -+extern "C" __typeof(duplocale) __duplocale; -+extern "C" __typeof(uselocale) __uselocale; -+ -+#endif // GLIBC 2.3 and later -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.cc 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.cc 2005-04-28 01:13:15.000000000 -0500 -@@ -0,0 +1,160 @@ -+// Wrapper for underlying C-language localization -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.8 Standard locale categories. -+// -+ -+// Written by Benjamin Kosnik -+ -+#include // For errno -+#include -+#include -+#include -+#include -+ -+#ifndef __UCLIBC_HAS_XLOCALE__ -+#define __strtol_l(S, E, B, L) strtol((S), (E), (B)) -+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B)) -+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B)) -+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B)) -+#define __strtof_l(S, E, L) strtof((S), (E)) -+#define __strtod_l(S, E, L) strtod((S), (E)) -+#define __strtold_l(S, E, L) strtold((S), (E)) -+#warning should dummy __newlocale check for C|POSIX ? -+#define __newlocale(a, b, c) NULL -+#define __freelocale(a) ((void)0) -+#define __duplocale(a) __c_locale() -+#endif -+ -+namespace std -+{ -+ template<> -+ void -+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, -+ const __c_locale& __cloc) -+ { -+ if (!(__err & ios_base::failbit)) -+ { -+ char* __sanity; -+ errno = 0; -+ float __f = __strtof_l(__s, &__sanity, __cloc); -+ if (__sanity != __s && errno != ERANGE) -+ __v = __f; -+ else -+ __err |= ios_base::failbit; -+ } -+ } -+ -+ template<> -+ void -+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, -+ const __c_locale& __cloc) -+ { -+ if (!(__err & ios_base::failbit)) -+ { -+ char* __sanity; -+ errno = 0; -+ double __d = __strtod_l(__s, &__sanity, __cloc); -+ if (__sanity != __s && errno != ERANGE) -+ __v = __d; -+ else -+ __err |= ios_base::failbit; -+ } -+ } -+ -+ template<> -+ void -+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err, -+ const __c_locale& __cloc) -+ { -+ if (!(__err & ios_base::failbit)) -+ { -+ char* __sanity; -+ errno = 0; -+ long double __ld = __strtold_l(__s, &__sanity, __cloc); -+ if (__sanity != __s && errno != ERANGE) -+ __v = __ld; -+ else -+ __err |= ios_base::failbit; -+ } -+ } -+ -+ void -+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, -+ __c_locale __old) -+ { -+ __cloc = __newlocale(1 << LC_ALL, __s, __old); -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ if (!__cloc) -+ { -+ // This named locale is not supported by the underlying OS. -+ __throw_runtime_error(__N("locale::facet::_S_create_c_locale " -+ "name not valid")); -+ } -+#endif -+ } -+ -+ void -+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc) -+ { -+ if (_S_get_c_locale() != __cloc) -+ __freelocale(__cloc); -+ } -+ -+ __c_locale -+ locale::facet::_S_clone_c_locale(__c_locale& __cloc) -+ { return __duplocale(__cloc); } -+} // namespace std -+ -+namespace __gnu_cxx -+{ -+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] = -+ { -+ "LC_CTYPE", -+ "LC_NUMERIC", -+ "LC_TIME", -+ "LC_COLLATE", -+ "LC_MONETARY", -+ "LC_MESSAGES", -+#if _GLIBCXX_NUM_CATEGORIES != 0 -+ "LC_PAPER", -+ "LC_NAME", -+ "LC_ADDRESS", -+ "LC_TELEPHONE", -+ "LC_MEASUREMENT", -+ "LC_IDENTIFICATION" -+#endif -+ }; -+} -+ -+namespace std -+{ -+ const char* const* const locale::_S_categories = __gnu_cxx::category_names; -+} // namespace std -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.h 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.h 2005-04-28 01:13:15.000000000 -0500 -@@ -0,0 +1,115 @@ -+// Wrapper for underlying C-language localization -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.8 Standard locale categories. -+// -+ -+// Written by Benjamin Kosnik -+ -+#ifndef _C_LOCALE_H -+#define _C_LOCALE_H 1 -+ -+#pragma GCC system_header -+ -+#include // get std::strlen -+#include // get std::snprintf or std::sprintf -+#include -+#include // For codecvt -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this -+#endif -+#ifdef __UCLIBC_HAS_LOCALE__ -+#include // For codecvt using iconv, iconv_t -+#endif -+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ -+#include // 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 -+ int -+ __convert_from_v(char* __out, const int __size, const char* __fmt, -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ _Tv __v, const __c_locale& __cloc, int __prec) -+ { -+ __c_locale __old = __gnu_cxx::__uselocale(__cloc); -+#else -+ _Tv __v, const __c_locale&, int __prec) -+ { -+# ifdef __UCLIBC_HAS_LOCALE__ -+ char* __old = std::setlocale(LC_ALL, NULL); -+ char* __sav = new char[std::strlen(__old) + 1]; -+ std::strcpy(__sav, __old); -+ std::setlocale(LC_ALL, "C"); -+# endif -+#endif -+ -+ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v); -+ -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __gnu_cxx::__uselocale(__old); -+#elif defined __UCLIBC_HAS_LOCALE__ -+ std::setlocale(LC_ALL, __sav); -+ delete [] __sav; -+#endif -+ return __ret; -+ } -+} -+ -+#endif -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2005-04-28 01:13:15.000000000 -0500 -@@ -0,0 +1,306 @@ -+// std::codecvt implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2002, 2003 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.1.5 - Template class codecvt -+// -+ -+// Written by Benjamin Kosnik -+ -+#include -+#include -+ -+namespace std -+{ -+ // Specializations. -+#ifdef _GLIBCXX_USE_WCHAR_T -+ codecvt_base::result -+ codecvt:: -+ 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(-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(__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:: -+ 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(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(-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(-1) -+ || __conv == static_cast(-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:: -+ 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:: -+ 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:: -+ 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(__builtin_alloca(sizeof(wchar_t) -+ * __max)); -+ while (__from < __end && __max) -+ { -+ const extern_type* __from_chunk_end; -+ __from_chunk_end = static_cast(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(-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(-1) -+ || __conv == static_cast(-2)) -+ break; -+ } -+ __state = __tmp_state; -+ __ret += __from - __tmp_from; -+ break; -+ } -+ if (!__from) -+ __from = __from_chunk_end; -+ -+ __ret += __from - __tmp_from; -+ __max -= __conv; -+ -+ if (__from < __end && __max) -+ { -+ // XXX Probably wrong for stateful encodings -+ __tmp_state = __state; -+ ++__from; -+ ++__ret; -+ --__max; -+ } -+ } -+ -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ -+ return __ret; -+ } -+#endif -+} -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/collate_members.cc ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/collate_members.cc 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/collate_members.cc 2005-04-28 01:13:15.000000000 -0500 -@@ -0,0 +1,80 @@ -+// std::collate implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#include -+#include -+ -+#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::_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::_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::_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::_M_transform(wchar_t* __to, const wchar_t* __from, -+ size_t __n) const -+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); } -+#endif -+} -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2005-04-28 01:13:15.000000000 -0500 -@@ -0,0 +1,300 @@ -+// std::ctype implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions. -+// -+ -+// Written by Benjamin Kosnik -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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 specializations are in src/locale.cc and -+ // various /config/os/* files. -+ template<> -+ ctype_byname::ctype_byname(const char* __s, size_t __refs) -+ : ctype(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::__wmask_type -+ ctype::_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::do_toupper(wchar_t __c) const -+ { return __towupper_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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::do_tolower(wchar_t __c) const -+ { return __towlower_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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:: -+ 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:: -+ 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:: -+ 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:: -+ 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:: -+ do_widen(char __c) const -+ { return _M_widen[static_cast(__c)]; } -+ -+ const char* -+ ctype:: -+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const -+ { -+ while (__lo < __hi) -+ { -+ *__dest = _M_widen[static_cast(*__lo)]; -+ ++__lo; -+ ++__dest; -+ } -+ return __hi; -+ } -+ -+ char -+ ctype:: -+ 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(__c)); -+ } -+ -+ const wchar_t* -+ ctype:: -+ 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(__c)); -+ } -+ ++__lo; -+ ++__dest; -+ } -+ else -+ while (__lo < __hi) -+ { -+ const int __c = wctob(*__lo); -+ *__dest = (__c == EOF ? __dfault : static_cast(__c)); -+ ++__lo; -+ ++__dest; -+ } -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ return __hi; -+ } -+ -+ void -+ ctype::_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(__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(_ISbit(__k)); -+ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]); -+ } -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ } -+#endif // _GLIBCXX_USE_WCHAR_T -+} -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.cc ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.cc 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.cc 2005-04-28 01:13:15.000000000 -0500 -@@ -0,0 +1,100 @@ -+// std::messages implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#include -+#include -+ -+#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::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(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::do_get(catalog, int, int, const wstring& __dfault) const -+ { -+# ifdef __UCLIBC_HAS_XLOCALE__ -+ __c_locale __old = __uselocale(_M_c_locale_messages); -+ char* __msg = gettext(_M_convert_to_char(__dfault)); -+ __uselocale(__old); -+ return _M_convert_from_char(__msg); -+# elif defined __UCLIBC_HAS_LOCALE__ -+ char* __old = strdup(setlocale(LC_ALL, NULL)); -+ setlocale(LC_ALL, _M_name_messages); -+ char* __msg = gettext(_M_convert_to_char(__dfault)); -+ setlocale(LC_ALL, __old); -+ free(__old); -+ return _M_convert_from_char(__msg); -+# else -+ char* __msg = gettext(_M_convert_to_char(__dfault)); -+ return _M_convert_from_char(__msg); -+# endif -+ } -+#endif -+} -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.h 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2005-04-28 01:13:15.000000000 -0500 -@@ -0,0 +1,118 @@ -+// std::messages implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.7.1.2 messages functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#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 -+ messages<_CharT>::messages(size_t __refs) -+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), -+ _M_name_messages(_S_get_c_name()) -+ { } -+ -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::open(const basic_string& __s, const locale& __loc, -+ const char* __dir) const -+ { -+ __bindtextdomain(__s.c_str(), __dir); -+ return this->do_open(__s, __loc); -+ } -+ -+ // Virtual member functions. -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::do_open(const basic_string& __s, -+ const locale&) const -+ { -+ // No error checking is done, assume the catalog exists and can -+ // be used. -+ __textdomain(__s.c_str()); -+ return 0; -+ } -+ -+ template -+ void -+ messages<_CharT>::do_close(catalog) const -+ { } -+ -+ // messages_byname -+ template -+ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) -+ : messages<_CharT>(__refs) -+ { -+ if (this->_M_name_messages != locale::facet::_S_get_c_name()) -+ delete [] this->_M_name_messages; -+ char* __tmp = new char[std::strlen(__s) + 1]; -+ std::strcpy(__tmp, __s); -+ this->_M_name_messages = __tmp; -+ -+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) -+ { -+ this->_S_destroy_c_locale(this->_M_c_locale_messages); -+ this->_S_create_c_locale(this->_M_c_locale_messages, __s); -+ } -+ } -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2005-04-28 01:23:02.000000000 -0500 -@@ -0,0 +1,692 @@ -+// std::moneypunct implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning optimize this for uclibc -+#warning tailor for stub locale support -+#endif -+ -+#ifndef __UCLIBC_HAS_XLOCALE__ -+#define __nl_langinfo_l(N, L) nl_langinfo((N)) -+#endif -+ -+namespace std -+{ -+ // Construct and return valid pattern consisting of some combination of: -+ // space none symbol sign value -+ money_base::pattern -+ money_base::_S_construct_pattern(char __precedes, char __space, char __posn) -+ { -+ pattern __ret; -+ -+ // This insanely complicated routine attempts to construct a valid -+ // pattern for use with monyepunct. A couple of invariants: -+ -+ // if (__precedes) symbol -> value -+ // else value -> symbol -+ -+ // if (__space) space -+ // else none -+ -+ // none == never first -+ // space never first or last -+ -+ // Any elegant implementations of this are welcome. -+ switch (__posn) -+ { -+ case 0: -+ case 1: -+ // 1 The sign precedes the value and symbol. -+ __ret.field[0] = sign; -+ if (__space) -+ { -+ // Pattern starts with sign. -+ if (__precedes) -+ { -+ __ret.field[1] = symbol; -+ __ret.field[3] = value; -+ } -+ else -+ { -+ __ret.field[1] = value; -+ __ret.field[3] = symbol; -+ } -+ __ret.field[2] = space; -+ } -+ else -+ { -+ // Pattern starts with sign and ends with none. -+ if (__precedes) -+ { -+ __ret.field[1] = symbol; -+ __ret.field[2] = value; -+ } -+ else -+ { -+ __ret.field[1] = value; -+ __ret.field[2] = symbol; -+ } -+ __ret.field[3] = none; -+ } -+ break; -+ case 2: -+ // 2 The sign follows the value and symbol. -+ if (__space) -+ { -+ // Pattern either ends with sign. -+ if (__precedes) -+ { -+ __ret.field[0] = symbol; -+ __ret.field[2] = value; -+ } -+ else -+ { -+ __ret.field[0] = value; -+ __ret.field[2] = symbol; -+ } -+ __ret.field[1] = space; -+ __ret.field[3] = sign; -+ } -+ else -+ { -+ // Pattern ends with sign then none. -+ if (__precedes) -+ { -+ __ret.field[0] = symbol; -+ __ret.field[1] = value; -+ } -+ else -+ { -+ __ret.field[0] = value; -+ __ret.field[1] = symbol; -+ } -+ __ret.field[2] = sign; -+ __ret.field[3] = none; -+ } -+ break; -+ case 3: -+ // 3 The sign immediately precedes the symbol. -+ if (__precedes) -+ { -+ __ret.field[0] = sign; -+ __ret.field[1] = symbol; -+ if (__space) -+ { -+ __ret.field[2] = space; -+ __ret.field[3] = value; -+ } -+ else -+ { -+ __ret.field[2] = value; -+ __ret.field[3] = none; -+ } -+ } -+ else -+ { -+ __ret.field[0] = value; -+ if (__space) -+ { -+ __ret.field[1] = space; -+ __ret.field[2] = sign; -+ __ret.field[3] = symbol; -+ } -+ else -+ { -+ __ret.field[1] = sign; -+ __ret.field[2] = symbol; -+ __ret.field[3] = none; -+ } -+ } -+ break; -+ case 4: -+ // 4 The sign immediately follows the symbol. -+ if (__precedes) -+ { -+ __ret.field[0] = symbol; -+ __ret.field[1] = sign; -+ if (__space) -+ { -+ __ret.field[2] = space; -+ __ret.field[3] = value; -+ } -+ else -+ { -+ __ret.field[2] = value; -+ __ret.field[3] = none; -+ } -+ } -+ else -+ { -+ __ret.field[0] = value; -+ if (__space) -+ { -+ __ret.field[1] = space; -+ __ret.field[2] = symbol; -+ __ret.field[3] = sign; -+ } -+ else -+ { -+ __ret.field[1] = symbol; -+ __ret.field[2] = sign; -+ __ret.field[3] = none; -+ } -+ } -+ break; -+ default: -+ __ret = pattern(); -+ } -+ return __ret; -+ } -+ -+ template<> -+ void -+ moneypunct::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::~moneypunct() -+ { delete _M_data; } -+ -+ template<> -+ moneypunct::~moneypunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ moneypunct::_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; -+ -+ 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(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::_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; -+ -+ 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(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::~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::~moneypunct() -+ { -+ if (_M_data->_M_positive_sign_size) -+ delete [] _M_data->_M_positive_sign; -+ if (_M_data->_M_negative_sign_size -+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0) -+ delete [] _M_data->_M_negative_sign; -+ if (_M_data->_M_curr_symbol_size) -+ delete [] _M_data->_M_curr_symbol; -+ delete _M_data; -+ } -+#endif -+} -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2005-04-28 01:20:20.000000000 -0500 -@@ -0,0 +1,173 @@ -+// std::numpunct implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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::~numpunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ numpunct::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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(__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(__num_base::_S_atoms_in[__j]); -+ } -+ else -+ { -+ // Named locale. -+ // NB: In the GNU model wchar_t is always 32 bit wide. -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this -+#endif -+#ifdef __UCLIBC__ -+# ifdef __UCLIBC_HAS_XLOCALE__ -+ _M_data->_M_decimal_point = __cloc->decimal_point_wc; -+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; -+# else -+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; -+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; -+# endif -+#else -+ union { char *__s; wchar_t __w; } __u; -+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc); -+ _M_data->_M_decimal_point = __u.__w; -+ -+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc); -+ _M_data->_M_thousands_sep = __u.__w; -+#endif -+ -+ if (_M_data->_M_thousands_sep == L'\0') -+ _M_data->_M_grouping = ""; -+ else -+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); -+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); -+ } -+ -+ // NB: There is no way to extact this info from posix locales. -+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); -+ _M_data->_M_truename = L"true"; -+ _M_data->_M_truename_size = 4; -+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); -+ _M_data->_M_falsename = L"false"; -+ _M_data->_M_falsename_size = 5; -+ } -+ -+ template<> -+ numpunct::~numpunct() -+ { delete _M_data; } -+ #endif -+} -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.cc ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.cc 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.cc 2005-04-28 01:13:15.000000000 -0500 -@@ -0,0 +1,406 @@ -+// std::time_get, std::time_put implementation, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions -+// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#include -+#include -+ -+#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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+ 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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+#warning wide time stuff -+// if (!__cloc) -+ { -+ // "C" locale -+ _M_c_locale_timepunct = _S_get_c_locale(); -+ -+ _M_data->_M_date_format = L"%m/%d/%y"; -+ _M_data->_M_date_era_format = L"%m/%d/%y"; -+ _M_data->_M_time_format = L"%H:%M:%S"; -+ _M_data->_M_time_era_format = L"%H:%M:%S"; -+ _M_data->_M_date_time_format = L""; -+ _M_data->_M_date_time_era_format = L""; -+ _M_data->_M_am = L"AM"; -+ _M_data->_M_pm = L"PM"; -+ _M_data->_M_am_pm_format = L""; -+ -+ // Day names, starting with "C"'s Sunday. -+ _M_data->_M_day1 = L"Sunday"; -+ _M_data->_M_day2 = L"Monday"; -+ _M_data->_M_day3 = L"Tuesday"; -+ _M_data->_M_day4 = L"Wednesday"; -+ _M_data->_M_day5 = L"Thursday"; -+ _M_data->_M_day6 = L"Friday"; -+ _M_data->_M_day7 = L"Saturday"; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ _M_data->_M_aday1 = L"Sun"; -+ _M_data->_M_aday2 = L"Mon"; -+ _M_data->_M_aday3 = L"Tue"; -+ _M_data->_M_aday4 = L"Wed"; -+ _M_data->_M_aday5 = L"Thu"; -+ _M_data->_M_aday6 = L"Fri"; -+ _M_data->_M_aday7 = L"Sat"; -+ -+ // Month names, starting with "C"'s January. -+ _M_data->_M_month01 = L"January"; -+ _M_data->_M_month02 = L"February"; -+ _M_data->_M_month03 = L"March"; -+ _M_data->_M_month04 = L"April"; -+ _M_data->_M_month05 = L"May"; -+ _M_data->_M_month06 = L"June"; -+ _M_data->_M_month07 = L"July"; -+ _M_data->_M_month08 = L"August"; -+ _M_data->_M_month09 = L"September"; -+ _M_data->_M_month10 = L"October"; -+ _M_data->_M_month11 = L"November"; -+ _M_data->_M_month12 = L"December"; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ _M_data->_M_amonth01 = L"Jan"; -+ _M_data->_M_amonth02 = L"Feb"; -+ _M_data->_M_amonth03 = L"Mar"; -+ _M_data->_M_amonth04 = L"Apr"; -+ _M_data->_M_amonth05 = L"May"; -+ _M_data->_M_amonth06 = L"Jun"; -+ _M_data->_M_amonth07 = L"Jul"; -+ _M_data->_M_amonth08 = L"Aug"; -+ _M_data->_M_amonth09 = L"Sep"; -+ _M_data->_M_amonth10 = L"Oct"; -+ _M_data->_M_amonth11 = L"Nov"; -+ _M_data->_M_amonth12 = L"Dec"; -+ } -+#if 0 -+ else -+ { -+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); -+ -+ union { char *__s; wchar_t *__w; } __u; -+ -+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); -+ _M_data->_M_date_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); -+ _M_data->_M_date_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); -+ _M_data->_M_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); -+ _M_data->_M_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); -+ _M_data->_M_date_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); -+ _M_data->_M_date_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); -+ _M_data->_M_am = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); -+ _M_data->_M_pm = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); -+ _M_data->_M_am_pm_format = __u.__w; -+ -+ // Day names, starting with "C"'s Sunday. -+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); -+ _M_data->_M_day1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); -+ _M_data->_M_day2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); -+ _M_data->_M_day3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); -+ _M_data->_M_day4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); -+ _M_data->_M_day5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); -+ _M_data->_M_day6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); -+ _M_data->_M_day7 = __u.__w; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); -+ _M_data->_M_aday1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); -+ _M_data->_M_aday2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); -+ _M_data->_M_aday3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); -+ _M_data->_M_aday4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); -+ _M_data->_M_aday5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); -+ _M_data->_M_aday6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); -+ _M_data->_M_aday7 = __u.__w; -+ -+ // Month names, starting with "C"'s January. -+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); -+ _M_data->_M_month01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); -+ _M_data->_M_month02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); -+ _M_data->_M_month03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); -+ _M_data->_M_month04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); -+ _M_data->_M_month05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); -+ _M_data->_M_month06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); -+ _M_data->_M_month07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); -+ _M_data->_M_month08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); -+ _M_data->_M_month09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); -+ _M_data->_M_month10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); -+ _M_data->_M_month11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); -+ _M_data->_M_month12 = __u.__w; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); -+ _M_data->_M_amonth01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); -+ _M_data->_M_amonth02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); -+ _M_data->_M_amonth03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); -+ _M_data->_M_amonth04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); -+ _M_data->_M_amonth05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); -+ _M_data->_M_amonth06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); -+ _M_data->_M_amonth07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); -+ _M_data->_M_amonth08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); -+ _M_data->_M_amonth09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); -+ _M_data->_M_amonth10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); -+ _M_data->_M_amonth11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); -+ _M_data->_M_amonth12 = __u.__w; -+ } -+#endif // 0 -+ } -+#endif -+} -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.h 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.h 2004-05-22 18:46:31.000000000 -0500 -@@ -0,0 +1,68 @@ -+// std::time_get, std::time_put implementation, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.5.1.2 - time_get functions -+// ISO C++ 14882: 22.2.5.3.2 - time_put functions -+// -+ -+// Written by Benjamin Kosnik -+ -+ template -+ __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 -+ __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 -+ __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 -+ __timepunct<_CharT>::~__timepunct() -+ { -+ if (_M_name_timepunct != _S_get_c_name()) -+ delete [] _M_name_timepunct; -+ delete _M_data; -+ _S_destroy_c_locale(_M_c_locale_timepunct); -+ } -diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_base.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_base.h ---- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_base.h 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_base.h 2005-04-28 01:10:27.000000000 -0500 -@@ -0,0 +1,64 @@ -+// Locale support -*- C++ -*- -+ -+// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 -+// Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.1 Locales -+// -+ -+/** @file ctype_base.h -+ * This is an internal header file, included by other library headers. -+ * You should not attempt to use it directly. -+ */ -+ -+// Information as gleaned from /usr/include/ctype.h -+ -+ /// @brief Base class for ctype. -+ struct ctype_base -+ { -+ // Note: In uClibc, the following two types depend on configuration. -+ -+ // Non-standard typedefs. -+ typedef const __ctype_touplow_t* __to_type; -+ -+ // NB: Offsets into ctype::_M_table force a particular size -+ // on the mask type. Because of this, we don't use an enum. -+ typedef __ctype_mask_t mask; -+ static const mask upper = _ISupper; -+ static const mask lower = _ISlower; -+ static const mask alpha = _ISalpha; -+ static const mask digit = _ISdigit; -+ static const mask xdigit = _ISxdigit; -+ static const mask space = _ISspace; -+ static const mask print = _ISprint; -+ static const mask graph = _ISalpha | _ISdigit | _ISpunct; -+ static const mask cntrl = _IScntrl; -+ static const mask punct = _ISpunct; -+ static const mask alnum = _ISalpha | _ISdigit; -+ }; -diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_inline.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_inline.h ---- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_inline.h 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_inline.h 2002-06-24 00:49:19.000000000 -0500 -@@ -0,0 +1,69 @@ -+// Locale support -*- C++ -*- -+ -+// Copyright (C) 2000, 2002 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.1 Locales -+// -+ -+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) -+// functions go in ctype.cc -+ -+ bool -+ ctype:: -+ is(mask __m, char __c) const -+ { return _M_table[static_cast(__c)] & __m; } -+ -+ const char* -+ ctype:: -+ is(const char* __low, const char* __high, mask* __vec) const -+ { -+ while (__low < __high) -+ *__vec++ = _M_table[static_cast(*__low++)]; -+ return __high; -+ } -+ -+ const char* -+ ctype:: -+ scan_is(mask __m, const char* __low, const char* __high) const -+ { -+ while (__low < __high -+ && !(_M_table[static_cast(*__low)] & __m)) -+ ++__low; -+ return __low; -+ } -+ -+ const char* -+ ctype:: -+ scan_not(mask __m, const char* __low, const char* __high) const -+ { -+ while (__low < __high -+ && (_M_table[static_cast(*__low)] & __m) != 0) -+ ++__low; -+ return __low; -+ } -diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_noninline.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h ---- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2005-04-28 01:10:27.000000000 -0500 -@@ -0,0 +1,92 @@ -+// Locale support -*- C++ -*- -+ -+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 -+// Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.1 Locales -+// -+ -+// Information as gleaned from /usr/include/ctype.h -+ -+ const ctype_base::mask* -+ ctype::classic_table() throw() -+ { return __C_ctype_b; } -+ -+ ctype::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::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::do_toupper(char __c) const -+ { return _M_toupper[static_cast(__c)]; } -+ -+ const char* -+ ctype::do_toupper(char* __low, const char* __high) const -+ { -+ while (__low < __high) -+ { -+ *__low = _M_toupper[static_cast(*__low)]; -+ ++__low; -+ } -+ return __high; -+ } -+ -+ char -+ ctype::do_tolower(char __c) const -+ { return _M_tolower[static_cast(__c)]; } -+ -+ const char* -+ ctype::do_tolower(char* __low, const char* __high) const -+ { -+ while (__low < __high) -+ { -+ *__low = _M_tolower[static_cast(*__low)]; -+ ++__low; -+ } -+ return __high; -+ } -diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/os_defines.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/os_defines.h ---- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/os_defines.h 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/os_defines.h 2005-04-28 01:10:27.000000000 -0500 -@@ -0,0 +1,44 @@ -+// Specific definitions for GNU/Linux -*- C++ -*- -+ -+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+#ifndef _GLIBCXX_OS_DEFINES -+#define _GLIBCXX_OS_DEFINES 1 -+ -+// System-specific #define, typedefs, corrections, etc, go here. This -+// file will come before all others. -+ -+// This keeps isanum, et al from being propagated as macros. -+#define __NO_CTYPE 1 -+ -+#include -+ -+// We must not see the optimized string functions GNU libc defines. -+#define __NO_STRING_INLINES -+ -+#endif -diff -urN gcc-4.0.0-100/libstdc++-v3/configure gcc-4.0.0/libstdc++-v3/configure ---- gcc-4.0.0-100/libstdc++-v3/configure 2005-04-30 13:06:53.683055232 -0500 -+++ gcc-4.0.0/libstdc++-v3/configure 2005-04-30 12:24:24.000000000 -0500 -@@ -3998,6 +3998,11 @@ - lt_cv_deplibs_check_method=pass_all - ;; - -+linux-uclibc*) -+ lt_cv_deplibs_check_method=pass_all -+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` -+ ;; -+ - netbsd* | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' -@@ -5672,7 +5677,7 @@ - enableval="$enable_clocale" - - case "$enableval" in -- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;; -+ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;; - *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5 - echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;} - { (exit 1); exit 1; }; } ;; -@@ -5697,6 +5702,9 @@ - # Default to "generic". - if test $enable_clocale_flag = auto; then - case ${target_os} in -+ linux-uclibc*) -+ enable_clocale_flag=uclibc -+ ;; - linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) - cat >conftest.$ac_ext <<_ACEOF - /* confdefs.h. */ -@@ -5927,6 +5935,76 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ echo "$as_me:$LINENO: result: uclibc" >&5 -+echo "${ECHO_T}uclibc" >&6 -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ # Extract the first word of "msgfmt", so it can be a program name with args. -+set dummy msgfmt; ac_word=$2 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_check_msgfmt+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$check_msgfmt"; then -+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. -+else -+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -+for as_dir in $PATH -+do -+ IFS=$as_save_IFS -+ test -z "$as_dir" && as_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_check_msgfmt="yes" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done -+ -+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" -+fi -+fi -+check_msgfmt=$ac_cv_prog_check_msgfmt -+if test -n "$check_msgfmt"; then -+ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 -+echo "${ECHO_T}$check_msgfmt" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ -+ -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the -diff -urN gcc-4.0.0-100/libstdc++-v3/configure.host gcc-4.0.0/libstdc++-v3/configure.host ---- gcc-4.0.0-100/libstdc++-v3/configure.host 2005-04-30 13:06:53.688054472 -0500 -+++ gcc-4.0.0/libstdc++-v3/configure.host 2005-04-28 20:20:32.000000000 -0500 -@@ -249,6 +249,12 @@ - ;; - esac - -+# Override for uClibc since linux-uclibc gets mishandled above. -+case "${host_os}" in -+ *-uclibc*) -+ os_include_dir="os/uclibc" -+ ;; -+esac - - # Set any OS-dependent and CPU-dependent bits. - # THIS TABLE IS SORTED. KEEP IT THAT WAY. -diff -urN gcc-4.0.0-100/libstdc++-v3/crossconfig.m4 gcc-4.0.0/libstdc++-v3/crossconfig.m4 ---- gcc-4.0.0-100/libstdc++-v3/crossconfig.m4 2005-04-30 13:06:53.689054320 -0500 -+++ gcc-4.0.0/libstdc++-v3/crossconfig.m4 2005-04-28 20:27:15.000000000 -0500 -@@ -142,6 +142,98 @@ - ;; - esac - ;; -+ *-uclibc*) -+# Temporary hack until we implement the float versions of the libm funcs -+ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ -+ machine/endian.h machine/param.h sys/machine.h sys/types.h \ -+ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h]) -+ SECTION_FLAGS='-ffunction-sections -fdata-sections' -+ AC_SUBST(SECTION_FLAGS) -+ GLIBCXX_CHECK_LINKER_FEATURES -+ GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT -+ GLIBCXX_CHECK_WCHAR_T_SUPPORT -+ -+ # For LFS. -+ AC_DEFINE(HAVE_INT64_T) -+ case "$target" in -+ *-uclinux*) -+ # Don't enable LFS with uClinux -+ ;; -+ *) -+ AC_DEFINE(_GLIBCXX_USE_LFS) -+ esac -+ -+ # For showmanyc_helper(). -+ AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) -+ GLIBCXX_CHECK_POLL -+ GLIBCXX_CHECK_S_ISREG_OR_S_IFREG -+ -+ # For xsputn_2(). -+ AC_CHECK_HEADERS(sys/uio.h) -+ GLIBCXX_CHECK_WRITEV -+ -+# AC_DEFINE(HAVE_ACOSF) -+# AC_DEFINE(HAVE_ASINF) -+# AC_DEFINE(HAVE_ATANF) -+# AC_DEFINE(HAVE_ATAN2F) -+ AC_DEFINE(HAVE_CEILF) -+ AC_DEFINE(HAVE_COPYSIGN) -+# AC_DEFINE(HAVE_COPYSIGNF) -+# AC_DEFINE(HAVE_COSF) -+# AC_DEFINE(HAVE_COSHF) -+# AC_DEFINE(HAVE_EXPF) -+# AC_DEFINE(HAVE_FABSF) -+ AC_DEFINE(HAVE_FINITE) -+ AC_DEFINE(HAVE_FINITEF) -+ AC_DEFINE(HAVE_FLOORF) -+# AC_DEFINE(HAVE_FMODF) -+# AC_DEFINE(HAVE_FREXPF) -+ AC_DEFINE(HAVE_HYPOT) -+# AC_DEFINE(HAVE_HYPOTF) -+ AC_DEFINE(HAVE_ISINF) -+ AC_DEFINE(HAVE_ISINFF) -+ AC_DEFINE(HAVE_ISNAN) -+ AC_DEFINE(HAVE_ISNANF) -+# AC_DEFINE(HAVE_LOGF) -+# AC_DEFINE(HAVE_LOG10F) -+# AC_DEFINE(HAVE_MODFF) -+# AC_DEFINE(HAVE_SINF) -+# AC_DEFINE(HAVE_SINHF) -+# AC_DEFINE(HAVE_SINCOS) -+# AC_DEFINE(HAVE_SINCOSF) -+ AC_DEFINE(HAVE_SQRTF) -+# AC_DEFINE(HAVE_TANF) -+# AC_DEFINE(HAVE_TANHF) -+ if test x"long_double_math_on_this_cpu" = x"yes"; then -+# AC_DEFINE(HAVE_ACOSL) -+# AC_DEFINE(HAVE_ASINL) -+# AC_DEFINE(HAVE_ATANL) -+# AC_DEFINE(HAVE_ATAN2L) -+# AC_DEFINE(HAVE_CEILL) -+# AC_DEFINE(HAVE_COPYSIGNL) -+# AC_DEFINE(HAVE_COSL) -+# AC_DEFINE(HAVE_COSHL) -+# AC_DEFINE(HAVE_EXPL) -+# AC_DEFINE(HAVE_FABSL) -+# AC_DEFINE(HAVE_FINITEL) -+# AC_DEFINE(HAVE_FLOORL) -+# AC_DEFINE(HAVE_FMODL) -+# AC_DEFINE(HAVE_FREXPL) -+# AC_DEFINE(HAVE_HYPOTL) -+# AC_DEFINE(HAVE_ISINFL) -+# AC_DEFINE(HAVE_ISNANL) -+# AC_DEFINE(HAVE_LOGL) -+# AC_DEFINE(HAVE_LOG10L) -+# AC_DEFINE(HAVE_MODFL) -+# AC_DEFINE(HAVE_POWL) -+# AC_DEFINE(HAVE_SINL) -+# AC_DEFINE(HAVE_SINHL) -+# AC_DEFINE(HAVE_SINCOSL) -+# AC_DEFINE(HAVE_SQRTL) -+# AC_DEFINE(HAVE_TANL) -+# AC_DEFINE(HAVE_TANHL) -+ fi -+ ;; - *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu) - AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ - machine/endian.h machine/param.h sys/machine.h sys/types.h \ -@@ -156,7 +248,7 @@ - AC_DEFINE(HAVE_INT64_T) - case "$target" in - *-uclinux*) -- # Don't enable LFS with uClibc -+ # Don't enable LFS with uClinux - ;; - *) - AC_DEFINE(_GLIBCXX_USE_LFS) -diff -urN gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h ---- gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h 2005-04-30 13:06:53.690054168 -0500 -+++ gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h 2005-04-28 20:15:56.000000000 -0500 -@@ -101,7 +101,9 @@ - using std::wmemcpy; - using std::wmemmove; - using std::wmemset; -+#if _GLIBCXX_HAVE_WCSFTIME - using std::wcsftime; -+#endif - - #if _GLIBCXX_USE_C99 - using std::wcstold; -diff -urN gcc-4.0.0-100/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.0.0/libstdc++-v3/include/c_std/std_cwchar.h ---- gcc-4.0.0-100/libstdc++-v3/include/c_std/std_cwchar.h 2005-04-30 13:06:53.691054016 -0500 -+++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cwchar.h 2005-04-28 20:15:56.000000000 -0500 -@@ -179,7 +179,9 @@ - using ::wcscoll; - using ::wcscpy; - using ::wcscspn; -+#if _GLIBCXX_HAVE_WCSFTIME - using ::wcsftime; -+#endif - using ::wcslen; - using ::wcsncat; - using ::wcsncmp; diff --git a/patches/gcc/4.0.3/300-libstdc++-pic.patch b/patches/gcc/4.0.3/300-libstdc++-pic.patch deleted file mode 100644 index a9d6e71..0000000 --- a/patches/gcc/4.0.3/300-libstdc++-pic.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- gcc-4.0.0/libstdc++-v3/src/Makefile.am -+++ gcc-4.0.0/libstdc++-v3/src/Makefile.am -@@ -214,6 +214,10 @@ - $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ - - -+install-exec-local: -+ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) -+ - # Added bits to build debug library. - if GLIBCXX_BUILD_DEBUG - all-local: build_debug ---- gcc-4.0.0/libstdc++-v3/src/Makefile.in -+++ gcc-4.0.0/libstdc++-v3/src/Makefile.in -@@ -625,7 +625,7 @@ - - install-data-am: install-data-local - --install-exec-am: install-toolexeclibLTLIBRARIES -+install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local - - install-info: install-info-am - -@@ -664,7 +664,7 @@ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am \ -- uninstall-toolexeclibLTLIBRARIES -+ uninstall-toolexeclibLTLIBRARIES install-exec-local - - @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP) - @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver -@@ -743,6 +743,11 @@ - install_debug: - (cd ${debugdir} && $(MAKE) \ - toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) -+ -+install-exec-local: -+ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) -+ - # Tell versions [3.59,3.63) of GNU make to not export all variables. - # Otherwise a system limit (for SysV at least) may be exceeded. - .NOEXPORT: diff --git a/patches/gcc/4.0.3/301-missing-execinfo_h.patch b/patches/gcc/4.0.3/301-missing-execinfo_h.patch deleted file mode 100644 index 0e2092f..0000000 --- a/patches/gcc/4.0.3/301-missing-execinfo_h.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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 - # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ -- && !defined(__ia64__) -+ && !defined(__ia64__) && !defined(__UCLIBC__) - # ifndef GC_HAVE_BUILTIN_BACKTRACE - # define GC_HAVE_BUILTIN_BACKTRACE - # endif diff --git a/patches/gcc/4.0.3/302-c99-snprintf.patch b/patches/gcc/4.0.3/302-c99-snprintf.patch deleted file mode 100644 index dfb22d6..0000000 --- a/patches/gcc/4.0.3/302-c99-snprintf.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h-orig 2005-04-29 00:08:41.000000000 -0500 -+++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h 2005-04-29 00:08:45.000000000 -0500 -@@ -142,7 +142,7 @@ - using ::vsprintf; - } - --#if _GLIBCXX_USE_C99 -+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) - - #undef snprintf - #undef vfscanf diff --git a/patches/gcc/4.0.3/303-c99-complex-ugly-hack.patch b/patches/gcc/4.0.3/303-c99-complex-ugly-hack.patch deleted file mode 100644 index 2ccc80d..0000000 --- a/patches/gcc/4.0.3/303-c99-complex-ugly-hack.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- 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 -+#ifdef __UCLIBC__ -+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs -+#endif - int - main () - { diff --git a/patches/gcc/4.0.3/304-index_macro.patch b/patches/gcc/4.0.3/304-index_macro.patch deleted file mode 100644 index 1fac112..0000000 --- a/patches/gcc/4.0.3/304-index_macro.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- 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 - #include - -+/* 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 // For uninitialized_copy_n - #include // For power - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - namespace __gnu_cxx - { - using std::size_t; diff --git a/patches/gcc/4.0.3/602-sdk-libstdc++-includes.patch b/patches/gcc/4.0.3/602-sdk-libstdc++-includes.patch deleted file mode 100644 index c7676ae..0000000 --- a/patches/gcc/4.0.3/602-sdk-libstdc++-includes.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff -urN gcc-4.0.0-100/libstdc++-v3/fragment.am gcc-4.0.0/libstdc++-v3/fragment.am ---- gcc-4.0.0-100/libstdc++-v3/fragment.am 2004-10-25 15:32:40.000000000 -0500 -+++ gcc-4.0.0/libstdc++-v3/fragment.am 2005-04-28 21:48:43.000000000 -0500 -@@ -18,5 +18,5 @@ - $(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once - - # -I/-D flags to pass when compiling. --AM_CPPFLAGS = $(GLIBCXX_INCLUDES) -+AM_CPPFLAGS = $(GLIBCXX_INCLUDES) -I$(toplevel_srcdir)/include - -diff -urN gcc-4.0.0-100/libstdc++-v3/libmath/Makefile.am gcc-4.0.0/libstdc++-v3/libmath/Makefile.am ---- gcc-4.0.0-100/libstdc++-v3/libmath/Makefile.am 2003-08-27 16:29:42.000000000 -0500 -+++ gcc-4.0.0/libstdc++-v3/libmath/Makefile.am 2005-04-28 21:48:43.000000000 -0500 -@@ -32,7 +32,7 @@ - - libmath_la_SOURCES = stubs.c - --AM_CPPFLAGS = $(CANADIAN_INCLUDES) -+AM_CPPFLAGS = $(CANADIAN_INCLUDES) -I$(toplevel_srcdir)/include - - # Only compiling "C" sources in this directory. - LIBTOOL = @LIBTOOL@ --tag CC diff --git a/patches/gcc/4.0.3/800-arm-bigendian.patch b/patches/gcc/4.0.3/800-arm-bigendian.patch deleted file mode 100644 index 307aea3..0000000 --- a/patches/gcc/4.0.3/800-arm-bigendian.patch +++ /dev/null @@ -1,67 +0,0 @@ -By Lennert Buytenhek -Adds support for arm*b-linux* big-endian ARM targets - -See http://gcc.gnu.org/PR16350 - ---- gcc-4.0.3/gcc/config/arm/linux-elf.h -+++ gcc-4.0.3/gcc/config/arm/linux-elf.h -@@ -31,19 +31,33 @@ - /* Do not assume anything about header files. */ - #define NO_IMPLICIT_EXTERN_C - -+/* -+ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* -+ * (big endian) configurations. -+ */ -+#if TARGET_BIG_ENDIAN_DEFAULT -+#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END -+#define TARGET_ENDIAN_OPTION "mbig-endian" -+#define TARGET_LINKER_EMULATION "armelfb_linux" -+#else -+#define TARGET_ENDIAN_DEFAULT 0 -+#define TARGET_ENDIAN_OPTION "mlittle-endian" -+#define TARGET_LINKER_EMULATION "armelf_linux" -+#endif -+ - #undef TARGET_DEFAULT_FLOAT_ABI - #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD - - #undef TARGET_DEFAULT --#define TARGET_DEFAULT (0) -+#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT) - - #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 - --#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" -+#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" - - #undef MULTILIB_DEFAULTS - #define MULTILIB_DEFAULTS \ -- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" } -+ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" } - - /* The GNU C++ standard library requires that these macros be defined. */ - #undef CPLUSPLUS_CPP_SPEC -@@ -90,7 +104,7 @@ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ - -X \ -- %{mbig-endian:-EB}" \ -+ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ - SUBTARGET_EXTRA_LINK_SPEC - - #define TARGET_OS_CPP_BUILTINS() \ ---- gcc-4.0.3/gcc/config.gcc -+++ gcc-4.0.3/gcc/config.gcc -@@ -672,6 +672,11 @@ - ;; - arm*-*-linux*) # ARM GNU/Linux with ELF - tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h" -+ case $target in -+ arm*b-*) -+ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" -+ ;; -+ esac - tmake_file="${tmake_file} arm/t-arm arm/t-linux" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - gnu_ld=yes diff --git a/patches/gcc/4.0.4/110-uclibc-locale.patch b/patches/gcc/4.0.4/110-uclibc-locale.patch new file mode 100644 index 0000000..ac4cf97 --- /dev/null +++ b/patches/gcc/4.0.4/110-uclibc-locale.patch @@ -0,0 +1,3237 @@ +diff -urN gcc-4.0.0-100/libstdc++-v3/acinclude.m4 gcc-4.0.0/libstdc++-v3/acinclude.m4 +--- gcc-4.0.0-100/libstdc++-v3/acinclude.m4 2005-04-30 13:06:53.000000000 -0500 ++++ gcc-4.0.0/libstdc++-v3/acinclude.m4 2005-04-28 20:19:01.000000000 -0500 +@@ -1104,7 +1104,7 @@ + AC_MSG_CHECKING([for C locale to use]) + GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], + [use MODEL for target locale package], +- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto]) ++ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto]) + + # If they didn't use this option switch, or if they specified --enable + # with no specific model, we'll have to look for one. If they +@@ -1120,6 +1120,9 @@ + # Default to "generic". + if test $enable_clocale_flag = auto; then + case ${target_os} in ++ *-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) + AC_EGREP_CPP([_GLIBCXX_ok], [ + #include +@@ -1263,6 +1266,40 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ AC_MSG_RESULT(uclibc) ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ AC_SUBST(glibcxx_MOFILES) ++ AC_SUBST(glibcxx_POFILES) ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,59 @@ ++// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*- ++ ++// Copyright (C) 2002, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// Written by Jakub Jelinek ++ ++#include ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning clean this up ++#endif ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ ++extern "C" __typeof(iswctype_l) __iswctype_l; ++extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l; ++extern "C" __typeof(strcoll_l) __strcoll_l; ++extern "C" __typeof(strftime_l) __strftime_l; ++extern "C" __typeof(strtod_l) __strtod_l; ++extern "C" __typeof(strtof_l) __strtof_l; ++extern "C" __typeof(strtold_l) __strtold_l; ++extern "C" __typeof(strxfrm_l) __strxfrm_l; ++extern "C" __typeof(towlower_l) __towlower_l; ++extern "C" __typeof(towupper_l) __towupper_l; ++extern "C" __typeof(wcscoll_l) __wcscoll_l; ++extern "C" __typeof(wcsftime_l) __wcsftime_l; ++extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l; ++extern "C" __typeof(wctype_l) __wctype_l; ++extern "C" __typeof(newlocale) __newlocale; ++extern "C" __typeof(freelocale) __freelocale; ++extern "C" __typeof(duplocale) __duplocale; ++extern "C" __typeof(uselocale) __uselocale; ++ ++#endif // GLIBC 2.3 and later +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,160 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik ++ ++#include // For errno ++#include ++#include ++#include ++#include ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __strtol_l(S, E, B, L) strtol((S), (E), (B)) ++#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B)) ++#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B)) ++#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B)) ++#define __strtof_l(S, E, L) strtof((S), (E)) ++#define __strtod_l(S, E, L) strtod((S), (E)) ++#define __strtold_l(S, E, L) strtold((S), (E)) ++#warning should dummy __newlocale check for C|POSIX ? ++#define __newlocale(a, b, c) NULL ++#define __freelocale(a) ((void)0) ++#define __duplocale(a) __c_locale() ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ float __f = __strtof_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __f; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ double __d = __strtod_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __d; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ if (!(__err & ios_base::failbit)) ++ { ++ char* __sanity; ++ errno = 0; ++ long double __ld = __strtold_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __ld; ++ else ++ __err |= ios_base::failbit; ++ } ++ } ++ ++ void ++ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, ++ __c_locale __old) ++ { ++ __cloc = __newlocale(1 << LC_ALL, __s, __old); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ if (!__cloc) ++ { ++ // This named locale is not supported by the underlying OS. ++ __throw_runtime_error(__N("locale::facet::_S_create_c_locale " ++ "name not valid")); ++ } ++#endif ++ } ++ ++ void ++ locale::facet::_S_destroy_c_locale(__c_locale& __cloc) ++ { ++ if (_S_get_c_locale() != __cloc) ++ __freelocale(__cloc); ++ } ++ ++ __c_locale ++ locale::facet::_S_clone_c_locale(__c_locale& __cloc) ++ { return __duplocale(__cloc); } ++} // namespace std ++ ++namespace __gnu_cxx ++{ ++ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] = ++ { ++ "LC_CTYPE", ++ "LC_NUMERIC", ++ "LC_TIME", ++ "LC_COLLATE", ++ "LC_MONETARY", ++ "LC_MESSAGES", ++#if _GLIBCXX_NUM_CATEGORIES != 0 ++ "LC_PAPER", ++ "LC_NAME", ++ "LC_ADDRESS", ++ "LC_TELEPHONE", ++ "LC_MEASUREMENT", ++ "LC_IDENTIFICATION" ++#endif ++ }; ++} ++ ++namespace std ++{ ++ const char* const* const locale::_S_categories = __gnu_cxx::category_names; ++} // namespace std +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.h 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,115 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik ++ ++#ifndef _C_LOCALE_H ++#define _C_LOCALE_H 1 ++ ++#pragma GCC system_header ++ ++#include // get std::strlen ++#include // get std::snprintf or std::sprintf ++#include ++#include // For codecvt ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC_HAS_LOCALE__ ++#include // For codecvt using iconv, iconv_t ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#include // 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 ++ int ++ __convert_from_v(char* __out, const int __size, const char* __fmt, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ _Tv __v, const __c_locale& __cloc, int __prec) ++ { ++ __c_locale __old = __gnu_cxx::__uselocale(__cloc); ++#else ++ _Tv __v, const __c_locale&, int __prec) ++ { ++# ifdef __UCLIBC_HAS_LOCALE__ ++ char* __old = std::setlocale(LC_ALL, NULL); ++ char* __sav = new char[std::strlen(__old) + 1]; ++ std::strcpy(__sav, __old); ++ std::setlocale(LC_ALL, "C"); ++# endif ++#endif ++ ++ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __gnu_cxx::__uselocale(__old); ++#elif defined __UCLIBC_HAS_LOCALE__ ++ std::setlocale(LC_ALL, __sav); ++ delete [] __sav; ++#endif ++ return __ret; ++ } ++} ++ ++#endif +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,306 @@ ++// std::codecvt implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.5 - Template class codecvt ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++namespace std ++{ ++ // Specializations. ++#ifdef _GLIBCXX_USE_WCHAR_T ++ codecvt_base::result ++ codecvt:: ++ 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(-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(__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:: ++ 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(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(-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(-1) ++ || __conv == static_cast(-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:: ++ 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:: ++ 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:: ++ 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(__builtin_alloca(sizeof(wchar_t) ++ * __max)); ++ while (__from < __end && __max) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast(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(-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(-1) ++ || __conv == static_cast(-2)) ++ break; ++ } ++ __state = __tmp_state; ++ __ret += __from - __tmp_from; ++ break; ++ } ++ if (!__from) ++ __from = __from_chunk_end; ++ ++ __ret += __from - __tmp_from; ++ __max -= __conv; ++ ++ if (__from < __end && __max) ++ { ++ // XXX Probably wrong for stateful encodings ++ __tmp_state = __state; ++ ++__from; ++ ++__ret; ++ --__max; ++ } ++ } ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ return __ret; ++ } ++#endif ++} +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/collate_members.cc +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/collate_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/collate_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,80 @@ ++// std::collate implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.4.1.2 collate virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++#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::_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::_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::_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::_M_transform(wchar_t* __to, const wchar_t* __from, ++ size_t __n) const ++ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); } ++#endif ++} +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,300 @@ ++// std::ctype implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions. ++// ++ ++// Written by Benjamin Kosnik ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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 specializations are in src/locale.cc and ++ // various /config/os/* files. ++ template<> ++ ctype_byname::ctype_byname(const char* __s, size_t __refs) ++ : ctype(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::__wmask_type ++ ctype::_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::do_toupper(wchar_t __c) const ++ { return __towupper_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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::do_tolower(wchar_t __c) const ++ { return __towlower_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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:: ++ 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:: ++ 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:: ++ 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:: ++ 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:: ++ do_widen(char __c) const ++ { return _M_widen[static_cast(__c)]; } ++ ++ const char* ++ ctype:: ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const ++ { ++ while (__lo < __hi) ++ { ++ *__dest = _M_widen[static_cast(*__lo)]; ++ ++__lo; ++ ++__dest; ++ } ++ return __hi; ++ } ++ ++ char ++ ctype:: ++ 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(__c)); ++ } ++ ++ const wchar_t* ++ ctype:: ++ 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(__c)); ++ } ++ ++__lo; ++ ++__dest; ++ } ++ else ++ while (__lo < __hi) ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast(__c)); ++ ++__lo; ++ ++__dest; ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __hi; ++ } ++ ++ void ++ ctype::_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(__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(_ISbit(__k)); ++ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]); ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ } ++#endif // _GLIBCXX_USE_WCHAR_T ++} +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.cc +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,100 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++#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::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(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::do_get(catalog, int, int, const wstring& __dfault) const ++ { ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ __uselocale(__old); ++ return _M_convert_from_char(__msg); ++# elif defined __UCLIBC_HAS_LOCALE__ ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ setlocale(LC_ALL, __old); ++ free(__old); ++ return _M_convert_from_char(__msg); ++# else ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ return _M_convert_from_char(__msg); ++# endif ++ } ++#endif ++} +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,118 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#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 ++ messages<_CharT>::messages(size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), ++ _M_name_messages(_S_get_c_name()) ++ { } ++ ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::open(const basic_string& __s, const locale& __loc, ++ const char* __dir) const ++ { ++ __bindtextdomain(__s.c_str(), __dir); ++ return this->do_open(__s, __loc); ++ } ++ ++ // Virtual member functions. ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::do_open(const basic_string& __s, ++ const locale&) const ++ { ++ // No error checking is done, assume the catalog exists and can ++ // be used. ++ __textdomain(__s.c_str()); ++ return 0; ++ } ++ ++ template ++ void ++ messages<_CharT>::do_close(catalog) const ++ { } ++ ++ // messages_byname ++ template ++ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) ++ : messages<_CharT>(__refs) ++ { ++ if (this->_M_name_messages != locale::facet::_S_get_c_name()) ++ delete [] this->_M_name_messages; ++ char* __tmp = new char[std::strlen(__s) + 1]; ++ std::strcpy(__tmp, __s); ++ this->_M_name_messages = __tmp; ++ ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ++ { ++ this->_S_destroy_c_locale(this->_M_c_locale_messages); ++ this->_S_create_c_locale(this->_M_c_locale_messages, __s); ++ } ++ } +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2005-04-28 01:23:02.000000000 -0500 +@@ -0,0 +1,692 @@ ++// std::moneypunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning optimize this for uclibc ++#warning tailor for stub locale support ++#endif ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ // Construct and return valid pattern consisting of some combination of: ++ // space none symbol sign value ++ money_base::pattern ++ money_base::_S_construct_pattern(char __precedes, char __space, char __posn) ++ { ++ pattern __ret; ++ ++ // This insanely complicated routine attempts to construct a valid ++ // pattern for use with monyepunct. A couple of invariants: ++ ++ // if (__precedes) symbol -> value ++ // else value -> symbol ++ ++ // if (__space) space ++ // else none ++ ++ // none == never first ++ // space never first or last ++ ++ // Any elegant implementations of this are welcome. ++ switch (__posn) ++ { ++ case 0: ++ case 1: ++ // 1 The sign precedes the value and symbol. ++ __ret.field[0] = sign; ++ if (__space) ++ { ++ // Pattern starts with sign. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[3] = symbol; ++ } ++ __ret.field[2] = space; ++ } ++ else ++ { ++ // Pattern starts with sign and ends with none. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[3] = none; ++ } ++ break; ++ case 2: ++ // 2 The sign follows the value and symbol. ++ if (__space) ++ { ++ // Pattern either ends with sign. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[1] = space; ++ __ret.field[3] = sign; ++ } ++ else ++ { ++ // Pattern ends with sign then none. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[1] = symbol; ++ } ++ __ret.field[2] = sign; ++ __ret.field[3] = none; ++ } ++ break; ++ case 3: ++ // 3 The sign immediately precedes the symbol. ++ if (__precedes) ++ { ++ __ret.field[0] = sign; ++ __ret.field[1] = symbol; ++ if (__space) ++ { ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[2] = value; ++ __ret.field[3] = none; ++ } ++ } ++ else ++ { ++ __ret.field[0] = value; ++ if (__space) ++ { ++ __ret.field[1] = space; ++ __ret.field[2] = sign; ++ __ret.field[3] = symbol; ++ } ++ else ++ { ++ __ret.field[1] = sign; ++ __ret.field[2] = symbol; ++ __ret.field[3] = none; ++ } ++ } ++ break; ++ case 4: ++ // 4 The sign immediately follows the symbol. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = sign; ++ if (__space) ++ { ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[2] = value; ++ __ret.field[3] = none; ++ } ++ } ++ else ++ { ++ __ret.field[0] = value; ++ if (__space) ++ { ++ __ret.field[1] = space; ++ __ret.field[2] = symbol; ++ __ret.field[3] = sign; ++ } ++ else ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = sign; ++ __ret.field[3] = none; ++ } ++ } ++ break; ++ default: ++ __ret = pattern(); ++ } ++ return __ret; ++ } ++ ++ template<> ++ void ++ moneypunct::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::~moneypunct() ++ { delete _M_data; } ++ ++ template<> ++ moneypunct::~moneypunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ moneypunct::_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; ++ ++ 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(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::_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; ++ ++ 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(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::~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::~moneypunct() ++ { ++ if (_M_data->_M_positive_sign_size) ++ delete [] _M_data->_M_positive_sign; ++ if (_M_data->_M_negative_sign_size ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0) ++ delete [] _M_data->_M_negative_sign; ++ if (_M_data->_M_curr_symbol_size) ++ delete [] _M_data->_M_curr_symbol; ++ delete _M_data; ++ } ++#endif ++} +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2005-04-28 01:20:20.000000000 -0500 +@@ -0,0 +1,173 @@ ++// std::numpunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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::~numpunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ numpunct::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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(__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(__num_base::_S_atoms_in[__j]); ++ } ++ else ++ { ++ // Named locale. ++ // NB: In the GNU model wchar_t is always 32 bit wide. ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# else ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ ++ if (_M_data->_M_thousands_sep == L'\0') ++ _M_data->_M_grouping = ""; ++ else ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ } ++ ++ // NB: There is no way to extact this info from posix locales. ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); ++ _M_data->_M_truename = L"true"; ++ _M_data->_M_truename_size = 4; ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); ++ _M_data->_M_falsename = L"false"; ++ _M_data->_M_falsename_size = 5; ++ } ++ ++ template<> ++ numpunct::~numpunct() ++ { delete _M_data; } ++ #endif ++} +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.cc +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.cc 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.cc 2005-04-28 01:13:15.000000000 -0500 +@@ -0,0 +1,406 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++#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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++ 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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++#warning wide time stuff ++// if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = L"%m/%d/%y"; ++ _M_data->_M_date_era_format = L"%m/%d/%y"; ++ _M_data->_M_time_format = L"%H:%M:%S"; ++ _M_data->_M_time_era_format = L"%H:%M:%S"; ++ _M_data->_M_date_time_format = L""; ++ _M_data->_M_date_time_era_format = L""; ++ _M_data->_M_am = L"AM"; ++ _M_data->_M_pm = L"PM"; ++ _M_data->_M_am_pm_format = L""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = L"Sunday"; ++ _M_data->_M_day2 = L"Monday"; ++ _M_data->_M_day3 = L"Tuesday"; ++ _M_data->_M_day4 = L"Wednesday"; ++ _M_data->_M_day5 = L"Thursday"; ++ _M_data->_M_day6 = L"Friday"; ++ _M_data->_M_day7 = L"Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = L"Sun"; ++ _M_data->_M_aday2 = L"Mon"; ++ _M_data->_M_aday3 = L"Tue"; ++ _M_data->_M_aday4 = L"Wed"; ++ _M_data->_M_aday5 = L"Thu"; ++ _M_data->_M_aday6 = L"Fri"; ++ _M_data->_M_aday7 = L"Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = L"January"; ++ _M_data->_M_month02 = L"February"; ++ _M_data->_M_month03 = L"March"; ++ _M_data->_M_month04 = L"April"; ++ _M_data->_M_month05 = L"May"; ++ _M_data->_M_month06 = L"June"; ++ _M_data->_M_month07 = L"July"; ++ _M_data->_M_month08 = L"August"; ++ _M_data->_M_month09 = L"September"; ++ _M_data->_M_month10 = L"October"; ++ _M_data->_M_month11 = L"November"; ++ _M_data->_M_month12 = L"December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = L"Jan"; ++ _M_data->_M_amonth02 = L"Feb"; ++ _M_data->_M_amonth03 = L"Mar"; ++ _M_data->_M_amonth04 = L"Apr"; ++ _M_data->_M_amonth05 = L"May"; ++ _M_data->_M_amonth06 = L"Jun"; ++ _M_data->_M_amonth07 = L"Jul"; ++ _M_data->_M_amonth08 = L"Aug"; ++ _M_data->_M_amonth09 = L"Sep"; ++ _M_data->_M_amonth10 = L"Oct"; ++ _M_data->_M_amonth11 = L"Nov"; ++ _M_data->_M_amonth12 = L"Dec"; ++ } ++#if 0 ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ union { char *__s; wchar_t *__w; } __u; ++ ++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); ++ _M_data->_M_date_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); ++ _M_data->_M_date_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); ++ _M_data->_M_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); ++ _M_data->_M_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); ++ _M_data->_M_date_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); ++ _M_data->_M_date_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); ++ _M_data->_M_am = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); ++ _M_data->_M_pm = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); ++ _M_data->_M_am_pm_format = __u.__w; ++ ++ // Day names, starting with "C"'s Sunday. ++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); ++ _M_data->_M_day1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); ++ _M_data->_M_day2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); ++ _M_data->_M_day3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); ++ _M_data->_M_day4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); ++ _M_data->_M_day5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); ++ _M_data->_M_day6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); ++ _M_data->_M_day7 = __u.__w; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); ++ _M_data->_M_aday1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); ++ _M_data->_M_aday2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); ++ _M_data->_M_aday3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); ++ _M_data->_M_aday4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); ++ _M_data->_M_aday5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); ++ _M_data->_M_aday6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); ++ _M_data->_M_aday7 = __u.__w; ++ ++ // Month names, starting with "C"'s January. ++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); ++ _M_data->_M_month01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); ++ _M_data->_M_month02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); ++ _M_data->_M_month03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); ++ _M_data->_M_month04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); ++ _M_data->_M_month05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); ++ _M_data->_M_month06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); ++ _M_data->_M_month07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); ++ _M_data->_M_month08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); ++ _M_data->_M_month09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); ++ _M_data->_M_month10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); ++ _M_data->_M_month11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); ++ _M_data->_M_month12 = __u.__w; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); ++ _M_data->_M_amonth01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); ++ _M_data->_M_amonth02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); ++ _M_data->_M_amonth03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); ++ _M_data->_M_amonth04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); ++ _M_data->_M_amonth05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); ++ _M_data->_M_amonth06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); ++ _M_data->_M_amonth07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); ++ _M_data->_M_amonth08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); ++ _M_data->_M_amonth09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); ++ _M_data->_M_amonth10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); ++ _M_data->_M_amonth11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); ++ _M_data->_M_amonth12 = __u.__w; ++ } ++#endif // 0 ++ } ++#endif ++} +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.h 2004-05-22 18:46:31.000000000 -0500 +@@ -0,0 +1,68 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put functions ++// ++ ++// Written by Benjamin Kosnik ++ ++ template ++ __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 ++ __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 ++ __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 ++ __timepunct<_CharT>::~__timepunct() ++ { ++ if (_M_name_timepunct != _S_get_c_name()) ++ delete [] _M_name_timepunct; ++ delete _M_data; ++ _S_destroy_c_locale(_M_c_locale_timepunct); ++ } +diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_base.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_base.h +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_base.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_base.h 2005-04-28 01:10:27.000000000 -0500 +@@ -0,0 +1,64 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++/** @file ctype_base.h ++ * This is an internal header file, included by other library headers. ++ * You should not attempt to use it directly. ++ */ ++ ++// Information as gleaned from /usr/include/ctype.h ++ ++ /// @brief Base class for ctype. ++ struct ctype_base ++ { ++ // Note: In uClibc, the following two types depend on configuration. ++ ++ // Non-standard typedefs. ++ typedef const __ctype_touplow_t* __to_type; ++ ++ // NB: Offsets into ctype::_M_table force a particular size ++ // on the mask type. Because of this, we don't use an enum. ++ typedef __ctype_mask_t mask; ++ static const mask upper = _ISupper; ++ static const mask lower = _ISlower; ++ static const mask alpha = _ISalpha; ++ static const mask digit = _ISdigit; ++ static const mask xdigit = _ISxdigit; ++ static const mask space = _ISspace; ++ static const mask print = _ISprint; ++ static const mask graph = _ISalpha | _ISdigit | _ISpunct; ++ static const mask cntrl = _IScntrl; ++ static const mask punct = _ISpunct; ++ static const mask alnum = _ISalpha | _ISdigit; ++ }; +diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_inline.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_inline.h +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_inline.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_inline.h 2002-06-24 00:49:19.000000000 -0500 +@@ -0,0 +1,69 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 2000, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) ++// functions go in ctype.cc ++ ++ bool ++ ctype:: ++ is(mask __m, char __c) const ++ { return _M_table[static_cast(__c)] & __m; } ++ ++ const char* ++ ctype:: ++ is(const char* __low, const char* __high, mask* __vec) const ++ { ++ while (__low < __high) ++ *__vec++ = _M_table[static_cast(*__low++)]; ++ return __high; ++ } ++ ++ const char* ++ ctype:: ++ scan_is(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && !(_M_table[static_cast(*__low)] & __m)) ++ ++__low; ++ return __low; ++ } ++ ++ const char* ++ ctype:: ++ scan_not(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && (_M_table[static_cast(*__low)] & __m) != 0) ++ ++__low; ++ return __low; ++ } +diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_noninline.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2005-04-28 01:10:27.000000000 -0500 +@@ -0,0 +1,92 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// Information as gleaned from /usr/include/ctype.h ++ ++ const ctype_base::mask* ++ ctype::classic_table() throw() ++ { return __C_ctype_b; } ++ ++ ctype::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::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::do_toupper(char __c) const ++ { return _M_toupper[static_cast(__c)]; } ++ ++ const char* ++ ctype::do_toupper(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_toupper[static_cast(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } ++ ++ char ++ ctype::do_tolower(char __c) const ++ { return _M_tolower[static_cast(__c)]; } ++ ++ const char* ++ ctype::do_tolower(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_tolower[static_cast(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } +diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/os_defines.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/os_defines.h +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/os_defines.h 1969-12-31 18:00:00.000000000 -0600 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/os_defines.h 2005-04-28 01:10:27.000000000 -0500 +@@ -0,0 +1,44 @@ ++// Specific definitions for GNU/Linux -*- C++ -*- ++ ++// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++#ifndef _GLIBCXX_OS_DEFINES ++#define _GLIBCXX_OS_DEFINES 1 ++ ++// System-specific #define, typedefs, corrections, etc, go here. This ++// file will come before all others. ++ ++// This keeps isanum, et al from being propagated as macros. ++#define __NO_CTYPE 1 ++ ++#include ++ ++// We must not see the optimized string functions GNU libc defines. ++#define __NO_STRING_INLINES ++ ++#endif +diff -urN gcc-4.0.0-100/libstdc++-v3/configure gcc-4.0.0/libstdc++-v3/configure +--- gcc-4.0.0-100/libstdc++-v3/configure 2005-04-30 13:06:53.683055232 -0500 ++++ gcc-4.0.0/libstdc++-v3/configure 2005-04-30 12:24:24.000000000 -0500 +@@ -3998,6 +3998,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +@@ -5672,7 +5677,7 @@ + enableval="$enable_clocale" + + case "$enableval" in +- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;; ++ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;; + *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5 + echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;} + { (exit 1); exit 1; }; } ;; +@@ -5697,6 +5702,9 @@ + # Default to "generic". + if test $enable_clocale_flag = auto; then + case ${target_os} in ++ linux-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ +@@ -5927,6 +5935,76 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ echo "$as_me:$LINENO: result: uclibc" >&5 ++echo "${ECHO_T}uclibc" >&6 ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ # Extract the first word of "msgfmt", so it can be a program name with args. ++set dummy msgfmt; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test -n "$check_msgfmt"; then ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_check_msgfmt="yes" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" ++fi ++fi ++check_msgfmt=$ac_cv_prog_check_msgfmt ++if test -n "$check_msgfmt"; then ++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 ++echo "${ECHO_T}$check_msgfmt" >&6 ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ ++ ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -urN gcc-4.0.0-100/libstdc++-v3/configure.host gcc-4.0.0/libstdc++-v3/configure.host +--- gcc-4.0.0-100/libstdc++-v3/configure.host 2005-04-30 13:06:53.688054472 -0500 ++++ gcc-4.0.0/libstdc++-v3/configure.host 2005-04-28 20:20:32.000000000 -0500 +@@ -249,6 +249,12 @@ + ;; + esac + ++# Override for uClibc since linux-uclibc gets mishandled above. ++case "${host_os}" in ++ *-uclibc*) ++ os_include_dir="os/uclibc" ++ ;; ++esac + + # Set any OS-dependent and CPU-dependent bits. + # THIS TABLE IS SORTED. KEEP IT THAT WAY. +diff -urN gcc-4.0.0-100/libstdc++-v3/crossconfig.m4 gcc-4.0.0/libstdc++-v3/crossconfig.m4 +--- gcc-4.0.0-100/libstdc++-v3/crossconfig.m4 2005-04-30 13:06:53.689054320 -0500 ++++ gcc-4.0.0/libstdc++-v3/crossconfig.m4 2005-04-28 20:27:15.000000000 -0500 +@@ -142,6 +142,98 @@ + ;; + esac + ;; ++ *-uclibc*) ++# Temporary hack until we implement the float versions of the libm funcs ++ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ ++ machine/endian.h machine/param.h sys/machine.h sys/types.h \ ++ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h]) ++ SECTION_FLAGS='-ffunction-sections -fdata-sections' ++ AC_SUBST(SECTION_FLAGS) ++ GLIBCXX_CHECK_LINKER_FEATURES ++ GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT ++ GLIBCXX_CHECK_WCHAR_T_SUPPORT ++ ++ # For LFS. ++ AC_DEFINE(HAVE_INT64_T) ++ case "$target" in ++ *-uclinux*) ++ # Don't enable LFS with uClinux ++ ;; ++ *) ++ AC_DEFINE(_GLIBCXX_USE_LFS) ++ esac ++ ++ # For showmanyc_helper(). ++ AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) ++ GLIBCXX_CHECK_POLL ++ GLIBCXX_CHECK_S_ISREG_OR_S_IFREG ++ ++ # For xsputn_2(). ++ AC_CHECK_HEADERS(sys/uio.h) ++ GLIBCXX_CHECK_WRITEV ++ ++# AC_DEFINE(HAVE_ACOSF) ++# AC_DEFINE(HAVE_ASINF) ++# AC_DEFINE(HAVE_ATANF) ++# AC_DEFINE(HAVE_ATAN2F) ++ AC_DEFINE(HAVE_CEILF) ++ AC_DEFINE(HAVE_COPYSIGN) ++# AC_DEFINE(HAVE_COPYSIGNF) ++# AC_DEFINE(HAVE_COSF) ++# AC_DEFINE(HAVE_COSHF) ++# AC_DEFINE(HAVE_EXPF) ++# AC_DEFINE(HAVE_FABSF) ++ AC_DEFINE(HAVE_FINITE) ++ AC_DEFINE(HAVE_FINITEF) ++ AC_DEFINE(HAVE_FLOORF) ++# AC_DEFINE(HAVE_FMODF) ++# AC_DEFINE(HAVE_FREXPF) ++ AC_DEFINE(HAVE_HYPOT) ++# AC_DEFINE(HAVE_HYPOTF) ++ AC_DEFINE(HAVE_ISINF) ++ AC_DEFINE(HAVE_ISINFF) ++ AC_DEFINE(HAVE_ISNAN) ++ AC_DEFINE(HAVE_ISNANF) ++# AC_DEFINE(HAVE_LOGF) ++# AC_DEFINE(HAVE_LOG10F) ++# AC_DEFINE(HAVE_MODFF) ++# AC_DEFINE(HAVE_SINF) ++# AC_DEFINE(HAVE_SINHF) ++# AC_DEFINE(HAVE_SINCOS) ++# AC_DEFINE(HAVE_SINCOSF) ++ AC_DEFINE(HAVE_SQRTF) ++# AC_DEFINE(HAVE_TANF) ++# AC_DEFINE(HAVE_TANHF) ++ if test x"long_double_math_on_this_cpu" = x"yes"; then ++# AC_DEFINE(HAVE_ACOSL) ++# AC_DEFINE(HAVE_ASINL) ++# AC_DEFINE(HAVE_ATANL) ++# AC_DEFINE(HAVE_ATAN2L) ++# AC_DEFINE(HAVE_CEILL) ++# AC_DEFINE(HAVE_COPYSIGNL) ++# AC_DEFINE(HAVE_COSL) ++# AC_DEFINE(HAVE_COSHL) ++# AC_DEFINE(HAVE_EXPL) ++# AC_DEFINE(HAVE_FABSL) ++# AC_DEFINE(HAVE_FINITEL) ++# AC_DEFINE(HAVE_FLOORL) ++# AC_DEFINE(HAVE_FMODL) ++# AC_DEFINE(HAVE_FREXPL) ++# AC_DEFINE(HAVE_HYPOTL) ++# AC_DEFINE(HAVE_ISINFL) ++# AC_DEFINE(HAVE_ISNANL) ++# AC_DEFINE(HAVE_LOGL) ++# AC_DEFINE(HAVE_LOG10L) ++# AC_DEFINE(HAVE_MODFL) ++# AC_DEFINE(HAVE_POWL) ++# AC_DEFINE(HAVE_SINL) ++# AC_DEFINE(HAVE_SINHL) ++# AC_DEFINE(HAVE_SINCOSL) ++# AC_DEFINE(HAVE_SQRTL) ++# AC_DEFINE(HAVE_TANL) ++# AC_DEFINE(HAVE_TANHL) ++ fi ++ ;; + *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu) + AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ + machine/endian.h machine/param.h sys/machine.h sys/types.h \ +@@ -156,7 +248,7 @@ + AC_DEFINE(HAVE_INT64_T) + case "$target" in + *-uclinux*) +- # Don't enable LFS with uClibc ++ # Don't enable LFS with uClinux + ;; + *) + AC_DEFINE(_GLIBCXX_USE_LFS) +diff -urN gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h +--- gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h 2005-04-30 13:06:53.690054168 -0500 ++++ gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h 2005-04-28 20:15:56.000000000 -0500 +@@ -101,7 +101,9 @@ + using std::wmemcpy; + using std::wmemmove; + using std::wmemset; ++#if _GLIBCXX_HAVE_WCSFTIME + using std::wcsftime; ++#endif + + #if _GLIBCXX_USE_C99 + using std::wcstold; +diff -urN gcc-4.0.0-100/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.0.0/libstdc++-v3/include/c_std/std_cwchar.h +--- gcc-4.0.0-100/libstdc++-v3/include/c_std/std_cwchar.h 2005-04-30 13:06:53.691054016 -0500 ++++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cwchar.h 2005-04-28 20:15:56.000000000 -0500 +@@ -179,7 +179,9 @@ + using ::wcscoll; + using ::wcscpy; + using ::wcscspn; ++#if _GLIBCXX_HAVE_WCSFTIME + using ::wcsftime; ++#endif + using ::wcslen; + using ::wcsncat; + using ::wcsncmp; diff --git a/patches/gcc/4.0.4/120-libstdc++-pic.patch b/patches/gcc/4.0.4/120-libstdc++-pic.patch new file mode 100644 index 0000000..a9d6e71 --- /dev/null +++ b/patches/gcc/4.0.4/120-libstdc++-pic.patch @@ -0,0 +1,45 @@ +--- gcc-4.0.0/libstdc++-v3/src/Makefile.am ++++ gcc-4.0.0/libstdc++-v3/src/Makefile.am +@@ -214,6 +214,10 @@ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ + + ++install-exec-local: ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++ + # Added bits to build debug library. + if GLIBCXX_BUILD_DEBUG + all-local: build_debug +--- gcc-4.0.0/libstdc++-v3/src/Makefile.in ++++ gcc-4.0.0/libstdc++-v3/src/Makefile.in +@@ -625,7 +625,7 @@ + + install-data-am: install-data-local + +-install-exec-am: install-toolexeclibLTLIBRARIES ++install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local + + install-info: install-info-am + +@@ -664,7 +664,7 @@ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ +- uninstall-toolexeclibLTLIBRARIES ++ uninstall-toolexeclibLTLIBRARIES install-exec-local + + @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP) + @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver +@@ -743,6 +743,11 @@ + install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ++ ++install-exec-local: ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff --git a/patches/gcc/4.0.4/130-missing-execinfo_h.patch b/patches/gcc/4.0.4/130-missing-execinfo_h.patch new file mode 100644 index 0000000..0e2092f --- /dev/null +++ b/patches/gcc/4.0.4/130-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 + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/patches/gcc/4.0.4/140-c99-snprintf.patch b/patches/gcc/4.0.4/140-c99-snprintf.patch new file mode 100644 index 0000000..dfb22d6 --- /dev/null +++ b/patches/gcc/4.0.4/140-c99-snprintf.patch @@ -0,0 +1,11 @@ +--- gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h-orig 2005-04-29 00:08:41.000000000 -0500 ++++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h 2005-04-29 00:08:45.000000000 -0500 +@@ -142,7 +142,7 @@ + using ::vsprintf; + } + +-#if _GLIBCXX_USE_C99 ++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf diff --git a/patches/gcc/4.0.4/150-c99-complex-ugly-hack.patch b/patches/gcc/4.0.4/150-c99-complex-ugly-hack.patch new file mode 100644 index 0000000..2ccc80d --- /dev/null +++ b/patches/gcc/4.0.4/150-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 ++#ifdef __UCLIBC__ ++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs ++#endif + int + main () + { diff --git a/patches/gcc/4.0.4/160-index_macro.patch b/patches/gcc/4.0.4/160-index_macro.patch new file mode 100644 index 0000000..1fac112 --- /dev/null +++ b/patches/gcc/4.0.4/160-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 + #include + ++/* 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 // For uninitialized_copy_n + #include // For power + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + namespace __gnu_cxx + { + using std::size_t; diff --git a/patches/gcc/4.0.4/170-libmudflap-susv3-legacy.patch b/patches/gcc/4.0.4/170-libmudflap-susv3-legacy.patch new file mode 100644 index 0000000..374b1f8 --- /dev/null +++ b/patches/gcc/4.0.4/170-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/patches/gcc/4.0.4/180-sdk-libstdc++-includes.patch b/patches/gcc/4.0.4/180-sdk-libstdc++-includes.patch new file mode 100644 index 0000000..c7676ae --- /dev/null +++ b/patches/gcc/4.0.4/180-sdk-libstdc++-includes.patch @@ -0,0 +1,22 @@ +diff -urN gcc-4.0.0-100/libstdc++-v3/fragment.am gcc-4.0.0/libstdc++-v3/fragment.am +--- gcc-4.0.0-100/libstdc++-v3/fragment.am 2004-10-25 15:32:40.000000000 -0500 ++++ gcc-4.0.0/libstdc++-v3/fragment.am 2005-04-28 21:48:43.000000000 -0500 +@@ -18,5 +18,5 @@ + $(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once + + # -I/-D flags to pass when compiling. +-AM_CPPFLAGS = $(GLIBCXX_INCLUDES) ++AM_CPPFLAGS = $(GLIBCXX_INCLUDES) -I$(toplevel_srcdir)/include + +diff -urN gcc-4.0.0-100/libstdc++-v3/libmath/Makefile.am gcc-4.0.0/libstdc++-v3/libmath/Makefile.am +--- gcc-4.0.0-100/libstdc++-v3/libmath/Makefile.am 2003-08-27 16:29:42.000000000 -0500 ++++ gcc-4.0.0/libstdc++-v3/libmath/Makefile.am 2005-04-28 21:48:43.000000000 -0500 +@@ -32,7 +32,7 @@ + + libmath_la_SOURCES = stubs.c + +-AM_CPPFLAGS = $(CANADIAN_INCLUDES) ++AM_CPPFLAGS = $(CANADIAN_INCLUDES) -I$(toplevel_srcdir)/include + + # Only compiling "C" sources in this directory. + LIBTOOL = @LIBTOOL@ --tag CC diff --git a/patches/gcc/4.0.4/190-arm-bigendian.patch b/patches/gcc/4.0.4/190-arm-bigendian.patch new file mode 100644 index 0000000..fd2c9bf --- /dev/null +++ b/patches/gcc/4.0.4/190-arm-bigendian.patch @@ -0,0 +1,65 @@ +diff -dur gcc-4.0.4.orig/gcc/config/arm/linux-elf.h gcc-4.0.4/gcc/config/arm/linux-elf.h +--- gcc-4.0.4.orig/gcc/config/arm/linux-elf.h 2007-02-02 19:24:50.000000000 +0100 ++++ gcc-4.0.4/gcc/config/arm/linux-elf.h 2007-02-02 19:26:12.000000000 +0100 +@@ -31,19 +31,33 @@ + /* Do not assume anything about header files. */ + #define NO_IMPLICIT_EXTERN_C + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END ++#define TARGET_ENDIAN_OPTION "mbig-endian" ++#define TARGET_LINKER_EMULATION "armelfb_linux" ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#define TARGET_ENDIAN_OPTION "mlittle-endian" ++#define TARGET_LINKER_EMULATION "armelf_linux" ++#endif ++ + #undef TARGET_DEFAULT_FLOAT_ABI + #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD + + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (0) ++#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT) + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" } + + /* The GNU C++ standard library requires that these macros be defined. */ + #undef CPLUSPLUS_CPP_SPEC +@@ -95,7 +109,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #define TARGET_OS_CPP_BUILTINS() \ +Only in gcc-4.0.4/gcc/config/arm: linux-elf.h.orig +diff -dur gcc-4.0.4.orig/gcc/config.gcc gcc-4.0.4/gcc/config.gcc +--- gcc-4.0.4.orig/gcc/config.gcc 2007-02-02 19:24:50.000000000 +0100 ++++ gcc-4.0.4/gcc/config.gcc 2007-02-02 19:26:12.000000000 +0100 +@@ -672,6 +672,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h" ++ case $target in ++ arm*b-*) ++ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" ++ ;; ++ esac + tmake_file="${tmake_file} arm/t-arm arm/t-linux" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes diff --git a/patches/gcc/4.0.4/200-arm-softfloat.patch b/patches/gcc/4.0.4/200-arm-softfloat.patch new file mode 100644 index 0000000..1965a8a --- /dev/null +++ b/patches/gcc/4.0.4/200-arm-softfloat.patch @@ -0,0 +1,15 @@ +Enable building a pure soft-float compiler without the need for a software +floating point library. + +diff -dur gcc-4.0.4.orig/gcc/config.gcc gcc-4.0.4/gcc/config.gcc +--- gcc-4.0.4.orig/gcc/config.gcc 2007-02-02 19:12:28.000000000 +0100 ++++ gcc-4.0.4/gcc/config.gcc 2007-02-02 19:12:07.000000000 +0100 +@@ -677,7 +677,7 @@ + tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" + ;; + esac +- tmake_file="${tmake_file} arm/t-arm arm/t-linux" ++ tmake_file="${tmake_file} arm/t-arm arm/t-linux arm/t-arm-elf" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + gnu_ld=yes + ;; diff --git a/patches/gcc/4.0.4/200-uclibc-locale.patch b/patches/gcc/4.0.4/200-uclibc-locale.patch deleted file mode 100644 index ac4cf97..0000000 --- a/patches/gcc/4.0.4/200-uclibc-locale.patch +++ /dev/null @@ -1,3237 +0,0 @@ -diff -urN gcc-4.0.0-100/libstdc++-v3/acinclude.m4 gcc-4.0.0/libstdc++-v3/acinclude.m4 ---- gcc-4.0.0-100/libstdc++-v3/acinclude.m4 2005-04-30 13:06:53.000000000 -0500 -+++ gcc-4.0.0/libstdc++-v3/acinclude.m4 2005-04-28 20:19:01.000000000 -0500 -@@ -1104,7 +1104,7 @@ - AC_MSG_CHECKING([for C locale to use]) - GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], - [use MODEL for target locale package], -- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto]) -+ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto]) - - # If they didn't use this option switch, or if they specified --enable - # with no specific model, we'll have to look for one. If they -@@ -1120,6 +1120,9 @@ - # Default to "generic". - if test $enable_clocale_flag = auto; then - case ${target_os} in -+ *-uclibc*) -+ enable_clocale_flag=uclibc -+ ;; - linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) - AC_EGREP_CPP([_GLIBCXX_ok], [ - #include -@@ -1263,6 +1266,40 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ AC_MSG_RESULT(uclibc) -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ AC_SUBST(glibcxx_MOFILES) -+ AC_SUBST(glibcxx_POFILES) -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2005-04-28 01:13:15.000000000 -0500 -@@ -0,0 +1,59 @@ -+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*- -+ -+// Copyright (C) 2002, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// Written by Jakub Jelinek -+ -+#include -+ -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning clean this up -+#endif -+ -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ -+extern "C" __typeof(iswctype_l) __iswctype_l; -+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l; -+extern "C" __typeof(strcoll_l) __strcoll_l; -+extern "C" __typeof(strftime_l) __strftime_l; -+extern "C" __typeof(strtod_l) __strtod_l; -+extern "C" __typeof(strtof_l) __strtof_l; -+extern "C" __typeof(strtold_l) __strtold_l; -+extern "C" __typeof(strxfrm_l) __strxfrm_l; -+extern "C" __typeof(towlower_l) __towlower_l; -+extern "C" __typeof(towupper_l) __towupper_l; -+extern "C" __typeof(wcscoll_l) __wcscoll_l; -+extern "C" __typeof(wcsftime_l) __wcsftime_l; -+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l; -+extern "C" __typeof(wctype_l) __wctype_l; -+extern "C" __typeof(newlocale) __newlocale; -+extern "C" __typeof(freelocale) __freelocale; -+extern "C" __typeof(duplocale) __duplocale; -+extern "C" __typeof(uselocale) __uselocale; -+ -+#endif // GLIBC 2.3 and later -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.cc 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.cc 2005-04-28 01:13:15.000000000 -0500 -@@ -0,0 +1,160 @@ -+// Wrapper for underlying C-language localization -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.8 Standard locale categories. -+// -+ -+// Written by Benjamin Kosnik -+ -+#include // For errno -+#include -+#include -+#include -+#include -+ -+#ifndef __UCLIBC_HAS_XLOCALE__ -+#define __strtol_l(S, E, B, L) strtol((S), (E), (B)) -+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B)) -+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B)) -+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B)) -+#define __strtof_l(S, E, L) strtof((S), (E)) -+#define __strtod_l(S, E, L) strtod((S), (E)) -+#define __strtold_l(S, E, L) strtold((S), (E)) -+#warning should dummy __newlocale check for C|POSIX ? -+#define __newlocale(a, b, c) NULL -+#define __freelocale(a) ((void)0) -+#define __duplocale(a) __c_locale() -+#endif -+ -+namespace std -+{ -+ template<> -+ void -+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, -+ const __c_locale& __cloc) -+ { -+ if (!(__err & ios_base::failbit)) -+ { -+ char* __sanity; -+ errno = 0; -+ float __f = __strtof_l(__s, &__sanity, __cloc); -+ if (__sanity != __s && errno != ERANGE) -+ __v = __f; -+ else -+ __err |= ios_base::failbit; -+ } -+ } -+ -+ template<> -+ void -+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, -+ const __c_locale& __cloc) -+ { -+ if (!(__err & ios_base::failbit)) -+ { -+ char* __sanity; -+ errno = 0; -+ double __d = __strtod_l(__s, &__sanity, __cloc); -+ if (__sanity != __s && errno != ERANGE) -+ __v = __d; -+ else -+ __err |= ios_base::failbit; -+ } -+ } -+ -+ template<> -+ void -+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err, -+ const __c_locale& __cloc) -+ { -+ if (!(__err & ios_base::failbit)) -+ { -+ char* __sanity; -+ errno = 0; -+ long double __ld = __strtold_l(__s, &__sanity, __cloc); -+ if (__sanity != __s && errno != ERANGE) -+ __v = __ld; -+ else -+ __err |= ios_base::failbit; -+ } -+ } -+ -+ void -+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, -+ __c_locale __old) -+ { -+ __cloc = __newlocale(1 << LC_ALL, __s, __old); -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ if (!__cloc) -+ { -+ // This named locale is not supported by the underlying OS. -+ __throw_runtime_error(__N("locale::facet::_S_create_c_locale " -+ "name not valid")); -+ } -+#endif -+ } -+ -+ void -+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc) -+ { -+ if (_S_get_c_locale() != __cloc) -+ __freelocale(__cloc); -+ } -+ -+ __c_locale -+ locale::facet::_S_clone_c_locale(__c_locale& __cloc) -+ { return __duplocale(__cloc); } -+} // namespace std -+ -+namespace __gnu_cxx -+{ -+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] = -+ { -+ "LC_CTYPE", -+ "LC_NUMERIC", -+ "LC_TIME", -+ "LC_COLLATE", -+ "LC_MONETARY", -+ "LC_MESSAGES", -+#if _GLIBCXX_NUM_CATEGORIES != 0 -+ "LC_PAPER", -+ "LC_NAME", -+ "LC_ADDRESS", -+ "LC_TELEPHONE", -+ "LC_MEASUREMENT", -+ "LC_IDENTIFICATION" -+#endif -+ }; -+} -+ -+namespace std -+{ -+ const char* const* const locale::_S_categories = __gnu_cxx::category_names; -+} // namespace std -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.h 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.h 2005-04-28 01:13:15.000000000 -0500 -@@ -0,0 +1,115 @@ -+// Wrapper for underlying C-language localization -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.8 Standard locale categories. -+// -+ -+// Written by Benjamin Kosnik -+ -+#ifndef _C_LOCALE_H -+#define _C_LOCALE_H 1 -+ -+#pragma GCC system_header -+ -+#include // get std::strlen -+#include // get std::snprintf or std::sprintf -+#include -+#include // For codecvt -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this -+#endif -+#ifdef __UCLIBC_HAS_LOCALE__ -+#include // For codecvt using iconv, iconv_t -+#endif -+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ -+#include // 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 -+ int -+ __convert_from_v(char* __out, const int __size, const char* __fmt, -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ _Tv __v, const __c_locale& __cloc, int __prec) -+ { -+ __c_locale __old = __gnu_cxx::__uselocale(__cloc); -+#else -+ _Tv __v, const __c_locale&, int __prec) -+ { -+# ifdef __UCLIBC_HAS_LOCALE__ -+ char* __old = std::setlocale(LC_ALL, NULL); -+ char* __sav = new char[std::strlen(__old) + 1]; -+ std::strcpy(__sav, __old); -+ std::setlocale(LC_ALL, "C"); -+# endif -+#endif -+ -+ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v); -+ -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __gnu_cxx::__uselocale(__old); -+#elif defined __UCLIBC_HAS_LOCALE__ -+ std::setlocale(LC_ALL, __sav); -+ delete [] __sav; -+#endif -+ return __ret; -+ } -+} -+ -+#endif -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2005-04-28 01:13:15.000000000 -0500 -@@ -0,0 +1,306 @@ -+// std::codecvt implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2002, 2003 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.1.5 - Template class codecvt -+// -+ -+// Written by Benjamin Kosnik -+ -+#include -+#include -+ -+namespace std -+{ -+ // Specializations. -+#ifdef _GLIBCXX_USE_WCHAR_T -+ codecvt_base::result -+ codecvt:: -+ 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(-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(__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:: -+ 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(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(-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(-1) -+ || __conv == static_cast(-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:: -+ 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:: -+ 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:: -+ 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(__builtin_alloca(sizeof(wchar_t) -+ * __max)); -+ while (__from < __end && __max) -+ { -+ const extern_type* __from_chunk_end; -+ __from_chunk_end = static_cast(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(-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(-1) -+ || __conv == static_cast(-2)) -+ break; -+ } -+ __state = __tmp_state; -+ __ret += __from - __tmp_from; -+ break; -+ } -+ if (!__from) -+ __from = __from_chunk_end; -+ -+ __ret += __from - __tmp_from; -+ __max -= __conv; -+ -+ if (__from < __end && __max) -+ { -+ // XXX Probably wrong for stateful encodings -+ __tmp_state = __state; -+ ++__from; -+ ++__ret; -+ --__max; -+ } -+ } -+ -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ -+ return __ret; -+ } -+#endif -+} -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/collate_members.cc ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/collate_members.cc 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/collate_members.cc 2005-04-28 01:13:15.000000000 -0500 -@@ -0,0 +1,80 @@ -+// std::collate implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#include -+#include -+ -+#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::_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::_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::_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::_M_transform(wchar_t* __to, const wchar_t* __from, -+ size_t __n) const -+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); } -+#endif -+} -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2005-04-28 01:13:15.000000000 -0500 -@@ -0,0 +1,300 @@ -+// std::ctype implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions. -+// -+ -+// Written by Benjamin Kosnik -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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 specializations are in src/locale.cc and -+ // various /config/os/* files. -+ template<> -+ ctype_byname::ctype_byname(const char* __s, size_t __refs) -+ : ctype(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::__wmask_type -+ ctype::_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::do_toupper(wchar_t __c) const -+ { return __towupper_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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::do_tolower(wchar_t __c) const -+ { return __towlower_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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:: -+ 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:: -+ 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:: -+ 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:: -+ 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:: -+ do_widen(char __c) const -+ { return _M_widen[static_cast(__c)]; } -+ -+ const char* -+ ctype:: -+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const -+ { -+ while (__lo < __hi) -+ { -+ *__dest = _M_widen[static_cast(*__lo)]; -+ ++__lo; -+ ++__dest; -+ } -+ return __hi; -+ } -+ -+ char -+ ctype:: -+ 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(__c)); -+ } -+ -+ const wchar_t* -+ ctype:: -+ 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(__c)); -+ } -+ ++__lo; -+ ++__dest; -+ } -+ else -+ while (__lo < __hi) -+ { -+ const int __c = wctob(*__lo); -+ *__dest = (__c == EOF ? __dfault : static_cast(__c)); -+ ++__lo; -+ ++__dest; -+ } -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ return __hi; -+ } -+ -+ void -+ ctype::_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(__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(_ISbit(__k)); -+ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]); -+ } -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ } -+#endif // _GLIBCXX_USE_WCHAR_T -+} -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.cc ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.cc 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.cc 2005-04-28 01:13:15.000000000 -0500 -@@ -0,0 +1,100 @@ -+// std::messages implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#include -+#include -+ -+#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::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(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::do_get(catalog, int, int, const wstring& __dfault) const -+ { -+# ifdef __UCLIBC_HAS_XLOCALE__ -+ __c_locale __old = __uselocale(_M_c_locale_messages); -+ char* __msg = gettext(_M_convert_to_char(__dfault)); -+ __uselocale(__old); -+ return _M_convert_from_char(__msg); -+# elif defined __UCLIBC_HAS_LOCALE__ -+ char* __old = strdup(setlocale(LC_ALL, NULL)); -+ setlocale(LC_ALL, _M_name_messages); -+ char* __msg = gettext(_M_convert_to_char(__dfault)); -+ setlocale(LC_ALL, __old); -+ free(__old); -+ return _M_convert_from_char(__msg); -+# else -+ char* __msg = gettext(_M_convert_to_char(__dfault)); -+ return _M_convert_from_char(__msg); -+# endif -+ } -+#endif -+} -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.h 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2005-04-28 01:13:15.000000000 -0500 -@@ -0,0 +1,118 @@ -+// std::messages implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.7.1.2 messages functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#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 -+ messages<_CharT>::messages(size_t __refs) -+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), -+ _M_name_messages(_S_get_c_name()) -+ { } -+ -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::open(const basic_string& __s, const locale& __loc, -+ const char* __dir) const -+ { -+ __bindtextdomain(__s.c_str(), __dir); -+ return this->do_open(__s, __loc); -+ } -+ -+ // Virtual member functions. -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::do_open(const basic_string& __s, -+ const locale&) const -+ { -+ // No error checking is done, assume the catalog exists and can -+ // be used. -+ __textdomain(__s.c_str()); -+ return 0; -+ } -+ -+ template -+ void -+ messages<_CharT>::do_close(catalog) const -+ { } -+ -+ // messages_byname -+ template -+ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) -+ : messages<_CharT>(__refs) -+ { -+ if (this->_M_name_messages != locale::facet::_S_get_c_name()) -+ delete [] this->_M_name_messages; -+ char* __tmp = new char[std::strlen(__s) + 1]; -+ std::strcpy(__tmp, __s); -+ this->_M_name_messages = __tmp; -+ -+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) -+ { -+ this->_S_destroy_c_locale(this->_M_c_locale_messages); -+ this->_S_create_c_locale(this->_M_c_locale_messages, __s); -+ } -+ } -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2005-04-28 01:23:02.000000000 -0500 -@@ -0,0 +1,692 @@ -+// std::moneypunct implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning optimize this for uclibc -+#warning tailor for stub locale support -+#endif -+ -+#ifndef __UCLIBC_HAS_XLOCALE__ -+#define __nl_langinfo_l(N, L) nl_langinfo((N)) -+#endif -+ -+namespace std -+{ -+ // Construct and return valid pattern consisting of some combination of: -+ // space none symbol sign value -+ money_base::pattern -+ money_base::_S_construct_pattern(char __precedes, char __space, char __posn) -+ { -+ pattern __ret; -+ -+ // This insanely complicated routine attempts to construct a valid -+ // pattern for use with monyepunct. A couple of invariants: -+ -+ // if (__precedes) symbol -> value -+ // else value -> symbol -+ -+ // if (__space) space -+ // else none -+ -+ // none == never first -+ // space never first or last -+ -+ // Any elegant implementations of this are welcome. -+ switch (__posn) -+ { -+ case 0: -+ case 1: -+ // 1 The sign precedes the value and symbol. -+ __ret.field[0] = sign; -+ if (__space) -+ { -+ // Pattern starts with sign. -+ if (__precedes) -+ { -+ __ret.field[1] = symbol; -+ __ret.field[3] = value; -+ } -+ else -+ { -+ __ret.field[1] = value; -+ __ret.field[3] = symbol; -+ } -+ __ret.field[2] = space; -+ } -+ else -+ { -+ // Pattern starts with sign and ends with none. -+ if (__precedes) -+ { -+ __ret.field[1] = symbol; -+ __ret.field[2] = value; -+ } -+ else -+ { -+ __ret.field[1] = value; -+ __ret.field[2] = symbol; -+ } -+ __ret.field[3] = none; -+ } -+ break; -+ case 2: -+ // 2 The sign follows the value and symbol. -+ if (__space) -+ { -+ // Pattern either ends with sign. -+ if (__precedes) -+ { -+ __ret.field[0] = symbol; -+ __ret.field[2] = value; -+ } -+ else -+ { -+ __ret.field[0] = value; -+ __ret.field[2] = symbol; -+ } -+ __ret.field[1] = space; -+ __ret.field[3] = sign; -+ } -+ else -+ { -+ // Pattern ends with sign then none. -+ if (__precedes) -+ { -+ __ret.field[0] = symbol; -+ __ret.field[1] = value; -+ } -+ else -+ { -+ __ret.field[0] = value; -+ __ret.field[1] = symbol; -+ } -+ __ret.field[2] = sign; -+ __ret.field[3] = none; -+ } -+ break; -+ case 3: -+ // 3 The sign immediately precedes the symbol. -+ if (__precedes) -+ { -+ __ret.field[0] = sign; -+ __ret.field[1] = symbol; -+ if (__space) -+ { -+ __ret.field[2] = space; -+ __ret.field[3] = value; -+ } -+ else -+ { -+ __ret.field[2] = value; -+ __ret.field[3] = none; -+ } -+ } -+ else -+ { -+ __ret.field[0] = value; -+ if (__space) -+ { -+ __ret.field[1] = space; -+ __ret.field[2] = sign; -+ __ret.field[3] = symbol; -+ } -+ else -+ { -+ __ret.field[1] = sign; -+ __ret.field[2] = symbol; -+ __ret.field[3] = none; -+ } -+ } -+ break; -+ case 4: -+ // 4 The sign immediately follows the symbol. -+ if (__precedes) -+ { -+ __ret.field[0] = symbol; -+ __ret.field[1] = sign; -+ if (__space) -+ { -+ __ret.field[2] = space; -+ __ret.field[3] = value; -+ } -+ else -+ { -+ __ret.field[2] = value; -+ __ret.field[3] = none; -+ } -+ } -+ else -+ { -+ __ret.field[0] = value; -+ if (__space) -+ { -+ __ret.field[1] = space; -+ __ret.field[2] = symbol; -+ __ret.field[3] = sign; -+ } -+ else -+ { -+ __ret.field[1] = symbol; -+ __ret.field[2] = sign; -+ __ret.field[3] = none; -+ } -+ } -+ break; -+ default: -+ __ret = pattern(); -+ } -+ return __ret; -+ } -+ -+ template<> -+ void -+ moneypunct::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::~moneypunct() -+ { delete _M_data; } -+ -+ template<> -+ moneypunct::~moneypunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ moneypunct::_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; -+ -+ 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(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::_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; -+ -+ 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(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::~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::~moneypunct() -+ { -+ if (_M_data->_M_positive_sign_size) -+ delete [] _M_data->_M_positive_sign; -+ if (_M_data->_M_negative_sign_size -+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0) -+ delete [] _M_data->_M_negative_sign; -+ if (_M_data->_M_curr_symbol_size) -+ delete [] _M_data->_M_curr_symbol; -+ delete _M_data; -+ } -+#endif -+} -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2005-04-28 01:20:20.000000000 -0500 -@@ -0,0 +1,173 @@ -+// std::numpunct implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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::~numpunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ numpunct::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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(__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(__num_base::_S_atoms_in[__j]); -+ } -+ else -+ { -+ // Named locale. -+ // NB: In the GNU model wchar_t is always 32 bit wide. -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this -+#endif -+#ifdef __UCLIBC__ -+# ifdef __UCLIBC_HAS_XLOCALE__ -+ _M_data->_M_decimal_point = __cloc->decimal_point_wc; -+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; -+# else -+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; -+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; -+# endif -+#else -+ union { char *__s; wchar_t __w; } __u; -+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc); -+ _M_data->_M_decimal_point = __u.__w; -+ -+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc); -+ _M_data->_M_thousands_sep = __u.__w; -+#endif -+ -+ if (_M_data->_M_thousands_sep == L'\0') -+ _M_data->_M_grouping = ""; -+ else -+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); -+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); -+ } -+ -+ // NB: There is no way to extact this info from posix locales. -+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); -+ _M_data->_M_truename = L"true"; -+ _M_data->_M_truename_size = 4; -+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); -+ _M_data->_M_falsename = L"false"; -+ _M_data->_M_falsename_size = 5; -+ } -+ -+ template<> -+ numpunct::~numpunct() -+ { delete _M_data; } -+ #endif -+} -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.cc ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.cc 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.cc 2005-04-28 01:13:15.000000000 -0500 -@@ -0,0 +1,406 @@ -+// std::time_get, std::time_put implementation, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions -+// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#include -+#include -+ -+#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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+ 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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+#warning wide time stuff -+// if (!__cloc) -+ { -+ // "C" locale -+ _M_c_locale_timepunct = _S_get_c_locale(); -+ -+ _M_data->_M_date_format = L"%m/%d/%y"; -+ _M_data->_M_date_era_format = L"%m/%d/%y"; -+ _M_data->_M_time_format = L"%H:%M:%S"; -+ _M_data->_M_time_era_format = L"%H:%M:%S"; -+ _M_data->_M_date_time_format = L""; -+ _M_data->_M_date_time_era_format = L""; -+ _M_data->_M_am = L"AM"; -+ _M_data->_M_pm = L"PM"; -+ _M_data->_M_am_pm_format = L""; -+ -+ // Day names, starting with "C"'s Sunday. -+ _M_data->_M_day1 = L"Sunday"; -+ _M_data->_M_day2 = L"Monday"; -+ _M_data->_M_day3 = L"Tuesday"; -+ _M_data->_M_day4 = L"Wednesday"; -+ _M_data->_M_day5 = L"Thursday"; -+ _M_data->_M_day6 = L"Friday"; -+ _M_data->_M_day7 = L"Saturday"; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ _M_data->_M_aday1 = L"Sun"; -+ _M_data->_M_aday2 = L"Mon"; -+ _M_data->_M_aday3 = L"Tue"; -+ _M_data->_M_aday4 = L"Wed"; -+ _M_data->_M_aday5 = L"Thu"; -+ _M_data->_M_aday6 = L"Fri"; -+ _M_data->_M_aday7 = L"Sat"; -+ -+ // Month names, starting with "C"'s January. -+ _M_data->_M_month01 = L"January"; -+ _M_data->_M_month02 = L"February"; -+ _M_data->_M_month03 = L"March"; -+ _M_data->_M_month04 = L"April"; -+ _M_data->_M_month05 = L"May"; -+ _M_data->_M_month06 = L"June"; -+ _M_data->_M_month07 = L"July"; -+ _M_data->_M_month08 = L"August"; -+ _M_data->_M_month09 = L"September"; -+ _M_data->_M_month10 = L"October"; -+ _M_data->_M_month11 = L"November"; -+ _M_data->_M_month12 = L"December"; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ _M_data->_M_amonth01 = L"Jan"; -+ _M_data->_M_amonth02 = L"Feb"; -+ _M_data->_M_amonth03 = L"Mar"; -+ _M_data->_M_amonth04 = L"Apr"; -+ _M_data->_M_amonth05 = L"May"; -+ _M_data->_M_amonth06 = L"Jun"; -+ _M_data->_M_amonth07 = L"Jul"; -+ _M_data->_M_amonth08 = L"Aug"; -+ _M_data->_M_amonth09 = L"Sep"; -+ _M_data->_M_amonth10 = L"Oct"; -+ _M_data->_M_amonth11 = L"Nov"; -+ _M_data->_M_amonth12 = L"Dec"; -+ } -+#if 0 -+ else -+ { -+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); -+ -+ union { char *__s; wchar_t *__w; } __u; -+ -+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); -+ _M_data->_M_date_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); -+ _M_data->_M_date_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); -+ _M_data->_M_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); -+ _M_data->_M_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); -+ _M_data->_M_date_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); -+ _M_data->_M_date_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); -+ _M_data->_M_am = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); -+ _M_data->_M_pm = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); -+ _M_data->_M_am_pm_format = __u.__w; -+ -+ // Day names, starting with "C"'s Sunday. -+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); -+ _M_data->_M_day1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); -+ _M_data->_M_day2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); -+ _M_data->_M_day3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); -+ _M_data->_M_day4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); -+ _M_data->_M_day5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); -+ _M_data->_M_day6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); -+ _M_data->_M_day7 = __u.__w; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); -+ _M_data->_M_aday1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); -+ _M_data->_M_aday2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); -+ _M_data->_M_aday3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); -+ _M_data->_M_aday4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); -+ _M_data->_M_aday5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); -+ _M_data->_M_aday6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); -+ _M_data->_M_aday7 = __u.__w; -+ -+ // Month names, starting with "C"'s January. -+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); -+ _M_data->_M_month01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); -+ _M_data->_M_month02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); -+ _M_data->_M_month03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); -+ _M_data->_M_month04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); -+ _M_data->_M_month05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); -+ _M_data->_M_month06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); -+ _M_data->_M_month07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); -+ _M_data->_M_month08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); -+ _M_data->_M_month09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); -+ _M_data->_M_month10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); -+ _M_data->_M_month11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); -+ _M_data->_M_month12 = __u.__w; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); -+ _M_data->_M_amonth01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); -+ _M_data->_M_amonth02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); -+ _M_data->_M_amonth03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); -+ _M_data->_M_amonth04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); -+ _M_data->_M_amonth05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); -+ _M_data->_M_amonth06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); -+ _M_data->_M_amonth07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); -+ _M_data->_M_amonth08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); -+ _M_data->_M_amonth09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); -+ _M_data->_M_amonth10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); -+ _M_data->_M_amonth11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); -+ _M_data->_M_amonth12 = __u.__w; -+ } -+#endif // 0 -+ } -+#endif -+} -diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.h 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.h 2004-05-22 18:46:31.000000000 -0500 -@@ -0,0 +1,68 @@ -+// std::time_get, std::time_put implementation, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.5.1.2 - time_get functions -+// ISO C++ 14882: 22.2.5.3.2 - time_put functions -+// -+ -+// Written by Benjamin Kosnik -+ -+ template -+ __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 -+ __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 -+ __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 -+ __timepunct<_CharT>::~__timepunct() -+ { -+ if (_M_name_timepunct != _S_get_c_name()) -+ delete [] _M_name_timepunct; -+ delete _M_data; -+ _S_destroy_c_locale(_M_c_locale_timepunct); -+ } -diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_base.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_base.h ---- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_base.h 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_base.h 2005-04-28 01:10:27.000000000 -0500 -@@ -0,0 +1,64 @@ -+// Locale support -*- C++ -*- -+ -+// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 -+// Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.1 Locales -+// -+ -+/** @file ctype_base.h -+ * This is an internal header file, included by other library headers. -+ * You should not attempt to use it directly. -+ */ -+ -+// Information as gleaned from /usr/include/ctype.h -+ -+ /// @brief Base class for ctype. -+ struct ctype_base -+ { -+ // Note: In uClibc, the following two types depend on configuration. -+ -+ // Non-standard typedefs. -+ typedef const __ctype_touplow_t* __to_type; -+ -+ // NB: Offsets into ctype::_M_table force a particular size -+ // on the mask type. Because of this, we don't use an enum. -+ typedef __ctype_mask_t mask; -+ static const mask upper = _ISupper; -+ static const mask lower = _ISlower; -+ static const mask alpha = _ISalpha; -+ static const mask digit = _ISdigit; -+ static const mask xdigit = _ISxdigit; -+ static const mask space = _ISspace; -+ static const mask print = _ISprint; -+ static const mask graph = _ISalpha | _ISdigit | _ISpunct; -+ static const mask cntrl = _IScntrl; -+ static const mask punct = _ISpunct; -+ static const mask alnum = _ISalpha | _ISdigit; -+ }; -diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_inline.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_inline.h ---- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_inline.h 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_inline.h 2002-06-24 00:49:19.000000000 -0500 -@@ -0,0 +1,69 @@ -+// Locale support -*- C++ -*- -+ -+// Copyright (C) 2000, 2002 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.1 Locales -+// -+ -+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) -+// functions go in ctype.cc -+ -+ bool -+ ctype:: -+ is(mask __m, char __c) const -+ { return _M_table[static_cast(__c)] & __m; } -+ -+ const char* -+ ctype:: -+ is(const char* __low, const char* __high, mask* __vec) const -+ { -+ while (__low < __high) -+ *__vec++ = _M_table[static_cast(*__low++)]; -+ return __high; -+ } -+ -+ const char* -+ ctype:: -+ scan_is(mask __m, const char* __low, const char* __high) const -+ { -+ while (__low < __high -+ && !(_M_table[static_cast(*__low)] & __m)) -+ ++__low; -+ return __low; -+ } -+ -+ const char* -+ ctype:: -+ scan_not(mask __m, const char* __low, const char* __high) const -+ { -+ while (__low < __high -+ && (_M_table[static_cast(*__low)] & __m) != 0) -+ ++__low; -+ return __low; -+ } -diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_noninline.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h ---- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2005-04-28 01:10:27.000000000 -0500 -@@ -0,0 +1,92 @@ -+// Locale support -*- C++ -*- -+ -+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 -+// Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.1 Locales -+// -+ -+// Information as gleaned from /usr/include/ctype.h -+ -+ const ctype_base::mask* -+ ctype::classic_table() throw() -+ { return __C_ctype_b; } -+ -+ ctype::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::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::do_toupper(char __c) const -+ { return _M_toupper[static_cast(__c)]; } -+ -+ const char* -+ ctype::do_toupper(char* __low, const char* __high) const -+ { -+ while (__low < __high) -+ { -+ *__low = _M_toupper[static_cast(*__low)]; -+ ++__low; -+ } -+ return __high; -+ } -+ -+ char -+ ctype::do_tolower(char __c) const -+ { return _M_tolower[static_cast(__c)]; } -+ -+ const char* -+ ctype::do_tolower(char* __low, const char* __high) const -+ { -+ while (__low < __high) -+ { -+ *__low = _M_tolower[static_cast(*__low)]; -+ ++__low; -+ } -+ return __high; -+ } -diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/os_defines.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/os_defines.h ---- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/os_defines.h 1969-12-31 18:00:00.000000000 -0600 -+++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/os_defines.h 2005-04-28 01:10:27.000000000 -0500 -@@ -0,0 +1,44 @@ -+// Specific definitions for GNU/Linux -*- C++ -*- -+ -+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+#ifndef _GLIBCXX_OS_DEFINES -+#define _GLIBCXX_OS_DEFINES 1 -+ -+// System-specific #define, typedefs, corrections, etc, go here. This -+// file will come before all others. -+ -+// This keeps isanum, et al from being propagated as macros. -+#define __NO_CTYPE 1 -+ -+#include -+ -+// We must not see the optimized string functions GNU libc defines. -+#define __NO_STRING_INLINES -+ -+#endif -diff -urN gcc-4.0.0-100/libstdc++-v3/configure gcc-4.0.0/libstdc++-v3/configure ---- gcc-4.0.0-100/libstdc++-v3/configure 2005-04-30 13:06:53.683055232 -0500 -+++ gcc-4.0.0/libstdc++-v3/configure 2005-04-30 12:24:24.000000000 -0500 -@@ -3998,6 +3998,11 @@ - lt_cv_deplibs_check_method=pass_all - ;; - -+linux-uclibc*) -+ lt_cv_deplibs_check_method=pass_all -+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` -+ ;; -+ - netbsd* | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' -@@ -5672,7 +5677,7 @@ - enableval="$enable_clocale" - - case "$enableval" in -- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;; -+ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;; - *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5 - echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;} - { (exit 1); exit 1; }; } ;; -@@ -5697,6 +5702,9 @@ - # Default to "generic". - if test $enable_clocale_flag = auto; then - case ${target_os} in -+ linux-uclibc*) -+ enable_clocale_flag=uclibc -+ ;; - linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) - cat >conftest.$ac_ext <<_ACEOF - /* confdefs.h. */ -@@ -5927,6 +5935,76 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ echo "$as_me:$LINENO: result: uclibc" >&5 -+echo "${ECHO_T}uclibc" >&6 -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ # Extract the first word of "msgfmt", so it can be a program name with args. -+set dummy msgfmt; ac_word=$2 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_check_msgfmt+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$check_msgfmt"; then -+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. -+else -+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -+for as_dir in $PATH -+do -+ IFS=$as_save_IFS -+ test -z "$as_dir" && as_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_check_msgfmt="yes" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done -+ -+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" -+fi -+fi -+check_msgfmt=$ac_cv_prog_check_msgfmt -+if test -n "$check_msgfmt"; then -+ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 -+echo "${ECHO_T}$check_msgfmt" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ -+ -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the -diff -urN gcc-4.0.0-100/libstdc++-v3/configure.host gcc-4.0.0/libstdc++-v3/configure.host ---- gcc-4.0.0-100/libstdc++-v3/configure.host 2005-04-30 13:06:53.688054472 -0500 -+++ gcc-4.0.0/libstdc++-v3/configure.host 2005-04-28 20:20:32.000000000 -0500 -@@ -249,6 +249,12 @@ - ;; - esac - -+# Override for uClibc since linux-uclibc gets mishandled above. -+case "${host_os}" in -+ *-uclibc*) -+ os_include_dir="os/uclibc" -+ ;; -+esac - - # Set any OS-dependent and CPU-dependent bits. - # THIS TABLE IS SORTED. KEEP IT THAT WAY. -diff -urN gcc-4.0.0-100/libstdc++-v3/crossconfig.m4 gcc-4.0.0/libstdc++-v3/crossconfig.m4 ---- gcc-4.0.0-100/libstdc++-v3/crossconfig.m4 2005-04-30 13:06:53.689054320 -0500 -+++ gcc-4.0.0/libstdc++-v3/crossconfig.m4 2005-04-28 20:27:15.000000000 -0500 -@@ -142,6 +142,98 @@ - ;; - esac - ;; -+ *-uclibc*) -+# Temporary hack until we implement the float versions of the libm funcs -+ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ -+ machine/endian.h machine/param.h sys/machine.h sys/types.h \ -+ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h]) -+ SECTION_FLAGS='-ffunction-sections -fdata-sections' -+ AC_SUBST(SECTION_FLAGS) -+ GLIBCXX_CHECK_LINKER_FEATURES -+ GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT -+ GLIBCXX_CHECK_WCHAR_T_SUPPORT -+ -+ # For LFS. -+ AC_DEFINE(HAVE_INT64_T) -+ case "$target" in -+ *-uclinux*) -+ # Don't enable LFS with uClinux -+ ;; -+ *) -+ AC_DEFINE(_GLIBCXX_USE_LFS) -+ esac -+ -+ # For showmanyc_helper(). -+ AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) -+ GLIBCXX_CHECK_POLL -+ GLIBCXX_CHECK_S_ISREG_OR_S_IFREG -+ -+ # For xsputn_2(). -+ AC_CHECK_HEADERS(sys/uio.h) -+ GLIBCXX_CHECK_WRITEV -+ -+# AC_DEFINE(HAVE_ACOSF) -+# AC_DEFINE(HAVE_ASINF) -+# AC_DEFINE(HAVE_ATANF) -+# AC_DEFINE(HAVE_ATAN2F) -+ AC_DEFINE(HAVE_CEILF) -+ AC_DEFINE(HAVE_COPYSIGN) -+# AC_DEFINE(HAVE_COPYSIGNF) -+# AC_DEFINE(HAVE_COSF) -+# AC_DEFINE(HAVE_COSHF) -+# AC_DEFINE(HAVE_EXPF) -+# AC_DEFINE(HAVE_FABSF) -+ AC_DEFINE(HAVE_FINITE) -+ AC_DEFINE(HAVE_FINITEF) -+ AC_DEFINE(HAVE_FLOORF) -+# AC_DEFINE(HAVE_FMODF) -+# AC_DEFINE(HAVE_FREXPF) -+ AC_DEFINE(HAVE_HYPOT) -+# AC_DEFINE(HAVE_HYPOTF) -+ AC_DEFINE(HAVE_ISINF) -+ AC_DEFINE(HAVE_ISINFF) -+ AC_DEFINE(HAVE_ISNAN) -+ AC_DEFINE(HAVE_ISNANF) -+# AC_DEFINE(HAVE_LOGF) -+# AC_DEFINE(HAVE_LOG10F) -+# AC_DEFINE(HAVE_MODFF) -+# AC_DEFINE(HAVE_SINF) -+# AC_DEFINE(HAVE_SINHF) -+# AC_DEFINE(HAVE_SINCOS) -+# AC_DEFINE(HAVE_SINCOSF) -+ AC_DEFINE(HAVE_SQRTF) -+# AC_DEFINE(HAVE_TANF) -+# AC_DEFINE(HAVE_TANHF) -+ if test x"long_double_math_on_this_cpu" = x"yes"; then -+# AC_DEFINE(HAVE_ACOSL) -+# AC_DEFINE(HAVE_ASINL) -+# AC_DEFINE(HAVE_ATANL) -+# AC_DEFINE(HAVE_ATAN2L) -+# AC_DEFINE(HAVE_CEILL) -+# AC_DEFINE(HAVE_COPYSIGNL) -+# AC_DEFINE(HAVE_COSL) -+# AC_DEFINE(HAVE_COSHL) -+# AC_DEFINE(HAVE_EXPL) -+# AC_DEFINE(HAVE_FABSL) -+# AC_DEFINE(HAVE_FINITEL) -+# AC_DEFINE(HAVE_FLOORL) -+# AC_DEFINE(HAVE_FMODL) -+# AC_DEFINE(HAVE_FREXPL) -+# AC_DEFINE(HAVE_HYPOTL) -+# AC_DEFINE(HAVE_ISINFL) -+# AC_DEFINE(HAVE_ISNANL) -+# AC_DEFINE(HAVE_LOGL) -+# AC_DEFINE(HAVE_LOG10L) -+# AC_DEFINE(HAVE_MODFL) -+# AC_DEFINE(HAVE_POWL) -+# AC_DEFINE(HAVE_SINL) -+# AC_DEFINE(HAVE_SINHL) -+# AC_DEFINE(HAVE_SINCOSL) -+# AC_DEFINE(HAVE_SQRTL) -+# AC_DEFINE(HAVE_TANL) -+# AC_DEFINE(HAVE_TANHL) -+ fi -+ ;; - *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu) - AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ - machine/endian.h machine/param.h sys/machine.h sys/types.h \ -@@ -156,7 +248,7 @@ - AC_DEFINE(HAVE_INT64_T) - case "$target" in - *-uclinux*) -- # Don't enable LFS with uClibc -+ # Don't enable LFS with uClinux - ;; - *) - AC_DEFINE(_GLIBCXX_USE_LFS) -diff -urN gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h ---- gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h 2005-04-30 13:06:53.690054168 -0500 -+++ gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h 2005-04-28 20:15:56.000000000 -0500 -@@ -101,7 +101,9 @@ - using std::wmemcpy; - using std::wmemmove; - using std::wmemset; -+#if _GLIBCXX_HAVE_WCSFTIME - using std::wcsftime; -+#endif - - #if _GLIBCXX_USE_C99 - using std::wcstold; -diff -urN gcc-4.0.0-100/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.0.0/libstdc++-v3/include/c_std/std_cwchar.h ---- gcc-4.0.0-100/libstdc++-v3/include/c_std/std_cwchar.h 2005-04-30 13:06:53.691054016 -0500 -+++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cwchar.h 2005-04-28 20:15:56.000000000 -0500 -@@ -179,7 +179,9 @@ - using ::wcscoll; - using ::wcscpy; - using ::wcscspn; -+#if _GLIBCXX_HAVE_WCSFTIME - using ::wcsftime; -+#endif - using ::wcslen; - using ::wcsncat; - using ::wcsncmp; diff --git a/patches/gcc/4.0.4/300-libstdc++-pic.patch b/patches/gcc/4.0.4/300-libstdc++-pic.patch deleted file mode 100644 index a9d6e71..0000000 --- a/patches/gcc/4.0.4/300-libstdc++-pic.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- gcc-4.0.0/libstdc++-v3/src/Makefile.am -+++ gcc-4.0.0/libstdc++-v3/src/Makefile.am -@@ -214,6 +214,10 @@ - $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ - - -+install-exec-local: -+ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) -+ - # Added bits to build debug library. - if GLIBCXX_BUILD_DEBUG - all-local: build_debug ---- gcc-4.0.0/libstdc++-v3/src/Makefile.in -+++ gcc-4.0.0/libstdc++-v3/src/Makefile.in -@@ -625,7 +625,7 @@ - - install-data-am: install-data-local - --install-exec-am: install-toolexeclibLTLIBRARIES -+install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local - - install-info: install-info-am - -@@ -664,7 +664,7 @@ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am \ -- uninstall-toolexeclibLTLIBRARIES -+ uninstall-toolexeclibLTLIBRARIES install-exec-local - - @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP) - @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver -@@ -743,6 +743,11 @@ - install_debug: - (cd ${debugdir} && $(MAKE) \ - toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) -+ -+install-exec-local: -+ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) -+ - # Tell versions [3.59,3.63) of GNU make to not export all variables. - # Otherwise a system limit (for SysV at least) may be exceeded. - .NOEXPORT: diff --git a/patches/gcc/4.0.4/301-missing-execinfo_h.patch b/patches/gcc/4.0.4/301-missing-execinfo_h.patch deleted file mode 100644 index 0e2092f..0000000 --- a/patches/gcc/4.0.4/301-missing-execinfo_h.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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 - # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ -- && !defined(__ia64__) -+ && !defined(__ia64__) && !defined(__UCLIBC__) - # ifndef GC_HAVE_BUILTIN_BACKTRACE - # define GC_HAVE_BUILTIN_BACKTRACE - # endif diff --git a/patches/gcc/4.0.4/302-c99-snprintf.patch b/patches/gcc/4.0.4/302-c99-snprintf.patch deleted file mode 100644 index dfb22d6..0000000 --- a/patches/gcc/4.0.4/302-c99-snprintf.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h-orig 2005-04-29 00:08:41.000000000 -0500 -+++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h 2005-04-29 00:08:45.000000000 -0500 -@@ -142,7 +142,7 @@ - using ::vsprintf; - } - --#if _GLIBCXX_USE_C99 -+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) - - #undef snprintf - #undef vfscanf diff --git a/patches/gcc/4.0.4/303-c99-complex-ugly-hack.patch b/patches/gcc/4.0.4/303-c99-complex-ugly-hack.patch deleted file mode 100644 index 2ccc80d..0000000 --- a/patches/gcc/4.0.4/303-c99-complex-ugly-hack.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- 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 -+#ifdef __UCLIBC__ -+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs -+#endif - int - main () - { diff --git a/patches/gcc/4.0.4/304-index_macro.patch b/patches/gcc/4.0.4/304-index_macro.patch deleted file mode 100644 index 1fac112..0000000 --- a/patches/gcc/4.0.4/304-index_macro.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- 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 - #include - -+/* 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 // For uninitialized_copy_n - #include // For power - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - namespace __gnu_cxx - { - using std::size_t; diff --git a/patches/gcc/4.0.4/305-libmudflap-susv3-legacy.patch b/patches/gcc/4.0.4/305-libmudflap-susv3-legacy.patch deleted file mode 100644 index 374b1f8..0000000 --- a/patches/gcc/4.0.4/305-libmudflap-susv3-legacy.patch +++ /dev/null @@ -1,49 +0,0 @@ -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/patches/gcc/4.0.4/602-sdk-libstdc++-includes.patch b/patches/gcc/4.0.4/602-sdk-libstdc++-includes.patch deleted file mode 100644 index c7676ae..0000000 --- a/patches/gcc/4.0.4/602-sdk-libstdc++-includes.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff -urN gcc-4.0.0-100/libstdc++-v3/fragment.am gcc-4.0.0/libstdc++-v3/fragment.am ---- gcc-4.0.0-100/libstdc++-v3/fragment.am 2004-10-25 15:32:40.000000000 -0500 -+++ gcc-4.0.0/libstdc++-v3/fragment.am 2005-04-28 21:48:43.000000000 -0500 -@@ -18,5 +18,5 @@ - $(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once - - # -I/-D flags to pass when compiling. --AM_CPPFLAGS = $(GLIBCXX_INCLUDES) -+AM_CPPFLAGS = $(GLIBCXX_INCLUDES) -I$(toplevel_srcdir)/include - -diff -urN gcc-4.0.0-100/libstdc++-v3/libmath/Makefile.am gcc-4.0.0/libstdc++-v3/libmath/Makefile.am ---- gcc-4.0.0-100/libstdc++-v3/libmath/Makefile.am 2003-08-27 16:29:42.000000000 -0500 -+++ gcc-4.0.0/libstdc++-v3/libmath/Makefile.am 2005-04-28 21:48:43.000000000 -0500 -@@ -32,7 +32,7 @@ - - libmath_la_SOURCES = stubs.c - --AM_CPPFLAGS = $(CANADIAN_INCLUDES) -+AM_CPPFLAGS = $(CANADIAN_INCLUDES) -I$(toplevel_srcdir)/include - - # Only compiling "C" sources in this directory. - LIBTOOL = @LIBTOOL@ --tag CC diff --git a/patches/gcc/4.0.4/800-arm-bigendian.patch b/patches/gcc/4.0.4/800-arm-bigendian.patch deleted file mode 100644 index fd2c9bf..0000000 --- a/patches/gcc/4.0.4/800-arm-bigendian.patch +++ /dev/null @@ -1,65 +0,0 @@ -diff -dur gcc-4.0.4.orig/gcc/config/arm/linux-elf.h gcc-4.0.4/gcc/config/arm/linux-elf.h ---- gcc-4.0.4.orig/gcc/config/arm/linux-elf.h 2007-02-02 19:24:50.000000000 +0100 -+++ gcc-4.0.4/gcc/config/arm/linux-elf.h 2007-02-02 19:26:12.000000000 +0100 -@@ -31,19 +31,33 @@ - /* Do not assume anything about header files. */ - #define NO_IMPLICIT_EXTERN_C - -+/* -+ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* -+ * (big endian) configurations. -+ */ -+#if TARGET_BIG_ENDIAN_DEFAULT -+#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END -+#define TARGET_ENDIAN_OPTION "mbig-endian" -+#define TARGET_LINKER_EMULATION "armelfb_linux" -+#else -+#define TARGET_ENDIAN_DEFAULT 0 -+#define TARGET_ENDIAN_OPTION "mlittle-endian" -+#define TARGET_LINKER_EMULATION "armelf_linux" -+#endif -+ - #undef TARGET_DEFAULT_FLOAT_ABI - #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD - - #undef TARGET_DEFAULT --#define TARGET_DEFAULT (0) -+#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT) - - #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 - --#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" -+#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" - - #undef MULTILIB_DEFAULTS - #define MULTILIB_DEFAULTS \ -- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" } -+ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" } - - /* The GNU C++ standard library requires that these macros be defined. */ - #undef CPLUSPLUS_CPP_SPEC -@@ -95,7 +109,7 @@ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "} \ - -X \ -- %{mbig-endian:-EB}" \ -+ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ - SUBTARGET_EXTRA_LINK_SPEC - - #define TARGET_OS_CPP_BUILTINS() \ -Only in gcc-4.0.4/gcc/config/arm: linux-elf.h.orig -diff -dur gcc-4.0.4.orig/gcc/config.gcc gcc-4.0.4/gcc/config.gcc ---- gcc-4.0.4.orig/gcc/config.gcc 2007-02-02 19:24:50.000000000 +0100 -+++ gcc-4.0.4/gcc/config.gcc 2007-02-02 19:26:12.000000000 +0100 -@@ -672,6 +672,11 @@ - ;; - arm*-*-linux*) # ARM GNU/Linux with ELF - tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h" -+ case $target in -+ arm*b-*) -+ tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" -+ ;; -+ esac - tmake_file="${tmake_file} arm/t-arm arm/t-linux" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - gnu_ld=yes diff --git a/patches/gcc/4.0.4/801-arm-softfloat.patch b/patches/gcc/4.0.4/801-arm-softfloat.patch deleted file mode 100644 index 1965a8a..0000000 --- a/patches/gcc/4.0.4/801-arm-softfloat.patch +++ /dev/null @@ -1,15 +0,0 @@ -Enable building a pure soft-float compiler without the need for a software -floating point library. - -diff -dur gcc-4.0.4.orig/gcc/config.gcc gcc-4.0.4/gcc/config.gcc ---- gcc-4.0.4.orig/gcc/config.gcc 2007-02-02 19:12:28.000000000 +0100 -+++ gcc-4.0.4/gcc/config.gcc 2007-02-02 19:12:07.000000000 +0100 -@@ -677,7 +677,7 @@ - tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines" - ;; - esac -- tmake_file="${tmake_file} arm/t-arm arm/t-linux" -+ tmake_file="${tmake_file} arm/t-arm arm/t-linux arm/t-arm-elf" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - gnu_ld=yes - ;; diff --git a/patches/gcc/4.1.1/120-uclibc-locale.patch b/patches/gcc/4.1.1/120-uclibc-locale.patch new file mode 100644 index 0000000..e5d712e --- /dev/null +++ b/patches/gcc/4.1.1/120-uclibc-locale.patch @@ -0,0 +1,3239 @@ +--- gcc-4.1.0-dist/libstdc++-v3/acinclude.m4 ++++ gcc-4.1.0/libstdc++-v3/acinclude.m4 +@@ -1071,7 +1071,7 @@ + AC_MSG_CHECKING([for C locale to use]) + GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], + [use MODEL for target locale package], +- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto]) ++ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto]) + + # If they didn't use this option switch, or if they specified --enable + # with no specific model, we'll have to look for one. If they +@@ -1087,6 +1087,9 @@ + # Default to "generic". + if test $enable_clocale_flag = auto; then + case ${target_os} in ++ *-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) + AC_EGREP_CPP([_GLIBCXX_ok], [ + #include +@@ -1230,6 +1233,40 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ AC_MSG_RESULT(uclibc) ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ AC_SUBST(glibcxx_MOFILES) ++ AC_SUBST(glibcxx_POFILES) ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c++locale_internal.h ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h +@@ -0,0 +1,63 @@ ++// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*- ++ ++// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// Written by Jakub Jelinek ++ ++#include ++#include ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning clean this up ++#endif ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ ++extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l; ++extern "C" __typeof(strcoll_l) __strcoll_l; ++extern "C" __typeof(strftime_l) __strftime_l; ++extern "C" __typeof(strtod_l) __strtod_l; ++extern "C" __typeof(strtof_l) __strtof_l; ++extern "C" __typeof(strtold_l) __strtold_l; ++extern "C" __typeof(strxfrm_l) __strxfrm_l; ++extern "C" __typeof(newlocale) __newlocale; ++extern "C" __typeof(freelocale) __freelocale; ++extern "C" __typeof(duplocale) __duplocale; ++extern "C" __typeof(uselocale) __uselocale; ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++extern "C" __typeof(iswctype_l) __iswctype_l; ++extern "C" __typeof(towlower_l) __towlower_l; ++extern "C" __typeof(towupper_l) __towupper_l; ++extern "C" __typeof(wcscoll_l) __wcscoll_l; ++extern "C" __typeof(wcsftime_l) __wcsftime_l; ++extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l; ++extern "C" __typeof(wctype_l) __wctype_l; ++#endif ++ ++#endif // GLIBC 2.3 and later +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c_locale.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c_locale.cc +@@ -0,0 +1,152 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik ++ ++#include // For errno ++#include ++#include ++#include ++#include ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __strtol_l(S, E, B, L) strtol((S), (E), (B)) ++#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B)) ++#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B)) ++#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B)) ++#define __strtof_l(S, E, L) strtof((S), (E)) ++#define __strtod_l(S, E, L) strtod((S), (E)) ++#define __strtold_l(S, E, L) strtold((S), (E)) ++#warning should dummy __newlocale check for C|POSIX ? ++#define __newlocale(a, b, c) NULL ++#define __freelocale(a) ((void)0) ++#define __duplocale(a) __c_locale() ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ char* __sanity; ++ errno = 0; ++ float __f = __strtof_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __f; ++ else ++ __err |= ios_base::failbit; ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ char* __sanity; ++ errno = 0; ++ double __d = __strtod_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __d; ++ else ++ __err |= ios_base::failbit; ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ char* __sanity; ++ errno = 0; ++ long double __ld = __strtold_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __ld; ++ else ++ __err |= ios_base::failbit; ++ } ++ ++ void ++ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, ++ __c_locale __old) ++ { ++ __cloc = __newlocale(1 << LC_ALL, __s, __old); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ if (!__cloc) ++ { ++ // This named locale is not supported by the underlying OS. ++ __throw_runtime_error(__N("locale::facet::_S_create_c_locale " ++ "name not valid")); ++ } ++#endif ++ } ++ ++ void ++ locale::facet::_S_destroy_c_locale(__c_locale& __cloc) ++ { ++ if (__cloc && _S_get_c_locale() != __cloc) ++ __freelocale(__cloc); ++ } ++ ++ __c_locale ++ locale::facet::_S_clone_c_locale(__c_locale& __cloc) ++ { return __duplocale(__cloc); } ++} // namespace std ++ ++namespace __gnu_cxx ++{ ++ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] = ++ { ++ "LC_CTYPE", ++ "LC_NUMERIC", ++ "LC_TIME", ++ "LC_COLLATE", ++ "LC_MONETARY", ++ "LC_MESSAGES", ++#if _GLIBCXX_NUM_CATEGORIES != 0 ++ "LC_PAPER", ++ "LC_NAME", ++ "LC_ADDRESS", ++ "LC_TELEPHONE", ++ "LC_MEASUREMENT", ++ "LC_IDENTIFICATION" ++#endif ++ }; ++} ++ ++namespace std ++{ ++ const char* const* const locale::_S_categories = __gnu_cxx::category_names; ++} // namespace std +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c_locale.h ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c_locale.h +@@ -0,0 +1,117 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik ++ ++#ifndef _C_LOCALE_H ++#define _C_LOCALE_H 1 ++ ++#pragma GCC system_header ++ ++#include // get std::strlen ++#include // get std::snprintf or std::sprintf ++#include ++#include // For codecvt ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC_HAS_LOCALE__ ++#include // For codecvt using iconv, iconv_t ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#include // 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 ++ int ++ __convert_from_v(char* __out, ++ const int __size __attribute__ ((__unused__)), ++ const char* __fmt, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ _Tv __v, const __c_locale& __cloc, int __prec) ++ { ++ __c_locale __old = __gnu_cxx::__uselocale(__cloc); ++#else ++ _Tv __v, const __c_locale&, int __prec) ++ { ++# ifdef __UCLIBC_HAS_LOCALE__ ++ char* __old = std::setlocale(LC_ALL, NULL); ++ char* __sav = new char[std::strlen(__old) + 1]; ++ std::strcpy(__sav, __old); ++ std::setlocale(LC_ALL, "C"); ++# endif ++#endif ++ ++ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __gnu_cxx::__uselocale(__old); ++#elif defined __UCLIBC_HAS_LOCALE__ ++ std::setlocale(LC_ALL, __sav); ++ delete [] __sav; ++#endif ++ return __ret; ++ } ++} ++ ++#endif +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/codecvt_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc +@@ -0,0 +1,306 @@ ++// std::codecvt implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.5 - Template class codecvt ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++namespace std ++{ ++ // Specializations. ++#ifdef _GLIBCXX_USE_WCHAR_T ++ codecvt_base::result ++ codecvt:: ++ 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(-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(__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:: ++ 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(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(-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(-1) ++ || __conv == static_cast(-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:: ++ 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:: ++ 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:: ++ 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(__builtin_alloca(sizeof(wchar_t) ++ * __max)); ++ while (__from < __end && __max) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast(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(-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(-1) ++ || __conv == static_cast(-2)) ++ break; ++ } ++ __state = __tmp_state; ++ __ret += __from - __tmp_from; ++ break; ++ } ++ if (!__from) ++ __from = __from_chunk_end; ++ ++ __ret += __from - __tmp_from; ++ __max -= __conv; ++ ++ if (__from < __end && __max) ++ { ++ // XXX Probably wrong for stateful encodings ++ __tmp_state = __state; ++ ++__from; ++ ++__ret; ++ --__max; ++ } ++ } ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ return __ret; ++ } ++#endif ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/collate_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/collate_members.cc +@@ -0,0 +1,80 @@ ++// std::collate implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.4.1.2 collate virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++#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::_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::_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::_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::_M_transform(wchar_t* __to, const wchar_t* __from, ++ size_t __n) const ++ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); } ++#endif ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/ctype_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc +@@ -0,0 +1,314 @@ ++// std::ctype implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions. ++// ++ ++// Written by Benjamin Kosnik ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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 specializations are in src/locale.cc and ++ // various /config/os/* files. ++ template<> ++ ctype_byname::ctype_byname(const char* __s, size_t __refs) ++ : ctype(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::__wmask_type ++ ctype::_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::do_toupper(wchar_t __c) const ++ { return __towupper_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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::do_tolower(wchar_t __c) const ++ { return __towlower_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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:: ++ do_is(mask __m, wchar_t __c) const ++ { ++ // The case of __m == ctype_base::space is particularly important, ++ // due to its use in many istream functions. Therefore we deal with ++ // it first, exploiting the knowledge that on GNU systems _M_bit[5] ++ // is the mask corresponding to ctype_base::space. NB: an encoding ++ // change would not affect correctness! ++ bool __ret = false; ++ if (__m == _M_bit[5]) ++ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype); ++ else ++ { ++ // Highest bitmask in ctype_base == 10, but extra in "C" ++ // library for blank. ++ const size_t __bitmasksize = 11; ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) ++ if (__m & _M_bit[__bitcur]) ++ { ++ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype)) ++ { ++ __ret = true; ++ break; ++ } ++ else if (__m == _M_bit[__bitcur]) ++ break; ++ } ++ } ++ return __ret; ++ } ++ ++ const wchar_t* ++ ctype:: ++ 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:: ++ 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:: ++ 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:: ++ do_widen(char __c) const ++ { return _M_widen[static_cast(__c)]; } ++ ++ const char* ++ ctype:: ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const ++ { ++ while (__lo < __hi) ++ { ++ *__dest = _M_widen[static_cast(*__lo)]; ++ ++__lo; ++ ++__dest; ++ } ++ return __hi; ++ } ++ ++ char ++ ctype:: ++ 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(__c)); ++ } ++ ++ const wchar_t* ++ ctype:: ++ 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(__c)); ++ } ++ ++__lo; ++ ++__dest; ++ } ++ else ++ while (__lo < __hi) ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast(__c)); ++ ++__lo; ++ ++__dest; ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __hi; ++ } ++ ++ void ++ ctype::_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(__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(_ISbit(__k)); ++ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]); ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ } ++#endif // _GLIBCXX_USE_WCHAR_T ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/messages_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/messages_members.cc +@@ -0,0 +1,100 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++#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::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(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::do_get(catalog, int, int, const wstring& __dfault) const ++ { ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ __uselocale(__old); ++ return _M_convert_from_char(__msg); ++# elif defined __UCLIBC_HAS_LOCALE__ ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ setlocale(LC_ALL, __old); ++ free(__old); ++ return _M_convert_from_char(__msg); ++# else ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ return _M_convert_from_char(__msg); ++# endif ++ } ++#endif ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/messages_members.h ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/messages_members.h +@@ -0,0 +1,121 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#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 ++ messages<_CharT>::messages(size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), ++ _M_name_messages(_S_get_c_name()) ++ { } ++ ++ template ++ messages<_CharT>::messages(__c_locale __cloc, const char* __s, ++ size_t __refs) ++ : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL) ++ { ++ const size_t __len = std::strlen(__s) + 1; ++ char* __tmp = new char[__len]; ++ std::memcpy(__tmp, __s, __len); ++ _M_name_messages = __tmp; ++ ++ // Last to avoid leaking memory if new throws. ++ _M_c_locale_messages = _S_clone_c_locale(__cloc); ++ } ++ ++ template ++ typename messages<_CharT>::catalog ++ messages<_CharT>::open(const basic_string& __s, const locale& __loc, ++ const char* __dir) const ++ { ++ __bindtextdomain(__s.c_str(), __dir); ++ return this->do_open(__s, __loc); ++ } ++ ++ // Virtual member functions. ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::do_open(const basic_string& __s, ++ const locale&) const ++ { ++ // No error checking is done, assume the catalog exists and can ++ // be used. ++ __textdomain(__s.c_str()); ++ return 0; ++ } ++ ++ template ++ void ++ messages<_CharT>::do_close(catalog) const ++ { } ++ ++ // messages_byname ++ template ++ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) ++ : messages<_CharT>(__refs) ++ { ++ if (this->_M_name_messages != locale::facet::_S_get_c_name()) ++ delete [] this->_M_name_messages; ++ char* __tmp = new char[std::strlen(__s) + 1]; ++ std::strcpy(__tmp, __s); ++ this->_M_name_messages = __tmp; ++ ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ++ { ++ this->_S_destroy_c_locale(this->_M_c_locale_messages); ++ this->_S_create_c_locale(this->_M_c_locale_messages, __s); ++ } ++ } +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/monetary_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc +@@ -0,0 +1,692 @@ ++// std::moneypunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning optimize this for uclibc ++#warning tailor for stub locale support ++#endif ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ // Construct and return valid pattern consisting of some combination of: ++ // space none symbol sign value ++ money_base::pattern ++ money_base::_S_construct_pattern(char __precedes, char __space, char __posn) ++ { ++ pattern __ret; ++ ++ // This insanely complicated routine attempts to construct a valid ++ // pattern for use with monyepunct. A couple of invariants: ++ ++ // if (__precedes) symbol -> value ++ // else value -> symbol ++ ++ // if (__space) space ++ // else none ++ ++ // none == never first ++ // space never first or last ++ ++ // Any elegant implementations of this are welcome. ++ switch (__posn) ++ { ++ case 0: ++ case 1: ++ // 1 The sign precedes the value and symbol. ++ __ret.field[0] = sign; ++ if (__space) ++ { ++ // Pattern starts with sign. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[3] = symbol; ++ } ++ __ret.field[2] = space; ++ } ++ else ++ { ++ // Pattern starts with sign and ends with none. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[3] = none; ++ } ++ break; ++ case 2: ++ // 2 The sign follows the value and symbol. ++ if (__space) ++ { ++ // Pattern either ends with sign. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[1] = space; ++ __ret.field[3] = sign; ++ } ++ else ++ { ++ // Pattern ends with sign then none. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[1] = symbol; ++ } ++ __ret.field[2] = sign; ++ __ret.field[3] = none; ++ } ++ break; ++ case 3: ++ // 3 The sign immediately precedes the symbol. ++ if (__precedes) ++ { ++ __ret.field[0] = sign; ++ __ret.field[1] = symbol; ++ if (__space) ++ { ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[2] = value; ++ __ret.field[3] = none; ++ } ++ } ++ else ++ { ++ __ret.field[0] = value; ++ if (__space) ++ { ++ __ret.field[1] = space; ++ __ret.field[2] = sign; ++ __ret.field[3] = symbol; ++ } ++ else ++ { ++ __ret.field[1] = sign; ++ __ret.field[2] = symbol; ++ __ret.field[3] = none; ++ } ++ } ++ break; ++ case 4: ++ // 4 The sign immediately follows the symbol. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = sign; ++ if (__space) ++ { ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[2] = value; ++ __ret.field[3] = none; ++ } ++ } ++ else ++ { ++ __ret.field[0] = value; ++ if (__space) ++ { ++ __ret.field[1] = space; ++ __ret.field[2] = symbol; ++ __ret.field[3] = sign; ++ } ++ else ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = sign; ++ __ret.field[3] = none; ++ } ++ } ++ break; ++ default: ++ __ret = pattern(); ++ } ++ return __ret; ++ } ++ ++ template<> ++ void ++ moneypunct::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::~moneypunct() ++ { delete _M_data; } ++ ++ template<> ++ moneypunct::~moneypunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ moneypunct::_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; ++ ++ 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(money_base::_S_atoms[__i]); ++ } ++ else ++ { ++ // Named locale. ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(__cloc); ++#else ++ // Switch to named locale so that mbsrtowcs will work. ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, __name); ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this... should be monetary ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# elif defined __UCLIBC_HAS_LOCALE__ ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); ++ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); ++ ++ wchar_t* __wcs_ps = 0; ++ wchar_t* __wcs_ns = 0; ++ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); ++ try ++ { ++ mbstate_t __state; ++ size_t __len = strlen(__cpossign); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ps = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); ++ _M_data->_M_positive_sign = __wcs_ps; ++ } ++ else ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); ++ ++ __len = strlen(__cnegsign); ++ if (!__nposn) ++ _M_data->_M_negative_sign = L"()"; ++ else if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ns = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); ++ _M_data->_M_negative_sign = __wcs_ns; ++ } ++ else ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); ++ ++ // _Intl == true. ++ __len = strlen(__ccurr); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state); ++ _M_data->_M_curr_symbol = __wcs; ++ } ++ else ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); ++ } ++ catch (...) ++ { ++ delete _M_data; ++ _M_data = 0; ++ delete __wcs_ps; ++ delete __wcs_ns; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ __throw_exception_again; ++ } ++ ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, ++ __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ } ++ } ++ ++ template<> ++ void ++ moneypunct::_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; ++ ++ 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(money_base::_S_atoms[__i]); ++ } ++ else ++ { ++ // Named locale. ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(__cloc); ++#else ++ // Switch to named locale so that mbsrtowcs will work. ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, __name); ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this... should be monetary ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# elif defined __UCLIBC_HAS_LOCALE__ ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); ++ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); ++ ++ wchar_t* __wcs_ps = 0; ++ wchar_t* __wcs_ns = 0; ++ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); ++ try ++ { ++ mbstate_t __state; ++ size_t __len; ++ __len = strlen(__cpossign); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ps = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); ++ _M_data->_M_positive_sign = __wcs_ps; ++ } ++ else ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); ++ ++ __len = strlen(__cnegsign); ++ if (!__nposn) ++ _M_data->_M_negative_sign = L"()"; ++ else if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ns = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); ++ _M_data->_M_negative_sign = __wcs_ns; ++ } ++ else ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); ++ ++ // _Intl == true. ++ __len = strlen(__ccurr); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state); ++ _M_data->_M_curr_symbol = __wcs; ++ } ++ else ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); ++ } ++ catch (...) ++ { ++ delete _M_data; ++ _M_data = 0; ++ delete __wcs_ps; ++ delete __wcs_ns; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ __throw_exception_again; ++ } ++ ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ } ++ } ++ ++ template<> ++ moneypunct::~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::~moneypunct() ++ { ++ if (_M_data->_M_positive_sign_size) ++ delete [] _M_data->_M_positive_sign; ++ if (_M_data->_M_negative_sign_size ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0) ++ delete [] _M_data->_M_negative_sign; ++ if (_M_data->_M_curr_symbol_size) ++ delete [] _M_data->_M_curr_symbol; ++ delete _M_data; ++ } ++#endif ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/numeric_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc +@@ -0,0 +1,173 @@ ++// std::numpunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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::~numpunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ numpunct::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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(__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(__num_base::_S_atoms_in[__j]); ++ } ++ else ++ { ++ // Named locale. ++ // NB: In the GNU model wchar_t is always 32 bit wide. ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# elif defined __UCLIBC_HAS_LOCALE__ ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ ++ if (_M_data->_M_thousands_sep == L'\0') ++ _M_data->_M_grouping = ""; ++ else ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ } ++ ++ // NB: There is no way to extact this info from posix locales. ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); ++ _M_data->_M_truename = L"true"; ++ _M_data->_M_truename_size = 4; ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); ++ _M_data->_M_falsename = L"false"; ++ _M_data->_M_falsename_size = 5; ++ } ++ ++ template<> ++ numpunct::~numpunct() ++ { delete _M_data; } ++ #endif ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/time_members.cc ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/time_members.cc +@@ -0,0 +1,406 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++#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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++ 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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++#warning wide time stuff ++// if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = L"%m/%d/%y"; ++ _M_data->_M_date_era_format = L"%m/%d/%y"; ++ _M_data->_M_time_format = L"%H:%M:%S"; ++ _M_data->_M_time_era_format = L"%H:%M:%S"; ++ _M_data->_M_date_time_format = L""; ++ _M_data->_M_date_time_era_format = L""; ++ _M_data->_M_am = L"AM"; ++ _M_data->_M_pm = L"PM"; ++ _M_data->_M_am_pm_format = L""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = L"Sunday"; ++ _M_data->_M_day2 = L"Monday"; ++ _M_data->_M_day3 = L"Tuesday"; ++ _M_data->_M_day4 = L"Wednesday"; ++ _M_data->_M_day5 = L"Thursday"; ++ _M_data->_M_day6 = L"Friday"; ++ _M_data->_M_day7 = L"Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = L"Sun"; ++ _M_data->_M_aday2 = L"Mon"; ++ _M_data->_M_aday3 = L"Tue"; ++ _M_data->_M_aday4 = L"Wed"; ++ _M_data->_M_aday5 = L"Thu"; ++ _M_data->_M_aday6 = L"Fri"; ++ _M_data->_M_aday7 = L"Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = L"January"; ++ _M_data->_M_month02 = L"February"; ++ _M_data->_M_month03 = L"March"; ++ _M_data->_M_month04 = L"April"; ++ _M_data->_M_month05 = L"May"; ++ _M_data->_M_month06 = L"June"; ++ _M_data->_M_month07 = L"July"; ++ _M_data->_M_month08 = L"August"; ++ _M_data->_M_month09 = L"September"; ++ _M_data->_M_month10 = L"October"; ++ _M_data->_M_month11 = L"November"; ++ _M_data->_M_month12 = L"December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = L"Jan"; ++ _M_data->_M_amonth02 = L"Feb"; ++ _M_data->_M_amonth03 = L"Mar"; ++ _M_data->_M_amonth04 = L"Apr"; ++ _M_data->_M_amonth05 = L"May"; ++ _M_data->_M_amonth06 = L"Jun"; ++ _M_data->_M_amonth07 = L"Jul"; ++ _M_data->_M_amonth08 = L"Aug"; ++ _M_data->_M_amonth09 = L"Sep"; ++ _M_data->_M_amonth10 = L"Oct"; ++ _M_data->_M_amonth11 = L"Nov"; ++ _M_data->_M_amonth12 = L"Dec"; ++ } ++#if 0 ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ union { char *__s; wchar_t *__w; } __u; ++ ++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); ++ _M_data->_M_date_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); ++ _M_data->_M_date_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); ++ _M_data->_M_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); ++ _M_data->_M_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); ++ _M_data->_M_date_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); ++ _M_data->_M_date_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); ++ _M_data->_M_am = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); ++ _M_data->_M_pm = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); ++ _M_data->_M_am_pm_format = __u.__w; ++ ++ // Day names, starting with "C"'s Sunday. ++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); ++ _M_data->_M_day1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); ++ _M_data->_M_day2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); ++ _M_data->_M_day3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); ++ _M_data->_M_day4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); ++ _M_data->_M_day5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); ++ _M_data->_M_day6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); ++ _M_data->_M_day7 = __u.__w; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); ++ _M_data->_M_aday1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); ++ _M_data->_M_aday2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); ++ _M_data->_M_aday3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); ++ _M_data->_M_aday4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); ++ _M_data->_M_aday5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); ++ _M_data->_M_aday6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); ++ _M_data->_M_aday7 = __u.__w; ++ ++ // Month names, starting with "C"'s January. ++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); ++ _M_data->_M_month01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); ++ _M_data->_M_month02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); ++ _M_data->_M_month03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); ++ _M_data->_M_month04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); ++ _M_data->_M_month05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); ++ _M_data->_M_month06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); ++ _M_data->_M_month07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); ++ _M_data->_M_month08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); ++ _M_data->_M_month09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); ++ _M_data->_M_month10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); ++ _M_data->_M_month11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); ++ _M_data->_M_month12 = __u.__w; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); ++ _M_data->_M_amonth01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); ++ _M_data->_M_amonth02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); ++ _M_data->_M_amonth03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); ++ _M_data->_M_amonth04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); ++ _M_data->_M_amonth05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); ++ _M_data->_M_amonth06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); ++ _M_data->_M_amonth07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); ++ _M_data->_M_amonth08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); ++ _M_data->_M_amonth09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); ++ _M_data->_M_amonth10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); ++ _M_data->_M_amonth11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); ++ _M_data->_M_amonth12 = __u.__w; ++ } ++#endif // 0 ++ } ++#endif ++} +--- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/time_members.h ++++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/time_members.h +@@ -0,0 +1,76 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put functions ++// ++ ++// Written by Benjamin Kosnik ++ ++ template ++ __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 ++ __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 ++ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, ++ size_t __refs) ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), ++ _M_name_timepunct(NULL) ++ { ++ const size_t __len = std::strlen(__s) + 1; ++ char* __tmp = new char[__len]; ++ std::memcpy(__tmp, __s, __len); ++ _M_name_timepunct = __tmp; ++ ++ try ++ { _M_initialize_timepunct(__cloc); } ++ catch(...) ++ { ++ delete [] _M_name_timepunct; ++ __throw_exception_again; ++ } ++ } ++ ++ template ++ __timepunct<_CharT>::~__timepunct() ++ { ++ if (_M_name_timepunct != _S_get_c_name()) ++ delete [] _M_name_timepunct; ++ delete _M_data; ++ _S_destroy_c_locale(_M_c_locale_timepunct); ++ } +--- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_base.h ++++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_base.h +@@ -0,0 +1,64 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++/** @file ctype_base.h ++ * This is an internal header file, included by other library headers. ++ * You should not attempt to use it directly. ++ */ ++ ++// Information as gleaned from /usr/include/ctype.h ++ ++ /// @brief Base class for ctype. ++ struct ctype_base ++ { ++ // Note: In uClibc, the following two types depend on configuration. ++ ++ // Non-standard typedefs. ++ typedef const __ctype_touplow_t* __to_type; ++ ++ // NB: Offsets into ctype::_M_table force a particular size ++ // on the mask type. Because of this, we don't use an enum. ++ typedef __ctype_mask_t mask; ++ static const mask upper = _ISupper; ++ static const mask lower = _ISlower; ++ static const mask alpha = _ISalpha; ++ static const mask digit = _ISdigit; ++ static const mask xdigit = _ISxdigit; ++ static const mask space = _ISspace; ++ static const mask print = _ISprint; ++ static const mask graph = _ISalpha | _ISdigit | _ISpunct; ++ static const mask cntrl = _IScntrl; ++ static const mask punct = _ISpunct; ++ static const mask alnum = _ISalpha | _ISdigit; ++ }; +--- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_inline.h ++++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_inline.h +@@ -0,0 +1,69 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 2000, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) ++// functions go in ctype.cc ++ ++ bool ++ ctype:: ++ is(mask __m, char __c) const ++ { return _M_table[static_cast(__c)] & __m; } ++ ++ const char* ++ ctype:: ++ is(const char* __low, const char* __high, mask* __vec) const ++ { ++ while (__low < __high) ++ *__vec++ = _M_table[static_cast(*__low++)]; ++ return __high; ++ } ++ ++ const char* ++ ctype:: ++ scan_is(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && !(_M_table[static_cast(*__low)] & __m)) ++ ++__low; ++ return __low; ++ } ++ ++ const char* ++ ctype:: ++ scan_not(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && (_M_table[static_cast(*__low)] & __m) != 0) ++ ++__low; ++ return __low; ++ } +--- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_noninline.h ++++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h +@@ -0,0 +1,92 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++// Information as gleaned from /usr/include/ctype.h ++ ++ const ctype_base::mask* ++ ctype::classic_table() throw() ++ { return __C_ctype_b; } ++ ++ ctype::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::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::do_toupper(char __c) const ++ { return _M_toupper[static_cast(__c)]; } ++ ++ const char* ++ ctype::do_toupper(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_toupper[static_cast(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } ++ ++ char ++ ctype::do_tolower(char __c) const ++ { return _M_tolower[static_cast(__c)]; } ++ ++ const char* ++ ctype::do_tolower(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_tolower[static_cast(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } +--- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/os_defines.h ++++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/os_defines.h +@@ -0,0 +1,44 @@ ++// Specific definitions for GNU/Linux -*- C++ -*- ++ ++// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++#ifndef _GLIBCXX_OS_DEFINES ++#define _GLIBCXX_OS_DEFINES 1 ++ ++// System-specific #define, typedefs, corrections, etc, go here. This ++// file will come before all others. ++ ++// This keeps isanum, et al from being propagated as macros. ++#define __NO_CTYPE 1 ++ ++#include ++ ++// We must not see the optimized string functions GNU libc defines. ++#define __NO_STRING_INLINES ++ ++#endif +--- gcc-4.1.0-dist/libstdc++-v3/configure ++++ gcc-4.1.0/libstdc++-v3/configure +@@ -4005,6 +4005,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +@@ -5740,7 +5745,7 @@ + enableval="$enable_clocale" + + case "$enableval" in +- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;; ++ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;; + *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5 + echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;} + { (exit 1); exit 1; }; } ;; +@@ -5765,6 +5770,9 @@ + # Default to "generic". + if test $enable_clocale_flag = auto; then + case ${target_os} in ++ linux-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ +@@ -5995,6 +6003,76 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ echo "$as_me:$LINENO: result: uclibc" >&5 ++echo "${ECHO_T}uclibc" >&6 ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ # Extract the first word of "msgfmt", so it can be a program name with args. ++set dummy msgfmt; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test -n "$check_msgfmt"; then ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_check_msgfmt="yes" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" ++fi ++fi ++check_msgfmt=$ac_cv_prog_check_msgfmt ++if test -n "$check_msgfmt"; then ++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 ++echo "${ECHO_T}$check_msgfmt" >&6 ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ ++ ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +--- gcc-4.1.0-dist/libstdc++-v3/configure.host ++++ gcc-4.1.0/libstdc++-v3/configure.host +@@ -261,6 +261,12 @@ + ;; + esac + ++# Override for uClibc since linux-uclibc gets mishandled above. ++case "${host_os}" in ++ *-uclibc*) ++ os_include_dir="os/uclibc" ++ ;; ++esac + + # Set any OS-dependent and CPU-dependent bits. + # THIS TABLE IS SORTED. KEEP IT THAT WAY. +--- gcc-4.1.0-dist/libstdc++-v3/crossconfig.m4 ++++ gcc-4.1.0/libstdc++-v3/crossconfig.m4 +@@ -143,6 +143,99 @@ + ;; + esac + ;; ++ *-uclibc*) ++# Temporary hack until we implement the float versions of the libm funcs ++ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ ++ machine/endian.h machine/param.h sys/machine.h sys/types.h \ ++ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h]) ++ SECTION_FLAGS='-ffunction-sections -fdata-sections' ++ AC_SUBST(SECTION_FLAGS) ++ GLIBCXX_CHECK_LINKER_FEATURES ++ GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT ++ GLIBCXX_CHECK_WCHAR_T_SUPPORT ++ ++ # For LFS. ++ AC_DEFINE(HAVE_INT64_T) ++ case "$target" in ++ *-uclinux*) ++ # Don't enable LFS with uClinux ++ ;; ++ *) ++ AC_DEFINE(_GLIBCXX_USE_LFS) ++ esac ++ ++ # For showmanyc_helper(). ++ AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) ++ GLIBCXX_CHECK_POLL ++ GLIBCXX_CHECK_S_ISREG_OR_S_IFREG ++ ++ # For xsputn_2(). ++ AC_CHECK_HEADERS(sys/uio.h) ++ GLIBCXX_CHECK_WRITEV ++ ++# AC_DEFINE(HAVE_ACOSF) ++# AC_DEFINE(HAVE_ASINF) ++# AC_DEFINE(HAVE_ATANF) ++# AC_DEFINE(HAVE_ATAN2F) ++ AC_DEFINE(HAVE_CEILF) ++ AC_DEFINE(HAVE_COPYSIGN) ++# AC_DEFINE(HAVE_COPYSIGNF) ++# AC_DEFINE(HAVE_COSF) ++# AC_DEFINE(HAVE_COSHF) ++# AC_DEFINE(HAVE_EXPF) ++# AC_DEFINE(HAVE_FABSF) ++ AC_DEFINE(HAVE_FINITE) ++ AC_DEFINE(HAVE_FINITEF) ++ AC_DEFINE(HAVE_FLOORF) ++# AC_DEFINE(HAVE_FMODF) ++# AC_DEFINE(HAVE_FREXPF) ++ AC_DEFINE(HAVE_HYPOT) ++# AC_DEFINE(HAVE_HYPOTF) ++ AC_DEFINE(HAVE_ISINF) ++ AC_DEFINE(HAVE_ISINFF) ++ AC_DEFINE(HAVE_ISNAN) ++ AC_DEFINE(HAVE_ISNANF) ++# AC_DEFINE(HAVE_LOGF) ++# AC_DEFINE(HAVE_LOG10F) ++# AC_DEFINE(HAVE_MODFF) ++# AC_DEFINE(HAVE_SINF) ++# AC_DEFINE(HAVE_SINHF) ++# AC_DEFINE(HAVE_SINCOS) ++# AC_DEFINE(HAVE_SINCOSF) ++ AC_DEFINE(HAVE_SQRTF) ++# AC_DEFINE(HAVE_TANF) ++# AC_DEFINE(HAVE_TANHF) ++ if test x"long_double_math_on_this_cpu" = x"yes"; then ++ AC_MSG_ERROR([long_double_math_on_this_cpu is yes!]) ++# AC_DEFINE(HAVE_ACOSL) ++# AC_DEFINE(HAVE_ASINL) ++# AC_DEFINE(HAVE_ATANL) ++# AC_DEFINE(HAVE_ATAN2L) ++# AC_DEFINE(HAVE_CEILL) ++# AC_DEFINE(HAVE_COPYSIGNL) ++# AC_DEFINE(HAVE_COSL) ++# AC_DEFINE(HAVE_COSHL) ++# AC_DEFINE(HAVE_EXPL) ++# AC_DEFINE(HAVE_FABSL) ++# AC_DEFINE(HAVE_FINITEL) ++# AC_DEFINE(HAVE_FLOORL) ++# AC_DEFINE(HAVE_FMODL) ++# AC_DEFINE(HAVE_FREXPL) ++# AC_DEFINE(HAVE_HYPOTL) ++# AC_DEFINE(HAVE_ISINFL) ++# AC_DEFINE(HAVE_ISNANL) ++# AC_DEFINE(HAVE_LOGL) ++# AC_DEFINE(HAVE_LOG10L) ++# AC_DEFINE(HAVE_MODFL) ++# AC_DEFINE(HAVE_POWL) ++# AC_DEFINE(HAVE_SINL) ++# AC_DEFINE(HAVE_SINHL) ++# AC_DEFINE(HAVE_SINCOSL) ++# AC_DEFINE(HAVE_SQRTL) ++# AC_DEFINE(HAVE_TANL) ++# AC_DEFINE(HAVE_TANHL) ++ fi ++ ;; + *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu) + AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ + machine/endian.h machine/param.h sys/machine.h sys/types.h \ +@@ -157,7 +250,7 @@ + AC_DEFINE(HAVE_INT64_T) + case "$target" in + *-uclinux*) +- # Don't enable LFS with uClibc ++ # Don't enable LFS with uClinux + ;; + *) + AC_DEFINE(_GLIBCXX_USE_LFS) +--- gcc-4.1.0-dist/libstdc++-v3/include/c_compatibility/wchar.h ++++ gcc-4.1.0/libstdc++-v3/include/c_compatibility/wchar.h +@@ -101,7 +101,9 @@ + using std::wmemcpy; + using std::wmemmove; + using std::wmemset; ++#if _GLIBCXX_HAVE_WCSFTIME + using std::wcsftime; ++#endif + + #if _GLIBCXX_USE_C99 + using std::wcstold; +--- gcc-4.1.0-dist/libstdc++-v3/include/c_std/std_cwchar.h ++++ gcc-4.1.0/libstdc++-v3/include/c_std/std_cwchar.h +@@ -180,7 +180,9 @@ + using ::wcscoll; + using ::wcscpy; + using ::wcscspn; ++#if _GLIBCXX_HAVE_WCSFTIME + using ::wcsftime; ++#endif + using ::wcslen; + using ::wcsncat; + using ::wcsncmp; diff --git a/patches/gcc/4.1.1/130-libstdc++-pic.patch b/patches/gcc/4.1.1/130-libstdc++-pic.patch new file mode 100644 index 0000000..560bcb2 --- /dev/null +++ b/patches/gcc/4.1.1/130-libstdc++-pic.patch @@ -0,0 +1,50 @@ +# DP: Build and install libstdc++_pic.a library. + +--- gcc/libstdc++-v3/src/Makefile.am ++++ gcc/libstdc++-v3/src/Makefile.am +@@ -214,6 +214,12 @@ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ + + ++install-exec-local: ++ifeq ($(enable_shared),yes) ++ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++endif ++ + # Added bits to build debug library. + if GLIBCXX_BUILD_DEBUG + all-local: build_debug +--- gcc/libstdc++-v3/src/Makefile.in ++++ gcc/libstdc++-v3/src/Makefile.in +@@ -627,7 +627,7 @@ + + install-data-am: install-data-local + +-install-exec-am: install-toolexeclibLTLIBRARIES ++install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local + + install-info: install-info-am + +@@ -660,6 +660,7 @@ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-data-local install-exec \ ++ install-exec-local \ + install-exec-am install-info install-info-am install-man \ + install-strip install-toolexeclibLTLIBRARIES installcheck \ + installcheck-am installdirs maintainer-clean \ +@@ -743,6 +743,13 @@ + install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ++ ++install-exec-local: ++ifeq ($(enable_shared),yes) ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++endif ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff --git a/patches/gcc/4.1.1/140-missing-execinfo_h.patch b/patches/gcc/4.1.1/140-missing-execinfo_h.patch new file mode 100644 index 0000000..0e2092f --- /dev/null +++ b/patches/gcc/4.1.1/140-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 + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/patches/gcc/4.1.1/150-c99-snprintf.patch b/patches/gcc/4.1.1/150-c99-snprintf.patch new file mode 100644 index 0000000..dfb22d6 --- /dev/null +++ b/patches/gcc/4.1.1/150-c99-snprintf.patch @@ -0,0 +1,11 @@ +--- gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h-orig 2005-04-29 00:08:41.000000000 -0500 ++++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h 2005-04-29 00:08:45.000000000 -0500 +@@ -142,7 +142,7 @@ + using ::vsprintf; + } + +-#if _GLIBCXX_USE_C99 ++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf diff --git a/patches/gcc/4.1.1/160-c99-complex-ugly-hack.patch b/patches/gcc/4.1.1/160-c99-complex-ugly-hack.patch new file mode 100644 index 0000000..2ccc80d --- /dev/null +++ b/patches/gcc/4.1.1/160-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 ++#ifdef __UCLIBC__ ++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs ++#endif + int + main () + { diff --git a/patches/gcc/4.1.1/170-index_macro.patch b/patches/gcc/4.1.1/170-index_macro.patch new file mode 100644 index 0000000..1fac112 --- /dev/null +++ b/patches/gcc/4.1.1/170-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 + #include + ++/* 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 // For uninitialized_copy_n + #include // For power + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + namespace __gnu_cxx + { + using std::size_t; diff --git a/patches/gcc/4.1.1/180-sh-pr24836.patch b/patches/gcc/4.1.1/180-sh-pr24836.patch new file mode 100644 index 0000000..7992282 --- /dev/null +++ b/patches/gcc/4.1.1/180-sh-pr24836.patch @@ -0,0 +1,25 @@ +http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348 +http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24836 + +--- gcc/gcc/configure.ac (revision 106699) ++++ gcc/gcc/configure.ac (working copy) +@@ -2446,7 +2446,7 @@ + tls_first_minor=14 + tls_as_opt="-m64 -Aesame --fatal-warnings" + ;; +- sh-*-* | sh[34]-*-*) ++ sh-*-* | sh[34]*-*-*) + conftest_s=' + .section ".tdata","awT",@progbits + foo: .long 25 +--- gcc/gcc/configure ++++ gcc/gcc/configure +@@ -14846,7 +14846,7 @@ + tls_first_minor=14 + tls_as_opt="-m64 -Aesame --fatal-warnings" + ;; +- sh-*-* | sh[34]-*-*) ++ sh-*-* | sh[34]*-*-*) + conftest_s=' + .section ".tdata","awT",@progbits + foo: .long 25 diff --git a/patches/gcc/4.1.1/190-arm-bigendian.patch b/patches/gcc/4.1.1/190-arm-bigendian.patch new file mode 100644 index 0000000..1fa5ae1 --- /dev/null +++ b/patches/gcc/4.1.1/190-arm-bigendian.patch @@ -0,0 +1,67 @@ +By Lennert Buytenhek +Adds support for arm*b-linux* big-endian ARM targets + +See http://gcc.gnu.org/PR16350 + +--- gcc-4.1.0/gcc/config/arm/linux-elf.h ++++ gcc-4.1.0/gcc/config/arm/linux-elf.h +@@ -28,19 +28,33 @@ + #undef TARGET_VERSION + #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr); + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_ENDIAN_DEFAULT MASK_BIG_END ++#define TARGET_ENDIAN_OPTION "mbig-endian" ++#define TARGET_LINKER_EMULATION "armelfb_linux" ++#else ++#define TARGET_ENDIAN_DEFAULT 0 ++#define TARGET_ENDIAN_OPTION "mlittle-endian" ++#define TARGET_LINKER_EMULATION "armelf_linux" ++#endif ++ + #undef TARGET_DEFAULT_FLOAT_ABI + #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD + + #undef TARGET_DEFAULT +-#define TARGET_DEFAULT (0) ++#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT) + + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 + +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" + + #undef MULTILIB_DEFAULTS + #define MULTILIB_DEFAULTS \ +- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" } ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" } + + /* Now we define the strings used to build the spec file. */ + #undef LIB_SPEC +@@ -61,7 +75,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker " LINUX_TARGET_INTERPRETER "} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #undef LINK_SPEC +--- gcc-4.1.0/gcc/config.gcc ++++ gcc-4.1.0/gcc/config.gcc +@@ -672,6 +672,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" ++ case $target in ++ arm*b-*) ++ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" ++ ;; ++ esac + tmake_file="${tmake_file} t-linux arm/t-arm" + case ${target} in + arm*-*-linux-gnueabi) diff --git a/patches/gcc/4.1.1/200-softfloat-fix.patch b/patches/gcc/4.1.1/200-softfloat-fix.patch new file mode 100644 index 0000000..844c9a0 --- /dev/null +++ b/patches/gcc/4.1.1/200-softfloat-fix.patch @@ -0,0 +1,58 @@ +This patch (C) 2007 Yann E. MORIN +Licensed under GPL v2. + +First hunk of this patch solves compiling uClibc-0.9.28{,.1} : + +make[1]: Entering directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' + LD libuClibc-0.9.29.so +libc/libc_so.a(difftime.os): In function `difftime': +difftime.c:(.text+0x8): undefined reference to `__floatsidf' +difftime.c:(.text+0x2c): undefined reference to `__subdf3' +libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr': +_fpmaxtostr.c:(.text+0xd4): undefined reference to `__nedf2' +_fpmaxtostr.c:(.text+0xf8): undefined reference to `__eqdf2' +_fpmaxtostr.c:(.text+0x114): undefined reference to `__divdf3' +_fpmaxtostr.c:(.text+0x120): undefined reference to `__ltdf2' +_fpmaxtostr.c:(.text+0x1c4): undefined reference to `__muldf3' +_fpmaxtostr.c:(.text+0x388): undefined reference to `__gedf2' +_fpmaxtostr.c:(.text+0x430): undefined reference to `__adddf3' +libc/libc_so.a(__psfs_do_numeric.os): In function `__psfs_do_numeric': +__psfs_do_numeric.c:(.text+0x520): undefined reference to `__truncdfsf2' +libc/libc_so.a(strtof.os): In function `strtof': +strtof.c:(.text+0x1c): undefined reference to `__extendsfdf2' +/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/cc_core_prefix/lib/gcc/arm-linux-uclibc/4.1.1/libgcc.a(_fixunsdfsi.o): +In function `__fixunsdfsi': +libgcc2.c:(.text+0x34): undefined reference to `__fixdfsi' +make[2]: *** [lib/libc.so] Error 1 +make[1]: *** [lib/libc.so.0] Error 2 +make[1]: Leaving directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' +make: *** [/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc/lib/libc.a] +Error 2 + +The second hunk fixes building final gcc because soft-float implies using -lfloat (which we don't have). + + +diff -dur gcc-4.1.1.no-softfloat-fix/gcc/config.gcc gcc-4.1.1/gcc/config.gcc +--- gcc-4.1.1.no-softfloat-fix/gcc/config.gcc 2007-02-01 21:57:17.000000000 +0100 ++++ gcc-4.1.1/gcc/config.gcc 2007-02-01 22:11:06.000000000 +0100 +@@ -690,7 +690,7 @@ + default_use_cxa_atexit=yes + ;; + *) +- tmake_file="$tmake_file arm/t-linux" ++ tmake_file="$tmake_file arm/t-linux arm/t-arm-elf" + ;; + esac + tm_file="$tm_file arm/aout.h arm/arm.h" +diff -dur gcc-4.1.1.-lfloat/gcc/config/arm/linux-elf.h gcc-4.1.1/gcc/config/arm/linux-elf.h +--- gcc-4.1.1.-lfloat/gcc/config/arm/linux-elf.h 2007-02-01 21:57:17.000000000 +0100 ++++ gcc-4.1.1/gcc/config/arm/linux-elf.h 2007-02-01 23:00:42.000000000 +0100 +@@ -63,7 +63,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + #ifdef USE_UCLIBC + #define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0" diff --git a/patches/gcc/4.1.1/200-uclibc-locale.patch b/patches/gcc/4.1.1/200-uclibc-locale.patch deleted file mode 100644 index e5d712e..0000000 --- a/patches/gcc/4.1.1/200-uclibc-locale.patch +++ /dev/null @@ -1,3239 +0,0 @@ ---- gcc-4.1.0-dist/libstdc++-v3/acinclude.m4 -+++ gcc-4.1.0/libstdc++-v3/acinclude.m4 -@@ -1071,7 +1071,7 @@ - AC_MSG_CHECKING([for C locale to use]) - GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], - [use MODEL for target locale package], -- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto]) -+ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto]) - - # If they didn't use this option switch, or if they specified --enable - # with no specific model, we'll have to look for one. If they -@@ -1087,6 +1087,9 @@ - # Default to "generic". - if test $enable_clocale_flag = auto; then - case ${target_os} in -+ *-uclibc*) -+ enable_clocale_flag=uclibc -+ ;; - linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) - AC_EGREP_CPP([_GLIBCXX_ok], [ - #include -@@ -1230,6 +1233,40 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ AC_MSG_RESULT(uclibc) -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ AC_SUBST(glibcxx_MOFILES) -+ AC_SUBST(glibcxx_POFILES) -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the ---- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c++locale_internal.h -+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h -@@ -0,0 +1,63 @@ -+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*- -+ -+// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// Written by Jakub Jelinek -+ -+#include -+#include -+ -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning clean this up -+#endif -+ -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ -+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l; -+extern "C" __typeof(strcoll_l) __strcoll_l; -+extern "C" __typeof(strftime_l) __strftime_l; -+extern "C" __typeof(strtod_l) __strtod_l; -+extern "C" __typeof(strtof_l) __strtof_l; -+extern "C" __typeof(strtold_l) __strtold_l; -+extern "C" __typeof(strxfrm_l) __strxfrm_l; -+extern "C" __typeof(newlocale) __newlocale; -+extern "C" __typeof(freelocale) __freelocale; -+extern "C" __typeof(duplocale) __duplocale; -+extern "C" __typeof(uselocale) __uselocale; -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+extern "C" __typeof(iswctype_l) __iswctype_l; -+extern "C" __typeof(towlower_l) __towlower_l; -+extern "C" __typeof(towupper_l) __towupper_l; -+extern "C" __typeof(wcscoll_l) __wcscoll_l; -+extern "C" __typeof(wcsftime_l) __wcsftime_l; -+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l; -+extern "C" __typeof(wctype_l) __wctype_l; -+#endif -+ -+#endif // GLIBC 2.3 and later ---- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c_locale.cc -+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c_locale.cc -@@ -0,0 +1,152 @@ -+// Wrapper for underlying C-language localization -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004, 2005 -+// Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.8 Standard locale categories. -+// -+ -+// Written by Benjamin Kosnik -+ -+#include // For errno -+#include -+#include -+#include -+#include -+ -+#ifndef __UCLIBC_HAS_XLOCALE__ -+#define __strtol_l(S, E, B, L) strtol((S), (E), (B)) -+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B)) -+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B)) -+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B)) -+#define __strtof_l(S, E, L) strtof((S), (E)) -+#define __strtod_l(S, E, L) strtod((S), (E)) -+#define __strtold_l(S, E, L) strtold((S), (E)) -+#warning should dummy __newlocale check for C|POSIX ? -+#define __newlocale(a, b, c) NULL -+#define __freelocale(a) ((void)0) -+#define __duplocale(a) __c_locale() -+#endif -+ -+namespace std -+{ -+ template<> -+ void -+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, -+ const __c_locale& __cloc) -+ { -+ char* __sanity; -+ errno = 0; -+ float __f = __strtof_l(__s, &__sanity, __cloc); -+ if (__sanity != __s && errno != ERANGE) -+ __v = __f; -+ else -+ __err |= ios_base::failbit; -+ } -+ -+ template<> -+ void -+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, -+ const __c_locale& __cloc) -+ { -+ char* __sanity; -+ errno = 0; -+ double __d = __strtod_l(__s, &__sanity, __cloc); -+ if (__sanity != __s && errno != ERANGE) -+ __v = __d; -+ else -+ __err |= ios_base::failbit; -+ } -+ -+ template<> -+ void -+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err, -+ const __c_locale& __cloc) -+ { -+ char* __sanity; -+ errno = 0; -+ long double __ld = __strtold_l(__s, &__sanity, __cloc); -+ if (__sanity != __s && errno != ERANGE) -+ __v = __ld; -+ else -+ __err |= ios_base::failbit; -+ } -+ -+ void -+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, -+ __c_locale __old) -+ { -+ __cloc = __newlocale(1 << LC_ALL, __s, __old); -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ if (!__cloc) -+ { -+ // This named locale is not supported by the underlying OS. -+ __throw_runtime_error(__N("locale::facet::_S_create_c_locale " -+ "name not valid")); -+ } -+#endif -+ } -+ -+ void -+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc) -+ { -+ if (__cloc && _S_get_c_locale() != __cloc) -+ __freelocale(__cloc); -+ } -+ -+ __c_locale -+ locale::facet::_S_clone_c_locale(__c_locale& __cloc) -+ { return __duplocale(__cloc); } -+} // namespace std -+ -+namespace __gnu_cxx -+{ -+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] = -+ { -+ "LC_CTYPE", -+ "LC_NUMERIC", -+ "LC_TIME", -+ "LC_COLLATE", -+ "LC_MONETARY", -+ "LC_MESSAGES", -+#if _GLIBCXX_NUM_CATEGORIES != 0 -+ "LC_PAPER", -+ "LC_NAME", -+ "LC_ADDRESS", -+ "LC_TELEPHONE", -+ "LC_MEASUREMENT", -+ "LC_IDENTIFICATION" -+#endif -+ }; -+} -+ -+namespace std -+{ -+ const char* const* const locale::_S_categories = __gnu_cxx::category_names; -+} // namespace std ---- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c_locale.h -+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c_locale.h -@@ -0,0 +1,117 @@ -+// Wrapper for underlying C-language localization -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.8 Standard locale categories. -+// -+ -+// Written by Benjamin Kosnik -+ -+#ifndef _C_LOCALE_H -+#define _C_LOCALE_H 1 -+ -+#pragma GCC system_header -+ -+#include // get std::strlen -+#include // get std::snprintf or std::sprintf -+#include -+#include // For codecvt -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this -+#endif -+#ifdef __UCLIBC_HAS_LOCALE__ -+#include // For codecvt using iconv, iconv_t -+#endif -+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ -+#include // 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 -+ int -+ __convert_from_v(char* __out, -+ const int __size __attribute__ ((__unused__)), -+ const char* __fmt, -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ _Tv __v, const __c_locale& __cloc, int __prec) -+ { -+ __c_locale __old = __gnu_cxx::__uselocale(__cloc); -+#else -+ _Tv __v, const __c_locale&, int __prec) -+ { -+# ifdef __UCLIBC_HAS_LOCALE__ -+ char* __old = std::setlocale(LC_ALL, NULL); -+ char* __sav = new char[std::strlen(__old) + 1]; -+ std::strcpy(__sav, __old); -+ std::setlocale(LC_ALL, "C"); -+# endif -+#endif -+ -+ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v); -+ -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __gnu_cxx::__uselocale(__old); -+#elif defined __UCLIBC_HAS_LOCALE__ -+ std::setlocale(LC_ALL, __sav); -+ delete [] __sav; -+#endif -+ return __ret; -+ } -+} -+ -+#endif ---- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/codecvt_members.cc -+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc -@@ -0,0 +1,306 @@ -+// std::codecvt implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2002, 2003 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.1.5 - Template class codecvt -+// -+ -+// Written by Benjamin Kosnik -+ -+#include -+#include -+ -+namespace std -+{ -+ // Specializations. -+#ifdef _GLIBCXX_USE_WCHAR_T -+ codecvt_base::result -+ codecvt:: -+ 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(-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(__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:: -+ 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(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(-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(-1) -+ || __conv == static_cast(-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:: -+ 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:: -+ 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:: -+ 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(__builtin_alloca(sizeof(wchar_t) -+ * __max)); -+ while (__from < __end && __max) -+ { -+ const extern_type* __from_chunk_end; -+ __from_chunk_end = static_cast(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(-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(-1) -+ || __conv == static_cast(-2)) -+ break; -+ } -+ __state = __tmp_state; -+ __ret += __from - __tmp_from; -+ break; -+ } -+ if (!__from) -+ __from = __from_chunk_end; -+ -+ __ret += __from - __tmp_from; -+ __max -= __conv; -+ -+ if (__from < __end && __max) -+ { -+ // XXX Probably wrong for stateful encodings -+ __tmp_state = __state; -+ ++__from; -+ ++__ret; -+ --__max; -+ } -+ } -+ -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ -+ return __ret; -+ } -+#endif -+} ---- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/collate_members.cc -+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/collate_members.cc -@@ -0,0 +1,80 @@ -+// std::collate implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#include -+#include -+ -+#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::_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::_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::_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::_M_transform(wchar_t* __to, const wchar_t* __from, -+ size_t __n) const -+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); } -+#endif -+} ---- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/ctype_members.cc -+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc -@@ -0,0 +1,314 @@ -+// std::ctype implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions. -+// -+ -+// Written by Benjamin Kosnik -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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 specializations are in src/locale.cc and -+ // various /config/os/* files. -+ template<> -+ ctype_byname::ctype_byname(const char* __s, size_t __refs) -+ : ctype(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::__wmask_type -+ ctype::_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::do_toupper(wchar_t __c) const -+ { return __towupper_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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::do_tolower(wchar_t __c) const -+ { return __towlower_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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:: -+ do_is(mask __m, wchar_t __c) const -+ { -+ // The case of __m == ctype_base::space is particularly important, -+ // due to its use in many istream functions. Therefore we deal with -+ // it first, exploiting the knowledge that on GNU systems _M_bit[5] -+ // is the mask corresponding to ctype_base::space. NB: an encoding -+ // change would not affect correctness! -+ bool __ret = false; -+ if (__m == _M_bit[5]) -+ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype); -+ else -+ { -+ // Highest bitmask in ctype_base == 10, but extra in "C" -+ // library for blank. -+ const size_t __bitmasksize = 11; -+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) -+ if (__m & _M_bit[__bitcur]) -+ { -+ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype)) -+ { -+ __ret = true; -+ break; -+ } -+ else if (__m == _M_bit[__bitcur]) -+ break; -+ } -+ } -+ return __ret; -+ } -+ -+ const wchar_t* -+ ctype:: -+ 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:: -+ 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:: -+ 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:: -+ do_widen(char __c) const -+ { return _M_widen[static_cast(__c)]; } -+ -+ const char* -+ ctype:: -+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const -+ { -+ while (__lo < __hi) -+ { -+ *__dest = _M_widen[static_cast(*__lo)]; -+ ++__lo; -+ ++__dest; -+ } -+ return __hi; -+ } -+ -+ char -+ ctype:: -+ 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(__c)); -+ } -+ -+ const wchar_t* -+ ctype:: -+ 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(__c)); -+ } -+ ++__lo; -+ ++__dest; -+ } -+ else -+ while (__lo < __hi) -+ { -+ const int __c = wctob(*__lo); -+ *__dest = (__c == EOF ? __dfault : static_cast(__c)); -+ ++__lo; -+ ++__dest; -+ } -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ return __hi; -+ } -+ -+ void -+ ctype::_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(__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(_ISbit(__k)); -+ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]); -+ } -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ } -+#endif // _GLIBCXX_USE_WCHAR_T -+} ---- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/messages_members.cc -+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/messages_members.cc -@@ -0,0 +1,100 @@ -+// std::messages implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#include -+#include -+ -+#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::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(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::do_get(catalog, int, int, const wstring& __dfault) const -+ { -+# ifdef __UCLIBC_HAS_XLOCALE__ -+ __c_locale __old = __uselocale(_M_c_locale_messages); -+ char* __msg = gettext(_M_convert_to_char(__dfault)); -+ __uselocale(__old); -+ return _M_convert_from_char(__msg); -+# elif defined __UCLIBC_HAS_LOCALE__ -+ char* __old = strdup(setlocale(LC_ALL, NULL)); -+ setlocale(LC_ALL, _M_name_messages); -+ char* __msg = gettext(_M_convert_to_char(__dfault)); -+ setlocale(LC_ALL, __old); -+ free(__old); -+ return _M_convert_from_char(__msg); -+# else -+ char* __msg = gettext(_M_convert_to_char(__dfault)); -+ return _M_convert_from_char(__msg); -+# endif -+ } -+#endif -+} ---- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/messages_members.h -+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/messages_members.h -@@ -0,0 +1,121 @@ -+// std::messages implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.7.1.2 messages functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#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 -+ messages<_CharT>::messages(size_t __refs) -+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), -+ _M_name_messages(_S_get_c_name()) -+ { } -+ -+ template -+ messages<_CharT>::messages(__c_locale __cloc, const char* __s, -+ size_t __refs) -+ : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL) -+ { -+ const size_t __len = std::strlen(__s) + 1; -+ char* __tmp = new char[__len]; -+ std::memcpy(__tmp, __s, __len); -+ _M_name_messages = __tmp; -+ -+ // Last to avoid leaking memory if new throws. -+ _M_c_locale_messages = _S_clone_c_locale(__cloc); -+ } -+ -+ template -+ typename messages<_CharT>::catalog -+ messages<_CharT>::open(const basic_string& __s, const locale& __loc, -+ const char* __dir) const -+ { -+ __bindtextdomain(__s.c_str(), __dir); -+ return this->do_open(__s, __loc); -+ } -+ -+ // Virtual member functions. -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::do_open(const basic_string& __s, -+ const locale&) const -+ { -+ // No error checking is done, assume the catalog exists and can -+ // be used. -+ __textdomain(__s.c_str()); -+ return 0; -+ } -+ -+ template -+ void -+ messages<_CharT>::do_close(catalog) const -+ { } -+ -+ // messages_byname -+ template -+ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) -+ : messages<_CharT>(__refs) -+ { -+ if (this->_M_name_messages != locale::facet::_S_get_c_name()) -+ delete [] this->_M_name_messages; -+ char* __tmp = new char[std::strlen(__s) + 1]; -+ std::strcpy(__tmp, __s); -+ this->_M_name_messages = __tmp; -+ -+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) -+ { -+ this->_S_destroy_c_locale(this->_M_c_locale_messages); -+ this->_S_create_c_locale(this->_M_c_locale_messages, __s); -+ } -+ } ---- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/monetary_members.cc -+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc -@@ -0,0 +1,692 @@ -+// std::moneypunct implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning optimize this for uclibc -+#warning tailor for stub locale support -+#endif -+ -+#ifndef __UCLIBC_HAS_XLOCALE__ -+#define __nl_langinfo_l(N, L) nl_langinfo((N)) -+#endif -+ -+namespace std -+{ -+ // Construct and return valid pattern consisting of some combination of: -+ // space none symbol sign value -+ money_base::pattern -+ money_base::_S_construct_pattern(char __precedes, char __space, char __posn) -+ { -+ pattern __ret; -+ -+ // This insanely complicated routine attempts to construct a valid -+ // pattern for use with monyepunct. A couple of invariants: -+ -+ // if (__precedes) symbol -> value -+ // else value -> symbol -+ -+ // if (__space) space -+ // else none -+ -+ // none == never first -+ // space never first or last -+ -+ // Any elegant implementations of this are welcome. -+ switch (__posn) -+ { -+ case 0: -+ case 1: -+ // 1 The sign precedes the value and symbol. -+ __ret.field[0] = sign; -+ if (__space) -+ { -+ // Pattern starts with sign. -+ if (__precedes) -+ { -+ __ret.field[1] = symbol; -+ __ret.field[3] = value; -+ } -+ else -+ { -+ __ret.field[1] = value; -+ __ret.field[3] = symbol; -+ } -+ __ret.field[2] = space; -+ } -+ else -+ { -+ // Pattern starts with sign and ends with none. -+ if (__precedes) -+ { -+ __ret.field[1] = symbol; -+ __ret.field[2] = value; -+ } -+ else -+ { -+ __ret.field[1] = value; -+ __ret.field[2] = symbol; -+ } -+ __ret.field[3] = none; -+ } -+ break; -+ case 2: -+ // 2 The sign follows the value and symbol. -+ if (__space) -+ { -+ // Pattern either ends with sign. -+ if (__precedes) -+ { -+ __ret.field[0] = symbol; -+ __ret.field[2] = value; -+ } -+ else -+ { -+ __ret.field[0] = value; -+ __ret.field[2] = symbol; -+ } -+ __ret.field[1] = space; -+ __ret.field[3] = sign; -+ } -+ else -+ { -+ // Pattern ends with sign then none. -+ if (__precedes) -+ { -+ __ret.field[0] = symbol; -+ __ret.field[1] = value; -+ } -+ else -+ { -+ __ret.field[0] = value; -+ __ret.field[1] = symbol; -+ } -+ __ret.field[2] = sign; -+ __ret.field[3] = none; -+ } -+ break; -+ case 3: -+ // 3 The sign immediately precedes the symbol. -+ if (__precedes) -+ { -+ __ret.field[0] = sign; -+ __ret.field[1] = symbol; -+ if (__space) -+ { -+ __ret.field[2] = space; -+ __ret.field[3] = value; -+ } -+ else -+ { -+ __ret.field[2] = value; -+ __ret.field[3] = none; -+ } -+ } -+ else -+ { -+ __ret.field[0] = value; -+ if (__space) -+ { -+ __ret.field[1] = space; -+ __ret.field[2] = sign; -+ __ret.field[3] = symbol; -+ } -+ else -+ { -+ __ret.field[1] = sign; -+ __ret.field[2] = symbol; -+ __ret.field[3] = none; -+ } -+ } -+ break; -+ case 4: -+ // 4 The sign immediately follows the symbol. -+ if (__precedes) -+ { -+ __ret.field[0] = symbol; -+ __ret.field[1] = sign; -+ if (__space) -+ { -+ __ret.field[2] = space; -+ __ret.field[3] = value; -+ } -+ else -+ { -+ __ret.field[2] = value; -+ __ret.field[3] = none; -+ } -+ } -+ else -+ { -+ __ret.field[0] = value; -+ if (__space) -+ { -+ __ret.field[1] = space; -+ __ret.field[2] = symbol; -+ __ret.field[3] = sign; -+ } -+ else -+ { -+ __ret.field[1] = symbol; -+ __ret.field[2] = sign; -+ __ret.field[3] = none; -+ } -+ } -+ break; -+ default: -+ __ret = pattern(); -+ } -+ return __ret; -+ } -+ -+ template<> -+ void -+ moneypunct::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::~moneypunct() -+ { delete _M_data; } -+ -+ template<> -+ moneypunct::~moneypunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ moneypunct::_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; -+ -+ 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(money_base::_S_atoms[__i]); -+ } -+ else -+ { -+ // Named locale. -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __c_locale __old = __uselocale(__cloc); -+#else -+ // Switch to named locale so that mbsrtowcs will work. -+ char* __old = strdup(setlocale(LC_ALL, NULL)); -+ setlocale(LC_ALL, __name); -+#endif -+ -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this... should be monetary -+#endif -+#ifdef __UCLIBC__ -+# ifdef __UCLIBC_HAS_XLOCALE__ -+ _M_data->_M_decimal_point = __cloc->decimal_point_wc; -+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; -+# elif defined __UCLIBC_HAS_LOCALE__ -+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; -+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; -+# endif -+#else -+ union { char *__s; wchar_t __w; } __u; -+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); -+ _M_data->_M_decimal_point = __u.__w; -+ -+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); -+ _M_data->_M_thousands_sep = __u.__w; -+#endif -+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); -+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); -+ -+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); -+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); -+ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); -+ -+ wchar_t* __wcs_ps = 0; -+ wchar_t* __wcs_ns = 0; -+ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); -+ try -+ { -+ mbstate_t __state; -+ size_t __len = strlen(__cpossign); -+ if (__len) -+ { -+ ++__len; -+ memset(&__state, 0, sizeof(mbstate_t)); -+ __wcs_ps = new wchar_t[__len]; -+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); -+ _M_data->_M_positive_sign = __wcs_ps; -+ } -+ else -+ _M_data->_M_positive_sign = L""; -+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); -+ -+ __len = strlen(__cnegsign); -+ if (!__nposn) -+ _M_data->_M_negative_sign = L"()"; -+ else if (__len) -+ { -+ ++__len; -+ memset(&__state, 0, sizeof(mbstate_t)); -+ __wcs_ns = new wchar_t[__len]; -+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); -+ _M_data->_M_negative_sign = __wcs_ns; -+ } -+ else -+ _M_data->_M_negative_sign = L""; -+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); -+ -+ // _Intl == true. -+ __len = strlen(__ccurr); -+ if (__len) -+ { -+ ++__len; -+ memset(&__state, 0, sizeof(mbstate_t)); -+ wchar_t* __wcs = new wchar_t[__len]; -+ mbsrtowcs(__wcs, &__ccurr, __len, &__state); -+ _M_data->_M_curr_symbol = __wcs; -+ } -+ else -+ _M_data->_M_curr_symbol = L""; -+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); -+ } -+ catch (...) -+ { -+ delete _M_data; -+ _M_data = 0; -+ delete __wcs_ps; -+ delete __wcs_ns; -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#else -+ setlocale(LC_ALL, __old); -+ free(__old); -+#endif -+ __throw_exception_again; -+ } -+ -+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, -+ __cloc)); -+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); -+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); -+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); -+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, -+ __pposn); -+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); -+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); -+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, -+ __nposn); -+ -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#else -+ setlocale(LC_ALL, __old); -+ free(__old); -+#endif -+ } -+ } -+ -+ template<> -+ void -+ moneypunct::_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; -+ -+ 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(money_base::_S_atoms[__i]); -+ } -+ else -+ { -+ // Named locale. -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __c_locale __old = __uselocale(__cloc); -+#else -+ // Switch to named locale so that mbsrtowcs will work. -+ char* __old = strdup(setlocale(LC_ALL, NULL)); -+ setlocale(LC_ALL, __name); -+#endif -+ -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this... should be monetary -+#endif -+#ifdef __UCLIBC__ -+# ifdef __UCLIBC_HAS_XLOCALE__ -+ _M_data->_M_decimal_point = __cloc->decimal_point_wc; -+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; -+# elif defined __UCLIBC_HAS_LOCALE__ -+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; -+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; -+# endif -+#else -+ union { char *__s; wchar_t __w; } __u; -+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); -+ _M_data->_M_decimal_point = __u.__w; -+ -+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); -+ _M_data->_M_thousands_sep = __u.__w; -+#endif -+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); -+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); -+ -+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); -+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); -+ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); -+ -+ wchar_t* __wcs_ps = 0; -+ wchar_t* __wcs_ns = 0; -+ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); -+ try -+ { -+ mbstate_t __state; -+ size_t __len; -+ __len = strlen(__cpossign); -+ if (__len) -+ { -+ ++__len; -+ memset(&__state, 0, sizeof(mbstate_t)); -+ __wcs_ps = new wchar_t[__len]; -+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); -+ _M_data->_M_positive_sign = __wcs_ps; -+ } -+ else -+ _M_data->_M_positive_sign = L""; -+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); -+ -+ __len = strlen(__cnegsign); -+ if (!__nposn) -+ _M_data->_M_negative_sign = L"()"; -+ else if (__len) -+ { -+ ++__len; -+ memset(&__state, 0, sizeof(mbstate_t)); -+ __wcs_ns = new wchar_t[__len]; -+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); -+ _M_data->_M_negative_sign = __wcs_ns; -+ } -+ else -+ _M_data->_M_negative_sign = L""; -+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); -+ -+ // _Intl == true. -+ __len = strlen(__ccurr); -+ if (__len) -+ { -+ ++__len; -+ memset(&__state, 0, sizeof(mbstate_t)); -+ wchar_t* __wcs = new wchar_t[__len]; -+ mbsrtowcs(__wcs, &__ccurr, __len, &__state); -+ _M_data->_M_curr_symbol = __wcs; -+ } -+ else -+ _M_data->_M_curr_symbol = L""; -+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); -+ } -+ catch (...) -+ { -+ delete _M_data; -+ _M_data = 0; -+ delete __wcs_ps; -+ delete __wcs_ns; -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#else -+ setlocale(LC_ALL, __old); -+ free(__old); -+#endif -+ __throw_exception_again; -+ } -+ -+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); -+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); -+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); -+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); -+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, -+ __pposn); -+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); -+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); -+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, -+ __nposn); -+ -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#else -+ setlocale(LC_ALL, __old); -+ free(__old); -+#endif -+ } -+ } -+ -+ template<> -+ moneypunct::~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::~moneypunct() -+ { -+ if (_M_data->_M_positive_sign_size) -+ delete [] _M_data->_M_positive_sign; -+ if (_M_data->_M_negative_sign_size -+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0) -+ delete [] _M_data->_M_negative_sign; -+ if (_M_data->_M_curr_symbol_size) -+ delete [] _M_data->_M_curr_symbol; -+ delete _M_data; -+ } -+#endif -+} ---- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/numeric_members.cc -+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc -@@ -0,0 +1,173 @@ -+// std::numpunct implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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::~numpunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ numpunct::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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(__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(__num_base::_S_atoms_in[__j]); -+ } -+ else -+ { -+ // Named locale. -+ // NB: In the GNU model wchar_t is always 32 bit wide. -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this -+#endif -+#ifdef __UCLIBC__ -+# ifdef __UCLIBC_HAS_XLOCALE__ -+ _M_data->_M_decimal_point = __cloc->decimal_point_wc; -+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; -+# elif defined __UCLIBC_HAS_LOCALE__ -+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; -+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; -+# endif -+#else -+ union { char *__s; wchar_t __w; } __u; -+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc); -+ _M_data->_M_decimal_point = __u.__w; -+ -+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc); -+ _M_data->_M_thousands_sep = __u.__w; -+#endif -+ -+ if (_M_data->_M_thousands_sep == L'\0') -+ _M_data->_M_grouping = ""; -+ else -+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); -+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); -+ } -+ -+ // NB: There is no way to extact this info from posix locales. -+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); -+ _M_data->_M_truename = L"true"; -+ _M_data->_M_truename_size = 4; -+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); -+ _M_data->_M_falsename = L"false"; -+ _M_data->_M_falsename_size = 5; -+ } -+ -+ template<> -+ numpunct::~numpunct() -+ { delete _M_data; } -+ #endif -+} ---- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/time_members.cc -+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/time_members.cc -@@ -0,0 +1,406 @@ -+// std::time_get, std::time_put implementation, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions -+// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#include -+#include -+ -+#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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+ 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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+#warning wide time stuff -+// if (!__cloc) -+ { -+ // "C" locale -+ _M_c_locale_timepunct = _S_get_c_locale(); -+ -+ _M_data->_M_date_format = L"%m/%d/%y"; -+ _M_data->_M_date_era_format = L"%m/%d/%y"; -+ _M_data->_M_time_format = L"%H:%M:%S"; -+ _M_data->_M_time_era_format = L"%H:%M:%S"; -+ _M_data->_M_date_time_format = L""; -+ _M_data->_M_date_time_era_format = L""; -+ _M_data->_M_am = L"AM"; -+ _M_data->_M_pm = L"PM"; -+ _M_data->_M_am_pm_format = L""; -+ -+ // Day names, starting with "C"'s Sunday. -+ _M_data->_M_day1 = L"Sunday"; -+ _M_data->_M_day2 = L"Monday"; -+ _M_data->_M_day3 = L"Tuesday"; -+ _M_data->_M_day4 = L"Wednesday"; -+ _M_data->_M_day5 = L"Thursday"; -+ _M_data->_M_day6 = L"Friday"; -+ _M_data->_M_day7 = L"Saturday"; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ _M_data->_M_aday1 = L"Sun"; -+ _M_data->_M_aday2 = L"Mon"; -+ _M_data->_M_aday3 = L"Tue"; -+ _M_data->_M_aday4 = L"Wed"; -+ _M_data->_M_aday5 = L"Thu"; -+ _M_data->_M_aday6 = L"Fri"; -+ _M_data->_M_aday7 = L"Sat"; -+ -+ // Month names, starting with "C"'s January. -+ _M_data->_M_month01 = L"January"; -+ _M_data->_M_month02 = L"February"; -+ _M_data->_M_month03 = L"March"; -+ _M_data->_M_month04 = L"April"; -+ _M_data->_M_month05 = L"May"; -+ _M_data->_M_month06 = L"June"; -+ _M_data->_M_month07 = L"July"; -+ _M_data->_M_month08 = L"August"; -+ _M_data->_M_month09 = L"September"; -+ _M_data->_M_month10 = L"October"; -+ _M_data->_M_month11 = L"November"; -+ _M_data->_M_month12 = L"December"; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ _M_data->_M_amonth01 = L"Jan"; -+ _M_data->_M_amonth02 = L"Feb"; -+ _M_data->_M_amonth03 = L"Mar"; -+ _M_data->_M_amonth04 = L"Apr"; -+ _M_data->_M_amonth05 = L"May"; -+ _M_data->_M_amonth06 = L"Jun"; -+ _M_data->_M_amonth07 = L"Jul"; -+ _M_data->_M_amonth08 = L"Aug"; -+ _M_data->_M_amonth09 = L"Sep"; -+ _M_data->_M_amonth10 = L"Oct"; -+ _M_data->_M_amonth11 = L"Nov"; -+ _M_data->_M_amonth12 = L"Dec"; -+ } -+#if 0 -+ else -+ { -+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); -+ -+ union { char *__s; wchar_t *__w; } __u; -+ -+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); -+ _M_data->_M_date_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); -+ _M_data->_M_date_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); -+ _M_data->_M_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); -+ _M_data->_M_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); -+ _M_data->_M_date_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); -+ _M_data->_M_date_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); -+ _M_data->_M_am = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); -+ _M_data->_M_pm = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); -+ _M_data->_M_am_pm_format = __u.__w; -+ -+ // Day names, starting with "C"'s Sunday. -+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); -+ _M_data->_M_day1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); -+ _M_data->_M_day2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); -+ _M_data->_M_day3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); -+ _M_data->_M_day4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); -+ _M_data->_M_day5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); -+ _M_data->_M_day6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); -+ _M_data->_M_day7 = __u.__w; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); -+ _M_data->_M_aday1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); -+ _M_data->_M_aday2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); -+ _M_data->_M_aday3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); -+ _M_data->_M_aday4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); -+ _M_data->_M_aday5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); -+ _M_data->_M_aday6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); -+ _M_data->_M_aday7 = __u.__w; -+ -+ // Month names, starting with "C"'s January. -+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); -+ _M_data->_M_month01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); -+ _M_data->_M_month02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); -+ _M_data->_M_month03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); -+ _M_data->_M_month04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); -+ _M_data->_M_month05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); -+ _M_data->_M_month06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); -+ _M_data->_M_month07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); -+ _M_data->_M_month08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); -+ _M_data->_M_month09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); -+ _M_data->_M_month10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); -+ _M_data->_M_month11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); -+ _M_data->_M_month12 = __u.__w; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); -+ _M_data->_M_amonth01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); -+ _M_data->_M_amonth02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); -+ _M_data->_M_amonth03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); -+ _M_data->_M_amonth04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); -+ _M_data->_M_amonth05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); -+ _M_data->_M_amonth06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); -+ _M_data->_M_amonth07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); -+ _M_data->_M_amonth08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); -+ _M_data->_M_amonth09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); -+ _M_data->_M_amonth10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); -+ _M_data->_M_amonth11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); -+ _M_data->_M_amonth12 = __u.__w; -+ } -+#endif // 0 -+ } -+#endif -+} ---- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/time_members.h -+++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/time_members.h -@@ -0,0 +1,76 @@ -+// std::time_get, std::time_put implementation, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.5.1.2 - time_get functions -+// ISO C++ 14882: 22.2.5.3.2 - time_put functions -+// -+ -+// Written by Benjamin Kosnik -+ -+ template -+ __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 -+ __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 -+ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, -+ size_t __refs) -+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), -+ _M_name_timepunct(NULL) -+ { -+ const size_t __len = std::strlen(__s) + 1; -+ char* __tmp = new char[__len]; -+ std::memcpy(__tmp, __s, __len); -+ _M_name_timepunct = __tmp; -+ -+ try -+ { _M_initialize_timepunct(__cloc); } -+ catch(...) -+ { -+ delete [] _M_name_timepunct; -+ __throw_exception_again; -+ } -+ } -+ -+ template -+ __timepunct<_CharT>::~__timepunct() -+ { -+ if (_M_name_timepunct != _S_get_c_name()) -+ delete [] _M_name_timepunct; -+ delete _M_data; -+ _S_destroy_c_locale(_M_c_locale_timepunct); -+ } ---- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_base.h -+++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_base.h -@@ -0,0 +1,64 @@ -+// Locale support -*- C++ -*- -+ -+// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 -+// Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.1 Locales -+// -+ -+/** @file ctype_base.h -+ * This is an internal header file, included by other library headers. -+ * You should not attempt to use it directly. -+ */ -+ -+// Information as gleaned from /usr/include/ctype.h -+ -+ /// @brief Base class for ctype. -+ struct ctype_base -+ { -+ // Note: In uClibc, the following two types depend on configuration. -+ -+ // Non-standard typedefs. -+ typedef const __ctype_touplow_t* __to_type; -+ -+ // NB: Offsets into ctype::_M_table force a particular size -+ // on the mask type. Because of this, we don't use an enum. -+ typedef __ctype_mask_t mask; -+ static const mask upper = _ISupper; -+ static const mask lower = _ISlower; -+ static const mask alpha = _ISalpha; -+ static const mask digit = _ISdigit; -+ static const mask xdigit = _ISxdigit; -+ static const mask space = _ISspace; -+ static const mask print = _ISprint; -+ static const mask graph = _ISalpha | _ISdigit | _ISpunct; -+ static const mask cntrl = _IScntrl; -+ static const mask punct = _ISpunct; -+ static const mask alnum = _ISalpha | _ISdigit; -+ }; ---- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_inline.h -+++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_inline.h -@@ -0,0 +1,69 @@ -+// Locale support -*- C++ -*- -+ -+// Copyright (C) 2000, 2002 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.1 Locales -+// -+ -+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) -+// functions go in ctype.cc -+ -+ bool -+ ctype:: -+ is(mask __m, char __c) const -+ { return _M_table[static_cast(__c)] & __m; } -+ -+ const char* -+ ctype:: -+ is(const char* __low, const char* __high, mask* __vec) const -+ { -+ while (__low < __high) -+ *__vec++ = _M_table[static_cast(*__low++)]; -+ return __high; -+ } -+ -+ const char* -+ ctype:: -+ scan_is(mask __m, const char* __low, const char* __high) const -+ { -+ while (__low < __high -+ && !(_M_table[static_cast(*__low)] & __m)) -+ ++__low; -+ return __low; -+ } -+ -+ const char* -+ ctype:: -+ scan_not(mask __m, const char* __low, const char* __high) const -+ { -+ while (__low < __high -+ && (_M_table[static_cast(*__low)] & __m) != 0) -+ ++__low; -+ return __low; -+ } ---- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_noninline.h -+++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h -@@ -0,0 +1,92 @@ -+// Locale support -*- C++ -*- -+ -+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 -+// Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.1 Locales -+// -+ -+// Information as gleaned from /usr/include/ctype.h -+ -+ const ctype_base::mask* -+ ctype::classic_table() throw() -+ { return __C_ctype_b; } -+ -+ ctype::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::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::do_toupper(char __c) const -+ { return _M_toupper[static_cast(__c)]; } -+ -+ const char* -+ ctype::do_toupper(char* __low, const char* __high) const -+ { -+ while (__low < __high) -+ { -+ *__low = _M_toupper[static_cast(*__low)]; -+ ++__low; -+ } -+ return __high; -+ } -+ -+ char -+ ctype::do_tolower(char __c) const -+ { return _M_tolower[static_cast(__c)]; } -+ -+ const char* -+ ctype::do_tolower(char* __low, const char* __high) const -+ { -+ while (__low < __high) -+ { -+ *__low = _M_tolower[static_cast(*__low)]; -+ ++__low; -+ } -+ return __high; -+ } ---- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/os_defines.h -+++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/os_defines.h -@@ -0,0 +1,44 @@ -+// Specific definitions for GNU/Linux -*- C++ -*- -+ -+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+#ifndef _GLIBCXX_OS_DEFINES -+#define _GLIBCXX_OS_DEFINES 1 -+ -+// System-specific #define, typedefs, corrections, etc, go here. This -+// file will come before all others. -+ -+// This keeps isanum, et al from being propagated as macros. -+#define __NO_CTYPE 1 -+ -+#include -+ -+// We must not see the optimized string functions GNU libc defines. -+#define __NO_STRING_INLINES -+ -+#endif ---- gcc-4.1.0-dist/libstdc++-v3/configure -+++ gcc-4.1.0/libstdc++-v3/configure -@@ -4005,6 +4005,11 @@ - lt_cv_deplibs_check_method=pass_all - ;; - -+linux-uclibc*) -+ lt_cv_deplibs_check_method=pass_all -+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` -+ ;; -+ - netbsd* | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' -@@ -5740,7 +5745,7 @@ - enableval="$enable_clocale" - - case "$enableval" in -- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;; -+ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;; - *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5 - echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;} - { (exit 1); exit 1; }; } ;; -@@ -5765,6 +5770,9 @@ - # Default to "generic". - if test $enable_clocale_flag = auto; then - case ${target_os} in -+ linux-uclibc*) -+ enable_clocale_flag=uclibc -+ ;; - linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) - cat >conftest.$ac_ext <<_ACEOF - /* confdefs.h. */ -@@ -5995,6 +6003,76 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ echo "$as_me:$LINENO: result: uclibc" >&5 -+echo "${ECHO_T}uclibc" >&6 -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ # Extract the first word of "msgfmt", so it can be a program name with args. -+set dummy msgfmt; ac_word=$2 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_check_msgfmt+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$check_msgfmt"; then -+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. -+else -+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -+for as_dir in $PATH -+do -+ IFS=$as_save_IFS -+ test -z "$as_dir" && as_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_check_msgfmt="yes" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done -+ -+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" -+fi -+fi -+check_msgfmt=$ac_cv_prog_check_msgfmt -+if test -n "$check_msgfmt"; then -+ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 -+echo "${ECHO_T}$check_msgfmt" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ -+ -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the ---- gcc-4.1.0-dist/libstdc++-v3/configure.host -+++ gcc-4.1.0/libstdc++-v3/configure.host -@@ -261,6 +261,12 @@ - ;; - esac - -+# Override for uClibc since linux-uclibc gets mishandled above. -+case "${host_os}" in -+ *-uclibc*) -+ os_include_dir="os/uclibc" -+ ;; -+esac - - # Set any OS-dependent and CPU-dependent bits. - # THIS TABLE IS SORTED. KEEP IT THAT WAY. ---- gcc-4.1.0-dist/libstdc++-v3/crossconfig.m4 -+++ gcc-4.1.0/libstdc++-v3/crossconfig.m4 -@@ -143,6 +143,99 @@ - ;; - esac - ;; -+ *-uclibc*) -+# Temporary hack until we implement the float versions of the libm funcs -+ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ -+ machine/endian.h machine/param.h sys/machine.h sys/types.h \ -+ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h]) -+ SECTION_FLAGS='-ffunction-sections -fdata-sections' -+ AC_SUBST(SECTION_FLAGS) -+ GLIBCXX_CHECK_LINKER_FEATURES -+ GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT -+ GLIBCXX_CHECK_WCHAR_T_SUPPORT -+ -+ # For LFS. -+ AC_DEFINE(HAVE_INT64_T) -+ case "$target" in -+ *-uclinux*) -+ # Don't enable LFS with uClinux -+ ;; -+ *) -+ AC_DEFINE(_GLIBCXX_USE_LFS) -+ esac -+ -+ # For showmanyc_helper(). -+ AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) -+ GLIBCXX_CHECK_POLL -+ GLIBCXX_CHECK_S_ISREG_OR_S_IFREG -+ -+ # For xsputn_2(). -+ AC_CHECK_HEADERS(sys/uio.h) -+ GLIBCXX_CHECK_WRITEV -+ -+# AC_DEFINE(HAVE_ACOSF) -+# AC_DEFINE(HAVE_ASINF) -+# AC_DEFINE(HAVE_ATANF) -+# AC_DEFINE(HAVE_ATAN2F) -+ AC_DEFINE(HAVE_CEILF) -+ AC_DEFINE(HAVE_COPYSIGN) -+# AC_DEFINE(HAVE_COPYSIGNF) -+# AC_DEFINE(HAVE_COSF) -+# AC_DEFINE(HAVE_COSHF) -+# AC_DEFINE(HAVE_EXPF) -+# AC_DEFINE(HAVE_FABSF) -+ AC_DEFINE(HAVE_FINITE) -+ AC_DEFINE(HAVE_FINITEF) -+ AC_DEFINE(HAVE_FLOORF) -+# AC_DEFINE(HAVE_FMODF) -+# AC_DEFINE(HAVE_FREXPF) -+ AC_DEFINE(HAVE_HYPOT) -+# AC_DEFINE(HAVE_HYPOTF) -+ AC_DEFINE(HAVE_ISINF) -+ AC_DEFINE(HAVE_ISINFF) -+ AC_DEFINE(HAVE_ISNAN) -+ AC_DEFINE(HAVE_ISNANF) -+# AC_DEFINE(HAVE_LOGF) -+# AC_DEFINE(HAVE_LOG10F) -+# AC_DEFINE(HAVE_MODFF) -+# AC_DEFINE(HAVE_SINF) -+# AC_DEFINE(HAVE_SINHF) -+# AC_DEFINE(HAVE_SINCOS) -+# AC_DEFINE(HAVE_SINCOSF) -+ AC_DEFINE(HAVE_SQRTF) -+# AC_DEFINE(HAVE_TANF) -+# AC_DEFINE(HAVE_TANHF) -+ if test x"long_double_math_on_this_cpu" = x"yes"; then -+ AC_MSG_ERROR([long_double_math_on_this_cpu is yes!]) -+# AC_DEFINE(HAVE_ACOSL) -+# AC_DEFINE(HAVE_ASINL) -+# AC_DEFINE(HAVE_ATANL) -+# AC_DEFINE(HAVE_ATAN2L) -+# AC_DEFINE(HAVE_CEILL) -+# AC_DEFINE(HAVE_COPYSIGNL) -+# AC_DEFINE(HAVE_COSL) -+# AC_DEFINE(HAVE_COSHL) -+# AC_DEFINE(HAVE_EXPL) -+# AC_DEFINE(HAVE_FABSL) -+# AC_DEFINE(HAVE_FINITEL) -+# AC_DEFINE(HAVE_FLOORL) -+# AC_DEFINE(HAVE_FMODL) -+# AC_DEFINE(HAVE_FREXPL) -+# AC_DEFINE(HAVE_HYPOTL) -+# AC_DEFINE(HAVE_ISINFL) -+# AC_DEFINE(HAVE_ISNANL) -+# AC_DEFINE(HAVE_LOGL) -+# AC_DEFINE(HAVE_LOG10L) -+# AC_DEFINE(HAVE_MODFL) -+# AC_DEFINE(HAVE_POWL) -+# AC_DEFINE(HAVE_SINL) -+# AC_DEFINE(HAVE_SINHL) -+# AC_DEFINE(HAVE_SINCOSL) -+# AC_DEFINE(HAVE_SQRTL) -+# AC_DEFINE(HAVE_TANL) -+# AC_DEFINE(HAVE_TANHL) -+ fi -+ ;; - *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu) - AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ - machine/endian.h machine/param.h sys/machine.h sys/types.h \ -@@ -157,7 +250,7 @@ - AC_DEFINE(HAVE_INT64_T) - case "$target" in - *-uclinux*) -- # Don't enable LFS with uClibc -+ # Don't enable LFS with uClinux - ;; - *) - AC_DEFINE(_GLIBCXX_USE_LFS) ---- gcc-4.1.0-dist/libstdc++-v3/include/c_compatibility/wchar.h -+++ gcc-4.1.0/libstdc++-v3/include/c_compatibility/wchar.h -@@ -101,7 +101,9 @@ - using std::wmemcpy; - using std::wmemmove; - using std::wmemset; -+#if _GLIBCXX_HAVE_WCSFTIME - using std::wcsftime; -+#endif - - #if _GLIBCXX_USE_C99 - using std::wcstold; ---- gcc-4.1.0-dist/libstdc++-v3/include/c_std/std_cwchar.h -+++ gcc-4.1.0/libstdc++-v3/include/c_std/std_cwchar.h -@@ -180,7 +180,9 @@ - using ::wcscoll; - using ::wcscpy; - using ::wcscspn; -+#if _GLIBCXX_HAVE_WCSFTIME - using ::wcsftime; -+#endif - using ::wcslen; - using ::wcsncat; - using ::wcsncmp; diff --git a/patches/gcc/4.1.1/300-libstdc++-pic.patch b/patches/gcc/4.1.1/300-libstdc++-pic.patch deleted file mode 100644 index 560bcb2..0000000 --- a/patches/gcc/4.1.1/300-libstdc++-pic.patch +++ /dev/null @@ -1,50 +0,0 @@ -# DP: Build and install libstdc++_pic.a library. - ---- gcc/libstdc++-v3/src/Makefile.am -+++ gcc/libstdc++-v3/src/Makefile.am -@@ -214,6 +214,12 @@ - $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ - - -+install-exec-local: -+ifeq ($(enable_shared),yes) -+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) -+endif -+ - # Added bits to build debug library. - if GLIBCXX_BUILD_DEBUG - all-local: build_debug ---- gcc/libstdc++-v3/src/Makefile.in -+++ gcc/libstdc++-v3/src/Makefile.in -@@ -627,7 +627,7 @@ - - install-data-am: install-data-local - --install-exec-am: install-toolexeclibLTLIBRARIES -+install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local - - install-info: install-info-am - -@@ -660,6 +660,7 @@ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-data-local install-exec \ -+ install-exec-local \ - install-exec-am install-info install-info-am install-man \ - install-strip install-toolexeclibLTLIBRARIES installcheck \ - installcheck-am installdirs maintainer-clean \ -@@ -743,6 +743,13 @@ - install_debug: - (cd ${debugdir} && $(MAKE) \ - toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) -+ -+install-exec-local: -+ifeq ($(enable_shared),yes) -+ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) -+endif -+ - # Tell versions [3.59,3.63) of GNU make to not export all variables. - # Otherwise a system limit (for SysV at least) may be exceeded. - .NOEXPORT: diff --git a/patches/gcc/4.1.1/301-missing-execinfo_h.patch b/patches/gcc/4.1.1/301-missing-execinfo_h.patch deleted file mode 100644 index 0e2092f..0000000 --- a/patches/gcc/4.1.1/301-missing-execinfo_h.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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 - # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ -- && !defined(__ia64__) -+ && !defined(__ia64__) && !defined(__UCLIBC__) - # ifndef GC_HAVE_BUILTIN_BACKTRACE - # define GC_HAVE_BUILTIN_BACKTRACE - # endif diff --git a/patches/gcc/4.1.1/302-c99-snprintf.patch b/patches/gcc/4.1.1/302-c99-snprintf.patch deleted file mode 100644 index dfb22d6..0000000 --- a/patches/gcc/4.1.1/302-c99-snprintf.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h-orig 2005-04-29 00:08:41.000000000 -0500 -+++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h 2005-04-29 00:08:45.000000000 -0500 -@@ -142,7 +142,7 @@ - using ::vsprintf; - } - --#if _GLIBCXX_USE_C99 -+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) - - #undef snprintf - #undef vfscanf diff --git a/patches/gcc/4.1.1/303-c99-complex-ugly-hack.patch b/patches/gcc/4.1.1/303-c99-complex-ugly-hack.patch deleted file mode 100644 index 2ccc80d..0000000 --- a/patches/gcc/4.1.1/303-c99-complex-ugly-hack.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- 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 -+#ifdef __UCLIBC__ -+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs -+#endif - int - main () - { diff --git a/patches/gcc/4.1.1/304-index_macro.patch b/patches/gcc/4.1.1/304-index_macro.patch deleted file mode 100644 index 1fac112..0000000 --- a/patches/gcc/4.1.1/304-index_macro.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- 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 - #include - -+/* 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 // For uninitialized_copy_n - #include // For power - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - namespace __gnu_cxx - { - using std::size_t; diff --git a/patches/gcc/4.1.1/740-sh-pr24836.patch b/patches/gcc/4.1.1/740-sh-pr24836.patch deleted file mode 100644 index 7992282..0000000 --- a/patches/gcc/4.1.1/740-sh-pr24836.patch +++ /dev/null @@ -1,25 +0,0 @@ -http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348 -http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24836 - ---- gcc/gcc/configure.ac (revision 106699) -+++ gcc/gcc/configure.ac (working copy) -@@ -2446,7 +2446,7 @@ - tls_first_minor=14 - tls_as_opt="-m64 -Aesame --fatal-warnings" - ;; -- sh-*-* | sh[34]-*-*) -+ sh-*-* | sh[34]*-*-*) - conftest_s=' - .section ".tdata","awT",@progbits - foo: .long 25 ---- gcc/gcc/configure -+++ gcc/gcc/configure -@@ -14846,7 +14846,7 @@ - tls_first_minor=14 - tls_as_opt="-m64 -Aesame --fatal-warnings" - ;; -- sh-*-* | sh[34]-*-*) -+ sh-*-* | sh[34]*-*-*) - conftest_s=' - .section ".tdata","awT",@progbits - foo: .long 25 diff --git a/patches/gcc/4.1.1/800-arm-bigendian.patch b/patches/gcc/4.1.1/800-arm-bigendian.patch deleted file mode 100644 index 1fa5ae1..0000000 --- a/patches/gcc/4.1.1/800-arm-bigendian.patch +++ /dev/null @@ -1,67 +0,0 @@ -By Lennert Buytenhek -Adds support for arm*b-linux* big-endian ARM targets - -See http://gcc.gnu.org/PR16350 - ---- gcc-4.1.0/gcc/config/arm/linux-elf.h -+++ gcc-4.1.0/gcc/config/arm/linux-elf.h -@@ -28,19 +28,33 @@ - #undef TARGET_VERSION - #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr); - -+/* -+ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* -+ * (big endian) configurations. -+ */ -+#if TARGET_BIG_ENDIAN_DEFAULT -+#define TARGET_ENDIAN_DEFAULT MASK_BIG_END -+#define TARGET_ENDIAN_OPTION "mbig-endian" -+#define TARGET_LINKER_EMULATION "armelfb_linux" -+#else -+#define TARGET_ENDIAN_DEFAULT 0 -+#define TARGET_ENDIAN_OPTION "mlittle-endian" -+#define TARGET_LINKER_EMULATION "armelf_linux" -+#endif -+ - #undef TARGET_DEFAULT_FLOAT_ABI - #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD - - #undef TARGET_DEFAULT --#define TARGET_DEFAULT (0) -+#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT) - - #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 - --#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" -+#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" - - #undef MULTILIB_DEFAULTS - #define MULTILIB_DEFAULTS \ -- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" } -+ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" } - - /* Now we define the strings used to build the spec file. */ - #undef LIB_SPEC -@@ -61,7 +75,7 @@ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker " LINUX_TARGET_INTERPRETER "} \ - -X \ -- %{mbig-endian:-EB}" \ -+ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ - SUBTARGET_EXTRA_LINK_SPEC - - #undef LINK_SPEC ---- gcc-4.1.0/gcc/config.gcc -+++ gcc-4.1.0/gcc/config.gcc -@@ -672,6 +672,11 @@ - ;; - arm*-*-linux*) # ARM GNU/Linux with ELF - tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" -+ case $target in -+ arm*b-*) -+ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" -+ ;; -+ esac - tmake_file="${tmake_file} t-linux arm/t-arm" - case ${target} in - arm*-*-linux-gnueabi) diff --git a/patches/gcc/4.1.1/801-softfloat-fix.patch b/patches/gcc/4.1.1/801-softfloat-fix.patch deleted file mode 100644 index 844c9a0..0000000 --- a/patches/gcc/4.1.1/801-softfloat-fix.patch +++ /dev/null @@ -1,58 +0,0 @@ -This patch (C) 2007 Yann E. MORIN -Licensed under GPL v2. - -First hunk of this patch solves compiling uClibc-0.9.28{,.1} : - -make[1]: Entering directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' - LD libuClibc-0.9.29.so -libc/libc_so.a(difftime.os): In function `difftime': -difftime.c:(.text+0x8): undefined reference to `__floatsidf' -difftime.c:(.text+0x2c): undefined reference to `__subdf3' -libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr': -_fpmaxtostr.c:(.text+0xd4): undefined reference to `__nedf2' -_fpmaxtostr.c:(.text+0xf8): undefined reference to `__eqdf2' -_fpmaxtostr.c:(.text+0x114): undefined reference to `__divdf3' -_fpmaxtostr.c:(.text+0x120): undefined reference to `__ltdf2' -_fpmaxtostr.c:(.text+0x1c4): undefined reference to `__muldf3' -_fpmaxtostr.c:(.text+0x388): undefined reference to `__gedf2' -_fpmaxtostr.c:(.text+0x430): undefined reference to `__adddf3' -libc/libc_so.a(__psfs_do_numeric.os): In function `__psfs_do_numeric': -__psfs_do_numeric.c:(.text+0x520): undefined reference to `__truncdfsf2' -libc/libc_so.a(strtof.os): In function `strtof': -strtof.c:(.text+0x1c): undefined reference to `__extendsfdf2' -/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/cc_core_prefix/lib/gcc/arm-linux-uclibc/4.1.1/libgcc.a(_fixunsdfsi.o): -In function `__fixunsdfsi': -libgcc2.c:(.text+0x34): undefined reference to `__fixdfsi' -make[2]: *** [lib/libc.so] Error 1 -make[1]: *** [lib/libc.so.0] Error 2 -make[1]: Leaving directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' -make: *** [/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc/lib/libc.a] -Error 2 - -The second hunk fixes building final gcc because soft-float implies using -lfloat (which we don't have). - - -diff -dur gcc-4.1.1.no-softfloat-fix/gcc/config.gcc gcc-4.1.1/gcc/config.gcc ---- gcc-4.1.1.no-softfloat-fix/gcc/config.gcc 2007-02-01 21:57:17.000000000 +0100 -+++ gcc-4.1.1/gcc/config.gcc 2007-02-01 22:11:06.000000000 +0100 -@@ -690,7 +690,7 @@ - default_use_cxa_atexit=yes - ;; - *) -- tmake_file="$tmake_file arm/t-linux" -+ tmake_file="$tmake_file arm/t-linux arm/t-arm-elf" - ;; - esac - tm_file="$tm_file arm/aout.h arm/arm.h" -diff -dur gcc-4.1.1.-lfloat/gcc/config/arm/linux-elf.h gcc-4.1.1/gcc/config/arm/linux-elf.h ---- gcc-4.1.1.-lfloat/gcc/config/arm/linux-elf.h 2007-02-01 21:57:17.000000000 +0100 -+++ gcc-4.1.1/gcc/config/arm/linux-elf.h 2007-02-01 23:00:42.000000000 +0100 -@@ -63,7 +63,7 @@ - %{shared:-lc} \ - %{!shared:%{profile:-lc_p}%{!profile:-lc}}" - --#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" -+#define LIBGCC_SPEC "-lgcc" - - #ifdef USE_UCLIBC - #define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0" diff --git a/patches/gcc/4.1.2/120-uclibc-locale.patch b/patches/gcc/4.1.2/120-uclibc-locale.patch new file mode 100644 index 0000000..8c5a183 --- /dev/null +++ b/patches/gcc/4.1.2/120-uclibc-locale.patch @@ -0,0 +1,3239 @@ +--- gcc-4.1.2.orig/libstdc++-v3/acinclude.m4 2007-01-29 11:51:01.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/acinclude.m4 2007-03-04 23:31:57.000000000 +0100 +@@ -1003,7 +1003,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 +@@ -1019,6 +1019,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 +@@ -1162,6 +1165,40 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ AC_MSG_RESULT(uclibc) ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ AC_SUBST(glibcxx_MOFILES) ++ AC_SUBST(glibcxx_POFILES) ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-03-04 23:31:57.000000000 +0100 +@@ -0,0 +1,63 @@ ++// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*- ++ ++// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// Written by Jakub Jelinek ++ ++#include ++#include ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning clean this up ++#endif ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ ++extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l; ++extern "C" __typeof(strcoll_l) __strcoll_l; ++extern "C" __typeof(strftime_l) __strftime_l; ++extern "C" __typeof(strtod_l) __strtod_l; ++extern "C" __typeof(strtof_l) __strtof_l; ++extern "C" __typeof(strtold_l) __strtold_l; ++extern "C" __typeof(strxfrm_l) __strxfrm_l; ++extern "C" __typeof(newlocale) __newlocale; ++extern "C" __typeof(freelocale) __freelocale; ++extern "C" __typeof(duplocale) __duplocale; ++extern "C" __typeof(uselocale) __uselocale; ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++extern "C" __typeof(iswctype_l) __iswctype_l; ++extern "C" __typeof(towlower_l) __towlower_l; ++extern "C" __typeof(towupper_l) __towupper_l; ++extern "C" __typeof(wcscoll_l) __wcscoll_l; ++extern "C" __typeof(wcsftime_l) __wcsftime_l; ++extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l; ++extern "C" __typeof(wctype_l) __wctype_l; ++#endif ++ ++#endif // GLIBC 2.3 and later +--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-03-04 23:31:57.000000000 +0100 +@@ -0,0 +1,152 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik ++ ++#include // For errno ++#include ++#include ++#include ++#include ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __strtol_l(S, E, B, L) strtol((S), (E), (B)) ++#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B)) ++#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B)) ++#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B)) ++#define __strtof_l(S, E, L) strtof((S), (E)) ++#define __strtod_l(S, E, L) strtod((S), (E)) ++#define __strtold_l(S, E, L) strtold((S), (E)) ++#warning should dummy __newlocale check for C|POSIX ? ++#define __newlocale(a, b, c) NULL ++#define __freelocale(a) ((void)0) ++#define __duplocale(a) __c_locale() ++#endif ++ ++namespace std ++{ ++ template<> ++ void ++ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ char* __sanity; ++ errno = 0; ++ float __f = __strtof_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __f; ++ else ++ __err |= ios_base::failbit; ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ char* __sanity; ++ errno = 0; ++ double __d = __strtod_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __d; ++ else ++ __err |= ios_base::failbit; ++ } ++ ++ template<> ++ void ++ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err, ++ const __c_locale& __cloc) ++ { ++ char* __sanity; ++ errno = 0; ++ long double __ld = __strtold_l(__s, &__sanity, __cloc); ++ if (__sanity != __s && errno != ERANGE) ++ __v = __ld; ++ else ++ __err |= ios_base::failbit; ++ } ++ ++ void ++ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, ++ __c_locale __old) ++ { ++ __cloc = __newlocale(1 << LC_ALL, __s, __old); ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ if (!__cloc) ++ { ++ // This named locale is not supported by the underlying OS. ++ __throw_runtime_error(__N("locale::facet::_S_create_c_locale " ++ "name not valid")); ++ } ++#endif ++ } ++ ++ void ++ locale::facet::_S_destroy_c_locale(__c_locale& __cloc) ++ { ++ if (__cloc && _S_get_c_locale() != __cloc) ++ __freelocale(__cloc); ++ } ++ ++ __c_locale ++ locale::facet::_S_clone_c_locale(__c_locale& __cloc) ++ { return __duplocale(__cloc); } ++} // namespace std ++ ++namespace __gnu_cxx ++{ ++ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] = ++ { ++ "LC_CTYPE", ++ "LC_NUMERIC", ++ "LC_TIME", ++ "LC_COLLATE", ++ "LC_MONETARY", ++ "LC_MESSAGES", ++#if _GLIBCXX_NUM_CATEGORIES != 0 ++ "LC_PAPER", ++ "LC_NAME", ++ "LC_ADDRESS", ++ "LC_TELEPHONE", ++ "LC_MEASUREMENT", ++ "LC_IDENTIFICATION" ++#endif ++ }; ++} ++ ++namespace std ++{ ++ const char* const* const locale::_S_categories = __gnu_cxx::category_names; ++} // namespace std +--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-03-04 23:31:57.000000000 +0100 +@@ -0,0 +1,117 @@ ++// Wrapper for underlying C-language localization -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.8 Standard locale categories. ++// ++ ++// Written by Benjamin Kosnik ++ ++#ifndef _C_LOCALE_H ++#define _C_LOCALE_H 1 ++ ++#pragma GCC system_header ++ ++#include // get std::strlen ++#include // get std::snprintf or std::sprintf ++#include ++#include // For codecvt ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC_HAS_LOCALE__ ++#include // For codecvt using iconv, iconv_t ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#include // 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 ++ int ++ __convert_from_v(char* __out, ++ const int __size __attribute__ ((__unused__)), ++ const char* __fmt, ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ _Tv __v, const __c_locale& __cloc, int __prec) ++ { ++ __c_locale __old = __gnu_cxx::__uselocale(__cloc); ++#else ++ _Tv __v, const __c_locale&, int __prec) ++ { ++# ifdef __UCLIBC_HAS_LOCALE__ ++ char* __old = std::setlocale(LC_ALL, NULL); ++ char* __sav = new char[std::strlen(__old) + 1]; ++ std::strcpy(__sav, __old); ++ std::setlocale(LC_ALL, "C"); ++# endif ++#endif ++ ++ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __gnu_cxx::__uselocale(__old); ++#elif defined __UCLIBC_HAS_LOCALE__ ++ std::setlocale(LC_ALL, __sav); ++ delete [] __sav; ++#endif ++ return __ret; ++ } ++} ++ ++#endif +--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2007-03-04 23:31:57.000000000 +0100 +@@ -0,0 +1,306 @@ ++// std::codecvt implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2002, 2003 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.5 - Template class codecvt ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++namespace std ++{ ++ // Specializations. ++#ifdef _GLIBCXX_USE_WCHAR_T ++ codecvt_base::result ++ codecvt:: ++ 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(-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(__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:: ++ 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(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(-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(-1) ++ || __conv == static_cast(-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:: ++ 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:: ++ 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:: ++ 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(__builtin_alloca(sizeof(wchar_t) ++ * __max)); ++ while (__from < __end && __max) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast(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(-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(-1) ++ || __conv == static_cast(-2)) ++ break; ++ } ++ __state = __tmp_state; ++ __ret += __from - __tmp_from; ++ break; ++ } ++ if (!__from) ++ __from = __from_chunk_end; ++ ++ __ret += __from - __tmp_from; ++ __max -= __conv; ++ ++ if (__from < __end && __max) ++ { ++ // XXX Probably wrong for stateful encodings ++ __tmp_state = __state; ++ ++__from; ++ ++__ret; ++ --__max; ++ } ++ } ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ ++ return __ret; ++ } ++#endif ++} +--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-03-04 23:31:57.000000000 +0100 +@@ -0,0 +1,80 @@ ++// std::collate implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.4.1.2 collate virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++#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::_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::_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::_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::_M_transform(wchar_t* __to, const wchar_t* __from, ++ size_t __n) const ++ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); } ++#endif ++} +--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-03-04 23:31:57.000000000 +0100 +@@ -0,0 +1,314 @@ ++// std::ctype implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions. ++// ++ ++// Written by Benjamin Kosnik ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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 specializations are in src/locale.cc and ++ // various /config/os/* files. ++ template<> ++ ctype_byname::ctype_byname(const char* __s, size_t __refs) ++ : ctype(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::__wmask_type ++ ctype::_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::do_toupper(wchar_t __c) const ++ { return __towupper_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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::do_tolower(wchar_t __c) const ++ { return __towlower_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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:: ++ do_is(mask __m, wchar_t __c) const ++ { ++ // The case of __m == ctype_base::space is particularly important, ++ // due to its use in many istream functions. Therefore we deal with ++ // it first, exploiting the knowledge that on GNU systems _M_bit[5] ++ // is the mask corresponding to ctype_base::space. NB: an encoding ++ // change would not affect correctness! ++ bool __ret = false; ++ if (__m == _M_bit[5]) ++ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype); ++ else ++ { ++ // Highest bitmask in ctype_base == 10, but extra in "C" ++ // library for blank. ++ const size_t __bitmasksize = 11; ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) ++ if (__m & _M_bit[__bitcur]) ++ { ++ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype)) ++ { ++ __ret = true; ++ break; ++ } ++ else if (__m == _M_bit[__bitcur]) ++ break; ++ } ++ } ++ return __ret; ++ } ++ ++ const wchar_t* ++ ctype:: ++ 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:: ++ 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:: ++ 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:: ++ do_widen(char __c) const ++ { return _M_widen[static_cast(__c)]; } ++ ++ const char* ++ ctype:: ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const ++ { ++ while (__lo < __hi) ++ { ++ *__dest = _M_widen[static_cast(*__lo)]; ++ ++__lo; ++ ++__dest; ++ } ++ return __hi; ++ } ++ ++ char ++ ctype:: ++ 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(__c)); ++ } ++ ++ const wchar_t* ++ ctype:: ++ 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(__c)); ++ } ++ ++__lo; ++ ++__dest; ++ } ++ else ++ while (__lo < __hi) ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast(__c)); ++ ++__lo; ++ ++__dest; ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __hi; ++ } ++ ++ void ++ ctype::_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(__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(_ISbit(__k)); ++ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]); ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ } ++#endif // _GLIBCXX_USE_WCHAR_T ++} +--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-03-04 23:31:57.000000000 +0100 +@@ -0,0 +1,100 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++#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::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(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::do_get(catalog, int, int, const wstring& __dfault) const ++ { ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(_M_c_locale_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ __uselocale(__old); ++ return _M_convert_from_char(__msg); ++# elif defined __UCLIBC_HAS_LOCALE__ ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, _M_name_messages); ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ setlocale(LC_ALL, __old); ++ free(__old); ++ return _M_convert_from_char(__msg); ++# else ++ char* __msg = gettext(_M_convert_to_char(__dfault)); ++ return _M_convert_from_char(__msg); ++# endif ++ } ++#endif ++} +--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-03-04 23:31:57.000000000 +0100 +@@ -0,0 +1,121 @@ ++// std::messages implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.7.1.2 messages functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#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 ++ messages<_CharT>::messages(size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), ++ _M_name_messages(_S_get_c_name()) ++ { } ++ ++ template ++ messages<_CharT>::messages(__c_locale __cloc, const char* __s, ++ size_t __refs) ++ : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL) ++ { ++ const size_t __len = std::strlen(__s) + 1; ++ char* __tmp = new char[__len]; ++ std::memcpy(__tmp, __s, __len); ++ _M_name_messages = __tmp; ++ ++ // Last to avoid leaking memory if new throws. ++ _M_c_locale_messages = _S_clone_c_locale(__cloc); ++ } ++ ++ template ++ typename messages<_CharT>::catalog ++ messages<_CharT>::open(const basic_string& __s, const locale& __loc, ++ const char* __dir) const ++ { ++ __bindtextdomain(__s.c_str(), __dir); ++ return this->do_open(__s, __loc); ++ } ++ ++ // Virtual member functions. ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::do_open(const basic_string& __s, ++ const locale&) const ++ { ++ // No error checking is done, assume the catalog exists and can ++ // be used. ++ __textdomain(__s.c_str()); ++ return 0; ++ } ++ ++ template ++ void ++ messages<_CharT>::do_close(catalog) const ++ { } ++ ++ // messages_byname ++ template ++ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) ++ : messages<_CharT>(__refs) ++ { ++ if (this->_M_name_messages != locale::facet::_S_get_c_name()) ++ delete [] this->_M_name_messages; ++ char* __tmp = new char[std::strlen(__s) + 1]; ++ std::strcpy(__tmp, __s); ++ this->_M_name_messages = __tmp; ++ ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) ++ { ++ this->_S_destroy_c_locale(this->_M_c_locale_messages); ++ this->_S_create_c_locale(this->_M_c_locale_messages, __s); ++ } ++ } +--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-03-04 23:31:57.000000000 +0100 +@@ -0,0 +1,692 @@ ++// std::moneypunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning optimize this for uclibc ++#warning tailor for stub locale support ++#endif ++ ++#ifndef __UCLIBC_HAS_XLOCALE__ ++#define __nl_langinfo_l(N, L) nl_langinfo((N)) ++#endif ++ ++namespace std ++{ ++ // Construct and return valid pattern consisting of some combination of: ++ // space none symbol sign value ++ money_base::pattern ++ money_base::_S_construct_pattern(char __precedes, char __space, char __posn) ++ { ++ pattern __ret; ++ ++ // This insanely complicated routine attempts to construct a valid ++ // pattern for use with monyepunct. A couple of invariants: ++ ++ // if (__precedes) symbol -> value ++ // else value -> symbol ++ ++ // if (__space) space ++ // else none ++ ++ // none == never first ++ // space never first or last ++ ++ // Any elegant implementations of this are welcome. ++ switch (__posn) ++ { ++ case 0: ++ case 1: ++ // 1 The sign precedes the value and symbol. ++ __ret.field[0] = sign; ++ if (__space) ++ { ++ // Pattern starts with sign. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[3] = symbol; ++ } ++ __ret.field[2] = space; ++ } ++ else ++ { ++ // Pattern starts with sign and ends with none. ++ if (__precedes) ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[1] = value; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[3] = none; ++ } ++ break; ++ case 2: ++ // 2 The sign follows the value and symbol. ++ if (__space) ++ { ++ // Pattern either ends with sign. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[2] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[2] = symbol; ++ } ++ __ret.field[1] = space; ++ __ret.field[3] = sign; ++ } ++ else ++ { ++ // Pattern ends with sign then none. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = value; ++ } ++ else ++ { ++ __ret.field[0] = value; ++ __ret.field[1] = symbol; ++ } ++ __ret.field[2] = sign; ++ __ret.field[3] = none; ++ } ++ break; ++ case 3: ++ // 3 The sign immediately precedes the symbol. ++ if (__precedes) ++ { ++ __ret.field[0] = sign; ++ __ret.field[1] = symbol; ++ if (__space) ++ { ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[2] = value; ++ __ret.field[3] = none; ++ } ++ } ++ else ++ { ++ __ret.field[0] = value; ++ if (__space) ++ { ++ __ret.field[1] = space; ++ __ret.field[2] = sign; ++ __ret.field[3] = symbol; ++ } ++ else ++ { ++ __ret.field[1] = sign; ++ __ret.field[2] = symbol; ++ __ret.field[3] = none; ++ } ++ } ++ break; ++ case 4: ++ // 4 The sign immediately follows the symbol. ++ if (__precedes) ++ { ++ __ret.field[0] = symbol; ++ __ret.field[1] = sign; ++ if (__space) ++ { ++ __ret.field[2] = space; ++ __ret.field[3] = value; ++ } ++ else ++ { ++ __ret.field[2] = value; ++ __ret.field[3] = none; ++ } ++ } ++ else ++ { ++ __ret.field[0] = value; ++ if (__space) ++ { ++ __ret.field[1] = space; ++ __ret.field[2] = symbol; ++ __ret.field[3] = sign; ++ } ++ else ++ { ++ __ret.field[1] = symbol; ++ __ret.field[2] = sign; ++ __ret.field[3] = none; ++ } ++ } ++ break; ++ default: ++ __ret = pattern(); ++ } ++ return __ret; ++ } ++ ++ template<> ++ void ++ moneypunct::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::~moneypunct() ++ { delete _M_data; } ++ ++ template<> ++ moneypunct::~moneypunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ moneypunct::_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; ++ ++ 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(money_base::_S_atoms[__i]); ++ } ++ else ++ { ++ // Named locale. ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(__cloc); ++#else ++ // Switch to named locale so that mbsrtowcs will work. ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, __name); ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this... should be monetary ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# elif defined __UCLIBC_HAS_LOCALE__ ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); ++ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); ++ ++ wchar_t* __wcs_ps = 0; ++ wchar_t* __wcs_ns = 0; ++ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); ++ try ++ { ++ mbstate_t __state; ++ size_t __len = strlen(__cpossign); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ps = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); ++ _M_data->_M_positive_sign = __wcs_ps; ++ } ++ else ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); ++ ++ __len = strlen(__cnegsign); ++ if (!__nposn) ++ _M_data->_M_negative_sign = L"()"; ++ else if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ns = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); ++ _M_data->_M_negative_sign = __wcs_ns; ++ } ++ else ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); ++ ++ // _Intl == true. ++ __len = strlen(__ccurr); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state); ++ _M_data->_M_curr_symbol = __wcs; ++ } ++ else ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); ++ } ++ catch (...) ++ { ++ delete _M_data; ++ _M_data = 0; ++ delete __wcs_ps; ++ delete __wcs_ns; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ __throw_exception_again; ++ } ++ ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, ++ __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ } ++ } ++ ++ template<> ++ void ++ moneypunct::_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; ++ ++ 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(money_base::_S_atoms[__i]); ++ } ++ else ++ { ++ // Named locale. ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __c_locale __old = __uselocale(__cloc); ++#else ++ // Switch to named locale so that mbsrtowcs will work. ++ char* __old = strdup(setlocale(LC_ALL, NULL)); ++ setlocale(LC_ALL, __name); ++#endif ++ ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this... should be monetary ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# elif defined __UCLIBC_HAS_LOCALE__ ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); ++ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); ++ ++ wchar_t* __wcs_ps = 0; ++ wchar_t* __wcs_ns = 0; ++ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); ++ try ++ { ++ mbstate_t __state; ++ size_t __len; ++ __len = strlen(__cpossign); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ps = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); ++ _M_data->_M_positive_sign = __wcs_ps; ++ } ++ else ++ _M_data->_M_positive_sign = L""; ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); ++ ++ __len = strlen(__cnegsign); ++ if (!__nposn) ++ _M_data->_M_negative_sign = L"()"; ++ else if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ __wcs_ns = new wchar_t[__len]; ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); ++ _M_data->_M_negative_sign = __wcs_ns; ++ } ++ else ++ _M_data->_M_negative_sign = L""; ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); ++ ++ // _Intl == true. ++ __len = strlen(__ccurr); ++ if (__len) ++ { ++ ++__len; ++ memset(&__state, 0, sizeof(mbstate_t)); ++ wchar_t* __wcs = new wchar_t[__len]; ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state); ++ _M_data->_M_curr_symbol = __wcs; ++ } ++ else ++ _M_data->_M_curr_symbol = L""; ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); ++ } ++ catch (...) ++ { ++ delete _M_data; ++ _M_data = 0; ++ delete __wcs_ps; ++ delete __wcs_ns; ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ __throw_exception_again; ++ } ++ ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, ++ __pposn); ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, ++ __nposn); ++ ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#else ++ setlocale(LC_ALL, __old); ++ free(__old); ++#endif ++ } ++ } ++ ++ template<> ++ moneypunct::~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::~moneypunct() ++ { ++ if (_M_data->_M_positive_sign_size) ++ delete [] _M_data->_M_positive_sign; ++ if (_M_data->_M_negative_sign_size ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0) ++ delete [] _M_data->_M_negative_sign; ++ if (_M_data->_M_curr_symbol_size) ++ delete [] _M_data->_M_curr_symbol; ++ delete _M_data; ++ } ++#endif ++} +--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-03-04 23:31:57.000000000 +0100 +@@ -0,0 +1,173 @@ ++// std::numpunct implementation details, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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::~numpunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ numpunct::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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(__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(__num_base::_S_atoms_in[__j]); ++ } ++ else ++ { ++ // Named locale. ++ // NB: In the GNU model wchar_t is always 32 bit wide. ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC__ ++# ifdef __UCLIBC_HAS_XLOCALE__ ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc; ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; ++# elif defined __UCLIBC_HAS_LOCALE__ ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; ++# endif ++#else ++ union { char *__s; wchar_t __w; } __u; ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc); ++ _M_data->_M_decimal_point = __u.__w; ++ ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc); ++ _M_data->_M_thousands_sep = __u.__w; ++#endif ++ ++ if (_M_data->_M_thousands_sep == L'\0') ++ _M_data->_M_grouping = ""; ++ else ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); ++ } ++ ++ // NB: There is no way to extact this info from posix locales. ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); ++ _M_data->_M_truename = L"true"; ++ _M_data->_M_truename_size = 4; ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); ++ _M_data->_M_falsename = L"false"; ++ _M_data->_M_falsename_size = 5; ++ } ++ ++ template<> ++ numpunct::~numpunct() ++ { delete _M_data; } ++ #endif ++} +--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-03-04 23:31:57.000000000 +0100 +@@ -0,0 +1,406 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions ++// ++ ++// Written by Benjamin Kosnik ++ ++#include ++#include ++ ++#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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++ 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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++#warning wide time stuff ++// if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = L"%m/%d/%y"; ++ _M_data->_M_date_era_format = L"%m/%d/%y"; ++ _M_data->_M_time_format = L"%H:%M:%S"; ++ _M_data->_M_time_era_format = L"%H:%M:%S"; ++ _M_data->_M_date_time_format = L""; ++ _M_data->_M_date_time_era_format = L""; ++ _M_data->_M_am = L"AM"; ++ _M_data->_M_pm = L"PM"; ++ _M_data->_M_am_pm_format = L""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = L"Sunday"; ++ _M_data->_M_day2 = L"Monday"; ++ _M_data->_M_day3 = L"Tuesday"; ++ _M_data->_M_day4 = L"Wednesday"; ++ _M_data->_M_day5 = L"Thursday"; ++ _M_data->_M_day6 = L"Friday"; ++ _M_data->_M_day7 = L"Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = L"Sun"; ++ _M_data->_M_aday2 = L"Mon"; ++ _M_data->_M_aday3 = L"Tue"; ++ _M_data->_M_aday4 = L"Wed"; ++ _M_data->_M_aday5 = L"Thu"; ++ _M_data->_M_aday6 = L"Fri"; ++ _M_data->_M_aday7 = L"Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = L"January"; ++ _M_data->_M_month02 = L"February"; ++ _M_data->_M_month03 = L"March"; ++ _M_data->_M_month04 = L"April"; ++ _M_data->_M_month05 = L"May"; ++ _M_data->_M_month06 = L"June"; ++ _M_data->_M_month07 = L"July"; ++ _M_data->_M_month08 = L"August"; ++ _M_data->_M_month09 = L"September"; ++ _M_data->_M_month10 = L"October"; ++ _M_data->_M_month11 = L"November"; ++ _M_data->_M_month12 = L"December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = L"Jan"; ++ _M_data->_M_amonth02 = L"Feb"; ++ _M_data->_M_amonth03 = L"Mar"; ++ _M_data->_M_amonth04 = L"Apr"; ++ _M_data->_M_amonth05 = L"May"; ++ _M_data->_M_amonth06 = L"Jun"; ++ _M_data->_M_amonth07 = L"Jul"; ++ _M_data->_M_amonth08 = L"Aug"; ++ _M_data->_M_amonth09 = L"Sep"; ++ _M_data->_M_amonth10 = L"Oct"; ++ _M_data->_M_amonth11 = L"Nov"; ++ _M_data->_M_amonth12 = L"Dec"; ++ } ++#if 0 ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ union { char *__s; wchar_t *__w; } __u; ++ ++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); ++ _M_data->_M_date_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); ++ _M_data->_M_date_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); ++ _M_data->_M_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); ++ _M_data->_M_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); ++ _M_data->_M_date_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); ++ _M_data->_M_date_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); ++ _M_data->_M_am = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); ++ _M_data->_M_pm = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); ++ _M_data->_M_am_pm_format = __u.__w; ++ ++ // Day names, starting with "C"'s Sunday. ++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); ++ _M_data->_M_day1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); ++ _M_data->_M_day2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); ++ _M_data->_M_day3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); ++ _M_data->_M_day4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); ++ _M_data->_M_day5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); ++ _M_data->_M_day6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); ++ _M_data->_M_day7 = __u.__w; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); ++ _M_data->_M_aday1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); ++ _M_data->_M_aday2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); ++ _M_data->_M_aday3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); ++ _M_data->_M_aday4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); ++ _M_data->_M_aday5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); ++ _M_data->_M_aday6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); ++ _M_data->_M_aday7 = __u.__w; ++ ++ // Month names, starting with "C"'s January. ++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); ++ _M_data->_M_month01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); ++ _M_data->_M_month02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); ++ _M_data->_M_month03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); ++ _M_data->_M_month04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); ++ _M_data->_M_month05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); ++ _M_data->_M_month06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); ++ _M_data->_M_month07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); ++ _M_data->_M_month08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); ++ _M_data->_M_month09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); ++ _M_data->_M_month10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); ++ _M_data->_M_month11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); ++ _M_data->_M_month12 = __u.__w; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); ++ _M_data->_M_amonth01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); ++ _M_data->_M_amonth02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); ++ _M_data->_M_amonth03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); ++ _M_data->_M_amonth04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); ++ _M_data->_M_amonth05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); ++ _M_data->_M_amonth06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); ++ _M_data->_M_amonth07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); ++ _M_data->_M_amonth08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); ++ _M_data->_M_amonth09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); ++ _M_data->_M_amonth10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); ++ _M_data->_M_amonth11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); ++ _M_data->_M_amonth12 = __u.__w; ++ } ++#endif // 0 ++ } ++#endif ++} +--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/time_members.h 2007-03-04 23:31:57.000000000 +0100 +@@ -0,0 +1,76 @@ ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*- ++ ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.2.5.1.2 - time_get functions ++// ISO C++ 14882: 22.2.5.3.2 - time_put functions ++// ++ ++// Written by Benjamin Kosnik ++ ++ template ++ __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 ++ __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 ++ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, ++ size_t __refs) ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), ++ _M_name_timepunct(NULL) ++ { ++ const size_t __len = std::strlen(__s) + 1; ++ char* __tmp = new char[__len]; ++ std::memcpy(__tmp, __s, __len); ++ _M_name_timepunct = __tmp; ++ ++ try ++ { _M_initialize_timepunct(__cloc); } ++ catch(...) ++ { ++ delete [] _M_name_timepunct; ++ __throw_exception_again; ++ } ++ } ++ ++ template ++ __timepunct<_CharT>::~__timepunct() ++ { ++ if (_M_name_timepunct != _S_get_c_name()) ++ delete [] _M_name_timepunct; ++ delete _M_data; ++ _S_destroy_c_locale(_M_c_locale_timepunct); ++ } +--- gcc-4.1.2.orig/libstdc++-v3/config/os/uclibc/ctype_base.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/config/os/uclibc/ctype_base.h 2007-03-04 23:31:57.000000000 +0100 +@@ -0,0 +1,64 @@ ++// Locale support -*- C++ -*- ++ ++// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 ++// Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 2, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING. If not, write to the Free ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++// USA. ++ ++// As a special exception, you may use this file as part of a free software ++// library without restriction. Specifically, if other files instantiate ++// templates or use macros or inline functions from this file, or you compile ++// this file and link it with other files to produce an executable, this ++// file does not by itself cause the resulting executable to be covered by ++// the GNU General Public License. This exception does not however ++// invalidate any other reasons why the executable file might be covered by ++// the GNU General Public License. ++ ++// ++// ISO C++ 14882: 22.1 Locales ++// ++ ++/** @file ctype_base.h ++ * This is an internal header file, included by other library headers. ++ * You should not attempt to use it directly. ++ */ ++ ++// Information as gleaned from /usr/include/ctype.h ++ ++ /// @brief Base class for ctype. ++ struct ctype_base ++ { ++ // Note: In uClibc, the following two types depend on configuration. ++ ++ // Non-standard typedefs. ++ typedef const __ctype_touplow_t* __to_type; ++ ++ // NB: Offsets into ctype::_M_table force a particular size ++ // on the mask type. Because of this, we don't use an enum. ++ typedef __ctype_mask_t mask; ++ static const mask upper = _ISupper; ++ static const mask lower = _ISlower; ++ static const mask alpha = _ISalpha; ++ static const mask digit = _ISdigit; ++ static const mask xdigit = _ISxdigit; ++ static const mask space = _ISspace; ++ static const mask print = _ISprint; ++ static const mask graph = _ISalpha | _ISdigit | _ISpunct; ++ static const mask cntrl = _IScntrl; ++ static const mask punct = _ISpunct; ++ static const mask alnum = _ISalpha | _ISdigit; ++ }; +--- gcc-4.1.2.orig/libstdc++-v3/config/os/uclibc/ctype_inline.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/config/os/uclibc/ctype_inline.h 2007-03-04 23:31:57.000000000 +0100 +@@ -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:: ++ is(mask __m, char __c) const ++ { return _M_table[static_cast(__c)] & __m; } ++ ++ const char* ++ ctype:: ++ is(const char* __low, const char* __high, mask* __vec) const ++ { ++ while (__low < __high) ++ *__vec++ = _M_table[static_cast(*__low++)]; ++ return __high; ++ } ++ ++ const char* ++ ctype:: ++ scan_is(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && !(_M_table[static_cast(*__low)] & __m)) ++ ++__low; ++ return __low; ++ } ++ ++ const char* ++ ctype:: ++ scan_not(mask __m, const char* __low, const char* __high) const ++ { ++ while (__low < __high ++ && (_M_table[static_cast(*__low)] & __m) != 0) ++ ++__low; ++ return __low; ++ } +--- gcc-4.1.2.orig/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2007-03-04 23:31:57.000000000 +0100 +@@ -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::classic_table() throw() ++ { return __C_ctype_b; } ++ ++ ctype::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::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::do_toupper(char __c) const ++ { return _M_toupper[static_cast(__c)]; } ++ ++ const char* ++ ctype::do_toupper(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_toupper[static_cast(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } ++ ++ char ++ ctype::do_tolower(char __c) const ++ { return _M_tolower[static_cast(__c)]; } ++ ++ const char* ++ ctype::do_tolower(char* __low, const char* __high) const ++ { ++ while (__low < __high) ++ { ++ *__low = _M_tolower[static_cast(*__low)]; ++ ++__low; ++ } ++ return __high; ++ } +--- gcc-4.1.2.orig/libstdc++-v3/config/os/uclibc/os_defines.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/config/os/uclibc/os_defines.h 2007-03-04 23:31:57.000000000 +0100 +@@ -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 ++ ++// We must not see the optimized string functions GNU libc defines. ++#define __NO_STRING_INLINES ++ ++#endif +--- gcc-4.1.2.orig/libstdc++-v3/configure 2007-01-29 11:51:01.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/configure 2007-03-04 23:31:57.000000000 +0100 +@@ -4005,6 +4005,11 @@ + lt_cv_deplibs_check_method=pass_all + ;; + ++linux-uclibc*) ++ lt_cv_deplibs_check_method=pass_all ++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` ++ ;; ++ + netbsd* | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' +@@ -5740,7 +5745,7 @@ + enableval="$enable_clocale" + + case "$enableval" in +- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;; ++ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;; + *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5 + echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;} + { (exit 1); exit 1; }; } ;; +@@ -5765,6 +5770,9 @@ + # Default to "generic". + if test $enable_clocale_flag = auto; then + case ${target_os} in ++ linux-uclibc*) ++ enable_clocale_flag=uclibc ++ ;; + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ +@@ -5995,6 +6003,76 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ echo "$as_me:$LINENO: result: uclibc" >&5 ++echo "${ECHO_T}uclibc" >&6 ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ # Extract the first word of "msgfmt", so it can be a program name with args. ++set dummy msgfmt; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test -n "$check_msgfmt"; then ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_check_msgfmt="yes" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" ++fi ++fi ++check_msgfmt=$ac_cv_prog_check_msgfmt ++if test -n "$check_msgfmt"; then ++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 ++echo "${ECHO_T}$check_msgfmt" >&6 ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ ++ ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +--- gcc-4.1.2.orig/libstdc++-v3/configure.host 2007-01-28 21:12:40.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/configure.host 2007-03-04 23:31:57.000000000 +0100 +@@ -270,6 +270,12 @@ + ;; + esac + ++# Override for uClibc since linux-uclibc gets mishandled above. ++case "${host_os}" in ++ *-uclibc*) ++ os_include_dir="os/uclibc" ++ ;; ++esac + + # Set any OS-dependent and CPU-dependent bits. + # THIS TABLE IS SORTED. KEEP IT THAT WAY. +--- gcc-4.1.2.orig/libstdc++-v3/crossconfig.m4 2006-12-12 15:18:36.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/crossconfig.m4 2007-03-04 23:31:57.000000000 +0100 +@@ -143,6 +143,99 @@ + ;; + esac + ;; ++ *-uclibc*) ++# Temporary hack until we implement the float versions of the libm funcs ++ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ ++ machine/endian.h machine/param.h sys/machine.h sys/types.h \ ++ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h]) ++ SECTION_FLAGS='-ffunction-sections -fdata-sections' ++ AC_SUBST(SECTION_FLAGS) ++ GLIBCXX_CHECK_LINKER_FEATURES ++ GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT ++ GLIBCXX_CHECK_WCHAR_T_SUPPORT ++ ++ # For LFS. ++ AC_DEFINE(HAVE_INT64_T) ++ case "$target" in ++ *-uclinux*) ++ # Don't enable LFS with uClinux ++ ;; ++ *) ++ AC_DEFINE(_GLIBCXX_USE_LFS) ++ esac ++ ++ # For showmanyc_helper(). ++ AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) ++ GLIBCXX_CHECK_POLL ++ GLIBCXX_CHECK_S_ISREG_OR_S_IFREG ++ ++ # For xsputn_2(). ++ AC_CHECK_HEADERS(sys/uio.h) ++ GLIBCXX_CHECK_WRITEV ++ ++# AC_DEFINE(HAVE_ACOSF) ++# AC_DEFINE(HAVE_ASINF) ++# AC_DEFINE(HAVE_ATANF) ++# AC_DEFINE(HAVE_ATAN2F) ++ AC_DEFINE(HAVE_CEILF) ++ AC_DEFINE(HAVE_COPYSIGN) ++# AC_DEFINE(HAVE_COPYSIGNF) ++# AC_DEFINE(HAVE_COSF) ++# AC_DEFINE(HAVE_COSHF) ++# AC_DEFINE(HAVE_EXPF) ++# AC_DEFINE(HAVE_FABSF) ++ AC_DEFINE(HAVE_FINITE) ++ AC_DEFINE(HAVE_FINITEF) ++ AC_DEFINE(HAVE_FLOORF) ++# AC_DEFINE(HAVE_FMODF) ++# AC_DEFINE(HAVE_FREXPF) ++ AC_DEFINE(HAVE_HYPOT) ++# AC_DEFINE(HAVE_HYPOTF) ++ AC_DEFINE(HAVE_ISINF) ++ AC_DEFINE(HAVE_ISINFF) ++ AC_DEFINE(HAVE_ISNAN) ++ AC_DEFINE(HAVE_ISNANF) ++# AC_DEFINE(HAVE_LOGF) ++# AC_DEFINE(HAVE_LOG10F) ++# AC_DEFINE(HAVE_MODFF) ++# AC_DEFINE(HAVE_SINF) ++# AC_DEFINE(HAVE_SINHF) ++# AC_DEFINE(HAVE_SINCOS) ++# AC_DEFINE(HAVE_SINCOSF) ++ AC_DEFINE(HAVE_SQRTF) ++# AC_DEFINE(HAVE_TANF) ++# AC_DEFINE(HAVE_TANHF) ++ if test x"long_double_math_on_this_cpu" = x"yes"; then ++ AC_MSG_ERROR([long_double_math_on_this_cpu is yes!]) ++# AC_DEFINE(HAVE_ACOSL) ++# AC_DEFINE(HAVE_ASINL) ++# AC_DEFINE(HAVE_ATANL) ++# AC_DEFINE(HAVE_ATAN2L) ++# AC_DEFINE(HAVE_CEILL) ++# AC_DEFINE(HAVE_COPYSIGNL) ++# AC_DEFINE(HAVE_COSL) ++# AC_DEFINE(HAVE_COSHL) ++# AC_DEFINE(HAVE_EXPL) ++# AC_DEFINE(HAVE_FABSL) ++# AC_DEFINE(HAVE_FINITEL) ++# AC_DEFINE(HAVE_FLOORL) ++# AC_DEFINE(HAVE_FMODL) ++# AC_DEFINE(HAVE_FREXPL) ++# AC_DEFINE(HAVE_HYPOTL) ++# AC_DEFINE(HAVE_ISINFL) ++# AC_DEFINE(HAVE_ISNANL) ++# AC_DEFINE(HAVE_LOGL) ++# AC_DEFINE(HAVE_LOG10L) ++# AC_DEFINE(HAVE_MODFL) ++# AC_DEFINE(HAVE_POWL) ++# AC_DEFINE(HAVE_SINL) ++# AC_DEFINE(HAVE_SINHL) ++# AC_DEFINE(HAVE_SINCOSL) ++# AC_DEFINE(HAVE_SQRTL) ++# AC_DEFINE(HAVE_TANL) ++# AC_DEFINE(HAVE_TANHL) ++ fi ++ ;; + *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu) + AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ + machine/endian.h machine/param.h sys/machine.h sys/types.h \ +@@ -157,7 +250,7 @@ + AC_DEFINE(HAVE_INT64_T) + case "$target" in + *-uclinux*) +- # Don't enable LFS with uClibc ++ # Don't enable LFS with uClinux + ;; + *) + AC_DEFINE(_GLIBCXX_USE_LFS) +--- gcc-4.1.2.orig/libstdc++-v3/include/c_compatibility/wchar.h 2005-08-17 04:28:44.000000000 +0200 ++++ gcc-4.1.2/libstdc++-v3/include/c_compatibility/wchar.h 2007-03-04 23:31:57.000000000 +0100 +@@ -101,7 +101,9 @@ + using std::wmemcpy; + using std::wmemmove; + using std::wmemset; ++#if _GLIBCXX_HAVE_WCSFTIME + using std::wcsftime; ++#endif + + #if _GLIBCXX_USE_C99 + using std::wcstold; +--- gcc-4.1.2.orig/libstdc++-v3/include/c_std/std_cwchar.h 2005-10-30 23:21:50.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/include/c_std/std_cwchar.h 2007-03-04 23:31:57.000000000 +0100 +@@ -180,7 +180,9 @@ + using ::wcscoll; + using ::wcscpy; + using ::wcscspn; ++#if _GLIBCXX_HAVE_WCSFTIME + using ::wcsftime; ++#endif + using ::wcslen; + using ::wcsncat; + using ::wcsncmp; diff --git a/patches/gcc/4.1.2/130-libstdc++-pic.patch b/patches/gcc/4.1.2/130-libstdc++-pic.patch new file mode 100644 index 0000000..82be8a6 --- /dev/null +++ b/patches/gcc/4.1.2/130-libstdc++-pic.patch @@ -0,0 +1,48 @@ +--- gcc-4.1.2.orig/libstdc++-v3/src/Makefile.am 2006-01-10 05:01:00.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/src/Makefile.am 2007-03-04 23:32:40.000000000 +0100 +@@ -234,6 +234,12 @@ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ + + ++install-exec-local: ++ifeq ($(enable_shared),yes) ++ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++endif ++ + # Added bits to build debug library. + if GLIBCXX_BUILD_DEBUG + all-local: build_debug +--- gcc-4.1.2.orig/libstdc++-v3/src/Makefile.in 2006-01-10 18:14:00.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/src/Makefile.in 2007-03-04 23:32:40.000000000 +0100 +@@ -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 \ +@@ -760,6 +761,13 @@ + install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ++ ++install-exec-local: ++ifeq ($(enable_shared),yes) ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++endif ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff --git a/patches/gcc/4.1.2/140-missing-execinfo_h.patch b/patches/gcc/4.1.2/140-missing-execinfo_h.patch new file mode 100644 index 0000000..a1bfddb --- /dev/null +++ b/patches/gcc/4.1.2/140-missing-execinfo_h.patch @@ -0,0 +1,11 @@ +--- gcc-4.1.2.orig/boehm-gc/include/gc.h 2005-01-02 04:35:57.000000000 +0100 ++++ gcc-4.1.2/boehm-gc/include/gc.h 2007-03-04 23:33:07.000000000 +0100 +@@ -500,7 +500,7 @@ + #ifdef __linux__ + # include + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/patches/gcc/4.1.2/150-c99-snprintf.patch b/patches/gcc/4.1.2/150-c99-snprintf.patch new file mode 100644 index 0000000..775cd18 --- /dev/null +++ b/patches/gcc/4.1.2/150-c99-snprintf.patch @@ -0,0 +1,11 @@ +--- gcc-4.1.2.orig/libstdc++-v3/include/c_std/std_cstdio.h 2005-10-30 23:21:50.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/include/c_std/std_cstdio.h 2007-03-04 23:33:27.000000000 +0100 +@@ -143,7 +143,7 @@ + using ::vsprintf; + } + +-#if _GLIBCXX_USE_C99 ++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf diff --git a/patches/gcc/4.1.2/160-c99-complex-ugly-hack.patch b/patches/gcc/4.1.2/160-c99-complex-ugly-hack.patch new file mode 100644 index 0000000..209c457 --- /dev/null +++ b/patches/gcc/4.1.2/160-c99-complex-ugly-hack.patch @@ -0,0 +1,12 @@ +--- gcc-4.1.2.orig/libstdc++-v3/configure 2007-03-04 23:32:31.000000000 +0100 ++++ gcc-4.1.2/libstdc++-v3/configure 2007-03-04 23:33:54.000000000 +0100 +@@ -7324,6 +7324,9 @@ + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + #include ++#ifdef __UCLIBC__ ++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs ++#endif + int + main () + { diff --git a/patches/gcc/4.1.2/170-index_macro.patch b/patches/gcc/4.1.2/170-index_macro.patch new file mode 100644 index 0000000..a990b07 --- /dev/null +++ b/patches/gcc/4.1.2/170-index_macro.patch @@ -0,0 +1,24 @@ +--- gcc-4.1.2.orig/libstdc++-v3/include/ext/rope 2005-08-17 04:28:44.000000000 +0200 ++++ gcc-4.1.2/libstdc++-v3/include/ext/rope 2007-03-04 23:34:08.000000000 +0100 +@@ -57,6 +57,9 @@ + #include + #include + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + # ifdef __GC + # define __GC_CONST const + # else +--- gcc-4.1.2.orig/libstdc++-v3/include/ext/ropeimpl.h 2005-08-17 04:28:44.000000000 +0200 ++++ gcc-4.1.2/libstdc++-v3/include/ext/ropeimpl.h 2007-03-04 23:34:08.000000000 +0100 +@@ -53,6 +53,9 @@ + #include // For uninitialized_copy_n + #include // For power + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + namespace __gnu_cxx + { + using std::size_t; diff --git a/patches/gcc/4.1.2/180-libbackend_dep_gcov-iov.h.patch b/patches/gcc/4.1.2/180-libbackend_dep_gcov-iov.h.patch new file mode 100644 index 0000000..714449b --- /dev/null +++ b/patches/gcc/4.1.2/180-libbackend_dep_gcov-iov.h.patch @@ -0,0 +1,11 @@ +--- gcc-4.1.2.orig/gcc/Makefile.in 2006-11-01 15:40:44.000000000 +0100 ++++ gcc-4.1.2/gcc/Makefile.in 2007-03-04 23:34:32.000000000 +0100 +@@ -2522,7 +2522,7 @@ + # FIXME: writing proper dependencies for this is a *LOT* of work. + libbackend.o : $(OBJS-common:.o=.c) $(out_file) \ + insn-config.h insn-flags.h insn-codes.h insn-constants.h \ +- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) ++ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ + -DTARGET_NAME=\"$(target_noncanonical)\" \ + -DLOCALEDIR=\"$(localedir)\" \ diff --git a/patches/gcc/4.1.2/190-sh-pr24836.patch b/patches/gcc/4.1.2/190-sh-pr24836.patch new file mode 100644 index 0000000..39328a5 --- /dev/null +++ b/patches/gcc/4.1.2/190-sh-pr24836.patch @@ -0,0 +1,22 @@ +--- gcc-4.1.2.orig/gcc/configure.ac 2006-11-13 23:09:55.000000000 +0100 ++++ gcc-4.1.2/gcc/configure.ac 2007-03-04 23:34:53.000000000 +0100 +@@ -2435,7 +2435,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-4.1.2.orig/gcc/configure 2006-11-13 23:09:55.000000000 +0100 ++++ gcc-4.1.2/gcc/configure 2007-03-04 23:34:53.000000000 +0100 +@@ -14762,7 +14762,7 @@ + tls_first_minor=14 + tls_as_opt="-m64 -Aesame --fatal-warnings" + ;; +- sh-*-* | sh[34]-*-*) ++ sh-*-* | sh[34]*-*-*) + conftest_s=' + .section ".tdata","awT",@progbits + foo: .long 25 diff --git a/patches/gcc/4.1.2/200-arm-bigendian.patch b/patches/gcc/4.1.2/200-arm-bigendian.patch new file mode 100644 index 0000000..57b83eb --- /dev/null +++ b/patches/gcc/4.1.2/200-arm-bigendian.patch @@ -0,0 +1,114 @@ +--- gcc-4.1.2.orig/gcc/config/arm/linux-elf.h 2007-03-04 23:25:37.000000000 +0100 ++++ gcc-4.1.2/gcc/config/arm/linux-elf.h 2007-03-04 23:35:09.000000000 +0100 +@@ -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 +@@ -65,7 +79,7 @@ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker " LINUX_TARGET_INTERPRETER "} \ + -X \ +- %{mbig-endian:-EB}" \ ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ + SUBTARGET_EXTRA_LINK_SPEC + + #undef LINK_SPEC +--- gcc-4.1.2.orig/gcc/config.gcc 2007-03-04 23:31:48.000000000 +0100 ++++ gcc-4.1.2/gcc/config.gcc 2007-03-04 23:35:09.000000000 +0100 +@@ -672,6 +672,11 @@ + ;; + arm*-*-linux*) # ARM GNU/Linux with ELF + tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" ++ case $target in ++ arm*b-*) ++ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" ++ ;; ++ esac + tmake_file="${tmake_file} t-linux arm/t-arm" + case ${target} in + arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi) +--- gcc-4.1.2.orig/gcc/config/arm/linux-eabi.h 2007-03-04 23:31:48.000000000 +0100 ++++ gcc-4.1.2/gcc/config/arm/linux-eabi.h 2007-03-04 23:35:09.000000000 +0100 +@@ -20,6 +20,17 @@ + the Free Software Foundation, 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + ++/* ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* ++ * (big endian) configurations. ++ */ ++#undef TARGET_LINKER_EMULATION ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define TARGET_LINKER_EMULATION "armelfb_linux_eabi" ++#else ++#define TARGET_LINKER_EMULATION "armelf_linux_eabi" ++#endif ++ + /* On EABI GNU/Linux, we want both the BPABI builtins and the + GNU/Linux builtins. */ + #undef TARGET_OS_CPP_BUILTINS +@@ -48,7 +59,7 @@ + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi + + #undef SUBTARGET_EXTRA_LINK_SPEC +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi" ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION + + /* Use ld-linux.so.3 so that it will be possible to run "classic" + GNU/Linux binaries on an EABI system. */ +--- gcc-4.1.2.orig/gcc/config/arm/bpabi.h 2005-12-13 02:35:37.000000000 +0100 ++++ gcc-4.1.2/gcc/config/arm/bpabi.h 2007-03-04 23:35:09.000000000 +0100 +@@ -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/patches/gcc/4.1.2/200-uclibc-locale.patch b/patches/gcc/4.1.2/200-uclibc-locale.patch deleted file mode 100644 index 8c5a183..0000000 --- a/patches/gcc/4.1.2/200-uclibc-locale.patch +++ /dev/null @@ -1,3239 +0,0 @@ ---- gcc-4.1.2.orig/libstdc++-v3/acinclude.m4 2007-01-29 11:51:01.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/acinclude.m4 2007-03-04 23:31:57.000000000 +0100 -@@ -1003,7 +1003,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 -@@ -1019,6 +1019,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 -@@ -1162,6 +1165,40 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ AC_MSG_RESULT(uclibc) -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ AC_SUBST(glibcxx_MOFILES) -+ AC_SUBST(glibcxx_POFILES) -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the ---- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-03-04 23:31:57.000000000 +0100 -@@ -0,0 +1,63 @@ -+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*- -+ -+// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// Written by Jakub Jelinek -+ -+#include -+#include -+ -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning clean this up -+#endif -+ -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ -+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l; -+extern "C" __typeof(strcoll_l) __strcoll_l; -+extern "C" __typeof(strftime_l) __strftime_l; -+extern "C" __typeof(strtod_l) __strtod_l; -+extern "C" __typeof(strtof_l) __strtof_l; -+extern "C" __typeof(strtold_l) __strtold_l; -+extern "C" __typeof(strxfrm_l) __strxfrm_l; -+extern "C" __typeof(newlocale) __newlocale; -+extern "C" __typeof(freelocale) __freelocale; -+extern "C" __typeof(duplocale) __duplocale; -+extern "C" __typeof(uselocale) __uselocale; -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+extern "C" __typeof(iswctype_l) __iswctype_l; -+extern "C" __typeof(towlower_l) __towlower_l; -+extern "C" __typeof(towupper_l) __towupper_l; -+extern "C" __typeof(wcscoll_l) __wcscoll_l; -+extern "C" __typeof(wcsftime_l) __wcsftime_l; -+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l; -+extern "C" __typeof(wctype_l) __wctype_l; -+#endif -+ -+#endif // GLIBC 2.3 and later ---- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-03-04 23:31:57.000000000 +0100 -@@ -0,0 +1,152 @@ -+// Wrapper for underlying C-language localization -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004, 2005 -+// Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.8 Standard locale categories. -+// -+ -+// Written by Benjamin Kosnik -+ -+#include // For errno -+#include -+#include -+#include -+#include -+ -+#ifndef __UCLIBC_HAS_XLOCALE__ -+#define __strtol_l(S, E, B, L) strtol((S), (E), (B)) -+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B)) -+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B)) -+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B)) -+#define __strtof_l(S, E, L) strtof((S), (E)) -+#define __strtod_l(S, E, L) strtod((S), (E)) -+#define __strtold_l(S, E, L) strtold((S), (E)) -+#warning should dummy __newlocale check for C|POSIX ? -+#define __newlocale(a, b, c) NULL -+#define __freelocale(a) ((void)0) -+#define __duplocale(a) __c_locale() -+#endif -+ -+namespace std -+{ -+ template<> -+ void -+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, -+ const __c_locale& __cloc) -+ { -+ char* __sanity; -+ errno = 0; -+ float __f = __strtof_l(__s, &__sanity, __cloc); -+ if (__sanity != __s && errno != ERANGE) -+ __v = __f; -+ else -+ __err |= ios_base::failbit; -+ } -+ -+ template<> -+ void -+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, -+ const __c_locale& __cloc) -+ { -+ char* __sanity; -+ errno = 0; -+ double __d = __strtod_l(__s, &__sanity, __cloc); -+ if (__sanity != __s && errno != ERANGE) -+ __v = __d; -+ else -+ __err |= ios_base::failbit; -+ } -+ -+ template<> -+ void -+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err, -+ const __c_locale& __cloc) -+ { -+ char* __sanity; -+ errno = 0; -+ long double __ld = __strtold_l(__s, &__sanity, __cloc); -+ if (__sanity != __s && errno != ERANGE) -+ __v = __ld; -+ else -+ __err |= ios_base::failbit; -+ } -+ -+ void -+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, -+ __c_locale __old) -+ { -+ __cloc = __newlocale(1 << LC_ALL, __s, __old); -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ if (!__cloc) -+ { -+ // This named locale is not supported by the underlying OS. -+ __throw_runtime_error(__N("locale::facet::_S_create_c_locale " -+ "name not valid")); -+ } -+#endif -+ } -+ -+ void -+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc) -+ { -+ if (__cloc && _S_get_c_locale() != __cloc) -+ __freelocale(__cloc); -+ } -+ -+ __c_locale -+ locale::facet::_S_clone_c_locale(__c_locale& __cloc) -+ { return __duplocale(__cloc); } -+} // namespace std -+ -+namespace __gnu_cxx -+{ -+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] = -+ { -+ "LC_CTYPE", -+ "LC_NUMERIC", -+ "LC_TIME", -+ "LC_COLLATE", -+ "LC_MONETARY", -+ "LC_MESSAGES", -+#if _GLIBCXX_NUM_CATEGORIES != 0 -+ "LC_PAPER", -+ "LC_NAME", -+ "LC_ADDRESS", -+ "LC_TELEPHONE", -+ "LC_MEASUREMENT", -+ "LC_IDENTIFICATION" -+#endif -+ }; -+} -+ -+namespace std -+{ -+ const char* const* const locale::_S_categories = __gnu_cxx::category_names; -+} // namespace std ---- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-03-04 23:31:57.000000000 +0100 -@@ -0,0 +1,117 @@ -+// Wrapper for underlying C-language localization -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.8 Standard locale categories. -+// -+ -+// Written by Benjamin Kosnik -+ -+#ifndef _C_LOCALE_H -+#define _C_LOCALE_H 1 -+ -+#pragma GCC system_header -+ -+#include // get std::strlen -+#include // get std::snprintf or std::sprintf -+#include -+#include // For codecvt -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this -+#endif -+#ifdef __UCLIBC_HAS_LOCALE__ -+#include // For codecvt using iconv, iconv_t -+#endif -+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ -+#include // 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 -+ int -+ __convert_from_v(char* __out, -+ const int __size __attribute__ ((__unused__)), -+ const char* __fmt, -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ _Tv __v, const __c_locale& __cloc, int __prec) -+ { -+ __c_locale __old = __gnu_cxx::__uselocale(__cloc); -+#else -+ _Tv __v, const __c_locale&, int __prec) -+ { -+# ifdef __UCLIBC_HAS_LOCALE__ -+ char* __old = std::setlocale(LC_ALL, NULL); -+ char* __sav = new char[std::strlen(__old) + 1]; -+ std::strcpy(__sav, __old); -+ std::setlocale(LC_ALL, "C"); -+# endif -+#endif -+ -+ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v); -+ -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __gnu_cxx::__uselocale(__old); -+#elif defined __UCLIBC_HAS_LOCALE__ -+ std::setlocale(LC_ALL, __sav); -+ delete [] __sav; -+#endif -+ return __ret; -+ } -+} -+ -+#endif ---- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2007-03-04 23:31:57.000000000 +0100 -@@ -0,0 +1,306 @@ -+// std::codecvt implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2002, 2003 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.1.5 - Template class codecvt -+// -+ -+// Written by Benjamin Kosnik -+ -+#include -+#include -+ -+namespace std -+{ -+ // Specializations. -+#ifdef _GLIBCXX_USE_WCHAR_T -+ codecvt_base::result -+ codecvt:: -+ 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(-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(__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:: -+ 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(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(-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(-1) -+ || __conv == static_cast(-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:: -+ 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:: -+ 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:: -+ 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(__builtin_alloca(sizeof(wchar_t) -+ * __max)); -+ while (__from < __end && __max) -+ { -+ const extern_type* __from_chunk_end; -+ __from_chunk_end = static_cast(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(-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(-1) -+ || __conv == static_cast(-2)) -+ break; -+ } -+ __state = __tmp_state; -+ __ret += __from - __tmp_from; -+ break; -+ } -+ if (!__from) -+ __from = __from_chunk_end; -+ -+ __ret += __from - __tmp_from; -+ __max -= __conv; -+ -+ if (__from < __end && __max) -+ { -+ // XXX Probably wrong for stateful encodings -+ __tmp_state = __state; -+ ++__from; -+ ++__ret; -+ --__max; -+ } -+ } -+ -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ -+ return __ret; -+ } -+#endif -+} ---- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-03-04 23:31:57.000000000 +0100 -@@ -0,0 +1,80 @@ -+// std::collate implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#include -+#include -+ -+#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::_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::_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::_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::_M_transform(wchar_t* __to, const wchar_t* __from, -+ size_t __n) const -+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); } -+#endif -+} ---- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-03-04 23:31:57.000000000 +0100 -@@ -0,0 +1,314 @@ -+// std::ctype implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions. -+// -+ -+// Written by Benjamin Kosnik -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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 specializations are in src/locale.cc and -+ // various /config/os/* files. -+ template<> -+ ctype_byname::ctype_byname(const char* __s, size_t __refs) -+ : ctype(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::__wmask_type -+ ctype::_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::do_toupper(wchar_t __c) const -+ { return __towupper_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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::do_tolower(wchar_t __c) const -+ { return __towlower_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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:: -+ do_is(mask __m, wchar_t __c) const -+ { -+ // The case of __m == ctype_base::space is particularly important, -+ // due to its use in many istream functions. Therefore we deal with -+ // it first, exploiting the knowledge that on GNU systems _M_bit[5] -+ // is the mask corresponding to ctype_base::space. NB: an encoding -+ // change would not affect correctness! -+ bool __ret = false; -+ if (__m == _M_bit[5]) -+ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype); -+ else -+ { -+ // Highest bitmask in ctype_base == 10, but extra in "C" -+ // library for blank. -+ const size_t __bitmasksize = 11; -+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) -+ if (__m & _M_bit[__bitcur]) -+ { -+ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype)) -+ { -+ __ret = true; -+ break; -+ } -+ else if (__m == _M_bit[__bitcur]) -+ break; -+ } -+ } -+ return __ret; -+ } -+ -+ const wchar_t* -+ ctype:: -+ 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:: -+ 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:: -+ 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:: -+ do_widen(char __c) const -+ { return _M_widen[static_cast(__c)]; } -+ -+ const char* -+ ctype:: -+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const -+ { -+ while (__lo < __hi) -+ { -+ *__dest = _M_widen[static_cast(*__lo)]; -+ ++__lo; -+ ++__dest; -+ } -+ return __hi; -+ } -+ -+ char -+ ctype:: -+ 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(__c)); -+ } -+ -+ const wchar_t* -+ ctype:: -+ 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(__c)); -+ } -+ ++__lo; -+ ++__dest; -+ } -+ else -+ while (__lo < __hi) -+ { -+ const int __c = wctob(*__lo); -+ *__dest = (__c == EOF ? __dfault : static_cast(__c)); -+ ++__lo; -+ ++__dest; -+ } -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ return __hi; -+ } -+ -+ void -+ ctype::_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(__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(_ISbit(__k)); -+ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]); -+ } -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ } -+#endif // _GLIBCXX_USE_WCHAR_T -+} ---- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-03-04 23:31:57.000000000 +0100 -@@ -0,0 +1,100 @@ -+// std::messages implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#include -+#include -+ -+#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::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(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::do_get(catalog, int, int, const wstring& __dfault) const -+ { -+# ifdef __UCLIBC_HAS_XLOCALE__ -+ __c_locale __old = __uselocale(_M_c_locale_messages); -+ char* __msg = gettext(_M_convert_to_char(__dfault)); -+ __uselocale(__old); -+ return _M_convert_from_char(__msg); -+# elif defined __UCLIBC_HAS_LOCALE__ -+ char* __old = strdup(setlocale(LC_ALL, NULL)); -+ setlocale(LC_ALL, _M_name_messages); -+ char* __msg = gettext(_M_convert_to_char(__dfault)); -+ setlocale(LC_ALL, __old); -+ free(__old); -+ return _M_convert_from_char(__msg); -+# else -+ char* __msg = gettext(_M_convert_to_char(__dfault)); -+ return _M_convert_from_char(__msg); -+# endif -+ } -+#endif -+} ---- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-03-04 23:31:57.000000000 +0100 -@@ -0,0 +1,121 @@ -+// std::messages implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.7.1.2 messages functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#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 -+ messages<_CharT>::messages(size_t __refs) -+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), -+ _M_name_messages(_S_get_c_name()) -+ { } -+ -+ template -+ messages<_CharT>::messages(__c_locale __cloc, const char* __s, -+ size_t __refs) -+ : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL) -+ { -+ const size_t __len = std::strlen(__s) + 1; -+ char* __tmp = new char[__len]; -+ std::memcpy(__tmp, __s, __len); -+ _M_name_messages = __tmp; -+ -+ // Last to avoid leaking memory if new throws. -+ _M_c_locale_messages = _S_clone_c_locale(__cloc); -+ } -+ -+ template -+ typename messages<_CharT>::catalog -+ messages<_CharT>::open(const basic_string& __s, const locale& __loc, -+ const char* __dir) const -+ { -+ __bindtextdomain(__s.c_str(), __dir); -+ return this->do_open(__s, __loc); -+ } -+ -+ // Virtual member functions. -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::do_open(const basic_string& __s, -+ const locale&) const -+ { -+ // No error checking is done, assume the catalog exists and can -+ // be used. -+ __textdomain(__s.c_str()); -+ return 0; -+ } -+ -+ template -+ void -+ messages<_CharT>::do_close(catalog) const -+ { } -+ -+ // messages_byname -+ template -+ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) -+ : messages<_CharT>(__refs) -+ { -+ if (this->_M_name_messages != locale::facet::_S_get_c_name()) -+ delete [] this->_M_name_messages; -+ char* __tmp = new char[std::strlen(__s) + 1]; -+ std::strcpy(__tmp, __s); -+ this->_M_name_messages = __tmp; -+ -+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) -+ { -+ this->_S_destroy_c_locale(this->_M_c_locale_messages); -+ this->_S_create_c_locale(this->_M_c_locale_messages, __s); -+ } -+ } ---- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-03-04 23:31:57.000000000 +0100 -@@ -0,0 +1,692 @@ -+// std::moneypunct implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning optimize this for uclibc -+#warning tailor for stub locale support -+#endif -+ -+#ifndef __UCLIBC_HAS_XLOCALE__ -+#define __nl_langinfo_l(N, L) nl_langinfo((N)) -+#endif -+ -+namespace std -+{ -+ // Construct and return valid pattern consisting of some combination of: -+ // space none symbol sign value -+ money_base::pattern -+ money_base::_S_construct_pattern(char __precedes, char __space, char __posn) -+ { -+ pattern __ret; -+ -+ // This insanely complicated routine attempts to construct a valid -+ // pattern for use with monyepunct. A couple of invariants: -+ -+ // if (__precedes) symbol -> value -+ // else value -> symbol -+ -+ // if (__space) space -+ // else none -+ -+ // none == never first -+ // space never first or last -+ -+ // Any elegant implementations of this are welcome. -+ switch (__posn) -+ { -+ case 0: -+ case 1: -+ // 1 The sign precedes the value and symbol. -+ __ret.field[0] = sign; -+ if (__space) -+ { -+ // Pattern starts with sign. -+ if (__precedes) -+ { -+ __ret.field[1] = symbol; -+ __ret.field[3] = value; -+ } -+ else -+ { -+ __ret.field[1] = value; -+ __ret.field[3] = symbol; -+ } -+ __ret.field[2] = space; -+ } -+ else -+ { -+ // Pattern starts with sign and ends with none. -+ if (__precedes) -+ { -+ __ret.field[1] = symbol; -+ __ret.field[2] = value; -+ } -+ else -+ { -+ __ret.field[1] = value; -+ __ret.field[2] = symbol; -+ } -+ __ret.field[3] = none; -+ } -+ break; -+ case 2: -+ // 2 The sign follows the value and symbol. -+ if (__space) -+ { -+ // Pattern either ends with sign. -+ if (__precedes) -+ { -+ __ret.field[0] = symbol; -+ __ret.field[2] = value; -+ } -+ else -+ { -+ __ret.field[0] = value; -+ __ret.field[2] = symbol; -+ } -+ __ret.field[1] = space; -+ __ret.field[3] = sign; -+ } -+ else -+ { -+ // Pattern ends with sign then none. -+ if (__precedes) -+ { -+ __ret.field[0] = symbol; -+ __ret.field[1] = value; -+ } -+ else -+ { -+ __ret.field[0] = value; -+ __ret.field[1] = symbol; -+ } -+ __ret.field[2] = sign; -+ __ret.field[3] = none; -+ } -+ break; -+ case 3: -+ // 3 The sign immediately precedes the symbol. -+ if (__precedes) -+ { -+ __ret.field[0] = sign; -+ __ret.field[1] = symbol; -+ if (__space) -+ { -+ __ret.field[2] = space; -+ __ret.field[3] = value; -+ } -+ else -+ { -+ __ret.field[2] = value; -+ __ret.field[3] = none; -+ } -+ } -+ else -+ { -+ __ret.field[0] = value; -+ if (__space) -+ { -+ __ret.field[1] = space; -+ __ret.field[2] = sign; -+ __ret.field[3] = symbol; -+ } -+ else -+ { -+ __ret.field[1] = sign; -+ __ret.field[2] = symbol; -+ __ret.field[3] = none; -+ } -+ } -+ break; -+ case 4: -+ // 4 The sign immediately follows the symbol. -+ if (__precedes) -+ { -+ __ret.field[0] = symbol; -+ __ret.field[1] = sign; -+ if (__space) -+ { -+ __ret.field[2] = space; -+ __ret.field[3] = value; -+ } -+ else -+ { -+ __ret.field[2] = value; -+ __ret.field[3] = none; -+ } -+ } -+ else -+ { -+ __ret.field[0] = value; -+ if (__space) -+ { -+ __ret.field[1] = space; -+ __ret.field[2] = symbol; -+ __ret.field[3] = sign; -+ } -+ else -+ { -+ __ret.field[1] = symbol; -+ __ret.field[2] = sign; -+ __ret.field[3] = none; -+ } -+ } -+ break; -+ default: -+ __ret = pattern(); -+ } -+ return __ret; -+ } -+ -+ template<> -+ void -+ moneypunct::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::~moneypunct() -+ { delete _M_data; } -+ -+ template<> -+ moneypunct::~moneypunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ moneypunct::_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; -+ -+ 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(money_base::_S_atoms[__i]); -+ } -+ else -+ { -+ // Named locale. -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __c_locale __old = __uselocale(__cloc); -+#else -+ // Switch to named locale so that mbsrtowcs will work. -+ char* __old = strdup(setlocale(LC_ALL, NULL)); -+ setlocale(LC_ALL, __name); -+#endif -+ -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this... should be monetary -+#endif -+#ifdef __UCLIBC__ -+# ifdef __UCLIBC_HAS_XLOCALE__ -+ _M_data->_M_decimal_point = __cloc->decimal_point_wc; -+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; -+# elif defined __UCLIBC_HAS_LOCALE__ -+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; -+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; -+# endif -+#else -+ union { char *__s; wchar_t __w; } __u; -+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); -+ _M_data->_M_decimal_point = __u.__w; -+ -+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); -+ _M_data->_M_thousands_sep = __u.__w; -+#endif -+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); -+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); -+ -+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); -+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); -+ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); -+ -+ wchar_t* __wcs_ps = 0; -+ wchar_t* __wcs_ns = 0; -+ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); -+ try -+ { -+ mbstate_t __state; -+ size_t __len = strlen(__cpossign); -+ if (__len) -+ { -+ ++__len; -+ memset(&__state, 0, sizeof(mbstate_t)); -+ __wcs_ps = new wchar_t[__len]; -+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); -+ _M_data->_M_positive_sign = __wcs_ps; -+ } -+ else -+ _M_data->_M_positive_sign = L""; -+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); -+ -+ __len = strlen(__cnegsign); -+ if (!__nposn) -+ _M_data->_M_negative_sign = L"()"; -+ else if (__len) -+ { -+ ++__len; -+ memset(&__state, 0, sizeof(mbstate_t)); -+ __wcs_ns = new wchar_t[__len]; -+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); -+ _M_data->_M_negative_sign = __wcs_ns; -+ } -+ else -+ _M_data->_M_negative_sign = L""; -+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); -+ -+ // _Intl == true. -+ __len = strlen(__ccurr); -+ if (__len) -+ { -+ ++__len; -+ memset(&__state, 0, sizeof(mbstate_t)); -+ wchar_t* __wcs = new wchar_t[__len]; -+ mbsrtowcs(__wcs, &__ccurr, __len, &__state); -+ _M_data->_M_curr_symbol = __wcs; -+ } -+ else -+ _M_data->_M_curr_symbol = L""; -+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); -+ } -+ catch (...) -+ { -+ delete _M_data; -+ _M_data = 0; -+ delete __wcs_ps; -+ delete __wcs_ns; -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#else -+ setlocale(LC_ALL, __old); -+ free(__old); -+#endif -+ __throw_exception_again; -+ } -+ -+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, -+ __cloc)); -+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); -+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); -+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); -+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, -+ __pposn); -+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); -+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); -+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, -+ __nposn); -+ -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#else -+ setlocale(LC_ALL, __old); -+ free(__old); -+#endif -+ } -+ } -+ -+ template<> -+ void -+ moneypunct::_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; -+ -+ 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(money_base::_S_atoms[__i]); -+ } -+ else -+ { -+ // Named locale. -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __c_locale __old = __uselocale(__cloc); -+#else -+ // Switch to named locale so that mbsrtowcs will work. -+ char* __old = strdup(setlocale(LC_ALL, NULL)); -+ setlocale(LC_ALL, __name); -+#endif -+ -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this... should be monetary -+#endif -+#ifdef __UCLIBC__ -+# ifdef __UCLIBC_HAS_XLOCALE__ -+ _M_data->_M_decimal_point = __cloc->decimal_point_wc; -+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; -+# elif defined __UCLIBC_HAS_LOCALE__ -+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; -+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; -+# endif -+#else -+ union { char *__s; wchar_t __w; } __u; -+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); -+ _M_data->_M_decimal_point = __u.__w; -+ -+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); -+ _M_data->_M_thousands_sep = __u.__w; -+#endif -+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); -+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); -+ -+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); -+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); -+ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); -+ -+ wchar_t* __wcs_ps = 0; -+ wchar_t* __wcs_ns = 0; -+ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); -+ try -+ { -+ mbstate_t __state; -+ size_t __len; -+ __len = strlen(__cpossign); -+ if (__len) -+ { -+ ++__len; -+ memset(&__state, 0, sizeof(mbstate_t)); -+ __wcs_ps = new wchar_t[__len]; -+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); -+ _M_data->_M_positive_sign = __wcs_ps; -+ } -+ else -+ _M_data->_M_positive_sign = L""; -+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); -+ -+ __len = strlen(__cnegsign); -+ if (!__nposn) -+ _M_data->_M_negative_sign = L"()"; -+ else if (__len) -+ { -+ ++__len; -+ memset(&__state, 0, sizeof(mbstate_t)); -+ __wcs_ns = new wchar_t[__len]; -+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); -+ _M_data->_M_negative_sign = __wcs_ns; -+ } -+ else -+ _M_data->_M_negative_sign = L""; -+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); -+ -+ // _Intl == true. -+ __len = strlen(__ccurr); -+ if (__len) -+ { -+ ++__len; -+ memset(&__state, 0, sizeof(mbstate_t)); -+ wchar_t* __wcs = new wchar_t[__len]; -+ mbsrtowcs(__wcs, &__ccurr, __len, &__state); -+ _M_data->_M_curr_symbol = __wcs; -+ } -+ else -+ _M_data->_M_curr_symbol = L""; -+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); -+ } -+ catch (...) -+ { -+ delete _M_data; -+ _M_data = 0; -+ delete __wcs_ps; -+ delete __wcs_ns; -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#else -+ setlocale(LC_ALL, __old); -+ free(__old); -+#endif -+ __throw_exception_again; -+ } -+ -+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); -+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); -+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); -+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); -+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, -+ __pposn); -+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); -+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); -+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, -+ __nposn); -+ -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#else -+ setlocale(LC_ALL, __old); -+ free(__old); -+#endif -+ } -+ } -+ -+ template<> -+ moneypunct::~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::~moneypunct() -+ { -+ if (_M_data->_M_positive_sign_size) -+ delete [] _M_data->_M_positive_sign; -+ if (_M_data->_M_negative_sign_size -+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0) -+ delete [] _M_data->_M_negative_sign; -+ if (_M_data->_M_curr_symbol_size) -+ delete [] _M_data->_M_curr_symbol; -+ delete _M_data; -+ } -+#endif -+} ---- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-03-04 23:31:57.000000000 +0100 -@@ -0,0 +1,173 @@ -+// std::numpunct implementation details, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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::~numpunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ numpunct::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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(__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(__num_base::_S_atoms_in[__j]); -+ } -+ else -+ { -+ // Named locale. -+ // NB: In the GNU model wchar_t is always 32 bit wide. -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this -+#endif -+#ifdef __UCLIBC__ -+# ifdef __UCLIBC_HAS_XLOCALE__ -+ _M_data->_M_decimal_point = __cloc->decimal_point_wc; -+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; -+# elif defined __UCLIBC_HAS_LOCALE__ -+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc; -+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; -+# endif -+#else -+ union { char *__s; wchar_t __w; } __u; -+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc); -+ _M_data->_M_decimal_point = __u.__w; -+ -+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc); -+ _M_data->_M_thousands_sep = __u.__w; -+#endif -+ -+ if (_M_data->_M_thousands_sep == L'\0') -+ _M_data->_M_grouping = ""; -+ else -+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); -+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); -+ } -+ -+ // NB: There is no way to extact this info from posix locales. -+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc); -+ _M_data->_M_truename = L"true"; -+ _M_data->_M_truename_size = 4; -+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); -+ _M_data->_M_falsename = L"false"; -+ _M_data->_M_falsename_size = 5; -+ } -+ -+ template<> -+ numpunct::~numpunct() -+ { delete _M_data; } -+ #endif -+} ---- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-03-04 23:31:57.000000000 +0100 -@@ -0,0 +1,406 @@ -+// std::time_get, std::time_put implementation, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions -+// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions -+// -+ -+// Written by Benjamin Kosnik -+ -+#include -+#include -+ -+#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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+ 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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+#warning wide time stuff -+// if (!__cloc) -+ { -+ // "C" locale -+ _M_c_locale_timepunct = _S_get_c_locale(); -+ -+ _M_data->_M_date_format = L"%m/%d/%y"; -+ _M_data->_M_date_era_format = L"%m/%d/%y"; -+ _M_data->_M_time_format = L"%H:%M:%S"; -+ _M_data->_M_time_era_format = L"%H:%M:%S"; -+ _M_data->_M_date_time_format = L""; -+ _M_data->_M_date_time_era_format = L""; -+ _M_data->_M_am = L"AM"; -+ _M_data->_M_pm = L"PM"; -+ _M_data->_M_am_pm_format = L""; -+ -+ // Day names, starting with "C"'s Sunday. -+ _M_data->_M_day1 = L"Sunday"; -+ _M_data->_M_day2 = L"Monday"; -+ _M_data->_M_day3 = L"Tuesday"; -+ _M_data->_M_day4 = L"Wednesday"; -+ _M_data->_M_day5 = L"Thursday"; -+ _M_data->_M_day6 = L"Friday"; -+ _M_data->_M_day7 = L"Saturday"; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ _M_data->_M_aday1 = L"Sun"; -+ _M_data->_M_aday2 = L"Mon"; -+ _M_data->_M_aday3 = L"Tue"; -+ _M_data->_M_aday4 = L"Wed"; -+ _M_data->_M_aday5 = L"Thu"; -+ _M_data->_M_aday6 = L"Fri"; -+ _M_data->_M_aday7 = L"Sat"; -+ -+ // Month names, starting with "C"'s January. -+ _M_data->_M_month01 = L"January"; -+ _M_data->_M_month02 = L"February"; -+ _M_data->_M_month03 = L"March"; -+ _M_data->_M_month04 = L"April"; -+ _M_data->_M_month05 = L"May"; -+ _M_data->_M_month06 = L"June"; -+ _M_data->_M_month07 = L"July"; -+ _M_data->_M_month08 = L"August"; -+ _M_data->_M_month09 = L"September"; -+ _M_data->_M_month10 = L"October"; -+ _M_data->_M_month11 = L"November"; -+ _M_data->_M_month12 = L"December"; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ _M_data->_M_amonth01 = L"Jan"; -+ _M_data->_M_amonth02 = L"Feb"; -+ _M_data->_M_amonth03 = L"Mar"; -+ _M_data->_M_amonth04 = L"Apr"; -+ _M_data->_M_amonth05 = L"May"; -+ _M_data->_M_amonth06 = L"Jun"; -+ _M_data->_M_amonth07 = L"Jul"; -+ _M_data->_M_amonth08 = L"Aug"; -+ _M_data->_M_amonth09 = L"Sep"; -+ _M_data->_M_amonth10 = L"Oct"; -+ _M_data->_M_amonth11 = L"Nov"; -+ _M_data->_M_amonth12 = L"Dec"; -+ } -+#if 0 -+ else -+ { -+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); -+ -+ union { char *__s; wchar_t *__w; } __u; -+ -+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); -+ _M_data->_M_date_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); -+ _M_data->_M_date_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); -+ _M_data->_M_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); -+ _M_data->_M_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); -+ _M_data->_M_date_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); -+ _M_data->_M_date_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); -+ _M_data->_M_am = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); -+ _M_data->_M_pm = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); -+ _M_data->_M_am_pm_format = __u.__w; -+ -+ // Day names, starting with "C"'s Sunday. -+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); -+ _M_data->_M_day1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); -+ _M_data->_M_day2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); -+ _M_data->_M_day3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); -+ _M_data->_M_day4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); -+ _M_data->_M_day5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); -+ _M_data->_M_day6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); -+ _M_data->_M_day7 = __u.__w; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); -+ _M_data->_M_aday1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); -+ _M_data->_M_aday2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); -+ _M_data->_M_aday3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); -+ _M_data->_M_aday4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); -+ _M_data->_M_aday5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); -+ _M_data->_M_aday6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); -+ _M_data->_M_aday7 = __u.__w; -+ -+ // Month names, starting with "C"'s January. -+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); -+ _M_data->_M_month01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); -+ _M_data->_M_month02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); -+ _M_data->_M_month03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); -+ _M_data->_M_month04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); -+ _M_data->_M_month05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); -+ _M_data->_M_month06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); -+ _M_data->_M_month07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); -+ _M_data->_M_month08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); -+ _M_data->_M_month09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); -+ _M_data->_M_month10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); -+ _M_data->_M_month11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); -+ _M_data->_M_month12 = __u.__w; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); -+ _M_data->_M_amonth01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); -+ _M_data->_M_amonth02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); -+ _M_data->_M_amonth03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); -+ _M_data->_M_amonth04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); -+ _M_data->_M_amonth05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); -+ _M_data->_M_amonth06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); -+ _M_data->_M_amonth07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); -+ _M_data->_M_amonth08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); -+ _M_data->_M_amonth09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); -+ _M_data->_M_amonth10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); -+ _M_data->_M_amonth11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); -+ _M_data->_M_amonth12 = __u.__w; -+ } -+#endif // 0 -+ } -+#endif -+} ---- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/time_members.h 2007-03-04 23:31:57.000000000 +0100 -@@ -0,0 +1,76 @@ -+// std::time_get, std::time_put implementation, GNU version -*- C++ -*- -+ -+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.2.5.1.2 - time_get functions -+// ISO C++ 14882: 22.2.5.3.2 - time_put functions -+// -+ -+// Written by Benjamin Kosnik -+ -+ template -+ __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 -+ __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 -+ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, -+ size_t __refs) -+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), -+ _M_name_timepunct(NULL) -+ { -+ const size_t __len = std::strlen(__s) + 1; -+ char* __tmp = new char[__len]; -+ std::memcpy(__tmp, __s, __len); -+ _M_name_timepunct = __tmp; -+ -+ try -+ { _M_initialize_timepunct(__cloc); } -+ catch(...) -+ { -+ delete [] _M_name_timepunct; -+ __throw_exception_again; -+ } -+ } -+ -+ template -+ __timepunct<_CharT>::~__timepunct() -+ { -+ if (_M_name_timepunct != _S_get_c_name()) -+ delete [] _M_name_timepunct; -+ delete _M_data; -+ _S_destroy_c_locale(_M_c_locale_timepunct); -+ } ---- gcc-4.1.2.orig/libstdc++-v3/config/os/uclibc/ctype_base.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/config/os/uclibc/ctype_base.h 2007-03-04 23:31:57.000000000 +0100 -@@ -0,0 +1,64 @@ -+// Locale support -*- C++ -*- -+ -+// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 -+// Free Software Foundation, Inc. -+// -+// This file is part of the GNU ISO C++ Library. This library is free -+// software; you can redistribute it and/or modify it under the -+// terms of the GNU General Public License as published by the -+// Free Software Foundation; either version 2, or (at your option) -+// any later version. -+ -+// This library is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+ -+// You should have received a copy of the GNU General Public License along -+// with this library; see the file COPYING. If not, write to the Free -+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -+// USA. -+ -+// As a special exception, you may use this file as part of a free software -+// library without restriction. Specifically, if other files instantiate -+// templates or use macros or inline functions from this file, or you compile -+// this file and link it with other files to produce an executable, this -+// file does not by itself cause the resulting executable to be covered by -+// the GNU General Public License. This exception does not however -+// invalidate any other reasons why the executable file might be covered by -+// the GNU General Public License. -+ -+// -+// ISO C++ 14882: 22.1 Locales -+// -+ -+/** @file ctype_base.h -+ * This is an internal header file, included by other library headers. -+ * You should not attempt to use it directly. -+ */ -+ -+// Information as gleaned from /usr/include/ctype.h -+ -+ /// @brief Base class for ctype. -+ struct ctype_base -+ { -+ // Note: In uClibc, the following two types depend on configuration. -+ -+ // Non-standard typedefs. -+ typedef const __ctype_touplow_t* __to_type; -+ -+ // NB: Offsets into ctype::_M_table force a particular size -+ // on the mask type. Because of this, we don't use an enum. -+ typedef __ctype_mask_t mask; -+ static const mask upper = _ISupper; -+ static const mask lower = _ISlower; -+ static const mask alpha = _ISalpha; -+ static const mask digit = _ISdigit; -+ static const mask xdigit = _ISxdigit; -+ static const mask space = _ISspace; -+ static const mask print = _ISprint; -+ static const mask graph = _ISalpha | _ISdigit | _ISpunct; -+ static const mask cntrl = _IScntrl; -+ static const mask punct = _ISpunct; -+ static const mask alnum = _ISalpha | _ISdigit; -+ }; ---- gcc-4.1.2.orig/libstdc++-v3/config/os/uclibc/ctype_inline.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/config/os/uclibc/ctype_inline.h 2007-03-04 23:31:57.000000000 +0100 -@@ -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:: -+ is(mask __m, char __c) const -+ { return _M_table[static_cast(__c)] & __m; } -+ -+ const char* -+ ctype:: -+ is(const char* __low, const char* __high, mask* __vec) const -+ { -+ while (__low < __high) -+ *__vec++ = _M_table[static_cast(*__low++)]; -+ return __high; -+ } -+ -+ const char* -+ ctype:: -+ scan_is(mask __m, const char* __low, const char* __high) const -+ { -+ while (__low < __high -+ && !(_M_table[static_cast(*__low)] & __m)) -+ ++__low; -+ return __low; -+ } -+ -+ const char* -+ ctype:: -+ scan_not(mask __m, const char* __low, const char* __high) const -+ { -+ while (__low < __high -+ && (_M_table[static_cast(*__low)] & __m) != 0) -+ ++__low; -+ return __low; -+ } ---- gcc-4.1.2.orig/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2007-03-04 23:31:57.000000000 +0100 -@@ -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::classic_table() throw() -+ { return __C_ctype_b; } -+ -+ ctype::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::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::do_toupper(char __c) const -+ { return _M_toupper[static_cast(__c)]; } -+ -+ const char* -+ ctype::do_toupper(char* __low, const char* __high) const -+ { -+ while (__low < __high) -+ { -+ *__low = _M_toupper[static_cast(*__low)]; -+ ++__low; -+ } -+ return __high; -+ } -+ -+ char -+ ctype::do_tolower(char __c) const -+ { return _M_tolower[static_cast(__c)]; } -+ -+ const char* -+ ctype::do_tolower(char* __low, const char* __high) const -+ { -+ while (__low < __high) -+ { -+ *__low = _M_tolower[static_cast(*__low)]; -+ ++__low; -+ } -+ return __high; -+ } ---- gcc-4.1.2.orig/libstdc++-v3/config/os/uclibc/os_defines.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/config/os/uclibc/os_defines.h 2007-03-04 23:31:57.000000000 +0100 -@@ -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 -+ -+// We must not see the optimized string functions GNU libc defines. -+#define __NO_STRING_INLINES -+ -+#endif ---- gcc-4.1.2.orig/libstdc++-v3/configure 2007-01-29 11:51:01.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/configure 2007-03-04 23:31:57.000000000 +0100 -@@ -4005,6 +4005,11 @@ - lt_cv_deplibs_check_method=pass_all - ;; - -+linux-uclibc*) -+ lt_cv_deplibs_check_method=pass_all -+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` -+ ;; -+ - netbsd* | knetbsd*-gnu) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' -@@ -5740,7 +5745,7 @@ - enableval="$enable_clocale" - - case "$enableval" in -- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;; -+ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;; - *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5 - echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;} - { (exit 1); exit 1; }; } ;; -@@ -5765,6 +5770,9 @@ - # Default to "generic". - if test $enable_clocale_flag = auto; then - case ${target_os} in -+ linux-uclibc*) -+ enable_clocale_flag=uclibc -+ ;; - linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) - cat >conftest.$ac_ext <<_ACEOF - /* confdefs.h. */ -@@ -5995,6 +6003,76 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ echo "$as_me:$LINENO: result: uclibc" >&5 -+echo "${ECHO_T}uclibc" >&6 -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ # Extract the first word of "msgfmt", so it can be a program name with args. -+set dummy msgfmt; ac_word=$2 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_check_msgfmt+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$check_msgfmt"; then -+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. -+else -+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -+for as_dir in $PATH -+do -+ IFS=$as_save_IFS -+ test -z "$as_dir" && as_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_check_msgfmt="yes" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done -+ -+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" -+fi -+fi -+check_msgfmt=$ac_cv_prog_check_msgfmt -+if test -n "$check_msgfmt"; then -+ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 -+echo "${ECHO_T}$check_msgfmt" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ -+ -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the ---- gcc-4.1.2.orig/libstdc++-v3/configure.host 2007-01-28 21:12:40.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/configure.host 2007-03-04 23:31:57.000000000 +0100 -@@ -270,6 +270,12 @@ - ;; - esac - -+# Override for uClibc since linux-uclibc gets mishandled above. -+case "${host_os}" in -+ *-uclibc*) -+ os_include_dir="os/uclibc" -+ ;; -+esac - - # Set any OS-dependent and CPU-dependent bits. - # THIS TABLE IS SORTED. KEEP IT THAT WAY. ---- gcc-4.1.2.orig/libstdc++-v3/crossconfig.m4 2006-12-12 15:18:36.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/crossconfig.m4 2007-03-04 23:31:57.000000000 +0100 -@@ -143,6 +143,99 @@ - ;; - esac - ;; -+ *-uclibc*) -+# Temporary hack until we implement the float versions of the libm funcs -+ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ -+ machine/endian.h machine/param.h sys/machine.h sys/types.h \ -+ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h]) -+ SECTION_FLAGS='-ffunction-sections -fdata-sections' -+ AC_SUBST(SECTION_FLAGS) -+ GLIBCXX_CHECK_LINKER_FEATURES -+ GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT -+ GLIBCXX_CHECK_WCHAR_T_SUPPORT -+ -+ # For LFS. -+ AC_DEFINE(HAVE_INT64_T) -+ case "$target" in -+ *-uclinux*) -+ # Don't enable LFS with uClinux -+ ;; -+ *) -+ AC_DEFINE(_GLIBCXX_USE_LFS) -+ esac -+ -+ # For showmanyc_helper(). -+ AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) -+ GLIBCXX_CHECK_POLL -+ GLIBCXX_CHECK_S_ISREG_OR_S_IFREG -+ -+ # For xsputn_2(). -+ AC_CHECK_HEADERS(sys/uio.h) -+ GLIBCXX_CHECK_WRITEV -+ -+# AC_DEFINE(HAVE_ACOSF) -+# AC_DEFINE(HAVE_ASINF) -+# AC_DEFINE(HAVE_ATANF) -+# AC_DEFINE(HAVE_ATAN2F) -+ AC_DEFINE(HAVE_CEILF) -+ AC_DEFINE(HAVE_COPYSIGN) -+# AC_DEFINE(HAVE_COPYSIGNF) -+# AC_DEFINE(HAVE_COSF) -+# AC_DEFINE(HAVE_COSHF) -+# AC_DEFINE(HAVE_EXPF) -+# AC_DEFINE(HAVE_FABSF) -+ AC_DEFINE(HAVE_FINITE) -+ AC_DEFINE(HAVE_FINITEF) -+ AC_DEFINE(HAVE_FLOORF) -+# AC_DEFINE(HAVE_FMODF) -+# AC_DEFINE(HAVE_FREXPF) -+ AC_DEFINE(HAVE_HYPOT) -+# AC_DEFINE(HAVE_HYPOTF) -+ AC_DEFINE(HAVE_ISINF) -+ AC_DEFINE(HAVE_ISINFF) -+ AC_DEFINE(HAVE_ISNAN) -+ AC_DEFINE(HAVE_ISNANF) -+# AC_DEFINE(HAVE_LOGF) -+# AC_DEFINE(HAVE_LOG10F) -+# AC_DEFINE(HAVE_MODFF) -+# AC_DEFINE(HAVE_SINF) -+# AC_DEFINE(HAVE_SINHF) -+# AC_DEFINE(HAVE_SINCOS) -+# AC_DEFINE(HAVE_SINCOSF) -+ AC_DEFINE(HAVE_SQRTF) -+# AC_DEFINE(HAVE_TANF) -+# AC_DEFINE(HAVE_TANHF) -+ if test x"long_double_math_on_this_cpu" = x"yes"; then -+ AC_MSG_ERROR([long_double_math_on_this_cpu is yes!]) -+# AC_DEFINE(HAVE_ACOSL) -+# AC_DEFINE(HAVE_ASINL) -+# AC_DEFINE(HAVE_ATANL) -+# AC_DEFINE(HAVE_ATAN2L) -+# AC_DEFINE(HAVE_CEILL) -+# AC_DEFINE(HAVE_COPYSIGNL) -+# AC_DEFINE(HAVE_COSL) -+# AC_DEFINE(HAVE_COSHL) -+# AC_DEFINE(HAVE_EXPL) -+# AC_DEFINE(HAVE_FABSL) -+# AC_DEFINE(HAVE_FINITEL) -+# AC_DEFINE(HAVE_FLOORL) -+# AC_DEFINE(HAVE_FMODL) -+# AC_DEFINE(HAVE_FREXPL) -+# AC_DEFINE(HAVE_HYPOTL) -+# AC_DEFINE(HAVE_ISINFL) -+# AC_DEFINE(HAVE_ISNANL) -+# AC_DEFINE(HAVE_LOGL) -+# AC_DEFINE(HAVE_LOG10L) -+# AC_DEFINE(HAVE_MODFL) -+# AC_DEFINE(HAVE_POWL) -+# AC_DEFINE(HAVE_SINL) -+# AC_DEFINE(HAVE_SINHL) -+# AC_DEFINE(HAVE_SINCOSL) -+# AC_DEFINE(HAVE_SQRTL) -+# AC_DEFINE(HAVE_TANL) -+# AC_DEFINE(HAVE_TANHL) -+ fi -+ ;; - *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu) - AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ - machine/endian.h machine/param.h sys/machine.h sys/types.h \ -@@ -157,7 +250,7 @@ - AC_DEFINE(HAVE_INT64_T) - case "$target" in - *-uclinux*) -- # Don't enable LFS with uClibc -+ # Don't enable LFS with uClinux - ;; - *) - AC_DEFINE(_GLIBCXX_USE_LFS) ---- gcc-4.1.2.orig/libstdc++-v3/include/c_compatibility/wchar.h 2005-08-17 04:28:44.000000000 +0200 -+++ gcc-4.1.2/libstdc++-v3/include/c_compatibility/wchar.h 2007-03-04 23:31:57.000000000 +0100 -@@ -101,7 +101,9 @@ - using std::wmemcpy; - using std::wmemmove; - using std::wmemset; -+#if _GLIBCXX_HAVE_WCSFTIME - using std::wcsftime; -+#endif - - #if _GLIBCXX_USE_C99 - using std::wcstold; ---- gcc-4.1.2.orig/libstdc++-v3/include/c_std/std_cwchar.h 2005-10-30 23:21:50.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/include/c_std/std_cwchar.h 2007-03-04 23:31:57.000000000 +0100 -@@ -180,7 +180,9 @@ - using ::wcscoll; - using ::wcscpy; - using ::wcscspn; -+#if _GLIBCXX_HAVE_WCSFTIME - using ::wcsftime; -+#endif - using ::wcslen; - using ::wcsncat; - using ::wcsncmp; diff --git a/patches/gcc/4.1.2/210-softfloat-fix.patch b/patches/gcc/4.1.2/210-softfloat-fix.patch new file mode 100644 index 0000000..844c9a0 --- /dev/null +++ b/patches/gcc/4.1.2/210-softfloat-fix.patch @@ -0,0 +1,58 @@ +This patch (C) 2007 Yann E. MORIN +Licensed under GPL v2. + +First hunk of this patch solves compiling uClibc-0.9.28{,.1} : + +make[1]: Entering directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' + LD libuClibc-0.9.29.so +libc/libc_so.a(difftime.os): In function `difftime': +difftime.c:(.text+0x8): undefined reference to `__floatsidf' +difftime.c:(.text+0x2c): undefined reference to `__subdf3' +libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr': +_fpmaxtostr.c:(.text+0xd4): undefined reference to `__nedf2' +_fpmaxtostr.c:(.text+0xf8): undefined reference to `__eqdf2' +_fpmaxtostr.c:(.text+0x114): undefined reference to `__divdf3' +_fpmaxtostr.c:(.text+0x120): undefined reference to `__ltdf2' +_fpmaxtostr.c:(.text+0x1c4): undefined reference to `__muldf3' +_fpmaxtostr.c:(.text+0x388): undefined reference to `__gedf2' +_fpmaxtostr.c:(.text+0x430): undefined reference to `__adddf3' +libc/libc_so.a(__psfs_do_numeric.os): In function `__psfs_do_numeric': +__psfs_do_numeric.c:(.text+0x520): undefined reference to `__truncdfsf2' +libc/libc_so.a(strtof.os): In function `strtof': +strtof.c:(.text+0x1c): undefined reference to `__extendsfdf2' +/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/cc_core_prefix/lib/gcc/arm-linux-uclibc/4.1.1/libgcc.a(_fixunsdfsi.o): +In function `__fixunsdfsi': +libgcc2.c:(.text+0x34): undefined reference to `__fixdfsi' +make[2]: *** [lib/libc.so] Error 1 +make[1]: *** [lib/libc.so.0] Error 2 +make[1]: Leaving directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' +make: *** [/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc/lib/libc.a] +Error 2 + +The second hunk fixes building final gcc because soft-float implies using -lfloat (which we don't have). + + +diff -dur gcc-4.1.1.no-softfloat-fix/gcc/config.gcc gcc-4.1.1/gcc/config.gcc +--- gcc-4.1.1.no-softfloat-fix/gcc/config.gcc 2007-02-01 21:57:17.000000000 +0100 ++++ gcc-4.1.1/gcc/config.gcc 2007-02-01 22:11:06.000000000 +0100 +@@ -690,7 +690,7 @@ + default_use_cxa_atexit=yes + ;; + *) +- tmake_file="$tmake_file arm/t-linux" ++ tmake_file="$tmake_file arm/t-linux arm/t-arm-elf" + ;; + esac + tm_file="$tm_file arm/aout.h arm/arm.h" +diff -dur gcc-4.1.1.-lfloat/gcc/config/arm/linux-elf.h gcc-4.1.1/gcc/config/arm/linux-elf.h +--- gcc-4.1.1.-lfloat/gcc/config/arm/linux-elf.h 2007-02-01 21:57:17.000000000 +0100 ++++ gcc-4.1.1/gcc/config/arm/linux-elf.h 2007-02-01 23:00:42.000000000 +0100 +@@ -63,7 +63,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + #ifdef USE_UCLIBC + #define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0" diff --git a/patches/gcc/4.1.2/300-libstdc++-pic.patch b/patches/gcc/4.1.2/300-libstdc++-pic.patch deleted file mode 100644 index 82be8a6..0000000 --- a/patches/gcc/4.1.2/300-libstdc++-pic.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- gcc-4.1.2.orig/libstdc++-v3/src/Makefile.am 2006-01-10 05:01:00.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/src/Makefile.am 2007-03-04 23:32:40.000000000 +0100 -@@ -234,6 +234,12 @@ - $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ - - -+install-exec-local: -+ifeq ($(enable_shared),yes) -+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) -+endif -+ - # Added bits to build debug library. - if GLIBCXX_BUILD_DEBUG - all-local: build_debug ---- gcc-4.1.2.orig/libstdc++-v3/src/Makefile.in 2006-01-10 18:14:00.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/src/Makefile.in 2007-03-04 23:32:40.000000000 +0100 -@@ -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 \ -@@ -760,6 +761,13 @@ - install_debug: - (cd ${debugdir} && $(MAKE) \ - toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) -+ -+install-exec-local: -+ifeq ($(enable_shared),yes) -+ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) -+endif -+ - # Tell versions [3.59,3.63) of GNU make to not export all variables. - # Otherwise a system limit (for SysV at least) may be exceeded. - .NOEXPORT: diff --git a/patches/gcc/4.1.2/301-missing-execinfo_h.patch b/patches/gcc/4.1.2/301-missing-execinfo_h.patch deleted file mode 100644 index a1bfddb..0000000 --- a/patches/gcc/4.1.2/301-missing-execinfo_h.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- gcc-4.1.2.orig/boehm-gc/include/gc.h 2005-01-02 04:35:57.000000000 +0100 -+++ gcc-4.1.2/boehm-gc/include/gc.h 2007-03-04 23:33:07.000000000 +0100 -@@ -500,7 +500,7 @@ - #ifdef __linux__ - # include - # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ -- && !defined(__ia64__) -+ && !defined(__ia64__) && !defined(__UCLIBC__) - # ifndef GC_HAVE_BUILTIN_BACKTRACE - # define GC_HAVE_BUILTIN_BACKTRACE - # endif diff --git a/patches/gcc/4.1.2/302-c99-snprintf.patch b/patches/gcc/4.1.2/302-c99-snprintf.patch deleted file mode 100644 index 775cd18..0000000 --- a/patches/gcc/4.1.2/302-c99-snprintf.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- gcc-4.1.2.orig/libstdc++-v3/include/c_std/std_cstdio.h 2005-10-30 23:21:50.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/include/c_std/std_cstdio.h 2007-03-04 23:33:27.000000000 +0100 -@@ -143,7 +143,7 @@ - using ::vsprintf; - } - --#if _GLIBCXX_USE_C99 -+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) - - #undef snprintf - #undef vfscanf diff --git a/patches/gcc/4.1.2/303-c99-complex-ugly-hack.patch b/patches/gcc/4.1.2/303-c99-complex-ugly-hack.patch deleted file mode 100644 index 209c457..0000000 --- a/patches/gcc/4.1.2/303-c99-complex-ugly-hack.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- gcc-4.1.2.orig/libstdc++-v3/configure 2007-03-04 23:32:31.000000000 +0100 -+++ gcc-4.1.2/libstdc++-v3/configure 2007-03-04 23:33:54.000000000 +0100 -@@ -7324,6 +7324,9 @@ - cat >>conftest.$ac_ext <<_ACEOF - /* end confdefs.h. */ - #include -+#ifdef __UCLIBC__ -+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs -+#endif - int - main () - { diff --git a/patches/gcc/4.1.2/304-index_macro.patch b/patches/gcc/4.1.2/304-index_macro.patch deleted file mode 100644 index a990b07..0000000 --- a/patches/gcc/4.1.2/304-index_macro.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- gcc-4.1.2.orig/libstdc++-v3/include/ext/rope 2005-08-17 04:28:44.000000000 +0200 -+++ gcc-4.1.2/libstdc++-v3/include/ext/rope 2007-03-04 23:34:08.000000000 +0100 -@@ -57,6 +57,9 @@ - #include - #include - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - # ifdef __GC - # define __GC_CONST const - # else ---- gcc-4.1.2.orig/libstdc++-v3/include/ext/ropeimpl.h 2005-08-17 04:28:44.000000000 +0200 -+++ gcc-4.1.2/libstdc++-v3/include/ext/ropeimpl.h 2007-03-04 23:34:08.000000000 +0100 -@@ -53,6 +53,9 @@ - #include // For uninitialized_copy_n - #include // For power - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - namespace __gnu_cxx - { - using std::size_t; diff --git a/patches/gcc/4.1.2/402-libbackend_dep_gcov-iov.h.patch b/patches/gcc/4.1.2/402-libbackend_dep_gcov-iov.h.patch deleted file mode 100644 index 714449b..0000000 --- a/patches/gcc/4.1.2/402-libbackend_dep_gcov-iov.h.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- gcc-4.1.2.orig/gcc/Makefile.in 2006-11-01 15:40:44.000000000 +0100 -+++ gcc-4.1.2/gcc/Makefile.in 2007-03-04 23:34:32.000000000 +0100 -@@ -2522,7 +2522,7 @@ - # FIXME: writing proper dependencies for this is a *LOT* of work. - libbackend.o : $(OBJS-common:.o=.c) $(out_file) \ - insn-config.h insn-flags.h insn-codes.h insn-constants.h \ -- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) -+ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ - -DTARGET_NAME=\"$(target_noncanonical)\" \ - -DLOCALEDIR=\"$(localedir)\" \ diff --git a/patches/gcc/4.1.2/740-sh-pr24836.patch b/patches/gcc/4.1.2/740-sh-pr24836.patch deleted file mode 100644 index 39328a5..0000000 --- a/patches/gcc/4.1.2/740-sh-pr24836.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- gcc-4.1.2.orig/gcc/configure.ac 2006-11-13 23:09:55.000000000 +0100 -+++ gcc-4.1.2/gcc/configure.ac 2007-03-04 23:34:53.000000000 +0100 -@@ -2435,7 +2435,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-4.1.2.orig/gcc/configure 2006-11-13 23:09:55.000000000 +0100 -+++ gcc-4.1.2/gcc/configure 2007-03-04 23:34:53.000000000 +0100 -@@ -14762,7 +14762,7 @@ - tls_first_minor=14 - tls_as_opt="-m64 -Aesame --fatal-warnings" - ;; -- sh-*-* | sh[34]-*-*) -+ sh-*-* | sh[34]*-*-*) - conftest_s=' - .section ".tdata","awT",@progbits - foo: .long 25 diff --git a/patches/gcc/4.1.2/800-arm-bigendian.patch b/patches/gcc/4.1.2/800-arm-bigendian.patch deleted file mode 100644 index 57b83eb..0000000 --- a/patches/gcc/4.1.2/800-arm-bigendian.patch +++ /dev/null @@ -1,114 +0,0 @@ ---- gcc-4.1.2.orig/gcc/config/arm/linux-elf.h 2007-03-04 23:25:37.000000000 +0100 -+++ gcc-4.1.2/gcc/config/arm/linux-elf.h 2007-03-04 23:35:09.000000000 +0100 -@@ -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 -@@ -65,7 +79,7 @@ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker " LINUX_TARGET_INTERPRETER "} \ - -X \ -- %{mbig-endian:-EB}" \ -+ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ - SUBTARGET_EXTRA_LINK_SPEC - - #undef LINK_SPEC ---- gcc-4.1.2.orig/gcc/config.gcc 2007-03-04 23:31:48.000000000 +0100 -+++ gcc-4.1.2/gcc/config.gcc 2007-03-04 23:35:09.000000000 +0100 -@@ -672,6 +672,11 @@ - ;; - arm*-*-linux*) # ARM GNU/Linux with ELF - tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" -+ case $target in -+ arm*b-*) -+ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" -+ ;; -+ esac - tmake_file="${tmake_file} t-linux arm/t-arm" - case ${target} in - arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi) ---- gcc-4.1.2.orig/gcc/config/arm/linux-eabi.h 2007-03-04 23:31:48.000000000 +0100 -+++ gcc-4.1.2/gcc/config/arm/linux-eabi.h 2007-03-04 23:35:09.000000000 +0100 -@@ -20,6 +20,17 @@ - the Free Software Foundation, 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -+/* -+ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* -+ * (big endian) configurations. -+ */ -+#undef TARGET_LINKER_EMULATION -+#if TARGET_BIG_ENDIAN_DEFAULT -+#define TARGET_LINKER_EMULATION "armelfb_linux_eabi" -+#else -+#define TARGET_LINKER_EMULATION "armelf_linux_eabi" -+#endif -+ - /* On EABI GNU/Linux, we want both the BPABI builtins and the - GNU/Linux builtins. */ - #undef TARGET_OS_CPP_BUILTINS -@@ -48,7 +59,7 @@ - #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi - - #undef SUBTARGET_EXTRA_LINK_SPEC --#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi" -+#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION - - /* Use ld-linux.so.3 so that it will be possible to run "classic" - GNU/Linux binaries on an EABI system. */ ---- gcc-4.1.2.orig/gcc/config/arm/bpabi.h 2005-12-13 02:35:37.000000000 +0100 -+++ gcc-4.1.2/gcc/config/arm/bpabi.h 2007-03-04 23:35:09.000000000 +0100 -@@ -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/patches/gcc/4.1.2/801-softfloat-fix.patch b/patches/gcc/4.1.2/801-softfloat-fix.patch deleted file mode 100644 index 844c9a0..0000000 --- a/patches/gcc/4.1.2/801-softfloat-fix.patch +++ /dev/null @@ -1,58 +0,0 @@ -This patch (C) 2007 Yann E. MORIN -Licensed under GPL v2. - -First hunk of this patch solves compiling uClibc-0.9.28{,.1} : - -make[1]: Entering directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' - LD libuClibc-0.9.29.so -libc/libc_so.a(difftime.os): In function `difftime': -difftime.c:(.text+0x8): undefined reference to `__floatsidf' -difftime.c:(.text+0x2c): undefined reference to `__subdf3' -libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr': -_fpmaxtostr.c:(.text+0xd4): undefined reference to `__nedf2' -_fpmaxtostr.c:(.text+0xf8): undefined reference to `__eqdf2' -_fpmaxtostr.c:(.text+0x114): undefined reference to `__divdf3' -_fpmaxtostr.c:(.text+0x120): undefined reference to `__ltdf2' -_fpmaxtostr.c:(.text+0x1c4): undefined reference to `__muldf3' -_fpmaxtostr.c:(.text+0x388): undefined reference to `__gedf2' -_fpmaxtostr.c:(.text+0x430): undefined reference to `__adddf3' -libc/libc_so.a(__psfs_do_numeric.os): In function `__psfs_do_numeric': -__psfs_do_numeric.c:(.text+0x520): undefined reference to `__truncdfsf2' -libc/libc_so.a(strtof.os): In function `strtof': -strtof.c:(.text+0x1c): undefined reference to `__extendsfdf2' -/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/cc_core_prefix/lib/gcc/arm-linux-uclibc/4.1.1/libgcc.a(_fixunsdfsi.o): -In function `__fixunsdfsi': -libgcc2.c:(.text+0x34): undefined reference to `__fixdfsi' -make[2]: *** [lib/libc.so] Error 1 -make[1]: *** [lib/libc.so.0] Error 2 -make[1]: Leaving directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' -make: *** [/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc/lib/libc.a] -Error 2 - -The second hunk fixes building final gcc because soft-float implies using -lfloat (which we don't have). - - -diff -dur gcc-4.1.1.no-softfloat-fix/gcc/config.gcc gcc-4.1.1/gcc/config.gcc ---- gcc-4.1.1.no-softfloat-fix/gcc/config.gcc 2007-02-01 21:57:17.000000000 +0100 -+++ gcc-4.1.1/gcc/config.gcc 2007-02-01 22:11:06.000000000 +0100 -@@ -690,7 +690,7 @@ - default_use_cxa_atexit=yes - ;; - *) -- tmake_file="$tmake_file arm/t-linux" -+ tmake_file="$tmake_file arm/t-linux arm/t-arm-elf" - ;; - esac - tm_file="$tm_file arm/aout.h arm/arm.h" -diff -dur gcc-4.1.1.-lfloat/gcc/config/arm/linux-elf.h gcc-4.1.1/gcc/config/arm/linux-elf.h ---- gcc-4.1.1.-lfloat/gcc/config/arm/linux-elf.h 2007-02-01 21:57:17.000000000 +0100 -+++ gcc-4.1.1/gcc/config/arm/linux-elf.h 2007-02-01 23:00:42.000000000 +0100 -@@ -63,7 +63,7 @@ - %{shared:-lc} \ - %{!shared:%{profile:-lc_p}%{!profile:-lc}}" - --#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" -+#define LIBGCC_SPEC "-lgcc" - - #ifdef USE_UCLIBC - #define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0" diff --git a/patches/gcc/4.2.0/103-uclibc-conf-noupstream.patch b/patches/gcc/4.2.0/103-uclibc-conf-noupstream.patch deleted file mode 100644 index 09c9bbe..0000000 --- a/patches/gcc/4.2.0/103-uclibc-conf-noupstream.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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/patches/gcc/4.2.0/110-uclibc-conf-noupstream.patch b/patches/gcc/4.2.0/110-uclibc-conf-noupstream.patch new file mode 100644 index 0000000..09c9bbe --- /dev/null +++ b/patches/gcc/4.2.0/110-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/patches/gcc/4.2.0/120-uclibc-locale.patch b/patches/gcc/4.2.0/120-uclibc-locale.patch new file mode 100644 index 0000000..c933d1c --- /dev/null +++ b/patches/gcc/4.2.0/120-uclibc-locale.patch @@ -0,0 +1,2790 @@ +--- gcc/libstdc++-v3/acinclude.m4 ++++ gcc/libstdc++-v3/acinclude.m4 +@@ -1369,7 +1369,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 +@@ -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 +@@ -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 ++ ++#include ++#include ++ ++#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 ++ ++#include // For errno ++#include ++#include ++#include ++#include ++ ++#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 ++ ++#ifndef _C_LOCALE_H ++#define _C_LOCALE_H 1 ++ ++#pragma GCC system_header ++ ++#include // get std::strlen ++#include // get std::snprintf or std::sprintf ++#include ++#include // For codecvt ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC_HAS_LOCALE__ ++#include // For codecvt using iconv, iconv_t ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#include // 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 ++ 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 ++ ++#include ++#include ++ ++namespace std ++{ ++ // Specializations. ++#ifdef _GLIBCXX_USE_WCHAR_T ++ codecvt_base::result ++ codecvt:: ++ 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(-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(__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:: ++ 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(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(-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(-1) ++ || __conv == static_cast(-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:: ++ 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:: ++ 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:: ++ 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(__builtin_alloca(sizeof(wchar_t) ++ * __max)); ++ while (__from < __end && __max) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast(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(-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(-1) ++ || __conv == static_cast(-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 ++ ++#include ++#include ++ ++#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::_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::_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::_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::_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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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 specializations are in src/locale.cc and ++ // various /config/os/* files. ++ template<> ++ ctype_byname::ctype_byname(const char* __s, size_t __refs) ++ : ctype(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::__wmask_type ++ ctype::_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::do_toupper(wchar_t __c) const ++ { return __towupper_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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::do_tolower(wchar_t __c) const ++ { return __towlower_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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:: ++ 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:: ++ 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:: ++ 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:: ++ 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:: ++ do_widen(char __c) const ++ { return _M_widen[static_cast(__c)]; } ++ ++ const char* ++ ctype:: ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const ++ { ++ while (__lo < __hi) ++ { ++ *__dest = _M_widen[static_cast(*__lo)]; ++ ++__lo; ++ ++__dest; ++ } ++ return __hi; ++ } ++ ++ char ++ ctype:: ++ 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(__c)); ++ } ++ ++ const wchar_t* ++ ctype:: ++ 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(__c)); ++ } ++ ++__lo; ++ ++__dest; ++ } ++ else ++ while (__lo < __hi) ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast(__c)); ++ ++__lo; ++ ++__dest; ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __hi; ++ } ++ ++ void ++ ctype::_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(__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(_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 ++ ++#include ++#include ++ ++#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::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(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::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 ++ ++#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 ++ messages<_CharT>::messages(size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), ++ _M_name_messages(_S_get_c_name()) ++ { } ++ ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::open(const basic_string& __s, const locale& __loc, ++ const char* __dir) const ++ { ++ __bindtextdomain(__s.c_str(), __dir); ++ return this->do_open(__s, __loc); ++ } ++ ++ // Virtual member functions. ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::do_open(const basic_string& __s, ++ const locale&) const ++ { ++ // No error checking is done, assume the catalog exists and can ++ // be used. ++ __textdomain(__s.c_str()); ++ return 0; ++ } ++ ++ template ++ void ++ messages<_CharT>::do_close(catalog) const ++ { } ++ ++ // messages_byname ++ template ++ 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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::~moneypunct() ++ { delete _M_data; } ++ ++ template<> ++ moneypunct::~moneypunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ moneypunct::_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; ++ ++ 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(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::_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; ++ ++ 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(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::~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::~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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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::~numpunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ numpunct::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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(__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(__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::~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 ++ ++#include ++#include ++ ++#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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++ 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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++#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 ++ ++ template ++ __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 ++ __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 ++ __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 ++ __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/patches/gcc/4.2.0/130-uclibc-locale-no__x.patch b/patches/gcc/4.2.0/130-uclibc-locale-no__x.patch new file mode 100644 index 0000000..6ba4700 --- /dev/null +++ b/patches/gcc/4.2.0/130-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 + #include + +-#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 + #include + +-#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 + +-#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 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& __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/patches/gcc/4.2.0/140-uclibc-locale-wchar_fix.patch b/patches/gcc/4.2.0/140-uclibc-locale-wchar_fix.patch new file mode 100644 index 0000000..160ab35 --- /dev/null +++ b/patches/gcc/4.2.0/140-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/patches/gcc/4.2.0/150-uclibc-locale-update.patch b/patches/gcc/4.2.0/150-uclibc-locale-update.patch new file mode 100644 index 0000000..86b2844 --- /dev/null +++ b/patches/gcc/4.2.0/150-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 + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + namespace std +@@ -138,20 +143,34 @@ + ctype:: + 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:: + 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 + 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 + 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 +--- 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 + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + #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 + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + #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 + __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 + __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 + __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 +--- 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 // get std::strlen +-#include // get std::snprintf or std::sprintf ++#include // get std::vsnprintf or std::vsprintf + #include + #include // For codecvt + #ifdef __UCLIBC_MJN3_ONLY__ + #warning fix this + #endif +-#ifdef __UCLIBC_HAS_LOCALE__ ++#ifdef _GLIBCXX_USE_ICONV + #include // For codecvt using iconv, iconv_t + #endif +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ +-#include // For messages ++#ifdef HAVE_LIBINTL_H ++#include // For messages + #endif ++#include + + #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 +- 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/patches/gcc/4.2.0/160-libstdc++-pic.patch b/patches/gcc/4.2.0/160-libstdc++-pic.patch new file mode 100644 index 0000000..560bcb2 --- /dev/null +++ b/patches/gcc/4.2.0/160-libstdc++-pic.patch @@ -0,0 +1,50 @@ +# DP: Build and install libstdc++_pic.a library. + +--- gcc/libstdc++-v3/src/Makefile.am ++++ gcc/libstdc++-v3/src/Makefile.am +@@ -214,6 +214,12 @@ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ + + ++install-exec-local: ++ifeq ($(enable_shared),yes) ++ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++endif ++ + # Added bits to build debug library. + if GLIBCXX_BUILD_DEBUG + all-local: build_debug +--- gcc/libstdc++-v3/src/Makefile.in ++++ gcc/libstdc++-v3/src/Makefile.in +@@ -627,7 +627,7 @@ + + install-data-am: install-data-local + +-install-exec-am: install-toolexeclibLTLIBRARIES ++install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local + + install-info: install-info-am + +@@ -660,6 +660,7 @@ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-data-local install-exec \ ++ install-exec-local \ + install-exec-am install-info install-info-am install-man \ + install-strip install-toolexeclibLTLIBRARIES installcheck \ + installcheck-am installdirs maintainer-clean \ +@@ -743,6 +743,13 @@ + install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ++ ++install-exec-local: ++ifeq ($(enable_shared),yes) ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++endif ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff --git a/patches/gcc/4.2.0/170-missing-execinfo_h.patch b/patches/gcc/4.2.0/170-missing-execinfo_h.patch new file mode 100644 index 0000000..0e2092f --- /dev/null +++ b/patches/gcc/4.2.0/170-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 + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/patches/gcc/4.2.0/180-c99-snprintf.patch b/patches/gcc/4.2.0/180-c99-snprintf.patch new file mode 100644 index 0000000..d37a6b5 --- /dev/null +++ b/patches/gcc/4.2.0/180-c99-snprintf.patch @@ -0,0 +1,11 @@ +--- gcc-4.2.0.orig/libstdc++-v3/include/c_std/std_cstdio.h 2006-12-07 10:33:51.000000000 +0100 ++++ gcc-4.2.0/libstdc++-v3/include/c_std/std_cstdio.h 2007-05-20 01:05:38.000000000 +0200 +@@ -144,7 +144,7 @@ + + _GLIBCXX_END_NAMESPACE + +-#if _GLIBCXX_USE_C99 ++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf diff --git a/patches/gcc/4.2.0/190-c99-complex-ugly-hack.patch b/patches/gcc/4.2.0/190-c99-complex-ugly-hack.patch new file mode 100644 index 0000000..2ccc80d --- /dev/null +++ b/patches/gcc/4.2.0/190-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 ++#ifdef __UCLIBC__ ++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs ++#endif + int + main () + { diff --git a/patches/gcc/4.2.0/200-index_macro.patch b/patches/gcc/4.2.0/200-index_macro.patch new file mode 100644 index 0000000..d8e4765 --- /dev/null +++ b/patches/gcc/4.2.0/200-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 + #include + ++/* 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 // For uninitialized_copy_n + #include // For power + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + + using std::size_t; diff --git a/patches/gcc/4.2.0/200-uclibc-locale.patch b/patches/gcc/4.2.0/200-uclibc-locale.patch deleted file mode 100644 index c933d1c..0000000 --- a/patches/gcc/4.2.0/200-uclibc-locale.patch +++ /dev/null @@ -1,2790 +0,0 @@ ---- gcc/libstdc++-v3/acinclude.m4 -+++ gcc/libstdc++-v3/acinclude.m4 -@@ -1369,7 +1369,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 -@@ -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 -@@ -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 -+ -+#include -+#include -+ -+#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 -+ -+#include // For errno -+#include -+#include -+#include -+#include -+ -+#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 -+ -+#ifndef _C_LOCALE_H -+#define _C_LOCALE_H 1 -+ -+#pragma GCC system_header -+ -+#include // get std::strlen -+#include // get std::snprintf or std::sprintf -+#include -+#include // For codecvt -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this -+#endif -+#ifdef __UCLIBC_HAS_LOCALE__ -+#include // For codecvt using iconv, iconv_t -+#endif -+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ -+#include // 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 -+ 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 -+ -+#include -+#include -+ -+namespace std -+{ -+ // Specializations. -+#ifdef _GLIBCXX_USE_WCHAR_T -+ codecvt_base::result -+ codecvt:: -+ 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(-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(__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:: -+ 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(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(-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(-1) -+ || __conv == static_cast(-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:: -+ 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:: -+ 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:: -+ 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(__builtin_alloca(sizeof(wchar_t) -+ * __max)); -+ while (__from < __end && __max) -+ { -+ const extern_type* __from_chunk_end; -+ __from_chunk_end = static_cast(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(-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(-1) -+ || __conv == static_cast(-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 -+ -+#include -+#include -+ -+#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::_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::_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::_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::_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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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 specializations are in src/locale.cc and -+ // various /config/os/* files. -+ template<> -+ ctype_byname::ctype_byname(const char* __s, size_t __refs) -+ : ctype(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::__wmask_type -+ ctype::_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::do_toupper(wchar_t __c) const -+ { return __towupper_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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::do_tolower(wchar_t __c) const -+ { return __towlower_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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:: -+ 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:: -+ 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:: -+ 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:: -+ 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:: -+ do_widen(char __c) const -+ { return _M_widen[static_cast(__c)]; } -+ -+ const char* -+ ctype:: -+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const -+ { -+ while (__lo < __hi) -+ { -+ *__dest = _M_widen[static_cast(*__lo)]; -+ ++__lo; -+ ++__dest; -+ } -+ return __hi; -+ } -+ -+ char -+ ctype:: -+ 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(__c)); -+ } -+ -+ const wchar_t* -+ ctype:: -+ 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(__c)); -+ } -+ ++__lo; -+ ++__dest; -+ } -+ else -+ while (__lo < __hi) -+ { -+ const int __c = wctob(*__lo); -+ *__dest = (__c == EOF ? __dfault : static_cast(__c)); -+ ++__lo; -+ ++__dest; -+ } -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ return __hi; -+ } -+ -+ void -+ ctype::_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(__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(_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 -+ -+#include -+#include -+ -+#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::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(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::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 -+ -+#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 -+ messages<_CharT>::messages(size_t __refs) -+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), -+ _M_name_messages(_S_get_c_name()) -+ { } -+ -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::open(const basic_string& __s, const locale& __loc, -+ const char* __dir) const -+ { -+ __bindtextdomain(__s.c_str(), __dir); -+ return this->do_open(__s, __loc); -+ } -+ -+ // Virtual member functions. -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::do_open(const basic_string& __s, -+ const locale&) const -+ { -+ // No error checking is done, assume the catalog exists and can -+ // be used. -+ __textdomain(__s.c_str()); -+ return 0; -+ } -+ -+ template -+ void -+ messages<_CharT>::do_close(catalog) const -+ { } -+ -+ // messages_byname -+ template -+ 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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::~moneypunct() -+ { delete _M_data; } -+ -+ template<> -+ moneypunct::~moneypunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ moneypunct::_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; -+ -+ 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(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::_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; -+ -+ 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(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::~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::~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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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::~numpunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ numpunct::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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(__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(__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::~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 -+ -+#include -+#include -+ -+#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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+ 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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+#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 -+ -+ template -+ __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 -+ __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 -+ __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 -+ __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/patches/gcc/4.2.0/203-uclibc-locale-no__x.patch b/patches/gcc/4.2.0/203-uclibc-locale-no__x.patch deleted file mode 100644 index 6ba4700..0000000 --- a/patches/gcc/4.2.0/203-uclibc-locale-no__x.patch +++ /dev/null @@ -1,213 +0,0 @@ ---- 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 - #include - --#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 - #include - --#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 - --#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 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& __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/patches/gcc/4.2.0/204-uclibc-locale-wchar_fix.patch b/patches/gcc/4.2.0/204-uclibc-locale-wchar_fix.patch deleted file mode 100644 index 160ab35..0000000 --- a/patches/gcc/4.2.0/204-uclibc-locale-wchar_fix.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- 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/patches/gcc/4.2.0/205-uclibc-locale-update.patch b/patches/gcc/4.2.0/205-uclibc-locale-update.patch deleted file mode 100644 index 86b2844..0000000 --- a/patches/gcc/4.2.0/205-uclibc-locale-update.patch +++ /dev/null @@ -1,347 +0,0 @@ ---- 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 - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - namespace std -@@ -138,20 +143,34 @@ - ctype:: - 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:: - 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 - 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 - 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 ---- 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 - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - #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 - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - #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 - __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 - __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 - __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 ---- 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 // get std::strlen --#include // get std::snprintf or std::sprintf -+#include // get std::vsnprintf or std::vsprintf - #include - #include // For codecvt - #ifdef __UCLIBC_MJN3_ONLY__ - #warning fix this - #endif --#ifdef __UCLIBC_HAS_LOCALE__ -+#ifdef _GLIBCXX_USE_ICONV - #include // For codecvt using iconv, iconv_t - #endif --#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ --#include // For messages -+#ifdef HAVE_LIBINTL_H -+#include // For messages - #endif -+#include - - #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 -- 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/patches/gcc/4.2.0/210-libmudflap-susv3-legacy.patch b/patches/gcc/4.2.0/210-libmudflap-susv3-legacy.patch new file mode 100644 index 0000000..374b1f8 --- /dev/null +++ b/patches/gcc/4.2.0/210-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/patches/gcc/4.2.0/220-libstdc++-namespace.patch b/patches/gcc/4.2.0/220-libstdc++-namespace.patch new file mode 100644 index 0000000..69587ca --- /dev/null +++ b/patches/gcc/4.2.0/220-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 +- ++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 +- ++namespace std ++{ + template + __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/patches/gcc/4.2.0/230-libbackend_dep_gcov-iov.h.patch b/patches/gcc/4.2.0/230-libbackend_dep_gcov-iov.h.patch new file mode 100644 index 0000000..0bf115c --- /dev/null +++ b/patches/gcc/4.2.0/230-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/patches/gcc/4.2.0/240-arm-bigendian.patch b/patches/gcc/4.2.0/240-arm-bigendian.patch new file mode 100644 index 0000000..07c6093 --- /dev/null +++ b/patches/gcc/4.2.0/240-arm-bigendian.patch @@ -0,0 +1,67 @@ +By Lennert Buytenhek +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/patches/gcc/4.2.0/250-softfloat-fix.patch b/patches/gcc/4.2.0/250-softfloat-fix.patch new file mode 100644 index 0000000..3517856 --- /dev/null +++ b/patches/gcc/4.2.0/250-softfloat-fix.patch @@ -0,0 +1,58 @@ +This patch (C) 2007 Yann E. MORIN +Licensed under GPL v2. + +First hunk of this patch solves compiling uClibc: + +make[1]: Entering directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' + LD libuClibc-0.9.29.so +libc/libc_so.a(difftime.os): In function `difftime': +difftime.c:(.text+0x8): undefined reference to `__floatsidf' +difftime.c:(.text+0x2c): undefined reference to `__subdf3' +libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr': +_fpmaxtostr.c:(.text+0xd4): undefined reference to `__nedf2' +_fpmaxtostr.c:(.text+0xf8): undefined reference to `__eqdf2' +_fpmaxtostr.c:(.text+0x114): undefined reference to `__divdf3' +_fpmaxtostr.c:(.text+0x120): undefined reference to `__ltdf2' +_fpmaxtostr.c:(.text+0x1c4): undefined reference to `__muldf3' +_fpmaxtostr.c:(.text+0x388): undefined reference to `__gedf2' +_fpmaxtostr.c:(.text+0x430): undefined reference to `__adddf3' +libc/libc_so.a(__psfs_do_numeric.os): In function `__psfs_do_numeric': +__psfs_do_numeric.c:(.text+0x520): undefined reference to `__truncdfsf2' +libc/libc_so.a(strtof.os): In function `strtof': +strtof.c:(.text+0x1c): undefined reference to `__extendsfdf2' +/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/cc_core_prefix/lib/gcc/arm-linux-uclibc/4.1.1/libgcc.a(_fixunsdfsi.o): +In function `__fixunsdfsi': +libgcc2.c:(.text+0x34): undefined reference to `__fixdfsi' +make[2]: *** [lib/libc.so] Error 1 +make[1]: *** [lib/libc.so.0] Error 2 +make[1]: Leaving directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' +make: *** [/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc/lib/libc.a] +Error 2 + +The second hunk fixes building final gcc because soft-float implies using -lfloat (which we don't have). + + +diff -dur gcc-4.2.0.orig/gcc/config.gcc gcc-4.2.0/gcc/config.gcc +--- gcc-4.2.0.orig/gcc/config.gcc 2007-07-15 11:24:18.000000000 +0200 ++++ gcc-4.2.0/gcc/config.gcc 2007-07-15 11:26:02.000000000 +0200 +@@ -721,7 +721,7 @@ + default_use_cxa_atexit=yes + ;; + *) +- tmake_file="$tmake_file arm/t-linux" ++ tmake_file="$tmake_file arm/t-linux arm/t-arm-elf" + ;; + esac + tm_file="$tm_file arm/aout.h arm/arm.h" +diff -dur gcc-4.2.0.orig/gcc/config/arm/linux-elf.h gcc-4.2.0/gcc/config/arm/linux-elf.h +--- gcc-4.2.0.orig/gcc/config/arm/linux-elf.h 2007-07-15 11:24:18.000000000 +0200 ++++ gcc-4.2.0/gcc/config/arm/linux-elf.h 2007-07-15 11:26:02.000000000 +0200 +@@ -63,7 +63,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" + diff --git a/patches/gcc/4.2.0/260-flatten-switch-stmt-00.patch b/patches/gcc/4.2.0/260-flatten-switch-stmt-00.patch new file mode 100644 index 0000000..8fac37c --- /dev/null +++ b/patches/gcc/4.2.0/260-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/patches/gcc/4.2.0/270-soft-float.patch b/patches/gcc/4.2.0/270-soft-float.patch new file mode 100644 index 0000000..4287bfa --- /dev/null +++ b/patches/gcc/4.2.0/270-soft-float.patch @@ -0,0 +1,21 @@ +diff -uNpr gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c +--- gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c 2007-03-05 11:54:00.000000000 -0500 ++++ gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c 2008-01-31 17:51:24.000000000 -0500 +@@ -70,6 +70,8 @@ Software Foundation, 51 Franklin Street, + but GCC currently generates poor code when a union is used to turn + a long double into a pair of doubles. */ + ++#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) ++ + long double __gcc_qadd (double, double, double, double); + long double __gcc_qsub (double, double, double, double); + long double __gcc_qmul (double, double, double, double); +@@ -219,8 +221,6 @@ __gcc_qdiv (double a, double b, double c + return z.ldval; + } + +-#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) +- + long double __gcc_qneg (double, double); + int __gcc_qeq (double, double, double, double); + int __gcc_qne (double, double, double, double); diff --git a/patches/gcc/4.2.0/280-alpha-signal_h.patch b/patches/gcc/4.2.0/280-alpha-signal_h.patch new file mode 100644 index 0000000..d7e1796 --- /dev/null +++ b/patches/gcc/4.2.0/280-alpha-signal_h.patch @@ -0,0 +1,17 @@ +--- gcc-4.2.1-stock/gcc/config/alpha/linux-unwind.h 2005-06-24 20:22:41.000000000 -0500 ++++ gcc-4.2.1/gcc/config/alpha/linux-unwind.h 2007-09-01 20:21:34.000000000 -0500 +@@ -29,6 +29,9 @@ Boston, MA 02110-1301, USA. */ + /* Do code reading to identify a signal frame, and set the frame + state data appropriately. See unwind-dw2.c for the structs. */ + ++/* Don't use this if inhibit_libc is set ++ The build for this target will fail trying to include missing headers */ ++#ifndef inhibit_libc + #include + #include + +@@ -80,3 +83,4 @@ alpha_fallback_frame_state (struct _Unwi + fs->retaddr_column = 64; + return _URC_NO_REASON; + } ++#endif /* inhibit_libc */ diff --git a/patches/gcc/4.2.0/300-libstdc++-pic.patch b/patches/gcc/4.2.0/300-libstdc++-pic.patch deleted file mode 100644 index 560bcb2..0000000 --- a/patches/gcc/4.2.0/300-libstdc++-pic.patch +++ /dev/null @@ -1,50 +0,0 @@ -# DP: Build and install libstdc++_pic.a library. - ---- gcc/libstdc++-v3/src/Makefile.am -+++ gcc/libstdc++-v3/src/Makefile.am -@@ -214,6 +214,12 @@ - $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ - - -+install-exec-local: -+ifeq ($(enable_shared),yes) -+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) -+endif -+ - # Added bits to build debug library. - if GLIBCXX_BUILD_DEBUG - all-local: build_debug ---- gcc/libstdc++-v3/src/Makefile.in -+++ gcc/libstdc++-v3/src/Makefile.in -@@ -627,7 +627,7 @@ - - install-data-am: install-data-local - --install-exec-am: install-toolexeclibLTLIBRARIES -+install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local - - install-info: install-info-am - -@@ -660,6 +660,7 @@ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-data-local install-exec \ -+ install-exec-local \ - install-exec-am install-info install-info-am install-man \ - install-strip install-toolexeclibLTLIBRARIES installcheck \ - installcheck-am installdirs maintainer-clean \ -@@ -743,6 +743,13 @@ - install_debug: - (cd ${debugdir} && $(MAKE) \ - toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) -+ -+install-exec-local: -+ifeq ($(enable_shared),yes) -+ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) -+endif -+ - # Tell versions [3.59,3.63) of GNU make to not export all variables. - # Otherwise a system limit (for SysV at least) may be exceeded. - .NOEXPORT: diff --git a/patches/gcc/4.2.0/301-missing-execinfo_h.patch b/patches/gcc/4.2.0/301-missing-execinfo_h.patch deleted file mode 100644 index 0e2092f..0000000 --- a/patches/gcc/4.2.0/301-missing-execinfo_h.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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 - # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ -- && !defined(__ia64__) -+ && !defined(__ia64__) && !defined(__UCLIBC__) - # ifndef GC_HAVE_BUILTIN_BACKTRACE - # define GC_HAVE_BUILTIN_BACKTRACE - # endif diff --git a/patches/gcc/4.2.0/302-c99-snprintf.patch b/patches/gcc/4.2.0/302-c99-snprintf.patch deleted file mode 100644 index d37a6b5..0000000 --- a/patches/gcc/4.2.0/302-c99-snprintf.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- gcc-4.2.0.orig/libstdc++-v3/include/c_std/std_cstdio.h 2006-12-07 10:33:51.000000000 +0100 -+++ gcc-4.2.0/libstdc++-v3/include/c_std/std_cstdio.h 2007-05-20 01:05:38.000000000 +0200 -@@ -144,7 +144,7 @@ - - _GLIBCXX_END_NAMESPACE - --#if _GLIBCXX_USE_C99 -+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) - - #undef snprintf - #undef vfscanf diff --git a/patches/gcc/4.2.0/303-c99-complex-ugly-hack.patch b/patches/gcc/4.2.0/303-c99-complex-ugly-hack.patch deleted file mode 100644 index 2ccc80d..0000000 --- a/patches/gcc/4.2.0/303-c99-complex-ugly-hack.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- 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 -+#ifdef __UCLIBC__ -+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs -+#endif - int - main () - { diff --git a/patches/gcc/4.2.0/304-index_macro.patch b/patches/gcc/4.2.0/304-index_macro.patch deleted file mode 100644 index d8e4765..0000000 --- a/patches/gcc/4.2.0/304-index_macro.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- 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 - #include - -+/* 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 // For uninitialized_copy_n - #include // For power - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) - - using std::size_t; diff --git a/patches/gcc/4.2.0/305-libmudflap-susv3-legacy.patch b/patches/gcc/4.2.0/305-libmudflap-susv3-legacy.patch deleted file mode 100644 index 374b1f8..0000000 --- a/patches/gcc/4.2.0/305-libmudflap-susv3-legacy.patch +++ /dev/null @@ -1,49 +0,0 @@ -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/patches/gcc/4.2.0/306-libstdc++-namespace.patch b/patches/gcc/4.2.0/306-libstdc++-namespace.patch deleted file mode 100644 index 69587ca..0000000 --- a/patches/gcc/4.2.0/306-libstdc++-namespace.patch +++ /dev/null @@ -1,36 +0,0 @@ -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 -- -+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 -- -+namespace std -+{ - template - __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/patches/gcc/4.2.0/402-libbackend_dep_gcov-iov.h.patch b/patches/gcc/4.2.0/402-libbackend_dep_gcov-iov.h.patch deleted file mode 100644 index 0bf115c..0000000 --- a/patches/gcc/4.2.0/402-libbackend_dep_gcov-iov.h.patch +++ /dev/null @@ -1,13 +0,0 @@ -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/patches/gcc/4.2.0/800-arm-bigendian.patch b/patches/gcc/4.2.0/800-arm-bigendian.patch deleted file mode 100644 index 07c6093..0000000 --- a/patches/gcc/4.2.0/800-arm-bigendian.patch +++ /dev/null @@ -1,67 +0,0 @@ -By Lennert Buytenhek -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/patches/gcc/4.2.0/801-softfloat-fix.patch b/patches/gcc/4.2.0/801-softfloat-fix.patch deleted file mode 100644 index 3517856..0000000 --- a/patches/gcc/4.2.0/801-softfloat-fix.patch +++ /dev/null @@ -1,58 +0,0 @@ -This patch (C) 2007 Yann E. MORIN -Licensed under GPL v2. - -First hunk of this patch solves compiling uClibc: - -make[1]: Entering directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' - LD libuClibc-0.9.29.so -libc/libc_so.a(difftime.os): In function `difftime': -difftime.c:(.text+0x8): undefined reference to `__floatsidf' -difftime.c:(.text+0x2c): undefined reference to `__subdf3' -libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr': -_fpmaxtostr.c:(.text+0xd4): undefined reference to `__nedf2' -_fpmaxtostr.c:(.text+0xf8): undefined reference to `__eqdf2' -_fpmaxtostr.c:(.text+0x114): undefined reference to `__divdf3' -_fpmaxtostr.c:(.text+0x120): undefined reference to `__ltdf2' -_fpmaxtostr.c:(.text+0x1c4): undefined reference to `__muldf3' -_fpmaxtostr.c:(.text+0x388): undefined reference to `__gedf2' -_fpmaxtostr.c:(.text+0x430): undefined reference to `__adddf3' -libc/libc_so.a(__psfs_do_numeric.os): In function `__psfs_do_numeric': -__psfs_do_numeric.c:(.text+0x520): undefined reference to `__truncdfsf2' -libc/libc_so.a(strtof.os): In function `strtof': -strtof.c:(.text+0x1c): undefined reference to `__extendsfdf2' -/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/cc_core_prefix/lib/gcc/arm-linux-uclibc/4.1.1/libgcc.a(_fixunsdfsi.o): -In function `__fixunsdfsi': -libgcc2.c:(.text+0x34): undefined reference to `__fixdfsi' -make[2]: *** [lib/libc.so] Error 1 -make[1]: *** [lib/libc.so.0] Error 2 -make[1]: Leaving directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' -make: *** [/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc/lib/libc.a] -Error 2 - -The second hunk fixes building final gcc because soft-float implies using -lfloat (which we don't have). - - -diff -dur gcc-4.2.0.orig/gcc/config.gcc gcc-4.2.0/gcc/config.gcc ---- gcc-4.2.0.orig/gcc/config.gcc 2007-07-15 11:24:18.000000000 +0200 -+++ gcc-4.2.0/gcc/config.gcc 2007-07-15 11:26:02.000000000 +0200 -@@ -721,7 +721,7 @@ - default_use_cxa_atexit=yes - ;; - *) -- tmake_file="$tmake_file arm/t-linux" -+ tmake_file="$tmake_file arm/t-linux arm/t-arm-elf" - ;; - esac - tm_file="$tm_file arm/aout.h arm/arm.h" -diff -dur gcc-4.2.0.orig/gcc/config/arm/linux-elf.h gcc-4.2.0/gcc/config/arm/linux-elf.h ---- gcc-4.2.0.orig/gcc/config/arm/linux-elf.h 2007-07-15 11:24:18.000000000 +0200 -+++ gcc-4.2.0/gcc/config/arm/linux-elf.h 2007-07-15 11:26:02.000000000 +0200 -@@ -63,7 +63,7 @@ - %{shared:-lc} \ - %{!shared:%{profile:-lc_p}%{!profile:-lc}}" - --#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" -+#define LIBGCC_SPEC "-lgcc" - - #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" - diff --git a/patches/gcc/4.2.0/904-flatten-switch-stmt-00.patch b/patches/gcc/4.2.0/904-flatten-switch-stmt-00.patch deleted file mode 100644 index 8fac37c..0000000 --- a/patches/gcc/4.2.0/904-flatten-switch-stmt-00.patch +++ /dev/null @@ -1,153 +0,0 @@ -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/patches/gcc/4.2.0/920-soft-float.patch b/patches/gcc/4.2.0/920-soft-float.patch deleted file mode 100644 index 4287bfa..0000000 --- a/patches/gcc/4.2.0/920-soft-float.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -uNpr gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c ---- gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c 2007-03-05 11:54:00.000000000 -0500 -+++ gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c 2008-01-31 17:51:24.000000000 -0500 -@@ -70,6 +70,8 @@ Software Foundation, 51 Franklin Street, - but GCC currently generates poor code when a union is used to turn - a long double into a pair of doubles. */ - -+#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) -+ - long double __gcc_qadd (double, double, double, double); - long double __gcc_qsub (double, double, double, double); - long double __gcc_qmul (double, double, double, double); -@@ -219,8 +221,6 @@ __gcc_qdiv (double a, double b, double c - return z.ldval; - } - --#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) -- - long double __gcc_qneg (double, double); - int __gcc_qeq (double, double, double, double); - int __gcc_qne (double, double, double, double); diff --git a/patches/gcc/4.2.0/940-alpha-signal_h.patch b/patches/gcc/4.2.0/940-alpha-signal_h.patch deleted file mode 100644 index d7e1796..0000000 --- a/patches/gcc/4.2.0/940-alpha-signal_h.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- gcc-4.2.1-stock/gcc/config/alpha/linux-unwind.h 2005-06-24 20:22:41.000000000 -0500 -+++ gcc-4.2.1/gcc/config/alpha/linux-unwind.h 2007-09-01 20:21:34.000000000 -0500 -@@ -29,6 +29,9 @@ Boston, MA 02110-1301, USA. */ - /* Do code reading to identify a signal frame, and set the frame - state data appropriately. See unwind-dw2.c for the structs. */ - -+/* Don't use this if inhibit_libc is set -+ The build for this target will fail trying to include missing headers */ -+#ifndef inhibit_libc - #include - #include - -@@ -80,3 +83,4 @@ alpha_fallback_frame_state (struct _Unwi - fs->retaddr_column = 64; - return _URC_NO_REASON; - } -+#endif /* inhibit_libc */ diff --git a/patches/gcc/4.2.1/103-uclibc-conf-noupstream.patch b/patches/gcc/4.2.1/103-uclibc-conf-noupstream.patch deleted file mode 100644 index 1c239d6..0000000 --- a/patches/gcc/4.2.1/103-uclibc-conf-noupstream.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc ---- gcc-4.2.1.orig/gcc/config.gcc 2007-02-03 06:25:20.000000000 +0100 -+++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200 -@@ -1964,7 +1964,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/patches/gcc/4.2.1/110-uclibc-conf-noupstream.patch b/patches/gcc/4.2.1/110-uclibc-conf-noupstream.patch new file mode 100644 index 0000000..1c239d6 --- /dev/null +++ b/patches/gcc/4.2.1/110-uclibc-conf-noupstream.patch @@ -0,0 +1,12 @@ +diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc +--- gcc-4.2.1.orig/gcc/config.gcc 2007-02-03 06:25:20.000000000 +0100 ++++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200 +@@ -1964,7 +1964,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/patches/gcc/4.2.1/120-uclibc-locale.patch b/patches/gcc/4.2.1/120-uclibc-locale.patch new file mode 100644 index 0000000..298c505 --- /dev/null +++ b/patches/gcc/4.2.1/120-uclibc-locale.patch @@ -0,0 +1,2806 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 gcc-4.2.1/libstdc++-v3/acinclude.m4 +--- gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 2007-06-29 01:02:05.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/acinclude.m4 2007-08-03 20:30:21.000000000 +0200 +@@ -1334,7 +1334,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 +@@ -1355,6 +1355,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) + enable_clocale_flag=gnu + ;; +@@ -1526,6 +1529,40 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ AC_MSG_RESULT(uclibc) ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ AC_SUBST(glibcxx_MOFILES) ++ AC_SUBST(glibcxx_POFILES) ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include // For errno ++#include ++#include ++#include ++#include ++ ++#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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#ifndef _C_LOCALE_H ++#define _C_LOCALE_H 1 ++ ++#pragma GCC system_header ++ ++#include // get std::strlen ++#include // get std::snprintf or std::sprintf ++#include ++#include // For codecvt ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC_HAS_LOCALE__ ++#include // For codecvt using iconv, iconv_t ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#include // 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 ++ 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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++namespace std ++{ ++ // Specializations. ++#ifdef _GLIBCXX_USE_WCHAR_T ++ codecvt_base::result ++ codecvt:: ++ 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(-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(__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:: ++ 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(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(-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(-1) ++ || __conv == static_cast(-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:: ++ 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:: ++ 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:: ++ 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(__builtin_alloca(sizeof(wchar_t) ++ * __max)); ++ while (__from < __end && __max) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast(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(-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(-1) ++ || __conv == static_cast(-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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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::_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::_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::_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::_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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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 specializations are in src/locale.cc and ++ // various /config/os/* files. ++ template<> ++ ctype_byname::ctype_byname(const char* __s, size_t __refs) ++ : ctype(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::__wmask_type ++ ctype::_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::do_toupper(wchar_t __c) const ++ { return __towupper_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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::do_tolower(wchar_t __c) const ++ { return __towlower_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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:: ++ 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:: ++ 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:: ++ 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:: ++ 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:: ++ do_widen(char __c) const ++ { return _M_widen[static_cast(__c)]; } ++ ++ const char* ++ ctype:: ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const ++ { ++ while (__lo < __hi) ++ { ++ *__dest = _M_widen[static_cast(*__lo)]; ++ ++__lo; ++ ++__dest; ++ } ++ return __hi; ++ } ++ ++ char ++ ctype:: ++ 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(__c)); ++ } ++ ++ const wchar_t* ++ ctype:: ++ 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(__c)); ++ } ++ ++__lo; ++ ++__dest; ++ } ++ else ++ while (__lo < __hi) ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast(__c)); ++ ++__lo; ++ ++__dest; ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __hi; ++ } ++ ++ void ++ ctype::_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(__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(_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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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::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(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::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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#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 ++ messages<_CharT>::messages(size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), ++ _M_name_messages(_S_get_c_name()) ++ { } ++ ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::open(const basic_string& __s, const locale& __loc, ++ const char* __dir) const ++ { ++ __bindtextdomain(__s.c_str(), __dir); ++ return this->do_open(__s, __loc); ++ } ++ ++ // Virtual member functions. ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::do_open(const basic_string& __s, ++ const locale&) const ++ { ++ // No error checking is done, assume the catalog exists and can ++ // be used. ++ __textdomain(__s.c_str()); ++ return 0; ++ } ++ ++ template ++ void ++ messages<_CharT>::do_close(catalog) const ++ { } ++ ++ // messages_byname ++ template ++ 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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::~moneypunct() ++ { delete _M_data; } ++ ++ template<> ++ moneypunct::~moneypunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ moneypunct::_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; ++ ++ 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(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::_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; ++ ++ 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(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::~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::~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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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::~numpunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ numpunct::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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(__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(__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::~numpunct() ++ { delete _M_data; } ++ #endif ++} +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++ 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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++#warning wide time stuff ++// if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = L"%m/%d/%y"; ++ _M_data->_M_date_era_format = L"%m/%d/%y"; ++ _M_data->_M_time_format = L"%H:%M:%S"; ++ _M_data->_M_time_era_format = L"%H:%M:%S"; ++ _M_data->_M_date_time_format = L""; ++ _M_data->_M_date_time_era_format = L""; ++ _M_data->_M_am = L"AM"; ++ _M_data->_M_pm = L"PM"; ++ _M_data->_M_am_pm_format = L""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = L"Sunday"; ++ _M_data->_M_day2 = L"Monday"; ++ _M_data->_M_day3 = L"Tuesday"; ++ _M_data->_M_day4 = L"Wednesday"; ++ _M_data->_M_day5 = L"Thursday"; ++ _M_data->_M_day6 = L"Friday"; ++ _M_data->_M_day7 = L"Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = L"Sun"; ++ _M_data->_M_aday2 = L"Mon"; ++ _M_data->_M_aday3 = L"Tue"; ++ _M_data->_M_aday4 = L"Wed"; ++ _M_data->_M_aday5 = L"Thu"; ++ _M_data->_M_aday6 = L"Fri"; ++ _M_data->_M_aday7 = L"Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = L"January"; ++ _M_data->_M_month02 = L"February"; ++ _M_data->_M_month03 = L"March"; ++ _M_data->_M_month04 = L"April"; ++ _M_data->_M_month05 = L"May"; ++ _M_data->_M_month06 = L"June"; ++ _M_data->_M_month07 = L"July"; ++ _M_data->_M_month08 = L"August"; ++ _M_data->_M_month09 = L"September"; ++ _M_data->_M_month10 = L"October"; ++ _M_data->_M_month11 = L"November"; ++ _M_data->_M_month12 = L"December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = L"Jan"; ++ _M_data->_M_amonth02 = L"Feb"; ++ _M_data->_M_amonth03 = L"Mar"; ++ _M_data->_M_amonth04 = L"Apr"; ++ _M_data->_M_amonth05 = L"May"; ++ _M_data->_M_amonth06 = L"Jun"; ++ _M_data->_M_amonth07 = L"Jul"; ++ _M_data->_M_amonth08 = L"Aug"; ++ _M_data->_M_amonth09 = L"Sep"; ++ _M_data->_M_amonth10 = L"Oct"; ++ _M_data->_M_amonth11 = L"Nov"; ++ _M_data->_M_amonth12 = L"Dec"; ++ } ++#if 0 ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ union { char *__s; wchar_t *__w; } __u; ++ ++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); ++ _M_data->_M_date_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); ++ _M_data->_M_date_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); ++ _M_data->_M_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); ++ _M_data->_M_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); ++ _M_data->_M_date_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); ++ _M_data->_M_date_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); ++ _M_data->_M_am = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); ++ _M_data->_M_pm = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); ++ _M_data->_M_am_pm_format = __u.__w; ++ ++ // Day names, starting with "C"'s Sunday. ++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); ++ _M_data->_M_day1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); ++ _M_data->_M_day2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); ++ _M_data->_M_day3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); ++ _M_data->_M_day4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); ++ _M_data->_M_day5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); ++ _M_data->_M_day6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); ++ _M_data->_M_day7 = __u.__w; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); ++ _M_data->_M_aday1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); ++ _M_data->_M_aday2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); ++ _M_data->_M_aday3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); ++ _M_data->_M_aday4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); ++ _M_data->_M_aday5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); ++ _M_data->_M_aday6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); ++ _M_data->_M_aday7 = __u.__w; ++ ++ // Month names, starting with "C"'s January. ++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); ++ _M_data->_M_month01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); ++ _M_data->_M_month02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); ++ _M_data->_M_month03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); ++ _M_data->_M_month04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); ++ _M_data->_M_month05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); ++ _M_data->_M_month06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); ++ _M_data->_M_month07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); ++ _M_data->_M_month08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); ++ _M_data->_M_month09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); ++ _M_data->_M_month10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); ++ _M_data->_M_month11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); ++ _M_data->_M_month12 = __u.__w; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); ++ _M_data->_M_amonth01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); ++ _M_data->_M_amonth02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); ++ _M_data->_M_amonth03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); ++ _M_data->_M_amonth04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); ++ _M_data->_M_amonth05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); ++ _M_data->_M_amonth06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); ++ _M_data->_M_amonth07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); ++ _M_data->_M_amonth08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); ++ _M_data->_M_amonth09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); ++ _M_data->_M_amonth10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); ++ _M_data->_M_amonth11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); ++ _M_data->_M_amonth12 = __u.__w; ++ } ++#endif // 0 ++ } ++#endif ++} +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++ template ++ __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 ++ __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 ++ __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 ++ __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 -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure +--- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:29:22.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200 +@@ -5769,7 +5769,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; }; } ;; +@@ -5802,6 +5802,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) + enable_clocale_flag=gnu + ;; +@@ -6190,6 +6193,76 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ echo "$as_me:$LINENO: result: uclibc" >&5 ++echo "${ECHO_T}uclibc" >&6 ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ # Extract the first word of "msgfmt", so it can be a program name with args. ++set dummy msgfmt; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test -n "$check_msgfmt"; then ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_check_msgfmt="yes" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" ++fi ++fi ++check_msgfmt=$ac_cv_prog_check_msgfmt ++if test -n "$check_msgfmt"; then ++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 ++echo "${ECHO_T}$check_msgfmt" >&6 ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ ++ ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h +--- gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h 2005-08-17 04:28:44.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h +--- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h 2006-12-07 10:33:51.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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/patches/gcc/4.2.1/130-uclibc-locale-no__x.patch b/patches/gcc/4.2.1/130-uclibc-locale-no__x.patch new file mode 100644 index 0000000..d88dc22 --- /dev/null +++ b/patches/gcc/4.2.1/130-uclibc-locale-no__x.patch @@ -0,0 +1,223 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -39,20 +39,6 @@ + #include + #include + +-#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<> +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200 +@@ -68,6 +68,7 @@ + { + extern "C" __typeof(uselocale) __uselocale; + } ++#define __uselocale uselocale + #endif + + namespace std +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:53.000000000 +0200 +@@ -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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -36,13 +36,6 @@ + #include + #include + +-#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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -38,13 +38,6 @@ + #undef _LIBC + #include + +-#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 specializations are in src/locale.cc and +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -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 + +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200 +@@ -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& __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; + } + +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -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: +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -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 + { +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -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 + { diff --git a/patches/gcc/4.2.1/140-uclibc-locale-wchar_fix.patch b/patches/gcc/4.2.1/140-uclibc-locale-wchar_fix.patch new file mode 100644 index 0000000..077bb56 --- /dev/null +++ b/patches/gcc/4.2.1/140-uclibc-locale-wchar_fix.patch @@ -0,0 +1,50 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200 +@@ -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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200 +@@ -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/patches/gcc/4.2.1/150-uclibc-locale-update.patch b/patches/gcc/4.2.1/150-uclibc-locale-update.patch new file mode 100644 index 0000000..534f4e4 --- /dev/null +++ b/patches/gcc/4.2.1/150-uclibc-locale-update.patch @@ -0,0 +1,354 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:31:54.000000000 +0200 +@@ -46,16 +46,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 +60,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 +74,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 +101,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); + } + +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:31:54.000000000 +0200 +@@ -39,21 +39,23 @@ + #pragma GCC system_header + + #include // get std::strlen +-#include // get std::snprintf or std::sprintf ++#include // get std::vsnprintf or std::vsprintf + #include + #include // For codecvt + #ifdef __UCLIBC_MJN3_ONLY__ + #warning fix this + #endif +-#ifdef __UCLIBC_HAS_LOCALE__ ++#ifdef _GLIBCXX_USE_ICONV + #include // For codecvt using iconv, iconv_t + #endif +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ +-#include // For messages ++#ifdef HAVE_LIBINTL_H ++#include // For messages + #endif ++#include + + #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 +- 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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:31:54.000000000 +0200 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + namespace std +@@ -138,20 +143,34 @@ + ctype:: + 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:: + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200 +@@ -47,18 +47,21 @@ + template + 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 + 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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:54.000000000 +0200 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + #ifdef __UCLIBC_MJN3_ONLY__ +@@ -206,7 +211,7 @@ + } + break; + default: +- ; ++ __ret = pattern(); + } + return __ret; + } +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:54.000000000 +0200 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + #ifdef __UCLIBC_MJN3_ONLY__ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200 +@@ -37,25 +37,33 @@ + template + __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 + __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 + __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 diff --git a/patches/gcc/4.2.1/160-libstdc++-pic.patch b/patches/gcc/4.2.1/160-libstdc++-pic.patch new file mode 100644 index 0000000..7244d4c --- /dev/null +++ b/patches/gcc/4.2.1/160-libstdc++-pic.patch @@ -0,0 +1,50 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am gcc-4.2.1/libstdc++-v3/src/Makefile.am +--- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am 2006-07-28 06:57:34.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/src/Makefile.am 2007-08-03 20:32:27.000000000 +0200 +@@ -257,6 +257,12 @@ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ + + ++install-exec-local: ++ifeq ($(enable_shared),yes) ++ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++endif ++ + # Added bits to build debug library. + if GLIBCXX_BUILD_DEBUG + all-local: build_debug +diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in gcc-4.2.1/libstdc++-v3/src/Makefile.in +--- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in 2006-10-16 21:08:22.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/src/Makefile.in 2007-08-03 20:32:27.000000000 +0200 +@@ -657,7 +657,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 + +@@ -690,6 +690,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 \ +@@ -799,6 +800,13 @@ + install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ++ ++install-exec-local: ++ifeq ($(enable_shared),yes) ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++endif ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff --git a/patches/gcc/4.2.1/170-missing-execinfo_h.patch b/patches/gcc/4.2.1/170-missing-execinfo_h.patch new file mode 100644 index 0000000..ff67899 --- /dev/null +++ b/patches/gcc/4.2.1/170-missing-execinfo_h.patch @@ -0,0 +1,12 @@ +diff -durN gcc-4.2.1.orig/boehm-gc/include/gc.h gcc-4.2.1/boehm-gc/include/gc.h +--- gcc-4.2.1.orig/boehm-gc/include/gc.h 2006-09-18 20:45:08.000000000 +0200 ++++ gcc-4.2.1/boehm-gc/include/gc.h 2007-08-03 20:33:00.000000000 +0200 +@@ -502,7 +502,7 @@ + #if defined(__linux__) || defined(__GLIBC__) + # include + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/patches/gcc/4.2.1/180-c99-snprintf.patch b/patches/gcc/4.2.1/180-c99-snprintf.patch new file mode 100644 index 0000000..ddb0c34 --- /dev/null +++ b/patches/gcc/4.2.1/180-c99-snprintf.patch @@ -0,0 +1,12 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h +--- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h 2006-12-07 10:33:51.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h 2007-08-03 20:33:24.000000000 +0200 +@@ -144,7 +144,7 @@ + + _GLIBCXX_END_NAMESPACE + +-#if _GLIBCXX_USE_C99 ++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf diff --git a/patches/gcc/4.2.1/190-c99-complex-ugly-hack.patch b/patches/gcc/4.2.1/190-c99-complex-ugly-hack.patch new file mode 100644 index 0000000..de6d71c --- /dev/null +++ b/patches/gcc/4.2.1/190-c99-complex-ugly-hack.patch @@ -0,0 +1,13 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure +--- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:33:56.000000000 +0200 +@@ -7514,6 +7514,9 @@ + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + #include ++#ifdef __UCLIBC__ ++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs ++#endif + int + main () + { diff --git a/patches/gcc/4.2.1/200-index_macro.patch b/patches/gcc/4.2.1/200-index_macro.patch new file mode 100644 index 0000000..1e56b5d --- /dev/null +++ b/patches/gcc/4.2.1/200-index_macro.patch @@ -0,0 +1,26 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/rope gcc-4.2.1/libstdc++-v3/include/ext/rope +--- gcc-4.2.1.orig/libstdc++-v3/include/ext/rope 2006-10-17 13:56:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/include/ext/rope 2007-08-03 20:34:23.000000000 +0200 +@@ -58,6 +58,9 @@ + #include + #include + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + # ifdef __GC + # define __GC_CONST const + # else +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h +--- gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h 2006-10-17 13:56:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h 2007-08-03 20:34:23.000000000 +0200 +@@ -54,6 +54,9 @@ + #include // For uninitialized_copy_n + #include // For power + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + + using std::size_t; diff --git a/patches/gcc/4.2.1/200-uclibc-locale.patch b/patches/gcc/4.2.1/200-uclibc-locale.patch deleted file mode 100644 index 298c505..0000000 --- a/patches/gcc/4.2.1/200-uclibc-locale.patch +++ /dev/null @@ -1,2806 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 gcc-4.2.1/libstdc++-v3/acinclude.m4 ---- gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 2007-06-29 01:02:05.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/acinclude.m4 2007-08-03 20:30:21.000000000 +0200 -@@ -1334,7 +1334,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 -@@ -1355,6 +1355,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) - enable_clocale_flag=gnu - ;; -@@ -1526,6 +1529,40 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ AC_MSG_RESULT(uclibc) -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ AC_SUBST(glibcxx_MOFILES) -+ AC_SUBST(glibcxx_POFILES) -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include // For errno -+#include -+#include -+#include -+#include -+ -+#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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#ifndef _C_LOCALE_H -+#define _C_LOCALE_H 1 -+ -+#pragma GCC system_header -+ -+#include // get std::strlen -+#include // get std::snprintf or std::sprintf -+#include -+#include // For codecvt -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this -+#endif -+#ifdef __UCLIBC_HAS_LOCALE__ -+#include // For codecvt using iconv, iconv_t -+#endif -+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ -+#include // 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 -+ 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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+namespace std -+{ -+ // Specializations. -+#ifdef _GLIBCXX_USE_WCHAR_T -+ codecvt_base::result -+ codecvt:: -+ 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(-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(__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:: -+ 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(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(-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(-1) -+ || __conv == static_cast(-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:: -+ 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:: -+ 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:: -+ 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(__builtin_alloca(sizeof(wchar_t) -+ * __max)); -+ while (__from < __end && __max) -+ { -+ const extern_type* __from_chunk_end; -+ __from_chunk_end = static_cast(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(-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(-1) -+ || __conv == static_cast(-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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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::_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::_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::_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::_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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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 specializations are in src/locale.cc and -+ // various /config/os/* files. -+ template<> -+ ctype_byname::ctype_byname(const char* __s, size_t __refs) -+ : ctype(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::__wmask_type -+ ctype::_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::do_toupper(wchar_t __c) const -+ { return __towupper_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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::do_tolower(wchar_t __c) const -+ { return __towlower_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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:: -+ 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:: -+ 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:: -+ 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:: -+ 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:: -+ do_widen(char __c) const -+ { return _M_widen[static_cast(__c)]; } -+ -+ const char* -+ ctype:: -+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const -+ { -+ while (__lo < __hi) -+ { -+ *__dest = _M_widen[static_cast(*__lo)]; -+ ++__lo; -+ ++__dest; -+ } -+ return __hi; -+ } -+ -+ char -+ ctype:: -+ 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(__c)); -+ } -+ -+ const wchar_t* -+ ctype:: -+ 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(__c)); -+ } -+ ++__lo; -+ ++__dest; -+ } -+ else -+ while (__lo < __hi) -+ { -+ const int __c = wctob(*__lo); -+ *__dest = (__c == EOF ? __dfault : static_cast(__c)); -+ ++__lo; -+ ++__dest; -+ } -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ return __hi; -+ } -+ -+ void -+ ctype::_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(__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(_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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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::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(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::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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#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 -+ messages<_CharT>::messages(size_t __refs) -+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), -+ _M_name_messages(_S_get_c_name()) -+ { } -+ -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::open(const basic_string& __s, const locale& __loc, -+ const char* __dir) const -+ { -+ __bindtextdomain(__s.c_str(), __dir); -+ return this->do_open(__s, __loc); -+ } -+ -+ // Virtual member functions. -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::do_open(const basic_string& __s, -+ const locale&) const -+ { -+ // No error checking is done, assume the catalog exists and can -+ // be used. -+ __textdomain(__s.c_str()); -+ return 0; -+ } -+ -+ template -+ void -+ messages<_CharT>::do_close(catalog) const -+ { } -+ -+ // messages_byname -+ template -+ 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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::~moneypunct() -+ { delete _M_data; } -+ -+ template<> -+ moneypunct::~moneypunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ moneypunct::_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; -+ -+ 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(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::_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; -+ -+ 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(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::~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::~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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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::~numpunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ numpunct::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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(__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(__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::~numpunct() -+ { delete _M_data; } -+ #endif -+} -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+ 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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+#warning wide time stuff -+// if (!__cloc) -+ { -+ // "C" locale -+ _M_c_locale_timepunct = _S_get_c_locale(); -+ -+ _M_data->_M_date_format = L"%m/%d/%y"; -+ _M_data->_M_date_era_format = L"%m/%d/%y"; -+ _M_data->_M_time_format = L"%H:%M:%S"; -+ _M_data->_M_time_era_format = L"%H:%M:%S"; -+ _M_data->_M_date_time_format = L""; -+ _M_data->_M_date_time_era_format = L""; -+ _M_data->_M_am = L"AM"; -+ _M_data->_M_pm = L"PM"; -+ _M_data->_M_am_pm_format = L""; -+ -+ // Day names, starting with "C"'s Sunday. -+ _M_data->_M_day1 = L"Sunday"; -+ _M_data->_M_day2 = L"Monday"; -+ _M_data->_M_day3 = L"Tuesday"; -+ _M_data->_M_day4 = L"Wednesday"; -+ _M_data->_M_day5 = L"Thursday"; -+ _M_data->_M_day6 = L"Friday"; -+ _M_data->_M_day7 = L"Saturday"; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ _M_data->_M_aday1 = L"Sun"; -+ _M_data->_M_aday2 = L"Mon"; -+ _M_data->_M_aday3 = L"Tue"; -+ _M_data->_M_aday4 = L"Wed"; -+ _M_data->_M_aday5 = L"Thu"; -+ _M_data->_M_aday6 = L"Fri"; -+ _M_data->_M_aday7 = L"Sat"; -+ -+ // Month names, starting with "C"'s January. -+ _M_data->_M_month01 = L"January"; -+ _M_data->_M_month02 = L"February"; -+ _M_data->_M_month03 = L"March"; -+ _M_data->_M_month04 = L"April"; -+ _M_data->_M_month05 = L"May"; -+ _M_data->_M_month06 = L"June"; -+ _M_data->_M_month07 = L"July"; -+ _M_data->_M_month08 = L"August"; -+ _M_data->_M_month09 = L"September"; -+ _M_data->_M_month10 = L"October"; -+ _M_data->_M_month11 = L"November"; -+ _M_data->_M_month12 = L"December"; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ _M_data->_M_amonth01 = L"Jan"; -+ _M_data->_M_amonth02 = L"Feb"; -+ _M_data->_M_amonth03 = L"Mar"; -+ _M_data->_M_amonth04 = L"Apr"; -+ _M_data->_M_amonth05 = L"May"; -+ _M_data->_M_amonth06 = L"Jun"; -+ _M_data->_M_amonth07 = L"Jul"; -+ _M_data->_M_amonth08 = L"Aug"; -+ _M_data->_M_amonth09 = L"Sep"; -+ _M_data->_M_amonth10 = L"Oct"; -+ _M_data->_M_amonth11 = L"Nov"; -+ _M_data->_M_amonth12 = L"Dec"; -+ } -+#if 0 -+ else -+ { -+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); -+ -+ union { char *__s; wchar_t *__w; } __u; -+ -+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); -+ _M_data->_M_date_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); -+ _M_data->_M_date_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); -+ _M_data->_M_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); -+ _M_data->_M_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); -+ _M_data->_M_date_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); -+ _M_data->_M_date_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); -+ _M_data->_M_am = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); -+ _M_data->_M_pm = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); -+ _M_data->_M_am_pm_format = __u.__w; -+ -+ // Day names, starting with "C"'s Sunday. -+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); -+ _M_data->_M_day1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); -+ _M_data->_M_day2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); -+ _M_data->_M_day3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); -+ _M_data->_M_day4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); -+ _M_data->_M_day5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); -+ _M_data->_M_day6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); -+ _M_data->_M_day7 = __u.__w; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); -+ _M_data->_M_aday1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); -+ _M_data->_M_aday2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); -+ _M_data->_M_aday3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); -+ _M_data->_M_aday4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); -+ _M_data->_M_aday5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); -+ _M_data->_M_aday6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); -+ _M_data->_M_aday7 = __u.__w; -+ -+ // Month names, starting with "C"'s January. -+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); -+ _M_data->_M_month01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); -+ _M_data->_M_month02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); -+ _M_data->_M_month03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); -+ _M_data->_M_month04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); -+ _M_data->_M_month05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); -+ _M_data->_M_month06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); -+ _M_data->_M_month07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); -+ _M_data->_M_month08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); -+ _M_data->_M_month09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); -+ _M_data->_M_month10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); -+ _M_data->_M_month11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); -+ _M_data->_M_month12 = __u.__w; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); -+ _M_data->_M_amonth01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); -+ _M_data->_M_amonth02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); -+ _M_data->_M_amonth03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); -+ _M_data->_M_amonth04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); -+ _M_data->_M_amonth05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); -+ _M_data->_M_amonth06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); -+ _M_data->_M_amonth07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); -+ _M_data->_M_amonth08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); -+ _M_data->_M_amonth09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); -+ _M_data->_M_amonth10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); -+ _M_data->_M_amonth11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); -+ _M_data->_M_amonth12 = __u.__w; -+ } -+#endif // 0 -+ } -+#endif -+} -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+ template -+ __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 -+ __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 -+ __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 -+ __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 -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure ---- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:29:22.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200 -@@ -5769,7 +5769,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; }; } ;; -@@ -5802,6 +5802,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) - enable_clocale_flag=gnu - ;; -@@ -6190,6 +6193,76 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ echo "$as_me:$LINENO: result: uclibc" >&5 -+echo "${ECHO_T}uclibc" >&6 -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ # Extract the first word of "msgfmt", so it can be a program name with args. -+set dummy msgfmt; ac_word=$2 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_check_msgfmt+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$check_msgfmt"; then -+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. -+else -+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -+for as_dir in $PATH -+do -+ IFS=$as_save_IFS -+ test -z "$as_dir" && as_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_check_msgfmt="yes" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done -+ -+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" -+fi -+fi -+check_msgfmt=$ac_cv_prog_check_msgfmt -+if test -n "$check_msgfmt"; then -+ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 -+echo "${ECHO_T}$check_msgfmt" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ -+ -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the -diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h ---- gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h 2005-08-17 04:28:44.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h ---- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h 2006-12-07 10:33:51.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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/patches/gcc/4.2.1/203-uclibc-locale-no__x.patch b/patches/gcc/4.2.1/203-uclibc-locale-no__x.patch deleted file mode 100644 index d88dc22..0000000 --- a/patches/gcc/4.2.1/203-uclibc-locale-no__x.patch +++ /dev/null @@ -1,223 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -39,20 +39,6 @@ - #include - #include - --#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<> -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200 -@@ -68,6 +68,7 @@ - { - extern "C" __typeof(uselocale) __uselocale; - } -+#define __uselocale uselocale - #endif - - namespace std -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:53.000000000 +0200 -@@ -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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -36,13 +36,6 @@ - #include - #include - --#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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -38,13 +38,6 @@ - #undef _LIBC - #include - --#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 specializations are in src/locale.cc and -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -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 - -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200 -@@ -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& __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; - } - -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -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: -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -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 - { -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -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 - { diff --git a/patches/gcc/4.2.1/204-uclibc-locale-wchar_fix.patch b/patches/gcc/4.2.1/204-uclibc-locale-wchar_fix.patch deleted file mode 100644 index 077bb56..0000000 --- a/patches/gcc/4.2.1/204-uclibc-locale-wchar_fix.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200 -@@ -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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200 -@@ -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/patches/gcc/4.2.1/205-uclibc-locale-update.patch b/patches/gcc/4.2.1/205-uclibc-locale-update.patch deleted file mode 100644 index 534f4e4..0000000 --- a/patches/gcc/4.2.1/205-uclibc-locale-update.patch +++ /dev/null @@ -1,354 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:31:54.000000000 +0200 -@@ -46,16 +46,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 +60,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 +74,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 +101,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); - } - -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:31:54.000000000 +0200 -@@ -39,21 +39,23 @@ - #pragma GCC system_header - - #include // get std::strlen --#include // get std::snprintf or std::sprintf -+#include // get std::vsnprintf or std::vsprintf - #include - #include // For codecvt - #ifdef __UCLIBC_MJN3_ONLY__ - #warning fix this - #endif --#ifdef __UCLIBC_HAS_LOCALE__ -+#ifdef _GLIBCXX_USE_ICONV - #include // For codecvt using iconv, iconv_t - #endif --#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ --#include // For messages -+#ifdef HAVE_LIBINTL_H -+#include // For messages - #endif -+#include - - #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 -- 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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:31:54.000000000 +0200 -@@ -33,9 +33,14 @@ - - // Written by Benjamin Kosnik - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - namespace std -@@ -138,20 +143,34 @@ - ctype:: - 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:: - do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200 -@@ -47,18 +47,21 @@ - template - 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 - 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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:54.000000000 +0200 -@@ -33,9 +33,14 @@ - - // Written by Benjamin Kosnik - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - #ifdef __UCLIBC_MJN3_ONLY__ -@@ -206,7 +211,7 @@ - } - break; - default: -- ; -+ __ret = pattern(); - } - return __ret; - } -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:54.000000000 +0200 -@@ -33,9 +33,14 @@ - - // Written by Benjamin Kosnik - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - #ifdef __UCLIBC_MJN3_ONLY__ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200 -@@ -37,25 +37,33 @@ - template - __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 - __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 - __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 diff --git a/patches/gcc/4.2.1/210-libmudflap-susv3-legacy.patch b/patches/gcc/4.2.1/210-libmudflap-susv3-legacy.patch new file mode 100644 index 0000000..26e8704 --- /dev/null +++ b/patches/gcc/4.2.1/210-libmudflap-susv3-legacy.patch @@ -0,0 +1,48 @@ +diff -durN gcc-4.2.1.orig/libmudflap/mf-hooks2.c gcc-4.2.1/libmudflap/mf-hooks2.c +--- gcc-4.2.1.orig/libmudflap/mf-hooks2.c 2005-09-23 23:58:39.000000000 +0200 ++++ gcc-4.2.1/libmudflap/mf-hooks2.c 2007-08-03 20:35:09.000000000 +0200 +@@ -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/patches/gcc/4.2.1/220-libstdc++-namespace.patch b/patches/gcc/4.2.1/220-libstdc++-namespace.patch new file mode 100644 index 0000000..709e8f2 --- /dev/null +++ b/patches/gcc/4.2.1/220-libstdc++-namespace.patch @@ -0,0 +1,36 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:35:40.000000000 +0200 +@@ -32,7 +32,8 @@ + // + + // Written by Benjamin Kosnik +- ++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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:35:40.000000000 +0200 +@@ -33,7 +33,8 @@ + // + + // Written by Benjamin Kosnik +- ++namespace std ++{ + template + __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/patches/gcc/4.2.1/230-libbackend_dep_gcov-iov.h.patch b/patches/gcc/4.2.1/230-libbackend_dep_gcov-iov.h.patch new file mode 100644 index 0000000..32754be --- /dev/null +++ b/patches/gcc/4.2.1/230-libbackend_dep_gcov-iov.h.patch @@ -0,0 +1,12 @@ +diff -durN gcc-4.2.1.orig/gcc/Makefile.in gcc-4.2.1/gcc/Makefile.in +--- gcc-4.2.1.orig/gcc/Makefile.in 2007-05-31 17:37:38.000000000 +0200 ++++ gcc-4.2.1/gcc/Makefile.in 2007-08-03 20:36:14.000000000 +0200 +@@ -2660,7 +2660,7 @@ + # FIXME: writing proper dependencies for this is a *LOT* of work. + libbackend.o : $(OBJS-common:.o=.c) $(out_file) \ + insn-config.h insn-flags.h insn-codes.h insn-constants.h \ +- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) ++ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ + -DTARGET_NAME=\"$(target_noncanonical)\" \ + -DLOCALEDIR=\"$(localedir)\" \ diff --git a/patches/gcc/4.2.1/240-arm-bigendian.patch b/patches/gcc/4.2.1/240-arm-bigendian.patch new file mode 100644 index 0000000..2abeccd --- /dev/null +++ b/patches/gcc/4.2.1/240-arm-bigendian.patch @@ -0,0 +1,64 @@ +diff -durN gcc-4.2.1.orig/gcc/config/arm/linux-elf.h gcc-4.2.1/gcc/config/arm/linux-elf.h +--- gcc-4.2.1.orig/gcc/config/arm/linux-elf.h 2006-02-17 00:29:10.000000000 +0100 ++++ gcc-4.2.1/gcc/config/arm/linux-elf.h 2007-08-03 20:36:43.000000000 +0200 +@@ -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 +diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc +--- gcc-4.2.1.orig/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200 ++++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:36:43.000000000 +0200 +@@ -705,6 +705,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/patches/gcc/4.2.1/250-softfloat-fix.patch b/patches/gcc/4.2.1/250-softfloat-fix.patch new file mode 100644 index 0000000..3517856 --- /dev/null +++ b/patches/gcc/4.2.1/250-softfloat-fix.patch @@ -0,0 +1,58 @@ +This patch (C) 2007 Yann E. MORIN +Licensed under GPL v2. + +First hunk of this patch solves compiling uClibc: + +make[1]: Entering directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' + LD libuClibc-0.9.29.so +libc/libc_so.a(difftime.os): In function `difftime': +difftime.c:(.text+0x8): undefined reference to `__floatsidf' +difftime.c:(.text+0x2c): undefined reference to `__subdf3' +libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr': +_fpmaxtostr.c:(.text+0xd4): undefined reference to `__nedf2' +_fpmaxtostr.c:(.text+0xf8): undefined reference to `__eqdf2' +_fpmaxtostr.c:(.text+0x114): undefined reference to `__divdf3' +_fpmaxtostr.c:(.text+0x120): undefined reference to `__ltdf2' +_fpmaxtostr.c:(.text+0x1c4): undefined reference to `__muldf3' +_fpmaxtostr.c:(.text+0x388): undefined reference to `__gedf2' +_fpmaxtostr.c:(.text+0x430): undefined reference to `__adddf3' +libc/libc_so.a(__psfs_do_numeric.os): In function `__psfs_do_numeric': +__psfs_do_numeric.c:(.text+0x520): undefined reference to `__truncdfsf2' +libc/libc_so.a(strtof.os): In function `strtof': +strtof.c:(.text+0x1c): undefined reference to `__extendsfdf2' +/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/cc_core_prefix/lib/gcc/arm-linux-uclibc/4.1.1/libgcc.a(_fixunsdfsi.o): +In function `__fixunsdfsi': +libgcc2.c:(.text+0x34): undefined reference to `__fixdfsi' +make[2]: *** [lib/libc.so] Error 1 +make[1]: *** [lib/libc.so.0] Error 2 +make[1]: Leaving directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' +make: *** [/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc/lib/libc.a] +Error 2 + +The second hunk fixes building final gcc because soft-float implies using -lfloat (which we don't have). + + +diff -dur gcc-4.2.0.orig/gcc/config.gcc gcc-4.2.0/gcc/config.gcc +--- gcc-4.2.0.orig/gcc/config.gcc 2007-07-15 11:24:18.000000000 +0200 ++++ gcc-4.2.0/gcc/config.gcc 2007-07-15 11:26:02.000000000 +0200 +@@ -721,7 +721,7 @@ + default_use_cxa_atexit=yes + ;; + *) +- tmake_file="$tmake_file arm/t-linux" ++ tmake_file="$tmake_file arm/t-linux arm/t-arm-elf" + ;; + esac + tm_file="$tm_file arm/aout.h arm/arm.h" +diff -dur gcc-4.2.0.orig/gcc/config/arm/linux-elf.h gcc-4.2.0/gcc/config/arm/linux-elf.h +--- gcc-4.2.0.orig/gcc/config/arm/linux-elf.h 2007-07-15 11:24:18.000000000 +0200 ++++ gcc-4.2.0/gcc/config/arm/linux-elf.h 2007-07-15 11:26:02.000000000 +0200 +@@ -63,7 +63,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" + diff --git a/patches/gcc/4.2.1/260-flatten-switch-stmt-00.patch b/patches/gcc/4.2.1/260-flatten-switch-stmt-00.patch new file mode 100644 index 0000000..6c40c57 --- /dev/null +++ b/patches/gcc/4.2.1/260-flatten-switch-stmt-00.patch @@ -0,0 +1,24 @@ +diff -durN gcc-4.2.1.orig/gcc/stmt.c gcc-4.2.1/gcc/stmt.c +--- gcc-4.2.1.orig/gcc/stmt.c 2007-07-19 05:25:32.000000000 +0200 ++++ gcc-4.2.1/gcc/stmt.c 2007-08-03 20:37:19.000000000 +0200 +@@ -2512,7 +2512,11 @@ + 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); + } +@@ -3070,6 +3074,7 @@ + { + 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, diff --git a/patches/gcc/4.2.1/270-soft-float.patch b/patches/gcc/4.2.1/270-soft-float.patch new file mode 100644 index 0000000..4287bfa --- /dev/null +++ b/patches/gcc/4.2.1/270-soft-float.patch @@ -0,0 +1,21 @@ +diff -uNpr gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c +--- gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c 2007-03-05 11:54:00.000000000 -0500 ++++ gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c 2008-01-31 17:51:24.000000000 -0500 +@@ -70,6 +70,8 @@ Software Foundation, 51 Franklin Street, + but GCC currently generates poor code when a union is used to turn + a long double into a pair of doubles. */ + ++#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) ++ + long double __gcc_qadd (double, double, double, double); + long double __gcc_qsub (double, double, double, double); + long double __gcc_qmul (double, double, double, double); +@@ -219,8 +221,6 @@ __gcc_qdiv (double a, double b, double c + return z.ldval; + } + +-#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) +- + long double __gcc_qneg (double, double); + int __gcc_qeq (double, double, double, double); + int __gcc_qne (double, double, double, double); diff --git a/patches/gcc/4.2.1/280-alpha-signal_h.patch b/patches/gcc/4.2.1/280-alpha-signal_h.patch new file mode 100644 index 0000000..d7e1796 --- /dev/null +++ b/patches/gcc/4.2.1/280-alpha-signal_h.patch @@ -0,0 +1,17 @@ +--- gcc-4.2.1-stock/gcc/config/alpha/linux-unwind.h 2005-06-24 20:22:41.000000000 -0500 ++++ gcc-4.2.1/gcc/config/alpha/linux-unwind.h 2007-09-01 20:21:34.000000000 -0500 +@@ -29,6 +29,9 @@ Boston, MA 02110-1301, USA. */ + /* Do code reading to identify a signal frame, and set the frame + state data appropriately. See unwind-dw2.c for the structs. */ + ++/* Don't use this if inhibit_libc is set ++ The build for this target will fail trying to include missing headers */ ++#ifndef inhibit_libc + #include + #include + +@@ -80,3 +83,4 @@ alpha_fallback_frame_state (struct _Unwi + fs->retaddr_column = 64; + return _URC_NO_REASON; + } ++#endif /* inhibit_libc */ diff --git a/patches/gcc/4.2.1/300-libstdc++-pic.patch b/patches/gcc/4.2.1/300-libstdc++-pic.patch deleted file mode 100644 index 7244d4c..0000000 --- a/patches/gcc/4.2.1/300-libstdc++-pic.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am gcc-4.2.1/libstdc++-v3/src/Makefile.am ---- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am 2006-07-28 06:57:34.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/src/Makefile.am 2007-08-03 20:32:27.000000000 +0200 -@@ -257,6 +257,12 @@ - $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ - - -+install-exec-local: -+ifeq ($(enable_shared),yes) -+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) -+endif -+ - # Added bits to build debug library. - if GLIBCXX_BUILD_DEBUG - all-local: build_debug -diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in gcc-4.2.1/libstdc++-v3/src/Makefile.in ---- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in 2006-10-16 21:08:22.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/src/Makefile.in 2007-08-03 20:32:27.000000000 +0200 -@@ -657,7 +657,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 - -@@ -690,6 +690,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 \ -@@ -799,6 +800,13 @@ - install_debug: - (cd ${debugdir} && $(MAKE) \ - toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) -+ -+install-exec-local: -+ifeq ($(enable_shared),yes) -+ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) -+endif -+ - # Tell versions [3.59,3.63) of GNU make to not export all variables. - # Otherwise a system limit (for SysV at least) may be exceeded. - .NOEXPORT: diff --git a/patches/gcc/4.2.1/301-missing-execinfo_h.patch b/patches/gcc/4.2.1/301-missing-execinfo_h.patch deleted file mode 100644 index ff67899..0000000 --- a/patches/gcc/4.2.1/301-missing-execinfo_h.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -durN gcc-4.2.1.orig/boehm-gc/include/gc.h gcc-4.2.1/boehm-gc/include/gc.h ---- gcc-4.2.1.orig/boehm-gc/include/gc.h 2006-09-18 20:45:08.000000000 +0200 -+++ gcc-4.2.1/boehm-gc/include/gc.h 2007-08-03 20:33:00.000000000 +0200 -@@ -502,7 +502,7 @@ - #if defined(__linux__) || defined(__GLIBC__) - # include - # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ -- && !defined(__ia64__) -+ && !defined(__ia64__) && !defined(__UCLIBC__) - # ifndef GC_HAVE_BUILTIN_BACKTRACE - # define GC_HAVE_BUILTIN_BACKTRACE - # endif diff --git a/patches/gcc/4.2.1/302-c99-snprintf.patch b/patches/gcc/4.2.1/302-c99-snprintf.patch deleted file mode 100644 index ddb0c34..0000000 --- a/patches/gcc/4.2.1/302-c99-snprintf.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h ---- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h 2006-12-07 10:33:51.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h 2007-08-03 20:33:24.000000000 +0200 -@@ -144,7 +144,7 @@ - - _GLIBCXX_END_NAMESPACE - --#if _GLIBCXX_USE_C99 -+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) - - #undef snprintf - #undef vfscanf diff --git a/patches/gcc/4.2.1/303-c99-complex-ugly-hack.patch b/patches/gcc/4.2.1/303-c99-complex-ugly-hack.patch deleted file mode 100644 index de6d71c..0000000 --- a/patches/gcc/4.2.1/303-c99-complex-ugly-hack.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure ---- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:33:56.000000000 +0200 -@@ -7514,6 +7514,9 @@ - cat >>conftest.$ac_ext <<_ACEOF - /* end confdefs.h. */ - #include -+#ifdef __UCLIBC__ -+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs -+#endif - int - main () - { diff --git a/patches/gcc/4.2.1/304-index_macro.patch b/patches/gcc/4.2.1/304-index_macro.patch deleted file mode 100644 index 1e56b5d..0000000 --- a/patches/gcc/4.2.1/304-index_macro.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/rope gcc-4.2.1/libstdc++-v3/include/ext/rope ---- gcc-4.2.1.orig/libstdc++-v3/include/ext/rope 2006-10-17 13:56:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/include/ext/rope 2007-08-03 20:34:23.000000000 +0200 -@@ -58,6 +58,9 @@ - #include - #include - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - # ifdef __GC - # define __GC_CONST const - # else -diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h ---- gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h 2006-10-17 13:56:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h 2007-08-03 20:34:23.000000000 +0200 -@@ -54,6 +54,9 @@ - #include // For uninitialized_copy_n - #include // For power - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) - - using std::size_t; diff --git a/patches/gcc/4.2.1/305-libmudflap-susv3-legacy.patch b/patches/gcc/4.2.1/305-libmudflap-susv3-legacy.patch deleted file mode 100644 index 26e8704..0000000 --- a/patches/gcc/4.2.1/305-libmudflap-susv3-legacy.patch +++ /dev/null @@ -1,48 +0,0 @@ -diff -durN gcc-4.2.1.orig/libmudflap/mf-hooks2.c gcc-4.2.1/libmudflap/mf-hooks2.c ---- gcc-4.2.1.orig/libmudflap/mf-hooks2.c 2005-09-23 23:58:39.000000000 +0200 -+++ gcc-4.2.1/libmudflap/mf-hooks2.c 2007-08-03 20:35:09.000000000 +0200 -@@ -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/patches/gcc/4.2.1/306-libstdc++-namespace.patch b/patches/gcc/4.2.1/306-libstdc++-namespace.patch deleted file mode 100644 index 709e8f2..0000000 --- a/patches/gcc/4.2.1/306-libstdc++-namespace.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:35:40.000000000 +0200 -@@ -32,7 +32,8 @@ - // - - // Written by Benjamin Kosnik -- -+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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:35:40.000000000 +0200 -@@ -33,7 +33,8 @@ - // - - // Written by Benjamin Kosnik -- -+namespace std -+{ - template - __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/patches/gcc/4.2.1/402-libbackend_dep_gcov-iov.h.patch b/patches/gcc/4.2.1/402-libbackend_dep_gcov-iov.h.patch deleted file mode 100644 index 32754be..0000000 --- a/patches/gcc/4.2.1/402-libbackend_dep_gcov-iov.h.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -durN gcc-4.2.1.orig/gcc/Makefile.in gcc-4.2.1/gcc/Makefile.in ---- gcc-4.2.1.orig/gcc/Makefile.in 2007-05-31 17:37:38.000000000 +0200 -+++ gcc-4.2.1/gcc/Makefile.in 2007-08-03 20:36:14.000000000 +0200 -@@ -2660,7 +2660,7 @@ - # FIXME: writing proper dependencies for this is a *LOT* of work. - libbackend.o : $(OBJS-common:.o=.c) $(out_file) \ - insn-config.h insn-flags.h insn-codes.h insn-constants.h \ -- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) -+ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ - -DTARGET_NAME=\"$(target_noncanonical)\" \ - -DLOCALEDIR=\"$(localedir)\" \ diff --git a/patches/gcc/4.2.1/800-arm-bigendian.patch b/patches/gcc/4.2.1/800-arm-bigendian.patch deleted file mode 100644 index 2abeccd..0000000 --- a/patches/gcc/4.2.1/800-arm-bigendian.patch +++ /dev/null @@ -1,64 +0,0 @@ -diff -durN gcc-4.2.1.orig/gcc/config/arm/linux-elf.h gcc-4.2.1/gcc/config/arm/linux-elf.h ---- gcc-4.2.1.orig/gcc/config/arm/linux-elf.h 2006-02-17 00:29:10.000000000 +0100 -+++ gcc-4.2.1/gcc/config/arm/linux-elf.h 2007-08-03 20:36:43.000000000 +0200 -@@ -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 -diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc ---- gcc-4.2.1.orig/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200 -+++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:36:43.000000000 +0200 -@@ -705,6 +705,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/patches/gcc/4.2.1/801-softfloat-fix.patch b/patches/gcc/4.2.1/801-softfloat-fix.patch deleted file mode 100644 index 3517856..0000000 --- a/patches/gcc/4.2.1/801-softfloat-fix.patch +++ /dev/null @@ -1,58 +0,0 @@ -This patch (C) 2007 Yann E. MORIN -Licensed under GPL v2. - -First hunk of this patch solves compiling uClibc: - -make[1]: Entering directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' - LD libuClibc-0.9.29.so -libc/libc_so.a(difftime.os): In function `difftime': -difftime.c:(.text+0x8): undefined reference to `__floatsidf' -difftime.c:(.text+0x2c): undefined reference to `__subdf3' -libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr': -_fpmaxtostr.c:(.text+0xd4): undefined reference to `__nedf2' -_fpmaxtostr.c:(.text+0xf8): undefined reference to `__eqdf2' -_fpmaxtostr.c:(.text+0x114): undefined reference to `__divdf3' -_fpmaxtostr.c:(.text+0x120): undefined reference to `__ltdf2' -_fpmaxtostr.c:(.text+0x1c4): undefined reference to `__muldf3' -_fpmaxtostr.c:(.text+0x388): undefined reference to `__gedf2' -_fpmaxtostr.c:(.text+0x430): undefined reference to `__adddf3' -libc/libc_so.a(__psfs_do_numeric.os): In function `__psfs_do_numeric': -__psfs_do_numeric.c:(.text+0x520): undefined reference to `__truncdfsf2' -libc/libc_so.a(strtof.os): In function `strtof': -strtof.c:(.text+0x1c): undefined reference to `__extendsfdf2' -/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/cc_core_prefix/lib/gcc/arm-linux-uclibc/4.1.1/libgcc.a(_fixunsdfsi.o): -In function `__fixunsdfsi': -libgcc2.c:(.text+0x34): undefined reference to `__fixdfsi' -make[2]: *** [lib/libc.so] Error 1 -make[1]: *** [lib/libc.so.0] Error 2 -make[1]: Leaving directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' -make: *** [/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc/lib/libc.a] -Error 2 - -The second hunk fixes building final gcc because soft-float implies using -lfloat (which we don't have). - - -diff -dur gcc-4.2.0.orig/gcc/config.gcc gcc-4.2.0/gcc/config.gcc ---- gcc-4.2.0.orig/gcc/config.gcc 2007-07-15 11:24:18.000000000 +0200 -+++ gcc-4.2.0/gcc/config.gcc 2007-07-15 11:26:02.000000000 +0200 -@@ -721,7 +721,7 @@ - default_use_cxa_atexit=yes - ;; - *) -- tmake_file="$tmake_file arm/t-linux" -+ tmake_file="$tmake_file arm/t-linux arm/t-arm-elf" - ;; - esac - tm_file="$tm_file arm/aout.h arm/arm.h" -diff -dur gcc-4.2.0.orig/gcc/config/arm/linux-elf.h gcc-4.2.0/gcc/config/arm/linux-elf.h ---- gcc-4.2.0.orig/gcc/config/arm/linux-elf.h 2007-07-15 11:24:18.000000000 +0200 -+++ gcc-4.2.0/gcc/config/arm/linux-elf.h 2007-07-15 11:26:02.000000000 +0200 -@@ -63,7 +63,7 @@ - %{shared:-lc} \ - %{!shared:%{profile:-lc_p}%{!profile:-lc}}" - --#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" -+#define LIBGCC_SPEC "-lgcc" - - #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" - diff --git a/patches/gcc/4.2.1/904-flatten-switch-stmt-00.patch b/patches/gcc/4.2.1/904-flatten-switch-stmt-00.patch deleted file mode 100644 index 6c40c57..0000000 --- a/patches/gcc/4.2.1/904-flatten-switch-stmt-00.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -durN gcc-4.2.1.orig/gcc/stmt.c gcc-4.2.1/gcc/stmt.c ---- gcc-4.2.1.orig/gcc/stmt.c 2007-07-19 05:25:32.000000000 +0200 -+++ gcc-4.2.1/gcc/stmt.c 2007-08-03 20:37:19.000000000 +0200 -@@ -2512,7 +2512,11 @@ - 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); - } -@@ -3070,6 +3074,7 @@ - { - 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, diff --git a/patches/gcc/4.2.1/920-soft-float.patch b/patches/gcc/4.2.1/920-soft-float.patch deleted file mode 100644 index 4287bfa..0000000 --- a/patches/gcc/4.2.1/920-soft-float.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -uNpr gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c ---- gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c 2007-03-05 11:54:00.000000000 -0500 -+++ gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c 2008-01-31 17:51:24.000000000 -0500 -@@ -70,6 +70,8 @@ Software Foundation, 51 Franklin Street, - but GCC currently generates poor code when a union is used to turn - a long double into a pair of doubles. */ - -+#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) -+ - long double __gcc_qadd (double, double, double, double); - long double __gcc_qsub (double, double, double, double); - long double __gcc_qmul (double, double, double, double); -@@ -219,8 +221,6 @@ __gcc_qdiv (double a, double b, double c - return z.ldval; - } - --#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) -- - long double __gcc_qneg (double, double); - int __gcc_qeq (double, double, double, double); - int __gcc_qne (double, double, double, double); diff --git a/patches/gcc/4.2.1/940-alpha-signal_h.patch b/patches/gcc/4.2.1/940-alpha-signal_h.patch deleted file mode 100644 index d7e1796..0000000 --- a/patches/gcc/4.2.1/940-alpha-signal_h.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- gcc-4.2.1-stock/gcc/config/alpha/linux-unwind.h 2005-06-24 20:22:41.000000000 -0500 -+++ gcc-4.2.1/gcc/config/alpha/linux-unwind.h 2007-09-01 20:21:34.000000000 -0500 -@@ -29,6 +29,9 @@ Boston, MA 02110-1301, USA. */ - /* Do code reading to identify a signal frame, and set the frame - state data appropriately. See unwind-dw2.c for the structs. */ - -+/* Don't use this if inhibit_libc is set -+ The build for this target will fail trying to include missing headers */ -+#ifndef inhibit_libc - #include - #include - -@@ -80,3 +83,4 @@ alpha_fallback_frame_state (struct _Unwi - fs->retaddr_column = 64; - return _URC_NO_REASON; - } -+#endif /* inhibit_libc */ diff --git a/patches/gcc/4.2.2/103-uclibc-conf-noupstream.patch b/patches/gcc/4.2.2/103-uclibc-conf-noupstream.patch deleted file mode 100644 index 1c239d6..0000000 --- a/patches/gcc/4.2.2/103-uclibc-conf-noupstream.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc ---- gcc-4.2.1.orig/gcc/config.gcc 2007-02-03 06:25:20.000000000 +0100 -+++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200 -@@ -1964,7 +1964,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/patches/gcc/4.2.2/110-uclibc-conf-noupstream.patch b/patches/gcc/4.2.2/110-uclibc-conf-noupstream.patch new file mode 100644 index 0000000..1c239d6 --- /dev/null +++ b/patches/gcc/4.2.2/110-uclibc-conf-noupstream.patch @@ -0,0 +1,12 @@ +diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc +--- gcc-4.2.1.orig/gcc/config.gcc 2007-02-03 06:25:20.000000000 +0100 ++++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200 +@@ -1964,7 +1964,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/patches/gcc/4.2.2/120-uclibc-locale.patch b/patches/gcc/4.2.2/120-uclibc-locale.patch new file mode 100644 index 0000000..298c505 --- /dev/null +++ b/patches/gcc/4.2.2/120-uclibc-locale.patch @@ -0,0 +1,2806 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 gcc-4.2.1/libstdc++-v3/acinclude.m4 +--- gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 2007-06-29 01:02:05.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/acinclude.m4 2007-08-03 20:30:21.000000000 +0200 +@@ -1334,7 +1334,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 +@@ -1355,6 +1355,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) + enable_clocale_flag=gnu + ;; +@@ -1526,6 +1529,40 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ AC_MSG_RESULT(uclibc) ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ AC_SUBST(glibcxx_MOFILES) ++ AC_SUBST(glibcxx_POFILES) ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include // For errno ++#include ++#include ++#include ++#include ++ ++#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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#ifndef _C_LOCALE_H ++#define _C_LOCALE_H 1 ++ ++#pragma GCC system_header ++ ++#include // get std::strlen ++#include // get std::snprintf or std::sprintf ++#include ++#include // For codecvt ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC_HAS_LOCALE__ ++#include // For codecvt using iconv, iconv_t ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#include // 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 ++ 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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++namespace std ++{ ++ // Specializations. ++#ifdef _GLIBCXX_USE_WCHAR_T ++ codecvt_base::result ++ codecvt:: ++ 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(-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(__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:: ++ 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(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(-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(-1) ++ || __conv == static_cast(-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:: ++ 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:: ++ 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:: ++ 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(__builtin_alloca(sizeof(wchar_t) ++ * __max)); ++ while (__from < __end && __max) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast(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(-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(-1) ++ || __conv == static_cast(-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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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::_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::_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::_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::_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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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 specializations are in src/locale.cc and ++ // various /config/os/* files. ++ template<> ++ ctype_byname::ctype_byname(const char* __s, size_t __refs) ++ : ctype(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::__wmask_type ++ ctype::_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::do_toupper(wchar_t __c) const ++ { return __towupper_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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::do_tolower(wchar_t __c) const ++ { return __towlower_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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:: ++ 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:: ++ 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:: ++ 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:: ++ 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:: ++ do_widen(char __c) const ++ { return _M_widen[static_cast(__c)]; } ++ ++ const char* ++ ctype:: ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const ++ { ++ while (__lo < __hi) ++ { ++ *__dest = _M_widen[static_cast(*__lo)]; ++ ++__lo; ++ ++__dest; ++ } ++ return __hi; ++ } ++ ++ char ++ ctype:: ++ 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(__c)); ++ } ++ ++ const wchar_t* ++ ctype:: ++ 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(__c)); ++ } ++ ++__lo; ++ ++__dest; ++ } ++ else ++ while (__lo < __hi) ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast(__c)); ++ ++__lo; ++ ++__dest; ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __hi; ++ } ++ ++ void ++ ctype::_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(__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(_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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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::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(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::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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#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 ++ messages<_CharT>::messages(size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), ++ _M_name_messages(_S_get_c_name()) ++ { } ++ ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::open(const basic_string& __s, const locale& __loc, ++ const char* __dir) const ++ { ++ __bindtextdomain(__s.c_str(), __dir); ++ return this->do_open(__s, __loc); ++ } ++ ++ // Virtual member functions. ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::do_open(const basic_string& __s, ++ const locale&) const ++ { ++ // No error checking is done, assume the catalog exists and can ++ // be used. ++ __textdomain(__s.c_str()); ++ return 0; ++ } ++ ++ template ++ void ++ messages<_CharT>::do_close(catalog) const ++ { } ++ ++ // messages_byname ++ template ++ 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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::~moneypunct() ++ { delete _M_data; } ++ ++ template<> ++ moneypunct::~moneypunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ moneypunct::_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; ++ ++ 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(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::_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; ++ ++ 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(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::~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::~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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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::~numpunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ numpunct::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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(__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(__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::~numpunct() ++ { delete _M_data; } ++ #endif ++} +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++ 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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++#warning wide time stuff ++// if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = L"%m/%d/%y"; ++ _M_data->_M_date_era_format = L"%m/%d/%y"; ++ _M_data->_M_time_format = L"%H:%M:%S"; ++ _M_data->_M_time_era_format = L"%H:%M:%S"; ++ _M_data->_M_date_time_format = L""; ++ _M_data->_M_date_time_era_format = L""; ++ _M_data->_M_am = L"AM"; ++ _M_data->_M_pm = L"PM"; ++ _M_data->_M_am_pm_format = L""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = L"Sunday"; ++ _M_data->_M_day2 = L"Monday"; ++ _M_data->_M_day3 = L"Tuesday"; ++ _M_data->_M_day4 = L"Wednesday"; ++ _M_data->_M_day5 = L"Thursday"; ++ _M_data->_M_day6 = L"Friday"; ++ _M_data->_M_day7 = L"Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = L"Sun"; ++ _M_data->_M_aday2 = L"Mon"; ++ _M_data->_M_aday3 = L"Tue"; ++ _M_data->_M_aday4 = L"Wed"; ++ _M_data->_M_aday5 = L"Thu"; ++ _M_data->_M_aday6 = L"Fri"; ++ _M_data->_M_aday7 = L"Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = L"January"; ++ _M_data->_M_month02 = L"February"; ++ _M_data->_M_month03 = L"March"; ++ _M_data->_M_month04 = L"April"; ++ _M_data->_M_month05 = L"May"; ++ _M_data->_M_month06 = L"June"; ++ _M_data->_M_month07 = L"July"; ++ _M_data->_M_month08 = L"August"; ++ _M_data->_M_month09 = L"September"; ++ _M_data->_M_month10 = L"October"; ++ _M_data->_M_month11 = L"November"; ++ _M_data->_M_month12 = L"December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = L"Jan"; ++ _M_data->_M_amonth02 = L"Feb"; ++ _M_data->_M_amonth03 = L"Mar"; ++ _M_data->_M_amonth04 = L"Apr"; ++ _M_data->_M_amonth05 = L"May"; ++ _M_data->_M_amonth06 = L"Jun"; ++ _M_data->_M_amonth07 = L"Jul"; ++ _M_data->_M_amonth08 = L"Aug"; ++ _M_data->_M_amonth09 = L"Sep"; ++ _M_data->_M_amonth10 = L"Oct"; ++ _M_data->_M_amonth11 = L"Nov"; ++ _M_data->_M_amonth12 = L"Dec"; ++ } ++#if 0 ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ union { char *__s; wchar_t *__w; } __u; ++ ++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); ++ _M_data->_M_date_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); ++ _M_data->_M_date_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); ++ _M_data->_M_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); ++ _M_data->_M_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); ++ _M_data->_M_date_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); ++ _M_data->_M_date_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); ++ _M_data->_M_am = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); ++ _M_data->_M_pm = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); ++ _M_data->_M_am_pm_format = __u.__w; ++ ++ // Day names, starting with "C"'s Sunday. ++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); ++ _M_data->_M_day1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); ++ _M_data->_M_day2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); ++ _M_data->_M_day3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); ++ _M_data->_M_day4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); ++ _M_data->_M_day5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); ++ _M_data->_M_day6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); ++ _M_data->_M_day7 = __u.__w; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); ++ _M_data->_M_aday1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); ++ _M_data->_M_aday2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); ++ _M_data->_M_aday3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); ++ _M_data->_M_aday4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); ++ _M_data->_M_aday5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); ++ _M_data->_M_aday6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); ++ _M_data->_M_aday7 = __u.__w; ++ ++ // Month names, starting with "C"'s January. ++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); ++ _M_data->_M_month01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); ++ _M_data->_M_month02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); ++ _M_data->_M_month03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); ++ _M_data->_M_month04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); ++ _M_data->_M_month05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); ++ _M_data->_M_month06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); ++ _M_data->_M_month07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); ++ _M_data->_M_month08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); ++ _M_data->_M_month09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); ++ _M_data->_M_month10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); ++ _M_data->_M_month11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); ++ _M_data->_M_month12 = __u.__w; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); ++ _M_data->_M_amonth01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); ++ _M_data->_M_amonth02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); ++ _M_data->_M_amonth03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); ++ _M_data->_M_amonth04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); ++ _M_data->_M_amonth05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); ++ _M_data->_M_amonth06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); ++ _M_data->_M_amonth07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); ++ _M_data->_M_amonth08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); ++ _M_data->_M_amonth09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); ++ _M_data->_M_amonth10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); ++ _M_data->_M_amonth11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); ++ _M_data->_M_amonth12 = __u.__w; ++ } ++#endif // 0 ++ } ++#endif ++} +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++ template ++ __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 ++ __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 ++ __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 ++ __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 -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure +--- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:29:22.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200 +@@ -5769,7 +5769,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; }; } ;; +@@ -5802,6 +5802,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) + enable_clocale_flag=gnu + ;; +@@ -6190,6 +6193,76 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ echo "$as_me:$LINENO: result: uclibc" >&5 ++echo "${ECHO_T}uclibc" >&6 ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ # Extract the first word of "msgfmt", so it can be a program name with args. ++set dummy msgfmt; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test -n "$check_msgfmt"; then ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_check_msgfmt="yes" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" ++fi ++fi ++check_msgfmt=$ac_cv_prog_check_msgfmt ++if test -n "$check_msgfmt"; then ++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 ++echo "${ECHO_T}$check_msgfmt" >&6 ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ ++ ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h +--- gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h 2005-08-17 04:28:44.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h +--- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h 2006-12-07 10:33:51.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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/patches/gcc/4.2.2/130-uclibc-locale-no__x.patch b/patches/gcc/4.2.2/130-uclibc-locale-no__x.patch new file mode 100644 index 0000000..d88dc22 --- /dev/null +++ b/patches/gcc/4.2.2/130-uclibc-locale-no__x.patch @@ -0,0 +1,223 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -39,20 +39,6 @@ + #include + #include + +-#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<> +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200 +@@ -68,6 +68,7 @@ + { + extern "C" __typeof(uselocale) __uselocale; + } ++#define __uselocale uselocale + #endif + + namespace std +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:53.000000000 +0200 +@@ -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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -36,13 +36,6 @@ + #include + #include + +-#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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -38,13 +38,6 @@ + #undef _LIBC + #include + +-#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 specializations are in src/locale.cc and +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -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 + +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200 +@@ -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& __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; + } + +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -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: +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -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 + { +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -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 + { diff --git a/patches/gcc/4.2.2/140-uclibc-locale-wchar_fix.patch b/patches/gcc/4.2.2/140-uclibc-locale-wchar_fix.patch new file mode 100644 index 0000000..077bb56 --- /dev/null +++ b/patches/gcc/4.2.2/140-uclibc-locale-wchar_fix.patch @@ -0,0 +1,50 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200 +@@ -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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200 +@@ -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/patches/gcc/4.2.2/150-uclibc-locale-update.patch b/patches/gcc/4.2.2/150-uclibc-locale-update.patch new file mode 100644 index 0000000..534f4e4 --- /dev/null +++ b/patches/gcc/4.2.2/150-uclibc-locale-update.patch @@ -0,0 +1,354 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:31:54.000000000 +0200 +@@ -46,16 +46,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 +60,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 +74,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 +101,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); + } + +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:31:54.000000000 +0200 +@@ -39,21 +39,23 @@ + #pragma GCC system_header + + #include // get std::strlen +-#include // get std::snprintf or std::sprintf ++#include // get std::vsnprintf or std::vsprintf + #include + #include // For codecvt + #ifdef __UCLIBC_MJN3_ONLY__ + #warning fix this + #endif +-#ifdef __UCLIBC_HAS_LOCALE__ ++#ifdef _GLIBCXX_USE_ICONV + #include // For codecvt using iconv, iconv_t + #endif +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ +-#include // For messages ++#ifdef HAVE_LIBINTL_H ++#include // For messages + #endif ++#include + + #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 +- 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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:31:54.000000000 +0200 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + namespace std +@@ -138,20 +143,34 @@ + ctype:: + 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:: + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200 +@@ -47,18 +47,21 @@ + template + 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 + 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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:54.000000000 +0200 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + #ifdef __UCLIBC_MJN3_ONLY__ +@@ -206,7 +211,7 @@ + } + break; + default: +- ; ++ __ret = pattern(); + } + return __ret; + } +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:54.000000000 +0200 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + #ifdef __UCLIBC_MJN3_ONLY__ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200 +@@ -37,25 +37,33 @@ + template + __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 + __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 + __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 diff --git a/patches/gcc/4.2.2/160-libstdc++-pic.patch b/patches/gcc/4.2.2/160-libstdc++-pic.patch new file mode 100644 index 0000000..7244d4c --- /dev/null +++ b/patches/gcc/4.2.2/160-libstdc++-pic.patch @@ -0,0 +1,50 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am gcc-4.2.1/libstdc++-v3/src/Makefile.am +--- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am 2006-07-28 06:57:34.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/src/Makefile.am 2007-08-03 20:32:27.000000000 +0200 +@@ -257,6 +257,12 @@ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ + + ++install-exec-local: ++ifeq ($(enable_shared),yes) ++ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++endif ++ + # Added bits to build debug library. + if GLIBCXX_BUILD_DEBUG + all-local: build_debug +diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in gcc-4.2.1/libstdc++-v3/src/Makefile.in +--- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in 2006-10-16 21:08:22.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/src/Makefile.in 2007-08-03 20:32:27.000000000 +0200 +@@ -657,7 +657,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 + +@@ -690,6 +690,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 \ +@@ -799,6 +800,13 @@ + install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ++ ++install-exec-local: ++ifeq ($(enable_shared),yes) ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++endif ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff --git a/patches/gcc/4.2.2/170-missing-execinfo_h.patch b/patches/gcc/4.2.2/170-missing-execinfo_h.patch new file mode 100644 index 0000000..ff67899 --- /dev/null +++ b/patches/gcc/4.2.2/170-missing-execinfo_h.patch @@ -0,0 +1,12 @@ +diff -durN gcc-4.2.1.orig/boehm-gc/include/gc.h gcc-4.2.1/boehm-gc/include/gc.h +--- gcc-4.2.1.orig/boehm-gc/include/gc.h 2006-09-18 20:45:08.000000000 +0200 ++++ gcc-4.2.1/boehm-gc/include/gc.h 2007-08-03 20:33:00.000000000 +0200 +@@ -502,7 +502,7 @@ + #if defined(__linux__) || defined(__GLIBC__) + # include + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/patches/gcc/4.2.2/180-c99-snprintf.patch b/patches/gcc/4.2.2/180-c99-snprintf.patch new file mode 100644 index 0000000..ddb0c34 --- /dev/null +++ b/patches/gcc/4.2.2/180-c99-snprintf.patch @@ -0,0 +1,12 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h +--- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h 2006-12-07 10:33:51.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h 2007-08-03 20:33:24.000000000 +0200 +@@ -144,7 +144,7 @@ + + _GLIBCXX_END_NAMESPACE + +-#if _GLIBCXX_USE_C99 ++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf diff --git a/patches/gcc/4.2.2/190-c99-complex-ugly-hack.patch b/patches/gcc/4.2.2/190-c99-complex-ugly-hack.patch new file mode 100644 index 0000000..de6d71c --- /dev/null +++ b/patches/gcc/4.2.2/190-c99-complex-ugly-hack.patch @@ -0,0 +1,13 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure +--- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:33:56.000000000 +0200 +@@ -7514,6 +7514,9 @@ + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + #include ++#ifdef __UCLIBC__ ++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs ++#endif + int + main () + { diff --git a/patches/gcc/4.2.2/200-index_macro.patch b/patches/gcc/4.2.2/200-index_macro.patch new file mode 100644 index 0000000..1e56b5d --- /dev/null +++ b/patches/gcc/4.2.2/200-index_macro.patch @@ -0,0 +1,26 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/rope gcc-4.2.1/libstdc++-v3/include/ext/rope +--- gcc-4.2.1.orig/libstdc++-v3/include/ext/rope 2006-10-17 13:56:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/include/ext/rope 2007-08-03 20:34:23.000000000 +0200 +@@ -58,6 +58,9 @@ + #include + #include + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + # ifdef __GC + # define __GC_CONST const + # else +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h +--- gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h 2006-10-17 13:56:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h 2007-08-03 20:34:23.000000000 +0200 +@@ -54,6 +54,9 @@ + #include // For uninitialized_copy_n + #include // For power + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + + using std::size_t; diff --git a/patches/gcc/4.2.2/200-uclibc-locale.patch b/patches/gcc/4.2.2/200-uclibc-locale.patch deleted file mode 100644 index 298c505..0000000 --- a/patches/gcc/4.2.2/200-uclibc-locale.patch +++ /dev/null @@ -1,2806 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 gcc-4.2.1/libstdc++-v3/acinclude.m4 ---- gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 2007-06-29 01:02:05.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/acinclude.m4 2007-08-03 20:30:21.000000000 +0200 -@@ -1334,7 +1334,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 -@@ -1355,6 +1355,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) - enable_clocale_flag=gnu - ;; -@@ -1526,6 +1529,40 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ AC_MSG_RESULT(uclibc) -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ AC_SUBST(glibcxx_MOFILES) -+ AC_SUBST(glibcxx_POFILES) -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include // For errno -+#include -+#include -+#include -+#include -+ -+#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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#ifndef _C_LOCALE_H -+#define _C_LOCALE_H 1 -+ -+#pragma GCC system_header -+ -+#include // get std::strlen -+#include // get std::snprintf or std::sprintf -+#include -+#include // For codecvt -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this -+#endif -+#ifdef __UCLIBC_HAS_LOCALE__ -+#include // For codecvt using iconv, iconv_t -+#endif -+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ -+#include // 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 -+ 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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+namespace std -+{ -+ // Specializations. -+#ifdef _GLIBCXX_USE_WCHAR_T -+ codecvt_base::result -+ codecvt:: -+ 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(-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(__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:: -+ 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(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(-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(-1) -+ || __conv == static_cast(-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:: -+ 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:: -+ 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:: -+ 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(__builtin_alloca(sizeof(wchar_t) -+ * __max)); -+ while (__from < __end && __max) -+ { -+ const extern_type* __from_chunk_end; -+ __from_chunk_end = static_cast(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(-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(-1) -+ || __conv == static_cast(-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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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::_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::_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::_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::_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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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 specializations are in src/locale.cc and -+ // various /config/os/* files. -+ template<> -+ ctype_byname::ctype_byname(const char* __s, size_t __refs) -+ : ctype(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::__wmask_type -+ ctype::_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::do_toupper(wchar_t __c) const -+ { return __towupper_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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::do_tolower(wchar_t __c) const -+ { return __towlower_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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:: -+ 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:: -+ 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:: -+ 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:: -+ 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:: -+ do_widen(char __c) const -+ { return _M_widen[static_cast(__c)]; } -+ -+ const char* -+ ctype:: -+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const -+ { -+ while (__lo < __hi) -+ { -+ *__dest = _M_widen[static_cast(*__lo)]; -+ ++__lo; -+ ++__dest; -+ } -+ return __hi; -+ } -+ -+ char -+ ctype:: -+ 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(__c)); -+ } -+ -+ const wchar_t* -+ ctype:: -+ 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(__c)); -+ } -+ ++__lo; -+ ++__dest; -+ } -+ else -+ while (__lo < __hi) -+ { -+ const int __c = wctob(*__lo); -+ *__dest = (__c == EOF ? __dfault : static_cast(__c)); -+ ++__lo; -+ ++__dest; -+ } -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ return __hi; -+ } -+ -+ void -+ ctype::_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(__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(_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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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::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(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::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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#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 -+ messages<_CharT>::messages(size_t __refs) -+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), -+ _M_name_messages(_S_get_c_name()) -+ { } -+ -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::open(const basic_string& __s, const locale& __loc, -+ const char* __dir) const -+ { -+ __bindtextdomain(__s.c_str(), __dir); -+ return this->do_open(__s, __loc); -+ } -+ -+ // Virtual member functions. -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::do_open(const basic_string& __s, -+ const locale&) const -+ { -+ // No error checking is done, assume the catalog exists and can -+ // be used. -+ __textdomain(__s.c_str()); -+ return 0; -+ } -+ -+ template -+ void -+ messages<_CharT>::do_close(catalog) const -+ { } -+ -+ // messages_byname -+ template -+ 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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::~moneypunct() -+ { delete _M_data; } -+ -+ template<> -+ moneypunct::~moneypunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ moneypunct::_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; -+ -+ 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(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::_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; -+ -+ 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(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::~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::~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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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::~numpunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ numpunct::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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(__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(__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::~numpunct() -+ { delete _M_data; } -+ #endif -+} -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+ 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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+#warning wide time stuff -+// if (!__cloc) -+ { -+ // "C" locale -+ _M_c_locale_timepunct = _S_get_c_locale(); -+ -+ _M_data->_M_date_format = L"%m/%d/%y"; -+ _M_data->_M_date_era_format = L"%m/%d/%y"; -+ _M_data->_M_time_format = L"%H:%M:%S"; -+ _M_data->_M_time_era_format = L"%H:%M:%S"; -+ _M_data->_M_date_time_format = L""; -+ _M_data->_M_date_time_era_format = L""; -+ _M_data->_M_am = L"AM"; -+ _M_data->_M_pm = L"PM"; -+ _M_data->_M_am_pm_format = L""; -+ -+ // Day names, starting with "C"'s Sunday. -+ _M_data->_M_day1 = L"Sunday"; -+ _M_data->_M_day2 = L"Monday"; -+ _M_data->_M_day3 = L"Tuesday"; -+ _M_data->_M_day4 = L"Wednesday"; -+ _M_data->_M_day5 = L"Thursday"; -+ _M_data->_M_day6 = L"Friday"; -+ _M_data->_M_day7 = L"Saturday"; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ _M_data->_M_aday1 = L"Sun"; -+ _M_data->_M_aday2 = L"Mon"; -+ _M_data->_M_aday3 = L"Tue"; -+ _M_data->_M_aday4 = L"Wed"; -+ _M_data->_M_aday5 = L"Thu"; -+ _M_data->_M_aday6 = L"Fri"; -+ _M_data->_M_aday7 = L"Sat"; -+ -+ // Month names, starting with "C"'s January. -+ _M_data->_M_month01 = L"January"; -+ _M_data->_M_month02 = L"February"; -+ _M_data->_M_month03 = L"March"; -+ _M_data->_M_month04 = L"April"; -+ _M_data->_M_month05 = L"May"; -+ _M_data->_M_month06 = L"June"; -+ _M_data->_M_month07 = L"July"; -+ _M_data->_M_month08 = L"August"; -+ _M_data->_M_month09 = L"September"; -+ _M_data->_M_month10 = L"October"; -+ _M_data->_M_month11 = L"November"; -+ _M_data->_M_month12 = L"December"; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ _M_data->_M_amonth01 = L"Jan"; -+ _M_data->_M_amonth02 = L"Feb"; -+ _M_data->_M_amonth03 = L"Mar"; -+ _M_data->_M_amonth04 = L"Apr"; -+ _M_data->_M_amonth05 = L"May"; -+ _M_data->_M_amonth06 = L"Jun"; -+ _M_data->_M_amonth07 = L"Jul"; -+ _M_data->_M_amonth08 = L"Aug"; -+ _M_data->_M_amonth09 = L"Sep"; -+ _M_data->_M_amonth10 = L"Oct"; -+ _M_data->_M_amonth11 = L"Nov"; -+ _M_data->_M_amonth12 = L"Dec"; -+ } -+#if 0 -+ else -+ { -+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); -+ -+ union { char *__s; wchar_t *__w; } __u; -+ -+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); -+ _M_data->_M_date_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); -+ _M_data->_M_date_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); -+ _M_data->_M_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); -+ _M_data->_M_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); -+ _M_data->_M_date_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); -+ _M_data->_M_date_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); -+ _M_data->_M_am = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); -+ _M_data->_M_pm = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); -+ _M_data->_M_am_pm_format = __u.__w; -+ -+ // Day names, starting with "C"'s Sunday. -+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); -+ _M_data->_M_day1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); -+ _M_data->_M_day2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); -+ _M_data->_M_day3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); -+ _M_data->_M_day4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); -+ _M_data->_M_day5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); -+ _M_data->_M_day6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); -+ _M_data->_M_day7 = __u.__w; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); -+ _M_data->_M_aday1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); -+ _M_data->_M_aday2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); -+ _M_data->_M_aday3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); -+ _M_data->_M_aday4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); -+ _M_data->_M_aday5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); -+ _M_data->_M_aday6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); -+ _M_data->_M_aday7 = __u.__w; -+ -+ // Month names, starting with "C"'s January. -+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); -+ _M_data->_M_month01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); -+ _M_data->_M_month02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); -+ _M_data->_M_month03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); -+ _M_data->_M_month04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); -+ _M_data->_M_month05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); -+ _M_data->_M_month06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); -+ _M_data->_M_month07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); -+ _M_data->_M_month08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); -+ _M_data->_M_month09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); -+ _M_data->_M_month10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); -+ _M_data->_M_month11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); -+ _M_data->_M_month12 = __u.__w; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); -+ _M_data->_M_amonth01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); -+ _M_data->_M_amonth02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); -+ _M_data->_M_amonth03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); -+ _M_data->_M_amonth04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); -+ _M_data->_M_amonth05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); -+ _M_data->_M_amonth06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); -+ _M_data->_M_amonth07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); -+ _M_data->_M_amonth08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); -+ _M_data->_M_amonth09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); -+ _M_data->_M_amonth10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); -+ _M_data->_M_amonth11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); -+ _M_data->_M_amonth12 = __u.__w; -+ } -+#endif // 0 -+ } -+#endif -+} -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+ template -+ __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 -+ __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 -+ __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 -+ __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 -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure ---- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:29:22.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200 -@@ -5769,7 +5769,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; }; } ;; -@@ -5802,6 +5802,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) - enable_clocale_flag=gnu - ;; -@@ -6190,6 +6193,76 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ echo "$as_me:$LINENO: result: uclibc" >&5 -+echo "${ECHO_T}uclibc" >&6 -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ # Extract the first word of "msgfmt", so it can be a program name with args. -+set dummy msgfmt; ac_word=$2 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_check_msgfmt+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$check_msgfmt"; then -+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. -+else -+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -+for as_dir in $PATH -+do -+ IFS=$as_save_IFS -+ test -z "$as_dir" && as_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_check_msgfmt="yes" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done -+ -+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" -+fi -+fi -+check_msgfmt=$ac_cv_prog_check_msgfmt -+if test -n "$check_msgfmt"; then -+ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 -+echo "${ECHO_T}$check_msgfmt" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ -+ -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the -diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h ---- gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h 2005-08-17 04:28:44.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h ---- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h 2006-12-07 10:33:51.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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/patches/gcc/4.2.2/203-uclibc-locale-no__x.patch b/patches/gcc/4.2.2/203-uclibc-locale-no__x.patch deleted file mode 100644 index d88dc22..0000000 --- a/patches/gcc/4.2.2/203-uclibc-locale-no__x.patch +++ /dev/null @@ -1,223 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -39,20 +39,6 @@ - #include - #include - --#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<> -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200 -@@ -68,6 +68,7 @@ - { - extern "C" __typeof(uselocale) __uselocale; - } -+#define __uselocale uselocale - #endif - - namespace std -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:53.000000000 +0200 -@@ -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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -36,13 +36,6 @@ - #include - #include - --#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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -38,13 +38,6 @@ - #undef _LIBC - #include - --#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 specializations are in src/locale.cc and -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -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 - -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200 -@@ -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& __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; - } - -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -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: -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -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 - { -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -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 - { diff --git a/patches/gcc/4.2.2/204-uclibc-locale-wchar_fix.patch b/patches/gcc/4.2.2/204-uclibc-locale-wchar_fix.patch deleted file mode 100644 index 077bb56..0000000 --- a/patches/gcc/4.2.2/204-uclibc-locale-wchar_fix.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200 -@@ -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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200 -@@ -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/patches/gcc/4.2.2/205-uclibc-locale-update.patch b/patches/gcc/4.2.2/205-uclibc-locale-update.patch deleted file mode 100644 index 534f4e4..0000000 --- a/patches/gcc/4.2.2/205-uclibc-locale-update.patch +++ /dev/null @@ -1,354 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:31:54.000000000 +0200 -@@ -46,16 +46,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 +60,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 +74,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 +101,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); - } - -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:31:54.000000000 +0200 -@@ -39,21 +39,23 @@ - #pragma GCC system_header - - #include // get std::strlen --#include // get std::snprintf or std::sprintf -+#include // get std::vsnprintf or std::vsprintf - #include - #include // For codecvt - #ifdef __UCLIBC_MJN3_ONLY__ - #warning fix this - #endif --#ifdef __UCLIBC_HAS_LOCALE__ -+#ifdef _GLIBCXX_USE_ICONV - #include // For codecvt using iconv, iconv_t - #endif --#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ --#include // For messages -+#ifdef HAVE_LIBINTL_H -+#include // For messages - #endif -+#include - - #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 -- 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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:31:54.000000000 +0200 -@@ -33,9 +33,14 @@ - - // Written by Benjamin Kosnik - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - namespace std -@@ -138,20 +143,34 @@ - ctype:: - 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:: - do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200 -@@ -47,18 +47,21 @@ - template - 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 - 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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:54.000000000 +0200 -@@ -33,9 +33,14 @@ - - // Written by Benjamin Kosnik - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - #ifdef __UCLIBC_MJN3_ONLY__ -@@ -206,7 +211,7 @@ - } - break; - default: -- ; -+ __ret = pattern(); - } - return __ret; - } -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:54.000000000 +0200 -@@ -33,9 +33,14 @@ - - // Written by Benjamin Kosnik - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - #ifdef __UCLIBC_MJN3_ONLY__ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200 -@@ -37,25 +37,33 @@ - template - __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 - __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 - __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 diff --git a/patches/gcc/4.2.2/210-libmudflap-susv3-legacy.patch b/patches/gcc/4.2.2/210-libmudflap-susv3-legacy.patch new file mode 100644 index 0000000..26e8704 --- /dev/null +++ b/patches/gcc/4.2.2/210-libmudflap-susv3-legacy.patch @@ -0,0 +1,48 @@ +diff -durN gcc-4.2.1.orig/libmudflap/mf-hooks2.c gcc-4.2.1/libmudflap/mf-hooks2.c +--- gcc-4.2.1.orig/libmudflap/mf-hooks2.c 2005-09-23 23:58:39.000000000 +0200 ++++ gcc-4.2.1/libmudflap/mf-hooks2.c 2007-08-03 20:35:09.000000000 +0200 +@@ -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/patches/gcc/4.2.2/220-libstdc++-namespace.patch b/patches/gcc/4.2.2/220-libstdc++-namespace.patch new file mode 100644 index 0000000..709e8f2 --- /dev/null +++ b/patches/gcc/4.2.2/220-libstdc++-namespace.patch @@ -0,0 +1,36 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:35:40.000000000 +0200 +@@ -32,7 +32,8 @@ + // + + // Written by Benjamin Kosnik +- ++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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:35:40.000000000 +0200 +@@ -33,7 +33,8 @@ + // + + // Written by Benjamin Kosnik +- ++namespace std ++{ + template + __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/patches/gcc/4.2.2/230-libbackend_dep_gcov-iov.h.patch b/patches/gcc/4.2.2/230-libbackend_dep_gcov-iov.h.patch new file mode 100644 index 0000000..32754be --- /dev/null +++ b/patches/gcc/4.2.2/230-libbackend_dep_gcov-iov.h.patch @@ -0,0 +1,12 @@ +diff -durN gcc-4.2.1.orig/gcc/Makefile.in gcc-4.2.1/gcc/Makefile.in +--- gcc-4.2.1.orig/gcc/Makefile.in 2007-05-31 17:37:38.000000000 +0200 ++++ gcc-4.2.1/gcc/Makefile.in 2007-08-03 20:36:14.000000000 +0200 +@@ -2660,7 +2660,7 @@ + # FIXME: writing proper dependencies for this is a *LOT* of work. + libbackend.o : $(OBJS-common:.o=.c) $(out_file) \ + insn-config.h insn-flags.h insn-codes.h insn-constants.h \ +- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) ++ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ + -DTARGET_NAME=\"$(target_noncanonical)\" \ + -DLOCALEDIR=\"$(localedir)\" \ diff --git a/patches/gcc/4.2.2/240-arm-bigendian.patch b/patches/gcc/4.2.2/240-arm-bigendian.patch new file mode 100644 index 0000000..2abeccd --- /dev/null +++ b/patches/gcc/4.2.2/240-arm-bigendian.patch @@ -0,0 +1,64 @@ +diff -durN gcc-4.2.1.orig/gcc/config/arm/linux-elf.h gcc-4.2.1/gcc/config/arm/linux-elf.h +--- gcc-4.2.1.orig/gcc/config/arm/linux-elf.h 2006-02-17 00:29:10.000000000 +0100 ++++ gcc-4.2.1/gcc/config/arm/linux-elf.h 2007-08-03 20:36:43.000000000 +0200 +@@ -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 +diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc +--- gcc-4.2.1.orig/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200 ++++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:36:43.000000000 +0200 +@@ -705,6 +705,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/patches/gcc/4.2.2/250-softfloat-fix.patch b/patches/gcc/4.2.2/250-softfloat-fix.patch new file mode 100644 index 0000000..3517856 --- /dev/null +++ b/patches/gcc/4.2.2/250-softfloat-fix.patch @@ -0,0 +1,58 @@ +This patch (C) 2007 Yann E. MORIN +Licensed under GPL v2. + +First hunk of this patch solves compiling uClibc: + +make[1]: Entering directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' + LD libuClibc-0.9.29.so +libc/libc_so.a(difftime.os): In function `difftime': +difftime.c:(.text+0x8): undefined reference to `__floatsidf' +difftime.c:(.text+0x2c): undefined reference to `__subdf3' +libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr': +_fpmaxtostr.c:(.text+0xd4): undefined reference to `__nedf2' +_fpmaxtostr.c:(.text+0xf8): undefined reference to `__eqdf2' +_fpmaxtostr.c:(.text+0x114): undefined reference to `__divdf3' +_fpmaxtostr.c:(.text+0x120): undefined reference to `__ltdf2' +_fpmaxtostr.c:(.text+0x1c4): undefined reference to `__muldf3' +_fpmaxtostr.c:(.text+0x388): undefined reference to `__gedf2' +_fpmaxtostr.c:(.text+0x430): undefined reference to `__adddf3' +libc/libc_so.a(__psfs_do_numeric.os): In function `__psfs_do_numeric': +__psfs_do_numeric.c:(.text+0x520): undefined reference to `__truncdfsf2' +libc/libc_so.a(strtof.os): In function `strtof': +strtof.c:(.text+0x1c): undefined reference to `__extendsfdf2' +/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/cc_core_prefix/lib/gcc/arm-linux-uclibc/4.1.1/libgcc.a(_fixunsdfsi.o): +In function `__fixunsdfsi': +libgcc2.c:(.text+0x34): undefined reference to `__fixdfsi' +make[2]: *** [lib/libc.so] Error 1 +make[1]: *** [lib/libc.so.0] Error 2 +make[1]: Leaving directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' +make: *** [/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc/lib/libc.a] +Error 2 + +The second hunk fixes building final gcc because soft-float implies using -lfloat (which we don't have). + + +diff -dur gcc-4.2.0.orig/gcc/config.gcc gcc-4.2.0/gcc/config.gcc +--- gcc-4.2.0.orig/gcc/config.gcc 2007-07-15 11:24:18.000000000 +0200 ++++ gcc-4.2.0/gcc/config.gcc 2007-07-15 11:26:02.000000000 +0200 +@@ -721,7 +721,7 @@ + default_use_cxa_atexit=yes + ;; + *) +- tmake_file="$tmake_file arm/t-linux" ++ tmake_file="$tmake_file arm/t-linux arm/t-arm-elf" + ;; + esac + tm_file="$tm_file arm/aout.h arm/arm.h" +diff -dur gcc-4.2.0.orig/gcc/config/arm/linux-elf.h gcc-4.2.0/gcc/config/arm/linux-elf.h +--- gcc-4.2.0.orig/gcc/config/arm/linux-elf.h 2007-07-15 11:24:18.000000000 +0200 ++++ gcc-4.2.0/gcc/config/arm/linux-elf.h 2007-07-15 11:26:02.000000000 +0200 +@@ -63,7 +63,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" + diff --git a/patches/gcc/4.2.2/260-flatten-switch-stmt-00.patch b/patches/gcc/4.2.2/260-flatten-switch-stmt-00.patch new file mode 100644 index 0000000..6c40c57 --- /dev/null +++ b/patches/gcc/4.2.2/260-flatten-switch-stmt-00.patch @@ -0,0 +1,24 @@ +diff -durN gcc-4.2.1.orig/gcc/stmt.c gcc-4.2.1/gcc/stmt.c +--- gcc-4.2.1.orig/gcc/stmt.c 2007-07-19 05:25:32.000000000 +0200 ++++ gcc-4.2.1/gcc/stmt.c 2007-08-03 20:37:19.000000000 +0200 +@@ -2512,7 +2512,11 @@ + 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); + } +@@ -3070,6 +3074,7 @@ + { + 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, diff --git a/patches/gcc/4.2.2/270-soft-float.patch b/patches/gcc/4.2.2/270-soft-float.patch new file mode 100644 index 0000000..4287bfa --- /dev/null +++ b/patches/gcc/4.2.2/270-soft-float.patch @@ -0,0 +1,21 @@ +diff -uNpr gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c +--- gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c 2007-03-05 11:54:00.000000000 -0500 ++++ gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c 2008-01-31 17:51:24.000000000 -0500 +@@ -70,6 +70,8 @@ Software Foundation, 51 Franklin Street, + but GCC currently generates poor code when a union is used to turn + a long double into a pair of doubles. */ + ++#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) ++ + long double __gcc_qadd (double, double, double, double); + long double __gcc_qsub (double, double, double, double); + long double __gcc_qmul (double, double, double, double); +@@ -219,8 +221,6 @@ __gcc_qdiv (double a, double b, double c + return z.ldval; + } + +-#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) +- + long double __gcc_qneg (double, double); + int __gcc_qeq (double, double, double, double); + int __gcc_qne (double, double, double, double); diff --git a/patches/gcc/4.2.2/280-alpha-signal_h.patch b/patches/gcc/4.2.2/280-alpha-signal_h.patch new file mode 100644 index 0000000..d7e1796 --- /dev/null +++ b/patches/gcc/4.2.2/280-alpha-signal_h.patch @@ -0,0 +1,17 @@ +--- gcc-4.2.1-stock/gcc/config/alpha/linux-unwind.h 2005-06-24 20:22:41.000000000 -0500 ++++ gcc-4.2.1/gcc/config/alpha/linux-unwind.h 2007-09-01 20:21:34.000000000 -0500 +@@ -29,6 +29,9 @@ Boston, MA 02110-1301, USA. */ + /* Do code reading to identify a signal frame, and set the frame + state data appropriately. See unwind-dw2.c for the structs. */ + ++/* Don't use this if inhibit_libc is set ++ The build for this target will fail trying to include missing headers */ ++#ifndef inhibit_libc + #include + #include + +@@ -80,3 +83,4 @@ alpha_fallback_frame_state (struct _Unwi + fs->retaddr_column = 64; + return _URC_NO_REASON; + } ++#endif /* inhibit_libc */ diff --git a/patches/gcc/4.2.2/300-libstdc++-pic.patch b/patches/gcc/4.2.2/300-libstdc++-pic.patch deleted file mode 100644 index 7244d4c..0000000 --- a/patches/gcc/4.2.2/300-libstdc++-pic.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am gcc-4.2.1/libstdc++-v3/src/Makefile.am ---- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am 2006-07-28 06:57:34.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/src/Makefile.am 2007-08-03 20:32:27.000000000 +0200 -@@ -257,6 +257,12 @@ - $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ - - -+install-exec-local: -+ifeq ($(enable_shared),yes) -+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) -+endif -+ - # Added bits to build debug library. - if GLIBCXX_BUILD_DEBUG - all-local: build_debug -diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in gcc-4.2.1/libstdc++-v3/src/Makefile.in ---- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in 2006-10-16 21:08:22.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/src/Makefile.in 2007-08-03 20:32:27.000000000 +0200 -@@ -657,7 +657,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 - -@@ -690,6 +690,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 \ -@@ -799,6 +800,13 @@ - install_debug: - (cd ${debugdir} && $(MAKE) \ - toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) -+ -+install-exec-local: -+ifeq ($(enable_shared),yes) -+ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) -+endif -+ - # Tell versions [3.59,3.63) of GNU make to not export all variables. - # Otherwise a system limit (for SysV at least) may be exceeded. - .NOEXPORT: diff --git a/patches/gcc/4.2.2/301-missing-execinfo_h.patch b/patches/gcc/4.2.2/301-missing-execinfo_h.patch deleted file mode 100644 index ff67899..0000000 --- a/patches/gcc/4.2.2/301-missing-execinfo_h.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -durN gcc-4.2.1.orig/boehm-gc/include/gc.h gcc-4.2.1/boehm-gc/include/gc.h ---- gcc-4.2.1.orig/boehm-gc/include/gc.h 2006-09-18 20:45:08.000000000 +0200 -+++ gcc-4.2.1/boehm-gc/include/gc.h 2007-08-03 20:33:00.000000000 +0200 -@@ -502,7 +502,7 @@ - #if defined(__linux__) || defined(__GLIBC__) - # include - # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ -- && !defined(__ia64__) -+ && !defined(__ia64__) && !defined(__UCLIBC__) - # ifndef GC_HAVE_BUILTIN_BACKTRACE - # define GC_HAVE_BUILTIN_BACKTRACE - # endif diff --git a/patches/gcc/4.2.2/302-c99-snprintf.patch b/patches/gcc/4.2.2/302-c99-snprintf.patch deleted file mode 100644 index ddb0c34..0000000 --- a/patches/gcc/4.2.2/302-c99-snprintf.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h ---- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h 2006-12-07 10:33:51.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h 2007-08-03 20:33:24.000000000 +0200 -@@ -144,7 +144,7 @@ - - _GLIBCXX_END_NAMESPACE - --#if _GLIBCXX_USE_C99 -+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) - - #undef snprintf - #undef vfscanf diff --git a/patches/gcc/4.2.2/303-c99-complex-ugly-hack.patch b/patches/gcc/4.2.2/303-c99-complex-ugly-hack.patch deleted file mode 100644 index de6d71c..0000000 --- a/patches/gcc/4.2.2/303-c99-complex-ugly-hack.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure ---- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:33:56.000000000 +0200 -@@ -7514,6 +7514,9 @@ - cat >>conftest.$ac_ext <<_ACEOF - /* end confdefs.h. */ - #include -+#ifdef __UCLIBC__ -+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs -+#endif - int - main () - { diff --git a/patches/gcc/4.2.2/304-index_macro.patch b/patches/gcc/4.2.2/304-index_macro.patch deleted file mode 100644 index 1e56b5d..0000000 --- a/patches/gcc/4.2.2/304-index_macro.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/rope gcc-4.2.1/libstdc++-v3/include/ext/rope ---- gcc-4.2.1.orig/libstdc++-v3/include/ext/rope 2006-10-17 13:56:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/include/ext/rope 2007-08-03 20:34:23.000000000 +0200 -@@ -58,6 +58,9 @@ - #include - #include - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - # ifdef __GC - # define __GC_CONST const - # else -diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h ---- gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h 2006-10-17 13:56:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h 2007-08-03 20:34:23.000000000 +0200 -@@ -54,6 +54,9 @@ - #include // For uninitialized_copy_n - #include // For power - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) - - using std::size_t; diff --git a/patches/gcc/4.2.2/305-libmudflap-susv3-legacy.patch b/patches/gcc/4.2.2/305-libmudflap-susv3-legacy.patch deleted file mode 100644 index 26e8704..0000000 --- a/patches/gcc/4.2.2/305-libmudflap-susv3-legacy.patch +++ /dev/null @@ -1,48 +0,0 @@ -diff -durN gcc-4.2.1.orig/libmudflap/mf-hooks2.c gcc-4.2.1/libmudflap/mf-hooks2.c ---- gcc-4.2.1.orig/libmudflap/mf-hooks2.c 2005-09-23 23:58:39.000000000 +0200 -+++ gcc-4.2.1/libmudflap/mf-hooks2.c 2007-08-03 20:35:09.000000000 +0200 -@@ -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/patches/gcc/4.2.2/306-libstdc++-namespace.patch b/patches/gcc/4.2.2/306-libstdc++-namespace.patch deleted file mode 100644 index 709e8f2..0000000 --- a/patches/gcc/4.2.2/306-libstdc++-namespace.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:35:40.000000000 +0200 -@@ -32,7 +32,8 @@ - // - - // Written by Benjamin Kosnik -- -+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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:35:40.000000000 +0200 -@@ -33,7 +33,8 @@ - // - - // Written by Benjamin Kosnik -- -+namespace std -+{ - template - __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/patches/gcc/4.2.2/402-libbackend_dep_gcov-iov.h.patch b/patches/gcc/4.2.2/402-libbackend_dep_gcov-iov.h.patch deleted file mode 100644 index 32754be..0000000 --- a/patches/gcc/4.2.2/402-libbackend_dep_gcov-iov.h.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -durN gcc-4.2.1.orig/gcc/Makefile.in gcc-4.2.1/gcc/Makefile.in ---- gcc-4.2.1.orig/gcc/Makefile.in 2007-05-31 17:37:38.000000000 +0200 -+++ gcc-4.2.1/gcc/Makefile.in 2007-08-03 20:36:14.000000000 +0200 -@@ -2660,7 +2660,7 @@ - # FIXME: writing proper dependencies for this is a *LOT* of work. - libbackend.o : $(OBJS-common:.o=.c) $(out_file) \ - insn-config.h insn-flags.h insn-codes.h insn-constants.h \ -- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) -+ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ - -DTARGET_NAME=\"$(target_noncanonical)\" \ - -DLOCALEDIR=\"$(localedir)\" \ diff --git a/patches/gcc/4.2.2/800-arm-bigendian.patch b/patches/gcc/4.2.2/800-arm-bigendian.patch deleted file mode 100644 index 2abeccd..0000000 --- a/patches/gcc/4.2.2/800-arm-bigendian.patch +++ /dev/null @@ -1,64 +0,0 @@ -diff -durN gcc-4.2.1.orig/gcc/config/arm/linux-elf.h gcc-4.2.1/gcc/config/arm/linux-elf.h ---- gcc-4.2.1.orig/gcc/config/arm/linux-elf.h 2006-02-17 00:29:10.000000000 +0100 -+++ gcc-4.2.1/gcc/config/arm/linux-elf.h 2007-08-03 20:36:43.000000000 +0200 -@@ -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 -diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc ---- gcc-4.2.1.orig/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200 -+++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:36:43.000000000 +0200 -@@ -705,6 +705,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/patches/gcc/4.2.2/801-softfloat-fix.patch b/patches/gcc/4.2.2/801-softfloat-fix.patch deleted file mode 100644 index 3517856..0000000 --- a/patches/gcc/4.2.2/801-softfloat-fix.patch +++ /dev/null @@ -1,58 +0,0 @@ -This patch (C) 2007 Yann E. MORIN -Licensed under GPL v2. - -First hunk of this patch solves compiling uClibc: - -make[1]: Entering directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' - LD libuClibc-0.9.29.so -libc/libc_so.a(difftime.os): In function `difftime': -difftime.c:(.text+0x8): undefined reference to `__floatsidf' -difftime.c:(.text+0x2c): undefined reference to `__subdf3' -libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr': -_fpmaxtostr.c:(.text+0xd4): undefined reference to `__nedf2' -_fpmaxtostr.c:(.text+0xf8): undefined reference to `__eqdf2' -_fpmaxtostr.c:(.text+0x114): undefined reference to `__divdf3' -_fpmaxtostr.c:(.text+0x120): undefined reference to `__ltdf2' -_fpmaxtostr.c:(.text+0x1c4): undefined reference to `__muldf3' -_fpmaxtostr.c:(.text+0x388): undefined reference to `__gedf2' -_fpmaxtostr.c:(.text+0x430): undefined reference to `__adddf3' -libc/libc_so.a(__psfs_do_numeric.os): In function `__psfs_do_numeric': -__psfs_do_numeric.c:(.text+0x520): undefined reference to `__truncdfsf2' -libc/libc_so.a(strtof.os): In function `strtof': -strtof.c:(.text+0x1c): undefined reference to `__extendsfdf2' -/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/cc_core_prefix/lib/gcc/arm-linux-uclibc/4.1.1/libgcc.a(_fixunsdfsi.o): -In function `__fixunsdfsi': -libgcc2.c:(.text+0x34): undefined reference to `__fixdfsi' -make[2]: *** [lib/libc.so] Error 1 -make[1]: *** [lib/libc.so.0] Error 2 -make[1]: Leaving directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' -make: *** [/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc/lib/libc.a] -Error 2 - -The second hunk fixes building final gcc because soft-float implies using -lfloat (which we don't have). - - -diff -dur gcc-4.2.0.orig/gcc/config.gcc gcc-4.2.0/gcc/config.gcc ---- gcc-4.2.0.orig/gcc/config.gcc 2007-07-15 11:24:18.000000000 +0200 -+++ gcc-4.2.0/gcc/config.gcc 2007-07-15 11:26:02.000000000 +0200 -@@ -721,7 +721,7 @@ - default_use_cxa_atexit=yes - ;; - *) -- tmake_file="$tmake_file arm/t-linux" -+ tmake_file="$tmake_file arm/t-linux arm/t-arm-elf" - ;; - esac - tm_file="$tm_file arm/aout.h arm/arm.h" -diff -dur gcc-4.2.0.orig/gcc/config/arm/linux-elf.h gcc-4.2.0/gcc/config/arm/linux-elf.h ---- gcc-4.2.0.orig/gcc/config/arm/linux-elf.h 2007-07-15 11:24:18.000000000 +0200 -+++ gcc-4.2.0/gcc/config/arm/linux-elf.h 2007-07-15 11:26:02.000000000 +0200 -@@ -63,7 +63,7 @@ - %{shared:-lc} \ - %{!shared:%{profile:-lc_p}%{!profile:-lc}}" - --#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" -+#define LIBGCC_SPEC "-lgcc" - - #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" - diff --git a/patches/gcc/4.2.2/904-flatten-switch-stmt-00.patch b/patches/gcc/4.2.2/904-flatten-switch-stmt-00.patch deleted file mode 100644 index 6c40c57..0000000 --- a/patches/gcc/4.2.2/904-flatten-switch-stmt-00.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -durN gcc-4.2.1.orig/gcc/stmt.c gcc-4.2.1/gcc/stmt.c ---- gcc-4.2.1.orig/gcc/stmt.c 2007-07-19 05:25:32.000000000 +0200 -+++ gcc-4.2.1/gcc/stmt.c 2007-08-03 20:37:19.000000000 +0200 -@@ -2512,7 +2512,11 @@ - 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); - } -@@ -3070,6 +3074,7 @@ - { - 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, diff --git a/patches/gcc/4.2.2/920-soft-float.patch b/patches/gcc/4.2.2/920-soft-float.patch deleted file mode 100644 index 4287bfa..0000000 --- a/patches/gcc/4.2.2/920-soft-float.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -uNpr gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c ---- gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c 2007-03-05 11:54:00.000000000 -0500 -+++ gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c 2008-01-31 17:51:24.000000000 -0500 -@@ -70,6 +70,8 @@ Software Foundation, 51 Franklin Street, - but GCC currently generates poor code when a union is used to turn - a long double into a pair of doubles. */ - -+#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) -+ - long double __gcc_qadd (double, double, double, double); - long double __gcc_qsub (double, double, double, double); - long double __gcc_qmul (double, double, double, double); -@@ -219,8 +221,6 @@ __gcc_qdiv (double a, double b, double c - return z.ldval; - } - --#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) -- - long double __gcc_qneg (double, double); - int __gcc_qeq (double, double, double, double); - int __gcc_qne (double, double, double, double); diff --git a/patches/gcc/4.2.2/940-alpha-signal_h.patch b/patches/gcc/4.2.2/940-alpha-signal_h.patch deleted file mode 100644 index d7e1796..0000000 --- a/patches/gcc/4.2.2/940-alpha-signal_h.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- gcc-4.2.1-stock/gcc/config/alpha/linux-unwind.h 2005-06-24 20:22:41.000000000 -0500 -+++ gcc-4.2.1/gcc/config/alpha/linux-unwind.h 2007-09-01 20:21:34.000000000 -0500 -@@ -29,6 +29,9 @@ Boston, MA 02110-1301, USA. */ - /* Do code reading to identify a signal frame, and set the frame - state data appropriately. See unwind-dw2.c for the structs. */ - -+/* Don't use this if inhibit_libc is set -+ The build for this target will fail trying to include missing headers */ -+#ifndef inhibit_libc - #include - #include - -@@ -80,3 +83,4 @@ alpha_fallback_frame_state (struct _Unwi - fs->retaddr_column = 64; - return _URC_NO_REASON; - } -+#endif /* inhibit_libc */ diff --git a/patches/gcc/4.2.3/103-uclibc-conf-noupstream.patch b/patches/gcc/4.2.3/103-uclibc-conf-noupstream.patch deleted file mode 100644 index 1c239d6..0000000 --- a/patches/gcc/4.2.3/103-uclibc-conf-noupstream.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc ---- gcc-4.2.1.orig/gcc/config.gcc 2007-02-03 06:25:20.000000000 +0100 -+++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200 -@@ -1964,7 +1964,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/patches/gcc/4.2.3/110-uclibc-conf-noupstream.patch b/patches/gcc/4.2.3/110-uclibc-conf-noupstream.patch new file mode 100644 index 0000000..1c239d6 --- /dev/null +++ b/patches/gcc/4.2.3/110-uclibc-conf-noupstream.patch @@ -0,0 +1,12 @@ +diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc +--- gcc-4.2.1.orig/gcc/config.gcc 2007-02-03 06:25:20.000000000 +0100 ++++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200 +@@ -1964,7 +1964,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/patches/gcc/4.2.3/120-uclibc-locale.patch b/patches/gcc/4.2.3/120-uclibc-locale.patch new file mode 100644 index 0000000..298c505 --- /dev/null +++ b/patches/gcc/4.2.3/120-uclibc-locale.patch @@ -0,0 +1,2806 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 gcc-4.2.1/libstdc++-v3/acinclude.m4 +--- gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 2007-06-29 01:02:05.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/acinclude.m4 2007-08-03 20:30:21.000000000 +0200 +@@ -1334,7 +1334,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 +@@ -1355,6 +1355,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) + enable_clocale_flag=gnu + ;; +@@ -1526,6 +1529,40 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ AC_MSG_RESULT(uclibc) ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ AC_SUBST(glibcxx_MOFILES) ++ AC_SUBST(glibcxx_POFILES) ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include // For errno ++#include ++#include ++#include ++#include ++ ++#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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#ifndef _C_LOCALE_H ++#define _C_LOCALE_H 1 ++ ++#pragma GCC system_header ++ ++#include // get std::strlen ++#include // get std::snprintf or std::sprintf ++#include ++#include // For codecvt ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC_HAS_LOCALE__ ++#include // For codecvt using iconv, iconv_t ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#include // 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 ++ 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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++namespace std ++{ ++ // Specializations. ++#ifdef _GLIBCXX_USE_WCHAR_T ++ codecvt_base::result ++ codecvt:: ++ 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(-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(__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:: ++ 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(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(-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(-1) ++ || __conv == static_cast(-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:: ++ 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:: ++ 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:: ++ 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(__builtin_alloca(sizeof(wchar_t) ++ * __max)); ++ while (__from < __end && __max) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast(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(-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(-1) ++ || __conv == static_cast(-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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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::_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::_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::_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::_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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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 specializations are in src/locale.cc and ++ // various /config/os/* files. ++ template<> ++ ctype_byname::ctype_byname(const char* __s, size_t __refs) ++ : ctype(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::__wmask_type ++ ctype::_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::do_toupper(wchar_t __c) const ++ { return __towupper_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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::do_tolower(wchar_t __c) const ++ { return __towlower_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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:: ++ 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:: ++ 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:: ++ 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:: ++ 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:: ++ do_widen(char __c) const ++ { return _M_widen[static_cast(__c)]; } ++ ++ const char* ++ ctype:: ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const ++ { ++ while (__lo < __hi) ++ { ++ *__dest = _M_widen[static_cast(*__lo)]; ++ ++__lo; ++ ++__dest; ++ } ++ return __hi; ++ } ++ ++ char ++ ctype:: ++ 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(__c)); ++ } ++ ++ const wchar_t* ++ ctype:: ++ 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(__c)); ++ } ++ ++__lo; ++ ++__dest; ++ } ++ else ++ while (__lo < __hi) ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast(__c)); ++ ++__lo; ++ ++__dest; ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __hi; ++ } ++ ++ void ++ ctype::_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(__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(_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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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::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(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::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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#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 ++ messages<_CharT>::messages(size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), ++ _M_name_messages(_S_get_c_name()) ++ { } ++ ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::open(const basic_string& __s, const locale& __loc, ++ const char* __dir) const ++ { ++ __bindtextdomain(__s.c_str(), __dir); ++ return this->do_open(__s, __loc); ++ } ++ ++ // Virtual member functions. ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::do_open(const basic_string& __s, ++ const locale&) const ++ { ++ // No error checking is done, assume the catalog exists and can ++ // be used. ++ __textdomain(__s.c_str()); ++ return 0; ++ } ++ ++ template ++ void ++ messages<_CharT>::do_close(catalog) const ++ { } ++ ++ // messages_byname ++ template ++ 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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::~moneypunct() ++ { delete _M_data; } ++ ++ template<> ++ moneypunct::~moneypunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ moneypunct::_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; ++ ++ 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(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::_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; ++ ++ 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(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::~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::~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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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::~numpunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ numpunct::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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(__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(__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::~numpunct() ++ { delete _M_data; } ++ #endif ++} +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++ 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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++#warning wide time stuff ++// if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = L"%m/%d/%y"; ++ _M_data->_M_date_era_format = L"%m/%d/%y"; ++ _M_data->_M_time_format = L"%H:%M:%S"; ++ _M_data->_M_time_era_format = L"%H:%M:%S"; ++ _M_data->_M_date_time_format = L""; ++ _M_data->_M_date_time_era_format = L""; ++ _M_data->_M_am = L"AM"; ++ _M_data->_M_pm = L"PM"; ++ _M_data->_M_am_pm_format = L""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = L"Sunday"; ++ _M_data->_M_day2 = L"Monday"; ++ _M_data->_M_day3 = L"Tuesday"; ++ _M_data->_M_day4 = L"Wednesday"; ++ _M_data->_M_day5 = L"Thursday"; ++ _M_data->_M_day6 = L"Friday"; ++ _M_data->_M_day7 = L"Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = L"Sun"; ++ _M_data->_M_aday2 = L"Mon"; ++ _M_data->_M_aday3 = L"Tue"; ++ _M_data->_M_aday4 = L"Wed"; ++ _M_data->_M_aday5 = L"Thu"; ++ _M_data->_M_aday6 = L"Fri"; ++ _M_data->_M_aday7 = L"Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = L"January"; ++ _M_data->_M_month02 = L"February"; ++ _M_data->_M_month03 = L"March"; ++ _M_data->_M_month04 = L"April"; ++ _M_data->_M_month05 = L"May"; ++ _M_data->_M_month06 = L"June"; ++ _M_data->_M_month07 = L"July"; ++ _M_data->_M_month08 = L"August"; ++ _M_data->_M_month09 = L"September"; ++ _M_data->_M_month10 = L"October"; ++ _M_data->_M_month11 = L"November"; ++ _M_data->_M_month12 = L"December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = L"Jan"; ++ _M_data->_M_amonth02 = L"Feb"; ++ _M_data->_M_amonth03 = L"Mar"; ++ _M_data->_M_amonth04 = L"Apr"; ++ _M_data->_M_amonth05 = L"May"; ++ _M_data->_M_amonth06 = L"Jun"; ++ _M_data->_M_amonth07 = L"Jul"; ++ _M_data->_M_amonth08 = L"Aug"; ++ _M_data->_M_amonth09 = L"Sep"; ++ _M_data->_M_amonth10 = L"Oct"; ++ _M_data->_M_amonth11 = L"Nov"; ++ _M_data->_M_amonth12 = L"Dec"; ++ } ++#if 0 ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ union { char *__s; wchar_t *__w; } __u; ++ ++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); ++ _M_data->_M_date_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); ++ _M_data->_M_date_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); ++ _M_data->_M_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); ++ _M_data->_M_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); ++ _M_data->_M_date_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); ++ _M_data->_M_date_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); ++ _M_data->_M_am = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); ++ _M_data->_M_pm = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); ++ _M_data->_M_am_pm_format = __u.__w; ++ ++ // Day names, starting with "C"'s Sunday. ++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); ++ _M_data->_M_day1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); ++ _M_data->_M_day2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); ++ _M_data->_M_day3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); ++ _M_data->_M_day4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); ++ _M_data->_M_day5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); ++ _M_data->_M_day6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); ++ _M_data->_M_day7 = __u.__w; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); ++ _M_data->_M_aday1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); ++ _M_data->_M_aday2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); ++ _M_data->_M_aday3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); ++ _M_data->_M_aday4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); ++ _M_data->_M_aday5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); ++ _M_data->_M_aday6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); ++ _M_data->_M_aday7 = __u.__w; ++ ++ // Month names, starting with "C"'s January. ++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); ++ _M_data->_M_month01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); ++ _M_data->_M_month02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); ++ _M_data->_M_month03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); ++ _M_data->_M_month04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); ++ _M_data->_M_month05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); ++ _M_data->_M_month06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); ++ _M_data->_M_month07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); ++ _M_data->_M_month08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); ++ _M_data->_M_month09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); ++ _M_data->_M_month10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); ++ _M_data->_M_month11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); ++ _M_data->_M_month12 = __u.__w; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); ++ _M_data->_M_amonth01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); ++ _M_data->_M_amonth02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); ++ _M_data->_M_amonth03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); ++ _M_data->_M_amonth04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); ++ _M_data->_M_amonth05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); ++ _M_data->_M_amonth06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); ++ _M_data->_M_amonth07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); ++ _M_data->_M_amonth08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); ++ _M_data->_M_amonth09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); ++ _M_data->_M_amonth10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); ++ _M_data->_M_amonth11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); ++ _M_data->_M_amonth12 = __u.__w; ++ } ++#endif // 0 ++ } ++#endif ++} +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++ template ++ __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 ++ __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 ++ __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 ++ __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 -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure +--- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:29:22.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200 +@@ -5769,7 +5769,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; }; } ;; +@@ -5802,6 +5802,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) + enable_clocale_flag=gnu + ;; +@@ -6190,6 +6193,76 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ echo "$as_me:$LINENO: result: uclibc" >&5 ++echo "${ECHO_T}uclibc" >&6 ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ # Extract the first word of "msgfmt", so it can be a program name with args. ++set dummy msgfmt; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test -n "$check_msgfmt"; then ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_check_msgfmt="yes" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" ++fi ++fi ++check_msgfmt=$ac_cv_prog_check_msgfmt ++if test -n "$check_msgfmt"; then ++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 ++echo "${ECHO_T}$check_msgfmt" >&6 ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ ++ ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h +--- gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h 2005-08-17 04:28:44.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h +--- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h 2006-12-07 10:33:51.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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/patches/gcc/4.2.3/130-uclibc-locale-no__x.patch b/patches/gcc/4.2.3/130-uclibc-locale-no__x.patch new file mode 100644 index 0000000..d88dc22 --- /dev/null +++ b/patches/gcc/4.2.3/130-uclibc-locale-no__x.patch @@ -0,0 +1,223 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -39,20 +39,6 @@ + #include + #include + +-#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<> +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200 +@@ -68,6 +68,7 @@ + { + extern "C" __typeof(uselocale) __uselocale; + } ++#define __uselocale uselocale + #endif + + namespace std +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:53.000000000 +0200 +@@ -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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -36,13 +36,6 @@ + #include + #include + +-#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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -38,13 +38,6 @@ + #undef _LIBC + #include + +-#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 specializations are in src/locale.cc and +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -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 + +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200 +@@ -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& __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; + } + +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -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: +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -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 + { +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -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 + { diff --git a/patches/gcc/4.2.3/140-uclibc-locale-wchar_fix.patch b/patches/gcc/4.2.3/140-uclibc-locale-wchar_fix.patch new file mode 100644 index 0000000..077bb56 --- /dev/null +++ b/patches/gcc/4.2.3/140-uclibc-locale-wchar_fix.patch @@ -0,0 +1,50 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200 +@@ -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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200 +@@ -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/patches/gcc/4.2.3/150-uclibc-locale-update.patch b/patches/gcc/4.2.3/150-uclibc-locale-update.patch new file mode 100644 index 0000000..534f4e4 --- /dev/null +++ b/patches/gcc/4.2.3/150-uclibc-locale-update.patch @@ -0,0 +1,354 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:31:54.000000000 +0200 +@@ -46,16 +46,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 +60,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 +74,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 +101,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); + } + +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:31:54.000000000 +0200 +@@ -39,21 +39,23 @@ + #pragma GCC system_header + + #include // get std::strlen +-#include // get std::snprintf or std::sprintf ++#include // get std::vsnprintf or std::vsprintf + #include + #include // For codecvt + #ifdef __UCLIBC_MJN3_ONLY__ + #warning fix this + #endif +-#ifdef __UCLIBC_HAS_LOCALE__ ++#ifdef _GLIBCXX_USE_ICONV + #include // For codecvt using iconv, iconv_t + #endif +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ +-#include // For messages ++#ifdef HAVE_LIBINTL_H ++#include // For messages + #endif ++#include + + #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 +- 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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:31:54.000000000 +0200 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + namespace std +@@ -138,20 +143,34 @@ + ctype:: + 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:: + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200 +@@ -47,18 +47,21 @@ + template + 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 + 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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:54.000000000 +0200 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + #ifdef __UCLIBC_MJN3_ONLY__ +@@ -206,7 +211,7 @@ + } + break; + default: +- ; ++ __ret = pattern(); + } + return __ret; + } +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:54.000000000 +0200 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + #ifdef __UCLIBC_MJN3_ONLY__ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200 +@@ -37,25 +37,33 @@ + template + __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 + __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 + __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 diff --git a/patches/gcc/4.2.3/160-libstdc++-pic.patch b/patches/gcc/4.2.3/160-libstdc++-pic.patch new file mode 100644 index 0000000..7244d4c --- /dev/null +++ b/patches/gcc/4.2.3/160-libstdc++-pic.patch @@ -0,0 +1,50 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am gcc-4.2.1/libstdc++-v3/src/Makefile.am +--- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am 2006-07-28 06:57:34.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/src/Makefile.am 2007-08-03 20:32:27.000000000 +0200 +@@ -257,6 +257,12 @@ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ + + ++install-exec-local: ++ifeq ($(enable_shared),yes) ++ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++endif ++ + # Added bits to build debug library. + if GLIBCXX_BUILD_DEBUG + all-local: build_debug +diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in gcc-4.2.1/libstdc++-v3/src/Makefile.in +--- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in 2006-10-16 21:08:22.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/src/Makefile.in 2007-08-03 20:32:27.000000000 +0200 +@@ -657,7 +657,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 + +@@ -690,6 +690,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 \ +@@ -799,6 +800,13 @@ + install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ++ ++install-exec-local: ++ifeq ($(enable_shared),yes) ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++endif ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff --git a/patches/gcc/4.2.3/170-missing-execinfo_h.patch b/patches/gcc/4.2.3/170-missing-execinfo_h.patch new file mode 100644 index 0000000..ff67899 --- /dev/null +++ b/patches/gcc/4.2.3/170-missing-execinfo_h.patch @@ -0,0 +1,12 @@ +diff -durN gcc-4.2.1.orig/boehm-gc/include/gc.h gcc-4.2.1/boehm-gc/include/gc.h +--- gcc-4.2.1.orig/boehm-gc/include/gc.h 2006-09-18 20:45:08.000000000 +0200 ++++ gcc-4.2.1/boehm-gc/include/gc.h 2007-08-03 20:33:00.000000000 +0200 +@@ -502,7 +502,7 @@ + #if defined(__linux__) || defined(__GLIBC__) + # include + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/patches/gcc/4.2.3/180-c99-snprintf.patch b/patches/gcc/4.2.3/180-c99-snprintf.patch new file mode 100644 index 0000000..ddb0c34 --- /dev/null +++ b/patches/gcc/4.2.3/180-c99-snprintf.patch @@ -0,0 +1,12 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h +--- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h 2006-12-07 10:33:51.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h 2007-08-03 20:33:24.000000000 +0200 +@@ -144,7 +144,7 @@ + + _GLIBCXX_END_NAMESPACE + +-#if _GLIBCXX_USE_C99 ++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf diff --git a/patches/gcc/4.2.3/190-c99-complex-ugly-hack.patch b/patches/gcc/4.2.3/190-c99-complex-ugly-hack.patch new file mode 100644 index 0000000..de6d71c --- /dev/null +++ b/patches/gcc/4.2.3/190-c99-complex-ugly-hack.patch @@ -0,0 +1,13 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure +--- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:33:56.000000000 +0200 +@@ -7514,6 +7514,9 @@ + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + #include ++#ifdef __UCLIBC__ ++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs ++#endif + int + main () + { diff --git a/patches/gcc/4.2.3/200-index_macro.patch b/patches/gcc/4.2.3/200-index_macro.patch new file mode 100644 index 0000000..1e56b5d --- /dev/null +++ b/patches/gcc/4.2.3/200-index_macro.patch @@ -0,0 +1,26 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/rope gcc-4.2.1/libstdc++-v3/include/ext/rope +--- gcc-4.2.1.orig/libstdc++-v3/include/ext/rope 2006-10-17 13:56:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/include/ext/rope 2007-08-03 20:34:23.000000000 +0200 +@@ -58,6 +58,9 @@ + #include + #include + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + # ifdef __GC + # define __GC_CONST const + # else +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h +--- gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h 2006-10-17 13:56:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h 2007-08-03 20:34:23.000000000 +0200 +@@ -54,6 +54,9 @@ + #include // For uninitialized_copy_n + #include // For power + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + + using std::size_t; diff --git a/patches/gcc/4.2.3/200-uclibc-locale.patch b/patches/gcc/4.2.3/200-uclibc-locale.patch deleted file mode 100644 index 298c505..0000000 --- a/patches/gcc/4.2.3/200-uclibc-locale.patch +++ /dev/null @@ -1,2806 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 gcc-4.2.1/libstdc++-v3/acinclude.m4 ---- gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 2007-06-29 01:02:05.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/acinclude.m4 2007-08-03 20:30:21.000000000 +0200 -@@ -1334,7 +1334,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 -@@ -1355,6 +1355,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) - enable_clocale_flag=gnu - ;; -@@ -1526,6 +1529,40 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ AC_MSG_RESULT(uclibc) -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ AC_SUBST(glibcxx_MOFILES) -+ AC_SUBST(glibcxx_POFILES) -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include // For errno -+#include -+#include -+#include -+#include -+ -+#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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#ifndef _C_LOCALE_H -+#define _C_LOCALE_H 1 -+ -+#pragma GCC system_header -+ -+#include // get std::strlen -+#include // get std::snprintf or std::sprintf -+#include -+#include // For codecvt -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this -+#endif -+#ifdef __UCLIBC_HAS_LOCALE__ -+#include // For codecvt using iconv, iconv_t -+#endif -+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ -+#include // 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 -+ 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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+namespace std -+{ -+ // Specializations. -+#ifdef _GLIBCXX_USE_WCHAR_T -+ codecvt_base::result -+ codecvt:: -+ 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(-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(__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:: -+ 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(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(-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(-1) -+ || __conv == static_cast(-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:: -+ 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:: -+ 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:: -+ 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(__builtin_alloca(sizeof(wchar_t) -+ * __max)); -+ while (__from < __end && __max) -+ { -+ const extern_type* __from_chunk_end; -+ __from_chunk_end = static_cast(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(-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(-1) -+ || __conv == static_cast(-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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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::_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::_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::_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::_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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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 specializations are in src/locale.cc and -+ // various /config/os/* files. -+ template<> -+ ctype_byname::ctype_byname(const char* __s, size_t __refs) -+ : ctype(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::__wmask_type -+ ctype::_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::do_toupper(wchar_t __c) const -+ { return __towupper_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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::do_tolower(wchar_t __c) const -+ { return __towlower_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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:: -+ 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:: -+ 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:: -+ 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:: -+ 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:: -+ do_widen(char __c) const -+ { return _M_widen[static_cast(__c)]; } -+ -+ const char* -+ ctype:: -+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const -+ { -+ while (__lo < __hi) -+ { -+ *__dest = _M_widen[static_cast(*__lo)]; -+ ++__lo; -+ ++__dest; -+ } -+ return __hi; -+ } -+ -+ char -+ ctype:: -+ 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(__c)); -+ } -+ -+ const wchar_t* -+ ctype:: -+ 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(__c)); -+ } -+ ++__lo; -+ ++__dest; -+ } -+ else -+ while (__lo < __hi) -+ { -+ const int __c = wctob(*__lo); -+ *__dest = (__c == EOF ? __dfault : static_cast(__c)); -+ ++__lo; -+ ++__dest; -+ } -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ return __hi; -+ } -+ -+ void -+ ctype::_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(__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(_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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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::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(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::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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#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 -+ messages<_CharT>::messages(size_t __refs) -+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), -+ _M_name_messages(_S_get_c_name()) -+ { } -+ -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::open(const basic_string& __s, const locale& __loc, -+ const char* __dir) const -+ { -+ __bindtextdomain(__s.c_str(), __dir); -+ return this->do_open(__s, __loc); -+ } -+ -+ // Virtual member functions. -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::do_open(const basic_string& __s, -+ const locale&) const -+ { -+ // No error checking is done, assume the catalog exists and can -+ // be used. -+ __textdomain(__s.c_str()); -+ return 0; -+ } -+ -+ template -+ void -+ messages<_CharT>::do_close(catalog) const -+ { } -+ -+ // messages_byname -+ template -+ 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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::~moneypunct() -+ { delete _M_data; } -+ -+ template<> -+ moneypunct::~moneypunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ moneypunct::_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; -+ -+ 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(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::_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; -+ -+ 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(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::~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::~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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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::~numpunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ numpunct::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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(__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(__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::~numpunct() -+ { delete _M_data; } -+ #endif -+} -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+ 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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+#warning wide time stuff -+// if (!__cloc) -+ { -+ // "C" locale -+ _M_c_locale_timepunct = _S_get_c_locale(); -+ -+ _M_data->_M_date_format = L"%m/%d/%y"; -+ _M_data->_M_date_era_format = L"%m/%d/%y"; -+ _M_data->_M_time_format = L"%H:%M:%S"; -+ _M_data->_M_time_era_format = L"%H:%M:%S"; -+ _M_data->_M_date_time_format = L""; -+ _M_data->_M_date_time_era_format = L""; -+ _M_data->_M_am = L"AM"; -+ _M_data->_M_pm = L"PM"; -+ _M_data->_M_am_pm_format = L""; -+ -+ // Day names, starting with "C"'s Sunday. -+ _M_data->_M_day1 = L"Sunday"; -+ _M_data->_M_day2 = L"Monday"; -+ _M_data->_M_day3 = L"Tuesday"; -+ _M_data->_M_day4 = L"Wednesday"; -+ _M_data->_M_day5 = L"Thursday"; -+ _M_data->_M_day6 = L"Friday"; -+ _M_data->_M_day7 = L"Saturday"; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ _M_data->_M_aday1 = L"Sun"; -+ _M_data->_M_aday2 = L"Mon"; -+ _M_data->_M_aday3 = L"Tue"; -+ _M_data->_M_aday4 = L"Wed"; -+ _M_data->_M_aday5 = L"Thu"; -+ _M_data->_M_aday6 = L"Fri"; -+ _M_data->_M_aday7 = L"Sat"; -+ -+ // Month names, starting with "C"'s January. -+ _M_data->_M_month01 = L"January"; -+ _M_data->_M_month02 = L"February"; -+ _M_data->_M_month03 = L"March"; -+ _M_data->_M_month04 = L"April"; -+ _M_data->_M_month05 = L"May"; -+ _M_data->_M_month06 = L"June"; -+ _M_data->_M_month07 = L"July"; -+ _M_data->_M_month08 = L"August"; -+ _M_data->_M_month09 = L"September"; -+ _M_data->_M_month10 = L"October"; -+ _M_data->_M_month11 = L"November"; -+ _M_data->_M_month12 = L"December"; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ _M_data->_M_amonth01 = L"Jan"; -+ _M_data->_M_amonth02 = L"Feb"; -+ _M_data->_M_amonth03 = L"Mar"; -+ _M_data->_M_amonth04 = L"Apr"; -+ _M_data->_M_amonth05 = L"May"; -+ _M_data->_M_amonth06 = L"Jun"; -+ _M_data->_M_amonth07 = L"Jul"; -+ _M_data->_M_amonth08 = L"Aug"; -+ _M_data->_M_amonth09 = L"Sep"; -+ _M_data->_M_amonth10 = L"Oct"; -+ _M_data->_M_amonth11 = L"Nov"; -+ _M_data->_M_amonth12 = L"Dec"; -+ } -+#if 0 -+ else -+ { -+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); -+ -+ union { char *__s; wchar_t *__w; } __u; -+ -+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); -+ _M_data->_M_date_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); -+ _M_data->_M_date_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); -+ _M_data->_M_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); -+ _M_data->_M_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); -+ _M_data->_M_date_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); -+ _M_data->_M_date_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); -+ _M_data->_M_am = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); -+ _M_data->_M_pm = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); -+ _M_data->_M_am_pm_format = __u.__w; -+ -+ // Day names, starting with "C"'s Sunday. -+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); -+ _M_data->_M_day1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); -+ _M_data->_M_day2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); -+ _M_data->_M_day3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); -+ _M_data->_M_day4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); -+ _M_data->_M_day5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); -+ _M_data->_M_day6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); -+ _M_data->_M_day7 = __u.__w; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); -+ _M_data->_M_aday1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); -+ _M_data->_M_aday2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); -+ _M_data->_M_aday3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); -+ _M_data->_M_aday4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); -+ _M_data->_M_aday5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); -+ _M_data->_M_aday6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); -+ _M_data->_M_aday7 = __u.__w; -+ -+ // Month names, starting with "C"'s January. -+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); -+ _M_data->_M_month01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); -+ _M_data->_M_month02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); -+ _M_data->_M_month03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); -+ _M_data->_M_month04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); -+ _M_data->_M_month05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); -+ _M_data->_M_month06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); -+ _M_data->_M_month07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); -+ _M_data->_M_month08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); -+ _M_data->_M_month09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); -+ _M_data->_M_month10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); -+ _M_data->_M_month11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); -+ _M_data->_M_month12 = __u.__w; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); -+ _M_data->_M_amonth01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); -+ _M_data->_M_amonth02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); -+ _M_data->_M_amonth03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); -+ _M_data->_M_amonth04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); -+ _M_data->_M_amonth05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); -+ _M_data->_M_amonth06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); -+ _M_data->_M_amonth07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); -+ _M_data->_M_amonth08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); -+ _M_data->_M_amonth09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); -+ _M_data->_M_amonth10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); -+ _M_data->_M_amonth11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); -+ _M_data->_M_amonth12 = __u.__w; -+ } -+#endif // 0 -+ } -+#endif -+} -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+ template -+ __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 -+ __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 -+ __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 -+ __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 -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure ---- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:29:22.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200 -@@ -5769,7 +5769,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; }; } ;; -@@ -5802,6 +5802,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) - enable_clocale_flag=gnu - ;; -@@ -6190,6 +6193,76 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ echo "$as_me:$LINENO: result: uclibc" >&5 -+echo "${ECHO_T}uclibc" >&6 -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ # Extract the first word of "msgfmt", so it can be a program name with args. -+set dummy msgfmt; ac_word=$2 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_check_msgfmt+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$check_msgfmt"; then -+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. -+else -+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -+for as_dir in $PATH -+do -+ IFS=$as_save_IFS -+ test -z "$as_dir" && as_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_check_msgfmt="yes" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done -+ -+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" -+fi -+fi -+check_msgfmt=$ac_cv_prog_check_msgfmt -+if test -n "$check_msgfmt"; then -+ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 -+echo "${ECHO_T}$check_msgfmt" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ -+ -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the -diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h ---- gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h 2005-08-17 04:28:44.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h ---- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h 2006-12-07 10:33:51.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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/patches/gcc/4.2.3/203-uclibc-locale-no__x.patch b/patches/gcc/4.2.3/203-uclibc-locale-no__x.patch deleted file mode 100644 index d88dc22..0000000 --- a/patches/gcc/4.2.3/203-uclibc-locale-no__x.patch +++ /dev/null @@ -1,223 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -39,20 +39,6 @@ - #include - #include - --#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<> -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200 -@@ -68,6 +68,7 @@ - { - extern "C" __typeof(uselocale) __uselocale; - } -+#define __uselocale uselocale - #endif - - namespace std -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:53.000000000 +0200 -@@ -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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -36,13 +36,6 @@ - #include - #include - --#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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -38,13 +38,6 @@ - #undef _LIBC - #include - --#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 specializations are in src/locale.cc and -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -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 - -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200 -@@ -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& __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; - } - -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -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: -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -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 - { -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -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 - { diff --git a/patches/gcc/4.2.3/204-uclibc-locale-wchar_fix.patch b/patches/gcc/4.2.3/204-uclibc-locale-wchar_fix.patch deleted file mode 100644 index 077bb56..0000000 --- a/patches/gcc/4.2.3/204-uclibc-locale-wchar_fix.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200 -@@ -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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200 -@@ -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/patches/gcc/4.2.3/205-uclibc-locale-update.patch b/patches/gcc/4.2.3/205-uclibc-locale-update.patch deleted file mode 100644 index 534f4e4..0000000 --- a/patches/gcc/4.2.3/205-uclibc-locale-update.patch +++ /dev/null @@ -1,354 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:31:54.000000000 +0200 -@@ -46,16 +46,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 +60,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 +74,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 +101,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); - } - -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:31:54.000000000 +0200 -@@ -39,21 +39,23 @@ - #pragma GCC system_header - - #include // get std::strlen --#include // get std::snprintf or std::sprintf -+#include // get std::vsnprintf or std::vsprintf - #include - #include // For codecvt - #ifdef __UCLIBC_MJN3_ONLY__ - #warning fix this - #endif --#ifdef __UCLIBC_HAS_LOCALE__ -+#ifdef _GLIBCXX_USE_ICONV - #include // For codecvt using iconv, iconv_t - #endif --#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ --#include // For messages -+#ifdef HAVE_LIBINTL_H -+#include // For messages - #endif -+#include - - #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 -- 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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:31:54.000000000 +0200 -@@ -33,9 +33,14 @@ - - // Written by Benjamin Kosnik - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - namespace std -@@ -138,20 +143,34 @@ - ctype:: - 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:: - do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200 -@@ -47,18 +47,21 @@ - template - 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 - 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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:54.000000000 +0200 -@@ -33,9 +33,14 @@ - - // Written by Benjamin Kosnik - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - #ifdef __UCLIBC_MJN3_ONLY__ -@@ -206,7 +211,7 @@ - } - break; - default: -- ; -+ __ret = pattern(); - } - return __ret; - } -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:54.000000000 +0200 -@@ -33,9 +33,14 @@ - - // Written by Benjamin Kosnik - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - #ifdef __UCLIBC_MJN3_ONLY__ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200 -@@ -37,25 +37,33 @@ - template - __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 - __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 - __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 diff --git a/patches/gcc/4.2.3/210-libmudflap-susv3-legacy.patch b/patches/gcc/4.2.3/210-libmudflap-susv3-legacy.patch new file mode 100644 index 0000000..26e8704 --- /dev/null +++ b/patches/gcc/4.2.3/210-libmudflap-susv3-legacy.patch @@ -0,0 +1,48 @@ +diff -durN gcc-4.2.1.orig/libmudflap/mf-hooks2.c gcc-4.2.1/libmudflap/mf-hooks2.c +--- gcc-4.2.1.orig/libmudflap/mf-hooks2.c 2005-09-23 23:58:39.000000000 +0200 ++++ gcc-4.2.1/libmudflap/mf-hooks2.c 2007-08-03 20:35:09.000000000 +0200 +@@ -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/patches/gcc/4.2.3/220-libstdc++-namespace.patch b/patches/gcc/4.2.3/220-libstdc++-namespace.patch new file mode 100644 index 0000000..709e8f2 --- /dev/null +++ b/patches/gcc/4.2.3/220-libstdc++-namespace.patch @@ -0,0 +1,36 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:35:40.000000000 +0200 +@@ -32,7 +32,8 @@ + // + + // Written by Benjamin Kosnik +- ++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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:35:40.000000000 +0200 +@@ -33,7 +33,8 @@ + // + + // Written by Benjamin Kosnik +- ++namespace std ++{ + template + __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/patches/gcc/4.2.3/230-libbackend_dep_gcov-iov.h.patch b/patches/gcc/4.2.3/230-libbackend_dep_gcov-iov.h.patch new file mode 100644 index 0000000..32754be --- /dev/null +++ b/patches/gcc/4.2.3/230-libbackend_dep_gcov-iov.h.patch @@ -0,0 +1,12 @@ +diff -durN gcc-4.2.1.orig/gcc/Makefile.in gcc-4.2.1/gcc/Makefile.in +--- gcc-4.2.1.orig/gcc/Makefile.in 2007-05-31 17:37:38.000000000 +0200 ++++ gcc-4.2.1/gcc/Makefile.in 2007-08-03 20:36:14.000000000 +0200 +@@ -2660,7 +2660,7 @@ + # FIXME: writing proper dependencies for this is a *LOT* of work. + libbackend.o : $(OBJS-common:.o=.c) $(out_file) \ + insn-config.h insn-flags.h insn-codes.h insn-constants.h \ +- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) ++ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ + -DTARGET_NAME=\"$(target_noncanonical)\" \ + -DLOCALEDIR=\"$(localedir)\" \ diff --git a/patches/gcc/4.2.3/240-arm-bigendian.patch b/patches/gcc/4.2.3/240-arm-bigendian.patch new file mode 100644 index 0000000..2abeccd --- /dev/null +++ b/patches/gcc/4.2.3/240-arm-bigendian.patch @@ -0,0 +1,64 @@ +diff -durN gcc-4.2.1.orig/gcc/config/arm/linux-elf.h gcc-4.2.1/gcc/config/arm/linux-elf.h +--- gcc-4.2.1.orig/gcc/config/arm/linux-elf.h 2006-02-17 00:29:10.000000000 +0100 ++++ gcc-4.2.1/gcc/config/arm/linux-elf.h 2007-08-03 20:36:43.000000000 +0200 +@@ -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 +diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc +--- gcc-4.2.1.orig/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200 ++++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:36:43.000000000 +0200 +@@ -705,6 +705,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/patches/gcc/4.2.3/250-softfloat-fix.patch b/patches/gcc/4.2.3/250-softfloat-fix.patch new file mode 100644 index 0000000..3517856 --- /dev/null +++ b/patches/gcc/4.2.3/250-softfloat-fix.patch @@ -0,0 +1,58 @@ +This patch (C) 2007 Yann E. MORIN +Licensed under GPL v2. + +First hunk of this patch solves compiling uClibc: + +make[1]: Entering directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' + LD libuClibc-0.9.29.so +libc/libc_so.a(difftime.os): In function `difftime': +difftime.c:(.text+0x8): undefined reference to `__floatsidf' +difftime.c:(.text+0x2c): undefined reference to `__subdf3' +libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr': +_fpmaxtostr.c:(.text+0xd4): undefined reference to `__nedf2' +_fpmaxtostr.c:(.text+0xf8): undefined reference to `__eqdf2' +_fpmaxtostr.c:(.text+0x114): undefined reference to `__divdf3' +_fpmaxtostr.c:(.text+0x120): undefined reference to `__ltdf2' +_fpmaxtostr.c:(.text+0x1c4): undefined reference to `__muldf3' +_fpmaxtostr.c:(.text+0x388): undefined reference to `__gedf2' +_fpmaxtostr.c:(.text+0x430): undefined reference to `__adddf3' +libc/libc_so.a(__psfs_do_numeric.os): In function `__psfs_do_numeric': +__psfs_do_numeric.c:(.text+0x520): undefined reference to `__truncdfsf2' +libc/libc_so.a(strtof.os): In function `strtof': +strtof.c:(.text+0x1c): undefined reference to `__extendsfdf2' +/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/cc_core_prefix/lib/gcc/arm-linux-uclibc/4.1.1/libgcc.a(_fixunsdfsi.o): +In function `__fixunsdfsi': +libgcc2.c:(.text+0x34): undefined reference to `__fixdfsi' +make[2]: *** [lib/libc.so] Error 1 +make[1]: *** [lib/libc.so.0] Error 2 +make[1]: Leaving directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' +make: *** [/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc/lib/libc.a] +Error 2 + +The second hunk fixes building final gcc because soft-float implies using -lfloat (which we don't have). + + +diff -dur gcc-4.2.0.orig/gcc/config.gcc gcc-4.2.0/gcc/config.gcc +--- gcc-4.2.0.orig/gcc/config.gcc 2007-07-15 11:24:18.000000000 +0200 ++++ gcc-4.2.0/gcc/config.gcc 2007-07-15 11:26:02.000000000 +0200 +@@ -721,7 +721,7 @@ + default_use_cxa_atexit=yes + ;; + *) +- tmake_file="$tmake_file arm/t-linux" ++ tmake_file="$tmake_file arm/t-linux arm/t-arm-elf" + ;; + esac + tm_file="$tm_file arm/aout.h arm/arm.h" +diff -dur gcc-4.2.0.orig/gcc/config/arm/linux-elf.h gcc-4.2.0/gcc/config/arm/linux-elf.h +--- gcc-4.2.0.orig/gcc/config/arm/linux-elf.h 2007-07-15 11:24:18.000000000 +0200 ++++ gcc-4.2.0/gcc/config/arm/linux-elf.h 2007-07-15 11:26:02.000000000 +0200 +@@ -63,7 +63,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" + diff --git a/patches/gcc/4.2.3/260-flatten-switch-stmt-00.patch b/patches/gcc/4.2.3/260-flatten-switch-stmt-00.patch new file mode 100644 index 0000000..6c40c57 --- /dev/null +++ b/patches/gcc/4.2.3/260-flatten-switch-stmt-00.patch @@ -0,0 +1,24 @@ +diff -durN gcc-4.2.1.orig/gcc/stmt.c gcc-4.2.1/gcc/stmt.c +--- gcc-4.2.1.orig/gcc/stmt.c 2007-07-19 05:25:32.000000000 +0200 ++++ gcc-4.2.1/gcc/stmt.c 2007-08-03 20:37:19.000000000 +0200 +@@ -2512,7 +2512,11 @@ + 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); + } +@@ -3070,6 +3074,7 @@ + { + 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, diff --git a/patches/gcc/4.2.3/270-soft-float.patch b/patches/gcc/4.2.3/270-soft-float.patch new file mode 100644 index 0000000..4287bfa --- /dev/null +++ b/patches/gcc/4.2.3/270-soft-float.patch @@ -0,0 +1,21 @@ +diff -uNpr gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c +--- gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c 2007-03-05 11:54:00.000000000 -0500 ++++ gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c 2008-01-31 17:51:24.000000000 -0500 +@@ -70,6 +70,8 @@ Software Foundation, 51 Franklin Street, + but GCC currently generates poor code when a union is used to turn + a long double into a pair of doubles. */ + ++#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) ++ + long double __gcc_qadd (double, double, double, double); + long double __gcc_qsub (double, double, double, double); + long double __gcc_qmul (double, double, double, double); +@@ -219,8 +221,6 @@ __gcc_qdiv (double a, double b, double c + return z.ldval; + } + +-#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) +- + long double __gcc_qneg (double, double); + int __gcc_qeq (double, double, double, double); + int __gcc_qne (double, double, double, double); diff --git a/patches/gcc/4.2.3/280-eabi_fixes.patch b/patches/gcc/4.2.3/280-eabi_fixes.patch new file mode 100644 index 0000000..7dce608 --- /dev/null +++ b/patches/gcc/4.2.3/280-eabi_fixes.patch @@ -0,0 +1,13 @@ +diff -durN gcc-4.2.3.orig/gcc/config/arm/linux-eabi.h gcc-4.2.3/gcc/config/arm/linux-eabi.h +--- gcc-4.2.3.orig/gcc/config/arm/linux-eabi.h 2007-09-01 17:28:30.000000000 +0200 ++++ gcc-4.2.3/gcc/config/arm/linux-eabi.h 2008-05-25 23:47:36.000000000 +0200 +@@ -47,7 +47,8 @@ + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi + + #undef SUBTARGET_EXTRA_LINK_SPEC +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi" ++#define SUBTARGET_EXTRA_LINK_SPEC \ ++ " %{mlittle-endian:-m armelf_linux_eabi} %{mbig-endian:-m armelfb_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/patches/gcc/4.2.3/290-alpha-signal_h.patch b/patches/gcc/4.2.3/290-alpha-signal_h.patch new file mode 100644 index 0000000..d7e1796 --- /dev/null +++ b/patches/gcc/4.2.3/290-alpha-signal_h.patch @@ -0,0 +1,17 @@ +--- gcc-4.2.1-stock/gcc/config/alpha/linux-unwind.h 2005-06-24 20:22:41.000000000 -0500 ++++ gcc-4.2.1/gcc/config/alpha/linux-unwind.h 2007-09-01 20:21:34.000000000 -0500 +@@ -29,6 +29,9 @@ Boston, MA 02110-1301, USA. */ + /* Do code reading to identify a signal frame, and set the frame + state data appropriately. See unwind-dw2.c for the structs. */ + ++/* Don't use this if inhibit_libc is set ++ The build for this target will fail trying to include missing headers */ ++#ifndef inhibit_libc + #include + #include + +@@ -80,3 +83,4 @@ alpha_fallback_frame_state (struct _Unwi + fs->retaddr_column = 64; + return _URC_NO_REASON; + } ++#endif /* inhibit_libc */ diff --git a/patches/gcc/4.2.3/300-fortran-signed-TImode.patch b/patches/gcc/4.2.3/300-fortran-signed-TImode.patch new file mode 100644 index 0000000..01e2f01 --- /dev/null +++ b/patches/gcc/4.2.3/300-fortran-signed-TImode.patch @@ -0,0 +1,43 @@ +Fix building gfortran for ARM. +http://gcc.gnu.org/ml/gcc-patches/2007-05/msg01010.html +---- + +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 + + gcc/fortran/ + * trans-types.c (gfc_type_for_size): Handle signed TImode. + +diff -durN gcc-4.2.3.old/gcc/fortran/trans-types.c gcc-4.2.3/gcc/fortran/trans-types.c +--- gcc-4.2.3.old/gcc/fortran/trans-types.c 2007-08-31 10:27:50.000000000 +0200 ++++ gcc-4.2.3/gcc/fortran/trans-types.c 2008-07-17 09:54:20.000000000 +0200 +@@ -1799,6 +1799,13 @@ + 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/patches/gcc/4.2.3/300-libstdc++-pic.patch b/patches/gcc/4.2.3/300-libstdc++-pic.patch deleted file mode 100644 index 7244d4c..0000000 --- a/patches/gcc/4.2.3/300-libstdc++-pic.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am gcc-4.2.1/libstdc++-v3/src/Makefile.am ---- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am 2006-07-28 06:57:34.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/src/Makefile.am 2007-08-03 20:32:27.000000000 +0200 -@@ -257,6 +257,12 @@ - $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ - - -+install-exec-local: -+ifeq ($(enable_shared),yes) -+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) -+endif -+ - # Added bits to build debug library. - if GLIBCXX_BUILD_DEBUG - all-local: build_debug -diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in gcc-4.2.1/libstdc++-v3/src/Makefile.in ---- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in 2006-10-16 21:08:22.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/src/Makefile.in 2007-08-03 20:32:27.000000000 +0200 -@@ -657,7 +657,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 - -@@ -690,6 +690,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 \ -@@ -799,6 +800,13 @@ - install_debug: - (cd ${debugdir} && $(MAKE) \ - toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) -+ -+install-exec-local: -+ifeq ($(enable_shared),yes) -+ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) -+endif -+ - # Tell versions [3.59,3.63) of GNU make to not export all variables. - # Otherwise a system limit (for SysV at least) may be exceeded. - .NOEXPORT: diff --git a/patches/gcc/4.2.3/301-missing-execinfo_h.patch b/patches/gcc/4.2.3/301-missing-execinfo_h.patch deleted file mode 100644 index ff67899..0000000 --- a/patches/gcc/4.2.3/301-missing-execinfo_h.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -durN gcc-4.2.1.orig/boehm-gc/include/gc.h gcc-4.2.1/boehm-gc/include/gc.h ---- gcc-4.2.1.orig/boehm-gc/include/gc.h 2006-09-18 20:45:08.000000000 +0200 -+++ gcc-4.2.1/boehm-gc/include/gc.h 2007-08-03 20:33:00.000000000 +0200 -@@ -502,7 +502,7 @@ - #if defined(__linux__) || defined(__GLIBC__) - # include - # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ -- && !defined(__ia64__) -+ && !defined(__ia64__) && !defined(__UCLIBC__) - # ifndef GC_HAVE_BUILTIN_BACKTRACE - # define GC_HAVE_BUILTIN_BACKTRACE - # endif diff --git a/patches/gcc/4.2.3/302-c99-snprintf.patch b/patches/gcc/4.2.3/302-c99-snprintf.patch deleted file mode 100644 index ddb0c34..0000000 --- a/patches/gcc/4.2.3/302-c99-snprintf.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h ---- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h 2006-12-07 10:33:51.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h 2007-08-03 20:33:24.000000000 +0200 -@@ -144,7 +144,7 @@ - - _GLIBCXX_END_NAMESPACE - --#if _GLIBCXX_USE_C99 -+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) - - #undef snprintf - #undef vfscanf diff --git a/patches/gcc/4.2.3/303-c99-complex-ugly-hack.patch b/patches/gcc/4.2.3/303-c99-complex-ugly-hack.patch deleted file mode 100644 index de6d71c..0000000 --- a/patches/gcc/4.2.3/303-c99-complex-ugly-hack.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure ---- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:33:56.000000000 +0200 -@@ -7514,6 +7514,9 @@ - cat >>conftest.$ac_ext <<_ACEOF - /* end confdefs.h. */ - #include -+#ifdef __UCLIBC__ -+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs -+#endif - int - main () - { diff --git a/patches/gcc/4.2.3/304-index_macro.patch b/patches/gcc/4.2.3/304-index_macro.patch deleted file mode 100644 index 1e56b5d..0000000 --- a/patches/gcc/4.2.3/304-index_macro.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/rope gcc-4.2.1/libstdc++-v3/include/ext/rope ---- gcc-4.2.1.orig/libstdc++-v3/include/ext/rope 2006-10-17 13:56:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/include/ext/rope 2007-08-03 20:34:23.000000000 +0200 -@@ -58,6 +58,9 @@ - #include - #include - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - # ifdef __GC - # define __GC_CONST const - # else -diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h ---- gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h 2006-10-17 13:56:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h 2007-08-03 20:34:23.000000000 +0200 -@@ -54,6 +54,9 @@ - #include // For uninitialized_copy_n - #include // For power - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) - - using std::size_t; diff --git a/patches/gcc/4.2.3/305-libmudflap-susv3-legacy.patch b/patches/gcc/4.2.3/305-libmudflap-susv3-legacy.patch deleted file mode 100644 index 26e8704..0000000 --- a/patches/gcc/4.2.3/305-libmudflap-susv3-legacy.patch +++ /dev/null @@ -1,48 +0,0 @@ -diff -durN gcc-4.2.1.orig/libmudflap/mf-hooks2.c gcc-4.2.1/libmudflap/mf-hooks2.c ---- gcc-4.2.1.orig/libmudflap/mf-hooks2.c 2005-09-23 23:58:39.000000000 +0200 -+++ gcc-4.2.1/libmudflap/mf-hooks2.c 2007-08-03 20:35:09.000000000 +0200 -@@ -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/patches/gcc/4.2.3/306-libstdc++-namespace.patch b/patches/gcc/4.2.3/306-libstdc++-namespace.patch deleted file mode 100644 index 709e8f2..0000000 --- a/patches/gcc/4.2.3/306-libstdc++-namespace.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:35:40.000000000 +0200 -@@ -32,7 +32,8 @@ - // - - // Written by Benjamin Kosnik -- -+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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:35:40.000000000 +0200 -@@ -33,7 +33,8 @@ - // - - // Written by Benjamin Kosnik -- -+namespace std -+{ - template - __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/patches/gcc/4.2.3/402-libbackend_dep_gcov-iov.h.patch b/patches/gcc/4.2.3/402-libbackend_dep_gcov-iov.h.patch deleted file mode 100644 index 32754be..0000000 --- a/patches/gcc/4.2.3/402-libbackend_dep_gcov-iov.h.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -durN gcc-4.2.1.orig/gcc/Makefile.in gcc-4.2.1/gcc/Makefile.in ---- gcc-4.2.1.orig/gcc/Makefile.in 2007-05-31 17:37:38.000000000 +0200 -+++ gcc-4.2.1/gcc/Makefile.in 2007-08-03 20:36:14.000000000 +0200 -@@ -2660,7 +2660,7 @@ - # FIXME: writing proper dependencies for this is a *LOT* of work. - libbackend.o : $(OBJS-common:.o=.c) $(out_file) \ - insn-config.h insn-flags.h insn-codes.h insn-constants.h \ -- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) -+ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ - -DTARGET_NAME=\"$(target_noncanonical)\" \ - -DLOCALEDIR=\"$(localedir)\" \ diff --git a/patches/gcc/4.2.3/800-arm-bigendian.patch b/patches/gcc/4.2.3/800-arm-bigendian.patch deleted file mode 100644 index 2abeccd..0000000 --- a/patches/gcc/4.2.3/800-arm-bigendian.patch +++ /dev/null @@ -1,64 +0,0 @@ -diff -durN gcc-4.2.1.orig/gcc/config/arm/linux-elf.h gcc-4.2.1/gcc/config/arm/linux-elf.h ---- gcc-4.2.1.orig/gcc/config/arm/linux-elf.h 2006-02-17 00:29:10.000000000 +0100 -+++ gcc-4.2.1/gcc/config/arm/linux-elf.h 2007-08-03 20:36:43.000000000 +0200 -@@ -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 -diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc ---- gcc-4.2.1.orig/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200 -+++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:36:43.000000000 +0200 -@@ -705,6 +705,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/patches/gcc/4.2.3/801-softfloat-fix.patch b/patches/gcc/4.2.3/801-softfloat-fix.patch deleted file mode 100644 index 3517856..0000000 --- a/patches/gcc/4.2.3/801-softfloat-fix.patch +++ /dev/null @@ -1,58 +0,0 @@ -This patch (C) 2007 Yann E. MORIN -Licensed under GPL v2. - -First hunk of this patch solves compiling uClibc: - -make[1]: Entering directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' - LD libuClibc-0.9.29.so -libc/libc_so.a(difftime.os): In function `difftime': -difftime.c:(.text+0x8): undefined reference to `__floatsidf' -difftime.c:(.text+0x2c): undefined reference to `__subdf3' -libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr': -_fpmaxtostr.c:(.text+0xd4): undefined reference to `__nedf2' -_fpmaxtostr.c:(.text+0xf8): undefined reference to `__eqdf2' -_fpmaxtostr.c:(.text+0x114): undefined reference to `__divdf3' -_fpmaxtostr.c:(.text+0x120): undefined reference to `__ltdf2' -_fpmaxtostr.c:(.text+0x1c4): undefined reference to `__muldf3' -_fpmaxtostr.c:(.text+0x388): undefined reference to `__gedf2' -_fpmaxtostr.c:(.text+0x430): undefined reference to `__adddf3' -libc/libc_so.a(__psfs_do_numeric.os): In function `__psfs_do_numeric': -__psfs_do_numeric.c:(.text+0x520): undefined reference to `__truncdfsf2' -libc/libc_so.a(strtof.os): In function `strtof': -strtof.c:(.text+0x1c): undefined reference to `__extendsfdf2' -/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/cc_core_prefix/lib/gcc/arm-linux-uclibc/4.1.1/libgcc.a(_fixunsdfsi.o): -In function `__fixunsdfsi': -libgcc2.c:(.text+0x34): undefined reference to `__fixdfsi' -make[2]: *** [lib/libc.so] Error 1 -make[1]: *** [lib/libc.so.0] Error 2 -make[1]: Leaving directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' -make: *** [/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc/lib/libc.a] -Error 2 - -The second hunk fixes building final gcc because soft-float implies using -lfloat (which we don't have). - - -diff -dur gcc-4.2.0.orig/gcc/config.gcc gcc-4.2.0/gcc/config.gcc ---- gcc-4.2.0.orig/gcc/config.gcc 2007-07-15 11:24:18.000000000 +0200 -+++ gcc-4.2.0/gcc/config.gcc 2007-07-15 11:26:02.000000000 +0200 -@@ -721,7 +721,7 @@ - default_use_cxa_atexit=yes - ;; - *) -- tmake_file="$tmake_file arm/t-linux" -+ tmake_file="$tmake_file arm/t-linux arm/t-arm-elf" - ;; - esac - tm_file="$tm_file arm/aout.h arm/arm.h" -diff -dur gcc-4.2.0.orig/gcc/config/arm/linux-elf.h gcc-4.2.0/gcc/config/arm/linux-elf.h ---- gcc-4.2.0.orig/gcc/config/arm/linux-elf.h 2007-07-15 11:24:18.000000000 +0200 -+++ gcc-4.2.0/gcc/config/arm/linux-elf.h 2007-07-15 11:26:02.000000000 +0200 -@@ -63,7 +63,7 @@ - %{shared:-lc} \ - %{!shared:%{profile:-lc_p}%{!profile:-lc}}" - --#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" -+#define LIBGCC_SPEC "-lgcc" - - #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" - diff --git a/patches/gcc/4.2.3/904-flatten-switch-stmt-00.patch b/patches/gcc/4.2.3/904-flatten-switch-stmt-00.patch deleted file mode 100644 index 6c40c57..0000000 --- a/patches/gcc/4.2.3/904-flatten-switch-stmt-00.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -durN gcc-4.2.1.orig/gcc/stmt.c gcc-4.2.1/gcc/stmt.c ---- gcc-4.2.1.orig/gcc/stmt.c 2007-07-19 05:25:32.000000000 +0200 -+++ gcc-4.2.1/gcc/stmt.c 2007-08-03 20:37:19.000000000 +0200 -@@ -2512,7 +2512,11 @@ - 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); - } -@@ -3070,6 +3074,7 @@ - { - 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, diff --git a/patches/gcc/4.2.3/920-soft-float.patch b/patches/gcc/4.2.3/920-soft-float.patch deleted file mode 100644 index 4287bfa..0000000 --- a/patches/gcc/4.2.3/920-soft-float.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -uNpr gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c ---- gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c 2007-03-05 11:54:00.000000000 -0500 -+++ gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c 2008-01-31 17:51:24.000000000 -0500 -@@ -70,6 +70,8 @@ Software Foundation, 51 Franklin Street, - but GCC currently generates poor code when a union is used to turn - a long double into a pair of doubles. */ - -+#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) -+ - long double __gcc_qadd (double, double, double, double); - long double __gcc_qsub (double, double, double, double); - long double __gcc_qmul (double, double, double, double); -@@ -219,8 +221,6 @@ __gcc_qdiv (double a, double b, double c - return z.ldval; - } - --#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) -- - long double __gcc_qneg (double, double); - int __gcc_qeq (double, double, double, double); - int __gcc_qne (double, double, double, double); diff --git a/patches/gcc/4.2.3/930-eabi_fixes.patch b/patches/gcc/4.2.3/930-eabi_fixes.patch deleted file mode 100644 index 7dce608..0000000 --- a/patches/gcc/4.2.3/930-eabi_fixes.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -durN gcc-4.2.3.orig/gcc/config/arm/linux-eabi.h gcc-4.2.3/gcc/config/arm/linux-eabi.h ---- gcc-4.2.3.orig/gcc/config/arm/linux-eabi.h 2007-09-01 17:28:30.000000000 +0200 -+++ gcc-4.2.3/gcc/config/arm/linux-eabi.h 2008-05-25 23:47:36.000000000 +0200 -@@ -47,7 +47,8 @@ - #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi - - #undef SUBTARGET_EXTRA_LINK_SPEC --#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi" -+#define SUBTARGET_EXTRA_LINK_SPEC \ -+ " %{mlittle-endian:-m armelf_linux_eabi} %{mbig-endian:-m armelfb_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/patches/gcc/4.2.3/940-alpha-signal_h.patch b/patches/gcc/4.2.3/940-alpha-signal_h.patch deleted file mode 100644 index d7e1796..0000000 --- a/patches/gcc/4.2.3/940-alpha-signal_h.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- gcc-4.2.1-stock/gcc/config/alpha/linux-unwind.h 2005-06-24 20:22:41.000000000 -0500 -+++ gcc-4.2.1/gcc/config/alpha/linux-unwind.h 2007-09-01 20:21:34.000000000 -0500 -@@ -29,6 +29,9 @@ Boston, MA 02110-1301, USA. */ - /* Do code reading to identify a signal frame, and set the frame - state data appropriately. See unwind-dw2.c for the structs. */ - -+/* Don't use this if inhibit_libc is set -+ The build for this target will fail trying to include missing headers */ -+#ifndef inhibit_libc - #include - #include - -@@ -80,3 +83,4 @@ alpha_fallback_frame_state (struct _Unwi - fs->retaddr_column = 64; - return _URC_NO_REASON; - } -+#endif /* inhibit_libc */ diff --git a/patches/gcc/4.2.3/950-fortran-signed-TImode.patch b/patches/gcc/4.2.3/950-fortran-signed-TImode.patch deleted file mode 100644 index 01e2f01..0000000 --- a/patches/gcc/4.2.3/950-fortran-signed-TImode.patch +++ /dev/null @@ -1,43 +0,0 @@ -Fix building gfortran for ARM. -http://gcc.gnu.org/ml/gcc-patches/2007-05/msg01010.html ----- - -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 - - gcc/fortran/ - * trans-types.c (gfc_type_for_size): Handle signed TImode. - -diff -durN gcc-4.2.3.old/gcc/fortran/trans-types.c gcc-4.2.3/gcc/fortran/trans-types.c ---- gcc-4.2.3.old/gcc/fortran/trans-types.c 2007-08-31 10:27:50.000000000 +0200 -+++ gcc-4.2.3/gcc/fortran/trans-types.c 2008-07-17 09:54:20.000000000 +0200 -@@ -1799,6 +1799,13 @@ - 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/patches/gcc/4.2.4/103-uclibc-conf-noupstream.patch b/patches/gcc/4.2.4/103-uclibc-conf-noupstream.patch deleted file mode 100644 index 1c239d6..0000000 --- a/patches/gcc/4.2.4/103-uclibc-conf-noupstream.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc ---- gcc-4.2.1.orig/gcc/config.gcc 2007-02-03 06:25:20.000000000 +0100 -+++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200 -@@ -1964,7 +1964,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/patches/gcc/4.2.4/110-uclibc-conf-noupstream.patch b/patches/gcc/4.2.4/110-uclibc-conf-noupstream.patch new file mode 100644 index 0000000..1c239d6 --- /dev/null +++ b/patches/gcc/4.2.4/110-uclibc-conf-noupstream.patch @@ -0,0 +1,12 @@ +diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc +--- gcc-4.2.1.orig/gcc/config.gcc 2007-02-03 06:25:20.000000000 +0100 ++++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200 +@@ -1964,7 +1964,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/patches/gcc/4.2.4/120-uclibc-locale.patch b/patches/gcc/4.2.4/120-uclibc-locale.patch new file mode 100644 index 0000000..298c505 --- /dev/null +++ b/patches/gcc/4.2.4/120-uclibc-locale.patch @@ -0,0 +1,2806 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 gcc-4.2.1/libstdc++-v3/acinclude.m4 +--- gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 2007-06-29 01:02:05.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/acinclude.m4 2007-08-03 20:30:21.000000000 +0200 +@@ -1334,7 +1334,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 +@@ -1355,6 +1355,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) + enable_clocale_flag=gnu + ;; +@@ -1526,6 +1529,40 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ AC_MSG_RESULT(uclibc) ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ AC_SUBST(glibcxx_MOFILES) ++ AC_SUBST(glibcxx_POFILES) ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include // For errno ++#include ++#include ++#include ++#include ++ ++#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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#ifndef _C_LOCALE_H ++#define _C_LOCALE_H 1 ++ ++#pragma GCC system_header ++ ++#include // get std::strlen ++#include // get std::snprintf or std::sprintf ++#include ++#include // For codecvt ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC_HAS_LOCALE__ ++#include // For codecvt using iconv, iconv_t ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#include // 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 ++ 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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++namespace std ++{ ++ // Specializations. ++#ifdef _GLIBCXX_USE_WCHAR_T ++ codecvt_base::result ++ codecvt:: ++ 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(-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(__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:: ++ 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(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(-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(-1) ++ || __conv == static_cast(-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:: ++ 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:: ++ 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:: ++ 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(__builtin_alloca(sizeof(wchar_t) ++ * __max)); ++ while (__from < __end && __max) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast(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(-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(-1) ++ || __conv == static_cast(-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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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::_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::_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::_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::_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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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 specializations are in src/locale.cc and ++ // various /config/os/* files. ++ template<> ++ ctype_byname::ctype_byname(const char* __s, size_t __refs) ++ : ctype(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::__wmask_type ++ ctype::_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::do_toupper(wchar_t __c) const ++ { return __towupper_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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::do_tolower(wchar_t __c) const ++ { return __towlower_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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:: ++ 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:: ++ 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:: ++ 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:: ++ 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:: ++ do_widen(char __c) const ++ { return _M_widen[static_cast(__c)]; } ++ ++ const char* ++ ctype:: ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const ++ { ++ while (__lo < __hi) ++ { ++ *__dest = _M_widen[static_cast(*__lo)]; ++ ++__lo; ++ ++__dest; ++ } ++ return __hi; ++ } ++ ++ char ++ ctype:: ++ 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(__c)); ++ } ++ ++ const wchar_t* ++ ctype:: ++ 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(__c)); ++ } ++ ++__lo; ++ ++__dest; ++ } ++ else ++ while (__lo < __hi) ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast(__c)); ++ ++__lo; ++ ++__dest; ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __hi; ++ } ++ ++ void ++ ctype::_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(__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(_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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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::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(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::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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#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 ++ messages<_CharT>::messages(size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), ++ _M_name_messages(_S_get_c_name()) ++ { } ++ ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::open(const basic_string& __s, const locale& __loc, ++ const char* __dir) const ++ { ++ __bindtextdomain(__s.c_str(), __dir); ++ return this->do_open(__s, __loc); ++ } ++ ++ // Virtual member functions. ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::do_open(const basic_string& __s, ++ const locale&) const ++ { ++ // No error checking is done, assume the catalog exists and can ++ // be used. ++ __textdomain(__s.c_str()); ++ return 0; ++ } ++ ++ template ++ void ++ messages<_CharT>::do_close(catalog) const ++ { } ++ ++ // messages_byname ++ template ++ 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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::~moneypunct() ++ { delete _M_data; } ++ ++ template<> ++ moneypunct::~moneypunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ moneypunct::_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; ++ ++ 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(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::_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; ++ ++ 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(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::~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::~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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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::~numpunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ numpunct::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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(__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(__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::~numpunct() ++ { delete _M_data; } ++ #endif ++} +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++ 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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++#warning wide time stuff ++// if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = L"%m/%d/%y"; ++ _M_data->_M_date_era_format = L"%m/%d/%y"; ++ _M_data->_M_time_format = L"%H:%M:%S"; ++ _M_data->_M_time_era_format = L"%H:%M:%S"; ++ _M_data->_M_date_time_format = L""; ++ _M_data->_M_date_time_era_format = L""; ++ _M_data->_M_am = L"AM"; ++ _M_data->_M_pm = L"PM"; ++ _M_data->_M_am_pm_format = L""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = L"Sunday"; ++ _M_data->_M_day2 = L"Monday"; ++ _M_data->_M_day3 = L"Tuesday"; ++ _M_data->_M_day4 = L"Wednesday"; ++ _M_data->_M_day5 = L"Thursday"; ++ _M_data->_M_day6 = L"Friday"; ++ _M_data->_M_day7 = L"Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = L"Sun"; ++ _M_data->_M_aday2 = L"Mon"; ++ _M_data->_M_aday3 = L"Tue"; ++ _M_data->_M_aday4 = L"Wed"; ++ _M_data->_M_aday5 = L"Thu"; ++ _M_data->_M_aday6 = L"Fri"; ++ _M_data->_M_aday7 = L"Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = L"January"; ++ _M_data->_M_month02 = L"February"; ++ _M_data->_M_month03 = L"March"; ++ _M_data->_M_month04 = L"April"; ++ _M_data->_M_month05 = L"May"; ++ _M_data->_M_month06 = L"June"; ++ _M_data->_M_month07 = L"July"; ++ _M_data->_M_month08 = L"August"; ++ _M_data->_M_month09 = L"September"; ++ _M_data->_M_month10 = L"October"; ++ _M_data->_M_month11 = L"November"; ++ _M_data->_M_month12 = L"December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = L"Jan"; ++ _M_data->_M_amonth02 = L"Feb"; ++ _M_data->_M_amonth03 = L"Mar"; ++ _M_data->_M_amonth04 = L"Apr"; ++ _M_data->_M_amonth05 = L"May"; ++ _M_data->_M_amonth06 = L"Jun"; ++ _M_data->_M_amonth07 = L"Jul"; ++ _M_data->_M_amonth08 = L"Aug"; ++ _M_data->_M_amonth09 = L"Sep"; ++ _M_data->_M_amonth10 = L"Oct"; ++ _M_data->_M_amonth11 = L"Nov"; ++ _M_data->_M_amonth12 = L"Dec"; ++ } ++#if 0 ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ union { char *__s; wchar_t *__w; } __u; ++ ++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); ++ _M_data->_M_date_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); ++ _M_data->_M_date_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); ++ _M_data->_M_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); ++ _M_data->_M_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); ++ _M_data->_M_date_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); ++ _M_data->_M_date_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); ++ _M_data->_M_am = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); ++ _M_data->_M_pm = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); ++ _M_data->_M_am_pm_format = __u.__w; ++ ++ // Day names, starting with "C"'s Sunday. ++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); ++ _M_data->_M_day1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); ++ _M_data->_M_day2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); ++ _M_data->_M_day3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); ++ _M_data->_M_day4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); ++ _M_data->_M_day5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); ++ _M_data->_M_day6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); ++ _M_data->_M_day7 = __u.__w; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); ++ _M_data->_M_aday1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); ++ _M_data->_M_aday2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); ++ _M_data->_M_aday3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); ++ _M_data->_M_aday4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); ++ _M_data->_M_aday5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); ++ _M_data->_M_aday6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); ++ _M_data->_M_aday7 = __u.__w; ++ ++ // Month names, starting with "C"'s January. ++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); ++ _M_data->_M_month01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); ++ _M_data->_M_month02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); ++ _M_data->_M_month03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); ++ _M_data->_M_month04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); ++ _M_data->_M_month05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); ++ _M_data->_M_month06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); ++ _M_data->_M_month07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); ++ _M_data->_M_month08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); ++ _M_data->_M_month09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); ++ _M_data->_M_month10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); ++ _M_data->_M_month11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); ++ _M_data->_M_month12 = __u.__w; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); ++ _M_data->_M_amonth01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); ++ _M_data->_M_amonth02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); ++ _M_data->_M_amonth03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); ++ _M_data->_M_amonth04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); ++ _M_data->_M_amonth05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); ++ _M_data->_M_amonth06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); ++ _M_data->_M_amonth07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); ++ _M_data->_M_amonth08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); ++ _M_data->_M_amonth09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); ++ _M_data->_M_amonth10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); ++ _M_data->_M_amonth11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); ++ _M_data->_M_amonth12 = __u.__w; ++ } ++#endif // 0 ++ } ++#endif ++} +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 ++ ++ template ++ __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 ++ __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 ++ __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 ++ __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 -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure +--- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:29:22.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200 +@@ -5769,7 +5769,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; }; } ;; +@@ -5802,6 +5802,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) + enable_clocale_flag=gnu + ;; +@@ -6190,6 +6193,76 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ echo "$as_me:$LINENO: result: uclibc" >&5 ++echo "${ECHO_T}uclibc" >&6 ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ # Extract the first word of "msgfmt", so it can be a program name with args. ++set dummy msgfmt; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test -n "$check_msgfmt"; then ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_check_msgfmt="yes" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" ++fi ++fi ++check_msgfmt=$ac_cv_prog_check_msgfmt ++if test -n "$check_msgfmt"; then ++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 ++echo "${ECHO_T}$check_msgfmt" >&6 ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ ++ ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h +--- gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h 2005-08-17 04:28:44.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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 -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h +--- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h 2006-12-07 10:33:51.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h 2007-08-03 20:30:21.000000000 +0200 +@@ -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/patches/gcc/4.2.4/130-uclibc-locale-no__x.patch b/patches/gcc/4.2.4/130-uclibc-locale-no__x.patch new file mode 100644 index 0000000..d88dc22 --- /dev/null +++ b/patches/gcc/4.2.4/130-uclibc-locale-no__x.patch @@ -0,0 +1,223 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -39,20 +39,6 @@ + #include + #include + +-#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<> +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200 +@@ -68,6 +68,7 @@ + { + extern "C" __typeof(uselocale) __uselocale; + } ++#define __uselocale uselocale + #endif + + namespace std +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:53.000000000 +0200 +@@ -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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -36,13 +36,6 @@ + #include + #include + +-#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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -38,13 +38,6 @@ + #undef _LIBC + #include + +-#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 specializations are in src/locale.cc and +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -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 + +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200 +@@ -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& __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; + } + +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -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: +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -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 + { +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:53.000000000 +0200 +@@ -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 + { diff --git a/patches/gcc/4.2.4/140-uclibc-locale-wchar_fix.patch b/patches/gcc/4.2.4/140-uclibc-locale-wchar_fix.patch new file mode 100644 index 0000000..077bb56 --- /dev/null +++ b/patches/gcc/4.2.4/140-uclibc-locale-wchar_fix.patch @@ -0,0 +1,50 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200 +@@ -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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200 +@@ -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/patches/gcc/4.2.4/150-uclibc-locale-update.patch b/patches/gcc/4.2.4/150-uclibc-locale-update.patch new file mode 100644 index 0000000..534f4e4 --- /dev/null +++ b/patches/gcc/4.2.4/150-uclibc-locale-update.patch @@ -0,0 +1,354 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:31:54.000000000 +0200 +@@ -46,16 +46,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 +60,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 +74,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 +101,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); + } + +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:31:54.000000000 +0200 +@@ -39,21 +39,23 @@ + #pragma GCC system_header + + #include // get std::strlen +-#include // get std::snprintf or std::sprintf ++#include // get std::vsnprintf or std::vsprintf + #include + #include // For codecvt + #ifdef __UCLIBC_MJN3_ONLY__ + #warning fix this + #endif +-#ifdef __UCLIBC_HAS_LOCALE__ ++#ifdef _GLIBCXX_USE_ICONV + #include // For codecvt using iconv, iconv_t + #endif +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ +-#include // For messages ++#ifdef HAVE_LIBINTL_H ++#include // For messages + #endif ++#include + + #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 +- 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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:31:54.000000000 +0200 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + namespace std +@@ -138,20 +143,34 @@ + ctype:: + 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:: + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200 +@@ -47,18 +47,21 @@ + template + 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 + 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 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:54.000000000 +0200 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + #ifdef __UCLIBC_MJN3_ONLY__ +@@ -206,7 +211,7 @@ + } + break; + default: +- ; ++ __ret = pattern(); + } + return __ret; + } +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:54.000000000 +0200 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + #ifdef __UCLIBC_MJN3_ONLY__ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200 +@@ -37,25 +37,33 @@ + template + __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 + __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 + __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 diff --git a/patches/gcc/4.2.4/160-libstdc++-pic.patch b/patches/gcc/4.2.4/160-libstdc++-pic.patch new file mode 100644 index 0000000..7244d4c --- /dev/null +++ b/patches/gcc/4.2.4/160-libstdc++-pic.patch @@ -0,0 +1,50 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am gcc-4.2.1/libstdc++-v3/src/Makefile.am +--- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am 2006-07-28 06:57:34.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/src/Makefile.am 2007-08-03 20:32:27.000000000 +0200 +@@ -257,6 +257,12 @@ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ + + ++install-exec-local: ++ifeq ($(enable_shared),yes) ++ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++endif ++ + # Added bits to build debug library. + if GLIBCXX_BUILD_DEBUG + all-local: build_debug +diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in gcc-4.2.1/libstdc++-v3/src/Makefile.in +--- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in 2006-10-16 21:08:22.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/src/Makefile.in 2007-08-03 20:32:27.000000000 +0200 +@@ -657,7 +657,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 + +@@ -690,6 +690,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 \ +@@ -799,6 +800,13 @@ + install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ++ ++install-exec-local: ++ifeq ($(enable_shared),yes) ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++endif ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff --git a/patches/gcc/4.2.4/170-missing-execinfo_h.patch b/patches/gcc/4.2.4/170-missing-execinfo_h.patch new file mode 100644 index 0000000..ff67899 --- /dev/null +++ b/patches/gcc/4.2.4/170-missing-execinfo_h.patch @@ -0,0 +1,12 @@ +diff -durN gcc-4.2.1.orig/boehm-gc/include/gc.h gcc-4.2.1/boehm-gc/include/gc.h +--- gcc-4.2.1.orig/boehm-gc/include/gc.h 2006-09-18 20:45:08.000000000 +0200 ++++ gcc-4.2.1/boehm-gc/include/gc.h 2007-08-03 20:33:00.000000000 +0200 +@@ -502,7 +502,7 @@ + #if defined(__linux__) || defined(__GLIBC__) + # include + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/patches/gcc/4.2.4/180-c99-snprintf.patch b/patches/gcc/4.2.4/180-c99-snprintf.patch new file mode 100644 index 0000000..ddb0c34 --- /dev/null +++ b/patches/gcc/4.2.4/180-c99-snprintf.patch @@ -0,0 +1,12 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h +--- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h 2006-12-07 10:33:51.000000000 +0100 ++++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h 2007-08-03 20:33:24.000000000 +0200 +@@ -144,7 +144,7 @@ + + _GLIBCXX_END_NAMESPACE + +-#if _GLIBCXX_USE_C99 ++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) + + #undef snprintf + #undef vfscanf diff --git a/patches/gcc/4.2.4/190-c99-complex-ugly-hack.patch b/patches/gcc/4.2.4/190-c99-complex-ugly-hack.patch new file mode 100644 index 0000000..de6d71c --- /dev/null +++ b/patches/gcc/4.2.4/190-c99-complex-ugly-hack.patch @@ -0,0 +1,13 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure +--- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:33:56.000000000 +0200 +@@ -7514,6 +7514,9 @@ + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + #include ++#ifdef __UCLIBC__ ++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs ++#endif + int + main () + { diff --git a/patches/gcc/4.2.4/200-index_macro.patch b/patches/gcc/4.2.4/200-index_macro.patch new file mode 100644 index 0000000..1e56b5d --- /dev/null +++ b/patches/gcc/4.2.4/200-index_macro.patch @@ -0,0 +1,26 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/rope gcc-4.2.1/libstdc++-v3/include/ext/rope +--- gcc-4.2.1.orig/libstdc++-v3/include/ext/rope 2006-10-17 13:56:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/include/ext/rope 2007-08-03 20:34:23.000000000 +0200 +@@ -58,6 +58,9 @@ + #include + #include + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + # ifdef __GC + # define __GC_CONST const + # else +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h +--- gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h 2006-10-17 13:56:21.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h 2007-08-03 20:34:23.000000000 +0200 +@@ -54,6 +54,9 @@ + #include // For uninitialized_copy_n + #include // For power + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + + using std::size_t; diff --git a/patches/gcc/4.2.4/200-uclibc-locale.patch b/patches/gcc/4.2.4/200-uclibc-locale.patch deleted file mode 100644 index 298c505..0000000 --- a/patches/gcc/4.2.4/200-uclibc-locale.patch +++ /dev/null @@ -1,2806 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 gcc-4.2.1/libstdc++-v3/acinclude.m4 ---- gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 2007-06-29 01:02:05.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/acinclude.m4 2007-08-03 20:30:21.000000000 +0200 -@@ -1334,7 +1334,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 -@@ -1355,6 +1355,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) - enable_clocale_flag=gnu - ;; -@@ -1526,6 +1529,40 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ AC_MSG_RESULT(uclibc) -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ AC_SUBST(glibcxx_MOFILES) -+ AC_SUBST(glibcxx_POFILES) -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include // For errno -+#include -+#include -+#include -+#include -+ -+#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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#ifndef _C_LOCALE_H -+#define _C_LOCALE_H 1 -+ -+#pragma GCC system_header -+ -+#include // get std::strlen -+#include // get std::snprintf or std::sprintf -+#include -+#include // For codecvt -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this -+#endif -+#ifdef __UCLIBC_HAS_LOCALE__ -+#include // For codecvt using iconv, iconv_t -+#endif -+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ -+#include // 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 -+ 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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+namespace std -+{ -+ // Specializations. -+#ifdef _GLIBCXX_USE_WCHAR_T -+ codecvt_base::result -+ codecvt:: -+ 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(-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(__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:: -+ 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(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(-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(-1) -+ || __conv == static_cast(-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:: -+ 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:: -+ 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:: -+ 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(__builtin_alloca(sizeof(wchar_t) -+ * __max)); -+ while (__from < __end && __max) -+ { -+ const extern_type* __from_chunk_end; -+ __from_chunk_end = static_cast(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(-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(-1) -+ || __conv == static_cast(-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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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::_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::_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::_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::_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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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 specializations are in src/locale.cc and -+ // various /config/os/* files. -+ template<> -+ ctype_byname::ctype_byname(const char* __s, size_t __refs) -+ : ctype(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::__wmask_type -+ ctype::_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::do_toupper(wchar_t __c) const -+ { return __towupper_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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::do_tolower(wchar_t __c) const -+ { return __towlower_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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:: -+ 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:: -+ 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:: -+ 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:: -+ 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:: -+ do_widen(char __c) const -+ { return _M_widen[static_cast(__c)]; } -+ -+ const char* -+ ctype:: -+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const -+ { -+ while (__lo < __hi) -+ { -+ *__dest = _M_widen[static_cast(*__lo)]; -+ ++__lo; -+ ++__dest; -+ } -+ return __hi; -+ } -+ -+ char -+ ctype:: -+ 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(__c)); -+ } -+ -+ const wchar_t* -+ ctype:: -+ 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(__c)); -+ } -+ ++__lo; -+ ++__dest; -+ } -+ else -+ while (__lo < __hi) -+ { -+ const int __c = wctob(*__lo); -+ *__dest = (__c == EOF ? __dfault : static_cast(__c)); -+ ++__lo; -+ ++__dest; -+ } -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ return __hi; -+ } -+ -+ void -+ ctype::_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(__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(_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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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::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(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::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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#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 -+ messages<_CharT>::messages(size_t __refs) -+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), -+ _M_name_messages(_S_get_c_name()) -+ { } -+ -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::open(const basic_string& __s, const locale& __loc, -+ const char* __dir) const -+ { -+ __bindtextdomain(__s.c_str(), __dir); -+ return this->do_open(__s, __loc); -+ } -+ -+ // Virtual member functions. -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::do_open(const basic_string& __s, -+ const locale&) const -+ { -+ // No error checking is done, assume the catalog exists and can -+ // be used. -+ __textdomain(__s.c_str()); -+ return 0; -+ } -+ -+ template -+ void -+ messages<_CharT>::do_close(catalog) const -+ { } -+ -+ // messages_byname -+ template -+ 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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::~moneypunct() -+ { delete _M_data; } -+ -+ template<> -+ moneypunct::~moneypunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ moneypunct::_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; -+ -+ 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(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::_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; -+ -+ 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(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::~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::~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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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::~numpunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ numpunct::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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(__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(__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::~numpunct() -+ { delete _M_data; } -+ #endif -+} -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+ 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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+#warning wide time stuff -+// if (!__cloc) -+ { -+ // "C" locale -+ _M_c_locale_timepunct = _S_get_c_locale(); -+ -+ _M_data->_M_date_format = L"%m/%d/%y"; -+ _M_data->_M_date_era_format = L"%m/%d/%y"; -+ _M_data->_M_time_format = L"%H:%M:%S"; -+ _M_data->_M_time_era_format = L"%H:%M:%S"; -+ _M_data->_M_date_time_format = L""; -+ _M_data->_M_date_time_era_format = L""; -+ _M_data->_M_am = L"AM"; -+ _M_data->_M_pm = L"PM"; -+ _M_data->_M_am_pm_format = L""; -+ -+ // Day names, starting with "C"'s Sunday. -+ _M_data->_M_day1 = L"Sunday"; -+ _M_data->_M_day2 = L"Monday"; -+ _M_data->_M_day3 = L"Tuesday"; -+ _M_data->_M_day4 = L"Wednesday"; -+ _M_data->_M_day5 = L"Thursday"; -+ _M_data->_M_day6 = L"Friday"; -+ _M_data->_M_day7 = L"Saturday"; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ _M_data->_M_aday1 = L"Sun"; -+ _M_data->_M_aday2 = L"Mon"; -+ _M_data->_M_aday3 = L"Tue"; -+ _M_data->_M_aday4 = L"Wed"; -+ _M_data->_M_aday5 = L"Thu"; -+ _M_data->_M_aday6 = L"Fri"; -+ _M_data->_M_aday7 = L"Sat"; -+ -+ // Month names, starting with "C"'s January. -+ _M_data->_M_month01 = L"January"; -+ _M_data->_M_month02 = L"February"; -+ _M_data->_M_month03 = L"March"; -+ _M_data->_M_month04 = L"April"; -+ _M_data->_M_month05 = L"May"; -+ _M_data->_M_month06 = L"June"; -+ _M_data->_M_month07 = L"July"; -+ _M_data->_M_month08 = L"August"; -+ _M_data->_M_month09 = L"September"; -+ _M_data->_M_month10 = L"October"; -+ _M_data->_M_month11 = L"November"; -+ _M_data->_M_month12 = L"December"; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ _M_data->_M_amonth01 = L"Jan"; -+ _M_data->_M_amonth02 = L"Feb"; -+ _M_data->_M_amonth03 = L"Mar"; -+ _M_data->_M_amonth04 = L"Apr"; -+ _M_data->_M_amonth05 = L"May"; -+ _M_data->_M_amonth06 = L"Jun"; -+ _M_data->_M_amonth07 = L"Jul"; -+ _M_data->_M_amonth08 = L"Aug"; -+ _M_data->_M_amonth09 = L"Sep"; -+ _M_data->_M_amonth10 = L"Oct"; -+ _M_data->_M_amonth11 = L"Nov"; -+ _M_data->_M_amonth12 = L"Dec"; -+ } -+#if 0 -+ else -+ { -+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); -+ -+ union { char *__s; wchar_t *__w; } __u; -+ -+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); -+ _M_data->_M_date_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); -+ _M_data->_M_date_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); -+ _M_data->_M_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); -+ _M_data->_M_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); -+ _M_data->_M_date_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); -+ _M_data->_M_date_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); -+ _M_data->_M_am = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); -+ _M_data->_M_pm = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); -+ _M_data->_M_am_pm_format = __u.__w; -+ -+ // Day names, starting with "C"'s Sunday. -+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); -+ _M_data->_M_day1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); -+ _M_data->_M_day2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); -+ _M_data->_M_day3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); -+ _M_data->_M_day4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); -+ _M_data->_M_day5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); -+ _M_data->_M_day6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); -+ _M_data->_M_day7 = __u.__w; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); -+ _M_data->_M_aday1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); -+ _M_data->_M_aday2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); -+ _M_data->_M_aday3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); -+ _M_data->_M_aday4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); -+ _M_data->_M_aday5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); -+ _M_data->_M_aday6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); -+ _M_data->_M_aday7 = __u.__w; -+ -+ // Month names, starting with "C"'s January. -+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); -+ _M_data->_M_month01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); -+ _M_data->_M_month02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); -+ _M_data->_M_month03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); -+ _M_data->_M_month04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); -+ _M_data->_M_month05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); -+ _M_data->_M_month06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); -+ _M_data->_M_month07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); -+ _M_data->_M_month08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); -+ _M_data->_M_month09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); -+ _M_data->_M_month10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); -+ _M_data->_M_month11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); -+ _M_data->_M_month12 = __u.__w; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); -+ _M_data->_M_amonth01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); -+ _M_data->_M_amonth02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); -+ _M_data->_M_amonth03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); -+ _M_data->_M_amonth04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); -+ _M_data->_M_amonth05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); -+ _M_data->_M_amonth06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); -+ _M_data->_M_amonth07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); -+ _M_data->_M_amonth08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); -+ _M_data->_M_amonth09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); -+ _M_data->_M_amonth10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); -+ _M_data->_M_amonth11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); -+ _M_data->_M_amonth12 = __u.__w; -+ } -+#endif // 0 -+ } -+#endif -+} -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -+ -+ template -+ __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 -+ __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 -+ __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 -+ __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 -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure ---- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:29:22.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200 -@@ -5769,7 +5769,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; }; } ;; -@@ -5802,6 +5802,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) - enable_clocale_flag=gnu - ;; -@@ -6190,6 +6193,76 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ echo "$as_me:$LINENO: result: uclibc" >&5 -+echo "${ECHO_T}uclibc" >&6 -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ # Extract the first word of "msgfmt", so it can be a program name with args. -+set dummy msgfmt; ac_word=$2 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_check_msgfmt+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$check_msgfmt"; then -+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. -+else -+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -+for as_dir in $PATH -+do -+ IFS=$as_save_IFS -+ test -z "$as_dir" && as_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_check_msgfmt="yes" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done -+ -+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" -+fi -+fi -+check_msgfmt=$ac_cv_prog_check_msgfmt -+if test -n "$check_msgfmt"; then -+ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 -+echo "${ECHO_T}$check_msgfmt" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ -+ -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the -diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h ---- gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h 2005-08-17 04:28:44.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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 -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h ---- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h 2006-12-07 10:33:51.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h 2007-08-03 20:30:21.000000000 +0200 -@@ -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/patches/gcc/4.2.4/203-uclibc-locale-no__x.patch b/patches/gcc/4.2.4/203-uclibc-locale-no__x.patch deleted file mode 100644 index d88dc22..0000000 --- a/patches/gcc/4.2.4/203-uclibc-locale-no__x.patch +++ /dev/null @@ -1,223 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -39,20 +39,6 @@ - #include - #include - --#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<> -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200 -@@ -68,6 +68,7 @@ - { - extern "C" __typeof(uselocale) __uselocale; - } -+#define __uselocale uselocale - #endif - - namespace std -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:53.000000000 +0200 -@@ -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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -36,13 +36,6 @@ - #include - #include - --#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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -38,13 +38,6 @@ - #undef _LIBC - #include - --#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 specializations are in src/locale.cc and -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -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 - -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200 -@@ -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& __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; - } - -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -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: -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -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 - { -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:53.000000000 +0200 -@@ -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 - { diff --git a/patches/gcc/4.2.4/204-uclibc-locale-wchar_fix.patch b/patches/gcc/4.2.4/204-uclibc-locale-wchar_fix.patch deleted file mode 100644 index 077bb56..0000000 --- a/patches/gcc/4.2.4/204-uclibc-locale-wchar_fix.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200 -@@ -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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200 -@@ -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/patches/gcc/4.2.4/205-uclibc-locale-update.patch b/patches/gcc/4.2.4/205-uclibc-locale-update.patch deleted file mode 100644 index 534f4e4..0000000 --- a/patches/gcc/4.2.4/205-uclibc-locale-update.patch +++ /dev/null @@ -1,354 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:31:54.000000000 +0200 -@@ -46,16 +46,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 +60,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 +74,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 +101,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); - } - -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:31:54.000000000 +0200 -@@ -39,21 +39,23 @@ - #pragma GCC system_header - - #include // get std::strlen --#include // get std::snprintf or std::sprintf -+#include // get std::vsnprintf or std::vsprintf - #include - #include // For codecvt - #ifdef __UCLIBC_MJN3_ONLY__ - #warning fix this - #endif --#ifdef __UCLIBC_HAS_LOCALE__ -+#ifdef _GLIBCXX_USE_ICONV - #include // For codecvt using iconv, iconv_t - #endif --#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ --#include // For messages -+#ifdef HAVE_LIBINTL_H -+#include // For messages - #endif -+#include - - #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 -- 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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:31:54.000000000 +0200 -@@ -33,9 +33,14 @@ - - // Written by Benjamin Kosnik - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - namespace std -@@ -138,20 +143,34 @@ - ctype:: - 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:: - do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200 -@@ -47,18 +47,21 @@ - template - 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 - 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 -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:54.000000000 +0200 -@@ -33,9 +33,14 @@ - - // Written by Benjamin Kosnik - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - #ifdef __UCLIBC_MJN3_ONLY__ -@@ -206,7 +211,7 @@ - } - break; - default: -- ; -+ __ret = pattern(); - } - return __ret; - } -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:54.000000000 +0200 -@@ -33,9 +33,14 @@ - - // Written by Benjamin Kosnik - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - #ifdef __UCLIBC_MJN3_ONLY__ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200 -@@ -37,25 +37,33 @@ - template - __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 - __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 - __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 diff --git a/patches/gcc/4.2.4/210-libmudflap-susv3-legacy.patch b/patches/gcc/4.2.4/210-libmudflap-susv3-legacy.patch new file mode 100644 index 0000000..26e8704 --- /dev/null +++ b/patches/gcc/4.2.4/210-libmudflap-susv3-legacy.patch @@ -0,0 +1,48 @@ +diff -durN gcc-4.2.1.orig/libmudflap/mf-hooks2.c gcc-4.2.1/libmudflap/mf-hooks2.c +--- gcc-4.2.1.orig/libmudflap/mf-hooks2.c 2005-09-23 23:58:39.000000000 +0200 ++++ gcc-4.2.1/libmudflap/mf-hooks2.c 2007-08-03 20:35:09.000000000 +0200 +@@ -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/patches/gcc/4.2.4/220-libstdc++-namespace.patch b/patches/gcc/4.2.4/220-libstdc++-namespace.patch new file mode 100644 index 0000000..709e8f2 --- /dev/null +++ b/patches/gcc/4.2.4/220-libstdc++-namespace.patch @@ -0,0 +1,36 @@ +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:35:40.000000000 +0200 +@@ -32,7 +32,8 @@ + // + + // Written by Benjamin Kosnik +- ++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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:35:40.000000000 +0200 +@@ -33,7 +33,8 @@ + // + + // Written by Benjamin Kosnik +- ++namespace std ++{ + template + __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/patches/gcc/4.2.4/230-libbackend_dep_gcov-iov.h.patch b/patches/gcc/4.2.4/230-libbackend_dep_gcov-iov.h.patch new file mode 100644 index 0000000..32754be --- /dev/null +++ b/patches/gcc/4.2.4/230-libbackend_dep_gcov-iov.h.patch @@ -0,0 +1,12 @@ +diff -durN gcc-4.2.1.orig/gcc/Makefile.in gcc-4.2.1/gcc/Makefile.in +--- gcc-4.2.1.orig/gcc/Makefile.in 2007-05-31 17:37:38.000000000 +0200 ++++ gcc-4.2.1/gcc/Makefile.in 2007-08-03 20:36:14.000000000 +0200 +@@ -2660,7 +2660,7 @@ + # FIXME: writing proper dependencies for this is a *LOT* of work. + libbackend.o : $(OBJS-common:.o=.c) $(out_file) \ + insn-config.h insn-flags.h insn-codes.h insn-constants.h \ +- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) ++ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ + -DTARGET_NAME=\"$(target_noncanonical)\" \ + -DLOCALEDIR=\"$(localedir)\" \ diff --git a/patches/gcc/4.2.4/240-arm-bigendian.patch b/patches/gcc/4.2.4/240-arm-bigendian.patch new file mode 100644 index 0000000..2abeccd --- /dev/null +++ b/patches/gcc/4.2.4/240-arm-bigendian.patch @@ -0,0 +1,64 @@ +diff -durN gcc-4.2.1.orig/gcc/config/arm/linux-elf.h gcc-4.2.1/gcc/config/arm/linux-elf.h +--- gcc-4.2.1.orig/gcc/config/arm/linux-elf.h 2006-02-17 00:29:10.000000000 +0100 ++++ gcc-4.2.1/gcc/config/arm/linux-elf.h 2007-08-03 20:36:43.000000000 +0200 +@@ -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 +diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc +--- gcc-4.2.1.orig/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200 ++++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:36:43.000000000 +0200 +@@ -705,6 +705,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/patches/gcc/4.2.4/250-softfloat-fix.patch b/patches/gcc/4.2.4/250-softfloat-fix.patch new file mode 100644 index 0000000..3517856 --- /dev/null +++ b/patches/gcc/4.2.4/250-softfloat-fix.patch @@ -0,0 +1,58 @@ +This patch (C) 2007 Yann E. MORIN +Licensed under GPL v2. + +First hunk of this patch solves compiling uClibc: + +make[1]: Entering directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' + LD libuClibc-0.9.29.so +libc/libc_so.a(difftime.os): In function `difftime': +difftime.c:(.text+0x8): undefined reference to `__floatsidf' +difftime.c:(.text+0x2c): undefined reference to `__subdf3' +libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr': +_fpmaxtostr.c:(.text+0xd4): undefined reference to `__nedf2' +_fpmaxtostr.c:(.text+0xf8): undefined reference to `__eqdf2' +_fpmaxtostr.c:(.text+0x114): undefined reference to `__divdf3' +_fpmaxtostr.c:(.text+0x120): undefined reference to `__ltdf2' +_fpmaxtostr.c:(.text+0x1c4): undefined reference to `__muldf3' +_fpmaxtostr.c:(.text+0x388): undefined reference to `__gedf2' +_fpmaxtostr.c:(.text+0x430): undefined reference to `__adddf3' +libc/libc_so.a(__psfs_do_numeric.os): In function `__psfs_do_numeric': +__psfs_do_numeric.c:(.text+0x520): undefined reference to `__truncdfsf2' +libc/libc_so.a(strtof.os): In function `strtof': +strtof.c:(.text+0x1c): undefined reference to `__extendsfdf2' +/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/cc_core_prefix/lib/gcc/arm-linux-uclibc/4.1.1/libgcc.a(_fixunsdfsi.o): +In function `__fixunsdfsi': +libgcc2.c:(.text+0x34): undefined reference to `__fixdfsi' +make[2]: *** [lib/libc.so] Error 1 +make[1]: *** [lib/libc.so.0] Error 2 +make[1]: Leaving directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' +make: *** [/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc/lib/libc.a] +Error 2 + +The second hunk fixes building final gcc because soft-float implies using -lfloat (which we don't have). + + +diff -dur gcc-4.2.0.orig/gcc/config.gcc gcc-4.2.0/gcc/config.gcc +--- gcc-4.2.0.orig/gcc/config.gcc 2007-07-15 11:24:18.000000000 +0200 ++++ gcc-4.2.0/gcc/config.gcc 2007-07-15 11:26:02.000000000 +0200 +@@ -721,7 +721,7 @@ + default_use_cxa_atexit=yes + ;; + *) +- tmake_file="$tmake_file arm/t-linux" ++ tmake_file="$tmake_file arm/t-linux arm/t-arm-elf" + ;; + esac + tm_file="$tm_file arm/aout.h arm/arm.h" +diff -dur gcc-4.2.0.orig/gcc/config/arm/linux-elf.h gcc-4.2.0/gcc/config/arm/linux-elf.h +--- gcc-4.2.0.orig/gcc/config/arm/linux-elf.h 2007-07-15 11:24:18.000000000 +0200 ++++ gcc-4.2.0/gcc/config/arm/linux-elf.h 2007-07-15 11:26:02.000000000 +0200 +@@ -63,7 +63,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" + diff --git a/patches/gcc/4.2.4/260-flatten-switch-stmt-00.patch b/patches/gcc/4.2.4/260-flatten-switch-stmt-00.patch new file mode 100644 index 0000000..6c40c57 --- /dev/null +++ b/patches/gcc/4.2.4/260-flatten-switch-stmt-00.patch @@ -0,0 +1,24 @@ +diff -durN gcc-4.2.1.orig/gcc/stmt.c gcc-4.2.1/gcc/stmt.c +--- gcc-4.2.1.orig/gcc/stmt.c 2007-07-19 05:25:32.000000000 +0200 ++++ gcc-4.2.1/gcc/stmt.c 2007-08-03 20:37:19.000000000 +0200 +@@ -2512,7 +2512,11 @@ + 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); + } +@@ -3070,6 +3074,7 @@ + { + 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, diff --git a/patches/gcc/4.2.4/270-soft-float.patch b/patches/gcc/4.2.4/270-soft-float.patch new file mode 100644 index 0000000..4287bfa --- /dev/null +++ b/patches/gcc/4.2.4/270-soft-float.patch @@ -0,0 +1,21 @@ +diff -uNpr gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c +--- gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c 2007-03-05 11:54:00.000000000 -0500 ++++ gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c 2008-01-31 17:51:24.000000000 -0500 +@@ -70,6 +70,8 @@ Software Foundation, 51 Franklin Street, + but GCC currently generates poor code when a union is used to turn + a long double into a pair of doubles. */ + ++#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) ++ + long double __gcc_qadd (double, double, double, double); + long double __gcc_qsub (double, double, double, double); + long double __gcc_qmul (double, double, double, double); +@@ -219,8 +221,6 @@ __gcc_qdiv (double a, double b, double c + return z.ldval; + } + +-#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) +- + long double __gcc_qneg (double, double); + int __gcc_qeq (double, double, double, double); + int __gcc_qne (double, double, double, double); diff --git a/patches/gcc/4.2.4/280-eabi_fixes.patch b/patches/gcc/4.2.4/280-eabi_fixes.patch new file mode 100644 index 0000000..7dce608 --- /dev/null +++ b/patches/gcc/4.2.4/280-eabi_fixes.patch @@ -0,0 +1,13 @@ +diff -durN gcc-4.2.3.orig/gcc/config/arm/linux-eabi.h gcc-4.2.3/gcc/config/arm/linux-eabi.h +--- gcc-4.2.3.orig/gcc/config/arm/linux-eabi.h 2007-09-01 17:28:30.000000000 +0200 ++++ gcc-4.2.3/gcc/config/arm/linux-eabi.h 2008-05-25 23:47:36.000000000 +0200 +@@ -47,7 +47,8 @@ + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi + + #undef SUBTARGET_EXTRA_LINK_SPEC +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi" ++#define SUBTARGET_EXTRA_LINK_SPEC \ ++ " %{mlittle-endian:-m armelf_linux_eabi} %{mbig-endian:-m armelfb_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/patches/gcc/4.2.4/290-alpha-signal_h.patch b/patches/gcc/4.2.4/290-alpha-signal_h.patch new file mode 100644 index 0000000..d7e1796 --- /dev/null +++ b/patches/gcc/4.2.4/290-alpha-signal_h.patch @@ -0,0 +1,17 @@ +--- gcc-4.2.1-stock/gcc/config/alpha/linux-unwind.h 2005-06-24 20:22:41.000000000 -0500 ++++ gcc-4.2.1/gcc/config/alpha/linux-unwind.h 2007-09-01 20:21:34.000000000 -0500 +@@ -29,6 +29,9 @@ Boston, MA 02110-1301, USA. */ + /* Do code reading to identify a signal frame, and set the frame + state data appropriately. See unwind-dw2.c for the structs. */ + ++/* Don't use this if inhibit_libc is set ++ The build for this target will fail trying to include missing headers */ ++#ifndef inhibit_libc + #include + #include + +@@ -80,3 +83,4 @@ alpha_fallback_frame_state (struct _Unwi + fs->retaddr_column = 64; + return _URC_NO_REASON; + } ++#endif /* inhibit_libc */ diff --git a/patches/gcc/4.2.4/300-fortran-signed-TImode.patch b/patches/gcc/4.2.4/300-fortran-signed-TImode.patch new file mode 100644 index 0000000..01e2f01 --- /dev/null +++ b/patches/gcc/4.2.4/300-fortran-signed-TImode.patch @@ -0,0 +1,43 @@ +Fix building gfortran for ARM. +http://gcc.gnu.org/ml/gcc-patches/2007-05/msg01010.html +---- + +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 + + gcc/fortran/ + * trans-types.c (gfc_type_for_size): Handle signed TImode. + +diff -durN gcc-4.2.3.old/gcc/fortran/trans-types.c gcc-4.2.3/gcc/fortran/trans-types.c +--- gcc-4.2.3.old/gcc/fortran/trans-types.c 2007-08-31 10:27:50.000000000 +0200 ++++ gcc-4.2.3/gcc/fortran/trans-types.c 2008-07-17 09:54:20.000000000 +0200 +@@ -1799,6 +1799,13 @@ + 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/patches/gcc/4.2.4/300-libstdc++-pic.patch b/patches/gcc/4.2.4/300-libstdc++-pic.patch deleted file mode 100644 index 7244d4c..0000000 --- a/patches/gcc/4.2.4/300-libstdc++-pic.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am gcc-4.2.1/libstdc++-v3/src/Makefile.am ---- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am 2006-07-28 06:57:34.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/src/Makefile.am 2007-08-03 20:32:27.000000000 +0200 -@@ -257,6 +257,12 @@ - $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ - - -+install-exec-local: -+ifeq ($(enable_shared),yes) -+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) -+endif -+ - # Added bits to build debug library. - if GLIBCXX_BUILD_DEBUG - all-local: build_debug -diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in gcc-4.2.1/libstdc++-v3/src/Makefile.in ---- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in 2006-10-16 21:08:22.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/src/Makefile.in 2007-08-03 20:32:27.000000000 +0200 -@@ -657,7 +657,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 - -@@ -690,6 +690,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 \ -@@ -799,6 +800,13 @@ - install_debug: - (cd ${debugdir} && $(MAKE) \ - toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) -+ -+install-exec-local: -+ifeq ($(enable_shared),yes) -+ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) -+endif -+ - # Tell versions [3.59,3.63) of GNU make to not export all variables. - # Otherwise a system limit (for SysV at least) may be exceeded. - .NOEXPORT: diff --git a/patches/gcc/4.2.4/301-missing-execinfo_h.patch b/patches/gcc/4.2.4/301-missing-execinfo_h.patch deleted file mode 100644 index ff67899..0000000 --- a/patches/gcc/4.2.4/301-missing-execinfo_h.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -durN gcc-4.2.1.orig/boehm-gc/include/gc.h gcc-4.2.1/boehm-gc/include/gc.h ---- gcc-4.2.1.orig/boehm-gc/include/gc.h 2006-09-18 20:45:08.000000000 +0200 -+++ gcc-4.2.1/boehm-gc/include/gc.h 2007-08-03 20:33:00.000000000 +0200 -@@ -502,7 +502,7 @@ - #if defined(__linux__) || defined(__GLIBC__) - # include - # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ -- && !defined(__ia64__) -+ && !defined(__ia64__) && !defined(__UCLIBC__) - # ifndef GC_HAVE_BUILTIN_BACKTRACE - # define GC_HAVE_BUILTIN_BACKTRACE - # endif diff --git a/patches/gcc/4.2.4/302-c99-snprintf.patch b/patches/gcc/4.2.4/302-c99-snprintf.patch deleted file mode 100644 index ddb0c34..0000000 --- a/patches/gcc/4.2.4/302-c99-snprintf.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h ---- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h 2006-12-07 10:33:51.000000000 +0100 -+++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h 2007-08-03 20:33:24.000000000 +0200 -@@ -144,7 +144,7 @@ - - _GLIBCXX_END_NAMESPACE - --#if _GLIBCXX_USE_C99 -+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) - - #undef snprintf - #undef vfscanf diff --git a/patches/gcc/4.2.4/303-c99-complex-ugly-hack.patch b/patches/gcc/4.2.4/303-c99-complex-ugly-hack.patch deleted file mode 100644 index de6d71c..0000000 --- a/patches/gcc/4.2.4/303-c99-complex-ugly-hack.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure ---- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:33:56.000000000 +0200 -@@ -7514,6 +7514,9 @@ - cat >>conftest.$ac_ext <<_ACEOF - /* end confdefs.h. */ - #include -+#ifdef __UCLIBC__ -+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs -+#endif - int - main () - { diff --git a/patches/gcc/4.2.4/304-index_macro.patch b/patches/gcc/4.2.4/304-index_macro.patch deleted file mode 100644 index 1e56b5d..0000000 --- a/patches/gcc/4.2.4/304-index_macro.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/rope gcc-4.2.1/libstdc++-v3/include/ext/rope ---- gcc-4.2.1.orig/libstdc++-v3/include/ext/rope 2006-10-17 13:56:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/include/ext/rope 2007-08-03 20:34:23.000000000 +0200 -@@ -58,6 +58,9 @@ - #include - #include - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - # ifdef __GC - # define __GC_CONST const - # else -diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h ---- gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h 2006-10-17 13:56:21.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h 2007-08-03 20:34:23.000000000 +0200 -@@ -54,6 +54,9 @@ - #include // For uninitialized_copy_n - #include // For power - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) - - using std::size_t; diff --git a/patches/gcc/4.2.4/305-libmudflap-susv3-legacy.patch b/patches/gcc/4.2.4/305-libmudflap-susv3-legacy.patch deleted file mode 100644 index 26e8704..0000000 --- a/patches/gcc/4.2.4/305-libmudflap-susv3-legacy.patch +++ /dev/null @@ -1,48 +0,0 @@ -diff -durN gcc-4.2.1.orig/libmudflap/mf-hooks2.c gcc-4.2.1/libmudflap/mf-hooks2.c ---- gcc-4.2.1.orig/libmudflap/mf-hooks2.c 2005-09-23 23:58:39.000000000 +0200 -+++ gcc-4.2.1/libmudflap/mf-hooks2.c 2007-08-03 20:35:09.000000000 +0200 -@@ -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/patches/gcc/4.2.4/306-libstdc++-namespace.patch b/patches/gcc/4.2.4/306-libstdc++-namespace.patch deleted file mode 100644 index 709e8f2..0000000 --- a/patches/gcc/4.2.4/306-libstdc++-namespace.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:35:40.000000000 +0200 -@@ -32,7 +32,8 @@ - // - - // Written by Benjamin Kosnik -- -+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 -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200 -+++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:35:40.000000000 +0200 -@@ -33,7 +33,8 @@ - // - - // Written by Benjamin Kosnik -- -+namespace std -+{ - template - __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/patches/gcc/4.2.4/402-libbackend_dep_gcov-iov.h.patch b/patches/gcc/4.2.4/402-libbackend_dep_gcov-iov.h.patch deleted file mode 100644 index 32754be..0000000 --- a/patches/gcc/4.2.4/402-libbackend_dep_gcov-iov.h.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -durN gcc-4.2.1.orig/gcc/Makefile.in gcc-4.2.1/gcc/Makefile.in ---- gcc-4.2.1.orig/gcc/Makefile.in 2007-05-31 17:37:38.000000000 +0200 -+++ gcc-4.2.1/gcc/Makefile.in 2007-08-03 20:36:14.000000000 +0200 -@@ -2660,7 +2660,7 @@ - # FIXME: writing proper dependencies for this is a *LOT* of work. - libbackend.o : $(OBJS-common:.o=.c) $(out_file) \ - insn-config.h insn-flags.h insn-codes.h insn-constants.h \ -- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) -+ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ - -DTARGET_NAME=\"$(target_noncanonical)\" \ - -DLOCALEDIR=\"$(localedir)\" \ diff --git a/patches/gcc/4.2.4/800-arm-bigendian.patch b/patches/gcc/4.2.4/800-arm-bigendian.patch deleted file mode 100644 index 2abeccd..0000000 --- a/patches/gcc/4.2.4/800-arm-bigendian.patch +++ /dev/null @@ -1,64 +0,0 @@ -diff -durN gcc-4.2.1.orig/gcc/config/arm/linux-elf.h gcc-4.2.1/gcc/config/arm/linux-elf.h ---- gcc-4.2.1.orig/gcc/config/arm/linux-elf.h 2006-02-17 00:29:10.000000000 +0100 -+++ gcc-4.2.1/gcc/config/arm/linux-elf.h 2007-08-03 20:36:43.000000000 +0200 -@@ -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 -diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc ---- gcc-4.2.1.orig/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200 -+++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:36:43.000000000 +0200 -@@ -705,6 +705,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/patches/gcc/4.2.4/801-softfloat-fix.patch b/patches/gcc/4.2.4/801-softfloat-fix.patch deleted file mode 100644 index 3517856..0000000 --- a/patches/gcc/4.2.4/801-softfloat-fix.patch +++ /dev/null @@ -1,58 +0,0 @@ -This patch (C) 2007 Yann E. MORIN -Licensed under GPL v2. - -First hunk of this patch solves compiling uClibc: - -make[1]: Entering directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' - LD libuClibc-0.9.29.so -libc/libc_so.a(difftime.os): In function `difftime': -difftime.c:(.text+0x8): undefined reference to `__floatsidf' -difftime.c:(.text+0x2c): undefined reference to `__subdf3' -libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr': -_fpmaxtostr.c:(.text+0xd4): undefined reference to `__nedf2' -_fpmaxtostr.c:(.text+0xf8): undefined reference to `__eqdf2' -_fpmaxtostr.c:(.text+0x114): undefined reference to `__divdf3' -_fpmaxtostr.c:(.text+0x120): undefined reference to `__ltdf2' -_fpmaxtostr.c:(.text+0x1c4): undefined reference to `__muldf3' -_fpmaxtostr.c:(.text+0x388): undefined reference to `__gedf2' -_fpmaxtostr.c:(.text+0x430): undefined reference to `__adddf3' -libc/libc_so.a(__psfs_do_numeric.os): In function `__psfs_do_numeric': -__psfs_do_numeric.c:(.text+0x520): undefined reference to `__truncdfsf2' -libc/libc_so.a(strtof.os): In function `strtof': -strtof.c:(.text+0x1c): undefined reference to `__extendsfdf2' -/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/cc_core_prefix/lib/gcc/arm-linux-uclibc/4.1.1/libgcc.a(_fixunsdfsi.o): -In function `__fixunsdfsi': -libgcc2.c:(.text+0x34): undefined reference to `__fixdfsi' -make[2]: *** [lib/libc.so] Error 1 -make[1]: *** [lib/libc.so.0] Error 2 -make[1]: Leaving directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc' -make: *** [/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc/lib/libc.a] -Error 2 - -The second hunk fixes building final gcc because soft-float implies using -lfloat (which we don't have). - - -diff -dur gcc-4.2.0.orig/gcc/config.gcc gcc-4.2.0/gcc/config.gcc ---- gcc-4.2.0.orig/gcc/config.gcc 2007-07-15 11:24:18.000000000 +0200 -+++ gcc-4.2.0/gcc/config.gcc 2007-07-15 11:26:02.000000000 +0200 -@@ -721,7 +721,7 @@ - default_use_cxa_atexit=yes - ;; - *) -- tmake_file="$tmake_file arm/t-linux" -+ tmake_file="$tmake_file arm/t-linux arm/t-arm-elf" - ;; - esac - tm_file="$tm_file arm/aout.h arm/arm.h" -diff -dur gcc-4.2.0.orig/gcc/config/arm/linux-elf.h gcc-4.2.0/gcc/config/arm/linux-elf.h ---- gcc-4.2.0.orig/gcc/config/arm/linux-elf.h 2007-07-15 11:24:18.000000000 +0200 -+++ gcc-4.2.0/gcc/config/arm/linux-elf.h 2007-07-15 11:26:02.000000000 +0200 -@@ -63,7 +63,7 @@ - %{shared:-lc} \ - %{!shared:%{profile:-lc_p}%{!profile:-lc}}" - --#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" -+#define LIBGCC_SPEC "-lgcc" - - #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" - diff --git a/patches/gcc/4.2.4/904-flatten-switch-stmt-00.patch b/patches/gcc/4.2.4/904-flatten-switch-stmt-00.patch deleted file mode 100644 index 6c40c57..0000000 --- a/patches/gcc/4.2.4/904-flatten-switch-stmt-00.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -durN gcc-4.2.1.orig/gcc/stmt.c gcc-4.2.1/gcc/stmt.c ---- gcc-4.2.1.orig/gcc/stmt.c 2007-07-19 05:25:32.000000000 +0200 -+++ gcc-4.2.1/gcc/stmt.c 2007-08-03 20:37:19.000000000 +0200 -@@ -2512,7 +2512,11 @@ - 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); - } -@@ -3070,6 +3074,7 @@ - { - 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, diff --git a/patches/gcc/4.2.4/920-soft-float.patch b/patches/gcc/4.2.4/920-soft-float.patch deleted file mode 100644 index 4287bfa..0000000 --- a/patches/gcc/4.2.4/920-soft-float.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -uNpr gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c ---- gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c 2007-03-05 11:54:00.000000000 -0500 -+++ gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c 2008-01-31 17:51:24.000000000 -0500 -@@ -70,6 +70,8 @@ Software Foundation, 51 Franklin Street, - but GCC currently generates poor code when a union is used to turn - a long double into a pair of doubles. */ - -+#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) -+ - long double __gcc_qadd (double, double, double, double); - long double __gcc_qsub (double, double, double, double); - long double __gcc_qmul (double, double, double, double); -@@ -219,8 +221,6 @@ __gcc_qdiv (double a, double b, double c - return z.ldval; - } - --#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__) -- - long double __gcc_qneg (double, double); - int __gcc_qeq (double, double, double, double); - int __gcc_qne (double, double, double, double); diff --git a/patches/gcc/4.2.4/930-eabi_fixes.patch b/patches/gcc/4.2.4/930-eabi_fixes.patch deleted file mode 100644 index 7dce608..0000000 --- a/patches/gcc/4.2.4/930-eabi_fixes.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -durN gcc-4.2.3.orig/gcc/config/arm/linux-eabi.h gcc-4.2.3/gcc/config/arm/linux-eabi.h ---- gcc-4.2.3.orig/gcc/config/arm/linux-eabi.h 2007-09-01 17:28:30.000000000 +0200 -+++ gcc-4.2.3/gcc/config/arm/linux-eabi.h 2008-05-25 23:47:36.000000000 +0200 -@@ -47,7 +47,8 @@ - #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi - - #undef SUBTARGET_EXTRA_LINK_SPEC --#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi" -+#define SUBTARGET_EXTRA_LINK_SPEC \ -+ " %{mlittle-endian:-m armelf_linux_eabi} %{mbig-endian:-m armelfb_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/patches/gcc/4.2.4/940-alpha-signal_h.patch b/patches/gcc/4.2.4/940-alpha-signal_h.patch deleted file mode 100644 index d7e1796..0000000 --- a/patches/gcc/4.2.4/940-alpha-signal_h.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- gcc-4.2.1-stock/gcc/config/alpha/linux-unwind.h 2005-06-24 20:22:41.000000000 -0500 -+++ gcc-4.2.1/gcc/config/alpha/linux-unwind.h 2007-09-01 20:21:34.000000000 -0500 -@@ -29,6 +29,9 @@ Boston, MA 02110-1301, USA. */ - /* Do code reading to identify a signal frame, and set the frame - state data appropriately. See unwind-dw2.c for the structs. */ - -+/* Don't use this if inhibit_libc is set -+ The build for this target will fail trying to include missing headers */ -+#ifndef inhibit_libc - #include - #include - -@@ -80,3 +83,4 @@ alpha_fallback_frame_state (struct _Unwi - fs->retaddr_column = 64; - return _URC_NO_REASON; - } -+#endif /* inhibit_libc */ diff --git a/patches/gcc/4.2.4/950-fortran-signed-TImode.patch b/patches/gcc/4.2.4/950-fortran-signed-TImode.patch deleted file mode 100644 index 01e2f01..0000000 --- a/patches/gcc/4.2.4/950-fortran-signed-TImode.patch +++ /dev/null @@ -1,43 +0,0 @@ -Fix building gfortran for ARM. -http://gcc.gnu.org/ml/gcc-patches/2007-05/msg01010.html ----- - -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 - - gcc/fortran/ - * trans-types.c (gfc_type_for_size): Handle signed TImode. - -diff -durN gcc-4.2.3.old/gcc/fortran/trans-types.c gcc-4.2.3/gcc/fortran/trans-types.c ---- gcc-4.2.3.old/gcc/fortran/trans-types.c 2007-08-31 10:27:50.000000000 +0200 -+++ gcc-4.2.3/gcc/fortran/trans-types.c 2008-07-17 09:54:20.000000000 +0200 -@@ -1799,6 +1799,13 @@ - 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/patches/gcc/4.3.0/110-trampolinewarn.patch b/patches/gcc/4.3.0/110-trampolinewarn.patch new file mode 100644 index 0000000..0c14ec3 --- /dev/null +++ b/patches/gcc/4.3.0/110-trampolinewarn.patch @@ -0,0 +1,35 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/00_all_gcc-trampolinewarn.patch + This trivial patch causes gcc to emit a warning whenever + it generates a trampoline. These are otherwise hard to + locate. It is rigged to default ON - to have it default + to OFF remove the text 'Init(1)' from the common.opt + patch, leaving just 'Common Var(warn_trampolines)'. + Kevin F. Quinn 17 Jan 2006 + +diff -durN gcc-4.3.0.orig/gcc/builtins.c gcc-4.3.0/gcc/builtins.c +--- gcc-4.3.0.orig/gcc/builtins.c 2008-02-20 18:27:21.000000000 +0100 ++++ gcc-4.3.0/gcc/builtins.c 2008-06-10 14:44:10.000000000 +0200 +@@ -5659,6 +5659,9 @@ + trampolines_created = 1; + INITIALIZE_TRAMPOLINE (r_tramp, r_func, r_chain); + ++ if (warn_trampolines) ++ warning (OPT_Wtrampolines, "generating trampoline in object (requires executable stack)"); ++ + return const0_rtx; + } + +diff -durN gcc-4.3.0.orig/gcc/common.opt gcc-4.3.0/gcc/common.opt +--- gcc-4.3.0.orig/gcc/common.opt 2008-01-22 15:11:44.000000000 +0100 ++++ gcc-4.3.0/gcc/common.opt 2008-06-10 14:44:10.000000000 +0200 +@@ -182,6 +182,10 @@ + Common Var(warn_system_headers) Warning + Do not suppress warnings from system headers + ++Wtrampolines ++Common Var(warn_trampolines) Init(1) ++Warn whenever a trampoline is generated ++ + Wuninitialized + Common Var(warn_uninitialized) Warning + Warn about uninitialized automatic variables diff --git a/patches/gcc/4.3.0/120-java-nomulti.patch b/patches/gcc/4.3.0/120-java-nomulti.patch new file mode 100644 index 0000000..f75fbf6 --- /dev/null +++ b/patches/gcc/4.3.0/120-java-nomulti.patch @@ -0,0 +1,47 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/03_all_gcc43-java-nomulti.patch +diff -durN gcc-4.3.0.orig/libjava/configure gcc-4.3.0/libjava/configure +--- gcc-4.3.0.orig/libjava/configure 2008-03-05 19:44:25.000000000 +0100 ++++ gcc-4.3.0/libjava/configure 2008-06-10 14:44:13.000000000 +0200 +@@ -1018,6 +1018,8 @@ + --enable-gconf-peer compile GConf native peers for util.preferences + --enable-java-maintainer-mode + allow rebuilding of .class and .h files ++ --enable-libjava-multilib ++ build libjava as multilib + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-maintainer-mode enable make rules and dependencies not useful +@@ -1850,6 +1852,16 @@ + fi + + ++# Check whether --enable-libjava-multilib was given. ++if test "${enable_libjava_multilib+set}" = set; then ++ enableval=$enable_libjava_multilib; ++fi ++ ++if test "$enable_libjava_multilib" = no; then ++ multilib=no ++ ac_configure_args="$ac_configure_args --disable-multilib" ++fi ++ + # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX. + + +diff -durN gcc-4.3.0.orig/libjava/configure.ac gcc-4.3.0/libjava/configure.ac +--- gcc-4.3.0.orig/libjava/configure.ac 2007-12-22 16:48:46.000000000 +0100 ++++ gcc-4.3.0/libjava/configure.ac 2008-06-10 14:44:13.000000000 +0200 +@@ -82,6 +82,13 @@ + [allow rebuilding of .class and .h files])) + AM_CONDITIONAL(JAVA_MAINTAINER_MODE, test "$enable_java_maintainer_mode" = yes) + ++AC_ARG_ENABLE(libjava-multilib, ++ AS_HELP_STRING([--enable-libjava-multilib], [build libjava as multilib])) ++if test "$enable_libjava_multilib" = no; then ++ multilib=no ++ ac_configure_args="$ac_configure_args --disable-multilib" ++fi ++ + # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX. + GCC_NO_EXECUTABLES + diff --git a/patches/gcc/4.3.0/125-trampolinewarn.patch b/patches/gcc/4.3.0/125-trampolinewarn.patch deleted file mode 100644 index 0c14ec3..0000000 --- a/patches/gcc/4.3.0/125-trampolinewarn.patch +++ /dev/null @@ -1,35 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/00_all_gcc-trampolinewarn.patch - This trivial patch causes gcc to emit a warning whenever - it generates a trampoline. These are otherwise hard to - locate. It is rigged to default ON - to have it default - to OFF remove the text 'Init(1)' from the common.opt - patch, leaving just 'Common Var(warn_trampolines)'. - Kevin F. Quinn 17 Jan 2006 - -diff -durN gcc-4.3.0.orig/gcc/builtins.c gcc-4.3.0/gcc/builtins.c ---- gcc-4.3.0.orig/gcc/builtins.c 2008-02-20 18:27:21.000000000 +0100 -+++ gcc-4.3.0/gcc/builtins.c 2008-06-10 14:44:10.000000000 +0200 -@@ -5659,6 +5659,9 @@ - trampolines_created = 1; - INITIALIZE_TRAMPOLINE (r_tramp, r_func, r_chain); - -+ if (warn_trampolines) -+ warning (OPT_Wtrampolines, "generating trampoline in object (requires executable stack)"); -+ - return const0_rtx; - } - -diff -durN gcc-4.3.0.orig/gcc/common.opt gcc-4.3.0/gcc/common.opt ---- gcc-4.3.0.orig/gcc/common.opt 2008-01-22 15:11:44.000000000 +0100 -+++ gcc-4.3.0/gcc/common.opt 2008-06-10 14:44:10.000000000 +0200 -@@ -182,6 +182,10 @@ - Common Var(warn_system_headers) Warning - Do not suppress warnings from system headers - -+Wtrampolines -+Common Var(warn_trampolines) Init(1) -+Warn whenever a trampoline is generated -+ - Wuninitialized - Common Var(warn_uninitialized) Warning - Warn about uninitialized automatic variables diff --git a/patches/gcc/4.3.0/130-cross-compile.patch b/patches/gcc/4.3.0/130-cross-compile.patch new file mode 100644 index 0000000..7eddac3 --- /dev/null +++ b/patches/gcc/4.3.0/130-cross-compile.patch @@ -0,0 +1,44 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/08_all_gcc-4.1-cross-compile.patch +Some notes on the 'bootstrap with or without libc headers' debate: +http://linuxfromscratch.org/pipermail/lfs-dev/2005-July/052409.html +http://gcc.gnu.org/ml/gcc/2005-07/msg01195.html + +diff -durN gcc-4.3.0.orig/gcc/configure gcc-4.3.0/gcc/configure +--- gcc-4.3.0.orig/gcc/configure 2008-03-05 00:39:11.000000000 +0100 ++++ gcc-4.3.0/gcc/configure 2008-06-10 14:44:17.000000000 +0200 +@@ -13274,7 +13274,7 @@ + | powerpc*-*-*,powerpc64*-*-*) + CROSS="$CROSS -DNATIVE_CROSS" ;; + esac +-elif test "x$TARGET_SYSTEM_ROOT" != x; then ++elif test "x$TARGET_SYSTEM_ROOT" != x -o $build != $host; then + SYSTEM_HEADER_DIR=$build_system_header_dir + fi + +diff -durN gcc-4.3.0.orig/gcc/configure.ac gcc-4.3.0/gcc/configure.ac +--- gcc-4.3.0.orig/gcc/configure.ac 2008-03-05 00:39:11.000000000 +0100 ++++ gcc-4.3.0/gcc/configure.ac 2008-06-10 14:44:17.000000000 +0200 +@@ -1745,7 +1745,7 @@ + | powerpc*-*-*,powerpc64*-*-*) + CROSS="$CROSS -DNATIVE_CROSS" ;; + esac +-elif test "x$TARGET_SYSTEM_ROOT" != x; then ++elif test "x$TARGET_SYSTEM_ROOT" != x -o $build != $host; then + SYSTEM_HEADER_DIR=$build_system_header_dir + fi + +diff -durN gcc-4.3.0.orig/gcc/unwind-dw2.c gcc-4.3.0/gcc/unwind-dw2.c +--- gcc-4.3.0.orig/gcc/unwind-dw2.c 2007-07-25 20:14:57.000000000 +0200 ++++ gcc-4.3.0/gcc/unwind-dw2.c 2008-06-10 14:44:17.000000000 +0200 +@@ -334,9 +334,11 @@ + } + #endif + ++#ifndef inhibit_libc + #ifdef MD_UNWIND_SUPPORT + #include MD_UNWIND_SUPPORT + #endif ++#endif + + /* Extract any interesting information from the CIE for the translation + unit F belongs to. Return a pointer to the byte after the augmentation, diff --git a/patches/gcc/4.3.0/140-netbsd-symbolic.patch b/patches/gcc/4.3.0/140-netbsd-symbolic.patch new file mode 100644 index 0000000..a4e6913 --- /dev/null +++ b/patches/gcc/4.3.0/140-netbsd-symbolic.patch @@ -0,0 +1,14 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/11_all_gcc-netbsd-symbolic.patch +http://bugs.gentoo.org/122698 + +diff -durN gcc-4.3.0.orig/gcc/config/netbsd-elf.h gcc-4.3.0/gcc/config/netbsd-elf.h +--- gcc-4.3.0.orig/gcc/config/netbsd-elf.h 2007-09-03 18:14:04.000000000 +0200 ++++ gcc-4.3.0/gcc/config/netbsd-elf.h 2008-06-10 14:44:21.000000000 +0200 +@@ -82,6 +82,7 @@ + #define NETBSD_LINK_SPEC_ELF \ + "%{assert*} %{R*} %{rpath*} \ + %{shared:-shared} \ ++ %{symbolic:-Bsymbolic} \ + %{!shared: \ + -dc -dp \ + %{!nostdlib: \ diff --git a/patches/gcc/4.3.0/150-java-nomulti.patch b/patches/gcc/4.3.0/150-java-nomulti.patch deleted file mode 100644 index f75fbf6..0000000 --- a/patches/gcc/4.3.0/150-java-nomulti.patch +++ /dev/null @@ -1,47 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/03_all_gcc43-java-nomulti.patch -diff -durN gcc-4.3.0.orig/libjava/configure gcc-4.3.0/libjava/configure ---- gcc-4.3.0.orig/libjava/configure 2008-03-05 19:44:25.000000000 +0100 -+++ gcc-4.3.0/libjava/configure 2008-06-10 14:44:13.000000000 +0200 -@@ -1018,6 +1018,8 @@ - --enable-gconf-peer compile GConf native peers for util.preferences - --enable-java-maintainer-mode - allow rebuilding of .class and .h files -+ --enable-libjava-multilib -+ build libjava as multilib - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - --enable-maintainer-mode enable make rules and dependencies not useful -@@ -1850,6 +1852,16 @@ - fi - - -+# Check whether --enable-libjava-multilib was given. -+if test "${enable_libjava_multilib+set}" = set; then -+ enableval=$enable_libjava_multilib; -+fi -+ -+if test "$enable_libjava_multilib" = no; then -+ multilib=no -+ ac_configure_args="$ac_configure_args --disable-multilib" -+fi -+ - # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX. - - -diff -durN gcc-4.3.0.orig/libjava/configure.ac gcc-4.3.0/libjava/configure.ac ---- gcc-4.3.0.orig/libjava/configure.ac 2007-12-22 16:48:46.000000000 +0100 -+++ gcc-4.3.0/libjava/configure.ac 2008-06-10 14:44:13.000000000 +0200 -@@ -82,6 +82,13 @@ - [allow rebuilding of .class and .h files])) - AM_CONDITIONAL(JAVA_MAINTAINER_MODE, test "$enable_java_maintainer_mode" = yes) - -+AC_ARG_ENABLE(libjava-multilib, -+ AS_HELP_STRING([--enable-libjava-multilib], [build libjava as multilib])) -+if test "$enable_libjava_multilib" = no; then -+ multilib=no -+ ac_configure_args="$ac_configure_args --disable-multilib" -+fi -+ - # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX. - GCC_NO_EXECUTABLES - diff --git a/patches/gcc/4.3.0/150-sparc64-bsd.patch b/patches/gcc/4.3.0/150-sparc64-bsd.patch new file mode 100644 index 0000000..7c4fb5d --- /dev/null +++ b/patches/gcc/4.3.0/150-sparc64-bsd.patch @@ -0,0 +1,30 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/14_all_gcc-sparc64-bsd.patch +diff -durN gcc-4.3.0.orig/gcc/config/sparc/freebsd.h gcc-4.3.0/gcc/config/sparc/freebsd.h +--- gcc-4.3.0.orig/gcc/config/sparc/freebsd.h 2007-08-02 12:49:31.000000000 +0200 ++++ gcc-4.3.0/gcc/config/sparc/freebsd.h 2008-06-10 14:44:26.000000000 +0200 +@@ -25,9 +25,22 @@ + /* FreeBSD needs the platform name (sparc64) defined. + Emacs needs to know if the arch is 64 or 32-bits. */ + +-#undef CPP_CPU64_DEFAULT_SPEC +-#define CPP_CPU64_DEFAULT_SPEC \ +- "-D__sparc64__ -D__sparc_v9__ -D__sparcv9 -D__arch64__" ++#undef FBSD_TARGET_CPU_CPP_BUILTINS ++#define FBSD_TARGET_CPU_CPP_BUILTINS() \ ++ do \ ++ { \ ++ if (TARGET_ARCH64) \ ++ { \ ++ builtin_define ("__sparc64__"); \ ++ builtin_define ("__sparc_v9__"); \ ++ builtin_define ("__sparcv9"); \ ++ } \ ++ else \ ++ builtin_define ("__sparc"); \ ++ builtin_define ("__sparc__"); \ ++ } \ ++ while (0) ++ + + #define LINK_SPEC "%(link_arch) \ + %{!mno-relax:%{!r:-relax}} \ diff --git a/patches/gcc/4.3.0/160-flatten-switch-stmt-00.patch b/patches/gcc/4.3.0/160-flatten-switch-stmt-00.patch new file mode 100644 index 0000000..390f45e --- /dev/null +++ b/patches/gcc/4.3.0/160-flatten-switch-stmt-00.patch @@ -0,0 +1,76 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/18_all_904-flatten-switch-stmt-00.patch +http://gcc.gnu.org/ml/gcc-patches/2007-04/msg00927.html + +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" + +diff -durN gcc-4.3.0.orig/gcc/stmt.c gcc-4.3.0/gcc/stmt.c +--- gcc-4.3.0.orig/gcc/stmt.c 2007-12-04 22:55:32.000000000 +0100 ++++ gcc-4.3.0/gcc/stmt.c 2008-06-10 14:44:33.000000000 +0200 +@@ -2508,7 +2508,11 @@ + 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); + } +@@ -3066,6 +3070,7 @@ + { + 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, diff --git a/patches/gcc/4.3.0/170-x86-emit-cld.patch b/patches/gcc/4.3.0/170-x86-emit-cld.patch new file mode 100644 index 0000000..a2b723a --- /dev/null +++ b/patches/gcc/4.3.0/170-x86-emit-cld.patch @@ -0,0 +1,156 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/20_all_gcc-x86-emit-cld.patch +bandaid for the cld issue. to be dropped when gcc-4.3 goes stable. + +http://gcc.gnu.org/ml/gcc-patches/2008-03/msg00417.html + +2008-03-06 Uros Bizjak + + * config/i386/i386.h (TARGET_CLD): New define. + (struct machine_function): Add needs_cld field. + (ix86_current_function_needs_cld): New define. + * config/i386/i386.md (UNSPEC_CLD): New unspec volatile constant. + ("cld"): New isns pattern. + ("strmov_singleop"): Set ix86_current_function_needs_cld flag. + ("rep_mov"): Ditto. + ("strset_singleop"): Ditto. + ("rep_stos"): Ditto. + ("cmpstrnqi_nz_1"): Ditto. + ("cmpstrnqi_1"): Ditto. + ("strlenqi_1"): Ditto. + * config/i386/i386.c (ix86_expand_prologue): Emit cld insn for + TARGET_CLD when ix86_current_function_needs_cld is set. + +diff -durN gcc-4.3.0.orig/gcc/config/i386/i386.c gcc-4.3.0/gcc/config/i386/i386.c +--- gcc-4.3.0.orig/gcc/config/i386/i386.c 2008-02-21 13:30:00.000000000 +0100 ++++ gcc-4.3.0/gcc/config/i386/i386.c 2008-06-10 14:44:37.000000000 +0200 +@@ -6448,6 +6448,10 @@ + emit_insn (gen_prologue_use (pic_offset_table_rtx)); + emit_insn (gen_blockage ()); + } ++ ++ /* Emit cld instruction if stringops are used in the function. */ ++ if (TARGET_CLD && ix86_current_function_needs_cld) ++ emit_insn (gen_cld ()); + } + + /* Emit code to restore saved registers using MOV insns. First register +diff -durN gcc-4.3.0.orig/gcc/config/i386/i386.h gcc-4.3.0/gcc/config/i386/i386.h +--- gcc-4.3.0.orig/gcc/config/i386/i386.h 2008-02-15 09:12:02.000000000 +0100 ++++ gcc-4.3.0/gcc/config/i386/i386.h 2008-06-10 14:44:37.000000000 +0200 +@@ -388,6 +388,7 @@ + + extern int x86_prefetch_sse; + ++#define TARGET_CLD 1 + #define TARGET_ABM x86_abm + #define TARGET_CMPXCHG16B x86_cmpxchg16b + #define TARGET_POPCNT x86_popcnt +@@ -2443,8 +2444,9 @@ + int save_varrargs_registers; + int accesses_prev_frame; + int optimize_mode_switching[MAX_386_ENTITIES]; +- /* Set by ix86_compute_frame_layout and used by prologue/epilogue expander to +- determine the style used. */ ++ int needs_cld; ++ /* Set by ix86_compute_frame_layout and used by prologue/epilogue ++ expander to determine the style used. */ + int use_fast_prologue_epilogue; + /* Number of saved registers USE_FAST_PROLOGUE_EPILOGUE has been computed + for. */ +@@ -2464,6 +2466,7 @@ + #define ix86_stack_locals (cfun->machine->stack_locals) + #define ix86_save_varrargs_registers (cfun->machine->save_varrargs_registers) + #define ix86_optimize_mode_switching (cfun->machine->optimize_mode_switching) ++#define ix86_current_function_needs_cld (cfun->machine->needs_cld) + #define ix86_tls_descriptor_calls_expanded_in_cfun \ + (cfun->machine->tls_descriptor_call_expanded_p) + /* Since tls_descriptor_call_expanded is not cleared, even if all TLS +diff -durN gcc-4.3.0.orig/gcc/config/i386/i386.md gcc-4.3.0/gcc/config/i386/i386.md +--- gcc-4.3.0.orig/gcc/config/i386/i386.md 2008-02-06 12:34:00.000000000 +0100 ++++ gcc-4.3.0/gcc/config/i386/i386.md 2008-06-10 14:44:37.000000000 +0200 +@@ -205,6 +205,7 @@ + (UNSPECV_XCHG 12) + (UNSPECV_LOCK 13) + (UNSPECV_PROLOGUE_USE 14) ++ (UNSPECV_CLD 15) + ]) + + ;; Constants to represent pcomtrue/pcomfalse variants +@@ -18529,6 +18530,14 @@ + + ;; Block operation instructions + ++(define_insn "cld" ++ [(unspec_volatile [(const_int 0)] UNSPECV_CLD)] ++ "" ++ "cld" ++ [(set_attr "length" "1") ++ (set_attr "length_immediate" "0") ++ (set_attr "modrm" "0")]) ++ + (define_expand "movmemsi" + [(use (match_operand:BLK 0 "memory_operand" "")) + (use (match_operand:BLK 1 "memory_operand" "")) +@@ -18601,7 +18610,7 @@ + (set (match_operand 2 "register_operand" "") + (match_operand 5 "" ""))])] + "TARGET_SINGLE_STRINGOP || optimize_size" +- "") ++ "ix86_current_function_needs_cld = 1;") + + (define_insn "*strmovdi_rex_1" + [(set (mem:DI (match_operand:DI 2 "register_operand" "0")) +@@ -18718,7 +18727,7 @@ + (match_operand 3 "memory_operand" "")) + (use (match_dup 4))])] + "" +- "") ++ "ix86_current_function_needs_cld = 1;") + + (define_insn "*rep_movdi_rex64" + [(set (match_operand:DI 2 "register_operand" "=c") (const_int 0)) +@@ -18878,7 +18887,7 @@ + (set (match_operand 0 "register_operand" "") + (match_operand 3 "" ""))])] + "TARGET_SINGLE_STRINGOP || optimize_size" +- "") ++ "ix86_current_function_needs_cld = 1;") + + (define_insn "*strsetdi_rex_1" + [(set (mem:DI (match_operand:DI 1 "register_operand" "0")) +@@ -18972,7 +18981,7 @@ + (use (match_operand 3 "register_operand" "")) + (use (match_dup 1))])] + "" +- "") ++ "ix86_current_function_needs_cld = 1;") + + (define_insn "*rep_stosdi_rex64" + [(set (match_operand:DI 1 "register_operand" "=c") (const_int 0)) +@@ -19148,7 +19157,7 @@ + (clobber (match_operand 1 "register_operand" "")) + (clobber (match_dup 2))])] + "" +- "") ++ "ix86_current_function_needs_cld = 1;") + + (define_insn "*cmpstrnqi_nz_1" + [(set (reg:CC FLAGS_REG) +@@ -19195,7 +19204,7 @@ + (clobber (match_operand 1 "register_operand" "")) + (clobber (match_dup 2))])] + "" +- "") ++ "ix86_current_function_needs_cld = 1;") + + (define_insn "*cmpstrnqi_1" + [(set (reg:CC FLAGS_REG) +@@ -19264,7 +19273,7 @@ + (clobber (match_operand 1 "register_operand" "")) + (clobber (reg:CC FLAGS_REG))])] + "" +- "") ++ "ix86_current_function_needs_cld = 1;") + + (define_insn "*strlenqi_1" + [(set (match_operand:SI 0 "register_operand" "=&c") diff --git a/patches/gcc/4.3.0/175-cross-compile.patch b/patches/gcc/4.3.0/175-cross-compile.patch deleted file mode 100644 index 7eddac3..0000000 --- a/patches/gcc/4.3.0/175-cross-compile.patch +++ /dev/null @@ -1,44 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/08_all_gcc-4.1-cross-compile.patch -Some notes on the 'bootstrap with or without libc headers' debate: -http://linuxfromscratch.org/pipermail/lfs-dev/2005-July/052409.html -http://gcc.gnu.org/ml/gcc/2005-07/msg01195.html - -diff -durN gcc-4.3.0.orig/gcc/configure gcc-4.3.0/gcc/configure ---- gcc-4.3.0.orig/gcc/configure 2008-03-05 00:39:11.000000000 +0100 -+++ gcc-4.3.0/gcc/configure 2008-06-10 14:44:17.000000000 +0200 -@@ -13274,7 +13274,7 @@ - | powerpc*-*-*,powerpc64*-*-*) - CROSS="$CROSS -DNATIVE_CROSS" ;; - esac --elif test "x$TARGET_SYSTEM_ROOT" != x; then -+elif test "x$TARGET_SYSTEM_ROOT" != x -o $build != $host; then - SYSTEM_HEADER_DIR=$build_system_header_dir - fi - -diff -durN gcc-4.3.0.orig/gcc/configure.ac gcc-4.3.0/gcc/configure.ac ---- gcc-4.3.0.orig/gcc/configure.ac 2008-03-05 00:39:11.000000000 +0100 -+++ gcc-4.3.0/gcc/configure.ac 2008-06-10 14:44:17.000000000 +0200 -@@ -1745,7 +1745,7 @@ - | powerpc*-*-*,powerpc64*-*-*) - CROSS="$CROSS -DNATIVE_CROSS" ;; - esac --elif test "x$TARGET_SYSTEM_ROOT" != x; then -+elif test "x$TARGET_SYSTEM_ROOT" != x -o $build != $host; then - SYSTEM_HEADER_DIR=$build_system_header_dir - fi - -diff -durN gcc-4.3.0.orig/gcc/unwind-dw2.c gcc-4.3.0/gcc/unwind-dw2.c ---- gcc-4.3.0.orig/gcc/unwind-dw2.c 2007-07-25 20:14:57.000000000 +0200 -+++ gcc-4.3.0/gcc/unwind-dw2.c 2008-06-10 14:44:17.000000000 +0200 -@@ -334,9 +334,11 @@ - } - #endif - -+#ifndef inhibit_libc - #ifdef MD_UNWIND_SUPPORT - #include MD_UNWIND_SUPPORT - #endif -+#endif - - /* Extract any interesting information from the CIE for the translation - unit F belongs to. Return a pointer to the byte after the augmentation, diff --git a/patches/gcc/4.3.0/180-libiberty-pic.patch b/patches/gcc/4.3.0/180-libiberty-pic.patch new file mode 100644 index 0000000..844f83a --- /dev/null +++ b/patches/gcc/4.3.0/180-libiberty-pic.patch @@ -0,0 +1,12 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/51_all_gcc-3.4-libiberty-pic.patch +diff -durN gcc-4.3.0.orig/libiberty/Makefile.in gcc-4.3.0/libiberty/Makefile.in +--- gcc-4.3.0.orig/libiberty/Makefile.in 2007-07-25 08:26:45.000000000 +0200 ++++ gcc-4.3.0/libiberty/Makefile.in 2008-06-10 14:44:43.000000000 +0200 +@@ -225,6 +225,7 @@ + $(AR) $(AR_FLAGS) $(TARGETLIB) \ + $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \ + $(RANLIB) $(TARGETLIB); \ ++ cp $(TARGETLIB) ../ ; \ + cd ..; \ + else true; fi + diff --git a/patches/gcc/4.3.0/190-superh-default-multilib.patch b/patches/gcc/4.3.0/190-superh-default-multilib.patch new file mode 100644 index 0000000..4898a36 --- /dev/null +++ b/patches/gcc/4.3.0/190-superh-default-multilib.patch @@ -0,0 +1,25 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/53_all_gcc4-superh-default-multilib.patch +The gcc-3.x toolchains would contain all the targets by default. With gcc-4, +you have to actually list out the multilibs you want or you will end up with +just one when using targets like 'sh4-linux-gnu'. + +The resulting toolchain can't even build a kernel as the kernel needs to build +with the nofpu flag to be sure that no fpu ops are generated. + +Here we restore the gcc-3.x behavior; the additional overhead of building all +of these multilibs by default is negligible. + +http://bugs.gentoo.org/140205 + +diff -durN gcc-4.3.0.orig/gcc/config.gcc gcc-4.3.0/gcc/config.gcc +--- gcc-4.3.0.orig/gcc/config.gcc 2008-01-29 17:28:10.000000000 +0100 ++++ gcc-4.3.0/gcc/config.gcc 2008-06-10 14:44:47.000000000 +0200 +@@ -2271,7 +2271,7 @@ + if test x${sh_multilibs} = x ; then + case ${target} in + sh64-superh-linux* | \ +- sh[1234]*) sh_multilibs=${sh_cpu_target} ;; ++ sh[1234]*) sh_multilibs=`cd ${srcdir}/config/sh ; echo t-mlib-sh[1-4]* | sed 's:t-mlib-sh:,m:g;s: ::g'` ;; + sh64* | sh5*) sh_multilibs=m5-32media,m5-32media-nofpu,m5-compact,m5-compact-nofpu,m5-64media,m5-64media-nofpu ;; + sh-superh-*) sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;; + sh*-*-linux*) sh_multilibs=m1,m3e,m4 ;; diff --git a/patches/gcc/4.3.0/200-libstdc++-pic.patch b/patches/gcc/4.3.0/200-libstdc++-pic.patch new file mode 100644 index 0000000..21c2245 --- /dev/null +++ b/patches/gcc/4.3.0/200-libstdc++-pic.patch @@ -0,0 +1,56 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/54_all_300-libstdc++-pic.patch +install libstdc++_pic.a if we have pic objs + +diff -durN gcc-4.3.0.orig/libstdc++-v3/src/Makefile.am gcc-4.3.0/libstdc++-v3/src/Makefile.am +--- gcc-4.3.0.orig/libstdc++-v3/src/Makefile.am 2008-02-29 19:26:50.000000000 +0100 ++++ gcc-4.3.0/libstdc++-v3/src/Makefile.am 2008-06-10 14:44:51.000000000 +0200 +@@ -289,6 +289,13 @@ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ + + ++install-exec-local: ++ pic_objs=`sed -n "s:'::g;s:^pic_object=::p" *.lo | grep -v '^none$$'`; \ ++ if [ x"$$pic_objs" != x ]; then \ ++ $(AR) cru libstdc++_pic.a $$pic_objs $(top_builddir)/libsupc++/*.o || exit 1; \ ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) || exit 1; \ ++ fi ++ + # Added bits to build debug library. + if GLIBCXX_BUILD_DEBUG + all-local: build_debug +diff -durN gcc-4.3.0.orig/libstdc++-v3/src/Makefile.in gcc-4.3.0/libstdc++-v3/src/Makefile.in +--- gcc-4.3.0.orig/libstdc++-v3/src/Makefile.in 2008-02-29 19:26:50.000000000 +0100 ++++ gcc-4.3.0/libstdc++-v3/src/Makefile.in 2008-06-10 14:44:51.000000000 +0200 +@@ -693,7 +693,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 + +@@ -732,7 +732,7 @@ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ +- uninstall-toolexeclibLTLIBRARIES ++ uninstall-toolexeclibLTLIBRARIES install-exec-local + + + # Symbol versioning for shared libraries. +@@ -858,6 +858,14 @@ + install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ++ ++install-exec-local: ++ pic_objs=`sed -n "s:'::g;s:^pic_object=::p" *.lo | grep -v '^none$$'`; \ ++ if [ x"$$pic_objs" != x ]; then \ ++ $(AR) cru libstdc++_pic.a $$pic_objs $(top_builddir)/libsupc++/*.o || exit 1; \ ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) || exit 1; \ ++ fi ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff --git a/patches/gcc/4.3.0/200-netbsd-symbolic.patch b/patches/gcc/4.3.0/200-netbsd-symbolic.patch deleted file mode 100644 index a4e6913..0000000 --- a/patches/gcc/4.3.0/200-netbsd-symbolic.patch +++ /dev/null @@ -1,14 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/11_all_gcc-netbsd-symbolic.patch -http://bugs.gentoo.org/122698 - -diff -durN gcc-4.3.0.orig/gcc/config/netbsd-elf.h gcc-4.3.0/gcc/config/netbsd-elf.h ---- gcc-4.3.0.orig/gcc/config/netbsd-elf.h 2007-09-03 18:14:04.000000000 +0200 -+++ gcc-4.3.0/gcc/config/netbsd-elf.h 2008-06-10 14:44:21.000000000 +0200 -@@ -82,6 +82,7 @@ - #define NETBSD_LINK_SPEC_ELF \ - "%{assert*} %{R*} %{rpath*} \ - %{shared:-shared} \ -+ %{symbolic:-Bsymbolic} \ - %{!shared: \ - -dc -dp \ - %{!nostdlib: \ diff --git a/patches/gcc/4.3.0/210-pr35440.patch b/patches/gcc/4.3.0/210-pr35440.patch new file mode 100644 index 0000000..097496b --- /dev/null +++ b/patches/gcc/4.3.0/210-pr35440.patch @@ -0,0 +1,59 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/60_all_gcc43-pr35440.patch +2008-03-19 Jakub Jelinek + + PR c/35440 + * c-pretty-print.c (pp_c_initializer_list): Handle CONSTRUCTOR + for all types. + + * gcc.dg/pr35440.c: New test. + +diff -durN gcc-4.3.0.orig/gcc/c-pretty-print.c gcc-4.3.0/gcc/c-pretty-print.c +--- gcc-4.3.0.orig/gcc/c-pretty-print.c 2008-01-29 14:59:59.000000000 +0100 ++++ gcc-4.3.0/gcc/c-pretty-print.c 2008-06-10 14:44:54.000000000 +0200 +@@ -1173,6 +1173,12 @@ + tree type = TREE_TYPE (e); + const enum tree_code code = TREE_CODE (type); + ++ if (TREE_CODE (e) == CONSTRUCTOR) ++ { ++ pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e)); ++ return; ++ } ++ + switch (code) + { + case RECORD_TYPE: +@@ -1207,16 +1213,12 @@ + case VECTOR_TYPE: + if (TREE_CODE (e) == VECTOR_CST) + pp_c_expression_list (pp, TREE_VECTOR_CST_ELTS (e)); +- else if (TREE_CODE (e) == CONSTRUCTOR) +- pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e)); + else + break; + return; + + case COMPLEX_TYPE: +- if (TREE_CODE (e) == CONSTRUCTOR) +- pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e)); +- else if (TREE_CODE (e) == COMPLEX_CST || TREE_CODE (e) == COMPLEX_EXPR) ++ if (TREE_CODE (e) == COMPLEX_CST || TREE_CODE (e) == COMPLEX_EXPR) + { + const bool cst = TREE_CODE (e) == COMPLEX_CST; + pp_expression (pp, cst ? TREE_REALPART (e) : TREE_OPERAND (e, 0)); +diff -durN gcc-4.3.0.orig/gcc/testsuite/gcc.dg/pr35440.c gcc-4.3.0/gcc/testsuite/gcc.dg/pr35440.c +--- gcc-4.3.0.orig/gcc/testsuite/gcc.dg/pr35440.c 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.0/gcc/testsuite/gcc.dg/pr35440.c 2008-06-10 14:44:54.000000000 +0200 +@@ -0,0 +1,12 @@ ++/* PR c/35440 */ ++/* { dg-do compile } */ ++/* { dg-options "-std=gnu99" } */ ++ ++struct A {}; ++struct B { int i; char j[2]; }; ++ ++void foo (void) ++{ ++ (struct A){}(); /* { dg-error "called object" } */ ++ (struct B){ .i = 2, .j[1] = 1 }(); /* { dg-error "called object" } */ ++} diff --git a/patches/gcc/4.3.0/220-pr24170.patch b/patches/gcc/4.3.0/220-pr24170.patch new file mode 100644 index 0000000..2ecceb6 --- /dev/null +++ b/patches/gcc/4.3.0/220-pr24170.patch @@ -0,0 +1,61 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/61_all_gcc43-pr24170.patch +http://gcc.gnu.org/PR24170 + +2008-02-20 Tom Tromey + + PR libgcj/24170: + * java/io/natFilePosix.cc (File::performList): Don't use + readdir_r. + * configure, include/config.h.in: Rebuilt. + * configure.ac: Don't check for readdir_r. + +diff -durN gcc-4.3.0.orig/libjava/configure.ac gcc-4.3.0/libjava/configure.ac +--- gcc-4.3.0.orig/libjava/configure.ac 2008-06-10 14:44:17.000000000 +0200 ++++ gcc-4.3.0/libjava/configure.ac 2008-06-10 14:44:58.000000000 +0200 +@@ -1030,7 +1030,7 @@ + PLATFORMNET=NoNet + else + AC_CHECK_FUNCS([strerror_r select fstat open fsync sleep opendir \ +- localtime_r readdir_r getpwuid_r getcwd \ ++ localtime_r getpwuid_r getcwd \ + access stat lstat mkdir rename rmdir unlink utime chmod readlink \ + nl_langinfo setlocale \ + inet_pton uname inet_ntoa \ +diff -durN gcc-4.3.0.orig/libjava/include/config.h.in gcc-4.3.0/libjava/include/config.h.in +--- gcc-4.3.0.orig/libjava/include/config.h.in 2007-07-31 18:17:21.000000000 +0200 ++++ gcc-4.3.0/libjava/include/config.h.in 2008-06-10 14:44:58.000000000 +0200 +@@ -214,9 +214,6 @@ + /* Define to 1 if you have the header file. */ + #undef HAVE_PWD_H + +-/* Define to 1 if you have the `readdir_r' function. */ +-#undef HAVE_READDIR_R +- + /* Define to 1 if you have the `readlink' function. */ + #undef HAVE_READLINK + +diff -durN gcc-4.3.0.orig/libjava/java/io/natFilePosix.cc gcc-4.3.0/libjava/java/io/natFilePosix.cc +--- gcc-4.3.0.orig/libjava/java/io/natFilePosix.cc 2007-08-04 23:50:01.000000000 +0200 ++++ gcc-4.3.0/libjava/java/io/natFilePosix.cc 2008-06-10 14:44:58.000000000 +0200 +@@ -1,6 +1,6 @@ + // natFile.cc - Native part of File class for POSIX. + +-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2006 ++/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2008 + Free Software Foundation + + This file is part of libgcj. +@@ -292,13 +292,7 @@ + + java::util::ArrayList *list = new java::util::ArrayList (); + struct dirent *d; +-#if defined(HAVE_READDIR_R) && defined(_POSIX_PTHREAD_SEMANTICS) +- int name_max = pathconf (buf, _PC_NAME_MAX); +- char dbuf[sizeof (struct dirent) + name_max + 1]; +- while (readdir_r (dir, (struct dirent *) dbuf, &d) == 0 && d != NULL) +-#else /* HAVE_READDIR_R */ + while ((d = readdir (dir)) != NULL) +-#endif /* HAVE_READDIR_R */ + { + // Omit "." and "..". + if (d->d_name[0] == '.' diff --git a/patches/gcc/4.3.0/225-sparc64-bsd.patch b/patches/gcc/4.3.0/225-sparc64-bsd.patch deleted file mode 100644 index 7c4fb5d..0000000 --- a/patches/gcc/4.3.0/225-sparc64-bsd.patch +++ /dev/null @@ -1,30 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/14_all_gcc-sparc64-bsd.patch -diff -durN gcc-4.3.0.orig/gcc/config/sparc/freebsd.h gcc-4.3.0/gcc/config/sparc/freebsd.h ---- gcc-4.3.0.orig/gcc/config/sparc/freebsd.h 2007-08-02 12:49:31.000000000 +0200 -+++ gcc-4.3.0/gcc/config/sparc/freebsd.h 2008-06-10 14:44:26.000000000 +0200 -@@ -25,9 +25,22 @@ - /* FreeBSD needs the platform name (sparc64) defined. - Emacs needs to know if the arch is 64 or 32-bits. */ - --#undef CPP_CPU64_DEFAULT_SPEC --#define CPP_CPU64_DEFAULT_SPEC \ -- "-D__sparc64__ -D__sparc_v9__ -D__sparcv9 -D__arch64__" -+#undef FBSD_TARGET_CPU_CPP_BUILTINS -+#define FBSD_TARGET_CPU_CPP_BUILTINS() \ -+ do \ -+ { \ -+ if (TARGET_ARCH64) \ -+ { \ -+ builtin_define ("__sparc64__"); \ -+ builtin_define ("__sparc_v9__"); \ -+ builtin_define ("__sparcv9"); \ -+ } \ -+ else \ -+ builtin_define ("__sparc"); \ -+ builtin_define ("__sparc__"); \ -+ } \ -+ while (0) -+ - - #define LINK_SPEC "%(link_arch) \ - %{!mno-relax:%{!r:-relax}} \ diff --git a/patches/gcc/4.3.0/230-noteGNUstack-00.patch b/patches/gcc/4.3.0/230-noteGNUstack-00.patch new file mode 100644 index 0000000..8752070 --- /dev/null +++ b/patches/gcc/4.3.0/230-noteGNUstack-00.patch @@ -0,0 +1,96 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/61_all_gcc4-ia64-noteGNUstack.patch +2004-09-20 Jakub Jelinek + + * config/rs6000/ppc-asm.h: Add .note.GNU-stack section also + on ppc64-linux. + + * config/ia64/lib1funcs.asm: Add .note.GNU-stack section on + ia64-linux. + * config/ia64/crtbegin.asm: Likewise. + * config/ia64/crtend.asm: Likewise. + * config/ia64/crti.asm: Likewise. + * config/ia64/crtn.asm: Likewise. + +2004-05-14 Jakub Jelinek + + * config/ia64/linux.h (TARGET_ASM_FILE_END): Define. + +diff -durN gcc-4.3.0.orig/gcc/config/ia64/crtbegin.asm gcc-4.3.0/gcc/config/ia64/crtbegin.asm +--- gcc-4.3.0.orig/gcc/config/ia64/crtbegin.asm 2005-09-27 02:52:24.000000000 +0200 ++++ gcc-4.3.0/gcc/config/ia64/crtbegin.asm 2008-06-10 14:45:02.000000000 +0200 +@@ -255,3 +255,7 @@ + .weak __cxa_finalize + #endif + .weak _Jv_RegisterClasses ++ ++#ifdef __linux__ ++.section .note.GNU-stack; .previous ++#endif +diff -durN gcc-4.3.0.orig/gcc/config/ia64/crtend.asm gcc-4.3.0/gcc/config/ia64/crtend.asm +--- gcc-4.3.0.orig/gcc/config/ia64/crtend.asm 2005-09-27 02:52:24.000000000 +0200 ++++ gcc-4.3.0/gcc/config/ia64/crtend.asm 2008-06-10 14:45:02.000000000 +0200 +@@ -122,3 +122,7 @@ + + br.ret.sptk.many rp + .endp __do_global_ctors_aux ++ ++#ifdef __linux__ ++.section .note.GNU-stack; .previous ++#endif +diff -durN gcc-4.3.0.orig/gcc/config/ia64/crti.asm gcc-4.3.0/gcc/config/ia64/crti.asm +--- gcc-4.3.0.orig/gcc/config/ia64/crti.asm 2005-06-25 03:22:41.000000000 +0200 ++++ gcc-4.3.0/gcc/config/ia64/crti.asm 2008-06-10 14:45:02.000000000 +0200 +@@ -64,3 +64,7 @@ + .body + + # end of crti.asm ++ ++#ifdef __linux__ ++.section .note.GNU-stack; .previous ++#endif +diff -durN gcc-4.3.0.orig/gcc/config/ia64/crtn.asm gcc-4.3.0/gcc/config/ia64/crtn.asm +--- gcc-4.3.0.orig/gcc/config/ia64/crtn.asm 2005-06-25 03:22:41.000000000 +0200 ++++ gcc-4.3.0/gcc/config/ia64/crtn.asm 2008-06-10 14:45:02.000000000 +0200 +@@ -54,3 +54,7 @@ + br.ret.sptk.many b0 + + # end of crtn.asm ++ ++#ifdef __linux__ ++.section .note.GNU-stack; .previous ++#endif +diff -durN gcc-4.3.0.orig/gcc/config/ia64/lib1funcs.asm gcc-4.3.0/gcc/config/ia64/lib1funcs.asm +--- gcc-4.3.0.orig/gcc/config/ia64/lib1funcs.asm 2005-09-27 02:52:24.000000000 +0200 ++++ gcc-4.3.0/gcc/config/ia64/lib1funcs.asm 2008-06-10 14:45:02.000000000 +0200 +@@ -792,3 +792,7 @@ + } + .endp __floattitf + #endif ++ ++#ifdef __linux__ ++.section .note.GNU-stack; .previous ++#endif +diff -durN gcc-4.3.0.orig/gcc/config/ia64/linux.h gcc-4.3.0/gcc/config/ia64/linux.h +--- gcc-4.3.0.orig/gcc/config/ia64/linux.h 2006-12-12 16:15:19.000000000 +0100 ++++ gcc-4.3.0/gcc/config/ia64/linux.h 2008-06-10 14:45:02.000000000 +0200 +@@ -5,6 +5,8 @@ + + #define TARGET_VERSION fprintf (stderr, " (IA-64) Linux"); + ++#define TARGET_ASM_FILE_END file_end_indicate_exec_stack ++ + /* This is for -profile to use -lc_p instead of -lc. */ + #undef CC1_SPEC + #define CC1_SPEC "%{profile:-p} %{G*}" +diff -durN gcc-4.3.0.orig/gcc/config/rs6000/ppc-asm.h gcc-4.3.0/gcc/config/rs6000/ppc-asm.h +--- gcc-4.3.0.orig/gcc/config/rs6000/ppc-asm.h 2003-06-04 18:44:51.000000000 +0200 ++++ gcc-4.3.0/gcc/config/rs6000/ppc-asm.h 2008-06-10 14:45:02.000000000 +0200 +@@ -158,7 +158,7 @@ + .size FUNC_NAME(name),GLUE(.L,name)-FUNC_NAME(name) + #endif + +-#if defined __linux__ && !defined __powerpc64__ ++#if defined __linux__ + .section .note.GNU-stack + .previous + #endif diff --git a/patches/gcc/4.3.0/240-noteGNUstack-01.patch b/patches/gcc/4.3.0/240-noteGNUstack-01.patch new file mode 100644 index 0000000..1094e08 --- /dev/null +++ b/patches/gcc/4.3.0/240-noteGNUstack-01.patch @@ -0,0 +1,198 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/62_all_gcc4-noteGNUstack.patch +2005-02-08 Jakub Jelinek + + * src/alpha/osf.S: Add .note.GNU-stack on Linux. + * src/s390/sysv.S: Likewise. + * src/powerpc/linux64.S: Likewise. + * src/powerpc/linux64_closure.S: Likewise. + * src/powerpc/ppc_closure.S: Likewise. + * src/powerpc/sysv.S: Likewise. + * src/x86/unix64.S: Likewise. + * src/x86/sysv.S: Likewise. + * src/sparc/v8.S: Likewise. + * src/sparc/v9.S: Likewise. + * src/m68k/sysv.S: Likewise. + * src/ia64/unix.S: Likewise. + * src/arm/sysv.S: Likewise. + + * ia64_save_regs_in_stack.s: Moved to... + * ia64_save_regs_in_stack.S: ... this. Add .note.GNU-stack + on Linux. + +diff -durN gcc-4.3.0.orig/boehm-gc/ia64_save_regs_in_stack.S gcc-4.3.0/boehm-gc/ia64_save_regs_in_stack.S +--- gcc-4.3.0.orig/boehm-gc/ia64_save_regs_in_stack.S 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.0/boehm-gc/ia64_save_regs_in_stack.S 2008-06-10 14:45:05.000000000 +0200 +@@ -0,0 +1,15 @@ ++ .text ++ .align 16 ++ .global GC_save_regs_in_stack ++ .proc GC_save_regs_in_stack ++GC_save_regs_in_stack: ++ .bodyfoo.mpg ++ flushrs ++ ;; ++ mov r8=ar.bsp ++ br.ret.sptk.few rp ++ .endp GC_save_regs_in_stack ++ ++#ifdef __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.0.orig/boehm-gc/ia64_save_regs_in_stack.s gcc-4.3.0/boehm-gc/ia64_save_regs_in_stack.s +--- gcc-4.3.0.orig/boehm-gc/ia64_save_regs_in_stack.s 2001-10-15 06:57:59.000000000 +0200 ++++ gcc-4.3.0/boehm-gc/ia64_save_regs_in_stack.s 2008-06-10 14:45:05.000000000 +0200 +@@ -1,12 +0,0 @@ +- .text +- .align 16 +- .global GC_save_regs_in_stack +- .proc GC_save_regs_in_stack +-GC_save_regs_in_stack: +- .body +- flushrs +- ;; +- mov r8=ar.bsp +- br.ret.sptk.few rp +- .endp GC_save_regs_in_stack +- +diff -durN gcc-4.3.0.orig/libffi/src/alpha/osf.S gcc-4.3.0/libffi/src/alpha/osf.S +--- gcc-4.3.0.orig/libffi/src/alpha/osf.S 2007-04-06 18:24:16.000000000 +0200 ++++ gcc-4.3.0/libffi/src/alpha/osf.S 2008-06-10 14:45:05.000000000 +0200 +@@ -358,4 +358,8 @@ + .byte 16 # uleb128 offset 16*-8 + .align 3 + $LEFDE3: ++ ++#ifdef __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif + #endif +diff -durN gcc-4.3.0.orig/libffi/src/arm/sysv.S gcc-4.3.0/libffi/src/arm/sysv.S +--- gcc-4.3.0.orig/libffi/src/arm/sysv.S 2007-09-04 19:52:45.000000000 +0200 ++++ gcc-4.3.0/libffi/src/arm/sysv.S 2008-06-10 14:45:05.000000000 +0200 +@@ -293,3 +293,6 @@ + UNWIND .fnend + .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) + ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",%progbits ++#endif +diff -durN gcc-4.3.0.orig/libffi/src/ia64/unix.S gcc-4.3.0/libffi/src/ia64/unix.S +--- gcc-4.3.0.orig/libffi/src/ia64/unix.S 2005-03-30 23:49:19.000000000 +0200 ++++ gcc-4.3.0/libffi/src/ia64/unix.S 2008-06-10 14:45:05.000000000 +0200 +@@ -553,3 +553,7 @@ + data8 @pcrel(.Lld_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT + data8 @pcrel(.Lld_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE + data8 @pcrel(.Lld_hfa_ldouble) // FFI_IA64_TYPE_HFA_LDOUBLE ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.0.orig/libffi/src/m68k/sysv.S gcc-4.3.0/libffi/src/m68k/sysv.S +--- gcc-4.3.0.orig/libffi/src/m68k/sysv.S 2007-05-10 23:29:04.000000000 +0200 ++++ gcc-4.3.0/libffi/src/m68k/sysv.S 2008-06-10 14:45:05.000000000 +0200 +@@ -207,3 +207,7 @@ + rts + CFI_ENDPROC() + .size ffi_closure_struct_SYSV,.-ffi_closure_struct_SYSV ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.0.orig/libffi/src/powerpc/linux64.S gcc-4.3.0/libffi/src/powerpc/linux64.S +--- gcc-4.3.0.orig/libffi/src/powerpc/linux64.S 2007-11-17 00:24:53.000000000 +0100 ++++ gcc-4.3.0/libffi/src/powerpc/linux64.S 2008-06-10 14:45:05.000000000 +0200 +@@ -179,3 +179,7 @@ + .align 3 + .LEFDE1: + #endif ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.0.orig/libffi/src/powerpc/linux64_closure.S gcc-4.3.0/libffi/src/powerpc/linux64_closure.S +--- gcc-4.3.0.orig/libffi/src/powerpc/linux64_closure.S 2005-08-11 23:18:24.000000000 +0200 ++++ gcc-4.3.0/libffi/src/powerpc/linux64_closure.S 2008-06-10 14:45:05.000000000 +0200 +@@ -204,3 +204,7 @@ + .align 3 + .LEFDE1: + #endif ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.0.orig/libffi/src/powerpc/ppc_closure.S gcc-4.3.0/libffi/src/powerpc/ppc_closure.S +--- gcc-4.3.0.orig/libffi/src/powerpc/ppc_closure.S 2007-12-01 22:00:04.000000000 +0100 ++++ gcc-4.3.0/libffi/src/powerpc/ppc_closure.S 2008-06-10 14:45:05.000000000 +0200 +@@ -295,3 +295,7 @@ + .LEFDE1: + + #endif ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.0.orig/libffi/src/powerpc/sysv.S gcc-4.3.0/libffi/src/powerpc/sysv.S +--- gcc-4.3.0.orig/libffi/src/powerpc/sysv.S 2007-12-01 22:00:04.000000000 +0100 ++++ gcc-4.3.0/libffi/src/powerpc/sysv.S 2008-06-10 14:45:05.000000000 +0200 +@@ -223,3 +223,7 @@ + .align 2 + .LEFDE1: + #endif ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.0.orig/libffi/src/s390/sysv.S gcc-4.3.0/libffi/src/s390/sysv.S +--- gcc-4.3.0.orig/libffi/src/s390/sysv.S 2003-10-21 21:01:58.000000000 +0200 ++++ gcc-4.3.0/libffi/src/s390/sysv.S 2008-06-10 14:45:05.000000000 +0200 +@@ -427,3 +427,6 @@ + + #endif + ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.0.orig/libffi/src/sparc/v8.S gcc-4.3.0/libffi/src/sparc/v8.S +--- gcc-4.3.0.orig/libffi/src/sparc/v8.S 2004-11-22 19:35:16.000000000 +0100 ++++ gcc-4.3.0/libffi/src/sparc/v8.S 2008-06-10 14:45:05.000000000 +0200 +@@ -265,3 +265,7 @@ + .byte 0x1f ! uleb128 0x1f + .align WS + .LLEFDE2: ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.0.orig/libffi/src/sparc/v9.S gcc-4.3.0/libffi/src/sparc/v9.S +--- gcc-4.3.0.orig/libffi/src/sparc/v9.S 2004-01-25 07:58:33.000000000 +0100 ++++ gcc-4.3.0/libffi/src/sparc/v9.S 2008-06-10 14:45:05.000000000 +0200 +@@ -300,3 +300,7 @@ + .align 8 + .LLEFDE2: + #endif ++ ++#ifdef __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.0.orig/libffi/src/x86/sysv.S gcc-4.3.0/libffi/src/x86/sysv.S +--- gcc-4.3.0.orig/libffi/src/x86/sysv.S 2008-01-30 15:36:58.000000000 +0100 ++++ gcc-4.3.0/libffi/src/x86/sysv.S 2008-06-10 14:45:05.000000000 +0200 +@@ -430,3 +430,7 @@ + #endif + + #endif /* ifndef __x86_64__ */ ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.0.orig/libffi/src/x86/unix64.S gcc-4.3.0/libffi/src/x86/unix64.S +--- gcc-4.3.0.orig/libffi/src/x86/unix64.S 2005-05-05 06:06:38.000000000 +0200 ++++ gcc-4.3.0/libffi/src/x86/unix64.S 2008-06-10 14:45:05.000000000 +0200 +@@ -410,3 +410,7 @@ + .LEFDE3: + + #endif /* __x86_64__ */ ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif diff --git a/patches/gcc/4.3.0/250-flatten-switch-stmt-00.patch b/patches/gcc/4.3.0/250-flatten-switch-stmt-00.patch deleted file mode 100644 index 390f45e..0000000 --- a/patches/gcc/4.3.0/250-flatten-switch-stmt-00.patch +++ /dev/null @@ -1,76 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/18_all_904-flatten-switch-stmt-00.patch -http://gcc.gnu.org/ml/gcc-patches/2007-04/msg00927.html - -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" - -diff -durN gcc-4.3.0.orig/gcc/stmt.c gcc-4.3.0/gcc/stmt.c ---- gcc-4.3.0.orig/gcc/stmt.c 2007-12-04 22:55:32.000000000 +0100 -+++ gcc-4.3.0/gcc/stmt.c 2008-06-10 14:44:33.000000000 +0200 -@@ -2508,7 +2508,11 @@ - 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); - } -@@ -3066,6 +3070,7 @@ - { - 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, diff --git a/patches/gcc/4.3.0/250-pr35705.patch b/patches/gcc/4.3.0/250-pr35705.patch new file mode 100644 index 0000000..5eb4312 --- /dev/null +++ b/patches/gcc/4.3.0/250-pr35705.patch @@ -0,0 +1,21 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/63_all_gcc43-pr35705.patch +http://gcc.gnu.org/PR35705 + +2008-04-01 John David Anglin + + PR middle-end/35705 + * fold-const.c (get_pointer_modulus_and_residue): Return modulus 1 if + the expression is a function address. + +diff -durN gcc-4.3.0.orig/gcc/fold-const.c gcc-4.3.0/gcc/fold-const.c +--- gcc-4.3.0.orig/gcc/fold-const.c 2008-02-27 15:12:33.000000000 +0100 ++++ gcc-4.3.0/gcc/fold-const.c 2008-06-10 14:45:09.000000000 +0200 +@@ -9357,7 +9357,7 @@ + } + } + +- if (DECL_P (expr)) ++ if (DECL_P (expr) && TREE_CODE (expr) != FUNCTION_DECL) + return DECL_ALIGN_UNIT (expr); + } + else if (code == POINTER_PLUS_EXPR) diff --git a/patches/gcc/4.3.0/260-pr34571.patch b/patches/gcc/4.3.0/260-pr34571.patch new file mode 100644 index 0000000..44d6f86 --- /dev/null +++ b/patches/gcc/4.3.0/260-pr34571.patch @@ -0,0 +1,35 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/64_all_gcc43-pr34571.patch +http://gcc.gnu.org/PR34571 + +2007-12-26 Rask Ingemann Lambertsen + + PR target/34571 + * config/alpha/alpha.c (alpha_cannot_force_const_mem): Use + symbolic_operand. + * varasm.c (output_constant_pool_1): Fix typo. + +diff -durN gcc-4.3.0.orig/gcc/config/alpha/alpha.c gcc-4.3.0/gcc/config/alpha/alpha.c +--- gcc-4.3.0.orig/gcc/config/alpha/alpha.c 2008-02-07 18:45:24.000000000 +0100 ++++ gcc-4.3.0/gcc/config/alpha/alpha.c 2008-06-10 14:45:13.000000000 +0200 +@@ -1113,8 +1113,7 @@ + static bool + alpha_cannot_force_const_mem (rtx x) + { +- enum rtx_code code = GET_CODE (x); +- return code == SYMBOL_REF || code == LABEL_REF || code == CONST; ++ return symbolic_operand (x, GET_MODE (x)); + } + + /* We do not allow indirect calls to be optimized into sibling calls, nor +diff -durN gcc-4.3.0.orig/gcc/varasm.c gcc-4.3.0/gcc/varasm.c +--- gcc-4.3.0.orig/gcc/varasm.c 2007-12-05 22:55:10.000000000 +0100 ++++ gcc-4.3.0/gcc/varasm.c 2008-06-10 14:45:13.000000000 +0200 +@@ -3710,7 +3710,7 @@ + /* FALLTHRU */ + + case LABEL_REF: +- tmp = XEXP (x, 0); ++ tmp = XEXP (tmp, 0); + gcc_assert (!INSN_DELETED_P (tmp)); + gcc_assert (!NOTE_P (tmp) + || NOTE_KIND (tmp) != NOTE_INSN_DELETED); diff --git a/patches/gcc/4.3.0/270-pr35982.patch b/patches/gcc/4.3.0/270-pr35982.patch new file mode 100644 index 0000000..461fd57 --- /dev/null +++ b/patches/gcc/4.3.0/270-pr35982.patch @@ -0,0 +1,23 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/65_all_gcc43-pr35982.patch +http://gcc.gnu.org/PR35982 + +2008-04-23 Ira Rosen + + PR tree-optimization/35982 + * tree-vect-analyze.c (vect_check_interleaving): Check that the + interleaved data-refs are of the same type. + +diff -durN gcc-4.3.0.orig/gcc/tree-vect-analyze.c gcc-4.3.0/gcc/tree-vect-analyze.c +--- gcc-4.3.0.orig/gcc/tree-vect-analyze.c 2007-12-06 17:18:55.000000000 +0100 ++++ gcc-4.3.0/gcc/tree-vect-analyze.c 2008-06-10 14:45:17.000000000 +0200 +@@ -1081,7 +1081,9 @@ + type_size_b = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (drb)))); + + if (type_size_a != type_size_b +- || tree_int_cst_compare (DR_STEP (dra), DR_STEP (drb))) ++ || tree_int_cst_compare (DR_STEP (dra), DR_STEP (drb)) ++ || !types_compatible_p (TREE_TYPE (DR_REF (dra)), ++ TREE_TYPE (DR_REF (drb)))) + return; + + init_a = TREE_INT_CST_LOW (DR_INIT (dra)); diff --git a/patches/gcc/4.3.0/275-x86-emit-cld.patch b/patches/gcc/4.3.0/275-x86-emit-cld.patch deleted file mode 100644 index a2b723a..0000000 --- a/patches/gcc/4.3.0/275-x86-emit-cld.patch +++ /dev/null @@ -1,156 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/20_all_gcc-x86-emit-cld.patch -bandaid for the cld issue. to be dropped when gcc-4.3 goes stable. - -http://gcc.gnu.org/ml/gcc-patches/2008-03/msg00417.html - -2008-03-06 Uros Bizjak - - * config/i386/i386.h (TARGET_CLD): New define. - (struct machine_function): Add needs_cld field. - (ix86_current_function_needs_cld): New define. - * config/i386/i386.md (UNSPEC_CLD): New unspec volatile constant. - ("cld"): New isns pattern. - ("strmov_singleop"): Set ix86_current_function_needs_cld flag. - ("rep_mov"): Ditto. - ("strset_singleop"): Ditto. - ("rep_stos"): Ditto. - ("cmpstrnqi_nz_1"): Ditto. - ("cmpstrnqi_1"): Ditto. - ("strlenqi_1"): Ditto. - * config/i386/i386.c (ix86_expand_prologue): Emit cld insn for - TARGET_CLD when ix86_current_function_needs_cld is set. - -diff -durN gcc-4.3.0.orig/gcc/config/i386/i386.c gcc-4.3.0/gcc/config/i386/i386.c ---- gcc-4.3.0.orig/gcc/config/i386/i386.c 2008-02-21 13:30:00.000000000 +0100 -+++ gcc-4.3.0/gcc/config/i386/i386.c 2008-06-10 14:44:37.000000000 +0200 -@@ -6448,6 +6448,10 @@ - emit_insn (gen_prologue_use (pic_offset_table_rtx)); - emit_insn (gen_blockage ()); - } -+ -+ /* Emit cld instruction if stringops are used in the function. */ -+ if (TARGET_CLD && ix86_current_function_needs_cld) -+ emit_insn (gen_cld ()); - } - - /* Emit code to restore saved registers using MOV insns. First register -diff -durN gcc-4.3.0.orig/gcc/config/i386/i386.h gcc-4.3.0/gcc/config/i386/i386.h ---- gcc-4.3.0.orig/gcc/config/i386/i386.h 2008-02-15 09:12:02.000000000 +0100 -+++ gcc-4.3.0/gcc/config/i386/i386.h 2008-06-10 14:44:37.000000000 +0200 -@@ -388,6 +388,7 @@ - - extern int x86_prefetch_sse; - -+#define TARGET_CLD 1 - #define TARGET_ABM x86_abm - #define TARGET_CMPXCHG16B x86_cmpxchg16b - #define TARGET_POPCNT x86_popcnt -@@ -2443,8 +2444,9 @@ - int save_varrargs_registers; - int accesses_prev_frame; - int optimize_mode_switching[MAX_386_ENTITIES]; -- /* Set by ix86_compute_frame_layout and used by prologue/epilogue expander to -- determine the style used. */ -+ int needs_cld; -+ /* Set by ix86_compute_frame_layout and used by prologue/epilogue -+ expander to determine the style used. */ - int use_fast_prologue_epilogue; - /* Number of saved registers USE_FAST_PROLOGUE_EPILOGUE has been computed - for. */ -@@ -2464,6 +2466,7 @@ - #define ix86_stack_locals (cfun->machine->stack_locals) - #define ix86_save_varrargs_registers (cfun->machine->save_varrargs_registers) - #define ix86_optimize_mode_switching (cfun->machine->optimize_mode_switching) -+#define ix86_current_function_needs_cld (cfun->machine->needs_cld) - #define ix86_tls_descriptor_calls_expanded_in_cfun \ - (cfun->machine->tls_descriptor_call_expanded_p) - /* Since tls_descriptor_call_expanded is not cleared, even if all TLS -diff -durN gcc-4.3.0.orig/gcc/config/i386/i386.md gcc-4.3.0/gcc/config/i386/i386.md ---- gcc-4.3.0.orig/gcc/config/i386/i386.md 2008-02-06 12:34:00.000000000 +0100 -+++ gcc-4.3.0/gcc/config/i386/i386.md 2008-06-10 14:44:37.000000000 +0200 -@@ -205,6 +205,7 @@ - (UNSPECV_XCHG 12) - (UNSPECV_LOCK 13) - (UNSPECV_PROLOGUE_USE 14) -+ (UNSPECV_CLD 15) - ]) - - ;; Constants to represent pcomtrue/pcomfalse variants -@@ -18529,6 +18530,14 @@ - - ;; Block operation instructions - -+(define_insn "cld" -+ [(unspec_volatile [(const_int 0)] UNSPECV_CLD)] -+ "" -+ "cld" -+ [(set_attr "length" "1") -+ (set_attr "length_immediate" "0") -+ (set_attr "modrm" "0")]) -+ - (define_expand "movmemsi" - [(use (match_operand:BLK 0 "memory_operand" "")) - (use (match_operand:BLK 1 "memory_operand" "")) -@@ -18601,7 +18610,7 @@ - (set (match_operand 2 "register_operand" "") - (match_operand 5 "" ""))])] - "TARGET_SINGLE_STRINGOP || optimize_size" -- "") -+ "ix86_current_function_needs_cld = 1;") - - (define_insn "*strmovdi_rex_1" - [(set (mem:DI (match_operand:DI 2 "register_operand" "0")) -@@ -18718,7 +18727,7 @@ - (match_operand 3 "memory_operand" "")) - (use (match_dup 4))])] - "" -- "") -+ "ix86_current_function_needs_cld = 1;") - - (define_insn "*rep_movdi_rex64" - [(set (match_operand:DI 2 "register_operand" "=c") (const_int 0)) -@@ -18878,7 +18887,7 @@ - (set (match_operand 0 "register_operand" "") - (match_operand 3 "" ""))])] - "TARGET_SINGLE_STRINGOP || optimize_size" -- "") -+ "ix86_current_function_needs_cld = 1;") - - (define_insn "*strsetdi_rex_1" - [(set (mem:DI (match_operand:DI 1 "register_operand" "0")) -@@ -18972,7 +18981,7 @@ - (use (match_operand 3 "register_operand" "")) - (use (match_dup 1))])] - "" -- "") -+ "ix86_current_function_needs_cld = 1;") - - (define_insn "*rep_stosdi_rex64" - [(set (match_operand:DI 1 "register_operand" "=c") (const_int 0)) -@@ -19148,7 +19157,7 @@ - (clobber (match_operand 1 "register_operand" "")) - (clobber (match_dup 2))])] - "" -- "") -+ "ix86_current_function_needs_cld = 1;") - - (define_insn "*cmpstrnqi_nz_1" - [(set (reg:CC FLAGS_REG) -@@ -19195,7 +19204,7 @@ - (clobber (match_operand 1 "register_operand" "")) - (clobber (match_dup 2))])] - "" -- "") -+ "ix86_current_function_needs_cld = 1;") - - (define_insn "*cmpstrnqi_1" - [(set (reg:CC FLAGS_REG) -@@ -19264,7 +19273,7 @@ - (clobber (match_operand 1 "register_operand" "")) - (clobber (reg:CC FLAGS_REG))])] - "" -- "") -+ "ix86_current_function_needs_cld = 1;") - - (define_insn "*strlenqi_1" - [(set (match_operand:SI 0 "register_operand" "=&c") diff --git a/patches/gcc/4.3.0/280-pr25343.patch b/patches/gcc/4.3.0/280-pr25343.patch new file mode 100644 index 0000000..eee48d5 --- /dev/null +++ b/patches/gcc/4.3.0/280-pr25343.patch @@ -0,0 +1,21 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/66_all_gcc43-pr25343.patch +http://gcc.gnu.org/PR25343 + +sniped from Debian + +2008-04-27 Roman Zippel + + * config/host-linux.c (TRY_EMPTY_VM_SPACE): Define for __mc68000__. + +diff -durN gcc-4.3.0.orig/gcc/config/host-linux.c gcc-4.3.0/gcc/config/host-linux.c +--- gcc-4.3.0.orig/gcc/config/host-linux.c 2007-08-02 12:49:31.000000000 +0200 ++++ gcc-4.3.0/gcc/config/host-linux.c 2008-06-10 14:45:20.000000000 +0200 +@@ -84,6 +84,8 @@ + # define TRY_EMPTY_VM_SPACE 0x8000000000 + #elif defined(__sparc__) + # define TRY_EMPTY_VM_SPACE 0x60000000 ++#elif defined(__mc68000__) ++# define TRY_EMPTY_VM_SPACE 0x40000000 + #else + # define TRY_EMPTY_VM_SPACE 0 + #endif diff --git a/patches/gcc/4.3.0/290-sh-pr24836.patch b/patches/gcc/4.3.0/290-sh-pr24836.patch new file mode 100644 index 0000000..8c8f8e3 --- /dev/null +++ b/patches/gcc/4.3.0/290-sh-pr24836.patch @@ -0,0 +1,28 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/74_all_sh-pr24836.patch +http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348 +http://gcc.gnu.org/PR24836 + +diff -durN gcc-4.3.0.orig/gcc/configure gcc-4.3.0/gcc/configure +--- gcc-4.3.0.orig/gcc/configure 2008-06-10 14:44:21.000000000 +0200 ++++ gcc-4.3.0/gcc/configure 2008-06-10 14:45:24.000000000 +0200 +@@ -14700,7 +14700,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 -durN gcc-4.3.0.orig/gcc/configure.ac gcc-4.3.0/gcc/configure.ac +--- gcc-4.3.0.orig/gcc/configure.ac 2008-06-10 14:44:21.000000000 +0200 ++++ gcc-4.3.0/gcc/configure.ac 2008-06-10 14:45:24.000000000 +0200 +@@ -2533,7 +2533,7 @@ + tls_first_minor=14 + tls_as_opt="-m64 -Aesame --fatal-warnings" + ;; +- sh-*-* | sh[34]-*-*) ++ sh-*-* | sh[34]*-*-*) + conftest_s=' + .section ".tdata","awT",@progbits + foo: .long 25 diff --git a/patches/gcc/4.3.0/300-ca-translation-typo.patch b/patches/gcc/4.3.0/300-ca-translation-typo.patch new file mode 100644 index 0000000..ae77fe6 --- /dev/null +++ b/patches/gcc/4.3.0/300-ca-translation-typo.patch @@ -0,0 +1,19 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/85_all_gcc-ca-translation-typo.patch +http://bugs.gentoo.org/127190 + +2006-03-28 Harald van Dijk + + * ca.po: Fix printf flag typo in negative value translation. + +diff -durN gcc-4.3.0.orig/gcc/po/ca.po gcc-4.3.0/gcc/po/ca.po +--- gcc-4.3.0.orig/gcc/po/ca.po 2007-11-10 19:36:27.000000000 +0100 ++++ gcc-4.3.0/gcc/po/ca.po 2008-06-10 14:45:27.000000000 +0200 +@@ -36028,7 +36028,7 @@ + #~ msgstr "passant el valor negatiu `%E' per a %s %P de \"%D\"" + + #~ msgid "%s of negative value `%E' to `%T'" +-#~ msgstr "%s de valor negatiu `%I' a \"%T\"" ++#~ msgstr "%s de valor negatiu `%E' a \"%T\"" + + #~ msgid "initializing array with parameter list" + #~ msgstr "inicialitzant una matriu amb una llista de paràmetres" diff --git a/patches/gcc/4.3.0/300-libiberty-pic.patch b/patches/gcc/4.3.0/300-libiberty-pic.patch deleted file mode 100644 index 844f83a..0000000 --- a/patches/gcc/4.3.0/300-libiberty-pic.patch +++ /dev/null @@ -1,12 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/51_all_gcc-3.4-libiberty-pic.patch -diff -durN gcc-4.3.0.orig/libiberty/Makefile.in gcc-4.3.0/libiberty/Makefile.in ---- gcc-4.3.0.orig/libiberty/Makefile.in 2007-07-25 08:26:45.000000000 +0200 -+++ gcc-4.3.0/libiberty/Makefile.in 2008-06-10 14:44:43.000000000 +0200 -@@ -225,6 +225,7 @@ - $(AR) $(AR_FLAGS) $(TARGETLIB) \ - $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \ - $(RANLIB) $(TARGETLIB); \ -+ cp $(TARGETLIB) ../ ; \ - cd ..; \ - else true; fi - diff --git a/patches/gcc/4.3.0/310-uclibc-conf-noupstream.patch b/patches/gcc/4.3.0/310-uclibc-conf-noupstream.patch new file mode 100644 index 0000000..3b93043 --- /dev/null +++ b/patches/gcc/4.3.0/310-uclibc-conf-noupstream.patch @@ -0,0 +1,13 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_103-uclibc-conf-noupstream.patch +diff -durN gcc-4.3.0.orig/gcc/config.gcc gcc-4.3.0/gcc/config.gcc +--- gcc-4.3.0.orig/gcc/config.gcc 2008-06-10 14:44:51.000000000 +0200 ++++ gcc-4.3.0/gcc/config.gcc 2008-06-10 14:45:31.000000000 +0200 +@@ -2142,7 +2142,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/patches/gcc/4.3.0/320-uclibc-locale.patch b/patches/gcc/4.3.0/320-uclibc-locale.patch new file mode 100644 index 0000000..60e4b90 --- /dev/null +++ b/patches/gcc/4.3.0/320-uclibc-locale.patch @@ -0,0 +1,2794 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_200-uclibc-locale.patch +diff -durN gcc-4.3.0.orig/libstdc++-v3/acinclude.m4 gcc-4.3.0/libstdc++-v3/acinclude.m4 +--- gcc-4.3.0.orig/libstdc++-v3/acinclude.m4 2008-02-29 01:00:39.000000000 +0100 ++++ gcc-4.3.0/libstdc++-v3/acinclude.m4 2008-06-10 14:45:35.000000000 +0200 +@@ -1349,7 +1349,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 +@@ -1370,6 +1370,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) + enable_clocale_flag=gnu + ;; +@@ -1541,6 +1544,40 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ AC_MSG_RESULT(uclibc) ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ AC_SUBST(glibcxx_MOFILES) ++ AC_SUBST(glibcxx_POFILES) ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-06-10 14:45:35.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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 +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:45:35.000000000 +0200 +@@ -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 ++ ++#include // For errno ++#include ++#include ++#include ++#include ++ ++#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 -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:45:35.000000000 +0200 +@@ -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 ++ ++#ifndef _C_LOCALE_H ++#define _C_LOCALE_H 1 ++ ++#pragma GCC system_header ++ ++#include // get std::strlen ++#include // get std::snprintf or std::sprintf ++#include ++#include // For codecvt ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC_HAS_LOCALE__ ++#include // For codecvt using iconv, iconv_t ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#include // 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 ++ 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 +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2008-06-10 14:45:35.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++namespace std ++{ ++ // Specializations. ++#ifdef _GLIBCXX_USE_WCHAR_T ++ codecvt_base::result ++ codecvt:: ++ 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(-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(__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:: ++ 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(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(-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(-1) ++ || __conv == static_cast(-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:: ++ 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:: ++ 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:: ++ 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(__builtin_alloca(sizeof(wchar_t) ++ * __max)); ++ while (__from < __end && __max) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast(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(-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(-1) ++ || __conv == static_cast(-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 -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/collate_members.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/collate_members.cc 2008-06-10 14:45:35.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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::_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::_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::_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::_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 -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:45:35.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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 specializations are in src/locale.cc and ++ // various /config/os/* files. ++ template<> ++ ctype_byname::ctype_byname(const char* __s, size_t __refs) ++ : ctype(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::__wmask_type ++ ctype::_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::do_toupper(wchar_t __c) const ++ { return __towupper_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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::do_tolower(wchar_t __c) const ++ { return __towlower_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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:: ++ 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:: ++ 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:: ++ 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:: ++ 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:: ++ do_widen(char __c) const ++ { return _M_widen[static_cast(__c)]; } ++ ++ const char* ++ ctype:: ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const ++ { ++ while (__lo < __hi) ++ { ++ *__dest = _M_widen[static_cast(*__lo)]; ++ ++__lo; ++ ++__dest; ++ } ++ return __hi; ++ } ++ ++ char ++ ctype:: ++ 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(__c)); ++ } ++ ++ const wchar_t* ++ ctype:: ++ 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(__c)); ++ } ++ ++__lo; ++ ++__dest; ++ } ++ else ++ while (__lo < __hi) ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast(__c)); ++ ++__lo; ++ ++__dest; ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __hi; ++ } ++ ++ void ++ ctype::_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(__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(_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 -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.cc 2008-06-10 14:45:35.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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::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(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::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 -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:45:35.000000000 +0200 +@@ -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 ++ ++#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 ++ messages<_CharT>::messages(size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), ++ _M_name_messages(_S_get_c_name()) ++ { } ++ ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::open(const basic_string& __s, const locale& __loc, ++ const char* __dir) const ++ { ++ __bindtextdomain(__s.c_str(), __dir); ++ return this->do_open(__s, __loc); ++ } ++ ++ // Virtual member functions. ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::do_open(const basic_string& __s, ++ const locale&) const ++ { ++ // No error checking is done, assume the catalog exists and can ++ // be used. ++ __textdomain(__s.c_str()); ++ return 0; ++ } ++ ++ template ++ void ++ messages<_CharT>::do_close(catalog) const ++ { } ++ ++ // messages_byname ++ template ++ 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 -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:45:35.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::~moneypunct() ++ { delete _M_data; } ++ ++ template<> ++ moneypunct::~moneypunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ moneypunct::_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; ++ ++ 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(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::_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; ++ ++ 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(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::~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::~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 -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:45:35.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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::~numpunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ numpunct::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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(__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(__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::~numpunct() ++ { delete _M_data; } ++ #endif ++} +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-06-10 14:45:35.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++ 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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++#warning wide time stuff ++// if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = L"%m/%d/%y"; ++ _M_data->_M_date_era_format = L"%m/%d/%y"; ++ _M_data->_M_time_format = L"%H:%M:%S"; ++ _M_data->_M_time_era_format = L"%H:%M:%S"; ++ _M_data->_M_date_time_format = L""; ++ _M_data->_M_date_time_era_format = L""; ++ _M_data->_M_am = L"AM"; ++ _M_data->_M_pm = L"PM"; ++ _M_data->_M_am_pm_format = L""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = L"Sunday"; ++ _M_data->_M_day2 = L"Monday"; ++ _M_data->_M_day3 = L"Tuesday"; ++ _M_data->_M_day4 = L"Wednesday"; ++ _M_data->_M_day5 = L"Thursday"; ++ _M_data->_M_day6 = L"Friday"; ++ _M_data->_M_day7 = L"Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = L"Sun"; ++ _M_data->_M_aday2 = L"Mon"; ++ _M_data->_M_aday3 = L"Tue"; ++ _M_data->_M_aday4 = L"Wed"; ++ _M_data->_M_aday5 = L"Thu"; ++ _M_data->_M_aday6 = L"Fri"; ++ _M_data->_M_aday7 = L"Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = L"January"; ++ _M_data->_M_month02 = L"February"; ++ _M_data->_M_month03 = L"March"; ++ _M_data->_M_month04 = L"April"; ++ _M_data->_M_month05 = L"May"; ++ _M_data->_M_month06 = L"June"; ++ _M_data->_M_month07 = L"July"; ++ _M_data->_M_month08 = L"August"; ++ _M_data->_M_month09 = L"September"; ++ _M_data->_M_month10 = L"October"; ++ _M_data->_M_month11 = L"November"; ++ _M_data->_M_month12 = L"December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = L"Jan"; ++ _M_data->_M_amonth02 = L"Feb"; ++ _M_data->_M_amonth03 = L"Mar"; ++ _M_data->_M_amonth04 = L"Apr"; ++ _M_data->_M_amonth05 = L"May"; ++ _M_data->_M_amonth06 = L"Jun"; ++ _M_data->_M_amonth07 = L"Jul"; ++ _M_data->_M_amonth08 = L"Aug"; ++ _M_data->_M_amonth09 = L"Sep"; ++ _M_data->_M_amonth10 = L"Oct"; ++ _M_data->_M_amonth11 = L"Nov"; ++ _M_data->_M_amonth12 = L"Dec"; ++ } ++#if 0 ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ union { char *__s; wchar_t *__w; } __u; ++ ++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); ++ _M_data->_M_date_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); ++ _M_data->_M_date_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); ++ _M_data->_M_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); ++ _M_data->_M_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); ++ _M_data->_M_date_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); ++ _M_data->_M_date_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); ++ _M_data->_M_am = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); ++ _M_data->_M_pm = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); ++ _M_data->_M_am_pm_format = __u.__w; ++ ++ // Day names, starting with "C"'s Sunday. ++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); ++ _M_data->_M_day1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); ++ _M_data->_M_day2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); ++ _M_data->_M_day3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); ++ _M_data->_M_day4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); ++ _M_data->_M_day5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); ++ _M_data->_M_day6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); ++ _M_data->_M_day7 = __u.__w; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); ++ _M_data->_M_aday1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); ++ _M_data->_M_aday2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); ++ _M_data->_M_aday3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); ++ _M_data->_M_aday4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); ++ _M_data->_M_aday5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); ++ _M_data->_M_aday6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); ++ _M_data->_M_aday7 = __u.__w; ++ ++ // Month names, starting with "C"'s January. ++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); ++ _M_data->_M_month01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); ++ _M_data->_M_month02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); ++ _M_data->_M_month03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); ++ _M_data->_M_month04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); ++ _M_data->_M_month05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); ++ _M_data->_M_month06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); ++ _M_data->_M_month07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); ++ _M_data->_M_month08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); ++ _M_data->_M_month09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); ++ _M_data->_M_month10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); ++ _M_data->_M_month11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); ++ _M_data->_M_month12 = __u.__w; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); ++ _M_data->_M_amonth01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); ++ _M_data->_M_amonth02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); ++ _M_data->_M_amonth03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); ++ _M_data->_M_amonth04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); ++ _M_data->_M_amonth05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); ++ _M_data->_M_amonth06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); ++ _M_data->_M_amonth07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); ++ _M_data->_M_amonth08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); ++ _M_data->_M_amonth09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); ++ _M_data->_M_amonth10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); ++ _M_data->_M_amonth11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); ++ _M_data->_M_amonth12 = __u.__w; ++ } ++#endif // 0 ++ } ++#endif ++} +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:45:35.000000000 +0200 +@@ -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 ++ ++ template ++ __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 ++ __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 ++ __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 ++ __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 -durN gcc-4.3.0.orig/libstdc++-v3/configure gcc-4.3.0/libstdc++-v3/configure +--- gcc-4.3.0.orig/libstdc++-v3/configure 2008-02-29 01:00:39.000000000 +0100 ++++ gcc-4.3.0/libstdc++-v3/configure 2008-06-10 14:45:35.000000000 +0200 +@@ -14001,7 +14001,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; }; } ;; +@@ -14034,6 +14034,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) + enable_clocale_flag=gnu + ;; +@@ -14422,6 +14425,76 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ echo "$as_me:$LINENO: result: uclibc" >&5 ++echo "${ECHO_T}uclibc" >&6 ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ # Extract the first word of "msgfmt", so it can be a program name with args. ++set dummy msgfmt; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test -n "$check_msgfmt"; then ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_check_msgfmt="yes" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" ++fi ++fi ++check_msgfmt=$ac_cv_prog_check_msgfmt ++if test -n "$check_msgfmt"; then ++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 ++echo "${ECHO_T}$check_msgfmt" >&6 ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ ++ ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -durN gcc-4.3.0.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.3.0/libstdc++-v3/include/c_compatibility/wchar.h +--- gcc-4.3.0.orig/libstdc++-v3/include/c_compatibility/wchar.h 2007-03-04 23:59:49.000000000 +0100 ++++ gcc-4.3.0/libstdc++-v3/include/c_compatibility/wchar.h 2008-06-10 14:45:35.000000000 +0200 +@@ -106,7 +106,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 --git a/patches/gcc/4.3.0/325-superh-default-multilib.patch b/patches/gcc/4.3.0/325-superh-default-multilib.patch deleted file mode 100644 index 4898a36..0000000 --- a/patches/gcc/4.3.0/325-superh-default-multilib.patch +++ /dev/null @@ -1,25 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/53_all_gcc4-superh-default-multilib.patch -The gcc-3.x toolchains would contain all the targets by default. With gcc-4, -you have to actually list out the multilibs you want or you will end up with -just one when using targets like 'sh4-linux-gnu'. - -The resulting toolchain can't even build a kernel as the kernel needs to build -with the nofpu flag to be sure that no fpu ops are generated. - -Here we restore the gcc-3.x behavior; the additional overhead of building all -of these multilibs by default is negligible. - -http://bugs.gentoo.org/140205 - -diff -durN gcc-4.3.0.orig/gcc/config.gcc gcc-4.3.0/gcc/config.gcc ---- gcc-4.3.0.orig/gcc/config.gcc 2008-01-29 17:28:10.000000000 +0100 -+++ gcc-4.3.0/gcc/config.gcc 2008-06-10 14:44:47.000000000 +0200 -@@ -2271,7 +2271,7 @@ - if test x${sh_multilibs} = x ; then - case ${target} in - sh64-superh-linux* | \ -- sh[1234]*) sh_multilibs=${sh_cpu_target} ;; -+ sh[1234]*) sh_multilibs=`cd ${srcdir}/config/sh ; echo t-mlib-sh[1-4]* | sed 's:t-mlib-sh:,m:g;s: ::g'` ;; - sh64* | sh5*) sh_multilibs=m5-32media,m5-32media-nofpu,m5-compact,m5-compact-nofpu,m5-64media,m5-64media-nofpu ;; - sh-superh-*) sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;; - sh*-*-linux*) sh_multilibs=m1,m3e,m4 ;; diff --git a/patches/gcc/4.3.0/330-uclibc-locale-no__x.patch b/patches/gcc/4.3.0/330-uclibc-locale-no__x.patch new file mode 100644 index 0000000..ff15ed1 --- /dev/null +++ b/patches/gcc/4.3.0/330-uclibc-locale-no__x.patch @@ -0,0 +1,224 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_203-uclibc-locale-no__x.patch +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-06-10 14:45:39.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-06-10 14:45:39.000000000 +0200 +@@ -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 +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:45:39.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:45:39.000000000 +0200 +@@ -39,20 +39,6 @@ + #include + #include + +-#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<> +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:45:39.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:45:39.000000000 +0200 +@@ -68,6 +68,7 @@ + { + extern "C" __typeof(uselocale) __uselocale; + } ++#define __uselocale uselocale + #endif + + namespace std +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/collate_members.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 2008-06-10 14:45:39.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/collate_members.cc 2008-06-10 14:45:39.000000000 +0200 +@@ -36,13 +36,6 @@ + #include + #include + +-#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 +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:45:39.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:45:39.000000000 +0200 +@@ -38,13 +38,6 @@ + #undef _LIBC + #include + +-#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 specializations are in src/locale.cc and +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 2008-06-10 14:45:39.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.cc 2008-06-10 14:45:39.000000000 +0200 +@@ -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 + +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:45:39.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:45:39.000000000 +0200 +@@ -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& __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; + } + +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:45:39.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:45:39.000000000 +0200 +@@ -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: +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:45:39.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:45:39.000000000 +0200 +@@ -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 + { +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-06-10 14:45:39.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-06-10 14:45:39.000000000 +0200 +@@ -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 + { diff --git a/patches/gcc/4.3.0/340-uclibc-locale-wchar_fix.patch b/patches/gcc/4.3.0/340-uclibc-locale-wchar_fix.patch new file mode 100644 index 0000000..a20ba94 --- /dev/null +++ b/patches/gcc/4.3.0/340-uclibc-locale-wchar_fix.patch @@ -0,0 +1,51 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_204-uclibc-locale-wchar_fix.patch +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:45:43.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:45:43.000000000 +0200 +@@ -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 +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:45:43.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:45:43.000000000 +0200 +@@ -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/patches/gcc/4.3.0/350-libstdc++-pic.patch b/patches/gcc/4.3.0/350-libstdc++-pic.patch deleted file mode 100644 index 21c2245..0000000 --- a/patches/gcc/4.3.0/350-libstdc++-pic.patch +++ /dev/null @@ -1,56 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/54_all_300-libstdc++-pic.patch -install libstdc++_pic.a if we have pic objs - -diff -durN gcc-4.3.0.orig/libstdc++-v3/src/Makefile.am gcc-4.3.0/libstdc++-v3/src/Makefile.am ---- gcc-4.3.0.orig/libstdc++-v3/src/Makefile.am 2008-02-29 19:26:50.000000000 +0100 -+++ gcc-4.3.0/libstdc++-v3/src/Makefile.am 2008-06-10 14:44:51.000000000 +0200 -@@ -289,6 +289,13 @@ - $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ - - -+install-exec-local: -+ pic_objs=`sed -n "s:'::g;s:^pic_object=::p" *.lo | grep -v '^none$$'`; \ -+ if [ x"$$pic_objs" != x ]; then \ -+ $(AR) cru libstdc++_pic.a $$pic_objs $(top_builddir)/libsupc++/*.o || exit 1; \ -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) || exit 1; \ -+ fi -+ - # Added bits to build debug library. - if GLIBCXX_BUILD_DEBUG - all-local: build_debug -diff -durN gcc-4.3.0.orig/libstdc++-v3/src/Makefile.in gcc-4.3.0/libstdc++-v3/src/Makefile.in ---- gcc-4.3.0.orig/libstdc++-v3/src/Makefile.in 2008-02-29 19:26:50.000000000 +0100 -+++ gcc-4.3.0/libstdc++-v3/src/Makefile.in 2008-06-10 14:44:51.000000000 +0200 -@@ -693,7 +693,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 - -@@ -732,7 +732,7 @@ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am \ -- uninstall-toolexeclibLTLIBRARIES -+ uninstall-toolexeclibLTLIBRARIES install-exec-local - - - # Symbol versioning for shared libraries. -@@ -858,6 +858,14 @@ - install_debug: - (cd ${debugdir} && $(MAKE) \ - toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) -+ -+install-exec-local: -+ pic_objs=`sed -n "s:'::g;s:^pic_object=::p" *.lo | grep -v '^none$$'`; \ -+ if [ x"$$pic_objs" != x ]; then \ -+ $(AR) cru libstdc++_pic.a $$pic_objs $(top_builddir)/libsupc++/*.o || exit 1; \ -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) || exit 1; \ -+ fi -+ - # Tell versions [3.59,3.63) of GNU make to not export all variables. - # Otherwise a system limit (for SysV at least) may be exceeded. - .NOEXPORT: diff --git a/patches/gcc/4.3.0/350-uclibc-locale-update.patch b/patches/gcc/4.3.0/350-uclibc-locale-update.patch new file mode 100644 index 0000000..7ee6aff --- /dev/null +++ b/patches/gcc/4.3.0/350-uclibc-locale-update.patch @@ -0,0 +1,355 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_205-uclibc-locale-update.patch +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:45:43.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:45:46.000000000 +0200 +@@ -46,16 +46,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 +60,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 +74,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 +101,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); + } + +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:45:43.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:45:46.000000000 +0200 +@@ -39,21 +39,23 @@ + #pragma GCC system_header + + #include // get std::strlen +-#include // get std::snprintf or std::sprintf ++#include // get std::vsnprintf or std::vsprintf + #include + #include // For codecvt + #ifdef __UCLIBC_MJN3_ONLY__ + #warning fix this + #endif +-#ifdef __UCLIBC_HAS_LOCALE__ ++#ifdef _GLIBCXX_USE_ICONV + #include // For codecvt using iconv, iconv_t + #endif +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ +-#include // For messages ++#ifdef HAVE_LIBINTL_H ++#include // For messages + #endif ++#include + + #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 +- 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 -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:45:43.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:45:46.000000000 +0200 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + namespace std +@@ -138,20 +143,34 @@ + ctype:: + 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:: + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:45:43.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:45:46.000000000 +0200 +@@ -47,18 +47,21 @@ + template + 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 + 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 +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:45:46.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:45:46.000000000 +0200 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + #ifdef __UCLIBC_MJN3_ONLY__ +@@ -206,7 +211,7 @@ + } + break; + default: +- ; ++ __ret = pattern(); + } + return __ret; + } +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:45:46.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:45:46.000000000 +0200 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + #ifdef __UCLIBC_MJN3_ONLY__ +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:45:39.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:45:46.000000000 +0200 +@@ -37,25 +37,33 @@ + template + __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 + __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 + __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 diff --git a/patches/gcc/4.3.0/360-missing-execinfo_h.patch b/patches/gcc/4.3.0/360-missing-execinfo_h.patch new file mode 100644 index 0000000..d6dcd80 --- /dev/null +++ b/patches/gcc/4.3.0/360-missing-execinfo_h.patch @@ -0,0 +1,13 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_301-missing-execinfo_h.patch +diff -durN gcc-4.3.0.orig/boehm-gc/include/gc.h gcc-4.3.0/boehm-gc/include/gc.h +--- gcc-4.3.0.orig/boehm-gc/include/gc.h 2007-04-23 23:10:09.000000000 +0200 ++++ gcc-4.3.0/boehm-gc/include/gc.h 2008-06-10 14:45:50.000000000 +0200 +@@ -503,7 +503,7 @@ + #if defined(__linux__) || defined(__GLIBC__) + # include + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/patches/gcc/4.3.0/370-c99-complex-ugly-hack.patch b/patches/gcc/4.3.0/370-c99-complex-ugly-hack.patch new file mode 100644 index 0000000..1ad238b --- /dev/null +++ b/patches/gcc/4.3.0/370-c99-complex-ugly-hack.patch @@ -0,0 +1,14 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_303-c99-complex-ugly-hack.patch +diff -durN gcc-4.3.0.orig/libstdc++-v3/configure gcc-4.3.0/libstdc++-v3/configure +--- gcc-4.3.0.orig/libstdc++-v3/configure 2008-06-10 14:45:39.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/configure 2008-06-10 14:45:54.000000000 +0200 +@@ -39006,6 +39006,9 @@ + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + #include ++#ifdef __UCLIBC__ ++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs ++#endif + int + main () + { diff --git a/patches/gcc/4.3.0/375-pr35440.patch b/patches/gcc/4.3.0/375-pr35440.patch deleted file mode 100644 index 097496b..0000000 --- a/patches/gcc/4.3.0/375-pr35440.patch +++ /dev/null @@ -1,59 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/60_all_gcc43-pr35440.patch -2008-03-19 Jakub Jelinek - - PR c/35440 - * c-pretty-print.c (pp_c_initializer_list): Handle CONSTRUCTOR - for all types. - - * gcc.dg/pr35440.c: New test. - -diff -durN gcc-4.3.0.orig/gcc/c-pretty-print.c gcc-4.3.0/gcc/c-pretty-print.c ---- gcc-4.3.0.orig/gcc/c-pretty-print.c 2008-01-29 14:59:59.000000000 +0100 -+++ gcc-4.3.0/gcc/c-pretty-print.c 2008-06-10 14:44:54.000000000 +0200 -@@ -1173,6 +1173,12 @@ - tree type = TREE_TYPE (e); - const enum tree_code code = TREE_CODE (type); - -+ if (TREE_CODE (e) == CONSTRUCTOR) -+ { -+ pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e)); -+ return; -+ } -+ - switch (code) - { - case RECORD_TYPE: -@@ -1207,16 +1213,12 @@ - case VECTOR_TYPE: - if (TREE_CODE (e) == VECTOR_CST) - pp_c_expression_list (pp, TREE_VECTOR_CST_ELTS (e)); -- else if (TREE_CODE (e) == CONSTRUCTOR) -- pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e)); - else - break; - return; - - case COMPLEX_TYPE: -- if (TREE_CODE (e) == CONSTRUCTOR) -- pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e)); -- else if (TREE_CODE (e) == COMPLEX_CST || TREE_CODE (e) == COMPLEX_EXPR) -+ if (TREE_CODE (e) == COMPLEX_CST || TREE_CODE (e) == COMPLEX_EXPR) - { - const bool cst = TREE_CODE (e) == COMPLEX_CST; - pp_expression (pp, cst ? TREE_REALPART (e) : TREE_OPERAND (e, 0)); -diff -durN gcc-4.3.0.orig/gcc/testsuite/gcc.dg/pr35440.c gcc-4.3.0/gcc/testsuite/gcc.dg/pr35440.c ---- gcc-4.3.0.orig/gcc/testsuite/gcc.dg/pr35440.c 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.0/gcc/testsuite/gcc.dg/pr35440.c 2008-06-10 14:44:54.000000000 +0200 -@@ -0,0 +1,12 @@ -+/* PR c/35440 */ -+/* { dg-do compile } */ -+/* { dg-options "-std=gnu99" } */ -+ -+struct A {}; -+struct B { int i; char j[2]; }; -+ -+void foo (void) -+{ -+ (struct A){}(); /* { dg-error "called object" } */ -+ (struct B){ .i = 2, .j[1] = 1 }(); /* { dg-error "called object" } */ -+} diff --git a/patches/gcc/4.3.0/380-index_macro.patch b/patches/gcc/4.3.0/380-index_macro.patch new file mode 100644 index 0000000..ec42836 --- /dev/null +++ b/patches/gcc/4.3.0/380-index_macro.patch @@ -0,0 +1,27 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_304-index_macro.patch +diff -durN gcc-4.3.0.orig/libstdc++-v3/include/ext/rope gcc-4.3.0/libstdc++-v3/include/ext/rope +--- gcc-4.3.0.orig/libstdc++-v3/include/ext/rope 2008-01-31 19:44:55.000000000 +0100 ++++ gcc-4.3.0/libstdc++-v3/include/ext/rope 2008-06-10 14:45:58.000000000 +0200 +@@ -59,6 +59,9 @@ + #include + #include + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + # ifdef __GC + # define __GC_CONST const + # else +diff -durN gcc-4.3.0.orig/libstdc++-v3/include/ext/ropeimpl.h gcc-4.3.0/libstdc++-v3/include/ext/ropeimpl.h +--- gcc-4.3.0.orig/libstdc++-v3/include/ext/ropeimpl.h 2007-05-04 17:06:46.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/include/ext/ropeimpl.h 2008-06-10 14:45:58.000000000 +0200 +@@ -54,6 +54,9 @@ + #include // For uninitialized_copy_n + #include // For power + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + + using std::size_t; diff --git a/patches/gcc/4.3.0/390-libmudflap-susv3-legacy.patch b/patches/gcc/4.3.0/390-libmudflap-susv3-legacy.patch new file mode 100644 index 0000000..6793375 --- /dev/null +++ b/patches/gcc/4.3.0/390-libmudflap-susv3-legacy.patch @@ -0,0 +1,49 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_305-libmudflap-susv3-legacy.patch +diff -durN gcc-4.3.0.orig/libmudflap/mf-hooks2.c gcc-4.3.0/libmudflap/mf-hooks2.c +--- gcc-4.3.0.orig/libmudflap/mf-hooks2.c 2005-09-23 23:58:39.000000000 +0200 ++++ gcc-4.3.0/libmudflap/mf-hooks2.c 2008-06-10 14:46:02.000000000 +0200 +@@ -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 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/patches/gcc/4.3.0/400-libstdc++-namespace.patch b/patches/gcc/4.3.0/400-libstdc++-namespace.patch new file mode 100644 index 0000000..532b50f --- /dev/null +++ b/patches/gcc/4.3.0/400-libstdc++-namespace.patch @@ -0,0 +1,38 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_306-libstdc++-namespace.patch +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 +diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:45:50.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:46:05.000000000 +0200 +@@ -32,7 +32,8 @@ + // + + // Written by Benjamin Kosnik +- ++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 -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:45:50.000000000 +0200 ++++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:46:05.000000000 +0200 +@@ -33,7 +33,8 @@ + // + + // Written by Benjamin Kosnik +- ++namespace std ++{ + template + __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/patches/gcc/4.3.0/400-pr24170.patch b/patches/gcc/4.3.0/400-pr24170.patch deleted file mode 100644 index 2ecceb6..0000000 --- a/patches/gcc/4.3.0/400-pr24170.patch +++ /dev/null @@ -1,61 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/61_all_gcc43-pr24170.patch -http://gcc.gnu.org/PR24170 - -2008-02-20 Tom Tromey - - PR libgcj/24170: - * java/io/natFilePosix.cc (File::performList): Don't use - readdir_r. - * configure, include/config.h.in: Rebuilt. - * configure.ac: Don't check for readdir_r. - -diff -durN gcc-4.3.0.orig/libjava/configure.ac gcc-4.3.0/libjava/configure.ac ---- gcc-4.3.0.orig/libjava/configure.ac 2008-06-10 14:44:17.000000000 +0200 -+++ gcc-4.3.0/libjava/configure.ac 2008-06-10 14:44:58.000000000 +0200 -@@ -1030,7 +1030,7 @@ - PLATFORMNET=NoNet - else - AC_CHECK_FUNCS([strerror_r select fstat open fsync sleep opendir \ -- localtime_r readdir_r getpwuid_r getcwd \ -+ localtime_r getpwuid_r getcwd \ - access stat lstat mkdir rename rmdir unlink utime chmod readlink \ - nl_langinfo setlocale \ - inet_pton uname inet_ntoa \ -diff -durN gcc-4.3.0.orig/libjava/include/config.h.in gcc-4.3.0/libjava/include/config.h.in ---- gcc-4.3.0.orig/libjava/include/config.h.in 2007-07-31 18:17:21.000000000 +0200 -+++ gcc-4.3.0/libjava/include/config.h.in 2008-06-10 14:44:58.000000000 +0200 -@@ -214,9 +214,6 @@ - /* Define to 1 if you have the header file. */ - #undef HAVE_PWD_H - --/* Define to 1 if you have the `readdir_r' function. */ --#undef HAVE_READDIR_R -- - /* Define to 1 if you have the `readlink' function. */ - #undef HAVE_READLINK - -diff -durN gcc-4.3.0.orig/libjava/java/io/natFilePosix.cc gcc-4.3.0/libjava/java/io/natFilePosix.cc ---- gcc-4.3.0.orig/libjava/java/io/natFilePosix.cc 2007-08-04 23:50:01.000000000 +0200 -+++ gcc-4.3.0/libjava/java/io/natFilePosix.cc 2008-06-10 14:44:58.000000000 +0200 -@@ -1,6 +1,6 @@ - // natFile.cc - Native part of File class for POSIX. - --/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2006 -+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2008 - Free Software Foundation - - This file is part of libgcj. -@@ -292,13 +292,7 @@ - - java::util::ArrayList *list = new java::util::ArrayList (); - struct dirent *d; --#if defined(HAVE_READDIR_R) && defined(_POSIX_PTHREAD_SEMANTICS) -- int name_max = pathconf (buf, _PC_NAME_MAX); -- char dbuf[sizeof (struct dirent) + name_max + 1]; -- while (readdir_r (dir, (struct dirent *) dbuf, &d) == 0 && d != NULL) --#else /* HAVE_READDIR_R */ - while ((d = readdir (dir)) != NULL) --#endif /* HAVE_READDIR_R */ - { - // Omit "." and "..". - if (d->d_name[0] == '.' diff --git a/patches/gcc/4.3.0/410-arm-softfloat.patch b/patches/gcc/4.3.0/410-arm-softfloat.patch new file mode 100644 index 0000000..4e7ea7c --- /dev/null +++ b/patches/gcc/4.3.0/410-arm-softfloat.patch @@ -0,0 +1,29 @@ +diff -durN gcc-4.3.1.orig/gcc/config/arm/linux-elf.h gcc-4.3.1/gcc/config/arm/linux-elf.h +--- gcc-4.3.1.orig/gcc/config/arm/linux-elf.h 2007-11-08 14:44:09.000000000 +0100 ++++ gcc-4.3.1/gcc/config/arm/linux-elf.h 2008-07-23 15:30:57.000000000 +0200 +@@ -60,7 +60,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" + +diff -durN gcc-4.3.1.orig/gcc/config/arm/t-linux gcc-4.3.1/gcc/config/arm/t-linux +--- gcc-4.3.1.orig/gcc/config/arm/t-linux 2006-11-09 23:14:27.000000000 +0100 ++++ gcc-4.3.1/gcc/config/arm/t-linux 2008-07-23 19:15:25.000000000 +0200 +@@ -3,7 +3,12 @@ + TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC + + LIB1ASMSRC = arm/lib1funcs.asm +-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx ++LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func \ ++ _call_via_rX _interwork_call_via_rX \ ++ _lshrdi3 _ashrdi3 _ashldi3 \ ++ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ ++ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ ++ _fixsfsi _fixunssfsi _floatdidf _floatdisf _floatundidf _floatundisf + + # MULTILIB_OPTIONS = mhard-float/msoft-float + # MULTILIB_DIRNAMES = hard-float soft-float diff --git a/patches/gcc/4.3.0/420-alpha-signal_h.patch b/patches/gcc/4.3.0/420-alpha-signal_h.patch new file mode 100644 index 0000000..d7e1796 --- /dev/null +++ b/patches/gcc/4.3.0/420-alpha-signal_h.patch @@ -0,0 +1,17 @@ +--- gcc-4.2.1-stock/gcc/config/alpha/linux-unwind.h 2005-06-24 20:22:41.000000000 -0500 ++++ gcc-4.2.1/gcc/config/alpha/linux-unwind.h 2007-09-01 20:21:34.000000000 -0500 +@@ -29,6 +29,9 @@ Boston, MA 02110-1301, USA. */ + /* Do code reading to identify a signal frame, and set the frame + state data appropriately. See unwind-dw2.c for the structs. */ + ++/* Don't use this if inhibit_libc is set ++ The build for this target will fail trying to include missing headers */ ++#ifndef inhibit_libc + #include + #include + +@@ -80,3 +83,4 @@ alpha_fallback_frame_state (struct _Unwi + fs->retaddr_column = 64; + return _URC_NO_REASON; + } ++#endif /* inhibit_libc */ diff --git a/patches/gcc/4.3.0/425-noteGNUstack-00.patch b/patches/gcc/4.3.0/425-noteGNUstack-00.patch deleted file mode 100644 index 8752070..0000000 --- a/patches/gcc/4.3.0/425-noteGNUstack-00.patch +++ /dev/null @@ -1,96 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/61_all_gcc4-ia64-noteGNUstack.patch -2004-09-20 Jakub Jelinek - - * config/rs6000/ppc-asm.h: Add .note.GNU-stack section also - on ppc64-linux. - - * config/ia64/lib1funcs.asm: Add .note.GNU-stack section on - ia64-linux. - * config/ia64/crtbegin.asm: Likewise. - * config/ia64/crtend.asm: Likewise. - * config/ia64/crti.asm: Likewise. - * config/ia64/crtn.asm: Likewise. - -2004-05-14 Jakub Jelinek - - * config/ia64/linux.h (TARGET_ASM_FILE_END): Define. - -diff -durN gcc-4.3.0.orig/gcc/config/ia64/crtbegin.asm gcc-4.3.0/gcc/config/ia64/crtbegin.asm ---- gcc-4.3.0.orig/gcc/config/ia64/crtbegin.asm 2005-09-27 02:52:24.000000000 +0200 -+++ gcc-4.3.0/gcc/config/ia64/crtbegin.asm 2008-06-10 14:45:02.000000000 +0200 -@@ -255,3 +255,7 @@ - .weak __cxa_finalize - #endif - .weak _Jv_RegisterClasses -+ -+#ifdef __linux__ -+.section .note.GNU-stack; .previous -+#endif -diff -durN gcc-4.3.0.orig/gcc/config/ia64/crtend.asm gcc-4.3.0/gcc/config/ia64/crtend.asm ---- gcc-4.3.0.orig/gcc/config/ia64/crtend.asm 2005-09-27 02:52:24.000000000 +0200 -+++ gcc-4.3.0/gcc/config/ia64/crtend.asm 2008-06-10 14:45:02.000000000 +0200 -@@ -122,3 +122,7 @@ - - br.ret.sptk.many rp - .endp __do_global_ctors_aux -+ -+#ifdef __linux__ -+.section .note.GNU-stack; .previous -+#endif -diff -durN gcc-4.3.0.orig/gcc/config/ia64/crti.asm gcc-4.3.0/gcc/config/ia64/crti.asm ---- gcc-4.3.0.orig/gcc/config/ia64/crti.asm 2005-06-25 03:22:41.000000000 +0200 -+++ gcc-4.3.0/gcc/config/ia64/crti.asm 2008-06-10 14:45:02.000000000 +0200 -@@ -64,3 +64,7 @@ - .body - - # end of crti.asm -+ -+#ifdef __linux__ -+.section .note.GNU-stack; .previous -+#endif -diff -durN gcc-4.3.0.orig/gcc/config/ia64/crtn.asm gcc-4.3.0/gcc/config/ia64/crtn.asm ---- gcc-4.3.0.orig/gcc/config/ia64/crtn.asm 2005-06-25 03:22:41.000000000 +0200 -+++ gcc-4.3.0/gcc/config/ia64/crtn.asm 2008-06-10 14:45:02.000000000 +0200 -@@ -54,3 +54,7 @@ - br.ret.sptk.many b0 - - # end of crtn.asm -+ -+#ifdef __linux__ -+.section .note.GNU-stack; .previous -+#endif -diff -durN gcc-4.3.0.orig/gcc/config/ia64/lib1funcs.asm gcc-4.3.0/gcc/config/ia64/lib1funcs.asm ---- gcc-4.3.0.orig/gcc/config/ia64/lib1funcs.asm 2005-09-27 02:52:24.000000000 +0200 -+++ gcc-4.3.0/gcc/config/ia64/lib1funcs.asm 2008-06-10 14:45:02.000000000 +0200 -@@ -792,3 +792,7 @@ - } - .endp __floattitf - #endif -+ -+#ifdef __linux__ -+.section .note.GNU-stack; .previous -+#endif -diff -durN gcc-4.3.0.orig/gcc/config/ia64/linux.h gcc-4.3.0/gcc/config/ia64/linux.h ---- gcc-4.3.0.orig/gcc/config/ia64/linux.h 2006-12-12 16:15:19.000000000 +0100 -+++ gcc-4.3.0/gcc/config/ia64/linux.h 2008-06-10 14:45:02.000000000 +0200 -@@ -5,6 +5,8 @@ - - #define TARGET_VERSION fprintf (stderr, " (IA-64) Linux"); - -+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack -+ - /* This is for -profile to use -lc_p instead of -lc. */ - #undef CC1_SPEC - #define CC1_SPEC "%{profile:-p} %{G*}" -diff -durN gcc-4.3.0.orig/gcc/config/rs6000/ppc-asm.h gcc-4.3.0/gcc/config/rs6000/ppc-asm.h ---- gcc-4.3.0.orig/gcc/config/rs6000/ppc-asm.h 2003-06-04 18:44:51.000000000 +0200 -+++ gcc-4.3.0/gcc/config/rs6000/ppc-asm.h 2008-06-10 14:45:02.000000000 +0200 -@@ -158,7 +158,7 @@ - .size FUNC_NAME(name),GLUE(.L,name)-FUNC_NAME(name) - #endif - --#if defined __linux__ && !defined __powerpc64__ -+#if defined __linux__ - .section .note.GNU-stack - .previous - #endif diff --git a/patches/gcc/4.3.0/450-noteGNUstack-01.patch b/patches/gcc/4.3.0/450-noteGNUstack-01.patch deleted file mode 100644 index 1094e08..0000000 --- a/patches/gcc/4.3.0/450-noteGNUstack-01.patch +++ /dev/null @@ -1,198 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/62_all_gcc4-noteGNUstack.patch -2005-02-08 Jakub Jelinek - - * src/alpha/osf.S: Add .note.GNU-stack on Linux. - * src/s390/sysv.S: Likewise. - * src/powerpc/linux64.S: Likewise. - * src/powerpc/linux64_closure.S: Likewise. - * src/powerpc/ppc_closure.S: Likewise. - * src/powerpc/sysv.S: Likewise. - * src/x86/unix64.S: Likewise. - * src/x86/sysv.S: Likewise. - * src/sparc/v8.S: Likewise. - * src/sparc/v9.S: Likewise. - * src/m68k/sysv.S: Likewise. - * src/ia64/unix.S: Likewise. - * src/arm/sysv.S: Likewise. - - * ia64_save_regs_in_stack.s: Moved to... - * ia64_save_regs_in_stack.S: ... this. Add .note.GNU-stack - on Linux. - -diff -durN gcc-4.3.0.orig/boehm-gc/ia64_save_regs_in_stack.S gcc-4.3.0/boehm-gc/ia64_save_regs_in_stack.S ---- gcc-4.3.0.orig/boehm-gc/ia64_save_regs_in_stack.S 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.0/boehm-gc/ia64_save_regs_in_stack.S 2008-06-10 14:45:05.000000000 +0200 -@@ -0,0 +1,15 @@ -+ .text -+ .align 16 -+ .global GC_save_regs_in_stack -+ .proc GC_save_regs_in_stack -+GC_save_regs_in_stack: -+ .bodyfoo.mpg -+ flushrs -+ ;; -+ mov r8=ar.bsp -+ br.ret.sptk.few rp -+ .endp GC_save_regs_in_stack -+ -+#ifdef __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.0.orig/boehm-gc/ia64_save_regs_in_stack.s gcc-4.3.0/boehm-gc/ia64_save_regs_in_stack.s ---- gcc-4.3.0.orig/boehm-gc/ia64_save_regs_in_stack.s 2001-10-15 06:57:59.000000000 +0200 -+++ gcc-4.3.0/boehm-gc/ia64_save_regs_in_stack.s 2008-06-10 14:45:05.000000000 +0200 -@@ -1,12 +0,0 @@ -- .text -- .align 16 -- .global GC_save_regs_in_stack -- .proc GC_save_regs_in_stack --GC_save_regs_in_stack: -- .body -- flushrs -- ;; -- mov r8=ar.bsp -- br.ret.sptk.few rp -- .endp GC_save_regs_in_stack -- -diff -durN gcc-4.3.0.orig/libffi/src/alpha/osf.S gcc-4.3.0/libffi/src/alpha/osf.S ---- gcc-4.3.0.orig/libffi/src/alpha/osf.S 2007-04-06 18:24:16.000000000 +0200 -+++ gcc-4.3.0/libffi/src/alpha/osf.S 2008-06-10 14:45:05.000000000 +0200 -@@ -358,4 +358,8 @@ - .byte 16 # uleb128 offset 16*-8 - .align 3 - $LEFDE3: -+ -+#ifdef __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif - #endif -diff -durN gcc-4.3.0.orig/libffi/src/arm/sysv.S gcc-4.3.0/libffi/src/arm/sysv.S ---- gcc-4.3.0.orig/libffi/src/arm/sysv.S 2007-09-04 19:52:45.000000000 +0200 -+++ gcc-4.3.0/libffi/src/arm/sysv.S 2008-06-10 14:45:05.000000000 +0200 -@@ -293,3 +293,6 @@ - UNWIND .fnend - .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) - -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",%progbits -+#endif -diff -durN gcc-4.3.0.orig/libffi/src/ia64/unix.S gcc-4.3.0/libffi/src/ia64/unix.S ---- gcc-4.3.0.orig/libffi/src/ia64/unix.S 2005-03-30 23:49:19.000000000 +0200 -+++ gcc-4.3.0/libffi/src/ia64/unix.S 2008-06-10 14:45:05.000000000 +0200 -@@ -553,3 +553,7 @@ - data8 @pcrel(.Lld_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT - data8 @pcrel(.Lld_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE - data8 @pcrel(.Lld_hfa_ldouble) // FFI_IA64_TYPE_HFA_LDOUBLE -+ -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.0.orig/libffi/src/m68k/sysv.S gcc-4.3.0/libffi/src/m68k/sysv.S ---- gcc-4.3.0.orig/libffi/src/m68k/sysv.S 2007-05-10 23:29:04.000000000 +0200 -+++ gcc-4.3.0/libffi/src/m68k/sysv.S 2008-06-10 14:45:05.000000000 +0200 -@@ -207,3 +207,7 @@ - rts - CFI_ENDPROC() - .size ffi_closure_struct_SYSV,.-ffi_closure_struct_SYSV -+ -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.0.orig/libffi/src/powerpc/linux64.S gcc-4.3.0/libffi/src/powerpc/linux64.S ---- gcc-4.3.0.orig/libffi/src/powerpc/linux64.S 2007-11-17 00:24:53.000000000 +0100 -+++ gcc-4.3.0/libffi/src/powerpc/linux64.S 2008-06-10 14:45:05.000000000 +0200 -@@ -179,3 +179,7 @@ - .align 3 - .LEFDE1: - #endif -+ -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.0.orig/libffi/src/powerpc/linux64_closure.S gcc-4.3.0/libffi/src/powerpc/linux64_closure.S ---- gcc-4.3.0.orig/libffi/src/powerpc/linux64_closure.S 2005-08-11 23:18:24.000000000 +0200 -+++ gcc-4.3.0/libffi/src/powerpc/linux64_closure.S 2008-06-10 14:45:05.000000000 +0200 -@@ -204,3 +204,7 @@ - .align 3 - .LEFDE1: - #endif -+ -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.0.orig/libffi/src/powerpc/ppc_closure.S gcc-4.3.0/libffi/src/powerpc/ppc_closure.S ---- gcc-4.3.0.orig/libffi/src/powerpc/ppc_closure.S 2007-12-01 22:00:04.000000000 +0100 -+++ gcc-4.3.0/libffi/src/powerpc/ppc_closure.S 2008-06-10 14:45:05.000000000 +0200 -@@ -295,3 +295,7 @@ - .LEFDE1: - - #endif -+ -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.0.orig/libffi/src/powerpc/sysv.S gcc-4.3.0/libffi/src/powerpc/sysv.S ---- gcc-4.3.0.orig/libffi/src/powerpc/sysv.S 2007-12-01 22:00:04.000000000 +0100 -+++ gcc-4.3.0/libffi/src/powerpc/sysv.S 2008-06-10 14:45:05.000000000 +0200 -@@ -223,3 +223,7 @@ - .align 2 - .LEFDE1: - #endif -+ -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.0.orig/libffi/src/s390/sysv.S gcc-4.3.0/libffi/src/s390/sysv.S ---- gcc-4.3.0.orig/libffi/src/s390/sysv.S 2003-10-21 21:01:58.000000000 +0200 -+++ gcc-4.3.0/libffi/src/s390/sysv.S 2008-06-10 14:45:05.000000000 +0200 -@@ -427,3 +427,6 @@ - - #endif - -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.0.orig/libffi/src/sparc/v8.S gcc-4.3.0/libffi/src/sparc/v8.S ---- gcc-4.3.0.orig/libffi/src/sparc/v8.S 2004-11-22 19:35:16.000000000 +0100 -+++ gcc-4.3.0/libffi/src/sparc/v8.S 2008-06-10 14:45:05.000000000 +0200 -@@ -265,3 +265,7 @@ - .byte 0x1f ! uleb128 0x1f - .align WS - .LLEFDE2: -+ -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.0.orig/libffi/src/sparc/v9.S gcc-4.3.0/libffi/src/sparc/v9.S ---- gcc-4.3.0.orig/libffi/src/sparc/v9.S 2004-01-25 07:58:33.000000000 +0100 -+++ gcc-4.3.0/libffi/src/sparc/v9.S 2008-06-10 14:45:05.000000000 +0200 -@@ -300,3 +300,7 @@ - .align 8 - .LLEFDE2: - #endif -+ -+#ifdef __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.0.orig/libffi/src/x86/sysv.S gcc-4.3.0/libffi/src/x86/sysv.S ---- gcc-4.3.0.orig/libffi/src/x86/sysv.S 2008-01-30 15:36:58.000000000 +0100 -+++ gcc-4.3.0/libffi/src/x86/sysv.S 2008-06-10 14:45:05.000000000 +0200 -@@ -430,3 +430,7 @@ - #endif - - #endif /* ifndef __x86_64__ */ -+ -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.0.orig/libffi/src/x86/unix64.S gcc-4.3.0/libffi/src/x86/unix64.S ---- gcc-4.3.0.orig/libffi/src/x86/unix64.S 2005-05-05 06:06:38.000000000 +0200 -+++ gcc-4.3.0/libffi/src/x86/unix64.S 2008-06-10 14:45:05.000000000 +0200 -@@ -410,3 +410,7 @@ - .LEFDE3: - - #endif /* __x86_64__ */ -+ -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif diff --git a/patches/gcc/4.3.0/475-pr35705.patch b/patches/gcc/4.3.0/475-pr35705.patch deleted file mode 100644 index 5eb4312..0000000 --- a/patches/gcc/4.3.0/475-pr35705.patch +++ /dev/null @@ -1,21 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/63_all_gcc43-pr35705.patch -http://gcc.gnu.org/PR35705 - -2008-04-01 John David Anglin - - PR middle-end/35705 - * fold-const.c (get_pointer_modulus_and_residue): Return modulus 1 if - the expression is a function address. - -diff -durN gcc-4.3.0.orig/gcc/fold-const.c gcc-4.3.0/gcc/fold-const.c ---- gcc-4.3.0.orig/gcc/fold-const.c 2008-02-27 15:12:33.000000000 +0100 -+++ gcc-4.3.0/gcc/fold-const.c 2008-06-10 14:45:09.000000000 +0200 -@@ -9357,7 +9357,7 @@ - } - } - -- if (DECL_P (expr)) -+ if (DECL_P (expr) && TREE_CODE (expr) != FUNCTION_DECL) - return DECL_ALIGN_UNIT (expr); - } - else if (code == POINTER_PLUS_EXPR) diff --git a/patches/gcc/4.3.0/500-pr34571.patch b/patches/gcc/4.3.0/500-pr34571.patch deleted file mode 100644 index 44d6f86..0000000 --- a/patches/gcc/4.3.0/500-pr34571.patch +++ /dev/null @@ -1,35 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/64_all_gcc43-pr34571.patch -http://gcc.gnu.org/PR34571 - -2007-12-26 Rask Ingemann Lambertsen - - PR target/34571 - * config/alpha/alpha.c (alpha_cannot_force_const_mem): Use - symbolic_operand. - * varasm.c (output_constant_pool_1): Fix typo. - -diff -durN gcc-4.3.0.orig/gcc/config/alpha/alpha.c gcc-4.3.0/gcc/config/alpha/alpha.c ---- gcc-4.3.0.orig/gcc/config/alpha/alpha.c 2008-02-07 18:45:24.000000000 +0100 -+++ gcc-4.3.0/gcc/config/alpha/alpha.c 2008-06-10 14:45:13.000000000 +0200 -@@ -1113,8 +1113,7 @@ - static bool - alpha_cannot_force_const_mem (rtx x) - { -- enum rtx_code code = GET_CODE (x); -- return code == SYMBOL_REF || code == LABEL_REF || code == CONST; -+ return symbolic_operand (x, GET_MODE (x)); - } - - /* We do not allow indirect calls to be optimized into sibling calls, nor -diff -durN gcc-4.3.0.orig/gcc/varasm.c gcc-4.3.0/gcc/varasm.c ---- gcc-4.3.0.orig/gcc/varasm.c 2007-12-05 22:55:10.000000000 +0100 -+++ gcc-4.3.0/gcc/varasm.c 2008-06-10 14:45:13.000000000 +0200 -@@ -3710,7 +3710,7 @@ - /* FALLTHRU */ - - case LABEL_REF: -- tmp = XEXP (x, 0); -+ tmp = XEXP (tmp, 0); - gcc_assert (!INSN_DELETED_P (tmp)); - gcc_assert (!NOTE_P (tmp) - || NOTE_KIND (tmp) != NOTE_INSN_DELETED); diff --git a/patches/gcc/4.3.0/525-pr35982.patch b/patches/gcc/4.3.0/525-pr35982.patch deleted file mode 100644 index 461fd57..0000000 --- a/patches/gcc/4.3.0/525-pr35982.patch +++ /dev/null @@ -1,23 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/65_all_gcc43-pr35982.patch -http://gcc.gnu.org/PR35982 - -2008-04-23 Ira Rosen - - PR tree-optimization/35982 - * tree-vect-analyze.c (vect_check_interleaving): Check that the - interleaved data-refs are of the same type. - -diff -durN gcc-4.3.0.orig/gcc/tree-vect-analyze.c gcc-4.3.0/gcc/tree-vect-analyze.c ---- gcc-4.3.0.orig/gcc/tree-vect-analyze.c 2007-12-06 17:18:55.000000000 +0100 -+++ gcc-4.3.0/gcc/tree-vect-analyze.c 2008-06-10 14:45:17.000000000 +0200 -@@ -1081,7 +1081,9 @@ - type_size_b = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (drb)))); - - if (type_size_a != type_size_b -- || tree_int_cst_compare (DR_STEP (dra), DR_STEP (drb))) -+ || tree_int_cst_compare (DR_STEP (dra), DR_STEP (drb)) -+ || !types_compatible_p (TREE_TYPE (DR_REF (dra)), -+ TREE_TYPE (DR_REF (drb)))) - return; - - init_a = TREE_INT_CST_LOW (DR_INIT (dra)); diff --git a/patches/gcc/4.3.0/550-pr25343.patch b/patches/gcc/4.3.0/550-pr25343.patch deleted file mode 100644 index eee48d5..0000000 --- a/patches/gcc/4.3.0/550-pr25343.patch +++ /dev/null @@ -1,21 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/66_all_gcc43-pr25343.patch -http://gcc.gnu.org/PR25343 - -sniped from Debian - -2008-04-27 Roman Zippel - - * config/host-linux.c (TRY_EMPTY_VM_SPACE): Define for __mc68000__. - -diff -durN gcc-4.3.0.orig/gcc/config/host-linux.c gcc-4.3.0/gcc/config/host-linux.c ---- gcc-4.3.0.orig/gcc/config/host-linux.c 2007-08-02 12:49:31.000000000 +0200 -+++ gcc-4.3.0/gcc/config/host-linux.c 2008-06-10 14:45:20.000000000 +0200 -@@ -84,6 +84,8 @@ - # define TRY_EMPTY_VM_SPACE 0x8000000000 - #elif defined(__sparc__) - # define TRY_EMPTY_VM_SPACE 0x60000000 -+#elif defined(__mc68000__) -+# define TRY_EMPTY_VM_SPACE 0x40000000 - #else - # define TRY_EMPTY_VM_SPACE 0 - #endif diff --git a/patches/gcc/4.3.0/575-sh-pr24836.patch b/patches/gcc/4.3.0/575-sh-pr24836.patch deleted file mode 100644 index 8c8f8e3..0000000 --- a/patches/gcc/4.3.0/575-sh-pr24836.patch +++ /dev/null @@ -1,28 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/74_all_sh-pr24836.patch -http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348 -http://gcc.gnu.org/PR24836 - -diff -durN gcc-4.3.0.orig/gcc/configure gcc-4.3.0/gcc/configure ---- gcc-4.3.0.orig/gcc/configure 2008-06-10 14:44:21.000000000 +0200 -+++ gcc-4.3.0/gcc/configure 2008-06-10 14:45:24.000000000 +0200 -@@ -14700,7 +14700,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 -durN gcc-4.3.0.orig/gcc/configure.ac gcc-4.3.0/gcc/configure.ac ---- gcc-4.3.0.orig/gcc/configure.ac 2008-06-10 14:44:21.000000000 +0200 -+++ gcc-4.3.0/gcc/configure.ac 2008-06-10 14:45:24.000000000 +0200 -@@ -2533,7 +2533,7 @@ - tls_first_minor=14 - tls_as_opt="-m64 -Aesame --fatal-warnings" - ;; -- sh-*-* | sh[34]-*-*) -+ sh-*-* | sh[34]*-*-*) - conftest_s=' - .section ".tdata","awT",@progbits - foo: .long 25 diff --git a/patches/gcc/4.3.0/600-ca-translation-typo.patch b/patches/gcc/4.3.0/600-ca-translation-typo.patch deleted file mode 100644 index ae77fe6..0000000 --- a/patches/gcc/4.3.0/600-ca-translation-typo.patch +++ /dev/null @@ -1,19 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/gentoo/85_all_gcc-ca-translation-typo.patch -http://bugs.gentoo.org/127190 - -2006-03-28 Harald van Dijk - - * ca.po: Fix printf flag typo in negative value translation. - -diff -durN gcc-4.3.0.orig/gcc/po/ca.po gcc-4.3.0/gcc/po/ca.po ---- gcc-4.3.0.orig/gcc/po/ca.po 2007-11-10 19:36:27.000000000 +0100 -+++ gcc-4.3.0/gcc/po/ca.po 2008-06-10 14:45:27.000000000 +0200 -@@ -36028,7 +36028,7 @@ - #~ msgstr "passant el valor negatiu `%E' per a %s %P de \"%D\"" - - #~ msgid "%s of negative value `%E' to `%T'" --#~ msgstr "%s de valor negatiu `%I' a \"%T\"" -+#~ msgstr "%s de valor negatiu `%E' a \"%T\"" - - #~ msgid "initializing array with parameter list" - #~ msgstr "inicialitzant una matriu amb una llista de paràmetres" diff --git a/patches/gcc/4.3.0/625-uclibc-conf-noupstream.patch b/patches/gcc/4.3.0/625-uclibc-conf-noupstream.patch deleted file mode 100644 index 3b93043..0000000 --- a/patches/gcc/4.3.0/625-uclibc-conf-noupstream.patch +++ /dev/null @@ -1,13 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_103-uclibc-conf-noupstream.patch -diff -durN gcc-4.3.0.orig/gcc/config.gcc gcc-4.3.0/gcc/config.gcc ---- gcc-4.3.0.orig/gcc/config.gcc 2008-06-10 14:44:51.000000000 +0200 -+++ gcc-4.3.0/gcc/config.gcc 2008-06-10 14:45:31.000000000 +0200 -@@ -2142,7 +2142,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/patches/gcc/4.3.0/650-uclibc-locale.patch b/patches/gcc/4.3.0/650-uclibc-locale.patch deleted file mode 100644 index 60e4b90..0000000 --- a/patches/gcc/4.3.0/650-uclibc-locale.patch +++ /dev/null @@ -1,2794 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_200-uclibc-locale.patch -diff -durN gcc-4.3.0.orig/libstdc++-v3/acinclude.m4 gcc-4.3.0/libstdc++-v3/acinclude.m4 ---- gcc-4.3.0.orig/libstdc++-v3/acinclude.m4 2008-02-29 01:00:39.000000000 +0100 -+++ gcc-4.3.0/libstdc++-v3/acinclude.m4 2008-06-10 14:45:35.000000000 +0200 -@@ -1349,7 +1349,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 -@@ -1370,6 +1370,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) - enable_clocale_flag=gnu - ;; -@@ -1541,6 +1544,40 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ AC_MSG_RESULT(uclibc) -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ AC_SUBST(glibcxx_MOFILES) -+ AC_SUBST(glibcxx_POFILES) -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-06-10 14:45:35.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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 -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:45:35.000000000 +0200 -@@ -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 -+ -+#include // For errno -+#include -+#include -+#include -+#include -+ -+#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 -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:45:35.000000000 +0200 -@@ -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 -+ -+#ifndef _C_LOCALE_H -+#define _C_LOCALE_H 1 -+ -+#pragma GCC system_header -+ -+#include // get std::strlen -+#include // get std::snprintf or std::sprintf -+#include -+#include // For codecvt -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this -+#endif -+#ifdef __UCLIBC_HAS_LOCALE__ -+#include // For codecvt using iconv, iconv_t -+#endif -+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ -+#include // 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 -+ 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 -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2008-06-10 14:45:35.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+namespace std -+{ -+ // Specializations. -+#ifdef _GLIBCXX_USE_WCHAR_T -+ codecvt_base::result -+ codecvt:: -+ 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(-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(__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:: -+ 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(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(-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(-1) -+ || __conv == static_cast(-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:: -+ 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:: -+ 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:: -+ 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(__builtin_alloca(sizeof(wchar_t) -+ * __max)); -+ while (__from < __end && __max) -+ { -+ const extern_type* __from_chunk_end; -+ __from_chunk_end = static_cast(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(-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(-1) -+ || __conv == static_cast(-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 -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/collate_members.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/collate_members.cc 2008-06-10 14:45:35.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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::_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::_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::_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::_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 -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:45:35.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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 specializations are in src/locale.cc and -+ // various /config/os/* files. -+ template<> -+ ctype_byname::ctype_byname(const char* __s, size_t __refs) -+ : ctype(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::__wmask_type -+ ctype::_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::do_toupper(wchar_t __c) const -+ { return __towupper_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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::do_tolower(wchar_t __c) const -+ { return __towlower_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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:: -+ 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:: -+ 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:: -+ 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:: -+ 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:: -+ do_widen(char __c) const -+ { return _M_widen[static_cast(__c)]; } -+ -+ const char* -+ ctype:: -+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const -+ { -+ while (__lo < __hi) -+ { -+ *__dest = _M_widen[static_cast(*__lo)]; -+ ++__lo; -+ ++__dest; -+ } -+ return __hi; -+ } -+ -+ char -+ ctype:: -+ 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(__c)); -+ } -+ -+ const wchar_t* -+ ctype:: -+ 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(__c)); -+ } -+ ++__lo; -+ ++__dest; -+ } -+ else -+ while (__lo < __hi) -+ { -+ const int __c = wctob(*__lo); -+ *__dest = (__c == EOF ? __dfault : static_cast(__c)); -+ ++__lo; -+ ++__dest; -+ } -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ return __hi; -+ } -+ -+ void -+ ctype::_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(__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(_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 -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.cc 2008-06-10 14:45:35.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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::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(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::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 -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:45:35.000000000 +0200 -@@ -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 -+ -+#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 -+ messages<_CharT>::messages(size_t __refs) -+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), -+ _M_name_messages(_S_get_c_name()) -+ { } -+ -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::open(const basic_string& __s, const locale& __loc, -+ const char* __dir) const -+ { -+ __bindtextdomain(__s.c_str(), __dir); -+ return this->do_open(__s, __loc); -+ } -+ -+ // Virtual member functions. -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::do_open(const basic_string& __s, -+ const locale&) const -+ { -+ // No error checking is done, assume the catalog exists and can -+ // be used. -+ __textdomain(__s.c_str()); -+ return 0; -+ } -+ -+ template -+ void -+ messages<_CharT>::do_close(catalog) const -+ { } -+ -+ // messages_byname -+ template -+ 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 -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:45:35.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::~moneypunct() -+ { delete _M_data; } -+ -+ template<> -+ moneypunct::~moneypunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ moneypunct::_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; -+ -+ 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(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::_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; -+ -+ 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(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::~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::~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 -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:45:35.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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::~numpunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ numpunct::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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(__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(__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::~numpunct() -+ { delete _M_data; } -+ #endif -+} -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-06-10 14:45:35.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+ 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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+#warning wide time stuff -+// if (!__cloc) -+ { -+ // "C" locale -+ _M_c_locale_timepunct = _S_get_c_locale(); -+ -+ _M_data->_M_date_format = L"%m/%d/%y"; -+ _M_data->_M_date_era_format = L"%m/%d/%y"; -+ _M_data->_M_time_format = L"%H:%M:%S"; -+ _M_data->_M_time_era_format = L"%H:%M:%S"; -+ _M_data->_M_date_time_format = L""; -+ _M_data->_M_date_time_era_format = L""; -+ _M_data->_M_am = L"AM"; -+ _M_data->_M_pm = L"PM"; -+ _M_data->_M_am_pm_format = L""; -+ -+ // Day names, starting with "C"'s Sunday. -+ _M_data->_M_day1 = L"Sunday"; -+ _M_data->_M_day2 = L"Monday"; -+ _M_data->_M_day3 = L"Tuesday"; -+ _M_data->_M_day4 = L"Wednesday"; -+ _M_data->_M_day5 = L"Thursday"; -+ _M_data->_M_day6 = L"Friday"; -+ _M_data->_M_day7 = L"Saturday"; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ _M_data->_M_aday1 = L"Sun"; -+ _M_data->_M_aday2 = L"Mon"; -+ _M_data->_M_aday3 = L"Tue"; -+ _M_data->_M_aday4 = L"Wed"; -+ _M_data->_M_aday5 = L"Thu"; -+ _M_data->_M_aday6 = L"Fri"; -+ _M_data->_M_aday7 = L"Sat"; -+ -+ // Month names, starting with "C"'s January. -+ _M_data->_M_month01 = L"January"; -+ _M_data->_M_month02 = L"February"; -+ _M_data->_M_month03 = L"March"; -+ _M_data->_M_month04 = L"April"; -+ _M_data->_M_month05 = L"May"; -+ _M_data->_M_month06 = L"June"; -+ _M_data->_M_month07 = L"July"; -+ _M_data->_M_month08 = L"August"; -+ _M_data->_M_month09 = L"September"; -+ _M_data->_M_month10 = L"October"; -+ _M_data->_M_month11 = L"November"; -+ _M_data->_M_month12 = L"December"; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ _M_data->_M_amonth01 = L"Jan"; -+ _M_data->_M_amonth02 = L"Feb"; -+ _M_data->_M_amonth03 = L"Mar"; -+ _M_data->_M_amonth04 = L"Apr"; -+ _M_data->_M_amonth05 = L"May"; -+ _M_data->_M_amonth06 = L"Jun"; -+ _M_data->_M_amonth07 = L"Jul"; -+ _M_data->_M_amonth08 = L"Aug"; -+ _M_data->_M_amonth09 = L"Sep"; -+ _M_data->_M_amonth10 = L"Oct"; -+ _M_data->_M_amonth11 = L"Nov"; -+ _M_data->_M_amonth12 = L"Dec"; -+ } -+#if 0 -+ else -+ { -+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); -+ -+ union { char *__s; wchar_t *__w; } __u; -+ -+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); -+ _M_data->_M_date_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); -+ _M_data->_M_date_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); -+ _M_data->_M_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); -+ _M_data->_M_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); -+ _M_data->_M_date_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); -+ _M_data->_M_date_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); -+ _M_data->_M_am = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); -+ _M_data->_M_pm = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); -+ _M_data->_M_am_pm_format = __u.__w; -+ -+ // Day names, starting with "C"'s Sunday. -+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); -+ _M_data->_M_day1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); -+ _M_data->_M_day2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); -+ _M_data->_M_day3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); -+ _M_data->_M_day4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); -+ _M_data->_M_day5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); -+ _M_data->_M_day6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); -+ _M_data->_M_day7 = __u.__w; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); -+ _M_data->_M_aday1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); -+ _M_data->_M_aday2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); -+ _M_data->_M_aday3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); -+ _M_data->_M_aday4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); -+ _M_data->_M_aday5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); -+ _M_data->_M_aday6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); -+ _M_data->_M_aday7 = __u.__w; -+ -+ // Month names, starting with "C"'s January. -+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); -+ _M_data->_M_month01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); -+ _M_data->_M_month02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); -+ _M_data->_M_month03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); -+ _M_data->_M_month04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); -+ _M_data->_M_month05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); -+ _M_data->_M_month06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); -+ _M_data->_M_month07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); -+ _M_data->_M_month08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); -+ _M_data->_M_month09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); -+ _M_data->_M_month10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); -+ _M_data->_M_month11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); -+ _M_data->_M_month12 = __u.__w; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); -+ _M_data->_M_amonth01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); -+ _M_data->_M_amonth02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); -+ _M_data->_M_amonth03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); -+ _M_data->_M_amonth04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); -+ _M_data->_M_amonth05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); -+ _M_data->_M_amonth06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); -+ _M_data->_M_amonth07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); -+ _M_data->_M_amonth08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); -+ _M_data->_M_amonth09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); -+ _M_data->_M_amonth10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); -+ _M_data->_M_amonth11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); -+ _M_data->_M_amonth12 = __u.__w; -+ } -+#endif // 0 -+ } -+#endif -+} -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:45:35.000000000 +0200 -@@ -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 -+ -+ template -+ __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 -+ __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 -+ __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 -+ __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 -durN gcc-4.3.0.orig/libstdc++-v3/configure gcc-4.3.0/libstdc++-v3/configure ---- gcc-4.3.0.orig/libstdc++-v3/configure 2008-02-29 01:00:39.000000000 +0100 -+++ gcc-4.3.0/libstdc++-v3/configure 2008-06-10 14:45:35.000000000 +0200 -@@ -14001,7 +14001,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; }; } ;; -@@ -14034,6 +14034,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) - enable_clocale_flag=gnu - ;; -@@ -14422,6 +14425,76 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ echo "$as_me:$LINENO: result: uclibc" >&5 -+echo "${ECHO_T}uclibc" >&6 -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ # Extract the first word of "msgfmt", so it can be a program name with args. -+set dummy msgfmt; ac_word=$2 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_check_msgfmt+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$check_msgfmt"; then -+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. -+else -+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -+for as_dir in $PATH -+do -+ IFS=$as_save_IFS -+ test -z "$as_dir" && as_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_check_msgfmt="yes" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done -+ -+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" -+fi -+fi -+check_msgfmt=$ac_cv_prog_check_msgfmt -+if test -n "$check_msgfmt"; then -+ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 -+echo "${ECHO_T}$check_msgfmt" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ -+ -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the -diff -durN gcc-4.3.0.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.3.0/libstdc++-v3/include/c_compatibility/wchar.h ---- gcc-4.3.0.orig/libstdc++-v3/include/c_compatibility/wchar.h 2007-03-04 23:59:49.000000000 +0100 -+++ gcc-4.3.0/libstdc++-v3/include/c_compatibility/wchar.h 2008-06-10 14:45:35.000000000 +0200 -@@ -106,7 +106,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 --git a/patches/gcc/4.3.0/675-uclibc-locale-no__x.patch b/patches/gcc/4.3.0/675-uclibc-locale-no__x.patch deleted file mode 100644 index ff15ed1..0000000 --- a/patches/gcc/4.3.0/675-uclibc-locale-no__x.patch +++ /dev/null @@ -1,224 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_203-uclibc-locale-no__x.patch -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-06-10 14:45:39.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-06-10 14:45:39.000000000 +0200 -@@ -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 -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:45:39.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:45:39.000000000 +0200 -@@ -39,20 +39,6 @@ - #include - #include - --#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<> -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:45:39.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:45:39.000000000 +0200 -@@ -68,6 +68,7 @@ - { - extern "C" __typeof(uselocale) __uselocale; - } -+#define __uselocale uselocale - #endif - - namespace std -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/collate_members.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 2008-06-10 14:45:39.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/collate_members.cc 2008-06-10 14:45:39.000000000 +0200 -@@ -36,13 +36,6 @@ - #include - #include - --#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 -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:45:39.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:45:39.000000000 +0200 -@@ -38,13 +38,6 @@ - #undef _LIBC - #include - --#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 specializations are in src/locale.cc and -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 2008-06-10 14:45:39.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.cc 2008-06-10 14:45:39.000000000 +0200 -@@ -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 - -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:45:39.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:45:39.000000000 +0200 -@@ -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& __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; - } - -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:45:39.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:45:39.000000000 +0200 -@@ -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: -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:45:39.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:45:39.000000000 +0200 -@@ -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 - { -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-06-10 14:45:39.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-06-10 14:45:39.000000000 +0200 -@@ -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 - { diff --git a/patches/gcc/4.3.0/700-uclibc-locale-wchar_fix.patch b/patches/gcc/4.3.0/700-uclibc-locale-wchar_fix.patch deleted file mode 100644 index a20ba94..0000000 --- a/patches/gcc/4.3.0/700-uclibc-locale-wchar_fix.patch +++ /dev/null @@ -1,51 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_204-uclibc-locale-wchar_fix.patch -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:45:43.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:45:43.000000000 +0200 -@@ -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 -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:45:43.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:45:43.000000000 +0200 -@@ -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/patches/gcc/4.3.0/725-uclibc-locale-update.patch b/patches/gcc/4.3.0/725-uclibc-locale-update.patch deleted file mode 100644 index 7ee6aff..0000000 --- a/patches/gcc/4.3.0/725-uclibc-locale-update.patch +++ /dev/null @@ -1,355 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_205-uclibc-locale-update.patch -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:45:43.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:45:46.000000000 +0200 -@@ -46,16 +46,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 +60,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 +74,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 +101,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); - } - -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:45:43.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:45:46.000000000 +0200 -@@ -39,21 +39,23 @@ - #pragma GCC system_header - - #include // get std::strlen --#include // get std::snprintf or std::sprintf -+#include // get std::vsnprintf or std::vsprintf - #include - #include // For codecvt - #ifdef __UCLIBC_MJN3_ONLY__ - #warning fix this - #endif --#ifdef __UCLIBC_HAS_LOCALE__ -+#ifdef _GLIBCXX_USE_ICONV - #include // For codecvt using iconv, iconv_t - #endif --#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ --#include // For messages -+#ifdef HAVE_LIBINTL_H -+#include // For messages - #endif -+#include - - #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 -- 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 -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:45:43.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:45:46.000000000 +0200 -@@ -33,9 +33,14 @@ - - // Written by Benjamin Kosnik - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - namespace std -@@ -138,20 +143,34 @@ - ctype:: - 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:: - do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:45:43.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:45:46.000000000 +0200 -@@ -47,18 +47,21 @@ - template - 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 - 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 -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:45:46.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:45:46.000000000 +0200 -@@ -33,9 +33,14 @@ - - // Written by Benjamin Kosnik - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - #ifdef __UCLIBC_MJN3_ONLY__ -@@ -206,7 +211,7 @@ - } - break; - default: -- ; -+ __ret = pattern(); - } - return __ret; - } -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:45:46.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:45:46.000000000 +0200 -@@ -33,9 +33,14 @@ - - // Written by Benjamin Kosnik - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - #ifdef __UCLIBC_MJN3_ONLY__ -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:45:39.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:45:46.000000000 +0200 -@@ -37,25 +37,33 @@ - template - __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 - __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 - __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 diff --git a/patches/gcc/4.3.0/750-missing-execinfo_h.patch b/patches/gcc/4.3.0/750-missing-execinfo_h.patch deleted file mode 100644 index d6dcd80..0000000 --- a/patches/gcc/4.3.0/750-missing-execinfo_h.patch +++ /dev/null @@ -1,13 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_301-missing-execinfo_h.patch -diff -durN gcc-4.3.0.orig/boehm-gc/include/gc.h gcc-4.3.0/boehm-gc/include/gc.h ---- gcc-4.3.0.orig/boehm-gc/include/gc.h 2007-04-23 23:10:09.000000000 +0200 -+++ gcc-4.3.0/boehm-gc/include/gc.h 2008-06-10 14:45:50.000000000 +0200 -@@ -503,7 +503,7 @@ - #if defined(__linux__) || defined(__GLIBC__) - # include - # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ -- && !defined(__ia64__) -+ && !defined(__ia64__) && !defined(__UCLIBC__) - # ifndef GC_HAVE_BUILTIN_BACKTRACE - # define GC_HAVE_BUILTIN_BACKTRACE - # endif diff --git a/patches/gcc/4.3.0/775-c99-complex-ugly-hack.patch b/patches/gcc/4.3.0/775-c99-complex-ugly-hack.patch deleted file mode 100644 index 1ad238b..0000000 --- a/patches/gcc/4.3.0/775-c99-complex-ugly-hack.patch +++ /dev/null @@ -1,14 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_303-c99-complex-ugly-hack.patch -diff -durN gcc-4.3.0.orig/libstdc++-v3/configure gcc-4.3.0/libstdc++-v3/configure ---- gcc-4.3.0.orig/libstdc++-v3/configure 2008-06-10 14:45:39.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/configure 2008-06-10 14:45:54.000000000 +0200 -@@ -39006,6 +39006,9 @@ - cat >>conftest.$ac_ext <<_ACEOF - /* end confdefs.h. */ - #include -+#ifdef __UCLIBC__ -+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs -+#endif - int - main () - { diff --git a/patches/gcc/4.3.0/800-index_macro.patch b/patches/gcc/4.3.0/800-index_macro.patch deleted file mode 100644 index ec42836..0000000 --- a/patches/gcc/4.3.0/800-index_macro.patch +++ /dev/null @@ -1,27 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_304-index_macro.patch -diff -durN gcc-4.3.0.orig/libstdc++-v3/include/ext/rope gcc-4.3.0/libstdc++-v3/include/ext/rope ---- gcc-4.3.0.orig/libstdc++-v3/include/ext/rope 2008-01-31 19:44:55.000000000 +0100 -+++ gcc-4.3.0/libstdc++-v3/include/ext/rope 2008-06-10 14:45:58.000000000 +0200 -@@ -59,6 +59,9 @@ - #include - #include - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - # ifdef __GC - # define __GC_CONST const - # else -diff -durN gcc-4.3.0.orig/libstdc++-v3/include/ext/ropeimpl.h gcc-4.3.0/libstdc++-v3/include/ext/ropeimpl.h ---- gcc-4.3.0.orig/libstdc++-v3/include/ext/ropeimpl.h 2007-05-04 17:06:46.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/include/ext/ropeimpl.h 2008-06-10 14:45:58.000000000 +0200 -@@ -54,6 +54,9 @@ - #include // For uninitialized_copy_n - #include // For power - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) - - using std::size_t; diff --git a/patches/gcc/4.3.0/825-libmudflap-susv3-legacy.patch b/patches/gcc/4.3.0/825-libmudflap-susv3-legacy.patch deleted file mode 100644 index 6793375..0000000 --- a/patches/gcc/4.3.0/825-libmudflap-susv3-legacy.patch +++ /dev/null @@ -1,49 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_305-libmudflap-susv3-legacy.patch -diff -durN gcc-4.3.0.orig/libmudflap/mf-hooks2.c gcc-4.3.0/libmudflap/mf-hooks2.c ---- gcc-4.3.0.orig/libmudflap/mf-hooks2.c 2005-09-23 23:58:39.000000000 +0200 -+++ gcc-4.3.0/libmudflap/mf-hooks2.c 2008-06-10 14:46:02.000000000 +0200 -@@ -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 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/patches/gcc/4.3.0/850-libstdc++-namespace.patch b/patches/gcc/4.3.0/850-libstdc++-namespace.patch deleted file mode 100644 index 532b50f..0000000 --- a/patches/gcc/4.3.0/850-libstdc++-namespace.patch +++ /dev/null @@ -1,38 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_306-libstdc++-namespace.patch -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 -diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:45:50.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:46:05.000000000 +0200 -@@ -32,7 +32,8 @@ - // - - // Written by Benjamin Kosnik -- -+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 -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:45:50.000000000 +0200 -+++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:46:05.000000000 +0200 -@@ -33,7 +33,8 @@ - // - - // Written by Benjamin Kosnik -- -+namespace std -+{ - template - __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/patches/gcc/4.3.0/875-arm-softfloat.patch b/patches/gcc/4.3.0/875-arm-softfloat.patch deleted file mode 100644 index 4e7ea7c..0000000 --- a/patches/gcc/4.3.0/875-arm-softfloat.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff -durN gcc-4.3.1.orig/gcc/config/arm/linux-elf.h gcc-4.3.1/gcc/config/arm/linux-elf.h ---- gcc-4.3.1.orig/gcc/config/arm/linux-elf.h 2007-11-08 14:44:09.000000000 +0100 -+++ gcc-4.3.1/gcc/config/arm/linux-elf.h 2008-07-23 15:30:57.000000000 +0200 -@@ -60,7 +60,7 @@ - %{shared:-lc} \ - %{!shared:%{profile:-lc_p}%{!profile:-lc}}" - --#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" -+#define LIBGCC_SPEC "-lgcc" - - #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" - -diff -durN gcc-4.3.1.orig/gcc/config/arm/t-linux gcc-4.3.1/gcc/config/arm/t-linux ---- gcc-4.3.1.orig/gcc/config/arm/t-linux 2006-11-09 23:14:27.000000000 +0100 -+++ gcc-4.3.1/gcc/config/arm/t-linux 2008-07-23 19:15:25.000000000 +0200 -@@ -3,7 +3,12 @@ - TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC - - LIB1ASMSRC = arm/lib1funcs.asm --LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx -+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func \ -+ _call_via_rX _interwork_call_via_rX \ -+ _lshrdi3 _ashrdi3 _ashldi3 \ -+ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ -+ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ -+ _fixsfsi _fixunssfsi _floatdidf _floatdisf _floatundidf _floatundisf - - # MULTILIB_OPTIONS = mhard-float/msoft-float - # MULTILIB_DIRNAMES = hard-float soft-float diff --git a/patches/gcc/4.3.0/940-alpha-signal_h.patch b/patches/gcc/4.3.0/940-alpha-signal_h.patch deleted file mode 100644 index d7e1796..0000000 --- a/patches/gcc/4.3.0/940-alpha-signal_h.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- gcc-4.2.1-stock/gcc/config/alpha/linux-unwind.h 2005-06-24 20:22:41.000000000 -0500 -+++ gcc-4.2.1/gcc/config/alpha/linux-unwind.h 2007-09-01 20:21:34.000000000 -0500 -@@ -29,6 +29,9 @@ Boston, MA 02110-1301, USA. */ - /* Do code reading to identify a signal frame, and set the frame - state data appropriately. See unwind-dw2.c for the structs. */ - -+/* Don't use this if inhibit_libc is set -+ The build for this target will fail trying to include missing headers */ -+#ifndef inhibit_libc - #include - #include - -@@ -80,3 +83,4 @@ alpha_fallback_frame_state (struct _Unwi - fs->retaddr_column = 64; - return _URC_NO_REASON; - } -+#endif /* inhibit_libc */ diff --git a/patches/gcc/4.3.1/110-trampolinewarn.patch b/patches/gcc/4.3.1/110-trampolinewarn.patch new file mode 100644 index 0000000..7dcfe4d --- /dev/null +++ b/patches/gcc/4.3.1/110-trampolinewarn.patch @@ -0,0 +1,35 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/00_all_gcc-trampolinewarn.patch + This trivial patch causes gcc to emit a warning whenever + it generates a trampoline. These are otherwise hard to + locate. It is rigged to default ON - to have it default + to OFF remove the text 'Init(1)' from the common.opt + patch, leaving just 'Common Var(warn_trampolines)'. + Kevin F. Quinn 17 Jan 2006 + +diff -durN gcc-4.3.1.orig/gcc/builtins.c gcc-4.3.1/gcc/builtins.c +--- gcc-4.3.1.orig/gcc/builtins.c 2008-04-23 00:36:27.000000000 +0200 ++++ gcc-4.3.1/gcc/builtins.c 2008-06-10 14:56:54.000000000 +0200 +@@ -5662,6 +5662,9 @@ + trampolines_created = 1; + INITIALIZE_TRAMPOLINE (r_tramp, r_func, r_chain); + ++ if (warn_trampolines) ++ warning (OPT_Wtrampolines, "generating trampoline in object (requires executable stack)"); ++ + return const0_rtx; + } + +diff -durN gcc-4.3.1.orig/gcc/common.opt gcc-4.3.1/gcc/common.opt +--- gcc-4.3.1.orig/gcc/common.opt 2008-01-22 15:11:44.000000000 +0100 ++++ gcc-4.3.1/gcc/common.opt 2008-06-10 14:56:54.000000000 +0200 +@@ -182,6 +182,10 @@ + Common Var(warn_system_headers) Warning + Do not suppress warnings from system headers + ++Wtrampolines ++Common Var(warn_trampolines) Init(1) ++Warn whenever a trampoline is generated ++ + Wuninitialized + Common Var(warn_uninitialized) Warning + Warn about uninitialized automatic variables diff --git a/patches/gcc/4.3.1/120-java-nomulti.patch b/patches/gcc/4.3.1/120-java-nomulti.patch new file mode 100644 index 0000000..ad43ce4 --- /dev/null +++ b/patches/gcc/4.3.1/120-java-nomulti.patch @@ -0,0 +1,47 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/03_all_gcc43-java-nomulti.patch +diff -durN gcc-4.3.1.orig/libjava/configure gcc-4.3.1/libjava/configure +--- gcc-4.3.1.orig/libjava/configure 2008-06-06 16:49:11.000000000 +0200 ++++ gcc-4.3.1/libjava/configure 2008-06-10 14:57:38.000000000 +0200 +@@ -1018,6 +1018,8 @@ + --enable-gconf-peer compile GConf native peers for util.preferences + --enable-java-maintainer-mode + allow rebuilding of .class and .h files ++ --enable-libjava-multilib ++ build libjava as multilib + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-maintainer-mode enable make rules and dependencies not useful +@@ -1850,6 +1852,16 @@ + fi + + ++# Check whether --enable-libjava-multilib was given. ++if test "${enable_libjava_multilib+set}" = set; then ++ enableval=$enable_libjava_multilib; ++fi ++ ++if test "$enable_libjava_multilib" = no; then ++ multilib=no ++ ac_configure_args="$ac_configure_args --disable-multilib" ++fi ++ + # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX. + + +diff -durN gcc-4.3.1.orig/libjava/configure.ac gcc-4.3.1/libjava/configure.ac +--- gcc-4.3.1.orig/libjava/configure.ac 2007-12-22 16:48:46.000000000 +0100 ++++ gcc-4.3.1/libjava/configure.ac 2008-06-10 14:57:38.000000000 +0200 +@@ -82,6 +82,13 @@ + [allow rebuilding of .class and .h files])) + AM_CONDITIONAL(JAVA_MAINTAINER_MODE, test "$enable_java_maintainer_mode" = yes) + ++AC_ARG_ENABLE(libjava-multilib, ++ AS_HELP_STRING([--enable-libjava-multilib], [build libjava as multilib])) ++if test "$enable_libjava_multilib" = no; then ++ multilib=no ++ ac_configure_args="$ac_configure_args --disable-multilib" ++fi ++ + # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX. + GCC_NO_EXECUTABLES + diff --git a/patches/gcc/4.3.1/125-trampolinewarn.patch b/patches/gcc/4.3.1/125-trampolinewarn.patch deleted file mode 100644 index 7dcfe4d..0000000 --- a/patches/gcc/4.3.1/125-trampolinewarn.patch +++ /dev/null @@ -1,35 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/00_all_gcc-trampolinewarn.patch - This trivial patch causes gcc to emit a warning whenever - it generates a trampoline. These are otherwise hard to - locate. It is rigged to default ON - to have it default - to OFF remove the text 'Init(1)' from the common.opt - patch, leaving just 'Common Var(warn_trampolines)'. - Kevin F. Quinn 17 Jan 2006 - -diff -durN gcc-4.3.1.orig/gcc/builtins.c gcc-4.3.1/gcc/builtins.c ---- gcc-4.3.1.orig/gcc/builtins.c 2008-04-23 00:36:27.000000000 +0200 -+++ gcc-4.3.1/gcc/builtins.c 2008-06-10 14:56:54.000000000 +0200 -@@ -5662,6 +5662,9 @@ - trampolines_created = 1; - INITIALIZE_TRAMPOLINE (r_tramp, r_func, r_chain); - -+ if (warn_trampolines) -+ warning (OPT_Wtrampolines, "generating trampoline in object (requires executable stack)"); -+ - return const0_rtx; - } - -diff -durN gcc-4.3.1.orig/gcc/common.opt gcc-4.3.1/gcc/common.opt ---- gcc-4.3.1.orig/gcc/common.opt 2008-01-22 15:11:44.000000000 +0100 -+++ gcc-4.3.1/gcc/common.opt 2008-06-10 14:56:54.000000000 +0200 -@@ -182,6 +182,10 @@ - Common Var(warn_system_headers) Warning - Do not suppress warnings from system headers - -+Wtrampolines -+Common Var(warn_trampolines) Init(1) -+Warn whenever a trampoline is generated -+ - Wuninitialized - Common Var(warn_uninitialized) Warning - Warn about uninitialized automatic variables diff --git a/patches/gcc/4.3.1/130-cross-compile.patch b/patches/gcc/4.3.1/130-cross-compile.patch new file mode 100644 index 0000000..b6710a3 --- /dev/null +++ b/patches/gcc/4.3.1/130-cross-compile.patch @@ -0,0 +1,44 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/08_all_gcc-4.1-cross-compile.patch +Some notes on the 'bootstrap with or without libc headers' debate: +http://linuxfromscratch.org/pipermail/lfs-dev/2005-July/052409.html +http://gcc.gnu.org/ml/gcc/2005-07/msg01195.html + +diff -durN gcc-4.3.1.orig/gcc/configure gcc-4.3.1/gcc/configure +--- gcc-4.3.1.orig/gcc/configure 2008-05-21 10:54:15.000000000 +0200 ++++ gcc-4.3.1/gcc/configure 2008-06-10 14:57:42.000000000 +0200 +@@ -13283,7 +13283,7 @@ + | powerpc*-*-*,powerpc64*-*-*) + CROSS="$CROSS -DNATIVE_CROSS" ;; + esac +-elif test "x$TARGET_SYSTEM_ROOT" != x; then ++elif test "x$TARGET_SYSTEM_ROOT" != x -o $build != $host; then + SYSTEM_HEADER_DIR=$build_system_header_dir + fi + +diff -durN gcc-4.3.1.orig/gcc/configure.ac gcc-4.3.1/gcc/configure.ac +--- gcc-4.3.1.orig/gcc/configure.ac 2008-05-21 10:54:15.000000000 +0200 ++++ gcc-4.3.1/gcc/configure.ac 2008-06-10 14:57:42.000000000 +0200 +@@ -1749,7 +1749,7 @@ + | powerpc*-*-*,powerpc64*-*-*) + CROSS="$CROSS -DNATIVE_CROSS" ;; + esac +-elif test "x$TARGET_SYSTEM_ROOT" != x; then ++elif test "x$TARGET_SYSTEM_ROOT" != x -o $build != $host; then + SYSTEM_HEADER_DIR=$build_system_header_dir + fi + +diff -durN gcc-4.3.1.orig/gcc/unwind-dw2.c gcc-4.3.1/gcc/unwind-dw2.c +--- gcc-4.3.1.orig/gcc/unwind-dw2.c 2007-07-25 20:14:57.000000000 +0200 ++++ gcc-4.3.1/gcc/unwind-dw2.c 2008-06-10 14:57:42.000000000 +0200 +@@ -334,9 +334,11 @@ + } + #endif + ++#ifndef inhibit_libc + #ifdef MD_UNWIND_SUPPORT + #include MD_UNWIND_SUPPORT + #endif ++#endif + + /* Extract any interesting information from the CIE for the translation + unit F belongs to. Return a pointer to the byte after the augmentation, diff --git a/patches/gcc/4.3.1/140-netbsd-symbolic.patch b/patches/gcc/4.3.1/140-netbsd-symbolic.patch new file mode 100644 index 0000000..d06a04a --- /dev/null +++ b/patches/gcc/4.3.1/140-netbsd-symbolic.patch @@ -0,0 +1,14 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/11_all_gcc-netbsd-symbolic.patch +http://bugs.gentoo.org/122698 + +diff -durN gcc-4.3.1.orig/gcc/config/netbsd-elf.h gcc-4.3.1/gcc/config/netbsd-elf.h +--- gcc-4.3.1.orig/gcc/config/netbsd-elf.h 2007-09-03 18:14:04.000000000 +0200 ++++ gcc-4.3.1/gcc/config/netbsd-elf.h 2008-06-10 14:57:48.000000000 +0200 +@@ -82,6 +82,7 @@ + #define NETBSD_LINK_SPEC_ELF \ + "%{assert*} %{R*} %{rpath*} \ + %{shared:-shared} \ ++ %{symbolic:-Bsymbolic} \ + %{!shared: \ + -dc -dp \ + %{!nostdlib: \ diff --git a/patches/gcc/4.3.1/150-java-nomulti.patch b/patches/gcc/4.3.1/150-java-nomulti.patch deleted file mode 100644 index ad43ce4..0000000 --- a/patches/gcc/4.3.1/150-java-nomulti.patch +++ /dev/null @@ -1,47 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/03_all_gcc43-java-nomulti.patch -diff -durN gcc-4.3.1.orig/libjava/configure gcc-4.3.1/libjava/configure ---- gcc-4.3.1.orig/libjava/configure 2008-06-06 16:49:11.000000000 +0200 -+++ gcc-4.3.1/libjava/configure 2008-06-10 14:57:38.000000000 +0200 -@@ -1018,6 +1018,8 @@ - --enable-gconf-peer compile GConf native peers for util.preferences - --enable-java-maintainer-mode - allow rebuilding of .class and .h files -+ --enable-libjava-multilib -+ build libjava as multilib - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - --enable-maintainer-mode enable make rules and dependencies not useful -@@ -1850,6 +1852,16 @@ - fi - - -+# Check whether --enable-libjava-multilib was given. -+if test "${enable_libjava_multilib+set}" = set; then -+ enableval=$enable_libjava_multilib; -+fi -+ -+if test "$enable_libjava_multilib" = no; then -+ multilib=no -+ ac_configure_args="$ac_configure_args --disable-multilib" -+fi -+ - # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX. - - -diff -durN gcc-4.3.1.orig/libjava/configure.ac gcc-4.3.1/libjava/configure.ac ---- gcc-4.3.1.orig/libjava/configure.ac 2007-12-22 16:48:46.000000000 +0100 -+++ gcc-4.3.1/libjava/configure.ac 2008-06-10 14:57:38.000000000 +0200 -@@ -82,6 +82,13 @@ - [allow rebuilding of .class and .h files])) - AM_CONDITIONAL(JAVA_MAINTAINER_MODE, test "$enable_java_maintainer_mode" = yes) - -+AC_ARG_ENABLE(libjava-multilib, -+ AS_HELP_STRING([--enable-libjava-multilib], [build libjava as multilib])) -+if test "$enable_libjava_multilib" = no; then -+ multilib=no -+ ac_configure_args="$ac_configure_args --disable-multilib" -+fi -+ - # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX. - GCC_NO_EXECUTABLES - diff --git a/patches/gcc/4.3.1/150-sparc64-bsd.patch b/patches/gcc/4.3.1/150-sparc64-bsd.patch new file mode 100644 index 0000000..5ac2b43 --- /dev/null +++ b/patches/gcc/4.3.1/150-sparc64-bsd.patch @@ -0,0 +1,30 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/14_all_gcc-sparc64-bsd.patch +diff -durN gcc-4.3.1.orig/gcc/config/sparc/freebsd.h gcc-4.3.1/gcc/config/sparc/freebsd.h +--- gcc-4.3.1.orig/gcc/config/sparc/freebsd.h 2007-08-02 12:49:31.000000000 +0200 ++++ gcc-4.3.1/gcc/config/sparc/freebsd.h 2008-06-10 14:57:54.000000000 +0200 +@@ -25,9 +25,22 @@ + /* FreeBSD needs the platform name (sparc64) defined. + Emacs needs to know if the arch is 64 or 32-bits. */ + +-#undef CPP_CPU64_DEFAULT_SPEC +-#define CPP_CPU64_DEFAULT_SPEC \ +- "-D__sparc64__ -D__sparc_v9__ -D__sparcv9 -D__arch64__" ++#undef FBSD_TARGET_CPU_CPP_BUILTINS ++#define FBSD_TARGET_CPU_CPP_BUILTINS() \ ++ do \ ++ { \ ++ if (TARGET_ARCH64) \ ++ { \ ++ builtin_define ("__sparc64__"); \ ++ builtin_define ("__sparc_v9__"); \ ++ builtin_define ("__sparcv9"); \ ++ } \ ++ else \ ++ builtin_define ("__sparc"); \ ++ builtin_define ("__sparc__"); \ ++ } \ ++ while (0) ++ + + #define LINK_SPEC "%(link_arch) \ + %{!mno-relax:%{!r:-relax}} \ diff --git a/patches/gcc/4.3.1/160-flatten-switch-stmt-00.patch b/patches/gcc/4.3.1/160-flatten-switch-stmt-00.patch new file mode 100644 index 0000000..55cafcb --- /dev/null +++ b/patches/gcc/4.3.1/160-flatten-switch-stmt-00.patch @@ -0,0 +1,76 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/18_all_904-flatten-switch-stmt-00.patch +http://gcc.gnu.org/ml/gcc-patches/2007-04/msg00927.html + +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" + +diff -durN gcc-4.3.1.orig/gcc/stmt.c gcc-4.3.1/gcc/stmt.c +--- gcc-4.3.1.orig/gcc/stmt.c 2008-05-09 20:12:13.000000000 +0200 ++++ gcc-4.3.1/gcc/stmt.c 2008-06-10 14:57:58.000000000 +0200 +@@ -2509,7 +2509,11 @@ + 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); + } +@@ -3067,6 +3071,7 @@ + { + 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, diff --git a/patches/gcc/4.3.1/170-libiberty-pic.patch b/patches/gcc/4.3.1/170-libiberty-pic.patch new file mode 100644 index 0000000..0b1e6b4 --- /dev/null +++ b/patches/gcc/4.3.1/170-libiberty-pic.patch @@ -0,0 +1,12 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/51_all_gcc-3.4-libiberty-pic.patch +diff -durN gcc-4.3.1.orig/libiberty/Makefile.in gcc-4.3.1/libiberty/Makefile.in +--- gcc-4.3.1.orig/libiberty/Makefile.in 2007-07-25 08:26:45.000000000 +0200 ++++ gcc-4.3.1/libiberty/Makefile.in 2008-06-10 14:58:02.000000000 +0200 +@@ -225,6 +225,7 @@ + $(AR) $(AR_FLAGS) $(TARGETLIB) \ + $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \ + $(RANLIB) $(TARGETLIB); \ ++ cp $(TARGETLIB) ../ ; \ + cd ..; \ + else true; fi + diff --git a/patches/gcc/4.3.1/175-cross-compile.patch b/patches/gcc/4.3.1/175-cross-compile.patch deleted file mode 100644 index b6710a3..0000000 --- a/patches/gcc/4.3.1/175-cross-compile.patch +++ /dev/null @@ -1,44 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/08_all_gcc-4.1-cross-compile.patch -Some notes on the 'bootstrap with or without libc headers' debate: -http://linuxfromscratch.org/pipermail/lfs-dev/2005-July/052409.html -http://gcc.gnu.org/ml/gcc/2005-07/msg01195.html - -diff -durN gcc-4.3.1.orig/gcc/configure gcc-4.3.1/gcc/configure ---- gcc-4.3.1.orig/gcc/configure 2008-05-21 10:54:15.000000000 +0200 -+++ gcc-4.3.1/gcc/configure 2008-06-10 14:57:42.000000000 +0200 -@@ -13283,7 +13283,7 @@ - | powerpc*-*-*,powerpc64*-*-*) - CROSS="$CROSS -DNATIVE_CROSS" ;; - esac --elif test "x$TARGET_SYSTEM_ROOT" != x; then -+elif test "x$TARGET_SYSTEM_ROOT" != x -o $build != $host; then - SYSTEM_HEADER_DIR=$build_system_header_dir - fi - -diff -durN gcc-4.3.1.orig/gcc/configure.ac gcc-4.3.1/gcc/configure.ac ---- gcc-4.3.1.orig/gcc/configure.ac 2008-05-21 10:54:15.000000000 +0200 -+++ gcc-4.3.1/gcc/configure.ac 2008-06-10 14:57:42.000000000 +0200 -@@ -1749,7 +1749,7 @@ - | powerpc*-*-*,powerpc64*-*-*) - CROSS="$CROSS -DNATIVE_CROSS" ;; - esac --elif test "x$TARGET_SYSTEM_ROOT" != x; then -+elif test "x$TARGET_SYSTEM_ROOT" != x -o $build != $host; then - SYSTEM_HEADER_DIR=$build_system_header_dir - fi - -diff -durN gcc-4.3.1.orig/gcc/unwind-dw2.c gcc-4.3.1/gcc/unwind-dw2.c ---- gcc-4.3.1.orig/gcc/unwind-dw2.c 2007-07-25 20:14:57.000000000 +0200 -+++ gcc-4.3.1/gcc/unwind-dw2.c 2008-06-10 14:57:42.000000000 +0200 -@@ -334,9 +334,11 @@ - } - #endif - -+#ifndef inhibit_libc - #ifdef MD_UNWIND_SUPPORT - #include MD_UNWIND_SUPPORT - #endif -+#endif - - /* Extract any interesting information from the CIE for the translation - unit F belongs to. Return a pointer to the byte after the augmentation, diff --git a/patches/gcc/4.3.1/180-superh-default-multilib.patch b/patches/gcc/4.3.1/180-superh-default-multilib.patch new file mode 100644 index 0000000..bc24221 --- /dev/null +++ b/patches/gcc/4.3.1/180-superh-default-multilib.patch @@ -0,0 +1,25 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/53_all_gcc4-superh-default-multilib.patch +The gcc-3.x toolchains would contain all the targets by default. With gcc-4, +you have to actually list out the multilibs you want or you will end up with +just one when using targets like 'sh4-linux-gnu'. + +The resulting toolchain can't even build a kernel as the kernel needs to build +with the nofpu flag to be sure that no fpu ops are generated. + +Here we restore the gcc-3.x behavior; the additional overhead of building all +of these multilibs by default is negligible. + +http://bugs.gentoo.org/140205 + +diff -durN gcc-4.3.1.orig/gcc/config.gcc gcc-4.3.1/gcc/config.gcc +--- gcc-4.3.1.orig/gcc/config.gcc 2008-05-21 10:54:15.000000000 +0200 ++++ gcc-4.3.1/gcc/config.gcc 2008-06-10 14:58:06.000000000 +0200 +@@ -2278,7 +2278,7 @@ + if test x${sh_multilibs} = x ; then + case ${target} in + sh64-superh-linux* | \ +- sh[1234]*) sh_multilibs=${sh_cpu_target} ;; ++ sh[1234]*) sh_multilibs=`cd ${srcdir}/config/sh ; echo t-mlib-sh[1-4]* | sed 's:t-mlib-sh:,m:g;s: ::g'` ;; + sh64* | sh5*) sh_multilibs=m5-32media,m5-32media-nofpu,m5-compact,m5-compact-nofpu,m5-64media,m5-64media-nofpu ;; + sh-superh-*) sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;; + sh*-*-linux*) sh_multilibs=m1,m3e,m4 ;; diff --git a/patches/gcc/4.3.1/190-libstdc++-pic.patch b/patches/gcc/4.3.1/190-libstdc++-pic.patch new file mode 100644 index 0000000..61cab19 --- /dev/null +++ b/patches/gcc/4.3.1/190-libstdc++-pic.patch @@ -0,0 +1,56 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/54_all_300-libstdc++-pic.patch +install libstdc++_pic.a if we have pic objs + +diff -durN gcc-4.3.1.orig/libstdc++-v3/src/Makefile.am gcc-4.3.1/libstdc++-v3/src/Makefile.am +--- gcc-4.3.1.orig/libstdc++-v3/src/Makefile.am 2008-02-29 19:26:50.000000000 +0100 ++++ gcc-4.3.1/libstdc++-v3/src/Makefile.am 2008-06-10 14:58:09.000000000 +0200 +@@ -289,6 +289,13 @@ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ + + ++install-exec-local: ++ pic_objs=`sed -n "s:'::g;s:^pic_object=::p" *.lo | grep -v '^none$$'`; \ ++ if [ x"$$pic_objs" != x ]; then \ ++ $(AR) cru libstdc++_pic.a $$pic_objs $(top_builddir)/libsupc++/*.o || exit 1; \ ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) || exit 1; \ ++ fi ++ + # Added bits to build debug library. + if GLIBCXX_BUILD_DEBUG + all-local: build_debug +diff -durN gcc-4.3.1.orig/libstdc++-v3/src/Makefile.in gcc-4.3.1/libstdc++-v3/src/Makefile.in +--- gcc-4.3.1.orig/libstdc++-v3/src/Makefile.in 2008-02-29 19:26:50.000000000 +0100 ++++ gcc-4.3.1/libstdc++-v3/src/Makefile.in 2008-06-10 14:58:09.000000000 +0200 +@@ -693,7 +693,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 + +@@ -732,7 +732,7 @@ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ +- uninstall-toolexeclibLTLIBRARIES ++ uninstall-toolexeclibLTLIBRARIES install-exec-local + + + # Symbol versioning for shared libraries. +@@ -858,6 +858,14 @@ + install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ++ ++install-exec-local: ++ pic_objs=`sed -n "s:'::g;s:^pic_object=::p" *.lo | grep -v '^none$$'`; \ ++ if [ x"$$pic_objs" != x ]; then \ ++ $(AR) cru libstdc++_pic.a $$pic_objs $(top_builddir)/libsupc++/*.o || exit 1; \ ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) || exit 1; \ ++ fi ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff --git a/patches/gcc/4.3.1/200-netbsd-symbolic.patch b/patches/gcc/4.3.1/200-netbsd-symbolic.patch deleted file mode 100644 index d06a04a..0000000 --- a/patches/gcc/4.3.1/200-netbsd-symbolic.patch +++ /dev/null @@ -1,14 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/11_all_gcc-netbsd-symbolic.patch -http://bugs.gentoo.org/122698 - -diff -durN gcc-4.3.1.orig/gcc/config/netbsd-elf.h gcc-4.3.1/gcc/config/netbsd-elf.h ---- gcc-4.3.1.orig/gcc/config/netbsd-elf.h 2007-09-03 18:14:04.000000000 +0200 -+++ gcc-4.3.1/gcc/config/netbsd-elf.h 2008-06-10 14:57:48.000000000 +0200 -@@ -82,6 +82,7 @@ - #define NETBSD_LINK_SPEC_ELF \ - "%{assert*} %{R*} %{rpath*} \ - %{shared:-shared} \ -+ %{symbolic:-Bsymbolic} \ - %{!shared: \ - -dc -dp \ - %{!nostdlib: \ diff --git a/patches/gcc/4.3.1/200-pr24170.patch b/patches/gcc/4.3.1/200-pr24170.patch new file mode 100644 index 0000000..cd13698 --- /dev/null +++ b/patches/gcc/4.3.1/200-pr24170.patch @@ -0,0 +1,61 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/61_all_gcc43-pr24170.patch +http://gcc.gnu.org/PR24170 + +2008-02-20 Tom Tromey + + PR libgcj/24170: + * java/io/natFilePosix.cc (File::performList): Don't use + readdir_r. + * configure, include/config.h.in: Rebuilt. + * configure.ac: Don't check for readdir_r. + +diff -durN gcc-4.3.1.orig/libjava/configure.ac gcc-4.3.1/libjava/configure.ac +--- gcc-4.3.1.orig/libjava/configure.ac 2008-06-10 14:57:42.000000000 +0200 ++++ gcc-4.3.1/libjava/configure.ac 2008-06-10 14:58:13.000000000 +0200 +@@ -1030,7 +1030,7 @@ + PLATFORMNET=NoNet + else + AC_CHECK_FUNCS([strerror_r select fstat open fsync sleep opendir \ +- localtime_r readdir_r getpwuid_r getcwd \ ++ localtime_r getpwuid_r getcwd \ + access stat lstat mkdir rename rmdir unlink utime chmod readlink \ + nl_langinfo setlocale \ + inet_pton uname inet_ntoa \ +diff -durN gcc-4.3.1.orig/libjava/include/config.h.in gcc-4.3.1/libjava/include/config.h.in +--- gcc-4.3.1.orig/libjava/include/config.h.in 2007-07-31 18:17:21.000000000 +0200 ++++ gcc-4.3.1/libjava/include/config.h.in 2008-06-10 14:58:13.000000000 +0200 +@@ -214,9 +214,6 @@ + /* Define to 1 if you have the header file. */ + #undef HAVE_PWD_H + +-/* Define to 1 if you have the `readdir_r' function. */ +-#undef HAVE_READDIR_R +- + /* Define to 1 if you have the `readlink' function. */ + #undef HAVE_READLINK + +diff -durN gcc-4.3.1.orig/libjava/java/io/natFilePosix.cc gcc-4.3.1/libjava/java/io/natFilePosix.cc +--- gcc-4.3.1.orig/libjava/java/io/natFilePosix.cc 2007-08-04 23:50:01.000000000 +0200 ++++ gcc-4.3.1/libjava/java/io/natFilePosix.cc 2008-06-10 14:58:13.000000000 +0200 +@@ -1,6 +1,6 @@ + // natFile.cc - Native part of File class for POSIX. + +-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2006 ++/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2008 + Free Software Foundation + + This file is part of libgcj. +@@ -292,13 +292,7 @@ + + java::util::ArrayList *list = new java::util::ArrayList (); + struct dirent *d; +-#if defined(HAVE_READDIR_R) && defined(_POSIX_PTHREAD_SEMANTICS) +- int name_max = pathconf (buf, _PC_NAME_MAX); +- char dbuf[sizeof (struct dirent) + name_max + 1]; +- while (readdir_r (dir, (struct dirent *) dbuf, &d) == 0 && d != NULL) +-#else /* HAVE_READDIR_R */ + while ((d = readdir (dir)) != NULL) +-#endif /* HAVE_READDIR_R */ + { + // Omit "." and "..". + if (d->d_name[0] == '.' diff --git a/patches/gcc/4.3.1/210-noteGNUstack-00.patch b/patches/gcc/4.3.1/210-noteGNUstack-00.patch new file mode 100644 index 0000000..d656661 --- /dev/null +++ b/patches/gcc/4.3.1/210-noteGNUstack-00.patch @@ -0,0 +1,96 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/61_all_gcc4-ia64-noteGNUstack.patch +2004-09-20 Jakub Jelinek + + * config/rs6000/ppc-asm.h: Add .note.GNU-stack section also + on ppc64-linux. + + * config/ia64/lib1funcs.asm: Add .note.GNU-stack section on + ia64-linux. + * config/ia64/crtbegin.asm: Likewise. + * config/ia64/crtend.asm: Likewise. + * config/ia64/crti.asm: Likewise. + * config/ia64/crtn.asm: Likewise. + +2004-05-14 Jakub Jelinek + + * config/ia64/linux.h (TARGET_ASM_FILE_END): Define. + +diff -durN gcc-4.3.1.orig/gcc/config/ia64/crtbegin.asm gcc-4.3.1/gcc/config/ia64/crtbegin.asm +--- gcc-4.3.1.orig/gcc/config/ia64/crtbegin.asm 2005-09-27 02:52:24.000000000 +0200 ++++ gcc-4.3.1/gcc/config/ia64/crtbegin.asm 2008-06-10 14:58:17.000000000 +0200 +@@ -255,3 +255,7 @@ + .weak __cxa_finalize + #endif + .weak _Jv_RegisterClasses ++ ++#ifdef __linux__ ++.section .note.GNU-stack; .previous ++#endif +diff -durN gcc-4.3.1.orig/gcc/config/ia64/crtend.asm gcc-4.3.1/gcc/config/ia64/crtend.asm +--- gcc-4.3.1.orig/gcc/config/ia64/crtend.asm 2005-09-27 02:52:24.000000000 +0200 ++++ gcc-4.3.1/gcc/config/ia64/crtend.asm 2008-06-10 14:58:17.000000000 +0200 +@@ -122,3 +122,7 @@ + + br.ret.sptk.many rp + .endp __do_global_ctors_aux ++ ++#ifdef __linux__ ++.section .note.GNU-stack; .previous ++#endif +diff -durN gcc-4.3.1.orig/gcc/config/ia64/crti.asm gcc-4.3.1/gcc/config/ia64/crti.asm +--- gcc-4.3.1.orig/gcc/config/ia64/crti.asm 2005-06-25 03:22:41.000000000 +0200 ++++ gcc-4.3.1/gcc/config/ia64/crti.asm 2008-06-10 14:58:17.000000000 +0200 +@@ -64,3 +64,7 @@ + .body + + # end of crti.asm ++ ++#ifdef __linux__ ++.section .note.GNU-stack; .previous ++#endif +diff -durN gcc-4.3.1.orig/gcc/config/ia64/crtn.asm gcc-4.3.1/gcc/config/ia64/crtn.asm +--- gcc-4.3.1.orig/gcc/config/ia64/crtn.asm 2005-06-25 03:22:41.000000000 +0200 ++++ gcc-4.3.1/gcc/config/ia64/crtn.asm 2008-06-10 14:58:17.000000000 +0200 +@@ -54,3 +54,7 @@ + br.ret.sptk.many b0 + + # end of crtn.asm ++ ++#ifdef __linux__ ++.section .note.GNU-stack; .previous ++#endif +diff -durN gcc-4.3.1.orig/gcc/config/ia64/lib1funcs.asm gcc-4.3.1/gcc/config/ia64/lib1funcs.asm +--- gcc-4.3.1.orig/gcc/config/ia64/lib1funcs.asm 2005-09-27 02:52:24.000000000 +0200 ++++ gcc-4.3.1/gcc/config/ia64/lib1funcs.asm 2008-06-10 14:58:17.000000000 +0200 +@@ -792,3 +792,7 @@ + } + .endp __floattitf + #endif ++ ++#ifdef __linux__ ++.section .note.GNU-stack; .previous ++#endif +diff -durN gcc-4.3.1.orig/gcc/config/ia64/linux.h gcc-4.3.1/gcc/config/ia64/linux.h +--- gcc-4.3.1.orig/gcc/config/ia64/linux.h 2006-12-12 16:15:19.000000000 +0100 ++++ gcc-4.3.1/gcc/config/ia64/linux.h 2008-06-10 14:58:17.000000000 +0200 +@@ -5,6 +5,8 @@ + + #define TARGET_VERSION fprintf (stderr, " (IA-64) Linux"); + ++#define TARGET_ASM_FILE_END file_end_indicate_exec_stack ++ + /* This is for -profile to use -lc_p instead of -lc. */ + #undef CC1_SPEC + #define CC1_SPEC "%{profile:-p} %{G*}" +diff -durN gcc-4.3.1.orig/gcc/config/rs6000/ppc-asm.h gcc-4.3.1/gcc/config/rs6000/ppc-asm.h +--- gcc-4.3.1.orig/gcc/config/rs6000/ppc-asm.h 2003-06-04 18:44:51.000000000 +0200 ++++ gcc-4.3.1/gcc/config/rs6000/ppc-asm.h 2008-06-10 14:58:17.000000000 +0200 +@@ -158,7 +158,7 @@ + .size FUNC_NAME(name),GLUE(.L,name)-FUNC_NAME(name) + #endif + +-#if defined __linux__ && !defined __powerpc64__ ++#if defined __linux__ + .section .note.GNU-stack + .previous + #endif diff --git a/patches/gcc/4.3.1/220-noteGNUstack-01.patch b/patches/gcc/4.3.1/220-noteGNUstack-01.patch new file mode 100644 index 0000000..a74e5e8 --- /dev/null +++ b/patches/gcc/4.3.1/220-noteGNUstack-01.patch @@ -0,0 +1,198 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/62_all_gcc4-noteGNUstack.patch +2005-02-08 Jakub Jelinek + + * src/alpha/osf.S: Add .note.GNU-stack on Linux. + * src/s390/sysv.S: Likewise. + * src/powerpc/linux64.S: Likewise. + * src/powerpc/linux64_closure.S: Likewise. + * src/powerpc/ppc_closure.S: Likewise. + * src/powerpc/sysv.S: Likewise. + * src/x86/unix64.S: Likewise. + * src/x86/sysv.S: Likewise. + * src/sparc/v8.S: Likewise. + * src/sparc/v9.S: Likewise. + * src/m68k/sysv.S: Likewise. + * src/ia64/unix.S: Likewise. + * src/arm/sysv.S: Likewise. + + * ia64_save_regs_in_stack.s: Moved to... + * ia64_save_regs_in_stack.S: ... this. Add .note.GNU-stack + on Linux. + +diff -durN gcc-4.3.1.orig/boehm-gc/ia64_save_regs_in_stack.S gcc-4.3.1/boehm-gc/ia64_save_regs_in_stack.S +--- gcc-4.3.1.orig/boehm-gc/ia64_save_regs_in_stack.S 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.1/boehm-gc/ia64_save_regs_in_stack.S 2008-06-10 14:58:21.000000000 +0200 +@@ -0,0 +1,15 @@ ++ .text ++ .align 16 ++ .global GC_save_regs_in_stack ++ .proc GC_save_regs_in_stack ++GC_save_regs_in_stack: ++ .bodyfoo.mpg ++ flushrs ++ ;; ++ mov r8=ar.bsp ++ br.ret.sptk.few rp ++ .endp GC_save_regs_in_stack ++ ++#ifdef __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.1.orig/boehm-gc/ia64_save_regs_in_stack.s gcc-4.3.1/boehm-gc/ia64_save_regs_in_stack.s +--- gcc-4.3.1.orig/boehm-gc/ia64_save_regs_in_stack.s 2001-10-15 06:57:59.000000000 +0200 ++++ gcc-4.3.1/boehm-gc/ia64_save_regs_in_stack.s 2008-06-10 14:58:21.000000000 +0200 +@@ -1,12 +0,0 @@ +- .text +- .align 16 +- .global GC_save_regs_in_stack +- .proc GC_save_regs_in_stack +-GC_save_regs_in_stack: +- .body +- flushrs +- ;; +- mov r8=ar.bsp +- br.ret.sptk.few rp +- .endp GC_save_regs_in_stack +- +diff -durN gcc-4.3.1.orig/libffi/src/alpha/osf.S gcc-4.3.1/libffi/src/alpha/osf.S +--- gcc-4.3.1.orig/libffi/src/alpha/osf.S 2007-04-06 18:24:16.000000000 +0200 ++++ gcc-4.3.1/libffi/src/alpha/osf.S 2008-06-10 14:58:21.000000000 +0200 +@@ -358,4 +358,8 @@ + .byte 16 # uleb128 offset 16*-8 + .align 3 + $LEFDE3: ++ ++#ifdef __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif + #endif +diff -durN gcc-4.3.1.orig/libffi/src/arm/sysv.S gcc-4.3.1/libffi/src/arm/sysv.S +--- gcc-4.3.1.orig/libffi/src/arm/sysv.S 2007-09-04 19:52:45.000000000 +0200 ++++ gcc-4.3.1/libffi/src/arm/sysv.S 2008-06-10 14:58:21.000000000 +0200 +@@ -293,3 +293,6 @@ + UNWIND .fnend + .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) + ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",%progbits ++#endif +diff -durN gcc-4.3.1.orig/libffi/src/ia64/unix.S gcc-4.3.1/libffi/src/ia64/unix.S +--- gcc-4.3.1.orig/libffi/src/ia64/unix.S 2005-03-30 23:49:19.000000000 +0200 ++++ gcc-4.3.1/libffi/src/ia64/unix.S 2008-06-10 14:58:21.000000000 +0200 +@@ -553,3 +553,7 @@ + data8 @pcrel(.Lld_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT + data8 @pcrel(.Lld_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE + data8 @pcrel(.Lld_hfa_ldouble) // FFI_IA64_TYPE_HFA_LDOUBLE ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.1.orig/libffi/src/m68k/sysv.S gcc-4.3.1/libffi/src/m68k/sysv.S +--- gcc-4.3.1.orig/libffi/src/m68k/sysv.S 2007-05-10 23:29:04.000000000 +0200 ++++ gcc-4.3.1/libffi/src/m68k/sysv.S 2008-06-10 14:58:21.000000000 +0200 +@@ -207,3 +207,7 @@ + rts + CFI_ENDPROC() + .size ffi_closure_struct_SYSV,.-ffi_closure_struct_SYSV ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.1.orig/libffi/src/powerpc/linux64.S gcc-4.3.1/libffi/src/powerpc/linux64.S +--- gcc-4.3.1.orig/libffi/src/powerpc/linux64.S 2007-11-17 00:24:53.000000000 +0100 ++++ gcc-4.3.1/libffi/src/powerpc/linux64.S 2008-06-10 14:58:21.000000000 +0200 +@@ -179,3 +179,7 @@ + .align 3 + .LEFDE1: + #endif ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.1.orig/libffi/src/powerpc/linux64_closure.S gcc-4.3.1/libffi/src/powerpc/linux64_closure.S +--- gcc-4.3.1.orig/libffi/src/powerpc/linux64_closure.S 2005-08-11 23:18:24.000000000 +0200 ++++ gcc-4.3.1/libffi/src/powerpc/linux64_closure.S 2008-06-10 14:58:21.000000000 +0200 +@@ -204,3 +204,7 @@ + .align 3 + .LEFDE1: + #endif ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.1.orig/libffi/src/powerpc/ppc_closure.S gcc-4.3.1/libffi/src/powerpc/ppc_closure.S +--- gcc-4.3.1.orig/libffi/src/powerpc/ppc_closure.S 2007-12-01 22:00:04.000000000 +0100 ++++ gcc-4.3.1/libffi/src/powerpc/ppc_closure.S 2008-06-10 14:58:21.000000000 +0200 +@@ -295,3 +295,7 @@ + .LEFDE1: + + #endif ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.1.orig/libffi/src/powerpc/sysv.S gcc-4.3.1/libffi/src/powerpc/sysv.S +--- gcc-4.3.1.orig/libffi/src/powerpc/sysv.S 2007-12-01 22:00:04.000000000 +0100 ++++ gcc-4.3.1/libffi/src/powerpc/sysv.S 2008-06-10 14:58:21.000000000 +0200 +@@ -223,3 +223,7 @@ + .align 2 + .LEFDE1: + #endif ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.1.orig/libffi/src/s390/sysv.S gcc-4.3.1/libffi/src/s390/sysv.S +--- gcc-4.3.1.orig/libffi/src/s390/sysv.S 2003-10-21 21:01:58.000000000 +0200 ++++ gcc-4.3.1/libffi/src/s390/sysv.S 2008-06-10 14:58:21.000000000 +0200 +@@ -427,3 +427,6 @@ + + #endif + ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.1.orig/libffi/src/sparc/v8.S gcc-4.3.1/libffi/src/sparc/v8.S +--- gcc-4.3.1.orig/libffi/src/sparc/v8.S 2004-11-22 19:35:16.000000000 +0100 ++++ gcc-4.3.1/libffi/src/sparc/v8.S 2008-06-10 14:58:21.000000000 +0200 +@@ -265,3 +265,7 @@ + .byte 0x1f ! uleb128 0x1f + .align WS + .LLEFDE2: ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.1.orig/libffi/src/sparc/v9.S gcc-4.3.1/libffi/src/sparc/v9.S +--- gcc-4.3.1.orig/libffi/src/sparc/v9.S 2004-01-25 07:58:33.000000000 +0100 ++++ gcc-4.3.1/libffi/src/sparc/v9.S 2008-06-10 14:58:21.000000000 +0200 +@@ -300,3 +300,7 @@ + .align 8 + .LLEFDE2: + #endif ++ ++#ifdef __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.1.orig/libffi/src/x86/sysv.S gcc-4.3.1/libffi/src/x86/sysv.S +--- gcc-4.3.1.orig/libffi/src/x86/sysv.S 2008-01-30 15:36:58.000000000 +0100 ++++ gcc-4.3.1/libffi/src/x86/sysv.S 2008-06-10 14:58:21.000000000 +0200 +@@ -430,3 +430,7 @@ + #endif + + #endif /* ifndef __x86_64__ */ ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +diff -durN gcc-4.3.1.orig/libffi/src/x86/unix64.S gcc-4.3.1/libffi/src/x86/unix64.S +--- gcc-4.3.1.orig/libffi/src/x86/unix64.S 2005-05-05 06:06:38.000000000 +0200 ++++ gcc-4.3.1/libffi/src/x86/unix64.S 2008-06-10 14:58:21.000000000 +0200 +@@ -410,3 +410,7 @@ + .LEFDE3: + + #endif /* __x86_64__ */ ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif diff --git a/patches/gcc/4.3.1/225-sparc64-bsd.patch b/patches/gcc/4.3.1/225-sparc64-bsd.patch deleted file mode 100644 index 5ac2b43..0000000 --- a/patches/gcc/4.3.1/225-sparc64-bsd.patch +++ /dev/null @@ -1,30 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/14_all_gcc-sparc64-bsd.patch -diff -durN gcc-4.3.1.orig/gcc/config/sparc/freebsd.h gcc-4.3.1/gcc/config/sparc/freebsd.h ---- gcc-4.3.1.orig/gcc/config/sparc/freebsd.h 2007-08-02 12:49:31.000000000 +0200 -+++ gcc-4.3.1/gcc/config/sparc/freebsd.h 2008-06-10 14:57:54.000000000 +0200 -@@ -25,9 +25,22 @@ - /* FreeBSD needs the platform name (sparc64) defined. - Emacs needs to know if the arch is 64 or 32-bits. */ - --#undef CPP_CPU64_DEFAULT_SPEC --#define CPP_CPU64_DEFAULT_SPEC \ -- "-D__sparc64__ -D__sparc_v9__ -D__sparcv9 -D__arch64__" -+#undef FBSD_TARGET_CPU_CPP_BUILTINS -+#define FBSD_TARGET_CPU_CPP_BUILTINS() \ -+ do \ -+ { \ -+ if (TARGET_ARCH64) \ -+ { \ -+ builtin_define ("__sparc64__"); \ -+ builtin_define ("__sparc_v9__"); \ -+ builtin_define ("__sparcv9"); \ -+ } \ -+ else \ -+ builtin_define ("__sparc"); \ -+ builtin_define ("__sparc__"); \ -+ } \ -+ while (0) -+ - - #define LINK_SPEC "%(link_arch) \ - %{!mno-relax:%{!r:-relax}} \ diff --git a/patches/gcc/4.3.1/230-pr34571.patch b/patches/gcc/4.3.1/230-pr34571.patch new file mode 100644 index 0000000..16d0c30 --- /dev/null +++ b/patches/gcc/4.3.1/230-pr34571.patch @@ -0,0 +1,35 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/64_all_gcc43-pr34571.patch +http://gcc.gnu.org/PR34571 + +2007-12-26 Rask Ingemann Lambertsen + + PR target/34571 + * config/alpha/alpha.c (alpha_cannot_force_const_mem): Use + symbolic_operand. + * varasm.c (output_constant_pool_1): Fix typo. + +diff -durN gcc-4.3.1.orig/gcc/config/alpha/alpha.c gcc-4.3.1/gcc/config/alpha/alpha.c +--- gcc-4.3.1.orig/gcc/config/alpha/alpha.c 2008-02-07 18:45:24.000000000 +0100 ++++ gcc-4.3.1/gcc/config/alpha/alpha.c 2008-06-10 14:58:24.000000000 +0200 +@@ -1113,8 +1113,7 @@ + static bool + alpha_cannot_force_const_mem (rtx x) + { +- enum rtx_code code = GET_CODE (x); +- return code == SYMBOL_REF || code == LABEL_REF || code == CONST; ++ return symbolic_operand (x, GET_MODE (x)); + } + + /* We do not allow indirect calls to be optimized into sibling calls, nor +diff -durN gcc-4.3.1.orig/gcc/varasm.c gcc-4.3.1/gcc/varasm.c +--- gcc-4.3.1.orig/gcc/varasm.c 2007-12-05 22:55:10.000000000 +0100 ++++ gcc-4.3.1/gcc/varasm.c 2008-06-10 14:58:24.000000000 +0200 +@@ -3710,7 +3710,7 @@ + /* FALLTHRU */ + + case LABEL_REF: +- tmp = XEXP (x, 0); ++ tmp = XEXP (tmp, 0); + gcc_assert (!INSN_DELETED_P (tmp)); + gcc_assert (!NOTE_P (tmp) + || NOTE_KIND (tmp) != NOTE_INSN_DELETED); diff --git a/patches/gcc/4.3.1/240-pr25343.patch b/patches/gcc/4.3.1/240-pr25343.patch new file mode 100644 index 0000000..776f607 --- /dev/null +++ b/patches/gcc/4.3.1/240-pr25343.patch @@ -0,0 +1,21 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/66_all_gcc43-pr25343.patch +http://gcc.gnu.org/PR25343 + +sniped from Debian + +2008-04-27 Roman Zippel + + * config/host-linux.c (TRY_EMPTY_VM_SPACE): Define for __mc68000__. + +diff -durN gcc-4.3.1.orig/gcc/config/host-linux.c gcc-4.3.1/gcc/config/host-linux.c +--- gcc-4.3.1.orig/gcc/config/host-linux.c 2007-08-02 12:49:31.000000000 +0200 ++++ gcc-4.3.1/gcc/config/host-linux.c 2008-06-10 14:58:28.000000000 +0200 +@@ -84,6 +84,8 @@ + # define TRY_EMPTY_VM_SPACE 0x8000000000 + #elif defined(__sparc__) + # define TRY_EMPTY_VM_SPACE 0x60000000 ++#elif defined(__mc68000__) ++# define TRY_EMPTY_VM_SPACE 0x40000000 + #else + # define TRY_EMPTY_VM_SPACE 0 + #endif diff --git a/patches/gcc/4.3.1/250-flatten-switch-stmt-00.patch b/patches/gcc/4.3.1/250-flatten-switch-stmt-00.patch deleted file mode 100644 index 55cafcb..0000000 --- a/patches/gcc/4.3.1/250-flatten-switch-stmt-00.patch +++ /dev/null @@ -1,76 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/18_all_904-flatten-switch-stmt-00.patch -http://gcc.gnu.org/ml/gcc-patches/2007-04/msg00927.html - -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" - -diff -durN gcc-4.3.1.orig/gcc/stmt.c gcc-4.3.1/gcc/stmt.c ---- gcc-4.3.1.orig/gcc/stmt.c 2008-05-09 20:12:13.000000000 +0200 -+++ gcc-4.3.1/gcc/stmt.c 2008-06-10 14:57:58.000000000 +0200 -@@ -2509,7 +2509,11 @@ - 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); - } -@@ -3067,6 +3071,7 @@ - { - 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, diff --git a/patches/gcc/4.3.1/250-sh-pr24836.patch b/patches/gcc/4.3.1/250-sh-pr24836.patch new file mode 100644 index 0000000..753e264 --- /dev/null +++ b/patches/gcc/4.3.1/250-sh-pr24836.patch @@ -0,0 +1,28 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/74_all_sh-pr24836.patch +http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348 +http://gcc.gnu.org/PR24836 + +diff -durN gcc-4.3.1.orig/gcc/configure gcc-4.3.1/gcc/configure +--- gcc-4.3.1.orig/gcc/configure 2008-06-10 14:57:48.000000000 +0200 ++++ gcc-4.3.1/gcc/configure 2008-06-10 14:58:32.000000000 +0200 +@@ -14709,7 +14709,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 -durN gcc-4.3.1.orig/gcc/configure.ac gcc-4.3.1/gcc/configure.ac +--- gcc-4.3.1.orig/gcc/configure.ac 2008-06-10 14:57:48.000000000 +0200 ++++ gcc-4.3.1/gcc/configure.ac 2008-06-10 14:58:32.000000000 +0200 +@@ -2537,7 +2537,7 @@ + tls_first_minor=14 + tls_as_opt="-m64 -Aesame --fatal-warnings" + ;; +- sh-*-* | sh[34]-*-*) ++ sh-*-* | sh[34]*-*-*) + conftest_s=' + .section ".tdata","awT",@progbits + foo: .long 25 diff --git a/patches/gcc/4.3.1/260-uclibc-conf-noupstream.patch b/patches/gcc/4.3.1/260-uclibc-conf-noupstream.patch new file mode 100644 index 0000000..5176968 --- /dev/null +++ b/patches/gcc/4.3.1/260-uclibc-conf-noupstream.patch @@ -0,0 +1,13 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_103-uclibc-conf-noupstream.patch +diff -durN gcc-4.3.1.orig/gcc/config.gcc gcc-4.3.1/gcc/config.gcc +--- gcc-4.3.1.orig/gcc/config.gcc 2008-06-10 14:58:09.000000000 +0200 ++++ gcc-4.3.1/gcc/config.gcc 2008-06-10 14:58:36.000000000 +0200 +@@ -2149,7 +2149,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/patches/gcc/4.3.1/270-uclibc-locale.patch b/patches/gcc/4.3.1/270-uclibc-locale.patch new file mode 100644 index 0000000..6ba5fd9 --- /dev/null +++ b/patches/gcc/4.3.1/270-uclibc-locale.patch @@ -0,0 +1,2794 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_200-uclibc-locale.patch +diff -durN gcc-4.3.1.orig/libstdc++-v3/acinclude.m4 gcc-4.3.1/libstdc++-v3/acinclude.m4 +--- gcc-4.3.1.orig/libstdc++-v3/acinclude.m4 2008-04-25 18:52:57.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/acinclude.m4 2008-06-10 14:58:39.000000000 +0200 +@@ -1349,7 +1349,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 +@@ -1370,6 +1370,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) + enable_clocale_flag=gnu + ;; +@@ -1541,6 +1544,40 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ AC_MSG_RESULT(uclibc) ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ AC_SUBST(glibcxx_MOFILES) ++ AC_SUBST(glibcxx_POFILES) ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-06-10 14:58:39.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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 +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:58:39.000000000 +0200 +@@ -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 ++ ++#include // For errno ++#include ++#include ++#include ++#include ++ ++#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 -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:58:39.000000000 +0200 +@@ -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 ++ ++#ifndef _C_LOCALE_H ++#define _C_LOCALE_H 1 ++ ++#pragma GCC system_header ++ ++#include // get std::strlen ++#include // get std::snprintf or std::sprintf ++#include ++#include // For codecvt ++#ifdef __UCLIBC_MJN3_ONLY__ ++#warning fix this ++#endif ++#ifdef __UCLIBC_HAS_LOCALE__ ++#include // For codecvt using iconv, iconv_t ++#endif ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ ++#include // 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 ++ 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 +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2008-06-10 14:58:39.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++namespace std ++{ ++ // Specializations. ++#ifdef _GLIBCXX_USE_WCHAR_T ++ codecvt_base::result ++ codecvt:: ++ 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(-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(__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:: ++ 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(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(-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(-1) ++ || __conv == static_cast(-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:: ++ 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:: ++ 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:: ++ 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(__builtin_alloca(sizeof(wchar_t) ++ * __max)); ++ while (__from < __end && __max) ++ { ++ const extern_type* __from_chunk_end; ++ __from_chunk_end = static_cast(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(-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(-1) ++ || __conv == static_cast(-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 -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/collate_members.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2008-06-10 14:58:39.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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::_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::_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::_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::_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 -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:58:39.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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 specializations are in src/locale.cc and ++ // various /config/os/* files. ++ template<> ++ ctype_byname::ctype_byname(const char* __s, size_t __refs) ++ : ctype(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::__wmask_type ++ ctype::_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::do_toupper(wchar_t __c) const ++ { return __towupper_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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::do_tolower(wchar_t __c) const ++ { return __towlower_l(__c, _M_c_locale_ctype); } ++ ++ const wchar_t* ++ ctype::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:: ++ 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:: ++ 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:: ++ 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:: ++ 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:: ++ do_widen(char __c) const ++ { return _M_widen[static_cast(__c)]; } ++ ++ const char* ++ ctype:: ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const ++ { ++ while (__lo < __hi) ++ { ++ *__dest = _M_widen[static_cast(*__lo)]; ++ ++__lo; ++ ++__dest; ++ } ++ return __hi; ++ } ++ ++ char ++ ctype:: ++ 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(__c)); ++ } ++ ++ const wchar_t* ++ ctype:: ++ 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(__c)); ++ } ++ ++__lo; ++ ++__dest; ++ } ++ else ++ while (__lo < __hi) ++ { ++ const int __c = wctob(*__lo); ++ *__dest = (__c == EOF ? __dfault : static_cast(__c)); ++ ++__lo; ++ ++__dest; ++ } ++#ifdef __UCLIBC_HAS_XLOCALE__ ++ __uselocale(__old); ++#endif ++ return __hi; ++ } ++ ++ void ++ ctype::_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(__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(_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 -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2008-06-10 14:58:39.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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::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(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::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 -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:58:39.000000000 +0200 +@@ -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 ++ ++#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 ++ messages<_CharT>::messages(size_t __refs) ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), ++ _M_name_messages(_S_get_c_name()) ++ { } ++ ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::open(const basic_string& __s, const locale& __loc, ++ const char* __dir) const ++ { ++ __bindtextdomain(__s.c_str(), __dir); ++ return this->do_open(__s, __loc); ++ } ++ ++ // Virtual member functions. ++ template ++ 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 messages<_CharT>::catalog ++ messages<_CharT>::do_open(const basic_string& __s, ++ const locale&) const ++ { ++ // No error checking is done, assume the catalog exists and can ++ // be used. ++ __textdomain(__s.c_str()); ++ return 0; ++ } ++ ++ template ++ void ++ messages<_CharT>::do_close(catalog) const ++ { } ++ ++ // messages_byname ++ template ++ 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 -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:58:39.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::_M_initialize_moneypunct(__c_locale __cloc, ++ const char*) ++ { ++ if (!_M_data) ++ _M_data = new __moneypunct_cache; ++ ++ 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::~moneypunct() ++ { delete _M_data; } ++ ++ template<> ++ moneypunct::~moneypunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ moneypunct::_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; ++ ++ 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(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::_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; ++ ++ 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(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::~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::~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 -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:58:39.000000000 +0200 +@@ -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 ++ ++#define _LIBC ++#include ++#undef _LIBC ++#include ++ ++#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::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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::~numpunct() ++ { delete _M_data; } ++ ++#ifdef _GLIBCXX_USE_WCHAR_T ++ template<> ++ void ++ numpunct::_M_initialize_numpunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __numpunct_cache; ++ ++ 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(__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(__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::~numpunct() ++ { delete _M_data; } ++ #endif ++} +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-06-10 14:58:39.000000000 +0200 +@@ -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 ++ ++#include ++#include ++ ++#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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++ 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:: ++ _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::_M_initialize_timepunct(__c_locale __cloc) ++ { ++ if (!_M_data) ++ _M_data = new __timepunct_cache; ++ ++#warning wide time stuff ++// if (!__cloc) ++ { ++ // "C" locale ++ _M_c_locale_timepunct = _S_get_c_locale(); ++ ++ _M_data->_M_date_format = L"%m/%d/%y"; ++ _M_data->_M_date_era_format = L"%m/%d/%y"; ++ _M_data->_M_time_format = L"%H:%M:%S"; ++ _M_data->_M_time_era_format = L"%H:%M:%S"; ++ _M_data->_M_date_time_format = L""; ++ _M_data->_M_date_time_era_format = L""; ++ _M_data->_M_am = L"AM"; ++ _M_data->_M_pm = L"PM"; ++ _M_data->_M_am_pm_format = L""; ++ ++ // Day names, starting with "C"'s Sunday. ++ _M_data->_M_day1 = L"Sunday"; ++ _M_data->_M_day2 = L"Monday"; ++ _M_data->_M_day3 = L"Tuesday"; ++ _M_data->_M_day4 = L"Wednesday"; ++ _M_data->_M_day5 = L"Thursday"; ++ _M_data->_M_day6 = L"Friday"; ++ _M_data->_M_day7 = L"Saturday"; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ _M_data->_M_aday1 = L"Sun"; ++ _M_data->_M_aday2 = L"Mon"; ++ _M_data->_M_aday3 = L"Tue"; ++ _M_data->_M_aday4 = L"Wed"; ++ _M_data->_M_aday5 = L"Thu"; ++ _M_data->_M_aday6 = L"Fri"; ++ _M_data->_M_aday7 = L"Sat"; ++ ++ // Month names, starting with "C"'s January. ++ _M_data->_M_month01 = L"January"; ++ _M_data->_M_month02 = L"February"; ++ _M_data->_M_month03 = L"March"; ++ _M_data->_M_month04 = L"April"; ++ _M_data->_M_month05 = L"May"; ++ _M_data->_M_month06 = L"June"; ++ _M_data->_M_month07 = L"July"; ++ _M_data->_M_month08 = L"August"; ++ _M_data->_M_month09 = L"September"; ++ _M_data->_M_month10 = L"October"; ++ _M_data->_M_month11 = L"November"; ++ _M_data->_M_month12 = L"December"; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ _M_data->_M_amonth01 = L"Jan"; ++ _M_data->_M_amonth02 = L"Feb"; ++ _M_data->_M_amonth03 = L"Mar"; ++ _M_data->_M_amonth04 = L"Apr"; ++ _M_data->_M_amonth05 = L"May"; ++ _M_data->_M_amonth06 = L"Jun"; ++ _M_data->_M_amonth07 = L"Jul"; ++ _M_data->_M_amonth08 = L"Aug"; ++ _M_data->_M_amonth09 = L"Sep"; ++ _M_data->_M_amonth10 = L"Oct"; ++ _M_data->_M_amonth11 = L"Nov"; ++ _M_data->_M_amonth12 = L"Dec"; ++ } ++#if 0 ++ else ++ { ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); ++ ++ union { char *__s; wchar_t *__w; } __u; ++ ++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); ++ _M_data->_M_date_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); ++ _M_data->_M_date_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); ++ _M_data->_M_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); ++ _M_data->_M_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); ++ _M_data->_M_date_time_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); ++ _M_data->_M_date_time_era_format = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); ++ _M_data->_M_am = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); ++ _M_data->_M_pm = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); ++ _M_data->_M_am_pm_format = __u.__w; ++ ++ // Day names, starting with "C"'s Sunday. ++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); ++ _M_data->_M_day1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); ++ _M_data->_M_day2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); ++ _M_data->_M_day3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); ++ _M_data->_M_day4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); ++ _M_data->_M_day5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); ++ _M_data->_M_day6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); ++ _M_data->_M_day7 = __u.__w; ++ ++ // Abbreviated day names, starting with "C"'s Sun. ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); ++ _M_data->_M_aday1 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); ++ _M_data->_M_aday2 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); ++ _M_data->_M_aday3 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); ++ _M_data->_M_aday4 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); ++ _M_data->_M_aday5 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); ++ _M_data->_M_aday6 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); ++ _M_data->_M_aday7 = __u.__w; ++ ++ // Month names, starting with "C"'s January. ++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); ++ _M_data->_M_month01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); ++ _M_data->_M_month02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); ++ _M_data->_M_month03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); ++ _M_data->_M_month04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); ++ _M_data->_M_month05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); ++ _M_data->_M_month06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); ++ _M_data->_M_month07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); ++ _M_data->_M_month08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); ++ _M_data->_M_month09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); ++ _M_data->_M_month10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); ++ _M_data->_M_month11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); ++ _M_data->_M_month12 = __u.__w; ++ ++ // Abbreviated month names, starting with "C"'s Jan. ++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); ++ _M_data->_M_amonth01 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); ++ _M_data->_M_amonth02 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); ++ _M_data->_M_amonth03 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); ++ _M_data->_M_amonth04 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); ++ _M_data->_M_amonth05 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); ++ _M_data->_M_amonth06 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); ++ _M_data->_M_amonth07 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); ++ _M_data->_M_amonth08 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); ++ _M_data->_M_amonth09 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); ++ _M_data->_M_amonth10 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); ++ _M_data->_M_amonth11 = __u.__w; ++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); ++ _M_data->_M_amonth12 = __u.__w; ++ } ++#endif // 0 ++ } ++#endif ++} +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:58:39.000000000 +0200 +@@ -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 ++ ++ template ++ __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 ++ __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 ++ __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 ++ __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 -durN gcc-4.3.1.orig/libstdc++-v3/configure gcc-4.3.1/libstdc++-v3/configure +--- gcc-4.3.1.orig/libstdc++-v3/configure 2008-04-25 18:52:57.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/configure 2008-06-10 14:58:39.000000000 +0200 +@@ -14001,7 +14001,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; }; } ;; +@@ -14034,6 +14034,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) + enable_clocale_flag=gnu + ;; +@@ -14422,6 +14425,76 @@ + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; ++ uclibc) ++ echo "$as_me:$LINENO: result: uclibc" >&5 ++echo "${ECHO_T}uclibc" >&6 ++ ++ # Declare intention to use gettext, and add support for specific ++ # languages. ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT ++ ALL_LINGUAS="de fr" ++ ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. ++ # Extract the first word of "msgfmt", so it can be a program name with args. ++set dummy msgfmt; ac_word=$2 ++echo "$as_me:$LINENO: checking for $ac_word" >&5 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ if test -n "$check_msgfmt"; then ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. ++else ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_prog_check_msgfmt="yes" ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++done ++ ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" ++fi ++fi ++check_msgfmt=$ac_cv_prog_check_msgfmt ++if test -n "$check_msgfmt"; then ++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 ++echo "${ECHO_T}$check_msgfmt" >&6 ++else ++ echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6 ++fi ++ ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then ++ USE_NLS=yes ++ fi ++ # Export the build objects. ++ for ling in $ALL_LINGUAS; do \ ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ ++ done ++ ++ ++ ++ CLOCALE_H=config/locale/uclibc/c_locale.h ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc ++ CMESSAGES_H=config/locale/uclibc/messages_members.h ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc ++ CTIME_H=config/locale/uclibc/time_members.h ++ CTIME_CC=config/locale/uclibc/time_members.cc ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h ++ ;; + esac + + # This is where the testsuite looks for locale catalogs, using the +diff -durN gcc-4.3.1.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.3.1/libstdc++-v3/include/c_compatibility/wchar.h +--- gcc-4.3.1.orig/libstdc++-v3/include/c_compatibility/wchar.h 2007-03-04 23:59:49.000000000 +0100 ++++ gcc-4.3.1/libstdc++-v3/include/c_compatibility/wchar.h 2008-06-10 14:58:39.000000000 +0200 +@@ -106,7 +106,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 --git a/patches/gcc/4.3.1/275-libiberty-pic.patch b/patches/gcc/4.3.1/275-libiberty-pic.patch deleted file mode 100644 index 0b1e6b4..0000000 --- a/patches/gcc/4.3.1/275-libiberty-pic.patch +++ /dev/null @@ -1,12 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/51_all_gcc-3.4-libiberty-pic.patch -diff -durN gcc-4.3.1.orig/libiberty/Makefile.in gcc-4.3.1/libiberty/Makefile.in ---- gcc-4.3.1.orig/libiberty/Makefile.in 2007-07-25 08:26:45.000000000 +0200 -+++ gcc-4.3.1/libiberty/Makefile.in 2008-06-10 14:58:02.000000000 +0200 -@@ -225,6 +225,7 @@ - $(AR) $(AR_FLAGS) $(TARGETLIB) \ - $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \ - $(RANLIB) $(TARGETLIB); \ -+ cp $(TARGETLIB) ../ ; \ - cd ..; \ - else true; fi - diff --git a/patches/gcc/4.3.1/280-uclibc-locale-no__x.patch b/patches/gcc/4.3.1/280-uclibc-locale-no__x.patch new file mode 100644 index 0000000..68c6e31 --- /dev/null +++ b/patches/gcc/4.3.1/280-uclibc-locale-no__x.patch @@ -0,0 +1,224 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_203-uclibc-locale-no__x.patch +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-06-10 14:58:43.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-06-10 14:58:43.000000000 +0200 +@@ -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 +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:58:43.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:58:43.000000000 +0200 +@@ -39,20 +39,6 @@ + #include + #include + +-#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<> +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:58:43.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:58:43.000000000 +0200 +@@ -68,6 +68,7 @@ + { + extern "C" __typeof(uselocale) __uselocale; + } ++#define __uselocale uselocale + #endif + + namespace std +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/collate_members.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 2008-06-10 14:58:43.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2008-06-10 14:58:43.000000000 +0200 +@@ -36,13 +36,6 @@ + #include + #include + +-#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 +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:58:43.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:58:43.000000000 +0200 +@@ -38,13 +38,6 @@ + #undef _LIBC + #include + +-#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 specializations are in src/locale.cc and +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 2008-06-10 14:58:43.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2008-06-10 14:58:43.000000000 +0200 +@@ -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 + +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:58:43.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:58:43.000000000 +0200 +@@ -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& __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; + } + +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:58:43.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:58:43.000000000 +0200 +@@ -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: +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:58:43.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:58:43.000000000 +0200 +@@ -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 + { +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-06-10 14:58:43.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-06-10 14:58:43.000000000 +0200 +@@ -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 + { diff --git a/patches/gcc/4.3.1/290-uclibc-locale-wchar_fix.patch b/patches/gcc/4.3.1/290-uclibc-locale-wchar_fix.patch new file mode 100644 index 0000000..af26649 --- /dev/null +++ b/patches/gcc/4.3.1/290-uclibc-locale-wchar_fix.patch @@ -0,0 +1,51 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_204-uclibc-locale-wchar_fix.patch +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:58:47.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:58:47.000000000 +0200 +@@ -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 +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:58:47.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:58:47.000000000 +0200 +@@ -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/patches/gcc/4.3.1/300-superh-default-multilib.patch b/patches/gcc/4.3.1/300-superh-default-multilib.patch deleted file mode 100644 index bc24221..0000000 --- a/patches/gcc/4.3.1/300-superh-default-multilib.patch +++ /dev/null @@ -1,25 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/53_all_gcc4-superh-default-multilib.patch -The gcc-3.x toolchains would contain all the targets by default. With gcc-4, -you have to actually list out the multilibs you want or you will end up with -just one when using targets like 'sh4-linux-gnu'. - -The resulting toolchain can't even build a kernel as the kernel needs to build -with the nofpu flag to be sure that no fpu ops are generated. - -Here we restore the gcc-3.x behavior; the additional overhead of building all -of these multilibs by default is negligible. - -http://bugs.gentoo.org/140205 - -diff -durN gcc-4.3.1.orig/gcc/config.gcc gcc-4.3.1/gcc/config.gcc ---- gcc-4.3.1.orig/gcc/config.gcc 2008-05-21 10:54:15.000000000 +0200 -+++ gcc-4.3.1/gcc/config.gcc 2008-06-10 14:58:06.000000000 +0200 -@@ -2278,7 +2278,7 @@ - if test x${sh_multilibs} = x ; then - case ${target} in - sh64-superh-linux* | \ -- sh[1234]*) sh_multilibs=${sh_cpu_target} ;; -+ sh[1234]*) sh_multilibs=`cd ${srcdir}/config/sh ; echo t-mlib-sh[1-4]* | sed 's:t-mlib-sh:,m:g;s: ::g'` ;; - sh64* | sh5*) sh_multilibs=m5-32media,m5-32media-nofpu,m5-compact,m5-compact-nofpu,m5-64media,m5-64media-nofpu ;; - sh-superh-*) sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;; - sh*-*-linux*) sh_multilibs=m1,m3e,m4 ;; diff --git a/patches/gcc/4.3.1/300-uclibc-locale-update.patch b/patches/gcc/4.3.1/300-uclibc-locale-update.patch new file mode 100644 index 0000000..8fef5e4 --- /dev/null +++ b/patches/gcc/4.3.1/300-uclibc-locale-update.patch @@ -0,0 +1,355 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_205-uclibc-locale-update.patch +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:58:47.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:58:51.000000000 +0200 +@@ -46,16 +46,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 +60,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 +74,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 +101,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); + } + +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.h +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:58:47.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:58:51.000000000 +0200 +@@ -39,21 +39,23 @@ + #pragma GCC system_header + + #include // get std::strlen +-#include // get std::snprintf or std::sprintf ++#include // get std::vsnprintf or std::vsprintf + #include + #include // For codecvt + #ifdef __UCLIBC_MJN3_ONLY__ + #warning fix this + #endif +-#ifdef __UCLIBC_HAS_LOCALE__ ++#ifdef _GLIBCXX_USE_ICONV + #include // For codecvt using iconv, iconv_t + #endif +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ +-#include // For messages ++#ifdef HAVE_LIBINTL_H ++#include // For messages + #endif ++#include + + #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 +- 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 -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:58:47.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:58:51.000000000 +0200 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + namespace std +@@ -138,20 +143,34 @@ + ctype:: + 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:: + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:58:47.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:58:51.000000000 +0200 +@@ -47,18 +47,21 @@ + template + 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 + 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 +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:58:51.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:58:51.000000000 +0200 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + #ifdef __UCLIBC_MJN3_ONLY__ +@@ -206,7 +211,7 @@ + } + break; + default: +- ; ++ __ret = pattern(); + } + return __ret; + } +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:58:51.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:58:51.000000000 +0200 +@@ -33,9 +33,14 @@ + + // Written by Benjamin Kosnik + ++#include ++#ifdef __UCLIBC_HAS_LOCALE__ + #define _LIBC + #include + #undef _LIBC ++#else ++#include ++#endif + #include + + #ifdef __UCLIBC_MJN3_ONLY__ +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:58:43.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:58:51.000000000 +0200 +@@ -37,25 +37,33 @@ + template + __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 + __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 + __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 diff --git a/patches/gcc/4.3.1/310-missing-execinfo_h.patch b/patches/gcc/4.3.1/310-missing-execinfo_h.patch new file mode 100644 index 0000000..fa749b2 --- /dev/null +++ b/patches/gcc/4.3.1/310-missing-execinfo_h.patch @@ -0,0 +1,13 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_301-missing-execinfo_h.patch +diff -durN gcc-4.3.1.orig/boehm-gc/include/gc.h gcc-4.3.1/boehm-gc/include/gc.h +--- gcc-4.3.1.orig/boehm-gc/include/gc.h 2007-04-23 23:10:09.000000000 +0200 ++++ gcc-4.3.1/boehm-gc/include/gc.h 2008-06-10 14:58:54.000000000 +0200 +@@ -503,7 +503,7 @@ + #if defined(__linux__) || defined(__GLIBC__) + # include + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/patches/gcc/4.3.1/320-c99-complex-ugly-hack.patch b/patches/gcc/4.3.1/320-c99-complex-ugly-hack.patch new file mode 100644 index 0000000..7aa36f8 --- /dev/null +++ b/patches/gcc/4.3.1/320-c99-complex-ugly-hack.patch @@ -0,0 +1,14 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_303-c99-complex-ugly-hack.patch +diff -durN gcc-4.3.1.orig/libstdc++-v3/configure gcc-4.3.1/libstdc++-v3/configure +--- gcc-4.3.1.orig/libstdc++-v3/configure 2008-06-10 14:58:43.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/configure 2008-06-10 14:58:58.000000000 +0200 +@@ -39006,6 +39006,9 @@ + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + #include ++#ifdef __UCLIBC__ ++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs ++#endif + int + main () + { diff --git a/patches/gcc/4.3.1/325-libstdc++-pic.patch b/patches/gcc/4.3.1/325-libstdc++-pic.patch deleted file mode 100644 index 61cab19..0000000 --- a/patches/gcc/4.3.1/325-libstdc++-pic.patch +++ /dev/null @@ -1,56 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/54_all_300-libstdc++-pic.patch -install libstdc++_pic.a if we have pic objs - -diff -durN gcc-4.3.1.orig/libstdc++-v3/src/Makefile.am gcc-4.3.1/libstdc++-v3/src/Makefile.am ---- gcc-4.3.1.orig/libstdc++-v3/src/Makefile.am 2008-02-29 19:26:50.000000000 +0100 -+++ gcc-4.3.1/libstdc++-v3/src/Makefile.am 2008-06-10 14:58:09.000000000 +0200 -@@ -289,6 +289,13 @@ - $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ - - -+install-exec-local: -+ pic_objs=`sed -n "s:'::g;s:^pic_object=::p" *.lo | grep -v '^none$$'`; \ -+ if [ x"$$pic_objs" != x ]; then \ -+ $(AR) cru libstdc++_pic.a $$pic_objs $(top_builddir)/libsupc++/*.o || exit 1; \ -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) || exit 1; \ -+ fi -+ - # Added bits to build debug library. - if GLIBCXX_BUILD_DEBUG - all-local: build_debug -diff -durN gcc-4.3.1.orig/libstdc++-v3/src/Makefile.in gcc-4.3.1/libstdc++-v3/src/Makefile.in ---- gcc-4.3.1.orig/libstdc++-v3/src/Makefile.in 2008-02-29 19:26:50.000000000 +0100 -+++ gcc-4.3.1/libstdc++-v3/src/Makefile.in 2008-06-10 14:58:09.000000000 +0200 -@@ -693,7 +693,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 - -@@ -732,7 +732,7 @@ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am \ -- uninstall-toolexeclibLTLIBRARIES -+ uninstall-toolexeclibLTLIBRARIES install-exec-local - - - # Symbol versioning for shared libraries. -@@ -858,6 +858,14 @@ - install_debug: - (cd ${debugdir} && $(MAKE) \ - toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) -+ -+install-exec-local: -+ pic_objs=`sed -n "s:'::g;s:^pic_object=::p" *.lo | grep -v '^none$$'`; \ -+ if [ x"$$pic_objs" != x ]; then \ -+ $(AR) cru libstdc++_pic.a $$pic_objs $(top_builddir)/libsupc++/*.o || exit 1; \ -+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) || exit 1; \ -+ fi -+ - # Tell versions [3.59,3.63) of GNU make to not export all variables. - # Otherwise a system limit (for SysV at least) may be exceeded. - .NOEXPORT: diff --git a/patches/gcc/4.3.1/330-index_macro.patch b/patches/gcc/4.3.1/330-index_macro.patch new file mode 100644 index 0000000..65794aa --- /dev/null +++ b/patches/gcc/4.3.1/330-index_macro.patch @@ -0,0 +1,27 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_304-index_macro.patch +diff -durN gcc-4.3.1.orig/libstdc++-v3/include/ext/rope gcc-4.3.1/libstdc++-v3/include/ext/rope +--- gcc-4.3.1.orig/libstdc++-v3/include/ext/rope 2008-01-31 19:44:55.000000000 +0100 ++++ gcc-4.3.1/libstdc++-v3/include/ext/rope 2008-06-10 14:59:02.000000000 +0200 +@@ -59,6 +59,9 @@ + #include + #include + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + # ifdef __GC + # define __GC_CONST const + # else +diff -durN gcc-4.3.1.orig/libstdc++-v3/include/ext/ropeimpl.h gcc-4.3.1/libstdc++-v3/include/ext/ropeimpl.h +--- gcc-4.3.1.orig/libstdc++-v3/include/ext/ropeimpl.h 2007-05-04 17:06:46.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/include/ext/ropeimpl.h 2008-06-10 14:59:02.000000000 +0200 +@@ -54,6 +54,9 @@ + #include // For uninitialized_copy_n + #include // For power + ++/* cope w/ index defined as macro, SuSv3 proposal */ ++#undef index ++ + _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + + using std::size_t; diff --git a/patches/gcc/4.3.1/340-libmudflap-susv3-legacy.patch b/patches/gcc/4.3.1/340-libmudflap-susv3-legacy.patch new file mode 100644 index 0000000..9672fc4 --- /dev/null +++ b/patches/gcc/4.3.1/340-libmudflap-susv3-legacy.patch @@ -0,0 +1,49 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_305-libmudflap-susv3-legacy.patch +diff -durN gcc-4.3.1.orig/libmudflap/mf-hooks2.c gcc-4.3.1/libmudflap/mf-hooks2.c +--- gcc-4.3.1.orig/libmudflap/mf-hooks2.c 2005-09-23 23:58:39.000000000 +0200 ++++ gcc-4.3.1/libmudflap/mf-hooks2.c 2008-06-10 14:59:05.000000000 +0200 +@@ -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 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/patches/gcc/4.3.1/350-libstdc++-namespace.patch b/patches/gcc/4.3.1/350-libstdc++-namespace.patch new file mode 100644 index 0000000..eee4e50 --- /dev/null +++ b/patches/gcc/4.3.1/350-libstdc++-namespace.patch @@ -0,0 +1,38 @@ +Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_306-libstdc++-namespace.patch +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 +diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:58:54.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:59:09.000000000 +0200 +@@ -32,7 +32,8 @@ + // + + // Written by Benjamin Kosnik +- ++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 -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:58:54.000000000 +0200 ++++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:59:09.000000000 +0200 +@@ -33,7 +33,8 @@ + // + + // Written by Benjamin Kosnik +- ++namespace std ++{ + template + __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/patches/gcc/4.3.1/350-pr24170.patch b/patches/gcc/4.3.1/350-pr24170.patch deleted file mode 100644 index cd13698..0000000 --- a/patches/gcc/4.3.1/350-pr24170.patch +++ /dev/null @@ -1,61 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/61_all_gcc43-pr24170.patch -http://gcc.gnu.org/PR24170 - -2008-02-20 Tom Tromey - - PR libgcj/24170: - * java/io/natFilePosix.cc (File::performList): Don't use - readdir_r. - * configure, include/config.h.in: Rebuilt. - * configure.ac: Don't check for readdir_r. - -diff -durN gcc-4.3.1.orig/libjava/configure.ac gcc-4.3.1/libjava/configure.ac ---- gcc-4.3.1.orig/libjava/configure.ac 2008-06-10 14:57:42.000000000 +0200 -+++ gcc-4.3.1/libjava/configure.ac 2008-06-10 14:58:13.000000000 +0200 -@@ -1030,7 +1030,7 @@ - PLATFORMNET=NoNet - else - AC_CHECK_FUNCS([strerror_r select fstat open fsync sleep opendir \ -- localtime_r readdir_r getpwuid_r getcwd \ -+ localtime_r getpwuid_r getcwd \ - access stat lstat mkdir rename rmdir unlink utime chmod readlink \ - nl_langinfo setlocale \ - inet_pton uname inet_ntoa \ -diff -durN gcc-4.3.1.orig/libjava/include/config.h.in gcc-4.3.1/libjava/include/config.h.in ---- gcc-4.3.1.orig/libjava/include/config.h.in 2007-07-31 18:17:21.000000000 +0200 -+++ gcc-4.3.1/libjava/include/config.h.in 2008-06-10 14:58:13.000000000 +0200 -@@ -214,9 +214,6 @@ - /* Define to 1 if you have the header file. */ - #undef HAVE_PWD_H - --/* Define to 1 if you have the `readdir_r' function. */ --#undef HAVE_READDIR_R -- - /* Define to 1 if you have the `readlink' function. */ - #undef HAVE_READLINK - -diff -durN gcc-4.3.1.orig/libjava/java/io/natFilePosix.cc gcc-4.3.1/libjava/java/io/natFilePosix.cc ---- gcc-4.3.1.orig/libjava/java/io/natFilePosix.cc 2007-08-04 23:50:01.000000000 +0200 -+++ gcc-4.3.1/libjava/java/io/natFilePosix.cc 2008-06-10 14:58:13.000000000 +0200 -@@ -1,6 +1,6 @@ - // natFile.cc - Native part of File class for POSIX. - --/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2006 -+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2008 - Free Software Foundation - - This file is part of libgcj. -@@ -292,13 +292,7 @@ - - java::util::ArrayList *list = new java::util::ArrayList (); - struct dirent *d; --#if defined(HAVE_READDIR_R) && defined(_POSIX_PTHREAD_SEMANTICS) -- int name_max = pathconf (buf, _PC_NAME_MAX); -- char dbuf[sizeof (struct dirent) + name_max + 1]; -- while (readdir_r (dir, (struct dirent *) dbuf, &d) == 0 && d != NULL) --#else /* HAVE_READDIR_R */ - while ((d = readdir (dir)) != NULL) --#endif /* HAVE_READDIR_R */ - { - // Omit "." and "..". - if (d->d_name[0] == '.' diff --git a/patches/gcc/4.3.1/360-arm-softfloat.patch b/patches/gcc/4.3.1/360-arm-softfloat.patch new file mode 100644 index 0000000..4e7ea7c --- /dev/null +++ b/patches/gcc/4.3.1/360-arm-softfloat.patch @@ -0,0 +1,29 @@ +diff -durN gcc-4.3.1.orig/gcc/config/arm/linux-elf.h gcc-4.3.1/gcc/config/arm/linux-elf.h +--- gcc-4.3.1.orig/gcc/config/arm/linux-elf.h 2007-11-08 14:44:09.000000000 +0100 ++++ gcc-4.3.1/gcc/config/arm/linux-elf.h 2008-07-23 15:30:57.000000000 +0200 +@@ -60,7 +60,7 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" ++#define LIBGCC_SPEC "-lgcc" + + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" + +diff -durN gcc-4.3.1.orig/gcc/config/arm/t-linux gcc-4.3.1/gcc/config/arm/t-linux +--- gcc-4.3.1.orig/gcc/config/arm/t-linux 2006-11-09 23:14:27.000000000 +0100 ++++ gcc-4.3.1/gcc/config/arm/t-linux 2008-07-23 19:15:25.000000000 +0200 +@@ -3,7 +3,12 @@ + TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC + + LIB1ASMSRC = arm/lib1funcs.asm +-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx ++LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func \ ++ _call_via_rX _interwork_call_via_rX \ ++ _lshrdi3 _ashrdi3 _ashldi3 \ ++ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ ++ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ ++ _fixsfsi _fixunssfsi _floatdidf _floatdisf _floatundidf _floatundisf + + # MULTILIB_OPTIONS = mhard-float/msoft-float + # MULTILIB_DIRNAMES = hard-float soft-float diff --git a/patches/gcc/4.3.1/370-alpha-signal_h.patch b/patches/gcc/4.3.1/370-alpha-signal_h.patch new file mode 100644 index 0000000..d7e1796 --- /dev/null +++ b/patches/gcc/4.3.1/370-alpha-signal_h.patch @@ -0,0 +1,17 @@ +--- gcc-4.2.1-stock/gcc/config/alpha/linux-unwind.h 2005-06-24 20:22:41.000000000 -0500 ++++ gcc-4.2.1/gcc/config/alpha/linux-unwind.h 2007-09-01 20:21:34.000000000 -0500 +@@ -29,6 +29,9 @@ Boston, MA 02110-1301, USA. */ + /* Do code reading to identify a signal frame, and set the frame + state data appropriately. See unwind-dw2.c for the structs. */ + ++/* Don't use this if inhibit_libc is set ++ The build for this target will fail trying to include missing headers */ ++#ifndef inhibit_libc + #include + #include + +@@ -80,3 +83,4 @@ alpha_fallback_frame_state (struct _Unwi + fs->retaddr_column = 64; + return _URC_NO_REASON; + } ++#endif /* inhibit_libc */ diff --git a/patches/gcc/4.3.1/375-noteGNUstack-00.patch b/patches/gcc/4.3.1/375-noteGNUstack-00.patch deleted file mode 100644 index d656661..0000000 --- a/patches/gcc/4.3.1/375-noteGNUstack-00.patch +++ /dev/null @@ -1,96 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/61_all_gcc4-ia64-noteGNUstack.patch -2004-09-20 Jakub Jelinek - - * config/rs6000/ppc-asm.h: Add .note.GNU-stack section also - on ppc64-linux. - - * config/ia64/lib1funcs.asm: Add .note.GNU-stack section on - ia64-linux. - * config/ia64/crtbegin.asm: Likewise. - * config/ia64/crtend.asm: Likewise. - * config/ia64/crti.asm: Likewise. - * config/ia64/crtn.asm: Likewise. - -2004-05-14 Jakub Jelinek - - * config/ia64/linux.h (TARGET_ASM_FILE_END): Define. - -diff -durN gcc-4.3.1.orig/gcc/config/ia64/crtbegin.asm gcc-4.3.1/gcc/config/ia64/crtbegin.asm ---- gcc-4.3.1.orig/gcc/config/ia64/crtbegin.asm 2005-09-27 02:52:24.000000000 +0200 -+++ gcc-4.3.1/gcc/config/ia64/crtbegin.asm 2008-06-10 14:58:17.000000000 +0200 -@@ -255,3 +255,7 @@ - .weak __cxa_finalize - #endif - .weak _Jv_RegisterClasses -+ -+#ifdef __linux__ -+.section .note.GNU-stack; .previous -+#endif -diff -durN gcc-4.3.1.orig/gcc/config/ia64/crtend.asm gcc-4.3.1/gcc/config/ia64/crtend.asm ---- gcc-4.3.1.orig/gcc/config/ia64/crtend.asm 2005-09-27 02:52:24.000000000 +0200 -+++ gcc-4.3.1/gcc/config/ia64/crtend.asm 2008-06-10 14:58:17.000000000 +0200 -@@ -122,3 +122,7 @@ - - br.ret.sptk.many rp - .endp __do_global_ctors_aux -+ -+#ifdef __linux__ -+.section .note.GNU-stack; .previous -+#endif -diff -durN gcc-4.3.1.orig/gcc/config/ia64/crti.asm gcc-4.3.1/gcc/config/ia64/crti.asm ---- gcc-4.3.1.orig/gcc/config/ia64/crti.asm 2005-06-25 03:22:41.000000000 +0200 -+++ gcc-4.3.1/gcc/config/ia64/crti.asm 2008-06-10 14:58:17.000000000 +0200 -@@ -64,3 +64,7 @@ - .body - - # end of crti.asm -+ -+#ifdef __linux__ -+.section .note.GNU-stack; .previous -+#endif -diff -durN gcc-4.3.1.orig/gcc/config/ia64/crtn.asm gcc-4.3.1/gcc/config/ia64/crtn.asm ---- gcc-4.3.1.orig/gcc/config/ia64/crtn.asm 2005-06-25 03:22:41.000000000 +0200 -+++ gcc-4.3.1/gcc/config/ia64/crtn.asm 2008-06-10 14:58:17.000000000 +0200 -@@ -54,3 +54,7 @@ - br.ret.sptk.many b0 - - # end of crtn.asm -+ -+#ifdef __linux__ -+.section .note.GNU-stack; .previous -+#endif -diff -durN gcc-4.3.1.orig/gcc/config/ia64/lib1funcs.asm gcc-4.3.1/gcc/config/ia64/lib1funcs.asm ---- gcc-4.3.1.orig/gcc/config/ia64/lib1funcs.asm 2005-09-27 02:52:24.000000000 +0200 -+++ gcc-4.3.1/gcc/config/ia64/lib1funcs.asm 2008-06-10 14:58:17.000000000 +0200 -@@ -792,3 +792,7 @@ - } - .endp __floattitf - #endif -+ -+#ifdef __linux__ -+.section .note.GNU-stack; .previous -+#endif -diff -durN gcc-4.3.1.orig/gcc/config/ia64/linux.h gcc-4.3.1/gcc/config/ia64/linux.h ---- gcc-4.3.1.orig/gcc/config/ia64/linux.h 2006-12-12 16:15:19.000000000 +0100 -+++ gcc-4.3.1/gcc/config/ia64/linux.h 2008-06-10 14:58:17.000000000 +0200 -@@ -5,6 +5,8 @@ - - #define TARGET_VERSION fprintf (stderr, " (IA-64) Linux"); - -+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack -+ - /* This is for -profile to use -lc_p instead of -lc. */ - #undef CC1_SPEC - #define CC1_SPEC "%{profile:-p} %{G*}" -diff -durN gcc-4.3.1.orig/gcc/config/rs6000/ppc-asm.h gcc-4.3.1/gcc/config/rs6000/ppc-asm.h ---- gcc-4.3.1.orig/gcc/config/rs6000/ppc-asm.h 2003-06-04 18:44:51.000000000 +0200 -+++ gcc-4.3.1/gcc/config/rs6000/ppc-asm.h 2008-06-10 14:58:17.000000000 +0200 -@@ -158,7 +158,7 @@ - .size FUNC_NAME(name),GLUE(.L,name)-FUNC_NAME(name) - #endif - --#if defined __linux__ && !defined __powerpc64__ -+#if defined __linux__ - .section .note.GNU-stack - .previous - #endif diff --git a/patches/gcc/4.3.1/400-noteGNUstack-01.patch b/patches/gcc/4.3.1/400-noteGNUstack-01.patch deleted file mode 100644 index a74e5e8..0000000 --- a/patches/gcc/4.3.1/400-noteGNUstack-01.patch +++ /dev/null @@ -1,198 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/62_all_gcc4-noteGNUstack.patch -2005-02-08 Jakub Jelinek - - * src/alpha/osf.S: Add .note.GNU-stack on Linux. - * src/s390/sysv.S: Likewise. - * src/powerpc/linux64.S: Likewise. - * src/powerpc/linux64_closure.S: Likewise. - * src/powerpc/ppc_closure.S: Likewise. - * src/powerpc/sysv.S: Likewise. - * src/x86/unix64.S: Likewise. - * src/x86/sysv.S: Likewise. - * src/sparc/v8.S: Likewise. - * src/sparc/v9.S: Likewise. - * src/m68k/sysv.S: Likewise. - * src/ia64/unix.S: Likewise. - * src/arm/sysv.S: Likewise. - - * ia64_save_regs_in_stack.s: Moved to... - * ia64_save_regs_in_stack.S: ... this. Add .note.GNU-stack - on Linux. - -diff -durN gcc-4.3.1.orig/boehm-gc/ia64_save_regs_in_stack.S gcc-4.3.1/boehm-gc/ia64_save_regs_in_stack.S ---- gcc-4.3.1.orig/boehm-gc/ia64_save_regs_in_stack.S 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.1/boehm-gc/ia64_save_regs_in_stack.S 2008-06-10 14:58:21.000000000 +0200 -@@ -0,0 +1,15 @@ -+ .text -+ .align 16 -+ .global GC_save_regs_in_stack -+ .proc GC_save_regs_in_stack -+GC_save_regs_in_stack: -+ .bodyfoo.mpg -+ flushrs -+ ;; -+ mov r8=ar.bsp -+ br.ret.sptk.few rp -+ .endp GC_save_regs_in_stack -+ -+#ifdef __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.1.orig/boehm-gc/ia64_save_regs_in_stack.s gcc-4.3.1/boehm-gc/ia64_save_regs_in_stack.s ---- gcc-4.3.1.orig/boehm-gc/ia64_save_regs_in_stack.s 2001-10-15 06:57:59.000000000 +0200 -+++ gcc-4.3.1/boehm-gc/ia64_save_regs_in_stack.s 2008-06-10 14:58:21.000000000 +0200 -@@ -1,12 +0,0 @@ -- .text -- .align 16 -- .global GC_save_regs_in_stack -- .proc GC_save_regs_in_stack --GC_save_regs_in_stack: -- .body -- flushrs -- ;; -- mov r8=ar.bsp -- br.ret.sptk.few rp -- .endp GC_save_regs_in_stack -- -diff -durN gcc-4.3.1.orig/libffi/src/alpha/osf.S gcc-4.3.1/libffi/src/alpha/osf.S ---- gcc-4.3.1.orig/libffi/src/alpha/osf.S 2007-04-06 18:24:16.000000000 +0200 -+++ gcc-4.3.1/libffi/src/alpha/osf.S 2008-06-10 14:58:21.000000000 +0200 -@@ -358,4 +358,8 @@ - .byte 16 # uleb128 offset 16*-8 - .align 3 - $LEFDE3: -+ -+#ifdef __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif - #endif -diff -durN gcc-4.3.1.orig/libffi/src/arm/sysv.S gcc-4.3.1/libffi/src/arm/sysv.S ---- gcc-4.3.1.orig/libffi/src/arm/sysv.S 2007-09-04 19:52:45.000000000 +0200 -+++ gcc-4.3.1/libffi/src/arm/sysv.S 2008-06-10 14:58:21.000000000 +0200 -@@ -293,3 +293,6 @@ - UNWIND .fnend - .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) - -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",%progbits -+#endif -diff -durN gcc-4.3.1.orig/libffi/src/ia64/unix.S gcc-4.3.1/libffi/src/ia64/unix.S ---- gcc-4.3.1.orig/libffi/src/ia64/unix.S 2005-03-30 23:49:19.000000000 +0200 -+++ gcc-4.3.1/libffi/src/ia64/unix.S 2008-06-10 14:58:21.000000000 +0200 -@@ -553,3 +553,7 @@ - data8 @pcrel(.Lld_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT - data8 @pcrel(.Lld_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE - data8 @pcrel(.Lld_hfa_ldouble) // FFI_IA64_TYPE_HFA_LDOUBLE -+ -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.1.orig/libffi/src/m68k/sysv.S gcc-4.3.1/libffi/src/m68k/sysv.S ---- gcc-4.3.1.orig/libffi/src/m68k/sysv.S 2007-05-10 23:29:04.000000000 +0200 -+++ gcc-4.3.1/libffi/src/m68k/sysv.S 2008-06-10 14:58:21.000000000 +0200 -@@ -207,3 +207,7 @@ - rts - CFI_ENDPROC() - .size ffi_closure_struct_SYSV,.-ffi_closure_struct_SYSV -+ -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.1.orig/libffi/src/powerpc/linux64.S gcc-4.3.1/libffi/src/powerpc/linux64.S ---- gcc-4.3.1.orig/libffi/src/powerpc/linux64.S 2007-11-17 00:24:53.000000000 +0100 -+++ gcc-4.3.1/libffi/src/powerpc/linux64.S 2008-06-10 14:58:21.000000000 +0200 -@@ -179,3 +179,7 @@ - .align 3 - .LEFDE1: - #endif -+ -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.1.orig/libffi/src/powerpc/linux64_closure.S gcc-4.3.1/libffi/src/powerpc/linux64_closure.S ---- gcc-4.3.1.orig/libffi/src/powerpc/linux64_closure.S 2005-08-11 23:18:24.000000000 +0200 -+++ gcc-4.3.1/libffi/src/powerpc/linux64_closure.S 2008-06-10 14:58:21.000000000 +0200 -@@ -204,3 +204,7 @@ - .align 3 - .LEFDE1: - #endif -+ -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.1.orig/libffi/src/powerpc/ppc_closure.S gcc-4.3.1/libffi/src/powerpc/ppc_closure.S ---- gcc-4.3.1.orig/libffi/src/powerpc/ppc_closure.S 2007-12-01 22:00:04.000000000 +0100 -+++ gcc-4.3.1/libffi/src/powerpc/ppc_closure.S 2008-06-10 14:58:21.000000000 +0200 -@@ -295,3 +295,7 @@ - .LEFDE1: - - #endif -+ -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.1.orig/libffi/src/powerpc/sysv.S gcc-4.3.1/libffi/src/powerpc/sysv.S ---- gcc-4.3.1.orig/libffi/src/powerpc/sysv.S 2007-12-01 22:00:04.000000000 +0100 -+++ gcc-4.3.1/libffi/src/powerpc/sysv.S 2008-06-10 14:58:21.000000000 +0200 -@@ -223,3 +223,7 @@ - .align 2 - .LEFDE1: - #endif -+ -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.1.orig/libffi/src/s390/sysv.S gcc-4.3.1/libffi/src/s390/sysv.S ---- gcc-4.3.1.orig/libffi/src/s390/sysv.S 2003-10-21 21:01:58.000000000 +0200 -+++ gcc-4.3.1/libffi/src/s390/sysv.S 2008-06-10 14:58:21.000000000 +0200 -@@ -427,3 +427,6 @@ - - #endif - -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.1.orig/libffi/src/sparc/v8.S gcc-4.3.1/libffi/src/sparc/v8.S ---- gcc-4.3.1.orig/libffi/src/sparc/v8.S 2004-11-22 19:35:16.000000000 +0100 -+++ gcc-4.3.1/libffi/src/sparc/v8.S 2008-06-10 14:58:21.000000000 +0200 -@@ -265,3 +265,7 @@ - .byte 0x1f ! uleb128 0x1f - .align WS - .LLEFDE2: -+ -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.1.orig/libffi/src/sparc/v9.S gcc-4.3.1/libffi/src/sparc/v9.S ---- gcc-4.3.1.orig/libffi/src/sparc/v9.S 2004-01-25 07:58:33.000000000 +0100 -+++ gcc-4.3.1/libffi/src/sparc/v9.S 2008-06-10 14:58:21.000000000 +0200 -@@ -300,3 +300,7 @@ - .align 8 - .LLEFDE2: - #endif -+ -+#ifdef __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.1.orig/libffi/src/x86/sysv.S gcc-4.3.1/libffi/src/x86/sysv.S ---- gcc-4.3.1.orig/libffi/src/x86/sysv.S 2008-01-30 15:36:58.000000000 +0100 -+++ gcc-4.3.1/libffi/src/x86/sysv.S 2008-06-10 14:58:21.000000000 +0200 -@@ -430,3 +430,7 @@ - #endif - - #endif /* ifndef __x86_64__ */ -+ -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif -diff -durN gcc-4.3.1.orig/libffi/src/x86/unix64.S gcc-4.3.1/libffi/src/x86/unix64.S ---- gcc-4.3.1.orig/libffi/src/x86/unix64.S 2005-05-05 06:06:38.000000000 +0200 -+++ gcc-4.3.1/libffi/src/x86/unix64.S 2008-06-10 14:58:21.000000000 +0200 -@@ -410,3 +410,7 @@ - .LEFDE3: - - #endif /* __x86_64__ */ -+ -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif diff --git a/patches/gcc/4.3.1/425-pr34571.patch b/patches/gcc/4.3.1/425-pr34571.patch deleted file mode 100644 index 16d0c30..0000000 --- a/patches/gcc/4.3.1/425-pr34571.patch +++ /dev/null @@ -1,35 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/64_all_gcc43-pr34571.patch -http://gcc.gnu.org/PR34571 - -2007-12-26 Rask Ingemann Lambertsen - - PR target/34571 - * config/alpha/alpha.c (alpha_cannot_force_const_mem): Use - symbolic_operand. - * varasm.c (output_constant_pool_1): Fix typo. - -diff -durN gcc-4.3.1.orig/gcc/config/alpha/alpha.c gcc-4.3.1/gcc/config/alpha/alpha.c ---- gcc-4.3.1.orig/gcc/config/alpha/alpha.c 2008-02-07 18:45:24.000000000 +0100 -+++ gcc-4.3.1/gcc/config/alpha/alpha.c 2008-06-10 14:58:24.000000000 +0200 -@@ -1113,8 +1113,7 @@ - static bool - alpha_cannot_force_const_mem (rtx x) - { -- enum rtx_code code = GET_CODE (x); -- return code == SYMBOL_REF || code == LABEL_REF || code == CONST; -+ return symbolic_operand (x, GET_MODE (x)); - } - - /* We do not allow indirect calls to be optimized into sibling calls, nor -diff -durN gcc-4.3.1.orig/gcc/varasm.c gcc-4.3.1/gcc/varasm.c ---- gcc-4.3.1.orig/gcc/varasm.c 2007-12-05 22:55:10.000000000 +0100 -+++ gcc-4.3.1/gcc/varasm.c 2008-06-10 14:58:24.000000000 +0200 -@@ -3710,7 +3710,7 @@ - /* FALLTHRU */ - - case LABEL_REF: -- tmp = XEXP (x, 0); -+ tmp = XEXP (tmp, 0); - gcc_assert (!INSN_DELETED_P (tmp)); - gcc_assert (!NOTE_P (tmp) - || NOTE_KIND (tmp) != NOTE_INSN_DELETED); diff --git a/patches/gcc/4.3.1/450-pr25343.patch b/patches/gcc/4.3.1/450-pr25343.patch deleted file mode 100644 index 776f607..0000000 --- a/patches/gcc/4.3.1/450-pr25343.patch +++ /dev/null @@ -1,21 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/66_all_gcc43-pr25343.patch -http://gcc.gnu.org/PR25343 - -sniped from Debian - -2008-04-27 Roman Zippel - - * config/host-linux.c (TRY_EMPTY_VM_SPACE): Define for __mc68000__. - -diff -durN gcc-4.3.1.orig/gcc/config/host-linux.c gcc-4.3.1/gcc/config/host-linux.c ---- gcc-4.3.1.orig/gcc/config/host-linux.c 2007-08-02 12:49:31.000000000 +0200 -+++ gcc-4.3.1/gcc/config/host-linux.c 2008-06-10 14:58:28.000000000 +0200 -@@ -84,6 +84,8 @@ - # define TRY_EMPTY_VM_SPACE 0x8000000000 - #elif defined(__sparc__) - # define TRY_EMPTY_VM_SPACE 0x60000000 -+#elif defined(__mc68000__) -+# define TRY_EMPTY_VM_SPACE 0x40000000 - #else - # define TRY_EMPTY_VM_SPACE 0 - #endif diff --git a/patches/gcc/4.3.1/475-sh-pr24836.patch b/patches/gcc/4.3.1/475-sh-pr24836.patch deleted file mode 100644 index 753e264..0000000 --- a/patches/gcc/4.3.1/475-sh-pr24836.patch +++ /dev/null @@ -1,28 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/gentoo/74_all_sh-pr24836.patch -http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348 -http://gcc.gnu.org/PR24836 - -diff -durN gcc-4.3.1.orig/gcc/configure gcc-4.3.1/gcc/configure ---- gcc-4.3.1.orig/gcc/configure 2008-06-10 14:57:48.000000000 +0200 -+++ gcc-4.3.1/gcc/configure 2008-06-10 14:58:32.000000000 +0200 -@@ -14709,7 +14709,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 -durN gcc-4.3.1.orig/gcc/configure.ac gcc-4.3.1/gcc/configure.ac ---- gcc-4.3.1.orig/gcc/configure.ac 2008-06-10 14:57:48.000000000 +0200 -+++ gcc-4.3.1/gcc/configure.ac 2008-06-10 14:58:32.000000000 +0200 -@@ -2537,7 +2537,7 @@ - tls_first_minor=14 - tls_as_opt="-m64 -Aesame --fatal-warnings" - ;; -- sh-*-* | sh[34]-*-*) -+ sh-*-* | sh[34]*-*-*) - conftest_s=' - .section ".tdata","awT",@progbits - foo: .long 25 diff --git a/patches/gcc/4.3.1/500-uclibc-conf-noupstream.patch b/patches/gcc/4.3.1/500-uclibc-conf-noupstream.patch deleted file mode 100644 index 5176968..0000000 --- a/patches/gcc/4.3.1/500-uclibc-conf-noupstream.patch +++ /dev/null @@ -1,13 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_103-uclibc-conf-noupstream.patch -diff -durN gcc-4.3.1.orig/gcc/config.gcc gcc-4.3.1/gcc/config.gcc ---- gcc-4.3.1.orig/gcc/config.gcc 2008-06-10 14:58:09.000000000 +0200 -+++ gcc-4.3.1/gcc/config.gcc 2008-06-10 14:58:36.000000000 +0200 -@@ -2149,7 +2149,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/patches/gcc/4.3.1/525-uclibc-locale.patch b/patches/gcc/4.3.1/525-uclibc-locale.patch deleted file mode 100644 index 6ba5fd9..0000000 --- a/patches/gcc/4.3.1/525-uclibc-locale.patch +++ /dev/null @@ -1,2794 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_200-uclibc-locale.patch -diff -durN gcc-4.3.1.orig/libstdc++-v3/acinclude.m4 gcc-4.3.1/libstdc++-v3/acinclude.m4 ---- gcc-4.3.1.orig/libstdc++-v3/acinclude.m4 2008-04-25 18:52:57.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/acinclude.m4 2008-06-10 14:58:39.000000000 +0200 -@@ -1349,7 +1349,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 -@@ -1370,6 +1370,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) - enable_clocale_flag=gnu - ;; -@@ -1541,6 +1544,40 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ AC_MSG_RESULT(uclibc) -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ AC_SUBST(glibcxx_MOFILES) -+ AC_SUBST(glibcxx_POFILES) -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-06-10 14:58:39.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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 -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:58:39.000000000 +0200 -@@ -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 -+ -+#include // For errno -+#include -+#include -+#include -+#include -+ -+#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 -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:58:39.000000000 +0200 -@@ -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 -+ -+#ifndef _C_LOCALE_H -+#define _C_LOCALE_H 1 -+ -+#pragma GCC system_header -+ -+#include // get std::strlen -+#include // get std::snprintf or std::sprintf -+#include -+#include // For codecvt -+#ifdef __UCLIBC_MJN3_ONLY__ -+#warning fix this -+#endif -+#ifdef __UCLIBC_HAS_LOCALE__ -+#include // For codecvt using iconv, iconv_t -+#endif -+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ -+#include // 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 -+ 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 -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2008-06-10 14:58:39.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+namespace std -+{ -+ // Specializations. -+#ifdef _GLIBCXX_USE_WCHAR_T -+ codecvt_base::result -+ codecvt:: -+ 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(-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(__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:: -+ 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(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(-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(-1) -+ || __conv == static_cast(-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:: -+ 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:: -+ 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:: -+ 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(__builtin_alloca(sizeof(wchar_t) -+ * __max)); -+ while (__from < __end && __max) -+ { -+ const extern_type* __from_chunk_end; -+ __from_chunk_end = static_cast(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(-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(-1) -+ || __conv == static_cast(-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 -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/collate_members.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2008-06-10 14:58:39.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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::_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::_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::_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::_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 -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:58:39.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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 specializations are in src/locale.cc and -+ // various /config/os/* files. -+ template<> -+ ctype_byname::ctype_byname(const char* __s, size_t __refs) -+ : ctype(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::__wmask_type -+ ctype::_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::do_toupper(wchar_t __c) const -+ { return __towupper_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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::do_tolower(wchar_t __c) const -+ { return __towlower_l(__c, _M_c_locale_ctype); } -+ -+ const wchar_t* -+ ctype::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:: -+ 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:: -+ 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:: -+ 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:: -+ 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:: -+ do_widen(char __c) const -+ { return _M_widen[static_cast(__c)]; } -+ -+ const char* -+ ctype:: -+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const -+ { -+ while (__lo < __hi) -+ { -+ *__dest = _M_widen[static_cast(*__lo)]; -+ ++__lo; -+ ++__dest; -+ } -+ return __hi; -+ } -+ -+ char -+ ctype:: -+ 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(__c)); -+ } -+ -+ const wchar_t* -+ ctype:: -+ 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(__c)); -+ } -+ ++__lo; -+ ++__dest; -+ } -+ else -+ while (__lo < __hi) -+ { -+ const int __c = wctob(*__lo); -+ *__dest = (__c == EOF ? __dfault : static_cast(__c)); -+ ++__lo; -+ ++__dest; -+ } -+#ifdef __UCLIBC_HAS_XLOCALE__ -+ __uselocale(__old); -+#endif -+ return __hi; -+ } -+ -+ void -+ ctype::_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(__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(_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 -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2008-06-10 14:58:39.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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::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(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::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 -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:58:39.000000000 +0200 -@@ -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 -+ -+#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 -+ messages<_CharT>::messages(size_t __refs) -+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), -+ _M_name_messages(_S_get_c_name()) -+ { } -+ -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::open(const basic_string& __s, const locale& __loc, -+ const char* __dir) const -+ { -+ __bindtextdomain(__s.c_str(), __dir); -+ return this->do_open(__s, __loc); -+ } -+ -+ // Virtual member functions. -+ template -+ 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 messages<_CharT>::catalog -+ messages<_CharT>::do_open(const basic_string& __s, -+ const locale&) const -+ { -+ // No error checking is done, assume the catalog exists and can -+ // be used. -+ __textdomain(__s.c_str()); -+ return 0; -+ } -+ -+ template -+ void -+ messages<_CharT>::do_close(catalog) const -+ { } -+ -+ // messages_byname -+ template -+ 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 -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:58:39.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::_M_initialize_moneypunct(__c_locale __cloc, -+ const char*) -+ { -+ if (!_M_data) -+ _M_data = new __moneypunct_cache; -+ -+ 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::~moneypunct() -+ { delete _M_data; } -+ -+ template<> -+ moneypunct::~moneypunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ moneypunct::_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; -+ -+ 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(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::_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; -+ -+ 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(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::~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::~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 -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:58:39.000000000 +0200 -@@ -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 -+ -+#define _LIBC -+#include -+#undef _LIBC -+#include -+ -+#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::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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::~numpunct() -+ { delete _M_data; } -+ -+#ifdef _GLIBCXX_USE_WCHAR_T -+ template<> -+ void -+ numpunct::_M_initialize_numpunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __numpunct_cache; -+ -+ 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(__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(__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::~numpunct() -+ { delete _M_data; } -+ #endif -+} -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-06-10 14:58:39.000000000 +0200 -@@ -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 -+ -+#include -+#include -+ -+#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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+ 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:: -+ _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::_M_initialize_timepunct(__c_locale __cloc) -+ { -+ if (!_M_data) -+ _M_data = new __timepunct_cache; -+ -+#warning wide time stuff -+// if (!__cloc) -+ { -+ // "C" locale -+ _M_c_locale_timepunct = _S_get_c_locale(); -+ -+ _M_data->_M_date_format = L"%m/%d/%y"; -+ _M_data->_M_date_era_format = L"%m/%d/%y"; -+ _M_data->_M_time_format = L"%H:%M:%S"; -+ _M_data->_M_time_era_format = L"%H:%M:%S"; -+ _M_data->_M_date_time_format = L""; -+ _M_data->_M_date_time_era_format = L""; -+ _M_data->_M_am = L"AM"; -+ _M_data->_M_pm = L"PM"; -+ _M_data->_M_am_pm_format = L""; -+ -+ // Day names, starting with "C"'s Sunday. -+ _M_data->_M_day1 = L"Sunday"; -+ _M_data->_M_day2 = L"Monday"; -+ _M_data->_M_day3 = L"Tuesday"; -+ _M_data->_M_day4 = L"Wednesday"; -+ _M_data->_M_day5 = L"Thursday"; -+ _M_data->_M_day6 = L"Friday"; -+ _M_data->_M_day7 = L"Saturday"; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ _M_data->_M_aday1 = L"Sun"; -+ _M_data->_M_aday2 = L"Mon"; -+ _M_data->_M_aday3 = L"Tue"; -+ _M_data->_M_aday4 = L"Wed"; -+ _M_data->_M_aday5 = L"Thu"; -+ _M_data->_M_aday6 = L"Fri"; -+ _M_data->_M_aday7 = L"Sat"; -+ -+ // Month names, starting with "C"'s January. -+ _M_data->_M_month01 = L"January"; -+ _M_data->_M_month02 = L"February"; -+ _M_data->_M_month03 = L"March"; -+ _M_data->_M_month04 = L"April"; -+ _M_data->_M_month05 = L"May"; -+ _M_data->_M_month06 = L"June"; -+ _M_data->_M_month07 = L"July"; -+ _M_data->_M_month08 = L"August"; -+ _M_data->_M_month09 = L"September"; -+ _M_data->_M_month10 = L"October"; -+ _M_data->_M_month11 = L"November"; -+ _M_data->_M_month12 = L"December"; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ _M_data->_M_amonth01 = L"Jan"; -+ _M_data->_M_amonth02 = L"Feb"; -+ _M_data->_M_amonth03 = L"Mar"; -+ _M_data->_M_amonth04 = L"Apr"; -+ _M_data->_M_amonth05 = L"May"; -+ _M_data->_M_amonth06 = L"Jun"; -+ _M_data->_M_amonth07 = L"Jul"; -+ _M_data->_M_amonth08 = L"Aug"; -+ _M_data->_M_amonth09 = L"Sep"; -+ _M_data->_M_amonth10 = L"Oct"; -+ _M_data->_M_amonth11 = L"Nov"; -+ _M_data->_M_amonth12 = L"Dec"; -+ } -+#if 0 -+ else -+ { -+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc); -+ -+ union { char *__s; wchar_t *__w; } __u; -+ -+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); -+ _M_data->_M_date_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); -+ _M_data->_M_date_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); -+ _M_data->_M_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); -+ _M_data->_M_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); -+ _M_data->_M_date_time_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); -+ _M_data->_M_date_time_era_format = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); -+ _M_data->_M_am = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); -+ _M_data->_M_pm = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); -+ _M_data->_M_am_pm_format = __u.__w; -+ -+ // Day names, starting with "C"'s Sunday. -+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); -+ _M_data->_M_day1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); -+ _M_data->_M_day2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); -+ _M_data->_M_day3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); -+ _M_data->_M_day4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); -+ _M_data->_M_day5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); -+ _M_data->_M_day6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); -+ _M_data->_M_day7 = __u.__w; -+ -+ // Abbreviated day names, starting with "C"'s Sun. -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); -+ _M_data->_M_aday1 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); -+ _M_data->_M_aday2 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); -+ _M_data->_M_aday3 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); -+ _M_data->_M_aday4 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); -+ _M_data->_M_aday5 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); -+ _M_data->_M_aday6 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); -+ _M_data->_M_aday7 = __u.__w; -+ -+ // Month names, starting with "C"'s January. -+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); -+ _M_data->_M_month01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); -+ _M_data->_M_month02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); -+ _M_data->_M_month03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); -+ _M_data->_M_month04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); -+ _M_data->_M_month05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); -+ _M_data->_M_month06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); -+ _M_data->_M_month07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); -+ _M_data->_M_month08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); -+ _M_data->_M_month09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); -+ _M_data->_M_month10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); -+ _M_data->_M_month11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); -+ _M_data->_M_month12 = __u.__w; -+ -+ // Abbreviated month names, starting with "C"'s Jan. -+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); -+ _M_data->_M_amonth01 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); -+ _M_data->_M_amonth02 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); -+ _M_data->_M_amonth03 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); -+ _M_data->_M_amonth04 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); -+ _M_data->_M_amonth05 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); -+ _M_data->_M_amonth06 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); -+ _M_data->_M_amonth07 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); -+ _M_data->_M_amonth08 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); -+ _M_data->_M_amonth09 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); -+ _M_data->_M_amonth10 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); -+ _M_data->_M_amonth11 = __u.__w; -+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); -+ _M_data->_M_amonth12 = __u.__w; -+ } -+#endif // 0 -+ } -+#endif -+} -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:58:39.000000000 +0200 -@@ -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 -+ -+ template -+ __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 -+ __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 -+ __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 -+ __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 -durN gcc-4.3.1.orig/libstdc++-v3/configure gcc-4.3.1/libstdc++-v3/configure ---- gcc-4.3.1.orig/libstdc++-v3/configure 2008-04-25 18:52:57.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/configure 2008-06-10 14:58:39.000000000 +0200 -@@ -14001,7 +14001,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; }; } ;; -@@ -14034,6 +14034,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) - enable_clocale_flag=gnu - ;; -@@ -14422,6 +14425,76 @@ - CTIME_CC=config/locale/generic/time_members.cc - CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h - ;; -+ uclibc) -+ echo "$as_me:$LINENO: result: uclibc" >&5 -+echo "${ECHO_T}uclibc" >&6 -+ -+ # Declare intention to use gettext, and add support for specific -+ # languages. -+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT -+ ALL_LINGUAS="de fr" -+ -+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. -+ # Extract the first word of "msgfmt", so it can be a program name with args. -+set dummy msgfmt; ac_word=$2 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_prog_check_msgfmt+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 -+else -+ if test -n "$check_msgfmt"; then -+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. -+else -+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -+for as_dir in $PATH -+do -+ IFS=$as_save_IFS -+ test -z "$as_dir" && as_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -+ ac_cv_prog_check_msgfmt="yes" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 -+ break 2 -+ fi -+done -+done -+ -+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" -+fi -+fi -+check_msgfmt=$ac_cv_prog_check_msgfmt -+if test -n "$check_msgfmt"; then -+ echo "$as_me:$LINENO: result: $check_msgfmt" >&5 -+echo "${ECHO_T}$check_msgfmt" >&6 -+else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 -+fi -+ -+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then -+ USE_NLS=yes -+ fi -+ # Export the build objects. -+ for ling in $ALL_LINGUAS; do \ -+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ -+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ -+ done -+ -+ -+ -+ CLOCALE_H=config/locale/uclibc/c_locale.h -+ CLOCALE_CC=config/locale/uclibc/c_locale.cc -+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc -+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc -+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc -+ CMESSAGES_H=config/locale/uclibc/messages_members.h -+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc -+ CMONEY_CC=config/locale/uclibc/monetary_members.cc -+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc -+ CTIME_H=config/locale/uclibc/time_members.h -+ CTIME_CC=config/locale/uclibc/time_members.cc -+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h -+ ;; - esac - - # This is where the testsuite looks for locale catalogs, using the -diff -durN gcc-4.3.1.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.3.1/libstdc++-v3/include/c_compatibility/wchar.h ---- gcc-4.3.1.orig/libstdc++-v3/include/c_compatibility/wchar.h 2007-03-04 23:59:49.000000000 +0100 -+++ gcc-4.3.1/libstdc++-v3/include/c_compatibility/wchar.h 2008-06-10 14:58:39.000000000 +0200 -@@ -106,7 +106,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 --git a/patches/gcc/4.3.1/550-uclibc-locale-no__x.patch b/patches/gcc/4.3.1/550-uclibc-locale-no__x.patch deleted file mode 100644 index 68c6e31..0000000 --- a/patches/gcc/4.3.1/550-uclibc-locale-no__x.patch +++ /dev/null @@ -1,224 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_203-uclibc-locale-no__x.patch -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-06-10 14:58:43.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-06-10 14:58:43.000000000 +0200 -@@ -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 -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:58:43.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:58:43.000000000 +0200 -@@ -39,20 +39,6 @@ - #include - #include - --#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<> -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:58:43.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:58:43.000000000 +0200 -@@ -68,6 +68,7 @@ - { - extern "C" __typeof(uselocale) __uselocale; - } -+#define __uselocale uselocale - #endif - - namespace std -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/collate_members.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 2008-06-10 14:58:43.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2008-06-10 14:58:43.000000000 +0200 -@@ -36,13 +36,6 @@ - #include - #include - --#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 -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:58:43.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:58:43.000000000 +0200 -@@ -38,13 +38,6 @@ - #undef _LIBC - #include - --#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 specializations are in src/locale.cc and -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 2008-06-10 14:58:43.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2008-06-10 14:58:43.000000000 +0200 -@@ -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 - -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:58:43.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:58:43.000000000 +0200 -@@ -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& __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; - } - -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:58:43.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:58:43.000000000 +0200 -@@ -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: -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:58:43.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:58:43.000000000 +0200 -@@ -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 - { -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-06-10 14:58:43.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-06-10 14:58:43.000000000 +0200 -@@ -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 - { diff --git a/patches/gcc/4.3.1/575-uclibc-locale-wchar_fix.patch b/patches/gcc/4.3.1/575-uclibc-locale-wchar_fix.patch deleted file mode 100644 index af26649..0000000 --- a/patches/gcc/4.3.1/575-uclibc-locale-wchar_fix.patch +++ /dev/null @@ -1,51 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_204-uclibc-locale-wchar_fix.patch -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:58:47.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:58:47.000000000 +0200 -@@ -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 -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:58:47.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:58:47.000000000 +0200 -@@ -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/patches/gcc/4.3.1/600-uclibc-locale-update.patch b/patches/gcc/4.3.1/600-uclibc-locale-update.patch deleted file mode 100644 index 8fef5e4..0000000 --- a/patches/gcc/4.3.1/600-uclibc-locale-update.patch +++ /dev/null @@ -1,355 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_205-uclibc-locale-update.patch -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:58:47.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:58:51.000000000 +0200 -@@ -46,16 +46,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 +60,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 +74,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 +101,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); - } - -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.h ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:58:47.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:58:51.000000000 +0200 -@@ -39,21 +39,23 @@ - #pragma GCC system_header - - #include // get std::strlen --#include // get std::snprintf or std::sprintf -+#include // get std::vsnprintf or std::vsprintf - #include - #include // For codecvt - #ifdef __UCLIBC_MJN3_ONLY__ - #warning fix this - #endif --#ifdef __UCLIBC_HAS_LOCALE__ -+#ifdef _GLIBCXX_USE_ICONV - #include // For codecvt using iconv, iconv_t - #endif --#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ --#include // For messages -+#ifdef HAVE_LIBINTL_H -+#include // For messages - #endif -+#include - - #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 -- 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 -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:58:47.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:58:51.000000000 +0200 -@@ -33,9 +33,14 @@ - - // Written by Benjamin Kosnik - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - namespace std -@@ -138,20 +143,34 @@ - ctype:: - 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:: - do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:58:47.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:58:51.000000000 +0200 -@@ -47,18 +47,21 @@ - template - 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 - 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 -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:58:51.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:58:51.000000000 +0200 -@@ -33,9 +33,14 @@ - - // Written by Benjamin Kosnik - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - #ifdef __UCLIBC_MJN3_ONLY__ -@@ -206,7 +211,7 @@ - } - break; - default: -- ; -+ __ret = pattern(); - } - return __ret; - } -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:58:51.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:58:51.000000000 +0200 -@@ -33,9 +33,14 @@ - - // Written by Benjamin Kosnik - -+#include -+#ifdef __UCLIBC_HAS_LOCALE__ - #define _LIBC - #include - #undef _LIBC -+#else -+#include -+#endif - #include - - #ifdef __UCLIBC_MJN3_ONLY__ -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:58:43.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:58:51.000000000 +0200 -@@ -37,25 +37,33 @@ - template - __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 - __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 - __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 diff --git a/patches/gcc/4.3.1/625-missing-execinfo_h.patch b/patches/gcc/4.3.1/625-missing-execinfo_h.patch deleted file mode 100644 index fa749b2..0000000 --- a/patches/gcc/4.3.1/625-missing-execinfo_h.patch +++ /dev/null @@ -1,13 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_301-missing-execinfo_h.patch -diff -durN gcc-4.3.1.orig/boehm-gc/include/gc.h gcc-4.3.1/boehm-gc/include/gc.h ---- gcc-4.3.1.orig/boehm-gc/include/gc.h 2007-04-23 23:10:09.000000000 +0200 -+++ gcc-4.3.1/boehm-gc/include/gc.h 2008-06-10 14:58:54.000000000 +0200 -@@ -503,7 +503,7 @@ - #if defined(__linux__) || defined(__GLIBC__) - # include - # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ -- && !defined(__ia64__) -+ && !defined(__ia64__) && !defined(__UCLIBC__) - # ifndef GC_HAVE_BUILTIN_BACKTRACE - # define GC_HAVE_BUILTIN_BACKTRACE - # endif diff --git a/patches/gcc/4.3.1/650-c99-complex-ugly-hack.patch b/patches/gcc/4.3.1/650-c99-complex-ugly-hack.patch deleted file mode 100644 index 7aa36f8..0000000 --- a/patches/gcc/4.3.1/650-c99-complex-ugly-hack.patch +++ /dev/null @@ -1,14 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_303-c99-complex-ugly-hack.patch -diff -durN gcc-4.3.1.orig/libstdc++-v3/configure gcc-4.3.1/libstdc++-v3/configure ---- gcc-4.3.1.orig/libstdc++-v3/configure 2008-06-10 14:58:43.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/configure 2008-06-10 14:58:58.000000000 +0200 -@@ -39006,6 +39006,9 @@ - cat >>conftest.$ac_ext <<_ACEOF - /* end confdefs.h. */ - #include -+#ifdef __UCLIBC__ -+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs -+#endif - int - main () - { diff --git a/patches/gcc/4.3.1/675-index_macro.patch b/patches/gcc/4.3.1/675-index_macro.patch deleted file mode 100644 index 65794aa..0000000 --- a/patches/gcc/4.3.1/675-index_macro.patch +++ /dev/null @@ -1,27 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_304-index_macro.patch -diff -durN gcc-4.3.1.orig/libstdc++-v3/include/ext/rope gcc-4.3.1/libstdc++-v3/include/ext/rope ---- gcc-4.3.1.orig/libstdc++-v3/include/ext/rope 2008-01-31 19:44:55.000000000 +0100 -+++ gcc-4.3.1/libstdc++-v3/include/ext/rope 2008-06-10 14:59:02.000000000 +0200 -@@ -59,6 +59,9 @@ - #include - #include - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - # ifdef __GC - # define __GC_CONST const - # else -diff -durN gcc-4.3.1.orig/libstdc++-v3/include/ext/ropeimpl.h gcc-4.3.1/libstdc++-v3/include/ext/ropeimpl.h ---- gcc-4.3.1.orig/libstdc++-v3/include/ext/ropeimpl.h 2007-05-04 17:06:46.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/include/ext/ropeimpl.h 2008-06-10 14:59:02.000000000 +0200 -@@ -54,6 +54,9 @@ - #include // For uninitialized_copy_n - #include // For power - -+/* cope w/ index defined as macro, SuSv3 proposal */ -+#undef index -+ - _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) - - using std::size_t; diff --git a/patches/gcc/4.3.1/700-libmudflap-susv3-legacy.patch b/patches/gcc/4.3.1/700-libmudflap-susv3-legacy.patch deleted file mode 100644 index 9672fc4..0000000 --- a/patches/gcc/4.3.1/700-libmudflap-susv3-legacy.patch +++ /dev/null @@ -1,49 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_305-libmudflap-susv3-legacy.patch -diff -durN gcc-4.3.1.orig/libmudflap/mf-hooks2.c gcc-4.3.1/libmudflap/mf-hooks2.c ---- gcc-4.3.1.orig/libmudflap/mf-hooks2.c 2005-09-23 23:58:39.000000000 +0200 -+++ gcc-4.3.1/libmudflap/mf-hooks2.c 2008-06-10 14:59:05.000000000 +0200 -@@ -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 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/patches/gcc/4.3.1/725-libstdc++-namespace.patch b/patches/gcc/4.3.1/725-libstdc++-namespace.patch deleted file mode 100644 index eee4e50..0000000 --- a/patches/gcc/4.3.1/725-libstdc++-namespace.patch +++ /dev/null @@ -1,38 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.1/uclibc/90_all_306-libstdc++-namespace.patch -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 -diff -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:58:54.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:59:09.000000000 +0200 -@@ -32,7 +32,8 @@ - // - - // Written by Benjamin Kosnik -- -+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 -durN gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.h ---- gcc-4.3.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:58:54.000000000 +0200 -+++ gcc-4.3.1/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:59:09.000000000 +0200 -@@ -33,7 +33,8 @@ - // - - // Written by Benjamin Kosnik -- -+namespace std -+{ - template - __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/patches/gcc/4.3.1/750-arm-softfloat.patch b/patches/gcc/4.3.1/750-arm-softfloat.patch deleted file mode 100644 index 4e7ea7c..0000000 --- a/patches/gcc/4.3.1/750-arm-softfloat.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff -durN gcc-4.3.1.orig/gcc/config/arm/linux-elf.h gcc-4.3.1/gcc/config/arm/linux-elf.h ---- gcc-4.3.1.orig/gcc/config/arm/linux-elf.h 2007-11-08 14:44:09.000000000 +0100 -+++ gcc-4.3.1/gcc/config/arm/linux-elf.h 2008-07-23 15:30:57.000000000 +0200 -@@ -60,7 +60,7 @@ - %{shared:-lc} \ - %{!shared:%{profile:-lc_p}%{!profile:-lc}}" - --#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" -+#define LIBGCC_SPEC "-lgcc" - - #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" - -diff -durN gcc-4.3.1.orig/gcc/config/arm/t-linux gcc-4.3.1/gcc/config/arm/t-linux ---- gcc-4.3.1.orig/gcc/config/arm/t-linux 2006-11-09 23:14:27.000000000 +0100 -+++ gcc-4.3.1/gcc/config/arm/t-linux 2008-07-23 19:15:25.000000000 +0200 -@@ -3,7 +3,12 @@ - TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC - - LIB1ASMSRC = arm/lib1funcs.asm --LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx -+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func \ -+ _call_via_rX _interwork_call_via_rX \ -+ _lshrdi3 _ashrdi3 _ashldi3 \ -+ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ -+ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ -+ _fixsfsi _fixunssfsi _floatdidf _floatdisf _floatundidf _floatundisf - - # MULTILIB_OPTIONS = mhard-float/msoft-float - # MULTILIB_DIRNAMES = hard-float soft-float diff --git a/patches/gcc/4.3.1/940-alpha-signal_h.patch b/patches/gcc/4.3.1/940-alpha-signal_h.patch deleted file mode 100644 index d7e1796..0000000 --- a/patches/gcc/4.3.1/940-alpha-signal_h.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- gcc-4.2.1-stock/gcc/config/alpha/linux-unwind.h 2005-06-24 20:22:41.000000000 -0500 -+++ gcc-4.2.1/gcc/config/alpha/linux-unwind.h 2007-09-01 20:21:34.000000000 -0500 -@@ -29,6 +29,9 @@ Boston, MA 02110-1301, USA. */ - /* Do code reading to identify a signal frame, and set the frame - state data appropriately. See unwind-dw2.c for the structs. */ - -+/* Don't use this if inhibit_libc is set -+ The build for this target will fail trying to include missing headers */ -+#ifndef inhibit_libc - #include - #include - -@@ -80,3 +83,4 @@ alpha_fallback_frame_state (struct _Unwi - fs->retaddr_column = 64; - return _URC_NO_REASON; - } -+#endif /* inhibit_libc */ diff --git a/patches/gdb/6.4/110-uclibc-readline-conf.patch b/patches/gdb/6.4/110-uclibc-readline-conf.patch new file mode 100644 index 0000000..ffe792d --- /dev/null +++ b/patches/gdb/6.4/110-uclibc-readline-conf.patch @@ -0,0 +1,15 @@ +--- gdb-6.1.1-dist/readline/configure 2003-05-27 18:29:47.000000000 -0500 ++++ gdb-6.1.1/readline/configure 2004-08-09 14:20:23.000000000 -0500 +@@ -6249,7 +6249,12 @@ + + + echo "$as_me:$LINENO: checking for mbstate_t" >&5 ++echo $ECHO_N "bash_cv_have_mbstate_t=$bash_cv_have_mbstate_t" >&6 + echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6 ++if test "${bash_cv_have_mbstate_t+set}" != set; then ++ bash_cv_have_mbstate_t=yes ++ echo $ECHO_N "WARNING!! forcing to yes!!! $ECHO_C" >&6 ++fi + if test "${bash_cv_have_mbstate_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else diff --git a/patches/gdb/6.4/120-thread-timeout.patch b/patches/gdb/6.4/120-thread-timeout.patch new file mode 100644 index 0000000..6db0a7a --- /dev/null +++ b/patches/gdb/6.4/120-thread-timeout.patch @@ -0,0 +1,34 @@ +--- gdb-6.3.org/gdb/gdbserver/thread-db.c 2004-10-17 02:42:00.000000000 +0900 ++++ gdb-6.3/gdb/gdbserver/thread-db.c 2005-01-27 12:19:29.000000000 +0900 +@@ -21,6 +21,7 @@ + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + ++#include + #include "server.h" + + #include "linux-low.h" +@@ -142,6 +143,7 @@ + td_event_msg_t msg; + td_err_e err; + struct inferior_linux_data *tdata; ++ int timeout; + + if (debug_threads) + fprintf (stderr, "Thread creation event.\n"); +@@ -152,7 +154,13 @@ + In the LinuxThreads implementation, this is safe, + because all events come from the manager thread + (except for its own creation, of course). */ +- err = td_ta_event_getmsg (thread_agent, &msg); ++ for (timeout = 0; timeout < 50000; timeout++) ++ { ++ err = td_ta_event_getmsg (thread_agent, &msg); ++ if (err != TD_NOMSG) ++ break; ++ usleep(1000); ++ } + if (err != TD_OK) + fprintf (stderr, "thread getmsg err: %s\n", + thread_db_err_str (err)); + diff --git a/patches/gdb/6.4/130-fix-compile-flag-mismatch.patch b/patches/gdb/6.4/130-fix-compile-flag-mismatch.patch new file mode 100644 index 0000000..659a5f0 --- /dev/null +++ b/patches/gdb/6.4/130-fix-compile-flag-mismatch.patch @@ -0,0 +1,87 @@ +diff -ur gdb-6.4/gdb/configure gdb-6.4-patched/gdb/configure +--- gdb-6.4/gdb/configure 2005-07-25 10:08:40.000000000 -0500 ++++ gdb-6.4-patched/gdb/configure 2007-02-05 13:22:36.000000000 -0600 +@@ -309,7 +309,7 @@ + # include + #endif" + +-ac_subdirs_all="$ac_subdirs_all doc testsuite" ++ac_subdirs_all="$ac_subdirs_all doc" + ac_subdirs_all="$ac_subdirs_all gdbtk" + ac_subdirs_all="$ac_subdirs_all multi-ice" + ac_subdirs_all="$ac_subdirs_all gdbserver" +@@ -5940,7 +5940,7 @@ + + + +-subdirs="$subdirs doc testsuite" ++subdirs="$subdirs doc" + + + . $srcdir/configure.host +diff -ur gdb-6.4/gdb/gdbserver/configure gdb-6.4-patched/gdb/gdbserver/configure +--- gdb-6.4/gdb/gdbserver/configure 2005-09-17 18:14:37.000000000 -0500 ++++ gdb-6.4-patched/gdb/gdbserver/configure 2007-02-05 13:22:58.000000000 -0600 +@@ -1239,7 +1239,7 @@ + ac_cache_corrupted=: ;; + ,);; + *) +- if test "x$ac_old_val" != "x$ac_new_val"; then ++ if test "`echo $ac_old_val`" != "`echo $ac_new_val`"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 + echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +diff -ur gdb-6.4/gdb/testsuite/configure gdb-6.4-patched/gdb/testsuite/configure +--- gdb-6.4/gdb/testsuite/configure 2005-04-11 09:13:12.000000000 -0500 ++++ gdb-6.4-patched/gdb/testsuite/configure 2007-02-05 13:22:36.000000000 -0600 +@@ -1248,7 +1248,7 @@ + ac_cache_corrupted=: ;; + ,);; + *) +- if test "x$ac_old_val" != "x$ac_new_val"; then ++ if test "`echo $ac_old_val" != "`echo $ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 + echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +diff -ur gdb-6.4/Makefile.in gdb-6.4-patched/Makefile.in +--- gdb-6.4/Makefile.in 2005-12-01 23:29:54.000000000 -0600 ++++ gdb-6.4-patched/Makefile.in 2007-02-05 13:22:36.000000000 -0600 +@@ -383,7 +383,7 @@ + # CFLAGS will be just -g. We want to ensure that TARGET libraries + # (which we know are built with gcc) are built with optimizations so + # prepend -O2 when setting CFLAGS_FOR_TARGET. +-CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) ++CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)) + SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ + + # If GCC_FOR_TARGET is not overriden on the command line, then this +@@ -423,7 +423,7 @@ + fi; \ + fi` + +-CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) ++CXXFLAGS_FOR_TARGET = $(strip $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)) + LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates + + GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET) +diff -ur gdb-6.4/Makefile.tpl gdb-6.4-patched/Makefile.tpl +--- gdb-6.4/Makefile.tpl 2005-10-22 05:37:55.000000000 -0500 ++++ gdb-6.4-patched/Makefile.tpl 2007-02-05 13:22:36.000000000 -0600 +@@ -386,7 +386,7 @@ + # CFLAGS will be just -g. We want to ensure that TARGET libraries + # (which we know are built with gcc) are built with optimizations so + # prepend -O2 when setting CFLAGS_FOR_TARGET. +-CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) ++CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)) + SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ + + # If GCC_FOR_TARGET is not overriden on the command line, then this +@@ -426,7 +426,7 @@ + fi; \ + fi` + +-CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) ++CXXFLAGS_FOR_TARGET = $(strip $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)) + LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates + + GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET) diff --git a/patches/gdb/6.4/200-uclibc-readline-conf.patch b/patches/gdb/6.4/200-uclibc-readline-conf.patch deleted file mode 100644 index ffe792d..0000000 --- a/patches/gdb/6.4/200-uclibc-readline-conf.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- gdb-6.1.1-dist/readline/configure 2003-05-27 18:29:47.000000000 -0500 -+++ gdb-6.1.1/readline/configure 2004-08-09 14:20:23.000000000 -0500 -@@ -6249,7 +6249,12 @@ - - - echo "$as_me:$LINENO: checking for mbstate_t" >&5 -+echo $ECHO_N "bash_cv_have_mbstate_t=$bash_cv_have_mbstate_t" >&6 - echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6 -+if test "${bash_cv_have_mbstate_t+set}" != set; then -+ bash_cv_have_mbstate_t=yes -+ echo $ECHO_N "WARNING!! forcing to yes!!! $ECHO_C" >&6 -+fi - if test "${bash_cv_have_mbstate_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else diff --git a/patches/gdb/6.4/500-thread-timeout.patch b/patches/gdb/6.4/500-thread-timeout.patch deleted file mode 100644 index 6db0a7a..0000000 --- a/patches/gdb/6.4/500-thread-timeout.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- gdb-6.3.org/gdb/gdbserver/thread-db.c 2004-10-17 02:42:00.000000000 +0900 -+++ gdb-6.3/gdb/gdbserver/thread-db.c 2005-01-27 12:19:29.000000000 +0900 -@@ -21,6 +21,7 @@ - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -+#include - #include "server.h" - - #include "linux-low.h" -@@ -142,6 +143,7 @@ - td_event_msg_t msg; - td_err_e err; - struct inferior_linux_data *tdata; -+ int timeout; - - if (debug_threads) - fprintf (stderr, "Thread creation event.\n"); -@@ -152,7 +154,13 @@ - In the LinuxThreads implementation, this is safe, - because all events come from the manager thread - (except for its own creation, of course). */ -- err = td_ta_event_getmsg (thread_agent, &msg); -+ for (timeout = 0; timeout < 50000; timeout++) -+ { -+ err = td_ta_event_getmsg (thread_agent, &msg); -+ if (err != TD_NOMSG) -+ break; -+ usleep(1000); -+ } - if (err != TD_OK) - fprintf (stderr, "thread getmsg err: %s\n", - thread_db_err_str (err)); - diff --git a/patches/gdb/6.4/600-fix-compile-flag-mismatch.patch b/patches/gdb/6.4/600-fix-compile-flag-mismatch.patch deleted file mode 100644 index 659a5f0..0000000 --- a/patches/gdb/6.4/600-fix-compile-flag-mismatch.patch +++ /dev/null @@ -1,87 +0,0 @@ -diff -ur gdb-6.4/gdb/configure gdb-6.4-patched/gdb/configure ---- gdb-6.4/gdb/configure 2005-07-25 10:08:40.000000000 -0500 -+++ gdb-6.4-patched/gdb/configure 2007-02-05 13:22:36.000000000 -0600 -@@ -309,7 +309,7 @@ - # include - #endif" - --ac_subdirs_all="$ac_subdirs_all doc testsuite" -+ac_subdirs_all="$ac_subdirs_all doc" - ac_subdirs_all="$ac_subdirs_all gdbtk" - ac_subdirs_all="$ac_subdirs_all multi-ice" - ac_subdirs_all="$ac_subdirs_all gdbserver" -@@ -5940,7 +5940,7 @@ - - - --subdirs="$subdirs doc testsuite" -+subdirs="$subdirs doc" - - - . $srcdir/configure.host -diff -ur gdb-6.4/gdb/gdbserver/configure gdb-6.4-patched/gdb/gdbserver/configure ---- gdb-6.4/gdb/gdbserver/configure 2005-09-17 18:14:37.000000000 -0500 -+++ gdb-6.4-patched/gdb/gdbserver/configure 2007-02-05 13:22:58.000000000 -0600 -@@ -1239,7 +1239,7 @@ - ac_cache_corrupted=: ;; - ,);; - *) -- if test "x$ac_old_val" != "x$ac_new_val"; then -+ if test "`echo $ac_old_val`" != "`echo $ac_new_val`"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 - echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -diff -ur gdb-6.4/gdb/testsuite/configure gdb-6.4-patched/gdb/testsuite/configure ---- gdb-6.4/gdb/testsuite/configure 2005-04-11 09:13:12.000000000 -0500 -+++ gdb-6.4-patched/gdb/testsuite/configure 2007-02-05 13:22:36.000000000 -0600 -@@ -1248,7 +1248,7 @@ - ac_cache_corrupted=: ;; - ,);; - *) -- if test "x$ac_old_val" != "x$ac_new_val"; then -+ if test "`echo $ac_old_val" != "`echo $ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 - echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -diff -ur gdb-6.4/Makefile.in gdb-6.4-patched/Makefile.in ---- gdb-6.4/Makefile.in 2005-12-01 23:29:54.000000000 -0600 -+++ gdb-6.4-patched/Makefile.in 2007-02-05 13:22:36.000000000 -0600 -@@ -383,7 +383,7 @@ - # CFLAGS will be just -g. We want to ensure that TARGET libraries - # (which we know are built with gcc) are built with optimizations so - # prepend -O2 when setting CFLAGS_FOR_TARGET. --CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) -+CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)) - SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ - - # If GCC_FOR_TARGET is not overriden on the command line, then this -@@ -423,7 +423,7 @@ - fi; \ - fi` - --CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) -+CXXFLAGS_FOR_TARGET = $(strip $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)) - LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates - - GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET) -diff -ur gdb-6.4/Makefile.tpl gdb-6.4-patched/Makefile.tpl ---- gdb-6.4/Makefile.tpl 2005-10-22 05:37:55.000000000 -0500 -+++ gdb-6.4-patched/Makefile.tpl 2007-02-05 13:22:36.000000000 -0600 -@@ -386,7 +386,7 @@ - # CFLAGS will be just -g. We want to ensure that TARGET libraries - # (which we know are built with gcc) are built with optimizations so - # prepend -O2 when setting CFLAGS_FOR_TARGET. --CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) -+CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)) - SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ - - # If GCC_FOR_TARGET is not overriden on the command line, then this -@@ -426,7 +426,7 @@ - fi; \ - fi` - --CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) -+CXXFLAGS_FOR_TARGET = $(strip $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)) - LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates - - GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET) diff --git a/patches/gdb/6.5/110-uclibc-readline-conf.patch b/patches/gdb/6.5/110-uclibc-readline-conf.patch new file mode 100644 index 0000000..ffe792d --- /dev/null +++ b/patches/gdb/6.5/110-uclibc-readline-conf.patch @@ -0,0 +1,15 @@ +--- gdb-6.1.1-dist/readline/configure 2003-05-27 18:29:47.000000000 -0500 ++++ gdb-6.1.1/readline/configure 2004-08-09 14:20:23.000000000 -0500 +@@ -6249,7 +6249,12 @@ + + + echo "$as_me:$LINENO: checking for mbstate_t" >&5 ++echo $ECHO_N "bash_cv_have_mbstate_t=$bash_cv_have_mbstate_t" >&6 + echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6 ++if test "${bash_cv_have_mbstate_t+set}" != set; then ++ bash_cv_have_mbstate_t=yes ++ echo $ECHO_N "WARNING!! forcing to yes!!! $ECHO_C" >&6 ++fi + if test "${bash_cv_have_mbstate_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else diff --git a/patches/gdb/6.5/120-thread-timeout.patch b/patches/gdb/6.5/120-thread-timeout.patch new file mode 100644 index 0000000..d6f5dd8 --- /dev/null +++ b/patches/gdb/6.5/120-thread-timeout.patch @@ -0,0 +1,33 @@ +--- gdb-6.5/./gdb/gdbserver/thread-db.c.orig 2006-03-15 08:13:29.000000000 -0800 ++++ gdb-6.5/./gdb/gdbserver/thread-db.c 2008-04-01 21:21:23.000000000 -0700 +@@ -21,6 +21,7 @@ + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + ++#include + #include "server.h" + + #include "linux-low.h" +@@ -134,6 +135,7 @@ thread_db_create_event (CORE_ADDR where) + td_event_msg_t msg; + td_err_e err; + struct inferior_linux_data *tdata; ++ int timeout; + + if (debug_threads) + fprintf (stderr, "Thread creation event.\n"); +@@ -144,7 +146,13 @@ thread_db_create_event (CORE_ADDR where) + In the LinuxThreads implementation, this is safe, + because all events come from the manager thread + (except for its own creation, of course). */ +- err = td_ta_event_getmsg (thread_agent, &msg); ++ for (timeout = 0; timeout < 50000; timeout++) ++ { ++ err = td_ta_event_getmsg (thread_agent, &msg); ++ if (err != TD_NOMSG) ++ break; ++ usleep(1000); ++ } + if (err != TD_OK) + fprintf (stderr, "thread getmsg err: %s\n", + thread_db_err_str (err)); diff --git a/patches/gdb/6.5/130-fix-compile-flag-mismatch.patch b/patches/gdb/6.5/130-fix-compile-flag-mismatch.patch new file mode 100644 index 0000000..ba98482 --- /dev/null +++ b/patches/gdb/6.5/130-fix-compile-flag-mismatch.patch @@ -0,0 +1,69 @@ +diff -ur gdb-6.4/gdb/configure gdb-6.4-patched/gdb/configure +--- gdb-6.4/gdb/configure 2005-07-25 10:08:40.000000000 -0500 ++++ gdb-6.4-patched/gdb/configure 2007-02-05 13:22:36.000000000 -0600 +@@ -309,7 +309,7 @@ + # include + #endif" + +-ac_subdirs_all="$ac_subdirs_all doc testsuite" ++ac_subdirs_all="$ac_subdirs_all doc" + ac_subdirs_all="$ac_subdirs_all gdbtk" + ac_subdirs_all="$ac_subdirs_all multi-ice" + ac_subdirs_all="$ac_subdirs_all gdbserver" +@@ -5940,7 +5940,7 @@ + + + +-subdirs="$subdirs doc testsuite" ++subdirs="$subdirs doc" + + + . $srcdir/configure.host +diff -ur gdb-6.4/gdb/gdbserver/configure gdb-6.4-patched/gdb/gdbserver/configure +--- gdb-6.4/gdb/gdbserver/configure 2005-09-17 18:14:37.000000000 -0500 ++++ gdb-6.4-patched/gdb/gdbserver/configure 2007-02-05 13:22:58.000000000 -0600 +@@ -1239,7 +1239,7 @@ + ac_cache_corrupted=: ;; + ,);; + *) +- if test "x$ac_old_val" != "x$ac_new_val"; then ++ if test "`echo $ac_old_val`" != "`echo $ac_new_val`"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 + echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +diff -ur gdb-6.4/gdb/testsuite/configure gdb-6.4-patched/gdb/testsuite/configure +--- gdb-6.4/gdb/testsuite/configure 2005-04-11 09:13:12.000000000 -0500 ++++ gdb-6.4-patched/gdb/testsuite/configure 2007-02-05 13:22:36.000000000 -0600 +@@ -1248,7 +1248,7 @@ + ac_cache_corrupted=: ;; + ,);; + *) +- if test "x$ac_old_val" != "x$ac_new_val"; then ++ if test "`echo $ac_old_val" != "`echo $ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 + echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +diff -ur gdb-6.4/Makefile.in gdb-6.4-patched/Makefile.in +--- gdb-6.4/Makefile.in 2005-12-01 23:29:54.000000000 -0600 ++++ gdb-6.4-patched/Makefile.in 2007-02-05 13:22:36.000000000 -0600 +@@ -383,7 +383,7 @@ + # CFLAGS will be just -g. We want to ensure that TARGET libraries + # (which we know are built with gcc) are built with optimizations so + # prepend -O2 when setting CFLAGS_FOR_TARGET. +-CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) ++CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)) + SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ + + # If GCC_FOR_TARGET is not overriden on the command line, then this +diff -ur gdb-6.4/Makefile.tpl gdb-6.4-patched/Makefile.tpl +--- gdb-6.4/Makefile.tpl 2005-10-22 05:37:55.000000000 -0500 ++++ gdb-6.4-patched/Makefile.tpl 2007-02-05 13:22:36.000000000 -0600 +@@ -386,7 +386,7 @@ + # CFLAGS will be just -g. We want to ensure that TARGET libraries + # (which we know are built with gcc) are built with optimizations so + # prepend -O2 when setting CFLAGS_FOR_TARGET. +-CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) ++CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)) + SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ + + # If GCC_FOR_TARGET is not overriden on the command line, then this diff --git a/patches/gdb/6.5/200-uclibc-readline-conf.patch b/patches/gdb/6.5/200-uclibc-readline-conf.patch deleted file mode 100644 index ffe792d..0000000 --- a/patches/gdb/6.5/200-uclibc-readline-conf.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- gdb-6.1.1-dist/readline/configure 2003-05-27 18:29:47.000000000 -0500 -+++ gdb-6.1.1/readline/configure 2004-08-09 14:20:23.000000000 -0500 -@@ -6249,7 +6249,12 @@ - - - echo "$as_me:$LINENO: checking for mbstate_t" >&5 -+echo $ECHO_N "bash_cv_have_mbstate_t=$bash_cv_have_mbstate_t" >&6 - echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6 -+if test "${bash_cv_have_mbstate_t+set}" != set; then -+ bash_cv_have_mbstate_t=yes -+ echo $ECHO_N "WARNING!! forcing to yes!!! $ECHO_C" >&6 -+fi - if test "${bash_cv_have_mbstate_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else diff --git a/patches/gdb/6.5/500-thread-timeout.patch b/patches/gdb/6.5/500-thread-timeout.patch deleted file mode 100644 index d6f5dd8..0000000 --- a/patches/gdb/6.5/500-thread-timeout.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- gdb-6.5/./gdb/gdbserver/thread-db.c.orig 2006-03-15 08:13:29.000000000 -0800 -+++ gdb-6.5/./gdb/gdbserver/thread-db.c 2008-04-01 21:21:23.000000000 -0700 -@@ -21,6 +21,7 @@ - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -+#include - #include "server.h" - - #include "linux-low.h" -@@ -134,6 +135,7 @@ thread_db_create_event (CORE_ADDR where) - td_event_msg_t msg; - td_err_e err; - struct inferior_linux_data *tdata; -+ int timeout; - - if (debug_threads) - fprintf (stderr, "Thread creation event.\n"); -@@ -144,7 +146,13 @@ thread_db_create_event (CORE_ADDR where) - In the LinuxThreads implementation, this is safe, - because all events come from the manager thread - (except for its own creation, of course). */ -- err = td_ta_event_getmsg (thread_agent, &msg); -+ for (timeout = 0; timeout < 50000; timeout++) -+ { -+ err = td_ta_event_getmsg (thread_agent, &msg); -+ if (err != TD_NOMSG) -+ break; -+ usleep(1000); -+ } - if (err != TD_OK) - fprintf (stderr, "thread getmsg err: %s\n", - thread_db_err_str (err)); diff --git a/patches/gdb/6.5/600-fix-compile-flag-mismatch.patch b/patches/gdb/6.5/600-fix-compile-flag-mismatch.patch deleted file mode 100644 index ba98482..0000000 --- a/patches/gdb/6.5/600-fix-compile-flag-mismatch.patch +++ /dev/null @@ -1,69 +0,0 @@ -diff -ur gdb-6.4/gdb/configure gdb-6.4-patched/gdb/configure ---- gdb-6.4/gdb/configure 2005-07-25 10:08:40.000000000 -0500 -+++ gdb-6.4-patched/gdb/configure 2007-02-05 13:22:36.000000000 -0600 -@@ -309,7 +309,7 @@ - # include - #endif" - --ac_subdirs_all="$ac_subdirs_all doc testsuite" -+ac_subdirs_all="$ac_subdirs_all doc" - ac_subdirs_all="$ac_subdirs_all gdbtk" - ac_subdirs_all="$ac_subdirs_all multi-ice" - ac_subdirs_all="$ac_subdirs_all gdbserver" -@@ -5940,7 +5940,7 @@ - - - --subdirs="$subdirs doc testsuite" -+subdirs="$subdirs doc" - - - . $srcdir/configure.host -diff -ur gdb-6.4/gdb/gdbserver/configure gdb-6.4-patched/gdb/gdbserver/configure ---- gdb-6.4/gdb/gdbserver/configure 2005-09-17 18:14:37.000000000 -0500 -+++ gdb-6.4-patched/gdb/gdbserver/configure 2007-02-05 13:22:58.000000000 -0600 -@@ -1239,7 +1239,7 @@ - ac_cache_corrupted=: ;; - ,);; - *) -- if test "x$ac_old_val" != "x$ac_new_val"; then -+ if test "`echo $ac_old_val`" != "`echo $ac_new_val`"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 - echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -diff -ur gdb-6.4/gdb/testsuite/configure gdb-6.4-patched/gdb/testsuite/configure ---- gdb-6.4/gdb/testsuite/configure 2005-04-11 09:13:12.000000000 -0500 -+++ gdb-6.4-patched/gdb/testsuite/configure 2007-02-05 13:22:36.000000000 -0600 -@@ -1248,7 +1248,7 @@ - ac_cache_corrupted=: ;; - ,);; - *) -- if test "x$ac_old_val" != "x$ac_new_val"; then -+ if test "`echo $ac_old_val" != "`echo $ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 - echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -diff -ur gdb-6.4/Makefile.in gdb-6.4-patched/Makefile.in ---- gdb-6.4/Makefile.in 2005-12-01 23:29:54.000000000 -0600 -+++ gdb-6.4-patched/Makefile.in 2007-02-05 13:22:36.000000000 -0600 -@@ -383,7 +383,7 @@ - # CFLAGS will be just -g. We want to ensure that TARGET libraries - # (which we know are built with gcc) are built with optimizations so - # prepend -O2 when setting CFLAGS_FOR_TARGET. --CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) -+CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)) - SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ - - # If GCC_FOR_TARGET is not overriden on the command line, then this -diff -ur gdb-6.4/Makefile.tpl gdb-6.4-patched/Makefile.tpl ---- gdb-6.4/Makefile.tpl 2005-10-22 05:37:55.000000000 -0500 -+++ gdb-6.4-patched/Makefile.tpl 2007-02-05 13:22:36.000000000 -0600 -@@ -386,7 +386,7 @@ - # CFLAGS will be just -g. We want to ensure that TARGET libraries - # (which we know are built with gcc) are built with optimizations so - # prepend -O2 when setting CFLAGS_FOR_TARGET. --CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) -+CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)) - SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ - - # If GCC_FOR_TARGET is not overriden on the command line, then this diff --git a/patches/gdb/6.6/110-fix-compile-flag-mismatch.patch b/patches/gdb/6.6/110-fix-compile-flag-mismatch.patch new file mode 100644 index 0000000..60f0ace --- /dev/null +++ b/patches/gdb/6.6/110-fix-compile-flag-mismatch.patch @@ -0,0 +1,69 @@ +diff -rduNp gdb-6.6-100/Makefile.in gdb-6.6/Makefile.in +--- gdb-6.6-100/Makefile.in 2006-12-18 08:21:19.000000000 +0100 ++++ gdb-6.6/Makefile.in 2007-05-14 10:54:29.000000000 +0200 +@@ -331,7 +331,7 @@ COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_ + # CFLAGS will be just -g. We want to ensure that TARGET libraries + # (which we know are built with gcc) are built with optimizations so + # prepend -O2 when setting CFLAGS_FOR_TARGET. +-CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) ++CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)) + SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ + CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) + LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) +diff -rduNp gdb-6.6-100/Makefile.tpl gdb-6.6/Makefile.tpl +--- gdb-6.6-100/Makefile.tpl 2006-11-15 00:26:39.000000000 +0100 ++++ gdb-6.6/Makefile.tpl 2007-05-14 10:54:29.000000000 +0200 +@@ -334,7 +334,7 @@ COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_ + # CFLAGS will be just -g. We want to ensure that TARGET libraries + # (which we know are built with gcc) are built with optimizations so + # prepend -O2 when setting CFLAGS_FOR_TARGET. +-CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) ++CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)) + SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ + CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) + LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) +diff -rduNp gdb-6.6-100/gdb/configure gdb-6.6/gdb/configure +--- gdb-6.6-100/gdb/configure 2006-12-17 16:38:59.000000000 +0100 ++++ gdb-6.6/gdb/configure 2007-05-14 10:55:41.000000000 +0200 +@@ -272,7 +272,7 @@ PACKAGE_STRING= + PACKAGE_BUGREPORT= + + ac_unique_file="main.c" +-ac_subdirs_all="$ac_subdirs_all doc testsuite" ++ac_subdirs_all="$ac_subdirs_all doc" + # Factoring default headers for most tests. + ac_includes_default="\ + #include +@@ -3055,7 +3055,7 @@ _ACEOF + + + +-subdirs="$subdirs doc testsuite" ++subdirs="$subdirs doc" + + + # Provide defaults for some variables set by the per-host and per-target +diff -rduNp gdb-6.6-100/gdb/gdbserver/configure gdb-6.6/gdb/gdbserver/configure +--- gdb-6.6-100/gdb/gdbserver/configure 2006-11-22 01:10:19.000000000 +0100 ++++ gdb-6.6/gdb/gdbserver/configure 2007-05-14 10:54:29.000000000 +0200 +@@ -1239,7 +1239,7 @@ echo "$as_me: error: \`$ac_var' was not + ac_cache_corrupted=: ;; + ,);; + *) +- if test "x$ac_old_val" != "x$ac_new_val"; then ++ if test "`echo $ac_old_val`" != "`echo $ac_new_val`"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 + echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +diff -rduNp gdb-6.6-100/gdb/testsuite/configure gdb-6.6/gdb/testsuite/configure +--- gdb-6.6-100/gdb/testsuite/configure 2006-06-21 15:57:21.000000000 +0200 ++++ gdb-6.6/gdb/testsuite/configure 2007-05-14 10:54:29.000000000 +0200 +@@ -1248,7 +1248,7 @@ echo "$as_me: error: \`$ac_var' was not + ac_cache_corrupted=: ;; + ,);; + *) +- if test "x$ac_old_val" != "x$ac_new_val"; then ++ if test "`echo $ac_old_val" != "`echo $ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 + echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 diff --git a/patches/gdb/6.6/600-fix-compile-flag-mismatch.patch b/patches/gdb/6.6/600-fix-compile-flag-mismatch.patch deleted file mode 100644 index 60f0ace..0000000 --- a/patches/gdb/6.6/600-fix-compile-flag-mismatch.patch +++ /dev/null @@ -1,69 +0,0 @@ -diff -rduNp gdb-6.6-100/Makefile.in gdb-6.6/Makefile.in ---- gdb-6.6-100/Makefile.in 2006-12-18 08:21:19.000000000 +0100 -+++ gdb-6.6/Makefile.in 2007-05-14 10:54:29.000000000 +0200 -@@ -331,7 +331,7 @@ COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_ - # CFLAGS will be just -g. We want to ensure that TARGET libraries - # (which we know are built with gcc) are built with optimizations so - # prepend -O2 when setting CFLAGS_FOR_TARGET. --CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) -+CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)) - SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ - CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) - LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) -diff -rduNp gdb-6.6-100/Makefile.tpl gdb-6.6/Makefile.tpl ---- gdb-6.6-100/Makefile.tpl 2006-11-15 00:26:39.000000000 +0100 -+++ gdb-6.6/Makefile.tpl 2007-05-14 10:54:29.000000000 +0200 -@@ -334,7 +334,7 @@ COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_ - # CFLAGS will be just -g. We want to ensure that TARGET libraries - # (which we know are built with gcc) are built with optimizations so - # prepend -O2 when setting CFLAGS_FOR_TARGET. --CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) -+CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)) - SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ - CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) - LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) -diff -rduNp gdb-6.6-100/gdb/configure gdb-6.6/gdb/configure ---- gdb-6.6-100/gdb/configure 2006-12-17 16:38:59.000000000 +0100 -+++ gdb-6.6/gdb/configure 2007-05-14 10:55:41.000000000 +0200 -@@ -272,7 +272,7 @@ PACKAGE_STRING= - PACKAGE_BUGREPORT= - - ac_unique_file="main.c" --ac_subdirs_all="$ac_subdirs_all doc testsuite" -+ac_subdirs_all="$ac_subdirs_all doc" - # Factoring default headers for most tests. - ac_includes_default="\ - #include -@@ -3055,7 +3055,7 @@ _ACEOF - - - --subdirs="$subdirs doc testsuite" -+subdirs="$subdirs doc" - - - # Provide defaults for some variables set by the per-host and per-target -diff -rduNp gdb-6.6-100/gdb/gdbserver/configure gdb-6.6/gdb/gdbserver/configure ---- gdb-6.6-100/gdb/gdbserver/configure 2006-11-22 01:10:19.000000000 +0100 -+++ gdb-6.6/gdb/gdbserver/configure 2007-05-14 10:54:29.000000000 +0200 -@@ -1239,7 +1239,7 @@ echo "$as_me: error: \`$ac_var' was not - ac_cache_corrupted=: ;; - ,);; - *) -- if test "x$ac_old_val" != "x$ac_new_val"; then -+ if test "`echo $ac_old_val`" != "`echo $ac_new_val`"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 - echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -diff -rduNp gdb-6.6-100/gdb/testsuite/configure gdb-6.6/gdb/testsuite/configure ---- gdb-6.6-100/gdb/testsuite/configure 2006-06-21 15:57:21.000000000 +0200 -+++ gdb-6.6/gdb/testsuite/configure 2007-05-14 10:54:29.000000000 +0200 -@@ -1248,7 +1248,7 @@ echo "$as_me: error: \`$ac_var' was not - ac_cache_corrupted=: ;; - ,);; - *) -- if test "x$ac_old_val" != "x$ac_new_val"; then -+ if test "`echo $ac_old_val" != "`echo $ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 - echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 diff --git a/patches/gdb/6.7.1/100-security-errata-20050610.patch b/patches/gdb/6.7.1/100-security-errata-20050610.patch new file mode 100644 index 0000000..30c7f26 --- /dev/null +++ b/patches/gdb/6.7.1/100-security-errata-20050610.patch @@ -0,0 +1,205 @@ +Original patch from gentoo: gentoo/src/patchsets/gdb/6.7.1/35_all_gdb-6.3-security-errata-20050610.patch +-= BEGIN original header =- +2005-06-09 Jeff Johnston + + * gdb.base/gdbinit.exp: New testcase. + * gdb.base/gdbinit.sample: Sample .gdbinit for gdbinit.exp. + +2005-06-08 Daniel Jacobowitz + Jeff Johnston + + * Makefile.in (cli-cmds.o): Update. + * configure.in: Add check for getuid. + * configure: Regenerated. + * config.in: Ditto. + * main.c (captured_main): Pass -1 to source_command when loading + gdbinit files. + * cli/cli-cmds.c: Include "gdb_stat.h" and . + (source_command): Update documentation. Check permissions if + FROM_TTY is -1. + +-= END original header =- +diff -durN gdb-6.7.1.orig/gdb/cli/cli-cmds.c gdb-6.7.1/gdb/cli/cli-cmds.c +--- gdb-6.7.1.orig/gdb/cli/cli-cmds.c 2007-08-23 20:08:47.000000000 +0200 ++++ gdb-6.7.1/gdb/cli/cli-cmds.c 2008-06-17 23:27:44.000000000 +0200 +@@ -36,6 +36,7 @@ + #include "objfiles.h" + #include "source.h" + #include "disasm.h" ++#include "gdb_stat.h" + + #include "ui-out.h" + +@@ -459,12 +460,31 @@ + + if (fd == -1) + { +- if (from_tty) ++ if (from_tty > 0) + perror_with_name (file); + else + return; + } + ++#ifdef HAVE_GETUID ++ if (from_tty == -1) ++ { ++ struct stat statbuf; ++ if (fstat (fd, &statbuf) < 0) ++ { ++ perror_with_name (file); ++ close (fd); ++ return; ++ } ++ if (statbuf.st_uid != getuid () || (statbuf.st_mode & S_IWOTH)) ++ { ++ warning (_("not using untrusted file \"%s\""), file); ++ close (fd); ++ return; ++ } ++ } ++#endif ++ + stream = fdopen (fd, FOPEN_RT); + script_from_file (stream, file); + +diff -durN gdb-6.7.1.orig/gdb/main.c gdb-6.7.1/gdb/main.c +--- gdb-6.7.1.orig/gdb/main.c 2007-08-23 20:08:36.000000000 +0200 ++++ gdb-6.7.1/gdb/main.c 2008-06-17 23:27:44.000000000 +0200 +@@ -688,7 +688,7 @@ + + if (!inhibit_gdbinit) + { +- catch_command_errors (source_script, homeinit, 0, RETURN_MASK_ALL); ++ catch_command_errors (source_script, homeinit, -1, RETURN_MASK_ALL); + } + + /* Do stats; no need to do them elsewhere since we'll only +@@ -766,7 +766,7 @@ + || memcmp ((char *) &homebuf, (char *) &cwdbuf, sizeof (struct stat))) + if (!inhibit_gdbinit) + { +- catch_command_errors (source_script, gdbinit, 0, RETURN_MASK_ALL); ++ catch_command_errors (source_script, gdbinit, -1, RETURN_MASK_ALL); + } + + for (i = 0; i < ncmd; i++) +diff -durN gdb-6.7.1.orig/gdb/Makefile.in gdb-6.7.1/gdb/Makefile.in +--- gdb-6.7.1.orig/gdb/Makefile.in 2008-06-17 23:27:44.000000000 +0200 ++++ gdb-6.7.1/gdb/Makefile.in 2008-06-17 23:27:44.000000000 +0200 +@@ -2885,7 +2885,7 @@ + $(expression_h) $(frame_h) $(value_h) $(language_h) $(filenames_h) \ + $(objfiles_h) $(source_h) $(disasm_h) $(ui_out_h) $(top_h) \ + $(cli_decode_h) $(cli_script_h) $(cli_setshow_h) $(cli_cmds_h) \ +- $(tui_h) ++ $(tui_h) $(gdb_stat_h) + $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-cmds.c + cli-decode.o: $(srcdir)/cli/cli-decode.c $(defs_h) $(symtab_h) \ + $(gdb_regex_h) $(gdb_string_h) $(completer_h) $(ui_out_h) \ +diff -durN gdb-6.7.1.orig/gdb/testsuite/gdb.base/gdbinit.exp gdb-6.7.1/gdb/testsuite/gdb.base/gdbinit.exp +--- gdb-6.7.1.orig/gdb/testsuite/gdb.base/gdbinit.exp 1970-01-01 01:00:00.000000000 +0100 ++++ gdb-6.7.1/gdb/testsuite/gdb.base/gdbinit.exp 2008-06-17 23:27:44.000000000 +0200 +@@ -0,0 +1,98 @@ ++# Copyright 2005 ++# Free Software Foundation, Inc. ++ ++# This program 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 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++# Please email any bugs, comments, and/or additions to this file to: ++# bug-gdb@prep.ai.mit.edu ++ ++# This file was written by Jeff Johnston . ++ ++if $tracelevel then { ++ strace $tracelevel ++} ++ ++set prms_id 0 ++set bug_id 0 ++ ++# are we on a target board ++if [is_remote target] { ++ return ++} ++ ++ ++global verbose ++global GDB ++global GDBFLAGS ++global gdb_prompt ++global timeout ++global gdb_spawn_id; ++ ++gdb_stop_suppressing_tests; ++ ++verbose "Spawning $GDB -nw" ++ ++if [info exists gdb_spawn_id] { ++ return 0; ++} ++ ++if ![is_remote host] { ++ if { [which $GDB] == 0 } then { ++ perror "$GDB does not exist." ++ exit 1 ++ } ++} ++ ++set env(HOME) [pwd] ++remote_exec build "rm .gdbinit" ++remote_exec build "cp ${srcdir}/${subdir}/gdbinit.sample .gdbinit" ++remote_exec build "chmod 646 .gdbinit" ++ ++set res [remote_spawn host "$GDB -nw [host_info gdb_opts]"]; ++if { $res < 0 || $res == "" } { ++ perror "Spawning $GDB failed." ++ return 1; ++} ++gdb_expect 360 { ++ -re "warning: not using untrusted file.*\.gdbinit.*\[\r\n\]$gdb_prompt $" { ++ pass "untrusted .gdbinit caught." ++ } ++ -re "$gdb_prompt $" { ++ fail "untrusted .gdbinit caught." ++ } ++ timeout { ++ fail "(timeout) untrusted .gdbinit caught." ++ } ++} ++ ++remote_exec build "chmod 644 .gdbinit" ++set res [remote_spawn host "$GDB -nw [host_info gdb_opts]"]; ++if { $res < 0 || $res == "" } { ++ perror "Spawning $GDB failed." ++ return 1; ++} ++gdb_expect 360 { ++ -re "warning: not using untrusted file.*\.gdbinit.*\[\r\n\]$gdb_prompt $" { ++ fail "trusted .gdbinit allowed." ++ } ++ -re "in gdbinit.*$gdb_prompt $" { ++ pass "trusted .gdbinit allowed." ++ } ++ timeout { ++ fail "(timeout) trusted .gdbinit allowed." ++ } ++} ++ ++remote_exec build "rm .gdbinit" +diff -durN gdb-6.7.1.orig/gdb/testsuite/gdb.base/gdbinit.sample gdb-6.7.1/gdb/testsuite/gdb.base/gdbinit.sample +--- gdb-6.7.1.orig/gdb/testsuite/gdb.base/gdbinit.sample 1970-01-01 01:00:00.000000000 +0100 ++++ gdb-6.7.1/gdb/testsuite/gdb.base/gdbinit.sample 2008-06-17 23:27:44.000000000 +0200 +@@ -0,0 +1 @@ ++echo "\nin gdbinit" diff --git a/patches/gdb/6.7.1/110-hppa-offsets.patch b/patches/gdb/6.7.1/110-hppa-offsets.patch new file mode 100644 index 0000000..06e1e74 --- /dev/null +++ b/patches/gdb/6.7.1/110-hppa-offsets.patch @@ -0,0 +1,272 @@ +Original patch from gentoo: gentoo/src/patchsets/gdb/6.7.1/45_all_gdb-hppa-offsets.patch +-= BEGIN original header =- +sanitized headers dont include asm/offsets.h, so cache a local copy + +http://bugs.gentoo.org/180476 +http://lists.parisc-linux.org/pipermail/parisc-linux/2007-February/031162.html + +-= END original header =- +diff -durN gdb-6.7.1.orig/gdb/hppa-linux-nat.c gdb-6.7.1/gdb/hppa-linux-nat.c +--- gdb-6.7.1.orig/gdb/hppa-linux-nat.c 2007-08-23 20:08:33.000000000 +0200 ++++ gdb-6.7.1/gdb/hppa-linux-nat.c 2008-06-17 23:27:45.000000000 +0200 +@@ -32,7 +32,7 @@ + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,43) + #include + #else +-#include ++#include + #endif + + #include "hppa-tdep.h" +diff -durN gdb-6.7.1.orig/gdb/hppa-offsets.h gdb-6.7.1/gdb/hppa-offsets.h +--- gdb-6.7.1.orig/gdb/hppa-offsets.h 1970-01-01 01:00:00.000000000 +0100 ++++ gdb-6.7.1/gdb/hppa-offsets.h 2008-06-17 23:27:45.000000000 +0200 +@@ -0,0 +1,248 @@ ++#ifndef __ASM_OFFSETS_H__ ++#define __ASM_OFFSETS_H__ ++/* ++ * DO NOT MODIFY. ++ * ++ * This file was generated by arch/parisc/Makefile ++ * ++ */ ++ ++#define TASK_THREAD_INFO 4 /* offsetof(struct task_struct, thread_info) */ ++#define TASK_STATE 0 /* offsetof(struct task_struct, state) */ ++#define TASK_FLAGS 12 /* offsetof(struct task_struct, flags) */ ++#define TASK_SIGPENDING 1188 /* offsetof(struct task_struct, pending) */ ++#define TASK_PTRACE 16 /* offsetof(struct task_struct, ptrace) */ ++#define TASK_MM 108 /* offsetof(struct task_struct, mm) */ ++#define TASK_PERSONALITY 132 /* offsetof(struct task_struct, personality) */ ++#define TASK_PID 140 /* offsetof(struct task_struct, pid) */ ++ ++#define TASK_REGS 664 /* offsetof(struct task_struct, thread.regs) */ ++#define TASK_PT_PSW 664 /* offsetof(struct task_struct, thread.regs.gr[ 0]) */ ++#define TASK_PT_GR1 668 /* offsetof(struct task_struct, thread.regs.gr[ 1]) */ ++#define TASK_PT_GR2 672 /* offsetof(struct task_struct, thread.regs.gr[ 2]) */ ++#define TASK_PT_GR3 676 /* offsetof(struct task_struct, thread.regs.gr[ 3]) */ ++#define TASK_PT_GR4 680 /* offsetof(struct task_struct, thread.regs.gr[ 4]) */ ++#define TASK_PT_GR5 684 /* offsetof(struct task_struct, thread.regs.gr[ 5]) */ ++#define TASK_PT_GR6 688 /* offsetof(struct task_struct, thread.regs.gr[ 6]) */ ++#define TASK_PT_GR7 692 /* offsetof(struct task_struct, thread.regs.gr[ 7]) */ ++#define TASK_PT_GR8 696 /* offsetof(struct task_struct, thread.regs.gr[ 8]) */ ++#define TASK_PT_GR9 700 /* offsetof(struct task_struct, thread.regs.gr[ 9]) */ ++#define TASK_PT_GR10 704 /* offsetof(struct task_struct, thread.regs.gr[10]) */ ++#define TASK_PT_GR11 708 /* offsetof(struct task_struct, thread.regs.gr[11]) */ ++#define TASK_PT_GR12 712 /* offsetof(struct task_struct, thread.regs.gr[12]) */ ++#define TASK_PT_GR13 716 /* offsetof(struct task_struct, thread.regs.gr[13]) */ ++#define TASK_PT_GR14 720 /* offsetof(struct task_struct, thread.regs.gr[14]) */ ++#define TASK_PT_GR15 724 /* offsetof(struct task_struct, thread.regs.gr[15]) */ ++#define TASK_PT_GR16 728 /* offsetof(struct task_struct, thread.regs.gr[16]) */ ++#define TASK_PT_GR17 732 /* offsetof(struct task_struct, thread.regs.gr[17]) */ ++#define TASK_PT_GR18 736 /* offsetof(struct task_struct, thread.regs.gr[18]) */ ++#define TASK_PT_GR19 740 /* offsetof(struct task_struct, thread.regs.gr[19]) */ ++#define TASK_PT_GR20 744 /* offsetof(struct task_struct, thread.regs.gr[20]) */ ++#define TASK_PT_GR21 748 /* offsetof(struct task_struct, thread.regs.gr[21]) */ ++#define TASK_PT_GR22 752 /* offsetof(struct task_struct, thread.regs.gr[22]) */ ++#define TASK_PT_GR23 756 /* offsetof(struct task_struct, thread.regs.gr[23]) */ ++#define TASK_PT_GR24 760 /* offsetof(struct task_struct, thread.regs.gr[24]) */ ++#define TASK_PT_GR25 764 /* offsetof(struct task_struct, thread.regs.gr[25]) */ ++#define TASK_PT_GR26 768 /* offsetof(struct task_struct, thread.regs.gr[26]) */ ++#define TASK_PT_GR27 772 /* offsetof(struct task_struct, thread.regs.gr[27]) */ ++#define TASK_PT_GR28 776 /* offsetof(struct task_struct, thread.regs.gr[28]) */ ++#define TASK_PT_GR29 780 /* offsetof(struct task_struct, thread.regs.gr[29]) */ ++#define TASK_PT_GR30 784 /* offsetof(struct task_struct, thread.regs.gr[30]) */ ++#define TASK_PT_GR31 788 /* offsetof(struct task_struct, thread.regs.gr[31]) */ ++#define TASK_PT_FR0 792 /* offsetof(struct task_struct, thread.regs.fr[ 0]) */ ++#define TASK_PT_FR1 800 /* offsetof(struct task_struct, thread.regs.fr[ 1]) */ ++#define TASK_PT_FR2 808 /* offsetof(struct task_struct, thread.regs.fr[ 2]) */ ++#define TASK_PT_FR3 816 /* offsetof(struct task_struct, thread.regs.fr[ 3]) */ ++#define TASK_PT_FR4 824 /* offsetof(struct task_struct, thread.regs.fr[ 4]) */ ++#define TASK_PT_FR5 832 /* offsetof(struct task_struct, thread.regs.fr[ 5]) */ ++#define TASK_PT_FR6 840 /* offsetof(struct task_struct, thread.regs.fr[ 6]) */ ++#define TASK_PT_FR7 848 /* offsetof(struct task_struct, thread.regs.fr[ 7]) */ ++#define TASK_PT_FR8 856 /* offsetof(struct task_struct, thread.regs.fr[ 8]) */ ++#define TASK_PT_FR9 864 /* offsetof(struct task_struct, thread.regs.fr[ 9]) */ ++#define TASK_PT_FR10 872 /* offsetof(struct task_struct, thread.regs.fr[10]) */ ++#define TASK_PT_FR11 880 /* offsetof(struct task_struct, thread.regs.fr[11]) */ ++#define TASK_PT_FR12 888 /* offsetof(struct task_struct, thread.regs.fr[12]) */ ++#define TASK_PT_FR13 896 /* offsetof(struct task_struct, thread.regs.fr[13]) */ ++#define TASK_PT_FR14 904 /* offsetof(struct task_struct, thread.regs.fr[14]) */ ++#define TASK_PT_FR15 912 /* offsetof(struct task_struct, thread.regs.fr[15]) */ ++#define TASK_PT_FR16 920 /* offsetof(struct task_struct, thread.regs.fr[16]) */ ++#define TASK_PT_FR17 928 /* offsetof(struct task_struct, thread.regs.fr[17]) */ ++#define TASK_PT_FR18 936 /* offsetof(struct task_struct, thread.regs.fr[18]) */ ++#define TASK_PT_FR19 944 /* offsetof(struct task_struct, thread.regs.fr[19]) */ ++#define TASK_PT_FR20 952 /* offsetof(struct task_struct, thread.regs.fr[20]) */ ++#define TASK_PT_FR21 960 /* offsetof(struct task_struct, thread.regs.fr[21]) */ ++#define TASK_PT_FR22 968 /* offsetof(struct task_struct, thread.regs.fr[22]) */ ++#define TASK_PT_FR23 976 /* offsetof(struct task_struct, thread.regs.fr[23]) */ ++#define TASK_PT_FR24 984 /* offsetof(struct task_struct, thread.regs.fr[24]) */ ++#define TASK_PT_FR25 992 /* offsetof(struct task_struct, thread.regs.fr[25]) */ ++#define TASK_PT_FR26 1000 /* offsetof(struct task_struct, thread.regs.fr[26]) */ ++#define TASK_PT_FR27 1008 /* offsetof(struct task_struct, thread.regs.fr[27]) */ ++#define TASK_PT_FR28 1016 /* offsetof(struct task_struct, thread.regs.fr[28]) */ ++#define TASK_PT_FR29 1024 /* offsetof(struct task_struct, thread.regs.fr[29]) */ ++#define TASK_PT_FR30 1032 /* offsetof(struct task_struct, thread.regs.fr[30]) */ ++#define TASK_PT_FR31 1040 /* offsetof(struct task_struct, thread.regs.fr[31]) */ ++#define TASK_PT_SR0 1048 /* offsetof(struct task_struct, thread.regs.sr[ 0]) */ ++#define TASK_PT_SR1 1052 /* offsetof(struct task_struct, thread.regs.sr[ 1]) */ ++#define TASK_PT_SR2 1056 /* offsetof(struct task_struct, thread.regs.sr[ 2]) */ ++#define TASK_PT_SR3 1060 /* offsetof(struct task_struct, thread.regs.sr[ 3]) */ ++#define TASK_PT_SR4 1064 /* offsetof(struct task_struct, thread.regs.sr[ 4]) */ ++#define TASK_PT_SR5 1068 /* offsetof(struct task_struct, thread.regs.sr[ 5]) */ ++#define TASK_PT_SR6 1072 /* offsetof(struct task_struct, thread.regs.sr[ 6]) */ ++#define TASK_PT_SR7 1076 /* offsetof(struct task_struct, thread.regs.sr[ 7]) */ ++#define TASK_PT_IASQ0 1080 /* offsetof(struct task_struct, thread.regs.iasq[0]) */ ++#define TASK_PT_IASQ1 1084 /* offsetof(struct task_struct, thread.regs.iasq[1]) */ ++#define TASK_PT_IAOQ0 1088 /* offsetof(struct task_struct, thread.regs.iaoq[0]) */ ++#define TASK_PT_IAOQ1 1092 /* offsetof(struct task_struct, thread.regs.iaoq[1]) */ ++#define TASK_PT_CR27 1096 /* offsetof(struct task_struct, thread.regs.cr27) */ ++#define TASK_PT_ORIG_R28 1104 /* offsetof(struct task_struct, thread.regs.orig_r28) */ ++#define TASK_PT_KSP 1108 /* offsetof(struct task_struct, thread.regs.ksp) */ ++#define TASK_PT_KPC 1112 /* offsetof(struct task_struct, thread.regs.kpc) */ ++#define TASK_PT_SAR 1116 /* offsetof(struct task_struct, thread.regs.sar) */ ++#define TASK_PT_IIR 1120 /* offsetof(struct task_struct, thread.regs.iir) */ ++#define TASK_PT_ISR 1124 /* offsetof(struct task_struct, thread.regs.isr) */ ++#define TASK_PT_IOR 1128 /* offsetof(struct task_struct, thread.regs.ior) */ ++ ++#define TASK_SZ 1272 /* sizeof(struct task_struct) */ ++#define TASK_SZ_ALGN 1344 /* align(sizeof(struct task_struct), 64) */ ++ ++#define PT_PSW 0 /* offsetof(struct pt_regs, gr[ 0]) */ ++#define PT_GR1 4 /* offsetof(struct pt_regs, gr[ 1]) */ ++#define PT_GR2 8 /* offsetof(struct pt_regs, gr[ 2]) */ ++#define PT_GR3 12 /* offsetof(struct pt_regs, gr[ 3]) */ ++#define PT_GR4 16 /* offsetof(struct pt_regs, gr[ 4]) */ ++#define PT_GR5 20 /* offsetof(struct pt_regs, gr[ 5]) */ ++#define PT_GR6 24 /* offsetof(struct pt_regs, gr[ 6]) */ ++#define PT_GR7 28 /* offsetof(struct pt_regs, gr[ 7]) */ ++#define PT_GR8 32 /* offsetof(struct pt_regs, gr[ 8]) */ ++#define PT_GR9 36 /* offsetof(struct pt_regs, gr[ 9]) */ ++#define PT_GR10 40 /* offsetof(struct pt_regs, gr[10]) */ ++#define PT_GR11 44 /* offsetof(struct pt_regs, gr[11]) */ ++#define PT_GR12 48 /* offsetof(struct pt_regs, gr[12]) */ ++#define PT_GR13 52 /* offsetof(struct pt_regs, gr[13]) */ ++#define PT_GR14 56 /* offsetof(struct pt_regs, gr[14]) */ ++#define PT_GR15 60 /* offsetof(struct pt_regs, gr[15]) */ ++#define PT_GR16 64 /* offsetof(struct pt_regs, gr[16]) */ ++#define PT_GR17 68 /* offsetof(struct pt_regs, gr[17]) */ ++#define PT_GR18 72 /* offsetof(struct pt_regs, gr[18]) */ ++#define PT_GR19 76 /* offsetof(struct pt_regs, gr[19]) */ ++#define PT_GR20 80 /* offsetof(struct pt_regs, gr[20]) */ ++#define PT_GR21 84 /* offsetof(struct pt_regs, gr[21]) */ ++#define PT_GR22 88 /* offsetof(struct pt_regs, gr[22]) */ ++#define PT_GR23 92 /* offsetof(struct pt_regs, gr[23]) */ ++#define PT_GR24 96 /* offsetof(struct pt_regs, gr[24]) */ ++#define PT_GR25 100 /* offsetof(struct pt_regs, gr[25]) */ ++#define PT_GR26 104 /* offsetof(struct pt_regs, gr[26]) */ ++#define PT_GR27 108 /* offsetof(struct pt_regs, gr[27]) */ ++#define PT_GR28 112 /* offsetof(struct pt_regs, gr[28]) */ ++#define PT_GR29 116 /* offsetof(struct pt_regs, gr[29]) */ ++#define PT_GR30 120 /* offsetof(struct pt_regs, gr[30]) */ ++#define PT_GR31 124 /* offsetof(struct pt_regs, gr[31]) */ ++#define PT_FR0 128 /* offsetof(struct pt_regs, fr[ 0]) */ ++#define PT_FR1 136 /* offsetof(struct pt_regs, fr[ 1]) */ ++#define PT_FR2 144 /* offsetof(struct pt_regs, fr[ 2]) */ ++#define PT_FR3 152 /* offsetof(struct pt_regs, fr[ 3]) */ ++#define PT_FR4 160 /* offsetof(struct pt_regs, fr[ 4]) */ ++#define PT_FR5 168 /* offsetof(struct pt_regs, fr[ 5]) */ ++#define PT_FR6 176 /* offsetof(struct pt_regs, fr[ 6]) */ ++#define PT_FR7 184 /* offsetof(struct pt_regs, fr[ 7]) */ ++#define PT_FR8 192 /* offsetof(struct pt_regs, fr[ 8]) */ ++#define PT_FR9 200 /* offsetof(struct pt_regs, fr[ 9]) */ ++#define PT_FR10 208 /* offsetof(struct pt_regs, fr[10]) */ ++#define PT_FR11 216 /* offsetof(struct pt_regs, fr[11]) */ ++#define PT_FR12 224 /* offsetof(struct pt_regs, fr[12]) */ ++#define PT_FR13 232 /* offsetof(struct pt_regs, fr[13]) */ ++#define PT_FR14 240 /* offsetof(struct pt_regs, fr[14]) */ ++#define PT_FR15 248 /* offsetof(struct pt_regs, fr[15]) */ ++#define PT_FR16 256 /* offsetof(struct pt_regs, fr[16]) */ ++#define PT_FR17 264 /* offsetof(struct pt_regs, fr[17]) */ ++#define PT_FR18 272 /* offsetof(struct pt_regs, fr[18]) */ ++#define PT_FR19 280 /* offsetof(struct pt_regs, fr[19]) */ ++#define PT_FR20 288 /* offsetof(struct pt_regs, fr[20]) */ ++#define PT_FR21 296 /* offsetof(struct pt_regs, fr[21]) */ ++#define PT_FR22 304 /* offsetof(struct pt_regs, fr[22]) */ ++#define PT_FR23 312 /* offsetof(struct pt_regs, fr[23]) */ ++#define PT_FR24 320 /* offsetof(struct pt_regs, fr[24]) */ ++#define PT_FR25 328 /* offsetof(struct pt_regs, fr[25]) */ ++#define PT_FR26 336 /* offsetof(struct pt_regs, fr[26]) */ ++#define PT_FR27 344 /* offsetof(struct pt_regs, fr[27]) */ ++#define PT_FR28 352 /* offsetof(struct pt_regs, fr[28]) */ ++#define PT_FR29 360 /* offsetof(struct pt_regs, fr[29]) */ ++#define PT_FR30 368 /* offsetof(struct pt_regs, fr[30]) */ ++#define PT_FR31 376 /* offsetof(struct pt_regs, fr[31]) */ ++#define PT_SR0 384 /* offsetof(struct pt_regs, sr[ 0]) */ ++#define PT_SR1 388 /* offsetof(struct pt_regs, sr[ 1]) */ ++#define PT_SR2 392 /* offsetof(struct pt_regs, sr[ 2]) */ ++#define PT_SR3 396 /* offsetof(struct pt_regs, sr[ 3]) */ ++#define PT_SR4 400 /* offsetof(struct pt_regs, sr[ 4]) */ ++#define PT_SR5 404 /* offsetof(struct pt_regs, sr[ 5]) */ ++#define PT_SR6 408 /* offsetof(struct pt_regs, sr[ 6]) */ ++#define PT_SR7 412 /* offsetof(struct pt_regs, sr[ 7]) */ ++#define PT_IASQ0 416 /* offsetof(struct pt_regs, iasq[0]) */ ++#define PT_IASQ1 420 /* offsetof(struct pt_regs, iasq[1]) */ ++#define PT_IAOQ0 424 /* offsetof(struct pt_regs, iaoq[0]) */ ++#define PT_IAOQ1 428 /* offsetof(struct pt_regs, iaoq[1]) */ ++#define PT_CR27 432 /* offsetof(struct pt_regs, cr27) */ ++#define PT_ORIG_R28 440 /* offsetof(struct pt_regs, orig_r28) */ ++#define PT_KSP 444 /* offsetof(struct pt_regs, ksp) */ ++#define PT_KPC 448 /* offsetof(struct pt_regs, kpc) */ ++#define PT_SAR 452 /* offsetof(struct pt_regs, sar) */ ++#define PT_IIR 456 /* offsetof(struct pt_regs, iir) */ ++#define PT_ISR 460 /* offsetof(struct pt_regs, isr) */ ++#define PT_IOR 464 /* offsetof(struct pt_regs, ior) */ ++#define PT_SIZE 472 /* sizeof(struct pt_regs) */ ++#define PT_SZ_ALGN 576 /* align(sizeof(struct pt_regs), 64) */ ++ ++#define TI_TASK 0 /* offsetof(struct thread_info, task) */ ++#define TI_EXEC_DOMAIN 4 /* offsetof(struct thread_info, exec_domain) */ ++#define TI_FLAGS 8 /* offsetof(struct thread_info, flags) */ ++#define TI_CPU 16 /* offsetof(struct thread_info, cpu) */ ++#define TI_SEGMENT 12 /* offsetof(struct thread_info, addr_limit) */ ++#define TI_PRE_COUNT 20 /* offsetof(struct thread_info, preempt_count) */ ++#define THREAD_SZ 44 /* sizeof(struct thread_info) */ ++#define THREAD_SZ_ALGN 128 /* align(sizeof(struct thread_info), 64) */ ++ ++#define IRQSTAT_SIRQ_PEND 0 /* offsetof(irq_cpustat_t, __softirq_pending) */ ++#define IRQSTAT_SZ 64 /* sizeof(irq_cpustat_t) */ ++ ++#define ICACHE_BASE 8 /* offsetof(struct pdc_cache_info, ic_base) */ ++#define ICACHE_STRIDE 12 /* offsetof(struct pdc_cache_info, ic_stride) */ ++#define ICACHE_COUNT 16 /* offsetof(struct pdc_cache_info, ic_count) */ ++#define ICACHE_LOOP 20 /* offsetof(struct pdc_cache_info, ic_loop) */ ++#define DCACHE_BASE 32 /* offsetof(struct pdc_cache_info, dc_base) */ ++#define DCACHE_STRIDE 36 /* offsetof(struct pdc_cache_info, dc_stride) */ ++#define DCACHE_COUNT 40 /* offsetof(struct pdc_cache_info, dc_count) */ ++#define DCACHE_LOOP 44 /* offsetof(struct pdc_cache_info, dc_loop) */ ++#define ITLB_SID_BASE 56 /* offsetof(struct pdc_cache_info, it_sp_base) */ ++#define ITLB_SID_STRIDE 60 /* offsetof(struct pdc_cache_info, it_sp_stride) */ ++#define ITLB_SID_COUNT 64 /* offsetof(struct pdc_cache_info, it_sp_count) */ ++#define ITLB_OFF_BASE 68 /* offsetof(struct pdc_cache_info, it_off_base) */ ++#define ITLB_OFF_STRIDE 72 /* offsetof(struct pdc_cache_info, it_off_stride) */ ++#define ITLB_OFF_COUNT 76 /* offsetof(struct pdc_cache_info, it_off_count) */ ++#define ITLB_LOOP 80 /* offsetof(struct pdc_cache_info, it_loop) */ ++#define DTLB_SID_BASE 92 /* offsetof(struct pdc_cache_info, dt_sp_base) */ ++#define DTLB_SID_STRIDE 96 /* offsetof(struct pdc_cache_info, dt_sp_stride) */ ++#define DTLB_SID_COUNT 100 /* offsetof(struct pdc_cache_info, dt_sp_count) */ ++#define DTLB_OFF_BASE 104 /* offsetof(struct pdc_cache_info, dt_off_base) */ ++#define DTLB_OFF_STRIDE 108 /* offsetof(struct pdc_cache_info, dt_off_stride) */ ++#define DTLB_OFF_COUNT 112 /* offsetof(struct pdc_cache_info, dt_off_count) */ ++#define DTLB_LOOP 116 /* offsetof(struct pdc_cache_info, dt_loop) */ ++ ++#define PA_BLOCKSTEP_BIT 1 /* 31-PT_BLOCKSTEP_BIT */ ++#define PA_SINGLESTEP_BIT 0 /* 31-PT_SINGLESTEP_BIT */ ++ ++#define ASM_PMD_SHIFT 21 /* PMD_SHIFT */ ++#define ASM_PGDIR_SHIFT 21 /* PGDIR_SHIFT */ ++#define ASM_BITS_PER_PGD 11 /* BITS_PER_PGD */ ++#define ASM_BITS_PER_PMD 0 /* BITS_PER_PMD */ ++#define ASM_BITS_PER_PTE 9 /* BITS_PER_PTE */ ++#define ASM_PGD_PMD_OFFSET -8192 /* -(PAGE_SIZE << PGD_ORDER) */ ++#define ASM_PMD_ENTRY 128 /* ((PAGE_OFFSET & PMD_MASK) >> PMD_SHIFT) */ ++#define ASM_PGD_ENTRY 128 /* PAGE_OFFSET >> PGDIR_SHIFT */ ++#define ASM_PGD_ENTRY_SIZE 4 /* PGD_ENTRY_SIZE */ ++#define ASM_PMD_ENTRY_SIZE 4 /* PMD_ENTRY_SIZE */ ++#define ASM_PTE_ENTRY_SIZE 8 /* PTE_ENTRY_SIZE */ ++#define ASM_PT_INITIAL 4 /* PT_INITIAL */ ++#define ASM_PAGE_SIZE 4096 /* PAGE_SIZE */ ++ ++ ++#endif diff --git a/patches/gdb/6.7.1/120-deleted-children.patch b/patches/gdb/6.7.1/120-deleted-children.patch new file mode 100644 index 0000000..08bbba9 --- /dev/null +++ b/patches/gdb/6.7.1/120-deleted-children.patch @@ -0,0 +1,26 @@ +Original patch from gentoo: gentoo/src/patchsets/gdb/6.7.1/50_all_gdb-deleted-children.patch +-= BEGIN original header =- +http://bugs.gentoo.org/210636 +http://sourceware.org/ml/gdb-patches/2007-11/msg00136.html + +2007-11-07 Vladimir Prus + + Fix crash when a variable object being deleted + has any of its children deleted previously. + + * varobj.c (delete_variable_1): Don't recurse + into deleted children. + +-= END original header =- +diff -durN gdb-6.7.1.orig/gdb/varobj.c gdb-6.7.1/gdb/varobj.c +--- gdb-6.7.1.orig/gdb/varobj.c 2007-08-31 21:01:17.000000000 +0200 ++++ gdb-6.7.1/gdb/varobj.c 2008-06-17 23:27:45.000000000 +0200 +@@ -1295,6 +1295,8 @@ + for (i = 0; i < VEC_length (varobj_p, var->children); ++i) + { + varobj_p child = VEC_index (varobj_p, var->children, i); ++ if (!child) ++ continue; + if (!remove_from_parent_p) + child->parent = NULL; + delete_variable_1 (resultp, delcountp, child, 0, only_children_p); diff --git a/patches/gdb/6.7.1/130-dwarf-stack-overflow.patch b/patches/gdb/6.7.1/130-dwarf-stack-overflow.patch new file mode 100644 index 0000000..764ec65 --- /dev/null +++ b/patches/gdb/6.7.1/130-dwarf-stack-overflow.patch @@ -0,0 +1,52 @@ +Original patch from gentoo: gentoo/src/patchsets/gdb/6.7.1/80_all_gdb-6.5-dwarf-stack-overflow.patch +-= BEGIN original header =- +http://bugs.gentoo.org/144833 + +for gdb/ChangeLog: +2006-08-22 Will Drewry + Tavis Ormandy + + * dwarf2read.c (decode_locdesc): Enforce location description stack + boundaries. + * dwarfread.c (locval): Likewise. + +-= END original header =- +diff -durN gdb-6.7.1.orig/gdb/dwarf2read.c gdb-6.7.1/gdb/dwarf2read.c +--- gdb-6.7.1.orig/gdb/dwarf2read.c 2007-09-05 02:51:48.000000000 +0200 ++++ gdb-6.7.1/gdb/dwarf2read.c 2008-06-17 23:27:46.000000000 +0200 +@@ -9061,8 +9061,7 @@ + callers will only want a very basic result and this can become a + complaint. + +- Note that stack[0] is unused except as a default error return. +- Note that stack overflow is not yet handled. */ ++ Note that stack[0] is unused except as a default error return. */ + + static CORE_ADDR + decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu) +@@ -9079,7 +9078,7 @@ + + i = 0; + stacki = 0; +- stack[stacki] = 0; ++ stack[++stacki] = 0; + + while (i < size) + { +@@ -9261,6 +9260,16 @@ + dwarf_stack_op_name (op)); + return (stack[stacki]); + } ++ /* Enforce maximum stack depth of size-1 to avoid ++stacki writing ++ outside of the allocated space. Also enforce minimum > 0. ++ -- wad@google.com 14 Aug 2006 */ ++ if (stacki >= sizeof (stack) / sizeof (*stack) - 1) ++ internal_error (__FILE__, __LINE__, ++ _("location description stack too deep: %d"), ++ stacki); ++ if (stacki <= 0) ++ internal_error (__FILE__, __LINE__, ++ _("location description stack too shallow")); + } + return (stack[stacki]); + } diff --git a/patches/gdb/6.7.1/150-security-errata-20050610.patch b/patches/gdb/6.7.1/150-security-errata-20050610.patch deleted file mode 100644 index 30c7f26..0000000 --- a/patches/gdb/6.7.1/150-security-errata-20050610.patch +++ /dev/null @@ -1,205 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gdb/6.7.1/35_all_gdb-6.3-security-errata-20050610.patch --= BEGIN original header =- -2005-06-09 Jeff Johnston - - * gdb.base/gdbinit.exp: New testcase. - * gdb.base/gdbinit.sample: Sample .gdbinit for gdbinit.exp. - -2005-06-08 Daniel Jacobowitz - Jeff Johnston - - * Makefile.in (cli-cmds.o): Update. - * configure.in: Add check for getuid. - * configure: Regenerated. - * config.in: Ditto. - * main.c (captured_main): Pass -1 to source_command when loading - gdbinit files. - * cli/cli-cmds.c: Include "gdb_stat.h" and . - (source_command): Update documentation. Check permissions if - FROM_TTY is -1. - --= END original header =- -diff -durN gdb-6.7.1.orig/gdb/cli/cli-cmds.c gdb-6.7.1/gdb/cli/cli-cmds.c ---- gdb-6.7.1.orig/gdb/cli/cli-cmds.c 2007-08-23 20:08:47.000000000 +0200 -+++ gdb-6.7.1/gdb/cli/cli-cmds.c 2008-06-17 23:27:44.000000000 +0200 -@@ -36,6 +36,7 @@ - #include "objfiles.h" - #include "source.h" - #include "disasm.h" -+#include "gdb_stat.h" - - #include "ui-out.h" - -@@ -459,12 +460,31 @@ - - if (fd == -1) - { -- if (from_tty) -+ if (from_tty > 0) - perror_with_name (file); - else - return; - } - -+#ifdef HAVE_GETUID -+ if (from_tty == -1) -+ { -+ struct stat statbuf; -+ if (fstat (fd, &statbuf) < 0) -+ { -+ perror_with_name (file); -+ close (fd); -+ return; -+ } -+ if (statbuf.st_uid != getuid () || (statbuf.st_mode & S_IWOTH)) -+ { -+ warning (_("not using untrusted file \"%s\""), file); -+ close (fd); -+ return; -+ } -+ } -+#endif -+ - stream = fdopen (fd, FOPEN_RT); - script_from_file (stream, file); - -diff -durN gdb-6.7.1.orig/gdb/main.c gdb-6.7.1/gdb/main.c ---- gdb-6.7.1.orig/gdb/main.c 2007-08-23 20:08:36.000000000 +0200 -+++ gdb-6.7.1/gdb/main.c 2008-06-17 23:27:44.000000000 +0200 -@@ -688,7 +688,7 @@ - - if (!inhibit_gdbinit) - { -- catch_command_errors (source_script, homeinit, 0, RETURN_MASK_ALL); -+ catch_command_errors (source_script, homeinit, -1, RETURN_MASK_ALL); - } - - /* Do stats; no need to do them elsewhere since we'll only -@@ -766,7 +766,7 @@ - || memcmp ((char *) &homebuf, (char *) &cwdbuf, sizeof (struct stat))) - if (!inhibit_gdbinit) - { -- catch_command_errors (source_script, gdbinit, 0, RETURN_MASK_ALL); -+ catch_command_errors (source_script, gdbinit, -1, RETURN_MASK_ALL); - } - - for (i = 0; i < ncmd; i++) -diff -durN gdb-6.7.1.orig/gdb/Makefile.in gdb-6.7.1/gdb/Makefile.in ---- gdb-6.7.1.orig/gdb/Makefile.in 2008-06-17 23:27:44.000000000 +0200 -+++ gdb-6.7.1/gdb/Makefile.in 2008-06-17 23:27:44.000000000 +0200 -@@ -2885,7 +2885,7 @@ - $(expression_h) $(frame_h) $(value_h) $(language_h) $(filenames_h) \ - $(objfiles_h) $(source_h) $(disasm_h) $(ui_out_h) $(top_h) \ - $(cli_decode_h) $(cli_script_h) $(cli_setshow_h) $(cli_cmds_h) \ -- $(tui_h) -+ $(tui_h) $(gdb_stat_h) - $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-cmds.c - cli-decode.o: $(srcdir)/cli/cli-decode.c $(defs_h) $(symtab_h) \ - $(gdb_regex_h) $(gdb_string_h) $(completer_h) $(ui_out_h) \ -diff -durN gdb-6.7.1.orig/gdb/testsuite/gdb.base/gdbinit.exp gdb-6.7.1/gdb/testsuite/gdb.base/gdbinit.exp ---- gdb-6.7.1.orig/gdb/testsuite/gdb.base/gdbinit.exp 1970-01-01 01:00:00.000000000 +0100 -+++ gdb-6.7.1/gdb/testsuite/gdb.base/gdbinit.exp 2008-06-17 23:27:44.000000000 +0200 -@@ -0,0 +1,98 @@ -+# Copyright 2005 -+# Free Software Foundation, Inc. -+ -+# This program 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 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@prep.ai.mit.edu -+ -+# This file was written by Jeff Johnston . -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+set prms_id 0 -+set bug_id 0 -+ -+# are we on a target board -+if [is_remote target] { -+ return -+} -+ -+ -+global verbose -+global GDB -+global GDBFLAGS -+global gdb_prompt -+global timeout -+global gdb_spawn_id; -+ -+gdb_stop_suppressing_tests; -+ -+verbose "Spawning $GDB -nw" -+ -+if [info exists gdb_spawn_id] { -+ return 0; -+} -+ -+if ![is_remote host] { -+ if { [which $GDB] == 0 } then { -+ perror "$GDB does not exist." -+ exit 1 -+ } -+} -+ -+set env(HOME) [pwd] -+remote_exec build "rm .gdbinit" -+remote_exec build "cp ${srcdir}/${subdir}/gdbinit.sample .gdbinit" -+remote_exec build "chmod 646 .gdbinit" -+ -+set res [remote_spawn host "$GDB -nw [host_info gdb_opts]"]; -+if { $res < 0 || $res == "" } { -+ perror "Spawning $GDB failed." -+ return 1; -+} -+gdb_expect 360 { -+ -re "warning: not using untrusted file.*\.gdbinit.*\[\r\n\]$gdb_prompt $" { -+ pass "untrusted .gdbinit caught." -+ } -+ -re "$gdb_prompt $" { -+ fail "untrusted .gdbinit caught." -+ } -+ timeout { -+ fail "(timeout) untrusted .gdbinit caught." -+ } -+} -+ -+remote_exec build "chmod 644 .gdbinit" -+set res [remote_spawn host "$GDB -nw [host_info gdb_opts]"]; -+if { $res < 0 || $res == "" } { -+ perror "Spawning $GDB failed." -+ return 1; -+} -+gdb_expect 360 { -+ -re "warning: not using untrusted file.*\.gdbinit.*\[\r\n\]$gdb_prompt $" { -+ fail "trusted .gdbinit allowed." -+ } -+ -re "in gdbinit.*$gdb_prompt $" { -+ pass "trusted .gdbinit allowed." -+ } -+ timeout { -+ fail "(timeout) trusted .gdbinit allowed." -+ } -+} -+ -+remote_exec build "rm .gdbinit" -diff -durN gdb-6.7.1.orig/gdb/testsuite/gdb.base/gdbinit.sample gdb-6.7.1/gdb/testsuite/gdb.base/gdbinit.sample ---- gdb-6.7.1.orig/gdb/testsuite/gdb.base/gdbinit.sample 1970-01-01 01:00:00.000000000 +0100 -+++ gdb-6.7.1/gdb/testsuite/gdb.base/gdbinit.sample 2008-06-17 23:27:44.000000000 +0200 -@@ -0,0 +1 @@ -+echo "\nin gdbinit" diff --git a/patches/gdb/6.7.1/175-hppa-offsets.patch b/patches/gdb/6.7.1/175-hppa-offsets.patch deleted file mode 100644 index 06e1e74..0000000 --- a/patches/gdb/6.7.1/175-hppa-offsets.patch +++ /dev/null @@ -1,272 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gdb/6.7.1/45_all_gdb-hppa-offsets.patch --= BEGIN original header =- -sanitized headers dont include asm/offsets.h, so cache a local copy - -http://bugs.gentoo.org/180476 -http://lists.parisc-linux.org/pipermail/parisc-linux/2007-February/031162.html - --= END original header =- -diff -durN gdb-6.7.1.orig/gdb/hppa-linux-nat.c gdb-6.7.1/gdb/hppa-linux-nat.c ---- gdb-6.7.1.orig/gdb/hppa-linux-nat.c 2007-08-23 20:08:33.000000000 +0200 -+++ gdb-6.7.1/gdb/hppa-linux-nat.c 2008-06-17 23:27:45.000000000 +0200 -@@ -32,7 +32,7 @@ - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,43) - #include - #else --#include -+#include - #endif - - #include "hppa-tdep.h" -diff -durN gdb-6.7.1.orig/gdb/hppa-offsets.h gdb-6.7.1/gdb/hppa-offsets.h ---- gdb-6.7.1.orig/gdb/hppa-offsets.h 1970-01-01 01:00:00.000000000 +0100 -+++ gdb-6.7.1/gdb/hppa-offsets.h 2008-06-17 23:27:45.000000000 +0200 -@@ -0,0 +1,248 @@ -+#ifndef __ASM_OFFSETS_H__ -+#define __ASM_OFFSETS_H__ -+/* -+ * DO NOT MODIFY. -+ * -+ * This file was generated by arch/parisc/Makefile -+ * -+ */ -+ -+#define TASK_THREAD_INFO 4 /* offsetof(struct task_struct, thread_info) */ -+#define TASK_STATE 0 /* offsetof(struct task_struct, state) */ -+#define TASK_FLAGS 12 /* offsetof(struct task_struct, flags) */ -+#define TASK_SIGPENDING 1188 /* offsetof(struct task_struct, pending) */ -+#define TASK_PTRACE 16 /* offsetof(struct task_struct, ptrace) */ -+#define TASK_MM 108 /* offsetof(struct task_struct, mm) */ -+#define TASK_PERSONALITY 132 /* offsetof(struct task_struct, personality) */ -+#define TASK_PID 140 /* offsetof(struct task_struct, pid) */ -+ -+#define TASK_REGS 664 /* offsetof(struct task_struct, thread.regs) */ -+#define TASK_PT_PSW 664 /* offsetof(struct task_struct, thread.regs.gr[ 0]) */ -+#define TASK_PT_GR1 668 /* offsetof(struct task_struct, thread.regs.gr[ 1]) */ -+#define TASK_PT_GR2 672 /* offsetof(struct task_struct, thread.regs.gr[ 2]) */ -+#define TASK_PT_GR3 676 /* offsetof(struct task_struct, thread.regs.gr[ 3]) */ -+#define TASK_PT_GR4 680 /* offsetof(struct task_struct, thread.regs.gr[ 4]) */ -+#define TASK_PT_GR5 684 /* offsetof(struct task_struct, thread.regs.gr[ 5]) */ -+#define TASK_PT_GR6 688 /* offsetof(struct task_struct, thread.regs.gr[ 6]) */ -+#define TASK_PT_GR7 692 /* offsetof(struct task_struct, thread.regs.gr[ 7]) */ -+#define TASK_PT_GR8 696 /* offsetof(struct task_struct, thread.regs.gr[ 8]) */ -+#define TASK_PT_GR9 700 /* offsetof(struct task_struct, thread.regs.gr[ 9]) */ -+#define TASK_PT_GR10 704 /* offsetof(struct task_struct, thread.regs.gr[10]) */ -+#define TASK_PT_GR11 708 /* offsetof(struct task_struct, thread.regs.gr[11]) */ -+#define TASK_PT_GR12 712 /* offsetof(struct task_struct, thread.regs.gr[12]) */ -+#define TASK_PT_GR13 716 /* offsetof(struct task_struct, thread.regs.gr[13]) */ -+#define TASK_PT_GR14 720 /* offsetof(struct task_struct, thread.regs.gr[14]) */ -+#define TASK_PT_GR15 724 /* offsetof(struct task_struct, thread.regs.gr[15]) */ -+#define TASK_PT_GR16 728 /* offsetof(struct task_struct, thread.regs.gr[16]) */ -+#define TASK_PT_GR17 732 /* offsetof(struct task_struct, thread.regs.gr[17]) */ -+#define TASK_PT_GR18 736 /* offsetof(struct task_struct, thread.regs.gr[18]) */ -+#define TASK_PT_GR19 740 /* offsetof(struct task_struct, thread.regs.gr[19]) */ -+#define TASK_PT_GR20 744 /* offsetof(struct task_struct, thread.regs.gr[20]) */ -+#define TASK_PT_GR21 748 /* offsetof(struct task_struct, thread.regs.gr[21]) */ -+#define TASK_PT_GR22 752 /* offsetof(struct task_struct, thread.regs.gr[22]) */ -+#define TASK_PT_GR23 756 /* offsetof(struct task_struct, thread.regs.gr[23]) */ -+#define TASK_PT_GR24 760 /* offsetof(struct task_struct, thread.regs.gr[24]) */ -+#define TASK_PT_GR25 764 /* offsetof(struct task_struct, thread.regs.gr[25]) */ -+#define TASK_PT_GR26 768 /* offsetof(struct task_struct, thread.regs.gr[26]) */ -+#define TASK_PT_GR27 772 /* offsetof(struct task_struct, thread.regs.gr[27]) */ -+#define TASK_PT_GR28 776 /* offsetof(struct task_struct, thread.regs.gr[28]) */ -+#define TASK_PT_GR29 780 /* offsetof(struct task_struct, thread.regs.gr[29]) */ -+#define TASK_PT_GR30 784 /* offsetof(struct task_struct, thread.regs.gr[30]) */ -+#define TASK_PT_GR31 788 /* offsetof(struct task_struct, thread.regs.gr[31]) */ -+#define TASK_PT_FR0 792 /* offsetof(struct task_struct, thread.regs.fr[ 0]) */ -+#define TASK_PT_FR1 800 /* offsetof(struct task_struct, thread.regs.fr[ 1]) */ -+#define TASK_PT_FR2 808 /* offsetof(struct task_struct, thread.regs.fr[ 2]) */ -+#define TASK_PT_FR3 816 /* offsetof(struct task_struct, thread.regs.fr[ 3]) */ -+#define TASK_PT_FR4 824 /* offsetof(struct task_struct, thread.regs.fr[ 4]) */ -+#define TASK_PT_FR5 832 /* offsetof(struct task_struct, thread.regs.fr[ 5]) */ -+#define TASK_PT_FR6 840 /* offsetof(struct task_struct, thread.regs.fr[ 6]) */ -+#define TASK_PT_FR7 848 /* offsetof(struct task_struct, thread.regs.fr[ 7]) */ -+#define TASK_PT_FR8 856 /* offsetof(struct task_struct, thread.regs.fr[ 8]) */ -+#define TASK_PT_FR9 864 /* offsetof(struct task_struct, thread.regs.fr[ 9]) */ -+#define TASK_PT_FR10 872 /* offsetof(struct task_struct, thread.regs.fr[10]) */ -+#define TASK_PT_FR11 880 /* offsetof(struct task_struct, thread.regs.fr[11]) */ -+#define TASK_PT_FR12 888 /* offsetof(struct task_struct, thread.regs.fr[12]) */ -+#define TASK_PT_FR13 896 /* offsetof(struct task_struct, thread.regs.fr[13]) */ -+#define TASK_PT_FR14 904 /* offsetof(struct task_struct, thread.regs.fr[14]) */ -+#define TASK_PT_FR15 912 /* offsetof(struct task_struct, thread.regs.fr[15]) */ -+#define TASK_PT_FR16 920 /* offsetof(struct task_struct, thread.regs.fr[16]) */ -+#define TASK_PT_FR17 928 /* offsetof(struct task_struct, thread.regs.fr[17]) */ -+#define TASK_PT_FR18 936 /* offsetof(struct task_struct, thread.regs.fr[18]) */ -+#define TASK_PT_FR19 944 /* offsetof(struct task_struct, thread.regs.fr[19]) */ -+#define TASK_PT_FR20 952 /* offsetof(struct task_struct, thread.regs.fr[20]) */ -+#define TASK_PT_FR21 960 /* offsetof(struct task_struct, thread.regs.fr[21]) */ -+#define TASK_PT_FR22 968 /* offsetof(struct task_struct, thread.regs.fr[22]) */ -+#define TASK_PT_FR23 976 /* offsetof(struct task_struct, thread.regs.fr[23]) */ -+#define TASK_PT_FR24 984 /* offsetof(struct task_struct, thread.regs.fr[24]) */ -+#define TASK_PT_FR25 992 /* offsetof(struct task_struct, thread.regs.fr[25]) */ -+#define TASK_PT_FR26 1000 /* offsetof(struct task_struct, thread.regs.fr[26]) */ -+#define TASK_PT_FR27 1008 /* offsetof(struct task_struct, thread.regs.fr[27]) */ -+#define TASK_PT_FR28 1016 /* offsetof(struct task_struct, thread.regs.fr[28]) */ -+#define TASK_PT_FR29 1024 /* offsetof(struct task_struct, thread.regs.fr[29]) */ -+#define TASK_PT_FR30 1032 /* offsetof(struct task_struct, thread.regs.fr[30]) */ -+#define TASK_PT_FR31 1040 /* offsetof(struct task_struct, thread.regs.fr[31]) */ -+#define TASK_PT_SR0 1048 /* offsetof(struct task_struct, thread.regs.sr[ 0]) */ -+#define TASK_PT_SR1 1052 /* offsetof(struct task_struct, thread.regs.sr[ 1]) */ -+#define TASK_PT_SR2 1056 /* offsetof(struct task_struct, thread.regs.sr[ 2]) */ -+#define TASK_PT_SR3 1060 /* offsetof(struct task_struct, thread.regs.sr[ 3]) */ -+#define TASK_PT_SR4 1064 /* offsetof(struct task_struct, thread.regs.sr[ 4]) */ -+#define TASK_PT_SR5 1068 /* offsetof(struct task_struct, thread.regs.sr[ 5]) */ -+#define TASK_PT_SR6 1072 /* offsetof(struct task_struct, thread.regs.sr[ 6]) */ -+#define TASK_PT_SR7 1076 /* offsetof(struct task_struct, thread.regs.sr[ 7]) */ -+#define TASK_PT_IASQ0 1080 /* offsetof(struct task_struct, thread.regs.iasq[0]) */ -+#define TASK_PT_IASQ1 1084 /* offsetof(struct task_struct, thread.regs.iasq[1]) */ -+#define TASK_PT_IAOQ0 1088 /* offsetof(struct task_struct, thread.regs.iaoq[0]) */ -+#define TASK_PT_IAOQ1 1092 /* offsetof(struct task_struct, thread.regs.iaoq[1]) */ -+#define TASK_PT_CR27 1096 /* offsetof(struct task_struct, thread.regs.cr27) */ -+#define TASK_PT_ORIG_R28 1104 /* offsetof(struct task_struct, thread.regs.orig_r28) */ -+#define TASK_PT_KSP 1108 /* offsetof(struct task_struct, thread.regs.ksp) */ -+#define TASK_PT_KPC 1112 /* offsetof(struct task_struct, thread.regs.kpc) */ -+#define TASK_PT_SAR 1116 /* offsetof(struct task_struct, thread.regs.sar) */ -+#define TASK_PT_IIR 1120 /* offsetof(struct task_struct, thread.regs.iir) */ -+#define TASK_PT_ISR 1124 /* offsetof(struct task_struct, thread.regs.isr) */ -+#define TASK_PT_IOR 1128 /* offsetof(struct task_struct, thread.regs.ior) */ -+ -+#define TASK_SZ 1272 /* sizeof(struct task_struct) */ -+#define TASK_SZ_ALGN 1344 /* align(sizeof(struct task_struct), 64) */ -+ -+#define PT_PSW 0 /* offsetof(struct pt_regs, gr[ 0]) */ -+#define PT_GR1 4 /* offsetof(struct pt_regs, gr[ 1]) */ -+#define PT_GR2 8 /* offsetof(struct pt_regs, gr[ 2]) */ -+#define PT_GR3 12 /* offsetof(struct pt_regs, gr[ 3]) */ -+#define PT_GR4 16 /* offsetof(struct pt_regs, gr[ 4]) */ -+#define PT_GR5 20 /* offsetof(struct pt_regs, gr[ 5]) */ -+#define PT_GR6 24 /* offsetof(struct pt_regs, gr[ 6]) */ -+#define PT_GR7 28 /* offsetof(struct pt_regs, gr[ 7]) */ -+#define PT_GR8 32 /* offsetof(struct pt_regs, gr[ 8]) */ -+#define PT_GR9 36 /* offsetof(struct pt_regs, gr[ 9]) */ -+#define PT_GR10 40 /* offsetof(struct pt_regs, gr[10]) */ -+#define PT_GR11 44 /* offsetof(struct pt_regs, gr[11]) */ -+#define PT_GR12 48 /* offsetof(struct pt_regs, gr[12]) */ -+#define PT_GR13 52 /* offsetof(struct pt_regs, gr[13]) */ -+#define PT_GR14 56 /* offsetof(struct pt_regs, gr[14]) */ -+#define PT_GR15 60 /* offsetof(struct pt_regs, gr[15]) */ -+#define PT_GR16 64 /* offsetof(struct pt_regs, gr[16]) */ -+#define PT_GR17 68 /* offsetof(struct pt_regs, gr[17]) */ -+#define PT_GR18 72 /* offsetof(struct pt_regs, gr[18]) */ -+#define PT_GR19 76 /* offsetof(struct pt_regs, gr[19]) */ -+#define PT_GR20 80 /* offsetof(struct pt_regs, gr[20]) */ -+#define PT_GR21 84 /* offsetof(struct pt_regs, gr[21]) */ -+#define PT_GR22 88 /* offsetof(struct pt_regs, gr[22]) */ -+#define PT_GR23 92 /* offsetof(struct pt_regs, gr[23]) */ -+#define PT_GR24 96 /* offsetof(struct pt_regs, gr[24]) */ -+#define PT_GR25 100 /* offsetof(struct pt_regs, gr[25]) */ -+#define PT_GR26 104 /* offsetof(struct pt_regs, gr[26]) */ -+#define PT_GR27 108 /* offsetof(struct pt_regs, gr[27]) */ -+#define PT_GR28 112 /* offsetof(struct pt_regs, gr[28]) */ -+#define PT_GR29 116 /* offsetof(struct pt_regs, gr[29]) */ -+#define PT_GR30 120 /* offsetof(struct pt_regs, gr[30]) */ -+#define PT_GR31 124 /* offsetof(struct pt_regs, gr[31]) */ -+#define PT_FR0 128 /* offsetof(struct pt_regs, fr[ 0]) */ -+#define PT_FR1 136 /* offsetof(struct pt_regs, fr[ 1]) */ -+#define PT_FR2 144 /* offsetof(struct pt_regs, fr[ 2]) */ -+#define PT_FR3 152 /* offsetof(struct pt_regs, fr[ 3]) */ -+#define PT_FR4 160 /* offsetof(struct pt_regs, fr[ 4]) */ -+#define PT_FR5 168 /* offsetof(struct pt_regs, fr[ 5]) */ -+#define PT_FR6 176 /* offsetof(struct pt_regs, fr[ 6]) */ -+#define PT_FR7 184 /* offsetof(struct pt_regs, fr[ 7]) */ -+#define PT_FR8 192 /* offsetof(struct pt_regs, fr[ 8]) */ -+#define PT_FR9 200 /* offsetof(struct pt_regs, fr[ 9]) */ -+#define PT_FR10 208 /* offsetof(struct pt_regs, fr[10]) */ -+#define PT_FR11 216 /* offsetof(struct pt_regs, fr[11]) */ -+#define PT_FR12 224 /* offsetof(struct pt_regs, fr[12]) */ -+#define PT_FR13 232 /* offsetof(struct pt_regs, fr[13]) */ -+#define PT_FR14 240 /* offsetof(struct pt_regs, fr[14]) */ -+#define PT_FR15 248 /* offsetof(struct pt_regs, fr[15]) */ -+#define PT_FR16 256 /* offsetof(struct pt_regs, fr[16]) */ -+#define PT_FR17 264 /* offsetof(struct pt_regs, fr[17]) */ -+#define PT_FR18 272 /* offsetof(struct pt_regs, fr[18]) */ -+#define PT_FR19 280 /* offsetof(struct pt_regs, fr[19]) */ -+#define PT_FR20 288 /* offsetof(struct pt_regs, fr[20]) */ -+#define PT_FR21 296 /* offsetof(struct pt_regs, fr[21]) */ -+#define PT_FR22 304 /* offsetof(struct pt_regs, fr[22]) */ -+#define PT_FR23 312 /* offsetof(struct pt_regs, fr[23]) */ -+#define PT_FR24 320 /* offsetof(struct pt_regs, fr[24]) */ -+#define PT_FR25 328 /* offsetof(struct pt_regs, fr[25]) */ -+#define PT_FR26 336 /* offsetof(struct pt_regs, fr[26]) */ -+#define PT_FR27 344 /* offsetof(struct pt_regs, fr[27]) */ -+#define PT_FR28 352 /* offsetof(struct pt_regs, fr[28]) */ -+#define PT_FR29 360 /* offsetof(struct pt_regs, fr[29]) */ -+#define PT_FR30 368 /* offsetof(struct pt_regs, fr[30]) */ -+#define PT_FR31 376 /* offsetof(struct pt_regs, fr[31]) */ -+#define PT_SR0 384 /* offsetof(struct pt_regs, sr[ 0]) */ -+#define PT_SR1 388 /* offsetof(struct pt_regs, sr[ 1]) */ -+#define PT_SR2 392 /* offsetof(struct pt_regs, sr[ 2]) */ -+#define PT_SR3 396 /* offsetof(struct pt_regs, sr[ 3]) */ -+#define PT_SR4 400 /* offsetof(struct pt_regs, sr[ 4]) */ -+#define PT_SR5 404 /* offsetof(struct pt_regs, sr[ 5]) */ -+#define PT_SR6 408 /* offsetof(struct pt_regs, sr[ 6]) */ -+#define PT_SR7 412 /* offsetof(struct pt_regs, sr[ 7]) */ -+#define PT_IASQ0 416 /* offsetof(struct pt_regs, iasq[0]) */ -+#define PT_IASQ1 420 /* offsetof(struct pt_regs, iasq[1]) */ -+#define PT_IAOQ0 424 /* offsetof(struct pt_regs, iaoq[0]) */ -+#define PT_IAOQ1 428 /* offsetof(struct pt_regs, iaoq[1]) */ -+#define PT_CR27 432 /* offsetof(struct pt_regs, cr27) */ -+#define PT_ORIG_R28 440 /* offsetof(struct pt_regs, orig_r28) */ -+#define PT_KSP 444 /* offsetof(struct pt_regs, ksp) */ -+#define PT_KPC 448 /* offsetof(struct pt_regs, kpc) */ -+#define PT_SAR 452 /* offsetof(struct pt_regs, sar) */ -+#define PT_IIR 456 /* offsetof(struct pt_regs, iir) */ -+#define PT_ISR 460 /* offsetof(struct pt_regs, isr) */ -+#define PT_IOR 464 /* offsetof(struct pt_regs, ior) */ -+#define PT_SIZE 472 /* sizeof(struct pt_regs) */ -+#define PT_SZ_ALGN 576 /* align(sizeof(struct pt_regs), 64) */ -+ -+#define TI_TASK 0 /* offsetof(struct thread_info, task) */ -+#define TI_EXEC_DOMAIN 4 /* offsetof(struct thread_info, exec_domain) */ -+#define TI_FLAGS 8 /* offsetof(struct thread_info, flags) */ -+#define TI_CPU 16 /* offsetof(struct thread_info, cpu) */ -+#define TI_SEGMENT 12 /* offsetof(struct thread_info, addr_limit) */ -+#define TI_PRE_COUNT 20 /* offsetof(struct thread_info, preempt_count) */ -+#define THREAD_SZ 44 /* sizeof(struct thread_info) */ -+#define THREAD_SZ_ALGN 128 /* align(sizeof(struct thread_info), 64) */ -+ -+#define IRQSTAT_SIRQ_PEND 0 /* offsetof(irq_cpustat_t, __softirq_pending) */ -+#define IRQSTAT_SZ 64 /* sizeof(irq_cpustat_t) */ -+ -+#define ICACHE_BASE 8 /* offsetof(struct pdc_cache_info, ic_base) */ -+#define ICACHE_STRIDE 12 /* offsetof(struct pdc_cache_info, ic_stride) */ -+#define ICACHE_COUNT 16 /* offsetof(struct pdc_cache_info, ic_count) */ -+#define ICACHE_LOOP 20 /* offsetof(struct pdc_cache_info, ic_loop) */ -+#define DCACHE_BASE 32 /* offsetof(struct pdc_cache_info, dc_base) */ -+#define DCACHE_STRIDE 36 /* offsetof(struct pdc_cache_info, dc_stride) */ -+#define DCACHE_COUNT 40 /* offsetof(struct pdc_cache_info, dc_count) */ -+#define DCACHE_LOOP 44 /* offsetof(struct pdc_cache_info, dc_loop) */ -+#define ITLB_SID_BASE 56 /* offsetof(struct pdc_cache_info, it_sp_base) */ -+#define ITLB_SID_STRIDE 60 /* offsetof(struct pdc_cache_info, it_sp_stride) */ -+#define ITLB_SID_COUNT 64 /* offsetof(struct pdc_cache_info, it_sp_count) */ -+#define ITLB_OFF_BASE 68 /* offsetof(struct pdc_cache_info, it_off_base) */ -+#define ITLB_OFF_STRIDE 72 /* offsetof(struct pdc_cache_info, it_off_stride) */ -+#define ITLB_OFF_COUNT 76 /* offsetof(struct pdc_cache_info, it_off_count) */ -+#define ITLB_LOOP 80 /* offsetof(struct pdc_cache_info, it_loop) */ -+#define DTLB_SID_BASE 92 /* offsetof(struct pdc_cache_info, dt_sp_base) */ -+#define DTLB_SID_STRIDE 96 /* offsetof(struct pdc_cache_info, dt_sp_stride) */ -+#define DTLB_SID_COUNT 100 /* offsetof(struct pdc_cache_info, dt_sp_count) */ -+#define DTLB_OFF_BASE 104 /* offsetof(struct pdc_cache_info, dt_off_base) */ -+#define DTLB_OFF_STRIDE 108 /* offsetof(struct pdc_cache_info, dt_off_stride) */ -+#define DTLB_OFF_COUNT 112 /* offsetof(struct pdc_cache_info, dt_off_count) */ -+#define DTLB_LOOP 116 /* offsetof(struct pdc_cache_info, dt_loop) */ -+ -+#define PA_BLOCKSTEP_BIT 1 /* 31-PT_BLOCKSTEP_BIT */ -+#define PA_SINGLESTEP_BIT 0 /* 31-PT_SINGLESTEP_BIT */ -+ -+#define ASM_PMD_SHIFT 21 /* PMD_SHIFT */ -+#define ASM_PGDIR_SHIFT 21 /* PGDIR_SHIFT */ -+#define ASM_BITS_PER_PGD 11 /* BITS_PER_PGD */ -+#define ASM_BITS_PER_PMD 0 /* BITS_PER_PMD */ -+#define ASM_BITS_PER_PTE 9 /* BITS_PER_PTE */ -+#define ASM_PGD_PMD_OFFSET -8192 /* -(PAGE_SIZE << PGD_ORDER) */ -+#define ASM_PMD_ENTRY 128 /* ((PAGE_OFFSET & PMD_MASK) >> PMD_SHIFT) */ -+#define ASM_PGD_ENTRY 128 /* PAGE_OFFSET >> PGDIR_SHIFT */ -+#define ASM_PGD_ENTRY_SIZE 4 /* PGD_ENTRY_SIZE */ -+#define ASM_PMD_ENTRY_SIZE 4 /* PMD_ENTRY_SIZE */ -+#define ASM_PTE_ENTRY_SIZE 8 /* PTE_ENTRY_SIZE */ -+#define ASM_PT_INITIAL 4 /* PT_INITIAL */ -+#define ASM_PAGE_SIZE 4096 /* PAGE_SIZE */ -+ -+ -+#endif diff --git a/patches/gdb/6.7.1/200-deleted-children.patch b/patches/gdb/6.7.1/200-deleted-children.patch deleted file mode 100644 index 08bbba9..0000000 --- a/patches/gdb/6.7.1/200-deleted-children.patch +++ /dev/null @@ -1,26 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gdb/6.7.1/50_all_gdb-deleted-children.patch --= BEGIN original header =- -http://bugs.gentoo.org/210636 -http://sourceware.org/ml/gdb-patches/2007-11/msg00136.html - -2007-11-07 Vladimir Prus - - Fix crash when a variable object being deleted - has any of its children deleted previously. - - * varobj.c (delete_variable_1): Don't recurse - into deleted children. - --= END original header =- -diff -durN gdb-6.7.1.orig/gdb/varobj.c gdb-6.7.1/gdb/varobj.c ---- gdb-6.7.1.orig/gdb/varobj.c 2007-08-31 21:01:17.000000000 +0200 -+++ gdb-6.7.1/gdb/varobj.c 2008-06-17 23:27:45.000000000 +0200 -@@ -1295,6 +1295,8 @@ - for (i = 0; i < VEC_length (varobj_p, var->children); ++i) - { - varobj_p child = VEC_index (varobj_p, var->children, i); -+ if (!child) -+ continue; - if (!remove_from_parent_p) - child->parent = NULL; - delete_variable_1 (resultp, delcountp, child, 0, only_children_p); diff --git a/patches/gdb/6.7.1/225-dwarf-stack-overflow.patch b/patches/gdb/6.7.1/225-dwarf-stack-overflow.patch deleted file mode 100644 index 764ec65..0000000 --- a/patches/gdb/6.7.1/225-dwarf-stack-overflow.patch +++ /dev/null @@ -1,52 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gdb/6.7.1/80_all_gdb-6.5-dwarf-stack-overflow.patch --= BEGIN original header =- -http://bugs.gentoo.org/144833 - -for gdb/ChangeLog: -2006-08-22 Will Drewry - Tavis Ormandy - - * dwarf2read.c (decode_locdesc): Enforce location description stack - boundaries. - * dwarfread.c (locval): Likewise. - --= END original header =- -diff -durN gdb-6.7.1.orig/gdb/dwarf2read.c gdb-6.7.1/gdb/dwarf2read.c ---- gdb-6.7.1.orig/gdb/dwarf2read.c 2007-09-05 02:51:48.000000000 +0200 -+++ gdb-6.7.1/gdb/dwarf2read.c 2008-06-17 23:27:46.000000000 +0200 -@@ -9061,8 +9061,7 @@ - callers will only want a very basic result and this can become a - complaint. - -- Note that stack[0] is unused except as a default error return. -- Note that stack overflow is not yet handled. */ -+ Note that stack[0] is unused except as a default error return. */ - - static CORE_ADDR - decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu) -@@ -9079,7 +9078,7 @@ - - i = 0; - stacki = 0; -- stack[stacki] = 0; -+ stack[++stacki] = 0; - - while (i < size) - { -@@ -9261,6 +9260,16 @@ - dwarf_stack_op_name (op)); - return (stack[stacki]); - } -+ /* Enforce maximum stack depth of size-1 to avoid ++stacki writing -+ outside of the allocated space. Also enforce minimum > 0. -+ -- wad@google.com 14 Aug 2006 */ -+ if (stacki >= sizeof (stack) / sizeof (*stack) - 1) -+ internal_error (__FILE__, __LINE__, -+ _("location description stack too deep: %d"), -+ stacki); -+ if (stacki <= 0) -+ internal_error (__FILE__, __LINE__, -+ _("location description stack too shallow")); - } - return (stack[stacki]); - } diff --git a/patches/gdb/6.7/110-hppa-offsets.patch b/patches/gdb/6.7/110-hppa-offsets.patch new file mode 100644 index 0000000..9de831b --- /dev/null +++ b/patches/gdb/6.7/110-hppa-offsets.patch @@ -0,0 +1,272 @@ +Original patch from gentoo: gentoo/src/patchsets/gdb/6.7/45_all_gdb-hppa-offsets.patch +-= BEGIN original header =- +sanitized headers dont include asm/offsets.h, so cache a local copy + +http://bugs.gentoo.org/180476 +http://lists.parisc-linux.org/pipermail/parisc-linux/2007-February/031162.html + +-= END original header =- +diff -durN gdb-6.7.orig/gdb/hppa-linux-nat.c gdb-6.7/gdb/hppa-linux-nat.c +--- gdb-6.7.orig/gdb/hppa-linux-nat.c 2007-08-23 20:08:33.000000000 +0200 ++++ gdb-6.7/gdb/hppa-linux-nat.c 2008-06-17 23:25:28.000000000 +0200 +@@ -32,7 +32,7 @@ + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,43) + #include + #else +-#include ++#include + #endif + + #include "hppa-tdep.h" +diff -durN gdb-6.7.orig/gdb/hppa-offsets.h gdb-6.7/gdb/hppa-offsets.h +--- gdb-6.7.orig/gdb/hppa-offsets.h 1970-01-01 01:00:00.000000000 +0100 ++++ gdb-6.7/gdb/hppa-offsets.h 2008-06-17 23:25:28.000000000 +0200 +@@ -0,0 +1,248 @@ ++#ifndef __ASM_OFFSETS_H__ ++#define __ASM_OFFSETS_H__ ++/* ++ * DO NOT MODIFY. ++ * ++ * This file was generated by arch/parisc/Makefile ++ * ++ */ ++ ++#define TASK_THREAD_INFO 4 /* offsetof(struct task_struct, thread_info) */ ++#define TASK_STATE 0 /* offsetof(struct task_struct, state) */ ++#define TASK_FLAGS 12 /* offsetof(struct task_struct, flags) */ ++#define TASK_SIGPENDING 1188 /* offsetof(struct task_struct, pending) */ ++#define TASK_PTRACE 16 /* offsetof(struct task_struct, ptrace) */ ++#define TASK_MM 108 /* offsetof(struct task_struct, mm) */ ++#define TASK_PERSONALITY 132 /* offsetof(struct task_struct, personality) */ ++#define TASK_PID 140 /* offsetof(struct task_struct, pid) */ ++ ++#define TASK_REGS 664 /* offsetof(struct task_struct, thread.regs) */ ++#define TASK_PT_PSW 664 /* offsetof(struct task_struct, thread.regs.gr[ 0]) */ ++#define TASK_PT_GR1 668 /* offsetof(struct task_struct, thread.regs.gr[ 1]) */ ++#define TASK_PT_GR2 672 /* offsetof(struct task_struct, thread.regs.gr[ 2]) */ ++#define TASK_PT_GR3 676 /* offsetof(struct task_struct, thread.regs.gr[ 3]) */ ++#define TASK_PT_GR4 680 /* offsetof(struct task_struct, thread.regs.gr[ 4]) */ ++#define TASK_PT_GR5 684 /* offsetof(struct task_struct, thread.regs.gr[ 5]) */ ++#define TASK_PT_GR6 688 /* offsetof(struct task_struct, thread.regs.gr[ 6]) */ ++#define TASK_PT_GR7 692 /* offsetof(struct task_struct, thread.regs.gr[ 7]) */ ++#define TASK_PT_GR8 696 /* offsetof(struct task_struct, thread.regs.gr[ 8]) */ ++#define TASK_PT_GR9 700 /* offsetof(struct task_struct, thread.regs.gr[ 9]) */ ++#define TASK_PT_GR10 704 /* offsetof(struct task_struct, thread.regs.gr[10]) */ ++#define TASK_PT_GR11 708 /* offsetof(struct task_struct, thread.regs.gr[11]) */ ++#define TASK_PT_GR12 712 /* offsetof(struct task_struct, thread.regs.gr[12]) */ ++#define TASK_PT_GR13 716 /* offsetof(struct task_struct, thread.regs.gr[13]) */ ++#define TASK_PT_GR14 720 /* offsetof(struct task_struct, thread.regs.gr[14]) */ ++#define TASK_PT_GR15 724 /* offsetof(struct task_struct, thread.regs.gr[15]) */ ++#define TASK_PT_GR16 728 /* offsetof(struct task_struct, thread.regs.gr[16]) */ ++#define TASK_PT_GR17 732 /* offsetof(struct task_struct, thread.regs.gr[17]) */ ++#define TASK_PT_GR18 736 /* offsetof(struct task_struct, thread.regs.gr[18]) */ ++#define TASK_PT_GR19 740 /* offsetof(struct task_struct, thread.regs.gr[19]) */ ++#define TASK_PT_GR20 744 /* offsetof(struct task_struct, thread.regs.gr[20]) */ ++#define TASK_PT_GR21 748 /* offsetof(struct task_struct, thread.regs.gr[21]) */ ++#define TASK_PT_GR22 752 /* offsetof(struct task_struct, thread.regs.gr[22]) */ ++#define TASK_PT_GR23 756 /* offsetof(struct task_struct, thread.regs.gr[23]) */ ++#define TASK_PT_GR24 760 /* offsetof(struct task_struct, thread.regs.gr[24]) */ ++#define TASK_PT_GR25 764 /* offsetof(struct task_struct, thread.regs.gr[25]) */ ++#define TASK_PT_GR26 768 /* offsetof(struct task_struct, thread.regs.gr[26]) */ ++#define TASK_PT_GR27 772 /* offsetof(struct task_struct, thread.regs.gr[27]) */ ++#define TASK_PT_GR28 776 /* offsetof(struct task_struct, thread.regs.gr[28]) */ ++#define TASK_PT_GR29 780 /* offsetof(struct task_struct, thread.regs.gr[29]) */ ++#define TASK_PT_GR30 784 /* offsetof(struct task_struct, thread.regs.gr[30]) */ ++#define TASK_PT_GR31 788 /* offsetof(struct task_struct, thread.regs.gr[31]) */ ++#define TASK_PT_FR0 792 /* offsetof(struct task_struct, thread.regs.fr[ 0]) */ ++#define TASK_PT_FR1 800 /* offsetof(struct task_struct, thread.regs.fr[ 1]) */ ++#define TASK_PT_FR2 808 /* offsetof(struct task_struct, thread.regs.fr[ 2]) */ ++#define TASK_PT_FR3 816 /* offsetof(struct task_struct, thread.regs.fr[ 3]) */ ++#define TASK_PT_FR4 824 /* offsetof(struct task_struct, thread.regs.fr[ 4]) */ ++#define TASK_PT_FR5 832 /* offsetof(struct task_struct, thread.regs.fr[ 5]) */ ++#define TASK_PT_FR6 840 /* offsetof(struct task_struct, thread.regs.fr[ 6]) */ ++#define TASK_PT_FR7 848 /* offsetof(struct task_struct, thread.regs.fr[ 7]) */ ++#define TASK_PT_FR8 856 /* offsetof(struct task_struct, thread.regs.fr[ 8]) */ ++#define TASK_PT_FR9 864 /* offsetof(struct task_struct, thread.regs.fr[ 9]) */ ++#define TASK_PT_FR10 872 /* offsetof(struct task_struct, thread.regs.fr[10]) */ ++#define TASK_PT_FR11 880 /* offsetof(struct task_struct, thread.regs.fr[11]) */ ++#define TASK_PT_FR12 888 /* offsetof(struct task_struct, thread.regs.fr[12]) */ ++#define TASK_PT_FR13 896 /* offsetof(struct task_struct, thread.regs.fr[13]) */ ++#define TASK_PT_FR14 904 /* offsetof(struct task_struct, thread.regs.fr[14]) */ ++#define TASK_PT_FR15 912 /* offsetof(struct task_struct, thread.regs.fr[15]) */ ++#define TASK_PT_FR16 920 /* offsetof(struct task_struct, thread.regs.fr[16]) */ ++#define TASK_PT_FR17 928 /* offsetof(struct task_struct, thread.regs.fr[17]) */ ++#define TASK_PT_FR18 936 /* offsetof(struct task_struct, thread.regs.fr[18]) */ ++#define TASK_PT_FR19 944 /* offsetof(struct task_struct, thread.regs.fr[19]) */ ++#define TASK_PT_FR20 952 /* offsetof(struct task_struct, thread.regs.fr[20]) */ ++#define TASK_PT_FR21 960 /* offsetof(struct task_struct, thread.regs.fr[21]) */ ++#define TASK_PT_FR22 968 /* offsetof(struct task_struct, thread.regs.fr[22]) */ ++#define TASK_PT_FR23 976 /* offsetof(struct task_struct, thread.regs.fr[23]) */ ++#define TASK_PT_FR24 984 /* offsetof(struct task_struct, thread.regs.fr[24]) */ ++#define TASK_PT_FR25 992 /* offsetof(struct task_struct, thread.regs.fr[25]) */ ++#define TASK_PT_FR26 1000 /* offsetof(struct task_struct, thread.regs.fr[26]) */ ++#define TASK_PT_FR27 1008 /* offsetof(struct task_struct, thread.regs.fr[27]) */ ++#define TASK_PT_FR28 1016 /* offsetof(struct task_struct, thread.regs.fr[28]) */ ++#define TASK_PT_FR29 1024 /* offsetof(struct task_struct, thread.regs.fr[29]) */ ++#define TASK_PT_FR30 1032 /* offsetof(struct task_struct, thread.regs.fr[30]) */ ++#define TASK_PT_FR31 1040 /* offsetof(struct task_struct, thread.regs.fr[31]) */ ++#define TASK_PT_SR0 1048 /* offsetof(struct task_struct, thread.regs.sr[ 0]) */ ++#define TASK_PT_SR1 1052 /* offsetof(struct task_struct, thread.regs.sr[ 1]) */ ++#define TASK_PT_SR2 1056 /* offsetof(struct task_struct, thread.regs.sr[ 2]) */ ++#define TASK_PT_SR3 1060 /* offsetof(struct task_struct, thread.regs.sr[ 3]) */ ++#define TASK_PT_SR4 1064 /* offsetof(struct task_struct, thread.regs.sr[ 4]) */ ++#define TASK_PT_SR5 1068 /* offsetof(struct task_struct, thread.regs.sr[ 5]) */ ++#define TASK_PT_SR6 1072 /* offsetof(struct task_struct, thread.regs.sr[ 6]) */ ++#define TASK_PT_SR7 1076 /* offsetof(struct task_struct, thread.regs.sr[ 7]) */ ++#define TASK_PT_IASQ0 1080 /* offsetof(struct task_struct, thread.regs.iasq[0]) */ ++#define TASK_PT_IASQ1 1084 /* offsetof(struct task_struct, thread.regs.iasq[1]) */ ++#define TASK_PT_IAOQ0 1088 /* offsetof(struct task_struct, thread.regs.iaoq[0]) */ ++#define TASK_PT_IAOQ1 1092 /* offsetof(struct task_struct, thread.regs.iaoq[1]) */ ++#define TASK_PT_CR27 1096 /* offsetof(struct task_struct, thread.regs.cr27) */ ++#define TASK_PT_ORIG_R28 1104 /* offsetof(struct task_struct, thread.regs.orig_r28) */ ++#define TASK_PT_KSP 1108 /* offsetof(struct task_struct, thread.regs.ksp) */ ++#define TASK_PT_KPC 1112 /* offsetof(struct task_struct, thread.regs.kpc) */ ++#define TASK_PT_SAR 1116 /* offsetof(struct task_struct, thread.regs.sar) */ ++#define TASK_PT_IIR 1120 /* offsetof(struct task_struct, thread.regs.iir) */ ++#define TASK_PT_ISR 1124 /* offsetof(struct task_struct, thread.regs.isr) */ ++#define TASK_PT_IOR 1128 /* offsetof(struct task_struct, thread.regs.ior) */ ++ ++#define TASK_SZ 1272 /* sizeof(struct task_struct) */ ++#define TASK_SZ_ALGN 1344 /* align(sizeof(struct task_struct), 64) */ ++ ++#define PT_PSW 0 /* offsetof(struct pt_regs, gr[ 0]) */ ++#define PT_GR1 4 /* offsetof(struct pt_regs, gr[ 1]) */ ++#define PT_GR2 8 /* offsetof(struct pt_regs, gr[ 2]) */ ++#define PT_GR3 12 /* offsetof(struct pt_regs, gr[ 3]) */ ++#define PT_GR4 16 /* offsetof(struct pt_regs, gr[ 4]) */ ++#define PT_GR5 20 /* offsetof(struct pt_regs, gr[ 5]) */ ++#define PT_GR6 24 /* offsetof(struct pt_regs, gr[ 6]) */ ++#define PT_GR7 28 /* offsetof(struct pt_regs, gr[ 7]) */ ++#define PT_GR8 32 /* offsetof(struct pt_regs, gr[ 8]) */ ++#define PT_GR9 36 /* offsetof(struct pt_regs, gr[ 9]) */ ++#define PT_GR10 40 /* offsetof(struct pt_regs, gr[10]) */ ++#define PT_GR11 44 /* offsetof(struct pt_regs, gr[11]) */ ++#define PT_GR12 48 /* offsetof(struct pt_regs, gr[12]) */ ++#define PT_GR13 52 /* offsetof(struct pt_regs, gr[13]) */ ++#define PT_GR14 56 /* offsetof(struct pt_regs, gr[14]) */ ++#define PT_GR15 60 /* offsetof(struct pt_regs, gr[15]) */ ++#define PT_GR16 64 /* offsetof(struct pt_regs, gr[16]) */ ++#define PT_GR17 68 /* offsetof(struct pt_regs, gr[17]) */ ++#define PT_GR18 72 /* offsetof(struct pt_regs, gr[18]) */ ++#define PT_GR19 76 /* offsetof(struct pt_regs, gr[19]) */ ++#define PT_GR20 80 /* offsetof(struct pt_regs, gr[20]) */ ++#define PT_GR21 84 /* offsetof(struct pt_regs, gr[21]) */ ++#define PT_GR22 88 /* offsetof(struct pt_regs, gr[22]) */ ++#define PT_GR23 92 /* offsetof(struct pt_regs, gr[23]) */ ++#define PT_GR24 96 /* offsetof(struct pt_regs, gr[24]) */ ++#define PT_GR25 100 /* offsetof(struct pt_regs, gr[25]) */ ++#define PT_GR26 104 /* offsetof(struct pt_regs, gr[26]) */ ++#define PT_GR27 108 /* offsetof(struct pt_regs, gr[27]) */ ++#define PT_GR28 112 /* offsetof(struct pt_regs, gr[28]) */ ++#define PT_GR29 116 /* offsetof(struct pt_regs, gr[29]) */ ++#define PT_GR30 120 /* offsetof(struct pt_regs, gr[30]) */ ++#define PT_GR31 124 /* offsetof(struct pt_regs, gr[31]) */ ++#define PT_FR0 128 /* offsetof(struct pt_regs, fr[ 0]) */ ++#define PT_FR1 136 /* offsetof(struct pt_regs, fr[ 1]) */ ++#define PT_FR2 144 /* offsetof(struct pt_regs, fr[ 2]) */ ++#define PT_FR3 152 /* offsetof(struct pt_regs, fr[ 3]) */ ++#define PT_FR4 160 /* offsetof(struct pt_regs, fr[ 4]) */ ++#define PT_FR5 168 /* offsetof(struct pt_regs, fr[ 5]) */ ++#define PT_FR6 176 /* offsetof(struct pt_regs, fr[ 6]) */ ++#define PT_FR7 184 /* offsetof(struct pt_regs, fr[ 7]) */ ++#define PT_FR8 192 /* offsetof(struct pt_regs, fr[ 8]) */ ++#define PT_FR9 200 /* offsetof(struct pt_regs, fr[ 9]) */ ++#define PT_FR10 208 /* offsetof(struct pt_regs, fr[10]) */ ++#define PT_FR11 216 /* offsetof(struct pt_regs, fr[11]) */ ++#define PT_FR12 224 /* offsetof(struct pt_regs, fr[12]) */ ++#define PT_FR13 232 /* offsetof(struct pt_regs, fr[13]) */ ++#define PT_FR14 240 /* offsetof(struct pt_regs, fr[14]) */ ++#define PT_FR15 248 /* offsetof(struct pt_regs, fr[15]) */ ++#define PT_FR16 256 /* offsetof(struct pt_regs, fr[16]) */ ++#define PT_FR17 264 /* offsetof(struct pt_regs, fr[17]) */ ++#define PT_FR18 272 /* offsetof(struct pt_regs, fr[18]) */ ++#define PT_FR19 280 /* offsetof(struct pt_regs, fr[19]) */ ++#define PT_FR20 288 /* offsetof(struct pt_regs, fr[20]) */ ++#define PT_FR21 296 /* offsetof(struct pt_regs, fr[21]) */ ++#define PT_FR22 304 /* offsetof(struct pt_regs, fr[22]) */ ++#define PT_FR23 312 /* offsetof(struct pt_regs, fr[23]) */ ++#define PT_FR24 320 /* offsetof(struct pt_regs, fr[24]) */ ++#define PT_FR25 328 /* offsetof(struct pt_regs, fr[25]) */ ++#define PT_FR26 336 /* offsetof(struct pt_regs, fr[26]) */ ++#define PT_FR27 344 /* offsetof(struct pt_regs, fr[27]) */ ++#define PT_FR28 352 /* offsetof(struct pt_regs, fr[28]) */ ++#define PT_FR29 360 /* offsetof(struct pt_regs, fr[29]) */ ++#define PT_FR30 368 /* offsetof(struct pt_regs, fr[30]) */ ++#define PT_FR31 376 /* offsetof(struct pt_regs, fr[31]) */ ++#define PT_SR0 384 /* offsetof(struct pt_regs, sr[ 0]) */ ++#define PT_SR1 388 /* offsetof(struct pt_regs, sr[ 1]) */ ++#define PT_SR2 392 /* offsetof(struct pt_regs, sr[ 2]) */ ++#define PT_SR3 396 /* offsetof(struct pt_regs, sr[ 3]) */ ++#define PT_SR4 400 /* offsetof(struct pt_regs, sr[ 4]) */ ++#define PT_SR5 404 /* offsetof(struct pt_regs, sr[ 5]) */ ++#define PT_SR6 408 /* offsetof(struct pt_regs, sr[ 6]) */ ++#define PT_SR7 412 /* offsetof(struct pt_regs, sr[ 7]) */ ++#define PT_IASQ0 416 /* offsetof(struct pt_regs, iasq[0]) */ ++#define PT_IASQ1 420 /* offsetof(struct pt_regs, iasq[1]) */ ++#define PT_IAOQ0 424 /* offsetof(struct pt_regs, iaoq[0]) */ ++#define PT_IAOQ1 428 /* offsetof(struct pt_regs, iaoq[1]) */ ++#define PT_CR27 432 /* offsetof(struct pt_regs, cr27) */ ++#define PT_ORIG_R28 440 /* offsetof(struct pt_regs, orig_r28) */ ++#define PT_KSP 444 /* offsetof(struct pt_regs, ksp) */ ++#define PT_KPC 448 /* offsetof(struct pt_regs, kpc) */ ++#define PT_SAR 452 /* offsetof(struct pt_regs, sar) */ ++#define PT_IIR 456 /* offsetof(struct pt_regs, iir) */ ++#define PT_ISR 460 /* offsetof(struct pt_regs, isr) */ ++#define PT_IOR 464 /* offsetof(struct pt_regs, ior) */ ++#define PT_SIZE 472 /* sizeof(struct pt_regs) */ ++#define PT_SZ_ALGN 576 /* align(sizeof(struct pt_regs), 64) */ ++ ++#define TI_TASK 0 /* offsetof(struct thread_info, task) */ ++#define TI_EXEC_DOMAIN 4 /* offsetof(struct thread_info, exec_domain) */ ++#define TI_FLAGS 8 /* offsetof(struct thread_info, flags) */ ++#define TI_CPU 16 /* offsetof(struct thread_info, cpu) */ ++#define TI_SEGMENT 12 /* offsetof(struct thread_info, addr_limit) */ ++#define TI_PRE_COUNT 20 /* offsetof(struct thread_info, preempt_count) */ ++#define THREAD_SZ 44 /* sizeof(struct thread_info) */ ++#define THREAD_SZ_ALGN 128 /* align(sizeof(struct thread_info), 64) */ ++ ++#define IRQSTAT_SIRQ_PEND 0 /* offsetof(irq_cpustat_t, __softirq_pending) */ ++#define IRQSTAT_SZ 64 /* sizeof(irq_cpustat_t) */ ++ ++#define ICACHE_BASE 8 /* offsetof(struct pdc_cache_info, ic_base) */ ++#define ICACHE_STRIDE 12 /* offsetof(struct pdc_cache_info, ic_stride) */ ++#define ICACHE_COUNT 16 /* offsetof(struct pdc_cache_info, ic_count) */ ++#define ICACHE_LOOP 20 /* offsetof(struct pdc_cache_info, ic_loop) */ ++#define DCACHE_BASE 32 /* offsetof(struct pdc_cache_info, dc_base) */ ++#define DCACHE_STRIDE 36 /* offsetof(struct pdc_cache_info, dc_stride) */ ++#define DCACHE_COUNT 40 /* offsetof(struct pdc_cache_info, dc_count) */ ++#define DCACHE_LOOP 44 /* offsetof(struct pdc_cache_info, dc_loop) */ ++#define ITLB_SID_BASE 56 /* offsetof(struct pdc_cache_info, it_sp_base) */ ++#define ITLB_SID_STRIDE 60 /* offsetof(struct pdc_cache_info, it_sp_stride) */ ++#define ITLB_SID_COUNT 64 /* offsetof(struct pdc_cache_info, it_sp_count) */ ++#define ITLB_OFF_BASE 68 /* offsetof(struct pdc_cache_info, it_off_base) */ ++#define ITLB_OFF_STRIDE 72 /* offsetof(struct pdc_cache_info, it_off_stride) */ ++#define ITLB_OFF_COUNT 76 /* offsetof(struct pdc_cache_info, it_off_count) */ ++#define ITLB_LOOP 80 /* offsetof(struct pdc_cache_info, it_loop) */ ++#define DTLB_SID_BASE 92 /* offsetof(struct pdc_cache_info, dt_sp_base) */ ++#define DTLB_SID_STRIDE 96 /* offsetof(struct pdc_cache_info, dt_sp_stride) */ ++#define DTLB_SID_COUNT 100 /* offsetof(struct pdc_cache_info, dt_sp_count) */ ++#define DTLB_OFF_BASE 104 /* offsetof(struct pdc_cache_info, dt_off_base) */ ++#define DTLB_OFF_STRIDE 108 /* offsetof(struct pdc_cache_info, dt_off_stride) */ ++#define DTLB_OFF_COUNT 112 /* offsetof(struct pdc_cache_info, dt_off_count) */ ++#define DTLB_LOOP 116 /* offsetof(struct pdc_cache_info, dt_loop) */ ++ ++#define PA_BLOCKSTEP_BIT 1 /* 31-PT_BLOCKSTEP_BIT */ ++#define PA_SINGLESTEP_BIT 0 /* 31-PT_SINGLESTEP_BIT */ ++ ++#define ASM_PMD_SHIFT 21 /* PMD_SHIFT */ ++#define ASM_PGDIR_SHIFT 21 /* PGDIR_SHIFT */ ++#define ASM_BITS_PER_PGD 11 /* BITS_PER_PGD */ ++#define ASM_BITS_PER_PMD 0 /* BITS_PER_PMD */ ++#define ASM_BITS_PER_PTE 9 /* BITS_PER_PTE */ ++#define ASM_PGD_PMD_OFFSET -8192 /* -(PAGE_SIZE << PGD_ORDER) */ ++#define ASM_PMD_ENTRY 128 /* ((PAGE_OFFSET & PMD_MASK) >> PMD_SHIFT) */ ++#define ASM_PGD_ENTRY 128 /* PAGE_OFFSET >> PGDIR_SHIFT */ ++#define ASM_PGD_ENTRY_SIZE 4 /* PGD_ENTRY_SIZE */ ++#define ASM_PMD_ENTRY_SIZE 4 /* PMD_ENTRY_SIZE */ ++#define ASM_PTE_ENTRY_SIZE 8 /* PTE_ENTRY_SIZE */ ++#define ASM_PT_INITIAL 4 /* PT_INITIAL */ ++#define ASM_PAGE_SIZE 4096 /* PAGE_SIZE */ ++ ++ ++#endif diff --git a/patches/gdb/6.7/120-dwarf-stack-overflow.patch b/patches/gdb/6.7/120-dwarf-stack-overflow.patch new file mode 100644 index 0000000..171e64e --- /dev/null +++ b/patches/gdb/6.7/120-dwarf-stack-overflow.patch @@ -0,0 +1,52 @@ +Original patch from gentoo: gentoo/src/patchsets/gdb/6.7/80_all_gdb-6.5-dwarf-stack-overflow.patch +-= BEGIN original header =- +http://bugs.gentoo.org/144833 + +for gdb/ChangeLog: +2006-08-22 Will Drewry + Tavis Ormandy + + * dwarf2read.c (decode_locdesc): Enforce location description stack + boundaries. + * dwarfread.c (locval): Likewise. + +-= END original header =- +diff -durN gdb-6.7.orig/gdb/dwarf2read.c gdb-6.7/gdb/dwarf2read.c +--- gdb-6.7.orig/gdb/dwarf2read.c 2007-09-05 02:51:48.000000000 +0200 ++++ gdb-6.7/gdb/dwarf2read.c 2008-06-17 23:25:38.000000000 +0200 +@@ -9061,8 +9061,7 @@ + callers will only want a very basic result and this can become a + complaint. + +- Note that stack[0] is unused except as a default error return. +- Note that stack overflow is not yet handled. */ ++ Note that stack[0] is unused except as a default error return. */ + + static CORE_ADDR + decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu) +@@ -9079,7 +9078,7 @@ + + i = 0; + stacki = 0; +- stack[stacki] = 0; ++ stack[++stacki] = 0; + + while (i < size) + { +@@ -9261,6 +9260,16 @@ + dwarf_stack_op_name (op)); + return (stack[stacki]); + } ++ /* Enforce maximum stack depth of size-1 to avoid ++stacki writing ++ outside of the allocated space. Also enforce minimum > 0. ++ -- wad@google.com 14 Aug 2006 */ ++ if (stacki >= sizeof (stack) / sizeof (*stack) - 1) ++ internal_error (__FILE__, __LINE__, ++ _("location description stack too deep: %d"), ++ stacki); ++ if (stacki <= 0) ++ internal_error (__FILE__, __LINE__, ++ _("location description stack too shallow")); + } + return (stack[stacki]); + } diff --git a/patches/gdb/6.7/125-hppa-offsets.patch b/patches/gdb/6.7/125-hppa-offsets.patch deleted file mode 100644 index 9de831b..0000000 --- a/patches/gdb/6.7/125-hppa-offsets.patch +++ /dev/null @@ -1,272 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gdb/6.7/45_all_gdb-hppa-offsets.patch --= BEGIN original header =- -sanitized headers dont include asm/offsets.h, so cache a local copy - -http://bugs.gentoo.org/180476 -http://lists.parisc-linux.org/pipermail/parisc-linux/2007-February/031162.html - --= END original header =- -diff -durN gdb-6.7.orig/gdb/hppa-linux-nat.c gdb-6.7/gdb/hppa-linux-nat.c ---- gdb-6.7.orig/gdb/hppa-linux-nat.c 2007-08-23 20:08:33.000000000 +0200 -+++ gdb-6.7/gdb/hppa-linux-nat.c 2008-06-17 23:25:28.000000000 +0200 -@@ -32,7 +32,7 @@ - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,43) - #include - #else --#include -+#include - #endif - - #include "hppa-tdep.h" -diff -durN gdb-6.7.orig/gdb/hppa-offsets.h gdb-6.7/gdb/hppa-offsets.h ---- gdb-6.7.orig/gdb/hppa-offsets.h 1970-01-01 01:00:00.000000000 +0100 -+++ gdb-6.7/gdb/hppa-offsets.h 2008-06-17 23:25:28.000000000 +0200 -@@ -0,0 +1,248 @@ -+#ifndef __ASM_OFFSETS_H__ -+#define __ASM_OFFSETS_H__ -+/* -+ * DO NOT MODIFY. -+ * -+ * This file was generated by arch/parisc/Makefile -+ * -+ */ -+ -+#define TASK_THREAD_INFO 4 /* offsetof(struct task_struct, thread_info) */ -+#define TASK_STATE 0 /* offsetof(struct task_struct, state) */ -+#define TASK_FLAGS 12 /* offsetof(struct task_struct, flags) */ -+#define TASK_SIGPENDING 1188 /* offsetof(struct task_struct, pending) */ -+#define TASK_PTRACE 16 /* offsetof(struct task_struct, ptrace) */ -+#define TASK_MM 108 /* offsetof(struct task_struct, mm) */ -+#define TASK_PERSONALITY 132 /* offsetof(struct task_struct, personality) */ -+#define TASK_PID 140 /* offsetof(struct task_struct, pid) */ -+ -+#define TASK_REGS 664 /* offsetof(struct task_struct, thread.regs) */ -+#define TASK_PT_PSW 664 /* offsetof(struct task_struct, thread.regs.gr[ 0]) */ -+#define TASK_PT_GR1 668 /* offsetof(struct task_struct, thread.regs.gr[ 1]) */ -+#define TASK_PT_GR2 672 /* offsetof(struct task_struct, thread.regs.gr[ 2]) */ -+#define TASK_PT_GR3 676 /* offsetof(struct task_struct, thread.regs.gr[ 3]) */ -+#define TASK_PT_GR4 680 /* offsetof(struct task_struct, thread.regs.gr[ 4]) */ -+#define TASK_PT_GR5 684 /* offsetof(struct task_struct, thread.regs.gr[ 5]) */ -+#define TASK_PT_GR6 688 /* offsetof(struct task_struct, thread.regs.gr[ 6]) */ -+#define TASK_PT_GR7 692 /* offsetof(struct task_struct, thread.regs.gr[ 7]) */ -+#define TASK_PT_GR8 696 /* offsetof(struct task_struct, thread.regs.gr[ 8]) */ -+#define TASK_PT_GR9 700 /* offsetof(struct task_struct, thread.regs.gr[ 9]) */ -+#define TASK_PT_GR10 704 /* offsetof(struct task_struct, thread.regs.gr[10]) */ -+#define TASK_PT_GR11 708 /* offsetof(struct task_struct, thread.regs.gr[11]) */ -+#define TASK_PT_GR12 712 /* offsetof(struct task_struct, thread.regs.gr[12]) */ -+#define TASK_PT_GR13 716 /* offsetof(struct task_struct, thread.regs.gr[13]) */ -+#define TASK_PT_GR14 720 /* offsetof(struct task_struct, thread.regs.gr[14]) */ -+#define TASK_PT_GR15 724 /* offsetof(struct task_struct, thread.regs.gr[15]) */ -+#define TASK_PT_GR16 728 /* offsetof(struct task_struct, thread.regs.gr[16]) */ -+#define TASK_PT_GR17 732 /* offsetof(struct task_struct, thread.regs.gr[17]) */ -+#define TASK_PT_GR18 736 /* offsetof(struct task_struct, thread.regs.gr[18]) */ -+#define TASK_PT_GR19 740 /* offsetof(struct task_struct, thread.regs.gr[19]) */ -+#define TASK_PT_GR20 744 /* offsetof(struct task_struct, thread.regs.gr[20]) */ -+#define TASK_PT_GR21 748 /* offsetof(struct task_struct, thread.regs.gr[21]) */ -+#define TASK_PT_GR22 752 /* offsetof(struct task_struct, thread.regs.gr[22]) */ -+#define TASK_PT_GR23 756 /* offsetof(struct task_struct, thread.regs.gr[23]) */ -+#define TASK_PT_GR24 760 /* offsetof(struct task_struct, thread.regs.gr[24]) */ -+#define TASK_PT_GR25 764 /* offsetof(struct task_struct, thread.regs.gr[25]) */ -+#define TASK_PT_GR26 768 /* offsetof(struct task_struct, thread.regs.gr[26]) */ -+#define TASK_PT_GR27 772 /* offsetof(struct task_struct, thread.regs.gr[27]) */ -+#define TASK_PT_GR28 776 /* offsetof(struct task_struct, thread.regs.gr[28]) */ -+#define TASK_PT_GR29 780 /* offsetof(struct task_struct, thread.regs.gr[29]) */ -+#define TASK_PT_GR30 784 /* offsetof(struct task_struct, thread.regs.gr[30]) */ -+#define TASK_PT_GR31 788 /* offsetof(struct task_struct, thread.regs.gr[31]) */ -+#define TASK_PT_FR0 792 /* offsetof(struct task_struct, thread.regs.fr[ 0]) */ -+#define TASK_PT_FR1 800 /* offsetof(struct task_struct, thread.regs.fr[ 1]) */ -+#define TASK_PT_FR2 808 /* offsetof(struct task_struct, thread.regs.fr[ 2]) */ -+#define TASK_PT_FR3 816 /* offsetof(struct task_struct, thread.regs.fr[ 3]) */ -+#define TASK_PT_FR4 824 /* offsetof(struct task_struct, thread.regs.fr[ 4]) */ -+#define TASK_PT_FR5 832 /* offsetof(struct task_struct, thread.regs.fr[ 5]) */ -+#define TASK_PT_FR6 840 /* offsetof(struct task_struct, thread.regs.fr[ 6]) */ -+#define TASK_PT_FR7 848 /* offsetof(struct task_struct, thread.regs.fr[ 7]) */ -+#define TASK_PT_FR8 856 /* offsetof(struct task_struct, thread.regs.fr[ 8]) */ -+#define TASK_PT_FR9 864 /* offsetof(struct task_struct, thread.regs.fr[ 9]) */ -+#define TASK_PT_FR10 872 /* offsetof(struct task_struct, thread.regs.fr[10]) */ -+#define TASK_PT_FR11 880 /* offsetof(struct task_struct, thread.regs.fr[11]) */ -+#define TASK_PT_FR12 888 /* offsetof(struct task_struct, thread.regs.fr[12]) */ -+#define TASK_PT_FR13 896 /* offsetof(struct task_struct, thread.regs.fr[13]) */ -+#define TASK_PT_FR14 904 /* offsetof(struct task_struct, thread.regs.fr[14]) */ -+#define TASK_PT_FR15 912 /* offsetof(struct task_struct, thread.regs.fr[15]) */ -+#define TASK_PT_FR16 920 /* offsetof(struct task_struct, thread.regs.fr[16]) */ -+#define TASK_PT_FR17 928 /* offsetof(struct task_struct, thread.regs.fr[17]) */ -+#define TASK_PT_FR18 936 /* offsetof(struct task_struct, thread.regs.fr[18]) */ -+#define TASK_PT_FR19 944 /* offsetof(struct task_struct, thread.regs.fr[19]) */ -+#define TASK_PT_FR20 952 /* offsetof(struct task_struct, thread.regs.fr[20]) */ -+#define TASK_PT_FR21 960 /* offsetof(struct task_struct, thread.regs.fr[21]) */ -+#define TASK_PT_FR22 968 /* offsetof(struct task_struct, thread.regs.fr[22]) */ -+#define TASK_PT_FR23 976 /* offsetof(struct task_struct, thread.regs.fr[23]) */ -+#define TASK_PT_FR24 984 /* offsetof(struct task_struct, thread.regs.fr[24]) */ -+#define TASK_PT_FR25 992 /* offsetof(struct task_struct, thread.regs.fr[25]) */ -+#define TASK_PT_FR26 1000 /* offsetof(struct task_struct, thread.regs.fr[26]) */ -+#define TASK_PT_FR27 1008 /* offsetof(struct task_struct, thread.regs.fr[27]) */ -+#define TASK_PT_FR28 1016 /* offsetof(struct task_struct, thread.regs.fr[28]) */ -+#define TASK_PT_FR29 1024 /* offsetof(struct task_struct, thread.regs.fr[29]) */ -+#define TASK_PT_FR30 1032 /* offsetof(struct task_struct, thread.regs.fr[30]) */ -+#define TASK_PT_FR31 1040 /* offsetof(struct task_struct, thread.regs.fr[31]) */ -+#define TASK_PT_SR0 1048 /* offsetof(struct task_struct, thread.regs.sr[ 0]) */ -+#define TASK_PT_SR1 1052 /* offsetof(struct task_struct, thread.regs.sr[ 1]) */ -+#define TASK_PT_SR2 1056 /* offsetof(struct task_struct, thread.regs.sr[ 2]) */ -+#define TASK_PT_SR3 1060 /* offsetof(struct task_struct, thread.regs.sr[ 3]) */ -+#define TASK_PT_SR4 1064 /* offsetof(struct task_struct, thread.regs.sr[ 4]) */ -+#define TASK_PT_SR5 1068 /* offsetof(struct task_struct, thread.regs.sr[ 5]) */ -+#define TASK_PT_SR6 1072 /* offsetof(struct task_struct, thread.regs.sr[ 6]) */ -+#define TASK_PT_SR7 1076 /* offsetof(struct task_struct, thread.regs.sr[ 7]) */ -+#define TASK_PT_IASQ0 1080 /* offsetof(struct task_struct, thread.regs.iasq[0]) */ -+#define TASK_PT_IASQ1 1084 /* offsetof(struct task_struct, thread.regs.iasq[1]) */ -+#define TASK_PT_IAOQ0 1088 /* offsetof(struct task_struct, thread.regs.iaoq[0]) */ -+#define TASK_PT_IAOQ1 1092 /* offsetof(struct task_struct, thread.regs.iaoq[1]) */ -+#define TASK_PT_CR27 1096 /* offsetof(struct task_struct, thread.regs.cr27) */ -+#define TASK_PT_ORIG_R28 1104 /* offsetof(struct task_struct, thread.regs.orig_r28) */ -+#define TASK_PT_KSP 1108 /* offsetof(struct task_struct, thread.regs.ksp) */ -+#define TASK_PT_KPC 1112 /* offsetof(struct task_struct, thread.regs.kpc) */ -+#define TASK_PT_SAR 1116 /* offsetof(struct task_struct, thread.regs.sar) */ -+#define TASK_PT_IIR 1120 /* offsetof(struct task_struct, thread.regs.iir) */ -+#define TASK_PT_ISR 1124 /* offsetof(struct task_struct, thread.regs.isr) */ -+#define TASK_PT_IOR 1128 /* offsetof(struct task_struct, thread.regs.ior) */ -+ -+#define TASK_SZ 1272 /* sizeof(struct task_struct) */ -+#define TASK_SZ_ALGN 1344 /* align(sizeof(struct task_struct), 64) */ -+ -+#define PT_PSW 0 /* offsetof(struct pt_regs, gr[ 0]) */ -+#define PT_GR1 4 /* offsetof(struct pt_regs, gr[ 1]) */ -+#define PT_GR2 8 /* offsetof(struct pt_regs, gr[ 2]) */ -+#define PT_GR3 12 /* offsetof(struct pt_regs, gr[ 3]) */ -+#define PT_GR4 16 /* offsetof(struct pt_regs, gr[ 4]) */ -+#define PT_GR5 20 /* offsetof(struct pt_regs, gr[ 5]) */ -+#define PT_GR6 24 /* offsetof(struct pt_regs, gr[ 6]) */ -+#define PT_GR7 28 /* offsetof(struct pt_regs, gr[ 7]) */ -+#define PT_GR8 32 /* offsetof(struct pt_regs, gr[ 8]) */ -+#define PT_GR9 36 /* offsetof(struct pt_regs, gr[ 9]) */ -+#define PT_GR10 40 /* offsetof(struct pt_regs, gr[10]) */ -+#define PT_GR11 44 /* offsetof(struct pt_regs, gr[11]) */ -+#define PT_GR12 48 /* offsetof(struct pt_regs, gr[12]) */ -+#define PT_GR13 52 /* offsetof(struct pt_regs, gr[13]) */ -+#define PT_GR14 56 /* offsetof(struct pt_regs, gr[14]) */ -+#define PT_GR15 60 /* offsetof(struct pt_regs, gr[15]) */ -+#define PT_GR16 64 /* offsetof(struct pt_regs, gr[16]) */ -+#define PT_GR17 68 /* offsetof(struct pt_regs, gr[17]) */ -+#define PT_GR18 72 /* offsetof(struct pt_regs, gr[18]) */ -+#define PT_GR19 76 /* offsetof(struct pt_regs, gr[19]) */ -+#define PT_GR20 80 /* offsetof(struct pt_regs, gr[20]) */ -+#define PT_GR21 84 /* offsetof(struct pt_regs, gr[21]) */ -+#define PT_GR22 88 /* offsetof(struct pt_regs, gr[22]) */ -+#define PT_GR23 92 /* offsetof(struct pt_regs, gr[23]) */ -+#define PT_GR24 96 /* offsetof(struct pt_regs, gr[24]) */ -+#define PT_GR25 100 /* offsetof(struct pt_regs, gr[25]) */ -+#define PT_GR26 104 /* offsetof(struct pt_regs, gr[26]) */ -+#define PT_GR27 108 /* offsetof(struct pt_regs, gr[27]) */ -+#define PT_GR28 112 /* offsetof(struct pt_regs, gr[28]) */ -+#define PT_GR29 116 /* offsetof(struct pt_regs, gr[29]) */ -+#define PT_GR30 120 /* offsetof(struct pt_regs, gr[30]) */ -+#define PT_GR31 124 /* offsetof(struct pt_regs, gr[31]) */ -+#define PT_FR0 128 /* offsetof(struct pt_regs, fr[ 0]) */ -+#define PT_FR1 136 /* offsetof(struct pt_regs, fr[ 1]) */ -+#define PT_FR2 144 /* offsetof(struct pt_regs, fr[ 2]) */ -+#define PT_FR3 152 /* offsetof(struct pt_regs, fr[ 3]) */ -+#define PT_FR4 160 /* offsetof(struct pt_regs, fr[ 4]) */ -+#define PT_FR5 168 /* offsetof(struct pt_regs, fr[ 5]) */ -+#define PT_FR6 176 /* offsetof(struct pt_regs, fr[ 6]) */ -+#define PT_FR7 184 /* offsetof(struct pt_regs, fr[ 7]) */ -+#define PT_FR8 192 /* offsetof(struct pt_regs, fr[ 8]) */ -+#define PT_FR9 200 /* offsetof(struct pt_regs, fr[ 9]) */ -+#define PT_FR10 208 /* offsetof(struct pt_regs, fr[10]) */ -+#define PT_FR11 216 /* offsetof(struct pt_regs, fr[11]) */ -+#define PT_FR12 224 /* offsetof(struct pt_regs, fr[12]) */ -+#define PT_FR13 232 /* offsetof(struct pt_regs, fr[13]) */ -+#define PT_FR14 240 /* offsetof(struct pt_regs, fr[14]) */ -+#define PT_FR15 248 /* offsetof(struct pt_regs, fr[15]) */ -+#define PT_FR16 256 /* offsetof(struct pt_regs, fr[16]) */ -+#define PT_FR17 264 /* offsetof(struct pt_regs, fr[17]) */ -+#define PT_FR18 272 /* offsetof(struct pt_regs, fr[18]) */ -+#define PT_FR19 280 /* offsetof(struct pt_regs, fr[19]) */ -+#define PT_FR20 288 /* offsetof(struct pt_regs, fr[20]) */ -+#define PT_FR21 296 /* offsetof(struct pt_regs, fr[21]) */ -+#define PT_FR22 304 /* offsetof(struct pt_regs, fr[22]) */ -+#define PT_FR23 312 /* offsetof(struct pt_regs, fr[23]) */ -+#define PT_FR24 320 /* offsetof(struct pt_regs, fr[24]) */ -+#define PT_FR25 328 /* offsetof(struct pt_regs, fr[25]) */ -+#define PT_FR26 336 /* offsetof(struct pt_regs, fr[26]) */ -+#define PT_FR27 344 /* offsetof(struct pt_regs, fr[27]) */ -+#define PT_FR28 352 /* offsetof(struct pt_regs, fr[28]) */ -+#define PT_FR29 360 /* offsetof(struct pt_regs, fr[29]) */ -+#define PT_FR30 368 /* offsetof(struct pt_regs, fr[30]) */ -+#define PT_FR31 376 /* offsetof(struct pt_regs, fr[31]) */ -+#define PT_SR0 384 /* offsetof(struct pt_regs, sr[ 0]) */ -+#define PT_SR1 388 /* offsetof(struct pt_regs, sr[ 1]) */ -+#define PT_SR2 392 /* offsetof(struct pt_regs, sr[ 2]) */ -+#define PT_SR3 396 /* offsetof(struct pt_regs, sr[ 3]) */ -+#define PT_SR4 400 /* offsetof(struct pt_regs, sr[ 4]) */ -+#define PT_SR5 404 /* offsetof(struct pt_regs, sr[ 5]) */ -+#define PT_SR6 408 /* offsetof(struct pt_regs, sr[ 6]) */ -+#define PT_SR7 412 /* offsetof(struct pt_regs, sr[ 7]) */ -+#define PT_IASQ0 416 /* offsetof(struct pt_regs, iasq[0]) */ -+#define PT_IASQ1 420 /* offsetof(struct pt_regs, iasq[1]) */ -+#define PT_IAOQ0 424 /* offsetof(struct pt_regs, iaoq[0]) */ -+#define PT_IAOQ1 428 /* offsetof(struct pt_regs, iaoq[1]) */ -+#define PT_CR27 432 /* offsetof(struct pt_regs, cr27) */ -+#define PT_ORIG_R28 440 /* offsetof(struct pt_regs, orig_r28) */ -+#define PT_KSP 444 /* offsetof(struct pt_regs, ksp) */ -+#define PT_KPC 448 /* offsetof(struct pt_regs, kpc) */ -+#define PT_SAR 452 /* offsetof(struct pt_regs, sar) */ -+#define PT_IIR 456 /* offsetof(struct pt_regs, iir) */ -+#define PT_ISR 460 /* offsetof(struct pt_regs, isr) */ -+#define PT_IOR 464 /* offsetof(struct pt_regs, ior) */ -+#define PT_SIZE 472 /* sizeof(struct pt_regs) */ -+#define PT_SZ_ALGN 576 /* align(sizeof(struct pt_regs), 64) */ -+ -+#define TI_TASK 0 /* offsetof(struct thread_info, task) */ -+#define TI_EXEC_DOMAIN 4 /* offsetof(struct thread_info, exec_domain) */ -+#define TI_FLAGS 8 /* offsetof(struct thread_info, flags) */ -+#define TI_CPU 16 /* offsetof(struct thread_info, cpu) */ -+#define TI_SEGMENT 12 /* offsetof(struct thread_info, addr_limit) */ -+#define TI_PRE_COUNT 20 /* offsetof(struct thread_info, preempt_count) */ -+#define THREAD_SZ 44 /* sizeof(struct thread_info) */ -+#define THREAD_SZ_ALGN 128 /* align(sizeof(struct thread_info), 64) */ -+ -+#define IRQSTAT_SIRQ_PEND 0 /* offsetof(irq_cpustat_t, __softirq_pending) */ -+#define IRQSTAT_SZ 64 /* sizeof(irq_cpustat_t) */ -+ -+#define ICACHE_BASE 8 /* offsetof(struct pdc_cache_info, ic_base) */ -+#define ICACHE_STRIDE 12 /* offsetof(struct pdc_cache_info, ic_stride) */ -+#define ICACHE_COUNT 16 /* offsetof(struct pdc_cache_info, ic_count) */ -+#define ICACHE_LOOP 20 /* offsetof(struct pdc_cache_info, ic_loop) */ -+#define DCACHE_BASE 32 /* offsetof(struct pdc_cache_info, dc_base) */ -+#define DCACHE_STRIDE 36 /* offsetof(struct pdc_cache_info, dc_stride) */ -+#define DCACHE_COUNT 40 /* offsetof(struct pdc_cache_info, dc_count) */ -+#define DCACHE_LOOP 44 /* offsetof(struct pdc_cache_info, dc_loop) */ -+#define ITLB_SID_BASE 56 /* offsetof(struct pdc_cache_info, it_sp_base) */ -+#define ITLB_SID_STRIDE 60 /* offsetof(struct pdc_cache_info, it_sp_stride) */ -+#define ITLB_SID_COUNT 64 /* offsetof(struct pdc_cache_info, it_sp_count) */ -+#define ITLB_OFF_BASE 68 /* offsetof(struct pdc_cache_info, it_off_base) */ -+#define ITLB_OFF_STRIDE 72 /* offsetof(struct pdc_cache_info, it_off_stride) */ -+#define ITLB_OFF_COUNT 76 /* offsetof(struct pdc_cache_info, it_off_count) */ -+#define ITLB_LOOP 80 /* offsetof(struct pdc_cache_info, it_loop) */ -+#define DTLB_SID_BASE 92 /* offsetof(struct pdc_cache_info, dt_sp_base) */ -+#define DTLB_SID_STRIDE 96 /* offsetof(struct pdc_cache_info, dt_sp_stride) */ -+#define DTLB_SID_COUNT 100 /* offsetof(struct pdc_cache_info, dt_sp_count) */ -+#define DTLB_OFF_BASE 104 /* offsetof(struct pdc_cache_info, dt_off_base) */ -+#define DTLB_OFF_STRIDE 108 /* offsetof(struct pdc_cache_info, dt_off_stride) */ -+#define DTLB_OFF_COUNT 112 /* offsetof(struct pdc_cache_info, dt_off_count) */ -+#define DTLB_LOOP 116 /* offsetof(struct pdc_cache_info, dt_loop) */ -+ -+#define PA_BLOCKSTEP_BIT 1 /* 31-PT_BLOCKSTEP_BIT */ -+#define PA_SINGLESTEP_BIT 0 /* 31-PT_SINGLESTEP_BIT */ -+ -+#define ASM_PMD_SHIFT 21 /* PMD_SHIFT */ -+#define ASM_PGDIR_SHIFT 21 /* PGDIR_SHIFT */ -+#define ASM_BITS_PER_PGD 11 /* BITS_PER_PGD */ -+#define ASM_BITS_PER_PMD 0 /* BITS_PER_PMD */ -+#define ASM_BITS_PER_PTE 9 /* BITS_PER_PTE */ -+#define ASM_PGD_PMD_OFFSET -8192 /* -(PAGE_SIZE << PGD_ORDER) */ -+#define ASM_PMD_ENTRY 128 /* ((PAGE_OFFSET & PMD_MASK) >> PMD_SHIFT) */ -+#define ASM_PGD_ENTRY 128 /* PAGE_OFFSET >> PGDIR_SHIFT */ -+#define ASM_PGD_ENTRY_SIZE 4 /* PGD_ENTRY_SIZE */ -+#define ASM_PMD_ENTRY_SIZE 4 /* PMD_ENTRY_SIZE */ -+#define ASM_PTE_ENTRY_SIZE 8 /* PTE_ENTRY_SIZE */ -+#define ASM_PT_INITIAL 4 /* PT_INITIAL */ -+#define ASM_PAGE_SIZE 4096 /* PAGE_SIZE */ -+ -+ -+#endif diff --git a/patches/gdb/6.7/150-dwarf-stack-overflow.patch b/patches/gdb/6.7/150-dwarf-stack-overflow.patch deleted file mode 100644 index 171e64e..0000000 --- a/patches/gdb/6.7/150-dwarf-stack-overflow.patch +++ /dev/null @@ -1,52 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gdb/6.7/80_all_gdb-6.5-dwarf-stack-overflow.patch --= BEGIN original header =- -http://bugs.gentoo.org/144833 - -for gdb/ChangeLog: -2006-08-22 Will Drewry - Tavis Ormandy - - * dwarf2read.c (decode_locdesc): Enforce location description stack - boundaries. - * dwarfread.c (locval): Likewise. - --= END original header =- -diff -durN gdb-6.7.orig/gdb/dwarf2read.c gdb-6.7/gdb/dwarf2read.c ---- gdb-6.7.orig/gdb/dwarf2read.c 2007-09-05 02:51:48.000000000 +0200 -+++ gdb-6.7/gdb/dwarf2read.c 2008-06-17 23:25:38.000000000 +0200 -@@ -9061,8 +9061,7 @@ - callers will only want a very basic result and this can become a - complaint. - -- Note that stack[0] is unused except as a default error return. -- Note that stack overflow is not yet handled. */ -+ Note that stack[0] is unused except as a default error return. */ - - static CORE_ADDR - decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu) -@@ -9079,7 +9078,7 @@ - - i = 0; - stacki = 0; -- stack[stacki] = 0; -+ stack[++stacki] = 0; - - while (i < size) - { -@@ -9261,6 +9260,16 @@ - dwarf_stack_op_name (op)); - return (stack[stacki]); - } -+ /* Enforce maximum stack depth of size-1 to avoid ++stacki writing -+ outside of the allocated space. Also enforce minimum > 0. -+ -- wad@google.com 14 Aug 2006 */ -+ if (stacki >= sizeof (stack) / sizeof (*stack) - 1) -+ internal_error (__FILE__, __LINE__, -+ _("location description stack too deep: %d"), -+ stacki); -+ if (stacki <= 0) -+ internal_error (__FILE__, __LINE__, -+ _("location description stack too shallow")); - } - return (stack[stacki]); - } diff --git a/patches/gdb/6.8/110-security-errata-20050610.patch b/patches/gdb/6.8/110-security-errata-20050610.patch new file mode 100644 index 0000000..27e8174 --- /dev/null +++ b/patches/gdb/6.8/110-security-errata-20050610.patch @@ -0,0 +1,205 @@ +Original patch from gentoo: gentoo/src/patchsets/gdb/6.8/35_all_gdb-6.3-security-errata-20050610.patch +-= BEGIN original header =- +2005-06-09 Jeff Johnston + + * gdb.base/gdbinit.exp: New testcase. + * gdb.base/gdbinit.sample: Sample .gdbinit for gdbinit.exp. + +2005-06-08 Daniel Jacobowitz + Jeff Johnston + + * Makefile.in (cli-cmds.o): Update. + * configure.in: Add check for getuid. + * configure: Regenerated. + * config.in: Ditto. + * main.c (captured_main): Pass -1 to source_command when loading + gdbinit files. + * cli/cli-cmds.c: Include "gdb_stat.h" and . + (source_command): Update documentation. Check permissions if + FROM_TTY is -1. + +-= END original header =- +diff -durN gdb-6.8.orig/gdb/Makefile.in gdb-6.8/gdb/Makefile.in +--- gdb-6.8.orig/gdb/Makefile.in 2008-03-17 13:15:08.000000000 +0100 ++++ gdb-6.8/gdb/Makefile.in 2008-06-17 16:07:33.000000000 +0200 +@@ -3004,7 +3004,7 @@ + $(expression_h) $(frame_h) $(value_h) $(language_h) $(filenames_h) \ + $(objfiles_h) $(source_h) $(disasm_h) $(ui_out_h) $(top_h) \ + $(cli_decode_h) $(cli_script_h) $(cli_setshow_h) $(cli_cmds_h) \ +- $(tui_h) ++ $(tui_h) $(gdb_stat_h) + $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-cmds.c + cli-decode.o: $(srcdir)/cli/cli-decode.c $(defs_h) $(symtab_h) \ + $(gdb_regex_h) $(gdb_string_h) $(completer_h) $(ui_out_h) \ +diff -durN gdb-6.8.orig/gdb/cli/cli-cmds.c gdb-6.8/gdb/cli/cli-cmds.c +--- gdb-6.8.orig/gdb/cli/cli-cmds.c 2008-01-01 23:53:14.000000000 +0100 ++++ gdb-6.8/gdb/cli/cli-cmds.c 2008-06-17 16:07:33.000000000 +0200 +@@ -36,6 +36,7 @@ + #include "objfiles.h" + #include "source.h" + #include "disasm.h" ++#include "gdb_stat.h" + + #include "ui-out.h" + +@@ -459,12 +460,31 @@ + + if (fd == -1) + { +- if (from_tty) ++ if (from_tty > 0) + perror_with_name (file); + else + return; + } + ++#ifdef HAVE_GETUID ++ if (from_tty == -1) ++ { ++ struct stat statbuf; ++ if (fstat (fd, &statbuf) < 0) ++ { ++ perror_with_name (file); ++ close (fd); ++ return; ++ } ++ if (statbuf.st_uid != getuid () || (statbuf.st_mode & S_IWOTH)) ++ { ++ warning (_("not using untrusted file \"%s\""), file); ++ close (fd); ++ return; ++ } ++ } ++#endif ++ + stream = fdopen (fd, FOPEN_RT); + script_from_file (stream, file); + +diff -durN gdb-6.8.orig/gdb/main.c gdb-6.8/gdb/main.c +--- gdb-6.8.orig/gdb/main.c 2008-01-05 17:49:53.000000000 +0100 ++++ gdb-6.8/gdb/main.c 2008-06-17 16:07:33.000000000 +0200 +@@ -690,7 +690,7 @@ + + if (!inhibit_gdbinit) + { +- catch_command_errors (source_script, homeinit, 0, RETURN_MASK_ALL); ++ catch_command_errors (source_script, homeinit, -1, RETURN_MASK_ALL); + } + + /* Do stats; no need to do them elsewhere since we'll only +@@ -778,7 +778,7 @@ + || memcmp ((char *) &homebuf, (char *) &cwdbuf, sizeof (struct stat))) + if (!inhibit_gdbinit) + { +- catch_command_errors (source_script, gdbinit, 0, RETURN_MASK_ALL); ++ catch_command_errors (source_script, gdbinit, -1, RETURN_MASK_ALL); + } + + for (i = 0; i < ncmd; i++) +diff -durN gdb-6.8.orig/gdb/testsuite/gdb.base/gdbinit.exp gdb-6.8/gdb/testsuite/gdb.base/gdbinit.exp +--- gdb-6.8.orig/gdb/testsuite/gdb.base/gdbinit.exp 1970-01-01 01:00:00.000000000 +0100 ++++ gdb-6.8/gdb/testsuite/gdb.base/gdbinit.exp 2008-06-17 16:07:33.000000000 +0200 +@@ -0,0 +1,98 @@ ++# Copyright 2005 ++# Free Software Foundation, Inc. ++ ++# This program 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 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++# Please email any bugs, comments, and/or additions to this file to: ++# bug-gdb@prep.ai.mit.edu ++ ++# This file was written by Jeff Johnston . ++ ++if $tracelevel then { ++ strace $tracelevel ++} ++ ++set prms_id 0 ++set bug_id 0 ++ ++# are we on a target board ++if [is_remote target] { ++ return ++} ++ ++ ++global verbose ++global GDB ++global GDBFLAGS ++global gdb_prompt ++global timeout ++global gdb_spawn_id; ++ ++gdb_stop_suppressing_tests; ++ ++verbose "Spawning $GDB -nw" ++ ++if [info exists gdb_spawn_id] { ++ return 0; ++} ++ ++if ![is_remote host] { ++ if { [which $GDB] == 0 } then { ++ perror "$GDB does not exist." ++ exit 1 ++ } ++} ++ ++set env(HOME) [pwd] ++remote_exec build "rm .gdbinit" ++remote_exec build "cp ${srcdir}/${subdir}/gdbinit.sample .gdbinit" ++remote_exec build "chmod 646 .gdbinit" ++ ++set res [remote_spawn host "$GDB -nw [host_info gdb_opts]"]; ++if { $res < 0 || $res == "" } { ++ perror "Spawning $GDB failed." ++ return 1; ++} ++gdb_expect 360 { ++ -re "warning: not using untrusted file.*\.gdbinit.*\[\r\n\]$gdb_prompt $" { ++ pass "untrusted .gdbinit caught." ++ } ++ -re "$gdb_prompt $" { ++ fail "untrusted .gdbinit caught." ++ } ++ timeout { ++ fail "(timeout) untrusted .gdbinit caught." ++ } ++} ++ ++remote_exec build "chmod 644 .gdbinit" ++set res [remote_spawn host "$GDB -nw [host_info gdb_opts]"]; ++if { $res < 0 || $res == "" } { ++ perror "Spawning $GDB failed." ++ return 1; ++} ++gdb_expect 360 { ++ -re "warning: not using untrusted file.*\.gdbinit.*\[\r\n\]$gdb_prompt $" { ++ fail "trusted .gdbinit allowed." ++ } ++ -re "in gdbinit.*$gdb_prompt $" { ++ pass "trusted .gdbinit allowed." ++ } ++ timeout { ++ fail "(timeout) trusted .gdbinit allowed." ++ } ++} ++ ++remote_exec build "rm .gdbinit" +diff -durN gdb-6.8.orig/gdb/testsuite/gdb.base/gdbinit.sample gdb-6.8/gdb/testsuite/gdb.base/gdbinit.sample +--- gdb-6.8.orig/gdb/testsuite/gdb.base/gdbinit.sample 1970-01-01 01:00:00.000000000 +0100 ++++ gdb-6.8/gdb/testsuite/gdb.base/gdbinit.sample 2008-06-17 16:07:33.000000000 +0200 +@@ -0,0 +1 @@ ++echo "\nin gdbinit" diff --git a/patches/gdb/6.8/120-tdep-opcode-include-workaround.patch b/patches/gdb/6.8/120-tdep-opcode-include-workaround.patch new file mode 100644 index 0000000..61fdef4 --- /dev/null +++ b/patches/gdb/6.8/120-tdep-opcode-include-workaround.patch @@ -0,0 +1,33 @@ +Original patch from gentoo: gentoo/src/patchsets/gdb/6.8/20_all_gdb-tdep-opcode-include-workaround.patch +-= BEGIN original header =- +workaround build failure + +http://bugs.gentoo.org/216368 + +-= END original header =- +diff -durN gdb-6.8.orig/gdb/frv-tdep.c gdb-6.8/gdb/frv-tdep.c +--- gdb-6.8.orig/gdb/frv-tdep.c 2008-01-11 14:19:59.000000000 +0100 ++++ gdb-6.8/gdb/frv-tdep.c 2008-06-17 16:07:34.000000000 +0200 +@@ -32,7 +32,7 @@ + #include "gdb_assert.h" + #include "sim-regno.h" + #include "gdb/sim-frv.h" +-#include "opcodes/frv-desc.h" /* for the H_SPR_... enums */ ++#include "../opcodes/frv-desc.h" /* for the H_SPR_... enums */ + #include "symtab.h" + #include "elf-bfd.h" + #include "elf/frv.h" +diff -durN gdb-6.8.orig/gdb/mep-tdep.c gdb-6.8/gdb/mep-tdep.c +--- gdb-6.8.orig/gdb/mep-tdep.c 2008-01-11 14:20:02.000000000 +0100 ++++ gdb-6.8/gdb/mep-tdep.c 2008-06-17 16:07:34.000000000 +0200 +@@ -53,8 +53,8 @@ + + /* Get the user's customized MeP coprocessor register names from + libopcodes. */ +-#include "opcodes/mep-desc.h" +-#include "opcodes/mep-opc.h" ++#include "../opcodes/mep-desc.h" ++#include "../opcodes/mep-opc.h" + + + /* The gdbarch_tdep structure. */ diff --git a/patches/gdb/6.8/150-security-errata-20050610.patch b/patches/gdb/6.8/150-security-errata-20050610.patch deleted file mode 100644 index 27e8174..0000000 --- a/patches/gdb/6.8/150-security-errata-20050610.patch +++ /dev/null @@ -1,205 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gdb/6.8/35_all_gdb-6.3-security-errata-20050610.patch --= BEGIN original header =- -2005-06-09 Jeff Johnston - - * gdb.base/gdbinit.exp: New testcase. - * gdb.base/gdbinit.sample: Sample .gdbinit for gdbinit.exp. - -2005-06-08 Daniel Jacobowitz - Jeff Johnston - - * Makefile.in (cli-cmds.o): Update. - * configure.in: Add check for getuid. - * configure: Regenerated. - * config.in: Ditto. - * main.c (captured_main): Pass -1 to source_command when loading - gdbinit files. - * cli/cli-cmds.c: Include "gdb_stat.h" and . - (source_command): Update documentation. Check permissions if - FROM_TTY is -1. - --= END original header =- -diff -durN gdb-6.8.orig/gdb/Makefile.in gdb-6.8/gdb/Makefile.in ---- gdb-6.8.orig/gdb/Makefile.in 2008-03-17 13:15:08.000000000 +0100 -+++ gdb-6.8/gdb/Makefile.in 2008-06-17 16:07:33.000000000 +0200 -@@ -3004,7 +3004,7 @@ - $(expression_h) $(frame_h) $(value_h) $(language_h) $(filenames_h) \ - $(objfiles_h) $(source_h) $(disasm_h) $(ui_out_h) $(top_h) \ - $(cli_decode_h) $(cli_script_h) $(cli_setshow_h) $(cli_cmds_h) \ -- $(tui_h) -+ $(tui_h) $(gdb_stat_h) - $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-cmds.c - cli-decode.o: $(srcdir)/cli/cli-decode.c $(defs_h) $(symtab_h) \ - $(gdb_regex_h) $(gdb_string_h) $(completer_h) $(ui_out_h) \ -diff -durN gdb-6.8.orig/gdb/cli/cli-cmds.c gdb-6.8/gdb/cli/cli-cmds.c ---- gdb-6.8.orig/gdb/cli/cli-cmds.c 2008-01-01 23:53:14.000000000 +0100 -+++ gdb-6.8/gdb/cli/cli-cmds.c 2008-06-17 16:07:33.000000000 +0200 -@@ -36,6 +36,7 @@ - #include "objfiles.h" - #include "source.h" - #include "disasm.h" -+#include "gdb_stat.h" - - #include "ui-out.h" - -@@ -459,12 +460,31 @@ - - if (fd == -1) - { -- if (from_tty) -+ if (from_tty > 0) - perror_with_name (file); - else - return; - } - -+#ifdef HAVE_GETUID -+ if (from_tty == -1) -+ { -+ struct stat statbuf; -+ if (fstat (fd, &statbuf) < 0) -+ { -+ perror_with_name (file); -+ close (fd); -+ return; -+ } -+ if (statbuf.st_uid != getuid () || (statbuf.st_mode & S_IWOTH)) -+ { -+ warning (_("not using untrusted file \"%s\""), file); -+ close (fd); -+ return; -+ } -+ } -+#endif -+ - stream = fdopen (fd, FOPEN_RT); - script_from_file (stream, file); - -diff -durN gdb-6.8.orig/gdb/main.c gdb-6.8/gdb/main.c ---- gdb-6.8.orig/gdb/main.c 2008-01-05 17:49:53.000000000 +0100 -+++ gdb-6.8/gdb/main.c 2008-06-17 16:07:33.000000000 +0200 -@@ -690,7 +690,7 @@ - - if (!inhibit_gdbinit) - { -- catch_command_errors (source_script, homeinit, 0, RETURN_MASK_ALL); -+ catch_command_errors (source_script, homeinit, -1, RETURN_MASK_ALL); - } - - /* Do stats; no need to do them elsewhere since we'll only -@@ -778,7 +778,7 @@ - || memcmp ((char *) &homebuf, (char *) &cwdbuf, sizeof (struct stat))) - if (!inhibit_gdbinit) - { -- catch_command_errors (source_script, gdbinit, 0, RETURN_MASK_ALL); -+ catch_command_errors (source_script, gdbinit, -1, RETURN_MASK_ALL); - } - - for (i = 0; i < ncmd; i++) -diff -durN gdb-6.8.orig/gdb/testsuite/gdb.base/gdbinit.exp gdb-6.8/gdb/testsuite/gdb.base/gdbinit.exp ---- gdb-6.8.orig/gdb/testsuite/gdb.base/gdbinit.exp 1970-01-01 01:00:00.000000000 +0100 -+++ gdb-6.8/gdb/testsuite/gdb.base/gdbinit.exp 2008-06-17 16:07:33.000000000 +0200 -@@ -0,0 +1,98 @@ -+# Copyright 2005 -+# Free Software Foundation, Inc. -+ -+# This program 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 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@prep.ai.mit.edu -+ -+# This file was written by Jeff Johnston . -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+set prms_id 0 -+set bug_id 0 -+ -+# are we on a target board -+if [is_remote target] { -+ return -+} -+ -+ -+global verbose -+global GDB -+global GDBFLAGS -+global gdb_prompt -+global timeout -+global gdb_spawn_id; -+ -+gdb_stop_suppressing_tests; -+ -+verbose "Spawning $GDB -nw" -+ -+if [info exists gdb_spawn_id] { -+ return 0; -+} -+ -+if ![is_remote host] { -+ if { [which $GDB] == 0 } then { -+ perror "$GDB does not exist." -+ exit 1 -+ } -+} -+ -+set env(HOME) [pwd] -+remote_exec build "rm .gdbinit" -+remote_exec build "cp ${srcdir}/${subdir}/gdbinit.sample .gdbinit" -+remote_exec build "chmod 646 .gdbinit" -+ -+set res [remote_spawn host "$GDB -nw [host_info gdb_opts]"]; -+if { $res < 0 || $res == "" } { -+ perror "Spawning $GDB failed." -+ return 1; -+} -+gdb_expect 360 { -+ -re "warning: not using untrusted file.*\.gdbinit.*\[\r\n\]$gdb_prompt $" { -+ pass "untrusted .gdbinit caught." -+ } -+ -re "$gdb_prompt $" { -+ fail "untrusted .gdbinit caught." -+ } -+ timeout { -+ fail "(timeout) untrusted .gdbinit caught." -+ } -+} -+ -+remote_exec build "chmod 644 .gdbinit" -+set res [remote_spawn host "$GDB -nw [host_info gdb_opts]"]; -+if { $res < 0 || $res == "" } { -+ perror "Spawning $GDB failed." -+ return 1; -+} -+gdb_expect 360 { -+ -re "warning: not using untrusted file.*\.gdbinit.*\[\r\n\]$gdb_prompt $" { -+ fail "trusted .gdbinit allowed." -+ } -+ -re "in gdbinit.*$gdb_prompt $" { -+ pass "trusted .gdbinit allowed." -+ } -+ timeout { -+ fail "(timeout) trusted .gdbinit allowed." -+ } -+} -+ -+remote_exec build "rm .gdbinit" -diff -durN gdb-6.8.orig/gdb/testsuite/gdb.base/gdbinit.sample gdb-6.8/gdb/testsuite/gdb.base/gdbinit.sample ---- gdb-6.8.orig/gdb/testsuite/gdb.base/gdbinit.sample 1970-01-01 01:00:00.000000000 +0100 -+++ gdb-6.8/gdb/testsuite/gdb.base/gdbinit.sample 2008-06-17 16:07:33.000000000 +0200 -@@ -0,0 +1 @@ -+echo "\nin gdbinit" diff --git a/patches/gdb/6.8/200-tdep-opcode-include-workaround.patch b/patches/gdb/6.8/200-tdep-opcode-include-workaround.patch deleted file mode 100644 index 61fdef4..0000000 --- a/patches/gdb/6.8/200-tdep-opcode-include-workaround.patch +++ /dev/null @@ -1,33 +0,0 @@ -Original patch from gentoo: gentoo/src/patchsets/gdb/6.8/20_all_gdb-tdep-opcode-include-workaround.patch --= BEGIN original header =- -workaround build failure - -http://bugs.gentoo.org/216368 - --= END original header =- -diff -durN gdb-6.8.orig/gdb/frv-tdep.c gdb-6.8/gdb/frv-tdep.c ---- gdb-6.8.orig/gdb/frv-tdep.c 2008-01-11 14:19:59.000000000 +0100 -+++ gdb-6.8/gdb/frv-tdep.c 2008-06-17 16:07:34.000000000 +0200 -@@ -32,7 +32,7 @@ - #include "gdb_assert.h" - #include "sim-regno.h" - #include "gdb/sim-frv.h" --#include "opcodes/frv-desc.h" /* for the H_SPR_... enums */ -+#include "../opcodes/frv-desc.h" /* for the H_SPR_... enums */ - #include "symtab.h" - #include "elf-bfd.h" - #include "elf/frv.h" -diff -durN gdb-6.8.orig/gdb/mep-tdep.c gdb-6.8/gdb/mep-tdep.c ---- gdb-6.8.orig/gdb/mep-tdep.c 2008-01-11 14:20:02.000000000 +0100 -+++ gdb-6.8/gdb/mep-tdep.c 2008-06-17 16:07:34.000000000 +0200 -@@ -53,8 +53,8 @@ - - /* Get the user's customized MeP coprocessor register names from - libopcodes. */ --#include "opcodes/mep-desc.h" --#include "opcodes/mep-opc.h" -+#include "../opcodes/mep-desc.h" -+#include "../opcodes/mep-opc.h" - - - /* The gdbarch_tdep structure. */ diff --git a/patches/glibc/2.3.6/195-use_short_for_fnstsw.patch b/patches/glibc/2.3.6/195-use_short_for_fnstsw.patch deleted file mode 100644 index 0e849fa..0000000 --- a/patches/glibc/2.3.6/195-use_short_for_fnstsw.patch +++ /dev/null @@ -1,18 +0,0 @@ -Original patch from H.J. Lu, as reported there: -http://www.nabble.com/PATCH:-Use-short-for-fnstsw-td14775171.html - -fnstsw stores 16bit into %ax. The upper 16bit of %eax is unchanged. -The new assembler (binutils-2.18.50.0.4 and up) will disallow "fnstsw %eax". - -diff -dur glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c ---- glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c 2004-03-05 11:14:48.000000000 +0100 -+++ glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c 2008-06-24 10:56:14.000000000 +0200 -@@ -26,7 +26,7 @@ - int - fetestexcept (int excepts) - { -- int temp; -+ short temp; - int xtemp = 0; - - /* Get current exceptions. */ diff --git a/patches/glibc/2.3.6/200-fix-pr631.patch b/patches/glibc/2.3.6/200-fix-pr631.patch deleted file mode 100644 index 899fa2a..0000000 --- a/patches/glibc/2.3.6/200-fix-pr631.patch +++ /dev/null @@ -1,45 +0,0 @@ -From dank@kegel.com -Wed Jun 15 09:12:43 PDT 2005 - -Fixes - -build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r' -build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent' -... 53 lines deleted ... -build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r' -collect2: ld returned 1 exit status -make[2]: *** [/build/gcc-3.4.3-glibc-2.3.5-hdrs-2.6.11.2/i686-unknown-linux-gnu/build-glibc/elf/ldconfig] Error 1 - -when building glibc with --enable-static-nss. - -See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631 - ---- glibc-2.3.5/Makeconfig.old Wed Jun 15 08:13:12 2005 -+++ glibc-2.3.5/Makeconfig Wed Jun 15 08:13:14 2005 -@@ -487,7 +487,7 @@ - - # The static libraries. - ifeq (yes,$(build-static)) --link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a -+link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a - else - ifeq (yes,$(build-shared)) - # We can try to link the programs with lib*_pic.a... ---- glibc-2.3.5/elf/Makefile.old Wed Jun 15 07:46:49 2005 -+++ glibc-2.3.5/elf/Makefile Wed Jun 15 08:14:00 2005 -@@ -115,6 +115,13 @@ - install-bin-script = ldd - endif - -+ifeq (yes,$(build-static-nss)) -+nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) -+resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv) -+otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ -+ $(resolvobjdir)/libresolv.a -+endif -+ - others = sprof sln - install-bin = sprof - others-static = sln - -Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.3.6/200-use_short_for_fnstsw.patch b/patches/glibc/2.3.6/200-use_short_for_fnstsw.patch new file mode 100644 index 0000000..0e849fa --- /dev/null +++ b/patches/glibc/2.3.6/200-use_short_for_fnstsw.patch @@ -0,0 +1,18 @@ +Original patch from H.J. Lu, as reported there: +http://www.nabble.com/PATCH:-Use-short-for-fnstsw-td14775171.html + +fnstsw stores 16bit into %ax. The upper 16bit of %eax is unchanged. +The new assembler (binutils-2.18.50.0.4 and up) will disallow "fnstsw %eax". + +diff -dur glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c +--- glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c 2004-03-05 11:14:48.000000000 +0100 ++++ glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c 2008-06-24 10:56:14.000000000 +0200 +@@ -26,7 +26,7 @@ + int + fetestexcept (int excepts) + { +- int temp; ++ short temp; + int xtemp = 0; + + /* Get current exceptions. */ diff --git a/patches/glibc/2.3.6/210-fix-pr631.patch b/patches/glibc/2.3.6/210-fix-pr631.patch new file mode 100644 index 0000000..899fa2a --- /dev/null +++ b/patches/glibc/2.3.6/210-fix-pr631.patch @@ -0,0 +1,45 @@ +From dank@kegel.com +Wed Jun 15 09:12:43 PDT 2005 + +Fixes + +build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r' +build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent' +... 53 lines deleted ... +build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r' +collect2: ld returned 1 exit status +make[2]: *** [/build/gcc-3.4.3-glibc-2.3.5-hdrs-2.6.11.2/i686-unknown-linux-gnu/build-glibc/elf/ldconfig] Error 1 + +when building glibc with --enable-static-nss. + +See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631 + +--- glibc-2.3.5/Makeconfig.old Wed Jun 15 08:13:12 2005 ++++ glibc-2.3.5/Makeconfig Wed Jun 15 08:13:14 2005 +@@ -487,7 +487,7 @@ + + # The static libraries. + ifeq (yes,$(build-static)) +-link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a ++link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a + else + ifeq (yes,$(build-shared)) + # We can try to link the programs with lib*_pic.a... +--- glibc-2.3.5/elf/Makefile.old Wed Jun 15 07:46:49 2005 ++++ glibc-2.3.5/elf/Makefile Wed Jun 15 08:14:00 2005 +@@ -115,6 +115,13 @@ + install-bin-script = ldd + endif + ++ifeq (yes,$(build-static-nss)) ++nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) ++resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv) ++otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ ++ $(resolvobjdir)/libresolv.a ++endif ++ + others = sprof sln + install-bin = sprof + others-static = sln + +Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.3.6/210-fp-byteorder.patch b/patches/glibc/2.3.6/210-fp-byteorder.patch deleted file mode 100644 index d45cdbc..0000000 --- a/patches/glibc/2.3.6/210-fp-byteorder.patch +++ /dev/null @@ -1,205 +0,0 @@ -Taken from http://sources.redhat.com/ml/crossgcc/2004-02/msg00104.html -Author: addsub@eyou.com -Target: ARM - -Fixes http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/920501-8.c -and makes printf("%f", 1.0) work. - -Lennert Buytenhek wrote in http://sources.redhat.com/ml/crossgcc/2004-09/msg00115.html : - It ... fixes the 'printf("%f\n", 0.5); prints 0.000000' and general 'floating point - is broken' on my big-endian hardfloat FPA ARM platform. ... - It's definitely needed for hardfloat. So I'd think it's needed for - big-endian systems in any case, and for VFP on little-endian systems - too. Someone would have to verify that though. - -Lennert Buytenhek wrote in http://sources.redhat.com/ml/crossgcc/2004-09/msg00123.html - I just had a look at glibc-20040830, and [this patch] is still needed and useful - for this version. glibc-20040830 out-of-the-box still contains the - following wrong assumptions: - - sysdeps/arm/bits/endian.h: float word order is big endian (which it is - not on vfp systems) - - sysdeps/arm/gmp-mparam.h: IEEE doubles are mixed endian (which they - are not on big endian systems, neither on vfp systems) - - sysdeps/arm/ieee754.h: IEEE doubles are in little endian byte order - (which they are not on big endian systems) - [This patch] seems the right solution for all of these issues. - -Dimitry Andric wrote in http://sources.redhat.com/ml/crossgcc/2004-09/msg00132.html : - It's even needed for glibc CVS, AFAICS. - The patch hunk which modifies glibc.new/sysdeps/arm/bits/endian.h - (currently at version 1.4) is only needed for proper VFP operation. - But the hunk which modifies sysdeps/arm/gmp-mparam.h, and the hunk - that deletes sysdeps/arm/ieee754.h (yes, this IS correct), are needed - for proper operation of *any* FP model on big endian ARM. - -See also discussion in followups to -http://sources.redhat.com/ml/crossgcc/2004-05/msg00245.html) - -Message-ID: <276985760.37584@eyou.com> -Received: from unknown (HELO eyou.com) (172.16.2.2) - by 0.0.0.0 with SMTP; Tue, 17 Feb 2004 10:42:40 +0800 -Received: (qmail 8238 invoked by uid 65534); 17 Feb 2004 10:42:38 +0800 -Date: 17 Feb 2004 10:42:38 +0800 -Message-ID: <20040217104238.8237.qmail@eyou.com> -From: "add" -To: dank@kegel.com -Reply-To: "add" -Subject: Re:   problem while building arm vfp softfloat gcc ` - -Hi, Dan, This is a patch I applied to my glibc-2.3.2, then my softfloat -toolchain can printf("%f\n",1.0). So you may have a try of this - - -diff -uNrp glibc.old/sysdeps/arm/bits/endian.h glibc.new/sysdeps/arm/bits/endian.h ---- glibc.old/sysdeps/arm/bits/endian.h 1999-04-12 11:59:13.000000000 -0400 -+++ glibc.new/sysdeps/arm/bits/endian.h 2004-02-12 09:15:13.000000000 -0500 -@@ -9,4 +9,9 @@ - #else - #define __BYTE_ORDER __LITTLE_ENDIAN - #endif -+ -+#ifdef __VFP_FP__ -+#define __FLOAT_WORD_ORDER __BYTE_ORDER -+#else - #define __FLOAT_WORD_ORDER __BIG_ENDIAN -+#endif -diff -uNrp glibc.old/sysdeps/arm/gmp-mparam.h glibc.new/sysdeps/arm/gmp-mparam.h ---- glibc.old/sysdeps/arm/gmp-mparam.h 2001-07-07 15:21:19.000000000 -0400 -+++ glibc.new/sysdeps/arm/gmp-mparam.h 2004-02-12 09:15:13.000000000 -0500 -@@ -26,5 +26,13 @@ MA 02111-1307, USA. */ - #define BITS_PER_SHORTINT 16 - #define BITS_PER_CHAR 8 - --#define IEEE_DOUBLE_BIG_ENDIAN 0 --#define IEEE_DOUBLE_MIXED_ENDIAN 1 -+#if defined(__ARMEB__) -+# define IEEE_DOUBLE_MIXED_ENDIAN 0 -+# define IEEE_DOUBLE_BIG_ENDIAN 1 -+#elif defined(__VFP_FP__) -+# define IEEE_DOUBLE_MIXED_ENDIAN 0 -+# define IEEE_DOUBLE_BIG_ENDIAN 0 -+#else -+# define IEEE_DOUBLE_BIG_ENDIAN 0 -+# define IEEE_DOUBLE_MIXED_ENDIAN 1 -+#endif -diff -uNrp glibc.old/sysdeps/arm/ieee754.h glibc.new/sysdeps/arm/ieee754.h ---- glibc.old/sysdeps/arm/ieee754.h 2001-07-07 15:21:19.000000000 -0400 -+++ glibc.new/sysdeps/arm/ieee754.h 1969-12-31 19:00:00.000000000 -0500 -@@ -1,115 +0,0 @@ --/* Copyright (C) 1992, 1995, 1996, 1998 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- -- The GNU C 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 -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, write to the Free -- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -- 02111-1307 USA. */ -- --#ifndef _IEEE754_H -- --#define _IEEE754_H 1 --#include -- --#include -- --__BEGIN_DECLS -- --union ieee754_float -- { -- float f; -- -- /* This is the IEEE 754 single-precision format. */ -- struct -- { -- unsigned int mantissa:23; -- unsigned int exponent:8; -- unsigned int negative:1; -- } ieee; -- -- /* This format makes it easier to see if a NaN is a signalling NaN. */ -- struct -- { -- unsigned int mantissa:22; -- unsigned int quiet_nan:1; -- unsigned int exponent:8; -- unsigned int negative:1; -- } ieee_nan; -- }; -- --#define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */ -- -- --union ieee754_double -- { -- double d; -- -- /* This is the IEEE 754 double-precision format. */ -- struct -- { -- unsigned int mantissa0:20; -- unsigned int exponent:11; -- unsigned int negative:1; -- unsigned int mantissa1:32; -- } ieee; -- -- /* This format makes it easier to see if a NaN is a signalling NaN. */ -- struct -- { -- unsigned int mantissa0:19; -- unsigned int quiet_nan:1; -- unsigned int exponent:11; -- unsigned int negative:1; -- unsigned int mantissa1:32; -- } ieee_nan; -- }; -- --#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */ -- -- --/* The following two structures are correct for `new' floating point systems but -- wrong for the old FPPC. The only solution seems to be to avoid their use on -- old hardware. */ -- --union ieee854_long_double -- { -- long double d; -- -- /* This is the IEEE 854 double-extended-precision format. */ -- struct -- { -- unsigned int exponent:15; -- unsigned int empty:16; -- unsigned int negative:1; -- unsigned int mantissa1:32; -- unsigned int mantissa0:32; -- } ieee; -- -- /* This is for NaNs in the IEEE 854 double-extended-precision format. */ -- struct -- { -- unsigned int exponent:15; -- unsigned int empty:16; -- unsigned int negative:1; -- unsigned int mantissa1:32; -- unsigned int mantissa0:30; -- unsigned int quiet_nan:1; -- unsigned int one:1; -- } ieee_nan; -- }; -- --#define IEEE854_LONG_DOUBLE_BIAS 0x3fff -- --__END_DECLS -- --#endif /* ieee754.h */ - -Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.3.6/220-fp-byteorder.patch b/patches/glibc/2.3.6/220-fp-byteorder.patch new file mode 100644 index 0000000..d45cdbc --- /dev/null +++ b/patches/glibc/2.3.6/220-fp-byteorder.patch @@ -0,0 +1,205 @@ +Taken from http://sources.redhat.com/ml/crossgcc/2004-02/msg00104.html +Author: addsub@eyou.com +Target: ARM + +Fixes http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/920501-8.c +and makes printf("%f", 1.0) work. + +Lennert Buytenhek wrote in http://sources.redhat.com/ml/crossgcc/2004-09/msg00115.html : + It ... fixes the 'printf("%f\n", 0.5); prints 0.000000' and general 'floating point + is broken' on my big-endian hardfloat FPA ARM platform. ... + It's definitely needed for hardfloat. So I'd think it's needed for + big-endian systems in any case, and for VFP on little-endian systems + too. Someone would have to verify that though. + +Lennert Buytenhek wrote in http://sources.redhat.com/ml/crossgcc/2004-09/msg00123.html + I just had a look at glibc-20040830, and [this patch] is still needed and useful + for this version. glibc-20040830 out-of-the-box still contains the + following wrong assumptions: + - sysdeps/arm/bits/endian.h: float word order is big endian (which it is + not on vfp systems) + - sysdeps/arm/gmp-mparam.h: IEEE doubles are mixed endian (which they + are not on big endian systems, neither on vfp systems) + - sysdeps/arm/ieee754.h: IEEE doubles are in little endian byte order + (which they are not on big endian systems) + [This patch] seems the right solution for all of these issues. + +Dimitry Andric wrote in http://sources.redhat.com/ml/crossgcc/2004-09/msg00132.html : + It's even needed for glibc CVS, AFAICS. + The patch hunk which modifies glibc.new/sysdeps/arm/bits/endian.h + (currently at version 1.4) is only needed for proper VFP operation. + But the hunk which modifies sysdeps/arm/gmp-mparam.h, and the hunk + that deletes sysdeps/arm/ieee754.h (yes, this IS correct), are needed + for proper operation of *any* FP model on big endian ARM. + +See also discussion in followups to +http://sources.redhat.com/ml/crossgcc/2004-05/msg00245.html) + +Message-ID: <276985760.37584@eyou.com> +Received: from unknown (HELO eyou.com) (172.16.2.2) + by 0.0.0.0 with SMTP; Tue, 17 Feb 2004 10:42:40 +0800 +Received: (qmail 8238 invoked by uid 65534); 17 Feb 2004 10:42:38 +0800 +Date: 17 Feb 2004 10:42:38 +0800 +Message-ID: <20040217104238.8237.qmail@eyou.com> +From: "add" +To: dank@kegel.com +Reply-To: "add" +Subject: Re:   problem while building arm vfp softfloat gcc ` + +Hi, Dan, This is a patch I applied to my glibc-2.3.2, then my softfloat +toolchain can printf("%f\n",1.0). So you may have a try of this + + +diff -uNrp glibc.old/sysdeps/arm/bits/endian.h glibc.new/sysdeps/arm/bits/endian.h +--- glibc.old/sysdeps/arm/bits/endian.h 1999-04-12 11:59:13.000000000 -0400 ++++ glibc.new/sysdeps/arm/bits/endian.h 2004-02-12 09:15:13.000000000 -0500 +@@ -9,4 +9,9 @@ + #else + #define __BYTE_ORDER __LITTLE_ENDIAN + #endif ++ ++#ifdef __VFP_FP__ ++#define __FLOAT_WORD_ORDER __BYTE_ORDER ++#else + #define __FLOAT_WORD_ORDER __BIG_ENDIAN ++#endif +diff -uNrp glibc.old/sysdeps/arm/gmp-mparam.h glibc.new/sysdeps/arm/gmp-mparam.h +--- glibc.old/sysdeps/arm/gmp-mparam.h 2001-07-07 15:21:19.000000000 -0400 ++++ glibc.new/sysdeps/arm/gmp-mparam.h 2004-02-12 09:15:13.000000000 -0500 +@@ -26,5 +26,13 @@ MA 02111-1307, USA. */ + #define BITS_PER_SHORTINT 16 + #define BITS_PER_CHAR 8 + +-#define IEEE_DOUBLE_BIG_ENDIAN 0 +-#define IEEE_DOUBLE_MIXED_ENDIAN 1 ++#if defined(__ARMEB__) ++# define IEEE_DOUBLE_MIXED_ENDIAN 0 ++# define IEEE_DOUBLE_BIG_ENDIAN 1 ++#elif defined(__VFP_FP__) ++# define IEEE_DOUBLE_MIXED_ENDIAN 0 ++# define IEEE_DOUBLE_BIG_ENDIAN 0 ++#else ++# define IEEE_DOUBLE_BIG_ENDIAN 0 ++# define IEEE_DOUBLE_MIXED_ENDIAN 1 ++#endif +diff -uNrp glibc.old/sysdeps/arm/ieee754.h glibc.new/sysdeps/arm/ieee754.h +--- glibc.old/sysdeps/arm/ieee754.h 2001-07-07 15:21:19.000000000 -0400 ++++ glibc.new/sysdeps/arm/ieee754.h 1969-12-31 19:00:00.000000000 -0500 +@@ -1,115 +0,0 @@ +-/* Copyright (C) 1992, 1995, 1996, 1998 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- +- The GNU C Library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- The GNU C 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 +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with the GNU C Library; if not, write to the Free +- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +- 02111-1307 USA. */ +- +-#ifndef _IEEE754_H +- +-#define _IEEE754_H 1 +-#include +- +-#include +- +-__BEGIN_DECLS +- +-union ieee754_float +- { +- float f; +- +- /* This is the IEEE 754 single-precision format. */ +- struct +- { +- unsigned int mantissa:23; +- unsigned int exponent:8; +- unsigned int negative:1; +- } ieee; +- +- /* This format makes it easier to see if a NaN is a signalling NaN. */ +- struct +- { +- unsigned int mantissa:22; +- unsigned int quiet_nan:1; +- unsigned int exponent:8; +- unsigned int negative:1; +- } ieee_nan; +- }; +- +-#define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */ +- +- +-union ieee754_double +- { +- double d; +- +- /* This is the IEEE 754 double-precision format. */ +- struct +- { +- unsigned int mantissa0:20; +- unsigned int exponent:11; +- unsigned int negative:1; +- unsigned int mantissa1:32; +- } ieee; +- +- /* This format makes it easier to see if a NaN is a signalling NaN. */ +- struct +- { +- unsigned int mantissa0:19; +- unsigned int quiet_nan:1; +- unsigned int exponent:11; +- unsigned int negative:1; +- unsigned int mantissa1:32; +- } ieee_nan; +- }; +- +-#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */ +- +- +-/* The following two structures are correct for `new' floating point systems but +- wrong for the old FPPC. The only solution seems to be to avoid their use on +- old hardware. */ +- +-union ieee854_long_double +- { +- long double d; +- +- /* This is the IEEE 854 double-extended-precision format. */ +- struct +- { +- unsigned int exponent:15; +- unsigned int empty:16; +- unsigned int negative:1; +- unsigned int mantissa1:32; +- unsigned int mantissa0:32; +- } ieee; +- +- /* This is for NaNs in the IEEE 854 double-extended-precision format. */ +- struct +- { +- unsigned int exponent:15; +- unsigned int empty:16; +- unsigned int negative:1; +- unsigned int mantissa1:32; +- unsigned int mantissa0:30; +- unsigned int quiet_nan:1; +- unsigned int one:1; +- } ieee_nan; +- }; +- +-#define IEEE854_LONG_DOUBLE_BIAS 0x3fff +- +-__END_DECLS +- +-#endif /* ieee754.h */ + +Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.3.6/220-mips-bootstrap-gcc-header-install.patch b/patches/glibc/2.3.6/220-mips-bootstrap-gcc-header-install.patch deleted file mode 100644 index 2fd72f8..0000000 --- a/patches/glibc/2.3.6/220-mips-bootstrap-gcc-header-install.patch +++ /dev/null @@ -1,37 +0,0 @@ -http://sourceware.org/ml/crossgcc/2005-05/msg00165.html -Fixes a MIPS build problem (unrelated to NPTL) - -Message-ID: <428E8B24.1000201@realitydiluted.com> -Date: Fri, 20 May 2005 20:13:08 -0500 -From: "Steven J dot Hill" -To: crossgcc at sources dot redhat dot com, toolchain at gentoo dot org, - Shay_Gal-On at pmc-sierra dot com, TheNop at gmx dot net -Subject: New NPTL patches for crosstools and MIPS NPTL patches.... - -Greetings. - -I have uploaded the latest NPTL patch for crosstool-0.34. I have also -uploaded a tarball of the patches necessary to build a MIPS NPTL -cross toolchain. To build a MIPS NPTL toolchain you will need the -released version of binutils-2.16 and the absolute latest GCC and -glibc code from the HEAD of cvs. Use the 'demo-mips-nptl.sh' script -to build the toolchain. Please report bugs or issues to the crossgcc -mailing list. Here is the link off of my FTP site: - - ftp://ftp.realitydiluted.com/crosstools/crosstool-0.34/ - -[Note: BOOTSTRAP_GCC is set by crosstool.sh when invoking make install-headers] - -diff -ur glibc-2.4.0-20050406/sysdeps/mips/mips32/Makefile glibc-2.4.0-20050406-patched/sysdeps/mips/mips32/Makefile ---- glibc-2.4.0-20050406/sysdeps/mips/mips32/Makefile 2003-03-29 02:15:28.000000000 -0600 -+++ glibc-2.4.0-20050406-patched/sysdeps/mips/mips32/Makefile 2005-04-12 21:36:51.318837655 -0500 -@@ -1,3 +1,7 @@ -+ifeq ($(filter -DBOOTSTRAP_GCC,$(CFLAGS)),) - ifeq ($(filter -mabi=32,$(CC)),) - CC += -mabi=32 - endif -+else -+CC += -D"_MIPS_SZPTR=32" -+endif - -Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.3.6/230-make-install-lib-all.patch b/patches/glibc/2.3.6/230-make-install-lib-all.patch deleted file mode 100644 index 1e69bb2..0000000 --- a/patches/glibc/2.3.6/230-make-install-lib-all.patch +++ /dev/null @@ -1,26 +0,0 @@ -From http://svn.exactcode.de/t2/trunk/package/base/glibc32/make-install-lib-all.patch -Rule to install all needed libraries, not just the ones installed by install-lib, -yet not install programs. -Needed because we can't use the main install target, as we can't build programs before -we have the final gcc installed; linking fails because libeh.a is not present, -and glibc insists on linking programs with that library. - -diff -Naur glibc-2.3.4.orig/Makerules glibc-2.3.4/Makerules ---- glibc-2.3.4.orig/Makerules 2004-12-15 20:52:39.000000000 +0200 -+++ glibc-2.3.4/Makerules 2005-02-19 15:16:31.415125176 +0200 -@@ -844,6 +844,13 @@ - installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\ - $(inst_libdir)/$(patsubst %,$(libtype$o),\ - $(libprefix)$(libc-name))) -+ -+install-lib-all: $(inst_slibdir)/libc.so$(libc.so-version) \ -+ $(inst_slibdir)/libc-$(version).so \ -+ $(inst_libdir)/libc.so \ -+ $(inst_libdir)/libc.a \ -+ install-lib -+ - install: $(installed-libcs) - $(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force) - $(make-target-directory) - -Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.3.6/230-mips-bootstrap-gcc-header-install.patch b/patches/glibc/2.3.6/230-mips-bootstrap-gcc-header-install.patch new file mode 100644 index 0000000..2fd72f8 --- /dev/null +++ b/patches/glibc/2.3.6/230-mips-bootstrap-gcc-header-install.patch @@ -0,0 +1,37 @@ +http://sourceware.org/ml/crossgcc/2005-05/msg00165.html +Fixes a MIPS build problem (unrelated to NPTL) + +Message-ID: <428E8B24.1000201@realitydiluted.com> +Date: Fri, 20 May 2005 20:13:08 -0500 +From: "Steven J dot Hill" +To: crossgcc at sources dot redhat dot com, toolchain at gentoo dot org, + Shay_Gal-On at pmc-sierra dot com, TheNop at gmx dot net +Subject: New NPTL patches for crosstools and MIPS NPTL patches.... + +Greetings. + +I have uploaded the latest NPTL patch for crosstool-0.34. I have also +uploaded a tarball of the patches necessary to build a MIPS NPTL +cross toolchain. To build a MIPS NPTL toolchain you will need the +released version of binutils-2.16 and the absolute latest GCC and +glibc code from the HEAD of cvs. Use the 'demo-mips-nptl.sh' script +to build the toolchain. Please report bugs or issues to the crossgcc +mailing list. Here is the link off of my FTP site: + + ftp://ftp.realitydiluted.com/crosstools/crosstool-0.34/ + +[Note: BOOTSTRAP_GCC is set by crosstool.sh when invoking make install-headers] + +diff -ur glibc-2.4.0-20050406/sysdeps/mips/mips32/Makefile glibc-2.4.0-20050406-patched/sysdeps/mips/mips32/Makefile +--- glibc-2.4.0-20050406/sysdeps/mips/mips32/Makefile 2003-03-29 02:15:28.000000000 -0600 ++++ glibc-2.4.0-20050406-patched/sysdeps/mips/mips32/Makefile 2005-04-12 21:36:51.318837655 -0500 +@@ -1,3 +1,7 @@ ++ifeq ($(filter -DBOOTSTRAP_GCC,$(CFLAGS)),) + ifeq ($(filter -mabi=32,$(CC)),) + CC += -mabi=32 + endif ++else ++CC += -D"_MIPS_SZPTR=32" ++endif + +Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.3.6/240-make-install-lib-all.patch b/patches/glibc/2.3.6/240-make-install-lib-all.patch new file mode 100644 index 0000000..1e69bb2 --- /dev/null +++ b/patches/glibc/2.3.6/240-make-install-lib-all.patch @@ -0,0 +1,26 @@ +From http://svn.exactcode.de/t2/trunk/package/base/glibc32/make-install-lib-all.patch +Rule to install all needed libraries, not just the ones installed by install-lib, +yet not install programs. +Needed because we can't use the main install target, as we can't build programs before +we have the final gcc installed; linking fails because libeh.a is not present, +and glibc insists on linking programs with that library. + +diff -Naur glibc-2.3.4.orig/Makerules glibc-2.3.4/Makerules +--- glibc-2.3.4.orig/Makerules 2004-12-15 20:52:39.000000000 +0200 ++++ glibc-2.3.4/Makerules 2005-02-19 15:16:31.415125176 +0200 +@@ -844,6 +844,13 @@ + installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\ + $(inst_libdir)/$(patsubst %,$(libtype$o),\ + $(libprefix)$(libc-name))) ++ ++install-lib-all: $(inst_slibdir)/libc.so$(libc.so-version) \ ++ $(inst_slibdir)/libc-$(version).so \ ++ $(inst_libdir)/libc.so \ ++ $(inst_libdir)/libc.a \ ++ install-lib ++ + install: $(installed-libcs) + $(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force) + $(make-target-directory) + +Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.3.6/240-weakalias.patch b/patches/glibc/2.3.6/240-weakalias.patch deleted file mode 100644 index 722365f..0000000 --- a/patches/glibc/2.3.6/240-weakalias.patch +++ /dev/null @@ -1,45 +0,0 @@ -This one was taken from debian. - -# DP: Description: Fix __bind redefinition problem -# DP: Related bugs: -# DP: Dpatch author: Phil Blundell -# DP: Patch author: Daniel Jacobowitz -# DP: Upstream status: In CVS -# DP: Status Details: -# DP: Date: 2005-12-25 - -Index: sysdeps/unix/sysv/linux/arm/socket.S -=================================================================== -RCS file: /cvs/glibc/ports/sysdeps/unix/sysv/linux/arm/socket.S,v -retrieving revision 1.12 -retrieving revision 1.13 -diff -u -r1.12 -r1.13 ---- glibc-2.3.6.ds1.orig/sysdeps/unix/sysv/linux/arm/socket.S 4 Dec 2004 21:20:16 -0000 1.12 -+++ glibc-2.3.6.ds1/sysdeps/unix/sysv/linux/arm/socket.S 27 Oct 2005 18:50:12 -0000 1.13 -@@ -1,4 +1,6 @@ --/* Copyright (C) 1995, 1996, 1997, 1998, 2003 Free Software Foundation, Inc. -+/* Copyright (C) 1995, 1996, 1997, 1998, 2003, 2004, 2005 -+ Free Software Foundation, Inc. -+ - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or -@@ -32,7 +34,11 @@ - The .S files for the other calls just #define socket and #include this. */ - - #ifndef __socket -+#ifndef NO_WEAK_ALIAS - #define __socket P(__,socket) -+#else -+#define __socket socket -+#endif - #endif - - #define PUSHARGS_1 str a1, [sp, $-4]! -@@ -120,4 +126,6 @@ - - PSEUDO_END (__socket) - -+#ifndef NO_WEAK_ALIAS - weak_alias (__socket, socket) -+#endif diff --git a/patches/glibc/2.3.6/250-csu-Makefile.patch b/patches/glibc/2.3.6/250-csu-Makefile.patch deleted file mode 100644 index 509cbcc..0000000 --- a/patches/glibc/2.3.6/250-csu-Makefile.patch +++ /dev/null @@ -1,39 +0,0 @@ -Use printf instead of echo for some shells. - -http://www.cygwin.com/ml/libc-alpha/2005-02/msg00123.html - -This patch does not generate invalid csu/version-info.h which has -unterminating " line because some /bin/sh cannot parse correctly. The -previous discussion was: - - http://sources.redhat.com/ml/libc-alpha/2004-08/msg00129.html - http://sources.redhat.com/ml/libc-alpha/2004-08/msg00145.html - -This patch gets rid of all this issue because the conclusion of the -discussion was to use printf instead of echo. Roland, could you look -at it again? - -Regards, --- gotom - -2005-02-26 GOTO Masanori - - * csu/Makefile: Use printf instead of echo for some shells. - -Index: csu/Makefile -=================================================================== -RCS file: /cvs/glibc/libc/csu/Makefile,v -retrieving revision 1.75 -diff -u -p -r1.75 Makefile ---- glibc/csu/Makefile 3 Jan 2005 17:57:14 -0000 1.75 -+++ glibc.new/csu/Makefile 27 Feb 2005 01:17:49 -0000 -@@ -241,7 +241,7 @@ $(objpfx)version-info.h: $(common-objpfx - esac; \ - files="$(all-Banner-files)"; \ - if test -n "$$files"; then \ -- echo "\"Available extensions:\\n\""; \ -+ printf '"Available extensions:\\n"\n'; \ - sed -e '/^#/d' -e 's/^[[:space:]]*/ /' \ - -e 's/^\(.*\)$$/\"\1\\n\"/' $$files; \ - fi) > $@T - diff --git a/patches/glibc/2.3.6/250-weakalias.patch b/patches/glibc/2.3.6/250-weakalias.patch new file mode 100644 index 0000000..722365f --- /dev/null +++ b/patches/glibc/2.3.6/250-weakalias.patch @@ -0,0 +1,45 @@ +This one was taken from debian. + +# DP: Description: Fix __bind redefinition problem +# DP: Related bugs: +# DP: Dpatch author: Phil Blundell +# DP: Patch author: Daniel Jacobowitz +# DP: Upstream status: In CVS +# DP: Status Details: +# DP: Date: 2005-12-25 + +Index: sysdeps/unix/sysv/linux/arm/socket.S +=================================================================== +RCS file: /cvs/glibc/ports/sysdeps/unix/sysv/linux/arm/socket.S,v +retrieving revision 1.12 +retrieving revision 1.13 +diff -u -r1.12 -r1.13 +--- glibc-2.3.6.ds1.orig/sysdeps/unix/sysv/linux/arm/socket.S 4 Dec 2004 21:20:16 -0000 1.12 ++++ glibc-2.3.6.ds1/sysdeps/unix/sysv/linux/arm/socket.S 27 Oct 2005 18:50:12 -0000 1.13 +@@ -1,4 +1,6 @@ +-/* Copyright (C) 1995, 1996, 1997, 1998, 2003 Free Software Foundation, Inc. ++/* Copyright (C) 1995, 1996, 1997, 1998, 2003, 2004, 2005 ++ Free Software Foundation, Inc. ++ + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or +@@ -32,7 +34,11 @@ + The .S files for the other calls just #define socket and #include this. */ + + #ifndef __socket ++#ifndef NO_WEAK_ALIAS + #define __socket P(__,socket) ++#else ++#define __socket socket ++#endif + #endif + + #define PUSHARGS_1 str a1, [sp, $-4]! +@@ -120,4 +126,6 @@ + + PSEUDO_END (__socket) + ++#ifndef NO_WEAK_ALIAS + weak_alias (__socket, socket) ++#endif diff --git a/patches/glibc/2.3.6/260-alpha-asm_page.patch b/patches/glibc/2.3.6/260-alpha-asm_page.patch deleted file mode 100644 index b198b36..0000000 --- a/patches/glibc/2.3.6/260-alpha-asm_page.patch +++ /dev/null @@ -1,26 +0,0 @@ -2008-06-07 Mike Frysinger - - * sysdeps/unix/sysv/linux/alpha/sys/user.h: Copy page.h definitions - from the kernel header to sys/user.h and remove the #include of - sys/user.h. - ---- a/sysdeps/unix/sysv/linux/alpha/sys/user.h -+++ b/sysdeps/unix/sysv/linux/alpha/sys/user.h -@@ -23,7 +23,6 @@ - only. Don't read too much into it. Don't use it for anything other - than gdb/strace unless you know what you are doing. */ - --#include - #include - - struct user -@@ -41,6 +40,9 @@ struct user - char u_comm[32]; /* user command name */ - }; - -+#define PAGE_SHIFT 13 -+#define PAGE_SIZE (1 << PAGE_SHIFT) -+#define PAGE_MASK (~(PAGE_SIZE-1)) - #define NBPG PAGE_SIZE - #define UPAGES 1 - #define HOST_TEXT_START_ADDR (u.start_code) diff --git a/patches/glibc/2.3.6/260-csu-Makefile.patch b/patches/glibc/2.3.6/260-csu-Makefile.patch new file mode 100644 index 0000000..509cbcc --- /dev/null +++ b/patches/glibc/2.3.6/260-csu-Makefile.patch @@ -0,0 +1,39 @@ +Use printf instead of echo for some shells. + +http://www.cygwin.com/ml/libc-alpha/2005-02/msg00123.html + +This patch does not generate invalid csu/version-info.h which has +unterminating " line because some /bin/sh cannot parse correctly. The +previous discussion was: + + http://sources.redhat.com/ml/libc-alpha/2004-08/msg00129.html + http://sources.redhat.com/ml/libc-alpha/2004-08/msg00145.html + +This patch gets rid of all this issue because the conclusion of the +discussion was to use printf instead of echo. Roland, could you look +at it again? + +Regards, +-- gotom + +2005-02-26 GOTO Masanori + + * csu/Makefile: Use printf instead of echo for some shells. + +Index: csu/Makefile +=================================================================== +RCS file: /cvs/glibc/libc/csu/Makefile,v +retrieving revision 1.75 +diff -u -p -r1.75 Makefile +--- glibc/csu/Makefile 3 Jan 2005 17:57:14 -0000 1.75 ++++ glibc.new/csu/Makefile 27 Feb 2005 01:17:49 -0000 +@@ -241,7 +241,7 @@ $(objpfx)version-info.h: $(common-objpfx + esac; \ + files="$(all-Banner-files)"; \ + if test -n "$$files"; then \ +- echo "\"Available extensions:\\n\""; \ ++ printf '"Available extensions:\\n"\n'; \ + sed -e '/^#/d' -e 's/^[[:space:]]*/ /' \ + -e 's/^\(.*\)$$/\"\1\\n\"/' $$files; \ + fi) > $@T + diff --git a/patches/glibc/2.3.6/270-alpha-asm_elf.patch b/patches/glibc/2.3.6/270-alpha-asm_elf.patch deleted file mode 100644 index 3da5c8e..0000000 --- a/patches/glibc/2.3.6/270-alpha-asm_elf.patch +++ /dev/null @@ -1,194 +0,0 @@ -since the kernel no longer provides asm/elf.h, the sys/procfs.h from the -common code, alpha, and sh fail when used. this should things up. --mike - -2008-06-07 Mike Frysinger - - * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. - * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h - definitions from the kernel header to sys/procfs.h and remove the - #include of asm/elf.h. - * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. - -*Attachment: signature.asc * -/Description:/ This is a digitally signed message part. - -2008-06-07 Mike Frysinger - - * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. - * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h - definitions from the kernel header to sys/procfs.h and remove the - #include of asm/elf.h. - * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. - ---- a/sysdeps/unix/sysv/linux/alpha/sys/procfs.h -+++ b/sysdeps/unix/sysv/linux/alpha/sys/procfs.h -@@ -29,10 +29,23 @@ - #include - #include - #include --#include - - __BEGIN_DECLS - -+/* -+ * The OSF/1 version of makes gregset_t 46 entries long. -+ * I have no idea why that is so. For now, we just leave it at 33 -+ * (32 general regs + processor status word). -+ */ -+#define ELF_NGREG 33 -+#define ELF_NFPREG 32 -+ -+typedef unsigned long elf_greg_t; -+typedef elf_greg_t elf_gregset_t[ELF_NGREG]; -+ -+typedef double elf_fpreg_t; -+typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; -+ - struct elf_siginfo - { - int si_signo; /* Signal number. */ ---- a/sysdeps/unix/sysv/linux/sh/sys/procfs.h -+++ b/sysdeps/unix/sysv/linux/sh/sys/procfs.h -@@ -29,10 +29,19 @@ - #include - #include - #include --#include - - __BEGIN_DECLS - -+/* -+ * ELF register definitions... -+ */ -+typedef unsigned long elf_greg_t; -+ -+#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) -+typedef elf_greg_t elf_gregset_t[ELF_NGREG]; -+ -+typedef struct user_fpu_struct elf_fpregset_t; -+ - struct elf_siginfo - { - int si_signo; /* Signal number. */ ---- a/sysdeps/unix/sysv/linux/sys/procfs.h -+++ b/sysdeps/unix/sysv/linux/sys/procfs.h -@@ -1,115 +1,2 @@ --/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- -- The GNU C 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 -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, write to the Free -- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -- 02111-1307 USA. */ -- --#ifndef _SYS_PROCFS_H --#define _SYS_PROCFS_H 1 -- --/* This is somehow modelled after the file of the same name on SysVr4 -- systems. It provides a definition of the core file format for ELF -- used on Linux. */ -- --#include --#include --#include --#include --#include --#include --#include -- --__BEGIN_DECLS -- --struct elf_siginfo -- { -- int si_signo; /* Signal number. */ -- int si_code; /* Extra code. */ -- int si_errno; /* Errno. */ -- }; -- --/* Definitions to generate Intel SVR4-like core files. These mostly -- have the same names as the SVR4 types with "elf_" tacked on the -- front to prevent clashes with linux definitions, and the typedef -- forms have been avoided. This is mostly like the SVR4 structure, -- but more Linuxy, with things that Linux does not support and which -- gdb doesn't really use excluded. Fields present but not used are -- marked with "XXX". */ --struct elf_prstatus -- { --#if 0 -- long int pr_flags; /* XXX Process flags. */ -- short int pr_why; /* XXX Reason for process halt. */ -- short int pr_what; /* XXX More detailed reason. */ --#endif -- struct elf_siginfo pr_info; /* Info associated with signal. */ -- short int pr_cursig; /* Current signal. */ -- unsigned long int pr_sigpend; /* Set of pending signals. */ -- unsigned long int pr_sighold; /* Set of held signals. */ --#if 0 -- struct sigaltstack pr_altstack; /* Alternate stack info. */ -- struct sigaction pr_action; /* Signal action for current sig. */ --#endif -- __pid_t pr_pid; -- __pid_t pr_ppid; -- __pid_t pr_pgrp; -- __pid_t pr_sid; -- struct timeval pr_utime; /* User time. */ -- struct timeval pr_stime; /* System time. */ -- struct timeval pr_cutime; /* Cumulative user time. */ -- struct timeval pr_cstime; /* Cumulative system time. */ --#if 0 -- long int pr_instr; /* Current instruction. */ --#endif -- elf_gregset_t pr_reg; /* GP registers. */ -- int pr_fpvalid; /* True if math copro being used. */ -- }; -- -- --#define ELF_PRARGSZ (80) /* Number of chars for args */ -- --struct elf_prpsinfo -- { -- char pr_state; /* Numeric process state. */ -- char pr_sname; /* Char for pr_state. */ -- char pr_zomb; /* Zombie. */ -- char pr_nice; /* Nice val. */ -- unsigned long int pr_flag; /* Flags. */ -- unsigned short int pr_uid; -- unsigned short int pr_gid; -- int pr_pid, pr_ppid, pr_pgrp, pr_sid; -- /* Lots missing */ -- char pr_fname[16]; /* Filename of executable. */ -- char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ -- }; -- --/* Addresses. */ --typedef void *psaddr_t; -- --/* Register sets. Linux has different names. */ --typedef gregset_t prgregset_t; --typedef fpregset_t prfpregset_t; -- --/* We don't have any differences between processes and threads, -- therefore habe only ine PID type. */ --typedef __pid_t lwpid_t; -- -- --typedef struct elf_prstatus prstatus_t; --typedef struct elf_prpsinfo prpsinfo_t; -- --__END_DECLS -- --#endif /* sys/procfs.h */ -+/* sys/procfs.h is architecture specific. */ -+#error "This file must be supplied by every Linux architecture." - diff --git a/patches/glibc/2.3.6/270-alpha-asm_page.patch b/patches/glibc/2.3.6/270-alpha-asm_page.patch new file mode 100644 index 0000000..b198b36 --- /dev/null +++ b/patches/glibc/2.3.6/270-alpha-asm_page.patch @@ -0,0 +1,26 @@ +2008-06-07 Mike Frysinger + + * sysdeps/unix/sysv/linux/alpha/sys/user.h: Copy page.h definitions + from the kernel header to sys/user.h and remove the #include of + sys/user.h. + +--- a/sysdeps/unix/sysv/linux/alpha/sys/user.h ++++ b/sysdeps/unix/sysv/linux/alpha/sys/user.h +@@ -23,7 +23,6 @@ + only. Don't read too much into it. Don't use it for anything other + than gdb/strace unless you know what you are doing. */ + +-#include + #include + + struct user +@@ -41,6 +40,9 @@ struct user + char u_comm[32]; /* user command name */ + }; + ++#define PAGE_SHIFT 13 ++#define PAGE_SIZE (1 << PAGE_SHIFT) ++#define PAGE_MASK (~(PAGE_SIZE-1)) + #define NBPG PAGE_SIZE + #define UPAGES 1 + #define HOST_TEXT_START_ADDR (u.start_code) diff --git a/patches/glibc/2.3.6/280-alpha-asm_elf.patch b/patches/glibc/2.3.6/280-alpha-asm_elf.patch new file mode 100644 index 0000000..3da5c8e --- /dev/null +++ b/patches/glibc/2.3.6/280-alpha-asm_elf.patch @@ -0,0 +1,194 @@ +since the kernel no longer provides asm/elf.h, the sys/procfs.h from the +common code, alpha, and sh fail when used. this should things up. +-mike + +2008-06-07 Mike Frysinger + + * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. + * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h + definitions from the kernel header to sys/procfs.h and remove the + #include of asm/elf.h. + * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. + +*Attachment: signature.asc * +/Description:/ This is a digitally signed message part. + +2008-06-07 Mike Frysinger + + * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. + * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h + definitions from the kernel header to sys/procfs.h and remove the + #include of asm/elf.h. + * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. + +--- a/sysdeps/unix/sysv/linux/alpha/sys/procfs.h ++++ b/sysdeps/unix/sysv/linux/alpha/sys/procfs.h +@@ -29,10 +29,23 @@ + #include + #include + #include +-#include + + __BEGIN_DECLS + ++/* ++ * The OSF/1 version of makes gregset_t 46 entries long. ++ * I have no idea why that is so. For now, we just leave it at 33 ++ * (32 general regs + processor status word). ++ */ ++#define ELF_NGREG 33 ++#define ELF_NFPREG 32 ++ ++typedef unsigned long elf_greg_t; ++typedef elf_greg_t elf_gregset_t[ELF_NGREG]; ++ ++typedef double elf_fpreg_t; ++typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; ++ + struct elf_siginfo + { + int si_signo; /* Signal number. */ +--- a/sysdeps/unix/sysv/linux/sh/sys/procfs.h ++++ b/sysdeps/unix/sysv/linux/sh/sys/procfs.h +@@ -29,10 +29,19 @@ + #include + #include + #include +-#include + + __BEGIN_DECLS + ++/* ++ * ELF register definitions... ++ */ ++typedef unsigned long elf_greg_t; ++ ++#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) ++typedef elf_greg_t elf_gregset_t[ELF_NGREG]; ++ ++typedef struct user_fpu_struct elf_fpregset_t; ++ + struct elf_siginfo + { + int si_signo; /* Signal number. */ +--- a/sysdeps/unix/sysv/linux/sys/procfs.h ++++ b/sysdeps/unix/sysv/linux/sys/procfs.h +@@ -1,115 +1,2 @@ +-/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- +- The GNU C Library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- The GNU C 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 +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with the GNU C Library; if not, write to the Free +- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +- 02111-1307 USA. */ +- +-#ifndef _SYS_PROCFS_H +-#define _SYS_PROCFS_H 1 +- +-/* This is somehow modelled after the file of the same name on SysVr4 +- systems. It provides a definition of the core file format for ELF +- used on Linux. */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-__BEGIN_DECLS +- +-struct elf_siginfo +- { +- int si_signo; /* Signal number. */ +- int si_code; /* Extra code. */ +- int si_errno; /* Errno. */ +- }; +- +-/* Definitions to generate Intel SVR4-like core files. These mostly +- have the same names as the SVR4 types with "elf_" tacked on the +- front to prevent clashes with linux definitions, and the typedef +- forms have been avoided. This is mostly like the SVR4 structure, +- but more Linuxy, with things that Linux does not support and which +- gdb doesn't really use excluded. Fields present but not used are +- marked with "XXX". */ +-struct elf_prstatus +- { +-#if 0 +- long int pr_flags; /* XXX Process flags. */ +- short int pr_why; /* XXX Reason for process halt. */ +- short int pr_what; /* XXX More detailed reason. */ +-#endif +- struct elf_siginfo pr_info; /* Info associated with signal. */ +- short int pr_cursig; /* Current signal. */ +- unsigned long int pr_sigpend; /* Set of pending signals. */ +- unsigned long int pr_sighold; /* Set of held signals. */ +-#if 0 +- struct sigaltstack pr_altstack; /* Alternate stack info. */ +- struct sigaction pr_action; /* Signal action for current sig. */ +-#endif +- __pid_t pr_pid; +- __pid_t pr_ppid; +- __pid_t pr_pgrp; +- __pid_t pr_sid; +- struct timeval pr_utime; /* User time. */ +- struct timeval pr_stime; /* System time. */ +- struct timeval pr_cutime; /* Cumulative user time. */ +- struct timeval pr_cstime; /* Cumulative system time. */ +-#if 0 +- long int pr_instr; /* Current instruction. */ +-#endif +- elf_gregset_t pr_reg; /* GP registers. */ +- int pr_fpvalid; /* True if math copro being used. */ +- }; +- +- +-#define ELF_PRARGSZ (80) /* Number of chars for args */ +- +-struct elf_prpsinfo +- { +- char pr_state; /* Numeric process state. */ +- char pr_sname; /* Char for pr_state. */ +- char pr_zomb; /* Zombie. */ +- char pr_nice; /* Nice val. */ +- unsigned long int pr_flag; /* Flags. */ +- unsigned short int pr_uid; +- unsigned short int pr_gid; +- int pr_pid, pr_ppid, pr_pgrp, pr_sid; +- /* Lots missing */ +- char pr_fname[16]; /* Filename of executable. */ +- char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ +- }; +- +-/* Addresses. */ +-typedef void *psaddr_t; +- +-/* Register sets. Linux has different names. */ +-typedef gregset_t prgregset_t; +-typedef fpregset_t prfpregset_t; +- +-/* We don't have any differences between processes and threads, +- therefore habe only ine PID type. */ +-typedef __pid_t lwpid_t; +- +- +-typedef struct elf_prstatus prstatus_t; +-typedef struct elf_prpsinfo prpsinfo_t; +- +-__END_DECLS +- +-#endif /* sys/procfs.h */ ++/* sys/procfs.h is architecture specific. */ ++#error "This file must be supplied by every Linux architecture." + diff --git a/patches/glibc/2.5.1/100-cygwin.patch b/patches/glibc/2.5.1/100-cygwin.patch new file mode 100644 index 0000000..3c0cd7d --- /dev/null +++ b/patches/glibc/2.5.1/100-cygwin.patch @@ -0,0 +1,187 @@ +Fixes +elf/librtld.os: In function `process_envvars': : undefined reference to `__access' +... +when building glibc-2.3.x on cygwin + +Idea from +http://sources.redhat.com/ml/bug-glibc/2002-01/msg00071/glibc-2.2-cygin-shared.patch +Basically, make glibc use .oST as suffix for 'object static' +instead of .oS, since cygwin has trouble distinguishing .os from .oS +(Original patch had .on, but .oST is more mnemonic for 'object static') + +glibc-linuxthreads-2.3.5 also requires a patch, see +../glibc-linuxthreads-2.3.5/glibc-linuxthreads-2.3.5-cygwin.patch + +[ forward ported to glibc-2.3.5 by Petr Cvachoucek: + +Message-ID: <4282FCBA.3040000@unicontrols.cz> +Date: Thu, 12 May 2005 08:50:34 +0200 +From: Petr Cvachoucek +To: Dan Kegel +CC: crossgcc@sources.redhat.com +Subject: Patches to build gcc 3.4.3 / glibc 2.3.5 on cygwin + +Hi Dan, +following patches are needed to build gcc-3.4.3/glibc-2.3.5 toolchain +on cygwin. Tested to build toolchains for powerpc 604 and 750 targets. + +-- + Petr Cvachoucek + Unicontrols a.s. + http://www.unicontrols.cz +] + +diff -aur glibc-2.3.5/Makeconfig glibc-2.3.5-cygwin/Makeconfig +--- glibc-2.3.5/Makeconfig 2005-02-16 11:50:19.000000000 +0100 ++++ glibc-2.3.5-cygwin/Makeconfig 2005-05-11 08:24:51.046875000 +0200 +@@ -472,7 +472,7 @@ + # run the linked programs. + link-libc = -Wl,-rpath-link=$(rpath-link) \ + $(common-objpfx)libc.so$(libc.so-version) \ +- $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib) ++ $(common-objpfx)$(patsubst %,$(libtype.oST),c) $(gnulib) + # This is how to find at build-time things that will be installed there. + rpath-dirs = math elf dlfcn nss nis rt resolv crypt + endif +@@ -693,7 +693,7 @@ + # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX}) + # to pass different flags for each flavor. + libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o)) +-all-object-suffixes := .o .os .op .og .ob .oS ++all-object-suffixes := .o .os .op .og .ob .oST + object-suffixes := + CPPFLAGS-.o = $(pic-default) + CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) +@@ -749,14 +749,14 @@ + + ifeq (yes,$(build-shared)) + # Build special library that contains the static-only routines for libc. +-object-suffixes-for-libc += .oS ++object-suffixes-for-libc += .oST + + # Must build the routines as PIC, though, because they can end up in (users') + # shared objects. We don't want to use CFLAGS-os because users may, for + # example, make that processor-specific. +-CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag) +-CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 +-libtype.oS = lib%_nonshared.a ++CFLAGS-.oST = $(CFLAGS-.o) $(PIC-ccflag) ++CPPFLAGS-.oST = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 ++libtype.oST = lib%_nonshared.a + endif + + # The assembler can generate debug information too. +diff -aur glibc-2.3.5/Makerules glibc-2.3.5-cygwin/Makerules +--- glibc-2.3.5/Makerules 2004-12-15 19:52:39.000000000 +0100 ++++ glibc-2.3.5-cygwin/Makerules 2005-05-11 08:25:33.578125000 +0200 +@@ -417,7 +417,7 @@ + # Bounded pointer thunks are only built for *.ob + elide-bp-thunks = $(addprefix $(bppfx),$(bp-thunks)) + +-elide-routines.oS += $(filter-out $(static-only-routines),\ ++elide-routines.oST += $(filter-out $(static-only-routines),\ + $(routines) $(aux) $(sysdep_routines)) \ + $(elide-bp-thunks) + elide-routines.os += $(static-only-routines) $(elide-bp-thunks) +@@ -981,7 +981,7 @@ + install: $(inst_libdir)/libc.so + $(inst_libdir)/libc.so: $(common-objpfx)format.lds \ + $(common-objpfx)libc.so$(libc.so-version) \ +- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ ++ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ + $(libprefix)$(libc-name)) \ + $(+force) + (echo '/* GNU ld script';\ +@@ -989,7 +989,7 @@ + echo ' the static library, so try that secondarily. */';\ + cat $<; \ + echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \ +- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\ ++ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)$(libc-name))'\ + ' AS_NEEDED (' $(slibdir)/$(rtld-installed-name) ') )' \ + ) > $@.new + mv -f $@.new $@ +diff -aur glibc-2.3.5/extra-lib.mk glibc-2.3.5-cygwin/extra-lib.mk +--- glibc-2.3.5/extra-lib.mk 2004-12-02 23:54:47.000000000 +0100 ++++ glibc-2.3.5-cygwin/extra-lib.mk 2005-05-11 08:27:28.156250000 +0200 +@@ -13,7 +13,7 @@ + + ifneq (,$($(lib)-static-only-routines)) + ifneq (,$(filter yesyes%,$(build-shared)$(elf)$($(lib).so-version))) +-object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oS) ++object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oST) + endif + endif + +@@ -29,7 +29,7 @@ + + # Add each flavor of library to the lists of things to build and install. + install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o))) +-extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\ ++extra-objs += $(foreach o,$(filter-out .os .oST,$(object-suffixes-$(lib))),\ + $(patsubst %,%$o,$(filter-out \ + $($(lib)-shared-only-routines),\ + $(all-$(lib)-routines)))) +@@ -57,7 +57,7 @@ + + + # Use o-iterator.mk to generate a rule for each flavor of library. +-ifneq (,$(filter-out .os .oS,$(object-suffixes-$(lib)))) ++ifneq (,$(filter-out .os .oST,$(object-suffixes-$(lib)))) + define o-iterator-doit + $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \ + $(patsubst %,$(objpfx)%$o,\ +@@ -65,7 +65,7 @@ + $(all-$(lib)-routines))); \ + $$(build-extra-lib) + endef +-object-suffixes-left = $(filter-out .os .oS,$(object-suffixes-$(lib))) ++object-suffixes-left = $(filter-out .os .oST,$(object-suffixes-$(lib))) + include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left)) + endif + +@@ -77,9 +77,9 @@ + $(build-extra-lib) + endif + +-ifneq (,$(filter .oS,$(object-suffixes-$(lib)))) +-$(objpfx)$(patsubst %,$(libtype.oS),$(lib:lib%=%)): \ +- $(patsubst %,$(objpfx)%.oS,\ ++ifneq (,$(filter .oST,$(object-suffixes-$(lib)))) ++$(objpfx)$(patsubst %,$(libtype.oST),$(lib:lib%=%)): \ ++ $(patsubst %,$(objpfx)%.oST,\ + $(filter $($(lib)-static-only-routines),\ + $(all-$(lib)-routines))) + $(build-extra-lib) +diff -aur glibc-2.3.5/nptl/Makefile glibc-2.3.5-cygwin/nptl/Makefile +--- glibc-2.3.5/nptl/Makefile 2005-02-16 09:45:56.000000000 +0100 ++++ glibc-2.3.5-cygwin/nptl/Makefile 2005-05-11 08:26:01.812500000 +0200 +@@ -375,7 +375,7 @@ + + $(inst_libdir)/libpthread.so: $(common-objpfx)format.lds \ + $(objpfx)libpthread.so$(libpthread.so-version) \ +- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ ++ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ + $(libprefix)pthread) \ + $(+force) + (echo '/* GNU ld script';\ +@@ -383,7 +383,7 @@ + echo ' the static library, so try that secondarily. */';\ + cat $<; \ + echo 'GROUP ( $(slibdir)/libpthread.so$(libpthread.so-version)' \ +- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)pthread)'\ ++ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)pthread)'\ + ')' \ + ) > $@.new + mv -f $@.new $@ +diff -aur glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile +--- glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile 2004-08-16 08:46:14.000000000 +0200 ++++ glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile 2005-05-11 08:26:25.937500000 +0200 +@@ -10,4 +10,4 @@ + ASFLAGS-.op += -Wa,-Av9a + ASFLAGS-.og += -Wa,-Av9a + ASFLAGS-.ob += -Wa,-Av9a +-ASFLAGS-.oS += -Wa,-Av9a ++ASFLAGS-.oST += -Wa,-Av9a + +Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.5.1/110-configure-apple-as.patch b/patches/glibc/2.5.1/110-configure-apple-as.patch new file mode 100644 index 0000000..78a1324 --- /dev/null +++ b/patches/glibc/2.5.1/110-configure-apple-as.patch @@ -0,0 +1,25 @@ +http://in3www.epfl.ch/~schaffne/glibc-configure-apple-as.patch +http://sources.redhat.com/ml/crossgcc/2004-02/msg00151.html + +The following makes it possible to configure glibc-2.3.2 on Mac OS X, +where the assembler but doesn't understand the --version flag. + +Fixes the symptom +checking whether ld is GNU ld... no +checking for /usr/libexec/gcc/darwin/ppc/as... /usr/libexec/gcc/darwin/ppc/as +checking version of /usr/libexec/gcc/darwin/ppc/as... + + +--- glibc-2.3.2/configure~ Wed Feb 26 09:20:48 2003 ++++ glibc-2.3.2/configure Fri Feb 27 13:12:53 2004 +@@ -4039,7 +4039,7 @@ + # Found it, now check the version. + echo "$as_me:$LINENO: checking version of $AS" >&5 + echo $ECHO_N "checking version of $AS... $ECHO_C" >&6 +- ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` ++ ac_prog_version=`$AS -v &1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 2.1[3-9]*) + +Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.5.1/120-cygwin.patch b/patches/glibc/2.5.1/120-cygwin.patch deleted file mode 100644 index 3c0cd7d..0000000 --- a/patches/glibc/2.5.1/120-cygwin.patch +++ /dev/null @@ -1,187 +0,0 @@ -Fixes -elf/librtld.os: In function `process_envvars': : undefined reference to `__access' -... -when building glibc-2.3.x on cygwin - -Idea from -http://sources.redhat.com/ml/bug-glibc/2002-01/msg00071/glibc-2.2-cygin-shared.patch -Basically, make glibc use .oST as suffix for 'object static' -instead of .oS, since cygwin has trouble distinguishing .os from .oS -(Original patch had .on, but .oST is more mnemonic for 'object static') - -glibc-linuxthreads-2.3.5 also requires a patch, see -../glibc-linuxthreads-2.3.5/glibc-linuxthreads-2.3.5-cygwin.patch - -[ forward ported to glibc-2.3.5 by Petr Cvachoucek: - -Message-ID: <4282FCBA.3040000@unicontrols.cz> -Date: Thu, 12 May 2005 08:50:34 +0200 -From: Petr Cvachoucek -To: Dan Kegel -CC: crossgcc@sources.redhat.com -Subject: Patches to build gcc 3.4.3 / glibc 2.3.5 on cygwin - -Hi Dan, -following patches are needed to build gcc-3.4.3/glibc-2.3.5 toolchain -on cygwin. Tested to build toolchains for powerpc 604 and 750 targets. - --- - Petr Cvachoucek - Unicontrols a.s. - http://www.unicontrols.cz -] - -diff -aur glibc-2.3.5/Makeconfig glibc-2.3.5-cygwin/Makeconfig ---- glibc-2.3.5/Makeconfig 2005-02-16 11:50:19.000000000 +0100 -+++ glibc-2.3.5-cygwin/Makeconfig 2005-05-11 08:24:51.046875000 +0200 -@@ -472,7 +472,7 @@ - # run the linked programs. - link-libc = -Wl,-rpath-link=$(rpath-link) \ - $(common-objpfx)libc.so$(libc.so-version) \ -- $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib) -+ $(common-objpfx)$(patsubst %,$(libtype.oST),c) $(gnulib) - # This is how to find at build-time things that will be installed there. - rpath-dirs = math elf dlfcn nss nis rt resolv crypt - endif -@@ -693,7 +693,7 @@ - # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX}) - # to pass different flags for each flavor. - libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o)) --all-object-suffixes := .o .os .op .og .ob .oS -+all-object-suffixes := .o .os .op .og .ob .oST - object-suffixes := - CPPFLAGS-.o = $(pic-default) - CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) -@@ -749,14 +749,14 @@ - - ifeq (yes,$(build-shared)) - # Build special library that contains the static-only routines for libc. --object-suffixes-for-libc += .oS -+object-suffixes-for-libc += .oST - - # Must build the routines as PIC, though, because they can end up in (users') - # shared objects. We don't want to use CFLAGS-os because users may, for - # example, make that processor-specific. --CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag) --CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 --libtype.oS = lib%_nonshared.a -+CFLAGS-.oST = $(CFLAGS-.o) $(PIC-ccflag) -+CPPFLAGS-.oST = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 -+libtype.oST = lib%_nonshared.a - endif - - # The assembler can generate debug information too. -diff -aur glibc-2.3.5/Makerules glibc-2.3.5-cygwin/Makerules ---- glibc-2.3.5/Makerules 2004-12-15 19:52:39.000000000 +0100 -+++ glibc-2.3.5-cygwin/Makerules 2005-05-11 08:25:33.578125000 +0200 -@@ -417,7 +417,7 @@ - # Bounded pointer thunks are only built for *.ob - elide-bp-thunks = $(addprefix $(bppfx),$(bp-thunks)) - --elide-routines.oS += $(filter-out $(static-only-routines),\ -+elide-routines.oST += $(filter-out $(static-only-routines),\ - $(routines) $(aux) $(sysdep_routines)) \ - $(elide-bp-thunks) - elide-routines.os += $(static-only-routines) $(elide-bp-thunks) -@@ -981,7 +981,7 @@ - install: $(inst_libdir)/libc.so - $(inst_libdir)/libc.so: $(common-objpfx)format.lds \ - $(common-objpfx)libc.so$(libc.so-version) \ -- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ -+ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ - $(libprefix)$(libc-name)) \ - $(+force) - (echo '/* GNU ld script';\ -@@ -989,7 +989,7 @@ - echo ' the static library, so try that secondarily. */';\ - cat $<; \ - echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \ -- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\ -+ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)$(libc-name))'\ - ' AS_NEEDED (' $(slibdir)/$(rtld-installed-name) ') )' \ - ) > $@.new - mv -f $@.new $@ -diff -aur glibc-2.3.5/extra-lib.mk glibc-2.3.5-cygwin/extra-lib.mk ---- glibc-2.3.5/extra-lib.mk 2004-12-02 23:54:47.000000000 +0100 -+++ glibc-2.3.5-cygwin/extra-lib.mk 2005-05-11 08:27:28.156250000 +0200 -@@ -13,7 +13,7 @@ - - ifneq (,$($(lib)-static-only-routines)) - ifneq (,$(filter yesyes%,$(build-shared)$(elf)$($(lib).so-version))) --object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oS) -+object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oST) - endif - endif - -@@ -29,7 +29,7 @@ - - # Add each flavor of library to the lists of things to build and install. - install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o))) --extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\ -+extra-objs += $(foreach o,$(filter-out .os .oST,$(object-suffixes-$(lib))),\ - $(patsubst %,%$o,$(filter-out \ - $($(lib)-shared-only-routines),\ - $(all-$(lib)-routines)))) -@@ -57,7 +57,7 @@ - - - # Use o-iterator.mk to generate a rule for each flavor of library. --ifneq (,$(filter-out .os .oS,$(object-suffixes-$(lib)))) -+ifneq (,$(filter-out .os .oST,$(object-suffixes-$(lib)))) - define o-iterator-doit - $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \ - $(patsubst %,$(objpfx)%$o,\ -@@ -65,7 +65,7 @@ - $(all-$(lib)-routines))); \ - $$(build-extra-lib) - endef --object-suffixes-left = $(filter-out .os .oS,$(object-suffixes-$(lib))) -+object-suffixes-left = $(filter-out .os .oST,$(object-suffixes-$(lib))) - include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left)) - endif - -@@ -77,9 +77,9 @@ - $(build-extra-lib) - endif - --ifneq (,$(filter .oS,$(object-suffixes-$(lib)))) --$(objpfx)$(patsubst %,$(libtype.oS),$(lib:lib%=%)): \ -- $(patsubst %,$(objpfx)%.oS,\ -+ifneq (,$(filter .oST,$(object-suffixes-$(lib)))) -+$(objpfx)$(patsubst %,$(libtype.oST),$(lib:lib%=%)): \ -+ $(patsubst %,$(objpfx)%.oST,\ - $(filter $($(lib)-static-only-routines),\ - $(all-$(lib)-routines))) - $(build-extra-lib) -diff -aur glibc-2.3.5/nptl/Makefile glibc-2.3.5-cygwin/nptl/Makefile ---- glibc-2.3.5/nptl/Makefile 2005-02-16 09:45:56.000000000 +0100 -+++ glibc-2.3.5-cygwin/nptl/Makefile 2005-05-11 08:26:01.812500000 +0200 -@@ -375,7 +375,7 @@ - - $(inst_libdir)/libpthread.so: $(common-objpfx)format.lds \ - $(objpfx)libpthread.so$(libpthread.so-version) \ -- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ -+ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ - $(libprefix)pthread) \ - $(+force) - (echo '/* GNU ld script';\ -@@ -383,7 +383,7 @@ - echo ' the static library, so try that secondarily. */';\ - cat $<; \ - echo 'GROUP ( $(slibdir)/libpthread.so$(libpthread.so-version)' \ -- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)pthread)'\ -+ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)pthread)'\ - ')' \ - ) > $@.new - mv -f $@.new $@ -diff -aur glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile ---- glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile 2004-08-16 08:46:14.000000000 +0200 -+++ glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile 2005-05-11 08:26:25.937500000 +0200 -@@ -10,4 +10,4 @@ - ASFLAGS-.op += -Wa,-Av9a - ASFLAGS-.og += -Wa,-Av9a - ASFLAGS-.ob += -Wa,-Av9a --ASFLAGS-.oS += -Wa,-Av9a -+ASFLAGS-.oST += -Wa,-Av9a - -Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.5.1/120-fix-pr631.patch b/patches/glibc/2.5.1/120-fix-pr631.patch new file mode 100644 index 0000000..13688df --- /dev/null +++ b/patches/glibc/2.5.1/120-fix-pr631.patch @@ -0,0 +1,45 @@ +From dank@kegel.com +Wed Jun 15 09:12:43 PDT 2005 + +Fixes + +build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r' +build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent' +... 53 lines deleted ... +build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r' +collect2: ld returned 1 exit status +make[2]: *** [/build/gcc-3.4.3-glibc-2.3.5-hdrs-2.6.11.2/i686-unknown-linux-gnu/build-glibc/elf/ldconfig] Error 1 + +when building glibc with --enable-static-nss. + +See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631 + +--- glibc-2.3.5/Makeconfig.old Wed Jun 15 08:13:12 2005 ++++ glibc-2.3.5/Makeconfig Wed Jun 15 08:13:14 2005 +@@ -510,7 +510,7 @@ + + # The static libraries. + ifeq (yes,$(build-static)) +-link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a ++link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a + else + ifeq (yes,$(build-shared)) + # We can try to link the programs with lib*_pic.a... +--- glibc-2.3.5/elf/Makefile.old Wed Jun 15 07:46:49 2005 ++++ glibc-2.3.5/elf/Makefile Wed Jun 15 08:14:00 2005 +@@ -120,6 +120,13 @@ + install-bin-script = ldd + endif + ++ifeq (yes,$(build-static-nss)) ++nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) ++resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv) ++otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ ++ $(resolvobjdir)/libresolv.a ++endif ++ + others = sprof sln + install-bin = sprof + others-static = sln + +Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.5.1/130-i686-assembler.patch b/patches/glibc/2.5.1/130-i686-assembler.patch new file mode 100644 index 0000000..9904efb --- /dev/null +++ b/patches/glibc/2.5.1/130-i686-assembler.patch @@ -0,0 +1,38 @@ +2007-02-15 Khem Raj + + * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686. + * nptl/sysdeps/pthread/pt-initfini.c: Ditto. + + + +Index: glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h +=================================================================== +--- glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (revision 1469) ++++ glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (working copy) +@@ -29,6 +29,10 @@ + #include + #include + ++#if defined __i686 && defined __ASSEMBLER__ ++#undef __i686 ++#define __i686 __i686 ++#endif + + /* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h +Index: glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c +=================================================================== +--- glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (revision 1469) ++++ glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (working copy) +@@ -45,6 +45,11 @@ + /* Embed an #include to pull in the alignment and .end directives. */ + asm ("\n#include \"defs.h\""); + ++asm ("\n#if defined __i686 && defined __ASSEMBLER__"); ++asm ("\n#undef __i686"); ++asm ("\n#define __i686 __i686"); ++asm ("\n#endif"); ++ + /* The initial common code ends here. */ + asm ("\n/*@HEADER_ENDS*/"); + diff --git a/patches/glibc/2.5.1/140-configure-apple-as.patch b/patches/glibc/2.5.1/140-configure-apple-as.patch deleted file mode 100644 index 78a1324..0000000 --- a/patches/glibc/2.5.1/140-configure-apple-as.patch +++ /dev/null @@ -1,25 +0,0 @@ -http://in3www.epfl.ch/~schaffne/glibc-configure-apple-as.patch -http://sources.redhat.com/ml/crossgcc/2004-02/msg00151.html - -The following makes it possible to configure glibc-2.3.2 on Mac OS X, -where the assembler but doesn't understand the --version flag. - -Fixes the symptom -checking whether ld is GNU ld... no -checking for /usr/libexec/gcc/darwin/ppc/as... /usr/libexec/gcc/darwin/ppc/as -checking version of /usr/libexec/gcc/darwin/ppc/as... - - ---- glibc-2.3.2/configure~ Wed Feb 26 09:20:48 2003 -+++ glibc-2.3.2/configure Fri Feb 27 13:12:53 2004 -@@ -4039,7 +4039,7 @@ - # Found it, now check the version. - echo "$as_me:$LINENO: checking version of $AS" >&5 - echo $ECHO_N "checking version of $AS... $ECHO_C" >&6 -- ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` -+ ac_prog_version=`$AS -v &1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` - case $ac_prog_version in - '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 2.1[3-9]*) - -Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.5.1/140-i386-preferred-stack-boundary.patch b/patches/glibc/2.5.1/140-i386-preferred-stack-boundary.patch new file mode 100644 index 0000000..449821d --- /dev/null +++ b/patches/glibc/2.5.1/140-i386-preferred-stack-boundary.patch @@ -0,0 +1,18 @@ +(C) 2007 Yann E. MORIN +License: LGPL v2.1 + +Shut off a stupid warning: preffered-stack-boundary must be between 4 ad 12, +and 2 is not. + +diff -dur glibc-2.5.orig/sysdeps/i386/Makefile glibc-2.5/sysdeps/i386/Makefile +--- glibc-2.5.orig/sysdeps/i386/Makefile 2005-03-06 01:18:16.000000000 +0100 ++++ glibc-2.5/sysdeps/i386/Makefile 2007-05-27 17:49:37.000000000 +0200 +@@ -36,7 +36,7 @@ + ifeq ($(subdir),csu) + sysdep-CFLAGS += -mpreferred-stack-boundary=4 + else +-sysdep-CFLAGS += -mpreferred-stack-boundary=2 ++sysdep-CFLAGS += -mpreferred-stack-boundary=4 + # Likewise, any function which calls user callbacks + uses-callbacks += -mpreferred-stack-boundary=4 + # Likewise, any stack alignment tests diff --git a/patches/glibc/2.5.1/150-alpha-asm_page.patch b/patches/glibc/2.5.1/150-alpha-asm_page.patch new file mode 100644 index 0000000..b198b36 --- /dev/null +++ b/patches/glibc/2.5.1/150-alpha-asm_page.patch @@ -0,0 +1,26 @@ +2008-06-07 Mike Frysinger + + * sysdeps/unix/sysv/linux/alpha/sys/user.h: Copy page.h definitions + from the kernel header to sys/user.h and remove the #include of + sys/user.h. + +--- a/sysdeps/unix/sysv/linux/alpha/sys/user.h ++++ b/sysdeps/unix/sysv/linux/alpha/sys/user.h +@@ -23,7 +23,6 @@ + only. Don't read too much into it. Don't use it for anything other + than gdb/strace unless you know what you are doing. */ + +-#include + #include + + struct user +@@ -41,6 +40,9 @@ struct user + char u_comm[32]; /* user command name */ + }; + ++#define PAGE_SHIFT 13 ++#define PAGE_SIZE (1 << PAGE_SHIFT) ++#define PAGE_MASK (~(PAGE_SIZE-1)) + #define NBPG PAGE_SIZE + #define UPAGES 1 + #define HOST_TEXT_START_ADDR (u.start_code) diff --git a/patches/glibc/2.5.1/150-fix-pr631.patch b/patches/glibc/2.5.1/150-fix-pr631.patch deleted file mode 100644 index 13688df..0000000 --- a/patches/glibc/2.5.1/150-fix-pr631.patch +++ /dev/null @@ -1,45 +0,0 @@ -From dank@kegel.com -Wed Jun 15 09:12:43 PDT 2005 - -Fixes - -build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r' -build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent' -... 53 lines deleted ... -build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r' -collect2: ld returned 1 exit status -make[2]: *** [/build/gcc-3.4.3-glibc-2.3.5-hdrs-2.6.11.2/i686-unknown-linux-gnu/build-glibc/elf/ldconfig] Error 1 - -when building glibc with --enable-static-nss. - -See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631 - ---- glibc-2.3.5/Makeconfig.old Wed Jun 15 08:13:12 2005 -+++ glibc-2.3.5/Makeconfig Wed Jun 15 08:13:14 2005 -@@ -510,7 +510,7 @@ - - # The static libraries. - ifeq (yes,$(build-static)) --link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a -+link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a - else - ifeq (yes,$(build-shared)) - # We can try to link the programs with lib*_pic.a... ---- glibc-2.3.5/elf/Makefile.old Wed Jun 15 07:46:49 2005 -+++ glibc-2.3.5/elf/Makefile Wed Jun 15 08:14:00 2005 -@@ -120,6 +120,13 @@ - install-bin-script = ldd - endif - -+ifeq (yes,$(build-static-nss)) -+nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) -+resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv) -+otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ -+ $(resolvobjdir)/libresolv.a -+endif -+ - others = sprof sln - install-bin = sprof - others-static = sln - -Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.5.1/160-i686-assembler.patch b/patches/glibc/2.5.1/160-i686-assembler.patch deleted file mode 100644 index 9904efb..0000000 --- a/patches/glibc/2.5.1/160-i686-assembler.patch +++ /dev/null @@ -1,38 +0,0 @@ -2007-02-15 Khem Raj - - * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686. - * nptl/sysdeps/pthread/pt-initfini.c: Ditto. - - - -Index: glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h -=================================================================== ---- glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (revision 1469) -+++ glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (working copy) -@@ -29,6 +29,10 @@ - #include - #include - -+#if defined __i686 && defined __ASSEMBLER__ -+#undef __i686 -+#define __i686 __i686 -+#endif - - /* For Linux we can use the system call table in the header file - /usr/include/asm/unistd.h -Index: glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c -=================================================================== ---- glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (revision 1469) -+++ glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (working copy) -@@ -45,6 +45,11 @@ - /* Embed an #include to pull in the alignment and .end directives. */ - asm ("\n#include \"defs.h\""); - -+asm ("\n#if defined __i686 && defined __ASSEMBLER__"); -+asm ("\n#undef __i686"); -+asm ("\n#define __i686 __i686"); -+asm ("\n#endif"); -+ - /* The initial common code ends here. */ - asm ("\n/*@HEADER_ENDS*/"); - diff --git a/patches/glibc/2.5.1/160-use_short_for_fnstsw.patch b/patches/glibc/2.5.1/160-use_short_for_fnstsw.patch new file mode 100644 index 0000000..0e849fa --- /dev/null +++ b/patches/glibc/2.5.1/160-use_short_for_fnstsw.patch @@ -0,0 +1,18 @@ +Original patch from H.J. Lu, as reported there: +http://www.nabble.com/PATCH:-Use-short-for-fnstsw-td14775171.html + +fnstsw stores 16bit into %ax. The upper 16bit of %eax is unchanged. +The new assembler (binutils-2.18.50.0.4 and up) will disallow "fnstsw %eax". + +diff -dur glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c +--- glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c 2004-03-05 11:14:48.000000000 +0100 ++++ glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c 2008-06-24 10:56:14.000000000 +0200 +@@ -26,7 +26,7 @@ + int + fetestexcept (int excepts) + { +- int temp; ++ short temp; + int xtemp = 0; + + /* Get current exceptions. */ diff --git a/patches/glibc/2.5.1/170-alpha-asm_elf.patch b/patches/glibc/2.5.1/170-alpha-asm_elf.patch new file mode 100644 index 0000000..3da5c8e --- /dev/null +++ b/patches/glibc/2.5.1/170-alpha-asm_elf.patch @@ -0,0 +1,194 @@ +since the kernel no longer provides asm/elf.h, the sys/procfs.h from the +common code, alpha, and sh fail when used. this should things up. +-mike + +2008-06-07 Mike Frysinger + + * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. + * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h + definitions from the kernel header to sys/procfs.h and remove the + #include of asm/elf.h. + * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. + +*Attachment: signature.asc * +/Description:/ This is a digitally signed message part. + +2008-06-07 Mike Frysinger + + * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. + * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h + definitions from the kernel header to sys/procfs.h and remove the + #include of asm/elf.h. + * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. + +--- a/sysdeps/unix/sysv/linux/alpha/sys/procfs.h ++++ b/sysdeps/unix/sysv/linux/alpha/sys/procfs.h +@@ -29,10 +29,23 @@ + #include + #include + #include +-#include + + __BEGIN_DECLS + ++/* ++ * The OSF/1 version of makes gregset_t 46 entries long. ++ * I have no idea why that is so. For now, we just leave it at 33 ++ * (32 general regs + processor status word). ++ */ ++#define ELF_NGREG 33 ++#define ELF_NFPREG 32 ++ ++typedef unsigned long elf_greg_t; ++typedef elf_greg_t elf_gregset_t[ELF_NGREG]; ++ ++typedef double elf_fpreg_t; ++typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; ++ + struct elf_siginfo + { + int si_signo; /* Signal number. */ +--- a/sysdeps/unix/sysv/linux/sh/sys/procfs.h ++++ b/sysdeps/unix/sysv/linux/sh/sys/procfs.h +@@ -29,10 +29,19 @@ + #include + #include + #include +-#include + + __BEGIN_DECLS + ++/* ++ * ELF register definitions... ++ */ ++typedef unsigned long elf_greg_t; ++ ++#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) ++typedef elf_greg_t elf_gregset_t[ELF_NGREG]; ++ ++typedef struct user_fpu_struct elf_fpregset_t; ++ + struct elf_siginfo + { + int si_signo; /* Signal number. */ +--- a/sysdeps/unix/sysv/linux/sys/procfs.h ++++ b/sysdeps/unix/sysv/linux/sys/procfs.h +@@ -1,115 +1,2 @@ +-/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- +- The GNU C Library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- The GNU C 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 +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with the GNU C Library; if not, write to the Free +- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +- 02111-1307 USA. */ +- +-#ifndef _SYS_PROCFS_H +-#define _SYS_PROCFS_H 1 +- +-/* This is somehow modelled after the file of the same name on SysVr4 +- systems. It provides a definition of the core file format for ELF +- used on Linux. */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-__BEGIN_DECLS +- +-struct elf_siginfo +- { +- int si_signo; /* Signal number. */ +- int si_code; /* Extra code. */ +- int si_errno; /* Errno. */ +- }; +- +-/* Definitions to generate Intel SVR4-like core files. These mostly +- have the same names as the SVR4 types with "elf_" tacked on the +- front to prevent clashes with linux definitions, and the typedef +- forms have been avoided. This is mostly like the SVR4 structure, +- but more Linuxy, with things that Linux does not support and which +- gdb doesn't really use excluded. Fields present but not used are +- marked with "XXX". */ +-struct elf_prstatus +- { +-#if 0 +- long int pr_flags; /* XXX Process flags. */ +- short int pr_why; /* XXX Reason for process halt. */ +- short int pr_what; /* XXX More detailed reason. */ +-#endif +- struct elf_siginfo pr_info; /* Info associated with signal. */ +- short int pr_cursig; /* Current signal. */ +- unsigned long int pr_sigpend; /* Set of pending signals. */ +- unsigned long int pr_sighold; /* Set of held signals. */ +-#if 0 +- struct sigaltstack pr_altstack; /* Alternate stack info. */ +- struct sigaction pr_action; /* Signal action for current sig. */ +-#endif +- __pid_t pr_pid; +- __pid_t pr_ppid; +- __pid_t pr_pgrp; +- __pid_t pr_sid; +- struct timeval pr_utime; /* User time. */ +- struct timeval pr_stime; /* System time. */ +- struct timeval pr_cutime; /* Cumulative user time. */ +- struct timeval pr_cstime; /* Cumulative system time. */ +-#if 0 +- long int pr_instr; /* Current instruction. */ +-#endif +- elf_gregset_t pr_reg; /* GP registers. */ +- int pr_fpvalid; /* True if math copro being used. */ +- }; +- +- +-#define ELF_PRARGSZ (80) /* Number of chars for args */ +- +-struct elf_prpsinfo +- { +- char pr_state; /* Numeric process state. */ +- char pr_sname; /* Char for pr_state. */ +- char pr_zomb; /* Zombie. */ +- char pr_nice; /* Nice val. */ +- unsigned long int pr_flag; /* Flags. */ +- unsigned short int pr_uid; +- unsigned short int pr_gid; +- int pr_pid, pr_ppid, pr_pgrp, pr_sid; +- /* Lots missing */ +- char pr_fname[16]; /* Filename of executable. */ +- char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ +- }; +- +-/* Addresses. */ +-typedef void *psaddr_t; +- +-/* Register sets. Linux has different names. */ +-typedef gregset_t prgregset_t; +-typedef fpregset_t prfpregset_t; +- +-/* We don't have any differences between processes and threads, +- therefore habe only ine PID type. */ +-typedef __pid_t lwpid_t; +- +- +-typedef struct elf_prstatus prstatus_t; +-typedef struct elf_prpsinfo prpsinfo_t; +- +-__END_DECLS +- +-#endif /* sys/procfs.h */ ++/* sys/procfs.h is architecture specific. */ ++#error "This file must be supplied by every Linux architecture." + diff --git a/patches/glibc/2.5.1/170-i386-preferred-stack-boundary.patch b/patches/glibc/2.5.1/170-i386-preferred-stack-boundary.patch deleted file mode 100644 index 449821d..0000000 --- a/patches/glibc/2.5.1/170-i386-preferred-stack-boundary.patch +++ /dev/null @@ -1,18 +0,0 @@ -(C) 2007 Yann E. MORIN -License: LGPL v2.1 - -Shut off a stupid warning: preffered-stack-boundary must be between 4 ad 12, -and 2 is not. - -diff -dur glibc-2.5.orig/sysdeps/i386/Makefile glibc-2.5/sysdeps/i386/Makefile ---- glibc-2.5.orig/sysdeps/i386/Makefile 2005-03-06 01:18:16.000000000 +0100 -+++ glibc-2.5/sysdeps/i386/Makefile 2007-05-27 17:49:37.000000000 +0200 -@@ -36,7 +36,7 @@ - ifeq ($(subdir),csu) - sysdep-CFLAGS += -mpreferred-stack-boundary=4 - else --sysdep-CFLAGS += -mpreferred-stack-boundary=2 -+sysdep-CFLAGS += -mpreferred-stack-boundary=4 - # Likewise, any function which calls user callbacks - uses-callbacks += -mpreferred-stack-boundary=4 - # Likewise, any stack alignment tests diff --git a/patches/glibc/2.5.1/180-alpha-asm_page.patch b/patches/glibc/2.5.1/180-alpha-asm_page.patch deleted file mode 100644 index b198b36..0000000 --- a/patches/glibc/2.5.1/180-alpha-asm_page.patch +++ /dev/null @@ -1,26 +0,0 @@ -2008-06-07 Mike Frysinger - - * sysdeps/unix/sysv/linux/alpha/sys/user.h: Copy page.h definitions - from the kernel header to sys/user.h and remove the #include of - sys/user.h. - ---- a/sysdeps/unix/sysv/linux/alpha/sys/user.h -+++ b/sysdeps/unix/sysv/linux/alpha/sys/user.h -@@ -23,7 +23,6 @@ - only. Don't read too much into it. Don't use it for anything other - than gdb/strace unless you know what you are doing. */ - --#include - #include - - struct user -@@ -41,6 +40,9 @@ struct user - char u_comm[32]; /* user command name */ - }; - -+#define PAGE_SHIFT 13 -+#define PAGE_SIZE (1 << PAGE_SHIFT) -+#define PAGE_MASK (~(PAGE_SIZE-1)) - #define NBPG PAGE_SIZE - #define UPAGES 1 - #define HOST_TEXT_START_ADDR (u.start_code) diff --git a/patches/glibc/2.5.1/180-alpha-cfi.patch b/patches/glibc/2.5.1/180-alpha-cfi.patch new file mode 100644 index 0000000..c1efd77 --- /dev/null +++ b/patches/glibc/2.5.1/180-alpha-cfi.patch @@ -0,0 +1,25 @@ +--- libc/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h 2006/10/29 21:48:06 1.6 ++++ libc/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h 2007/03/13 21:28:03 1.7 +@@ -55,6 +55,7 @@ + bne a3, SYSCALL_ERROR_LABEL; \ + __LABEL($pseudo_ret) \ + .subsection 2; \ ++ cfi_startproc; \ + __LABEL($pseudo_cancel) \ + subq sp, 64, sp; \ + cfi_def_cfa_offset(64); \ +@@ -90,12 +91,13 @@ + cfi_def_cfa_offset(0); \ + __LABEL($syscall_error) \ + SYSCALL_ERROR_HANDLER; \ ++ cfi_endproc; \ + .previous + + # undef PSEUDO_END + # define PSEUDO_END(sym) \ +- .subsection 2; \ + cfi_endproc; \ ++ .subsection 2; \ + .size sym, .-sym + + # define SAVE_ARGS_0 /* Nothing. */ diff --git a/patches/glibc/2.5.1/190-alpha-sigsuspend.patch b/patches/glibc/2.5.1/190-alpha-sigsuspend.patch new file mode 100644 index 0000000..daf1a5d --- /dev/null +++ b/patches/glibc/2.5.1/190-alpha-sigsuspend.patch @@ -0,0 +1,24 @@ +--- glibc-2.5/sysdeps/unix/sysv/linux/alpha/sigsuspend.S.orig 2006-10-22 22:17:01.000000000 +0200 ++++ glibc-2.5/sysdeps/unix/sysv/linux/alpha/sigsuspend.S 2006-10-22 22:18:05.000000000 +0200 +@@ -31,3 +31,21 @@ + libc_hidden_def (__sigsuspend) + weak_alias (__sigsuspend, sigsuspend) + strong_alias (__sigsuspend, __libc_sigsuspend) ++ ++#ifndef NO_CANCELLATION ++ .globl __sigsuspend_nocancel; ++ .align 4; ++ .type __sigsuspend_nocancel, @function; ++ .usepv __sigsuspend_nocancel, std; ++ cfi_startproc; ++__LABEL(__sigsuspend_nocancel) ++ ldgp gp, 0(pv); ++ PSEUDO_PROF; ++ PSEUDO_PREPARE_ARGS ++ lda v0, SYS_ify(sigsuspend); ++ call_pal PAL_callsys; ++ bne a3, SYSCALL_ERROR_LABEL; ++ ret; ++ cfi_endproc; ++ .size __sigsuspend_nocancel, .-__sigsuspend_nocancel ++#endif diff --git a/patches/glibc/2.5.1/190-use_short_for_fnstsw.patch b/patches/glibc/2.5.1/190-use_short_for_fnstsw.patch deleted file mode 100644 index 0e849fa..0000000 --- a/patches/glibc/2.5.1/190-use_short_for_fnstsw.patch +++ /dev/null @@ -1,18 +0,0 @@ -Original patch from H.J. Lu, as reported there: -http://www.nabble.com/PATCH:-Use-short-for-fnstsw-td14775171.html - -fnstsw stores 16bit into %ax. The upper 16bit of %eax is unchanged. -The new assembler (binutils-2.18.50.0.4 and up) will disallow "fnstsw %eax". - -diff -dur glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c ---- glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c 2004-03-05 11:14:48.000000000 +0100 -+++ glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c 2008-06-24 10:56:14.000000000 +0200 -@@ -26,7 +26,7 @@ - int - fetestexcept (int excepts) - { -- int temp; -+ short temp; - int xtemp = 0; - - /* Get current exceptions. */ diff --git a/patches/glibc/2.5.1/260-alpha-asm_elf.patch b/patches/glibc/2.5.1/260-alpha-asm_elf.patch deleted file mode 100644 index 3da5c8e..0000000 --- a/patches/glibc/2.5.1/260-alpha-asm_elf.patch +++ /dev/null @@ -1,194 +0,0 @@ -since the kernel no longer provides asm/elf.h, the sys/procfs.h from the -common code, alpha, and sh fail when used. this should things up. --mike - -2008-06-07 Mike Frysinger - - * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. - * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h - definitions from the kernel header to sys/procfs.h and remove the - #include of asm/elf.h. - * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. - -*Attachment: signature.asc * -/Description:/ This is a digitally signed message part. - -2008-06-07 Mike Frysinger - - * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. - * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h - definitions from the kernel header to sys/procfs.h and remove the - #include of asm/elf.h. - * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. - ---- a/sysdeps/unix/sysv/linux/alpha/sys/procfs.h -+++ b/sysdeps/unix/sysv/linux/alpha/sys/procfs.h -@@ -29,10 +29,23 @@ - #include - #include - #include --#include - - __BEGIN_DECLS - -+/* -+ * The OSF/1 version of makes gregset_t 46 entries long. -+ * I have no idea why that is so. For now, we just leave it at 33 -+ * (32 general regs + processor status word). -+ */ -+#define ELF_NGREG 33 -+#define ELF_NFPREG 32 -+ -+typedef unsigned long elf_greg_t; -+typedef elf_greg_t elf_gregset_t[ELF_NGREG]; -+ -+typedef double elf_fpreg_t; -+typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; -+ - struct elf_siginfo - { - int si_signo; /* Signal number. */ ---- a/sysdeps/unix/sysv/linux/sh/sys/procfs.h -+++ b/sysdeps/unix/sysv/linux/sh/sys/procfs.h -@@ -29,10 +29,19 @@ - #include - #include - #include --#include - - __BEGIN_DECLS - -+/* -+ * ELF register definitions... -+ */ -+typedef unsigned long elf_greg_t; -+ -+#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) -+typedef elf_greg_t elf_gregset_t[ELF_NGREG]; -+ -+typedef struct user_fpu_struct elf_fpregset_t; -+ - struct elf_siginfo - { - int si_signo; /* Signal number. */ ---- a/sysdeps/unix/sysv/linux/sys/procfs.h -+++ b/sysdeps/unix/sysv/linux/sys/procfs.h -@@ -1,115 +1,2 @@ --/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- -- The GNU C 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 -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, write to the Free -- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -- 02111-1307 USA. */ -- --#ifndef _SYS_PROCFS_H --#define _SYS_PROCFS_H 1 -- --/* This is somehow modelled after the file of the same name on SysVr4 -- systems. It provides a definition of the core file format for ELF -- used on Linux. */ -- --#include --#include --#include --#include --#include --#include --#include -- --__BEGIN_DECLS -- --struct elf_siginfo -- { -- int si_signo; /* Signal number. */ -- int si_code; /* Extra code. */ -- int si_errno; /* Errno. */ -- }; -- --/* Definitions to generate Intel SVR4-like core files. These mostly -- have the same names as the SVR4 types with "elf_" tacked on the -- front to prevent clashes with linux definitions, and the typedef -- forms have been avoided. This is mostly like the SVR4 structure, -- but more Linuxy, with things that Linux does not support and which -- gdb doesn't really use excluded. Fields present but not used are -- marked with "XXX". */ --struct elf_prstatus -- { --#if 0 -- long int pr_flags; /* XXX Process flags. */ -- short int pr_why; /* XXX Reason for process halt. */ -- short int pr_what; /* XXX More detailed reason. */ --#endif -- struct elf_siginfo pr_info; /* Info associated with signal. */ -- short int pr_cursig; /* Current signal. */ -- unsigned long int pr_sigpend; /* Set of pending signals. */ -- unsigned long int pr_sighold; /* Set of held signals. */ --#if 0 -- struct sigaltstack pr_altstack; /* Alternate stack info. */ -- struct sigaction pr_action; /* Signal action for current sig. */ --#endif -- __pid_t pr_pid; -- __pid_t pr_ppid; -- __pid_t pr_pgrp; -- __pid_t pr_sid; -- struct timeval pr_utime; /* User time. */ -- struct timeval pr_stime; /* System time. */ -- struct timeval pr_cutime; /* Cumulative user time. */ -- struct timeval pr_cstime; /* Cumulative system time. */ --#if 0 -- long int pr_instr; /* Current instruction. */ --#endif -- elf_gregset_t pr_reg; /* GP registers. */ -- int pr_fpvalid; /* True if math copro being used. */ -- }; -- -- --#define ELF_PRARGSZ (80) /* Number of chars for args */ -- --struct elf_prpsinfo -- { -- char pr_state; /* Numeric process state. */ -- char pr_sname; /* Char for pr_state. */ -- char pr_zomb; /* Zombie. */ -- char pr_nice; /* Nice val. */ -- unsigned long int pr_flag; /* Flags. */ -- unsigned short int pr_uid; -- unsigned short int pr_gid; -- int pr_pid, pr_ppid, pr_pgrp, pr_sid; -- /* Lots missing */ -- char pr_fname[16]; /* Filename of executable. */ -- char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ -- }; -- --/* Addresses. */ --typedef void *psaddr_t; -- --/* Register sets. Linux has different names. */ --typedef gregset_t prgregset_t; --typedef fpregset_t prfpregset_t; -- --/* We don't have any differences between processes and threads, -- therefore habe only ine PID type. */ --typedef __pid_t lwpid_t; -- -- --typedef struct elf_prstatus prstatus_t; --typedef struct elf_prpsinfo prpsinfo_t; -- --__END_DECLS -- --#endif /* sys/procfs.h */ -+/* sys/procfs.h is architecture specific. */ -+#error "This file must be supplied by every Linux architecture." - diff --git a/patches/glibc/2.5.1/270-alpha-cfi.patch b/patches/glibc/2.5.1/270-alpha-cfi.patch deleted file mode 100644 index c1efd77..0000000 --- a/patches/glibc/2.5.1/270-alpha-cfi.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- libc/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h 2006/10/29 21:48:06 1.6 -+++ libc/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h 2007/03/13 21:28:03 1.7 -@@ -55,6 +55,7 @@ - bne a3, SYSCALL_ERROR_LABEL; \ - __LABEL($pseudo_ret) \ - .subsection 2; \ -+ cfi_startproc; \ - __LABEL($pseudo_cancel) \ - subq sp, 64, sp; \ - cfi_def_cfa_offset(64); \ -@@ -90,12 +91,13 @@ - cfi_def_cfa_offset(0); \ - __LABEL($syscall_error) \ - SYSCALL_ERROR_HANDLER; \ -+ cfi_endproc; \ - .previous - - # undef PSEUDO_END - # define PSEUDO_END(sym) \ -- .subsection 2; \ - cfi_endproc; \ -+ .subsection 2; \ - .size sym, .-sym - - # define SAVE_ARGS_0 /* Nothing. */ diff --git a/patches/glibc/2.5.1/280-alpha-sigsuspend.patch b/patches/glibc/2.5.1/280-alpha-sigsuspend.patch deleted file mode 100644 index daf1a5d..0000000 --- a/patches/glibc/2.5.1/280-alpha-sigsuspend.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- glibc-2.5/sysdeps/unix/sysv/linux/alpha/sigsuspend.S.orig 2006-10-22 22:17:01.000000000 +0200 -+++ glibc-2.5/sysdeps/unix/sysv/linux/alpha/sigsuspend.S 2006-10-22 22:18:05.000000000 +0200 -@@ -31,3 +31,21 @@ - libc_hidden_def (__sigsuspend) - weak_alias (__sigsuspend, sigsuspend) - strong_alias (__sigsuspend, __libc_sigsuspend) -+ -+#ifndef NO_CANCELLATION -+ .globl __sigsuspend_nocancel; -+ .align 4; -+ .type __sigsuspend_nocancel, @function; -+ .usepv __sigsuspend_nocancel, std; -+ cfi_startproc; -+__LABEL(__sigsuspend_nocancel) -+ ldgp gp, 0(pv); -+ PSEUDO_PROF; -+ PSEUDO_PREPARE_ARGS -+ lda v0, SYS_ify(sigsuspend); -+ call_pal PAL_callsys; -+ bne a3, SYSCALL_ERROR_LABEL; -+ ret; -+ cfi_endproc; -+ .size __sigsuspend_nocancel, .-__sigsuspend_nocancel -+#endif diff --git a/patches/glibc/2.5/100-cygwin.patch b/patches/glibc/2.5/100-cygwin.patch new file mode 100644 index 0000000..3c0cd7d --- /dev/null +++ b/patches/glibc/2.5/100-cygwin.patch @@ -0,0 +1,187 @@ +Fixes +elf/librtld.os: In function `process_envvars': : undefined reference to `__access' +... +when building glibc-2.3.x on cygwin + +Idea from +http://sources.redhat.com/ml/bug-glibc/2002-01/msg00071/glibc-2.2-cygin-shared.patch +Basically, make glibc use .oST as suffix for 'object static' +instead of .oS, since cygwin has trouble distinguishing .os from .oS +(Original patch had .on, but .oST is more mnemonic for 'object static') + +glibc-linuxthreads-2.3.5 also requires a patch, see +../glibc-linuxthreads-2.3.5/glibc-linuxthreads-2.3.5-cygwin.patch + +[ forward ported to glibc-2.3.5 by Petr Cvachoucek: + +Message-ID: <4282FCBA.3040000@unicontrols.cz> +Date: Thu, 12 May 2005 08:50:34 +0200 +From: Petr Cvachoucek +To: Dan Kegel +CC: crossgcc@sources.redhat.com +Subject: Patches to build gcc 3.4.3 / glibc 2.3.5 on cygwin + +Hi Dan, +following patches are needed to build gcc-3.4.3/glibc-2.3.5 toolchain +on cygwin. Tested to build toolchains for powerpc 604 and 750 targets. + +-- + Petr Cvachoucek + Unicontrols a.s. + http://www.unicontrols.cz +] + +diff -aur glibc-2.3.5/Makeconfig glibc-2.3.5-cygwin/Makeconfig +--- glibc-2.3.5/Makeconfig 2005-02-16 11:50:19.000000000 +0100 ++++ glibc-2.3.5-cygwin/Makeconfig 2005-05-11 08:24:51.046875000 +0200 +@@ -472,7 +472,7 @@ + # run the linked programs. + link-libc = -Wl,-rpath-link=$(rpath-link) \ + $(common-objpfx)libc.so$(libc.so-version) \ +- $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib) ++ $(common-objpfx)$(patsubst %,$(libtype.oST),c) $(gnulib) + # This is how to find at build-time things that will be installed there. + rpath-dirs = math elf dlfcn nss nis rt resolv crypt + endif +@@ -693,7 +693,7 @@ + # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX}) + # to pass different flags for each flavor. + libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o)) +-all-object-suffixes := .o .os .op .og .ob .oS ++all-object-suffixes := .o .os .op .og .ob .oST + object-suffixes := + CPPFLAGS-.o = $(pic-default) + CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) +@@ -749,14 +749,14 @@ + + ifeq (yes,$(build-shared)) + # Build special library that contains the static-only routines for libc. +-object-suffixes-for-libc += .oS ++object-suffixes-for-libc += .oST + + # Must build the routines as PIC, though, because they can end up in (users') + # shared objects. We don't want to use CFLAGS-os because users may, for + # example, make that processor-specific. +-CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag) +-CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 +-libtype.oS = lib%_nonshared.a ++CFLAGS-.oST = $(CFLAGS-.o) $(PIC-ccflag) ++CPPFLAGS-.oST = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 ++libtype.oST = lib%_nonshared.a + endif + + # The assembler can generate debug information too. +diff -aur glibc-2.3.5/Makerules glibc-2.3.5-cygwin/Makerules +--- glibc-2.3.5/Makerules 2004-12-15 19:52:39.000000000 +0100 ++++ glibc-2.3.5-cygwin/Makerules 2005-05-11 08:25:33.578125000 +0200 +@@ -417,7 +417,7 @@ + # Bounded pointer thunks are only built for *.ob + elide-bp-thunks = $(addprefix $(bppfx),$(bp-thunks)) + +-elide-routines.oS += $(filter-out $(static-only-routines),\ ++elide-routines.oST += $(filter-out $(static-only-routines),\ + $(routines) $(aux) $(sysdep_routines)) \ + $(elide-bp-thunks) + elide-routines.os += $(static-only-routines) $(elide-bp-thunks) +@@ -981,7 +981,7 @@ + install: $(inst_libdir)/libc.so + $(inst_libdir)/libc.so: $(common-objpfx)format.lds \ + $(common-objpfx)libc.so$(libc.so-version) \ +- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ ++ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ + $(libprefix)$(libc-name)) \ + $(+force) + (echo '/* GNU ld script';\ +@@ -989,7 +989,7 @@ + echo ' the static library, so try that secondarily. */';\ + cat $<; \ + echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \ +- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\ ++ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)$(libc-name))'\ + ' AS_NEEDED (' $(slibdir)/$(rtld-installed-name) ') )' \ + ) > $@.new + mv -f $@.new $@ +diff -aur glibc-2.3.5/extra-lib.mk glibc-2.3.5-cygwin/extra-lib.mk +--- glibc-2.3.5/extra-lib.mk 2004-12-02 23:54:47.000000000 +0100 ++++ glibc-2.3.5-cygwin/extra-lib.mk 2005-05-11 08:27:28.156250000 +0200 +@@ -13,7 +13,7 @@ + + ifneq (,$($(lib)-static-only-routines)) + ifneq (,$(filter yesyes%,$(build-shared)$(elf)$($(lib).so-version))) +-object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oS) ++object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oST) + endif + endif + +@@ -29,7 +29,7 @@ + + # Add each flavor of library to the lists of things to build and install. + install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o))) +-extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\ ++extra-objs += $(foreach o,$(filter-out .os .oST,$(object-suffixes-$(lib))),\ + $(patsubst %,%$o,$(filter-out \ + $($(lib)-shared-only-routines),\ + $(all-$(lib)-routines)))) +@@ -57,7 +57,7 @@ + + + # Use o-iterator.mk to generate a rule for each flavor of library. +-ifneq (,$(filter-out .os .oS,$(object-suffixes-$(lib)))) ++ifneq (,$(filter-out .os .oST,$(object-suffixes-$(lib)))) + define o-iterator-doit + $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \ + $(patsubst %,$(objpfx)%$o,\ +@@ -65,7 +65,7 @@ + $(all-$(lib)-routines))); \ + $$(build-extra-lib) + endef +-object-suffixes-left = $(filter-out .os .oS,$(object-suffixes-$(lib))) ++object-suffixes-left = $(filter-out .os .oST,$(object-suffixes-$(lib))) + include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left)) + endif + +@@ -77,9 +77,9 @@ + $(build-extra-lib) + endif + +-ifneq (,$(filter .oS,$(object-suffixes-$(lib)))) +-$(objpfx)$(patsubst %,$(libtype.oS),$(lib:lib%=%)): \ +- $(patsubst %,$(objpfx)%.oS,\ ++ifneq (,$(filter .oST,$(object-suffixes-$(lib)))) ++$(objpfx)$(patsubst %,$(libtype.oST),$(lib:lib%=%)): \ ++ $(patsubst %,$(objpfx)%.oST,\ + $(filter $($(lib)-static-only-routines),\ + $(all-$(lib)-routines))) + $(build-extra-lib) +diff -aur glibc-2.3.5/nptl/Makefile glibc-2.3.5-cygwin/nptl/Makefile +--- glibc-2.3.5/nptl/Makefile 2005-02-16 09:45:56.000000000 +0100 ++++ glibc-2.3.5-cygwin/nptl/Makefile 2005-05-11 08:26:01.812500000 +0200 +@@ -375,7 +375,7 @@ + + $(inst_libdir)/libpthread.so: $(common-objpfx)format.lds \ + $(objpfx)libpthread.so$(libpthread.so-version) \ +- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ ++ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ + $(libprefix)pthread) \ + $(+force) + (echo '/* GNU ld script';\ +@@ -383,7 +383,7 @@ + echo ' the static library, so try that secondarily. */';\ + cat $<; \ + echo 'GROUP ( $(slibdir)/libpthread.so$(libpthread.so-version)' \ +- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)pthread)'\ ++ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)pthread)'\ + ')' \ + ) > $@.new + mv -f $@.new $@ +diff -aur glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile +--- glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile 2004-08-16 08:46:14.000000000 +0200 ++++ glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile 2005-05-11 08:26:25.937500000 +0200 +@@ -10,4 +10,4 @@ + ASFLAGS-.op += -Wa,-Av9a + ASFLAGS-.og += -Wa,-Av9a + ASFLAGS-.ob += -Wa,-Av9a +-ASFLAGS-.oS += -Wa,-Av9a ++ASFLAGS-.oST += -Wa,-Av9a + +Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.5/110-configure-apple-as.patch b/patches/glibc/2.5/110-configure-apple-as.patch new file mode 100644 index 0000000..78a1324 --- /dev/null +++ b/patches/glibc/2.5/110-configure-apple-as.patch @@ -0,0 +1,25 @@ +http://in3www.epfl.ch/~schaffne/glibc-configure-apple-as.patch +http://sources.redhat.com/ml/crossgcc/2004-02/msg00151.html + +The following makes it possible to configure glibc-2.3.2 on Mac OS X, +where the assembler but doesn't understand the --version flag. + +Fixes the symptom +checking whether ld is GNU ld... no +checking for /usr/libexec/gcc/darwin/ppc/as... /usr/libexec/gcc/darwin/ppc/as +checking version of /usr/libexec/gcc/darwin/ppc/as... + + +--- glibc-2.3.2/configure~ Wed Feb 26 09:20:48 2003 ++++ glibc-2.3.2/configure Fri Feb 27 13:12:53 2004 +@@ -4039,7 +4039,7 @@ + # Found it, now check the version. + echo "$as_me:$LINENO: checking version of $AS" >&5 + echo $ECHO_N "checking version of $AS... $ECHO_C" >&6 +- ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` ++ ac_prog_version=`$AS -v &1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 2.1[3-9]*) + +Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.5/120-cygwin.patch b/patches/glibc/2.5/120-cygwin.patch deleted file mode 100644 index 3c0cd7d..0000000 --- a/patches/glibc/2.5/120-cygwin.patch +++ /dev/null @@ -1,187 +0,0 @@ -Fixes -elf/librtld.os: In function `process_envvars': : undefined reference to `__access' -... -when building glibc-2.3.x on cygwin - -Idea from -http://sources.redhat.com/ml/bug-glibc/2002-01/msg00071/glibc-2.2-cygin-shared.patch -Basically, make glibc use .oST as suffix for 'object static' -instead of .oS, since cygwin has trouble distinguishing .os from .oS -(Original patch had .on, but .oST is more mnemonic for 'object static') - -glibc-linuxthreads-2.3.5 also requires a patch, see -../glibc-linuxthreads-2.3.5/glibc-linuxthreads-2.3.5-cygwin.patch - -[ forward ported to glibc-2.3.5 by Petr Cvachoucek: - -Message-ID: <4282FCBA.3040000@unicontrols.cz> -Date: Thu, 12 May 2005 08:50:34 +0200 -From: Petr Cvachoucek -To: Dan Kegel -CC: crossgcc@sources.redhat.com -Subject: Patches to build gcc 3.4.3 / glibc 2.3.5 on cygwin - -Hi Dan, -following patches are needed to build gcc-3.4.3/glibc-2.3.5 toolchain -on cygwin. Tested to build toolchains for powerpc 604 and 750 targets. - --- - Petr Cvachoucek - Unicontrols a.s. - http://www.unicontrols.cz -] - -diff -aur glibc-2.3.5/Makeconfig glibc-2.3.5-cygwin/Makeconfig ---- glibc-2.3.5/Makeconfig 2005-02-16 11:50:19.000000000 +0100 -+++ glibc-2.3.5-cygwin/Makeconfig 2005-05-11 08:24:51.046875000 +0200 -@@ -472,7 +472,7 @@ - # run the linked programs. - link-libc = -Wl,-rpath-link=$(rpath-link) \ - $(common-objpfx)libc.so$(libc.so-version) \ -- $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib) -+ $(common-objpfx)$(patsubst %,$(libtype.oST),c) $(gnulib) - # This is how to find at build-time things that will be installed there. - rpath-dirs = math elf dlfcn nss nis rt resolv crypt - endif -@@ -693,7 +693,7 @@ - # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX}) - # to pass different flags for each flavor. - libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o)) --all-object-suffixes := .o .os .op .og .ob .oS -+all-object-suffixes := .o .os .op .og .ob .oST - object-suffixes := - CPPFLAGS-.o = $(pic-default) - CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) -@@ -749,14 +749,14 @@ - - ifeq (yes,$(build-shared)) - # Build special library that contains the static-only routines for libc. --object-suffixes-for-libc += .oS -+object-suffixes-for-libc += .oST - - # Must build the routines as PIC, though, because they can end up in (users') - # shared objects. We don't want to use CFLAGS-os because users may, for - # example, make that processor-specific. --CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag) --CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 --libtype.oS = lib%_nonshared.a -+CFLAGS-.oST = $(CFLAGS-.o) $(PIC-ccflag) -+CPPFLAGS-.oST = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 -+libtype.oST = lib%_nonshared.a - endif - - # The assembler can generate debug information too. -diff -aur glibc-2.3.5/Makerules glibc-2.3.5-cygwin/Makerules ---- glibc-2.3.5/Makerules 2004-12-15 19:52:39.000000000 +0100 -+++ glibc-2.3.5-cygwin/Makerules 2005-05-11 08:25:33.578125000 +0200 -@@ -417,7 +417,7 @@ - # Bounded pointer thunks are only built for *.ob - elide-bp-thunks = $(addprefix $(bppfx),$(bp-thunks)) - --elide-routines.oS += $(filter-out $(static-only-routines),\ -+elide-routines.oST += $(filter-out $(static-only-routines),\ - $(routines) $(aux) $(sysdep_routines)) \ - $(elide-bp-thunks) - elide-routines.os += $(static-only-routines) $(elide-bp-thunks) -@@ -981,7 +981,7 @@ - install: $(inst_libdir)/libc.so - $(inst_libdir)/libc.so: $(common-objpfx)format.lds \ - $(common-objpfx)libc.so$(libc.so-version) \ -- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ -+ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ - $(libprefix)$(libc-name)) \ - $(+force) - (echo '/* GNU ld script';\ -@@ -989,7 +989,7 @@ - echo ' the static library, so try that secondarily. */';\ - cat $<; \ - echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \ -- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\ -+ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)$(libc-name))'\ - ' AS_NEEDED (' $(slibdir)/$(rtld-installed-name) ') )' \ - ) > $@.new - mv -f $@.new $@ -diff -aur glibc-2.3.5/extra-lib.mk glibc-2.3.5-cygwin/extra-lib.mk ---- glibc-2.3.5/extra-lib.mk 2004-12-02 23:54:47.000000000 +0100 -+++ glibc-2.3.5-cygwin/extra-lib.mk 2005-05-11 08:27:28.156250000 +0200 -@@ -13,7 +13,7 @@ - - ifneq (,$($(lib)-static-only-routines)) - ifneq (,$(filter yesyes%,$(build-shared)$(elf)$($(lib).so-version))) --object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oS) -+object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oST) - endif - endif - -@@ -29,7 +29,7 @@ - - # Add each flavor of library to the lists of things to build and install. - install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o))) --extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\ -+extra-objs += $(foreach o,$(filter-out .os .oST,$(object-suffixes-$(lib))),\ - $(patsubst %,%$o,$(filter-out \ - $($(lib)-shared-only-routines),\ - $(all-$(lib)-routines)))) -@@ -57,7 +57,7 @@ - - - # Use o-iterator.mk to generate a rule for each flavor of library. --ifneq (,$(filter-out .os .oS,$(object-suffixes-$(lib)))) -+ifneq (,$(filter-out .os .oST,$(object-suffixes-$(lib)))) - define o-iterator-doit - $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \ - $(patsubst %,$(objpfx)%$o,\ -@@ -65,7 +65,7 @@ - $(all-$(lib)-routines))); \ - $$(build-extra-lib) - endef --object-suffixes-left = $(filter-out .os .oS,$(object-suffixes-$(lib))) -+object-suffixes-left = $(filter-out .os .oST,$(object-suffixes-$(lib))) - include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left)) - endif - -@@ -77,9 +77,9 @@ - $(build-extra-lib) - endif - --ifneq (,$(filter .oS,$(object-suffixes-$(lib)))) --$(objpfx)$(patsubst %,$(libtype.oS),$(lib:lib%=%)): \ -- $(patsubst %,$(objpfx)%.oS,\ -+ifneq (,$(filter .oST,$(object-suffixes-$(lib)))) -+$(objpfx)$(patsubst %,$(libtype.oST),$(lib:lib%=%)): \ -+ $(patsubst %,$(objpfx)%.oST,\ - $(filter $($(lib)-static-only-routines),\ - $(all-$(lib)-routines))) - $(build-extra-lib) -diff -aur glibc-2.3.5/nptl/Makefile glibc-2.3.5-cygwin/nptl/Makefile ---- glibc-2.3.5/nptl/Makefile 2005-02-16 09:45:56.000000000 +0100 -+++ glibc-2.3.5-cygwin/nptl/Makefile 2005-05-11 08:26:01.812500000 +0200 -@@ -375,7 +375,7 @@ - - $(inst_libdir)/libpthread.so: $(common-objpfx)format.lds \ - $(objpfx)libpthread.so$(libpthread.so-version) \ -- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ -+ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ - $(libprefix)pthread) \ - $(+force) - (echo '/* GNU ld script';\ -@@ -383,7 +383,7 @@ - echo ' the static library, so try that secondarily. */';\ - cat $<; \ - echo 'GROUP ( $(slibdir)/libpthread.so$(libpthread.so-version)' \ -- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)pthread)'\ -+ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)pthread)'\ - ')' \ - ) > $@.new - mv -f $@.new $@ -diff -aur glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile ---- glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile 2004-08-16 08:46:14.000000000 +0200 -+++ glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile 2005-05-11 08:26:25.937500000 +0200 -@@ -10,4 +10,4 @@ - ASFLAGS-.op += -Wa,-Av9a - ASFLAGS-.og += -Wa,-Av9a - ASFLAGS-.ob += -Wa,-Av9a --ASFLAGS-.oS += -Wa,-Av9a -+ASFLAGS-.oST += -Wa,-Av9a - -Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.5/120-fix-pr631.patch b/patches/glibc/2.5/120-fix-pr631.patch new file mode 100644 index 0000000..13688df --- /dev/null +++ b/patches/glibc/2.5/120-fix-pr631.patch @@ -0,0 +1,45 @@ +From dank@kegel.com +Wed Jun 15 09:12:43 PDT 2005 + +Fixes + +build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r' +build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent' +... 53 lines deleted ... +build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r' +collect2: ld returned 1 exit status +make[2]: *** [/build/gcc-3.4.3-glibc-2.3.5-hdrs-2.6.11.2/i686-unknown-linux-gnu/build-glibc/elf/ldconfig] Error 1 + +when building glibc with --enable-static-nss. + +See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631 + +--- glibc-2.3.5/Makeconfig.old Wed Jun 15 08:13:12 2005 ++++ glibc-2.3.5/Makeconfig Wed Jun 15 08:13:14 2005 +@@ -510,7 +510,7 @@ + + # The static libraries. + ifeq (yes,$(build-static)) +-link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a ++link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a + else + ifeq (yes,$(build-shared)) + # We can try to link the programs with lib*_pic.a... +--- glibc-2.3.5/elf/Makefile.old Wed Jun 15 07:46:49 2005 ++++ glibc-2.3.5/elf/Makefile Wed Jun 15 08:14:00 2005 +@@ -120,6 +120,13 @@ + install-bin-script = ldd + endif + ++ifeq (yes,$(build-static-nss)) ++nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) ++resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv) ++otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ ++ $(resolvobjdir)/libresolv.a ++endif ++ + others = sprof sln + install-bin = sprof + others-static = sln + +Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.5/130-i686-assembler.patch b/patches/glibc/2.5/130-i686-assembler.patch new file mode 100644 index 0000000..9904efb --- /dev/null +++ b/patches/glibc/2.5/130-i686-assembler.patch @@ -0,0 +1,38 @@ +2007-02-15 Khem Raj + + * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686. + * nptl/sysdeps/pthread/pt-initfini.c: Ditto. + + + +Index: glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h +=================================================================== +--- glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (revision 1469) ++++ glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (working copy) +@@ -29,6 +29,10 @@ + #include + #include + ++#if defined __i686 && defined __ASSEMBLER__ ++#undef __i686 ++#define __i686 __i686 ++#endif + + /* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h +Index: glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c +=================================================================== +--- glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (revision 1469) ++++ glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (working copy) +@@ -45,6 +45,11 @@ + /* Embed an #include to pull in the alignment and .end directives. */ + asm ("\n#include \"defs.h\""); + ++asm ("\n#if defined __i686 && defined __ASSEMBLER__"); ++asm ("\n#undef __i686"); ++asm ("\n#define __i686 __i686"); ++asm ("\n#endif"); ++ + /* The initial common code ends here. */ + asm ("\n/*@HEADER_ENDS*/"); + diff --git a/patches/glibc/2.5/140-configure-apple-as.patch b/patches/glibc/2.5/140-configure-apple-as.patch deleted file mode 100644 index 78a1324..0000000 --- a/patches/glibc/2.5/140-configure-apple-as.patch +++ /dev/null @@ -1,25 +0,0 @@ -http://in3www.epfl.ch/~schaffne/glibc-configure-apple-as.patch -http://sources.redhat.com/ml/crossgcc/2004-02/msg00151.html - -The following makes it possible to configure glibc-2.3.2 on Mac OS X, -where the assembler but doesn't understand the --version flag. - -Fixes the symptom -checking whether ld is GNU ld... no -checking for /usr/libexec/gcc/darwin/ppc/as... /usr/libexec/gcc/darwin/ppc/as -checking version of /usr/libexec/gcc/darwin/ppc/as... - - ---- glibc-2.3.2/configure~ Wed Feb 26 09:20:48 2003 -+++ glibc-2.3.2/configure Fri Feb 27 13:12:53 2004 -@@ -4039,7 +4039,7 @@ - # Found it, now check the version. - echo "$as_me:$LINENO: checking version of $AS" >&5 - echo $ECHO_N "checking version of $AS... $ECHO_C" >&6 -- ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` -+ ac_prog_version=`$AS -v &1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` - case $ac_prog_version in - '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 2.1[3-9]*) - -Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.5/140-i386-preferred-stack-boundary.patch b/patches/glibc/2.5/140-i386-preferred-stack-boundary.patch new file mode 100644 index 0000000..449821d --- /dev/null +++ b/patches/glibc/2.5/140-i386-preferred-stack-boundary.patch @@ -0,0 +1,18 @@ +(C) 2007 Yann E. MORIN +License: LGPL v2.1 + +Shut off a stupid warning: preffered-stack-boundary must be between 4 ad 12, +and 2 is not. + +diff -dur glibc-2.5.orig/sysdeps/i386/Makefile glibc-2.5/sysdeps/i386/Makefile +--- glibc-2.5.orig/sysdeps/i386/Makefile 2005-03-06 01:18:16.000000000 +0100 ++++ glibc-2.5/sysdeps/i386/Makefile 2007-05-27 17:49:37.000000000 +0200 +@@ -36,7 +36,7 @@ + ifeq ($(subdir),csu) + sysdep-CFLAGS += -mpreferred-stack-boundary=4 + else +-sysdep-CFLAGS += -mpreferred-stack-boundary=2 ++sysdep-CFLAGS += -mpreferred-stack-boundary=4 + # Likewise, any function which calls user callbacks + uses-callbacks += -mpreferred-stack-boundary=4 + # Likewise, any stack alignment tests diff --git a/patches/glibc/2.5/150-alpha-asm_page.patch b/patches/glibc/2.5/150-alpha-asm_page.patch new file mode 100644 index 0000000..b198b36 --- /dev/null +++ b/patches/glibc/2.5/150-alpha-asm_page.patch @@ -0,0 +1,26 @@ +2008-06-07 Mike Frysinger + + * sysdeps/unix/sysv/linux/alpha/sys/user.h: Copy page.h definitions + from the kernel header to sys/user.h and remove the #include of + sys/user.h. + +--- a/sysdeps/unix/sysv/linux/alpha/sys/user.h ++++ b/sysdeps/unix/sysv/linux/alpha/sys/user.h +@@ -23,7 +23,6 @@ + only. Don't read too much into it. Don't use it for anything other + than gdb/strace unless you know what you are doing. */ + +-#include + #include + + struct user +@@ -41,6 +40,9 @@ struct user + char u_comm[32]; /* user command name */ + }; + ++#define PAGE_SHIFT 13 ++#define PAGE_SIZE (1 << PAGE_SHIFT) ++#define PAGE_MASK (~(PAGE_SIZE-1)) + #define NBPG PAGE_SIZE + #define UPAGES 1 + #define HOST_TEXT_START_ADDR (u.start_code) diff --git a/patches/glibc/2.5/150-fix-pr631.patch b/patches/glibc/2.5/150-fix-pr631.patch deleted file mode 100644 index 13688df..0000000 --- a/patches/glibc/2.5/150-fix-pr631.patch +++ /dev/null @@ -1,45 +0,0 @@ -From dank@kegel.com -Wed Jun 15 09:12:43 PDT 2005 - -Fixes - -build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r' -build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent' -... 53 lines deleted ... -build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r' -collect2: ld returned 1 exit status -make[2]: *** [/build/gcc-3.4.3-glibc-2.3.5-hdrs-2.6.11.2/i686-unknown-linux-gnu/build-glibc/elf/ldconfig] Error 1 - -when building glibc with --enable-static-nss. - -See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631 - ---- glibc-2.3.5/Makeconfig.old Wed Jun 15 08:13:12 2005 -+++ glibc-2.3.5/Makeconfig Wed Jun 15 08:13:14 2005 -@@ -510,7 +510,7 @@ - - # The static libraries. - ifeq (yes,$(build-static)) --link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a -+link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a - else - ifeq (yes,$(build-shared)) - # We can try to link the programs with lib*_pic.a... ---- glibc-2.3.5/elf/Makefile.old Wed Jun 15 07:46:49 2005 -+++ glibc-2.3.5/elf/Makefile Wed Jun 15 08:14:00 2005 -@@ -120,6 +120,13 @@ - install-bin-script = ldd - endif - -+ifeq (yes,$(build-static-nss)) -+nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) -+resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv) -+otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ -+ $(resolvobjdir)/libresolv.a -+endif -+ - others = sprof sln - install-bin = sprof - others-static = sln - -Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.5/160-i686-assembler.patch b/patches/glibc/2.5/160-i686-assembler.patch deleted file mode 100644 index 9904efb..0000000 --- a/patches/glibc/2.5/160-i686-assembler.patch +++ /dev/null @@ -1,38 +0,0 @@ -2007-02-15 Khem Raj - - * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686. - * nptl/sysdeps/pthread/pt-initfini.c: Ditto. - - - -Index: glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h -=================================================================== ---- glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (revision 1469) -+++ glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (working copy) -@@ -29,6 +29,10 @@ - #include - #include - -+#if defined __i686 && defined __ASSEMBLER__ -+#undef __i686 -+#define __i686 __i686 -+#endif - - /* For Linux we can use the system call table in the header file - /usr/include/asm/unistd.h -Index: glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c -=================================================================== ---- glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (revision 1469) -+++ glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (working copy) -@@ -45,6 +45,11 @@ - /* Embed an #include to pull in the alignment and .end directives. */ - asm ("\n#include \"defs.h\""); - -+asm ("\n#if defined __i686 && defined __ASSEMBLER__"); -+asm ("\n#undef __i686"); -+asm ("\n#define __i686 __i686"); -+asm ("\n#endif"); -+ - /* The initial common code ends here. */ - asm ("\n/*@HEADER_ENDS*/"); - diff --git a/patches/glibc/2.5/160-use_short_for_fnstsw.patch b/patches/glibc/2.5/160-use_short_for_fnstsw.patch new file mode 100644 index 0000000..0e849fa --- /dev/null +++ b/patches/glibc/2.5/160-use_short_for_fnstsw.patch @@ -0,0 +1,18 @@ +Original patch from H.J. Lu, as reported there: +http://www.nabble.com/PATCH:-Use-short-for-fnstsw-td14775171.html + +fnstsw stores 16bit into %ax. The upper 16bit of %eax is unchanged. +The new assembler (binutils-2.18.50.0.4 and up) will disallow "fnstsw %eax". + +diff -dur glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c +--- glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c 2004-03-05 11:14:48.000000000 +0100 ++++ glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c 2008-06-24 10:56:14.000000000 +0200 +@@ -26,7 +26,7 @@ + int + fetestexcept (int excepts) + { +- int temp; ++ short temp; + int xtemp = 0; + + /* Get current exceptions. */ diff --git a/patches/glibc/2.5/170-alpha-asm_elf.patch b/patches/glibc/2.5/170-alpha-asm_elf.patch new file mode 100644 index 0000000..3da5c8e --- /dev/null +++ b/patches/glibc/2.5/170-alpha-asm_elf.patch @@ -0,0 +1,194 @@ +since the kernel no longer provides asm/elf.h, the sys/procfs.h from the +common code, alpha, and sh fail when used. this should things up. +-mike + +2008-06-07 Mike Frysinger + + * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. + * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h + definitions from the kernel header to sys/procfs.h and remove the + #include of asm/elf.h. + * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. + +*Attachment: signature.asc * +/Description:/ This is a digitally signed message part. + +2008-06-07 Mike Frysinger + + * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. + * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h + definitions from the kernel header to sys/procfs.h and remove the + #include of asm/elf.h. + * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. + +--- a/sysdeps/unix/sysv/linux/alpha/sys/procfs.h ++++ b/sysdeps/unix/sysv/linux/alpha/sys/procfs.h +@@ -29,10 +29,23 @@ + #include + #include + #include +-#include + + __BEGIN_DECLS + ++/* ++ * The OSF/1 version of makes gregset_t 46 entries long. ++ * I have no idea why that is so. For now, we just leave it at 33 ++ * (32 general regs + processor status word). ++ */ ++#define ELF_NGREG 33 ++#define ELF_NFPREG 32 ++ ++typedef unsigned long elf_greg_t; ++typedef elf_greg_t elf_gregset_t[ELF_NGREG]; ++ ++typedef double elf_fpreg_t; ++typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; ++ + struct elf_siginfo + { + int si_signo; /* Signal number. */ +--- a/sysdeps/unix/sysv/linux/sh/sys/procfs.h ++++ b/sysdeps/unix/sysv/linux/sh/sys/procfs.h +@@ -29,10 +29,19 @@ + #include + #include + #include +-#include + + __BEGIN_DECLS + ++/* ++ * ELF register definitions... ++ */ ++typedef unsigned long elf_greg_t; ++ ++#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) ++typedef elf_greg_t elf_gregset_t[ELF_NGREG]; ++ ++typedef struct user_fpu_struct elf_fpregset_t; ++ + struct elf_siginfo + { + int si_signo; /* Signal number. */ +--- a/sysdeps/unix/sysv/linux/sys/procfs.h ++++ b/sysdeps/unix/sysv/linux/sys/procfs.h +@@ -1,115 +1,2 @@ +-/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- +- The GNU C Library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- The GNU C 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 +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with the GNU C Library; if not, write to the Free +- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +- 02111-1307 USA. */ +- +-#ifndef _SYS_PROCFS_H +-#define _SYS_PROCFS_H 1 +- +-/* This is somehow modelled after the file of the same name on SysVr4 +- systems. It provides a definition of the core file format for ELF +- used on Linux. */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-__BEGIN_DECLS +- +-struct elf_siginfo +- { +- int si_signo; /* Signal number. */ +- int si_code; /* Extra code. */ +- int si_errno; /* Errno. */ +- }; +- +-/* Definitions to generate Intel SVR4-like core files. These mostly +- have the same names as the SVR4 types with "elf_" tacked on the +- front to prevent clashes with linux definitions, and the typedef +- forms have been avoided. This is mostly like the SVR4 structure, +- but more Linuxy, with things that Linux does not support and which +- gdb doesn't really use excluded. Fields present but not used are +- marked with "XXX". */ +-struct elf_prstatus +- { +-#if 0 +- long int pr_flags; /* XXX Process flags. */ +- short int pr_why; /* XXX Reason for process halt. */ +- short int pr_what; /* XXX More detailed reason. */ +-#endif +- struct elf_siginfo pr_info; /* Info associated with signal. */ +- short int pr_cursig; /* Current signal. */ +- unsigned long int pr_sigpend; /* Set of pending signals. */ +- unsigned long int pr_sighold; /* Set of held signals. */ +-#if 0 +- struct sigaltstack pr_altstack; /* Alternate stack info. */ +- struct sigaction pr_action; /* Signal action for current sig. */ +-#endif +- __pid_t pr_pid; +- __pid_t pr_ppid; +- __pid_t pr_pgrp; +- __pid_t pr_sid; +- struct timeval pr_utime; /* User time. */ +- struct timeval pr_stime; /* System time. */ +- struct timeval pr_cutime; /* Cumulative user time. */ +- struct timeval pr_cstime; /* Cumulative system time. */ +-#if 0 +- long int pr_instr; /* Current instruction. */ +-#endif +- elf_gregset_t pr_reg; /* GP registers. */ +- int pr_fpvalid; /* True if math copro being used. */ +- }; +- +- +-#define ELF_PRARGSZ (80) /* Number of chars for args */ +- +-struct elf_prpsinfo +- { +- char pr_state; /* Numeric process state. */ +- char pr_sname; /* Char for pr_state. */ +- char pr_zomb; /* Zombie. */ +- char pr_nice; /* Nice val. */ +- unsigned long int pr_flag; /* Flags. */ +- unsigned short int pr_uid; +- unsigned short int pr_gid; +- int pr_pid, pr_ppid, pr_pgrp, pr_sid; +- /* Lots missing */ +- char pr_fname[16]; /* Filename of executable. */ +- char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ +- }; +- +-/* Addresses. */ +-typedef void *psaddr_t; +- +-/* Register sets. Linux has different names. */ +-typedef gregset_t prgregset_t; +-typedef fpregset_t prfpregset_t; +- +-/* We don't have any differences between processes and threads, +- therefore habe only ine PID type. */ +-typedef __pid_t lwpid_t; +- +- +-typedef struct elf_prstatus prstatus_t; +-typedef struct elf_prpsinfo prpsinfo_t; +- +-__END_DECLS +- +-#endif /* sys/procfs.h */ ++/* sys/procfs.h is architecture specific. */ ++#error "This file must be supplied by every Linux architecture." + diff --git a/patches/glibc/2.5/170-i386-preferred-stack-boundary.patch b/patches/glibc/2.5/170-i386-preferred-stack-boundary.patch deleted file mode 100644 index 449821d..0000000 --- a/patches/glibc/2.5/170-i386-preferred-stack-boundary.patch +++ /dev/null @@ -1,18 +0,0 @@ -(C) 2007 Yann E. MORIN -License: LGPL v2.1 - -Shut off a stupid warning: preffered-stack-boundary must be between 4 ad 12, -and 2 is not. - -diff -dur glibc-2.5.orig/sysdeps/i386/Makefile glibc-2.5/sysdeps/i386/Makefile ---- glibc-2.5.orig/sysdeps/i386/Makefile 2005-03-06 01:18:16.000000000 +0100 -+++ glibc-2.5/sysdeps/i386/Makefile 2007-05-27 17:49:37.000000000 +0200 -@@ -36,7 +36,7 @@ - ifeq ($(subdir),csu) - sysdep-CFLAGS += -mpreferred-stack-boundary=4 - else --sysdep-CFLAGS += -mpreferred-stack-boundary=2 -+sysdep-CFLAGS += -mpreferred-stack-boundary=4 - # Likewise, any function which calls user callbacks - uses-callbacks += -mpreferred-stack-boundary=4 - # Likewise, any stack alignment tests diff --git a/patches/glibc/2.5/180-alpha-asm_page.patch b/patches/glibc/2.5/180-alpha-asm_page.patch deleted file mode 100644 index b198b36..0000000 --- a/patches/glibc/2.5/180-alpha-asm_page.patch +++ /dev/null @@ -1,26 +0,0 @@ -2008-06-07 Mike Frysinger - - * sysdeps/unix/sysv/linux/alpha/sys/user.h: Copy page.h definitions - from the kernel header to sys/user.h and remove the #include of - sys/user.h. - ---- a/sysdeps/unix/sysv/linux/alpha/sys/user.h -+++ b/sysdeps/unix/sysv/linux/alpha/sys/user.h -@@ -23,7 +23,6 @@ - only. Don't read too much into it. Don't use it for anything other - than gdb/strace unless you know what you are doing. */ - --#include - #include - - struct user -@@ -41,6 +40,9 @@ struct user - char u_comm[32]; /* user command name */ - }; - -+#define PAGE_SHIFT 13 -+#define PAGE_SIZE (1 << PAGE_SHIFT) -+#define PAGE_MASK (~(PAGE_SIZE-1)) - #define NBPG PAGE_SIZE - #define UPAGES 1 - #define HOST_TEXT_START_ADDR (u.start_code) diff --git a/patches/glibc/2.5/180-alpha-cfi.patch b/patches/glibc/2.5/180-alpha-cfi.patch new file mode 100644 index 0000000..c1efd77 --- /dev/null +++ b/patches/glibc/2.5/180-alpha-cfi.patch @@ -0,0 +1,25 @@ +--- libc/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h 2006/10/29 21:48:06 1.6 ++++ libc/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h 2007/03/13 21:28:03 1.7 +@@ -55,6 +55,7 @@ + bne a3, SYSCALL_ERROR_LABEL; \ + __LABEL($pseudo_ret) \ + .subsection 2; \ ++ cfi_startproc; \ + __LABEL($pseudo_cancel) \ + subq sp, 64, sp; \ + cfi_def_cfa_offset(64); \ +@@ -90,12 +91,13 @@ + cfi_def_cfa_offset(0); \ + __LABEL($syscall_error) \ + SYSCALL_ERROR_HANDLER; \ ++ cfi_endproc; \ + .previous + + # undef PSEUDO_END + # define PSEUDO_END(sym) \ +- .subsection 2; \ + cfi_endproc; \ ++ .subsection 2; \ + .size sym, .-sym + + # define SAVE_ARGS_0 /* Nothing. */ diff --git a/patches/glibc/2.5/190-alpha-sigsuspend.patch b/patches/glibc/2.5/190-alpha-sigsuspend.patch new file mode 100644 index 0000000..daf1a5d --- /dev/null +++ b/patches/glibc/2.5/190-alpha-sigsuspend.patch @@ -0,0 +1,24 @@ +--- glibc-2.5/sysdeps/unix/sysv/linux/alpha/sigsuspend.S.orig 2006-10-22 22:17:01.000000000 +0200 ++++ glibc-2.5/sysdeps/unix/sysv/linux/alpha/sigsuspend.S 2006-10-22 22:18:05.000000000 +0200 +@@ -31,3 +31,21 @@ + libc_hidden_def (__sigsuspend) + weak_alias (__sigsuspend, sigsuspend) + strong_alias (__sigsuspend, __libc_sigsuspend) ++ ++#ifndef NO_CANCELLATION ++ .globl __sigsuspend_nocancel; ++ .align 4; ++ .type __sigsuspend_nocancel, @function; ++ .usepv __sigsuspend_nocancel, std; ++ cfi_startproc; ++__LABEL(__sigsuspend_nocancel) ++ ldgp gp, 0(pv); ++ PSEUDO_PROF; ++ PSEUDO_PREPARE_ARGS ++ lda v0, SYS_ify(sigsuspend); ++ call_pal PAL_callsys; ++ bne a3, SYSCALL_ERROR_LABEL; ++ ret; ++ cfi_endproc; ++ .size __sigsuspend_nocancel, .-__sigsuspend_nocancel ++#endif diff --git a/patches/glibc/2.5/190-use_short_for_fnstsw.patch b/patches/glibc/2.5/190-use_short_for_fnstsw.patch deleted file mode 100644 index 0e849fa..0000000 --- a/patches/glibc/2.5/190-use_short_for_fnstsw.patch +++ /dev/null @@ -1,18 +0,0 @@ -Original patch from H.J. Lu, as reported there: -http://www.nabble.com/PATCH:-Use-short-for-fnstsw-td14775171.html - -fnstsw stores 16bit into %ax. The upper 16bit of %eax is unchanged. -The new assembler (binutils-2.18.50.0.4 and up) will disallow "fnstsw %eax". - -diff -dur glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c ---- glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c 2004-03-05 11:14:48.000000000 +0100 -+++ glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c 2008-06-24 10:56:14.000000000 +0200 -@@ -26,7 +26,7 @@ - int - fetestexcept (int excepts) - { -- int temp; -+ short temp; - int xtemp = 0; - - /* Get current exceptions. */ diff --git a/patches/glibc/2.5/260-alpha-asm_elf.patch b/patches/glibc/2.5/260-alpha-asm_elf.patch deleted file mode 100644 index 3da5c8e..0000000 --- a/patches/glibc/2.5/260-alpha-asm_elf.patch +++ /dev/null @@ -1,194 +0,0 @@ -since the kernel no longer provides asm/elf.h, the sys/procfs.h from the -common code, alpha, and sh fail when used. this should things up. --mike - -2008-06-07 Mike Frysinger - - * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. - * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h - definitions from the kernel header to sys/procfs.h and remove the - #include of asm/elf.h. - * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. - -*Attachment: signature.asc * -/Description:/ This is a digitally signed message part. - -2008-06-07 Mike Frysinger - - * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. - * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h - definitions from the kernel header to sys/procfs.h and remove the - #include of asm/elf.h. - * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. - ---- a/sysdeps/unix/sysv/linux/alpha/sys/procfs.h -+++ b/sysdeps/unix/sysv/linux/alpha/sys/procfs.h -@@ -29,10 +29,23 @@ - #include - #include - #include --#include - - __BEGIN_DECLS - -+/* -+ * The OSF/1 version of makes gregset_t 46 entries long. -+ * I have no idea why that is so. For now, we just leave it at 33 -+ * (32 general regs + processor status word). -+ */ -+#define ELF_NGREG 33 -+#define ELF_NFPREG 32 -+ -+typedef unsigned long elf_greg_t; -+typedef elf_greg_t elf_gregset_t[ELF_NGREG]; -+ -+typedef double elf_fpreg_t; -+typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; -+ - struct elf_siginfo - { - int si_signo; /* Signal number. */ ---- a/sysdeps/unix/sysv/linux/sh/sys/procfs.h -+++ b/sysdeps/unix/sysv/linux/sh/sys/procfs.h -@@ -29,10 +29,19 @@ - #include - #include - #include --#include - - __BEGIN_DECLS - -+/* -+ * ELF register definitions... -+ */ -+typedef unsigned long elf_greg_t; -+ -+#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) -+typedef elf_greg_t elf_gregset_t[ELF_NGREG]; -+ -+typedef struct user_fpu_struct elf_fpregset_t; -+ - struct elf_siginfo - { - int si_signo; /* Signal number. */ ---- a/sysdeps/unix/sysv/linux/sys/procfs.h -+++ b/sysdeps/unix/sysv/linux/sys/procfs.h -@@ -1,115 +1,2 @@ --/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- -- The GNU C 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 -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, write to the Free -- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -- 02111-1307 USA. */ -- --#ifndef _SYS_PROCFS_H --#define _SYS_PROCFS_H 1 -- --/* This is somehow modelled after the file of the same name on SysVr4 -- systems. It provides a definition of the core file format for ELF -- used on Linux. */ -- --#include --#include --#include --#include --#include --#include --#include -- --__BEGIN_DECLS -- --struct elf_siginfo -- { -- int si_signo; /* Signal number. */ -- int si_code; /* Extra code. */ -- int si_errno; /* Errno. */ -- }; -- --/* Definitions to generate Intel SVR4-like core files. These mostly -- have the same names as the SVR4 types with "elf_" tacked on the -- front to prevent clashes with linux definitions, and the typedef -- forms have been avoided. This is mostly like the SVR4 structure, -- but more Linuxy, with things that Linux does not support and which -- gdb doesn't really use excluded. Fields present but not used are -- marked with "XXX". */ --struct elf_prstatus -- { --#if 0 -- long int pr_flags; /* XXX Process flags. */ -- short int pr_why; /* XXX Reason for process halt. */ -- short int pr_what; /* XXX More detailed reason. */ --#endif -- struct elf_siginfo pr_info; /* Info associated with signal. */ -- short int pr_cursig; /* Current signal. */ -- unsigned long int pr_sigpend; /* Set of pending signals. */ -- unsigned long int pr_sighold; /* Set of held signals. */ --#if 0 -- struct sigaltstack pr_altstack; /* Alternate stack info. */ -- struct sigaction pr_action; /* Signal action for current sig. */ --#endif -- __pid_t pr_pid; -- __pid_t pr_ppid; -- __pid_t pr_pgrp; -- __pid_t pr_sid; -- struct timeval pr_utime; /* User time. */ -- struct timeval pr_stime; /* System time. */ -- struct timeval pr_cutime; /* Cumulative user time. */ -- struct timeval pr_cstime; /* Cumulative system time. */ --#if 0 -- long int pr_instr; /* Current instruction. */ --#endif -- elf_gregset_t pr_reg; /* GP registers. */ -- int pr_fpvalid; /* True if math copro being used. */ -- }; -- -- --#define ELF_PRARGSZ (80) /* Number of chars for args */ -- --struct elf_prpsinfo -- { -- char pr_state; /* Numeric process state. */ -- char pr_sname; /* Char for pr_state. */ -- char pr_zomb; /* Zombie. */ -- char pr_nice; /* Nice val. */ -- unsigned long int pr_flag; /* Flags. */ -- unsigned short int pr_uid; -- unsigned short int pr_gid; -- int pr_pid, pr_ppid, pr_pgrp, pr_sid; -- /* Lots missing */ -- char pr_fname[16]; /* Filename of executable. */ -- char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ -- }; -- --/* Addresses. */ --typedef void *psaddr_t; -- --/* Register sets. Linux has different names. */ --typedef gregset_t prgregset_t; --typedef fpregset_t prfpregset_t; -- --/* We don't have any differences between processes and threads, -- therefore habe only ine PID type. */ --typedef __pid_t lwpid_t; -- -- --typedef struct elf_prstatus prstatus_t; --typedef struct elf_prpsinfo prpsinfo_t; -- --__END_DECLS -- --#endif /* sys/procfs.h */ -+/* sys/procfs.h is architecture specific. */ -+#error "This file must be supplied by every Linux architecture." - diff --git a/patches/glibc/2.5/270-alpha-cfi.patch b/patches/glibc/2.5/270-alpha-cfi.patch deleted file mode 100644 index c1efd77..0000000 --- a/patches/glibc/2.5/270-alpha-cfi.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- libc/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h 2006/10/29 21:48:06 1.6 -+++ libc/nptl/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h 2007/03/13 21:28:03 1.7 -@@ -55,6 +55,7 @@ - bne a3, SYSCALL_ERROR_LABEL; \ - __LABEL($pseudo_ret) \ - .subsection 2; \ -+ cfi_startproc; \ - __LABEL($pseudo_cancel) \ - subq sp, 64, sp; \ - cfi_def_cfa_offset(64); \ -@@ -90,12 +91,13 @@ - cfi_def_cfa_offset(0); \ - __LABEL($syscall_error) \ - SYSCALL_ERROR_HANDLER; \ -+ cfi_endproc; \ - .previous - - # undef PSEUDO_END - # define PSEUDO_END(sym) \ -- .subsection 2; \ - cfi_endproc; \ -+ .subsection 2; \ - .size sym, .-sym - - # define SAVE_ARGS_0 /* Nothing. */ diff --git a/patches/glibc/2.5/280-alpha-sigsuspend.patch b/patches/glibc/2.5/280-alpha-sigsuspend.patch deleted file mode 100644 index daf1a5d..0000000 --- a/patches/glibc/2.5/280-alpha-sigsuspend.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- glibc-2.5/sysdeps/unix/sysv/linux/alpha/sigsuspend.S.orig 2006-10-22 22:17:01.000000000 +0200 -+++ glibc-2.5/sysdeps/unix/sysv/linux/alpha/sigsuspend.S 2006-10-22 22:18:05.000000000 +0200 -@@ -31,3 +31,21 @@ - libc_hidden_def (__sigsuspend) - weak_alias (__sigsuspend, sigsuspend) - strong_alias (__sigsuspend, __libc_sigsuspend) -+ -+#ifndef NO_CANCELLATION -+ .globl __sigsuspend_nocancel; -+ .align 4; -+ .type __sigsuspend_nocancel, @function; -+ .usepv __sigsuspend_nocancel, std; -+ cfi_startproc; -+__LABEL(__sigsuspend_nocancel) -+ ldgp gp, 0(pv); -+ PSEUDO_PROF; -+ PSEUDO_PREPARE_ARGS -+ lda v0, SYS_ify(sigsuspend); -+ call_pal PAL_callsys; -+ bne a3, SYSCALL_ERROR_LABEL; -+ ret; -+ cfi_endproc; -+ .size __sigsuspend_nocancel, .-__sigsuspend_nocancel -+#endif diff --git a/patches/glibc/2.6.1/100-cygwin.patch b/patches/glibc/2.6.1/100-cygwin.patch new file mode 100644 index 0000000..3c0cd7d --- /dev/null +++ b/patches/glibc/2.6.1/100-cygwin.patch @@ -0,0 +1,187 @@ +Fixes +elf/librtld.os: In function `process_envvars': : undefined reference to `__access' +... +when building glibc-2.3.x on cygwin + +Idea from +http://sources.redhat.com/ml/bug-glibc/2002-01/msg00071/glibc-2.2-cygin-shared.patch +Basically, make glibc use .oST as suffix for 'object static' +instead of .oS, since cygwin has trouble distinguishing .os from .oS +(Original patch had .on, but .oST is more mnemonic for 'object static') + +glibc-linuxthreads-2.3.5 also requires a patch, see +../glibc-linuxthreads-2.3.5/glibc-linuxthreads-2.3.5-cygwin.patch + +[ forward ported to glibc-2.3.5 by Petr Cvachoucek: + +Message-ID: <4282FCBA.3040000@unicontrols.cz> +Date: Thu, 12 May 2005 08:50:34 +0200 +From: Petr Cvachoucek +To: Dan Kegel +CC: crossgcc@sources.redhat.com +Subject: Patches to build gcc 3.4.3 / glibc 2.3.5 on cygwin + +Hi Dan, +following patches are needed to build gcc-3.4.3/glibc-2.3.5 toolchain +on cygwin. Tested to build toolchains for powerpc 604 and 750 targets. + +-- + Petr Cvachoucek + Unicontrols a.s. + http://www.unicontrols.cz +] + +diff -aur glibc-2.3.5/Makeconfig glibc-2.3.5-cygwin/Makeconfig +--- glibc-2.3.5/Makeconfig 2005-02-16 11:50:19.000000000 +0100 ++++ glibc-2.3.5-cygwin/Makeconfig 2005-05-11 08:24:51.046875000 +0200 +@@ -472,7 +472,7 @@ + # run the linked programs. + link-libc = -Wl,-rpath-link=$(rpath-link) \ + $(common-objpfx)libc.so$(libc.so-version) \ +- $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib) ++ $(common-objpfx)$(patsubst %,$(libtype.oST),c) $(gnulib) + # This is how to find at build-time things that will be installed there. + rpath-dirs = math elf dlfcn nss nis rt resolv crypt + endif +@@ -693,7 +693,7 @@ + # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX}) + # to pass different flags for each flavor. + libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o)) +-all-object-suffixes := .o .os .op .og .ob .oS ++all-object-suffixes := .o .os .op .og .ob .oST + object-suffixes := + CPPFLAGS-.o = $(pic-default) + CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) +@@ -749,14 +749,14 @@ + + ifeq (yes,$(build-shared)) + # Build special library that contains the static-only routines for libc. +-object-suffixes-for-libc += .oS ++object-suffixes-for-libc += .oST + + # Must build the routines as PIC, though, because they can end up in (users') + # shared objects. We don't want to use CFLAGS-os because users may, for + # example, make that processor-specific. +-CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag) +-CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 +-libtype.oS = lib%_nonshared.a ++CFLAGS-.oST = $(CFLAGS-.o) $(PIC-ccflag) ++CPPFLAGS-.oST = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 ++libtype.oST = lib%_nonshared.a + endif + + # The assembler can generate debug information too. +diff -aur glibc-2.3.5/Makerules glibc-2.3.5-cygwin/Makerules +--- glibc-2.3.5/Makerules 2004-12-15 19:52:39.000000000 +0100 ++++ glibc-2.3.5-cygwin/Makerules 2005-05-11 08:25:33.578125000 +0200 +@@ -417,7 +417,7 @@ + # Bounded pointer thunks are only built for *.ob + elide-bp-thunks = $(addprefix $(bppfx),$(bp-thunks)) + +-elide-routines.oS += $(filter-out $(static-only-routines),\ ++elide-routines.oST += $(filter-out $(static-only-routines),\ + $(routines) $(aux) $(sysdep_routines)) \ + $(elide-bp-thunks) + elide-routines.os += $(static-only-routines) $(elide-bp-thunks) +@@ -981,7 +981,7 @@ + install: $(inst_libdir)/libc.so + $(inst_libdir)/libc.so: $(common-objpfx)format.lds \ + $(common-objpfx)libc.so$(libc.so-version) \ +- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ ++ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ + $(libprefix)$(libc-name)) \ + $(+force) + (echo '/* GNU ld script';\ +@@ -989,7 +989,7 @@ + echo ' the static library, so try that secondarily. */';\ + cat $<; \ + echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \ +- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\ ++ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)$(libc-name))'\ + ' AS_NEEDED (' $(slibdir)/$(rtld-installed-name) ') )' \ + ) > $@.new + mv -f $@.new $@ +diff -aur glibc-2.3.5/extra-lib.mk glibc-2.3.5-cygwin/extra-lib.mk +--- glibc-2.3.5/extra-lib.mk 2004-12-02 23:54:47.000000000 +0100 ++++ glibc-2.3.5-cygwin/extra-lib.mk 2005-05-11 08:27:28.156250000 +0200 +@@ -13,7 +13,7 @@ + + ifneq (,$($(lib)-static-only-routines)) + ifneq (,$(filter yesyes%,$(build-shared)$(elf)$($(lib).so-version))) +-object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oS) ++object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oST) + endif + endif + +@@ -29,7 +29,7 @@ + + # Add each flavor of library to the lists of things to build and install. + install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o))) +-extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\ ++extra-objs += $(foreach o,$(filter-out .os .oST,$(object-suffixes-$(lib))),\ + $(patsubst %,%$o,$(filter-out \ + $($(lib)-shared-only-routines),\ + $(all-$(lib)-routines)))) +@@ -57,7 +57,7 @@ + + + # Use o-iterator.mk to generate a rule for each flavor of library. +-ifneq (,$(filter-out .os .oS,$(object-suffixes-$(lib)))) ++ifneq (,$(filter-out .os .oST,$(object-suffixes-$(lib)))) + define o-iterator-doit + $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \ + $(patsubst %,$(objpfx)%$o,\ +@@ -65,7 +65,7 @@ + $(all-$(lib)-routines))); \ + $$(build-extra-lib) + endef +-object-suffixes-left = $(filter-out .os .oS,$(object-suffixes-$(lib))) ++object-suffixes-left = $(filter-out .os .oST,$(object-suffixes-$(lib))) + include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left)) + endif + +@@ -77,9 +77,9 @@ + $(build-extra-lib) + endif + +-ifneq (,$(filter .oS,$(object-suffixes-$(lib)))) +-$(objpfx)$(patsubst %,$(libtype.oS),$(lib:lib%=%)): \ +- $(patsubst %,$(objpfx)%.oS,\ ++ifneq (,$(filter .oST,$(object-suffixes-$(lib)))) ++$(objpfx)$(patsubst %,$(libtype.oST),$(lib:lib%=%)): \ ++ $(patsubst %,$(objpfx)%.oST,\ + $(filter $($(lib)-static-only-routines),\ + $(all-$(lib)-routines))) + $(build-extra-lib) +diff -aur glibc-2.3.5/nptl/Makefile glibc-2.3.5-cygwin/nptl/Makefile +--- glibc-2.3.5/nptl/Makefile 2005-02-16 09:45:56.000000000 +0100 ++++ glibc-2.3.5-cygwin/nptl/Makefile 2005-05-11 08:26:01.812500000 +0200 +@@ -375,7 +375,7 @@ + + $(inst_libdir)/libpthread.so: $(common-objpfx)format.lds \ + $(objpfx)libpthread.so$(libpthread.so-version) \ +- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ ++ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ + $(libprefix)pthread) \ + $(+force) + (echo '/* GNU ld script';\ +@@ -383,7 +383,7 @@ + echo ' the static library, so try that secondarily. */';\ + cat $<; \ + echo 'GROUP ( $(slibdir)/libpthread.so$(libpthread.so-version)' \ +- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)pthread)'\ ++ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)pthread)'\ + ')' \ + ) > $@.new + mv -f $@.new $@ +diff -aur glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile +--- glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile 2004-08-16 08:46:14.000000000 +0200 ++++ glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile 2005-05-11 08:26:25.937500000 +0200 +@@ -10,4 +10,4 @@ + ASFLAGS-.op += -Wa,-Av9a + ASFLAGS-.og += -Wa,-Av9a + ASFLAGS-.ob += -Wa,-Av9a +-ASFLAGS-.oS += -Wa,-Av9a ++ASFLAGS-.oST += -Wa,-Av9a + +Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.6.1/110-configure-apple-as.patch b/patches/glibc/2.6.1/110-configure-apple-as.patch new file mode 100644 index 0000000..78a1324 --- /dev/null +++ b/patches/glibc/2.6.1/110-configure-apple-as.patch @@ -0,0 +1,25 @@ +http://in3www.epfl.ch/~schaffne/glibc-configure-apple-as.patch +http://sources.redhat.com/ml/crossgcc/2004-02/msg00151.html + +The following makes it possible to configure glibc-2.3.2 on Mac OS X, +where the assembler but doesn't understand the --version flag. + +Fixes the symptom +checking whether ld is GNU ld... no +checking for /usr/libexec/gcc/darwin/ppc/as... /usr/libexec/gcc/darwin/ppc/as +checking version of /usr/libexec/gcc/darwin/ppc/as... + + +--- glibc-2.3.2/configure~ Wed Feb 26 09:20:48 2003 ++++ glibc-2.3.2/configure Fri Feb 27 13:12:53 2004 +@@ -4039,7 +4039,7 @@ + # Found it, now check the version. + echo "$as_me:$LINENO: checking version of $AS" >&5 + echo $ECHO_N "checking version of $AS... $ECHO_C" >&6 +- ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` ++ ac_prog_version=`$AS -v &1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 2.1[3-9]*) + +Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.6.1/120-cygwin.patch b/patches/glibc/2.6.1/120-cygwin.patch deleted file mode 100644 index 3c0cd7d..0000000 --- a/patches/glibc/2.6.1/120-cygwin.patch +++ /dev/null @@ -1,187 +0,0 @@ -Fixes -elf/librtld.os: In function `process_envvars': : undefined reference to `__access' -... -when building glibc-2.3.x on cygwin - -Idea from -http://sources.redhat.com/ml/bug-glibc/2002-01/msg00071/glibc-2.2-cygin-shared.patch -Basically, make glibc use .oST as suffix for 'object static' -instead of .oS, since cygwin has trouble distinguishing .os from .oS -(Original patch had .on, but .oST is more mnemonic for 'object static') - -glibc-linuxthreads-2.3.5 also requires a patch, see -../glibc-linuxthreads-2.3.5/glibc-linuxthreads-2.3.5-cygwin.patch - -[ forward ported to glibc-2.3.5 by Petr Cvachoucek: - -Message-ID: <4282FCBA.3040000@unicontrols.cz> -Date: Thu, 12 May 2005 08:50:34 +0200 -From: Petr Cvachoucek -To: Dan Kegel -CC: crossgcc@sources.redhat.com -Subject: Patches to build gcc 3.4.3 / glibc 2.3.5 on cygwin - -Hi Dan, -following patches are needed to build gcc-3.4.3/glibc-2.3.5 toolchain -on cygwin. Tested to build toolchains for powerpc 604 and 750 targets. - --- - Petr Cvachoucek - Unicontrols a.s. - http://www.unicontrols.cz -] - -diff -aur glibc-2.3.5/Makeconfig glibc-2.3.5-cygwin/Makeconfig ---- glibc-2.3.5/Makeconfig 2005-02-16 11:50:19.000000000 +0100 -+++ glibc-2.3.5-cygwin/Makeconfig 2005-05-11 08:24:51.046875000 +0200 -@@ -472,7 +472,7 @@ - # run the linked programs. - link-libc = -Wl,-rpath-link=$(rpath-link) \ - $(common-objpfx)libc.so$(libc.so-version) \ -- $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib) -+ $(common-objpfx)$(patsubst %,$(libtype.oST),c) $(gnulib) - # This is how to find at build-time things that will be installed there. - rpath-dirs = math elf dlfcn nss nis rt resolv crypt - endif -@@ -693,7 +693,7 @@ - # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX}) - # to pass different flags for each flavor. - libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o)) --all-object-suffixes := .o .os .op .og .ob .oS -+all-object-suffixes := .o .os .op .og .ob .oST - object-suffixes := - CPPFLAGS-.o = $(pic-default) - CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) -@@ -749,14 +749,14 @@ - - ifeq (yes,$(build-shared)) - # Build special library that contains the static-only routines for libc. --object-suffixes-for-libc += .oS -+object-suffixes-for-libc += .oST - - # Must build the routines as PIC, though, because they can end up in (users') - # shared objects. We don't want to use CFLAGS-os because users may, for - # example, make that processor-specific. --CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag) --CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 --libtype.oS = lib%_nonshared.a -+CFLAGS-.oST = $(CFLAGS-.o) $(PIC-ccflag) -+CPPFLAGS-.oST = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 -+libtype.oST = lib%_nonshared.a - endif - - # The assembler can generate debug information too. -diff -aur glibc-2.3.5/Makerules glibc-2.3.5-cygwin/Makerules ---- glibc-2.3.5/Makerules 2004-12-15 19:52:39.000000000 +0100 -+++ glibc-2.3.5-cygwin/Makerules 2005-05-11 08:25:33.578125000 +0200 -@@ -417,7 +417,7 @@ - # Bounded pointer thunks are only built for *.ob - elide-bp-thunks = $(addprefix $(bppfx),$(bp-thunks)) - --elide-routines.oS += $(filter-out $(static-only-routines),\ -+elide-routines.oST += $(filter-out $(static-only-routines),\ - $(routines) $(aux) $(sysdep_routines)) \ - $(elide-bp-thunks) - elide-routines.os += $(static-only-routines) $(elide-bp-thunks) -@@ -981,7 +981,7 @@ - install: $(inst_libdir)/libc.so - $(inst_libdir)/libc.so: $(common-objpfx)format.lds \ - $(common-objpfx)libc.so$(libc.so-version) \ -- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ -+ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ - $(libprefix)$(libc-name)) \ - $(+force) - (echo '/* GNU ld script';\ -@@ -989,7 +989,7 @@ - echo ' the static library, so try that secondarily. */';\ - cat $<; \ - echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \ -- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\ -+ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)$(libc-name))'\ - ' AS_NEEDED (' $(slibdir)/$(rtld-installed-name) ') )' \ - ) > $@.new - mv -f $@.new $@ -diff -aur glibc-2.3.5/extra-lib.mk glibc-2.3.5-cygwin/extra-lib.mk ---- glibc-2.3.5/extra-lib.mk 2004-12-02 23:54:47.000000000 +0100 -+++ glibc-2.3.5-cygwin/extra-lib.mk 2005-05-11 08:27:28.156250000 +0200 -@@ -13,7 +13,7 @@ - - ifneq (,$($(lib)-static-only-routines)) - ifneq (,$(filter yesyes%,$(build-shared)$(elf)$($(lib).so-version))) --object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oS) -+object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oST) - endif - endif - -@@ -29,7 +29,7 @@ - - # Add each flavor of library to the lists of things to build and install. - install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o))) --extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\ -+extra-objs += $(foreach o,$(filter-out .os .oST,$(object-suffixes-$(lib))),\ - $(patsubst %,%$o,$(filter-out \ - $($(lib)-shared-only-routines),\ - $(all-$(lib)-routines)))) -@@ -57,7 +57,7 @@ - - - # Use o-iterator.mk to generate a rule for each flavor of library. --ifneq (,$(filter-out .os .oS,$(object-suffixes-$(lib)))) -+ifneq (,$(filter-out .os .oST,$(object-suffixes-$(lib)))) - define o-iterator-doit - $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \ - $(patsubst %,$(objpfx)%$o,\ -@@ -65,7 +65,7 @@ - $(all-$(lib)-routines))); \ - $$(build-extra-lib) - endef --object-suffixes-left = $(filter-out .os .oS,$(object-suffixes-$(lib))) -+object-suffixes-left = $(filter-out .os .oST,$(object-suffixes-$(lib))) - include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left)) - endif - -@@ -77,9 +77,9 @@ - $(build-extra-lib) - endif - --ifneq (,$(filter .oS,$(object-suffixes-$(lib)))) --$(objpfx)$(patsubst %,$(libtype.oS),$(lib:lib%=%)): \ -- $(patsubst %,$(objpfx)%.oS,\ -+ifneq (,$(filter .oST,$(object-suffixes-$(lib)))) -+$(objpfx)$(patsubst %,$(libtype.oST),$(lib:lib%=%)): \ -+ $(patsubst %,$(objpfx)%.oST,\ - $(filter $($(lib)-static-only-routines),\ - $(all-$(lib)-routines))) - $(build-extra-lib) -diff -aur glibc-2.3.5/nptl/Makefile glibc-2.3.5-cygwin/nptl/Makefile ---- glibc-2.3.5/nptl/Makefile 2005-02-16 09:45:56.000000000 +0100 -+++ glibc-2.3.5-cygwin/nptl/Makefile 2005-05-11 08:26:01.812500000 +0200 -@@ -375,7 +375,7 @@ - - $(inst_libdir)/libpthread.so: $(common-objpfx)format.lds \ - $(objpfx)libpthread.so$(libpthread.so-version) \ -- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ -+ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ - $(libprefix)pthread) \ - $(+force) - (echo '/* GNU ld script';\ -@@ -383,7 +383,7 @@ - echo ' the static library, so try that secondarily. */';\ - cat $<; \ - echo 'GROUP ( $(slibdir)/libpthread.so$(libpthread.so-version)' \ -- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)pthread)'\ -+ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)pthread)'\ - ')' \ - ) > $@.new - mv -f $@.new $@ -diff -aur glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile ---- glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile 2004-08-16 08:46:14.000000000 +0200 -+++ glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile 2005-05-11 08:26:25.937500000 +0200 -@@ -10,4 +10,4 @@ - ASFLAGS-.op += -Wa,-Av9a - ASFLAGS-.og += -Wa,-Av9a - ASFLAGS-.ob += -Wa,-Av9a --ASFLAGS-.oS += -Wa,-Av9a -+ASFLAGS-.oST += -Wa,-Av9a - -Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.6.1/120-fix-pr631.patch b/patches/glibc/2.6.1/120-fix-pr631.patch new file mode 100644 index 0000000..13688df --- /dev/null +++ b/patches/glibc/2.6.1/120-fix-pr631.patch @@ -0,0 +1,45 @@ +From dank@kegel.com +Wed Jun 15 09:12:43 PDT 2005 + +Fixes + +build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r' +build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent' +... 53 lines deleted ... +build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r' +collect2: ld returned 1 exit status +make[2]: *** [/build/gcc-3.4.3-glibc-2.3.5-hdrs-2.6.11.2/i686-unknown-linux-gnu/build-glibc/elf/ldconfig] Error 1 + +when building glibc with --enable-static-nss. + +See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631 + +--- glibc-2.3.5/Makeconfig.old Wed Jun 15 08:13:12 2005 ++++ glibc-2.3.5/Makeconfig Wed Jun 15 08:13:14 2005 +@@ -510,7 +510,7 @@ + + # The static libraries. + ifeq (yes,$(build-static)) +-link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a ++link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a + else + ifeq (yes,$(build-shared)) + # We can try to link the programs with lib*_pic.a... +--- glibc-2.3.5/elf/Makefile.old Wed Jun 15 07:46:49 2005 ++++ glibc-2.3.5/elf/Makefile Wed Jun 15 08:14:00 2005 +@@ -120,6 +120,13 @@ + install-bin-script = ldd + endif + ++ifeq (yes,$(build-static-nss)) ++nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) ++resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv) ++otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ ++ $(resolvobjdir)/libresolv.a ++endif ++ + others = sprof sln + install-bin = sprof + others-static = sln + +Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.6.1/130-i686-assembler.patch b/patches/glibc/2.6.1/130-i686-assembler.patch new file mode 100644 index 0000000..9904efb --- /dev/null +++ b/patches/glibc/2.6.1/130-i686-assembler.patch @@ -0,0 +1,38 @@ +2007-02-15 Khem Raj + + * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686. + * nptl/sysdeps/pthread/pt-initfini.c: Ditto. + + + +Index: glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h +=================================================================== +--- glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (revision 1469) ++++ glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (working copy) +@@ -29,6 +29,10 @@ + #include + #include + ++#if defined __i686 && defined __ASSEMBLER__ ++#undef __i686 ++#define __i686 __i686 ++#endif + + /* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h +Index: glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c +=================================================================== +--- glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (revision 1469) ++++ glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (working copy) +@@ -45,6 +45,11 @@ + /* Embed an #include to pull in the alignment and .end directives. */ + asm ("\n#include \"defs.h\""); + ++asm ("\n#if defined __i686 && defined __ASSEMBLER__"); ++asm ("\n#undef __i686"); ++asm ("\n#define __i686 __i686"); ++asm ("\n#endif"); ++ + /* The initial common code ends here. */ + asm ("\n/*@HEADER_ENDS*/"); + diff --git a/patches/glibc/2.6.1/140-configure-apple-as.patch b/patches/glibc/2.6.1/140-configure-apple-as.patch deleted file mode 100644 index 78a1324..0000000 --- a/patches/glibc/2.6.1/140-configure-apple-as.patch +++ /dev/null @@ -1,25 +0,0 @@ -http://in3www.epfl.ch/~schaffne/glibc-configure-apple-as.patch -http://sources.redhat.com/ml/crossgcc/2004-02/msg00151.html - -The following makes it possible to configure glibc-2.3.2 on Mac OS X, -where the assembler but doesn't understand the --version flag. - -Fixes the symptom -checking whether ld is GNU ld... no -checking for /usr/libexec/gcc/darwin/ppc/as... /usr/libexec/gcc/darwin/ppc/as -checking version of /usr/libexec/gcc/darwin/ppc/as... - - ---- glibc-2.3.2/configure~ Wed Feb 26 09:20:48 2003 -+++ glibc-2.3.2/configure Fri Feb 27 13:12:53 2004 -@@ -4039,7 +4039,7 @@ - # Found it, now check the version. - echo "$as_me:$LINENO: checking version of $AS" >&5 - echo $ECHO_N "checking version of $AS... $ECHO_C" >&6 -- ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` -+ ac_prog_version=`$AS -v &1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` - case $ac_prog_version in - '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 2.1[3-9]*) - -Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.6.1/140-i386-preferred-stack-boundary.patch b/patches/glibc/2.6.1/140-i386-preferred-stack-boundary.patch new file mode 100644 index 0000000..449821d --- /dev/null +++ b/patches/glibc/2.6.1/140-i386-preferred-stack-boundary.patch @@ -0,0 +1,18 @@ +(C) 2007 Yann E. MORIN +License: LGPL v2.1 + +Shut off a stupid warning: preffered-stack-boundary must be between 4 ad 12, +and 2 is not. + +diff -dur glibc-2.5.orig/sysdeps/i386/Makefile glibc-2.5/sysdeps/i386/Makefile +--- glibc-2.5.orig/sysdeps/i386/Makefile 2005-03-06 01:18:16.000000000 +0100 ++++ glibc-2.5/sysdeps/i386/Makefile 2007-05-27 17:49:37.000000000 +0200 +@@ -36,7 +36,7 @@ + ifeq ($(subdir),csu) + sysdep-CFLAGS += -mpreferred-stack-boundary=4 + else +-sysdep-CFLAGS += -mpreferred-stack-boundary=2 ++sysdep-CFLAGS += -mpreferred-stack-boundary=4 + # Likewise, any function which calls user callbacks + uses-callbacks += -mpreferred-stack-boundary=4 + # Likewise, any stack alignment tests diff --git a/patches/glibc/2.6.1/150-alpha-asm_page.patch b/patches/glibc/2.6.1/150-alpha-asm_page.patch new file mode 100644 index 0000000..b198b36 --- /dev/null +++ b/patches/glibc/2.6.1/150-alpha-asm_page.patch @@ -0,0 +1,26 @@ +2008-06-07 Mike Frysinger + + * sysdeps/unix/sysv/linux/alpha/sys/user.h: Copy page.h definitions + from the kernel header to sys/user.h and remove the #include of + sys/user.h. + +--- a/sysdeps/unix/sysv/linux/alpha/sys/user.h ++++ b/sysdeps/unix/sysv/linux/alpha/sys/user.h +@@ -23,7 +23,6 @@ + only. Don't read too much into it. Don't use it for anything other + than gdb/strace unless you know what you are doing. */ + +-#include + #include + + struct user +@@ -41,6 +40,9 @@ struct user + char u_comm[32]; /* user command name */ + }; + ++#define PAGE_SHIFT 13 ++#define PAGE_SIZE (1 << PAGE_SHIFT) ++#define PAGE_MASK (~(PAGE_SIZE-1)) + #define NBPG PAGE_SIZE + #define UPAGES 1 + #define HOST_TEXT_START_ADDR (u.start_code) diff --git a/patches/glibc/2.6.1/150-fix-pr631.patch b/patches/glibc/2.6.1/150-fix-pr631.patch deleted file mode 100644 index 13688df..0000000 --- a/patches/glibc/2.6.1/150-fix-pr631.patch +++ /dev/null @@ -1,45 +0,0 @@ -From dank@kegel.com -Wed Jun 15 09:12:43 PDT 2005 - -Fixes - -build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r' -build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent' -... 53 lines deleted ... -build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r' -collect2: ld returned 1 exit status -make[2]: *** [/build/gcc-3.4.3-glibc-2.3.5-hdrs-2.6.11.2/i686-unknown-linux-gnu/build-glibc/elf/ldconfig] Error 1 - -when building glibc with --enable-static-nss. - -See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631 - ---- glibc-2.3.5/Makeconfig.old Wed Jun 15 08:13:12 2005 -+++ glibc-2.3.5/Makeconfig Wed Jun 15 08:13:14 2005 -@@ -510,7 +510,7 @@ - - # The static libraries. - ifeq (yes,$(build-static)) --link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a -+link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a - else - ifeq (yes,$(build-shared)) - # We can try to link the programs with lib*_pic.a... ---- glibc-2.3.5/elf/Makefile.old Wed Jun 15 07:46:49 2005 -+++ glibc-2.3.5/elf/Makefile Wed Jun 15 08:14:00 2005 -@@ -120,6 +120,13 @@ - install-bin-script = ldd - endif - -+ifeq (yes,$(build-static-nss)) -+nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) -+resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv) -+otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ -+ $(resolvobjdir)/libresolv.a -+endif -+ - others = sprof sln - install-bin = sprof - others-static = sln - -Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.6.1/160-i686-assembler.patch b/patches/glibc/2.6.1/160-i686-assembler.patch deleted file mode 100644 index 9904efb..0000000 --- a/patches/glibc/2.6.1/160-i686-assembler.patch +++ /dev/null @@ -1,38 +0,0 @@ -2007-02-15 Khem Raj - - * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686. - * nptl/sysdeps/pthread/pt-initfini.c: Ditto. - - - -Index: glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h -=================================================================== ---- glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (revision 1469) -+++ glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (working copy) -@@ -29,6 +29,10 @@ - #include - #include - -+#if defined __i686 && defined __ASSEMBLER__ -+#undef __i686 -+#define __i686 __i686 -+#endif - - /* For Linux we can use the system call table in the header file - /usr/include/asm/unistd.h -Index: glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c -=================================================================== ---- glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (revision 1469) -+++ glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (working copy) -@@ -45,6 +45,11 @@ - /* Embed an #include to pull in the alignment and .end directives. */ - asm ("\n#include \"defs.h\""); - -+asm ("\n#if defined __i686 && defined __ASSEMBLER__"); -+asm ("\n#undef __i686"); -+asm ("\n#define __i686 __i686"); -+asm ("\n#endif"); -+ - /* The initial common code ends here. */ - asm ("\n/*@HEADER_ENDS*/"); - diff --git a/patches/glibc/2.6.1/160-use_short_for_fnstsw.patch b/patches/glibc/2.6.1/160-use_short_for_fnstsw.patch new file mode 100644 index 0000000..0e849fa --- /dev/null +++ b/patches/glibc/2.6.1/160-use_short_for_fnstsw.patch @@ -0,0 +1,18 @@ +Original patch from H.J. Lu, as reported there: +http://www.nabble.com/PATCH:-Use-short-for-fnstsw-td14775171.html + +fnstsw stores 16bit into %ax. The upper 16bit of %eax is unchanged. +The new assembler (binutils-2.18.50.0.4 and up) will disallow "fnstsw %eax". + +diff -dur glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c +--- glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c 2004-03-05 11:14:48.000000000 +0100 ++++ glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c 2008-06-24 10:56:14.000000000 +0200 +@@ -26,7 +26,7 @@ + int + fetestexcept (int excepts) + { +- int temp; ++ short temp; + int xtemp = 0; + + /* Get current exceptions. */ diff --git a/patches/glibc/2.6.1/170-alpha-asm_elf.patch b/patches/glibc/2.6.1/170-alpha-asm_elf.patch new file mode 100644 index 0000000..3da5c8e --- /dev/null +++ b/patches/glibc/2.6.1/170-alpha-asm_elf.patch @@ -0,0 +1,194 @@ +since the kernel no longer provides asm/elf.h, the sys/procfs.h from the +common code, alpha, and sh fail when used. this should things up. +-mike + +2008-06-07 Mike Frysinger + + * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. + * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h + definitions from the kernel header to sys/procfs.h and remove the + #include of asm/elf.h. + * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. + +*Attachment: signature.asc * +/Description:/ This is a digitally signed message part. + +2008-06-07 Mike Frysinger + + * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. + * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h + definitions from the kernel header to sys/procfs.h and remove the + #include of asm/elf.h. + * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. + +--- a/sysdeps/unix/sysv/linux/alpha/sys/procfs.h ++++ b/sysdeps/unix/sysv/linux/alpha/sys/procfs.h +@@ -29,10 +29,23 @@ + #include + #include + #include +-#include + + __BEGIN_DECLS + ++/* ++ * The OSF/1 version of makes gregset_t 46 entries long. ++ * I have no idea why that is so. For now, we just leave it at 33 ++ * (32 general regs + processor status word). ++ */ ++#define ELF_NGREG 33 ++#define ELF_NFPREG 32 ++ ++typedef unsigned long elf_greg_t; ++typedef elf_greg_t elf_gregset_t[ELF_NGREG]; ++ ++typedef double elf_fpreg_t; ++typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; ++ + struct elf_siginfo + { + int si_signo; /* Signal number. */ +--- a/sysdeps/unix/sysv/linux/sh/sys/procfs.h ++++ b/sysdeps/unix/sysv/linux/sh/sys/procfs.h +@@ -29,10 +29,19 @@ + #include + #include + #include +-#include + + __BEGIN_DECLS + ++/* ++ * ELF register definitions... ++ */ ++typedef unsigned long elf_greg_t; ++ ++#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) ++typedef elf_greg_t elf_gregset_t[ELF_NGREG]; ++ ++typedef struct user_fpu_struct elf_fpregset_t; ++ + struct elf_siginfo + { + int si_signo; /* Signal number. */ +--- a/sysdeps/unix/sysv/linux/sys/procfs.h ++++ b/sysdeps/unix/sysv/linux/sys/procfs.h +@@ -1,115 +1,2 @@ +-/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- +- The GNU C Library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- The GNU C 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 +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with the GNU C Library; if not, write to the Free +- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +- 02111-1307 USA. */ +- +-#ifndef _SYS_PROCFS_H +-#define _SYS_PROCFS_H 1 +- +-/* This is somehow modelled after the file of the same name on SysVr4 +- systems. It provides a definition of the core file format for ELF +- used on Linux. */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-__BEGIN_DECLS +- +-struct elf_siginfo +- { +- int si_signo; /* Signal number. */ +- int si_code; /* Extra code. */ +- int si_errno; /* Errno. */ +- }; +- +-/* Definitions to generate Intel SVR4-like core files. These mostly +- have the same names as the SVR4 types with "elf_" tacked on the +- front to prevent clashes with linux definitions, and the typedef +- forms have been avoided. This is mostly like the SVR4 structure, +- but more Linuxy, with things that Linux does not support and which +- gdb doesn't really use excluded. Fields present but not used are +- marked with "XXX". */ +-struct elf_prstatus +- { +-#if 0 +- long int pr_flags; /* XXX Process flags. */ +- short int pr_why; /* XXX Reason for process halt. */ +- short int pr_what; /* XXX More detailed reason. */ +-#endif +- struct elf_siginfo pr_info; /* Info associated with signal. */ +- short int pr_cursig; /* Current signal. */ +- unsigned long int pr_sigpend; /* Set of pending signals. */ +- unsigned long int pr_sighold; /* Set of held signals. */ +-#if 0 +- struct sigaltstack pr_altstack; /* Alternate stack info. */ +- struct sigaction pr_action; /* Signal action for current sig. */ +-#endif +- __pid_t pr_pid; +- __pid_t pr_ppid; +- __pid_t pr_pgrp; +- __pid_t pr_sid; +- struct timeval pr_utime; /* User time. */ +- struct timeval pr_stime; /* System time. */ +- struct timeval pr_cutime; /* Cumulative user time. */ +- struct timeval pr_cstime; /* Cumulative system time. */ +-#if 0 +- long int pr_instr; /* Current instruction. */ +-#endif +- elf_gregset_t pr_reg; /* GP registers. */ +- int pr_fpvalid; /* True if math copro being used. */ +- }; +- +- +-#define ELF_PRARGSZ (80) /* Number of chars for args */ +- +-struct elf_prpsinfo +- { +- char pr_state; /* Numeric process state. */ +- char pr_sname; /* Char for pr_state. */ +- char pr_zomb; /* Zombie. */ +- char pr_nice; /* Nice val. */ +- unsigned long int pr_flag; /* Flags. */ +- unsigned short int pr_uid; +- unsigned short int pr_gid; +- int pr_pid, pr_ppid, pr_pgrp, pr_sid; +- /* Lots missing */ +- char pr_fname[16]; /* Filename of executable. */ +- char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ +- }; +- +-/* Addresses. */ +-typedef void *psaddr_t; +- +-/* Register sets. Linux has different names. */ +-typedef gregset_t prgregset_t; +-typedef fpregset_t prfpregset_t; +- +-/* We don't have any differences between processes and threads, +- therefore habe only ine PID type. */ +-typedef __pid_t lwpid_t; +- +- +-typedef struct elf_prstatus prstatus_t; +-typedef struct elf_prpsinfo prpsinfo_t; +- +-__END_DECLS +- +-#endif /* sys/procfs.h */ ++/* sys/procfs.h is architecture specific. */ ++#error "This file must be supplied by every Linux architecture." + diff --git a/patches/glibc/2.6.1/170-i386-preferred-stack-boundary.patch b/patches/glibc/2.6.1/170-i386-preferred-stack-boundary.patch deleted file mode 100644 index 449821d..0000000 --- a/patches/glibc/2.6.1/170-i386-preferred-stack-boundary.patch +++ /dev/null @@ -1,18 +0,0 @@ -(C) 2007 Yann E. MORIN -License: LGPL v2.1 - -Shut off a stupid warning: preffered-stack-boundary must be between 4 ad 12, -and 2 is not. - -diff -dur glibc-2.5.orig/sysdeps/i386/Makefile glibc-2.5/sysdeps/i386/Makefile ---- glibc-2.5.orig/sysdeps/i386/Makefile 2005-03-06 01:18:16.000000000 +0100 -+++ glibc-2.5/sysdeps/i386/Makefile 2007-05-27 17:49:37.000000000 +0200 -@@ -36,7 +36,7 @@ - ifeq ($(subdir),csu) - sysdep-CFLAGS += -mpreferred-stack-boundary=4 - else --sysdep-CFLAGS += -mpreferred-stack-boundary=2 -+sysdep-CFLAGS += -mpreferred-stack-boundary=4 - # Likewise, any function which calls user callbacks - uses-callbacks += -mpreferred-stack-boundary=4 - # Likewise, any stack alignment tests diff --git a/patches/glibc/2.6.1/180-alpha-asm_page.patch b/patches/glibc/2.6.1/180-alpha-asm_page.patch deleted file mode 100644 index b198b36..0000000 --- a/patches/glibc/2.6.1/180-alpha-asm_page.patch +++ /dev/null @@ -1,26 +0,0 @@ -2008-06-07 Mike Frysinger - - * sysdeps/unix/sysv/linux/alpha/sys/user.h: Copy page.h definitions - from the kernel header to sys/user.h and remove the #include of - sys/user.h. - ---- a/sysdeps/unix/sysv/linux/alpha/sys/user.h -+++ b/sysdeps/unix/sysv/linux/alpha/sys/user.h -@@ -23,7 +23,6 @@ - only. Don't read too much into it. Don't use it for anything other - than gdb/strace unless you know what you are doing. */ - --#include - #include - - struct user -@@ -41,6 +40,9 @@ struct user - char u_comm[32]; /* user command name */ - }; - -+#define PAGE_SHIFT 13 -+#define PAGE_SIZE (1 << PAGE_SHIFT) -+#define PAGE_MASK (~(PAGE_SIZE-1)) - #define NBPG PAGE_SIZE - #define UPAGES 1 - #define HOST_TEXT_START_ADDR (u.start_code) diff --git a/patches/glibc/2.6.1/190-use_short_for_fnstsw.patch b/patches/glibc/2.6.1/190-use_short_for_fnstsw.patch deleted file mode 100644 index 0e849fa..0000000 --- a/patches/glibc/2.6.1/190-use_short_for_fnstsw.patch +++ /dev/null @@ -1,18 +0,0 @@ -Original patch from H.J. Lu, as reported there: -http://www.nabble.com/PATCH:-Use-short-for-fnstsw-td14775171.html - -fnstsw stores 16bit into %ax. The upper 16bit of %eax is unchanged. -The new assembler (binutils-2.18.50.0.4 and up) will disallow "fnstsw %eax". - -diff -dur glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c ---- glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c 2004-03-05 11:14:48.000000000 +0100 -+++ glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c 2008-06-24 10:56:14.000000000 +0200 -@@ -26,7 +26,7 @@ - int - fetestexcept (int excepts) - { -- int temp; -+ short temp; - int xtemp = 0; - - /* Get current exceptions. */ diff --git a/patches/glibc/2.6.1/200-alpha-asm_elf.patch b/patches/glibc/2.6.1/200-alpha-asm_elf.patch deleted file mode 100644 index 3da5c8e..0000000 --- a/patches/glibc/2.6.1/200-alpha-asm_elf.patch +++ /dev/null @@ -1,194 +0,0 @@ -since the kernel no longer provides asm/elf.h, the sys/procfs.h from the -common code, alpha, and sh fail when used. this should things up. --mike - -2008-06-07 Mike Frysinger - - * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. - * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h - definitions from the kernel header to sys/procfs.h and remove the - #include of asm/elf.h. - * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. - -*Attachment: signature.asc * -/Description:/ This is a digitally signed message part. - -2008-06-07 Mike Frysinger - - * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. - * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h - definitions from the kernel header to sys/procfs.h and remove the - #include of asm/elf.h. - * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. - ---- a/sysdeps/unix/sysv/linux/alpha/sys/procfs.h -+++ b/sysdeps/unix/sysv/linux/alpha/sys/procfs.h -@@ -29,10 +29,23 @@ - #include - #include - #include --#include - - __BEGIN_DECLS - -+/* -+ * The OSF/1 version of makes gregset_t 46 entries long. -+ * I have no idea why that is so. For now, we just leave it at 33 -+ * (32 general regs + processor status word). -+ */ -+#define ELF_NGREG 33 -+#define ELF_NFPREG 32 -+ -+typedef unsigned long elf_greg_t; -+typedef elf_greg_t elf_gregset_t[ELF_NGREG]; -+ -+typedef double elf_fpreg_t; -+typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; -+ - struct elf_siginfo - { - int si_signo; /* Signal number. */ ---- a/sysdeps/unix/sysv/linux/sh/sys/procfs.h -+++ b/sysdeps/unix/sysv/linux/sh/sys/procfs.h -@@ -29,10 +29,19 @@ - #include - #include - #include --#include - - __BEGIN_DECLS - -+/* -+ * ELF register definitions... -+ */ -+typedef unsigned long elf_greg_t; -+ -+#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) -+typedef elf_greg_t elf_gregset_t[ELF_NGREG]; -+ -+typedef struct user_fpu_struct elf_fpregset_t; -+ - struct elf_siginfo - { - int si_signo; /* Signal number. */ ---- a/sysdeps/unix/sysv/linux/sys/procfs.h -+++ b/sysdeps/unix/sysv/linux/sys/procfs.h -@@ -1,115 +1,2 @@ --/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- -- The GNU C 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 -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, write to the Free -- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -- 02111-1307 USA. */ -- --#ifndef _SYS_PROCFS_H --#define _SYS_PROCFS_H 1 -- --/* This is somehow modelled after the file of the same name on SysVr4 -- systems. It provides a definition of the core file format for ELF -- used on Linux. */ -- --#include --#include --#include --#include --#include --#include --#include -- --__BEGIN_DECLS -- --struct elf_siginfo -- { -- int si_signo; /* Signal number. */ -- int si_code; /* Extra code. */ -- int si_errno; /* Errno. */ -- }; -- --/* Definitions to generate Intel SVR4-like core files. These mostly -- have the same names as the SVR4 types with "elf_" tacked on the -- front to prevent clashes with linux definitions, and the typedef -- forms have been avoided. This is mostly like the SVR4 structure, -- but more Linuxy, with things that Linux does not support and which -- gdb doesn't really use excluded. Fields present but not used are -- marked with "XXX". */ --struct elf_prstatus -- { --#if 0 -- long int pr_flags; /* XXX Process flags. */ -- short int pr_why; /* XXX Reason for process halt. */ -- short int pr_what; /* XXX More detailed reason. */ --#endif -- struct elf_siginfo pr_info; /* Info associated with signal. */ -- short int pr_cursig; /* Current signal. */ -- unsigned long int pr_sigpend; /* Set of pending signals. */ -- unsigned long int pr_sighold; /* Set of held signals. */ --#if 0 -- struct sigaltstack pr_altstack; /* Alternate stack info. */ -- struct sigaction pr_action; /* Signal action for current sig. */ --#endif -- __pid_t pr_pid; -- __pid_t pr_ppid; -- __pid_t pr_pgrp; -- __pid_t pr_sid; -- struct timeval pr_utime; /* User time. */ -- struct timeval pr_stime; /* System time. */ -- struct timeval pr_cutime; /* Cumulative user time. */ -- struct timeval pr_cstime; /* Cumulative system time. */ --#if 0 -- long int pr_instr; /* Current instruction. */ --#endif -- elf_gregset_t pr_reg; /* GP registers. */ -- int pr_fpvalid; /* True if math copro being used. */ -- }; -- -- --#define ELF_PRARGSZ (80) /* Number of chars for args */ -- --struct elf_prpsinfo -- { -- char pr_state; /* Numeric process state. */ -- char pr_sname; /* Char for pr_state. */ -- char pr_zomb; /* Zombie. */ -- char pr_nice; /* Nice val. */ -- unsigned long int pr_flag; /* Flags. */ -- unsigned short int pr_uid; -- unsigned short int pr_gid; -- int pr_pid, pr_ppid, pr_pgrp, pr_sid; -- /* Lots missing */ -- char pr_fname[16]; /* Filename of executable. */ -- char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ -- }; -- --/* Addresses. */ --typedef void *psaddr_t; -- --/* Register sets. Linux has different names. */ --typedef gregset_t prgregset_t; --typedef fpregset_t prfpregset_t; -- --/* We don't have any differences between processes and threads, -- therefore habe only ine PID type. */ --typedef __pid_t lwpid_t; -- -- --typedef struct elf_prstatus prstatus_t; --typedef struct elf_prpsinfo prpsinfo_t; -- --__END_DECLS -- --#endif /* sys/procfs.h */ -+/* sys/procfs.h is architecture specific. */ -+#error "This file must be supplied by every Linux architecture." - diff --git a/patches/glibc/2.6/100-cygwin.patch b/patches/glibc/2.6/100-cygwin.patch new file mode 100644 index 0000000..3c0cd7d --- /dev/null +++ b/patches/glibc/2.6/100-cygwin.patch @@ -0,0 +1,187 @@ +Fixes +elf/librtld.os: In function `process_envvars': : undefined reference to `__access' +... +when building glibc-2.3.x on cygwin + +Idea from +http://sources.redhat.com/ml/bug-glibc/2002-01/msg00071/glibc-2.2-cygin-shared.patch +Basically, make glibc use .oST as suffix for 'object static' +instead of .oS, since cygwin has trouble distinguishing .os from .oS +(Original patch had .on, but .oST is more mnemonic for 'object static') + +glibc-linuxthreads-2.3.5 also requires a patch, see +../glibc-linuxthreads-2.3.5/glibc-linuxthreads-2.3.5-cygwin.patch + +[ forward ported to glibc-2.3.5 by Petr Cvachoucek: + +Message-ID: <4282FCBA.3040000@unicontrols.cz> +Date: Thu, 12 May 2005 08:50:34 +0200 +From: Petr Cvachoucek +To: Dan Kegel +CC: crossgcc@sources.redhat.com +Subject: Patches to build gcc 3.4.3 / glibc 2.3.5 on cygwin + +Hi Dan, +following patches are needed to build gcc-3.4.3/glibc-2.3.5 toolchain +on cygwin. Tested to build toolchains for powerpc 604 and 750 targets. + +-- + Petr Cvachoucek + Unicontrols a.s. + http://www.unicontrols.cz +] + +diff -aur glibc-2.3.5/Makeconfig glibc-2.3.5-cygwin/Makeconfig +--- glibc-2.3.5/Makeconfig 2005-02-16 11:50:19.000000000 +0100 ++++ glibc-2.3.5-cygwin/Makeconfig 2005-05-11 08:24:51.046875000 +0200 +@@ -472,7 +472,7 @@ + # run the linked programs. + link-libc = -Wl,-rpath-link=$(rpath-link) \ + $(common-objpfx)libc.so$(libc.so-version) \ +- $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib) ++ $(common-objpfx)$(patsubst %,$(libtype.oST),c) $(gnulib) + # This is how to find at build-time things that will be installed there. + rpath-dirs = math elf dlfcn nss nis rt resolv crypt + endif +@@ -693,7 +693,7 @@ + # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX}) + # to pass different flags for each flavor. + libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o)) +-all-object-suffixes := .o .os .op .og .ob .oS ++all-object-suffixes := .o .os .op .og .ob .oST + object-suffixes := + CPPFLAGS-.o = $(pic-default) + CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) +@@ -749,14 +749,14 @@ + + ifeq (yes,$(build-shared)) + # Build special library that contains the static-only routines for libc. +-object-suffixes-for-libc += .oS ++object-suffixes-for-libc += .oST + + # Must build the routines as PIC, though, because they can end up in (users') + # shared objects. We don't want to use CFLAGS-os because users may, for + # example, make that processor-specific. +-CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag) +-CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 +-libtype.oS = lib%_nonshared.a ++CFLAGS-.oST = $(CFLAGS-.o) $(PIC-ccflag) ++CPPFLAGS-.oST = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 ++libtype.oST = lib%_nonshared.a + endif + + # The assembler can generate debug information too. +diff -aur glibc-2.3.5/Makerules glibc-2.3.5-cygwin/Makerules +--- glibc-2.3.5/Makerules 2004-12-15 19:52:39.000000000 +0100 ++++ glibc-2.3.5-cygwin/Makerules 2005-05-11 08:25:33.578125000 +0200 +@@ -417,7 +417,7 @@ + # Bounded pointer thunks are only built for *.ob + elide-bp-thunks = $(addprefix $(bppfx),$(bp-thunks)) + +-elide-routines.oS += $(filter-out $(static-only-routines),\ ++elide-routines.oST += $(filter-out $(static-only-routines),\ + $(routines) $(aux) $(sysdep_routines)) \ + $(elide-bp-thunks) + elide-routines.os += $(static-only-routines) $(elide-bp-thunks) +@@ -981,7 +981,7 @@ + install: $(inst_libdir)/libc.so + $(inst_libdir)/libc.so: $(common-objpfx)format.lds \ + $(common-objpfx)libc.so$(libc.so-version) \ +- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ ++ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ + $(libprefix)$(libc-name)) \ + $(+force) + (echo '/* GNU ld script';\ +@@ -989,7 +989,7 @@ + echo ' the static library, so try that secondarily. */';\ + cat $<; \ + echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \ +- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\ ++ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)$(libc-name))'\ + ' AS_NEEDED (' $(slibdir)/$(rtld-installed-name) ') )' \ + ) > $@.new + mv -f $@.new $@ +diff -aur glibc-2.3.5/extra-lib.mk glibc-2.3.5-cygwin/extra-lib.mk +--- glibc-2.3.5/extra-lib.mk 2004-12-02 23:54:47.000000000 +0100 ++++ glibc-2.3.5-cygwin/extra-lib.mk 2005-05-11 08:27:28.156250000 +0200 +@@ -13,7 +13,7 @@ + + ifneq (,$($(lib)-static-only-routines)) + ifneq (,$(filter yesyes%,$(build-shared)$(elf)$($(lib).so-version))) +-object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oS) ++object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oST) + endif + endif + +@@ -29,7 +29,7 @@ + + # Add each flavor of library to the lists of things to build and install. + install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o))) +-extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\ ++extra-objs += $(foreach o,$(filter-out .os .oST,$(object-suffixes-$(lib))),\ + $(patsubst %,%$o,$(filter-out \ + $($(lib)-shared-only-routines),\ + $(all-$(lib)-routines)))) +@@ -57,7 +57,7 @@ + + + # Use o-iterator.mk to generate a rule for each flavor of library. +-ifneq (,$(filter-out .os .oS,$(object-suffixes-$(lib)))) ++ifneq (,$(filter-out .os .oST,$(object-suffixes-$(lib)))) + define o-iterator-doit + $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \ + $(patsubst %,$(objpfx)%$o,\ +@@ -65,7 +65,7 @@ + $(all-$(lib)-routines))); \ + $$(build-extra-lib) + endef +-object-suffixes-left = $(filter-out .os .oS,$(object-suffixes-$(lib))) ++object-suffixes-left = $(filter-out .os .oST,$(object-suffixes-$(lib))) + include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left)) + endif + +@@ -77,9 +77,9 @@ + $(build-extra-lib) + endif + +-ifneq (,$(filter .oS,$(object-suffixes-$(lib)))) +-$(objpfx)$(patsubst %,$(libtype.oS),$(lib:lib%=%)): \ +- $(patsubst %,$(objpfx)%.oS,\ ++ifneq (,$(filter .oST,$(object-suffixes-$(lib)))) ++$(objpfx)$(patsubst %,$(libtype.oST),$(lib:lib%=%)): \ ++ $(patsubst %,$(objpfx)%.oST,\ + $(filter $($(lib)-static-only-routines),\ + $(all-$(lib)-routines))) + $(build-extra-lib) +diff -aur glibc-2.3.5/nptl/Makefile glibc-2.3.5-cygwin/nptl/Makefile +--- glibc-2.3.5/nptl/Makefile 2005-02-16 09:45:56.000000000 +0100 ++++ glibc-2.3.5-cygwin/nptl/Makefile 2005-05-11 08:26:01.812500000 +0200 +@@ -375,7 +375,7 @@ + + $(inst_libdir)/libpthread.so: $(common-objpfx)format.lds \ + $(objpfx)libpthread.so$(libpthread.so-version) \ +- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ ++ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ + $(libprefix)pthread) \ + $(+force) + (echo '/* GNU ld script';\ +@@ -383,7 +383,7 @@ + echo ' the static library, so try that secondarily. */';\ + cat $<; \ + echo 'GROUP ( $(slibdir)/libpthread.so$(libpthread.so-version)' \ +- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)pthread)'\ ++ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)pthread)'\ + ')' \ + ) > $@.new + mv -f $@.new $@ +diff -aur glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile +--- glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile 2004-08-16 08:46:14.000000000 +0200 ++++ glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile 2005-05-11 08:26:25.937500000 +0200 +@@ -10,4 +10,4 @@ + ASFLAGS-.op += -Wa,-Av9a + ASFLAGS-.og += -Wa,-Av9a + ASFLAGS-.ob += -Wa,-Av9a +-ASFLAGS-.oS += -Wa,-Av9a ++ASFLAGS-.oST += -Wa,-Av9a + +Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.6/110-configure-apple-as.patch b/patches/glibc/2.6/110-configure-apple-as.patch new file mode 100644 index 0000000..78a1324 --- /dev/null +++ b/patches/glibc/2.6/110-configure-apple-as.patch @@ -0,0 +1,25 @@ +http://in3www.epfl.ch/~schaffne/glibc-configure-apple-as.patch +http://sources.redhat.com/ml/crossgcc/2004-02/msg00151.html + +The following makes it possible to configure glibc-2.3.2 on Mac OS X, +where the assembler but doesn't understand the --version flag. + +Fixes the symptom +checking whether ld is GNU ld... no +checking for /usr/libexec/gcc/darwin/ppc/as... /usr/libexec/gcc/darwin/ppc/as +checking version of /usr/libexec/gcc/darwin/ppc/as... + + +--- glibc-2.3.2/configure~ Wed Feb 26 09:20:48 2003 ++++ glibc-2.3.2/configure Fri Feb 27 13:12:53 2004 +@@ -4039,7 +4039,7 @@ + # Found it, now check the version. + echo "$as_me:$LINENO: checking version of $AS" >&5 + echo $ECHO_N "checking version of $AS... $ECHO_C" >&6 +- ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` ++ ac_prog_version=`$AS -v &1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 2.1[3-9]*) + +Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.6/120-cygwin.patch b/patches/glibc/2.6/120-cygwin.patch deleted file mode 100644 index 3c0cd7d..0000000 --- a/patches/glibc/2.6/120-cygwin.patch +++ /dev/null @@ -1,187 +0,0 @@ -Fixes -elf/librtld.os: In function `process_envvars': : undefined reference to `__access' -... -when building glibc-2.3.x on cygwin - -Idea from -http://sources.redhat.com/ml/bug-glibc/2002-01/msg00071/glibc-2.2-cygin-shared.patch -Basically, make glibc use .oST as suffix for 'object static' -instead of .oS, since cygwin has trouble distinguishing .os from .oS -(Original patch had .on, but .oST is more mnemonic for 'object static') - -glibc-linuxthreads-2.3.5 also requires a patch, see -../glibc-linuxthreads-2.3.5/glibc-linuxthreads-2.3.5-cygwin.patch - -[ forward ported to glibc-2.3.5 by Petr Cvachoucek: - -Message-ID: <4282FCBA.3040000@unicontrols.cz> -Date: Thu, 12 May 2005 08:50:34 +0200 -From: Petr Cvachoucek -To: Dan Kegel -CC: crossgcc@sources.redhat.com -Subject: Patches to build gcc 3.4.3 / glibc 2.3.5 on cygwin - -Hi Dan, -following patches are needed to build gcc-3.4.3/glibc-2.3.5 toolchain -on cygwin. Tested to build toolchains for powerpc 604 and 750 targets. - --- - Petr Cvachoucek - Unicontrols a.s. - http://www.unicontrols.cz -] - -diff -aur glibc-2.3.5/Makeconfig glibc-2.3.5-cygwin/Makeconfig ---- glibc-2.3.5/Makeconfig 2005-02-16 11:50:19.000000000 +0100 -+++ glibc-2.3.5-cygwin/Makeconfig 2005-05-11 08:24:51.046875000 +0200 -@@ -472,7 +472,7 @@ - # run the linked programs. - link-libc = -Wl,-rpath-link=$(rpath-link) \ - $(common-objpfx)libc.so$(libc.so-version) \ -- $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib) -+ $(common-objpfx)$(patsubst %,$(libtype.oST),c) $(gnulib) - # This is how to find at build-time things that will be installed there. - rpath-dirs = math elf dlfcn nss nis rt resolv crypt - endif -@@ -693,7 +693,7 @@ - # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX}) - # to pass different flags for each flavor. - libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o)) --all-object-suffixes := .o .os .op .og .ob .oS -+all-object-suffixes := .o .os .op .og .ob .oST - object-suffixes := - CPPFLAGS-.o = $(pic-default) - CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) -@@ -749,14 +749,14 @@ - - ifeq (yes,$(build-shared)) - # Build special library that contains the static-only routines for libc. --object-suffixes-for-libc += .oS -+object-suffixes-for-libc += .oST - - # Must build the routines as PIC, though, because they can end up in (users') - # shared objects. We don't want to use CFLAGS-os because users may, for - # example, make that processor-specific. --CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag) --CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 --libtype.oS = lib%_nonshared.a -+CFLAGS-.oST = $(CFLAGS-.o) $(PIC-ccflag) -+CPPFLAGS-.oST = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 -+libtype.oST = lib%_nonshared.a - endif - - # The assembler can generate debug information too. -diff -aur glibc-2.3.5/Makerules glibc-2.3.5-cygwin/Makerules ---- glibc-2.3.5/Makerules 2004-12-15 19:52:39.000000000 +0100 -+++ glibc-2.3.5-cygwin/Makerules 2005-05-11 08:25:33.578125000 +0200 -@@ -417,7 +417,7 @@ - # Bounded pointer thunks are only built for *.ob - elide-bp-thunks = $(addprefix $(bppfx),$(bp-thunks)) - --elide-routines.oS += $(filter-out $(static-only-routines),\ -+elide-routines.oST += $(filter-out $(static-only-routines),\ - $(routines) $(aux) $(sysdep_routines)) \ - $(elide-bp-thunks) - elide-routines.os += $(static-only-routines) $(elide-bp-thunks) -@@ -981,7 +981,7 @@ - install: $(inst_libdir)/libc.so - $(inst_libdir)/libc.so: $(common-objpfx)format.lds \ - $(common-objpfx)libc.so$(libc.so-version) \ -- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ -+ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ - $(libprefix)$(libc-name)) \ - $(+force) - (echo '/* GNU ld script';\ -@@ -989,7 +989,7 @@ - echo ' the static library, so try that secondarily. */';\ - cat $<; \ - echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \ -- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\ -+ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)$(libc-name))'\ - ' AS_NEEDED (' $(slibdir)/$(rtld-installed-name) ') )' \ - ) > $@.new - mv -f $@.new $@ -diff -aur glibc-2.3.5/extra-lib.mk glibc-2.3.5-cygwin/extra-lib.mk ---- glibc-2.3.5/extra-lib.mk 2004-12-02 23:54:47.000000000 +0100 -+++ glibc-2.3.5-cygwin/extra-lib.mk 2005-05-11 08:27:28.156250000 +0200 -@@ -13,7 +13,7 @@ - - ifneq (,$($(lib)-static-only-routines)) - ifneq (,$(filter yesyes%,$(build-shared)$(elf)$($(lib).so-version))) --object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oS) -+object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oST) - endif - endif - -@@ -29,7 +29,7 @@ - - # Add each flavor of library to the lists of things to build and install. - install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o))) --extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\ -+extra-objs += $(foreach o,$(filter-out .os .oST,$(object-suffixes-$(lib))),\ - $(patsubst %,%$o,$(filter-out \ - $($(lib)-shared-only-routines),\ - $(all-$(lib)-routines)))) -@@ -57,7 +57,7 @@ - - - # Use o-iterator.mk to generate a rule for each flavor of library. --ifneq (,$(filter-out .os .oS,$(object-suffixes-$(lib)))) -+ifneq (,$(filter-out .os .oST,$(object-suffixes-$(lib)))) - define o-iterator-doit - $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \ - $(patsubst %,$(objpfx)%$o,\ -@@ -65,7 +65,7 @@ - $(all-$(lib)-routines))); \ - $$(build-extra-lib) - endef --object-suffixes-left = $(filter-out .os .oS,$(object-suffixes-$(lib))) -+object-suffixes-left = $(filter-out .os .oST,$(object-suffixes-$(lib))) - include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left)) - endif - -@@ -77,9 +77,9 @@ - $(build-extra-lib) - endif - --ifneq (,$(filter .oS,$(object-suffixes-$(lib)))) --$(objpfx)$(patsubst %,$(libtype.oS),$(lib:lib%=%)): \ -- $(patsubst %,$(objpfx)%.oS,\ -+ifneq (,$(filter .oST,$(object-suffixes-$(lib)))) -+$(objpfx)$(patsubst %,$(libtype.oST),$(lib:lib%=%)): \ -+ $(patsubst %,$(objpfx)%.oST,\ - $(filter $($(lib)-static-only-routines),\ - $(all-$(lib)-routines))) - $(build-extra-lib) -diff -aur glibc-2.3.5/nptl/Makefile glibc-2.3.5-cygwin/nptl/Makefile ---- glibc-2.3.5/nptl/Makefile 2005-02-16 09:45:56.000000000 +0100 -+++ glibc-2.3.5-cygwin/nptl/Makefile 2005-05-11 08:26:01.812500000 +0200 -@@ -375,7 +375,7 @@ - - $(inst_libdir)/libpthread.so: $(common-objpfx)format.lds \ - $(objpfx)libpthread.so$(libpthread.so-version) \ -- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ -+ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ - $(libprefix)pthread) \ - $(+force) - (echo '/* GNU ld script';\ -@@ -383,7 +383,7 @@ - echo ' the static library, so try that secondarily. */';\ - cat $<; \ - echo 'GROUP ( $(slibdir)/libpthread.so$(libpthread.so-version)' \ -- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)pthread)'\ -+ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)pthread)'\ - ')' \ - ) > $@.new - mv -f $@.new $@ -diff -aur glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile ---- glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile 2004-08-16 08:46:14.000000000 +0200 -+++ glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile 2005-05-11 08:26:25.937500000 +0200 -@@ -10,4 +10,4 @@ - ASFLAGS-.op += -Wa,-Av9a - ASFLAGS-.og += -Wa,-Av9a - ASFLAGS-.ob += -Wa,-Av9a --ASFLAGS-.oS += -Wa,-Av9a -+ASFLAGS-.oST += -Wa,-Av9a - -Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.6/120-fix-pr631.patch b/patches/glibc/2.6/120-fix-pr631.patch new file mode 100644 index 0000000..13688df --- /dev/null +++ b/patches/glibc/2.6/120-fix-pr631.patch @@ -0,0 +1,45 @@ +From dank@kegel.com +Wed Jun 15 09:12:43 PDT 2005 + +Fixes + +build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r' +build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent' +... 53 lines deleted ... +build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r' +collect2: ld returned 1 exit status +make[2]: *** [/build/gcc-3.4.3-glibc-2.3.5-hdrs-2.6.11.2/i686-unknown-linux-gnu/build-glibc/elf/ldconfig] Error 1 + +when building glibc with --enable-static-nss. + +See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631 + +--- glibc-2.3.5/Makeconfig.old Wed Jun 15 08:13:12 2005 ++++ glibc-2.3.5/Makeconfig Wed Jun 15 08:13:14 2005 +@@ -510,7 +510,7 @@ + + # The static libraries. + ifeq (yes,$(build-static)) +-link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a ++link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a + else + ifeq (yes,$(build-shared)) + # We can try to link the programs with lib*_pic.a... +--- glibc-2.3.5/elf/Makefile.old Wed Jun 15 07:46:49 2005 ++++ glibc-2.3.5/elf/Makefile Wed Jun 15 08:14:00 2005 +@@ -120,6 +120,13 @@ + install-bin-script = ldd + endif + ++ifeq (yes,$(build-static-nss)) ++nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) ++resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv) ++otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ ++ $(resolvobjdir)/libresolv.a ++endif ++ + others = sprof sln + install-bin = sprof + others-static = sln + +Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.6/130-i686-assembler.patch b/patches/glibc/2.6/130-i686-assembler.patch new file mode 100644 index 0000000..9904efb --- /dev/null +++ b/patches/glibc/2.6/130-i686-assembler.patch @@ -0,0 +1,38 @@ +2007-02-15 Khem Raj + + * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686. + * nptl/sysdeps/pthread/pt-initfini.c: Ditto. + + + +Index: glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h +=================================================================== +--- glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (revision 1469) ++++ glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (working copy) +@@ -29,6 +29,10 @@ + #include + #include + ++#if defined __i686 && defined __ASSEMBLER__ ++#undef __i686 ++#define __i686 __i686 ++#endif + + /* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h +Index: glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c +=================================================================== +--- glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (revision 1469) ++++ glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (working copy) +@@ -45,6 +45,11 @@ + /* Embed an #include to pull in the alignment and .end directives. */ + asm ("\n#include \"defs.h\""); + ++asm ("\n#if defined __i686 && defined __ASSEMBLER__"); ++asm ("\n#undef __i686"); ++asm ("\n#define __i686 __i686"); ++asm ("\n#endif"); ++ + /* The initial common code ends here. */ + asm ("\n/*@HEADER_ENDS*/"); + diff --git a/patches/glibc/2.6/140-configure-apple-as.patch b/patches/glibc/2.6/140-configure-apple-as.patch deleted file mode 100644 index 78a1324..0000000 --- a/patches/glibc/2.6/140-configure-apple-as.patch +++ /dev/null @@ -1,25 +0,0 @@ -http://in3www.epfl.ch/~schaffne/glibc-configure-apple-as.patch -http://sources.redhat.com/ml/crossgcc/2004-02/msg00151.html - -The following makes it possible to configure glibc-2.3.2 on Mac OS X, -where the assembler but doesn't understand the --version flag. - -Fixes the symptom -checking whether ld is GNU ld... no -checking for /usr/libexec/gcc/darwin/ppc/as... /usr/libexec/gcc/darwin/ppc/as -checking version of /usr/libexec/gcc/darwin/ppc/as... - - ---- glibc-2.3.2/configure~ Wed Feb 26 09:20:48 2003 -+++ glibc-2.3.2/configure Fri Feb 27 13:12:53 2004 -@@ -4039,7 +4039,7 @@ - # Found it, now check the version. - echo "$as_me:$LINENO: checking version of $AS" >&5 - echo $ECHO_N "checking version of $AS... $ECHO_C" >&6 -- ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` -+ ac_prog_version=`$AS -v &1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` - case $ac_prog_version in - '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 2.1[3-9]*) - -Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.6/140-i386-preferred-stack-boundary.patch b/patches/glibc/2.6/140-i386-preferred-stack-boundary.patch new file mode 100644 index 0000000..449821d --- /dev/null +++ b/patches/glibc/2.6/140-i386-preferred-stack-boundary.patch @@ -0,0 +1,18 @@ +(C) 2007 Yann E. MORIN +License: LGPL v2.1 + +Shut off a stupid warning: preffered-stack-boundary must be between 4 ad 12, +and 2 is not. + +diff -dur glibc-2.5.orig/sysdeps/i386/Makefile glibc-2.5/sysdeps/i386/Makefile +--- glibc-2.5.orig/sysdeps/i386/Makefile 2005-03-06 01:18:16.000000000 +0100 ++++ glibc-2.5/sysdeps/i386/Makefile 2007-05-27 17:49:37.000000000 +0200 +@@ -36,7 +36,7 @@ + ifeq ($(subdir),csu) + sysdep-CFLAGS += -mpreferred-stack-boundary=4 + else +-sysdep-CFLAGS += -mpreferred-stack-boundary=2 ++sysdep-CFLAGS += -mpreferred-stack-boundary=4 + # Likewise, any function which calls user callbacks + uses-callbacks += -mpreferred-stack-boundary=4 + # Likewise, any stack alignment tests diff --git a/patches/glibc/2.6/150-alpha-asm_page.patch b/patches/glibc/2.6/150-alpha-asm_page.patch new file mode 100644 index 0000000..b198b36 --- /dev/null +++ b/patches/glibc/2.6/150-alpha-asm_page.patch @@ -0,0 +1,26 @@ +2008-06-07 Mike Frysinger + + * sysdeps/unix/sysv/linux/alpha/sys/user.h: Copy page.h definitions + from the kernel header to sys/user.h and remove the #include of + sys/user.h. + +--- a/sysdeps/unix/sysv/linux/alpha/sys/user.h ++++ b/sysdeps/unix/sysv/linux/alpha/sys/user.h +@@ -23,7 +23,6 @@ + only. Don't read too much into it. Don't use it for anything other + than gdb/strace unless you know what you are doing. */ + +-#include + #include + + struct user +@@ -41,6 +40,9 @@ struct user + char u_comm[32]; /* user command name */ + }; + ++#define PAGE_SHIFT 13 ++#define PAGE_SIZE (1 << PAGE_SHIFT) ++#define PAGE_MASK (~(PAGE_SIZE-1)) + #define NBPG PAGE_SIZE + #define UPAGES 1 + #define HOST_TEXT_START_ADDR (u.start_code) diff --git a/patches/glibc/2.6/150-fix-pr631.patch b/patches/glibc/2.6/150-fix-pr631.patch deleted file mode 100644 index 13688df..0000000 --- a/patches/glibc/2.6/150-fix-pr631.patch +++ /dev/null @@ -1,45 +0,0 @@ -From dank@kegel.com -Wed Jun 15 09:12:43 PDT 2005 - -Fixes - -build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r' -build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent' -... 53 lines deleted ... -build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r' -collect2: ld returned 1 exit status -make[2]: *** [/build/gcc-3.4.3-glibc-2.3.5-hdrs-2.6.11.2/i686-unknown-linux-gnu/build-glibc/elf/ldconfig] Error 1 - -when building glibc with --enable-static-nss. - -See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631 - ---- glibc-2.3.5/Makeconfig.old Wed Jun 15 08:13:12 2005 -+++ glibc-2.3.5/Makeconfig Wed Jun 15 08:13:14 2005 -@@ -510,7 +510,7 @@ - - # The static libraries. - ifeq (yes,$(build-static)) --link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a -+link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a - else - ifeq (yes,$(build-shared)) - # We can try to link the programs with lib*_pic.a... ---- glibc-2.3.5/elf/Makefile.old Wed Jun 15 07:46:49 2005 -+++ glibc-2.3.5/elf/Makefile Wed Jun 15 08:14:00 2005 -@@ -120,6 +120,13 @@ - install-bin-script = ldd - endif - -+ifeq (yes,$(build-static-nss)) -+nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) -+resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv) -+otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ -+ $(resolvobjdir)/libresolv.a -+endif -+ - others = sprof sln - install-bin = sprof - others-static = sln - -Signed-off-by: Robert P. J. Day diff --git a/patches/glibc/2.6/160-i686-assembler.patch b/patches/glibc/2.6/160-i686-assembler.patch deleted file mode 100644 index 9904efb..0000000 --- a/patches/glibc/2.6/160-i686-assembler.patch +++ /dev/null @@ -1,38 +0,0 @@ -2007-02-15 Khem Raj - - * sysdeps/unix/sysv/linux/i386/sysdep.h: Re-define __i686. - * nptl/sysdeps/pthread/pt-initfini.c: Ditto. - - - -Index: glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h -=================================================================== ---- glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (revision 1469) -+++ glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (working copy) -@@ -29,6 +29,10 @@ - #include - #include - -+#if defined __i686 && defined __ASSEMBLER__ -+#undef __i686 -+#define __i686 __i686 -+#endif - - /* For Linux we can use the system call table in the header file - /usr/include/asm/unistd.h -Index: glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c -=================================================================== ---- glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (revision 1469) -+++ glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (working copy) -@@ -45,6 +45,11 @@ - /* Embed an #include to pull in the alignment and .end directives. */ - asm ("\n#include \"defs.h\""); - -+asm ("\n#if defined __i686 && defined __ASSEMBLER__"); -+asm ("\n#undef __i686"); -+asm ("\n#define __i686 __i686"); -+asm ("\n#endif"); -+ - /* The initial common code ends here. */ - asm ("\n/*@HEADER_ENDS*/"); - diff --git a/patches/glibc/2.6/160-use_short_for_fnstsw.patch b/patches/glibc/2.6/160-use_short_for_fnstsw.patch new file mode 100644 index 0000000..0e849fa --- /dev/null +++ b/patches/glibc/2.6/160-use_short_for_fnstsw.patch @@ -0,0 +1,18 @@ +Original patch from H.J. Lu, as reported there: +http://www.nabble.com/PATCH:-Use-short-for-fnstsw-td14775171.html + +fnstsw stores 16bit into %ax. The upper 16bit of %eax is unchanged. +The new assembler (binutils-2.18.50.0.4 and up) will disallow "fnstsw %eax". + +diff -dur glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c +--- glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c 2004-03-05 11:14:48.000000000 +0100 ++++ glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c 2008-06-24 10:56:14.000000000 +0200 +@@ -26,7 +26,7 @@ + int + fetestexcept (int excepts) + { +- int temp; ++ short temp; + int xtemp = 0; + + /* Get current exceptions. */ diff --git a/patches/glibc/2.6/170-alpha-asm_elf.patch b/patches/glibc/2.6/170-alpha-asm_elf.patch new file mode 100644 index 0000000..3da5c8e --- /dev/null +++ b/patches/glibc/2.6/170-alpha-asm_elf.patch @@ -0,0 +1,194 @@ +since the kernel no longer provides asm/elf.h, the sys/procfs.h from the +common code, alpha, and sh fail when used. this should things up. +-mike + +2008-06-07 Mike Frysinger + + * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. + * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h + definitions from the kernel header to sys/procfs.h and remove the + #include of asm/elf.h. + * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. + +*Attachment: signature.asc * +/Description:/ This is a digitally signed message part. + +2008-06-07 Mike Frysinger + + * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. + * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h + definitions from the kernel header to sys/procfs.h and remove the + #include of asm/elf.h. + * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. + +--- a/sysdeps/unix/sysv/linux/alpha/sys/procfs.h ++++ b/sysdeps/unix/sysv/linux/alpha/sys/procfs.h +@@ -29,10 +29,23 @@ + #include + #include + #include +-#include + + __BEGIN_DECLS + ++/* ++ * The OSF/1 version of makes gregset_t 46 entries long. ++ * I have no idea why that is so. For now, we just leave it at 33 ++ * (32 general regs + processor status word). ++ */ ++#define ELF_NGREG 33 ++#define ELF_NFPREG 32 ++ ++typedef unsigned long elf_greg_t; ++typedef elf_greg_t elf_gregset_t[ELF_NGREG]; ++ ++typedef double elf_fpreg_t; ++typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; ++ + struct elf_siginfo + { + int si_signo; /* Signal number. */ +--- a/sysdeps/unix/sysv/linux/sh/sys/procfs.h ++++ b/sysdeps/unix/sysv/linux/sh/sys/procfs.h +@@ -29,10 +29,19 @@ + #include + #include + #include +-#include + + __BEGIN_DECLS + ++/* ++ * ELF register definitions... ++ */ ++typedef unsigned long elf_greg_t; ++ ++#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) ++typedef elf_greg_t elf_gregset_t[ELF_NGREG]; ++ ++typedef struct user_fpu_struct elf_fpregset_t; ++ + struct elf_siginfo + { + int si_signo; /* Signal number. */ +--- a/sysdeps/unix/sysv/linux/sys/procfs.h ++++ b/sysdeps/unix/sysv/linux/sys/procfs.h +@@ -1,115 +1,2 @@ +-/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- +- The GNU C Library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- The GNU C 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 +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with the GNU C Library; if not, write to the Free +- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +- 02111-1307 USA. */ +- +-#ifndef _SYS_PROCFS_H +-#define _SYS_PROCFS_H 1 +- +-/* This is somehow modelled after the file of the same name on SysVr4 +- systems. It provides a definition of the core file format for ELF +- used on Linux. */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-__BEGIN_DECLS +- +-struct elf_siginfo +- { +- int si_signo; /* Signal number. */ +- int si_code; /* Extra code. */ +- int si_errno; /* Errno. */ +- }; +- +-/* Definitions to generate Intel SVR4-like core files. These mostly +- have the same names as the SVR4 types with "elf_" tacked on the +- front to prevent clashes with linux definitions, and the typedef +- forms have been avoided. This is mostly like the SVR4 structure, +- but more Linuxy, with things that Linux does not support and which +- gdb doesn't really use excluded. Fields present but not used are +- marked with "XXX". */ +-struct elf_prstatus +- { +-#if 0 +- long int pr_flags; /* XXX Process flags. */ +- short int pr_why; /* XXX Reason for process halt. */ +- short int pr_what; /* XXX More detailed reason. */ +-#endif +- struct elf_siginfo pr_info; /* Info associated with signal. */ +- short int pr_cursig; /* Current signal. */ +- unsigned long int pr_sigpend; /* Set of pending signals. */ +- unsigned long int pr_sighold; /* Set of held signals. */ +-#if 0 +- struct sigaltstack pr_altstack; /* Alternate stack info. */ +- struct sigaction pr_action; /* Signal action for current sig. */ +-#endif +- __pid_t pr_pid; +- __pid_t pr_ppid; +- __pid_t pr_pgrp; +- __pid_t pr_sid; +- struct timeval pr_utime; /* User time. */ +- struct timeval pr_stime; /* System time. */ +- struct timeval pr_cutime; /* Cumulative user time. */ +- struct timeval pr_cstime; /* Cumulative system time. */ +-#if 0 +- long int pr_instr; /* Current instruction. */ +-#endif +- elf_gregset_t pr_reg; /* GP registers. */ +- int pr_fpvalid; /* True if math copro being used. */ +- }; +- +- +-#define ELF_PRARGSZ (80) /* Number of chars for args */ +- +-struct elf_prpsinfo +- { +- char pr_state; /* Numeric process state. */ +- char pr_sname; /* Char for pr_state. */ +- char pr_zomb; /* Zombie. */ +- char pr_nice; /* Nice val. */ +- unsigned long int pr_flag; /* Flags. */ +- unsigned short int pr_uid; +- unsigned short int pr_gid; +- int pr_pid, pr_ppid, pr_pgrp, pr_sid; +- /* Lots missing */ +- char pr_fname[16]; /* Filename of executable. */ +- char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ +- }; +- +-/* Addresses. */ +-typedef void *psaddr_t; +- +-/* Register sets. Linux has different names. */ +-typedef gregset_t prgregset_t; +-typedef fpregset_t prfpregset_t; +- +-/* We don't have any differences between processes and threads, +- therefore habe only ine PID type. */ +-typedef __pid_t lwpid_t; +- +- +-typedef struct elf_prstatus prstatus_t; +-typedef struct elf_prpsinfo prpsinfo_t; +- +-__END_DECLS +- +-#endif /* sys/procfs.h */ ++/* sys/procfs.h is architecture specific. */ ++#error "This file must be supplied by every Linux architecture." + diff --git a/patches/glibc/2.6/170-i386-preferred-stack-boundary.patch b/patches/glibc/2.6/170-i386-preferred-stack-boundary.patch deleted file mode 100644 index 449821d..0000000 --- a/patches/glibc/2.6/170-i386-preferred-stack-boundary.patch +++ /dev/null @@ -1,18 +0,0 @@ -(C) 2007 Yann E. MORIN -License: LGPL v2.1 - -Shut off a stupid warning: preffered-stack-boundary must be between 4 ad 12, -and 2 is not. - -diff -dur glibc-2.5.orig/sysdeps/i386/Makefile glibc-2.5/sysdeps/i386/Makefile ---- glibc-2.5.orig/sysdeps/i386/Makefile 2005-03-06 01:18:16.000000000 +0100 -+++ glibc-2.5/sysdeps/i386/Makefile 2007-05-27 17:49:37.000000000 +0200 -@@ -36,7 +36,7 @@ - ifeq ($(subdir),csu) - sysdep-CFLAGS += -mpreferred-stack-boundary=4 - else --sysdep-CFLAGS += -mpreferred-stack-boundary=2 -+sysdep-CFLAGS += -mpreferred-stack-boundary=4 - # Likewise, any function which calls user callbacks - uses-callbacks += -mpreferred-stack-boundary=4 - # Likewise, any stack alignment tests diff --git a/patches/glibc/2.6/180-alpha-asm_page.patch b/patches/glibc/2.6/180-alpha-asm_page.patch deleted file mode 100644 index b198b36..0000000 --- a/patches/glibc/2.6/180-alpha-asm_page.patch +++ /dev/null @@ -1,26 +0,0 @@ -2008-06-07 Mike Frysinger - - * sysdeps/unix/sysv/linux/alpha/sys/user.h: Copy page.h definitions - from the kernel header to sys/user.h and remove the #include of - sys/user.h. - ---- a/sysdeps/unix/sysv/linux/alpha/sys/user.h -+++ b/sysdeps/unix/sysv/linux/alpha/sys/user.h -@@ -23,7 +23,6 @@ - only. Don't read too much into it. Don't use it for anything other - than gdb/strace unless you know what you are doing. */ - --#include - #include - - struct user -@@ -41,6 +40,9 @@ struct user - char u_comm[32]; /* user command name */ - }; - -+#define PAGE_SHIFT 13 -+#define PAGE_SIZE (1 << PAGE_SHIFT) -+#define PAGE_MASK (~(PAGE_SIZE-1)) - #define NBPG PAGE_SIZE - #define UPAGES 1 - #define HOST_TEXT_START_ADDR (u.start_code) diff --git a/patches/glibc/2.6/190-use_short_for_fnstsw.patch b/patches/glibc/2.6/190-use_short_for_fnstsw.patch deleted file mode 100644 index 0e849fa..0000000 --- a/patches/glibc/2.6/190-use_short_for_fnstsw.patch +++ /dev/null @@ -1,18 +0,0 @@ -Original patch from H.J. Lu, as reported there: -http://www.nabble.com/PATCH:-Use-short-for-fnstsw-td14775171.html - -fnstsw stores 16bit into %ax. The upper 16bit of %eax is unchanged. -The new assembler (binutils-2.18.50.0.4 and up) will disallow "fnstsw %eax". - -diff -dur glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c ---- glibc-2.6.1.orig/sysdeps/i386/fpu/ftestexcept.c 2004-03-05 11:14:48.000000000 +0100 -+++ glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c 2008-06-24 10:56:14.000000000 +0200 -@@ -26,7 +26,7 @@ - int - fetestexcept (int excepts) - { -- int temp; -+ short temp; - int xtemp = 0; - - /* Get current exceptions. */ diff --git a/patches/glibc/2.6/200-alpha-asm_elf.patch b/patches/glibc/2.6/200-alpha-asm_elf.patch deleted file mode 100644 index 3da5c8e..0000000 --- a/patches/glibc/2.6/200-alpha-asm_elf.patch +++ /dev/null @@ -1,194 +0,0 @@ -since the kernel no longer provides asm/elf.h, the sys/procfs.h from the -common code, alpha, and sh fail when used. this should things up. --mike - -2008-06-07 Mike Frysinger - - * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. - * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h - definitions from the kernel header to sys/procfs.h and remove the - #include of asm/elf.h. - * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. - -*Attachment: signature.asc * -/Description:/ This is a digitally signed message part. - -2008-06-07 Mike Frysinger - - * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. - * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h - definitions from the kernel header to sys/procfs.h and remove the - #include of asm/elf.h. - * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. - ---- a/sysdeps/unix/sysv/linux/alpha/sys/procfs.h -+++ b/sysdeps/unix/sysv/linux/alpha/sys/procfs.h -@@ -29,10 +29,23 @@ - #include - #include - #include --#include - - __BEGIN_DECLS - -+/* -+ * The OSF/1 version of makes gregset_t 46 entries long. -+ * I have no idea why that is so. For now, we just leave it at 33 -+ * (32 general regs + processor status word). -+ */ -+#define ELF_NGREG 33 -+#define ELF_NFPREG 32 -+ -+typedef unsigned long elf_greg_t; -+typedef elf_greg_t elf_gregset_t[ELF_NGREG]; -+ -+typedef double elf_fpreg_t; -+typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; -+ - struct elf_siginfo - { - int si_signo; /* Signal number. */ ---- a/sysdeps/unix/sysv/linux/sh/sys/procfs.h -+++ b/sysdeps/unix/sysv/linux/sh/sys/procfs.h -@@ -29,10 +29,19 @@ - #include - #include - #include --#include - - __BEGIN_DECLS - -+/* -+ * ELF register definitions... -+ */ -+typedef unsigned long elf_greg_t; -+ -+#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) -+typedef elf_greg_t elf_gregset_t[ELF_NGREG]; -+ -+typedef struct user_fpu_struct elf_fpregset_t; -+ - struct elf_siginfo - { - int si_signo; /* Signal number. */ ---- a/sysdeps/unix/sysv/linux/sys/procfs.h -+++ b/sysdeps/unix/sysv/linux/sys/procfs.h -@@ -1,115 +1,2 @@ --/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- -- The GNU C 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 -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, write to the Free -- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -- 02111-1307 USA. */ -- --#ifndef _SYS_PROCFS_H --#define _SYS_PROCFS_H 1 -- --/* This is somehow modelled after the file of the same name on SysVr4 -- systems. It provides a definition of the core file format for ELF -- used on Linux. */ -- --#include --#include --#include --#include --#include --#include --#include -- --__BEGIN_DECLS -- --struct elf_siginfo -- { -- int si_signo; /* Signal number. */ -- int si_code; /* Extra code. */ -- int si_errno; /* Errno. */ -- }; -- --/* Definitions to generate Intel SVR4-like core files. These mostly -- have the same names as the SVR4 types with "elf_" tacked on the -- front to prevent clashes with linux definitions, and the typedef -- forms have been avoided. This is mostly like the SVR4 structure, -- but more Linuxy, with things that Linux does not support and which -- gdb doesn't really use excluded. Fields present but not used are -- marked with "XXX". */ --struct elf_prstatus -- { --#if 0 -- long int pr_flags; /* XXX Process flags. */ -- short int pr_why; /* XXX Reason for process halt. */ -- short int pr_what; /* XXX More detailed reason. */ --#endif -- struct elf_siginfo pr_info; /* Info associated with signal. */ -- short int pr_cursig; /* Current signal. */ -- unsigned long int pr_sigpend; /* Set of pending signals. */ -- unsigned long int pr_sighold; /* Set of held signals. */ --#if 0 -- struct sigaltstack pr_altstack; /* Alternate stack info. */ -- struct sigaction pr_action; /* Signal action for current sig. */ --#endif -- __pid_t pr_pid; -- __pid_t pr_ppid; -- __pid_t pr_pgrp; -- __pid_t pr_sid; -- struct timeval pr_utime; /* User time. */ -- struct timeval pr_stime; /* System time. */ -- struct timeval pr_cutime; /* Cumulative user time. */ -- struct timeval pr_cstime; /* Cumulative system time. */ --#if 0 -- long int pr_instr; /* Current instruction. */ --#endif -- elf_gregset_t pr_reg; /* GP registers. */ -- int pr_fpvalid; /* True if math copro being used. */ -- }; -- -- --#define ELF_PRARGSZ (80) /* Number of chars for args */ -- --struct elf_prpsinfo -- { -- char pr_state; /* Numeric process state. */ -- char pr_sname; /* Char for pr_state. */ -- char pr_zomb; /* Zombie. */ -- char pr_nice; /* Nice val. */ -- unsigned long int pr_flag; /* Flags. */ -- unsigned short int pr_uid; -- unsigned short int pr_gid; -- int pr_pid, pr_ppid, pr_pgrp, pr_sid; -- /* Lots missing */ -- char pr_fname[16]; /* Filename of executable. */ -- char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ -- }; -- --/* Addresses. */ --typedef void *psaddr_t; -- --/* Register sets. Linux has different names. */ --typedef gregset_t prgregset_t; --typedef fpregset_t prfpregset_t; -- --/* We don't have any differences between processes and threads, -- therefore habe only ine PID type. */ --typedef __pid_t lwpid_t; -- -- --typedef struct elf_prstatus prstatus_t; --typedef struct elf_prpsinfo prpsinfo_t; -- --__END_DECLS -- --#endif /* sys/procfs.h */ -+/* sys/procfs.h is architecture specific. */ -+#error "This file must be supplied by every Linux architecture." - diff --git a/patches/glibc/2.7/100-cygwin.patch b/patches/glibc/2.7/100-cygwin.patch new file mode 100644 index 0000000..030361f --- /dev/null +++ b/patches/glibc/2.7/100-cygwin.patch @@ -0,0 +1,185 @@ +Fixes +elf/librtld.os: In function `process_envvars': : undefined reference to `__access' +... +when building glibc-2.3.x on cygwin + +Idea from +http://sources.redhat.com/ml/bug-glibc/2002-01/msg00071/glibc-2.2-cygin-shared.patch +Basically, make glibc use .oST as suffix for 'object static' +instead of .oS, since cygwin has trouble distinguishing .os from .oS +(Original patch had .on, but .oST is more mnemonic for 'object static') + +glibc-linuxthreads-2.3.5 also requires a patch, see +../glibc-linuxthreads-2.3.5/glibc-linuxthreads-2.3.5-cygwin.patch + +[ forward ported to glibc-2.3.5 by Petr Cvachoucek: + +Message-ID: <4282FCBA.3040000@unicontrols.cz> +Date: Thu, 12 May 2005 08:50:34 +0200 +From: Petr Cvachoucek +To: Dan Kegel +CC: crossgcc@sources.redhat.com +Subject: Patches to build gcc 3.4.3 / glibc 2.3.5 on cygwin + +Hi Dan, +following patches are needed to build gcc-3.4.3/glibc-2.3.5 toolchain +on cygwin. Tested to build toolchains for powerpc 604 and 750 targets. + +-- + Petr Cvachoucek + Unicontrols a.s. + http://www.unicontrols.cz +] + +diff -aur glibc-2.3.5/Makeconfig glibc-2.3.5-cygwin/Makeconfig +--- glibc-2.3.5/Makeconfig 2005-02-16 11:50:19.000000000 +0100 ++++ glibc-2.3.5-cygwin/Makeconfig 2005-05-11 08:24:51.046875000 +0200 +@@ -470,7 +470,7 @@ + # run the linked programs. + link-libc = -Wl,-rpath-link=$(rpath-link) \ + $(common-objpfx)libc.so$(libc.so-version) \ +- $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib) ++ $(common-objpfx)$(patsubst %,$(libtype.oST),c) $(gnulib) + # This is how to find at build-time things that will be installed there. + rpath-dirs = math elf dlfcn nss nis rt resolv crypt + endif +@@ -691,7 +691,7 @@ + # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX}) + # to pass different flags for each flavor. + libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o)) +-all-object-suffixes := .o .os .op .og .ob .oS ++all-object-suffixes := .o .os .op .og .ob .oST + object-suffixes := + CPPFLAGS-.o = $(pic-default) + CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) +@@ -747,14 +747,14 @@ + + ifeq (yes,$(build-shared)) + # Build special library that contains the static-only routines for libc. +-object-suffixes-for-libc += .oS ++object-suffixes-for-libc += .oST + + # Must build the routines as PIC, though, because they can end up in (users') + # shared objects. We don't want to use CFLAGS-os because users may, for + # example, make that processor-specific. +-CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag) +-CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 +-libtype.oS = lib%_nonshared.a ++CFLAGS-.oST = $(CFLAGS-.o) $(PIC-ccflag) ++CPPFLAGS-.oST = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 ++libtype.oST = lib%_nonshared.a + endif + + # The assembler can generate debug information too. +diff -aur glibc-2.3.5/Makerules glibc-2.3.5-cygwin/Makerules +--- glibc-2.3.5/Makerules 2004-12-15 19:52:39.000000000 +0100 ++++ glibc-2.3.5-cygwin/Makerules 2005-05-11 08:25:33.578125000 +0200 +@@ -417,7 +417,7 @@ + # Bounded pointer thunks are only built for *.ob + elide-bp-thunks = $(addprefix $(bppfx),$(bp-thunks)) + +-elide-routines.oS += $(filter-out $(static-only-routines),\ ++elide-routines.oST += $(filter-out $(static-only-routines),\ + $(routines) $(aux) $(sysdep_routines)) \ + $(elide-bp-thunks) + elide-routines.os += $(static-only-routines) $(elide-bp-thunks) +@@ -984,7 +984,7 @@ + install: $(inst_libdir)/libc.so + $(inst_libdir)/libc.so: $(common-objpfx)format.lds \ + $(common-objpfx)libc.so$(libc.so-version) \ +- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ ++ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ + $(libprefix)$(libc-name)) \ + $(+force) + (echo '/* GNU ld script';\ +@@ -992,7 +992,7 @@ + echo ' the static library, so try that secondarily. */';\ + cat $<; \ + echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \ +- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\ ++ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)$(libc-name))'\ + ' AS_NEEDED (' $(slibdir)/$(rtld-installed-name) ') )' \ + ) > $@.new + mv -f $@.new $@ +diff -aur glibc-2.3.5/extra-lib.mk glibc-2.3.5-cygwin/extra-lib.mk +--- glibc-2.3.5/extra-lib.mk 2004-12-02 23:54:47.000000000 +0100 ++++ glibc-2.3.5-cygwin/extra-lib.mk 2005-05-11 08:27:28.156250000 +0200 +@@ -13,7 +13,7 @@ + + ifneq (,$($(lib)-static-only-routines)) + ifneq (,$(filter yesyes%,$(build-shared)$(elf)$($(lib).so-version))) +-object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oS) ++object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oST) + endif + endif + +@@ -29,7 +29,7 @@ + + # Add each flavor of library to the lists of things to build and install. + install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o))) +-extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\ ++extra-objs += $(foreach o,$(filter-out .os .oST,$(object-suffixes-$(lib))),\ + $(patsubst %,%$o,$(filter-out \ + $($(lib)-shared-only-routines),\ + $(all-$(lib)-routines)))) +@@ -57,7 +57,7 @@ + + + # Use o-iterator.mk to generate a rule for each flavor of library. +-ifneq (,$(filter-out .os .oS,$(object-suffixes-$(lib)))) ++ifneq (,$(filter-out .os .oST,$(object-suffixes-$(lib)))) + define o-iterator-doit + $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \ + $(patsubst %,$(objpfx)%$o,\ +@@ -65,7 +65,7 @@ + $(all-$(lib)-routines))); \ + $$(build-extra-lib) + endef +-object-suffixes-left = $(filter-out .os .oS,$(object-suffixes-$(lib))) ++object-suffixes-left = $(filter-out .os .oST,$(object-suffixes-$(lib))) + include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left)) + endif + +@@ -77,9 +77,9 @@ + $(build-extra-lib) + endif + +-ifneq (,$(filter .oS,$(object-suffixes-$(lib)))) +-$(objpfx)$(patsubst %,$(libtype.oS),$(lib:lib%=%)): \ +- $(patsubst %,$(objpfx)%.oS,\ ++ifneq (,$(filter .oST,$(object-suffixes-$(lib)))) ++$(objpfx)$(patsubst %,$(libtype.oST),$(lib:lib%=%)): \ ++ $(patsubst %,$(objpfx)%.oST,\ + $(filter $($(lib)-static-only-routines),\ + $(all-$(lib)-routines))) + $(build-extra-lib) +diff -aur glibc-2.3.5/nptl/Makefile glibc-2.3.5-cygwin/nptl/Makefile +--- glibc-2.3.5/nptl/Makefile 2005-02-16 09:45:56.000000000 +0100 ++++ glibc-2.3.5-cygwin/nptl/Makefile 2005-05-11 08:26:01.812500000 +0200 +@@ -375,7 +375,7 @@ + + $(inst_libdir)/libpthread.so: $(common-objpfx)format.lds \ + $(objpfx)libpthread.so$(libpthread.so-version) \ +- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ ++ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ + $(libprefix)pthread) \ + $(+force) + (echo '/* GNU ld script';\ +@@ -383,7 +383,7 @@ + echo ' the static library, so try that secondarily. */';\ + cat $<; \ + echo 'GROUP ( $(slibdir)/libpthread.so$(libpthread.so-version)' \ +- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)pthread)'\ ++ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)pthread)'\ + ')' \ + ) > $@.new + mv -f $@.new $@ +diff -aur glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile +--- glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile 2004-08-16 08:46:14.000000000 +0200 ++++ glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile 2005-05-11 08:26:25.937500000 +0200 +@@ -10,4 +10,4 @@ + ASFLAGS-.op += -Wa,-Av9a + ASFLAGS-.og += -Wa,-Av9a + ASFLAGS-.ob += -Wa,-Av9a +-ASFLAGS-.oS += -Wa,-Av9a ++ASFLAGS-.oST += -Wa,-Av9a diff --git a/patches/glibc/2.7/110-configure-apple-as.patch b/patches/glibc/2.7/110-configure-apple-as.patch new file mode 100644 index 0000000..264a5df --- /dev/null +++ b/patches/glibc/2.7/110-configure-apple-as.patch @@ -0,0 +1,26 @@ +http://in3www.epfl.ch/~schaffne/glibc-configure-apple-as.patch +http://sources.redhat.com/ml/crossgcc/2004-02/msg00151.html + +The following makes it possible to configure glibc-2.3.2 on Mac OS X, +where the assembler but doesn't understand the --version flag. + +Fixes the symptom +checking whether ld is GNU ld... no +checking for /usr/libexec/gcc/darwin/ppc/as... /usr/libexec/gcc/darwin/ppc/as +checking version of /usr/libexec/gcc/darwin/ppc/as... + + +NOTE: This patch should apparently be pushed upstream so we don't need to +keep adding it here. + +--- glibc-2.3.2/configure~ Wed Feb 26 09:20:48 2003 ++++ glibc-2.3.2/configure Fri Feb 27 13:12:53 2004 +@@ -4524,7 +4524,7 @@ + # Found it, now check the version. + { echo "$as_me:$LINENO: checking version of $AS" >&5 + echo $ECHO_N "checking version of $AS... $ECHO_C" >&6; } +- ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` ++ ac_prog_version=`$AS -v &1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 2.1[3-9]*) diff --git a/patches/glibc/2.7/120-cygwin.patch b/patches/glibc/2.7/120-cygwin.patch deleted file mode 100644 index 030361f..0000000 --- a/patches/glibc/2.7/120-cygwin.patch +++ /dev/null @@ -1,185 +0,0 @@ -Fixes -elf/librtld.os: In function `process_envvars': : undefined reference to `__access' -... -when building glibc-2.3.x on cygwin - -Idea from -http://sources.redhat.com/ml/bug-glibc/2002-01/msg00071/glibc-2.2-cygin-shared.patch -Basically, make glibc use .oST as suffix for 'object static' -instead of .oS, since cygwin has trouble distinguishing .os from .oS -(Original patch had .on, but .oST is more mnemonic for 'object static') - -glibc-linuxthreads-2.3.5 also requires a patch, see -../glibc-linuxthreads-2.3.5/glibc-linuxthreads-2.3.5-cygwin.patch - -[ forward ported to glibc-2.3.5 by Petr Cvachoucek: - -Message-ID: <4282FCBA.3040000@unicontrols.cz> -Date: Thu, 12 May 2005 08:50:34 +0200 -From: Petr Cvachoucek -To: Dan Kegel -CC: crossgcc@sources.redhat.com -Subject: Patches to build gcc 3.4.3 / glibc 2.3.5 on cygwin - -Hi Dan, -following patches are needed to build gcc-3.4.3/glibc-2.3.5 toolchain -on cygwin. Tested to build toolchains for powerpc 604 and 750 targets. - --- - Petr Cvachoucek - Unicontrols a.s. - http://www.unicontrols.cz -] - -diff -aur glibc-2.3.5/Makeconfig glibc-2.3.5-cygwin/Makeconfig ---- glibc-2.3.5/Makeconfig 2005-02-16 11:50:19.000000000 +0100 -+++ glibc-2.3.5-cygwin/Makeconfig 2005-05-11 08:24:51.046875000 +0200 -@@ -470,7 +470,7 @@ - # run the linked programs. - link-libc = -Wl,-rpath-link=$(rpath-link) \ - $(common-objpfx)libc.so$(libc.so-version) \ -- $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib) -+ $(common-objpfx)$(patsubst %,$(libtype.oST),c) $(gnulib) - # This is how to find at build-time things that will be installed there. - rpath-dirs = math elf dlfcn nss nis rt resolv crypt - endif -@@ -691,7 +691,7 @@ - # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX}) - # to pass different flags for each flavor. - libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o)) --all-object-suffixes := .o .os .op .og .ob .oS -+all-object-suffixes := .o .os .op .og .ob .oST - object-suffixes := - CPPFLAGS-.o = $(pic-default) - CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) -@@ -747,14 +747,14 @@ - - ifeq (yes,$(build-shared)) - # Build special library that contains the static-only routines for libc. --object-suffixes-for-libc += .oS -+object-suffixes-for-libc += .oST - - # Must build the routines as PIC, though, because they can end up in (users') - # shared objects. We don't want to use CFLAGS-os because users may, for - # example, make that processor-specific. --CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag) --CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 --libtype.oS = lib%_nonshared.a -+CFLAGS-.oST = $(CFLAGS-.o) $(PIC-ccflag) -+CPPFLAGS-.oST = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 -+libtype.oST = lib%_nonshared.a - endif - - # The assembler can generate debug information too. -diff -aur glibc-2.3.5/Makerules glibc-2.3.5-cygwin/Makerules ---- glibc-2.3.5/Makerules 2004-12-15 19:52:39.000000000 +0100 -+++ glibc-2.3.5-cygwin/Makerules 2005-05-11 08:25:33.578125000 +0200 -@@ -417,7 +417,7 @@ - # Bounded pointer thunks are only built for *.ob - elide-bp-thunks = $(addprefix $(bppfx),$(bp-thunks)) - --elide-routines.oS += $(filter-out $(static-only-routines),\ -+elide-routines.oST += $(filter-out $(static-only-routines),\ - $(routines) $(aux) $(sysdep_routines)) \ - $(elide-bp-thunks) - elide-routines.os += $(static-only-routines) $(elide-bp-thunks) -@@ -984,7 +984,7 @@ - install: $(inst_libdir)/libc.so - $(inst_libdir)/libc.so: $(common-objpfx)format.lds \ - $(common-objpfx)libc.so$(libc.so-version) \ -- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ -+ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ - $(libprefix)$(libc-name)) \ - $(+force) - (echo '/* GNU ld script';\ -@@ -992,7 +992,7 @@ - echo ' the static library, so try that secondarily. */';\ - cat $<; \ - echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \ -- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\ -+ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)$(libc-name))'\ - ' AS_NEEDED (' $(slibdir)/$(rtld-installed-name) ') )' \ - ) > $@.new - mv -f $@.new $@ -diff -aur glibc-2.3.5/extra-lib.mk glibc-2.3.5-cygwin/extra-lib.mk ---- glibc-2.3.5/extra-lib.mk 2004-12-02 23:54:47.000000000 +0100 -+++ glibc-2.3.5-cygwin/extra-lib.mk 2005-05-11 08:27:28.156250000 +0200 -@@ -13,7 +13,7 @@ - - ifneq (,$($(lib)-static-only-routines)) - ifneq (,$(filter yesyes%,$(build-shared)$(elf)$($(lib).so-version))) --object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oS) -+object-suffixes-$(lib) += $(filter-out $($(lib)-inhibit-o),.oST) - endif - endif - -@@ -29,7 +29,7 @@ - - # Add each flavor of library to the lists of things to build and install. - install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o))) --extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\ -+extra-objs += $(foreach o,$(filter-out .os .oST,$(object-suffixes-$(lib))),\ - $(patsubst %,%$o,$(filter-out \ - $($(lib)-shared-only-routines),\ - $(all-$(lib)-routines)))) -@@ -57,7 +57,7 @@ - - - # Use o-iterator.mk to generate a rule for each flavor of library. --ifneq (,$(filter-out .os .oS,$(object-suffixes-$(lib)))) -+ifneq (,$(filter-out .os .oST,$(object-suffixes-$(lib)))) - define o-iterator-doit - $(objpfx)$(patsubst %,$(libtype$o),$(lib:lib%=%)): \ - $(patsubst %,$(objpfx)%$o,\ -@@ -65,7 +65,7 @@ - $(all-$(lib)-routines))); \ - $$(build-extra-lib) - endef --object-suffixes-left = $(filter-out .os .oS,$(object-suffixes-$(lib))) -+object-suffixes-left = $(filter-out .os .oST,$(object-suffixes-$(lib))) - include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes-left)) - endif - -@@ -77,9 +77,9 @@ - $(build-extra-lib) - endif - --ifneq (,$(filter .oS,$(object-suffixes-$(lib)))) --$(objpfx)$(patsubst %,$(libtype.oS),$(lib:lib%=%)): \ -- $(patsubst %,$(objpfx)%.oS,\ -+ifneq (,$(filter .oST,$(object-suffixes-$(lib)))) -+$(objpfx)$(patsubst %,$(libtype.oST),$(lib:lib%=%)): \ -+ $(patsubst %,$(objpfx)%.oST,\ - $(filter $($(lib)-static-only-routines),\ - $(all-$(lib)-routines))) - $(build-extra-lib) -diff -aur glibc-2.3.5/nptl/Makefile glibc-2.3.5-cygwin/nptl/Makefile ---- glibc-2.3.5/nptl/Makefile 2005-02-16 09:45:56.000000000 +0100 -+++ glibc-2.3.5-cygwin/nptl/Makefile 2005-05-11 08:26:01.812500000 +0200 -@@ -375,7 +375,7 @@ - - $(inst_libdir)/libpthread.so: $(common-objpfx)format.lds \ - $(objpfx)libpthread.so$(libpthread.so-version) \ -- $(inst_libdir)/$(patsubst %,$(libtype.oS),\ -+ $(inst_libdir)/$(patsubst %,$(libtype.oST),\ - $(libprefix)pthread) \ - $(+force) - (echo '/* GNU ld script';\ -@@ -383,7 +383,7 @@ - echo ' the static library, so try that secondarily. */';\ - cat $<; \ - echo 'GROUP ( $(slibdir)/libpthread.so$(libpthread.so-version)' \ -- '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)pthread)'\ -+ '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)pthread)'\ - ')' \ - ) > $@.new - mv -f $@.new $@ -diff -aur glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile ---- glibc-2.3.5/sysdeps/sparc/sparc32/sparcv9/Makefile 2004-08-16 08:46:14.000000000 +0200 -+++ glibc-2.3.5-cygwin/sysdeps/sparc/sparc32/sparcv9/Makefile 2005-05-11 08:26:25.937500000 +0200 -@@ -10,4 +10,4 @@ - ASFLAGS-.op += -Wa,-Av9a - ASFLAGS-.og += -Wa,-Av9a - ASFLAGS-.ob += -Wa,-Av9a --ASFLAGS-.oS += -Wa,-Av9a -+ASFLAGS-.oST += -Wa,-Av9a diff --git a/patches/glibc/2.7/120-fix-pr631.patch b/patches/glibc/2.7/120-fix-pr631.patch new file mode 100644 index 0000000..4e549fd --- /dev/null +++ b/patches/glibc/2.7/120-fix-pr631.patch @@ -0,0 +1,43 @@ +From dank@kegel.com +Wed Jun 15 09:12:43 PDT 2005 + +Fixes + +build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r' +build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent' +... 53 lines deleted ... +build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r' +collect2: ld returned 1 exit status +make[2]: *** [/build/gcc-3.4.3-glibc-2.3.5-hdrs-2.6.11.2/i686-unknown-linux-gnu/build-glibc/elf/ldconfig] Error 1 + +when building glibc with --enable-static-nss. + +See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631 + +--- glibc-2.3.5/Makeconfig.old Wed Jun 15 08:13:12 2005 ++++ glibc-2.3.5/Makeconfig Wed Jun 15 08:13:14 2005 +@@ -508,7 +508,7 @@ + + # The static libraries. + ifeq (yes,$(build-static)) +-link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a ++link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a + else + ifeq (yes,$(build-shared)) + # We can try to link the programs with lib*_pic.a... +--- glibc-2.3.5/elf/Makefile.old Wed Jun 15 07:46:49 2005 ++++ glibc-2.3.5/elf/Makefile Wed Jun 15 08:14:00 2005 +@@ -120,6 +120,13 @@ + install-bin-script = ldd + endif + ++ifeq (yes,$(build-static-nss)) ++nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) ++resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv) ++otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ ++ $(resolvobjdir)/libresolv.a ++endif ++ + others = sprof sln + install-bin = sprof + others-static = sln diff --git a/patches/glibc/2.7/130-i686-assembler.patch b/patches/glibc/2.7/130-i686-assembler.patch new file mode 100644 index 0000000..09c8754 --- /dev/null +++ b/patches/glibc/2.7/130-i686-assembler.patch @@ -0,0 +1,43 @@ +If gcc is configured to generate i686 code or better by default (like +when using the --with-arch=pentium3 configure option), then the __i686 +macro will always be defined automatically and thus screw up the +compilation of some .S files. + +http://bugs.gentoo.org/131108 +http://sourceware.org/ml/libc-alpha/2006-04/msg00090.html + +2006-04-25 Mike Frysinger + + * sysdeps/i386/sysdep.h (__i686): Undefine. + +Index: glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h +=================================================================== +--- glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (revision 1469) ++++ glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (working copy) +@@ -29,6 +29,10 @@ + #include + #include + ++#if defined __i686 && defined __ASSEMBLER__ ++#undef __i686 ++#define __i686 __i686 ++#endif + + /* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h +Index: glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c +=================================================================== +--- glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (revision 1469) ++++ glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (working copy) +@@ -45,6 +45,11 @@ + /* Embed an #include to pull in the alignment and .end directives. */ + asm ("\n#include \"defs.h\""); + ++asm ("\n#if defined __i686 && defined __ASSEMBLER__"); ++asm ("\n#undef __i686"); ++asm ("\n#define __i686 __i686"); ++asm ("\n#endif"); ++ + /* The initial common code ends here. */ + asm ("\n/*@HEADER_ENDS*/"); + diff --git a/patches/glibc/2.7/140-configure-apple-as.patch b/patches/glibc/2.7/140-configure-apple-as.patch deleted file mode 100644 index 264a5df..0000000 --- a/patches/glibc/2.7/140-configure-apple-as.patch +++ /dev/null @@ -1,26 +0,0 @@ -http://in3www.epfl.ch/~schaffne/glibc-configure-apple-as.patch -http://sources.redhat.com/ml/crossgcc/2004-02/msg00151.html - -The following makes it possible to configure glibc-2.3.2 on Mac OS X, -where the assembler but doesn't understand the --version flag. - -Fixes the symptom -checking whether ld is GNU ld... no -checking for /usr/libexec/gcc/darwin/ppc/as... /usr/libexec/gcc/darwin/ppc/as -checking version of /usr/libexec/gcc/darwin/ppc/as... - - -NOTE: This patch should apparently be pushed upstream so we don't need to -keep adding it here. - ---- glibc-2.3.2/configure~ Wed Feb 26 09:20:48 2003 -+++ glibc-2.3.2/configure Fri Feb 27 13:12:53 2004 -@@ -4524,7 +4524,7 @@ - # Found it, now check the version. - { echo "$as_me:$LINENO: checking version of $AS" >&5 - echo $ECHO_N "checking version of $AS... $ECHO_C" >&6; } -- ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` -+ ac_prog_version=`$AS -v &1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'` - case $ac_prog_version in - '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 2.1[3-9]*) diff --git a/patches/glibc/2.7/140-i386-preferred-stack-boundary.patch b/patches/glibc/2.7/140-i386-preferred-stack-boundary.patch new file mode 100644 index 0000000..449821d --- /dev/null +++ b/patches/glibc/2.7/140-i386-preferred-stack-boundary.patch @@ -0,0 +1,18 @@ +(C) 2007 Yann E. MORIN +License: LGPL v2.1 + +Shut off a stupid warning: preffered-stack-boundary must be between 4 ad 12, +and 2 is not. + +diff -dur glibc-2.5.orig/sysdeps/i386/Makefile glibc-2.5/sysdeps/i386/Makefile +--- glibc-2.5.orig/sysdeps/i386/Makefile 2005-03-06 01:18:16.000000000 +0100 ++++ glibc-2.5/sysdeps/i386/Makefile 2007-05-27 17:49:37.000000000 +0200 +@@ -36,7 +36,7 @@ + ifeq ($(subdir),csu) + sysdep-CFLAGS += -mpreferred-stack-boundary=4 + else +-sysdep-CFLAGS += -mpreferred-stack-boundary=2 ++sysdep-CFLAGS += -mpreferred-stack-boundary=4 + # Likewise, any function which calls user callbacks + uses-callbacks += -mpreferred-stack-boundary=4 + # Likewise, any stack alignment tests diff --git a/patches/glibc/2.7/150-alpha-asm_page.patch b/patches/glibc/2.7/150-alpha-asm_page.patch new file mode 100644 index 0000000..b198b36 --- /dev/null +++ b/patches/glibc/2.7/150-alpha-asm_page.patch @@ -0,0 +1,26 @@ +2008-06-07 Mike Frysinger + + * sysdeps/unix/sysv/linux/alpha/sys/user.h: Copy page.h definitions + from the kernel header to sys/user.h and remove the #include of + sys/user.h. + +--- a/sysdeps/unix/sysv/linux/alpha/sys/user.h ++++ b/sysdeps/unix/sysv/linux/alpha/sys/user.h +@@ -23,7 +23,6 @@ + only. Don't read too much into it. Don't use it for anything other + than gdb/strace unless you know what you are doing. */ + +-#include + #include + + struct user +@@ -41,6 +40,9 @@ struct user + char u_comm[32]; /* user command name */ + }; + ++#define PAGE_SHIFT 13 ++#define PAGE_SIZE (1 << PAGE_SHIFT) ++#define PAGE_MASK (~(PAGE_SIZE-1)) + #define NBPG PAGE_SIZE + #define UPAGES 1 + #define HOST_TEXT_START_ADDR (u.start_code) diff --git a/patches/glibc/2.7/150-fix-pr631.patch b/patches/glibc/2.7/150-fix-pr631.patch deleted file mode 100644 index 4e549fd..0000000 --- a/patches/glibc/2.7/150-fix-pr631.patch +++ /dev/null @@ -1,43 +0,0 @@ -From dank@kegel.com -Wed Jun 15 09:12:43 PDT 2005 - -Fixes - -build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r' -build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent' -... 53 lines deleted ... -build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r' -collect2: ld returned 1 exit status -make[2]: *** [/build/gcc-3.4.3-glibc-2.3.5-hdrs-2.6.11.2/i686-unknown-linux-gnu/build-glibc/elf/ldconfig] Error 1 - -when building glibc with --enable-static-nss. - -See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631 - ---- glibc-2.3.5/Makeconfig.old Wed Jun 15 08:13:12 2005 -+++ glibc-2.3.5/Makeconfig Wed Jun 15 08:13:14 2005 -@@ -508,7 +508,7 @@ - - # The static libraries. - ifeq (yes,$(build-static)) --link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a -+link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a - else - ifeq (yes,$(build-shared)) - # We can try to link the programs with lib*_pic.a... ---- glibc-2.3.5/elf/Makefile.old Wed Jun 15 07:46:49 2005 -+++ glibc-2.3.5/elf/Makefile Wed Jun 15 08:14:00 2005 -@@ -120,6 +120,13 @@ - install-bin-script = ldd - endif - -+ifeq (yes,$(build-static-nss)) -+nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) -+resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv) -+otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ -+ $(resolvobjdir)/libresolv.a -+endif -+ - others = sprof sln - install-bin = sprof - others-static = sln diff --git a/patches/glibc/2.7/160-build_wcs_upper_buffer.patch b/patches/glibc/2.7/160-build_wcs_upper_buffer.patch new file mode 100644 index 0000000..72cde92 --- /dev/null +++ b/patches/glibc/2.7/160-build_wcs_upper_buffer.patch @@ -0,0 +1,22 @@ +Matthias Kaehlcke writes: + +A compilation of an ARM toolchain with glibc 2.7 using crosstool-ng +failed with a gcc error in glibc-2.7/posix/regex_internal.c, more +concretly in the function build_wcs_upper_buffer(). The return type of +the function prototype in regex_internal.h doesn't correspond with the +return type of this function in regex_internal.c. + +The attached patch corrects the return type of the function prototype +in regex_internal.h + +--- glibc-2.7/posix/regex_internal.h.org 2008-05-30 11:16:01.000000000 +0200 ++++ glibc-2.7/posix/regex_internal.h 2008-05-30 11:16:35.000000000 +0200 +@@ -391,7 +391,7 @@ + internal_function; + # ifdef RE_ENABLE_I18N + static void build_wcs_buffer (re_string_t *pstr) internal_function; +-static int build_wcs_upper_buffer (re_string_t *pstr) internal_function; ++static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr) internal_function; + # endif /* RE_ENABLE_I18N */ + static void build_upper_buffer (re_string_t *pstr) internal_function; + static void re_string_translate_buffer (re_string_t *pstr) internal_function; diff --git a/patches/glibc/2.7/160-i686-assembler.patch b/patches/glibc/2.7/160-i686-assembler.patch deleted file mode 100644 index 09c8754..0000000 --- a/patches/glibc/2.7/160-i686-assembler.patch +++ /dev/null @@ -1,43 +0,0 @@ -If gcc is configured to generate i686 code or better by default (like -when using the --with-arch=pentium3 configure option), then the __i686 -macro will always be defined automatically and thus screw up the -compilation of some .S files. - -http://bugs.gentoo.org/131108 -http://sourceware.org/ml/libc-alpha/2006-04/msg00090.html - -2006-04-25 Mike Frysinger - - * sysdeps/i386/sysdep.h (__i686): Undefine. - -Index: glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h -=================================================================== ---- glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (revision 1469) -+++ glibc-2.4/sysdeps/unix/sysv/linux/i386/sysdep.h (working copy) -@@ -29,6 +29,10 @@ - #include - #include - -+#if defined __i686 && defined __ASSEMBLER__ -+#undef __i686 -+#define __i686 __i686 -+#endif - - /* For Linux we can use the system call table in the header file - /usr/include/asm/unistd.h -Index: glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c -=================================================================== ---- glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (revision 1469) -+++ glibc-2.4/nptl/sysdeps/pthread/pt-initfini.c (working copy) -@@ -45,6 +45,11 @@ - /* Embed an #include to pull in the alignment and .end directives. */ - asm ("\n#include \"defs.h\""); - -+asm ("\n#if defined __i686 && defined __ASSEMBLER__"); -+asm ("\n#undef __i686"); -+asm ("\n#define __i686 __i686"); -+asm ("\n#endif"); -+ - /* The initial common code ends here. */ - asm ("\n/*@HEADER_ENDS*/"); - diff --git a/patches/glibc/2.7/170-i386-preferred-stack-boundary.patch b/patches/glibc/2.7/170-i386-preferred-stack-boundary.patch deleted file mode 100644 index 449821d..0000000 --- a/patches/glibc/2.7/170-i386-preferred-stack-boundary.patch +++ /dev/null @@ -1,18 +0,0 @@ -(C) 2007 Yann E. MORIN -License: LGPL v2.1 - -Shut off a stupid warning: preffered-stack-boundary must be between 4 ad 12, -and 2 is not. - -diff -dur glibc-2.5.orig/sysdeps/i386/Makefile glibc-2.5/sysdeps/i386/Makefile ---- glibc-2.5.orig/sysdeps/i386/Makefile 2005-03-06 01:18:16.000000000 +0100 -+++ glibc-2.5/sysdeps/i386/Makefile 2007-05-27 17:49:37.000000000 +0200 -@@ -36,7 +36,7 @@ - ifeq ($(subdir),csu) - sysdep-CFLAGS += -mpreferred-stack-boundary=4 - else --sysdep-CFLAGS += -mpreferred-stack-boundary=2 -+sysdep-CFLAGS += -mpreferred-stack-boundary=4 - # Likewise, any function which calls user callbacks - uses-callbacks += -mpreferred-stack-boundary=4 - # Likewise, any stack alignment tests diff --git a/patches/glibc/2.7/170-use_short_for_fnstsw.patch b/patches/glibc/2.7/170-use_short_for_fnstsw.patch new file mode 100644 index 0000000..722f8d2 --- /dev/null +++ b/patches/glibc/2.7/170-use_short_for_fnstsw.patch @@ -0,0 +1,18 @@ +Original patch from H.J. Lu, as reported there: +http://www.nabble.com/PATCH:-Use-short-for-fnstsw-td14775171.html + +fnstsw stores 16bit into %ax. The upper 16bit of %eax is unchanged. +The new assembler (binutils-2.18.50.0.4 and up) will disallow "fnstsw %eax". + +diff -dur glibc-2.7.orig/sysdeps/i386/fpu/ftestexcept.c glibc-2.7/sysdeps/i386/fpu/ftestexcept.c +--- glibc-2.7.orig/sysdeps/i386/fpu/ftestexcept.c 2004-03-05 11:14:48.000000000 +0100 ++++ glibc-2.7/sysdeps/i386/fpu/ftestexcept.c 2008-06-24 10:54:43.000000000 +0200 +@@ -26,7 +26,7 @@ + int + fetestexcept (int excepts) + { +- int temp; ++ short temp; + int xtemp = 0; + + /* Get current exceptions. */ diff --git a/patches/glibc/2.7/180-alpha-asm_page.patch b/patches/glibc/2.7/180-alpha-asm_page.patch deleted file mode 100644 index b198b36..0000000 --- a/patches/glibc/2.7/180-alpha-asm_page.patch +++ /dev/null @@ -1,26 +0,0 @@ -2008-06-07 Mike Frysinger - - * sysdeps/unix/sysv/linux/alpha/sys/user.h: Copy page.h definitions - from the kernel header to sys/user.h and remove the #include of - sys/user.h. - ---- a/sysdeps/unix/sysv/linux/alpha/sys/user.h -+++ b/sysdeps/unix/sysv/linux/alpha/sys/user.h -@@ -23,7 +23,6 @@ - only. Don't read too much into it. Don't use it for anything other - than gdb/strace unless you know what you are doing. */ - --#include - #include - - struct user -@@ -41,6 +40,9 @@ struct user - char u_comm[32]; /* user command name */ - }; - -+#define PAGE_SHIFT 13 -+#define PAGE_SIZE (1 << PAGE_SHIFT) -+#define PAGE_MASK (~(PAGE_SIZE-1)) - #define NBPG PAGE_SIZE - #define UPAGES 1 - #define HOST_TEXT_START_ADDR (u.start_code) diff --git a/patches/glibc/2.7/180-gcc-4.3_sysinclude_path.patch b/patches/glibc/2.7/180-gcc-4.3_sysinclude_path.patch new file mode 100644 index 0000000..7af09a4 --- /dev/null +++ b/patches/glibc/2.7/180-gcc-4.3_sysinclude_path.patch @@ -0,0 +1,50 @@ +Patch pointed to by Ryan ARNOLD on the libc-help ML. +See: http://sourceware.org/ml/libc-help/2008-06/msg00063.html + +Forwarded to crosstool-NG by Ioannis E. VENETIS: +See: http://sourceware.org/ml/libc-help/2008-06/msg00063.html + +GCC 4.3 changed the location of some of the header files. I don't +understand why you'd be getting these errors while building GCC since +it provides them. + +With regard to GLIBC, Roland checked in some changes so that the GLIBC +build system could find the new locations of the GCC provided header +files. + +diff -durN glibc-2.7.orig/configure.in glibc-2.7/configure.in +--- glibc-2.7.orig/configure.in 2007-06-08 05:16:36.000000000 +0200 ++++ glibc-2.7/configure.in 2008-06-24 18:38:46.000000000 +0200 +@@ -911,8 +911,12 @@ + # header directory and add that to the list. NOTE: Only does the right + # thing on a system that doesn't need fixincludes. (Not presently a problem.) + if test -n "$sysheaders"; then +- ccheaders=`$CC -print-file-name=include` +- SYSINCLUDES="-nostdinc -isystem $ccheaders \ ++ SYSINCLUDES=-nostdinc ++ for d in include include-fixed; do ++ i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" && ++ SYSINCLUDES="$SYSINCLUDES -isystem $i" ++ done ++ SYSINCLUDES="$SYSINCLUDES \ + -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`" + if test -n "$CXX"; then + cxxversion=`$CXX -dumpversion 2>&AS_MESSAGE_LOG_FD` && +diff -durN glibc-2.7.orig/configure glibc-2.7/configure +--- glibc-2.7.orig/configure 2008-06-24 18:35:34.000000000 +0200 ++++ glibc-2.7/configure 2008-06-24 18:38:46.000000000 +0200 +@@ -5062,8 +5062,12 @@ + # header directory and add that to the list. NOTE: Only does the right + # thing on a system that doesn't need fixincludes. (Not presently a problem.) + if test -n "$sysheaders"; then +- ccheaders=`$CC -print-file-name=include` +- SYSINCLUDES="-nostdinc -isystem $ccheaders \ ++ SYSINCLUDES=-nostdinc ++ for d in include include-fixed; do ++ i=`$CC -print-file-name="$d"` && test "x$i" != "x$d" && ++ SYSINCLUDES="$SYSINCLUDES -isystem $i" ++ done ++ SYSINCLUDES="$SYSINCLUDES \ + -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`" + if test -n "$CXX"; then + cxxversion=`$CXX -dumpversion 2>&5` && diff --git a/patches/glibc/2.7/190-alpha-asm_elf.patch b/patches/glibc/2.7/190-alpha-asm_elf.patch new file mode 100644 index 0000000..3da5c8e --- /dev/null +++ b/patches/glibc/2.7/190-alpha-asm_elf.patch @@ -0,0 +1,194 @@ +since the kernel no longer provides asm/elf.h, the sys/procfs.h from the +common code, alpha, and sh fail when used. this should things up. +-mike + +2008-06-07 Mike Frysinger + + * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. + * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h + definitions from the kernel header to sys/procfs.h and remove the + #include of asm/elf.h. + * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. + +*Attachment: signature.asc * +/Description:/ This is a digitally signed message part. + +2008-06-07 Mike Frysinger + + * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. + * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h + definitions from the kernel header to sys/procfs.h and remove the + #include of asm/elf.h. + * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. + +--- a/sysdeps/unix/sysv/linux/alpha/sys/procfs.h ++++ b/sysdeps/unix/sysv/linux/alpha/sys/procfs.h +@@ -29,10 +29,23 @@ + #include + #include + #include +-#include + + __BEGIN_DECLS + ++/* ++ * The OSF/1 version of makes gregset_t 46 entries long. ++ * I have no idea why that is so. For now, we just leave it at 33 ++ * (32 general regs + processor status word). ++ */ ++#define ELF_NGREG 33 ++#define ELF_NFPREG 32 ++ ++typedef unsigned long elf_greg_t; ++typedef elf_greg_t elf_gregset_t[ELF_NGREG]; ++ ++typedef double elf_fpreg_t; ++typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; ++ + struct elf_siginfo + { + int si_signo; /* Signal number. */ +--- a/sysdeps/unix/sysv/linux/sh/sys/procfs.h ++++ b/sysdeps/unix/sysv/linux/sh/sys/procfs.h +@@ -29,10 +29,19 @@ + #include + #include + #include +-#include + + __BEGIN_DECLS + ++/* ++ * ELF register definitions... ++ */ ++typedef unsigned long elf_greg_t; ++ ++#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) ++typedef elf_greg_t elf_gregset_t[ELF_NGREG]; ++ ++typedef struct user_fpu_struct elf_fpregset_t; ++ + struct elf_siginfo + { + int si_signo; /* Signal number. */ +--- a/sysdeps/unix/sysv/linux/sys/procfs.h ++++ b/sysdeps/unix/sysv/linux/sys/procfs.h +@@ -1,115 +1,2 @@ +-/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- +- The GNU C Library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- The GNU C 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 +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with the GNU C Library; if not, write to the Free +- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +- 02111-1307 USA. */ +- +-#ifndef _SYS_PROCFS_H +-#define _SYS_PROCFS_H 1 +- +-/* This is somehow modelled after the file of the same name on SysVr4 +- systems. It provides a definition of the core file format for ELF +- used on Linux. */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-__BEGIN_DECLS +- +-struct elf_siginfo +- { +- int si_signo; /* Signal number. */ +- int si_code; /* Extra code. */ +- int si_errno; /* Errno. */ +- }; +- +-/* Definitions to generate Intel SVR4-like core files. These mostly +- have the same names as the SVR4 types with "elf_" tacked on the +- front to prevent clashes with linux definitions, and the typedef +- forms have been avoided. This is mostly like the SVR4 structure, +- but more Linuxy, with things that Linux does not support and which +- gdb doesn't really use excluded. Fields present but not used are +- marked with "XXX". */ +-struct elf_prstatus +- { +-#if 0 +- long int pr_flags; /* XXX Process flags. */ +- short int pr_why; /* XXX Reason for process halt. */ +- short int pr_what; /* XXX More detailed reason. */ +-#endif +- struct elf_siginfo pr_info; /* Info associated with signal. */ +- short int pr_cursig; /* Current signal. */ +- unsigned long int pr_sigpend; /* Set of pending signals. */ +- unsigned long int pr_sighold; /* Set of held signals. */ +-#if 0 +- struct sigaltstack pr_altstack; /* Alternate stack info. */ +- struct sigaction pr_action; /* Signal action for current sig. */ +-#endif +- __pid_t pr_pid; +- __pid_t pr_ppid; +- __pid_t pr_pgrp; +- __pid_t pr_sid; +- struct timeval pr_utime; /* User time. */ +- struct timeval pr_stime; /* System time. */ +- struct timeval pr_cutime; /* Cumulative user time. */ +- struct timeval pr_cstime; /* Cumulative system time. */ +-#if 0 +- long int pr_instr; /* Current instruction. */ +-#endif +- elf_gregset_t pr_reg; /* GP registers. */ +- int pr_fpvalid; /* True if math copro being used. */ +- }; +- +- +-#define ELF_PRARGSZ (80) /* Number of chars for args */ +- +-struct elf_prpsinfo +- { +- char pr_state; /* Numeric process state. */ +- char pr_sname; /* Char for pr_state. */ +- char pr_zomb; /* Zombie. */ +- char pr_nice; /* Nice val. */ +- unsigned long int pr_flag; /* Flags. */ +- unsigned short int pr_uid; +- unsigned short int pr_gid; +- int pr_pid, pr_ppid, pr_pgrp, pr_sid; +- /* Lots missing */ +- char pr_fname[16]; /* Filename of executable. */ +- char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ +- }; +- +-/* Addresses. */ +-typedef void *psaddr_t; +- +-/* Register sets. Linux has different names. */ +-typedef gregset_t prgregset_t; +-typedef fpregset_t prfpregset_t; +- +-/* We don't have any differences between processes and threads, +- therefore habe only ine PID type. */ +-typedef __pid_t lwpid_t; +- +- +-typedef struct elf_prstatus prstatus_t; +-typedef struct elf_prpsinfo prpsinfo_t; +- +-__END_DECLS +- +-#endif /* sys/procfs.h */ ++/* sys/procfs.h is architecture specific. */ ++#error "This file must be supplied by every Linux architecture." + diff --git a/patches/glibc/2.7/190-build_wcs_upper_buffer.patch b/patches/glibc/2.7/190-build_wcs_upper_buffer.patch deleted file mode 100644 index 72cde92..0000000 --- a/patches/glibc/2.7/190-build_wcs_upper_buffer.patch +++ /dev/null @@ -1,22 +0,0 @@ -Matthias Kaehlcke writes: - -A compilation of an ARM toolchain with glibc 2.7 using crosstool-ng -failed with a gcc error in glibc-2.7/posix/regex_internal.c, more -concretly in the function build_wcs_upper_buffer(). The return type of -the function prototype in regex_internal.h doesn't correspond with the -return type of this function in regex_internal.c. - -The attached patch corrects the return type of the function prototype -in regex_internal.h - ---- glibc-2.7/posix/regex_internal.h.org 2008-05-30 11:16:01.000000000 +0200 -+++ glibc-2.7/posix/regex_internal.h 2008-05-30 11:16:35.000000000 +0200 -@@ -391,7 +391,7 @@ - internal_function; - # ifdef RE_ENABLE_I18N - static void build_wcs_buffer (re_string_t *pstr) internal_function; --static int build_wcs_upper_buffer (re_string_t *pstr) internal_function; -+static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr) internal_function; - # endif /* RE_ENABLE_I18N */ - static void build_upper_buffer (re_string_t *pstr) internal_function; - static void re_string_translate_buffer (re_string_t *pstr) internal_function; diff --git a/patches/glibc/2.7/200-alpha-atfcts.patch b/patches/glibc/2.7/200-alpha-atfcts.patch new file mode 100644 index 0000000..06c7d8f --- /dev/null +++ b/patches/glibc/2.7/200-alpha-atfcts.patch @@ -0,0 +1,12 @@ +--- glibc-2.7/sysdeps/unix/sysv/linux/kernel-features.h 2007-08-14 06:21:09.000000000 +0300 ++++ glibc-2.7/sysdeps/unix/sysv/linux/kernel-features.h.new 2008-07-23 07:05:20.000000000 +0300 +@@ -449,8 +449,7 @@ + and on Alpha just after 2.6.22-rc1. */ + #if __LINUX_KERNEL_VERSION >= 0x020611 \ + && ((!defined __sh__ && !defined __alpha__) \ +- || (__LINUX_KERNEL_VERSION >= 0x020613 && defined __sh__) \ +- || (__LINUX_KERNEL_VERSION >= 0x020617 && defined __alpha__)) ++ || (__LINUX_KERNEL_VERSION >= 0x020613 && defined __sh__)) + # define __ASSUME_ATFCTS 1 + #endif + diff --git a/patches/glibc/2.7/200-use_short_for_fnstsw.patch b/patches/glibc/2.7/200-use_short_for_fnstsw.patch deleted file mode 100644 index 722f8d2..0000000 --- a/patches/glibc/2.7/200-use_short_for_fnstsw.patch +++ /dev/null @@ -1,18 +0,0 @@ -Original patch from H.J. Lu, as reported there: -http://www.nabble.com/PATCH:-Use-short-for-fnstsw-td14775171.html - -fnstsw stores 16bit into %ax. The upper 16bit of %eax is unchanged. -The new assembler (binutils-2.18.50.0.4 and up) will disallow "fnstsw %eax". - -diff -dur glibc-2.7.orig/sysdeps/i386/fpu/ftestexcept.c glibc-2.7/sysdeps/i386/fpu/ftestexcept.c ---- glibc-2.7.orig/sysdeps/i386/fpu/ftestexcept.c 2004-03-05 11:14:48.000000000 +0100 -+++ glibc-2.7/sysdeps/i386/fpu/ftestexcept.c 2008-06-24 10:54:43.000000000 +0200 -@@ -26,7 +26,7 @@ - int - fetestexcept (int excepts) - { -- int temp; -+ short temp; - int xtemp = 0; - - /* Get current exceptions. */ diff --git a/patches/glibc/2.7/210-alpha-ptr_mangle.patch b/patches/glibc/2.7/210-alpha-ptr_mangle.patch new file mode 100644 index 0000000..7f22833 --- /dev/null +++ b/patches/glibc/2.7/210-alpha-ptr_mangle.patch @@ -0,0 +1,94 @@ +--- glibc-2.7.orig/sysdeps/unix/alpha/sysdep.h ++++ glibc-2.7/sysdeps/unix/alpha/sysdep.h +@@ -397,42 +397,4 @@ + _sc_ret = _sc_0, _sc_err = _sc_19; \ + } + +-/* Pointer mangling support. Note that tls access is slow enough that +- we don't deoptimize things by placing the pointer check value there. */ +- +-#include +- +-#if defined NOT_IN_libc && defined IS_IN_rtld +-# ifdef __ASSEMBLER__ +-# define PTR_MANGLE(dst, src, tmp) \ +- ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \ +- ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \ +- xor src, tmp, dst +-# define PTR_MANGLE2(dst, src, tmp) \ +- xor src, tmp, dst +-# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) +-# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) +-# else +-extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; +-# define PTR_MANGLE(var) \ +- (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) +-# define PTR_DEMANGLE(var) PTR_MANGLE(var) +-# endif +-#elif defined PIC +-# ifdef __ASSEMBLER__ +-# define PTR_MANGLE(dst, src, tmp) \ +- ldq tmp, __pointer_chk_guard; \ +- xor src, tmp, dst +-# define PTR_MANGLE2(dst, src, tmp) \ +- xor src, tmp, dst +-# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) +-# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) +-# else +-extern uintptr_t __pointer_chk_guard attribute_relro; +-# define PTR_MANGLE(var) \ +- (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard) +-# define PTR_DEMANGLE(var) PTR_MANGLE(var) +-# endif +-#endif +- + #endif /* ASSEMBLER */ +--- glibc-2.7.orig/sysdeps/unix/sysv/linux/alpha/sysdep.h ++++ glibc-2.7/sysdeps/unix/sysv/linux/alpha/sysdep.h +@@ -98,4 +98,46 @@ + INTERNAL_SYSCALL1(name, err_out, nr, args); \ + }) + ++/* Pointer mangling support. Note that tls access is slow enough that ++ we don't deoptimize things by placing the pointer check value there. */ ++ ++#if defined NOT_IN_libc && defined IS_IN_rtld ++# ifdef __ASSEMBLER__ ++# define PTR_MANGLE(dst, src, tmp) \ ++ ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \ ++ ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \ ++ xor src, tmp, dst ++# define PTR_MANGLE2(dst, src, tmp) \ ++ xor src, tmp, dst ++# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) ++# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) ++# else ++extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; ++# define PTR_MANGLE(var) \ ++ (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) ++# define PTR_DEMANGLE(var) PTR_MANGLE(var) ++# endif ++#elif defined PIC ++# ifdef __ASSEMBLER__ ++# define PTR_MANGLE(dst, src, tmp) \ ++ ldq tmp, __pointer_chk_guard; \ ++ xor src, tmp, dst ++# define PTR_MANGLE2(dst, src, tmp) \ ++ xor src, tmp, dst ++# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) ++# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) ++# else ++extern uintptr_t __pointer_chk_guard attribute_relro; ++# define PTR_MANGLE(var) \ ++ (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard) ++# define PTR_DEMANGLE(var) PTR_MANGLE(var) ++# endif ++#else ++/* Pointer mangling is not yet supported for static libc on alpha. */ ++# ifndef __ASSEMBLER__ ++# define PTR_MANGLE(var) (void) (var) ++# define PTR_DEMANGLE(var) (void) (var) ++# endif ++#endif ++ + #endif /* _LINUX_ALPHA_SYSDEP_H */ diff --git a/patches/glibc/2.7/210-gcc-4.3_sysinclude_path.patch b/patches/glibc/2.7/210-gcc-4.3_sysinclude_path.patch deleted file mode 100644 index 7af09a4..0000000 --- a/patches/glibc/2.7/210-gcc-4.3_sysinclude_path.patch +++ /dev/null @@ -1,50 +0,0 @@ -Patch pointed to by Ryan ARNOLD on the libc-help ML. -See: http://sourceware.org/ml/libc-help/2008-06/msg00063.html - -Forwarded to crosstool-NG by Ioannis E. VENETIS: -See: http://sourceware.org/ml/libc-help/2008-06/msg00063.html - -GCC 4.3 changed the location of some of the header files. I don't -understand why you'd be getting these errors while building GCC since -it provides them. - -With regard to GLIBC, Roland checked in some changes so that the GLIBC -build system could find the new locations of the GCC provided header -files. - -diff -durN glibc-2.7.orig/configure.in glibc-2.7/configure.in ---- glibc-2.7.orig/configure.in 2007-06-08 05:16:36.000000000 +0200 -+++ glibc-2.7/configure.in 2008-06-24 18:38:46.000000000 +0200 -@@ -911,8 +911,12 @@ - # header directory and add that to the list. NOTE: Only does the right - # thing on a system that doesn't need fixincludes. (Not presently a problem.) - if test -n "$sysheaders"; then -- ccheaders=`$CC -print-file-name=include` -- SYSINCLUDES="-nostdinc -isystem $ccheaders \ -+ SYSINCLUDES=-nostdinc -+ for d in include include-fixed; do -+ i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" && -+ SYSINCLUDES="$SYSINCLUDES -isystem $i" -+ done -+ SYSINCLUDES="$SYSINCLUDES \ - -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`" - if test -n "$CXX"; then - cxxversion=`$CXX -dumpversion 2>&AS_MESSAGE_LOG_FD` && -diff -durN glibc-2.7.orig/configure glibc-2.7/configure ---- glibc-2.7.orig/configure 2008-06-24 18:35:34.000000000 +0200 -+++ glibc-2.7/configure 2008-06-24 18:38:46.000000000 +0200 -@@ -5062,8 +5062,12 @@ - # header directory and add that to the list. NOTE: Only does the right - # thing on a system that doesn't need fixincludes. (Not presently a problem.) - if test -n "$sysheaders"; then -- ccheaders=`$CC -print-file-name=include` -- SYSINCLUDES="-nostdinc -isystem $ccheaders \ -+ SYSINCLUDES=-nostdinc -+ for d in include include-fixed; do -+ i=`$CC -print-file-name="$d"` && test "x$i" != "x$d" && -+ SYSINCLUDES="$SYSINCLUDES -isystem $i" -+ done -+ SYSINCLUDES="$SYSINCLUDES \ - -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`" - if test -n "$CXX"; then - cxxversion=`$CXX -dumpversion 2>&5` && diff --git a/patches/glibc/2.7/220-alpha-asm_elf.patch b/patches/glibc/2.7/220-alpha-asm_elf.patch deleted file mode 100644 index 3da5c8e..0000000 --- a/patches/glibc/2.7/220-alpha-asm_elf.patch +++ /dev/null @@ -1,194 +0,0 @@ -since the kernel no longer provides asm/elf.h, the sys/procfs.h from the -common code, alpha, and sh fail when used. this should things up. --mike - -2008-06-07 Mike Frysinger - - * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. - * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h - definitions from the kernel header to sys/procfs.h and remove the - #include of asm/elf.h. - * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. - -*Attachment: signature.asc * -/Description:/ This is a digitally signed message part. - -2008-06-07 Mike Frysinger - - * sysdeps/unix/sysv/linux/sys/procfs.h: Replace with #error stub. - * sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some asm/elf.h - definitions from the kernel header to sys/procfs.h and remove the - #include of asm/elf.h. - * sysdeps/unix/sysv/linux/sh/sys/procfs.h: Likewise. - ---- a/sysdeps/unix/sysv/linux/alpha/sys/procfs.h -+++ b/sysdeps/unix/sysv/linux/alpha/sys/procfs.h -@@ -29,10 +29,23 @@ - #include - #include - #include --#include - - __BEGIN_DECLS - -+/* -+ * The OSF/1 version of makes gregset_t 46 entries long. -+ * I have no idea why that is so. For now, we just leave it at 33 -+ * (32 general regs + processor status word). -+ */ -+#define ELF_NGREG 33 -+#define ELF_NFPREG 32 -+ -+typedef unsigned long elf_greg_t; -+typedef elf_greg_t elf_gregset_t[ELF_NGREG]; -+ -+typedef double elf_fpreg_t; -+typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; -+ - struct elf_siginfo - { - int si_signo; /* Signal number. */ ---- a/sysdeps/unix/sysv/linux/sh/sys/procfs.h -+++ b/sysdeps/unix/sysv/linux/sh/sys/procfs.h -@@ -29,10 +29,19 @@ - #include - #include - #include --#include - - __BEGIN_DECLS - -+/* -+ * ELF register definitions... -+ */ -+typedef unsigned long elf_greg_t; -+ -+#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) -+typedef elf_greg_t elf_gregset_t[ELF_NGREG]; -+ -+typedef struct user_fpu_struct elf_fpregset_t; -+ - struct elf_siginfo - { - int si_signo; /* Signal number. */ ---- a/sysdeps/unix/sysv/linux/sys/procfs.h -+++ b/sysdeps/unix/sysv/linux/sys/procfs.h -@@ -1,115 +1,2 @@ --/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- -- The GNU C 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 -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, write to the Free -- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -- 02111-1307 USA. */ -- --#ifndef _SYS_PROCFS_H --#define _SYS_PROCFS_H 1 -- --/* This is somehow modelled after the file of the same name on SysVr4 -- systems. It provides a definition of the core file format for ELF -- used on Linux. */ -- --#include --#include --#include --#include --#include --#include --#include -- --__BEGIN_DECLS -- --struct elf_siginfo -- { -- int si_signo; /* Signal number. */ -- int si_code; /* Extra code. */ -- int si_errno; /* Errno. */ -- }; -- --/* Definitions to generate Intel SVR4-like core files. These mostly -- have the same names as the SVR4 types with "elf_" tacked on the -- front to prevent clashes with linux definitions, and the typedef -- forms have been avoided. This is mostly like the SVR4 structure, -- but more Linuxy, with things that Linux does not support and which -- gdb doesn't really use excluded. Fields present but not used are -- marked with "XXX". */ --struct elf_prstatus -- { --#if 0 -- long int pr_flags; /* XXX Process flags. */ -- short int pr_why; /* XXX Reason for process halt. */ -- short int pr_what; /* XXX More detailed reason. */ --#endif -- struct elf_siginfo pr_info; /* Info associated with signal. */ -- short int pr_cursig; /* Current signal. */ -- unsigned long int pr_sigpend; /* Set of pending signals. */ -- unsigned long int pr_sighold; /* Set of held signals. */ --#if 0 -- struct sigaltstack pr_altstack; /* Alternate stack info. */ -- struct sigaction pr_action; /* Signal action for current sig. */ --#endif -- __pid_t pr_pid; -- __pid_t pr_ppid; -- __pid_t pr_pgrp; -- __pid_t pr_sid; -- struct timeval pr_utime; /* User time. */ -- struct timeval pr_stime; /* System time. */ -- struct timeval pr_cutime; /* Cumulative user time. */ -- struct timeval pr_cstime; /* Cumulative system time. */ --#if 0 -- long int pr_instr; /* Current instruction. */ --#endif -- elf_gregset_t pr_reg; /* GP registers. */ -- int pr_fpvalid; /* True if math copro being used. */ -- }; -- -- --#define ELF_PRARGSZ (80) /* Number of chars for args */ -- --struct elf_prpsinfo -- { -- char pr_state; /* Numeric process state. */ -- char pr_sname; /* Char for pr_state. */ -- char pr_zomb; /* Zombie. */ -- char pr_nice; /* Nice val. */ -- unsigned long int pr_flag; /* Flags. */ -- unsigned short int pr_uid; -- unsigned short int pr_gid; -- int pr_pid, pr_ppid, pr_pgrp, pr_sid; -- /* Lots missing */ -- char pr_fname[16]; /* Filename of executable. */ -- char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ -- }; -- --/* Addresses. */ --typedef void *psaddr_t; -- --/* Register sets. Linux has different names. */ --typedef gregset_t prgregset_t; --typedef fpregset_t prfpregset_t; -- --/* We don't have any differences between processes and threads, -- therefore habe only ine PID type. */ --typedef __pid_t lwpid_t; -- -- --typedef struct elf_prstatus prstatus_t; --typedef struct elf_prpsinfo prpsinfo_t; -- --__END_DECLS -- --#endif /* sys/procfs.h */ -+/* sys/procfs.h is architecture specific. */ -+#error "This file must be supplied by every Linux architecture." - diff --git a/patches/glibc/2.7/230-alpha-atfcts.patch b/patches/glibc/2.7/230-alpha-atfcts.patch deleted file mode 100644 index 06c7d8f..0000000 --- a/patches/glibc/2.7/230-alpha-atfcts.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- glibc-2.7/sysdeps/unix/sysv/linux/kernel-features.h 2007-08-14 06:21:09.000000000 +0300 -+++ glibc-2.7/sysdeps/unix/sysv/linux/kernel-features.h.new 2008-07-23 07:05:20.000000000 +0300 -@@ -449,8 +449,7 @@ - and on Alpha just after 2.6.22-rc1. */ - #if __LINUX_KERNEL_VERSION >= 0x020611 \ - && ((!defined __sh__ && !defined __alpha__) \ -- || (__LINUX_KERNEL_VERSION >= 0x020613 && defined __sh__) \ -- || (__LINUX_KERNEL_VERSION >= 0x020617 && defined __alpha__)) -+ || (__LINUX_KERNEL_VERSION >= 0x020613 && defined __sh__)) - # define __ASSUME_ATFCTS 1 - #endif - diff --git a/patches/glibc/2.7/240-alpha-ptr_mangle.patch b/patches/glibc/2.7/240-alpha-ptr_mangle.patch deleted file mode 100644 index 7f22833..0000000 --- a/patches/glibc/2.7/240-alpha-ptr_mangle.patch +++ /dev/null @@ -1,94 +0,0 @@ ---- glibc-2.7.orig/sysdeps/unix/alpha/sysdep.h -+++ glibc-2.7/sysdeps/unix/alpha/sysdep.h -@@ -397,42 +397,4 @@ - _sc_ret = _sc_0, _sc_err = _sc_19; \ - } - --/* Pointer mangling support. Note that tls access is slow enough that -- we don't deoptimize things by placing the pointer check value there. */ -- --#include -- --#if defined NOT_IN_libc && defined IS_IN_rtld --# ifdef __ASSEMBLER__ --# define PTR_MANGLE(dst, src, tmp) \ -- ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \ -- ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \ -- xor src, tmp, dst --# define PTR_MANGLE2(dst, src, tmp) \ -- xor src, tmp, dst --# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) --# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) --# else --extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; --# define PTR_MANGLE(var) \ -- (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) --# define PTR_DEMANGLE(var) PTR_MANGLE(var) --# endif --#elif defined PIC --# ifdef __ASSEMBLER__ --# define PTR_MANGLE(dst, src, tmp) \ -- ldq tmp, __pointer_chk_guard; \ -- xor src, tmp, dst --# define PTR_MANGLE2(dst, src, tmp) \ -- xor src, tmp, dst --# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) --# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) --# else --extern uintptr_t __pointer_chk_guard attribute_relro; --# define PTR_MANGLE(var) \ -- (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard) --# define PTR_DEMANGLE(var) PTR_MANGLE(var) --# endif --#endif -- - #endif /* ASSEMBLER */ ---- glibc-2.7.orig/sysdeps/unix/sysv/linux/alpha/sysdep.h -+++ glibc-2.7/sysdeps/unix/sysv/linux/alpha/sysdep.h -@@ -98,4 +98,46 @@ - INTERNAL_SYSCALL1(name, err_out, nr, args); \ - }) - -+/* Pointer mangling support. Note that tls access is slow enough that -+ we don't deoptimize things by placing the pointer check value there. */ -+ -+#if defined NOT_IN_libc && defined IS_IN_rtld -+# ifdef __ASSEMBLER__ -+# define PTR_MANGLE(dst, src, tmp) \ -+ ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \ -+ ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \ -+ xor src, tmp, dst -+# define PTR_MANGLE2(dst, src, tmp) \ -+ xor src, tmp, dst -+# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) -+# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) -+# else -+extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; -+# define PTR_MANGLE(var) \ -+ (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) -+# define PTR_DEMANGLE(var) PTR_MANGLE(var) -+# endif -+#elif defined PIC -+# ifdef __ASSEMBLER__ -+# define PTR_MANGLE(dst, src, tmp) \ -+ ldq tmp, __pointer_chk_guard; \ -+ xor src, tmp, dst -+# define PTR_MANGLE2(dst, src, tmp) \ -+ xor src, tmp, dst -+# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) -+# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) -+# else -+extern uintptr_t __pointer_chk_guard attribute_relro; -+# define PTR_MANGLE(var) \ -+ (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard) -+# define PTR_DEMANGLE(var) PTR_MANGLE(var) -+# endif -+#else -+/* Pointer mangling is not yet supported for static libc on alpha. */ -+# ifndef __ASSEMBLER__ -+# define PTR_MANGLE(var) (void) (var) -+# define PTR_DEMANGLE(var) (void) (var) -+# endif -+#endif -+ - #endif /* _LINUX_ALPHA_SYSDEP_H */ diff --git a/patches/glibc/linuxthreads-2.3.6/110-alpha-cfi.patch b/patches/glibc/linuxthreads-2.3.6/110-alpha-cfi.patch new file mode 100644 index 0000000..97c152e --- /dev/null +++ b/patches/glibc/linuxthreads-2.3.6/110-alpha-cfi.patch @@ -0,0 +1,25 @@ +--- glibc-2.3.6/linuxthreads/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h.orig 2008-06-19 15:31:45.000000000 +0300 ++++ glibc-2.3.6/linuxthreads/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h 2008-06-19 15:36:10.000000000 +0300 +@@ -54,6 +54,7 @@ + bne a3, SYSCALL_ERROR_LABEL; \ + __LABEL($pseudo_ret) \ + .subsection 2; \ ++ cfi_startproc; \ + __LABEL($pseudo_cancel) \ + subq sp, 64, sp; \ + cfi_def_cfa_offset(64); \ +@@ -84,12 +85,13 @@ + cfi_def_cfa_offset(0); \ + __LABEL($syscall_error) \ + SYSCALL_ERROR_HANDLER; \ ++ cfi_endproc; \ + .previous + + # undef PSEUDO_END + # define PSEUDO_END(sym) \ +- .subsection 2; \ + cfi_endproc; \ ++ .subsection 2; \ + .size sym, .-sym + + # define SAVE_ARGS_0 /* Nothing. */ diff --git a/patches/glibc/linuxthreads-2.3.6/270-alpha-cfi.patch b/patches/glibc/linuxthreads-2.3.6/270-alpha-cfi.patch deleted file mode 100644 index 97c152e..0000000 --- a/patches/glibc/linuxthreads-2.3.6/270-alpha-cfi.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- glibc-2.3.6/linuxthreads/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h.orig 2008-06-19 15:31:45.000000000 +0300 -+++ glibc-2.3.6/linuxthreads/sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h 2008-06-19 15:36:10.000000000 +0300 -@@ -54,6 +54,7 @@ - bne a3, SYSCALL_ERROR_LABEL; \ - __LABEL($pseudo_ret) \ - .subsection 2; \ -+ cfi_startproc; \ - __LABEL($pseudo_cancel) \ - subq sp, 64, sp; \ - cfi_def_cfa_offset(64); \ -@@ -84,12 +85,13 @@ - cfi_def_cfa_offset(0); \ - __LABEL($syscall_error) \ - SYSCALL_ERROR_HANDLER; \ -+ cfi_endproc; \ - .previous - - # undef PSEUDO_END - # define PSEUDO_END(sym) \ -- .subsection 2; \ - cfi_endproc; \ -+ .subsection 2; \ - .size sym, .-sym - - # define SAVE_ARGS_0 /* Nothing. */ diff --git a/patches/glibc/ports-2.6.1/110-ARM-asm_page_h.patch b/patches/glibc/ports-2.6.1/110-ARM-asm_page_h.patch new file mode 100644 index 0000000..4e882af --- /dev/null +++ b/patches/glibc/ports-2.6.1/110-ARM-asm_page_h.patch @@ -0,0 +1,11 @@ +diff -durN glibc-ports-2.7.orig/sysdeps/unix/sysv/linux/arm/ioperm.c glibc-ports-2.7/sysdeps/unix/sysv/linux/arm/ioperm.c +--- glibc-2.6.1.orig/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/arm/ioperm.c 2005-06-10 13:12:09.000000000 +0200 ++++ glibc-2.6.1/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/arm/ioperm.c 2008-05-18 16:19:45.000000000 +0200 +@@ -45,7 +45,6 @@ + #include + + #include +-#include + #include + + #define PATH_ARM_SYSTYPE "/etc/arm_systype" diff --git a/patches/glibc/ports-2.6.1/200-ARM-asm_page_h.patch b/patches/glibc/ports-2.6.1/200-ARM-asm_page_h.patch deleted file mode 100644 index 4e882af..0000000 --- a/patches/glibc/ports-2.6.1/200-ARM-asm_page_h.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -durN glibc-ports-2.7.orig/sysdeps/unix/sysv/linux/arm/ioperm.c glibc-ports-2.7/sysdeps/unix/sysv/linux/arm/ioperm.c ---- glibc-2.6.1.orig/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/arm/ioperm.c 2005-06-10 13:12:09.000000000 +0200 -+++ glibc-2.6.1/glibc-ports-2.6.1/sysdeps/unix/sysv/linux/arm/ioperm.c 2008-05-18 16:19:45.000000000 +0200 -@@ -45,7 +45,6 @@ - #include - - #include --#include - #include - - #define PATH_ARM_SYSTYPE "/etc/arm_systype" diff --git a/patches/strace/4.5.15/110-dont-use-REG_SYSCALL-for-sh.patch b/patches/strace/4.5.15/110-dont-use-REG_SYSCALL-for-sh.patch new file mode 100644 index 0000000..8add445 --- /dev/null +++ b/patches/strace/4.5.15/110-dont-use-REG_SYSCALL-for-sh.patch @@ -0,0 +1,11 @@ +diff -dur strace-4.5.15.orig/process.c strace-4.5.15/process.c +--- strace-4.5.15.orig/process.c 2007-01-11 23:08:38.000000000 +0100 ++++ strace-4.5.15/process.c 2007-07-14 19:19:58.000000000 +0200 +@@ -2679,7 +2679,6 @@ + { 4*REG_GBR, "4*REG_GBR" }, + { 4*REG_MACH, "4*REG_MACH" }, + { 4*REG_MACL, "4*REG_MACL" }, +- { 4*REG_SYSCALL, "4*REG_SYSCALL" }, + { 4*REG_FPUL, "4*REG_FPUL" }, + { 4*REG_FPREG0, "4*REG_FPREG0" }, + { 4*(REG_FPREG0+1), "4*REG_FPREG1" }, diff --git a/patches/strace/4.5.15/120-fix-arm-bad-syscall.patch b/patches/strace/4.5.15/120-fix-arm-bad-syscall.patch new file mode 100644 index 0000000..aa4c5c4 --- /dev/null +++ b/patches/strace/4.5.15/120-fix-arm-bad-syscall.patch @@ -0,0 +1,19 @@ +diff -dur strace-4.5.15.orig/syscall.c strace-4.5.15/syscall.c +--- strace-4.5.15.orig/syscall.c 2006-12-21 23:13:33.000000000 +0100 ++++ strace-4.5.15/syscall.c 2007-07-14 19:21:44.000000000 +0200 +@@ -1045,6 +1045,15 @@ + /* + * Note: we only deal with only 32-bit CPUs here. + */ ++ ++ if (!(tcp->flags & TCB_INSYSCALL) && ++ (tcp->flags & TCB_WAITEXECVE)) { ++ /* caught a fake syscall from the execve's exit */ ++ tcp->flags &= ~TCB_WAITEXECVE; ++ return 0; ++ } ++ ++ + if (regs.ARM_cpsr & 0x20) { + /* + * Get the Thumb-mode system call number diff --git a/patches/strace/4.5.15/130-fix-disabled-largefile-syscalls.patch b/patches/strace/4.5.15/130-fix-disabled-largefile-syscalls.patch new file mode 100644 index 0000000..22903cd --- /dev/null +++ b/patches/strace/4.5.15/130-fix-disabled-largefile-syscalls.patch @@ -0,0 +1,22 @@ +diff -dur strace-4.5.15.orig/syscall.c strace-4.5.15/syscall.c +--- strace-4.5.15.orig/syscall.c 2007-07-14 19:21:44.000000000 +0200 ++++ strace-4.5.15/syscall.c 2007-07-14 19:22:49.000000000 +0200 +@@ -125,6 +125,18 @@ + #define TP TRACE_PROCESS + #define TS TRACE_SIGNAL + ++#ifndef HAVE_STATFS64 ++/* ++ * Ugly hacks for systems that do not have LFS ++ */ ++ ++#define sys_truncate64 sys_truncate ++#define sys_ftruncate64 sys_ftruncate ++#define sys_getdents64 sys_getdents ++#define sys_statfs64 sys_statfs ++#define sys_fstatfs64 sys_fstatfs ++#endif ++ + static const struct sysent sysent0[] = { + #include "syscallent.h" + }; diff --git a/patches/strace/4.5.15/140-mips-sprintsigmask-fix.patch b/patches/strace/4.5.15/140-mips-sprintsigmask-fix.patch new file mode 100644 index 0000000..e2aaa40 --- /dev/null +++ b/patches/strace/4.5.15/140-mips-sprintsigmask-fix.patch @@ -0,0 +1,12 @@ +diff -dur strace-4.5.15.orig/signal.c strace-4.5.15/signal.c +--- strace-4.5.15.orig/signal.c 2007-01-11 23:08:38.000000000 +0100 ++++ strace-4.5.15/signal.c 2007-07-14 19:24:43.000000000 +0200 +@@ -1440,7 +1440,7 @@ + tcp->u_rval = tcp->u_error = 0; + if(tcp->u_arg[0] == 0) + return 0; +- tcp->auxstr = sprintsigmask("mask now ", tcp->u_arg[1]); ++ tcp->auxstr = sprintsigmask("mask now ", tcp->u_arg[1], 0); + return RVAL_NONE | RVAL_STR; + } + return 0; diff --git a/patches/strace/4.5.15/150-dont-use-REG_SYSCALL-for-sh.patch b/patches/strace/4.5.15/150-dont-use-REG_SYSCALL-for-sh.patch deleted file mode 100644 index 8add445..0000000 --- a/patches/strace/4.5.15/150-dont-use-REG_SYSCALL-for-sh.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -dur strace-4.5.15.orig/process.c strace-4.5.15/process.c ---- strace-4.5.15.orig/process.c 2007-01-11 23:08:38.000000000 +0100 -+++ strace-4.5.15/process.c 2007-07-14 19:19:58.000000000 +0200 -@@ -2679,7 +2679,6 @@ - { 4*REG_GBR, "4*REG_GBR" }, - { 4*REG_MACH, "4*REG_MACH" }, - { 4*REG_MACL, "4*REG_MACL" }, -- { 4*REG_SYSCALL, "4*REG_SYSCALL" }, - { 4*REG_FPUL, "4*REG_FPUL" }, - { 4*REG_FPREG0, "4*REG_FPREG0" }, - { 4*(REG_FPREG0+1), "4*REG_FPREG1" }, diff --git a/patches/strace/4.5.15/150-statfs64-check.patch b/patches/strace/4.5.15/150-statfs64-check.patch new file mode 100644 index 0000000..a1d8e5f --- /dev/null +++ b/patches/strace/4.5.15/150-statfs64-check.patch @@ -0,0 +1,53 @@ +diff -dur strace-4.5.15.orig/acinclude.m4 strace-4.5.15/acinclude.m4 +--- strace-4.5.15.orig/acinclude.m4 2004-04-14 04:21:01.000000000 +0200 ++++ strace-4.5.15/acinclude.m4 2007-07-14 19:25:25.000000000 +0200 +@@ -210,6 +210,26 @@ + fi + ]) + ++dnl ### A macro to determine whether statfs64 is defined. ++AC_DEFUN([AC_STATFS64], ++[AC_MSG_CHECKING(for statfs64 in sys/(statfs|vfs).h) ++AC_CACHE_VAL(ac_cv_type_statfs64, ++[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef LINUX ++#include ++#include ++#else ++#include ++#endif]], [[struct statfs64 st;]])],[ac_cv_type_statfs64=yes],[ac_cv_type_statfs64=no])]) ++AC_MSG_RESULT($ac_cv_type_statfs64) ++if test "$ac_cv_type_statfs64" = yes ++then ++ AC_DEFINE([HAVE_STATFS64], 1, ++[Define if statfs64 is available in sys/statfs.h or sys/vfs.h.]) ++fi ++]) ++ ++ ++ + dnl ### A macro to determine if off_t is a long long + AC_DEFUN([AC_OFF_T_IS_LONG_LONG], + [AC_MSG_CHECKING(for long long off_t) +diff -dur strace-4.5.15.orig/configure.ac strace-4.5.15/configure.ac +--- strace-4.5.15.orig/configure.ac 2007-01-11 12:37:55.000000000 +0100 ++++ strace-4.5.15/configure.ac 2007-07-14 19:25:25.000000000 +0200 +@@ -169,6 +169,7 @@ + struct stat.st_level, + struct stat.st_rdev]) + AC_STAT64 ++AC_STATFS64 + + AC_TYPE_SIGNAL + AC_TYPE_UID_T +diff -dur strace-4.5.15.orig/file.c strace-4.5.15/file.c +--- strace-4.5.15.orig/file.c 2007-01-15 21:25:52.000000000 +0100 ++++ strace-4.5.15/file.c 2007-07-14 19:25:25.000000000 +0200 +@@ -1635,7 +1635,7 @@ + return 0; + } + +-#ifdef LINUX ++#ifdef HAVE_STATFS64 + static void + printstatfs64(tcp, addr) + struct tcb *tcp; diff --git a/patches/strace/4.5.15/160-superh-update.ac.patch b/patches/strace/4.5.15/160-superh-update.ac.patch new file mode 100644 index 0000000..75e2cd4 --- /dev/null +++ b/patches/strace/4.5.15/160-superh-update.ac.patch @@ -0,0 +1,22 @@ +diff -dur strace-4.5.15.orig/configure.ac strace-4.5.15/configure.ac +--- strace-4.5.15.orig/configure.ac 2007-07-14 19:25:25.000000000 +0200 ++++ strace-4.5.15/configure.ac 2007-07-14 19:27:35.000000000 +0200 +@@ -91,14 +91,14 @@ + arch=hppa + AC_DEFINE([HPPA], 1, [Define for the HPPA architecture.]) + ;; +-sh) +- arch=sh +- AC_DEFINE([SH], 1, [Define for the SH architecture.]) +- ;; + sh64) + arch=sh64 + AC_DEFINE([SH64], 1, [Define for the SH64 architecture.]) + ;; ++sh*) ++ arch=sh ++ AC_DEFINE([SH], 1, [Define for the SH architecture.]) ++ ;; + x86?64*) + arch=x86_64 + AC_DEFINE([X86_64], 1, [Define for the AMD x86-64 architecture.]) diff --git a/patches/strace/4.5.15/170-undef-CTL_PROC.patch b/patches/strace/4.5.15/170-undef-CTL_PROC.patch new file mode 100644 index 0000000..cfb8752 --- /dev/null +++ b/patches/strace/4.5.15/170-undef-CTL_PROC.patch @@ -0,0 +1,13 @@ +diff -dur strace-4.5.15.orig/system.c strace-4.5.15/system.c +--- strace-4.5.15.orig/system.c 2007-01-17 00:22:36.000000000 +0100 ++++ strace-4.5.15/system.c 2007-07-14 19:28:41.000000000 +0200 +@@ -1612,7 +1612,9 @@ + { CTL_KERN, "CTL_KERN" }, + { CTL_VM, "CTL_VM" }, + { CTL_NET, "CTL_NET" }, ++#ifdef CTL_PROC + { CTL_PROC, "CTL_PROC" }, ++#endif + { CTL_FS, "CTL_FS" }, + { CTL_DEBUG, "CTL_DEBUG" }, + { CTL_DEV, "CTL_DEV" }, diff --git a/patches/strace/4.5.15/180-undef-PACKET_MEMBERSHIP.patch b/patches/strace/4.5.15/180-undef-PACKET_MEMBERSHIP.patch new file mode 100644 index 0000000..d7a100e --- /dev/null +++ b/patches/strace/4.5.15/180-undef-PACKET_MEMBERSHIP.patch @@ -0,0 +1,16 @@ +diff -dur strace-4.5.15.orig/net.c strace-4.5.15/net.c +--- strace-4.5.15.orig/net.c 2006-12-13 20:57:23.000000000 +0100 ++++ strace-4.5.15/net.c 2007-07-14 19:29:36.000000000 +0200 +@@ -800,8 +800,12 @@ + + #ifdef SOL_PACKET + static const struct xlat sockpacketoptions[] = { ++#if defined(PACKET_ADD_MEMBERSHIP) + { PACKET_ADD_MEMBERSHIP, "PACKET_ADD_MEMBERSHIP" }, ++#endif ++#if defined(PACKET_DROP_MEMBERSHIP) + { PACKET_DROP_MEMBERSHIP, "PACKET_DROP_MEMBERSHIP"}, ++#endif + #if defined(PACKET_RECV_OUTPUT) + { PACKET_RECV_OUTPUT, "PACKET_RECV_OUTPUT" }, + #endif diff --git a/patches/strace/4.5.15/190-undef-syscall.patch b/patches/strace/4.5.15/190-undef-syscall.patch new file mode 100644 index 0000000..7123f04 --- /dev/null +++ b/patches/strace/4.5.15/190-undef-syscall.patch @@ -0,0 +1,64 @@ +diff -dur strace-4.5.15.orig/linux/syscallent.h strace-4.5.15/linux/syscallent.h +--- strace-4.5.15.orig/linux/syscallent.h 2006-10-16 03:17:52.000000000 +0200 ++++ strace-4.5.15/linux/syscallent.h 2007-07-14 19:30:16.000000000 +0200 +@@ -130,7 +130,11 @@ + { 2, TF, sys_statfs, "statfs" }, /* 99 */ + { 2, TD, sys_fstatfs, "fstatfs" }, /* 100 */ + { 3, 0, sys_ioperm, "ioperm" }, /* 101 */ +- { 2, TD, sys_socketcall, "socketcall", SYS_socketcall }, /* 102 */ ++ { 2, TD, sys_socketcall, "socketcall" ++#ifdef __NR_socketcall ++ , SYS_socketcall ++#endif ++ }, /* 102 */ + { 3, 0, sys_syslog, "syslog" }, /* 103 */ + { 3, 0, sys_setitimer, "setitimer" }, /* 104 */ + { 2, 0, sys_getitimer, "getitimer" }, /* 105 */ +@@ -145,7 +149,11 @@ + { 4, TP, sys_wait4, "wait4", SYS_wait4 }, /* 114 */ + { 1, 0, sys_swapoff, "swapoff" }, /* 115 */ + { 1, 0, sys_sysinfo, "sysinfo" }, /* 116 */ +- { 6, 0, sys_ipc, "ipc", SYS_ipc }, /* 117 */ ++ { 6, 0, sys_ipc, "ipc" ++#ifdef __NR_ipc ++ , SYS_ipc ++#endif ++ }, /* 117 */ + { 1, TD, sys_fsync, "fsync" }, /* 118 */ + { 1, TS, sys_sigreturn, "sigreturn" }, /* 119 */ + { 5, TP, sys_clone, "clone", SYS_clone }, /* 120 */ +@@ -282,7 +290,11 @@ + { 3, 0, sys_io_cancel, "io_cancel" }, /* 249 */ + { 5, 0, sys_fadvise64, "fadvise64" }, /* 250 */ + { 5, 0, printargs, "SYS_251" }, /* 251 */ +- { 1, TP, sys_exit, "exit_group", __NR_exit_group }, /* 252 */ ++ { 1, TP, sys_exit, "exit_group" ++#ifdef __NR_exit_group ++ , __NR_exit_group ++#endif ++ }, /* 252 */ + { 4, 0, printargs, "lookup_dcookie"}, /* 253 */ + { 1, 0, sys_epoll_create, "epoll_create" }, /* 254 */ + { 4, TD, sys_epoll_ctl, "epoll_ctl" }, /* 255 */ +diff -dur strace-4.5.15.orig/syscall.c strace-4.5.15/syscall.c +--- strace-4.5.15.orig/syscall.c 2007-07-14 19:22:49.000000000 +0200 ++++ strace-4.5.15/syscall.c 2007-07-14 19:30:16.000000000 +0200 +@@ -2404,14 +2404,18 @@ + switch (known_scno(tcp)) { + #ifdef LINUX + #if !defined (ALPHA) && !defined(SPARC) && !defined(SPARC64) && !defined(MIPS) && !defined(HPPA) ++#ifdef __NR_socketcall + case SYS_socketcall: + decode_subcall(tcp, SYS_socket_subcall, + SYS_socket_nsubcalls, deref_style); + break; ++#endif ++#ifdef __NR_ipc + case SYS_ipc: + decode_subcall(tcp, SYS_ipc_subcall, + SYS_ipc_nsubcalls, shift_style); + break; ++#endif + #endif /* !ALPHA && !MIPS && !SPARC && !SPARC64 && !HPPA */ + #if defined (SPARC) || defined (SPARC64) + case SYS_socketcall: diff --git a/patches/strace/4.5.15/200-fix-arm-bad-syscall.patch b/patches/strace/4.5.15/200-fix-arm-bad-syscall.patch deleted file mode 100644 index aa4c5c4..0000000 --- a/patches/strace/4.5.15/200-fix-arm-bad-syscall.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff -dur strace-4.5.15.orig/syscall.c strace-4.5.15/syscall.c ---- strace-4.5.15.orig/syscall.c 2006-12-21 23:13:33.000000000 +0100 -+++ strace-4.5.15/syscall.c 2007-07-14 19:21:44.000000000 +0200 -@@ -1045,6 +1045,15 @@ - /* - * Note: we only deal with only 32-bit CPUs here. - */ -+ -+ if (!(tcp->flags & TCB_INSYSCALL) && -+ (tcp->flags & TCB_WAITEXECVE)) { -+ /* caught a fake syscall from the execve's exit */ -+ tcp->flags &= ~TCB_WAITEXECVE; -+ return 0; -+ } -+ -+ - if (regs.ARM_cpsr & 0x20) { - /* - * Get the Thumb-mode system call number diff --git a/patches/strace/4.5.15/250-fix-disabled-largefile-syscalls.patch b/patches/strace/4.5.15/250-fix-disabled-largefile-syscalls.patch deleted file mode 100644 index 22903cd..0000000 --- a/patches/strace/4.5.15/250-fix-disabled-largefile-syscalls.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff -dur strace-4.5.15.orig/syscall.c strace-4.5.15/syscall.c ---- strace-4.5.15.orig/syscall.c 2007-07-14 19:21:44.000000000 +0200 -+++ strace-4.5.15/syscall.c 2007-07-14 19:22:49.000000000 +0200 -@@ -125,6 +125,18 @@ - #define TP TRACE_PROCESS - #define TS TRACE_SIGNAL - -+#ifndef HAVE_STATFS64 -+/* -+ * Ugly hacks for systems that do not have LFS -+ */ -+ -+#define sys_truncate64 sys_truncate -+#define sys_ftruncate64 sys_ftruncate -+#define sys_getdents64 sys_getdents -+#define sys_statfs64 sys_statfs -+#define sys_fstatfs64 sys_fstatfs -+#endif -+ - static const struct sysent sysent0[] = { - #include "syscallent.h" - }; diff --git a/patches/strace/4.5.15/300-mips-sprintsigmask-fix.patch b/patches/strace/4.5.15/300-mips-sprintsigmask-fix.patch deleted file mode 100644 index e2aaa40..0000000 --- a/patches/strace/4.5.15/300-mips-sprintsigmask-fix.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -dur strace-4.5.15.orig/signal.c strace-4.5.15/signal.c ---- strace-4.5.15.orig/signal.c 2007-01-11 23:08:38.000000000 +0100 -+++ strace-4.5.15/signal.c 2007-07-14 19:24:43.000000000 +0200 -@@ -1440,7 +1440,7 @@ - tcp->u_rval = tcp->u_error = 0; - if(tcp->u_arg[0] == 0) - return 0; -- tcp->auxstr = sprintsigmask("mask now ", tcp->u_arg[1]); -+ tcp->auxstr = sprintsigmask("mask now ", tcp->u_arg[1], 0); - return RVAL_NONE | RVAL_STR; - } - return 0; diff --git a/patches/strace/4.5.15/350-statfs64-check.patch b/patches/strace/4.5.15/350-statfs64-check.patch deleted file mode 100644 index a1d8e5f..0000000 --- a/patches/strace/4.5.15/350-statfs64-check.patch +++ /dev/null @@ -1,53 +0,0 @@ -diff -dur strace-4.5.15.orig/acinclude.m4 strace-4.5.15/acinclude.m4 ---- strace-4.5.15.orig/acinclude.m4 2004-04-14 04:21:01.000000000 +0200 -+++ strace-4.5.15/acinclude.m4 2007-07-14 19:25:25.000000000 +0200 -@@ -210,6 +210,26 @@ - fi - ]) - -+dnl ### A macro to determine whether statfs64 is defined. -+AC_DEFUN([AC_STATFS64], -+[AC_MSG_CHECKING(for statfs64 in sys/(statfs|vfs).h) -+AC_CACHE_VAL(ac_cv_type_statfs64, -+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef LINUX -+#include -+#include -+#else -+#include -+#endif]], [[struct statfs64 st;]])],[ac_cv_type_statfs64=yes],[ac_cv_type_statfs64=no])]) -+AC_MSG_RESULT($ac_cv_type_statfs64) -+if test "$ac_cv_type_statfs64" = yes -+then -+ AC_DEFINE([HAVE_STATFS64], 1, -+[Define if statfs64 is available in sys/statfs.h or sys/vfs.h.]) -+fi -+]) -+ -+ -+ - dnl ### A macro to determine if off_t is a long long - AC_DEFUN([AC_OFF_T_IS_LONG_LONG], - [AC_MSG_CHECKING(for long long off_t) -diff -dur strace-4.5.15.orig/configure.ac strace-4.5.15/configure.ac ---- strace-4.5.15.orig/configure.ac 2007-01-11 12:37:55.000000000 +0100 -+++ strace-4.5.15/configure.ac 2007-07-14 19:25:25.000000000 +0200 -@@ -169,6 +169,7 @@ - struct stat.st_level, - struct stat.st_rdev]) - AC_STAT64 -+AC_STATFS64 - - AC_TYPE_SIGNAL - AC_TYPE_UID_T -diff -dur strace-4.5.15.orig/file.c strace-4.5.15/file.c ---- strace-4.5.15.orig/file.c 2007-01-15 21:25:52.000000000 +0100 -+++ strace-4.5.15/file.c 2007-07-14 19:25:25.000000000 +0200 -@@ -1635,7 +1635,7 @@ - return 0; - } - --#ifdef LINUX -+#ifdef HAVE_STATFS64 - static void - printstatfs64(tcp, addr) - struct tcb *tcp; diff --git a/patches/strace/4.5.15/400-superh-update.ac.patch b/patches/strace/4.5.15/400-superh-update.ac.patch deleted file mode 100644 index 75e2cd4..0000000 --- a/patches/strace/4.5.15/400-superh-update.ac.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff -dur strace-4.5.15.orig/configure.ac strace-4.5.15/configure.ac ---- strace-4.5.15.orig/configure.ac 2007-07-14 19:25:25.000000000 +0200 -+++ strace-4.5.15/configure.ac 2007-07-14 19:27:35.000000000 +0200 -@@ -91,14 +91,14 @@ - arch=hppa - AC_DEFINE([HPPA], 1, [Define for the HPPA architecture.]) - ;; --sh) -- arch=sh -- AC_DEFINE([SH], 1, [Define for the SH architecture.]) -- ;; - sh64) - arch=sh64 - AC_DEFINE([SH64], 1, [Define for the SH64 architecture.]) - ;; -+sh*) -+ arch=sh -+ AC_DEFINE([SH], 1, [Define for the SH architecture.]) -+ ;; - x86?64*) - arch=x86_64 - AC_DEFINE([X86_64], 1, [Define for the AMD x86-64 architecture.]) diff --git a/patches/strace/4.5.15/450-undef-CTL_PROC.patch b/patches/strace/4.5.15/450-undef-CTL_PROC.patch deleted file mode 100644 index cfb8752..0000000 --- a/patches/strace/4.5.15/450-undef-CTL_PROC.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -dur strace-4.5.15.orig/system.c strace-4.5.15/system.c ---- strace-4.5.15.orig/system.c 2007-01-17 00:22:36.000000000 +0100 -+++ strace-4.5.15/system.c 2007-07-14 19:28:41.000000000 +0200 -@@ -1612,7 +1612,9 @@ - { CTL_KERN, "CTL_KERN" }, - { CTL_VM, "CTL_VM" }, - { CTL_NET, "CTL_NET" }, -+#ifdef CTL_PROC - { CTL_PROC, "CTL_PROC" }, -+#endif - { CTL_FS, "CTL_FS" }, - { CTL_DEBUG, "CTL_DEBUG" }, - { CTL_DEV, "CTL_DEV" }, diff --git a/patches/strace/4.5.15/500-undef-PACKET_MEMBERSHIP.patch b/patches/strace/4.5.15/500-undef-PACKET_MEMBERSHIP.patch deleted file mode 100644 index d7a100e..0000000 --- a/patches/strace/4.5.15/500-undef-PACKET_MEMBERSHIP.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff -dur strace-4.5.15.orig/net.c strace-4.5.15/net.c ---- strace-4.5.15.orig/net.c 2006-12-13 20:57:23.000000000 +0100 -+++ strace-4.5.15/net.c 2007-07-14 19:29:36.000000000 +0200 -@@ -800,8 +800,12 @@ - - #ifdef SOL_PACKET - static const struct xlat sockpacketoptions[] = { -+#if defined(PACKET_ADD_MEMBERSHIP) - { PACKET_ADD_MEMBERSHIP, "PACKET_ADD_MEMBERSHIP" }, -+#endif -+#if defined(PACKET_DROP_MEMBERSHIP) - { PACKET_DROP_MEMBERSHIP, "PACKET_DROP_MEMBERSHIP"}, -+#endif - #if defined(PACKET_RECV_OUTPUT) - { PACKET_RECV_OUTPUT, "PACKET_RECV_OUTPUT" }, - #endif diff --git a/patches/strace/4.5.15/550-undef-syscall.patch b/patches/strace/4.5.15/550-undef-syscall.patch deleted file mode 100644 index 7123f04..0000000 --- a/patches/strace/4.5.15/550-undef-syscall.patch +++ /dev/null @@ -1,64 +0,0 @@ -diff -dur strace-4.5.15.orig/linux/syscallent.h strace-4.5.15/linux/syscallent.h ---- strace-4.5.15.orig/linux/syscallent.h 2006-10-16 03:17:52.000000000 +0200 -+++ strace-4.5.15/linux/syscallent.h 2007-07-14 19:30:16.000000000 +0200 -@@ -130,7 +130,11 @@ - { 2, TF, sys_statfs, "statfs" }, /* 99 */ - { 2, TD, sys_fstatfs, "fstatfs" }, /* 100 */ - { 3, 0, sys_ioperm, "ioperm" }, /* 101 */ -- { 2, TD, sys_socketcall, "socketcall", SYS_socketcall }, /* 102 */ -+ { 2, TD, sys_socketcall, "socketcall" -+#ifdef __NR_socketcall -+ , SYS_socketcall -+#endif -+ }, /* 102 */ - { 3, 0, sys_syslog, "syslog" }, /* 103 */ - { 3, 0, sys_setitimer, "setitimer" }, /* 104 */ - { 2, 0, sys_getitimer, "getitimer" }, /* 105 */ -@@ -145,7 +149,11 @@ - { 4, TP, sys_wait4, "wait4", SYS_wait4 }, /* 114 */ - { 1, 0, sys_swapoff, "swapoff" }, /* 115 */ - { 1, 0, sys_sysinfo, "sysinfo" }, /* 116 */ -- { 6, 0, sys_ipc, "ipc", SYS_ipc }, /* 117 */ -+ { 6, 0, sys_ipc, "ipc" -+#ifdef __NR_ipc -+ , SYS_ipc -+#endif -+ }, /* 117 */ - { 1, TD, sys_fsync, "fsync" }, /* 118 */ - { 1, TS, sys_sigreturn, "sigreturn" }, /* 119 */ - { 5, TP, sys_clone, "clone", SYS_clone }, /* 120 */ -@@ -282,7 +290,11 @@ - { 3, 0, sys_io_cancel, "io_cancel" }, /* 249 */ - { 5, 0, sys_fadvise64, "fadvise64" }, /* 250 */ - { 5, 0, printargs, "SYS_251" }, /* 251 */ -- { 1, TP, sys_exit, "exit_group", __NR_exit_group }, /* 252 */ -+ { 1, TP, sys_exit, "exit_group" -+#ifdef __NR_exit_group -+ , __NR_exit_group -+#endif -+ }, /* 252 */ - { 4, 0, printargs, "lookup_dcookie"}, /* 253 */ - { 1, 0, sys_epoll_create, "epoll_create" }, /* 254 */ - { 4, TD, sys_epoll_ctl, "epoll_ctl" }, /* 255 */ -diff -dur strace-4.5.15.orig/syscall.c strace-4.5.15/syscall.c ---- strace-4.5.15.orig/syscall.c 2007-07-14 19:22:49.000000000 +0200 -+++ strace-4.5.15/syscall.c 2007-07-14 19:30:16.000000000 +0200 -@@ -2404,14 +2404,18 @@ - switch (known_scno(tcp)) { - #ifdef LINUX - #if !defined (ALPHA) && !defined(SPARC) && !defined(SPARC64) && !defined(MIPS) && !defined(HPPA) -+#ifdef __NR_socketcall - case SYS_socketcall: - decode_subcall(tcp, SYS_socket_subcall, - SYS_socket_nsubcalls, deref_style); - break; -+#endif -+#ifdef __NR_ipc - case SYS_ipc: - decode_subcall(tcp, SYS_ipc_subcall, - SYS_ipc_nsubcalls, shift_style); - break; -+#endif - #endif /* !ALPHA && !MIPS && !SPARC && !SPARC64 && !HPPA */ - #if defined (SPARC) || defined (SPARC64) - case SYS_socketcall: diff --git a/patches/strace/4.5.16/110-dont-use-REG_SYSCALL-for-sh.patch b/patches/strace/4.5.16/110-dont-use-REG_SYSCALL-for-sh.patch new file mode 100644 index 0000000..ebbf69a --- /dev/null +++ b/patches/strace/4.5.16/110-dont-use-REG_SYSCALL-for-sh.patch @@ -0,0 +1,11 @@ +diff -dur strace-4.5.16.orig/process.c strace-4.5.16/process.c +--- strace-4.5.16.orig/process.c 2007-01-11 23:08:38.000000000 +0100 ++++ strace-4.5.16/process.c 2007-07-14 19:19:58.000000000 +0200 +@@ -2685,7 +2685,6 @@ + { 4*REG_GBR, "4*REG_GBR" }, + { 4*REG_MACH, "4*REG_MACH" }, + { 4*REG_MACL, "4*REG_MACL" }, +- { 4*REG_SYSCALL, "4*REG_SYSCALL" }, + { 4*REG_FPUL, "4*REG_FPUL" }, + { 4*REG_FPREG0, "4*REG_FPREG0" }, + { 4*(REG_FPREG0+1), "4*REG_FPREG1" }, diff --git a/patches/strace/4.5.16/120-fix-arm-bad-syscall.patch b/patches/strace/4.5.16/120-fix-arm-bad-syscall.patch new file mode 100644 index 0000000..d31b9da --- /dev/null +++ b/patches/strace/4.5.16/120-fix-arm-bad-syscall.patch @@ -0,0 +1,19 @@ +diff -dur strace-4.5.16.orig/syscall.c strace-4.5.16/syscall.c +--- strace-4.5.16.orig/syscall.c 2006-12-21 23:13:33.000000000 +0100 ++++ strace-4.5.16/syscall.c 2007-07-14 19:21:44.000000000 +0200 +@@ -1045,6 +1045,15 @@ + /* + * Note: we only deal with only 32-bit CPUs here. + */ ++ ++ if (!(tcp->flags & TCB_INSYSCALL) && ++ (tcp->flags & TCB_WAITEXECVE)) { ++ /* caught a fake syscall from the execve's exit */ ++ tcp->flags &= ~TCB_WAITEXECVE; ++ return 0; ++ } ++ ++ + if (regs.ARM_cpsr & 0x20) { + /* + * Get the Thumb-mode system call number diff --git a/patches/strace/4.5.16/130-fix-disabled-largefile-syscalls.patch b/patches/strace/4.5.16/130-fix-disabled-largefile-syscalls.patch new file mode 100644 index 0000000..2f47dc9 --- /dev/null +++ b/patches/strace/4.5.16/130-fix-disabled-largefile-syscalls.patch @@ -0,0 +1,22 @@ +diff -dur strace-4.5.16.orig/syscall.c strace-4.5.16/syscall.c +--- strace-4.5.16.orig/syscall.c 2007-07-14 19:21:44.000000000 +0200 ++++ strace-4.5.16/syscall.c 2007-07-14 19:22:49.000000000 +0200 +@@ -125,6 +125,18 @@ + #define TP TRACE_PROCESS + #define TS TRACE_SIGNAL + ++#ifndef HAVE_STATFS64 ++/* ++ * Ugly hacks for systems that do not have LFS ++ */ ++ ++#define sys_truncate64 sys_truncate ++#define sys_ftruncate64 sys_ftruncate ++#define sys_getdents64 sys_getdents ++#define sys_statfs64 sys_statfs ++#define sys_fstatfs64 sys_fstatfs ++#endif ++ + static const struct sysent sysent0[] = { + #include "syscallent.h" + }; diff --git a/patches/strace/4.5.16/140-statfs64-check.patch b/patches/strace/4.5.16/140-statfs64-check.patch new file mode 100644 index 0000000..758966b --- /dev/null +++ b/patches/strace/4.5.16/140-statfs64-check.patch @@ -0,0 +1,53 @@ +diff -dur strace-4.5.16.orig/acinclude.m4 strace-4.5.16/acinclude.m4 +--- strace-4.5.16.orig/acinclude.m4 2004-04-14 04:21:01.000000000 +0200 ++++ strace-4.5.16/acinclude.m4 2007-07-14 19:25:25.000000000 +0200 +@@ -210,6 +210,26 @@ + fi + ]) + ++dnl ### A macro to determine whether statfs64 is defined. ++AC_DEFUN([AC_STATFS64], ++[AC_MSG_CHECKING(for statfs64 in sys/(statfs|vfs).h) ++AC_CACHE_VAL(ac_cv_type_statfs64, ++[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef LINUX ++#include ++#include ++#else ++#include ++#endif]], [[struct statfs64 st;]])],[ac_cv_type_statfs64=yes],[ac_cv_type_statfs64=no])]) ++AC_MSG_RESULT($ac_cv_type_statfs64) ++if test "$ac_cv_type_statfs64" = yes ++then ++ AC_DEFINE([HAVE_STATFS64], 1, ++[Define if statfs64 is available in sys/statfs.h or sys/vfs.h.]) ++fi ++]) ++ ++ ++ + dnl ### A macro to determine if off_t is a long long + AC_DEFUN([AC_OFF_T_IS_LONG_LONG], + [AC_MSG_CHECKING(for long long off_t) +diff -dur strace-4.5.16.orig/configure.ac strace-4.5.16/configure.ac +--- strace-4.5.16.orig/configure.ac 2007-01-11 12:37:55.000000000 +0100 ++++ strace-4.5.16/configure.ac 2007-07-14 19:25:25.000000000 +0200 +@@ -169,6 +169,7 @@ + struct stat.st_level, + struct stat.st_rdev]) + AC_STAT64 ++AC_STATFS64 + + AC_TYPE_SIGNAL + AC_TYPE_UID_T +diff -dur strace-4.5.16.orig/file.c strace-4.5.16/file.c +--- strace-4.5.16.orig/file.c 2007-01-15 21:25:52.000000000 +0100 ++++ strace-4.5.16/file.c 2007-07-14 19:25:25.000000000 +0200 +@@ -1636,7 +1636,7 @@ + return 0; + } + +-#ifdef LINUX ++#ifdef HAVE_STATFS64 + static void + printstatfs64(tcp, addr) + struct tcb *tcp; diff --git a/patches/strace/4.5.16/150-dont-use-REG_SYSCALL-for-sh.patch b/patches/strace/4.5.16/150-dont-use-REG_SYSCALL-for-sh.patch deleted file mode 100644 index ebbf69a..0000000 --- a/patches/strace/4.5.16/150-dont-use-REG_SYSCALL-for-sh.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -dur strace-4.5.16.orig/process.c strace-4.5.16/process.c ---- strace-4.5.16.orig/process.c 2007-01-11 23:08:38.000000000 +0100 -+++ strace-4.5.16/process.c 2007-07-14 19:19:58.000000000 +0200 -@@ -2685,7 +2685,6 @@ - { 4*REG_GBR, "4*REG_GBR" }, - { 4*REG_MACH, "4*REG_MACH" }, - { 4*REG_MACL, "4*REG_MACL" }, -- { 4*REG_SYSCALL, "4*REG_SYSCALL" }, - { 4*REG_FPUL, "4*REG_FPUL" }, - { 4*REG_FPREG0, "4*REG_FPREG0" }, - { 4*(REG_FPREG0+1), "4*REG_FPREG1" }, diff --git a/patches/strace/4.5.16/150-superh-update.ac.patch b/patches/strace/4.5.16/150-superh-update.ac.patch new file mode 100644 index 0000000..4129315 --- /dev/null +++ b/patches/strace/4.5.16/150-superh-update.ac.patch @@ -0,0 +1,22 @@ +diff -dur strace-4.5.16.orig/configure.ac strace-4.5.16/configure.ac +--- strace-4.5.16.orig/configure.ac 2007-07-14 19:25:25.000000000 +0200 ++++ strace-4.5.16/configure.ac 2007-07-14 19:27:35.000000000 +0200 +@@ -91,14 +91,14 @@ + arch=hppa + AC_DEFINE([HPPA], 1, [Define for the HPPA architecture.]) + ;; +-sh) +- arch=sh +- AC_DEFINE([SH], 1, [Define for the SH architecture.]) +- ;; + sh64) + arch=sh64 + AC_DEFINE([SH64], 1, [Define for the SH64 architecture.]) + ;; ++sh*) ++ arch=sh ++ AC_DEFINE([SH], 1, [Define for the SH architecture.]) ++ ;; + x86?64*) + arch=x86_64 + AC_DEFINE([X86_64], 1, [Define for the AMD x86-64 architecture.]) diff --git a/patches/strace/4.5.16/160-undef-CTL_PROC.patch b/patches/strace/4.5.16/160-undef-CTL_PROC.patch new file mode 100644 index 0000000..9bbd78c --- /dev/null +++ b/patches/strace/4.5.16/160-undef-CTL_PROC.patch @@ -0,0 +1,13 @@ +diff -dur strace-4.5.16.orig/system.c strace-4.5.16/system.c +--- strace-4.5.16.orig/system.c 2007-01-17 00:22:36.000000000 +0100 ++++ strace-4.5.16/system.c 2007-07-14 19:28:41.000000000 +0200 +@@ -1612,7 +1612,9 @@ + { CTL_KERN, "CTL_KERN" }, + { CTL_VM, "CTL_VM" }, + { CTL_NET, "CTL_NET" }, ++#ifdef CTL_PROC + { CTL_PROC, "CTL_PROC" }, ++#endif + { CTL_FS, "CTL_FS" }, + { CTL_DEBUG, "CTL_DEBUG" }, + { CTL_DEV, "CTL_DEV" }, diff --git a/patches/strace/4.5.16/170-undef-PACKET_MEMBERSHIP.patch b/patches/strace/4.5.16/170-undef-PACKET_MEMBERSHIP.patch new file mode 100644 index 0000000..3098f80 --- /dev/null +++ b/patches/strace/4.5.16/170-undef-PACKET_MEMBERSHIP.patch @@ -0,0 +1,16 @@ +diff -dur strace-4.5.16.orig/net.c strace-4.5.16/net.c +--- strace-4.5.16.orig/net.c 2006-12-13 20:57:23.000000000 +0100 ++++ strace-4.5.16/net.c 2007-07-14 19:29:36.000000000 +0200 +@@ -800,8 +800,12 @@ + + #ifdef SOL_PACKET + static const struct xlat sockpacketoptions[] = { ++#if defined(PACKET_ADD_MEMBERSHIP) + { PACKET_ADD_MEMBERSHIP, "PACKET_ADD_MEMBERSHIP" }, ++#endif ++#if defined(PACKET_DROP_MEMBERSHIP) + { PACKET_DROP_MEMBERSHIP, "PACKET_DROP_MEMBERSHIP"}, ++#endif + #if defined(PACKET_RECV_OUTPUT) + { PACKET_RECV_OUTPUT, "PACKET_RECV_OUTPUT" }, + #endif diff --git a/patches/strace/4.5.16/180-undef-syscall.patch b/patches/strace/4.5.16/180-undef-syscall.patch new file mode 100644 index 0000000..6194429 --- /dev/null +++ b/patches/strace/4.5.16/180-undef-syscall.patch @@ -0,0 +1,64 @@ +diff -dur strace-4.5.16.orig/linux/syscallent.h strace-4.5.16/linux/syscallent.h +--- strace-4.5.16.orig/linux/syscallent.h 2006-10-16 03:17:52.000000000 +0200 ++++ strace-4.5.16/linux/syscallent.h 2007-07-14 19:30:16.000000000 +0200 +@@ -130,7 +130,11 @@ + { 2, TF, sys_statfs, "statfs" }, /* 99 */ + { 2, TD, sys_fstatfs, "fstatfs" }, /* 100 */ + { 3, 0, sys_ioperm, "ioperm" }, /* 101 */ +- { 2, TD, sys_socketcall, "socketcall", SYS_socketcall }, /* 102 */ ++ { 2, TD, sys_socketcall, "socketcall" ++#ifdef __NR_socketcall ++ , SYS_socketcall ++#endif ++ }, /* 102 */ + { 3, 0, sys_syslog, "syslog" }, /* 103 */ + { 3, 0, sys_setitimer, "setitimer" }, /* 104 */ + { 2, 0, sys_getitimer, "getitimer" }, /* 105 */ +@@ -145,7 +149,11 @@ + { 4, TP, sys_wait4, "wait4", SYS_wait4 }, /* 114 */ + { 1, 0, sys_swapoff, "swapoff" }, /* 115 */ + { 1, 0, sys_sysinfo, "sysinfo" }, /* 116 */ +- { 6, 0, sys_ipc, "ipc", SYS_ipc }, /* 117 */ ++ { 6, 0, sys_ipc, "ipc" ++#ifdef __NR_ipc ++ , SYS_ipc ++#endif ++ }, /* 117 */ + { 1, TD, sys_fsync, "fsync" }, /* 118 */ + { 1, TS, sys_sigreturn, "sigreturn" }, /* 119 */ + { 5, TP, sys_clone, "clone", SYS_clone }, /* 120 */ +@@ -282,7 +290,11 @@ + { 3, 0, sys_io_cancel, "io_cancel" }, /* 249 */ + { 5, 0, sys_fadvise64, "fadvise64" }, /* 250 */ + { 5, 0, printargs, "SYS_251" }, /* 251 */ +- { 1, TP, sys_exit, "exit_group", __NR_exit_group }, /* 252 */ ++ { 1, TP, sys_exit, "exit_group" ++#ifdef __NR_exit_group ++ , __NR_exit_group ++#endif ++ }, /* 252 */ + { 4, 0, printargs, "lookup_dcookie"}, /* 253 */ + { 1, 0, sys_epoll_create, "epoll_create" }, /* 254 */ + { 4, TD, sys_epoll_ctl, "epoll_ctl" }, /* 255 */ +diff -dur strace-4.5.16.orig/syscall.c strace-4.5.16/syscall.c +--- strace-4.5.16.orig/syscall.c 2007-07-14 19:22:49.000000000 +0200 ++++ strace-4.5.16/syscall.c 2007-07-14 19:30:16.000000000 +0200 +@@ -2383,14 +2383,18 @@ + switch (known_scno(tcp)) { + #ifdef LINUX + #if !defined (ALPHA) && !defined(SPARC) && !defined(SPARC64) && !defined(MIPS) && !defined(HPPA) ++#ifdef __NR_socketcall + case SYS_socketcall: + decode_subcall(tcp, SYS_socket_subcall, + SYS_socket_nsubcalls, deref_style); + break; ++#endif ++#ifdef __NR_ipc + case SYS_ipc: + decode_subcall(tcp, SYS_ipc_subcall, + SYS_ipc_nsubcalls, shift_style); + break; ++#endif + #endif /* !ALPHA && !MIPS && !SPARC && !SPARC64 && !HPPA */ + #if defined (SPARC) || defined (SPARC64) + case SYS_socketcall: diff --git a/patches/strace/4.5.16/200-fix-arm-bad-syscall.patch b/patches/strace/4.5.16/200-fix-arm-bad-syscall.patch deleted file mode 100644 index d31b9da..0000000 --- a/patches/strace/4.5.16/200-fix-arm-bad-syscall.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff -dur strace-4.5.16.orig/syscall.c strace-4.5.16/syscall.c ---- strace-4.5.16.orig/syscall.c 2006-12-21 23:13:33.000000000 +0100 -+++ strace-4.5.16/syscall.c 2007-07-14 19:21:44.000000000 +0200 -@@ -1045,6 +1045,15 @@ - /* - * Note: we only deal with only 32-bit CPUs here. - */ -+ -+ if (!(tcp->flags & TCB_INSYSCALL) && -+ (tcp->flags & TCB_WAITEXECVE)) { -+ /* caught a fake syscall from the execve's exit */ -+ tcp->flags &= ~TCB_WAITEXECVE; -+ return 0; -+ } -+ -+ - if (regs.ARM_cpsr & 0x20) { - /* - * Get the Thumb-mode system call number diff --git a/patches/strace/4.5.16/250-fix-disabled-largefile-syscalls.patch b/patches/strace/4.5.16/250-fix-disabled-largefile-syscalls.patch deleted file mode 100644 index 2f47dc9..0000000 --- a/patches/strace/4.5.16/250-fix-disabled-largefile-syscalls.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff -dur strace-4.5.16.orig/syscall.c strace-4.5.16/syscall.c ---- strace-4.5.16.orig/syscall.c 2007-07-14 19:21:44.000000000 +0200 -+++ strace-4.5.16/syscall.c 2007-07-14 19:22:49.000000000 +0200 -@@ -125,6 +125,18 @@ - #define TP TRACE_PROCESS - #define TS TRACE_SIGNAL - -+#ifndef HAVE_STATFS64 -+/* -+ * Ugly hacks for systems that do not have LFS -+ */ -+ -+#define sys_truncate64 sys_truncate -+#define sys_ftruncate64 sys_ftruncate -+#define sys_getdents64 sys_getdents -+#define sys_statfs64 sys_statfs -+#define sys_fstatfs64 sys_fstatfs -+#endif -+ - static const struct sysent sysent0[] = { - #include "syscallent.h" - }; diff --git a/patches/strace/4.5.16/350-statfs64-check.patch b/patches/strace/4.5.16/350-statfs64-check.patch deleted file mode 100644 index 758966b..0000000 --- a/patches/strace/4.5.16/350-statfs64-check.patch +++ /dev/null @@ -1,53 +0,0 @@ -diff -dur strace-4.5.16.orig/acinclude.m4 strace-4.5.16/acinclude.m4 ---- strace-4.5.16.orig/acinclude.m4 2004-04-14 04:21:01.000000000 +0200 -+++ strace-4.5.16/acinclude.m4 2007-07-14 19:25:25.000000000 +0200 -@@ -210,6 +210,26 @@ - fi - ]) - -+dnl ### A macro to determine whether statfs64 is defined. -+AC_DEFUN([AC_STATFS64], -+[AC_MSG_CHECKING(for statfs64 in sys/(statfs|vfs).h) -+AC_CACHE_VAL(ac_cv_type_statfs64, -+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef LINUX -+#include -+#include -+#else -+#include -+#endif]], [[struct statfs64 st;]])],[ac_cv_type_statfs64=yes],[ac_cv_type_statfs64=no])]) -+AC_MSG_RESULT($ac_cv_type_statfs64) -+if test "$ac_cv_type_statfs64" = yes -+then -+ AC_DEFINE([HAVE_STATFS64], 1, -+[Define if statfs64 is available in sys/statfs.h or sys/vfs.h.]) -+fi -+]) -+ -+ -+ - dnl ### A macro to determine if off_t is a long long - AC_DEFUN([AC_OFF_T_IS_LONG_LONG], - [AC_MSG_CHECKING(for long long off_t) -diff -dur strace-4.5.16.orig/configure.ac strace-4.5.16/configure.ac ---- strace-4.5.16.orig/configure.ac 2007-01-11 12:37:55.000000000 +0100 -+++ strace-4.5.16/configure.ac 2007-07-14 19:25:25.000000000 +0200 -@@ -169,6 +169,7 @@ - struct stat.st_level, - struct stat.st_rdev]) - AC_STAT64 -+AC_STATFS64 - - AC_TYPE_SIGNAL - AC_TYPE_UID_T -diff -dur strace-4.5.16.orig/file.c strace-4.5.16/file.c ---- strace-4.5.16.orig/file.c 2007-01-15 21:25:52.000000000 +0100 -+++ strace-4.5.16/file.c 2007-07-14 19:25:25.000000000 +0200 -@@ -1636,7 +1636,7 @@ - return 0; - } - --#ifdef LINUX -+#ifdef HAVE_STATFS64 - static void - printstatfs64(tcp, addr) - struct tcb *tcp; diff --git a/patches/strace/4.5.16/400-superh-update.ac.patch b/patches/strace/4.5.16/400-superh-update.ac.patch deleted file mode 100644 index 4129315..0000000 --- a/patches/strace/4.5.16/400-superh-update.ac.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff -dur strace-4.5.16.orig/configure.ac strace-4.5.16/configure.ac ---- strace-4.5.16.orig/configure.ac 2007-07-14 19:25:25.000000000 +0200 -+++ strace-4.5.16/configure.ac 2007-07-14 19:27:35.000000000 +0200 -@@ -91,14 +91,14 @@ - arch=hppa - AC_DEFINE([HPPA], 1, [Define for the HPPA architecture.]) - ;; --sh) -- arch=sh -- AC_DEFINE([SH], 1, [Define for the SH architecture.]) -- ;; - sh64) - arch=sh64 - AC_DEFINE([SH64], 1, [Define for the SH64 architecture.]) - ;; -+sh*) -+ arch=sh -+ AC_DEFINE([SH], 1, [Define for the SH architecture.]) -+ ;; - x86?64*) - arch=x86_64 - AC_DEFINE([X86_64], 1, [Define for the AMD x86-64 architecture.]) diff --git a/patches/strace/4.5.16/450-undef-CTL_PROC.patch b/patches/strace/4.5.16/450-undef-CTL_PROC.patch deleted file mode 100644 index 9bbd78c..0000000 --- a/patches/strace/4.5.16/450-undef-CTL_PROC.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -dur strace-4.5.16.orig/system.c strace-4.5.16/system.c ---- strace-4.5.16.orig/system.c 2007-01-17 00:22:36.000000000 +0100 -+++ strace-4.5.16/system.c 2007-07-14 19:28:41.000000000 +0200 -@@ -1612,7 +1612,9 @@ - { CTL_KERN, "CTL_KERN" }, - { CTL_VM, "CTL_VM" }, - { CTL_NET, "CTL_NET" }, -+#ifdef CTL_PROC - { CTL_PROC, "CTL_PROC" }, -+#endif - { CTL_FS, "CTL_FS" }, - { CTL_DEBUG, "CTL_DEBUG" }, - { CTL_DEV, "CTL_DEV" }, diff --git a/patches/strace/4.5.16/500-undef-PACKET_MEMBERSHIP.patch b/patches/strace/4.5.16/500-undef-PACKET_MEMBERSHIP.patch deleted file mode 100644 index 3098f80..0000000 --- a/patches/strace/4.5.16/500-undef-PACKET_MEMBERSHIP.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff -dur strace-4.5.16.orig/net.c strace-4.5.16/net.c ---- strace-4.5.16.orig/net.c 2006-12-13 20:57:23.000000000 +0100 -+++ strace-4.5.16/net.c 2007-07-14 19:29:36.000000000 +0200 -@@ -800,8 +800,12 @@ - - #ifdef SOL_PACKET - static const struct xlat sockpacketoptions[] = { -+#if defined(PACKET_ADD_MEMBERSHIP) - { PACKET_ADD_MEMBERSHIP, "PACKET_ADD_MEMBERSHIP" }, -+#endif -+#if defined(PACKET_DROP_MEMBERSHIP) - { PACKET_DROP_MEMBERSHIP, "PACKET_DROP_MEMBERSHIP"}, -+#endif - #if defined(PACKET_RECV_OUTPUT) - { PACKET_RECV_OUTPUT, "PACKET_RECV_OUTPUT" }, - #endif diff --git a/patches/strace/4.5.16/550-undef-syscall.patch b/patches/strace/4.5.16/550-undef-syscall.patch deleted file mode 100644 index 6194429..0000000 --- a/patches/strace/4.5.16/550-undef-syscall.patch +++ /dev/null @@ -1,64 +0,0 @@ -diff -dur strace-4.5.16.orig/linux/syscallent.h strace-4.5.16/linux/syscallent.h ---- strace-4.5.16.orig/linux/syscallent.h 2006-10-16 03:17:52.000000000 +0200 -+++ strace-4.5.16/linux/syscallent.h 2007-07-14 19:30:16.000000000 +0200 -@@ -130,7 +130,11 @@ - { 2, TF, sys_statfs, "statfs" }, /* 99 */ - { 2, TD, sys_fstatfs, "fstatfs" }, /* 100 */ - { 3, 0, sys_ioperm, "ioperm" }, /* 101 */ -- { 2, TD, sys_socketcall, "socketcall", SYS_socketcall }, /* 102 */ -+ { 2, TD, sys_socketcall, "socketcall" -+#ifdef __NR_socketcall -+ , SYS_socketcall -+#endif -+ }, /* 102 */ - { 3, 0, sys_syslog, "syslog" }, /* 103 */ - { 3, 0, sys_setitimer, "setitimer" }, /* 104 */ - { 2, 0, sys_getitimer, "getitimer" }, /* 105 */ -@@ -145,7 +149,11 @@ - { 4, TP, sys_wait4, "wait4", SYS_wait4 }, /* 114 */ - { 1, 0, sys_swapoff, "swapoff" }, /* 115 */ - { 1, 0, sys_sysinfo, "sysinfo" }, /* 116 */ -- { 6, 0, sys_ipc, "ipc", SYS_ipc }, /* 117 */ -+ { 6, 0, sys_ipc, "ipc" -+#ifdef __NR_ipc -+ , SYS_ipc -+#endif -+ }, /* 117 */ - { 1, TD, sys_fsync, "fsync" }, /* 118 */ - { 1, TS, sys_sigreturn, "sigreturn" }, /* 119 */ - { 5, TP, sys_clone, "clone", SYS_clone }, /* 120 */ -@@ -282,7 +290,11 @@ - { 3, 0, sys_io_cancel, "io_cancel" }, /* 249 */ - { 5, 0, sys_fadvise64, "fadvise64" }, /* 250 */ - { 5, 0, printargs, "SYS_251" }, /* 251 */ -- { 1, TP, sys_exit, "exit_group", __NR_exit_group }, /* 252 */ -+ { 1, TP, sys_exit, "exit_group" -+#ifdef __NR_exit_group -+ , __NR_exit_group -+#endif -+ }, /* 252 */ - { 4, 0, printargs, "lookup_dcookie"}, /* 253 */ - { 1, 0, sys_epoll_create, "epoll_create" }, /* 254 */ - { 4, TD, sys_epoll_ctl, "epoll_ctl" }, /* 255 */ -diff -dur strace-4.5.16.orig/syscall.c strace-4.5.16/syscall.c ---- strace-4.5.16.orig/syscall.c 2007-07-14 19:22:49.000000000 +0200 -+++ strace-4.5.16/syscall.c 2007-07-14 19:30:16.000000000 +0200 -@@ -2383,14 +2383,18 @@ - switch (known_scno(tcp)) { - #ifdef LINUX - #if !defined (ALPHA) && !defined(SPARC) && !defined(SPARC64) && !defined(MIPS) && !defined(HPPA) -+#ifdef __NR_socketcall - case SYS_socketcall: - decode_subcall(tcp, SYS_socket_subcall, - SYS_socket_nsubcalls, deref_style); - break; -+#endif -+#ifdef __NR_ipc - case SYS_ipc: - decode_subcall(tcp, SYS_ipc_subcall, - SYS_ipc_nsubcalls, shift_style); - break; -+#endif - #endif /* !ALPHA && !MIPS && !SPARC && !SPARC64 && !HPPA */ - #if defined (SPARC) || defined (SPARC64) - case SYS_socketcall: diff --git a/patches/uClibc/0.9.28.1/000-string-functions.patch b/patches/uClibc/0.9.28.1/000-string-functions.patch deleted file mode 100644 index ab6c255..0000000 --- a/patches/uClibc/0.9.28.1/000-string-functions.patch +++ /dev/null @@ -1,14 +0,0 @@ -Give preference to target-optimised functions over glibc's ones, -which in turn ahave precedence over generic ones. - ---- uClibc.orig/libc/Makefile 2005-07-20 08:10:44.000000000 +0200 -+++ uclibc/libc/Makefile 2005-07-28 13:33:40.000000000 +0200 -@@ -59,7 +59,7 @@ - $(AR) dN 2 $(LIBNAME) $$objs && \ - $(AR) dN 2 $(LIBNAME) $$objs - @for objfile in obj.signal \ -- obj.string.generic obj.string.$(TARGET_ARCH) obj.string \ -+ obj.string obj.string.generic obj.string.$(TARGET_ARCH) \ - obj.sysdeps.common obj.sysdeps.$(TARGET_ARCH) ; do \ - if [ -e $$objfile ] ; then \ - echo $(AR) $(ARFLAGS) $(LIBNAME) $$objfile ; \ diff --git a/patches/uClibc/0.9.28.1/001-install_dev.patch b/patches/uClibc/0.9.28.1/001-install_dev.patch deleted file mode 100644 index 2fefe83..0000000 --- a/patches/uClibc/0.9.28.1/001-install_dev.patch +++ /dev/null @@ -1,22 +0,0 @@ -We know that the kernel headers are in place. Don't try to install them. - -diff -dur uClibc-0.9.28.1.orig/Makefile uClibc-0.9.28.1/Makefile ---- uClibc-0.9.28.1.orig/Makefile 2007-01-28 06:38:00.000000000 +0100 -+++ uClibc-0.9.28.1/Makefile 2007-01-28 18:55:46.000000000 +0100 -@@ -158,12 +158,10 @@ - $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib - $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include - -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/ -- if [ "$(KERNEL_SOURCE)" = "$(DEVEL_PREFIX)" ] ; then \ -- extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \ -- else \ -- extra_exclude="" ; \ -- fi ; \ -- tar -chf - include --exclude .svn --exclude CVS $$extra_exclude \ -+ extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \ -+ tar -chf - include --exclude .svn --exclude CVS \ -+ --exclude include/linux \ -+ --exclude include/asm'*' \ - | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX) - ifneq ($(strip $(UCLIBC_HAS_FLOATS)),y) - # Remove floating point related headers since float support is disabled. diff --git a/patches/uClibc/0.9.28.1/002-no_LFS-no_readahead.patch b/patches/uClibc/0.9.28.1/002-no_LFS-no_readahead.patch deleted file mode 100644 index ca0568c..0000000 --- a/patches/uClibc/0.9.28.1/002-no_LFS-no_readahead.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/common/Makefile uClibc-0.9.28.1/libc/sysdeps/linux/common/Makefile ---- uClibc-0.9.28.1.orig/libc/sysdeps/linux/common/Makefile 2007-01-26 00:54:19.000000000 +0100 -+++ uClibc-0.9.28.1/libc/sysdeps/linux/common/Makefile 2007-02-01 08:44:37.000000000 +0100 -@@ -25,6 +25,10 @@ - SRCS := $(filter-out sbrk.c,$(SRCS)) - endif - -+ifneq ($(strip $(UCLIBC_HAS_LFS)),y) -+SRCS := $(filter-out readahead.c,$(SRCS)) -+endif -+ - ifneq ($(strip $(UCLIBC_HAS_SSP)),y) - SRCS := $(filter-out ssp.c,$(SRCS)) - endif diff --git a/patches/uClibc/0.9.28.1/003-time-locale.patch b/patches/uClibc/0.9.28.1/003-time-locale.patch deleted file mode 100644 index f449ad6..0000000 --- a/patches/uClibc/0.9.28.1/003-time-locale.patch +++ /dev/null @@ -1,15 +0,0 @@ -Index: libc/misc/time/time.c -=================================================================== ---- a/libc/misc/time/time.c (revision 17534) -+++ b/libc/misc/time/time.c (revision 17647) -@@ -158,7 +158,9 @@ - #endif - - #if defined (L_tzset) || defined (L_localtime_r) || defined(L_strftime) || \ -- defined(L__time_mktime) || defined(L__time_mktime_tzi) -+ defined(L__time_mktime) || defined(L__time_mktime_tzi) || \ -+ ((defined(L_strftime) || defined(L_strftime_l)) && \ -+ defined(__UCLIBC_HAS_XLOCALE__)) - - void _time_tzset (int); - diff --git a/patches/uClibc/0.9.28.1/004-ctype.patch b/patches/uClibc/0.9.28.1/004-ctype.patch deleted file mode 100644 index b07ccdb..0000000 --- a/patches/uClibc/0.9.28.1/004-ctype.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -urN uClibc-dist/libc/sysdeps/linux/common/bits/uClibc_touplow.h uClibc/libc/sysdeps/linux/common/bits/uClibc_touplow.h ---- uClibc-dist/libc/sysdeps/linux/common/bits/uClibc_touplow.h Fri Jun 3 13:30:25 2005 -+++ uClibc/libc/sysdeps/linux/common/bits/uClibc_touplow.h Fri Jun 3 13:30:39 2005 -@@ -34,11 +34,11 @@ - - /* glibc uses the equivalent of - typedef __int32_t __ctype_touplow_t; */ - --typedef __uint16_t __ctype_mask_t; -+typedef __uint32_t __ctype_mask_t; - - #ifdef __UCLIBC_HAS_CTYPE_SIGNED__ - --typedef __int16_t __ctype_touplow_t; -+typedef __int32_t __ctype_touplow_t; - #define __UCLIBC_CTYPE_B_TBL_OFFSET 128 - #define __UCLIBC_CTYPE_TO_TBL_OFFSET 128 - diff --git a/patches/uClibc/0.9.28.1/100-string-functions.patch b/patches/uClibc/0.9.28.1/100-string-functions.patch new file mode 100644 index 0000000..ab6c255 --- /dev/null +++ b/patches/uClibc/0.9.28.1/100-string-functions.patch @@ -0,0 +1,14 @@ +Give preference to target-optimised functions over glibc's ones, +which in turn ahave precedence over generic ones. + +--- uClibc.orig/libc/Makefile 2005-07-20 08:10:44.000000000 +0200 ++++ uclibc/libc/Makefile 2005-07-28 13:33:40.000000000 +0200 +@@ -59,7 +59,7 @@ + $(AR) dN 2 $(LIBNAME) $$objs && \ + $(AR) dN 2 $(LIBNAME) $$objs + @for objfile in obj.signal \ +- obj.string.generic obj.string.$(TARGET_ARCH) obj.string \ ++ obj.string obj.string.generic obj.string.$(TARGET_ARCH) \ + obj.sysdeps.common obj.sysdeps.$(TARGET_ARCH) ; do \ + if [ -e $$objfile ] ; then \ + echo $(AR) $(ARFLAGS) $(LIBNAME) $$objfile ; \ diff --git a/patches/uClibc/0.9.28.1/110-install_dev.patch b/patches/uClibc/0.9.28.1/110-install_dev.patch new file mode 100644 index 0000000..2fefe83 --- /dev/null +++ b/patches/uClibc/0.9.28.1/110-install_dev.patch @@ -0,0 +1,22 @@ +We know that the kernel headers are in place. Don't try to install them. + +diff -dur uClibc-0.9.28.1.orig/Makefile uClibc-0.9.28.1/Makefile +--- uClibc-0.9.28.1.orig/Makefile 2007-01-28 06:38:00.000000000 +0100 ++++ uClibc-0.9.28.1/Makefile 2007-01-28 18:55:46.000000000 +0100 +@@ -158,12 +158,10 @@ + $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib + $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include + -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/ +- if [ "$(KERNEL_SOURCE)" = "$(DEVEL_PREFIX)" ] ; then \ +- extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \ +- else \ +- extra_exclude="" ; \ +- fi ; \ +- tar -chf - include --exclude .svn --exclude CVS $$extra_exclude \ ++ extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \ ++ tar -chf - include --exclude .svn --exclude CVS \ ++ --exclude include/linux \ ++ --exclude include/asm'*' \ + | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX) + ifneq ($(strip $(UCLIBC_HAS_FLOATS)),y) + # Remove floating point related headers since float support is disabled. diff --git a/patches/uClibc/0.9.28.1/120-no_LFS-no_readahead.patch b/patches/uClibc/0.9.28.1/120-no_LFS-no_readahead.patch new file mode 100644 index 0000000..ca0568c --- /dev/null +++ b/patches/uClibc/0.9.28.1/120-no_LFS-no_readahead.patch @@ -0,0 +1,14 @@ +diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/common/Makefile uClibc-0.9.28.1/libc/sysdeps/linux/common/Makefile +--- uClibc-0.9.28.1.orig/libc/sysdeps/linux/common/Makefile 2007-01-26 00:54:19.000000000 +0100 ++++ uClibc-0.9.28.1/libc/sysdeps/linux/common/Makefile 2007-02-01 08:44:37.000000000 +0100 +@@ -25,6 +25,10 @@ + SRCS := $(filter-out sbrk.c,$(SRCS)) + endif + ++ifneq ($(strip $(UCLIBC_HAS_LFS)),y) ++SRCS := $(filter-out readahead.c,$(SRCS)) ++endif ++ + ifneq ($(strip $(UCLIBC_HAS_SSP)),y) + SRCS := $(filter-out ssp.c,$(SRCS)) + endif diff --git a/patches/uClibc/0.9.28.1/130-time-locale.patch b/patches/uClibc/0.9.28.1/130-time-locale.patch new file mode 100644 index 0000000..f449ad6 --- /dev/null +++ b/patches/uClibc/0.9.28.1/130-time-locale.patch @@ -0,0 +1,15 @@ +Index: libc/misc/time/time.c +=================================================================== +--- a/libc/misc/time/time.c (revision 17534) ++++ b/libc/misc/time/time.c (revision 17647) +@@ -158,7 +158,9 @@ + #endif + + #if defined (L_tzset) || defined (L_localtime_r) || defined(L_strftime) || \ +- defined(L__time_mktime) || defined(L__time_mktime_tzi) ++ defined(L__time_mktime) || defined(L__time_mktime_tzi) || \ ++ ((defined(L_strftime) || defined(L_strftime_l)) && \ ++ defined(__UCLIBC_HAS_XLOCALE__)) + + void _time_tzset (int); + diff --git a/patches/uClibc/0.9.28.1/140-ctype.patch b/patches/uClibc/0.9.28.1/140-ctype.patch new file mode 100644 index 0000000..b07ccdb --- /dev/null +++ b/patches/uClibc/0.9.28.1/140-ctype.patch @@ -0,0 +1,17 @@ +diff -urN uClibc-dist/libc/sysdeps/linux/common/bits/uClibc_touplow.h uClibc/libc/sysdeps/linux/common/bits/uClibc_touplow.h +--- uClibc-dist/libc/sysdeps/linux/common/bits/uClibc_touplow.h Fri Jun 3 13:30:25 2005 ++++ uClibc/libc/sysdeps/linux/common/bits/uClibc_touplow.h Fri Jun 3 13:30:39 2005 +@@ -34,11 +34,11 @@ + + /* glibc uses the equivalent of - typedef __int32_t __ctype_touplow_t; */ + +-typedef __uint16_t __ctype_mask_t; ++typedef __uint32_t __ctype_mask_t; + + #ifdef __UCLIBC_HAS_CTYPE_SIGNED__ + +-typedef __int16_t __ctype_touplow_t; ++typedef __int32_t __ctype_touplow_t; + #define __UCLIBC_CTYPE_B_TBL_OFFSET 128 + #define __UCLIBC_CTYPE_TO_TBL_OFFSET 128 + diff --git a/patches/uClibc/0.9.28.1/150-custom-ISA.patch b/patches/uClibc/0.9.28.1/150-custom-ISA.patch new file mode 100644 index 0000000..2cc9bcb --- /dev/null +++ b/patches/uClibc/0.9.28.1/150-custom-ISA.patch @@ -0,0 +1,31 @@ +diff -dur uClibc-0.9.28.orig/Rules.mak uClibc-0.9.28/Rules.mak +--- uClibc-0.9.28.orig/Rules.mak 2005-08-18 00:49:49.000000000 +0200 ++++ uClibc-0.9.28/Rules.mak 2007-01-30 10:53:34.000000000 +0100 +@@ -168,6 +168,7 @@ + CPU_CFLAGS-$(CONFIG_MIPS_ISA_4)+=-mips4 -mtune=mips4 + CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS32)+=-mips32 -mtune=mips32 + CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS64)+=-mips64 -mtune=mips32 ++ CPU_CFLAGS-$(CONFIG_MIPS_ISA_CUSTOM)+=-march=$(CONFIG_MIPS_CPU_CFLAGS_CUSTOM) + endif + + ifeq ($(strip $(TARGET_ARCH)),sh) +diff -dur uClibc-0.9.28.orig/extra/Configs/Config.mips uClibc-0.9.28/extra/Configs/Config.mips +--- uClibc-0.9.28.orig/extra/Configs/Config.mips 2005-08-18 00:49:41.000000000 +0200 ++++ uClibc-0.9.28/extra/Configs/Config.mips 2007-01-30 10:52:12.000000000 +0100 +@@ -63,4 +63,16 @@ + config CONFIG_MIPS_ISA_MIPS64 + bool "MIPS64" + ++config CONFIG_MIPS_ISA_CUSTOM ++ bool "Custom" ++ + endchoice ++ ++config CONFIG_MIPS_CPU_CFLAGS_CUSTOM ++ string ++ prompt "Custon ISA" ++ depends on CONFIG_MIPS_ISA_CUSTOM ++ default "" ++ help ++ Enter your custom ISA here (eg: lx4189!). ++ diff --git a/patches/uClibc/0.9.28.1/160-mips-asm.h.patch b/patches/uClibc/0.9.28.1/160-mips-asm.h.patch new file mode 100644 index 0000000..285feed --- /dev/null +++ b/patches/uClibc/0.9.28.1/160-mips-asm.h.patch @@ -0,0 +1,41 @@ +diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/clone.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/clone.S +--- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/clone.S 2007-02-07 11:18:12.000000000 +0100 ++++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/clone.S 2007-02-07 10:41:34.000000000 +0100 +@@ -24,7 +24,7 @@ + #include + #define _ERRNO_H 1 + #include +-#include ++#include + + /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */ + +diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/pipe.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/pipe.S +--- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/pipe.S 2007-02-07 11:18:12.000000000 +0100 ++++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/pipe.S 2007-02-07 11:16:52.000000000 +0100 +@@ -3,9 +3,9 @@ + /*see uClibc's sh/pipe.c and glibc-2.2.4's mips/pipe.S */ + + #include +-#include ++#include + #include +-#include ++#include + + .globl pipe + .ent pipe, 0 +diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/syscall.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/syscall.S +--- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/syscall.S 2007-02-07 11:18:12.000000000 +0100 ++++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/syscall.S 2007-02-07 11:17:03.000000000 +0100 +@@ -17,8 +17,8 @@ + 02111-1307 USA. */ + + #include +-#include +-#include ++#include ++#include + + #ifdef __PIC__ + .option pic2 diff --git a/patches/uClibc/0.9.28.1/200-custom-ISA.patch b/patches/uClibc/0.9.28.1/200-custom-ISA.patch deleted file mode 100644 index 2cc9bcb..0000000 --- a/patches/uClibc/0.9.28.1/200-custom-ISA.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff -dur uClibc-0.9.28.orig/Rules.mak uClibc-0.9.28/Rules.mak ---- uClibc-0.9.28.orig/Rules.mak 2005-08-18 00:49:49.000000000 +0200 -+++ uClibc-0.9.28/Rules.mak 2007-01-30 10:53:34.000000000 +0100 -@@ -168,6 +168,7 @@ - CPU_CFLAGS-$(CONFIG_MIPS_ISA_4)+=-mips4 -mtune=mips4 - CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS32)+=-mips32 -mtune=mips32 - CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS64)+=-mips64 -mtune=mips32 -+ CPU_CFLAGS-$(CONFIG_MIPS_ISA_CUSTOM)+=-march=$(CONFIG_MIPS_CPU_CFLAGS_CUSTOM) - endif - - ifeq ($(strip $(TARGET_ARCH)),sh) -diff -dur uClibc-0.9.28.orig/extra/Configs/Config.mips uClibc-0.9.28/extra/Configs/Config.mips ---- uClibc-0.9.28.orig/extra/Configs/Config.mips 2005-08-18 00:49:41.000000000 +0200 -+++ uClibc-0.9.28/extra/Configs/Config.mips 2007-01-30 10:52:12.000000000 +0100 -@@ -63,4 +63,16 @@ - config CONFIG_MIPS_ISA_MIPS64 - bool "MIPS64" - -+config CONFIG_MIPS_ISA_CUSTOM -+ bool "Custom" -+ - endchoice -+ -+config CONFIG_MIPS_CPU_CFLAGS_CUSTOM -+ string -+ prompt "Custon ISA" -+ depends on CONFIG_MIPS_ISA_CUSTOM -+ default "" -+ help -+ Enter your custom ISA here (eg: lx4189!). -+ diff --git a/patches/uClibc/0.9.28.1/201-mips-asm.h.patch b/patches/uClibc/0.9.28.1/201-mips-asm.h.patch deleted file mode 100644 index 285feed..0000000 --- a/patches/uClibc/0.9.28.1/201-mips-asm.h.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/clone.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/clone.S ---- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/clone.S 2007-02-07 11:18:12.000000000 +0100 -+++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/clone.S 2007-02-07 10:41:34.000000000 +0100 -@@ -24,7 +24,7 @@ - #include - #define _ERRNO_H 1 - #include --#include -+#include - - /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */ - -diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/pipe.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/pipe.S ---- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/pipe.S 2007-02-07 11:18:12.000000000 +0100 -+++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/pipe.S 2007-02-07 11:16:52.000000000 +0100 -@@ -3,9 +3,9 @@ - /*see uClibc's sh/pipe.c and glibc-2.2.4's mips/pipe.S */ - - #include --#include -+#include - #include --#include -+#include - - .globl pipe - .ent pipe, 0 -diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/syscall.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/syscall.S ---- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/syscall.S 2007-02-07 11:18:12.000000000 +0100 -+++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/syscall.S 2007-02-07 11:17:03.000000000 +0100 -@@ -17,8 +17,8 @@ - 02111-1307 USA. */ - - #include --#include --#include -+#include -+#include - - #ifdef __PIC__ - .option pic2 diff --git a/patches/uClibc/0.9.28.2/000-string-functions.patch b/patches/uClibc/0.9.28.2/000-string-functions.patch deleted file mode 100644 index ab6c255..0000000 --- a/patches/uClibc/0.9.28.2/000-string-functions.patch +++ /dev/null @@ -1,14 +0,0 @@ -Give preference to target-optimised functions over glibc's ones, -which in turn ahave precedence over generic ones. - ---- uClibc.orig/libc/Makefile 2005-07-20 08:10:44.000000000 +0200 -+++ uclibc/libc/Makefile 2005-07-28 13:33:40.000000000 +0200 -@@ -59,7 +59,7 @@ - $(AR) dN 2 $(LIBNAME) $$objs && \ - $(AR) dN 2 $(LIBNAME) $$objs - @for objfile in obj.signal \ -- obj.string.generic obj.string.$(TARGET_ARCH) obj.string \ -+ obj.string obj.string.generic obj.string.$(TARGET_ARCH) \ - obj.sysdeps.common obj.sysdeps.$(TARGET_ARCH) ; do \ - if [ -e $$objfile ] ; then \ - echo $(AR) $(ARFLAGS) $(LIBNAME) $$objfile ; \ diff --git a/patches/uClibc/0.9.28.2/001-install_dev.patch b/patches/uClibc/0.9.28.2/001-install_dev.patch deleted file mode 100644 index 4b42467..0000000 --- a/patches/uClibc/0.9.28.2/001-install_dev.patch +++ /dev/null @@ -1,22 +0,0 @@ -We know that the kernel headers are in place. Don't try to install them. - -diff -dur uClibc-0.9.28.1.orig/Makefile uClibc-0.9.28.1/Makefile ---- uClibc-0.9.28.1.orig/Makefile 2007-01-28 06:38:00.000000000 +0100 -+++ uClibc-0.9.28.1/Makefile 2007-01-28 18:55:46.000000000 +0100 -@@ -158,12 +158,10 @@ - $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib - $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include - -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/ -- if [ "$(KERNEL_SOURCE)" = "$(DEVEL_PREFIX)" ] ; then \ -- extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \ -- else \ -- extra_exclude="" ; \ -- fi ; \ -- tar -chf - include --exclude .svn --exclude CVS $$extra_exclude \ -+ extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \ -+ tar -chf - include --exclude .svn --exclude CVS \ -+ --exclude include/linux \ -+ --exclude include/asm'*' \ - | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX) - echo '/* Dont use _syscall#() macros; use the syscall() function */' > \ - $(PREFIX)$(DEVEL_PREFIX)include/bits/syscalls.h diff --git a/patches/uClibc/0.9.28.2/002-no_LFS-no_readahead.patch b/patches/uClibc/0.9.28.2/002-no_LFS-no_readahead.patch deleted file mode 100644 index ca0568c..0000000 --- a/patches/uClibc/0.9.28.2/002-no_LFS-no_readahead.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/common/Makefile uClibc-0.9.28.1/libc/sysdeps/linux/common/Makefile ---- uClibc-0.9.28.1.orig/libc/sysdeps/linux/common/Makefile 2007-01-26 00:54:19.000000000 +0100 -+++ uClibc-0.9.28.1/libc/sysdeps/linux/common/Makefile 2007-02-01 08:44:37.000000000 +0100 -@@ -25,6 +25,10 @@ - SRCS := $(filter-out sbrk.c,$(SRCS)) - endif - -+ifneq ($(strip $(UCLIBC_HAS_LFS)),y) -+SRCS := $(filter-out readahead.c,$(SRCS)) -+endif -+ - ifneq ($(strip $(UCLIBC_HAS_SSP)),y) - SRCS := $(filter-out ssp.c,$(SRCS)) - endif diff --git a/patches/uClibc/0.9.28.2/004-ctype.patch b/patches/uClibc/0.9.28.2/004-ctype.patch deleted file mode 100644 index b07ccdb..0000000 --- a/patches/uClibc/0.9.28.2/004-ctype.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -urN uClibc-dist/libc/sysdeps/linux/common/bits/uClibc_touplow.h uClibc/libc/sysdeps/linux/common/bits/uClibc_touplow.h ---- uClibc-dist/libc/sysdeps/linux/common/bits/uClibc_touplow.h Fri Jun 3 13:30:25 2005 -+++ uClibc/libc/sysdeps/linux/common/bits/uClibc_touplow.h Fri Jun 3 13:30:39 2005 -@@ -34,11 +34,11 @@ - - /* glibc uses the equivalent of - typedef __int32_t __ctype_touplow_t; */ - --typedef __uint16_t __ctype_mask_t; -+typedef __uint32_t __ctype_mask_t; - - #ifdef __UCLIBC_HAS_CTYPE_SIGNED__ - --typedef __int16_t __ctype_touplow_t; -+typedef __int32_t __ctype_touplow_t; - #define __UCLIBC_CTYPE_B_TBL_OFFSET 128 - #define __UCLIBC_CTYPE_TO_TBL_OFFSET 128 - diff --git a/patches/uClibc/0.9.28.2/100-string-functions.patch b/patches/uClibc/0.9.28.2/100-string-functions.patch new file mode 100644 index 0000000..ab6c255 --- /dev/null +++ b/patches/uClibc/0.9.28.2/100-string-functions.patch @@ -0,0 +1,14 @@ +Give preference to target-optimised functions over glibc's ones, +which in turn ahave precedence over generic ones. + +--- uClibc.orig/libc/Makefile 2005-07-20 08:10:44.000000000 +0200 ++++ uclibc/libc/Makefile 2005-07-28 13:33:40.000000000 +0200 +@@ -59,7 +59,7 @@ + $(AR) dN 2 $(LIBNAME) $$objs && \ + $(AR) dN 2 $(LIBNAME) $$objs + @for objfile in obj.signal \ +- obj.string.generic obj.string.$(TARGET_ARCH) obj.string \ ++ obj.string obj.string.generic obj.string.$(TARGET_ARCH) \ + obj.sysdeps.common obj.sysdeps.$(TARGET_ARCH) ; do \ + if [ -e $$objfile ] ; then \ + echo $(AR) $(ARFLAGS) $(LIBNAME) $$objfile ; \ diff --git a/patches/uClibc/0.9.28.2/110-install_dev.patch b/patches/uClibc/0.9.28.2/110-install_dev.patch new file mode 100644 index 0000000..4b42467 --- /dev/null +++ b/patches/uClibc/0.9.28.2/110-install_dev.patch @@ -0,0 +1,22 @@ +We know that the kernel headers are in place. Don't try to install them. + +diff -dur uClibc-0.9.28.1.orig/Makefile uClibc-0.9.28.1/Makefile +--- uClibc-0.9.28.1.orig/Makefile 2007-01-28 06:38:00.000000000 +0100 ++++ uClibc-0.9.28.1/Makefile 2007-01-28 18:55:46.000000000 +0100 +@@ -158,12 +158,10 @@ + $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib + $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include + -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/ +- if [ "$(KERNEL_SOURCE)" = "$(DEVEL_PREFIX)" ] ; then \ +- extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \ +- else \ +- extra_exclude="" ; \ +- fi ; \ +- tar -chf - include --exclude .svn --exclude CVS $$extra_exclude \ ++ extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \ ++ tar -chf - include --exclude .svn --exclude CVS \ ++ --exclude include/linux \ ++ --exclude include/asm'*' \ + | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX) + echo '/* Dont use _syscall#() macros; use the syscall() function */' > \ + $(PREFIX)$(DEVEL_PREFIX)include/bits/syscalls.h diff --git a/patches/uClibc/0.9.28.2/120-no_LFS-no_readahead.patch b/patches/uClibc/0.9.28.2/120-no_LFS-no_readahead.patch new file mode 100644 index 0000000..ca0568c --- /dev/null +++ b/patches/uClibc/0.9.28.2/120-no_LFS-no_readahead.patch @@ -0,0 +1,14 @@ +diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/common/Makefile uClibc-0.9.28.1/libc/sysdeps/linux/common/Makefile +--- uClibc-0.9.28.1.orig/libc/sysdeps/linux/common/Makefile 2007-01-26 00:54:19.000000000 +0100 ++++ uClibc-0.9.28.1/libc/sysdeps/linux/common/Makefile 2007-02-01 08:44:37.000000000 +0100 +@@ -25,6 +25,10 @@ + SRCS := $(filter-out sbrk.c,$(SRCS)) + endif + ++ifneq ($(strip $(UCLIBC_HAS_LFS)),y) ++SRCS := $(filter-out readahead.c,$(SRCS)) ++endif ++ + ifneq ($(strip $(UCLIBC_HAS_SSP)),y) + SRCS := $(filter-out ssp.c,$(SRCS)) + endif diff --git a/patches/uClibc/0.9.28.2/130-ctype.patch b/patches/uClibc/0.9.28.2/130-ctype.patch new file mode 100644 index 0000000..b07ccdb --- /dev/null +++ b/patches/uClibc/0.9.28.2/130-ctype.patch @@ -0,0 +1,17 @@ +diff -urN uClibc-dist/libc/sysdeps/linux/common/bits/uClibc_touplow.h uClibc/libc/sysdeps/linux/common/bits/uClibc_touplow.h +--- uClibc-dist/libc/sysdeps/linux/common/bits/uClibc_touplow.h Fri Jun 3 13:30:25 2005 ++++ uClibc/libc/sysdeps/linux/common/bits/uClibc_touplow.h Fri Jun 3 13:30:39 2005 +@@ -34,11 +34,11 @@ + + /* glibc uses the equivalent of - typedef __int32_t __ctype_touplow_t; */ + +-typedef __uint16_t __ctype_mask_t; ++typedef __uint32_t __ctype_mask_t; + + #ifdef __UCLIBC_HAS_CTYPE_SIGNED__ + +-typedef __int16_t __ctype_touplow_t; ++typedef __int32_t __ctype_touplow_t; + #define __UCLIBC_CTYPE_B_TBL_OFFSET 128 + #define __UCLIBC_CTYPE_TO_TBL_OFFSET 128 + diff --git a/patches/uClibc/0.9.28.2/140-custom-ISA.patch b/patches/uClibc/0.9.28.2/140-custom-ISA.patch new file mode 100644 index 0000000..2cc9bcb --- /dev/null +++ b/patches/uClibc/0.9.28.2/140-custom-ISA.patch @@ -0,0 +1,31 @@ +diff -dur uClibc-0.9.28.orig/Rules.mak uClibc-0.9.28/Rules.mak +--- uClibc-0.9.28.orig/Rules.mak 2005-08-18 00:49:49.000000000 +0200 ++++ uClibc-0.9.28/Rules.mak 2007-01-30 10:53:34.000000000 +0100 +@@ -168,6 +168,7 @@ + CPU_CFLAGS-$(CONFIG_MIPS_ISA_4)+=-mips4 -mtune=mips4 + CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS32)+=-mips32 -mtune=mips32 + CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS64)+=-mips64 -mtune=mips32 ++ CPU_CFLAGS-$(CONFIG_MIPS_ISA_CUSTOM)+=-march=$(CONFIG_MIPS_CPU_CFLAGS_CUSTOM) + endif + + ifeq ($(strip $(TARGET_ARCH)),sh) +diff -dur uClibc-0.9.28.orig/extra/Configs/Config.mips uClibc-0.9.28/extra/Configs/Config.mips +--- uClibc-0.9.28.orig/extra/Configs/Config.mips 2005-08-18 00:49:41.000000000 +0200 ++++ uClibc-0.9.28/extra/Configs/Config.mips 2007-01-30 10:52:12.000000000 +0100 +@@ -63,4 +63,16 @@ + config CONFIG_MIPS_ISA_MIPS64 + bool "MIPS64" + ++config CONFIG_MIPS_ISA_CUSTOM ++ bool "Custom" ++ + endchoice ++ ++config CONFIG_MIPS_CPU_CFLAGS_CUSTOM ++ string ++ prompt "Custon ISA" ++ depends on CONFIG_MIPS_ISA_CUSTOM ++ default "" ++ help ++ Enter your custom ISA here (eg: lx4189!). ++ diff --git a/patches/uClibc/0.9.28.2/150-mips-asm.h.patch b/patches/uClibc/0.9.28.2/150-mips-asm.h.patch new file mode 100644 index 0000000..285feed --- /dev/null +++ b/patches/uClibc/0.9.28.2/150-mips-asm.h.patch @@ -0,0 +1,41 @@ +diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/clone.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/clone.S +--- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/clone.S 2007-02-07 11:18:12.000000000 +0100 ++++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/clone.S 2007-02-07 10:41:34.000000000 +0100 +@@ -24,7 +24,7 @@ + #include + #define _ERRNO_H 1 + #include +-#include ++#include + + /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */ + +diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/pipe.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/pipe.S +--- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/pipe.S 2007-02-07 11:18:12.000000000 +0100 ++++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/pipe.S 2007-02-07 11:16:52.000000000 +0100 +@@ -3,9 +3,9 @@ + /*see uClibc's sh/pipe.c and glibc-2.2.4's mips/pipe.S */ + + #include +-#include ++#include + #include +-#include ++#include + + .globl pipe + .ent pipe, 0 +diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/syscall.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/syscall.S +--- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/syscall.S 2007-02-07 11:18:12.000000000 +0100 ++++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/syscall.S 2007-02-07 11:17:03.000000000 +0100 +@@ -17,8 +17,8 @@ + 02111-1307 USA. */ + + #include +-#include +-#include ++#include ++#include + + #ifdef __PIC__ + .option pic2 diff --git a/patches/uClibc/0.9.28.2/200-custom-ISA.patch b/patches/uClibc/0.9.28.2/200-custom-ISA.patch deleted file mode 100644 index 2cc9bcb..0000000 --- a/patches/uClibc/0.9.28.2/200-custom-ISA.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff -dur uClibc-0.9.28.orig/Rules.mak uClibc-0.9.28/Rules.mak ---- uClibc-0.9.28.orig/Rules.mak 2005-08-18 00:49:49.000000000 +0200 -+++ uClibc-0.9.28/Rules.mak 2007-01-30 10:53:34.000000000 +0100 -@@ -168,6 +168,7 @@ - CPU_CFLAGS-$(CONFIG_MIPS_ISA_4)+=-mips4 -mtune=mips4 - CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS32)+=-mips32 -mtune=mips32 - CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS64)+=-mips64 -mtune=mips32 -+ CPU_CFLAGS-$(CONFIG_MIPS_ISA_CUSTOM)+=-march=$(CONFIG_MIPS_CPU_CFLAGS_CUSTOM) - endif - - ifeq ($(strip $(TARGET_ARCH)),sh) -diff -dur uClibc-0.9.28.orig/extra/Configs/Config.mips uClibc-0.9.28/extra/Configs/Config.mips ---- uClibc-0.9.28.orig/extra/Configs/Config.mips 2005-08-18 00:49:41.000000000 +0200 -+++ uClibc-0.9.28/extra/Configs/Config.mips 2007-01-30 10:52:12.000000000 +0100 -@@ -63,4 +63,16 @@ - config CONFIG_MIPS_ISA_MIPS64 - bool "MIPS64" - -+config CONFIG_MIPS_ISA_CUSTOM -+ bool "Custom" -+ - endchoice -+ -+config CONFIG_MIPS_CPU_CFLAGS_CUSTOM -+ string -+ prompt "Custon ISA" -+ depends on CONFIG_MIPS_ISA_CUSTOM -+ default "" -+ help -+ Enter your custom ISA here (eg: lx4189!). -+ diff --git a/patches/uClibc/0.9.28.2/201-mips-asm.h.patch b/patches/uClibc/0.9.28.2/201-mips-asm.h.patch deleted file mode 100644 index 285feed..0000000 --- a/patches/uClibc/0.9.28.2/201-mips-asm.h.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/clone.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/clone.S ---- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/clone.S 2007-02-07 11:18:12.000000000 +0100 -+++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/clone.S 2007-02-07 10:41:34.000000000 +0100 -@@ -24,7 +24,7 @@ - #include - #define _ERRNO_H 1 - #include --#include -+#include - - /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */ - -diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/pipe.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/pipe.S ---- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/pipe.S 2007-02-07 11:18:12.000000000 +0100 -+++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/pipe.S 2007-02-07 11:16:52.000000000 +0100 -@@ -3,9 +3,9 @@ - /*see uClibc's sh/pipe.c and glibc-2.2.4's mips/pipe.S */ - - #include --#include -+#include - #include --#include -+#include - - .globl pipe - .ent pipe, 0 -diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/syscall.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/syscall.S ---- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/syscall.S 2007-02-07 11:18:12.000000000 +0100 -+++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/syscall.S 2007-02-07 11:17:03.000000000 +0100 -@@ -17,8 +17,8 @@ - 02111-1307 USA. */ - - #include --#include --#include -+#include -+#include - - #ifdef __PIC__ - .option pic2 diff --git a/patches/uClibc/0.9.28.3/000-string-functions.patch b/patches/uClibc/0.9.28.3/000-string-functions.patch deleted file mode 100644 index ab6c255..0000000 --- a/patches/uClibc/0.9.28.3/000-string-functions.patch +++ /dev/null @@ -1,14 +0,0 @@ -Give preference to target-optimised functions over glibc's ones, -which in turn ahave precedence over generic ones. - ---- uClibc.orig/libc/Makefile 2005-07-20 08:10:44.000000000 +0200 -+++ uclibc/libc/Makefile 2005-07-28 13:33:40.000000000 +0200 -@@ -59,7 +59,7 @@ - $(AR) dN 2 $(LIBNAME) $$objs && \ - $(AR) dN 2 $(LIBNAME) $$objs - @for objfile in obj.signal \ -- obj.string.generic obj.string.$(TARGET_ARCH) obj.string \ -+ obj.string obj.string.generic obj.string.$(TARGET_ARCH) \ - obj.sysdeps.common obj.sysdeps.$(TARGET_ARCH) ; do \ - if [ -e $$objfile ] ; then \ - echo $(AR) $(ARFLAGS) $(LIBNAME) $$objfile ; \ diff --git a/patches/uClibc/0.9.28.3/001-install_dev.patch b/patches/uClibc/0.9.28.3/001-install_dev.patch deleted file mode 100644 index 4b42467..0000000 --- a/patches/uClibc/0.9.28.3/001-install_dev.patch +++ /dev/null @@ -1,22 +0,0 @@ -We know that the kernel headers are in place. Don't try to install them. - -diff -dur uClibc-0.9.28.1.orig/Makefile uClibc-0.9.28.1/Makefile ---- uClibc-0.9.28.1.orig/Makefile 2007-01-28 06:38:00.000000000 +0100 -+++ uClibc-0.9.28.1/Makefile 2007-01-28 18:55:46.000000000 +0100 -@@ -158,12 +158,10 @@ - $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib - $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include - -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/ -- if [ "$(KERNEL_SOURCE)" = "$(DEVEL_PREFIX)" ] ; then \ -- extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \ -- else \ -- extra_exclude="" ; \ -- fi ; \ -- tar -chf - include --exclude .svn --exclude CVS $$extra_exclude \ -+ extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \ -+ tar -chf - include --exclude .svn --exclude CVS \ -+ --exclude include/linux \ -+ --exclude include/asm'*' \ - | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX) - echo '/* Dont use _syscall#() macros; use the syscall() function */' > \ - $(PREFIX)$(DEVEL_PREFIX)include/bits/syscalls.h diff --git a/patches/uClibc/0.9.28.3/002-no_LFS-no_readahead.patch b/patches/uClibc/0.9.28.3/002-no_LFS-no_readahead.patch deleted file mode 100644 index ca0568c..0000000 --- a/patches/uClibc/0.9.28.3/002-no_LFS-no_readahead.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/common/Makefile uClibc-0.9.28.1/libc/sysdeps/linux/common/Makefile ---- uClibc-0.9.28.1.orig/libc/sysdeps/linux/common/Makefile 2007-01-26 00:54:19.000000000 +0100 -+++ uClibc-0.9.28.1/libc/sysdeps/linux/common/Makefile 2007-02-01 08:44:37.000000000 +0100 -@@ -25,6 +25,10 @@ - SRCS := $(filter-out sbrk.c,$(SRCS)) - endif - -+ifneq ($(strip $(UCLIBC_HAS_LFS)),y) -+SRCS := $(filter-out readahead.c,$(SRCS)) -+endif -+ - ifneq ($(strip $(UCLIBC_HAS_SSP)),y) - SRCS := $(filter-out ssp.c,$(SRCS)) - endif diff --git a/patches/uClibc/0.9.28.3/004-ctype.patch b/patches/uClibc/0.9.28.3/004-ctype.patch deleted file mode 100644 index b07ccdb..0000000 --- a/patches/uClibc/0.9.28.3/004-ctype.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -urN uClibc-dist/libc/sysdeps/linux/common/bits/uClibc_touplow.h uClibc/libc/sysdeps/linux/common/bits/uClibc_touplow.h ---- uClibc-dist/libc/sysdeps/linux/common/bits/uClibc_touplow.h Fri Jun 3 13:30:25 2005 -+++ uClibc/libc/sysdeps/linux/common/bits/uClibc_touplow.h Fri Jun 3 13:30:39 2005 -@@ -34,11 +34,11 @@ - - /* glibc uses the equivalent of - typedef __int32_t __ctype_touplow_t; */ - --typedef __uint16_t __ctype_mask_t; -+typedef __uint32_t __ctype_mask_t; - - #ifdef __UCLIBC_HAS_CTYPE_SIGNED__ - --typedef __int16_t __ctype_touplow_t; -+typedef __int32_t __ctype_touplow_t; - #define __UCLIBC_CTYPE_B_TBL_OFFSET 128 - #define __UCLIBC_CTYPE_TO_TBL_OFFSET 128 - diff --git a/patches/uClibc/0.9.28.3/100-string-functions.patch b/patches/uClibc/0.9.28.3/100-string-functions.patch new file mode 100644 index 0000000..ab6c255 --- /dev/null +++ b/patches/uClibc/0.9.28.3/100-string-functions.patch @@ -0,0 +1,14 @@ +Give preference to target-optimised functions over glibc's ones, +which in turn ahave precedence over generic ones. + +--- uClibc.orig/libc/Makefile 2005-07-20 08:10:44.000000000 +0200 ++++ uclibc/libc/Makefile 2005-07-28 13:33:40.000000000 +0200 +@@ -59,7 +59,7 @@ + $(AR) dN 2 $(LIBNAME) $$objs && \ + $(AR) dN 2 $(LIBNAME) $$objs + @for objfile in obj.signal \ +- obj.string.generic obj.string.$(TARGET_ARCH) obj.string \ ++ obj.string obj.string.generic obj.string.$(TARGET_ARCH) \ + obj.sysdeps.common obj.sysdeps.$(TARGET_ARCH) ; do \ + if [ -e $$objfile ] ; then \ + echo $(AR) $(ARFLAGS) $(LIBNAME) $$objfile ; \ diff --git a/patches/uClibc/0.9.28.3/110-install_dev.patch b/patches/uClibc/0.9.28.3/110-install_dev.patch new file mode 100644 index 0000000..4b42467 --- /dev/null +++ b/patches/uClibc/0.9.28.3/110-install_dev.patch @@ -0,0 +1,22 @@ +We know that the kernel headers are in place. Don't try to install them. + +diff -dur uClibc-0.9.28.1.orig/Makefile uClibc-0.9.28.1/Makefile +--- uClibc-0.9.28.1.orig/Makefile 2007-01-28 06:38:00.000000000 +0100 ++++ uClibc-0.9.28.1/Makefile 2007-01-28 18:55:46.000000000 +0100 +@@ -158,12 +158,10 @@ + $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib + $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include + -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/ +- if [ "$(KERNEL_SOURCE)" = "$(DEVEL_PREFIX)" ] ; then \ +- extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \ +- else \ +- extra_exclude="" ; \ +- fi ; \ +- tar -chf - include --exclude .svn --exclude CVS $$extra_exclude \ ++ extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \ ++ tar -chf - include --exclude .svn --exclude CVS \ ++ --exclude include/linux \ ++ --exclude include/asm'*' \ + | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX) + echo '/* Dont use _syscall#() macros; use the syscall() function */' > \ + $(PREFIX)$(DEVEL_PREFIX)include/bits/syscalls.h diff --git a/patches/uClibc/0.9.28.3/120-no_LFS-no_readahead.patch b/patches/uClibc/0.9.28.3/120-no_LFS-no_readahead.patch new file mode 100644 index 0000000..ca0568c --- /dev/null +++ b/patches/uClibc/0.9.28.3/120-no_LFS-no_readahead.patch @@ -0,0 +1,14 @@ +diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/common/Makefile uClibc-0.9.28.1/libc/sysdeps/linux/common/Makefile +--- uClibc-0.9.28.1.orig/libc/sysdeps/linux/common/Makefile 2007-01-26 00:54:19.000000000 +0100 ++++ uClibc-0.9.28.1/libc/sysdeps/linux/common/Makefile 2007-02-01 08:44:37.000000000 +0100 +@@ -25,6 +25,10 @@ + SRCS := $(filter-out sbrk.c,$(SRCS)) + endif + ++ifneq ($(strip $(UCLIBC_HAS_LFS)),y) ++SRCS := $(filter-out readahead.c,$(SRCS)) ++endif ++ + ifneq ($(strip $(UCLIBC_HAS_SSP)),y) + SRCS := $(filter-out ssp.c,$(SRCS)) + endif diff --git a/patches/uClibc/0.9.28.3/130-ctype.patch b/patches/uClibc/0.9.28.3/130-ctype.patch new file mode 100644 index 0000000..b07ccdb --- /dev/null +++ b/patches/uClibc/0.9.28.3/130-ctype.patch @@ -0,0 +1,17 @@ +diff -urN uClibc-dist/libc/sysdeps/linux/common/bits/uClibc_touplow.h uClibc/libc/sysdeps/linux/common/bits/uClibc_touplow.h +--- uClibc-dist/libc/sysdeps/linux/common/bits/uClibc_touplow.h Fri Jun 3 13:30:25 2005 ++++ uClibc/libc/sysdeps/linux/common/bits/uClibc_touplow.h Fri Jun 3 13:30:39 2005 +@@ -34,11 +34,11 @@ + + /* glibc uses the equivalent of - typedef __int32_t __ctype_touplow_t; */ + +-typedef __uint16_t __ctype_mask_t; ++typedef __uint32_t __ctype_mask_t; + + #ifdef __UCLIBC_HAS_CTYPE_SIGNED__ + +-typedef __int16_t __ctype_touplow_t; ++typedef __int32_t __ctype_touplow_t; + #define __UCLIBC_CTYPE_B_TBL_OFFSET 128 + #define __UCLIBC_CTYPE_TO_TBL_OFFSET 128 + diff --git a/patches/uClibc/0.9.28.3/140-custom-ISA.patch b/patches/uClibc/0.9.28.3/140-custom-ISA.patch new file mode 100644 index 0000000..2cc9bcb --- /dev/null +++ b/patches/uClibc/0.9.28.3/140-custom-ISA.patch @@ -0,0 +1,31 @@ +diff -dur uClibc-0.9.28.orig/Rules.mak uClibc-0.9.28/Rules.mak +--- uClibc-0.9.28.orig/Rules.mak 2005-08-18 00:49:49.000000000 +0200 ++++ uClibc-0.9.28/Rules.mak 2007-01-30 10:53:34.000000000 +0100 +@@ -168,6 +168,7 @@ + CPU_CFLAGS-$(CONFIG_MIPS_ISA_4)+=-mips4 -mtune=mips4 + CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS32)+=-mips32 -mtune=mips32 + CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS64)+=-mips64 -mtune=mips32 ++ CPU_CFLAGS-$(CONFIG_MIPS_ISA_CUSTOM)+=-march=$(CONFIG_MIPS_CPU_CFLAGS_CUSTOM) + endif + + ifeq ($(strip $(TARGET_ARCH)),sh) +diff -dur uClibc-0.9.28.orig/extra/Configs/Config.mips uClibc-0.9.28/extra/Configs/Config.mips +--- uClibc-0.9.28.orig/extra/Configs/Config.mips 2005-08-18 00:49:41.000000000 +0200 ++++ uClibc-0.9.28/extra/Configs/Config.mips 2007-01-30 10:52:12.000000000 +0100 +@@ -63,4 +63,16 @@ + config CONFIG_MIPS_ISA_MIPS64 + bool "MIPS64" + ++config CONFIG_MIPS_ISA_CUSTOM ++ bool "Custom" ++ + endchoice ++ ++config CONFIG_MIPS_CPU_CFLAGS_CUSTOM ++ string ++ prompt "Custon ISA" ++ depends on CONFIG_MIPS_ISA_CUSTOM ++ default "" ++ help ++ Enter your custom ISA here (eg: lx4189!). ++ diff --git a/patches/uClibc/0.9.28.3/150-mips-asm.h.patch b/patches/uClibc/0.9.28.3/150-mips-asm.h.patch new file mode 100644 index 0000000..285feed --- /dev/null +++ b/patches/uClibc/0.9.28.3/150-mips-asm.h.patch @@ -0,0 +1,41 @@ +diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/clone.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/clone.S +--- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/clone.S 2007-02-07 11:18:12.000000000 +0100 ++++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/clone.S 2007-02-07 10:41:34.000000000 +0100 +@@ -24,7 +24,7 @@ + #include + #define _ERRNO_H 1 + #include +-#include ++#include + + /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */ + +diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/pipe.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/pipe.S +--- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/pipe.S 2007-02-07 11:18:12.000000000 +0100 ++++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/pipe.S 2007-02-07 11:16:52.000000000 +0100 +@@ -3,9 +3,9 @@ + /*see uClibc's sh/pipe.c and glibc-2.2.4's mips/pipe.S */ + + #include +-#include ++#include + #include +-#include ++#include + + .globl pipe + .ent pipe, 0 +diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/syscall.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/syscall.S +--- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/syscall.S 2007-02-07 11:18:12.000000000 +0100 ++++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/syscall.S 2007-02-07 11:17:03.000000000 +0100 +@@ -17,8 +17,8 @@ + 02111-1307 USA. */ + + #include +-#include +-#include ++#include ++#include + + #ifdef __PIC__ + .option pic2 diff --git a/patches/uClibc/0.9.28.3/200-custom-ISA.patch b/patches/uClibc/0.9.28.3/200-custom-ISA.patch deleted file mode 100644 index 2cc9bcb..0000000 --- a/patches/uClibc/0.9.28.3/200-custom-ISA.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff -dur uClibc-0.9.28.orig/Rules.mak uClibc-0.9.28/Rules.mak ---- uClibc-0.9.28.orig/Rules.mak 2005-08-18 00:49:49.000000000 +0200 -+++ uClibc-0.9.28/Rules.mak 2007-01-30 10:53:34.000000000 +0100 -@@ -168,6 +168,7 @@ - CPU_CFLAGS-$(CONFIG_MIPS_ISA_4)+=-mips4 -mtune=mips4 - CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS32)+=-mips32 -mtune=mips32 - CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS64)+=-mips64 -mtune=mips32 -+ CPU_CFLAGS-$(CONFIG_MIPS_ISA_CUSTOM)+=-march=$(CONFIG_MIPS_CPU_CFLAGS_CUSTOM) - endif - - ifeq ($(strip $(TARGET_ARCH)),sh) -diff -dur uClibc-0.9.28.orig/extra/Configs/Config.mips uClibc-0.9.28/extra/Configs/Config.mips ---- uClibc-0.9.28.orig/extra/Configs/Config.mips 2005-08-18 00:49:41.000000000 +0200 -+++ uClibc-0.9.28/extra/Configs/Config.mips 2007-01-30 10:52:12.000000000 +0100 -@@ -63,4 +63,16 @@ - config CONFIG_MIPS_ISA_MIPS64 - bool "MIPS64" - -+config CONFIG_MIPS_ISA_CUSTOM -+ bool "Custom" -+ - endchoice -+ -+config CONFIG_MIPS_CPU_CFLAGS_CUSTOM -+ string -+ prompt "Custon ISA" -+ depends on CONFIG_MIPS_ISA_CUSTOM -+ default "" -+ help -+ Enter your custom ISA here (eg: lx4189!). -+ diff --git a/patches/uClibc/0.9.28.3/201-mips-asm.h.patch b/patches/uClibc/0.9.28.3/201-mips-asm.h.patch deleted file mode 100644 index 285feed..0000000 --- a/patches/uClibc/0.9.28.3/201-mips-asm.h.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/clone.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/clone.S ---- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/clone.S 2007-02-07 11:18:12.000000000 +0100 -+++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/clone.S 2007-02-07 10:41:34.000000000 +0100 -@@ -24,7 +24,7 @@ - #include - #define _ERRNO_H 1 - #include --#include -+#include - - /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */ - -diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/pipe.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/pipe.S ---- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/pipe.S 2007-02-07 11:18:12.000000000 +0100 -+++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/pipe.S 2007-02-07 11:16:52.000000000 +0100 -@@ -3,9 +3,9 @@ - /*see uClibc's sh/pipe.c and glibc-2.2.4's mips/pipe.S */ - - #include --#include -+#include - #include --#include -+#include - - .globl pipe - .ent pipe, 0 -diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/syscall.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/syscall.S ---- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/syscall.S 2007-02-07 11:18:12.000000000 +0100 -+++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/syscall.S 2007-02-07 11:17:03.000000000 +0100 -@@ -17,8 +17,8 @@ - 02111-1307 USA. */ - - #include --#include --#include -+#include -+#include - - #ifdef __PIC__ - .option pic2 diff --git a/patches/uClibc/0.9.28/000-string-functions.patch b/patches/uClibc/0.9.28/000-string-functions.patch deleted file mode 100644 index 4436bfe..0000000 --- a/patches/uClibc/0.9.28/000-string-functions.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- uClibc.orig/libc/Makefile 2005-07-20 08:10:44.000000000 +0200 -+++ uclibc/libc/Makefile 2005-07-28 13:33:40.000000000 +0200 -@@ -59,7 +59,7 @@ - $(AR) dN 2 $(LIBNAME) $$objs && \ - $(AR) dN 2 $(LIBNAME) $$objs - @for objfile in obj.signal \ -- obj.string.generic obj.string.$(TARGET_ARCH) obj.string \ -+ obj.string obj.string.generic obj.string.$(TARGET_ARCH) \ - obj.sysdeps.common obj.sysdeps.$(TARGET_ARCH) ; do \ - if [ -e $$objfile ] ; then \ - echo $(AR) $(ARFLAGS) $(LIBNAME) $$objfile ; \ diff --git a/patches/uClibc/0.9.28/001-install_dev.patch b/patches/uClibc/0.9.28/001-install_dev.patch deleted file mode 100644 index 476525b..0000000 --- a/patches/uClibc/0.9.28/001-install_dev.patch +++ /dev/null @@ -1,39 +0,0 @@ -There are at least three weird glitches in the Makefile: - - the test operator is a dual-equal sign (==) when it should be a single one (=); - - the exclude options are not accepted as is by GNU tar; - - how on earth could KERNEL_SOURCE possibly be equal to DEVEL_PREFIX ??? - -We (Cedric DUVAL and I, Yann E. MORIN) are not quite sure why it is that way. -We're not quite sure either on how to solve this. - -What we need is to built a toolchain; in no way we need to install the linux headers. - ==> systematically exclude them from the [s]tar command. - -This patch is inspired by the svn repository of uClibc as of 20060209. -diff -dur /home/ymorin/dev/uClibc-0.9.28/Makefile uClibc-0.9.28/Makefile ---- /home/ymorin/dev/uClibc-0.9.28/Makefile 2005-08-18 00:49:49.000000000 +0200 -+++ uClibc-0.9.28/Makefile 2006-02-09 17:06:58.000000000 +0100 -@@ -158,12 +158,17 @@ - $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib - $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include - -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/ -- if [ "$(KERNEL_SOURCE)" == "$(DEVEL_PREFIX)" ] ; then \ -- extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \ -- else \ -- extra_exclude="" ; \ -- fi ; \ -- tar -chf - include --exclude .svn --exclude CVS $$extra_exclude \ -+# if [ "$(KERNEL_SOURCE)" == "$(DEVEL_PREFIX)" ] ; then \ -+# extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \ -+# else \ -+# extra_exclude="" ; \ -+# fi ; \ -+# tar -chf - include --exclude .svn --exclude CVS $$extra_exclude \ -+# | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX) -+ printf ".svn\n.cvsignore\nCVS\n" > tar_exclude ; \ -+ ls -1d include/linux include/asm* >> tar_exclude ; \ -+ tar -chf - -X tar_exclude include \ - | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX) -+ rm -f tar_exclude - ifneq ($(strip $(UCLIBC_HAS_FLOATS)),y) - # Remove floating point related headers since float support is disabled. diff --git a/patches/uClibc/0.9.28/002-no_LFS-no_readahead.patch b/patches/uClibc/0.9.28/002-no_LFS-no_readahead.patch deleted file mode 100644 index ca0568c..0000000 --- a/patches/uClibc/0.9.28/002-no_LFS-no_readahead.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/common/Makefile uClibc-0.9.28.1/libc/sysdeps/linux/common/Makefile ---- uClibc-0.9.28.1.orig/libc/sysdeps/linux/common/Makefile 2007-01-26 00:54:19.000000000 +0100 -+++ uClibc-0.9.28.1/libc/sysdeps/linux/common/Makefile 2007-02-01 08:44:37.000000000 +0100 -@@ -25,6 +25,10 @@ - SRCS := $(filter-out sbrk.c,$(SRCS)) - endif - -+ifneq ($(strip $(UCLIBC_HAS_LFS)),y) -+SRCS := $(filter-out readahead.c,$(SRCS)) -+endif -+ - ifneq ($(strip $(UCLIBC_HAS_SSP)),y) - SRCS := $(filter-out ssp.c,$(SRCS)) - endif diff --git a/patches/uClibc/0.9.28/004-ctype.patch b/patches/uClibc/0.9.28/004-ctype.patch deleted file mode 100644 index b07ccdb..0000000 --- a/patches/uClibc/0.9.28/004-ctype.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -urN uClibc-dist/libc/sysdeps/linux/common/bits/uClibc_touplow.h uClibc/libc/sysdeps/linux/common/bits/uClibc_touplow.h ---- uClibc-dist/libc/sysdeps/linux/common/bits/uClibc_touplow.h Fri Jun 3 13:30:25 2005 -+++ uClibc/libc/sysdeps/linux/common/bits/uClibc_touplow.h Fri Jun 3 13:30:39 2005 -@@ -34,11 +34,11 @@ - - /* glibc uses the equivalent of - typedef __int32_t __ctype_touplow_t; */ - --typedef __uint16_t __ctype_mask_t; -+typedef __uint32_t __ctype_mask_t; - - #ifdef __UCLIBC_HAS_CTYPE_SIGNED__ - --typedef __int16_t __ctype_touplow_t; -+typedef __int32_t __ctype_touplow_t; - #define __UCLIBC_CTYPE_B_TBL_OFFSET 128 - #define __UCLIBC_CTYPE_TO_TBL_OFFSET 128 - diff --git a/patches/uClibc/0.9.28/005-fix_includes.sh.patch b/patches/uClibc/0.9.28/005-fix_includes.sh.patch deleted file mode 100644 index 0311c83..0000000 --- a/patches/uClibc/0.9.28/005-fix_includes.sh.patch +++ /dev/null @@ -1,316 +0,0 @@ ---- uClibc-0.9.28/extra/scripts/fix_includes.sh.orig 2006-12-13 05:44:21.000000000 -0700 -+++ uClibc-0.9.28/extra/scripts/fix_includes.sh 2006-12-13 05:44:35.000000000 -0700 -@@ -1,183 +1,155 @@ - #!/bin/sh --# Copyright (C) 2003 Erik Andersen - # --# This program is free software; you can redistribute it and/or --# modify it under the terms of the GNU Library General Public --# License as published by the Free Software Foundation; either --# version 2 of the License, or (at your option) any later --# version. --# --# This program 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 Library General Public License for more details. --# --# You should have received a copy of the GNU Library General --# Public License along with this program; if not, write to the --# Free Software Foundation, Inc., 59 Temple Place, Suite 330, --# Boston, MA 02111-1307 USA -- --usage () { -- echo "" -- echo "usage: "`basename $0`" -k KERNEL_SOURCE_DIRECTORY -t TARGET_ARCH" -- echo "" -- echo "This utility scans the KERNEL_SOURCE_DIRECTORY directory and" -- echo "checks that it contains well formed kernel headers suitable" -- echo "for inclusion as the include/linux/ directory provided by" -- echo "uClibc." -- echo "" -- echo "If the specified kernel headers are present and already" -- echo "configured for the architecture specified by TARGET_ARCH," -- echo "they will be used as-is." -- echo "" -- echo "If the specified kernel headers are missing entirely, this" -- echo "script will return an error." -- echo "" -- echo "If the specified kernel headers are present, but are either" -- echo "not yet configured or are configured for an architecture" -- echo "different than that specified by TARGET_ARCH, this script" -- echo "will attempt to 'fix' the kernel headers and make them" -- echo "suitable for use by uClibc. This fixing process may fail." -- echo "It is therefore best to always provide kernel headers that" -- echo "are already configured for the selected architecture." -- echo "" -- echo "Most Linux distributions provide 'kernel-headers' packages" -- echo "that are suitable for use by uClibc." -- echo "" -- echo "" -- exit 1; -+# Copyright (C) 2000-2005 Erik Andersen -+# -+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -+# -+ -+usage() { -+ echo "" -+ echo "usage: "`basename $0`" -k KERNEL_SOURCE_DIRECTORY -t TARGET_ARCH" -+ echo "" -+ echo "This utility scans the KERNEL_SOURCE_DIRECTORY directory and" -+ echo "checks that it contains well formed kernel headers suitable" -+ echo "for inclusion as the include/linux/ directory provided by" -+ echo "uClibc." -+ echo "" -+ echo "If the specified kernel headers are present and already" -+ echo "configured for the architecture specified by TARGET_ARCH," -+ echo "they will be used as-is." -+ echo "" -+ echo "If the specified kernel headers are missing entirely, this" -+ echo "script will return an error." -+ echo "" -+ echo "If the specified kernel headers are present, but are either" -+ echo "not yet configured or are configured for an architecture" -+ echo "different than that specified by TARGET_ARCH, this script" -+ echo "will attempt to 'fix' the kernel headers and make them" -+ echo "suitable for use by uClibc. This fixing process may fail." -+ echo "It is therefore best to always provide kernel headers that" -+ echo "are already configured for the selected architecture." -+ echo "" -+ echo "Most Linux distributions provide 'kernel-headers' packages" -+ echo "that are suitable for use by uClibc." -+ echo "" -+ echo "" -+ exit 1 - } - --HAS_MMU="y"; -+ -+# -+# Parse our arguments -+# -+HAS_MMU="y" - while [ -n "$1" ]; do -- case $1 in -- -k ) shift; if [ -n "$1" ]; then KERNEL_SOURCE=$1; shift; else usage; fi; ;; -- -t ) shift; if [ -n "$1" ]; then TARGET_ARCH=$1; shift; else usage; fi; ;; -- -n ) shift; HAS_MMU="n"; ;; -- -* ) usage; ;; -- * ) usage; ;; -- esac; --done; -+ case $1 in -+ -k ) shift; if [ -n "$1" ]; then KERNEL_SOURCE=$1; shift; else usage; fi; ;; -+ -t ) shift; if [ -n "$1" ]; then TARGET_ARCH=$1; shift; else usage; fi; ;; -+ -n ) shift; HAS_MMU="n"; ;; -+ -* ) usage; ;; -+ * ) usage; ;; -+ esac -+done - --if [ ! -f "$KERNEL_SOURCE/Makefile" -a ! -f "$KERNEL_SOURCE/include/linux/version.h" ]; then -- echo ""; -- echo ""; -- echo "The file $KERNEL_SOURCE/Makefile or $KERNEL_SOURCE/include/linux/version.h is missing!"; -- echo "Perhaps your kernel source is broken?" -- echo ""; -- echo ""; -- exit 1; --fi; - --if [ ! -d "$KERNEL_SOURCE" ]; then -- echo ""; -- echo ""; -- echo "$KERNEL_SOURCE is not a directory"; -- echo ""; -- echo ""; -- exit 1; --fi; -- --if [ -f "$KERNEL_SOURCE/Makefile" ] ; then --# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION --eval `sed -n -e 's/^\([A-Z]*\) = \([0-9]*\)$/\1=\2/p' -e 's/^\([A-Z]*\) = \(-[-a-z0-9]*\)$/\1=\2/p' $KERNEL_SOURCE/Makefile` --else --ver=`grep UTS_RELEASE $KERNEL_SOURCE/include/linux/version.h | cut -d '"' -f 2` --VERSION=`echo "$ver" | cut -d '.' -f 1` --PATCHLEVEL=`echo "$ver" | cut -d '.' -f 2` --if echo "$ver" | grep -q '-' ; then --SUBLEVEL=`echo "$ver" | sed "s/${VERSION}.${PATCHLEVEL}.//" | cut -d '-' -f 1` --EXTRAVERSION=`echo "$ver" | sed "s/${VERSION}.${PATCHLEVEL}.${SUBLEVEL}-//"` --else --SUBLEVEL=`echo "$ver" | cut -d '.' -f 3` --#EXTRAVERSION= --fi -+# -+# Perform some sanity checks on our kernel sources -+# -+if [ ! -f "$KERNEL_SOURCE/Makefile" -a ! -f "$KERNEL_SOURCE/include/linux/version.h" ]; then -+ echo "" -+ echo "" -+ echo "The file $KERNEL_SOURCE/Makefile or $KERNEL_SOURCE/include/linux/version.h is missing!" -+ echo "Perhaps your kernel source is broken?" -+ echo "" -+ echo "" -+ exit 1 - fi --if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ] --then -- echo "Unable to determine version for kernel headers" -- echo -e "\tprovided in directory $KERNEL_SOURCE" -- exit 1 -+if [ ! -d "$KERNEL_SOURCE" ]; then -+ echo "" -+ echo "" -+ echo "$KERNEL_SOURCE is not a directory" -+ echo "" -+ echo "" -+ exit 1 - fi - --if [ "$MAKE_IS_SILENT" != "y" ]; then --echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION}" --echo -e "\n" --echo "Using kernel headers from $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION} for architecture '$TARGET_ARCH'" --echo -e "\tprovided in directory $KERNEL_SOURCE" --echo -e "\n" --fi - -+# - # Create a symlink to include/asm -- -+# - rm -f include/asm* - if [ ! -d "$KERNEL_SOURCE/include/asm" ]; then -- echo ""; -- echo ""; -- echo "The symlink $KERNEL_SOURCE/include/asm is missing\!"; -- echo "Perhaps you forgot to configure your kernel source?"; -- echo "You really should configure your kernel source tree so I"; -- echo "do not have to try and guess about this sort of thing."; -- echo "" -- echo "Attempting to guess a usable value...."; -- echo "" -- echo ""; -- sleep 1; -- -- if [ "$TARGET_ARCH" = "powerpc" ];then -- set -x; -- ln -fs $KERNEL_SOURCE/include/asm-ppc include/asm; -- set +x; -- elif [ "$TARGET_ARCH" = "mips" ];then -- set -x; -- ln -fs $KERNEL_SOURCE/include/asm-mips include/asm; -- set +x; -- elif [ "$TARGET_ARCH" = "arm" ];then -- set -x; -- ln -fs $KERNEL_SOURCE/include/asm-arm include/asm; -- set +x; -- if [ ! -L $KERNEL_SOURCE/include/asm-arm/proc ] ; then -- if [ ! -L proc ] ; then -- (cd include/asm; -- ln -fs proc-armv proc; -- ln -fs arch-ebsa285 arch); -- fi -+ echo "" -+ echo "" -+ echo "The symlink $KERNEL_SOURCE/include/asm is missing\!" -+ echo "Perhaps you forgot to configure your kernel source?" -+ echo "You really should configure your kernel source tree so I" -+ echo "do not have to try and guess about this sort of thing." -+ echo "" -+ echo "Attempting to guess a usable value...." -+ echo "" -+ echo "" -+ sleep 1 -+ -+ if [ "$TARGET_ARCH" = "powerpc" ]; then -+ set -x -+ ln -fs $KERNEL_SOURCE/include/asm-ppc include/asm -+ set +x -+ elif [ "$TARGET_ARCH" = "mips" ]; then -+ set -x -+ ln -fs $KERNEL_SOURCE/include/asm-mips include/asm -+ set +x -+ elif [ "$TARGET_ARCH" = "arm" ]; then -+ set -x -+ ln -fs $KERNEL_SOURCE/include/asm-arm include/asm -+ set +x -+ if [ ! -L $KERNEL_SOURCE/include/asm-arm/proc ]; then -+ if [ ! -L proc ]; then -+ ( -+ cd include/asm -+ ln -fs proc-armv proc -+ ln -fs arch-ebsa285 arch -+ ) -+ fi -+ fi -+ elif [ "$TARGET_ARCH" = "cris" ]; then -+ set -x -+ ln -fs $KERNEL_SOURCE/include/asm-cris include/asm -+ set +x -+ elif [ "$HAS_MMU" != "y" ]; then -+ if [ -d $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu ]; then -+ set -x -+ ln -fs $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu include/asm -+ set +x -+ else -+ set -x -+ ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm -+ set +x -+ fi -+ else -+ set -x -+ ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm -+ set +x - fi; -- elif [ "$TARGET_ARCH" = "cris" ]; then -- set -x; -- ln -fs $KERNEL_SOURCE/include/asm-cris include/asm; -- set +x; -- elif [ "$HAS_MMU" != "y" ]; then -- if [ -d $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu ] ; then -- set -x; -- ln -fs $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu include/asm; -- set +x; -- else -- set -x; -- ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm; -- set +x; -- fi; -- else -- set -x; -- ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm; -- set +x; -- fi; - else --# No guessing required..... --ln -fs $KERNEL_SOURCE/include/asm include/asm --if [ -e $KERNEL_SOURCE/include/asm-$TARGET_ARCH ] ; then --ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm-$TARGET_ARCH -+ # No guessing required..... -+ for x in $KERNEL_SOURCE/include/asm* ; do -+ ln -fs ${x} include/ -+ done - fi --fi; - - -+# - # Annoyingly, 2.6.x kernel headers also need an include/asm-generic/ directory --if [ $VERSION -eq 2 ] && [ $PATCHLEVEL -ge 6 ] ; then -- ln -fs $KERNEL_SOURCE/include/asm-generic include/asm-generic --fi; -+# -+if [ -e $KERNEL_SOURCE/include/asm-generic ]; then -+ rm -f include/asm-generic -+ ln -fs $KERNEL_SOURCE/include/asm-generic include/asm-generic -+fi - - -+# - # Create the include/linux symlink. -+# - rm -f include/linux - ln -fs $KERNEL_SOURCE/include/linux include/linux -- diff --git a/patches/uClibc/0.9.28/100-string-functions.patch b/patches/uClibc/0.9.28/100-string-functions.patch new file mode 100644 index 0000000..4436bfe --- /dev/null +++ b/patches/uClibc/0.9.28/100-string-functions.patch @@ -0,0 +1,11 @@ +--- uClibc.orig/libc/Makefile 2005-07-20 08:10:44.000000000 +0200 ++++ uclibc/libc/Makefile 2005-07-28 13:33:40.000000000 +0200 +@@ -59,7 +59,7 @@ + $(AR) dN 2 $(LIBNAME) $$objs && \ + $(AR) dN 2 $(LIBNAME) $$objs + @for objfile in obj.signal \ +- obj.string.generic obj.string.$(TARGET_ARCH) obj.string \ ++ obj.string obj.string.generic obj.string.$(TARGET_ARCH) \ + obj.sysdeps.common obj.sysdeps.$(TARGET_ARCH) ; do \ + if [ -e $$objfile ] ; then \ + echo $(AR) $(ARFLAGS) $(LIBNAME) $$objfile ; \ diff --git a/patches/uClibc/0.9.28/110-install_dev.patch b/patches/uClibc/0.9.28/110-install_dev.patch new file mode 100644 index 0000000..476525b --- /dev/null +++ b/patches/uClibc/0.9.28/110-install_dev.patch @@ -0,0 +1,39 @@ +There are at least three weird glitches in the Makefile: + - the test operator is a dual-equal sign (==) when it should be a single one (=); + - the exclude options are not accepted as is by GNU tar; + - how on earth could KERNEL_SOURCE possibly be equal to DEVEL_PREFIX ??? + +We (Cedric DUVAL and I, Yann E. MORIN) are not quite sure why it is that way. +We're not quite sure either on how to solve this. + +What we need is to built a toolchain; in no way we need to install the linux headers. + ==> systematically exclude them from the [s]tar command. + +This patch is inspired by the svn repository of uClibc as of 20060209. +diff -dur /home/ymorin/dev/uClibc-0.9.28/Makefile uClibc-0.9.28/Makefile +--- /home/ymorin/dev/uClibc-0.9.28/Makefile 2005-08-18 00:49:49.000000000 +0200 ++++ uClibc-0.9.28/Makefile 2006-02-09 17:06:58.000000000 +0100 +@@ -158,12 +158,17 @@ + $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib + $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include + -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/ +- if [ "$(KERNEL_SOURCE)" == "$(DEVEL_PREFIX)" ] ; then \ +- extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \ +- else \ +- extra_exclude="" ; \ +- fi ; \ +- tar -chf - include --exclude .svn --exclude CVS $$extra_exclude \ ++# if [ "$(KERNEL_SOURCE)" == "$(DEVEL_PREFIX)" ] ; then \ ++# extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \ ++# else \ ++# extra_exclude="" ; \ ++# fi ; \ ++# tar -chf - include --exclude .svn --exclude CVS $$extra_exclude \ ++# | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX) ++ printf ".svn\n.cvsignore\nCVS\n" > tar_exclude ; \ ++ ls -1d include/linux include/asm* >> tar_exclude ; \ ++ tar -chf - -X tar_exclude include \ + | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX) ++ rm -f tar_exclude + ifneq ($(strip $(UCLIBC_HAS_FLOATS)),y) + # Remove floating point related headers since float support is disabled. diff --git a/patches/uClibc/0.9.28/120-no_LFS-no_readahead.patch b/patches/uClibc/0.9.28/120-no_LFS-no_readahead.patch new file mode 100644 index 0000000..ca0568c --- /dev/null +++ b/patches/uClibc/0.9.28/120-no_LFS-no_readahead.patch @@ -0,0 +1,14 @@ +diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/common/Makefile uClibc-0.9.28.1/libc/sysdeps/linux/common/Makefile +--- uClibc-0.9.28.1.orig/libc/sysdeps/linux/common/Makefile 2007-01-26 00:54:19.000000000 +0100 ++++ uClibc-0.9.28.1/libc/sysdeps/linux/common/Makefile 2007-02-01 08:44:37.000000000 +0100 +@@ -25,6 +25,10 @@ + SRCS := $(filter-out sbrk.c,$(SRCS)) + endif + ++ifneq ($(strip $(UCLIBC_HAS_LFS)),y) ++SRCS := $(filter-out readahead.c,$(SRCS)) ++endif ++ + ifneq ($(strip $(UCLIBC_HAS_SSP)),y) + SRCS := $(filter-out ssp.c,$(SRCS)) + endif diff --git a/patches/uClibc/0.9.28/130-ctype.patch b/patches/uClibc/0.9.28/130-ctype.patch new file mode 100644 index 0000000..b07ccdb --- /dev/null +++ b/patches/uClibc/0.9.28/130-ctype.patch @@ -0,0 +1,17 @@ +diff -urN uClibc-dist/libc/sysdeps/linux/common/bits/uClibc_touplow.h uClibc/libc/sysdeps/linux/common/bits/uClibc_touplow.h +--- uClibc-dist/libc/sysdeps/linux/common/bits/uClibc_touplow.h Fri Jun 3 13:30:25 2005 ++++ uClibc/libc/sysdeps/linux/common/bits/uClibc_touplow.h Fri Jun 3 13:30:39 2005 +@@ -34,11 +34,11 @@ + + /* glibc uses the equivalent of - typedef __int32_t __ctype_touplow_t; */ + +-typedef __uint16_t __ctype_mask_t; ++typedef __uint32_t __ctype_mask_t; + + #ifdef __UCLIBC_HAS_CTYPE_SIGNED__ + +-typedef __int16_t __ctype_touplow_t; ++typedef __int32_t __ctype_touplow_t; + #define __UCLIBC_CTYPE_B_TBL_OFFSET 128 + #define __UCLIBC_CTYPE_TO_TBL_OFFSET 128 + diff --git a/patches/uClibc/0.9.28/140-fix_includes.sh.patch b/patches/uClibc/0.9.28/140-fix_includes.sh.patch new file mode 100644 index 0000000..0311c83 --- /dev/null +++ b/patches/uClibc/0.9.28/140-fix_includes.sh.patch @@ -0,0 +1,316 @@ +--- uClibc-0.9.28/extra/scripts/fix_includes.sh.orig 2006-12-13 05:44:21.000000000 -0700 ++++ uClibc-0.9.28/extra/scripts/fix_includes.sh 2006-12-13 05:44:35.000000000 -0700 +@@ -1,183 +1,155 @@ + #!/bin/sh +-# Copyright (C) 2003 Erik Andersen + # +-# This program is free software; you can redistribute it and/or +-# modify it under the terms of the GNU Library General Public +-# License as published by the Free Software Foundation; either +-# version 2 of the License, or (at your option) any later +-# version. +-# +-# This program 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 Library General Public License for more details. +-# +-# You should have received a copy of the GNU Library General +-# Public License along with this program; if not, write to the +-# Free Software Foundation, Inc., 59 Temple Place, Suite 330, +-# Boston, MA 02111-1307 USA +- +-usage () { +- echo "" +- echo "usage: "`basename $0`" -k KERNEL_SOURCE_DIRECTORY -t TARGET_ARCH" +- echo "" +- echo "This utility scans the KERNEL_SOURCE_DIRECTORY directory and" +- echo "checks that it contains well formed kernel headers suitable" +- echo "for inclusion as the include/linux/ directory provided by" +- echo "uClibc." +- echo "" +- echo "If the specified kernel headers are present and already" +- echo "configured for the architecture specified by TARGET_ARCH," +- echo "they will be used as-is." +- echo "" +- echo "If the specified kernel headers are missing entirely, this" +- echo "script will return an error." +- echo "" +- echo "If the specified kernel headers are present, but are either" +- echo "not yet configured or are configured for an architecture" +- echo "different than that specified by TARGET_ARCH, this script" +- echo "will attempt to 'fix' the kernel headers and make them" +- echo "suitable for use by uClibc. This fixing process may fail." +- echo "It is therefore best to always provide kernel headers that" +- echo "are already configured for the selected architecture." +- echo "" +- echo "Most Linux distributions provide 'kernel-headers' packages" +- echo "that are suitable for use by uClibc." +- echo "" +- echo "" +- exit 1; ++# Copyright (C) 2000-2005 Erik Andersen ++# ++# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. ++# ++ ++usage() { ++ echo "" ++ echo "usage: "`basename $0`" -k KERNEL_SOURCE_DIRECTORY -t TARGET_ARCH" ++ echo "" ++ echo "This utility scans the KERNEL_SOURCE_DIRECTORY directory and" ++ echo "checks that it contains well formed kernel headers suitable" ++ echo "for inclusion as the include/linux/ directory provided by" ++ echo "uClibc." ++ echo "" ++ echo "If the specified kernel headers are present and already" ++ echo "configured for the architecture specified by TARGET_ARCH," ++ echo "they will be used as-is." ++ echo "" ++ echo "If the specified kernel headers are missing entirely, this" ++ echo "script will return an error." ++ echo "" ++ echo "If the specified kernel headers are present, but are either" ++ echo "not yet configured or are configured for an architecture" ++ echo "different than that specified by TARGET_ARCH, this script" ++ echo "will attempt to 'fix' the kernel headers and make them" ++ echo "suitable for use by uClibc. This fixing process may fail." ++ echo "It is therefore best to always provide kernel headers that" ++ echo "are already configured for the selected architecture." ++ echo "" ++ echo "Most Linux distributions provide 'kernel-headers' packages" ++ echo "that are suitable for use by uClibc." ++ echo "" ++ echo "" ++ exit 1 + } + +-HAS_MMU="y"; ++ ++# ++# Parse our arguments ++# ++HAS_MMU="y" + while [ -n "$1" ]; do +- case $1 in +- -k ) shift; if [ -n "$1" ]; then KERNEL_SOURCE=$1; shift; else usage; fi; ;; +- -t ) shift; if [ -n "$1" ]; then TARGET_ARCH=$1; shift; else usage; fi; ;; +- -n ) shift; HAS_MMU="n"; ;; +- -* ) usage; ;; +- * ) usage; ;; +- esac; +-done; ++ case $1 in ++ -k ) shift; if [ -n "$1" ]; then KERNEL_SOURCE=$1; shift; else usage; fi; ;; ++ -t ) shift; if [ -n "$1" ]; then TARGET_ARCH=$1; shift; else usage; fi; ;; ++ -n ) shift; HAS_MMU="n"; ;; ++ -* ) usage; ;; ++ * ) usage; ;; ++ esac ++done + +-if [ ! -f "$KERNEL_SOURCE/Makefile" -a ! -f "$KERNEL_SOURCE/include/linux/version.h" ]; then +- echo ""; +- echo ""; +- echo "The file $KERNEL_SOURCE/Makefile or $KERNEL_SOURCE/include/linux/version.h is missing!"; +- echo "Perhaps your kernel source is broken?" +- echo ""; +- echo ""; +- exit 1; +-fi; + +-if [ ! -d "$KERNEL_SOURCE" ]; then +- echo ""; +- echo ""; +- echo "$KERNEL_SOURCE is not a directory"; +- echo ""; +- echo ""; +- exit 1; +-fi; +- +-if [ -f "$KERNEL_SOURCE/Makefile" ] ; then +-# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION +-eval `sed -n -e 's/^\([A-Z]*\) = \([0-9]*\)$/\1=\2/p' -e 's/^\([A-Z]*\) = \(-[-a-z0-9]*\)$/\1=\2/p' $KERNEL_SOURCE/Makefile` +-else +-ver=`grep UTS_RELEASE $KERNEL_SOURCE/include/linux/version.h | cut -d '"' -f 2` +-VERSION=`echo "$ver" | cut -d '.' -f 1` +-PATCHLEVEL=`echo "$ver" | cut -d '.' -f 2` +-if echo "$ver" | grep -q '-' ; then +-SUBLEVEL=`echo "$ver" | sed "s/${VERSION}.${PATCHLEVEL}.//" | cut -d '-' -f 1` +-EXTRAVERSION=`echo "$ver" | sed "s/${VERSION}.${PATCHLEVEL}.${SUBLEVEL}-//"` +-else +-SUBLEVEL=`echo "$ver" | cut -d '.' -f 3` +-#EXTRAVERSION= +-fi ++# ++# Perform some sanity checks on our kernel sources ++# ++if [ ! -f "$KERNEL_SOURCE/Makefile" -a ! -f "$KERNEL_SOURCE/include/linux/version.h" ]; then ++ echo "" ++ echo "" ++ echo "The file $KERNEL_SOURCE/Makefile or $KERNEL_SOURCE/include/linux/version.h is missing!" ++ echo "Perhaps your kernel source is broken?" ++ echo "" ++ echo "" ++ exit 1 + fi +-if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ] +-then +- echo "Unable to determine version for kernel headers" +- echo -e "\tprovided in directory $KERNEL_SOURCE" +- exit 1 ++if [ ! -d "$KERNEL_SOURCE" ]; then ++ echo "" ++ echo "" ++ echo "$KERNEL_SOURCE is not a directory" ++ echo "" ++ echo "" ++ exit 1 + fi + +-if [ "$MAKE_IS_SILENT" != "y" ]; then +-echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION}" +-echo -e "\n" +-echo "Using kernel headers from $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION} for architecture '$TARGET_ARCH'" +-echo -e "\tprovided in directory $KERNEL_SOURCE" +-echo -e "\n" +-fi + ++# + # Create a symlink to include/asm +- ++# + rm -f include/asm* + if [ ! -d "$KERNEL_SOURCE/include/asm" ]; then +- echo ""; +- echo ""; +- echo "The symlink $KERNEL_SOURCE/include/asm is missing\!"; +- echo "Perhaps you forgot to configure your kernel source?"; +- echo "You really should configure your kernel source tree so I"; +- echo "do not have to try and guess about this sort of thing."; +- echo "" +- echo "Attempting to guess a usable value...."; +- echo "" +- echo ""; +- sleep 1; +- +- if [ "$TARGET_ARCH" = "powerpc" ];then +- set -x; +- ln -fs $KERNEL_SOURCE/include/asm-ppc include/asm; +- set +x; +- elif [ "$TARGET_ARCH" = "mips" ];then +- set -x; +- ln -fs $KERNEL_SOURCE/include/asm-mips include/asm; +- set +x; +- elif [ "$TARGET_ARCH" = "arm" ];then +- set -x; +- ln -fs $KERNEL_SOURCE/include/asm-arm include/asm; +- set +x; +- if [ ! -L $KERNEL_SOURCE/include/asm-arm/proc ] ; then +- if [ ! -L proc ] ; then +- (cd include/asm; +- ln -fs proc-armv proc; +- ln -fs arch-ebsa285 arch); +- fi ++ echo "" ++ echo "" ++ echo "The symlink $KERNEL_SOURCE/include/asm is missing\!" ++ echo "Perhaps you forgot to configure your kernel source?" ++ echo "You really should configure your kernel source tree so I" ++ echo "do not have to try and guess about this sort of thing." ++ echo "" ++ echo "Attempting to guess a usable value...." ++ echo "" ++ echo "" ++ sleep 1 ++ ++ if [ "$TARGET_ARCH" = "powerpc" ]; then ++ set -x ++ ln -fs $KERNEL_SOURCE/include/asm-ppc include/asm ++ set +x ++ elif [ "$TARGET_ARCH" = "mips" ]; then ++ set -x ++ ln -fs $KERNEL_SOURCE/include/asm-mips include/asm ++ set +x ++ elif [ "$TARGET_ARCH" = "arm" ]; then ++ set -x ++ ln -fs $KERNEL_SOURCE/include/asm-arm include/asm ++ set +x ++ if [ ! -L $KERNEL_SOURCE/include/asm-arm/proc ]; then ++ if [ ! -L proc ]; then ++ ( ++ cd include/asm ++ ln -fs proc-armv proc ++ ln -fs arch-ebsa285 arch ++ ) ++ fi ++ fi ++ elif [ "$TARGET_ARCH" = "cris" ]; then ++ set -x ++ ln -fs $KERNEL_SOURCE/include/asm-cris include/asm ++ set +x ++ elif [ "$HAS_MMU" != "y" ]; then ++ if [ -d $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu ]; then ++ set -x ++ ln -fs $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu include/asm ++ set +x ++ else ++ set -x ++ ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm ++ set +x ++ fi ++ else ++ set -x ++ ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm ++ set +x + fi; +- elif [ "$TARGET_ARCH" = "cris" ]; then +- set -x; +- ln -fs $KERNEL_SOURCE/include/asm-cris include/asm; +- set +x; +- elif [ "$HAS_MMU" != "y" ]; then +- if [ -d $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu ] ; then +- set -x; +- ln -fs $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu include/asm; +- set +x; +- else +- set -x; +- ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm; +- set +x; +- fi; +- else +- set -x; +- ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm; +- set +x; +- fi; + else +-# No guessing required..... +-ln -fs $KERNEL_SOURCE/include/asm include/asm +-if [ -e $KERNEL_SOURCE/include/asm-$TARGET_ARCH ] ; then +-ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm-$TARGET_ARCH ++ # No guessing required..... ++ for x in $KERNEL_SOURCE/include/asm* ; do ++ ln -fs ${x} include/ ++ done + fi +-fi; + + ++# + # Annoyingly, 2.6.x kernel headers also need an include/asm-generic/ directory +-if [ $VERSION -eq 2 ] && [ $PATCHLEVEL -ge 6 ] ; then +- ln -fs $KERNEL_SOURCE/include/asm-generic include/asm-generic +-fi; ++# ++if [ -e $KERNEL_SOURCE/include/asm-generic ]; then ++ rm -f include/asm-generic ++ ln -fs $KERNEL_SOURCE/include/asm-generic include/asm-generic ++fi + + ++# + # Create the include/linux symlink. ++# + rm -f include/linux + ln -fs $KERNEL_SOURCE/include/linux include/linux +- diff --git a/patches/uClibc/0.9.28/150-custom-ISA.patch b/patches/uClibc/0.9.28/150-custom-ISA.patch new file mode 100644 index 0000000..2cc9bcb --- /dev/null +++ b/patches/uClibc/0.9.28/150-custom-ISA.patch @@ -0,0 +1,31 @@ +diff -dur uClibc-0.9.28.orig/Rules.mak uClibc-0.9.28/Rules.mak +--- uClibc-0.9.28.orig/Rules.mak 2005-08-18 00:49:49.000000000 +0200 ++++ uClibc-0.9.28/Rules.mak 2007-01-30 10:53:34.000000000 +0100 +@@ -168,6 +168,7 @@ + CPU_CFLAGS-$(CONFIG_MIPS_ISA_4)+=-mips4 -mtune=mips4 + CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS32)+=-mips32 -mtune=mips32 + CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS64)+=-mips64 -mtune=mips32 ++ CPU_CFLAGS-$(CONFIG_MIPS_ISA_CUSTOM)+=-march=$(CONFIG_MIPS_CPU_CFLAGS_CUSTOM) + endif + + ifeq ($(strip $(TARGET_ARCH)),sh) +diff -dur uClibc-0.9.28.orig/extra/Configs/Config.mips uClibc-0.9.28/extra/Configs/Config.mips +--- uClibc-0.9.28.orig/extra/Configs/Config.mips 2005-08-18 00:49:41.000000000 +0200 ++++ uClibc-0.9.28/extra/Configs/Config.mips 2007-01-30 10:52:12.000000000 +0100 +@@ -63,4 +63,16 @@ + config CONFIG_MIPS_ISA_MIPS64 + bool "MIPS64" + ++config CONFIG_MIPS_ISA_CUSTOM ++ bool "Custom" ++ + endchoice ++ ++config CONFIG_MIPS_CPU_CFLAGS_CUSTOM ++ string ++ prompt "Custon ISA" ++ depends on CONFIG_MIPS_ISA_CUSTOM ++ default "" ++ help ++ Enter your custom ISA here (eg: lx4189!). ++ diff --git a/patches/uClibc/0.9.28/160-mips-asm.h.patch b/patches/uClibc/0.9.28/160-mips-asm.h.patch new file mode 100644 index 0000000..285feed --- /dev/null +++ b/patches/uClibc/0.9.28/160-mips-asm.h.patch @@ -0,0 +1,41 @@ +diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/clone.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/clone.S +--- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/clone.S 2007-02-07 11:18:12.000000000 +0100 ++++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/clone.S 2007-02-07 10:41:34.000000000 +0100 +@@ -24,7 +24,7 @@ + #include + #define _ERRNO_H 1 + #include +-#include ++#include + + /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */ + +diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/pipe.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/pipe.S +--- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/pipe.S 2007-02-07 11:18:12.000000000 +0100 ++++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/pipe.S 2007-02-07 11:16:52.000000000 +0100 +@@ -3,9 +3,9 @@ + /*see uClibc's sh/pipe.c and glibc-2.2.4's mips/pipe.S */ + + #include +-#include ++#include + #include +-#include ++#include + + .globl pipe + .ent pipe, 0 +diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/syscall.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/syscall.S +--- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/syscall.S 2007-02-07 11:18:12.000000000 +0100 ++++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/syscall.S 2007-02-07 11:17:03.000000000 +0100 +@@ -17,8 +17,8 @@ + 02111-1307 USA. */ + + #include +-#include +-#include ++#include ++#include + + #ifdef __PIC__ + .option pic2 diff --git a/patches/uClibc/0.9.28/200-custom-ISA.patch b/patches/uClibc/0.9.28/200-custom-ISA.patch deleted file mode 100644 index 2cc9bcb..0000000 --- a/patches/uClibc/0.9.28/200-custom-ISA.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff -dur uClibc-0.9.28.orig/Rules.mak uClibc-0.9.28/Rules.mak ---- uClibc-0.9.28.orig/Rules.mak 2005-08-18 00:49:49.000000000 +0200 -+++ uClibc-0.9.28/Rules.mak 2007-01-30 10:53:34.000000000 +0100 -@@ -168,6 +168,7 @@ - CPU_CFLAGS-$(CONFIG_MIPS_ISA_4)+=-mips4 -mtune=mips4 - CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS32)+=-mips32 -mtune=mips32 - CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS64)+=-mips64 -mtune=mips32 -+ CPU_CFLAGS-$(CONFIG_MIPS_ISA_CUSTOM)+=-march=$(CONFIG_MIPS_CPU_CFLAGS_CUSTOM) - endif - - ifeq ($(strip $(TARGET_ARCH)),sh) -diff -dur uClibc-0.9.28.orig/extra/Configs/Config.mips uClibc-0.9.28/extra/Configs/Config.mips ---- uClibc-0.9.28.orig/extra/Configs/Config.mips 2005-08-18 00:49:41.000000000 +0200 -+++ uClibc-0.9.28/extra/Configs/Config.mips 2007-01-30 10:52:12.000000000 +0100 -@@ -63,4 +63,16 @@ - config CONFIG_MIPS_ISA_MIPS64 - bool "MIPS64" - -+config CONFIG_MIPS_ISA_CUSTOM -+ bool "Custom" -+ - endchoice -+ -+config CONFIG_MIPS_CPU_CFLAGS_CUSTOM -+ string -+ prompt "Custon ISA" -+ depends on CONFIG_MIPS_ISA_CUSTOM -+ default "" -+ help -+ Enter your custom ISA here (eg: lx4189!). -+ diff --git a/patches/uClibc/0.9.28/201-mips-asm.h.patch b/patches/uClibc/0.9.28/201-mips-asm.h.patch deleted file mode 100644 index 285feed..0000000 --- a/patches/uClibc/0.9.28/201-mips-asm.h.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/clone.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/clone.S ---- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/clone.S 2007-02-07 11:18:12.000000000 +0100 -+++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/clone.S 2007-02-07 10:41:34.000000000 +0100 -@@ -24,7 +24,7 @@ - #include - #define _ERRNO_H 1 - #include --#include -+#include - - /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */ - -diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/pipe.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/pipe.S ---- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/pipe.S 2007-02-07 11:18:12.000000000 +0100 -+++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/pipe.S 2007-02-07 11:16:52.000000000 +0100 -@@ -3,9 +3,9 @@ - /*see uClibc's sh/pipe.c and glibc-2.2.4's mips/pipe.S */ - - #include --#include -+#include - #include --#include -+#include - - .globl pipe - .ent pipe, 0 -diff -dur uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/syscall.S uClibc-0.9.28.1/libc/sysdeps/linux/mips/syscall.S ---- uClibc-0.9.28.1.orig/libc/sysdeps/linux/mips/syscall.S 2007-02-07 11:18:12.000000000 +0100 -+++ uClibc-0.9.28.1/libc/sysdeps/linux/mips/syscall.S 2007-02-07 11:17:03.000000000 +0100 -@@ -17,8 +17,8 @@ - 02111-1307 USA. */ - - #include --#include --#include -+#include -+#include - - #ifdef __PIC__ - .option pic2 diff --git a/patches/uClibc/0.9.29/000-fix-mmap.patch b/patches/uClibc/0.9.29/000-fix-mmap.patch deleted file mode 100644 index 4775e8c..0000000 --- a/patches/uClibc/0.9.29/000-fix-mmap.patch +++ /dev/null @@ -1,91 +0,0 @@ ---- uClibc-0.9.29.oorig/test/mmap/mmap2.c (revision 0) -+++ uClibc-0.9.29/test/mmap/mmap2.c (revision 18616) -@@ -0,0 +1,41 @@ -+/* When trying to map /dev/mem with offset 0xFFFFF000 on the ARM platform, mmap -+ * returns -EOVERFLOW. -+ * -+ * Since off_t is defined as a long int and the sign bit is set in the address, -+ * the shift operation shifts in ones instead of zeroes -+ * from the left. This results the offset sent to the kernel function becomes -+ * 0xFFFFFFFF instead of 0x000FFFFF with MMAP2_PAGE_SHIFT set to 12. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define FATAL do { fprintf(stderr, "Error at line %d, file %s (%d) [%s]\n", \ -+ __LINE__, __FILE__, errno, strerror(errno)); exit(1); } while(0) -+ -+#define MAP_SIZE 4096UL -+#define MAP_MASK (MAP_SIZE - 1) -+ -+int main(int argc, char **argv) { -+ void* map_base = 0; -+ int fd; -+ off_t target = 0xfffff000; -+ if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) FATAL; -+ printf("/dev/mem opened.\n"); -+ fflush(stdout); -+ -+ /* Map one page */ -+ map_base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, -+ fd, target & ~MAP_MASK); -+ if(map_base == (void *) -1) FATAL; -+ printf("Memory mapped at address %p.\n", map_base); -+ fflush(stdout); -+ if(munmap(map_base, MAP_SIZE) == -1) FATAL; -+ close(fd); -+ return 0; -+} ---- uClibc-0.9.29.oorig/libc/sysdeps/linux/arm/mmap.c (revision 18615) -+++ uClibc-0.9.29/libc/sysdeps/linux/arm/mmap.c (revision 18616) -@@ -27,7 +27,6 @@ __ptr_t mmap(__ptr_t addr, size_t len, i - - #elif defined (__NR_mmap2) - #define __NR__mmap __NR_mmap2 -- - #ifndef MMAP2_PAGE_SHIFT - # define MMAP2_PAGE_SHIFT 12 - #endif -@@ -39,9 +38,17 @@ __ptr_t mmap(__ptr_t addr, size_t len, i - { - /* check if offset is page aligned */ - if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) -+ { -+ __set_errno(EINVAL); - return MAP_FAILED; -+ } -+#ifdef __USE_FILE_OFFSET64 -+ return (__ptr_t) _mmap (addr, len, prot, flags, -+ fd,((__u_quad_t) offset >> MMAP2_PAGE_SHIFT)); -+#else - return (__ptr_t) _mmap (addr, len, prot, flags, -- fd,(off_t) (offset >> MMAP2_PAGE_SHIFT)); -+ fd,((__u_long) offset >> MMAP2_PAGE_SHIFT)); -+#endif - } - #elif defined (__NR_mmap) - # define __NR__mmap __NR_mmap ---- uClibc-0.9.29.oorig/libc/sysdeps/linux/common/mmap64.c (revision 18615) -+++ uClibc-0.9.29/libc/sysdeps/linux/common/mmap64.c (revision 18616) -@@ -58,8 +58,13 @@ __ptr_t mmap64(__ptr_t addr, size_t len, - __set_errno(EINVAL); - return MAP_FAILED; - } -- -- return __syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT)); -+#ifdef __USE_FILE_OFFSET64 -+ return __syscall_mmap2(addr, len, prot, flags, -+ fd,((__u_quad_t)offset >> MMAP2_PAGE_SHIFT)); -+#else -+ return __syscall_mmap2(addr, len, prot, flags, -+ fd,((__u_long)offset >> MMAP2_PAGE_SHIFT)); -+#endif - } - - # endif diff --git a/patches/uClibc/0.9.29/100-conditional-sched_affinity.patch b/patches/uClibc/0.9.29/100-conditional-sched_affinity.patch deleted file mode 100644 index 509c42a..0000000 --- a/patches/uClibc/0.9.29/100-conditional-sched_affinity.patch +++ /dev/null @@ -1,53 +0,0 @@ -diff -ur uClibc-0.9.29/libc/sysdeps/linux/common/sched_getaffinity.c uClibc-0.9.29-patched/libc/sysdeps/linux/common/sched_getaffinity.c ---- uClibc-0.9.29/libc/sysdeps/linux/common/sched_getaffinity.c 2007-02-12 16:52:32.000000000 -0600 -+++ uClibc-0.9.29-patched/libc/sysdeps/linux/common/sched_getaffinity.c 2007-05-09 18:05:09.397411811 -0500 -@@ -29,6 +29,7 @@ - #include - #include - -+#ifdef __NR_sched_getaffinity - libc_hidden_proto(memset) - - #define __NR___syscall_sched_getaffinity __NR_sched_getaffinity -@@ -48,5 +49,15 @@ - } - return res; - } -+#else -+/* -+int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *cpuset) -+{ -+ __set_errno(ENOSYS); -+ return -1; -+} -+*/ - #endif - #endif -+ -+#endif -diff -ur uClibc-0.9.29/libc/sysdeps/linux/common/sched_setaffinity.c uClibc-0.9.29-patched/libc/sysdeps/linux/common/sched_setaffinity.c ---- uClibc-0.9.29/libc/sysdeps/linux/common/sched_setaffinity.c 2007-02-12 16:52:32.000000000 -0600 -+++ uClibc-0.9.29-patched/libc/sysdeps/linux/common/sched_setaffinity.c 2007-05-09 18:05:09.397411811 -0500 -@@ -31,6 +31,7 @@ - #include - #include - -+#ifdef __NR_sched_setaffinity - libc_hidden_proto(getpid) - - #define __NR___syscall_sched_setaffinity __NR_sched_setaffinity -@@ -74,5 +75,14 @@ - - return INLINE_SYSCALL (sched_setaffinity, 3, pid, cpusetsize, cpuset); - } -+#else -+/* -+int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset) -+{ -+ __set_errno(ENOSYS); -+ return -1; -+} -+*/ -+#endif - #endif - #endif diff --git a/patches/uClibc/0.9.29/100-fix-mmap.patch b/patches/uClibc/0.9.29/100-fix-mmap.patch new file mode 100644 index 0000000..4775e8c --- /dev/null +++ b/patches/uClibc/0.9.29/100-fix-mmap.patch @@ -0,0 +1,91 @@ +--- uClibc-0.9.29.oorig/test/mmap/mmap2.c (revision 0) ++++ uClibc-0.9.29/test/mmap/mmap2.c (revision 18616) +@@ -0,0 +1,41 @@ ++/* When trying to map /dev/mem with offset 0xFFFFF000 on the ARM platform, mmap ++ * returns -EOVERFLOW. ++ * ++ * Since off_t is defined as a long int and the sign bit is set in the address, ++ * the shift operation shifts in ones instead of zeroes ++ * from the left. This results the offset sent to the kernel function becomes ++ * 0xFFFFFFFF instead of 0x000FFFFF with MMAP2_PAGE_SHIFT set to 12. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define FATAL do { fprintf(stderr, "Error at line %d, file %s (%d) [%s]\n", \ ++ __LINE__, __FILE__, errno, strerror(errno)); exit(1); } while(0) ++ ++#define MAP_SIZE 4096UL ++#define MAP_MASK (MAP_SIZE - 1) ++ ++int main(int argc, char **argv) { ++ void* map_base = 0; ++ int fd; ++ off_t target = 0xfffff000; ++ if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) FATAL; ++ printf("/dev/mem opened.\n"); ++ fflush(stdout); ++ ++ /* Map one page */ ++ map_base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, ++ fd, target & ~MAP_MASK); ++ if(map_base == (void *) -1) FATAL; ++ printf("Memory mapped at address %p.\n", map_base); ++ fflush(stdout); ++ if(munmap(map_base, MAP_SIZE) == -1) FATAL; ++ close(fd); ++ return 0; ++} +--- uClibc-0.9.29.oorig/libc/sysdeps/linux/arm/mmap.c (revision 18615) ++++ uClibc-0.9.29/libc/sysdeps/linux/arm/mmap.c (revision 18616) +@@ -27,7 +27,6 @@ __ptr_t mmap(__ptr_t addr, size_t len, i + + #elif defined (__NR_mmap2) + #define __NR__mmap __NR_mmap2 +- + #ifndef MMAP2_PAGE_SHIFT + # define MMAP2_PAGE_SHIFT 12 + #endif +@@ -39,9 +38,17 @@ __ptr_t mmap(__ptr_t addr, size_t len, i + { + /* check if offset is page aligned */ + if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) ++ { ++ __set_errno(EINVAL); + return MAP_FAILED; ++ } ++#ifdef __USE_FILE_OFFSET64 ++ return (__ptr_t) _mmap (addr, len, prot, flags, ++ fd,((__u_quad_t) offset >> MMAP2_PAGE_SHIFT)); ++#else + return (__ptr_t) _mmap (addr, len, prot, flags, +- fd,(off_t) (offset >> MMAP2_PAGE_SHIFT)); ++ fd,((__u_long) offset >> MMAP2_PAGE_SHIFT)); ++#endif + } + #elif defined (__NR_mmap) + # define __NR__mmap __NR_mmap +--- uClibc-0.9.29.oorig/libc/sysdeps/linux/common/mmap64.c (revision 18615) ++++ uClibc-0.9.29/libc/sysdeps/linux/common/mmap64.c (revision 18616) +@@ -58,8 +58,13 @@ __ptr_t mmap64(__ptr_t addr, size_t len, + __set_errno(EINVAL); + return MAP_FAILED; + } +- +- return __syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT)); ++#ifdef __USE_FILE_OFFSET64 ++ return __syscall_mmap2(addr, len, prot, flags, ++ fd,((__u_quad_t)offset >> MMAP2_PAGE_SHIFT)); ++#else ++ return __syscall_mmap2(addr, len, prot, flags, ++ fd,((__u_long)offset >> MMAP2_PAGE_SHIFT)); ++#endif + } + + # endif diff --git a/patches/uClibc/0.9.29/110-conditional-sched_affinity.patch b/patches/uClibc/0.9.29/110-conditional-sched_affinity.patch new file mode 100644 index 0000000..509c42a --- /dev/null +++ b/patches/uClibc/0.9.29/110-conditional-sched_affinity.patch @@ -0,0 +1,53 @@ +diff -ur uClibc-0.9.29/libc/sysdeps/linux/common/sched_getaffinity.c uClibc-0.9.29-patched/libc/sysdeps/linux/common/sched_getaffinity.c +--- uClibc-0.9.29/libc/sysdeps/linux/common/sched_getaffinity.c 2007-02-12 16:52:32.000000000 -0600 ++++ uClibc-0.9.29-patched/libc/sysdeps/linux/common/sched_getaffinity.c 2007-05-09 18:05:09.397411811 -0500 +@@ -29,6 +29,7 @@ + #include + #include + ++#ifdef __NR_sched_getaffinity + libc_hidden_proto(memset) + + #define __NR___syscall_sched_getaffinity __NR_sched_getaffinity +@@ -48,5 +49,15 @@ + } + return res; + } ++#else ++/* ++int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *cpuset) ++{ ++ __set_errno(ENOSYS); ++ return -1; ++} ++*/ + #endif + #endif ++ ++#endif +diff -ur uClibc-0.9.29/libc/sysdeps/linux/common/sched_setaffinity.c uClibc-0.9.29-patched/libc/sysdeps/linux/common/sched_setaffinity.c +--- uClibc-0.9.29/libc/sysdeps/linux/common/sched_setaffinity.c 2007-02-12 16:52:32.000000000 -0600 ++++ uClibc-0.9.29-patched/libc/sysdeps/linux/common/sched_setaffinity.c 2007-05-09 18:05:09.397411811 -0500 +@@ -31,6 +31,7 @@ + #include + #include + ++#ifdef __NR_sched_setaffinity + libc_hidden_proto(getpid) + + #define __NR___syscall_sched_setaffinity __NR_sched_setaffinity +@@ -74,5 +75,14 @@ + + return INLINE_SYSCALL (sched_setaffinity, 3, pid, cpusetsize, cpuset); + } ++#else ++/* ++int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset) ++{ ++ __set_errno(ENOSYS); ++ return -1; ++} ++*/ ++#endif + #endif + #endif diff --git a/patches/uClibc/0.9.29/120-fix-internal_function-definition.patch b/patches/uClibc/0.9.29/120-fix-internal_function-definition.patch new file mode 100644 index 0000000..9b88d82 --- /dev/null +++ b/patches/uClibc/0.9.29/120-fix-internal_function-definition.patch @@ -0,0 +1,51 @@ +Index: uClibc/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h +=================================================================== +--- uClibc/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h (revision 18898) ++++ uClibc/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h (working copy) +@@ -42,6 +42,8 @@ + /* define if target supports IEEE signed zero floats */ + #define __UCLIBC_HAVE_SIGNED_ZERO__ + ++#if defined _LIBC + #define internal_function __attribute__ ((regparm (3), stdcall)) ++#endif + + #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ +Index: uClibc/include/libc-symbols.h +=================================================================== +--- uClibc/include/libc-symbols.h (revision 18898) ++++ uClibc/include/libc-symbols.h (working copy) +@@ -22,6 +22,16 @@ + #ifndef _LIBC_SYMBOLS_H + #define _LIBC_SYMBOLS_H 1 + ++/* This is defined for the compilation of all C library code. features.h ++ tests this to avoid inclusion of stubs.h while compiling the library, ++ before stubs.h has been generated. Some library code that is shared ++ with other packages also tests this symbol to see if it is being ++ compiled as part of the C library. We must define this before including ++ config.h, because it makes some definitions conditional on whether libc ++ itself is being compiled, or just some generator program. */ ++#define _LIBC 1 ++ ++ + /* This file's macros are included implicitly in the compilation of every + file in the C library by -imacros. + +@@ -40,16 +50,6 @@ + + #include + +- +-/* This is defined for the compilation of all C library code. features.h +- tests this to avoid inclusion of stubs.h while compiling the library, +- before stubs.h has been generated. Some library code that is shared +- with other packages also tests this symbol to see if it is being +- compiled as part of the C library. We must define this before including +- config.h, because it makes some definitions conditional on whether libc +- itself is being compiled, or just some generator program. */ +-#define _LIBC 1 +- + /* Enable declarations of GNU extensions, since we are compiling them. */ + #define _GNU_SOURCE 1 + diff --git a/patches/uClibc/0.9.29/130-fix-gethostent_r-failure-retval.patch b/patches/uClibc/0.9.29/130-fix-gethostent_r-failure-retval.patch new file mode 100644 index 0000000..7b246c1 --- /dev/null +++ b/patches/uClibc/0.9.29/130-fix-gethostent_r-failure-retval.patch @@ -0,0 +1,12 @@ +diff -ur uClibc-0.9.29/libc/inet/resolv.c uClibc-0.9.29-patched/libc/inet/resolv.c +--- uClibc-0.9.29/libc/inet/resolv.c 2007-04-23 12:01:05.000000000 -0500 ++++ uClibc-0.9.29-patched/libc/inet/resolv.c 2007-05-09 18:05:33.563404419 -0500 +@@ -1700,7 +1700,7 @@ + int gethostent_r(struct hostent *result_buf, char *buf, size_t buflen, + struct hostent **result, int *h_errnop) + { +- int ret; ++ int ret = HOST_NOT_FOUND; + + __UCLIBC_MUTEX_LOCK(mylock); + if (__gethostent_fp == NULL) { diff --git a/patches/uClibc/0.9.29/140-bits_sysnum_h.patch b/patches/uClibc/0.9.29/140-bits_sysnum_h.patch new file mode 100644 index 0000000..595a22e --- /dev/null +++ b/patches/uClibc/0.9.29/140-bits_sysnum_h.patch @@ -0,0 +1,33 @@ +YEM-20070519: +bits/sysnum.h needs a cross compiler to be built. Fortunately, this +header is not needed to build gcc. Move generation of this header. + +Index: uClibc/Makefile.in +=================================================================== +--- uClibc/Makefile.in (revision 18651) ++++ uClibc/Makefile.in (working copy) +@@ -91,6 +91,11 @@ + $(LN) -fs $$i .; \ + done; \ + fi ++ifeq ($(UCLIBC_HAS_LOCALE),y) ++ $(MAKE) locale_headers ++endif ++ ++pregen: headers + $(Q)\ + set -e; \ + cd $(top_builddir); \ +@@ -102,12 +107,7 @@ + else \ + mv -f $$tmp include/bits/sysnum.h; \ + fi +-ifeq ($(UCLIBC_HAS_LOCALE),y) +- $(MAKE) locale_headers +-endif + +-pregen: headers +- + install: install_runtime install_dev + + diff --git a/patches/uClibc/0.9.29/150-bits_sysnum_h2.patch b/patches/uClibc/0.9.29/150-bits_sysnum_h2.patch new file mode 100644 index 0000000..d650d8d --- /dev/null +++ b/patches/uClibc/0.9.29/150-bits_sysnum_h2.patch @@ -0,0 +1,18 @@ +YEM-20070519: +Patch from Bernhard Fischer on the uClibc mailing +list ( http://www.uclibc.org/lists/uclibc/2008-January/018940.html ) above +the 400-bits_sysnum_h.patch. + +Index: uClibc/Makefile.in +=================================================================== +--- uClibc/Makefile.in (revision 18651) ++++ uClibc/Makefile.in (working copy) +@@ -114,7 +116,7 @@ install: install_runtime install_dev + RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell $(top_srcdir)extra/scripts/relative_path.sh $(DEVEL_PREFIX)lib $(RUNTIME_PREFIX)lib) + + # Installs header files. +-install_headers: ++install_headers: headers + $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include + printf ".svn\n.cvsignore\nCVS\n" > tar_exclude ; \ + $(TAR) -chf - -X tar_exclude include \ diff --git a/patches/uClibc/0.9.29/160-custom-ISA.patch b/patches/uClibc/0.9.29/160-custom-ISA.patch new file mode 100644 index 0000000..51993ee --- /dev/null +++ b/patches/uClibc/0.9.29/160-custom-ISA.patch @@ -0,0 +1,31 @@ +diff -dur uClibc-0.9.29.orig/extra/Configs/Config.mips uClibc-0.9.29/extra/Configs/Config.mips +--- uClibc-0.9.29.orig/extra/Configs/Config.mips 2007-03-16 20:38:14.000000000 +0100 ++++ uClibc-0.9.29/extra/Configs/Config.mips 2007-05-22 19:30:43.000000000 +0200 +@@ -71,4 +71,16 @@ + config CONFIG_MIPS_ISA_MIPS64 + bool "MIPS64" + ++config CONFIG_MIPS_ISA_CUSTOM ++ bool "Custom" ++ + endchoice ++ ++config CONFIG_MIPS_CPU_CFLAGS_CUSTOM ++ string ++ prompt "Custon ISA" ++ depends on CONFIG_MIPS_ISA_CUSTOM ++ default "" ++ help ++ Enter your custom ISA here (eg: lx4189!). ++ +diff -dur uClibc-0.9.29.orig/Rules.mak uClibc-0.9.29/Rules.mak +--- uClibc-0.9.29.orig/Rules.mak 2007-04-17 15:34:11.000000000 +0200 ++++ uClibc-0.9.29/Rules.mak 2007-05-22 19:31:48.000000000 +0200 +@@ -234,6 +234,7 @@ + CPU_CFLAGS-$(CONFIG_MIPS_N64_ABI)+=-mabi=64 + CPU_CFLAGS-$(CONFIG_MIPS_O32_ABI)+=-mabi=32 + CPU_CFLAGS-$(CONFIG_MIPS_N32_ABI)+=-mabi=n32 ++ CPU_CFLAGS-$(CONFIG_MIPS_ISA_CUSTOM)+=-march=$(CONFIG_MIPS_CPU_CFLAGS_CUSTOM) + endif + + ifeq ($(TARGET_ARCH),nios) diff --git a/patches/uClibc/0.9.29/170-filter-gnu99-from-assembly-flags.patch b/patches/uClibc/0.9.29/170-filter-gnu99-from-assembly-flags.patch new file mode 100644 index 0000000..d1a7e3a --- /dev/null +++ b/patches/uClibc/0.9.29/170-filter-gnu99-from-assembly-flags.patch @@ -0,0 +1,12 @@ +diff -ur uClibc-0.9.29/Makerules uClibc-0.9.29-patched/Makerules +--- uClibc-0.9.29/Makerules 2006-12-10 18:25:23.000000000 -0600 ++++ uClibc-0.9.29-patched/Makerules 2008-01-26 17:04:50.965699518 -0600 +@@ -96,7 +96,7 @@ + disp_ld = $($(DISP)_disp_ld) + + cmd_compile.c = $(CC) -c $< -o $@ $(CFLAGS) $(ARCH_CFLAGS) $(CFLAGS-$(suffix $@)) $(filter-out $(CFLAGS-OMIT-$(notdir $<)),$(CFLAGS-$(notdir $(^D)))) $(CFLAGS-$(subst $(top_srcdir),,$(dir $<))) $(CFLAGS-$(notdir $<)) $(CFLAGS-$(notdir $@)) +-cmd_compile.S = $(cmd_compile.c) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@)) ++cmd_compile.S = $(filter-out -std=gnu99, $(cmd_compile.c)) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@)) + cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@)) + cmd_compile-m = $(CC) $^ -c -o $@ $(CFLAGS) $(ARCH_CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(notdir $(@D))) $(CFLAGS-$(notdir $@)) + cmd_strip = $(STRIPTOOL) $(STRIP_FLAGS) $^ diff --git a/patches/uClibc/0.9.29/180-linuxthreads.patch b/patches/uClibc/0.9.29/180-linuxthreads.patch new file mode 100644 index 0000000..8ce2439 --- /dev/null +++ b/patches/uClibc/0.9.29/180-linuxthreads.patch @@ -0,0 +1,145 @@ +--- a/libpthread/linuxthreads.old/attr.c 2006-01-24 12:41:01.000000000 -0500 ++++ b/libpthread/linuxthreads.old/attr.c 2008-02-10 11:35:32.000000000 -0500 +@@ -25,6 +25,14 @@ + #include "pthread.h" + #include "internals.h" + ++#include ++#include ++#include ++#include ++#include ++#include ++ ++ + /* NOTE: With uClibc I don't think we need this versioning stuff. + * Therefore, define the function pthread_attr_init() here using + * a strong symbol. */ +@@ -209,4 +217,94 @@ int __pthread_attr_getstacksize(const pt + *stacksize = attr->__stacksize; + return 0; + } ++ ++ ++extern int *__libc_stack_end; ++ + weak_alias (__pthread_attr_getstacksize, pthread_attr_getstacksize) ++void* pthread_getattr_np(pthread_t thread, pthread_attr_t *attr) ++{ ++ static void *stackBase = 0; ++ static size_t stackSize = 0; ++ int ret = 0; ++ /* Stack size limit. */ ++ struct rlimit rl; ++ ++ /* The safest way to get the top of the stack is to read ++ /proc/self/maps and locate the line into which ++ __libc_stack_end falls. */ ++ FILE *fp = fopen("/proc/self/maps", "rc"); ++ if (fp == NULL) ++ ret = errno; ++ /* We need the limit of the stack in any case. */ ++ else if (getrlimit (RLIMIT_STACK, &rl) != 0) ++ ret = errno; ++ else { ++ /* We need no locking. */ ++ __fsetlocking (fp, FSETLOCKING_BYCALLER); ++ ++ /* Until we found an entry (which should always be the case) ++ mark the result as a failure. */ ++ ret = ENOENT; ++ ++ char *line = NULL; ++ size_t linelen = 0; ++ uintptr_t last_to = 0; ++ ++ while (! feof_unlocked (fp)) { ++ if (getdelim (&line, &linelen, '\n', fp) <= 0) ++ break; ++ ++ uintptr_t from; ++ uintptr_t to; ++ if (sscanf (line, "%x-%x", &from, &to) != 2) ++ continue; ++ if (from <= (uintptr_t) __libc_stack_end ++ && (uintptr_t) __libc_stack_end < to) { ++ /* Found the entry. Now we have the info we need. */ ++ attr->__stacksize = rl.rlim_cur; ++#ifdef _STACK_GROWS_UP ++ /* Don't check to enforce a limit on the __stacksize */ ++ attr->__stackaddr = (void *) from; ++#else ++ attr->__stackaddr = (void *) to; ++ ++ /* The limit might be too high. */ ++ if ((size_t) attr->__stacksize > (size_t) attr->__stackaddr - last_to) ++ attr->__stacksize = (size_t) attr->__stackaddr - last_to; ++#endif ++ ++ /* We succeed and no need to look further. */ ++ ret = 0; ++ break; ++ } ++ last_to = to; ++ } ++ ++ fclose (fp); ++ free (line); ++ } ++#ifndef _STACK_GROWS_UP ++ stackBase = (char *) attr->__stackaddr - attr->__stacksize; ++#else ++ stackBase = attr->__stackaddr; ++#endif ++ stackSize = attr->__stacksize; ++ return (void*)(stackBase + stackSize); ++} ++ ++int __pthread_attr_getstack (const pthread_attr_t *attr, void **stackaddr, ++ size_t *stacksize) ++{ ++ /* XXX This function has a stupid definition. The standard specifies ++ no error value but what is if no stack address was set? We simply ++ return the value we have in the member. */ ++#ifndef _STACK_GROWS_UP ++ *stackaddr = (char *) attr->__stackaddr - attr->__stacksize; ++#else ++ *stackaddr = attr->__stackaddr; ++#endif ++ *stacksize = attr->__stacksize; ++ return 0; ++} ++weak_alias (__pthread_attr_getstack, pthread_attr_getstack) + +--- a/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h 2006-12-07 22:19:36.000000000 -0500 ++++ b/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h 2008-02-10 11:42:35.000000000 -0500 +@@ -288,15 +288,11 @@ extern int pthread_attr_getstacksize (__ + __attr, size_t *__restrict __stacksize) + __THROW; + +-#if 0 +-/* Not yet implemented in uClibc! */ +- + #ifdef __USE_GNU + /* Initialize thread attribute *ATTR with attributes corresponding to the + already running thread TH. It shall be called on unitialized ATTR + and destroyed with pthread_attr_destroy when no longer needed. */ +-extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr) __THROW; +-#endif ++extern void* pthread_getattr_np(pthread_t thread, pthread_attr_t *attr); + #endif + + /* Functions for scheduling control. */ +@@ -599,6 +595,11 @@ extern int pthread_cancel (pthread_t __c + cancelled. */ + extern void pthread_testcancel (void); + ++/* Return the previously set address for the stack. */ ++extern int pthread_attr_getstack (__const pthread_attr_t *__restrict __attr, ++ void **__restrict __stackaddr, ++ size_t *__restrict __stacksize) __THROW; ++ + + /* Install a cleanup handler: ROUTINE will be called with arguments ARG + when the thread is cancelled or calls pthread_exit. ROUTINE will also + diff --git a/patches/uClibc/0.9.29/190-rm-whitespace.patch b/patches/uClibc/0.9.29/190-rm-whitespace.patch new file mode 100644 index 0000000..6004f91 --- /dev/null +++ b/patches/uClibc/0.9.29/190-rm-whitespace.patch @@ -0,0 +1,86 @@ +diff -urN uClibc-0.9.29-0rig/include/assert.h uClibc-0.9.29/include/assert.h +--- uClibc-0.9.29-0rig/include/assert.h 2005-11-03 23:42:46.000000000 +0100 ++++ uClibc-0.9.29/include/assert.h 2007-08-13 19:10:57.000000000 +0200 +@@ -31,7 +31,7 @@ + #define _ASSERT_H 1 + #include + +-#if defined __cplusplus && __GNUC_PREREQ (2,95) ++#if defined __cplusplus && __GNUC_PREREQ(2,95) + # define __ASSERT_VOID_CAST static_cast + #else + # define __ASSERT_VOID_CAST (void) +@@ -59,13 +59,17 @@ + (__ASSERT_VOID_CAST ((expr) ? 0 : \ + (__assert (__STRING(expr), __FILE__, __LINE__, \ + __ASSERT_FUNCTION), 0))) +- ++ ++/* Define some temporaries to workaround tinyx makedepend bug */ ++#define __GNUC_PREREQ_2_6 __GNUC_PREREQ(2, 6) ++#define __GNUC_PREREQ_2_4 __GNUC_PREREQ(2, 4) + /* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__' + which contains the name of the function currently being defined. + This is broken in G++ before version 2.6. + C9x has a similar variable called __func__, but prefer the GCC one since + it demangles C++ function names. */ +-# if defined __cplusplus ? __GNUC_PREREQ (2, 6) : __GNUC_PREREQ (2, 4) ++ ++# if defined __cplusplus ? __GNUC_PREREQ_2_6 : __GNUC_PREREQ_2_4 + # define __ASSERT_FUNCTION __PRETTY_FUNCTION__ + # else + # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +diff -urN uClibc-0.9.29-0rig/include/complex.h uClibc-0.9.29/include/complex.h +--- uClibc-0.9.29-0rig/include/complex.h 2002-05-09 10:15:21.000000000 +0200 ++++ uClibc-0.9.29/include/complex.h 2007-08-13 17:55:29.000000000 +0200 +@@ -33,7 +33,7 @@ + /* We might need to add support for more compilers here. But since ISO + C99 is out hopefully all maintained compilers will soon provide the data + types `float complex' and `double complex'. */ +-#if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (2, 97) ++#if __GNUC_PREREQ(2, 7) && !__GNUC_PREREQ(2, 97) + # define _Complex __complex__ + #endif + +diff -urN uClibc-0.9.29-0rig/include/features.h uClibc-0.9.29/include/features.h +--- uClibc-0.9.29-0rig/include/features.h 2006-11-29 22:10:04.000000000 +0100 ++++ uClibc-0.9.29/include/features.h 2007-08-13 17:55:51.000000000 +0200 +@@ -143,7 +143,7 @@ + + /* Convenience macros to test the versions of glibc and gcc. + Use them like this: +- #if __GNUC_PREREQ (2,8) ++ #if __GNUC_PREREQ(2,8) + ... code requiring gcc 2.8 or later ... + #endif + Note - they won't work for gcc1 or glibc1, since the _MINOR macros +@@ -297,7 +297,7 @@ + /* uClibc does not support _FORTIFY_SOURCE */ + #undef _FORTIFY_SOURCE + #if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 \ +- && __GNUC_PREREQ (4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0 ++ && __GNUC_PREREQ(4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0 + # if _FORTIFY_SOURCE > 1 + # define __USE_FORTIFY_LEVEL 2 + # else +@@ -366,7 +366,7 @@ + #endif /* !ASSEMBLER */ + + /* Decide whether we can define 'extern inline' functions in headers. */ +-#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \ ++#if __GNUC_PREREQ(2, 7) && defined __OPTIMIZE__ \ + && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ + # define __USE_EXTERN_INLINES 1 + #endif +diff -urN uClibc-0.9.29-0rig/include/tgmath.h uClibc-0.9.29/include/tgmath.h +--- uClibc-0.9.29-0rig/include/tgmath.h 2002-05-09 10:15:21.000000000 +0200 ++++ uClibc-0.9.29/include/tgmath.h 2007-08-13 17:56:17.000000000 +0200 +@@ -34,7 +34,7 @@ + do not try this for now and instead concentrate only on GNU CC. Once + we have more information support for other compilers might follow. */ + +-#if __GNUC_PREREQ (2, 7) ++#if __GNUC_PREREQ(2, 7) + + # ifdef __NO_LONG_DOUBLE_MATH + # define __tgml(fct) fct diff --git a/patches/uClibc/0.9.29/200-fix-internal_function-definition.patch b/patches/uClibc/0.9.29/200-fix-internal_function-definition.patch deleted file mode 100644 index 9b88d82..0000000 --- a/patches/uClibc/0.9.29/200-fix-internal_function-definition.patch +++ /dev/null @@ -1,51 +0,0 @@ -Index: uClibc/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h -=================================================================== ---- uClibc/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h (revision 18898) -+++ uClibc/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h (working copy) -@@ -42,6 +42,8 @@ - /* define if target supports IEEE signed zero floats */ - #define __UCLIBC_HAVE_SIGNED_ZERO__ - -+#if defined _LIBC - #define internal_function __attribute__ ((regparm (3), stdcall)) -+#endif - - #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ -Index: uClibc/include/libc-symbols.h -=================================================================== ---- uClibc/include/libc-symbols.h (revision 18898) -+++ uClibc/include/libc-symbols.h (working copy) -@@ -22,6 +22,16 @@ - #ifndef _LIBC_SYMBOLS_H - #define _LIBC_SYMBOLS_H 1 - -+/* This is defined for the compilation of all C library code. features.h -+ tests this to avoid inclusion of stubs.h while compiling the library, -+ before stubs.h has been generated. Some library code that is shared -+ with other packages also tests this symbol to see if it is being -+ compiled as part of the C library. We must define this before including -+ config.h, because it makes some definitions conditional on whether libc -+ itself is being compiled, or just some generator program. */ -+#define _LIBC 1 -+ -+ - /* This file's macros are included implicitly in the compilation of every - file in the C library by -imacros. - -@@ -40,16 +50,6 @@ - - #include - -- --/* This is defined for the compilation of all C library code. features.h -- tests this to avoid inclusion of stubs.h while compiling the library, -- before stubs.h has been generated. Some library code that is shared -- with other packages also tests this symbol to see if it is being -- compiled as part of the C library. We must define this before including -- config.h, because it makes some definitions conditional on whether libc -- itself is being compiled, or just some generator program. */ --#define _LIBC 1 -- - /* Enable declarations of GNU extensions, since we are compiling them. */ - #define _GNU_SOURCE 1 - diff --git a/patches/uClibc/0.9.29/300-fix-gethostent_r-failure-retval.patch b/patches/uClibc/0.9.29/300-fix-gethostent_r-failure-retval.patch deleted file mode 100644 index 7b246c1..0000000 --- a/patches/uClibc/0.9.29/300-fix-gethostent_r-failure-retval.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ur uClibc-0.9.29/libc/inet/resolv.c uClibc-0.9.29-patched/libc/inet/resolv.c ---- uClibc-0.9.29/libc/inet/resolv.c 2007-04-23 12:01:05.000000000 -0500 -+++ uClibc-0.9.29-patched/libc/inet/resolv.c 2007-05-09 18:05:33.563404419 -0500 -@@ -1700,7 +1700,7 @@ - int gethostent_r(struct hostent *result_buf, char *buf, size_t buflen, - struct hostent **result, int *h_errnop) - { -- int ret; -+ int ret = HOST_NOT_FOUND; - - __UCLIBC_MUTEX_LOCK(mylock); - if (__gethostent_fp == NULL) { diff --git a/patches/uClibc/0.9.29/400-bits_sysnum_h.patch b/patches/uClibc/0.9.29/400-bits_sysnum_h.patch deleted file mode 100644 index 595a22e..0000000 --- a/patches/uClibc/0.9.29/400-bits_sysnum_h.patch +++ /dev/null @@ -1,33 +0,0 @@ -YEM-20070519: -bits/sysnum.h needs a cross compiler to be built. Fortunately, this -header is not needed to build gcc. Move generation of this header. - -Index: uClibc/Makefile.in -=================================================================== ---- uClibc/Makefile.in (revision 18651) -+++ uClibc/Makefile.in (working copy) -@@ -91,6 +91,11 @@ - $(LN) -fs $$i .; \ - done; \ - fi -+ifeq ($(UCLIBC_HAS_LOCALE),y) -+ $(MAKE) locale_headers -+endif -+ -+pregen: headers - $(Q)\ - set -e; \ - cd $(top_builddir); \ -@@ -102,12 +107,7 @@ - else \ - mv -f $$tmp include/bits/sysnum.h; \ - fi --ifeq ($(UCLIBC_HAS_LOCALE),y) -- $(MAKE) locale_headers --endif - --pregen: headers -- - install: install_runtime install_dev - - diff --git a/patches/uClibc/0.9.29/401-bits_sysnum_h2.patch b/patches/uClibc/0.9.29/401-bits_sysnum_h2.patch deleted file mode 100644 index d650d8d..0000000 --- a/patches/uClibc/0.9.29/401-bits_sysnum_h2.patch +++ /dev/null @@ -1,18 +0,0 @@ -YEM-20070519: -Patch from Bernhard Fischer on the uClibc mailing -list ( http://www.uclibc.org/lists/uclibc/2008-January/018940.html ) above -the 400-bits_sysnum_h.patch. - -Index: uClibc/Makefile.in -=================================================================== ---- uClibc/Makefile.in (revision 18651) -+++ uClibc/Makefile.in (working copy) -@@ -114,7 +116,7 @@ install: install_runtime install_dev - RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell $(top_srcdir)extra/scripts/relative_path.sh $(DEVEL_PREFIX)lib $(RUNTIME_PREFIX)lib) - - # Installs header files. --install_headers: -+install_headers: headers - $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include - printf ".svn\n.cvsignore\nCVS\n" > tar_exclude ; \ - $(TAR) -chf - -X tar_exclude include \ diff --git a/patches/uClibc/0.9.29/500-custom-ISA.patch b/patches/uClibc/0.9.29/500-custom-ISA.patch deleted file mode 100644 index 51993ee..0000000 --- a/patches/uClibc/0.9.29/500-custom-ISA.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff -dur uClibc-0.9.29.orig/extra/Configs/Config.mips uClibc-0.9.29/extra/Configs/Config.mips ---- uClibc-0.9.29.orig/extra/Configs/Config.mips 2007-03-16 20:38:14.000000000 +0100 -+++ uClibc-0.9.29/extra/Configs/Config.mips 2007-05-22 19:30:43.000000000 +0200 -@@ -71,4 +71,16 @@ - config CONFIG_MIPS_ISA_MIPS64 - bool "MIPS64" - -+config CONFIG_MIPS_ISA_CUSTOM -+ bool "Custom" -+ - endchoice -+ -+config CONFIG_MIPS_CPU_CFLAGS_CUSTOM -+ string -+ prompt "Custon ISA" -+ depends on CONFIG_MIPS_ISA_CUSTOM -+ default "" -+ help -+ Enter your custom ISA here (eg: lx4189!). -+ -diff -dur uClibc-0.9.29.orig/Rules.mak uClibc-0.9.29/Rules.mak ---- uClibc-0.9.29.orig/Rules.mak 2007-04-17 15:34:11.000000000 +0200 -+++ uClibc-0.9.29/Rules.mak 2007-05-22 19:31:48.000000000 +0200 -@@ -234,6 +234,7 @@ - CPU_CFLAGS-$(CONFIG_MIPS_N64_ABI)+=-mabi=64 - CPU_CFLAGS-$(CONFIG_MIPS_O32_ABI)+=-mabi=32 - CPU_CFLAGS-$(CONFIG_MIPS_N32_ABI)+=-mabi=n32 -+ CPU_CFLAGS-$(CONFIG_MIPS_ISA_CUSTOM)+=-march=$(CONFIG_MIPS_CPU_CFLAGS_CUSTOM) - endif - - ifeq ($(TARGET_ARCH),nios) diff --git a/patches/uClibc/0.9.29/600-filter-gnu99-from-assembly-flags.patch b/patches/uClibc/0.9.29/600-filter-gnu99-from-assembly-flags.patch deleted file mode 100644 index d1a7e3a..0000000 --- a/patches/uClibc/0.9.29/600-filter-gnu99-from-assembly-flags.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ur uClibc-0.9.29/Makerules uClibc-0.9.29-patched/Makerules ---- uClibc-0.9.29/Makerules 2006-12-10 18:25:23.000000000 -0600 -+++ uClibc-0.9.29-patched/Makerules 2008-01-26 17:04:50.965699518 -0600 -@@ -96,7 +96,7 @@ - disp_ld = $($(DISP)_disp_ld) - - cmd_compile.c = $(CC) -c $< -o $@ $(CFLAGS) $(ARCH_CFLAGS) $(CFLAGS-$(suffix $@)) $(filter-out $(CFLAGS-OMIT-$(notdir $<)),$(CFLAGS-$(notdir $(^D)))) $(CFLAGS-$(subst $(top_srcdir),,$(dir $<))) $(CFLAGS-$(notdir $<)) $(CFLAGS-$(notdir $@)) --cmd_compile.S = $(cmd_compile.c) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@)) -+cmd_compile.S = $(filter-out -std=gnu99, $(cmd_compile.c)) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@)) - cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@)) - cmd_compile-m = $(CC) $^ -c -o $@ $(CFLAGS) $(ARCH_CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(notdir $(@D))) $(CFLAGS-$(notdir $@)) - cmd_strip = $(STRIPTOOL) $(STRIP_FLAGS) $^ diff --git a/patches/uClibc/0.9.29/700-linuxthreads.patch b/patches/uClibc/0.9.29/700-linuxthreads.patch deleted file mode 100644 index 8ce2439..0000000 --- a/patches/uClibc/0.9.29/700-linuxthreads.patch +++ /dev/null @@ -1,145 +0,0 @@ ---- a/libpthread/linuxthreads.old/attr.c 2006-01-24 12:41:01.000000000 -0500 -+++ b/libpthread/linuxthreads.old/attr.c 2008-02-10 11:35:32.000000000 -0500 -@@ -25,6 +25,14 @@ - #include "pthread.h" - #include "internals.h" - -+#include -+#include -+#include -+#include -+#include -+#include -+ -+ - /* NOTE: With uClibc I don't think we need this versioning stuff. - * Therefore, define the function pthread_attr_init() here using - * a strong symbol. */ -@@ -209,4 +217,94 @@ int __pthread_attr_getstacksize(const pt - *stacksize = attr->__stacksize; - return 0; - } -+ -+ -+extern int *__libc_stack_end; -+ - weak_alias (__pthread_attr_getstacksize, pthread_attr_getstacksize) -+void* pthread_getattr_np(pthread_t thread, pthread_attr_t *attr) -+{ -+ static void *stackBase = 0; -+ static size_t stackSize = 0; -+ int ret = 0; -+ /* Stack size limit. */ -+ struct rlimit rl; -+ -+ /* The safest way to get the top of the stack is to read -+ /proc/self/maps and locate the line into which -+ __libc_stack_end falls. */ -+ FILE *fp = fopen("/proc/self/maps", "rc"); -+ if (fp == NULL) -+ ret = errno; -+ /* We need the limit of the stack in any case. */ -+ else if (getrlimit (RLIMIT_STACK, &rl) != 0) -+ ret = errno; -+ else { -+ /* We need no locking. */ -+ __fsetlocking (fp, FSETLOCKING_BYCALLER); -+ -+ /* Until we found an entry (which should always be the case) -+ mark the result as a failure. */ -+ ret = ENOENT; -+ -+ char *line = NULL; -+ size_t linelen = 0; -+ uintptr_t last_to = 0; -+ -+ while (! feof_unlocked (fp)) { -+ if (getdelim (&line, &linelen, '\n', fp) <= 0) -+ break; -+ -+ uintptr_t from; -+ uintptr_t to; -+ if (sscanf (line, "%x-%x", &from, &to) != 2) -+ continue; -+ if (from <= (uintptr_t) __libc_stack_end -+ && (uintptr_t) __libc_stack_end < to) { -+ /* Found the entry. Now we have the info we need. */ -+ attr->__stacksize = rl.rlim_cur; -+#ifdef _STACK_GROWS_UP -+ /* Don't check to enforce a limit on the __stacksize */ -+ attr->__stackaddr = (void *) from; -+#else -+ attr->__stackaddr = (void *) to; -+ -+ /* The limit might be too high. */ -+ if ((size_t) attr->__stacksize > (size_t) attr->__stackaddr - last_to) -+ attr->__stacksize = (size_t) attr->__stackaddr - last_to; -+#endif -+ -+ /* We succeed and no need to look further. */ -+ ret = 0; -+ break; -+ } -+ last_to = to; -+ } -+ -+ fclose (fp); -+ free (line); -+ } -+#ifndef _STACK_GROWS_UP -+ stackBase = (char *) attr->__stackaddr - attr->__stacksize; -+#else -+ stackBase = attr->__stackaddr; -+#endif -+ stackSize = attr->__stacksize; -+ return (void*)(stackBase + stackSize); -+} -+ -+int __pthread_attr_getstack (const pthread_attr_t *attr, void **stackaddr, -+ size_t *stacksize) -+{ -+ /* XXX This function has a stupid definition. The standard specifies -+ no error value but what is if no stack address was set? We simply -+ return the value we have in the member. */ -+#ifndef _STACK_GROWS_UP -+ *stackaddr = (char *) attr->__stackaddr - attr->__stacksize; -+#else -+ *stackaddr = attr->__stackaddr; -+#endif -+ *stacksize = attr->__stacksize; -+ return 0; -+} -+weak_alias (__pthread_attr_getstack, pthread_attr_getstack) - ---- a/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h 2006-12-07 22:19:36.000000000 -0500 -+++ b/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h 2008-02-10 11:42:35.000000000 -0500 -@@ -288,15 +288,11 @@ extern int pthread_attr_getstacksize (__ - __attr, size_t *__restrict __stacksize) - __THROW; - --#if 0 --/* Not yet implemented in uClibc! */ -- - #ifdef __USE_GNU - /* Initialize thread attribute *ATTR with attributes corresponding to the - already running thread TH. It shall be called on unitialized ATTR - and destroyed with pthread_attr_destroy when no longer needed. */ --extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr) __THROW; --#endif -+extern void* pthread_getattr_np(pthread_t thread, pthread_attr_t *attr); - #endif - - /* Functions for scheduling control. */ -@@ -599,6 +595,11 @@ extern int pthread_cancel (pthread_t __c - cancelled. */ - extern void pthread_testcancel (void); - -+/* Return the previously set address for the stack. */ -+extern int pthread_attr_getstack (__const pthread_attr_t *__restrict __attr, -+ void **__restrict __stackaddr, -+ size_t *__restrict __stacksize) __THROW; -+ - - /* Install a cleanup handler: ROUTINE will be called with arguments ARG - when the thread is cancelled or calls pthread_exit. ROUTINE will also - diff --git a/patches/uClibc/0.9.29/800-rm-whitespace.patch b/patches/uClibc/0.9.29/800-rm-whitespace.patch deleted file mode 100644 index 6004f91..0000000 --- a/patches/uClibc/0.9.29/800-rm-whitespace.patch +++ /dev/null @@ -1,86 +0,0 @@ -diff -urN uClibc-0.9.29-0rig/include/assert.h uClibc-0.9.29/include/assert.h ---- uClibc-0.9.29-0rig/include/assert.h 2005-11-03 23:42:46.000000000 +0100 -+++ uClibc-0.9.29/include/assert.h 2007-08-13 19:10:57.000000000 +0200 -@@ -31,7 +31,7 @@ - #define _ASSERT_H 1 - #include - --#if defined __cplusplus && __GNUC_PREREQ (2,95) -+#if defined __cplusplus && __GNUC_PREREQ(2,95) - # define __ASSERT_VOID_CAST static_cast - #else - # define __ASSERT_VOID_CAST (void) -@@ -59,13 +59,17 @@ - (__ASSERT_VOID_CAST ((expr) ? 0 : \ - (__assert (__STRING(expr), __FILE__, __LINE__, \ - __ASSERT_FUNCTION), 0))) -- -+ -+/* Define some temporaries to workaround tinyx makedepend bug */ -+#define __GNUC_PREREQ_2_6 __GNUC_PREREQ(2, 6) -+#define __GNUC_PREREQ_2_4 __GNUC_PREREQ(2, 4) - /* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__' - which contains the name of the function currently being defined. - This is broken in G++ before version 2.6. - C9x has a similar variable called __func__, but prefer the GCC one since - it demangles C++ function names. */ --# if defined __cplusplus ? __GNUC_PREREQ (2, 6) : __GNUC_PREREQ (2, 4) -+ -+# if defined __cplusplus ? __GNUC_PREREQ_2_6 : __GNUC_PREREQ_2_4 - # define __ASSERT_FUNCTION __PRETTY_FUNCTION__ - # else - # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L -diff -urN uClibc-0.9.29-0rig/include/complex.h uClibc-0.9.29/include/complex.h ---- uClibc-0.9.29-0rig/include/complex.h 2002-05-09 10:15:21.000000000 +0200 -+++ uClibc-0.9.29/include/complex.h 2007-08-13 17:55:29.000000000 +0200 -@@ -33,7 +33,7 @@ - /* We might need to add support for more compilers here. But since ISO - C99 is out hopefully all maintained compilers will soon provide the data - types `float complex' and `double complex'. */ --#if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (2, 97) -+#if __GNUC_PREREQ(2, 7) && !__GNUC_PREREQ(2, 97) - # define _Complex __complex__ - #endif - -diff -urN uClibc-0.9.29-0rig/include/features.h uClibc-0.9.29/include/features.h ---- uClibc-0.9.29-0rig/include/features.h 2006-11-29 22:10:04.000000000 +0100 -+++ uClibc-0.9.29/include/features.h 2007-08-13 17:55:51.000000000 +0200 -@@ -143,7 +143,7 @@ - - /* Convenience macros to test the versions of glibc and gcc. - Use them like this: -- #if __GNUC_PREREQ (2,8) -+ #if __GNUC_PREREQ(2,8) - ... code requiring gcc 2.8 or later ... - #endif - Note - they won't work for gcc1 or glibc1, since the _MINOR macros -@@ -297,7 +297,7 @@ - /* uClibc does not support _FORTIFY_SOURCE */ - #undef _FORTIFY_SOURCE - #if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 \ -- && __GNUC_PREREQ (4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0 -+ && __GNUC_PREREQ(4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0 - # if _FORTIFY_SOURCE > 1 - # define __USE_FORTIFY_LEVEL 2 - # else -@@ -366,7 +366,7 @@ - #endif /* !ASSEMBLER */ - - /* Decide whether we can define 'extern inline' functions in headers. */ --#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \ -+#if __GNUC_PREREQ(2, 7) && defined __OPTIMIZE__ \ - && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ - # define __USE_EXTERN_INLINES 1 - #endif -diff -urN uClibc-0.9.29-0rig/include/tgmath.h uClibc-0.9.29/include/tgmath.h ---- uClibc-0.9.29-0rig/include/tgmath.h 2002-05-09 10:15:21.000000000 +0200 -+++ uClibc-0.9.29/include/tgmath.h 2007-08-13 17:56:17.000000000 +0200 -@@ -34,7 +34,7 @@ - do not try this for now and instead concentrate only on GNU CC. Once - we have more information support for other compilers might follow. */ - --#if __GNUC_PREREQ (2, 7) -+#if __GNUC_PREREQ(2, 7) - - # ifdef __NO_LONG_DOUBLE_MATH - # define __tgml(fct) fct -- cgit v0.10.2-6-g49f6