NaCl runtime fixes
[mono.git] / mono / mini / mini.c
index 88d6bd834e0a53d61a0b58405b2bef67cb1eb7db..8357ca931c9561964147c62144c4ee5a39099f81 100644 (file)
@@ -3394,7 +3394,7 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code,
                break;
        }
        case MONO_PATCH_INFO_JIT_TLS_ID: {
-               target = (gpointer)mono_jit_tls_id;
+               target = (gpointer) (size_t) mono_jit_tls_id;
                break;
        }
        default:
@@ -5798,8 +5798,15 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in
                        patch_info.data.method = method;
                        g_hash_table_remove (domain_jit_info (target_domain)->jump_target_hash, method);
 
+#if defined(__native_client_codegen__) && defined(__native_client__)
+                       /* These patches are applied after a method has been installed, no target munging is needed. */
+                       nacl_allow_target_modification (FALSE);
+#endif
                        for (tmp = jlist->list; tmp; tmp = tmp->next)
                                mono_arch_patch_code (NULL, target_domain, tmp->data, &patch_info, NULL, TRUE);
+#if defined(__native_client_codegen__) && defined(__native_client__)
+                       nacl_allow_target_modification (TRUE);
+#endif
                }
        }