ffi 1.9.23 → 1.9.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +66 -0
  3. data/Rakefile +1 -1
  4. data/ext/ffi_c/Call.c +5 -2
  5. data/ext/ffi_c/Function.c +8 -5
  6. data/ext/ffi_c/Thread.c +1 -0
  7. data/ext/ffi_c/extconf.rb +1 -0
  8. data/ext/ffi_c/libffi/.appveyor.yml +6 -4
  9. data/ext/ffi_c/libffi/.github/issue_template.md +10 -0
  10. data/ext/ffi_c/libffi/.gitignore +2 -0
  11. data/ext/ffi_c/libffi/.travis.yml +20 -16
  12. data/ext/ffi_c/libffi/.travis/ar-lib +270 -0
  13. data/ext/ffi_c/libffi/.travis/build.sh +34 -0
  14. data/ext/ffi_c/libffi/.travis/compile +351 -0
  15. data/ext/ffi_c/libffi/.travis/install.sh +11 -3
  16. data/ext/ffi_c/libffi/.travis/moxie-sim.exp +60 -0
  17. data/ext/ffi_c/libffi/.travis/site.exp +18 -0
  18. data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +352 -0
  19. data/ext/ffi_c/libffi/Makefile.am +4 -45
  20. data/ext/ffi_c/libffi/{README → README.md} +237 -230
  21. data/ext/ffi_c/libffi/configure.ac +10 -8
  22. data/ext/ffi_c/libffi/configure.host +5 -0
  23. data/ext/ffi_c/libffi/include/ffi.h.in +48 -26
  24. data/ext/ffi_c/libffi/include/ffi_common.h +2 -0
  25. data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +18 -16
  26. data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +21 -8
  27. data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +4 -4
  28. data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +9 -7
  29. data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +8 -5
  30. data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +5 -5
  31. data/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 +7 -6
  32. data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +99 -61
  33. data/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 +18 -8
  34. data/ext/ffi_c/libffi/m4/ax_require_defined.m4 +37 -0
  35. data/ext/ffi_c/libffi/msvcc.sh +82 -14
  36. data/ext/ffi_c/libffi/src/aarch64/ffi.c +8 -31
  37. data/ext/ffi_c/libffi/src/closures.c +31 -1
  38. data/ext/ffi_c/libffi/src/ia64/ffi.c +24 -6
  39. data/ext/ffi_c/libffi/src/ia64/ffitarget.h +2 -1
  40. data/ext/ffi_c/libffi/src/ia64/unix.S +6 -1
  41. data/ext/ffi_c/libffi/src/mips/ffi.c +29 -12
  42. data/ext/ffi_c/libffi/src/mips/ffitarget.h +7 -12
  43. data/ext/ffi_c/libffi/src/moxie/eabi.S +1 -1
  44. data/ext/ffi_c/libffi/src/moxie/ffi.c +18 -5
  45. data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +45 -16
  46. data/ext/ffi_c/libffi/src/riscv/ffi.c +445 -0
  47. data/ext/ffi_c/libffi/src/riscv/ffitarget.h +68 -0
  48. data/ext/ffi_c/libffi/src/riscv/sysv.S +214 -0
  49. data/ext/ffi_c/libffi/src/types.c +3 -1
  50. data/ext/ffi_c/libffi/src/x86/ffi.c +18 -0
  51. data/ext/ffi_c/libffi/src/x86/ffi64.c +15 -9
  52. data/ext/ffi_c/libffi/src/x86/ffitarget.h +8 -2
  53. data/ext/ffi_c/libffi/src/x86/ffiw64.c +30 -9
  54. data/ext/ffi_c/libffi/src/xtensa/sysv.S +6 -1
  55. data/ext/ffi_c/libffi/testsuite/Makefile.am +108 -77
  56. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +195 -5
  57. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/Makefile +28 -0
  58. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/README +78 -0
  59. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/alignof.h +50 -0
  60. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +58 -0
  61. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +1745 -0
  62. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +2885 -0
  63. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +743 -0
  64. data/ext/ffi_c/libffi/testsuite/libffi.call/align_stdcall.c +46 -0
  65. data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +14 -1
  66. data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +3 -1
  67. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct10.c +1 -0
  68. data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +57 -0
  69. data/ext/ffi_c/libffi/testsuite/libffi.call/unwindtest.cc +1 -1
  70. data/ext/ffi_c/libffi/testsuite/libffi.call/unwindtest_ffi_call.cc +1 -1
  71. data/lib/ffi/library.rb +2 -4
  72. data/lib/ffi/platform/mips64-linux/types.conf +104 -0
  73. data/lib/ffi/platform/mipsisa32r6-linux/types.conf +102 -0
  74. data/lib/ffi/platform/mipsisa32r6el-linux/types.conf +102 -0
  75. data/lib/ffi/platform/mipsisa64r6-linux/types.conf +104 -0
  76. data/lib/ffi/platform/mipsisa64r6el-linux/types.conf +104 -0
  77. data/lib/ffi/version.rb +1 -1
  78. metadata +29 -3
@@ -1,5 +1,5 @@
1
1
  # ===========================================================================
2
- # http://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html
2
+ # https://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html
3
3
  # ===========================================================================
4
4
  #
5
5
  # SYNOPSIS
@@ -29,7 +29,7 @@
29
29
  # Public License for more details.
30
30
  #
31
31
  # You should have received a copy of the GNU General Public License along
32
- # with this program. If not, see <http://www.gnu.org/licenses/>.
32
+ # with this program. If not, see <https://www.gnu.org/licenses/>.
33
33
  #
34
34
  # As a special exception, the respective Autoconf Macro's copyright owner
35
35
  # gives unlimited permission to copy, distribute and modify the configure
@@ -44,22 +44,24 @@
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 11
47
+ #serial 16
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,
51
+ dnl Please add if possible support to ax_compiler_version.m4
51
52
  [# note: don't check for gcc first since some other compilers define __GNUC__
52
53
  vendors="intel: __ICC,__ECC,__INTEL_COMPILER
53
54
  ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__
54
55
  pathscale: __PATHCC__,__PATHSCALE__
55
56
  clang: __clang__
57
+ cray: _CRAYC
58
+ fujitsu: __FUJITSU
56
59
  gnu: __GNUC__
57
60
  sun: __SUNPRO_C,__SUNPRO_CC
58
61
  hp: __HP_cc,__HP_aCC
59
62
  dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER
60
- borland: __BORLANDC__,__TURBOC__
63
+ borland: __BORLANDC__,__CODEGEARC__,__TURBOC__
61
64
  comeau: __COMO__
62
- cray: _CRAYC
63
65
  kai: __KCC
64
66
  lcc: __LCC__
65
67
  sgi: __sgi,sgi
@@ -67,6 +69,7 @@ AC_DEFUN([AX_COMPILER_VENDOR],
67
69
  metrowerks: __MWERKS__
68
70
  watcom: __WATCOMC__
69
71
  portland: __PGI
72
+ tcc: __TINYC__
70
73
  unknown: UNKNOWN"
71
74
  for ventest in $vendors; do
72
75
  case $ventest in
@@ -1,5 +1,5 @@
1
1
  # ===========================================================================
2
- # http://www.gnu.org/software/autoconf-archive/ax_configure_args.html
2
+ # https://www.gnu.org/software/autoconf-archive/ax_configure_args.html
3
3
  # ===========================================================================
4
4
  #
5
5
  # SYNOPSIS
@@ -15,7 +15,7 @@
15
15
  # to rely on eval'ing $ac_configure_args however some old autoconf
16
16
  # versions do not provide that. To ensure maximum portability of autoconf
17
17
  # extension macros this helper can be AC_REQUIRE'd so that
18
- # $ac_configure_args will alsways be present.
18
+ # $ac_configure_args will always be present.
19
19
  #
20
20
  # Sadly, the traditional "exec $SHELL" of the enable_builddir macros is
21
21
  # spoiled now and must be replaced by "eval + exit $?".
@@ -42,7 +42,7 @@
42
42
  # Public License for more details.
43
43
  #
44
44
  # You should have received a copy of the GNU General Public License along
45
- # with this program. If not, see <http://www.gnu.org/licenses/>.
45
+ # with this program. If not, see <https://www.gnu.org/licenses/>.
46
46
  #
47
47
  # As a special exception, the respective Autoconf Macro's copyright owner
48
48
  # gives unlimited permission to copy, distribute and modify the configure
@@ -57,10 +57,10 @@
57
57
  # modified version of the Autoconf Macro, you may extend this special
58
58
  # exception to the GPL to apply to your modified version as well.
59
59
 
60
- #serial 9
60
+ #serial 13
61
61
 
62
62
  AC_DEFUN([AX_CONFIGURE_ARGS],[
63
- # [$]@ is unsable in 2.60+ but earlier autoconf had no ac_configure_args
63
+ # [$]@ is unusable in 2.60+ but earlier autoconf had no ac_configure_args
64
64
  if test "${ac_configure_args+set}" != "set" ; then
65
65
  ac_configure_args=
66
66
  for ac_arg in ${1+"[$]@"}; do
@@ -1,5 +1,5 @@
1
1
  # ===========================================================================
2
- # http://www.gnu.org/software/autoconf-archive/ax_enable_builddir.html
2
+ # https://www.gnu.org/software/autoconf-archive/ax_enable_builddir.html
3
3
  # ===========================================================================
4
4
  #
5
5
  # SYNOPSIS
@@ -24,7 +24,7 @@
24
24
  # toplevel builddir Makefile. It just copies the variables and
25
25
  # rule-targets, each extended with a default rule-execution that recurses
26
26
  # into the build directory of the current "HOST". You can override the
27
- # auto-dection through `config.guess` and build-time of course, as in
27
+ # auto-detection through `config.guess` and build-time of course, as in
28
28
  #
29
29
  # make HOST=i386-mingw-cross
30
30
  #
@@ -42,7 +42,7 @@
42
42
  # into. Usually, the last one is the only one used. However, almost all
43
43
  # targets have an additional "*-all" rule which makes the script to
44
44
  # recurse into _all_ variants of the current HOST (!!) setting. The "-all"
45
- # suffix can be overriden for the macro as well.
45
+ # suffix can be overridden for the macro as well.
46
46
  #
47
47
  # a special rule is only given for things like "dist" that will copy the
48
48
  # tarball from the builddir to the sourcedir (or $(PUB)) for reason of
@@ -64,7 +64,7 @@
64
64
  # Public License for more details.
65
65
  #
66
66
  # You should have received a copy of the GNU General Public License along
67
- # with this program. If not, see <http://www.gnu.org/licenses/>.
67
+ # with this program. If not, see <https://www.gnu.org/licenses/>.
68
68
  #
69
69
  # As a special exception, the respective Autoconf Macro's copyright owner
70
70
  # gives unlimited permission to copy, distribute and modify the configure
@@ -79,10 +79,11 @@
79
79
  # modified version of the Autoconf Macro, you may extend this special
80
80
  # exception to the GPL to apply to your modified version as well.
81
81
 
82
- #serial 23
82
+ #serial 30
83
83
 
84
84
  AC_DEFUN([AX_ENABLE_BUILDDIR],[
85
85
  AC_REQUIRE([AC_CANONICAL_HOST])[]dnl
86
+ AC_REQUIRE([AC_CANONICAL_TARGET])[]dnl
86
87
  AC_REQUIRE([AX_CONFIGURE_ARGS])[]dnl
87
88
  AC_REQUIRE([AM_AUX_DIR_EXPAND])[]dnl
88
89
  AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl
@@ -121,7 +122,7 @@ if test ".$srcdir" = ".." ; then
121
122
  test -f $srcdir/$cache_file && mv $srcdir/$cache_file .
122
123
  AC_MSG_RESULT(....exec $SHELL $srcdir/[$]0 "--srcdir=$srcdir" "--enable-builddir=$SUB" ${1+"[$]@"})
123
124
  case "[$]0" in # restart
124
- [[\\/]]* | ?:[[\\/]]*) # Asbolute name
125
+ [[\\/]]* | ?:[[\\/]]*) # Absolute name
125
126
  eval $SHELL "'[$]0'" "'--srcdir=$srcdir'" "'--enable-builddir=$SUB'" $ac_configure_args ;;
126
127
  *) eval $SHELL "'$srcdir/[$]0'" "'--srcdir=$srcdir'" "'--enable-builddir=$SUB'" $ac_configure_args ;;
127
128
  esac ; exit $?
@@ -1,5 +1,5 @@
1
1
  # ===========================================================================
2
- # http://www.gnu.org/software/autoconf-archive/ax_gcc_archflag.html
2
+ # https://www.gnu.org/software/autoconf-archive/ax_gcc_archflag.html
3
3
  # ===========================================================================
4
4
  #
5
5
  # SYNOPSIS
@@ -36,7 +36,8 @@
36
36
  #
37
37
  # Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
38
38
  # Copyright (c) 2008 Matteo Frigo
39
- # Copyright (c) 2012 Tsukasa Oi
39
+ # Copyright (c) 2014 Tsukasa Oi
40
+ # Copyright (c) 2017 Alexey Kopytov
40
41
  #
41
42
  # This program is free software: you can redistribute it and/or modify it
42
43
  # under the terms of the GNU General Public License as published by the
@@ -49,7 +50,7 @@
49
50
  # Public License for more details.
50
51
  #
51
52
  # You should have received a copy of the GNU General Public License along
52
- # with this program. If not, see <http://www.gnu.org/licenses/>.
53
+ # with this program. If not, see <https://www.gnu.org/licenses/>.
53
54
  #
54
55
  # As a special exception, the respective Autoconf Macro's copyright owner
55
56
  # gives unlimited permission to copy, distribute and modify the configure
@@ -64,11 +65,13 @@
64
65
  # modified version of the Autoconf Macro, you may extend this special
65
66
  # exception to the GPL to apply to your modified version as well.
66
67
 
67
- #serial 11
68
+ #serial 20
68
69
 
69
70
  AC_DEFUN([AX_GCC_ARCHFLAG],
70
71
  [AC_REQUIRE([AC_PROG_CC])
71
72
  AC_REQUIRE([AC_CANONICAL_HOST])
73
+ AC_REQUIRE([AC_PROG_SED])
74
+ AC_REQUIRE([AX_COMPILER_VENDOR])
72
75
 
73
76
  AC_ARG_WITH(gcc-arch, [AS_HELP_STRING([--with-gcc-arch=<arch>], [use architecture <arch> for gcc -march/-mtune, instead of guessing])],
74
77
  ax_gcc_arch=$withval, ax_gcc_arch=yes)
@@ -85,63 +88,70 @@ if test "x$ax_gcc_arch" = xyes; then
85
88
  ax_gcc_arch=""
86
89
  if test "$cross_compiling" = no; then
87
90
  case $host_cpu in
88
- i[[3456]]86*|x86_64*) # use cpuid codes
91
+ i[[3456]]86*|x86_64*|amd64*) # use cpuid codes
89
92
  AX_GCC_X86_CPUID(0)
90
93
  AX_GCC_X86_CPUID(1)
91
94
  case $ax_cv_gcc_x86_cpuid_0 in
92
- *:756e6547:*:*) # Intel
95
+ *:756e6547:6c65746e:49656e69) # Intel
93
96
  case $ax_cv_gcc_x86_cpuid_1 in
94
- *5[[48]]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;;
95
- *5??:*:*:*) ax_gcc_arch=pentium ;;
96
- *0?6[[3456]]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;;
97
- *0?6a?:*[[01]]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;;
98
- *0?6a?:*[[234]]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;;
99
- *0?6[[9de]]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;;
100
- *0?6[[78b]]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;;
101
- *0?6f?:*:*:*|*1?66?:*:*:*) ax_gcc_arch="core2 pentium-m pentium3 pentiumpro" ;;
97
+ *5[[4578]]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;;
98
+ *5[[123]]?:*:*:*) ax_gcc_arch=pentium ;;
99
+ *0?61?:*:*:*|?61?:*:*:*|61?:*:*:*) ax_gcc_arch=pentiumpro ;;
100
+ *0?6[[356]]?:*:*:*|?6[[356]]?:*:*:*|6[[356]]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;;
101
+ *0?6[[78ab]]?:*:*:*|?6[[78ab]]?:*:*:*|6[[78ab]]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;;
102
+ *0?6[[9d]]?:*:*:*|?6[[9d]]?:*:*:*|6[[9d]]?:*:*:*|*1?65?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;;
103
+ *0?6e?:*:*:*|?6e?:*:*:*|6e?:*:*:*) ax_gcc_arch="yonah pentium-m pentium3 pentiumpro" ;;
104
+ *0?6f?:*:*:*|?6f?:*:*:*|6f?:*:*:*|*1?66?:*:*:*) ax_gcc_arch="core2 pentium-m pentium3 pentiumpro" ;;
102
105
  *1?6[[7d]]?:*:*:*) ax_gcc_arch="penryn core2 pentium-m pentium3 pentiumpro" ;;
103
- *1?6[[aef]]?:*:*:*|*2?6[[5cef]]?:*:*:*) ax_gcc_arch="corei7 core2 pentium-m pentium3 pentiumpro" ;;
104
- *1?6c?:*:*:*|*[[23]]?66?:*:*:*) ax_gcc_arch="atom core2 pentium-m pentium3 pentiumpro" ;;
105
- *2?6[[ad]]?:*:*:*) ax_gcc_arch="corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;;
106
- *0?6??:*:*:*) ax_gcc_arch=pentiumpro ;;
107
- *6??:*:*:*) ax_gcc_arch="core2 pentiumpro" ;;
108
- ?000?f3[[347]]:*:*:*|?000?f4[1347]:*:*:*|?000?f6?:*:*:*)
109
- case $host_cpu in
110
- x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;;
111
- *) ax_gcc_arch="prescott pentium4 pentiumpro" ;;
112
- esac ;;
113
- ?000?f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";;
106
+ *1?6[[aef]]?:*:*:*|*2?6e?:*:*:*) ax_gcc_arch="nehalem corei7 core2 pentium-m pentium3 pentiumpro" ;;
107
+ *2?6[[5cf]]?:*:*:*) ax_gcc_arch="westmere corei7 core2 pentium-m pentium3 pentiumpro" ;;
108
+ *2?6[[ad]]?:*:*:*) ax_gcc_arch="sandybridge corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;;
109
+ *3?6[[ae]]?:*:*:*) ax_gcc_arch="ivybridge core-avx-i corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;;
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" ;;
112
+ *1?6c?:*:*:*|*2?6[[67]]?:*:*:*|*3?6[[56]]?:*:*:*) ax_gcc_arch="bonnell atom core2 pentium-m pentium3 pentiumpro" ;;
113
+ *3?67?:*:*:*|*[[45]]?6[[ad]]?:*:*:*) ax_gcc_arch="silvermont atom core2 pentium-m pentium3 pentiumpro" ;;
114
+ *000?f[[012]]?:*:*:*|?f[[012]]?:*:*:*|f[[012]]?:*:*:*) ax_gcc_arch="pentium4 pentiumpro" ;;
115
+ *000?f[[346]]?:*:*:*|?f[[346]]?:*:*:*|f[[346]]?:*:*:*) ax_gcc_arch="nocona prescott pentium4 pentiumpro" ;;
116
+ # fallback
117
+ *5??:*:*:*) ax_gcc_arch=pentium ;;
118
+ *??6??:*:*:*) ax_gcc_arch="core2 pentiumpro" ;;
119
+ *6??:*:*:*) ax_gcc_arch=pentiumpro ;;
120
+ *00??f??:*:*:*|??f??:*:*:*|?f??:*:*:*|f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro" ;;
114
121
  esac ;;
115
- *:68747541:*:*) # AMD
122
+ *:68747541:444d4163:69746e65) # AMD
116
123
  case $ax_cv_gcc_x86_cpuid_1 in
117
124
  *5[[67]]?:*:*:*) ax_gcc_arch=k6 ;;
118
- *5[[8d]]?:*:*:*) ax_gcc_arch="k6-2 k6" ;;
119
- *5[[9]]?:*:*:*) ax_gcc_arch="k6-3 k6" ;;
120
- *60?:*:*:*) ax_gcc_arch=k7 ;;
125
+ *5[[8]]?:*:*:*) ax_gcc_arch="k6-2 k6" ;;
126
+ *5[[9d]]?:*:*:*) ax_gcc_arch="k6-3 k6" ;;
121
127
  *6[[12]]?:*:*:*) ax_gcc_arch="athlon k7" ;;
122
128
  *6[[34]]?:*:*:*) ax_gcc_arch="athlon-tbird k7" ;;
123
- *67?:*:*:*) ax_gcc_arch="athlon-4 athlon k7" ;;
124
- *6[[68a]]?:*:*:*)
125
- AX_GCC_X86_CPUID(0x80000006) # L2 cache size
126
- case $ax_cv_gcc_x86_cpuid_0x80000006 in
127
- *:*:*[[1-9a-f]]??????:*) # (L2 = ecx >> 16) >= 256
128
- ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;;
129
- *) ax_gcc_arch="athlon-4 athlon k7" ;;
130
- esac ;;
131
- ?00??f[[4cef8b]]?:*:*:*) ax_gcc_arch="athlon64 k8" ;;
132
- ?00??f5?:*:*:*) ax_gcc_arch="opteron k8" ;;
133
- ?00??f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;;
134
- ?00??f??:*:*:*) ax_gcc_arch="k8" ;;
135
- ?05??f??:*:*:*) ax_gcc_arch="btver1 amdfam10 k8" ;;
136
- ?06??f??:*:*:*) ax_gcc_arch="bdver1 amdfam10 k8" ;;
137
- *f??:*:*:*) ax_gcc_arch="amdfam10 k8" ;;
129
+ *6[[678a]]?:*:*:*) ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;;
130
+ *000?f[[4578bcef]]?:*:*:*|?f[[4578bcef]]?:*:*:*|f[[4578bcef]]?:*:*:*|*001?f[[4578bcf]]?:*:*:*|1?f[[4578bcf]]?:*:*:*) ax_gcc_arch="athlon64 k8" ;;
131
+ *002?f[[13457bcf]]?:*:*:*|2?f[[13457bcf]]?:*:*:*|*004?f[[138bcf]]?:*:*:*|4?f[[138bcf]]?:*:*:*|*005?f[[df]]?:*:*:*|5?f[[df]]?:*:*:*|*006?f[[8bcf]]?:*:*:*|6?f[[8bcf]]?:*:*:*|*007?f[[cf]]?:*:*:*|7?f[[cf]]?:*:*:*|*00c?f1?:*:*:*|c?f1?:*:*:*|*020?f3?:*:*:*|20?f3?:*:*:*) ax_gcc_arch="athlon64-sse3 k8-sse3 athlon64 k8" ;;
132
+ *010?f[[245689a]]?:*:*:*|10?f[[245689a]]?:*:*:*|*030?f1?:*:*:*|30?f1?:*:*:*) ax_gcc_arch="barcelona amdfam10 k8" ;;
133
+ *050?f[[12]]?:*:*:*|50?f[[12]]?:*:*:*) ax_gcc_arch="btver1 amdfam10 k8" ;;
134
+ *060?f1?:*:*:*|60?f1?:*:*:*) ax_gcc_arch="bdver1 amdfam10 k8" ;;
135
+ *060?f2?:*:*:*|60?f2?:*:*:*|*061?f[[03]]?:*:*:*|61?f[[03]]?:*:*:*) ax_gcc_arch="bdver2 bdver1 amdfam10 k8" ;;
136
+ *063?f0?:*:*:*|63?f0?:*:*:*) ax_gcc_arch="bdver3 bdver2 bdver1 amdfam10 k8" ;;
137
+ *07[[03]]?f0?:*:*:*|7[[03]]?f0?:*:*:*) ax_gcc_arch="btver2 btver1 amdfam10 k8" ;;
138
+ # fallback
139
+ *0[[13]]??f??:*:*:*|[[13]]??f??:*:*:*) ax_gcc_arch="barcelona amdfam10 k8" ;;
140
+ *020?f??:*:*:*|20?f??:*:*:*) ax_gcc_arch="athlon64-sse3 k8-sse3 athlon64 k8" ;;
141
+ *05??f??:*:*:*|5??f??:*:*:*) ax_gcc_arch="btver1 amdfam10 k8" ;;
142
+ *060?f??:*:*:*|60?f??:*:*:*) ax_gcc_arch="bdver1 amdfam10 k8" ;;
143
+ *061?f??:*:*:*|61?f??:*:*:*) ax_gcc_arch="bdver2 bdver1 amdfam10 k8" ;;
144
+ *06??f??:*:*:*|6??f??:*:*:*) ax_gcc_arch="bdver3 bdver2 bdver1 amdfam10 k8" ;;
145
+ *070?f??:*:*:*|70?f??:*:*:*) ax_gcc_arch="btver2 btver1 amdfam10 k8" ;;
146
+ *???f??:*:*:*) ax_gcc_arch="amdfam10 k8" ;;
138
147
  esac ;;
139
- *:746e6543:*:*) # IDT
148
+ *:746e6543:736c7561:48727561) # IDT / VIA (Centaur)
140
149
  case $ax_cv_gcc_x86_cpuid_1 in
141
150
  *54?:*:*:*) ax_gcc_arch=winchip-c6 ;;
142
- *58?:*:*:*) ax_gcc_arch=winchip2 ;;
151
+ *5[[89]]?:*:*:*) ax_gcc_arch=winchip2 ;;
152
+ *66?:*:*:*) ax_gcc_arch=winchip2 ;;
143
153
  *6[[78]]?:*:*:*) ax_gcc_arch=c3 ;;
144
- *69?:*:*:*) ax_gcc_arch="c3-2 c3" ;;
154
+ *6[[9adf]]?:*:*:*) ax_gcc_arch="c3-2 c3" ;;
145
155
  esac ;;
146
156
  esac
147
157
  if test x"$ax_gcc_arch" = x; then # fallback
@@ -155,7 +165,7 @@ case $host_cpu in
155
165
  sparc*)
156
166
  AC_PATH_PROG([PRTDIAG], [prtdiag], [prtdiag], [$PATH:/usr/platform/`uname -i`/sbin/:/usr/platform/`uname -m`/sbin/])
157
167
  cputype=`(((grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null`
158
- cputype=`echo "$cputype" | tr -d ' -' | sed 's/SPARCIIi/SPARCII/' | tr $as_cr_LETTERS $as_cr_letters`
168
+ cputype=`echo "$cputype" | tr -d ' -' | $SED 's/SPARCIIi/SPARCII/' |tr $as_cr_LETTERS $as_cr_letters`
159
169
  case $cputype in
160
170
  *ultrasparciv*) ax_gcc_arch="ultrasparc4 ultrasparc3 ultrasparc v9" ;;
161
171
  *ultrasparciii*) ax_gcc_arch="ultrasparc3 ultrasparc v9" ;;
@@ -177,8 +187,8 @@ case $host_cpu in
177
187
  alphaev79) ax_gcc_arch="ev79 ev7 ev69 ev68 ev67" ;;
178
188
 
179
189
  powerpc*)
180
- cputype=`((grep cpu /proc/cpuinfo | head -n 1 | cut -d: -f2 | cut -d, -f1 | sed 's/ //g') ; /usr/bin/machine ; /bin/machine; grep CPU /var/run/dmesg.boot | head -n 1 | cut -d" " -f2) 2> /dev/null`
181
- cputype=`echo $cputype | sed -e 's/ppc//g;s/ *//g'`
190
+ cputype=`((grep cpu /proc/cpuinfo | head -n 1 | cut -d: -f2 | cut -d, -f1 | $SED 's/ //g') ; /usr/bin/machine ; /bin/machine; grep CPU /var/run/dmesg.boot | head -n 1 | cut -d" " -f2) 2> /dev/null`
191
+ cputype=`echo $cputype | $SED -e 's/ppc//g;s/ *//g'`
182
192
  case $cputype in
183
193
  *750*) ax_gcc_arch="750 G3" ;;
184
194
  *740[[0-9]]*) ax_gcc_arch="$cputype 7400 G4" ;;
@@ -192,22 +202,50 @@ case $host_cpu in
192
202
  esac
193
203
  ax_gcc_arch="$ax_gcc_arch powerpc"
194
204
  ;;
205
+ aarch64)
206
+ cpuimpl=`grep 'CPU implementer' /proc/cpuinfo 2> /dev/null | cut -d: -f2 | tr -d " " | head -n 1`
207
+ cpuarch=`grep 'CPU architecture' /proc/cpuinfo 2> /dev/null | cut -d: -f2 | tr -d " " | head -n 1`
208
+ cpuvar=`grep 'CPU variant' /proc/cpuinfo 2> /dev/null | cut -d: -f2 | tr -d " " | head -n 1`
209
+ case $cpuimpl in
210
+ 0x42) case $cpuarch in
211
+ 8) case $cpuvar in
212
+ 0x0) ax_gcc_arch="thunderx2t99 vulcan armv8.1-a armv8-a+lse armv8-a native" ;;
213
+ esac
214
+ ;;
215
+ esac
216
+ ;;
217
+ 0x43) case $cpuarch in
218
+ 8) case $cpuvar in
219
+ 0x0) ax_gcc_arch="thunderx armv8-a native" ;;
220
+ 0x1) ax_gcc_arch="thunderx+lse armv8.1-a armv8-a+lse armv8-a native" ;;
221
+ esac
222
+ ;;
223
+ esac
224
+ ;;
225
+ esac
226
+ ;;
195
227
  esac
196
228
  fi # not cross-compiling
197
229
  fi # guess arch
198
230
 
199
231
  if test "x$ax_gcc_arch" != x -a "x$ax_gcc_arch" != xno; then
200
- for arch in $ax_gcc_arch; do
201
- if test "x[]m4_default([$1],yes)" = xyes; then # if we require portable code
202
- flags="-mtune=$arch"
203
- # -mcpu=$arch and m$arch generate nonportable code on every arch except
204
- # x86. And some other arches (e.g. Alpha) don't accept -mtune. Grrr.
205
- case $host_cpu in i*86|x86_64*) flags="$flags -mcpu=$arch -m$arch";; esac
206
- else
207
- flags="-march=$arch -mcpu=$arch -m$arch"
208
- fi
209
- for flag in $flags; do
210
- AX_CHECK_COMPILE_FLAG($flag, [ax_cv_gcc_archflag=$flag; break])
232
+ if test "x[]m4_default([$1],yes)" = xyes; then # if we require portable code
233
+ flag_prefixes="-mtune="
234
+ if test "x$ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor" = xclang; then flag_prefixes="-march="; fi
235
+ # -mcpu=$arch and m$arch generate nonportable code on every arch except
236
+ # x86. And some other arches (e.g. Alpha) don't accept -mtune. Grrr.
237
+ case $host_cpu in i*86|x86_64*|amd64*) flag_prefixes="$flag_prefixes -mcpu= -m";; esac
238
+ else
239
+ flag_prefixes="-march= -mcpu= -m"
240
+ fi
241
+ for flag_prefix in $flag_prefixes; do
242
+ for arch in $ax_gcc_arch; do
243
+ flag="$flag_prefix$arch"
244
+ AX_CHECK_COMPILE_FLAG($flag, [if test "x$ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor" = xclang; then
245
+ if test "x[]m4_default([$1],yes)" = xyes; then
246
+ if test "x$flag" = "x-march=$arch"; then flag=-mtune=$arch; fi
247
+ fi
248
+ fi; ax_cv_gcc_archflag=$flag; break])
211
249
  done
212
250
  test "x$ax_cv_gcc_archflag" = xunknown || break
213
251
  done
@@ -1,17 +1,19 @@
1
1
  # ===========================================================================
2
- # http://www.gnu.org/software/autoconf-archive/ax_gcc_x86_cpuid.html
2
+ # https://www.gnu.org/software/autoconf-archive/ax_gcc_x86_cpuid.html
3
3
  # ===========================================================================
4
4
  #
5
5
  # SYNOPSIS
6
6
  #
7
7
  # AX_GCC_X86_CPUID(OP)
8
+ # AX_GCC_X86_CPUID_COUNT(OP, COUNT)
8
9
  #
9
10
  # DESCRIPTION
10
11
  #
11
12
  # On Pentium and later x86 processors, with gcc or a compiler that has a
12
13
  # compatible syntax for inline assembly instructions, run a small program
13
14
  # that executes the cpuid instruction with input OP. This can be used to
14
- # detect the CPU type.
15
+ # detect the CPU type. AX_GCC_X86_CPUID_COUNT takes an additional COUNT
16
+ # parameter that gets passed into register ECX before calling cpuid.
15
17
  #
16
18
  # On output, the values of the eax, ebx, ecx, and edx registers are stored
17
19
  # as hexadecimal strings as "eax:ebx:ecx:edx" in the cache variable
@@ -28,6 +30,7 @@
28
30
  #
29
31
  # Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
30
32
  # Copyright (c) 2008 Matteo Frigo
33
+ # Copyright (c) 2015 Michael Petch <mpetch@capp-sysware.com>
31
34
  #
32
35
  # This program is free software: you can redistribute it and/or modify it
33
36
  # under the terms of the GNU General Public License as published by the
@@ -40,7 +43,7 @@
40
43
  # Public License for more details.
41
44
  #
42
45
  # You should have received a copy of the GNU General Public License along
43
- # with this program. If not, see <http://www.gnu.org/licenses/>.
46
+ # with this program. If not, see <https://www.gnu.org/licenses/>.
44
47
  #
45
48
  # As a special exception, the respective Autoconf Macro's copyright owner
46
49
  # gives unlimited permission to copy, distribute and modify the configure
@@ -55,18 +58,25 @@
55
58
  # modified version of the Autoconf Macro, you may extend this special
56
59
  # exception to the GPL to apply to your modified version as well.
57
60
 
58
- #serial 7
61
+ #serial 10
59
62
 
60
63
  AC_DEFUN([AX_GCC_X86_CPUID],
64
+ [AX_GCC_X86_CPUID_COUNT($1, 0)
65
+ ])
66
+
67
+ AC_DEFUN([AX_GCC_X86_CPUID_COUNT],
61
68
  [AC_REQUIRE([AC_PROG_CC])
62
69
  AC_LANG_PUSH([C])
63
70
  AC_CACHE_CHECK(for x86 cpuid $1 output, ax_cv_gcc_x86_cpuid_$1,
64
71
  [AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>], [
65
- int op = $1, eax, ebx, ecx, edx;
72
+ int op = $1, level = $2, eax, ebx, ecx, edx;
66
73
  FILE *f;
67
- __asm__("cpuid"
68
- : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
69
- : "a" (op));
74
+ __asm__ __volatile__ ("xchg %%ebx, %1\n"
75
+ "cpuid\n"
76
+ "xchg %%ebx, %1\n"
77
+ : "=a" (eax), "=r" (ebx), "=c" (ecx), "=d" (edx)
78
+ : "a" (op), "2" (level));
79
+
70
80
  f = fopen("conftest_cpuid", "w"); if (!f) return 1;
71
81
  fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx);
72
82
  fclose(f);
@@ -0,0 +1,37 @@
1
+ # ===========================================================================
2
+ # https://www.gnu.org/software/autoconf-archive/ax_require_defined.html
3
+ # ===========================================================================
4
+ #
5
+ # SYNOPSIS
6
+ #
7
+ # AX_REQUIRE_DEFINED(MACRO)
8
+ #
9
+ # DESCRIPTION
10
+ #
11
+ # AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
12
+ # been defined and thus are available for use. This avoids random issues
13
+ # where a macro isn't expanded. Instead the configure script emits a
14
+ # non-fatal:
15
+ #
16
+ # ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
17
+ #
18
+ # It's like AC_REQUIRE except it doesn't expand the required macro.
19
+ #
20
+ # Here's an example:
21
+ #
22
+ # AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
23
+ #
24
+ # LICENSE
25
+ #
26
+ # Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
27
+ #
28
+ # Copying and distribution of this file, with or without modification, are
29
+ # permitted in any medium without royalty provided the copyright notice
30
+ # and this notice are preserved. This file is offered as-is, without any
31
+ # warranty.
32
+
33
+ #serial 2
34
+
35
+ AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
36
+ m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
37
+ ])dnl AX_REQUIRE_DEFINED