void-packages/srcpkgs/gcc/patches/fix-ppc64-float128-libstdc++.patch
q66 9e4b02efa9 gcc: add ppc64 support
--enable-vtable-verify causes ICEs on ppc64, so disable that,
also add arch specific bits everywhere else

the new patch is a backport from current gcc9/8.x tree, fixing
errors about "__float128 is not supported on this target" when
c++ math library on ppc64 and possibly other platforms (manifests
for example when building the bullet physics library)

we also need a patch for ppc64 musl, otherwise it will fail in
decimal float stuff, that one is taken from alpine linux

also serial-configure is broken for some cross targets, so
disable it

[ci skip]
2019-01-05 23:38:00 +01:00

287 lines
9.7 KiB
Diff

commit f65ae6e128fad98bd415ad1de158c30e81e1a7db
Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue Jul 31 09:38:28 2018 +0000
PR libstdc++/84654 Disable __float128 specializations for -mno-float128
diff --git libstdc++-v3/acinclude.m4 libstdc++-v3/acinclude.m4
index 3bd669a4cc8..4f37b6a6498 100644
--- libstdc++-v3/acinclude.m4
+++ libstdc++-v3/acinclude.m4
@@ -3062,7 +3062,7 @@ dnl Note: also checks that the types aren't standard types.
dnl
dnl Defines:
dnl _GLIBCXX_USE_INT128
-dnl _GLIBCXX_USE_FLOAT128
+dnl ENABLE_FLOAT128
dnl
AC_DEFUN([GLIBCXX_ENABLE_INT128_FLOAT128], [
@@ -3117,13 +3117,12 @@ EOF
AC_MSG_CHECKING([for __float128])
if AC_TRY_EVAL(ac_compile); then
- AC_DEFINE(_GLIBCXX_USE_FLOAT128, 1,
- [Define if __float128 is supported on this host.])
enable_float128=yes
else
enable_float128=no
fi
AC_MSG_RESULT($enable_float128)
+ GLIBCXX_CONDITIONAL(ENABLE_FLOAT128, test $enable_float128 = yes)
rm -f conftest*
AC_LANG_RESTORE
diff --git libstdc++-v3/config.h.in libstdc++-v3/config.h.in
index 5a0f0678439..765cedc6edf 100644
--- libstdc++-v3/config.h.in
+++ libstdc++-v3/config.h.in
@@ -918,9 +918,6 @@
/* Define if fchmodat is available in <sys/stat.h>. */
#undef _GLIBCXX_USE_FCHMODAT
-/* Define if __float128 is supported on this host. */
-#undef _GLIBCXX_USE_FLOAT128
-
/* Defined if gettimeofday is available. */
#undef _GLIBCXX_USE_GETTIMEOFDAY
diff --git libstdc++-v3/configure libstdc++-v3/configure
index fbc9daeb195..5535bfa2b5a 100755
--- libstdc++-v3/configure
+++ libstdc++-v3/configure
@@ -729,6 +729,8 @@ BASIC_FILE_H
CSTDIO_H
SECTION_FLAGS
WERROR
+ENABLE_FLOAT128_FALSE
+ENABLE_FLOAT128_TRUE
thread_header
glibcxx_PCHFLAGS
GLIBCXX_BUILD_PCH_FALSE
@@ -11606,7 +11608,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11609 "configure"
+#line 11611 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11712,7 +11714,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11715 "configure"
+#line 11717 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15398,7 +15400,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
# Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
-#line 15401 "configure"
+#line 15403 "configure"
int main()
{
typedef bool atomic_type;
@@ -15433,7 +15435,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15436 "configure"
+#line 15438 "configure"
int main()
{
typedef short atomic_type;
@@ -15468,7 +15470,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15471 "configure"
+#line 15473 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
@@ -15504,7 +15506,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15507 "configure"
+#line 15509 "configure"
int main()
{
typedef long long atomic_type;
@@ -15585,7 +15587,7 @@ $as_echo "$as_me: WARNING: Performance of certain classes will degrade as a resu
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 15588 "configure"
+#line 15590 "configure"
int main()
{
_Decimal32 d1;
@@ -15627,7 +15629,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 15630 "configure"
+#line 15632 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@@ -15661,7 +15663,7 @@ $as_echo "$enable_int128" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15664 "configure"
+#line 15666 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@@ -15683,15 +15685,13 @@ $as_echo_n "checking for __float128... " >&6; }
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
-
-$as_echo "#define _GLIBCXX_USE_FLOAT128 1" >>confdefs.h
-
enable_float128=yes
else
enable_float128=no
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_float128" >&5
$as_echo "$enable_float128" >&6; }
+
rm -f conftest*
ac_ext=c
@@ -81261,6 +81261,15 @@ else
fi
+ if test $enable_float128 = yes; then
+ ENABLE_FLOAT128_TRUE=
+ ENABLE_FLOAT128_FALSE='#'
+else
+ ENABLE_FLOAT128_TRUE='#'
+ ENABLE_FLOAT128_FALSE=
+fi
+
+
if test $enable_libstdcxx_allocator_flag = new; then
ENABLE_ALLOCATOR_NEW_TRUE=
ENABLE_ALLOCATOR_NEW_FALSE='#'
@@ -81804,6 +81813,10 @@ if test -z "${GLIBCXX_BUILD_PCH_TRUE}" && test -z "${GLIBCXX_BUILD_PCH_FALSE}";
as_fn_error "conditional \"GLIBCXX_BUILD_PCH\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_FLOAT128_TRUE}" && test -z "${ENABLE_FLOAT128_FALSE}"; then
+ as_fn_error "conditional \"ENABLE_FLOAT128\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${ENABLE_ALLOCATOR_NEW_TRUE}" && test -z "${ENABLE_ALLOCATOR_NEW_FALSE}"; then
as_fn_error "conditional \"ENABLE_ALLOCATOR_NEW\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git libstdc++-v3/include/Makefile.am libstdc++-v3/include/Makefile.am
index 70a662fa2f9..77e6dc2f6be 100644
--- libstdc++-v3/include/Makefile.am
+++ libstdc++-v3/include/Makefile.am
@@ -1230,6 +1230,14 @@ stamp-allocator-new:
echo 0 > stamp-allocator-new
endif
+if ENABLE_FLOAT128
+stamp-float128:
+ echo 'define _GLIBCXX_USE_FLOAT128 1' > stamp-float128
+else
+stamp-float128:
+ echo 'undef _GLIBCXX_USE_FLOAT128' > stamp-float128
+endif
+
# NB: The non-empty default ldbl_compat works around an AIX sed
# oddity, see libstdc++/31957 for details.
${host_builddir}/c++config.h: ${CONFIG_HEADER} \
@@ -1241,7 +1249,8 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
stamp-extern-template \
stamp-dual-abi \
stamp-cxx11-abi \
- stamp-allocator-new
+ stamp-allocator-new \
+ stamp-float128
@date=`cat ${toplevel_srcdir}/gcc/DATESTAMP` ;\
release=`sed 's/^\([0-9]*\).*$$/\1/' ${toplevel_srcdir}/gcc/BASE-VER` ;\
ns_version=`cat stamp-namespace-version` ;\
@@ -1250,6 +1259,7 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
dualabi=`cat stamp-dual-abi` ;\
cxx11abi=`cat stamp-cxx11-abi` ;\
allocatornew=`cat stamp-allocator-new` ;\
+ float128=`cat stamp-float128` ;\
ldbl_compat='s,g,g,' ;\
grep "^[ ]*#[ ]*define[ ][ ]*_GLIBCXX_LONG_DOUBLE_COMPAT[ ][ ]*1[ ]*$$" \
${CONFIG_HEADER} > /dev/null 2>&1 \
@@ -1262,6 +1272,7 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
-e "s,define _GLIBCXX_USE_DUAL_ABI, define _GLIBCXX_USE_DUAL_ABI $$dualabi," \
-e "s,define _GLIBCXX_USE_CXX11_ABI, define _GLIBCXX_USE_CXX11_ABI $$cxx11abi," \
-e "s,define _GLIBCXX_USE_ALLOCATOR_NEW, define _GLIBCXX_USE_ALLOCATOR_NEW $$allocatornew," \
+ -e "s,define _GLIBCXX_USE_FLOAT128,$$float128," \
-e "$$ldbl_compat" \
< ${glibcxx_srcdir}/include/bits/c++config > $@ ;\
sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \
diff --git libstdc++-v3/include/Makefile.in libstdc++-v3/include/Makefile.in
index 790887a259c..948a5c1f1c5 100644
--- libstdc++-v3/include/Makefile.in
+++ libstdc++-v3/include/Makefile.in
@@ -1662,6 +1662,11 @@ stamp-host: ${host_headers} ${bits_host_headers} ${ext_host_headers} ${host_head
@ENABLE_ALLOCATOR_NEW_FALSE@stamp-allocator-new:
@ENABLE_ALLOCATOR_NEW_FALSE@ echo 0 > stamp-allocator-new
+@ENABLE_FLOAT128_TRUE@stamp-float128:
+@ENABLE_FLOAT128_TRUE@ echo 'define _GLIBCXX_USE_FLOAT128 1' > stamp-float128
+@ENABLE_FLOAT128_FALSE@stamp-float128:
+@ENABLE_FLOAT128_FALSE@ echo 'undef _GLIBCXX_USE_FLOAT128' > stamp-float128
+
# NB: The non-empty default ldbl_compat works around an AIX sed
# oddity, see libstdc++/31957 for details.
${host_builddir}/c++config.h: ${CONFIG_HEADER} \
@@ -1673,7 +1678,8 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
stamp-extern-template \
stamp-dual-abi \
stamp-cxx11-abi \
- stamp-allocator-new
+ stamp-allocator-new \
+ stamp-float128
@date=`cat ${toplevel_srcdir}/gcc/DATESTAMP` ;\
release=`sed 's/^\([0-9]*\).*$$/\1/' ${toplevel_srcdir}/gcc/BASE-VER` ;\
ns_version=`cat stamp-namespace-version` ;\
@@ -1682,6 +1688,7 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
dualabi=`cat stamp-dual-abi` ;\
cxx11abi=`cat stamp-cxx11-abi` ;\
allocatornew=`cat stamp-allocator-new` ;\
+ float128=`cat stamp-float128` ;\
ldbl_compat='s,g,g,' ;\
grep "^[ ]*#[ ]*define[ ][ ]*_GLIBCXX_LONG_DOUBLE_COMPAT[ ][ ]*1[ ]*$$" \
${CONFIG_HEADER} > /dev/null 2>&1 \
@@ -1694,6 +1701,7 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
-e "s,define _GLIBCXX_USE_DUAL_ABI, define _GLIBCXX_USE_DUAL_ABI $$dualabi," \
-e "s,define _GLIBCXX_USE_CXX11_ABI, define _GLIBCXX_USE_CXX11_ABI $$cxx11abi," \
-e "s,define _GLIBCXX_USE_ALLOCATOR_NEW, define _GLIBCXX_USE_ALLOCATOR_NEW $$allocatornew," \
+ -e "s,define _GLIBCXX_USE_FLOAT128,$$float128," \
-e "$$ldbl_compat" \
< ${glibcxx_srcdir}/include/bits/c++config > $@ ;\
sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \
diff --git libstdc++-v3/include/bits/c++config libstdc++-v3/include/bits/c++config
index 1eb4679f67c..bfe268da825 100644
--- libstdc++-v3/include/bits/c++config
+++ libstdc++-v3/include/bits/c++config
@@ -609,4 +609,9 @@ namespace std
# endif
#endif
+/* Define if __float128 is supported on this host. */
+#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)
+#define _GLIBCXX_USE_FLOAT128
+#endif
+
// End of prewritten config; the settings discovered at configure time follow.