From 20d0b100ddcc91b702b46773e337528722c75dfd Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 15 Dec 2011 23:59:56 +0100 Subject: [PATCH] AOT: Add option to emit global symbols for methods. Fixes #2471. The logic here is that we emit the debug name for a method as the global symbol, not the generated name we otherwise use, and we don't emit a debug symbol. The issue is that if we have both a global debug symbol and a global (generated) method name, which one will show up in stack traces is undefined. This is a temporary patch until it has been reviewed by the runtime people (it's only on mobile-master for now). --- mono/mini/aot-compiler.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mono/mini/aot-compiler.c b/mono/mini/aot-compiler.c index 93805edadc7..51325ebc6f7 100644 --- a/mono/mini/aot-compiler.c +++ b/mono/mini/aot-compiler.c @@ -217,6 +217,7 @@ typedef struct MonoAotCompile { GHashTable *plt_entry_debug_sym_cache; gboolean thumb_mixed, need_no_dead_strip, need_pt_gnu_stack; GHashTable *ginst_hash; + gboolean global_symbols; #ifdef MONOTOUCH gboolean direct_method_addresses; #endif @@ -615,6 +616,7 @@ arch_init (MonoAotCompile *acfg) #ifdef MONOTOUCH acfg->direct_method_addresses = TRUE; + acfg->global_symbols = TRUE; #endif } @@ -3993,9 +3995,13 @@ emit_method_code (MonoAotCompile *acfg, MonoCompile *cfg) /* Make the labels local */ emit_section_change (acfg, ".text", 0); emit_alignment (acfg, func_alignment); + + if (acfg->global_symbols && acfg->need_no_dead_strip) + fprintf (acfg->fp, " .no_dead_strip %s\n", cfg->asm_symbol); + emit_label (acfg, cfg->asm_symbol); - if (acfg->aot_opts.write_symbols) { + if (acfg->aot_opts.write_symbols && !acfg->global_symbols) { /* * Write a C style symbol for every method, this has two uses: * - it works on platforms where the dwarf debugging info is not @@ -7750,6 +7756,8 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options) if (COMPILE_LLVM (cfg)) cfg->asm_symbol = g_strdup_printf ("%s%s", acfg->llvm_label_prefix, cfg->llvm_method_name); + else if (acfg->global_symbols) + cfg->asm_symbol = get_debug_sym (cfg->method, "", acfg->method_label_hash); else cfg->asm_symbol = g_strdup_printf ("%s%sm_%x", acfg->temp_prefix, acfg->llvm_label_prefix, method_index); } -- 2.11.4.GIT