Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mono][wasm] Refactor mono_fixup_symbol_name #101681

Merged
merged 12 commits into from
May 9, 2024
10 changes: 2 additions & 8 deletions src/mono/mono/mini/aot-compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -14284,7 +14284,7 @@ acfg_free (MonoAotCompile *acfg)
g_free (acfg->static_linking_symbol);
g_free (acfg->got_symbol);
g_free (acfg->plt_symbol);
g_free (acfg->global_prefix);
g_free (acfg->assembly_name_sym);
mkhamoyan marked this conversation as resolved.
Show resolved Hide resolved
g_ptr_array_free (acfg->methods, TRUE);
g_ptr_array_free (acfg->image_table, TRUE);
g_ptr_array_free (acfg->globals, TRUE);
Expand Down Expand Up @@ -15112,13 +15112,7 @@ aot_assembly (MonoAssembly *ass, guint32 jit_opts, MonoAotOptions *aot_options)
if (acfg->aot_opts.llvm_only)
acfg->flags = (MonoAotFileFlags)(acfg->flags | MONO_AOT_FILE_FLAG_LLVM_ONLY);

acfg->assembly_name_sym = g_strdup (get_assembly_prefix (acfg->image));
char *p;
/* Get rid of characters which cannot occur in symbols */
for (p = acfg->assembly_name_sym; *p; ++p) {
if (!(isalnum (*p) || *p == '_'))
*p = '_';
}
acfg->assembly_name_sym = mono_fixup_symbol_name ("", get_assembly_prefix (acfg->image), "");
acfg->global_prefix = g_strdup_printf ("mono_aot_%s", acfg->assembly_name_sym);
acfg->plt_symbol = g_strdup_printf ("%s_plt", acfg->global_prefix);
acfg->got_symbol = g_strdup_printf ("%s_got", acfg->global_prefix);
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/AotCompilerTask/MonoAOTCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ private PrecompileArguments GetPrecompileArgumentsFor(ITaskItem assemblyItem, st

if (CollectTrimmingEligibleMethods)
{
string assemblyName = assemblyFilename.Replace(".", "_");
string assemblyName = FixupSymbolName(assemblyFilename);
string outputFileName = assemblyName + "_compiled_methods.txt";
string outputFilePath;
if (string.IsNullOrEmpty(TrimmingEligibleMethodsOutputDirectory))
Expand Down