Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 35a5081

Browse files
committed
Import libffi master
1 parent 82244f9 commit 35a5081

34 files changed

+1824
-138
lines changed

.appveyor.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ platform:
1313
- x64
1414
- x86
1515
- arm
16+
- arm64
1617

1718
environment:
1819
global:
@@ -30,6 +31,12 @@ install:
3031
$env:HOST="i686-pc-cygwin"
3132
$env:MSVCC="/cygdrive/c/projects/libffi/msvcc.sh"
3233
$env:SRC_ARCHITECTURE="x86"
34+
} ElseIf ($env:Platform -Match "arm64") {
35+
$env:VCVARS_PLATFORM="x86_arm64"
36+
$env:BUILD="i686-pc-cygwin"
37+
$env:HOST="aarch64-w64-cygwin"
38+
$env:MSVCC="/cygdrive/c/projects/libffi/msvcc.sh -marm64"
39+
$env:SRC_ARCHITECTURE="aarch64"
3340
} ElseIf ($env:Platform -Match "arm") {
3441
$env:VCVARS_PLATFORM="x86_arm"
3542
$env:BUILD="i686-pc-cygwin"
@@ -40,7 +47,7 @@ install:
4047
$env:VCVARS_PLATFORM="amd64"
4148
$env:BUILD="x86_64-w64-cygwin"
4249
$env:HOST="x86_64-w64-cygwin"
43-
$env:ASSEMBLER="/cygdrive/c/projects/libffi/msvcc.sh -m64"
50+
$env:MSVCC="/cygdrive/c/projects/libffi/msvcc.sh -m64"
4451
$env:SRC_ARCHITECTURE="x86"
4552
}
4653
- 'appveyor DownloadFile https://cygwin.com/setup-x86.exe -FileName setup.exe'

.gitattributes

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
# Make everything a binary data types
2-
* binary
3-
*.* binary
1+
* text=auto
2+
3+
*.sln text eol=crlf
4+
*.vcxproj* text eol=crlf

.travis/build.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,16 @@ function build_linux()
1010
make
1111
make dist
1212
make check RUNTESTFLAGS="-a $RUNTESTFLAGS"
13-
cat */testsuite/libffi.log
13+
14+
gzip -c -9 */testsuite/libffi.log > libffi.log.gz
15+
echo ================================================================
16+
echo The logs are too long for travis to handle, so we compress and
17+
echo uuencode them. Download, decode and uncompress if you need to
18+
echo read them.
19+
echo ================================================================
20+
uuencode libffi.log.gz -
21+
echo ================================================================
22+
echo ================================================================
1423
}
1524

1625
function build_ios()

.travis/install.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ if [[ $TRAVIS_OS_NAME != 'linux' ]]; then
88
brew install libtool dejagnu;
99
else
1010
sudo apt-get update
11-
sudo apt-get install dejagnu texinfo
11+
sudo apt-get install dejagnu texinfo sharutils
1212
case "$HOST" in
1313
i386-pc-linux-gnu)
1414
sudo apt-get install gcc-multilib g++-multilib
1515
;;
1616
moxie-elf)
17-
echo 'deb http://repos.moxielogic.org:7114/MoxieLogic moxiedev main' | sudo tee -a /etc/apt/sources.list
18-
sudo apt-get update -qq
17+
echo 'deb https://repos.moxielogic.org:7114/MoxieLogic moxiedev main' | sudo tee -a /etc/apt/sources.list
18+
sudo apt-get clean # clear the cache
19+
sudo apt-get update ## -qq
20+
# debug...
21+
curl https://repos.moxielogic.org:7114/MoxieLogic/dists/moxiedev/main/binary-amd64/Packages
1922
sudo apt-get install -y --allow-unauthenticated moxielogic-moxie-elf-gcc moxielogic-moxie-elf-gcc-c++ moxielogic-moxie-elf-gcc-libstdc++ moxielogic-moxie-elf-gdb-sim
2023
;;
2124
esac

Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ noinst_HEADERS = \
7979

8080
EXTRA_libffi_la_SOURCES = \
8181
src/aarch64/ffi.c src/aarch64/sysv.S \
82+
src/aarch64/win64_armasm.S \
8283
src/alpha/ffi.c src/alpha/osf.S \
8384
src/arc/ffi.c src/arc/arcompact.S \
8485
src/arm/ffi.c src/arm/sysv.S \

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ tested:
5151
| --------------- | ---------------- | ----------------------- |
5252
| AArch64 (ARM64) | iOS | Clang |
5353
| AArch64 | Linux | GCC |
54+
| AArch64 | Windows | MSVC |
5455
| Alpha | Linux | GCC |
5556
| Alpha | Tru64 | GCC |
5657
| ARC | Linux | GCC |
@@ -169,6 +170,11 @@ remove the line in configure that sets 'fix_srcfile_path' to a 'cygpath'
169170
command. ('cygpath' is not present in MingW, and is not required when
170171
using MingW-style paths.)
171172

173+
To build static library for ARM64 with MSVC using visual studio solution, msvc_build folder have
174+
aarch64/Ffi_staticLib.sln
175+
required header files in aarch64/aarch64_include/
176+
177+
172178
SPARC Solaris builds require the use of the GNU assembler and linker.
173179
Point ``AS`` and ``LD`` environment variables at those tool prior to
174180
configuration.
@@ -191,14 +197,13 @@ History
191197

192198
See the git log for details at http://github.com/libffi/libffi.
193199

194-
3.4 TBD
200+
3.3 TBD
195201
Add RISC-V support.
196202
New API in support of GO closures.
197203
Default to Microsoft's 64 bit long double ABI with Visual C++.
198-
GNU compiler uses 80 bits (128 in memory) FFI_GNUW64 ABI.
199-
Many new tests cases and bug fixes.
200-
201-
3.3 Mar-05-19
204+
GNU compiler uses 80 bits (128 in memory) FFI_GNUW64 ABI.
205+
Many new tests cases and bug fixes.
206+
Add windows on arm64 (WOA) support.
202207
Add Windows 32-bit arm support.
203208
204209
3.2.1 Nov-12-14

configure.host

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
# THIS TABLE IS SORTED. KEEP IT THAT WAY.
77
# Most of the time we can define all the variables all at once...
88
case "${host}" in
9+
aarch64*-*-cygwin* | aarch64*-*-mingw* | aarch64*-*-win* )
10+
TARGET=ARM_WIN64; TARGETDIR=aarch64
11+
MSVC=1
12+
;;
13+
914
aarch64*-*-*)
1015
TARGET=AARCH64; TARGETDIR=aarch64
1116
SOURCES="ffi.c sysv.S"
@@ -250,6 +255,9 @@ case "${TARGET}" in
250255
ARM_WIN32)
251256
SOURCES="ffi.c sysv_msvc_arm32.S"
252257
;;
258+
ARM_WIN64)
259+
SOURCES="ffi.c win64_armasm.S"
260+
;;
253261
MIPS)
254262
SOURCES="ffi.c o32.S n32.S"
255263
;;

include/ffi.h.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,13 @@ FFI_API size_t ffi_raw_size (ffi_cif *cif);
283283
packing, even on 64-bit machines. I.e. on 64-bit machines longs
284284
and doubles are followed by an empty 64-bit word. */
285285

286+
#if !FFI_NATIVE_RAW_API
286287
FFI_API
287288
void ffi_java_raw_call (ffi_cif *cif,
288289
void (*fn)(void),
289290
void *rvalue,
290291
ffi_java_raw *avalue);
292+
#endif
291293

292294
FFI_API
293295
void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw);
@@ -414,6 +416,7 @@ ffi_prep_raw_closure_loc (ffi_raw_closure*,
414416
void *user_data,
415417
void *codeloc);
416418

419+
#if !FFI_NATIVE_RAW_API
417420
FFI_API ffi_status
418421
ffi_prep_java_raw_closure (ffi_java_raw_closure*,
419422
ffi_cif *cif,
@@ -426,6 +429,7 @@ ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
426429
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
427430
void *user_data,
428431
void *codeloc);
432+
#endif
429433

430434
#endif /* FFI_CLOSURES */
431435

include/ffi_common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ ffi_status ffi_prep_cif_core(ffi_cif *cif,
9999
ffi_type *rtype,
100100
ffi_type **atypes);
101101

102+
/* Translate a data pointer to a code pointer. Needed for closures on
103+
some targets. */
104+
void *ffi_data_to_code_pointer (void *data) FFI_HIDDEN;
105+
102106
/* Extended cif, used in callback from assembly routine */
103107
typedef struct
104108
{

m4/asmcfi.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ AC_DEFUN([GCC_AS_CFI_PSEUDO_OP],
22
[AC_CACHE_CHECK([assembler .cfi pseudo-op support],
33
gcc_cv_as_cfi_pseudo_op, [
44
gcc_cv_as_cfi_pseudo_op=unknown
5-
AC_TRY_COMPILE([asm (".cfi_startproc\n\t.cfi_endproc");],,
5+
AC_TRY_COMPILE([asm (".cfi_sections\n\t.cfi_startproc\n\t.cfi_endproc");],,
66
[gcc_cv_as_cfi_pseudo_op=yes],
77
[gcc_cv_as_cfi_pseudo_op=no])
88
])

msvc_build/aarch64/Ffi_staticLib.sln

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.28302.56
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Ffi_staticLib_arm64", "Ffi_staticLib.vcxproj", "{115502C0-BE05-4767-BF19-5C87D805FAD6}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|ARM64 = Debug|ARM64
11+
Debug|x64 = Debug|x64
12+
Debug|x86 = Debug|x86
13+
Release|ARM64 = Release|ARM64
14+
Release|x64 = Release|x64
15+
Release|x86 = Release|x86
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{115502C0-BE05-4767-BF19-5C87D805FAD6}.Debug|ARM64.ActiveCfg = Debug|ARM64
19+
{115502C0-BE05-4767-BF19-5C87D805FAD6}.Debug|ARM64.Build.0 = Debug|ARM64
20+
{115502C0-BE05-4767-BF19-5C87D805FAD6}.Debug|x64.ActiveCfg = Debug|ARM64
21+
{115502C0-BE05-4767-BF19-5C87D805FAD6}.Debug|x86.ActiveCfg = Debug|ARM64
22+
{115502C0-BE05-4767-BF19-5C87D805FAD6}.Release|ARM64.ActiveCfg = Release|ARM64
23+
{115502C0-BE05-4767-BF19-5C87D805FAD6}.Release|ARM64.Build.0 = Release|ARM64
24+
{115502C0-BE05-4767-BF19-5C87D805FAD6}.Release|x64.ActiveCfg = Release|ARM64
25+
{115502C0-BE05-4767-BF19-5C87D805FAD6}.Release|x86.ActiveCfg = Release|ARM64
26+
EndGlobalSection
27+
GlobalSection(SolutionProperties) = preSolution
28+
HideSolutionNode = FALSE
29+
EndGlobalSection
30+
GlobalSection(ExtensibilityGlobals) = postSolution
31+
SolutionGuid = {241C54C7-20DD-4897-9376-E6B6D1B43BD5}
32+
EndGlobalSection
33+
EndGlobal
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|ARM64">
5+
<Configuration>Debug</Configuration>
6+
<Platform>ARM64</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|ARM64">
9+
<Configuration>Release</Configuration>
10+
<Platform>ARM64</Platform>
11+
</ProjectConfiguration>
12+
</ItemGroup>
13+
<PropertyGroup Label="Globals">
14+
<VCProjectVersion>15.0</VCProjectVersion>
15+
<ProjectGuid>{115502C0-BE05-4767-BF19-5C87D805FAD6}</ProjectGuid>
16+
<Keyword>Win32Proj</Keyword>
17+
<RootNamespace>FfistaticLib</RootNamespace>
18+
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
19+
<ProjectName>Ffi_staticLib_arm64</ProjectName>
20+
</PropertyGroup>
21+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
22+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
23+
<ConfigurationType>StaticLibrary</ConfigurationType>
24+
<UseDebugLibraries>true</UseDebugLibraries>
25+
<PlatformToolset>v141</PlatformToolset>
26+
<CharacterSet>Unicode</CharacterSet>
27+
</PropertyGroup>
28+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
29+
<ConfigurationType>StaticLibrary</ConfigurationType>
30+
<UseDebugLibraries>false</UseDebugLibraries>
31+
<PlatformToolset>v141</PlatformToolset>
32+
<WholeProgramOptimization>true</WholeProgramOptimization>
33+
<CharacterSet>Unicode</CharacterSet>
34+
</PropertyGroup>
35+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
36+
<ImportGroup Label="ExtensionSettings">
37+
</ImportGroup>
38+
<ImportGroup Label="Shared">
39+
</ImportGroup>
40+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="PropertySheets">
41+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
42+
</ImportGroup>
43+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="PropertySheets">
44+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
45+
</ImportGroup>
46+
<PropertyGroup Label="UserMacros" />
47+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
48+
<LinkIncremental>true</LinkIncremental>
49+
</PropertyGroup>
50+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
51+
<LinkIncremental>false</LinkIncremental>
52+
</PropertyGroup>
53+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
54+
<ClCompile>
55+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
56+
<WarningLevel>Level3</WarningLevel>
57+
<Optimization>Disabled</Optimization>
58+
<SDLCheck>true</SDLCheck>
59+
<PreprocessorDefinitions>FFI_BUILDING_DLL;_DEBUG;_LIB;USE_DL_PREFIX;ARM64;_M_ARM64;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
60+
<ConformanceMode>true</ConformanceMode>
61+
<AdditionalIncludeDirectories>..\..\include;.\aarch64_include;..\..\src\aarch64;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
62+
<IgnoreStandardIncludePath>false</IgnoreStandardIncludePath>
63+
<BrowseInformation>true</BrowseInformation>
64+
<OmitFramePointers>
65+
</OmitFramePointers>
66+
<WholeProgramOptimization>false</WholeProgramOptimization>
67+
</ClCompile>
68+
<Link>
69+
<SubSystem>Windows</SubSystem>
70+
<GenerateDebugInformation>true</GenerateDebugInformation>
71+
</Link>
72+
</ItemDefinitionGroup>
73+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
74+
<ClCompile>
75+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
76+
<WarningLevel>Level3</WarningLevel>
77+
<Optimization>MaxSpeed</Optimization>
78+
<FunctionLevelLinking>true</FunctionLevelLinking>
79+
<IntrinsicFunctions>true</IntrinsicFunctions>
80+
<SDLCheck>true</SDLCheck>
81+
<PreprocessorDefinitions>FFI_BUILDING_DLL;USE_DL_PREFIX;ARM64;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
82+
<ConformanceMode>true</ConformanceMode>
83+
<AdditionalIncludeDirectories>..\..\include;.\aarch64_include;..\..\src\aarch64;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
84+
<OmitFramePointers>true</OmitFramePointers>
85+
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
86+
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
87+
<AdditionalUsingDirectories>..\..\src;..\..\src\aarch64;%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
88+
</ClCompile>
89+
<Link>
90+
<SubSystem>Windows</SubSystem>
91+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
92+
<OptimizeReferences>true</OptimizeReferences>
93+
<GenerateDebugInformation>true</GenerateDebugInformation>
94+
</Link>
95+
<ProjectReference>
96+
<LinkLibraryDependencies>true</LinkLibraryDependencies>
97+
</ProjectReference>
98+
</ItemDefinitionGroup>
99+
<ItemGroup>
100+
<ClInclude Include=".\aarch64_include\ffi.h" />
101+
<ClInclude Include=".\aarch64_include\fficonfig.h" />
102+
<ClInclude Include="..\..\src\aarch64\ffitarget.h" />
103+
<ClInclude Include="..\include\ffi_cfi.h" />
104+
<ClInclude Include="..\include\ffi_common.h" />
105+
<ClInclude Include="..\..\src\aarch64\internal.h" />
106+
</ItemGroup>
107+
<ItemGroup>
108+
<ClCompile Include="..\..\src\closures.c" />
109+
<ClCompile Include="..\..\src\dlmalloc.c" />
110+
<ClCompile Include="..\..\src\aarch64\ffi.c" />
111+
<ClCompile Include="..\..\src\prep_cif.c" />
112+
<ClCompile Include="..\..\src\types.c" />
113+
</ItemGroup>
114+
<!--ItemGroup>
115+
<Object Include="..\..\..\..\Downloads\libffi-master-win64\src\aarch64\win64_armasm.obj" />
116+
</ItemGroup-->
117+
<ItemGroup>
118+
<CustomBuild Include="..\..\src\aarch64\win64_armasm.S">
119+
<!--ExcludedFromBuild Condition="'$(Platform)'!='ARM64'">true</ExcludedFromBuild -->
120+
<Command>
121+
cl /FA /EP /nologo /I"..\..\include" /I".\aarch64_include" /I"..\..\src\aarch64" "%(FullPath)" &gt; $(IntDir)win64_armasm.i
122+
armasm64 $(IntDir)win64_armasm.i /I"src\" /I"..\..\include" /I"..\..\src\aarch64" -o "$(IntDir)win64_armasm.obj"
123+
</Command>
124+
<Outputs>win64_armasm.obj;%(Outputs)</Outputs>
125+
</CustomBuild>
126+
</ItemGroup>
127+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
128+
<ImportGroup Label="ExtensionTargets">
129+
</ImportGroup>
130+
</Project>

0 commit comments

Comments
 (0)