ffi 1.11.3 → 1.15.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +184 -0
- data/Gemfile +3 -4
- data/README.md +24 -3
- data/Rakefile +64 -69
- data/ext/ffi_c/AbstractMemory.c +24 -25
- data/ext/ffi_c/Buffer.c +4 -9
- data/ext/ffi_c/Call.c +4 -16
- data/ext/ffi_c/ClosurePool.c +75 -25
- data/ext/ffi_c/ClosurePool.h +3 -1
- data/ext/ffi_c/DynamicLibrary.c +1 -6
- data/ext/ffi_c/Function.c +38 -38
- data/ext/ffi_c/Function.h +0 -4
- data/ext/ffi_c/FunctionInfo.c +3 -8
- data/ext/ffi_c/LastError.c +2 -6
- data/ext/ffi_c/LongDouble.c +5 -3
- data/ext/ffi_c/LongDouble.h +0 -4
- data/ext/ffi_c/MemoryPointer.c +3 -8
- data/ext/ffi_c/MemoryPointer.h +0 -4
- data/ext/ffi_c/MethodHandle.c +21 -31
- data/ext/ffi_c/MethodHandle.h +3 -2
- data/ext/ffi_c/Platform.c +5 -9
- data/ext/ffi_c/Pointer.c +25 -26
- data/ext/ffi_c/Pointer.h +0 -4
- data/ext/ffi_c/Struct.c +49 -56
- data/ext/ffi_c/Struct.h +12 -6
- data/ext/ffi_c/StructByValue.c +2 -7
- data/ext/ffi_c/StructLayout.c +22 -20
- data/ext/ffi_c/Thread.c +0 -8
- data/ext/ffi_c/Thread.h +1 -9
- data/ext/ffi_c/Type.c +1 -1
- data/ext/ffi_c/Types.c +6 -7
- data/ext/ffi_c/Types.h +3 -4
- data/ext/ffi_c/Variadic.c +14 -9
- data/ext/ffi_c/compat.h +4 -0
- data/ext/ffi_c/extconf.rb +36 -24
- data/ext/ffi_c/libffi/.travis/bfin-sim.exp +58 -0
- data/ext/ffi_c/libffi/.travis/build-cross-in-container.sh +14 -0
- data/ext/ffi_c/libffi/.travis/build-in-container.sh +2 -12
- data/ext/ffi_c/libffi/.travis/build.sh +62 -30
- data/ext/ffi_c/libffi/.travis/install.sh +65 -37
- data/ext/ffi_c/libffi/.travis/m32r-sim.exp +58 -0
- data/ext/ffi_c/libffi/.travis/moxie-sim.exp +1 -1
- data/ext/ffi_c/libffi/.travis/or1k-sim.exp +58 -0
- data/ext/ffi_c/libffi/.travis/powerpc-eabisim.exp +58 -0
- data/ext/ffi_c/libffi/.travis/site.exp +10 -1
- data/ext/ffi_c/libffi/.travis/wine-sim.exp +55 -0
- data/ext/ffi_c/libffi/.travis.yml +32 -12
- data/ext/ffi_c/libffi/{ChangeLog.libffi-3.1 → ChangeLog.old} +1407 -0
- data/ext/ffi_c/libffi/LICENSE +1 -1
- data/ext/ffi_c/libffi/Makefile.am +53 -61
- data/ext/ffi_c/libffi/Makefile.in +458 -207
- data/ext/ffi_c/libffi/README.md +22 -6
- data/ext/ffi_c/libffi/config.guess +552 -331
- data/ext/ffi_c/libffi/config.sub +1321 -1306
- data/ext/ffi_c/libffi/configure +414 -342
- data/ext/ffi_c/libffi/configure.ac +32 -11
- data/ext/ffi_c/libffi/configure.host +37 -22
- data/ext/ffi_c/libffi/doc/Makefile.in +9 -5
- data/ext/ffi_c/libffi/doc/libffi.texi +26 -14
- data/ext/ffi_c/libffi/doc/version.texi +4 -4
- data/ext/ffi_c/libffi/fficonfig.h.in +13 -0
- data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +2 -4
- data/ext/ffi_c/libffi/include/Makefile.in +10 -6
- data/ext/ffi_c/libffi/include/ffi.h.in +15 -7
- data/ext/ffi_c/libffi/install-sh +23 -13
- data/ext/ffi_c/libffi/libffi.map.in +8 -12
- data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +2 -48
- data/ext/ffi_c/libffi/libtool-version +1 -1
- data/ext/ffi_c/libffi/ltmain.sh +156 -61
- data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +5 -26
- data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +5 -26
- data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +2 -1
- data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +5 -26
- data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +7 -3
- data/ext/ffi_c/libffi/man/Makefile.in +9 -5
- data/ext/ffi_c/libffi/missing +8 -8
- data/ext/ffi_c/libffi/msvcc.sh +11 -11
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +51 -35
- data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +10 -5
- data/ext/ffi_c/libffi/src/aarch64/internal.h +1 -0
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +14 -3
- data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +1 -1
- data/ext/ffi_c/libffi/src/arm/ffi.c +22 -0
- data/ext/ffi_c/libffi/src/arm/sysv.S +4 -4
- data/ext/ffi_c/libffi/src/closures.c +43 -12
- data/ext/ffi_c/libffi/src/csky/ffi.c +395 -0
- data/ext/ffi_c/libffi/src/csky/ffitarget.h +63 -0
- data/ext/ffi_c/libffi/src/csky/sysv.S +371 -0
- data/ext/ffi_c/libffi/src/dlmalloc.c +1 -1
- data/ext/ffi_c/libffi/src/kvx/asm.h +5 -0
- data/ext/ffi_c/libffi/src/kvx/ffi.c +273 -0
- data/ext/ffi_c/libffi/src/kvx/ffitarget.h +75 -0
- data/ext/ffi_c/libffi/src/kvx/sysv.S +127 -0
- data/ext/ffi_c/libffi/src/mips/ffi.c +5 -1
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +1 -1
- data/ext/ffi_c/libffi/src/mips/o32.S +2 -0
- data/ext/ffi_c/libffi/src/pa/ffi.c +46 -91
- data/ext/ffi_c/libffi/src/pa/ffitarget.h +1 -6
- data/ext/ffi_c/libffi/src/pa/hpux32.S +4 -2
- data/ext/ffi_c/libffi/src/pa/linux.S +4 -2
- data/ext/ffi_c/libffi/src/powerpc/ffi.c +3 -2
- data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +13 -1
- data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +154 -8
- data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +18 -7
- data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +10 -4
- data/ext/ffi_c/libffi/src/powerpc/linux64.S +91 -28
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +80 -4
- data/ext/ffi_c/libffi/src/powerpc/sysv.S +5 -7
- data/ext/ffi_c/libffi/src/prep_cif.c +1 -1
- data/ext/ffi_c/libffi/src/x86/ffi.c +15 -6
- data/ext/ffi_c/libffi/src/x86/ffi64.c +17 -8
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +15 -2
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +15 -8
- data/ext/ffi_c/libffi/src/x86/sysv.S +15 -6
- data/ext/ffi_c/libffi/src/x86/unix64.S +59 -4
- data/ext/ffi_c/libffi/src/x86/win64.S +7 -3
- data/ext/ffi_c/libffi/src/x86/win64_intel.S +3 -2
- data/ext/ffi_c/libffi/testsuite/Makefile.am +78 -75
- data/ext/ffi_c/libffi/testsuite/Makefile.in +124 -84
- data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +7 -4
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +7 -2
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +4 -4
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +12 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure.exp +67 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn0.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn3.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn4.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn5.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn6.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_loc_fn0.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_simple.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_12byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_16byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_18byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_19byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_1_1byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_24byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_2byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3_1byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3float.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4_1byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5_1_byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_64byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6_1_byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7_1_byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_8byte.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_double.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_float.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_pointer.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint16.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint32.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint64.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint16.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint32.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint64.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_dbls_struct.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double_va.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_float.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble_va.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_many_mixed_args.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_many_mixed_float_double.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_schar.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshort.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshortchar.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_uchar.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushort.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushortchar.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer_stack.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_schar.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sint.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sshort.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_struct_va1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uchar.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uchar_va.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint_va.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulong_va.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulonglong.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort_va.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/err_bad_abi.c +0 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +138 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/huge_struct.c +3 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct10.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct11.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct3.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct4.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct5.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct6.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct7.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct8.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct9.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/problem1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium2.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/testclosure.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest.cc +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest_ffi_call.cc +0 -0
- data/ffi.gemspec +4 -5
- data/lib/ffi/abstract_memory.rb +44 -0
- data/lib/ffi/autopointer.rb +1 -1
- data/lib/ffi/ffi.rb +2 -0
- data/lib/ffi/io.rb +3 -3
- data/lib/ffi/library.rb +8 -4
- data/lib/ffi/managedstruct.rb +2 -2
- data/lib/ffi/platform/aarch64-darwin/types.conf +130 -0
- data/lib/ffi/platform/aarch64-freebsd/types.conf +2 -2
- data/lib/ffi/platform/aarch64-freebsd12/types.conf +113 -60
- data/lib/ffi/platform/aarch64-openbsd/types.conf +134 -0
- data/lib/ffi/platform/arm-linux/types.conf +32 -4
- data/lib/ffi/platform/i386-windows/types.conf +26 -79
- data/lib/ffi/platform/powerpc-linux/types.conf +32 -2
- data/lib/ffi/platform/powerpc-openbsd/types.conf +156 -0
- data/lib/ffi/platform/powerpc64le-linux/types.conf +100 -0
- data/lib/ffi/platform/riscv64-linux/types.conf +104 -0
- data/lib/ffi/platform/sparcv9-openbsd/types.conf +156 -0
- data/lib/ffi/platform/x86_64-darwin/types.conf +4 -0
- data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +4 -22
- data/lib/ffi/platform/x86_64-haiku/types.conf +117 -0
- data/lib/ffi/platform/x86_64-linux/types.conf +21 -0
- data/lib/ffi/platform/x86_64-msys/types.conf +119 -0
- data/lib/ffi/platform/x86_64-windows/types.conf +10 -78
- data/lib/ffi/platform.rb +18 -8
- data/lib/ffi/pointer.rb +21 -14
- data/lib/ffi/struct.rb +10 -5
- data/lib/ffi/tools/const_generator.rb +6 -4
- data/lib/ffi/tools/struct_generator.rb +2 -1
- data/lib/ffi/tools/types_generator.rb +2 -0
- data/lib/ffi/variadic.rb +1 -10
- data/lib/ffi/version.rb +1 -1
- data/lib/ffi.rb +10 -3
- data/rakelib/ffi_gem_helper.rb +65 -0
- data/samples/getlogin.rb +1 -1
- data/samples/getpid.rb +1 -1
- data/samples/gettimeofday.rb +8 -8
- data/samples/hello.rb +2 -1
- data/samples/inotify.rb +1 -1
- data/samples/pty.rb +1 -2
- data/samples/qsort.rb +0 -1
- metadata +133 -134
- data/.appveyor.yml +0 -27
- data/.gitignore +0 -25
- data/.gitmodules +0 -4
- data/.travis.yml +0 -42
- data/.yardopts +0 -5
- data/ext/ffi_c/libffi/ChangeLog.libffi +0 -584
- data/ext/ffi_c/libffi/ChangeLog.libgcj +0 -40
- data/ext/ffi_c/libffi/ChangeLog.v1 +0 -764
- data/ext/ffi_c/win32/stdbool.h +0 -8
- data/ext/ffi_c/win32/stdint.h +0 -201
- data/samples/sample_helper.rb +0 -6
data/ext/ffi_c/libffi/missing
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#! /bin/sh
|
2
2
|
# Common wrapper for a few potentially missing GNU programs.
|
3
3
|
|
4
|
-
scriptversion=
|
4
|
+
scriptversion=2018-03-07.03; # UTC
|
5
5
|
|
6
|
-
# Copyright (C) 1996-
|
6
|
+
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
7
7
|
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
8
8
|
|
9
9
|
# This program is free software; you can redistribute it and/or modify
|
@@ -17,7 +17,7 @@ scriptversion=2013-10-28.13; # UTC
|
|
17
17
|
# GNU General Public License for more details.
|
18
18
|
|
19
19
|
# You should have received a copy of the GNU General Public License
|
20
|
-
# along with this program. If not, see <
|
20
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
21
21
|
|
22
22
|
# As a special exception to the GNU General Public License, if you
|
23
23
|
# distribute this file as part of a program that contains a
|
@@ -101,9 +101,9 @@ else
|
|
101
101
|
exit $st
|
102
102
|
fi
|
103
103
|
|
104
|
-
perl_URL=
|
105
|
-
flex_URL=
|
106
|
-
gnu_software_URL=
|
104
|
+
perl_URL=https://www.perl.org/
|
105
|
+
flex_URL=https://github.com/westes/flex
|
106
|
+
gnu_software_URL=https://www.gnu.org/software
|
107
107
|
|
108
108
|
program_details ()
|
109
109
|
{
|
@@ -207,9 +207,9 @@ give_advice "$1" | sed -e '1s/^/WARNING: /' \
|
|
207
207
|
exit $st
|
208
208
|
|
209
209
|
# Local variables:
|
210
|
-
# eval: (add-hook '
|
210
|
+
# eval: (add-hook 'before-save-hook 'time-stamp)
|
211
211
|
# time-stamp-start: "scriptversion="
|
212
212
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
213
|
-
# time-stamp-time-zone: "
|
213
|
+
# time-stamp-time-zone: "UTC0"
|
214
214
|
# time-stamp-end: "; # UTC"
|
215
215
|
# End:
|
data/ext/ffi_c/libffi/msvcc.sh
CHANGED
@@ -165,24 +165,24 @@ do
|
|
165
165
|
shift 1
|
166
166
|
;;
|
167
167
|
-I)
|
168
|
-
p=$(cygpath -
|
169
|
-
args="$args -I$p"
|
170
|
-
includes="$includes -I$p"
|
168
|
+
p=$(cygpath -ma "$2")
|
169
|
+
args="$args -I\"$p\""
|
170
|
+
includes="$includes -I\"$p\""
|
171
171
|
shift 2
|
172
172
|
;;
|
173
173
|
-I*)
|
174
|
-
p=$(cygpath -
|
175
|
-
args="$args -I$p"
|
176
|
-
includes="$includes -I$p"
|
174
|
+
p=$(cygpath -ma "${1#-I}")
|
175
|
+
args="$args -I\"$p\""
|
176
|
+
includes="$includes -I\"$p\""
|
177
177
|
shift 1
|
178
178
|
;;
|
179
179
|
-L)
|
180
|
-
p=$(cygpath -
|
180
|
+
p=$(cygpath -ma $2)
|
181
181
|
linkargs="$linkargs -LIBPATH:$p"
|
182
182
|
shift 2
|
183
183
|
;;
|
184
184
|
-L*)
|
185
|
-
p=$(cygpath -
|
185
|
+
p=$(cygpath -ma ${1#-L})
|
186
186
|
linkargs="$linkargs -LIBPATH:$p"
|
187
187
|
shift 1
|
188
188
|
;;
|
@@ -256,12 +256,12 @@ do
|
|
256
256
|
shift 2
|
257
257
|
;;
|
258
258
|
*.S)
|
259
|
-
src
|
259
|
+
src="$(cygpath -ma $1)"
|
260
260
|
assembly="true"
|
261
261
|
shift 1
|
262
262
|
;;
|
263
263
|
*.c)
|
264
|
-
args="$args $1"
|
264
|
+
args="$args $(cygpath -ma $1)"
|
265
265
|
shift 1
|
266
266
|
;;
|
267
267
|
*)
|
@@ -312,7 +312,7 @@ if [ -n "$assembly" ]; then
|
|
312
312
|
echo "$cl -nologo -EP $includes $defines $src > $ppsrc"
|
313
313
|
fi
|
314
314
|
|
315
|
-
"$cl" -nologo -EP $includes $defines $src > $ppsrc || exit $?
|
315
|
+
eval "\"$cl\" -nologo -EP $includes $defines $src" > $ppsrc || exit $?
|
316
316
|
output="$(echo $output | sed 's%/F[dpa][^ ]*%%g')"
|
317
317
|
if [ $ml = "armasm" ]; then
|
318
318
|
args="-nologo -g -oldit $armasm_output $ppsrc -errorReport:prompt"
|
@@ -27,7 +27,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
27
27
|
#include <ffi.h>
|
28
28
|
#include <ffi_common.h>
|
29
29
|
#include "internal.h"
|
30
|
-
#ifdef
|
30
|
+
#ifdef _WIN32
|
31
31
|
#include <windows.h> /* FlushInstructionCache */
|
32
32
|
#endif
|
33
33
|
|
@@ -62,6 +62,9 @@ struct call_context
|
|
62
62
|
#if FFI_EXEC_TRAMPOLINE_TABLE
|
63
63
|
|
64
64
|
#ifdef __MACH__
|
65
|
+
#ifdef HAVE_PTRAUTH
|
66
|
+
#include <ptrauth.h>
|
67
|
+
#endif
|
65
68
|
#include <mach/vm_param.h>
|
66
69
|
#endif
|
67
70
|
|
@@ -78,7 +81,7 @@ ffi_clear_cache (void *start, void *end)
|
|
78
81
|
sys_icache_invalidate (start, (char *)end - (char *)start);
|
79
82
|
#elif defined (__GNUC__)
|
80
83
|
__builtin___clear_cache (start, end);
|
81
|
-
#elif defined (
|
84
|
+
#elif defined (_WIN32)
|
82
85
|
FlushInstructionCache(GetCurrentProcess(), start, (char*)end - (char*)start);
|
83
86
|
#else
|
84
87
|
#error "Missing builtin to flush instruction cache"
|
@@ -561,6 +564,14 @@ ffi_prep_cif_machdep_var(ffi_cif *cif, unsigned int nfixedargs,
|
|
561
564
|
cif->aarch64_nfixedargs = nfixedargs;
|
562
565
|
return status;
|
563
566
|
}
|
567
|
+
#else
|
568
|
+
ffi_status FFI_HIDDEN
|
569
|
+
ffi_prep_cif_machdep_var(ffi_cif *cif, unsigned int nfixedargs, unsigned int ntotalargs)
|
570
|
+
{
|
571
|
+
ffi_status status = ffi_prep_cif_machdep (cif);
|
572
|
+
cif->flags |= AARCH64_FLAG_VARARG;
|
573
|
+
return status;
|
574
|
+
}
|
564
575
|
#endif /* __APPLE__ */
|
565
576
|
|
566
577
|
extern void ffi_call_SYSV (struct call_context *context, void *frame,
|
@@ -577,7 +588,7 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
|
|
577
588
|
void *stack, *frame, *rvalue;
|
578
589
|
struct arg_state state;
|
579
590
|
size_t stack_bytes, rtype_size, rsize;
|
580
|
-
int i, nargs, flags;
|
591
|
+
int i, nargs, flags, isvariadic = 0;
|
581
592
|
ffi_type *rtype;
|
582
593
|
|
583
594
|
flags = cif->flags;
|
@@ -585,6 +596,12 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
|
|
585
596
|
rtype_size = rtype->size;
|
586
597
|
stack_bytes = cif->bytes;
|
587
598
|
|
599
|
+
if (flags & AARCH64_FLAG_VARARG)
|
600
|
+
{
|
601
|
+
isvariadic = 1;
|
602
|
+
flags &= ~AARCH64_FLAG_VARARG;
|
603
|
+
}
|
604
|
+
|
588
605
|
/* If the target function returns a structure via hidden pointer,
|
589
606
|
then we cannot allow a null rvalue. Otherwise, mash a null
|
590
607
|
rvalue to void return type. */
|
@@ -664,35 +681,31 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
|
|
664
681
|
h = is_vfp_type (ty);
|
665
682
|
if (h)
|
666
683
|
{
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
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 */
|
684
|
+
int elems = 4 - (h & 3);
|
685
|
+
if (cif->abi == FFI_WIN64 && isvariadic)
|
686
|
+
{
|
687
|
+
if (state.ngrn + elems <= N_X_ARG_REG)
|
688
|
+
{
|
689
|
+
dest = &context->x[state.ngrn];
|
690
|
+
state.ngrn += elems;
|
691
|
+
extend_hfa_type(dest, a, h);
|
692
|
+
break;
|
693
|
+
}
|
694
|
+
state.nsrn = N_X_ARG_REG;
|
695
|
+
dest = allocate_to_stack(&state, stack, ty->alignment, s);
|
696
|
+
}
|
697
|
+
else
|
698
|
+
{
|
699
|
+
if (state.nsrn + elems <= N_V_ARG_REG)
|
700
|
+
{
|
701
|
+
dest = &context->v[state.nsrn];
|
702
|
+
state.nsrn += elems;
|
703
|
+
extend_hfa_type (dest, a, h);
|
704
|
+
break;
|
705
|
+
}
|
706
|
+
state.nsrn = N_V_ARG_REG;
|
707
|
+
dest = allocate_to_stack (&state, stack, ty->alignment, s);
|
708
|
+
}
|
696
709
|
}
|
697
710
|
else if (s > 16)
|
698
711
|
{
|
@@ -789,6 +802,9 @@ ffi_prep_closure_loc (ffi_closure *closure,
|
|
789
802
|
|
790
803
|
#if FFI_EXEC_TRAMPOLINE_TABLE
|
791
804
|
#ifdef __MACH__
|
805
|
+
#ifdef HAVE_PTRAUTH
|
806
|
+
codeloc = ptrauth_strip (codeloc, ptrauth_key_asia);
|
807
|
+
#endif
|
792
808
|
void **config = (void **)((uint8_t *)codeloc - PAGE_MAX_SIZE);
|
793
809
|
config[0] = closure;
|
794
810
|
config[1] = start;
|
@@ -808,7 +824,7 @@ ffi_prep_closure_loc (ffi_closure *closure,
|
|
808
824
|
ffi_clear_cache(tramp, tramp + FFI_TRAMPOLINE_SIZE);
|
809
825
|
|
810
826
|
/* Also flush the cache for code mapping. */
|
811
|
-
#ifdef
|
827
|
+
#ifdef _WIN32
|
812
828
|
// Not using dlmalloc.c for Windows ARM64 builds
|
813
829
|
// so calling ffi_data_to_code_pointer() isn't necessary
|
814
830
|
unsigned char *tramp_code = tramp;
|
@@ -914,7 +930,7 @@ ffi_closure_SYSV_inner (ffi_cif *cif,
|
|
914
930
|
if (h)
|
915
931
|
{
|
916
932
|
n = 4 - (h & 3);
|
917
|
-
#ifdef
|
933
|
+
#ifdef _WIN32 /* for handling armasm calling convention */
|
918
934
|
if (cif->is_variadic)
|
919
935
|
{
|
920
936
|
if (state.ngrn + n <= N_X_ARG_REG)
|
@@ -954,7 +970,7 @@ ffi_closure_SYSV_inner (ffi_cif *cif,
|
|
954
970
|
avalue[i] = allocate_to_stack(&state, stack,
|
955
971
|
ty->alignment, s);
|
956
972
|
}
|
957
|
-
#ifdef
|
973
|
+
#ifdef _WIN32 /* for handling armasm calling convention */
|
958
974
|
}
|
959
975
|
#endif /* for handling armasm calling convention */
|
960
976
|
}
|
@@ -32,7 +32,7 @@ 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(
|
35
|
+
#elif defined(_WIN32)
|
36
36
|
#define FFI_SIZEOF_ARG 8
|
37
37
|
typedef unsigned long long ffi_arg;
|
38
38
|
typedef signed long long ffi_sarg;
|
@@ -45,8 +45,13 @@ typedef enum ffi_abi
|
|
45
45
|
{
|
46
46
|
FFI_FIRST_ABI = 0,
|
47
47
|
FFI_SYSV,
|
48
|
+
FFI_WIN64,
|
48
49
|
FFI_LAST_ABI,
|
50
|
+
#if defined(_WIN32)
|
51
|
+
FFI_DEFAULT_ABI = FFI_WIN64
|
52
|
+
#else
|
49
53
|
FFI_DEFAULT_ABI = FFI_SYSV
|
54
|
+
#endif
|
50
55
|
} ffi_abi;
|
51
56
|
#endif
|
52
57
|
|
@@ -69,22 +74,22 @@ typedef enum ffi_abi
|
|
69
74
|
#define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE
|
70
75
|
#endif
|
71
76
|
|
72
|
-
#ifdef
|
77
|
+
#ifdef _WIN32
|
73
78
|
#define FFI_EXTRA_CIF_FIELDS unsigned is_variadic
|
74
79
|
#endif
|
80
|
+
#define FFI_TARGET_SPECIFIC_VARIADIC
|
75
81
|
|
76
82
|
/* ---- Internal ---- */
|
77
83
|
|
78
84
|
#if defined (__APPLE__)
|
79
|
-
#define FFI_TARGET_SPECIFIC_VARIADIC
|
80
85
|
#define FFI_EXTRA_CIF_FIELDS unsigned aarch64_nfixedargs
|
81
|
-
#elif !defined(
|
86
|
+
#elif !defined(_WIN32)
|
82
87
|
/* iOS and Windows reserve x18 for the system. Disable Go closures until
|
83
88
|
a new static chain is chosen. */
|
84
89
|
#define FFI_GO_CLOSURES 1
|
85
90
|
#endif
|
86
91
|
|
87
|
-
#ifndef
|
92
|
+
#ifndef _WIN32
|
88
93
|
/* No complex type on Windows */
|
89
94
|
#define FFI_TARGET_HAS_COMPLEX_TYPE
|
90
95
|
#endif
|
@@ -56,6 +56,14 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
56
56
|
#define PTR_SIZE 4
|
57
57
|
#else
|
58
58
|
#define PTR_SIZE 8
|
59
|
+
#endif
|
60
|
+
|
61
|
+
#if FFI_EXEC_TRAMPOLINE_TABLE && defined(__MACH__) && defined(HAVE_PTRAUTH)
|
62
|
+
# define BR(r) braaz r
|
63
|
+
# define BLR(r) blraaz r
|
64
|
+
#else
|
65
|
+
# define BR(r) br r
|
66
|
+
# define BLR(r) blr r
|
59
67
|
#endif
|
60
68
|
|
61
69
|
.text
|
@@ -111,7 +119,7 @@ CNAME(ffi_call_SYSV):
|
|
111
119
|
/* Deallocate the context, leaving the stacked arguments. */
|
112
120
|
add sp, sp, #CALL_CONTEXT_SIZE
|
113
121
|
|
114
|
-
|
122
|
+
BLR(x9) /* call fn */
|
115
123
|
|
116
124
|
ldp x3, x4, [x29, #16] /* reload rvalue and flags */
|
117
125
|
|
@@ -271,6 +279,9 @@ CNAME(ffi_closure_SYSV):
|
|
271
279
|
bl CNAME(ffi_closure_SYSV_inner)
|
272
280
|
|
273
281
|
/* Load the return value as directed. */
|
282
|
+
#if FFI_EXEC_TRAMPOLINE_TABLE && defined(__MACH__) && defined(HAVE_PTRAUTH)
|
283
|
+
autiza x1
|
284
|
+
#endif
|
274
285
|
adr x1, 0f
|
275
286
|
and w0, w0, #AARCH64_RET_MASK
|
276
287
|
add x1, x1, x0, lsl #3
|
@@ -365,8 +376,8 @@ CNAME(ffi_closure_trampoline_table_page):
|
|
365
376
|
.rept PAGE_MAX_SIZE / FFI_TRAMPOLINE_SIZE
|
366
377
|
adr x16, -PAGE_MAX_SIZE
|
367
378
|
ldp x17, x16, [x16]
|
368
|
-
|
369
|
-
nop /* each entry in the trampoline config page is 2*sizeof(void*) so the trampoline itself cannot be smaller
|
379
|
+
BR(x16)
|
380
|
+
nop /* each entry in the trampoline config page is 2*sizeof(void*) so the trampoline itself cannot be smaller than 16 bytes */
|
370
381
|
.endr
|
371
382
|
|
372
383
|
.globl CNAME(ffi_closure_trampoline_table_page)
|
@@ -55,6 +55,11 @@ extern unsigned int ffi_arm_trampoline[3] FFI_HIDDEN;
|
|
55
55
|
#endif
|
56
56
|
#endif
|
57
57
|
|
58
|
+
#if defined(__FreeBSD__) && defined(__arm__)
|
59
|
+
#include <sys/types.h>
|
60
|
+
#include <machine/sysarch.h>
|
61
|
+
#endif
|
62
|
+
|
58
63
|
/* Forward declares. */
|
59
64
|
static int vfp_type_p (const ffi_type *);
|
60
65
|
static void layout_vfp_args (ffi_cif *);
|
@@ -421,12 +426,14 @@ ffi_call (ffi_cif *cif, void (*fn) (void), void *rvalue, void **avalue)
|
|
421
426
|
ffi_call_int (cif, fn, rvalue, avalue, NULL);
|
422
427
|
}
|
423
428
|
|
429
|
+
#ifdef FFI_GO_CLOSURES
|
424
430
|
void
|
425
431
|
ffi_call_go (ffi_cif *cif, void (*fn) (void), void *rvalue,
|
426
432
|
void **avalue, void *closure)
|
427
433
|
{
|
428
434
|
ffi_call_int (cif, fn, rvalue, avalue, closure);
|
429
435
|
}
|
436
|
+
#endif
|
430
437
|
|
431
438
|
static void *
|
432
439
|
ffi_prep_incoming_args_SYSV (ffi_cif *cif, void *rvalue,
|
@@ -564,11 +571,24 @@ ffi_closure_inner_VFP (ffi_cif *cif,
|
|
564
571
|
|
565
572
|
void ffi_closure_SYSV (void) FFI_HIDDEN;
|
566
573
|
void ffi_closure_VFP (void) FFI_HIDDEN;
|
574
|
+
|
575
|
+
#ifdef FFI_GO_CLOSURES
|
567
576
|
void ffi_go_closure_SYSV (void) FFI_HIDDEN;
|
568
577
|
void ffi_go_closure_VFP (void) FFI_HIDDEN;
|
578
|
+
#endif
|
569
579
|
|
570
580
|
/* the cif must already be prep'ed */
|
571
581
|
|
582
|
+
#if defined(__FreeBSD__) && defined(__arm__)
|
583
|
+
#define __clear_cache(start, end) do { \
|
584
|
+
struct arm_sync_icache_args ua; \
|
585
|
+
\
|
586
|
+
ua.addr = (uintptr_t)(start); \
|
587
|
+
ua.len = (char *)(end) - (char *)start; \
|
588
|
+
sysarch(ARM_SYNC_ICACHE, &ua); \
|
589
|
+
} while (0);
|
590
|
+
#endif
|
591
|
+
|
572
592
|
ffi_status
|
573
593
|
ffi_prep_closure_loc (ffi_closure * closure,
|
574
594
|
ffi_cif * cif,
|
@@ -622,6 +642,7 @@ ffi_prep_closure_loc (ffi_closure * closure,
|
|
622
642
|
return FFI_OK;
|
623
643
|
}
|
624
644
|
|
645
|
+
#ifdef FFI_GO_CLOSURES
|
625
646
|
ffi_status
|
626
647
|
ffi_prep_go_closure (ffi_go_closure *closure, ffi_cif *cif,
|
627
648
|
void (*fun) (ffi_cif *, void *, void **, void *))
|
@@ -643,6 +664,7 @@ ffi_prep_go_closure (ffi_go_closure *closure, ffi_cif *cif,
|
|
643
664
|
|
644
665
|
return FFI_OK;
|
645
666
|
}
|
667
|
+
#endif
|
646
668
|
|
647
669
|
/* Below are routines for VFP hard-float support. */
|
648
670
|
|
@@ -129,11 +129,11 @@ ARM_FUNC_START(ffi_call_VFP)
|
|
129
129
|
|
130
130
|
cmp r3, #3 @ load only d0 if possible
|
131
131
|
#ifdef __clang__
|
132
|
-
vldrle d0, [
|
133
|
-
vldmgt
|
132
|
+
vldrle d0, [r0]
|
133
|
+
vldmgt r0, {d0-d7}
|
134
134
|
#else
|
135
|
-
ldcle p11, cr0, [r0] @ vldrle d0, [
|
136
|
-
ldcgt p11, cr0, [r0], {16} @ vldmgt
|
135
|
+
ldcle p11, cr0, [r0] @ vldrle d0, [r0]
|
136
|
+
ldcgt p11, cr0, [r0], {16} @ vldmgt r0, {d0-d7}
|
137
137
|
#endif
|
138
138
|
add r0, r0, #64 @ discard the vfp register args
|
139
139
|
/* FALLTHRU */
|
@@ -1,5 +1,6 @@
|
|
1
1
|
/* -----------------------------------------------------------------------
|
2
|
-
closures.c - Copyright (c)
|
2
|
+
closures.c - Copyright (c) 2019 Anthony Green
|
3
|
+
Copyright (c) 2007, 2009, 2010 Red Hat, Inc.
|
3
4
|
Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc
|
4
5
|
Copyright (c) 2011 Plausible Labs Cooperative, Inc.
|
5
6
|
|
@@ -44,6 +45,9 @@
|
|
44
45
|
|
45
46
|
#include <stddef.h>
|
46
47
|
#include <unistd.h>
|
48
|
+
#ifdef HAVE_SYS_MEMFD_H
|
49
|
+
#include <sys/memfd.h>
|
50
|
+
#endif
|
47
51
|
|
48
52
|
static const size_t overhead =
|
49
53
|
(sizeof(max_align_t) > sizeof(void *) + sizeof(size_t)) ?
|
@@ -122,7 +126,7 @@ ffi_closure_free (void *ptr)
|
|
122
126
|
# define FFI_MMAP_EXEC_WRIT 1
|
123
127
|
# define HAVE_MNTENT 1
|
124
128
|
# endif
|
125
|
-
# if defined(
|
129
|
+
# if defined(_WIN32) || defined(__OS2__)
|
126
130
|
/* Windows systems may have Data Execution Protection (DEP) enabled,
|
127
131
|
which requires the use of VirtualMalloc/VirtualFree to alloc/free
|
128
132
|
executable memory. */
|
@@ -147,6 +151,9 @@ ffi_closure_free (void *ptr)
|
|
147
151
|
|
148
152
|
#include <mach/mach.h>
|
149
153
|
#include <pthread.h>
|
154
|
+
#ifdef HAVE_PTRAUTH
|
155
|
+
#include <ptrauth.h>
|
156
|
+
#endif
|
150
157
|
#include <stdio.h>
|
151
158
|
#include <stdlib.h>
|
152
159
|
|
@@ -300,6 +307,9 @@ ffi_closure_alloc (size_t size, void **code)
|
|
300
307
|
|
301
308
|
/* Initialize the return values */
|
302
309
|
*code = entry->trampoline;
|
310
|
+
#ifdef HAVE_PTRAUTH
|
311
|
+
*code = ptrauth_sign_unauthenticated (*code, ptrauth_key_asia, 0);
|
312
|
+
#endif
|
303
313
|
closure->trampoline_table = table;
|
304
314
|
closure->trampoline_table_entry = entry;
|
305
315
|
|
@@ -385,7 +395,7 @@ ffi_closure_free (void *ptr)
|
|
385
395
|
#endif
|
386
396
|
#include <string.h>
|
387
397
|
#include <stdio.h>
|
388
|
-
#if !defined(
|
398
|
+
#if !defined(_WIN32)
|
389
399
|
#ifdef HAVE_MNTENT
|
390
400
|
#include <mntent.h>
|
391
401
|
#endif /* HAVE_MNTENT */
|
@@ -511,11 +521,11 @@ static int dlmalloc_trim(size_t) MAYBE_UNUSED;
|
|
511
521
|
static size_t dlmalloc_usable_size(void*) MAYBE_UNUSED;
|
512
522
|
static void dlmalloc_stats(void) MAYBE_UNUSED;
|
513
523
|
|
514
|
-
#if !(defined(
|
524
|
+
#if !(defined(_WIN32) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX)
|
515
525
|
/* Use these for mmap and munmap within dlmalloc.c. */
|
516
526
|
static void *dlmmap(void *, size_t, int, int, int, off_t);
|
517
527
|
static int dlmunmap(void *, size_t);
|
518
|
-
#endif /* !(defined(
|
528
|
+
#endif /* !(defined(_WIN32) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */
|
519
529
|
|
520
530
|
#define mmap dlmmap
|
521
531
|
#define munmap dlmunmap
|
@@ -525,7 +535,7 @@ static int dlmunmap(void *, size_t);
|
|
525
535
|
#undef mmap
|
526
536
|
#undef munmap
|
527
537
|
|
528
|
-
#if !(defined(
|
538
|
+
#if !(defined(_WIN32) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX)
|
529
539
|
|
530
540
|
/* A mutex used to synchronize access to *exec* variables in this file. */
|
531
541
|
static pthread_mutex_t open_temp_exec_file_mutex = PTHREAD_MUTEX_INITIALIZER;
|
@@ -537,6 +547,17 @@ static int execfd = -1;
|
|
537
547
|
/* The amount of space already allocated from the temporary file. */
|
538
548
|
static size_t execsize = 0;
|
539
549
|
|
550
|
+
#ifdef HAVE_MEMFD_CREATE
|
551
|
+
/* Open a temporary file name, and immediately unlink it. */
|
552
|
+
static int
|
553
|
+
open_temp_exec_file_memfd (const char *name)
|
554
|
+
{
|
555
|
+
int fd;
|
556
|
+
fd = memfd_create (name, MFD_CLOEXEC);
|
557
|
+
return fd;
|
558
|
+
}
|
559
|
+
#endif
|
560
|
+
|
540
561
|
/* Open a temporary file name, and immediately unlink it. */
|
541
562
|
static int
|
542
563
|
open_temp_exec_file_name (char *name, int flags)
|
@@ -664,6 +685,9 @@ static struct
|
|
664
685
|
const char *arg;
|
665
686
|
int repeat;
|
666
687
|
} open_temp_exec_file_opts[] = {
|
688
|
+
#ifdef HAVE_MEMFD_CREATE
|
689
|
+
{ open_temp_exec_file_memfd, "libffi", 0 },
|
690
|
+
#endif
|
667
691
|
{ open_temp_exec_file_env, "TMPDIR", 0 },
|
668
692
|
{ open_temp_exec_file_dir, "/tmp", 0 },
|
669
693
|
{ open_temp_exec_file_dir, "/var/tmp", 0 },
|
@@ -907,7 +931,7 @@ segment_holding_code (mstate m, char* addr)
|
|
907
931
|
}
|
908
932
|
#endif
|
909
933
|
|
910
|
-
#endif /* !(defined(
|
934
|
+
#endif /* !(defined(_WIN32) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */
|
911
935
|
|
912
936
|
/* Allocate a chunk of memory with the given size. Returns a pointer
|
913
937
|
to the writable address, and sets *CODE to the executable
|
@@ -920,7 +944,7 @@ ffi_closure_alloc (size_t size, void **code)
|
|
920
944
|
if (!code)
|
921
945
|
return NULL;
|
922
946
|
|
923
|
-
ptr = dlmalloc (size);
|
947
|
+
ptr = FFI_CLOSURE_PTR (dlmalloc (size));
|
924
948
|
|
925
949
|
if (ptr)
|
926
950
|
{
|
@@ -936,7 +960,14 @@ void *
|
|
936
960
|
ffi_data_to_code_pointer (void *data)
|
937
961
|
{
|
938
962
|
msegmentptr seg = segment_holding (gm, data);
|
939
|
-
|
963
|
+
/* We expect closures to be allocated with ffi_closure_alloc(), in
|
964
|
+
which case seg will be non-NULL. However, some users take on the
|
965
|
+
burden of managing this memory themselves, in which case this
|
966
|
+
we'll just return data. */
|
967
|
+
if (seg)
|
968
|
+
return add_segment_exec_offset (data, seg);
|
969
|
+
else
|
970
|
+
return data;
|
940
971
|
}
|
941
972
|
|
942
973
|
/* Release a chunk of memory allocated with ffi_closure_alloc. If
|
@@ -953,7 +984,7 @@ ffi_closure_free (void *ptr)
|
|
953
984
|
ptr = sub_segment_exec_offset (ptr, seg);
|
954
985
|
#endif
|
955
986
|
|
956
|
-
dlfree (ptr);
|
987
|
+
dlfree (FFI_RESTORE_PTR (ptr));
|
957
988
|
}
|
958
989
|
|
959
990
|
# else /* ! FFI_MMAP_EXEC_WRIT */
|
@@ -969,13 +1000,13 @@ ffi_closure_alloc (size_t size, void **code)
|
|
969
1000
|
if (!code)
|
970
1001
|
return NULL;
|
971
1002
|
|
972
|
-
return *code = malloc (size);
|
1003
|
+
return *code = FFI_CLOSURE_PTR (malloc (size));
|
973
1004
|
}
|
974
1005
|
|
975
1006
|
void
|
976
1007
|
ffi_closure_free (void *ptr)
|
977
1008
|
{
|
978
|
-
free (ptr);
|
1009
|
+
free (FFI_RESTORE_PTR (ptr));
|
979
1010
|
}
|
980
1011
|
|
981
1012
|
void *
|