Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 1 | From cbbf1a8ba7f037ba3b83f090829edcbab542c285 Mon Sep 17 00:00:00 2001 |
| 2 | From: Szabolcs Nagy <szabolcs.nagy@arm.com> |
| 3 | Date: Thu, 13 Dec 2018 17:47:17 +0000 |
| 4 | Subject: [PATCH] AArch64: Fix the gdb build with musl libc |
| 5 | |
| 6 | Including asm/sigcontext.h together with libc headers is not valid. In |
| 7 | general linux headers may not work with libc headers, so mixing them |
| 8 | should be avoided, especially when the linux header defines types that |
| 9 | are also exposed in libc headers. |
| 10 | |
| 11 | In case of asm/sigcontext.h glibc happens to work because glibc signal.h |
| 12 | directly includes it, but e.g. in musl libc signal.h replicates the |
| 13 | sigcontext.h definitions in an abi compatible way which are in conflict |
| 14 | with the linux definitions when both headers are included. |
| 15 | |
| 16 | Since old linux headers or old libc headers may not have the necessary |
| 17 | definitions, gdb has to replicate the definitions it relies on anyway. |
| 18 | Which is fine since all definitions must be ABI stable. For linux apis |
| 19 | that are not available via libc headers, replicating the definitions in |
| 20 | gdb is the most reliable way to use them. |
| 21 | |
| 22 | Note: asm/ptrace.h includes asm/sigcontext.h in some versions of linux |
| 23 | headers, which is just as problematic and should be fixed in linux. |
| 24 | |
| 25 | gdb/ChangeLog: |
| 26 | |
| 27 | * nat/aarch64-sve-linux-ptrace.h: Include signal.h instead of |
| 28 | asm/sigcontext.h. |
| 29 | |
| 30 | [ChangeLog entry stripped so that patch applies cleanly] |
| 31 | Upstream-Status: Backport |
| 32 | Signed-off-by: Paul Barker <paul@betafive.co.uk> |
| 33 | --- |
| 34 | gdb/nat/aarch64-sve-linux-ptrace.h | 2 +- |
| 35 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 36 | |
| 37 | diff --git a/gdb/nat/aarch64-sve-linux-ptrace.h b/gdb/nat/aarch64-sve-linux-ptrace.h |
| 38 | index 029e753ffe..172ae39432 100644 |
| 39 | --- a/gdb/nat/aarch64-sve-linux-ptrace.h |
| 40 | +++ b/gdb/nat/aarch64-sve-linux-ptrace.h |
| 41 | @@ -20,7 +20,7 @@ |
| 42 | #ifndef AARCH64_SVE_LINUX_PTRACE_H |
| 43 | #define AARCH64_SVE_LINUX_PTRACE_H |
| 44 | |
| 45 | -#include <asm/sigcontext.h> |
| 46 | +#include <signal.h> |
| 47 | #include <sys/utsname.h> |
| 48 | #include <sys/ptrace.h> |
| 49 | #include <asm/ptrace.h> |
| 50 | -- |
| 51 | 2.17.1 |
| 52 | |