ffi 1.12.0 → 1.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +79 -0
  3. data/Gemfile +4 -2
  4. data/README.md +10 -2
  5. data/Rakefile +24 -43
  6. data/ext/ffi_c/AbstractMemory.c +25 -26
  7. data/ext/ffi_c/Buffer.c +4 -9
  8. data/ext/ffi_c/Call.c +3 -14
  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 +15 -35
  13. data/ext/ffi_c/FunctionInfo.c +3 -8
  14. data/ext/ffi_c/LastError.c +2 -6
  15. data/ext/ffi_c/LongDouble.c +5 -3
  16. data/ext/ffi_c/LongDouble.h +0 -4
  17. data/ext/ffi_c/MemoryPointer.c +3 -8
  18. data/ext/ffi_c/MethodHandle.c +21 -31
  19. data/ext/ffi_c/MethodHandle.h +3 -2
  20. data/ext/ffi_c/Platform.c +3 -7
  21. data/ext/ffi_c/Pointer.c +25 -26
  22. data/ext/ffi_c/Struct.c +49 -56
  23. data/ext/ffi_c/Struct.h +12 -6
  24. data/ext/ffi_c/StructByValue.c +2 -7
  25. data/ext/ffi_c/StructLayout.c +22 -19
  26. data/ext/ffi_c/Thread.c +0 -8
  27. data/ext/ffi_c/Thread.h +1 -9
  28. data/ext/ffi_c/Type.c +1 -1
  29. data/ext/ffi_c/Variadic.c +2 -7
  30. data/ext/ffi_c/compat.h +4 -0
  31. data/ext/ffi_c/extconf.rb +33 -24
  32. data/ext/ffi_c/libffi/.travis.yml +4 -0
  33. data/ext/ffi_c/libffi/.travis/bfin-sim.exp +1 -1
  34. data/ext/ffi_c/libffi/.travis/build.sh +4 -0
  35. data/ext/ffi_c/libffi/.travis/m32r-sim.exp +1 -1
  36. data/ext/ffi_c/libffi/.travis/moxie-sim.exp +1 -1
  37. data/ext/ffi_c/libffi/.travis/or1k-sim.exp +1 -1
  38. data/ext/ffi_c/libffi/.travis/powerpc-eabisim.exp +1 -1
  39. data/ext/ffi_c/libffi/.travis/wine-sim.exp +1 -1
  40. data/ext/ffi_c/libffi/Makefile.am +49 -58
  41. data/ext/ffi_c/libffi/README.md +11 -1
  42. data/ext/ffi_c/libffi/config.guess +552 -331
  43. data/ext/ffi_c/libffi/config.sub +1321 -1306
  44. data/ext/ffi_c/libffi/configure.ac +31 -10
  45. data/ext/ffi_c/libffi/configure.host +32 -20
  46. data/ext/ffi_c/libffi/doc/Makefile.am +3 -0
  47. data/ext/ffi_c/libffi/doc/libffi.texi +997 -0
  48. data/ext/ffi_c/libffi/doc/version.texi +4 -0
  49. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +1 -1
  50. data/ext/ffi_c/libffi/include/ffi.h.in +8 -0
  51. data/ext/ffi_c/libffi/libffi.map.in +8 -12
  52. data/ext/ffi_c/libffi/libtool-version +1 -1
  53. data/ext/ffi_c/libffi/msvcc.sh +11 -11
  54. data/ext/ffi_c/libffi/src/aarch64/ffi.c +51 -35
  55. data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +10 -5
  56. data/ext/ffi_c/libffi/src/aarch64/internal.h +1 -0
  57. data/ext/ffi_c/libffi/src/aarch64/sysv.S +14 -3
  58. data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +1 -1
  59. data/ext/ffi_c/libffi/src/arm/ffi.c +22 -0
  60. data/ext/ffi_c/libffi/src/arm/sysv.S +4 -4
  61. data/ext/ffi_c/libffi/src/closures.c +33 -10
  62. data/ext/ffi_c/libffi/src/csky/ffi.c +395 -0
  63. data/ext/ffi_c/libffi/src/csky/ffitarget.h +63 -0
  64. data/ext/ffi_c/libffi/src/csky/sysv.S +371 -0
  65. data/ext/ffi_c/libffi/src/dlmalloc.c +1 -1
  66. data/ext/ffi_c/libffi/src/kvx/asm.h +5 -0
  67. data/ext/ffi_c/libffi/src/kvx/ffi.c +273 -0
  68. data/ext/ffi_c/libffi/src/kvx/ffitarget.h +75 -0
  69. data/ext/ffi_c/libffi/src/kvx/sysv.S +127 -0
  70. data/ext/ffi_c/libffi/src/mips/ffi.c +5 -1
  71. data/ext/ffi_c/libffi/src/mips/ffitarget.h +1 -1
  72. data/ext/ffi_c/libffi/src/pa/ffi.c +46 -91
  73. data/ext/ffi_c/libffi/src/pa/ffitarget.h +1 -6
  74. data/ext/ffi_c/libffi/src/pa/hpux32.S +4 -2
  75. data/ext/ffi_c/libffi/src/pa/linux.S +4 -2
  76. data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +13 -1
  77. data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +1 -1
  78. data/ext/ffi_c/libffi/src/powerpc/linux64.S +8 -0
  79. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +13 -1
  80. data/ext/ffi_c/libffi/src/powerpc/sysv.S +5 -7
  81. data/ext/ffi_c/libffi/src/prep_cif.c +1 -1
  82. data/ext/ffi_c/libffi/src/x86/ffi.c +15 -6
  83. data/ext/ffi_c/libffi/src/x86/ffi64.c +17 -8
  84. data/ext/ffi_c/libffi/src/x86/ffitarget.h +15 -2
  85. data/ext/ffi_c/libffi/src/x86/ffiw64.c +15 -8
  86. data/ext/ffi_c/libffi/src/x86/sysv.S +15 -6
  87. data/ext/ffi_c/libffi/src/x86/unix64.S +59 -4
  88. data/ext/ffi_c/libffi/src/x86/win64.S +7 -3
  89. data/ext/ffi_c/libffi/src/x86/win64_intel.S +3 -2
  90. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +22 -2
  91. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +4 -4
  92. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +2 -2
  93. data/ext/ffi_c/libffi/testsuite/libffi.closures/huge_struct.c +2 -0
  94. data/ffi.gemspec +2 -2
  95. data/lib/ffi.rb +10 -2
  96. data/lib/ffi/abstract_memory.rb +44 -0
  97. data/lib/ffi/ffi.rb +1 -0
  98. data/lib/ffi/library.rb +6 -2
  99. data/lib/ffi/platform.rb +21 -8
  100. data/lib/ffi/platform/aarch64-darwin/types.conf +130 -0
  101. data/lib/ffi/platform/aarch64-openbsd/types.conf +134 -0
  102. data/lib/ffi/platform/arm-linux/types.conf +32 -4
  103. data/lib/ffi/platform/i386-windows/types.conf +26 -79
  104. data/lib/ffi/platform/powerpc-linux/types.conf +32 -2
  105. data/lib/ffi/platform/powerpc-openbsd/types.conf +156 -0
  106. data/lib/ffi/platform/sparcv9-openbsd/types.conf +156 -0
  107. data/lib/ffi/platform/x86_64-darwin/types.conf +4 -0
  108. data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +4 -22
  109. data/lib/ffi/platform/x86_64-haiku/types.conf +117 -0
  110. data/lib/ffi/platform/x86_64-linux/types.conf +21 -0
  111. data/lib/ffi/platform/x86_64-msys/types.conf +119 -0
  112. data/lib/ffi/platform/x86_64-windows/types.conf +10 -78
  113. data/lib/ffi/pointer.rb +40 -19
  114. data/lib/ffi/struct.rb +9 -4
  115. data/lib/ffi/tools/types_generator.rb +2 -0
  116. data/lib/ffi/version.rb +1 -1
  117. data/samples/getlogin.rb +1 -1
  118. data/samples/getpid.rb +1 -1
  119. data/samples/gettimeofday.rb +8 -8
  120. data/samples/hello.rb +2 -1
  121. data/samples/inotify.rb +1 -1
  122. data/samples/pty.rb +1 -2
  123. data/samples/qsort.rb +0 -1
  124. metadata +18 -12
  125. data/.appveyor.yml +0 -27
  126. data/.gitignore +0 -25
  127. data/.gitmodules +0 -4
  128. data/.travis.yml +0 -44
  129. data/.yardopts +0 -5
  130. data/ext/ffi_c/win32/stdbool.h +0 -8
  131. data/ext/ffi_c/win32/stdint.h +0 -201
  132. data/samples/sample_helper.rb +0 -6
@@ -34,11 +34,7 @@
34
34
  #include "extconf.h"
35
35
  #include "AbstractMemory.h"
36
36
  #include "Type.h"
37
- #ifdef RUBY_1_9
38
37
  #include <ruby/st.h>
39
- #else
40
- #include <st.h>
41
- #endif
42
38
 
43
39
  #ifdef __cplusplus
44
40
  extern "C" {
@@ -73,11 +69,21 @@ extern "C" {
73
69
  int size;
74
70
  int align;
75
71
  ffi_type** ffiTypes;
76
- struct st_table* fieldSymbolTable;
72
+
73
+ /*
74
+ * We use the fieldName's minor 8 Bits as index to a 256 entry cache.
75
+ * This avoids full ruby hash lookups for repeated lookups.
76
+ */
77
+ #define FIELD_CACHE_LOOKUP(this, sym) ( &(this)->cache_row[((sym) >> 8) & 0xff] )
78
+
79
+ struct field_cache_entry {
80
+ VALUE fieldName;
81
+ StructField *field;
82
+ } cache_row[0x100];
77
83
 
78
84
  /** The number of reference tracking fields in this struct */
79
85
  int referenceFieldCount;
80
-
86
+
81
87
  VALUE rbFieldNames;
82
88
  VALUE rbFieldMap;
83
89
  VALUE rbFields;
@@ -32,13 +32,8 @@
32
32
  #endif
33
33
  #include <sys/types.h>
34
34
  #include <stdio.h>
35
- #ifndef _MSC_VER
36
- # include <stdint.h>
37
- # include <stdbool.h>
38
- #else
39
- # include "win32/stdbool.h"
40
- # include "win32/stdint.h"
41
- #endif
35
+ #include <stdint.h>
36
+ #include <stdbool.h>
42
37
  #include <errno.h>
43
38
  #include <ruby.h>
44
39
 
@@ -32,12 +32,9 @@
32
32
 
33
33
  #ifndef _MSC_VER
34
34
  # include <sys/param.h>
35
- # include <stdint.h>
36
- # include <stdbool.h>
37
- #else
38
- # include "win32/stdbool.h"
39
- # include "win32/stdint.h"
40
35
  #endif
36
+ #include <stdint.h>
37
+ #include <stdbool.h>
41
38
  #include <ruby.h>
42
39
  #include "rbffi.h"
43
40
  #include "compat.h"
@@ -138,7 +135,7 @@ struct_field_initialize(int argc, VALUE* argv, VALUE self)
138
135
  && RTEST(rb_funcall2(rbType, rb_intern("reference_required?"), 0, NULL)));
139
136
  break;
140
137
  }
141
-
138
+
142
139
  return self;
143
140
  }
144
141
 
@@ -239,7 +236,7 @@ static VALUE
239
236
  struct_field_put(VALUE self, VALUE pointer, VALUE value)
240
237
  {
241
238
  StructField* f;
242
-
239
+
243
240
  Data_Get_Struct(self, StructField, f);
244
241
  if (f->memoryOp == NULL) {
245
242
  rb_raise(rb_eArgError, "put not supported for %s", rb_obj_classname(f->rbType));
@@ -261,7 +258,7 @@ static VALUE
261
258
  function_field_get(VALUE self, VALUE pointer)
262
259
  {
263
260
  StructField* f;
264
-
261
+
265
262
  Data_Get_Struct(self, StructField, f);
266
263
 
267
264
  return rbffi_Function_NewInstance(f->rbType, (*rbffi_AbstractMemoryOps.pointer->get)(MEMORY(pointer), f->offset));
@@ -272,7 +269,7 @@ function_field_get(VALUE self, VALUE pointer)
272
269
  * @param [AbstractMemory] pointer pointer to a {Struct}
273
270
  * @param [Function, Proc] proc
274
271
  * @return [Function]
275
- * Set a {Function} to memory pointed by +pointer+ as a function.
272
+ * Set a {Function} to memory pointed by +pointer+ as a function.
276
273
  *
277
274
  * If a Proc is submitted as +proc+, it is automatically transformed to a {Function}.
278
275
  */
@@ -339,19 +336,24 @@ array_field_put(VALUE self, VALUE pointer, VALUE value)
339
336
  {
340
337
  StructField* f;
341
338
  ArrayType* array;
342
-
339
+
343
340
 
344
341
  Data_Get_Struct(self, StructField, f);
345
342
  Data_Get_Struct(f->rbType, ArrayType, array);
346
-
343
+
347
344
  if (isCharArray(array) && rb_obj_is_instance_of(value, rb_cString)) {
348
345
  VALUE argv[2];
349
346
 
350
347
  argv[0] = INT2FIX(f->offset);
351
348
  argv[1] = value;
352
349
 
353
- rb_funcall2(pointer, rb_intern("put_string"), 2, argv);
354
-
350
+ if (RSTRING_LEN(value) < array->length) {
351
+ rb_funcall2(pointer, rb_intern("put_string"), 2, argv);
352
+ } else if (RSTRING_LEN(value) == array->length) {
353
+ rb_funcall2(pointer, rb_intern("put_bytes"), 2, argv);
354
+ } else {
355
+ rb_raise(rb_eIndexError, "String is longer (%ld bytes) than the char array (%d bytes)", RSTRING_LEN(value), array->length);
356
+ }
355
357
  } else {
356
358
  #ifdef notyet
357
359
  MemoryOp* op;
@@ -419,7 +421,6 @@ struct_layout_allocate(VALUE klass)
419
421
  layout->rbFieldMap = Qnil;
420
422
  layout->rbFieldNames = Qnil;
421
423
  layout->rbFields = Qnil;
422
- layout->fieldSymbolTable = st_init_numtable();
423
424
  layout->base.ffiType = xcalloc(1, sizeof(*layout->base.ffiType));
424
425
  layout->base.ffiType->size = 0;
425
426
  layout->base.ffiType->alignment = 0;
@@ -488,7 +489,6 @@ struct_layout_initialize(VALUE self, VALUE fields, VALUE size, VALUE align)
488
489
 
489
490
 
490
491
  layout->ffiTypes[i] = ftype->size > 0 ? ftype : NULL;
491
- st_insert(layout->fieldSymbolTable, rbName, rbField);
492
492
  rb_hash_aset(layout->rbFieldMap, rbName, rbField);
493
493
  rb_ary_push(layout->rbFields, rbField);
494
494
  rb_ary_push(layout->rbFieldNames, rbName);
@@ -501,14 +501,14 @@ struct_layout_initialize(VALUE self, VALUE fields, VALUE size, VALUE align)
501
501
  return self;
502
502
  }
503
503
 
504
- /*
504
+ /*
505
505
  * call-seq: [](field)
506
506
  * @param [Symbol] field
507
507
  * @return [StructLayout::Field]
508
508
  * Get a field from the layout.
509
509
  */
510
510
  static VALUE
511
- struct_layout_union_bang(VALUE self)
511
+ struct_layout_union_bang(VALUE self)
512
512
  {
513
513
  const ffi_type *alignment_types[] = { &ffi_type_sint8, &ffi_type_sint16, &ffi_type_sint32, &ffi_type_sint64,
514
514
  &ffi_type_float, &ffi_type_double, &ffi_type_longdouble, NULL };
@@ -602,6 +602,10 @@ struct_layout_mark(StructLayout *layout)
602
602
  rb_gc_mark(layout->rbFieldMap);
603
603
  rb_gc_mark(layout->rbFieldNames);
604
604
  rb_gc_mark(layout->rbFields);
605
+ /* Clear the cache, to be safe from changes of fieldName VALUE by GC.compact.
606
+ * TODO: Move cache clearing to compactation callback provided by Ruby-2.7+.
607
+ */
608
+ memset(&layout->cache_row, 0, sizeof(layout->cache_row));
605
609
  }
606
610
 
607
611
  static void
@@ -610,7 +614,6 @@ struct_layout_free(StructLayout *layout)
610
614
  xfree(layout->ffiTypes);
611
615
  xfree(layout->base.ffiType);
612
616
  xfree(layout->fields);
613
- st_free_table(layout->fieldSymbolTable);
614
617
  xfree(layout);
615
618
  }
616
619
 
@@ -627,7 +630,7 @@ rbffi_StructLayout_Init(VALUE moduleFFI)
627
630
  */
628
631
  rbffi_StructLayoutClass = rb_define_class_under(moduleFFI, "StructLayout", ffi_Type);
629
632
  rb_global_variable(&rbffi_StructLayoutClass);
630
-
633
+
631
634
  /*
632
635
  * Document-class: FFI::StructLayout::Field
633
636
  * A field in a {StructLayout}.
@@ -28,12 +28,7 @@
28
28
  */
29
29
 
30
30
  #include <stddef.h>
31
- #ifndef _MSC_VER
32
31
  #include <stdbool.h>
33
- #else
34
- # include "win32/stdbool.h"
35
- # include "win32/stdint.h"
36
- #endif
37
32
 
38
33
  #if defined(__CYGWIN__) || !defined(_WIN32)
39
34
  # include <pthread.h>
@@ -74,9 +69,6 @@ void
74
69
  rbffi_frame_push(rbffi_frame_t* frame)
75
70
  {
76
71
  memset(frame, 0, sizeof(*frame));
77
- #ifndef HAVE_RUBY_THREAD_HAS_GVL_P
78
- frame->has_gvl = true;
79
- #endif
80
72
  frame->exc = Qnil;
81
73
 
82
74
  #ifdef _WIN32
@@ -30,12 +30,7 @@
30
30
  #ifndef RBFFI_THREAD_H
31
31
  #define RBFFI_THREAD_H
32
32
 
33
- #ifndef _MSC_VER
34
- # include <stdbool.h>
35
- #else
36
- # include "win32/stdbool.h"
37
- # include "win32/stdint.h"
38
- #endif
33
+ #include <stdbool.h>
39
34
  #include <ruby.h>
40
35
  #include "extconf.h"
41
36
 
@@ -66,9 +61,6 @@ typedef struct rbffi_frame {
66
61
  struct thread_data* td;
67
62
  #endif
68
63
  struct rbffi_frame* prev;
69
- #ifndef HAVE_RUBY_THREAD_HAS_GVL_P
70
- bool has_gvl;
71
- #endif
72
64
  VALUE exc;
73
65
  } rbffi_frame_t;
74
66
 
@@ -28,7 +28,7 @@
28
28
  */
29
29
 
30
30
  #ifndef _MSC_VER
31
- #include <sys/param.h>
31
+ # include <sys/param.h>
32
32
  #endif
33
33
 
34
34
  #include <sys/types.h>
@@ -33,13 +33,8 @@
33
33
  #include <sys/types.h>
34
34
 
35
35
  #include <stdio.h>
36
- #ifndef _MSC_VER
37
- # include <stdint.h>
38
- # include <stdbool.h>
39
- #else
40
- # include "win32/stdbool.h"
41
- # include "win32/stdint.h"
42
- #endif
36
+ #include <stdint.h>
37
+ #include <stdbool.h>
43
38
  #include <ruby.h>
44
39
 
45
40
  #include <ffi.h>
@@ -64,6 +64,10 @@
64
64
  # define unlikely(x) (x)
65
65
  #endif
66
66
 
67
+ #ifdef _MSC_VER
68
+ #define ffi_type_longdouble ffi_type_double
69
+ #endif
70
+
67
71
  #ifndef MAX
68
72
  # define MAX(a, b) ((a) < (b) ? (b) : (a))
69
73
  #endif
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- if !defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
3
+ if RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
4
4
  require 'mkmf'
5
5
  require 'rbconfig'
6
6
 
@@ -8,14 +8,22 @@ if !defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
8
8
  # We need pkg_config or ffi.h
9
9
  libffi_ok = pkg_config("libffi") ||
10
10
  have_header("ffi.h") ||
11
- find_header("ffi.h", "/usr/local/include", "/usr/include/ffi")
11
+ find_header("ffi.h", "/usr/local/include", "/usr/include/ffi",
12
+ "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi",
13
+ "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi") ||
14
+ (find_header("ffi.h", `xcrun --sdk macosx --show-sdk-path`.strip + "/usr/include/ffi") rescue false)
12
15
 
13
- # Ensure we can link to ffi_call
14
- libffi_ok &&= have_library("ffi", "ffi_call", [ "ffi.h" ]) ||
15
- have_library("libffi", "ffi_call", [ "ffi.h" ])
16
+ # Ensure we can link to ffi_prep_closure_loc
17
+ libffi_ok &&= have_library("ffi", "ffi_prep_closure_loc", [ "ffi.h" ]) ||
18
+ have_library("libffi", "ffi_prep_closure_loc", [ "ffi.h" ]) ||
19
+ have_library("libffi-8", "ffi_prep_closure_loc", [ "ffi.h" ])
16
20
 
17
- # And we need a libffi version recent enough to provide ffi_closure_alloc
18
- libffi_ok &&= have_func("ffi_closure_alloc")
21
+ if RbConfig::CONFIG['host_os'] =~ /mswin/
22
+ have_library('libffi_convenience')
23
+ have_library('shlwapi')
24
+ end
25
+
26
+ libffi_ok
19
27
  end
20
28
 
21
29
  dir_config("ffi_c")
@@ -36,41 +44,42 @@ if !defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
36
44
  abort "system libffi is not usable" unless system_libffi_usable?
37
45
  end
38
46
 
39
- have_header('shlwapi.h')
40
- have_func('rb_thread_call_without_gvl') || abort("Ruby C-API function `rb_thread_call_without_gvl` is missing")
41
- have_func('ruby_native_thread_p')
42
- if RUBY_VERSION >= "2.3.0"
43
- # On OSX and Linux ruby_thread_has_gvl_p() is detected but fails at runtime for ruby < 2.3.0
44
- have_func('ruby_thread_has_gvl_p')
45
- end
46
-
47
47
  if system_libffi
48
48
  have_func('ffi_prep_cif_var')
49
49
  $defs << "-DHAVE_RAW_API" if have_func("ffi_raw_call") && have_func("ffi_prep_raw_closure")
50
50
  else
51
51
  $defs << "-DHAVE_FFI_PREP_CIF_VAR"
52
52
  $defs << "-DUSE_INTERNAL_LIBFFI"
53
+
54
+ # Ensure libffi symbols aren't exported when using static libffi.
55
+ # This is to avoid interference with other gems like fiddle.
56
+ # See https://github.com/ffi/ffi/issues/835
57
+ append_ldflags "-Wl,--exclude-libs,ALL"
58
+ end
59
+
60
+ ffi_alloc_default = RbConfig::CONFIG['host_os'] =~ /darwin/i && RbConfig::CONFIG['host'] =~ /arm/i
61
+ if enable_config('libffi-alloc', ffi_alloc_default)
62
+ $defs << "-DUSE_FFI_ALLOC"
53
63
  end
54
64
 
55
65
  $defs << "-DHAVE_EXTCONF_H" if $defs.empty? # needed so create_header works
56
- $defs << "-DRUBY_1_9" if RUBY_VERSION >= "1.9.0"
57
- $defs << "-DFFI_BUILDING" if RbConfig::CONFIG['host_os'] =~ /mswin/ # for compatibility with newer libffi
58
66
 
59
67
  create_header
60
-
61
- $LOCAL_LIBS << " ./libffi/.libs/libffi_convenience.lib" if !system_libffi && RbConfig::CONFIG['host_os'] =~ /mswin/
62
-
63
68
  create_makefile("ffi_c")
69
+
64
70
  unless system_libffi
65
71
  File.open("Makefile", "a") do |mf|
66
72
  mf.puts "LIBFFI_HOST=--host=#{RbConfig::CONFIG['host_alias']}" if RbConfig::CONFIG.has_key?("host_alias")
67
- if RbConfig::CONFIG['host_os'].downcase =~ /darwin/
73
+ if RbConfig::CONFIG['host_os'] =~ /darwin/i
74
+ if RbConfig::CONFIG['host'] =~ /arm/i
75
+ mf.puts "LIBFFI_HOST=--host=aarch64-apple-#{RbConfig::CONFIG['host_os']}"
76
+ end
68
77
  mf.puts "include ${srcdir}/libffi.darwin.mk"
69
- elsif RbConfig::CONFIG['host_os'].downcase =~ /bsd/
78
+ elsif RbConfig::CONFIG['host_os'] =~ /bsd/i
70
79
  mf.puts '.include "${srcdir}/libffi.bsd.mk"'
71
- elsif RbConfig::CONFIG['host_os'].downcase =~ /mswin64/
80
+ elsif RbConfig::CONFIG['host_os'] =~ /mswin64/i
72
81
  mf.puts '!include $(srcdir)/libffi.vc64.mk'
73
- elsif RbConfig::CONFIG['host_os'].downcase =~ /mswin32/
82
+ elsif RbConfig::CONFIG['host_os'] =~ /mswin32/i
74
83
  mf.puts '!include $(srcdir)/libffi.vc.mk'
75
84
  else
76
85
  mf.puts "include ${srcdir}/libffi.mk"
@@ -39,6 +39,10 @@ matrix:
39
39
  - os: linux
40
40
  arch: arm64
41
41
  env: HOST=aarch64-linux-gnu
42
+ - os: linux
43
+ arch: arm64
44
+ env: HOST=aarch64-linux-gnu
45
+ compiler: clang
42
46
  - os: linux
43
47
  env: HOST=arm32v7-linux-gnu LIBFFI_TEST_OPTIMIZATION="-O0"
44
48
  - os: linux
@@ -14,7 +14,7 @@
14
14
  #
15
15
  # You should have received a copy of the GNU General Public License
16
16
  # along with DejaGnu; if not, write to the Free Software Foundation,
17
- # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
+ # Inc., 51 Franklin Street, Fifth Floor, MA 02110, USA.
18
18
 
19
19
  # This is a list of toolchains that are supported on this board.
20
20
  set_board_info target_install {bfin-elf}
@@ -2,6 +2,10 @@
2
2
 
3
3
  set -x
4
4
 
5
+ # This is a policy bound API key. It can only be used with
6
+ # https://github.com/libffi/rlgl-policy.git.
7
+ RLGL_KEY=0LIBFFI-0LIBFFI-0LIBFFI-0LIBFFI
8
+
5
9
  if [ -z ${QEMU_CPU+x} ]; then
6
10
  export SET_QEMU_CPU=
7
11
  else
@@ -14,7 +14,7 @@
14
14
  #
15
15
  # You should have received a copy of the GNU General Public License
16
16
  # along with DejaGnu; if not, write to the Free Software Foundation,
17
- # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
+ # Inc., 51 Franklin Street, Fifth Floor, MA 02110, USA.
18
18
 
19
19
  # This is a list of toolchains that are supported on this board.
20
20
  set_board_info target_install {m32r-elf}
@@ -14,7 +14,7 @@
14
14
  #
15
15
  # You should have received a copy of the GNU General Public License
16
16
  # along with DejaGnu; if not, write to the Free Software Foundation,
17
- # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
+ # Inc., 51 Franklin Street, Fifth Floor, MA 02110, USA.
18
18
 
19
19
  # This is a list of toolchains that are supported on this board.
20
20
  set_board_info target_install {moxie-elf}
@@ -14,7 +14,7 @@
14
14
  #
15
15
  # You should have received a copy of the GNU General Public License
16
16
  # along with DejaGnu; if not, write to the Free Software Foundation,
17
- # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
+ # Inc., 51 Franklin Street, Fifth Floor, MA 02110, USA.
18
18
 
19
19
  # This is a list of toolchains that are supported on this board.
20
20
  set_board_info target_install {or1k-elf}
@@ -14,7 +14,7 @@
14
14
  #
15
15
  # You should have received a copy of the GNU General Public License
16
16
  # along with DejaGnu; if not, write to the Free Software Foundation,
17
- # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
+ # Inc., 51 Franklin Street, Fifth Floor, MA 02110, USA.
18
18
 
19
19
  # This is a list of toolchains that are supported on this board.
20
20
  set_board_info target_install {powerpc-eabisim}
@@ -14,7 +14,7 @@
14
14
  #
15
15
  # You should have received a copy of the GNU General Public License
16
16
  # along with DejaGnu; if not, write to the Free Software Foundation,
17
- # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
+ # Inc., 51 Franklin Street, Fifth Floor, MA 02110, USA.
18
18
 
19
19
  # This is a list of toolchains that are supported on this board.
20
20
  set_board_info target_install {i686-w64-mingw32}