diff --git a/configure b/configure index 44a1608fb90..b15803cc3ff 100755 --- a/configure +++ b/configure @@ -17271,215 +17271,6 @@ then fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether external symbols need an underscore prefix" >&5 -$as_echo_n "checking whether external symbols need an underscore prefix... " >&6; } -if ${ac_cv_c_extern_prefix+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -extern int ac_test; -int -main () -{ -asm(".globl _ac_test\n_ac_test:\t.long 0"); if (ac_test) return 1 - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_c_extern_prefix="yes" -else - ac_cv_c_extern_prefix="no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_extern_prefix" >&5 -$as_echo "$ac_cv_c_extern_prefix" >&6; } - -case $host_cpu in - *i[3456789]86*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether external symbols need stdcall decoration" >&5 -$as_echo_n "checking whether external symbols need stdcall decoration... " >&6; } -if ${ac_cv_c_stdcall_suffix+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef _MSC_VER -#define __stdcall __attribute__((__stdcall__)) -#endif -int __stdcall ac_test(int i) { return i; } -int -main () -{ -asm("jmp _ac_test@4"); if (ac_test(1)) return 1 - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_c_stdcall_suffix="yes" -else - ac_cv_c_stdcall_suffix="no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stdcall_suffix" >&5 -$as_echo "$ac_cv_c_stdcall_suffix" >&6; } ;; - *) ac_cv_c_stdcall_suffix="no" ;; -esac - - -if test "$ac_cv_c_extern_prefix" = "yes" -then - $as_echo "#define __ASM_NAME(name) \"_\" name" >>confdefs.h - - asm_name_prefix="_" -else - $as_echo "#define __ASM_NAME(name) name" >>confdefs.h - - asm_name_prefix="" -fi - - -if test "$ac_cv_c_stdcall_suffix" = "yes" -then - $as_echo "#define __ASM_STDCALL(args) \"@\" #args" >>confdefs.h - -else - $as_echo "#define __ASM_STDCALL(args) \"\"" >>confdefs.h - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to define a function in assembly code" >&5 -$as_echo_n "checking how to define a function in assembly code... " >&6; } -if ${ac_cv_asm_func_def+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -asm("\t.globl _ac_test\n\t.def _ac_test; .scl 2; .type 32; .endef\n_ac_test:\t.long 0"); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_asm_func_def=".def" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -asm("\t.globl _ac_test\n\t.type _ac_test,@function\n_ac_test:\t.long 0"); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_asm_func_def=".type @function" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -asm("\t.globl _ac_test\n\t.type _ac_test,2\n_ac_test:\t.long 0"); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_asm_func_def=".type 2" -else - ac_cv_asm_func_def="unknown" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_asm_func_def" >&5 -$as_echo "$ac_cv_asm_func_def" >&6; } - -case "$ac_cv_asm_func_def" in - ".def") - asm_func_header=".def $asm_name_prefix\" #name suffix \"; .scl 2; .type 32; .endef" ;; - ".type @function") - asm_func_header=".type $asm_name_prefix\" #name suffix \",@function" ;; - ".type 2") - asm_func_header=".type $asm_name_prefix\" #name suffix \",2" ;; - *) - asm_func_header="" ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether asm() works outside of functions" >&5 -$as_echo_n "checking whether asm() works outside of functions... " >&6; } -if ${ac_cv_c_asm_outside_funcs+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -asm(".text\n\t.long 0"); -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_asm_outside_funcs="yes" -else - ac_cv_c_asm_outside_funcs="no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_asm_outside_funcs" >&5 -$as_echo "$ac_cv_c_asm_outside_funcs" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether .previous is supported in assembly code" >&5 -$as_echo_n "checking whether .previous is supported in assembly code... " >&6; } -if ${ac_cv_c_dot_previous+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -asm(".text\nac_test:\t.long 0\n\t.previous"); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_c_dot_previous="yes" -else - ac_cv_c_dot_previous="no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_dot_previous" >&5 -$as_echo "$ac_cv_c_dot_previous" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether CFI directives are supported in assembly code" >&5 $as_echo_n "checking whether CFI directives are supported in assembly code... " >&6; } if ${ac_cv_c_cfi_support+:} false; then : @@ -17505,52 +17296,16 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_cfi_support" >&5 $as_echo "$ac_cv_c_cfi_support" >&6; } - -asm_func_header=".globl $asm_name_prefix\" #name suffix \"\\n\\t$asm_func_header\\n$asm_name_prefix\" #name suffix \":\\n\\t" -asm_func_trailer="" -if test "$ac_cv_c_dot_previous" = "yes" -then - asm_func_trailer="\\n\\t.previous" -fi if test "$ac_cv_c_cfi_support" = "yes" then - asm_func_header="$asm_func_header.cfi_startproc\\n\\t" - asm_func_trailer="\\n\\t.cfi_endproc$asm_func_trailer" - -$as_echo "#define __ASM_CFI(str) str" >>confdefs.h - LDDLLFLAGS="$LDDLLFLAGS -fasynchronous-unwind-tables" else - $as_echo "#define __ASM_CFI(str) \"\"" >>confdefs.h - if test "x$enable_win64" = "xyes" then as_fn_append wine_warnings "|building 64-bit Wine without support for CFI directives; exception handling will not work properly." fi fi -asm_func_code="$asm_func_header\" code \"$asm_func_trailer" - - -if test "$ac_cv_c_asm_outside_funcs" = "yes" -then - cat >>confdefs.h <<_ACEOF -#define __ASM_DEFINE_FUNC(name,suffix,code) asm(".text\n\t.align 4\n\t$asm_func_code"); -_ACEOF - -else - cat >>confdefs.h <<_ACEOF -#define __ASM_DEFINE_FUNC(name,suffix,code) void __asm_dummy_##name(void) { asm(".text\n\t.align 4\n\t$asm_func_code"); } -_ACEOF - -fi - -$as_echo "#define __ASM_GLOBAL_FUNC(name,code) __ASM_DEFINE_FUNC(name,\"\",code)" >>confdefs.h - - -$as_echo "#define __ASM_STDCALL_FUNC(name,args,code) __ASM_DEFINE_FUNC(name,__ASM_STDCALL(args),code)" >>confdefs.h - - case $build_os in cygwin*|mingw32*) TOOLSEXT=".exe" diff --git a/configure.ac b/configure.ac index ae8e85b3560..9dd300d0bde 100644 --- a/configure.ac +++ b/configure.ac @@ -2046,114 +2046,21 @@ then CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0" fi -dnl **** Check for underscore on external symbols **** - -AC_CACHE_CHECK([whether external symbols need an underscore prefix], ac_cv_c_extern_prefix, - WINE_TRY_ASM_LINK([".globl _ac_test\n_ac_test:\t.long 0"], - [extern int ac_test;], - [if (ac_test) return 1], - ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no")) - -case $host_cpu in - *i[[3456789]]86*) - AC_CACHE_CHECK([whether external symbols need stdcall decoration], ac_cv_c_stdcall_suffix, - WINE_TRY_ASM_LINK(["jmp _ac_test@4"], -[#ifndef _MSC_VER -#define __stdcall __attribute__((__stdcall__)) -#endif -int __stdcall ac_test(int i) { return i; }], - [if (ac_test(1)) return 1], - ac_cv_c_stdcall_suffix="yes",ac_cv_c_stdcall_suffix="no")) ;; - *) ac_cv_c_stdcall_suffix="no" ;; -esac - -AH_TEMPLATE(__ASM_NAME,[Define to a macro to generate an assembly name from a C symbol]) -if test "$ac_cv_c_extern_prefix" = "yes" -then - AC_DEFINE([__ASM_NAME(name)], ["_" name]) - asm_name_prefix="_" -else - AC_DEFINE([__ASM_NAME(name)], [name]) - asm_name_prefix="" -fi - -AH_TEMPLATE(__ASM_STDCALL,[Define to a macro to generate an stdcall suffix]) -if test "$ac_cv_c_stdcall_suffix" = "yes" -then - AC_DEFINE([__ASM_STDCALL(args)],["@" #args]) -else - AC_DEFINE([__ASM_STDCALL(args)],[""]) -fi - -dnl **** Check how to define a function in assembly code **** - -AC_CACHE_CHECK([how to define a function in assembly code], ac_cv_asm_func_def, - WINE_TRY_ASM_LINK( - ["\t.globl _ac_test\n\t.def _ac_test; .scl 2; .type 32; .endef\n_ac_test:\t.long 0"],,, - ac_cv_asm_func_def=".def", - [WINE_TRY_ASM_LINK(["\t.globl _ac_test\n\t.type _ac_test,@function\n_ac_test:\t.long 0"],,, - ac_cv_asm_func_def=".type @function", - [WINE_TRY_ASM_LINK(["\t.globl _ac_test\n\t.type _ac_test,2\n_ac_test:\t.long 0"],,, - ac_cv_asm_func_def=".type 2", - ac_cv_asm_func_def="unknown")])])) - -case "$ac_cv_asm_func_def" in - ".def") - asm_func_header=".def $asm_name_prefix\" #name suffix \"; .scl 2; .type 32; .endef" ;; - ".type @function") - asm_func_header=".type $asm_name_prefix\" #name suffix \",@function" ;; - ".type 2") - asm_func_header=".type $asm_name_prefix\" #name suffix \",2" ;; - *) - asm_func_header="" ;; -esac - -AC_CACHE_CHECK([whether asm() works outside of functions], ac_cv_c_asm_outside_funcs, - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[asm(".text\n\t.long 0");]],)], - ac_cv_c_asm_outside_funcs="yes",ac_cv_c_asm_outside_funcs="no")) - -AC_CACHE_CHECK([whether .previous is supported in assembly code], ac_cv_c_dot_previous, - WINE_TRY_ASM_LINK([".text\nac_test:\t.long 0\n\t.previous"],,, - ac_cv_c_dot_previous="yes",ac_cv_c_dot_previous="no")) +dnl **** Check for CFI directives support **** AC_CACHE_CHECK([whether CFI directives are supported in assembly code], ac_cv_c_cfi_support, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[asm(".text\nac_test:\t.cfi_startproc\n\t.long 0\n\t.cfi_endproc");]])], ac_cv_c_cfi_support="yes",ac_cv_c_cfi_support="no")) - -asm_func_header=".globl $asm_name_prefix\" #name suffix \"\\n\\t$asm_func_header\\n$asm_name_prefix\" #name suffix \":\\n\\t" -asm_func_trailer="" -if test "$ac_cv_c_dot_previous" = "yes" -then - asm_func_trailer="\\n\\t.previous" -fi if test "$ac_cv_c_cfi_support" = "yes" then - asm_func_header="$asm_func_header.cfi_startproc\\n\\t" - asm_func_trailer="\\n\\t.cfi_endproc$asm_func_trailer" - AC_DEFINE([__ASM_CFI(str)],[str],[Define to a macro to output a .cfi assembly pseudo-op]) LDDLLFLAGS="$LDDLLFLAGS -fasynchronous-unwind-tables" else - AC_DEFINE([__ASM_CFI(str)],[""]) if test "x$enable_win64" = "xyes" then WINE_WARNING([building 64-bit Wine without support for CFI directives; exception handling will not work properly.]) fi fi -asm_func_code="$asm_func_header\" code \"$asm_func_trailer" - -AH_TEMPLATE(__ASM_DEFINE_FUNC,[Define to a macro to define an assembly function]) -if test "$ac_cv_c_asm_outside_funcs" = "yes" -then - AC_DEFINE_UNQUOTED([__ASM_DEFINE_FUNC(name,suffix,code)],[asm(".text\n\t.align 4\n\t$asm_func_code");]) -else - AC_DEFINE_UNQUOTED([__ASM_DEFINE_FUNC(name,suffix,code)],[void __asm_dummy_##name(void) { asm(".text\n\t.align 4\n\t$asm_func_code"); }]) -fi -AC_DEFINE([__ASM_GLOBAL_FUNC(name,code)],[__ASM_DEFINE_FUNC(name,"",code)], - [Define to a macro to generate an assembly function with C calling convention]) -AC_DEFINE([__ASM_STDCALL_FUNC(name,args,code)],[__ASM_DEFINE_FUNC(name,__ASM_STDCALL(args),code)], - [Define to a macro to generate an assembly function with stdcall calling convention]) - dnl **** Platform-specific checks **** case $build_os in diff --git a/dlls/dbghelp/minidump.c b/dlls/dbghelp/minidump.c index 6a2525f8e1f..9922d080325 100644 --- a/dlls/dbghelp/minidump.c +++ b/dlls/dbghelp/minidump.c @@ -29,6 +29,7 @@ #include "dbghelp_private.h" #include "winternl.h" #include "psapi.h" +#include "wine/asm.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(dbghelp); diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 198c6a8f10a..acf2cf3d236 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -40,6 +40,7 @@ #include "wine/debug.h" #include "wine/unicode.h" +#include "wine/asm.h" #include "windef.h" #include "winbase.h" #include "winuser.h" diff --git a/dlls/hal/hal.c b/dlls/hal/hal.c index 269a551f177..11a559180e2 100644 --- a/dlls/hal/hal.c +++ b/dlls/hal/hal.c @@ -30,6 +30,7 @@ #include "winternl.h" #include "excpt.h" #include "ddk/ntddk.h" +#include "wine/asm.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(ntoskrnl); diff --git a/dlls/kernel32/debugger.c b/dlls/kernel32/debugger.c index 8e5af30b634..e2ee1fd64bb 100644 --- a/dlls/kernel32/debugger.c +++ b/dlls/kernel32/debugger.c @@ -27,6 +27,7 @@ #include "winerror.h" #include "wine/server.h" #include "kernel_private.h" +#include "wine/asm.h" #include "wine/debug.h" #include "wine/exception.h" diff --git a/dlls/kernel32/module.c b/dlls/kernel32/module.c index 2f078a00a10..1ea7b0e942a 100644 --- a/dlls/kernel32/module.c +++ b/dlls/kernel32/module.c @@ -41,6 +41,7 @@ #include "wine/exception.h" #include "wine/list.h" +#include "wine/asm.h" #include "wine/debug.h" #include "wine/unicode.h" diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index ccb743b28ee..b48aa669b2a 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -61,6 +61,7 @@ #include "wine/library.h" #include "wine/server.h" #include "wine/unicode.h" +#include "wine/asm.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(process); diff --git a/dlls/kernel32/sync.c b/dlls/kernel32/sync.c index 9f5b614508a..162979e3ab8 100644 --- a/dlls/kernel32/sync.c +++ b/dlls/kernel32/sync.c @@ -40,6 +40,7 @@ #include "winioctl.h" #include "ddk/wdm.h" +#include "wine/asm.h" #include "wine/library.h" #include "wine/unicode.h" #include "kernel_private.h" diff --git a/dlls/kernel32/thread.c b/dlls/kernel32/thread.c index d167abe24ae..51babc1cc5e 100644 --- a/dlls/kernel32/thread.c +++ b/dlls/kernel32/thread.c @@ -38,6 +38,7 @@ #include "wine/exception.h" #include "wine/library.h" #include "wine/server.h" +#include "wine/asm.h" #include "wine/debug.h" #include "kernel_private.h" diff --git a/dlls/krnl386.exe16/kernel16_private.h b/dlls/krnl386.exe16/kernel16_private.h index 1f8f730916d..59b7a35c972 100644 --- a/dlls/krnl386.exe16/kernel16_private.h +++ b/dlls/krnl386.exe16/kernel16_private.h @@ -24,6 +24,7 @@ #include "wine/winbase16.h" #include "winreg.h" #include "winternl.h" +#include "wine/asm.h" #include "pshpack1.h" diff --git a/dlls/mshtml/ifacewrap.c b/dlls/mshtml/ifacewrap.c index a8a892896d5..ce8f4ce1e14 100644 --- a/dlls/mshtml/ifacewrap.c +++ b/dlls/mshtml/ifacewrap.c @@ -27,6 +27,7 @@ #include "winuser.h" #include "ole2.h" +#include "wine/asm.h" #include "wine/debug.h" #include "mshtml_private.h" diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index 35e9bf0208f..702bc9b33bb 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -31,6 +31,7 @@ #include "shlobj.h" #include "shlwapi.h" +#include "wine/asm.h" #include "wine/debug.h" #include "mshtml_private.h" diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c index 647961cf87b..c43f5d7c1ea 100644 --- a/dlls/msi/custom.c +++ b/dlls/msi/custom.c @@ -35,6 +35,7 @@ #include "msipriv.h" #include "winemsi.h" +#include "wine/asm.h" #include "wine/heap.h" #include "wine/debug.h" #include "wine/unicode.h" diff --git a/dlls/msvcp90/cxx.h b/dlls/msvcp90/cxx.h index 05c8776813d..fd697564afd 100644 --- a/dlls/msvcp90/cxx.h +++ b/dlls/msvcp90/cxx.h @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "wine/asm.h" + /* Copied from dlls/msvcrt/cxx.h */ #undef __thiscall #ifdef __i386__ /* thiscall functions are i386-specific */ diff --git a/dlls/msvcrt/cppexcept.h b/dlls/msvcrt/cppexcept.h index 2091889066d..69fb3c5eed9 100644 --- a/dlls/msvcrt/cppexcept.h +++ b/dlls/msvcrt/cppexcept.h @@ -21,6 +21,8 @@ #ifndef __MSVCRT_CPPEXCEPT_H #define __MSVCRT_CPPEXCEPT_H +#include "wine/asm.h" + #define CXX_FRAME_MAGIC_VC6 0x19930520 #define CXX_FRAME_MAGIC_VC7 0x19930521 #define CXX_FRAME_MAGIC_VC8 0x19930522 diff --git a/dlls/msvcrt/cxx.h b/dlls/msvcrt/cxx.h index 3765dc81d33..75677e28736 100644 --- a/dlls/msvcrt/cxx.h +++ b/dlls/msvcrt/cxx.h @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "wine/asm.h" + #undef __thiscall #ifdef __i386__ /* thiscall functions are i386-specific */ diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index fdd664dcec1..049c3407321 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -30,6 +30,7 @@ #include "msvcrt.h" +#include "wine/asm.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); diff --git a/dlls/msvcrt/misc.c b/dlls/msvcrt/misc.c index 21ab9be9a8d..ae81fbf5cdb 100644 --- a/dlls/msvcrt/misc.c +++ b/dlls/msvcrt/misc.c @@ -27,6 +27,7 @@ #include "wine/debug.h" #include "ntsecapi.h" #include "windows.h" +#include "wine/asm.h" WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); diff --git a/dlls/ntdll/large_int.c b/dlls/ntdll/large_int.c index 5716416e03e..cc77d239f39 100644 --- a/dlls/ntdll/large_int.c +++ b/dlls/ntdll/large_int.c @@ -28,6 +28,7 @@ #define WIN32_NO_STATUS #include "windef.h" #include "winternl.h" +#include "wine/asm.h" #ifndef _WIN64 diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index 6a609123fb4..24c61a013e9 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -28,6 +28,7 @@ #include "winnt.h" #include "winternl.h" #include "wine/server.h" +#include "wine/asm.h" #define MAX_NT_PATH_LENGTH 277 diff --git a/dlls/ntdll/resource.c b/dlls/ntdll/resource.c index 0322a92bdc2..f649e200cba 100644 --- a/dlls/ntdll/resource.c +++ b/dlls/ntdll/resource.c @@ -40,6 +40,7 @@ #include "winbase.h" #include "winnt.h" #include "winternl.h" +#include "wine/asm.h" #include "wine/exception.h" #include "wine/unicode.h" #include "wine/debug.h" diff --git a/dlls/ntoskrnl.exe/ntoskrnl_private.h b/dlls/ntoskrnl.exe/ntoskrnl_private.h index c2ea91c6c31..65e27293972 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl_private.h +++ b/dlls/ntoskrnl.exe/ntoskrnl_private.h @@ -21,6 +21,8 @@ #ifndef __WINE_NTOSKRNL_PRIVATE_H #define __WINE_NTOSKRNL_PRIVATE_H +#include "wine/asm.h" + struct _OBJECT_TYPE { const WCHAR *name; /* object type name used for type validation */ diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c index 8ea103b3a67..a896bc699c7 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -31,6 +31,7 @@ #include "ddk/wdm.h" #include "ddk/ntifs.h" +#include "wine/asm.h" #include "wine/debug.h" #include "wine/heap.h" diff --git a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c index 221463bc05e..2379b3aa77a 100644 --- a/dlls/ole32/stg_prop.c +++ b/dlls/ole32/stg_prop.c @@ -53,6 +53,7 @@ #include "winnls.h" #include "winuser.h" #include "wine/unicode.h" +#include "wine/asm.h" #include "wine/debug.h" #include "dictionary.h" #include "storage32.h" diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 521f1a3b915..1a0bceb7ad2 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -73,6 +73,7 @@ #include "typelib.h" #include "wine/debug.h" #include "variant.h" +#include "wine/asm.h" #include "wine/heap.h" #include "wine/list.h" diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c index d709502a1ec..ab9450383d4 100644 --- a/dlls/riched20/txthost.c +++ b/dlls/riched20/txthost.c @@ -28,6 +28,7 @@ #include "richole.h" #include "imm.h" #include "textserv.h" +#include "wine/asm.h" #include "wine/debug.h" #include "editstr.h" diff --git a/dlls/riched20/txtsrv.c b/dlls/riched20/txtsrv.c index 37b866a7f85..a9ceef4dd1f 100644 --- a/dlls/riched20/txtsrv.c +++ b/dlls/riched20/txtsrv.c @@ -30,6 +30,7 @@ #include "tom.h" #include "imm.h" #include "textserv.h" +#include "wine/asm.h" #include "wine/debug.h" #include "editstr.h" diff --git a/dlls/rpcrt4/cproxy.c b/dlls/rpcrt4/cproxy.c index 56ef84d2738..ddbd58ce74b 100644 --- a/dlls/rpcrt4/cproxy.c +++ b/dlls/rpcrt4/cproxy.c @@ -36,6 +36,7 @@ #include "cpsf.h" #include "ndr_misc.h" #include "ndr_stubless.h" +#include "wine/asm.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); diff --git a/dlls/rpcrt4/ndr_stubless.c b/dlls/rpcrt4/ndr_stubless.c index 530bd9e5eb6..c912d93231d 100644 --- a/dlls/rpcrt4/ndr_stubless.c +++ b/dlls/rpcrt4/ndr_stubless.c @@ -39,6 +39,7 @@ #include "rpcproxy.h" #include "wine/exception.h" +#include "wine/asm.h" #include "wine/debug.h" #include "cpsf.h" diff --git a/dlls/user32/hook.c b/dlls/user32/hook.c index 3aa7b33a8cb..d3e78bb473d 100644 --- a/dlls/user32/hook.c +++ b/dlls/user32/hook.c @@ -77,6 +77,7 @@ #include "user_private.h" #include "wine/server.h" #include "wine/unicode.h" +#include "wine/asm.h" #include "wine/debug.h" #include "winternl.h" diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index f5dc47ca4f7..5bf82c66e00 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -43,6 +43,7 @@ #include "user_private.h" #include "wine/gdi_driver.h" #include "wine/unicode.h" +#include "wine/asm.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(system); diff --git a/dlls/user32/win.c b/dlls/user32/win.c index a29e3a1d9bb..3582262b7de 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -31,6 +31,7 @@ #include "winver.h" #include "wine/server.h" #include "wine/unicode.h" +#include "wine/asm.h" #include "win.h" #include "user_private.h" #include "controls.h" diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index f86fb4acda3..6de650cd1e5 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -33,6 +33,7 @@ #include "win.h" #include "user_private.h" #include "wine/unicode.h" +#include "wine/asm.h" #include "wine/debug.h" WINE_DECLARE_DEBUG_CHANNEL(msg); diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c index 3a9fd22aae6..05392e105ee 100644 --- a/dlls/vcomp/main.c +++ b/dlls/vcomp/main.c @@ -32,6 +32,7 @@ #include "winternl.h" #include "wine/debug.h" #include "wine/list.h" +#include "wine/asm.h" WINE_DEFAULT_DEBUG_CHANNEL(vcomp); diff --git a/dlls/vssapi/main.c b/dlls/vssapi/main.c index 7ac0adb5639..2ebd2041f89 100644 --- a/dlls/vssapi/main.c +++ b/dlls/vssapi/main.c @@ -23,6 +23,7 @@ #include "vss.h" #include "vswriter.h" #include "vsbackup.h" +#include "wine/asm.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL( vssapi ); diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c index 862e17fe623..6c56d0d70ae 100644 --- a/dlls/wbemprox/builtin.c +++ b/dlls/wbemprox/builtin.c @@ -62,6 +62,7 @@ #include "winspool.h" #include "setupapi.h" +#include "wine/asm.h" #include "wine/debug.h" #include "wbemprox_private.h" diff --git a/dlls/winecrt0/exception.c b/dlls/winecrt0/exception.c index 0e00f73a6fd..8a7f2a503b3 100644 --- a/dlls/winecrt0/exception.c +++ b/dlls/winecrt0/exception.c @@ -18,12 +18,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" #include #include "winternl.h" #include "wine/exception.h" +#include "wine/asm.h" -#if defined(__x86_64__) && defined(__ASM_GLOBAL_FUNC) +#ifdef __x86_64__ extern void __wine_unwind_trampoline(void); /* we need an extra call to make sure the stack is correctly aligned */ __ASM_GLOBAL_FUNC( __wine_unwind_trampoline, "callq *%rax" ); @@ -47,7 +47,7 @@ void __wine_rtl_unwind( EXCEPTION_REGISTRATION_RECORD* frame, EXCEPTION_RECORD * : "=a" (dummy1), "=S" (dummy2), "=D" (dummy3), "=c" (dummy4) : "0" (RtlUnwind), "1" (frame), "2" (target), "3" (record) : "edx", "memory" ); -#elif defined(__x86_64__) && defined(__ASM_GLOBAL_FUNC) +#elif defined(__x86_64__) RtlUnwind( frame, __wine_unwind_trampoline, record, target ); #else RtlUnwind( frame, target, record, 0 ); diff --git a/include/config.h.in b/include/config.h.in index 8add980f549..b172e0a6f10 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -1469,26 +1469,6 @@ /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES -/* Define to a macro to output a .cfi assembly pseudo-op */ -#undef __ASM_CFI - -/* Define to a macro to define an assembly function */ -#undef __ASM_DEFINE_FUNC - -/* Define to a macro to generate an assembly function with C calling - convention */ -#undef __ASM_GLOBAL_FUNC - -/* Define to a macro to generate an assembly name from a C symbol */ -#undef __ASM_NAME - -/* Define to a macro to generate an stdcall suffix */ -#undef __ASM_STDCALL - -/* Define to a macro to generate an assembly function with stdcall calling - convention */ -#undef __ASM_STDCALL_FUNC - /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus diff --git a/include/wine/asm.h b/include/wine/asm.h new file mode 100644 index 00000000000..bf97bc03f46 --- /dev/null +++ b/include/wine/asm.h @@ -0,0 +1,66 @@ +/* + * Inline assembly support + * + * Copyright 2019 Alexandre Julliard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WINE_WINE_ASM_H +#define __WINE_WINE_ASM_H + +#if defined(__APPLE__) || (defined(_WIN32) && defined(__i386__)) +# define __ASM_NAME(name) "_" name +#else +# define __ASM_NAME(name) name +#endif + +#if defined(_WIN32) && defined(__i386__) +# define __ASM_STDCALL(args) "@" #args +#else +# define __ASM_STDCALL(args) "" +#endif + +#ifdef __GCC_HAVE_DWARF2_CFI_ASM +# define __ASM_CFI(str) str +#else +# define __ASM_CFI(str) str +#endif + +#ifdef _WIN32 +# define __ASM_FUNC_TYPE(name) ".def " name "; .scl 2; .type 32; .endef" +#elif defined(__APPLE__) +# define __ASM_FUNC_TYPE(name) "" +#elif defined(__arm__) || defined(__arm64__) +# define __ASM_FUNC_TYPE(name) ".type " name ",%function" +#else +# define __ASM_FUNC_TYPE(name) ".type " name ",@function" +#endif + +#ifdef __GNUC__ +# define __ASM_DEFINE_FUNC(name,code) \ + asm(".text\n\t.align 4\n\t.globl " name "\n\t" __ASM_FUNC_TYPE(name) "\n" name ":\n\t" \ + __ASM_CFI(".cfi_startproc\n\t") code __ASM_CFI("\n\t.cfi_endproc") ); +#else +# define __ASM_DEFINE_FUNC(name,code) void __asm_dummy_##__LINE__(void) { \ + asm(".text\n\t.align 4\n\t.globl " name "\n\t" __ASM_FUNC_TYPE(name) "\n" name ":\n\t" \ + __ASM_CFI(".cfi_startproc\n\t") code __ASM_CFI("\n\t.cfi_endproc") ); } +#endif + +#define __ASM_GLOBAL_FUNC(name,code) __ASM_DEFINE_FUNC(__ASM_NAME(#name),code) + +#define __ASM_STDCALL_FUNC(name,args,code) __ASM_DEFINE_FUNC(__ASM_NAME(#name) __ASM_STDCALL(args),code) + +#endif /* __WINE_WINE_ASM_H */ diff --git a/libs/port/interlocked.c b/libs/port/interlocked.c index efdfd2af197..59b852f7e9f 100644 --- a/libs/port/interlocked.c +++ b/libs/port/interlocked.c @@ -18,9 +18,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" #include +#include "basetsd.h" +#include "wine/asm.h" #ifdef __i386__ diff --git a/libs/wine/ldt.c b/libs/wine/ldt.c index d3ff82135d2..baf12a2e3a7 100644 --- a/libs/wine/ldt.c +++ b/libs/wine/ldt.c @@ -32,6 +32,7 @@ #include "windef.h" #include "winbase.h" #include "wine/library.h" +#include "wine/asm.h" #ifdef __i386__ diff --git a/libs/wine/port.c b/libs/wine/port.c index e954e5ba8e5..990b7b7a743 100644 --- a/libs/wine/port.c +++ b/libs/wine/port.c @@ -28,6 +28,7 @@ #define WINE_UNICODE_INLINE /* nothing */ #include "wine/unicode.h" #include "wine/library.h" +#include "wine/asm.h" /* functions from libwine_port that are also exported from libwine for backwards compatibility, * on platforms that require it */ diff --git a/loader/preloader.c b/loader/preloader.c index 13a6ad86b20..bb16ecd96a4 100644 --- a/loader/preloader.c +++ b/loader/preloader.c @@ -93,6 +93,7 @@ # include #endif +#include "wine/asm.h" #include "main.h" /* ELF definitions */ diff --git a/loader/preloader_mac.c b/loader/preloader_mac.c index ff62d32ed6a..43dc6b2b7e6 100644 --- a/loader/preloader_mac.c +++ b/loader/preloader_mac.c @@ -51,6 +51,7 @@ #include #endif +#include "wine/asm.h" #include "main.h" #ifndef LC_MAIN diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index 0b544e50e28..ac43f149d52 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -75,6 +75,7 @@ #include #include #include +#include #include #include