sync with buildroot2 from uclibc, cleanup, extract linuxsource in kernel-headers
[openwrt.git] / openwrt / toolchain / gcc / 3.4.0 / arm-softfloat.patch.conditional
1 #
2 # Submitted:
3 #
4 # Dimitry Andric <dimitry@andric.com>, 2004-05-01
5 #
6 # Description:
7 #
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
10 #
11 # This version has been adapted to work with gcc 3.4.0.
12 #
13 # The original patch doesn't distinguish between softfpa and softvfp modes
14 # in the way Nicholas Pitre probably meant. His description is:
15 #
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."
21 #
22 # Which means the following:
23 #
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:
27 #
28 # private flags = 600: [APCS-32] [VFP float format] [software FP]
29 #
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:
32 #
33 # private flags = 0: [APCS-32] [FPA float format]
34 #
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:
38 #
39 # private flags = 200: [APCS-32] [FPA float format] [software FP]
40 #
41 # The original patch from Nicholas Pitre contained the following constructs:
42 #
43 # #define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \
44 # %{mhard-float:-mfpu=fpa} \
45 # %{!mhard-float: %{msoft-float:-mfpu=softfpa;:-mfpu=softvfp}}"
46 #
47 # However, gcc doesn't accept this ";:" notation, used in the 3rd line. This
48 # is probably the reason Robert Schwebel modified it to:
49 #
50 # #define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \
51 # %{mhard-float:-mfpu=fpa} \
52 # %{!mhard-float: %{msoft-float:-mfpu=softfpa -mfpu=softvfp}}"
53 #
54 # But this causes the following behaviour:
55 #
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:
59 #
60 # private flags = 0: [APCS-32] [FPA float format]
61 #
62 # This is not correct!
63 #
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.
68 #
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:
72 #
73 # private flags = 600: [APCS-32] [VFP float format] [software FP]
74 #
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
77 # in this case).
78 #
79 # Therefore, I modified this patch to get the desired behaviour. Every
80 # instance of the notation:
81 #
82 # %{msoft-float:-mfpu=softfpa -mfpu=softvfp}
83 #
84 # was changed to:
85 #
86 # %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}
87 #
88 # I also did the following:
89 #
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.)
97
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
101 @@ -31,11 +31,16 @@
102 #define TARGET_VERSION fputs (" (ARM/coff)", stderr)
103
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 \
108 + | ARM_FLAG_VFP \
109 + | ARM_FLAG_APCS_32 \
110 + | ARM_FLAG_APCS_FRAME \
111 + | ARM_FLAG_MMU_TRAPS )
112
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" }
117 #endif
118 \f
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
123 @@ -46,7 +46,9 @@
124
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}}"
131 #endif
132
133 #ifndef ASM_SPEC
134 @@ -106,12 +108,17 @@
135 #endif
136
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 \
141 + | ARM_FLAG_VFP \
142 + | ARM_FLAG_APCS_32 \
143 + | ARM_FLAG_APCS_FRAME \
144 + | ARM_FLAG_MMU_TRAPS )
145 #endif
146
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" }
151 #endif
152 \f
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
157 @@ -30,9 +30,27 @@
158 /* Do not assume anything about header files. */
159 #define NO_IMPLICIT_EXTERN_C
160
161 -/* Default is to use APCS-32 mode. */
162 +/*
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.
169 + */
170 +
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 \
176 + | ARM_FLAG_VFP \
177 + | ARM_FLAG_MMU_TRAPS )
178 +
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}}"
184
185 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
186
187 @@ -40,7 +58,7 @@
188
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" }
193
194 #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
195
196 @@ -55,7 +73,7 @@
197 %{shared:-lc} \
198 %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
199
200 -#define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc"
201 +#define LIBGCC_SPEC "-lgcc"
202
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
208 @@ -4,7 +4,10 @@
209 LIBGCC2_DEBUG_CFLAGS = -g0
210
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
217
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
223 @@ -30,7 +30,12 @@
224
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 \
230 + | ARM_FLAG_VFP \
231 + | ARM_FLAG_APCS_32 \
232 + | ARM_FLAG_APCS_FRAME \
233 + | ARM_FLAG_MMU_TRAPS )
234 #endif
235
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
240 @@ -49,11 +49,12 @@
241 endian, regardless of the endian-ness of the memory
242 system. */
243
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}}"
251
252 #ifndef MULTILIB_DEFAULTS
253 #define MULTILIB_DEFAULTS \
254 - { "mlittle-endian", "mno-thumb-interwork", "marm", "msoft-float" }
255 + { "mlittle-endian", "mno-thumb-interwork", "marm" }
256 #endif
This page took 0.063995 seconds and 5 git commands to generate.