fix 32-bit build under MSVC 10

Esse commit está contido em:
Timothy Wall
2013-05-27 07:56:05 -04:00
commit 8638bb57f9
6 arquivos alterados com 24 adições e 13 exclusões
+11 -3
Ver Arquivo
@@ -163,7 +163,13 @@ endif
ifeq ($(OS),win32)
ARCH=$(shell uname -m | sed 's/i.86/i386/g')
CDEFINES=-DHAVE_PROTECTION -DPSAPI_VERSION=1 -DFFI_BUILDING
ifeq ($(CC),$(MINGW))
LIBS=-lpsapi
else
ARSFX=.lib
COPT=
LIBS=psapi.lib
endif
WINDRES=windres
EXTRAOBJS=$(RSRC)
STRIP=@echo
@@ -172,6 +178,11 @@ LIBSFX=.dll
TESTLIB_TRUNC=$(BUILD)/testlib-truncated.dll
ifneq ($(ARCH),amd64)
CC=$(FFI_SRC)/../cc.sh -m32
CPP=$(FFI_SRC)/../cc.sh -m32 -E
LD=$(FFI_SRC)/../ld.sh -m32
FFI_CONFIG+= && rm -f include/ffitarget.h && cp $(FFI_SRC)/include/*.h $(FFI_SRC)/src/x86/ffitarget.h include
FFI_ENV+=LD="$(LD)" CPP="$(CPP)"
ifeq ($(CC),gcc)
# -mno-cygwin is only available on GCC 3; GCC 4 requires an explicit mingw
# installation
@@ -209,9 +220,6 @@ else
CC=$(FFI_SRC)/../cc.sh -m64
CPP=$(FFI_SRC)/../cc.sh -m64 -E
LD=$(FFI_SRC)/../ld.sh -m64
COPT=
LIBS=psapi.lib
ARSFX=.lib
FFI_CONFIG+=--host=x86_64-w64-mingw32 && rm -f include/ffitarget.h && cp $(FFI_SRC)/include/*.h $(FFI_SRC)/src/x86/ffitarget.h include
FFI_ENV+=LD="$(LD)" CPP="$(CPP)"
EXTRAOBJS+=$(DLLCB)
+3 -4
Ver Arquivo
@@ -49,10 +49,9 @@ extern "C" {
#endif
#else /* _WIN64 */
#ifdef _MSC_VER
// FIXME is "PROC NEAR" correct?
#define ASMFN(X) extern void asmfn ## X(); \
__asm asmfn ## X PROC NEAR \
__asm jmp fn[X]
#define ASMFN(X) void __declspec(naked) asmfn ## X() { \
__asm jmp fn[X] \
}
#else
#define ASMFN(X) extern void asmfn ## X (); asm(".globl _asmfn" #X "\n\
_asmfn" #X ":\n\
+2 -2
Ver Arquivo
@@ -36,7 +36,7 @@ do
shift 1
;;
-m32)
if echo $PATH | grep amd64 >& /dev/null; then
if type cl | grep amd64 >& /dev/null; then
echo "Wrong CL.EXE in path; use 32-bit version"
exit 1
fi
@@ -48,7 +48,7 @@ do
shift 1
;;
-m64)
if ! echo $PATH | grep amd64 >& /dev/null; then
if ! type cl | grep amd64 >& /dev/null; then
echo "Wrong CL.EXE in path; use 64-bit version"
exit 1
fi
+1 -2
Ver Arquivo
@@ -168,8 +168,7 @@ w32_find_entry(JNIEnv* env, HANDLE handle, const char* funname) {
}
return func;
}
#endif
#endif /* _WIN32 */
#define MEMCPY(D,S,L) do { \
PSTART(); memcpy(D,S,L); PEND(); \
+5
Ver Arquivo
@@ -134,8 +134,13 @@ typedef struct _callback {
#endif
#if defined(_MSC_VER)
#if defined(_WIN64)
#define L2A(X) ((void *)(X))
#define A2L(X) ((jlong)(X))
#else
#define L2A(X) ((void *)(unsigned long)(X))
#define A2L(X) ((jlong)(unsigned long)(X))
#endif
#define snprintf sprintf_s
#define strdup _strdup
#else
+2 -2
Ver Arquivo
@@ -15,7 +15,7 @@ do
case $1
in
-m32)
if echo $PATH | grep amd64; then
if type link | grep amd64; then
echo "Wrong LINK.EXE in path; use 32-bit version"
exit 1
fi
@@ -26,7 +26,7 @@ do
shift 1
;;
-m64)
if ! echo $PATH | grep amd64; then
if ! type link | grep amd64; then
echo "Wrong LINK.EXE in path; use 64-bit version"
exit 1
fi