ffi 1.9.21-x86-mingw32 → 1.9.22-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ffi might be problematic. Click here for more details.

Files changed (551) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +22 -0
  3. data/.gitmodules +3 -0
  4. data/.travis.yml +52 -0
  5. data/.yardopts +5 -0
  6. data/Gemfile +15 -0
  7. data/{spec/ffi/LICENSE.SPECS → LICENSE.SPECS} +1 -1
  8. data/README.md +1 -1
  9. data/Rakefile +28 -3
  10. data/appveyor.yml +22 -0
  11. data/ffi.gemspec +14 -1
  12. data/lib/2.0/ffi_c.so +0 -0
  13. data/lib/2.1/ffi_c.so +0 -0
  14. data/lib/2.2/ffi_c.so +0 -0
  15. data/lib/2.3/ffi_c.so +0 -0
  16. data/lib/2.4/ffi_c.so +0 -0
  17. data/lib/2.5/ffi_c.so +0 -0
  18. data/lib/ffi/library.rb +1 -1
  19. data/lib/ffi/version.rb +1 -1
  20. data/samples/getlogin.rb +8 -0
  21. data/samples/getpid.rb +8 -0
  22. data/samples/gettimeofday.rb +18 -0
  23. data/samples/hello.rb +7 -0
  24. data/samples/inotify.rb +60 -0
  25. data/samples/pty.rb +76 -0
  26. data/samples/qsort.rb +21 -0
  27. data/samples/sample_helper.rb +6 -0
  28. metadata +17 -526
  29. data/ext/ffi_c/AbstractMemory.c +0 -1109
  30. data/ext/ffi_c/AbstractMemory.h +0 -175
  31. data/ext/ffi_c/ArrayType.c +0 -162
  32. data/ext/ffi_c/ArrayType.h +0 -59
  33. data/ext/ffi_c/Buffer.c +0 -365
  34. data/ext/ffi_c/Call.c +0 -517
  35. data/ext/ffi_c/Call.h +0 -110
  36. data/ext/ffi_c/ClosurePool.c +0 -283
  37. data/ext/ffi_c/ClosurePool.h +0 -57
  38. data/ext/ffi_c/DataConverter.c +0 -91
  39. data/ext/ffi_c/DynamicLibrary.c +0 -339
  40. data/ext/ffi_c/DynamicLibrary.h +0 -98
  41. data/ext/ffi_c/Function.c +0 -998
  42. data/ext/ffi_c/Function.h +0 -87
  43. data/ext/ffi_c/FunctionInfo.c +0 -271
  44. data/ext/ffi_c/LastError.c +0 -184
  45. data/ext/ffi_c/LastError.h +0 -47
  46. data/ext/ffi_c/LongDouble.c +0 -63
  47. data/ext/ffi_c/LongDouble.h +0 -51
  48. data/ext/ffi_c/MappedType.c +0 -168
  49. data/ext/ffi_c/MappedType.h +0 -59
  50. data/ext/ffi_c/MemoryPointer.c +0 -197
  51. data/ext/ffi_c/MemoryPointer.h +0 -53
  52. data/ext/ffi_c/MethodHandle.c +0 -358
  53. data/ext/ffi_c/MethodHandle.h +0 -55
  54. data/ext/ffi_c/Platform.c +0 -129
  55. data/ext/ffi_c/Platform.h +0 -45
  56. data/ext/ffi_c/Pointer.c +0 -508
  57. data/ext/ffi_c/Pointer.h +0 -63
  58. data/ext/ffi_c/Struct.c +0 -829
  59. data/ext/ffi_c/Struct.h +0 -106
  60. data/ext/ffi_c/StructByReference.c +0 -190
  61. data/ext/ffi_c/StructByReference.h +0 -50
  62. data/ext/ffi_c/StructByValue.c +0 -150
  63. data/ext/ffi_c/StructByValue.h +0 -55
  64. data/ext/ffi_c/StructLayout.c +0 -698
  65. data/ext/ffi_c/Thread.c +0 -352
  66. data/ext/ffi_c/Thread.h +0 -95
  67. data/ext/ffi_c/Type.c +0 -397
  68. data/ext/ffi_c/Type.h +0 -62
  69. data/ext/ffi_c/Types.c +0 -139
  70. data/ext/ffi_c/Types.h +0 -89
  71. data/ext/ffi_c/Variadic.c +0 -304
  72. data/ext/ffi_c/compat.h +0 -78
  73. data/ext/ffi_c/extconf.rb +0 -71
  74. data/ext/ffi_c/ffi.c +0 -98
  75. data/ext/ffi_c/libffi.bsd.mk +0 -40
  76. data/ext/ffi_c/libffi.darwin.mk +0 -105
  77. data/ext/ffi_c/libffi.gnu.mk +0 -32
  78. data/ext/ffi_c/libffi.mk +0 -18
  79. data/ext/ffi_c/libffi.vc.mk +0 -26
  80. data/ext/ffi_c/libffi.vc64.mk +0 -26
  81. data/ext/ffi_c/libffi/ChangeLog.libffi +0 -584
  82. data/ext/ffi_c/libffi/ChangeLog.libffi-3.1 +0 -6000
  83. data/ext/ffi_c/libffi/ChangeLog.libgcj +0 -40
  84. data/ext/ffi_c/libffi/ChangeLog.v1 +0 -764
  85. data/ext/ffi_c/libffi/LICENSE +0 -21
  86. data/ext/ffi_c/libffi/Makefile.am +0 -205
  87. data/ext/ffi_c/libffi/Makefile.in +0 -1805
  88. data/ext/ffi_c/libffi/README +0 -454
  89. data/ext/ffi_c/libffi/acinclude.m4 +0 -473
  90. data/ext/ffi_c/libffi/aclocal.m4 +0 -2134
  91. data/ext/ffi_c/libffi/autogen.sh +0 -2
  92. data/ext/ffi_c/libffi/autom4te.cache/output.0 +0 -21972
  93. data/ext/ffi_c/libffi/autom4te.cache/output.1 +0 -21972
  94. data/ext/ffi_c/libffi/autom4te.cache/output.2 +0 -21972
  95. data/ext/ffi_c/libffi/autom4te.cache/output.3 +0 -21972
  96. data/ext/ffi_c/libffi/autom4te.cache/requests +0 -331
  97. data/ext/ffi_c/libffi/autom4te.cache/traces.0 +0 -4010
  98. data/ext/ffi_c/libffi/autom4te.cache/traces.1 +0 -1005
  99. data/ext/ffi_c/libffi/autom4te.cache/traces.2 +0 -4010
  100. data/ext/ffi_c/libffi/autom4te.cache/traces.3 +0 -4010
  101. data/ext/ffi_c/libffi/compile +0 -347
  102. data/ext/ffi_c/libffi/config.guess +0 -1462
  103. data/ext/ffi_c/libffi/config.sub +0 -1825
  104. data/ext/ffi_c/libffi/configure +0 -21972
  105. data/ext/ffi_c/libffi/configure.ac +0 -388
  106. data/ext/ffi_c/libffi/configure.host +0 -272
  107. data/ext/ffi_c/libffi/depcomp +0 -791
  108. data/ext/ffi_c/libffi/doc/Makefile.am +0 -3
  109. data/ext/ffi_c/libffi/doc/Makefile.in +0 -811
  110. data/ext/ffi_c/libffi/doc/libffi.texi +0 -985
  111. data/ext/ffi_c/libffi/doc/mdate-sh +0 -228
  112. data/ext/ffi_c/libffi/doc/texinfo.tex +0 -10079
  113. data/ext/ffi_c/libffi/doc/version.texi +0 -4
  114. data/ext/ffi_c/libffi/fficonfig.h.in +0 -210
  115. data/ext/ffi_c/libffi/fficonfig.h.in~ +0 -210
  116. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +0 -207
  117. data/ext/ffi_c/libffi/include/Makefile.am +0 -9
  118. data/ext/ffi_c/libffi/include/Makefile.in +0 -604
  119. data/ext/ffi_c/libffi/include/ffi.h.in +0 -484
  120. data/ext/ffi_c/libffi/include/ffi_cfi.h +0 -55
  121. data/ext/ffi_c/libffi/include/ffi_common.h +0 -147
  122. data/ext/ffi_c/libffi/install-sh +0 -508
  123. data/ext/ffi_c/libffi/libffi.map.in +0 -80
  124. data/ext/ffi_c/libffi/libffi.pc.in +0 -11
  125. data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +0 -637
  126. data/ext/ffi_c/libffi/libtool-ldflags +0 -106
  127. data/ext/ffi_c/libffi/libtool-version +0 -29
  128. data/ext/ffi_c/libffi/ltmain.sh +0 -11156
  129. data/ext/ffi_c/libffi/m4/asmcfi.m4 +0 -13
  130. data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +0 -69
  131. data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +0 -181
  132. data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +0 -122
  133. data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +0 -72
  134. data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +0 -84
  135. data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +0 -70
  136. data/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 +0 -301
  137. data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +0 -225
  138. data/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 +0 -79
  139. data/ext/ffi_c/libffi/m4/libtool.m4 +0 -8387
  140. data/ext/ffi_c/libffi/m4/ltoptions.m4 +0 -437
  141. data/ext/ffi_c/libffi/m4/ltsugar.m4 +0 -124
  142. data/ext/ffi_c/libffi/m4/ltversion.m4 +0 -23
  143. data/ext/ffi_c/libffi/m4/lt~obsolete.m4 +0 -99
  144. data/ext/ffi_c/libffi/man/Makefile.am +0 -8
  145. data/ext/ffi_c/libffi/man/Makefile.in +0 -558
  146. data/ext/ffi_c/libffi/man/ffi.3 +0 -41
  147. data/ext/ffi_c/libffi/man/ffi_call.3 +0 -103
  148. data/ext/ffi_c/libffi/man/ffi_prep_cif.3 +0 -68
  149. data/ext/ffi_c/libffi/man/ffi_prep_cif_var.3 +0 -73
  150. data/ext/ffi_c/libffi/missing +0 -215
  151. data/ext/ffi_c/libffi/msvcc.sh +0 -260
  152. data/ext/ffi_c/libffi/src/aarch64/ffi.c +0 -941
  153. data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +0 -81
  154. data/ext/ffi_c/libffi/src/aarch64/internal.h +0 -67
  155. data/ext/ffi_c/libffi/src/aarch64/sysv.S +0 -438
  156. data/ext/ffi_c/libffi/src/alpha/ffi.c +0 -521
  157. data/ext/ffi_c/libffi/src/alpha/ffitarget.h +0 -57
  158. data/ext/ffi_c/libffi/src/alpha/internal.h +0 -23
  159. data/ext/ffi_c/libffi/src/alpha/osf.S +0 -282
  160. data/ext/ffi_c/libffi/src/arc/arcompact.S +0 -135
  161. data/ext/ffi_c/libffi/src/arc/ffi.c +0 -266
  162. data/ext/ffi_c/libffi/src/arc/ffitarget.h +0 -53
  163. data/ext/ffi_c/libffi/src/arm/ffi.c +0 -808
  164. data/ext/ffi_c/libffi/src/arm/ffitarget.h +0 -82
  165. data/ext/ffi_c/libffi/src/arm/internal.h +0 -7
  166. data/ext/ffi_c/libffi/src/arm/sysv.S +0 -383
  167. data/ext/ffi_c/libffi/src/avr32/ffi.c +0 -423
  168. data/ext/ffi_c/libffi/src/avr32/ffitarget.h +0 -55
  169. data/ext/ffi_c/libffi/src/avr32/sysv.S +0 -208
  170. data/ext/ffi_c/libffi/src/bfin/ffi.c +0 -196
  171. data/ext/ffi_c/libffi/src/bfin/ffitarget.h +0 -43
  172. data/ext/ffi_c/libffi/src/bfin/sysv.S +0 -179
  173. data/ext/ffi_c/libffi/src/closures.c +0 -890
  174. data/ext/ffi_c/libffi/src/cris/ffi.c +0 -386
  175. data/ext/ffi_c/libffi/src/cris/ffitarget.h +0 -56
  176. data/ext/ffi_c/libffi/src/cris/sysv.S +0 -215
  177. data/ext/ffi_c/libffi/src/debug.c +0 -64
  178. data/ext/ffi_c/libffi/src/dlmalloc.c +0 -5166
  179. data/ext/ffi_c/libffi/src/frv/eabi.S +0 -128
  180. data/ext/ffi_c/libffi/src/frv/ffi.c +0 -292
  181. data/ext/ffi_c/libffi/src/frv/ffitarget.h +0 -62
  182. data/ext/ffi_c/libffi/src/ia64/ffi.c +0 -586
  183. data/ext/ffi_c/libffi/src/ia64/ffitarget.h +0 -55
  184. data/ext/ffi_c/libffi/src/ia64/ia64_flags.h +0 -40
  185. data/ext/ffi_c/libffi/src/ia64/unix.S +0 -560
  186. data/ext/ffi_c/libffi/src/java_raw_api.c +0 -374
  187. data/ext/ffi_c/libffi/src/m32r/ffi.c +0 -232
  188. data/ext/ffi_c/libffi/src/m32r/ffitarget.h +0 -53
  189. data/ext/ffi_c/libffi/src/m32r/sysv.S +0 -121
  190. data/ext/ffi_c/libffi/src/m68k/ffi.c +0 -362
  191. data/ext/ffi_c/libffi/src/m68k/ffitarget.h +0 -54
  192. data/ext/ffi_c/libffi/src/m68k/sysv.S +0 -357
  193. data/ext/ffi_c/libffi/src/m88k/ffi.c +0 -400
  194. data/ext/ffi_c/libffi/src/m88k/ffitarget.h +0 -49
  195. data/ext/ffi_c/libffi/src/m88k/obsd.S +0 -209
  196. data/ext/ffi_c/libffi/src/metag/ffi.c +0 -330
  197. data/ext/ffi_c/libffi/src/metag/ffitarget.h +0 -53
  198. data/ext/ffi_c/libffi/src/metag/sysv.S +0 -311
  199. data/ext/ffi_c/libffi/src/microblaze/ffi.c +0 -321
  200. data/ext/ffi_c/libffi/src/microblaze/ffitarget.h +0 -53
  201. data/ext/ffi_c/libffi/src/microblaze/sysv.S +0 -302
  202. data/ext/ffi_c/libffi/src/mips/ffi.c +0 -1105
  203. data/ext/ffi_c/libffi/src/mips/ffitarget.h +0 -249
  204. data/ext/ffi_c/libffi/src/mips/n32.S +0 -661
  205. data/ext/ffi_c/libffi/src/mips/o32.S +0 -502
  206. data/ext/ffi_c/libffi/src/moxie/eabi.S +0 -101
  207. data/ext/ffi_c/libffi/src/moxie/ffi.c +0 -272
  208. data/ext/ffi_c/libffi/src/moxie/ffitarget.h +0 -52
  209. data/ext/ffi_c/libffi/src/nios2/ffi.c +0 -304
  210. data/ext/ffi_c/libffi/src/nios2/ffitarget.h +0 -52
  211. data/ext/ffi_c/libffi/src/nios2/sysv.S +0 -136
  212. data/ext/ffi_c/libffi/src/or1k/ffi.c +0 -328
  213. data/ext/ffi_c/libffi/src/or1k/ffitarget.h +0 -58
  214. data/ext/ffi_c/libffi/src/or1k/sysv.S +0 -107
  215. data/ext/ffi_c/libffi/src/pa/ffi.c +0 -719
  216. data/ext/ffi_c/libffi/src/pa/ffitarget.h +0 -85
  217. data/ext/ffi_c/libffi/src/pa/hpux32.S +0 -368
  218. data/ext/ffi_c/libffi/src/pa/linux.S +0 -357
  219. data/ext/ffi_c/libffi/src/powerpc/aix.S +0 -328
  220. data/ext/ffi_c/libffi/src/powerpc/aix_closure.S +0 -447
  221. data/ext/ffi_c/libffi/src/powerpc/asm.h +0 -125
  222. data/ext/ffi_c/libffi/src/powerpc/darwin.S +0 -378
  223. data/ext/ffi_c/libffi/src/powerpc/darwin_closure.S +0 -571
  224. data/ext/ffi_c/libffi/src/powerpc/ffi.c +0 -173
  225. data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +0 -1359
  226. data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +0 -945
  227. data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +0 -94
  228. data/ext/ffi_c/libffi/src/powerpc/ffi_sysv.c +0 -923
  229. data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +0 -195
  230. data/ext/ffi_c/libffi/src/powerpc/linux64.S +0 -228
  231. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +0 -488
  232. data/ext/ffi_c/libffi/src/powerpc/ppc_closure.S +0 -397
  233. data/ext/ffi_c/libffi/src/powerpc/sysv.S +0 -175
  234. data/ext/ffi_c/libffi/src/prep_cif.c +0 -261
  235. data/ext/ffi_c/libffi/src/raw_api.c +0 -267
  236. data/ext/ffi_c/libffi/src/s390/ffi.c +0 -756
  237. data/ext/ffi_c/libffi/src/s390/ffitarget.h +0 -70
  238. data/ext/ffi_c/libffi/src/s390/internal.h +0 -11
  239. data/ext/ffi_c/libffi/src/s390/sysv.S +0 -325
  240. data/ext/ffi_c/libffi/src/sh/ffi.c +0 -717
  241. data/ext/ffi_c/libffi/src/sh/ffitarget.h +0 -54
  242. data/ext/ffi_c/libffi/src/sh/sysv.S +0 -850
  243. data/ext/ffi_c/libffi/src/sh64/ffi.c +0 -469
  244. data/ext/ffi_c/libffi/src/sh64/ffitarget.h +0 -58
  245. data/ext/ffi_c/libffi/src/sh64/sysv.S +0 -539
  246. data/ext/ffi_c/libffi/src/sparc/ffi.c +0 -468
  247. data/ext/ffi_c/libffi/src/sparc/ffi64.c +0 -608
  248. data/ext/ffi_c/libffi/src/sparc/ffitarget.h +0 -81
  249. data/ext/ffi_c/libffi/src/sparc/internal.h +0 -26
  250. data/ext/ffi_c/libffi/src/sparc/v8.S +0 -443
  251. data/ext/ffi_c/libffi/src/sparc/v9.S +0 -440
  252. data/ext/ffi_c/libffi/src/tile/ffi.c +0 -355
  253. data/ext/ffi_c/libffi/src/tile/ffitarget.h +0 -65
  254. data/ext/ffi_c/libffi/src/tile/tile.S +0 -360
  255. data/ext/ffi_c/libffi/src/types.c +0 -106
  256. data/ext/ffi_c/libffi/src/vax/elfbsd.S +0 -195
  257. data/ext/ffi_c/libffi/src/vax/ffi.c +0 -276
  258. data/ext/ffi_c/libffi/src/vax/ffitarget.h +0 -49
  259. data/ext/ffi_c/libffi/src/x86/asmnames.h +0 -30
  260. data/ext/ffi_c/libffi/src/x86/ffi.c +0 -733
  261. data/ext/ffi_c/libffi/src/x86/ffi64.c +0 -857
  262. data/ext/ffi_c/libffi/src/x86/ffitarget.h +0 -141
  263. data/ext/ffi_c/libffi/src/x86/ffiw64.c +0 -287
  264. data/ext/ffi_c/libffi/src/x86/internal.h +0 -29
  265. data/ext/ffi_c/libffi/src/x86/internal64.h +0 -22
  266. data/ext/ffi_c/libffi/src/x86/sysv.S +0 -1043
  267. data/ext/ffi_c/libffi/src/x86/unix64.S +0 -525
  268. data/ext/ffi_c/libffi/src/x86/win64.S +0 -232
  269. data/ext/ffi_c/libffi/src/x86/win64_intel.S +0 -237
  270. data/ext/ffi_c/libffi/src/xtensa/ffi.c +0 -298
  271. data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +0 -53
  272. data/ext/ffi_c/libffi/src/xtensa/sysv.S +0 -253
  273. data/ext/ffi_c/libffi/stamp-h.in +0 -1
  274. data/ext/ffi_c/libffi/testsuite/Makefile.am +0 -85
  275. data/ext/ffi_c/libffi/testsuite/Makefile.in +0 -607
  276. data/ext/ffi_c/libffi/testsuite/config/default.exp +0 -1
  277. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +0 -445
  278. data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +0 -283
  279. data/ext/ffi_c/libffi/testsuite/lib/wrapper.exp +0 -45
  280. data/ext/ffi_c/libffi/testsuite/libffi.call/align_mixed.c +0 -46
  281. data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +0 -30
  282. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn0.c +0 -89
  283. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn1.c +0 -81
  284. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn2.c +0 -81
  285. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn3.c +0 -82
  286. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn4.c +0 -89
  287. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn5.c +0 -92
  288. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn6.c +0 -90
  289. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_loc_fn0.c +0 -95
  290. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_simple.c +0 -55
  291. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_12byte.c +0 -94
  292. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_16byte.c +0 -95
  293. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_18byte.c +0 -96
  294. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_19byte.c +0 -102
  295. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_1_1byte.c +0 -89
  296. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte.c +0 -91
  297. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte1.c +0 -93
  298. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_24byte.c +0 -113
  299. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_2byte.c +0 -90
  300. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3_1byte.c +0 -95
  301. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte1.c +0 -90
  302. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte2.c +0 -90
  303. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_4_1byte.c +0 -98
  304. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_4byte.c +0 -90
  305. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_5_1_byte.c +0 -109
  306. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_5byte.c +0 -98
  307. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_64byte.c +0 -124
  308. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_6_1_byte.c +0 -113
  309. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_6byte.c +0 -99
  310. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_7_1_byte.c +0 -117
  311. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_7byte.c +0 -97
  312. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_8byte.c +0 -88
  313. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte1.c +0 -90
  314. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte2.c +0 -91
  315. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_double.c +0 -93
  316. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_float.c +0 -91
  317. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble.c +0 -92
  318. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split.c +0 -132
  319. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c +0 -115
  320. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_pointer.c +0 -95
  321. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint16.c +0 -91
  322. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint32.c +0 -91
  323. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint64.c +0 -92
  324. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint16.c +0 -91
  325. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint32.c +0 -91
  326. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint64.c +0 -93
  327. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_dbls_struct.c +0 -66
  328. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_double.c +0 -43
  329. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_double_va.c +0 -61
  330. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_float.c +0 -42
  331. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble.c +0 -105
  332. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble_va.c +0 -61
  333. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_many_mixed_args.c +0 -70
  334. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_many_mixed_float_double.c +0 -55
  335. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_schar.c +0 -74
  336. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshort.c +0 -74
  337. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshortchar.c +0 -86
  338. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_uchar.c +0 -91
  339. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushort.c +0 -74
  340. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushortchar.c +0 -86
  341. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer.c +0 -74
  342. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer_stack.c +0 -142
  343. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_schar.c +0 -44
  344. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_sint.c +0 -42
  345. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_sshort.c +0 -42
  346. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_struct_va1.c +0 -114
  347. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar.c +0 -42
  348. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar_va.c +0 -44
  349. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uint.c +0 -43
  350. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uint_va.c +0 -45
  351. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ulong_va.c +0 -45
  352. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ulonglong.c +0 -47
  353. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort.c +0 -43
  354. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort_va.c +0 -44
  355. data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_abi.c +0 -36
  356. data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c +0 -26
  357. data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +0 -136
  358. data/ext/ffi_c/libffi/testsuite/libffi.call/float.c +0 -59
  359. data/ext/ffi_c/libffi/testsuite/libffi.call/float1.c +0 -60
  360. data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +0 -60
  361. data/ext/ffi_c/libffi/testsuite/libffi.call/float3.c +0 -74
  362. data/ext/ffi_c/libffi/testsuite/libffi.call/float4.c +0 -62
  363. data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +0 -107
  364. data/ext/ffi_c/libffi/testsuite/libffi.call/huge_struct.c +0 -341
  365. data/ext/ffi_c/libffi/testsuite/libffi.call/many.c +0 -59
  366. data/ext/ffi_c/libffi/testsuite/libffi.call/many2.c +0 -57
  367. data/ext/ffi_c/libffi/testsuite/libffi.call/many_double.c +0 -70
  368. data/ext/ffi_c/libffi/testsuite/libffi.call/many_mixed.c +0 -78
  369. data/ext/ffi_c/libffi/testsuite/libffi.call/negint.c +0 -52
  370. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct.c +0 -152
  371. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct1.c +0 -161
  372. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct10.c +0 -133
  373. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct11.c +0 -121
  374. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct2.c +0 -110
  375. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct3.c +0 -111
  376. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct4.c +0 -111
  377. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct5.c +0 -112
  378. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct6.c +0 -131
  379. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct7.c +0 -111
  380. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct8.c +0 -131
  381. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct9.c +0 -131
  382. data/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c +0 -46
  383. data/ext/ffi_c/libffi/testsuite/libffi.call/pr1172638.c +0 -127
  384. data/ext/ffi_c/libffi/testsuite/libffi.call/problem1.c +0 -90
  385. data/ext/ffi_c/libffi/testsuite/libffi.call/promotion.c +0 -59
  386. data/ext/ffi_c/libffi/testsuite/libffi.call/pyobjc-tc.c +0 -114
  387. data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c +0 -36
  388. data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl1.c +0 -43
  389. data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl2.c +0 -42
  390. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl.c +0 -35
  391. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl1.c +0 -36
  392. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c +0 -49
  393. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl3.c +0 -42
  394. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c +0 -34
  395. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll.c +0 -41
  396. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +0 -43
  397. data/ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c +0 -36
  398. data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +0 -38
  399. data/ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c +0 -38
  400. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +0 -38
  401. data/ext/ffi_c/libffi/testsuite/libffi.call/stret_large.c +0 -145
  402. data/ext/ffi_c/libffi/testsuite/libffi.call/stret_large2.c +0 -148
  403. data/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium.c +0 -124
  404. data/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium2.c +0 -125
  405. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +0 -44
  406. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +0 -49
  407. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +0 -49
  408. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +0 -55
  409. data/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c +0 -67
  410. data/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c +0 -67
  411. data/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c +0 -60
  412. data/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c +0 -64
  413. data/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c +0 -66
  414. data/ext/ffi_c/libffi/testsuite/libffi.call/struct6.c +0 -64
  415. data/ext/ffi_c/libffi/testsuite/libffi.call/struct7.c +0 -74
  416. data/ext/ffi_c/libffi/testsuite/libffi.call/struct8.c +0 -81
  417. data/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c +0 -68
  418. data/ext/ffi_c/libffi/testsuite/libffi.call/testclosure.c +0 -70
  419. data/ext/ffi_c/libffi/testsuite/libffi.call/uninitialized.c +0 -61
  420. data/ext/ffi_c/libffi/testsuite/libffi.call/unwindtest.cc +0 -117
  421. data/ext/ffi_c/libffi/testsuite/libffi.call/unwindtest_ffi_call.cc +0 -54
  422. data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +0 -196
  423. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +0 -121
  424. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +0 -123
  425. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +0 -125
  426. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex.inc +0 -91
  427. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_double.c +0 -10
  428. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_float.c +0 -10
  429. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_longdouble.c +0 -10
  430. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex.inc +0 -42
  431. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_double.c +0 -10
  432. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_float.c +0 -10
  433. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_longdouble.c +0 -10
  434. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct.inc +0 -71
  435. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_double.c +0 -10
  436. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_float.c +0 -10
  437. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_longdouble.c +0 -10
  438. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va.inc +0 -80
  439. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_double.c +0 -10
  440. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_float.c +0 -16
  441. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_longdouble.c +0 -10
  442. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.exp +0 -36
  443. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.inc +0 -51
  444. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_double.inc +0 -7
  445. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_float.inc +0 -7
  446. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_longdouble.inc +0 -7
  447. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_double.c +0 -10
  448. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_float.c +0 -10
  449. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_int.c +0 -86
  450. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_longdouble.c +0 -10
  451. data/ext/ffi_c/libffi/testsuite/libffi.complex/ffitest.h +0 -1
  452. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex.inc +0 -78
  453. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_double.c +0 -10
  454. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_float.c +0 -10
  455. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_longdouble.c +0 -10
  456. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex.inc +0 -37
  457. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1.inc +0 -41
  458. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_double.c +0 -10
  459. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_float.c +0 -10
  460. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_longdouble.c +0 -10
  461. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc +0 -44
  462. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_double.c +0 -10
  463. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_float.c +0 -10
  464. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_longdouble.c +0 -10
  465. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_double.c +0 -10
  466. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_float.c +0 -10
  467. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_longdouble.c +0 -10
  468. data/ext/ffi_c/libffi/testsuite/libffi.go/aa-direct.c +0 -34
  469. data/ext/ffi_c/libffi/testsuite/libffi.go/closure1.c +0 -28
  470. data/ext/ffi_c/libffi/testsuite/libffi.go/ffitest.h +0 -1
  471. data/ext/ffi_c/libffi/testsuite/libffi.go/go.exp +0 -36
  472. data/ext/ffi_c/libffi/testsuite/libffi.go/static-chain.h +0 -19
  473. data/ext/ffi_c/rbffi.h +0 -57
  474. data/ext/ffi_c/rbffi_endian.h +0 -59
  475. data/ext/ffi_c/win32/stdbool.h +0 -8
  476. data/ext/ffi_c/win32/stdint.h +0 -201
  477. data/gen/Rakefile +0 -30
  478. data/libtest/Benchmark.c +0 -52
  479. data/libtest/BoolTest.c +0 -34
  480. data/libtest/BufferTest.c +0 -31
  481. data/libtest/ClosureTest.c +0 -205
  482. data/libtest/EnumTest.c +0 -51
  483. data/libtest/FunctionTest.c +0 -70
  484. data/libtest/GNUmakefile +0 -149
  485. data/libtest/GlobalVariable.c +0 -62
  486. data/libtest/LastErrorTest.c +0 -21
  487. data/libtest/NumberTest.c +0 -132
  488. data/libtest/PointerTest.c +0 -63
  489. data/libtest/ReferenceTest.c +0 -23
  490. data/libtest/StringTest.c +0 -34
  491. data/libtest/StructTest.c +0 -243
  492. data/libtest/UnionTest.c +0 -43
  493. data/libtest/VariadicTest.c +0 -99
  494. data/spec/ffi/async_callback_spec.rb +0 -35
  495. data/spec/ffi/bitmask_spec.rb +0 -575
  496. data/spec/ffi/bool_spec.rb +0 -32
  497. data/spec/ffi/buffer_spec.rb +0 -279
  498. data/spec/ffi/callback_spec.rb +0 -773
  499. data/spec/ffi/custom_param_type.rb +0 -37
  500. data/spec/ffi/custom_type_spec.rb +0 -74
  501. data/spec/ffi/dup_spec.rb +0 -52
  502. data/spec/ffi/embed-test/ext/Makefile +0 -242
  503. data/spec/ffi/enum_spec.rb +0 -423
  504. data/spec/ffi/errno_spec.rb +0 -20
  505. data/spec/ffi/ffi_spec.rb +0 -28
  506. data/spec/ffi/fixtures/Benchmark.c +0 -52
  507. data/spec/ffi/fixtures/BitmaskTest.c +0 -51
  508. data/spec/ffi/fixtures/BoolTest.c +0 -34
  509. data/spec/ffi/fixtures/BufferTest.c +0 -31
  510. data/spec/ffi/fixtures/ClosureTest.c +0 -205
  511. data/spec/ffi/fixtures/EnumTest.c +0 -51
  512. data/spec/ffi/fixtures/FunctionTest.c +0 -142
  513. data/spec/ffi/fixtures/GNUmakefile +0 -149
  514. data/spec/ffi/fixtures/GlobalVariable.c +0 -62
  515. data/spec/ffi/fixtures/LastErrorTest.c +0 -21
  516. data/spec/ffi/fixtures/NumberTest.c +0 -132
  517. data/spec/ffi/fixtures/PipeHelper.h +0 -21
  518. data/spec/ffi/fixtures/PipeHelperPosix.c +0 -41
  519. data/spec/ffi/fixtures/PipeHelperWindows.c +0 -72
  520. data/spec/ffi/fixtures/PointerTest.c +0 -63
  521. data/spec/ffi/fixtures/ReferenceTest.c +0 -23
  522. data/spec/ffi/fixtures/StringTest.c +0 -34
  523. data/spec/ffi/fixtures/StructTest.c +0 -243
  524. data/spec/ffi/fixtures/UnionTest.c +0 -43
  525. data/spec/ffi/fixtures/VariadicTest.c +0 -99
  526. data/spec/ffi/fixtures/classes.rb +0 -438
  527. data/spec/ffi/function_spec.rb +0 -97
  528. data/spec/ffi/io_spec.rb +0 -16
  529. data/spec/ffi/library_spec.rb +0 -286
  530. data/spec/ffi/long_double.rb +0 -30
  531. data/spec/ffi/managed_struct_spec.rb +0 -68
  532. data/spec/ffi/memorypointer_spec.rb +0 -78
  533. data/spec/ffi/number_spec.rb +0 -247
  534. data/spec/ffi/platform_spec.rb +0 -114
  535. data/spec/ffi/pointer_spec.rb +0 -285
  536. data/spec/ffi/rbx/attach_function_spec.rb +0 -34
  537. data/spec/ffi/rbx/memory_pointer_spec.rb +0 -198
  538. data/spec/ffi/rbx/spec_helper.rb +0 -6
  539. data/spec/ffi/rbx/struct_spec.rb +0 -18
  540. data/spec/ffi/spec_helper.rb +0 -93
  541. data/spec/ffi/string_spec.rb +0 -118
  542. data/spec/ffi/strptr_spec.rb +0 -50
  543. data/spec/ffi/struct_by_ref_spec.rb +0 -43
  544. data/spec/ffi/struct_callback_spec.rb +0 -69
  545. data/spec/ffi/struct_initialize_spec.rb +0 -35
  546. data/spec/ffi/struct_packed_spec.rb +0 -50
  547. data/spec/ffi/struct_spec.rb +0 -882
  548. data/spec/ffi/typedef_spec.rb +0 -91
  549. data/spec/ffi/union_spec.rb +0 -67
  550. data/spec/ffi/variadic_spec.rb +0 -132
  551. data/spec/spec.opts +0 -4
@@ -1,260 +0,0 @@
1
- #!/bin/sh
2
-
3
- # ***** BEGIN LICENSE BLOCK *****
4
- # Version: MPL 1.1/GPL 2.0/LGPL 2.1
5
- #
6
- # The contents of this file are subject to the Mozilla Public License Version
7
- # 1.1 (the "License"); you may not use this file except in compliance with
8
- # the License. You may obtain a copy of the License at
9
- # http://www.mozilla.org/MPL/
10
- #
11
- # Software distributed under the License is distributed on an "AS IS" basis,
12
- # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13
- # for the specific language governing rights and limitations under the
14
- # License.
15
- #
16
- # The Original Code is the MSVC wrappificator.
17
- #
18
- # The Initial Developer of the Original Code is
19
- # Timothy Wall <twalljava@dev.java.net>.
20
- # Portions created by the Initial Developer are Copyright (C) 2009
21
- # the Initial Developer. All Rights Reserved.
22
- #
23
- # Contributor(s):
24
- # Daniel Witte <dwitte@mozilla.com>
25
- #
26
- # Alternatively, the contents of this file may be used under the terms of
27
- # either the GNU General Public License Version 2 or later (the "GPL"), or
28
- # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29
- # in which case the provisions of the GPL or the LGPL are applicable instead
30
- # of those above. If you wish to allow use of your version of this file only
31
- # under the terms of either the GPL or the LGPL, and not to allow others to
32
- # use your version of this file under the terms of the MPL, indicate your
33
- # decision by deleting the provisions above and replace them with the notice
34
- # and other provisions required by the GPL or the LGPL. If you do not delete
35
- # the provisions above, a recipient may use your version of this file under
36
- # the terms of any one of the MPL, the GPL or the LGPL.
37
- #
38
- # ***** END LICENSE BLOCK *****
39
-
40
- #
41
- # GCC-compatible wrapper for cl.exe and ml.exe. Arguments are given in GCC
42
- # format and translated into something sensible for cl or ml.
43
- #
44
-
45
- args_orig=$@
46
- args="-nologo -W3"
47
- static_crt=
48
- debug_crt=
49
- cl="cl"
50
- ml="ml"
51
- safeseh="-safeseh"
52
- output=
53
-
54
- while [ $# -gt 0 ]
55
- do
56
- case $1
57
- in
58
- --version)
59
- args="-help"
60
- shift 1
61
- ;;
62
- -fexceptions)
63
- # Don't enable exceptions for now.
64
- #args="$args -EHac"
65
- shift 1
66
- ;;
67
- -m32)
68
- shift 1
69
- ;;
70
- -m64)
71
- ml="ml64" # "$MSVC/x86_amd64/ml64"
72
- safeseh=
73
- shift 1
74
- ;;
75
- -clang-cl)
76
- cl="clang-cl"
77
- shift 1
78
- ;;
79
- -O0)
80
- args="$args -Od"
81
- shift 1
82
- ;;
83
- -O*)
84
- # Runtime error checks (enabled by setting -RTC1 in the -DFFI_DEBUG
85
- # case below) are not compatible with optimization flags and will
86
- # cause the build to fail. Therefore, drop the optimization flag if
87
- # -DFFI_DEBUG is also set.
88
- case $args_orig in
89
- *-DFFI_DEBUG*)
90
- args="$args"
91
- ;;
92
- *)
93
- # The ax_cc_maxopt.m4 macro from the upstream autoconf-archive
94
- # project doesn't support MSVC and therefore ends up trying to
95
- # use -O3. Use the equivalent "max optimization" flag for MSVC
96
- # instead of erroring out.
97
- case $1 in
98
- -O3)
99
- args="$args -O2"
100
- ;;
101
- *)
102
- args="$args $1"
103
- ;;
104
- esac
105
- opt="true"
106
- ;;
107
- esac
108
- shift 1
109
- ;;
110
- -g)
111
- # Enable debug symbol generation.
112
- args="$args -Zi"
113
- shift 1
114
- ;;
115
- -DFFI_DEBUG)
116
- # Enable runtime error checks.
117
- args="$args -RTC1"
118
- defines="$defines $1"
119
- shift 1
120
- ;;
121
- -DUSE_STATIC_RTL)
122
- # Link against static CRT.
123
- static_crt=1
124
- shift 1
125
- ;;
126
- -DUSE_DEBUG_RTL)
127
- # Link against debug CRT.
128
- debug_crt=1
129
- shift 1
130
- ;;
131
- -c)
132
- args="$args -c"
133
- args="$(echo $args | sed 's%/Fe%/Fo%g')"
134
- single="-c"
135
- shift 1
136
- ;;
137
- -D*=*)
138
- name="$(echo $1|sed 's/-D\([^=][^=]*\)=.*/\1/g')"
139
- value="$(echo $1|sed 's/-D[^=][^=]*=//g')"
140
- args="$args -D${name}='$value'"
141
- defines="$defines -D${name}='$value'"
142
- shift 1
143
- ;;
144
- -D*)
145
- args="$args $1"
146
- defines="$defines $1"
147
- shift 1
148
- ;;
149
- -I)
150
- args="$args -I$2"
151
- includes="$includes -I$2"
152
- shift 2
153
- ;;
154
- -I*)
155
- args="$args $1"
156
- includes="$includes $1"
157
- shift 1
158
- ;;
159
- -W|-Wextra)
160
- # TODO map extra warnings
161
- shift 1
162
- ;;
163
- -Wall)
164
- # -Wall on MSVC is overzealous, and we already build with -W3. Nothing
165
- # to do here.
166
- shift 1
167
- ;;
168
- -pedantic)
169
- # libffi tests -pedantic with -Wall, so drop it also.
170
- shift 1
171
- ;;
172
- -Werror)
173
- args="$args -WX"
174
- shift 1
175
- ;;
176
- -W*)
177
- # TODO map specific warnings
178
- shift 1
179
- ;;
180
- -S)
181
- args="$args -FAs"
182
- shift 1
183
- ;;
184
- -o)
185
- outdir="$(dirname $2)"
186
- base="$(basename $2|sed 's/\.[^.]*//g')"
187
- if [ -n "$single" ]; then
188
- output="-Fo$2"
189
- else
190
- output="-Fe$2"
191
- fi
192
- if [ -n "$assembly" ]; then
193
- args="$args $output"
194
- else
195
- args="$args $output -Fd$outdir/$base -Fp$outdir/$base -Fa$outdir/$base"
196
- fi
197
- shift 2
198
- ;;
199
- *.S)
200
- src=$1
201
- assembly="true"
202
- shift 1
203
- ;;
204
- *.c)
205
- args="$args $1"
206
- shift 1
207
- ;;
208
- *)
209
- # Assume it's an MSVC argument, and pass it through.
210
- args="$args $1"
211
- shift 1
212
- ;;
213
- esac
214
- done
215
-
216
- # If -Zi is specified, certain optimizations are implicitly disabled
217
- # by MSVC. Add back those optimizations if this is an optimized build.
218
- # NOTE: These arguments must come after all others.
219
- if [ -n "$opt" ]; then
220
- args="$args -link -OPT:REF -OPT:ICF -INCREMENTAL:NO"
221
- fi
222
-
223
- if [ -n "$static_crt" ]; then
224
- md=-MT
225
- else
226
- md=-MD
227
- fi
228
-
229
- if [ -n "$debug_crt" ]; then
230
- md="${md}d"
231
- fi
232
-
233
- if [ -n "$assembly" ]; then
234
- if [ -z "$outdir" ]; then
235
- outdir="."
236
- fi
237
- ppsrc="$outdir/$(basename $src|sed 's/.S$/.asm/g')"
238
- echo "$cl -nologo -EP $includes $defines $src > $ppsrc"
239
- "$cl" -nologo -EP $includes $defines $src > $ppsrc || exit $?
240
- output="$(echo $output | sed 's%/F[dpa][^ ]*%%g')"
241
- args="-nologo $safeseh $single $output $ppsrc"
242
-
243
- echo "$ml $args"
244
- eval "\"$ml\" $args"
245
- result=$?
246
-
247
- # required to fix ml64 broken output?
248
- #mv *.obj $outdir
249
- else
250
- args="$md $args"
251
- echo "$cl $args"
252
- # Return an error code of 1 if an invalid command line parameter is passed
253
- # instead of just ignoring it.
254
- eval "(\"$cl\" $args 2>&1 1>&3 | \
255
- awk '{print \$0} /D9002/ {error=1} END{exit error}' >&2) 3>&1"
256
- result=$?
257
- fi
258
-
259
- exit $result
260
-
@@ -1,941 +0,0 @@
1
- /* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd.
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- ``Software''), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
21
-
22
- #include <stdio.h>
23
- #include <stdlib.h>
24
- #include <stdint.h>
25
- #include <fficonfig.h>
26
- #include <ffi.h>
27
- #include <ffi_common.h>
28
- #include "internal.h"
29
-
30
- /* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE;
31
- all further uses in this file will refer to the 128-bit type. */
32
- #if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE
33
- # if FFI_TYPE_LONGDOUBLE != 4
34
- # error FFI_TYPE_LONGDOUBLE out of date
35
- # endif
36
- #else
37
- # undef FFI_TYPE_LONGDOUBLE
38
- # define FFI_TYPE_LONGDOUBLE 4
39
- #endif
40
-
41
- union _d
42
- {
43
- UINT64 d;
44
- UINT32 s[2];
45
- };
46
-
47
- struct _v
48
- {
49
- union _d d[2] __attribute__((aligned(16)));
50
- };
51
-
52
- struct call_context
53
- {
54
- struct _v v[N_V_ARG_REG];
55
- UINT64 x[N_X_ARG_REG];
56
- };
57
-
58
- #if FFI_EXEC_TRAMPOLINE_TABLE
59
-
60
- #ifdef __MACH__
61
- #include <mach/vm_param.h>
62
- #endif
63
-
64
- #else
65
-
66
- #if defined (__clang__) && defined (__APPLE__)
67
- extern void sys_icache_invalidate (void *start, size_t len);
68
- #endif
69
-
70
- static inline void
71
- ffi_clear_cache (void *start, void *end)
72
- {
73
- #if defined (__clang__) && defined (__APPLE__)
74
- sys_icache_invalidate (start, (char *)end - (char *)start);
75
- #elif defined (__GNUC__)
76
- __builtin___clear_cache (start, end);
77
- #else
78
- #error "Missing builtin to flush instruction cache"
79
- #endif
80
- }
81
-
82
- #endif
83
-
84
- /* A subroutine of is_vfp_type. Given a structure type, return the type code
85
- of the first non-structure element. Recurse for structure elements.
86
- Return -1 if the structure is in fact empty, i.e. no nested elements. */
87
-
88
- static int
89
- is_hfa0 (const ffi_type *ty)
90
- {
91
- ffi_type **elements = ty->elements;
92
- int i, ret = -1;
93
-
94
- if (elements != NULL)
95
- for (i = 0; elements[i]; ++i)
96
- {
97
- ret = elements[i]->type;
98
- if (ret == FFI_TYPE_STRUCT || ret == FFI_TYPE_COMPLEX)
99
- {
100
- ret = is_hfa0 (elements[i]);
101
- if (ret < 0)
102
- continue;
103
- }
104
- break;
105
- }
106
-
107
- return ret;
108
- }
109
-
110
- /* A subroutine of is_vfp_type. Given a structure type, return true if all
111
- of the non-structure elements are the same as CANDIDATE. */
112
-
113
- static int
114
- is_hfa1 (const ffi_type *ty, int candidate)
115
- {
116
- ffi_type **elements = ty->elements;
117
- int i;
118
-
119
- if (elements != NULL)
120
- for (i = 0; elements[i]; ++i)
121
- {
122
- int t = elements[i]->type;
123
- if (t == FFI_TYPE_STRUCT || t == FFI_TYPE_COMPLEX)
124
- {
125
- if (!is_hfa1 (elements[i], candidate))
126
- return 0;
127
- }
128
- else if (t != candidate)
129
- return 0;
130
- }
131
-
132
- return 1;
133
- }
134
-
135
- /* Determine if TY may be allocated to the FP registers. This is both an
136
- fp scalar type as well as an homogenous floating point aggregate (HFA).
137
- That is, a structure consisting of 1 to 4 members of all the same type,
138
- where that type is an fp scalar.
139
-
140
- Returns non-zero iff TY is an HFA. The result is the AARCH64_RET_*
141
- constant for the type. */
142
-
143
- static int
144
- is_vfp_type (const ffi_type *ty)
145
- {
146
- ffi_type **elements;
147
- int candidate, i;
148
- size_t size, ele_count;
149
-
150
- /* Quickest tests first. */
151
- candidate = ty->type;
152
- switch (candidate)
153
- {
154
- default:
155
- return 0;
156
- case FFI_TYPE_FLOAT:
157
- case FFI_TYPE_DOUBLE:
158
- case FFI_TYPE_LONGDOUBLE:
159
- ele_count = 1;
160
- goto done;
161
- case FFI_TYPE_COMPLEX:
162
- candidate = ty->elements[0]->type;
163
- switch (candidate)
164
- {
165
- case FFI_TYPE_FLOAT:
166
- case FFI_TYPE_DOUBLE:
167
- case FFI_TYPE_LONGDOUBLE:
168
- ele_count = 2;
169
- goto done;
170
- }
171
- return 0;
172
- case FFI_TYPE_STRUCT:
173
- break;
174
- }
175
-
176
- /* No HFA types are smaller than 4 bytes, or larger than 64 bytes. */
177
- size = ty->size;
178
- if (size < 4 || size > 64)
179
- return 0;
180
-
181
- /* Find the type of the first non-structure member. */
182
- elements = ty->elements;
183
- candidate = elements[0]->type;
184
- if (candidate == FFI_TYPE_STRUCT || candidate == FFI_TYPE_COMPLEX)
185
- {
186
- for (i = 0; ; ++i)
187
- {
188
- candidate = is_hfa0 (elements[i]);
189
- if (candidate >= 0)
190
- break;
191
- }
192
- }
193
-
194
- /* If the first member is not a floating point type, it's not an HFA.
195
- Also quickly re-check the size of the structure. */
196
- switch (candidate)
197
- {
198
- case FFI_TYPE_FLOAT:
199
- ele_count = size / sizeof(float);
200
- if (size != ele_count * sizeof(float))
201
- return 0;
202
- break;
203
- case FFI_TYPE_DOUBLE:
204
- ele_count = size / sizeof(double);
205
- if (size != ele_count * sizeof(double))
206
- return 0;
207
- break;
208
- case FFI_TYPE_LONGDOUBLE:
209
- ele_count = size / sizeof(long double);
210
- if (size != ele_count * sizeof(long double))
211
- return 0;
212
- break;
213
- default:
214
- return 0;
215
- }
216
- if (ele_count > 4)
217
- return 0;
218
-
219
- /* Finally, make sure that all scalar elements are the same type. */
220
- for (i = 0; elements[i]; ++i)
221
- {
222
- int t = elements[i]->type;
223
- if (t == FFI_TYPE_STRUCT || t == FFI_TYPE_COMPLEX)
224
- {
225
- if (!is_hfa1 (elements[i], candidate))
226
- return 0;
227
- }
228
- else if (t != candidate)
229
- return 0;
230
- }
231
-
232
- /* All tests succeeded. Encode the result. */
233
- done:
234
- return candidate * 4 + (4 - ele_count);
235
- }
236
-
237
- /* Representation of the procedure call argument marshalling
238
- state.
239
-
240
- The terse state variable names match the names used in the AARCH64
241
- PCS. */
242
-
243
- struct arg_state
244
- {
245
- unsigned ngrn; /* Next general-purpose register number. */
246
- unsigned nsrn; /* Next vector register number. */
247
- size_t nsaa; /* Next stack offset. */
248
-
249
- #if defined (__APPLE__)
250
- unsigned allocating_variadic;
251
- #endif
252
- };
253
-
254
- /* Initialize a procedure call argument marshalling state. */
255
- static void
256
- arg_init (struct arg_state *state)
257
- {
258
- state->ngrn = 0;
259
- state->nsrn = 0;
260
- state->nsaa = 0;
261
- #if defined (__APPLE__)
262
- state->allocating_variadic = 0;
263
- #endif
264
- }
265
-
266
- /* Allocate an aligned slot on the stack and return a pointer to it. */
267
- static void *
268
- allocate_to_stack (struct arg_state *state, void *stack,
269
- size_t alignment, size_t size)
270
- {
271
- size_t nsaa = state->nsaa;
272
-
273
- /* Round up the NSAA to the larger of 8 or the natural
274
- alignment of the argument's type. */
275
- #if defined (__APPLE__)
276
- if (state->allocating_variadic && alignment < 8)
277
- alignment = 8;
278
- #else
279
- if (alignment < 8)
280
- alignment = 8;
281
- #endif
282
-
283
- nsaa = FFI_ALIGN (nsaa, alignment);
284
- state->nsaa = nsaa + size;
285
-
286
- return (char *)stack + nsaa;
287
- }
288
-
289
- static ffi_arg
290
- extend_integer_type (void *source, int type)
291
- {
292
- switch (type)
293
- {
294
- case FFI_TYPE_UINT8:
295
- return *(UINT8 *) source;
296
- case FFI_TYPE_SINT8:
297
- return *(SINT8 *) source;
298
- case FFI_TYPE_UINT16:
299
- return *(UINT16 *) source;
300
- case FFI_TYPE_SINT16:
301
- return *(SINT16 *) source;
302
- case FFI_TYPE_UINT32:
303
- return *(UINT32 *) source;
304
- case FFI_TYPE_INT:
305
- case FFI_TYPE_SINT32:
306
- return *(SINT32 *) source;
307
- case FFI_TYPE_UINT64:
308
- case FFI_TYPE_SINT64:
309
- return *(UINT64 *) source;
310
- break;
311
- case FFI_TYPE_POINTER:
312
- return *(uintptr_t *) source;
313
- default:
314
- abort();
315
- }
316
- }
317
-
318
- static void
319
- extend_hfa_type (void *dest, void *src, int h)
320
- {
321
- ssize_t f = h - AARCH64_RET_S4;
322
- void *x0;
323
-
324
- asm volatile (
325
- "adr %0, 0f\n"
326
- " add %0, %0, %1\n"
327
- " br %0\n"
328
- "0: ldp s16, s17, [%3]\n" /* S4 */
329
- " ldp s18, s19, [%3, #8]\n"
330
- " b 4f\n"
331
- " ldp s16, s17, [%3]\n" /* S3 */
332
- " ldr s18, [%3, #8]\n"
333
- " b 3f\n"
334
- " ldp s16, s17, [%3]\n" /* S2 */
335
- " b 2f\n"
336
- " nop\n"
337
- " ldr s16, [%3]\n" /* S1 */
338
- " b 1f\n"
339
- " nop\n"
340
- " ldp d16, d17, [%3]\n" /* D4 */
341
- " ldp d18, d19, [%3, #16]\n"
342
- " b 4f\n"
343
- " ldp d16, d17, [%3]\n" /* D3 */
344
- " ldr d18, [%3, #16]\n"
345
- " b 3f\n"
346
- " ldp d16, d17, [%3]\n" /* D2 */
347
- " b 2f\n"
348
- " nop\n"
349
- " ldr d16, [%3]\n" /* D1 */
350
- " b 1f\n"
351
- " nop\n"
352
- " ldp q16, q17, [%3]\n" /* Q4 */
353
- " ldp q18, q19, [%3, #16]\n"
354
- " b 4f\n"
355
- " ldp q16, q17, [%3]\n" /* Q3 */
356
- " ldr q18, [%3, #16]\n"
357
- " b 3f\n"
358
- " ldp q16, q17, [%3]\n" /* Q2 */
359
- " b 2f\n"
360
- " nop\n"
361
- " ldr q16, [%3]\n" /* Q1 */
362
- " b 1f\n"
363
- "4: str q19, [%2, #48]\n"
364
- "3: str q18, [%2, #32]\n"
365
- "2: str q17, [%2, #16]\n"
366
- "1: str q16, [%2]"
367
- : "=&r"(x0)
368
- : "r"(f * 12), "r"(dest), "r"(src)
369
- : "memory", "v16", "v17", "v18", "v19");
370
- }
371
-
372
- static void *
373
- compress_hfa_type (void *dest, void *reg, int h)
374
- {
375
- switch (h)
376
- {
377
- case AARCH64_RET_S1:
378
- if (dest == reg)
379
- {
380
- #ifdef __AARCH64EB__
381
- dest += 12;
382
- #endif
383
- }
384
- else
385
- *(float *)dest = *(float *)reg;
386
- break;
387
- case AARCH64_RET_S2:
388
- asm ("ldp q16, q17, [%1]\n\t"
389
- "st2 { v16.s, v17.s }[0], [%0]"
390
- : : "r"(dest), "r"(reg) : "memory", "v16", "v17");
391
- break;
392
- case AARCH64_RET_S3:
393
- asm ("ldp q16, q17, [%1]\n\t"
394
- "ldr q18, [%1, #32]\n\t"
395
- "st3 { v16.s, v17.s, v18.s }[0], [%0]"
396
- : : "r"(dest), "r"(reg) : "memory", "v16", "v17", "v18");
397
- break;
398
- case AARCH64_RET_S4:
399
- asm ("ldp q16, q17, [%1]\n\t"
400
- "ldp q18, q19, [%1, #32]\n\t"
401
- "st4 { v16.s, v17.s, v18.s, v19.s }[0], [%0]"
402
- : : "r"(dest), "r"(reg) : "memory", "v16", "v17", "v18", "v19");
403
- break;
404
-
405
- case AARCH64_RET_D1:
406
- if (dest == reg)
407
- {
408
- #ifdef __AARCH64EB__
409
- dest += 8;
410
- #endif
411
- }
412
- else
413
- *(double *)dest = *(double *)reg;
414
- break;
415
- case AARCH64_RET_D2:
416
- asm ("ldp q16, q17, [%1]\n\t"
417
- "st2 { v16.d, v17.d }[0], [%0]"
418
- : : "r"(dest), "r"(reg) : "memory", "v16", "v17");
419
- break;
420
- case AARCH64_RET_D3:
421
- asm ("ldp q16, q17, [%1]\n\t"
422
- "ldr q18, [%1, #32]\n\t"
423
- "st3 { v16.d, v17.d, v18.d }[0], [%0]"
424
- : : "r"(dest), "r"(reg) : "memory", "v16", "v17", "v18");
425
- break;
426
- case AARCH64_RET_D4:
427
- asm ("ldp q16, q17, [%1]\n\t"
428
- "ldp q18, q19, [%1, #32]\n\t"
429
- "st4 { v16.d, v17.d, v18.d, v19.d }[0], [%0]"
430
- : : "r"(dest), "r"(reg) : "memory", "v16", "v17", "v18", "v19");
431
- break;
432
-
433
- default:
434
- if (dest != reg)
435
- return memcpy (dest, reg, 16 * (4 - (h & 3)));
436
- break;
437
- }
438
- return dest;
439
- }
440
-
441
- /* Either allocate an appropriate register for the argument type, or if
442
- none are available, allocate a stack slot and return a pointer
443
- to the allocated space. */
444
-
445
- static void *
446
- allocate_int_to_reg_or_stack (struct call_context *context,
447
- struct arg_state *state,
448
- void *stack, size_t size)
449
- {
450
- if (state->ngrn < N_X_ARG_REG)
451
- return &context->x[state->ngrn++];
452
-
453
- state->ngrn = N_X_ARG_REG;
454
- return allocate_to_stack (state, stack, size, size);
455
- }
456
-
457
- ffi_status
458
- ffi_prep_cif_machdep (ffi_cif *cif)
459
- {
460
- ffi_type *rtype = cif->rtype;
461
- size_t bytes = cif->bytes;
462
- int flags, i, n;
463
-
464
- switch (rtype->type)
465
- {
466
- case FFI_TYPE_VOID:
467
- flags = AARCH64_RET_VOID;
468
- break;
469
- case FFI_TYPE_UINT8:
470
- flags = AARCH64_RET_UINT8;
471
- break;
472
- case FFI_TYPE_UINT16:
473
- flags = AARCH64_RET_UINT16;
474
- break;
475
- case FFI_TYPE_UINT32:
476
- flags = AARCH64_RET_UINT32;
477
- break;
478
- case FFI_TYPE_SINT8:
479
- flags = AARCH64_RET_SINT8;
480
- break;
481
- case FFI_TYPE_SINT16:
482
- flags = AARCH64_RET_SINT16;
483
- break;
484
- case FFI_TYPE_INT:
485
- case FFI_TYPE_SINT32:
486
- flags = AARCH64_RET_SINT32;
487
- break;
488
- case FFI_TYPE_SINT64:
489
- case FFI_TYPE_UINT64:
490
- flags = AARCH64_RET_INT64;
491
- break;
492
- case FFI_TYPE_POINTER:
493
- flags = (sizeof(void *) == 4 ? AARCH64_RET_UINT32 : AARCH64_RET_INT64);
494
- break;
495
-
496
- case FFI_TYPE_FLOAT:
497
- case FFI_TYPE_DOUBLE:
498
- case FFI_TYPE_LONGDOUBLE:
499
- case FFI_TYPE_STRUCT:
500
- case FFI_TYPE_COMPLEX:
501
- flags = is_vfp_type (rtype);
502
- if (flags == 0)
503
- {
504
- size_t s = rtype->size;
505
- if (s > 16)
506
- {
507
- flags = AARCH64_RET_VOID | AARCH64_RET_IN_MEM;
508
- bytes += 8;
509
- }
510
- else if (s == 16)
511
- flags = AARCH64_RET_INT128;
512
- else if (s == 8)
513
- flags = AARCH64_RET_INT64;
514
- else
515
- flags = AARCH64_RET_INT128 | AARCH64_RET_NEED_COPY;
516
- }
517
- break;
518
-
519
- default:
520
- abort();
521
- }
522
-
523
- for (i = 0, n = cif->nargs; i < n; i++)
524
- if (is_vfp_type (cif->arg_types[i]))
525
- {
526
- flags |= AARCH64_FLAG_ARG_V;
527
- break;
528
- }
529
-
530
- /* Round the stack up to a multiple of the stack alignment requirement. */
531
- cif->bytes = FFI_ALIGN(bytes, 16);
532
- cif->flags = flags;
533
- #if defined (__APPLE__)
534
- cif->aarch64_nfixedargs = 0;
535
- #endif
536
-
537
- return FFI_OK;
538
- }
539
-
540
- #if defined (__APPLE__)
541
- /* 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)
545
- {
546
- ffi_status status = ffi_prep_cif_machdep (cif);
547
- cif->aarch64_nfixedargs = nfixedargs;
548
- return status;
549
- }
550
- #endif /* __APPLE__ */
551
-
552
- extern void ffi_call_SYSV (struct call_context *context, void *frame,
553
- void (*fn)(void), void *rvalue, int flags,
554
- void *closure) FFI_HIDDEN;
555
-
556
- /* Call a function with the provided arguments and capture the return
557
- value. */
558
- static void
559
- ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
560
- void **avalue, void *closure)
561
- {
562
- struct call_context *context;
563
- void *stack, *frame, *rvalue;
564
- struct arg_state state;
565
- size_t stack_bytes, rtype_size, rsize;
566
- int i, nargs, flags;
567
- ffi_type *rtype;
568
-
569
- flags = cif->flags;
570
- rtype = cif->rtype;
571
- rtype_size = rtype->size;
572
- stack_bytes = cif->bytes;
573
-
574
- /* If the target function returns a structure via hidden pointer,
575
- then we cannot allow a null rvalue. Otherwise, mash a null
576
- rvalue to void return type. */
577
- rsize = 0;
578
- if (flags & AARCH64_RET_IN_MEM)
579
- {
580
- if (orig_rvalue == NULL)
581
- rsize = rtype_size;
582
- }
583
- else if (orig_rvalue == NULL)
584
- flags &= AARCH64_FLAG_ARG_V;
585
- else if (flags & AARCH64_RET_NEED_COPY)
586
- rsize = 16;
587
-
588
- /* Allocate consectutive stack for everything we'll need. */
589
- context = alloca (sizeof(struct call_context) + stack_bytes + 32 + rsize);
590
- stack = context + 1;
591
- frame = stack + stack_bytes;
592
- rvalue = (rsize ? frame + 32 : orig_rvalue);
593
-
594
- arg_init (&state);
595
- for (i = 0, nargs = cif->nargs; i < nargs; i++)
596
- {
597
- ffi_type *ty = cif->arg_types[i];
598
- size_t s = ty->size;
599
- void *a = avalue[i];
600
- int h, t;
601
-
602
- t = ty->type;
603
- switch (t)
604
- {
605
- case FFI_TYPE_VOID:
606
- FFI_ASSERT (0);
607
- break;
608
-
609
- /* If the argument is a basic type the argument is allocated to an
610
- appropriate register, or if none are available, to the stack. */
611
- case FFI_TYPE_INT:
612
- case FFI_TYPE_UINT8:
613
- case FFI_TYPE_SINT8:
614
- case FFI_TYPE_UINT16:
615
- case FFI_TYPE_SINT16:
616
- case FFI_TYPE_UINT32:
617
- case FFI_TYPE_SINT32:
618
- case FFI_TYPE_UINT64:
619
- case FFI_TYPE_SINT64:
620
- case FFI_TYPE_POINTER:
621
- do_pointer:
622
- {
623
- ffi_arg ext = extend_integer_type (a, t);
624
- if (state.ngrn < N_X_ARG_REG)
625
- context->x[state.ngrn++] = ext;
626
- else
627
- {
628
- void *d = allocate_to_stack (&state, stack, ty->alignment, s);
629
- state.ngrn = N_X_ARG_REG;
630
- /* Note that the default abi extends each argument
631
- to a full 64-bit slot, while the iOS abi allocates
632
- only enough space. */
633
- #ifdef __APPLE__
634
- memcpy(d, a, s);
635
- #else
636
- *(ffi_arg *)d = ext;
637
- #endif
638
- }
639
- }
640
- break;
641
-
642
- case FFI_TYPE_FLOAT:
643
- case FFI_TYPE_DOUBLE:
644
- case FFI_TYPE_LONGDOUBLE:
645
- case FFI_TYPE_STRUCT:
646
- case FFI_TYPE_COMPLEX:
647
- {
648
- void *dest;
649
-
650
- h = is_vfp_type (ty);
651
- if (h)
652
- {
653
- int elems = 4 - (h & 3);
654
- if (state.nsrn + elems <= N_V_ARG_REG)
655
- {
656
- dest = &context->v[state.nsrn];
657
- state.nsrn += elems;
658
- extend_hfa_type (dest, a, h);
659
- break;
660
- }
661
- state.nsrn = N_V_ARG_REG;
662
- dest = allocate_to_stack (&state, stack, ty->alignment, s);
663
- }
664
- else if (s > 16)
665
- {
666
- /* If the argument is a composite type that is larger than 16
667
- bytes, then the argument has been copied to memory, and
668
- the argument is replaced by a pointer to the copy. */
669
- a = &avalue[i];
670
- t = FFI_TYPE_POINTER;
671
- s = sizeof (void *);
672
- goto do_pointer;
673
- }
674
- else
675
- {
676
- size_t n = (s + 7) / 8;
677
- if (state.ngrn + n <= N_X_ARG_REG)
678
- {
679
- /* If the argument is a composite type and the size in
680
- double-words is not more than the number of available
681
- X registers, then the argument is copied into
682
- consecutive X registers. */
683
- dest = &context->x[state.ngrn];
684
- state.ngrn += n;
685
- }
686
- else
687
- {
688
- /* Otherwise, there are insufficient X registers. Further
689
- X register allocations are prevented, the NSAA is
690
- adjusted and the argument is copied to memory at the
691
- adjusted NSAA. */
692
- state.ngrn = N_X_ARG_REG;
693
- dest = allocate_to_stack (&state, stack, ty->alignment, s);
694
- }
695
- }
696
- memcpy (dest, a, s);
697
- }
698
- break;
699
-
700
- default:
701
- abort();
702
- }
703
-
704
- #if defined (__APPLE__)
705
- if (i + 1 == cif->aarch64_nfixedargs)
706
- {
707
- state.ngrn = N_X_ARG_REG;
708
- state.nsrn = N_V_ARG_REG;
709
- state.allocating_variadic = 1;
710
- }
711
- #endif
712
- }
713
-
714
- ffi_call_SYSV (context, frame, fn, rvalue, flags, closure);
715
-
716
- if (flags & AARCH64_RET_NEED_COPY)
717
- memcpy (orig_rvalue, rvalue, rtype_size);
718
- }
719
-
720
- void
721
- ffi_call (ffi_cif *cif, void (*fn) (void), void *rvalue, void **avalue)
722
- {
723
- ffi_call_int (cif, fn, rvalue, avalue, NULL);
724
- }
725
-
726
- #ifdef FFI_GO_CLOSURES
727
- void
728
- ffi_call_go (ffi_cif *cif, void (*fn) (void), void *rvalue,
729
- void **avalue, void *closure)
730
- {
731
- ffi_call_int (cif, fn, rvalue, avalue, closure);
732
- }
733
- #endif /* FFI_GO_CLOSURES */
734
-
735
- /* Build a trampoline. */
736
-
737
- extern void ffi_closure_SYSV (void) FFI_HIDDEN;
738
- extern void ffi_closure_SYSV_V (void) FFI_HIDDEN;
739
-
740
- ffi_status
741
- ffi_prep_closure_loc (ffi_closure *closure,
742
- ffi_cif* cif,
743
- void (*fun)(ffi_cif*,void*,void**,void*),
744
- void *user_data,
745
- void *codeloc)
746
- {
747
- if (cif->abi != FFI_SYSV)
748
- return FFI_BAD_ABI;
749
-
750
- void (*start)(void);
751
-
752
- if (cif->flags & AARCH64_FLAG_ARG_V)
753
- start = ffi_closure_SYSV_V;
754
- else
755
- start = ffi_closure_SYSV;
756
-
757
- #if FFI_EXEC_TRAMPOLINE_TABLE
758
- #ifdef __MACH__
759
- void **config = (void **)((uint8_t *)codeloc - PAGE_MAX_SIZE);
760
- config[0] = closure;
761
- config[1] = start;
762
- #endif
763
- #else
764
- static const unsigned char trampoline[16] = {
765
- 0x90, 0x00, 0x00, 0x58, /* ldr x16, tramp+16 */
766
- 0xf1, 0xff, 0xff, 0x10, /* adr x17, tramp+0 */
767
- 0x00, 0x02, 0x1f, 0xd6 /* br x16 */
768
- };
769
- char *tramp = closure->tramp;
770
-
771
- memcpy (tramp, trampoline, sizeof(trampoline));
772
-
773
- *(UINT64 *)(tramp + 16) = (uintptr_t)start;
774
-
775
- ffi_clear_cache(tramp, tramp + FFI_TRAMPOLINE_SIZE);
776
- #endif
777
-
778
- closure->cif = cif;
779
- closure->fun = fun;
780
- closure->user_data = user_data;
781
-
782
- return FFI_OK;
783
- }
784
-
785
- #ifdef FFI_GO_CLOSURES
786
- extern void ffi_go_closure_SYSV (void) FFI_HIDDEN;
787
- extern void ffi_go_closure_SYSV_V (void) FFI_HIDDEN;
788
-
789
- ffi_status
790
- ffi_prep_go_closure (ffi_go_closure *closure, ffi_cif* cif,
791
- void (*fun)(ffi_cif*,void*,void**,void*))
792
- {
793
- void (*start)(void);
794
-
795
- if (cif->abi != FFI_SYSV)
796
- return FFI_BAD_ABI;
797
-
798
- if (cif->flags & AARCH64_FLAG_ARG_V)
799
- start = ffi_go_closure_SYSV_V;
800
- else
801
- start = ffi_go_closure_SYSV;
802
-
803
- closure->tramp = start;
804
- closure->cif = cif;
805
- closure->fun = fun;
806
-
807
- return FFI_OK;
808
- }
809
- #endif /* FFI_GO_CLOSURES */
810
-
811
- /* Primary handler to setup and invoke a function within a closure.
812
-
813
- A closure when invoked enters via the assembler wrapper
814
- ffi_closure_SYSV(). The wrapper allocates a call context on the
815
- stack, saves the interesting registers (from the perspective of
816
- the calling convention) into the context then passes control to
817
- ffi_closure_SYSV_inner() passing the saved context and a pointer to
818
- the stack at the point ffi_closure_SYSV() was invoked.
819
-
820
- On the return path the assembler wrapper will reload call context
821
- registers.
822
-
823
- ffi_closure_SYSV_inner() marshalls the call context into ffi value
824
- descriptors, invokes the wrapped function, then marshalls the return
825
- value back into the call context. */
826
-
827
- int FFI_HIDDEN
828
- ffi_closure_SYSV_inner (ffi_cif *cif,
829
- void (*fun)(ffi_cif*,void*,void**,void*),
830
- void *user_data,
831
- struct call_context *context,
832
- void *stack, void *rvalue, void *struct_rvalue)
833
- {
834
- void **avalue = (void**) alloca (cif->nargs * sizeof (void*));
835
- int i, h, nargs, flags;
836
- struct arg_state state;
837
-
838
- arg_init (&state);
839
-
840
- for (i = 0, nargs = cif->nargs; i < nargs; i++)
841
- {
842
- ffi_type *ty = cif->arg_types[i];
843
- int t = ty->type;
844
- size_t n, s = ty->size;
845
-
846
- switch (t)
847
- {
848
- case FFI_TYPE_VOID:
849
- FFI_ASSERT (0);
850
- break;
851
-
852
- case FFI_TYPE_INT:
853
- case FFI_TYPE_UINT8:
854
- case FFI_TYPE_SINT8:
855
- case FFI_TYPE_UINT16:
856
- case FFI_TYPE_SINT16:
857
- case FFI_TYPE_UINT32:
858
- case FFI_TYPE_SINT32:
859
- case FFI_TYPE_UINT64:
860
- case FFI_TYPE_SINT64:
861
- case FFI_TYPE_POINTER:
862
- avalue[i] = allocate_int_to_reg_or_stack (context, &state, stack, s);
863
- break;
864
-
865
- case FFI_TYPE_FLOAT:
866
- case FFI_TYPE_DOUBLE:
867
- case FFI_TYPE_LONGDOUBLE:
868
- case FFI_TYPE_STRUCT:
869
- case FFI_TYPE_COMPLEX:
870
- h = is_vfp_type (ty);
871
- if (h)
872
- {
873
- 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
- }
923
-
924
- #if defined (__APPLE__)
925
- if (i + 1 == cif->aarch64_nfixedargs)
926
- {
927
- state.ngrn = N_X_ARG_REG;
928
- state.nsrn = N_V_ARG_REG;
929
- state.allocating_variadic = 1;
930
- }
931
- #endif
932
- }
933
-
934
- flags = cif->flags;
935
- if (flags & AARCH64_RET_IN_MEM)
936
- rvalue = struct_rvalue;
937
-
938
- fun (cif, rvalue, avalue, user_data);
939
-
940
- return flags;
941
- }