Permalink
Browse files

Escape characters in LLVM symbol names

  • Loading branch information...
1 parent 7e2eff0 commit af804a9305ec7f87891aaeab05be793012693bb8 @vargaz vargaz committed with shana Aug 11, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 mono/mini/aot-compiler.c
View
@@ -185,6 +185,7 @@ typedef struct MonoAotCompile {
MonoClass **typespec_classes;
GString *llc_args;
GString *as_args;
+ char *assembly_name_sym;
gboolean thumb_mixed, need_no_dead_strip, need_pt_gnu_stack;
} MonoAotCompile;
@@ -5129,7 +5130,7 @@ mono_aot_get_method_name (MonoCompile *cfg)
{
if (llvm_acfg->aot_opts.static_link)
/* Include the assembly name too to avoid duplicate symbol errors */
- return g_strdup_printf ("%s_%s", llvm_acfg->image->assembly->aname.name, get_debug_sym (cfg->orig_method, "", llvm_acfg->method_label_hash));
+ return g_strdup_printf ("%s_%s", llvm_acfg->assembly_name_sym, get_debug_sym (cfg->orig_method, "", llvm_acfg->method_label_hash));
else
return get_debug_sym (cfg->orig_method, "", llvm_acfg->method_label_hash);
}
@@ -6842,6 +6843,7 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
acfg->got_symbol_base = g_strdup_printf ("mono_aot_%s_got", acfg->image->assembly->aname.name);
acfg->plt_symbol = g_strdup_printf ("%smono_aot_%s_plt", acfg->llvm_label_prefix, acfg->image->assembly->aname.name);
+ acfg->assembly_name_sym = g_strdup (acfg->image->assembly->aname.name);
/* Get rid of characters which cannot occur in symbols */
for (p = acfg->got_symbol_base; *p; ++p) {
@@ -6852,6 +6854,10 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
if (!(isalnum (*p) || *p == '_'))
*p = '_';
}
+ for (p = acfg->assembly_name_sym; *p; ++p) {
+ if (!(isalnum (*p) || *p == '_'))
+ *p = '_';
+ }
acfg->method_index = 1;

0 comments on commit af804a9

Please sign in to comment.