[617118d] | 1 | # Source: http://sources.redhat.com/ml/crossgcc/2004-02/msg00104.html |
---|
| 2 | # |
---|
| 3 | # From: Dan Kegel <dank at kegel dot com> |
---|
| 4 | # To: Nicolas Pitre <nico at cam dot org> |
---|
| 5 | # Cc: add <addsub at eyou dot com>, Richard dot Earnshaw at arm dot com, |
---|
| 6 | # rearnsha at arm dot com, crossgcc at sources dot redhat dot com, |
---|
| 7 | # linux-arm at lists dot arm dot linux dot org dot uk |
---|
| 8 | # Date: Mon, 16 Feb 2004 22:49:35 -0800 |
---|
| 9 | # Subject: Re: problem while building arm vfp softfloat gcc |
---|
| 10 | # |
---|
| 11 | # Attached is a patch from addsub@eyou.com that he says patches glibc and |
---|
| 12 | # makes printf("%f", 1.0) work again. I haven't tested it, just wanted |
---|
| 13 | # to give Nico a chance to have a look at it. Not sure if addsub wrote |
---|
| 14 | # this himself or whether it's suitable for glibc mainline (I've asked him). |
---|
| 15 | # - Dan |
---|
| 16 | |
---|
| 17 | diff -uNrp glibc.old/sysdeps/arm/bits/endian.h glibc.new/sysdeps/arm/bits/endian.h |
---|
| 18 | --- glibc.old/sysdeps/arm/bits/endian.h 1999-04-12 11:59:13.000000000 -0400 |
---|
| 19 | +++ glibc.new/sysdeps/arm/bits/endian.h 2004-02-12 09:15:13.000000000 -0500 |
---|
| 20 | @@ -9,4 +9,9 @@ |
---|
| 21 | #else |
---|
| 22 | #define __BYTE_ORDER __LITTLE_ENDIAN |
---|
| 23 | #endif |
---|
| 24 | + |
---|
| 25 | +#ifdef __VFP_FP__ |
---|
| 26 | +#define __FLOAT_WORD_ORDER __BYTE_ORDER |
---|
| 27 | +#else |
---|
| 28 | #define __FLOAT_WORD_ORDER __BIG_ENDIAN |
---|
| 29 | +#endif |
---|
| 30 | diff -uNrp glibc.old/sysdeps/arm/gmp-mparam.h glibc.new/sysdeps/arm/gmp-mparam.h |
---|
| 31 | --- glibc.old/sysdeps/arm/gmp-mparam.h 2001-07-07 15:21:19.000000000 -0400 |
---|
| 32 | +++ glibc.new/sysdeps/arm/gmp-mparam.h 2004-02-12 09:15:13.000000000 -0500 |
---|
| 33 | @@ -26,5 +26,13 @@ MA 02111-1307, USA. */ |
---|
| 34 | #define BITS_PER_SHORTINT 16 |
---|
| 35 | #define BITS_PER_CHAR 8 |
---|
| 36 | |
---|
| 37 | -#define IEEE_DOUBLE_BIG_ENDIAN 0 |
---|
| 38 | -#define IEEE_DOUBLE_MIXED_ENDIAN 1 |
---|
| 39 | +#if defined(__ARMEB__) |
---|
| 40 | +# define IEEE_DOUBLE_MIXED_ENDIAN 0 |
---|
| 41 | +# define IEEE_DOUBLE_BIG_ENDIAN 1 |
---|
| 42 | +#elif defined(__VFP_FP__) |
---|
| 43 | +# define IEEE_DOUBLE_MIXED_ENDIAN 0 |
---|
| 44 | +# define IEEE_DOUBLE_BIG_ENDIAN 0 |
---|
| 45 | +#else |
---|
| 46 | +# define IEEE_DOUBLE_BIG_ENDIAN 0 |
---|
| 47 | +# define IEEE_DOUBLE_MIXED_ENDIAN 1 |
---|
| 48 | +#endif |
---|
| 49 | diff -uNrp glibc.old/sysdeps/arm/ieee754.h glibc.new/sysdeps/arm/ieee754.h |
---|
| 50 | --- glibc.old/sysdeps/arm/ieee754.h 2001-07-07 15:21:19.000000000 -0400 |
---|
| 51 | +++ glibc.new/sysdeps/arm/ieee754.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 52 | @@ -1,115 +0,0 @@ |
---|
| 53 | -/* Copyright (C) 1992, 1995, 1996, 1998 Free Software Foundation, Inc. |
---|
| 54 | - This file is part of the GNU C Library. |
---|
| 55 | - |
---|
| 56 | - The GNU C Library is free software; you can redistribute it and/or |
---|
| 57 | - modify it under the terms of the GNU Lesser General Public |
---|
| 58 | - License as published by the Free Software Foundation; either |
---|
| 59 | - version 2.1 of the License, or (at your option) any later version. |
---|
| 60 | - |
---|
| 61 | - The GNU C Library is distributed in the hope that it will be useful, |
---|
| 62 | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 63 | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 64 | - Lesser General Public License for more details. |
---|
| 65 | - |
---|
| 66 | - You should have received a copy of the GNU Lesser General Public |
---|
| 67 | - License along with the GNU C Library; if not, write to the Free |
---|
| 68 | - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
---|
| 69 | - 02111-1307 USA. */ |
---|
| 70 | - |
---|
| 71 | -#ifndef _IEEE754_H |
---|
| 72 | - |
---|
| 73 | -#define _IEEE754_H 1 |
---|
| 74 | -#include <features.h> |
---|
| 75 | - |
---|
| 76 | -#include <endian.h> |
---|
| 77 | - |
---|
| 78 | -__BEGIN_DECLS |
---|
| 79 | - |
---|
| 80 | -union ieee754_float |
---|
| 81 | - { |
---|
| 82 | - float f; |
---|
| 83 | - |
---|
| 84 | - /* This is the IEEE 754 single-precision format. */ |
---|
| 85 | - struct |
---|
| 86 | - { |
---|
| 87 | - unsigned int mantissa:23; |
---|
| 88 | - unsigned int exponent:8; |
---|
| 89 | - unsigned int negative:1; |
---|
| 90 | - } ieee; |
---|
| 91 | - |
---|
| 92 | - /* This format makes it easier to see if a NaN is a signalling NaN. */ |
---|
| 93 | - struct |
---|
| 94 | - { |
---|
| 95 | - unsigned int mantissa:22; |
---|
| 96 | - unsigned int quiet_nan:1; |
---|
| 97 | - unsigned int exponent:8; |
---|
| 98 | - unsigned int negative:1; |
---|
| 99 | - } ieee_nan; |
---|
| 100 | - }; |
---|
| 101 | - |
---|
| 102 | -#define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */ |
---|
| 103 | - |
---|
| 104 | - |
---|
| 105 | -union ieee754_double |
---|
| 106 | - { |
---|
| 107 | - double d; |
---|
| 108 | - |
---|
| 109 | - /* This is the IEEE 754 double-precision format. */ |
---|
| 110 | - struct |
---|
| 111 | - { |
---|
| 112 | - unsigned int mantissa0:20; |
---|
| 113 | - unsigned int exponent:11; |
---|
| 114 | - unsigned int negative:1; |
---|
| 115 | - unsigned int mantissa1:32; |
---|
| 116 | - } ieee; |
---|
| 117 | - |
---|
| 118 | - /* This format makes it easier to see if a NaN is a signalling NaN. */ |
---|
| 119 | - struct |
---|
| 120 | - { |
---|
| 121 | - unsigned int mantissa0:19; |
---|
| 122 | - unsigned int quiet_nan:1; |
---|
| 123 | - unsigned int exponent:11; |
---|
| 124 | - unsigned int negative:1; |
---|
| 125 | - unsigned int mantissa1:32; |
---|
| 126 | - } ieee_nan; |
---|
| 127 | - }; |
---|
| 128 | - |
---|
| 129 | -#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */ |
---|
| 130 | - |
---|
| 131 | - |
---|
| 132 | -/* The following two structures are correct for `new' floating point systems but |
---|
| 133 | - wrong for the old FPPC. The only solution seems to be to avoid their use on |
---|
| 134 | - old hardware. */ |
---|
| 135 | - |
---|
| 136 | -union ieee854_long_double |
---|
| 137 | - { |
---|
| 138 | - long double d; |
---|
| 139 | - |
---|
| 140 | - /* This is the IEEE 854 double-extended-precision format. */ |
---|
| 141 | - struct |
---|
| 142 | - { |
---|
| 143 | - unsigned int exponent:15; |
---|
| 144 | - unsigned int empty:16; |
---|
| 145 | - unsigned int negative:1; |
---|
| 146 | - unsigned int mantissa1:32; |
---|
| 147 | - unsigned int mantissa0:32; |
---|
| 148 | - } ieee; |
---|
| 149 | - |
---|
| 150 | - /* This is for NaNs in the IEEE 854 double-extended-precision format. */ |
---|
| 151 | - struct |
---|
| 152 | - { |
---|
| 153 | - unsigned int exponent:15; |
---|
| 154 | - unsigned int empty:16; |
---|
| 155 | - unsigned int negative:1; |
---|
| 156 | - unsigned int mantissa1:32; |
---|
| 157 | - unsigned int mantissa0:30; |
---|
| 158 | - unsigned int quiet_nan:1; |
---|
| 159 | - unsigned int one:1; |
---|
| 160 | - } ieee_nan; |
---|
| 161 | - }; |
---|
| 162 | - |
---|
| 163 | -#define IEEE854_LONG_DOUBLE_BIAS 0x3fff |
---|
| 164 | - |
---|
| 165 | -__END_DECLS |
---|
| 166 | - |
---|
| 167 | -#endif /* ieee754.h */ |
---|