Subject: [alpine-aports] [PATCH] main/libunwind: fix build on mips* (glibcisms)

From: alpine-mips-patches <[email-masked]>
Date: Thu, 20 Dec 2018 14:06:58 +0000

---
 main/libunwind/APKBUILD            |  9 ++-
 main/libunwind/musl-mips-fix.patch | 95 ++++++++++++++++++++++++++++++
 2 files changed, 101 insertions(+), 3 deletions(-)
 create mode 100644 main/libunwind/musl-mips-fix.patch

diff --git a/main/libunwind/APKBUILD b/main/libunwind/APKBUILD
index 21faae55c0..80ea003530 100644
--- a/main/libunwind/APKBUILD
+++ b/main/libunwind/APKBUILD
@@ -3,7 +3,7 @@
 pkgname=libunwind
 pkgver=1.2.1
 _pkgver=${pkgver/_/-}
-pkgrel=1
+pkgrel=2
 pkgdesc="Portable and efficient C programming interface (API) to determine the call-chain of a program"
 url="http://www.nongnu.org/libunwind/"
 arch="all !s390x !x86 !ppc64le"
@@ -14,7 +14,9 @@ makedepends="$depends_dev autoconf automake libtool linux-headers"
 subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc"
 source="https://download.savannah.gnu.org/releases/libunwind/libunwind-$_pkgver.tar.gz
 	force-enable-man.patch
-	fix-UNW_VERSION_MINOR.patch"
+	fix-UNW_VERSION_MINOR.patch
+	musl-mips-fix.patch
+	"
 builddir="$srcdir/$pkgname-$_pkgver"
 
 build() {
@@ -39,4 +41,5 @@ package() {
 
 sha512sums="af7c280d2a963779a4a2711887618bc96383011e4e5d52e4085aa7fb351e55e357468f6ff85e66a216f1c6826538f498335a917a5970575c93be74c96316319b  libunwind-1.2.1.tar.gz
 7c2b9f48b74464c8c27367bfb0ede317bfbc5fc392c0d1371a9a82ae518d3799c019f6e258ec2262c4117c6fb936c40b7cb9f2bfebddb3ea4efbbcbcc4268822  force-enable-man.patch
-6efc82cb6ab042da68f982789644896b1dd24d6232f5ffd911f9aedcb01439d6b794c0534b64ee7c39f1ea46fff563e980c6650291440365e577ea0b4abc3436  fix-UNW_VERSION_MINOR.patch"
+6efc82cb6ab042da68f982789644896b1dd24d6232f5ffd911f9aedcb01439d6b794c0534b64ee7c39f1ea46fff563e980c6650291440365e577ea0b4abc3436  fix-UNW_VERSION_MINOR.patch
+e0652d85512ef8b1446fc9956fea0fad9978fe639f5dd5afcfcbb2b31584fb9026851bf8ebc9fe9fb535a8a0490e2bdf71b32a19195f5c5aa6b330feebbb0b03  musl-mips-fix.patch"
diff --git a/main/libunwind/musl-mips-fix.patch b/main/libunwind/musl-mips-fix.patch
new file mode 100644
index 0000000000..4835513d2a
--- /dev/null
+++ b/main/libunwind/musl-mips-fix.patch
@@ -0,0 +1,95 @@
+--- a/src/coredump/_UCD_access_reg_linux.c
++++ b/src/coredump/_UCD_access_reg_linux.c
+@@ -55,36 +55,36 @@
+ #if defined(UNW_TARGET_MIPS)
+   static const uint8_t remap_regs[] =
+     {
+-      [UNW_MIPS_R0]  = EF_REG0,
+-      [UNW_MIPS_R1]  = EF_REG1,
+-      [UNW_MIPS_R2]  = EF_REG2,
+-      [UNW_MIPS_R3]  = EF_REG3,
+-      [UNW_MIPS_R4]  = EF_REG4,
+-      [UNW_MIPS_R5]  = EF_REG5,
+-      [UNW_MIPS_R6]  = EF_REG6,
+-      [UNW_MIPS_R7]  = EF_REG7,
+-      [UNW_MIPS_R8]  = EF_REG8,
+-      [UNW_MIPS_R9]  = EF_REG9,
+-      [UNW_MIPS_R10] = EF_REG10,
+-      [UNW_MIPS_R11] = EF_REG11,
+-      [UNW_MIPS_R12] = EF_REG12,
+-      [UNW_MIPS_R13] = EF_REG13,
+-      [UNW_MIPS_R14] = EF_REG14,
+-      [UNW_MIPS_R15] = EF_REG15,
+-      [UNW_MIPS_R16] = EF_REG16,
+-      [UNW_MIPS_R17] = EF_REG17,
+-      [UNW_MIPS_R18] = EF_REG18,
+-      [UNW_MIPS_R19] = EF_REG19,
+-      [UNW_MIPS_R20] = EF_REG20,
+-      [UNW_MIPS_R21] = EF_REG21,
+-      [UNW_MIPS_R22] = EF_REG22,
+-      [UNW_MIPS_R23] = EF_REG23,
+-      [UNW_MIPS_R24] = EF_REG24,
+-      [UNW_MIPS_R25] = EF_REG25,
+-      [UNW_MIPS_R28] = EF_REG28,
+-      [UNW_MIPS_R29] = EF_REG29,
+-      [UNW_MIPS_R30] = EF_REG30,
+-      [UNW_MIPS_R31] = EF_REG31,
++      [UNW_MIPS_R0]  = EF_R0,
++      [UNW_MIPS_R1]  = EF_R1,
++      [UNW_MIPS_R2]  = EF_R2,
++      [UNW_MIPS_R3]  = EF_R3,
++      [UNW_MIPS_R4]  = EF_R4,
++      [UNW_MIPS_R5]  = EF_R5,
++      [UNW_MIPS_R6]  = EF_R6,
++      [UNW_MIPS_R7]  = EF_R7,
++      [UNW_MIPS_R8]  = EF_R8,
++      [UNW_MIPS_R9]  = EF_R9,
++      [UNW_MIPS_R10] = EF_R10,
++      [UNW_MIPS_R11] = EF_R11,
++      [UNW_MIPS_R12] = EF_R12,
++      [UNW_MIPS_R13] = EF_R13,
++      [UNW_MIPS_R14] = EF_R14,
++      [UNW_MIPS_R15] = EF_R15,
++      [UNW_MIPS_R16] = EF_R16,
++      [UNW_MIPS_R17] = EF_R17,
++      [UNW_MIPS_R18] = EF_R18,
++      [UNW_MIPS_R19] = EF_R19,
++      [UNW_MIPS_R20] = EF_R20,
++      [UNW_MIPS_R21] = EF_R21,
++      [UNW_MIPS_R22] = EF_R22,
++      [UNW_MIPS_R23] = EF_R23,
++      [UNW_MIPS_R24] = EF_R24,
++      [UNW_MIPS_R25] = EF_R25,
++      [UNW_MIPS_R28] = EF_R28,
++      [UNW_MIPS_R29] = EF_R29,
++      [UNW_MIPS_R30] = EF_R30,
++      [UNW_MIPS_R31] = EF_R31,
+       [UNW_MIPS_PC]  = EF_CP0_EPC,
+     };
+ #elif defined(UNW_TARGET_X86)
+--- a/src/coredump/_UCD_lib.h
++++ b/src/coredump/_UCD_lib.h
+@@ -50,6 +50,7 @@
+ #include <stdbool.h>
+ #include <limits.h>
+ #include <sys/param.h>
++#include <sys/reg.h>
+ #include <pwd.h>
+ #include <grp.h>
+ #include <syslog.h>
+--- a/src/mips/getcontext.S
++++ b/src/mips/getcontext.S
+@@ -24,12 +24,11 @@
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
+ 
+ #include "offsets.h"
+-#include <endian.h>
+ 
+ 	.text
+ 
+ #if _MIPS_SIM == _ABIO32
+-# if __BYTE_ORDER == __BIG_ENDIAN
++# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+ #  define OFFSET 4
+ # else
+ #  define OFFSET 0
-- 
2.20.1

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