Subject: [alpine-aports] [PATCH] main/musl: fix setjmp/longjmp for MIPS O32 FP64 ABI

From: alpine-mips-patches <[email-masked]>
Date: Sun, 16 Sep 2018 01:22:21 +0300 (MSK)

This belongs in upstream of course however next musl release will
likely happen not so soon.

---
 main/musl/APKBUILD                            |  5 +-
 ...setjmp-longjmp-for-mips-o32-fp64-abi.patch | 50 +++++++++++++++++++
 2 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 main/musl/fix-setjmp-longjmp-for-mips-o32-fp64-abi.patch

diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD
index 4179769a00..fba87123cf 100644
--- a/main/musl/APKBUILD
+++ b/main/musl/APKBUILD
@@ -22,6 +22,8 @@ source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
 	getconf.c
 	getent.c
 	iconv.c
+
+	fix-setjmp-longjmp-for-mips-o32-fp64-abi.patch
 	"
 
 # secfixes:
@@ -146,4 +148,5 @@ sha512sums="d3a7a30aa375ca50d7dcfbd618581d59e1aa5378417f50a0ca5510099336fd74cc9d
 062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b  __stack_chk_fail_local.c
 0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d  getconf.c
 378d70e65bcc65bb4e1415354cecfa54b0c1146dfb24474b69e418cdbf7ad730472cd09f6f103e1c99ba6c324c9560bccdf287f5889bbc3ef0bdf0e08da47413  getent.c
-9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf  iconv.c"
+9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf  iconv.c
+a18ae9bd51a7ddf63dea1e912f23b1d80a7084c56fe9530f8171935bafaf80b5f230b8e56277cafd4a2bd340ad919ca12f97b46d7ed9dbb322999eceab73636a  fix-setjmp-longjmp-for-mips-o32-fp64-abi.patch"
diff --git a/main/musl/fix-setjmp-longjmp-for-mips-o32-fp64-abi.patch b/main/musl/fix-setjmp-longjmp-for-mips-o32-fp64-abi.patch
new file mode 100644
index 0000000000..04c87a9be7
--- /dev/null
+++ b/main/musl/fix-setjmp-longjmp-for-mips-o32-fp64-abi.patch
@@ -0,0 +1,50 @@
+--- a/src/setjmp/mips/longjmp.S
++++ b/src/setjmp/mips/longjmp.S
+@@ -12,6 +12,14 @@
+ 	addu    $2, $2, 1
+ 1:
+ #ifndef __mips_soft_float
++#if __mips_fpr == 64
++	ldc1	$20, 56($4)
++	ldc1	$22, 64($4)
++	ldc1	$24, 72($4)
++	ldc1	$26, 80($4)
++	ldc1	$28, 88($4)
++	ldc1	$30, 96($4)
++#else
+ 	lwc1    $20, 56($4)
+ 	lwc1    $21, 60($4)
+ 	lwc1    $22, 64($4)
+@@ -24,6 +32,7 @@
+ 	lwc1    $29, 92($4)
+ 	lwc1    $30, 96($4)
+ 	lwc1    $31, 100($4)
++#endif
+ #endif
+ 	lw      $ra,  0($4)
+ 	lw      $sp,  4($4)
+--- a/src/setjmp/mips/setjmp.S
++++ b/src/setjmp/mips/setjmp.S
+@@ -22,6 +22,14 @@
+ 	sw      $30, 40($4)
+ 	sw      $28, 44($4)
+ #ifndef __mips_soft_float
++#if __mips_fpr == 64
++	sdc1	$20, 56($4)
++	sdc1	$22, 64($4)
++	sdc1	$24, 72($4)
++	sdc1	$26, 80($4)
++	sdc1	$28, 88($4)
++	sdc1	$30, 96($4)
++#else
+ 	swc1    $20, 56($4)
+ 	swc1    $21, 60($4)
+ 	swc1    $22, 64($4)
+@@ -34,6 +42,7 @@
+ 	swc1    $29, 92($4)
+ 	swc1    $30, 96($4)
+ 	swc1    $31, 100($4)
++#endif
+ #endif
+ 	jr      $ra
+ 	li      $2, 0
-- 
2.19.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---