void-packages/srcpkgs/gcc/patches/libgcc-musl-ldbl128-config....

139 lines
4.0 KiB
Diff

From 330788a7acde436c1ee8fcb0c1fd657e6ffab8fd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Thu, 2 May 2019 18:58:29 +0200
Subject: [PATCH] libgcc: do not build 128-bit long double runtime support for
musl
Another patch was already disabling 128-bit long doubles for the
compiler itself, this one additionally avoids building the runtime
support for that.
Musl does not support 128-bit long doubles, and building libgcc
with 128-bit long double ABI was breaking things like ld.gold
which refuses to link two objects with different FP ABI tags.
---
libgcc/config.host | 10 +++++++++-
libgcc/config/rs6000/ppc64-fp.c | 14 ++++++++++++++
libgcc/config/rs6000/t-musl | 8 ++++++++
3 files changed, 31 insertions(+), 1 deletion(-)
create mode 100644 libgcc/config/rs6000/t-musl
diff --git a/libgcc/config.host b/libgcc/config.host
index 11b4aca..51ceef5 100644
--- libgcc/config.host
+++ libgcc/config.host
@@ -1071,8 +1071,16 @@ powerpc-*-rtems*)
extra_parts="$extra_parts crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
;;
powerpc*-*-linux*)
- tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff rs6000/t-linux t-dfprules rs6000/t-ppc64-fp t-slibgcc-libgcc"
+ tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff t-dfprules rs6000/t-ppc64-fp t-slibgcc-libgcc"
tmake_file="${tmake_file} t-stack rs6000/t-stack-rs6000"
+ case ${host} in
+ powerpc*-*-linux-musl*)
+ tmake_file="${tmake_file} rs6000/t-musl"
+ ;;
+ *)
+ tmake_file="${tmake_file} rs6000/t-linux"
+ ;;
+ esac
case $ppc_fp_type in
64)
;;
diff --git a/libgcc/config/rs6000/ppc64-fp.c b/libgcc/config/rs6000/ppc64-fp.c
index faffc82..9f479ee 100644
--- libgcc/config/rs6000/ppc64-fp.c
+++ libgcc/config/rs6000/ppc64-fp.c
@@ -25,25 +25,34 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#if defined(__powerpc64__) || defined (__64BIT__) || defined(__ppc64__)
+#if __LDBL_MANT_DIG__ > __DBL_MANT_DIG__
#define TMODES
+#endif
#include "fp-bit.h"
+#ifdef TMODES
extern DItype __fixtfdi (TFtype);
+#endif
extern DItype __fixdfdi (DFtype);
extern DItype __fixsfdi (SFtype);
extern USItype __fixunsdfsi (DFtype);
extern USItype __fixunssfsi (SFtype);
+#ifdef TMODES
extern TFtype __floatditf (DItype);
extern TFtype __floatunditf (UDItype);
+#endif
extern DFtype __floatdidf (DItype);
extern DFtype __floatundidf (UDItype);
extern SFtype __floatdisf (DItype);
extern SFtype __floatundisf (UDItype);
+#ifdef TMODES
extern DItype __fixunstfdi (TFtype);
+#endif
static DItype local_fixunssfdi (SFtype);
static DItype local_fixunsdfdi (DFtype);
+#ifdef TMODES
DItype
__fixtfdi (TFtype a)
{
@@ -51,6 +60,7 @@ __fixtfdi (TFtype a)
return - __fixunstfdi (-a);
return __fixunstfdi (a);
}
+#endif
DItype
__fixdfdi (DFtype a)
@@ -86,6 +96,7 @@ __fixunssfsi (SFtype a)
return (SItype) a;
}
+#ifdef TMODES
TFtype
__floatditf (DItype u)
{
@@ -109,6 +120,7 @@ __floatunditf (UDItype u)
return (TFtype) dh + (TFtype) dl;
}
+#endif
DFtype
__floatdidf (DItype u)
@@ -183,6 +195,7 @@ __floatundisf (UDItype u)
return (SFtype) f;
}
+#ifdef TMODES
DItype
__fixunstfdi (TFtype a)
{
@@ -206,6 +219,7 @@ __fixunstfdi (TFtype a)
v += (USItype) a;
return v;
}
+#endif
/* This version is needed to prevent recursion; fixunsdfdi in libgcc
calls fixdfdi, which in turn calls calls fixunsdfdi. */
diff --git a/libgcc/config/rs6000/t-musl b/libgcc/config/rs6000/t-musl
new file mode 100644
index 0000000..f261d8a
--- /dev/null
+++ libgcc/config/rs6000/t-musl
@@ -0,0 +1,8 @@
+# Overrides for musl; we want to avoid building all these implementations
+# required for quad-precision float handling as musl does not support that,
+# ibm-ldouble.c is added into the build by t-ppccomm
+
+HOST_LIBGCC2_CFLAGS += -mlong-double-64 -mno-minimal-toc
+
+# We do not want to build ibm-ldouble.c.
+LIB2ADD := $(filter-out %ibm-ldouble.c, $(LIB2ADD))
--
2.21.0