Merge remote branch 'upstream/master'
[mono.git] / mono / mini / aot-runtime.c
index 9610c7859b29d13a8001d15047d6832016356c99..115384028f003b2d2bca9677e26e655fb197ce92 100644 (file)
@@ -1036,6 +1036,7 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
        MonoAotFileInfo *info = NULL;
        int i, version;
        guint8 *blob;
+       gboolean do_load_image = TRUE;
 
        if (mono_compile_aot)
                return;
@@ -1262,8 +1263,20 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
         * non-lazily, since we can't handle out-of-date errors later.
         * The cached class info also depends on the exact assemblies.
         */
-       for (i = 0; i < amodule->image_table_len; ++i)
-               load_image (amodule, i, FALSE);
+#if defined(__native_client__)
+       /* TODO: Don't 'load_image' on mscorlib due to a */
+       /* recursive loading problem.  This should be    */
+       /* removed if mscorlib is loaded from disk.      */
+       if (strncmp(assembly->aname.name, "mscorlib", 8)) {
+               do_load_image = TRUE;
+       } else {
+               do_load_image = FALSE;
+       }
+#endif
+       if (do_load_image) {
+               for (i = 0; i < amodule->image_table_len; ++i)
+                       load_image (amodule, i, FALSE);
+       }
 
        if (amodule->out_of_date) {
                mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT Module %s is unusable because a dependency is out-of-date.\n", assembly->image->name);