mirror of
https://github.com/darlinghq/darling-python.git
synced 2024-11-23 12:19:44 +00:00
Fix the ctypes Python module to use the right (bundled) libffi (Darling issue #139)
This commit is contained in:
parent
5d52dfef84
commit
83ba6be14c
@ -8,7 +8,7 @@ if(COMMAND cmake_policy)
|
||||
endif(COMMAND cmake_policy)
|
||||
|
||||
add_definitions(-DTARGET_OS_MAC=1)
|
||||
add_definitions(-D__APPLE__ -D__MACH__ -D__DYNAMIC__)
|
||||
add_definitions(-D__APPLE__ -D__MACH__ -D__DYNAMIC__ -DMACOSX)
|
||||
add_definitions(-DNDEBUG -DHAVE_NDBM_H -DHAVE_SEM_OPEN -DOBJC2RUNTIME)
|
||||
|
||||
add_definitions(-DVERSION="2.6" -DPREFIX="/System/Library/Frameworks/Python.framework/Versions/2.6" -DSUFFIX="${BITS}")
|
||||
@ -33,7 +33,7 @@ include_directories(${DARLING_TOP_DIRECTORY}/src/external/expat/expat/lib)
|
||||
include_directories(${DARLING_TOP_DIRECTORY}/src/ncurses/include)
|
||||
include_directories(${DARLING_TOP_DIRECTORY}/src/ncurses/panel)
|
||||
include_directories(${DARLING_TOP_DIRECTORY}/src/libedit/src)
|
||||
include_directories(${DARLING_TOP_DIRECTORY}/src/libffi/include)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Modules/_ctypes/libffi_osx/include)
|
||||
include_directories(${DARLING_TOP_DIRECTORY}/src/external/openssl/src/include)
|
||||
include_directories(${DARLING_TOP_DIRECTORY}/src/external/corefoundation/Headers)
|
||||
include_directories(${CMAKE_BINARY_DIR}/src/external/corefoundation/Headers)
|
||||
@ -251,8 +251,8 @@ pymodule(_bisect Modules/_bisectmodule.c)
|
||||
pymodule(_bytesio Modules/_bytesio.c)
|
||||
pymodule(_collections Modules/_collectionsmodule.c)
|
||||
pymodule(_csv Modules/_csv.c)
|
||||
pymodule(_ctypes Modules/_ctypes/callbacks.c Modules/_ctypes/callproc.c Modules/_ctypes/cfield.c Modules/_ctypes/_ctypes.c Modules/_ctypes/malloc_closure.c Modules/_ctypes/stgdict.c Modules/_ctypes/darwin/dlfcn_simple.c)
|
||||
target_link_libraries(py26__ctypes ffi)
|
||||
pymodule(_ctypes Modules/_ctypes/callbacks.c Modules/_ctypes/callproc.c Modules/_ctypes/cfield.c Modules/_ctypes/_ctypes.c Modules/_ctypes/malloc_closure.c Modules/_ctypes/stgdict.c Modules/_ctypes/darwin/dlfcn_simple.c
|
||||
Modules/_ctypes/libffi_osx/ffi.c Modules/_ctypes/libffi_osx/x86/darwin64.S Modules/_ctypes/libffi_osx/x86/x86-darwin.S Modules/_ctypes/libffi_osx/x86/x86-ffi64.c Modules/_ctypes/libffi_osx/x86/x86-ffi_darwin.c)
|
||||
pymodule(_ctypes_test Modules/_ctypes/_ctypes_test.c)
|
||||
pymodule(_curses_panel Modules/_curses_panel.c)
|
||||
target_link_libraries(py26__curses_panel ncurses panel)
|
||||
|
@ -29,6 +29,11 @@
|
||||
#include <fficonfig.h>
|
||||
#include <ffi.h>
|
||||
|
||||
#ifdef DARLING
|
||||
# define _ffi_call_unix64 ffi_call_unix64
|
||||
# define _ffi_closure_unix64 ffi_closure_unix64
|
||||
#endif
|
||||
|
||||
.file "darwin64.S"
|
||||
.text
|
||||
|
||||
@ -39,7 +44,7 @@
|
||||
for this function. This has been allocated by ffi_call. We also
|
||||
deallocate some of the stack that has been alloca'd. */
|
||||
|
||||
.align 3
|
||||
.align 8
|
||||
.globl _ffi_call_unix64
|
||||
|
||||
_ffi_call_unix64:
|
||||
@ -106,53 +111,53 @@ Lstore_table:
|
||||
.long Lst_int64-Lstore_table /* FFI_TYPE_POINTER */
|
||||
|
||||
.text
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_void:
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_uint8:
|
||||
movzbq %al, %rax
|
||||
movq %rax, (%rdi)
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_sint8:
|
||||
movsbq %al, %rax
|
||||
movq %rax, (%rdi)
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_uint16:
|
||||
movzwq %ax, %rax
|
||||
movq %rax, (%rdi)
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_sint16:
|
||||
movswq %ax, %rax
|
||||
movq %rax, (%rdi)
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_uint32:
|
||||
movl %eax, %eax
|
||||
movq %rax, (%rdi)
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_sint32:
|
||||
cltq
|
||||
movq %rax, (%rdi)
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_int64:
|
||||
movq %rax, (%rdi)
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_float:
|
||||
movss %xmm0, (%rdi)
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_double:
|
||||
movsd %xmm0, (%rdi)
|
||||
ret
|
||||
Lst_ldouble:
|
||||
fstpt (%rdi)
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_struct:
|
||||
leaq -20(%rsp), %rsi /* Scratch area in redzone. */
|
||||
|
||||
@ -183,7 +188,7 @@ Lst_struct:
|
||||
/* Many times we can avoid loading any SSE registers at all.
|
||||
It's not worth an indirect jump to load the exact set of
|
||||
SSE registers needed; zero or all is a good compromise. */
|
||||
.align 3
|
||||
.align 8
|
||||
LUW3:
|
||||
Lload_sse:
|
||||
movdqa 48(%r10), %xmm0
|
||||
@ -197,7 +202,7 @@ Lload_sse:
|
||||
jmp Lret_from_load_sse
|
||||
|
||||
LUW4:
|
||||
.align 3
|
||||
.align 8
|
||||
.globl _ffi_closure_unix64
|
||||
|
||||
_ffi_closure_unix64:
|
||||
@ -219,7 +224,7 @@ Lret_from_save_sse:
|
||||
leaq 176(%rsp), %rsi
|
||||
movq %rsp, %rdx
|
||||
leaq 208(%rsp), %rcx
|
||||
call _ffi_closure_unix64_inner
|
||||
call _ffi_closure_unix64_inner@PLT
|
||||
|
||||
/* Deallocate stack frame early; return value is now in redzone. */
|
||||
addq $200, %rsp
|
||||
@ -250,38 +255,38 @@ Lload_table:
|
||||
.long Lld_int64-Lload_table /* FFI_TYPE_POINTER */
|
||||
|
||||
.text
|
||||
.align 3
|
||||
.align 8
|
||||
Lld_void:
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lld_int8:
|
||||
movzbl -24(%rsp), %eax
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lld_int16:
|
||||
movzwl -24(%rsp), %eax
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lld_int32:
|
||||
movl -24(%rsp), %eax
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lld_int64:
|
||||
movq -24(%rsp), %rax
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lld_float:
|
||||
movss -24(%rsp), %xmm0
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lld_double:
|
||||
movsd -24(%rsp), %xmm0
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lld_ldouble:
|
||||
fldt -24(%rsp)
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lld_struct:
|
||||
/* There are four possibilities here, %rax/%rdx, %xmm0/%rax,
|
||||
%rax/%xmm0, %xmm0/%xmm1. We collapse two by always loading
|
||||
@ -300,7 +305,7 @@ Lld_struct:
|
||||
ret
|
||||
|
||||
/* See the comment above Lload_sse; the same logic applies here. */
|
||||
.align 3
|
||||
.align 8
|
||||
LUW8:
|
||||
Lsave_sse:
|
||||
movdqa %xmm0, 48(%rsp)
|
||||
@ -314,7 +319,8 @@ Lsave_sse:
|
||||
jmp Lret_from_save_sse
|
||||
|
||||
LUW9:
|
||||
.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
|
||||
//.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
|
||||
.text
|
||||
EH_frame1:
|
||||
.set L$set$0,LECIE1-LSCIE1 /* CIE Length */
|
||||
.long L$set$0
|
||||
@ -332,7 +338,7 @@ LSCIE1:
|
||||
.byte 0x8 /* uleb128 0x8 */
|
||||
.byte 0x90 /* DW_CFA_offset, column 0x10 */
|
||||
.byte 0x1
|
||||
.align 3
|
||||
.align 8
|
||||
LECIE1:
|
||||
.globl _ffi_call_unix64.eh
|
||||
_ffi_call_unix64.eh:
|
||||
@ -376,7 +382,7 @@ LASFDE1:
|
||||
.long L$set$5
|
||||
.byte 0xb /* DW_CFA_restore_state */
|
||||
|
||||
.align 3
|
||||
.align 8
|
||||
LEFDE1:
|
||||
.globl _ffi_closure_unix64.eh
|
||||
_ffi_closure_unix64.eh:
|
||||
@ -408,8 +414,8 @@ LASFDE3:
|
||||
.long L$set$10
|
||||
.byte 0xb /* DW_CFA_restore_state */
|
||||
|
||||
.align 3
|
||||
.align 8
|
||||
LEFDE3:
|
||||
.subsections_via_symbols
|
||||
// .subsections_via_symbols
|
||||
|
||||
#endif /* __x86_64__ */
|
||||
|
@ -29,6 +29,14 @@
|
||||
* assembly programming in 8 years.
|
||||
*/
|
||||
|
||||
#ifdef DARLING
|
||||
# define _ffi_prep_args ffi_prep_args
|
||||
# define _ffi_call_SYSV ffi_call_SYSV
|
||||
# define _ffi_closure_SYSV ffi_closure_SYSV
|
||||
# define _ffi_closure_SYSV_inner ffi_closure_SYSV_inner
|
||||
# define _ffi_closure_raw_SYSV ffi_closure_raw_SYSV
|
||||
#endif
|
||||
|
||||
#ifndef __x86_64__
|
||||
|
||||
#define LIBFFI_ASM
|
||||
@ -46,7 +54,7 @@
|
||||
|
||||
.globl _ffi_prep_args
|
||||
|
||||
.align 4
|
||||
.align 16
|
||||
.globl _ffi_call_SYSV
|
||||
|
||||
_ffi_call_SYSV:
|
||||
@ -166,7 +174,7 @@ Lepilogue:
|
||||
LFE1:
|
||||
.ffi_call_SYSV_end:
|
||||
|
||||
.align 4
|
||||
.align 16
|
||||
FFI_HIDDEN (ffi_closure_SYSV)
|
||||
.globl _ffi_closure_SYSV
|
||||
|
||||
@ -244,7 +252,7 @@ LFE2:
|
||||
#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
|
||||
#define CIF_FLAGS_OFFSET 20
|
||||
|
||||
.align 4
|
||||
.align 16
|
||||
FFI_HIDDEN (ffi_closure_raw_SYSV)
|
||||
.globl _ffi_closure_raw_SYSV
|
||||
|
||||
@ -300,14 +308,19 @@ Lrcls_retllong:
|
||||
jmp Lrcls_epilogue
|
||||
LFE3:
|
||||
#endif
|
||||
|
||||
#ifndef DARLING
|
||||
.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
|
||||
#else
|
||||
L_ffi_closure_SYSV_inner$stub:
|
||||
jmp _ffi_closure_SYSV_inner
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef DARLING
|
||||
.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
|
||||
#endif
|
||||
EH_frame1:
|
||||
.set L$set$0,LECIE1-LSCIE1
|
||||
.long L$set$0
|
||||
@ -325,7 +338,7 @@ LSCIE1:
|
||||
.byte 0x4
|
||||
.byte 0x88
|
||||
.byte 0x1
|
||||
.align 2
|
||||
.align 4
|
||||
LECIE1:
|
||||
.globl _ffi_call_SYSV.eh
|
||||
_ffi_call_SYSV.eh:
|
||||
@ -350,7 +363,7 @@ LASFDE1:
|
||||
.long L$set$4
|
||||
.byte 0xd
|
||||
.byte 0x4
|
||||
.align 2
|
||||
.align 4
|
||||
LEFDE1:
|
||||
.globl _ffi_closure_SYSV.eh
|
||||
_ffi_closure_SYSV.eh:
|
||||
@ -375,7 +388,7 @@ LASFDE2:
|
||||
.long L$set$8
|
||||
.byte 0xd
|
||||
.byte 0x4
|
||||
.align 2
|
||||
.align 4
|
||||
LEFDE2:
|
||||
|
||||
#if !FFI_NO_RAW_API
|
||||
@ -408,7 +421,7 @@ LASFDE3:
|
||||
.long L$set$14
|
||||
.byte 0x85
|
||||
.byte 0x3
|
||||
.align 2
|
||||
.align 4
|
||||
LEFDE3:
|
||||
|
||||
#endif
|
||||
|
@ -7,8 +7,9 @@ if(COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0005 NEW)
|
||||
endif(COMMAND cmake_policy)
|
||||
|
||||
enable_language(C ASM)
|
||||
add_definitions(-DTARGET_OS_MAC=1)
|
||||
add_definitions(-D__APPLE__ -D__MACH__ -D__DYNAMIC__)
|
||||
add_definitions(-D__APPLE__ -D__MACH__ -D__DYNAMIC__ -DMACOSX)
|
||||
add_definitions(-DNDEBUG -DHAVE_NDBM_H -DHAVE_SEM_OPEN -DOBJC2RUNTIME)
|
||||
|
||||
add_definitions(-DVERSION="2.7" -DPREFIX="/System/Library/Frameworks/Python.framework/Versions/2.7" -DSUFFIX="${BITS}")
|
||||
@ -33,7 +34,7 @@ include_directories(${DARLING_TOP_DIRECTORY}/src/external/expat/expat/lib)
|
||||
include_directories(${DARLING_TOP_DIRECTORY}/src/ncurses/include)
|
||||
include_directories(${DARLING_TOP_DIRECTORY}/src/ncurses/panel)
|
||||
include_directories(${DARLING_TOP_DIRECTORY}/src/libedit/src)
|
||||
include_directories(${DARLING_TOP_DIRECTORY}/src/libffi/include)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Modules/_ctypes/libffi_osx/include)
|
||||
include_directories(${DARLING_TOP_DIRECTORY}/src/external/openssl/src/include)
|
||||
include_directories(${DARLING_TOP_DIRECTORY}/src/external/corefoundation/Headers)
|
||||
include_directories(${CMAKE_BINARY_DIR}/src/external/corefoundation/Headers)
|
||||
@ -256,8 +257,8 @@ pymodule(_bisect Modules/_bisectmodule.c)
|
||||
pymodule(_io Modules/_io/bufferedio.c Modules/_io/bytesio.c Modules/_io/fileio.c Modules/_io/iobase.c Modules/_io/_iomodule.c Modules/_io/stringio.c Modules/_io/textio.c)
|
||||
pymodule(_collections Modules/_collectionsmodule.c)
|
||||
pymodule(_csv Modules/_csv.c)
|
||||
pymodule(_ctypes Modules/_ctypes/callbacks.c Modules/_ctypes/callproc.c Modules/_ctypes/cfield.c Modules/_ctypes/_ctypes.c Modules/_ctypes/malloc_closure.c Modules/_ctypes/stgdict.c Modules/_ctypes/darwin/dlfcn_simple.c)
|
||||
target_link_libraries(py27__ctypes ffi)
|
||||
pymodule(_ctypes Modules/_ctypes/callbacks.c Modules/_ctypes/callproc.c Modules/_ctypes/cfield.c Modules/_ctypes/_ctypes.c Modules/_ctypes/malloc_closure.c Modules/_ctypes/stgdict.c Modules/_ctypes/darwin/dlfcn_simple.c
|
||||
Modules/_ctypes/libffi_osx/ffi.c Modules/_ctypes/libffi_osx/x86/darwin64.S Modules/_ctypes/libffi_osx/x86/x86-darwin.S Modules/_ctypes/libffi_osx/x86/x86-ffi64.c Modules/_ctypes/libffi_osx/x86/x86-ffi_darwin.c)
|
||||
pymodule(_ctypes_test Modules/_ctypes/_ctypes_test.c)
|
||||
pymodule(_curses_panel Modules/_curses_panel.c)
|
||||
target_link_libraries(py27__curses_panel ncurses panel)
|
||||
|
@ -29,6 +29,11 @@
|
||||
#include <fficonfig.h>
|
||||
#include <ffi.h>
|
||||
|
||||
#ifdef DARLING
|
||||
# define _ffi_call_unix64 ffi_call_unix64
|
||||
# define _ffi_closure_unix64 ffi_closure_unix64
|
||||
#endif
|
||||
|
||||
.file "darwin64.S"
|
||||
.text
|
||||
|
||||
@ -39,7 +44,7 @@
|
||||
for this function. This has been allocated by ffi_call. We also
|
||||
deallocate some of the stack that has been alloca'd. */
|
||||
|
||||
.align 3
|
||||
.align 8
|
||||
.globl _ffi_call_unix64
|
||||
|
||||
_ffi_call_unix64:
|
||||
@ -53,7 +58,7 @@ LUW0:
|
||||
movq %r10, 24(%rax) /* Relocate return address. */
|
||||
movq %rax, %rbp /* Finalize local stack frame. */
|
||||
LUW1:
|
||||
/* movq %rdi, %r10 // Save a copy of the register area. */
|
||||
/* movq %rdi, %r10 */ // Save a copy of the register area.
|
||||
movq %r12, %r10
|
||||
movq %r8, %r11 /* Save a copy of the target fn. */
|
||||
movl %r9d, %eax /* Set number of SSE registers. */
|
||||
@ -108,53 +113,53 @@ Lstore_table:
|
||||
.long Lst_int64-Lstore_table /* FFI_TYPE_POINTER */
|
||||
|
||||
.text
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_void:
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_uint8:
|
||||
movzbq %al, %rax
|
||||
movq %rax, (%rdi)
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_sint8:
|
||||
movsbq %al, %rax
|
||||
movq %rax, (%rdi)
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_uint16:
|
||||
movzwq %ax, %rax
|
||||
movq %rax, (%rdi)
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_sint16:
|
||||
movswq %ax, %rax
|
||||
movq %rax, (%rdi)
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_uint32:
|
||||
movl %eax, %eax
|
||||
movq %rax, (%rdi)
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_sint32:
|
||||
cltq
|
||||
movq %rax, (%rdi)
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_int64:
|
||||
movq %rax, (%rdi)
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_float:
|
||||
movss %xmm0, (%rdi)
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_double:
|
||||
movsd %xmm0, (%rdi)
|
||||
ret
|
||||
Lst_ldouble:
|
||||
fstpt (%rdi)
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lst_struct:
|
||||
leaq -20(%rsp), %rsi /* Scratch area in redzone. */
|
||||
|
||||
@ -185,7 +190,7 @@ Lst_struct:
|
||||
/* Many times we can avoid loading any SSE registers at all.
|
||||
It's not worth an indirect jump to load the exact set of
|
||||
SSE registers needed; zero or all is a good compromise. */
|
||||
.align 3
|
||||
.align 8
|
||||
LUW3:
|
||||
Lload_sse:
|
||||
movdqa 48(%r10), %xmm0
|
||||
@ -199,7 +204,7 @@ Lload_sse:
|
||||
jmp Lret_from_load_sse
|
||||
|
||||
LUW4:
|
||||
.align 3
|
||||
.align 8
|
||||
.globl _ffi_closure_unix64
|
||||
|
||||
_ffi_closure_unix64:
|
||||
@ -221,7 +226,7 @@ Lret_from_save_sse:
|
||||
leaq 176(%rsp), %rsi
|
||||
movq %rsp, %rdx
|
||||
leaq 208(%rsp), %rcx
|
||||
call _ffi_closure_unix64_inner
|
||||
call _ffi_closure_unix64_inner@PLT
|
||||
|
||||
/* Deallocate stack frame early; return value is now in redzone. */
|
||||
addq $200, %rsp
|
||||
@ -252,38 +257,38 @@ Lload_table:
|
||||
.long Lld_int64-Lload_table /* FFI_TYPE_POINTER */
|
||||
|
||||
.text
|
||||
.align 3
|
||||
.align 8
|
||||
Lld_void:
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lld_int8:
|
||||
movzbl -24(%rsp), %eax
|
||||
movzbl -24(%rsp), %eax
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lld_int16:
|
||||
movzwl -24(%rsp), %eax
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lld_int32:
|
||||
movl -24(%rsp), %eax
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lld_int64:
|
||||
movq -24(%rsp), %rax
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lld_float:
|
||||
movss -24(%rsp), %xmm0
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lld_double:
|
||||
movsd -24(%rsp), %xmm0
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lld_ldouble:
|
||||
fldt -24(%rsp)
|
||||
ret
|
||||
.align 3
|
||||
.align 8
|
||||
Lld_struct:
|
||||
/* There are four possibilities here, %rax/%rdx, %xmm0/%rax,
|
||||
%rax/%xmm0, %xmm0/%xmm1. We collapse two by always loading
|
||||
@ -302,7 +307,7 @@ Lld_struct:
|
||||
ret
|
||||
|
||||
/* See the comment above Lload_sse; the same logic applies here. */
|
||||
.align 3
|
||||
.align 8
|
||||
LUW8:
|
||||
Lsave_sse:
|
||||
movdqa %xmm0, 48(%rsp)
|
||||
@ -316,7 +321,8 @@ Lsave_sse:
|
||||
jmp Lret_from_save_sse
|
||||
|
||||
LUW9:
|
||||
.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
|
||||
//.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
|
||||
.text
|
||||
EH_frame1:
|
||||
.set L$set$0,LECIE1-LSCIE1 /* CIE Length */
|
||||
.long L$set$0
|
||||
@ -334,7 +340,7 @@ LSCIE1:
|
||||
.byte 0x8 /* uleb128 0x8 */
|
||||
.byte 0x90 /* DW_CFA_offset, column 0x10 */
|
||||
.byte 0x1
|
||||
.align 3
|
||||
.align 8
|
||||
LECIE1:
|
||||
.globl _ffi_call_unix64.eh
|
||||
_ffi_call_unix64.eh:
|
||||
@ -378,7 +384,7 @@ LASFDE1:
|
||||
.long L$set$5
|
||||
.byte 0xb /* DW_CFA_restore_state */
|
||||
|
||||
.align 3
|
||||
.align 8
|
||||
LEFDE1:
|
||||
.globl _ffi_closure_unix64.eh
|
||||
_ffi_closure_unix64.eh:
|
||||
@ -410,8 +416,8 @@ LASFDE3:
|
||||
.long L$set$10
|
||||
.byte 0xb /* DW_CFA_restore_state */
|
||||
|
||||
.align 3
|
||||
.align 8
|
||||
LEFDE3:
|
||||
.subsections_via_symbols
|
||||
// .subsections_via_symbols
|
||||
|
||||
#endif /* __x86_64__ */
|
||||
|
@ -29,6 +29,14 @@
|
||||
* assembly programming in 8 years.
|
||||
*/
|
||||
|
||||
#ifdef DARLING
|
||||
# define _ffi_prep_args ffi_prep_args
|
||||
# define _ffi_call_SYSV ffi_call_SYSV
|
||||
# define _ffi_closure_SYSV ffi_closure_SYSV
|
||||
# define _ffi_closure_SYSV_inner ffi_closure_SYSV_inner
|
||||
# define _ffi_closure_raw_SYSV ffi_closure_raw_SYSV
|
||||
#endif
|
||||
|
||||
#ifndef __x86_64__
|
||||
|
||||
#define LIBFFI_ASM
|
||||
@ -46,7 +54,7 @@
|
||||
|
||||
.globl _ffi_prep_args
|
||||
|
||||
.align 4
|
||||
.align 16
|
||||
.globl _ffi_call_SYSV
|
||||
|
||||
_ffi_call_SYSV:
|
||||
@ -166,7 +174,7 @@ Lepilogue:
|
||||
LFE1:
|
||||
.ffi_call_SYSV_end:
|
||||
|
||||
.align 4
|
||||
.align 16
|
||||
FFI_HIDDEN (ffi_closure_SYSV)
|
||||
.globl _ffi_closure_SYSV
|
||||
|
||||
@ -198,12 +206,12 @@ LCFI7:
|
||||
je Lcls_retldouble
|
||||
cmpl $FFI_TYPE_SINT64, %eax
|
||||
je Lcls_retllong
|
||||
cmpl $FFI_TYPE_UINT8, %eax
|
||||
je Lcls_retstruct1
|
||||
cmpl $FFI_TYPE_UINT8, %eax
|
||||
je Lcls_retstruct1
|
||||
cmpl $FFI_TYPE_SINT8, %eax
|
||||
je Lcls_retstruct1
|
||||
cmpl $FFI_TYPE_UINT16, %eax
|
||||
je Lcls_retstruct2
|
||||
cmpl $FFI_TYPE_UINT16, %eax
|
||||
je Lcls_retstruct2
|
||||
cmpl $FFI_TYPE_SINT16, %eax
|
||||
je Lcls_retstruct2
|
||||
cmpl $FFI_TYPE_STRUCT, %eax
|
||||
@ -248,7 +256,7 @@ LFE2:
|
||||
#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
|
||||
#define CIF_FLAGS_OFFSET 20
|
||||
|
||||
.align 4
|
||||
.align 16
|
||||
FFI_HIDDEN (ffi_closure_raw_SYSV)
|
||||
.globl _ffi_closure_raw_SYSV
|
||||
|
||||
@ -304,14 +312,19 @@ Lrcls_retllong:
|
||||
jmp Lrcls_epilogue
|
||||
LFE3:
|
||||
#endif
|
||||
|
||||
#ifndef DARLING
|
||||
.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
|
||||
#else
|
||||
L_ffi_closure_SYSV_inner$stub:
|
||||
jmp _ffi_closure_SYSV_inner
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef DARLING
|
||||
.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
|
||||
#endif
|
||||
EH_frame1:
|
||||
.set L$set$0,LECIE1-LSCIE1
|
||||
.long L$set$0
|
||||
@ -329,7 +342,7 @@ LSCIE1:
|
||||
.byte 0x4
|
||||
.byte 0x88
|
||||
.byte 0x1
|
||||
.align 2
|
||||
.align 4
|
||||
LECIE1:
|
||||
.globl _ffi_call_SYSV.eh
|
||||
_ffi_call_SYSV.eh:
|
||||
@ -354,7 +367,7 @@ LASFDE1:
|
||||
.long L$set$4
|
||||
.byte 0xd
|
||||
.byte 0x4
|
||||
.align 2
|
||||
.align 4
|
||||
LEFDE1:
|
||||
.globl _ffi_closure_SYSV.eh
|
||||
_ffi_closure_SYSV.eh:
|
||||
@ -379,7 +392,7 @@ LASFDE2:
|
||||
.long L$set$8
|
||||
.byte 0xd
|
||||
.byte 0x4
|
||||
.align 2
|
||||
.align 4
|
||||
LEFDE2:
|
||||
|
||||
#if !FFI_NO_RAW_API
|
||||
@ -412,7 +425,7 @@ LASFDE3:
|
||||
.long L$set$14
|
||||
.byte 0x85
|
||||
.byte 0x3
|
||||
.align 2
|
||||
.align 4
|
||||
LEFDE3:
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user