llvm-6502/lib
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
..
Analysis Revert r219432 - "Revert "[BasicAA] Revert "Revert r218714 - Make better use of zext and sign information.""" 2014-11-13 09:16:54 +00:00
AsmParser X86: Implement the vectorcall calling convention 2014-10-28 01:29:26 +00:00
Bitcode Silence MSVC warning on missing return after fully covered switch 2014-11-13 23:07:22 +00:00
CodeGen Use nullptr instead of NULL for variadic sentinels 2014-11-13 22:55:19 +00:00
DebugInfo Revert "[dwarfdump] Add support for dumping accelerator tables." 2014-11-13 00:15:15 +00:00
ExecutionEngine Changing a StringRef::begin() call into StringRef::data(); NFC. 2014-11-12 19:43:13 +00:00
IR Use nullptr instead of NULL for variadic sentinels 2014-11-13 22:55:19 +00:00
IRReader Remove unused variable. NFC. 2014-11-06 23:16:57 +00:00
LineEditor
Linker Revert "IR: MDNode => Value" 2014-11-11 21:30:22 +00:00
LTO libLTO: Assert if LTOCodeGenerator and LTOModule are from different contexts 2014-11-11 23:13:10 +00:00
MC Fix a regression on the disassembling C API. 2014-11-13 16:52:07 +00:00
Object Un-break the big-endian buildbots 2014-11-13 20:07:06 +00:00
Option Add an overload of getLastArgNoClaim taking two OptSpecifiers. 2014-09-12 19:42:53 +00:00
ProfileData Use ErrorOr for the ::create factory on instrumented and sample profilers. 2014-11-03 00:51:45 +00:00
Support Fix symbol resolution of floating point libc builtins in MCJIT 2014-11-13 23:32:52 +00:00
TableGen Eliminate some deep std::vector copies. NFC. 2014-10-03 18:33:16 +00:00
Target R600/SI: Fix fmin_legacy / fmax_legacy matching for SI 2014-11-13 23:03:09 +00:00
Transforms Use nullptr instead of NULL for variadic sentinels 2014-11-13 22:55:19 +00:00
CMakeLists.txt
LLVMBuild.txt
Makefile