ffi 1.16.3 → 1.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +42 -0
- data/Gemfile +9 -2
- data/README.md +1 -1
- data/Rakefile +17 -5
- data/ext/ffi_c/AbstractMemory.c +39 -38
- data/ext/ffi_c/ArrayType.c +2 -2
- data/ext/ffi_c/Buffer.c +4 -4
- data/ext/ffi_c/Call.c +12 -6
- data/ext/ffi_c/Call.h +3 -2
- data/ext/ffi_c/DynamicLibrary.c +2 -2
- data/ext/ffi_c/FunctionInfo.c +1 -1
- data/ext/ffi_c/LastError.c +4 -4
- data/ext/ffi_c/MemoryPointer.c +2 -2
- data/ext/ffi_c/Pointer.c +14 -11
- data/ext/ffi_c/Struct.c +11 -4
- data/ext/ffi_c/StructLayout.c +13 -13
- data/ext/ffi_c/Type.c +17 -16
- data/ext/ffi_c/Types.c +7 -1
- data/ext/ffi_c/Types.h +0 -1
- data/ext/ffi_c/Variadic.c +6 -3
- data/ext/ffi_c/libffi/.allow-ai-service +0 -0
- data/ext/ffi_c/libffi/.github/workflows/build.yml +34 -15
- data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +2 -1
- data/ext/ffi_c/libffi/LICENSE +1 -1
- data/ext/ffi_c/libffi/README.md +10 -5
- data/ext/ffi_c/libffi/configure +15 -15
- data/ext/ffi_c/libffi/configure.ac +2 -2
- data/ext/ffi_c/libffi/configure.host +1 -1
- data/ext/ffi_c/libffi/doc/libffi.texi +1 -1
- data/ext/ffi_c/libffi/doc/version.texi +4 -4
- data/ext/ffi_c/libffi/include/ffi.h.in +2 -11
- data/ext/ffi_c/libffi/include/ffi_common.h +4 -2
- data/ext/ffi_c/libffi/libffi.map.in +5 -0
- data/ext/ffi_c/libffi/libtool-version +1 -1
- data/ext/ffi_c/libffi/ltmain.sh +8 -20
- data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +1 -1
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +26 -13
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +198 -46
- data/ext/ffi_c/libffi/src/closures.c +3 -3
- data/ext/ffi_c/libffi/src/debug.c +2 -2
- data/ext/ffi_c/libffi/src/dlmalloc.c +1 -1
- data/ext/ffi_c/libffi/src/loongarch64/ffi.c +3 -0
- data/ext/ffi_c/libffi/src/mips/ffi.c +12 -4
- data/ext/ffi_c/libffi/src/mips/n32.S +65 -14
- data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +36 -24
- data/ext/ffi_c/libffi/src/sparc/ffi64.c +7 -1
- data/ext/ffi_c/libffi/src/tramp.c +1 -1
- data/ext/ffi_c/libffi/src/types.c +4 -6
- data/ext/ffi_c/libffi/src/wasm32/ffi.c +13 -0
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +1 -1
- data/ext/ffi_c/libffi/testsuite/Makefile.am +79 -127
- data/ext/ffi_c/libffi/testsuite/Makefile.in +79 -127
- data/ext/ffi_c/libffi/testsuite/emscripten/conftest.py +6 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback.c +99 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback2.c +108 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback3.c +114 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback4.c +119 -0
- data/ext/ffi_c/libffi.darwin.mk +2 -2
- data/lib/ffi/autopointer.rb +1 -9
- data/lib/ffi/dynamic_library.rb +34 -5
- data/lib/ffi/enum.rb +0 -1
- data/lib/ffi/function.rb +1 -1
- data/lib/ffi/io.rb +2 -2
- data/lib/ffi/library.rb +23 -23
- data/lib/ffi/platform/aarch64-linux/types.conf +74 -3
- data/lib/ffi/pointer.rb +6 -6
- data/lib/ffi/struct.rb +4 -4
- data/lib/ffi/struct_layout.rb +2 -2
- data/lib/ffi/struct_layout_builder.rb +8 -8
- data/lib/ffi/types.rb +51 -49
- data/lib/ffi/version.rb +1 -1
- data/sig/ffi/abstract_memory.rbs +165 -0
- data/sig/ffi/auto_pointer.rbs +27 -0
- data/sig/ffi/buffer.rbs +18 -0
- data/sig/ffi/data_converter.rbs +10 -0
- data/sig/ffi/dynamic_library.rbs +9 -0
- data/sig/ffi/enum.rbs +38 -0
- data/sig/ffi/function.rbs +39 -0
- data/sig/ffi/library.rbs +42 -0
- data/sig/ffi/native_type.rbs +86 -0
- data/sig/ffi/pointer.rbs +42 -0
- data/sig/ffi/struct.rbs +76 -0
- data/sig/ffi/struct_by_reference.rbs +11 -0
- data/sig/ffi/struct_by_value.rbs +7 -0
- data/sig/ffi/struct_layout.rbs +9 -0
- data/sig/ffi/struct_layout_builder.rbs +5 -0
- data/sig/ffi/type.rbs +39 -0
- data/sig/ffi.rbs +26 -0
- data.tar.gz.sig +0 -0
- metadata +37 -18
- metadata.gz.sig +0 -0
@@ -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
|
|
data/ext/ffi_c/libffi/ltmain.sh
CHANGED
@@ -31,7 +31,7 @@
|
|
31
31
|
|
32
32
|
PROGRAM=libtool
|
33
33
|
PACKAGE=libtool
|
34
|
-
VERSION="2.4.7 Debian-2.4.7-
|
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
|
-
|
595
|
-
|
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-
|
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
|
|
@@ -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:
|
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
|
-
"
|
398
|
+
" "BTI_J"\n" /* S3 */
|
399
|
+
" ldp s16, s17, [%3]\n"
|
397
400
|
" ldr s18, [%3, #8]\n"
|
398
401
|
" b 3f\n"
|
399
|
-
"
|
402
|
+
" "BTI_J"\n" /* S2 */
|
403
|
+
" ldp s16, s17, [%3]\n"
|
400
404
|
" b 2f\n"
|
401
405
|
" nop\n"
|
402
|
-
"
|
406
|
+
" "BTI_J"\n" /* S1 */
|
407
|
+
" ldr s16, [%3]\n"
|
403
408
|
" b 1f\n"
|
404
409
|
" nop\n"
|
405
|
-
"
|
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
|
-
"
|
414
|
+
" "BTI_J"\n" /* D3 */
|
415
|
+
" ldp d16, d17, [%3]\n"
|
409
416
|
" ldr d18, [%3, #16]\n"
|
410
417
|
" b 3f\n"
|
411
|
-
"
|
418
|
+
" "BTI_J"\n" /* D2 */
|
419
|
+
" ldp d16, d17, [%3]\n"
|
412
420
|
" b 2f\n"
|
413
421
|
" nop\n"
|
414
|
-
"
|
422
|
+
" "BTI_J"\n" /* D1 */
|
423
|
+
" ldr d16, [%3]\n"
|
415
424
|
" b 1f\n"
|
416
425
|
" nop\n"
|
417
|
-
"
|
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
|
-
"
|
430
|
+
" "BTI_J"\n" /* Q3 */
|
431
|
+
" ldp q16, q17, [%3]\n"
|
421
432
|
" ldr q18, [%3, #32]\n"
|
422
433
|
" b 3f\n"
|
423
|
-
"
|
434
|
+
" "BTI_J"\n" /* Q2 */
|
435
|
+
" ldp q16, q17, [%3]\n"
|
424
436
|
" b 2f\n"
|
425
437
|
" nop\n"
|
426
|
-
"
|
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 *
|
446
|
+
: "r"(f * 16), "r"(dest), "r"(src)
|
434
447
|
: "memory", "v16", "v17", "v18", "v19");
|
435
448
|
}
|
436
449
|
#endif
|
@@ -64,6 +64,13 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
64
64
|
#define PTR_SIZE 8
|
65
65
|
#endif
|
66
66
|
|
67
|
+
#define BTI_C hint #34
|
68
|
+
#define BTI_J hint #36
|
69
|
+
/*
|
70
|
+
* The ELF Notes section needs to indicate if BTI is supported, as the first ELF loaded that doesn't
|
71
|
+
* declare this support disables it for memory region containing the loaded library.
|
72
|
+
*/
|
73
|
+
# define GNU_PROPERTY_AARCH64_BTI (1 << 0) /* Has Branch Target Identification */
|
67
74
|
.text
|
68
75
|
.align 4
|
69
76
|
|
@@ -84,6 +91,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
84
91
|
|
85
92
|
cfi_startproc
|
86
93
|
CNAME(ffi_call_SYSV):
|
94
|
+
BTI_C
|
87
95
|
/* Sign the lr with x1 since that is where it will be stored */
|
88
96
|
SIGN_LR_WITH_REG(x1)
|
89
97
|
|
@@ -144,78 +152,142 @@ CNAME(ffi_call_SYSV):
|
|
144
152
|
/* Save the return value as directed. */
|
145
153
|
adr x5, 0f
|
146
154
|
and w4, w4, #AARCH64_RET_MASK
|
147
|
-
add x5, x5, x4, lsl #
|
155
|
+
add x5, x5, x4, lsl #4
|
148
156
|
br x5
|
149
157
|
|
150
|
-
/* Note that each table entry is
|
158
|
+
/* Note that each table entry is 4 insns, and thus 16 bytes.
|
151
159
|
For integer data, note that we're storing into ffi_arg
|
152
160
|
and therefore we want to extend to 64 bits; these types
|
153
161
|
have two consecutive entries allocated for them. */
|
154
162
|
.align 4
|
155
|
-
0:
|
163
|
+
0: BTI_J /* VOID */
|
164
|
+
b 99f
|
165
|
+
nop
|
156
166
|
nop
|
157
|
-
1:
|
167
|
+
1: BTI_J /* INT64 */
|
168
|
+
str x0, [x3]
|
158
169
|
b 99f
|
159
|
-
|
170
|
+
nop
|
171
|
+
2: BTI_J /* INT128 */
|
172
|
+
stp x0, x1, [x3]
|
160
173
|
b 99f
|
174
|
+
nop
|
161
175
|
3: brk #1000 /* UNUSED */
|
162
176
|
b 99f
|
177
|
+
nop
|
178
|
+
nop
|
163
179
|
4: brk #1000 /* UNUSED */
|
164
180
|
b 99f
|
181
|
+
nop
|
182
|
+
nop
|
165
183
|
5: brk #1000 /* UNUSED */
|
166
184
|
b 99f
|
185
|
+
nop
|
186
|
+
nop
|
167
187
|
6: brk #1000 /* UNUSED */
|
168
188
|
b 99f
|
189
|
+
nop
|
190
|
+
nop
|
169
191
|
7: brk #1000 /* UNUSED */
|
170
192
|
b 99f
|
171
|
-
|
193
|
+
nop
|
194
|
+
nop
|
195
|
+
8: BTI_J /* S4 */
|
196
|
+
st4 { v0.s, v1.s, v2.s, v3.s }[0], [x3]
|
172
197
|
b 99f
|
173
|
-
|
198
|
+
nop
|
199
|
+
9: BTI_J /* S3 */
|
200
|
+
st3 { v0.s, v1.s, v2.s }[0], [x3]
|
174
201
|
b 99f
|
175
|
-
|
202
|
+
nop
|
203
|
+
10: BTI_J /* S2 */
|
204
|
+
stp s0, s1, [x3]
|
176
205
|
b 99f
|
177
|
-
|
206
|
+
nop
|
207
|
+
11: BTI_J
|
208
|
+
str s0, [x3] /* S1 */
|
178
209
|
b 99f
|
179
|
-
|
210
|
+
nop
|
211
|
+
12: BTI_J /* D4 */
|
212
|
+
st4 { v0.d, v1.d, v2.d, v3.d }[0], [x3]
|
180
213
|
b 99f
|
181
|
-
|
214
|
+
nop
|
215
|
+
13: BTI_J /* D3 */
|
216
|
+
st3 { v0.d, v1.d, v2.d }[0], [x3]
|
182
217
|
b 99f
|
183
|
-
|
218
|
+
nop
|
219
|
+
14: BTI_J /* D2 */
|
220
|
+
stp d0, d1, [x3]
|
184
221
|
b 99f
|
185
|
-
|
222
|
+
nop
|
223
|
+
15: BTI_J /* D1 */
|
224
|
+
str d0, [x3]
|
186
225
|
b 99f
|
187
|
-
16: str q3, [x3, #48] /* Q4 */
|
188
226
|
nop
|
189
|
-
|
227
|
+
16: BTI_J /* Q4 */
|
228
|
+
str q3, [x3, #48]
|
190
229
|
nop
|
191
|
-
|
230
|
+
nop
|
231
|
+
17: BTI_J /* Q3 */
|
232
|
+
str q2, [x3, #32]
|
233
|
+
nop
|
234
|
+
nop
|
235
|
+
18: BTI_J /* Q2 */
|
236
|
+
stp q0, q1, [x3]
|
192
237
|
b 99f
|
193
|
-
|
238
|
+
nop
|
239
|
+
19: BTI_J /* Q1 */
|
240
|
+
str q0, [x3]
|
194
241
|
b 99f
|
195
|
-
|
242
|
+
nop
|
243
|
+
20: BTI_J /* UINT8 */
|
244
|
+
uxtb w0, w0
|
196
245
|
str x0, [x3]
|
246
|
+
nop
|
197
247
|
21: b 99f /* reserved */
|
198
248
|
nop
|
199
|
-
|
249
|
+
nop
|
250
|
+
nop
|
251
|
+
22: BTI_J /* UINT16 */
|
252
|
+
uxth w0, w0
|
200
253
|
str x0, [x3]
|
254
|
+
nop
|
201
255
|
23: b 99f /* reserved */
|
202
256
|
nop
|
203
|
-
|
257
|
+
nop
|
258
|
+
nop
|
259
|
+
24: BTI_J /* UINT32 */
|
260
|
+
mov w0, w0
|
204
261
|
str x0, [x3]
|
262
|
+
nop
|
205
263
|
25: b 99f /* reserved */
|
206
264
|
nop
|
207
|
-
|
265
|
+
nop
|
266
|
+
nop
|
267
|
+
26: BTI_J /* SINT8 */
|
268
|
+
sxtb x0, w0
|
208
269
|
str x0, [x3]
|
270
|
+
nop
|
209
271
|
27: b 99f /* reserved */
|
210
272
|
nop
|
211
|
-
|
273
|
+
nop
|
274
|
+
nop
|
275
|
+
28: BTI_J /* SINT16 */
|
276
|
+
sxth x0, w0
|
212
277
|
str x0, [x3]
|
278
|
+
nop
|
213
279
|
29: b 99f /* reserved */
|
214
280
|
nop
|
215
|
-
|
281
|
+
nop
|
282
|
+
nop
|
283
|
+
30: BTI_J /* SINT32 */
|
284
|
+
sxtw x0, w0
|
216
285
|
str x0, [x3]
|
286
|
+
nop
|
217
287
|
31: b 99f /* reserved */
|
218
288
|
nop
|
289
|
+
nop
|
290
|
+
nop
|
219
291
|
|
220
292
|
/* Return now that result has been populated. */
|
221
293
|
99:
|
@@ -252,6 +324,7 @@ CNAME(ffi_call_SYSV):
|
|
252
324
|
.align 4
|
253
325
|
CNAME(ffi_closure_SYSV_V):
|
254
326
|
cfi_startproc
|
327
|
+
BTI_C
|
255
328
|
SIGN_LR
|
256
329
|
stp x29, x30, [sp, #-ffi_closure_SYSV_FS]!
|
257
330
|
cfi_adjust_cfa_offset (ffi_closure_SYSV_FS)
|
@@ -276,6 +349,7 @@ CNAME(ffi_closure_SYSV_V):
|
|
276
349
|
.align 4
|
277
350
|
cfi_startproc
|
278
351
|
CNAME(ffi_closure_SYSV):
|
352
|
+
BTI_C
|
279
353
|
SIGN_LR
|
280
354
|
stp x29, x30, [sp, #-ffi_closure_SYSV_FS]!
|
281
355
|
cfi_adjust_cfa_offset (ffi_closure_SYSV_FS)
|
@@ -305,73 +379,135 @@ L(do_closure):
|
|
305
379
|
/* Load the return value as directed. */
|
306
380
|
adr x1, 0f
|
307
381
|
and w0, w0, #AARCH64_RET_MASK
|
308
|
-
add x1, x1, x0, lsl #
|
382
|
+
add x1, x1, x0, lsl #4
|
309
383
|
add x3, sp, #16+CALL_CONTEXT_SIZE
|
310
384
|
br x1
|
311
385
|
|
312
|
-
/* Note that each table entry is
|
386
|
+
/* Note that each table entry is 4 insns, and thus 16 bytes. */
|
313
387
|
.align 4
|
314
|
-
0:
|
388
|
+
0: BTI_J /* VOID */
|
389
|
+
b 99f
|
390
|
+
nop
|
315
391
|
nop
|
316
|
-
1:
|
392
|
+
1: BTI_J /* INT64 */
|
393
|
+
ldr x0, [x3]
|
317
394
|
b 99f
|
318
|
-
|
395
|
+
nop
|
396
|
+
2: BTI_J /* INT128 */
|
397
|
+
ldp x0, x1, [x3]
|
319
398
|
b 99f
|
399
|
+
nop
|
320
400
|
3: brk #1000 /* UNUSED */
|
321
401
|
nop
|
402
|
+
nop
|
403
|
+
nop
|
322
404
|
4: brk #1000 /* UNUSED */
|
323
405
|
nop
|
406
|
+
nop
|
407
|
+
nop
|
324
408
|
5: brk #1000 /* UNUSED */
|
325
409
|
nop
|
410
|
+
nop
|
411
|
+
nop
|
326
412
|
6: brk #1000 /* UNUSED */
|
327
413
|
nop
|
414
|
+
nop
|
415
|
+
nop
|
328
416
|
7: brk #1000 /* UNUSED */
|
329
417
|
nop
|
330
|
-
8: ldr s3, [x3, #12] /* S4 */
|
331
418
|
nop
|
332
|
-
9: ldr s2, [x3, #8] /* S3 */
|
333
419
|
nop
|
334
|
-
|
420
|
+
8: BTI_J /* S4 */
|
421
|
+
ldr s3, [x3, #12]
|
422
|
+
nop
|
423
|
+
nop
|
424
|
+
9: BTI_J /* S3 */
|
425
|
+
ldr s2, [x3, #8]
|
426
|
+
nop
|
427
|
+
nop
|
428
|
+
10: BTI_J /* S2 */
|
429
|
+
ldp s0, s1, [x3]
|
335
430
|
b 99f
|
336
|
-
|
431
|
+
nop
|
432
|
+
11: BTI_J /* S1 */
|
433
|
+
ldr s0, [x3]
|
337
434
|
b 99f
|
338
|
-
12: ldr d3, [x3, #24] /* D4 */
|
339
435
|
nop
|
340
|
-
|
436
|
+
12: BTI_J /* D4 */
|
437
|
+
ldr d3, [x3, #24]
|
438
|
+
nop
|
439
|
+
nop
|
440
|
+
13: BTI_J /* D3 */
|
441
|
+
ldr d2, [x3, #16]
|
341
442
|
nop
|
342
|
-
|
443
|
+
nop
|
444
|
+
14: BTI_J /* D2 */
|
445
|
+
ldp d0, d1, [x3]
|
343
446
|
b 99f
|
344
|
-
|
447
|
+
nop
|
448
|
+
15: BTI_J /* D1 */
|
449
|
+
ldr d0, [x3]
|
345
450
|
b 99f
|
346
|
-
16: ldr q3, [x3, #48] /* Q4 */
|
347
451
|
nop
|
348
|
-
|
452
|
+
16: BTI_J /* Q4 */
|
453
|
+
ldr q3, [x3, #48]
|
349
454
|
nop
|
350
|
-
|
455
|
+
nop
|
456
|
+
17: BTI_J /* Q3 */
|
457
|
+
ldr q2, [x3, #32]
|
458
|
+
nop
|
459
|
+
nop
|
460
|
+
18: BTI_J /* Q2 */
|
461
|
+
ldp q0, q1, [x3]
|
351
462
|
b 99f
|
352
|
-
|
463
|
+
nop
|
464
|
+
19: BTI_J /* Q1 */
|
465
|
+
ldr q0, [x3]
|
353
466
|
b 99f
|
354
|
-
|
467
|
+
nop
|
468
|
+
20: BTI_J /* UINT8 */
|
469
|
+
ldrb w0, [x3, #BE(7)]
|
355
470
|
b 99f
|
471
|
+
nop
|
356
472
|
21: brk #1000 /* reserved */
|
357
473
|
nop
|
358
|
-
|
474
|
+
nop
|
475
|
+
nop
|
476
|
+
22: BTI_J /* UINT16 */
|
477
|
+
ldrh w0, [x3, #BE(6)]
|
359
478
|
b 99f
|
479
|
+
nop
|
360
480
|
23: brk #1000 /* reserved */
|
361
481
|
nop
|
362
|
-
|
482
|
+
nop
|
483
|
+
nop
|
484
|
+
24: BTI_J /* UINT32 */
|
485
|
+
ldr w0, [x3, #BE(4)]
|
363
486
|
b 99f
|
487
|
+
nop
|
364
488
|
25: brk #1000 /* reserved */
|
365
489
|
nop
|
366
|
-
|
490
|
+
nop
|
491
|
+
nop
|
492
|
+
26: BTI_J /* SINT8 */
|
493
|
+
ldrsb x0, [x3, #BE(7)]
|
367
494
|
b 99f
|
495
|
+
nop
|
368
496
|
27: brk #1000 /* reserved */
|
369
497
|
nop
|
370
|
-
|
498
|
+
nop
|
499
|
+
nop
|
500
|
+
28: BTI_J /* SINT16 */
|
501
|
+
ldrsh x0, [x3, #BE(6)]
|
371
502
|
b 99f
|
503
|
+
nop
|
372
504
|
29: brk #1000 /* reserved */
|
373
505
|
nop
|
374
|
-
|
506
|
+
nop
|
507
|
+
nop
|
508
|
+
30: BTI_J /* SINT32 */
|
509
|
+
ldrsw x0, [x3, #BE(4)]
|
510
|
+
nop
|
375
511
|
nop
|
376
512
|
31: /* reserved */
|
377
513
|
99: ldp x29, x30, [sp], #ffi_closure_SYSV_FS
|
@@ -391,6 +527,7 @@ L(do_closure):
|
|
391
527
|
#if defined(FFI_EXEC_STATIC_TRAMP)
|
392
528
|
.align 4
|
393
529
|
CNAME(ffi_closure_SYSV_V_alt):
|
530
|
+
BTI_C
|
394
531
|
/* See the comments above trampoline_code_table. */
|
395
532
|
ldr x17, [sp, #8] /* Load closure in x17 */
|
396
533
|
add sp, sp, #16 /* Restore the stack */
|
@@ -405,6 +542,7 @@ CNAME(ffi_closure_SYSV_V_alt):
|
|
405
542
|
|
406
543
|
.align 4
|
407
544
|
CNAME(ffi_closure_SYSV_alt):
|
545
|
+
BTI_C
|
408
546
|
/* See the comments above trampoline_code_table. */
|
409
547
|
ldr x17, [sp, #8] /* Load closure in x17 */
|
410
548
|
add sp, sp, #16 /* Restore the stack */
|
@@ -485,6 +623,7 @@ CNAME(ffi_closure_trampoline_table_page):
|
|
485
623
|
.align 4
|
486
624
|
CNAME(ffi_go_closure_SYSV_V):
|
487
625
|
cfi_startproc
|
626
|
+
BTI_C
|
488
627
|
stp x29, x30, [sp, #-ffi_closure_SYSV_FS]!
|
489
628
|
cfi_adjust_cfa_offset (ffi_closure_SYSV_FS)
|
490
629
|
cfi_rel_offset (x29, 0)
|
@@ -508,6 +647,7 @@ CNAME(ffi_go_closure_SYSV_V):
|
|
508
647
|
.align 4
|
509
648
|
cfi_startproc
|
510
649
|
CNAME(ffi_go_closure_SYSV):
|
650
|
+
BTI_C
|
511
651
|
stp x29, x30, [sp, #-ffi_closure_SYSV_FS]!
|
512
652
|
cfi_adjust_cfa_offset (ffi_closure_SYSV_FS)
|
513
653
|
cfi_rel_offset (x29, 0)
|
@@ -539,5 +679,17 @@ CNAME(ffi_go_closure_SYSV):
|
|
539
679
|
|
540
680
|
#if defined __ELF__ && defined __linux__
|
541
681
|
.section .note.GNU-stack,"",%progbits
|
682
|
+
|
683
|
+
.pushsection .note.gnu.property, "a";
|
684
|
+
.balign 8;
|
685
|
+
.long 4;
|
686
|
+
.long 0x10;
|
687
|
+
.long 0x5;
|
688
|
+
.asciz "GNU";
|
689
|
+
.long 0xc0000000; /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */
|
690
|
+
.long 4;
|
691
|
+
.long GNU_PROPERTY_AARCH64_BTI;
|
692
|
+
.long 0;
|
693
|
+
.popsection;
|
542
694
|
#endif
|
543
695
|
|
@@ -599,7 +599,7 @@ open_temp_exec_file_memfd (const char *name)
|
|
599
599
|
|
600
600
|
/* Open a temporary file name, and immediately unlink it. */
|
601
601
|
static int
|
602
|
-
open_temp_exec_file_name (char *name, int flags)
|
602
|
+
open_temp_exec_file_name (char *name, int flags MAYBE_UNUSED)
|
603
603
|
{
|
604
604
|
int fd;
|
605
605
|
|
@@ -795,7 +795,7 @@ open_temp_exec_file (void)
|
|
795
795
|
Failure to allocate the space will cause SIGBUS to be thrown when
|
796
796
|
the mapping is subsequently written to. */
|
797
797
|
static int
|
798
|
-
allocate_space (int fd, off_t
|
798
|
+
allocate_space (int fd, off_t len)
|
799
799
|
{
|
800
800
|
static long page_size;
|
801
801
|
|
@@ -838,7 +838,7 @@ dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset)
|
|
838
838
|
|
839
839
|
offset = execsize;
|
840
840
|
|
841
|
-
if (allocate_space (execfd,
|
841
|
+
if (allocate_space (execfd, length))
|
842
842
|
return MFAIL;
|
843
843
|
|
844
844
|
flags &= ~(MAP_PRIVATE | MAP_ANONYMOUS);
|
@@ -38,7 +38,7 @@ void ffi_stop_here(void)
|
|
38
38
|
|
39
39
|
/* This function should only be called via the FFI_ASSERT() macro */
|
40
40
|
|
41
|
-
void ffi_assert(char *expr, char *file, int line)
|
41
|
+
NORETURN void ffi_assert(const char *expr, const char *file, int line)
|
42
42
|
{
|
43
43
|
fprintf(stderr, "ASSERTION FAILURE: %s at %s:%d\n", expr, file, line);
|
44
44
|
ffi_stop_here();
|
@@ -47,7 +47,7 @@ void ffi_assert(char *expr, char *file, int line)
|
|
47
47
|
|
48
48
|
/* Perform a sanity check on an ffi_type structure */
|
49
49
|
|
50
|
-
void ffi_type_test(ffi_type *a, char *file, int line)
|
50
|
+
void ffi_type_test(ffi_type *a, const char *file, int line)
|
51
51
|
{
|
52
52
|
FFI_ASSERT_AT(a != NULL, file, line);
|
53
53
|
|
@@ -28,6 +28,7 @@
|
|
28
28
|
|
29
29
|
#include <ffi.h>
|
30
30
|
#include <ffi_common.h>
|
31
|
+
#include <tramp.h>
|
31
32
|
|
32
33
|
#include <stdlib.h>
|
33
34
|
#include <stdint.h>
|
@@ -58,7 +59,9 @@
|
|
58
59
|
*/
|
59
60
|
typedef struct call_context
|
60
61
|
{
|
62
|
+
#if !defined(__loongarch_soft_float)
|
61
63
|
ABI_FLOAT fa[8];
|
64
|
+
#endif
|
62
65
|
size_t a[10];
|
63
66
|
} call_context;
|
64
67
|
|