refs #140. Fixed zdot incompatibility ABI issue with GCC 4.7 on Win 32.

GCC 4.7 uses MSVC ABI on Win 32. This means the caller pops the hidden pointer for returning
aggregate structures larger than 8 bytes.
This commit is contained in:
Zhang Xianyi 2012-09-24 20:34:33 +08:00
parent 1d72b8bf1b
commit 2573311308
2 changed files with 31 additions and 1 deletions

View File

@ -149,6 +149,26 @@ EXTRALIB += -defaultlib:advapi32
SUFFIX = obj SUFFIX = obj
PSUFFIX = pobj PSUFFIX = pobj
LIBSUFFIX = lib LIBSUFFIX = lib
ifeq ($(C_COMPILER), GCC)
#Test for supporting MS_ABI
GCCVERSIONGTEQ4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 4)
GCCVERSIONGT4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 4)
GCCMINORVERSIONGTEQ7 := $(shell expr `$(CC) -dumpversion | cut -f2 -d.` \>= 7)
ifeq ($(GCCVERSIONGT4), 1)
# GCC Majar version > 4
# It is compatible with MSVC ABI.
CCOMMON_OPT += -DMS_ABI
endif
ifeq ($(GCCVERSIONGTEQ4), 1)
ifeq ($(GCCMINORVERSIONGTEQ7), 1)
# GCC Version >=4.7
# It is compatible with MSVC ABI.
CCOMMON_OPT += -DMS_ABI
endif
endif
endif
endif endif
ifeq ($(OSNAME), Interix) ifeq ($(OSNAME), Interix)

View File

@ -1541,6 +1541,16 @@
popl %ebx popl %ebx
popl %esi popl %esi
popl %edi popl %edi
/*remove the hidden return value address from the stack.*/ #if defined(OS_WINNT) || defined(OS_CYGWIN_NT) || defined(OS_INTERIX)
#ifdef MS_ABI
/* For MingW GCC >= 4.7. It is compatible with MSVC ABI. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36834 */
ret
#else
/* remove the hidden return value address from the stack. For MingW GCC < 4.7 */
ret $0x4 ret $0x4
#endif
#else
/*remove the hidden return value address from the stack on Linux.*/
ret $0x4
#endif
EPILOGUE EPILOGUE