ffi 1.9.25 → 1.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (285) hide show
  1. checksums.yaml +4 -4
  2. data/{appveyor.yml → .appveyor.yml} +7 -2
  3. data/.gitignore +3 -0
  4. data/.gitmodules +1 -0
  5. data/.travis.yml +22 -30
  6. data/CHANGELOG.md +107 -0
  7. data/Gemfile +2 -2
  8. data/README.md +29 -17
  9. data/Rakefile +17 -89
  10. data/ext/ffi_c/AbstractMemory.c +5 -9
  11. data/ext/ffi_c/Call.c +18 -39
  12. data/ext/ffi_c/Call.h +4 -7
  13. data/ext/ffi_c/DynamicLibrary.c +1 -1
  14. data/ext/ffi_c/Function.c +29 -113
  15. data/ext/ffi_c/LastError.c +47 -2
  16. data/ext/ffi_c/LongDouble.c +7 -7
  17. data/ext/ffi_c/Platform.c +0 -47
  18. data/ext/ffi_c/Struct.c +47 -51
  19. data/ext/ffi_c/Struct.h +12 -6
  20. data/ext/ffi_c/StructLayout.c +13 -12
  21. data/ext/ffi_c/Thread.c +6 -222
  22. data/ext/ffi_c/Thread.h +2 -13
  23. data/ext/ffi_c/Type.c +0 -18
  24. data/ext/ffi_c/Type.h +0 -1
  25. data/ext/ffi_c/Types.c +1 -1
  26. data/ext/ffi_c/Variadic.c +9 -15
  27. data/ext/ffi_c/extconf.rb +34 -21
  28. data/ext/ffi_c/ffi.c +3 -8
  29. data/ext/ffi_c/libffi/.appveyor.yml +29 -13
  30. data/ext/ffi_c/libffi/.gitattributes +4 -0
  31. data/ext/ffi_c/libffi/.travis/bfin-sim.exp +58 -0
  32. data/ext/ffi_c/libffi/.travis/build-cross-in-container.sh +14 -0
  33. data/ext/ffi_c/libffi/.travis/build-in-container.sh +12 -0
  34. data/ext/ffi_c/libffi/.travis/build.sh +112 -8
  35. data/ext/ffi_c/libffi/.travis/install.sh +65 -16
  36. data/ext/ffi_c/libffi/.travis/m32r-sim.exp +58 -0
  37. data/ext/ffi_c/libffi/.travis/or1k-sim.exp +58 -0
  38. data/ext/ffi_c/libffi/.travis/powerpc-eabisim.exp +58 -0
  39. data/ext/ffi_c/libffi/.travis/site.exp +10 -1
  40. data/ext/ffi_c/libffi/.travis/wine-sim.exp +55 -0
  41. data/ext/ffi_c/libffi/.travis.yml +47 -2
  42. data/ext/ffi_c/libffi/{ChangeLog.libffi-3.1 → ChangeLog.old} +1407 -0
  43. data/ext/ffi_c/libffi/LICENSE +1 -1
  44. data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +5 -4
  45. data/ext/ffi_c/libffi/Makefile.am +33 -40
  46. data/ext/ffi_c/libffi/Makefile.in +392 -176
  47. data/ext/ffi_c/libffi/README.md +23 -8
  48. data/ext/ffi_c/libffi/configure +319 -343
  49. data/ext/ffi_c/libffi/configure.ac +6 -2
  50. data/ext/ffi_c/libffi/configure.host +26 -9
  51. data/ext/ffi_c/libffi/doc/Makefile.in +9 -5
  52. data/ext/ffi_c/libffi/doc/libffi.texi +26 -14
  53. data/ext/ffi_c/libffi/doc/version.texi +4 -4
  54. data/ext/ffi_c/libffi/fficonfig.h.in +4 -0
  55. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +1 -3
  56. data/ext/ffi_c/libffi/include/Makefile.in +10 -6
  57. data/ext/ffi_c/libffi/include/ffi.h.in +11 -7
  58. data/ext/ffi_c/libffi/include/ffi_common.h +5 -1
  59. data/ext/ffi_c/libffi/install-sh +23 -13
  60. data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +2 -48
  61. data/ext/ffi_c/libffi/ltmain.sh +153 -60
  62. data/ext/ffi_c/libffi/m4/asmcfi.m4 +1 -1
  63. data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +5 -26
  64. data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +5 -26
  65. data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +2 -1
  66. data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +5 -26
  67. data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +7 -3
  68. data/ext/ffi_c/libffi/make_sunver.pl +333 -0
  69. data/ext/ffi_c/libffi/man/Makefile.in +9 -5
  70. data/ext/ffi_c/libffi/missing +8 -8
  71. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.sln +33 -0
  72. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj +130 -0
  73. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.filters +57 -0
  74. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.user +4 -0
  75. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +511 -0
  76. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/fficonfig.h +219 -0
  77. data/ext/ffi_c/libffi/msvcc.sh +27 -2
  78. data/ext/ffi_c/libffi/src/aarch64/ffi.c +126 -58
  79. data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +13 -2
  80. data/ext/ffi_c/libffi/src/aarch64/sysv.S +8 -6
  81. data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +506 -0
  82. data/ext/ffi_c/libffi/src/arm/ffi.c +40 -5
  83. data/ext/ffi_c/libffi/src/arm/ffitarget.h +8 -1
  84. data/ext/ffi_c/libffi/src/arm/sysv.S +2 -0
  85. data/ext/ffi_c/libffi/src/arm/sysv_msvc_arm32.S +311 -0
  86. data/ext/ffi_c/libffi/src/closures.c +41 -9
  87. data/ext/ffi_c/libffi/src/frv/ffi.c +1 -1
  88. data/ext/ffi_c/libffi/src/metag/ffi.c +1 -1
  89. data/ext/ffi_c/libffi/src/mips/o32.S +2 -0
  90. data/ext/ffi_c/libffi/src/moxie/ffi.c +1 -1
  91. data/ext/ffi_c/libffi/src/pa/linux.S +23 -2
  92. data/ext/ffi_c/libffi/src/powerpc/ffi.c +6 -4
  93. data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +211 -32
  94. data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +18 -7
  95. data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +10 -4
  96. data/ext/ffi_c/libffi/src/powerpc/linux64.S +83 -28
  97. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +68 -4
  98. data/ext/ffi_c/libffi/src/prep_cif.c +4 -2
  99. data/ext/ffi_c/libffi/src/riscv/ffi.c +42 -6
  100. data/ext/ffi_c/libffi/src/riscv/ffitarget.h +1 -0
  101. data/ext/ffi_c/libffi/src/riscv/sysv.S +86 -7
  102. data/ext/ffi_c/libffi/src/x86/ffi.c +14 -6
  103. data/ext/ffi_c/libffi/src/x86/ffi64.c +5 -3
  104. data/ext/ffi_c/libffi/src/x86/ffiw64.c +5 -2
  105. data/ext/ffi_c/libffi/src/x86/sysv.S +90 -4
  106. data/ext/ffi_c/libffi/src/x86/sysv_intel.S +995 -0
  107. data/ext/ffi_c/libffi/src/x86/unix64.S +41 -0
  108. data/ext/ffi_c/libffi/src/x86/win64.S +5 -0
  109. data/ext/ffi_c/libffi/testsuite/Makefile.am +114 -109
  110. data/ext/ffi_c/libffi/testsuite/Makefile.in +124 -84
  111. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +26 -22
  112. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +7 -2
  113. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +1 -1
  114. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +1 -1
  115. data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +12 -1
  116. data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +9 -8
  117. data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +1 -1
  118. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure.exp +67 -0
  119. data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +138 -0
  120. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/huge_struct.c +1 -1
  121. data/ext/ffi_c/libffi.darwin.mk +1 -1
  122. data/ext/ffi_c/rbffi.h +0 -2
  123. data/ffi.gemspec +12 -5
  124. data/lib/ffi/data_converter.rb +67 -0
  125. data/lib/ffi/ffi.rb +2 -0
  126. data/lib/ffi/library.rb +6 -6
  127. data/lib/ffi/platform/aarch64-freebsd/types.conf +128 -0
  128. data/lib/ffi/platform/aarch64-freebsd12/types.conf +128 -0
  129. data/lib/ffi/platform/aarch64-linux/types.conf +81 -81
  130. data/lib/ffi/platform/arm-freebsd/types.conf +152 -0
  131. data/lib/ffi/platform/arm-freebsd12/types.conf +152 -0
  132. data/lib/ffi/platform/arm-linux/types.conf +79 -79
  133. data/lib/ffi/platform/i386-cygwin/types.conf +1 -1
  134. data/lib/ffi/platform/i386-darwin/types.conf +63 -63
  135. data/lib/ffi/platform/i386-freebsd/types.conf +89 -89
  136. data/lib/ffi/platform/i386-freebsd12/types.conf +152 -0
  137. data/lib/ffi/platform/i386-gnu/types.conf +84 -84
  138. data/lib/ffi/platform/i386-linux/types.conf +77 -77
  139. data/lib/ffi/platform/i386-netbsd/types.conf +87 -87
  140. data/lib/ffi/platform/i386-openbsd/types.conf +89 -89
  141. data/lib/ffi/platform/i386-solaris/types.conf +96 -96
  142. data/lib/ffi/platform/i386-windows/types.conf +84 -84
  143. data/lib/ffi/platform/ia64-linux/types.conf +79 -79
  144. data/lib/ffi/platform/mips-linux/types.conf +79 -79
  145. data/lib/ffi/platform/mips64-linux/types.conf +81 -81
  146. data/lib/ffi/platform/mips64el-linux/types.conf +81 -81
  147. data/lib/ffi/platform/mipsel-linux/types.conf +79 -79
  148. data/lib/ffi/platform/mipsisa32r6-linux/types.conf +79 -79
  149. data/lib/ffi/platform/mipsisa32r6el-linux/types.conf +79 -79
  150. data/lib/ffi/platform/mipsisa64r6-linux/types.conf +81 -81
  151. data/lib/ffi/platform/mipsisa64r6el-linux/types.conf +81 -81
  152. data/lib/ffi/platform/powerpc-aix/types.conf +155 -155
  153. data/lib/ffi/platform/powerpc-darwin/types.conf +63 -63
  154. data/lib/ffi/platform/powerpc-linux/types.conf +77 -77
  155. data/lib/ffi/platform/powerpc64-linux/types.conf +81 -81
  156. data/lib/ffi/platform/s390-linux/types.conf +79 -79
  157. data/lib/ffi/platform/s390x-linux/types.conf +79 -79
  158. data/lib/ffi/platform/sparc-linux/types.conf +79 -79
  159. data/lib/ffi/platform/sparc-solaris/types.conf +103 -103
  160. data/lib/ffi/platform/sparc64-linux/types.conf +79 -79
  161. data/lib/ffi/platform/sparcv9-solaris/types.conf +103 -103
  162. data/lib/ffi/platform/x86_64-cygwin/types.conf +1 -1
  163. data/lib/ffi/platform/x86_64-darwin/types.conf +84 -84
  164. data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +148 -0
  165. data/lib/ffi/platform/x86_64-freebsd/types.conf +90 -90
  166. data/lib/ffi/platform/x86_64-freebsd12/types.conf +158 -0
  167. data/lib/ffi/platform/x86_64-linux/types.conf +86 -77
  168. data/lib/ffi/platform/x86_64-netbsd/types.conf +89 -89
  169. data/lib/ffi/platform/x86_64-openbsd/types.conf +86 -86
  170. data/lib/ffi/platform/x86_64-solaris/types.conf +96 -96
  171. data/lib/ffi/platform/x86_64-windows/types.conf +99 -99
  172. data/lib/ffi/platform.rb +13 -2
  173. data/lib/ffi/pointer.rb +5 -6
  174. data/lib/ffi/struct.rb +5 -66
  175. data/lib/ffi/struct_by_reference.rb +72 -0
  176. data/lib/ffi/struct_layout.rb +96 -0
  177. data/lib/ffi/tools/const_generator.rb +5 -4
  178. data/lib/ffi/tools/generator.rb +47 -2
  179. data/lib/ffi/tools/generator_task.rb +13 -17
  180. data/lib/ffi/tools/struct_generator.rb +4 -4
  181. data/lib/ffi/tools/types_generator.rb +5 -4
  182. data/lib/ffi/types.rb +1 -1
  183. data/lib/ffi/version.rb +1 -1
  184. metadata +144 -115
  185. data/ext/ffi_c/DataConverter.c +0 -91
  186. data/ext/ffi_c/StructByReference.c +0 -190
  187. data/ext/ffi_c/StructByReference.h +0 -50
  188. data/ext/ffi_c/libffi/ChangeLog.libffi +0 -584
  189. data/ext/ffi_c/libffi/ChangeLog.libgcj +0 -40
  190. data/ext/ffi_c/libffi/ChangeLog.v1 +0 -764
  191. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn0.c +0 -0
  192. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn1.c +0 -0
  193. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn2.c +0 -0
  194. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn3.c +0 -0
  195. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn4.c +0 -0
  196. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn5.c +0 -0
  197. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn6.c +0 -0
  198. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_loc_fn0.c +0 -0
  199. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_simple.c +0 -0
  200. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_12byte.c +0 -0
  201. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_16byte.c +0 -0
  202. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_18byte.c +0 -0
  203. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_19byte.c +0 -0
  204. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_1_1byte.c +0 -0
  205. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte.c +0 -0
  206. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte1.c +0 -0
  207. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_24byte.c +0 -0
  208. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_2byte.c +0 -0
  209. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3_1byte.c +0 -0
  210. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte1.c +0 -0
  211. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte2.c +0 -0
  212. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3float.c +0 -0
  213. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4_1byte.c +0 -0
  214. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4byte.c +0 -0
  215. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5_1_byte.c +0 -0
  216. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5byte.c +0 -0
  217. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_64byte.c +0 -0
  218. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6_1_byte.c +0 -0
  219. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6byte.c +0 -0
  220. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7_1_byte.c +0 -0
  221. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7byte.c +0 -0
  222. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_8byte.c +0 -0
  223. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte1.c +0 -0
  224. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte2.c +0 -0
  225. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_double.c +0 -0
  226. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_float.c +0 -0
  227. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble.c +0 -0
  228. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split.c +0 -0
  229. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split2.c +0 -0
  230. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_pointer.c +0 -0
  231. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint16.c +0 -0
  232. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint32.c +0 -0
  233. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint64.c +0 -0
  234. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint16.c +0 -0
  235. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint32.c +0 -0
  236. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint64.c +0 -0
  237. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_dbls_struct.c +0 -0
  238. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double.c +0 -0
  239. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double_va.c +0 -0
  240. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_float.c +0 -0
  241. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble.c +0 -0
  242. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble_va.c +0 -0
  243. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_many_mixed_args.c +0 -0
  244. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_many_mixed_float_double.c +0 -0
  245. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_schar.c +0 -0
  246. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshort.c +0 -0
  247. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshortchar.c +0 -0
  248. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_uchar.c +0 -0
  249. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushort.c +0 -0
  250. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushortchar.c +0 -0
  251. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer.c +0 -0
  252. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer_stack.c +0 -0
  253. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_schar.c +0 -0
  254. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sint.c +0 -0
  255. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sshort.c +0 -0
  256. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_struct_va1.c +0 -0
  257. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uchar.c +0 -0
  258. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uchar_va.c +0 -0
  259. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint.c +0 -0
  260. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint_va.c +0 -0
  261. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulong_va.c +0 -0
  262. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulonglong.c +0 -0
  263. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort.c +0 -0
  264. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort_va.c +0 -0
  265. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/err_bad_abi.c +0 -0
  266. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct.c +0 -0
  267. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct1.c +0 -0
  268. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct10.c +0 -0
  269. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct11.c +0 -0
  270. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct2.c +0 -0
  271. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct3.c +0 -0
  272. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct4.c +0 -0
  273. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct5.c +0 -0
  274. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct6.c +0 -0
  275. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct7.c +0 -0
  276. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct8.c +0 -0
  277. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct9.c +0 -0
  278. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/problem1.c +0 -0
  279. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large.c +0 -0
  280. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large2.c +0 -0
  281. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium.c +0 -0
  282. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium2.c +0 -0
  283. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/testclosure.c +0 -0
  284. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest.cc +0 -0
  285. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest_ffi_call.cc +0 -0
@@ -0,0 +1,219 @@
1
+ /* fficonfig.h. Generated from fficonfig.h.in by configure. */
2
+ /* fficonfig.h.in. Generated from configure.ac by autoheader. */
3
+
4
+ /* Define if building universal (internal helper macro) */
5
+ /* #undef AC_APPLE_UNIVERSAL_BUILD */
6
+
7
+ /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
8
+ systems. This function is required for `alloca.c' support on those systems.
9
+ */
10
+ /* #undef CRAY_STACKSEG_END */
11
+
12
+ /* Define to 1 if using `alloca.c'. */
13
+ /* #undef C_ALLOCA */
14
+
15
+ /* Define to the flags needed for the .section .eh_frame directive. */
16
+ #define EH_FRAME_FLAGS "a"
17
+
18
+ /* Define this if you want extra debugging. */
19
+ /* #undef FFI_DEBUG */
20
+
21
+ /* Cannot use PROT_EXEC on this target, so, we revert to alternative means */
22
+ /* #undef FFI_EXEC_TRAMPOLINE_TABLE */
23
+
24
+ /* Define this if you want to enable pax emulated trampolines */
25
+ /* #undef FFI_MMAP_EXEC_EMUTRAMP_PAX */
26
+
27
+ /* Cannot use malloc on this target, so, we revert to alternative means */
28
+ /* #undef FFI_MMAP_EXEC_WRIT */
29
+
30
+ /* Define this if you do not want support for the raw API. */
31
+ /* #undef FFI_NO_RAW_API */
32
+
33
+ /* Define this if you do not want support for aggregate types. */
34
+ /* #undef FFI_NO_STRUCTS */
35
+
36
+ /* Define to 1 if you have `alloca', as a function or macro. */
37
+ #define HAVE_ALLOCA 1
38
+
39
+ /* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
40
+ */
41
+ /*#define HAVE_ALLOCA_H 1 */
42
+
43
+ /* Define if your assembler supports .cfi_* directives. */
44
+ #define HAVE_AS_CFI_PSEUDO_OP 1
45
+
46
+ /* Define if your assembler supports .register. */
47
+ /* #undef HAVE_AS_REGISTER_PSEUDO_OP */
48
+
49
+ /* Define if the compiler uses zarch features. */
50
+ /* #undef HAVE_AS_S390_ZARCH */
51
+
52
+ /* Define if your assembler and linker support unaligned PC relative relocs.
53
+ */
54
+ /* #undef HAVE_AS_SPARC_UA_PCREL */
55
+
56
+ /* Define if your assembler supports unwind section type. */
57
+ /* #undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE */
58
+
59
+ /* Define if your assembler supports PC relative relocs. */
60
+ /* #undef HAVE_AS_X86_PCREL */
61
+
62
+ /* Define to 1 if you have the <dlfcn.h> header file. */
63
+ #define HAVE_DLFCN_H 1
64
+
65
+ /* Define if __attribute__((visibility("hidden"))) is supported. */
66
+ #define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1
67
+
68
+ /* Define to 1 if you have the <inttypes.h> header file. */
69
+ #define HAVE_INTTYPES_H 1
70
+
71
+ /* Define if you have the long double type and it is bigger than a double */
72
+ #define HAVE_LONG_DOUBLE 1
73
+
74
+ /* Define if you support more than one size of the long double type */
75
+ /* #undef HAVE_LONG_DOUBLE_VARIANT */
76
+
77
+ /* Define to 1 if you have the `memcpy' function. */
78
+ #define HAVE_MEMCPY 1
79
+
80
+ /* Define to 1 if you have the <memory.h> header file. */
81
+ #define HAVE_MEMORY_H 1
82
+
83
+ /* Define to 1 if you have the `mkostemp' function. */
84
+ #define HAVE_MKOSTEMP 1
85
+
86
+ /* Define to 1 if you have the `mmap' function. */
87
+ #define HAVE_MMAP 1
88
+
89
+ /* Define if mmap with MAP_ANON(YMOUS) works. */
90
+ #define HAVE_MMAP_ANON 1
91
+
92
+ /* Define if mmap of /dev/zero works. */
93
+ #define HAVE_MMAP_DEV_ZERO 1
94
+
95
+ /* Define if read-only mmap of a plain file works. */
96
+ #define HAVE_MMAP_FILE 1
97
+
98
+ /* Define if .eh_frame sections should be read-only. */
99
+ #define HAVE_RO_EH_FRAME 1
100
+
101
+ /* Define to 1 if you have the <stdint.h> header file. */
102
+ #define HAVE_STDINT_H 1
103
+
104
+ /* Define to 1 if you have the <stdlib.h> header file. */
105
+ //#define HAVE_STDLIB_H 0
106
+ #define LACKS_STDLIB_H 1
107
+ /* Define to 1 if you have the <strings.h> header file. */
108
+ #define HAVE_STRINGS_H 1
109
+
110
+ /* Define to 1 if you have the <string.h> header file. */
111
+ #define HAVE_STRING_H 1
112
+
113
+ /* Define to 1 if you have the <sys/mman.h> header file. */
114
+ #define HAVE_SYS_MMAN_H 1
115
+
116
+ /* Define to 1 if you have the <sys/stat.h> header file. */
117
+ #define HAVE_SYS_STAT_H 1
118
+
119
+ /* Define to 1 if you have the <sys/types.h> header file. */
120
+ #define HAVE_SYS_TYPES_H 1
121
+
122
+ /* Define to 1 if you have the <unistd.h> header file. */
123
+ #define HAVE_UNISTD_H 1
124
+
125
+ /* Define to 1 if GNU symbol versioning is used for libatomic. */
126
+ #define LIBFFI_GNU_SYMBOL_VERSIONING 1
127
+
128
+ /* Define to the sub-directory in which libtool stores uninstalled libraries.
129
+ */
130
+ #define LT_OBJDIR ".libs/"
131
+
132
+ /* Define to 1 if your C compiler doesn't accept -c and -o together. */
133
+ /* #undef NO_MINUS_C_MINUS_O */
134
+
135
+ /* Name of package */
136
+ #define PACKAGE "libffi"
137
+
138
+ /* Define to the address where bug reports for this package should be sent. */
139
+ #define PACKAGE_BUGREPORT "http://github.com/libffi/libffi/issues"
140
+
141
+ /* Define to the full name of this package. */
142
+ #define PACKAGE_NAME "libffi"
143
+
144
+ /* Define to the full name and version of this package. */
145
+ #define PACKAGE_STRING "libffi 3.3-rc0"
146
+
147
+ /* Define to the one symbol short name of this package. */
148
+ #define PACKAGE_TARNAME "libffi"
149
+
150
+ /* Define to the home page for this package. */
151
+ #define PACKAGE_URL ""
152
+
153
+ /* Define to the version of this package. */
154
+ #define PACKAGE_VERSION "3.3-rc0"
155
+
156
+ /* The size of `double', as computed by sizeof. */
157
+ #define SIZEOF_DOUBLE 8
158
+
159
+ /* The size of `long double', as computed by sizeof. */
160
+ #define SIZEOF_LONG_DOUBLE 8
161
+
162
+ /* The size of `size_t', as computed by sizeof. */
163
+ #define SIZEOF_SIZE_T 8
164
+
165
+ /* If using the C implementation of alloca, define if you know the
166
+ direction of stack growth for your system; otherwise it will be
167
+ automatically deduced at runtime.
168
+ STACK_DIRECTION > 0 => grows toward higher addresses
169
+ STACK_DIRECTION < 0 => grows toward lower addresses
170
+ STACK_DIRECTION = 0 => direction of growth unknown */
171
+ /* #undef STACK_DIRECTION */
172
+
173
+ /* Define to 1 if you have the ANSI C header files. */
174
+ #define STDC_HEADERS 1
175
+
176
+ /* Define if symbols are underscored. */
177
+ /* #undef SYMBOL_UNDERSCORE */
178
+
179
+ /* Define this if you are using Purify and want to suppress spurious messages.
180
+ */
181
+ /* #undef USING_PURIFY */
182
+
183
+ /* Version number of package */
184
+ #define VERSION "3.3-rc0"
185
+
186
+ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
187
+ significant byte first (like Motorola and SPARC, unlike Intel). */
188
+ #if defined AC_APPLE_UNIVERSAL_BUILD
189
+ # if defined __BIG_ENDIAN__
190
+ # define WORDS_BIGENDIAN 1
191
+ # endif
192
+ #else
193
+ # ifndef WORDS_BIGENDIAN
194
+ /* # undef WORDS_BIGENDIAN */
195
+ # endif
196
+ #endif
197
+
198
+ /* Define to `unsigned int' if <sys/types.h> does not define. */
199
+ /* #undef size_t */
200
+
201
+
202
+ #ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
203
+ #ifdef LIBFFI_ASM
204
+ #ifdef __APPLE__
205
+ #define FFI_HIDDEN(name) .private_extern name
206
+ #else
207
+ #define FFI_HIDDEN(name) .hidden name
208
+ #endif
209
+ #else
210
+ #define FFI_HIDDEN __attribute__ ((visibility ("hidden")))
211
+ #endif
212
+ #else
213
+ #ifdef LIBFFI_ASM
214
+ #define FFI_HIDDEN(name)
215
+ #else
216
+ #define FFI_HIDDEN
217
+ #endif
218
+ #endif
219
+
@@ -60,7 +60,7 @@ do
60
60
  case $1
61
61
  in
62
62
  --verbose)
63
- $verbose=1
63
+ verbose=1
64
64
  shift 1
65
65
  ;;
66
66
  --version)
@@ -80,6 +80,16 @@ do
80
80
  safeseh=
81
81
  shift 1
82
82
  ;;
83
+ -marm)
84
+ ml='armasm'
85
+ safeseh=
86
+ shift 1
87
+ ;;
88
+ -marm64)
89
+ ml='armasm64'
90
+ safeseh=
91
+ shift 1
92
+ ;;
83
93
  -clang-cl)
84
94
  cl="clang-cl"
85
95
  shift 1
@@ -237,6 +247,7 @@ do
237
247
  else
238
248
  output="-Fe$2"
239
249
  fi
250
+ armasm_output="-o $2"
240
251
  if [ -n "$assembly" ]; then
241
252
  args="$args $output"
242
253
  else
@@ -289,13 +300,27 @@ if [ -n "$assembly" ]; then
289
300
  fi
290
301
  ppsrc="$outdir/$(basename $src|sed 's/.S$/.asm/g')"
291
302
 
303
+ if [ $ml = "armasm" ]; then
304
+ defines="$defines -D_M_ARM"
305
+ fi
306
+
307
+ if [ $ml = "armasm64" ]; then
308
+ defines="$defines -D_M_ARM64"
309
+ fi
310
+
292
311
  if test -n "$verbose"; then
293
312
  echo "$cl -nologo -EP $includes $defines $src > $ppsrc"
294
313
  fi
295
314
 
296
315
  "$cl" -nologo -EP $includes $defines $src > $ppsrc || exit $?
297
316
  output="$(echo $output | sed 's%/F[dpa][^ ]*%%g')"
298
- args="-nologo $safeseh $single $output $ppsrc"
317
+ if [ $ml = "armasm" ]; then
318
+ args="-nologo -g -oldit $armasm_output $ppsrc -errorReport:prompt"
319
+ elif [ $ml = "armasm64" ]; then
320
+ args="-nologo -g $armasm_output $ppsrc -errorReport:prompt"
321
+ else
322
+ args="-nologo $safeseh $single $output $ppsrc"
323
+ fi
299
324
 
300
325
  if test -n "$verbose"; then
301
326
  echo "$ml $args"
@@ -19,6 +19,7 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
19
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
20
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
21
21
 
22
+ #if defined(__aarch64__) || defined(__arm64__)|| defined (_M_ARM64)
22
23
  #include <stdio.h>
23
24
  #include <stdlib.h>
24
25
  #include <stdint.h>
@@ -26,6 +27,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
26
27
  #include <ffi.h>
27
28
  #include <ffi_common.h>
28
29
  #include "internal.h"
30
+ #ifdef _M_ARM64
31
+ #include <windows.h> /* FlushInstructionCache */
32
+ #endif
29
33
 
30
34
  /* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE;
31
35
  all further uses in this file will refer to the 128-bit type. */
@@ -74,6 +78,8 @@ ffi_clear_cache (void *start, void *end)
74
78
  sys_icache_invalidate (start, (char *)end - (char *)start);
75
79
  #elif defined (__GNUC__)
76
80
  __builtin___clear_cache (start, end);
81
+ #elif defined (_M_ARM64)
82
+ FlushInstructionCache(GetCurrentProcess(), start, (char*)end - (char*)start);
77
83
  #else
78
84
  #error "Missing builtin to flush instruction cache"
79
85
  #endif
@@ -315,6 +321,9 @@ extend_integer_type (void *source, int type)
315
321
  }
316
322
  }
317
323
 
324
+ #if defined(_MSC_VER)
325
+ void extend_hfa_type (void *dest, void *src, int h);
326
+ #else
318
327
  static void
319
328
  extend_hfa_type (void *dest, void *src, int h)
320
329
  {
@@ -350,10 +359,10 @@ extend_hfa_type (void *dest, void *src, int h)
350
359
  " b 1f\n"
351
360
  " nop\n"
352
361
  " ldp q16, q17, [%3]\n" /* Q4 */
353
- " ldp q18, q19, [%3, #16]\n"
362
+ " ldp q18, q19, [%3, #32]\n"
354
363
  " b 4f\n"
355
364
  " ldp q16, q17, [%3]\n" /* Q3 */
356
- " ldr q18, [%3, #16]\n"
365
+ " ldr q18, [%3, #32]\n"
357
366
  " b 3f\n"
358
367
  " ldp q16, q17, [%3]\n" /* Q2 */
359
368
  " b 2f\n"
@@ -368,7 +377,11 @@ extend_hfa_type (void *dest, void *src, int h)
368
377
  : "r"(f * 12), "r"(dest), "r"(src)
369
378
  : "memory", "v16", "v17", "v18", "v19");
370
379
  }
380
+ #endif
371
381
 
382
+ #if defined(_MSC_VER)
383
+ void* compress_hfa_type (void *dest, void *src, int h);
384
+ #else
372
385
  static void *
373
386
  compress_hfa_type (void *dest, void *reg, int h)
374
387
  {
@@ -437,6 +450,7 @@ compress_hfa_type (void *dest, void *reg, int h)
437
450
  }
438
451
  return dest;
439
452
  }
453
+ #endif
440
454
 
441
455
  /* Either allocate an appropriate register for the argument type, or if
442
456
  none are available, allocate a stack slot and return a pointer
@@ -454,7 +468,7 @@ allocate_int_to_reg_or_stack (struct call_context *context,
454
468
  return allocate_to_stack (state, stack, size, size);
455
469
  }
456
470
 
457
- ffi_status
471
+ ffi_status FFI_HIDDEN
458
472
  ffi_prep_cif_machdep (ffi_cif *cif)
459
473
  {
460
474
  ffi_type *rtype = cif->rtype;
@@ -539,9 +553,9 @@ ffi_prep_cif_machdep (ffi_cif *cif)
539
553
 
540
554
  #if defined (__APPLE__)
541
555
  /* Perform Apple-specific cif processing for variadic calls */
542
- ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif,
543
- unsigned int nfixedargs,
544
- unsigned int ntotalargs)
556
+ ffi_status FFI_HIDDEN
557
+ ffi_prep_cif_machdep_var(ffi_cif *cif, unsigned int nfixedargs,
558
+ unsigned int ntotalargs)
545
559
  {
546
560
  ffi_status status = ffi_prep_cif_machdep (cif);
547
561
  cif->aarch64_nfixedargs = nfixedargs;
@@ -588,8 +602,8 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
588
602
  /* Allocate consectutive stack for everything we'll need. */
589
603
  context = alloca (sizeof(struct call_context) + stack_bytes + 32 + rsize);
590
604
  stack = context + 1;
591
- frame = stack + stack_bytes;
592
- rvalue = (rsize ? frame + 32 : orig_rvalue);
605
+ frame = (void*)((uintptr_t)stack + (uintptr_t)stack_bytes);
606
+ rvalue = (rsize ? (void*)((uintptr_t)frame + 32) : orig_rvalue);
593
607
 
594
608
  arg_init (&state);
595
609
  for (i = 0, nargs = cif->nargs; i < nargs; i++)
@@ -651,6 +665,22 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
651
665
  if (h)
652
666
  {
653
667
  int elems = 4 - (h & 3);
668
+ #ifdef _M_ARM64 /* for handling armasm calling convention */
669
+ if (cif->is_variadic)
670
+ {
671
+ if (state.ngrn + elems <= N_X_ARG_REG)
672
+ {
673
+ dest = &context->x[state.ngrn];
674
+ state.ngrn += elems;
675
+ extend_hfa_type(dest, a, h);
676
+ break;
677
+ }
678
+ state.nsrn = N_X_ARG_REG;
679
+ dest = allocate_to_stack(&state, stack, ty->alignment, s);
680
+ }
681
+ else
682
+ {
683
+ #endif /* for handling armasm calling convention */
654
684
  if (state.nsrn + elems <= N_V_ARG_REG)
655
685
  {
656
686
  dest = &context->v[state.nsrn];
@@ -660,6 +690,9 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
660
690
  }
661
691
  state.nsrn = N_V_ARG_REG;
662
692
  dest = allocate_to_stack (&state, stack, ty->alignment, s);
693
+ #ifdef _M_ARM64 /* for handling armasm calling convention */
694
+ }
695
+ #endif /* for handling armasm calling convention */
663
696
  }
664
697
  else if (s > 16)
665
698
  {
@@ -681,7 +714,7 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
681
714
  X registers, then the argument is copied into
682
715
  consecutive X registers. */
683
716
  dest = &context->x[state.ngrn];
684
- state.ngrn += n;
717
+ state.ngrn += (unsigned int)n;
685
718
  }
686
719
  else
687
720
  {
@@ -773,6 +806,16 @@ ffi_prep_closure_loc (ffi_closure *closure,
773
806
  *(UINT64 *)(tramp + 16) = (uintptr_t)start;
774
807
 
775
808
  ffi_clear_cache(tramp, tramp + FFI_TRAMPOLINE_SIZE);
809
+
810
+ /* Also flush the cache for code mapping. */
811
+ #ifdef _M_ARM64
812
+ // Not using dlmalloc.c for Windows ARM64 builds
813
+ // so calling ffi_data_to_code_pointer() isn't necessary
814
+ unsigned char *tramp_code = tramp;
815
+ #else
816
+ unsigned char *tramp_code = ffi_data_to_code_pointer (tramp);
817
+ #endif
818
+ ffi_clear_cache (tramp_code, tramp_code + FFI_TRAMPOLINE_SIZE);
776
819
  #endif
777
820
 
778
821
  closure->cif = cif;
@@ -871,55 +914,78 @@ ffi_closure_SYSV_inner (ffi_cif *cif,
871
914
  if (h)
872
915
  {
873
916
  n = 4 - (h & 3);
874
- if (state.nsrn + n <= N_V_ARG_REG)
875
- {
876
- void *reg = &context->v[state.nsrn];
877
- state.nsrn += n;
878
-
879
- /* Eeek! We need a pointer to the structure, however the
880
- homogeneous float elements are being passed in individual
881
- registers, therefore for float and double the structure
882
- is not represented as a contiguous sequence of bytes in
883
- our saved register context. We don't need the original
884
- contents of the register storage, so we reformat the
885
- structure into the same memory. */
886
- avalue[i] = compress_hfa_type (reg, reg, h);
887
- }
888
- else
889
- {
890
- state.nsrn = N_V_ARG_REG;
891
- avalue[i] = allocate_to_stack (&state, stack,
892
- ty->alignment, s);
893
- }
894
- }
895
- else if (s > 16)
896
- {
897
- /* Replace Composite type of size greater than 16 with a
898
- pointer. */
899
- avalue[i] = *(void **)
900
- allocate_int_to_reg_or_stack (context, &state, stack,
901
- sizeof (void *));
902
- }
903
- else
904
- {
905
- n = (s + 7) / 8;
906
- if (state.ngrn + n <= N_X_ARG_REG)
907
- {
908
- avalue[i] = &context->x[state.ngrn];
909
- state.ngrn += n;
910
- }
911
- else
912
- {
913
- state.ngrn = N_X_ARG_REG;
914
- avalue[i] = allocate_to_stack (&state, stack,
915
- ty->alignment, s);
916
- }
917
- }
918
- break;
919
-
920
- default:
921
- abort();
922
- }
917
+ #ifdef _M_ARM64 /* for handling armasm calling convention */
918
+ if (cif->is_variadic)
919
+ {
920
+ if (state.ngrn + n <= N_X_ARG_REG)
921
+ {
922
+ void *reg = &context->x[state.ngrn];
923
+ state.ngrn += (unsigned int)n;
924
+
925
+ /* Eeek! We need a pointer to the structure, however the
926
+ homogeneous float elements are being passed in individual
927
+ registers, therefore for float and double the structure
928
+ is not represented as a contiguous sequence of bytes in
929
+ our saved register context. We don't need the original
930
+ contents of the register storage, so we reformat the
931
+ structure into the same memory. */
932
+ avalue[i] = compress_hfa_type(reg, reg, h);
933
+ }
934
+ else
935
+ {
936
+ state.ngrn = N_X_ARG_REG;
937
+ state.nsrn = N_V_ARG_REG;
938
+ avalue[i] = allocate_to_stack(&state, stack,
939
+ ty->alignment, s);
940
+ }
941
+ }
942
+ else
943
+ {
944
+ #endif /* for handling armasm calling convention */
945
+ if (state.nsrn + n <= N_V_ARG_REG)
946
+ {
947
+ void *reg = &context->v[state.nsrn];
948
+ state.nsrn += (unsigned int)n;
949
+ avalue[i] = compress_hfa_type(reg, reg, h);
950
+ }
951
+ else
952
+ {
953
+ state.nsrn = N_V_ARG_REG;
954
+ avalue[i] = allocate_to_stack(&state, stack,
955
+ ty->alignment, s);
956
+ }
957
+ #ifdef _M_ARM64 /* for handling armasm calling convention */
958
+ }
959
+ #endif /* for handling armasm calling convention */
960
+ }
961
+ else if (s > 16)
962
+ {
963
+ /* Replace Composite type of size greater than 16 with a
964
+ pointer. */
965
+ avalue[i] = *(void **)
966
+ allocate_int_to_reg_or_stack (context, &state, stack,
967
+ sizeof (void *));
968
+ }
969
+ else
970
+ {
971
+ n = (s + 7) / 8;
972
+ if (state.ngrn + n <= N_X_ARG_REG)
973
+ {
974
+ avalue[i] = &context->x[state.ngrn];
975
+ state.ngrn += (unsigned int)n;
976
+ }
977
+ else
978
+ {
979
+ state.ngrn = N_X_ARG_REG;
980
+ avalue[i] = allocate_to_stack(&state, stack,
981
+ ty->alignment, s);
982
+ }
983
+ }
984
+ break;
985
+
986
+ default:
987
+ abort();
988
+ }
923
989
 
924
990
  #if defined (__APPLE__)
925
991
  if (i + 1 == cif->aarch64_nfixedargs)
@@ -939,3 +1005,5 @@ ffi_closure_SYSV_inner (ffi_cif *cif,
939
1005
 
940
1006
  return flags;
941
1007
  }
1008
+
1009
+ #endif /* (__aarch64__) || defined(__arm64__)|| defined (_M_ARM64)*/
@@ -32,6 +32,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
32
32
  #define FFI_SIZEOF_JAVA_RAW 4
33
33
  typedef unsigned long long ffi_arg;
34
34
  typedef signed long long ffi_sarg;
35
+ #elif defined(_M_ARM64)
36
+ #define FFI_SIZEOF_ARG 8
37
+ typedef unsigned long long ffi_arg;
38
+ typedef signed long long ffi_sarg;
35
39
  #else
36
40
  typedef unsigned long ffi_arg;
37
41
  typedef signed long ffi_sarg;
@@ -65,17 +69,24 @@ typedef enum ffi_abi
65
69
  #define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE
66
70
  #endif
67
71
 
72
+ #ifdef _M_ARM64
73
+ #define FFI_EXTRA_CIF_FIELDS unsigned is_variadic
74
+ #endif
75
+
68
76
  /* ---- Internal ---- */
69
77
 
70
78
  #if defined (__APPLE__)
71
79
  #define FFI_TARGET_SPECIFIC_VARIADIC
72
80
  #define FFI_EXTRA_CIF_FIELDS unsigned aarch64_nfixedargs
73
- #else
74
- /* iOS reserves x18 for the system. Disable Go closures until
81
+ #elif !defined(_M_ARM64)
82
+ /* iOS and Windows reserve x18 for the system. Disable Go closures until
75
83
  a new static chain is chosen. */
76
84
  #define FFI_GO_CLOSURES 1
77
85
  #endif
78
86
 
87
+ #ifndef _M_ARM64
88
+ /* No complex type on Windows */
79
89
  #define FFI_TARGET_HAS_COMPLEX_TYPE
90
+ #endif
80
91
 
81
92
  #endif
@@ -19,6 +19,7 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
19
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
20
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
21
21
 
22
+ #if defined(__aarch64__) || defined(__arm64__)
22
23
  #define LIBFFI_ASM
23
24
  #include <fficonfig.h>
24
25
  #include <ffi.h>
@@ -198,9 +199,9 @@ CNAME(ffi_call_SYSV):
198
199
  cfi_endproc
199
200
 
200
201
  .globl CNAME(ffi_call_SYSV)
202
+ FFI_HIDDEN(CNAME(ffi_call_SYSV))
201
203
  #ifdef __ELF__
202
204
  .type CNAME(ffi_call_SYSV), #function
203
- .hidden CNAME(ffi_call_SYSV)
204
205
  .size CNAME(ffi_call_SYSV), .-CNAME(ffi_call_SYSV)
205
206
  #endif
206
207
 
@@ -237,9 +238,9 @@ CNAME(ffi_closure_SYSV_V):
237
238
  cfi_endproc
238
239
 
239
240
  .globl CNAME(ffi_closure_SYSV_V)
241
+ FFI_HIDDEN(CNAME(ffi_closure_SYSV_V))
240
242
  #ifdef __ELF__
241
243
  .type CNAME(ffi_closure_SYSV_V), #function
242
- .hidden CNAME(ffi_closure_SYSV_V)
243
244
  .size CNAME(ffi_closure_SYSV_V), . - CNAME(ffi_closure_SYSV_V)
244
245
  #endif
245
246
 
@@ -349,9 +350,9 @@ CNAME(ffi_closure_SYSV):
349
350
  cfi_endproc
350
351
 
351
352
  .globl CNAME(ffi_closure_SYSV)
353
+ FFI_HIDDEN(CNAME(ffi_closure_SYSV))
352
354
  #ifdef __ELF__
353
355
  .type CNAME(ffi_closure_SYSV), #function
354
- .hidden CNAME(ffi_closure_SYSV)
355
356
  .size CNAME(ffi_closure_SYSV), . - CNAME(ffi_closure_SYSV)
356
357
  #endif
357
358
 
@@ -369,9 +370,9 @@ CNAME(ffi_closure_trampoline_table_page):
369
370
  .endr
370
371
 
371
372
  .globl CNAME(ffi_closure_trampoline_table_page)
373
+ FFI_HIDDEN(CNAME(ffi_closure_trampoline_table_page))
372
374
  #ifdef __ELF__
373
375
  .type CNAME(ffi_closure_trampoline_table_page), #function
374
- .hidden CNAME(ffi_closure_trampoline_table_page)
375
376
  .size CNAME(ffi_closure_trampoline_table_page), . - CNAME(ffi_closure_trampoline_table_page)
376
377
  #endif
377
378
  #endif
@@ -396,9 +397,9 @@ CNAME(ffi_go_closure_SYSV_V):
396
397
  cfi_endproc
397
398
 
398
399
  .globl CNAME(ffi_go_closure_SYSV_V)
400
+ FFI_HIDDEN(CNAME(ffi_go_closure_SYSV_V))
399
401
  #ifdef __ELF__
400
402
  .type CNAME(ffi_go_closure_SYSV_V), #function
401
- .hidden CNAME(ffi_go_closure_SYSV_V)
402
403
  .size CNAME(ffi_go_closure_SYSV_V), . - CNAME(ffi_go_closure_SYSV_V)
403
404
  #endif
404
405
 
@@ -425,12 +426,13 @@ CNAME(ffi_go_closure_SYSV):
425
426
  cfi_endproc
426
427
 
427
428
  .globl CNAME(ffi_go_closure_SYSV)
429
+ FFI_HIDDEN(CNAME(ffi_go_closure_SYSV))
428
430
  #ifdef __ELF__
429
431
  .type CNAME(ffi_go_closure_SYSV), #function
430
- .hidden CNAME(ffi_go_closure_SYSV)
431
432
  .size CNAME(ffi_go_closure_SYSV), . - CNAME(ffi_go_closure_SYSV)
432
433
  #endif
433
434
  #endif /* FFI_GO_CLOSURES */
435
+ #endif /* __arm64__ */
434
436
 
435
437
  #if defined __ELF__ && defined __linux__
436
438
  .section .note.GNU-stack,"",%progbits