Skip to content

Commit af1b3b0

Browse files
matouskozaklambdageek
andauthoredAug 7, 2024
[mono] Mark AOT modules unusable if no AOT version is found (#106026)
On Android, we might hit a collision where we instead of <libName>.dll.so try to load <libName>.so. By detecting this issue early we can mark the library as AOT unusable. We do this by checking if we were able to get the AOT file version and if not, we mark the .so file as unusable. --------- Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
1 parent 4153092 commit af1b3b0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed
 

‎src/mono/mono/mini/aot-runtime.c

+8-5
Original file line numberDiff line numberDiff line change
@@ -2102,15 +2102,13 @@ load_aot_module (MonoAssemblyLoadContext *alc, MonoAssembly *assembly, gpointer
21022102
find_symbol (sofile, globals, "mono_aot_file_info", (gpointer*)&info);
21032103
}
21042104

2105-
// Copy aotid to MonoImage
2106-
memcpy(&assembly->image->aotid, info->aotid, 16);
2107-
21082105
if (version_symbol) {
21092106
/* Old file format */
21102107
version = atoi (version_symbol);
2111-
} else {
2112-
g_assert (info);
2108+
} else if (info) {
21132109
version = info->version;
2110+
} else {
2111+
version = -1;
21142112
}
21152113

21162114
if (version != MONO_AOT_FILE_VERSION) {
@@ -2120,6 +2118,11 @@ load_aot_module (MonoAssemblyLoadContext *alc, MonoAssembly *assembly, gpointer
21202118
guint8 *blob;
21212119
void *handle;
21222120

2121+
g_assert (info);
2122+
2123+
// Copy aotid to MonoImage
2124+
memcpy(&assembly->image->aotid, info->aotid, 16);
2125+
21232126
if (info->flags & MONO_AOT_FILE_FLAG_SEPARATE_DATA) {
21242127
aot_data = open_aot_data (assembly, info, &handle);
21252128

0 commit comments

Comments
 (0)