package/gdb: disable gdb 8.2 for aarch64 and kernel headers < 5.0
PATCH 1/2 package/gdb: disable gdb 8.2 for aarch64 and kernel headers < 5.0
gdb 8.2 on aarch64 needs kernel headers >= 5.0 due to issues with the new SVE kernel support introduced by [1].
[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=95228a0d790f16deae3436e18f41b70fc711a5b2
These issues are fixed in by the following patches in kernel >= 5.0.
[arm64/sve: Disentangle <uapi/asm/ptrace.h> from <uapi/asm/sigcontext.h>]
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=9966a05c7b80f075f2bc7e48dbb108d3f2927234
[arm64/sve: ptrace: Fix SVE_PT_REGS_OFFSET definition]
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=ee1b465b303591d3a04d403122bbc0d7026520fb
--- package/gdb/Config.in.host | 2 ++ 1 file changed, 2 insertions(+)
package/gdb/Config.in.host +2 -0
@@ -68,6 +68,8 @@ config BR2_GDB_VERSION_8_2 bool "gdb 8.2.x" # Needs a C++11 compiler depends on BR2_HOST_GCC_AT_LEAST_4_8 + # Issue with kernel headers < 5.0 and musl + depends on !BR2_aarch64 || (BR2_aarch64 && !BR2_TOOLCHAIN_USES_MUSL) endchoice
Signature · 1 line
2.14.5
PATCH 2/2 package/gdb/8.2.1: fix gdb build with musl and kernel headers
As reported by toolchain builder [1], gdb 8.2.1 doesn't build with musl toolchains on aarch64.
Backport an upstream patch [2].
Keep gdb 8.2.x disable for aarch64 with musl toolchain since it require kernel headers > 5.0. We can enable this gdb version as soon as we have BR2_TOOLCHAIN_HEADERS_AT_LEAST_6_0 symbol in Buildroot.
[1] https://gitlab.com/kubu93/toolchains-builder/-/jobs/148356393
[2] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=51b4f73a37c2e7eec31e932fc3c8dae879735f63
--- ...-AArch64-Fix-the-gdb-build-with-musl-libc.patch | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 package/gdb/8.2.1/0006-AArch64-Fix-the-gdb-build-with-musl-libc.patch
package/gdb/8.2.1/0006-AArch64-Fix-the-gdb-build-with-musl-libc.patch new file +52 -0
@@ -0,0 +1,52 @@ +From dc3493a11c987edc1c85d9bd7f2242b5bffb7430 Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy <[email protected]> +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. + +gdb/ChangeLog: + + * nat/aarch64-sve-linux-ptrace.h: Include signal.h instead of + asm/sigcontext.h. + +[Romain: backport to 8.2 from upstream commit + 51b4f73a37c2e7eec31e932fc3c8dae879735f63] +Signed-off-by: Romain Naour <[email protected]> +--- + gdb/nat/aarch64-sve-linux-ptrace.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/nat/aarch64-sve-linux-ptrace.h b/gdb/nat/aarch64-sve-linux-ptrace.h +index 029e753ffe8..172ae39432f 100644 +--- a/gdb/nat/aarch64-sve-linux-ptrace.h ++++ b/gdb/nat/aarch64-sve-linux-ptrace.h +@@ -20,7 +20,7 @@ + #ifndef AARCH64_SVE_LINUX_PTRACE_H + #define AARCH64_SVE_LINUX_PTRACE_H + +-#include <asm/sigcontext.h> ++#include <signal.h> + #include <sys/utsname.h> + #include <sys/ptrace.h> + #include <asm/ptrace.h> +-- +2.14.5 +
Signature · 1 line
2.14.5