ffi 1.16.3 → 1.17.1

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 (96) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +51 -0
  4. data/Gemfile +9 -2
  5. data/README.md +1 -1
  6. data/Rakefile +18 -6
  7. data/ext/ffi_c/AbstractMemory.c +39 -38
  8. data/ext/ffi_c/ArrayType.c +2 -2
  9. data/ext/ffi_c/Buffer.c +4 -4
  10. data/ext/ffi_c/Call.c +12 -6
  11. data/ext/ffi_c/Call.h +3 -2
  12. data/ext/ffi_c/DynamicLibrary.c +2 -2
  13. data/ext/ffi_c/Function.c +52 -34
  14. data/ext/ffi_c/FunctionInfo.c +1 -1
  15. data/ext/ffi_c/LastError.c +4 -4
  16. data/ext/ffi_c/MemoryPointer.c +2 -2
  17. data/ext/ffi_c/Pointer.c +14 -11
  18. data/ext/ffi_c/Struct.c +11 -4
  19. data/ext/ffi_c/StructLayout.c +13 -13
  20. data/ext/ffi_c/Type.c +17 -16
  21. data/ext/ffi_c/Types.c +7 -1
  22. data/ext/ffi_c/Types.h +0 -1
  23. data/ext/ffi_c/Variadic.c +6 -3
  24. data/ext/ffi_c/libffi/.allow-ai-service +0 -0
  25. data/ext/ffi_c/libffi/.github/workflows/build.yml +34 -15
  26. data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +2 -1
  27. data/ext/ffi_c/libffi/LICENSE +1 -1
  28. data/ext/ffi_c/libffi/README.md +10 -5
  29. data/ext/ffi_c/libffi/configure +1254 -940
  30. data/ext/ffi_c/libffi/configure.ac +2 -2
  31. data/ext/ffi_c/libffi/configure.host +1 -1
  32. data/ext/ffi_c/libffi/doc/libffi.texi +1 -1
  33. data/ext/ffi_c/libffi/doc/version.texi +4 -4
  34. data/ext/ffi_c/libffi/fficonfig.h.in +6 -6
  35. data/ext/ffi_c/libffi/include/ffi.h.in +2 -11
  36. data/ext/ffi_c/libffi/include/ffi_common.h +4 -2
  37. data/ext/ffi_c/libffi/libffi.map.in +5 -0
  38. data/ext/ffi_c/libffi/libtool-version +1 -1
  39. data/ext/ffi_c/libffi/ltmain.sh +8 -20
  40. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +1 -1
  41. data/ext/ffi_c/libffi/src/aarch64/ffi.c +26 -13
  42. data/ext/ffi_c/libffi/src/aarch64/sysv.S +198 -46
  43. data/ext/ffi_c/libffi/src/closures.c +3 -3
  44. data/ext/ffi_c/libffi/src/debug.c +2 -2
  45. data/ext/ffi_c/libffi/src/dlmalloc.c +1 -1
  46. data/ext/ffi_c/libffi/src/loongarch64/ffi.c +3 -0
  47. data/ext/ffi_c/libffi/src/mips/ffi.c +12 -4
  48. data/ext/ffi_c/libffi/src/mips/n32.S +65 -14
  49. data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +36 -24
  50. data/ext/ffi_c/libffi/src/sparc/ffi64.c +7 -1
  51. data/ext/ffi_c/libffi/src/tramp.c +1 -1
  52. data/ext/ffi_c/libffi/src/types.c +4 -6
  53. data/ext/ffi_c/libffi/src/wasm32/ffi.c +13 -0
  54. data/ext/ffi_c/libffi/src/x86/ffiw64.c +1 -1
  55. data/ext/ffi_c/libffi/testsuite/Makefile.am +79 -127
  56. data/ext/ffi_c/libffi/testsuite/Makefile.in +79 -127
  57. data/ext/ffi_c/libffi/testsuite/emscripten/conftest.py +6 -0
  58. data/ext/ffi_c/libffi/testsuite/libffi.call/callback.c +99 -0
  59. data/ext/ffi_c/libffi/testsuite/libffi.call/callback2.c +108 -0
  60. data/ext/ffi_c/libffi/testsuite/libffi.call/callback3.c +114 -0
  61. data/ext/ffi_c/libffi/testsuite/libffi.call/callback4.c +119 -0
  62. data/ext/ffi_c/libffi.darwin.mk +2 -2
  63. data/lib/ffi/autopointer.rb +1 -9
  64. data/lib/ffi/dynamic_library.rb +34 -5
  65. data/lib/ffi/enum.rb +0 -1
  66. data/lib/ffi/ffi.rb +59 -0
  67. data/lib/ffi/function.rb +1 -1
  68. data/lib/ffi/io.rb +2 -2
  69. data/lib/ffi/library.rb +23 -23
  70. data/lib/ffi/platform/aarch64-linux/types.conf +74 -3
  71. data/lib/ffi/pointer.rb +6 -6
  72. data/lib/ffi/struct.rb +4 -4
  73. data/lib/ffi/struct_layout.rb +2 -2
  74. data/lib/ffi/struct_layout_builder.rb +8 -8
  75. data/lib/ffi/types.rb +51 -49
  76. data/lib/ffi/version.rb +1 -1
  77. data/sig/ffi/abstract_memory.rbs +165 -0
  78. data/sig/ffi/auto_pointer.rbs +26 -0
  79. data/sig/ffi/buffer.rbs +18 -0
  80. data/sig/ffi/data_converter.rbs +10 -0
  81. data/sig/ffi/dynamic_library.rbs +9 -0
  82. data/sig/ffi/enum.rbs +38 -0
  83. data/sig/ffi/function.rbs +39 -0
  84. data/sig/ffi/library.rbs +42 -0
  85. data/sig/ffi/native_type.rbs +86 -0
  86. data/sig/ffi/pointer.rbs +42 -0
  87. data/sig/ffi/struct.rbs +76 -0
  88. data/sig/ffi/struct_by_reference.rbs +11 -0
  89. data/sig/ffi/struct_by_value.rbs +7 -0
  90. data/sig/ffi/struct_layout.rbs +9 -0
  91. data/sig/ffi/struct_layout_builder.rbs +5 -0
  92. data/sig/ffi/type.rbs +39 -0
  93. data/sig/ffi.rbs +26 -0
  94. data.tar.gz.sig +0 -0
  95. metadata +37 -18
  96. metadata.gz.sig +0 -0
@@ -2,7 +2,7 @@ dnl Process this with autoconf to create configure
2
2
 
3
3
  AC_PREREQ([2.71])
4
4
 
5
- AC_INIT([libffi],[3.4.4],[http://github.com/libffi/libffi/issues])
5
+ AC_INIT([libffi],[3.4.6],[http://github.com/libffi/libffi/issues])
6
6
  AC_CONFIG_HEADERS([fficonfig.h])
7
7
 
8
8
  AC_CANONICAL_TARGET
@@ -298,7 +298,7 @@ if test "x$GCC" = "xyes"; then
298
298
  echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1 ; }' > conftest.c
299
299
  libffi_cv_hidden_visibility_attribute=no
300
300
  if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
301
- if $EGREP '(\.hidden|\.private_extern).*foo' conftest.s >/dev/null; then
301
+ if $EGREP '(\.hidden|\.private_extern).*foo|foo.*,hidden' conftest.s >/dev/null; then
302
302
  libffi_cv_hidden_visibility_attribute=yes
303
303
  fi
304
304
  fi
@@ -205,7 +205,7 @@ case "${host}" in
205
205
  powerpc-*-eabi*)
206
206
  TARGET=POWERPC; TARGETDIR=powerpc
207
207
  ;;
208
- powerpc-*-beos*)
208
+ powerpc-*-beos* | powerpc-*-haiku*)
209
209
  TARGET=POWERPC; TARGETDIR=powerpc
210
210
  ;;
211
211
  powerpc-*-darwin* | powerpc64-*-darwin*)
@@ -18,7 +18,7 @@
18
18
  This manual is for libffi, a portable foreign function interface
19
19
  library.
20
20
 
21
- Copyright @copyright{} 2008--2019, 2021, 2022 Anthony Green and Red Hat, Inc.
21
+ Copyright @copyright{} 2008--2024 Anthony Green and Red Hat, Inc.
22
22
 
23
23
  Permission is hereby granted, free of charge, to any person obtaining
24
24
  a copy of this software and associated documentation files (the
@@ -1,4 +1,4 @@
1
- @set UPDATED 23 October 2022
2
- @set UPDATED-MONTH October 2022
3
- @set EDITION 3.4.4
4
- @set VERSION 3.4.4
1
+ @set UPDATED 15 February 2024
2
+ @set UPDATED-MONTH February 2024
3
+ @set EDITION 3.4.6
4
+ @set VERSION 3.4.6
@@ -65,10 +65,10 @@
65
65
  /* Define if you support more than one size of the long double type */
66
66
  #undef HAVE_LONG_DOUBLE_VARIANT
67
67
 
68
- /* Define to 1 if you have the `memcpy' function. */
68
+ /* Define to 1 if you have the 'memcpy' function. */
69
69
  #undef HAVE_MEMCPY
70
70
 
71
- /* Define to 1 if you have the `memfd_create' function. */
71
+ /* Define to 1 if you have the 'memfd_create' function. */
72
72
  #undef HAVE_MEMFD_CREATE
73
73
 
74
74
  /* Define if your compiler supports pointer authentication. */
@@ -131,16 +131,16 @@
131
131
  /* Define to the version of this package. */
132
132
  #undef PACKAGE_VERSION
133
133
 
134
- /* The size of `double', as computed by sizeof. */
134
+ /* The size of 'double', as computed by sizeof. */
135
135
  #undef SIZEOF_DOUBLE
136
136
 
137
- /* The size of `long double', as computed by sizeof. */
137
+ /* The size of 'long double', as computed by sizeof. */
138
138
  #undef SIZEOF_LONG_DOUBLE
139
139
 
140
- /* The size of `size_t', as computed by sizeof. */
140
+ /* The size of 'size_t', as computed by sizeof. */
141
141
  #undef SIZEOF_SIZE_T
142
142
 
143
- /* Define to 1 if all of the C90 standard headers exist (not just the ones
143
+ /* Define to 1 if all of the C89 standard headers exist (not just the ones
144
144
  required in a freestanding environment). This macro is provided for
145
145
  backward compatibility; new code need not use it. */
146
146
  #undef STDC_HEADERS
@@ -1,6 +1,6 @@
1
1
  /* -----------------------------------------------------------------*-C-*-
2
2
  libffi @VERSION@
3
- - Copyright (c) 2011, 2014, 2019, 2021, 2022 Anthony Green
3
+ - Copyright (c) 2011, 2014, 2019, 2021, 2022, 2024 Anthony Green
4
4
  - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person
@@ -220,21 +220,12 @@ FFI_EXTERN ffi_type ffi_type_sint64;
220
220
  FFI_EXTERN ffi_type ffi_type_float;
221
221
  FFI_EXTERN ffi_type ffi_type_double;
222
222
  FFI_EXTERN ffi_type ffi_type_pointer;
223
-
224
- #if @HAVE_LONG_DOUBLE@
225
223
  FFI_EXTERN ffi_type ffi_type_longdouble;
226
- #else
227
- #define ffi_type_longdouble ffi_type_double
228
- #endif
229
224
 
230
225
  #ifdef FFI_TARGET_HAS_COMPLEX_TYPE
231
226
  FFI_EXTERN ffi_type ffi_type_complex_float;
232
227
  FFI_EXTERN ffi_type ffi_type_complex_double;
233
- #if @HAVE_LONG_DOUBLE@
234
228
  FFI_EXTERN ffi_type ffi_type_complex_longdouble;
235
- #else
236
- #define ffi_type_complex_longdouble ffi_type_complex_double
237
- #endif
238
229
  #endif
239
230
  #endif /* LIBFFI_HIDE_BASIC_TYPES */
240
231
 
@@ -464,7 +455,7 @@ ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
464
455
 
465
456
  #endif /* FFI_CLOSURES */
466
457
 
467
- #if FFI_GO_CLOSURES
458
+ #ifdef FFI_GO_CLOSURES
468
459
 
469
460
  typedef struct {
470
461
  void *tramp;
@@ -49,8 +49,10 @@ extern "C" {
49
49
  # endif
50
50
  # endif
51
51
  # define MAYBE_UNUSED __attribute__((__unused__))
52
+ # define NORETURN __attribute__((__noreturn__))
52
53
  #else
53
54
  # define MAYBE_UNUSED
55
+ # define NORETURN
54
56
  # if HAVE_ALLOCA_H
55
57
  # include <alloca.h>
56
58
  # else
@@ -82,9 +84,9 @@ char *alloca ();
82
84
  #endif
83
85
 
84
86
  #ifdef FFI_DEBUG
85
- void ffi_assert(char *expr, char *file, int line);
87
+ NORETURN void ffi_assert(const char *expr, const char *file, int line);
86
88
  void ffi_stop_here(void);
87
- void ffi_type_test(ffi_type *a, char *file, int line);
89
+ void ffi_type_test(ffi_type *a, const char *file, int line);
88
90
 
89
91
  #define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__))
90
92
  #define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l)))
@@ -33,7 +33,10 @@ LIBFFI_BASE_8.0 {
33
33
  ffi_raw_to_ptrarray;
34
34
  ffi_raw_size;
35
35
 
36
+ #if !FFI_NATIVE_RAW_API
36
37
  ffi_java_raw_call;
38
+ #endif
39
+
37
40
  ffi_java_ptrarray_to_raw;
38
41
  ffi_java_raw_to_ptrarray;
39
42
  ffi_java_raw_size;
@@ -62,8 +65,10 @@ LIBFFI_CLOSURE_8.0 {
62
65
  ffi_prep_closure_loc;
63
66
  ffi_prep_raw_closure;
64
67
  ffi_prep_raw_closure_loc;
68
+ #if !FFI_NATIVE_RAW_API
65
69
  ffi_prep_java_raw_closure;
66
70
  ffi_prep_java_raw_closure_loc;
71
+ #endif
67
72
  } LIBFFI_BASE_8.0;
68
73
  #endif
69
74
 
@@ -26,4 +26,4 @@
26
26
  # release, then set age to 0.
27
27
  #
28
28
  # CURRENT:REVISION:AGE
29
- 9:2:1
29
+ 9:4:1
@@ -31,7 +31,7 @@
31
31
 
32
32
  PROGRAM=libtool
33
33
  PACKAGE=libtool
34
- VERSION="2.4.7 Debian-2.4.7-5"
34
+ VERSION="2.4.7 Debian-2.4.7-7build1"
35
35
  package_revision=2.4.7
36
36
 
37
37
 
@@ -572,27 +572,15 @@ func_require_term_colors ()
572
572
  # ---------------------
573
573
  # Append VALUE onto the existing contents of VAR.
574
574
 
575
- # We should try to minimise forks, especially on Windows where they are
576
- # unreasonably slow, so skip the feature probes when bash or zsh are
577
- # being used:
578
- if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
579
- : ${_G_HAVE_ARITH_OP="yes"}
580
- : ${_G_HAVE_XSI_OPS="yes"}
581
- # The += operator was introduced in bash 3.1
582
- case $BASH_VERSION in
583
- [12].* | 3.0 | 3.0*) ;;
584
- *)
585
- : ${_G_HAVE_PLUSEQ_OP="yes"}
586
- ;;
587
- esac
588
- fi
589
-
590
575
  # _G_HAVE_PLUSEQ_OP
591
576
  # Can be empty, in which case the shell is probed, "yes" if += is
592
577
  # useable or anything else if it does not work.
593
- test -z "$_G_HAVE_PLUSEQ_OP" \
594
- && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
595
- && _G_HAVE_PLUSEQ_OP=yes
578
+ if test -z "$_G_HAVE_PLUSEQ_OP" && \
579
+ __PLUSEQ_TEST="a" && \
580
+ __PLUSEQ_TEST+=" b" 2>/dev/null && \
581
+ test "a b" = "$__PLUSEQ_TEST"; then
582
+ _G_HAVE_PLUSEQ_OP=yes
583
+ fi
596
584
 
597
585
  if test yes = "$_G_HAVE_PLUSEQ_OP"
598
586
  then
@@ -2308,7 +2296,7 @@ include the following information:
2308
2296
  compiler: $LTCC
2309
2297
  compiler flags: $LTCFLAGS
2310
2298
  linker: $LD (gnu? $with_gnu_ld)
2311
- version: $progname $scriptversion Debian-2.4.7-5
2299
+ version: $progname $scriptversion Debian-2.4.7-7build1
2312
2300
  automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2313
2301
  autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2314
2302
 
@@ -429,7 +429,7 @@ ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
429
429
 
430
430
  #endif /* FFI_CLOSURES */
431
431
 
432
- #if FFI_GO_CLOSURES
432
+ #ifdef FFI_GO_CLOSURES
433
433
 
434
434
  typedef struct {
435
435
  void *tramp;
@@ -386,51 +386,64 @@ extend_hfa_type (void *dest, void *src, int h)
386
386
  ssize_t f = h - AARCH64_RET_S4;
387
387
  void *x0;
388
388
 
389
+ #define BTI_J "hint #36"
389
390
  asm volatile (
390
391
  "adr %0, 0f\n"
391
392
  " add %0, %0, %1\n"
392
393
  " br %0\n"
393
- "0: ldp s16, s17, [%3]\n" /* S4 */
394
+ "0: "BTI_J"\n" /* S4 */
395
+ " ldp s16, s17, [%3]\n"
394
396
  " ldp s18, s19, [%3, #8]\n"
395
397
  " b 4f\n"
396
- " ldp s16, s17, [%3]\n" /* S3 */
398
+ " "BTI_J"\n" /* S3 */
399
+ " ldp s16, s17, [%3]\n"
397
400
  " ldr s18, [%3, #8]\n"
398
401
  " b 3f\n"
399
- " ldp s16, s17, [%3]\n" /* S2 */
402
+ " "BTI_J"\n" /* S2 */
403
+ " ldp s16, s17, [%3]\n"
400
404
  " b 2f\n"
401
405
  " nop\n"
402
- " ldr s16, [%3]\n" /* S1 */
406
+ " "BTI_J"\n" /* S1 */
407
+ " ldr s16, [%3]\n"
403
408
  " b 1f\n"
404
409
  " nop\n"
405
- " ldp d16, d17, [%3]\n" /* D4 */
410
+ " "BTI_J"\n" /* D4 */
411
+ " ldp d16, d17, [%3]\n"
406
412
  " ldp d18, d19, [%3, #16]\n"
407
413
  " b 4f\n"
408
- " ldp d16, d17, [%3]\n" /* D3 */
414
+ " "BTI_J"\n" /* D3 */
415
+ " ldp d16, d17, [%3]\n"
409
416
  " ldr d18, [%3, #16]\n"
410
417
  " b 3f\n"
411
- " ldp d16, d17, [%3]\n" /* D2 */
418
+ " "BTI_J"\n" /* D2 */
419
+ " ldp d16, d17, [%3]\n"
412
420
  " b 2f\n"
413
421
  " nop\n"
414
- " ldr d16, [%3]\n" /* D1 */
422
+ " "BTI_J"\n" /* D1 */
423
+ " ldr d16, [%3]\n"
415
424
  " b 1f\n"
416
425
  " nop\n"
417
- " ldp q16, q17, [%3]\n" /* Q4 */
426
+ " "BTI_J"\n" /* Q4 */
427
+ " ldp q16, q17, [%3]\n"
418
428
  " ldp q18, q19, [%3, #32]\n"
419
429
  " b 4f\n"
420
- " ldp q16, q17, [%3]\n" /* Q3 */
430
+ " "BTI_J"\n" /* Q3 */
431
+ " ldp q16, q17, [%3]\n"
421
432
  " ldr q18, [%3, #32]\n"
422
433
  " b 3f\n"
423
- " ldp q16, q17, [%3]\n" /* Q2 */
434
+ " "BTI_J"\n" /* Q2 */
435
+ " ldp q16, q17, [%3]\n"
424
436
  " b 2f\n"
425
437
  " nop\n"
426
- " ldr q16, [%3]\n" /* Q1 */
438
+ " "BTI_J"\n" /* Q1 */
439
+ " ldr q16, [%3]\n"
427
440
  " b 1f\n"
428
441
  "4: str q19, [%2, #48]\n"
429
442
  "3: str q18, [%2, #32]\n"
430
443
  "2: str q17, [%2, #16]\n"
431
444
  "1: str q16, [%2]"
432
445
  : "=&r"(x0)
433
- : "r"(f * 12), "r"(dest), "r"(src)
446
+ : "r"(f * 16), "r"(dest), "r"(src)
434
447
  : "memory", "v16", "v17", "v18", "v19");
435
448
  }
436
449
  #endif