[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#331220: gcc-3.3: Please add big-endian arm (armeb) support



Package: gcc-3.3
Version: 1:3.3.6-10
Severity: wishlist
Tags: patch

Attached is a patch for gcc-3.3 to add support for the armeb
architecture.  It's pretty similar to the corresponding patches
for gcc-3.4 and gcc-4.0, but it has one extra patch for PR22528
that was fixed on the 3.4 branch but never in 3.3, and which is
needed for gcc to even be able to bootstrap itself on this
architecture.


-- System Information:
Debian Release: 3.1
Architecture: armeb (armv5teb)
Kernel: Linux 2.6.13
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages gcc-3.3 depends on:
ii  binutils             2.16.1cvs20050902-1 The GNU assembler, linker and bina
ii  cpp-3.3              1:3.3.6-10          The GNU C preprocessor
ii  gcc-3.3-base         1:3.3.6-10          The GNU Compiler Collection (base
ii  libc6                2.3.5-6             GNU C Library: Shared libraries an
ii  libgcc1              1:4.0.1-8           GCC support library

-- no debconf information
--- gcc-3.3-3.3.6/debian/rules2.orig	2005-10-02 13:40:44.000000000 +0200
+++ gcc-3.3-3.3.6/debian/rules2	2005-10-02 13:41:45.000000000 +0200
@@ -152,7 +152,7 @@
 endif
 
 # Increase the timeout for one testrun on slow architectures
-ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),arm hppa m68k))
+ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),arm armeb hppa m68k))
   DEJAGNU_TIMEOUT=600
 else
   DEJAGNU_TIMEOUT=450
@@ -570,7 +570,7 @@
 
 # start the script only on architectures known to be slow ...
 # or on those known not to show too many failures
-ifeq ($(DEB_HOST_ARCH), $(findstring $(DEB_HOST_ARCH),arm hppa m68k mips mipsel))
+ifeq ($(DEB_HOST_ARCH), $(findstring $(DEB_HOST_ARCH),arm armeb hppa m68k mips mipsel))
 	: # start logwatch script for regular output during test runs
 	chmod +x debian/logwatch.sh
 	-debian/logwatch.sh -t 900 -p $(builddir)/logwatch.pid \
@@ -659,7 +659,7 @@
 	rm -f test32-protocol
 
 # start the script only on architectures known to be slow ...
-ifeq ($(DEB_HOST_ARCH), $(findstring $(DEB_HOST_ARCH),arm m68k))
+ifeq ($(DEB_HOST_ARCH), $(findstring $(DEB_HOST_ARCH),arm armeb m68k))
 	: # start logwatch script for regular output during test runs
 	chmod +x debian/logwatch.sh
 	-debian/logwatch.sh -t 900 -p $(builddir)/logwatch-32.pid \
--- gcc-3.3-3.3.6/debian/control.orig	2005-10-02 13:40:45.000000000 +0200
+++ gcc-3.3-3.3.6/debian/control	2005-10-02 13:41:45.000000000 +0200
@@ -4,7 +4,7 @@
 Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
 Uploaders: Matthias Klose <doko@debian.org>, Gerhard Tonn <gt@debian.org>
 Standards-Version: 3.6.2
-Build-Depends: dpkg-dev (>= 1.13.9), libc6.1-dev (>= 2.3.2.ds1-16) [alpha ia64] | libc0.3-dev [hurd-i386] | libc0.1-dev [kfreebsd-i386] | libc12-dev (>= 2.0.ds1-1) [netbsd-i386] | libc6-dev (>= 2.3.2.ds1-16), libc6-dev-sparc64 [sparc], libc6-dev-s390x [s390], libunwind7-dev (>= 0.98.5-1) [ia64], libatomic-ops-dev [ia64], m4, autoconf2.13, automake1.4 | automake (<< 1.5), libtool, autotools-dev, gawk, dejagnu (>= 1.4.3) [!hurd-i386], expect (>= 5.38.0) [!hurd-i386], bzip2, binutils (>= 2.15-7) | binutils-multiarch (>= 2.15-7), binutils-hppa64 (>= 2.15-7) [hppa], debhelper (>= 3.0.25), gperf (>= 2.7-3), bison (>= 1:1.875), flex, gettext, texinfo (>= 4.3), zlib1g-dev, libgc-dev [!avr], gcc-3.3, gnat-3.3 [!arm !hurd-i386 !m68k !ppc64 !kfreebsd-i386 !netbsd-i386] | gnat-3.2 [!arm !hurd-i386 !m68k !ppc64 !kfreebsd-i386 !netbsd-i386] | gnat [i386 powerpc sparc], locales [!netbsd-i386 !hurd-i386 !hurd-i386], procps [!hurd-i386], sharutils, realpath (>= 1.9.12), lsb-release
+Build-Depends: dpkg-dev (>= 1.13.9), libc6.1-dev (>= 2.3.2.ds1-16) [alpha ia64] | libc0.3-dev [hurd-i386] | libc0.1-dev [kfreebsd-i386] | libc12-dev (>= 2.0.ds1-1) [netbsd-i386] | libc6-dev (>= 2.3.2.ds1-16), libc6-dev-sparc64 [sparc], libc6-dev-s390x [s390], libunwind7-dev (>= 0.98.5-1) [ia64], libatomic-ops-dev [ia64], m4, autoconf2.13, automake1.4 | automake (<< 1.5), libtool, autotools-dev, gawk, dejagnu (>= 1.4.3) [!hurd-i386], expect (>= 5.38.0) [!hurd-i386], bzip2, binutils (>= 2.15-7) | binutils-multiarch (>= 2.15-7), binutils-hppa64 (>= 2.15-7) [hppa], debhelper (>= 3.0.25), gperf (>= 2.7-3), bison (>= 1:1.875), flex, gettext, texinfo (>= 4.3), zlib1g-dev, libgc-dev [!avr], gcc-3.3, gnat-3.3 [!arm !armeb !hurd-i386 !m68k !ppc64 !kfreebsd-i386 !netbsd-i386] | gnat-3.2 [!arm !armeb !hurd-i386 !m68k !ppc64 !kfreebsd-i386 !netbsd-i386] | gnat [i386 powerpc sparc], locales [!netbsd-i386 !hurd-i386 !hurd-i386], procps [!hurd-i386], sharutils, realpath (>= 1.9.12), lsb-release
 Build-Depends-Indep: doxygen (>= 1.4.2-3), graphviz (>= 2.2)
 
 Package: gcc-3.3-base
@@ -206,7 +206,7 @@
  Documentation for the GNU Ada compiler in info format.
 
 Package: gcc-3.3-soft-float
-Architecture: arm
+Architecture: arm armeb
 Priority: optional
 Depends: gcc-3.3-base (>= 1:3.3.6-10), ${shlibs:Depends}, gcc-3.3 (>= 1:3.3.6-10), gcc-3.3 (<< 1:3.3.7)
 Replaces: gcc-soft-float-ss (<< 1:3.3.7)
--- gcc-3.3-3.3.6/debian/rules.defs.orig	2005-10-02 13:40:44.000000000 +0200
+++ gcc-3.3-3.3.6/debian/rules.defs	2005-10-02 13:41:45.000000000 +0200
@@ -399,7 +399,7 @@
 endif
 
 with_libgnat := yes
-ada_no_archs := arm hurd-i386 m68k ppc64 kfreebsd-i386 netbsd-i386
+ada_no_archs := arm armeb hurd-i386 m68k ppc64 kfreebsd-i386 netbsd-i386
 ifneq ($(DEB_TARGET_ARCH),i386)
   ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),$(ada_no_archs)))
     with_ada := disabled for architecure $(DEB_TARGET_ARCH)
--- gcc-3.3-3.3.6/debian/rules.patch.orig	2005-10-02 13:40:45.000000000 +0200
+++ gcc-3.3-3.3.6/debian/rules.patch	2005-10-02 13:43:13.000000000 +0200
@@ -89,6 +89,9 @@
 ifeq ($(DEB_TARGET_ARCH),arm)
   debian_patches += arm-tune arm-gotoff arm-ldm
 endif
+ifeq ($(DEB_TARGET_ARCH),armeb)
+  debian_patches += arm-tune arm-gotoff arm-ldm pr22528 arm-bigendian
+endif
 ifneq (,$(findstring $(DEB_TARGET_ARCH),i386))
   debian_patches += cpu-default-i486
 endif
--- gcc-3.3-3.3.6/debian/patches/pr22528.dpatch.orig	2005-10-02 13:41:45.000000000 +0200
+++ gcc-3.3-3.3.6/debian/patches/pr22528.dpatch	2005-10-02 13:41:45.000000000 +0200
@@ -0,0 +1,91 @@
+#! /bin/sh -e
+
+src=gcc
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    src=$3/gcc
+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 --fuzz 10 < $0
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 --fuzz 10 < $0
+        ;;
+    *)
+        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+        exit 1
+esac
+exit 0
+
+--- gcc/config/arm/arm.md.orig	2004-03-30 22:43:44.000000000 +0200
++++ gcc/config/arm/arm.md	2005-08-15 12:21:55.000000000 +0200
+@@ -4275,7 +4275,7 @@
+    (set (match_dup 2)
+ 	(ashiftrt:SI (match_operand 0 "" "") (const_int 8)))
+    ;; store the high byte
+-   (set (match_dup 4) (subreg:QI (match_dup 2) 0))]	;explicit subreg safe
++   (set (match_dup 4) (match_dup 5))]
+   "TARGET_ARM"
+   "
+   {
+@@ -4291,7 +4291,8 @@
+     operands[1] = adjust_address (operands[1], QImode, 0);
+     operands[3] = gen_lowpart (QImode, operands[0]);
+     operands[0] = gen_lowpart (SImode, operands[0]);
+-    operands[2] = gen_reg_rtx (SImode); 
++    operands[2] = gen_reg_rtx (SImode);
++    operands[5] = gen_lowpart (QImode, operands[2]);
+   }"
+ )
+ 
+@@ -4299,7 +4300,7 @@
+   [(set (match_dup 4) (match_dup 3))
+    (set (match_dup 2)
+ 	(ashiftrt:SI (match_operand 0 "" "") (const_int 8)))
+-   (set (match_operand 1 "" "")	(subreg:QI (match_dup 2) 3))]
++   (set (match_operand 1 "" "")	(match_dup 5))]
+   "TARGET_ARM"
+   "
+   {
+@@ -4316,13 +4317,14 @@
+     operands[3] = gen_lowpart (QImode, operands[0]);
+     operands[0] = gen_lowpart (SImode, operands[0]);
+     operands[2] = gen_reg_rtx (SImode);
++    operands[5] = gen_lowpart (QImode, operands[2]);
+   }"
+ )
+ 
+ ;; Subroutine to store a half word integer constant into memory.
+ (define_expand "storeinthi"
+   [(set (match_operand 0 "" "")
+-	(subreg:QI (match_operand 1 "" "") 0))
++	(match_operand 1 "" ""))
+    (set (match_dup 3) (match_dup 2))]
+   "TARGET_ARM"
+   "
+@@ -4363,6 +4365,7 @@
+     operands[3] = adjust_address (op0, QImode, 1);
+     operands[0] = adjust_address (operands[0], QImode, 0);
+     operands[2] = gen_lowpart (QImode, operands[2]);
++    operands[1] = gen_lowpart (QImode, operands[1]);
+   }"
+ )
+ 
+@@ -4682,11 +4685,12 @@
+    (set (match_dup 3)
+ 	(ashiftrt:SI (match_dup 2) (const_int 16)))
+    (set (match_operand:HI 0 "s_register_operand" "")
+-	(subreg:HI (match_dup 3) 0))]
++	(match_dup 4))]
+   "TARGET_ARM"
+   "
+   operands[2] = gen_reg_rtx (SImode);
+   operands[3] = gen_reg_rtx (SImode);
++  operands[4] = gen_lowpart (HImode, operands[3]);
+   "
+ )
+ 
--- gcc-3.3-3.3.6/debian/patches/arm-bigendian.dpatch.orig	2005-10-02 13:41:45.000000000 +0200
+++ gcc-3.3-3.3.6/debian/patches/arm-bigendian.dpatch	2005-10-02 13:41:45.000000000 +0200
@@ -0,0 +1,84 @@
+#! /bin/sh -e
+
+src=gcc
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    src=$3/gcc
+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 --fuzz 10 < $0
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 --fuzz 10 < $0
+        ;;
+    *)
+        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+        exit 1
+esac
+exit 0
+
+--- gcc/config/arm/linux-elf.h	2004-04-13 22:15:11.000000000 +0200
++++ gcc/config/arm/linux-elf.h	2004-08-31 02:36:56.578068179 +0200
+@@ -30,17 +30,31 @@
+ /* Do not assume anything about header files.  */
+ #define NO_IMPLICIT_EXTERN_C
+ 
++/*
++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
++ * (big endian) configurations.
++ */
++#if TARGET_BIG_ENDIAN_DEFAULT
++#define TARGET_ENDIAN_DEFAULT ARM_FLAG_BIG_END
++#define TARGET_ENDIAN_OPTION "mbig-endian"
++#define TARGET_LINKER_EMULATION "armelfb_linux"
++#else
++#define TARGET_ENDIAN_DEFAULT 0
++#define TARGET_ENDIAN_OPTION "mlittle-endian"
++#define TARGET_LINKER_EMULATION "armelf_linux"
++#endif
++
+ /* Default is to use APCS-32 mode.  */
+ #undef  TARGET_DEFAULT
+-#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS)
++#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS | TARGET_ENDIAN_DEFAULT)
+ 
+ #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
+ 
+-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
+ 
+ #undef  MULTILIB_DEFAULTS
+ #define MULTILIB_DEFAULTS \
+-	{ "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" }
++	{ "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" }
+ 
+ #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
+ 
+@@ -88,7 +102,7 @@
+    %{rdynamic:-export-dynamic} \
+    %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
+    -X \
+-   %{mbig-endian:-EB}" \
++   %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
+    SUBTARGET_EXTRA_LINK_SPEC
+ 
+ #define TARGET_OS_CPP_BUILTINS()		\
+--- gcc/config.gcc	2004-04-13 22:32:55.000000000 +0200
++++ gcc/config.gcc	2004-08-31 02:35:07.301792054 +0200
+@@ -699,6 +699,11 @@
+ 	;;
+ arm*-*-linux*)			# ARM GNU/Linux with ELF
+ 	tm_file="dbxelf.h elfos.h arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/aout.h arm/arm.h"
++	case $machine in
++	arm*b-*)
++		tm_defines="TARGET_BIG_ENDIAN_DEFAULT=1 $tm_defines"
++		;;
++	esac
+ 	tmake_file="t-slibgcc-elf-ver t-linux arm/t-linux"
+ 	extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
+ 	gnu_ld=yes
+
--- gcc-3.3-3.3.6/debian/control.m4.orig	2005-10-02 13:40:48.000000000 +0200
+++ gcc-3.3-3.3.6/debian/control.m4	2005-10-02 13:41:45.000000000 +0200
@@ -619,7 +619,7 @@
 ifdef(`TARGET',`',`dnl
 ifenabled(`libs',`
 Package: gcc`'PV-soft-float
-Architecture: arm
+Architecture: arm armeb
 Priority: PRI(optional)
 Depends: gcc`'PV-base (>= CV), ${shlibs:Depends}ifenabled(`cdev',`, gcc`'PV (>= CV), gcc`'PV (<< NV)')
 Replaces: gcc-soft-float-ss (<< NV)

Reply to: