segfault with HowToUseJIT

Hi!

I've started looking porting our application which uses LLVM JIT to using LLVM 9 (9.0.1).

To begin, I tried running the HowToUseJIT.cpp (example directory) program and it fails with a segfault:

./HowToUseJIT
We just constructed this LLVM module:

; ModuleID = 'test'
source_filename = "test"

Running foo: Segmentation fault (core dumped)

Running it through GDB:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000404912 in main () at HowToUseJIT.cc:131
131 GenericValue gv = EE->runFunction(FooF, noargs);
(gdb) bt
#0 0x0000000000404912 in main () at HowToUseJIT.cc:131

It seems it fails when the JIT-compiled function gets called.

I freshly downloaded LLVM 9.0.1 and build it with the backend "X86". The machine I am running this on is a 'Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz'

Any ideas?

Frank

+Lang, Veteran of the JIT Wars (/owner of LLVM JIT infrastructure) - might have some ideas here.

Hi Frank,
Actually, IR generated in the code is incomplete. IR module must contain two function definitions but when printing the IRModule you get only
;ModuleID = ‘test’

source_filename = “test”