<html><body><div style="color:#000; background-color:#fff; font-family:lucida console, sans-serif;font-size:10pt">I just dealt with AOT cross compiling from win64 to freebsd/amd64 and had something like this<br><br>mono_marshal_get_icall_wrapper emits the address of the function to call at the time of compilation.<br><br><br>As I was only concerned with AOT I just changed<br><br>mono_mb_emit_native_call (mb, csig2, (gpointer) func);<br><br>to<br><br>mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);<div>mono_mb_emit_op (mb, CEE_MONO_ICALL, func);</div><br><br>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.<br><br>Another issue that probably doesn't apply to you, but caused huge problems, was alignment of data structures between different compilers.<br>The mono vm compiled on freebsd had different alignment for bitfields than the compiler built with
msvc.<br><br>Gavin<br><div><span><br></span></div><div><br></div> <div style="font-family: lucida console, sans-serif; font-size: 10pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1"> <font face="Arial" size="2"> <b><span style="font-weight:bold;">From:</span></b> voldemarz <firstname.lastname@example.org><br> <b><span style="font-weight: bold;">To:</span></b> email@example.com <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, June 27, 2013 9:52 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Mono-dev] Mono AOT for 64-bit Windows<br> </font> </div> <div class="y_msg_container"><br>
Thanks for input. By seasoned you mean someone who has good knowledge of Mono<br>internals or generally a guy with low level experience on various<br>platforms/architectures?<br><br>I slightly modified ASM generation <br>- wrapped .type and .size within .def/.endef directives<br>- removed local symbol emission<br>- removed underscore in front of global symbols <br><br>Now I can generate AOT images and runtime seems to find all data structures<br>it needs. In few first runs surprisingly some simple tests worked<br>successfully in aot and full-aot mode - console output, simple calculations,<br>events, catching exceptions, allocating bunch of objects and invoking<br>garbage collection.<br><br>Then I regenerated AOT image of mscorlib and it doesn't work any more.<br>Trying to figure out issues now. In full-aot mode it crashes after a jump to<br>a non-executable memory region from
function<br>wrapper_managed_to_native_object___icall_wrapper_mono_object_new_ptrfree_box_intptr<br><br>The first few ops after the function prolog look like this (full function<br>asm here <http://pastebin.com/GfTLeN1e> ):<br>mov rax,7FACDFD19E0h<br>mov rcx,qword ptr [rbp-70h]<br>sub rsp,20h<br>mov qword ptr [rbp-38h],rsp<br>call rax<br><br>The address loaded into rax looks very suspicios. As far I can see that<br>function is compiled from IL. Haven't tracked down were is it coming from?<br>Could someone point me to it? What is it attempting call internally?<br><br><br><br>--<br>View this message in context: http://mono.1490590.n4.nabble.com/Mono-AOT-for-64-bit-Windows-tp4659926p4660049.html<br>Sent from the Mono - Dev mailing list archive at <a target="_blank"
href="http://nabble.com/">Nabble.com</a>.<br>_______________________________________________<br>Mono-devel-list mailing list<br><a ymailto="mailto:Monofirstname.lastname@example.org" href="mailto:Monoemail@example.com">Monofirstname.lastname@example.org</a><br>http://lists.ximian.com/mailman/listinfo/mono-devel-list<br><br><br></div> </div> </div> </div></body></html>