mirror of
https://github.com/RPCS3/llvm.git
synced 2024-11-27 13:40:43 +00:00
Windows/DynamicLibrary.inc: Clean up ELM_Callback. We may check the decl instead of the versions of individual libraries.
autoconf: Add checking ELM_Callback decl for mingw32 and mingw-w64. cmake/config-ix.cmake: Add checking ELM_Callback decl for win32. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130657 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9bc1537488
commit
6073a05240
@ -1429,6 +1429,24 @@ if test "$llvm_cv_os_type" = "MingW" ; then
|
||||
AC_CHECK_LIB(gcc,__cmpdi2,AC_DEFINE([HAVE___CMPDI2],[1],[Have host's __cmpdi2]))
|
||||
fi
|
||||
|
||||
dnl Check Win32 API EnumerateLoadedModules.
|
||||
if test "$llvm_cv_os_type" = "MingW" ; then
|
||||
AC_MSG_CHECKING([whether EnumerateLoadedModules() accepts new decl])
|
||||
AC_COMPILE_IFELSE([[#include <windows.h>
|
||||
#include <imagehlp.h>
|
||||
extern void foo(PENUMLOADED_MODULES_CALLBACK);
|
||||
extern void foo(BOOL(CALLBACK*)(PCSTR,ULONG_PTR,ULONG,PVOID));]],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
llvm_cv_win32_elmcb_pcstr="PCSTR"
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([no])
|
||||
llvm_cv_win32_elmcb_pcstr="PSTR"
|
||||
])
|
||||
AC_DEFINE_UNQUOTED([WIN32_ELMCB_PCSTR],$llvm_cv_win32_elmcb_pcstr,[Type of 1st arg on ELM Callback])
|
||||
fi
|
||||
|
||||
dnl Check for variations in the Standard C++ library and STL. These macros are
|
||||
dnl provided by LLVM in the autoconf/m4 directory.
|
||||
AC_FUNC_ISNAN
|
||||
|
@ -366,6 +366,21 @@ else( MSVC )
|
||||
set(LTDL_DLOPEN_DEPLIBS 0) # TODO
|
||||
endif( MSVC )
|
||||
|
||||
if( PURE_WINDOWS )
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <windows.h>
|
||||
#include <imagehlp.h>
|
||||
extern \"C\" void foo(PENUMLOADED_MODULES_CALLBACK);
|
||||
extern \"C\" void foo(BOOL(CALLBACK*)(PCSTR,ULONG_PTR,ULONG,PVOID));
|
||||
int main(){return 0;}"
|
||||
HAVE_ELMCB_PCSTR)
|
||||
if( HAVE_ELMCB_PCSTR )
|
||||
set(WIN32_ELMCB_PCSTR "PCSTR")
|
||||
else()
|
||||
set(WIN32_ELMCB_PCSTR "PSTR")
|
||||
endif()
|
||||
endif( PURE_WINDOWS )
|
||||
|
||||
# FIXME: Signal handler return type, currently hardcoded to 'void'
|
||||
set(RETSIGTYPE void)
|
||||
|
||||
|
67
configure
vendored
67
configure
vendored
@ -20660,6 +20660,73 @@ fi
|
||||
|
||||
fi
|
||||
|
||||
if test "$llvm_cv_os_type" = "MingW" ; then
|
||||
{ echo "$as_me:$LINENO: checking whether EnumerateLoadedModules() accepts new decl" >&5
|
||||
echo $ECHO_N "checking whether EnumerateLoadedModules() accepts new decl... $ECHO_C" >&6; }
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#include <windows.h>
|
||||
#include <imagehlp.h>
|
||||
extern void foo(PENUMLOADED_MODULES_CALLBACK);
|
||||
extern void foo(BOOL(CALLBACK*)(PCSTR,ULONG_PTR,ULONG,PVOID));
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
|
||||
{ (case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_try") 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_try") 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
|
||||
{ echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6; }
|
||||
llvm_cv_win32_elmcb_pcstr="PCSTR"
|
||||
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
|
||||
{ echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6; }
|
||||
llvm_cv_win32_elmcb_pcstr="PSTR"
|
||||
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define WIN32_ELMCB_PCSTR $llvm_cv_win32_elmcb_pcstr
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
|
||||
{ echo "$as_me:$LINENO: checking for isnan in <math.h>" >&5
|
||||
echo $ECHO_N "checking for isnan in <math.h>... $ECHO_C" >&6; }
|
||||
|
@ -196,6 +196,9 @@
|
||||
/* Define to 1 if you have the `udis86' library (-ludis86). */
|
||||
#undef HAVE_LIBUDIS86
|
||||
|
||||
/* Type of 1st arg on ELM Callback */
|
||||
#cmakedefine WIN32_ELMCB_PCSTR ${WIN32_ELMCB_PCSTR}
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#cmakedefine HAVE_LIMITS_H ${HAVE_LIMITS_H}
|
||||
|
||||
|
@ -675,6 +675,9 @@
|
||||
/* Define if use udis86 library */
|
||||
#undef USE_UDIS86
|
||||
|
||||
/* Type of 1st arg on ELM Callback */
|
||||
#undef WIN32_ELMCB_PCSTR
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
|
@ -41,41 +41,12 @@ using namespace sys;
|
||||
|
||||
static std::vector<HMODULE> OpenedHandles;
|
||||
|
||||
#ifdef _WIN64
|
||||
typedef DWORD64 ModuleBaseType;
|
||||
#else
|
||||
typedef ULONG ModuleBaseType;
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
// Use old callback if:
|
||||
// - Not using Visual Studio
|
||||
// - Visual Studio 2005 or earlier but only if we are not using the Windows SDK
|
||||
// or Windows SDK version is older than 6.0
|
||||
// Use new callback if:
|
||||
// - Newer Visual Studio (comes with newer SDK).
|
||||
// - Visual Studio 2005 with Windows SDK 6.0+
|
||||
#if defined(_MSC_VER)
|
||||
#if _MSC_VER < 1500 && (!defined(VER_PRODUCTBUILD) || VER_PRODUCTBUILD < 6000)
|
||||
#define OLD_ELM_CALLBACK_DECL 1
|
||||
#endif
|
||||
#elif defined(__MINGW64__)
|
||||
// Use new callback.
|
||||
#elif defined(__MINGW32__)
|
||||
#define OLD_ELM_CALLBACK_DECL 1
|
||||
#endif
|
||||
|
||||
#ifdef OLD_ELM_CALLBACK_DECL
|
||||
static BOOL CALLBACK ELM_Callback(PSTR ModuleName,
|
||||
ModuleBaseType ModuleBase,
|
||||
static BOOL CALLBACK ELM_Callback(WIN32_ELMCB_PCSTR ModuleName,
|
||||
ULONG_PTR ModuleBase,
|
||||
ULONG ModuleSize,
|
||||
PVOID UserContext)
|
||||
#else
|
||||
static BOOL CALLBACK ELM_Callback(PCSTR ModuleName,
|
||||
ModuleBaseType ModuleBase,
|
||||
ULONG ModuleSize,
|
||||
PVOID UserContext)
|
||||
#endif
|
||||
{
|
||||
// Ignore VC++ runtimes prior to 7.1. Somehow some of them get loaded
|
||||
// into the process.
|
||||
|
Loading…
Reference in New Issue
Block a user