[llvm-bugs] [Bug 41258] New: ORC JIT fails with standard math librrary

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 27 08:33:37 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41258

            Bug ID: 41258
           Summary: ORC JIT fails with standard math librrary
           Product: new-bugs
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: fwinter at jlab.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Created attachment 21686
  --> https://bugs.llvm.org/attachment.cgi?id=21686&action=edit
Exploit

Hi,

when transitioning our application (which uses the IR Builder and JIT) from
using LLVM release 6.0 to release 8.0 we noticed that some JIT'd function work
fine while others don't. They actually crashed the program (always with the
same error message, see below). I narrowed it down to whenever a JIT'd function
make calls to the standard math library it fails.

I provide a minimal exploit.

Description of the exploit:
The program uses the KaleidoscopeJIT.h that ships with LLVM 8 (except that I
had to expose the Datalayout). It reads from the filesystem an IR file
(filename "func_works.ll" or "func_cos_fails.ll) and asks the ORC JIT first for
the symbol "func_ir" and then for the address.

In case the file "func_works.ll" was read the program succeeds with:

symbol found!
address found!

In case the file "func_cos_fails.ll" was read the program fails with:

symbol found!
Failure value returned from cantFail wrapped call
UNREACHABLE executed at
install/llvm-8.0-x86-debug/include/llvm/Support/Error.h:732!
Stack dump:

The program needs to be rebuild for it to use the other input file since the
filename is a C literal.

This was tested on an x86 Linux Ubuntu system using a "debug" build of LLVM 8.0
configured with

cmake -G "Unix Makefiles" \
      -DBUILD_SHARED_LIBS="ON" \
      -DLLVM_ENABLE_RTTI="ON" \
      -DLLVM_ENABLE_ZLIB="OFF" \
      -DLLVM_ENABLE_TERMINFO="OFF" \
      -DCMAKE_BUILD_TYPE="Debug" \
      -DCMAKE_INSTALL_PREFIX=$CMAKE_INSTALL_PREFIX \
      -DLLVM_TARGETS_TO_BUILD="X86" \
      -DCMAKE_BUILD_TYPE="Debug" \
      $SRC

We are not doing something obviously wrong, do we?

This is a show stopper for us. We cannot use LLVM 8.0 in our production code.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190327/f25d649f/attachment.html>


More information about the llvm-bugs mailing list