[Mono-dev] Mono AOT for 64-bit Windows
admin at wholesalealgorithms.com
Thu Jun 27 17:19:14 UTC 2013
I just dealt with AOT cross compiling from win64 to freebsd/amd64 and had something like this
mono_marshal_get_icall_wrapper emits the address of the function to call at the time of compilation.
As I was only concerned with AOT I just changed
mono_mb_emit_native_call (mb, csig2, (gpointer) func);
mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
mono_mb_emit_op (mb, CEE_MONO_ICALL, func);
I'm sure there was another case that also emitted the wrong address in the same way but can't find it at the moment.
Another issue that probably doesn't apply to you, but caused huge problems, was alignment of data structures between different compilers.
The mono vm compiled on freebsd had different alignment for bitfields than the compiler built with msvc.
From: voldemarz <voldemarz at gmail.com>
To: mono-devel-list at lists.ximian.com
Sent: Thursday, June 27, 2013 9:52 AM
Subject: Re: [Mono-dev] Mono AOT for 64-bit Windows
Thanks for input. By seasoned you mean someone who has good knowledge of Mono
internals or generally a guy with low level experience on various
I slightly modified ASM generation
- wrapped .type and .size within .def/.endef directives
- removed local symbol emission
- removed underscore in front of global symbols
Now I can generate AOT images and runtime seems to find all data structures
it needs. In few first runs surprisingly some simple tests worked
successfully in aot and full-aot mode - console output, simple calculations,
events, catching exceptions, allocating bunch of objects and invoking
Then I regenerated AOT image of mscorlib and it doesn't work any more.
Trying to figure out issues now. In full-aot mode it crashes after a jump to
a non-executable memory region from function
The first few ops after the function prolog look like this (full function
asm here <http://pastebin.com/GfTLeN1e> ):
mov rcx,qword ptr [rbp-70h]
mov qword ptr [rbp-38h],rsp
The address loaded into rax looks very suspicios. As far I can see that
function is compiled from IL. Haven't tracked down were is it coming from?
Could someone point me to it? What is it attempting call internally?
View this message in context: http://mono.1490590.n4.nabble.com/Mono-AOT-for-64-bit-Windows-tp4659926p4660049.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-devel-list