ffi 1.12.2 → 1.15.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +132 -0
  3. data/Gemfile +1 -2
  4. data/README.md +14 -2
  5. data/Rakefile +46 -65
  6. data/ext/ffi_c/AbstractMemory.c +24 -25
  7. data/ext/ffi_c/Buffer.c +4 -9
  8. data/ext/ffi_c/Call.c +3 -15
  9. data/ext/ffi_c/ClosurePool.c +75 -25
  10. data/ext/ffi_c/ClosurePool.h +3 -1
  11. data/ext/ffi_c/DynamicLibrary.c +1 -6
  12. data/ext/ffi_c/Function.c +38 -38
  13. data/ext/ffi_c/Function.h +0 -4
  14. data/ext/ffi_c/FunctionInfo.c +3 -8
  15. data/ext/ffi_c/LastError.c +2 -6
  16. data/ext/ffi_c/LongDouble.c +5 -3
  17. data/ext/ffi_c/LongDouble.h +0 -4
  18. data/ext/ffi_c/MemoryPointer.c +3 -8
  19. data/ext/ffi_c/MemoryPointer.h +0 -4
  20. data/ext/ffi_c/MethodHandle.c +21 -31
  21. data/ext/ffi_c/MethodHandle.h +3 -2
  22. data/ext/ffi_c/Platform.c +3 -7
  23. data/ext/ffi_c/Pointer.c +25 -26
  24. data/ext/ffi_c/Pointer.h +0 -4
  25. data/ext/ffi_c/Struct.c +3 -6
  26. data/ext/ffi_c/StructByValue.c +2 -7
  27. data/ext/ffi_c/StructLayout.c +9 -8
  28. data/ext/ffi_c/Thread.c +0 -8
  29. data/ext/ffi_c/Thread.h +1 -9
  30. data/ext/ffi_c/Type.c +1 -1
  31. data/ext/ffi_c/Types.c +6 -7
  32. data/ext/ffi_c/Types.h +3 -4
  33. data/ext/ffi_c/Variadic.c +14 -9
  34. data/ext/ffi_c/compat.h +4 -0
  35. data/ext/ffi_c/extconf.rb +36 -23
  36. data/ext/ffi_c/libffi/.travis.yml +4 -0
  37. data/ext/ffi_c/libffi/.travis/bfin-sim.exp +1 -1
  38. data/ext/ffi_c/libffi/.travis/build.sh +4 -0
  39. data/ext/ffi_c/libffi/.travis/m32r-sim.exp +1 -1
  40. data/ext/ffi_c/libffi/.travis/moxie-sim.exp +1 -1
  41. data/ext/ffi_c/libffi/.travis/or1k-sim.exp +1 -1
  42. data/ext/ffi_c/libffi/.travis/powerpc-eabisim.exp +1 -1
  43. data/ext/ffi_c/libffi/.travis/wine-sim.exp +1 -1
  44. data/ext/ffi_c/libffi/Makefile.am +49 -58
  45. data/ext/ffi_c/libffi/Makefile.in +93 -58
  46. data/ext/ffi_c/libffi/README.md +11 -1
  47. data/ext/ffi_c/libffi/config.guess +552 -331
  48. data/ext/ffi_c/libffi/config.sub +1321 -1306
  49. data/ext/ffi_c/libffi/configure +120 -24
  50. data/ext/ffi_c/libffi/configure.ac +31 -10
  51. data/ext/ffi_c/libffi/configure.host +32 -20
  52. data/ext/ffi_c/libffi/fficonfig.h.in +9 -0
  53. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +1 -1
  54. data/ext/ffi_c/libffi/include/ffi.h.in +8 -0
  55. data/ext/ffi_c/libffi/libffi.map.in +8 -12
  56. data/ext/ffi_c/libffi/libtool-version +1 -1
  57. data/ext/ffi_c/libffi/ltmain.sh +6 -4
  58. data/ext/ffi_c/libffi/msvcc.sh +11 -11
  59. data/ext/ffi_c/libffi/src/aarch64/ffi.c +51 -35
  60. data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +10 -5
  61. data/ext/ffi_c/libffi/src/aarch64/internal.h +1 -0
  62. data/ext/ffi_c/libffi/src/aarch64/sysv.S +14 -3
  63. data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +1 -1
  64. data/ext/ffi_c/libffi/src/arm/ffi.c +22 -0
  65. data/ext/ffi_c/libffi/src/arm/sysv.S +4 -4
  66. data/ext/ffi_c/libffi/src/closures.c +33 -10
  67. data/ext/ffi_c/libffi/src/csky/ffi.c +395 -0
  68. data/ext/ffi_c/libffi/src/csky/ffitarget.h +63 -0
  69. data/ext/ffi_c/libffi/src/csky/sysv.S +371 -0
  70. data/ext/ffi_c/libffi/src/dlmalloc.c +1 -1
  71. data/ext/ffi_c/libffi/src/kvx/asm.h +5 -0
  72. data/ext/ffi_c/libffi/src/kvx/ffi.c +273 -0
  73. data/ext/ffi_c/libffi/src/kvx/ffitarget.h +75 -0
  74. data/ext/ffi_c/libffi/src/kvx/sysv.S +127 -0
  75. data/ext/ffi_c/libffi/src/mips/ffi.c +5 -1
  76. data/ext/ffi_c/libffi/src/mips/ffitarget.h +1 -1
  77. data/ext/ffi_c/libffi/src/pa/ffi.c +46 -91
  78. data/ext/ffi_c/libffi/src/pa/ffitarget.h +1 -6
  79. data/ext/ffi_c/libffi/src/pa/hpux32.S +4 -2
  80. data/ext/ffi_c/libffi/src/pa/linux.S +4 -2
  81. data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +13 -1
  82. data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +1 -1
  83. data/ext/ffi_c/libffi/src/powerpc/linux64.S +8 -0
  84. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +13 -1
  85. data/ext/ffi_c/libffi/src/powerpc/sysv.S +5 -7
  86. data/ext/ffi_c/libffi/src/prep_cif.c +1 -1
  87. data/ext/ffi_c/libffi/src/x86/ffi.c +15 -6
  88. data/ext/ffi_c/libffi/src/x86/ffi64.c +17 -8
  89. data/ext/ffi_c/libffi/src/x86/ffitarget.h +15 -2
  90. data/ext/ffi_c/libffi/src/x86/ffiw64.c +15 -8
  91. data/ext/ffi_c/libffi/src/x86/sysv.S +15 -6
  92. data/ext/ffi_c/libffi/src/x86/unix64.S +59 -4
  93. data/ext/ffi_c/libffi/src/x86/win64.S +7 -3
  94. data/ext/ffi_c/libffi/src/x86/win64_intel.S +3 -2
  95. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +22 -2
  96. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +4 -4
  97. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +2 -2
  98. data/ext/ffi_c/libffi/testsuite/libffi.closures/huge_struct.c +2 -0
  99. data/ffi.gemspec +2 -2
  100. data/lib/ffi.rb +10 -3
  101. data/lib/ffi/abstract_memory.rb +44 -0
  102. data/lib/ffi/autopointer.rb +1 -1
  103. data/lib/ffi/ffi.rb +1 -0
  104. data/lib/ffi/io.rb +3 -3
  105. data/lib/ffi/library.rb +7 -3
  106. data/lib/ffi/managedstruct.rb +2 -2
  107. data/lib/ffi/platform.rb +18 -8
  108. data/lib/ffi/platform/aarch64-darwin/types.conf +130 -0
  109. data/lib/ffi/platform/aarch64-freebsd/types.conf +2 -2
  110. data/lib/ffi/platform/aarch64-freebsd12/types.conf +113 -60
  111. data/lib/ffi/platform/aarch64-openbsd/types.conf +134 -0
  112. data/lib/ffi/platform/arm-linux/types.conf +32 -4
  113. data/lib/ffi/platform/i386-windows/types.conf +26 -79
  114. data/lib/ffi/platform/powerpc-linux/types.conf +32 -2
  115. data/lib/ffi/platform/powerpc-openbsd/types.conf +156 -0
  116. data/lib/ffi/platform/powerpc64le-linux/types.conf +100 -0
  117. data/lib/ffi/platform/riscv64-linux/types.conf +104 -0
  118. data/lib/ffi/platform/sparcv9-openbsd/types.conf +156 -0
  119. data/lib/ffi/platform/x86_64-darwin/types.conf +4 -0
  120. data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +4 -22
  121. data/lib/ffi/platform/x86_64-haiku/types.conf +117 -0
  122. data/lib/ffi/platform/x86_64-linux/types.conf +21 -0
  123. data/lib/ffi/platform/x86_64-msys/types.conf +119 -0
  124. data/lib/ffi/platform/x86_64-windows/types.conf +10 -78
  125. data/lib/ffi/pointer.rb +21 -14
  126. data/lib/ffi/struct.rb +8 -2
  127. data/lib/ffi/tools/const_generator.rb +2 -1
  128. data/lib/ffi/tools/struct_generator.rb +2 -1
  129. data/lib/ffi/tools/types_generator.rb +2 -0
  130. data/lib/ffi/variadic.rb +1 -10
  131. data/lib/ffi/version.rb +1 -1
  132. data/rakelib/ffi_gem_helper.rb +65 -0
  133. data/samples/getlogin.rb +1 -1
  134. data/samples/getpid.rb +1 -1
  135. data/samples/gettimeofday.rb +8 -8
  136. data/samples/hello.rb +2 -1
  137. data/samples/inotify.rb +1 -1
  138. data/samples/pty.rb +1 -2
  139. data/samples/qsort.rb +0 -1
  140. metadata +21 -12
  141. data/.appveyor.yml +0 -27
  142. data/.gitignore +0 -25
  143. data/.gitmodules +0 -4
  144. data/.travis.yml +0 -44
  145. data/.yardopts +0 -5
  146. data/ext/ffi_c/win32/stdbool.h +0 -8
  147. data/ext/ffi_c/win32/stdint.h +0 -201
  148. data/samples/sample_helper.rb +0 -6
@@ -7174,8 +7174,11 @@ _LT_EOF
7174
7174
  test $ac_status = 0; }; then
7175
7175
  # Now try to grab the symbols.
7176
7176
  nlist=conftest.nm
7177
- $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&5
7178
- if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&5 && test -s "$nlist"; then
7177
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
7178
+ (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
7179
+ ac_status=$?
7180
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
7181
+ test $ac_status = 0; } && test -s "$nlist"; then
7179
7182
  # Try sorting and uniquifying the output.
7180
7183
  if sort "$nlist" | uniq > "$nlist"T; then
7181
7184
  mv -f "$nlist"T "$nlist"
@@ -9535,12 +9538,6 @@ lt_prog_compiler_static=
9535
9538
  lt_prog_compiler_pic='-KPIC'
9536
9539
  lt_prog_compiler_static='-static'
9537
9540
  ;;
9538
- # flang / f18. f95 an alias for gfortran or flang on Debian
9539
- flang* | f18* | f95*)
9540
- lt_prog_compiler_wl='-Wl,'
9541
- lt_prog_compiler_pic='-fPIC'
9542
- lt_prog_compiler_static='-static'
9543
- ;;
9544
9541
  # icc used to be incompatible with GCC.
9545
9542
  # ICC 10 doesn't accept -KPIC any more.
9546
9543
  icc* | ifort*)
@@ -13483,7 +13480,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
13483
13480
  # Commands to make compiler produce verbose output that lists
13484
13481
  # what "hidden" libraries, object files and flags are used when
13485
13482
  # linking a shared library.
13486
- output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
13483
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
13487
13484
 
13488
13485
  else
13489
13486
  GXX=no
@@ -13975,7 +13972,7 @@ fi
13975
13972
  # explicitly linking system object files so we need to strip them
13976
13973
  # from the output so that they don't get included in the library
13977
13974
  # dependencies.
13978
- output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
13975
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
13979
13976
  ;;
13980
13977
  *)
13981
13978
  if test yes = "$GXX"; then
@@ -14040,7 +14037,7 @@ fi
14040
14037
  # explicitly linking system object files so we need to strip them
14041
14038
  # from the output so that they don't get included in the library
14042
14039
  # dependencies.
14043
- output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
14040
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
14044
14041
  ;;
14045
14042
  *)
14046
14043
  if test yes = "$GXX"; then
@@ -14379,7 +14376,7 @@ fi
14379
14376
  # Commands to make compiler produce verbose output that lists
14380
14377
  # what "hidden" libraries, object files and flags are used when
14381
14378
  # linking a shared library.
14382
- output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
14379
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
14383
14380
 
14384
14381
  else
14385
14382
  # FIXME: insert proper C++ library support
@@ -14463,7 +14460,7 @@ fi
14463
14460
  # Commands to make compiler produce verbose output that lists
14464
14461
  # what "hidden" libraries, object files and flags are used when
14465
14462
  # linking a shared library.
14466
- output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
14463
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
14467
14464
  else
14468
14465
  # g++ 2.7 appears to require '-G' NOT '-shared' on this
14469
14466
  # platform.
@@ -14474,7 +14471,7 @@ fi
14474
14471
  # Commands to make compiler produce verbose output that lists
14475
14472
  # what "hidden" libraries, object files and flags are used when
14476
14473
  # linking a shared library.
14477
- output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
14474
+ output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
14478
14475
  fi
14479
14476
 
14480
14477
  hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir'
@@ -17468,6 +17465,30 @@ fi
17468
17465
 
17469
17466
 
17470
17467
 
17468
+ for ac_header in sys/memfd.h
17469
+ do :
17470
+ ac_fn_c_check_header_mongrel "$LINENO" "sys/memfd.h" "ac_cv_header_sys_memfd_h" "$ac_includes_default"
17471
+ if test "x$ac_cv_header_sys_memfd_h" = xyes; then :
17472
+ cat >>confdefs.h <<_ACEOF
17473
+ #define HAVE_SYS_MEMFD_H 1
17474
+ _ACEOF
17475
+
17476
+ fi
17477
+
17478
+ done
17479
+
17480
+ for ac_func in memfd_create
17481
+ do :
17482
+ ac_fn_c_check_func "$LINENO" "memfd_create" "ac_cv_func_memfd_create"
17483
+ if test "x$ac_cv_func_memfd_create" = xyes; then :
17484
+ cat >>confdefs.h <<_ACEOF
17485
+ #define HAVE_MEMFD_CREATE 1
17486
+ _ACEOF
17487
+
17488
+ fi
17489
+ done
17490
+
17491
+
17471
17492
  for ac_header in sys/mman.h
17472
17493
  do :
17473
17494
  ac_fn_c_check_header_mongrel "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default"
@@ -18451,6 +18472,50 @@ $as_echo "#define HAVE_AS_S390_ZARCH 1" >>confdefs.h
18451
18472
  ;;
18452
18473
  esac
18453
18474
 
18475
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports pointer authentication" >&5
18476
+ $as_echo_n "checking whether compiler supports pointer authentication... " >&6; }
18477
+ if ${libffi_cv_as_ptrauth+:} false; then :
18478
+ $as_echo_n "(cached) " >&6
18479
+ else
18480
+
18481
+ libffi_cv_as_ptrauth=unknown
18482
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
18483
+ /* end confdefs.h. */
18484
+
18485
+ int
18486
+ main ()
18487
+ {
18488
+
18489
+ #ifdef __clang__
18490
+ # if __has_feature(ptrauth_calls)
18491
+ # define HAVE_PTRAUTH 1
18492
+ # endif
18493
+ #endif
18494
+
18495
+ #ifndef HAVE_PTRAUTH
18496
+ # error Pointer authentication not supported
18497
+ #endif
18498
+
18499
+ ;
18500
+ return 0;
18501
+ }
18502
+ _ACEOF
18503
+ if ac_fn_c_try_compile "$LINENO"; then :
18504
+ libffi_cv_as_ptrauth=yes
18505
+ else
18506
+ libffi_cv_as_ptrauth=no
18507
+ fi
18508
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
18509
+
18510
+ fi
18511
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_ptrauth" >&5
18512
+ $as_echo "$libffi_cv_as_ptrauth" >&6; }
18513
+ if test "x$libffi_cv_as_ptrauth" = xyes; then
18514
+
18515
+ $as_echo "#define HAVE_PTRAUTH 1" >>confdefs.h
18516
+
18517
+ fi
18518
+
18454
18519
  # On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC.
18455
18520
  # Check whether --enable-pax_emutramp was given.
18456
18521
  if test "${enable_pax_emutramp+set}" = set; then :
@@ -18579,23 +18644,53 @@ $as_echo "#define HAVE_AS_X86_64_UNWIND_SECTION_TYPE 1" >>confdefs.h
18579
18644
  fi
18580
18645
 
18581
18646
  if test "x$GCC" = "xyes"; then
18647
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fno-lto" >&5
18648
+ $as_echo_n "checking whether C compiler accepts -fno-lto... " >&6; }
18649
+ if ${ax_cv_check_cflags___fno_lto+:} false; then :
18650
+ $as_echo_n "(cached) " >&6
18651
+ else
18652
+
18653
+ ax_check_save_flags=$CFLAGS
18654
+ CFLAGS="$CFLAGS -fno-lto"
18655
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
18656
+ /* end confdefs.h. */
18657
+
18658
+ int
18659
+ main ()
18660
+ {
18661
+
18662
+ ;
18663
+ return 0;
18664
+ }
18665
+ _ACEOF
18666
+ if ac_fn_c_try_compile "$LINENO"; then :
18667
+ ax_cv_check_cflags___fno_lto=yes
18668
+ else
18669
+ ax_cv_check_cflags___fno_lto=no
18670
+ fi
18671
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
18672
+ CFLAGS=$ax_check_save_flags
18673
+ fi
18674
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fno_lto" >&5
18675
+ $as_echo "$ax_cv_check_cflags___fno_lto" >&6; }
18676
+ if test "x$ax_cv_check_cflags___fno_lto" = xyes; then :
18677
+ libffi_cv_no_lto=-fno-lto
18678
+ else
18679
+ :
18680
+ fi
18681
+
18682
+
18582
18683
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether .eh_frame section should be read-only" >&5
18583
18684
  $as_echo_n "checking whether .eh_frame section should be read-only... " >&6; }
18584
18685
  if ${libffi_cv_ro_eh_frame+:} false; then :
18585
18686
  $as_echo_n "(cached) " >&6
18586
18687
  else
18587
18688
 
18588
- libffi_cv_ro_eh_frame=no
18689
+ libffi_cv_ro_eh_frame=yes
18589
18690
  echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
18590
- if $CC $CFLAGS -c -fpic -fexceptions -o conftest.o conftest.c > /dev/null 2>&1; then
18591
- objdump -h conftest.o > conftest.dump 2>&1
18592
- libffi_eh_frame_line=`grep -n eh_frame conftest.dump | cut -d: -f 1`
18593
- if test "x$libffi_eh_frame_line" != "x"; then
18594
- libffi_test_line=`expr $libffi_eh_frame_line + 1`p
18595
- sed -n $libffi_test_line conftest.dump > conftest.line
18596
- if grep READONLY conftest.line > /dev/null; then
18597
- libffi_cv_ro_eh_frame=yes
18598
- fi
18691
+ if $CC $CFLAGS -c -fpic -fexceptions $libffi_cv_no_lto -o conftest.o conftest.c > /dev/null 2>&1; then
18692
+ if readelf -WS conftest.o | grep -q -n 'eh_frame .* WA'; then
18693
+ libffi_cv_ro_eh_frame=no
18599
18694
  fi
18600
18695
  fi
18601
18696
  rm -f conftest.*
@@ -21211,6 +21306,7 @@ See \`config.log' for more details" "$LINENO" 5; }
21211
21306
  cat <<_LT_EOF >> "$cfgfile"
21212
21307
  #! $SHELL
21213
21308
  # Generated automatically by $as_me ($PACKAGE) $VERSION
21309
+ # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
21214
21310
  # NOTE: Changes made to this file will be lost: look at ltmain.sh.
21215
21311
 
21216
21312
  # Provide generalized library-building support services.
@@ -63,6 +63,9 @@ EOF
63
63
 
64
64
  AM_MAINTAINER_MODE
65
65
 
66
+ AC_CHECK_HEADERS(sys/memfd.h)
67
+ AC_CHECK_FUNCS([memfd_create])
68
+
66
69
  AC_CHECK_HEADERS(sys/mman.h)
67
70
  AC_CHECK_FUNCS([mmap mkostemp])
68
71
  AC_FUNC_MMAP_BLACKLIST
@@ -176,6 +179,28 @@ case "$TARGET" in
176
179
  ;;
177
180
  esac
178
181
 
182
+ AC_CACHE_CHECK([whether compiler supports pointer authentication],
183
+ libffi_cv_as_ptrauth, [
184
+ libffi_cv_as_ptrauth=unknown
185
+ AC_TRY_COMPILE(,[
186
+ #ifdef __clang__
187
+ # if __has_feature(ptrauth_calls)
188
+ # define HAVE_PTRAUTH 1
189
+ # endif
190
+ #endif
191
+
192
+ #ifndef HAVE_PTRAUTH
193
+ # error Pointer authentication not supported
194
+ #endif
195
+ ],
196
+ [libffi_cv_as_ptrauth=yes],
197
+ [libffi_cv_as_ptrauth=no])
198
+ ])
199
+ if test "x$libffi_cv_as_ptrauth" = xyes; then
200
+ AC_DEFINE(HAVE_PTRAUTH, 1,
201
+ [Define if your compiler supports pointer authentication.])
202
+ fi
203
+
179
204
  # On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC.
180
205
  AC_ARG_ENABLE(pax_emutramp,
181
206
  [ --enable-pax_emutramp enable pax emulated trampolines, for we can't use PROT_EXEC],
@@ -238,19 +263,15 @@ EOF
238
263
  fi
239
264
 
240
265
  if test "x$GCC" = "xyes"; then
266
+ AX_CHECK_COMPILE_FLAG(-fno-lto, libffi_cv_no_lto=-fno-lto)
267
+
241
268
  AC_CACHE_CHECK([whether .eh_frame section should be read-only],
242
269
  libffi_cv_ro_eh_frame, [
243
- libffi_cv_ro_eh_frame=no
270
+ libffi_cv_ro_eh_frame=yes
244
271
  echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
245
- if $CC $CFLAGS -c -fpic -fexceptions -o conftest.o conftest.c > /dev/null 2>&1; then
246
- objdump -h conftest.o > conftest.dump 2>&1
247
- libffi_eh_frame_line=`grep -n eh_frame conftest.dump | cut -d: -f 1`
248
- if test "x$libffi_eh_frame_line" != "x"; then
249
- libffi_test_line=`expr $libffi_eh_frame_line + 1`p
250
- sed -n $libffi_test_line conftest.dump > conftest.line
251
- if grep READONLY conftest.line > /dev/null; then
252
- libffi_cv_ro_eh_frame=yes
253
- fi
272
+ if $CC $CFLAGS -c -fpic -fexceptions $libffi_cv_no_lto -o conftest.o conftest.c > /dev/null 2>&1; then
273
+ if readelf -WS conftest.o | grep -q -n 'eh_frame .* WA'; then
274
+ libffi_cv_ro_eh_frame=no
254
275
  fi
255
276
  fi
256
277
  rm -f conftest.*
@@ -8,7 +8,9 @@
8
8
  case "${host}" in
9
9
  aarch64*-*-cygwin* | aarch64*-*-mingw* | aarch64*-*-win* )
10
10
  TARGET=ARM_WIN64; TARGETDIR=aarch64
11
- MSVC=1
11
+ if test "${ax_cv_c_compiler_vendor}" = "microsoft"; then
12
+ MSVC=1
13
+ fi
12
14
  ;;
13
15
 
14
16
  aarch64*-*-*)
@@ -53,6 +55,11 @@ case "${host}" in
53
55
  SOURCES="ffi.c sysv.S"
54
56
  ;;
55
57
 
58
+ csky-*-*)
59
+ TARGET=CSKY; TARGETDIR=csky
60
+ SOURCES="ffi.c sysv.S"
61
+ ;;
62
+
56
63
  frv-*-*)
57
64
  TARGET=FRV; TARGETDIR=frv
58
65
  SOURCES="ffi.c eabi.S"
@@ -108,22 +115,14 @@ case "${host}" in
108
115
  i?86-*-* | x86_64-*-* | amd64-*)
109
116
  TARGETDIR=x86
110
117
  if test $ac_cv_sizeof_size_t = 4; then
111
- case "$host" in
112
- x86_64-*x32|x86_64-x32-*)
113
- TARGET_X32=yes
114
- TARGET=X86_64
115
- ;;
116
- *)
117
- echo 'int foo (void) { return __x86_64__; }' > conftest.c
118
- if $CC $CFLAGS -Werror -S conftest.c -o conftest.s > /dev/null 2>&1; then
119
- TARGET_X32=yes
120
- TARGET=X86_64
121
- else
122
- TARGET=X86;
123
- fi
124
- rm -f conftest.*
125
- ;;
126
- esac
118
+ echo 'int foo (void) { return __x86_64__; }' > conftest.c
119
+ if $CC $CFLAGS -Werror -S conftest.c -o conftest.s > /dev/null 2>&1; then
120
+ TARGET_X32=yes
121
+ TARGET=X86_64
122
+ else
123
+ TARGET=X86;
124
+ fi
125
+ rm -f conftest.*
127
126
  else
128
127
  TARGET=X86_64;
129
128
  fi
@@ -134,6 +133,11 @@ case "${host}" in
134
133
  SOURCES="ffi.c unix.S"
135
134
  ;;
136
135
 
136
+ kvx-*-*)
137
+ TARGET=KVX; TARGETDIR=kvx
138
+ SOURCES="ffi.c sysv.S"
139
+ ;;
140
+
137
141
  m32r*-*-*)
138
142
  TARGET=M32R; TARGETDIR=m32r
139
143
  SOURCES="ffi.c sysv.S"
@@ -167,7 +171,7 @@ case "${host}" in
167
171
  mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
168
172
  TARGET=MIPS; TARGETDIR=mips
169
173
  ;;
170
- mips*-*linux* | mips*-*-openbsd*)
174
+ mips*-*linux* | mips*-*-openbsd* | mips*-*-freebsd*)
171
175
  # Support 128-bit long double for NewABI.
172
176
  HAVE_LONG_DOUBLE='defined(__mips64)'
173
177
  TARGET=MIPS; TARGETDIR=mips
@@ -206,7 +210,11 @@ case "${host}" in
206
210
  TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
207
211
  HAVE_LONG_DOUBLE_VARIANT=1
208
212
  ;;
209
- powerpc64-*-freebsd*)
213
+ powerpcspe-*-freebsd*)
214
+ TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
215
+ CFLAGS="$CFLAGS -D__NO_FPRS__"
216
+ ;;
217
+ powerpc64-*-freebsd* | powerpc64le-*-freebsd*)
210
218
  TARGET=POWERPC; TARGETDIR=powerpc
211
219
  ;;
212
220
  powerpc*-*-rtems*)
@@ -259,7 +267,11 @@ case "${TARGET}" in
259
267
  SOURCES="ffi.c sysv_msvc_arm32.S"
260
268
  ;;
261
269
  ARM_WIN64)
262
- SOURCES="ffi.c win64_armasm.S"
270
+ if test "$MSVC" = 1; then
271
+ SOURCES="ffi.c win64_armasm.S"
272
+ else
273
+ SOURCES="ffi.c sysv.S"
274
+ fi
263
275
  ;;
264
276
  MIPS)
265
277
  SOURCES="ffi.c o32.S n32.S"
@@ -76,6 +76,9 @@
76
76
  /* Define to 1 if you have the `memcpy' function. */
77
77
  #undef HAVE_MEMCPY
78
78
 
79
+ /* Define to 1 if you have the `memfd_create' function. */
80
+ #undef HAVE_MEMFD_CREATE
81
+
79
82
  /* Define to 1 if you have the <memory.h> header file. */
80
83
  #undef HAVE_MEMORY_H
81
84
 
@@ -94,6 +97,9 @@
94
97
  /* Define if read-only mmap of a plain file works. */
95
98
  #undef HAVE_MMAP_FILE
96
99
 
100
+ /* Define if your compiler supports pointer authentication. */
101
+ #undef HAVE_PTRAUTH
102
+
97
103
  /* Define if .eh_frame sections should be read-only. */
98
104
  #undef HAVE_RO_EH_FRAME
99
105
 
@@ -109,6 +115,9 @@
109
115
  /* Define to 1 if you have the <string.h> header file. */
110
116
  #undef HAVE_STRING_H
111
117
 
118
+ /* Define to 1 if you have the <sys/memfd.h> header file. */
119
+ #undef HAVE_SYS_MEMFD_H
120
+
112
121
  /* Define to 1 if you have the <sys/mman.h> header file. */
113
122
  #undef HAVE_SYS_MMAN_H
114
123
 
@@ -186,7 +186,7 @@ def generate_source_and_headers(generate_osx=True, generate_ios=True):
186
186
  build_target(desktop64_platform, platform_headers)
187
187
 
188
188
  mkdir_p('darwin_common/include')
189
- for header_name, tag_tuples in platform_headers.iteritems():
189
+ for header_name, tag_tuples in platform_headers.items():
190
190
  basename, suffix = os.path.splitext(header_name)
191
191
  with open(os.path.join('darwin_common/include', header_name), 'w') as header:
192
192
  for tag_tuple in tag_tuples:
@@ -330,6 +330,14 @@ typedef struct {
330
330
  FFI_API void *ffi_closure_alloc (size_t size, void **code);
331
331
  FFI_API void ffi_closure_free (void *);
332
332
 
333
+ #if defined(PA_LINUX) || defined(PA_HPUX)
334
+ #define FFI_CLOSURE_PTR(X) ((void *)((unsigned int)(X) | 2))
335
+ #define FFI_RESTORE_PTR(X) ((void *)((unsigned int)(X) & ~3))
336
+ #else
337
+ #define FFI_CLOSURE_PTR(X) (X)
338
+ #define FFI_RESTORE_PTR(X) (X)
339
+ #endif
340
+
333
341
  FFI_API ffi_status
334
342
  ffi_prep_closure (ffi_closure*,
335
343
  ffi_cif *,
@@ -6,7 +6,7 @@
6
6
  /* These version numbers correspond to the libtool-version abi numbers,
7
7
  not to the libffi release numbers. */
8
8
 
9
- LIBFFI_BASE_7.0 {
9
+ LIBFFI_BASE_8.0 {
10
10
  global:
11
11
  /* Exported data variables. */
12
12
  ffi_type_void;
@@ -38,27 +38,23 @@ LIBFFI_BASE_7.0 {
38
38
  ffi_java_raw_to_ptrarray;
39
39
  ffi_java_raw_size;
40
40
 
41
+ ffi_get_struct_offsets;
41
42
  local:
42
43
  *;
43
44
  };
44
45
 
45
- LIBFFI_BASE_7.1 {
46
- global:
47
- ffi_get_struct_offsets;
48
- } LIBFFI_BASE_7.0;
49
-
50
46
  #ifdef FFI_TARGET_HAS_COMPLEX_TYPE
51
- LIBFFI_COMPLEX_7.0 {
47
+ LIBFFI_COMPLEX_8.0 {
52
48
  global:
53
49
  /* Exported data variables. */
54
50
  ffi_type_complex_float;
55
51
  ffi_type_complex_double;
56
52
  ffi_type_complex_longdouble;
57
- } LIBFFI_BASE_7.0;
53
+ } LIBFFI_BASE_8.0;
58
54
  #endif
59
55
 
60
56
  #if FFI_CLOSURES
61
- LIBFFI_CLOSURE_7.0 {
57
+ LIBFFI_CLOSURE_8.0 {
62
58
  global:
63
59
  ffi_closure_alloc;
64
60
  ffi_closure_free;
@@ -68,13 +64,13 @@ LIBFFI_CLOSURE_7.0 {
68
64
  ffi_prep_raw_closure_loc;
69
65
  ffi_prep_java_raw_closure;
70
66
  ffi_prep_java_raw_closure_loc;
71
- } LIBFFI_BASE_7.0;
67
+ } LIBFFI_BASE_8.0;
72
68
  #endif
73
69
 
74
70
  #if FFI_GO_CLOSURES
75
- LIBFFI_GO_CLOSURE_7.0 {
71
+ LIBFFI_GO_CLOSURE_8.0 {
76
72
  global:
77
73
  ffi_call_go;
78
74
  ffi_prep_go_closure;
79
- } LIBFFI_CLOSURE_7.0;
75
+ } LIBFFI_CLOSURE_8.0;
80
76
  #endif