vrclient: Fix building on macos

This commit is contained in:
Andrew Eikum 2018-06-07 10:09:17 -05:00
parent 7afb1d5a4a
commit 97cb5639d7
2 changed files with 11 additions and 19 deletions

View File

@ -21,23 +21,22 @@
#ifdef __APPLE__ #ifdef __APPLE__
# define __ASM_NAME(name) "_" name # define __ASM_NAME(name) "_" name
#else # define FORCE_ALIGN
# define __ASM_NAME(name) name
#endif
#ifdef __i386__ /* thiscall functions are i386-specific */
#ifdef __APPLE__
# 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"); # 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 #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"); # 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 #endif
#define __ASM_GLOBAL_FUNC(name,code) __ASM_DEFINE_FUNC(name,"",code) #define __ASM_GLOBAL_FUNC(name,code) __ASM_DEFINE_FUNC(name,"",code)
#define __ASM_STDCALL(args) "" #define __ASM_STDCALL(args) ""
#ifdef __i386__ /* thiscall functions are i386-specific */
#define THISCALL(func) __thiscall_ ## func #define THISCALL(func) __thiscall_ ## func
#define THISCALL_NAME(func) __ASM_NAME("__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) \ #define DEFINE_THISCALL_WRAPPER(func,args) \
extern void THISCALL(func)(void); \ extern void THISCALL(func)(void); \
__ASM_GLOBAL_FUNC(__thiscall_ ## func, \ __ASM_GLOBAL_FUNC(__thiscall_ ## func, \
@ -49,7 +48,7 @@
#define THISCALL(func) func #define THISCALL(func) func
#define THISCALL_NAME(func) __ASM_NAME(#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 */ #define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
#endif /* __i386__ */ #endif /* __i386__ */

View File

@ -23,6 +23,7 @@
#include "wined3d-interop.h" #include "wined3d-interop.h"
#include "cxx.h"
#include "flatapi.h" #include "flatapi.h"
#include "cppIVRClientCore_IVRClientCore_003.h" #include "cppIVRClientCore_IVRClientCore_003.h"
@ -912,21 +913,13 @@ void destroy_compositor_data(struct compositor_data *data)
/* call_flat_method() definition */ /* call_flat_method() definition */
#ifdef __i386__ #ifdef __i386__
asm(".text\n\t" __ASM_GLOBAL_FUNC(call_flat_method,
".align 4\n\t"
".globl call_flat_method\n\t"
".type call_flat_method, @function\n"
"call_flat_method:\n\t"
"popl %eax\n\t" "popl %eax\n\t"
"pushl %ecx\n\t" "pushl %ecx\n\t"
"pushl %eax\n\t" "pushl %eax\n\t"
"jmp *%edx"); "jmp *%edx");
#else #else
asm(".text\n\t" __ASM_GLOBAL_FUNC(call_flat_method,
".align 4\n\t"
".globl call_flat_method\n\t"
".type call_flat_method, @function\n"
"call_flat_method:\n\t"
"popq %rax\n\t" // return address "popq %rax\n\t" // return address
"pushq %r9\n\t" "pushq %r9\n\t"
"pushq %rax\n\t" "pushq %rax\n\t"