Package: gcc-4.0
Version: 4.0.2-4.1
Severity: wishlist
Tags: patch

Please enable tri-arch support for the MIPS platforms. The attached
patch (and a corresponding patch to glibc) provide support for n32 & n64
ABIs in addition to the current o32 ABI. These patches have been tested
by building n32 & n64 version of the ltp packages.

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (600, 'testing')
Architecture: mipsel (mips64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.14-rc1-Helix64-smp
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages gcc-4.0 depends on:
ii  binutils                     2.16.1-2    The GNU assembler, linker and bina
ii  cpp-4.0                      4.0.2-4.1   The GNU C preprocessor
ii  gcc-4.0-base                 4.0.2-4.1   The GNU Compiler Collection (base 
ii  libc6                        2.3.5-8.2   GNU C Library: Shared libraries an
ii  libgcc1                      1:4.0.2-4.1 GCC support library

Versions of packages gcc-4.0 recommends:
ii  libc6-dev                     2.3.5-8.2  GNU C Library: Development Librari
ii  libmudflap0-dev               4.0.2-4.1  GCC mudflap support libraries (dev

-- no debconf information
Index: debian/rules.patch
===================================================================
--- debian/rules.patch  (.../vendor/gcc-4.0/current)    (revision 145)
+++ debian/rules.patch  (.../src/gcc-4.0)       (revision 145)
@@ -102,6 +102,7 @@
 endif
 ifneq (,$(findstring /$(DEB_TARGET_ARCH)/,/mips/mipsel/))
   debian_patches += libffi-mips libmudflap-entry-point libmudflap-mips
+  debian_patches += mips-biarch
 endif
 
 ifeq ($(DEB_TARGET_ARCH_OS),kfreebsd)
Index: debian/patches/mips-biarch.dpatch
===================================================================
--- debian/patches/mips-biarch.dpatch   (.../vendor/gcc-4.0/current)    
(revision 0)
+++ debian/patches/mips-biarch.dpatch   (.../src/gcc-4.0)       (revision 145)
@@ -0,0 +1,85 @@
+#! /bin/sh -e
+
+# DP: Patch author: Stuart Anderson <[EMAIL PROTECTED]>
+# DP: Upstream status: Not submitted
+# DP: Description: add full tri-arch support. Include linux64.h also fix up
+# DP: Description: the directory names so that o32 is the default and follow
+# DP: Description: the glibc convention for 32 & 64 bit names
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -c -f --no-backup-if-mismatch -p1 < $0
+        ;;
+    -unpatch)
+        patch $pdir -c -f --no-backup-if-mismatch -R -p1 < $0
+        ;;
+    *)
+        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+        exit 1
+esac
+exit 0
+
+*** src/gcc/config.gcc.bak     Mon Oct  3 16:12:53 2005
+--- src/gcc/config.gcc Mon Oct  3 16:19:45 2005
+***************
+*** 1424,1430 ****
+       gas=yes
+       ;;
+  mips*-*-linux*)                              # Linux MIPS, either endian.
+!         tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h"
+       case ${target} in
+          mipsisa32*-*)
+                  target_cpu_default="MASK_SOFT_FLOAT"
+--- 1424,1431 ----
+       gas=yes
+       ;;
+  mips*-*-linux*)                              # Linux MIPS, either endian.
+!         tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h 
mips/linux64.h"
+!      tmake_file="${tmake_file} mips/t-linux64"
+       case ${target} in
+          mipsisa32*-*)
+                  target_cpu_default="MASK_SOFT_FLOAT"
+
+*** src/gcc/config/mips/linux64.h.bak  Mon Oct  3 11:28:01 2005
+--- src/gcc/config/mips/linux64.h      Mon Oct  3 11:28:29 2005
+***************
+*** 23,29 ****
+     in order to make the other specs easier to write.  */
+  #define DRIVER_SELF_SPECS \
+  "%{!EB:%{!EL:%(endian_spec)}}", \
+! "%{!mabi=*: -mabi=n32}"
+  
+  #undef SUBTARGET_ASM_SPEC
+  #define SUBTARGET_ASM_SPEC "\
+--- 23,29 ----
+     in order to make the other specs easier to write.  */
+  #define DRIVER_SELF_SPECS \
+  "%{!EB:%{!EL:%(endian_spec)}}", \
+! "%{!mabi=*: -mabi=32}"
+  
+  #undef SUBTARGET_ASM_SPEC
+  #define SUBTARGET_ASM_SPEC "\
+
+*** src/gcc/config/mips/t-linux64.orig Wed Oct 19 06:19:32 2005
+--- src/gcc/config/mips/t-linux64      Tue Oct 18 18:08:02 2005
+***************
+*** 1,5 ****
+  MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
+! MULTILIB_DIRNAMES = n32 32 64
+  MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64
+  
+  EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
+--- 1,5 ----
+  MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
+! MULTILIB_DIRNAMES = 32 . 64
+  MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64
+  
+  EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o

Property changes on: debian/patches/mips-biarch.dpatch
___________________________________________________________________
Name: svn:executable
   + *

Index: debian/patches/biarch-include-mips.dpatch
===================================================================
--- debian/patches/biarch-include-mips.dpatch   (.../vendor/gcc-4.0/current)    
(revision 0)
+++ debian/patches/biarch-include-mips.dpatch   (.../src/gcc-4.0)       
(revision 145)
@@ -0,0 +1,59 @@
+#! /bin/sh -e
+
+# DP: mips-biarch-include.dpatch
+# DP:
+# DP: Adds biarch include directory (/usr/include/{mips/mips64}-linux-gnu)
+# DP: to the system include paths, depending on 32/64 bit mode.
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p0 < $0
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        ;;
+    *)
+        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+        exit 1
+esac
+exit 0
+
+--- gcc/Makefile.in~   2005-04-04 21:45:13.000000000 +0200
++++ gcc/Makefile.in    2005-07-08 21:04:29.808308064 +0200
+@@ -2680,6 +2680,8 @@
+   -DLOCAL_INCLUDE_DIR=\"$(local_includedir)\" \
+   -DCROSS_INCLUDE_DIR=\"$(CROSS_SYSTEM_HEADER_DIR)\" \
+   -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
++  -DTARGET32_MACHINE=\"mips-linux-gnu\" \
++  -DTARGET64_MACHINE=\"mips64-linux-gnu\" \
+   @TARGET_SYSTEM_ROOT_DEFINE@
+ 
+ cppdefault.o: cppdefault.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+
+--- gcc/cppdefault.c~  2004-11-03 03:23:49.000000000 +0000
++++ gcc/cppdefault.c   2005-07-09 10:19:46.762899104 +0000
+@@ -50,9 +70,15 @@
+     /* Pick up GNU C++ generic include files.  */
+     { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 0 },
+ #endif
++#if defined (CROSS_COMPILE)
++    /* Pick up GNU C++ target-dependent include files.  */
++    { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, 0, 32 },
++#else
+ #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
+     /* Pick up GNU C++ target-dependent include files.  */
+-    { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, 0 },
++    { GPLUSPLUS_INCLUDE_DIR "/" TARGET32_MACHINE, "G++", 1, 1, 0, 32 },
++    { GPLUSPLUS_INCLUDE_DIR "/" TARGET64_MACHINE, "G++", 1, 1, 0, 64 },
++#endif
+ #endif
+ #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
+     /* Pick up GNU C++ backward and deprecated include files.  */

Property changes on: debian/patches/biarch-include-mips.dpatch
___________________________________________________________________
Name: svn:executable
   + *

Index: debian/rules.defs
===================================================================
--- debian/rules.defs   (.../vendor/gcc-4.0/current)    (revision 145)
+++ debian/rules.defs   (.../src/gcc-4.0)       (revision 145)
@@ -568,7 +568,7 @@
 biarch_cpu := $(patsubst $(DEB_TARGET_GNU_CPU)=%, %, \
                         $(filter $(DEB_TARGET_GNU_CPU)=%, $(biarch_map)))
 
-biarch_archs := /i386/powerpc/sparc/s390/
+biarch_archs := /i386/powerpc/sparc/s390/mips/mipsel/
 ifeq (/$(DEB_TARGET_ARCH)/,$(findstring /$(DEB_TARGET_ARCH)/,$(biarch_archs)))
   biarch := yes
   with_lib64gcc        := yes
@@ -591,7 +591,7 @@
   export TARGET64_MACHINE
 endif
 
-biarch32_archs := /amd64/ppc64/
+biarch32_archs := /amd64/ppc64/mips/mipsel/
 ifeq (/$(DEB_TARGET_ARCH)/,$(findstring 
/$(DEB_TARGET_ARCH)/,$(biarch32_archs)))
   biarch32 := yes
   with_lib32gcc := yes
@@ -610,6 +610,12 @@
   export TARGET64_MACHINE
 endif
 
+ifneq (, $(filter $(DEB_TARGET_ARCH_CPU),mips mipsel))
+  # on mips, we are really tri-arch
+  TARGET32_MACHINE := $(TARGET_ALIAS)
+  TARGET64_MACHINE := $(TARGET_ALIAS)
+endif
+
 #ifeq ($(DEB_TARGET_ARCH),ia64)
 #  biarch32 := yes
 #endif
@@ -670,6 +676,15 @@
   endif
 endif
 
+# mips/mipsel build --------------------
+ifneq (, $(filter $(DEB_TARGET_ARCH_CPU),mipsel))
+  export GNUTARGET = elf64-tradlittlemips
+endif
+ifneq (, $(filter $(DEB_TARGET_ARCH_CPU),mips))
+  export GNUTARGET = elf64-tradbigmips
+endif
+
+
 # GNU locales
 force_gnu_locales := yes
 locale_no_systems := gnu knetbsd-gnu netbsdelf-gnu
Index: debian/changelog
===================================================================
--- debian/changelog    (.../vendor/gcc-4.0/current)    (revision 145)
+++ debian/changelog    (.../src/gcc-4.0)       (revision 145)
@@ -1,3 +1,10 @@
+gcc-4.0 (4.0.2-4.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Enable triarch support for mips64 
+
+ -- Stuart Anderson <[EMAIL PROTECTED]>  Tue, 22 Nov 2005 08:17:31 -0600
+
 gcc-4.0 (4.0.2-4) unstable; urgency=low
 
   * Configure libstdc++ using the default allocator. Background:
@@ -72,8 +79,22 @@
 
  -- Matthias Klose <[EMAIL PROTECTED]>  Sun, 23 Oct 2005 12:50:59 +0200
 
+gcc-4.0 (4.0.2-2.2a) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Fix TARGET32_MACHINE & TARGET64_MACHINE for tri-arch mode
+  * re-enable FORTRAN and ADA builds 
+
+ -- Stuart Anderson <[EMAIL PROTECTED]>  Sat,  5 Nov 2005 14:16:19 -0700
+
+gcc-4.0 (4.0.2-2.1a) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Enable triarch support for mips64 
+
+ -- Stuart Anderson <[EMAIL PROTECTED]>  Wed, 12 Oct 2005 18:34:52 -0600
+
 gcc-4.0 (4.0.2-2) unstable; urgency=low
-
   * Update to CVS 20051001, taken from the gcc-4_0-branch. Includes the
     changes between 4.0.2 RC3 and the final 4.0.2 release, missing from
     the upstream tarball. Remove patches applied upstream (gcc-c-decl,
Index: debian/rules.conf
===================================================================
--- debian/rules.conf   (.../vendor/gcc-4.0/current)    (revision 145)
+++ debian/rules.conf   (.../src/gcc-4.0)       (revision 145)
@@ -57,7 +57,7 @@
 JAVA_BUILD_DEP := xlibs-dev [java_no_archs], libgtk2.0-dev (>= 2.4.4-2) 
[java_no_archs], libart-2.0-dev [java_no_archs], libcairo2-dev [java_no_archs],
 #PASCAL_BUILD_DEP := libncurses5-dev [pascal_no_archs], tetex-bin 
[pascal_no_archs], libgmp3-dev [pascal_no_archs], help2man [pascal_no_archs],
 
-LIBC_BIARCH_BUILD_DEP = libc6-dev-amd64 [i386], libc6-dev-sparc64 [sparc], 
libc6-dev-s390x [s390], libc6-dev-i386 [amd64] | ia32-libs-dev [amd64], 
libc6-dev-powerpc [ppc64], libc6-dev-ppc64 [powerpc], lib32gcc1 [amd64 ppc64], 
lib64gcc1 [i386 powerpc sparc s390], lib64z1-dev [i386 powerpc sparc s390], 
lib32z1-dev [amd64],
+LIBC_BIARCH_BUILD_DEP = libc6-dev-amd64 [i386], libc6-dev-sparc64 [sparc], 
libc6-dev-s390x [s390], libc6-dev-i386 [amd64] | ia32-libs-dev [amd64], 
libc6-dev-powerpc [ppc64], libc6-dev-ppc64 [powerpc], lib32gcc1 [amd64 ppc64], 
lib64gcc1 [i386 powerpc sparc s390], lib64z1-dev [i386 powerpc sparc s390], 
lib32z1-dev [amd64], libc6-dev-mipsn32 [mips mipsel], libc6-dev-mipsn64 [mips 
mipsel],
 
 #ifeq ($(PKGSOURCE),gcc-snapshot)
 #  LIBC_BIARCH_BUILD_DEP =
@@ -83,6 +83,10 @@
     LIBC_BIARCH_DEP := libc6-s390x (>= $(libc_ver))
     LIBC_BIARCH_DEV_DEP := libc6-dev-s390x (>= $(libc_ver))
   endif
+  ifneq (, $(filter $(DEB_TARGET_ARCH),mips mipsel))
+    LIBC_BIARCH_DEP := libc6-mipsn64 (>= $(libc_ver))
+    LIBC_BIARCH_DEV_DEP := libc6-dev-mipsn64 (>= $(libc_ver))
+  endif
   LIBCXX_BIARCH_DEP = lib64stdc++$(CXX_SONAME)
 endif
 ifeq ($(biarch32),yes)
@@ -99,6 +103,10 @@
     LIBC_BIARCH_DEP := libc6-powerpc (>= $(libc_ver))
     LIBC_BIARCH_DEV_DEP := libc6-dev-powerpc (>= $(libc_ver))
   endif
+  ifneq (, $(filter $(DEB_TARGET_ARCH),mips mipsel))
+    LIBC_BIARCH_DEP := libc6-mipsn32 (>= $(libc_ver))
+    LIBC_BIARCH_DEV_DEP := libc6-dev-mipsn32 (>= $(libc_ver))
+  endif
   LIBCXX_BIARCH_DEP = lib32stdc++$(CXX_SONAME)
 endif
 
@@ -264,7 +272,8 @@
   languages = ada c c++ f95 java objc pascal treelang
   addons = cdev c++dev fastjar fdev fixincl javadev libcxx libg2c \
           libgcc libffi libfortran libgcj libgnat libnof libobjc libs \
-          lib64gcc lib64cxx lib64ffi lib64gcj lib64gnat \
+          lib64gcc lib32gcc lib64cxx lib32cxx lib64ffi lib32ffi \
+          lib64gcj lib32gcj lib64gnat lib32gnat \
           lib64objc lib32objc lib64gfortran lib32gfortran \
           libnof objcdev proto
 endif

Reply via email to