Bug 6953 - JIT assertion when running with embedded mono w/ LLVM 2.11.4 (head as of 2012-09-05)
Summary: JIT assertion when running with embedded mono w/ LLVM 2.11.4 (head as of 2012...
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2012-09-06 10:23 UTC by Jonathan Shore
Modified: 2014-07-30 08:48 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Jonathan Shore 2012-09-06 10:23:56 UTC
I have an embedded application (which is using LLVM and is statically compiled).  With the latest build off of the head (as of 2012-09-05), I get the following assertion on startup.   This is the first time I have tried to run embedded with LLVM enabled.  Previously was using the mono JIT without problem.

The initialization is as follows:

   extern int mono_use_llvm;

    mono_use_llvm = true;

    // create AppDomain
   _domain = mono_jit_init (bootassembly);
   _core = mono_domain_assembly_open (_domain, bootassembly);

   // setup config locations
   mono_config_parse (NULL);

Without the mono_use_llvm = true, the code functions properly.  The performance difference between the mono JIT and LLVM is more than 2x though, so would like to get this working.  Is there some other preparation needed to use LLVM here.

* Assertion at mini-llvm-cpp.cpp:507, condition `EE' not met


Native stacktrace:


Debug info from gdb:

[Thread debugging using libthread_db enabled]
0x0000000000f2e39e in __libc_waitpid (pid=<value optimized out>, stat_loc=0x7fff4a77dc7c, options=<value optimized out>)
    at ../sysdeps/unix/sysv/linux/waitpid.c:32
32	../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory.
	in ../sysdeps/unix/sysv/linux/waitpid.c
* 1 Thread 0x18dd8c0 (LWP 2968)  0x0000000000f2e39e in __libc_waitpid (pid=<value optimized out>, stat_loc=0x7fff4a77dc7c, 
    options=<value optimized out>) at ../sysdeps/unix/sysv/linux/waitpid.c:32

Thread 1 (Thread 0x18dd8c0 (LWP 2968)):
#0  0x0000000000f2e39e in __libc_waitpid (pid=<value optimized out>, stat_loc=0x7fff4a77dc7c, options=<value optimized out>)
    at ../sysdeps/unix/sysv/linux/waitpid.c:32
#1  0x0000000000648fb2 in mono_handle_native_sigsegv (signal=<value optimized out>, ctx=<value optimized out>) at mini-exceptions.c:2291
#2  <signal handler called>
#3  0x0000000000f2e50b in raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:42
#4  0x0000000000f43260 in abort ()
#5  0x00000000005b54fb in monoeg_g_logv (log_domain=0x1342729 "", log_level=G_LOG_LEVEL_ERROR, format=<value optimized out>, 
    args=<value optimized out>) at goutput.c:136
#6  0x00000000005b55a7 in monoeg_assertion_message (format=0x6 <Address 0x6 out of bounds>) at goutput.c:156
#7  0x0000000000664771 in mono_llvm_create_ee (MP=0x1a44260, alloc_cb=<value optimized out>, emitted_cb=<value optimized out>, 
    exception_cb=0x64abd0 <exception_cb>) at mini-llvm-cpp.cpp:507
#8  0x000000000064fb0b in init_jit_module (cfg=0x1a40520) at mini-llvm.c:5043
#9  mono_llvm_emit_method (cfg=0x1a40520) at mini-llvm.c:4214
#10 0x000000000049210d in mini_method_compile (method=0x1a3f860, opts=<value optimized out>, domain=<value optimized out>, 
    run_cctors=<value optimized out>, compile_aot=<value optimized out>, parts=<value optimized out>) at mini.c:5010
#11 0x000000000049376b in mono_jit_compile_method_inner (method=0x1a3f860, opt=51472895, ex=0x7fff4a77eb78) at mini.c:5313
#12 mono_jit_compile_method_with_opt (method=0x1a3f860, opt=51472895, ex=0x7fff4a77eb78) at mini.c:5567
#13 0x0000000000494576 in mono_jit_runtime_invoke (method=0x1a3f860, obj=0x7f1482163f50, params=<value optimized out>, exc=0x0) at mini.c:5792
#14 0x000000000052496b in mono_runtime_invoke (method=0x1a3f860, obj=0x7f1482163f50, params=0x7fff4a77ed20, exc=0x0) at object.c:2810
#15 0x00000000004d0847 in create_exception_two_strings (klass=0x1a3ece8, a1=<value optimized out>, a2=<value optimized out>) at exception.c:139
#16 0x00000000004a9337 in create_domain_objects (domain=0x7f148265fcc0) at appdomain.c:179
#17 0x00000000004aa38f in mono_runtime_init (domain=0x7f148265fcc0, start_cb=<value optimized out>, attach_cb=0x48b700 <mono_thread_attach_cb>)
    at appdomain.c:263
#18 0x00000000004960e7 in mini_init (filename=<value optimized out>, runtime_version=<value optimized out>) at mini.c:6790
#19 0x000000000044c9a2 in CLRApi (this=0x1950090, bootassembly=0x19b1398 "./dist/hf/lib/com.gf.core.dll", debugagent=0x0, optimize=true)
    at /home/jshore/Dev/hf/src/Libraries/CApi/src/CLRApi.cpp:46
#20 0x0000000000417439 in HF::EvaluatorLocal::Initialize (this=0x19b0bb0) at ./src/HftCommon/evaluator/HFEvaluatorLocal.cpp:49
#21 0x00000000004176ce in HF::EvaluatorLocal::Evaluate (this=0x19b0bb0, individual=0x18e4e50, packagename=...)
    at ./src/HftCommon/evaluator/HFEvaluatorLocal.cpp:73
---Type <return> to continue, or q <return> to quit---q
Comment 1 Zoltan Varga 2012-09-06 12:03:44 UTC
How do you link your app ? The LLVM libraries are not linked into libmono currently, so you have to link
them yourself, i.e.:

g++ -m32 embed.c `llvm-config --libs core bitwriter jit mcjit x86codegen` ...
Comment 2 Jonathan Shore 2012-09-06 12:41:54 UTC
I was including the LLVM libraries in addition to libmono-2.0.a, but may be a link problem.  Can close this and I will do a thorough analysis before posting as a bug again.  Perhaps will be best to construct a simple test case.
Comment 3 Rodrigo Kumpera 2014-07-30 08:48:14 UTC
closing as per last comment.