ffi 1.10.0 → 1.13.1
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} +9 -1
- data/.github/workflows/ci.yml +64 -0
- data/.gitignore +3 -0
- data/.gitmodules +1 -0
- data/.travis.yml +35 -20
- data/CHANGELOG.md +124 -0
- data/Gemfile +6 -4
- data/README.md +29 -17
- data/Rakefile +29 -120
- data/ext/ffi_c/AbstractMemory.c +5 -9
- data/ext/ffi_c/Buffer.c +2 -2
- data/ext/ffi_c/Call.c +14 -41
- data/ext/ffi_c/Call.h +4 -7
- data/ext/ffi_c/ClosurePool.c +11 -14
- data/ext/ffi_c/DynamicLibrary.c +1 -1
- data/ext/ffi_c/Function.c +18 -117
- data/ext/ffi_c/FunctionInfo.c +1 -2
- data/ext/ffi_c/LongDouble.c +12 -10
- data/ext/ffi_c/LongDouble.h +0 -4
- data/ext/ffi_c/MemoryPointer.c +1 -1
- data/ext/ffi_c/MethodHandle.c +18 -24
- data/ext/ffi_c/MethodHandle.h +3 -2
- data/ext/ffi_c/Platform.c +1 -47
- data/ext/ffi_c/Pointer.c +1 -1
- data/ext/ffi_c/Struct.c +47 -51
- data/ext/ffi_c/Struct.h +12 -6
- data/ext/ffi_c/StructLayout.c +20 -14
- data/ext/ffi_c/Thread.c +4 -223
- data/ext/ffi_c/Thread.h +0 -14
- data/ext/ffi_c/Type.c +0 -18
- data/ext/ffi_c/Type.h +0 -1
- data/ext/ffi_c/Types.c +1 -1
- data/ext/ffi_c/Variadic.c +9 -15
- data/ext/ffi_c/compat.h +4 -0
- data/ext/ffi_c/extconf.rb +36 -26
- data/ext/ffi_c/ffi.c +3 -8
- 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 +51 -2
- 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 +12 -0
- data/ext/ffi_c/libffi/.travis/build.sh +116 -8
- data/ext/ffi_c/libffi/.travis/install.sh +65 -16
- data/ext/ffi_c/libffi/.travis/m32r-sim.exp +58 -0
- 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/{ChangeLog.libffi-3.1 → ChangeLog.old} +1407 -0
- data/ext/ffi_c/libffi/LICENSE +1 -1
- data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +5 -4
- data/ext/ffi_c/libffi/Makefile.am +35 -41
- data/ext/ffi_c/libffi/README.md +29 -8
- data/ext/ffi_c/libffi/configure.ac +31 -11
- data/ext/ffi_c/libffi/configure.host +26 -9
- data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +1 -3
- data/ext/ffi_c/libffi/include/ffi.h.in +19 -7
- data/ext/ffi_c/libffi/include/ffi_common.h +5 -1
- 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/m4/asmcfi.m4 +1 -1
- 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/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 +132 -58
- data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +13 -2
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +21 -8
- 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 +51 -13
- data/ext/ffi_c/libffi/src/frv/ffi.c +1 -1
- data/ext/ffi_c/libffi/src/metag/ffi.c +1 -1
- data/ext/ffi_c/libffi/src/mips/o32.S +2 -0
- data/ext/ffi_c/libffi/src/moxie/ffi.c +1 -1
- 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 +27 -4
- data/ext/ffi_c/libffi/src/powerpc/ffi.c +6 -4
- data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +211 -32
- 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 +83 -28
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +68 -4
- data/ext/ffi_c/libffi/src/powerpc/sysv.S +5 -7
- data/ext/ffi_c/libffi/src/prep_cif.c +4 -2
- data/ext/ffi_c/libffi/src/riscv/ffi.c +42 -6
- data/ext/ffi_c/libffi/src/riscv/ffitarget.h +1 -0
- data/ext/ffi_c/libffi/src/riscv/sysv.S +86 -7
- data/ext/ffi_c/libffi/src/x86/ffi.c +21 -10
- data/ext/ffi_c/libffi/src/x86/ffi64.c +15 -11
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +15 -2
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +15 -10
- data/ext/ffi_c/libffi/src/x86/sysv.S +103 -8
- data/ext/ffi_c/libffi/src/x86/sysv_intel.S +995 -0
- data/ext/ffi_c/libffi/src/x86/unix64.S +99 -2
- data/ext/ffi_c/libffi/src/x86/win64.S +9 -1
- data/ext/ffi_c/libffi/testsuite/Makefile.am +114 -109
- data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +26 -22
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +7 -2
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +12 -1
- 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/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 +1 -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/ext/ffi_c/rbffi.h +0 -2
- data/ffi.gemspec +12 -5
- data/lib/ffi.rb +10 -2
- data/lib/ffi/data_converter.rb +67 -0
- data/lib/ffi/ffi.rb +2 -0
- data/lib/ffi/library.rb +10 -6
- data/lib/ffi/platform.rb +12 -3
- 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 +110 -82
- 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 +43 -96
- 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 +108 -78
- data/lib/ffi/platform/powerpc-openbsd/types.conf +156 -0
- 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-openbsd/types.conf +156 -0
- 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 +88 -84
- data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +130 -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 +107 -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 +42 -110
- data/lib/ffi/pointer.rb +20 -13
- data/lib/ffi/struct.rb +13 -68
- data/lib/ffi/struct_by_reference.rb +72 -0
- data/lib/ffi/struct_layout.rb +96 -0
- data/lib/ffi/tools/const_generator.rb +5 -4
- data/lib/ffi/tools/generator.rb +47 -2
- data/lib/ffi/tools/generator_task.rb +13 -17
- data/lib/ffi/tools/struct_generator.rb +4 -4
- data/lib/ffi/tools/types_generator.rb +7 -4
- data/lib/ffi/types.rb +1 -1
- data/lib/ffi/version.rb +1 -1
- 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 +141 -116
- data/ext/ffi_c/DataConverter.c +0 -91
- data/ext/ffi_c/StructByReference.c +0 -190
- data/ext/ffi_c/StructByReference.h +0 -50
- 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/samples/sample_helper.rb +0 -6
@@ -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
|
|
@@ -122,7 +123,7 @@ ffi_closure_free (void *ptr)
|
|
122
123
|
# define FFI_MMAP_EXEC_WRIT 1
|
123
124
|
# define HAVE_MNTENT 1
|
124
125
|
# endif
|
125
|
-
# if defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)
|
126
|
+
# if defined(X86_WIN32) || defined(X86_WIN64) || defined(_M_ARM64) || defined(__OS2__)
|
126
127
|
/* Windows systems may have Data Execution Protection (DEP) enabled,
|
127
128
|
which requires the use of VirtualMalloc/VirtualFree to alloc/free
|
128
129
|
executable memory. */
|
@@ -147,6 +148,9 @@ ffi_closure_free (void *ptr)
|
|
147
148
|
|
148
149
|
#include <mach/mach.h>
|
149
150
|
#include <pthread.h>
|
151
|
+
#ifdef HAVE_PTRAUTH
|
152
|
+
#include <ptrauth.h>
|
153
|
+
#endif
|
150
154
|
#include <stdio.h>
|
151
155
|
#include <stdlib.h>
|
152
156
|
|
@@ -172,7 +176,7 @@ struct ffi_trampoline_table
|
|
172
176
|
|
173
177
|
struct ffi_trampoline_table_entry
|
174
178
|
{
|
175
|
-
void *(*trampoline) ();
|
179
|
+
void *(*trampoline) (void);
|
176
180
|
ffi_trampoline_table_entry *next;
|
177
181
|
};
|
178
182
|
|
@@ -300,6 +304,9 @@ ffi_closure_alloc (size_t size, void **code)
|
|
300
304
|
|
301
305
|
/* Initialize the return values */
|
302
306
|
*code = entry->trampoline;
|
307
|
+
#ifdef HAVE_PTRAUTH
|
308
|
+
*code = ptrauth_sign_unauthenticated (*code, ptrauth_key_asia, 0);
|
309
|
+
#endif
|
303
310
|
closure->trampoline_table = table;
|
304
311
|
closure->trampoline_table_entry = entry;
|
305
312
|
|
@@ -385,7 +392,7 @@ ffi_closure_free (void *ptr)
|
|
385
392
|
#endif
|
386
393
|
#include <string.h>
|
387
394
|
#include <stdio.h>
|
388
|
-
#if !defined(X86_WIN32) && !defined(X86_WIN64)
|
395
|
+
#if !defined(X86_WIN32) && !defined(X86_WIN64) && !defined(_M_ARM64)
|
389
396
|
#ifdef HAVE_MNTENT
|
390
397
|
#include <mntent.h>
|
391
398
|
#endif /* HAVE_MNTENT */
|
@@ -511,7 +518,7 @@ static int dlmalloc_trim(size_t) MAYBE_UNUSED;
|
|
511
518
|
static size_t dlmalloc_usable_size(void*) MAYBE_UNUSED;
|
512
519
|
static void dlmalloc_stats(void) MAYBE_UNUSED;
|
513
520
|
|
514
|
-
#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX)
|
521
|
+
#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(_M_ARM64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX)
|
515
522
|
/* Use these for mmap and munmap within dlmalloc.c. */
|
516
523
|
static void *dlmmap(void *, size_t, int, int, int, off_t);
|
517
524
|
static int dlmunmap(void *, size_t);
|
@@ -525,7 +532,7 @@ static int dlmunmap(void *, size_t);
|
|
525
532
|
#undef mmap
|
526
533
|
#undef munmap
|
527
534
|
|
528
|
-
#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX)
|
535
|
+
#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(_M_ARM64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX)
|
529
536
|
|
530
537
|
/* A mutex used to synchronize access to *exec* variables in this file. */
|
531
538
|
static pthread_mutex_t open_temp_exec_file_mutex = PTHREAD_MUTEX_INITIALIZER;
|
@@ -789,7 +796,13 @@ dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset)
|
|
789
796
|
close (execfd);
|
790
797
|
goto retry_open;
|
791
798
|
}
|
792
|
-
ftruncate (execfd, offset)
|
799
|
+
if (ftruncate (execfd, offset) != 0)
|
800
|
+
{
|
801
|
+
/* Fixme : Error logs can be added here. Returning an error for
|
802
|
+
* ftruncte() will not add any advantage as it is being
|
803
|
+
* validating in the error case. */
|
804
|
+
}
|
805
|
+
|
793
806
|
return MFAIL;
|
794
807
|
}
|
795
808
|
else if (!offset
|
@@ -801,7 +814,12 @@ dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset)
|
|
801
814
|
if (start == MFAIL)
|
802
815
|
{
|
803
816
|
munmap (ptr, length);
|
804
|
-
ftruncate (execfd, offset)
|
817
|
+
if (ftruncate (execfd, offset) != 0)
|
818
|
+
{
|
819
|
+
/* Fixme : Error logs can be added here. Returning an error for
|
820
|
+
* ftruncte() will not add any advantage as it is being
|
821
|
+
* validating in the error case. */
|
822
|
+
}
|
805
823
|
return start;
|
806
824
|
}
|
807
825
|
|
@@ -896,7 +914,7 @@ segment_holding_code (mstate m, char* addr)
|
|
896
914
|
}
|
897
915
|
#endif
|
898
916
|
|
899
|
-
#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */
|
917
|
+
#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(_M_ARM64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */
|
900
918
|
|
901
919
|
/* Allocate a chunk of memory with the given size. Returns a pointer
|
902
920
|
to the writable address, and sets *CODE to the executable
|
@@ -909,7 +927,7 @@ ffi_closure_alloc (size_t size, void **code)
|
|
909
927
|
if (!code)
|
910
928
|
return NULL;
|
911
929
|
|
912
|
-
ptr = dlmalloc (size);
|
930
|
+
ptr = FFI_CLOSURE_PTR (dlmalloc (size));
|
913
931
|
|
914
932
|
if (ptr)
|
915
933
|
{
|
@@ -921,6 +939,20 @@ ffi_closure_alloc (size_t size, void **code)
|
|
921
939
|
return ptr;
|
922
940
|
}
|
923
941
|
|
942
|
+
void *
|
943
|
+
ffi_data_to_code_pointer (void *data)
|
944
|
+
{
|
945
|
+
msegmentptr seg = segment_holding (gm, data);
|
946
|
+
/* We expect closures to be allocated with ffi_closure_alloc(), in
|
947
|
+
which case seg will be non-NULL. However, some users take on the
|
948
|
+
burden of managing this memory themselves, in which case this
|
949
|
+
we'll just return data. */
|
950
|
+
if (seg)
|
951
|
+
return add_segment_exec_offset (data, seg);
|
952
|
+
else
|
953
|
+
return data;
|
954
|
+
}
|
955
|
+
|
924
956
|
/* Release a chunk of memory allocated with ffi_closure_alloc. If
|
925
957
|
FFI_CLOSURE_FREE_CODE is nonzero, the given address can be the
|
926
958
|
writable or the executable address given. Otherwise, only the
|
@@ -935,7 +967,7 @@ ffi_closure_free (void *ptr)
|
|
935
967
|
ptr = sub_segment_exec_offset (ptr, seg);
|
936
968
|
#endif
|
937
969
|
|
938
|
-
dlfree (ptr);
|
970
|
+
dlfree (FFI_RESTORE_PTR (ptr));
|
939
971
|
}
|
940
972
|
|
941
973
|
# else /* ! FFI_MMAP_EXEC_WRIT */
|
@@ -951,13 +983,19 @@ ffi_closure_alloc (size_t size, void **code)
|
|
951
983
|
if (!code)
|
952
984
|
return NULL;
|
953
985
|
|
954
|
-
return *code = malloc (size);
|
986
|
+
return *code = FFI_CLOSURE_PTR (malloc (size));
|
955
987
|
}
|
956
988
|
|
957
989
|
void
|
958
990
|
ffi_closure_free (void *ptr)
|
959
991
|
{
|
960
|
-
free (ptr);
|
992
|
+
free (FFI_RESTORE_PTR (ptr));
|
993
|
+
}
|
994
|
+
|
995
|
+
void *
|
996
|
+
ffi_data_to_code_pointer (void *data)
|
997
|
+
{
|
998
|
+
return data;
|
961
999
|
}
|
962
1000
|
|
963
1001
|
# endif /* ! FFI_MMAP_EXEC_WRIT */
|
@@ -107,7 +107,7 @@ void *ffi_prep_args(char *stack, extended_cif *ecif)
|
|
107
107
|
count += z;
|
108
108
|
}
|
109
109
|
|
110
|
-
return (stack + ((count > 24) ? 24 :
|
110
|
+
return (stack + ((count > 24) ? 24 : FFI_ALIGN_DOWN(count, 8)));
|
111
111
|
}
|
112
112
|
|
113
113
|
/* Perform machine dependent cif processing */
|
@@ -61,7 +61,7 @@ unsigned int ffi_prep_args(char *stack, extended_cif *ecif)
|
|
61
61
|
argp -= z;
|
62
62
|
|
63
63
|
/* Align if necessary */
|
64
|
-
argp = (char *)
|
64
|
+
argp = (char *) FFI_ALIGN_DOWN(FFI_ALIGN_DOWN(argp, (*p_arg)->alignment), 4);
|
65
65
|
|
66
66
|
if (z < sizeof(int)) {
|
67
67
|
z = sizeof(int);
|
@@ -282,9 +282,11 @@ $LCFI12:
|
|
282
282
|
li $13, 1 # FFI_O32
|
283
283
|
bne $16, $13, 1f # Skip fp save if FFI_O32_SOFT_FLOAT
|
284
284
|
|
285
|
+
#ifndef __mips_soft_float
|
285
286
|
# Store all possible float/double registers.
|
286
287
|
s.d $f12, FA_0_0_OFF2($fp)
|
287
288
|
s.d $f14, FA_1_0_OFF2($fp)
|
289
|
+
#endif
|
288
290
|
1:
|
289
291
|
# prepare arguments for ffi_closure_mips_inner_O32
|
290
292
|
REG_L a0, 4($15) # cif
|
@@ -100,7 +100,7 @@ void *ffi_prep_args(char *stack, extended_cif *ecif)
|
|
100
100
|
count += z;
|
101
101
|
}
|
102
102
|
|
103
|
-
return (stack + ((count > 24) ? 24 :
|
103
|
+
return (stack + ((count > 24) ? 24 : FFI_ALIGN_DOWN(count, 8)));
|
104
104
|
}
|
105
105
|
|
106
106
|
/* Perform machine dependent cif processing */
|
@@ -421,12 +421,15 @@ ffi_status ffi_closure_inner_pa32(ffi_closure *closure, UINT32 *stack)
|
|
421
421
|
ffi_cif *cif;
|
422
422
|
void **avalue;
|
423
423
|
void *rvalue;
|
424
|
-
|
424
|
+
/* Functions can return up to 64-bits in registers. Return address
|
425
|
+
must be double word aligned. */
|
426
|
+
union { double rd; UINT32 ret[2]; } u;
|
425
427
|
ffi_type **p_arg;
|
426
428
|
char *tmp;
|
427
429
|
int i, avn;
|
428
430
|
unsigned int slot = FIRST_ARG_SLOT;
|
429
431
|
register UINT32 r28 asm("r28");
|
432
|
+
ffi_closure *c = (ffi_closure *)FFI_RESTORE_PTR (closure);
|
430
433
|
|
431
434
|
cif = closure->cif;
|
432
435
|
|
@@ -434,7 +437,7 @@ ffi_status ffi_closure_inner_pa32(ffi_closure *closure, UINT32 *stack)
|
|
434
437
|
if (cif->flags == FFI_TYPE_STRUCT)
|
435
438
|
rvalue = (void *)r28;
|
436
439
|
else
|
437
|
-
rvalue = &
|
440
|
+
rvalue = &u;
|
438
441
|
|
439
442
|
avalue = (void **)alloca(cif->nargs * FFI_SIZEOF_ARG);
|
440
443
|
avn = cif->nargs;
|
@@ -529,35 +532,35 @@ ffi_status ffi_closure_inner_pa32(ffi_closure *closure, UINT32 *stack)
|
|
529
532
|
}
|
530
533
|
|
531
534
|
/* Invoke the closure. */
|
532
|
-
(
|
535
|
+
(c->fun) (cif, rvalue, avalue, c->user_data);
|
533
536
|
|
534
|
-
debug(3, "after calling function, ret[0] = %08x, ret[1] = %08x\n", ret[0],
|
535
|
-
ret[1]);
|
537
|
+
debug(3, "after calling function, ret[0] = %08x, ret[1] = %08x\n", u.ret[0],
|
538
|
+
u.ret[1]);
|
536
539
|
|
537
540
|
/* Store the result using the lower 2 bytes of the flags. */
|
538
541
|
switch (cif->flags)
|
539
542
|
{
|
540
543
|
case FFI_TYPE_UINT8:
|
541
|
-
*(stack - FIRST_ARG_SLOT) = (UINT8)(ret[0] >> 24);
|
544
|
+
*(stack - FIRST_ARG_SLOT) = (UINT8)(u.ret[0] >> 24);
|
542
545
|
break;
|
543
546
|
case FFI_TYPE_SINT8:
|
544
|
-
*(stack - FIRST_ARG_SLOT) = (SINT8)(ret[0] >> 24);
|
547
|
+
*(stack - FIRST_ARG_SLOT) = (SINT8)(u.ret[0] >> 24);
|
545
548
|
break;
|
546
549
|
case FFI_TYPE_UINT16:
|
547
|
-
*(stack - FIRST_ARG_SLOT) = (UINT16)(ret[0] >> 16);
|
550
|
+
*(stack - FIRST_ARG_SLOT) = (UINT16)(u.ret[0] >> 16);
|
548
551
|
break;
|
549
552
|
case FFI_TYPE_SINT16:
|
550
|
-
*(stack - FIRST_ARG_SLOT) = (SINT16)(ret[0] >> 16);
|
553
|
+
*(stack - FIRST_ARG_SLOT) = (SINT16)(u.ret[0] >> 16);
|
551
554
|
break;
|
552
555
|
case FFI_TYPE_INT:
|
553
556
|
case FFI_TYPE_SINT32:
|
554
557
|
case FFI_TYPE_UINT32:
|
555
|
-
*(stack - FIRST_ARG_SLOT) = ret[0];
|
558
|
+
*(stack - FIRST_ARG_SLOT) = u.ret[0];
|
556
559
|
break;
|
557
560
|
case FFI_TYPE_SINT64:
|
558
561
|
case FFI_TYPE_UINT64:
|
559
|
-
*(stack - FIRST_ARG_SLOT) = ret[0];
|
560
|
-
*(stack - FIRST_ARG_SLOT - 1) = ret[1];
|
562
|
+
*(stack - FIRST_ARG_SLOT) = u.ret[0];
|
563
|
+
*(stack - FIRST_ARG_SLOT - 1) = u.ret[1];
|
561
564
|
break;
|
562
565
|
|
563
566
|
case FFI_TYPE_DOUBLE:
|
@@ -577,7 +580,7 @@ ffi_status ffi_closure_inner_pa32(ffi_closure *closure, UINT32 *stack)
|
|
577
580
|
case FFI_TYPE_SMALL_STRUCT4:
|
578
581
|
tmp = (void*)(stack - FIRST_ARG_SLOT);
|
579
582
|
tmp += 4 - cif->rtype->size;
|
580
|
-
memcpy((void*)tmp, &
|
583
|
+
memcpy((void*)tmp, &u, cif->rtype->size);
|
581
584
|
break;
|
582
585
|
|
583
586
|
case FFI_TYPE_SMALL_STRUCT5:
|
@@ -598,7 +601,7 @@ ffi_status ffi_closure_inner_pa32(ffi_closure *closure, UINT32 *stack)
|
|
598
601
|
}
|
599
602
|
|
600
603
|
memset (ret2, 0, sizeof (ret2));
|
601
|
-
memcpy ((char *)ret2 + off,
|
604
|
+
memcpy ((char *)ret2 + off, &u, 8 - off);
|
602
605
|
|
603
606
|
*(stack - FIRST_ARG_SLOT) = ret2[0];
|
604
607
|
*(stack - FIRST_ARG_SLOT - 1) = ret2[1];
|
@@ -630,89 +633,41 @@ ffi_prep_closure_loc (ffi_closure* closure,
|
|
630
633
|
void *user_data,
|
631
634
|
void *codeloc)
|
632
635
|
{
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
636
|
+
ffi_closure *c = (ffi_closure *)FFI_RESTORE_PTR (closure);
|
637
|
+
|
638
|
+
/* The layout of a function descriptor. A function pointer with the PLABEL
|
639
|
+
bit set points to a function descriptor. */
|
640
|
+
struct pa32_fd
|
641
|
+
{
|
642
|
+
UINT32 code_pointer;
|
643
|
+
UINT32 gp;
|
644
|
+
};
|
645
|
+
|
646
|
+
struct ffi_pa32_trampoline_struct
|
647
|
+
{
|
648
|
+
UINT32 code_pointer; /* Pointer to ffi_closure_unix. */
|
649
|
+
UINT32 fake_gp; /* Pointer to closure, installed as gp. */
|
650
|
+
UINT32 real_gp; /* Real gp value. */
|
651
|
+
};
|
652
|
+
|
653
|
+
struct ffi_pa32_trampoline_struct *tramp;
|
654
|
+
struct pa32_fd *fd;
|
637
655
|
|
638
656
|
if (cif->abi != FFI_PA32)
|
639
657
|
return FFI_BAD_ABI;
|
640
658
|
|
641
|
-
/*
|
642
|
-
|
643
|
-
|
644
|
-
#ifdef PA_LINUX
|
645
|
-
tramp[0] = 0xeaa00000; /* b,l .+8,%r21 ; %r21 <- pc+8 */
|
646
|
-
tramp[1] = 0xd6a01c1e; /* depi 0,31,2,%r21 ; mask priv bits */
|
647
|
-
tramp[2] = 0x4aa10028; /* ldw 20(%r21),%r1 ; load plabel */
|
648
|
-
tramp[3] = 0x36b53ff1; /* ldo -8(%r21),%r21 ; get closure addr */
|
649
|
-
tramp[4] = 0x0c201096; /* ldw 0(%r1),%r22 ; address of handler */
|
650
|
-
tramp[5] = 0xeac0c000; /* bv%r0(%r22) ; branch to handler */
|
651
|
-
tramp[6] = 0x0c281093; /* ldw 4(%r1),%r19 ; GP of handler */
|
652
|
-
tramp[7] = ((UINT32)(ffi_closure_pa32) & ~2);
|
653
|
-
|
654
|
-
/* Flush d/icache -- have to flush up 2 two lines because of
|
655
|
-
alignment. */
|
656
|
-
__asm__ volatile(
|
657
|
-
"fdc 0(%0)\n\t"
|
658
|
-
"fdc %1(%0)\n\t"
|
659
|
-
"fic 0(%%sr4, %0)\n\t"
|
660
|
-
"fic %1(%%sr4, %0)\n\t"
|
661
|
-
"sync\n\t"
|
662
|
-
"nop\n\t"
|
663
|
-
"nop\n\t"
|
664
|
-
"nop\n\t"
|
665
|
-
"nop\n\t"
|
666
|
-
"nop\n\t"
|
667
|
-
"nop\n\t"
|
668
|
-
"nop\n"
|
669
|
-
:
|
670
|
-
: "r"((unsigned long)tramp & ~31),
|
671
|
-
"r"(32 /* stride */)
|
672
|
-
: "memory");
|
673
|
-
#endif
|
659
|
+
/* Get function descriptor address for ffi_closure_pa32. */
|
660
|
+
fd = (struct pa32_fd *)((UINT32)ffi_closure_pa32 & ~3);
|
674
661
|
|
675
|
-
|
676
|
-
tramp
|
677
|
-
tramp
|
678
|
-
tramp
|
679
|
-
tramp
|
680
|
-
tramp[4] = 0x0c201096; /* ldw 0(%r1),%r22 ; address of handler */
|
681
|
-
tramp[5] = 0x02c010b4; /* ldsid (%r22),%r20 ; load space id */
|
682
|
-
tramp[6] = 0x00141820; /* mtsp %r20,%sr0 ; into %sr0 */
|
683
|
-
tramp[7] = 0xe2c00000; /* be 0(%sr0,%r22) ; branch to handler */
|
684
|
-
tramp[8] = 0x0c281093; /* ldw 4(%r1),%r19 ; GP of handler */
|
685
|
-
tramp[9] = ((UINT32)(ffi_closure_pa32) & ~2);
|
686
|
-
|
687
|
-
/* Flush d/icache -- have to flush three lines because of alignment. */
|
688
|
-
__asm__ volatile(
|
689
|
-
"copy %1,%0\n\t"
|
690
|
-
"fdc,m %2(%0)\n\t"
|
691
|
-
"fdc,m %2(%0)\n\t"
|
692
|
-
"fdc,m %2(%0)\n\t"
|
693
|
-
"ldsid (%1),%0\n\t"
|
694
|
-
"mtsp %0,%%sr0\n\t"
|
695
|
-
"copy %1,%0\n\t"
|
696
|
-
"fic,m %2(%%sr0,%0)\n\t"
|
697
|
-
"fic,m %2(%%sr0,%0)\n\t"
|
698
|
-
"fic,m %2(%%sr0,%0)\n\t"
|
699
|
-
"sync\n\t"
|
700
|
-
"nop\n\t"
|
701
|
-
"nop\n\t"
|
702
|
-
"nop\n\t"
|
703
|
-
"nop\n\t"
|
704
|
-
"nop\n\t"
|
705
|
-
"nop\n\t"
|
706
|
-
"nop\n"
|
707
|
-
: "=&r" ((unsigned long)tmp)
|
708
|
-
: "r" ((unsigned long)tramp & ~31),
|
709
|
-
"r" (32/* stride */)
|
710
|
-
: "memory");
|
711
|
-
#endif
|
662
|
+
/* Setup trampoline. */
|
663
|
+
tramp = (struct ffi_pa32_trampoline_struct *)c->tramp;
|
664
|
+
tramp->code_pointer = fd->code_pointer;
|
665
|
+
tramp->fake_gp = (UINT32)codeloc & ~3;
|
666
|
+
tramp->real_gp = fd->gp;
|
712
667
|
|
713
|
-
|
714
|
-
|
715
|
-
|
668
|
+
c->cif = cif;
|
669
|
+
c->user_data = user_data;
|
670
|
+
c->fun = fun;
|
716
671
|
|
717
672
|
return FFI_OK;
|
718
673
|
}
|
@@ -68,12 +68,7 @@ typedef enum ffi_abi {
|
|
68
68
|
|
69
69
|
#define FFI_CLOSURES 1
|
70
70
|
#define FFI_NATIVE_RAW_API 0
|
71
|
-
|
72
|
-
#ifdef PA_LINUX
|
73
|
-
#define FFI_TRAMPOLINE_SIZE 32
|
74
|
-
#else
|
75
|
-
#define FFI_TRAMPOLINE_SIZE 40
|
76
|
-
#endif
|
71
|
+
#define FFI_TRAMPOLINE_SIZE 12
|
77
72
|
|
78
73
|
#define FFI_TYPE_SMALL_STRUCT2 -1
|
79
74
|
#define FFI_TYPE_SMALL_STRUCT3 -2
|
@@ -259,7 +259,7 @@ L$done
|
|
259
259
|
L$FE1
|
260
260
|
|
261
261
|
/* void ffi_closure_pa32(void);
|
262
|
-
Called with closure argument in %
|
262
|
+
Called with closure argument in %r19 */
|
263
263
|
|
264
264
|
.SPACE $TEXT$
|
265
265
|
.SUBSPA $CODE$
|
@@ -285,7 +285,9 @@ L$CFI22
|
|
285
285
|
stw %arg2, -44(%r3)
|
286
286
|
stw %arg3, -48(%r3)
|
287
287
|
|
288
|
-
|
288
|
+
/* Retrieve closure pointer and real gp. */
|
289
|
+
copy %r19, %arg0
|
290
|
+
ldw 8(%r19), %r19
|
289
291
|
bl ffi_closure_inner_pa32, %r2
|
290
292
|
copy %r3, %arg1
|
291
293
|
ldwm -64(%sp), %r3
|
@@ -252,7 +252,7 @@ ffi_call_pa32:
|
|
252
252
|
.LFE1:
|
253
253
|
|
254
254
|
/* void ffi_closure_pa32(void);
|
255
|
-
Called with closure argument in %
|
255
|
+
Called with closure argument in %r19 */
|
256
256
|
.export ffi_closure_pa32,code
|
257
257
|
.import ffi_closure_inner_pa32,code
|
258
258
|
|
@@ -277,7 +277,9 @@ ffi_closure_pa32:
|
|
277
277
|
stw %arg2, -44(%r3)
|
278
278
|
stw %arg3, -48(%r3)
|
279
279
|
|
280
|
-
|
280
|
+
/* Retrieve closure pointer and real gp. */
|
281
|
+
copy %r19, %arg0
|
282
|
+
ldw 8(%r19), %r19
|
281
283
|
bl ffi_closure_inner_pa32, %r2
|
282
284
|
copy %r3, %arg1
|
283
285
|
|
@@ -297,10 +299,18 @@ ffi_closure_pa32:
|
|
297
299
|
.LSCIE1:
|
298
300
|
.word 0x0 ;# CIE Identifier Tag
|
299
301
|
.byte 0x1 ;# CIE Version
|
302
|
+
#ifdef __PIC__
|
303
|
+
.ascii "zR\0" ;# CIE Augmentation: 'z' - data, 'R' - DW_EH_PE_... data
|
304
|
+
#else
|
300
305
|
.ascii "\0" ;# CIE Augmentation
|
306
|
+
#endif
|
301
307
|
.uleb128 0x1 ;# CIE Code Alignment Factor
|
302
308
|
.sleb128 4 ;# CIE Data Alignment Factor
|
303
309
|
.byte 0x2 ;# CIE RA Column
|
310
|
+
#ifdef __PIC__
|
311
|
+
.uleb128 0x1 ;# Augmentation size
|
312
|
+
.byte 0x1b ;# FDE Encoding (DW_EH_PE_pcrel|DW_EH_PE_sdata4)
|
313
|
+
#endif
|
304
314
|
.byte 0xc ;# DW_CFA_def_cfa
|
305
315
|
.uleb128 0x1e
|
306
316
|
.uleb128 0x0
|
@@ -310,9 +320,15 @@ ffi_closure_pa32:
|
|
310
320
|
.word .LEFDE1-.LASFDE1 ;# FDE Length
|
311
321
|
.LASFDE1:
|
312
322
|
.word .LASFDE1-.Lframe1 ;# FDE CIE offset
|
313
|
-
|
323
|
+
#ifdef __PIC__
|
324
|
+
.word .LFB1-. ;# FDE initial location
|
325
|
+
#else
|
326
|
+
.word .LFB1 ;# FDE initial location
|
327
|
+
#endif
|
314
328
|
.word .LFE1-.LFB1 ;# FDE address range
|
315
|
-
|
329
|
+
#ifdef __PIC__
|
330
|
+
.uleb128 0x0 ;# Augmentation size: no data
|
331
|
+
#endif
|
316
332
|
.byte 0x4 ;# DW_CFA_advance_loc4
|
317
333
|
.word .LCFI11-.LFB1
|
318
334
|
.byte 0x83 ;# DW_CFA_offset, column 0x3
|
@@ -338,8 +354,15 @@ ffi_closure_pa32:
|
|
338
354
|
.word .LEFDE2-.LASFDE2 ;# FDE Length
|
339
355
|
.LASFDE2:
|
340
356
|
.word .LASFDE2-.Lframe1 ;# FDE CIE offset
|
357
|
+
#ifdef __PIC__
|
358
|
+
.word .LFB2-. ;# FDE initial location
|
359
|
+
#else
|
341
360
|
.word .LFB2 ;# FDE initial location
|
361
|
+
#endif
|
342
362
|
.word .LFE2-.LFB2 ;# FDE address range
|
363
|
+
#ifdef __PIC__
|
364
|
+
.uleb128 0x0 ;# Augmentation size: no data
|
365
|
+
#endif
|
343
366
|
.byte 0x4 ;# DW_CFA_advance_loc4
|
344
367
|
.word .LCFI21-.LFB2
|
345
368
|
.byte 0x83 ;# DW_CFA_offset, column 0x3
|