Bug#335116: glibc: Please add big-endian arm (armeb) support
Package: glibc
Severity: wishlist
Tags: patch
The attached patch adds support for the big-endian arm (armeb)
architecture to glibc. Changes:
1) Add 'armeb' to all the Architecture: lines; and
2) Add arm-float-byteorder.dpatch which:
1) fixes sysdeps/arm/gmp-mparam.h (__ARMEB__ has
IEEE_DOUBLE_BIG_ENDIAN=1 and IEEE_DOUBLE_MIXED_ENDIAN=0); and
2) deletes sysdeps/arm/ieee754.h, so that the generic ieee754.h
header is used instead, which is what we want because the generic
header honors __BYTE_ORDER and __FLOAT_WORD_ORDER while the
'forked' version of the header that arm uses does not.
-- 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)
--- glibc-2.3.5/debian/control.orig 2005-09-27 00:15:09.000000000 +0000
+++ glibc-2.3.5/debian/control 2005-09-27 00:15:35.000000000 +0000
@@ -38,7 +38,7 @@
by default. This created a package that unpacked to an excess of 30 megs.
Package: nscd
-Architecture: alpha amd64 arm i386 m68k mips mipsel powerpc sparc ia64 hppa s390 sh3 sh4 sh3eb sh4eb freebsd-i386
+Architecture: alpha amd64 arm armeb i386 m68k mips mipsel powerpc sparc ia64 hppa s390 sh3 sh4 sh3eb sh4eb freebsd-i386
Section: admin
Priority: optional
Depends: libc6 (>= ${Source-Version})
@@ -50,7 +50,7 @@
slow Services like LDAP, NIS or NIS+
Package: libc6
-Architecture: amd64 arm i386 m68k mips mipsel powerpc sparc s390 hppa sh3 sh4 sh3eb sh4eb
+Architecture: amd64 arm armeb i386 m68k mips mipsel powerpc sparc s390 hppa sh3 sh4 sh3eb sh4eb
Section: base
Priority: required
Provides: ${locale:Depends}
@@ -61,7 +61,7 @@
Timezone data is also included.
Package: libc6-dev
-Architecture: amd64 arm i386 m68k mips mipsel powerpc sparc s390 hppa sh3 sh4 sh3eb sh4eb
+Architecture: amd64 arm armeb i386 m68k mips mipsel powerpc sparc s390 hppa sh3 sh4 sh3eb sh4eb
Section: libdevel
Priority: standard
Depends: libc6 (= ${Source-Version})
@@ -71,7 +71,7 @@
and link programs which use the standard C library.
Package: libc6-dbg
-Architecture: amd64 arm i386 m68k mips mipsel powerpc sparc s390 hppa sh3 sh4 sh3eb sh4eb
+Architecture: amd64 arm armeb i386 m68k mips mipsel powerpc sparc s390 hppa sh3 sh4 sh3eb sh4eb
Section: libdevel
Priority: extra
Provides: libc-dbg
@@ -85,7 +85,7 @@
Most people will not need this package.
Package: libc6-prof
-Architecture: amd64 arm i386 m68k mips mipsel powerpc sparc s390 hppa sh3 sh4 sh3eb sh4eb
+Architecture: amd64 arm armeb i386 m68k mips mipsel powerpc sparc s390 hppa sh3 sh4 sh3eb sh4eb
Section: libdevel
Priority: extra
Depends: libc6 (= ${Source-Version})
@@ -94,7 +94,7 @@
with gprof.
Package: libc6-pic
-Architecture: amd64 arm i386 m68k mips mipsel powerpc sparc s390 hppa sh3 sh4 sh3eb sh4eb
+Architecture: amd64 arm armeb i386 m68k mips mipsel powerpc sparc s390 hppa sh3 sh4 sh3eb sh4eb
Section: libdevel
Priority: optional
Conflicts: libc-pic
@@ -109,7 +109,7 @@
Package: libc6-udeb
XC-Package-Type: udeb
-Architecture: amd64 arm i386 m68k mips mipsel powerpc sparc s390 hppa sh3 sh4 sh3eb sh4eb
+Architecture: amd64 arm armeb i386 m68k mips mipsel powerpc sparc s390 hppa sh3 sh4 sh3eb sh4eb
Section: debian-installer
Priority: extra
Provides: libc6, libc-udeb, ${locale:Depends}
--- glibc-2.3.5/debian/patches/arm-float-byteorder.dpatch.orig 2005-09-27 00:23:53.000000000 +0000
+++ glibc-2.3.5/debian/patches/arm-float-byteorder.dpatch 2005-09-27 00:23:20.000000000 +0000
@@ -0,0 +1,148 @@
+#! /bin/sh -e
+
+# DP: Description: fix float byte order on big-endian arm
+
+if [ $# -ne 2 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+case "$1" in
+ -patch) patch -d "$2" -f --no-backup-if-mismatch -p0 < $0;;
+ -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p0 < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+esac
+exit 0
+
+--- sysdeps/arm/gmp-mparam.h 2005-08-05 08:57:26.000000000 +0000
++++ sysdeps/arm/gmp-mparam.h 2005-08-05 08:57:48.000000000 +0000
+@@ -26,5 +26,10 @@
+ #define BITS_PER_SHORTINT 16
+ #define BITS_PER_CHAR 8
+
++#ifdef __ARMEB__
++#define IEEE_DOUBLE_BIG_ENDIAN 1
++#define IEEE_DOUBLE_MIXED_ENDIAN 0
++#else
+ #define IEEE_DOUBLE_BIG_ENDIAN 0
+ #define IEEE_DOUBLE_MIXED_ENDIAN 1
++#endif
+--- sysdeps/arm/ieee754.h 2001-07-07 19:21:19.000000000 +0000
++++ sysdeps/arm/ieee754.h 1970-01-01 00:00:00.000000000 +0000
+@@ -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 <features.h>
+-
+-#include <endian.h>
+-
+-__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 */
--- glibc-2.3.5/debian/patches/00list.orig 2005-09-27 00:22:27.000000000 +0000
+++ glibc-2.3.5/debian/patches/00list 2005-09-27 00:23:12.000000000 +0000
@@ -36,6 +36,7 @@
50_glibc232-m68k-dwarf2-buildfix
#arm-output-format # g: suspended
arm-ioperm
+arm-float-byteorder
#glibc-make-check-perms # g: suspended
glibc-2.3.2-ldconfig-tls
glibc23-mips-msq
--- glibc-2.3.5/debian/rules.d/control.mk.orig 2005-10-01 09:56:32.000000000 +0000
+++ glibc-2.3.5/debian/rules.d/control.mk 2005-10-01 09:56:38.000000000 +0000
@@ -1,10 +1,10 @@
control_deps := $(addprefix debian/control.in/, libc6 libc6.1 libc0.3 libc1 sparc64 s390x ppc64 opt)
-threads_archs := alpha amd64 arm i386 m68k mips mipsel powerpc sparc ia64 hppa s390 sh3 sh4 sh3eb sh4eb freebsd-i386
+threads_archs := alpha amd64 arm armeb i386 m68k mips mipsel powerpc sparc ia64 hppa s390 sh3 sh4 sh3eb sh4eb freebsd-i386
debian/control.in/libc6: debian/control.in/libc debian/rules.d/control.mk
sed -e 's%@libc@%libc6%g' \
- -e 's%@archs@%amd64 arm i386 m68k mips mipsel powerpc sparc s390 hppa sh3 sh4 sh3eb sh4eb%g' < $< > $@
+ -e 's%@archs@%amd64 arm armeb i386 m68k mips mipsel powerpc sparc s390 hppa sh3 sh4 sh3eb sh4eb%g' < $< > $@
debian/control.in/libc6.1: debian/control.in/libc debian/rules.d/control.mk
sed -e 's%@libc@%libc6.1%g;s%@archs@%alpha ia64%g' < $< > $@
Reply to: