xref: /OK3568_Linux_fs/buildroot/package/gdb/11.2/0004-gdbserver-fix-build-for-m68k.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 90ebe548922538b854de52e8b687384f44360984 Mon Sep 17 00:00:00 2001
2From: Romain Naour <romain.naour@gmail.com>
3Date: Fri, 22 Jun 2018 22:40:26 +0200
4Subject: [PATCH] gdbserver: fix build for m68k
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9As for strace [1], when <sys/reg.h> is included after <linux/ptrace.h>,
10the build fails on m68k with the following diagnostics:
11
12In file included from ./../nat/linux-ptrace.h:28:0,
13                 from linux-low.h:27,
14                 from linux-m68k-low.c:20:
15[...]/usr/include/sys/reg.h:26:3: error: expected identifier before numeric constant
16   PT_D1 = 0,
17   ^
18[...]usr/include/sys/reg.h:26:3: error: expected « } » before numeric constant
19[...]usr/include/sys/reg.h:26:3: error: expected unqualified-id before numeric constant
20In file included from linux-m68k-low.c:27:0:
21[...]usr/include/sys/reg.h:99:1: error: expected declaration before « } » token
22 };
23 ^
24
25Fix this by moving <sys/reg.h> on top of "linux-low.h".
26
27[1] https://github.com/strace/strace/commit/6ebf6c4f9e5ebca123a5b5f24afe67cf0473cf92
28
29Signed-off-by: Romain Naour <romain.naour@gmail.com>
30---
31 gdbserver/linux-m68k-low.cc | 9 +++++----
32 1 file changed, 5 insertions(+), 4 deletions(-)
33
34diff --git a/gdbserver/linux-m68k-low.cc b/gdbserver/linux-m68k-low.cc
35index 838ba353b0b..36679682b9a 100644
36--- a/gdbserver/linux-m68k-low.cc
37+++ b/gdbserver/linux-m68k-low.cc
38@@ -17,6 +17,11 @@
39    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
40
41 #include "server.h"
42+
43+#ifdef HAVE_SYS_REG_H
44+#include <sys/reg.h>
45+#endif
46+
47 #include "linux-low.h"
48
49 /* Linux target op definitions for the m68k architecture.  */
50@@ -80,10 +85,6 @@ m68k_target::low_decr_pc_after_break ()
51 void init_registers_m68k (void);
52 extern const struct target_desc *tdesc_m68k;
53
54-#ifdef HAVE_SYS_REG_H
55-#include <sys/reg.h>
56-#endif
57-
58 #define m68k_num_regs 29
59 #define m68k_num_gregs 18
60
61--
622.29.2
63
64