patches/gcc/3.4.4/arm-softfloat.patch
changeset 330 447b203edc2e
parent 329 419d959441ed
child 331 0c05f9ea3254
     1.1 --- a/patches/gcc/3.4.4/arm-softfloat.patch	Tue Aug 14 19:32:22 2007 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,270 +0,0 @@
     1.4 -Note... modified my mjn3 to not conflict with the big endian arm patch.
     1.5 -Warning!!!  Only the linux target is aware of TARGET_ENDIAN_DEFAULT.
     1.6 -Also changed
     1.7 -  #define SUBTARGET_EXTRA_ASM_SPEC "\
     1.8 -  %{!mcpu=*:-mcpu=xscale} \
     1.9 -  %{mhard-float:-mfpu=fpa} \
    1.10 -  %{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}"
    1.11 -to
    1.12 -  #define SUBTARGET_EXTRA_ASM_SPEC "\
    1.13 -  %{mhard-float:-mfpu=fpa} \
    1.14 -  %{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}"
    1.15 -in gcc/config/arm/linux-elf.h.
    1.16 -#
    1.17 -# Submitted:
    1.18 -#
    1.19 -# Dimitry Andric <dimitry@andric.com>, 2004-05-01
    1.20 -#
    1.21 -# Description:
    1.22 -#
    1.23 -# Nicholas Pitre released this patch for gcc soft-float support here: 
    1.24 -# http://lists.arm.linux.org.uk/pipermail/linux-arm/2003-October/006436.html
    1.25 -#
    1.26 -# This version has been adapted to work with gcc 3.4.0.
    1.27 -#
    1.28 -# The original patch doesn't distinguish between softfpa and softvfp modes
    1.29 -# in the way Nicholas Pitre probably meant.  His description is:
    1.30 -#
    1.31 -# "Default is to use APCS-32 mode with soft-vfp.  The old Linux default for
    1.32 -# floats can be achieved with -mhard-float or with the configure
    1.33 -# --with-float=hard option.  If -msoft-float or --with-float=soft is used then
    1.34 -# software float support will be used just like the default but with the legacy
    1.35 -# big endian word ordering for double float representation instead."
    1.36 -#
    1.37 -# Which means the following:
    1.38 -#
    1.39 -# * If you compile without -mhard-float or -msoft-float, you should get
    1.40 -#   software floating point, using the VFP format.  The produced object file
    1.41 -#   should have these flags in its header:
    1.42 -#
    1.43 -#     private flags = 600: [APCS-32] [VFP float format] [software FP]
    1.44 -#
    1.45 -# * If you compile with -mhard-float, you should get hardware floating point,
    1.46 -#   which always uses the FPA format.  Object file header flags should be:
    1.47 -#
    1.48 -#     private flags = 0: [APCS-32] [FPA float format]
    1.49 -#
    1.50 -# * If you compile with -msoft-float, you should get software floating point,
    1.51 -#   using the FPA format.  This is done for compatibility reasons with many
    1.52 -#   existing distributions.  Object file header flags should be:
    1.53 -#
    1.54 -#     private flags = 200: [APCS-32] [FPA float format] [software FP]
    1.55 -#
    1.56 -# The original patch from Nicholas Pitre contained the following constructs:
    1.57 -#
    1.58 -#   #define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \
    1.59 -#     %{mhard-float:-mfpu=fpa} \
    1.60 -#     %{!mhard-float: %{msoft-float:-mfpu=softfpa;:-mfpu=softvfp}}"
    1.61 -#
    1.62 -# However, gcc doesn't accept this ";:" notation, used in the 3rd line.  This
    1.63 -# is probably the reason Robert Schwebel modified it to:
    1.64 -#
    1.65 -#   #define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \
    1.66 -#     %{mhard-float:-mfpu=fpa} \
    1.67 -#     %{!mhard-float: %{msoft-float:-mfpu=softfpa -mfpu=softvfp}}"
    1.68 -#
    1.69 -# But this causes the following behaviour:
    1.70 -#
    1.71 -# * If you compile without -mhard-float or -msoft-float, the compiler generates
    1.72 -#   software floating point instructions, but *nothing* is passed to the
    1.73 -#   assembler, which results in an object file which has flags:
    1.74 -#
    1.75 -#     private flags = 0: [APCS-32] [FPA float format]
    1.76 -#
    1.77 -#   This is not correct!
    1.78 -#
    1.79 -# * If you compile with -mhard-float, the compiler generates hardware floating
    1.80 -#   point instructions, and passes "-mfpu=fpa" to the assembler, which results
    1.81 -#   in an object file which has the same flags as in the previous item, but now
    1.82 -#   those *are* correct.
    1.83 -#    
    1.84 -# * If you compile with -msoft-float, the compiler generates software floating
    1.85 -#   point instructions, and passes "-mfpu=softfpa -mfpu=softvfp" (in that
    1.86 -#   order) to the assembler, which results in an object file with flags:
    1.87 -#
    1.88 -#   private flags = 600: [APCS-32] [VFP float format] [software FP]
    1.89 -#
    1.90 -#   This is not correct, because the last "-mfpu=" option on the assembler
    1.91 -#   command line determines the actual FPU convention used (which should be FPA
    1.92 -#   in this case).
    1.93 -#
    1.94 -# Therefore, I modified this patch to get the desired behaviour.  Every
    1.95 -# instance of the notation:
    1.96 -#
    1.97 -#   %{msoft-float:-mfpu=softfpa -mfpu=softvfp}
    1.98 -#
    1.99 -# was changed to:
   1.100 -#
   1.101 -#   %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}
   1.102 -#
   1.103 -# I also did the following:
   1.104 -# 
   1.105 -# * Modified all TARGET_DEFAULT macros I could find to include ARM_FLAG_VFP, to
   1.106 -#   be consistent with Nicholas' original patch.
   1.107 -# * Removed any "msoft-float" or "mhard-float" from all MULTILIB_DEFAULTS
   1.108 -#   macros I could find.  I think that if you compile without any options, you
   1.109 -#   would like to get the defaults. :)
   1.110 -# * Removed the extra -lfloat option from LIBGCC_SPEC, since it isn't needed
   1.111 -#   anymore.  (The required functions are now in libgcc.)
   1.112 -
   1.113 -diff -urN gcc-3.4.1-old/gcc/config/arm/coff.h gcc-3.4.1/gcc/config/arm/coff.h
   1.114 ---- gcc-3.4.1-old/gcc/config/arm/coff.h	2004-02-24 08:25:22.000000000 -0600
   1.115 -+++ gcc-3.4.1/gcc/config/arm/coff.h	2004-09-02 21:51:15.000000000 -0500
   1.116 -@@ -31,11 +31,16 @@
   1.117 - #define TARGET_VERSION fputs (" (ARM/coff)", stderr)
   1.118 - 
   1.119 - #undef  TARGET_DEFAULT
   1.120 --#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS)
   1.121 -+#define TARGET_DEFAULT		\
   1.122 -+	( ARM_FLAG_SOFT_FLOAT	\
   1.123 -+	| ARM_FLAG_VFP		\
   1.124 -+	| ARM_FLAG_APCS_32	\
   1.125 -+	| ARM_FLAG_APCS_FRAME	\
   1.126 -+	| ARM_FLAG_MMU_TRAPS )
   1.127 - 
   1.128 - #ifndef MULTILIB_DEFAULTS
   1.129 - #define MULTILIB_DEFAULTS \
   1.130 --  { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork" }
   1.131 -+  { "marm", "mlittle-endian", "mapcs-32", "mno-thumb-interwork" }
   1.132 - #endif
   1.133 - 
   1.134 - /* This is COFF, but prefer stabs.  */
   1.135 -diff -urN gcc-3.4.1-old/gcc/config/arm/elf.h gcc-3.4.1/gcc/config/arm/elf.h
   1.136 ---- gcc-3.4.1-old/gcc/config/arm/elf.h	2004-02-24 08:25:22.000000000 -0600
   1.137 -+++ gcc-3.4.1/gcc/config/arm/elf.h	2004-09-02 21:51:15.000000000 -0500
   1.138 -@@ -46,7 +46,9 @@
   1.139 - 
   1.140 - #ifndef SUBTARGET_ASM_FLOAT_SPEC
   1.141 - #define SUBTARGET_ASM_FLOAT_SPEC "\
   1.142 --%{mapcs-float:-mfloat} %{msoft-float:-mfpu=softfpa}"
   1.143 -+%{mapcs-float:-mfloat} \
   1.144 -+%{mhard-float:-mfpu=fpa} \
   1.145 -+%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}"
   1.146 - #endif
   1.147 - 
   1.148 - #ifndef ASM_SPEC
   1.149 -@@ -106,12 +108,17 @@
   1.150 - #endif
   1.151 - 
   1.152 - #ifndef TARGET_DEFAULT
   1.153 --#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS)
   1.154 -+#define TARGET_DEFAULT		\
   1.155 -+	( ARM_FLAG_SOFT_FLOAT	\
   1.156 -+	| ARM_FLAG_VFP		\
   1.157 -+	| ARM_FLAG_APCS_32	\
   1.158 -+	| ARM_FLAG_APCS_FRAME	\
   1.159 -+	| ARM_FLAG_MMU_TRAPS )
   1.160 - #endif
   1.161 - 
   1.162 - #ifndef MULTILIB_DEFAULTS
   1.163 - #define MULTILIB_DEFAULTS \
   1.164 --  { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork", "fno-leading-underscore" }
   1.165 -+  { "marm", "mlittle-endian", "mapcs-32", "mno-thumb-interwork", "fno-leading-underscore" }
   1.166 - #endif
   1.167 - 
   1.168 - #define TARGET_ASM_FILE_START_APP_OFF true
   1.169 -diff -urN gcc-3.4.1-old/gcc/config/arm/linux-elf.h gcc-3.4.1/gcc/config/arm/linux-elf.h
   1.170 ---- gcc-3.4.1-old/gcc/config/arm/linux-elf.h	2004-09-02 21:50:52.000000000 -0500
   1.171 -+++ gcc-3.4.1/gcc/config/arm/linux-elf.h	2004-09-02 22:00:49.000000000 -0500
   1.172 -@@ -44,12 +44,26 @@
   1.173 - #define TARGET_LINKER_EMULATION "armelf_linux"
   1.174 - #endif
   1.175 - 
   1.176 --/* Default is to use APCS-32 mode.  */
   1.177 -+/*
   1.178 -+ * Default is to use APCS-32 mode with soft-vfp.
   1.179 -+ * The old Linux default for floats can be achieved with -mhard-float
   1.180 -+ * or with the configure --with-float=hard option.
   1.181 -+ * If -msoft-float or --with-float=soft is used then software float 
   1.182 -+ * support will be used just like the default but with the legacy
   1.183 -+ * big endian word ordering for double float representation instead.
   1.184 -+ */
   1.185 - #undef  TARGET_DEFAULT
   1.186 --#define TARGET_DEFAULT \
   1.187 --		( ARM_FLAG_APCS_32 | \
   1.188 --		  ARM_FLAG_MMU_TRAPS | \
   1.189 --		  TARGET_ENDIAN_DEFAULT )
   1.190 -+#define TARGET_DEFAULT		\
   1.191 -+	( ARM_FLAG_APCS_32	\
   1.192 -+	| ARM_FLAG_SOFT_FLOAT	\
   1.193 -+	| TARGET_ENDIAN_DEFAULT	\
   1.194 -+	| ARM_FLAG_VFP		\
   1.195 -+	| ARM_FLAG_MMU_TRAPS )
   1.196 -+
   1.197 -+#undef  SUBTARGET_EXTRA_ASM_SPEC
   1.198 -+#define SUBTARGET_EXTRA_ASM_SPEC "\
   1.199 -+%{mhard-float:-mfpu=fpa} \
   1.200 -+%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}"
   1.201 - 
   1.202 - #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
   1.203 - 
   1.204 -@@ -57,7 +71,7 @@
   1.205 - 
   1.206 - #undef  MULTILIB_DEFAULTS
   1.207 - #define MULTILIB_DEFAULTS \
   1.208 --	{ "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" }
   1.209 -+	{ "marm", TARGET_ENDIAN_OPTION, "mapcs-32", "mno-thumb-interwork" }
   1.210 - 
   1.211 - #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
   1.212 - 
   1.213 -@@ -72,7 +86,7 @@
   1.214 -    %{shared:-lc} \
   1.215 -    %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
   1.216 - 
   1.217 --#define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc"
   1.218 -+#define LIBGCC_SPEC "-lgcc"
   1.219 - 
   1.220 - /* Provide a STARTFILE_SPEC appropriate for GNU/Linux.  Here we add
   1.221 -    the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
   1.222 -diff -urN gcc-3.4.1-old/gcc/config/arm/t-linux gcc-3.4.1/gcc/config/arm/t-linux
   1.223 ---- gcc-3.4.1-old/gcc/config/arm/t-linux	2003-09-20 16:09:07.000000000 -0500
   1.224 -+++ gcc-3.4.1/gcc/config/arm/t-linux	2004-09-02 21:51:15.000000000 -0500
   1.225 -@@ -4,7 +4,10 @@
   1.226 - LIBGCC2_DEBUG_CFLAGS = -g0
   1.227 - 
   1.228 - LIB1ASMSRC = arm/lib1funcs.asm
   1.229 --LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx
   1.230 -+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
   1.231 -+	_negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
   1.232 -+	_truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
   1.233 -+	_fixsfsi _fixunssfsi
   1.234 - 
   1.235 - # MULTILIB_OPTIONS = mhard-float/msoft-float
   1.236 - # MULTILIB_DIRNAMES = hard-float soft-float
   1.237 -diff -urN gcc-3.4.1-old/gcc/config/arm/unknown-elf.h gcc-3.4.1/gcc/config/arm/unknown-elf.h
   1.238 ---- gcc-3.4.1-old/gcc/config/arm/unknown-elf.h	2004-02-24 08:25:22.000000000 -0600
   1.239 -+++ gcc-3.4.1/gcc/config/arm/unknown-elf.h	2004-09-02 21:51:15.000000000 -0500
   1.240 -@@ -30,7 +30,12 @@
   1.241 - 
   1.242 - /* Default to using APCS-32 and software floating point.  */
   1.243 - #ifndef TARGET_DEFAULT
   1.244 --#define TARGET_DEFAULT	(ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS)
   1.245 -+#define TARGET_DEFAULT		\
   1.246 -+	( ARM_FLAG_SOFT_FLOAT	\
   1.247 -+	| ARM_FLAG_VFP		\
   1.248 -+	| ARM_FLAG_APCS_32	\
   1.249 -+	| ARM_FLAG_APCS_FRAME	\
   1.250 -+	| ARM_FLAG_MMU_TRAPS )
   1.251 - #endif
   1.252 - 
   1.253 - /* Now we define the strings used to build the spec file.  */
   1.254 -diff -urN gcc-3.4.1-old/gcc/config/arm/xscale-elf.h gcc-3.4.1/gcc/config/arm/xscale-elf.h
   1.255 ---- gcc-3.4.1-old/gcc/config/arm/xscale-elf.h	2003-07-01 18:26:43.000000000 -0500
   1.256 -+++ gcc-3.4.1/gcc/config/arm/xscale-elf.h	2004-09-02 21:51:15.000000000 -0500
   1.257 -@@ -49,11 +49,12 @@
   1.258 - 		     endian, regardless of the endian-ness of the memory
   1.259 - 		     system.  */
   1.260 - 		     
   1.261 --#define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \
   1.262 --  %{mhard-float:-mfpu=fpa} \
   1.263 --  %{!mhard-float: %{msoft-float:-mfpu=softfpa;:-mfpu=softvfp}}"
   1.264 -+#define SUBTARGET_EXTRA_ASM_SPEC "\
   1.265 -+%{!mcpu=*:-mcpu=xscale} \
   1.266 -+%{mhard-float:-mfpu=fpa} \
   1.267 -+%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}"
   1.268 - 
   1.269 - #ifndef MULTILIB_DEFAULTS
   1.270 - #define MULTILIB_DEFAULTS \
   1.271 --  { "mlittle-endian", "mno-thumb-interwork", "marm", "msoft-float" }
   1.272 -+  { "mlittle-endian", "mno-thumb-interwork", "marm" }
   1.273 - #endif