ffi 1.9.18 → 1.9.21

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 (366) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -2
  3. data/Rakefile +14 -3
  4. data/ext/ffi_c/AbstractMemory.c +6 -1
  5. data/ext/ffi_c/Platform.c +10 -2
  6. data/ext/ffi_c/extconf.rb +7 -2
  7. data/ext/ffi_c/libffi.bsd.mk +9 -3
  8. data/ext/ffi_c/libffi.darwin.mk +14 -4
  9. data/ext/ffi_c/libffi.gnu.mk +2 -1
  10. data/ext/ffi_c/libffi.mk +9 -4
  11. data/ext/ffi_c/libffi/ChangeLog.libffi +2 -2
  12. data/ext/ffi_c/libffi/{ChangeLog → ChangeLog.libffi-3.1} +1402 -2
  13. data/ext/ffi_c/libffi/ChangeLog.v1 +1 -1
  14. data/ext/ffi_c/libffi/LICENSE +1 -1
  15. data/ext/ffi_c/libffi/Makefile.am +166 -157
  16. data/ext/ffi_c/libffi/README +164 -52
  17. data/ext/ffi_c/libffi/acinclude.m4 +381 -0
  18. data/ext/ffi_c/libffi/autogen.sh +2 -0
  19. data/ext/ffi_c/libffi/configure.ac +148 -256
  20. data/ext/ffi_c/libffi/configure.host +265 -4
  21. data/ext/ffi_c/libffi/doc/Makefile.am +3 -0
  22. data/ext/ffi_c/libffi/doc/libffi.texi +430 -45
  23. data/ext/ffi_c/libffi/doc/version.texi +4 -4
  24. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +207 -0
  25. data/ext/ffi_c/libffi/include/Makefile.am +3 -3
  26. data/ext/ffi_c/libffi/include/ffi.h.in +107 -50
  27. data/ext/ffi_c/libffi/include/ffi_cfi.h +55 -0
  28. data/ext/ffi_c/libffi/include/ffi_common.h +32 -11
  29. data/ext/ffi_c/libffi/libffi.map.in +80 -0
  30. data/ext/ffi_c/libffi/libffi.pc.in +3 -2
  31. data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +637 -0
  32. data/ext/ffi_c/libffi/libtool-ldflags +106 -0
  33. data/ext/ffi_c/libffi/libtool-version +1 -1
  34. data/ext/ffi_c/libffi/m4/asmcfi.m4 +13 -0
  35. data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +69 -0
  36. data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +13 -8
  37. data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +31 -104
  38. data/ext/ffi_c/libffi/m4/{ax_check_compiler_flags.m4 → ax_check_compile_flag.m4} +30 -34
  39. data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +32 -11
  40. data/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 +6 -5
  41. data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +31 -21
  42. data/ext/ffi_c/libffi/man/Makefile.am +2 -2
  43. data/ext/ffi_c/libffi/man/ffi.3 +10 -0
  44. data/ext/ffi_c/libffi/man/ffi_prep_cif.3 +6 -4
  45. data/ext/ffi_c/libffi/man/ffi_prep_cif_var.3 +73 -0
  46. data/ext/ffi_c/libffi/msvcc.sh +72 -9
  47. data/ext/ffi_c/libffi/src/aarch64/ffi.c +941 -0
  48. data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +81 -0
  49. data/ext/ffi_c/libffi/src/aarch64/internal.h +67 -0
  50. data/ext/ffi_c/libffi/src/aarch64/sysv.S +438 -0
  51. data/ext/ffi_c/libffi/src/alpha/ffi.c +335 -98
  52. data/ext/ffi_c/libffi/src/alpha/ffitarget.h +10 -1
  53. data/ext/ffi_c/libffi/src/alpha/internal.h +23 -0
  54. data/ext/ffi_c/libffi/src/alpha/osf.S +161 -266
  55. data/ext/ffi_c/libffi/src/arc/arcompact.S +135 -0
  56. data/ext/ffi_c/libffi/src/arc/ffi.c +266 -0
  57. data/ext/ffi_c/libffi/src/arc/ffitarget.h +53 -0
  58. data/ext/ffi_c/libffi/src/arm/ffi.c +597 -517
  59. data/ext/ffi_c/libffi/src/arm/ffitarget.h +24 -7
  60. data/ext/ffi_c/libffi/src/arm/internal.h +7 -0
  61. data/ext/ffi_c/libffi/src/arm/sysv.S +303 -417
  62. data/ext/ffi_c/libffi/src/avr32/ffitarget.h +6 -1
  63. data/ext/ffi_c/libffi/src/bfin/ffi.c +196 -0
  64. data/ext/ffi_c/libffi/src/bfin/ffitarget.h +43 -0
  65. data/ext/ffi_c/libffi/src/bfin/sysv.S +179 -0
  66. data/ext/ffi_c/libffi/src/closures.c +319 -44
  67. data/ext/ffi_c/libffi/src/cris/ffi.c +10 -7
  68. data/ext/ffi_c/libffi/src/cris/ffitarget.h +6 -1
  69. data/ext/ffi_c/libffi/src/debug.c +6 -1
  70. data/ext/ffi_c/libffi/src/dlmalloc.c +16 -11
  71. data/ext/ffi_c/libffi/src/frv/ffi.c +1 -1
  72. data/ext/ffi_c/libffi/src/frv/ffitarget.h +6 -1
  73. data/ext/ffi_c/libffi/src/ia64/ffi.c +11 -7
  74. data/ext/ffi_c/libffi/src/ia64/ffitarget.h +6 -1
  75. data/ext/ffi_c/libffi/src/java_raw_api.c +23 -5
  76. data/ext/ffi_c/libffi/src/m32r/ffi.c +1 -1
  77. data/ext/ffi_c/libffi/src/m32r/ffitarget.h +6 -1
  78. data/ext/ffi_c/libffi/src/m68k/ffi.c +87 -13
  79. data/ext/ffi_c/libffi/src/m68k/ffitarget.h +6 -1
  80. data/ext/ffi_c/libffi/src/m68k/sysv.S +119 -32
  81. data/ext/ffi_c/libffi/src/m88k/ffi.c +400 -0
  82. data/ext/ffi_c/libffi/src/m88k/ffitarget.h +49 -0
  83. data/ext/ffi_c/libffi/src/m88k/obsd.S +209 -0
  84. data/ext/ffi_c/libffi/src/metag/ffi.c +330 -0
  85. data/ext/ffi_c/libffi/{fficonfig.hw → src/metag/ffitarget.h} +22 -26
  86. data/ext/ffi_c/libffi/src/metag/sysv.S +311 -0
  87. data/ext/ffi_c/libffi/src/microblaze/ffi.c +321 -0
  88. data/ext/ffi_c/libffi/src/microblaze/ffitarget.h +53 -0
  89. data/ext/ffi_c/libffi/src/microblaze/sysv.S +302 -0
  90. data/ext/ffi_c/libffi/src/mips/ffi.c +95 -28
  91. data/ext/ffi_c/libffi/src/mips/ffitarget.h +9 -2
  92. data/ext/ffi_c/libffi/src/mips/n32.S +126 -56
  93. data/ext/ffi_c/libffi/src/mips/o32.S +148 -27
  94. data/ext/ffi_c/libffi/src/moxie/eabi.S +55 -82
  95. data/ext/ffi_c/libffi/src/moxie/ffi.c +40 -44
  96. data/ext/ffi_c/libffi/src/moxie/ffitarget.h +52 -0
  97. data/ext/ffi_c/libffi/src/nios2/ffi.c +304 -0
  98. data/ext/ffi_c/libffi/src/nios2/ffitarget.h +52 -0
  99. data/ext/ffi_c/libffi/src/nios2/sysv.S +136 -0
  100. data/ext/ffi_c/libffi/src/or1k/ffi.c +328 -0
  101. data/ext/ffi_c/libffi/src/or1k/ffitarget.h +58 -0
  102. data/ext/ffi_c/libffi/src/or1k/sysv.S +107 -0
  103. data/ext/ffi_c/libffi/src/pa/ffitarget.h +8 -1
  104. data/ext/ffi_c/libffi/src/powerpc/aix.S +6 -6
  105. data/ext/ffi_c/libffi/src/powerpc/aix_closure.S +3 -1
  106. data/ext/ffi_c/libffi/src/powerpc/asm.h +2 -2
  107. data/ext/ffi_c/libffi/src/powerpc/darwin.S +2 -7
  108. data/ext/ffi_c/libffi/src/powerpc/darwin_closure.S +22 -26
  109. data/ext/ffi_c/libffi/src/powerpc/ffi.c +103 -1378
  110. data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +25 -25
  111. data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +945 -0
  112. data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +94 -0
  113. data/ext/ffi_c/libffi/src/powerpc/ffi_sysv.c +923 -0
  114. data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +100 -44
  115. data/ext/ffi_c/libffi/src/powerpc/linux64.S +100 -59
  116. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +360 -108
  117. data/ext/ffi_c/libffi/src/powerpc/ppc_closure.S +138 -68
  118. data/ext/ffi_c/libffi/src/powerpc/sysv.S +68 -112
  119. data/ext/ffi_c/libffi/src/prep_cif.c +108 -24
  120. data/ext/ffi_c/libffi/src/raw_api.c +18 -5
  121. data/ext/ffi_c/libffi/src/s390/ffi.c +294 -318
  122. data/ext/ffi_c/libffi/src/s390/ffitarget.h +9 -1
  123. data/ext/ffi_c/libffi/src/s390/internal.h +11 -0
  124. data/ext/ffi_c/libffi/src/s390/sysv.S +257 -366
  125. data/ext/ffi_c/libffi/src/sh/ffi.c +4 -3
  126. data/ext/ffi_c/libffi/src/sh/ffitarget.h +6 -1
  127. data/ext/ffi_c/libffi/src/sh64/ffi.c +3 -2
  128. data/ext/ffi_c/libffi/src/sh64/ffitarget.h +6 -1
  129. data/ext/ffi_c/libffi/src/sparc/ffi.c +326 -527
  130. data/ext/ffi_c/libffi/src/sparc/ffi64.c +608 -0
  131. data/ext/ffi_c/libffi/src/sparc/ffitarget.h +20 -7
  132. data/ext/ffi_c/libffi/src/sparc/internal.h +26 -0
  133. data/ext/ffi_c/libffi/src/sparc/v8.S +364 -234
  134. data/ext/ffi_c/libffi/src/sparc/v9.S +340 -207
  135. data/ext/ffi_c/libffi/src/tile/ffi.c +355 -0
  136. data/ext/ffi_c/libffi/src/tile/ffitarget.h +65 -0
  137. data/ext/ffi_c/libffi/src/tile/tile.S +360 -0
  138. data/ext/ffi_c/libffi/src/types.c +43 -14
  139. data/ext/ffi_c/libffi/src/vax/elfbsd.S +195 -0
  140. data/ext/ffi_c/libffi/src/vax/ffi.c +276 -0
  141. data/ext/ffi_c/libffi/src/vax/ffitarget.h +49 -0
  142. data/ext/ffi_c/libffi/src/x86/asmnames.h +30 -0
  143. data/ext/ffi_c/libffi/src/x86/ffi.c +589 -500
  144. data/ext/ffi_c/libffi/src/x86/ffi64.c +338 -116
  145. data/ext/ffi_c/libffi/src/x86/ffitarget.h +55 -35
  146. data/ext/ffi_c/libffi/src/x86/ffiw64.c +287 -0
  147. data/ext/ffi_c/libffi/src/x86/internal.h +29 -0
  148. data/ext/ffi_c/libffi/src/x86/internal64.h +22 -0
  149. data/ext/ffi_c/libffi/src/x86/sysv.S +975 -400
  150. data/ext/ffi_c/libffi/src/x86/unix64.S +398 -299
  151. data/ext/ffi_c/libffi/src/x86/win64.S +222 -458
  152. data/ext/ffi_c/libffi/src/x86/win64_intel.S +237 -0
  153. data/ext/ffi_c/libffi/src/xtensa/ffi.c +298 -0
  154. data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +53 -0
  155. data/ext/ffi_c/libffi/src/xtensa/sysv.S +253 -0
  156. data/ext/ffi_c/libffi/stamp-h.in +1 -0
  157. data/ext/ffi_c/libffi/testsuite/Makefile.am +78 -73
  158. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +120 -25
  159. data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +21 -1
  160. data/ext/ffi_c/libffi/testsuite/libffi.call/align_mixed.c +46 -0
  161. data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +4 -6
  162. data/ext/ffi_c/libffi/testsuite/libffi.call/{closure_stdcall.c → closure_simple.c} +7 -16
  163. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_12byte.c +4 -4
  164. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_16byte.c +4 -4
  165. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_18byte.c +4 -4
  166. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_19byte.c +4 -4
  167. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_1_1byte.c +4 -4
  168. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte.c +4 -4
  169. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte1.c +4 -4
  170. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_24byte.c +5 -5
  171. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_2byte.c +4 -4
  172. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3_1byte.c +4 -4
  173. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte1.c +4 -4
  174. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte2.c +4 -4
  175. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_4_1byte.c +4 -4
  176. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_4byte.c +4 -4
  177. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_5_1_byte.c +4 -4
  178. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_5byte.c +4 -4
  179. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_64byte.c +5 -5
  180. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_6_1_byte.c +4 -4
  181. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_6byte.c +4 -4
  182. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_7_1_byte.c +4 -4
  183. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_7byte.c +4 -4
  184. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_8byte.c +4 -4
  185. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte1.c +4 -4
  186. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte2.c +4 -4
  187. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_double.c +4 -4
  188. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_float.c +4 -4
  189. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble.c +4 -4
  190. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split.c +4 -6
  191. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c +4 -6
  192. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_pointer.c +4 -4
  193. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint16.c +4 -4
  194. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint32.c +4 -4
  195. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint64.c +4 -4
  196. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint16.c +4 -4
  197. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint32.c +4 -4
  198. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint64.c +4 -4
  199. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_dbls_struct.c +4 -4
  200. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_double_va.c +10 -9
  201. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble.c +3 -3
  202. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble_va.c +10 -9
  203. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_many_mixed_args.c +70 -0
  204. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_many_mixed_float_double.c +55 -0
  205. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer.c +1 -1
  206. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer_stack.c +11 -9
  207. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_struct_va1.c +114 -0
  208. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar_va.c +44 -0
  209. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uint_va.c +45 -0
  210. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ulong_va.c +45 -0
  211. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ulonglong.c +5 -5
  212. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort_va.c +44 -0
  213. data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c +2 -2
  214. data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +23 -40
  215. data/ext/ffi_c/libffi/testsuite/libffi.call/float1.c +3 -1
  216. data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +6 -4
  217. data/ext/ffi_c/libffi/testsuite/libffi.call/float3.c +4 -2
  218. data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +107 -0
  219. data/ext/ffi_c/libffi/testsuite/libffi.call/huge_struct.c +18 -19
  220. data/ext/ffi_c/libffi/testsuite/libffi.call/many.c +6 -16
  221. data/ext/ffi_c/libffi/testsuite/libffi.call/many2.c +57 -0
  222. data/ext/ffi_c/libffi/testsuite/libffi.call/many_double.c +70 -0
  223. data/ext/ffi_c/libffi/testsuite/libffi.call/many_mixed.c +78 -0
  224. data/ext/ffi_c/libffi/testsuite/libffi.call/negint.c +0 -1
  225. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct.c +6 -6
  226. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct1.c +8 -8
  227. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct10.c +6 -6
  228. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct11.c +121 -0
  229. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct2.c +5 -5
  230. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct3.c +5 -5
  231. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct4.c +5 -5
  232. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct5.c +5 -5
  233. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct6.c +6 -6
  234. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct7.c +5 -5
  235. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct8.c +6 -6
  236. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct9.c +6 -6
  237. data/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c +46 -0
  238. data/ext/ffi_c/libffi/testsuite/libffi.call/pr1172638.c +127 -0
  239. data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c +1 -0
  240. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c +1 -1
  241. data/ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c +1 -1
  242. data/ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c +1 -1
  243. data/ext/ffi_c/libffi/testsuite/libffi.call/stret_large.c +7 -7
  244. data/ext/ffi_c/libffi/testsuite/libffi.call/stret_large2.c +7 -7
  245. data/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium.c +5 -5
  246. data/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium2.c +5 -5
  247. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +2 -2
  248. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +49 -0
  249. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +49 -0
  250. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +55 -0
  251. data/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c +9 -7
  252. data/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c +7 -7
  253. data/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c +7 -6
  254. data/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c +9 -8
  255. data/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c +9 -8
  256. data/ext/ffi_c/libffi/testsuite/libffi.call/struct6.c +9 -9
  257. data/ext/ffi_c/libffi/testsuite/libffi.call/struct7.c +9 -9
  258. data/ext/ffi_c/libffi/testsuite/libffi.call/struct8.c +9 -8
  259. data/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c +9 -8
  260. data/ext/ffi_c/libffi/testsuite/libffi.call/testclosure.c +2 -2
  261. data/ext/ffi_c/libffi/testsuite/libffi.call/uninitialized.c +61 -0
  262. data/ext/ffi_c/libffi/testsuite/{libffi.special → libffi.call}/unwindtest.cc +3 -10
  263. data/ext/ffi_c/libffi/testsuite/{libffi.special → libffi.call}/unwindtest_ffi_call.cc +2 -1
  264. data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +196 -0
  265. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +121 -0
  266. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +123 -0
  267. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +125 -0
  268. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex.inc +91 -0
  269. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_double.c +10 -0
  270. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_float.c +10 -0
  271. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_longdouble.c +10 -0
  272. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex.inc +42 -0
  273. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_double.c +10 -0
  274. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_float.c +10 -0
  275. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_longdouble.c +10 -0
  276. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct.inc +71 -0
  277. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_double.c +10 -0
  278. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_float.c +10 -0
  279. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_longdouble.c +10 -0
  280. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va.inc +80 -0
  281. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_double.c +10 -0
  282. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_float.c +16 -0
  283. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_longdouble.c +10 -0
  284. data/ext/ffi_c/libffi/testsuite/{libffi.special/special.exp → libffi.complex/complex.exp} +9 -8
  285. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.inc +51 -0
  286. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_double.inc +7 -0
  287. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_float.inc +7 -0
  288. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_longdouble.inc +7 -0
  289. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_double.c +10 -0
  290. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_float.c +10 -0
  291. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_int.c +86 -0
  292. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_longdouble.c +10 -0
  293. data/ext/ffi_c/libffi/testsuite/libffi.complex/ffitest.h +1 -0
  294. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex.inc +78 -0
  295. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_double.c +10 -0
  296. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_float.c +10 -0
  297. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_longdouble.c +10 -0
  298. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex.inc +37 -0
  299. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1.inc +41 -0
  300. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_double.c +10 -0
  301. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_float.c +10 -0
  302. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_longdouble.c +10 -0
  303. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc +44 -0
  304. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_double.c +10 -0
  305. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_float.c +10 -0
  306. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_longdouble.c +10 -0
  307. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_double.c +10 -0
  308. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_float.c +10 -0
  309. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_longdouble.c +10 -0
  310. data/ext/ffi_c/libffi/testsuite/libffi.go/aa-direct.c +34 -0
  311. data/ext/ffi_c/libffi/testsuite/libffi.go/closure1.c +28 -0
  312. data/ext/ffi_c/libffi/testsuite/libffi.go/ffitest.h +1 -0
  313. data/ext/ffi_c/libffi/testsuite/libffi.go/go.exp +36 -0
  314. data/ext/ffi_c/libffi/testsuite/libffi.go/static-chain.h +19 -0
  315. data/ffi.gemspec +2 -2
  316. data/lib/ffi/enum.rb +124 -0
  317. data/lib/ffi/library.rb +65 -13
  318. data/lib/ffi/platform.rb +7 -2
  319. data/lib/ffi/platform/sparc64-linux/types.conf +102 -0
  320. data/lib/ffi/platform/x86_64-windows/types.conf +113 -20
  321. data/lib/ffi/pointer.rb +1 -0
  322. data/lib/ffi/struct.rb +0 -2
  323. data/lib/ffi/version.rb +1 -1
  324. data/spec/ffi/bitmask_spec.rb +575 -0
  325. data/spec/ffi/fixtures/BitmaskTest.c +51 -0
  326. data/spec/ffi/rbx/memory_pointer_spec.rb +4 -0
  327. data/spec/ffi/struct_spec.rb +0 -4
  328. metadata +143 -51
  329. data/ext/ffi_c/libffi/Makefile.in +0 -1820
  330. data/ext/ffi_c/libffi/Makefile.vc +0 -141
  331. data/ext/ffi_c/libffi/Makefile.vc64 +0 -141
  332. data/ext/ffi_c/libffi/aclocal.m4 +0 -1873
  333. data/ext/ffi_c/libffi/build-ios.sh +0 -67
  334. data/ext/ffi_c/libffi/compile +0 -143
  335. data/ext/ffi_c/libffi/config.guess +0 -1501
  336. data/ext/ffi_c/libffi/config.sub +0 -1705
  337. data/ext/ffi_c/libffi/configure +0 -17191
  338. data/ext/ffi_c/libffi/depcomp +0 -630
  339. data/ext/ffi_c/libffi/doc/libffi.info +0 -593
  340. data/ext/ffi_c/libffi/doc/stamp-vti +0 -4
  341. data/ext/ffi_c/libffi/fficonfig.h.in +0 -199
  342. data/ext/ffi_c/libffi/include/Makefile.in +0 -487
  343. data/ext/ffi_c/libffi/include/ffi.h.vc +0 -427
  344. data/ext/ffi_c/libffi/include/ffi.h.vc64 +0 -427
  345. data/ext/ffi_c/libffi/install-sh +0 -520
  346. data/ext/ffi_c/libffi/ltmain.sh +0 -9636
  347. data/ext/ffi_c/libffi/m4/libtool.m4 +0 -7831
  348. data/ext/ffi_c/libffi/m4/ltoptions.m4 +0 -369
  349. data/ext/ffi_c/libffi/m4/ltsugar.m4 +0 -123
  350. data/ext/ffi_c/libffi/m4/ltversion.m4 +0 -23
  351. data/ext/ffi_c/libffi/m4/lt~obsolete.m4 +0 -98
  352. data/ext/ffi_c/libffi/man/Makefile.in +0 -466
  353. data/ext/ffi_c/libffi/mdate-sh +0 -201
  354. data/ext/ffi_c/libffi/missing +0 -376
  355. data/ext/ffi_c/libffi/src/arm/gentramp.sh +0 -118
  356. data/ext/ffi_c/libffi/src/arm/trampoline.S +0 -4450
  357. data/ext/ffi_c/libffi/src/x86/darwin.S +0 -444
  358. data/ext/ffi_c/libffi/src/x86/darwin64.S +0 -416
  359. data/ext/ffi_c/libffi/src/x86/freebsd.S +0 -458
  360. data/ext/ffi_c/libffi/src/x86/win32.S +0 -1065
  361. data/ext/ffi_c/libffi/testsuite/Makefile.in +0 -500
  362. data/ext/ffi_c/libffi/testsuite/lib/libffi-dg.exp +0 -300
  363. data/ext/ffi_c/libffi/testsuite/libffi.call/many_win32.c +0 -63
  364. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen_win32.c +0 -44
  365. data/ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h +0 -96
  366. data/ext/ffi_c/libffi/texinfo.tex +0 -7210
@@ -1,6 +1,7 @@
1
1
  /* -----------------------------------------------------------------*-C-*-
2
- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc.
3
- Copyright (c) 2010 CodeSourcery
2
+ ffitarget.h - Copyright (c) 2012 Anthony Green
3
+ Copyright (c) 2010 CodeSourcery
4
+ Copyright (c) 1996-2003 Red Hat, Inc.
4
5
 
5
6
  Target configuration macros for ARM.
6
7
 
@@ -29,6 +30,10 @@
29
30
  #ifndef LIBFFI_TARGET_H
30
31
  #define LIBFFI_TARGET_H
31
32
 
33
+ #ifndef LIBFFI_H
34
+ #error "Please do not include ffitarget.h directly into your source. Use ffi.h instead."
35
+ #endif
36
+
32
37
  #ifndef LIBFFI_ASM
33
38
  typedef unsigned long ffi_arg;
34
39
  typedef signed long ffi_sarg;
@@ -48,18 +53,30 @@ typedef enum ffi_abi {
48
53
 
49
54
  #define FFI_EXTRA_CIF_FIELDS \
50
55
  int vfp_used; \
51
- short vfp_reg_free, vfp_nargs; \
56
+ unsigned short vfp_reg_free, vfp_nargs; \
52
57
  signed char vfp_args[16] \
53
58
 
54
- /* Internally used. */
55
- #define FFI_TYPE_STRUCT_VFP_FLOAT (FFI_TYPE_LAST + 1)
56
- #define FFI_TYPE_STRUCT_VFP_DOUBLE (FFI_TYPE_LAST + 2)
59
+ #define FFI_TARGET_SPECIFIC_VARIADIC
60
+ #define FFI_TARGET_HAS_COMPLEX_TYPE
57
61
 
58
62
  /* ---- Definitions for closures ----------------------------------------- */
59
63
 
60
64
  #define FFI_CLOSURES 1
61
- #define FFI_TRAMPOLINE_SIZE 20
65
+ #define FFI_GO_CLOSURES 1
62
66
  #define FFI_NATIVE_RAW_API 0
63
67
 
68
+ #if defined (FFI_EXEC_TRAMPOLINE_TABLE) && FFI_EXEC_TRAMPOLINE_TABLE
69
+
70
+ #ifdef __MACH__
71
+ #define FFI_TRAMPOLINE_SIZE 12
72
+ #define FFI_TRAMPOLINE_CLOSURE_OFFSET 8
73
+ #else
74
+ #error "No trampoline table implementation"
75
+ #endif
76
+
77
+ #else
78
+ #define FFI_TRAMPOLINE_SIZE 12
79
+ #define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE
64
80
  #endif
65
81
 
82
+ #endif
@@ -0,0 +1,7 @@
1
+ #define ARM_TYPE_VFP_S 0
2
+ #define ARM_TYPE_VFP_D 1
3
+ #define ARM_TYPE_VFP_N 2
4
+ #define ARM_TYPE_INT64 3
5
+ #define ARM_TYPE_INT 4
6
+ #define ARM_TYPE_VOID 5
7
+ #define ARM_TYPE_STRUCT 6
@@ -1,8 +1,8 @@
1
1
  /* -----------------------------------------------------------------------
2
2
  sysv.S - Copyright (c) 1998, 2008, 2011 Red Hat, Inc.
3
3
  Copyright (c) 2011 Plausible Labs Cooperative, Inc.
4
-
5
- ARM Foreign Function Interface
4
+
5
+ ARM Foreign Function Interface
6
6
 
7
7
  Permission is hereby granted, free of charge, to any person obtaining
8
8
  a copy of this software and associated documentation files (the
@@ -25,472 +25,358 @@
25
25
  DEALINGS IN THE SOFTWARE.
26
26
  ----------------------------------------------------------------------- */
27
27
 
28
- #define LIBFFI_ASM
28
+ #define LIBFFI_ASM
29
29
  #include <fficonfig.h>
30
30
  #include <ffi.h>
31
- #ifdef HAVE_MACHINE_ASM_H
32
- #include <machine/asm.h>
33
- #else
34
- #ifdef __USER_LABEL_PREFIX__
35
- #define CONCAT1(a, b) CONCAT2(a, b)
36
- #define CONCAT2(a, b) a ## b
37
-
38
- /* Use the right prefix for global labels. */
39
- #define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
40
- #else
41
- #define CNAME(x) x
42
- #endif
43
- #ifdef __APPLE__
44
- #define ENTRY(x) .globl CNAME(x); CNAME(x):
45
- #else
46
- #define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x):
47
- #endif /* __APPLE__ */
48
- #endif
49
-
50
- #ifdef __ELF__
51
- #define LSYM(x) .x
52
- #else
53
- #define LSYM(x) x
54
- #endif
55
-
56
- /* Use the SOFTFP return value ABI on Mac OS X, as per the iOS ABI
57
- Function Call Guide */
58
- #ifdef __APPLE__
59
- #define __SOFTFP__
60
- #endif
61
-
62
- /* We need a better way of testing for this, but for now, this is all
63
- we can do. */
64
- @ This selects the minimum architecture level required.
65
- #define __ARM_ARCH__ 3
66
-
67
- #if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
68
- # undef __ARM_ARCH__
69
- # define __ARM_ARCH__ 4
70
- #endif
71
-
72
- #if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \
73
- || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
74
- || defined(__ARM_ARCH_5TEJ__)
75
- # undef __ARM_ARCH__
76
- # define __ARM_ARCH__ 5
77
- #endif
78
-
79
- #if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
31
+ #include <ffi_cfi.h>
32
+ #include "internal.h"
33
+
34
+ /* GCC 4.8 provides __ARM_ARCH; construct it otherwise. */
35
+ #ifndef __ARM_ARCH
36
+ # if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
37
+ || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
38
+ || defined(__ARM_ARCH_7EM__)
39
+ # define __ARM_ARCH 7
40
+ # elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
80
41
  || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \
81
42
  || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \
82
43
  || defined(__ARM_ARCH_6M__)
83
- # undef __ARM_ARCH__
84
- # define __ARM_ARCH__ 6
85
- #endif
86
-
87
- #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
88
- || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
89
- || defined(__ARM_ARCH_7EM__)
90
- # undef __ARM_ARCH__
91
- # define __ARM_ARCH__ 7
92
- #endif
93
-
94
- #if __ARM_ARCH__ >= 5
95
- # define call_reg(x) blx x
96
- #elif defined (__ARM_ARCH_4T__)
97
- # define call_reg(x) mov lr, pc ; bx x
98
- # if defined(__thumb__) || defined(__THUMB_INTERWORK__)
99
- # define __INTERWORKING__
44
+ # define __ARM_ARCH 6
45
+ # elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \
46
+ || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
47
+ || defined(__ARM_ARCH_5TEJ__)
48
+ # define __ARM_ARCH 5
49
+ # else
50
+ # define __ARM_ARCH 4
100
51
  # endif
101
- #else
102
- # define call_reg(x) mov lr, pc ; mov pc, x
103
52
  #endif
104
53
 
105
54
  /* Conditionally compile unwinder directives. */
106
55
  #ifdef __ARM_EABI__
107
- #define UNWIND
56
+ # define UNWIND(...) __VA_ARGS__
108
57
  #else
109
- #define UNWIND @
110
- #endif
58
+ # define UNWIND(...)
59
+ #endif
111
60
 
112
-
113
- #if defined(__thumb__) && !defined(__THUMB_INTERWORK__)
114
- .macro ARM_FUNC_START name
115
- .text
116
- .align 0
117
- .thumb
118
- .thumb_func
119
- #ifdef __APPLE__
120
- ENTRY($0)
121
- #else
122
- ENTRY(\name)
61
+ #if defined(HAVE_AS_CFI_PSEUDO_OP) && defined(__ARM_EABI__)
62
+ .cfi_sections .debug_frame
123
63
  #endif
124
- bx pc
125
- nop
126
- .arm
127
- UNWIND .fnstart
128
- /* A hook to tell gdb that we've switched to ARM mode. Also used to call
129
- directly from other local arm routines. */
130
- #ifdef __APPLE__
131
- _L__$0:
64
+
65
+ #define CONCAT(a, b) CONCAT2(a, b)
66
+ #define CONCAT2(a, b) a ## b
67
+
68
+ #ifdef __USER_LABEL_PREFIX__
69
+ # define CNAME(X) CONCAT (__USER_LABEL_PREFIX__, X)
132
70
  #else
133
- _L__\name:
71
+ # define CNAME(X) X
134
72
  #endif
135
- .endm
136
- #else
137
- .macro ARM_FUNC_START name
138
- .text
139
- .align 0
140
- .arm
141
- #ifdef __APPLE__
142
- ENTRY($0)
73
+ #ifdef __ELF__
74
+ # define SIZE(X) .size CNAME(X), . - CNAME(X)
75
+ # define TYPE(X, Y) .type CNAME(X), Y
143
76
  #else
144
- ENTRY(\name)
145
- #endif
146
- UNWIND .fnstart
147
- .endm
77
+ # define SIZE(X)
78
+ # define TYPE(X, Y)
148
79
  #endif
149
80
 
150
- .macro RETLDM regs=, cond=, dirn=ia
151
- #if defined (__INTERWORKING__)
152
- .ifc "\regs",""
153
- ldr\cond lr, [sp], #4
154
- .else
155
- ldm\cond\dirn sp!, {\regs, lr}
156
- .endif
157
- bx\cond lr
81
+ #define ARM_FUNC_START_LOCAL(name) \
82
+ .align 3; \
83
+ TYPE(CNAME(name), %function); \
84
+ CNAME(name):
85
+
86
+ #define ARM_FUNC_START(name) \
87
+ .globl CNAME(name); \
88
+ FFI_HIDDEN(CNAME(name)); \
89
+ ARM_FUNC_START_LOCAL(name)
90
+
91
+ #define ARM_FUNC_END(name) \
92
+ SIZE(name)
93
+
94
+ /* Aid in defining a jump table with 8 bytes between entries. */
95
+ /* ??? The clang assembler doesn't handle .if with symbolic expressions. */
96
+ #ifdef __clang__
97
+ # define E(index)
158
98
  #else
159
- .ifc "\regs",""
160
- ldr\cond pc, [sp], #4
161
- .else
162
- ldm\cond\dirn sp!, {\regs, pc}
99
+ # define E(index) \
100
+ .if . - 0b - 8*index; \
101
+ .error "type table out of sync"; \
163
102
  .endif
164
103
  #endif
165
- .endm
166
-
167
- @ r0: ffi_prep_args
168
- @ r1: &ecif
169
- @ r2: cif->bytes
170
- @ r3: fig->flags
171
- @ sp+0: ecif.rvalue
172
-
173
- @ This assumes we are using gas.
174
- ARM_FUNC_START ffi_call_SYSV
175
- @ Save registers
176
- stmfd sp!, {r0-r3, fp, lr}
177
- UNWIND .save {r0-r3, fp, lr}
178
- mov fp, sp
179
-
180
- UNWIND .setfp fp, sp
181
-
182
- @ Make room for all of the new args.
183
- sub sp, fp, r2
184
-
185
- @ Place all of the ffi_prep_args in position
186
- mov r0, sp
187
- @ r1 already set
188
-
189
- @ Call ffi_prep_args(stack, &ecif)
190
- bl ffi_prep_args
191
-
192
- @ move first 4 parameters in registers
193
- ldmia sp, {r0-r3}
194
-
195
- @ and adjust stack
196
- sub lr, fp, sp @ cif->bytes == fp - sp
197
- ldr ip, [fp] @ load fn() in advance
198
- cmp lr, #16
199
- movhs lr, #16
200
- add sp, sp, lr
201
-
202
- @ call (fn) (...)
203
- call_reg(ip)
204
-
205
- @ Remove the space we pushed for the args
206
- mov sp, fp
207
104
 
208
- @ Load r2 with the pointer to storage for the return value
209
- ldr r2, [sp, #24]
105
+ .text
106
+ .syntax unified
107
+ .arm
210
108
 
211
- @ Load r3 with the return type code
212
- ldr r3, [sp, #12]
109
+ #ifndef __clang__
110
+ /* We require interworking on LDM, which implies ARMv5T,
111
+ which implies the existance of BLX. */
112
+ .arch armv5t
113
+ #endif
213
114
 
214
- @ If the return value pointer is NULL, assume no return value.
215
- cmp r2, #0
216
- beq LSYM(Lepilogue)
115
+ /* Note that we use STC and LDC to encode VFP instructions,
116
+ so that we do not need ".fpu vfp", nor get that added to
117
+ the object file attributes. These will not be executed
118
+ unless the FFI_VFP abi is used. */
217
119
 
218
- @ return INT
219
- cmp r3, #FFI_TYPE_INT
220
- #if defined(__SOFTFP__) || defined(__ARM_EABI__)
221
- cmpne r3, #FFI_TYPE_FLOAT
222
- #endif
223
- streq r0, [r2]
224
- beq LSYM(Lepilogue)
120
+ @ r0: stack
121
+ @ r1: frame
122
+ @ r2: fn
123
+ @ r3: vfp_used
124
+
125
+ ARM_FUNC_START(ffi_call_VFP)
126
+ UNWIND(.fnstart)
127
+ cfi_startproc
225
128
 
226
- @ return INT64
227
- cmp r3, #FFI_TYPE_SINT64
228
- #if defined(__SOFTFP__) || defined(__ARM_EABI__)
229
- cmpne r3, #FFI_TYPE_DOUBLE
129
+ cmp r3, #3 @ load only d0 if possible
130
+ #ifdef __clang__
131
+ vldrle d0, [sp]
132
+ vldmgt sp, {d0-d7}
133
+ #else
134
+ ldcle p11, cr0, [r0] @ vldrle d0, [sp]
135
+ ldcgt p11, cr0, [r0], {16} @ vldmgt sp, {d0-d7}
230
136
  #endif
231
- stmeqia r2, {r0, r1}
137
+ add r0, r0, #64 @ discard the vfp register args
138
+ /* FALLTHRU */
139
+ ARM_FUNC_END(ffi_call_VFP)
140
+
141
+ ARM_FUNC_START(ffi_call_SYSV)
142
+ stm r1, {fp, lr}
143
+ mov fp, r1
144
+
145
+ @ This is a bit of a lie wrt the origin of the unwind info, but
146
+ @ now we've got the usual frame pointer and two saved registers.
147
+ UNWIND(.save {fp,lr})
148
+ UNWIND(.setfp fp, sp)
149
+ cfi_def_cfa(fp, 8)
150
+ cfi_rel_offset(fp, 0)
151
+ cfi_rel_offset(lr, 4)
152
+
153
+ mov sp, r0 @ install the stack pointer
154
+ mov lr, r2 @ move the fn pointer out of the way
155
+ ldr ip, [fp, #16] @ install the static chain
156
+ ldmia sp!, {r0-r3} @ move first 4 parameters in registers.
157
+ blx lr @ call fn
232
158
 
233
- #if !defined(__SOFTFP__) && !defined(__ARM_EABI__)
234
- beq LSYM(Lepilogue)
159
+ @ Load r2 with the pointer to storage for the return value
160
+ @ Load r3 with the return type code
161
+ ldr r2, [fp, #8]
162
+ ldr r3, [fp, #12]
235
163
 
236
- @ return FLOAT
237
- cmp r3, #FFI_TYPE_FLOAT
238
- stfeqs f0, [r2]
239
- beq LSYM(Lepilogue)
164
+ @ Deallocate the stack with the arguments.
165
+ mov sp, fp
166
+ cfi_def_cfa_register(sp)
240
167
 
241
- @ return DOUBLE or LONGDOUBLE
242
- cmp r3, #FFI_TYPE_DOUBLE
243
- stfeqd f0, [r2]
168
+ @ Store values stored in registers.
169
+ .align 3
170
+ add pc, pc, r3, lsl #3
171
+ nop
172
+ 0:
173
+ E(ARM_TYPE_VFP_S)
174
+ #ifdef __clang__
175
+ vstr s0, [r2]
176
+ #else
177
+ stc p10, cr0, [r2] @ vstr s0, [r2]
244
178
  #endif
245
-
246
- LSYM(Lepilogue):
247
- #if defined (__INTERWORKING__)
248
- ldmia sp!, {r0-r3,fp, lr}
249
- bx lr
179
+ pop {fp,pc}
180
+ E(ARM_TYPE_VFP_D)
181
+ #ifdef __clang__
182
+ vstr d0, [r2]
250
183
  #else
251
- ldmia sp!, {r0-r3,fp, pc}
184
+ stc p11, cr0, [r2] @ vstr d0, [r2]
252
185
  #endif
253
-
254
- .ffi_call_SYSV_end:
255
- UNWIND .fnend
256
- #ifdef __ELF__
257
- .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV)
186
+ pop {fp,pc}
187
+ E(ARM_TYPE_VFP_N)
188
+ #ifdef __clang__
189
+ vstm r2, {d0-d3}
190
+ #else
191
+ stc p11, cr0, [r2], {8} @ vstm r2, {d0-d3}
258
192
  #endif
193
+ pop {fp,pc}
194
+ E(ARM_TYPE_INT64)
195
+ str r1, [r2, #4]
196
+ nop
197
+ E(ARM_TYPE_INT)
198
+ str r0, [r2]
199
+ pop {fp,pc}
200
+ E(ARM_TYPE_VOID)
201
+ pop {fp,pc}
202
+ nop
203
+ E(ARM_TYPE_STRUCT)
204
+ pop {fp,pc}
205
+
206
+ cfi_endproc
207
+ UNWIND(.fnend)
208
+ ARM_FUNC_END(ffi_call_SYSV)
259
209
 
260
210
 
261
211
  /*
262
- unsigned int FFI_HIDDEN
263
- ffi_closure_SYSV_inner (closure, respp, args)
264
- ffi_closure *closure;
265
- void **respp;
266
- void *args;
212
+ int ffi_closure_inner_* (cif, fun, user_data, frame)
267
213
  */
268
214
 
269
- ARM_FUNC_START ffi_closure_SYSV
270
- UNWIND .pad #16
215
+ ARM_FUNC_START(ffi_go_closure_SYSV)
216
+ cfi_startproc
217
+ stmdb sp!, {r0-r3} @ save argument regs
218
+ cfi_adjust_cfa_offset(16)
219
+ ldr r0, [ip, #4] @ load cif
220
+ ldr r1, [ip, #8] @ load fun
221
+ mov r2, ip @ load user_data
222
+ b 0f
223
+ cfi_endproc
224
+ ARM_FUNC_END(ffi_go_closure_SYSV)
225
+
226
+ ARM_FUNC_START(ffi_closure_SYSV)
227
+ UNWIND(.fnstart)
228
+ cfi_startproc
229
+ stmdb sp!, {r0-r3} @ save argument regs
230
+ cfi_adjust_cfa_offset(16)
231
+
232
+ #if FFI_EXEC_TRAMPOLINE_TABLE
233
+ ldr ip, [ip] @ ip points to the config page, dereference to get the ffi_closure*
234
+ #endif
235
+ ldr r0, [ip, #FFI_TRAMPOLINE_CLOSURE_OFFSET] @ load cif
236
+ ldr r1, [ip, #FFI_TRAMPOLINE_CLOSURE_OFFSET+4] @ load fun
237
+ ldr r2, [ip, #FFI_TRAMPOLINE_CLOSURE_OFFSET+8] @ load user_data
238
+ 0:
239
+ add ip, sp, #16 @ compute entry sp
240
+ sub sp, sp, #64+32 @ allocate frame
241
+ cfi_adjust_cfa_offset(64+32)
242
+ stmdb sp!, {ip,lr}
243
+
244
+ /* Remember that EABI unwind info only applies at call sites.
245
+ We need do nothing except note the save of the stack pointer
246
+ and the link registers. */
247
+ UNWIND(.save {sp,lr})
248
+ cfi_adjust_cfa_offset(8)
249
+ cfi_rel_offset(lr, 4)
250
+
251
+ add r3, sp, #8 @ load frame
252
+ bl CNAME(ffi_closure_inner_SYSV)
253
+
254
+ @ Load values returned in registers.
255
+ add r2, sp, #8+64 @ load result
256
+ adr r3, CNAME(ffi_closure_ret)
257
+ add pc, r3, r0, lsl #3
258
+ cfi_endproc
259
+ UNWIND(.fnend)
260
+ ARM_FUNC_END(ffi_closure_SYSV)
261
+
262
+ ARM_FUNC_START(ffi_go_closure_VFP)
263
+ cfi_startproc
264
+ stmdb sp!, {r0-r3} @ save argument regs
265
+ cfi_adjust_cfa_offset(16)
266
+ ldr r0, [ip, #4] @ load cif
267
+ ldr r1, [ip, #8] @ load fun
268
+ mov r2, ip @ load user_data
269
+ b 0f
270
+ cfi_endproc
271
+ ARM_FUNC_END(ffi_go_closure_VFP)
272
+
273
+ ARM_FUNC_START(ffi_closure_VFP)
274
+ UNWIND(.fnstart)
275
+ cfi_startproc
276
+ stmdb sp!, {r0-r3} @ save argument regs
277
+ cfi_adjust_cfa_offset(16)
278
+
279
+ #if FFI_EXEC_TRAMPOLINE_TABLE
280
+ ldr ip, [ip] @ ip points to the config page, dereference to get the ffi_closure*
281
+ #endif
282
+ ldr r0, [ip, #FFI_TRAMPOLINE_CLOSURE_OFFSET] @ load cif
283
+ ldr r1, [ip, #FFI_TRAMPOLINE_CLOSURE_OFFSET+4] @ load fun
284
+ ldr r2, [ip, #FFI_TRAMPOLINE_CLOSURE_OFFSET+8] @ load user_data
285
+ 0:
271
286
  add ip, sp, #16
272
- stmfd sp!, {ip, lr}
273
- UNWIND .save {r0, lr}
274
- add r2, sp, #8
275
- UNWIND .pad #16
276
- sub sp, sp, #16
277
- str sp, [sp, #8]
278
- add r1, sp, #8
279
- bl CNAME(ffi_closure_SYSV_inner)
280
- cmp r0, #FFI_TYPE_INT
281
- beq .Lretint
282
-
283
- cmp r0, #FFI_TYPE_FLOAT
284
- #if defined(__SOFTFP__) || defined(__ARM_EABI__)
285
- beq .Lretint
287
+ sub sp, sp, #64+32 @ allocate frame
288
+ cfi_adjust_cfa_offset(64+32)
289
+ #ifdef __clang__
290
+ vstm sp, {d0-d7}
286
291
  #else
287
- beq .Lretfloat
292
+ stc p11, cr0, [sp], {16} @ vstm sp, {d0-d7}
288
293
  #endif
289
-
290
- cmp r0, #FFI_TYPE_DOUBLE
291
- #if defined(__SOFTFP__) || defined(__ARM_EABI__)
292
- beq .Lretlonglong
294
+ stmdb sp!, {ip,lr}
295
+
296
+ /* See above. */
297
+ UNWIND(.save {sp,lr})
298
+ cfi_adjust_cfa_offset(8)
299
+ cfi_rel_offset(lr, 4)
300
+
301
+ add r3, sp, #8 @ load frame
302
+ bl CNAME(ffi_closure_inner_VFP)
303
+
304
+ @ Load values returned in registers.
305
+ add r2, sp, #8+64 @ load result
306
+ adr r3, CNAME(ffi_closure_ret)
307
+ add pc, r3, r0, lsl #3
308
+ cfi_endproc
309
+ UNWIND(.fnend)
310
+ ARM_FUNC_END(ffi_closure_VFP)
311
+
312
+ /* Load values returned in registers for both closure entry points.
313
+ Note that we use LDM with SP in the register set. This is deprecated
314
+ by ARM, but not yet unpredictable. */
315
+
316
+ ARM_FUNC_START_LOCAL(ffi_closure_ret)
317
+ cfi_startproc
318
+ cfi_rel_offset(sp, 0)
319
+ cfi_rel_offset(lr, 4)
320
+ 0:
321
+ E(ARM_TYPE_VFP_S)
322
+ #ifdef __clang__
323
+ vldr s0, [r2]
293
324
  #else
294
- beq .Lretdouble
325
+ ldc p10, cr0, [r2] @ vldr s0, [r2]
295
326
  #endif
296
-
297
- cmp r0, #FFI_TYPE_LONGDOUBLE
298
- #if defined(__SOFTFP__) || defined(__ARM_EABI__)
299
- beq .Lretlonglong
327
+ ldm sp, {sp,pc}
328
+ E(ARM_TYPE_VFP_D)
329
+ #ifdef __clang__
330
+ vldr d0, [r2]
300
331
  #else
301
- beq .Lretlongdouble
332
+ ldc p11, cr0, [r2] @ vldr d0, [r2]
302
333
  #endif
303
-
304
- cmp r0, #FFI_TYPE_SINT64
305
- beq .Lretlonglong
306
- .Lclosure_epilogue:
307
- add sp, sp, #16
308
- ldmfd sp, {sp, pc}
309
- .Lretint:
310
- ldr r0, [sp]
311
- b .Lclosure_epilogue
312
- .Lretlonglong:
313
- ldr r0, [sp]
314
- ldr r1, [sp, #4]
315
- b .Lclosure_epilogue
316
-
317
- #if !defined(__SOFTFP__) && !defined(__ARM_EABI__)
318
- .Lretfloat:
319
- ldfs f0, [sp]
320
- b .Lclosure_epilogue
321
- .Lretdouble:
322
- ldfd f0, [sp]
323
- b .Lclosure_epilogue
324
- .Lretlongdouble:
325
- ldfd f0, [sp]
326
- b .Lclosure_epilogue
334
+ ldm sp, {sp,pc}
335
+ E(ARM_TYPE_VFP_N)
336
+ #ifdef __clang__
337
+ vldm r2, {d0-d3}
338
+ #else
339
+ ldc p11, cr0, [r2], {8} @ vldm r2, {d0-d3}
327
340
  #endif
328
-
329
- .ffi_closure_SYSV_end:
330
- UNWIND .fnend
331
- #ifdef __ELF__
332
- .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV)
341
+ ldm sp, {sp,pc}
342
+ E(ARM_TYPE_INT64)
343
+ ldr r1, [r2, #4]
344
+ nop
345
+ E(ARM_TYPE_INT)
346
+ ldr r0, [r2]
347
+ ldm sp, {sp,pc}
348
+ E(ARM_TYPE_VOID)
349
+ ldm sp, {sp,pc}
350
+ nop
351
+ E(ARM_TYPE_STRUCT)
352
+ ldm sp, {sp,pc}
353
+ cfi_endproc
354
+ ARM_FUNC_END(ffi_closure_ret)
355
+
356
+ #if FFI_EXEC_TRAMPOLINE_TABLE
357
+
358
+ #ifdef __MACH__
359
+ #include <mach/vm_param.h>
360
+
361
+ .align PAGE_MAX_SHIFT
362
+ ARM_FUNC_START(ffi_closure_trampoline_table_page)
363
+ .rept PAGE_MAX_SIZE / FFI_TRAMPOLINE_SIZE
364
+ adr ip, #-PAGE_MAX_SIZE @ the config page is PAGE_MAX_SIZE behind the trampoline page
365
+ sub ip, #8 @ account for pc bias
366
+ ldr pc, [ip, #4] @ jump to ffi_closure_SYSV or ffi_closure_VFP
367
+ .endr
368
+ ARM_FUNC_END(ffi_closure_trampoline_table_page)
333
369
  #endif
334
370
 
371
+ #else
335
372
 
336
- /* Below are VFP hard-float ABI call and closure implementations.
337
- Add VFP FPU directive here. */
338
- .fpu vfp
339
-
340
- @ r0: fn
341
- @ r1: &ecif
342
- @ r2: cif->bytes
343
- @ r3: fig->flags
344
- @ sp+0: ecif.rvalue
345
-
346
- ARM_FUNC_START ffi_call_VFP
347
- @ Save registers
348
- stmfd sp!, {r0-r3, fp, lr}
349
- UNWIND .save {r0-r3, fp, lr}
350
- mov fp, sp
351
- UNWIND .setfp fp, sp
352
-
353
- @ Make room for all of the new args.
354
- sub sp, sp, r2
355
-
356
- @ Make room for loading VFP args
357
- sub sp, sp, #64
358
-
359
- @ Place all of the ffi_prep_args in position
360
- mov r0, sp
361
- @ r1 already set
362
- sub r2, fp, #64 @ VFP scratch space
363
-
364
- @ Call ffi_prep_args(stack, &ecif, vfp_space)
365
- bl ffi_prep_args
366
-
367
- @ Load VFP register args if needed
368
- cmp r0, #0
369
- beq LSYM(Lbase_args)
370
-
371
- @ Load only d0 if possible
372
- cmp r0, #3
373
- sub ip, fp, #64
374
- flddle d0, [ip]
375
- fldmiadgt ip, {d0-d7}
376
-
377
- LSYM(Lbase_args):
378
- @ move first 4 parameters in registers
379
- ldmia sp, {r0-r3}
380
-
381
- @ and adjust stack
382
- sub lr, ip, sp @ cif->bytes == (fp - 64) - sp
383
- ldr ip, [fp] @ load fn() in advance
384
- cmp lr, #16
385
- movhs lr, #16
386
- add sp, sp, lr
387
-
388
- @ call (fn) (...)
389
- call_reg(ip)
390
-
391
- @ Remove the space we pushed for the args
392
- mov sp, fp
373
+ ARM_FUNC_START(ffi_arm_trampoline)
374
+ 0: adr ip, 0b
375
+ ldr pc, 1f
376
+ 1: .long 0
377
+ ARM_FUNC_END(ffi_arm_trampoline)
393
378
 
394
- @ Load r2 with the pointer to storage for
395
- @ the return value
396
- ldr r2, [sp, #24]
397
-
398
- @ Load r3 with the return type code
399
- ldr r3, [sp, #12]
400
-
401
- @ If the return value pointer is NULL,
402
- @ assume no return value.
403
- cmp r2, #0
404
- beq LSYM(Lepilogue_vfp)
405
-
406
- cmp r3, #FFI_TYPE_INT
407
- streq r0, [r2]
408
- beq LSYM(Lepilogue_vfp)
409
-
410
- cmp r3, #FFI_TYPE_SINT64
411
- stmeqia r2, {r0, r1}
412
- beq LSYM(Lepilogue_vfp)
413
-
414
- cmp r3, #FFI_TYPE_FLOAT
415
- fstseq s0, [r2]
416
- beq LSYM(Lepilogue_vfp)
417
-
418
- cmp r3, #FFI_TYPE_DOUBLE
419
- fstdeq d0, [r2]
420
- beq LSYM(Lepilogue_vfp)
421
-
422
- cmp r3, #FFI_TYPE_STRUCT_VFP_FLOAT
423
- cmpne r3, #FFI_TYPE_STRUCT_VFP_DOUBLE
424
- fstmiadeq r2, {d0-d3}
425
-
426
- LSYM(Lepilogue_vfp):
427
- RETLDM "r0-r3,fp"
428
-
429
- .ffi_call_VFP_end:
430
- UNWIND .fnend
431
- .size CNAME(ffi_call_VFP),.ffi_call_VFP_end-CNAME(ffi_call_VFP)
432
-
433
-
434
- ARM_FUNC_START ffi_closure_VFP
435
- fstmfdd sp!, {d0-d7}
436
- @ r0-r3, then d0-d7
437
- UNWIND .pad #80
438
- add ip, sp, #80
439
- stmfd sp!, {ip, lr}
440
- UNWIND .save {r0, lr}
441
- add r2, sp, #72
442
- add r3, sp, #8
443
- UNWIND .pad #72
444
- sub sp, sp, #72
445
- str sp, [sp, #64]
446
- add r1, sp, #64
447
- bl ffi_closure_SYSV_inner
448
-
449
- cmp r0, #FFI_TYPE_INT
450
- beq .Lretint_vfp
451
-
452
- cmp r0, #FFI_TYPE_FLOAT
453
- beq .Lretfloat_vfp
454
-
455
- cmp r0, #FFI_TYPE_DOUBLE
456
- cmpne r0, #FFI_TYPE_LONGDOUBLE
457
- beq .Lretdouble_vfp
458
-
459
- cmp r0, #FFI_TYPE_SINT64
460
- beq .Lretlonglong_vfp
461
-
462
- cmp r0, #FFI_TYPE_STRUCT_VFP_FLOAT
463
- beq .Lretfloat_struct_vfp
464
-
465
- cmp r0, #FFI_TYPE_STRUCT_VFP_DOUBLE
466
- beq .Lretdouble_struct_vfp
467
-
468
- .Lclosure_epilogue_vfp:
469
- add sp, sp, #72
470
- ldmfd sp, {sp, pc}
471
-
472
- .Lretfloat_vfp:
473
- flds s0, [sp]
474
- b .Lclosure_epilogue_vfp
475
- .Lretdouble_vfp:
476
- fldd d0, [sp]
477
- b .Lclosure_epilogue_vfp
478
- .Lretint_vfp:
479
- ldr r0, [sp]
480
- b .Lclosure_epilogue_vfp
481
- .Lretlonglong_vfp:
482
- ldmia sp, {r0, r1}
483
- b .Lclosure_epilogue_vfp
484
- .Lretfloat_struct_vfp:
485
- fldmiad sp, {d0-d1}
486
- b .Lclosure_epilogue_vfp
487
- .Lretdouble_struct_vfp:
488
- fldmiad sp, {d0-d3}
489
- b .Lclosure_epilogue_vfp
490
-
491
- .ffi_closure_VFP_end:
492
- UNWIND .fnend
493
- .size CNAME(ffi_closure_VFP),.ffi_closure_VFP_end-CNAME(ffi_closure_VFP)
379
+ #endif /* FFI_EXEC_TRAMPOLINE_TABLE */
494
380
 
495
381
  #if defined __ELF__ && defined __linux__
496
382
  .section .note.GNU-stack,"",%progbits