ffi 1.15.5 → 1.16.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (309) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +61 -0
  4. data/Gemfile +1 -1
  5. data/README.md +3 -2
  6. data/Rakefile +10 -7
  7. data/ext/ffi_c/AbstractMemory.c +56 -34
  8. data/ext/ffi_c/AbstractMemory.h +3 -2
  9. data/ext/ffi_c/ArrayType.c +49 -13
  10. data/ext/ffi_c/ArrayType.h +1 -0
  11. data/ext/ffi_c/Buffer.c +86 -29
  12. data/ext/ffi_c/Call.c +13 -5
  13. data/ext/ffi_c/DynamicLibrary.c +89 -26
  14. data/ext/ffi_c/Function.c +238 -98
  15. data/ext/ffi_c/Function.h +1 -0
  16. data/ext/ffi_c/FunctionInfo.c +78 -24
  17. data/ext/ffi_c/LastError.c +25 -7
  18. data/ext/ffi_c/MappedType.c +66 -23
  19. data/ext/ffi_c/MappedType.h +0 -2
  20. data/ext/ffi_c/MemoryPointer.c +34 -7
  21. data/ext/ffi_c/MethodHandle.c +3 -1
  22. data/ext/ffi_c/Pointer.c +68 -29
  23. data/ext/ffi_c/Pointer.h +1 -0
  24. data/ext/ffi_c/Struct.c +151 -80
  25. data/ext/ffi_c/Struct.h +7 -4
  26. data/ext/ffi_c/StructByValue.c +48 -16
  27. data/ext/ffi_c/StructLayout.c +117 -48
  28. data/ext/ffi_c/Type.c +104 -36
  29. data/ext/ffi_c/Type.h +3 -1
  30. data/ext/ffi_c/Types.c +1 -1
  31. data/ext/ffi_c/Variadic.c +65 -23
  32. data/ext/ffi_c/compat.h +22 -22
  33. data/ext/ffi_c/extconf.rb +19 -2
  34. data/ext/ffi_c/ffi.c +4 -0
  35. data/ext/ffi_c/libffi/.appveyor/site.exp +16 -0
  36. data/ext/ffi_c/libffi/.appveyor/unix-noexec.exp +7 -0
  37. data/ext/ffi_c/libffi/.appveyor.yml +27 -9
  38. data/ext/ffi_c/libffi/.ci/build-cross-in-container.sh +18 -0
  39. data/ext/ffi_c/libffi/{.travis → .ci}/build-in-container.sh +4 -6
  40. data/ext/ffi_c/libffi/.ci/build.sh +124 -0
  41. data/ext/ffi_c/libffi/{.travis → .ci}/install.sh +14 -7
  42. data/ext/ffi_c/libffi/.ci/msvs-detect +1103 -0
  43. data/ext/ffi_c/libffi/{.travis → .ci}/site.exp +5 -3
  44. data/ext/ffi_c/libffi/.circleci/config.yml +156 -0
  45. data/ext/ffi_c/libffi/.github/workflows/build.yml +460 -0
  46. data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +171 -0
  47. data/ext/ffi_c/libffi/.gitignore +10 -2
  48. data/ext/ffi_c/libffi/LICENSE +1 -1
  49. data/ext/ffi_c/libffi/Makefile.am +12 -5
  50. data/ext/ffi_c/libffi/Makefile.in +118 -51
  51. data/ext/ffi_c/libffi/README.md +144 -104
  52. data/ext/ffi_c/libffi/acinclude.m4 +10 -112
  53. data/ext/ffi_c/libffi/compile +347 -0
  54. data/ext/ffi_c/libffi/config.guess +623 -556
  55. data/ext/ffi_c/libffi/config.sub +75 -34
  56. data/ext/ffi_c/libffi/configure +4571 -3830
  57. data/ext/ffi_c/libffi/configure.ac +64 -28
  58. data/ext/ffi_c/libffi/configure.host +25 -6
  59. data/ext/ffi_c/libffi/doc/Makefile.in +9 -6
  60. data/ext/ffi_c/libffi/doc/libffi.texi +82 -33
  61. data/ext/ffi_c/libffi/doc/version.texi +4 -4
  62. data/ext/ffi_c/libffi/fficonfig.h.in +12 -47
  63. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +163 -52
  64. data/ext/ffi_c/libffi/include/Makefile.am +1 -1
  65. data/ext/ffi_c/libffi/include/Makefile.in +10 -9
  66. data/ext/ffi_c/libffi/include/ffi.h.in +54 -50
  67. data/ext/ffi_c/libffi/include/ffi_cfi.h +21 -0
  68. data/ext/ffi_c/libffi/include/ffi_common.h +29 -0
  69. data/ext/ffi_c/libffi/include/tramp.h +45 -0
  70. data/ext/ffi_c/libffi/install-sh +92 -69
  71. data/ext/ffi_c/libffi/libtool-version +2 -2
  72. data/ext/ffi_c/libffi/ltmain.sh +512 -315
  73. data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +18 -14
  74. data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +108 -72
  75. data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +76 -45
  76. data/ext/ffi_c/libffi/m4/ax_prepend_flag.m4 +51 -0
  77. data/ext/ffi_c/libffi/man/Makefile.in +9 -6
  78. data/ext/ffi_c/libffi/missing +1 -1
  79. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +1 -1
  80. data/ext/ffi_c/libffi/msvcc.sh +1 -1
  81. data/ext/ffi_c/libffi/src/aarch64/ffi.c +146 -42
  82. data/ext/ffi_c/libffi/src/aarch64/internal.h +32 -0
  83. data/ext/ffi_c/libffi/src/aarch64/sysv.S +134 -42
  84. data/ext/ffi_c/libffi/src/arc/arcompact.S +169 -94
  85. data/ext/ffi_c/libffi/src/arc/ffi.c +325 -148
  86. data/ext/ffi_c/libffi/src/arc/ffitarget.h +14 -0
  87. data/ext/ffi_c/libffi/src/arm/ffi.c +62 -17
  88. data/ext/ffi_c/libffi/src/arm/ffitarget.h +3 -3
  89. data/ext/ffi_c/libffi/src/arm/internal.h +10 -0
  90. data/ext/ffi_c/libffi/src/arm/sysv.S +113 -42
  91. data/ext/ffi_c/libffi/src/closures.c +133 -47
  92. data/ext/ffi_c/libffi/src/dlmalloc.c +5 -0
  93. data/ext/ffi_c/libffi/src/ia64/ffi.c +12 -0
  94. data/ext/ffi_c/libffi/src/ia64/unix.S +20 -2
  95. data/ext/ffi_c/libffi/src/loongarch64/ffi.c +621 -0
  96. data/ext/ffi_c/libffi/src/loongarch64/ffitarget.h +82 -0
  97. data/ext/ffi_c/libffi/src/loongarch64/sysv.S +327 -0
  98. data/ext/ffi_c/libffi/src/m32r/ffi.c +31 -14
  99. data/ext/ffi_c/libffi/src/mips/ffi.c +240 -65
  100. data/ext/ffi_c/libffi/src/mips/ffitarget.h +7 -0
  101. data/ext/ffi_c/libffi/src/mips/n32.S +137 -28
  102. data/ext/ffi_c/libffi/src/mips/o32.S +61 -4
  103. data/ext/ffi_c/libffi/src/moxie/ffi.c +47 -22
  104. data/ext/ffi_c/libffi/src/or1k/ffi.c +25 -12
  105. data/ext/ffi_c/libffi/src/pa/ffi.c +32 -33
  106. data/ext/ffi_c/libffi/src/pa/ffi64.c +614 -0
  107. data/ext/ffi_c/libffi/src/pa/ffitarget.h +22 -8
  108. data/ext/ffi_c/libffi/src/pa/hpux32.S +83 -36
  109. data/ext/ffi_c/libffi/src/pa/hpux64.S +681 -0
  110. data/ext/ffi_c/libffi/src/pa/linux.S +82 -35
  111. data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +1 -1
  112. data/ext/ffi_c/libffi/src/powerpc/linux64.S +2 -0
  113. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +2 -0
  114. data/ext/ffi_c/libffi/src/powerpc/t-aix +5 -0
  115. data/ext/ffi_c/libffi/src/prep_cif.c +22 -2
  116. data/ext/ffi_c/libffi/src/riscv/ffi.c +37 -4
  117. data/ext/ffi_c/libffi/src/sparc/ffi64.c +16 -0
  118. data/ext/ffi_c/libffi/src/tramp.c +716 -0
  119. data/ext/ffi_c/libffi/src/wasm32/ffi.c +934 -0
  120. data/ext/ffi_c/libffi/src/wasm32/ffitarget.h +62 -0
  121. data/ext/ffi_c/libffi/src/x86/ffi.c +99 -37
  122. data/ext/ffi_c/libffi/src/x86/ffi64.c +67 -12
  123. data/ext/ffi_c/libffi/src/x86/ffitarget.h +9 -5
  124. data/ext/ffi_c/libffi/src/x86/ffiw64.c +43 -0
  125. data/ext/ffi_c/libffi/src/x86/internal.h +14 -0
  126. data/ext/ffi_c/libffi/src/x86/internal64.h +14 -0
  127. data/ext/ffi_c/libffi/src/x86/sysv.S +172 -38
  128. data/ext/ffi_c/libffi/src/x86/sysv_intel.S +91 -88
  129. data/ext/ffi_c/libffi/src/x86/unix64.S +96 -6
  130. data/ext/ffi_c/libffi/src/x86/win64.S +20 -7
  131. data/ext/ffi_c/libffi/src/xtensa/ffi.c +16 -8
  132. data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +4 -0
  133. data/ext/ffi_c/libffi/src/xtensa/sysv.S +26 -16
  134. data/ext/ffi_c/libffi/testsuite/Makefile.am +127 -114
  135. data/ext/ffi_c/libffi/testsuite/Makefile.in +137 -121
  136. data/ext/ffi_c/libffi/testsuite/emscripten/build-tests.sh +54 -0
  137. data/ext/ffi_c/libffi/testsuite/emscripten/build.sh +63 -0
  138. data/ext/ffi_c/libffi/testsuite/emscripten/conftest.py +80 -0
  139. data/ext/ffi_c/libffi/testsuite/emscripten/node-tests.sh +48 -0
  140. data/ext/ffi_c/libffi/testsuite/emscripten/test.html +7 -0
  141. data/ext/ffi_c/libffi/testsuite/emscripten/test_libffi.py +51 -0
  142. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +43 -21
  143. data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +2 -2
  144. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +1 -0
  145. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +5 -1
  146. data/ext/ffi_c/libffi/testsuite/libffi.call/bpo_38748.c +41 -0
  147. data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +28 -3
  148. data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +3 -0
  149. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +5 -0
  150. data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +4 -0
  151. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +4 -0
  152. data/ext/ffi_c/libffi/testsuite/libffi.call/s55.c +60 -0
  153. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +8 -9
  154. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +2 -2
  155. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +2 -2
  156. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +2 -2
  157. data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +1 -1
  158. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_2.c +63 -0
  159. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3.c +65 -0
  160. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3f.c +65 -0
  161. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4.c +67 -0
  162. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4f.c +67 -0
  163. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_big.c +93 -0
  164. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_small.c +61 -0
  165. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_2H.c +63 -0
  166. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_8H.c +90 -0
  167. data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +1 -119
  168. data/ext/ffi_c/libffi/testsuite/libffi.call/va_2.c +220 -0
  169. data/ext/ffi_c/libffi/testsuite/libffi.call/va_3.c +154 -0
  170. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +13 -0
  171. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +11 -0
  172. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +15 -0
  173. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn0.c +3 -2
  174. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn1.c +2 -0
  175. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn2.c +2 -0
  176. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn3.c +21 -1
  177. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn4.c +2 -0
  178. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn5.c +2 -0
  179. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn6.c +2 -0
  180. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_loc_fn0.c +7 -6
  181. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_simple.c +6 -0
  182. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_12byte.c +18 -0
  183. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_16byte.c +22 -0
  184. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_18byte.c +24 -0
  185. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_19byte.c +29 -0
  186. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_1_1byte.c +4 -0
  187. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte.c +19 -1
  188. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte1.c +21 -1
  189. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_24byte.c +35 -3
  190. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_2byte.c +13 -0
  191. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3_1byte.c +19 -0
  192. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte1.c +13 -0
  193. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte2.c +13 -0
  194. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3float.c +18 -0
  195. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4_1byte.c +22 -0
  196. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4byte.c +13 -0
  197. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5_1_byte.c +29 -1
  198. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5byte.c +19 -1
  199. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_64byte.c +24 -0
  200. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6_1_byte.c +28 -1
  201. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6byte.c +24 -2
  202. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7_1_byte.c +39 -1
  203. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7byte.c +25 -1
  204. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_8byte.c +14 -0
  205. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte1.c +14 -1
  206. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte2.c +14 -2
  207. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_double.c +19 -1
  208. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_float.c +19 -1
  209. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble.c +20 -1
  210. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split.c +40 -25
  211. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split2.c +40 -3
  212. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_pointer.c +19 -1
  213. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint16.c +18 -1
  214. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint32.c +18 -3
  215. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint64.c +18 -1
  216. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint16.c +18 -1
  217. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint32.c +19 -1
  218. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint64.c +19 -1
  219. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_dbls_struct.c +3 -1
  220. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_double_va.c +9 -1
  221. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_float.c +4 -0
  222. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble.c +11 -1
  223. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble_va.c +22 -3
  224. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_schar.c +5 -1
  225. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshort.c +6 -1
  226. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshortchar.c +9 -1
  227. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_uchar.c +9 -1
  228. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushort.c +6 -2
  229. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushortchar.c +9 -1
  230. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer.c +5 -0
  231. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer_stack.c +10 -0
  232. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_schar.c +3 -0
  233. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sint.c +2 -0
  234. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sshort.c +3 -0
  235. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_struct_va1.c +11 -0
  236. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uchar.c +3 -0
  237. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint.c +4 -0
  238. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint_va.c +4 -0
  239. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulong_va.c +4 -0
  240. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulonglong.c +2 -0
  241. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ushort.c +3 -0
  242. data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +1 -138
  243. data/ext/ffi_c/libffi/testsuite/libffi.closures/huge_struct.c +21 -21
  244. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct.c +32 -9
  245. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct1.c +1 -1
  246. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct10.c +12 -0
  247. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct11.c +21 -5
  248. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct12.c +86 -0
  249. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct13.c +115 -0
  250. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct2.c +10 -1
  251. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct3.c +10 -1
  252. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct4.c +9 -0
  253. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct5.c +9 -0
  254. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct6.c +11 -0
  255. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct7.c +9 -0
  256. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct8.c +11 -0
  257. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct9.c +11 -0
  258. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs1.c +86 -0
  259. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs2.c +102 -0
  260. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs3.c +101 -0
  261. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium.c +1 -1
  262. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium2.c +1 -1
  263. data/ext/ffi_c/libffi/testsuite/libffi.closures/testclosure.c +6 -1
  264. data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest.cc +2 -1
  265. data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest_ffi_call.cc +1 -0
  266. data/ext/ffi_c/libffi.bsd.mk +2 -2
  267. data/ext/ffi_c/libffi.gnu.mk +2 -2
  268. data/ext/ffi_c/rbffi.h +1 -1
  269. data/ffi.gemspec +3 -3
  270. data/lib/ffi/autopointer.rb +7 -22
  271. data/lib/ffi/compat.rb +43 -0
  272. data/lib/ffi/data_converter.rb +2 -2
  273. data/lib/ffi/dynamic_library.rb +89 -0
  274. data/lib/ffi/enum.rb +18 -11
  275. data/lib/ffi/ffi.rb +3 -0
  276. data/lib/ffi/function.rb +71 -0
  277. data/lib/ffi/library.rb +55 -71
  278. data/lib/ffi/library_path.rb +109 -0
  279. data/lib/ffi/managedstruct.rb +1 -1
  280. data/lib/ffi/platform/aarch64-windows/types.conf +52 -0
  281. data/lib/ffi/platform/hppa1.1-linux/types.conf +178 -0
  282. data/lib/ffi/platform/hppa2.0-linux/types.conf +178 -0
  283. data/lib/ffi/platform/loongarch64-linux/types.conf +141 -0
  284. data/lib/ffi/platform/sw_64-linux/types.conf +141 -0
  285. data/lib/ffi/platform.rb +15 -13
  286. data/lib/ffi/struct.rb +2 -1
  287. data/lib/ffi/struct_layout.rb +1 -1
  288. data/lib/ffi/struct_layout_builder.rb +1 -1
  289. data/lib/ffi/types.rb +30 -5
  290. data/lib/ffi/variadic.rb +19 -8
  291. data/lib/ffi/version.rb +1 -1
  292. data.tar.gz.sig +3 -0
  293. metadata +98 -25
  294. metadata.gz.sig +3 -0
  295. data/ext/ffi_c/libffi/.travis/build-cross-in-container.sh +0 -14
  296. data/ext/ffi_c/libffi/.travis/build.sh +0 -142
  297. data/ext/ffi_c/libffi/.travis.yml +0 -83
  298. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uchar_va.c +0 -44
  299. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ushort_va.c +0 -44
  300. /data/ext/ffi_c/libffi/{.travis → .ci}/ar-lib +0 -0
  301. /data/ext/ffi_c/libffi/{.travis → .ci}/bfin-sim.exp +0 -0
  302. /data/ext/ffi_c/libffi/{.travis → .ci}/compile +0 -0
  303. /data/ext/ffi_c/libffi/{.travis → .ci}/m32r-sim.exp +0 -0
  304. /data/ext/ffi_c/libffi/{.travis → .ci}/moxie-sim.exp +0 -0
  305. /data/ext/ffi_c/libffi/{.travis → .ci}/or1k-sim.exp +0 -0
  306. /data/ext/ffi_c/libffi/{.travis → .ci}/powerpc-eabisim.exp +0 -0
  307. /data/ext/ffi_c/libffi/{.travis → .ci}/wine-sim.exp +0 -0
  308. /data/ext/ffi_c/libffi/testsuite/libffi.call/{pyobjc-tc.c → pyobjc_tc.c} +0 -0
  309. /data/lib/ffi/platform/{sparc64-linux → sparcv9-linux}/types.conf +0 -0
@@ -1,12 +1,14 @@
1
1
  #! /bin/sh
2
2
  # Configuration validation subroutine script.
3
- # Copyright 1992-2020 Free Software Foundation, Inc.
3
+ # Copyright 1992-2022 Free Software Foundation, Inc.
4
4
 
5
- timestamp='2020-08-05'
5
+ # shellcheck disable=SC2006,SC2268 # see below for rationale
6
+
7
+ timestamp='2022-01-03'
6
8
 
7
9
  # This file is free software; you can redistribute it and/or modify it
8
10
  # under the terms of the GNU General Public License as published by
9
- # the Free Software Foundation; either version 3 of the License, or
11
+ # the Free Software Foundation, either version 3 of the License, or
10
12
  # (at your option) any later version.
11
13
  #
12
14
  # This program is distributed in the hope that it will be useful, but
@@ -33,7 +35,7 @@ timestamp='2020-08-05'
33
35
  # Otherwise, we print the canonical config type on stdout and succeed.
34
36
 
35
37
  # You can get the latest version of this script from:
36
- # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
38
+ # https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
37
39
 
38
40
  # This file is supposed to be the same for all GNU packages
39
41
  # and recognize all the CPU types, system types and aliases
@@ -50,6 +52,13 @@ timestamp='2020-08-05'
50
52
  # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
51
53
  # It is wrong to echo any other type of specification.
52
54
 
55
+ # The "shellcheck disable" line above the timestamp inhibits complaints
56
+ # about features and limitations of the classic Bourne shell that were
57
+ # superseded or lifted in POSIX. However, this script identifies a wide
58
+ # variety of pre-POSIX systems that do not have POSIX shells at all, and
59
+ # even some reasonably current systems (Solaris 10 as case-in-point) still
60
+ # have a pre-POSIX /bin/sh.
61
+
53
62
  me=`echo "$0" | sed -e 's,.*/,,'`
54
63
 
55
64
  usage="\
@@ -67,7 +76,7 @@ Report bugs and patches to <config-patches@gnu.org>."
67
76
  version="\
68
77
  GNU config.sub ($timestamp)
69
78
 
70
- Copyright 1992-2020 Free Software Foundation, Inc.
79
+ Copyright 1992-2022 Free Software Foundation, Inc.
71
80
 
72
81
  This is free software; see the source for copying conditions. There is NO
73
82
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -112,9 +121,11 @@ esac
112
121
 
113
122
  # Split fields of configuration type
114
123
  # shellcheck disable=SC2162
124
+ saved_IFS=$IFS
115
125
  IFS="-" read field1 field2 field3 field4 <<EOF
116
126
  $1
117
127
  EOF
128
+ IFS=$saved_IFS
118
129
 
119
130
  # Separate into logical components for further validation
120
131
  case $1 in
@@ -163,6 +174,10 @@ case $1 in
163
174
  basic_machine=$field1
164
175
  basic_os=$field2
165
176
  ;;
177
+ zephyr*)
178
+ basic_machine=$field1-unknown
179
+ basic_os=$field2
180
+ ;;
166
181
  # Manufacturers
167
182
  dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
168
183
  | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
@@ -922,9 +937,11 @@ case $basic_machine in
922
937
 
923
938
  *-*)
924
939
  # shellcheck disable=SC2162
940
+ saved_IFS=$IFS
925
941
  IFS="-" read cpu vendor <<EOF
926
942
  $basic_machine
927
943
  EOF
944
+ IFS=$saved_IFS
928
945
  ;;
929
946
  # We use `pc' rather than `unknown'
930
947
  # because (1) that's what they normally are, and
@@ -1003,6 +1020,11 @@ case $cpu-$vendor in
1003
1020
  ;;
1004
1021
 
1005
1022
  # Here we normalize CPU types with a missing or matching vendor
1023
+ armh-unknown | armh-alt)
1024
+ cpu=armv7l
1025
+ vendor=alt
1026
+ basic_os=${basic_os:-linux-gnueabihf}
1027
+ ;;
1006
1028
  dpx20-unknown | dpx20-bull)
1007
1029
  cpu=rs6000
1008
1030
  vendor=bull
@@ -1104,7 +1126,7 @@ case $cpu-$vendor in
1104
1126
  xscale-* | xscalee[bl]-*)
1105
1127
  cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
1106
1128
  ;;
1107
- arm64-*)
1129
+ arm64-* | arm64_32-* | aarch64le-*)
1108
1130
  cpu=aarch64
1109
1131
  ;;
1110
1132
 
@@ -1165,7 +1187,7 @@ case $cpu-$vendor in
1165
1187
  | alphapca5[67] | alpha64pca5[67] \
1166
1188
  | am33_2.0 \
1167
1189
  | amdgcn \
1168
- | arc | arceb \
1190
+ | arc | arceb | arc32 | arc64 \
1169
1191
  | arm | arm[lb]e | arme[lb] | armv* \
1170
1192
  | avr | avr32 \
1171
1193
  | asmjs \
@@ -1185,6 +1207,7 @@ case $cpu-$vendor in
1185
1207
  | k1om \
1186
1208
  | le32 | le64 \
1187
1209
  | lm32 \
1210
+ | loongarch32 | loongarch64 | loongarchx32 \
1188
1211
  | m32c | m32r | m32rle \
1189
1212
  | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
1190
1213
  | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
@@ -1203,9 +1226,13 @@ case $cpu-$vendor in
1203
1226
  | mips64vr5900 | mips64vr5900el \
1204
1227
  | mipsisa32 | mipsisa32el \
1205
1228
  | mipsisa32r2 | mipsisa32r2el \
1229
+ | mipsisa32r3 | mipsisa32r3el \
1230
+ | mipsisa32r5 | mipsisa32r5el \
1206
1231
  | mipsisa32r6 | mipsisa32r6el \
1207
1232
  | mipsisa64 | mipsisa64el \
1208
1233
  | mipsisa64r2 | mipsisa64r2el \
1234
+ | mipsisa64r3 | mipsisa64r3el \
1235
+ | mipsisa64r5 | mipsisa64r5el \
1209
1236
  | mipsisa64r6 | mipsisa64r6el \
1210
1237
  | mipsisa64sb1 | mipsisa64sb1el \
1211
1238
  | mipsisa64sr71k | mipsisa64sr71kel \
@@ -1229,7 +1256,7 @@ case $cpu-$vendor in
1229
1256
  | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
1230
1257
  | pru \
1231
1258
  | pyramid \
1232
- | riscv | riscv32 | riscv64 \
1259
+ | riscv | riscv32 | riscv32be | riscv64 | riscv64be \
1233
1260
  | rl78 | romp | rs6000 | rx \
1234
1261
  | s390 | s390x \
1235
1262
  | score \
@@ -1241,6 +1268,7 @@ case $cpu-$vendor in
1241
1268
  | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
1242
1269
  | spu \
1243
1270
  | tahoe \
1271
+ | thumbv7* \
1244
1272
  | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
1245
1273
  | tron \
1246
1274
  | ubicom32 \
@@ -1278,34 +1306,40 @@ esac
1278
1306
 
1279
1307
  # Decode manufacturer-specific aliases for certain operating systems.
1280
1308
 
1281
- if [ x$basic_os != x ]
1309
+ if test x$basic_os != x
1282
1310
  then
1283
1311
 
1284
- # First recognize some ad-hoc caes, or perhaps split kernel-os, or else just
1312
+ # First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
1285
1313
  # set os.
1286
1314
  case $basic_os in
1287
1315
  gnu/linux*)
1288
1316
  kernel=linux
1289
- os=`echo $basic_os | sed -e 's|gnu/linux|gnu|'`
1317
+ os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
1318
+ ;;
1319
+ os2-emx)
1320
+ kernel=os2
1321
+ os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
1290
1322
  ;;
1291
1323
  nto-qnx*)
1292
1324
  kernel=nto
1293
- os=`echo $basic_os | sed -e 's|nto-qnx|qnx|'`
1325
+ os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
1294
1326
  ;;
1295
1327
  *-*)
1296
1328
  # shellcheck disable=SC2162
1329
+ saved_IFS=$IFS
1297
1330
  IFS="-" read kernel os <<EOF
1298
1331
  $basic_os
1299
1332
  EOF
1333
+ IFS=$saved_IFS
1300
1334
  ;;
1301
1335
  # Default OS when just kernel was specified
1302
1336
  nto*)
1303
1337
  kernel=nto
1304
- os=`echo $basic_os | sed -e 's|nto|qnx|'`
1338
+ os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
1305
1339
  ;;
1306
1340
  linux*)
1307
1341
  kernel=linux
1308
- os=`echo $basic_os | sed -e 's|linux|gnu|'`
1342
+ os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
1309
1343
  ;;
1310
1344
  *)
1311
1345
  kernel=
@@ -1326,7 +1360,7 @@ case $os in
1326
1360
  os=cnk
1327
1361
  ;;
1328
1362
  solaris1 | solaris1.*)
1329
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
1363
+ os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
1330
1364
  ;;
1331
1365
  solaris)
1332
1366
  os=solaris2
@@ -1355,7 +1389,7 @@ case $os in
1355
1389
  os=sco3.2v4
1356
1390
  ;;
1357
1391
  sco3.2.[4-9]*)
1358
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
1392
+ os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
1359
1393
  ;;
1360
1394
  sco*v* | scout)
1361
1395
  # Don't match below
@@ -1367,13 +1401,7 @@ case $os in
1367
1401
  os=psos
1368
1402
  ;;
1369
1403
  qnx*)
1370
- case $cpu in
1371
- x86 | i*86)
1372
- ;;
1373
- *)
1374
- os=nto-$os
1375
- ;;
1376
- esac
1404
+ os=qnx
1377
1405
  ;;
1378
1406
  hiux*)
1379
1407
  os=hiuxwe2
@@ -1437,7 +1465,7 @@ case $os in
1437
1465
  ;;
1438
1466
  # Preserve the version number of sinix5.
1439
1467
  sinix5.*)
1440
- os=`echo $os | sed -e 's|sinix|sysv|'`
1468
+ os=`echo "$os" | sed -e 's|sinix|sysv|'`
1441
1469
  ;;
1442
1470
  sinix*)
1443
1471
  os=sysv4
@@ -1683,11 +1711,14 @@ fi
1683
1711
 
1684
1712
  # Now, validate our (potentially fixed-up) OS.
1685
1713
  case $os in
1686
- # Sometimes we do "kernel-abi", so those need to count as OSes.
1687
- musl* | newlib* | uclibc*)
1714
+ # Sometimes we do "kernel-libc", so those need to count as OSes.
1715
+ musl* | newlib* | relibc* | uclibc*)
1716
+ ;;
1717
+ # Likewise for "kernel-abi"
1718
+ eabi* | gnueabi*)
1688
1719
  ;;
1689
- # Likewise for "kernel-libc"
1690
- eabi | eabisim | eabihf | gnueabi | gnueabihf)
1720
+ # VxWorks passes extra cpu info in the 4th filed.
1721
+ simlinux | simwindows | spe)
1691
1722
  ;;
1692
1723
  # Now accept the basic system types.
1693
1724
  # The portable systems comes first.
@@ -1697,19 +1728,19 @@ case $os in
1697
1728
  | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
1698
1729
  | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \
1699
1730
  | hiux* | abug | nacl* | netware* | windows* \
1700
- | os9* | macos* | osx* | ios* \
1731
+ | os9* | macos* | osx* | ios* | watchos* | tvos* \
1701
1732
  | mpw* | magic* | mmixware* | mon960* | lnews* \
1702
1733
  | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
1703
1734
  | aos* | aros* | cloudabi* | sortix* | twizzler* \
1704
1735
  | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
1705
1736
  | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
1706
1737
  | mirbsd* | netbsd* | dicos* | openedition* | ose* \
1707
- | bitrig* | openbsd* | solidbsd* | libertybsd* | os108* \
1738
+ | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
1708
1739
  | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
1709
1740
  | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
1710
1741
  | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
1711
1742
  | udi* | lites* | ieee* | go32* | aux* | hcos* \
1712
- | chorusrdb* | cegcc* | glidix* \
1743
+ | chorusrdb* | cegcc* | glidix* | serenity* \
1713
1744
  | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
1714
1745
  | midipix* | mingw32* | mingw64* | mint* \
1715
1746
  | uxpv* | beos* | mpeix* | udk* | moxiebox* \
@@ -1722,7 +1753,8 @@ case $os in
1722
1753
  | skyos* | haiku* | rdos* | toppers* | drops* | es* \
1723
1754
  | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
1724
1755
  | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
1725
- | nsk* | powerunix* | genode* | zvmoe* )
1756
+ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
1757
+ | fiwix* )
1726
1758
  ;;
1727
1759
  # This one is extra strict with allowed versions
1728
1760
  sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
@@ -1739,9 +1771,12 @@ esac
1739
1771
  # As a final step for OS-related things, validate the OS-kernel combination
1740
1772
  # (given a valid OS), if there is a kernel.
1741
1773
  case $kernel-$os in
1742
- linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* )
1774
+ linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
1775
+ | linux-musl* | linux-relibc* | linux-uclibc* )
1743
1776
  ;;
1744
- -dietlibc* | -newlib* | -musl* | -uclibc* )
1777
+ uclinux-uclibc* )
1778
+ ;;
1779
+ -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
1745
1780
  # These are just libc implementations, not actual OSes, and thus
1746
1781
  # require a kernel.
1747
1782
  echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
@@ -1749,8 +1784,14 @@ case $kernel-$os in
1749
1784
  ;;
1750
1785
  kfreebsd*-gnu* | kopensolaris*-gnu*)
1751
1786
  ;;
1787
+ vxworks-simlinux | vxworks-simwindows | vxworks-spe)
1788
+ ;;
1752
1789
  nto-qnx*)
1753
1790
  ;;
1791
+ os2-emx)
1792
+ ;;
1793
+ ios*-simulator | tvos*-simulator | watchos*-simulator)
1794
+ ;;
1754
1795
  *-eabi* | *-gnueabi*)
1755
1796
  ;;
1756
1797
  -*)