1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

Windows/DynamicLibrary.inc: Split explicit symbols into explicit_symbols.inc.

config.h.* have conditions whether each symbol is defined or not.
Autoconf and CMake may check symbols in libgcc.a for JIT on Mingw.

llvm-svn: 124950
This commit is contained in:
NAKAMURA Takumi 2011-02-05 15:11:53 +00:00
parent 07a84f5950
commit aa8b506820
7 changed files with 1583 additions and 58 deletions

View File

@ -1397,6 +1397,28 @@ AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp writev])
AC_C_PRINTF_A AC_C_PRINTF_A
AC_FUNC_RAND48 AC_FUNC_RAND48
dnl Check symbols in libgcc.a for JIT on Mingw.
if test "$llvm_cv_os_type" = "MingW" ; then
AC_CHECK_LIB(gcc,_alloca,AC_DEFINE([HAVE__ALLOCA],[1],[Have host's _alloca]))
AC_CHECK_LIB(gcc,__alloca,AC_DEFINE([HAVE___ALLOCA],[1],[Have host's __alloca]))
AC_CHECK_LIB(gcc,__chkstk,AC_DEFINE([HAVE___CHKSTK],[1],[Have host's __chkstk]))
AC_CHECK_LIB(gcc,___chkstk,AC_DEFINE([HAVE____CHKSTK],[1],[Have host's ___chkstk]))
AC_CHECK_LIB(gcc,__ashldi3,AC_DEFINE([HAVE___ASHLDI3],[1],[Have host's __ashldi3]))
AC_CHECK_LIB(gcc,__ashrdi3,AC_DEFINE([HAVE___ASHRDI3],[1],[Have host's __ashrdi3]))
AC_CHECK_LIB(gcc,__divdi3,AC_DEFINE([HAVE___DIVDI3],[1],[Have host's __divdi3]))
AC_CHECK_LIB(gcc,__fixdfdi,AC_DEFINE([HAVE___FIXDFDI],[1],[Have host's __fixdfdi]))
AC_CHECK_LIB(gcc,__fixsfdi,AC_DEFINE([HAVE___FIXSFDI],[1],[Have host's __fixsfdi]))
AC_CHECK_LIB(gcc,__floatdidf,AC_DEFINE([HAVE___FLOATDIDF],[1],[Have host's __floatdidf]))
AC_CHECK_LIB(gcc,__lshrdi3,AC_DEFINE([HAVE___LSHRDI3],[1],[Have host's __lshrdi3]))
AC_CHECK_LIB(gcc,__moddi3,AC_DEFINE([HAVE___MODDI3],[1],[Have host's __moddi3]))
AC_CHECK_LIB(gcc,__udivdi3,AC_DEFINE([HAVE___UDIVDI3],[1],[Have host's __udivdi3]))
AC_CHECK_LIB(gcc,__umoddi3,AC_DEFINE([HAVE___UMODDI3],[1],[Have host's __umoddi3]))
AC_CHECK_LIB(gcc,__main,AC_DEFINE([HAVE___MAIN],[1],[Have host's __main]))
AC_CHECK_LIB(gcc,__cmpdi2,AC_DEFINE([HAVE___CMPDI2],[1],[Have host's __cmpdi2]))
fi
dnl Check for variations in the Standard C++ library and STL. These macros are dnl Check for variations in the Standard C++ library and STL. These macros are
dnl provided by LLVM in the autoconf/m4 directory. dnl provided by LLVM in the autoconf/m4 directory.
AC_FUNC_ISNAN AC_FUNC_ISNAN

View File

@ -155,6 +155,25 @@ check_symbol_exists(memmove string.h HAVE_MEMMOVE)
check_symbol_exists(setenv stdlib.h HAVE_SETENV) check_symbol_exists(setenv stdlib.h HAVE_SETENV)
if( PURE_WINDOWS ) if( PURE_WINDOWS )
check_symbol_exists(_chsize_s io.h HAVE__CHSIZE_S) check_symbol_exists(_chsize_s io.h HAVE__CHSIZE_S)
check_function_exists(_alloca HAVE__ALLOCA)
check_function_exists(__alloca HAVE___ALLOCA)
check_function_exists(__chkstk HAVE___CHKSTK)
check_function_exists(___chkstk HAVE____CHKSTK)
check_function_exists(__ashldi3 HAVE___ASHLDI3)
check_function_exists(__ashrdi3 HAVE___ASHRDI3)
check_function_exists(__divdi3 HAVE___DIVDI3)
check_function_exists(__fixdfdi HAVE___FIXDFDI)
check_function_exists(__fixsfdi HAVE___FIXSFDI)
check_function_exists(__floatdidf HAVE___FLOATDIDF)
check_function_exists(__lshrdi3 HAVE___LSHRDI3)
check_function_exists(__moddi3 HAVE___MODDI3)
check_function_exists(__udivdi3 HAVE___UDIVDI3)
check_function_exists(__umoddi3 HAVE___UMODDI3)
check_function_exists(__main HAVE___MAIN)
check_function_exists(__cmpdi2 HAVE___CMPDI2)
endif() endif()
if( HAVE_ARGZ_H ) if( HAVE_ARGZ_H )
check_symbol_exists(argz_append argz.h HAVE_ARGZ_APPEND) check_symbol_exists(argz_append argz.h HAVE_ARGZ_APPEND)

1365
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -454,9 +454,57 @@
/* Define if the xdot.py program is available */ /* Define if the xdot.py program is available */
#undef HAVE_XDOT_PY #undef HAVE_XDOT_PY
/* Have host's _alloca */
#cmakedefine HAVE__ALLOCA ${HAVE__ALLOCA}
/* Have host's __alloca */
#cmakedefine HAVE___ALLOCA ${HAVE___ALLOCA}
/* Have host's __ashldi3 */
#cmakedefine HAVE___ASHLDI3 ${HAVE___ASHLDI3}
/* Have host's __ashrdi3 */
#cmakedefine HAVE___ASHRDI3 ${HAVE___ASHRDI3}
/* Have host's __chkstk */
#cmakedefine HAVE___CHKSTK ${HAVE___CHKSTK}
/* Have host's __cmpdi2 */
#cmakedefine HAVE___CMPDI2 ${HAVE___CMPDI2}
/* Have host's __divdi3 */
#cmakedefine HAVE___DIVDI3 ${HAVE___DIVDI3}
/* Define to 1 if you have the `__dso_handle' function. */ /* Define to 1 if you have the `__dso_handle' function. */
#undef HAVE___DSO_HANDLE #undef HAVE___DSO_HANDLE
/* Have host's __fixdfdi */
#cmakedefine HAVE___FIXDFDI ${HAVE___FIXDFDI}
/* Have host's __fixsfdi */
#cmakedefine HAVE___FIXSFDI ${HAVE___FIXSFDI}
/* Have host's __floatdidf */
#cmakedefine HAVE___FLOATDIDF ${HAVE___FLOATDIDF}
/* Have host's __lshrdi3 */
#cmakedefine HAVE___LSHRDI3 ${HAVE___LSHRDI3}
/* Have host's __main */
#cmakedefine HAVE___MAIN ${HAVE___MAIN}
/* Have host's __moddi3 */
#cmakedefine HAVE___MODDI3 ${HAVE___MODDI3}
/* Have host's __udivdi3 */
#cmakedefine HAVE___UDIVDI3 ${HAVE___UDIVDI3}
/* Have host's __umoddi3 */
#cmakedefine HAVE___UMODDI3 ${HAVE___UMODDI3}
/* Have host's ___chkstk */
#cmakedefine HAVE____CHKSTK ${HAVE____CHKSTK}
/* Linker version detected at compile time. */ /* Linker version detected at compile time. */
#undef HOST_LINK_VERSION #undef HOST_LINK_VERSION

View File

@ -476,9 +476,57 @@
/* Define if the xdot.py program is available */ /* Define if the xdot.py program is available */
#undef HAVE_XDOT_PY #undef HAVE_XDOT_PY
/* Have host's _alloca */
#undef HAVE__ALLOCA
/* Have host's __alloca */
#undef HAVE___ALLOCA
/* Have host's __ashldi3 */
#undef HAVE___ASHLDI3
/* Have host's __ashrdi3 */
#undef HAVE___ASHRDI3
/* Have host's __chkstk */
#undef HAVE___CHKSTK
/* Have host's __cmpdi2 */
#undef HAVE___CMPDI2
/* Have host's __divdi3 */
#undef HAVE___DIVDI3
/* Define to 1 if you have the `__dso_handle' function. */ /* Define to 1 if you have the `__dso_handle' function. */
#undef HAVE___DSO_HANDLE #undef HAVE___DSO_HANDLE
/* Have host's __fixdfdi */
#undef HAVE___FIXDFDI
/* Have host's __fixsfdi */
#undef HAVE___FIXSFDI
/* Have host's __floatdidf */
#undef HAVE___FLOATDIDF
/* Have host's __lshrdi3 */
#undef HAVE___LSHRDI3
/* Have host's __main */
#undef HAVE___MAIN
/* Have host's __moddi3 */
#undef HAVE___MODDI3
/* Have host's __udivdi3 */
#undef HAVE___UDIVDI3
/* Have host's __umoddi3 */
#undef HAVE___UMODDI3
/* Have host's ___chkstk */
#undef HAVE____CHKSTK
/* Linker version detected at compile time. */ /* Linker version detected at compile time. */
#undef HOST_LINK_VERSION #undef HOST_LINK_VERSION

View File

@ -110,35 +110,14 @@ bool DynamicLibrary::LoadLibraryPermanently(const char *filename,
// Stack probing routines are in the support library (e.g. libgcc), but we don't // Stack probing routines are in the support library (e.g. libgcc), but we don't
// have dynamic linking on windows. Provide a hook. // have dynamic linking on windows. Provide a hook.
#if defined(__MINGW32__) || defined (_MSC_VER) #define EXPLICIT_SYMBOL(SYM) \
#define EXPLICIT_SYMBOL(SYM) \ extern "C" { extern void *SYM; }
if (!strcmp(symbolName, #SYM)) return (void*)&SYM #define EXPLICIT_SYMBOL2(SYMFROM, SYMTO) EXPLICIT_SYMBOL(SYMTO)
#define EXPLICIT_SYMBOL2(SYMFROM, SYMTO) \
if (!strcmp(symbolName, #SYMFROM)) return (void*)&SYMTO
#define EXPLICIT_SYMBOL_DEF(SYM) \
extern "C" { extern void *SYM; }
#if defined(__MINGW32__) #include "explicit_symbols.inc"
EXPLICIT_SYMBOL_DEF(_alloca)
EXPLICIT_SYMBOL_DEF(__main) #undef EXPLICIT_SYMBOL
EXPLICIT_SYMBOL_DEF(__ashldi3) #undef EXPLICIT_SYMBOL2
EXPLICIT_SYMBOL_DEF(__ashrdi3)
EXPLICIT_SYMBOL_DEF(__cmpdi2)
EXPLICIT_SYMBOL_DEF(__divdi3)
EXPLICIT_SYMBOL_DEF(__fixdfdi)
EXPLICIT_SYMBOL_DEF(__fixsfdi)
EXPLICIT_SYMBOL_DEF(__fixunsdfdi)
EXPLICIT_SYMBOL_DEF(__fixunssfdi)
EXPLICIT_SYMBOL_DEF(__floatdidf)
EXPLICIT_SYMBOL_DEF(__floatdisf)
EXPLICIT_SYMBOL_DEF(__lshrdi3)
EXPLICIT_SYMBOL_DEF(__moddi3)
EXPLICIT_SYMBOL_DEF(__udivdi3)
EXPLICIT_SYMBOL_DEF(__umoddi3)
#elif defined(_MSC_VER)
EXPLICIT_SYMBOL_DEF(_alloca_probe)
#endif
#endif
void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) { void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) {
// First check symbols added via AddSymbol(). // First check symbols added via AddSymbol().
@ -159,39 +138,17 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) {
} }
} }
#if defined(__MINGW32__) #define EXPLICIT_SYMBOL(SYM) \
{ if (!strcmp(symbolName, #SYM)) return (void*)&SYM;
EXPLICIT_SYMBOL(_alloca); #define EXPLICIT_SYMBOL2(SYMFROM, SYMTO) \
EXPLICIT_SYMBOL(__main); if (!strcmp(symbolName, #SYMFROM)) return (void*)&SYMTO;
EXPLICIT_SYMBOL(__ashldi3);
EXPLICIT_SYMBOL(__ashrdi3);
EXPLICIT_SYMBOL(__cmpdi2);
EXPLICIT_SYMBOL(__divdi3);
EXPLICIT_SYMBOL(__fixdfdi);
EXPLICIT_SYMBOL(__fixsfdi);
EXPLICIT_SYMBOL(__fixunsdfdi);
EXPLICIT_SYMBOL(__fixunssfdi);
EXPLICIT_SYMBOL(__floatdidf);
EXPLICIT_SYMBOL(__floatdisf);
EXPLICIT_SYMBOL(__lshrdi3);
EXPLICIT_SYMBOL(__moddi3);
EXPLICIT_SYMBOL(__udivdi3);
EXPLICIT_SYMBOL(__umoddi3);
EXPLICIT_SYMBOL2(alloca, _alloca);
#undef EXPLICIT_SYMBOL
#undef EXPLICIT_SYMBOL2
#undef EXPLICIT_SYMBOL_DEF
}
#elif defined(_MSC_VER)
{ {
EXPLICIT_SYMBOL2(alloca, _alloca_probe); #include "explicit_symbols.inc"
EXPLICIT_SYMBOL2(_alloca, _alloca_probe);
#undef EXPLICIT_SYMBOL
#undef EXPLICIT_SYMBOL2
#undef EXPLICIT_SYMBOL_DEF
} }
#endif
#undef EXPLICIT_SYMBOL
#undef EXPLICIT_SYMBOL2
return 0; return 0;
} }

View File

@ -0,0 +1,66 @@
/* in libgcc.a */
#ifdef HAVE__ALLOCA
EXPLICIT_SYMBOL(_alloca)
EXPLICIT_SYMBOL2(alloca, _alloca);
#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)
EXPLICIT_SYMBOL2(alloca, _alloca_probe);
#endif