acfg->llc_args = g_string_new ("");
acfg->as_args = g_string_new ("");
+ /*
+ * The prefix LLVM likes to put in front of symbol names on darwin.
+ * The mach-os specs require this for globals, but LLVM puts them in front of all
+ * symbols. We need to handle this, since we need to refer to LLVM generated
+ * symbols.
+ */
+ acfg->llvm_label_prefix = "";
+
#ifdef TARGET_ARM
if (acfg->aot_opts.mtriple && strstr (acfg->aot_opts.mtriple, "darwin")) {
g_string_append (acfg->llc_args, "-mattr=+v6");
{
char *name1, *name2, *cached;
int i, j, len, count;
-
+
name1 = mono_method_full_name (method, TRUE);
len = strlen (name1);
name2 = malloc (strlen (prefix) + len + 16);
char*
mono_aot_get_method_name (MonoCompile *cfg)
-{
- guint32 method_index = get_method_index (llvm_acfg, cfg->orig_method);
-
- return g_strdup_printf ("m_%x", method_index);
-}
-
-char*
-mono_aot_get_method_debug_name (MonoCompile *cfg)
{
return get_debug_sym (cfg->orig_method, "", llvm_acfg->method_label_hash);
}
#endif
acfg->num_trampolines [MONO_AOT_TRAMP_IMT_THUNK] = acfg->aot_opts.full_aot ? acfg->aot_opts.nimt_trampolines : 0;
+ acfg->temp_prefix = img_writer_get_temp_label_prefix (NULL);
+
+ arch_init (acfg);
+
acfg->got_symbol_base = g_strdup_printf ("%smono_aot_%s_got", acfg->llvm_label_prefix, acfg->image->assembly->aname.name);
acfg->plt_symbol = g_strdup_printf ("%smono_aot_%s_plt", acfg->llvm_label_prefix, acfg->image->assembly->aname.name);
*p = '_';
}
- acfg->temp_prefix = img_writer_get_temp_label_prefix (NULL);
-
- /*
- * The prefix LLVM likes to put in front of symbol names on darwin.
- * The mach-os specs require this for globals, but LLVM puts them in front of all
- * symbols. We need to handle this, since we need to refer to LLVM generated
- * symbols.
- */
- acfg->llvm_label_prefix = "";
-
- arch_init (acfg);
-
acfg->method_index = 1;
collect_methods (acfg);
MonoCompile *cfg = acfg->cfgs [i];
int method_index = get_method_index (acfg, cfg->orig_method);
- cfg->asm_symbol = g_strdup_printf ("%s%sm_%x", acfg->temp_prefix, acfg->llvm_label_prefix, method_index);
+ if (COMPILE_LLVM (cfg))
+ cfg->asm_symbol = g_strdup_printf ("%s%s", acfg->llvm_label_prefix, cfg->llvm_method_name);
+ else
+ cfg->asm_symbol = g_strdup_printf ("%s%sm_%x", acfg->temp_prefix, acfg->llvm_label_prefix, method_index);
}
}
MonoMethodSignature *sig;
MonoBasicBlock *bb;
LLVMTypeRef method_type;
- LLVMValueRef method = NULL, debug_alias = NULL;
- char *method_name, *debug_name = NULL;
+ LLVMValueRef method = NULL;
+ char *method_name;
LLVMValueRef *values;
int i, max_block_num, bb_index;
gboolean last = FALSE;
if (cfg->compile_aot) {
ctx->lmodule = &aot_module;
method_name = mono_aot_get_method_name (cfg);
- debug_name = mono_aot_get_method_debug_name (cfg);
+ cfg->llvm_method_name = g_strdup (method_name);
} else {
init_jit_module ();
ctx->lmodule = &jit_module;
method_name = mono_method_full_name (cfg->method, TRUE);
- debug_name = NULL;
}
module = ctx->module = ctx->lmodule->module;
#endif
LLVMSetLinkage (method, LLVMPrivateLinkage);
+ if (cfg->compile_aot) {
+ LLVMSetLinkage (method, LLVMInternalLinkage);
+ LLVMSetVisibility (method, LLVMHiddenVisibility);
+ } else {
+ LLVMSetLinkage (method, LLVMPrivateLinkage);
+ }
+
if (cfg->method->save_lmf)
LLVM_FAILURE (ctx, "lmf");
if (cfg->compile_aot) {
/* Don't generate native code, keep the LLVM IR */
-
- /* Can't delete the method if it has an alias, so only add it if successful */
- if (debug_name) {
- debug_alias = LLVMAddAlias (module, LLVMTypeOf (method), method, debug_name);
- LLVMSetLinkage (debug_alias, LLVMInternalLinkage);
- LLVMSetVisibility (debug_alias, LLVMHiddenVisibility);
- }
-
if (cfg->compile_aot && cfg->verbose_level)
printf ("%s emitted as %s\n", mono_method_full_name (cfg->method, TRUE), method_name);
g_free (ctx->pindexes);
g_free (ctx->is_dead);
g_free (ctx->unreachable);
- g_free (debug_name);
g_ptr_array_free (phi_values, TRUE);
g_free (ctx->bblocks);
g_hash_table_destroy (ctx->region_to_handler);
guint32 got_offset, ex_info_offset, method_info_offset;
/* Symbol used to refer to this method in generated assembly */
char *asm_symbol;
+ char *llvm_method_name;
MonoJitExceptionInfo *llvm_ex_info;
guint32 llvm_ex_info_len;
guint32 mono_aot_get_got_offset (MonoJumpInfo *ji) MONO_LLVM_INTERNAL;
char* mono_aot_get_method_name (MonoCompile *cfg) MONO_LLVM_INTERNAL;
char* mono_aot_get_plt_symbol (MonoJumpInfoType type, gconstpointer data) MONO_LLVM_INTERNAL;
-char* mono_aot_get_method_debug_name (MonoCompile *cfg) MONO_LLVM_INTERNAL;
MonoJumpInfo* mono_aot_patch_info_dup (MonoJumpInfo* ji) MONO_LLVM_INTERNAL;
void mono_aot_set_make_unreadable (gboolean unreadable) MONO_INTERNAL;
gboolean mono_aot_is_pagefault (void *ptr) MONO_INTERNAL;