From 97cb5639d78d893edae4a7aa730ea529eb128ff2 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Thu, 7 Jun 2018 10:09:17 -0500 Subject: vrclient: Fix building on macos --- vrclient_x64/cxx.h | 17 ++++++++--------- vrclient_x64/vrclient_main.c | 13 +++---------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/vrclient_x64/cxx.h b/vrclient_x64/cxx.h index 5ee17132..322cdec4 100644 --- a/vrclient_x64/cxx.h +++ b/vrclient_x64/cxx.h @@ -21,23 +21,22 @@ #ifdef __APPLE__ # define __ASM_NAME(name) "_" name -#else -# define __ASM_NAME(name) name -#endif - -#ifdef __i386__ /* thiscall functions are i386-specific */ - -#ifdef __APPLE__ +# define FORCE_ALIGN # define __ASM_DEFINE_FUNC(name,suffix,code) asm(".text\n\t.align 4\n\t.globl _" #name suffix "\n\t\n_" #name suffix ":\n\t.cfi_startproc\n\t" code "\n\t.cfi_endproc\n\t.previous"); #else +# define __ASM_NAME(name) name +# define FORCE_ALIGN __attribute__((__force_align_arg_pointer__)) # define __ASM_DEFINE_FUNC(name,suffix,code) asm(".text\n\t.align 4\n\t.globl " #name suffix "\n\t.type " #name suffix ",@function\n" #name suffix ":\n\t.cfi_startproc\n\t" code "\n\t.cfi_endproc\n\t.previous"); #endif + #define __ASM_GLOBAL_FUNC(name,code) __ASM_DEFINE_FUNC(name,"",code) #define __ASM_STDCALL(args) "" +#ifdef __i386__ /* thiscall functions are i386-specific */ + #define THISCALL(func) __thiscall_ ## func #define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func) -#define __thiscall __stdcall __attribute__((__force_align_arg_pointer__)) +#define __thiscall __stdcall FORCE_ALIGN #define DEFINE_THISCALL_WRAPPER(func,args) \ extern void THISCALL(func)(void); \ __ASM_GLOBAL_FUNC(__thiscall_ ## func, \ @@ -49,7 +48,7 @@ #define THISCALL(func) func #define THISCALL_NAME(func) __ASM_NAME(#func) -#define __thiscall __cdecl __attribute__((__force_align_arg_pointer__)) +#define __thiscall __cdecl FORCE_ALIGN #define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */ #endif /* __i386__ */ diff --git a/vrclient_x64/vrclient_main.c b/vrclient_x64/vrclient_main.c index 3bc25258..afa50fb4 100644 --- a/vrclient_x64/vrclient_main.c +++ b/vrclient_x64/vrclient_main.c @@ -23,6 +23,7 @@ #include "wined3d-interop.h" +#include "cxx.h" #include "flatapi.h" #include "cppIVRClientCore_IVRClientCore_003.h" @@ -912,21 +913,13 @@ void destroy_compositor_data(struct compositor_data *data) /* call_flat_method() definition */ #ifdef __i386__ -asm(".text\n\t" - ".align 4\n\t" - ".globl call_flat_method\n\t" - ".type call_flat_method, @function\n" - "call_flat_method:\n\t" +__ASM_GLOBAL_FUNC(call_flat_method, "popl %eax\n\t" "pushl %ecx\n\t" "pushl %eax\n\t" "jmp *%edx"); #else -asm(".text\n\t" - ".align 4\n\t" - ".globl call_flat_method\n\t" - ".type call_flat_method, @function\n" - "call_flat_method:\n\t" +__ASM_GLOBAL_FUNC(call_flat_method, "popq %rax\n\t" // return address "pushq %r9\n\t" "pushq %rax\n\t" -- cgit v1.2.3