ffi 1.15.5 → 1.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (308) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +54 -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/config.guess +623 -556
  54. data/ext/ffi_c/libffi/config.sub +75 -34
  55. data/ext/ffi_c/libffi/configure +4571 -3830
  56. data/ext/ffi_c/libffi/configure.ac +64 -28
  57. data/ext/ffi_c/libffi/configure.host +25 -6
  58. data/ext/ffi_c/libffi/doc/Makefile.in +9 -6
  59. data/ext/ffi_c/libffi/doc/libffi.texi +82 -33
  60. data/ext/ffi_c/libffi/doc/version.texi +4 -4
  61. data/ext/ffi_c/libffi/fficonfig.h.in +12 -47
  62. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +163 -52
  63. data/ext/ffi_c/libffi/include/Makefile.am +1 -1
  64. data/ext/ffi_c/libffi/include/Makefile.in +10 -9
  65. data/ext/ffi_c/libffi/include/ffi.h.in +54 -50
  66. data/ext/ffi_c/libffi/include/ffi_cfi.h +21 -0
  67. data/ext/ffi_c/libffi/include/ffi_common.h +29 -0
  68. data/ext/ffi_c/libffi/include/tramp.h +45 -0
  69. data/ext/ffi_c/libffi/install-sh +92 -69
  70. data/ext/ffi_c/libffi/libtool-version +2 -2
  71. data/ext/ffi_c/libffi/ltmain.sh +512 -315
  72. data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +18 -14
  73. data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +108 -72
  74. data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +76 -45
  75. data/ext/ffi_c/libffi/m4/ax_prepend_flag.m4 +51 -0
  76. data/ext/ffi_c/libffi/man/Makefile.in +9 -6
  77. data/ext/ffi_c/libffi/missing +1 -1
  78. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +1 -1
  79. data/ext/ffi_c/libffi/msvcc.sh +1 -1
  80. data/ext/ffi_c/libffi/src/aarch64/ffi.c +146 -42
  81. data/ext/ffi_c/libffi/src/aarch64/internal.h +32 -0
  82. data/ext/ffi_c/libffi/src/aarch64/sysv.S +134 -42
  83. data/ext/ffi_c/libffi/src/arc/arcompact.S +169 -94
  84. data/ext/ffi_c/libffi/src/arc/ffi.c +325 -148
  85. data/ext/ffi_c/libffi/src/arc/ffitarget.h +14 -0
  86. data/ext/ffi_c/libffi/src/arm/ffi.c +62 -17
  87. data/ext/ffi_c/libffi/src/arm/ffitarget.h +3 -3
  88. data/ext/ffi_c/libffi/src/arm/internal.h +10 -0
  89. data/ext/ffi_c/libffi/src/arm/sysv.S +113 -42
  90. data/ext/ffi_c/libffi/src/closures.c +133 -47
  91. data/ext/ffi_c/libffi/src/dlmalloc.c +5 -0
  92. data/ext/ffi_c/libffi/src/ia64/ffi.c +12 -0
  93. data/ext/ffi_c/libffi/src/ia64/unix.S +20 -2
  94. data/ext/ffi_c/libffi/src/loongarch64/ffi.c +621 -0
  95. data/ext/ffi_c/libffi/src/loongarch64/ffitarget.h +82 -0
  96. data/ext/ffi_c/libffi/src/loongarch64/sysv.S +327 -0
  97. data/ext/ffi_c/libffi/src/m32r/ffi.c +31 -14
  98. data/ext/ffi_c/libffi/src/mips/ffi.c +240 -65
  99. data/ext/ffi_c/libffi/src/mips/ffitarget.h +7 -0
  100. data/ext/ffi_c/libffi/src/mips/n32.S +137 -28
  101. data/ext/ffi_c/libffi/src/mips/o32.S +61 -4
  102. data/ext/ffi_c/libffi/src/moxie/ffi.c +47 -22
  103. data/ext/ffi_c/libffi/src/or1k/ffi.c +25 -12
  104. data/ext/ffi_c/libffi/src/pa/ffi.c +32 -33
  105. data/ext/ffi_c/libffi/src/pa/ffi64.c +614 -0
  106. data/ext/ffi_c/libffi/src/pa/ffitarget.h +22 -8
  107. data/ext/ffi_c/libffi/src/pa/hpux32.S +83 -36
  108. data/ext/ffi_c/libffi/src/pa/hpux64.S +681 -0
  109. data/ext/ffi_c/libffi/src/pa/linux.S +82 -35
  110. data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +1 -1
  111. data/ext/ffi_c/libffi/src/powerpc/linux64.S +2 -0
  112. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +2 -0
  113. data/ext/ffi_c/libffi/src/powerpc/t-aix +5 -0
  114. data/ext/ffi_c/libffi/src/prep_cif.c +22 -2
  115. data/ext/ffi_c/libffi/src/riscv/ffi.c +37 -4
  116. data/ext/ffi_c/libffi/src/sparc/ffi64.c +16 -0
  117. data/ext/ffi_c/libffi/src/tramp.c +716 -0
  118. data/ext/ffi_c/libffi/src/wasm32/ffi.c +934 -0
  119. data/ext/ffi_c/libffi/src/wasm32/ffitarget.h +62 -0
  120. data/ext/ffi_c/libffi/src/x86/ffi.c +99 -37
  121. data/ext/ffi_c/libffi/src/x86/ffi64.c +67 -12
  122. data/ext/ffi_c/libffi/src/x86/ffitarget.h +9 -5
  123. data/ext/ffi_c/libffi/src/x86/ffiw64.c +43 -0
  124. data/ext/ffi_c/libffi/src/x86/internal.h +14 -0
  125. data/ext/ffi_c/libffi/src/x86/internal64.h +14 -0
  126. data/ext/ffi_c/libffi/src/x86/sysv.S +172 -38
  127. data/ext/ffi_c/libffi/src/x86/sysv_intel.S +91 -88
  128. data/ext/ffi_c/libffi/src/x86/unix64.S +96 -6
  129. data/ext/ffi_c/libffi/src/x86/win64.S +20 -7
  130. data/ext/ffi_c/libffi/src/xtensa/ffi.c +16 -8
  131. data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +4 -0
  132. data/ext/ffi_c/libffi/src/xtensa/sysv.S +26 -16
  133. data/ext/ffi_c/libffi/testsuite/Makefile.am +127 -114
  134. data/ext/ffi_c/libffi/testsuite/Makefile.in +137 -121
  135. data/ext/ffi_c/libffi/testsuite/emscripten/build-tests.sh +54 -0
  136. data/ext/ffi_c/libffi/testsuite/emscripten/build.sh +63 -0
  137. data/ext/ffi_c/libffi/testsuite/emscripten/conftest.py +80 -0
  138. data/ext/ffi_c/libffi/testsuite/emscripten/node-tests.sh +48 -0
  139. data/ext/ffi_c/libffi/testsuite/emscripten/test.html +7 -0
  140. data/ext/ffi_c/libffi/testsuite/emscripten/test_libffi.py +51 -0
  141. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +43 -21
  142. data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +2 -2
  143. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +1 -0
  144. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +5 -1
  145. data/ext/ffi_c/libffi/testsuite/libffi.call/bpo_38748.c +41 -0
  146. data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +28 -3
  147. data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +3 -0
  148. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +5 -0
  149. data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +4 -0
  150. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +4 -0
  151. data/ext/ffi_c/libffi/testsuite/libffi.call/s55.c +60 -0
  152. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +8 -9
  153. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +2 -2
  154. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +2 -2
  155. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +2 -2
  156. data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +1 -1
  157. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_2.c +63 -0
  158. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3.c +65 -0
  159. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3f.c +65 -0
  160. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4.c +67 -0
  161. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4f.c +67 -0
  162. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_big.c +93 -0
  163. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_small.c +61 -0
  164. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_2H.c +63 -0
  165. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_8H.c +90 -0
  166. data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +1 -119
  167. data/ext/ffi_c/libffi/testsuite/libffi.call/va_2.c +220 -0
  168. data/ext/ffi_c/libffi/testsuite/libffi.call/va_3.c +154 -0
  169. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +13 -0
  170. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +11 -0
  171. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +15 -0
  172. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn0.c +3 -2
  173. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn1.c +2 -0
  174. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn2.c +2 -0
  175. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn3.c +21 -1
  176. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn4.c +2 -0
  177. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn5.c +2 -0
  178. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn6.c +2 -0
  179. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_loc_fn0.c +7 -6
  180. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_simple.c +6 -0
  181. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_12byte.c +18 -0
  182. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_16byte.c +22 -0
  183. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_18byte.c +24 -0
  184. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_19byte.c +29 -0
  185. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_1_1byte.c +4 -0
  186. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte.c +19 -1
  187. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte1.c +21 -1
  188. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_24byte.c +35 -3
  189. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_2byte.c +13 -0
  190. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3_1byte.c +19 -0
  191. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte1.c +13 -0
  192. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte2.c +13 -0
  193. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3float.c +18 -0
  194. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4_1byte.c +22 -0
  195. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4byte.c +13 -0
  196. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5_1_byte.c +29 -1
  197. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5byte.c +19 -1
  198. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_64byte.c +24 -0
  199. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6_1_byte.c +28 -1
  200. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6byte.c +24 -2
  201. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7_1_byte.c +39 -1
  202. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7byte.c +25 -1
  203. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_8byte.c +14 -0
  204. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte1.c +14 -1
  205. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte2.c +14 -2
  206. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_double.c +19 -1
  207. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_float.c +19 -1
  208. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble.c +20 -1
  209. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split.c +40 -25
  210. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split2.c +40 -3
  211. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_pointer.c +19 -1
  212. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint16.c +18 -1
  213. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint32.c +18 -3
  214. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint64.c +18 -1
  215. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint16.c +18 -1
  216. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint32.c +19 -1
  217. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint64.c +19 -1
  218. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_dbls_struct.c +3 -1
  219. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_double_va.c +9 -1
  220. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_float.c +4 -0
  221. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble.c +11 -1
  222. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble_va.c +22 -3
  223. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_schar.c +5 -1
  224. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshort.c +6 -1
  225. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshortchar.c +9 -1
  226. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_uchar.c +9 -1
  227. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushort.c +6 -2
  228. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushortchar.c +9 -1
  229. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer.c +5 -0
  230. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer_stack.c +10 -0
  231. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_schar.c +3 -0
  232. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sint.c +2 -0
  233. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sshort.c +3 -0
  234. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_struct_va1.c +11 -0
  235. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uchar.c +3 -0
  236. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint.c +4 -0
  237. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint_va.c +4 -0
  238. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulong_va.c +4 -0
  239. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulonglong.c +2 -0
  240. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ushort.c +3 -0
  241. data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +1 -138
  242. data/ext/ffi_c/libffi/testsuite/libffi.closures/huge_struct.c +21 -21
  243. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct.c +32 -9
  244. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct1.c +1 -1
  245. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct10.c +12 -0
  246. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct11.c +21 -5
  247. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct12.c +86 -0
  248. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct13.c +115 -0
  249. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct2.c +10 -1
  250. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct3.c +10 -1
  251. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct4.c +9 -0
  252. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct5.c +9 -0
  253. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct6.c +11 -0
  254. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct7.c +9 -0
  255. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct8.c +11 -0
  256. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct9.c +11 -0
  257. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs1.c +86 -0
  258. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs2.c +102 -0
  259. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs3.c +101 -0
  260. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium.c +1 -1
  261. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium2.c +1 -1
  262. data/ext/ffi_c/libffi/testsuite/libffi.closures/testclosure.c +6 -1
  263. data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest.cc +2 -1
  264. data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest_ffi_call.cc +1 -0
  265. data/ext/ffi_c/libffi.bsd.mk +2 -2
  266. data/ext/ffi_c/libffi.gnu.mk +2 -2
  267. data/ext/ffi_c/rbffi.h +1 -1
  268. data/ffi.gemspec +2 -2
  269. data/lib/ffi/autopointer.rb +7 -22
  270. data/lib/ffi/compat.rb +43 -0
  271. data/lib/ffi/data_converter.rb +2 -2
  272. data/lib/ffi/dynamic_library.rb +89 -0
  273. data/lib/ffi/enum.rb +18 -11
  274. data/lib/ffi/ffi.rb +3 -0
  275. data/lib/ffi/function.rb +71 -0
  276. data/lib/ffi/library.rb +55 -71
  277. data/lib/ffi/library_path.rb +109 -0
  278. data/lib/ffi/managedstruct.rb +1 -1
  279. data/lib/ffi/platform/aarch64-windows/types.conf +52 -0
  280. data/lib/ffi/platform/hppa1.1-linux/types.conf +178 -0
  281. data/lib/ffi/platform/hppa2.0-linux/types.conf +178 -0
  282. data/lib/ffi/platform/loongarch64-linux/types.conf +141 -0
  283. data/lib/ffi/platform/sw_64-linux/types.conf +141 -0
  284. data/lib/ffi/platform.rb +15 -13
  285. data/lib/ffi/struct.rb +2 -1
  286. data/lib/ffi/struct_layout.rb +1 -1
  287. data/lib/ffi/struct_layout_builder.rb +1 -1
  288. data/lib/ffi/types.rb +30 -5
  289. data/lib/ffi/variadic.rb +19 -8
  290. data/lib/ffi/version.rb +1 -1
  291. data.tar.gz.sig +0 -0
  292. metadata +97 -25
  293. metadata.gz.sig +1 -0
  294. data/ext/ffi_c/libffi/.travis/build-cross-in-container.sh +0 -14
  295. data/ext/ffi_c/libffi/.travis/build.sh +0 -142
  296. data/ext/ffi_c/libffi/.travis.yml +0 -83
  297. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uchar_va.c +0 -44
  298. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ushort_va.c +0 -44
  299. /data/ext/ffi_c/libffi/{.travis → .ci}/ar-lib +0 -0
  300. /data/ext/ffi_c/libffi/{.travis → .ci}/bfin-sim.exp +0 -0
  301. /data/ext/ffi_c/libffi/{.travis → .ci}/compile +0 -0
  302. /data/ext/ffi_c/libffi/{.travis → .ci}/m32r-sim.exp +0 -0
  303. /data/ext/ffi_c/libffi/{.travis → .ci}/moxie-sim.exp +0 -0
  304. /data/ext/ffi_c/libffi/{.travis → .ci}/or1k-sim.exp +0 -0
  305. /data/ext/ffi_c/libffi/{.travis → .ci}/powerpc-eabisim.exp +0 -0
  306. /data/ext/ffi_c/libffi/{.travis → .ci}/wine-sim.exp +0 -0
  307. /data/ext/ffi_c/libffi/testsuite/libffi.call/{pyobjc-tc.c → pyobjc_tc.c} +0 -0
  308. /data/lib/ffi/platform/{sparc64-linux → sparcv9-linux}/types.conf +0 -0
@@ -1,10 +1,7 @@
1
1
  Status
2
2
  ======
3
3
 
4
- [![Build Status](https://travis-ci.org/libffi/libffi.svg?branch=master)](https://travis-ci.org/libffi/libffi)
5
- [![Build status](https://ci.appveyor.com/api/projects/status/8lko9vagbx4w2kxq?svg=true)](https://ci.appveyor.com/project/atgreen/libffi)
6
-
7
- libffi-3.4 was released on TBD. Check the libffi web
4
+ libffi-3.4.4 was released on October 23, 2022. Check the libffi web
8
5
  page for updates: <URL:http://sourceware.org/libffi/>.
9
6
 
10
7
 
@@ -28,7 +25,7 @@ bridge from the interpreter program to compiled code.
28
25
  The libffi library provides a portable, high level programming
29
26
  interface to various calling conventions. This allows a programmer to
30
27
  call any function specified by a call interface description at run
31
- time.
28
+ time.
32
29
 
33
30
  FFI stands for Foreign Function Interface. A foreign function
34
31
  interface is the popular name for the interface that allows code
@@ -55,6 +52,8 @@ tested:
55
52
  | Alpha | Linux | GCC |
56
53
  | Alpha | Tru64 | GCC |
57
54
  | ARC | Linux | GCC |
55
+ | ARC32 | Linux | GCC |
56
+ | ARC64 | Linux | GCC |
58
57
  | ARM | Linux | GCC |
59
58
  | ARM | iOS | GCC |
60
59
  | ARM | Windows | MSVC |
@@ -62,8 +61,10 @@ tested:
62
61
  | Blackfin | uClinux | GCC |
63
62
  | CSKY | Linux | GCC |
64
63
  | HPPA | HPUX | GCC |
64
+ | HPPA64 | HPUX | GCC |
65
65
  | KVX | Linux | GCC |
66
66
  | IA-64 | Linux | GCC |
67
+ | LoongArch64 | Linux | GCC |
67
68
  | M68K | FreeMiNT | GCC |
68
69
  | M68K | Linux | GCC |
69
70
  | M68K | RTEMS | GCC |
@@ -77,6 +78,7 @@ tested:
77
78
  | Moxie | Bare metal | GCC |
78
79
  | Nios II | Linux | GCC |
79
80
  | OpenRISC | Linux | GCC |
81
+ | PowerPC 32-bit | AIX | GCC |
80
82
  | PowerPC 32-bit | AIX | IBM XL C |
81
83
  | PowerPC 64-bit | AIX | IBM XL C |
82
84
  | PowerPC | AMIGA | GCC |
@@ -98,6 +100,7 @@ tested:
98
100
  | SPARC64 | Solaris | Oracle Solaris Studio C |
99
101
  | TILE-Gx/TILEPro | Linux | GCC |
100
102
  | VAX | OpenBSD/vax | GCC |
103
+ | WASM32 | Emscripten | EMCC |
101
104
  | X86 | FreeBSD | GCC |
102
105
  | X86 | GNU HURD | GCC |
103
106
  | X86 | Interix | GCC |
@@ -108,14 +111,14 @@ tested:
108
111
  | X86 | Solaris | GCC |
109
112
  | X86 | Solaris | Oracle Solaris Studio C |
110
113
  | X86 | Windows/Cygwin | GCC |
111
- | X86 | Windows/MingW | GCC |
114
+ | X86 | Windows/MinGW | GCC |
112
115
  | X86-64 | FreeBSD | GCC |
113
116
  | X86-64 | Linux | GCC |
114
117
  | X86-64 | Linux/x32 | GCC |
115
118
  | X86-64 | OpenBSD | GCC |
116
119
  | X86-64 | Solaris | Oracle Solaris Studio C |
117
120
  | X86-64 | Windows/Cygwin | GCC |
118
- | X86-64 | Windows/MingW | GCC |
121
+ | X86-64 | Windows/MinGW | GCC |
119
122
  | X86-64 | Mac OSX | GCC |
120
123
  | Xtensa | Linux | GCC |
121
124
 
@@ -137,15 +140,15 @@ install autoconf, automake and libtool.
137
140
 
138
141
  You may want to tell configure where to install the libffi library and
139
142
  header files. To do that, use the ``--prefix`` configure switch. Libffi
140
- will install under /usr/local by default.
143
+ will install under /usr/local by default.
141
144
 
142
145
  If you want to enable extra run-time debugging checks use the the
143
146
  ``--enable-debug`` configure switch. This is useful when your program dies
144
- mysteriously while using libffi.
147
+ mysteriously while using libffi.
145
148
 
146
149
  Another useful configure switch is ``--enable-purify-safety``. Using this
147
150
  will add some extra code which will suppress certain warnings when you
148
- are using Purify with libffi. Only use this switch when using
151
+ are using Purify with libffi. Only use this switch when using
149
152
  Purify, as it will slow down the library.
150
153
 
151
154
  If you don't want to build documentation, use the ``--disable-docs``
@@ -164,7 +167,7 @@ For 64-bit Windows builds, use ``CC="path/to/msvcc.sh -m64"`` and
164
167
  It is also possible to build libffi on Windows platforms with the LLVM
165
168
  project's clang-cl compiler, like below:
166
169
 
167
- path/to/configure CC="path/to/msvcc.sh -clang-cl" CXX="path/to/msvcc.sh -clang-cl" LD=link CPP="clang-cl -EP"
170
+ path/to/configure CC="path/to/msvcc.sh -clang-cl" CXX="path/to/msvcc.sh -clang-cl" LD=link CPP="clang-cl -EP"
168
171
 
169
172
  When building with MSVC under a MingW environment, you may need to
170
173
  remove the line in configure that sets 'fix_srcfile_path' to a 'cygpath'
@@ -198,14 +201,41 @@ History
198
201
 
199
202
  See the git log for details at http://github.com/libffi/libffi.
200
203
 
201
- 3.4 TBD
202
- Add support for Alibaba's CSKY architecture.
204
+ TBD - TBD
205
+ Add support for wasm32.
206
+ Add support for HPPA64, and many HPPA fixes.
207
+ Add support for ARCv3: ARC32 & ARC64.
208
+ Many x86 Darwin fixes.
209
+
210
+ 3.4.4 Oct-23-2022
211
+ Important aarch64 fixes, including support for linux builds
212
+ with Link Time Optimization (-flto).
213
+ Fix x86 stdcall stack alignment.
214
+ Fix x86 Windows msvc assembler compatibility.
215
+ Fix moxie and or1k small structure args.
216
+
217
+ 3.4.3 Sep-19-2022
218
+ All struct args are passed by value, regardless of size, as per ABIs.
219
+ Enable static trampolines for Cygwin.
220
+ Add support for Loongson's LoongArch64 architecture.
221
+ Fix x32 static trampolines.
222
+ Fix 32-bit x86 stdcall stack corruption.
223
+ Fix ILP32 aarch64 support.
224
+
225
+ 3.4.2 Jun-28-2021
226
+ Add static trampoline support for Linux on x86_64 and ARM64.
227
+ Add support for Alibaba's CSKY architecture.
228
+ Add support for Kalray's KVX architecture.
203
229
  Add support for Intel Control-flow Enforcement Technology (CET).
204
- Add support for ARM Pointer Authentication (PA).
205
- Fix 32-bit PPC regression.
206
- Fix MIPS soft-float problem.
207
-
208
- 3.3 Nov-23-19
230
+ Add support for ARM Pointer Authentication (PA).
231
+ Fix 32-bit PPC regression.
232
+ Fix MIPS soft-float problem.
233
+ Enable tmpdir override with the $LIBFFI_TMPDIR environment variable.
234
+ Enable compatibility with MSVC runtime stack checking.
235
+ Reject float and small integer argument in ffi_prep_cif_var().
236
+ Callers must promote these types themselves.
237
+
238
+ 3.3 Nov-23-2019
209
239
  Add RISC-V support.
210
240
  New API in support of GO closures.
211
241
  Add IEEE754 binary128 long double support for 64-bit Power
@@ -216,19 +246,19 @@ See the git log for details at http://github.com/libffi/libffi.
216
246
  Raw java (gcj) API deprecated.
217
247
  Add pre-built PDF documentation to source distribution.
218
248
  Many new test cases and bug fixes.
219
-
220
- 3.2.1 Nov-12-14
249
+
250
+ 3.2.1 Nov-12-2014
221
251
  Build fix for non-iOS AArch64 targets.
222
-
223
- 3.2 Nov-11-14
252
+
253
+ 3.2 Nov-11-2014
224
254
  Add C99 Complex Type support (currently only supported on
225
255
  s390).
226
256
  Add support for PASCAL and REGISTER calling conventions on x86
227
257
  Windows/Linux.
228
258
  Add OpenRISC and Cygwin-64 support.
229
259
  Bug fixes.
230
-
231
- 3.1 May-19-14
260
+
261
+ 3.1 May-19-2014
232
262
  Add AArch64 (ARM64) iOS support.
233
263
  Add Nios II support.
234
264
  Add m88k and DEC VAX support.
@@ -240,8 +270,8 @@ See the git log for details at http://github.com/libffi/libffi.
240
270
  failures, and respect the $CC and $CXX environment variables.
241
271
  Archive off the manually maintained ChangeLog in favor of git
242
272
  log.
243
-
244
- 3.0.13 Mar-17-13
273
+
274
+ 3.0.13 Mar-17-2013
245
275
  Add Meta support.
246
276
  Add missing Moxie bits.
247
277
  Fix stack alignment bug on 32-bit x86.
@@ -250,8 +280,8 @@ See the git log for details at http://github.com/libffi/libffi.
250
280
  Fix the install dir location for some platforms when building
251
281
  with GCC (OS X, Solaris).
252
282
  Fix Cygwin regression.
253
-
254
- 3.0.12 Feb-11-13
283
+
284
+ 3.0.12 Feb-11-2013
255
285
  Add Moxie support.
256
286
  Add AArch64 support.
257
287
  Add Blackfin support.
@@ -262,8 +292,8 @@ See the git log for details at http://github.com/libffi/libffi.
262
292
  Add support for native vendor compilers on
263
293
  Solaris and AIX.
264
294
  Work around LLVM/GCC interoperability issue on x86_64.
265
-
266
- 3.0.11 Apr-11-12
295
+
296
+ 3.0.11 Apr-11-2012
267
297
  Lots of build fixes.
268
298
  Add support for variadic functions (ffi_prep_cif_var).
269
299
  Add Linux/x32 support.
@@ -273,8 +303,8 @@ See the git log for details at http://github.com/libffi/libffi.
273
303
  Integration with iOS' xcode build tools.
274
304
  Fix Octeon and MC68881 support.
275
305
  Fix code pessimizations.
276
-
277
- 3.0.10 Aug-23-11
306
+
307
+ 3.0.10 Aug-23-2011
278
308
  Add support for Apple's iOS.
279
309
  Add support for ARM VFP ABI.
280
310
  Add RTEMS support for MIPS and M68K.
@@ -287,129 +317,129 @@ See the git log for details at http://github.com/libffi/libffi.
287
317
  Solaris compiler.
288
318
  Testsuite fixes for Tru64 Unix.
289
319
  Additional platform support.
290
-
291
- 3.0.9 Dec-31-09
320
+
321
+ 3.0.9 Dec-31-2009
292
322
  Add AVR32 and win64 ports. Add ARM softfp support.
293
323
  Many fixes for AIX, Solaris, HP-UX, *BSD.
294
324
  Several PowerPC and x86-64 bug fixes.
295
325
  Build DLL for windows.
296
-
297
- 3.0.8 Dec-19-08
326
+
327
+ 3.0.8 Dec-19-2008
298
328
  Add *BSD, BeOS, and PA-Linux support.
299
-
300
- 3.0.7 Nov-11-08
329
+
330
+ 3.0.7 Nov-11-2008
301
331
  Fix for ppc FreeBSD.
302
332
  (thanks to Andreas Tobler)
303
-
304
- 3.0.6 Jul-17-08
333
+
334
+ 3.0.6 Jul-17-2008
305
335
  Fix for closures on sh.
306
336
  Mark the sh/sh64 stack as non-executable.
307
337
  (both thanks to Kaz Kojima)
308
-
309
- 3.0.5 Apr-3-08
338
+
339
+ 3.0.5 Apr-3-2008
310
340
  Fix libffi.pc file.
311
341
  Fix #define ARM for IcedTea users.
312
342
  Fix x86 closure bug.
313
-
314
- 3.0.4 Feb-24-08
343
+
344
+ 3.0.4 Feb-24-2008
315
345
  Fix x86 OpenBSD configury.
316
-
317
- 3.0.3 Feb-22-08
346
+
347
+ 3.0.3 Feb-22-2008
318
348
  Enable x86 OpenBSD thanks to Thomas Heller, and
319
349
  x86-64 FreeBSD thanks to Björn König and Andreas Tobler.
320
350
  Clean up test instruction in README.
321
-
322
- 3.0.2 Feb-21-08
351
+
352
+ 3.0.2 Feb-21-2008
323
353
  Improved x86 FreeBSD support.
324
354
  Thanks to Björn König.
325
-
326
- 3.0.1 Feb-15-08
355
+
356
+ 3.0.1 Feb-15-2008
327
357
  Fix instruction cache flushing bug on MIPS.
328
358
  Thanks to David Daney.
329
-
330
- 3.0.0 Feb-15-08
359
+
360
+ 3.0.0 Feb-15-2008
331
361
  Many changes, mostly thanks to the GCC project.
332
362
  Cygnus Solutions is now Red Hat.
333
-
363
+
334
364
  [10 years go by...]
335
-
336
- 1.20 Oct-5-98
365
+
366
+ 1.20 Oct-5-1998
337
367
  Raffaele Sena produces ARM port.
338
-
339
- 1.19 Oct-5-98
368
+
369
+ 1.19 Oct-5-1998
340
370
  Fixed x86 long double and long long return support.
341
371
  m68k bug fixes from Andreas Schwab.
342
372
  Patch for DU assembler compatibility for the Alpha from Richard
343
373
  Henderson.
344
-
345
- 1.18 Apr-17-98
374
+
375
+ 1.18 Apr-17-1998
346
376
  Bug fixes and MIPS configuration changes.
347
-
348
- 1.17 Feb-24-98
377
+
378
+ 1.17 Feb-24-1998
349
379
  Bug fixes and m68k port from Andreas Schwab. PowerPC port from
350
380
  Geoffrey Keating. Various bug x86, Sparc and MIPS bug fixes.
351
-
352
- 1.16 Feb-11-98
381
+
382
+ 1.16 Feb-11-1998
353
383
  Richard Henderson produces Alpha port.
354
-
355
- 1.15 Dec-4-97
384
+
385
+ 1.15 Dec-4-1997
356
386
  Fixed an n32 ABI bug. New libtool, auto* support.
357
-
387
+
358
388
  1.14 May-13-97
359
389
  libtool is now used to generate shared and static libraries.
360
390
  Fixed a minor portability problem reported by Russ McManus
361
391
  <mcmanr@eq.gs.com>.
362
-
363
- 1.13 Dec-2-96
392
+
393
+ 1.13 Dec-2-1996
364
394
  Added --enable-purify-safety to keep Purify from complaining
365
395
  about certain low level code.
366
396
  Sparc fix for calling functions with < 6 args.
367
397
  Linux x86 a.out fix.
368
-
369
- 1.12 Nov-22-96
370
- Added missing ffi_type_void, needed for supporting void return
371
- types. Fixed test case for non MIPS machines. Cygnus Support
372
- is now Cygnus Solutions.
373
-
374
- 1.11 Oct-30-96
398
+
399
+ 1.12 Nov-22-1996
400
+ Added missing ffi_type_void, needed for supporting void return
401
+ types. Fixed test case for non MIPS machines. Cygnus Support
402
+ is now Cygnus Solutions.
403
+
404
+ 1.11 Oct-30-1996
375
405
  Added notes about GNU make.
376
-
377
- 1.10 Oct-29-96
406
+
407
+ 1.10 Oct-29-1996
378
408
  Added configuration fix for non GNU compilers.
379
-
380
- 1.09 Oct-29-96
381
- Added --enable-debug configure switch. Clean-ups based on LCLint
382
- feedback. ffi_mips.h is always installed. Many configuration
409
+
410
+ 1.09 Oct-29-1996
411
+ Added --enable-debug configure switch. Clean-ups based on LCLint
412
+ feedback. ffi_mips.h is always installed. Many configuration
383
413
  fixes. Fixed ffitest.c for sparc builds.
384
-
385
- 1.08 Oct-15-96
414
+
415
+ 1.08 Oct-15-1996
386
416
  Fixed n32 problem. Many clean-ups.
387
-
388
- 1.07 Oct-14-96
417
+
418
+ 1.07 Oct-14-1996
389
419
  Gordon Irlam rewrites v8.S again. Bug fixes.
390
-
391
- 1.06 Oct-14-96
392
- Gordon Irlam improved the sparc port.
393
-
394
- 1.05 Oct-14-96
420
+
421
+ 1.06 Oct-14-1996
422
+ Gordon Irlam improved the sparc port.
423
+
424
+ 1.05 Oct-14-1996
395
425
  Interface changes based on feedback.
396
-
397
- 1.04 Oct-11-96
426
+
427
+ 1.04 Oct-11-1996
398
428
  Sparc port complete (modulo struct passing bug).
399
-
400
- 1.03 Oct-10-96
429
+
430
+ 1.03 Oct-10-1996
401
431
  Passing struct args, and returning struct values works for
402
432
  all architectures/calling conventions. Expanded tests.
403
-
404
- 1.02 Oct-9-96
433
+
434
+ 1.02 Oct-9-1996
405
435
  Added SGI n32 support. Fixed bugs in both o32 and Linux support.
406
436
  Added "make test".
407
-
408
- 1.01 Oct-8-96
437
+
438
+ 1.01 Oct-8-1996
409
439
  Fixed float passing bug in mips version. Restructured some
410
440
  of the code. Builds cleanly with SGI tools.
411
-
412
- 1.00 Oct-7-96
441
+
442
+ 1.00 Oct-7-1996
413
443
  First release. No public announcement.
414
444
 
415
445
  Authors & Credits
@@ -437,9 +467,12 @@ developers:
437
467
  avr32 Bradley Smith
438
468
  blackfin Alexandre Keunecke I. de Mendonca
439
469
  cris Simon Posnjak, Hans-Peter Nilsson
440
- csky Ma Jun, Zhang Wenmeng
470
+ csky Ma Jun, Zhang Wenmeng
441
471
  frv Anthony Green
442
472
  ia64 Hans Boehm
473
+ kvx Yann Sionneau
474
+ loongarch64 Cheng Lulu, Xi Ruoyao, Xu Hao,
475
+ Zhang Wenlong, Pan Xuefeng
443
476
  m32r Kazuhiro Inaoka
444
477
  m68k Andreas Schwab
445
478
  m88k Miod Vallat
@@ -451,6 +484,7 @@ developers:
451
484
  nios ii Sandra Loosemore
452
485
  openrisc Sebastian Macke
453
486
  pa Randolph Chung, Dave Anglin, Andreas Tobler
487
+ pa64 Dave Anglin
454
488
  powerpc Geoffrey Keating, Andreas Tobler,
455
489
  David Edelsohn, John Hornkvist
456
490
  powerpc64 Jakub Jelinek
@@ -461,6 +495,7 @@ developers:
461
495
  sparc Anthony Green, Gordon Irlam
462
496
  tile-gx/tilepro Walter Lee
463
497
  vax Miod Vallat
498
+ wasm32 Hood Chatham, Brion Vibber, Kleis Auke Wolthuizen
464
499
  x86 Anthony Green, Jon Beniston
465
500
  x86-64 Bo Thorsen
466
501
  xtensa Chris Zankel
@@ -481,6 +516,11 @@ Alex Oliva solved the executable page problem for SElinux.
481
516
  The list above is almost certainly incomplete and inaccurate. I'm
482
517
  happy to make corrections or additions upon request.
483
518
 
484
- If you have a problem, or have found a bug, please send a note to the
485
- author at green@moxielogic.com, or the project mailing list at
486
- libffi-discuss@sourceware.org.
519
+ If you have a problem, or have found a bug, please file an issue on
520
+ our issue tracker at https://github.com/libffi/libffi/issues.
521
+
522
+ The author can be reached at green@moxielogic.com.
523
+
524
+ To subscribe/unsubscribe to our mailing lists, visit:
525
+ https://sourceware.org/mailman/listinfo/libffi-announce
526
+ https://sourceware.org/mailman/listinfo/libffi-discuss
@@ -45,16 +45,16 @@ else
45
45
 
46
46
  # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for.
47
47
  AC_CACHE_CHECK([for MAP_ANON(YMOUS)], ac_cv_decl_map_anon,
48
- [AC_TRY_COMPILE(
49
- [#include <sys/types.h>
48
+ [AC_COMPILE_IFELSE(
49
+ [AC_LANG_PROGRAM([[#include <sys/types.h>
50
50
  #include <sys/mman.h>
51
51
  #include <unistd.h>
52
52
 
53
53
  #ifndef MAP_ANONYMOUS
54
54
  #define MAP_ANONYMOUS MAP_ANON
55
55
  #endif
56
- ],
57
- [int n = MAP_ANONYMOUS;],
56
+ ]],
57
+ [[int n = MAP_ANONYMOUS;]])],
58
58
  ac_cv_decl_map_anon=yes,
59
59
  ac_cv_decl_map_anon=no)])
60
60
 
@@ -104,7 +104,7 @@ dnl See docs/html/17_intro/configury.html#enable for documentation.
104
104
  dnl
105
105
  m4_define([LIBFFI_ENABLE],[dnl
106
106
  m4_define([_g_switch],[--enable-$1])dnl
107
- m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
107
+ m4_define([_g_help],[AS_HELP_STRING([_g_switch$3],[$4 @<:@default=$2@:>@])])dnl
108
108
  AC_ARG_ENABLE($1,_g_help,
109
109
  m4_bmatch([$5],
110
110
  [^permit ],
@@ -152,109 +152,7 @@ AC_DEFUN([LIBFFI_CHECK_LINKER_FEATURES], [
152
152
  # by now (in libtool), but require it now just to be safe...
153
153
  test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
154
154
  test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
155
- AC_REQUIRE([AC_PROG_LD])
156
- AC_REQUIRE([AC_PROG_AWK])
157
-
158
- # The name set by libtool depends on the version of libtool. Shame on us
159
- # for depending on an impl detail, but c'est la vie. Older versions used
160
- # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
161
- # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
162
- # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
163
- # set (hence we're using an older libtool), then set it.
164
- if test x${with_gnu_ld+set} != xset; then
165
- if test x${ac_cv_prog_gnu_ld+set} != xset; then
166
- # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
167
- with_gnu_ld=no
168
- else
169
- with_gnu_ld=$ac_cv_prog_gnu_ld
170
- fi
171
- fi
172
-
173
- # Start by getting the version number. I think the libtool test already
174
- # does some of this, but throws away the result.
175
- libat_ld_is_gold=no
176
- if $LD --version 2>/dev/null | grep 'GNU gold'> /dev/null 2>&1; then
177
- libat_ld_is_gold=yes
178
- fi
179
- changequote(,)
180
- ldver=`$LD --version 2>/dev/null |
181
- sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
182
- changequote([,])
183
- libat_gnu_ld_version=`echo $ldver | \
184
- $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
185
-
186
- # Set --gc-sections.
187
- if test "$with_gnu_ld" = "notbroken"; then
188
- # GNU ld it is! Joy and bunny rabbits!
189
-
190
- # All these tests are for C++; save the language and the compiler flags.
191
- # Need to do this so that g++ won't try to link in libstdc++
192
- ac_test_CFLAGS="${CFLAGS+set}"
193
- ac_save_CFLAGS="$CFLAGS"
194
- CFLAGS='-x c++ -Wl,--gc-sections'
195
-
196
- # Check for -Wl,--gc-sections
197
- # XXX This test is broken at the moment, as symbols required for linking
198
- # are now in libsupc++ (not built yet). In addition, this test has
199
- # cored on solaris in the past. In addition, --gc-sections doesn't
200
- # really work at the moment (keeps on discarding used sections, first
201
- # .eh_frame and now some of the glibc sections for iconv).
202
- # Bzzzzt. Thanks for playing, maybe next time.
203
- AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
204
- AC_TRY_RUN([
205
- int main(void)
206
- {
207
- try { throw 1; }
208
- catch (...) { };
209
- return 0;
210
- }
211
- ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
212
- if test "$ac_test_CFLAGS" = set; then
213
- CFLAGS="$ac_save_CFLAGS"
214
- else
215
- # this is the suspicious part
216
- CFLAGS=''
217
- fi
218
- if test "$ac_sectionLDflags" = "yes"; then
219
- SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
220
- fi
221
- AC_MSG_RESULT($ac_sectionLDflags)
222
- fi
223
-
224
- # Set linker optimization flags.
225
- if test x"$with_gnu_ld" = x"yes"; then
226
- OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
227
- fi
228
-
229
- AC_SUBST(SECTION_LDFLAGS)
230
- AC_SUBST(OPT_LDFLAGS)
231
- ])
232
-
233
-
234
- dnl
235
- dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
236
- dnl the native linker is in use, all variables will be defined to something
237
- dnl safe (like an empty string).
238
- dnl
239
- dnl Defines:
240
- dnl SECTION_LDFLAGS='-Wl,--gc-sections' if possible
241
- dnl OPT_LDFLAGS='-Wl,-O1' if possible
242
- dnl LD (as a side effect of testing)
243
- dnl Sets:
244
- dnl with_gnu_ld
245
- dnl libat_ld_is_gold (possibly)
246
- dnl libat_gnu_ld_version (possibly)
247
- dnl
248
- dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
249
- dnl set libat_gnu_ld_version to 12345. Zeros cause problems.
250
- dnl
251
- AC_DEFUN([LIBFFI_CHECK_LINKER_FEATURES], [
252
- # If we're not using GNU ld, then there's no point in even trying these
253
- # tests. Check for that first. We should have already tested for gld
254
- # by now (in libtool), but require it now just to be safe...
255
- test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
256
- test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
257
- AC_REQUIRE([AC_PROG_LD])
155
+ AC_REQUIRE([LT_PATH_LD])
258
156
  AC_REQUIRE([AC_PROG_AWK])
259
157
 
260
158
  # The name set by libtool depends on the version of libtool. Shame on us
@@ -307,14 +205,14 @@ AC_DEFUN([LIBFFI_CHECK_LINKER_FEATURES], [
307
205
  # .eh_frame and now some of the glibc sections for iconv).
308
206
  # Bzzzzt. Thanks for playing, maybe next time.
309
207
  AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
310
- AC_TRY_RUN([
208
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
311
209
  int main(void)
312
210
  {
313
211
  try { throw 1; }
314
212
  catch (...) { };
315
213
  return 0;
316
214
  }
317
- ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
215
+ ]])],[ac_sectionLDflags=yes],[ac_sectionLDflags=no],[ac_sectionLDflags=yes])
318
216
  if test "$ac_test_CFLAGS" = set; then
319
217
  CFLAGS="$ac_save_CFLAGS"
320
218
  else
@@ -401,7 +299,7 @@ if test $enable_symvers != no; then
401
299
  AC_MSG_CHECKING([for shared libgcc])
402
300
  ac_save_CFLAGS="$CFLAGS"
403
301
  CFLAGS=' -lgcc_s'
404
- AC_TRY_LINK(, [return 0;], libat_shared_libgcc=yes, libat_shared_libgcc=no)
302
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[libat_shared_libgcc=yes],[libat_shared_libgcc=no])
405
303
  CFLAGS="$ac_save_CFLAGS"
406
304
  if test $libat_shared_libgcc = no; then
407
305
  cat > conftest.c <<EOF
@@ -416,7 +314,7 @@ changequote([,])dnl
416
314
  rm -f conftest.c conftest.so
417
315
  if test x${libat_libgcc_s_suffix+set} = xset; then
418
316
  CFLAGS=" -lgcc_s$libat_libgcc_s_suffix"
419
- AC_TRY_LINK(, [return 0;], libat_shared_libgcc=yes)
317
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[libat_shared_libgcc=yes],[])
420
318
  CFLAGS="$ac_save_CFLAGS"
421
319
  fi
422
320
  fi