/* It is filled up during loading by the AOT loader. */
emit_zero_bytes (acfg, 16);
} else {
- /* Need to make sure this is 5 bytes long */
+ /* Need to make sure this is 9 bytes long */
emit_byte (acfg, '\xe9');
- label = g_strdup_printf (".Lpd_%d", i);
- emit_symbol_diff (acfg, label, ".", -4);
- g_free (label);
+ emit_symbol_diff (acfg, "plt", ".", -4);
+ emit_int32 (acfg, plt_info_offsets [i]);
}
#elif defined(__x86_64__)
/*
emit_global (acfg, symbol, TRUE);
emit_label (acfg, symbol);
- /*
- * Emit the default targets for the PLT entries separately since these will not
- * be modified at runtime.
- */
- for (i = 1; i < acfg->plt_offset; ++i) {
- char *label;
-
- label = g_strdup_printf (".Lpd_%d", i);
- emit_label (acfg, label);
- g_free (label);
-
- /* Put the offset into the register expected by mono_aot_plt_trampoline */
-#if defined(__i386__)
- /* movl $const, %eax */
- emit_byte (acfg, '\xb8');
- emit_int32 (acfg, plt_info_offsets [i]);
- /* jmp .Lp_0 */
- emit_byte (acfg, '\xe9');
- emit_symbol_diff (acfg, ".Lp_0", ".", -4);
-#elif defined(__x86_64__)
- /* Emitted along with the PLT entries since they will not be patched */
-#elif defined(__arm__)
- /* Emitted along with the PLT entries since they will not be patched */
-#if 0
- /* This is 12 bytes long, init_plt () depends on this */
- emit_unset_mode (acfg);
- fprintf (acfg->fp, "\tldr ip, [pc, #0]\n");
- fprintf (acfg->fp, "\tb .Lp_0\n");
- fprintf (acfg->fp, "\t.word %d\n", plt_info_offsets [i]);
-#endif
-#else
- g_assert_not_reached ();
-#endif
- }
-
/* Emit PLT info */
symbol = g_strdup_printf ("plt_info");
emit_global (acfg, symbol, FALSE);
guint32
mono_aot_get_plt_info_offset (gssize *regs, guint8 *code)
{
-#if defined(__i386__)
- return regs [MONO_ARCH_AOT_PLT_OFFSET_REG];
-#elif defined(__x86_64__)
guint8 *plt_entry = mono_aot_get_plt_entry (code);
g_assert (plt_entry);
+ /* The offset is embedded inside the code after the plt entry */
+#if defined(__i386__)
+ return *(guint32*)(plt_entry + 5);
+#elif defined(__x86_64__)
return *(guint32*)(plt_entry + 6);
#elif defined(__arm__)
- guint8 *plt_entry = mono_aot_get_plt_entry (code);
-
- g_assert (plt_entry);
-
/* The offset is stored as the 5th word of the plt entry */
return ((guint32*)plt_entry) [4];
#else