Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • alistair23/pmaports
  • exkc/pmaports
  • fossdd/pmaports
  • JustSoup321/pmaports
  • Eisenbahnfan/pmaports
  • raihan2000/pmaports
  • sleirsgoevy/pmaports
  • Adrian/pmaports
  • adamthiede/pmaports
  • jianhua/pmaports
  • knuxify/pmaports
  • Arnavion/pmaports
  • barni2000/pmaports
  • longnoserob/pmaports
  • smankusors/pmaports
  • Aren/pmaports
  • langfingaz/pmaports
  • sicelo/pmaports
  • kouta-kun/pmaports
  • craftyguy/pmaports
  • rdacayan/pmaports
  • rmader/pmaports
  • Haui111/pmaports
  • jakko/pmaports
  • dujem/pmaports
  • methanal/pmaports
  • WeirdTreeThing/pmaports
  • MightyM17/pmaports
  • sertonix/pmaports
  • amessier/pmaports
  • akemnade/pmaports
  • setotau/pmaports
  • kevinwidjaja21/pmaports
  • NekoCWD/pmaports
  • ollieparanoid/pmaports
  • manoedinata/pmaports
  • Drakulix/pmaports
  • grimler/pmaports
  • benpicco/pmaports
  • Frieder.Hannenheim/pmaports
  • andrisas/pmaports
  • EspiDev/pmaports
  • maze42/pmaports
  • anjandev/pmaports
  • danct12/pmaports
  • ijiki16/pmaports
  • jja2000/pmaports
  • fancsali/pmaports
  • bolilingmeng89006/pmaports
  • Minecrell/pmaports
  • chipiguay/pmaports
  • cherrypicker/pmaports
  • fortuna-mainline/pmaports
  • pevik/pmaports
  • Patriot-06/pmaports
  • JoseskVolpe/pmaports
  • verdre/pmaports
  • proycon/pmaports
  • AutumnSpark1226/pmaports
  • PsychoGame/pmaports
  • fraolt/pmaports
  • VaporGame/pmaports
  • pugzarecute/pmaports
  • CalcProgrammer1/pmaports
  • hexaheximal/pmaports
  • dabao1955/pmaports
  • HenriDellal/pmaports
  • semfault/pmaports
  • strobo5/pmaports
  • andrewgigena/pmaports
  • Athozus/pmaports
  • 1peter10/pmaports
  • vixalien/pmaports
  • Tooniis/pmaports
  • adomerle/pmaports
  • bjorn3/pmaports
  • StacyHarper/pmaports
  • Jack_Kekzoz/pmaports
  • Ceddicedced/pmaports
  • Justin_Zobel/pmaports
  • airtower-luna/pmaports
  • f-izzo/pmaports
  • cosmo/pmaports
  • 9lore/pmaports
  • postmarketOS/pmaports
  • Johnnynator/pmaports
  • iAboothahir/pmaports
  • N1kroks/pmaports
  • neuschaefer/pmaports
  • DylanVanAssche/pmaports
  • yehiashamaa987/pmaports
  • Operachi/pmaports
  • faveoled/pmaports
  • ilpianista/pmaports
  • johkra/pmaports
  • HDDTHR/pmaports
  • zsoltiv/pmaports
  • Justin/pmaports
  • Kaloyan501/pmaports_huawei_p8_lite_2015_fix
  • joelselvaraj/pmaports
  • rontti/pmaports
  • dsankouski/pmaports
  • StandaSK/pmaports
  • paricbat/pmaports
  • asdfugil/pmaports
  • komaru-yml/pmaports
  • MasterPlexus/pmaports
  • Felix/pmaports
  • ayakael/pmaports
  • feisuzhu/pmaports
  • AJ-RR/pmaports
  • SzczurekYT/pmaports
  • mediaberry/pmaports
  • justsomeguy/pmaports
  • Augis154/pmaports
  • hrdl/pmaports
  • sib0ndt/pmaports
  • 19atlas/pmaports
  • vipaoL/pmaports
  • wannjanjic/pmaports
  • dh/pmaports
  • LogicalErzor/pmaports
  • halamix2/pmaports
  • Shamilkv34/pmaports
  • Cogitri/pmaports
  • fallenritemonk/pmaports
  • user0-07161/pmaports
  • rock3tsprocket/pmaports
  • ellyq/pmaports
  • rodent/pmaports
  • mkorpershoek/pmaports
  • candrew/pmaports
  • fallaciousreasoning/pmaports
  • chalkin/pmaports
  • ungeskriptet/pmaports
  • r00t/pmaports
  • panpanpanpan/pmaports
  • celiffe/pmaports
  • davidfurey/pmaports
  • kidd/pmaports
  • tpikonen/pmaports
  • camelCaseNick/pmaports
  • ermine/pmaports
  • lgh/pmaports
  • sajattack/pmaports
  • StephanieBread/pmaports
  • M0Rf30/pmaports
  • notfound405/pmaports
  • samueldr/pmaports
  • r10nw7fd3/pmaports
  • treid998/pmaports-merge
  • denysvitali/pmaports
  • rodriguezst/pmaports
  • puppiestdoggo1/pmaports
  • donihalim/pmaports
  • EDKPiepaint/pmaports-apple-tonga-test
156 results
Show changes
Commits on Source (17)
Showing
with 1195 additions and 280 deletions
......@@ -4,17 +4,17 @@ Date: Fri, 21 Aug 2020 07:07:48 +0000
Subject: [PATCH 26/35] ada: musl support fixes
---
gcc/ada/Makefile.rtl | 10 +++++-----
gcc/ada/Makefile.rtl | 16 ++++++++--------
gcc/ada/adaint.c | 34 +++++++++++++++++++---------------
gcc/ada/adaint.h | 10 ++++------
gcc/ada/terminals.c | 8 ++++----
4 files changed, 32 insertions(+), 30 deletions(-)
4 files changed, 35 insertions(+), 33 deletions(-)
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index 96306f8cc9a..090b6770ae5 100644
index 32cbdb692..463028fbe 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -1549,7 +1549,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
@@ -1558,7 +1558,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
s-intman.adb<libgnarl/s-intman__posix.adb \
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -23,7 +23,16 @@ index 96306f8cc9a..090b6770ae5 100644
a-exetim.adb<libgnarl/a-exetim__posix.adb \
a-exetim.ads<libgnarl/a-exetim__default.ads \
s-linux.ads<libgnarl/s-linux.ads \
@@ -2174,7 +2174,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
@@ -2144,7 +2144,7 @@ ifeq ($(strip $(filter-out loongarch% linux%,$(target_cpu) $(target_os))),)
g-sercom.adb<libgnat/g-sercom__linux.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
$(GNATRTL_128BIT_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
system.ads<libgnat/system-linux-loongarch.ads
@@ -2232,7 +2232,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -32,7 +41,7 @@ index 96306f8cc9a..090b6770ae5 100644
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
system.ads<libgnat/system-linux-ppc.ads
@@ -2205,7 +2205,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
@@ -2267,7 +2267,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
endif
# ARM linux, GNU eabi
......@@ -50,7 +59,7 @@ index 96306f8cc9a..090b6770ae5 100644
s-mudido.adb<libgnarl/s-mudido__affinity.adb \
s-osinte.ads<libgnarl/s-osinte__linux.ads \
s-osinte.adb<libgnarl/s-osinte__posix.adb \
@@ -2420,7 +2420,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
@@ -2488,7 +2488,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -59,7 +68,16 @@ index 96306f8cc9a..090b6770ae5 100644
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
$(GNATRTL_128BIT_PAIRS) \
@@ -2524,7 +2524,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
@@ -2592,7 +2592,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
$(ATOMICS_TARGET_PAIRS) \
$(X86_64_TARGET_PAIRS) \
$(SIMD_PATH_TARGET_PAIRS) \
@@ -2637,7 +2637,7 @@ ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -69,10 +87,10 @@ index 96306f8cc9a..090b6770ae5 100644
$(X86_64_TARGET_PAIRS) \
$(SIMD_PATH_TARGET_PAIRS) \
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 8522094164e..92b230a462b 100644
index 74aa3c412..ef6118f37 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -91,6 +91,11 @@
@@ -94,6 +94,11 @@
#include <sys/param.h>
#include <sys/pstat.h>
#endif
......@@ -84,7 +102,7 @@ index 8522094164e..92b230a462b 100644
#ifdef __PikeOS__
#define __BSD_VISIBLE 1
@@ -3438,7 +3443,6 @@ __gnat_lwp_self (void)
@@ -3465,7 +3470,6 @@ __gnat_lwp_self (void)
#endif
#if defined (__linux__)
......@@ -92,7 +110,7 @@ index 8522094164e..92b230a462b 100644
/* glibc versions earlier than 2.7 do not define the routines to handle
dynamically allocated CPU sets. For these targets, we use the static
@@ -3448,7 +3452,7 @@ __gnat_lwp_self (void)
@@ -3475,7 +3479,7 @@ __gnat_lwp_self (void)
/* Dynamic cpu sets */
......@@ -101,7 +119,7 @@ index 8522094164e..92b230a462b 100644
__gnat_cpu_alloc (size_t count)
{
return CPU_ALLOC (count);
@@ -3461,33 +3465,33 @@ __gnat_cpu_alloc_size (size_t count)
@@ -3488,33 +3492,33 @@ __gnat_cpu_alloc_size (size_t count)
}
void
......@@ -143,7 +161,7 @@ index 8522094164e..92b230a462b 100644
}
size_t
@@ -3497,23 +3501,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
@@ -3524,23 +3528,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
}
void
......@@ -173,7 +191,7 @@ index 8522094164e..92b230a462b 100644
#endif /* !CPU_ALLOC */
#endif /* __linux__ */
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 987432c9307..4d782f07de9 100644
index 0cbfd0e15..f97ed905b 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -319,13 +319,11 @@ extern void *__gnat_lwp_self (void);
......@@ -195,10 +213,10 @@ index 987432c9307..4d782f07de9 100644
#if defined (_WIN32)
diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
index c0ee4a16bb1..ed796a48c1b 100644
index 05af82c27..626ac35bc 100644
--- a/gcc/ada/terminals.c
+++ b/gcc/ada/terminals.c
@@ -1127,7 +1127,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
@@ -1134,7 +1134,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
/* POSIX does not specify how to open the master side of a terminal.Several
methods are available (system specific):
1- using a cloning device (USE_CLONE_DEVICE)
......@@ -207,7 +225,7 @@ index c0ee4a16bb1..ed796a48c1b 100644
3- openpty (USE_OPENPTY)
When using the cloning device method, the macro USE_CLONE_DEVICE should
@@ -1141,7 +1141,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
@@ -1148,7 +1148,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
#if defined (__APPLE__) || defined (BSD)
#define USE_OPENPTY
#elif defined (__linux__)
......@@ -216,7 +234,7 @@ index c0ee4a16bb1..ed796a48c1b 100644
#elif defined (__sun__)
#define USE_CLONE_DEVICE "/dev/ptmx"
#elif defined (_AIX)
@@ -1190,8 +1190,8 @@ allocate_pty_desc (pty_desc **desc) {
@@ -1197,8 +1197,8 @@ allocate_pty_desc (pty_desc **desc) {
int master_fd = -1;
char *slave_name = NULL;
......@@ -227,6 +245,3 @@ index c0ee4a16bb1..ed796a48c1b 100644
#elif defined (USE_OPENPTY)
status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL);
#elif defined (USE_CLONE_DEVICE)
--
2.41.0
From: Celeste <cielesti@protonmail.com>
Date: Mon, 2 Sep 2024 02:54:17 +0000
Subject: [PATCH] libphobos: add riscv64 and loongarch64 support
Add musl support for these 2 architectures based on fenv.h and signal.h from:
https://git.musl-libc.org/cgit/musl/tree/arch/riscv64/bits?h=v1.2.5
https://git.musl-libc.org/cgit/musl/tree/arch/loongarch64/bits?h=v1.2.5
---
libphobos/libdruntime/core/stdc/fenv.d | 13 +++++++++++++
libphobos/libdruntime/core/sys/posix/signal.d | 10 ++++++++++
2 files changed, 23 insertions(+)
diff --git a/libphobos/libdruntime/core/stdc/fenv.d b/libphobos/libdruntime/core/stdc/fenv.d
index a7364c0a..5b327e4a 100644
--- a/libphobos/libdruntime/core/stdc/fenv.d
+++ b/libphobos/libdruntime/core/stdc/fenv.d
@@ -436,20 +436,33 @@ else version (CRuntime_Musl)
ushort __cs_selector;
ushort __opcode;
uint __data_offset;
ushort __data_selector;
ushort __unused5;
version (X86_64)
uint __mxcsr;
}
alias ushort fexcept_t;
}
+ else version (RISCV64)
+ {
+ alias uint fenv_t;
+ alias uint fexcept_t;
+ }
+ else version (LoongArch64)
+ {
+ struct fenv_t
+ {
+ uint __cw;
+ }
+ alias uint fexcept_t;
+ }
else
{
static assert(false, "Architecture not supported.");
}
}
else version (CRuntime_Newlib)
{
version (AArch64)
{
alias fenv_t = ulong;
diff --git a/libphobos/libdruntime/core/sys/posix/signal.d b/libphobos/libdruntime/core/sys/posix/signal.d
index a8b7f751..78d8b3cd 100644
--- a/libphobos/libdruntime/core/sys/posix/signal.d
+++ b/libphobos/libdruntime/core/sys/posix/signal.d
@@ -2751,20 +2751,30 @@ else version (CRuntime_Musl)
else version (PPC_Any)
{
enum MINSIGSTKSZ = 4096;
enum SIGSTKSZ = 10240;
}
else version (X86_Any)
{
enum MINSIGSTKSZ = 2048;
enum SIGSTKSZ = 8192;
}
+ else version (RISCV64)
+ {
+ enum MINSIGSTKSZ = 2048;
+ enum SIGSTKSZ = 8192;
+ }
+ else version (LoongArch64)
+ {
+ enum MINSIGSTKSZ = 4096;
+ enum SIGSTKSZ = 16384;
+ }
else
static assert(0, "unimplemented");
//ucontext_t (defined in core.sys.posix.ucontext)
//mcontext_t (defined in core.sys.posix.ucontext)
version (MIPS_Any)
{
struct stack_t
{
......@@ -34,7 +34,7 @@ _pkgsnap="${pkgver##*_git}"
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
pkgname=gcc-aarch64
pkgrel=2
pkgrel=3
pkgdesc="Stage2 cross-compiler for aarch64"
url="https://gcc.gnu.org"
arch="x86_64"
......@@ -64,6 +64,7 @@ _libitm=true
if [ "$CHOST" != "$CTARGET" ]; then
if [ "$BOOTSTRAP" = nolibc ]; then
LANG_CXX=false
LANG_D=false
LANG_ADA=false
_libgcc=false
_builddir="$srcdir/build-cross-pass2"
......@@ -73,7 +74,6 @@ if [ "$CHOST" != "$CTARGET" ]; then
LANG_OBJC=false
LANG_GO=false
LANG_FORTRAN=false
LANG_D=false
LANG_JIT=false
_libgomp=false
_libatomic=false
......@@ -115,7 +115,6 @@ elif [ "$CBUILD" != "$CHOST" ]; then
LANG_OBJC=false
LANG_GO=false
LANG_FORTRAN=false
LANG_D=false
LANG_JIT=false
STRIP_FOR_TARGET=${CROSS_COMPILE}strip
......@@ -140,11 +139,11 @@ else
export BOOT_LDFLAGS="$LDFLAGS"
fi
case "$CARCH" in
case "$CTARGET_ARCH" in
# GDC hasn't been ported to PowerPC
# See libphobos/configure.tgt in GCC sources for supported targets
# riscv fails with: error: static assert "unimplemented"
ppc64le|riscv64|loongarch64) LANG_D=false ;;
ppc64le|riscv64) LANG_D=false ;;
# GDC does currently not work on 32-bit musl architectures.
# This is a known upstream issue.
# See: https://github.com/dlang/druntime/pull/3383
......@@ -171,7 +170,7 @@ esac
# currently on x86, x86_64 and ia64
_libquadmath=$LANG_FORTRAN
case "$CTARGET_ARCH" in
x86 | x86_64) _libquadmath=$LANG_FORTRAN ;;
x86 | x86_64 | ppc64le) _libquadmath=$LANG_FORTRAN ;;
*) _libquadmath=false ;;
esac
......@@ -184,13 +183,8 @@ if $_libgomp; then
subpackages="$subpackages libgomp::$CTARGET_ARCH"
fi
case "$CARCH" in
riscv64)
LANG_ADA=false;;
esac
case "$CTARGET_ARCH" in
loongarch64)
riscv64|loongarch64)
LANG_ADA=false;;
esac
......@@ -199,9 +193,17 @@ if $LANG_CXX; then
_languages="$_languages,c++"
fi
if $LANG_D; then
subpackages="$subpackages libgphobos::$CTARGET_ARCH gcc-gdc$_target:gdc"
subpackages="$subpackages gcc-gdc$_target:gdc"
_languages="$_languages,d"
makedepends_build="$makedepends_build libucontext-dev gcc-gdc-bootstrap"
makedepends_build="$makedepends_build libucontext-dev"
if [ "$CBUILD" = "$CTARGET" ]; then
makedepends_build="$makedepends_build gcc-gdc-bootstrap"
subpackages="$subpackages libgphobos::$CTARGET_ARCH"
else
# shared libgphobos is for D programs to link against, so
# skip building that while cross-compiling the GDC compiler
makedepends_build="$makedepends_build gcc-gdc gcc-gdc$_cross"
fi
fi
if $LANG_OBJC; then
subpackages="$subpackages libobjc::$CTARGET_ARCH gcc-objc$_target:objc"
......@@ -278,7 +280,9 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkg
0033-libphobos-do-not-use-LFS64-symbols.patch
0034-libgo-fix-lfs64-use.patch
0035-loongarch-disable-multilib-support.patch
0036-libphobos-add-riscv64-and-loongarch64-support.patch
fix-arm64.patch
ppc64le-quadmath.patch
"
# secfixes:
......@@ -339,7 +343,7 @@ build() {
i586-*-*-*) _arch_configure="--with-arch=pentium-m --with-fpmath=sse --with-tune=generic --enable-cld";;
s390x-*-*-*) _arch_configure="--with-arch=z196 --with-tune=zEC12 --with-zarch --with-long-double-128 --enable-decimal-float";;
riscv64-*-*-*) _arch_configure="--with-arch=rv64gc --with-abi=lp64d --enable-autolink-libatomic";;
loongarch64-*-*-*) _arch_configure="--with-arch=loongarch64 --with-abi=lp64d --with-tls=trad";;
loongarch64-*-*-*) _arch_configure="--with-arch=loongarch64 --with-abi=lp64d";;
esac
case "$CTARGET_ARCH" in
......@@ -360,20 +364,23 @@ build() {
case "$BOOTSTRAP" in
nolibc) _bootstrap_configure="--with-newlib --disable-shared --enable-threads=no" ;;
*) _bootstrap_configure="--enable-shared --enable-threads --enable-tls" ;;
*)
# cross-bootstrap GDC with a static libphobos: due to GCC's
# ./configure not having a --disable-shared=libphobos option,
# we have to use --enable-shared with everything else instead.
if $LANG_D && [ "$CBUILD" != "$CTARGET" ]; then
_bootstrap_configure="--enable-shared=libgcc,libstdc++,libffi,zlib,boehm-gc,ada,libada,libgo,libobjc,libatomic,libgomp,libitm,libgfortran,libquadmath"
else
_bootstrap_configure="--enable-shared"
fi
_bootstrap_configure="$_bootstrap_configure --enable-threads --enable-tls"
;;
esac
$_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
$_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
$_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
if ! $_libquadmath; then
_arch_configure="$_arch_configure --disable-libquadmath"
# ppc64le needs both --disable-libquadmath{,-support}
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116007
[ "$CARCH" = "ppc64le" ] &&
_arch_configure="$_arch_configure
--disable-libquadmath-support"
fi
$_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath"
msg "Building the following:"
echo ""
......@@ -427,6 +434,10 @@ build() {
--with-pkgversion="$version"
msg "building gcc"
if $LANG_D && [ "$CBUILD" != "$CTARGET" ]; then
# cross-compiling libphobos with parallel make fails
make all-target-libphobos
fi
make
# we build gccjit separate to not build all of gcc with --enable-host-shared
......@@ -667,9 +678,9 @@ libgphobos() {
gdc() {
pkgdesc="GCC-based D language compiler"
depends="gcc=$_gccrel libgphobos=$_gccrel musl-dev"
depends="$depends libucontext-dev"
provides="gcc-gdc-bootstrap=$_gccrel"
depends="gcc$_target=$_gccrel musl-dev libucontext-dev"
[ "$CBUILD" = "$CTARGET" ] && depends="$depends libgphobos=$_gccrel"
[ "$CHOST" = "$CTARGET" ] && provides="gcc-gdc-bootstrap=$_gccrel"
mkdir -p "$subpkgdir/$_gcclibexec" \
"$subpkgdir"/$_gcclibdir/include/d/ \
......@@ -680,13 +691,25 @@ gdc() {
# without installing the compiler
mv "$pkgdir/$_gcclibexec/d21" "$subpkgdir/$_gcclibexec/"
mv "$pkgdir"/$_gcclibdir/include/d/* "$subpkgdir"/$_gcclibdir/include/d/
mv "$pkgdir"/usr/lib/libgdruntime.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgdruntime.so "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.so "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.spec "$subpkgdir"/usr/lib/
if [ "$CBUILD" = "$CTARGET" ]; then
mv "$pkgdir"/usr/lib/libgdruntime.so "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.so "$subpkgdir"/usr/lib/
fi
if [ "$CHOST" = "$CTARGET" ]; then
mv "$pkgdir"/usr/lib/libgdruntime.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.spec "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/bin/gdc "$subpkgdir"/usr/bin/
else
mkdir -p "$subpkgdir"/usr/$CTARGET/lib/
mv "$pkgdir"/usr/$CTARGET/lib/libgdruntime.a \
"$subpkgdir"/usr/$CTARGET/lib/
mv "$pkgdir"/usr/$CTARGET/lib/libgphobos.a \
"$subpkgdir"/usr/$CTARGET/lib/
mv "$pkgdir"/usr/$CTARGET/lib/libgphobos.spec \
"$subpkgdir"/usr/$CTARGET/lib/
fi
mv "$pkgdir"/usr/bin/$CTARGET-gdc "$subpkgdir"/usr/bin/
mv "$pkgdir"/usr/bin/gdc "$subpkgdir"/usr/bin/
}
libgo() {
......@@ -828,7 +851,7 @@ f382eb5f7c2c60c5a23fac587c9629a3059d7be0898e97a1feaf9b9cbe1ef4693cc1177eb29333e8
abf845792433a21fed5dd06167b9f6cf5e8f8026a409acce93824e466c5148e192bf5f404a271931fe4b65283499329bf67bb01019f2f3e02501f20619404e6c 0023-riscv-disable-multilib-support.patch
ab88a2f63e3545bbc36537aa9a86f2c6c35e41bbf702d6e13743a405cdac4f901eed5737189b780da96647fea9f5d863fdc76373f25a00064106dcb5514d6d87 0024-always-build-libgcc_eh.a.patch
8fdbe0c8bf4ca60f458a33e59027de03d15ac91933fe46d8ca62119346d20b9bc2447c0bf22bceb63d0cf8613ab61512d9197f4e6c2224af473b63ef9f254295 0025-ada-libgnarl-compatibility-for-musl.patch
5fd23a506b55c88d4f000e01c539eb25d6da2516949c9d7a1c9ee20f4c6b627e4788541284d9c14c33bafa7cb43ce2e0469dd91006152f00e30815107150320f 0026-ada-musl-support-fixes.patch
684bf2db12aa45e8db7a895ab0f227b4e4351f611b4fcc6e1745d7ad94d31b3554f39d8cf9e2203520b3c6ee35cf309b417d4a842e7a8cd55a2b2accb23f2f24 0026-ada-musl-support-fixes.patch
3f9a406d7d2ce34951215ffbcadb49a45e55ad5c24ab9097c0e5e92383e43b876872ccd2a7e7def2833ab204975ee5733f8bcf90934db9fa9c4f6f56c62081f6 0027-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
720a4001f9a1fa4122e456077ecff8d3eb8af7c83d0a81f9da6a6cca05b23664206a82a349e34482c48bfe40e99aa5f21567613d0913f6a24f282bc84a994496 0028-configure-fix-detection-of-atomic-builtins-in-libato.patch
2044c23b23726965c0a6fd39f616cc464badd650947cb40495eeabd906a3af629878c1d28b403b8eb46b30a1a0ba39083023290d62f0c99ccf070063226e3f8f 0029-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
......@@ -838,5 +861,7 @@ b325035cb7122d79c6b42ca6d3fc9e02319ed2f7cddb0639dff25d2798d2ce63812cd623462cdf95
c474f34e6f9a4239d486a65141a133dbe8ce91427d502a57a9fd6eb403478a2b5715ba74f24c1cc0761e16eec77ba2c1ca921fb7d7bc1e040fc3703fc9559e75 0033-libphobos-do-not-use-LFS64-symbols.patch
c4482ffc36e7894b2140800159f4cbc9a3e9011e43a69b69f4fa92d5a11e2ee645c7e21df4423dd1e0636e8890849a5719647bfbdf84f951d638f8f488cb718c 0034-libgo-fix-lfs64-use.patch
65df1d489e8d07a811f39e27fd29e3b2b4164fbc2c5fdc16a5142886d94a96e3fb28ccf4f20dd297ba6540ef8ea1ac3eb65a4279494639bf2f0f8376a3896cc3 0035-loongarch-disable-multilib-support.patch
06f64544fd8bc4b6c8b06410c5198aa8fb4e82c232afc0cad83b2c69ac5d39399968206defa78297222700cd18e7fd7e8244afa76d343406a01f657c86306453 0036-libphobos-add-riscv64-and-loongarch64-support.patch
00319c9770362520e8e93bd03fda1769dfa3622eba77d620e11d8af45a38e6d804a5e924046ae388e1cfaea605696e89c343fca507aaaa5edd58d80744fff14f fix-arm64.patch
815265826742400f86336f0c2d3e4edc37398dbc6505ee81107c0103c13ac0f406cff851438d2323033c6c6d0c0323765ee15b975eab8d1dd465f9e988168fb9 ppc64le-quadmath.patch
"
Patch-Source: https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=3fe5720430a9ba61ed7562aac4d758cc77d49a28
--
From 3fe5720430a9ba61ed7562aac4d758cc77d49a28 Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Sat, 3 Aug 2024 20:37:54 +0200
Subject: [PATCH] libquadmath: Fix up libquadmath/math/sqrtq.c compilation in
some powerpc* configurations [PR116007]
My PR114623 change started using soft-fp.h and quad.h for the sqrtq implementation.
Unfortunately, that seems to fail building in some powerpc* configurations, where
TFmode isn't available.
quad.h has:
#ifndef TFtype
typedef float TFtype __attribute__ ((mode (TF)));
#endif
and uses TFtype. quad.h has:
/* Define the complex type corresponding to __float128
("_Complex __float128" is not allowed) */
#if (!defined(_ARCH_PPC)) || defined(__LONG_DOUBLE_IEEE128__)
typedef _Complex float __attribute__((mode(TC))) __complex128;
#else
typedef _Complex float __attribute__((mode(KC))) __complex128;
#endif
with the conditional and KCmode use added during porting of libquadmath
to powerpc*, so I've just defined TFtype for powerpc when __LONG_DOUBLE_IEEE128__
isn't defined; I could define it to float __attribute__ ((mode (KF))) but it
seemed easier to just define it to __float128 which should do the same thing.
2024-08-03 Jakub Jelinek <jakub@redhat.com>
PR target/116007
* math/sqrtq.c (TFtype): For PowerPC without __LONG_DOUBLE_IEEE128__
define to __float128 before including soft-fp.h and quad.h.
(cherry picked from commit 3ac02e67503ccffa3dfeeffc0a60fce6bdaca43b)
---
libquadmath/math/sqrtq.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libquadmath/math/sqrtq.c b/libquadmath/math/sqrtq.c
index 8ca2828d42ce..a58998a06670 100644
--- a/libquadmath/math/sqrtq.c
+++ b/libquadmath/math/sqrtq.c
@@ -9,6 +9,9 @@
&& defined(FE_TOWARDZERO) \
&& defined(FE_INEXACT)
#define USE_SOFT_FP 1
+#if defined(_ARCH_PPC) && !defined(__LONG_DOUBLE_IEEE128__)
+#define TFtype __float128
+#endif
#include "../../libgcc/soft-fp/soft-fp.h"
#include "../../libgcc/soft-fp/quad.h"
#endif
--
2.43.5
......@@ -4,17 +4,17 @@ Date: Fri, 21 Aug 2020 07:07:48 +0000
Subject: [PATCH 26/35] ada: musl support fixes
---
gcc/ada/Makefile.rtl | 10 +++++-----
gcc/ada/Makefile.rtl | 16 ++++++++--------
gcc/ada/adaint.c | 34 +++++++++++++++++++---------------
gcc/ada/adaint.h | 10 ++++------
gcc/ada/terminals.c | 8 ++++----
4 files changed, 32 insertions(+), 30 deletions(-)
4 files changed, 35 insertions(+), 33 deletions(-)
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index 96306f8cc9a..090b6770ae5 100644
index 32cbdb692..463028fbe 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -1549,7 +1549,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
@@ -1558,7 +1558,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
s-intman.adb<libgnarl/s-intman__posix.adb \
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -23,7 +23,16 @@ index 96306f8cc9a..090b6770ae5 100644
a-exetim.adb<libgnarl/a-exetim__posix.adb \
a-exetim.ads<libgnarl/a-exetim__default.ads \
s-linux.ads<libgnarl/s-linux.ads \
@@ -2174,7 +2174,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
@@ -2144,7 +2144,7 @@ ifeq ($(strip $(filter-out loongarch% linux%,$(target_cpu) $(target_os))),)
g-sercom.adb<libgnat/g-sercom__linux.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
$(GNATRTL_128BIT_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
system.ads<libgnat/system-linux-loongarch.ads
@@ -2232,7 +2232,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -32,7 +41,7 @@ index 96306f8cc9a..090b6770ae5 100644
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
system.ads<libgnat/system-linux-ppc.ads
@@ -2205,7 +2205,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
@@ -2267,7 +2267,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
endif
# ARM linux, GNU eabi
......@@ -50,7 +59,7 @@ index 96306f8cc9a..090b6770ae5 100644
s-mudido.adb<libgnarl/s-mudido__affinity.adb \
s-osinte.ads<libgnarl/s-osinte__linux.ads \
s-osinte.adb<libgnarl/s-osinte__posix.adb \
@@ -2420,7 +2420,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
@@ -2488,7 +2488,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -59,7 +68,16 @@ index 96306f8cc9a..090b6770ae5 100644
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
$(GNATRTL_128BIT_PAIRS) \
@@ -2524,7 +2524,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
@@ -2592,7 +2592,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
$(ATOMICS_TARGET_PAIRS) \
$(X86_64_TARGET_PAIRS) \
$(SIMD_PATH_TARGET_PAIRS) \
@@ -2637,7 +2637,7 @@ ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -69,10 +87,10 @@ index 96306f8cc9a..090b6770ae5 100644
$(X86_64_TARGET_PAIRS) \
$(SIMD_PATH_TARGET_PAIRS) \
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 8522094164e..92b230a462b 100644
index 74aa3c412..ef6118f37 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -91,6 +91,11 @@
@@ -94,6 +94,11 @@
#include <sys/param.h>
#include <sys/pstat.h>
#endif
......@@ -84,7 +102,7 @@ index 8522094164e..92b230a462b 100644
#ifdef __PikeOS__
#define __BSD_VISIBLE 1
@@ -3438,7 +3443,6 @@ __gnat_lwp_self (void)
@@ -3465,7 +3470,6 @@ __gnat_lwp_self (void)
#endif
#if defined (__linux__)
......@@ -92,7 +110,7 @@ index 8522094164e..92b230a462b 100644
/* glibc versions earlier than 2.7 do not define the routines to handle
dynamically allocated CPU sets. For these targets, we use the static
@@ -3448,7 +3452,7 @@ __gnat_lwp_self (void)
@@ -3475,7 +3479,7 @@ __gnat_lwp_self (void)
/* Dynamic cpu sets */
......@@ -101,7 +119,7 @@ index 8522094164e..92b230a462b 100644
__gnat_cpu_alloc (size_t count)
{
return CPU_ALLOC (count);
@@ -3461,33 +3465,33 @@ __gnat_cpu_alloc_size (size_t count)
@@ -3488,33 +3492,33 @@ __gnat_cpu_alloc_size (size_t count)
}
void
......@@ -143,7 +161,7 @@ index 8522094164e..92b230a462b 100644
}
size_t
@@ -3497,23 +3501,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
@@ -3524,23 +3528,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
}
void
......@@ -173,7 +191,7 @@ index 8522094164e..92b230a462b 100644
#endif /* !CPU_ALLOC */
#endif /* __linux__ */
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 987432c9307..4d782f07de9 100644
index 0cbfd0e15..f97ed905b 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -319,13 +319,11 @@ extern void *__gnat_lwp_self (void);
......@@ -195,10 +213,10 @@ index 987432c9307..4d782f07de9 100644
#if defined (_WIN32)
diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
index c0ee4a16bb1..ed796a48c1b 100644
index 05af82c27..626ac35bc 100644
--- a/gcc/ada/terminals.c
+++ b/gcc/ada/terminals.c
@@ -1127,7 +1127,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
@@ -1134,7 +1134,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
/* POSIX does not specify how to open the master side of a terminal.Several
methods are available (system specific):
1- using a cloning device (USE_CLONE_DEVICE)
......@@ -207,7 +225,7 @@ index c0ee4a16bb1..ed796a48c1b 100644
3- openpty (USE_OPENPTY)
When using the cloning device method, the macro USE_CLONE_DEVICE should
@@ -1141,7 +1141,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
@@ -1148,7 +1148,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
#if defined (__APPLE__) || defined (BSD)
#define USE_OPENPTY
#elif defined (__linux__)
......@@ -216,7 +234,7 @@ index c0ee4a16bb1..ed796a48c1b 100644
#elif defined (__sun__)
#define USE_CLONE_DEVICE "/dev/ptmx"
#elif defined (_AIX)
@@ -1190,8 +1190,8 @@ allocate_pty_desc (pty_desc **desc) {
@@ -1197,8 +1197,8 @@ allocate_pty_desc (pty_desc **desc) {
int master_fd = -1;
char *slave_name = NULL;
......@@ -227,6 +245,3 @@ index c0ee4a16bb1..ed796a48c1b 100644
#elif defined (USE_OPENPTY)
status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL);
#elif defined (USE_CLONE_DEVICE)
--
2.41.0
From: Celeste <cielesti@protonmail.com>
Date: Mon, 2 Sep 2024 02:54:17 +0000
Subject: [PATCH] libphobos: add riscv64 and loongarch64 support
Add musl support for these 2 architectures based on fenv.h and signal.h from:
https://git.musl-libc.org/cgit/musl/tree/arch/riscv64/bits?h=v1.2.5
https://git.musl-libc.org/cgit/musl/tree/arch/loongarch64/bits?h=v1.2.5
---
libphobos/libdruntime/core/stdc/fenv.d | 13 +++++++++++++
libphobos/libdruntime/core/sys/posix/signal.d | 10 ++++++++++
2 files changed, 23 insertions(+)
diff --git a/libphobos/libdruntime/core/stdc/fenv.d b/libphobos/libdruntime/core/stdc/fenv.d
index a7364c0a..5b327e4a 100644
--- a/libphobos/libdruntime/core/stdc/fenv.d
+++ b/libphobos/libdruntime/core/stdc/fenv.d
@@ -436,20 +436,33 @@ else version (CRuntime_Musl)
ushort __cs_selector;
ushort __opcode;
uint __data_offset;
ushort __data_selector;
ushort __unused5;
version (X86_64)
uint __mxcsr;
}
alias ushort fexcept_t;
}
+ else version (RISCV64)
+ {
+ alias uint fenv_t;
+ alias uint fexcept_t;
+ }
+ else version (LoongArch64)
+ {
+ struct fenv_t
+ {
+ uint __cw;
+ }
+ alias uint fexcept_t;
+ }
else
{
static assert(false, "Architecture not supported.");
}
}
else version (CRuntime_Newlib)
{
version (AArch64)
{
alias fenv_t = ulong;
diff --git a/libphobos/libdruntime/core/sys/posix/signal.d b/libphobos/libdruntime/core/sys/posix/signal.d
index a8b7f751..78d8b3cd 100644
--- a/libphobos/libdruntime/core/sys/posix/signal.d
+++ b/libphobos/libdruntime/core/sys/posix/signal.d
@@ -2751,20 +2751,30 @@ else version (CRuntime_Musl)
else version (PPC_Any)
{
enum MINSIGSTKSZ = 4096;
enum SIGSTKSZ = 10240;
}
else version (X86_Any)
{
enum MINSIGSTKSZ = 2048;
enum SIGSTKSZ = 8192;
}
+ else version (RISCV64)
+ {
+ enum MINSIGSTKSZ = 2048;
+ enum SIGSTKSZ = 8192;
+ }
+ else version (LoongArch64)
+ {
+ enum MINSIGSTKSZ = 4096;
+ enum SIGSTKSZ = 16384;
+ }
else
static assert(0, "unimplemented");
//ucontext_t (defined in core.sys.posix.ucontext)
//mcontext_t (defined in core.sys.posix.ucontext)
version (MIPS_Any)
{
struct stack_t
{
......@@ -34,7 +34,7 @@ _pkgsnap="${pkgver##*_git}"
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
pkgname=gcc-armhf
pkgrel=2
pkgrel=3
pkgdesc="Stage2 cross-compiler for armhf"
url="https://gcc.gnu.org"
arch="x86_64"
......@@ -64,6 +64,7 @@ _libitm=true
if [ "$CHOST" != "$CTARGET" ]; then
if [ "$BOOTSTRAP" = nolibc ]; then
LANG_CXX=false
LANG_D=false
LANG_ADA=false
_libgcc=false
_builddir="$srcdir/build-cross-pass2"
......@@ -73,7 +74,6 @@ if [ "$CHOST" != "$CTARGET" ]; then
LANG_OBJC=false
LANG_GO=false
LANG_FORTRAN=false
LANG_D=false
LANG_JIT=false
_libgomp=false
_libatomic=false
......@@ -115,7 +115,6 @@ elif [ "$CBUILD" != "$CHOST" ]; then
LANG_OBJC=false
LANG_GO=false
LANG_FORTRAN=false
LANG_D=false
LANG_JIT=false
STRIP_FOR_TARGET=${CROSS_COMPILE}strip
......@@ -140,11 +139,11 @@ else
export BOOT_LDFLAGS="$LDFLAGS"
fi
case "$CARCH" in
case "$CTARGET_ARCH" in
# GDC hasn't been ported to PowerPC
# See libphobos/configure.tgt in GCC sources for supported targets
# riscv fails with: error: static assert "unimplemented"
ppc64le|riscv64|loongarch64) LANG_D=false ;;
ppc64le|riscv64) LANG_D=false ;;
# GDC does currently not work on 32-bit musl architectures.
# This is a known upstream issue.
# See: https://github.com/dlang/druntime/pull/3383
......@@ -171,7 +170,7 @@ esac
# currently on x86, x86_64 and ia64
_libquadmath=$LANG_FORTRAN
case "$CTARGET_ARCH" in
x86 | x86_64) _libquadmath=$LANG_FORTRAN ;;
x86 | x86_64 | ppc64le) _libquadmath=$LANG_FORTRAN ;;
*) _libquadmath=false ;;
esac
......@@ -184,13 +183,8 @@ if $_libgomp; then
subpackages="$subpackages libgomp::$CTARGET_ARCH"
fi
case "$CARCH" in
riscv64)
LANG_ADA=false;;
esac
case "$CTARGET_ARCH" in
loongarch64)
riscv64|loongarch64)
LANG_ADA=false;;
esac
......@@ -199,9 +193,17 @@ if $LANG_CXX; then
_languages="$_languages,c++"
fi
if $LANG_D; then
subpackages="$subpackages libgphobos::$CTARGET_ARCH gcc-gdc$_target:gdc"
subpackages="$subpackages gcc-gdc$_target:gdc"
_languages="$_languages,d"
makedepends_build="$makedepends_build libucontext-dev gcc-gdc-bootstrap"
makedepends_build="$makedepends_build libucontext-dev"
if [ "$CBUILD" = "$CTARGET" ]; then
makedepends_build="$makedepends_build gcc-gdc-bootstrap"
subpackages="$subpackages libgphobos::$CTARGET_ARCH"
else
# shared libgphobos is for D programs to link against, so
# skip building that while cross-compiling the GDC compiler
makedepends_build="$makedepends_build gcc-gdc gcc-gdc$_cross"
fi
fi
if $LANG_OBJC; then
subpackages="$subpackages libobjc::$CTARGET_ARCH gcc-objc$_target:objc"
......@@ -278,7 +280,9 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkg
0033-libphobos-do-not-use-LFS64-symbols.patch
0034-libgo-fix-lfs64-use.patch
0035-loongarch-disable-multilib-support.patch
0036-libphobos-add-riscv64-and-loongarch64-support.patch
fix-arm64.patch
ppc64le-quadmath.patch
"
# secfixes:
......@@ -339,7 +343,7 @@ build() {
i586-*-*-*) _arch_configure="--with-arch=pentium-m --with-fpmath=sse --with-tune=generic --enable-cld";;
s390x-*-*-*) _arch_configure="--with-arch=z196 --with-tune=zEC12 --with-zarch --with-long-double-128 --enable-decimal-float";;
riscv64-*-*-*) _arch_configure="--with-arch=rv64gc --with-abi=lp64d --enable-autolink-libatomic";;
loongarch64-*-*-*) _arch_configure="--with-arch=loongarch64 --with-abi=lp64d --with-tls=trad";;
loongarch64-*-*-*) _arch_configure="--with-arch=loongarch64 --with-abi=lp64d";;
esac
case "$CTARGET_ARCH" in
......@@ -360,20 +364,23 @@ build() {
case "$BOOTSTRAP" in
nolibc) _bootstrap_configure="--with-newlib --disable-shared --enable-threads=no" ;;
*) _bootstrap_configure="--enable-shared --enable-threads --enable-tls" ;;
*)
# cross-bootstrap GDC with a static libphobos: due to GCC's
# ./configure not having a --disable-shared=libphobos option,
# we have to use --enable-shared with everything else instead.
if $LANG_D && [ "$CBUILD" != "$CTARGET" ]; then
_bootstrap_configure="--enable-shared=libgcc,libstdc++,libffi,zlib,boehm-gc,ada,libada,libgo,libobjc,libatomic,libgomp,libitm,libgfortran,libquadmath"
else
_bootstrap_configure="--enable-shared"
fi
_bootstrap_configure="$_bootstrap_configure --enable-threads --enable-tls"
;;
esac
$_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
$_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
$_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
if ! $_libquadmath; then
_arch_configure="$_arch_configure --disable-libquadmath"
# ppc64le needs both --disable-libquadmath{,-support}
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116007
[ "$CARCH" = "ppc64le" ] &&
_arch_configure="$_arch_configure
--disable-libquadmath-support"
fi
$_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath"
msg "Building the following:"
echo ""
......@@ -427,6 +434,10 @@ build() {
--with-pkgversion="$version"
msg "building gcc"
if $LANG_D && [ "$CBUILD" != "$CTARGET" ]; then
# cross-compiling libphobos with parallel make fails
make all-target-libphobos
fi
make
# we build gccjit separate to not build all of gcc with --enable-host-shared
......@@ -667,9 +678,9 @@ libgphobos() {
gdc() {
pkgdesc="GCC-based D language compiler"
depends="gcc=$_gccrel libgphobos=$_gccrel musl-dev"
depends="$depends libucontext-dev"
provides="gcc-gdc-bootstrap=$_gccrel"
depends="gcc$_target=$_gccrel musl-dev libucontext-dev"
[ "$CBUILD" = "$CTARGET" ] && depends="$depends libgphobos=$_gccrel"
[ "$CHOST" = "$CTARGET" ] && provides="gcc-gdc-bootstrap=$_gccrel"
mkdir -p "$subpkgdir/$_gcclibexec" \
"$subpkgdir"/$_gcclibdir/include/d/ \
......@@ -680,13 +691,25 @@ gdc() {
# without installing the compiler
mv "$pkgdir/$_gcclibexec/d21" "$subpkgdir/$_gcclibexec/"
mv "$pkgdir"/$_gcclibdir/include/d/* "$subpkgdir"/$_gcclibdir/include/d/
mv "$pkgdir"/usr/lib/libgdruntime.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgdruntime.so "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.so "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.spec "$subpkgdir"/usr/lib/
if [ "$CBUILD" = "$CTARGET" ]; then
mv "$pkgdir"/usr/lib/libgdruntime.so "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.so "$subpkgdir"/usr/lib/
fi
if [ "$CHOST" = "$CTARGET" ]; then
mv "$pkgdir"/usr/lib/libgdruntime.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.spec "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/bin/gdc "$subpkgdir"/usr/bin/
else
mkdir -p "$subpkgdir"/usr/$CTARGET/lib/
mv "$pkgdir"/usr/$CTARGET/lib/libgdruntime.a \
"$subpkgdir"/usr/$CTARGET/lib/
mv "$pkgdir"/usr/$CTARGET/lib/libgphobos.a \
"$subpkgdir"/usr/$CTARGET/lib/
mv "$pkgdir"/usr/$CTARGET/lib/libgphobos.spec \
"$subpkgdir"/usr/$CTARGET/lib/
fi
mv "$pkgdir"/usr/bin/$CTARGET-gdc "$subpkgdir"/usr/bin/
mv "$pkgdir"/usr/bin/gdc "$subpkgdir"/usr/bin/
}
libgo() {
......@@ -828,7 +851,7 @@ f382eb5f7c2c60c5a23fac587c9629a3059d7be0898e97a1feaf9b9cbe1ef4693cc1177eb29333e8
abf845792433a21fed5dd06167b9f6cf5e8f8026a409acce93824e466c5148e192bf5f404a271931fe4b65283499329bf67bb01019f2f3e02501f20619404e6c 0023-riscv-disable-multilib-support.patch
ab88a2f63e3545bbc36537aa9a86f2c6c35e41bbf702d6e13743a405cdac4f901eed5737189b780da96647fea9f5d863fdc76373f25a00064106dcb5514d6d87 0024-always-build-libgcc_eh.a.patch
8fdbe0c8bf4ca60f458a33e59027de03d15ac91933fe46d8ca62119346d20b9bc2447c0bf22bceb63d0cf8613ab61512d9197f4e6c2224af473b63ef9f254295 0025-ada-libgnarl-compatibility-for-musl.patch
5fd23a506b55c88d4f000e01c539eb25d6da2516949c9d7a1c9ee20f4c6b627e4788541284d9c14c33bafa7cb43ce2e0469dd91006152f00e30815107150320f 0026-ada-musl-support-fixes.patch
684bf2db12aa45e8db7a895ab0f227b4e4351f611b4fcc6e1745d7ad94d31b3554f39d8cf9e2203520b3c6ee35cf309b417d4a842e7a8cd55a2b2accb23f2f24 0026-ada-musl-support-fixes.patch
3f9a406d7d2ce34951215ffbcadb49a45e55ad5c24ab9097c0e5e92383e43b876872ccd2a7e7def2833ab204975ee5733f8bcf90934db9fa9c4f6f56c62081f6 0027-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
720a4001f9a1fa4122e456077ecff8d3eb8af7c83d0a81f9da6a6cca05b23664206a82a349e34482c48bfe40e99aa5f21567613d0913f6a24f282bc84a994496 0028-configure-fix-detection-of-atomic-builtins-in-libato.patch
2044c23b23726965c0a6fd39f616cc464badd650947cb40495eeabd906a3af629878c1d28b403b8eb46b30a1a0ba39083023290d62f0c99ccf070063226e3f8f 0029-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
......@@ -838,5 +861,7 @@ b325035cb7122d79c6b42ca6d3fc9e02319ed2f7cddb0639dff25d2798d2ce63812cd623462cdf95
c474f34e6f9a4239d486a65141a133dbe8ce91427d502a57a9fd6eb403478a2b5715ba74f24c1cc0761e16eec77ba2c1ca921fb7d7bc1e040fc3703fc9559e75 0033-libphobos-do-not-use-LFS64-symbols.patch
c4482ffc36e7894b2140800159f4cbc9a3e9011e43a69b69f4fa92d5a11e2ee645c7e21df4423dd1e0636e8890849a5719647bfbdf84f951d638f8f488cb718c 0034-libgo-fix-lfs64-use.patch
65df1d489e8d07a811f39e27fd29e3b2b4164fbc2c5fdc16a5142886d94a96e3fb28ccf4f20dd297ba6540ef8ea1ac3eb65a4279494639bf2f0f8376a3896cc3 0035-loongarch-disable-multilib-support.patch
06f64544fd8bc4b6c8b06410c5198aa8fb4e82c232afc0cad83b2c69ac5d39399968206defa78297222700cd18e7fd7e8244afa76d343406a01f657c86306453 0036-libphobos-add-riscv64-and-loongarch64-support.patch
00319c9770362520e8e93bd03fda1769dfa3622eba77d620e11d8af45a38e6d804a5e924046ae388e1cfaea605696e89c343fca507aaaa5edd58d80744fff14f fix-arm64.patch
815265826742400f86336f0c2d3e4edc37398dbc6505ee81107c0103c13ac0f406cff851438d2323033c6c6d0c0323765ee15b975eab8d1dd465f9e988168fb9 ppc64le-quadmath.patch
"
Patch-Source: https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=3fe5720430a9ba61ed7562aac4d758cc77d49a28
--
From 3fe5720430a9ba61ed7562aac4d758cc77d49a28 Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Sat, 3 Aug 2024 20:37:54 +0200
Subject: [PATCH] libquadmath: Fix up libquadmath/math/sqrtq.c compilation in
some powerpc* configurations [PR116007]
My PR114623 change started using soft-fp.h and quad.h for the sqrtq implementation.
Unfortunately, that seems to fail building in some powerpc* configurations, where
TFmode isn't available.
quad.h has:
#ifndef TFtype
typedef float TFtype __attribute__ ((mode (TF)));
#endif
and uses TFtype. quad.h has:
/* Define the complex type corresponding to __float128
("_Complex __float128" is not allowed) */
#if (!defined(_ARCH_PPC)) || defined(__LONG_DOUBLE_IEEE128__)
typedef _Complex float __attribute__((mode(TC))) __complex128;
#else
typedef _Complex float __attribute__((mode(KC))) __complex128;
#endif
with the conditional and KCmode use added during porting of libquadmath
to powerpc*, so I've just defined TFtype for powerpc when __LONG_DOUBLE_IEEE128__
isn't defined; I could define it to float __attribute__ ((mode (KF))) but it
seemed easier to just define it to __float128 which should do the same thing.
2024-08-03 Jakub Jelinek <jakub@redhat.com>
PR target/116007
* math/sqrtq.c (TFtype): For PowerPC without __LONG_DOUBLE_IEEE128__
define to __float128 before including soft-fp.h and quad.h.
(cherry picked from commit 3ac02e67503ccffa3dfeeffc0a60fce6bdaca43b)
---
libquadmath/math/sqrtq.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libquadmath/math/sqrtq.c b/libquadmath/math/sqrtq.c
index 8ca2828d42ce..a58998a06670 100644
--- a/libquadmath/math/sqrtq.c
+++ b/libquadmath/math/sqrtq.c
@@ -9,6 +9,9 @@
&& defined(FE_TOWARDZERO) \
&& defined(FE_INEXACT)
#define USE_SOFT_FP 1
+#if defined(_ARCH_PPC) && !defined(__LONG_DOUBLE_IEEE128__)
+#define TFtype __float128
+#endif
#include "../../libgcc/soft-fp/soft-fp.h"
#include "../../libgcc/soft-fp/quad.h"
#endif
--
2.43.5
......@@ -4,17 +4,17 @@ Date: Fri, 21 Aug 2020 07:07:48 +0000
Subject: [PATCH 26/35] ada: musl support fixes
---
gcc/ada/Makefile.rtl | 10 +++++-----
gcc/ada/Makefile.rtl | 16 ++++++++--------
gcc/ada/adaint.c | 34 +++++++++++++++++++---------------
gcc/ada/adaint.h | 10 ++++------
gcc/ada/terminals.c | 8 ++++----
4 files changed, 32 insertions(+), 30 deletions(-)
4 files changed, 35 insertions(+), 33 deletions(-)
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index 96306f8cc9a..090b6770ae5 100644
index 32cbdb692..463028fbe 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -1549,7 +1549,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
@@ -1558,7 +1558,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
s-intman.adb<libgnarl/s-intman__posix.adb \
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -23,7 +23,16 @@ index 96306f8cc9a..090b6770ae5 100644
a-exetim.adb<libgnarl/a-exetim__posix.adb \
a-exetim.ads<libgnarl/a-exetim__default.ads \
s-linux.ads<libgnarl/s-linux.ads \
@@ -2174,7 +2174,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
@@ -2144,7 +2144,7 @@ ifeq ($(strip $(filter-out loongarch% linux%,$(target_cpu) $(target_os))),)
g-sercom.adb<libgnat/g-sercom__linux.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
$(GNATRTL_128BIT_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
system.ads<libgnat/system-linux-loongarch.ads
@@ -2232,7 +2232,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -32,7 +41,7 @@ index 96306f8cc9a..090b6770ae5 100644
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
system.ads<libgnat/system-linux-ppc.ads
@@ -2205,7 +2205,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
@@ -2267,7 +2267,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
endif
# ARM linux, GNU eabi
......@@ -50,7 +59,7 @@ index 96306f8cc9a..090b6770ae5 100644
s-mudido.adb<libgnarl/s-mudido__affinity.adb \
s-osinte.ads<libgnarl/s-osinte__linux.ads \
s-osinte.adb<libgnarl/s-osinte__posix.adb \
@@ -2420,7 +2420,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
@@ -2488,7 +2488,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -59,7 +68,16 @@ index 96306f8cc9a..090b6770ae5 100644
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
$(GNATRTL_128BIT_PAIRS) \
@@ -2524,7 +2524,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
@@ -2592,7 +2592,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
$(ATOMICS_TARGET_PAIRS) \
$(X86_64_TARGET_PAIRS) \
$(SIMD_PATH_TARGET_PAIRS) \
@@ -2637,7 +2637,7 @@ ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -69,10 +87,10 @@ index 96306f8cc9a..090b6770ae5 100644
$(X86_64_TARGET_PAIRS) \
$(SIMD_PATH_TARGET_PAIRS) \
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 8522094164e..92b230a462b 100644
index 74aa3c412..ef6118f37 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -91,6 +91,11 @@
@@ -94,6 +94,11 @@
#include <sys/param.h>
#include <sys/pstat.h>
#endif
......@@ -84,7 +102,7 @@ index 8522094164e..92b230a462b 100644
#ifdef __PikeOS__
#define __BSD_VISIBLE 1
@@ -3438,7 +3443,6 @@ __gnat_lwp_self (void)
@@ -3465,7 +3470,6 @@ __gnat_lwp_self (void)
#endif
#if defined (__linux__)
......@@ -92,7 +110,7 @@ index 8522094164e..92b230a462b 100644
/* glibc versions earlier than 2.7 do not define the routines to handle
dynamically allocated CPU sets. For these targets, we use the static
@@ -3448,7 +3452,7 @@ __gnat_lwp_self (void)
@@ -3475,7 +3479,7 @@ __gnat_lwp_self (void)
/* Dynamic cpu sets */
......@@ -101,7 +119,7 @@ index 8522094164e..92b230a462b 100644
__gnat_cpu_alloc (size_t count)
{
return CPU_ALLOC (count);
@@ -3461,33 +3465,33 @@ __gnat_cpu_alloc_size (size_t count)
@@ -3488,33 +3492,33 @@ __gnat_cpu_alloc_size (size_t count)
}
void
......@@ -143,7 +161,7 @@ index 8522094164e..92b230a462b 100644
}
size_t
@@ -3497,23 +3501,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
@@ -3524,23 +3528,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
}
void
......@@ -173,7 +191,7 @@ index 8522094164e..92b230a462b 100644
#endif /* !CPU_ALLOC */
#endif /* __linux__ */
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 987432c9307..4d782f07de9 100644
index 0cbfd0e15..f97ed905b 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -319,13 +319,11 @@ extern void *__gnat_lwp_self (void);
......@@ -195,10 +213,10 @@ index 987432c9307..4d782f07de9 100644
#if defined (_WIN32)
diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
index c0ee4a16bb1..ed796a48c1b 100644
index 05af82c27..626ac35bc 100644
--- a/gcc/ada/terminals.c
+++ b/gcc/ada/terminals.c
@@ -1127,7 +1127,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
@@ -1134,7 +1134,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
/* POSIX does not specify how to open the master side of a terminal.Several
methods are available (system specific):
1- using a cloning device (USE_CLONE_DEVICE)
......@@ -207,7 +225,7 @@ index c0ee4a16bb1..ed796a48c1b 100644
3- openpty (USE_OPENPTY)
When using the cloning device method, the macro USE_CLONE_DEVICE should
@@ -1141,7 +1141,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
@@ -1148,7 +1148,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
#if defined (__APPLE__) || defined (BSD)
#define USE_OPENPTY
#elif defined (__linux__)
......@@ -216,7 +234,7 @@ index c0ee4a16bb1..ed796a48c1b 100644
#elif defined (__sun__)
#define USE_CLONE_DEVICE "/dev/ptmx"
#elif defined (_AIX)
@@ -1190,8 +1190,8 @@ allocate_pty_desc (pty_desc **desc) {
@@ -1197,8 +1197,8 @@ allocate_pty_desc (pty_desc **desc) {
int master_fd = -1;
char *slave_name = NULL;
......@@ -227,6 +245,3 @@ index c0ee4a16bb1..ed796a48c1b 100644
#elif defined (USE_OPENPTY)
status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL);
#elif defined (USE_CLONE_DEVICE)
--
2.41.0
From: Celeste <cielesti@protonmail.com>
Date: Mon, 2 Sep 2024 02:54:17 +0000
Subject: [PATCH] libphobos: add riscv64 and loongarch64 support
Add musl support for these 2 architectures based on fenv.h and signal.h from:
https://git.musl-libc.org/cgit/musl/tree/arch/riscv64/bits?h=v1.2.5
https://git.musl-libc.org/cgit/musl/tree/arch/loongarch64/bits?h=v1.2.5
---
libphobos/libdruntime/core/stdc/fenv.d | 13 +++++++++++++
libphobos/libdruntime/core/sys/posix/signal.d | 10 ++++++++++
2 files changed, 23 insertions(+)
diff --git a/libphobos/libdruntime/core/stdc/fenv.d b/libphobos/libdruntime/core/stdc/fenv.d
index a7364c0a..5b327e4a 100644
--- a/libphobos/libdruntime/core/stdc/fenv.d
+++ b/libphobos/libdruntime/core/stdc/fenv.d
@@ -436,20 +436,33 @@ else version (CRuntime_Musl)
ushort __cs_selector;
ushort __opcode;
uint __data_offset;
ushort __data_selector;
ushort __unused5;
version (X86_64)
uint __mxcsr;
}
alias ushort fexcept_t;
}
+ else version (RISCV64)
+ {
+ alias uint fenv_t;
+ alias uint fexcept_t;
+ }
+ else version (LoongArch64)
+ {
+ struct fenv_t
+ {
+ uint __cw;
+ }
+ alias uint fexcept_t;
+ }
else
{
static assert(false, "Architecture not supported.");
}
}
else version (CRuntime_Newlib)
{
version (AArch64)
{
alias fenv_t = ulong;
diff --git a/libphobos/libdruntime/core/sys/posix/signal.d b/libphobos/libdruntime/core/sys/posix/signal.d
index a8b7f751..78d8b3cd 100644
--- a/libphobos/libdruntime/core/sys/posix/signal.d
+++ b/libphobos/libdruntime/core/sys/posix/signal.d
@@ -2751,20 +2751,30 @@ else version (CRuntime_Musl)
else version (PPC_Any)
{
enum MINSIGSTKSZ = 4096;
enum SIGSTKSZ = 10240;
}
else version (X86_Any)
{
enum MINSIGSTKSZ = 2048;
enum SIGSTKSZ = 8192;
}
+ else version (RISCV64)
+ {
+ enum MINSIGSTKSZ = 2048;
+ enum SIGSTKSZ = 8192;
+ }
+ else version (LoongArch64)
+ {
+ enum MINSIGSTKSZ = 4096;
+ enum SIGSTKSZ = 16384;
+ }
else
static assert(0, "unimplemented");
//ucontext_t (defined in core.sys.posix.ucontext)
//mcontext_t (defined in core.sys.posix.ucontext)
version (MIPS_Any)
{
struct stack_t
{
......@@ -34,7 +34,7 @@ _pkgsnap="${pkgver##*_git}"
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
pkgname=gcc-armv7
pkgrel=2
pkgrel=3
pkgdesc="Stage2 cross-compiler for armv7"
url="https://gcc.gnu.org"
arch="x86_64"
......@@ -64,6 +64,7 @@ _libitm=true
if [ "$CHOST" != "$CTARGET" ]; then
if [ "$BOOTSTRAP" = nolibc ]; then
LANG_CXX=false
LANG_D=false
LANG_ADA=false
_libgcc=false
_builddir="$srcdir/build-cross-pass2"
......@@ -73,7 +74,6 @@ if [ "$CHOST" != "$CTARGET" ]; then
LANG_OBJC=false
LANG_GO=false
LANG_FORTRAN=false
LANG_D=false
LANG_JIT=false
_libgomp=false
_libatomic=false
......@@ -115,7 +115,6 @@ elif [ "$CBUILD" != "$CHOST" ]; then
LANG_OBJC=false
LANG_GO=false
LANG_FORTRAN=false
LANG_D=false
LANG_JIT=false
STRIP_FOR_TARGET=${CROSS_COMPILE}strip
......@@ -140,11 +139,11 @@ else
export BOOT_LDFLAGS="$LDFLAGS"
fi
case "$CARCH" in
case "$CTARGET_ARCH" in
# GDC hasn't been ported to PowerPC
# See libphobos/configure.tgt in GCC sources for supported targets
# riscv fails with: error: static assert "unimplemented"
ppc64le|riscv64|loongarch64) LANG_D=false ;;
ppc64le|riscv64) LANG_D=false ;;
# GDC does currently not work on 32-bit musl architectures.
# This is a known upstream issue.
# See: https://github.com/dlang/druntime/pull/3383
......@@ -171,7 +170,7 @@ esac
# currently on x86, x86_64 and ia64
_libquadmath=$LANG_FORTRAN
case "$CTARGET_ARCH" in
x86 | x86_64) _libquadmath=$LANG_FORTRAN ;;
x86 | x86_64 | ppc64le) _libquadmath=$LANG_FORTRAN ;;
*) _libquadmath=false ;;
esac
......@@ -184,13 +183,8 @@ if $_libgomp; then
subpackages="$subpackages libgomp::$CTARGET_ARCH"
fi
case "$CARCH" in
riscv64)
LANG_ADA=false;;
esac
case "$CTARGET_ARCH" in
loongarch64)
riscv64|loongarch64)
LANG_ADA=false;;
esac
......@@ -199,9 +193,17 @@ if $LANG_CXX; then
_languages="$_languages,c++"
fi
if $LANG_D; then
subpackages="$subpackages libgphobos::$CTARGET_ARCH gcc-gdc$_target:gdc"
subpackages="$subpackages gcc-gdc$_target:gdc"
_languages="$_languages,d"
makedepends_build="$makedepends_build libucontext-dev gcc-gdc-bootstrap"
makedepends_build="$makedepends_build libucontext-dev"
if [ "$CBUILD" = "$CTARGET" ]; then
makedepends_build="$makedepends_build gcc-gdc-bootstrap"
subpackages="$subpackages libgphobos::$CTARGET_ARCH"
else
# shared libgphobos is for D programs to link against, so
# skip building that while cross-compiling the GDC compiler
makedepends_build="$makedepends_build gcc-gdc gcc-gdc$_cross"
fi
fi
if $LANG_OBJC; then
subpackages="$subpackages libobjc::$CTARGET_ARCH gcc-objc$_target:objc"
......@@ -278,7 +280,9 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkg
0033-libphobos-do-not-use-LFS64-symbols.patch
0034-libgo-fix-lfs64-use.patch
0035-loongarch-disable-multilib-support.patch
0036-libphobos-add-riscv64-and-loongarch64-support.patch
fix-arm64.patch
ppc64le-quadmath.patch
"
# secfixes:
......@@ -339,7 +343,7 @@ build() {
i586-*-*-*) _arch_configure="--with-arch=pentium-m --with-fpmath=sse --with-tune=generic --enable-cld";;
s390x-*-*-*) _arch_configure="--with-arch=z196 --with-tune=zEC12 --with-zarch --with-long-double-128 --enable-decimal-float";;
riscv64-*-*-*) _arch_configure="--with-arch=rv64gc --with-abi=lp64d --enable-autolink-libatomic";;
loongarch64-*-*-*) _arch_configure="--with-arch=loongarch64 --with-abi=lp64d --with-tls=trad";;
loongarch64-*-*-*) _arch_configure="--with-arch=loongarch64 --with-abi=lp64d";;
esac
case "$CTARGET_ARCH" in
......@@ -360,20 +364,23 @@ build() {
case "$BOOTSTRAP" in
nolibc) _bootstrap_configure="--with-newlib --disable-shared --enable-threads=no" ;;
*) _bootstrap_configure="--enable-shared --enable-threads --enable-tls" ;;
*)
# cross-bootstrap GDC with a static libphobos: due to GCC's
# ./configure not having a --disable-shared=libphobos option,
# we have to use --enable-shared with everything else instead.
if $LANG_D && [ "$CBUILD" != "$CTARGET" ]; then
_bootstrap_configure="--enable-shared=libgcc,libstdc++,libffi,zlib,boehm-gc,ada,libada,libgo,libobjc,libatomic,libgomp,libitm,libgfortran,libquadmath"
else
_bootstrap_configure="--enable-shared"
fi
_bootstrap_configure="$_bootstrap_configure --enable-threads --enable-tls"
;;
esac
$_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
$_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
$_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
if ! $_libquadmath; then
_arch_configure="$_arch_configure --disable-libquadmath"
# ppc64le needs both --disable-libquadmath{,-support}
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116007
[ "$CARCH" = "ppc64le" ] &&
_arch_configure="$_arch_configure
--disable-libquadmath-support"
fi
$_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath"
msg "Building the following:"
echo ""
......@@ -427,6 +434,10 @@ build() {
--with-pkgversion="$version"
msg "building gcc"
if $LANG_D && [ "$CBUILD" != "$CTARGET" ]; then
# cross-compiling libphobos with parallel make fails
make all-target-libphobos
fi
make
# we build gccjit separate to not build all of gcc with --enable-host-shared
......@@ -667,9 +678,9 @@ libgphobos() {
gdc() {
pkgdesc="GCC-based D language compiler"
depends="gcc=$_gccrel libgphobos=$_gccrel musl-dev"
depends="$depends libucontext-dev"
provides="gcc-gdc-bootstrap=$_gccrel"
depends="gcc$_target=$_gccrel musl-dev libucontext-dev"
[ "$CBUILD" = "$CTARGET" ] && depends="$depends libgphobos=$_gccrel"
[ "$CHOST" = "$CTARGET" ] && provides="gcc-gdc-bootstrap=$_gccrel"
mkdir -p "$subpkgdir/$_gcclibexec" \
"$subpkgdir"/$_gcclibdir/include/d/ \
......@@ -680,13 +691,25 @@ gdc() {
# without installing the compiler
mv "$pkgdir/$_gcclibexec/d21" "$subpkgdir/$_gcclibexec/"
mv "$pkgdir"/$_gcclibdir/include/d/* "$subpkgdir"/$_gcclibdir/include/d/
mv "$pkgdir"/usr/lib/libgdruntime.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgdruntime.so "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.so "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.spec "$subpkgdir"/usr/lib/
if [ "$CBUILD" = "$CTARGET" ]; then
mv "$pkgdir"/usr/lib/libgdruntime.so "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.so "$subpkgdir"/usr/lib/
fi
if [ "$CHOST" = "$CTARGET" ]; then
mv "$pkgdir"/usr/lib/libgdruntime.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.spec "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/bin/gdc "$subpkgdir"/usr/bin/
else
mkdir -p "$subpkgdir"/usr/$CTARGET/lib/
mv "$pkgdir"/usr/$CTARGET/lib/libgdruntime.a \
"$subpkgdir"/usr/$CTARGET/lib/
mv "$pkgdir"/usr/$CTARGET/lib/libgphobos.a \
"$subpkgdir"/usr/$CTARGET/lib/
mv "$pkgdir"/usr/$CTARGET/lib/libgphobos.spec \
"$subpkgdir"/usr/$CTARGET/lib/
fi
mv "$pkgdir"/usr/bin/$CTARGET-gdc "$subpkgdir"/usr/bin/
mv "$pkgdir"/usr/bin/gdc "$subpkgdir"/usr/bin/
}
libgo() {
......@@ -828,7 +851,7 @@ f382eb5f7c2c60c5a23fac587c9629a3059d7be0898e97a1feaf9b9cbe1ef4693cc1177eb29333e8
abf845792433a21fed5dd06167b9f6cf5e8f8026a409acce93824e466c5148e192bf5f404a271931fe4b65283499329bf67bb01019f2f3e02501f20619404e6c 0023-riscv-disable-multilib-support.patch
ab88a2f63e3545bbc36537aa9a86f2c6c35e41bbf702d6e13743a405cdac4f901eed5737189b780da96647fea9f5d863fdc76373f25a00064106dcb5514d6d87 0024-always-build-libgcc_eh.a.patch
8fdbe0c8bf4ca60f458a33e59027de03d15ac91933fe46d8ca62119346d20b9bc2447c0bf22bceb63d0cf8613ab61512d9197f4e6c2224af473b63ef9f254295 0025-ada-libgnarl-compatibility-for-musl.patch
5fd23a506b55c88d4f000e01c539eb25d6da2516949c9d7a1c9ee20f4c6b627e4788541284d9c14c33bafa7cb43ce2e0469dd91006152f00e30815107150320f 0026-ada-musl-support-fixes.patch
684bf2db12aa45e8db7a895ab0f227b4e4351f611b4fcc6e1745d7ad94d31b3554f39d8cf9e2203520b3c6ee35cf309b417d4a842e7a8cd55a2b2accb23f2f24 0026-ada-musl-support-fixes.patch
3f9a406d7d2ce34951215ffbcadb49a45e55ad5c24ab9097c0e5e92383e43b876872ccd2a7e7def2833ab204975ee5733f8bcf90934db9fa9c4f6f56c62081f6 0027-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
720a4001f9a1fa4122e456077ecff8d3eb8af7c83d0a81f9da6a6cca05b23664206a82a349e34482c48bfe40e99aa5f21567613d0913f6a24f282bc84a994496 0028-configure-fix-detection-of-atomic-builtins-in-libato.patch
2044c23b23726965c0a6fd39f616cc464badd650947cb40495eeabd906a3af629878c1d28b403b8eb46b30a1a0ba39083023290d62f0c99ccf070063226e3f8f 0029-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
......@@ -838,5 +861,7 @@ b325035cb7122d79c6b42ca6d3fc9e02319ed2f7cddb0639dff25d2798d2ce63812cd623462cdf95
c474f34e6f9a4239d486a65141a133dbe8ce91427d502a57a9fd6eb403478a2b5715ba74f24c1cc0761e16eec77ba2c1ca921fb7d7bc1e040fc3703fc9559e75 0033-libphobos-do-not-use-LFS64-symbols.patch
c4482ffc36e7894b2140800159f4cbc9a3e9011e43a69b69f4fa92d5a11e2ee645c7e21df4423dd1e0636e8890849a5719647bfbdf84f951d638f8f488cb718c 0034-libgo-fix-lfs64-use.patch
65df1d489e8d07a811f39e27fd29e3b2b4164fbc2c5fdc16a5142886d94a96e3fb28ccf4f20dd297ba6540ef8ea1ac3eb65a4279494639bf2f0f8376a3896cc3 0035-loongarch-disable-multilib-support.patch
06f64544fd8bc4b6c8b06410c5198aa8fb4e82c232afc0cad83b2c69ac5d39399968206defa78297222700cd18e7fd7e8244afa76d343406a01f657c86306453 0036-libphobos-add-riscv64-and-loongarch64-support.patch
00319c9770362520e8e93bd03fda1769dfa3622eba77d620e11d8af45a38e6d804a5e924046ae388e1cfaea605696e89c343fca507aaaa5edd58d80744fff14f fix-arm64.patch
815265826742400f86336f0c2d3e4edc37398dbc6505ee81107c0103c13ac0f406cff851438d2323033c6c6d0c0323765ee15b975eab8d1dd465f9e988168fb9 ppc64le-quadmath.patch
"
Patch-Source: https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=3fe5720430a9ba61ed7562aac4d758cc77d49a28
--
From 3fe5720430a9ba61ed7562aac4d758cc77d49a28 Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Sat, 3 Aug 2024 20:37:54 +0200
Subject: [PATCH] libquadmath: Fix up libquadmath/math/sqrtq.c compilation in
some powerpc* configurations [PR116007]
My PR114623 change started using soft-fp.h and quad.h for the sqrtq implementation.
Unfortunately, that seems to fail building in some powerpc* configurations, where
TFmode isn't available.
quad.h has:
#ifndef TFtype
typedef float TFtype __attribute__ ((mode (TF)));
#endif
and uses TFtype. quad.h has:
/* Define the complex type corresponding to __float128
("_Complex __float128" is not allowed) */
#if (!defined(_ARCH_PPC)) || defined(__LONG_DOUBLE_IEEE128__)
typedef _Complex float __attribute__((mode(TC))) __complex128;
#else
typedef _Complex float __attribute__((mode(KC))) __complex128;
#endif
with the conditional and KCmode use added during porting of libquadmath
to powerpc*, so I've just defined TFtype for powerpc when __LONG_DOUBLE_IEEE128__
isn't defined; I could define it to float __attribute__ ((mode (KF))) but it
seemed easier to just define it to __float128 which should do the same thing.
2024-08-03 Jakub Jelinek <jakub@redhat.com>
PR target/116007
* math/sqrtq.c (TFtype): For PowerPC without __LONG_DOUBLE_IEEE128__
define to __float128 before including soft-fp.h and quad.h.
(cherry picked from commit 3ac02e67503ccffa3dfeeffc0a60fce6bdaca43b)
---
libquadmath/math/sqrtq.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libquadmath/math/sqrtq.c b/libquadmath/math/sqrtq.c
index 8ca2828d42ce..a58998a06670 100644
--- a/libquadmath/math/sqrtq.c
+++ b/libquadmath/math/sqrtq.c
@@ -9,6 +9,9 @@
&& defined(FE_TOWARDZERO) \
&& defined(FE_INEXACT)
#define USE_SOFT_FP 1
+#if defined(_ARCH_PPC) && !defined(__LONG_DOUBLE_IEEE128__)
+#define TFtype __float128
+#endif
#include "../../libgcc/soft-fp/soft-fp.h"
#include "../../libgcc/soft-fp/quad.h"
#endif
--
2.43.5
......@@ -4,17 +4,17 @@ Date: Fri, 21 Aug 2020 07:07:48 +0000
Subject: [PATCH 26/35] ada: musl support fixes
---
gcc/ada/Makefile.rtl | 10 +++++-----
gcc/ada/Makefile.rtl | 16 ++++++++--------
gcc/ada/adaint.c | 34 +++++++++++++++++++---------------
gcc/ada/adaint.h | 10 ++++------
gcc/ada/terminals.c | 8 ++++----
4 files changed, 32 insertions(+), 30 deletions(-)
4 files changed, 35 insertions(+), 33 deletions(-)
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index 96306f8cc9a..090b6770ae5 100644
index 32cbdb692..463028fbe 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -1549,7 +1549,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
@@ -1558,7 +1558,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
s-intman.adb<libgnarl/s-intman__posix.adb \
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -23,7 +23,16 @@ index 96306f8cc9a..090b6770ae5 100644
a-exetim.adb<libgnarl/a-exetim__posix.adb \
a-exetim.ads<libgnarl/a-exetim__default.ads \
s-linux.ads<libgnarl/s-linux.ads \
@@ -2174,7 +2174,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
@@ -2144,7 +2144,7 @@ ifeq ($(strip $(filter-out loongarch% linux%,$(target_cpu) $(target_os))),)
g-sercom.adb<libgnat/g-sercom__linux.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
$(GNATRTL_128BIT_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
system.ads<libgnat/system-linux-loongarch.ads
@@ -2232,7 +2232,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -32,7 +41,7 @@ index 96306f8cc9a..090b6770ae5 100644
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
system.ads<libgnat/system-linux-ppc.ads
@@ -2205,7 +2205,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
@@ -2267,7 +2267,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
endif
# ARM linux, GNU eabi
......@@ -50,7 +59,7 @@ index 96306f8cc9a..090b6770ae5 100644
s-mudido.adb<libgnarl/s-mudido__affinity.adb \
s-osinte.ads<libgnarl/s-osinte__linux.ads \
s-osinte.adb<libgnarl/s-osinte__posix.adb \
@@ -2420,7 +2420,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
@@ -2488,7 +2488,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -59,7 +68,16 @@ index 96306f8cc9a..090b6770ae5 100644
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
$(GNATRTL_128BIT_PAIRS) \
@@ -2524,7 +2524,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
@@ -2592,7 +2592,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
$(ATOMICS_TARGET_PAIRS) \
$(X86_64_TARGET_PAIRS) \
$(SIMD_PATH_TARGET_PAIRS) \
@@ -2637,7 +2637,7 @@ ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -69,10 +87,10 @@ index 96306f8cc9a..090b6770ae5 100644
$(X86_64_TARGET_PAIRS) \
$(SIMD_PATH_TARGET_PAIRS) \
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 8522094164e..92b230a462b 100644
index 74aa3c412..ef6118f37 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -91,6 +91,11 @@
@@ -94,6 +94,11 @@
#include <sys/param.h>
#include <sys/pstat.h>
#endif
......@@ -84,7 +102,7 @@ index 8522094164e..92b230a462b 100644
#ifdef __PikeOS__
#define __BSD_VISIBLE 1
@@ -3438,7 +3443,6 @@ __gnat_lwp_self (void)
@@ -3465,7 +3470,6 @@ __gnat_lwp_self (void)
#endif
#if defined (__linux__)
......@@ -92,7 +110,7 @@ index 8522094164e..92b230a462b 100644
/* glibc versions earlier than 2.7 do not define the routines to handle
dynamically allocated CPU sets. For these targets, we use the static
@@ -3448,7 +3452,7 @@ __gnat_lwp_self (void)
@@ -3475,7 +3479,7 @@ __gnat_lwp_self (void)
/* Dynamic cpu sets */
......@@ -101,7 +119,7 @@ index 8522094164e..92b230a462b 100644
__gnat_cpu_alloc (size_t count)
{
return CPU_ALLOC (count);
@@ -3461,33 +3465,33 @@ __gnat_cpu_alloc_size (size_t count)
@@ -3488,33 +3492,33 @@ __gnat_cpu_alloc_size (size_t count)
}
void
......@@ -143,7 +161,7 @@ index 8522094164e..92b230a462b 100644
}
size_t
@@ -3497,23 +3501,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
@@ -3524,23 +3528,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
}
void
......@@ -173,7 +191,7 @@ index 8522094164e..92b230a462b 100644
#endif /* !CPU_ALLOC */
#endif /* __linux__ */
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 987432c9307..4d782f07de9 100644
index 0cbfd0e15..f97ed905b 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -319,13 +319,11 @@ extern void *__gnat_lwp_self (void);
......@@ -195,10 +213,10 @@ index 987432c9307..4d782f07de9 100644
#if defined (_WIN32)
diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
index c0ee4a16bb1..ed796a48c1b 100644
index 05af82c27..626ac35bc 100644
--- a/gcc/ada/terminals.c
+++ b/gcc/ada/terminals.c
@@ -1127,7 +1127,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
@@ -1134,7 +1134,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
/* POSIX does not specify how to open the master side of a terminal.Several
methods are available (system specific):
1- using a cloning device (USE_CLONE_DEVICE)
......@@ -207,7 +225,7 @@ index c0ee4a16bb1..ed796a48c1b 100644
3- openpty (USE_OPENPTY)
When using the cloning device method, the macro USE_CLONE_DEVICE should
@@ -1141,7 +1141,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
@@ -1148,7 +1148,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
#if defined (__APPLE__) || defined (BSD)
#define USE_OPENPTY
#elif defined (__linux__)
......@@ -216,7 +234,7 @@ index c0ee4a16bb1..ed796a48c1b 100644
#elif defined (__sun__)
#define USE_CLONE_DEVICE "/dev/ptmx"
#elif defined (_AIX)
@@ -1190,8 +1190,8 @@ allocate_pty_desc (pty_desc **desc) {
@@ -1197,8 +1197,8 @@ allocate_pty_desc (pty_desc **desc) {
int master_fd = -1;
char *slave_name = NULL;
......@@ -227,6 +245,3 @@ index c0ee4a16bb1..ed796a48c1b 100644
#elif defined (USE_OPENPTY)
status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL);
#elif defined (USE_CLONE_DEVICE)
--
2.41.0
From: Celeste <cielesti@protonmail.com>
Date: Mon, 2 Sep 2024 02:54:17 +0000
Subject: [PATCH] libphobos: add riscv64 and loongarch64 support
Add musl support for these 2 architectures based on fenv.h and signal.h from:
https://git.musl-libc.org/cgit/musl/tree/arch/riscv64/bits?h=v1.2.5
https://git.musl-libc.org/cgit/musl/tree/arch/loongarch64/bits?h=v1.2.5
---
libphobos/libdruntime/core/stdc/fenv.d | 13 +++++++++++++
libphobos/libdruntime/core/sys/posix/signal.d | 10 ++++++++++
2 files changed, 23 insertions(+)
diff --git a/libphobos/libdruntime/core/stdc/fenv.d b/libphobos/libdruntime/core/stdc/fenv.d
index a7364c0a..5b327e4a 100644
--- a/libphobos/libdruntime/core/stdc/fenv.d
+++ b/libphobos/libdruntime/core/stdc/fenv.d
@@ -436,20 +436,33 @@ else version (CRuntime_Musl)
ushort __cs_selector;
ushort __opcode;
uint __data_offset;
ushort __data_selector;
ushort __unused5;
version (X86_64)
uint __mxcsr;
}
alias ushort fexcept_t;
}
+ else version (RISCV64)
+ {
+ alias uint fenv_t;
+ alias uint fexcept_t;
+ }
+ else version (LoongArch64)
+ {
+ struct fenv_t
+ {
+ uint __cw;
+ }
+ alias uint fexcept_t;
+ }
else
{
static assert(false, "Architecture not supported.");
}
}
else version (CRuntime_Newlib)
{
version (AArch64)
{
alias fenv_t = ulong;
diff --git a/libphobos/libdruntime/core/sys/posix/signal.d b/libphobos/libdruntime/core/sys/posix/signal.d
index a8b7f751..78d8b3cd 100644
--- a/libphobos/libdruntime/core/sys/posix/signal.d
+++ b/libphobos/libdruntime/core/sys/posix/signal.d
@@ -2751,20 +2751,30 @@ else version (CRuntime_Musl)
else version (PPC_Any)
{
enum MINSIGSTKSZ = 4096;
enum SIGSTKSZ = 10240;
}
else version (X86_Any)
{
enum MINSIGSTKSZ = 2048;
enum SIGSTKSZ = 8192;
}
+ else version (RISCV64)
+ {
+ enum MINSIGSTKSZ = 2048;
+ enum SIGSTKSZ = 8192;
+ }
+ else version (LoongArch64)
+ {
+ enum MINSIGSTKSZ = 4096;
+ enum SIGSTKSZ = 16384;
+ }
else
static assert(0, "unimplemented");
//ucontext_t (defined in core.sys.posix.ucontext)
//mcontext_t (defined in core.sys.posix.ucontext)
version (MIPS_Any)
{
struct stack_t
{
......@@ -34,7 +34,7 @@ _pkgsnap="${pkgver##*_git}"
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
pkgname=gcc-riscv64
pkgrel=2
pkgrel=3
pkgdesc="Stage2 cross-compiler for riscv64"
url="https://gcc.gnu.org"
arch="x86_64"
......@@ -64,6 +64,7 @@ _libitm=true
if [ "$CHOST" != "$CTARGET" ]; then
if [ "$BOOTSTRAP" = nolibc ]; then
LANG_CXX=false
LANG_D=false
LANG_ADA=false
_libgcc=false
_builddir="$srcdir/build-cross-pass2"
......@@ -73,7 +74,6 @@ if [ "$CHOST" != "$CTARGET" ]; then
LANG_OBJC=false
LANG_GO=false
LANG_FORTRAN=false
LANG_D=false
LANG_JIT=false
_libgomp=false
_libatomic=false
......@@ -115,7 +115,6 @@ elif [ "$CBUILD" != "$CHOST" ]; then
LANG_OBJC=false
LANG_GO=false
LANG_FORTRAN=false
LANG_D=false
LANG_JIT=false
STRIP_FOR_TARGET=${CROSS_COMPILE}strip
......@@ -140,11 +139,11 @@ else
export BOOT_LDFLAGS="$LDFLAGS"
fi
case "$CARCH" in
case "$CTARGET_ARCH" in
# GDC hasn't been ported to PowerPC
# See libphobos/configure.tgt in GCC sources for supported targets
# riscv fails with: error: static assert "unimplemented"
ppc64le|riscv64|loongarch64) LANG_D=false ;;
ppc64le|riscv64) LANG_D=false ;;
# GDC does currently not work on 32-bit musl architectures.
# This is a known upstream issue.
# See: https://github.com/dlang/druntime/pull/3383
......@@ -171,7 +170,7 @@ esac
# currently on x86, x86_64 and ia64
_libquadmath=$LANG_FORTRAN
case "$CTARGET_ARCH" in
x86 | x86_64) _libquadmath=$LANG_FORTRAN ;;
x86 | x86_64 | ppc64le) _libquadmath=$LANG_FORTRAN ;;
*) _libquadmath=false ;;
esac
......@@ -184,13 +183,8 @@ if $_libgomp; then
subpackages="$subpackages libgomp::$CTARGET_ARCH"
fi
case "$CARCH" in
riscv64)
LANG_ADA=false;;
esac
case "$CTARGET_ARCH" in
loongarch64)
riscv64|loongarch64)
LANG_ADA=false;;
esac
......@@ -199,9 +193,17 @@ if $LANG_CXX; then
_languages="$_languages,c++"
fi
if $LANG_D; then
subpackages="$subpackages libgphobos::$CTARGET_ARCH gcc-gdc$_target:gdc"
subpackages="$subpackages gcc-gdc$_target:gdc"
_languages="$_languages,d"
makedepends_build="$makedepends_build libucontext-dev gcc-gdc-bootstrap"
makedepends_build="$makedepends_build libucontext-dev"
if [ "$CBUILD" = "$CTARGET" ]; then
makedepends_build="$makedepends_build gcc-gdc-bootstrap"
subpackages="$subpackages libgphobos::$CTARGET_ARCH"
else
# shared libgphobos is for D programs to link against, so
# skip building that while cross-compiling the GDC compiler
makedepends_build="$makedepends_build gcc-gdc gcc-gdc$_cross"
fi
fi
if $LANG_OBJC; then
subpackages="$subpackages libobjc::$CTARGET_ARCH gcc-objc$_target:objc"
......@@ -278,7 +280,9 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkg
0033-libphobos-do-not-use-LFS64-symbols.patch
0034-libgo-fix-lfs64-use.patch
0035-loongarch-disable-multilib-support.patch
0036-libphobos-add-riscv64-and-loongarch64-support.patch
fix-arm64.patch
ppc64le-quadmath.patch
"
# secfixes:
......@@ -339,7 +343,7 @@ build() {
i586-*-*-*) _arch_configure="--with-arch=pentium-m --with-fpmath=sse --with-tune=generic --enable-cld";;
s390x-*-*-*) _arch_configure="--with-arch=z196 --with-tune=zEC12 --with-zarch --with-long-double-128 --enable-decimal-float";;
riscv64-*-*-*) _arch_configure="--with-arch=rv64gc --with-abi=lp64d --enable-autolink-libatomic";;
loongarch64-*-*-*) _arch_configure="--with-arch=loongarch64 --with-abi=lp64d --with-tls=trad";;
loongarch64-*-*-*) _arch_configure="--with-arch=loongarch64 --with-abi=lp64d";;
esac
case "$CTARGET_ARCH" in
......@@ -360,20 +364,23 @@ build() {
case "$BOOTSTRAP" in
nolibc) _bootstrap_configure="--with-newlib --disable-shared --enable-threads=no" ;;
*) _bootstrap_configure="--enable-shared --enable-threads --enable-tls" ;;
*)
# cross-bootstrap GDC with a static libphobos: due to GCC's
# ./configure not having a --disable-shared=libphobos option,
# we have to use --enable-shared with everything else instead.
if $LANG_D && [ "$CBUILD" != "$CTARGET" ]; then
_bootstrap_configure="--enable-shared=libgcc,libstdc++,libffi,zlib,boehm-gc,ada,libada,libgo,libobjc,libatomic,libgomp,libitm,libgfortran,libquadmath"
else
_bootstrap_configure="--enable-shared"
fi
_bootstrap_configure="$_bootstrap_configure --enable-threads --enable-tls"
;;
esac
$_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
$_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
$_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
if ! $_libquadmath; then
_arch_configure="$_arch_configure --disable-libquadmath"
# ppc64le needs both --disable-libquadmath{,-support}
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116007
[ "$CARCH" = "ppc64le" ] &&
_arch_configure="$_arch_configure
--disable-libquadmath-support"
fi
$_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath"
msg "Building the following:"
echo ""
......@@ -427,6 +434,10 @@ build() {
--with-pkgversion="$version"
msg "building gcc"
if $LANG_D && [ "$CBUILD" != "$CTARGET" ]; then
# cross-compiling libphobos with parallel make fails
make all-target-libphobos
fi
make
# we build gccjit separate to not build all of gcc with --enable-host-shared
......@@ -667,9 +678,9 @@ libgphobos() {
gdc() {
pkgdesc="GCC-based D language compiler"
depends="gcc=$_gccrel libgphobos=$_gccrel musl-dev"
depends="$depends libucontext-dev"
provides="gcc-gdc-bootstrap=$_gccrel"
depends="gcc$_target=$_gccrel musl-dev libucontext-dev"
[ "$CBUILD" = "$CTARGET" ] && depends="$depends libgphobos=$_gccrel"
[ "$CHOST" = "$CTARGET" ] && provides="gcc-gdc-bootstrap=$_gccrel"
mkdir -p "$subpkgdir/$_gcclibexec" \
"$subpkgdir"/$_gcclibdir/include/d/ \
......@@ -680,13 +691,25 @@ gdc() {
# without installing the compiler
mv "$pkgdir/$_gcclibexec/d21" "$subpkgdir/$_gcclibexec/"
mv "$pkgdir"/$_gcclibdir/include/d/* "$subpkgdir"/$_gcclibdir/include/d/
mv "$pkgdir"/usr/lib/libgdruntime.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgdruntime.so "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.so "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.spec "$subpkgdir"/usr/lib/
if [ "$CBUILD" = "$CTARGET" ]; then
mv "$pkgdir"/usr/lib/libgdruntime.so "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.so "$subpkgdir"/usr/lib/
fi
if [ "$CHOST" = "$CTARGET" ]; then
mv "$pkgdir"/usr/lib/libgdruntime.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.spec "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/bin/gdc "$subpkgdir"/usr/bin/
else
mkdir -p "$subpkgdir"/usr/$CTARGET/lib/
mv "$pkgdir"/usr/$CTARGET/lib/libgdruntime.a \
"$subpkgdir"/usr/$CTARGET/lib/
mv "$pkgdir"/usr/$CTARGET/lib/libgphobos.a \
"$subpkgdir"/usr/$CTARGET/lib/
mv "$pkgdir"/usr/$CTARGET/lib/libgphobos.spec \
"$subpkgdir"/usr/$CTARGET/lib/
fi
mv "$pkgdir"/usr/bin/$CTARGET-gdc "$subpkgdir"/usr/bin/
mv "$pkgdir"/usr/bin/gdc "$subpkgdir"/usr/bin/
}
libgo() {
......@@ -828,7 +851,7 @@ f382eb5f7c2c60c5a23fac587c9629a3059d7be0898e97a1feaf9b9cbe1ef4693cc1177eb29333e8
abf845792433a21fed5dd06167b9f6cf5e8f8026a409acce93824e466c5148e192bf5f404a271931fe4b65283499329bf67bb01019f2f3e02501f20619404e6c 0023-riscv-disable-multilib-support.patch
ab88a2f63e3545bbc36537aa9a86f2c6c35e41bbf702d6e13743a405cdac4f901eed5737189b780da96647fea9f5d863fdc76373f25a00064106dcb5514d6d87 0024-always-build-libgcc_eh.a.patch
8fdbe0c8bf4ca60f458a33e59027de03d15ac91933fe46d8ca62119346d20b9bc2447c0bf22bceb63d0cf8613ab61512d9197f4e6c2224af473b63ef9f254295 0025-ada-libgnarl-compatibility-for-musl.patch
5fd23a506b55c88d4f000e01c539eb25d6da2516949c9d7a1c9ee20f4c6b627e4788541284d9c14c33bafa7cb43ce2e0469dd91006152f00e30815107150320f 0026-ada-musl-support-fixes.patch
684bf2db12aa45e8db7a895ab0f227b4e4351f611b4fcc6e1745d7ad94d31b3554f39d8cf9e2203520b3c6ee35cf309b417d4a842e7a8cd55a2b2accb23f2f24 0026-ada-musl-support-fixes.patch
3f9a406d7d2ce34951215ffbcadb49a45e55ad5c24ab9097c0e5e92383e43b876872ccd2a7e7def2833ab204975ee5733f8bcf90934db9fa9c4f6f56c62081f6 0027-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
720a4001f9a1fa4122e456077ecff8d3eb8af7c83d0a81f9da6a6cca05b23664206a82a349e34482c48bfe40e99aa5f21567613d0913f6a24f282bc84a994496 0028-configure-fix-detection-of-atomic-builtins-in-libato.patch
2044c23b23726965c0a6fd39f616cc464badd650947cb40495eeabd906a3af629878c1d28b403b8eb46b30a1a0ba39083023290d62f0c99ccf070063226e3f8f 0029-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
......@@ -838,5 +861,7 @@ b325035cb7122d79c6b42ca6d3fc9e02319ed2f7cddb0639dff25d2798d2ce63812cd623462cdf95
c474f34e6f9a4239d486a65141a133dbe8ce91427d502a57a9fd6eb403478a2b5715ba74f24c1cc0761e16eec77ba2c1ca921fb7d7bc1e040fc3703fc9559e75 0033-libphobos-do-not-use-LFS64-symbols.patch
c4482ffc36e7894b2140800159f4cbc9a3e9011e43a69b69f4fa92d5a11e2ee645c7e21df4423dd1e0636e8890849a5719647bfbdf84f951d638f8f488cb718c 0034-libgo-fix-lfs64-use.patch
65df1d489e8d07a811f39e27fd29e3b2b4164fbc2c5fdc16a5142886d94a96e3fb28ccf4f20dd297ba6540ef8ea1ac3eb65a4279494639bf2f0f8376a3896cc3 0035-loongarch-disable-multilib-support.patch
06f64544fd8bc4b6c8b06410c5198aa8fb4e82c232afc0cad83b2c69ac5d39399968206defa78297222700cd18e7fd7e8244afa76d343406a01f657c86306453 0036-libphobos-add-riscv64-and-loongarch64-support.patch
00319c9770362520e8e93bd03fda1769dfa3622eba77d620e11d8af45a38e6d804a5e924046ae388e1cfaea605696e89c343fca507aaaa5edd58d80744fff14f fix-arm64.patch
815265826742400f86336f0c2d3e4edc37398dbc6505ee81107c0103c13ac0f406cff851438d2323033c6c6d0c0323765ee15b975eab8d1dd465f9e988168fb9 ppc64le-quadmath.patch
"
Patch-Source: https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=3fe5720430a9ba61ed7562aac4d758cc77d49a28
--
From 3fe5720430a9ba61ed7562aac4d758cc77d49a28 Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Sat, 3 Aug 2024 20:37:54 +0200
Subject: [PATCH] libquadmath: Fix up libquadmath/math/sqrtq.c compilation in
some powerpc* configurations [PR116007]
My PR114623 change started using soft-fp.h and quad.h for the sqrtq implementation.
Unfortunately, that seems to fail building in some powerpc* configurations, where
TFmode isn't available.
quad.h has:
#ifndef TFtype
typedef float TFtype __attribute__ ((mode (TF)));
#endif
and uses TFtype. quad.h has:
/* Define the complex type corresponding to __float128
("_Complex __float128" is not allowed) */
#if (!defined(_ARCH_PPC)) || defined(__LONG_DOUBLE_IEEE128__)
typedef _Complex float __attribute__((mode(TC))) __complex128;
#else
typedef _Complex float __attribute__((mode(KC))) __complex128;
#endif
with the conditional and KCmode use added during porting of libquadmath
to powerpc*, so I've just defined TFtype for powerpc when __LONG_DOUBLE_IEEE128__
isn't defined; I could define it to float __attribute__ ((mode (KF))) but it
seemed easier to just define it to __float128 which should do the same thing.
2024-08-03 Jakub Jelinek <jakub@redhat.com>
PR target/116007
* math/sqrtq.c (TFtype): For PowerPC without __LONG_DOUBLE_IEEE128__
define to __float128 before including soft-fp.h and quad.h.
(cherry picked from commit 3ac02e67503ccffa3dfeeffc0a60fce6bdaca43b)
---
libquadmath/math/sqrtq.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libquadmath/math/sqrtq.c b/libquadmath/math/sqrtq.c
index 8ca2828d42ce..a58998a06670 100644
--- a/libquadmath/math/sqrtq.c
+++ b/libquadmath/math/sqrtq.c
@@ -9,6 +9,9 @@
&& defined(FE_TOWARDZERO) \
&& defined(FE_INEXACT)
#define USE_SOFT_FP 1
+#if defined(_ARCH_PPC) && !defined(__LONG_DOUBLE_IEEE128__)
+#define TFtype __float128
+#endif
#include "../../libgcc/soft-fp/soft-fp.h"
#include "../../libgcc/soft-fp/quad.h"
#endif
--
2.43.5
......@@ -4,17 +4,17 @@ Date: Fri, 21 Aug 2020 07:07:48 +0000
Subject: [PATCH 26/35] ada: musl support fixes
---
gcc/ada/Makefile.rtl | 10 +++++-----
gcc/ada/Makefile.rtl | 16 ++++++++--------
gcc/ada/adaint.c | 34 +++++++++++++++++++---------------
gcc/ada/adaint.h | 10 ++++------
gcc/ada/terminals.c | 8 ++++----
4 files changed, 32 insertions(+), 30 deletions(-)
4 files changed, 35 insertions(+), 33 deletions(-)
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index 96306f8cc9a..090b6770ae5 100644
index 32cbdb692..463028fbe 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -1549,7 +1549,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
@@ -1558,7 +1558,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
s-intman.adb<libgnarl/s-intman__posix.adb \
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -23,7 +23,16 @@ index 96306f8cc9a..090b6770ae5 100644
a-exetim.adb<libgnarl/a-exetim__posix.adb \
a-exetim.ads<libgnarl/a-exetim__default.ads \
s-linux.ads<libgnarl/s-linux.ads \
@@ -2174,7 +2174,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
@@ -2144,7 +2144,7 @@ ifeq ($(strip $(filter-out loongarch% linux%,$(target_cpu) $(target_os))),)
g-sercom.adb<libgnat/g-sercom__linux.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
$(GNATRTL_128BIT_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
system.ads<libgnat/system-linux-loongarch.ads
@@ -2232,7 +2232,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -32,7 +41,7 @@ index 96306f8cc9a..090b6770ae5 100644
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
system.ads<libgnat/system-linux-ppc.ads
@@ -2205,7 +2205,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
@@ -2267,7 +2267,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
endif
# ARM linux, GNU eabi
......@@ -50,7 +59,7 @@ index 96306f8cc9a..090b6770ae5 100644
s-mudido.adb<libgnarl/s-mudido__affinity.adb \
s-osinte.ads<libgnarl/s-osinte__linux.ads \
s-osinte.adb<libgnarl/s-osinte__posix.adb \
@@ -2420,7 +2420,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
@@ -2488,7 +2488,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -59,7 +68,16 @@ index 96306f8cc9a..090b6770ae5 100644
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
$(GNATRTL_128BIT_PAIRS) \
@@ -2524,7 +2524,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
@@ -2592,7 +2592,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
$(ATOMICS_TARGET_PAIRS) \
$(X86_64_TARGET_PAIRS) \
$(SIMD_PATH_TARGET_PAIRS) \
@@ -2637,7 +2637,7 @@ ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
......@@ -69,10 +87,10 @@ index 96306f8cc9a..090b6770ae5 100644
$(X86_64_TARGET_PAIRS) \
$(SIMD_PATH_TARGET_PAIRS) \
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 8522094164e..92b230a462b 100644
index 74aa3c412..ef6118f37 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -91,6 +91,11 @@
@@ -94,6 +94,11 @@
#include <sys/param.h>
#include <sys/pstat.h>
#endif
......@@ -84,7 +102,7 @@ index 8522094164e..92b230a462b 100644
#ifdef __PikeOS__
#define __BSD_VISIBLE 1
@@ -3438,7 +3443,6 @@ __gnat_lwp_self (void)
@@ -3465,7 +3470,6 @@ __gnat_lwp_self (void)
#endif
#if defined (__linux__)
......@@ -92,7 +110,7 @@ index 8522094164e..92b230a462b 100644
/* glibc versions earlier than 2.7 do not define the routines to handle
dynamically allocated CPU sets. For these targets, we use the static
@@ -3448,7 +3452,7 @@ __gnat_lwp_self (void)
@@ -3475,7 +3479,7 @@ __gnat_lwp_self (void)
/* Dynamic cpu sets */
......@@ -101,7 +119,7 @@ index 8522094164e..92b230a462b 100644
__gnat_cpu_alloc (size_t count)
{
return CPU_ALLOC (count);
@@ -3461,33 +3465,33 @@ __gnat_cpu_alloc_size (size_t count)
@@ -3488,33 +3492,33 @@ __gnat_cpu_alloc_size (size_t count)
}
void
......@@ -143,7 +161,7 @@ index 8522094164e..92b230a462b 100644
}
size_t
@@ -3497,23 +3501,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
@@ -3524,23 +3528,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
}
void
......@@ -173,7 +191,7 @@ index 8522094164e..92b230a462b 100644
#endif /* !CPU_ALLOC */
#endif /* __linux__ */
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 987432c9307..4d782f07de9 100644
index 0cbfd0e15..f97ed905b 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -319,13 +319,11 @@ extern void *__gnat_lwp_self (void);
......@@ -195,10 +213,10 @@ index 987432c9307..4d782f07de9 100644
#if defined (_WIN32)
diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
index c0ee4a16bb1..ed796a48c1b 100644
index 05af82c27..626ac35bc 100644
--- a/gcc/ada/terminals.c
+++ b/gcc/ada/terminals.c
@@ -1127,7 +1127,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
@@ -1134,7 +1134,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
/* POSIX does not specify how to open the master side of a terminal.Several
methods are available (system specific):
1- using a cloning device (USE_CLONE_DEVICE)
......@@ -207,7 +225,7 @@ index c0ee4a16bb1..ed796a48c1b 100644
3- openpty (USE_OPENPTY)
When using the cloning device method, the macro USE_CLONE_DEVICE should
@@ -1141,7 +1141,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
@@ -1148,7 +1148,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
#if defined (__APPLE__) || defined (BSD)
#define USE_OPENPTY
#elif defined (__linux__)
......@@ -216,7 +234,7 @@ index c0ee4a16bb1..ed796a48c1b 100644
#elif defined (__sun__)
#define USE_CLONE_DEVICE "/dev/ptmx"
#elif defined (_AIX)
@@ -1190,8 +1190,8 @@ allocate_pty_desc (pty_desc **desc) {
@@ -1197,8 +1197,8 @@ allocate_pty_desc (pty_desc **desc) {
int master_fd = -1;
char *slave_name = NULL;
......@@ -227,6 +245,3 @@ index c0ee4a16bb1..ed796a48c1b 100644
#elif defined (USE_OPENPTY)
status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL);
#elif defined (USE_CLONE_DEVICE)
--
2.41.0
From: Celeste <cielesti@protonmail.com>
Date: Mon, 2 Sep 2024 02:54:17 +0000
Subject: [PATCH] libphobos: add riscv64 and loongarch64 support
Add musl support for these 2 architectures based on fenv.h and signal.h from:
https://git.musl-libc.org/cgit/musl/tree/arch/riscv64/bits?h=v1.2.5
https://git.musl-libc.org/cgit/musl/tree/arch/loongarch64/bits?h=v1.2.5
---
libphobos/libdruntime/core/stdc/fenv.d | 13 +++++++++++++
libphobos/libdruntime/core/sys/posix/signal.d | 10 ++++++++++
2 files changed, 23 insertions(+)
diff --git a/libphobos/libdruntime/core/stdc/fenv.d b/libphobos/libdruntime/core/stdc/fenv.d
index a7364c0a..5b327e4a 100644
--- a/libphobos/libdruntime/core/stdc/fenv.d
+++ b/libphobos/libdruntime/core/stdc/fenv.d
@@ -436,20 +436,33 @@ else version (CRuntime_Musl)
ushort __cs_selector;
ushort __opcode;
uint __data_offset;
ushort __data_selector;
ushort __unused5;
version (X86_64)
uint __mxcsr;
}
alias ushort fexcept_t;
}
+ else version (RISCV64)
+ {
+ alias uint fenv_t;
+ alias uint fexcept_t;
+ }
+ else version (LoongArch64)
+ {
+ struct fenv_t
+ {
+ uint __cw;
+ }
+ alias uint fexcept_t;
+ }
else
{
static assert(false, "Architecture not supported.");
}
}
else version (CRuntime_Newlib)
{
version (AArch64)
{
alias fenv_t = ulong;
diff --git a/libphobos/libdruntime/core/sys/posix/signal.d b/libphobos/libdruntime/core/sys/posix/signal.d
index a8b7f751..78d8b3cd 100644
--- a/libphobos/libdruntime/core/sys/posix/signal.d
+++ b/libphobos/libdruntime/core/sys/posix/signal.d
@@ -2751,20 +2751,30 @@ else version (CRuntime_Musl)
else version (PPC_Any)
{
enum MINSIGSTKSZ = 4096;
enum SIGSTKSZ = 10240;
}
else version (X86_Any)
{
enum MINSIGSTKSZ = 2048;
enum SIGSTKSZ = 8192;
}
+ else version (RISCV64)
+ {
+ enum MINSIGSTKSZ = 2048;
+ enum SIGSTKSZ = 8192;
+ }
+ else version (LoongArch64)
+ {
+ enum MINSIGSTKSZ = 4096;
+ enum SIGSTKSZ = 16384;
+ }
else
static assert(0, "unimplemented");
//ucontext_t (defined in core.sys.posix.ucontext)
//mcontext_t (defined in core.sys.posix.ucontext)
version (MIPS_Any)
{
struct stack_t
{
......@@ -34,7 +34,7 @@ _pkgsnap="${pkgver##*_git}"
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
pkgname=gcc-x86
pkgrel=2
pkgrel=3
pkgdesc="Stage2 cross-compiler for x86"
url="https://gcc.gnu.org"
arch="x86_64"
......@@ -64,6 +64,7 @@ _libitm=true
if [ "$CHOST" != "$CTARGET" ]; then
if [ "$BOOTSTRAP" = nolibc ]; then
LANG_CXX=false
LANG_D=false
LANG_ADA=false
_libgcc=false
_builddir="$srcdir/build-cross-pass2"
......@@ -73,7 +74,6 @@ if [ "$CHOST" != "$CTARGET" ]; then
LANG_OBJC=false
LANG_GO=false
LANG_FORTRAN=false
LANG_D=false
LANG_JIT=false
_libgomp=false
_libatomic=false
......@@ -115,7 +115,6 @@ elif [ "$CBUILD" != "$CHOST" ]; then
LANG_OBJC=false
LANG_GO=false
LANG_FORTRAN=false
LANG_D=false
LANG_JIT=false
STRIP_FOR_TARGET=${CROSS_COMPILE}strip
......@@ -140,11 +139,11 @@ else
export BOOT_LDFLAGS="$LDFLAGS"
fi
case "$CARCH" in
case "$CTARGET_ARCH" in
# GDC hasn't been ported to PowerPC
# See libphobos/configure.tgt in GCC sources for supported targets
# riscv fails with: error: static assert "unimplemented"
ppc64le|riscv64|loongarch64) LANG_D=false ;;
ppc64le|riscv64) LANG_D=false ;;
# GDC does currently not work on 32-bit musl architectures.
# This is a known upstream issue.
# See: https://github.com/dlang/druntime/pull/3383
......@@ -171,7 +170,7 @@ esac
# currently on x86, x86_64 and ia64
_libquadmath=$LANG_FORTRAN
case "$CTARGET_ARCH" in
x86 | x86_64) _libquadmath=$LANG_FORTRAN ;;
x86 | x86_64 | ppc64le) _libquadmath=$LANG_FORTRAN ;;
*) _libquadmath=false ;;
esac
......@@ -184,13 +183,8 @@ if $_libgomp; then
subpackages="$subpackages libgomp::$CTARGET_ARCH"
fi
case "$CARCH" in
riscv64)
LANG_ADA=false;;
esac
case "$CTARGET_ARCH" in
loongarch64)
riscv64|loongarch64)
LANG_ADA=false;;
esac
......@@ -199,9 +193,17 @@ if $LANG_CXX; then
_languages="$_languages,c++"
fi
if $LANG_D; then
subpackages="$subpackages libgphobos::$CTARGET_ARCH gcc-gdc$_target:gdc"
subpackages="$subpackages gcc-gdc$_target:gdc"
_languages="$_languages,d"
makedepends_build="$makedepends_build libucontext-dev gcc-gdc-bootstrap"
makedepends_build="$makedepends_build libucontext-dev"
if [ "$CBUILD" = "$CTARGET" ]; then
makedepends_build="$makedepends_build gcc-gdc-bootstrap"
subpackages="$subpackages libgphobos::$CTARGET_ARCH"
else
# shared libgphobos is for D programs to link against, so
# skip building that while cross-compiling the GDC compiler
makedepends_build="$makedepends_build gcc-gdc gcc-gdc$_cross"
fi
fi
if $LANG_OBJC; then
subpackages="$subpackages libobjc::$CTARGET_ARCH gcc-objc$_target:objc"
......@@ -278,7 +280,9 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkg
0033-libphobos-do-not-use-LFS64-symbols.patch
0034-libgo-fix-lfs64-use.patch
0035-loongarch-disable-multilib-support.patch
0036-libphobos-add-riscv64-and-loongarch64-support.patch
fix-arm64.patch
ppc64le-quadmath.patch
"
# secfixes:
......@@ -339,7 +343,7 @@ build() {
i586-*-*-*) _arch_configure="--with-arch=pentium-m --with-fpmath=sse --with-tune=generic --enable-cld";;
s390x-*-*-*) _arch_configure="--with-arch=z196 --with-tune=zEC12 --with-zarch --with-long-double-128 --enable-decimal-float";;
riscv64-*-*-*) _arch_configure="--with-arch=rv64gc --with-abi=lp64d --enable-autolink-libatomic";;
loongarch64-*-*-*) _arch_configure="--with-arch=loongarch64 --with-abi=lp64d --with-tls=trad";;
loongarch64-*-*-*) _arch_configure="--with-arch=loongarch64 --with-abi=lp64d";;
esac
case "$CTARGET_ARCH" in
......@@ -360,20 +364,23 @@ build() {
case "$BOOTSTRAP" in
nolibc) _bootstrap_configure="--with-newlib --disable-shared --enable-threads=no" ;;
*) _bootstrap_configure="--enable-shared --enable-threads --enable-tls" ;;
*)
# cross-bootstrap GDC with a static libphobos: due to GCC's
# ./configure not having a --disable-shared=libphobos option,
# we have to use --enable-shared with everything else instead.
if $LANG_D && [ "$CBUILD" != "$CTARGET" ]; then
_bootstrap_configure="--enable-shared=libgcc,libstdc++,libffi,zlib,boehm-gc,ada,libada,libgo,libobjc,libatomic,libgomp,libitm,libgfortran,libquadmath"
else
_bootstrap_configure="--enable-shared"
fi
_bootstrap_configure="$_bootstrap_configure --enable-threads --enable-tls"
;;
esac
$_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
$_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
$_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
if ! $_libquadmath; then
_arch_configure="$_arch_configure --disable-libquadmath"
# ppc64le needs both --disable-libquadmath{,-support}
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116007
[ "$CARCH" = "ppc64le" ] &&
_arch_configure="$_arch_configure
--disable-libquadmath-support"
fi
$_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath"
msg "Building the following:"
echo ""
......@@ -427,6 +434,10 @@ build() {
--with-pkgversion="$version"
msg "building gcc"
if $LANG_D && [ "$CBUILD" != "$CTARGET" ]; then
# cross-compiling libphobos with parallel make fails
make all-target-libphobos
fi
make
# we build gccjit separate to not build all of gcc with --enable-host-shared
......@@ -667,9 +678,9 @@ libgphobos() {
gdc() {
pkgdesc="GCC-based D language compiler"
depends="gcc=$_gccrel libgphobos=$_gccrel musl-dev"
depends="$depends libucontext-dev"
provides="gcc-gdc-bootstrap=$_gccrel"
depends="gcc$_target=$_gccrel musl-dev libucontext-dev"
[ "$CBUILD" = "$CTARGET" ] && depends="$depends libgphobos=$_gccrel"
[ "$CHOST" = "$CTARGET" ] && provides="gcc-gdc-bootstrap=$_gccrel"
mkdir -p "$subpkgdir/$_gcclibexec" \
"$subpkgdir"/$_gcclibdir/include/d/ \
......@@ -680,13 +691,25 @@ gdc() {
# without installing the compiler
mv "$pkgdir/$_gcclibexec/d21" "$subpkgdir/$_gcclibexec/"
mv "$pkgdir"/$_gcclibdir/include/d/* "$subpkgdir"/$_gcclibdir/include/d/
mv "$pkgdir"/usr/lib/libgdruntime.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgdruntime.so "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.so "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.spec "$subpkgdir"/usr/lib/
if [ "$CBUILD" = "$CTARGET" ]; then
mv "$pkgdir"/usr/lib/libgdruntime.so "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.so "$subpkgdir"/usr/lib/
fi
if [ "$CHOST" = "$CTARGET" ]; then
mv "$pkgdir"/usr/lib/libgdruntime.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.spec "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/bin/gdc "$subpkgdir"/usr/bin/
else
mkdir -p "$subpkgdir"/usr/$CTARGET/lib/
mv "$pkgdir"/usr/$CTARGET/lib/libgdruntime.a \
"$subpkgdir"/usr/$CTARGET/lib/
mv "$pkgdir"/usr/$CTARGET/lib/libgphobos.a \
"$subpkgdir"/usr/$CTARGET/lib/
mv "$pkgdir"/usr/$CTARGET/lib/libgphobos.spec \
"$subpkgdir"/usr/$CTARGET/lib/
fi
mv "$pkgdir"/usr/bin/$CTARGET-gdc "$subpkgdir"/usr/bin/
mv "$pkgdir"/usr/bin/gdc "$subpkgdir"/usr/bin/
}
libgo() {
......@@ -828,7 +851,7 @@ f382eb5f7c2c60c5a23fac587c9629a3059d7be0898e97a1feaf9b9cbe1ef4693cc1177eb29333e8
abf845792433a21fed5dd06167b9f6cf5e8f8026a409acce93824e466c5148e192bf5f404a271931fe4b65283499329bf67bb01019f2f3e02501f20619404e6c 0023-riscv-disable-multilib-support.patch
ab88a2f63e3545bbc36537aa9a86f2c6c35e41bbf702d6e13743a405cdac4f901eed5737189b780da96647fea9f5d863fdc76373f25a00064106dcb5514d6d87 0024-always-build-libgcc_eh.a.patch
8fdbe0c8bf4ca60f458a33e59027de03d15ac91933fe46d8ca62119346d20b9bc2447c0bf22bceb63d0cf8613ab61512d9197f4e6c2224af473b63ef9f254295 0025-ada-libgnarl-compatibility-for-musl.patch
5fd23a506b55c88d4f000e01c539eb25d6da2516949c9d7a1c9ee20f4c6b627e4788541284d9c14c33bafa7cb43ce2e0469dd91006152f00e30815107150320f 0026-ada-musl-support-fixes.patch
684bf2db12aa45e8db7a895ab0f227b4e4351f611b4fcc6e1745d7ad94d31b3554f39d8cf9e2203520b3c6ee35cf309b417d4a842e7a8cd55a2b2accb23f2f24 0026-ada-musl-support-fixes.patch
3f9a406d7d2ce34951215ffbcadb49a45e55ad5c24ab9097c0e5e92383e43b876872ccd2a7e7def2833ab204975ee5733f8bcf90934db9fa9c4f6f56c62081f6 0027-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
720a4001f9a1fa4122e456077ecff8d3eb8af7c83d0a81f9da6a6cca05b23664206a82a349e34482c48bfe40e99aa5f21567613d0913f6a24f282bc84a994496 0028-configure-fix-detection-of-atomic-builtins-in-libato.patch
2044c23b23726965c0a6fd39f616cc464badd650947cb40495eeabd906a3af629878c1d28b403b8eb46b30a1a0ba39083023290d62f0c99ccf070063226e3f8f 0029-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
......@@ -838,5 +861,7 @@ b325035cb7122d79c6b42ca6d3fc9e02319ed2f7cddb0639dff25d2798d2ce63812cd623462cdf95
c474f34e6f9a4239d486a65141a133dbe8ce91427d502a57a9fd6eb403478a2b5715ba74f24c1cc0761e16eec77ba2c1ca921fb7d7bc1e040fc3703fc9559e75 0033-libphobos-do-not-use-LFS64-symbols.patch
c4482ffc36e7894b2140800159f4cbc9a3e9011e43a69b69f4fa92d5a11e2ee645c7e21df4423dd1e0636e8890849a5719647bfbdf84f951d638f8f488cb718c 0034-libgo-fix-lfs64-use.patch
65df1d489e8d07a811f39e27fd29e3b2b4164fbc2c5fdc16a5142886d94a96e3fb28ccf4f20dd297ba6540ef8ea1ac3eb65a4279494639bf2f0f8376a3896cc3 0035-loongarch-disable-multilib-support.patch
06f64544fd8bc4b6c8b06410c5198aa8fb4e82c232afc0cad83b2c69ac5d39399968206defa78297222700cd18e7fd7e8244afa76d343406a01f657c86306453 0036-libphobos-add-riscv64-and-loongarch64-support.patch
00319c9770362520e8e93bd03fda1769dfa3622eba77d620e11d8af45a38e6d804a5e924046ae388e1cfaea605696e89c343fca507aaaa5edd58d80744fff14f fix-arm64.patch
815265826742400f86336f0c2d3e4edc37398dbc6505ee81107c0103c13ac0f406cff851438d2323033c6c6d0c0323765ee15b975eab8d1dd465f9e988168fb9 ppc64le-quadmath.patch
"
Patch-Source: https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=3fe5720430a9ba61ed7562aac4d758cc77d49a28
--
From 3fe5720430a9ba61ed7562aac4d758cc77d49a28 Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Sat, 3 Aug 2024 20:37:54 +0200
Subject: [PATCH] libquadmath: Fix up libquadmath/math/sqrtq.c compilation in
some powerpc* configurations [PR116007]
My PR114623 change started using soft-fp.h and quad.h for the sqrtq implementation.
Unfortunately, that seems to fail building in some powerpc* configurations, where
TFmode isn't available.
quad.h has:
#ifndef TFtype
typedef float TFtype __attribute__ ((mode (TF)));
#endif
and uses TFtype. quad.h has:
/* Define the complex type corresponding to __float128
("_Complex __float128" is not allowed) */
#if (!defined(_ARCH_PPC)) || defined(__LONG_DOUBLE_IEEE128__)
typedef _Complex float __attribute__((mode(TC))) __complex128;
#else
typedef _Complex float __attribute__((mode(KC))) __complex128;
#endif
with the conditional and KCmode use added during porting of libquadmath
to powerpc*, so I've just defined TFtype for powerpc when __LONG_DOUBLE_IEEE128__
isn't defined; I could define it to float __attribute__ ((mode (KF))) but it
seemed easier to just define it to __float128 which should do the same thing.
2024-08-03 Jakub Jelinek <jakub@redhat.com>
PR target/116007
* math/sqrtq.c (TFtype): For PowerPC without __LONG_DOUBLE_IEEE128__
define to __float128 before including soft-fp.h and quad.h.
(cherry picked from commit 3ac02e67503ccffa3dfeeffc0a60fce6bdaca43b)
---
libquadmath/math/sqrtq.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libquadmath/math/sqrtq.c b/libquadmath/math/sqrtq.c
index 8ca2828d42ce..a58998a06670 100644
--- a/libquadmath/math/sqrtq.c
+++ b/libquadmath/math/sqrtq.c
@@ -9,6 +9,9 @@
&& defined(FE_TOWARDZERO) \
&& defined(FE_INEXACT)
#define USE_SOFT_FP 1
+#if defined(_ARCH_PPC) && !defined(__LONG_DOUBLE_IEEE128__)
+#define TFtype __float128
+#endif
#include "../../libgcc/soft-fp/soft-fp.h"
#include "../../libgcc/soft-fp/quad.h"
#endif
--
2.43.5