From f0f4138f90345d7d67dfa6783a7e1c7cc30d3c6f Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Sat, 22 Mar 2014 10:00:53 -0700 Subject: [PATCH] win32.S: Add handling for position-independent code on Darwin Newer versions of Darwin generate the necessary stub functions automatically and just need a call instruction, but accomodating older versions as well requires adding the stub. --- src/x86/win32.S | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/x86/win32.S b/src/x86/win32.S index b455982c..826a5a0f 100644 --- a/src/x86/win32.S +++ b/src/x86/win32.S @@ -691,6 +691,8 @@ USCORE_SYMBOL(ffi_closure_SYSV): movl %edx, (%esp) /* &resp */ #if defined(HAVE_HIDDEN_VISIBILITY_ATTRIBUTE) || !defined(__PIC__) call USCORE_SYMBOL(ffi_closure_SYSV_inner) +#elif defined(X86_DARWIN) + calll L_ffi_closure_SYSV_inner$stub #else movl %ebx, 8(%esp) call 1f @@ -970,6 +972,8 @@ USCORE_SYMBOL(ffi_closure_STDCALL): movl %edx, (%esp) /* &resp */ #if defined(HAVE_HIDDEN_VISIBILITY_ATTRIBUTE) || !defined(__PIC__) call USCORE_SYMBOL(ffi_closure_SYSV_inner) +#elif defined(X86_DARWIN) + calll L_ffi_closure_SYSV_inner$stub #else movl %ebx, 8(%esp) call 1f @@ -1070,6 +1074,13 @@ USCORE_SYMBOL(ffi_closure_STDCALL): .ffi_closure_STDCALL_end: .LFE5: +#if defined(X86_DARWIN) +.section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5 +L_ffi_closure_SYSV_inner$stub: + .indirect_symbol _ffi_closure_SYSV_inner + hlt ; hlt ; hlt ; hlt ; hlt +#endif + #if defined(X86_WIN32) && !defined(__OS2__) .section .eh_frame,"w" #endif