Hi!
This patch makes it possible to build an run wine with the Intel compiler.
Here are the environment variables I used to build:
export CC="icc" export CFLAGS="-O3 -xP -msse3 -parallel" export CXX="icc" export CXXFLAGS="-O3 -xP -msse3 -parallel" export LDFLAGS="-lguide -lsvml -lstdc++ -parallel" export MAKEFLAGS="-j 2"
(Not all are needed, just quoting from my .profile)
And here's the patch:
diff -Nru wine-0.9.35/dlls/kernel32/sync.c wine-0.9.35-icc/dlls/kernel32/sync.c --- wine-0.9.35/dlls/kernel32/sync.c 2007-04-13 17:47:52.000000000 +0200 +++ wine-0.9.35-icc/dlls/kernel32/sync.c 2007-04-21 17:20:13.000000000 +0200 @@ -1885,12 +1885,14 @@ * InterlockedCompareExchange (KERNEL32.@) */ /* LONG WINAPI InterlockedCompareExchange( PLONG dest, LONG xchg, LONG compare ); */ +#ifndef __INTEL_COMPILER __ASM_GLOBAL_FUNC(InterlockedCompareExchange, "movl 12(%esp),%eax\n\t" "movl 8(%esp),%ecx\n\t" "movl 4(%esp),%edx\n\t" "lock; cmpxchgl %ecx,(%edx)\n\t" "ret $12") +#endif
/*********************************************************************** * InterlockedExchange (KERNEL32.@) diff -Nru wine-0.9.35/dlls/kernel32/thread.c wine-0.9.35-icc/dlls/kernel32/thread.c --- wine-0.9.35/dlls/kernel32/thread.c 2007-04-13 17:47:52.000000000 +0200 +++ wine-0.9.35-icc/dlls/kernel32/thread.c 2007-04-21 17:21:25.000000000 +0200 @@ -554,11 +554,13 @@ * SetLastError (KERNEL32.@) */ /* void WINAPI SetLastError( DWORD error ); */ +#ifndef __INTEL_COMPILER __ASM_GLOBAL_FUNC( SetLastError, "movl 4(%esp),%eax\n\t" ".byte 0x64\n\t" "movl %eax,0x34\n\t" "ret $4" ) +#endif
/*********************************************************************** * GetLastError (KERNEL.148) diff -Nru wine-0.9.35/dlls/ntdll/thread.c wine-0.9.35-icc/dlls/ntdll/thread.c --- wine-0.9.35/dlls/ntdll/thread.c 2007-04-13 17:47:52.000000000 +0200 +++ wine-0.9.35-icc/dlls/ntdll/thread.c 2007-04-21 17:19:41.000000000 +0200 @@ -1429,7 +1429,9 @@ */ #if defined(__i386__) && defined(__GNUC__)
+#ifndef __INTEL_COMPILER __ASM_GLOBAL_FUNC( NtCurrentTeb, ".byte 0x64\n\tmovl 0x18,%eax\n\tret" ) +#endif
#elif defined(__i386__) && defined(_MSC_VER)
diff -Nru wine-0.9.35/libs/wine/ldt.c wine-0.9.35-icc/libs/wine/ldt.c --- wine-0.9.35/libs/wine/ldt.c 2007-04-13 17:47:52.000000000 +0200 +++ wine-0.9.35-icc/libs/wine/ldt.c 2007-04-21 17:19:41.000000000 +0200 @@ -480,10 +480,14 @@ __ASM_GLOBAL_FUNC( wine_get_cs, "movw %cs,%ax\n\tret" ) __ASM_GLOBAL_FUNC( wine_get_ds, "movw %ds,%ax\n\tret" ) __ASM_GLOBAL_FUNC( wine_get_es, "movw %es,%ax\n\tret" ) +#ifndef __INTEL_COMPILER __ASM_GLOBAL_FUNC( wine_get_fs, "movw %fs,%ax\n\tret" ) +#endif __ASM_GLOBAL_FUNC( wine_get_gs, "movw %gs,%ax\n\tret" ) __ASM_GLOBAL_FUNC( wine_get_ss, "movw %ss,%ax\n\tret" ) +#ifndef __INTEL_COMPILER __ASM_GLOBAL_FUNC( wine_set_fs, "movl 4(%esp),%eax\n\tmovw %ax,%fs\n\tret" ) +#endif __ASM_GLOBAL_FUNC( wine_set_gs, "movl 4(%esp),%eax\n\tmovw %ax,%gs\n\tret" ) # endif /* defined(_MSC_VER) */
diff -Nru wine-0.9.35/programs/winefile/winefile.c wine-0.9.35-icc/programs/winefile/winefile.c --- wine-0.9.35/programs/winefile/winefile.c 2007-04-13 17:47:52.000000000 +0200 +++ wine-0.9.35-icc/programs/winefile/winefile.c 2007-04-21 17:19:41.000000000 +0200 @@ -283,7 +283,11 @@
if (!pvswprintf) { HMODULE hModMsvcrt = LoadLibraryA("msvcrt"); +#ifdef __INTEL_COMPILER + pvswprintf = GetProcAddress(hModMsvcrt, "vswprintf"); +#else pvswprintf = (int(__cdecl*)(WCHAR*,const WCHAR*,va_list)) GetProcAddress(hModMsvcrt, "vswprintf"); +#endif }
va_start(ap, fmt);
I #ifdef'd the asm code out since for some strange reason, it was already defined when using ICC.
Could you please test it and commit it if it works?
Jonathan Schleifer schreef:
Hi!
This patch makes it possible to build an run wine with the Intel compiler.
Here are the environment variables I used to build:
export CFLAGS="-O3 -xP -msse3 -parallel" export CXX="icc" export CXXFLAGS="-O3 -xP -msse3 -parallel" export LDFLAGS="-lguide -lsvml -lstdc++ -parallel" export MAKEFLAGS="-j 2"
Wine could build fine without c++, not sure why everything has to link against the c++ library as it will probably only be needed in winegcc. Also these compiling flags seem kind of agressive.
I #ifdef'd the asm code out since for some strange reason, it was already defined when using ICC.
Could you please test it and commit it if it works?
They are defined in include/winbase.h - just make sure icc is recognised there. you can't just comment out those Interlocked functions, some applications might need them. Plus the way you do it makes the code unreadable. I cannot test this as I don't have icc.
Maarten