summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-7.3
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-7.3
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-7.3')
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.3/0044-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch391
1 files changed, 390 insertions, 1 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