ffi 1.9.23 → 1.9.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +66 -0
  3. data/Rakefile +1 -1
  4. data/ext/ffi_c/Call.c +5 -2
  5. data/ext/ffi_c/Function.c +8 -5
  6. data/ext/ffi_c/Thread.c +1 -0
  7. data/ext/ffi_c/extconf.rb +1 -0
  8. data/ext/ffi_c/libffi/.appveyor.yml +6 -4
  9. data/ext/ffi_c/libffi/.github/issue_template.md +10 -0
  10. data/ext/ffi_c/libffi/.gitignore +2 -0
  11. data/ext/ffi_c/libffi/.travis.yml +20 -16
  12. data/ext/ffi_c/libffi/.travis/ar-lib +270 -0
  13. data/ext/ffi_c/libffi/.travis/build.sh +34 -0
  14. data/ext/ffi_c/libffi/.travis/compile +351 -0
  15. data/ext/ffi_c/libffi/.travis/install.sh +11 -3
  16. data/ext/ffi_c/libffi/.travis/moxie-sim.exp +60 -0
  17. data/ext/ffi_c/libffi/.travis/site.exp +18 -0
  18. data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +352 -0
  19. data/ext/ffi_c/libffi/Makefile.am +4 -45
  20. data/ext/ffi_c/libffi/{README → README.md} +237 -230
  21. data/ext/ffi_c/libffi/configure.ac +10 -8
  22. data/ext/ffi_c/libffi/configure.host +5 -0
  23. data/ext/ffi_c/libffi/include/ffi.h.in +48 -26
  24. data/ext/ffi_c/libffi/include/ffi_common.h +2 -0
  25. data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +18 -16
  26. data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +21 -8
  27. data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +4 -4
  28. data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +9 -7
  29. data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +8 -5
  30. data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +5 -5
  31. data/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 +7 -6
  32. data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +99 -61
  33. data/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 +18 -8
  34. data/ext/ffi_c/libffi/m4/ax_require_defined.m4 +37 -0
  35. data/ext/ffi_c/libffi/msvcc.sh +82 -14
  36. data/ext/ffi_c/libffi/src/aarch64/ffi.c +8 -31
  37. data/ext/ffi_c/libffi/src/closures.c +31 -1
  38. data/ext/ffi_c/libffi/src/ia64/ffi.c +24 -6
  39. data/ext/ffi_c/libffi/src/ia64/ffitarget.h +2 -1
  40. data/ext/ffi_c/libffi/src/ia64/unix.S +6 -1
  41. data/ext/ffi_c/libffi/src/mips/ffi.c +29 -12
  42. data/ext/ffi_c/libffi/src/mips/ffitarget.h +7 -12
  43. data/ext/ffi_c/libffi/src/moxie/eabi.S +1 -1
  44. data/ext/ffi_c/libffi/src/moxie/ffi.c +18 -5
  45. data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +45 -16
  46. data/ext/ffi_c/libffi/src/riscv/ffi.c +445 -0
  47. data/ext/ffi_c/libffi/src/riscv/ffitarget.h +68 -0
  48. data/ext/ffi_c/libffi/src/riscv/sysv.S +214 -0
  49. data/ext/ffi_c/libffi/src/types.c +3 -1
  50. data/ext/ffi_c/libffi/src/x86/ffi.c +18 -0
  51. data/ext/ffi_c/libffi/src/x86/ffi64.c +15 -9
  52. data/ext/ffi_c/libffi/src/x86/ffitarget.h +8 -2
  53. data/ext/ffi_c/libffi/src/x86/ffiw64.c +30 -9
  54. data/ext/ffi_c/libffi/src/xtensa/sysv.S +6 -1
  55. data/ext/ffi_c/libffi/testsuite/Makefile.am +108 -77
  56. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +195 -5
  57. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/Makefile +28 -0
  58. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/README +78 -0
  59. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/alignof.h +50 -0
  60. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +58 -0
  61. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +1745 -0
  62. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +2885 -0
  63. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +743 -0
  64. data/ext/ffi_c/libffi/testsuite/libffi.call/align_stdcall.c +46 -0
  65. data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +14 -1
  66. data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +3 -1
  67. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct10.c +1 -0
  68. data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +57 -0
  69. data/ext/ffi_c/libffi/testsuite/libffi.call/unwindtest.cc +1 -1
  70. data/ext/ffi_c/libffi/testsuite/libffi.call/unwindtest_ffi_call.cc +1 -1
  71. data/lib/ffi/library.rb +2 -4
  72. data/lib/ffi/platform/mips64-linux/types.conf +104 -0
  73. data/lib/ffi/platform/mipsisa32r6-linux/types.conf +102 -0
  74. data/lib/ffi/platform/mipsisa32r6el-linux/types.conf +102 -0
  75. data/lib/ffi/platform/mipsisa64r6-linux/types.conf +104 -0
  76. data/lib/ffi/platform/mipsisa64r6el-linux/types.conf +104 -0
  77. data/lib/ffi/version.rb +1 -1
  78. metadata +29 -3
@@ -169,8 +169,13 @@ ENTRY(ffi_cacheflush)
169
169
 
170
170
  entry a1, 16
171
171
 
172
- 1: dhwbi a2, 0
172
+ 1:
173
+ #if XCHAL_DCACHE_SIZE
174
+ dhwbi a2, 0
175
+ #endif
176
+ #if XCHAL_ICACHE_SIZE
173
177
  ihi a2, 0
178
+ #endif
174
179
  addi a2, a2, 4
175
180
  blt a2, a3, 1b
176
181
 
@@ -6,81 +6,112 @@ EXTRA_DEJAGNU_SITE_CONFIG=../local.exp
6
6
 
7
7
  CLEANFILES = *.exe core* *.log *.sum
8
8
 
9
- EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \
10
- libffi.call/cls_align_longdouble_split.c \
11
- libffi.call/closure_loc_fn0.c libffi.call/cls_schar.c \
12
- libffi.call/closure_fn1.c \
13
- libffi.call/return_ul.c libffi.call/cls_align_double.c \
14
- libffi.call/return_fl2.c libffi.call/cls_1_1byte.c \
15
- libffi.call/cls_64byte.c libffi.call/nested_struct7.c \
16
- libffi.call/cls_align_sint32.c libffi.call/nested_struct2.c \
17
- libffi.call/ffitest.h libffi.call/nested_struct4.c \
18
- libffi.call/cls_multi_ushort.c libffi.call/struct3.c \
19
- libffi.call/cls_3byte1.c libffi.call/cls_16byte.c \
20
- libffi.call/struct8.c libffi.call/nested_struct8.c \
21
- libffi.call/cls_multi_sshort.c libffi.call/cls_3byte2.c \
22
- libffi.call/cls_pointer.c \
9
+ EXTRA_DIST = lib/target-libpath.exp lib/libffi.exp lib/wrapper.exp \
10
+ libffi.call/strlen4.c libffi.call/cls_multi_sshort.c \
11
+ libffi.call/cls_align_longdouble_split2.c libffi.call/cls_1_1byte.c \
12
+ libffi.call/struct10.c libffi.call/cls_uint_va.c \
13
+ libffi.call/many_mixed.c libffi.call/float.c libffi.call/struct5.c \
14
+ libffi.call/return_fl3.c libffi.call/cls_3_1byte.c \
15
+ libffi.call/return_fl1.c libffi.call/cls_many_mixed_args.c \
16
+ libffi.call/cls_20byte1.c libffi.call/cls_pointer_stack.c \
17
+ libffi.call/cls_align_float.c libffi.call/call.exp \
18
+ libffi.call/pyobjc-tc.c libffi.call/float_va.c \
19
+ libffi.call/cls_5_1_byte.c libffi.call/cls_9byte1.c \
20
+ libffi.call/cls_align_uint32.c libffi.call/stret_medium.c \
21
+ libffi.call/cls_3byte1.c libffi.call/cls_align_uint64.c \
22
+ libffi.call/cls_longdouble_va.c libffi.call/cls_align_pointer.c \
23
+ libffi.call/cls_19byte.c libffi.call/cls_ushort.c \
24
+ libffi.call/cls_align_sint32.c libffi.call/struct8.c \
25
+ libffi.call/pr1172638.c libffi.call/cls_ulonglong.c \
26
+ libffi.call/cls_struct_va1.c libffi.call/cls_9byte2.c \
27
+ libffi.call/closure_fn5.c libffi.call/cls_5byte.c \
28
+ libffi.call/cls_3float.c libffi.call/return_sc.c \
29
+ libffi.call/cls_schar.c libffi.call/closure_fn4.c \
30
+ libffi.call/cls_uchar_va.c libffi.call/closure_fn0.c \
31
+ libffi.call/huge_struct.c libffi.call/va_struct1.c \
32
+ libffi.call/cls_ushort_va.c libffi.call/struct9.c libffi.call/va_1.c \
33
+ libffi.call/cls_64byte.c libffi.call/va_struct2.c \
34
+ libffi.call/cls_longdouble.c libffi.call/return_fl2.c \
35
+ libffi.call/cls_ulong_va.c libffi.call/cls_6_1_byte.c \
36
+ libffi.call/cls_align_uint16.c libffi.call/closure_fn2.c \
37
+ libffi.call/align_mixed.c libffi.call/unwindtest_ffi_call.cc \
38
+ libffi.call/cls_multi_ushortchar.c libffi.call/cls_8byte.c \
39
+ libffi.call/ffitest.h libffi.call/nested_struct8.c \
40
+ libffi.call/cls_pointer.c libffi.call/nested_struct2.c \
41
+ libffi.call/nested_struct.c libffi.call/struct4.c \
42
+ libffi.call/cls_multi_schar.c libffi.call/cls_align_longdouble_split.c \
43
+ libffi.call/cls_uchar.c libffi.call/return_ldl.c \
44
+ libffi.call/nested_struct9.c libffi.call/cls_float.c \
45
+ libffi.call/stret_medium2.c libffi.call/closure_loc_fn0.c \
46
+ libffi.call/float3.c libffi.call/cls_6byte.c libffi.call/return_sl.c \
47
+ libffi.call/closure_simple.c libffi.call/return_dbl1.c \
48
+ libffi.call/cls_align_double.c libffi.call/cls_multi_uchar.c \
23
49
  libffi.call/err_bad_typedef.c libffi.call/cls_4_1byte.c \
24
- libffi.call/cls_9byte2.c libffi.call/cls_multi_schar.c \
25
- libffi.call/stret_medium2.c libffi.call/cls_5_1_byte.c \
26
- libffi.call/call.exp libffi.call/cls_double.c \
27
- libffi.call/cls_align_sint16.c libffi.call/cls_uint.c \
28
- libffi.call/return_ll1.c libffi.call/nested_struct3.c \
29
- libffi.call/cls_20byte1.c libffi.call/closure_fn4.c \
30
- libffi.call/cls_uchar.c libffi.call/struct2.c libffi.call/cls_7byte.c \
31
- libffi.call/strlen.c libffi.call/many.c libffi.call/testclosure.c \
32
- libffi.call/return_fl.c libffi.call/struct5.c \
33
- libffi.call/cls_12byte.c libffi.call/cls_multi_sshortchar.c \
34
- libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \
35
- libffi.call/return_fl3.c libffi.call/stret_medium.c \
36
- libffi.call/nested_struct6.c libffi.call/closure_fn3.c \
37
- libffi.call/float3.c libffi.call/many2.c \
38
- libffi.call/closure_simple.c libffi.call/cls_align_uint16.c \
39
- libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \
40
- libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \
41
- libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \
42
- libffi.call/cls_sshort.c \
43
- libffi.call/nested_struct.c libffi.call/cls_20byte.c \
44
- libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \
45
- libffi.call/return_uc.c \
46
- libffi.call/cls_18byte.c libffi.call/cls_8byte.c \
47
- libffi.call/promotion.c \
48
- libffi.call/return_dbl.c libffi.call/cls_24byte.c \
49
- libffi.call/struct4.c libffi.call/cls_6byte.c \
50
- libffi.call/cls_align_uint32.c libffi.call/float.c \
51
- libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \
52
- libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \
53
- libffi.call/cls_align_float.c libffi.call/return_fl1.c \
54
- libffi.call/nested_struct10.c libffi.call/nested_struct5.c \
55
- libffi.call/cls_align_sint64.c \
56
- libffi.call/stret_large2.c libffi.call/return_sl.c \
57
- libffi.call/closure_fn0.c libffi.call/cls_5byte.c \
58
- libffi.call/cls_2byte.c libffi.call/float2.c \
59
- libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \
60
- libffi.call/stret_large.c libffi.call/cls_ulonglong.c \
61
- libffi.call/cls_ushort.c libffi.call/nested_struct1.c \
62
- libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \
63
- libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \
64
- libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \
65
- libffi.call/struct1.c libffi.call/nested_struct9.c \
66
- libffi.call/huge_struct.c libffi.call/problem1.c \
67
- libffi.call/float4.c \
68
- libffi.call/return_ldl.c \
69
- libffi.call/closure_fn5.c \
70
- libffi.call/struct6.c libffi.call/return_ll.c libffi.call/struct9.c \
71
- libffi.call/return_sc.c libffi.call/struct7.c \
72
- libffi.call/cls_align_uint64.c libffi.call/cls_4byte.c \
73
- libffi.call/cls_6_1_byte.c \
74
- libffi.call/cls_7_1_byte.c libffi.call/unwindtest.cc \
75
- libffi.call/unwindtest_ffi_call.cc \
76
- lib/wrapper.exp lib/target-libpath.exp \
77
- lib/libffi.exp libffi.call/cls_struct_va1.c \
78
- libffi.call/cls_uchar_va.c libffi.call/cls_uint_va.c \
79
- libffi.call/cls_ulong_va.c libffi.call/cls_ushort_va.c \
80
- libffi.call/nested_struct11.c libffi.call/uninitialized.c \
81
- libffi.call/va_1.c libffi.call/va_struct1.c libffi.call/va_struct2.c \
82
- libffi.call/va_struct3.c \
83
- libffi.call/strlen2.c \
84
- libffi.call/strlen3.c \
85
- libffi.call/strlen4.c \
86
- libffi.call/cls_3float.c
50
+ libffi.call/closure_fn3.c libffi.call/return_ll1.c \
51
+ libffi.call/return_dbl2.c libffi.call/cls_align_sint64.c \
52
+ libffi.call/nested_struct1.c libffi.call/negint.c \
53
+ libffi.call/nested_struct3.c libffi.call/unwindtest.cc \
54
+ libffi.call/struct2.c libffi.call/struct3.c libffi.call/return_fl.c \
55
+ libffi.call/nested_struct5.c libffi.call/cls_multi_ushort.c \
56
+ libffi.call/nested_struct11.c libffi.call/cls_multi_sshortchar.c \
57
+ libffi.call/cls_align_longdouble.c libffi.call/cls_dbls_struct.c \
58
+ libffi.call/cls_many_mixed_float_double.c libffi.call/stret_large.c \
59
+ libffi.call/stret_large2.c libffi.call/cls_align_sint16.c \
60
+ libffi.call/cls_2byte.c libffi.call/offsets.c libffi.call/struct7.c \
61
+ libffi.call/nested_struct4.c libffi.call/problem1.c \
62
+ libffi.call/va_struct3.c libffi.call/testclosure.c \
63
+ libffi.call/float1.c libffi.call/nested_struct6.c \
64
+ libffi.call/cls_4byte.c libffi.call/cls_24byte.c \
65
+ libffi.call/uninitialized.c libffi.call/many2.c \
66
+ libffi.call/nested_struct10.c libffi.call/struct6.c \
67
+ libffi.call/strlen2.c libffi.call/float2.c libffi.call/cls_uint.c \
68
+ libffi.call/cls_12byte.c libffi.call/return_ul.c \
69
+ libffi.call/cls_sint.c libffi.call/cls_7_1_byte.c \
70
+ libffi.call/struct1.c libffi.call/cls_sshort.c \
71
+ libffi.call/cls_16byte.c libffi.call/strlen3.c \
72
+ libffi.call/nested_struct7.c libffi.call/cls_double_va.c \
73
+ libffi.call/return_dbl.c libffi.call/cls_3byte2.c libffi.call/float4.c \
74
+ libffi.call/cls_double.c libffi.call/many.c libffi.call/cls_7byte.c \
75
+ libffi.call/strlen.c libffi.call/closure_fn6.c libffi.call/return_uc.c \
76
+ libffi.call/closure_fn1.c libffi.call/cls_20byte.c \
77
+ libffi.call/cls_18byte.c libffi.call/err_bad_abi.c \
78
+ libffi.call/many_double.c libffi.call/return_ll.c \
79
+ libffi.call/promotion.c libffi.complex/complex_defs_longdouble.inc \
80
+ libffi.complex/cls_align_complex_float.c \
81
+ libffi.complex/cls_complex_va_float.c \
82
+ libffi.complex/cls_complex_struct_float.c \
83
+ libffi.complex/return_complex2_longdouble.c \
84
+ libffi.complex/cls_complex_float.c \
85
+ libffi.complex/return_complex_longdouble.c \
86
+ libffi.complex/return_complex2_float.c libffi.complex/cls_complex.inc \
87
+ libffi.complex/cls_complex_va_longdouble.c \
88
+ libffi.complex/return_complex_double.c \
89
+ libffi.complex/return_complex.inc libffi.complex/many_complex.inc \
90
+ libffi.complex/complex_float.c libffi.complex/cls_align_complex.inc \
91
+ libffi.complex/return_complex2_double.c \
92
+ libffi.complex/many_complex_float.c libffi.complex/ffitest.h \
93
+ libffi.complex/return_complex1_double.c \
94
+ libffi.complex/cls_complex_struct_longdouble.c \
95
+ libffi.complex/complex_defs_double.inc \
96
+ libffi.complex/cls_complex_va_double.c \
97
+ libffi.complex/many_complex_double.c \
98
+ libffi.complex/return_complex2.inc \
99
+ libffi.complex/return_complex1_float.c \
100
+ libffi.complex/complex_longdouble.c \
101
+ libffi.complex/complex_defs_float.inc \
102
+ libffi.complex/cls_complex_double.c \
103
+ libffi.complex/cls_align_complex_double.c \
104
+ libffi.complex/cls_align_complex_longdouble.c \
105
+ libffi.complex/complex_double.c libffi.complex/cls_complex_va.inc \
106
+ libffi.complex/many_complex_longdouble.c libffi.complex/complex.inc \
107
+ libffi.complex/return_complex1_longdouble.c \
108
+ libffi.complex/complex_int.c libffi.complex/cls_complex_longdouble.c \
109
+ libffi.complex/cls_complex_struct_double.c \
110
+ libffi.complex/return_complex1.inc libffi.complex/complex.exp \
111
+ libffi.complex/cls_complex_struct.inc \
112
+ libffi.complex/return_complex_float.c libffi.go/closure1.c \
113
+ libffi.go/aa-direct.c libffi.go/ffitest.h libffi.go/go.exp \
114
+ libffi.go/static-chain.h libffi.bhaible/bhaible.exp \
115
+ libffi.bhaible/test-call.c libffi.bhaible/alignof.h \
116
+ libffi.bhaible/testcases.c libffi.bhaible/test-callback.c \
117
+ libffi.bhaible/Makefile libffi.bhaible/README config/default.exp
@@ -24,6 +24,183 @@ load_lib libgloss.exp
24
24
  load_gcc_lib target-libpath.exp
25
25
  load_gcc_lib wrapper.exp
26
26
 
27
+ proc check_effective_target_gccbug { } {
28
+ global has_gccbug
29
+ return $has_gccbug
30
+ }
31
+
32
+ # Return 1 if the target matches the effective target 'arg', 0 otherwise.
33
+ # This can be used with any check_* proc that takes no argument and
34
+ # returns only 1 or 0. It could be used with check_* procs that take
35
+ # arguments with keywords that pass particular arguments.
36
+
37
+ proc is-effective-target { arg } {
38
+ global et_index
39
+ set selected 0
40
+ if { ![info exists et_index] } {
41
+ # Initialize the effective target index that is used in some
42
+ # check_effective_target_* procs.
43
+ set et_index 0
44
+ }
45
+ if { [info procs check_effective_target_${arg}] != [list] } {
46
+ set selected [check_effective_target_${arg}]
47
+ } else {
48
+ error "unknown effective target keyword `$arg'"
49
+ }
50
+ verbose "is-effective-target: $arg $selected" 2
51
+ return $selected
52
+ }
53
+
54
+ proc is-effective-target-keyword { arg } {
55
+ if { [info procs check_effective_target_${arg}] != [list] } {
56
+ return 1
57
+ } else {
58
+ return 0
59
+ }
60
+ }
61
+
62
+ # Intercept the call to the DejaGnu version of dg-process-target to
63
+ # support use of an effective-target keyword in place of a list of
64
+ # target triplets to xfail or skip a test.
65
+ #
66
+ # The argument to dg-process-target is the keyword "target" or "xfail"
67
+ # followed by a selector:
68
+ # target-triplet-1 ...
69
+ # effective-target-keyword
70
+ # selector-expression
71
+ #
72
+ # For a target list the result is "S" if the target is selected, "N" otherwise.
73
+ # For an xfail list the result is "F" if the target is affected, "P" otherwise.
74
+
75
+ # In contexts that allow either "target" or "xfail" the argument can be
76
+ # target selector1 xfail selector2
77
+ # which returns "N" if selector1 is not selected, otherwise the result of
78
+ # "xfail selector2".
79
+ #
80
+ # A selector expression appears within curly braces and uses a single logical
81
+ # operator: !, &&, or ||. An operand is another selector expression, an
82
+ # effective-target keyword, or a list of target triplets within quotes or
83
+ # curly braces.
84
+
85
+ if { [info procs saved-dg-process-target] == [list] } {
86
+ rename dg-process-target saved-dg-process-target
87
+
88
+ # Evaluate an operand within a selector expression.
89
+ proc selector_opd { op } {
90
+ set selector "target"
91
+ lappend selector $op
92
+ set answer [ expr { [dg-process-target $selector] == "S" } ]
93
+ verbose "selector_opd: `$op' $answer" 2
94
+ return $answer
95
+ }
96
+
97
+ # Evaluate a target triplet list within a selector expression.
98
+ # Unlike other operands, this needs to be expanded from a list to
99
+ # the same string as "target".
100
+ proc selector_list { op } {
101
+ set selector "target [join $op]"
102
+ set answer [ expr { [dg-process-target $selector] == "S" } ]
103
+ verbose "selector_list: `$op' $answer" 2
104
+ return $answer
105
+ }
106
+
107
+ # Evaluate a selector expression.
108
+ proc selector_expression { exp } {
109
+ if { [llength $exp] == 2 } {
110
+ if [string match "!" [lindex $exp 0]] {
111
+ set op1 [lindex $exp 1]
112
+ set answer [expr { ! [selector_opd $op1] }]
113
+ } else {
114
+ # Assume it's a list of target triplets.
115
+ set answer [selector_list $exp]
116
+ }
117
+ } elseif { [llength $exp] == 3 } {
118
+ set op1 [lindex $exp 0]
119
+ set opr [lindex $exp 1]
120
+ set op2 [lindex $exp 2]
121
+ if [string match "&&" $opr] {
122
+ set answer [expr { [selector_opd $op1] && [selector_opd $op2] }]
123
+ } elseif [string match "||" $opr] {
124
+ set answer [expr { [selector_opd $op1] || [selector_opd $op2] }]
125
+ } else {
126
+ # Assume it's a list of target triplets.
127
+ set answer [selector_list $exp]
128
+ }
129
+ } else {
130
+ # Assume it's a list of target triplets.
131
+ set answer [selector_list $exp]
132
+ }
133
+
134
+ verbose "selector_expression: `$exp' $answer" 2
135
+ return $answer
136
+ }
137
+
138
+ # Evaluate "target selector" or "xfail selector".
139
+
140
+ proc dg-process-target-1 { args } {
141
+ verbose "dg-process-target-1: `$args'" 2
142
+
143
+ # Extract the 'what' keyword from the argument list.
144
+ set selector [string trim [lindex $args 0]]
145
+ if [regexp "^xfail " $selector] {
146
+ set what "xfail"
147
+ } elseif [regexp "^target " $selector] {
148
+ set what "target"
149
+ } else {
150
+ error "syntax error in target selector \"$selector\""
151
+ }
152
+
153
+ # Extract the rest of the list, which might be a keyword.
154
+ regsub "^${what}" $selector "" rest
155
+ set rest [string trim $rest]
156
+
157
+ if [is-effective-target-keyword $rest] {
158
+ # The selector is an effective target keyword.
159
+ if [is-effective-target $rest] {
160
+ return [expr { $what == "xfail" ? "F" : "S" }]
161
+ } else {
162
+ return [expr { $what == "xfail" ? "P" : "N" }]
163
+ }
164
+ }
165
+
166
+ if [string match "{*}" $rest] {
167
+ if [selector_expression [lindex $rest 0]] {
168
+ return [expr { $what == "xfail" ? "F" : "S" }]
169
+ } else {
170
+ return [expr { $what == "xfail" ? "P" : "N" }]
171
+ }
172
+ }
173
+
174
+ # The selector is not an effective-target keyword, so process
175
+ # the list of target triplets.
176
+ return [saved-dg-process-target $selector]
177
+ }
178
+
179
+ # Intercept calls to the DejaGnu function. In addition to
180
+ # processing "target selector" or "xfail selector", handle
181
+ # "target selector1 xfail selector2".
182
+
183
+ proc dg-process-target { args } {
184
+ verbose "replacement dg-process-target: `$args'" 2
185
+
186
+ set selector [string trim [lindex $args 0]]
187
+
188
+ # If the argument list contains both 'target' and 'xfail',
189
+ # process 'target' and, if that succeeds, process 'xfail'.
190
+ if [regexp "^target .* xfail .*" $selector] {
191
+ set xfail_index [string first "xfail" $selector]
192
+ set xfail_selector [string range $selector $xfail_index end]
193
+ set target_selector [string range $selector 0 [expr $xfail_index-1]]
194
+ set target_selector [string trim $target_selector]
195
+ if { [dg-process-target-1 $target_selector] == "N" } {
196
+ return "N"
197
+ }
198
+ return [dg-process-target-1 $xfail_selector]
199
+
200
+ }
201
+ return [dg-process-target-1 $selector]
202
+ }
203
+ }
27
204
 
28
205
  # Define libffi callbacks for dg.exp.
29
206
 
@@ -299,14 +476,15 @@ proc libffi-dg-runtest { testcases default-extra-flags } {
299
476
 
300
477
  proc run-many-tests { testcases extra_flags } {
301
478
  global compiler_vendor
479
+ global has_gccbug
302
480
  switch $compiler_vendor {
303
481
  "clang" {
304
482
  set common "-W -Wall"
305
- set optimizations { "-O0" "-O1" "-O2" "-O3" "-Os" }
483
+ set optimizations { "-O0" "-O2" "-Os" }
306
484
  }
307
485
  "gnu" {
308
486
  set common "-W -Wall -Wno-psabi"
309
- set optimizations { "-O0" "-O2" "-O3" "-Os" "-O2 -fomit-frame-pointer" }
487
+ set optimizations { "-O0" "-O2" "-Os" "-O2 -fomit-frame-pointer" }
310
488
  }
311
489
  default {
312
490
  # Assume we are using the vendor compiler.
@@ -317,7 +495,7 @@ proc run-many-tests { testcases extra_flags } {
317
495
 
318
496
  set targetabis { "" }
319
497
  if [string match $compiler_vendor "gnu"] {
320
- if [istarget "i?86-*-*"] {
498
+ if [libffi_feature_test "#ifdef __i386__"] {
321
499
  set targetabis {
322
500
  ""
323
501
  "-DABI_NUM=FFI_STDCALL -DABI_ATTR=__STDCALL__"
@@ -325,10 +503,11 @@ proc run-many-tests { testcases extra_flags } {
325
503
  "-DABI_NUM=FFI_FASTCALL -DABI_ATTR=__FASTCALL__"
326
504
  }
327
505
  } elseif { [istarget "x86_64-*-*"] \
328
- && [libffi_feature_test "#ifndef __ILP32__"] } {
506
+ && [libffi_feature_test "#if !defined __ILP32__ \
507
+ && !defined __i386__"] } {
329
508
  set targetabis {
330
509
  ""
331
- "-DABI_NUM=FFI_WIN64 -DABI_ATTR=__MSABI__"
510
+ "-DABI_NUM=FFI_GNUW64 -DABI_ATTR=__MSABI__"
332
511
  }
333
512
  }
334
513
  }
@@ -344,6 +523,17 @@ proc run-many-tests { testcases extra_flags } {
344
523
  foreach opt $optimizations {
345
524
  foreach abi $abis {
346
525
  set options [concat $common $opt $abi]
526
+ set has_gccbug false;
527
+ if { [string match $compiler_vendor "gnu"] \
528
+ && [string match "*MSABI*" $abi] \
529
+ && ( ( [string match "*DGTEST=57 *" $common] \
530
+ && [string match "*call.c*" $testname] ) \
531
+ || ( [string match "*DGTEST=54 *" $common] \
532
+ && [string match "*callback*" $testname] ) \
533
+ || [string match "*DGTEST=55 *" $common] \
534
+ || [string match "*DGTEST=56 *" $common] ) } then {
535
+ set has_gccbug true;
536
+ }
347
537
  verbose "Testing $testname, $options" 1
348
538
  dg-test $test $options ""
349
539
  }
@@ -0,0 +1,28 @@
1
+ CC = gcc
2
+ CFLAGS = -O2 -Wall
3
+ prefix =
4
+ includedir = $(prefix)/include
5
+ libdir = $(prefix)/lib
6
+ CPPFLAGS = -I$(includedir)
7
+ LDFLAGS = -L$(libdir) -Wl,-rpath,$(libdir)
8
+
9
+ all: check-call check-callback
10
+
11
+ test-call: test-call.c testcases.c
12
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o test-call test-call.c -lffi
13
+
14
+ test-callback: test-callback.c testcases.c
15
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o test-callback test-callback.c -lffi
16
+
17
+ check-call: test-call
18
+ ./test-call > test-call.out
19
+ LC_ALL=C uniq -u < test-call.out > failed-call
20
+ test '!' -s failed-call
21
+
22
+ check-callback: test-callback
23
+ ./test-callback > test-callback.out
24
+ LC_ALL=C uniq -u < test-callback.out > failed-callback
25
+ test '!' -s failed-callback
26
+
27
+ clean:
28
+ rm -f test-call test-callback test-call.out test-callback.out failed-call failed-callback