llvm/test/ExecutionEngine
Reid Kleckner 016f651f8d Fix symbol resolution of floating point libc builtins in MCJIT
Fix for LLI failure on Windows\X86: http://llvm.org/PR5053

LLI.exe crashes on Windows\X86 when single precession floating point
intrinsics like the following are used: acos, asin, atan, atan2, ceil,
copysign, cos, cosh, exp, floor, fmin, fmax, fmod, log, pow, sin, sinh,
sqrt, tan, tanh

The above intrinsics are defined as inline-expansions in math.h, and are
not exported by msvcr120.dll (Win32 API GetProcAddress returns null).

For an FREM instruction, the JIT compiler generates a call to a stub for
the fmodf() intrinsic, and adds a relocation to fixup at load time. The
loader searches the libraries for the function, but fails because the
symbol is not exported. So, the call target remains NULL and the
execution crashes.

Since the math functions are loaded at JIT/runtime, the JIT can patch
CALL instruction directly instead of the searching the libraries'
exported symbols.  However, this fix caused build failures due to
unresolved symbols like _fmodf at link time.

Therefore, the current fix defines helper functions in the Runtime
link/load library to perform the above operations.  The address of these
helper functions are used to patch up the CALL instruction at load time.

Reviewers: lhames, rnk

Reviewed By: rnk

Differential Revision: http://reviews.llvm.org/D5387

Patch by Swaroop Sridhar!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221947 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-13 23:32:52 +00:00
..
Interpreter [PATCH][Interpreter] Add missing FP intrinsic lowering. 2014-08-30 18:33:35 +00:00
MCJIT Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
RuntimeDyld [MCJIT] Defer application of AArch64 MachO GOT relocations until resolve time. 2014-10-21 23:41:15 +00:00
2002-12-16-ArgTest.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
2003-01-04-ArgumentBug.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
2003-01-04-LoopTest.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
2003-01-04-PhiTest.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
2003-01-09-SARTest.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
2003-01-10-FUCOM.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
2003-01-15-AlignmentTest.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
2003-05-06-LivenessClobber.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
2003-05-07-ArgumentTest.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
2003-05-11-PHIRegAllocBug.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
2003-06-04-bzip2-bug.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
2003-06-05-PHIBug.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
2003-08-15-AllocaAssertion.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
2003-08-21-EnvironmentTest.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
2003-08-23-RegisterAllocatePhysReg.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
2005-12-02-TailCallBug.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
2007-12-10-APIntLoadStore.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
2008-06-05-APInt-OverAShr.ll Rewrite test/ExecutionEngine tests to use FileCheck instead of grep 2013-04-08 19:51:36 +00:00
2010-01-15-UndefValue.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
fma3-jit.ll In LLVM FMA3 operands are dst, src1, src2, src3, however dst is not encoded as it is always src1. This was causing the encoding of the operands to be off by one. 2013-08-21 05:03:10 +00:00
fpbitcast.ll Rewrite test/ExecutionEngine tests to use FileCheck instead of grep 2013-04-08 19:51:36 +00:00
frem.ll Fix symbol resolution of floating point libc builtins in MCJIT 2014-11-13 23:32:52 +00:00
hello2.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
hello.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
lit.local.cfg mark the old jit tests as unsupported for powerpc64 (for cmake) 2014-06-17 17:04:42 +00:00
mov64zext32.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
simplesttest.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
simpletest.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
stubs.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
test-arith.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
test-branch.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
test-call-no-external-funcs.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
test-call.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
test-cast.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
test-common-symbols.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
test-constantexpr.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
test-fp-no-external-funcs.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
test-fp.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
test-global-init-nonzero.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
test-global.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
test-interp-vec-arithm_float.ll Teach the interpreter to handle vector compares and additional vector arithmetic operations. 2013-04-26 20:19:41 +00:00
test-interp-vec-arithm_int.ll Teach the interpreter to handle vector compares and additional vector arithmetic operations. 2013-04-26 20:19:41 +00:00
test-interp-vec-cast.ll LLVM Interpreter: This patch implements vector support for cast operations (zext, sext, uitofp, sitofp, trunc, fpext, fptosi, fptrunc, bitcast) and shift operations (shl, ashr, lshr) for integer and floating point data types. 2013-08-05 12:17:06 +00:00
test-interp-vec-insertelement.ll llvm interpreter: select, shuffle and insertelement instructions. 2013-09-02 06:40:09 +00:00
test-interp-vec-insertextractvalue.ll LLVM interpreter: added a test for insert- extract- value 2013-09-12 10:52:03 +00:00
test-interp-vec-loadstore.ll LLVM Interpreter: MIPS tests should pass 2013-08-07 06:13:21 +00:00
test-interp-vec-logical.ll Teach the interpreter to handle vector compares and additional vector arithmetic operations. 2013-04-26 20:19:41 +00:00
test-interp-vec-select.ll llvm interpreter: select, shuffle and insertelement instructions. 2013-09-02 06:40:09 +00:00
test-interp-vec-setcond-fp.ll Teach the interpreter to handle vector compares and additional vector arithmetic operations. 2013-04-26 20:19:41 +00:00
test-interp-vec-setcond-int.ll Teach the interpreter to handle vector compares and additional vector arithmetic operations. 2013-04-26 20:19:41 +00:00
test-interp-vec-shift.ll LLVM Interpreter: This patch implements vector support for cast operations (zext, sext, uitofp, sitofp, trunc, fpext, fptosi, fptrunc, bitcast) and shift operations (shl, ashr, lshr) for integer and floating point data types. 2013-08-05 12:17:06 +00:00
test-interp-vec-shuffle.ll llvm interpreter: select, shuffle and insertelement instructions. 2013-09-02 06:40:09 +00:00
test-loadstore.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
test-local.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
test-logical.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
test-loop.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
test-phi.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
test-ret.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
test-return.ll Remove "XFAIL: arm" from test/ExecutionEngine/test-return.ll 2012-01-17 18:21:05 +00:00
test-setcond-fp.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
test-setcond-int.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
test-shift.ll Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00