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/Struct.h
CHANGED
@@ -34,11 +34,7 @@
|
|
34
34
|
#include "extconf.h"
|
35
35
|
#include "AbstractMemory.h"
|
36
36
|
#include "Type.h"
|
37
|
-
#ifdef RUBY_1_9
|
38
37
|
#include <ruby/st.h>
|
39
|
-
#else
|
40
|
-
#include <st.h>
|
41
|
-
#endif
|
42
38
|
|
43
39
|
#ifdef __cplusplus
|
44
40
|
extern "C" {
|
@@ -73,11 +69,21 @@ extern "C" {
|
|
73
69
|
int size;
|
74
70
|
int align;
|
75
71
|
ffi_type** ffiTypes;
|
76
|
-
|
72
|
+
|
73
|
+
/*
|
74
|
+
* We use the fieldName's minor 8 Bits as index to a 256 entry cache.
|
75
|
+
* This avoids full ruby hash lookups for repeated lookups.
|
76
|
+
*/
|
77
|
+
#define FIELD_CACHE_LOOKUP(this, sym) ( &(this)->cache_row[((sym) >> 8) & 0xff] )
|
78
|
+
|
79
|
+
struct field_cache_entry {
|
80
|
+
VALUE fieldName;
|
81
|
+
StructField *field;
|
82
|
+
} cache_row[0x100];
|
77
83
|
|
78
84
|
/** The number of reference tracking fields in this struct */
|
79
85
|
int referenceFieldCount;
|
80
|
-
|
86
|
+
|
81
87
|
VALUE rbFieldNames;
|
82
88
|
VALUE rbFieldMap;
|
83
89
|
VALUE rbFields;
|
data/ext/ffi_c/StructByValue.c
CHANGED
@@ -32,13 +32,8 @@
|
|
32
32
|
#endif
|
33
33
|
#include <sys/types.h>
|
34
34
|
#include <stdio.h>
|
35
|
-
#
|
36
|
-
#
|
37
|
-
# include <stdbool.h>
|
38
|
-
#else
|
39
|
-
# include "win32/stdbool.h"
|
40
|
-
# include "win32/stdint.h"
|
41
|
-
#endif
|
35
|
+
#include <stdint.h>
|
36
|
+
#include <stdbool.h>
|
42
37
|
#include <errno.h>
|
43
38
|
#include <ruby.h>
|
44
39
|
|
data/ext/ffi_c/StructLayout.c
CHANGED
@@ -32,12 +32,9 @@
|
|
32
32
|
|
33
33
|
#ifndef _MSC_VER
|
34
34
|
# include <sys/param.h>
|
35
|
-
# include <stdint.h>
|
36
|
-
# include <stdbool.h>
|
37
|
-
#else
|
38
|
-
# include "win32/stdbool.h"
|
39
|
-
# include "win32/stdint.h"
|
40
35
|
#endif
|
36
|
+
#include <stdint.h>
|
37
|
+
#include <stdbool.h>
|
41
38
|
#include <ruby.h>
|
42
39
|
#include "rbffi.h"
|
43
40
|
#include "compat.h"
|
@@ -126,7 +123,6 @@ struct_field_initialize(int argc, VALUE* argv, VALUE self)
|
|
126
123
|
|
127
124
|
switch (field->type->nativeType == NATIVE_MAPPED ? ((MappedType *) field->type)->type->nativeType : field->type->nativeType) {
|
128
125
|
case NATIVE_FUNCTION:
|
129
|
-
case NATIVE_CALLBACK:
|
130
126
|
case NATIVE_POINTER:
|
131
127
|
field->referenceRequired = true;
|
132
128
|
break;
|
@@ -138,7 +134,7 @@ struct_field_initialize(int argc, VALUE* argv, VALUE self)
|
|
138
134
|
&& RTEST(rb_funcall2(rbType, rb_intern("reference_required?"), 0, NULL)));
|
139
135
|
break;
|
140
136
|
}
|
141
|
-
|
137
|
+
|
142
138
|
return self;
|
143
139
|
}
|
144
140
|
|
@@ -239,7 +235,7 @@ static VALUE
|
|
239
235
|
struct_field_put(VALUE self, VALUE pointer, VALUE value)
|
240
236
|
{
|
241
237
|
StructField* f;
|
242
|
-
|
238
|
+
|
243
239
|
Data_Get_Struct(self, StructField, f);
|
244
240
|
if (f->memoryOp == NULL) {
|
245
241
|
rb_raise(rb_eArgError, "put not supported for %s", rb_obj_classname(f->rbType));
|
@@ -261,7 +257,7 @@ static VALUE
|
|
261
257
|
function_field_get(VALUE self, VALUE pointer)
|
262
258
|
{
|
263
259
|
StructField* f;
|
264
|
-
|
260
|
+
|
265
261
|
Data_Get_Struct(self, StructField, f);
|
266
262
|
|
267
263
|
return rbffi_Function_NewInstance(f->rbType, (*rbffi_AbstractMemoryOps.pointer->get)(MEMORY(pointer), f->offset));
|
@@ -272,7 +268,7 @@ function_field_get(VALUE self, VALUE pointer)
|
|
272
268
|
* @param [AbstractMemory] pointer pointer to a {Struct}
|
273
269
|
* @param [Function, Proc] proc
|
274
270
|
* @return [Function]
|
275
|
-
* Set a {Function} to memory pointed by +pointer+ as a function.
|
271
|
+
* Set a {Function} to memory pointed by +pointer+ as a function.
|
276
272
|
*
|
277
273
|
* If a Proc is submitted as +proc+, it is automatically transformed to a {Function}.
|
278
274
|
*/
|
@@ -339,19 +335,24 @@ array_field_put(VALUE self, VALUE pointer, VALUE value)
|
|
339
335
|
{
|
340
336
|
StructField* f;
|
341
337
|
ArrayType* array;
|
342
|
-
|
338
|
+
|
343
339
|
|
344
340
|
Data_Get_Struct(self, StructField, f);
|
345
341
|
Data_Get_Struct(f->rbType, ArrayType, array);
|
346
|
-
|
342
|
+
|
347
343
|
if (isCharArray(array) && rb_obj_is_instance_of(value, rb_cString)) {
|
348
344
|
VALUE argv[2];
|
349
345
|
|
350
346
|
argv[0] = INT2FIX(f->offset);
|
351
347
|
argv[1] = value;
|
352
348
|
|
353
|
-
|
354
|
-
|
349
|
+
if (RSTRING_LEN(value) < array->length) {
|
350
|
+
rb_funcall2(pointer, rb_intern("put_string"), 2, argv);
|
351
|
+
} else if (RSTRING_LEN(value) == array->length) {
|
352
|
+
rb_funcall2(pointer, rb_intern("put_bytes"), 2, argv);
|
353
|
+
} else {
|
354
|
+
rb_raise(rb_eIndexError, "String is longer (%ld bytes) than the char array (%d bytes)", RSTRING_LEN(value), array->length);
|
355
|
+
}
|
355
356
|
} else {
|
356
357
|
#ifdef notyet
|
357
358
|
MemoryOp* op;
|
@@ -419,7 +420,6 @@ struct_layout_allocate(VALUE klass)
|
|
419
420
|
layout->rbFieldMap = Qnil;
|
420
421
|
layout->rbFieldNames = Qnil;
|
421
422
|
layout->rbFields = Qnil;
|
422
|
-
layout->fieldSymbolTable = st_init_numtable();
|
423
423
|
layout->base.ffiType = xcalloc(1, sizeof(*layout->base.ffiType));
|
424
424
|
layout->base.ffiType->size = 0;
|
425
425
|
layout->base.ffiType->alignment = 0;
|
@@ -488,7 +488,6 @@ struct_layout_initialize(VALUE self, VALUE fields, VALUE size, VALUE align)
|
|
488
488
|
|
489
489
|
|
490
490
|
layout->ffiTypes[i] = ftype->size > 0 ? ftype : NULL;
|
491
|
-
st_insert(layout->fieldSymbolTable, rbName, rbField);
|
492
491
|
rb_hash_aset(layout->rbFieldMap, rbName, rbField);
|
493
492
|
rb_ary_push(layout->rbFields, rbField);
|
494
493
|
rb_ary_push(layout->rbFieldNames, rbName);
|
@@ -501,14 +500,14 @@ struct_layout_initialize(VALUE self, VALUE fields, VALUE size, VALUE align)
|
|
501
500
|
return self;
|
502
501
|
}
|
503
502
|
|
504
|
-
/*
|
503
|
+
/*
|
505
504
|
* call-seq: [](field)
|
506
505
|
* @param [Symbol] field
|
507
506
|
* @return [StructLayout::Field]
|
508
507
|
* Get a field from the layout.
|
509
508
|
*/
|
510
509
|
static VALUE
|
511
|
-
struct_layout_union_bang(VALUE self)
|
510
|
+
struct_layout_union_bang(VALUE self)
|
512
511
|
{
|
513
512
|
const ffi_type *alignment_types[] = { &ffi_type_sint8, &ffi_type_sint16, &ffi_type_sint32, &ffi_type_sint64,
|
514
513
|
&ffi_type_float, &ffi_type_double, &ffi_type_longdouble, NULL };
|
@@ -602,6 +601,10 @@ struct_layout_mark(StructLayout *layout)
|
|
602
601
|
rb_gc_mark(layout->rbFieldMap);
|
603
602
|
rb_gc_mark(layout->rbFieldNames);
|
604
603
|
rb_gc_mark(layout->rbFields);
|
604
|
+
/* Clear the cache, to be safe from changes of fieldName VALUE by GC.compact.
|
605
|
+
* TODO: Move cache clearing to compactation callback provided by Ruby-2.7+.
|
606
|
+
*/
|
607
|
+
memset(&layout->cache_row, 0, sizeof(layout->cache_row));
|
605
608
|
}
|
606
609
|
|
607
610
|
static void
|
@@ -610,7 +613,6 @@ struct_layout_free(StructLayout *layout)
|
|
610
613
|
xfree(layout->ffiTypes);
|
611
614
|
xfree(layout->base.ffiType);
|
612
615
|
xfree(layout->fields);
|
613
|
-
st_free_table(layout->fieldSymbolTable);
|
614
616
|
xfree(layout);
|
615
617
|
}
|
616
618
|
|
@@ -627,7 +629,7 @@ rbffi_StructLayout_Init(VALUE moduleFFI)
|
|
627
629
|
*/
|
628
630
|
rbffi_StructLayoutClass = rb_define_class_under(moduleFFI, "StructLayout", ffi_Type);
|
629
631
|
rb_global_variable(&rbffi_StructLayoutClass);
|
630
|
-
|
632
|
+
|
631
633
|
/*
|
632
634
|
* Document-class: FFI::StructLayout::Field
|
633
635
|
* A field in a {StructLayout}.
|
data/ext/ffi_c/Thread.c
CHANGED
@@ -28,12 +28,7 @@
|
|
28
28
|
*/
|
29
29
|
|
30
30
|
#include <stddef.h>
|
31
|
-
#ifndef _MSC_VER
|
32
31
|
#include <stdbool.h>
|
33
|
-
#else
|
34
|
-
# include "win32/stdbool.h"
|
35
|
-
# include "win32/stdint.h"
|
36
|
-
#endif
|
37
32
|
|
38
33
|
#if defined(__CYGWIN__) || !defined(_WIN32)
|
39
34
|
# include <pthread.h>
|
@@ -74,9 +69,6 @@ void
|
|
74
69
|
rbffi_frame_push(rbffi_frame_t* frame)
|
75
70
|
{
|
76
71
|
memset(frame, 0, sizeof(*frame));
|
77
|
-
#ifndef HAVE_RUBY_THREAD_HAS_GVL_P
|
78
|
-
frame->has_gvl = true;
|
79
|
-
#endif
|
80
72
|
frame->exc = Qnil;
|
81
73
|
|
82
74
|
#ifdef _WIN32
|
data/ext/ffi_c/Thread.h
CHANGED
@@ -30,12 +30,7 @@
|
|
30
30
|
#ifndef RBFFI_THREAD_H
|
31
31
|
#define RBFFI_THREAD_H
|
32
32
|
|
33
|
-
#
|
34
|
-
# include <stdbool.h>
|
35
|
-
#else
|
36
|
-
# include "win32/stdbool.h"
|
37
|
-
# include "win32/stdint.h"
|
38
|
-
#endif
|
33
|
+
#include <stdbool.h>
|
39
34
|
#include <ruby.h>
|
40
35
|
#include "extconf.h"
|
41
36
|
|
@@ -66,9 +61,6 @@ typedef struct rbffi_frame {
|
|
66
61
|
struct thread_data* td;
|
67
62
|
#endif
|
68
63
|
struct rbffi_frame* prev;
|
69
|
-
#ifndef HAVE_RUBY_THREAD_HAS_GVL_P
|
70
|
-
bool has_gvl;
|
71
|
-
#endif
|
72
64
|
VALUE exc;
|
73
65
|
} rbffi_frame_t;
|
74
66
|
|
data/ext/ffi_c/Type.c
CHANGED
data/ext/ffi_c/Types.c
CHANGED
@@ -85,10 +85,9 @@ rbffi_NativeValue_ToRuby(Type* type, VALUE rbType, const void* ptr)
|
|
85
85
|
return rbffi_Pointer_NewInstance(*(void **) ptr);
|
86
86
|
case NATIVE_BOOL:
|
87
87
|
return ((unsigned char) *(ffi_arg *) ptr) ? Qtrue : Qfalse;
|
88
|
-
|
89
|
-
case NATIVE_FUNCTION:
|
90
|
-
|
91
|
-
return *(void **) ptr != NULL
|
88
|
+
|
89
|
+
case NATIVE_FUNCTION: {
|
90
|
+
return *(void **) ptr != NULL
|
92
91
|
? rbffi_Function_NewInstance(rbType, rbffi_Pointer_NewInstance(*(void **) ptr))
|
93
92
|
: Qnil;
|
94
93
|
}
|
@@ -116,15 +115,15 @@ rbffi_NativeValue_ToRuby(Type* type, VALUE rbType, const void* ptr)
|
|
116
115
|
|
117
116
|
values[0] = rbffi_NativeValue_ToRuby(m->type, m->rbType, ptr);
|
118
117
|
values[1] = Qnil;
|
119
|
-
|
118
|
+
|
120
119
|
|
121
120
|
rbReturnValue = rb_funcall2(m->rbConverter, id_from_native, 2, values);
|
122
121
|
RB_GC_GUARD(values[0]);
|
123
122
|
RB_GC_GUARD(rbType);
|
124
|
-
|
123
|
+
|
125
124
|
return rbReturnValue;
|
126
125
|
}
|
127
|
-
|
126
|
+
|
128
127
|
default:
|
129
128
|
rb_raise(rb_eRuntimeError, "Unknown type: %d", type->nativeType);
|
130
129
|
return Qnil;
|
data/ext/ffi_c/Types.h
CHANGED
@@ -51,20 +51,19 @@ typedef enum {
|
|
51
51
|
NATIVE_FLOAT64,
|
52
52
|
NATIVE_LONGDOUBLE,
|
53
53
|
NATIVE_POINTER,
|
54
|
-
NATIVE_CALLBACK,
|
55
54
|
NATIVE_FUNCTION,
|
56
55
|
NATIVE_BUFFER_IN,
|
57
56
|
NATIVE_BUFFER_OUT,
|
58
57
|
NATIVE_BUFFER_INOUT,
|
59
58
|
NATIVE_CHAR_ARRAY,
|
60
59
|
NATIVE_BOOL,
|
61
|
-
|
60
|
+
|
62
61
|
/** An immutable string. Nul terminated, but only copies in to the native function */
|
63
62
|
NATIVE_STRING,
|
64
|
-
|
63
|
+
|
65
64
|
/** The function takes a variable number of arguments */
|
66
65
|
NATIVE_VARARGS,
|
67
|
-
|
66
|
+
|
68
67
|
/** Struct-by-value param or result */
|
69
68
|
NATIVE_STRUCT,
|
70
69
|
|
data/ext/ffi_c/Variadic.c
CHANGED
@@ -33,13 +33,8 @@
|
|
33
33
|
#include <sys/types.h>
|
34
34
|
|
35
35
|
#include <stdio.h>
|
36
|
-
#
|
37
|
-
#
|
38
|
-
# include <stdbool.h>
|
39
|
-
#else
|
40
|
-
# include "win32/stdbool.h"
|
41
|
-
# include "win32/stdint.h"
|
42
|
-
#endif
|
36
|
+
#include <stdint.h>
|
37
|
+
#include <stdbool.h>
|
43
38
|
#include <ruby.h>
|
44
39
|
|
45
40
|
#include <ffi.h>
|
@@ -173,7 +168,8 @@ variadic_invoke(VALUE self, VALUE parameterTypes, VALUE parameterValues)
|
|
173
168
|
ffi_type* ffiReturnType;
|
174
169
|
Type** paramTypes;
|
175
170
|
VALUE* argv;
|
176
|
-
|
171
|
+
VALUE* callbackParameters;
|
172
|
+
int paramCount = 0, fixedCount = 0, callbackCount = 0, i;
|
177
173
|
ffi_status ffiStatus;
|
178
174
|
rbffi_frame_t frame = { 0 };
|
179
175
|
|
@@ -187,6 +183,7 @@ variadic_invoke(VALUE self, VALUE parameterTypes, VALUE parameterValues)
|
|
187
183
|
params = ALLOCA_N(FFIStorage, paramCount);
|
188
184
|
ffiValues = ALLOCA_N(void*, paramCount);
|
189
185
|
argv = ALLOCA_N(VALUE, paramCount);
|
186
|
+
callbackParameters = ALLOCA_N(VALUE, paramCount);
|
190
187
|
retval = alloca(MAX(invoker->returnType->ffiType->size, FFI_SIZEOF_ARG));
|
191
188
|
|
192
189
|
for (i = 0; i < paramCount; ++i) {
|
@@ -216,6 +213,14 @@ variadic_invoke(VALUE self, VALUE parameterTypes, VALUE parameterValues)
|
|
216
213
|
Data_Get_Struct(rbType, Type, paramTypes[i]);
|
217
214
|
break;
|
218
215
|
|
216
|
+
case NATIVE_FUNCTION:
|
217
|
+
if (!rb_obj_is_kind_of(rbType, rbffi_FunctionTypeClass)) {
|
218
|
+
VALUE typeName = rb_funcall2(rbType, rb_intern("inspect"), 0, NULL);
|
219
|
+
rb_raise(rb_eTypeError, "Incorrect parameter type (%s)", RSTRING_PTR(typeName));
|
220
|
+
}
|
221
|
+
callbackParameters[callbackCount++] = rbType;
|
222
|
+
break;
|
223
|
+
|
219
224
|
default:
|
220
225
|
break;
|
221
226
|
}
|
@@ -253,7 +258,7 @@ variadic_invoke(VALUE self, VALUE parameterTypes, VALUE parameterValues)
|
|
253
258
|
}
|
254
259
|
|
255
260
|
rbffi_SetupCallParams(paramCount, argv, -1, paramTypes, params,
|
256
|
-
ffiValues,
|
261
|
+
ffiValues, callbackParameters, callbackCount, invoker->rbEnums);
|
257
262
|
|
258
263
|
rbffi_frame_push(&frame);
|
259
264
|
|
data/ext/ffi_c/compat.h
CHANGED
data/ext/ffi_c/extconf.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
if
|
3
|
+
if RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
|
4
4
|
require 'mkmf'
|
5
5
|
require 'rbconfig'
|
6
6
|
|
@@ -8,14 +8,22 @@ if !defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
|
|
8
8
|
# We need pkg_config or ffi.h
|
9
9
|
libffi_ok = pkg_config("libffi") ||
|
10
10
|
have_header("ffi.h") ||
|
11
|
-
find_header("ffi.h", "/usr/local/include", "/usr/include/ffi"
|
11
|
+
find_header("ffi.h", "/usr/local/include", "/usr/include/ffi",
|
12
|
+
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi",
|
13
|
+
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi") ||
|
14
|
+
(find_header("ffi.h", `xcrun --sdk macosx --show-sdk-path`.strip + "/usr/include/ffi") rescue false)
|
12
15
|
|
13
|
-
# Ensure we can link to
|
14
|
-
libffi_ok &&= have_library("ffi", "
|
15
|
-
have_library("libffi", "
|
16
|
+
# Ensure we can link to ffi_prep_closure_loc
|
17
|
+
libffi_ok &&= have_library("ffi", "ffi_prep_closure_loc", [ "ffi.h" ]) ||
|
18
|
+
have_library("libffi", "ffi_prep_closure_loc", [ "ffi.h" ]) ||
|
19
|
+
have_library("libffi-8", "ffi_prep_closure_loc", [ "ffi.h" ])
|
16
20
|
|
17
|
-
|
18
|
-
|
21
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin/
|
22
|
+
have_library('libffi_convenience')
|
23
|
+
have_library('shlwapi')
|
24
|
+
end
|
25
|
+
|
26
|
+
libffi_ok
|
19
27
|
end
|
20
28
|
|
21
29
|
dir_config("ffi_c")
|
@@ -36,41 +44,45 @@ if !defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
|
|
36
44
|
abort "system libffi is not usable" unless system_libffi_usable?
|
37
45
|
end
|
38
46
|
|
39
|
-
have_header('shlwapi.h')
|
40
|
-
have_func('rb_thread_call_without_gvl') || abort("Ruby C-API function `rb_thread_call_without_gvl` is missing")
|
41
|
-
have_func('ruby_native_thread_p')
|
42
|
-
if RUBY_VERSION >= "2.3.0"
|
43
|
-
# On OSX and Linux ruby_thread_has_gvl_p() is detected but fails at runtime for ruby < 2.3.0
|
44
|
-
have_func('ruby_thread_has_gvl_p')
|
45
|
-
end
|
46
|
-
|
47
47
|
if system_libffi
|
48
48
|
have_func('ffi_prep_cif_var')
|
49
49
|
$defs << "-DHAVE_RAW_API" if have_func("ffi_raw_call") && have_func("ffi_prep_raw_closure")
|
50
50
|
else
|
51
51
|
$defs << "-DHAVE_FFI_PREP_CIF_VAR"
|
52
52
|
$defs << "-DUSE_INTERNAL_LIBFFI"
|
53
|
+
|
54
|
+
# Ensure libffi symbols aren't exported when using static libffi.
|
55
|
+
# This is to avoid interference with other gems like fiddle.
|
56
|
+
# See https://github.com/ffi/ffi/issues/835
|
57
|
+
append_ldflags "-Wl,--exclude-libs,ALL"
|
53
58
|
end
|
54
59
|
|
55
|
-
|
56
|
-
|
57
|
-
$defs << "-DFFI_BUILDING" if RbConfig::CONFIG['host_os'] =~ /mswin/ # for compatibility with newer libffi
|
60
|
+
# Some linux archs need explicit linking to pthread, see https://github.com/ffi/ffi/issues/893
|
61
|
+
append_ldflags "-pthread"
|
58
62
|
|
59
|
-
|
63
|
+
ffi_alloc_default = RbConfig::CONFIG['host_os'] =~ /darwin/i && RbConfig::CONFIG['host'] =~ /arm|aarch64/i
|
64
|
+
if enable_config('libffi-alloc', ffi_alloc_default)
|
65
|
+
$defs << "-DUSE_FFI_ALLOC"
|
66
|
+
end
|
60
67
|
|
61
|
-
$
|
68
|
+
$defs << "-DHAVE_EXTCONF_H" if $defs.empty? # needed so create_header works
|
62
69
|
|
70
|
+
create_header
|
63
71
|
create_makefile("ffi_c")
|
72
|
+
|
64
73
|
unless system_libffi
|
65
74
|
File.open("Makefile", "a") do |mf|
|
66
75
|
mf.puts "LIBFFI_HOST=--host=#{RbConfig::CONFIG['host_alias']}" if RbConfig::CONFIG.has_key?("host_alias")
|
67
|
-
if RbConfig::CONFIG['host_os']
|
76
|
+
if RbConfig::CONFIG['host_os'] =~ /darwin/i
|
77
|
+
if RbConfig::CONFIG['host'] =~ /arm|aarch64/i
|
78
|
+
mf.puts "LIBFFI_HOST=--host=aarch64-apple-#{RbConfig::CONFIG['host_os']}"
|
79
|
+
end
|
68
80
|
mf.puts "include ${srcdir}/libffi.darwin.mk"
|
69
|
-
elsif RbConfig::CONFIG['host_os']
|
81
|
+
elsif RbConfig::CONFIG['host_os'] =~ /bsd/i
|
70
82
|
mf.puts '.include "${srcdir}/libffi.bsd.mk"'
|
71
|
-
elsif RbConfig::CONFIG['host_os']
|
83
|
+
elsif RbConfig::CONFIG['host_os'] =~ /mswin64/i
|
72
84
|
mf.puts '!include $(srcdir)/libffi.vc64.mk'
|
73
|
-
elsif RbConfig::CONFIG['host_os']
|
85
|
+
elsif RbConfig::CONFIG['host_os'] =~ /mswin32/i
|
74
86
|
mf.puts '!include $(srcdir)/libffi.vc.mk'
|
75
87
|
else
|
76
88
|
mf.puts "include ${srcdir}/libffi.mk"
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# Copyright (C) 2010, 2019 Free Software Foundation, Inc.
|
2
|
+
#
|
3
|
+
# This file is part of DejaGnu.
|
4
|
+
#
|
5
|
+
# DejaGnu is free software; you can redistribute it and/or modify it
|
6
|
+
# under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation; either version 2 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# DejaGnu is distributed in the hope that it will be useful, but
|
11
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with DejaGnu; if not, write to the Free Software Foundation,
|
17
|
+
# Inc., 51 Franklin Street, Fifth Floor, MA 02110, USA.
|
18
|
+
|
19
|
+
# This is a list of toolchains that are supported on this board.
|
20
|
+
set_board_info target_install {bfin-elf}
|
21
|
+
|
22
|
+
# Load the generic configuration for this board. This will define a basic set
|
23
|
+
# of routines needed by the tool to communicate with the board.
|
24
|
+
load_generic_config "sim"
|
25
|
+
|
26
|
+
# basic-sim.exp is a basic description for the standard Cygnus simulator.
|
27
|
+
load_base_board_description "basic-sim"
|
28
|
+
|
29
|
+
# "bfin" is the name of the sim subdir in devo/sim.
|
30
|
+
setup_sim bfin
|
31
|
+
|
32
|
+
# No multilib options needed by default.
|
33
|
+
process_multilib_options ""
|
34
|
+
|
35
|
+
# We only support newlib on this target. We assume that all multilib
|
36
|
+
# options have been specified before we get here.
|
37
|
+
|
38
|
+
set_board_info compiler "[find_gcc]"
|
39
|
+
set_board_info cflags "[libgloss_include_flags] [newlib_include_flags]"
|
40
|
+
set_board_info ldflags "[libgloss_link_flags] [newlib_link_flags]"
|
41
|
+
|
42
|
+
# Configuration settings for testsuites
|
43
|
+
set_board_info noargs 1
|
44
|
+
set_board_info gdb,nosignals 1
|
45
|
+
set_board_info gdb,noresults 1
|
46
|
+
set_board_info gdb,cannot_call_functions 1
|
47
|
+
set_board_info gdb,skip_float_tests 1
|
48
|
+
set_board_info gdb,can_reverse 1
|
49
|
+
set_board_info gdb,use_precord 1
|
50
|
+
|
51
|
+
# More time is needed
|
52
|
+
set_board_info gcc,timeout 800
|
53
|
+
set_board_info gdb,timeout 60
|
54
|
+
|
55
|
+
# Used by a few gcc.c-torture testcases to delimit how large the stack can
|
56
|
+
# be.
|
57
|
+
set_board_info gcc,stack_size 5000
|
58
|
+
|
@@ -7,16 +7,6 @@ export QEMU_LD_PREFIX=/usr/${HOST}
|
|
7
7
|
./configure ${HOST+--host=$HOST --disable-shared}
|
8
8
|
make
|
9
9
|
make dist
|
10
|
-
make check RUNTESTFLAGS="-a $RUNTESTFLAGS"
|
11
|
-
|
12
|
-
gzip -c -9 */testsuite/libffi.log > libffi.log.gz
|
13
|
-
echo ================================================================
|
14
|
-
echo The logs are too long for travis to handle, so we compress and
|
15
|
-
echo uuencode them. Download, decode and uncompress if you need to
|
16
|
-
echo read them.
|
17
|
-
echo ================================================================
|
18
|
-
uuencode libffi.log.gz -
|
19
|
-
echo ================================================================
|
20
|
-
echo ================================================================
|
21
|
-
exit $EXITCODE
|
10
|
+
make check RUNTESTFLAGS="-a $RUNTESTFLAGS" || true
|
11
|
+
|
22
12
|
|