--- gdb/utils.c~	2020-06-29 04:47:10.000000000 +0300
+++ gdb/utils.c	2020-07-02 11:11:45.476031500 +0300
@@ -2967,8 +2967,20 @@ gdb_realpath_check_trailer (const char *
   size_t len = strlen (result.get ());
   size_t trail_len = strlen (trailer);
 
+#ifndef _WIN32
   SELF_CHECK (len >= trail_len
 	      && strcmp (result.get () + len - trail_len, trailer) == 0);
+#else
+  const char *res_trail = result.get () + len - trail_len;
+  int slash = res_trail[0];
+
+  SELF_CHECK (len >= trail_len
+	      && (strcmp (result.get () + len - trail_len, trailer) == 0
+		  || (strcmp (result.get () + len - trail_len + 1,
+			      trailer + 1) == 0
+		      && IS_DIR_SEPARATOR (slash)
+		      && IS_DIR_SEPARATOR (trailer[0]))));
+#endif
 }
 
 static void
--- gdb/unittests/scoped_fd-selftests.c~	2020-06-29 04:47:10.000000000 +0300
+++ gdb/unittests/scoped_fd-selftests.c	2020-07-02 12:30:55.733738900 +0300
@@ -76,7 +76,7 @@ test_to_file ()
 
   unlink (filename);
   
-  gdb_file_up file = sfd.to_file ("rw");
+  gdb_file_up file = sfd.to_file ("r+");
   SELF_CHECK (file != nullptr);
   SELF_CHECK (sfd.get () == -1);
 }

--- gdb/unittests/mkdir-recursive-selftests.c~	2020-09-10 04:47:11.000000000 +0300
+++ gdb/unittests/mkdir-recursive-selftests.c	2020-09-10 16:50:26.304750000 +0300
@@ -74,7 +74,11 @@ test ()
   std::string dir = string_printf ("%s/a/b", base.data ());
   SELF_CHECK (create_dir_and_check (dir.c_str ()));
 
+#ifdef _WIN32
+  dir = string_printf ("%s/a/b/c//d/e", base.data ());
+#else
   dir = string_printf ("%s/a/b/c//d/e/", base.data ());
+#endif
   SELF_CHECK (create_dir_and_check (dir.c_str ()));
 }
 
