ffi 1.1.2 → 1.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +456 -0
- data/COPYING +49 -0
- data/Gemfile +21 -0
- data/LICENSE +21 -11
- data/LICENSE.SPECS +22 -0
- data/README.md +137 -0
- data/Rakefile +166 -156
- data/ext/ffi_c/AbstractMemory.c +240 -140
- data/ext/ffi_c/AbstractMemory.h +25 -15
- data/ext/ffi_c/ArrayType.c +78 -29
- data/ext/ffi_c/ArrayType.h +22 -12
- data/ext/ffi_c/Buffer.c +121 -60
- data/ext/ffi_c/Call.c +184 -137
- data/ext/ffi_c/Call.h +46 -22
- data/ext/ffi_c/ClosurePool.c +101 -43
- data/ext/ffi_c/ClosurePool.h +24 -13
- data/ext/ffi_c/DynamicLibrary.c +139 -57
- data/ext/ffi_c/DynamicLibrary.h +70 -12
- data/ext/ffi_c/Function.c +372 -273
- data/ext/ffi_c/Function.h +25 -20
- data/ext/ffi_c/FunctionInfo.c +135 -49
- data/ext/ffi_c/LastError.c +97 -30
- data/ext/ffi_c/LastError.h +21 -12
- data/ext/ffi_c/LongDouble.c +15 -9
- data/ext/ffi_c/LongDouble.h +21 -16
- data/ext/ffi_c/MappedType.c +88 -38
- data/ext/ffi_c/MappedType.h +21 -14
- data/ext/ffi_c/MemoryPointer.c +91 -38
- data/ext/ffi_c/MemoryPointer.h +22 -19
- data/ext/ffi_c/MethodHandle.c +52 -51
- data/ext/ffi_c/MethodHandle.h +24 -14
- data/ext/ffi_c/Platform.c +28 -62
- data/ext/ffi_c/Platform.h +21 -12
- data/ext/ffi_c/Pointer.c +145 -86
- data/ext/ffi_c/Pointer.h +23 -19
- data/ext/ffi_c/Struct.c +363 -163
- data/ext/ffi_c/Struct.h +39 -21
- data/ext/ffi_c/StructByValue.c +72 -37
- data/ext/ffi_c/StructByValue.h +21 -12
- data/ext/ffi_c/StructLayout.c +308 -94
- data/ext/ffi_c/Thread.c +73 -270
- data/ext/ffi_c/Thread.h +32 -35
- data/ext/ffi_c/Type.c +147 -84
- data/ext/ffi_c/Type.h +27 -11
- data/ext/ffi_c/Types.c +40 -24
- data/ext/ffi_c/Types.h +24 -21
- data/ext/ffi_c/Variadic.c +148 -64
- data/ext/ffi_c/compat.h +45 -37
- data/ext/ffi_c/extconf.rb +86 -32
- data/ext/ffi_c/ffi.c +32 -21
- data/ext/ffi_c/libffi/.allow-ai-service +0 -0
- data/ext/ffi_c/libffi/.appveyor/site.exp +16 -0
- data/ext/ffi_c/libffi/.appveyor/unix-noexec.exp +7 -0
- data/ext/ffi_c/libffi/.appveyor.yml +84 -0
- data/ext/ffi_c/libffi/.ci/ar-lib +270 -0
- data/ext/ffi_c/libffi/.ci/bfin-sim.exp +58 -0
- data/ext/ffi_c/libffi/.ci/build-cross-in-container.sh +18 -0
- data/ext/ffi_c/libffi/.ci/build-in-container.sh +10 -0
- data/ext/ffi_c/libffi/.ci/build.sh +124 -0
- data/ext/ffi_c/libffi/.ci/compile +351 -0
- data/ext/ffi_c/libffi/.ci/install.sh +78 -0
- data/ext/ffi_c/libffi/.ci/m32r-sim.exp +58 -0
- data/ext/ffi_c/libffi/.ci/moxie-sim.exp +60 -0
- data/ext/ffi_c/libffi/.ci/msvs-detect +1103 -0
- data/ext/ffi_c/libffi/.ci/or1k-sim.exp +58 -0
- data/ext/ffi_c/libffi/.ci/powerpc-eabisim.exp +58 -0
- data/ext/ffi_c/libffi/.ci/site.exp +29 -0
- data/ext/ffi_c/libffi/.ci/wine-sim.exp +55 -0
- data/ext/ffi_c/libffi/.circleci/config.yml +156 -0
- data/ext/ffi_c/libffi/.gitattributes +4 -0
- data/ext/ffi_c/libffi/.github/issue_template.md +10 -0
- data/ext/ffi_c/libffi/.github/workflows/build.yml +479 -0
- data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +172 -0
- data/ext/ffi_c/libffi/.gitignore +46 -0
- data/ext/ffi_c/libffi/{ChangeLog → ChangeLog.old} +6366 -3559
- data/ext/ffi_c/libffi/LICENSE +1 -1
- data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +353 -0
- data/ext/ffi_c/libffi/Makefile.am +131 -170
- data/ext/ffi_c/libffi/Makefile.in +1317 -1010
- data/ext/ffi_c/libffi/README.md +531 -0
- data/ext/ffi_c/libffi/acinclude.m4 +289 -4
- data/ext/ffi_c/libffi/autogen.sh +2 -0
- data/ext/ffi_c/libffi/compile +222 -17
- data/ext/ffi_c/libffi/config.guess +1033 -780
- data/ext/ffi_c/libffi/config.sub +1393 -1206
- data/ext/ffi_c/libffi/configure +16340 -10740
- data/ext/ffi_c/libffi/configure.ac +226 -271
- data/ext/ffi_c/libffi/configure.host +330 -4
- data/ext/ffi_c/libffi/doc/Makefile.am +3 -0
- data/ext/ffi_c/libffi/doc/Makefile.in +818 -0
- data/ext/ffi_c/libffi/doc/libffi.texi +525 -79
- data/ext/ffi_c/libffi/doc/version.texi +4 -4
- data/ext/ffi_c/libffi/fficonfig.h.in +41 -52
- data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +312 -0
- data/ext/ffi_c/libffi/include/Makefile.am +3 -3
- data/ext/ffi_c/libffi/include/Makefile.in +201 -79
- data/ext/ffi_c/libffi/include/ffi.h.in +190 -99
- data/ext/ffi_c/libffi/include/ffi_cfi.h +76 -0
- data/ext/ffi_c/libffi/include/ffi_common.h +72 -14
- data/ext/ffi_c/libffi/include/tramp.h +45 -0
- data/ext/ffi_c/libffi/install-sh +231 -210
- data/ext/ffi_c/libffi/libffi.map.in +81 -0
- data/ext/ffi_c/libffi/libffi.pc.in +3 -2
- data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +997 -0
- data/ext/ffi_c/libffi/libtool-ldflags +106 -0
- data/ext/ffi_c/libffi/libtool-version +2 -2
- data/ext/ffi_c/libffi/ltmain.sh +3868 -2068
- data/ext/ffi_c/libffi/m4/asmcfi.m4 +13 -0
- data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +50 -0
- data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +47 -25
- data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +110 -147
- data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +53 -0
- data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +75 -19
- data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +8 -29
- data/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 +11 -9
- data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +104 -52
- data/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 +18 -8
- data/ext/ffi_c/libffi/m4/ax_prepend_flag.m4 +51 -0
- data/ext/ffi_c/libffi/m4/ax_require_defined.m4 +37 -0
- data/ext/ffi_c/libffi/make_sunver.pl +333 -0
- data/ext/ffi_c/libffi/man/Makefile.am +2 -2
- data/ext/ffi_c/libffi/man/Makefile.in +156 -57
- data/ext/ffi_c/libffi/man/ffi.3 +10 -0
- data/ext/ffi_c/libffi/man/ffi_prep_cif.3 +6 -4
- data/ext/ffi_c/libffi/man/ffi_prep_cif_var.3 +73 -0
- data/ext/ffi_c/libffi/missing +153 -314
- 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/{include/ffi.h.vc64 → msvc_build/aarch64/aarch64_include/ffi.h} +151 -67
- data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/fficonfig.h +219 -0
- data/ext/ffi_c/libffi/msvcc.sh +176 -20
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +1142 -0
- data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +97 -0
- data/ext/ffi_c/libffi/src/aarch64/internal.h +100 -0
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +695 -0
- data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +506 -0
- data/ext/ffi_c/libffi/src/alpha/ffi.c +335 -98
- data/ext/ffi_c/libffi/src/alpha/ffitarget.h +10 -1
- data/ext/ffi_c/libffi/src/alpha/internal.h +23 -0
- data/ext/ffi_c/libffi/src/alpha/osf.S +161 -266
- data/ext/ffi_c/libffi/src/arc/arcompact.S +210 -0
- data/ext/ffi_c/libffi/src/arc/ffi.c +443 -0
- data/ext/ffi_c/libffi/src/arc/ffitarget.h +67 -0
- data/ext/ffi_c/libffi/src/arm/ffi.c +706 -513
- data/ext/ffi_c/libffi/src/arm/ffitarget.h +32 -8
- data/ext/ffi_c/libffi/src/arm/internal.h +17 -0
- data/ext/ffi_c/libffi/src/arm/sysv.S +372 -413
- data/ext/ffi_c/libffi/src/arm/sysv_msvc_arm32.S +311 -0
- data/ext/ffi_c/libffi/src/avr32/ffitarget.h +6 -1
- data/ext/ffi_c/libffi/src/bfin/ffi.c +196 -0
- data/ext/ffi_c/libffi/src/bfin/ffitarget.h +43 -0
- data/ext/ffi_c/libffi/src/bfin/sysv.S +179 -0
- data/ext/ffi_c/libffi/src/closures.c +565 -73
- data/ext/ffi_c/libffi/src/cris/ffi.c +10 -7
- data/ext/ffi_c/libffi/src/cris/ffitarget.h +6 -1
- 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/debug.c +8 -3
- data/ext/ffi_c/libffi/src/dlmalloc.c +23 -13
- data/ext/ffi_c/libffi/src/frv/ffi.c +2 -2
- data/ext/ffi_c/libffi/src/frv/ffitarget.h +6 -1
- data/ext/ffi_c/libffi/src/ia64/ffi.c +47 -13
- data/ext/ffi_c/libffi/src/ia64/ffitarget.h +8 -2
- data/ext/ffi_c/libffi/src/ia64/unix.S +28 -3
- data/ext/ffi_c/libffi/src/java_raw_api.c +23 -5
- 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/loongarch64/ffi.c +624 -0
- data/ext/ffi_c/libffi/src/loongarch64/ffitarget.h +82 -0
- data/ext/ffi_c/libffi/src/loongarch64/sysv.S +327 -0
- data/ext/ffi_c/libffi/src/m32r/ffi.c +32 -15
- data/ext/ffi_c/libffi/src/m32r/ffitarget.h +6 -1
- data/ext/ffi_c/libffi/src/m68k/ffi.c +87 -13
- data/ext/ffi_c/libffi/src/m68k/ffitarget.h +6 -1
- data/ext/ffi_c/libffi/src/m68k/sysv.S +119 -32
- data/ext/ffi_c/libffi/src/m88k/ffi.c +400 -0
- data/ext/ffi_c/libffi/src/m88k/ffitarget.h +49 -0
- data/ext/ffi_c/libffi/src/m88k/obsd.S +209 -0
- data/ext/ffi_c/libffi/src/metag/ffi.c +330 -0
- data/ext/ffi_c/libffi/{fficonfig.hw → src/metag/ffitarget.h} +22 -26
- data/ext/ffi_c/libffi/src/metag/sysv.S +311 -0
- data/ext/ffi_c/libffi/src/microblaze/ffi.c +321 -0
- data/ext/ffi_c/libffi/src/microblaze/ffitarget.h +53 -0
- data/ext/ffi_c/libffi/src/microblaze/sysv.S +302 -0
- data/ext/ffi_c/libffi/src/mips/ffi.c +382 -101
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +23 -14
- data/ext/ffi_c/libffi/src/mips/n32.S +321 -89
- data/ext/ffi_c/libffi/src/mips/o32.S +211 -31
- data/ext/ffi_c/libffi/src/moxie/eabi.S +55 -82
- data/ext/ffi_c/libffi/src/moxie/ffi.c +100 -66
- data/ext/ffi_c/libffi/src/moxie/ffitarget.h +52 -0
- data/ext/ffi_c/libffi/src/nios2/ffi.c +304 -0
- data/ext/ffi_c/libffi/src/nios2/ffitarget.h +52 -0
- data/ext/ffi_c/libffi/src/nios2/sysv.S +136 -0
- data/ext/ffi_c/libffi/src/or1k/ffi.c +341 -0
- data/ext/ffi_c/libffi/src/or1k/ffitarget.h +58 -0
- data/ext/ffi_c/libffi/src/or1k/sysv.S +107 -0
- data/ext/ffi_c/libffi/src/pa/ffi.c +62 -108
- data/ext/ffi_c/libffi/src/pa/ffi64.c +614 -0
- data/ext/ffi_c/libffi/src/pa/ffitarget.h +28 -12
- data/ext/ffi_c/libffi/src/pa/hpux32.S +87 -38
- data/ext/ffi_c/libffi/src/pa/hpux64.S +681 -0
- data/ext/ffi_c/libffi/src/pa/linux.S +109 -39
- data/ext/ffi_c/libffi/src/powerpc/aix.S +245 -7
- data/ext/ffi_c/libffi/src/powerpc/aix_closure.S +253 -4
- data/ext/ffi_c/libffi/src/powerpc/asm.h +2 -2
- data/ext/ffi_c/libffi/src/powerpc/darwin.S +2 -7
- data/ext/ffi_c/libffi/src/powerpc/darwin_closure.S +22 -26
- data/ext/ffi_c/libffi/src/powerpc/ffi.c +105 -1378
- data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +157 -52
- data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +1153 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +105 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi_sysv.c +923 -0
- data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +110 -45
- data/ext/ffi_c/libffi/src/powerpc/linux64.S +191 -85
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +438 -108
- data/ext/ffi_c/libffi/src/powerpc/ppc_closure.S +138 -68
- data/ext/ffi_c/libffi/src/powerpc/sysv.S +73 -119
- data/ext/ffi_c/libffi/src/powerpc/t-aix +5 -0
- data/ext/ffi_c/libffi/src/prep_cif.c +131 -25
- data/ext/ffi_c/libffi/src/raw_api.c +18 -5
- data/ext/ffi_c/libffi/src/riscv/ffi.c +514 -0
- data/ext/ffi_c/libffi/src/riscv/ffitarget.h +69 -0
- data/ext/ffi_c/libffi/src/riscv/sysv.S +293 -0
- data/ext/ffi_c/libffi/src/s390/ffi.c +294 -318
- data/ext/ffi_c/libffi/src/s390/ffitarget.h +9 -1
- data/ext/ffi_c/libffi/src/s390/internal.h +11 -0
- data/ext/ffi_c/libffi/src/s390/sysv.S +257 -366
- data/ext/ffi_c/libffi/src/sh/ffi.c +4 -3
- data/ext/ffi_c/libffi/src/sh/ffitarget.h +6 -1
- data/ext/ffi_c/libffi/src/sh64/ffi.c +3 -2
- data/ext/ffi_c/libffi/src/sh64/ffitarget.h +6 -1
- data/ext/ffi_c/libffi/src/sparc/ffi.c +326 -527
- data/ext/ffi_c/libffi/src/sparc/ffi64.c +630 -0
- data/ext/ffi_c/libffi/src/sparc/ffitarget.h +20 -7
- data/ext/ffi_c/libffi/src/sparc/internal.h +26 -0
- data/ext/ffi_c/libffi/src/sparc/v8.S +364 -234
- data/ext/ffi_c/libffi/src/sparc/v9.S +340 -207
- data/ext/ffi_c/libffi/src/tile/ffi.c +355 -0
- data/ext/ffi_c/libffi/src/tile/ffitarget.h +65 -0
- data/ext/ffi_c/libffi/src/tile/tile.S +360 -0
- data/ext/ffi_c/libffi/src/tramp.c +716 -0
- data/ext/ffi_c/libffi/src/types.c +48 -19
- data/ext/ffi_c/libffi/src/vax/elfbsd.S +195 -0
- data/ext/ffi_c/libffi/src/vax/ffi.c +276 -0
- data/ext/ffi_c/libffi/src/vax/ffitarget.h +49 -0
- data/ext/ffi_c/libffi/src/wasm32/ffi.c +947 -0
- data/ext/ffi_c/libffi/src/wasm32/ffitarget.h +62 -0
- data/ext/ffi_c/libffi/src/x86/asmnames.h +30 -0
- data/ext/ffi_c/libffi/src/x86/ffi.c +686 -498
- data/ext/ffi_c/libffi/src/x86/ffi64.c +444 -129
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +79 -36
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +361 -0
- data/ext/ffi_c/libffi/src/x86/internal.h +43 -0
- data/ext/ffi_c/libffi/src/x86/internal64.h +36 -0
- data/ext/ffi_c/libffi/src/x86/sysv.S +1198 -394
- data/ext/ffi_c/libffi/src/x86/sysv_intel.S +998 -0
- data/ext/ffi_c/libffi/src/x86/unix64.S +585 -300
- data/ext/ffi_c/libffi/src/x86/win64.S +244 -458
- data/ext/ffi_c/libffi/src/x86/win64_intel.S +238 -0
- data/ext/ffi_c/libffi/src/xtensa/ffi.c +306 -0
- data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +57 -0
- data/ext/ffi_c/libffi/src/xtensa/sysv.S +268 -0
- data/ext/ffi_c/libffi/stamp-h.in +1 -0
- data/ext/ffi_c/libffi/testsuite/Makefile.am +80 -73
- data/ext/ffi_c/libffi/testsuite/Makefile.in +233 -117
- data/ext/ffi_c/libffi/testsuite/emscripten/build-tests.sh +54 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/build.sh +63 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/conftest.py +86 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/node-tests.sh +48 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/test.html +7 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/test_libffi.py +51 -0
- data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +360 -28
- data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +22 -2
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/Makefile +28 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/README +78 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/alignof.h +50 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +63 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +1746 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +2885 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +747 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/align_mixed.c +46 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/align_stdcall.c +46 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/bpo_38748.c +41 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +28 -6
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback.c +99 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback2.c +108 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback3.c +114 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback4.c +119 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +52 -42
- data/ext/ffi_c/libffi/testsuite/libffi.call/float1.c +3 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +15 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/float3.c +4 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +110 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many.c +6 -16
- data/ext/ffi_c/libffi/testsuite/libffi.call/many2.c +57 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_double.c +70 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_mixed.c +78 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/negint.c +0 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c +46 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/pr1172638.c +127 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c +1 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +5 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/s55.c +60 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +9 -10
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +49 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +49 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +55 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c +9 -7
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +57 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c +7 -7
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c +7 -6
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c +9 -8
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c +9 -8
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct6.c +9 -9
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct7.c +9 -9
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct8.c +9 -8
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c +9 -8
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_2.c +63 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3.c +65 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3f.c +65 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4.c +67 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4f.c +67 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_big.c +93 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_small.c +61 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_2H.c +63 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_8H.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/uninitialized.c +61 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +78 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_2.c +220 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_3.c +154 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +134 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +134 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +140 -0
- 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 +3 -2
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn1.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn2.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn3.c +21 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn4.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn5.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn6.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_loc_fn0.c +7 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call/closure_stdcall.c → libffi.closures/closure_simple.c} +13 -16
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_12byte.c +22 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_16byte.c +26 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_18byte.c +28 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_19byte.c +33 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_1_1byte.c +8 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte1.c +25 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_24byte.c +40 -8
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_2byte.c +17 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3_1byte.c +23 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte1.c +17 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte2.c +17 -4
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3float.c +113 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4_1byte.c +26 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4byte.c +17 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5_1_byte.c +33 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5byte.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_64byte.c +29 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6_1_byte.c +32 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6byte.c +28 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7_1_byte.c +43 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7byte.c +29 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_8byte.c +18 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte1.c +18 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte2.c +18 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_double.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_float.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble.c +24 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split.c +44 -31
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split2.c +44 -9
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_pointer.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint16.c +22 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint32.c +22 -7
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint64.c +22 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint16.c +22 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint32.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint64.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_dbls_struct.c +7 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double_va.c +19 -10
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_float.c +4 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble.c +14 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble_va.c +32 -12
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_many_mixed_args.c +70 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_many_mixed_float_double.c +55 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_schar.c +5 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshort.c +6 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshortchar.c +9 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_uchar.c +9 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushort.c +6 -2
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushortchar.c +9 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer.c +6 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer_stack.c +21 -9
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_schar.c +3 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sint.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sshort.c +3 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_struct_va1.c +125 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uchar.c +3 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint_va.c +49 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulong_va.c +49 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulonglong.c +7 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort.c +3 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +1 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/huge_struct.c +41 -40
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct.c +38 -15
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct1.c +9 -9
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct10.c +19 -6
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct11.c +137 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct12.c +86 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct13.c +115 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct2.c +15 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct3.c +15 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct4.c +14 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct5.c +14 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct6.c +17 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct7.c +14 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct8.c +17 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct9.c +17 -6
- data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs1.c +86 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs2.c +102 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs3.c +101 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large.c +7 -7
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large2.c +7 -7
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium.c +6 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium2.c +6 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/testclosure.c +8 -3
- data/ext/ffi_c/libffi/testsuite/{libffi.special → libffi.closures}/unwindtest.cc +4 -10
- data/ext/ffi_c/libffi/testsuite/{libffi.special → libffi.closures}/unwindtest_ffi_call.cc +4 -2
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex.inc +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex.inc +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct.inc +71 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va.inc +80 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_float.c +16 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.special/special.exp → libffi.complex/complex.exp} +9 -8
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.inc +51 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_double.inc +7 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_float.inc +7 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_longdouble.inc +7 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_int.c +86 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/ffitest.h +1 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex.inc +78 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex.inc +37 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1.inc +41 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc +44 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/aa-direct.c +34 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/closure1.c +28 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/ffitest.h +1 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/go.exp +36 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/static-chain.h +19 -0
- data/ext/ffi_c/libffi.bsd.mk +13 -7
- data/ext/ffi_c/libffi.darwin.mk +25 -13
- data/ext/ffi_c/libffi.gnu.mk +4 -3
- data/ext/ffi_c/libffi.mk +11 -6
- data/ext/ffi_c/libffi.vc.mk +1 -1
- data/ext/ffi_c/libffi.vc64.mk +1 -1
- data/ext/ffi_c/rbffi.h +23 -15
- data/ext/ffi_c/rbffi_endian.h +11 -2
- data/ffi.gemspec +42 -0
- data/lib/ffi/abstract_memory.rb +44 -0
- data/lib/ffi/autopointer.rb +65 -68
- data/lib/ffi/compat.rb +43 -0
- data/lib/ffi/data_converter.rb +67 -0
- data/lib/ffi/dynamic_library.rb +118 -0
- data/lib/ffi/enum.rb +166 -25
- data/lib/ffi/errno.rb +21 -11
- data/lib/ffi/ffi.rb +28 -11
- data/lib/ffi/function.rb +71 -0
- data/lib/ffi/io.rb +25 -15
- data/lib/ffi/library.rb +227 -136
- data/lib/ffi/library_path.rb +109 -0
- data/lib/ffi/managedstruct.rb +64 -35
- data/lib/ffi/platform/aarch64-darwin/types.conf +130 -0
- data/lib/ffi/platform/aarch64-freebsd/types.conf +128 -0
- data/lib/ffi/platform/aarch64-freebsd12/types.conf +181 -0
- data/lib/ffi/platform/aarch64-linux/types.conf +175 -0
- data/lib/ffi/platform/aarch64-openbsd/types.conf +134 -0
- data/lib/ffi/platform/aarch64-windows/types.conf +52 -0
- data/lib/ffi/platform/arm-freebsd/types.conf +152 -0
- data/lib/ffi/platform/arm-freebsd12/types.conf +152 -0
- data/lib/ffi/platform/arm-linux/types.conf +110 -82
- data/lib/ffi/platform/hppa1.1-linux/types.conf +178 -0
- data/lib/ffi/platform/hppa2.0-linux/types.conf +178 -0
- data/lib/ffi/platform/i386-cygwin/types.conf +3 -0
- data/lib/ffi/platform/i386-darwin/types.conf +63 -63
- data/lib/ffi/platform/i386-freebsd/types.conf +89 -89
- data/lib/ffi/platform/i386-freebsd12/types.conf +152 -0
- 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 -87
- 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/loongarch64-linux/types.conf +141 -0
- data/lib/ffi/platform/mips-linux/types.conf +79 -79
- data/lib/ffi/platform/mips64-linux/types.conf +104 -0
- data/lib/ffi/platform/mips64el-linux/types.conf +104 -0
- data/lib/ffi/platform/mipsel-linux/types.conf +79 -79
- data/lib/ffi/platform/mipsisa32r6-linux/types.conf +102 -0
- data/lib/ffi/platform/mipsisa32r6el-linux/types.conf +102 -0
- data/lib/ffi/platform/mipsisa64r6-linux/types.conf +104 -0
- data/lib/ffi/platform/mipsisa64r6el-linux/types.conf +104 -0
- 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 +104 -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/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/sparcv9-linux/types.conf +102 -0
- data/lib/ffi/platform/sparcv9-openbsd/types.conf +156 -0
- data/lib/ffi/platform/sparcv9-solaris/types.conf +103 -103
- data/lib/ffi/platform/sw_64-linux/types.conf +141 -0
- data/lib/ffi/platform/x86_64-cygwin/types.conf +3 -0
- data/lib/ffi/platform/x86_64-darwin/types.conf +93 -63
- data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +130 -0
- data/lib/ffi/platform/x86_64-freebsd/types.conf +90 -88
- data/lib/ffi/platform/x86_64-freebsd12/types.conf +158 -0
- data/lib/ffi/platform/x86_64-haiku/types.conf +117 -0
- data/lib/ffi/platform/x86_64-linux/types.conf +107 -77
- data/lib/ffi/platform/x86_64-msys/types.conf +119 -0
- data/lib/ffi/platform/x86_64-netbsd/types.conf +89 -87
- data/lib/ffi/platform/x86_64-openbsd/types.conf +100 -92
- data/lib/ffi/platform/x86_64-solaris/types.conf +96 -96
- data/lib/ffi/platform/x86_64-windows/types.conf +52 -0
- data/lib/ffi/platform.rb +91 -34
- data/lib/ffi/pointer.rb +78 -33
- data/lib/ffi/struct.rb +100 -66
- data/lib/ffi/struct_by_reference.rb +72 -0
- data/lib/ffi/struct_layout.rb +96 -0
- data/lib/ffi/struct_layout_builder.rb +84 -19
- data/lib/ffi/tools/const_generator.rb +11 -8
- data/lib/ffi/tools/generator.rb +48 -1
- data/lib/ffi/tools/generator_task.rb +13 -16
- data/lib/ffi/tools/struct_generator.rb +6 -5
- data/lib/ffi/tools/types_generator.rb +14 -10
- data/lib/ffi/types.rb +96 -51
- data/lib/ffi/union.rb +23 -12
- data/lib/ffi/variadic.rb +44 -29
- data/lib/ffi/version.rb +3 -0
- data/lib/ffi.rb +20 -8
- data/rakelib/ffi_gem_helper.rb +65 -0
- data/samples/getlogin.rb +8 -0
- data/samples/getpid.rb +8 -0
- data/samples/gettimeofday.rb +18 -0
- data/samples/hello.rb +8 -0
- data/samples/hello_ractor.rb +11 -0
- data/samples/inotify.rb +60 -0
- data/samples/pty.rb +75 -0
- data/samples/qsort.rb +20 -0
- data/samples/qsort_ractor.rb +28 -0
- data/sig/ffi/abstract_memory.rbs +165 -0
- data/sig/ffi/auto_pointer.rbs +27 -0
- data/sig/ffi/buffer.rbs +18 -0
- data/sig/ffi/data_converter.rbs +10 -0
- data/sig/ffi/dynamic_library.rbs +9 -0
- data/sig/ffi/enum.rbs +38 -0
- data/sig/ffi/function.rbs +39 -0
- data/sig/ffi/library.rbs +42 -0
- data/sig/ffi/native_type.rbs +86 -0
- data/sig/ffi/pointer.rbs +42 -0
- data/sig/ffi/struct.rbs +76 -0
- data/sig/ffi/struct_by_reference.rbs +11 -0
- data/sig/ffi/struct_by_value.rbs +7 -0
- data/sig/ffi/struct_layout.rbs +9 -0
- data/sig/ffi/struct_layout_builder.rbs +5 -0
- data/sig/ffi/type.rbs +39 -0
- data/sig/ffi.rbs +26 -0
- data.tar.gz.sig +0 -0
- metadata +508 -268
- metadata.gz.sig +1 -0
- data/History.txt +0 -1
- data/README.rdoc +0 -102
- data/ext/ffi_c/DataConverter.c +0 -91
- data/ext/ffi_c/Ffi_c.iml +0 -12
- data/ext/ffi_c/StructByReference.c +0 -158
- 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/ext/ffi_c/libffi/Makefile.vc +0 -141
- data/ext/ffi_c/libffi/Makefile.vc64 +0 -141
- data/ext/ffi_c/libffi/README +0 -342
- data/ext/ffi_c/libffi/aclocal.m4 +0 -1873
- data/ext/ffi_c/libffi/build-ios.sh +0 -67
- data/ext/ffi_c/libffi/depcomp +0 -630
- data/ext/ffi_c/libffi/doc/libffi.info +0 -593
- data/ext/ffi_c/libffi/doc/stamp-vti +0 -4
- data/ext/ffi_c/libffi/include/ffi.h.vc +0 -427
- data/ext/ffi_c/libffi/m4/ax_check_compiler_flags.m4 +0 -76
- data/ext/ffi_c/libffi/m4/libtool.m4 +0 -7831
- data/ext/ffi_c/libffi/m4/ltoptions.m4 +0 -369
- data/ext/ffi_c/libffi/m4/ltsugar.m4 +0 -123
- data/ext/ffi_c/libffi/m4/ltversion.m4 +0 -23
- data/ext/ffi_c/libffi/m4/lt~obsolete.m4 +0 -98
- data/ext/ffi_c/libffi/mdate-sh +0 -201
- data/ext/ffi_c/libffi/src/arm/gentramp.sh +0 -118
- data/ext/ffi_c/libffi/src/arm/trampoline.S +0 -4450
- data/ext/ffi_c/libffi/src/x86/darwin.S +0 -444
- data/ext/ffi_c/libffi/src/x86/darwin64.S +0 -416
- data/ext/ffi_c/libffi/src/x86/freebsd.S +0 -458
- data/ext/ffi_c/libffi/src/x86/win32.S +0 -1065
- data/ext/ffi_c/libffi/testsuite/lib/libffi-dg.exp +0 -300
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_win32.c +0 -63
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen_win32.c +0 -44
- data/ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h +0 -96
- data/ext/ffi_c/libffi/texinfo.tex +0 -7210
- data/ext/ffi_c/win32/stdint.h +0 -199
- data/gen/Rakefile +0 -30
- data/lib/Lib.iml +0 -13
- data/spec/ffi/Ffi.iml +0 -12
- data/spec/ffi/async_callback_spec.rb +0 -46
- data/spec/ffi/bool_spec.rb +0 -40
- data/spec/ffi/buffer_spec.rb +0 -215
- data/spec/ffi/callback_spec.rb +0 -668
- data/spec/ffi/custom_param_type.rb +0 -47
- data/spec/ffi/custom_type_spec.rb +0 -85
- data/spec/ffi/dup_spec.rb +0 -65
- data/spec/ffi/enum_spec.rb +0 -227
- data/spec/ffi/errno_spec.rb +0 -29
- data/spec/ffi/ffi_spec.rb +0 -40
- data/spec/ffi/function_spec.rb +0 -87
- data/spec/ffi/library_spec.rb +0 -208
- data/spec/ffi/long_double.rb +0 -41
- data/spec/ffi/managed_struct_spec.rb +0 -72
- data/spec/ffi/number_spec.rb +0 -247
- data/spec/ffi/pointer_spec.rb +0 -214
- data/spec/ffi/rbx/attach_function_spec.rb +0 -28
- data/spec/ffi/rbx/memory_pointer_spec.rb +0 -111
- data/spec/ffi/rbx/spec_helper.rb +0 -1
- data/spec/ffi/rbx/struct_spec.rb +0 -13
- data/spec/ffi/spec_helper.rb +0 -35
- data/spec/ffi/string_spec.rb +0 -119
- data/spec/ffi/strptr_spec.rb +0 -61
- data/spec/ffi/struct_callback_spec.rb +0 -80
- data/spec/ffi/struct_initialize_spec.rb +0 -46
- data/spec/ffi/struct_packed_spec.rb +0 -62
- data/spec/ffi/struct_spec.rb +0 -719
- data/spec/ffi/typedef_spec.rb +0 -89
- data/spec/ffi/union_spec.rb +0 -76
- data/spec/ffi/variadic_spec.rb +0 -103
- data/spec/spec.opts +0 -4
- data/tasks/ann.rake +0 -80
- data/tasks/extension.rake +0 -32
- data/tasks/gem.rake +0 -199
- data/tasks/git.rake +0 -41
- data/tasks/notes.rake +0 -27
- data/tasks/post_load.rake +0 -34
- data/tasks/rdoc.rake +0 -50
- data/tasks/rubyforge.rake +0 -55
- data/tasks/setup.rb +0 -301
- data/tasks/spec.rake +0 -54
- data/tasks/svn.rake +0 -47
- data/tasks/test.rake +0 -40
- data/tasks/yard.rake +0 -11
- data/ext/ffi_c/libffi/testsuite/libffi.call/{pyobjc-tc.c → pyobjc_tc.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}/err_bad_abi.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/problem1.c +0 -0
- data/lib/ffi/platform/{i486-gnu → i386-gnu}/types.conf +84 -84
@@ -1,5 +1,7 @@
|
|
1
1
|
/* -----------------------------------------------------------------------
|
2
|
-
sysv.S - Copyright (c)
|
2
|
+
sysv.S - Copyright (c) 2017 Anthony Green
|
3
|
+
- Copyright (c) 2013 The Written Word, Inc.
|
4
|
+
- Copyright (c) 1996,1998,2001-2003,2005,2008,2010 Red Hat, Inc.
|
3
5
|
|
4
6
|
X86 Foreign Function Interface
|
5
7
|
|
@@ -24,444 +26,1246 @@
|
|
24
26
|
DEALINGS IN THE SOFTWARE.
|
25
27
|
----------------------------------------------------------------------- */
|
26
28
|
|
27
|
-
#
|
29
|
+
#ifdef __i386__
|
30
|
+
#ifndef _MSC_VER
|
28
31
|
|
29
32
|
#define LIBFFI_ASM
|
30
33
|
#include <fficonfig.h>
|
31
34
|
#include <ffi.h>
|
35
|
+
#include "internal.h"
|
32
36
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
ffi_call_SYSV:
|
42
|
-
.LFB1:
|
43
|
-
pushl %ebp
|
44
|
-
.LCFI0:
|
45
|
-
movl %esp,%ebp
|
46
|
-
.LCFI1:
|
47
|
-
/* Make room for all of the new args. */
|
48
|
-
movl 16(%ebp),%ecx
|
49
|
-
subl %ecx,%esp
|
50
|
-
|
51
|
-
/* Align the stack pointer to 16-bytes */
|
52
|
-
andl $0xfffffff0, %esp
|
53
|
-
|
54
|
-
movl %esp,%eax
|
55
|
-
|
56
|
-
/* Place all of the ffi_prep_args in position */
|
57
|
-
pushl 12(%ebp)
|
58
|
-
pushl %eax
|
59
|
-
call *8(%ebp)
|
60
|
-
|
61
|
-
/* Return stack to previous state and call the function */
|
62
|
-
addl $8,%esp
|
63
|
-
|
64
|
-
call *28(%ebp)
|
65
|
-
|
66
|
-
/* Load %ecx with the return type code */
|
67
|
-
movl 20(%ebp),%ecx
|
68
|
-
|
69
|
-
/* Protect %esi. We're going to pop it in the epilogue. */
|
70
|
-
pushl %esi
|
71
|
-
|
72
|
-
/* If the return value pointer is NULL, assume no return value. */
|
73
|
-
cmpl $0,24(%ebp)
|
74
|
-
jne 0f
|
75
|
-
|
76
|
-
/* Even if there is no space for the return value, we are
|
77
|
-
obliged to handle floating-point values. */
|
78
|
-
cmpl $FFI_TYPE_FLOAT,%ecx
|
79
|
-
jne noretval
|
80
|
-
fstp %st(0)
|
81
|
-
|
82
|
-
jmp epilogue
|
83
|
-
|
84
|
-
0:
|
85
|
-
call 1f
|
86
|
-
|
87
|
-
.Lstore_table:
|
88
|
-
.long noretval-.Lstore_table /* FFI_TYPE_VOID */
|
89
|
-
.long retint-.Lstore_table /* FFI_TYPE_INT */
|
90
|
-
.long retfloat-.Lstore_table /* FFI_TYPE_FLOAT */
|
91
|
-
.long retdouble-.Lstore_table /* FFI_TYPE_DOUBLE */
|
92
|
-
.long retlongdouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */
|
93
|
-
.long retuint8-.Lstore_table /* FFI_TYPE_UINT8 */
|
94
|
-
.long retsint8-.Lstore_table /* FFI_TYPE_SINT8 */
|
95
|
-
.long retuint16-.Lstore_table /* FFI_TYPE_UINT16 */
|
96
|
-
.long retsint16-.Lstore_table /* FFI_TYPE_SINT16 */
|
97
|
-
.long retint-.Lstore_table /* FFI_TYPE_UINT32 */
|
98
|
-
.long retint-.Lstore_table /* FFI_TYPE_SINT32 */
|
99
|
-
.long retint64-.Lstore_table /* FFI_TYPE_UINT64 */
|
100
|
-
.long retint64-.Lstore_table /* FFI_TYPE_SINT64 */
|
101
|
-
.long retstruct-.Lstore_table /* FFI_TYPE_STRUCT */
|
102
|
-
.long retint-.Lstore_table /* FFI_TYPE_POINTER */
|
37
|
+
#define C2(X, Y) X ## Y
|
38
|
+
#define C1(X, Y) C2(X, Y)
|
39
|
+
#ifdef __USER_LABEL_PREFIX__
|
40
|
+
# define C(X) C1(__USER_LABEL_PREFIX__, X)
|
41
|
+
#else
|
42
|
+
# define C(X) X
|
43
|
+
#endif
|
103
44
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
45
|
+
#ifdef X86_DARWIN
|
46
|
+
# define L(X) C1(L, X)
|
47
|
+
#else
|
48
|
+
# define L(X) C1(.L, X)
|
49
|
+
#endif
|
108
50
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
51
|
+
#ifdef __ELF__
|
52
|
+
# define ENDF(X) .type X,@function; .size X, . - X
|
53
|
+
#else
|
54
|
+
# define ENDF(X)
|
55
|
+
#endif
|
113
56
|
|
114
|
-
|
115
|
-
|
116
|
-
|
57
|
+
/* Handle win32 fastcall name mangling. */
|
58
|
+
#ifdef X86_WIN32
|
59
|
+
# define ffi_call_i386 "@ffi_call_i386@8"
|
60
|
+
# define ffi_closure_inner "@ffi_closure_inner@8"
|
61
|
+
#else
|
62
|
+
# define ffi_call_i386 C(ffi_call_i386)
|
63
|
+
# define ffi_closure_inner C(ffi_closure_inner)
|
64
|
+
#endif
|
117
65
|
|
118
|
-
|
119
|
-
|
120
|
-
|
66
|
+
/* This macro allows the safe creation of jump tables without an
|
67
|
+
actual table. The entry points into the table are all 8 bytes.
|
68
|
+
The use of ORG asserts that we're at the correct location. */
|
69
|
+
/* ??? The clang assembler doesn't handle .org with symbolic expressions. */
|
70
|
+
#if defined(__clang__) || defined(__APPLE__) || (defined (__sun__) && defined(__svr4__))
|
71
|
+
# define E(BASE, X) .balign 8
|
72
|
+
#else
|
73
|
+
# define E(BASE, X) .balign 8; .org BASE + X * 8
|
74
|
+
#endif
|
121
75
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
retfloat:
|
127
|
-
/* Load %ecx with the pointer to storage for the return value */
|
128
|
-
movl 24(%ebp),%ecx
|
129
|
-
fstps (%ecx)
|
130
|
-
jmp epilogue
|
131
|
-
|
132
|
-
retdouble:
|
133
|
-
/* Load %ecx with the pointer to storage for the return value */
|
134
|
-
movl 24(%ebp),%ecx
|
135
|
-
fstpl (%ecx)
|
136
|
-
jmp epilogue
|
137
|
-
|
138
|
-
retlongdouble:
|
139
|
-
/* Load %ecx with the pointer to storage for the return value */
|
140
|
-
movl 24(%ebp),%ecx
|
141
|
-
fstpt (%ecx)
|
142
|
-
jmp epilogue
|
143
|
-
|
144
|
-
retint64:
|
145
|
-
/* Load %ecx with the pointer to storage for the return value */
|
146
|
-
movl 24(%ebp),%ecx
|
147
|
-
movl %eax,0(%ecx)
|
148
|
-
movl %edx,4(%ecx)
|
149
|
-
jmp epilogue
|
150
|
-
|
151
|
-
retint:
|
152
|
-
/* Load %ecx with the pointer to storage for the return value */
|
153
|
-
movl 24(%ebp),%ecx
|
154
|
-
movl %eax,0(%ecx)
|
155
|
-
|
156
|
-
retstruct:
|
157
|
-
/* Nothing to do! */
|
158
|
-
|
159
|
-
noretval:
|
160
|
-
epilogue:
|
161
|
-
popl %esi
|
162
|
-
movl %ebp,%esp
|
163
|
-
popl %ebp
|
164
|
-
ret
|
165
|
-
.LFE1:
|
166
|
-
.ffi_call_SYSV_end:
|
167
|
-
.size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV
|
76
|
+
.text
|
77
|
+
.balign 16
|
78
|
+
.globl ffi_call_i386
|
79
|
+
FFI_HIDDEN(ffi_call_i386)
|
168
80
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
movl
|
187
|
-
#
|
188
|
-
|
81
|
+
/* This is declared as
|
82
|
+
|
83
|
+
void ffi_call_i386(struct call_frame *frame, char *argp)
|
84
|
+
__attribute__((fastcall));
|
85
|
+
|
86
|
+
Thus the arguments are present in
|
87
|
+
|
88
|
+
ecx: frame
|
89
|
+
edx: argp
|
90
|
+
*/
|
91
|
+
|
92
|
+
ffi_call_i386:
|
93
|
+
L(UW0):
|
94
|
+
# cfi_startproc
|
95
|
+
_CET_ENDBR
|
96
|
+
#if !HAVE_FASTCALL
|
97
|
+
movl 4(%esp), %ecx
|
98
|
+
movl 8(%esp), %edx
|
99
|
+
#endif
|
100
|
+
movl (%esp), %eax /* move the return address */
|
101
|
+
movl %ebp, (%ecx) /* store %ebp into local frame */
|
102
|
+
movl %eax, 4(%ecx) /* store retaddr into local frame */
|
103
|
+
|
104
|
+
/* New stack frame based off ebp. This is a itty bit of unwind
|
105
|
+
trickery in that the CFA *has* changed. There is no easy way
|
106
|
+
to describe it correctly on entry to the function. Fortunately,
|
107
|
+
it doesn't matter too much since at all points we can correctly
|
108
|
+
unwind back to ffi_call. Note that the location to which we
|
109
|
+
moved the return address is (the new) CFA-4, so from the
|
110
|
+
perspective of the unwind info, it hasn't moved. */
|
111
|
+
movl %ecx, %ebp
|
112
|
+
L(UW1):
|
113
|
+
# cfi_def_cfa(%ebp, 8)
|
114
|
+
# cfi_rel_offset(%ebp, 0)
|
115
|
+
|
116
|
+
movl %edx, %esp /* set outgoing argument stack */
|
117
|
+
movl 20+R_EAX*4(%ebp), %eax /* set register arguments */
|
118
|
+
movl 20+R_EDX*4(%ebp), %edx
|
119
|
+
movl 20+R_ECX*4(%ebp), %ecx
|
120
|
+
|
121
|
+
call *8(%ebp)
|
122
|
+
|
123
|
+
movl 12(%ebp), %ecx /* load return type code */
|
124
|
+
movl %ebx, 8(%ebp) /* preserve %ebx */
|
125
|
+
L(UW2):
|
126
|
+
# cfi_rel_offset(%ebx, 8)
|
127
|
+
|
128
|
+
andl $X86_RET_TYPE_MASK, %ecx
|
129
|
+
#ifdef __PIC__
|
130
|
+
call C(__x86.get_pc_thunk.bx)
|
131
|
+
L(pc1):
|
132
|
+
leal L(store_table)-L(pc1)(%ebx, %ecx, 8), %ebx
|
189
133
|
#else
|
190
|
-
|
191
|
-
.LCFI7:
|
192
|
-
call 1f
|
193
|
-
1: popl %ebx
|
194
|
-
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
|
195
|
-
call ffi_closure_SYSV_inner@PLT
|
196
|
-
movl 8(%esp), %ebx
|
134
|
+
leal L(store_table)(,%ecx, 8), %ebx
|
197
135
|
#endif
|
198
|
-
movl
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
136
|
+
movl 16(%ebp), %ecx /* load result address */
|
137
|
+
_CET_NOTRACK jmp *%ebx
|
138
|
+
|
139
|
+
.balign 8
|
140
|
+
L(store_table):
|
141
|
+
E(L(store_table), X86_RET_FLOAT)
|
142
|
+
fstps (%ecx)
|
143
|
+
jmp L(e1)
|
144
|
+
E(L(store_table), X86_RET_DOUBLE)
|
145
|
+
fstpl (%ecx)
|
146
|
+
jmp L(e1)
|
147
|
+
E(L(store_table), X86_RET_LDOUBLE)
|
148
|
+
fstpt (%ecx)
|
149
|
+
jmp L(e1)
|
150
|
+
E(L(store_table), X86_RET_SINT8)
|
151
|
+
movsbl %al, %eax
|
152
|
+
mov %eax, (%ecx)
|
153
|
+
jmp L(e1)
|
154
|
+
E(L(store_table), X86_RET_SINT16)
|
155
|
+
movswl %ax, %eax
|
156
|
+
mov %eax, (%ecx)
|
157
|
+
jmp L(e1)
|
158
|
+
E(L(store_table), X86_RET_UINT8)
|
159
|
+
movzbl %al, %eax
|
160
|
+
mov %eax, (%ecx)
|
161
|
+
jmp L(e1)
|
162
|
+
E(L(store_table), X86_RET_UINT16)
|
163
|
+
movzwl %ax, %eax
|
164
|
+
mov %eax, (%ecx)
|
165
|
+
jmp L(e1)
|
166
|
+
E(L(store_table), X86_RET_INT64)
|
167
|
+
movl %edx, 4(%ecx)
|
168
|
+
/* fallthru */
|
169
|
+
E(L(store_table), X86_RET_INT32)
|
170
|
+
movl %eax, (%ecx)
|
171
|
+
/* fallthru */
|
172
|
+
E(L(store_table), X86_RET_VOID)
|
173
|
+
L(e1):
|
174
|
+
movl 8(%ebp), %ebx
|
220
175
|
movl %ebp, %esp
|
221
176
|
popl %ebp
|
177
|
+
L(UW3):
|
178
|
+
# cfi_remember_state
|
179
|
+
# cfi_def_cfa(%esp, 4)
|
180
|
+
# cfi_restore(%ebx)
|
181
|
+
# cfi_restore(%ebp)
|
222
182
|
ret
|
223
|
-
|
224
|
-
|
225
|
-
jmp .Lcls_epilogue
|
226
|
-
.Lcls_retfloat:
|
227
|
-
flds (%ecx)
|
228
|
-
jmp .Lcls_epilogue
|
229
|
-
.Lcls_retdouble:
|
230
|
-
fldl (%ecx)
|
231
|
-
jmp .Lcls_epilogue
|
232
|
-
.Lcls_retldouble:
|
233
|
-
fldt (%ecx)
|
234
|
-
jmp .Lcls_epilogue
|
235
|
-
.Lcls_retllong:
|
236
|
-
movl (%ecx), %eax
|
237
|
-
movl 4(%ecx), %edx
|
238
|
-
jmp .Lcls_epilogue
|
239
|
-
.Lcls_retstruct:
|
240
|
-
movl %ebp, %esp
|
241
|
-
popl %ebp
|
242
|
-
ret $4
|
243
|
-
.LFE2:
|
244
|
-
.size ffi_closure_SYSV, .-ffi_closure_SYSV
|
183
|
+
L(UW4):
|
184
|
+
# cfi_restore_state
|
245
185
|
|
246
|
-
|
186
|
+
E(L(store_table), X86_RET_STRUCTPOP)
|
187
|
+
jmp L(e1)
|
188
|
+
E(L(store_table), X86_RET_STRUCTARG)
|
189
|
+
jmp L(e1)
|
190
|
+
E(L(store_table), X86_RET_STRUCT_1B)
|
191
|
+
movb %al, (%ecx)
|
192
|
+
jmp L(e1)
|
193
|
+
E(L(store_table), X86_RET_STRUCT_2B)
|
194
|
+
movw %ax, (%ecx)
|
195
|
+
jmp L(e1)
|
196
|
+
|
197
|
+
/* Fill out the table so that bad values are predictable. */
|
198
|
+
E(L(store_table), X86_RET_UNUSED14)
|
199
|
+
ud2
|
200
|
+
E(L(store_table), X86_RET_UNUSED15)
|
201
|
+
ud2
|
202
|
+
|
203
|
+
L(UW5):
|
204
|
+
# cfi_endproc
|
205
|
+
ENDF(ffi_call_i386)
|
206
|
+
|
207
|
+
/* The inner helper is declared as
|
208
|
+
|
209
|
+
void ffi_closure_inner(struct closure_frame *frame, char *argp)
|
210
|
+
__attribute_((fastcall))
|
247
211
|
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
#
|
212
|
+
Thus the arguments are placed in
|
213
|
+
|
214
|
+
ecx: frame
|
215
|
+
edx: argp
|
216
|
+
*/
|
217
|
+
|
218
|
+
/* Macros to help setting up the closure_data structure. */
|
219
|
+
|
220
|
+
#if HAVE_FASTCALL
|
221
|
+
# define closure_FS (40 + 4)
|
222
|
+
# define closure_CF 0
|
257
223
|
#else
|
258
|
-
#define
|
259
|
-
#define
|
260
|
-
#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
|
224
|
+
# define closure_FS (8 + 40 + 12)
|
225
|
+
# define closure_CF 8
|
261
226
|
#endif
|
262
|
-
#define CIF_FLAGS_OFFSET 20
|
263
227
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
movl %
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
movl
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
leal
|
284
|
-
|
285
|
-
movl %
|
286
|
-
|
287
|
-
movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */
|
288
|
-
cmpl $FFI_TYPE_INT, %eax
|
289
|
-
je .Lrcls_retint
|
290
|
-
|
291
|
-
/* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16,
|
292
|
-
FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */
|
293
|
-
cmpl $FFI_TYPE_UINT64, %eax
|
294
|
-
jge 0f
|
295
|
-
cmpl $FFI_TYPE_UINT8, %eax
|
296
|
-
jge .Lrcls_retint
|
297
|
-
0:
|
298
|
-
cmpl $FFI_TYPE_FLOAT, %eax
|
299
|
-
je .Lrcls_retfloat
|
300
|
-
cmpl $FFI_TYPE_DOUBLE, %eax
|
301
|
-
je .Lrcls_retdouble
|
302
|
-
cmpl $FFI_TYPE_LONGDOUBLE, %eax
|
303
|
-
je .Lrcls_retldouble
|
304
|
-
cmpl $FFI_TYPE_SINT64, %eax
|
305
|
-
je .Lrcls_retllong
|
306
|
-
.Lrcls_epilogue:
|
307
|
-
addl $36, %esp
|
308
|
-
popl %esi
|
309
|
-
popl %ebp
|
310
|
-
ret
|
311
|
-
.Lrcls_retint:
|
312
|
-
movl -24(%ebp), %eax
|
313
|
-
jmp .Lrcls_epilogue
|
314
|
-
.Lrcls_retfloat:
|
315
|
-
flds -24(%ebp)
|
316
|
-
jmp .Lrcls_epilogue
|
317
|
-
.Lrcls_retdouble:
|
318
|
-
fldl -24(%ebp)
|
319
|
-
jmp .Lrcls_epilogue
|
320
|
-
.Lrcls_retldouble:
|
321
|
-
fldt -24(%ebp)
|
322
|
-
jmp .Lrcls_epilogue
|
323
|
-
.Lrcls_retllong:
|
324
|
-
movl -24(%ebp), %eax
|
325
|
-
movl -20(%ebp), %edx
|
326
|
-
jmp .Lrcls_epilogue
|
327
|
-
.LFE3:
|
328
|
-
.size ffi_closure_raw_SYSV, .-ffi_closure_raw_SYSV
|
228
|
+
#define FFI_CLOSURE_SAVE_REGS \
|
229
|
+
movl %eax, closure_CF+16+R_EAX*4(%esp); \
|
230
|
+
movl %edx, closure_CF+16+R_EDX*4(%esp); \
|
231
|
+
movl %ecx, closure_CF+16+R_ECX*4(%esp)
|
232
|
+
|
233
|
+
#define FFI_CLOSURE_COPY_TRAMP_DATA \
|
234
|
+
movl FFI_TRAMPOLINE_SIZE(%eax), %edx; /* copy cif */ \
|
235
|
+
movl FFI_TRAMPOLINE_SIZE+4(%eax), %ecx; /* copy fun */ \
|
236
|
+
movl FFI_TRAMPOLINE_SIZE+8(%eax), %eax; /* copy user_data */ \
|
237
|
+
movl %edx, closure_CF+28(%esp); \
|
238
|
+
movl %ecx, closure_CF+32(%esp); \
|
239
|
+
movl %eax, closure_CF+36(%esp)
|
240
|
+
|
241
|
+
#if HAVE_FASTCALL
|
242
|
+
# define FFI_CLOSURE_PREP_CALL \
|
243
|
+
movl %esp, %ecx; /* load closure_data */ \
|
244
|
+
leal closure_FS+4(%esp), %edx; /* load incoming stack */
|
245
|
+
#else
|
246
|
+
# define FFI_CLOSURE_PREP_CALL \
|
247
|
+
leal closure_CF(%esp), %ecx; /* load closure_data */ \
|
248
|
+
leal closure_FS+4(%esp), %edx; /* load incoming stack */ \
|
249
|
+
movl %ecx, (%esp); \
|
250
|
+
movl %edx, 4(%esp)
|
329
251
|
#endif
|
330
252
|
|
331
|
-
#
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
253
|
+
#define FFI_CLOSURE_CALL_INNER(UWN) \
|
254
|
+
call ffi_closure_inner
|
255
|
+
|
256
|
+
#define FFI_CLOSURE_MASK_AND_JUMP(N, UW) \
|
257
|
+
andl $X86_RET_TYPE_MASK, %eax; \
|
258
|
+
leal L(C1(load_table,N))(, %eax, 8), %edx; \
|
259
|
+
movl closure_CF(%esp), %eax; /* optimiztic load */ \
|
260
|
+
_CET_NOTRACK jmp *%edx
|
261
|
+
|
262
|
+
#ifdef __PIC__
|
263
|
+
# if defined X86_DARWIN || defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
|
264
|
+
# undef FFI_CLOSURE_MASK_AND_JUMP
|
265
|
+
# define FFI_CLOSURE_MASK_AND_JUMP(N, UW) \
|
266
|
+
andl $X86_RET_TYPE_MASK, %eax; \
|
267
|
+
call C(__x86.get_pc_thunk.dx); \
|
268
|
+
L(C1(pc,N)): \
|
269
|
+
leal L(C1(load_table,N))-L(C1(pc,N))(%edx, %eax, 8), %edx; \
|
270
|
+
movl closure_CF(%esp), %eax; /* optimiztic load */ \
|
271
|
+
_CET_NOTRACK jmp *%edx
|
337
272
|
# else
|
338
|
-
# define
|
339
|
-
#
|
340
|
-
#
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
273
|
+
# define FFI_CLOSURE_CALL_INNER_SAVE_EBX
|
274
|
+
# undef FFI_CLOSURE_CALL_INNER
|
275
|
+
# define FFI_CLOSURE_CALL_INNER(UWN) \
|
276
|
+
movl %ebx, 40(%esp); /* save ebx */ \
|
277
|
+
L(C1(UW,UWN)): \
|
278
|
+
/* cfi_rel_offset(%ebx, 40); */ \
|
279
|
+
call C(__x86.get_pc_thunk.bx); /* load got register */ \
|
280
|
+
addl $C(_GLOBAL_OFFSET_TABLE_), %ebx; \
|
281
|
+
call ffi_closure_inner@PLT
|
282
|
+
# undef FFI_CLOSURE_MASK_AND_JUMP
|
283
|
+
# define FFI_CLOSURE_MASK_AND_JUMP(N, UWN) \
|
284
|
+
andl $X86_RET_TYPE_MASK, %eax; \
|
285
|
+
leal L(C1(load_table,N))@GOTOFF(%ebx, %eax, 8), %edx; \
|
286
|
+
movl 40(%esp), %ebx; /* restore ebx */ \
|
287
|
+
L(C1(UW,UWN)): \
|
288
|
+
/* cfi_restore(%ebx); */ \
|
289
|
+
movl closure_CF(%esp), %eax; /* optimiztic load */ \
|
290
|
+
_CET_NOTRACK jmp *%edx
|
291
|
+
# endif /* DARWIN || HIDDEN */
|
292
|
+
#endif /* __PIC__ */
|
293
|
+
|
294
|
+
.balign 16
|
295
|
+
.globl C(ffi_go_closure_EAX)
|
296
|
+
FFI_HIDDEN(C(ffi_go_closure_EAX))
|
297
|
+
C(ffi_go_closure_EAX):
|
298
|
+
L(UW6):
|
299
|
+
# cfi_startproc
|
300
|
+
_CET_ENDBR
|
301
|
+
subl $closure_FS, %esp
|
302
|
+
L(UW7):
|
303
|
+
# cfi_def_cfa_offset(closure_FS + 4)
|
304
|
+
FFI_CLOSURE_SAVE_REGS
|
305
|
+
movl 4(%eax), %edx /* copy cif */
|
306
|
+
movl 8(%eax), %ecx /* copy fun */
|
307
|
+
movl %edx, closure_CF+28(%esp)
|
308
|
+
movl %ecx, closure_CF+32(%esp)
|
309
|
+
movl %eax, closure_CF+36(%esp) /* closure is user_data */
|
310
|
+
jmp L(do_closure_i386)
|
311
|
+
L(UW8):
|
312
|
+
# cfi_endproc
|
313
|
+
ENDF(C(ffi_go_closure_EAX))
|
314
|
+
|
315
|
+
.balign 16
|
316
|
+
.globl C(ffi_go_closure_ECX)
|
317
|
+
FFI_HIDDEN(C(ffi_go_closure_ECX))
|
318
|
+
C(ffi_go_closure_ECX):
|
319
|
+
L(UW9):
|
320
|
+
# cfi_startproc
|
321
|
+
_CET_ENDBR
|
322
|
+
subl $closure_FS, %esp
|
323
|
+
L(UW10):
|
324
|
+
# cfi_def_cfa_offset(closure_FS + 4)
|
325
|
+
FFI_CLOSURE_SAVE_REGS
|
326
|
+
movl 4(%ecx), %edx /* copy cif */
|
327
|
+
movl 8(%ecx), %eax /* copy fun */
|
328
|
+
movl %edx, closure_CF+28(%esp)
|
329
|
+
movl %eax, closure_CF+32(%esp)
|
330
|
+
movl %ecx, closure_CF+36(%esp) /* closure is user_data */
|
331
|
+
jmp L(do_closure_i386)
|
332
|
+
L(UW11):
|
333
|
+
# cfi_endproc
|
334
|
+
ENDF(C(ffi_go_closure_ECX))
|
335
|
+
|
336
|
+
/* The closure entry points are reached from the ffi_closure trampoline.
|
337
|
+
On entry, %eax contains the address of the ffi_closure. */
|
338
|
+
|
339
|
+
.balign 16
|
340
|
+
.globl C(ffi_closure_i386)
|
341
|
+
FFI_HIDDEN(C(ffi_closure_i386))
|
342
|
+
|
343
|
+
C(ffi_closure_i386):
|
344
|
+
L(UW12):
|
345
|
+
# cfi_startproc
|
346
|
+
_CET_ENDBR
|
347
|
+
subl $closure_FS, %esp
|
348
|
+
L(UW13):
|
349
|
+
# cfi_def_cfa_offset(closure_FS + 4)
|
350
|
+
|
351
|
+
FFI_CLOSURE_SAVE_REGS
|
352
|
+
FFI_CLOSURE_COPY_TRAMP_DATA
|
353
|
+
|
354
|
+
/* Entry point from preceeding Go closures. */
|
355
|
+
L(do_closure_i386):
|
356
|
+
|
357
|
+
FFI_CLOSURE_PREP_CALL
|
358
|
+
FFI_CLOSURE_CALL_INNER(14)
|
359
|
+
FFI_CLOSURE_MASK_AND_JUMP(2, 15)
|
360
|
+
|
361
|
+
.balign 8
|
362
|
+
L(load_table2):
|
363
|
+
E(L(load_table2), X86_RET_FLOAT)
|
364
|
+
flds closure_CF(%esp)
|
365
|
+
jmp L(e2)
|
366
|
+
E(L(load_table2), X86_RET_DOUBLE)
|
367
|
+
fldl closure_CF(%esp)
|
368
|
+
jmp L(e2)
|
369
|
+
E(L(load_table2), X86_RET_LDOUBLE)
|
370
|
+
fldt closure_CF(%esp)
|
371
|
+
jmp L(e2)
|
372
|
+
E(L(load_table2), X86_RET_SINT8)
|
373
|
+
movsbl %al, %eax
|
374
|
+
jmp L(e2)
|
375
|
+
E(L(load_table2), X86_RET_SINT16)
|
376
|
+
movswl %ax, %eax
|
377
|
+
jmp L(e2)
|
378
|
+
E(L(load_table2), X86_RET_UINT8)
|
379
|
+
movzbl %al, %eax
|
380
|
+
jmp L(e2)
|
381
|
+
E(L(load_table2), X86_RET_UINT16)
|
382
|
+
movzwl %ax, %eax
|
383
|
+
jmp L(e2)
|
384
|
+
E(L(load_table2), X86_RET_INT64)
|
385
|
+
movl closure_CF+4(%esp), %edx
|
386
|
+
jmp L(e2)
|
387
|
+
E(L(load_table2), X86_RET_INT32)
|
388
|
+
nop
|
389
|
+
/* fallthru */
|
390
|
+
E(L(load_table2), X86_RET_VOID)
|
391
|
+
L(e2):
|
392
|
+
addl $closure_FS, %esp
|
393
|
+
L(UW16):
|
394
|
+
# cfi_adjust_cfa_offset(-closure_FS)
|
395
|
+
ret
|
396
|
+
L(UW17):
|
397
|
+
# cfi_adjust_cfa_offset(closure_FS)
|
398
|
+
E(L(load_table2), X86_RET_STRUCTPOP)
|
399
|
+
addl $closure_FS, %esp
|
400
|
+
L(UW18):
|
401
|
+
# cfi_adjust_cfa_offset(-closure_FS)
|
402
|
+
ret $4
|
403
|
+
L(UW19):
|
404
|
+
# cfi_adjust_cfa_offset(closure_FS)
|
405
|
+
E(L(load_table2), X86_RET_STRUCTARG)
|
406
|
+
jmp L(e2)
|
407
|
+
E(L(load_table2), X86_RET_STRUCT_1B)
|
408
|
+
movzbl %al, %eax
|
409
|
+
jmp L(e2)
|
410
|
+
E(L(load_table2), X86_RET_STRUCT_2B)
|
411
|
+
movzwl %ax, %eax
|
412
|
+
jmp L(e2)
|
413
|
+
|
414
|
+
/* Fill out the table so that bad values are predictable. */
|
415
|
+
E(L(load_table2), X86_RET_UNUSED14)
|
416
|
+
ud2
|
417
|
+
E(L(load_table2), X86_RET_UNUSED15)
|
418
|
+
ud2
|
419
|
+
|
420
|
+
L(UW20):
|
421
|
+
# cfi_endproc
|
422
|
+
ENDF(C(ffi_closure_i386))
|
423
|
+
|
424
|
+
.balign 16
|
425
|
+
.globl C(ffi_go_closure_STDCALL)
|
426
|
+
FFI_HIDDEN(C(ffi_go_closure_STDCALL))
|
427
|
+
C(ffi_go_closure_STDCALL):
|
428
|
+
L(UW21):
|
429
|
+
# cfi_startproc
|
430
|
+
_CET_ENDBR
|
431
|
+
subl $closure_FS, %esp
|
432
|
+
L(UW22):
|
433
|
+
# cfi_def_cfa_offset(closure_FS + 4)
|
434
|
+
FFI_CLOSURE_SAVE_REGS
|
435
|
+
movl 4(%ecx), %edx /* copy cif */
|
436
|
+
movl 8(%ecx), %eax /* copy fun */
|
437
|
+
movl %edx, closure_CF+28(%esp)
|
438
|
+
movl %eax, closure_CF+32(%esp)
|
439
|
+
movl %ecx, closure_CF+36(%esp) /* closure is user_data */
|
440
|
+
jmp L(do_closure_STDCALL)
|
441
|
+
L(UW23):
|
442
|
+
# cfi_endproc
|
443
|
+
ENDF(C(ffi_go_closure_STDCALL))
|
444
|
+
|
445
|
+
/* For REGISTER, we have no available parameter registers, and so we
|
446
|
+
enter here having pushed the closure onto the stack. */
|
447
|
+
|
448
|
+
.balign 16
|
449
|
+
.globl C(ffi_closure_REGISTER)
|
450
|
+
FFI_HIDDEN(C(ffi_closure_REGISTER))
|
451
|
+
C(ffi_closure_REGISTER):
|
452
|
+
L(UW24):
|
453
|
+
# cfi_startproc
|
454
|
+
# cfi_def_cfa(%esp, 8)
|
455
|
+
# cfi_offset(%eip, -8)
|
456
|
+
_CET_ENDBR
|
457
|
+
subl $closure_FS-4, %esp
|
458
|
+
L(UW25):
|
459
|
+
# cfi_def_cfa_offset(closure_FS + 4)
|
460
|
+
FFI_CLOSURE_SAVE_REGS
|
461
|
+
movl closure_FS-4(%esp), %ecx /* load retaddr */
|
462
|
+
movl closure_FS(%esp), %eax /* load closure */
|
463
|
+
movl %ecx, closure_FS(%esp) /* move retaddr */
|
464
|
+
jmp L(do_closure_REGISTER)
|
465
|
+
L(UW26):
|
466
|
+
# cfi_endproc
|
467
|
+
ENDF(C(ffi_closure_REGISTER))
|
468
|
+
|
469
|
+
/* For STDCALL (and others), we need to pop N bytes of arguments off
|
470
|
+
the stack following the closure. The amount needing to be popped
|
471
|
+
is returned to us from ffi_closure_inner. */
|
472
|
+
|
473
|
+
.balign 16
|
474
|
+
.globl C(ffi_closure_STDCALL)
|
475
|
+
FFI_HIDDEN(C(ffi_closure_STDCALL))
|
476
|
+
C(ffi_closure_STDCALL):
|
477
|
+
L(UW27):
|
478
|
+
# cfi_startproc
|
479
|
+
_CET_ENDBR
|
480
|
+
subl $closure_FS, %esp
|
481
|
+
L(UW28):
|
482
|
+
# cfi_def_cfa_offset(closure_FS + 4)
|
483
|
+
|
484
|
+
FFI_CLOSURE_SAVE_REGS
|
485
|
+
|
486
|
+
/* Entry point from ffi_closure_REGISTER. */
|
487
|
+
L(do_closure_REGISTER):
|
488
|
+
|
489
|
+
FFI_CLOSURE_COPY_TRAMP_DATA
|
490
|
+
|
491
|
+
/* Entry point from preceeding Go closure. */
|
492
|
+
L(do_closure_STDCALL):
|
493
|
+
|
494
|
+
FFI_CLOSURE_PREP_CALL
|
495
|
+
FFI_CLOSURE_CALL_INNER(29)
|
496
|
+
|
497
|
+
movl %eax, %ecx
|
498
|
+
shrl $X86_RET_POP_SHIFT, %ecx /* isolate pop count */
|
499
|
+
leal closure_FS(%esp, %ecx), %ecx /* compute popped esp */
|
500
|
+
movl closure_FS(%esp), %edx /* move return address */
|
501
|
+
movl %edx, (%ecx)
|
502
|
+
|
503
|
+
/* From this point on, the value of %esp upon return is %ecx+4,
|
504
|
+
and we've copied the return address to %ecx to make return easy.
|
505
|
+
There's no point in representing this in the unwind info, as
|
506
|
+
there is always a window between the mov and the ret which
|
507
|
+
will be wrong from one point of view or another. */
|
508
|
+
|
509
|
+
FFI_CLOSURE_MASK_AND_JUMP(3, 30)
|
510
|
+
|
511
|
+
.balign 8
|
512
|
+
L(load_table3):
|
513
|
+
E(L(load_table3), X86_RET_FLOAT)
|
514
|
+
flds closure_CF(%esp)
|
515
|
+
movl %ecx, %esp
|
516
|
+
ret
|
517
|
+
E(L(load_table3), X86_RET_DOUBLE)
|
518
|
+
fldl closure_CF(%esp)
|
519
|
+
movl %ecx, %esp
|
520
|
+
ret
|
521
|
+
E(L(load_table3), X86_RET_LDOUBLE)
|
522
|
+
fldt closure_CF(%esp)
|
523
|
+
movl %ecx, %esp
|
524
|
+
ret
|
525
|
+
E(L(load_table3), X86_RET_SINT8)
|
526
|
+
movsbl %al, %eax
|
527
|
+
movl %ecx, %esp
|
528
|
+
ret
|
529
|
+
E(L(load_table3), X86_RET_SINT16)
|
530
|
+
movswl %ax, %eax
|
531
|
+
movl %ecx, %esp
|
532
|
+
ret
|
533
|
+
E(L(load_table3), X86_RET_UINT8)
|
534
|
+
movzbl %al, %eax
|
535
|
+
movl %ecx, %esp
|
536
|
+
ret
|
537
|
+
E(L(load_table3), X86_RET_UINT16)
|
538
|
+
movzwl %ax, %eax
|
539
|
+
movl %ecx, %esp
|
540
|
+
ret
|
541
|
+
E(L(load_table3), X86_RET_INT64)
|
542
|
+
movl closure_CF+4(%esp), %edx
|
543
|
+
movl %ecx, %esp
|
544
|
+
ret
|
545
|
+
E(L(load_table3), X86_RET_INT32)
|
546
|
+
movl %ecx, %esp
|
547
|
+
ret
|
548
|
+
E(L(load_table3), X86_RET_VOID)
|
549
|
+
movl %ecx, %esp
|
550
|
+
ret
|
551
|
+
E(L(load_table3), X86_RET_STRUCTPOP)
|
552
|
+
movl %ecx, %esp
|
553
|
+
ret
|
554
|
+
E(L(load_table3), X86_RET_STRUCTARG)
|
555
|
+
movl %ecx, %esp
|
556
|
+
ret
|
557
|
+
E(L(load_table3), X86_RET_STRUCT_1B)
|
558
|
+
movzbl %al, %eax
|
559
|
+
movl %ecx, %esp
|
560
|
+
ret
|
561
|
+
E(L(load_table3), X86_RET_STRUCT_2B)
|
562
|
+
movzwl %ax, %eax
|
563
|
+
movl %ecx, %esp
|
564
|
+
ret
|
565
|
+
|
566
|
+
/* Fill out the table so that bad values are predictable. */
|
567
|
+
E(L(load_table3), X86_RET_UNUSED14)
|
568
|
+
ud2
|
569
|
+
E(L(load_table3), X86_RET_UNUSED15)
|
570
|
+
ud2
|
571
|
+
|
572
|
+
L(UW31):
|
573
|
+
# cfi_endproc
|
574
|
+
ENDF(C(ffi_closure_STDCALL))
|
575
|
+
|
576
|
+
#if defined(FFI_EXEC_STATIC_TRAMP)
|
577
|
+
.balign 16
|
578
|
+
.globl C(ffi_closure_i386_alt)
|
579
|
+
FFI_HIDDEN(C(ffi_closure_i386_alt))
|
580
|
+
C(ffi_closure_i386_alt):
|
581
|
+
/* See the comments above trampoline_code_table. */
|
582
|
+
_CET_ENDBR
|
583
|
+
movl 4(%esp), %eax /* Load closure in eax */
|
584
|
+
add $8, %esp /* Restore the stack */
|
585
|
+
jmp C(ffi_closure_i386)
|
586
|
+
ENDF(C(ffi_closure_i386_alt))
|
587
|
+
|
588
|
+
.balign 16
|
589
|
+
.globl C(ffi_closure_REGISTER_alt)
|
590
|
+
FFI_HIDDEN(C(ffi_closure_REGISTER_alt))
|
591
|
+
C(ffi_closure_REGISTER_alt):
|
592
|
+
/* See the comments above trampoline_code_table. */
|
593
|
+
_CET_ENDBR
|
594
|
+
movl (%esp), %eax /* Restore eax */
|
595
|
+
add $4, %esp /* Leave closure on stack */
|
596
|
+
jmp C(ffi_closure_REGISTER)
|
597
|
+
ENDF(C(ffi_closure_REGISTER_alt))
|
598
|
+
|
599
|
+
.balign 16
|
600
|
+
.globl C(ffi_closure_STDCALL_alt)
|
601
|
+
FFI_HIDDEN(C(ffi_closure_STDCALL_alt))
|
602
|
+
C(ffi_closure_STDCALL_alt):
|
603
|
+
/* See the comments above trampoline_code_table. */
|
604
|
+
_CET_ENDBR
|
605
|
+
movl 4(%esp), %eax /* Load closure in eax */
|
606
|
+
add $8, %esp /* Restore the stack */
|
607
|
+
jmp C(ffi_closure_STDCALL)
|
608
|
+
ENDF(C(ffi_closure_STDCALL_alt))
|
609
|
+
|
610
|
+
/*
|
611
|
+
* Below is the definition of the trampoline code table. Each element in
|
612
|
+
* the code table is a trampoline.
|
613
|
+
*
|
614
|
+
* Because we jump to the trampoline, we place a _CET_ENDBR at the
|
615
|
+
* beginning of the trampoline to mark it as a valid branch target. This is
|
616
|
+
* part of the the Intel CET (Control Flow Enforcement Technology).
|
617
|
+
*/
|
618
|
+
/*
|
619
|
+
* The trampoline uses register eax. It saves the original value of eax on
|
620
|
+
* the stack.
|
621
|
+
*
|
622
|
+
* The trampoline has two parameters - target code to jump to and data for
|
623
|
+
* the target code. The trampoline extracts the parameters from its parameter
|
624
|
+
* block (see tramp_table_map()). The trampoline saves the data address on
|
625
|
+
* the stack. Finally, it jumps to the target code.
|
626
|
+
*
|
627
|
+
* The target code can choose to:
|
628
|
+
*
|
629
|
+
* - restore the value of eax
|
630
|
+
* - load the data address in a register
|
631
|
+
* - restore the stack pointer to what it was when the trampoline was invoked.
|
632
|
+
*/
|
633
|
+
#ifdef ENDBR_PRESENT
|
634
|
+
#define X86_DATA_OFFSET 4081
|
635
|
+
#define X86_CODE_OFFSET 4070
|
345
636
|
#else
|
346
|
-
#
|
347
|
-
#
|
637
|
+
#define X86_DATA_OFFSET 4085
|
638
|
+
#define X86_CODE_OFFSET 4074
|
348
639
|
#endif
|
349
640
|
|
350
|
-
.
|
351
|
-
.
|
352
|
-
|
353
|
-
|
354
|
-
.
|
355
|
-
|
356
|
-
|
641
|
+
.align X86_TRAMP_MAP_SIZE
|
642
|
+
.globl C(trampoline_code_table)
|
643
|
+
FFI_HIDDEN(C(trampoline_code_table))
|
644
|
+
C(trampoline_code_table):
|
645
|
+
.rept X86_TRAMP_MAP_SIZE / X86_TRAMP_SIZE
|
646
|
+
_CET_ENDBR
|
647
|
+
sub $8, %esp
|
648
|
+
movl %eax, (%esp) /* Save %eax on stack */
|
649
|
+
call 1f /* Get next PC into %eax */
|
650
|
+
movl X86_DATA_OFFSET(%eax), %eax /* Copy data into %eax */
|
651
|
+
movl %eax, 4(%esp) /* Save data on stack */
|
652
|
+
call 1f /* Get next PC into %eax */
|
653
|
+
movl X86_CODE_OFFSET(%eax), %eax /* Copy code into %eax */
|
654
|
+
jmp *%eax /* Jump to code */
|
655
|
+
1:
|
656
|
+
mov (%esp), %eax
|
657
|
+
ret
|
658
|
+
.align 4
|
659
|
+
.endr
|
660
|
+
ENDF(C(trampoline_code_table))
|
661
|
+
.align X86_TRAMP_MAP_SIZE
|
662
|
+
#endif /* FFI_EXEC_STATIC_TRAMP */
|
663
|
+
|
664
|
+
#if !FFI_NO_RAW_API
|
665
|
+
|
666
|
+
#define raw_closure_S_FS (16+16+12)
|
667
|
+
|
668
|
+
.balign 16
|
669
|
+
.globl C(ffi_closure_raw_SYSV)
|
670
|
+
FFI_HIDDEN(C(ffi_closure_raw_SYSV))
|
671
|
+
C(ffi_closure_raw_SYSV):
|
672
|
+
L(UW32):
|
673
|
+
# cfi_startproc
|
674
|
+
_CET_ENDBR
|
675
|
+
subl $raw_closure_S_FS, %esp
|
676
|
+
L(UW33):
|
677
|
+
# cfi_def_cfa_offset(raw_closure_S_FS + 4)
|
678
|
+
movl %ebx, raw_closure_S_FS-4(%esp)
|
679
|
+
L(UW34):
|
680
|
+
# cfi_rel_offset(%ebx, raw_closure_S_FS-4)
|
681
|
+
|
682
|
+
movl FFI_TRAMPOLINE_SIZE+8(%eax), %edx /* load cl->user_data */
|
683
|
+
movl %edx, 12(%esp)
|
684
|
+
leal raw_closure_S_FS+4(%esp), %edx /* load raw_args */
|
685
|
+
movl %edx, 8(%esp)
|
686
|
+
leal 16(%esp), %edx /* load &res */
|
687
|
+
movl %edx, 4(%esp)
|
688
|
+
movl FFI_TRAMPOLINE_SIZE(%eax), %ebx /* load cl->cif */
|
689
|
+
movl %ebx, (%esp)
|
690
|
+
call *FFI_TRAMPOLINE_SIZE+4(%eax) /* call cl->fun */
|
691
|
+
|
692
|
+
movl 20(%ebx), %eax /* load cif->flags */
|
693
|
+
andl $X86_RET_TYPE_MASK, %eax
|
357
694
|
#ifdef __PIC__
|
358
|
-
.
|
695
|
+
call C(__x86.get_pc_thunk.bx)
|
696
|
+
L(pc4):
|
697
|
+
leal L(load_table4)-L(pc4)(%ebx, %eax, 8), %ecx
|
359
698
|
#else
|
360
|
-
|
699
|
+
leal L(load_table4)(,%eax, 8), %ecx
|
361
700
|
#endif
|
362
|
-
|
701
|
+
movl raw_closure_S_FS-4(%esp), %ebx
|
702
|
+
L(UW35):
|
703
|
+
# cfi_restore(%ebx)
|
704
|
+
movl 16(%esp), %eax /* Optimistic load */
|
705
|
+
jmp *%ecx
|
706
|
+
|
707
|
+
.balign 8
|
708
|
+
L(load_table4):
|
709
|
+
E(L(load_table4), X86_RET_FLOAT)
|
710
|
+
flds 16(%esp)
|
711
|
+
jmp L(e4)
|
712
|
+
E(L(load_table4), X86_RET_DOUBLE)
|
713
|
+
fldl 16(%esp)
|
714
|
+
jmp L(e4)
|
715
|
+
E(L(load_table4), X86_RET_LDOUBLE)
|
716
|
+
fldt 16(%esp)
|
717
|
+
jmp L(e4)
|
718
|
+
E(L(load_table4), X86_RET_SINT8)
|
719
|
+
movsbl %al, %eax
|
720
|
+
jmp L(e4)
|
721
|
+
E(L(load_table4), X86_RET_SINT16)
|
722
|
+
movswl %ax, %eax
|
723
|
+
jmp L(e4)
|
724
|
+
E(L(load_table4), X86_RET_UINT8)
|
725
|
+
movzbl %al, %eax
|
726
|
+
jmp L(e4)
|
727
|
+
E(L(load_table4), X86_RET_UINT16)
|
728
|
+
movzwl %ax, %eax
|
729
|
+
jmp L(e4)
|
730
|
+
E(L(load_table4), X86_RET_INT64)
|
731
|
+
movl 16+4(%esp), %edx
|
732
|
+
jmp L(e4)
|
733
|
+
E(L(load_table4), X86_RET_INT32)
|
734
|
+
nop
|
735
|
+
/* fallthru */
|
736
|
+
E(L(load_table4), X86_RET_VOID)
|
737
|
+
L(e4):
|
738
|
+
addl $raw_closure_S_FS, %esp
|
739
|
+
L(UW36):
|
740
|
+
# cfi_adjust_cfa_offset(-raw_closure_S_FS)
|
741
|
+
ret
|
742
|
+
L(UW37):
|
743
|
+
# cfi_adjust_cfa_offset(raw_closure_S_FS)
|
744
|
+
E(L(load_table4), X86_RET_STRUCTPOP)
|
745
|
+
addl $raw_closure_S_FS, %esp
|
746
|
+
L(UW38):
|
747
|
+
# cfi_adjust_cfa_offset(-raw_closure_S_FS)
|
748
|
+
ret $4
|
749
|
+
L(UW39):
|
750
|
+
# cfi_adjust_cfa_offset(raw_closure_S_FS)
|
751
|
+
E(L(load_table4), X86_RET_STRUCTARG)
|
752
|
+
jmp L(e4)
|
753
|
+
E(L(load_table4), X86_RET_STRUCT_1B)
|
754
|
+
movzbl %al, %eax
|
755
|
+
jmp L(e4)
|
756
|
+
E(L(load_table4), X86_RET_STRUCT_2B)
|
757
|
+
movzwl %ax, %eax
|
758
|
+
jmp L(e4)
|
759
|
+
|
760
|
+
/* Fill out the table so that bad values are predictable. */
|
761
|
+
E(L(load_table4), X86_RET_UNUSED14)
|
762
|
+
ud2
|
763
|
+
E(L(load_table4), X86_RET_UNUSED15)
|
764
|
+
ud2
|
765
|
+
|
766
|
+
L(UW40):
|
767
|
+
# cfi_endproc
|
768
|
+
ENDF(C(ffi_closure_raw_SYSV))
|
769
|
+
|
770
|
+
#define raw_closure_T_FS (16+16+8)
|
771
|
+
|
772
|
+
.balign 16
|
773
|
+
.globl C(ffi_closure_raw_THISCALL)
|
774
|
+
FFI_HIDDEN(C(ffi_closure_raw_THISCALL))
|
775
|
+
C(ffi_closure_raw_THISCALL):
|
776
|
+
L(UW41):
|
777
|
+
# cfi_startproc
|
778
|
+
_CET_ENDBR
|
779
|
+
/* Rearrange the stack such that %ecx is the first argument.
|
780
|
+
This means moving the return address. */
|
781
|
+
popl %edx
|
782
|
+
L(UW42):
|
783
|
+
# cfi_def_cfa_offset(0)
|
784
|
+
# cfi_register(%eip, %edx)
|
785
|
+
pushl %ecx
|
786
|
+
L(UW43):
|
787
|
+
# cfi_adjust_cfa_offset(4)
|
788
|
+
pushl %edx
|
789
|
+
L(UW44):
|
790
|
+
# cfi_adjust_cfa_offset(4)
|
791
|
+
# cfi_rel_offset(%eip, 0)
|
792
|
+
subl $raw_closure_T_FS, %esp
|
793
|
+
L(UW45):
|
794
|
+
# cfi_adjust_cfa_offset(raw_closure_T_FS)
|
795
|
+
movl %ebx, raw_closure_T_FS-4(%esp)
|
796
|
+
L(UW46):
|
797
|
+
# cfi_rel_offset(%ebx, raw_closure_T_FS-4)
|
798
|
+
|
799
|
+
movl FFI_TRAMPOLINE_SIZE+8(%eax), %edx /* load cl->user_data */
|
800
|
+
movl %edx, 12(%esp)
|
801
|
+
leal raw_closure_T_FS+4(%esp), %edx /* load raw_args */
|
802
|
+
movl %edx, 8(%esp)
|
803
|
+
leal 16(%esp), %edx /* load &res */
|
804
|
+
movl %edx, 4(%esp)
|
805
|
+
movl FFI_TRAMPOLINE_SIZE(%eax), %ebx /* load cl->cif */
|
806
|
+
movl %ebx, (%esp)
|
807
|
+
call *FFI_TRAMPOLINE_SIZE+4(%eax) /* call cl->fun */
|
808
|
+
|
809
|
+
movl 20(%ebx), %eax /* load cif->flags */
|
810
|
+
andl $X86_RET_TYPE_MASK, %eax
|
363
811
|
#ifdef __PIC__
|
364
|
-
.
|
812
|
+
call C(__x86.get_pc_thunk.bx)
|
813
|
+
L(pc5):
|
814
|
+
leal L(load_table5)-L(pc5)(%ebx, %eax, 8), %ecx
|
365
815
|
#else
|
366
|
-
|
816
|
+
leal L(load_table5)(,%eax, 8), %ecx
|
367
817
|
#endif
|
818
|
+
movl raw_closure_T_FS-4(%esp), %ebx
|
819
|
+
L(UW47):
|
820
|
+
# cfi_restore(%ebx)
|
821
|
+
movl 16(%esp), %eax /* Optimistic load */
|
822
|
+
jmp *%ecx
|
823
|
+
|
824
|
+
.balign 8
|
825
|
+
L(load_table5):
|
826
|
+
E(L(load_table5), X86_RET_FLOAT)
|
827
|
+
flds 16(%esp)
|
828
|
+
jmp L(e5)
|
829
|
+
E(L(load_table5), X86_RET_DOUBLE)
|
830
|
+
fldl 16(%esp)
|
831
|
+
jmp L(e5)
|
832
|
+
E(L(load_table5), X86_RET_LDOUBLE)
|
833
|
+
fldt 16(%esp)
|
834
|
+
jmp L(e5)
|
835
|
+
E(L(load_table5), X86_RET_SINT8)
|
836
|
+
movsbl %al, %eax
|
837
|
+
jmp L(e5)
|
838
|
+
E(L(load_table5), X86_RET_SINT16)
|
839
|
+
movswl %ax, %eax
|
840
|
+
jmp L(e5)
|
841
|
+
E(L(load_table5), X86_RET_UINT8)
|
842
|
+
movzbl %al, %eax
|
843
|
+
jmp L(e5)
|
844
|
+
E(L(load_table5), X86_RET_UINT16)
|
845
|
+
movzwl %ax, %eax
|
846
|
+
jmp L(e5)
|
847
|
+
E(L(load_table5), X86_RET_INT64)
|
848
|
+
movl 16+4(%esp), %edx
|
849
|
+
jmp L(e5)
|
850
|
+
E(L(load_table5), X86_RET_INT32)
|
851
|
+
nop
|
852
|
+
/* fallthru */
|
853
|
+
E(L(load_table5), X86_RET_VOID)
|
854
|
+
L(e5):
|
855
|
+
addl $raw_closure_T_FS, %esp
|
856
|
+
L(UW48):
|
857
|
+
# cfi_adjust_cfa_offset(-raw_closure_T_FS)
|
858
|
+
/* Remove the extra %ecx argument we pushed. */
|
859
|
+
ret $4
|
860
|
+
L(UW49):
|
861
|
+
# cfi_adjust_cfa_offset(raw_closure_T_FS)
|
862
|
+
E(L(load_table5), X86_RET_STRUCTPOP)
|
863
|
+
addl $raw_closure_T_FS, %esp
|
864
|
+
L(UW50):
|
865
|
+
# cfi_adjust_cfa_offset(-raw_closure_T_FS)
|
866
|
+
ret $8
|
867
|
+
L(UW51):
|
868
|
+
# cfi_adjust_cfa_offset(raw_closure_T_FS)
|
869
|
+
E(L(load_table5), X86_RET_STRUCTARG)
|
870
|
+
jmp L(e5)
|
871
|
+
E(L(load_table5), X86_RET_STRUCT_1B)
|
872
|
+
movzbl %al, %eax
|
873
|
+
jmp L(e5)
|
874
|
+
E(L(load_table5), X86_RET_STRUCT_2B)
|
875
|
+
movzwl %ax, %eax
|
876
|
+
jmp L(e5)
|
877
|
+
|
878
|
+
/* Fill out the table so that bad values are predictable. */
|
879
|
+
E(L(load_table5), X86_RET_UNUSED14)
|
880
|
+
ud2
|
881
|
+
E(L(load_table5), X86_RET_UNUSED15)
|
882
|
+
ud2
|
883
|
+
|
884
|
+
L(UW52):
|
885
|
+
# cfi_endproc
|
886
|
+
ENDF(C(ffi_closure_raw_THISCALL))
|
887
|
+
|
888
|
+
#endif /* !FFI_NO_RAW_API */
|
889
|
+
|
890
|
+
#ifdef X86_DARWIN
|
891
|
+
/* The linker in use on earlier Darwin needs weak definitions to be
|
892
|
+
placed in a coalesced section. That section should not be called
|
893
|
+
__TEXT,__text since that would be re-defining the attributes of the
|
894
|
+
.text section (which is an error for earlier tools). Here we use
|
895
|
+
'__textcoal_nt' which is what GCC emits for this.
|
896
|
+
Later linker versions are happy to use a normal section and, after
|
897
|
+
Darwin12 / OSX 10.8, the tools warn that using coalesced sections
|
898
|
+
for this is deprecated so we must switch to avoid build fails and/or
|
899
|
+
deprecation warnings. */
|
900
|
+
# if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
|
901
|
+
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1080
|
902
|
+
# define COMDAT(X) \
|
903
|
+
.section __TEXT,__textcoal_nt,coalesced,pure_instructions; \
|
904
|
+
.weak_definition X; \
|
905
|
+
FFI_HIDDEN(X)
|
906
|
+
# else
|
907
|
+
# define COMDAT(X) \
|
908
|
+
.text; \
|
909
|
+
.weak_definition X; \
|
910
|
+
FFI_HIDDEN(X)
|
911
|
+
# endif
|
912
|
+
#elif defined __ELF__ && !(defined(__sun__) && defined(__svr4__))
|
913
|
+
# define COMDAT(X) \
|
914
|
+
.section .text.X,"axG",@progbits,X,comdat; \
|
915
|
+
.globl X; \
|
916
|
+
FFI_HIDDEN(X)
|
368
917
|
#else
|
369
|
-
#
|
918
|
+
# define COMDAT(X)
|
370
919
|
#endif
|
371
|
-
|
372
|
-
|
373
|
-
.
|
374
|
-
|
375
|
-
|
376
|
-
|
920
|
+
|
921
|
+
#if defined(__PIC__)
|
922
|
+
COMDAT(C(__x86.get_pc_thunk.bx))
|
923
|
+
C(__x86.get_pc_thunk.bx):
|
924
|
+
movl (%esp), %ebx
|
925
|
+
ret
|
926
|
+
ENDF(C(__x86.get_pc_thunk.bx))
|
927
|
+
# if defined X86_DARWIN || defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
|
928
|
+
COMDAT(C(__x86.get_pc_thunk.dx))
|
929
|
+
C(__x86.get_pc_thunk.dx):
|
930
|
+
movl (%esp), %edx
|
931
|
+
ret
|
932
|
+
ENDF(C(__x86.get_pc_thunk.dx))
|
933
|
+
#endif /* DARWIN || HIDDEN */
|
934
|
+
#endif /* __PIC__ */
|
935
|
+
|
936
|
+
/* Sadly, OSX cctools-as does not understand .cfi directives at all so
|
937
|
+
we build an eh frame by hand. */
|
938
|
+
|
939
|
+
#ifdef __APPLE__
|
940
|
+
/* The cctools assembler will try to make a difference between two local
|
941
|
+
symbols into a relocation against, which will not work in the eh (produces
|
942
|
+
link-time fails).
|
943
|
+
To avoid this, we compute the symbol difference with a .set directive and
|
944
|
+
then substitute this value. */
|
945
|
+
# define LEN(N, P) .set Llen$N$P,L(N)-L(P); .long Llen$N$P
|
946
|
+
/* Note, this assume DW_CFA_advance_loc1 fits into 7 bits. */
|
947
|
+
# define ADV(N, P) .set Ladv$N$P,L(N)-L(P); .byte 2, Ladv$N$P
|
948
|
+
/* For historical reasons, the EH reg numbers for SP and FP are swapped from
|
949
|
+
the DWARF ones for 32b Darwin. */
|
950
|
+
# define SP 5
|
951
|
+
# define FP 4
|
952
|
+
# define ENC 0x10
|
953
|
+
#else
|
954
|
+
# define LEN(N, P) .long L(N)-L(P)
|
955
|
+
/* Assume DW_CFA_advance_loc1 fits. */
|
956
|
+
# define ADV(N, P) .byte 2, L(N)-L(P)
|
957
|
+
# define SP 4
|
958
|
+
# define FP 5
|
959
|
+
# define ENC 0x1b
|
377
960
|
#endif
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
.align 4
|
384
|
-
.LECIE1:
|
385
|
-
.LSFDE1:
|
386
|
-
.long .LEFDE1-.LASFDE1 /* FDE Length */
|
387
|
-
.LASFDE1:
|
388
|
-
.long .LASFDE1-.Lframe1 /* FDE CIE offset */
|
389
|
-
.long FDE_ENCODE(.LFB1) /* FDE initial location */
|
390
|
-
.long .LFE1-.LFB1 /* FDE address range */
|
391
|
-
#ifdef __PIC__
|
392
|
-
.byte 0x0 /* .uleb128 0x0; Augmentation size */
|
961
|
+
|
962
|
+
#ifdef HAVE_AS_X86_PCREL
|
963
|
+
# define PCREL(X) X-.
|
964
|
+
#else
|
965
|
+
# define PCREL(X) X@rel
|
393
966
|
#endif
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
.align 4
|
405
|
-
.LEFDE1:
|
406
|
-
.LSFDE2:
|
407
|
-
.long .LEFDE2-.LASFDE2 /* FDE Length */
|
408
|
-
.LASFDE2:
|
409
|
-
.long .LASFDE2-.Lframe1 /* FDE CIE offset */
|
410
|
-
.long FDE_ENCODE(.LFB2) /* FDE initial location */
|
411
|
-
.long .LFE2-.LFB2 /* FDE address range */
|
412
|
-
#ifdef __PIC__
|
413
|
-
.byte 0x0 /* .uleb128 0x0; Augmentation size */
|
967
|
+
|
968
|
+
#ifdef __APPLE__
|
969
|
+
.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
|
970
|
+
EHFrame0:
|
971
|
+
#elif defined(X86_WIN32)
|
972
|
+
.section .eh_frame,"r"
|
973
|
+
#elif defined(HAVE_AS_X86_64_UNWIND_SECTION_TYPE)
|
974
|
+
.section .eh_frame,EH_FRAME_FLAGS,@unwind
|
975
|
+
#else
|
976
|
+
.section .eh_frame,EH_FRAME_FLAGS,@progbits
|
414
977
|
#endif
|
415
|
-
|
416
|
-
|
417
|
-
.
|
418
|
-
.byte 0x8 /* .uleb128 0x8 */
|
419
|
-
.byte 0x85 /* DW_CFA_offset, column 0x5 */
|
420
|
-
.byte 0x2 /* .uleb128 0x2 */
|
421
|
-
.byte 0x4 /* DW_CFA_advance_loc4 */
|
422
|
-
.long .LCFI3-.LCFI2
|
423
|
-
.byte 0xd /* DW_CFA_def_cfa_register */
|
424
|
-
.byte 0x5 /* .uleb128 0x5 */
|
425
|
-
#if !defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE && defined __PIC__
|
426
|
-
.byte 0x4 /* DW_CFA_advance_loc4 */
|
427
|
-
.long .LCFI7-.LCFI3
|
428
|
-
.byte 0x83 /* DW_CFA_offset, column 0x3 */
|
429
|
-
.byte 0xa /* .uleb128 0xa */
|
978
|
+
#ifndef __APPLE__
|
979
|
+
/* EH sections are already suitably aligned on Darwin. */
|
980
|
+
.balign 4
|
430
981
|
#endif
|
431
|
-
.align 4
|
432
|
-
.LEFDE2:
|
433
982
|
|
434
|
-
|
983
|
+
L(CIE):
|
984
|
+
.set L(set0),L(ECIE)-L(SCIE)
|
985
|
+
.long L(set0) /* CIE Length */
|
986
|
+
L(SCIE):
|
987
|
+
.long 0 /* CIE Identifier Tag */
|
988
|
+
.byte 1 /* CIE Version */
|
989
|
+
.ascii "zR\0" /* CIE Augmentation */
|
990
|
+
.byte 1 /* CIE Code Alignment Factor */
|
991
|
+
.byte 0x7c /* CIE Data Alignment Factor */
|
992
|
+
.byte 0x8 /* CIE RA Column */
|
993
|
+
.byte 1 /* Augmentation size */
|
994
|
+
.byte ENC /* FDE Encoding (pcrel abs/4byte) */
|
995
|
+
.byte 0xc, SP, 4 /* DW_CFA_def_cfa, %esp offset 4 */
|
996
|
+
.byte 0x80+8, 1 /* DW_CFA_offset, %eip offset 1*-4 */
|
997
|
+
.balign 4
|
998
|
+
L(ECIE):
|
435
999
|
|
436
|
-
.
|
437
|
-
.long
|
438
|
-
|
439
|
-
|
440
|
-
.long
|
441
|
-
|
442
|
-
|
443
|
-
|
1000
|
+
.set L(set1),L(EFDE1)-L(SFDE1)
|
1001
|
+
.long L(set1) /* FDE Length */
|
1002
|
+
L(SFDE1):
|
1003
|
+
LEN(SFDE1, CIE) /* FDE CIE offset */
|
1004
|
+
.long PCREL(L(UW0)) /* Initial location */
|
1005
|
+
LEN(UW5, UW0) /* Address range */
|
1006
|
+
.byte 0 /* Augmentation size */
|
1007
|
+
ADV(UW1, UW0)
|
1008
|
+
.byte 0xc, FP, 8 /* DW_CFA_def_cfa, %ebp 8 */
|
1009
|
+
.byte 0x80+FP, 2 /* DW_CFA_offset, %ebp 2*-4 */
|
1010
|
+
ADV(UW2, UW1)
|
1011
|
+
.byte 0x80+3, 0 /* DW_CFA_offset, %ebx 0*-4 */
|
1012
|
+
ADV(UW3, UW2)
|
1013
|
+
.byte 0xa /* DW_CFA_remember_state */
|
1014
|
+
.byte 0xc, SP, 4 /* DW_CFA_def_cfa, %esp 4 */
|
1015
|
+
.byte 0xc0+3 /* DW_CFA_restore, %ebx */
|
1016
|
+
.byte 0xc0+FP /* DW_CFA_restore, %ebp */
|
1017
|
+
ADV(UW4, UW3)
|
1018
|
+
.byte 0xb /* DW_CFA_restore_state */
|
1019
|
+
.balign 4
|
1020
|
+
L(EFDE1):
|
1021
|
+
|
1022
|
+
.set L(set2),L(EFDE2)-L(SFDE2)
|
1023
|
+
.long L(set2) /* FDE Length */
|
1024
|
+
L(SFDE2):
|
1025
|
+
LEN(SFDE2, CIE) /* FDE CIE offset */
|
1026
|
+
.long PCREL(L(UW6)) /* Initial location */
|
1027
|
+
LEN(UW8,UW6) /* Address range */
|
1028
|
+
.byte 0 /* Augmentation size */
|
1029
|
+
ADV(UW7, UW6)
|
1030
|
+
.byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */
|
1031
|
+
.balign 4
|
1032
|
+
L(EFDE2):
|
1033
|
+
|
1034
|
+
.set L(set3),L(EFDE3)-L(SFDE3)
|
1035
|
+
.long L(set3) /* FDE Length */
|
1036
|
+
L(SFDE3):
|
1037
|
+
LEN(SFDE3, CIE) /* FDE CIE offset */
|
1038
|
+
.long PCREL(L(UW9)) /* Initial location */
|
1039
|
+
LEN(UW11, UW9) /* Address range */
|
1040
|
+
.byte 0 /* Augmentation size */
|
1041
|
+
ADV(UW10, UW9)
|
1042
|
+
.byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */
|
1043
|
+
.balign 4
|
1044
|
+
L(EFDE3):
|
1045
|
+
|
1046
|
+
.set L(set4),L(EFDE4)-L(SFDE4)
|
1047
|
+
.long L(set4) /* FDE Length */
|
1048
|
+
L(SFDE4):
|
1049
|
+
LEN(SFDE4, CIE) /* FDE CIE offset */
|
1050
|
+
.long PCREL(L(UW12)) /* Initial location */
|
1051
|
+
LEN(UW20, UW12) /* Address range */
|
1052
|
+
.byte 0 /* Augmentation size */
|
1053
|
+
ADV(UW13, UW12)
|
1054
|
+
.byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */
|
1055
|
+
#ifdef FFI_CLOSURE_CALL_INNER_SAVE_EBX
|
1056
|
+
ADV(UW14, UW13)
|
1057
|
+
.byte 0x80+3, (40-(closure_FS+4))/-4 /* DW_CFA_offset %ebx */
|
1058
|
+
ADV(UW15, UW14)
|
1059
|
+
.byte 0xc0+3 /* DW_CFA_restore %ebx */
|
1060
|
+
ADV(UW16, UW15)
|
1061
|
+
#else
|
1062
|
+
ADV(UW16, UW13)
|
1063
|
+
#endif
|
1064
|
+
.byte 0xe, 4 /* DW_CFA_def_cfa_offset */
|
1065
|
+
ADV(UW17, UW16)
|
1066
|
+
.byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */
|
1067
|
+
ADV(UW18, UW17)
|
1068
|
+
.byte 0xe, 4 /* DW_CFA_def_cfa_offset */
|
1069
|
+
ADV(UW19, UW18)
|
1070
|
+
.byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */
|
1071
|
+
.balign 4
|
1072
|
+
L(EFDE4):
|
1073
|
+
|
1074
|
+
.set L(set5),L(EFDE5)-L(SFDE5)
|
1075
|
+
.long L(set5) /* FDE Length */
|
1076
|
+
L(SFDE5):
|
1077
|
+
LEN(SFDE5, CIE) /* FDE CIE offset */
|
1078
|
+
.long PCREL(L(UW21)) /* Initial location */
|
1079
|
+
LEN(UW23, UW21) /* Address range */
|
1080
|
+
.byte 0 /* Augmentation size */
|
1081
|
+
ADV(UW22, UW21)
|
1082
|
+
.byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */
|
1083
|
+
.balign 4
|
1084
|
+
L(EFDE5):
|
1085
|
+
|
1086
|
+
.set L(set6),L(EFDE6)-L(SFDE6)
|
1087
|
+
.long L(set6) /* FDE Length */
|
1088
|
+
L(SFDE6):
|
1089
|
+
LEN(SFDE6, CIE) /* FDE CIE offset */
|
1090
|
+
.long PCREL(L(UW24)) /* Initial location */
|
1091
|
+
LEN(UW26, UW24) /* Address range */
|
1092
|
+
.byte 0 /* Augmentation size */
|
1093
|
+
.byte 0xe, 8 /* DW_CFA_def_cfa_offset */
|
1094
|
+
.byte 0x80+8, 2 /* DW_CFA_offset %eip, 2*-4 */
|
1095
|
+
ADV(UW25, UW24)
|
1096
|
+
.byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */
|
1097
|
+
.balign 4
|
1098
|
+
L(EFDE6):
|
1099
|
+
|
1100
|
+
.set L(set7),L(EFDE7)-L(SFDE7)
|
1101
|
+
.long L(set7) /* FDE Length */
|
1102
|
+
L(SFDE7):
|
1103
|
+
LEN(SFDE7, CIE) /* FDE CIE offset */
|
1104
|
+
.long PCREL(L(UW27)) /* Initial location */
|
1105
|
+
LEN(UW31, UW27) /* Address range */
|
1106
|
+
.byte 0 /* Augmentation size */
|
1107
|
+
ADV(UW28, UW27)
|
1108
|
+
.byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */
|
1109
|
+
#ifdef FFI_CLOSURE_CALL_INNER_SAVE_EBX
|
1110
|
+
ADV(UW29, UW28)
|
1111
|
+
.byte 0x80+3, (40-(closure_FS+4))/-4 /* DW_CFA_offset %ebx */
|
1112
|
+
ADV(UW30, UW29)
|
1113
|
+
.byte 0xc0+3 /* DW_CFA_restore %ebx */
|
444
1114
|
#endif
|
445
|
-
.
|
446
|
-
|
447
|
-
|
448
|
-
.
|
449
|
-
.
|
450
|
-
|
451
|
-
|
452
|
-
.long
|
453
|
-
|
454
|
-
.byte
|
455
|
-
|
456
|
-
.
|
457
|
-
|
458
|
-
.byte
|
459
|
-
|
460
|
-
.
|
1115
|
+
.balign 4
|
1116
|
+
L(EFDE7):
|
1117
|
+
#if !FFI_NO_RAW_API
|
1118
|
+
.set L(set8),L(EFDE8)-L(SFDE8)
|
1119
|
+
.long L(set8) /* FDE Length */
|
1120
|
+
L(SFDE8):
|
1121
|
+
LEN(SFDE8, CIE) /* FDE CIE offset */
|
1122
|
+
.long PCREL(L(UW32)) /* Initial location */
|
1123
|
+
LEN(UW40, UW32) /* Address range */
|
1124
|
+
.byte 0 /* Augmentation size */
|
1125
|
+
ADV(UW33, UW32)
|
1126
|
+
.byte 0xe, raw_closure_S_FS+4 /* DW_CFA_def_cfa_offset */
|
1127
|
+
ADV(UW34, UW33)
|
1128
|
+
.byte 0x80+3, 2 /* DW_CFA_offset %ebx 2*-4 */
|
1129
|
+
ADV(UW35, UW34)
|
1130
|
+
.byte 0xc0+3 /* DW_CFA_restore %ebx */
|
1131
|
+
ADV(UW36, UW35)
|
1132
|
+
.byte 0xe, 4 /* DW_CFA_def_cfa_offset */
|
1133
|
+
ADV(UW37, UW36)
|
1134
|
+
.byte 0xe, raw_closure_S_FS+4 /* DW_CFA_def_cfa_offset */
|
1135
|
+
ADV(UW38, UW37)
|
1136
|
+
.byte 0xe, 4 /* DW_CFA_def_cfa_offset */
|
1137
|
+
ADV(UW39, UW38)
|
1138
|
+
.byte 0xe, raw_closure_S_FS+4 /* DW_CFA_def_cfa_offset */
|
1139
|
+
.balign 4
|
1140
|
+
L(EFDE8):
|
461
1141
|
|
1142
|
+
.set L(set9),L(EFDE9)-L(SFDE9)
|
1143
|
+
.long L(set9) /* FDE Length */
|
1144
|
+
L(SFDE9):
|
1145
|
+
LEN(SFDE9, CIE) /* FDE CIE offset */
|
1146
|
+
.long PCREL(L(UW41)) /* Initial location */
|
1147
|
+
LEN(UW52, UW41) /* Address range */
|
1148
|
+
.byte 0 /* Augmentation size */
|
1149
|
+
ADV(UW42, UW41)
|
1150
|
+
.byte 0xe, 0 /* DW_CFA_def_cfa_offset */
|
1151
|
+
.byte 0x9, 8, 2 /* DW_CFA_register %eip, %edx */
|
1152
|
+
ADV(UW43, UW42)
|
1153
|
+
.byte 0xe, 4 /* DW_CFA_def_cfa_offset */
|
1154
|
+
ADV(UW44, UW43)
|
1155
|
+
.byte 0xe, 8 /* DW_CFA_def_cfa_offset */
|
1156
|
+
.byte 0x80+8, 2 /* DW_CFA_offset %eip 2*-4 */
|
1157
|
+
ADV(UW45, UW44)
|
1158
|
+
.byte 0xe, raw_closure_T_FS+8 /* DW_CFA_def_cfa_offset */
|
1159
|
+
ADV(UW46, UW45)
|
1160
|
+
.byte 0x80+3, 3 /* DW_CFA_offset %ebx 3*-4 */
|
1161
|
+
ADV(UW47, UW46)
|
1162
|
+
.byte 0xc0+3 /* DW_CFA_restore %ebx */
|
1163
|
+
ADV(UW48, UW47)
|
1164
|
+
.byte 0xe, 8 /* DW_CFA_def_cfa_offset */
|
1165
|
+
ADV(UW49, UW48)
|
1166
|
+
.byte 0xe, raw_closure_T_FS+8 /* DW_CFA_def_cfa_offset */
|
1167
|
+
ADV(UW50, UW49)
|
1168
|
+
.byte 0xe, 8 /* DW_CFA_def_cfa_offset */
|
1169
|
+
ADV(UW51, UW50)
|
1170
|
+
.byte 0xe, raw_closure_T_FS+8 /* DW_CFA_def_cfa_offset */
|
1171
|
+
.balign 4
|
1172
|
+
L(EFDE9):
|
1173
|
+
#endif /* !FFI_NO_RAW_API */
|
1174
|
+
|
1175
|
+
#ifdef _WIN32
|
1176
|
+
.def @feat.00;
|
1177
|
+
.scl 3;
|
1178
|
+
.type 0;
|
1179
|
+
.endef
|
1180
|
+
.globl @feat.00
|
1181
|
+
@feat.00 = 1
|
462
1182
|
#endif
|
463
1183
|
|
464
|
-
#
|
1184
|
+
#if defined(__APPLE__)
|
1185
|
+
.subsections_via_symbols
|
1186
|
+
# if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
|
1187
|
+
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1070 && __clang__
|
1188
|
+
/* compact unwind is not used with GCC at present, was not present before 10.6
|
1189
|
+
but has some bugs there, so do not emit until 10.7. */
|
1190
|
+
.section __LD,__compact_unwind,regular,debug
|
1191
|
+
|
1192
|
+
/* compact unwind for ffi_call_i386 */
|
1193
|
+
.long C(ffi_call_i386)
|
1194
|
+
.set L1,L(UW5)-L(UW0)
|
1195
|
+
.long L1
|
1196
|
+
.long 0x04000000 /* use dwarf unwind info */
|
1197
|
+
.long 0
|
1198
|
+
.long 0
|
1199
|
+
|
1200
|
+
/* compact unwind for ffi_go_closure_EAX */
|
1201
|
+
.long C(ffi_go_closure_EAX)
|
1202
|
+
.set L2,L(UW8)-L(UW6)
|
1203
|
+
.long L2
|
1204
|
+
.long 0x04000000 /* use dwarf unwind info */
|
1205
|
+
.long 0
|
1206
|
+
.long 0
|
1207
|
+
|
1208
|
+
/* compact unwind for ffi_go_closure_ECX */
|
1209
|
+
.long C(ffi_go_closure_ECX)
|
1210
|
+
.set L3,L(UW11)-L(UW9)
|
1211
|
+
.long L3
|
1212
|
+
.long 0x04000000 /* use dwarf unwind info */
|
1213
|
+
.long 0
|
1214
|
+
.long 0
|
1215
|
+
|
1216
|
+
/* compact unwind for ffi_closure_i386 */
|
1217
|
+
.long C(ffi_closure_i386)
|
1218
|
+
.set L4,L(UW20)-L(UW12)
|
1219
|
+
.long L4
|
1220
|
+
.long 0x04000000 /* use dwarf unwind info */
|
1221
|
+
.long 0
|
1222
|
+
.long 0
|
1223
|
+
|
1224
|
+
/* compact unwind for ffi_go_closure_STDCALL */
|
1225
|
+
.long C(ffi_go_closure_STDCALL)
|
1226
|
+
.set L5,L(UW23)-L(UW21)
|
1227
|
+
.long L5
|
1228
|
+
.long 0x04000000 /* use dwarf unwind info */
|
1229
|
+
.long 0
|
1230
|
+
.long 0
|
1231
|
+
|
1232
|
+
/* compact unwind for ffi_closure_REGISTER */
|
1233
|
+
.long C(ffi_closure_REGISTER)
|
1234
|
+
.set L6,L(UW26)-L(UW24)
|
1235
|
+
.long L6
|
1236
|
+
.long 0x04000000 /* use dwarf unwind info */
|
1237
|
+
.long 0
|
1238
|
+
.long 0
|
1239
|
+
|
1240
|
+
/* compact unwind for ffi_closure_STDCALL */
|
1241
|
+
.long C(ffi_closure_STDCALL)
|
1242
|
+
.set L7,L(UW31)-L(UW27)
|
1243
|
+
.long L7
|
1244
|
+
.long 0x04000000 /* use dwarf unwind info */
|
1245
|
+
.long 0
|
1246
|
+
.long 0
|
1247
|
+
|
1248
|
+
/* compact unwind for ffi_closure_raw_SYSV */
|
1249
|
+
.long C(ffi_closure_raw_SYSV)
|
1250
|
+
.set L8,L(UW40)-L(UW32)
|
1251
|
+
.long L8
|
1252
|
+
.long 0x04000000 /* use dwarf unwind info */
|
1253
|
+
.long 0
|
1254
|
+
.long 0
|
1255
|
+
|
1256
|
+
/* compact unwind for ffi_closure_raw_THISCALL */
|
1257
|
+
.long C(ffi_closure_raw_THISCALL)
|
1258
|
+
.set L9,L(UW52)-L(UW41)
|
1259
|
+
.long L9
|
1260
|
+
.long 0x04000000 /* use dwarf unwind info */
|
1261
|
+
.long 0
|
1262
|
+
.long 0
|
1263
|
+
#endif /* use compact unwind */
|
1264
|
+
#endif /* __APPLE__ */
|
1265
|
+
|
1266
|
+
#endif /* ifndef _MSC_VER */
|
1267
|
+
|
1268
|
+
#endif /* ifdef __i386__ */
|
465
1269
|
|
466
1270
|
#if defined __ELF__ && defined __linux__
|
467
1271
|
.section .note.GNU-stack,"",@progbits
|