Bug#336064: gcc-2.95: Please add big-endian arm (armeb) support
Package: gcc-2.95
Severity: wishlist
Tags: patch
The attached patch adds big-endian arm support to gcc-2.95. It's
more-or-less the same as its gcc-4.0 counterpart: teach the debian
build scripts about 'armeb', and patch gcc so that it defaults to
big-endian.
Since gcc-2.95 is so old, I haven't bothered with making a patch that
detects the endianness at configure time -- instead, if we're being
built for the armeb arch, a patch is applied that just hardcodes the
default endianity to big-endian. Please let me know if this is not
acceptable.
Together with the patches for #323512 and #336057 this allows for a
fully native build of gcc-2.95 on a big-endian arm system.
-- System Information:
Debian Release: testing/unstable
APT prefers stable
APT policy: (500, 'stable')
Architecture: armeb (armv4b)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.13
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
--- gcc-2.95-2.95.4.ds15/debian/rules2.orig 2005-10-11 11:15:05.000000000 +0200
+++ gcc-2.95-2.95.4.ds15/debian/rules2 2005-10-11 11:15:50.000000000 +0200
@@ -555,6 +555,11 @@
d_softfloat = debian/$(p_softfloat)
endif
+ifeq ($(DEB_HOST_ARCH),armeb)
+ p_softfloat = gcc$(pkg_ver)-soft-float$(ss_suffix)
+ d_softfloat = debian/$(p_softfloat)
+endif
+
# gcc must be moved after g77 and g++
# not all files $(PF)/include/*.h are part of gcc,
# but it becomes difficult to name all these files ...
@@ -598,6 +603,10 @@
dirs_gcc += $(gcc_lib_dir)/soft-float
files_gcc += $(gcc_lib_dir)/soft-float/{libgcc.a,*.o}
endif
+ifeq ($(TARGET)-$(with_arm_soft_float),armeb-yes)
+ dirs_gcc += $(gcc_lib_dir)/soft-float
+ files_gcc += $(gcc_lib_dir)/soft-float/{libgcc.a,*.o}
+endif
endif
files_gcc += \
$(shell test -e $(d)/$(gcc_lib_dir)/SYSCALLS.c.X \
@@ -630,6 +639,15 @@
$(gcc_lib_dir)/soft-float
endif
+ifeq ($(TARGET)-$(with_arm_soft_float),armeb-yes)
+ dirs_softfloat = \
+ $(PF)/lib/soft-float \
+ $(gcc_lib_dir)/soft-float
+ files_softfloat = \
+ $(PF)/lib/soft-float \
+ $(gcc_lib_dir)/soft-float
+endif
+
dirs_cpp = \
$(docdir)/$(p_cpp) \
$(PF)/share/man/man1 \
@@ -891,6 +909,10 @@
dirs_gcc += $(PF)/lib/soft-float
endif
+ifeq ($(TARGET)-$(with_arm_soft_float),armeb-yes)
+ dirs_gcc += $(PF)/lib/soft-float
+endif
+
foo-%:
echo T: $(TARGET) $(d)
echo $(dirs_gcc)
@@ -1049,6 +1071,9 @@
ifeq ($(TARGET)-$(with_arm_soft_float),arm-yes)
dh_installdirs -p$(p_softfloat) $(dirs_softfloat)
endif
+ifeq ($(TARGET)-$(with_arm_soft_float),armeb-yes)
+ dh_installdirs -p$(p_softfloat) $(dirs_softfloat)
+endif
ifeq ($(TARGET),native)
@@ -1187,6 +1212,9 @@
ifeq ($(TARGET)-$(with_arm_soft_float),arm-yes)
dh_movefiles -p$(p_softfloat) $(files_softfloat)
endif
+ifeq ($(TARGET)-$(with_arm_soft_float),armeb-yes)
+ dh_movefiles -p$(p_softfloat) $(files_softfloat)
+endif
dh_movefiles -p$(p_cpp) $(files_cpp)
dh_movefiles -p$(p_cppd) $(files_cppd)
ifeq ($(with_objc),yes)
--- gcc-2.95-2.95.4.ds15/debian/control.in.orig 2005-10-11 11:14:28.000000000 +0200
+++ gcc-2.95-2.95.4.ds15/debian/control.in 2005-10-11 11:14:16.000000000 +0200
@@ -427,7 +427,7 @@
with the -msoft-float option, for CPUs without a floating-point unit.
#endif
-#if defined(__arm__) && defined(ARM_SOFT_FLOAT)
+#if (defined(__arm__) || defined(__ARMEB__)) && defined(ARM_SOFT_FLOAT)
Package: PN(gcc_PV_-soft-float)
Architecture: any
Priority: PRI(optional)
--- gcc-2.95-2.95.4.ds15/debian/rules.patch.orig 2005-10-11 11:11:23.000000000 +0200
+++ gcc-2.95-2.95.4.ds15/debian/rules.patch 2005-10-11 11:12:45.000000000 +0200
@@ -142,9 +142,14 @@
arm-const-double arm-tune arm-output-int libgcc-umodsi3 \
arm-profile arm-gcc4-fix
endif
+ifeq ($(DEB_HOST_ARCH),armeb)
+ debian_patches += arm-pic arm-nested-func arm-various arm-exception \
+ arm-const-double arm-tune arm-output-int libgcc-umodsi3 \
+ arm-profile arm-gcc4-fix arm-big-endian
+endif
all_patches += arm-pic arm-nested-func arm-various arm-exception \
arm-const-double arm-tune arm-output-int libgcc-umodsi3 \
- arm-profile arm-gcc4-fix
+ arm-profile arm-gcc4-fix arm-big-endian
ifeq ($(DEB_HOST_ARCH),m68k)
debian_patches += 68060-build gcc-m68k-pic m68k-md m68k-reload g77-m68k-pic
--- gcc-2.95-2.95.4.ds15/debian/patches/arm-big-endian.dpatch.orig 2005-10-11 13:20:53.000000000 +0200
+++ gcc-2.95-2.95.4.ds15/debian/patches/arm-big-endian.dpatch 2005-10-11 13:20:14.000000000 +0200
@@ -0,0 +1,89 @@
+#! /bin/sh -e
+
+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/config/arm/elf.h.orig 2005-10-11 13:14:35.000000000 +0200
++++ gcc/config/arm/elf.h 2005-10-11 13:17:23.000000000 +0200
+@@ -146,12 +146,12 @@
+ #define JUMP_TABLES_IN_TEXT_SECTION 1
+
+ #ifndef ASM_SPEC
+-#define ASM_SPEC "%{mbig-endian:-EB} %{mcpu=*:-m%*} %{march=*:-m%*} \
++#define ASM_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} %{mcpu=*:-m%*} %{march=*:-m%*} \
+ %{mapcs-*:-mapcs-%*} %{mthumb-interwork:-mthumb-interwork} %{mapcs-float:mfloat}"
+ #endif
+
+ #ifndef LINK_SPEC
+-#define LINK_SPEC "%{mbig-endian:-EB} -X"
++#define LINK_SPEC "%{mbig-endian:-EB} %{mlittle-endian:-EL} -X"
+ #endif
+
+ /* Run-time Target Specification. */
+--- gcc/config/arm/arm.h.orig 2005-10-11 13:14:42.000000000 +0200
++++ gcc/config/arm/arm.h 2005-10-11 13:17:23.000000000 +0200
+@@ -209,8 +209,8 @@
+ %{!mlittle-endian:%{!mbig-endian:%(cpp_endian_default)}} \
+ "
+
+-/* Default is little endian, which doesn't define anything. */
+-#define CPP_ENDIAN_DEFAULT_SPEC ""
++/* Default is big endian, which defines __ARMEB__ */
++#define CPP_ENDIAN_DEFAULT_SPEC "-D__ARMEB__"
+
+ #define CC1_SPEC ""
+
+--- gcc/config/arm/linux-elf.h.orig 2005-10-11 13:15:07.000000000 +0200
++++ gcc/config/arm/linux-elf.h 2005-10-11 13:17:52.000000000 +0200
+@@ -30,13 +30,13 @@
+
+ #ifndef SUBTARGET_DEFAULT_APCS26
+ /* Default is to use APCS-32 mode. */
+-# define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_SHORT_BYTE)
++# define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_SHORT_BYTE | ARM_FLAG_BIG_END)
+ # ifdef SUBTARGET_OLD_LINKER
+ # define SUBTARGET_EXTRA_LINK_SPEC \
+ " %{mapcs-26:-m elf32arm26} %{!mapcs-26:-m elf32arm}"
+ # else /* new linker */
+ # define SUBTARGET_EXTRA_LINK_SPEC \
+- " %{mapcs-26:-m armelf_linux26} %{!mapcs-26:-m armelf_linux} -p"
++ " %{mapcs-26:-m armelfb_linux26} %{!mapcs-26:-m armelfb_linux} -p"
+ # endif
+ # define SUBTARGET_EXTRA_ASM_SPEC \
+ " %{mapcs-26:-mapcs-26} %(!mapcs-26:-mapcs-32}"
+@@ -48,7 +48,7 @@
+ " %{mapcs-32:-m elf32arm} %{!mapcs-32:-m elf32arm26}"
+ # else /* new linker */
+ # define SUBTARGET_LINK_SPEC \
+- " %{mapcs-32:-m armelf_linux} %{!mapcs-32:-m armelf_linux26} -p"
++ " %{mapcs-32:-m armelfb_linux} %{!mapcs-32:-m armelfb_linux26} -p"
+ # endif
+ # define SUBTARGET_EXTRA_ASM_SPEC \
+ " %{mapcs-32:-mapcs-32} %(!mapcs-32:-mapcs-26}"
+@@ -98,7 +98,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
+
+ #undef CPP_PREDEFINES
Reply to: