ffi 1.11.1 → 1.11.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/{appveyor.yml → .appveyor.yml} +1 -1
  3. data/.gitmodules +2 -2
  4. data/CHANGELOG.md +16 -0
  5. data/Rakefile +1 -0
  6. data/ext/ffi_c/Call.c +3 -3
  7. data/ext/ffi_c/Call.h +2 -2
  8. data/ext/ffi_c/Function.c +4 -4
  9. data/ext/ffi_c/LongDouble.c +7 -7
  10. data/ext/ffi_c/libffi.darwin.mk +1 -1
  11. data/ext/ffi_c/libffi/.appveyor.yml +29 -13
  12. data/ext/ffi_c/libffi/.gitattributes +4 -0
  13. data/ext/ffi_c/libffi/.travis.yml +31 -2
  14. data/ext/ffi_c/libffi/.travis/build-in-container.sh +22 -0
  15. data/ext/ffi_c/libffi/.travis/build.sh +83 -7
  16. data/ext/ffi_c/libffi/.travis/install.sh +32 -11
  17. data/ext/ffi_c/libffi/LICENSE +1 -1
  18. data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +5 -4
  19. data/ext/ffi_c/libffi/Makefile.am +30 -38
  20. data/ext/ffi_c/libffi/README.md +15 -6
  21. data/ext/ffi_c/libffi/configure.ac +1 -1
  22. data/ext/ffi_c/libffi/configure.host +21 -7
  23. data/ext/ffi_c/libffi/include/ffi.h.in +4 -0
  24. data/ext/ffi_c/libffi/include/ffi_common.h +4 -0
  25. data/ext/ffi_c/libffi/m4/asmcfi.m4 +1 -1
  26. data/ext/ffi_c/libffi/make_sunver.pl +333 -0
  27. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.sln +33 -0
  28. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj +130 -0
  29. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.filters +57 -0
  30. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.user +4 -0
  31. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +511 -0
  32. data/ext/ffi_c/libffi/msvcc.sh +27 -2
  33. data/ext/ffi_c/libffi/src/aarch64/ffi.c +124 -56
  34. data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +13 -2
  35. data/ext/ffi_c/libffi/src/aarch64/sysv.S +8 -6
  36. data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +506 -0
  37. data/ext/ffi_c/libffi/src/arm/ffi.c +40 -5
  38. data/ext/ffi_c/libffi/src/arm/ffitarget.h +8 -1
  39. data/ext/ffi_c/libffi/src/arm/sysv.S +2 -0
  40. data/ext/ffi_c/libffi/src/arm/sysv_msvc_arm32.S +311 -0
  41. data/ext/ffi_c/libffi/src/closures.c +32 -8
  42. data/ext/ffi_c/libffi/src/pa/linux.S +23 -2
  43. data/ext/ffi_c/libffi/src/powerpc/ffi.c +3 -2
  44. data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +58 -25
  45. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +1 -1
  46. data/ext/ffi_c/libffi/src/prep_cif.c +4 -2
  47. data/ext/ffi_c/libffi/src/x86/ffi.c +13 -6
  48. data/ext/ffi_c/libffi/src/x86/ffi64.c +5 -3
  49. data/ext/ffi_c/libffi/src/x86/ffiw64.c +6 -3
  50. data/ext/ffi_c/libffi/src/x86/sysv.S +2 -2
  51. data/ext/ffi_c/libffi/src/x86/sysv_intel.S +995 -0
  52. data/ext/ffi_c/libffi/src/x86/win64.S +5 -0
  53. data/ext/ffi_c/libffi/testsuite/Makefile.am +111 -109
  54. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +26 -5
  55. data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +9 -8
  56. data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +1 -1
  57. data/ffi.gemspec +1 -1
  58. data/lib/ffi/library.rb +5 -5
  59. data/lib/ffi/platform.rb +4 -1
  60. data/lib/ffi/platform/aarch64-freebsd/types.conf +89 -89
  61. data/lib/ffi/platform/aarch64-freebsd12/types.conf +89 -89
  62. data/lib/ffi/platform/aarch64-linux/types.conf +81 -81
  63. data/lib/ffi/platform/arm-freebsd/types.conf +87 -87
  64. data/lib/ffi/platform/arm-freebsd12/types.conf +87 -87
  65. data/lib/ffi/platform/arm-linux/types.conf +79 -79
  66. data/lib/ffi/platform/i386-cygwin/types.conf +1 -1
  67. data/lib/ffi/platform/i386-darwin/types.conf +63 -63
  68. data/lib/ffi/platform/i386-freebsd/types.conf +87 -87
  69. data/lib/ffi/platform/i386-freebsd12/types.conf +87 -87
  70. data/lib/ffi/platform/i386-gnu/types.conf +84 -84
  71. data/lib/ffi/platform/i386-linux/types.conf +77 -77
  72. data/lib/ffi/platform/i386-netbsd/types.conf +87 -87
  73. data/lib/ffi/platform/i386-openbsd/types.conf +89 -89
  74. data/lib/ffi/platform/i386-solaris/types.conf +96 -96
  75. data/lib/ffi/platform/i386-windows/types.conf +84 -84
  76. data/lib/ffi/platform/ia64-linux/types.conf +79 -79
  77. data/lib/ffi/platform/mips-linux/types.conf +79 -79
  78. data/lib/ffi/platform/mips64-linux/types.conf +81 -81
  79. data/lib/ffi/platform/mips64el-linux/types.conf +81 -81
  80. data/lib/ffi/platform/mipsel-linux/types.conf +79 -79
  81. data/lib/ffi/platform/mipsisa32r6-linux/types.conf +79 -79
  82. data/lib/ffi/platform/mipsisa32r6el-linux/types.conf +79 -79
  83. data/lib/ffi/platform/mipsisa64r6-linux/types.conf +81 -81
  84. data/lib/ffi/platform/mipsisa64r6el-linux/types.conf +81 -81
  85. data/lib/ffi/platform/powerpc-aix/types.conf +155 -155
  86. data/lib/ffi/platform/powerpc-darwin/types.conf +63 -63
  87. data/lib/ffi/platform/powerpc-linux/types.conf +77 -77
  88. data/lib/ffi/platform/powerpc64-linux/types.conf +81 -81
  89. data/lib/ffi/platform/s390-linux/types.conf +79 -79
  90. data/lib/ffi/platform/s390x-linux/types.conf +79 -79
  91. data/lib/ffi/platform/sparc-linux/types.conf +79 -79
  92. data/lib/ffi/platform/sparc-solaris/types.conf +103 -103
  93. data/lib/ffi/platform/sparc64-linux/types.conf +79 -79
  94. data/lib/ffi/platform/sparcv9-solaris/types.conf +103 -103
  95. data/lib/ffi/platform/x86_64-cygwin/types.conf +1 -1
  96. data/lib/ffi/platform/x86_64-darwin/types.conf +84 -84
  97. data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +148 -0
  98. data/lib/ffi/platform/x86_64-freebsd/types.conf +89 -89
  99. data/lib/ffi/platform/x86_64-freebsd12/types.conf +139 -109
  100. data/lib/ffi/platform/x86_64-linux/types.conf +86 -77
  101. data/lib/ffi/platform/x86_64-netbsd/types.conf +89 -89
  102. data/lib/ffi/platform/x86_64-openbsd/types.conf +86 -86
  103. data/lib/ffi/platform/x86_64-solaris/types.conf +96 -96
  104. data/lib/ffi/platform/x86_64-windows/types.conf +99 -99
  105. data/lib/ffi/tools/types_generator.rb +5 -4
  106. data/lib/ffi/version.rb +1 -1
  107. metadata +19 -5
@@ -2,21 +2,42 @@
2
2
  set -x
3
3
 
4
4
  if [[ $TRAVIS_OS_NAME != 'linux' ]]; then
5
- brew update
5
+ brew update > brew-update.log 2>&1
6
6
  # fix an issue with libtool on travis by reinstalling it
7
7
  brew uninstall libtool;
8
8
  brew install libtool dejagnu;
9
9
  else
10
+ sudo apt-get clean # clear the cache
10
11
  sudo apt-get update
11
- sudo apt-get install dejagnu texinfo
12
- case "$HOST" in
13
- i386-pc-linux-gnu)
14
- sudo apt-get install gcc-multilib g++-multilib
15
- ;;
16
- moxie-elf)
17
- echo 'deb http://repos.moxielogic.org:7114/MoxieLogic moxiedev main' | sudo tee -a /etc/apt/sources.list
18
- sudo apt-get update -qq
19
- sudo apt-get install -y --allow-unauthenticated moxielogic-moxie-elf-gcc moxielogic-moxie-elf-gcc-c++ moxielogic-moxie-elf-gcc-libstdc++ moxielogic-moxie-elf-gdb-sim
20
- ;;
12
+ case $HOST in
13
+ aarch64-linux-gnu | powerpc64le-unknown-linux-gnu | mips64el-linux-gnu | sparc64-linux-gnu)
14
+ ;;
15
+ alpha-linux-gnu | arm32v7-linux-gnu | m68k-linux-gnu | sh4-linux-gnu | s390x-linux-gnu )
16
+ sudo apt-get install qemu-user-static
17
+ ;;
18
+ hppa-linux-gnu )
19
+ sudo apt-get install -y qemu-user-static g++-5-hppa-linux-gnu
20
+ ;;
21
+ i386-pc-linux-gnu)
22
+ sudo apt-get install gcc-multilib g++-multilib;
23
+ ;;
24
+ moxie-elf)
25
+ echo 'deb https://repos.moxielogic.org:7114/MoxieLogic moxiedev main' | sudo tee -a /etc/apt/sources.list
26
+ sudo apt-get clean # clear the cache
27
+ sudo apt-get update ## -qq
28
+ sudo apt-get update
29
+ sudo apt-get install -y --allow-unauthenticated moxielogic-moxie-elf-gcc moxielogic-moxie-elf-gcc-c++ moxielogic-moxie-elf-gcc-libstdc++ moxielogic-moxie-elf-gdb-sim
30
+ ;;
31
+ i686-w64-mingw32)
32
+ sudo apt-get install gcc-mingw-w64-i686 binutils-mingw-w64-i686 wine;
33
+ ;;
34
+ esac
35
+ case $HOST in
36
+ arm32v7-linux-gnu | aarch64-linux-gnu | ppc64le-linux-gnu | s390x-linux-gnu)
37
+ # don't install host tools
38
+ ;;
39
+ *)
40
+ sudo apt-get install dejagnu texinfo sharutils
41
+ ;;
21
42
  esac
22
43
  fi
@@ -1,4 +1,4 @@
1
- libffi - Copyright (c) 1996-2014 Anthony Green, Red Hat, Inc and others.
1
+ libffi - Copyright (c) 1996-2019 Anthony Green, Red Hat, Inc and others.
2
2
  See source files for details.
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person obtaining
@@ -1,10 +1,11 @@
1
1
  The libffi source distribution contains certain code that is not part
2
2
  of libffi, and is only used as tooling to assist with the building and
3
3
  testing of libffi. This includes the msvcc.sh script used to wrap the
4
- Microsoft compiler with GNU compatible command-line options, and the
5
- libffi test code distributed in the testsuite/libffi.bhaible
6
- directory. This code is distributed with libffi for the purpose of
7
- convenience only, and libffi is in no way derived from this code.
4
+ Microsoft compiler with GNU compatible command-line options,
5
+ make_sunver.pl, and the libffi test code distributed in the
6
+ testsuite/libffi.bhaible directory. This code is distributed with
7
+ libffi for the purpose of convenience only, and libffi is in no way
8
+ derived from this code.
8
9
 
9
10
  msvcc.sh an testsuite/libffi.bhaible are both distributed under the
10
11
  terms of the GNU GPL version 2, as below.
@@ -22,7 +22,7 @@ EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj \
22
22
  generate-darwin-source-and-headers.py \
23
23
  libffi.xcodeproj/project.pbxproj \
24
24
  libtool-ldflags libtool-version configure.host README.md \
25
- libffi.map.in
25
+ libffi.map.in LICENSE-BUILDTOOLS msvc_build make_sunver.pl
26
26
 
27
27
  # local.exp is generated by configure
28
28
  DISTCLEANFILES = local.exp
@@ -77,41 +77,32 @@ noinst_HEADERS = \
77
77
  src/xtensa/ffitarget.h \
78
78
  src/dlmalloc.c
79
79
 
80
- EXTRA_libffi_la_SOURCES = \
81
- src/aarch64/ffi.c src/aarch64/sysv.S \
82
- src/alpha/ffi.c src/alpha/osf.S \
83
- src/arc/ffi.c src/arc/arcompact.S \
84
- src/arm/ffi.c src/arm/sysv.S \
85
- src/avr32/ffi.c src/avr32/sysv.S \
86
- src/bfin/ffi.c src/bfin/sysv.S \
87
- src/cris/ffi.c src/cris/sysv.S \
88
- src/frv/ffi.c src/frv/eabi.S \
89
- src/ia64/ffi.c src/ia64/unix.S \
90
- src/m32r/ffi.c src/m32r/sysv.S \
91
- src/m68k/ffi.c src/m68k/sysv.S \
92
- src/m88k/ffi.c src/m88k/obsd.S \
93
- src/metag/ffi.c src/metag/sysv.S \
94
- src/microblaze/ffi.c src/microblaze/sysv.S \
95
- src/mips/ffi.c src/mips/o32.S src/mips/n32.S \
96
- src/moxie/ffi.c src/moxie/eabi.S \
97
- src/nios2/ffi.c src/nios2/sysv.S \
98
- src/or1k/ffi.c src/or1k/sysv.S \
99
- src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \
100
- src/powerpc/ffi.c src/powerpc/ffi_sysv.c src/powerpc/ffi_linux64.c \
101
- src/powerpc/sysv.S src/powerpc/linux64.S \
102
- src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S \
103
- src/powerpc/aix.S src/powerpc/darwin.S src/powerpc/aix_closure.S \
104
- src/powerpc/darwin_closure.S src/powerpc/ffi_darwin.c \
105
- src/riscv/ffi.c src/riscv/sysv.S \
106
- src/s390/ffi.c src/s390/sysv.S \
107
- src/sh/ffi.c src/sh/sysv.S \
108
- src/sh64/ffi.c src/sh64/sysv.S \
109
- src/sparc/ffi.c src/sparc/ffi64.c src/sparc/v8.S src/sparc/v9.S \
110
- src/tile/ffi.c src/tile/tile.S \
111
- src/vax/ffi.c src/vax/elfbsd.S \
112
- src/x86/ffi.c src/x86/sysv.S \
113
- src/x86/ffiw64.c src/x86/win64.S \
114
- src/x86/ffi64.c src/x86/unix64.S \
80
+ EXTRA_libffi_la_SOURCES = src/aarch64/ffi.c src/aarch64/sysv.S \
81
+ src/aarch64/win64_armasm.S src/alpha/ffi.c src/alpha/osf.S \
82
+ src/arc/ffi.c src/arc/arcompact.S src/arm/ffi.c \
83
+ src/arm/sysv.S src/arm/ffi.c src/arm/sysv_msvc_arm32.S \
84
+ src/avr32/ffi.c src/avr32/sysv.S src/bfin/ffi.c \
85
+ src/bfin/sysv.S src/cris/ffi.c src/cris/sysv.S src/frv/ffi.c \
86
+ src/frv/eabi.S src/ia64/ffi.c src/ia64/unix.S src/m32r/ffi.c \
87
+ src/m32r/sysv.S src/m68k/ffi.c src/m68k/sysv.S src/m88k/ffi.c \
88
+ src/m88k/obsd.S src/metag/ffi.c src/metag/sysv.S \
89
+ src/microblaze/ffi.c src/microblaze/sysv.S src/mips/ffi.c \
90
+ src/mips/o32.S src/mips/n32.S src/moxie/ffi.c \
91
+ src/moxie/eabi.S src/nios2/ffi.c src/nios2/sysv.S \
92
+ src/or1k/ffi.c src/or1k/sysv.S src/pa/ffi.c src/pa/linux.S \
93
+ src/pa/hpux32.S src/powerpc/ffi.c src/powerpc/ffi_sysv.c \
94
+ src/powerpc/ffi_linux64.c src/powerpc/sysv.S \
95
+ src/powerpc/linux64.S src/powerpc/linux64_closure.S \
96
+ src/powerpc/ppc_closure.S src/powerpc/aix.S \
97
+ src/powerpc/darwin.S src/powerpc/aix_closure.S \
98
+ src/powerpc/darwin_closure.S src/powerpc/ffi_darwin.c \
99
+ src/riscv/ffi.c src/riscv/sysv.S src/s390/ffi.c \
100
+ src/s390/sysv.S src/sh/ffi.c src/sh/sysv.S src/sh64/ffi.c \
101
+ src/sh64/sysv.S src/sparc/ffi.c src/sparc/ffi64.c \
102
+ src/sparc/v8.S src/sparc/v9.S src/tile/ffi.c src/tile/tile.S \
103
+ src/vax/ffi.c src/vax/elfbsd.S src/x86/ffi.c src/x86/sysv.S \
104
+ src/x86/ffiw64.c src/x86/win64.S src/x86/ffi64.c \
105
+ src/x86/unix64.S src/x86/sysv_intel.S src/x86/win64_intel.S \
115
106
  src/xtensa/ffi.c src/xtensa/sysv.S
116
107
 
117
108
  TARGET_OBJ = @TARGET_OBJ@
@@ -140,9 +131,9 @@ endif
140
131
  if LIBFFI_BUILD_VERSIONED_SHLIB_SUN
141
132
  libffi_version_script = -Wl,-M,libffi.map-sun
142
133
  libffi_version_dep = libffi.map-sun
143
- libffi.map-sun : libffi.map $(top_srcdir)/../contrib/make_sunver.pl \
134
+ libffi.map-sun : libffi.map $(top_srcdir)/make_sunver.pl \
144
135
  $(libffi_la_OBJECTS) $(libffi_la_LIBADD)
145
- perl $(top_srcdir)/../contrib/make_sunver.pl libffi.map \
136
+ perl $(top_srcdir)/make_sunver.pl libffi.map \
146
137
  `echo $(libffi_la_OBJECTS) $(libffi_la_LIBADD) | \
147
138
  sed 's,\([^/ ]*\)\.l\([ao]\),.libs/\1.\2,g'` \
148
139
  > $@ || (rm -f $@ ; exit 1)
@@ -164,3 +155,4 @@ AM_CCASFLAGS = $(AM_CPPFLAGS)
164
155
 
165
156
  dist-hook:
166
157
  if [ -d $(top_srcdir)/.git ] ; then (cd $(top_srcdir); git log --no-decorate) ; else echo 'See git log for history.' ; fi > $(distdir)/ChangeLog
158
+ s=`awk '/was released on/{ print NR; exit}' $(top_srcdir)/README.md`; tail -n +$$(($$s-1)) $(top_srcdir)/README.md > $(distdir)/README.md
@@ -4,7 +4,7 @@ Status
4
4
  [![Build Status](https://travis-ci.org/libffi/libffi.svg?branch=master)](https://travis-ci.org/libffi/libffi)
5
5
  [![Build status](https://ci.appveyor.com/api/projects/status/8lko9vagbx4w2kxq?svg=true)](https://ci.appveyor.com/project/atgreen/libffi)
6
6
 
7
- libffi-3.3-rc0 was released on April 2, 2018. Check the libffi web
7
+ libffi-3.3-rc2 was released on November 2, 2019. Check the libffi web
8
8
  page for updates: <URL:http://sourceware.org/libffi/>.
9
9
 
10
10
 
@@ -51,11 +51,13 @@ tested:
51
51
  | --------------- | ---------------- | ----------------------- |
52
52
  | AArch64 (ARM64) | iOS | Clang |
53
53
  | AArch64 | Linux | GCC |
54
+ | AArch64 | Windows | MSVC |
54
55
  | Alpha | Linux | GCC |
55
56
  | Alpha | Tru64 | GCC |
56
57
  | ARC | Linux | GCC |
57
58
  | ARM | Linux | GCC |
58
59
  | ARM | iOS | GCC |
60
+ | ARM | Windows | MSVC |
59
61
  | AVR32 | Linux | GCC |
60
62
  | Blackfin | uClinux | GCC |
61
63
  | HPPA | HPUX | GCC |
@@ -152,7 +154,7 @@ It's also possible to build libffi on Windows platforms with
152
154
  Microsoft's Visual C++ compiler. In this case, use the msvcc.sh
153
155
  wrapper script during configuration like so:
154
156
 
155
- path/to/configure CC=path/to/msvcc.sh CXX=path/to/msvcc.sh LD=link CPP="cl -nologo -EP"
157
+ path/to/configure CC=path/to/msvcc.sh CXX=path/to/msvcc.sh LD=link CPP="cl -nologo -EP" CPPFLAGS="-DFFI_BUILDING_DLL"
156
158
 
157
159
  For 64-bit Windows builds, use ``CC="path/to/msvcc.sh -m64"`` and
158
160
  ``CXX="path/to/msvcc.sh -m64"``. You may also need to specify
@@ -161,13 +163,18 @@ For 64-bit Windows builds, use ``CC="path/to/msvcc.sh -m64"`` and
161
163
  It is also possible to build libffi on Windows platforms with the LLVM
162
164
  project's clang-cl compiler, like below:
163
165
 
164
- path/to/configure CC="path/to/msvcc.sh -clang-cl" CXX="path/to/msvcc.sh -clang-cl" LD=link CPP="clang-cl -EP"
166
+ path/to/configure CC="path/to/msvcc.sh -clang-cl" CXX="path/to/msvcc.sh -clang-cl" LD=link CPP="clang-cl -EP"
165
167
 
166
168
  When building with MSVC under a MingW environment, you may need to
167
169
  remove the line in configure that sets 'fix_srcfile_path' to a 'cygpath'
168
170
  command. ('cygpath' is not present in MingW, and is not required when
169
171
  using MingW-style paths.)
170
172
 
173
+ To build static library for ARM64 with MSVC using visual studio solution, msvc_build folder have
174
+ aarch64/Ffi_staticLib.sln
175
+ required header files in aarch64/aarch64_include/
176
+
177
+
171
178
  SPARC Solaris builds require the use of the GNU assembler and linker.
172
179
  Point ``AS`` and ``LD`` environment variables at those tool prior to
173
180
  configuration.
@@ -194,9 +201,11 @@ See the git log for details at http://github.com/libffi/libffi.
194
201
  Add RISC-V support.
195
202
  New API in support of GO closures.
196
203
  Default to Microsoft's 64 bit long double ABI with Visual C++.
197
- GNU compiler uses 80 bits (128 in memory) FFI_GNUW64 ABI.
198
- Many new tests cases and bug fixes.
199
-
204
+ GNU compiler uses 80 bits (128 in memory) FFI_GNUW64 ABI.
205
+ Many new tests cases and bug fixes.
206
+ Add windows on arm64 (WOA) support.
207
+ Add Windows 32-bit arm support.
208
+
200
209
  3.2.1 Nov-12-14
201
210
  Build fix for non-iOS AArch64 targets.
202
211
 
@@ -2,7 +2,7 @@ dnl Process this with autoconf to create configure
2
2
 
3
3
  AC_PREREQ(2.68)
4
4
 
5
- AC_INIT([libffi], [3.3-rc0], [http://github.com/libffi/libffi/issues])
5
+ AC_INIT([libffi], [3.3-rc2], [http://github.com/libffi/libffi/issues])
6
6
  AC_CONFIG_HEADERS([fficonfig.h])
7
7
 
8
8
  AC_CANONICAL_SYSTEM
@@ -6,6 +6,11 @@
6
6
  # THIS TABLE IS SORTED. KEEP IT THAT WAY.
7
7
  # Most of the time we can define all the variables all at once...
8
8
  case "${host}" in
9
+ aarch64*-*-cygwin* | aarch64*-*-mingw* | aarch64*-*-win* )
10
+ TARGET=ARM_WIN64; TARGETDIR=aarch64
11
+ MSVC=1
12
+ ;;
13
+
9
14
  aarch64*-*-*)
10
15
  TARGET=AARCH64; TARGETDIR=aarch64
11
16
  SOURCES="ffi.c sysv.S"
@@ -23,6 +28,11 @@ case "${host}" in
23
28
  SOURCES="ffi.c arcompact.S"
24
29
  ;;
25
30
 
31
+ arm*-*-cygwin* | arm*-*-mingw* | arm*-*-win* )
32
+ TARGET=ARM_WIN32; TARGETDIR=arm
33
+ MSVC=1
34
+ ;;
35
+
26
36
  arm*-*-*)
27
37
  TARGET=ARM; TARGETDIR=arm
28
38
  SOURCES="ffi.c sysv.S"
@@ -74,12 +84,6 @@ case "${host}" in
74
84
  fi
75
85
  if test "${ax_cv_c_compiler_vendor}" = "microsoft"; then
76
86
  MSVC=1
77
- if test $ac_cv_sizeof_size_t = 4; then
78
- # libffi does not support microsoft tools for 32-bit windows
79
- # hosts. Try porting src/x86/sysv.S to intel assembly
80
- # format.
81
- UNSUPPORTED=1
82
- fi
83
87
  fi
84
88
  # All mingw/cygwin/win32 builds require -no-undefined for sharedlib.
85
89
  # We must also check with_cross_host to decide if this is a native
@@ -248,6 +252,12 @@ esac
248
252
 
249
253
  # ... but some of the cases above share configury.
250
254
  case "${TARGET}" in
255
+ ARM_WIN32)
256
+ SOURCES="ffi.c sysv_msvc_arm32.S"
257
+ ;;
258
+ ARM_WIN64)
259
+ SOURCES="ffi.c win64_armasm.S"
260
+ ;;
251
261
  MIPS)
252
262
  SOURCES="ffi.c o32.S n32.S"
253
263
  ;;
@@ -265,7 +275,11 @@ case "${TARGET}" in
265
275
  SOURCES="ffi.c ffi_sysv.c sysv.S ppc_closure.S"
266
276
  ;;
267
277
  X86 | X86_DARWIN | X86_FREEBSD | X86_WIN32)
268
- SOURCES="ffi.c sysv.S"
278
+ if test "$MSVC" = 1; then
279
+ SOURCES="ffi.c sysv_intel.S"
280
+ else
281
+ SOURCES="ffi.c sysv.S"
282
+ fi
269
283
  ;;
270
284
  X86_64)
271
285
  if test x"$TARGET_X32" = xyes; then
@@ -283,11 +283,13 @@ FFI_API size_t ffi_raw_size (ffi_cif *cif);
283
283
  packing, even on 64-bit machines. I.e. on 64-bit machines longs
284
284
  and doubles are followed by an empty 64-bit word. */
285
285
 
286
+ #if !FFI_NATIVE_RAW_API
286
287
  FFI_API
287
288
  void ffi_java_raw_call (ffi_cif *cif,
288
289
  void (*fn)(void),
289
290
  void *rvalue,
290
291
  ffi_java_raw *avalue);
292
+ #endif
291
293
 
292
294
  FFI_API
293
295
  void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw);
@@ -414,6 +416,7 @@ ffi_prep_raw_closure_loc (ffi_raw_closure*,
414
416
  void *user_data,
415
417
  void *codeloc);
416
418
 
419
+ #if !FFI_NATIVE_RAW_API
417
420
  FFI_API ffi_status
418
421
  ffi_prep_java_raw_closure (ffi_java_raw_closure*,
419
422
  ffi_cif *cif,
@@ -426,6 +429,7 @@ ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
426
429
  void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
427
430
  void *user_data,
428
431
  void *codeloc);
432
+ #endif
429
433
 
430
434
  #endif /* FFI_CLOSURES */
431
435
 
@@ -99,6 +99,10 @@ ffi_status ffi_prep_cif_core(ffi_cif *cif,
99
99
  ffi_type *rtype,
100
100
  ffi_type **atypes);
101
101
 
102
+ /* Translate a data pointer to a code pointer. Needed for closures on
103
+ some targets. */
104
+ void *ffi_data_to_code_pointer (void *data) FFI_HIDDEN;
105
+
102
106
  /* Extended cif, used in callback from assembly routine */
103
107
  typedef struct
104
108
  {
@@ -2,7 +2,7 @@ AC_DEFUN([GCC_AS_CFI_PSEUDO_OP],
2
2
  [AC_CACHE_CHECK([assembler .cfi pseudo-op support],
3
3
  gcc_cv_as_cfi_pseudo_op, [
4
4
  gcc_cv_as_cfi_pseudo_op=unknown
5
- AC_TRY_COMPILE([asm (".cfi_startproc\n\t.cfi_endproc");],,
5
+ AC_TRY_COMPILE([asm (".cfi_sections\n\t.cfi_startproc\n\t.cfi_endproc");],,
6
6
  [gcc_cv_as_cfi_pseudo_op=yes],
7
7
  [gcc_cv_as_cfi_pseudo_op=no])
8
8
  ])
@@ -0,0 +1,333 @@
1
+ #!/usr/bin/perl -w
2
+
3
+ # make_sunver.pl
4
+ #
5
+ # This script takes at least two arguments, a GNU style version script and
6
+ # a list of object and archive files, and generates a corresponding Sun
7
+ # style version script as follows:
8
+ #
9
+ # Each glob pattern, C++ mangled pattern or literal in the input script is
10
+ # matched against all global symbols in the input objects, emitting those
11
+ # that matched (or nothing if no match was found).
12
+ # A comment with the original pattern and its type is left in the output
13
+ # file to make it easy to understand the matches.
14
+ #
15
+ # It uses elfdump when present (native), GNU readelf otherwise.
16
+ # It depends on the GNU version of c++filt, since it must understand the
17
+ # GNU mangling style.
18
+
19
+ use FileHandle;
20
+ use IPC::Open2;
21
+
22
+ # Enforce C locale.
23
+ $ENV{'LC_ALL'} = "C";
24
+ $ENV{'LANG'} = "C";
25
+
26
+ # Input version script, GNU style.
27
+ my $symvers = shift;
28
+
29
+ ##########
30
+ # Get all the symbols from the library, match them, and add them to a hash.
31
+
32
+ my %sym_hash = ();
33
+
34
+ # List of objects and archives to process.
35
+ my @OBJECTS = ();
36
+
37
+ # List of shared objects to omit from processing.
38
+ my @SHAREDOBJS = ();
39
+
40
+ # Filter out those input archives that have corresponding shared objects to
41
+ # avoid adding all symbols matched in the archive to the output map.
42
+ foreach $file (@ARGV) {
43
+ if (($so = $file) =~ s/\.a$/.so/ && -e $so) {
44
+ printf STDERR "omitted $file -> $so\n";
45
+ push (@SHAREDOBJS, $so);
46
+ } else {
47
+ push (@OBJECTS, $file);
48
+ }
49
+ }
50
+
51
+ # We need to detect and ignore hidden symbols. Solaris nm can only detect
52
+ # this in the harder to parse default output format, and GNU nm not at all,
53
+ # so use elfdump -s in the native case and GNU readelf -s otherwise.
54
+ # GNU objdump -t cannot be used since it produces a variable number of
55
+ # columns.
56
+
57
+ # The path to elfdump.
58
+ my $elfdump = "/usr/ccs/bin/elfdump";
59
+
60
+ if (-f $elfdump) {
61
+ open ELFDUMP,$elfdump.' -s '.(join ' ',@OBJECTS).'|' or die $!;
62
+ my $skip_arsym = 0;
63
+
64
+ while (<ELFDUMP>) {
65
+ chomp;
66
+
67
+ # Ignore empty lines.
68
+ if (/^$/) {
69
+ # End of archive symbol table, stop skipping.
70
+ $skip_arsym = 0 if $skip_arsym;
71
+ next;
72
+ }
73
+
74
+ # Keep skipping until end of archive symbol table.
75
+ next if ($skip_arsym);
76
+
77
+ # Ignore object name header for individual objects and archives.
78
+ next if (/:$/);
79
+
80
+ # Ignore table header lines.
81
+ next if (/^Symbol Table Section:/);
82
+ next if (/index.*value.*size/);
83
+
84
+ # Start of archive symbol table: start skipping.
85
+ if (/^Symbol Table: \(archive/) {
86
+ $skip_arsym = 1;
87
+ next;
88
+ }
89
+
90
+ # Split table.
91
+ (undef, undef, undef, undef, $bind, $oth, undef, $shndx, $name) = split;
92
+
93
+ # Error out for unknown input.
94
+ die "unknown input line:\n$_" unless defined($bind);
95
+
96
+ # Ignore local symbols.
97
+ next if ($bind eq "LOCL");
98
+ # Ignore hidden symbols.
99
+ next if ($oth eq "H");
100
+ # Ignore undefined symbols.
101
+ next if ($shndx eq "UNDEF");
102
+ # Error out for unhandled cases.
103
+ if ($bind !~ /^(GLOB|WEAK)/ or $oth ne "D") {
104
+ die "unhandled symbol:\n$_";
105
+ }
106
+
107
+ # Remember symbol.
108
+ $sym_hash{$name}++;
109
+ }
110
+ close ELFDUMP or die "$elfdump error";
111
+ } else {
112
+ open READELF, 'readelf -s -W '.(join ' ',@OBJECTS).'|' or die $!;
113
+ # Process each symbol.
114
+ while (<READELF>) {
115
+ chomp;
116
+
117
+ # Ignore empty lines.
118
+ next if (/^$/);
119
+
120
+ # Ignore object name header.
121
+ next if (/^File: .*$/);
122
+
123
+ # Ignore table header lines.
124
+ next if (/^Symbol table.*contains.*:/);
125
+ next if (/Num:.*Value.*Size/);
126
+
127
+ # Split table.
128
+ (undef, undef, undef, undef, $bind, $vis, $ndx, $name) = split;
129
+
130
+ # Error out for unknown input.
131
+ die "unknown input line:\n$_" unless defined($bind);
132
+
133
+ # Ignore local symbols.
134
+ next if ($bind eq "LOCAL");
135
+ # Ignore hidden symbols.
136
+ next if ($vis eq "HIDDEN");
137
+ # Ignore undefined symbols.
138
+ next if ($ndx eq "UND");
139
+ # Error out for unhandled cases.
140
+ if ($bind !~ /^(GLOBAL|WEAK)/ or $vis ne "DEFAULT") {
141
+ die "unhandled symbol:\n$_";
142
+ }
143
+
144
+ # Remember symbol.
145
+ $sym_hash{$name}++;
146
+ }
147
+ close READELF or die "readelf error";
148
+ }
149
+
150
+ ##########
151
+ # The various types of glob patterns.
152
+ #
153
+ # A glob pattern that is to be applied to the demangled name: 'cxx'.
154
+ # A glob patterns that applies directly to the name in the .o files: 'glob'.
155
+ # This pattern is ignored; used for local variables (usually just '*'): 'ign'.
156
+
157
+ # The type of the current pattern.
158
+ my $glob = 'glob';
159
+
160
+ # We're currently inside `extern "C++"', which Sun ld doesn't understand.
161
+ my $in_extern = 0;
162
+
163
+ # The c++filt command to use. This *must* be GNU c++filt; the Sun Studio
164
+ # c++filt doesn't handle the GNU mangling style.
165
+ my $cxxfilt = $ENV{'CXXFILT'} || "c++filt";
166
+
167
+ # The current version name.
168
+ my $current_version = "";
169
+
170
+ # Was there any attempt to match a symbol to this version?
171
+ my $matches_attempted;
172
+
173
+ # The number of versions which matched this symbol.
174
+ my $matched_symbols;
175
+
176
+ open F,$symvers or die $!;
177
+
178
+ # Print information about generating this file
179
+ print "# This file was generated by make_sunver.pl. DO NOT EDIT!\n";
180
+ print "# It was generated by:\n";
181
+ printf "# %s %s %s\n", $0, $symvers, (join ' ',@ARGV);
182
+ printf "# Omitted archives with corresponding shared libraries: %s\n",
183
+ (join ' ', @SHAREDOBJS) if $#SHAREDOBJS >= 0;
184
+ print "#\n\n";
185
+
186
+ while (<F>) {
187
+ # Lines of the form '};'
188
+ if (/^([ \t]*)(\}[ \t]*;[ \t]*)$/) {
189
+ $glob = 'glob';
190
+ if ($in_extern) {
191
+ $in_extern--;
192
+ print "$1##$2\n";
193
+ } else {
194
+ print;
195
+ }
196
+ next;
197
+ }
198
+
199
+ # Lines of the form '} SOME_VERSION_NAME_1.0;'
200
+ if (/^[ \t]*\}[ \tA-Z0-9_.a-z]+;[ \t]*$/) {
201
+ $glob = 'glob';
202
+ # We tried to match symbols agains this version, but none matched.
203
+ # Emit dummy hidden symbol to avoid marking this version WEAK.
204
+ if ($matches_attempted && $matched_symbols == 0) {
205
+ print " hidden:\n";
206
+ print " .force_WEAK_off_$current_version = DATA S0x0 V0x0;\n";
207
+ }
208
+ print; next;
209
+ }
210
+
211
+ # Comment and blank lines
212
+ if (/^[ \t]*\#/) { print; next; }
213
+ if (/^[ \t]*$/) { print; next; }
214
+
215
+ # Lines of the form '{'
216
+ if (/^([ \t]*){$/) {
217
+ if ($in_extern) {
218
+ print "$1##{\n";
219
+ } else {
220
+ print;
221
+ }
222
+ next;
223
+ }
224
+
225
+ # Lines of the form 'SOME_VERSION_NAME_1.1 {'
226
+ if (/^([A-Z0-9_.]+)[ \t]+{$/) {
227
+ # Record version name.
228
+ $current_version = $1;
229
+ # Reset match attempts, #matched symbols for this version.
230
+ $matches_attempted = 0;
231
+ $matched_symbols = 0;
232
+ print;
233
+ next;
234
+ }
235
+
236
+ # Ignore 'global:'
237
+ if (/^[ \t]*global:$/) { print; next; }
238
+
239
+ # After 'local:', globs should be ignored, they won't be exported.
240
+ if (/^[ \t]*local:$/) {
241
+ $glob = 'ign';
242
+ print;
243
+ next;
244
+ }
245
+
246
+ # After 'extern "C++"', globs are C++ patterns
247
+ if (/^([ \t]*)(extern \"C\+\+\"[ \t]*)$/) {
248
+ $in_extern++;
249
+ $glob = 'cxx';
250
+ # Need to comment, Sun ld cannot handle this.
251
+ print "$1##$2\n"; next;
252
+ }
253
+
254
+ # Chomp newline now we're done with passing through the input file.
255
+ chomp;
256
+
257
+ # Catch globs. Note that '{}' is not allowed in globs by this script,
258
+ # so only '*' and '[]' are available.
259
+ if (/^([ \t]*)([^ \t;{}#]+);?[ \t]*$/) {
260
+ my $ws = $1;
261
+ my $ptn = $2;
262
+ # Turn the glob into a regex by replacing '*' with '.*', '?' with '.'.
263
+ # Keep $ptn so we can still print the original form.
264
+ ($pattern = $ptn) =~ s/\*/\.\*/g;
265
+ $pattern =~ s/\?/\./g;
266
+
267
+ if ($glob eq 'ign') {
268
+ # We're in a local: * section; just continue.
269
+ print "$_\n";
270
+ next;
271
+ }
272
+
273
+ # Print the glob commented for human readers.
274
+ print "$ws##$ptn ($glob)\n";
275
+ # We tried to match a symbol to this version.
276
+ $matches_attempted++;
277
+
278
+ if ($glob eq 'glob') {
279
+ my %ptn_syms = ();
280
+
281
+ # Match ptn against symbols in %sym_hash.
282
+ foreach my $sym (keys %sym_hash) {
283
+ # Maybe it matches one of the patterns based on the symbol in
284
+ # the .o file.
285
+ $ptn_syms{$sym}++ if ($sym =~ /^$pattern$/);
286
+ }
287
+
288
+ foreach my $sym (sort keys(%ptn_syms)) {
289
+ $matched_symbols++;
290
+ print "$ws$sym;\n";
291
+ }
292
+ } elsif ($glob eq 'cxx') {
293
+ my %dem_syms = ();
294
+
295
+ # Verify that we're actually using GNU c++filt. Other versions
296
+ # most likely cannot handle GNU style symbol mangling.
297
+ my $cxxout = `$cxxfilt --version 2>&1`;
298
+ $cxxout =~ m/GNU/ or die "$0 requires GNU c++filt to function";
299
+
300
+ # Talk to c++filt through a pair of file descriptors.
301
+ # Need to start a fresh instance per pattern, otherwise the
302
+ # process grows to 500+ MB.
303
+ my $pid = open2(*FILTIN, *FILTOUT, $cxxfilt) or die $!;
304
+
305
+ # Match ptn against symbols in %sym_hash.
306
+ foreach my $sym (keys %sym_hash) {
307
+ # No? Well, maybe its demangled form matches one of those
308
+ # patterns.
309
+ printf FILTOUT "%s\n",$sym;
310
+ my $dem = <FILTIN>;
311
+ chomp $dem;
312
+ $dem_syms{$sym}++ if ($dem =~ /^$pattern$/);
313
+ }
314
+
315
+ close FILTOUT or die "c++filt error";
316
+ close FILTIN or die "c++filt error";
317
+ # Need to wait for the c++filt process to avoid lots of zombies.
318
+ waitpid $pid, 0;
319
+
320
+ foreach my $sym (sort keys(%dem_syms)) {
321
+ $matched_symbols++;
322
+ print "$ws$sym;\n";
323
+ }
324
+ } else {
325
+ # No? Well, then ignore it.
326
+ }
327
+ next;
328
+ }
329
+ # Important sanity check. This script can't handle lots of formats
330
+ # that GNU ld can, so be sure to error out if one is seen!
331
+ die "strange line `$_'";
332
+ }
333
+ close F;