Skip to content

Commit

Permalink
[aot] mscorlib.dll isn't CoreLib on netcore
Browse files Browse the repository at this point in the history
It's a forwarding assembly.  Don't treat it specially
  • Loading branch information
lambdageek committed May 25, 2021
1 parent 396681d commit cdff6f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/mono/mono/mini/aot-compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <mono/metadata/appdomain.h>
#include <mono/metadata/debug-helpers.h>
#include <mono/metadata/assembly.h>
#include <mono/metadata/assembly-internals.h>
#include <mono/metadata/metadata-internals.h>
#include <mono/metadata/reflection-internals.h>
#include <mono/metadata/marshal.h>
Expand Down Expand Up @@ -14089,7 +14090,7 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options,
#endif

/* required for mixed mode */
if (strcmp (acfg->image->assembly->aname.name, "mscorlib") == 0) {
if (strcmp (acfg->image->assembly->aname.name, MONO_ASSEMBLY_CORLIB_NAME) == 0) {
add_gc_wrappers (acfg);

for (int i = 0; i < MONO_JIT_ICALL_count; ++i)
Expand Down
8 changes: 5 additions & 3 deletions src/mono/mono/mini/aot-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,7 @@ check_usable (MonoAssembly *assembly, MonoAotFileInfo *info, guint8 *blob, char
msg = g_strdup ("compiled with --aot=full");
usable = FALSE;
}
if (mono_use_interpreter && !interp && !strcmp (assembly->aname.name, "mscorlib")) {
if (mono_use_interpreter && !interp && !strcmp (assembly->aname.name, MONO_ASSEMBLY_CORLIB_NAME)) {
/* mscorlib contains necessary interpreter trampolines */
msg = g_strdup ("not compiled with --aot=interp");
usable = FALSE;
Expand Down Expand Up @@ -2183,8 +2183,10 @@ load_aot_module (MonoAssemblyLoadContext *alc, MonoAssembly *assembly, gpointer
amodule->trampolines [MONO_AOT_TRAMP_FTNPTR_ARG] = (guint8 *)info->ftnptr_arg_trampolines;
amodule->trampolines [MONO_AOT_TRAMP_UNBOX_ARBITRARY] = (guint8 *)info->unbox_arbitrary_trampolines;

if (mono_is_corlib_image (assembly->image) || !strcmp (assembly->aname.name, "mscorlib") || !strcmp (assembly->aname.name, "System.Private.CoreLib"))
if (mono_is_corlib_image (assembly->image) || !strcmp (assembly->aname.name, MONO_ASSEMBLY_CORLIB_NAME)) {
g_assert (!mscorlib_aot_module);
mscorlib_aot_module = amodule;
}

/* Compute method addresses */
amodule->methods = (void **)g_malloc0 (amodule->info.nmethods * sizeof (gpointer));
Expand Down Expand Up @@ -5834,7 +5836,7 @@ aot_is_slim_amodule (MonoAotModule *amodule)
return FALSE;

/* "slim" only applies to mscorlib.dll */
if (strcmp (amodule->aot_name, "mscorlib"))
if (strcmp (amodule->aot_name, MONO_ASSEMBLY_CORLIB_NAME))
return FALSE;

guint32 f = amodule->info.flags;
Expand Down

0 comments on commit cdff6f7

Please sign in to comment.