ffi 1.11.1 → 1.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{appveyor.yml → .appveyor.yml} +1 -1
- data/.gitmodules +2 -2
- data/CHANGELOG.md +16 -0
- data/Rakefile +1 -0
- data/ext/ffi_c/Call.c +3 -3
- data/ext/ffi_c/Call.h +2 -2
- data/ext/ffi_c/Function.c +4 -4
- data/ext/ffi_c/LongDouble.c +7 -7
- data/ext/ffi_c/libffi.darwin.mk +1 -1
- data/ext/ffi_c/libffi/.appveyor.yml +29 -13
- data/ext/ffi_c/libffi/.gitattributes +4 -0
- data/ext/ffi_c/libffi/.travis.yml +31 -2
- data/ext/ffi_c/libffi/.travis/build-in-container.sh +22 -0
- data/ext/ffi_c/libffi/.travis/build.sh +83 -7
- data/ext/ffi_c/libffi/.travis/install.sh +32 -11
- data/ext/ffi_c/libffi/LICENSE +1 -1
- data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +5 -4
- data/ext/ffi_c/libffi/Makefile.am +30 -38
- data/ext/ffi_c/libffi/README.md +15 -6
- data/ext/ffi_c/libffi/configure.ac +1 -1
- data/ext/ffi_c/libffi/configure.host +21 -7
- data/ext/ffi_c/libffi/include/ffi.h.in +4 -0
- data/ext/ffi_c/libffi/include/ffi_common.h +4 -0
- data/ext/ffi_c/libffi/m4/asmcfi.m4 +1 -1
- data/ext/ffi_c/libffi/make_sunver.pl +333 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.sln +33 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj +130 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.filters +57 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.user +4 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +511 -0
- data/ext/ffi_c/libffi/msvcc.sh +27 -2
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +124 -56
- data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +13 -2
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +8 -6
- data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +506 -0
- data/ext/ffi_c/libffi/src/arm/ffi.c +40 -5
- data/ext/ffi_c/libffi/src/arm/ffitarget.h +8 -1
- data/ext/ffi_c/libffi/src/arm/sysv.S +2 -0
- data/ext/ffi_c/libffi/src/arm/sysv_msvc_arm32.S +311 -0
- data/ext/ffi_c/libffi/src/closures.c +32 -8
- data/ext/ffi_c/libffi/src/pa/linux.S +23 -2
- data/ext/ffi_c/libffi/src/powerpc/ffi.c +3 -2
- data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +58 -25
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +1 -1
- data/ext/ffi_c/libffi/src/prep_cif.c +4 -2
- data/ext/ffi_c/libffi/src/x86/ffi.c +13 -6
- data/ext/ffi_c/libffi/src/x86/ffi64.c +5 -3
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +6 -3
- data/ext/ffi_c/libffi/src/x86/sysv.S +2 -2
- data/ext/ffi_c/libffi/src/x86/sysv_intel.S +995 -0
- data/ext/ffi_c/libffi/src/x86/win64.S +5 -0
- data/ext/ffi_c/libffi/testsuite/Makefile.am +111 -109
- data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +26 -5
- data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +9 -8
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +1 -1
- data/ffi.gemspec +1 -1
- data/lib/ffi/library.rb +5 -5
- data/lib/ffi/platform.rb +4 -1
- data/lib/ffi/platform/aarch64-freebsd/types.conf +89 -89
- data/lib/ffi/platform/aarch64-freebsd12/types.conf +89 -89
- data/lib/ffi/platform/aarch64-linux/types.conf +81 -81
- data/lib/ffi/platform/arm-freebsd/types.conf +87 -87
- data/lib/ffi/platform/arm-freebsd12/types.conf +87 -87
- data/lib/ffi/platform/arm-linux/types.conf +79 -79
- data/lib/ffi/platform/i386-cygwin/types.conf +1 -1
- data/lib/ffi/platform/i386-darwin/types.conf +63 -63
- data/lib/ffi/platform/i386-freebsd/types.conf +87 -87
- data/lib/ffi/platform/i386-freebsd12/types.conf +87 -87
- data/lib/ffi/platform/i386-gnu/types.conf +84 -84
- data/lib/ffi/platform/i386-linux/types.conf +77 -77
- data/lib/ffi/platform/i386-netbsd/types.conf +87 -87
- data/lib/ffi/platform/i386-openbsd/types.conf +89 -89
- data/lib/ffi/platform/i386-solaris/types.conf +96 -96
- data/lib/ffi/platform/i386-windows/types.conf +84 -84
- data/lib/ffi/platform/ia64-linux/types.conf +79 -79
- data/lib/ffi/platform/mips-linux/types.conf +79 -79
- data/lib/ffi/platform/mips64-linux/types.conf +81 -81
- data/lib/ffi/platform/mips64el-linux/types.conf +81 -81
- data/lib/ffi/platform/mipsel-linux/types.conf +79 -79
- data/lib/ffi/platform/mipsisa32r6-linux/types.conf +79 -79
- data/lib/ffi/platform/mipsisa32r6el-linux/types.conf +79 -79
- data/lib/ffi/platform/mipsisa64r6-linux/types.conf +81 -81
- data/lib/ffi/platform/mipsisa64r6el-linux/types.conf +81 -81
- data/lib/ffi/platform/powerpc-aix/types.conf +155 -155
- data/lib/ffi/platform/powerpc-darwin/types.conf +63 -63
- data/lib/ffi/platform/powerpc-linux/types.conf +77 -77
- data/lib/ffi/platform/powerpc64-linux/types.conf +81 -81
- data/lib/ffi/platform/s390-linux/types.conf +79 -79
- data/lib/ffi/platform/s390x-linux/types.conf +79 -79
- data/lib/ffi/platform/sparc-linux/types.conf +79 -79
- data/lib/ffi/platform/sparc-solaris/types.conf +103 -103
- data/lib/ffi/platform/sparc64-linux/types.conf +79 -79
- data/lib/ffi/platform/sparcv9-solaris/types.conf +103 -103
- data/lib/ffi/platform/x86_64-cygwin/types.conf +1 -1
- data/lib/ffi/platform/x86_64-darwin/types.conf +84 -84
- data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +148 -0
- data/lib/ffi/platform/x86_64-freebsd/types.conf +89 -89
- data/lib/ffi/platform/x86_64-freebsd12/types.conf +139 -109
- data/lib/ffi/platform/x86_64-linux/types.conf +86 -77
- data/lib/ffi/platform/x86_64-netbsd/types.conf +89 -89
- data/lib/ffi/platform/x86_64-openbsd/types.conf +86 -86
- data/lib/ffi/platform/x86_64-solaris/types.conf +96 -96
- data/lib/ffi/platform/x86_64-windows/types.conf +99 -99
- data/lib/ffi/tools/types_generator.rb +5 -4
- data/lib/ffi/version.rb +1 -1
- metadata +19 -5
data/ext/ffi_c/libffi/msvcc.sh
CHANGED
@@ -60,7 +60,7 @@ do
|
|
60
60
|
case $1
|
61
61
|
in
|
62
62
|
--verbose)
|
63
|
-
|
63
|
+
verbose=1
|
64
64
|
shift 1
|
65
65
|
;;
|
66
66
|
--version)
|
@@ -80,6 +80,16 @@ do
|
|
80
80
|
safeseh=
|
81
81
|
shift 1
|
82
82
|
;;
|
83
|
+
-marm)
|
84
|
+
ml='armasm'
|
85
|
+
safeseh=
|
86
|
+
shift 1
|
87
|
+
;;
|
88
|
+
-marm64)
|
89
|
+
ml='armasm64'
|
90
|
+
safeseh=
|
91
|
+
shift 1
|
92
|
+
;;
|
83
93
|
-clang-cl)
|
84
94
|
cl="clang-cl"
|
85
95
|
shift 1
|
@@ -237,6 +247,7 @@ do
|
|
237
247
|
else
|
238
248
|
output="-Fe$2"
|
239
249
|
fi
|
250
|
+
armasm_output="-o $2"
|
240
251
|
if [ -n "$assembly" ]; then
|
241
252
|
args="$args $output"
|
242
253
|
else
|
@@ -289,13 +300,27 @@ if [ -n "$assembly" ]; then
|
|
289
300
|
fi
|
290
301
|
ppsrc="$outdir/$(basename $src|sed 's/.S$/.asm/g')"
|
291
302
|
|
303
|
+
if [ $ml = "armasm" ]; then
|
304
|
+
defines="$defines -D_M_ARM"
|
305
|
+
fi
|
306
|
+
|
307
|
+
if [ $ml = "armasm64" ]; then
|
308
|
+
defines="$defines -D_M_ARM64"
|
309
|
+
fi
|
310
|
+
|
292
311
|
if test -n "$verbose"; then
|
293
312
|
echo "$cl -nologo -EP $includes $defines $src > $ppsrc"
|
294
313
|
fi
|
295
314
|
|
296
315
|
"$cl" -nologo -EP $includes $defines $src > $ppsrc || exit $?
|
297
316
|
output="$(echo $output | sed 's%/F[dpa][^ ]*%%g')"
|
298
|
-
|
317
|
+
if [ $ml = "armasm" ]; then
|
318
|
+
args="-nologo -g -oldit $armasm_output $ppsrc -errorReport:prompt"
|
319
|
+
elif [ $ml = "armasm64" ]; then
|
320
|
+
args="-nologo -g $armasm_output $ppsrc -errorReport:prompt"
|
321
|
+
else
|
322
|
+
args="-nologo $safeseh $single $output $ppsrc"
|
323
|
+
fi
|
299
324
|
|
300
325
|
if test -n "$verbose"; then
|
301
326
|
echo "$ml $args"
|
@@ -19,6 +19,7 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
19
19
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20
20
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
21
21
|
|
22
|
+
#if defined(__aarch64__) || defined(__arm64__)|| defined (_M_ARM64)
|
22
23
|
#include <stdio.h>
|
23
24
|
#include <stdlib.h>
|
24
25
|
#include <stdint.h>
|
@@ -26,6 +27,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
26
27
|
#include <ffi.h>
|
27
28
|
#include <ffi_common.h>
|
28
29
|
#include "internal.h"
|
30
|
+
#ifdef _M_ARM64
|
31
|
+
#include <windows.h> /* FlushInstructionCache */
|
32
|
+
#endif
|
29
33
|
|
30
34
|
/* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE;
|
31
35
|
all further uses in this file will refer to the 128-bit type. */
|
@@ -74,6 +78,8 @@ ffi_clear_cache (void *start, void *end)
|
|
74
78
|
sys_icache_invalidate (start, (char *)end - (char *)start);
|
75
79
|
#elif defined (__GNUC__)
|
76
80
|
__builtin___clear_cache (start, end);
|
81
|
+
#elif defined (_M_ARM64)
|
82
|
+
FlushInstructionCache(GetCurrentProcess(), start, (char*)end - (char*)start);
|
77
83
|
#else
|
78
84
|
#error "Missing builtin to flush instruction cache"
|
79
85
|
#endif
|
@@ -315,6 +321,9 @@ extend_integer_type (void *source, int type)
|
|
315
321
|
}
|
316
322
|
}
|
317
323
|
|
324
|
+
#if defined(_MSC_VER)
|
325
|
+
void extend_hfa_type (void *dest, void *src, int h);
|
326
|
+
#else
|
318
327
|
static void
|
319
328
|
extend_hfa_type (void *dest, void *src, int h)
|
320
329
|
{
|
@@ -368,7 +377,11 @@ extend_hfa_type (void *dest, void *src, int h)
|
|
368
377
|
: "r"(f * 12), "r"(dest), "r"(src)
|
369
378
|
: "memory", "v16", "v17", "v18", "v19");
|
370
379
|
}
|
380
|
+
#endif
|
371
381
|
|
382
|
+
#if defined(_MSC_VER)
|
383
|
+
void* compress_hfa_type (void *dest, void *src, int h);
|
384
|
+
#else
|
372
385
|
static void *
|
373
386
|
compress_hfa_type (void *dest, void *reg, int h)
|
374
387
|
{
|
@@ -437,6 +450,7 @@ compress_hfa_type (void *dest, void *reg, int h)
|
|
437
450
|
}
|
438
451
|
return dest;
|
439
452
|
}
|
453
|
+
#endif
|
440
454
|
|
441
455
|
/* Either allocate an appropriate register for the argument type, or if
|
442
456
|
none are available, allocate a stack slot and return a pointer
|
@@ -454,7 +468,7 @@ allocate_int_to_reg_or_stack (struct call_context *context,
|
|
454
468
|
return allocate_to_stack (state, stack, size, size);
|
455
469
|
}
|
456
470
|
|
457
|
-
ffi_status
|
471
|
+
ffi_status FFI_HIDDEN
|
458
472
|
ffi_prep_cif_machdep (ffi_cif *cif)
|
459
473
|
{
|
460
474
|
ffi_type *rtype = cif->rtype;
|
@@ -539,9 +553,9 @@ ffi_prep_cif_machdep (ffi_cif *cif)
|
|
539
553
|
|
540
554
|
#if defined (__APPLE__)
|
541
555
|
/* Perform Apple-specific cif processing for variadic calls */
|
542
|
-
ffi_status
|
543
|
-
|
544
|
-
|
556
|
+
ffi_status FFI_HIDDEN
|
557
|
+
ffi_prep_cif_machdep_var(ffi_cif *cif, unsigned int nfixedargs,
|
558
|
+
unsigned int ntotalargs)
|
545
559
|
{
|
546
560
|
ffi_status status = ffi_prep_cif_machdep (cif);
|
547
561
|
cif->aarch64_nfixedargs = nfixedargs;
|
@@ -588,8 +602,8 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
|
|
588
602
|
/* Allocate consectutive stack for everything we'll need. */
|
589
603
|
context = alloca (sizeof(struct call_context) + stack_bytes + 32 + rsize);
|
590
604
|
stack = context + 1;
|
591
|
-
frame = stack + stack_bytes;
|
592
|
-
rvalue = (rsize ? frame + 32 : orig_rvalue);
|
605
|
+
frame = (void*)((uintptr_t)stack + (uintptr_t)stack_bytes);
|
606
|
+
rvalue = (rsize ? (void*)((uintptr_t)frame + 32) : orig_rvalue);
|
593
607
|
|
594
608
|
arg_init (&state);
|
595
609
|
for (i = 0, nargs = cif->nargs; i < nargs; i++)
|
@@ -651,6 +665,22 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
|
|
651
665
|
if (h)
|
652
666
|
{
|
653
667
|
int elems = 4 - (h & 3);
|
668
|
+
#ifdef _M_ARM64 /* for handling armasm calling convention */
|
669
|
+
if (cif->is_variadic)
|
670
|
+
{
|
671
|
+
if (state.ngrn + elems <= N_X_ARG_REG)
|
672
|
+
{
|
673
|
+
dest = &context->x[state.ngrn];
|
674
|
+
state.ngrn += elems;
|
675
|
+
extend_hfa_type(dest, a, h);
|
676
|
+
break;
|
677
|
+
}
|
678
|
+
state.nsrn = N_X_ARG_REG;
|
679
|
+
dest = allocate_to_stack(&state, stack, ty->alignment, s);
|
680
|
+
}
|
681
|
+
else
|
682
|
+
{
|
683
|
+
#endif /* for handling armasm calling convention */
|
654
684
|
if (state.nsrn + elems <= N_V_ARG_REG)
|
655
685
|
{
|
656
686
|
dest = &context->v[state.nsrn];
|
@@ -660,6 +690,9 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
|
|
660
690
|
}
|
661
691
|
state.nsrn = N_V_ARG_REG;
|
662
692
|
dest = allocate_to_stack (&state, stack, ty->alignment, s);
|
693
|
+
#ifdef _M_ARM64 /* for handling armasm calling convention */
|
694
|
+
}
|
695
|
+
#endif /* for handling armasm calling convention */
|
663
696
|
}
|
664
697
|
else if (s > 16)
|
665
698
|
{
|
@@ -681,7 +714,7 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
|
|
681
714
|
X registers, then the argument is copied into
|
682
715
|
consecutive X registers. */
|
683
716
|
dest = &context->x[state.ngrn];
|
684
|
-
|
717
|
+
state.ngrn += (unsigned int)n;
|
685
718
|
}
|
686
719
|
else
|
687
720
|
{
|
@@ -773,6 +806,16 @@ ffi_prep_closure_loc (ffi_closure *closure,
|
|
773
806
|
*(UINT64 *)(tramp + 16) = (uintptr_t)start;
|
774
807
|
|
775
808
|
ffi_clear_cache(tramp, tramp + FFI_TRAMPOLINE_SIZE);
|
809
|
+
|
810
|
+
/* Also flush the cache for code mapping. */
|
811
|
+
#ifdef _M_ARM64
|
812
|
+
// Not using dlmalloc.c for Windows ARM64 builds
|
813
|
+
// so calling ffi_data_to_code_pointer() isn't necessary
|
814
|
+
unsigned char *tramp_code = tramp;
|
815
|
+
#else
|
816
|
+
unsigned char *tramp_code = ffi_data_to_code_pointer (tramp);
|
817
|
+
#endif
|
818
|
+
ffi_clear_cache (tramp_code, tramp_code + FFI_TRAMPOLINE_SIZE);
|
776
819
|
#endif
|
777
820
|
|
778
821
|
closure->cif = cif;
|
@@ -871,55 +914,78 @@ ffi_closure_SYSV_inner (ffi_cif *cif,
|
|
871
914
|
if (h)
|
872
915
|
{
|
873
916
|
n = 4 - (h & 3);
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
917
|
+
#ifdef _M_ARM64 /* for handling armasm calling convention */
|
918
|
+
if (cif->is_variadic)
|
919
|
+
{
|
920
|
+
if (state.ngrn + n <= N_X_ARG_REG)
|
921
|
+
{
|
922
|
+
void *reg = &context->x[state.ngrn];
|
923
|
+
state.ngrn += (unsigned int)n;
|
924
|
+
|
925
|
+
/* Eeek! We need a pointer to the structure, however the
|
926
|
+
homogeneous float elements are being passed in individual
|
927
|
+
registers, therefore for float and double the structure
|
928
|
+
is not represented as a contiguous sequence of bytes in
|
929
|
+
our saved register context. We don't need the original
|
930
|
+
contents of the register storage, so we reformat the
|
931
|
+
structure into the same memory. */
|
932
|
+
avalue[i] = compress_hfa_type(reg, reg, h);
|
933
|
+
}
|
934
|
+
else
|
935
|
+
{
|
936
|
+
state.ngrn = N_X_ARG_REG;
|
937
|
+
state.nsrn = N_V_ARG_REG;
|
938
|
+
avalue[i] = allocate_to_stack(&state, stack,
|
939
|
+
ty->alignment, s);
|
940
|
+
}
|
941
|
+
}
|
942
|
+
else
|
943
|
+
{
|
944
|
+
#endif /* for handling armasm calling convention */
|
945
|
+
if (state.nsrn + n <= N_V_ARG_REG)
|
946
|
+
{
|
947
|
+
void *reg = &context->v[state.nsrn];
|
948
|
+
state.nsrn += (unsigned int)n;
|
949
|
+
avalue[i] = compress_hfa_type(reg, reg, h);
|
950
|
+
}
|
951
|
+
else
|
952
|
+
{
|
953
|
+
state.nsrn = N_V_ARG_REG;
|
954
|
+
avalue[i] = allocate_to_stack(&state, stack,
|
955
|
+
ty->alignment, s);
|
956
|
+
}
|
957
|
+
#ifdef _M_ARM64 /* for handling armasm calling convention */
|
958
|
+
}
|
959
|
+
#endif /* for handling armasm calling convention */
|
960
|
+
}
|
961
|
+
else if (s > 16)
|
962
|
+
{
|
963
|
+
/* Replace Composite type of size greater than 16 with a
|
964
|
+
pointer. */
|
965
|
+
avalue[i] = *(void **)
|
966
|
+
allocate_int_to_reg_or_stack (context, &state, stack,
|
967
|
+
sizeof (void *));
|
968
|
+
}
|
969
|
+
else
|
970
|
+
{
|
971
|
+
n = (s + 7) / 8;
|
972
|
+
if (state.ngrn + n <= N_X_ARG_REG)
|
973
|
+
{
|
974
|
+
avalue[i] = &context->x[state.ngrn];
|
975
|
+
state.ngrn += (unsigned int)n;
|
976
|
+
}
|
977
|
+
else
|
978
|
+
{
|
979
|
+
state.ngrn = N_X_ARG_REG;
|
980
|
+
avalue[i] = allocate_to_stack(&state, stack,
|
981
|
+
ty->alignment, s);
|
982
|
+
}
|
983
|
+
}
|
984
|
+
break;
|
985
|
+
|
986
|
+
default:
|
987
|
+
abort();
|
988
|
+
}
|
923
989
|
|
924
990
|
#if defined (__APPLE__)
|
925
991
|
if (i + 1 == cif->aarch64_nfixedargs)
|
@@ -939,3 +1005,5 @@ ffi_closure_SYSV_inner (ffi_cif *cif,
|
|
939
1005
|
|
940
1006
|
return flags;
|
941
1007
|
}
|
1008
|
+
|
1009
|
+
#endif /* (__aarch64__) || defined(__arm64__)|| defined (_M_ARM64)*/
|
@@ -32,6 +32,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
32
32
|
#define FFI_SIZEOF_JAVA_RAW 4
|
33
33
|
typedef unsigned long long ffi_arg;
|
34
34
|
typedef signed long long ffi_sarg;
|
35
|
+
#elif defined(_M_ARM64)
|
36
|
+
#define FFI_SIZEOF_ARG 8
|
37
|
+
typedef unsigned long long ffi_arg;
|
38
|
+
typedef signed long long ffi_sarg;
|
35
39
|
#else
|
36
40
|
typedef unsigned long ffi_arg;
|
37
41
|
typedef signed long ffi_sarg;
|
@@ -65,17 +69,24 @@ typedef enum ffi_abi
|
|
65
69
|
#define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE
|
66
70
|
#endif
|
67
71
|
|
72
|
+
#ifdef _M_ARM64
|
73
|
+
#define FFI_EXTRA_CIF_FIELDS unsigned is_variadic
|
74
|
+
#endif
|
75
|
+
|
68
76
|
/* ---- Internal ---- */
|
69
77
|
|
70
78
|
#if defined (__APPLE__)
|
71
79
|
#define FFI_TARGET_SPECIFIC_VARIADIC
|
72
80
|
#define FFI_EXTRA_CIF_FIELDS unsigned aarch64_nfixedargs
|
73
|
-
#
|
74
|
-
/* iOS
|
81
|
+
#elif !defined(_M_ARM64)
|
82
|
+
/* iOS and Windows reserve x18 for the system. Disable Go closures until
|
75
83
|
a new static chain is chosen. */
|
76
84
|
#define FFI_GO_CLOSURES 1
|
77
85
|
#endif
|
78
86
|
|
87
|
+
#ifndef _M_ARM64
|
88
|
+
/* No complex type on Windows */
|
79
89
|
#define FFI_TARGET_HAS_COMPLEX_TYPE
|
90
|
+
#endif
|
80
91
|
|
81
92
|
#endif
|
@@ -19,6 +19,7 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
19
19
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20
20
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
21
21
|
|
22
|
+
#if defined(__aarch64__) || defined(__arm64__)
|
22
23
|
#define LIBFFI_ASM
|
23
24
|
#include <fficonfig.h>
|
24
25
|
#include <ffi.h>
|
@@ -198,9 +199,9 @@ CNAME(ffi_call_SYSV):
|
|
198
199
|
cfi_endproc
|
199
200
|
|
200
201
|
.globl CNAME(ffi_call_SYSV)
|
202
|
+
FFI_HIDDEN(CNAME(ffi_call_SYSV))
|
201
203
|
#ifdef __ELF__
|
202
204
|
.type CNAME(ffi_call_SYSV), #function
|
203
|
-
.hidden CNAME(ffi_call_SYSV)
|
204
205
|
.size CNAME(ffi_call_SYSV), .-CNAME(ffi_call_SYSV)
|
205
206
|
#endif
|
206
207
|
|
@@ -237,9 +238,9 @@ CNAME(ffi_closure_SYSV_V):
|
|
237
238
|
cfi_endproc
|
238
239
|
|
239
240
|
.globl CNAME(ffi_closure_SYSV_V)
|
241
|
+
FFI_HIDDEN(CNAME(ffi_closure_SYSV_V))
|
240
242
|
#ifdef __ELF__
|
241
243
|
.type CNAME(ffi_closure_SYSV_V), #function
|
242
|
-
.hidden CNAME(ffi_closure_SYSV_V)
|
243
244
|
.size CNAME(ffi_closure_SYSV_V), . - CNAME(ffi_closure_SYSV_V)
|
244
245
|
#endif
|
245
246
|
|
@@ -349,9 +350,9 @@ CNAME(ffi_closure_SYSV):
|
|
349
350
|
cfi_endproc
|
350
351
|
|
351
352
|
.globl CNAME(ffi_closure_SYSV)
|
353
|
+
FFI_HIDDEN(CNAME(ffi_closure_SYSV))
|
352
354
|
#ifdef __ELF__
|
353
355
|
.type CNAME(ffi_closure_SYSV), #function
|
354
|
-
.hidden CNAME(ffi_closure_SYSV)
|
355
356
|
.size CNAME(ffi_closure_SYSV), . - CNAME(ffi_closure_SYSV)
|
356
357
|
#endif
|
357
358
|
|
@@ -369,9 +370,9 @@ CNAME(ffi_closure_trampoline_table_page):
|
|
369
370
|
.endr
|
370
371
|
|
371
372
|
.globl CNAME(ffi_closure_trampoline_table_page)
|
373
|
+
FFI_HIDDEN(CNAME(ffi_closure_trampoline_table_page))
|
372
374
|
#ifdef __ELF__
|
373
375
|
.type CNAME(ffi_closure_trampoline_table_page), #function
|
374
|
-
.hidden CNAME(ffi_closure_trampoline_table_page)
|
375
376
|
.size CNAME(ffi_closure_trampoline_table_page), . - CNAME(ffi_closure_trampoline_table_page)
|
376
377
|
#endif
|
377
378
|
#endif
|
@@ -396,9 +397,9 @@ CNAME(ffi_go_closure_SYSV_V):
|
|
396
397
|
cfi_endproc
|
397
398
|
|
398
399
|
.globl CNAME(ffi_go_closure_SYSV_V)
|
400
|
+
FFI_HIDDEN(CNAME(ffi_go_closure_SYSV_V))
|
399
401
|
#ifdef __ELF__
|
400
402
|
.type CNAME(ffi_go_closure_SYSV_V), #function
|
401
|
-
.hidden CNAME(ffi_go_closure_SYSV_V)
|
402
403
|
.size CNAME(ffi_go_closure_SYSV_V), . - CNAME(ffi_go_closure_SYSV_V)
|
403
404
|
#endif
|
404
405
|
|
@@ -425,12 +426,13 @@ CNAME(ffi_go_closure_SYSV):
|
|
425
426
|
cfi_endproc
|
426
427
|
|
427
428
|
.globl CNAME(ffi_go_closure_SYSV)
|
429
|
+
FFI_HIDDEN(CNAME(ffi_go_closure_SYSV))
|
428
430
|
#ifdef __ELF__
|
429
431
|
.type CNAME(ffi_go_closure_SYSV), #function
|
430
|
-
.hidden CNAME(ffi_go_closure_SYSV)
|
431
432
|
.size CNAME(ffi_go_closure_SYSV), . - CNAME(ffi_go_closure_SYSV)
|
432
433
|
#endif
|
433
434
|
#endif /* FFI_GO_CLOSURES */
|
435
|
+
#endif /* __arm64__ */
|
434
436
|
|
435
437
|
#if defined __ELF__ && defined __linux__
|
436
438
|
.section .note.GNU-stack,"",%progbits
|