Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
0171d7fa
Commit
0171d7fa
authored
May 08, 2015
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix libffi compilation on FreeBSD (#23042)
Patch from Marc-Andre Lemburg.
parent
cd797f91
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
18 deletions
+30
-18
Modules/_ctypes/libffi/src/x86/ffi.c
Modules/_ctypes/libffi/src/x86/ffi.c
+30
-18
No files found.
Modules/_ctypes/libffi/src/x86/ffi.c
View file @
0171d7fa
...
...
@@ -331,10 +331,11 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
extern
int
ffi_call_win64
(
void
(
*
)(
char
*
,
extended_cif
*
),
extended_cif
*
,
unsigned
,
unsigned
,
unsigned
*
,
void
(
*
fn
)(
void
));
#el
se
#el
if defined(X86_WIN32)
extern
void
ffi_call_win32
(
void
(
*
)(
char
*
,
extended_cif
*
),
extended_cif
*
,
unsigned
,
unsigned
,
unsigned
,
unsigned
*
,
void
(
*
fn
)(
void
));
#else
extern
void
ffi_call_SYSV
(
void
(
*
)(
char
*
,
extended_cif
*
),
extended_cif
*
,
unsigned
,
unsigned
,
unsigned
*
,
void
(
*
fn
)(
void
));
#endif
...
...
@@ -376,16 +377,9 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
ffi_call_win64
(
ffi_prep_args
,
&
ecif
,
cif
->
bytes
,
cif
->
flags
,
ecif
.
rvalue
,
fn
);
break
;
#else
#ifndef X86_WIN32
case
FFI_SYSV
:
ffi_call_SYSV
(
ffi_prep_args
,
&
ecif
,
cif
->
bytes
,
cif
->
flags
,
ecif
.
rvalue
,
fn
);
break
;
#else
#elif defined(X86_WIN32)
case
FFI_SYSV
:
case
FFI_MS_CDECL
:
#endif
case
FFI_STDCALL
:
ffi_call_win32
(
ffi_prep_args
,
&
ecif
,
cif
->
abi
,
cif
->
bytes
,
cif
->
flags
,
ecif
.
rvalue
,
fn
);
...
...
@@ -419,6 +413,11 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
ecif
.
rvalue
,
fn
);
}
break
;
#else
case
FFI_SYSV
:
ffi_call_SYSV
(
ffi_prep_args
,
&
ecif
,
cif
->
bytes
,
cif
->
flags
,
ecif
.
rvalue
,
fn
);
break
;
#endif
default:
FFI_ASSERT
(
0
);
...
...
@@ -787,28 +786,36 @@ ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *fake_avalue)
/* If the return value is a struct and we don't have a return */
/* value address then we need to make one */
#ifdef X86_WIN64
if
(
rvalue
==
NULL
&&
cif
->
flags
==
FFI_TYPE_STRUCT
&&
cif
->
rtype
->
size
!=
1
&&
cif
->
rtype
->
size
!=
2
&&
cif
->
rtype
->
size
!=
4
&&
cif
->
rtype
->
size
!=
8
)
{
ecif
.
rvalue
=
alloca
((
cif
->
rtype
->
size
+
0xF
)
&
~
0xF
);
}
#else
if
(
rvalue
==
NULL
&&
(
cif
->
flags
==
FFI_TYPE_STRUCT
||
cif
->
flags
==
FFI_TYPE_MS_STRUCT
))
{
ecif
.
rvalue
=
alloca
(
cif
->
rtype
->
size
);
}
#endif
else
ecif
.
rvalue
=
rvalue
;
switch
(
cif
->
abi
)
{
#if
ndef X86_WIN32
case
FFI_
SYSV
:
ffi_call_
SYSV
(
ffi_prep_args_raw
,
&
ecif
,
cif
->
bytes
,
cif
->
flag
s
,
ecif
.
rvalue
,
fn
);
#if
def X86_WIN64
case
FFI_
WIN64
:
ffi_call_
win64
(
ffi_prep_args_raw
,
&
ecif
,
cif
->
byte
s
,
cif
->
flags
,
ecif
.
rvalue
,
fn
);
break
;
#el
se
#el
if defined(X86_WIN32)
case
FFI_SYSV
:
case
FFI_MS_CDECL
:
#endif
#ifndef X86_WIN64
case
FFI_STDCALL
:
ffi_call_win32
(
ffi_prep_args_raw
,
&
ecif
,
cif
->
abi
,
cif
->
bytes
,
cif
->
flags
,
ecif
.
rvalue
,
fn
);
...
...
@@ -835,13 +842,18 @@ ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *fake_avalue)
++
passed_regs
;
}
if
(
passed_regs
<
2
&&
abi
==
FFI_FASTCALL
)
cif
->
abi
=
abi
=
FFI_THISCALL
;
abi
=
FFI_THISCALL
;
if
(
passed_regs
<
1
&&
abi
==
FFI_THISCALL
)
cif
->
abi
=
abi
=
FFI_STDCALL
;
abi
=
FFI_STDCALL
;
ffi_call_win32
(
ffi_prep_args_raw
,
&
ecif
,
abi
,
cif
->
bytes
,
cif
->
flags
,
ecif
.
rvalue
,
fn
);
}
break
;
#else
case
FFI_SYSV
:
ffi_call_SYSV
(
ffi_prep_args_raw
,
&
ecif
,
cif
->
bytes
,
cif
->
flags
,
ecif
.
rvalue
,
fn
);
break
;
#endif
default:
FFI_ASSERT
(
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment