diff options
Diffstat (limited to 'sys-devel/gdb/files/gdb-8.2.1-aarch64-musl.patch')
1 files changed, 49 insertions, 0 deletions
diff --git a/sys-devel/gdb/files/gdb-8.2.1-aarch64-musl.patch b/sys-devel/gdb/files/gdb-8.2.1-aarch64-musl.patch
new file mode 100644
index 000000000000..70f42df90a91
--- /dev/null
+++ b/sys-devel/gdb/files/gdb-8.2.1-aarch64-musl.patch
@@ -0,0 +1,49 @@
+From 51b4f73a37c2e7eec31e932fc3c8dae879735f63 Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <>
+Date: Thu, 13 Dec 2018 17:47:17 +0000
+Subject: [PATCH] AArch64: Fix the gdb build with musl libc
+Including asm/sigcontext.h together with libc headers is not valid. In
+general linux headers may not work with libc headers, so mixing them
+should be avoided, especially when the linux header defines types that
+are also exposed in libc headers.
+In case of asm/sigcontext.h glibc happens to work because glibc signal.h
+directly includes it, but e.g. in musl libc signal.h replicates the
+sigcontext.h definitions in an abi compatible way which are in conflict
+with the linux definitions when both headers are included.
+Since old linux headers or old libc headers may not have the necessary
+definitions, gdb has to replicate the definitions it relies on anyway.
+Which is fine since all definitions must be ABI stable. For linux apis
+that are not available via libc headers, replicating the definitions in
+gdb is the most reliable way to use them.
+Note: asm/ptrace.h includes asm/sigcontext.h in some versions of linux
+headers, which is just as problematic and should be fixed in linux.
+ * nat/aarch64-sve-linux-ptrace.h: Include signal.h instead of
+ asm/sigcontext.h.
+ gdb/ChangeLog | 5 +++++
+ gdb/nat/aarch64-sve-linux-ptrace.h | 2 +-
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+--- a/gdb/nat/aarch64-sve-linux-ptrace.h
++++ b/gdb/nat/aarch64-sve-linux-ptrace.h
+@@ -20,7 +20,7 @@
+-#include <asm/sigcontext.h>
++#include <signal.h>
+ #include <sys/utsname.h>
+ #include <sys/ptrace.h>
+ #include <asm/ptrace.h>