2011-02-05 23:11:53 +08:00
|
|
|
/* in libgcc.a */
|
|
|
|
|
|
|
|
#ifdef HAVE__ALLOCA
|
|
|
|
EXPLICIT_SYMBOL(_alloca)
|
2011-07-09 16:41:20 +08:00
|
|
|
EXPLICIT_SYMBOL2(alloca, _alloca)
|
2011-02-05 23:11:53 +08:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE___ALLOCA
|
|
|
|
EXPLICIT_SYMBOL(__alloca)
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE___CHKSTK
|
|
|
|
EXPLICIT_SYMBOL(__chkstk)
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE____CHKSTK
|
|
|
|
EXPLICIT_SYMBOL(___chkstk)
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE___MAIN
|
|
|
|
EXPLICIT_SYMBOL(__main) // FIXME: Don't call it.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE___ASHLDI3
|
|
|
|
EXPLICIT_SYMBOL(__ashldi3)
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE___ASHRDI3
|
|
|
|
EXPLICIT_SYMBOL(__ashrdi3)
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE___CMPDI2 // FIXME: unused
|
|
|
|
EXPLICIT_SYMBOL(__cmpdi2)
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE___DIVDI3
|
|
|
|
EXPLICIT_SYMBOL(__divdi3)
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE___FIXDFDI
|
|
|
|
EXPLICIT_SYMBOL(__fixdfdi)
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE___FIXSFDI
|
|
|
|
EXPLICIT_SYMBOL(__fixsfdi)
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE___FIXUNSDFDI
|
|
|
|
EXPLICIT_SYMBOL(__fixunsdfdi)
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE___FIXUNSSFDI
|
|
|
|
EXPLICIT_SYMBOL(__fixunssfdi)
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE___FLOATDIDF
|
|
|
|
EXPLICIT_SYMBOL(__floatdidf)
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE___FLOATDISF
|
|
|
|
EXPLICIT_SYMBOL(__floatdisf)
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE___LSHRDI3
|
|
|
|
EXPLICIT_SYMBOL(__lshrdi3)
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE___MODDI3
|
|
|
|
EXPLICIT_SYMBOL(__moddi3)
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE___UDIVDI3
|
|
|
|
EXPLICIT_SYMBOL(__udivdi3)
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE___UMODDI3
|
|
|
|
EXPLICIT_SYMBOL(__umoddi3)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* msvcrt */
|
|
|
|
#if defined(_MSC_VER)
|
2011-07-09 16:41:20 +08:00
|
|
|
EXPLICIT_SYMBOL2(alloca, _alloca_probe)
|
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!
llvm-svn: 221947
2014-11-14 07:32:52 +08:00
|
|
|
|
|
|
|
#ifdef _M_IX86
|
|
|
|
#define INLINE_DEF_FLOAT_SYMBOL(SYM, ARGC) INLINE_DEF_SYMBOL##ARGC(float, SYM)
|
|
|
|
INLINE_DEF_FLOAT_SYMBOL(acosf, 1)
|
|
|
|
INLINE_DEF_FLOAT_SYMBOL(asinf, 1)
|
|
|
|
INLINE_DEF_FLOAT_SYMBOL(atanf, 1)
|
|
|
|
INLINE_DEF_FLOAT_SYMBOL(atan2f, 2)
|
|
|
|
INLINE_DEF_FLOAT_SYMBOL(ceilf, 1)
|
|
|
|
INLINE_DEF_FLOAT_SYMBOL(cosf, 1)
|
|
|
|
INLINE_DEF_FLOAT_SYMBOL(coshf, 1)
|
|
|
|
INLINE_DEF_FLOAT_SYMBOL(expf, 1)
|
|
|
|
INLINE_DEF_FLOAT_SYMBOL(floorf, 1)
|
|
|
|
INLINE_DEF_FLOAT_SYMBOL(fmodf, 2)
|
|
|
|
INLINE_DEF_FLOAT_SYMBOL(logf, 1)
|
|
|
|
INLINE_DEF_FLOAT_SYMBOL(powf, 2)
|
|
|
|
INLINE_DEF_FLOAT_SYMBOL(sinf, 1)
|
|
|
|
INLINE_DEF_FLOAT_SYMBOL(sinhf, 1)
|
|
|
|
INLINE_DEF_FLOAT_SYMBOL(sqrtf, 1)
|
|
|
|
INLINE_DEF_FLOAT_SYMBOL(tanf, 1)
|
|
|
|
INLINE_DEF_FLOAT_SYMBOL(tanhf, 1)
|
2014-11-14 07:45:50 +08:00
|
|
|
|
|
|
|
// These were added in VS 2013.
|
2014-11-14 12:53:55 +08:00
|
|
|
#if (1800 <= _MSC_VER && _MSC_VER < 1900)
|
2014-11-14 07:45:50 +08:00
|
|
|
INLINE_DEF_FLOAT_SYMBOL(copysignf, 2)
|
|
|
|
INLINE_DEF_FLOAT_SYMBOL(fminf, 2)
|
|
|
|
INLINE_DEF_FLOAT_SYMBOL(fmaxf, 2)
|
|
|
|
#endif
|
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!
llvm-svn: 221947
2014-11-14 07:32:52 +08:00
|
|
|
#undef INLINE_DEF_FLOAT_SYMBOL
|
|
|
|
#endif
|
|
|
|
|
2011-02-05 23:11:53 +08:00
|
|
|
#endif
|