summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2014-03-22 10:00:53 -0700
committerJosh Triplett <josh@joshtriplett.org>2014-03-22 10:04:11 -0700
commitf0f4138f90345d7d67dfa6783a7e1c7cc30d3c6f (patch)
treeecabedc9d6b2de25dac9e8d2ba73d8242d85d83d /src
parentef5890ebafb7cd2fbf9acf161edb55fe1382871c (diff)
downloadlibffi-f0f4138f90345d7d67dfa6783a7e1c7cc30d3c6f.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/x86/win32.S11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/x86/win32.S b/src/x86/win32.S
index b455982..826a5a0 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