llvm-6502/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
2003-01-09-SARTest.ll
2003-01-10-FUCOM.ll
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
2003-06-04-bzip2-bug.ll
2003-06-05-PHIBug.ll
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
2008-06-05-APInt-OverAShr.ll
2010-01-15-UndefValue.ll
fma3-jit.ll
fpbitcast.ll
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
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
test-branch.ll
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
test-common-symbols.ll Reinstate "Nuke the old JIT." 2014-09-02 22:28:02 +00:00
test-constantexpr.ll
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
test-interp-vec-arithm_int.ll
test-interp-vec-cast.ll
test-interp-vec-insertelement.ll
test-interp-vec-insertextractvalue.ll
test-interp-vec-loadstore.ll
test-interp-vec-logical.ll
test-interp-vec-select.ll
test-interp-vec-setcond-fp.ll
test-interp-vec-setcond-int.ll
test-interp-vec-shift.ll
test-interp-vec-shuffle.ll
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
test-loop.ll
test-phi.ll
test-ret.ll
test-return.ll
test-setcond-fp.ll
test-setcond-int.ll
test-shift.ll