+++ /dev/null
-From 4d913bb73965fdb9c756e8d5916a829b60aa3a44 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Thu, 4 Aug 2016 23:44:24 +0200
-Subject: [PATCH] Revert "sim: unify SIM_CPU definition"
-
-This reverts commit 20bca71d82598a015de0991196e45f0b5f7ead81.
-
-This change causes a redefinition of SIM_CPU on the Blackfin
-architecture, as it is defined in both the common sim/common/sim-base.h
-and the architecture specific sim/bfin/sim-main.h.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- sim/arm/sim-main.h | 3 +++
- sim/avr/sim-main.h | 2 ++
- sim/bfin/sim-main.h | 2 --
- sim/common/sim-base.h | 2 --
- sim/cr16/sim-main.h | 2 ++
- sim/cris/sim-main.h | 5 +++++
- sim/d10v/sim-main.h | 2 ++
- sim/frv/sim-main.h | 10 ++++++++++
- sim/ft32/sim-main.h | 2 ++
- sim/h8300/sim-main.h | 3 +++
- sim/iq2000/sim-main.h | 5 +++++
- sim/lm32/sim-main.h | 5 +++++
- sim/m32r/sim-main.h | 5 +++++
- sim/m68hc11/sim-main.h | 3 +++
- sim/mcore/sim-main.h | 2 ++
- sim/microblaze/sim-main.h | 3 +++
- sim/mips/sim-main.h | 3 +++
- sim/mn10300/sim-main.h | 2 ++
- sim/moxie/sim-main.h | 3 +++
- sim/msp430/sim-main.h | 3 +++
- sim/sh/sim-main.h | 3 +++
- sim/sh64/sim-main.h | 5 +++++
- sim/v850/sim-main.h | 3 +++
- 23 files changed, 74 insertions(+), 4 deletions(-)
-
-diff --git a/sim/arm/sim-main.h b/sim/arm/sim-main.h
-index 9a37b98..ae622bd 100644
---- a/sim/arm/sim-main.h
-+++ b/sim/arm/sim-main.h
-@@ -20,6 +20,9 @@
- #define SIM_MAIN_H
-
- #include "sim-basics.h"
-+
-+typedef struct _sim_cpu SIM_CPU;
-+
- #include "sim-base.h"
- #include "bfd.h"
-
-diff --git a/sim/avr/sim-main.h b/sim/avr/sim-main.h
-index e0cac22..52904e3 100644
---- a/sim/avr/sim-main.h
-+++ b/sim/avr/sim-main.h
-@@ -23,6 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
- extern unsigned int pc;
-
-+typedef struct _sim_cpu SIM_CPU;
-+
- #include "sim-base.h"
-
- struct _sim_cpu {
-diff --git a/sim/bfin/sim-main.h b/sim/bfin/sim-main.h
-index 806fe15..53e1774 100644
---- a/sim/bfin/sim-main.h
-+++ b/sim/bfin/sim-main.h
-@@ -24,8 +24,6 @@
- #include "sim-basics.h"
- #include "sim-signal.h"
-
--/* TODO: Delete this. Need to convert bu32/etc... to common sim types
-- and unwind the bfin-sim.h/machs.h include below first though. */
- typedef struct _sim_cpu SIM_CPU;
-
- #include "bfin-sim.h"
-diff --git a/sim/common/sim-base.h b/sim/common/sim-base.h
-index 21f61f4..e90e07c 100644
---- a/sim/common/sim-base.h
-+++ b/sim/common/sim-base.h
-@@ -72,8 +72,6 @@ typedef address_word sim_cia;
- #define INVALID_INSTRUCTION_ADDRESS ((address_word)0 - 1)
- #endif
-
--/* TODO: Probably should just delete SIM_CPU. */
--typedef struct _sim_cpu SIM_CPU;
- typedef struct _sim_cpu sim_cpu;
-
- #include "sim-module.h"
-diff --git a/sim/cr16/sim-main.h b/sim/cr16/sim-main.h
-index a63b93e..1a80229 100644
---- a/sim/cr16/sim-main.h
-+++ b/sim/cr16/sim-main.h
-@@ -24,6 +24,8 @@
- typedef long int word;
- typedef unsigned long int uword;
-
-+typedef struct _sim_cpu SIM_CPU;
-+
- #include "sim-base.h"
- #include "bfd.h"
-
-diff --git a/sim/cris/sim-main.h b/sim/cris/sim-main.h
-index 4dc04a2..fec0039 100644
---- a/sim/cris/sim-main.h
-+++ b/sim/cris/sim-main.h
-@@ -24,6 +24,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
- #ifndef SIM_MAIN_H
- #define SIM_MAIN_H
-
-+#define USING_SIM_BASE_H
-+
-+struct _sim_cpu;
-+typedef struct _sim_cpu SIM_CPU;
-+
- #include "symcat.h"
- #include "sim-basics.h"
- #include "cgen-types.h"
-diff --git a/sim/d10v/sim-main.h b/sim/d10v/sim-main.h
-index 0b87811..a7d59dd 100644
---- a/sim/d10v/sim-main.h
-+++ b/sim/d10v/sim-main.h
-@@ -24,6 +24,8 @@
- typedef long int word;
- typedef unsigned long int uword;
-
-+typedef struct _sim_cpu SIM_CPU;
-+
- #include "sim-base.h"
- #include "bfd.h"
-
-diff --git a/sim/frv/sim-main.h b/sim/frv/sim-main.h
-index d5a67cb..fd12c4f 100644
---- a/sim/frv/sim-main.h
-+++ b/sim/frv/sim-main.h
-@@ -19,6 +19,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
- /* Main header for the frv. */
-
-+#define USING_SIM_BASE_H /* FIXME: quick hack */
-+
-+struct _sim_cpu; /* FIXME: should be in sim-basics.h */
-+typedef struct _sim_cpu SIM_CPU;
-+
-+/* Set the mask of unsupported traces. */
-+#define WITH_TRACE \
-+ (~(TRACE_alu | TRACE_decode | TRACE_memory | TRACE_model | TRACE_fpu \
-+ | TRACE_branch | TRACE_debug))
-+
- /* sim-basics.h includes config.h but cgen-types.h must be included before
- sim-basics.h and cgen-types.h needs config.h. */
- #include "config.h"
-diff --git a/sim/ft32/sim-main.h b/sim/ft32/sim-main.h
-index b27a690..a270a5d 100644
---- a/sim/ft32/sim-main.h
-+++ b/sim/ft32/sim-main.h
-@@ -25,6 +25,8 @@
- #include "sim-base.h"
- #include "bfd.h"
-
-+typedef struct _sim_cpu SIM_CPU;
-+
- #include "ft32-sim.h"
-
- struct _sim_cpu {
-diff --git a/sim/h8300/sim-main.h b/sim/h8300/sim-main.h
-index 6dbc1ac..e95c4d9 100644
---- a/sim/h8300/sim-main.h
-+++ b/sim/h8300/sim-main.h
-@@ -87,6 +87,9 @@ enum h8_typecodes {
- };
-
- #include "sim-basics.h"
-+
-+typedef struct _sim_cpu SIM_CPU;
-+
- #include "sim-base.h"
-
- /* Structure used to describe addressing */
-diff --git a/sim/iq2000/sim-main.h b/sim/iq2000/sim-main.h
-index 992520a..ce3baba 100644
---- a/sim/iq2000/sim-main.h
-+++ b/sim/iq2000/sim-main.h
-@@ -4,6 +4,11 @@
- #ifndef SIM_MAIN_H
- #define SIM_MAIN_H
-
-+#define USING_SIM_BASE_H /* FIXME: quick hack */
-+
-+struct _sim_cpu; /* FIXME: should be in sim-basics.h */
-+typedef struct _sim_cpu SIM_CPU;
-+
- /* sim-basics.h includes config.h but cgen-types.h must be included before
- sim-basics.h and cgen-types.h needs config.h. */
- #include "config.h"
-diff --git a/sim/lm32/sim-main.h b/sim/lm32/sim-main.h
-index 4894e8d..210bb8b 100644
---- a/sim/lm32/sim-main.h
-+++ b/sim/lm32/sim-main.h
-@@ -23,6 +23,11 @@
- #ifndef SIM_MAIN_H
- #define SIM_MAIN_H
-
-+#define USING_SIM_BASE_H /* FIXME: quick hack */
-+
-+struct _sim_cpu; /* FIXME: should be in sim-basics.h */
-+typedef struct _sim_cpu SIM_CPU;
-+
- #include "symcat.h"
- #include "sim-basics.h"
- #include "cgen-types.h"
-diff --git a/sim/m32r/sim-main.h b/sim/m32r/sim-main.h
-index cd39e98..74bb513 100644
---- a/sim/m32r/sim-main.h
-+++ b/sim/m32r/sim-main.h
-@@ -3,6 +3,11 @@
- #ifndef SIM_MAIN_H
- #define SIM_MAIN_H
-
-+#define USING_SIM_BASE_H /* FIXME: quick hack */
-+
-+struct _sim_cpu; /* FIXME: should be in sim-basics.h */
-+typedef struct _sim_cpu SIM_CPU;
-+
- #include "symcat.h"
- #include "sim-basics.h"
- #include "cgen-types.h"
-diff --git a/sim/m68hc11/sim-main.h b/sim/m68hc11/sim-main.h
-index d1fc582..4f41db9 100644
---- a/sim/m68hc11/sim-main.h
-+++ b/sim/m68hc11/sim-main.h
-@@ -25,6 +25,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
- #define SIM_HANDLES_LMA 1
-
- #include "sim-basics.h"
-+
-+typedef struct _sim_cpu SIM_CPU;
-+
- #include "sim-signal.h"
- #include "sim-base.h"
-
-diff --git a/sim/mcore/sim-main.h b/sim/mcore/sim-main.h
-index be50ec1..25698c1 100644
---- a/sim/mcore/sim-main.h
-+++ b/sim/mcore/sim-main.h
-@@ -24,6 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
- typedef long int word;
- typedef unsigned long int uword;
-
-+typedef struct _sim_cpu SIM_CPU;
-+
- #include "sim-base.h"
- #include "bfd.h"
-
-diff --git a/sim/microblaze/sim-main.h b/sim/microblaze/sim-main.h
-index 6781374..6b7b776 100644
---- a/sim/microblaze/sim-main.h
-+++ b/sim/microblaze/sim-main.h
-@@ -20,6 +20,9 @@
-
- #include "microblaze.h"
- #include "sim-basics.h"
-+
-+typedef struct _sim_cpu SIM_CPU;
-+
- #include "sim-base.h"
-
- /* The machine state.
-diff --git a/sim/mips/sim-main.h b/sim/mips/sim-main.h
-index 8d698ad..9729804 100644
---- a/sim/mips/sim-main.h
-+++ b/sim/mips/sim-main.h
-@@ -29,6 +29,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
- mips_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), (TRANSFER), (ERROR))
-
- #include "sim-basics.h"
-+
-+typedef struct _sim_cpu SIM_CPU;
-+
- #include "sim-base.h"
- #include "bfd.h"
-
-diff --git a/sim/mn10300/sim-main.h b/sim/mn10300/sim-main.h
-index 847506e..2ddbfb9 100644
---- a/sim/mn10300/sim-main.h
-+++ b/sim/mn10300/sim-main.h
-@@ -42,6 +42,8 @@
- #include "itable.h"
- #include "idecode.h"
-
-+typedef struct _sim_cpu SIM_CPU;
-+
- #define WITH_WATCHPOINTS 1
-
- #define SIM_CORE_SIGNAL(SD,CPU,CIA,MAP,NR_BYTES,ADDR,TRANSFER,ERROR) \
-diff --git a/sim/moxie/sim-main.h b/sim/moxie/sim-main.h
-index b1a64fc..c60437e 100644
---- a/sim/moxie/sim-main.h
-+++ b/sim/moxie/sim-main.h
-@@ -21,6 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
- #define SIM_MAIN_H
-
- #include "sim-basics.h"
-+
-+typedef struct _sim_cpu SIM_CPU;
-+
- #include "sim-base.h"
- #include "bfd.h"
-
-diff --git a/sim/msp430/sim-main.h b/sim/msp430/sim-main.h
-index 19c8cca..37bb42d 100644
---- a/sim/msp430/sim-main.h
-+++ b/sim/msp430/sim-main.h
-@@ -23,6 +23,9 @@
-
- #include "sim-basics.h"
- #include "sim-signal.h"
-+
-+typedef struct _sim_cpu SIM_CPU;
-+
- #include "msp430-sim.h"
- #include "sim-base.h"
-
-diff --git a/sim/sh/sim-main.h b/sim/sh/sim-main.h
-index e67df28..e2e17d7 100644
---- a/sim/sh/sim-main.h
-+++ b/sim/sh/sim-main.h
-@@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
- #define SIM_MAIN_H
-
- #include "sim-basics.h"
-+
-+typedef struct _sim_cpu SIM_CPU;
-+
- #include "sim-base.h"
-
- typedef struct
-diff --git a/sim/sh64/sim-main.h b/sim/sh64/sim-main.h
-index 7b24ab0..8fb595e 100644
---- a/sim/sh64/sim-main.h
-+++ b/sim/sh64/sim-main.h
-@@ -3,6 +3,11 @@
- #ifndef SIM_MAIN_H
- #define SIM_MAIN_H
-
-+#define USING_SIM_BASE_H /* FIXME: quick hack */
-+
-+struct _sim_cpu; /* FIXME: should be in sim-basics.h */
-+typedef struct _sim_cpu SIM_CPU;
-+
- /* sim-basics.h includes config.h but cgen-types.h must be included before
- sim-basics.h and cgen-types.h needs config.h. */
- #include "config.h"
-diff --git a/sim/v850/sim-main.h b/sim/v850/sim-main.h
-index 5127d28..16cbd97 100644
---- a/sim/v850/sim-main.h
-+++ b/sim/v850/sim-main.h
-@@ -16,6 +16,9 @@
- #include "sim-basics.h"
- #include "sim-signal.h"
- #include "sim-fpu.h"
-+
-+typedef struct _sim_cpu SIM_CPU;
-+
- #include "sim-base.h"
-
- #include "simops.h"
---
-2.7.4
-
--- /dev/null
+From ccc18e0b2dc77a6619df31fd4fadfb3a37401616 Mon Sep 17 00:00:00 2001
+From: "Arnout Vandecappelle (Essensium/Mind)" <arnout@mind.be>
+Date: Sun, 26 Mar 2017 23:06:45 +0200
+Subject: [PATCH] Sync proc_service definition with GLIBC
+
+GLIBC BZ#20311 [1] proc_service.h install patch also remove 'const'
+attributes from ps_get_thread_area and comment #15 discuss why to remove
+the const attribute (basically since it a callback with the struct
+ps_prochandle owned by the client it should be able to modify it if
+it the case).
+
+On default build this is not the issue and current g++ does not trigger
+any issue with this mismatch declaration. However, on some bootstrap
+build configuration where gdbserver is build with gcc instead this
+triggers:
+
+error: conflicting types for 'ps_get_thread_area'
+
+This patch fixes it by syncing the declaration with GLIBC.
+
+[1] https://sourceware.org/bugzilla/show_bug.cgi?id=20311
+
+gdb/ChangeLog:
+
+2016-08-25 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+
+ * aarch64-linux-nat.c (ps_get_thread_area): Remove const from
+ struct ps_prochandle.
+ * amd64-linux-nat.c (ps_get_thread_area): Likewise.
+ * arm-linux-nat.c (ps_get_thread_area): Likewise.
+ * gdb_proc_service.h (ps_get_thread_area): Likewise.
+ * i386-linux-nat.c (ps_get_thread_area): Likewise.
+ * m68klinux-nat.c (ps_get_thread_area): Likewise.
+ * mips-linux-nat.c (ps_get_thread_area): Likewise.
+ * nat/aarch64-linux.c (aarch64_ps_get_thread_area): Likewise.
+ * nat/aarch64-linux.h (aarch64_ps_get_thread_area): Likewise.
+ * xtensa-linux-nat.c (ps_get_thread_area): Likewise.
+
+gdb/gdbserver/ChangeLog:
+
+2016-08-25 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+
+ PR server/20491
+ * gdb_proc_service.h (ps_get_thread_area): Remove const from struct
+ ps_prochandle.
+ * linux-aarch64-low.c (ps_get_thread_area): Likewise.
+ * linux-arm-low.c (ps_get_thread_area): Likewise.
+ * linux-crisv32-low.c (ps_get_thread_area): Likewise.
+ * linux-m68k-low.c (ps_get_thread_area): Likewise.
+ * linux-mips-low.c (ps_get_thread_area): Likewise.
+ * linux-nios2-low.c (ps_get_thread_area): Likewise.
+ * linux-tic6x-low.c (ps_get_thread_area): Likewise.
+ * linux-x86-low.c (ps_get_thread_area): Likewise.
+ * linux-xtensa-low.c (ps_get_thread_area): Likewise.
+
+(cherry picked from commit 140bf80050b34f0947b34dba93b830ea2bfc5040)
+Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
+---
+ gdb/aarch64-linux-nat.c | 2 +-
+ gdb/amd64-linux-nat.c | 2 +-
+ gdb/arm-linux-nat.c | 2 +-
+ gdb/gdb_proc_service.h | 2 +-
+ gdb/gdbserver/gdb_proc_service.h | 2 +-
+ gdb/gdbserver/linux-aarch64-low.c | 2 +-
+ gdb/gdbserver/linux-arm-low.c | 2 +-
+ gdb/gdbserver/linux-crisv32-low.c | 2 +-
+ gdb/gdbserver/linux-m68k-low.c | 2 +-
+ gdb/gdbserver/linux-mips-low.c | 2 +-
+ gdb/gdbserver/linux-nios2-low.c | 2 +-
+ gdb/gdbserver/linux-tic6x-low.c | 2 +-
+ gdb/gdbserver/linux-x86-low.c | 2 +-
+ gdb/i386-linux-nat.c | 2 +-
+ gdb/m68klinux-nat.c | 2 +-
+ gdb/mips-linux-nat.c | 2 +-
+ 16 files changed, 16 insertions(+), 16 deletions(-)
+
+diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
+index 9959b81a2d..aa0f8d76bd 100644
+--- a/gdb/aarch64-linux-nat.c
++++ b/gdb/aarch64-linux-nat.c
+@@ -734,7 +734,7 @@ aarch64_linux_new_fork (struct lwp_info *parent, pid_t child_pid)
+ storage (or its descriptor). */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ struct iovec iovec;
+diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
+index 2e1b081b0f..7f076a9148 100644
+--- a/gdb/amd64-linux-nat.c
++++ b/gdb/amd64-linux-nat.c
+@@ -244,7 +244,7 @@ amd64_linux_store_inferior_registers (struct target_ops *ops,
+ a request for a thread's local storage address. */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ if (gdbarch_bfd_arch_info (target_gdbarch ())->bits_per_word == 32)
+diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
+index c167bce18b..8462655139 100644
+--- a/gdb/arm-linux-nat.c
++++ b/gdb/arm-linux-nat.c
+@@ -778,7 +778,7 @@ supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
+ /* Fetch the thread-local storage pointer for libthread_db. */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
+diff --git a/gdb/gdb_proc_service.h b/gdb/gdb_proc_service.h
+index e7369911a1..91fbc29a76 100644
+--- a/gdb/gdb_proc_service.h
++++ b/gdb/gdb_proc_service.h
+@@ -124,7 +124,7 @@ extern pid_t ps_getpid (struct ps_prochandle *);
+ /* Fetch the special per-thread address associated with the given LWP.
+ This call is only used on a few platforms (most use a normal register).
+ The meaning of the `int' parameter is machine-dependent. */
+-extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
++extern ps_err_e ps_get_thread_area (struct ps_prochandle *,
+ lwpid_t, int, psaddr_t *);
+
+
+diff --git a/gdb/gdbserver/gdb_proc_service.h b/gdb/gdbserver/gdb_proc_service.h
+index cbafbf3206..7f9b1e4de0 100644
+--- a/gdb/gdbserver/gdb_proc_service.h
++++ b/gdb/gdbserver/gdb_proc_service.h
+@@ -107,7 +107,7 @@ extern pid_t ps_getpid (struct ps_prochandle *);
+ /* Fetch the special per-thread address associated with the given LWP.
+ This call is only used on a few platforms (most use a normal register).
+ The meaning of the `int' parameter is machine-dependent. */
+-extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
++extern ps_err_e ps_get_thread_area (struct ps_prochandle *,
+ lwpid_t, int, psaddr_t *);
+
+
+diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
+index 8a30b00029..a0ac35620d 100644
+--- a/gdb/gdbserver/linux-aarch64-low.c
++++ b/gdb/gdbserver/linux-aarch64-low.c
+@@ -1089,7 +1089,7 @@ aarch64_stopped_by_watchpoint (void)
+ /* Fetch the thread-local storage pointer for libthread_db. */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ struct iovec iovec;
+diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
+index dd77b48ecd..560e7d8496 100644
+--- a/gdb/gdbserver/linux-arm-low.c
++++ b/gdb/gdbserver/linux-arm-low.c
+@@ -334,7 +334,7 @@ arm_reinsert_addr (void)
+ /* Fetch the thread-local storage pointer for libthread_db. */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
+diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdb/gdbserver/linux-crisv32-low.c
+index 65e6c09df2..fd5e627123 100644
+--- a/gdb/gdbserver/linux-crisv32-low.c
++++ b/gdb/gdbserver/linux-crisv32-low.c
+@@ -336,7 +336,7 @@ cris_stopped_data_address (void)
+ }
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
+diff --git a/gdb/gdbserver/linux-m68k-low.c b/gdb/gdbserver/linux-m68k-low.c
+index 4501904e39..7415930360 100644
+--- a/gdb/gdbserver/linux-m68k-low.c
++++ b/gdb/gdbserver/linux-m68k-low.c
+@@ -160,7 +160,7 @@ m68k_breakpoint_at (CORE_ADDR pc)
+ /* Fetch the thread-local storage pointer for libthread_db. */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
+diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c
+index 1695c4cf0d..acc2468bce 100644
+--- a/gdb/gdbserver/linux-mips-low.c
++++ b/gdb/gdbserver/linux-mips-low.c
+@@ -640,7 +640,7 @@ mips_stopped_data_address (void)
+ /* Fetch the thread-local storage pointer for libthread_db. */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
+diff --git a/gdb/gdbserver/linux-nios2-low.c b/gdb/gdbserver/linux-nios2-low.c
+index 7bd3c9795d..719883edef 100644
+--- a/gdb/gdbserver/linux-nios2-low.c
++++ b/gdb/gdbserver/linux-nios2-low.c
+@@ -150,7 +150,7 @@ nios2_breakpoint_at (CORE_ADDR where)
+ /* Fetch the thread-local storage pointer for libthread_db. */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
+diff --git a/gdb/gdbserver/linux-tic6x-low.c b/gdb/gdbserver/linux-tic6x-low.c
+index 0a0d220c34..26c4dee999 100644
+--- a/gdb/gdbserver/linux-tic6x-low.c
++++ b/gdb/gdbserver/linux-tic6x-low.c
+@@ -266,7 +266,7 @@ tic6x_breakpoint_at (CORE_ADDR where)
+ /* Fetch the thread-local storage pointer for libthread_db. */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
+diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
+index 484eadba05..15f25d71d5 100644
+--- a/gdb/gdbserver/linux-x86-low.c
++++ b/gdb/gdbserver/linux-x86-low.c
+@@ -231,7 +231,7 @@ is_64bit_tdesc (void)
+ /* Called by libthread_db. */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ #ifdef __x86_64__
+diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
+index 349ce68f5c..80d6a516ea 100644
+--- a/gdb/i386-linux-nat.c
++++ b/gdb/i386-linux-nat.c
+@@ -603,7 +603,7 @@ i386_linux_store_inferior_registers (struct target_ops *ops,
+ storage (or its descriptor). */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ unsigned int base_addr;
+diff --git a/gdb/m68klinux-nat.c b/gdb/m68klinux-nat.c
+index 8f89d7b87a..6e528b4e91 100644
+--- a/gdb/m68klinux-nat.c
++++ b/gdb/m68klinux-nat.c
+@@ -508,7 +508,7 @@ m68k_linux_store_inferior_registers (struct target_ops *ops,
+ /* Fetch the thread-local storage pointer for libthread_db. */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) < 0)
+diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
+index a36bb6356f..9f6d6975a0 100644
+--- a/gdb/mips-linux-nat.c
++++ b/gdb/mips-linux-nat.c
+@@ -152,7 +152,7 @@ mips64_linux_register_addr (struct gdbarch *gdbarch, int regno, int store)
+ /* Fetch the thread-local storage pointer for libthread_db. */
+
+ ps_err_e
+-ps_get_thread_area (const struct ps_prochandle *ph,
++ps_get_thread_area (struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+ {
+ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
+--
+2.11.0
+
+++ /dev/null
-From ccc18e0b2dc77a6619df31fd4fadfb3a37401616 Mon Sep 17 00:00:00 2001
-From: "Arnout Vandecappelle (Essensium/Mind)" <arnout@mind.be>
-Date: Sun, 26 Mar 2017 23:06:45 +0200
-Subject: [PATCH] Sync proc_service definition with GLIBC
-
-GLIBC BZ#20311 [1] proc_service.h install patch also remove 'const'
-attributes from ps_get_thread_area and comment #15 discuss why to remove
-the const attribute (basically since it a callback with the struct
-ps_prochandle owned by the client it should be able to modify it if
-it the case).
-
-On default build this is not the issue and current g++ does not trigger
-any issue with this mismatch declaration. However, on some bootstrap
-build configuration where gdbserver is build with gcc instead this
-triggers:
-
-error: conflicting types for 'ps_get_thread_area'
-
-This patch fixes it by syncing the declaration with GLIBC.
-
-[1] https://sourceware.org/bugzilla/show_bug.cgi?id=20311
-
-gdb/ChangeLog:
-
-2016-08-25 Adhemerval Zanella <adhemerval.zanella@linaro.org>
-
- * aarch64-linux-nat.c (ps_get_thread_area): Remove const from
- struct ps_prochandle.
- * amd64-linux-nat.c (ps_get_thread_area): Likewise.
- * arm-linux-nat.c (ps_get_thread_area): Likewise.
- * gdb_proc_service.h (ps_get_thread_area): Likewise.
- * i386-linux-nat.c (ps_get_thread_area): Likewise.
- * m68klinux-nat.c (ps_get_thread_area): Likewise.
- * mips-linux-nat.c (ps_get_thread_area): Likewise.
- * nat/aarch64-linux.c (aarch64_ps_get_thread_area): Likewise.
- * nat/aarch64-linux.h (aarch64_ps_get_thread_area): Likewise.
- * xtensa-linux-nat.c (ps_get_thread_area): Likewise.
-
-gdb/gdbserver/ChangeLog:
-
-2016-08-25 Adhemerval Zanella <adhemerval.zanella@linaro.org>
-
- PR server/20491
- * gdb_proc_service.h (ps_get_thread_area): Remove const from struct
- ps_prochandle.
- * linux-aarch64-low.c (ps_get_thread_area): Likewise.
- * linux-arm-low.c (ps_get_thread_area): Likewise.
- * linux-crisv32-low.c (ps_get_thread_area): Likewise.
- * linux-m68k-low.c (ps_get_thread_area): Likewise.
- * linux-mips-low.c (ps_get_thread_area): Likewise.
- * linux-nios2-low.c (ps_get_thread_area): Likewise.
- * linux-tic6x-low.c (ps_get_thread_area): Likewise.
- * linux-x86-low.c (ps_get_thread_area): Likewise.
- * linux-xtensa-low.c (ps_get_thread_area): Likewise.
-
-(cherry picked from commit 140bf80050b34f0947b34dba93b830ea2bfc5040)
-Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
----
- gdb/aarch64-linux-nat.c | 2 +-
- gdb/amd64-linux-nat.c | 2 +-
- gdb/arm-linux-nat.c | 2 +-
- gdb/gdb_proc_service.h | 2 +-
- gdb/gdbserver/gdb_proc_service.h | 2 +-
- gdb/gdbserver/linux-aarch64-low.c | 2 +-
- gdb/gdbserver/linux-arm-low.c | 2 +-
- gdb/gdbserver/linux-crisv32-low.c | 2 +-
- gdb/gdbserver/linux-m68k-low.c | 2 +-
- gdb/gdbserver/linux-mips-low.c | 2 +-
- gdb/gdbserver/linux-nios2-low.c | 2 +-
- gdb/gdbserver/linux-tic6x-low.c | 2 +-
- gdb/gdbserver/linux-x86-low.c | 2 +-
- gdb/i386-linux-nat.c | 2 +-
- gdb/m68klinux-nat.c | 2 +-
- gdb/mips-linux-nat.c | 2 +-
- 16 files changed, 16 insertions(+), 16 deletions(-)
-
-diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
-index 9959b81a2d..aa0f8d76bd 100644
---- a/gdb/aarch64-linux-nat.c
-+++ b/gdb/aarch64-linux-nat.c
-@@ -734,7 +734,7 @@ aarch64_linux_new_fork (struct lwp_info *parent, pid_t child_pid)
- storage (or its descriptor). */
-
- ps_err_e
--ps_get_thread_area (const struct ps_prochandle *ph,
-+ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
- {
- struct iovec iovec;
-diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
-index 2e1b081b0f..7f076a9148 100644
---- a/gdb/amd64-linux-nat.c
-+++ b/gdb/amd64-linux-nat.c
-@@ -244,7 +244,7 @@ amd64_linux_store_inferior_registers (struct target_ops *ops,
- a request for a thread's local storage address. */
-
- ps_err_e
--ps_get_thread_area (const struct ps_prochandle *ph,
-+ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
- {
- if (gdbarch_bfd_arch_info (target_gdbarch ())->bits_per_word == 32)
-diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
-index c167bce18b..8462655139 100644
---- a/gdb/arm-linux-nat.c
-+++ b/gdb/arm-linux-nat.c
-@@ -778,7 +778,7 @@ supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
- /* Fetch the thread-local storage pointer for libthread_db. */
-
- ps_err_e
--ps_get_thread_area (const struct ps_prochandle *ph,
-+ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
- {
- if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
-diff --git a/gdb/gdb_proc_service.h b/gdb/gdb_proc_service.h
-index e7369911a1..91fbc29a76 100644
---- a/gdb/gdb_proc_service.h
-+++ b/gdb/gdb_proc_service.h
-@@ -124,7 +124,7 @@ extern pid_t ps_getpid (struct ps_prochandle *);
- /* Fetch the special per-thread address associated with the given LWP.
- This call is only used on a few platforms (most use a normal register).
- The meaning of the `int' parameter is machine-dependent. */
--extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
-+extern ps_err_e ps_get_thread_area (struct ps_prochandle *,
- lwpid_t, int, psaddr_t *);
-
-
-diff --git a/gdb/gdbserver/gdb_proc_service.h b/gdb/gdbserver/gdb_proc_service.h
-index cbafbf3206..7f9b1e4de0 100644
---- a/gdb/gdbserver/gdb_proc_service.h
-+++ b/gdb/gdbserver/gdb_proc_service.h
-@@ -107,7 +107,7 @@ extern pid_t ps_getpid (struct ps_prochandle *);
- /* Fetch the special per-thread address associated with the given LWP.
- This call is only used on a few platforms (most use a normal register).
- The meaning of the `int' parameter is machine-dependent. */
--extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
-+extern ps_err_e ps_get_thread_area (struct ps_prochandle *,
- lwpid_t, int, psaddr_t *);
-
-
-diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
-index 8a30b00029..a0ac35620d 100644
---- a/gdb/gdbserver/linux-aarch64-low.c
-+++ b/gdb/gdbserver/linux-aarch64-low.c
-@@ -1089,7 +1089,7 @@ aarch64_stopped_by_watchpoint (void)
- /* Fetch the thread-local storage pointer for libthread_db. */
-
- ps_err_e
--ps_get_thread_area (const struct ps_prochandle *ph,
-+ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
- {
- struct iovec iovec;
-diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
-index dd77b48ecd..560e7d8496 100644
---- a/gdb/gdbserver/linux-arm-low.c
-+++ b/gdb/gdbserver/linux-arm-low.c
-@@ -334,7 +334,7 @@ arm_reinsert_addr (void)
- /* Fetch the thread-local storage pointer for libthread_db. */
-
- ps_err_e
--ps_get_thread_area (const struct ps_prochandle *ph,
-+ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
- {
- if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
-diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdb/gdbserver/linux-crisv32-low.c
-index 65e6c09df2..fd5e627123 100644
---- a/gdb/gdbserver/linux-crisv32-low.c
-+++ b/gdb/gdbserver/linux-crisv32-low.c
-@@ -336,7 +336,7 @@ cris_stopped_data_address (void)
- }
-
- ps_err_e
--ps_get_thread_area (const struct ps_prochandle *ph,
-+ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
- {
- if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
-diff --git a/gdb/gdbserver/linux-m68k-low.c b/gdb/gdbserver/linux-m68k-low.c
-index 4501904e39..7415930360 100644
---- a/gdb/gdbserver/linux-m68k-low.c
-+++ b/gdb/gdbserver/linux-m68k-low.c
-@@ -160,7 +160,7 @@ m68k_breakpoint_at (CORE_ADDR pc)
- /* Fetch the thread-local storage pointer for libthread_db. */
-
- ps_err_e
--ps_get_thread_area (const struct ps_prochandle *ph,
-+ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
- {
- if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
-diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c
-index 1695c4cf0d..acc2468bce 100644
---- a/gdb/gdbserver/linux-mips-low.c
-+++ b/gdb/gdbserver/linux-mips-low.c
-@@ -640,7 +640,7 @@ mips_stopped_data_address (void)
- /* Fetch the thread-local storage pointer for libthread_db. */
-
- ps_err_e
--ps_get_thread_area (const struct ps_prochandle *ph,
-+ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
- {
- if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
-diff --git a/gdb/gdbserver/linux-nios2-low.c b/gdb/gdbserver/linux-nios2-low.c
-index 7bd3c9795d..719883edef 100644
---- a/gdb/gdbserver/linux-nios2-low.c
-+++ b/gdb/gdbserver/linux-nios2-low.c
-@@ -150,7 +150,7 @@ nios2_breakpoint_at (CORE_ADDR where)
- /* Fetch the thread-local storage pointer for libthread_db. */
-
- ps_err_e
--ps_get_thread_area (const struct ps_prochandle *ph,
-+ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
- {
- if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
-diff --git a/gdb/gdbserver/linux-tic6x-low.c b/gdb/gdbserver/linux-tic6x-low.c
-index 0a0d220c34..26c4dee999 100644
---- a/gdb/gdbserver/linux-tic6x-low.c
-+++ b/gdb/gdbserver/linux-tic6x-low.c
-@@ -266,7 +266,7 @@ tic6x_breakpoint_at (CORE_ADDR where)
- /* Fetch the thread-local storage pointer for libthread_db. */
-
- ps_err_e
--ps_get_thread_area (const struct ps_prochandle *ph,
-+ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
- {
- if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
-diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
-index 484eadba05..15f25d71d5 100644
---- a/gdb/gdbserver/linux-x86-low.c
-+++ b/gdb/gdbserver/linux-x86-low.c
-@@ -231,7 +231,7 @@ is_64bit_tdesc (void)
- /* Called by libthread_db. */
-
- ps_err_e
--ps_get_thread_area (const struct ps_prochandle *ph,
-+ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
- {
- #ifdef __x86_64__
-diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
-index 349ce68f5c..80d6a516ea 100644
---- a/gdb/i386-linux-nat.c
-+++ b/gdb/i386-linux-nat.c
-@@ -603,7 +603,7 @@ i386_linux_store_inferior_registers (struct target_ops *ops,
- storage (or its descriptor). */
-
- ps_err_e
--ps_get_thread_area (const struct ps_prochandle *ph,
-+ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
- {
- unsigned int base_addr;
-diff --git a/gdb/m68klinux-nat.c b/gdb/m68klinux-nat.c
-index 8f89d7b87a..6e528b4e91 100644
---- a/gdb/m68klinux-nat.c
-+++ b/gdb/m68klinux-nat.c
-@@ -508,7 +508,7 @@ m68k_linux_store_inferior_registers (struct target_ops *ops,
- /* Fetch the thread-local storage pointer for libthread_db. */
-
- ps_err_e
--ps_get_thread_area (const struct ps_prochandle *ph,
-+ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
- {
- if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) < 0)
-diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
-index a36bb6356f..9f6d6975a0 100644
---- a/gdb/mips-linux-nat.c
-+++ b/gdb/mips-linux-nat.c
-@@ -152,7 +152,7 @@ mips64_linux_register_addr (struct gdbarch *gdbarch, int regno, int store)
- /* Fetch the thread-local storage pointer for libthread_db. */
-
- ps_err_e
--ps_get_thread_area (const struct ps_prochandle *ph,
-+ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
- {
- if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
---
-2.11.0
-
--- /dev/null
+From 3964e15443c5cdfca6723987c8ef1ef6cf984d41 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 6 Aug 2016 17:32:50 -0700
+Subject: [PATCH] ppc/ptrace: Define pt_regs uapi_pt_regs on !GLIBC systems
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ gdb/gdbserver/linux-ppc-low.c | 6 ++++++
+ gdb/nat/ppc-linux.h | 6 ++++++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
+index 188fac0..f71d5ab 100644
+--- a/gdb/gdbserver/linux-ppc-low.c
++++ b/gdb/gdbserver/linux-ppc-low.c
+@@ -21,7 +21,13 @@
+ #include "linux-low.h"
+
+ #include <elf.h>
++#if !defined(__GLIBC__)
++# define pt_regs uapi_pt_regs
++#endif
+ #include <asm/ptrace.h>
++#if !defined(__GLIBC__)
++# undef pt_regs
++#endif
+
+ #include "nat/ppc-linux.h"
+
+diff --git a/gdb/nat/ppc-linux.h b/gdb/nat/ppc-linux.h
+index 0ff2223..c978daa 100644
+--- a/gdb/nat/ppc-linux.h
++++ b/gdb/nat/ppc-linux.h
+@@ -18,7 +18,13 @@
+ #ifndef PPC_LINUX_H
+ #define PPC_LINUX_H 1
+
++#if !defined(__GLIBC__)
++# define pt_regs uapi_pt_regs
++#endif
+ #include <asm/ptrace.h>
++#if !defined(__GLIBC__)
++# undef pt_regs
++#endif
+ #include <asm/cputable.h>
+
+ /* This sometimes isn't defined. */
+--
+2.7.4
+
+++ /dev/null
-From 3964e15443c5cdfca6723987c8ef1ef6cf984d41 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 6 Aug 2016 17:32:50 -0700
-Subject: [PATCH] ppc/ptrace: Define pt_regs uapi_pt_regs on !GLIBC systems
-
-Upstream-Status: Pending
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- gdb/gdbserver/linux-ppc-low.c | 6 ++++++
- gdb/nat/ppc-linux.h | 6 ++++++
- 2 files changed, 12 insertions(+)
-
-diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
-index 188fac0..f71d5ab 100644
---- a/gdb/gdbserver/linux-ppc-low.c
-+++ b/gdb/gdbserver/linux-ppc-low.c
-@@ -21,7 +21,13 @@
- #include "linux-low.h"
-
- #include <elf.h>
-+#if !defined(__GLIBC__)
-+# define pt_regs uapi_pt_regs
-+#endif
- #include <asm/ptrace.h>
-+#if !defined(__GLIBC__)
-+# undef pt_regs
-+#endif
-
- #include "nat/ppc-linux.h"
-
-diff --git a/gdb/nat/ppc-linux.h b/gdb/nat/ppc-linux.h
-index 0ff2223..c978daa 100644
---- a/gdb/nat/ppc-linux.h
-+++ b/gdb/nat/ppc-linux.h
-@@ -18,7 +18,13 @@
- #ifndef PPC_LINUX_H
- #define PPC_LINUX_H 1
-
-+#if !defined(__GLIBC__)
-+# define pt_regs uapi_pt_regs
-+#endif
- #include <asm/ptrace.h>
-+#if !defined(__GLIBC__)
-+# undef pt_regs
-+#endif
- #include <asm/cputable.h>
-
- /* This sometimes isn't defined. */
---
-2.7.4
-
--- /dev/null
+From 1662a42e980c3f605000b23fda86ab24ceb69d32 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Sat, 3 Jun 2017 21:23:52 +0200
+Subject: [PATCH] sh/ptrace: Define pt_{dsp,}regs uapi_pt_{dsp,}regs on !GLIBC
+ systems
+
+Fixes a pt_{dsp,}regs redefinition when building with the musl C library
+on SuperH.
+
+Inspired by
+http://git.yoctoproject.org/clean/cgit.cgi/poky/plain/meta/recipes-devtools/gdb/gdb/0004-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch,
+adapted for SuperH.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ gdb/gdbserver/linux-sh-low.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/gdb/gdbserver/linux-sh-low.c b/gdb/gdbserver/linux-sh-low.c
+index 218d4d3..c4ada84 100644
+--- a/gdb/gdbserver/linux-sh-low.c
++++ b/gdb/gdbserver/linux-sh-low.c
+@@ -27,7 +27,15 @@ extern const struct target_desc *tdesc_sh;
+ #include <sys/reg.h>
+ #endif
+
++#if !defined(__GLIBC__)
++# define pt_regs uapi_pt_regs
++# define pt_dspregs uapi_pt_dspregs
++#endif
+ #include <asm/ptrace.h>
++#if !defined(__GLIBC__)
++# undef pt_regs
++# undef pt_dspregs
++#endif
+
+ #define sh_num_regs 41
+
+--
+2.7.4
+
--- /dev/null
+From 6de192acd4807d7fd57caf451567f09308bd8350 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Fri, 9 Jun 2017 10:19:32 +0200
+Subject: [PATCH] Fix gdbserver build on uClibc/noMMU
+
+The noMMU specific code requires including <sched.h>.
+
+Originally from
+https://cgit.openadk.org/cgi/cgit/openadk.git/plain/package/gdbserver/patches/nommu.patch.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ gdb/nat/linux-ptrace.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h
+index be6c395..c9f85aa 100644
+--- a/gdb/nat/linux-ptrace.h
++++ b/gdb/nat/linux-ptrace.h
+@@ -23,7 +23,8 @@ struct buffer;
+ #include <sys/ptrace.h>
+
+ #ifdef __UCLIBC__
+-#if !(defined(__UCLIBC_HAS_MMU__) || defined(__ARCH_HAS_MMU__))
++#include <sched.h>
++#if !(defined(__UCLIBC_HAS_MMU__) || defined(__ARCH_USE_MMU__))
+ /* PTRACE_TEXT_ADDR and friends. */
+ #include <asm/ptrace.h>
+ #define HAS_NOMMU
+--
+2.7.4
+
+++ /dev/null
-From 1662a42e980c3f605000b23fda86ab24ceb69d32 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Sat, 3 Jun 2017 21:23:52 +0200
-Subject: [PATCH] sh/ptrace: Define pt_{dsp,}regs uapi_pt_{dsp,}regs on !GLIBC
- systems
-
-Fixes a pt_{dsp,}regs redefinition when building with the musl C library
-on SuperH.
-
-Inspired by
-http://git.yoctoproject.org/clean/cgit.cgi/poky/plain/meta/recipes-devtools/gdb/gdb/0004-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch,
-adapted for SuperH.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- gdb/gdbserver/linux-sh-low.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/gdb/gdbserver/linux-sh-low.c b/gdb/gdbserver/linux-sh-low.c
-index 218d4d3..c4ada84 100644
---- a/gdb/gdbserver/linux-sh-low.c
-+++ b/gdb/gdbserver/linux-sh-low.c
-@@ -27,7 +27,15 @@ extern const struct target_desc *tdesc_sh;
- #include <sys/reg.h>
- #endif
-
-+#if !defined(__GLIBC__)
-+# define pt_regs uapi_pt_regs
-+# define pt_dspregs uapi_pt_dspregs
-+#endif
- #include <asm/ptrace.h>
-+#if !defined(__GLIBC__)
-+# undef pt_regs
-+# undef pt_dspregs
-+#endif
-
- #define sh_num_regs 41
-
---
-2.7.4
-
+++ /dev/null
-From 6de192acd4807d7fd57caf451567f09308bd8350 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Fri, 9 Jun 2017 10:19:32 +0200
-Subject: [PATCH] Fix gdbserver build on uClibc/noMMU
-
-The noMMU specific code requires including <sched.h>.
-
-Originally from
-https://cgit.openadk.org/cgi/cgit/openadk.git/plain/package/gdbserver/patches/nommu.patch.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- gdb/nat/linux-ptrace.h | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h
-index be6c395..c9f85aa 100644
---- a/gdb/nat/linux-ptrace.h
-+++ b/gdb/nat/linux-ptrace.h
-@@ -23,7 +23,8 @@ struct buffer;
- #include <sys/ptrace.h>
-
- #ifdef __UCLIBC__
--#if !(defined(__UCLIBC_HAS_MMU__) || defined(__ARCH_HAS_MMU__))
-+#include <sched.h>
-+#if !(defined(__UCLIBC_HAS_MMU__) || defined(__ARCH_USE_MMU__))
- /* PTRACE_TEXT_ADDR and friends. */
- #include <asm/ptrace.h>
- #define HAS_NOMMU
---
-2.7.4
-
--- /dev/null
+From 12a0b8d81e1fda6ba98abdce8d6f09f9555ebcf5 Mon Sep 17 00:00:00 2001
+From: Andre McCurdy <amccurdy@gmail.com>
+Date: Sat, 30 Apr 2016 15:29:06 -0700
+Subject: [PATCH] use <asm/sgidefs.h>
+
+Build fix for MIPS with musl libc
+
+The MIPS specific header <sgidefs.h> is provided by glibc and uclibc
+but not by musl. Regardless of the libc, the kernel headers provide
+<asm/sgidefs.h> which provides the same definitions, so use that
+instead.
+
+Upstream-Status: Pending
+
+[Vincent:
+Taken from https://sourceware.org/bugzilla/show_bug.cgi?id=21070
+Patch has been adapted to apply on 7.10.1.]
+
+Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
+---
+ gdb/mips-linux-nat.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
+index 9f6d697..8f57bb2 100644
+--- a/gdb/mips-linux-nat.c
++++ b/gdb/mips-linux-nat.c
+@@ -31,7 +31,7 @@
+ #include "gdb_proc_service.h"
+ #include "gregset.h"
+
+-#include <sgidefs.h>
++#include <asm/sgidefs.h>
+ #include <sys/ptrace.h>
+ #include <asm/ptrace.h>
+
+--
+2.13.1
+
+++ /dev/null
-From 12a0b8d81e1fda6ba98abdce8d6f09f9555ebcf5 Mon Sep 17 00:00:00 2001
-From: Andre McCurdy <amccurdy@gmail.com>
-Date: Sat, 30 Apr 2016 15:29:06 -0700
-Subject: [PATCH] use <asm/sgidefs.h>
-
-Build fix for MIPS with musl libc
-
-The MIPS specific header <sgidefs.h> is provided by glibc and uclibc
-but not by musl. Regardless of the libc, the kernel headers provide
-<asm/sgidefs.h> which provides the same definitions, so use that
-instead.
-
-Upstream-Status: Pending
-
-[Vincent:
-Taken from https://sourceware.org/bugzilla/show_bug.cgi?id=21070
-Patch has been adapted to apply on 7.10.1.]
-
-Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
----
- gdb/mips-linux-nat.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
-index 9f6d697..8f57bb2 100644
---- a/gdb/mips-linux-nat.c
-+++ b/gdb/mips-linux-nat.c
-@@ -31,7 +31,7 @@
- #include "gdb_proc_service.h"
- #include "gregset.h"
-
--#include <sgidefs.h>
-+#include <asm/sgidefs.h>
- #include <sys/ptrace.h>
- #include <asm/ptrace.h>
-
---
-2.13.1
-