diff --git a/gdb/NEWS b/gdb/NEWS
index fce33f3..f5a01e8 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -35,6 +35,9 @@ show debug bfd-cache
   The "/m" option is now considered deprecated: its "source-centric"
   output hasn't proved useful in practice.
 
+* The "set sysroot" (and "show sysroot") commands now permit multiple
+  directory paths.
+
 * New options
 
 set validate-build-id (on|off)
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index e82e41d..fa30007 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18154,7 +18154,8 @@ to specify the search directories for target libraries.
 @kindex set solib-absolute-prefix
 @kindex set sysroot
 @item set sysroot @var{path}
-Use @var{path} as the system root for the program being debugged.  Any
+Use @var{path} as the system root (or list of system roots) for the
+program being debugged.  Any
 absolute shared library paths will be prefixed with @var{path}; many
 runtime loaders store the absolute paths to the shared library in the
 target program's memory.  When starting processes remotely, and when
@@ -18166,7 +18167,10 @@ to be laid out in the same way that they are on the target, with
 e.g.@: a @file{/bin}, @file{/lib} and @file{/usr/lib} hierarchy under
 @var{path}.
 
-If @var{path} starts with the sequence @file{target:} and the target
+Multiple entries may be delimited by the host platform path separator in use.
+
+If @var{path} starts with the sequence @file{target:} (even if the host
+platform path separator is character @file{:}) and the target
 system is remote then @value{GDBN} will retrieve the target binaries
 from the remote system.  This is only supported when using a remote
 target that supports the @code{remote get} command (@pxref{File
@@ -18248,7 +18252,7 @@ location.
 
 @kindex show sysroot
 @item show sysroot
-Display the current executable and shared library prefix.
+Display the current executable and shared library prefix(es).
 
 @kindex set solib-search-path
 @item set solib-search-path @var{path}
diff --git a/gdb/solib.c b/gdb/solib.c
index be31ffd..98af2c0 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -46,6 +46,7 @@
 #include "filesystem.h"
 #include "gdb_bfd.h"
 #include "filestuff.h"
+#include "source.h"
 
 /* Architecture-specific operations.  */
 
@@ -118,9 +119,9 @@ show_solib_search_path (struct ui_file *file, int from_tty,
    is non-NULL, *FD is set to either -1 or an open file handle for
    the binary file.
 
-   Global variable GDB_SYSROOT is used as a prefix directory
+   Parameter SYSROOT is used as a prefix directory
    to search for binary files if they have an absolute path.
-   If GDB_SYSROOT starts with "target:" and target filesystem
+   If SYSROOT starts with "target:" and target filesystem
    is the local filesystem then the "target:" prefix will be
    stripped before the search starts.  This ensures that the
    same search algorithm is used for local files regardless of
@@ -150,14 +151,13 @@ show_solib_search_path (struct ui_file *file, int from_tty,
 */
 
 static char *
-solib_find_1 (char *in_pathname, int *fd, int is_solib)
+solib_find_2 (char *in_pathname, int *fd, int is_solib, const char *sysroot)
 {
   const struct target_so_ops *ops = solib_ops (target_gdbarch ());
   int found_file = -1;
   char *temp_pathname = NULL;
   const char *fskind = effective_target_file_system_kind ();
   struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
-  const char *sysroot = gdb_sysroot;
   int prefix_len, orig_prefix_len;
 
   /* If the absolute prefix starts with "target:" but the filesystem
@@ -377,6 +377,31 @@ solib_find_1 (char *in_pathname, int *fd, int is_solib)
   return temp_pathname;
 }
 
+/* It is an solib_find_2 wrapper handling multiple directory components
+   of GDB_SYSROOT.  */
+
+static char *
+solib_find_1 (char *in_pathname, int *fd, int is_solib)
+{
+  VEC (char_ptr) *sysroot_vec;
+  struct cleanup *back_to;
+  char *retval, *sysroot;
+  int ix;
+
+  sysroot_vec = dirnames_to_char_ptr_vec_target_exc (gdb_sysroot);
+  back_to = make_cleanup_free_char_ptr_vec (sysroot_vec);
+
+  for (ix = 0; VEC_iterate (char_ptr, sysroot_vec, ix, sysroot); ++ix)
+    {
+      retval = solib_find_2 (in_pathname, fd, is_solib, sysroot);
+      if (retval != NULL)
+	break;
+    }
+
+  do_cleanups (back_to);
+  return retval;
+}
+
 /* Return the full pathname of the main executable, or NULL if not
    found.  The returned pathname is malloc'ed and must be freed by
    the caller.  If FD is non-NULL, *FD is set to either -1 or an open
diff --git a/gdb/source.c b/gdb/source.c
index 0c23b7e..4cd3046 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -702,6 +702,41 @@ is_regular_file (const char *name)
   return S_ISREG (st.st_mode);
 }
 
+/* It is a wrapper of dirnames_to_char_ptr_vec which handles possible
+   TARGET_SYSROOT_PREFIX clash with DIRNAME_SEPARATOR.  */
+
+VEC (char_ptr) *
+dirnames_to_char_ptr_vec_target_exc (const char *string)
+{
+  VEC (char_ptr) *vec = dirnames_to_char_ptr_vec (string);
+  int ix;
+  char *s;
+
+  if (DIRNAME_SEPARATOR == ':')
+    for (ix = 0; ix < VEC_length (char_ptr, vec);)
+      {
+	char *s = VEC_index (char_ptr, vec, ix);
+
+	gdb_assert (strcmp (TARGET_SYSROOT_PREFIX, "target" ":") == 0);
+	if (strcmp (s, "target") != 0)
+	  {
+	    ++ix;
+	    continue;
+	  }
+	VEC_ordered_remove (char_ptr, vec, ix);
+	xfree (s);
+	if (ix == VEC_length (char_ptr, vec))
+	  VEC_safe_push (char_ptr, vec, xstrdup (TARGET_SYSROOT_PREFIX));
+	else
+	  xfree (VEC_replace (char_ptr, vec, ix,
+			      concat (TARGET_SYSROOT_PREFIX,
+				      VEC_index (char_ptr, vec, ix),
+				      NULL)));
+      }
+
+  return vec;
+}
+
 /* Open a file named STRING, searching path PATH (dir names sep by some char)
    using mode MODE in the calls to open.  You cannot use this function to
    create files (O_CREAT).
diff --git a/gdb/source.h b/gdb/source.h
index 9050357..fd58d8e 100644
--- a/gdb/source.h
+++ b/gdb/source.h
@@ -98,4 +98,7 @@ extern void clear_current_source_symtab_and_line (void);
 
 /* Add a source path substitution rule.  */
 extern void add_substitute_path_rule (char *, char *);
+
+extern VEC (char_ptr) *dirnames_to_char_ptr_vec_target_exc (const char *string);
+
 #endif
