[LLVMdev] MCJIT problem on native 'ppc64' target

Frank Winter fwinter at jlab.org
Mon Mar 10 11:23:04 PDT 2014


I am having an issue with MCJIT on the ppc64 machine architecture.
The symptom is that for a particular IR function the target machine
won't emit neither an object nor an assembly file and subsequent
calling the pointer to function results in a segfault.

My application generates on the fly several functions with the builder
and executes them with the MCJIT engine. I came across this particular
function when the segfault happened.

To investigate this I went down the static linking path and compiled the
barfing function with llc targeting ppc64 and linked it statically. This
works fine. Thus, the issue seems to be MCJIT related.

To further rule out user error I isolated an exploit for this issue and
reran it on the x86-64 architecture. That works fine too. Thus, it seems
to be 'ppc64' related.

I attach the exploit including it's Makefile. It builds 'main' and 
'main_static'.
The former goes the JIT path, the latter the static link path. The offending
function is 'func_fails.ll'. When 'main' is called with this IR function 
as its
argument it'll reproduce the segfault on the ppc64 architecture. The
main_static links statically to 'func_fails.ll' and calls the function 
in exactly
the same way as 'main' does. The statically linked version works fine.

The program 'func_works.ll' can be used a cross check that MCJIT on
the ppc64 architecture works and that the program 'main' is in general
well functioning. To confirm the 'main' executable can be invoked with
the argument 'func_works.ll'.

The issue seems to have to do with the number of calls to external
functions or whether a particular external function is called repeatedly.
I am saying this because when replacing all external calls with trivial
additions (fadd double ..), then the offending function works fine too.

Any suggestion how to hunt down the issue are very much welcome.

Thanks,
Frank




-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug_mcjit_ppc64.tgz
Type: application/x-compressed-tar
Size: 3560 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140310/17d9c786/attachment.bin>


More information about the llvm-dev mailing list