gcc tri-arch support
I've been working on the changes to enable tri-arch support in the
glibc and gcc-4.0 packages. I'm planning on sending the changes to the BTS
as enhancements, but would appreciate any comments anyone has before I do
so. There is a bit of a chicken and egg in that gcc and glibc depend on
the other already having been built tri-arch, so these two patches
effectively go together.
I know there is an "export GNUTARGET" in the patch for rules.def that
needs to be done better, but otherwise, the changes have been cleaned up
and minimized.
I've been testing this on LE, but tried to be careful to make changes
for both LE & BE.
Stuart
Stuart R. Anderson anderson@netsweng.com
Network & Software Engineering http://www.netsweng.com/
1024D/37A79149: 0791 D3B8 9A4C 2CDC A31F
BD03 0A62 E534 37A7 9149
Index: debian/control.in/mips64
===================================================================
--- debian/control.in/mips64 (.../vendor/glibc/current) (revision 0)
+++ debian/control.in/mips64 (.../src/glibc) (revision 97)
@@ -0,0 +1,21 @@
+Package: libc6-mips64
+Architecture: mips mipsel
+Section: base
+Priority: required
+Depends: libc6 (= ${Source-Version})
+Description: GNU C Library: 64bit Shared libraries for MIPS64
+ This package includes shared versions of the standard C library and the
+ standard math library, as well as many others. This is the 64bit version
+ of the library, meant for MIPS64 systems.
+
+Package: libc6-dev-mips64
+Architecture: mips mipsel
+Section: libdevel
+Priority: standard
+Provides: lib64c-dev
+Depends: libc6-mips64 (= ${Source-Version}), libc6-dev (= ${Source-Version}), lib64gcc1
+Description: GNU C Library: 64bit Development Libraries for MIPS64
+ Contains the symlinks and object files needed to compile and link programs
+ which use the standard C library. This is the 64bit version of the
+ library, meant for MIPS64 systems.
+
Index: debian/control.in/mips32
===================================================================
--- debian/control.in/mips32 (.../vendor/glibc/current) (revision 0)
+++ debian/control.in/mips32 (.../src/glibc) (revision 97)
@@ -0,0 +1,22 @@
+Package: libc6-mips32
+Architecture: mips mipsel
+Section: base
+Priority: required
+Depends: libc6 (= ${Source-Version})
+Conflicts: libc6-mipsn32
+Description: GNU C Library: n32 Shared libraries for MIPS
+ This package includes shared versions of the standard C library and the
+ standard math library, as well as many others. This is the n32 version
+ of the library, meant for MIPS systems.
+
+Package: libc6-dev-mips32
+Architecture: mips mipsel
+Section: libdevel
+Priority: standard
+Provides: libn32c-dev
+Depends: libc6-mips32 (= ${Source-Version}), libc6-dev (= ${Source-Version}), lib32gcc1
+Description: GNU C Library: n32 Development Libraries for MIPS
+ Contains the symlinks and object files needed to compile and link programs
+ which use the standard C library. This is the n32 version of the
+ library, meant for MIPS systems.
+
Index: debian/sysdeps/mipsel.mk
===================================================================
--- debian/sysdeps/mipsel.mk (.../vendor/glibc/current) (revision 0)
+++ debian/sysdeps/mipsel.mk (.../src/glibc) (revision 97)
@@ -0,0 +1,23 @@
+GLIBC_PASSES += mips64 mips32
+DEB_ARCH_REGULAR_PACKAGES += libc6-mips64 libc6-dev-mips64 libc6-mips32 libc6-dev-mips32
+# This is needed to keep binutils (ar & ranlib) from getting confused about
+# the file format being used.
+export GNUTARGET=elf64-tradlittlemips
+
+mips32_MIN_KERNEL_SUPPORTED = 2.6.0
+mips32_configure_target = mips64-linux
+mips32_CC = $(CC) -mabi=n32
+mips32_extra_cflags =
+mips32_add-ons = linuxthreads $(add-ons)
+libc6-mips32_shlib_dep = libc6-mips32 (>= $(shlib_dep_ver))
+mips32_LIBDIR = 32
+mips32_extra_config_options := $(extra_config_options) --with-__thread --disable-profile
+
+mips64_MIN_KERNEL_SUPPORTED = 2.6.0
+mips64_configure_target = mips64-linux
+mips64_CC = $(CC) -mabi=64
+mips64_extra_cflags =
+mips64_add-ons = linuxthreads $(add-ons)
+libc6-mips64_shlib_dep = libc6-mips64 (>= $(shlib_dep_ver))
+mips64_LIBDIR = 64
+mips64_extra_config_options := $(extra_config_options) --with-__thread --disable-profile
Index: debian/rules.d/debhelper.mk
===================================================================
--- debian/rules.d/debhelper.mk (.../vendor/glibc/current) (revision 97)
+++ debian/rules.d/debhelper.mk (.../src/glibc) (revision 97)
@@ -193,7 +193,7 @@
destdir=$$1; \
shift; \
z=debian/$(libc)-$$x.install; \
- if test $$destdir = 64; then \
+ if test $$destdir = 64 -o $$destdir = 32 ; then \
cp debian/debhelper.in/libc-alt.install $$z; \
zd=debian/$(libc)-dev-$$x.install; \
cp debian/debhelper.in/libc-alt-dev.install $$zd; \
Index: debian/rules.d/control.mk
===================================================================
--- debian/rules.d/control.mk (.../vendor/glibc/current) (revision 97)
+++ debian/rules.d/control.mk (.../src/glibc) (revision 97)
@@ -1,4 +1,4 @@
-control_deps := $(addprefix debian/control.in/, libc6 libc6.1 libc0.3 libc1 sparc64 s390x ppc64 opt amd64)
+control_deps := $(addprefix debian/control.in/, libc6 libc6.1 libc0.3 libc1 sparc64 s390x ppc64 opt amd64 mips32 mips64)
threads_archs := alpha amd64 arm i386 m68k mips mipsel powerpc sparc ia64 hppa s390 sh3 sh4 sh3eb sh4eb freebsd-i386
@@ -26,6 +26,8 @@
cat debian/control.in/s390x >> $@T
cat debian/control.in/amd64 >> $@T
cat debian/control.in/ppc64 >> $@T
+ cat debian/control.in/mips32 >> $@T
+ cat debian/control.in/mips64 >> $@T
cat debian/control.in/opt >> $@T
cat debian/control.in/libnss-dns-udeb >> $@T
cat debian/control.in/libnss-files-udeb >> $@T
Index: debian/rules.patch
===================================================================
--- debian/rules.patch (.../vendor/gcc-4.0/current) (revision 97)
+++ debian/rules.patch (.../src/gcc-4.0) (revision 97)
@@ -106,6 +106,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 97)
@@ -0,0 +1,86 @@
+#! /bin/sh -e
+
+# DP: add full tri-arch support. Include linux64.h also
+# DP: make sure -32 & -64 are recognized
+# DP: Fix up the directory names so that o32 is the default and the
+# DP: 32 & 64 bit names follow the same convention as is used by glibc
+
+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,31 ----
+ in order to make the other specs easier to write. */
+ #define DRIVER_SELF_SPECS \
+ "%{!EB:%{!EL:%(endian_spec)}}", \
+! "%{!mabi=*: -mabi=32}" \
+! "%{m32: -mabi=n32}" \
+! "%{m64: -mabi=64}"
+
+ #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
Index: debian/rules.defs
===================================================================
--- debian/rules.defs (.../vendor/gcc-4.0/current) (revision 97)
+++ debian/rules.defs (.../src/gcc-4.0) (revision 97)
@@ -9,6 +9,7 @@
builddir_ia6432 = $(PWD)/build-ia6432
stampdir = stamps
distribution := $(shell lsb_release -is)
+export GNUTARGET = elf64-tradlittlemips
lib64 = lib64
@@ -331,7 +332,7 @@
with_fortran := yes
endif
-f95_no_cpus :=
+f95_no_cpus := mips mipsel
ifneq (, $(filter $(DEB_TARGET_ARCH_CPU),$(f95_no_cpus)))
with_fortran := disabled for architecure $(DEB_TARGET_ARCH_CPU)
endif
@@ -475,7 +476,7 @@
endif
with_libgnat := yes
-ada_no_cpus := alpha arm armeb m68k sh3 sh3eb sh4 sh4eb
+ada_no_cpus := alpha arm armeb m68k sh3 sh3eb sh4 sh4eb mips mipsel
ada_no_systems := hurd-i386 kfreebsd-gnu knetbsd-gnu netbsdelf-gnu
ifneq (, $(filter $(DEB_TARGET_ARCH_CPU),$(ada_no_cpus)))
with_ada := disabled for architecure $(DEB_TARGET_ARCH_CPU)
@@ -599,7 +600,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
@@ -622,7 +623,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
Index: debian/rules.conf
===================================================================
--- debian/rules.conf (.../vendor/gcc-4.0/current) (revision 97)
+++ debian/rules.conf (.../src/gcc-4.0) (revision 97)
@@ -54,7 +54,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-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],
+LIBC_BIARCH_BUILD_DEP = 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], libc6-dev-mips64 [mips], libc6-dev-mips64 [mipsel],
ifeq ($(distribution),Ubuntu)
LIBC_BIARCH_BUILD_DEP += lib32z1-dev [amd64], lib64z1-dev [i386 powerpc],
@@ -97,6 +97,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-mips64 (>= $(libc_ver))
+ LIBC_BIARCH_DEV_DEP := libc6-dev-mips64 (>= $(libc_ver))
+ endif
LIBCXX_BIARCH_DEP = lib64stdc++$(CXX_SONAME)
endif
ifeq ($(biarch32),yes)
@@ -113,6 +117,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-mips32 (>= $(libc_ver))
+ LIBC_BIARCH_DEV_DEP := libc6-dev-mips32 (>= $(libc_ver))
+ endif
LIBCXX_BIARCH_DEP = lib32stdc++$(CXX_SONAME)
endif
@@ -278,7 +286,8 @@
languages = ada c c++ f77 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 to: