Subject: [alpine-aports] [PATCH] main/gdb: fix build and runtime failure on mips*

From: alpine-mips-patches <[email-masked]>
Date: Wed, 19 Dec 2018 07:44:46 +0000

- include <asm/sgidefs.h> from linux-headers;
 - pass something that musl recognizes as a valid sigprocmask 'how'
   parameter to prevent early exit due to EINVAL; SIG_BLOCK is zero
   on non-mips* (wrt to Alpine's set of architectures) so all other
   targets should be unaffected.

The SIG_BLOCK patch should be dropped when proper musl fix appears.
---
 main/gdb/APKBUILD                          |  8 ++++++--
 main/gdb/mips-sgidefs.patch                | 11 +++++++++++
 main/gdb/musl-sigprocmask-workaround.patch | 11 +++++++++++
 3 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 main/gdb/mips-sgidefs.patch
 create mode 100644 main/gdb/musl-sigprocmask-workaround.patch

diff --git a/main/gdb/APKBUILD b/main/gdb/APKBUILD
index eea7176cf6..4661a092f7 100644
--- a/main/gdb/APKBUILD
+++ b/main/gdb/APKBUILD
@@ -1,7 +1,7 @@
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=gdb
 pkgver=8.2
-pkgrel=1
+pkgrel=2
 pkgdesc="The GNU Debugger"
 url="https://www.sourceware.org/gdb/"
 arch="all"
@@ -16,6 +16,8 @@ source="https://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.xz
 	ppc-musl.patch
 	ppc-ptregs.patch
 	aarch64-headers.patch
+	mips-sgidefs.patch
+	musl-sigprocmask-workaround.patch
 	"
 
 builddir="$srcdir"/$pkgname-$pkgver
@@ -65,4 +67,6 @@ sha512sums="11cc481bebc51eb6db73249ecb62b8c07455cf3db169f4860b3a83114849fbd2b586
 70e7d04e4d72461436da503b5bfa370c5779e03245c521f30e9779d5ff37dbb2d708b05f2afb27f43ad9defc44df4bd979d72f777e744851fdbf156295e1cc9f  s390x-use-elf-gdb_fpregset_t.patch
 04911f87904b62dd7662435f9182b20485afb29ddb3d6398a9d31fef13495f7b70639c77fdae3a40e2775e270d7cd40d0cfd7ddf832372b506808d33c8301e01  ppc-musl.patch
 b75e1c1ee503a1948a7d5b8d90427b5c7d38ded69978056cee0adca222771a5c95ed1ac73127fcae7b795ea94296344eee5fca47e4cd04b418c164a756fb0933  ppc-ptregs.patch
-cd4a22a3ee10c7326edd6a6766c39110ce1400ac7499db7a2140744c05deb573498b0501aad045bccbaea4e87d45b62a758bfe134760ae49a01402697483d601  aarch64-headers.patch"
+cd4a22a3ee10c7326edd6a6766c39110ce1400ac7499db7a2140744c05deb573498b0501aad045bccbaea4e87d45b62a758bfe134760ae49a01402697483d601  aarch64-headers.patch
+b2cfab08edcb319ecaa045da214aa7d28e28a0f00eb9ddb19f9e415158995452d27b2c833d293a92f23e1d70108548958c8e5a2f5b3f8bec55e5d4aa5a101761  mips-sgidefs.patch
+ea37747582efc55ce75fefdc72503c199311a2c1318d0b2e09384318b59d6ad79971d10a330b2db9cc917e56b62ebb0ce6d62ffc5482af2a81c8e999e162cd0c  musl-sigprocmask-workaround.patch"
diff --git a/main/gdb/mips-sgidefs.patch b/main/gdb/mips-sgidefs.patch
new file mode 100644
index 0000000000..ec4e9c2666
--- /dev/null
+++ b/main/gdb/mips-sgidefs.patch
@@ -0,0 +1,11 @@
+--- a/gdb/mips-linux-nat.c
++++ b/gdb/mips-linux-nat.c
+@@ -31,7 +31,7 @@
+ #include "gdb_proc_service.h"
+ #include "gregset.h"
+ 
+-#include <sgidefs.h>
++#include <asm/sgidefs.h>
+ #include "nat/gdb_ptrace.h"
+ #include <asm/ptrace.h>
+ #include "inf-ptrace.h"
diff --git a/main/gdb/musl-sigprocmask-workaround.patch b/main/gdb/musl-sigprocmask-workaround.patch
new file mode 100644
index 0000000000..a07e8715dc
--- /dev/null
+++ b/main/gdb/musl-sigprocmask-workaround.patch
@@ -0,0 +1,11 @@
+--- a/gdb/common/signals-state-save-restore.c
++++ b/gdb/common/signals-state-save-restore.c
+@@ -41,7 +41,7 @@
+   int i;
+   int res;
+ 
+-  res = sigprocmask (0,  NULL, &original_signal_mask);
++  res = sigprocmask (SIG_BLOCK,  NULL, &original_signal_mask);
+   if (res == -1)
+     perror_with_name (("sigprocmask"));
+ 
-- 
2.19.2

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