img_writer_emit_pointer (acfg->w, target);
}
+static inline void
+emit_pointer_2 (MonoAotCompile *acfg, const char *prefix, const char *target)
+{
+ if (prefix [0] != '\0') {
+ char *s = g_strdup_printf ("%s%s", prefix, target);
+ img_writer_emit_pointer (acfg->w, s);
+ g_free (s);
+ } else {
+ img_writer_emit_pointer (acfg->w, target);
+ }
+}
+
static inline void
emit_int16 (MonoAotCompile *acfg, int value)
{
#define COMMON_TRAMP_SIZE 16
int count = (mono_pagesize () - COMMON_TRAMP_SIZE) / 8;
int imm8, rot_amount;
+ char symbol [128];
if (!acfg->aot_opts.use_trampolines_page)
return;
+ sprintf (symbol, "%sspecific_trampolines_page", acfg->user_symbol_prefix);
emit_alignment (acfg, mono_pagesize ());
- emit_global (acfg, "specific_trampolines_page", TRUE);
- emit_label (acfg, "specific_trampolines_page");
+ emit_global (acfg, symbol, TRUE);
+ emit_label (acfg, symbol);
/* emit the generic code first, the trampoline address + 8 is in the lr register */
code = buf;
* subtracts 4096 to get to the data page and loads the values
* We again fit the generic trampiline in 16 bytes.
*/
- emit_global (acfg, "rgctx_trampolines_page", TRUE);
- emit_label (acfg, "rgctx_trampolines_page");
+ sprintf (symbol, "%srgctx_trampolines_page", acfg->user_symbol_prefix);
+ emit_global (acfg, symbol, TRUE);
+ emit_label (acfg, symbol);
code = buf;
imm8 = mono_arm_is_rotated_imm8 (mono_pagesize (), &rot_amount);
ARM_SUB_REG_IMM (code, ARMREG_IP, ARMREG_IP, imm8, rot_amount);
/*
* gsharedvt arg trampolines: see arch_emit_gsharedvt_arg_trampoline ()
*/
- emit_global (acfg, "gsharedvt_arg_trampolines_page", TRUE);
- emit_label (acfg, "gsharedvt_arg_trampolines_page");
+ sprintf (symbol, "%sgshatedvt_arg_trampolines_page", acfg->user_symbol_prefix);
+ emit_global (acfg, symbol, TRUE);
+ emit_label (acfg, symbol);
code = buf;
ARM_PUSH (code, (1 << ARMREG_R0) | (1 << ARMREG_R1) | (1 << ARMREG_R2) | (1 << ARMREG_R3));
imm8 = mono_arm_is_rotated_imm8 (mono_pagesize (), &rot_amount);
* We again fit the generic trampiline in 16 bytes.
*/
#define IMT_TRAMP_SIZE 72
- emit_global (acfg, "imt_trampolines_page", TRUE);
- emit_label (acfg, "imt_trampolines_page");
+ sprintf (symbol, "%simt_trampolines_page", acfg->user_symbol_prefix);
+ emit_global (acfg, symbol, TRUE);
+ emit_label (acfg, symbol);
code = buf;
/* Need at least two free registers, plus a slot for storing the pc */
ARM_PUSH (code, (1 << ARMREG_R0)|(1 << ARMREG_R1)|(1 << ARMREG_R2));
/* Emit code */
- sprintf (start_symbol, "%s", name);
+ sprintf (start_symbol, "%s%s", acfg->user_symbol_prefix, name);
emit_section_change (acfg, ".text", 0);
emit_global (acfg, start_symbol, TRUE);
encode_patch_list (acfg, patches, patches->len, got_offset, p, &p);
g_assert (p - buf < buf_size);
- sprintf (symbol, "%s_p", name);
+ sprintf (symbol, "%s%s_p", acfg->user_symbol_prefix, name);
info_offset = add_to_blob (acfg, buf, p - buf);
gc_name = mono_gc_get_gc_name ();
gc_name_offset = add_to_blob (acfg, (guint8*)gc_name, strlen (gc_name) + 1);
- sprintf (symbol, "mono_aot_file_info");
+ sprintf (symbol, "%smono_aot_file_info", acfg->user_symbol_prefix);
emit_section_change (acfg, ".data", 0);
emit_alignment (acfg, 8);
emit_label (acfg, symbol);
* mono_aot_register_module (). The symbol points to a pointer to the the file info
* structure.
*/
-#if defined(TARGET_MACH) && !defined(__native_client_codegen__)
- sprintf (symbol, "_mono_aot_module_%s_info", acfg->image->assembly->aname.name);
-#else
- sprintf (symbol, "mono_aot_module_%s_info", acfg->image->assembly->aname.name);
-#endif
+ sprintf (symbol, "%smono_aot_module_%s_info", acfg->user_symbol_prefix, acfg->image->assembly->aname.name);
/* Get rid of characters which cannot occur in symbols */
p = symbol;
acfg->static_linking_symbol = g_strdup (symbol);
emit_global_inner (acfg, symbol, FALSE);
emit_label (acfg, symbol);
- emit_pointer (acfg, "mono_aot_file_info");
+ emit_pointer_2 (acfg, acfg->user_symbol_prefix, "mono_aot_file_info");
}
}
asm_writer_emit_global (MonoImageWriter *acfg, const char *name, gboolean func)
{
asm_writer_emit_unset_mode (acfg);
-#if ((defined(__ppc__) || defined(TARGET_X86) || defined(TARGET_AMD64)) && defined(TARGET_ASM_APPLE)) || (defined(HOST_WIN32) && !defined(MONO_CROSS_COMPILE))
- if (name[0] != '_')
- // mach-o always uses a '_' prefix.
- fprintf (acfg->fp, "\t.globl _%s\n", name);
- else
- fprintf (acfg->fp, "\t.globl %s\n", name);
-#else
+
fprintf (acfg->fp, "\t.globl %s\n", name);
-#endif
asm_writer_emit_symbol_type (acfg, name, func);
}
asm_writer_emit_label (MonoImageWriter *acfg, const char *name)
{
asm_writer_emit_unset_mode (acfg);
-#if (defined(TARGET_X86) || defined(TARGET_AMD64)) && defined(TARGET_ASM_APPLE)
- name = get_label(name);
- fprintf (acfg->fp, "%s:\n", name);
- if (name[0] != 'L' && name[0] != '_')
- fprintf (acfg->fp, "_%s:\n", name);
-
-#elif (defined(HOST_WIN32) && (defined(TARGET_X86) || defined(TARGET_AMD64))) || (defined(TARGET_X86) && defined(TARGET_ASM_APPLE))
- fprintf (acfg->fp, "_%s:\n", name);
-#if defined(HOST_WIN32)
- /* Emit a normal label too */
- fprintf (acfg->fp, "%s:\n", name);
-#endif
-#else
fprintf (acfg->fp, "%s:\n", get_label (name));
-#endif
-
}
static void