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]
This commit is contained in:
q66 2018-12-10 21:05:18 +01:00 committed by Enno Boland
parent 237e8e6f1e
commit 9e4b02efa9
3 changed files with 402 additions and 4 deletions

View File

@ -0,0 +1,76 @@
From 47467f3ab0fb2f2fcede81060fe8bb339d0909eb Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Wed, 28 Feb 2018 00:54:05 +0000
Subject: [PATCH 10/12] ldbl128 config
---
gcc/configure | 13 +++++++++++++
gcc/configure.ac | 16 ++++++++++++++--
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git gcc/configure gcc/configure
index 6121e163259..07ff8597d48 100755
--- gcc/configure
+++ gcc/configure
@@ -29309,6 +29309,15 @@ if test "${with_long_double_128+set}" = set; then :
withval=$with_long_double_128; gcc_cv_target_ldbl128="$with_long_double_128"
else
+ case "$target" in
+ s390*-*-linux-musl*)
+ gcc_cv_target_ldbl128=yes
+ ;;
+ powerpc*-*-linux-musl*)
+ gcc_cv_target_ldbl128=no
+ ;;
+ *)
+
if test $glibc_version_major -gt 2 \
|| ( test $glibc_version_major -eq 2 && test $glibc_version_minor -ge 4 ); then :
gcc_cv_target_ldbl128=yes
@@ -29320,6 +29329,10 @@ else
&& gcc_cv_target_ldbl128=yes
fi
+
+ ;;
+ esac
+
fi
;;
diff --git gcc/configure.ac gcc/configure.ac
index b066cc609e1..6c15ed898c0 100644
--- gcc/configure.ac
+++ gcc/configure.ac
@@ -5971,13 +5971,25 @@ case "$target" in
AC_ARG_WITH(long-double-128,
[AS_HELP_STRING([--with-long-double-128],
[use 128-bit long double by default])],
- gcc_cv_target_ldbl128="$with_long_double_128",
+ gcc_cv_target_ldbl128="$with_long_double_128", [
+ case "$target" in
+ s390*-*-linux-musl*)
+ gcc_cv_target_ldbl128=yes
+ ;;
+ powerpc*-*-linux-musl*)
+ gcc_cv_target_ldbl128=no
+ ;;
+ *)]
[GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_target_ldbl128=yes], [
[gcc_cv_target_ldbl128=no
grep '^[ ]*#[ ]*define[ ][ ]*__LONG_DOUBLE_MATH_OPTIONAL' \
$target_header_dir/bits/wordsize.h > /dev/null 2>&1 \
&& gcc_cv_target_ldbl128=yes
- ]])])
+ ]])]
+ [
+ ;;
+ esac
+ ])
;;
esac
if test x$gcc_cv_target_ldbl128 = xyes; then
--
2.17.1

View File

@ -0,0 +1,287 @@
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.

View File

@ -96,6 +96,9 @@ case "$XBPS_TARGET_MACHINE" in
armv7l-musl) _triplet="armv7l-linux-musleabihf";;
aarch64) _triplet="aarch64-linux-gnu";;
aarch64-musl) _triplet="aarch64-linux-musl";;
ppc64le) _triplet="powerpc64le-linux-gnu";;
ppc64le-musl) _triplet="powerpc64le-linux-musl";;
ppc64-musl) _triplet="powerpc64-linux-musl";;
mips-musl) _triplet="mips-linux-musl";;
mipshf-musl) _triplet="mips-linux-muslhf";;
mipsel-musl) _triplet="mipsel-linux-musl";;
@ -112,6 +115,9 @@ case "$XBPS_TARGET_MACHINE" in
subpackages+=" libquadmath libquadmath-devel"
subpackages+=" libvtv libvtv-devel"
;;
ppc64le)
subpackages+=" libquadmath libquadmath-devel"
;;
esac
case "$XBPS_TARGET_MACHINE" in
mips*) ;;
@ -169,12 +175,32 @@ do_configure() {
_args+=" --with-arch=armv8-a"
sed -i '/m64=/s/lib64/lib/' gcc/config/aarch64/t-aarch64-linux
;;
ppc64le*) # use lib not lib64 by default
_args+=" --with-cpu=powerpc64le --with-abi=elfv2"
sed -i '/OSDIRNAMES/s/lib64/lib/' gcc/config/rs6000/t-linux
sed -i '/m64=/s/lib64/lib/' gcc/config/rs6000/t-linux64
sed -i 's/lib64/lib/' gcc/config/rs6000/linux64.h
;;
ppc64*) # use lib not lib64 by default
_args+=" --with-cpu=powerpc64 --with-abi=elfv2"
sed -i '/OSDIRNAMES/s/lib64/lib/' gcc/config/rs6000/t-linux
sed -i '/m64=/s/lib64/lib/' gcc/config/rs6000/t-linux64
sed -i 's/lib64/lib/' gcc/config/rs6000/linux64.h
;;
x86_64*) # use lib not lib64 by default
sed -i '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64
sed -i 's/lib64/lib/' gcc/config/i386/linux64.h
;;
esac
# fix: unknown long double size, cannot define BFP_FMT
case "$XBPS_TARGET_MACHINE" in
ppc64le-musl|ppc64-musl)
_args+=" --enable-decimal-float=no --disable-libquadmath --enable-secureplt"
;;
*) ;;
esac
if [ -z "$CHROOT_READY" -o -n "$CROSS_BUILD" ]; then
_langs="c,c++,lto"
fi
@ -216,6 +242,11 @@ do_configure() {
;;
esac
case "$XBPS_TARGET_MACHINE" in
ppc64*) _args+=" --disable-vtable-verify";;
*) _args+=" --enable-vtable-verify";;
esac
export CFLAGS="${CFLAGS/-D_FORTIFY_SOURCE=2/}"
export CXXFLAGS="${CXXFLAGS/-D_FORTIFY_SOURCE=2/}"
@ -236,9 +267,7 @@ do_configure() {
_args+=" --enable-shared"
_args+=" --enable-lto"
_args+=" --enable-plugins"
_args+=" --enable-vtable-verify"
_args+=" --enable-linker-build-id"
_args+=" --enable-serial-configure"
_args+=" --disable-werror"
_args+=" --disable-nls"
_args+=" --enable-default-pie"
@ -250,6 +279,12 @@ do_configure() {
_args+=" --disable-libunwind-exceptions"
_args+=" --disable-target-libiberty"
# --enable-serial-configure is broken when cross-compiling for
# some targets because it introduces make rule dependency cycles
if [ ! "$CROSS_BUILD" ]; then
_args+=" --enable-serial-configure"
fi
mkdir -p build
cd build
if [ "$build_option_gnatboot" ]; then
@ -298,7 +333,7 @@ pre_install() {
do_install() {
cd build
case "$XBPS_TARGET_MACHINE" in
x86_64*|aarch64*)
x86_64*|aarch64*|ppc64*)
vmkdir usr/lib
ln -sfr ${DESTDIR}/usr/lib ${DESTDIR}/usr/lib64
;;
@ -344,7 +379,7 @@ do_install() {
done
case "$XBPS_TARGET_MACHINE" in
i686*|x86_64*) ;;
i686*|x86_64*|ppc64le) ;;
*) rm -f ${DESTDIR}/usr/share/info/libquadmath.info;;
esac
}