ffi 1.17.0 → 1.17.2
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +17 -0
- data/Gemfile +3 -1
- data/Rakefile +2 -2
- data/ext/ffi_c/Function.c +52 -34
- data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +48 -60
- data/ext/ffi_c/libffi/Makefile.am +4 -3
- data/ext/ffi_c/libffi/Makefile.in +5 -25
- data/ext/ffi_c/libffi/README.md +19 -2
- data/ext/ffi_c/libffi/acinclude.m4 +6 -0
- data/ext/ffi_c/libffi/config.guess +80 -22
- data/ext/ffi_c/libffi/config.sub +161 -80
- data/ext/ffi_c/libffi/configure +41 -25
- data/ext/ffi_c/libffi/configure.ac +9 -8
- data/ext/ffi_c/libffi/configure.host +0 -5
- data/ext/ffi_c/libffi/doc/Makefile.in +1 -0
- data/ext/ffi_c/libffi/doc/libffi.texi +3 -3
- data/ext/ffi_c/libffi/doc/version.texi +4 -4
- data/ext/ffi_c/libffi/fficonfig.h.in +3 -3
- data/ext/ffi_c/libffi/include/Makefile.in +1 -0
- data/ext/ffi_c/libffi/include/ffi_cfi.h +2 -0
- data/ext/ffi_c/libffi/include/ffi_common.h +17 -0
- data/ext/ffi_c/libffi/man/Makefile.in +1 -0
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +7 -4
- data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +2 -2
- data/ext/ffi_c/libffi/src/aarch64/internal.h +63 -17
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +16 -12
- data/ext/ffi_c/libffi/src/arc/arcompact.S +2 -2
- data/ext/ffi_c/libffi/src/arc/ffi.c +6 -2
- data/ext/ffi_c/libffi/src/closures.c +3 -3
- data/ext/ffi_c/libffi/src/dlmalloc.c +1 -0
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +2 -4
- data/ext/ffi_c/libffi/src/mips/n32.S +4 -0
- data/ext/ffi_c/libffi/src/mips/o32.S +4 -0
- data/ext/ffi_c/libffi/src/or1k/ffi.c +2 -2
- data/ext/ffi_c/libffi/src/powerpc/ffi.c +13 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +26 -19
- data/ext/ffi_c/libffi/src/powerpc/ffi_sysv.c +26 -16
- data/ext/ffi_c/libffi/src/powerpc/internal.h +10 -0
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +47 -0
- data/ext/ffi_c/libffi/src/powerpc/ppc_closure.S +24 -0
- data/ext/ffi_c/libffi/src/prep_cif.c +1 -4
- data/ext/ffi_c/libffi/src/s390/ffi.c +28 -1
- data/ext/ffi_c/libffi/src/s390/internal.h +11 -0
- data/ext/ffi_c/libffi/src/s390/sysv.S +38 -0
- data/ext/ffi_c/libffi/src/sparc/ffi.c +16 -0
- data/ext/ffi_c/libffi/src/wasm32/ffi.c +10 -262
- data/ext/ffi_c/libffi/src/x86/ffi.c +4 -1
- data/ext/ffi_c/libffi/src/x86/ffi64.c +4 -1
- data/ext/ffi_c/libffi/testsuite/Makefile.am +4 -3
- data/ext/ffi_c/libffi/testsuite/Makefile.in +5 -3
- data/ext/ffi_c/libffi/testsuite/emscripten/build-tests.sh +4 -24
- data/ext/ffi_c/libffi/testsuite/emscripten/build.sh +8 -25
- data/ext/ffi_c/libffi/testsuite/emscripten/node-tests.sh +3 -28
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback2.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback3.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback4.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/overread.c +54 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_int_float.c +88 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +1 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +1 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/x32.c +31 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshortchar.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushortchar.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_int.c +1 -1
- data/lib/ffi/ffi.rb +59 -0
- data/lib/ffi/version.rb +1 -1
- data/sig/ffi/auto_pointer.rbs +0 -1
- data/sig/ffi/library.rbs +1 -1
- data.tar.gz.sig +0 -0
- metadata +18 -18
- metadata.gz.sig +0 -0
- data/ext/ffi_c/libffi/.circleci/config.yml +0 -156
- data/ext/ffi_c/libffi/src/nios2/ffi.c +0 -304
- data/ext/ffi_c/libffi/src/nios2/ffitarget.h +0 -52
- data/ext/ffi_c/libffi/src/nios2/sysv.S +0 -136
data/ext/ffi_c/libffi/configure
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#! /bin/sh
|
2
2
|
# Guess values for system-dependent variables and create Makefiles.
|
3
|
-
# Generated by GNU Autoconf 2.71 for libffi 3.4.
|
3
|
+
# Generated by GNU Autoconf 2.71 for libffi 3.4.8.
|
4
4
|
#
|
5
5
|
# Report bugs to <http://github.com/libffi/libffi/issues>.
|
6
6
|
#
|
@@ -621,8 +621,8 @@ MAKEFLAGS=
|
|
621
621
|
# Identity of this package.
|
622
622
|
PACKAGE_NAME='libffi'
|
623
623
|
PACKAGE_TARNAME='libffi'
|
624
|
-
PACKAGE_VERSION='3.4.
|
625
|
-
PACKAGE_STRING='libffi 3.4.
|
624
|
+
PACKAGE_VERSION='3.4.8'
|
625
|
+
PACKAGE_STRING='libffi 3.4.8'
|
626
626
|
PACKAGE_BUGREPORT='http://github.com/libffi/libffi/issues'
|
627
627
|
PACKAGE_URL=''
|
628
628
|
|
@@ -694,6 +694,7 @@ MAINT
|
|
694
694
|
MAINTAINER_MODE_FALSE
|
695
695
|
MAINTAINER_MODE_TRUE
|
696
696
|
PRTDIAG
|
697
|
+
ac_ct_READELF
|
697
698
|
READELF
|
698
699
|
CXXCPP
|
699
700
|
LT_SYS_LIBRARY_PATH
|
@@ -1412,7 +1413,7 @@ if test "$ac_init_help" = "long"; then
|
|
1412
1413
|
# Omit some internal or obsolete options to make the list less imposing.
|
1413
1414
|
# This message is too long to be a string in the A/UX 3.1 sh.
|
1414
1415
|
cat <<_ACEOF
|
1415
|
-
\`configure' configures libffi 3.4.
|
1416
|
+
\`configure' configures libffi 3.4.8 to adapt to many kinds of systems.
|
1416
1417
|
|
1417
1418
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
1418
1419
|
|
@@ -1484,7 +1485,7 @@ fi
|
|
1484
1485
|
|
1485
1486
|
if test -n "$ac_init_help"; then
|
1486
1487
|
case $ac_init_help in
|
1487
|
-
short | recursive ) echo "Configuration of libffi 3.4.
|
1488
|
+
short | recursive ) echo "Configuration of libffi 3.4.8:";;
|
1488
1489
|
esac
|
1489
1490
|
cat <<\_ACEOF
|
1490
1491
|
|
@@ -1620,7 +1621,7 @@ fi
|
|
1620
1621
|
test -n "$ac_init_help" && exit $ac_status
|
1621
1622
|
if $ac_init_version; then
|
1622
1623
|
cat <<\_ACEOF
|
1623
|
-
libffi configure 3.4.
|
1624
|
+
libffi configure 3.4.8
|
1624
1625
|
generated by GNU Autoconf 2.71
|
1625
1626
|
|
1626
1627
|
Copyright (C) 2021 Free Software Foundation, Inc.
|
@@ -2194,7 +2195,7 @@ cat >config.log <<_ACEOF
|
|
2194
2195
|
This file contains any messages produced by compilers while
|
2195
2196
|
running configure, to aid debugging if configure makes a mistake.
|
2196
2197
|
|
2197
|
-
It was created by libffi $as_me 3.4.
|
2198
|
+
It was created by libffi $as_me 3.4.8, which was
|
2198
2199
|
generated by GNU Autoconf 2.71. Invocation command line was
|
2199
2200
|
|
2200
2201
|
$ $0$ac_configure_args_raw
|
@@ -3913,7 +3914,7 @@ fi
|
|
3913
3914
|
|
3914
3915
|
# Define the identity of the package.
|
3915
3916
|
PACKAGE='libffi'
|
3916
|
-
VERSION='3.4.
|
3917
|
+
VERSION='3.4.8'
|
3917
3918
|
|
3918
3919
|
|
3919
3920
|
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
|
@@ -17377,8 +17378,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
|
17377
17378
|
|
17378
17379
|
|
17379
17380
|
if test -n "$ac_tool_prefix"; then
|
17380
|
-
|
17381
|
-
|
17381
|
+
for ac_prog in readelf greadelf
|
17382
|
+
do
|
17383
|
+
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
|
17384
|
+
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
|
17382
17385
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
17383
17386
|
printf %s "checking for $ac_word... " >&6; }
|
17384
17387
|
if test ${ac_cv_prog_READELF+y}
|
@@ -17399,7 +17402,7 @@ do
|
|
17399
17402
|
esac
|
17400
17403
|
for ac_exec_ext in '' $ac_executable_extensions; do
|
17401
17404
|
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
|
17402
|
-
ac_cv_prog_READELF="$
|
17405
|
+
ac_cv_prog_READELF="$ac_tool_prefix$ac_prog"
|
17403
17406
|
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
|
17404
17407
|
break 2
|
17405
17408
|
fi
|
@@ -17419,11 +17422,15 @@ printf "%s\n" "no" >&6; }
|
|
17419
17422
|
fi
|
17420
17423
|
|
17421
17424
|
|
17425
|
+
test -n "$READELF" && break
|
17426
|
+
done
|
17422
17427
|
fi
|
17423
|
-
if test -z "$
|
17428
|
+
if test -z "$READELF"; then
|
17424
17429
|
ac_ct_READELF=$READELF
|
17425
|
-
|
17426
|
-
|
17430
|
+
for ac_prog in readelf greadelf
|
17431
|
+
do
|
17432
|
+
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
17433
|
+
set dummy $ac_prog; ac_word=$2
|
17427
17434
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
17428
17435
|
printf %s "checking for $ac_word... " >&6; }
|
17429
17436
|
if test ${ac_cv_prog_ac_ct_READELF+y}
|
@@ -17444,7 +17451,7 @@ do
|
|
17444
17451
|
esac
|
17445
17452
|
for ac_exec_ext in '' $ac_executable_extensions; do
|
17446
17453
|
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
|
17447
|
-
ac_cv_prog_ac_ct_READELF="
|
17454
|
+
ac_cv_prog_ac_ct_READELF="$ac_prog"
|
17448
17455
|
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
|
17449
17456
|
break 2
|
17450
17457
|
fi
|
@@ -17463,6 +17470,10 @@ else
|
|
17463
17470
|
printf "%s\n" "no" >&6; }
|
17464
17471
|
fi
|
17465
17472
|
|
17473
|
+
|
17474
|
+
test -n "$ac_ct_READELF" && break
|
17475
|
+
done
|
17476
|
+
|
17466
17477
|
if test "x$ac_ct_READELF" = x; then
|
17467
17478
|
READELF=""
|
17468
17479
|
else
|
@@ -17474,8 +17485,6 @@ ac_tool_warned=yes ;;
|
|
17474
17485
|
esac
|
17475
17486
|
READELF=$ac_ct_READELF
|
17476
17487
|
fi
|
17477
|
-
else
|
17478
|
-
READELF="$ac_cv_prog_READELF"
|
17479
17488
|
fi
|
17480
17489
|
|
17481
17490
|
|
@@ -19238,7 +19247,7 @@ else $as_nop
|
|
19238
19247
|
libffi_cv_as_s390_zarch=no
|
19239
19248
|
echo 'void foo(void) { bar(); bar(); }' > conftest.c
|
19240
19249
|
if $CC $CFLAGS -S conftest.c > /dev/null 2>&1; then
|
19241
|
-
if
|
19250
|
+
if $GREP -q brasl conftest.s; then
|
19242
19251
|
libffi_cv_as_s390_zarch=yes
|
19243
19252
|
fi
|
19244
19253
|
fi
|
@@ -19271,11 +19280,11 @@ main (void)
|
|
19271
19280
|
|
19272
19281
|
#ifdef __clang__
|
19273
19282
|
# if __has_feature(ptrauth_calls)
|
19274
|
-
# define
|
19283
|
+
# define HAVE_ARM64E_PTRAUTH 1
|
19275
19284
|
# endif
|
19276
19285
|
#endif
|
19277
19286
|
|
19278
|
-
#ifndef
|
19287
|
+
#ifndef HAVE_ARM64E_PTRAUTH
|
19279
19288
|
# error Pointer authentication not supported
|
19280
19289
|
#endif
|
19281
19290
|
|
@@ -19296,7 +19305,7 @@ fi
|
|
19296
19305
|
printf "%s\n" "$libffi_cv_as_ptrauth" >&6; }
|
19297
19306
|
if test "x$libffi_cv_as_ptrauth" = xyes; then
|
19298
19307
|
|
19299
|
-
printf "%s\n" "#define
|
19308
|
+
printf "%s\n" "#define HAVE_ARM64E_PTRAUTH 1" >>confdefs.h
|
19300
19309
|
|
19301
19310
|
fi
|
19302
19311
|
|
@@ -19486,7 +19495,7 @@ else $as_nop
|
|
19486
19495
|
libffi_cv_ro_eh_frame=yes
|
19487
19496
|
echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
|
19488
19497
|
if $CC $CFLAGS -c -fpic -fexceptions $libffi_cv_no_lto -o conftest.o conftest.c > /dev/null 2>&1; then
|
19489
|
-
if $READELF -WS conftest.o 2>/dev/null |
|
19498
|
+
if $READELF -WS conftest.o 2>/dev/null | $GREP -q -n 'eh_frame .* WA'; then
|
19490
19499
|
libffi_cv_ro_eh_frame=no
|
19491
19500
|
fi
|
19492
19501
|
fi
|
@@ -19638,7 +19647,8 @@ printf "%s\n" "#define FFI_EXEC_STATIC_TRAMP 1" >>confdefs.h
|
|
19638
19647
|
|
19639
19648
|
fi
|
19640
19649
|
;;
|
19641
|
-
*arm*-*-linux-* | aarch64*-*-linux-* | i*86-*-linux-* | x86_64-*-linux-*
|
19650
|
+
*arm*-*-linux-* | aarch64*-*-linux-* | i*86-*-linux-* | x86_64-*-linux-* \
|
19651
|
+
| loongarch*-*-linux-* | s390x*-linux-* | powerpc*-linux-*)
|
19642
19652
|
|
19643
19653
|
printf "%s\n" "#define FFI_EXEC_STATIC_TRAMP 1" >>confdefs.h
|
19644
19654
|
|
@@ -19733,6 +19743,10 @@ tmake_file="${tmake_file_}"
|
|
19733
19743
|
if $LD --version 2>/dev/null | grep 'LLD '> /dev/null 2>&1; then
|
19734
19744
|
libat_ld_is_lld=yes
|
19735
19745
|
fi
|
19746
|
+
libat_ld_is_mold=no
|
19747
|
+
if $LD --version 2>/dev/null | grep 'mold '> /dev/null 2>&1; then
|
19748
|
+
libat_ld_is_mold=yes
|
19749
|
+
fi
|
19736
19750
|
|
19737
19751
|
ldver=`$LD --version 2>/dev/null |
|
19738
19752
|
sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
|
@@ -19941,6 +19955,8 @@ if test $enable_symvers != no && test $libat_shared_libgcc = yes; then
|
|
19941
19955
|
enable_symvers=gnu
|
19942
19956
|
elif test $libat_ld_is_lld = yes ; then
|
19943
19957
|
enable_symvers=gnu
|
19958
|
+
elif test $libat_ld_is_mold = yes ; then
|
19959
|
+
enable_symvers=gnu
|
19944
19960
|
else
|
19945
19961
|
# The right tools, the right setup, but too old. Fallbacks?
|
19946
19962
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: === Linker version $libat_gnu_ld_version is too old for" >&5
|
@@ -20588,7 +20604,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|
20588
20604
|
# report actual input values of CONFIG_FILES etc. instead of their
|
20589
20605
|
# values after options handling.
|
20590
20606
|
ac_log="
|
20591
|
-
This file was extended by libffi $as_me 3.4.
|
20607
|
+
This file was extended by libffi $as_me 3.4.8, which was
|
20592
20608
|
generated by GNU Autoconf 2.71. Invocation command line was
|
20593
20609
|
|
20594
20610
|
CONFIG_FILES = $CONFIG_FILES
|
@@ -20656,7 +20672,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
|
|
20656
20672
|
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
20657
20673
|
ac_cs_config='$ac_cs_config_escaped'
|
20658
20674
|
ac_cs_version="\\
|
20659
|
-
libffi config.status 3.4.
|
20675
|
+
libffi config.status 3.4.8
|
20660
20676
|
configured by $0, generated by GNU Autoconf 2.71,
|
20661
20677
|
with options \\"\$ac_cs_config\\"
|
20662
20678
|
|
@@ -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.
|
5
|
+
AC_INIT([libffi],[3.4.8],[http://github.com/libffi/libffi/issues])
|
6
6
|
AC_CONFIG_HEADERS([fficonfig.h])
|
7
7
|
|
8
8
|
AC_CANONICAL_TARGET
|
@@ -42,7 +42,7 @@ AC_PROG_EGREP
|
|
42
42
|
LT_INIT
|
43
43
|
AC_CONFIG_MACRO_DIR([m4])
|
44
44
|
|
45
|
-
|
45
|
+
AC_CHECK_TOOLS([READELF], [readelf greadelf])
|
46
46
|
|
47
47
|
# Test for 64-bit build.
|
48
48
|
AC_CHECK_SIZEOF([size_t])
|
@@ -171,7 +171,7 @@ case "$TARGET" in
|
|
171
171
|
libffi_cv_as_s390_zarch=no
|
172
172
|
echo 'void foo(void) { bar(); bar(); }' > conftest.c
|
173
173
|
if $CC $CFLAGS -S conftest.c > /dev/null 2>&1; then
|
174
|
-
if
|
174
|
+
if $GREP -q brasl conftest.s; then
|
175
175
|
libffi_cv_as_s390_zarch=yes
|
176
176
|
fi
|
177
177
|
fi
|
@@ -189,17 +189,17 @@ AC_CACHE_CHECK([whether compiler supports pointer authentication],
|
|
189
189
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
|
190
190
|
#ifdef __clang__
|
191
191
|
# if __has_feature(ptrauth_calls)
|
192
|
-
# define
|
192
|
+
# define HAVE_ARM64E_PTRAUTH 1
|
193
193
|
# endif
|
194
194
|
#endif
|
195
195
|
|
196
|
-
#ifndef
|
196
|
+
#ifndef HAVE_ARM64E_PTRAUTH
|
197
197
|
# error Pointer authentication not supported
|
198
198
|
#endif
|
199
199
|
]])],[libffi_cv_as_ptrauth=yes],[libffi_cv_as_ptrauth=no])
|
200
200
|
])
|
201
201
|
if test "x$libffi_cv_as_ptrauth" = xyes; then
|
202
|
-
AC_DEFINE(
|
202
|
+
AC_DEFINE(HAVE_ARM64E_PTRAUTH, 1,
|
203
203
|
[Define if your compiler supports pointer authentication.])
|
204
204
|
fi
|
205
205
|
|
@@ -277,7 +277,7 @@ if test "x$GCC" = "xyes"; then
|
|
277
277
|
libffi_cv_ro_eh_frame=yes
|
278
278
|
echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
|
279
279
|
if $CC $CFLAGS -c -fpic -fexceptions $libffi_cv_no_lto -o conftest.o conftest.c > /dev/null 2>&1; then
|
280
|
-
if $READELF -WS conftest.o 2>/dev/null |
|
280
|
+
if $READELF -WS conftest.o 2>/dev/null | $GREP -q -n 'eh_frame .* WA'; then
|
281
281
|
libffi_cv_ro_eh_frame=no
|
282
282
|
fi
|
283
283
|
fi
|
@@ -382,7 +382,8 @@ case "$target" in
|
|
382
382
|
[Define this if you want statically defined trampolines])
|
383
383
|
fi
|
384
384
|
;;
|
385
|
-
*arm*-*-linux-* | aarch64*-*-linux-* | i*86-*-linux-* | x86_64-*-linux-*
|
385
|
+
*arm*-*-linux-* | aarch64*-*-linux-* | i*86-*-linux-* | x86_64-*-linux-* \
|
386
|
+
| loongarch*-*-linux-* | s390x*-linux-* | powerpc*-linux-*)
|
386
387
|
AC_DEFINE(FFI_EXEC_STATIC_TRAMP, 1,
|
387
388
|
[Define this if you want statically defined trampolines])
|
388
389
|
;;
|
@@ -263,14 +263,14 @@ int main()
|
|
263
263
|
&ffi_type_sint, args) == FFI_OK)
|
264
264
|
@{
|
265
265
|
s = "Hello World!";
|
266
|
-
ffi_call(&cif, puts, &rc, values);
|
266
|
+
ffi_call(&cif, (void(*)())puts, &rc, values);
|
267
267
|
/* rc now holds the result of the call to puts */
|
268
268
|
|
269
269
|
/* values holds a pointer to the function's arg, so to
|
270
270
|
call puts() again all we need to do is change the
|
271
271
|
value of s */
|
272
272
|
s = "This is cool!";
|
273
|
-
ffi_call(&cif, puts, &rc, values);
|
273
|
+
ffi_call(&cif, (void(*)())puts, &rc, values);
|
274
274
|
@}
|
275
275
|
|
276
276
|
return 0;
|
@@ -627,7 +627,7 @@ Here is the corresponding code to describe this struct to
|
|
627
627
|
|
628
628
|
tm_type.size = tm_type.alignment = 0;
|
629
629
|
tm_type.type = FFI_TYPE_STRUCT;
|
630
|
-
tm_type.elements =
|
630
|
+
tm_type.elements = tm_type_elements;
|
631
631
|
|
632
632
|
for (i = 0; i < 9; i++)
|
633
633
|
tm_type_elements[i] = &ffi_type_sint;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
@set UPDATED
|
2
|
-
@set UPDATED-MONTH
|
3
|
-
@set EDITION 3.4.
|
4
|
-
@set VERSION 3.4.
|
1
|
+
@set UPDATED 27 March 2025
|
2
|
+
@set UPDATED-MONTH March 2025
|
3
|
+
@set EDITION 3.4.8
|
4
|
+
@set VERSION 3.4.8
|
@@ -31,6 +31,9 @@
|
|
31
31
|
/* Define to 1 if you have the <alloca.h> header file. */
|
32
32
|
#undef HAVE_ALLOCA_H
|
33
33
|
|
34
|
+
/* Define if your compiler supports pointer authentication. */
|
35
|
+
#undef HAVE_ARM64E_PTRAUTH
|
36
|
+
|
34
37
|
/* Define if your assembler supports .cfi_* directives. */
|
35
38
|
#undef HAVE_AS_CFI_PSEUDO_OP
|
36
39
|
|
@@ -71,9 +74,6 @@
|
|
71
74
|
/* Define to 1 if you have the `memfd_create' function. */
|
72
75
|
#undef HAVE_MEMFD_CREATE
|
73
76
|
|
74
|
-
/* Define if your compiler supports pointer authentication. */
|
75
|
-
#undef HAVE_PTRAUTH
|
76
|
-
|
77
77
|
/* Define if .eh_frame sections should be read-only. */
|
78
78
|
#undef HAVE_RO_EH_FRAME
|
79
79
|
|
@@ -49,6 +49,7 @@
|
|
49
49
|
# define cfi_personality(enc, exp) .cfi_personality enc, exp
|
50
50
|
# define cfi_lsda(enc, exp) .cfi_lsda enc, exp
|
51
51
|
# define cfi_escape(...) .cfi_escape __VA_ARGS__
|
52
|
+
# define cfi_window_save .cfi_window_save
|
52
53
|
|
53
54
|
#else
|
54
55
|
|
@@ -71,6 +72,7 @@
|
|
71
72
|
# define cfi_personality(enc, exp)
|
72
73
|
# define cfi_lsda(enc, exp)
|
73
74
|
# define cfi_escape(...)
|
75
|
+
# define cfi_window_save
|
74
76
|
|
75
77
|
#endif /* HAVE_AS_CFI_PSEUDO_OP */
|
76
78
|
#endif /* FFI_CFI_H */
|
@@ -83,6 +83,23 @@ char *alloca ();
|
|
83
83
|
#include <stdio.h>
|
84
84
|
#endif
|
85
85
|
|
86
|
+
#ifndef __SANITIZE_ADDRESS__
|
87
|
+
# ifdef __clang__
|
88
|
+
# if __has_feature(address_sanitizer)
|
89
|
+
# define FFI_ASAN
|
90
|
+
# endif
|
91
|
+
# endif
|
92
|
+
#endif
|
93
|
+
#ifdef __SANITIZE_ADDRESS__
|
94
|
+
#define FFI_ASAN
|
95
|
+
#endif
|
96
|
+
|
97
|
+
#ifdef FFI_ASAN
|
98
|
+
#define FFI_ASAN_NO_SANITIZE __attribute__((no_sanitize_address))
|
99
|
+
#else
|
100
|
+
#define FFI_ASAN_NO_SANITIZE
|
101
|
+
#endif
|
102
|
+
|
86
103
|
#ifdef FFI_DEBUG
|
87
104
|
NORETURN void ffi_assert(const char *expr, const char *file, int line);
|
88
105
|
void ffi_stop_here(void);
|
@@ -63,7 +63,7 @@ struct call_context
|
|
63
63
|
#if FFI_EXEC_TRAMPOLINE_TABLE
|
64
64
|
|
65
65
|
#ifdef __MACH__
|
66
|
-
#ifdef
|
66
|
+
#ifdef HAVE_ARM64E_PTRAUTH
|
67
67
|
#include <ptrauth.h>
|
68
68
|
#endif
|
69
69
|
#include <mach/vm_param.h>
|
@@ -645,7 +645,10 @@ extern void ffi_call_SYSV (struct call_context *context, void *frame,
|
|
645
645
|
void *closure) FFI_HIDDEN;
|
646
646
|
|
647
647
|
/* Call a function with the provided arguments and capture the return
|
648
|
-
value.
|
648
|
+
value.
|
649
|
+
n.b. ffi_call_SYSV will steal the alloca'd `stack` variable here for use
|
650
|
+
_as its own stack_ - so we need to compile this function without ASAN */
|
651
|
+
FFI_ASAN_NO_SANITIZE
|
649
652
|
static void
|
650
653
|
ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
|
651
654
|
void **avalue, void *closure)
|
@@ -682,7 +685,7 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
|
|
682
685
|
else if (flags & AARCH64_RET_NEED_COPY)
|
683
686
|
rsize = 16;
|
684
687
|
|
685
|
-
/* Allocate
|
688
|
+
/* Allocate consecutive stack for everything we'll need.
|
686
689
|
The frame uses 40 bytes for: lr, fp, rvalue, flags, sp */
|
687
690
|
context = alloca (sizeof(struct call_context) + stack_bytes + 40 + rsize);
|
688
691
|
stack = context + 1;
|
@@ -877,7 +880,7 @@ ffi_prep_closure_loc (ffi_closure *closure,
|
|
877
880
|
|
878
881
|
#if FFI_EXEC_TRAMPOLINE_TABLE
|
879
882
|
# ifdef __MACH__
|
880
|
-
# ifdef
|
883
|
+
# ifdef HAVE_ARM64E_PTRAUTH
|
881
884
|
codeloc = ptrauth_auth_data(codeloc, ptrauth_key_function_pointer, 0);
|
882
885
|
# endif
|
883
886
|
void **config = (void **)((uint8_t *)codeloc - PAGE_MAX_SIZE);
|
@@ -83,8 +83,8 @@ typedef enum ffi_abi
|
|
83
83
|
|
84
84
|
#if defined (__APPLE__)
|
85
85
|
#define FFI_EXTRA_CIF_FIELDS unsigned aarch64_nfixedargs
|
86
|
-
#elif !defined(_WIN32)
|
87
|
-
/* iOS and
|
86
|
+
#elif !defined(_WIN32) && !defined(__ANDROID__)
|
87
|
+
/* iOS, Windows and Android reserve x18 for the system. Disable Go closures until
|
88
88
|
a new static chain is chosen. */
|
89
89
|
#define FFI_GO_CLOSURES 1
|
90
90
|
#endif
|
@@ -81,20 +81,66 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
81
81
|
/* Helpers for writing assembly compatible with arm ptr auth */
|
82
82
|
#ifdef LIBFFI_ASM
|
83
83
|
|
84
|
-
#
|
85
|
-
|
86
|
-
#define
|
87
|
-
#define
|
88
|
-
#define
|
89
|
-
#define
|
90
|
-
#define
|
91
|
-
#
|
92
|
-
#define
|
93
|
-
#define
|
94
|
-
#define
|
95
|
-
|
96
|
-
#
|
97
|
-
#define
|
98
|
-
#
|
99
|
-
|
100
|
-
#
|
84
|
+
#if defined(HAVE_ARM64E_PTRAUTH)
|
85
|
+
/* ARM64E ABI For Darwin */
|
86
|
+
#define SIGN_LR pacibsp
|
87
|
+
#define SIGN_LR_WITH_REG(x) pacib lr, x
|
88
|
+
#define AUTH_LR_AND_RET retab
|
89
|
+
#define AUTH_LR_WITH_REG(x) autib lr, x
|
90
|
+
#define BRANCH_AND_LINK_TO_REG blraaz
|
91
|
+
#define SIGN_LR_LINUX_ONLY
|
92
|
+
#define BRANCH_TO_REG braaz
|
93
|
+
#define PAC_CFI_WINDOW_SAVE
|
94
|
+
#define GNU_PROPERTY_AARCH64_POINTER_AUTH 0
|
95
|
+
/* Linux PAC Support */
|
96
|
+
#elif defined(__ARM_FEATURE_PAC_DEFAULT)
|
97
|
+
#define GNU_PROPERTY_AARCH64_POINTER_AUTH (1 << 1)
|
98
|
+
#define PAC_CFI_WINDOW_SAVE cfi_window_save
|
99
|
+
#define TMP_REG x9
|
100
|
+
#define BRANCH_TO_REG br
|
101
|
+
#define BRANCH_AND_LINK_TO_REG blr
|
102
|
+
#define SIGN_LR_LINUX_ONLY SIGN_LR
|
103
|
+
/* Which key to sign with? */
|
104
|
+
#if (__ARM_FEATURE_PAC_DEFAULT & 1) == 1
|
105
|
+
/* Signed with A-key */
|
106
|
+
#define SIGN_LR hint #25 /* paciasp */
|
107
|
+
#define AUTH_LR hint #29 /* autiasp */
|
108
|
+
#else
|
109
|
+
/* Signed with B-key */
|
110
|
+
#define SIGN_LR hint #27 /* pacibsp */
|
111
|
+
#define AUTH_LR hint #31 /* autibsp */
|
112
|
+
#endif /* __ARM_FEATURE_PAC_DEFAULT */
|
113
|
+
#define AUTH_LR_WITH_REG(x) _auth_lr_with_reg x
|
114
|
+
.macro _auth_lr_with_reg modifier
|
115
|
+
mov TMP_REG, sp
|
116
|
+
mov sp, \modifier
|
117
|
+
AUTH_LR
|
118
|
+
mov sp, TMP_REG
|
119
|
+
.endm
|
120
|
+
#define SIGN_LR_WITH_REG(x) _sign_lr_with_reg x
|
121
|
+
.macro _sign_lr_with_reg modifier
|
122
|
+
mov TMP_REG, sp
|
123
|
+
mov sp, \modifier
|
124
|
+
SIGN_LR
|
125
|
+
mov sp, TMP_REG
|
126
|
+
.endm
|
127
|
+
#define AUTH_LR_AND_RET _auth_lr_and_ret modifier
|
128
|
+
.macro _auth_lr_and_ret modifier
|
129
|
+
AUTH_LR
|
130
|
+
ret
|
131
|
+
.endm
|
132
|
+
#undef TMP_REG
|
133
|
+
|
134
|
+
/* No Pointer Auth */
|
135
|
+
#else
|
136
|
+
#define SIGN_LR
|
137
|
+
#define SIGN_LR_WITH_REG(x)
|
138
|
+
#define AUTH_LR_AND_RET ret
|
139
|
+
#define AUTH_LR_WITH_REG(x)
|
140
|
+
#define BRANCH_AND_LINK_TO_REG blr
|
141
|
+
#define SIGN_LR_LINUX_ONLY
|
142
|
+
#define BRANCH_TO_REG br
|
143
|
+
#define PAC_CFI_WINDOW_SAVE
|
144
|
+
#define GNU_PROPERTY_AARCH64_POINTER_AUTH 0
|
145
|
+
#endif /* HAVE_ARM64E_PTRAUTH */
|
146
|
+
#endif /* LIBFFI_ASM */
|
@@ -89,30 +89,30 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
89
89
|
x5 closure
|
90
90
|
*/
|
91
91
|
|
92
|
-
cfi_startproc
|
93
92
|
CNAME(ffi_call_SYSV):
|
93
|
+
cfi_startproc
|
94
94
|
BTI_C
|
95
|
-
|
95
|
+
PAC_CFI_WINDOW_SAVE
|
96
|
+
/* Sign the lr with x1 since that is the CFA which is the modifer used in auth instructions */
|
96
97
|
SIGN_LR_WITH_REG(x1)
|
97
98
|
|
98
|
-
|
99
|
-
#if defined(HAVE_PTRAUTH) && defined(__APPLE__)
|
99
|
+
#if defined(HAVE_ARM64E_PTRAUTH) && defined(__APPLE__)
|
100
100
|
/* darwin's libunwind assumes that the cfa is the sp and that's the data
|
101
101
|
* used to sign the lr. In order to allow unwinding through this
|
102
102
|
* function it is necessary to point the cfa at the signing register.
|
103
103
|
*/
|
104
104
|
cfi_def_cfa(x1, 0);
|
105
|
-
#else
|
106
|
-
cfi_def_cfa(x1, 40);
|
107
105
|
#endif
|
106
|
+
/* Use a stack frame allocated by our caller. */
|
108
107
|
stp x29, x30, [x1]
|
108
|
+
cfi_def_cfa_register(x1)
|
109
|
+
cfi_rel_offset (x29, 0)
|
110
|
+
cfi_rel_offset (x30, 8)
|
109
111
|
mov x9, sp
|
110
112
|
str x9, [x1, #32]
|
111
113
|
mov x29, x1
|
112
|
-
mov sp, x0
|
113
114
|
cfi_def_cfa_register(x29)
|
114
|
-
|
115
|
-
cfi_rel_offset (x30, 8)
|
115
|
+
mov sp, x0
|
116
116
|
|
117
117
|
mov x9, x2 /* save fn */
|
118
118
|
mov x8, x3 /* install structure return */
|
@@ -326,6 +326,7 @@ CNAME(ffi_closure_SYSV_V):
|
|
326
326
|
cfi_startproc
|
327
327
|
BTI_C
|
328
328
|
SIGN_LR
|
329
|
+
PAC_CFI_WINDOW_SAVE
|
329
330
|
stp x29, x30, [sp, #-ffi_closure_SYSV_FS]!
|
330
331
|
cfi_adjust_cfa_offset (ffi_closure_SYSV_FS)
|
331
332
|
cfi_rel_offset (x29, 0)
|
@@ -347,10 +348,11 @@ CNAME(ffi_closure_SYSV_V):
|
|
347
348
|
#endif
|
348
349
|
|
349
350
|
.align 4
|
350
|
-
cfi_startproc
|
351
351
|
CNAME(ffi_closure_SYSV):
|
352
|
+
cfi_startproc
|
352
353
|
BTI_C
|
353
354
|
SIGN_LR
|
355
|
+
PAC_CFI_WINDOW_SAVE
|
354
356
|
stp x29, x30, [sp, #-ffi_closure_SYSV_FS]!
|
355
357
|
cfi_adjust_cfa_offset (ffi_closure_SYSV_FS)
|
356
358
|
cfi_rel_offset (x29, 0)
|
@@ -645,9 +647,11 @@ CNAME(ffi_go_closure_SYSV_V):
|
|
645
647
|
#endif
|
646
648
|
|
647
649
|
.align 4
|
648
|
-
cfi_startproc
|
649
650
|
CNAME(ffi_go_closure_SYSV):
|
651
|
+
cfi_startproc
|
650
652
|
BTI_C
|
653
|
+
SIGN_LR_LINUX_ONLY
|
654
|
+
PAC_CFI_WINDOW_SAVE
|
651
655
|
stp x29, x30, [sp, #-ffi_closure_SYSV_FS]!
|
652
656
|
cfi_adjust_cfa_offset (ffi_closure_SYSV_FS)
|
653
657
|
cfi_rel_offset (x29, 0)
|
@@ -688,7 +692,7 @@ CNAME(ffi_go_closure_SYSV):
|
|
688
692
|
.asciz "GNU";
|
689
693
|
.long 0xc0000000; /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */
|
690
694
|
.long 4;
|
691
|
-
.long GNU_PROPERTY_AARCH64_BTI;
|
695
|
+
.long GNU_PROPERTY_AARCH64_BTI | GNU_PROPERTY_AARCH64_POINTER_AUTH;
|
692
696
|
.long 0;
|
693
697
|
.popsection;
|
694
698
|
#endif
|
@@ -39,14 +39,14 @@
|
|
39
39
|
#define LARG ldl
|
40
40
|
#define SARG stl
|
41
41
|
#define ADDPTR addl
|
42
|
-
#define MOVPTR
|
42
|
+
#define MOVPTR movl
|
43
43
|
#else
|
44
44
|
#define PTRS 4
|
45
45
|
#define FLTS 4
|
46
46
|
#define LARG ld
|
47
47
|
#define SARG st
|
48
48
|
#define ADDPTR add
|
49
|
-
#define MOVPTR
|
49
|
+
#define MOVPTR mov
|
50
50
|
#endif
|
51
51
|
|
52
52
|
#define FRAME_LEN (8 * PTRS + 16)
|