summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-8.2/0034-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
diff options
context:
space:
mode:
authorSerhey Popovych <serhe.popovych@gmail.com>2018-12-14 19:54:40 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-15 17:10:52 +0000
commit9eedf05a34d158883067311f6727cdb4ba1115e3 (patch)
tree1bad3b8b1aabfa436b36cd365b91657ee754a825 /meta/recipes-devtools/gcc/gcc-8.2/0034-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
parente0aabf14427b77f503d609a114633b7f082c265a (diff)
downloadpoky-9eedf05a34d158883067311f6727cdb4ba1115e3.tar.gz
gcc: More places to patch to disable ldbl 128 for musl on PPC
There are four functions using TFmode type (128bit) that isn't available when building with musl. Move each of them from common ppc64-fp.c to individual files referenced from t-float128 that used when ldbl 128 enabled at configure time. For gcc-7.3 if -mfloat128 is given -mfloat128-type must be given too. Exclude ibm-ldouble.c when ldbl 128 isn't enabled at config time. Build and boot tested with musl (no float128) and glibc (float128 and ibm128 on PowerPC64). (From OE-Core rev: dec8e566810525563b33c2877d10db0a70965d6d) Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-8.2/0034-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.2/0034-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch342
1 files changed, 341 insertions, 1 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-8.2/0034-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch b/meta/recipes-devtools/gcc/gcc-8.2/0034-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
index 7a69ea2806..391cda71d7 100644
--- a/meta/recipes-devtools/gcc/gcc-8.2/0034-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
+++ b/meta/recipes-devtools/gcc/gcc-8.2/0034-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
@@ -37,14 +37,354 @@ diff --git a/libgcc/config/rs6000/t-linux b/libgcc/config/rs6000/t-linux
37index 4f6d4c4a4d2..c50dd94a2da 100644 37index 4f6d4c4a4d2..c50dd94a2da 100644
38--- a/libgcc/config/rs6000/t-linux 38--- a/libgcc/config/rs6000/t-linux
39+++ b/libgcc/config/rs6000/t-linux 39+++ b/libgcc/config/rs6000/t-linux
40@@ -1,3 +1,6 @@ 40@@ -1,3 +1,9 @@
41 SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-glibc.ver 41 SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-glibc.ver
42 42
43-HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-minimal-toc 43-HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-minimal-toc
44+ifeq ($(with_ldbl128),yes) 44+ifeq ($(with_ldbl128),yes)
45+HOST_LIBGCC2_CFLAGS += -mlong-double-128 45+HOST_LIBGCC2_CFLAGS += -mlong-double-128
46+else
47+# We do not want to build ibm-ldouble.c.
48+LIB2ADD := $(filter-out %ibm-ldouble.c, $(LIB2ADD))
46+endif 49+endif
47+HOST_LIBGCC2_CFLAGS += -mno-minimal-toc 50+HOST_LIBGCC2_CFLAGS += -mno-minimal-toc
51diff --git a/libgcc/config/rs6000/fixtfdi.c b/libgcc/config/rs6000/fixtfdi.c
52--- a/libgcc/config/rs6000/fixtfdi.c 1969-12-31 19:00:00.000000000 -0500
53+++ b/libgcc/config/rs6000/fixtfdi.c 2018-12-12 17:54:50.110755540 -0500
54@@ -0,0 +1,42 @@
55+/* Software floating-point emulation.
56+ Convert a to 64bit signed integer
57+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
58+ This file is part of the GNU C Library.
59+ Contributed by Richard Henderson (rth@cygnus.com) and
60+ Jakub Jelinek (jj@ultra.linux.cz).
61+
62+ The GNU C Library is free software; you can redistribute it and/or
63+ modify it under the terms of the GNU Lesser General Public
64+ License as published by the Free Software Foundation; either
65+ version 2.1 of the License, or (at your option) any later version.
66+
67+ In addition to the permissions in the GNU Lesser General Public
68+ License, the Free Software Foundation gives you unlimited
69+ permission to link the compiled version of this file into
70+ combinations with other programs, and to distribute those
71+ combinations without any restriction coming from the use of this
72+ file. (The Lesser General Public License restrictions do apply in
73+ other respects; for example, they cover modification of the file,
74+ and distribution when not linked into a combine executable.)
75+
76+ The GNU C Library is distributed in the hope that it will be useful,
77+ but WITHOUT ANY WARRANTY; without even the implied warranty of
78+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
79+ Lesser General Public License for more details.
80+
81+ You should have received a copy of the GNU Lesser General Public
82+ License along with the GNU C Library; if not, see
83+ <http://www.gnu.org/licenses/>. */
84+
85+#ifdef _ARCH_PPC64
86+#include "soft-fp.h"
87+#include "quad-float128.h"
88+
89+DItype
90+__fixtfdi (TFtype a)
91+{
92+ if (a < 0)
93+ return - __fixunstfdi (-a);
94+ return __fixunstfdi (a);
95+}
96+#endif
97diff --git a/libgcc/config/rs6000/fixunstfdi.c b/libgcc/config/rs6000/fixunstfdi.c
98--- a/libgcc/config/rs6000/fixunstfdi.c 1969-12-31 19:00:00.000000000 -0500
99+++ b/libgcc/config/rs6000/fixunstfdi.c 2018-12-12 17:56:06.141654537 -0500
100@@ -0,0 +1,58 @@
101+/* Software floating-point emulation.
102+ Convert a to 64bit unsigned integer
103+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
104+ This file is part of the GNU C Library.
105+ Contributed by Richard Henderson (rth@cygnus.com) and
106+ Jakub Jelinek (jj@ultra.linux.cz).
107+
108+ The GNU C Library is free software; you can redistribute it and/or
109+ modify it under the terms of the GNU Lesser General Public
110+ License as published by the Free Software Foundation; either
111+ version 2.1 of the License, or (at your option) any later version.
112+
113+ In addition to the permissions in the GNU Lesser General Public
114+ License, the Free Software Foundation gives you unlimited
115+ permission to link the compiled version of this file into
116+ combinations with other programs, and to distribute those
117+ combinations without any restriction coming from the use of this
118+ file. (The Lesser General Public License restrictions do apply in
119+ other respects; for example, they cover modification of the file,
120+ and distribution when not linked into a combine executable.)
121+
122+ The GNU C Library is distributed in the hope that it will be useful,
123+ but WITHOUT ANY WARRANTY; without even the implied warranty of
124+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
125+ Lesser General Public License for more details.
126+
127+ You should have received a copy of the GNU Lesser General Public
128+ License along with the GNU C Library; if not, see
129+ <http://www.gnu.org/licenses/>. */
130+
131+#ifdef _ARCH_PPC64
132+#include "soft-fp.h"
133+#include "quad-float128.h"
134+
135+DItype
136+__fixunstfdi (TFtype a)
137+{
138+ if (a < 0)
139+ return 0;
140+
141+ /* Compute high word of result, as a flonum. */
142+ const TFtype b = (a / (((UDItype) 1) << (sizeof (SItype) * 8)));
143+ /* Convert that to fixed (but not to DItype!),
144+ and shift it into the high word. */
145+ UDItype v = (USItype) b;
146+ v <<= (sizeof (SItype) * 8);
147+ /* Remove high part from the TFtype, leaving the low part as flonum. */
148+ a -= (TFtype) v;
149+ /* Convert that to fixed (but not to DItype!) and add it in.
150+ Sometimes A comes out negative. This is significant, since
151+ A has more bits than a long int does. */
152+ if (a < 0)
153+ v -= (USItype) (-a);
154+ else
155+ v += (USItype) a;
156+ return v;
157+}
158+#endif
159diff --git a/libgcc/config/rs6000/floatditf.c b/libgcc/config/rs6000/floatditf.c
160--- a/libgcc/config/rs6000/floatditf.c 1969-12-31 19:00:00.000000000 -0500
161+++ b/libgcc/config/rs6000/floatditf.c 2018-12-12 17:57:55.852953553 -0500
162@@ -0,0 +1,47 @@
163+/* Software floating-point emulation.
164+ Convert a 64bit signed integer to IEEE quad
165+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
166+ This file is part of the GNU C Library.
167+ Contributed by Richard Henderson (rth@cygnus.com) and
168+ Jakub Jelinek (jj@ultra.linux.cz).
169+
170+ The GNU C Library is free software; you can redistribute it and/or
171+ modify it under the terms of the GNU Lesser General Public
172+ License as published by the Free Software Foundation; either
173+ version 2.1 of the License, or (at your option) any later version.
174+
175+ In addition to the permissions in the GNU Lesser General Public
176+ License, the Free Software Foundation gives you unlimited
177+ permission to link the compiled version of this file into
178+ combinations with other programs, and to distribute those
179+ combinations without any restriction coming from the use of this
180+ file. (The Lesser General Public License restrictions do apply in
181+ other respects; for example, they cover modification of the file,
182+ and distribution when not linked into a combine executable.)
183+
184+ The GNU C Library is distributed in the hope that it will be useful,
185+ but WITHOUT ANY WARRANTY; without even the implied warranty of
186+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
187+ Lesser General Public License for more details.
188+
189+ You should have received a copy of the GNU Lesser General Public
190+ License along with the GNU C Library; if not, see
191+ <http://www.gnu.org/licenses/>. */
192+
193+#ifdef _ARCH_PPC64
194+#include "soft-fp.h"
195+#include "double.h"
196+#include "quad-float128.h"
197+
198+TFtype
199+__floatditf (DItype u)
200+{
201+ DFtype dh, dl;
202+
203+ dh = (SItype) (u >> (sizeof (SItype) * 8));
204+ dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
205+ dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
206+
207+ return (TFtype) dh + (TFtype) dl;
208+}
209+#endif
210diff --git a/libgcc/config/rs6000/floatunditf.c b/libgcc/config/rs6000/floatunditf.c
211--- a/libgcc/config/rs6000/floatunditf.c 1969-12-31 19:00:00.000000000 -0500
212+++ b/libgcc/config/rs6000/floatunditf.c 2018-12-12 17:57:15.262473574 -0500
213@@ -0,0 +1,47 @@
214+/* Software floating-point emulation.
215+ Convert a 64bit unsigned integer to IEEE quad
216+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
217+ This file is part of the GNU C Library.
218+ Contributed by Richard Henderson (rth@cygnus.com) and
219+ Jakub Jelinek (jj@ultra.linux.cz).
220+
221+ The GNU C Library is free software; you can redistribute it and/or
222+ modify it under the terms of the GNU Lesser General Public
223+ License as published by the Free Software Foundation; either
224+ version 2.1 of the License, or (at your option) any later version.
225+
226+ In addition to the permissions in the GNU Lesser General Public
227+ License, the Free Software Foundation gives you unlimited
228+ permission to link the compiled version of this file into
229+ combinations with other programs, and to distribute those
230+ combinations without any restriction coming from the use of this
231+ file. (The Lesser General Public License restrictions do apply in
232+ other respects; for example, they cover modification of the file,
233+ and distribution when not linked into a combine executable.)
234+
235+ The GNU C Library is distributed in the hope that it will be useful,
236+ but WITHOUT ANY WARRANTY; without even the implied warranty of
237+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
238+ Lesser General Public License for more details.
239+
240+ You should have received a copy of the GNU Lesser General Public
241+ License along with the GNU C Library; if not, see
242+ <http://www.gnu.org/licenses/>. */
243+
244+#ifdef _ARCH_PPC64
245+#include "soft-fp.h"
246+#include "double.h"
247+#include "quad-float128.h"
248+
249+TFtype
250+__floatunditf (UDItype u)
251+{
252+ DFtype dh, dl;
253+
254+ dh = (USItype) (u >> (sizeof (SItype) * 8));
255+ dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
256+ dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
257+
258+ return (TFtype) dh + (TFtype) dl;
259+}
260+#endif
261diff --git a/libgcc/config/rs6000/ppc64-fp.c b/libgcc/config/rs6000/ppc64-fp.c
262--- a/libgcc/config/rs6000/ppc64-fp.c 2018-12-12 17:53:49.540038500 -0500
263+++ b/libgcc/config/rs6000/ppc64-fp.c 2018-12-12 17:49:51.897235314 -0500
264@@ -25,34 +25,21 @@
265 <http://www.gnu.org/licenses/>. */
266
267 #if defined(__powerpc64__) || defined (__64BIT__) || defined(__ppc64__)
268-#define TMODES
269 #include "fp-bit.h"
270
271-extern DItype __fixtfdi (TFtype);
272 extern DItype __fixdfdi (DFtype);
273 extern DItype __fixsfdi (SFtype);
274 extern USItype __fixunsdfsi (DFtype);
275 extern USItype __fixunssfsi (SFtype);
276-extern TFtype __floatditf (DItype);
277-extern TFtype __floatunditf (UDItype);
278 extern DFtype __floatdidf (DItype);
279 extern DFtype __floatundidf (UDItype);
280 extern SFtype __floatdisf (DItype);
281 extern SFtype __floatundisf (UDItype);
282-extern DItype __fixunstfdi (TFtype);
283
284 static DItype local_fixunssfdi (SFtype);
285 static DItype local_fixunsdfdi (DFtype);
286
287 DItype
288-__fixtfdi (TFtype a)
289-{
290- if (a < 0)
291- return - __fixunstfdi (-a);
292- return __fixunstfdi (a);
293-}
294-
295-DItype
296 __fixdfdi (DFtype a)
297 {
298 if (a < 0)
299@@ -86,30 +73,6 @@
300 return (SItype) a;
301 }
302
303-TFtype
304-__floatditf (DItype u)
305-{
306- DFtype dh, dl;
307-
308- dh = (SItype) (u >> (sizeof (SItype) * 8));
309- dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
310- dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
311-
312- return (TFtype) dh + (TFtype) dl;
313-}
314-
315-TFtype
316-__floatunditf (UDItype u)
317-{
318- DFtype dh, dl;
319-
320- dh = (USItype) (u >> (sizeof (SItype) * 8));
321- dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
322- dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
323-
324- return (TFtype) dh + (TFtype) dl;
325-}
326-
327 DFtype
328 __floatdidf (DItype u)
329 {
330@@ -183,30 +146,6 @@
331 return (SFtype) f;
332 }
333
334-DItype
335-__fixunstfdi (TFtype a)
336-{
337- if (a < 0)
338- return 0;
339-
340- /* Compute high word of result, as a flonum. */
341- const TFtype b = (a / (((UDItype) 1) << (sizeof (SItype) * 8)));
342- /* Convert that to fixed (but not to DItype!),
343- and shift it into the high word. */
344- UDItype v = (USItype) b;
345- v <<= (sizeof (SItype) * 8);
346- /* Remove high part from the TFtype, leaving the low part as flonum. */
347- a -= (TFtype) v;
348- /* Convert that to fixed (but not to DItype!) and add it in.
349- Sometimes A comes out negative. This is significant, since
350- A has more bits than a long int does. */
351- if (a < 0)
352- v -= (USItype) (-a);
353- else
354- v += (USItype) a;
355- return v;
356-}
357-
358 /* This version is needed to prevent recursion; fixunsdfdi in libgcc
359 calls fixdfdi, which in turn calls calls fixunsdfdi. */
360
361diff --git a/libgcc/config/rs6000/quad-float128.h b/libgcc/config/rs6000/quad-float128.h
362--- a/libgcc/config/rs6000/quad-float128.h 2018-12-12 17:53:49.540038500 -0500
363+++ b/libgcc/config/rs6000/quad-float128.h 2018-12-12 17:30:19.423468244 -0500
364@@ -104,6 +104,11 @@
365 extern UTItype_ppc __fixunskfti (TFtype);
366 extern TFtype __floattikf (TItype_ppc);
367 extern TFtype __floatuntikf (UTItype_ppc);
368+
369+extern DItype_ppc __fixtfdi (TFtype);
370+extern DItype_ppc __fixunstfdi (TFtype);
371+extern TFtype __floatditf (DItype_ppc);
372+extern TFtype __floatunditf (UDItype_ppc);
373 #endif
374
375 /* Functions using the ISA 3.0 hardware support. If the code is compiled with
376diff --git a/libgcc/config/rs6000/t-float128 b/libgcc/config/rs6000/t-float128
377--- a/libgcc/config/rs6000/t-float128 2018-12-12 17:53:49.540038500 -0500
378+++ b/libgcc/config/rs6000/t-float128 2018-12-12 17:45:12.233937136 -0500
379@@ -24,6 +24,7 @@
380
381 # New functions for software emulation
382 fp128_ppc_funcs = floattikf floatuntikf fixkfti fixunskfti \
383+ floatditf floatunditf fixtfdi fixunstfdi \
384 extendkftf2-sw trunctfkf2-sw \
385 sfp-exceptions _mulkc3 _divkc3 _powikf2
386
387
48diff --git a/libgcc/configure b/libgcc/configure 388diff --git a/libgcc/configure b/libgcc/configure
49old mode 100644 389old mode 100644
50new mode 100755 390new mode 100755