4 # Dimitry Andric <dimitry@andric.com>, 2004-05-01
8 # Nicholas Pitre released this patch for gcc soft-float support here:
9 # http://lists.arm.linux.org.uk/pipermail/linux-arm/2003-October/006436.html
11 # This version has been adapted to work with gcc 3.4.0.
13 # The original patch doesn't distinguish between softfpa and softvfp modes
14 # in the way Nicholas Pitre probably meant. His description is:
16 # "Default is to use APCS-32 mode with soft-vfp. The old Linux default for
17 # floats can be achieved with -mhard-float or with the configure
18 # --with-float=hard option. If -msoft-float or --with-float=soft is used then
19 # software float support will be used just like the default but with the legacy
20 # big endian word ordering for double float representation instead."
22 # Which means the following:
24 # * If you compile without -mhard-float or -msoft-float, you should get
25 # software floating point, using the VFP format. The produced object file
26 # should have these flags in its header:
28 # private flags = 600: [APCS-32] [VFP float format] [software FP]
30 # * If you compile with -mhard-float, you should get hardware floating point,
31 # which always uses the FPA format. Object file header flags should be:
33 # private flags = 0: [APCS-32] [FPA float format]
35 # * If you compile with -msoft-float, you should get software floating point,
36 # using the FPA format. This is done for compatibility reasons with many
37 # existing distributions. Object file header flags should be:
39 # private flags = 200: [APCS-32] [FPA float format] [software FP]
41 # The original patch from Nicholas Pitre contained the following constructs:
43 # #define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \
44 # %{mhard-float:-mfpu=fpa} \
45 # %{!mhard-float: %{msoft-float:-mfpu=softfpa;:-mfpu=softvfp}}"
47 # However, gcc doesn't accept this ";:" notation, used in the 3rd line. This
48 # is probably the reason Robert Schwebel modified it to:
50 # #define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \
51 # %{mhard-float:-mfpu=fpa} \
52 # %{!mhard-float: %{msoft-float:-mfpu=softfpa -mfpu=softvfp}}"
54 # But this causes the following behaviour:
56 # * If you compile without -mhard-float or -msoft-float, the compiler generates
57 # software floating point instructions, but *nothing* is passed to the
58 # assembler, which results in an object file which has flags:
60 # private flags = 0: [APCS-32] [FPA float format]
62 # This is not correct!
64 # * If you compile with -mhard-float, the compiler generates hardware floating
65 # point instructions, and passes "-mfpu=fpa" to the assembler, which results
66 # in an object file which has the same flags as in the previous item, but now
67 # those *are* correct.
69 # * If you compile with -msoft-float, the compiler generates software floating
70 # point instructions, and passes "-mfpu=softfpa -mfpu=softvfp" (in that
71 # order) to the assembler, which results in an object file with flags:
73 # private flags = 600: [APCS-32] [VFP float format] [software FP]
75 # This is not correct, because the last "-mfpu=" option on the assembler
76 # command line determines the actual FPU convention used (which should be FPA
79 # Therefore, I modified this patch to get the desired behaviour. Every
80 # instance of the notation:
82 # %{msoft-float:-mfpu=softfpa -mfpu=softvfp}
86 # %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}
88 # I also did the following:
90 # * Modified all TARGET_DEFAULT macros I could find to include ARM_FLAG_VFP, to
91 # be consistent with Nicholas' original patch.
92 # * Removed any "msoft-float" or "mhard-float" from all MULTILIB_DEFAULTS
93 # macros I could find. I think that if you compile without any options, you
94 # would like to get the defaults. :)
95 # * Removed the extra -lfloat option from LIBGCC_SPEC, since it isn't needed
96 # anymore. (The required functions are now in libgcc.)
98 diff -urNd gcc-3.4.0-orig/gcc/config/arm/coff.h gcc-3.4.0/gcc/config/arm/coff.h
99 --- gcc-3.4.0-orig/gcc/config/arm/coff.h 2004-02-24 15:25:22.000000000 +0100
100 +++ gcc-3.4.0/gcc/config/arm/coff.h 2004-05-01 19:07:06.059409600 +0200
102 #define TARGET_VERSION fputs (" (ARM/coff)", stderr)
104 #undef TARGET_DEFAULT
105 -#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS)
106 +#define TARGET_DEFAULT \
107 + ( ARM_FLAG_SOFT_FLOAT \
109 + | ARM_FLAG_APCS_32 \
110 + | ARM_FLAG_APCS_FRAME \
111 + | ARM_FLAG_MMU_TRAPS )
113 #ifndef MULTILIB_DEFAULTS
114 #define MULTILIB_DEFAULTS \
115 - { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork" }
116 + { "marm", "mlittle-endian", "mapcs-32", "mno-thumb-interwork" }
119 /* This is COFF, but prefer stabs. */
120 diff -urNd gcc-3.4.0-orig/gcc/config/arm/elf.h gcc-3.4.0/gcc/config/arm/elf.h
121 --- gcc-3.4.0-orig/gcc/config/arm/elf.h 2004-02-24 15:25:22.000000000 +0100
122 +++ gcc-3.4.0/gcc/config/arm/elf.h 2004-05-01 19:12:16.976486400 +0200
125 #ifndef SUBTARGET_ASM_FLOAT_SPEC
126 #define SUBTARGET_ASM_FLOAT_SPEC "\
127 -%{mapcs-float:-mfloat} %{msoft-float:-mfpu=softfpa}"
128 +%{mapcs-float:-mfloat} \
129 +%{mhard-float:-mfpu=fpa} \
130 +%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}"
134 @@ -106,12 +108,17 @@
137 #ifndef TARGET_DEFAULT
138 -#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS)
139 +#define TARGET_DEFAULT \
140 + ( ARM_FLAG_SOFT_FLOAT \
142 + | ARM_FLAG_APCS_32 \
143 + | ARM_FLAG_APCS_FRAME \
144 + | ARM_FLAG_MMU_TRAPS )
147 #ifndef MULTILIB_DEFAULTS
148 #define MULTILIB_DEFAULTS \
149 - { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork", "fno-leading-underscore" }
150 + { "marm", "mlittle-endian", "mapcs-32", "mno-thumb-interwork", "fno-leading-underscore" }
153 #define TARGET_ASM_FILE_START_APP_OFF true
154 diff -urNd gcc-3.4.0-orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h
155 --- gcc-3.4.0-orig/gcc/config/arm/linux-elf.h 2004-01-31 07:18:11.000000000 +0100
156 +++ gcc-3.4.0/gcc/config/arm/linux-elf.h 2004-05-01 19:19:06.935979200 +0200
158 /* Do not assume anything about header files. */
159 #define NO_IMPLICIT_EXTERN_C
161 -/* Default is to use APCS-32 mode. */
163 + * Default is to use APCS-32 mode with soft-vfp.
164 + * The old Linux default for floats can be achieved with -mhard-float
165 + * or with the configure --with-float=hard option.
166 + * If -msoft-float or --with-float=soft is used then software float
167 + * support will be used just like the default but with the legacy
168 + * big endian word ordering for double float representation instead.
171 #undef TARGET_DEFAULT
172 -#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS)
173 +#define TARGET_DEFAULT \
174 + ( ARM_FLAG_APCS_32 \
175 + | ARM_FLAG_SOFT_FLOAT \
177 + | ARM_FLAG_MMU_TRAPS )
179 +#undef SUBTARGET_EXTRA_ASM_SPEC
180 +#define SUBTARGET_EXTRA_ASM_SPEC "\
181 +%{!mcpu=*:-mcpu=xscale} \
182 +%{mhard-float:-mfpu=fpa} \
183 +%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}"
185 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
189 #undef MULTILIB_DEFAULTS
190 #define MULTILIB_DEFAULTS \
191 - { "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" }
192 + { "marm", "mlittle-endian", "mapcs-32", "mno-thumb-interwork" }
194 #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
198 %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
200 -#define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc"
201 +#define LIBGCC_SPEC "-lgcc"
203 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add
204 the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
205 diff -urNd gcc-3.4.0-orig/gcc/config/arm/t-linux gcc-3.4.0/gcc/config/arm/t-linux
206 --- gcc-3.4.0-orig/gcc/config/arm/t-linux 2003-09-20 23:09:07.000000000 +0200
207 +++ gcc-3.4.0/gcc/config/arm/t-linux 2004-05-01 20:31:59.102846400 +0200
209 LIBGCC2_DEBUG_CFLAGS = -g0
211 LIB1ASMSRC = arm/lib1funcs.asm
212 -LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx
213 +LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
214 + _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
215 + _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
216 + _fixsfsi _fixunssfsi
218 # MULTILIB_OPTIONS = mhard-float/msoft-float
219 # MULTILIB_DIRNAMES = hard-float soft-float
220 diff -urNd gcc-3.4.0-orig/gcc/config/arm/unknown-elf.h gcc-3.4.0/gcc/config/arm/unknown-elf.h
221 --- gcc-3.4.0-orig/gcc/config/arm/unknown-elf.h 2004-02-24 15:25:22.000000000 +0100
222 +++ gcc-3.4.0/gcc/config/arm/unknown-elf.h 2004-05-01 19:09:09.016212800 +0200
225 /* Default to using APCS-32 and software floating point. */
226 #ifndef TARGET_DEFAULT
227 -#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS)
228 +#define TARGET_DEFAULT \
229 + ( ARM_FLAG_SOFT_FLOAT \
231 + | ARM_FLAG_APCS_32 \
232 + | ARM_FLAG_APCS_FRAME \
233 + | ARM_FLAG_MMU_TRAPS )
236 /* Now we define the strings used to build the spec file. */
237 diff -urNd gcc-3.4.0-orig/gcc/config/arm/xscale-elf.h gcc-3.4.0/gcc/config/arm/xscale-elf.h
238 --- gcc-3.4.0-orig/gcc/config/arm/xscale-elf.h 2003-07-02 01:26:43.000000000 +0200
239 +++ gcc-3.4.0/gcc/config/arm/xscale-elf.h 2004-05-01 20:15:36.620105600 +0200
241 endian, regardless of the endian-ness of the memory
244 -#define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \
245 - %{mhard-float:-mfpu=fpa} \
246 - %{!mhard-float: %{msoft-float:-mfpu=softfpa;:-mfpu=softvfp}}"
247 +#define SUBTARGET_EXTRA_ASM_SPEC "\
248 +%{!mcpu=*:-mcpu=xscale} \
249 +%{mhard-float:-mfpu=fpa} \
250 +%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}"
252 #ifndef MULTILIB_DEFAULTS
253 #define MULTILIB_DEFAULTS \
254 - { "mlittle-endian", "mno-thumb-interwork", "marm", "msoft-float" }
255 + { "mlittle-endian", "mno-thumb-interwork", "marm" }