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
11efd790
Commit
11efd790
authored
Apr 17, 2019
by
Paul Monson
Committed by
Steve Dower
Apr 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-36071 Add support for Windows ARM32 in ctypes/libffi (GH-12059)
parent
264a0b40
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
8 deletions
+31
-8
Include/pyport.h
Include/pyport.h
+1
-1
Include/pythonrun.h
Include/pythonrun.h
+1
-1
Modules/_ctypes/callbacks.c
Modules/_ctypes/callbacks.c
+1
-1
Modules/_ctypes/callproc.c
Modules/_ctypes/callproc.c
+8
-3
Modules/_ctypes/malloc_closure.c
Modules/_ctypes/malloc_closure.c
+5
-0
PCbuild/pcbuild.sln
PCbuild/pcbuild.sln
+2
-0
PCbuild/prepare_libffi.bat
PCbuild/prepare_libffi.bat
+13
-2
No files found.
Include/pyport.h
View file @
11efd790
...
...
@@ -427,7 +427,7 @@ extern "C" {
#endif
/* get and set x87 control word for VisualStudio/x86 */
#if defined(_MSC_VER) &&
defined(_M_IX86)
/* x87 only supported in x86
*/
#if defined(_MSC_VER) &&
!defined(_WIN64) && !defined(_M_ARM)
/* x87 not supported in 64-bit or ARM
*/
#define HAVE_PY_SET_53BIT_PRECISION 1
#define _Py_SET_53BIT_PRECISION_HEADER \
unsigned int old_387controlword, new_387controlword, out_387controlword
...
...
Include/pythonrun.h
View file @
11efd790
...
...
@@ -165,7 +165,7 @@ PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
to an 8k margin. */
#define PYOS_STACK_MARGIN 2048
#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) && _MSC_VER >= 1300
#if defined(WIN32) && !defined(MS_WIN64) &&
!defined(_M_ARM) &&
defined(_MSC_VER) && _MSC_VER >= 1300
/* Enable stack checking under Microsoft C */
#define USE_STACKCHECK
#endif
...
...
Modules/_ctypes/callbacks.c
View file @
11efd790
...
...
@@ -380,7 +380,7 @@ CThunkObject *_ctypes_alloc_callback(PyObject *callable,
}
cc
=
FFI_DEFAULT_ABI
;
#if defined(MS_WIN32) && !defined(_WIN32_WCE) && !defined(MS_WIN64)
#if defined(MS_WIN32) && !defined(_WIN32_WCE) && !defined(MS_WIN64)
&& !defined(_M_ARM)
if
((
flags
&
FUNCFLAG_CDECL
)
==
0
)
cc
=
FFI_STDCALL
;
#endif
...
...
Modules/_ctypes/callproc.c
View file @
11efd790
...
...
@@ -737,12 +737,17 @@ of 1, 2, 4, 8, 16, 32, or 64 bits
*/
int
can_return_struct_as_int
(
size_t
s
)
{
return
s
==
1
||
s
==
2
||
s
==
4
;
return
s
==
1
||
s
==
2
||
s
==
4
;
}
int
can_return_struct_as_sint64
(
size_t
s
)
{
return
s
==
8
;
#ifdef _M_ARM
// 8 byte structs cannot be returned in a register on ARM32
return
0
;
#else
return
s
==
8
;
#endif
}
#endif
...
...
@@ -807,7 +812,7 @@ static int _call_function_pointer(int flags,
}
cc
=
FFI_DEFAULT_ABI
;
#if defined(MS_WIN32) && !defined(MS_WIN64) && !defined(_WIN32_WCE)
#if defined(MS_WIN32) && !defined(MS_WIN64) && !defined(_WIN32_WCE)
&& !defined(_M_ARM)
if
((
flags
&
FUNCFLAG_CDECL
)
==
0
)
cc
=
FFI_STDCALL
;
#endif
...
...
Modules/_ctypes/malloc_closure.c
View file @
11efd790
...
...
@@ -106,6 +106,11 @@ void *ffi_closure_alloc(size_t ignored, void** codeloc)
return
NULL
;
item
=
free_list
;
free_list
=
item
->
next
;
#ifdef _M_ARM
// set Thumb bit so that blx is called correctly
*
codeloc
=
(
ITEM
*
)((
uintptr_t
)
item
|
1
);
#else
*
codeloc
=
(
void
*
)
item
;
#endif
return
(
void
*
)
item
;
}
PCbuild/pcbuild.sln
View file @
11efd790
...
...
@@ -238,6 +238,7 @@ Global
{0E9791DB-593A-465F-98BC-681011311617}.Release|x64.ActiveCfg = Release|x64
{0E9791DB-593A-465F-98BC-681011311617}.Release|x64.Build.0 = Release|x64
{0E9791DB-593A-465F-98BC-681011311618}.Debug|ARM.ActiveCfg = Debug|ARM
{0E9791DB-593A-465F-98BC-681011311618}.Debug|ARM.Build.0 = Debug|ARM
{0E9791DB-593A-465F-98BC-681011311618}.Debug|Win32.ActiveCfg = Debug|Win32
{0E9791DB-593A-465F-98BC-681011311618}.Debug|Win32.Build.0 = Debug|Win32
{0E9791DB-593A-465F-98BC-681011311618}.Debug|x64.ActiveCfg = Debug|x64
...
...
@@ -255,6 +256,7 @@ Global
{0E9791DB-593A-465F-98BC-681011311618}.PGUpdate|x64.ActiveCfg = PGUpdate|x64
{0E9791DB-593A-465F-98BC-681011311618}.PGUpdate|x64.Build.0 = PGUpdate|x64
{0E9791DB-593A-465F-98BC-681011311618}.Release|ARM.ActiveCfg = Release|ARM
{0E9791DB-593A-465F-98BC-681011311618}.Release|ARM.Build.0 = Release|ARM
{0E9791DB-593A-465F-98BC-681011311618}.Release|Win32.ActiveCfg = Release|Win32
{0E9791DB-593A-465F-98BC-681011311618}.Release|Win32.Build.0 = Release|Win32
{0E9791DB-593A-465F-98BC-681011311618}.Release|x64.ActiveCfg = Release|x64
...
...
PCbuild/prepare_libffi.bat
View file @
11efd790
...
...
@@ -24,6 +24,7 @@ echo.
echo
.Available
flags
:
echo
.
-x
64
build
for
x64
echo
.
-x
86
build
for
x86
echo
.
-arm
32
build
for
arm32
echo
.
-?
this
help
echo
.
-
-install-cygwin
install
cygwin
to
c
:\cygwin
exit
/b
127
...
...
@@ -32,12 +33,14 @@ exit /b 127
set
BUILD_X64
=
set
BUILD_X86
=
set
BUILD_ARM32
=
set
INSTALL_CYGWIN
=
:CheckOpts
if
"
%
1"
==
""
goto
:CheckOptsDone
if
/I
"
%
1"
==
"-x64"
(
set
BUILD_X64
=
1
)
&
shift
&
goto
:CheckOpts
if
/I
"
%
1"
==
"-x86"
(
set
BUILD_X86
=
1
)
&
shift
&
goto
:CheckOpts
if
/I
"
%
1"
==
"-arm32"
(
set
BUILD_ARM32
=
1
)
&
shift
&
goto
:CheckOpts
if
/I
"
%
1"
==
"-?"
goto
:Usage
if
/I
"
%
1"
==
"--install-cygwin"
(
set
INSTALL_CYGWIN
=
1
)
&
shift
&
goto
:CheckOpts
goto
:Usage
...
...
@@ -47,6 +50,7 @@ goto :Usage
if
NOT
DEFINED
BUILD_X64
if
NOT
DEFINED
BUILD_X86
if
NOT
DEFINED
BUILD_ARM32
(
set
BUILD_X64
=
1
set
BUILD_X86
=
1
set
BUILD_ARM32
=
1
)
if
"
%INSTALL_CYGWIN%
"
==
"1"
call
:InstallCygwin
...
...
@@ -83,8 +87,9 @@ echo.
if
not
exist
Makefile
.in
(
%SH%
-lc
"(cd $LIBFFI_SOURCE; ./autogen.sh;)"
)
call
:BuildOne
x86
i686
-pc-cygwin
i686
-pc-cygwin
call
:BuildOne
x64
x86_64
-w
64
-cygwin
x86_64
-w
64
-cygwin
if
"
%BUILD
_X64
%
"
==
"1"
call
:BuildOne
x64
x86_64
-w
64
-cygwin
x86_64
-w
64
-cygwin
if
"
%BUILD
_X86
%
"
==
"1"
call
:BuildOne
x86
i686
-pc-cygwin
i686
-pc-cygwin
if
"
%BUILD
_ARM32
%
"
==
"1"
call
:BuildOne
x86_arm
i686
-pc-cygwin
arm
-w
32
-cygwin
popd
endlocal
...
...
@@ -118,6 +123,12 @@ if /I "%VCVARS_PLATFORM%" EQU "x86" (
set
ASSEMBLER
=
set
SRC_ARCHITECTURE
=
x86
)
if
/I
"
%VCVARS_PLATFORM%
"
EQU
"x86_arm"
(
set
ARCH
=
arm32
set
ARTIFACTS
=
%LIBFFI_SOURCE%
\arm
-w
32
-cygwin
set
ASSEMBLER
=
-marm
set
SRC_ARCHITECTURE
=
ARM
)
if
NOT
DEFINED
LIBFFI_OUT
set
LIBFFI_OUT
=
%~dp0
\..\externals\libffi
set
_LIBFFI_OUT
=
%LIBFFI_OUT%
\
%ARCH%
...
...
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