ffi 1.11.3 → 1.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -0
  3. data/CHANGELOG.md +27 -0
  4. data/Gemfile +2 -2
  5. data/README.md +10 -1
  6. data/ext/ffi_c/Struct.c +47 -51
  7. data/ext/ffi_c/Struct.h +12 -6
  8. data/ext/ffi_c/StructLayout.c +13 -12
  9. data/ext/ffi_c/extconf.rb +0 -1
  10. data/ext/ffi_c/libffi/.travis.yml +28 -12
  11. data/ext/ffi_c/libffi/.travis/bfin-sim.exp +58 -0
  12. data/ext/ffi_c/libffi/.travis/build-cross-in-container.sh +14 -0
  13. data/ext/ffi_c/libffi/.travis/build-in-container.sh +2 -12
  14. data/ext/ffi_c/libffi/.travis/build.sh +58 -30
  15. data/ext/ffi_c/libffi/.travis/install.sh +65 -37
  16. data/ext/ffi_c/libffi/.travis/m32r-sim.exp +58 -0
  17. data/ext/ffi_c/libffi/.travis/or1k-sim.exp +58 -0
  18. data/ext/ffi_c/libffi/.travis/powerpc-eabisim.exp +58 -0
  19. data/ext/ffi_c/libffi/.travis/site.exp +10 -1
  20. data/ext/ffi_c/libffi/.travis/wine-sim.exp +55 -0
  21. data/ext/ffi_c/libffi/{ChangeLog.libffi-3.1 → ChangeLog.old} +1407 -0
  22. data/ext/ffi_c/libffi/LICENSE +1 -1
  23. data/ext/ffi_c/libffi/Makefile.am +4 -3
  24. data/ext/ffi_c/libffi/README.md +12 -6
  25. data/ext/ffi_c/libffi/configure.ac +1 -1
  26. data/ext/ffi_c/libffi/configure.host +5 -2
  27. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +1 -3
  28. data/ext/ffi_c/libffi/include/ffi.h.in +7 -7
  29. data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +2 -48
  30. data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +5 -26
  31. data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +5 -26
  32. data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +2 -1
  33. data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +5 -26
  34. data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +7 -3
  35. data/ext/ffi_c/libffi/src/closures.c +10 -2
  36. data/ext/ffi_c/libffi/src/mips/o32.S +2 -0
  37. data/ext/ffi_c/libffi/src/powerpc/ffi.c +3 -2
  38. data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +154 -8
  39. data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +18 -7
  40. data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +10 -4
  41. data/ext/ffi_c/libffi/src/powerpc/linux64.S +83 -28
  42. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +67 -3
  43. data/ext/ffi_c/libffi/testsuite/Makefile.am +78 -75
  44. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +1 -18
  45. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +7 -2
  46. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +1 -1
  47. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +1 -1
  48. data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +12 -1
  49. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure.exp +67 -0
  50. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn0.c +0 -0
  51. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn1.c +0 -0
  52. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn2.c +0 -0
  53. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn3.c +0 -0
  54. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn4.c +0 -0
  55. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn5.c +0 -0
  56. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn6.c +0 -0
  57. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_loc_fn0.c +0 -0
  58. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_simple.c +0 -0
  59. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_12byte.c +0 -0
  60. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_16byte.c +0 -0
  61. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_18byte.c +0 -0
  62. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_19byte.c +0 -0
  63. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_1_1byte.c +0 -0
  64. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte.c +0 -0
  65. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte1.c +0 -0
  66. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_24byte.c +0 -0
  67. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_2byte.c +0 -0
  68. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3_1byte.c +0 -0
  69. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte1.c +0 -0
  70. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte2.c +0 -0
  71. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3float.c +0 -0
  72. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4_1byte.c +0 -0
  73. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4byte.c +0 -0
  74. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5_1_byte.c +0 -0
  75. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5byte.c +0 -0
  76. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_64byte.c +0 -0
  77. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6_1_byte.c +0 -0
  78. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6byte.c +0 -0
  79. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7_1_byte.c +0 -0
  80. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7byte.c +0 -0
  81. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_8byte.c +0 -0
  82. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte1.c +0 -0
  83. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte2.c +0 -0
  84. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_double.c +0 -0
  85. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_float.c +0 -0
  86. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble.c +0 -0
  87. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split.c +0 -0
  88. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split2.c +0 -0
  89. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_pointer.c +0 -0
  90. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint16.c +0 -0
  91. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint32.c +0 -0
  92. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint64.c +0 -0
  93. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint16.c +0 -0
  94. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint32.c +0 -0
  95. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint64.c +0 -0
  96. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_dbls_struct.c +0 -0
  97. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double.c +0 -0
  98. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double_va.c +0 -0
  99. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_float.c +0 -0
  100. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble.c +0 -0
  101. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble_va.c +0 -0
  102. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_many_mixed_args.c +0 -0
  103. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_many_mixed_float_double.c +0 -0
  104. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_schar.c +0 -0
  105. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshort.c +0 -0
  106. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshortchar.c +0 -0
  107. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_uchar.c +0 -0
  108. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushort.c +0 -0
  109. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushortchar.c +0 -0
  110. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer.c +0 -0
  111. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer_stack.c +0 -0
  112. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_schar.c +0 -0
  113. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sint.c +0 -0
  114. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sshort.c +0 -0
  115. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_struct_va1.c +0 -0
  116. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uchar.c +0 -0
  117. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uchar_va.c +0 -0
  118. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint.c +0 -0
  119. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint_va.c +0 -0
  120. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulong_va.c +0 -0
  121. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulonglong.c +0 -0
  122. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort.c +0 -0
  123. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort_va.c +0 -0
  124. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/err_bad_abi.c +0 -0
  125. data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +138 -0
  126. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/huge_struct.c +1 -1
  127. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct.c +0 -0
  128. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct1.c +0 -0
  129. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct10.c +0 -0
  130. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct11.c +0 -0
  131. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct2.c +0 -0
  132. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct3.c +0 -0
  133. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct4.c +0 -0
  134. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct5.c +0 -0
  135. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct6.c +0 -0
  136. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct7.c +0 -0
  137. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct8.c +0 -0
  138. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct9.c +0 -0
  139. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/problem1.c +0 -0
  140. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large.c +0 -0
  141. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large2.c +0 -0
  142. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium.c +0 -0
  143. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium2.c +0 -0
  144. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/testclosure.c +0 -0
  145. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest.cc +0 -0
  146. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest_ffi_call.cc +0 -0
  147. data/ffi.gemspec +2 -2
  148. data/lib/ffi/ffi.rb +1 -0
  149. data/lib/ffi/struct.rb +2 -3
  150. data/lib/ffi/version.rb +1 -1
  151. metadata +112 -108
  152. data/ext/ffi_c/libffi/ChangeLog.libffi +0 -584
  153. data/ext/ffi_c/libffi/ChangeLog.libgcj +0 -40
  154. data/ext/ffi_c/libffi/ChangeLog.v1 +0 -764
@@ -29,33 +29,12 @@
29
29
  # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
30
30
  # Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
31
31
  #
32
- # This program is free software: you can redistribute it and/or modify it
33
- # under the terms of the GNU General Public License as published by the
34
- # Free Software Foundation, either version 3 of the License, or (at your
35
- # option) any later version.
36
- #
37
- # This program is distributed in the hope that it will be useful, but
38
- # WITHOUT ANY WARRANTY; without even the implied warranty of
39
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
40
- # Public License for more details.
41
- #
42
- # You should have received a copy of the GNU General Public License along
43
- # with this program. If not, see <https://www.gnu.org/licenses/>.
44
- #
45
- # As a special exception, the respective Autoconf Macro's copyright owner
46
- # gives unlimited permission to copy, distribute and modify the configure
47
- # scripts that are the output of Autoconf when processing the Macro. You
48
- # need not follow the terms of the GNU General Public License when using
49
- # or distributing such scripts, even though portions of the text of the
50
- # Macro appear in them. The GNU General Public License (GPL) does govern
51
- # all other use of the material that constitutes the Autoconf Macro.
52
- #
53
- # This special exception to the GPL applies to versions of the Autoconf
54
- # Macro released by the Autoconf Archive. When you make and distribute a
55
- # modified version of the Autoconf Macro, you may extend this special
56
- # exception to the GPL to apply to your modified version as well.
32
+ # Copying and distribution of this file, with or without modification, are
33
+ # permitted in any medium without royalty provided the copyright notice
34
+ # and this notice are preserved. This file is offered as-is, without any
35
+ # warranty.
57
36
 
58
- #serial 5
37
+ #serial 6
59
38
 
60
39
  AC_DEFUN([AX_CHECK_COMPILE_FLAG],
61
40
  [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
@@ -44,7 +44,7 @@
44
44
  # modified version of the Autoconf Macro, you may extend this special
45
45
  # exception to the GPL to apply to your modified version as well.
46
46
 
47
- #serial 16
47
+ #serial 17
48
48
 
49
49
  AC_DEFUN([AX_COMPILER_VENDOR],
50
50
  [AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
@@ -56,6 +56,7 @@ AC_DEFUN([AX_COMPILER_VENDOR],
56
56
  clang: __clang__
57
57
  cray: _CRAYC
58
58
  fujitsu: __FUJITSU
59
+ sdcc: SDCC, __SDCC
59
60
  gnu: __GNUC__
60
61
  sun: __SUNPRO_C,__SUNPRO_CC
61
62
  hp: __HP_cc,__HP_aCC
@@ -31,33 +31,12 @@
31
31
  #
32
32
  # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
33
33
  #
34
- # This program is free software; you can redistribute it and/or modify it
35
- # under the terms of the GNU General Public License as published by the
36
- # Free Software Foundation; either version 3 of the License, or (at your
37
- # option) any later version.
38
- #
39
- # This program is distributed in the hope that it will be useful, but
40
- # WITHOUT ANY WARRANTY; without even the implied warranty of
41
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
42
- # Public License for more details.
43
- #
44
- # You should have received a copy of the GNU General Public License along
45
- # with this program. If not, see <https://www.gnu.org/licenses/>.
46
- #
47
- # As a special exception, the respective Autoconf Macro's copyright owner
48
- # gives unlimited permission to copy, distribute and modify the configure
49
- # scripts that are the output of Autoconf when processing the Macro. You
50
- # need not follow the terms of the GNU General Public License when using
51
- # or distributing such scripts, even though portions of the text of the
52
- # Macro appear in them. The GNU General Public License (GPL) does govern
53
- # all other use of the material that constitutes the Autoconf Macro.
54
- #
55
- # This special exception to the GPL applies to versions of the Autoconf
56
- # Macro released by the Autoconf Archive. When you make and distribute a
57
- # modified version of the Autoconf Macro, you may extend this special
58
- # exception to the GPL to apply to your modified version as well.
34
+ # Copying and distribution of this file, with or without modification, are
35
+ # permitted in any medium without royalty provided the copyright notice
36
+ # and this notice are preserved. This file is offered as-is, without any
37
+ # warranty.
59
38
 
60
- #serial 13
39
+ #serial 14
61
40
 
62
41
  AC_DEFUN([AX_CONFIGURE_ARGS],[
63
42
  # [$]@ is unusable in 2.60+ but earlier autoconf had no ac_configure_args
@@ -37,7 +37,7 @@
37
37
  # Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
38
38
  # Copyright (c) 2008 Matteo Frigo
39
39
  # Copyright (c) 2014 Tsukasa Oi
40
- # Copyright (c) 2017 Alexey Kopytov
40
+ # Copyright (c) 2017-2018 Alexey Kopytov
41
41
  #
42
42
  # This program is free software: you can redistribute it and/or modify it
43
43
  # under the terms of the GNU General Public License as published by the
@@ -65,7 +65,7 @@
65
65
  # modified version of the Autoconf Macro, you may extend this special
66
66
  # exception to the GPL to apply to your modified version as well.
67
67
 
68
- #serial 20
68
+ #serial 22
69
69
 
70
70
  AC_DEFUN([AX_GCC_ARCHFLAG],
71
71
  [AC_REQUIRE([AC_PROG_CC])
@@ -108,7 +108,7 @@ case $host_cpu in
108
108
  *2?6[[ad]]?:*:*:*) ax_gcc_arch="sandybridge corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;;
109
109
  *3?6[[ae]]?:*:*:*) ax_gcc_arch="ivybridge core-avx-i corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;;
110
110
  *3?6[[cf]]?:*:*:*|*4?6[[56]]?:*:*:*) ax_gcc_arch="haswell core-avx2 core-avx-i corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;;
111
- *3?6d?:*:*:*) ax_gcc_arch="broadwell core-avx2 core-avx-i corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;;
111
+ *3?6d?:*:*:*|*4?6[[7f]]?:*:*:*|*5?66?:*:*:*) ax_gcc_arch="broadwell core-avx2 core-avx-i corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;;
112
112
  *1?6c?:*:*:*|*2?6[[67]]?:*:*:*|*3?6[[56]]?:*:*:*) ax_gcc_arch="bonnell atom core2 pentium-m pentium3 pentiumpro" ;;
113
113
  *3?67?:*:*:*|*[[45]]?6[[ad]]?:*:*:*) ax_gcc_arch="silvermont atom core2 pentium-m pentium3 pentiumpro" ;;
114
114
  *000?f[[012]]?:*:*:*|?f[[012]]?:*:*:*|f[[012]]?:*:*:*) ax_gcc_arch="pentium4 pentiumpro" ;;
@@ -198,6 +198,10 @@ case $host_cpu in
198
198
  *POWER4*|*power4*|*gq*) ax_gcc_arch="power4 970";;
199
199
  *POWER5*|*power5*|*gr*|*gs*) ax_gcc_arch="power5 power4 970";;
200
200
  603ev|8240) ax_gcc_arch="$cputype 603e 603";;
201
+ *POWER7*) ax_gcc_arch="power7";;
202
+ *POWER8*) ax_gcc_arch="power8";;
203
+ *POWER9*) ax_gcc_arch="power9";;
204
+ *POWER10*) ax_gcc_arch="power10";;
201
205
  *) ax_gcc_arch=$cputype ;;
202
206
  esac
203
207
  ax_gcc_arch="$ax_gcc_arch powerpc"
@@ -1,5 +1,6 @@
1
1
  /* -----------------------------------------------------------------------
2
- closures.c - Copyright (c) 2007, 2009, 2010 Red Hat, Inc.
2
+ closures.c - Copyright (c) 2019 Anthony Green
3
+ Copyright (c) 2007, 2009, 2010 Red Hat, Inc.
3
4
  Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc
4
5
  Copyright (c) 2011 Plausible Labs Cooperative, Inc.
5
6
 
@@ -936,7 +937,14 @@ void *
936
937
  ffi_data_to_code_pointer (void *data)
937
938
  {
938
939
  msegmentptr seg = segment_holding (gm, data);
939
- return add_segment_exec_offset (data, seg);
940
+ /* We expect closures to be allocated with ffi_closure_alloc(), in
941
+ which case seg will be non-NULL. However, some users take on the
942
+ burden of managing this memory themselves, in which case this
943
+ we'll just return data. */
944
+ if (seg)
945
+ return add_segment_exec_offset (data, seg);
946
+ else
947
+ return data;
940
948
  }
941
949
 
942
950
  /* Release a chunk of memory allocated with ffi_closure_alloc. If
@@ -282,9 +282,11 @@ $LCFI12:
282
282
  li $13, 1 # FFI_O32
283
283
  bne $16, $13, 1f # Skip fp save if FFI_O32_SOFT_FLOAT
284
284
 
285
+ #ifndef __mips_soft_float
285
286
  # Store all possible float/double registers.
286
287
  s.d $f12, FA_0_0_OFF2($fp)
287
288
  s.d $f14, FA_1_0_OFF2($fp)
289
+ #endif
288
290
  1:
289
291
  # prepare arguments for ffi_closure_mips_inner_O32
290
292
  REG_L a0, 4($15) # cif
@@ -85,8 +85,9 @@ ffi_call_int (ffi_cif *cif,
85
85
  can write r3 and r4 to memory without worrying about struct size.
86
86
 
87
87
  For ELFv2 ABI, use a bounce buffer for homogeneous structs too,
88
- for similar reasons. */
89
- unsigned long smst_buffer[8];
88
+ for similar reasons. This bounce buffer must be aligned to 16
89
+ bytes for use with homogeneous structs of vectors (float128). */
90
+ float128 smst_buffer[8];
90
91
  extended_cif ecif;
91
92
 
92
93
  ecif.cif = cif;
@@ -38,7 +38,8 @@
38
38
  /* About the LINUX64 ABI. */
39
39
  enum {
40
40
  NUM_GPR_ARG_REGISTERS64 = 8,
41
- NUM_FPR_ARG_REGISTERS64 = 13
41
+ NUM_FPR_ARG_REGISTERS64 = 13,
42
+ NUM_VEC_ARG_REGISTERS64 = 12,
42
43
  };
43
44
  enum { ASM_NEEDS_REGISTERS64 = 4 };
44
45
 
@@ -81,11 +82,12 @@ discover_homogeneous_aggregate (ffi_abi abi,
81
82
  of FPRs, but according to the ABI must be considered
82
83
  distinct from doubles. They are also limited to a
83
84
  maximum of four members in a homogeneous aggregate. */
84
- else
85
+ else if ((abi & FFI_LINUX_LONG_DOUBLE_IEEE128) == 0)
85
86
  {
86
87
  *elnum = 2;
87
88
  return FFI_TYPE_LONGDOUBLE;
88
89
  }
90
+ /* Fall through. */
89
91
  #endif
90
92
  case FFI_TYPE_FLOAT:
91
93
  case FFI_TYPE_DOUBLE:
@@ -130,13 +132,23 @@ ffi_prep_cif_linux64_core (ffi_cif *cif)
130
132
  {
131
133
  ffi_type **ptr;
132
134
  unsigned bytes;
133
- unsigned i, fparg_count = 0, intarg_count = 0;
135
+ unsigned i, fparg_count = 0, intarg_count = 0, vecarg_count = 0;
134
136
  unsigned flags = cif->flags;
135
137
  unsigned elt, elnum, rtype;
136
138
 
137
139
  #if FFI_TYPE_LONGDOUBLE == FFI_TYPE_DOUBLE
138
- /* If compiled without long double support.. */
139
- if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
140
+ /* If compiled without long double support... */
141
+ if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0 ||
142
+ (cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
143
+ return FFI_BAD_ABI;
144
+ #elif !defined(__VEC__)
145
+ /* If compiled without vector register support (used by assembly)... */
146
+ if ((cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
147
+ return FFI_BAD_ABI;
148
+ #else
149
+ /* If the IEEE128 flag is set, but long double is only 64 bits wide... */
150
+ if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) == 0 &&
151
+ (cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
140
152
  return FFI_BAD_ABI;
141
153
  #endif
142
154
 
@@ -166,6 +178,11 @@ homogeneous:
166
178
  {
167
179
  #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
168
180
  case FFI_TYPE_LONGDOUBLE:
181
+ if ((cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
182
+ {
183
+ flags |= FLAG_RETURNS_VEC;
184
+ break;
185
+ }
169
186
  if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
170
187
  flags |= FLAG_RETURNS_128BITS;
171
188
  /* Fall through. */
@@ -221,6 +238,15 @@ homogeneous:
221
238
  {
222
239
  #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
223
240
  case FFI_TYPE_LONGDOUBLE:
241
+ if ((cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
242
+ {
243
+ vecarg_count++;
244
+ /* Align to 16 bytes, plus the 16-byte argument. */
245
+ intarg_count = (intarg_count + 3) & ~0x1;
246
+ if (vecarg_count > NUM_VEC_ARG_REGISTERS64)
247
+ flags |= FLAG_ARG_NEEDS_PSAVE;
248
+ break;
249
+ }
224
250
  if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
225
251
  {
226
252
  fparg_count++;
@@ -248,6 +274,17 @@ homogeneous:
248
274
  }
249
275
  intarg_count += ((*ptr)->size + 7) / 8;
250
276
  elt = discover_homogeneous_aggregate (cif->abi, *ptr, &elnum);
277
+ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
278
+ if (elt == FFI_TYPE_LONGDOUBLE &&
279
+ (cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
280
+ {
281
+ vecarg_count += elnum;
282
+ if (vecarg_count > NUM_VEC_ARG_REGISTERS64)
283
+ flags |= FLAG_ARG_NEEDS_PSAVE;
284
+ break;
285
+ }
286
+ else
287
+ #endif
251
288
  if (elt)
252
289
  {
253
290
  fparg_count += elnum;
@@ -286,10 +323,17 @@ homogeneous:
286
323
  flags |= FLAG_FP_ARGUMENTS;
287
324
  if (intarg_count > 4)
288
325
  flags |= FLAG_4_GPR_ARGUMENTS;
326
+ if (vecarg_count != 0)
327
+ flags |= FLAG_VEC_ARGUMENTS;
289
328
 
290
329
  /* Space for the FPR registers, if needed. */
291
330
  if (fparg_count != 0)
292
331
  bytes += NUM_FPR_ARG_REGISTERS64 * sizeof (double);
332
+ /* Space for the vector registers, if needed, aligned to 16 bytes. */
333
+ if (vecarg_count != 0) {
334
+ bytes = (bytes + 15) & ~0xF;
335
+ bytes += NUM_VEC_ARG_REGISTERS64 * sizeof (float128);
336
+ }
293
337
 
294
338
  /* Stack space. */
295
339
  #if _CALL_ELF == 2
@@ -372,6 +416,8 @@ ffi_prep_cif_linux64_var (ffi_cif *cif,
372
416
  |--------------------------------------------| |
373
417
  | FPR registers f1-f13 (optional) 13*8 | |
374
418
  |--------------------------------------------| |
419
+ | VEC registers v2-v13 (optional) 12*16 | |
420
+ |--------------------------------------------| |
375
421
  | Parameter save area | |
376
422
  |--------------------------------------------| |
377
423
  | TOC save area 8 | |
@@ -401,6 +447,7 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
401
447
  unsigned long *ul;
402
448
  float *f;
403
449
  double *d;
450
+ float128 *f128;
404
451
  size_t p;
405
452
  } valp;
406
453
 
@@ -419,6 +466,11 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
419
466
  valp fpr_base;
420
467
  unsigned int fparg_count;
421
468
 
469
+ /* 'vec_base' points at the space for v2, and grows upwards as
470
+ we use vector registers. */
471
+ valp vec_base;
472
+ unsigned int vecarg_count;
473
+
422
474
  unsigned int i, words, nargs, nfixedargs;
423
475
  ffi_type **ptr;
424
476
  double double_tmp;
@@ -435,6 +487,7 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
435
487
  unsigned long **ul;
436
488
  float **f;
437
489
  double **d;
490
+ float128 **f128;
438
491
  } p_argv;
439
492
  unsigned long gprvalue;
440
493
  unsigned long align;
@@ -449,11 +502,21 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
449
502
  #endif
450
503
  fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS64;
451
504
  fparg_count = 0;
505
+ /* Place the vector args below the FPRs, if used, else the GPRs. */
506
+ if (ecif->cif->flags & FLAG_FP_ARGUMENTS)
507
+ vec_base.p = fpr_base.p & ~0xF;
508
+ else
509
+ vec_base.p = gpr_base.p;
510
+ vec_base.f128 -= NUM_VEC_ARG_REGISTERS64;
511
+ vecarg_count = 0;
452
512
  next_arg.ul = gpr_base.ul;
453
513
 
454
514
  /* Check that everything starts aligned properly. */
455
515
  FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0);
456
516
  FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0);
517
+ FFI_ASSERT (((unsigned long) gpr_base.c & 0xF) == 0);
518
+ FFI_ASSERT (((unsigned long) gpr_end.c & 0xF) == 0);
519
+ FFI_ASSERT (((unsigned long) vec_base.c & 0xF) == 0);
457
520
  FFI_ASSERT ((bytes & 0xF) == 0);
458
521
 
459
522
  /* Deal with return values that are actually pass-by-reference. */
@@ -478,6 +541,22 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
478
541
  {
479
542
  #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
480
543
  case FFI_TYPE_LONGDOUBLE:
544
+ if ((ecif->cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
545
+ {
546
+ next_arg.p = FFI_ALIGN (next_arg.p, 16);
547
+ if (next_arg.ul == gpr_end.ul)
548
+ next_arg.ul = rest.ul;
549
+ if (vecarg_count < NUM_VEC_ARG_REGISTERS64 && i < nfixedargs)
550
+ memcpy (vec_base.f128++, *p_argv.f128, sizeof (float128));
551
+ else
552
+ memcpy (next_arg.f128, *p_argv.f128, sizeof (float128));
553
+ if (++next_arg.f128 == gpr_end.f128)
554
+ next_arg.f128 = rest.f128;
555
+ vecarg_count++;
556
+ FFI_ASSERT (__LDBL_MANT_DIG__ == 113);
557
+ FFI_ASSERT (flags & FLAG_VEC_ARGUMENTS);
558
+ break;
559
+ }
481
560
  if ((ecif->cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
482
561
  {
483
562
  double_tmp = (*p_argv.d)[0];
@@ -589,9 +668,29 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
589
668
  void *v;
590
669
  float *f;
591
670
  double *d;
671
+ float128 *f128;
592
672
  } arg;
593
673
 
594
674
  arg.v = *p_argv.v;
675
+ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
676
+ if (elt == FFI_TYPE_LONGDOUBLE &&
677
+ (ecif->cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
678
+ {
679
+ do
680
+ {
681
+ if (vecarg_count < NUM_VEC_ARG_REGISTERS64
682
+ && i < nfixedargs)
683
+ memcpy (vec_base.f128++, arg.f128, sizeof (float128));
684
+ else
685
+ memcpy (next_arg.f128, arg.f128++, sizeof (float128));
686
+ if (++next_arg.f128 == gpr_end.f128)
687
+ next_arg.f128 = rest.f128;
688
+ vecarg_count++;
689
+ }
690
+ while (--elnum != 0);
691
+ }
692
+ else
693
+ #endif
595
694
  if (elt == FFI_TYPE_FLOAT)
596
695
  {
597
696
  do
@@ -762,17 +861,20 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
762
861
  void *user_data,
763
862
  void *rvalue,
764
863
  unsigned long *pst,
765
- ffi_dblfl *pfr)
864
+ ffi_dblfl *pfr,
865
+ float128 *pvec)
766
866
  {
767
867
  /* rvalue is the pointer to space for return value in closure assembly */
768
868
  /* pst is the pointer to parameter save area
769
869
  (r3-r10 are stored into its first 8 slots by ffi_closure_LINUX64) */
770
870
  /* pfr is the pointer to where f1-f13 are stored in ffi_closure_LINUX64 */
871
+ /* pvec is the pointer to where v2-v13 are stored in ffi_closure_LINUX64 */
771
872
 
772
873
  void **avalue;
773
874
  ffi_type **arg_types;
774
875
  unsigned long i, avn, nfixedargs;
775
876
  ffi_dblfl *end_pfr = pfr + NUM_FPR_ARG_REGISTERS64;
877
+ float128 *end_pvec = pvec + NUM_VEC_ARG_REGISTERS64;
776
878
  unsigned long align;
777
879
 
778
880
  avalue = alloca (cif->nargs * sizeof (void *));
@@ -851,6 +953,7 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
851
953
  unsigned long *ul;
852
954
  float *f;
853
955
  double *d;
956
+ float128 *f128;
854
957
  size_t p;
855
958
  } to, from;
856
959
 
@@ -858,6 +961,17 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
858
961
  aggregate size is not greater than the space taken by
859
962
  the registers so store back to the register/parameter
860
963
  save arrays. */
964
+ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
965
+ if (elt == FFI_TYPE_LONGDOUBLE &&
966
+ (cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
967
+ {
968
+ if (pvec + elnum <= end_pvec)
969
+ to.v = pvec;
970
+ else
971
+ to.v = pst;
972
+ }
973
+ else
974
+ #endif
861
975
  if (pfr + elnum <= end_pfr)
862
976
  to.v = pfr;
863
977
  else
@@ -865,6 +979,23 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
865
979
 
866
980
  avalue[i] = to.v;
867
981
  from.ul = pst;
982
+ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
983
+ if (elt == FFI_TYPE_LONGDOUBLE &&
984
+ (cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
985
+ {
986
+ do
987
+ {
988
+ if (pvec < end_pvec && i < nfixedargs)
989
+ memcpy (to.f128, pvec++, sizeof (float128));
990
+ else
991
+ memcpy (to.f128, from.f128, sizeof (float128));
992
+ to.f128++;
993
+ from.f128++;
994
+ }
995
+ while (--elnum != 0);
996
+ }
997
+ else
998
+ #endif
868
999
  if (elt == FFI_TYPE_FLOAT)
869
1000
  {
870
1001
  do
@@ -920,7 +1051,18 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
920
1051
 
921
1052
  #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
922
1053
  case FFI_TYPE_LONGDOUBLE:
923
- if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
1054
+ if ((cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
1055
+ {
1056
+ if (((unsigned long) pst & 0xF) != 0)
1057
+ ++pst;
1058
+ if (pvec < end_pvec && i < nfixedargs)
1059
+ avalue[i] = pvec++;
1060
+ else
1061
+ avalue[i] = pst;
1062
+ pst += 2;
1063
+ break;
1064
+ }
1065
+ else if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
924
1066
  {
925
1067
  if (pfr + 1 < end_pfr && i + 1 < nfixedargs)
926
1068
  {
@@ -995,13 +1137,17 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
995
1137
  /* Tell ffi_closure_LINUX64 how to perform return type promotions. */
996
1138
  if ((cif->flags & FLAG_RETURNS_SMST) != 0)
997
1139
  {
998
- if ((cif->flags & FLAG_RETURNS_FP) == 0)
1140
+ if ((cif->flags & (FLAG_RETURNS_FP | FLAG_RETURNS_VEC)) == 0)
999
1141
  return FFI_V2_TYPE_SMALL_STRUCT + cif->rtype->size - 1;
1142
+ else if ((cif->flags & FLAG_RETURNS_VEC) != 0)
1143
+ return FFI_V2_TYPE_VECTOR_HOMOG;
1000
1144
  else if ((cif->flags & FLAG_RETURNS_64BITS) != 0)
1001
1145
  return FFI_V2_TYPE_DOUBLE_HOMOG;
1002
1146
  else
1003
1147
  return FFI_V2_TYPE_FLOAT_HOMOG;
1004
1148
  }
1149
+ if ((cif->flags & FLAG_RETURNS_VEC) != 0)
1150
+ return FFI_V2_TYPE_VECTOR;
1005
1151
  return cif->rtype->type;
1006
1152
  }
1007
1153
  #endif