summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0044-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch391
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.2/0034-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch342
2 files changed, 731 insertions, 2 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0044-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch b/meta/recipes-devtools/gcc/gcc-7.3/0044-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
index e39af9b1aa..f4dd891717 100644
--- a/meta/recipes-devtools/gcc/gcc-7.3/0044-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
+++ b/meta/recipes-devtools/gcc/gcc-7.3/0044-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch
@@ -36,14 +36,385 @@ diff --git a/libgcc/config/rs6000/t-linux b/libgcc/config/rs6000/t-linux
36index 4f6d4c4a4d2..c50dd94a2da 100644 36index 4f6d4c4a4d2..c50dd94a2da 100644
37--- a/libgcc/config/rs6000/t-linux 37--- a/libgcc/config/rs6000/t-linux
38+++ b/libgcc/config/rs6000/t-linux 38+++ b/libgcc/config/rs6000/t-linux
39@@ -1,3 +1,6 @@ 39@@ -1,3 +1,9 @@
40 SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-glibc.ver 40 SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-glibc.ver
41 41
42-HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-minimal-toc 42-HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-minimal-toc
43+ifeq ($(with_ldbl128),yes) 43+ifeq ($(with_ldbl128),yes)
44+HOST_LIBGCC2_CFLAGS += -mlong-double-128 44+HOST_LIBGCC2_CFLAGS += -mlong-double-128
45+else
46+# We do not want to build ibm-ldouble.c.
47+LIB2ADD := $(filter-out %ibm-ldouble.c, $(LIB2ADD))
45+endif 48+endif
46+HOST_LIBGCC2_CFLAGS += -mno-minimal-toc 49+HOST_LIBGCC2_CFLAGS += -mno-minimal-toc
50diff --git a/libgcc/config/rs6000/fixtfdi.c b/libgcc/config/rs6000/fixtfdi.c
51new file mode 100644
52index 0000000..9b979d0
53--- /dev/null
54+++ b/libgcc/config/rs6000/fixtfdi.c
55@@ -0,0 +1,42 @@
56+/* Software floating-point emulation.
57+ Convert a to 64bit signed integer
58+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
59+ This file is part of the GNU C Library.
60+ Contributed by Richard Henderson (rth@cygnus.com) and
61+ Jakub Jelinek (jj@ultra.linux.cz).
62+
63+ The GNU C Library is free software; you can redistribute it and/or
64+ modify it under the terms of the GNU Lesser General Public
65+ License as published by the Free Software Foundation; either
66+ version 2.1 of the License, or (at your option) any later version.
67+
68+ In addition to the permissions in the GNU Lesser General Public
69+ License, the Free Software Foundation gives you unlimited
70+ permission to link the compiled version of this file into
71+ combinations with other programs, and to distribute those
72+ combinations without any restriction coming from the use of this
73+ file. (The Lesser General Public License restrictions do apply in
74+ other respects; for example, they cover modification of the file,
75+ and distribution when not linked into a combine executable.)
76+
77+ The GNU C Library is distributed in the hope that it will be useful,
78+ but WITHOUT ANY WARRANTY; without even the implied warranty of
79+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
80+ Lesser General Public License for more details.
81+
82+ You should have received a copy of the GNU Lesser General Public
83+ License along with the GNU C Library; if not, see
84+ <http://www.gnu.org/licenses/>. */
85+
86+#ifdef _ARCH_PPC64
87+#include "soft-fp.h"
88+#include "quad-float128.h"
89+
90+DItype
91+__fixtfdi (TFtype a)
92+{
93+ if (a < 0)
94+ return - __fixunstfdi (-a);
95+ return __fixunstfdi (a);
96+}
97+#endif
98diff --git a/libgcc/config/rs6000/fixunstfdi.c b/libgcc/config/rs6000/fixunstfdi.c
99new file mode 100644
100index 0000000..65e9590
101--- /dev/null
102+++ b/libgcc/config/rs6000/fixunstfdi.c
103@@ -0,0 +1,58 @@
104+/* Software floating-point emulation.
105+ Convert a to 64bit unsigned integer
106+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
107+ This file is part of the GNU C Library.
108+ Contributed by Richard Henderson (rth@cygnus.com) and
109+ Jakub Jelinek (jj@ultra.linux.cz).
110+
111+ The GNU C Library is free software; you can redistribute it and/or
112+ modify it under the terms of the GNU Lesser General Public
113+ License as published by the Free Software Foundation; either
114+ version 2.1 of the License, or (at your option) any later version.
115+
116+ In addition to the permissions in the GNU Lesser General Public
117+ License, the Free Software Foundation gives you unlimited
118+ permission to link the compiled version of this file into
119+ combinations with other programs, and to distribute those
120+ combinations without any restriction coming from the use of this
121+ file. (The Lesser General Public License restrictions do apply in
122+ other respects; for example, they cover modification of the file,
123+ and distribution when not linked into a combine executable.)
124+
125+ The GNU C Library is distributed in the hope that it will be useful,
126+ but WITHOUT ANY WARRANTY; without even the implied warranty of
127+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
128+ Lesser General Public License for more details.
129+
130+ You should have received a copy of the GNU Lesser General Public
131+ License along with the GNU C Library; if not, see
132+ <http://www.gnu.org/licenses/>. */
133+
134+#ifdef _ARCH_PPC64
135+#include "soft-fp.h"
136+#include "quad-float128.h"
137+
138+DItype
139+__fixunstfdi (TFtype a)
140+{
141+ if (a < 0)
142+ return 0;
143+
144+ /* Compute high word of result, as a flonum. */
145+ const TFtype b = (a / (((UDItype) 1) << (sizeof (SItype) * 8)));
146+ /* Convert that to fixed (but not to DItype!),
147+ and shift it into the high word. */
148+ UDItype v = (USItype) b;
149+ v <<= (sizeof (SItype) * 8);
150+ /* Remove high part from the TFtype, leaving the low part as flonum. */
151+ a -= (TFtype) v;
152+ /* Convert that to fixed (but not to DItype!) and add it in.
153+ Sometimes A comes out negative. This is significant, since
154+ A has more bits than a long int does. */
155+ if (a < 0)
156+ v -= (USItype) (-a);
157+ else
158+ v += (USItype) a;
159+ return v;
160+}
161+#endif
162diff --git a/libgcc/config/rs6000/floatditf.c b/libgcc/config/rs6000/floatditf.c
163new file mode 100644
164index 0000000..20ad4c6
165--- /dev/null
166+++ b/libgcc/config/rs6000/floatditf.c
167@@ -0,0 +1,47 @@
168+/* Software floating-point emulation.
169+ Convert a 64bit signed integer to IEEE quad
170+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
171+ This file is part of the GNU C Library.
172+ Contributed by Richard Henderson (rth@cygnus.com) and
173+ Jakub Jelinek (jj@ultra.linux.cz).
174+
175+ The GNU C Library is free software; you can redistribute it and/or
176+ modify it under the terms of the GNU Lesser General Public
177+ License as published by the Free Software Foundation; either
178+ version 2.1 of the License, or (at your option) any later version.
179+
180+ In addition to the permissions in the GNU Lesser General Public
181+ License, the Free Software Foundation gives you unlimited
182+ permission to link the compiled version of this file into
183+ combinations with other programs, and to distribute those
184+ combinations without any restriction coming from the use of this
185+ file. (The Lesser General Public License restrictions do apply in
186+ other respects; for example, they cover modification of the file,
187+ and distribution when not linked into a combine executable.)
188+
189+ The GNU C Library is distributed in the hope that it will be useful,
190+ but WITHOUT ANY WARRANTY; without even the implied warranty of
191+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
192+ Lesser General Public License for more details.
193+
194+ You should have received a copy of the GNU Lesser General Public
195+ License along with the GNU C Library; if not, see
196+ <http://www.gnu.org/licenses/>. */
197+
198+#ifdef _ARCH_PPC64
199+#include "soft-fp.h"
200+#include "double.h"
201+#include "quad-float128.h"
202+
203+TFtype
204+__floatditf (DItype u)
205+{
206+ DFtype dh, dl;
207+
208+ dh = (SItype) (u >> (sizeof (SItype) * 8));
209+ dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
210+ dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
211+
212+ return (TFtype) dh + (TFtype) dl;
213+}
214+#endif
215diff --git a/libgcc/config/rs6000/floatunditf.c b/libgcc/config/rs6000/floatunditf.c
216new file mode 100644
217index 0000000..23dbde2
218--- /dev/null
219+++ b/libgcc/config/rs6000/floatunditf.c
220@@ -0,0 +1,47 @@
221+/* Software floating-point emulation.
222+ Convert a 64bit unsigned integer to IEEE quad
223+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
224+ This file is part of the GNU C Library.
225+ Contributed by Richard Henderson (rth@cygnus.com) and
226+ Jakub Jelinek (jj@ultra.linux.cz).
227+
228+ The GNU C Library is free software; you can redistribute it and/or
229+ modify it under the terms of the GNU Lesser General Public
230+ License as published by the Free Software Foundation; either
231+ version 2.1 of the License, or (at your option) any later version.
232+
233+ In addition to the permissions in the GNU Lesser General Public
234+ License, the Free Software Foundation gives you unlimited
235+ permission to link the compiled version of this file into
236+ combinations with other programs, and to distribute those
237+ combinations without any restriction coming from the use of this
238+ file. (The Lesser General Public License restrictions do apply in
239+ other respects; for example, they cover modification of the file,
240+ and distribution when not linked into a combine executable.)
241+
242+ The GNU C Library is distributed in the hope that it will be useful,
243+ but WITHOUT ANY WARRANTY; without even the implied warranty of
244+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
245+ Lesser General Public License for more details.
246+
247+ You should have received a copy of the GNU Lesser General Public
248+ License along with the GNU C Library; if not, see
249+ <http://www.gnu.org/licenses/>. */
250+
251+#ifdef _ARCH_PPC64
252+#include "soft-fp.h"
253+#include "double.h"
254+#include "quad-float128.h"
255+
256+TFtype
257+__floatunditf (UDItype u)
258+{
259+ DFtype dh, dl;
260+
261+ dh = (USItype) (u >> (sizeof (SItype) * 8));
262+ dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
263+ dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
264+
265+ return (TFtype) dh + (TFtype) dl;
266+}
267+#endif
268diff --git a/libgcc/config/rs6000/ppc64-fp.c b/libgcc/config/rs6000/ppc64-fp.c
269index 5e1cbdd..70ad3c9 100644
270--- a/libgcc/config/rs6000/ppc64-fp.c
271+++ b/libgcc/config/rs6000/ppc64-fp.c
272@@ -25,33 +25,20 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
273 <http://www.gnu.org/licenses/>. */
274
275 #if defined(__powerpc64__) || defined (__64BIT__) || defined(__ppc64__)
276-#define TMODES
277 #include "fp-bit.h"
278
279-extern DItype __fixtfdi (TFtype);
280 extern DItype __fixdfdi (DFtype);
281 extern DItype __fixsfdi (SFtype);
282 extern USItype __fixunsdfsi (DFtype);
283 extern USItype __fixunssfsi (SFtype);
284-extern TFtype __floatditf (DItype);
285-extern TFtype __floatunditf (UDItype);
286 extern DFtype __floatdidf (DItype);
287 extern DFtype __floatundidf (UDItype);
288 extern SFtype __floatdisf (DItype);
289 extern SFtype __floatundisf (UDItype);
290-extern DItype __fixunstfdi (TFtype);
291
292 static DItype local_fixunssfdi (SFtype);
293 static DItype local_fixunsdfdi (DFtype);
294
295-DItype
296-__fixtfdi (TFtype a)
297-{
298- if (a < 0)
299- return - __fixunstfdi (-a);
300- return __fixunstfdi (a);
301-}
302-
303 DItype
304 __fixdfdi (DFtype a)
305 {
306@@ -86,30 +73,6 @@ __fixunssfsi (SFtype a)
307 return (SItype) a;
308 }
309
310-TFtype
311-__floatditf (DItype u)
312-{
313- DFtype dh, dl;
314-
315- dh = (SItype) (u >> (sizeof (SItype) * 8));
316- dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
317- dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
318-
319- return (TFtype) dh + (TFtype) dl;
320-}
321-
322-TFtype
323-__floatunditf (UDItype u)
324-{
325- DFtype dh, dl;
326-
327- dh = (USItype) (u >> (sizeof (SItype) * 8));
328- dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
329- dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
330-
331- return (TFtype) dh + (TFtype) dl;
332-}
333-
334 DFtype
335 __floatdidf (DItype u)
336 {
337@@ -183,30 +146,6 @@ __floatundisf (UDItype u)
338 return (SFtype) f;
339 }
340
341-DItype
342-__fixunstfdi (TFtype a)
343-{
344- if (a < 0)
345- return 0;
346-
347- /* Compute high word of result, as a flonum. */
348- const TFtype b = (a / (((UDItype) 1) << (sizeof (SItype) * 8)));
349- /* Convert that to fixed (but not to DItype!),
350- and shift it into the high word. */
351- UDItype v = (USItype) b;
352- v <<= (sizeof (SItype) * 8);
353- /* Remove high part from the TFtype, leaving the low part as flonum. */
354- a -= (TFtype) v;
355- /* Convert that to fixed (but not to DItype!) and add it in.
356- Sometimes A comes out negative. This is significant, since
357- A has more bits than a long int does. */
358- if (a < 0)
359- v -= (USItype) (-a);
360- else
361- v += (USItype) a;
362- return v;
363-}
364-
365 /* This version is needed to prevent recursion; fixunsdfdi in libgcc
366 calls fixdfdi, which in turn calls calls fixunsdfdi. */
367
368diff --git a/libgcc/config/rs6000/quad-float128.h b/libgcc/config/rs6000/quad-float128.h
369index 7d69c87..a0c2664 100644
370--- a/libgcc/config/rs6000/quad-float128.h
371+++ b/libgcc/config/rs6000/quad-float128.h
372@@ -99,6 +99,11 @@ extern TItype_ppc __fixkfti (TFtype);
373 extern UTItype_ppc __fixunskfti (TFtype);
374 extern TFtype __floattikf (TItype_ppc);
375 extern TFtype __floatuntikf (UTItype_ppc);
376+
377+extern DItype_ppc __fixtfdi (TFtype);
378+extern DItype_ppc __fixunstfdi (TFtype);
379+extern TFtype __floatditf (DItype_ppc);
380+extern TFtype __floatunditf (UDItype_ppc);
381 #endif
382
383 /* Functions using the ISA 3.0 hardware support. If the code is compiled with
384diff --git a/libgcc/config/rs6000/t-float128 b/libgcc/config/rs6000/t-float128
385index 2c52ca6..3a241aa 100644
386--- a/libgcc/config/rs6000/t-float128
387+++ b/libgcc/config/rs6000/t-float128
388@@ -24,6 +24,7 @@ fp128_softfp_obj = $(fp128_softfp_static_obj) $(fp128_softfp_shared_obj)
389
390 # New functions for software emulation
391 fp128_ppc_funcs = floattikf floatuntikf fixkfti fixunskfti \
392+ floatditf floatunditf fixtfdi fixunstfdi \
393 extendkftf2-sw trunctfkf2-sw \
394 sfp-exceptions _mulkc3 _divkc3
395
396@@ -58,7 +59,7 @@ fp128_includes = $(srcdir)/soft-fp/double.h \
397 $(srcdir)/soft-fp/soft-fp.h
398
399 # Build the emulator without ISA 3.0 hardware support.
400-FP128_CFLAGS_SW = -Wno-type-limits -mvsx -mfloat128 \
401+FP128_CFLAGS_SW = -Wno-type-limits -mvsx -mfloat128 -mfloat128-type \
402 -mno-float128-hardware \
403 -I$(srcdir)/soft-fp \
404 -I$(srcdir)/config/rs6000 \
405diff --git a/libgcc/config/rs6000/t-float128-hw b/libgcc/config/rs6000/t-float128-hw
406index 161062f..0476874 100644
407--- a/libgcc/config/rs6000/t-float128-hw
408+++ b/libgcc/config/rs6000/t-float128-hw
409@@ -21,7 +21,7 @@ fp128_ifunc_obj = $(fp128_ifunc_static_obj) $(fp128_ifunc_shared_obj)
410 fp128_sed_hw = -hw
411
412 # Build the hardware support functions with appropriate hardware support
413-FP128_CFLAGS_HW = -Wno-type-limits -mvsx -mfloat128 \
414+FP128_CFLAGS_HW = -Wno-type-limits -mvsx -mfloat128 -mfloat128-type \
415 -mpower8-vector -mpower9-vector \
416 -mfloat128-hardware \
417 -I$(srcdir)/soft-fp \
47diff --git a/libgcc/configure b/libgcc/configure 418diff --git a/libgcc/configure b/libgcc/configure
48old mode 100644 419old mode 100644
49new mode 100755 420new mode 100755
@@ -96,6 +467,15 @@ index 45c459788c3..e2d19b144b8
96 # Check whether --with-aix-soname was given. 467 # Check whether --with-aix-soname was given.
97 if test "${with_aix_soname+set}" = set; then : 468 if test "${with_aix_soname+set}" = set; then :
98 withval=$with_aix_soname; case "${host}:${enable_shared}" in 469 withval=$with_aix_soname; case "${host}:${enable_shared}" in
470@@ -4999,7 +4999,7 @@ case ${host} in
471 # for hardware support.
472 powerpc*-*-linux*)
473 saved_CFLAGS="$CFLAGS"
474- CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128"
475+ CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128 -mfloat128-type"
476 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PowerPC ISA 2.06 to build __float128 libraries" >&5
477 $as_echo_n "checking for PowerPC ISA 2.06 to build __float128 libraries... " >&6; }
478 if test "${libgcc_cv_powerpc_float128+set}" = set; then :
99diff --git a/libgcc/configure.ac b/libgcc/configure.ac 479diff --git a/libgcc/configure.ac b/libgcc/configure.ac
100index af151473709..dada52416da 100644 480index af151473709..dada52416da 100644
101--- a/libgcc/configure.ac 481--- a/libgcc/configure.ac
@@ -119,6 +499,15 @@ index af151473709..dada52416da 100644
119 AC_ARG_WITH(aix-soname, 499 AC_ARG_WITH(aix-soname,
120 [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], 500 [AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
121 [shared library versioning (aka "SONAME") variant to provide on AIX])], 501 [shared library versioning (aka "SONAME") variant to provide on AIX])],
502@@ -394,7 +394,7 @@ case ${host} in
503 # for hardware support.
504 powerpc*-*-linux*)
505 saved_CFLAGS="$CFLAGS"
506- CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128"
507+ CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128 -mfloat128-type"
508 AC_CACHE_CHECK([for PowerPC ISA 2.06 to build __float128 libraries],
509 [libgcc_cv_powerpc_float128],
510 [AC_COMPILE_IFELSE(
122-- 511--
1232.12.2 5122.12.2
124 513
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