+2011-06-01  Mike Frysinger  <vapier@gentoo.org>
+
+       * remote-sim.c (gdbsim_open): Add the strlen of " --sysroot=" and
+       gdb_sysroot to the "len" variable.  Append both to "arg_buf".
+
 2011-06-01  Yao Qi  <yao@codesourcery.com>
 
        * objfiles.h (obj_section_addr): Update reference to objfile from
 
   len = (7 + 1                 /* gdbsim */
         + strlen (" -E little")
         + strlen (" --architecture=xxxxxxxxxx")
+        + strlen (" --sysroot=") + strlen (gdb_sysroot) +
         + (args ? strlen (args) : 0)
         + 50) /* slack */ ;
   arg_buf = (char *) alloca (len);
       strcat (arg_buf, " --architecture=");
       strcat (arg_buf, selected_architecture_name ());
     }
+  /* Pass along gdb's concept of the sysroot.  */
+  strcat (arg_buf, " --sysroot=");
+  strcat (arg_buf, gdb_sysroot);
   /* finally, any explicit args */
   if (args)
     {