diff mbox

[03/31] gdbserver/linux-low: start turning linux target ops into methods

Message ID 5f7fe91db27d52c30c5dbd468fa66c1aa4bd9202.1583529166.git.tankut.baris.aktemur@intel.com
State New
Headers show

Commit Message

Tankut Baris Aktemur March 6, 2020, 9:31 p.m. UTC
This is the beginning of a series of patches that convert the linux
low targets into classes derived from linux_process_target.  At the
end of the series we obtain a class hierarchy that looks like this:

process_stratum_target
^
|
|-- linux_process_target
    ^
    |
    |-- x86_target (defined in linux-x86-low)
    |-- aarch64_target (defined in linux-aarch64-low)
    |-- ppc_target (defined in linux-ppc-low)
    |-- ...

In several cases, linux_process_target simply forwards a target op
request to a corresponding linux_target_ops function.  For these
cases, the definition in linux_process_target will be removed and the
definition will be left to the deriving linux low target class; using
inheritance provides a nice and natural, object-oriented
simplification in these cases.

The series converts linux_target_ops into protected methods of
linux_process_target one by one.  Throughout the series, based on the
needs, static functions defined in linux-low.cc are converted to
private methods of linux_process_target as well.  This is done either
as separate patches or as integrated into a patch that convert a
particular linux_target_op into a method.

The series ends with the patch titled "gdbserver/linux-low: delete
'linux_target_ops' and 'the_low_target'".

Built and regression-tested on x86_64-linux.  The following linux low
targets have been built (but not tested) via cross-compilation:
aarch64, arm, m68k, mips, ppc, riscv, s390, sh, sparc.  The other
targets (bfin, cris, crisv32, ia64, m32r, nios2, tic6x, tile, xtensa)
were neither built nor tested.

gdbserver/ChangeLog:
2020-03-06  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* linux-low.h (the_linux_target): New extern declaration.
	* linux-low.cc (initialize_low): Use 'the_linux_target' to set
	'the_target'.
	(the_linux_target): Remove.
	* linux-x86-low.cc (class x86_target): New class.
	(the_x86_target): New static object.
	(the_linux_target): Define as pointer to the_x86_target.
	* linux-aarch64-low.cc (class aarch64_target): New class.
	(the_aarch64_target): New static object.
	(the_linux_target): Define as pointer to the_aarch64_target.
	* linux-arm-low.cc (class arm_target): New class.
	(the_arm_target): New static object.
	(the_linux_target): Define as pointer to the_arm_target.
	* linux-bfin-low.cc (class bfin_target): New class.
	(the_bfin_target): New static object.
	(the_linux_target): Define as pointer to the_bfin_target.
	* linux-cris-low.cc (class cris_target): New class.
	(the_cris_target): New static object.
	(the_linux_target): Define as pointer to the_cris_target.
	* linux-crisv32-low.cc (class crisv32_target): New class.
	(the_crisv32_target): New static object.
	(the_linux_target): Define as pointer to the_crisv32_target.
	* linux-ia64-low.cc (class ia64_target): New class.
	(the_ia64_target): New static object.
	(the_linux_target): Define as pointer to the_ia64_target.
	* linux-m32r-low.cc (class m32r_target): New class.
	(the_m32r_target): New static object.
	(the_linux_target): Define as pointer to the_m32r_target.
	* linux-m68k-low.cc (class m68k_target): New class.
	(the_m68k_target): New static object.
	(the_linux_target): Define as pointer to the_m68k_target.
	* linux-mips-low.cc (class mips_target): New class.
	(the_mips_target): New static object.
	(the_linux_target): Define as pointer to the_mips_target.
	* linux-nios2-low.cc (class nios2_target): New class.
	(the_nios2_target): New static object.
	(the_linux_target): Define as pointer to the_nios2_target.
	* linux-ppc-low.cc (class ppc_target): New class.
	(the_ppc_target): New static object.
	(the_linux_target): Define as pointer to the_ppc_target.
	* linux-riscv-low.cc (class riscv_target): New class.
	(the_riscv_target): New static object.
	(the_linux_target): Define as pointer to the_riscv_target.
	* linux-s390-low.cc (class s390_target): New class.
	(the_s390_target): New static object.
	(the_linux_target): Define as pointer to the_s390_target.
	* linux-sh-low.cc (class sh_target): New class.
	(the_sh_target): New static object.
	(the_linux_target): Define as pointer to the_sh_target.
	* linux-sparc-low.cc (class sparc_target): New class.
	(the_sparc_target): New static object.
	(the_linux_target): Define as pointer to the_sparc_target.
	* linux-tic6x-low.cc (class tic6x_target): New class.
	(the_tic6x_target): New static object.
	(the_linux_target): Define as pointer to the_tic6x_target.
	* linux-tile-low.cc (class tile_target): New class.
	(the_tile_target): New static object.
	(the_linux_target): Define as pointer to the_tile_target.
	* linux-xtensa-low.cc (class xtensa_target): New class.
	(the_xtensa_target): New static object.
	(the_linux_target): Define as pointer to the_xtensa_target.
---
 gdbserver/linux-aarch64-low.cc | 16 ++++++++++++++++
 gdbserver/linux-arm-low.cc     | 16 ++++++++++++++++
 gdbserver/linux-bfin-low.cc    | 15 +++++++++++++++
 gdbserver/linux-cris-low.cc    | 16 ++++++++++++++++
 gdbserver/linux-crisv32-low.cc | 16 ++++++++++++++++
 gdbserver/linux-ia64-low.cc    | 16 ++++++++++++++++
 gdbserver/linux-low.cc         |  6 +-----
 gdbserver/linux-low.h          |  5 +++++
 gdbserver/linux-m32r-low.cc    | 16 ++++++++++++++++
 gdbserver/linux-m68k-low.cc    | 16 ++++++++++++++++
 gdbserver/linux-mips-low.cc    | 16 ++++++++++++++++
 gdbserver/linux-nios2-low.cc   | 16 ++++++++++++++++
 gdbserver/linux-ppc-low.cc     | 16 ++++++++++++++++
 gdbserver/linux-riscv-low.cc   | 16 ++++++++++++++++
 gdbserver/linux-s390-low.cc    | 16 ++++++++++++++++
 gdbserver/linux-sh-low.cc      | 16 ++++++++++++++++
 gdbserver/linux-sparc-low.cc   | 16 ++++++++++++++++
 gdbserver/linux-tic6x-low.cc   | 16 ++++++++++++++++
 gdbserver/linux-tile-low.cc    | 16 ++++++++++++++++
 gdbserver/linux-x86-low.cc     | 18 ++++++++++++++++++
 gdbserver/linux-xtensa-low.cc  | 15 +++++++++++++++
 21 files changed, 310 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc
index 6ce5452945e..102b61ef9cb 100644
--- a/gdbserver/linux-aarch64-low.cc
+++ b/gdbserver/linux-aarch64-low.cc
@@ -49,6 +49,18 @@ 
 #include <sys/reg.h>
 #endif
 
+/* Linux target op definitions for the AArch64 architecture.  */
+
+class aarch64_target : public linux_process_target
+{
+public:
+
+};
+
+/* The singleton target ops object.  */
+
+static aarch64_target the_aarch64_target;
+
 /* Per-process arch-specific data we want to keep.  */
 
 struct arch_process_info
@@ -3088,6 +3100,10 @@  struct linux_target_ops the_low_target =
   aarch64_get_syscall_trapinfo,
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_aarch64_target;
+
 void
 initialize_low_arch (void)
 {
diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc
index f60543eae94..7ecedb8f6ef 100644
--- a/gdbserver/linux-arm-low.cc
+++ b/gdbserver/linux-arm-low.cc
@@ -54,6 +54,18 @@ 
 #define PTRACE_SETHBPREGS 30
 #endif
 
+/* Linux target op definitions for the ARM architecture.  */
+
+class arm_target : public linux_process_target
+{
+public:
+
+};
+
+/* The singleton target ops object.  */
+
+static arm_target the_arm_target;
+
 /* Information describing the hardware breakpoint capabilities.  */
 static struct
 {
@@ -1044,6 +1056,10 @@  struct linux_target_ops the_low_target = {
   arm_get_syscall_trapinfo,
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_arm_target;
+
 void
 initialize_low_arch (void)
 {
diff --git a/gdbserver/linux-bfin-low.cc b/gdbserver/linux-bfin-low.cc
index 5bfc8868bd9..c8c238abca7 100644
--- a/gdbserver/linux-bfin-low.cc
+++ b/gdbserver/linux-bfin-low.cc
@@ -23,6 +23,18 @@ 
 #include "linux-low.h"
 #include <asm/ptrace.h>
 
+/* Linux target op definitions for the BFIN architecture.  */
+
+class bfin_target : public linux_process_target
+{
+public:
+
+};
+
+/* The singleton target ops object.  */
+
+static bfin_target the_bfin_target;
+
 /* Defined in auto-generated file reg-bfin.c.  */
 void init_registers_bfin (void);
 extern const struct target_desc *tdesc_bfin;
@@ -151,6 +163,9 @@  struct linux_target_ops the_low_target = {
   bfin_supports_hardware_single_step,
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_bfin_target;
 
 void
 initialize_low_arch (void)
diff --git a/gdbserver/linux-cris-low.cc b/gdbserver/linux-cris-low.cc
index 81d84a1b5c8..d2735b4f459 100644
--- a/gdbserver/linux-cris-low.cc
+++ b/gdbserver/linux-cris-low.cc
@@ -20,6 +20,18 @@ 
 #include "linux-low.h"
 #include "nat/gdb_ptrace.h"
 
+/* Linux target op definitions for the CRIS architecture.  */
+
+class cris_target : public linux_process_target
+{
+public:
+
+};
+
+/* The singleton target ops object.  */
+
+static cris_target the_cris_target;
+
 /* Defined in auto-generated file reg-cris.c.  */
 void init_registers_cris (void);
 extern const struct target_desc *tdesc_cris;
@@ -125,6 +137,10 @@  struct linux_target_ops the_low_target = {
   cris_breakpoint_at,
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_cris_target;
+
 void
 initialize_low_arch (void)
 {
diff --git a/gdbserver/linux-crisv32-low.cc b/gdbserver/linux-crisv32-low.cc
index 06135efcfa2..346e2a4219e 100644
--- a/gdbserver/linux-crisv32-low.cc
+++ b/gdbserver/linux-crisv32-low.cc
@@ -20,6 +20,18 @@ 
 #include "linux-low.h"
 #include "nat/gdb_ptrace.h"
 
+/* Linux target op definitions for the CRIS architecture.  */
+
+class crisv32_target : public linux_process_target
+{
+public:
+
+};
+
+/* The singleton target ops object.  */
+
+static crisv32_target the_crisv32_target;
+
 /* Defined in auto-generated file reg-crisv32.c.  */
 void init_registers_crisv32 (void);
 extern const struct target_desc *tdesc_crisv32;
@@ -431,6 +443,10 @@  struct linux_target_ops the_low_target = {
   cris_supports_hardware_single_step,
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_crisv32_target;
+
 void
 initialize_low_arch (void)
 {
diff --git a/gdbserver/linux-ia64-low.cc b/gdbserver/linux-ia64-low.cc
index 2399e58b366..169a567d67b 100644
--- a/gdbserver/linux-ia64-low.cc
+++ b/gdbserver/linux-ia64-low.cc
@@ -23,6 +23,18 @@ 
 #include <sys/reg.h>
 #endif
 
+/* Linux target op definitions for the IA64 architecture.  */
+
+class ia64_target : public linux_process_target
+{
+public:
+
+};
+
+/* The singleton target ops object.  */
+
+static ia64_target the_ia64_target;
+
 /* Defined in auto-generated file reg-ia64.c.  */
 void init_registers_ia64 (void);
 extern const struct target_desc *tdesc_ia64;
@@ -353,6 +365,10 @@  struct linux_target_ops the_low_target = {
   ia64_fetch_register,
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_ia64_target;
+
 void
 initialize_low_arch (void)
 {
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index e748bfc9c6d..d399ea5c3d8 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -7444,10 +7444,6 @@  linux_get_hwcap2 (int wordsize)
   return hwcap2;
 }
 
-/* The linux target ops object.  */
-
-static linux_process_target the_linux_target;
-
 #ifdef HAVE_LINUX_REGSETS
 void
 initialize_regsets_info (struct regsets_info *info)
@@ -7465,7 +7461,7 @@  initialize_low (void)
   struct sigaction sigchld_action;
 
   memset (&sigchld_action, 0, sizeof (sigchld_action));
-  set_target_ops (&the_linux_target);
+  set_target_ops (the_linux_target);
 
   linux_ptrace_init_warnings ();
   linux_proc_init_warnings ();
diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h
index bc7abce2ac6..0af3c3cc387 100644
--- a/gdbserver/linux-low.h
+++ b/gdbserver/linux-low.h
@@ -563,8 +563,13 @@  class linux_process_target : public process_stratum_target
 
   /* Move THREAD out of the jump pad.  */
   void move_out_of_jump_pad (thread_info *thread);
+
+protected:
+  /* The architecture-specific "low" methods are listed below.  */
 };
 
+extern linux_process_target *the_linux_target;
+
 #define get_thread_lwp(thr) ((struct lwp_info *) (thread_target_data (thr)))
 #define get_lwp_thread(lwp) ((lwp)->thread)
 
diff --git a/gdbserver/linux-m32r-low.cc b/gdbserver/linux-m32r-low.cc
index 74e0f3f74c6..3921d450e0b 100644
--- a/gdbserver/linux-m32r-low.cc
+++ b/gdbserver/linux-m32r-low.cc
@@ -23,6 +23,18 @@ 
 #include <sys/reg.h>
 #endif
 
+/* Linux target op definitions for the m32r architecture.  */
+
+class m32r_target : public linux_process_target
+{
+public:
+
+};
+
+/* The singleton target ops object.  */
+
+static m32r_target the_m32r_target;
+
 /* Defined in auto-generated file reg-m32r.c.  */
 void init_registers_m32r (void);
 extern const struct target_desc *tdesc_m32r;
@@ -150,6 +162,10 @@  struct linux_target_ops the_low_target = {
   m32r_supports_hardware_single_step,
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_m32r_target;
+
 void
 initialize_low_arch (void)
 {
diff --git a/gdbserver/linux-m68k-low.cc b/gdbserver/linux-m68k-low.cc
index 246b295a875..21bd5334a2b 100644
--- a/gdbserver/linux-m68k-low.cc
+++ b/gdbserver/linux-m68k-low.cc
@@ -19,6 +19,18 @@ 
 #include "server.h"
 #include "linux-low.h"
 
+/* Linux target op definitions for the m68k architecture.  */
+
+class m68k_target : public linux_process_target
+{
+public:
+
+};
+
+/* The singleton target ops object.  */
+
+static m68k_target the_m68k_target;
+
 /* Defined in auto-generated file reg-m68k.c.  */
 void init_registers_m68k (void);
 extern const struct target_desc *tdesc_m68k;
@@ -245,6 +257,10 @@  struct linux_target_ops the_low_target = {
   m68k_supports_hardware_single_step,
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_m68k_target;
+
 void
 initialize_low_arch (void)
 {
diff --git a/gdbserver/linux-mips-low.cc b/gdbserver/linux-mips-low.cc
index 3caab02e503..debe115ea77 100644
--- a/gdbserver/linux-mips-low.cc
+++ b/gdbserver/linux-mips-low.cc
@@ -25,6 +25,18 @@ 
 #include "nat/mips-linux-watch.h"
 #include "gdb_proc_service.h"
 
+/* Linux target op definitions for the MIPS architecture.  */
+
+class mips_target : public linux_process_target
+{
+public:
+
+};
+
+/* The singleton target ops object.  */
+
+static mips_target the_mips_target;
+
 /* Defined in auto-generated file mips-linux.c.  */
 void init_registers_mips_linux (void);
 extern const struct target_desc *tdesc_mips_linux;
@@ -965,6 +977,10 @@  struct linux_target_ops the_low_target = {
   mips_linux_prepare_to_resume
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_mips_target;
+
 void
 initialize_low_arch (void)
 {
diff --git a/gdbserver/linux-nios2-low.cc b/gdbserver/linux-nios2-low.cc
index a8bb87a390e..09f8778f293 100644
--- a/gdbserver/linux-nios2-low.cc
+++ b/gdbserver/linux-nios2-low.cc
@@ -31,6 +31,18 @@ 
 #define PTRACE_GET_THREAD_AREA 25
 #endif
 
+/* Linux target op definitions for the NIOS II architecture.  */
+
+class nios2_target : public linux_process_target
+{
+public:
+
+};
+
+/* The singleton target ops object.  */
+
+static nios2_target the_nios2_target;
+
 /* The following definition must agree with the number of registers
    defined in "struct user_regs" in GLIBC
    (sysdeps/unix/sysv/linux/nios2/sys/user.h), and also with
@@ -250,6 +262,10 @@  struct linux_target_ops the_low_target =
   nios2_breakpoint_at,
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_nios2_target;
+
 void
 initialize_low_arch (void)
 {
diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc
index f3837e47960..a0f1ba09936 100644
--- a/gdbserver/linux-ppc-low.cc
+++ b/gdbserver/linux-ppc-low.cc
@@ -44,6 +44,18 @@ 
 #define PPC_LI(insn)	(PPC_SEXT (PPC_FIELD (insn, 6, 24), 24) << 2)
 #define PPC_BD(insn)	(PPC_SEXT (PPC_FIELD (insn, 16, 14), 14) << 2)
 
+/* Linux target op definitions for the PowerPC architecture.  */
+
+class ppc_target : public linux_process_target
+{
+public:
+
+};
+
+/* The singleton target ops object.  */
+
+static ppc_target the_ppc_target;
+
 /* Holds the AT_HWCAP auxv entry.  */
 
 static unsigned long ppc_hwcap;
@@ -3410,6 +3422,10 @@  struct linux_target_ops the_low_target = {
   ppc_get_ipa_tdesc_idx,
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_ppc_target;
+
 void
 initialize_low_arch (void)
 {
diff --git a/gdbserver/linux-riscv-low.cc b/gdbserver/linux-riscv-low.cc
index 07ae6174ee3..04f3a99f46f 100644
--- a/gdbserver/linux-riscv-low.cc
+++ b/gdbserver/linux-riscv-low.cc
@@ -30,6 +30,18 @@ 
 # define NFPREG 33
 #endif
 
+/* Linux target op definitions for the RISC-V architecture.  */
+
+class riscv_target : public linux_process_target
+{
+public:
+
+};
+
+/* The singleton target ops object.  */
+
+static riscv_target the_riscv_target;
+
 /* Implementation of linux_target_ops method "arch_setup".  */
 
 static void
@@ -270,6 +282,10 @@  struct linux_target_ops the_low_target =
   riscv_breakpoint_at,
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_riscv_target;
+
 /* Initialize the RISC-V/Linux target.  */
 
 void
diff --git a/gdbserver/linux-s390-low.cc b/gdbserver/linux-s390-low.cc
index f3d6f093099..17aa9d0231e 100644
--- a/gdbserver/linux-s390-low.cc
+++ b/gdbserver/linux-s390-low.cc
@@ -51,6 +51,18 @@ 
 
 #define s390_num_regs 52
 
+/* Linux target op definitions for the S/390 architecture.  */
+
+class s390_target : public linux_process_target
+{
+public:
+
+};
+
+/* The singleton target ops object.  */
+
+static s390_target the_s390_target;
+
 static int s390_regmap[] = {
   PT_PSWMASK, PT_PSWADDR,
 
@@ -2830,6 +2842,10 @@  struct linux_target_ops the_low_target = {
   s390_get_ipa_tdesc_idx,
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_s390_target;
+
 void
 initialize_low_arch (void)
 {
diff --git a/gdbserver/linux-sh-low.cc b/gdbserver/linux-sh-low.cc
index f55402c3d41..ab82ee37b2c 100644
--- a/gdbserver/linux-sh-low.cc
+++ b/gdbserver/linux-sh-low.cc
@@ -19,6 +19,18 @@ 
 #include "server.h"
 #include "linux-low.h"
 
+/* Linux target op definitions for the SH architecture.  */
+
+class sh_target : public linux_process_target
+{
+public:
+
+};
+
+/* The singleton target ops object.  */
+
+static sh_target the_sh_target;
+
 /* Defined in auto-generated file reg-sh.c.  */
 void init_registers_sh (void);
 extern const struct target_desc *tdesc_sh;
@@ -180,6 +192,10 @@  struct linux_target_ops the_low_target = {
   sh_supports_hardware_single_step,
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_sh_target;
+
 void
 initialize_low_arch (void)
 {
diff --git a/gdbserver/linux-sparc-low.cc b/gdbserver/linux-sparc-low.cc
index e6cb43209af..cc4f551123b 100644
--- a/gdbserver/linux-sparc-low.cc
+++ b/gdbserver/linux-sparc-low.cc
@@ -42,6 +42,18 @@ 
 #define sparc_num_regs \
   (SPARC_R_REGS_NUM + SPARC_F_REGS_NUM + SPARC_CONTROL_REGS_NUM)
 
+/* Linux target op definitions for the SPARC architecture.  */
+
+class sparc_target : public linux_process_target
+{
+public:
+
+};
+
+/* The singleton target ops object.  */
+
+static sparc_target the_sparc_target;
+
 /* Each offset is multiplied by 8, because of the register size.
    These offsets apply to the buffer sent/filled by ptrace.
    Additionally, the array elements order corresponds to the .dat file, and the
@@ -316,6 +328,10 @@  struct linux_target_ops the_low_target = {
   NULL, NULL
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_sparc_target;
+
 void
 initialize_low_arch (void)
 {
diff --git a/gdbserver/linux-tic6x-low.cc b/gdbserver/linux-tic6x-low.cc
index ca7c983a8ac..4c621c04982 100644
--- a/gdbserver/linux-tic6x-low.cc
+++ b/gdbserver/linux-tic6x-low.cc
@@ -38,6 +38,18 @@ 
 
 #include <asm/ptrace.h>
 
+/* Linux target op definitions for the TI C6x architecture.  */
+
+class tic6x_target : public linux_process_target
+{
+public:
+
+};
+
+/* The singleton target ops object.  */
+
+static tic6x_target the_tic6x_target;
+
 /* Defined in auto-generated file tic6x-c64xp-linux.c.  */
 void init_registers_tic6x_c64xp_linux (void);
 extern const struct target_desc *tdesc_tic6x_c64xp_linux;
@@ -439,6 +451,10 @@  tic6x_tdesc_test ()
 }
 #endif
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_tic6x_target;
+
 void
 initialize_low_arch (void)
 {
diff --git a/gdbserver/linux-tile-low.cc b/gdbserver/linux-tile-low.cc
index 1fe77a3fa57..807a8976fd7 100644
--- a/gdbserver/linux-tile-low.cc
+++ b/gdbserver/linux-tile-low.cc
@@ -23,6 +23,18 @@ 
 #include <arch/abi.h>
 #include "nat/gdb_ptrace.h"
 
+/* Linux target op definitions for the TILE-Gx architecture.  */
+
+class tile_target : public linux_process_target
+{
+public:
+
+};
+
+/* The singleton target ops object.  */
+
+static tile_target the_tile_target;
+
 /* Defined in auto-generated file reg-tilegx.c.  */
 void init_registers_tilegx (void);
 extern const struct target_desc *tdesc_tilegx;
@@ -212,6 +224,10 @@  struct linux_target_ops the_low_target =
   tile_supports_hardware_single_step,
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_tile_target;
+
 void
 initialize_low_arch (void)
 {
diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc
index 96818b85a86..dbfcd255325 100644
--- a/gdbserver/linux-x86-low.cc
+++ b/gdbserver/linux-x86-low.cc
@@ -92,6 +92,20 @@  static const char *xmltarget_amd64_linux_no_xml = "@<target>\
 #define ARCH_GET_GS 0x1004
 #endif
 
+/* Linux target op definitions for the x86 architecture.
+   This is initialized assuming an amd64 target.
+   'low_arch_setup' will correct it for i386 or amd64 targets.  */
+
+class x86_target : public linux_process_target
+{
+public:
+
+};
+
+/* The singleton target ops object.  */
+
+static x86_target the_x86_target;
+
 /* Per-process arch-specific data we want to keep.  */
 
 struct arch_process_info
@@ -2901,6 +2915,10 @@  struct linux_target_ops the_low_target =
   x86_get_ipa_tdesc_idx,
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_x86_target;
+
 void
 initialize_low_arch (void)
 {
diff --git a/gdbserver/linux-xtensa-low.cc b/gdbserver/linux-xtensa-low.cc
index 510c9bd8879..32146822d4f 100644
--- a/gdbserver/linux-xtensa-low.cc
+++ b/gdbserver/linux-xtensa-low.cc
@@ -20,6 +20,18 @@ 
 #include "server.h"
 #include "linux-low.h"
 
+/* Linux target op definitions for the Xtensa architecture.  */
+
+class xtensa_target : public linux_process_target
+{
+public:
+
+};
+
+/* The singleton target ops object.  */
+
+static xtensa_target the_xtensa_target;
+
 /* Defined in auto-generated file reg-xtensa.c.  */
 void init_registers_xtensa (void);
 extern const struct target_desc *tdesc_xtensa;
@@ -304,6 +316,9 @@  struct linux_target_ops the_low_target = {
   xtensa_supports_hardware_single_step,
 };
 
+/* The linux target ops object.  */
+
+linux_process_target *the_linux_target = &the_xtensa_target;
 
 void
 initialize_low_arch (void)