[Mono-dev] AMD64 AOT code and bad IMT

Gavin Dodd gavin at wholesalealgorithms.com
Mon May 20 23:37:02 UTC 2013


I'm new to Mono so I'm not sure if this is the right list. Please point me in the right direction if this isn't the place to ask these questions.

I'm trying to get AOT compiled code to run on an embedded AMD 64 system. 

It is crashing the first time it hits a method call requiring an IMT because the pointer is incorrect

To make things more interesting I'm working with a branch of mono 2.8 (I think) and I don't have any symbols for the AOT compiled code at run time,

The problem shows up in

common_call_trampoline(mgreg_t* regs, guint8* code, gpointer arg, guint8* tramp, MonoVTable* vt, gpointer* vtable_slot, gboolean need_rgctx_tramp) Line 320    C++

    if (m == MONO_FAKE_IMT_METHOD) {
        MonoMethod *impl_method;
        MonoObject *this_arg;

        /* we get the interface method because mono_convert_imt_slot_to_vtable_slot ()
         * needs the signature to be able to find the this argument
        m = mono_arch_find_imt_method (regs, code);


At this point m points to bad data. The address is the address returned by mono_get_lmf_addr() 

From the map file I think the function calling the trampoline is System_IO_StreamReader_Initialize_System_IO_Stream_System_Text_Encoding_bool_int
from System_IO_StreamReader__cctor

I'm not sure what function it is trying to call (the vt parameter is for System.IO.NullStream)

My questions are:

Is the lmf address the correct value for the return of mono_arch_find_imt_method? If not what should it be?
What generates the IMT for AOT compiled code? 

What sets the IMT address table at run time and where is it stored? I haven't seen any breakpoints on IMT functions get hit at runtime.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20130520/ab0c8d88/attachment.html>

More information about the Mono-devel-list mailing list