static MonoAotModule *mscorlib_aot_module;
+/* Embedding API hooks to load the AOT data for AOT images compiled with MONO_AOT_FILE_FLAG_SEPARATE_DATA */
+static MonoLoadAotDataFunc aot_data_load_func;
+static MonoFreeAotDataFunc aot_data_free_func;
+static gpointer aot_data_func_user_data;
+
static void
init_plt (MonoAotModule *info);
}
}
+void
+mono_install_load_aot_data_hook (MonoLoadAotDataFunc load_func, MonoFreeAotDataFunc free_func, gpointer user_data)
+{
+ aot_data_load_func = load_func;
+ aot_data_free_func = free_func;
+ aot_data_func_user_data = user_data;
+}
+
/* Load the separate aot data file for ASSEMBLY */
static guint8*
open_aot_data (MonoAssembly *assembly, MonoAotFileInfo *info, void **ret_handle)
char *filename;
guint8 *data;
+ if (aot_data_load_func) {
+ data = aot_data_load_func (assembly, info->datafile_size, aot_data_func_user_data, ret_handle);
+ g_assert (data);
+ return data;
+ }
+
/*
* Use <assembly name>.aotdata as the default implementation if no callback is given
*/
filename = g_strdup_printf ("%s.aotdata", assembly->image->name);
map = mono_file_map_open (filename);
g_assert (map);
- data = mono_file_map (info->datafile_size, MONO_MMAP_READ|MONO_MMAP_PRIVATE, mono_file_map_fd (map), 0, ret_handle);
+ data = mono_file_map (info->datafile_size, MONO_MMAP_READ, mono_file_map_fd (map), 0, ret_handle);
g_assert (data);
return data;
/* This is an exported function */
MONO_API void mono_aot_register_module (gpointer *aot_info);
+/* These are used to load the AOT data for aot images compiled with MONO_AOT_FILE_FLAG_SEPARATE_DATA */
+/*
+ * Return the AOT data for ASSEMBLY. SIZE is the size of the data. OUT_HANDLE should be set to a handle which is later
+ * passed to the free function.
+ */
+typedef unsigned char* (*MonoLoadAotDataFunc) (MonoAssembly *assembly, int size, gpointer user_data, void **out_handle);
+/* Not yet used */
+typedef void (*MonoFreeAotDataFunc) (MonoAssembly *assembly, int size, gpointer user_data, void *handle);
+MONO_API void mono_install_load_aot_data_hook (MonoLoadAotDataFunc load_func, MonoFreeAotDataFunc free_func, gpointer user_data);
+
void mono_xdebug_init (const char *xdebug_opts);
void mono_save_xdebug_info (MonoCompile *cfg);
void mono_save_trampoline_xdebug_info (MonoTrampInfo *info);