diff --git a/gdbserver/hostio.cc b/gdbserver/hostio.cc
index 8af4fbf4087..a3b32cd0fdc 100644
--- a/gdbserver/hostio.cc
+++ b/gdbserver/hostio.cc
@@ -196,7 +196,7 @@ require_valid_fd (int fd)
 static void
 hostio_error (char *own_buf)
 {
-  the_target->hostio_last_error (own_buf);
+  the_target->pt->hostio_last_error (own_buf);
 }
 
 static void
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index 42bfcde6203..789496719dc 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -45,7 +45,6 @@
 #include <sys/uio.h>
 #include "gdbsupport/filestuff.h"
 #include "tracepoint.h"
-#include "hostio.h"
 #include <inttypes.h>
 #include "gdbsupport/common-inferior.h"
 #include "nat/fork-inferior.h"
@@ -7411,7 +7410,6 @@ linux_get_hwcap2 (int wordsize)
 static linux_process_target the_linux_target;
 
 static process_stratum_target linux_target_ops = {
-  hostio_last_error_from_errno,
   linux_qxfer_osdata,
   linux_xfer_siginfo,
   linux_supports_non_stop,
diff --git a/gdbserver/lynx-low.cc b/gdbserver/lynx-low.cc
index f0d0d4456c4..0e904d07328 100644
--- a/gdbserver/lynx-low.cc
+++ b/gdbserver/lynx-low.cc
@@ -735,7 +735,6 @@ static lynx_process_target the_lynx_target;
 /* The LynxOS target_ops vector.  */
 
 static process_stratum_target lynx_target_ops = {
-  NULL,  /* hostio_last_error */
   NULL,  /* qxfer_osdata */
   NULL,  /* qxfer_siginfo */
   NULL,  /* supports_non_stop */
diff --git a/gdbserver/nto-low.cc b/gdbserver/nto-low.cc
index b9e7ed06337..ec0b477abe5 100644
--- a/gdbserver/nto-low.cc
+++ b/gdbserver/nto-low.cc
@@ -956,7 +956,6 @@ nto_sw_breakpoint_from_kind (int kind, int *size)
 static nto_process_target the_nto_target;
 
 static process_stratum_target nto_target_ops = {
-  hostio_last_error_from_errno,
   NULL, /* nto_qxfer_osdata */
   NULL, /* xfer_siginfo */
   nto_supports_non_stop,
diff --git a/gdbserver/target.cc b/gdbserver/target.cc
index f578dbea0da..e09ee7d0fa4 100644
--- a/gdbserver/target.cc
+++ b/gdbserver/target.cc
@@ -21,6 +21,7 @@
 #include "server.h"
 #include "tracepoint.h"
 #include "gdbsupport/byte-vector.h"
+#include "hostio.h"
 
 process_stratum_target *the_target;
 
@@ -506,3 +507,9 @@ process_target::get_tls_address (thread_info *thread, CORE_ADDR offset,
 {
   gdb_assert_not_reached ("target op get_tls_address not supported");
 }
+
+void
+process_target::hostio_last_error (char *buf)
+{
+  hostio_last_error_from_errno (buf);
+}
diff --git a/gdbserver/target.h b/gdbserver/target.h
index 2c818b3fb12..5f603fdf0bc 100644
--- a/gdbserver/target.h
+++ b/gdbserver/target.h
@@ -70,10 +70,6 @@ class process_target;
    shared code.  */
 struct process_stratum_target
 {
-  /* Fill BUF with an hostio error packet representing the last hostio
-     error.  */
-  void (*hostio_last_error) (char *buf);
-
   /* Read/Write OS data using qXfer packets.  */
   int (*qxfer_osdata) (const char *annex, unsigned char *readbuf,
 		       unsigned const char *writebuf, CORE_ADDR offset,
@@ -479,6 +475,10 @@ public:
      support the operation.  */
   virtual int get_tls_address (thread_info *thread, CORE_ADDR offset,
 			       CORE_ADDR load_module, CORE_ADDR *address);
+
+  /* Fill BUF with an hostio error packet representing the last hostio
+     error.  */
+  virtual void hostio_last_error (char *buf);
 };
 
 extern process_stratum_target *the_target;
diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc
index 84223e129bf..727bc9c8c95 100644
--- a/gdbserver/win32-low.cc
+++ b/gdbserver/win32-low.cc
@@ -1784,8 +1784,8 @@ win32_error_to_fileio_error (DWORD err)
   return FILEIO_EUNKNOWN;
 }
 
-static void
-wince_hostio_last_error (char *buf)
+void
+win32_process_target::hostio_last_error (char *buf)
 {
   DWORD winerr = GetLastError ();
   int fileio_err = win32_error_to_fileio_error (winerr);
@@ -1844,11 +1844,6 @@ win32_sw_breakpoint_from_kind (int kind, int *size)
 static win32_process_target the_win32_target;
 
 static process_stratum_target win32_target_ops = {
-#ifdef _WIN32_WCE
-  wince_hostio_last_error,
-#else
-  hostio_last_error_from_errno,
-#endif
   NULL, /* qxfer_osdata */
   win32_xfer_siginfo,
   NULL, /* supports_non_stop */
diff --git a/gdbserver/win32-low.h b/gdbserver/win32-low.h
index b2b8a6dedc3..86447fd541a 100644
--- a/gdbserver/win32-low.h
+++ b/gdbserver/win32-low.h
@@ -152,6 +152,10 @@ public:
   bool stopped_by_watchpoint () override;
 
   CORE_ADDR stopped_data_address () override;
+
+#ifdef _WIN32_WCE
+  void hostio_last_error (char *buf) override;
+#endif
 };
 
 /* Retrieve the context for this thread, if not already retrieved.  */
