0004-gdbserver-fix-build-for-m68k.patch 2.0 KB

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