deps: update libffi to 3.8.1

PR-URL: https://github.com/nodejs/node/pull/67476
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Node.js GitHub Bot authored and Antoine du Hamel committed 2026-11-19 15:42:20 +01:00
1 parent a8944e6405
commit de52e06e41
100 files changed
+12751 -4865

No files matched your search

+2046
View File
File diff suppressed because it is too large. Load diff
+15 -3
View File
@@ -26,10 +26,14 @@ EXTRA_DIST = LICENSE ChangeLog.old \
libffi.xcodeproj/project.pbxproj \
src/powerpc/t-aix \
libtool-ldflags libtool-version configure.host README.md \
libffi.map.in LICENSE-BUILDTOOLS msvc_build make_sunver.pl
libffi.map.in LICENSE-BUILDTOOLS msvc_build make_sunver.pl \
testsuite/check-dlmalloc-static.sh
check-local: src/closures.lo
$(SHELL) $(srcdir)/testsuite/check-dlmalloc-static.sh "$(NM)" src/closures.lo
# local.exp is generated by configure
DISTCLEANFILES = local.exp
DISTCLEANFILES = local.exp libffi.map libffi.map-sun
# Subdir rules rely on $(FLAGS_TO_PASS)
FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@@ -154,8 +158,16 @@ AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
AM_CCASFLAGS = '$(AM_CPPFLAGS)'
dist-hook:
d=`(cd $(distdir); pwd)`; (cd doc; make pdf; cp *.pdf $$d/doc)
if BUILD_DOCS
d=`(cd $(distdir); pwd)`; \
if (cd doc && make pdf && cp *.pdf $$d/doc); then \
:; \
else \
echo "dist-hook: PDF manual not built (no TeX engine?), omitting it from the dist"; \
fi
endif
if [ -d $(top_srcdir)/.git ] ; then (cd $(top_srcdir); git log --no-decorate) ; else echo 'See git log for history.' ; fi > $(distdir)/ChangeLog
rm -f $(distdir)/README.md; \
s=`awk '/was released on/{ print NR; exit}' $(top_srcdir)/README.md`; \
if [ -n "$$s" ]; then tail -n +$$(($$s-1)) $(top_srcdir)/README.md; else cat $(top_srcdir)/README.md; fi > $(distdir)/README.md
+215 -189
View File
@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# Makefile.in generated by automake 1.18.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# Copyright (C) 1994-2025 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -72,6 +72,8 @@ am__make_running_with_option = \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
am__rm_f = rm -f $(am__rm_f_notfound)
am__rm_rf = rm -rf $(am__rm_f_notfound)
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -145,10 +147,9 @@ am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
{ test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \
}
am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \
"$(DESTDIR)$(pkgconfigdir)"
@@ -336,8 +337,8 @@ distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
if test -d "$(distdir)"; then \
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -rf "$(distdir)" \
find "$(distdir)" -type d ! -perm -700 -exec chmod u+rwx {} ';' \
; rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
am__post_remove_distdir = $(am__remove_distdir)
@@ -367,14 +368,16 @@ am__relativize = \
done; \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
GZIP_ENV = -9
DIST_TARGETS = dist-gzip
# Exists only to be overridden by the user if desired.
AM_DISTCHECK_DVI_TARGET = dvi
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print
distcleancheck_listfiles = \
find . \( -type f -a \! \
\( -name .nfs* -o -name .smb* -o -name .__afs* \) \) -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
@@ -476,8 +479,10 @@ ac_ct_READELF = @ac_ct_READELF@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__rm_f_notfound = @am__rm_f_notfound@
am__tar = @am__tar@
am__untar = @am__untar@
am__xargs_n = @am__xargs_n@
ax_enable_builddir_sed = @ax_enable_builddir_sed@
bindir = @bindir@
build = @build@
@@ -539,11 +544,12 @@ EXTRA_DIST = LICENSE ChangeLog.old \
libffi.xcodeproj/project.pbxproj \
src/powerpc/t-aix \
libtool-ldflags libtool-version configure.host README.md \
libffi.map.in LICENSE-BUILDTOOLS msvc_build make_sunver.pl
libffi.map.in LICENSE-BUILDTOOLS msvc_build make_sunver.pl \
testsuite/check-dlmalloc-static.sh
# local.exp is generated by configure
DISTCLEANFILES = local.exp
DISTCLEANFILES = local.exp libffi.map libffi.map-sun
# Subdir rules rely on $(FLAGS_TO_PASS)
FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@@ -671,12 +677,12 @@ fficonfig.h: stamp-h1
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
stamp-h1: $(srcdir)/fficonfig.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status fficonfig.h
$(AM_V_at)rm -f stamp-h1
$(AM_V_GEN)cd $(top_builddir) && $(SHELL) ./config.status fficonfig.h
$(srcdir)/fficonfig.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
$(AM_V_GEN)($(am__cd) $(top_srcdir) && $(AUTOHEADER))
$(AM_V_at)rm -f stamp-h1
$(AM_V_at)touch $@
distclean-hdr:
-rm -f fficonfig.h stamp-h1
@@ -684,15 +690,13 @@ libffi.pc: $(top_builddir)/config.status $(srcdir)/libffi.pc.in
cd $(top_builddir) && $(SHELL) ./config.status $@
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
-$(am__rm_f) $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
echo rm -f $${locs}; \
$(am__rm_f) $${locs}
install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
@$(NORMAL_INSTALL)
@@ -719,21 +723,19 @@ uninstall-toolexeclibLTLIBRARIES:
done
clean-toolexeclibLTLIBRARIES:
-test -z "$(toolexeclib_LTLIBRARIES)" || rm -f $(toolexeclib_LTLIBRARIES)
-$(am__rm_f) $(toolexeclib_LTLIBRARIES)
@list='$(toolexeclib_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
echo rm -f $${locs}; \
$(am__rm_f) $${locs}
src/$(am__dirstamp):
@$(MKDIR_P) src
@: > src/$(am__dirstamp)
@: >>src/$(am__dirstamp)
src/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/$(DEPDIR)
@: > src/$(DEPDIR)/$(am__dirstamp)
@: >>src/$(DEPDIR)/$(am__dirstamp)
src/prep_cif.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/types.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/raw_api.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
@@ -743,10 +745,10 @@ src/tramp.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/debug.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/aarch64/$(am__dirstamp):
@$(MKDIR_P) src/aarch64
@: > src/aarch64/$(am__dirstamp)
@: >>src/aarch64/$(am__dirstamp)
src/aarch64/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/aarch64/$(DEPDIR)
@: > src/aarch64/$(DEPDIR)/$(am__dirstamp)
@: >>src/aarch64/$(DEPDIR)/$(am__dirstamp)
src/aarch64/ffi.lo: src/aarch64/$(am__dirstamp) \
src/aarch64/$(DEPDIR)/$(am__dirstamp)
src/aarch64/sysv.lo: src/aarch64/$(am__dirstamp) \
@@ -755,30 +757,30 @@ src/aarch64/win64_armasm.lo: src/aarch64/$(am__dirstamp) \
src/aarch64/$(DEPDIR)/$(am__dirstamp)
src/alpha/$(am__dirstamp):
@$(MKDIR_P) src/alpha
@: > src/alpha/$(am__dirstamp)
@: >>src/alpha/$(am__dirstamp)
src/alpha/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/alpha/$(DEPDIR)
@: > src/alpha/$(DEPDIR)/$(am__dirstamp)
@: >>src/alpha/$(DEPDIR)/$(am__dirstamp)
src/alpha/ffi.lo: src/alpha/$(am__dirstamp) \
src/alpha/$(DEPDIR)/$(am__dirstamp)
src/alpha/osf.lo: src/alpha/$(am__dirstamp) \
src/alpha/$(DEPDIR)/$(am__dirstamp)
src/arc/$(am__dirstamp):
@$(MKDIR_P) src/arc
@: > src/arc/$(am__dirstamp)
@: >>src/arc/$(am__dirstamp)
src/arc/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/arc/$(DEPDIR)
@: > src/arc/$(DEPDIR)/$(am__dirstamp)
@: >>src/arc/$(DEPDIR)/$(am__dirstamp)
src/arc/ffi.lo: src/arc/$(am__dirstamp) \
src/arc/$(DEPDIR)/$(am__dirstamp)
src/arc/arcompact.lo: src/arc/$(am__dirstamp) \
src/arc/$(DEPDIR)/$(am__dirstamp)
src/arm/$(am__dirstamp):
@$(MKDIR_P) src/arm
@: > src/arm/$(am__dirstamp)
@: >>src/arm/$(am__dirstamp)
src/arm/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/arm/$(DEPDIR)
@: > src/arm/$(DEPDIR)/$(am__dirstamp)
@: >>src/arm/$(DEPDIR)/$(am__dirstamp)
src/arm/ffi.lo: src/arm/$(am__dirstamp) \
src/arm/$(DEPDIR)/$(am__dirstamp)
src/arm/sysv.lo: src/arm/$(am__dirstamp) \
@@ -787,48 +789,48 @@ src/arm/sysv_msvc_arm32.lo: src/arm/$(am__dirstamp) \
src/arm/$(DEPDIR)/$(am__dirstamp)
src/avr32/$(am__dirstamp):
@$(MKDIR_P) src/avr32
@: > src/avr32/$(am__dirstamp)
@: >>src/avr32/$(am__dirstamp)
src/avr32/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/avr32/$(DEPDIR)
@: > src/avr32/$(DEPDIR)/$(am__dirstamp)
@: >>src/avr32/$(DEPDIR)/$(am__dirstamp)
src/avr32/ffi.lo: src/avr32/$(am__dirstamp) \
src/avr32/$(DEPDIR)/$(am__dirstamp)
src/avr32/sysv.lo: src/avr32/$(am__dirstamp) \
src/avr32/$(DEPDIR)/$(am__dirstamp)
src/bfin/$(am__dirstamp):
@$(MKDIR_P) src/bfin
@: > src/bfin/$(am__dirstamp)
@: >>src/bfin/$(am__dirstamp)
src/bfin/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/bfin/$(DEPDIR)
@: > src/bfin/$(DEPDIR)/$(am__dirstamp)
@: >>src/bfin/$(DEPDIR)/$(am__dirstamp)
src/bfin/ffi.lo: src/bfin/$(am__dirstamp) \
src/bfin/$(DEPDIR)/$(am__dirstamp)
src/bfin/sysv.lo: src/bfin/$(am__dirstamp) \
src/bfin/$(DEPDIR)/$(am__dirstamp)
src/cris/$(am__dirstamp):
@$(MKDIR_P) src/cris
@: > src/cris/$(am__dirstamp)
@: >>src/cris/$(am__dirstamp)
src/cris/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/cris/$(DEPDIR)
@: > src/cris/$(DEPDIR)/$(am__dirstamp)
@: >>src/cris/$(DEPDIR)/$(am__dirstamp)
src/cris/ffi.lo: src/cris/$(am__dirstamp) \
src/cris/$(DEPDIR)/$(am__dirstamp)
src/cris/sysv.lo: src/cris/$(am__dirstamp) \
src/cris/$(DEPDIR)/$(am__dirstamp)
src/frv/$(am__dirstamp):
@$(MKDIR_P) src/frv
@: > src/frv/$(am__dirstamp)
@: >>src/frv/$(am__dirstamp)
src/frv/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/frv/$(DEPDIR)
@: > src/frv/$(DEPDIR)/$(am__dirstamp)
@: >>src/frv/$(DEPDIR)/$(am__dirstamp)
src/frv/ffi.lo: src/frv/$(am__dirstamp) \
src/frv/$(DEPDIR)/$(am__dirstamp)
src/csky/$(am__dirstamp):
@$(MKDIR_P) src/csky
@: > src/csky/$(am__dirstamp)
@: >>src/csky/$(am__dirstamp)
src/csky/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/csky/$(DEPDIR)
@: > src/csky/$(DEPDIR)/$(am__dirstamp)
@: >>src/csky/$(DEPDIR)/$(am__dirstamp)
src/csky/ffi.lo: src/csky/$(am__dirstamp) \
src/csky/$(DEPDIR)/$(am__dirstamp)
src/csky/sysv.lo: src/csky/$(am__dirstamp) \
@@ -837,70 +839,70 @@ src/frv/eabi.lo: src/frv/$(am__dirstamp) \
src/frv/$(DEPDIR)/$(am__dirstamp)
src/ia64/$(am__dirstamp):
@$(MKDIR_P) src/ia64
@: > src/ia64/$(am__dirstamp)
@: >>src/ia64/$(am__dirstamp)
src/ia64/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/ia64/$(DEPDIR)
@: > src/ia64/$(DEPDIR)/$(am__dirstamp)
@: >>src/ia64/$(DEPDIR)/$(am__dirstamp)
src/ia64/ffi.lo: src/ia64/$(am__dirstamp) \
src/ia64/$(DEPDIR)/$(am__dirstamp)
src/ia64/unix.lo: src/ia64/$(am__dirstamp) \
src/ia64/$(DEPDIR)/$(am__dirstamp)
src/m32r/$(am__dirstamp):
@$(MKDIR_P) src/m32r
@: > src/m32r/$(am__dirstamp)
@: >>src/m32r/$(am__dirstamp)
src/m32r/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/m32r/$(DEPDIR)
@: > src/m32r/$(DEPDIR)/$(am__dirstamp)
@: >>src/m32r/$(DEPDIR)/$(am__dirstamp)
src/m32r/ffi.lo: src/m32r/$(am__dirstamp) \
src/m32r/$(DEPDIR)/$(am__dirstamp)
src/m32r/sysv.lo: src/m32r/$(am__dirstamp) \
src/m32r/$(DEPDIR)/$(am__dirstamp)
src/m68k/$(am__dirstamp):
@$(MKDIR_P) src/m68k
@: > src/m68k/$(am__dirstamp)
@: >>src/m68k/$(am__dirstamp)
src/m68k/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/m68k/$(DEPDIR)
@: > src/m68k/$(DEPDIR)/$(am__dirstamp)
@: >>src/m68k/$(DEPDIR)/$(am__dirstamp)
src/m68k/ffi.lo: src/m68k/$(am__dirstamp) \
src/m68k/$(DEPDIR)/$(am__dirstamp)
src/m68k/sysv.lo: src/m68k/$(am__dirstamp) \
src/m68k/$(DEPDIR)/$(am__dirstamp)
src/m88k/$(am__dirstamp):
@$(MKDIR_P) src/m88k
@: > src/m88k/$(am__dirstamp)
@: >>src/m88k/$(am__dirstamp)
src/m88k/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/m88k/$(DEPDIR)
@: > src/m88k/$(DEPDIR)/$(am__dirstamp)
@: >>src/m88k/$(DEPDIR)/$(am__dirstamp)
src/m88k/ffi.lo: src/m88k/$(am__dirstamp) \
src/m88k/$(DEPDIR)/$(am__dirstamp)
src/m88k/obsd.lo: src/m88k/$(am__dirstamp) \
src/m88k/$(DEPDIR)/$(am__dirstamp)
src/metag/$(am__dirstamp):
@$(MKDIR_P) src/metag
@: > src/metag/$(am__dirstamp)
@: >>src/metag/$(am__dirstamp)
src/metag/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/metag/$(DEPDIR)
@: > src/metag/$(DEPDIR)/$(am__dirstamp)
@: >>src/metag/$(DEPDIR)/$(am__dirstamp)
src/metag/ffi.lo: src/metag/$(am__dirstamp) \
src/metag/$(DEPDIR)/$(am__dirstamp)
src/metag/sysv.lo: src/metag/$(am__dirstamp) \
src/metag/$(DEPDIR)/$(am__dirstamp)
src/microblaze/$(am__dirstamp):
@$(MKDIR_P) src/microblaze
@: > src/microblaze/$(am__dirstamp)
@: >>src/microblaze/$(am__dirstamp)
src/microblaze/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/microblaze/$(DEPDIR)
@: > src/microblaze/$(DEPDIR)/$(am__dirstamp)
@: >>src/microblaze/$(DEPDIR)/$(am__dirstamp)
src/microblaze/ffi.lo: src/microblaze/$(am__dirstamp) \
src/microblaze/$(DEPDIR)/$(am__dirstamp)
src/microblaze/sysv.lo: src/microblaze/$(am__dirstamp) \
src/microblaze/$(DEPDIR)/$(am__dirstamp)
src/mips/$(am__dirstamp):
@$(MKDIR_P) src/mips
@: > src/mips/$(am__dirstamp)
@: >>src/mips/$(am__dirstamp)
src/mips/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/mips/$(DEPDIR)
@: > src/mips/$(DEPDIR)/$(am__dirstamp)
@: >>src/mips/$(DEPDIR)/$(am__dirstamp)
src/mips/ffi.lo: src/mips/$(am__dirstamp) \
src/mips/$(DEPDIR)/$(am__dirstamp)
src/mips/o32.lo: src/mips/$(am__dirstamp) \
@@ -909,30 +911,30 @@ src/mips/n32.lo: src/mips/$(am__dirstamp) \
src/mips/$(DEPDIR)/$(am__dirstamp)
src/moxie/$(am__dirstamp):
@$(MKDIR_P) src/moxie
@: > src/moxie/$(am__dirstamp)
@: >>src/moxie/$(am__dirstamp)
src/moxie/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/moxie/$(DEPDIR)
@: > src/moxie/$(DEPDIR)/$(am__dirstamp)
@: >>src/moxie/$(DEPDIR)/$(am__dirstamp)
src/moxie/ffi.lo: src/moxie/$(am__dirstamp) \
src/moxie/$(DEPDIR)/$(am__dirstamp)
src/moxie/eabi.lo: src/moxie/$(am__dirstamp) \
src/moxie/$(DEPDIR)/$(am__dirstamp)
src/or1k/$(am__dirstamp):
@$(MKDIR_P) src/or1k
@: > src/or1k/$(am__dirstamp)
@: >>src/or1k/$(am__dirstamp)
src/or1k/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/or1k/$(DEPDIR)
@: > src/or1k/$(DEPDIR)/$(am__dirstamp)
@: >>src/or1k/$(DEPDIR)/$(am__dirstamp)
src/or1k/ffi.lo: src/or1k/$(am__dirstamp) \
src/or1k/$(DEPDIR)/$(am__dirstamp)
src/or1k/sysv.lo: src/or1k/$(am__dirstamp) \
src/or1k/$(DEPDIR)/$(am__dirstamp)
src/pa/$(am__dirstamp):
@$(MKDIR_P) src/pa
@: > src/pa/$(am__dirstamp)
@: >>src/pa/$(am__dirstamp)
src/pa/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/pa/$(DEPDIR)
@: > src/pa/$(DEPDIR)/$(am__dirstamp)
@: >>src/pa/$(DEPDIR)/$(am__dirstamp)
src/pa/ffi.lo: src/pa/$(am__dirstamp) src/pa/$(DEPDIR)/$(am__dirstamp)
src/pa/linux.lo: src/pa/$(am__dirstamp) \
src/pa/$(DEPDIR)/$(am__dirstamp)
@@ -942,10 +944,10 @@ src/pa/hpux64.lo: src/pa/$(am__dirstamp) \
src/pa/$(DEPDIR)/$(am__dirstamp)
src/powerpc/$(am__dirstamp):
@$(MKDIR_P) src/powerpc
@: > src/powerpc/$(am__dirstamp)
@: >>src/powerpc/$(am__dirstamp)
src/powerpc/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/powerpc/$(DEPDIR)
@: > src/powerpc/$(DEPDIR)/$(am__dirstamp)
@: >>src/powerpc/$(DEPDIR)/$(am__dirstamp)
src/powerpc/ffi.lo: src/powerpc/$(am__dirstamp) \
src/powerpc/$(DEPDIR)/$(am__dirstamp)
src/powerpc/ffi_sysv.lo: src/powerpc/$(am__dirstamp) \
@@ -972,49 +974,49 @@ src/powerpc/ffi_darwin.lo: src/powerpc/$(am__dirstamp) \
src/powerpc/$(DEPDIR)/$(am__dirstamp)
src/riscv/$(am__dirstamp):
@$(MKDIR_P) src/riscv
@: > src/riscv/$(am__dirstamp)
@: >>src/riscv/$(am__dirstamp)
src/riscv/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/riscv/$(DEPDIR)
@: > src/riscv/$(DEPDIR)/$(am__dirstamp)
@: >>src/riscv/$(DEPDIR)/$(am__dirstamp)
src/riscv/ffi.lo: src/riscv/$(am__dirstamp) \
src/riscv/$(DEPDIR)/$(am__dirstamp)
src/riscv/sysv.lo: src/riscv/$(am__dirstamp) \
src/riscv/$(DEPDIR)/$(am__dirstamp)
src/s390/$(am__dirstamp):
@$(MKDIR_P) src/s390
@: > src/s390/$(am__dirstamp)
@: >>src/s390/$(am__dirstamp)
src/s390/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/s390/$(DEPDIR)
@: > src/s390/$(DEPDIR)/$(am__dirstamp)
@: >>src/s390/$(DEPDIR)/$(am__dirstamp)
src/s390/ffi.lo: src/s390/$(am__dirstamp) \
src/s390/$(DEPDIR)/$(am__dirstamp)
src/s390/sysv.lo: src/s390/$(am__dirstamp) \
src/s390/$(DEPDIR)/$(am__dirstamp)
src/sh/$(am__dirstamp):
@$(MKDIR_P) src/sh
@: > src/sh/$(am__dirstamp)
@: >>src/sh/$(am__dirstamp)
src/sh/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/sh/$(DEPDIR)
@: > src/sh/$(DEPDIR)/$(am__dirstamp)
@: >>src/sh/$(DEPDIR)/$(am__dirstamp)
src/sh/ffi.lo: src/sh/$(am__dirstamp) src/sh/$(DEPDIR)/$(am__dirstamp)
src/sh/sysv.lo: src/sh/$(am__dirstamp) \
src/sh/$(DEPDIR)/$(am__dirstamp)
src/sh64/$(am__dirstamp):
@$(MKDIR_P) src/sh64
@: > src/sh64/$(am__dirstamp)
@: >>src/sh64/$(am__dirstamp)
src/sh64/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/sh64/$(DEPDIR)
@: > src/sh64/$(DEPDIR)/$(am__dirstamp)
@: >>src/sh64/$(DEPDIR)/$(am__dirstamp)
src/sh64/ffi.lo: src/sh64/$(am__dirstamp) \
src/sh64/$(DEPDIR)/$(am__dirstamp)
src/sh64/sysv.lo: src/sh64/$(am__dirstamp) \
src/sh64/$(DEPDIR)/$(am__dirstamp)
src/sparc/$(am__dirstamp):
@$(MKDIR_P) src/sparc
@: > src/sparc/$(am__dirstamp)
@: >>src/sparc/$(am__dirstamp)
src/sparc/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/sparc/$(DEPDIR)
@: > src/sparc/$(DEPDIR)/$(am__dirstamp)
@: >>src/sparc/$(DEPDIR)/$(am__dirstamp)
src/sparc/ffi.lo: src/sparc/$(am__dirstamp) \
src/sparc/$(DEPDIR)/$(am__dirstamp)
src/sparc/ffi64.lo: src/sparc/$(am__dirstamp) \
@@ -1025,40 +1027,40 @@ src/sparc/v9.lo: src/sparc/$(am__dirstamp) \
src/sparc/$(DEPDIR)/$(am__dirstamp)
src/tile/$(am__dirstamp):
@$(MKDIR_P) src/tile
@: > src/tile/$(am__dirstamp)
@: >>src/tile/$(am__dirstamp)
src/tile/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/tile/$(DEPDIR)
@: > src/tile/$(DEPDIR)/$(am__dirstamp)
@: >>src/tile/$(DEPDIR)/$(am__dirstamp)
src/tile/ffi.lo: src/tile/$(am__dirstamp) \
src/tile/$(DEPDIR)/$(am__dirstamp)
src/tile/tile.lo: src/tile/$(am__dirstamp) \
src/tile/$(DEPDIR)/$(am__dirstamp)
src/vax/$(am__dirstamp):
@$(MKDIR_P) src/vax
@: > src/vax/$(am__dirstamp)
@: >>src/vax/$(am__dirstamp)
src/vax/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/vax/$(DEPDIR)
@: > src/vax/$(DEPDIR)/$(am__dirstamp)
@: >>src/vax/$(DEPDIR)/$(am__dirstamp)
src/vax/ffi.lo: src/vax/$(am__dirstamp) \
src/vax/$(DEPDIR)/$(am__dirstamp)
src/vax/elfbsd.lo: src/vax/$(am__dirstamp) \
src/vax/$(DEPDIR)/$(am__dirstamp)
src/x86/$(am__dirstamp):
@$(MKDIR_P) src/x86
@: > src/x86/$(am__dirstamp)
@: >>src/x86/$(am__dirstamp)
src/x86/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/x86/$(DEPDIR)
@: > src/x86/$(DEPDIR)/$(am__dirstamp)
@: >>src/x86/$(DEPDIR)/$(am__dirstamp)
src/x86/ffi.lo: src/x86/$(am__dirstamp) \
src/x86/$(DEPDIR)/$(am__dirstamp)
src/x86/sysv.lo: src/x86/$(am__dirstamp) \
src/x86/$(DEPDIR)/$(am__dirstamp)
src/wasm/$(am__dirstamp):
@$(MKDIR_P) src/wasm
@: > src/wasm/$(am__dirstamp)
@: >>src/wasm/$(am__dirstamp)
src/wasm/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/wasm/$(DEPDIR)
@: > src/wasm/$(DEPDIR)/$(am__dirstamp)
@: >>src/wasm/$(DEPDIR)/$(am__dirstamp)
src/wasm/ffi.lo: src/wasm/$(am__dirstamp) \
src/wasm/$(DEPDIR)/$(am__dirstamp)
src/x86/ffiw64.lo: src/x86/$(am__dirstamp) \
@@ -1075,30 +1077,30 @@ src/x86/win64_intel.lo: src/x86/$(am__dirstamp) \
src/x86/$(DEPDIR)/$(am__dirstamp)
src/xtensa/$(am__dirstamp):
@$(MKDIR_P) src/xtensa
@: > src/xtensa/$(am__dirstamp)
@: >>src/xtensa/$(am__dirstamp)
src/xtensa/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/xtensa/$(DEPDIR)
@: > src/xtensa/$(DEPDIR)/$(am__dirstamp)
@: >>src/xtensa/$(DEPDIR)/$(am__dirstamp)
src/xtensa/ffi.lo: src/xtensa/$(am__dirstamp) \
src/xtensa/$(DEPDIR)/$(am__dirstamp)
src/xtensa/sysv.lo: src/xtensa/$(am__dirstamp) \
src/xtensa/$(DEPDIR)/$(am__dirstamp)
src/kvx/$(am__dirstamp):
@$(MKDIR_P) src/kvx
@: > src/kvx/$(am__dirstamp)
@: >>src/kvx/$(am__dirstamp)
src/kvx/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/kvx/$(DEPDIR)
@: > src/kvx/$(DEPDIR)/$(am__dirstamp)
@: >>src/kvx/$(DEPDIR)/$(am__dirstamp)
src/kvx/ffi.lo: src/kvx/$(am__dirstamp) \
src/kvx/$(DEPDIR)/$(am__dirstamp)
src/kvx/sysv.lo: src/kvx/$(am__dirstamp) \
src/kvx/$(DEPDIR)/$(am__dirstamp)
src/loongarch/$(am__dirstamp):
@$(MKDIR_P) src/loongarch
@: > src/loongarch/$(am__dirstamp)
@: >>src/loongarch/$(am__dirstamp)
src/loongarch/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) src/loongarch/$(DEPDIR)
@: > src/loongarch/$(DEPDIR)/$(am__dirstamp)
@: >>src/loongarch/$(DEPDIR)/$(am__dirstamp)
src/loongarch/ffi.lo: src/loongarch/$(am__dirstamp) \
src/loongarch/$(DEPDIR)/$(am__dirstamp)
src/loongarch/sysv.lo: src/loongarch/$(am__dirstamp) \
@@ -1278,7 +1280,7 @@ distclean-compile:
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
@: >>$@
am--depfiles: $(am__depfiles_remade)
@@ -1498,12 +1500,13 @@ cscopelist-am: $(am__tagged_files)
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
$(AM_V_at)$(MKDIR_P) "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@@ -1576,6 +1579,10 @@ dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__post_remove_distdir)
dist-bzip3: distdir
tardir=$(distdir) && $(am__tar) | bzip3 -c >$(distdir).tar.bz3
$(am__post_remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__post_remove_distdir)
@@ -1617,9 +1624,11 @@ dist dist-all:
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
eval GZIP= gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.bz3*) \
bzip3 -dc $(distdir).tar.bz3 | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \
@@ -1627,7 +1636,7 @@ distcheck: dist
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
eval GZIP= gzip -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
*.tar.zst*) \
@@ -1699,6 +1708,7 @@ distcleancheck: distclean
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) check-local
check: check-recursive
all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) fficonfig.h
installdirs: installdirs-recursive
@@ -1730,75 +1740,75 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-rm -f src/$(DEPDIR)/$(am__dirstamp)
-rm -f src/$(am__dirstamp)
-rm -f src/aarch64/$(DEPDIR)/$(am__dirstamp)
-rm -f src/aarch64/$(am__dirstamp)
-rm -f src/alpha/$(DEPDIR)/$(am__dirstamp)
-rm -f src/alpha/$(am__dirstamp)
-rm -f src/arc/$(DEPDIR)/$(am__dirstamp)
-rm -f src/arc/$(am__dirstamp)
-rm -f src/arm/$(DEPDIR)/$(am__dirstamp)
-rm -f src/arm/$(am__dirstamp)
-rm -f src/avr32/$(DEPDIR)/$(am__dirstamp)
-rm -f src/avr32/$(am__dirstamp)
-rm -f src/bfin/$(DEPDIR)/$(am__dirstamp)
-rm -f src/bfin/$(am__dirstamp)
-rm -f src/cris/$(DEPDIR)/$(am__dirstamp)
-rm -f src/cris/$(am__dirstamp)
-rm -f src/csky/$(DEPDIR)/$(am__dirstamp)
-rm -f src/csky/$(am__dirstamp)
-rm -f src/frv/$(DEPDIR)/$(am__dirstamp)
-rm -f src/frv/$(am__dirstamp)
-rm -f src/ia64/$(DEPDIR)/$(am__dirstamp)
-rm -f src/ia64/$(am__dirstamp)
-rm -f src/kvx/$(DEPDIR)/$(am__dirstamp)
-rm -f src/kvx/$(am__dirstamp)
-rm -f src/loongarch/$(DEPDIR)/$(am__dirstamp)
-rm -f src/loongarch/$(am__dirstamp)
-rm -f src/m32r/$(DEPDIR)/$(am__dirstamp)
-rm -f src/m32r/$(am__dirstamp)
-rm -f src/m68k/$(DEPDIR)/$(am__dirstamp)
-rm -f src/m68k/$(am__dirstamp)
-rm -f src/m88k/$(DEPDIR)/$(am__dirstamp)
-rm -f src/m88k/$(am__dirstamp)
-rm -f src/metag/$(DEPDIR)/$(am__dirstamp)
-rm -f src/metag/$(am__dirstamp)
-rm -f src/microblaze/$(DEPDIR)/$(am__dirstamp)
-rm -f src/microblaze/$(am__dirstamp)
-rm -f src/mips/$(DEPDIR)/$(am__dirstamp)
-rm -f src/mips/$(am__dirstamp)
-rm -f src/moxie/$(DEPDIR)/$(am__dirstamp)
-rm -f src/moxie/$(am__dirstamp)
-rm -f src/or1k/$(DEPDIR)/$(am__dirstamp)
-rm -f src/or1k/$(am__dirstamp)
-rm -f src/pa/$(DEPDIR)/$(am__dirstamp)
-rm -f src/pa/$(am__dirstamp)
-rm -f src/powerpc/$(DEPDIR)/$(am__dirstamp)
-rm -f src/powerpc/$(am__dirstamp)
-rm -f src/riscv/$(DEPDIR)/$(am__dirstamp)
-rm -f src/riscv/$(am__dirstamp)
-rm -f src/s390/$(DEPDIR)/$(am__dirstamp)
-rm -f src/s390/$(am__dirstamp)
-rm -f src/sh/$(DEPDIR)/$(am__dirstamp)
-rm -f src/sh/$(am__dirstamp)
-rm -f src/sh64/$(DEPDIR)/$(am__dirstamp)
-rm -f src/sh64/$(am__dirstamp)
-rm -f src/sparc/$(DEPDIR)/$(am__dirstamp)
-rm -f src/sparc/$(am__dirstamp)
-rm -f src/tile/$(DEPDIR)/$(am__dirstamp)
-rm -f src/tile/$(am__dirstamp)
-rm -f src/vax/$(DEPDIR)/$(am__dirstamp)
-rm -f src/vax/$(am__dirstamp)
-rm -f src/wasm/$(DEPDIR)/$(am__dirstamp)
-rm -f src/wasm/$(am__dirstamp)
-rm -f src/x86/$(DEPDIR)/$(am__dirstamp)
-rm -f src/x86/$(am__dirstamp)
-rm -f src/xtensa/$(DEPDIR)/$(am__dirstamp)
-rm -f src/xtensa/$(am__dirstamp)
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
-$(am__rm_f) $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES)
-$(am__rm_f) $(DISTCLEANFILES)
-$(am__rm_f) src/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/$(am__dirstamp)
-$(am__rm_f) src/aarch64/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/aarch64/$(am__dirstamp)
-$(am__rm_f) src/alpha/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/alpha/$(am__dirstamp)
-$(am__rm_f) src/arc/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/arc/$(am__dirstamp)
-$(am__rm_f) src/arm/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/arm/$(am__dirstamp)
-$(am__rm_f) src/avr32/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/avr32/$(am__dirstamp)
-$(am__rm_f) src/bfin/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/bfin/$(am__dirstamp)
-$(am__rm_f) src/cris/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/cris/$(am__dirstamp)
-$(am__rm_f) src/csky/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/csky/$(am__dirstamp)
-$(am__rm_f) src/frv/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/frv/$(am__dirstamp)
-$(am__rm_f) src/ia64/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/ia64/$(am__dirstamp)
-$(am__rm_f) src/kvx/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/kvx/$(am__dirstamp)
-$(am__rm_f) src/loongarch/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/loongarch/$(am__dirstamp)
-$(am__rm_f) src/m32r/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/m32r/$(am__dirstamp)
-$(am__rm_f) src/m68k/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/m68k/$(am__dirstamp)
-$(am__rm_f) src/m88k/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/m88k/$(am__dirstamp)
-$(am__rm_f) src/metag/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/metag/$(am__dirstamp)
-$(am__rm_f) src/microblaze/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/microblaze/$(am__dirstamp)
-$(am__rm_f) src/mips/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/mips/$(am__dirstamp)
-$(am__rm_f) src/moxie/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/moxie/$(am__dirstamp)
-$(am__rm_f) src/or1k/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/or1k/$(am__dirstamp)
-$(am__rm_f) src/pa/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/pa/$(am__dirstamp)
-$(am__rm_f) src/powerpc/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/powerpc/$(am__dirstamp)
-$(am__rm_f) src/riscv/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/riscv/$(am__dirstamp)
-$(am__rm_f) src/s390/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/s390/$(am__dirstamp)
-$(am__rm_f) src/sh/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/sh/$(am__dirstamp)
-$(am__rm_f) src/sh64/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/sh64/$(am__dirstamp)
-$(am__rm_f) src/sparc/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/sparc/$(am__dirstamp)
-$(am__rm_f) src/tile/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/tile/$(am__dirstamp)
-$(am__rm_f) src/vax/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/vax/$(am__dirstamp)
-$(am__rm_f) src/wasm/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/wasm/$(am__dirstamp)
-$(am__rm_f) src/x86/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/x86/$(am__dirstamp)
-$(am__rm_f) src/xtensa/$(DEPDIR)/$(am__dirstamp)
-$(am__rm_f) src/xtensa/$(am__dirstamp)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -1810,7 +1820,7 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f src/$(DEPDIR)/closures.Plo
-rm -f src/$(DEPDIR)/closures.Plo
-rm -f src/$(DEPDIR)/debug.Plo
-rm -f src/$(DEPDIR)/java_raw_api.Plo
-rm -f src/$(DEPDIR)/prep_cif.Plo
@@ -1950,7 +1960,7 @@ installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f src/$(DEPDIR)/closures.Plo
-rm -f src/$(DEPDIR)/closures.Plo
-rm -f src/$(DEPDIR)/debug.Plo
-rm -f src/$(DEPDIR)/java_raw_api.Plo
-rm -f src/$(DEPDIR)/prep_cif.Plo
@@ -2061,28 +2071,28 @@ ps-am:
uninstall-am: uninstall-pkgconfigDATA uninstall-toolexeclibLTLIBRARIES
.MAKE: $(am__recursive_targets) all install-am install-strip
.MAKE: $(am__recursive_targets) all check-am install-am install-strip
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
am--depfiles am--refresh check check-am clean clean-cscope \
clean-generic clean-libtool clean-noinstLTLIBRARIES \
clean-toolexeclibLTLIBRARIES cscope cscopelist-am ctags \
ctags-am dist dist-all dist-bzip2 dist-gzip dist-hook \
dist-lzip dist-shar dist-tarZ dist-xz dist-zip dist-zstd \
distcheck distclean distclean-compile distclean-generic \
distclean-hdr distclean-libtool distclean-tags distcleancheck \
distdir distuninstallcheck dvi dvi-am html html-am info \
info-am install install-am install-data install-data-am \
install-dvi install-dvi-am install-exec install-exec-am \
install-html install-html-am install-info install-info-am \
install-man install-pdf install-pdf-am install-pkgconfigDATA \
install-ps install-ps-am install-strip \
install-toolexeclibLTLIBRARIES installcheck installcheck-am \
installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am uninstall-pkgconfigDATA \
uninstall-toolexeclibLTLIBRARIES
am--depfiles am--refresh check check-am check-local clean \
clean-cscope clean-generic clean-libtool \
clean-noinstLTLIBRARIES clean-toolexeclibLTLIBRARIES cscope \
cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
dist-bzip3 dist-gzip dist-hook dist-lzip dist-shar dist-tarZ \
dist-xz dist-zip dist-zstd distcheck distclean \
distclean-compile distclean-generic distclean-hdr \
distclean-libtool distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-pkgconfigDATA install-ps \
install-ps-am install-strip install-toolexeclibLTLIBRARIES \
installcheck installcheck-am installdirs installdirs-am \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
uninstall-pkgconfigDATA uninstall-toolexeclibLTLIBRARIES
.PRECIOUS: Makefile
@@ -2090,6 +2100,9 @@ uninstall-am: uninstall-pkgconfigDATA uninstall-toolexeclibLTLIBRARIES
# Alias required by AX_ENABLE_BUILDDIR / config-ml
.PHONY: all-configured
all-configured: all
check-local: src/closures.lo
$(SHELL) $(srcdir)/testsuite/check-dlmalloc-static.sh "$(NM)" src/closures.lo
@LIBFFI_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@libffi.map-sun : libffi.map $(top_srcdir)/make_sunver.pl \
@LIBFFI_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@ $(libffi_la_OBJECTS) $(libffi_la_LIBADD)
@LIBFFI_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@ perl $(top_srcdir)/make_sunver.pl libffi.map \
@@ -2102,8 +2115,14 @@ libffi.map: $(top_srcdir)/libffi.map.in
-E -x assembler-with-cpp -o $@ $(top_srcdir)/libffi.map.in
dist-hook:
d=`(cd $(distdir); pwd)`; (cd doc; make pdf; cp *.pdf $$d/doc)
@BUILD_DOCS_TRUE@ d=`(cd $(distdir); pwd)`; \
@BUILD_DOCS_TRUE@ if (cd doc && make pdf && cp *.pdf $$d/doc); then \
@BUILD_DOCS_TRUE@ :; \
@BUILD_DOCS_TRUE@ else \
@BUILD_DOCS_TRUE@ echo "dist-hook: PDF manual not built (no TeX engine?), omitting it from the dist"; \
@BUILD_DOCS_TRUE@ fi
if [ -d $(top_srcdir)/.git ] ; then (cd $(top_srcdir); git log --no-decorate) ; else echo 'See git log for history.' ; fi > $(distdir)/ChangeLog
rm -f $(distdir)/README.md; \
s=`awk '/was released on/{ print NR; exit}' $(top_srcdir)/README.md`; \
if [ -n "$$s" ]; then tail -n +$$(($$s-1)) $(top_srcdir)/README.md; else cat $(top_srcdir)/README.md; fi > $(distdir)/README.md
@@ -2113,3 +2132,10 @@ dist-hook:
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
# Tell GNU make to disable its built-in pattern rules.
%:: %,v
%:: RCS/%,v
%:: RCS/%
%:: s.%
%:: SCCS/s.%
+40 -1
View File
@@ -1,5 +1,5 @@
libffi-3.7.1 was released on July 10, 2026.
libffi-3.8.1 was released on November 14, 2026.
What is libffi?
@@ -201,6 +201,45 @@ History
See the git log for details at http://github.com/libffi/libffi.
3.8.1 November-14-2026
Improve ABI conformance and test coverage for complex-number
calls, closures, and small aggregates across ARM, x86, PowerPC,
MIPS, RISC-V, LoongArch, and SPARC.
aarch64/arm: fix big-endian closures receiving garbage sub-word
integer and float arguments, and big-endian sub-word and float
return values (#1012, closes #1011, #675). Correct the stack
offset of a by-value composite larger than 16 bytes and the
AAPCS64 HFA/HVA detection (GHSA-h52h-3759-xqm4,
GHSA-vg77-j273-647r).
x86-64: return a single-long-double struct in %st0 like a bare
long double (#1058); copy the upper half of 16-byte vector
arguments in reusable call plans; and reject vector types whose
ABI is undefined, where GCC and Clang disagree, instead of
marshalling them the wrong way (GHSA-5pc3-hr6f-q3mm).
powerpc64: fix _Complex long double when the ABI's long double is
64 bits (e.g. -mlong-double-64 or musl).
s390x: pass 128-bit integer closure arguments by reference, like
complex types, instead of leaving the value pointer
uninitialized (GHSA-wf8m-qr3x-cch4).
RISC-V: ignore the caller's return buffer for void calls.
MIPS: emit CFI in the N32/N64 assembly so unwinding works through
libffi frames (#1063).
wasm: correct heap accesses at or above 2 GiB (#1062), make
closures work with stack switching, and declare the stack-helper
dependencies in EM_JS_DEPS for newer Emscripten (#1019).
Closures and trampolines: fail allocation gracefully when the
page-size lookup fails (#1015) and bound the executable-mmap
retry loop (#1055). Fix a Darwin trampoline-table use-after-free
(GHSA-23hx-9rxv-9qfp), a Linux static-trampoline path mix-up that
could map the wrong file as code (GHSA-fq46-69xf-x5gf), and a
raw-API closure that passed the wrong handler data under static
trampolines (GHSA-w6j9-w53f-2857).
Keep the bundled dlmalloc symbols static so they cannot clash with
an application's allocator, and emit subsections_via_symbols on
Apple platforms for linker dead-stripping (#1017).
Build and packaging: honor an explicit --enable-docs, respect every
--libdir spelling, and keep CCASFLAGS in sync with CFLAGS (#1060).
3.8.0 August-8-2026
Add FFI_TYPE_VECTOR (SIMD) type support with libffi-computed
layout, for aarch64 and x86-64 (#1000, closes #773).
+3 -3
View File
@@ -334,14 +334,14 @@ libat_min_gnu_ld_version=21400
# Change "yes" into either "no" or a style name.
if test $enable_symvers != no && test $libat_shared_libgcc = yes; then
if test $with_gnu_ld = yes; then
if test $libat_gnu_ld_version -ge $libat_min_gnu_ld_version ; then
enable_symvers=gnu
elif test $libat_ld_is_gold = yes ; then
if test $libat_ld_is_gold = yes ; then
enable_symvers=gnu
elif test $libat_ld_is_lld = yes ; then
enable_symvers=gnu
elif test $libat_ld_is_mold = yes ; then
enable_symvers=gnu
elif test $libat_gnu_ld_version -ge $libat_min_gnu_ld_version ; then
enable_symvers=gnu
else
# The right tools, the right setup, but too old. Fallbacks?
AC_MSG_WARN(=== Linker version $libat_gnu_ld_version is too old for)
+311 -143
View File
@@ -1,6 +1,6 @@
# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
# generated automatically by aclocal 1.18.1 -*- Autoconf -*-
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
# Copyright (C) 1996-2025 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -14,15 +14,15 @@
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
[m4_warning([this file was generated for autoconf 2.71.
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
[m4_warning([this file was generated for autoconf 2.72.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*-
#
# Copyright (C) 1999-2008, 2011-2019, 2021-2022 Free Software
# Copyright (C) 1999-2008, 2011-2019, 2021-2024 Free Software
# Foundation, Inc.
# Written by Thomas Tanner, 1999
#
@@ -30,7 +30,7 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 21 LTDL_INIT
# serial 24 LTDL_INIT
# LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE])
# ------------------------------------------
@@ -457,7 +457,8 @@ esac
m4_ifdef([AM_CONDITIONAL],
[AM_CONDITIONAL(INSTALL_LTDL, test no != "${enable_ltdl_install-no}")
AM_CONDITIONAL(CONVENIENCE_LTDL, test no != "${enable_ltdl_convenience-no}")])
AM_CONDITIONAL(CONVENIENCE_LTDL, test no != "${enable_ltdl_convenience-no}")
AM_CONDITIONAL(LTARGZH_EXISTS, test -n "$LT_ARGZ_H")])
])# _LT_ENABLE_INSTALL
@@ -488,9 +489,6 @@ AC_CACHE_CHECK([whether deplibs are loaded by dlopen],
;;
esac
;;
bitrig*)
lt_cv_sys_dlopen_deplibs=yes
;;
darwin*)
# Assuming the user has installed a libdl from somewhere, this is true
# If you are looking for one http://www.opendarwin.org/projects/dlcompat
@@ -519,6 +517,9 @@ AC_CACHE_CHECK([whether deplibs are loaded by dlopen],
# at 6.2 and later dlopen does load deplibs.
lt_cv_sys_dlopen_deplibs=yes
;;
*-mlibc)
lt_cv_sys_dlopen_deplibs=yes
;;
netbsd* | netbsdelf*-gnu)
lt_cv_sys_dlopen_deplibs=yes
;;
@@ -735,7 +736,7 @@ darwin[[1567]].*)
beos*)
LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la"
;;
cygwin* | mingw* | pw32*)
cygwin* | mingw* | windows* | pw32*)
AC_CHECK_DECLS([cygwin_conv_path], [], [], [[#include <sys/cygwin.h>]])
LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la"
;;
@@ -783,7 +784,7 @@ AC_CACHE_CHECK([for _ prefix in compiled symbols],
[lt_cv_sys_symbol_underscore=no
cat > conftest.$ac_ext <<_LT_EOF
void nm_test_func(){}
int main(){nm_test_func;return 0;}
int main(void){nm_test_func;return 0;}
_LT_EOF
if AC_TRY_EVAL(ac_compile); then
# Now try to grab the symbols.
@@ -887,7 +888,7 @@ _LT_EOF
# define RTLD_NOW 0
# endif
#endif
int main () {
int main (void) {
void *handle = dlopen ("`pwd`/$libname$libltdl_cv_shlibext", RTLD_GLOBAL|RTLD_NOW);
int status = $libltdl_dlunknown;
if (handle) {
@@ -931,7 +932,7 @@ AU_ALIAS([AC_LTDL_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], [])
# Copyright (C) 2002-2021 Free Software Foundation, Inc.
# Copyright (C) 2002-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -943,10 +944,10 @@ dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], [])
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.16'
[am__api_version='1.18'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.16.5], [],
m4_if([$1], [1.18.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -962,14 +963,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.16.5])dnl
[AM_AUTOMAKE_VERSION([1.18.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# Figure out how to run the assembler. -*- Autoconf -*-
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -989,7 +990,7 @@ _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1041,7 +1042,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997-2021 Free Software Foundation, Inc.
# Copyright (C) 1997-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1072,7 +1073,7 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
# Copyright (C) 1999-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1204,7 +1205,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# When given -MP, icc 7.0 and 7.1 complain thus:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
@@ -1263,7 +1264,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
# Copyright (C) 1999-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1331,7 +1332,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
# Copyright (C) 1996-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1431,8 +1432,9 @@ AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_IF_OPTION([tar-v7], [_AM_PROG_TAR([v7])],
[_AM_PROG_TAR([ustar])])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES([CC])],
@@ -1465,7 +1467,7 @@ if test -z "$CSCOPE"; then
fi
AC_SUBST([CSCOPE])
AC_REQUIRE([AM_SILENT_RULES])dnl
AC_REQUIRE([_AM_SILENT_RULES])dnl
dnl The testsuite driver may need to know about EXEEXT, so add the
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
@@ -1473,47 +1475,9 @@ AC_CONFIG_COMMANDS_PRE(dnl
[m4_provide_if([_AM_COMPILER_EXEEXT],
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
# POSIX will say in a future version that running "rm -f" with no argument
# is OK; and we want to be able to make that assumption in our Makefile
# recipes. So use an aggressive probe to check that the usage we want is
# actually supported "in the wild" to an acceptable degree.
# See automake bug#10828.
# To make any issue more visible, cause the running configure to be aborted
# by default if the 'rm' program in use doesn't match our expectations; the
# user can still override this though.
if rm -f && rm -fr && rm -rf; then : OK; else
cat >&2 <<'END'
Oops!
AC_REQUIRE([_AM_PROG_RM_F])
AC_REQUIRE([_AM_PROG_XARGS_N])
Your 'rm' program seems unable to run without file operands specified
on the command line, even when the '-f' option is present. This is contrary
to the behaviour of most rm programs out there, and not conforming with
the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
Please tell bug-automake@gnu.org about your system, including the value
of your $PATH and any error possibly output before this message. This
can help us improve future automake versions.
END
if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
echo 'Configuration will proceed anyway, since you have set the' >&2
echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
echo >&2
else
cat >&2 <<'END'
Aborting the configuration process, to ensure you take notice of the issue.
You can download and install GNU coreutils to get an 'rm' implementation
that behaves properly: <https://www.gnu.org/software/coreutils/>.
If you want to complete the configuration process using your problematic
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
to "yes", and re-run configure.
END
AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
fi
fi
dnl The trailing newline in this macro's definition is deliberate, for
dnl backward compatibility and to allow trailing 'dnl'-style comments
dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
@@ -1546,7 +1510,7 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1567,7 +1531,7 @@ if test x"${install_sh+set}" != xset; then
fi
AC_SUBST([install_sh])])
# Copyright (C) 2003-2021 Free Software Foundation, Inc.
# Copyright (C) 2003-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1589,7 +1553,7 @@ AC_SUBST([am__leading_dot])])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
# Copyright (C) 1996-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1624,7 +1588,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1667,7 +1631,7 @@ AC_SUBST([am__quote])])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997-2021 Free Software Foundation, Inc.
# Copyright (C) 1997-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1701,7 +1665,7 @@ fi
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1730,7 +1694,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
# Copyright (C) 1999-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1762,7 +1726,10 @@ AC_CACHE_CHECK(
break
fi
done
rm -f core conftest*
# aligned with autoconf, so not including core; see bug#72225.
rm -f -r a.out a.exe b.out conftest.$ac_ext conftest.$ac_objext \
conftest.dSYM conftest1.$ac_ext conftest1.$ac_objext conftest1.dSYM \
conftest2.$ac_ext conftest2.$ac_objext conftest2.dSYM
unset am_i])
if test "$am_cv_prog_cc_c_o" != yes; then
# Losing compiler, so override with the script.
@@ -1777,7 +1744,23 @@ AC_LANG_POP([C])])
# For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
# Copyright (C) 2022-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_PROG_RM_F
# ---------------
# Check whether 'rm -f' without any arguments works.
# https://bugs.gnu.org/10828
AC_DEFUN([_AM_PROG_RM_F],
[am__rm_f_notfound=
AS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""'])
AC_SUBST(am__rm_f_notfound)
])
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1796,26 +1779,181 @@ AC_DEFUN([AM_RUN_LOG],
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
# Copyright (C) 1996-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_SLEEP_FRACTIONAL_SECONDS
# ----------------------------
AC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl
AC_CACHE_CHECK([whether sleep supports fractional seconds],
am_cv_sleep_fractional_seconds, [dnl
AS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes],
[am_cv_sleep_fractional_seconds=no])
])])
# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION
# -----------------------------------
# Determine the filesystem's resolution for file modification
# timestamps. The coarsest we know of is FAT, with a resolution
# of only two seconds, even with the most recent "exFAT" extensions.
# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one
# nanosecond, matching clock_gettime. However, it is probably not
# possible to delay execution of a shell script for less than one
# millisecond, due to process creation overhead and scheduling
# granularity, so we don't check for anything finer than that. (See below.)
AC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl
AC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS])
AC_CACHE_CHECK([filesystem timestamp resolution],
am_cv_filesystem_timestamp_resolution, [dnl
# Default to the worst case.
am_cv_filesystem_timestamp_resolution=2
# Only try to go finer than 1 sec if sleep can do it.
# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work,
# - 1 sec is not much of a win compared to 2 sec, and
# - it takes 2 seconds to perform the test whether 1 sec works.
#
# Instead, just use the default 2s on platforms that have 1s resolution,
# accept the extra 1s delay when using $sleep in the Automake tests, in
# exchange for not incurring the 2s delay for running the test for all
# packages.
#
am_try_resolutions=
if test "$am_cv_sleep_fractional_seconds" = yes; then
# Even a millisecond often causes a bunch of false positives,
# so just try a hundredth of a second. The time saved between .001 and
# .01 is not terribly consequential.
am_try_resolutions="0.01 0.1 $am_try_resolutions"
fi
# In order to catch current-generation FAT out, we must *modify* files
# that already exist; the *creation* timestamp is finer. Use names
# that make ls -t sort them differently when they have equal
# timestamps than when they have distinct timestamps, keeping
# in mind that ls -t prints the *newest* file first.
rm -f conftest.ts?
: > conftest.ts1
: > conftest.ts2
: > conftest.ts3
# Make sure ls -t actually works. Do 'set' in a subshell so we don't
# clobber the current shell's arguments. (Outer-level square brackets
# are removed by m4; they're present so that m4 does not expand
# <dollar><star>; be careful, easy to get confused.)
if (
set X `[ls -t conftest.ts[12]]` &&
{
test "$[]*" != "X conftest.ts1 conftest.ts2" ||
test "$[]*" != "X conftest.ts2 conftest.ts1";
}
); then :; else
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
_AS_ECHO_UNQUOTED(
["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""],
[AS_MESSAGE_LOG_FD])
AC_MSG_FAILURE([ls -t produces unexpected output.
Make sure there is not a broken ls alias in your environment.])
fi
for am_try_res in $am_try_resolutions; do
# Any one fine-grained sleep might happen to cross the boundary
# between two values of a coarser actual resolution, but if we do
# two fine-grained sleeps in a row, at least one of them will fall
# entirely within a coarse interval.
echo alpha > conftest.ts1
sleep $am_try_res
echo beta > conftest.ts2
sleep $am_try_res
echo gamma > conftest.ts3
# We assume that 'ls -t' will make use of high-resolution
# timestamps if the operating system supports them at all.
if (set X `ls -t conftest.ts?` &&
test "$[]2" = conftest.ts3 &&
test "$[]3" = conftest.ts2 &&
test "$[]4" = conftest.ts1); then
#
# Ok, ls -t worked. If we're at a resolution of 1 second, we're done,
# because we don't need to test make.
make_ok=true
if test $am_try_res != 1; then
# But if we've succeeded so far with a subsecond resolution, we
# have one more thing to check: make. It can happen that
# everything else supports the subsecond mtimes, but make doesn't;
# notably on macOS, which ships make 3.81 from 2006 (the last one
# released under GPLv2). https://bugs.gnu.org/68808
#
# We test $MAKE if it is defined in the environment, else "make".
# It might get overridden later, but our hope is that in practice
# it does not matter: it is the system "make" which is (by far)
# the most likely to be broken, whereas if the user overrides it,
# probably they did so with a better, or at least not worse, make.
# https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html
#
# Create a Makefile (real tab character here):
rm -f conftest.mk
echo 'conftest.ts1: conftest.ts2' >conftest.mk
echo ' touch conftest.ts2' >>conftest.mk
#
# Now, running
# touch conftest.ts1; touch conftest.ts2; make
# should touch ts1 because ts2 is newer. This could happen by luck,
# but most often, it will fail if make's support is insufficient. So
# test for several consecutive successes.
#
# (We reuse conftest.ts[12] because we still want to modify existing
# files, not create new ones, per above.)
n=0
make=${MAKE-make}
until test $n -eq 3; do
echo one > conftest.ts1
sleep $am_try_res
echo two > conftest.ts2 # ts2 should now be newer than ts1
if $make -f conftest.mk | grep 'up to date' >/dev/null; then
make_ok=false
break # out of $n loop
fi
n=`expr $n + 1`
done
fi
#
if $make_ok; then
# Everything we know to check worked out, so call this resolution good.
am_cv_filesystem_timestamp_resolution=$am_try_res
break # out of $am_try_res loop
fi
# Otherwise, we'll go on to check the next resolution.
fi
done
rm -f conftest.ts?
# (end _am_filesystem_timestamp_resolution)
])])
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION])
# This check should not be cached, as it may vary across builds of
# different projects.
AC_MSG_CHECKING([whether build environment is sane])
# Reject unsafe characters in $srcdir or the absolute working directory
# name. Accept space and tab only in the latter.
am_lf='
'
case `pwd` in
*[[\\\"\#\$\&\'\`$am_lf]]*)
AC_MSG_RESULT([no])
AC_MSG_ERROR([unsafe absolute working directory name]);;
esac
case $srcdir in
*[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
AC_MSG_RESULT([no])
AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
esac
@@ -1824,49 +1962,40 @@ esac
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
am_has_slept=no
for am_try in 1 2; do
echo "timestamp, slept: $am_has_slept" > conftest.file
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t "$srcdir/configure" conftest.file`
fi
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
am_build_env_is_sane=no
am_has_slept=no
rm -f conftest.file
for am_try in 1 2; do
echo "timestamp, slept: $am_has_slept" > conftest.file
if (
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
if test "$[]*" = "X"; then
# -L didn't work.
set X `ls -t "$srcdir/configure" conftest.file`
fi
test "$[]2" = conftest.file
); then
am_build_env_is_sane=yes
break
fi
# Just in case.
sleep "$am_cv_filesystem_timestamp_resolution"
am_has_slept=yes
done
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
if test "$[2]" = conftest.file || test $am_try -eq 2; then
break
fi
# Just in case.
sleep 1
am_has_slept=yes
done
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
AC_MSG_RESULT([$am_build_env_is_sane])
if test "$am_build_env_is_sane" = no; then
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT([yes])
# If we didn't sleep, we still need to ensure time stamps of config.status and
# generated files are strictly newer.
am_sleep_pid=
if grep 'slept: no' conftest.file >/dev/null 2>&1; then
( sleep 1 ) &
AS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl
( sleep "$am_cv_filesystem_timestamp_resolution" ) &
am_sleep_pid=$!
fi
])
AC_CONFIG_COMMANDS_PRE(
[AC_MSG_CHECKING([that generated files are newer than configure])
if test -n "$am_sleep_pid"; then
@@ -1877,18 +2006,18 @@ AC_CONFIG_COMMANDS_PRE(
rm -f conftest.file
])
# Copyright (C) 2009-2021 Free Software Foundation, Inc.
# Copyright (C) 2009-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_SILENT_RULES([DEFAULT])
# --------------------------
# Enable less verbose build rules; with the default set to DEFAULT
# ("yes" being less verbose, "no" or empty being verbose).
AC_DEFUN([AM_SILENT_RULES],
[AC_ARG_ENABLE([silent-rules], [dnl
# _AM_SILENT_RULES
# ----------------
# Enable less verbose build rules support.
AC_DEFUN([_AM_SILENT_RULES],
[AM_DEFAULT_VERBOSITY=1
AC_ARG_ENABLE([silent-rules], [dnl
AS_HELP_STRING(
[--enable-silent-rules],
[less verbose build output (undo: "make V=1")])
@@ -1896,11 +2025,6 @@ AS_HELP_STRING(
[--disable-silent-rules],
[verbose build output (undo: "make V=0")])dnl
])
case $enable_silent_rules in @%:@ (((
yes) AM_DEFAULT_VERBOSITY=0;;
no) AM_DEFAULT_VERBOSITY=1;;
*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
esac
dnl
dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
dnl do not support nested variable expansions.
@@ -1919,14 +2043,6 @@ am__doit:
else
am_cv_make_support_nested_variables=no
fi])
if test $am_cv_make_support_nested_variables = yes; then
dnl Using '$V' instead of '$(V)' breaks IRIX make.
AM_V='$(V)'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
else
AM_V=$AM_DEFAULT_VERBOSITY
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
fi
AC_SUBST([AM_V])dnl
AM_SUBST_NOTMAKE([AM_V])dnl
AC_SUBST([AM_DEFAULT_V])dnl
@@ -1935,9 +2051,37 @@ AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
AM_BACKSLASH='\'
AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
dnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
dnl to AM_SILENT_RULES to change the default value.
AC_CONFIG_COMMANDS_PRE([dnl
case $enable_silent_rules in @%:@ (((
yes) AM_DEFAULT_VERBOSITY=0;;
no) AM_DEFAULT_VERBOSITY=1;;
esac
if test $am_cv_make_support_nested_variables = yes; then
dnl Using '$V' instead of '$(V)' breaks IRIX make.
AM_V='$(V)'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
else
AM_V=$AM_DEFAULT_VERBOSITY
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
fi
])dnl
])
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
# AM_SILENT_RULES([DEFAULT])
# --------------------------
# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
# empty being verbose).
AC_DEFUN([AM_SILENT_RULES],
[AC_REQUIRE([_AM_SILENT_RULES])
AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])m4_newline
dnl We intentionally force a newline after the assignment, since a) nothing
dnl good can come of more text following, and b) that was the behavior
dnl before 1.17. See https://bugs.gnu.org/72267.
])
# Copyright (C) 2001-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1965,7 +2109,7 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006-2021 Free Software Foundation, Inc.
# Copyright (C) 2006-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1984,7 +2128,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004-2021 Free Software Foundation, Inc.
# Copyright (C) 2004-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -2030,15 +2174,19 @@ m4_if([$1], [v7],
am_uid=`id -u || echo unknown`
am_gid=`id -g || echo unknown`
AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
if test $am_uid -le $am_max_uid; then
AC_MSG_RESULT([yes])
if test x$am_uid = xunknown; then
AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work])
elif test $am_uid -le $am_max_uid; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
_am_tools=none
AC_MSG_RESULT([no])
_am_tools=none
fi
AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
if test $am_gid -le $am_max_gid; then
AC_MSG_RESULT([yes])
if test x$gm_gid = xunknown; then
AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work])
elif test $am_gid -le $am_max_gid; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
_am_tools=none
@@ -2115,6 +2263,26 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
# Copyright (C) 2022-2025 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_PROG_XARGS_N
# ----------------
# Check whether 'xargs -n' works. It should work everywhere, so the fallback
# is not optimized at all as we never expect to use it.
AC_DEFUN([_AM_PROG_XARGS_N],
[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl
AS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2
3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])])
AS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl
am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }'
])dnl
AC_SUBST(am__xargs_n)
])
m4_include([m4/asmcfi.m4])
m4_include([m4/ax_cc_maxopt.m4])
m4_include([m4/ax_cflags_warn_all.m4])
+29 -13
View File
@@ -1,9 +1,9 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2018-03-07.03; # UTC
scriptversion=2025-06-18.21; # UTC
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
# Copyright (C) 1999-2025 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
@@ -37,11 +37,11 @@ IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# func_file_conv build_file unneeded_conversions
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
# type is listed in (the comma separated) UNNEEDED_CONVERSIONS, no
# conversion will take place.
func_file_conv ()
{
file=$1
@@ -51,9 +51,20 @@ func_file_conv ()
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
if test -n "$MSYSTEM" && (cygpath --version) >/dev/null 2>&1; then
# MSYS2 environment.
file_conv=cygwin
else
# Original MinGW environment.
file_conv=mingw
fi
;;
CYGWIN* | MSYS*)
MSYS*)
# Old MSYS environment, or MSYS2 with 32-bit MSYS2 shell.
file_conv=cygwin
;;
CYGWIN*)
# Cygwin environment.
file_conv=cygwin
;;
*)
@@ -63,12 +74,14 @@ func_file_conv ()
fi
case $file_conv/,$2, in
*,$file_conv,*)
# This is the optimization mentioned above:
# If UNNEEDED_CONVERSIONS contains $file_conv, don't convert.
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/* | msys/*)
file=`cygpath -m "$file" || echo "$file"`
cygwin/*)
file=`cygpath -w "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
@@ -143,7 +156,7 @@ func_cl_wrapper ()
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
*.o | *.lo | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
@@ -248,14 +261,17 @@ If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
GNU Automake home page: <https://www.gnu.org/software/automake/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
echo "compile (GNU Automake) $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
clang-cl | *[/\\]clang-cl | clang-cl.exe | *[/\\]clang-cl.exe | \
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
@@ -340,9 +356,9 @@ exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# eval: (add-hook 'before-save-hook 'time-stamp nil t)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-format: "%Y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
+86 -25
View File
@@ -1,10 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright 1992-2022 Free Software Foundation, Inc.
# Copyright 1992-2024 Free Software Foundation, Inc.
# shellcheck disable=SC2006,SC2268 # see below for rationale
timestamp='2022-01-09'
timestamp='2024-07-27'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@ me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on.
Output the configuration name of the system '$me' is run on.
Options:
-h, --help print this help, then exit
@@ -60,13 +60,13 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright 1992-2022 Free Software Foundation, Inc.
Copyright 1992-2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
Try '$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
@@ -102,8 +102,8 @@ GUESS=
# temporary files to be created and, as you can see below, it is a
# headache to deal with in a portable fashion.
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.
# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still
# use 'HOST_CC' if defined, but it is deprecated.
# Portable tmp directory creation inspired by the Autoconf team.
@@ -123,7 +123,7 @@ set_cc_for_build() {
dummy=$tmp/dummy
case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
,,) echo "int x;" > "$dummy.c"
for driver in cc gcc c89 c99 ; do
for driver in cc gcc c17 c99 c89 ; do
if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
CC_FOR_BUILD=$driver
break
@@ -155,6 +155,9 @@ Linux|GNU|GNU/*)
set_cc_for_build
cat <<-EOF > "$dummy.c"
#if defined(__ANDROID__)
LIBC=android
#else
#include <features.h>
#if defined(__UCLIBC__)
LIBC=uclibc
@@ -162,6 +165,8 @@ Linux|GNU|GNU/*)
LIBC=dietlibc
#elif defined(__GLIBC__)
LIBC=gnu
#elif defined(__LLVM_LIBC__)
LIBC=llvm
#else
#include <stdarg.h>
/* First heuristic to detect musl libc. */
@@ -169,6 +174,7 @@ Linux|GNU|GNU/*)
LIBC=musl
#endif
#endif
#endif
EOF
cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
eval "$cc_set_libc"
@@ -459,7 +465,7 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
# Japanese Language versions have a version number like '4.1.3-JL'.
SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
GUESS=sparc-sun-sunos$SUN_REL
;;
@@ -628,7 +634,8 @@ EOF
sed 's/^ //' << EOF > "$dummy.c"
#include <sys/systemcfg.h>
main()
int
main ()
{
if (!__power_pc())
exit(1);
@@ -712,7 +719,8 @@ EOF
#include <stdlib.h>
#include <unistd.h>
int main ()
int
main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
@@ -904,7 +912,7 @@ EOF
fi
;;
*:FreeBSD:*:*)
UNAME_PROCESSOR=`/usr/bin/uname -p`
UNAME_PROCESSOR=`uname -p`
case $UNAME_PROCESSOR in
amd64)
UNAME_PROCESSOR=x86_64 ;;
@@ -966,11 +974,37 @@ EOF
GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
;;
x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*)
GUESS="$UNAME_MACHINE-pc-managarm-mlibc"
;;
*:[Mm]anagarm:*:*)
GUESS="$UNAME_MACHINE-unknown-managarm-mlibc"
;;
*:Minix:*:*)
GUESS=$UNAME_MACHINE-unknown-minix
;;
aarch64:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
set_cc_for_build
CPU=$UNAME_MACHINE
LIBCABI=$LIBC
if test "$CC_FOR_BUILD" != no_compiler_found; then
ABI=64
sed 's/^ //' << EOF > "$dummy.c"
#ifdef __ARM_EABI__
#ifdef __ARM_PCS_VFP
ABI=eabihf
#else
ABI=eabi
#endif
#endif
EOF
cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
eval "$cc_set_abi"
case $ABI in
eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;;
esac
fi
GUESS=$CPU-unknown-linux-$LIBCABI
;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
@@ -1036,7 +1070,16 @@ EOF
k1om:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
kvx:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
kvx:cos:*:*)
GUESS=$UNAME_MACHINE-unknown-cos
;;
kvx:mbr:*:*)
GUESS=$UNAME_MACHINE-unknown-mbr
;;
loongarch32:Linux:*:* | loongarch64:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
m32r*:Linux:*:*)
@@ -1151,16 +1194,27 @@ EOF
;;
x86_64:Linux:*:*)
set_cc_for_build
CPU=$UNAME_MACHINE
LIBCABI=$LIBC
if test "$CC_FOR_BUILD" != no_compiler_found; then
if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_X32 >/dev/null
then
LIBCABI=${LIBC}x32
fi
ABI=64
sed 's/^ //' << EOF > "$dummy.c"
#ifdef __i386__
ABI=x86
#else
#ifdef __ILP32__
ABI=x32
#endif
#endif
EOF
cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
eval "$cc_set_abi"
case $ABI in
x86) CPU=i686 ;;
x32) LIBCABI=${LIBC}x32 ;;
esac
fi
GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
GUESS=$CPU-pc-linux-$LIBCABI
;;
xtensa*:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
@@ -1180,7 +1234,7 @@ EOF
GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# If we were able to find 'uname', then EMX Unix compatibility
# is probably installed.
GUESS=$UNAME_MACHINE-pc-os2-emx
;;
@@ -1321,7 +1375,7 @@ EOF
GUESS=ns32k-sni-sysv
fi
;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
GUESS=i586-unisys-sysv4
;;
@@ -1367,8 +1421,11 @@ EOF
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
GUESS=i586-pc-haiku
;;
x86_64:Haiku:*:*)
GUESS=x86_64-unknown-haiku
ppc:Haiku:*:*) # Haiku running on Apple PowerPC
GUESS=powerpc-apple-haiku
;;
*:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat)
GUESS=$UNAME_MACHINE-unknown-haiku
;;
SX-4:SUPER-UX:*:*)
GUESS=sx4-nec-superux$UNAME_RELEASE
@@ -1540,6 +1597,9 @@ EOF
*:Unleashed:*:*)
GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
;;
*:Ironclad:*:*)
GUESS=$UNAME_MACHINE-unknown-ironclad
;;
esac
# Do we have a guess based on uname results?
@@ -1563,6 +1623,7 @@ cat > "$dummy.c" <<EOF
#endif
#endif
#endif
int
main ()
{
#if defined (sony)
+703 -239
View File
File diff suppressed because it is too large. Load diff
+3173 -1362
View File
File diff suppressed because it is too large. Load diff
+25 -4
View File
@@ -2,7 +2,7 @@ dnl Process this with autoconf to create configure
AC_PREREQ([2.68])
AC_INIT([libffi],[3.8.0],[http://github.com/libffi/libffi/issues])
AC_INIT([libffi],[3.8.1],[http://github.com/libffi/libffi/issues])
AC_CONFIG_HEADERS([fficonfig.h])
dnl Derive the version macros from AC_INIT so they cannot drift when the
@@ -47,6 +47,11 @@ m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
AC_SUBST(CFLAGS)
# Use the final compiler flags, including target flags added below, when make
# assembles sources. Keep explicit CCASFLAGS values, including empty ones.
if test "${CCASFLAGS+set}" != set; then
CCASFLAGS='$(CFLAGS)'
fi
AM_PROG_AS
AM_PROG_CC_C_O
AC_PROG_EGREP
@@ -285,9 +290,10 @@ EOF
# we ensure that we can compile _and_ link an assembly file containing an @unwind section
# since the compiler can support it and not the linker (ie old binutils)
if $CC -Wa,--fatal-warnings $CFLAGS -c conftest1.s > /dev/null 2>&1 && \
$CC conftest2.c conftest1.o > /dev/null 2>&1 ; then
$CC conftest2.c conftest1.o -o conftest$ac_exeext > /dev/null 2>&1 ; then
libffi_cv_as_x86_64_unwind_section_type=yes
fi
rm -f conftest1.s conftest1.o conftest2.c conftest$ac_exeext a.out
])
if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then
AC_DEFINE(HAVE_AS_X86_64_UNWIND_SECTION_TYPE, 1,
@@ -338,7 +344,7 @@ fi
AC_ARG_ENABLE(docs,
AS_HELP_STRING([--disable-docs],[Disable building of docs (default: no)]),
[enable_docs=no],
[],
[enable_docs=yes])
AM_CONDITIONAL(BUILD_DOCS, [test x$enable_docs = xyes])
@@ -427,6 +433,20 @@ AC_ARG_ENABLE(multi-os-directory,
[ --disable-multi-os-directory
disable use of gcc --print-multi-os-directory to change the library installation directory])
# Match every libdir spelling accepted by Autoconf's option parser.
libdir_explicit=no
eval "set x $ac_configure_args"
shift
for arg
do
case $arg in
-libdir | --libdir | --libdi | --libd | \
-libdir=* | --libdir=* | --libdi=* | --libd=*)
libdir_explicit=yes
break ;;
esac
done
# These variables are only ever used when we cross-build to X86_WIN32.
# And we only support this with GCC, so...
if test "x$GCC" = "xyes"; then
@@ -438,7 +458,8 @@ if test "x$GCC" = "xyes"; then
toolexecdir='${libdir}'/gcc-lib/'$(target_alias)'
toolexeclibdir='${libdir}'
fi
if test x"$enable_multi_os_directory" != x"no"; then
if test x"$enable_multi_os_directory" != x"no" &&
test x"$libdir_explicit" != x"yes"; then
multi_os_directory=`$CC $CFLAGS -print-multi-os-directory`
case $multi_os_directory in
.) ;; # Avoid trailing /.
+10 -9
View File
@@ -1,9 +1,9 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2018-03-07.03; # UTC
scriptversion=2025-06-18.21; # UTC
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
# Copyright (C) 1999-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -47,11 +47,13 @@ Environment variables:
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
GNU Automake home page: <https://www.gnu.org/software/automake/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
echo "depcomp (GNU Automake) $scriptversion"
exit $?
;;
esac
@@ -113,7 +115,6 @@ nl='
# These definitions help.
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
lower=abcdefghijklmnopqrstuvwxyz
digits=0123456789
alpha=${upper}${lower}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
@@ -128,7 +129,7 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Avoid interferences from the environment.
# Avoid interference from the environment.
gccflag= dashmflag=
# Some modes work just like other modes, but use different flags. We
@@ -198,8 +199,8 @@ gcc3)
;;
gcc)
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
## Note that this doesn't just cater to obsolete pre-3.x GCC compilers.
## but also to in-use compilers like IBM xlc/xlC and the HP C compiler.
## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
@@ -783,9 +784,9 @@ exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# eval: (add-hook 'before-save-hook 'time-stamp nil t)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-format: "%Y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
+23 -13
View File
@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# Makefile.in generated by automake 1.18.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# Copyright (C) 1994-2025 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -69,6 +69,8 @@ am__make_running_with_option = \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
am__rm_f = rm -f $(am__rm_f_notfound)
am__rm_rf = rm -rf $(am__rm_f_notfound)
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -195,10 +197,9 @@ am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
{ test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \
}
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in mdate-sh texinfo.tex
@@ -304,8 +305,10 @@ ac_ct_READELF = @ac_ct_READELF@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__rm_f_notfound = @am__rm_f_notfound@
am__tar = @am__tar@
am__untar = @am__untar@
am__xargs_n = @am__xargs_n@
ax_enable_builddir_sed = @ax_enable_builddir_sed@
bindir = @bindir@
build = @build@
@@ -422,13 +425,13 @@ clean-libtool:
.texi.dvi:
$(AM_V_TEXI2DVI)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
$(TEXI2DVI) $(AM_V_texinfo) --build-dir=$(@:.dvi=.t2d) -o $@ $(AM_V_texidevnull) \
$(TEXI2DVI) $(AM_TEXI2FLAGS) -I $(srcdir) $(AM_V_texinfo) --build-dir=$(@:.dvi=.t2d) -o $@ $(AM_V_texidevnull) \
$<
.texi.pdf:
$(AM_V_TEXI2PDF)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
$(TEXI2PDF) $(AM_V_texinfo) --build-dir=$(@:.pdf=.t2p) -o $@ $(AM_V_texidevnull) \
$(TEXI2PDF) $(AM_TEXI2FLAGS) -I $(srcdir) $(AM_V_texinfo) --build-dir=$(@:.pdf=.t2p) -o $@ $(AM_V_texidevnull) \
$<
.texi.html:
@@ -545,11 +548,10 @@ dist-info: $(INFO_DEPS)
done
mostlyclean-aminfo:
-rm -rf libffi.t2d libffi.t2p
-$(am__rm_rf) libffi.t2d libffi.t2p
clean-aminfo:
-test -z "libffi.dvi libffi.pdf libffi.ps libffi.html" \
|| rm -rf libffi.dvi libffi.pdf libffi.ps libffi.html
-$(am__rm_rf) libffi.dvi libffi.pdf libffi.ps libffi.html
maintainer-clean-aminfo:
@list='$(INFO_DEPS)'; for i in $$list; do \
@@ -563,6 +565,7 @@ ctags CTAGS:
cscope cscopelist:
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
@@ -630,8 +633,8 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-$(am__rm_f) $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -820,3 +823,10 @@ uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
# Tell GNU make to disable its built-in pattern rules.
%:: %,v
%:: RCS/%,v
%:: RCS/%
%:: s.%
%:: SCCS/s.%
+19 -15
View File
@@ -1,4 +1,4 @@
This is libffi.info, produced by makeinfo version 7.1 from libffi.texi.
This is libffi.info, produced by makeinfo version 7.2 from libffi.texi.
This manual is for libffi, a portable foreign function interface
library.
@@ -515,6 +515,12 @@ array.
structure types created like this should only be used to refer to
members of real ‘FFI_TYPE_STRUCT’ objects.
Some ABIs classify array fields differently from structurally
identical structure fields. Because ‘ffi_type’ has no separate array
tag, this emulation cannot express that distinction. On those targets,
passing or returning an enclosing structure containing an emulated array
by value is not supported.
However, a phony array type like this will not cause any errors from
‘libffi’ if you use it as an argument or return type. This may be
confusing.
@@ -1052,7 +1058,6 @@ A trivial example that creates a new ‘puts’ by binding ‘fputs’ with
return 0;
}

File: libffi.info, Node: Thread Safety, Prev: Closure Example, Up: Using libffi
@@ -1208,7 +1213,6 @@ Index
* void <3>: The Closure API. (line 19)
* void <4>: The Closure API. (line 26)

Tag Table:
Node: Top1387
@@ -1221,18 +1225,18 @@ Node: Primitive Types12967
Node: Structures15284
Node: Size and Alignment16395
Node: Arrays Unions Enums18666
Node: Type Example21643
Node: Complex22949
Node: Complex Type Example24463
Node: Vector Types27536
Node: Multiple ABIs31575
Node: Reusable Call Plans31962
Node: The Closure API34155
Node: Closure Example38497
Node: Thread Safety40141
Node: Memory Usage40974
Node: Missing Features42249
Node: Index42626
Node: Type Example21955
Node: Complex23261
Node: Complex Type Example24775
Node: Vector Types27848
Node: Multiple ABIs31887
Node: Reusable Call Plans32274
Node: The Closure API34467
Node: Closure Example38809
Node: Thread Safety40452
Node: Memory Usage41285
Node: Missing Features42560
Node: Index42937

End Tag Table
BIN
View File
Binary file not shown.
+6
View File
@@ -566,6 +566,12 @@ Note that arrays cannot be passed or returned by value in C --
structure types created like this should only be used to refer to
members of real @code{FFI_TYPE_STRUCT} objects.
Some ABIs classify array fields differently from structurally identical
structure fields. Because @code{ffi_type} has no separate array tag, this
emulation cannot express that distinction. On those targets, passing or
returning an enclosing structure containing an emulated array by value is
not supported.
However, a phony array type like this will not cause any errors from
@code{libffi} if you use it as an argument or return type. This may
be confusing.
+37 -38
View File
@@ -1,9 +1,10 @@
#!/bin/sh
# Get modification time of a file or directory and pretty-print it.
# Get modification time of a file or directory, or value of
# $SOURCE_DATE_EPOCH, and pretty-print it, formatted like 1 January 2000.
scriptversion=2018-03-07.03; # UTC
scriptversion=2025-06-25.21; # UTC
# Copyright (C) 1995-2021 Free Software Foundation, Inc.
# Copyright (C) 1995-2025 Free Software Foundation, Inc.
# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
#
# This program is free software; you can redistribute it and/or modify
@@ -50,21 +51,46 @@ Pretty-print the modification day of FILE, in the format:
1 January 1970
Report bugs to <bug-automake@gnu.org>.
GNU Automake home page: <https://www.gnu.org/software/automake/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
EOF
exit $?
;;
-v | --v*)
echo "mdate-sh $scriptversion"
echo "mdate-sh (GNU Automake) $scriptversion"
exit $?
;;
esac
# Warn if more than one file given.
if test $# -ne 1; then
echo "$0: warning: multiple files given, using first: $*" >&2
fi
error ()
{
echo "$0: $1" >&2
exit 1
}
# set $month ("January") and $nummonth (1) given arg MON ("Jan").
mon_to_month ()
{
case $1 in
Jan) month=January; nummonth=1;;
Feb) month=February; nummonth=2;;
Mar) month=March; nummonth=3;;
Apr) month=April; nummonth=4;;
May) month=May; nummonth=5;;
Jun) month=June; nummonth=6;;
Jul) month=July; nummonth=7;;
Aug) month=August; nummonth=8;;
Sep) month=September; nummonth=9;;
Oct) month=October; nummonth=10;;
Nov) month=November; nummonth=11;;
Dec) month=December; nummonth=12;;
esac
}
# Prevent date giving response in another language.
LANG=C
@@ -78,6 +104,7 @@ export LC_TIME
TZ=UTC0
export TZ
#
# GNU ls changes its time format in response to the TIME_STYLE
# variable. Since we cannot assume 'unset' works, revert this
# variable to its documented default.
@@ -123,20 +150,7 @@ do
shift
# Add another shift to the command.
command="$command shift;"
case $1 in
Jan) month=January; nummonth=1;;
Feb) month=February; nummonth=2;;
Mar) month=March; nummonth=3;;
Apr) month=April; nummonth=4;;
May) month=May; nummonth=5;;
Jun) month=June; nummonth=6;;
Jul) month=July; nummonth=7;;
Aug) month=August; nummonth=8;;
Sep) month=September; nummonth=9;;
Oct) month=October; nummonth=10;;
Nov) month=November; nummonth=11;;
Dec) month=December; nummonth=12;;
esac
mon_to_month $1
done
test -n "$month" || error "failed parsing '$ls_command /' output"
@@ -150,7 +164,6 @@ eval $command
# Because of the dummy argument above, month is in $2.
#
# On a POSIX system, we should have
#
# $# = 5
# $1 = file size
# $2 = month
@@ -159,7 +172,6 @@ eval $command
# $5 = filename
#
# On Darwin 7.7.0 and 7.6.0, we have
#
# $# = 4
# $1 = day
# $2 = month
@@ -167,20 +179,7 @@ eval $command
# $4 = filename
# Get the month.
case $2 in
Jan) month=January; nummonth=1;;
Feb) month=February; nummonth=2;;
Mar) month=March; nummonth=3;;
Apr) month=April; nummonth=4;;
May) month=May; nummonth=5;;
Jun) month=June; nummonth=6;;
Jul) month=July; nummonth=7;;
Aug) month=August; nummonth=8;;
Sep) month=September; nummonth=9;;
Oct) month=October; nummonth=10;;
Nov) month=November; nummonth=11;;
Dec) month=December; nummonth=12;;
esac
mon_to_month $2
case $3 in
???*) day=$1;;
@@ -205,9 +204,9 @@ case $3 in
Nov) nummonthtod=11;;
Dec) nummonthtod=12;;
esac
# For the first six month of the year the time notation can also
# For the first six months of the year the time notation can also
# be used for files modified in the last year.
if (expr $nummonth \> $nummonthtod) > /dev/null;
if (expr $nummonth \> $nummonthtod) >/dev/null;
then
year=`expr $year - 1`
fi;;
@@ -220,9 +219,9 @@ echo $day $month $year
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# eval: (add-hook 'before-save-hook 'time-stamp nil t)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-format: "%Y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
+4 -4
View File
@@ -1,4 +1,4 @@
@set UPDATED 8 August 2026
@set UPDATED-MONTH August 2026
@set EDITION 3.8.0
@set VERSION 3.8.0
@set UPDATED 14 November 2026
@set UPDATED-MONTH November 2026
@set EDITION 3.8.1
@set VERSION 3.8.1
+2456 -1714
View File
File diff suppressed because it is too large. Load diff
+4 -4
View File
@@ -1,4 +1,4 @@
@set UPDATED 8 August 2026
@set UPDATED-MONTH August 2026
@set EDITION 3.8.0
@set VERSION 3.8.0
@set UPDATED 14 November 2026
@set UPDATED-MONTH November 2026
@set EDITION 3.8.1
@set VERSION 3.8.1
+6 -6
View File
@@ -71,10 +71,10 @@
/* Define if you support more than one size of the long double type */
#undef HAVE_LONG_DOUBLE_VARIANT
/* Define to 1 if you have the `memcpy' function. */
/* Define to 1 if you have the 'memcpy' function. */
#undef HAVE_MEMCPY
/* Define to 1 if you have the `memfd_create' function. */
/* Define to 1 if you have the 'memfd_create' function. */
#undef HAVE_MEMFD_CREATE
/* Define if .eh_frame sections should be read-only. */
@@ -134,16 +134,16 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* The size of `double', as computed by sizeof. */
/* The size of 'double', as computed by sizeof. */
#undef SIZEOF_DOUBLE
/* The size of `long double', as computed by sizeof. */
/* The size of 'long double', as computed by sizeof. */
#undef SIZEOF_LONG_DOUBLE
/* The size of `size_t', as computed by sizeof. */
/* The size of 'size_t', as computed by sizeof. */
#undef SIZEOF_SIZE_T
/* Define to 1 if all of the C90 standard headers exist (not just the ones
/* Define to 1 if all of the C89 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
+2 -2
View File
@@ -7,8 +7,8 @@ import sys
from pathlib import Path
LIBFFI_VERSION = '3.8.0'
LIBFFI_VERSION_NUMBER = '30800'
LIBFFI_VERSION = '3.8.1'
LIBFFI_VERSION_NUMBER = '30801'
def normalize_arch(target_arch):
aliases = {
+20 -9
View File
@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# Makefile.in generated by automake 1.18.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# Copyright (C) 1994-2025 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -70,6 +70,8 @@ am__make_running_with_option = \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
am__rm_f = rm -f $(am__rm_f_notfound)
am__rm_rf = rm -rf $(am__rm_f_notfound)
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -155,10 +157,9 @@ am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
{ test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \
}
am__installdirs = "$(DESTDIR)$(includedir)"
HEADERS = $(nodist_include_HEADERS) $(noinst_HEADERS)
@@ -282,8 +283,10 @@ ac_ct_READELF = @ac_ct_READELF@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__rm_f_notfound = @am__rm_f_notfound@
am__tar = @am__tar@
am__untar = @am__untar@
am__xargs_n = @am__xargs_n@
ax_enable_builddir_sed = @ax_enable_builddir_sed@
bindir = @bindir@
build = @build@
@@ -452,6 +455,7 @@ cscopelist-am: $(am__tagged_files)
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
@@ -516,9 +520,9 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
-$(am__rm_f) $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES)
-$(am__rm_f) $(DISTCLEANFILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -611,3 +615,10 @@ uninstall-am: uninstall-nodist_includeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
# Tell GNU make to disable its built-in pattern rules.
%:: %,v
%:: RCS/%,v
%:: RCS/%
%:: s.%
%:: SCCS/s.%
+9 -9
View File
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2020-11-14.01; # UTC
scriptversion=2025-06-18.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -124,9 +124,9 @@ it's up to you to specify -f if you want it.
If -S is not specified, no backups are attempted.
Email bug reports to bug-automake@gnu.org.
Automake home page: https://www.gnu.org/software/automake/
"
Report bugs to <bug-automake@gnu.org>.
GNU Automake home page: <https://www.gnu.org/software/automake/>.
General help using GNU software: <https://www.gnu.org/gethelp/>."
while test $# -ne 0; do
case $1 in
@@ -170,7 +170,7 @@ while test $# -ne 0; do
-T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
--version) echo "$0 (GNU Automake) $scriptversion"; exit $?;;
--) shift
break;;
@@ -345,7 +345,7 @@ do
' 0
# Because "mkdir -p" follows existing symlinks and we likely work
# directly in world-writeable /tmp, make sure that the '$tmpdir'
# directly in world-writable /tmp, make sure that the '$tmpdir'
# directory is successfully created first before we actually test
# 'mkdir -p'.
if (umask $mkdir_umask &&
@@ -353,7 +353,7 @@ do
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# Check for POSIX incompatibility with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
@@ -533,9 +533,9 @@ do
done
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# eval: (add-hook 'before-save-hook 'time-stamp nil t)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-format: "%Y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
+1 -1
View File
@@ -26,4 +26,4 @@
# release, then set age to 0.
#
# CURRENT:REVISION:AGE
13:0:5
13:1:5
+418 -331
View File
File diff suppressed because it is too large. Load diff
+267 -181
View File
File diff suppressed because it is too large. Load diff
+68 -38
View File
@@ -1,6 +1,6 @@
# Helper functions for option handling. -*- Autoconf -*-
#
# Copyright (C) 2004-2005, 2007-2009, 2011-2019, 2021-2022 Free
# Copyright (C) 2004-2005, 2007-2009, 2011-2019, 2021-2024 Free
# Software Foundation, Inc.
# Written by Gary V. Vaughan, 2004
#
@@ -8,7 +8,7 @@
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 8 ltoptions.m4
# serial 10 ltoptions.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
@@ -128,7 +128,7 @@ LT_OPTION_DEFINE([LT_INIT], [win32-dll],
[enable_win32_dll=yes
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-cegcc*)
AC_CHECK_TOOL(AS, as, false)
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)
@@ -323,29 +323,39 @@ dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
# _LT_WITH_AIX_SONAME([DEFAULT])
# ----------------------------------
# implement the --with-aix-soname flag, and support the `aix-soname=aix'
# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'.
# implement the --enable-aix-soname configure option, and support the
# `aix-soname=aix' and `aix-soname=both' and `aix-soname=svr4' LT_INIT options.
# DEFAULT is either `aix', `both', or `svr4'. If omitted, it defaults to `aix'.
m4_define([_LT_WITH_AIX_SONAME],
[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
shared_archive_member_spec=
case $host,$enable_shared in
power*-*-aix[[5-9]]*,yes)
AC_MSG_CHECKING([which variant of shared library versioning to provide])
AC_ARG_WITH([aix-soname],
[AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
AC_ARG_ENABLE([aix-soname],
[AS_HELP_STRING([--enable-aix-soname=aix|svr4|both],
[shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
[case $withval in
aix|svr4|both)
;;
*)
AC_MSG_ERROR([Unknown argument to --with-aix-soname])
;;
esac
lt_cv_with_aix_soname=$with_aix_soname],
[AC_CACHE_VAL([lt_cv_with_aix_soname],
[lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
with_aix_soname=$lt_cv_with_aix_soname])
[case $enableval in
aix|svr4|both)
;;
*)
AC_MSG_ERROR([Unknown argument to --enable-aix-soname])
;;
esac
lt_cv_with_aix_soname=$enable_aix_soname],
[_AC_ENABLE_IF([with], [aix-soname],
[case $withval in
aix|svr4|both)
;;
*)
AC_MSG_ERROR([Unknown argument to --with-aix-soname])
;;
esac
lt_cv_with_aix_soname=$with_aix_soname],
[AC_CACHE_VAL([lt_cv_with_aix_soname],
[lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)])
enable_aix_soname=$lt_cv_with_aix_soname])
with_aix_soname=$enable_aix_soname
AC_MSG_RESULT([$with_aix_soname])
if test aix != "$with_aix_soname"; then
# For the AIX way of multilib, we name the shared archive member
@@ -376,30 +386,50 @@ LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
# _LT_WITH_PIC([MODE])
# --------------------
# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
# implement the --enable-pic flag, and support the 'pic-only' and 'no-pic'
# LT_INIT options.
# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'.
m4_define([_LT_WITH_PIC],
[AC_ARG_WITH([pic],
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
[AC_ARG_ENABLE([pic],
[AS_HELP_STRING([--enable-pic@<:@=PKGS@:>@],
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
[lt_p=${PACKAGE-default}
case $withval in
yes|no) pic_mode=$withval ;;
*)
pic_mode=default
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for lt_pkg in $withval; do
IFS=$lt_save_ifs
if test "X$lt_pkg" = "X$lt_p"; then
pic_mode=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[pic_mode=m4_default([$1], [default])])
case $enableval in
yes|no) pic_mode=$enableval ;;
*)
pic_mode=default
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for lt_pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$lt_pkg" = "X$lt_p"; then
pic_mode=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[dnl Continue to support --with-pic and --without-pic, for backward
dnl compatibility.
_AC_ENABLE_IF([with], [pic],
[lt_p=${PACKAGE-default}
case $withval in
yes|no) pic_mode=$withval ;;
*)
pic_mode=default
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for lt_pkg in $withval; do
IFS=$lt_save_ifs
if test "X$lt_pkg" = "X$lt_p"; then
pic_mode=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[pic_mode=m4_default([$1], [default])])]
)
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
])# _LT_WITH_PIC
+1 -1
View File
@@ -1,6 +1,6 @@
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
#
# Copyright (C) 2004-2005, 2007-2008, 2011-2019, 2021-2022 Free Software
# Copyright (C) 2004-2005, 2007-2008, 2011-2019, 2021-2024 Free Software
# Foundation, Inc.
# Written by Gary V. Vaughan, 2004
#
+6 -6
View File
@@ -1,6 +1,6 @@
# ltversion.m4 -- version numbers -*- Autoconf -*-
#
# Copyright (C) 2004, 2011-2019, 2021-2022 Free Software Foundation,
# Copyright (C) 2004, 2011-2019, 2021-2024 Free Software Foundation,
# Inc.
# Written by Scott James Remnant, 2004
#
@@ -10,15 +10,15 @@
# @configure_input@
# serial 4245 ltversion.m4
# serial 4441 ltversion.m4
# This file is part of GNU Libtool
m4_define([LT_PACKAGE_VERSION], [2.4.7])
m4_define([LT_PACKAGE_REVISION], [2.4.7])
m4_define([LT_PACKAGE_VERSION], [2.5.4])
m4_define([LT_PACKAGE_REVISION], [2.5.4])
AC_DEFUN([LTVERSION_VERSION],
[macro_version='2.4.7'
macro_revision='2.4.7'
[macro_version='2.5.4'
macro_revision='2.5.4'
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
_LT_DECL(, macro_revision, 0)
])
+1 -1
View File
@@ -1,6 +1,6 @@
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
#
# Copyright (C) 2004-2005, 2007, 2009, 2011-2019, 2021-2022 Free
# Copyright (C) 2004-2005, 2007, 2009, 2011-2019, 2021-2024 Free
# Software Foundation, Inc.
# Written by Scott James Remnant, 2004.
#
+19 -8
View File
@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# Makefile.in generated by automake 1.18.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# Copyright (C) 1994-2025 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -69,6 +69,8 @@ am__make_running_with_option = \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
am__rm_f = rm -f $(am__rm_f_notfound)
am__rm_rf = rm -rf $(am__rm_f_notfound)
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -153,10 +155,9 @@ am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
{ test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \
}
man3dir = $(mandir)/man3
am__installdirs = "$(DESTDIR)$(man3dir)"
@@ -266,8 +267,10 @@ ac_ct_READELF = @ac_ct_READELF@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__rm_f_notfound = @am__rm_f_notfound@
am__tar = @am__tar@
am__untar = @am__untar@
am__xargs_n = @am__xargs_n@
ax_enable_builddir_sed = @ax_enable_builddir_sed@
bindir = @bindir@
build = @build@
@@ -408,6 +411,7 @@ ctags CTAGS:
cscope cscopelist:
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
@@ -472,8 +476,8 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-$(am__rm_f) $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -567,3 +571,10 @@ uninstall-man: uninstall-man3
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
# Tell GNU make to disable its built-in pattern rules.
%:: %,v
%:: RCS/%,v
%:: RCS/%
%:: s.%
%:: SCCS/s.%
+50 -29
View File
@@ -1,9 +1,11 @@
#! /bin/sh
# Common wrapper for a few potentially missing GNU programs.
# Common wrapper for a few potentially missing GNU and other programs.
scriptversion=2018-03-07.03; # UTC
scriptversion=2025-06-18.21; # UTC
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
# shellcheck disable=SC2006,SC2268 # we must support pre-POSIX shells
# Copyright (C) 1996-2025 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
@@ -54,18 +56,20 @@ Options:
-v, --version output version information and exit
Supported PROGRAM values:
aclocal autoconf autoheader autom4te automake makeinfo
bison yacc flex lex help2man
aclocal autoconf autogen autoheader autom4te automake autoreconf
bison flex help2man lex makeinfo perl yacc
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
'g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
Report bugs to <bug-automake@gnu.org>.
GNU Automake home page: <https://www.gnu.org/software/automake/>.
General help using GNU software: <https://www.gnu.org/gethelp/>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
echo "missing (GNU Automake) $scriptversion"
exit $?
;;
@@ -108,7 +112,7 @@ gnu_software_URL=https://www.gnu.org/software
program_details ()
{
case $1 in
aclocal|automake)
aclocal|automake|autoreconf)
echo "The '$1' program is part of the GNU Automake package:"
echo "<$gnu_software_URL/automake>"
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
@@ -123,6 +127,9 @@ program_details ()
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
*)
:
;;
esac
}
@@ -137,48 +144,55 @@ give_advice ()
printf '%s\n' "'$1' is $msg."
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
autoheader_deps="'acconfig.h'"
automake_deps="'Makefile.am'"
aclocal_deps="'acinclude.m4'"
case $normalized_program in
aclocal*)
echo "You should only need it if you modified $aclocal_deps or"
echo "$configure_deps."
;;
autoconf*)
echo "You should only need it if you modified 'configure.ac',"
echo "or m4 files included by it."
program_details 'autoconf'
echo "You should only need it if you modified $configure_deps."
;;
autogen*)
echo "You should only need it if you modified a '.def' or '.tpl' file."
echo "You may want to install the GNU AutoGen package:"
echo "<$gnu_software_URL/autogen/>"
;;
autoheader*)
echo "You should only need it if you modified 'acconfig.h' or"
echo "You should only need it if you modified $autoheader_deps or"
echo "$configure_deps."
program_details 'autoheader'
;;
automake*)
echo "You should only need it if you modified 'Makefile.am' or"
echo "You should only need it if you modified $automake_deps or"
echo "$configure_deps."
program_details 'automake'
;;
aclocal*)
echo "You should only need it if you modified 'acinclude.m4' or"
echo "$configure_deps."
program_details 'aclocal'
;;
autom4te*)
autom4te*)
echo "You might have modified some maintainer files that require"
echo "the 'autom4te' program to be rebuilt."
program_details 'autom4te'
;;
autoreconf*)
echo "You should only need it if you modified $aclocal_deps or"
echo "$automake_deps or $autoheader_deps or $automake_deps or"
echo "$configure_deps."
;;
bison*|yacc*)
echo "You should only need it if you modified a '.y' file."
echo "You may want to install the GNU Bison package:"
echo "<$gnu_software_URL/bison/>"
;;
lex*|flex*)
echo "You should only need it if you modified a '.l' file."
echo "You may want to install the Fast Lexical Analyzer package:"
echo "<$flex_URL>"
;;
help2man*)
echo "You should only need it if you modified a dependency" \
"of a man page."
echo "You may want to install the GNU Help2man package:"
echo "<$gnu_software_URL/help2man/>"
;;
lex*|flex*)
echo "You should only need it if you modified a '.l' file."
echo "You may want to install the Fast Lexical Analyzer package:"
echo "<$flex_URL>"
;;
makeinfo*)
echo "You should only need it if you modified a '.texi' file, or"
echo "any other file indirectly affecting the aspect of the manual."
@@ -189,6 +203,12 @@ give_advice ()
echo "want to install GNU make:"
echo "<$gnu_software_URL/make/>"
;;
perl*)
echo "You should only need it to run GNU Autoconf, GNU Automake, "
echo " assorted other tools, or if you modified a Perl source file."
echo "You may want to install the Perl 5 language interpreter:"
echo "<$perl_URL>"
;;
*)
echo "You might have modified some files without having the proper"
echo "tools for further handling them. Check the 'README' file, it"
@@ -197,6 +217,7 @@ give_advice ()
echo "case some other package contains this missing '$1' program."
;;
esac
program_details "$normalized_program"
}
give_advice "$1" | sed -e '1s/^/WARNING: /' \
@@ -207,9 +228,9 @@ give_advice "$1" | sed -e '1s/^/WARNING: /' \
exit $st
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# eval: (add-hook 'before-save-hook 'time-stamp nil t)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-format: "%Y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
+137 -225
View File
@@ -105,249 +105,137 @@ intlog2 (int n)
return level;
}
/* A subroutine of is_vfp_type. Given a structure type, return the type code
of the first non-structure element. Recurse for structure elements.
Return -1 if the structure is in fact empty, i.e. no nested elements. */
/* A subroutine of is_vfp_type. Recursively flatten the (possibly nested)
aggregate TY and verify it is homogeneous: every leaf must be the same
fundamental type, as AAPCS64 requires of an HFA or HVA. Two short
vectors are the same fundamental type when they have the same size (the
lane type is irrelevant: an integer and a floating-point 16-byte vector
both occupy one Q register). A _Complex counts as two members of its
element type.
*KIND carries the common leaf type found so far: 0 before the first leaf,
a positive FFI_TYPE_{FLOAT,DOUBLE,LONGDOUBLE} for a floating-point HFA, or
the negated vector size for an HVA. Returns the number of leaf elements,
or -1 if TY is empty or not homogeneous. */
static int
is_hfa0 (const ffi_type *ty)
{
ffi_type **elements = ty->elements;
int i, ret = -1;
if (elements != NULL)
for (i = 0; elements[i]; ++i)
{
ret = elements[i]->type;
if (ret == FFI_TYPE_STRUCT || ret == FFI_TYPE_VECTOR
|| ret == FFI_TYPE_COMPLEX)
{
ret = is_hfa0 (elements[i]);
if (ret < 0)
continue;
}
break;
}
return ret;
}
/* A subroutine of is_vfp_type. Return the size in bytes of the vector (SIMD)
member of TY, i.e. the width of a single Neon register slot, or 0 if TY
neither is nor contains a vector. For a bare vector this is its whole size;
for a homogeneous vector aggregate it is the size of one lane vector. */
static size_t
is_simd (const ffi_type *ty)
hfa_flatten (const ffi_type *ty, int *kind)
{
ffi_type **elements;
int i;
int i, total, n, k;
if (ty->type == FFI_TYPE_VECTOR)
return ty->size;
switch (ty->type)
{
case FFI_TYPE_FLOAT:
case FFI_TYPE_DOUBLE:
case FFI_TYPE_LONGDOUBLE:
k = (int) ty->type;
if (*kind == 0)
*kind = k;
else if (*kind != k)
return -1;
return 1;
elements = ty->elements;
if (elements != NULL)
for (i = 0; elements[i]; ++i)
{
int t = elements[i]->type;
if (t == FFI_TYPE_STRUCT || t == FFI_TYPE_COMPLEX
|| t == FFI_TYPE_VECTOR)
return is_simd (elements[i]);
}
case FFI_TYPE_VECTOR:
/* Only 4-, 8- and 16-byte short vectors have a register class here. */
if (ty->size != 4 && ty->size != 8 && ty->size != 16)
return -1;
k = -(int) ty->size;
if (*kind == 0)
*kind = k;
else if (*kind != k)
return -1;
return 1;
return 0;
case FFI_TYPE_COMPLEX:
k = ty->elements[0]->type;
if (k != FFI_TYPE_FLOAT && k != FFI_TYPE_DOUBLE && k != FFI_TYPE_LONGDOUBLE)
return -1;
if (*kind == 0)
*kind = k;
else if (*kind != k)
return -1;
return 2;
case FFI_TYPE_STRUCT:
elements = ty->elements;
if (elements == NULL)
return -1;
total = 0;
for (i = 0; elements[i]; ++i)
{
n = hfa_flatten (elements[i], kind);
if (n < 0)
return -1;
total += n;
}
return total == 0 ? -1 : total;
default:
return -1;
}
}
/* A subroutine of is_vfp_type. Given a structure type, return true if all
of the non-structure elements are the same as CANDIDATE. */
/* Determine if TY may be allocated to the FP/SIMD registers. This is an fp
scalar or short vector, or a homogeneous aggregate (HFA or HVA) of 1 to 4
members all of the same fundamental type.
static int
is_hfa1 (const ffi_type *ty, int candidate)
{
ffi_type **elements = ty->elements;
int i;
if (elements != NULL)
for (i = 0; elements[i]; ++i)
{
int t = elements[i]->type;
if (t == FFI_TYPE_STRUCT || t == FFI_TYPE_VECTOR
|| t == FFI_TYPE_COMPLEX)
{
if (!is_hfa1 (elements[i], candidate))
return 0;
}
else if (t != candidate)
return 0;
}
return 1;
}
/* Determine if TY may be allocated to the FP registers. This is both an
fp scalar type as well as an homogenous floating point aggregate (HFA).
That is, a structure consisting of 1 to 4 members of all the same type,
where that type is an fp scalar.
Returns non-zero iff TY is an HFA. The result is the AARCH64_RET_*
constant for the type. */
Returns non-zero iff TY is such a type. The result is the AARCH64_RET_*
constant for it. */
static int
is_vfp_type (const ffi_type *ty)
{
ffi_type **elements;
int candidate, i;
size_t size, ele_count, simd_size;
int candidate, count, kind;
size_t size;
/* Quickest tests first. */
candidate = ty->type;
switch (candidate)
switch (ty->type)
{
default:
return 0;
case FFI_TYPE_FLOAT:
case FFI_TYPE_DOUBLE:
case FFI_TYPE_LONGDOUBLE:
ele_count = 1;
goto done;
return (int) ty->type * 4 + (4 - 1);
case FFI_TYPE_COMPLEX:
candidate = ty->elements[0]->type;
switch (candidate)
{
case FFI_TYPE_FLOAT:
case FFI_TYPE_DOUBLE:
case FFI_TYPE_LONGDOUBLE:
ele_count = 2;
goto done;
}
{
case FFI_TYPE_FLOAT:
case FFI_TYPE_DOUBLE:
case FFI_TYPE_LONGDOUBLE:
return candidate * 4 + (4 - 2);
}
return 0;
case FFI_TYPE_STRUCT:
case FFI_TYPE_VECTOR:
break;
}
/* No HFA/HVA types are smaller than 4 bytes, or larger than 64 bytes. */
/* No HFA/HVA is smaller than 4 bytes or larger than 64 bytes (4 Q regs). */
size = ty->size;
if (size < 4 || size > 64)
return 0;
/* Determine the width of the vector (SIMD) member, if any: 0 for a plain
floating-point HFA, else the size in bytes of one Neon register slot. */
simd_size = is_simd (ty);
/* Find the type of the first non-aggregate member. */
elements = ty->elements;
candidate = elements[0]->type;
if (candidate == FFI_TYPE_STRUCT || candidate == FFI_TYPE_VECTOR
|| candidate == FFI_TYPE_COMPLEX)
{
for (i = 0; ; ++i)
{
candidate = is_hfa0 (elements[i]);
if (candidate >= 0)
break;
}
}
if (simd_size)
{
/* Vector or homogeneous vector aggregate (HVA). A single Neon slot is
at most 16 bytes (a Q register). A bare vector wider than 16 bytes
(e.g. a 32-byte double4) has no short-vector register class under
AAPCS64, so bail and let the generic composite path pass it by
reference / return it in memory -- matching what current compilers do.
The scalar lane type does not affect register selection (an integer
and a floating-point 16-byte vector both occupy one Q register), so,
unlike the floating-point HFA path below, CANDIDATE is used only to
confirm the lanes are homogeneous. */
size_t reg_size = simd_size;
int num_registers;
int first_level_element_type;
/* A Neon register slot is an S (4B), D (8B) or Q (16B). A lane narrower
than 4 bytes has no short-vector register class under AAPCS64 and would
map below AARCH64_RET_S4, making extend_hfa_type() branch before its
jump table; reject it and let the generic aggregate path handle it. */
if (reg_size < 4 || reg_size > 16 || size % reg_size != 0)
return 0;
num_registers = (int) (size / reg_size);
if (num_registers > 4)
return 0;
/* For an aggregate, every member must itself be a vector (or nested
vector aggregate) of the same register width: this rejects a struct
that mixes a bare scalar with a vector even when the scalar's type
matches the vector's lane type. A bare vector needs no such check --
its lanes were validated when its layout was computed. */
if (ty->type != FFI_TYPE_VECTOR)
for (i = 0; elements[i]; ++i)
if (is_simd (elements[i]) != reg_size)
return 0;
/* Every lane must be the identical scalar type across the whole HVA
(this rejects, e.g., an aggregate mixing float and integer vectors). */
for (i = 0; elements[i]; ++i)
{
int t = elements[i]->type;
if (t == FFI_TYPE_STRUCT || t == FFI_TYPE_VECTOR
|| t == FFI_TYPE_COMPLEX)
{
if (!is_hfa1 (elements[i], candidate))
return 0;
}
else if (t != candidate)
return 0;
}
/* Reuse the AARCH64_RET_{S,D,Q}* codes, which are laid out as
(type * 4) + (4 - count) with FLOAT->S(4B), DOUBLE->D(8B),
LONGDOUBLE->Q(16B). Map the register width onto that type axis. */
first_level_element_type = FFI_TYPE_FLOAT + intlog2 ((int) reg_size) - 2;
return first_level_element_type * 4 + (4 - num_registers);
}
/* If the first member is not a floating point type, it's not an HFA.
Also quickly re-check the size of the structure. */
switch (candidate)
{
case FFI_TYPE_FLOAT:
ele_count = size / sizeof(float);
if (size != ele_count * sizeof(float))
return 0;
break;
case FFI_TYPE_DOUBLE:
ele_count = size / sizeof(double);
if (size != ele_count * sizeof(double))
return 0;
break;
case FFI_TYPE_LONGDOUBLE:
ele_count = size / sizeof(long double);
if (size != ele_count * sizeof(long double))
return 0;
break;
default:
return 0;
}
if (ele_count > 4)
/* Flatten the aggregate; every leaf must share one fundamental type, and
there must be 1 to 4 of them. */
kind = 0;
count = hfa_flatten (ty, &kind);
if (count < 1 || count > 4)
return 0;
/* Finally, make sure that all scalar elements are the same type. */
for (i = 0; elements[i]; ++i)
if (kind < 0)
{
int t = elements[i]->type;
if (t == FFI_TYPE_STRUCT || t == FFI_TYPE_COMPLEX)
{
if (!is_hfa1 (elements[i], candidate))
return 0;
}
else if (t != candidate)
return 0;
/* HVA: KIND is the negated vector register width (4, 8 or 16 bytes).
Map it onto the S/D/Q axis of the AARCH64_RET_* encoding. */
candidate = FFI_TYPE_FLOAT + intlog2 (-kind) - 2;
}
else
/* Floating-point HFA: KIND is the common scalar type. */
candidate = kind;
/* All tests succeeded. Encode the result. */
done:
return candidate * 4 + (4 - (int)ele_count);
return candidate * 4 + (4 - count);
}
/* Representation of the procedure call argument marshalling
@@ -408,6 +296,28 @@ allocate_to_stack (struct arg_state *state, void *stack,
return (char *)stack + nsaa;
}
/* Darwin packs only scalars to their natural alignment; a non-HFA
composite of up to 16 bytes still takes whole register-sized slots. */
static void *
allocate_composite_to_stack (struct arg_state *state, void *stack,
const ffi_type *ty)
{
size_t alignment = ty->alignment;
size_t size = ty->size;
/* Apple's ABI gives these composites full pointer-sized slots. The
experimental GCC Darwin port instead packs them to their natural size;
match the compiler ABI used to build libffi so calls and closures remain
self-consistent. */
#if defined (__APPLE__) \
&& (!defined (__GNUC__) || defined (__clang__))
alignment = FFI_ALIGN (alignment, sizeof (void *));
size = FFI_ALIGN (size, sizeof (void *));
#endif
return allocate_to_stack (state, stack, alignment, size);
}
/* Allocate and copy a structure that is passed by value on the stack and
return a pointer to it. */
static void *
@@ -564,13 +474,9 @@ compress_hfa_type (void *dest, void *reg, int h)
{
case AARCH64_RET_S1:
if (dest == reg)
{
#ifdef __AARCH64EB__
dest += 12;
#endif
}
return (char *)dest + BE (12);
else
*(float *)dest = *(float *)reg;
*(float *)dest = *(float *)((char *)reg + BE (12));
break;
case AARCH64_RET_S2:
__asm__ ("ldp q16, q17, [%1]\n\t"
@@ -592,13 +498,9 @@ compress_hfa_type (void *dest, void *reg, int h)
case AARCH64_RET_D1:
if (dest == reg)
{
#ifdef __AARCH64EB__
dest += 8;
#endif
}
return (char *)dest + BE (8);
else
*(double *)dest = *(double *)reg;
*(double *)dest = *(double *)((char *)reg + BE (8));
break;
case AARCH64_RET_D2:
__asm__ ("ldp q16, q17, [%1]\n\t"
@@ -637,10 +539,11 @@ allocate_int_to_reg_or_stack (struct call_context *context,
void *stack, size_t size)
{
if (state->ngrn < N_X_ARG_REG)
return &context->x[state->ngrn++];
return (char *)&context->x[state->ngrn++] + BE (sizeof (UINT64) - size);
state->ngrn = N_X_ARG_REG;
return allocate_to_stack (state, stack, size, size);
return (char *)allocate_to_stack (state, stack, size, size)
+ BE (sizeof (UINT64) - size);
}
static void *
@@ -937,7 +840,8 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
break;
}
state.nsrn = N_V_ARG_REG;
dest = allocate_to_stack (&state, stack, ty->alignment, s);
dest = (char *)allocate_to_stack (&state, stack, ty->alignment, s)
+ (t == FFI_TYPE_FLOAT ? BE (sizeof (UINT64) - s) : 0);
}
}
else if (s > 16)
@@ -951,6 +855,13 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
a = &dest;
t = FFI_TYPE_POINTER;
s = sizeof (void *);
/* The argument is now the pointer, which takes a plain 8-byte,
8-aligned stack slot (AAPCS64 B.4). Re-point `ty' so
do_pointer aligns the slot by 8 and not by the composite's
own alignment (up to 16), which would place the pointer at
the wrong offset -- where the callee, and libffi's own
closure path, do not look (GHSA-h52h-3759-xqm4). */
ty = &ffi_type_pointer;
goto do_pointer;
}
else
@@ -972,7 +883,7 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
adjusted and the argument is copied to memory at the
adjusted NSAA. */
state.ngrn = N_X_ARG_REG;
dest = allocate_to_stack (&state, stack, ty->alignment, s);
dest = allocate_composite_to_stack (&state, stack, ty);
}
}
memcpy (dest, a, s);
@@ -1222,8 +1133,9 @@ ffi_closure_SYSV_inner (ffi_cif *cif,
{
state.ngrn = N_X_ARG_REG;
state.nsrn = N_V_ARG_REG;
avalue[i] = allocate_to_stack(&state, stack,
ty->alignment, s);
avalue[i] = (char *)allocate_to_stack (&state, stack,
ty->alignment, s)
+ (t == FFI_TYPE_FLOAT ? BE (sizeof (UINT64) - s) : 0);
}
}
else
@@ -1237,8 +1149,9 @@ ffi_closure_SYSV_inner (ffi_cif *cif,
else
{
state.nsrn = N_V_ARG_REG;
avalue[i] = allocate_to_stack(&state, stack,
ty->alignment, s);
avalue[i] = (char *)allocate_to_stack (&state, stack,
ty->alignment, s)
+ (t == FFI_TYPE_FLOAT ? BE (sizeof (UINT64) - s) : 0);
}
}
}
@@ -1270,8 +1183,7 @@ ffi_closure_SYSV_inner (ffi_cif *cif,
else
{
state.ngrn = N_X_ARG_REG;
avalue[i] = allocate_to_stack(&state, stack,
ty->alignment, s);
avalue[i] = allocate_composite_to_stack (&state, stack, ty);
}
}
break;
+5
View File
@@ -78,6 +78,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#endif
#ifdef __AARCH64EB__
# define BE(X) X
#else
# define BE(X) 0
#endif
/* Helpers for writing assembly compatible with arm ptr auth */
#ifdef LIBFFI_ASM
+4
View File
@@ -728,3 +728,7 @@ CNAME(ffi_go_closure_SYSV):
.section .note.GNU-stack,"",%progbits
FEATURE_1_AND_MARK(AARCH64_BTI | AARCH64_POINTER_AUTH | AARCH64_GCS)
#endif
#ifdef __APPLE__
.subsections_via_symbols
#endif
+28 -1
View File
@@ -309,8 +309,20 @@ ffi_prep_cif_machdep (ffi_cif *cif)
flags = ARM_TYPE_INT;
else
{
/* The address of the return value goes in r0, ahead of the
arguments, which can then need more padding than cif->bytes
includes. Lay them out again behind it. */
unsigned i;
flags = ARM_TYPE_STRUCT;
bytes += 4;
bytes = 4;
for (i = 0; i < cif->nargs; i++)
{
ffi_type *ty = cif->arg_types[i];
bytes = (size_t) ffi_align (ty, (void *) bytes);
bytes += FFI_ALIGN (ty->size, 4);
}
}
break;
@@ -467,6 +479,11 @@ ffi_prep_incoming_args_SYSV (ffi_cif *cif, void *rvalue,
size_t z = ty->size;
argp = ffi_align (ty, argp);
#ifdef __ARMEB__
if (z < 4 && ty->type != FFI_TYPE_STRUCT && ty->type != FFI_TYPE_COMPLEX)
avalue[i] = (void *) (argp + 4 - z);
else
#endif
avalue[i] = (void *) argp;
argp += z;
}
@@ -515,6 +532,11 @@ ffi_prep_incoming_args_VFP (ffi_cif *cif, void *rvalue, char *stack,
if (tregp + z <= eo_regp || !stack_used)
{
/* Because we're little endian, this is what it turns into. */
#ifdef __ARMEB__
if (z < 4 && ty->type != FFI_TYPE_STRUCT && ty->type != FFI_TYPE_COMPLEX)
avalue[i] = (void *) (tregp + 4 - z);
else
#endif
avalue[i] = (void *) tregp;
regp = tregp + z;
@@ -537,6 +559,11 @@ ffi_prep_incoming_args_VFP (ffi_cif *cif, void *rvalue, char *stack,
stack_used = 1;
argp = ffi_align (ty, argp);
#ifdef __ARMEB__
if (z < 4 && ty->type != FFI_TYPE_STRUCT && ty->type != FFI_TYPE_COMPLEX)
avalue[i] = (void *) (argp + 4 - z);
else
#endif
avalue[i] = (void *) argp;
argp += z;
}
+43 -14
View File
@@ -65,6 +65,7 @@ ffi_closure_alloc (size_t size, void **code)
static size_t page_size;
size_t rounded_size;
void *codeseg, *dataseg;
long ps;
int prot;
/* Expect that PAX mprotect is active and a separate code mapping is necessary. */
@@ -73,7 +74,12 @@ ffi_closure_alloc (size_t size, void **code)
/* Obtain system page size. */
if (!page_size)
page_size = sysconf(_SC_PAGESIZE);
{
ps = sysconf(_SC_PAGESIZE);
if (ps <= 0)
return NULL;
page_size = (size_t) ps;
}
/* Round allocation size up to the next page, keeping in mind the size field and pointer to code map. */
rounded_size = (size + overhead + page_size - 1) & ~(page_size - 1);
@@ -256,12 +262,23 @@ ffi_trampoline_table_alloc (void)
/* We have valid trampoline and config pages */
table = calloc (1, sizeof (ffi_trampoline_table));
if (table == NULL)
{
vm_deallocate (mach_task_self (), config_page, PAGE_MAX_SIZE * 2);
return NULL;
}
table->free_count = FFI_TRAMPOLINE_COUNT;
table->config_page = config_page;
/* Create and initialize the free list */
table->free_list_pool =
calloc (FFI_TRAMPOLINE_COUNT, sizeof (ffi_trampoline_table_entry));
if (table->free_list_pool == NULL)
{
vm_deallocate (mach_task_self (), config_page, PAGE_MAX_SIZE * 2);
free (table);
return NULL;
}
for (i = 0; i < table->free_count; i++)
{
@@ -370,7 +387,13 @@ ffi_closure_free (void *ptr)
}
else if (ffi_trampoline_tables != table)
{
/* Otherwise, bump this table to the top of the list */
/* Otherwise, bump this table to the top of the list. Unlink it
from its current position first, so the old neighbours do not
keep pointing at it and corrupt the list (CWE-416). */
if (table->prev != NULL)
table->prev->next = table->next;
if (table->next != NULL)
table->next->prev = table->prev;
table->prev = NULL;
table->next = ffi_trampoline_tables;
if (ffi_trampoline_tables != NULL)
@@ -546,13 +569,18 @@ static void *dlmalloc(size_t);
static void dlfree(void*);
static void *dlcalloc(size_t, size_t) MAYBE_UNUSED;
static void *dlrealloc(void *, size_t) MAYBE_UNUSED;
static void *dlrealloc_in_place(void *, size_t) MAYBE_UNUSED;
static void *dlmemalign(size_t, size_t) MAYBE_UNUSED;
static int dlposix_memalign(void **, size_t, size_t) MAYBE_UNUSED;
static void *dlvalloc(size_t) MAYBE_UNUSED;
static int dlmallopt(int, int) MAYBE_UNUSED;
static size_t dlmalloc_footprint(void) MAYBE_UNUSED;
static size_t dlmalloc_max_footprint(void) MAYBE_UNUSED;
static size_t dlmalloc_footprint_limit(void) MAYBE_UNUSED;
static size_t dlmalloc_set_footprint_limit(size_t) MAYBE_UNUSED;
static void** dlindependent_calloc(size_t, size_t, void**) MAYBE_UNUSED;
static void** dlindependent_comalloc(size_t, size_t*, void**) MAYBE_UNUSED;
static size_t dlbulk_free(void**, size_t) MAYBE_UNUSED;
static void *dlpvalloc(size_t) MAYBE_UNUSED;
static int dlmalloc_trim(size_t) MAYBE_UNUSED;
static size_t dlmalloc_usable_size(void*) MAYBE_UNUSED;
@@ -737,12 +765,14 @@ static struct
#endif /* HAVE_MNTENT */
};
#define OPEN_TEMP_EXEC_FILE_OPTS_COUNT \
(sizeof (open_temp_exec_file_opts) / sizeof (*open_temp_exec_file_opts))
/* Current index into open_temp_exec_file_opts. */
static int open_temp_exec_file_opts_idx = 0;
static size_t open_temp_exec_file_opts_idx = 0;
/* Reset a current multi-call func, then advances to the next entry.
If we're at the last, go back to the first and return nonzero,
otherwise return zero. */
Return nonzero after advancing past the last entry. */
static int
open_temp_exec_file_opts_next (void)
{
@@ -750,15 +780,7 @@ open_temp_exec_file_opts_next (void)
open_temp_exec_file_opts[open_temp_exec_file_opts_idx].func (NULL);
open_temp_exec_file_opts_idx++;
if (open_temp_exec_file_opts_idx
== (sizeof (open_temp_exec_file_opts)
/ sizeof (*open_temp_exec_file_opts)))
{
open_temp_exec_file_opts_idx = 0;
return 1;
}
return 0;
return open_temp_exec_file_opts_idx == OPEN_TEMP_EXEC_FILE_OPTS_COUNT;
}
/* Return a file descriptor of a temporary zero-sized file in a
@@ -768,6 +790,9 @@ open_temp_exec_file (void)
{
int fd;
if (open_temp_exec_file_opts_idx == OPEN_TEMP_EXEC_FILE_OPTS_COUNT)
return -1;
do
{
fd = open_temp_exec_file_opts[open_temp_exec_file_opts_idx].func
@@ -800,6 +825,8 @@ allocate_space (int fd, off_t len)
/* Obtain system page size. */
if (!page_size)
page_size = sysconf(_SC_PAGESIZE);
if (page_size <= 0)
return -1;
unsigned char buf[page_size];
memset (buf, 0, page_size);
@@ -849,6 +876,7 @@ dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset)
if (!offset)
{
close (execfd);
execfd = -1;
goto retry_open;
}
if (ftruncate (execfd, offset) != 0)
@@ -861,6 +889,7 @@ dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset)
return MFAIL;
}
else if (!offset
&& open_temp_exec_file_opts_idx < OPEN_TEMP_EXEC_FILE_OPTS_COUNT
&& open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat)
open_temp_exec_file_opts_next ();
+5 -1
View File
@@ -343,10 +343,14 @@ ffi_prep_java_raw_closure_loc (ffi_java_raw_closure* cl,
{
ffi_status status;
/* Pass the closure itself as user_data, not codeloc: with static
trampolines codeloc points into the read-only trampoline code table,
so ffi_java_translate_args would read cl->fun/cl->user_data from the
wrong memory and make a wild indirect call (GHSA-w6j9-w53f-2857). */
status = ffi_prep_closure_loc ((ffi_closure*) cl,
cif,
&ffi_java_translate_args,
codeloc,
cl,
codeloc);
if (status == FFI_OK)
{
+18 -7
View File
@@ -92,6 +92,9 @@ typedef struct float_struct_info
char type2;
} float_struct_info;
#define IS_AGGREGATE(type) \
((type) == FFI_TYPE_STRUCT || (type) == FFI_TYPE_COMPLEX)
#if ABI_FRLEN >= 64
# define IS_FLOAT(type) ((type) >= FFI_TYPE_FLOAT && (type) <= FFI_TYPE_DOUBLE)
#else
@@ -105,7 +108,15 @@ flatten_struct (ffi_type *in, ffi_type **out, ffi_type **out_end)
if (out == out_end)
return out;
if (in->type != FFI_TYPE_STRUCT)
if (in->type == FFI_TYPE_COMPLEX)
{
/* The psABI passes a complex number like a struct of two reals. */
*(out++) = in->elements[0];
if (out == out_end)
return out;
*(out++) = in->elements[0];
}
else if (in->type != FFI_TYPE_STRUCT)
*(out++) = in;
else
for (i = 0; in->elements[i]; i++)
@@ -113,9 +124,9 @@ flatten_struct (ffi_type *in, ffi_type **out, ffi_type **out_end)
return out;
}
/* Structs with at most two fields after flattening, one of which is of
floating point type, are passed in multiple registers if sufficient
registers are available. */
/* Structs and complex numbers with at most two fields after flattening,
one of which is of floating point type, are passed in multiple registers
if sufficient registers are available. */
static float_struct_info
struct_passed_as_elements (call_builder *cb, ffi_type *top)
{
@@ -278,7 +289,7 @@ marshal (call_builder *cb, ffi_type *type, int var, void *data)
size_t realign[2];
#if ABI_FRLEN
if (!var && type->type == FFI_TYPE_STRUCT)
if (!var && IS_AGGREGATE (type->type))
{
float_struct_info fsi = struct_passed_as_elements (cb, type);
if (fsi.as_elements)
@@ -347,7 +358,7 @@ unmarshal (call_builder *cb, ffi_type *type, int var, void *data)
void *pointer;
#if ABI_FRLEN
if (!var && type->type == FFI_TYPE_STRUCT)
if (!var && IS_AGGREGATE (type->type))
{
float_struct_info fsi = struct_passed_as_elements (cb, type);
if (fsi.as_elements)
@@ -413,7 +424,7 @@ static int
passed_by_ref (call_builder *cb, ffi_type *type, int var)
{
#if ABI_FRLEN
if (!var && type->type == FFI_TYPE_STRUCT)
if (!var && IS_AGGREGATE (type->type))
{
float_struct_info fsi = struct_passed_as_elements (cb, type);
if (fsi.as_elements)
+1
View File
@@ -83,6 +83,7 @@ typedef enum ffi_abi
#endif /* LIBFFI_ASM */
#define FFI_TARGET_HAS_INT128
#define FFI_TARGET_HAS_COMPLEX_TYPE
/* ---- Definitions for closures ----------------------------------------- */
+1 -1
View File
@@ -65,7 +65,7 @@
setl [A0StP++], D0Ar2, D1Ar1
.endm
! Save retrun, frame pointer and other regs
! Save return, frame pointer and other regs
.macro SAVE_REGS regs=
.text
.balign 4
+79 -6
View File
@@ -402,7 +402,7 @@ static ffi_status ffi_prep_cif_machdep_int(ffi_cif *cif, unsigned nfixedargs)
* does not have special handling for floating point args.
*/
if (cif->rtype->type != FFI_TYPE_STRUCT && cif->rtype->type != FFI_TYPE_COMPLEX && cif->abi == FFI_O32)
if (cif->rtype->type != FFI_TYPE_STRUCT && cif->abi == FFI_O32)
{
if (cif->nargs > 0 && cif->nargs == nfixedargs)
{
@@ -455,6 +455,24 @@ static ffi_status ffi_prep_cif_machdep_int(ffi_cif *cif, unsigned nfixedargs)
cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 2);
break;
case FFI_TYPE_COMPLEX:
/* Complex values are returned in GPRs like integer complex
values of the same size. */
cif->flags += FFI_TYPE_COMPLEX << (FFI_FLAG_BITS * 2);
switch (cif->rtype->elements[0]->type)
{
case FFI_TYPE_FLOAT:
cif->flags += FFI_TYPE_UINT32 << (FFI_FLAG_BITS * 4);
break;
case FFI_TYPE_DOUBLE:
cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 4);
break;
default:
cif->flags += cif->rtype->elements[0]->type << (FFI_FLAG_BITS * 4);
break;
}
break;
case FFI_TYPE_FLOAT:
default:
cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 2);
@@ -798,6 +816,18 @@ void ffi_call_int(ffi_cif *cif, void (*fn)(void), void *rvalue,
rvalue_copy = alloca(16);
copy_rvalue = 1;
}
else if (cif->rtype->type == FFI_TYPE_COMPLEX && cif->rtype->size < 16)
{
/* The assembly stores complex GPR returns in 8-byte chunks.
Bounce them through a suitably sized and aligned buffer so a
smaller user result cannot be overrun. */
rvalue_copy = alloca (16);
copy_rvalue = 1;
#if defined(__MIPSEB__) || defined(_MIPSEB)
if (cif->rtype->size < 8)
copy_offset = 8 - cif->rtype->size;
#endif
}
else if (cif->rtype->type == FFI_TYPE_FLOAT
&& (cif->abi == FFI_N64_SOFT_FLOAT
|| cif->abi == FFI_N32_SOFT_FLOAT))
@@ -978,11 +1008,19 @@ ffi_closure_mips_inner_O32 (ffi_cif *cif,
argn = 1;
seen_int = 1;
}
if ((cif->flags >> (FFI_FLAG_BITS * 2)) == FFI_TYPE_COMPLEX)
if (cif->rtype->type == FFI_TYPE_COMPLEX
&& (cif->rtype->elements[0]->type == FFI_TYPE_FLOAT
|| cif->rtype->elements[0]->type == FFI_TYPE_DOUBLE
|| cif->rtype->elements[0]->type == FFI_TYPE_LONGDOUBLE))
{
rvalue = fpr;
argn = 1;
}
/* With soft float, complex values are returned in up to four GPRs,
which does not fit into the space for v0 and v1. ffi_closure_O32
does not use the space for the FP argument registers in that case,
so return the value there. */
if (cif->abi == FFI_O32_SOFT_FLOAT && cif->rtype->type == FFI_TYPE_COMPLEX)
rvalue = fpr;
i = 0;
avn = cif->nargs;
@@ -1041,6 +1079,15 @@ ffi_closure_mips_inner_O32 (ffi_cif *cif,
/* Invoke the closure. */
fun(cif, rvalue, avaluep, user_data);
if (cif->rtype->type == FFI_TYPE_COMPLEX && cif->rtype->size == 2)
{
/* A _Complex char is returned right-justified in v0. */
UINT16 value;
memcpy (&value, rvalue, sizeof (value));
*(UINT32 *) rvalue = value;
}
if (cif->abi == FFI_O32_SOFT_FLOAT)
{
switch (cif->rtype->type)
@@ -1049,15 +1096,18 @@ ffi_closure_mips_inner_O32 (ffi_cif *cif,
return FFI_TYPE_INT;
case FFI_TYPE_DOUBLE:
return FFI_TYPE_UINT64;
case FFI_TYPE_COMPLEX:
return (FFI_TYPE_COMPLEX
| (cif->rtype->size << (FFI_FLAG_BITS * 2)));
default:
return cif->rtype->type;
}
}
else
{
if (cif->rtype->type == FFI_TYPE_COMPLEX) {
__asm__ volatile ("move $v1, %0" : : "r"(cif->rtype->size));
}
if (cif->rtype->type == FFI_TYPE_COMPLEX)
return (FFI_TYPE_COMPLEX
| (cif->rtype->size << (FFI_FLAG_BITS * 2)));
return cif->rtype->type;
}
}
@@ -1271,6 +1321,29 @@ ffi_closure_mips_inner_N32 (ffi_cif *cif,
/* Invoke the closure. */
fun (cif, rvalue, avaluep, user_data);
#if defined(__MIPSEB__) || defined(_MIPSEB)
/* ffi_closure_N32 loads a 32-bit integer return value from the end of
an ffi_arg on big-endian. A float with soft float and a pointer on
N32 are returned the same way, but the closure stores them at the
start, so widen them. */
if ((cif->rtype->type == FFI_TYPE_FLOAT && soft_float)
#if _MIPS_SIM == _ABIN32
|| cif->rtype->type == FFI_TYPE_POINTER
#endif
)
*(ffi_arg *) rvalue = (SINT32) *(UINT32 *) rvalue;
/* Complex values smaller than 8 bytes are returned right-justified in
v0, which ffi_closure_N32 loads as a whole. */
if (cif->rtype->type == FFI_TYPE_COMPLEX && cif->rtype->size < 8)
{
size_t size = cif->rtype->size;
memmove ((char *) rvalue + 8 - size, rvalue, size);
memset (rvalue, 0, 8 - size);
}
#endif
return cif->flags >> (FFI_FLAG_BITS * 8);
}
+73 -11
View File
@@ -27,6 +27,7 @@
#define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h>
#include <ffi_cfi.h>
/* Only build this code if we are compiling for n32 */
@@ -56,6 +57,7 @@
.ent ffi_call_N32
ffi_call_N32:
.LFB0:
cfi_startproc
.frame $fp, SIZEOF_FRAME, ra
.mask 0xc0000000,-FFI_SIZEOF_ARG
.fmask 0x00000000,0
@@ -63,11 +65,15 @@ ffi_call_N32:
# Prologue
SUBU $sp, SIZEOF_FRAME # Frame size
.LCFI00:
cfi_def_cfa_offset(SIZEOF_FRAME)
REG_S $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp) # Save frame pointer
REG_S ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp) # Save return address
.LCFI01:
cfi_offset($fp, -2*FFI_SIZEOF_ARG)
cfi_offset(ra, -1*FFI_SIZEOF_ARG)
move $fp, $sp
.LCFI02:
cfi_def_cfa_register($fp)
move t9, callback # callback function pointer
REG_S bytes, 2*FFI_SIZEOF_ARG($fp) # bytes
REG_S flags, 3*FFI_SIZEOF_ARG($fp) # flags
@@ -396,7 +402,7 @@ retstruct_f_f_soft:
jal t9
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
sw v0, 0(t4)
sw v1, 4(t4)
sw a0, 4(t4)
b epilogue
retstruct_d_f_soft:
@@ -404,7 +410,7 @@ retstruct_d_f_soft:
jal t9
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
sd v0, 0(t4)
sw v1, 8(t4)
sw a0, 8(t4)
b epilogue
retstruct_f_d_soft:
@@ -466,6 +472,7 @@ epilogue:
j ra
.LFE0:
cfi_endproc
.end ffi_call_N32
/* ffi_closure_N32. Expects address of the passed-in ffi_closure in t0
@@ -521,6 +528,14 @@ epilogue:
#define V1_OFF2 (3 * FFI_SIZEOF_ARG)
#define V0_OFF2 (2 * FFI_SIZEOF_ARG)
/* Integer return values narrower than ffi_arg are stored widened to an
ffi_arg, so on big-endian their bytes are at its end. */
#if defined(__MIPSEB__) || defined(_MIPSEB)
#define V0_OFF2_N(n) (V0_OFF2 + FFI_SIZEOF_ARG - (n))
#else
#define V0_OFF2_N(n) V0_OFF2
#endif
#define RA_OFF2 (1 * FFI_SIZEOF_ARG)
#define GP_OFF2 (0 * FFI_SIZEOF_ARG)
@@ -529,14 +544,18 @@ epilogue:
.ent ffi_go_closure_N32
ffi_go_closure_N32:
.LFB1:
cfi_startproc
.frame $sp, SIZEOF_FRAME2, ra
.mask 0x90000000,-(SIZEOF_FRAME2 - RA_OFF2)
.fmask 0x00000000,0
SUBU $sp, SIZEOF_FRAME2
.LCFI10:
cfi_def_cfa_offset(SIZEOF_FRAME2)
.cpsetup t9, GP_OFF2, ffi_go_closure_N32
REG_S ra, RA_OFF2($sp) # Save return address
.LCFI11:
cfi_offset($gp, GP_OFF2 - SIZEOF_FRAME2)
cfi_offset(ra, RA_OFF2 - SIZEOF_FRAME2)
REG_S a0, A0_OFF2($sp)
REG_S a1, A1_OFF2($sp)
@@ -562,6 +581,7 @@ ffi_go_closure_N32:
b $do_closure
.LFE1:
cfi_endproc
.end ffi_go_closure_N32
.align 2
@@ -569,14 +589,18 @@ ffi_go_closure_N32:
.ent ffi_closure_N32
ffi_closure_N32:
.LFB2:
cfi_startproc
.frame $sp, SIZEOF_FRAME2, ra
.mask 0x90000000,-(SIZEOF_FRAME2 - RA_OFF2)
.fmask 0x00000000,0
SUBU $sp, SIZEOF_FRAME2
.LCFI20:
cfi_def_cfa_offset(SIZEOF_FRAME2)
.cpsetup t9, GP_OFF2, ffi_closure_N32
REG_S ra, RA_OFF2($sp) # Save return address
.LCFI21:
cfi_offset($gp, GP_OFF2 - SIZEOF_FRAME2)
cfi_offset(ra, RA_OFF2 - SIZEOF_FRAME2)
REG_S a0, A0_OFF2($sp)
REG_S a1, A1_OFF2($sp)
REG_S a2, A2_OFF2($sp)
@@ -628,27 +652,27 @@ cls_retuint64:
cls_retsint32:
bne v0, FFI_TYPE_SINT32, cls_retsint16
lw v0, V0_OFF2($sp)
lw v0, V0_OFF2_N(4)($sp)
b cls_epilogue
cls_retsint16:
bne v0, FFI_TYPE_SINT16, cls_retuint16
lh v0, V0_OFF2($sp)
lh v0, V0_OFF2_N(2)($sp)
b cls_epilogue
cls_retuint16:
bne v0, FFI_TYPE_UINT16, cls_retsint8
lhu v0, V0_OFF2($sp)
lhu v0, V0_OFF2_N(2)($sp)
b cls_epilogue
cls_retsint8:
bne v0, FFI_TYPE_SINT8, cls_retuint8
lb v0, V0_OFF2($sp)
lb v0, V0_OFF2_N(1)($sp)
b cls_epilogue
cls_retuint8:
bne v0, FFI_TYPE_UINT8, cls_retfloat
lbu v0, V0_OFF2($sp)
lbu v0, V0_OFF2_N(1)($sp)
b cls_epilogue
cls_retfloat:
@@ -703,18 +727,55 @@ cls_retstruct_d_f:
b cls_epilogue
cls_retstruct_f_d:
bne v0, FFI_TYPE_STRUCT_FD, cls_retcomplex_ld_ld
bne v0, FFI_TYPE_STRUCT_FD, cls_retstruct_f_soft
l.s $f0, V0_OFF2($sp)
l.d $f2, V1_OFF2($sp)
b cls_epilogue
#else
cls_longdouble_soft:
bne v0, FFI_TYPE_LONGDOUBLE, cls_retcomplex_ld_ld
bne v0, FFI_TYPE_LONGDOUBLE, cls_retstruct_f_soft
REG_L v0, V0_OFF2($sp)
REG_L a0, V1_OFF2($sp) # not typo, it is a0, I have no idea, gcc does do it
b cls_epilogue
#endif
# With soft float, a struct of one or two floating-point fields is
# returned with the first field in v0 and the second in a0, each
# like a scalar of its type.
cls_retstruct_f_soft:
bne v0, FFI_TYPE_STRUCT_F_SOFT, cls_retstruct_d_soft
lw v0, V0_OFF2($sp)
b cls_epilogue
cls_retstruct_d_soft:
bne v0, FFI_TYPE_STRUCT_D_SOFT, cls_retstruct_f_f_soft
ld v0, V0_OFF2($sp)
b cls_epilogue
cls_retstruct_f_f_soft:
bne v0, FFI_TYPE_STRUCT_FF_SOFT, cls_retstruct_d_d_soft
lw v0, V0_OFF2($sp)
lw a0, (V0_OFF2+4)($sp)
b cls_epilogue
cls_retstruct_d_d_soft:
bne v0, FFI_TYPE_STRUCT_DD_SOFT, cls_retstruct_f_d_soft
ld v0, V0_OFF2($sp)
ld a0, (V0_OFF2+8)($sp)
b cls_epilogue
cls_retstruct_f_d_soft:
bne v0, FFI_TYPE_STRUCT_FD_SOFT, cls_retstruct_d_f_soft
lw v0, V0_OFF2($sp)
ld a0, (V0_OFF2+8)($sp)
b cls_epilogue
cls_retstruct_d_f_soft:
bne v0, FFI_TYPE_STRUCT_DF_SOFT, cls_retcomplex_ld_ld
ld v0, V0_OFF2($sp)
lw a0, (V0_OFF2+8)($sp)
b cls_epilogue
cls_retcomplex_ld_ld:
bne v0, FFI_TYPE_COMPLEX_LDLD, cls_retstruct_small2
REG_L t8, A0_OFF2($sp)
@@ -739,9 +800,10 @@ cls_epilogue:
ADDU $sp, SIZEOF_FRAME2
j ra
.LFE2:
cfi_endproc
.end ffi_closure_N32
#ifdef __GNUC__
#if defined(__GNUC__) && !defined(HAVE_AS_CFI_PSEUDO_OP)
.section .eh_frame,EH_FRAME_FLAGS,@progbits
.Lframe1:
.4byte .LECIE1-.LSCIE1 # length
@@ -818,7 +880,7 @@ cls_epilogue:
.uleb128 (SIZEOF_FRAME2 - RA_OFF2)/4
.align EH_FRAME_ALIGN
.LEFDE2:
#endif /* __GNUC__ */
#endif /* __GNUC__ && !HAVE_AS_CFI_PSEUDO_OP */
#endif
+40 -5
View File
@@ -224,7 +224,24 @@ retcomplex:
b epilogue
5:
# Integer complex values: a _Complex char is returned right-justified
# in v0, a _Complex short in v0, a _Complex int in v0/v1 and a
# _Complex long long in v0/v1/a0/a1.
slti t3, t1, FFI_TYPE_UINT16
bnez t3, 6f
slti t3, t1, FFI_TYPE_UINT32
bnez t3, 7f
REG_S v1, 4(t0)
REG_S v0, 0(t0)
slti t3, t1, FFI_TYPE_UINT64
bnez t3, epilogue
REG_S a1, 12(t0)
REG_S a0, 8(t0)
b epilogue
6:
sh v0, 0(t0)
b epilogue
7:
REG_S v0, 0(t0)
b epilogue
@@ -408,11 +425,13 @@ $do_closure:
# Load the return value into the appropriate register.
move $8, $2
SRL $3, $8, (FFI_FLAG_BITS * 2)
and $8, ((1 << (FFI_FLAG_BITS * 2)) - 1)
li $9, FFI_TYPE_VOID
beq $8, $9, closure_done
li $13, 1 # FFI_O32
bne $16, $13, 1f # Skip fp restore if FFI_O32_SOFT_FLOAT
bne $16, $13, 2f # Skip fp restore if FFI_O32_SOFT_FLOAT
#ifndef __mips_soft_float
li $9, FFI_TYPE_FLOAT
@@ -427,15 +446,31 @@ $do_closure:
bne $8, $9, 1f
li $9, 8
l.s $f0, V0_OFF2($fp)
l.s $f2, V1_OFF2($fp)
REG_L $2, FA_0_0_OFF2($fp)
mtc1 $2, $f0
REG_L $2, FA_0_1_OFF2($fp)
mtc1 $2, $f2
beq $3, $9, closure_done
li $9, 16
l.d $f0, V0_OFF2($fp)
l.d $f2, (V0_OFF2+8)($fp)
l.d $f0, FA_0_0_OFF2($fp)
l.d $f2, FA_1_0_OFF2($fp)
beq $3, $9, closure_done
#endif
b 1f
2:
# FFI_O32_SOFT_FLOAT returns complex values in up to four GPRs.
# ffi_closure_mips_inner_O32 stored them in the space for the
# FP argument registers.
li $9, FFI_TYPE_COMPLEX
bne $8, $9, 1f
REG_L $2, FA_0_0_OFF2($fp)
REG_L $3, FA_0_1_OFF2($fp)
REG_L $4, FA_1_0_OFF2($fp)
REG_L $5, FA_1_1_OFF2($fp)
b closure_done
1:
REG_L $3, V1_OFF2($fp)
REG_L $2, V0_OFF2($fp)
+1 -1
View File
@@ -114,7 +114,7 @@ ffi_call_int (ffi_cif *cif,
if (rvalue && ecif.rvalue == smst_buffer)
{
unsigned int rsize = cif->rtype->size;
#ifdef FFI_TARGET_HAS_COMPLEX_TYPE
#if defined (FFI_TARGET_HAS_COMPLEX_TYPE) && defined (POWERPC64)
/* Integer-typed _Complex: the .Lsmall_struct return path stored
r3 at buffer offset 0 and r4 at offset 8. Extract one inner-
sized half from each slot — right-justified on BE, low-address
+28 -3
View File
@@ -61,6 +61,17 @@ ffi_prep_types_linux64 (ffi_abi abi)
ffi_type_longdouble.size = 16;
ffi_type_longdouble.alignment = 16;
}
#ifdef FFI_TARGET_HAS_COMPLEX_TYPE
/* _Complex long double is two halves of whatever long double just became.
Its size comes from sizeof(_Complex long double) at build time, which is
only right for the ABI libffi itself was built for, so keep it in step.
Leaving it behind makes the type disagree with its own element: a caller
that asks for the other long double width would get a return value copied
at cif->rtype->size (wrong by 16 bytes either way) and structs containing
the type laid out to the build-time size. */
ffi_type_complex_longdouble.size = 2 * ffi_type_longdouble.size;
ffi_type_complex_longdouble.alignment = ffi_type_longdouble.alignment;
#endif
}
#endif
@@ -393,6 +404,12 @@ homogeneous:
under ELFv2, and is what differentiates _Complex from a
same-sized struct{T;T;} which uses fewer GPR shadow slots. */
elt = (*ptr)->elements[0]->type;
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
/* A 64-bit long double is passed exactly like a double. */
if (elt == FFI_TYPE_LONGDOUBLE
&& (cif->abi & FFI_LINUX_LONG_DOUBLE_128) == 0)
elt = FFI_TYPE_DOUBLE;
#endif
switch (elt)
{
case FFI_TYPE_FLOAT:
@@ -776,6 +793,10 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
case FFI_TYPE_COMPLEX:
elt = (*ptr)->elements[0]->type;
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
/* A 64-bit long double is passed exactly like a double. */
if (elt == FFI_TYPE_LONGDOUBLE
&& (ecif->cif->abi & FFI_LINUX_LONG_DOUBLE_128) == 0)
elt = FFI_TYPE_DOUBLE;
if (elt == FFI_TYPE_LONGDOUBLE
&& (ecif->cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
{
@@ -1398,6 +1419,10 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
unsigned int j;
elt = arg_types[i]->elements[0]->type;
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
/* A 64-bit long double arrives exactly like a double. */
if (elt == FFI_TYPE_LONGDOUBLE
&& (cif->abi & FFI_LINUX_LONG_DOUBLE_128) == 0)
elt = FFI_TYPE_DOUBLE;
if (elt == FFI_TYPE_LONGDOUBLE
&& (cif->abi & FFI_LINUX_LONG_DOUBLE_IEEE128) != 0)
{
@@ -1624,13 +1649,13 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
case 0:
return PPC_LD_NONE;
case 1:
return PPC_LD_U8;
return PPC64_LD_STRUCT_1;
case 2:
return PPC_LD_U16;
return PPC64_LD_STRUCT_2;
case 3:
return PPC64_LD_STRUCT_3;
case 4:
return PPC_LD_U32;
return PPC64_LD_STRUCT_4;
case 5:
return PPC64_LD_STRUCT_5;
case 6:
+18 -4
View File
@@ -54,17 +54,24 @@
/* Needed for soft-float long-double. */
#define PPC32_LD_R3R6 10
/* Needed for _Complex long double with a 128-bit long double. */
#define PPC32_LD_R3R10 11
/* Needed for FFI_SYSV small structure returns. */
#ifdef __LITTLE_ENDIAN__
#define PPC32_SYSV_LD_STRUCT_3 PPC32_LD_R3
#define PPC32_SYSV_LD_STRUCT_5 PPC32_LD_R3R4
#define PPC32_SYSV_LD_STRUCT_6 PPC32_LD_R3R4
#define PPC32_SYSV_LD_STRUCT_7 PPC32_LD_R3R4
#define PPC32_SYSV_LD_STRUCT_1 PPC_LD_U8
#define PPC32_SYSV_LD_STRUCT_2 PPC_LD_U16
#else
#define PPC32_SYSV_LD_STRUCT_3 11
#define PPC32_SYSV_LD_STRUCT_5 12
#define PPC32_SYSV_LD_STRUCT_6 13
#define PPC32_SYSV_LD_STRUCT_7 14
#define PPC32_SYSV_LD_STRUCT_3 12
#define PPC32_SYSV_LD_STRUCT_5 13
#define PPC32_SYSV_LD_STRUCT_6 14
#define PPC32_SYSV_LD_STRUCT_7 15
#define PPC32_SYSV_LD_STRUCT_1 16
#define PPC32_SYSV_LD_STRUCT_2 17
#endif
#else /* POWERPC64 */
@@ -84,11 +91,17 @@
#define PPC64_LD_STRUCT_5 PPC_LD_I64
#define PPC64_LD_STRUCT_6 PPC_LD_I64
#define PPC64_LD_STRUCT_7 PPC_LD_I64
#define PPC64_LD_STRUCT_1 PPC_LD_U8
#define PPC64_LD_STRUCT_2 PPC_LD_U16
#define PPC64_LD_STRUCT_4 PPC_LD_U32
#else
#define PPC64_LD_STRUCT_3 16
#define PPC64_LD_STRUCT_5 17
#define PPC64_LD_STRUCT_6 18
#define PPC64_LD_STRUCT_7 19
#define PPC64_LD_STRUCT_1 20
#define PPC64_LD_STRUCT_2 21
#define PPC64_LD_STRUCT_4 22
#endif
#endif /* POWERPC64 */
@@ -106,6 +119,7 @@ enum {
/* These go in cr6 */
FLAG_RETURNS_64BITS = 1 << (31-27),
FLAG_RETURNS_128BITS = 1 << (31-26),
FLAG_RETURNS_256BITS = 1 << (31-25), /* Used by sysv code */
FLAG_COMPAT = 1 << (31- 8), /* Not used by assembly */
+100 -29
View File
@@ -42,6 +42,10 @@
#define NUM_GPR_ARG_REGISTERS 8
#define NUM_FPR_ARG_REGISTERS 8
/* Internal type for an eight-word complex value, i.e. _Complex long double
with a 128-bit long double. */
#define FFI_TYPE_UINT256 (FFI_TYPE_LAST + 1)
#if HAVE_LONG_DOUBLE_VARIANT && FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
/* Adjust size of ffi_type_longdouble. */
@@ -58,6 +62,12 @@ ffi_prep_types_sysv (ffi_abi abi)
ffi_type_longdouble.size = 16;
ffi_type_longdouble.alignment = 16;
}
#ifdef FFI_TARGET_HAS_COMPLEX_TYPE
/* _Complex long double is two halves of whatever long double just
became, so keep its size and alignment in step. */
ffi_type_complex_longdouble.size = 2 * ffi_type_longdouble.size;
ffi_type_complex_longdouble.alignment = ffi_type_longdouble.alignment;
#endif
}
#endif
@@ -89,6 +99,39 @@ translate_float (int abi, int type)
return type;
}
/* Transform a type to the type that is passed and returned the same way.
Complex values always go in GPRs, never in FPRs, even with hard float:
GCC does not split them for this ABI but passes each one as a single
item of as many words as it needs, just like an integer of that size. */
static int
translate_type (int abi, const ffi_type *t)
{
if (t->type != FFI_TYPE_COMPLEX)
return translate_float (abi, t->type);
switch (t->size)
{
case 2:
/* _Complex char. */
return FFI_TYPE_UINT16;
case 4:
/* _Complex short. */
return FFI_TYPE_UINT32;
case 8:
/* float and int _Complex: two words, like long long. */
return FFI_TYPE_UINT64;
case 16:
/* double, long long and 64-bit long double _Complex. */
return FFI_TYPE_UINT128;
case 32:
/* 128-bit long double _Complex. */
return FFI_TYPE_UINT256;
default:
FFI_ASSERT (0);
return FFI_TYPE_STRUCT;
}
}
/* Perform machine dependent cif processing */
static ffi_status
ffi_prep_cif_sysv_core (ffi_cif *cif)
@@ -121,7 +164,7 @@ ffi_prep_cif_sysv_core (ffi_cif *cif)
- long doubles (if not equivalent to double) are returned in
fpr1,fpr2 for Linux and as for large structs for SysV. */
type = translate_float (cif->abi, type);
type = translate_type (cif->abi, cif->rtype);
switch (type)
{
@@ -140,6 +183,9 @@ ffi_prep_cif_sysv_core (ffi_cif *cif)
#endif
break;
case FFI_TYPE_UINT256:
flags |= FLAG_RETURNS_256BITS;
/* Fall through. */
case FFI_TYPE_UINT128:
flags |= FLAG_RETURNS_128BITS;
/* Fall through. */
@@ -148,6 +194,13 @@ ffi_prep_cif_sysv_core (ffi_cif *cif)
flags |= FLAG_RETURNS_64BITS;
break;
case FFI_TYPE_UINT16:
/* A _Complex char is returned right-justified in r3, like a small
struct. Use the small struct bounce buffer to extract it. */
if (cif->rtype->type == FFI_TYPE_COMPLEX)
flags |= FLAG_RETURNS_SMST;
break;
case FFI_TYPE_STRUCT:
/* The final SYSV ABI says that structures smaller or equal 8 bytes
are returned in r3/r4. A draft ABI used by linux instead
@@ -176,9 +229,8 @@ ffi_prep_cif_sysv_core (ffi_cif *cif)
Stuff on the stack needs to keep proper alignment. */
for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++)
{
unsigned short typenum = (*ptr)->type;
typenum = translate_float (cif->abi, typenum);
unsigned short typenum = translate_type (cif->abi, *ptr);
unsigned nwords;
switch (typenum)
{
@@ -224,16 +276,19 @@ ffi_prep_cif_sysv_core (ffi_cif *cif)
#endif
break;
case FFI_TYPE_UINT256:
case FFI_TYPE_UINT128:
/* A long double in FFI_LINUX_SOFT_FLOAT can use only a set
of four consecutive gprs. If we do not have enough, we
have to adjust the gpr_count value. */
if (gpr_count >= NUM_GPR_ARG_REGISTERS - 3)
have to adjust the gpr_count value. Complex values of four
or eight words are passed the same way. */
nwords = typenum == FFI_TYPE_UINT256 ? 8 : 4;
if (gpr_count > NUM_GPR_ARG_REGISTERS - nwords)
gpr_count = NUM_GPR_ARG_REGISTERS;
if (gpr_count >= NUM_GPR_ARG_REGISTERS)
stack_count += 4;
stack_count += nwords;
else
gpr_count += 4;
gpr_count += nwords;
break;
case FFI_TYPE_UINT64:
@@ -458,9 +513,8 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
i > 0;
i--, ptr++, p_argv.v++)
{
unsigned int typenum = (*ptr)->type;
typenum = translate_float (ecif->cif->abi, typenum);
unsigned int typenum = translate_type (ecif->cif->abi, *ptr);
unsigned int ii, nwords;
/* Now test the translated value */
switch (typenum)
@@ -518,16 +572,18 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
break;
#endif /* have FPRs */
case FFI_TYPE_UINT256:
case FFI_TYPE_UINT128:
/* The soft float ABI for long doubles works like this, a long double
is passed in four consecutive GPRs if available. A maximum of 2
long doubles can be passed in gprs. If we do not have 4 GPRs
left, the long double is passed on the stack, 4-byte aligned. */
if (gpr_base.u >= gpr_end.u - 3)
left, the long double is passed on the stack, 4-byte aligned.
Complex values of four or eight words are passed the same way. */
nwords = typenum == FFI_TYPE_UINT256 ? 8 : 4;
if (gpr_base.u > gpr_end.u - nwords)
{
unsigned int ii;
gpr_base.u = gpr_end.u;
for (ii = 0; ii < 4; ii++)
for (ii = 0; ii < nwords; ii++)
{
unsigned int int_tmp = (*p_argv.ui)[ii];
*next_arg.u++ = int_tmp;
@@ -535,8 +591,7 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
}
else
{
unsigned int ii;
for (ii = 0; ii < 4; ii++)
for (ii = 0; ii < nwords; ii++)
{
unsigned int int_tmp = (*p_argv.ui)[ii];
*gpr_base.u++ = int_tmp;
@@ -709,7 +764,7 @@ ffi_closure_helper_SYSV (ffi_cif *cif,
avalue = alloca (cif->nargs * sizeof (void *));
/* First translate for softfloat/nonlinux */
rtypenum = translate_float (cif->abi, rtypenum);
rtypenum = translate_type (cif->abi, cif->rtype);
/* Copy the caller's structure return value address so that the closure
returns the data directly to the caller.
@@ -729,10 +784,9 @@ ffi_closure_helper_SYSV (ffi_cif *cif,
/* Grab the addresses of the arguments from the stack frame. */
while (i < avn) {
unsigned short typenum = arg_types[i]->type;
/* We may need to handle some values depending on ABI. */
typenum = translate_float (cif->abi, typenum);
unsigned short typenum = translate_type (cif->abi, arg_types[i]);
long nwords;
switch (typenum)
{
@@ -796,20 +850,23 @@ ffi_closure_helper_SYSV (ffi_cif *cif,
# endif
#endif
case FFI_TYPE_UINT256:
case FFI_TYPE_UINT128:
/* Test if for the whole long double, 4 gprs are available.
otherwise the stuff ends up on the stack. */
if (ng < NUM_GPR_ARG_REGISTERS - 3)
otherwise the stuff ends up on the stack. The same holds
for complex values of four or eight words. */
nwords = typenum == FFI_TYPE_UINT256 ? 8 : 4;
if (ng <= NUM_GPR_ARG_REGISTERS - nwords)
{
avalue[i] = pgr;
pgr += 4;
ng += 4;
pgr += nwords;
ng += nwords;
}
else
{
avalue[i] = pst;
pst += 4;
ng = 8+4;
pst += nwords;
ng = NUM_GPR_ARG_REGISTERS;
}
break;
@@ -940,6 +997,18 @@ ffi_closure_helper_SYSV (ffi_cif *cif,
case FFI_TYPE_SINT8:
return PPC_LD_S8;
case FFI_TYPE_UINT16:
if (cif->rtype->type == FFI_TYPE_COMPLEX)
{
/* A _Complex char is returned right-justified in r3. */
unsigned int word = 0;
#ifdef __LITTLE_ENDIAN__
memcpy (&word, rvalue, 2);
#else
memcpy ((char *) &word + 2, rvalue, 2);
#endif
*(unsigned int *) rvalue = word;
return PPC_LD_U32;
}
return PPC_LD_U16;
case FFI_TYPE_SINT16:
return PPC_LD_S16;
@@ -955,14 +1024,16 @@ ffi_closure_helper_SYSV (ffi_cif *cif,
return PPC_LD_I64;
case FFI_TYPE_UINT128:
return PPC32_LD_R3R6;
case FFI_TYPE_UINT256:
return PPC32_LD_R3R10;
case FFI_TYPE_STRUCT:
if (cif->abi & FFI_SYSV_STRUCT_RET)
switch (size)
{
case 1:
return PPC_LD_U8;
return PPC32_SYSV_LD_STRUCT_1;
case 2:
return PPC_LD_U16;
return PPC32_SYSV_LD_STRUCT_2;
case 3:
return PPC32_SYSV_LD_STRUCT_3;
case 4:
+9 -2
View File
@@ -155,8 +155,15 @@ typedef enum ffi_abi {
ELFv2, float/double _Complex are passed and returned as a 2-element
homogeneous floating-point aggregate, but each scalar half consumes a
GPR shadow slot of its own — i.e. the same way the underlying C ABI
handles them, which is what GCC's split_complex_arg emits. */
#if defined(POWERPC64) && _CALL_ELF == 2
handles them, which is what GCC's split_complex_arg emits.
They are also supported on 32-bit SYSV, where complex values are passed
and returned in GPRs like integers of the same size. */
#if defined(POWERPC64)
# if _CALL_ELF == 2
# define FFI_TARGET_HAS_COMPLEX_TYPE
# endif
#elif defined (POWERPC) || defined (POWERPC_FREEBSD)
# define FFI_TARGET_HAS_COMPLEX_TYPE
#endif
+17 -2
View File
@@ -342,8 +342,8 @@ E PPC64_LD_DOUBLE_HOMOG
#ifndef __LITTLE_ENDIAN__
E PPC64_LD_STRUCT_3
lwz %r3, RETVAL+4(%r1)
srd %r3, %r3, 8
ld %r3, RETVAL+0(%r1)
srdi %r3, %r3, 40
epilogue
E PPC64_LD_STRUCT_5
@@ -360,6 +360,21 @@ E PPC64_LD_STRUCT_7
ld %r3, RETVAL+0(%r1)
srdi %r3, %r3, 8
epilogue
E PPC64_LD_STRUCT_1
ld %r3, RETVAL+0(%r1)
srdi %r3, %r3, 56
epilogue
E PPC64_LD_STRUCT_2
ld %r3, RETVAL+0(%r1)
srdi %r3, %r3, 48
epilogue
E PPC64_LD_STRUCT_4
ld %r3, RETVAL+0(%r1)
srdi %r3, %r3, 32
epilogue
#endif
.Lmoredouble:
+20 -1
View File
@@ -202,10 +202,17 @@ E PPC_LD_S16
epilogue
E PPC32_LD_R3R6
.Lr3r6:
lwz %r5,112+8(%r1)
lwz %r6,112+12(%r1)
b .Lr3r4
E PPC32_LD_R3R10
lwz %r7,112+16(%r1)
lwz %r8,112+20(%r1)
lwz %r9,112+24(%r1)
b .Lr3r10
#ifndef __LITTLE_ENDIAN__
E PPC32_SYSV_LD_STRUCT_3
lwz %r3,112+0(%r1)
@@ -228,7 +235,15 @@ E PPC32_SYSV_LD_STRUCT_7
lwz %r3,112+0(%r1)
lwz %r4,112+4(%r1)
li %r5,8
nop
b .Lstruct567
E PPC32_SYSV_LD_STRUCT_1
lbz %r3,112+0(%r1)
epilogue
E PPC32_SYSV_LD_STRUCT_2
lhz %r3,112+0(%r1)
epilogue
.Lstruct567:
subfic %r6,%r5,32
@@ -239,6 +254,10 @@ E PPC32_SYSV_LD_STRUCT_7
epilogue
#endif
.Lr3r10:
lwz %r10,112+28(%r1)
b .Lr3r6
.cfi_endproc
END(ffi_closure_SYSV)
+5
View File
@@ -116,6 +116,11 @@ ENTRY(ffi_call_SYSV)
bf 26,L(done_return_value)
stw %r5,8(%r30)
stw %r6,12(%r30)
bf 25,L(done_return_value)
stw %r7,16(%r30)
stw %r8,20(%r30)
stw %r9,24(%r30)
stw %r10,28(%r30)
/* Fall through... */
L(done_return_value):
+6 -1
View File
@@ -232,10 +232,15 @@ ffi_prep_raw_closure_loc (ffi_raw_closure* cl,
{
ffi_status status;
/* Pass the closure itself as the user_data that ffi_translate_args
receives, not codeloc. The two aliased before static trampolines, but
with FFI_EXEC_STATIC_TRAMP codeloc points into the read-only trampoline
code table, so reading cl->fun/cl->user_data through it would load
garbage and make a wild indirect call (GHSA-w6j9-w53f-2857). */
status = ffi_prep_closure_loc ((ffi_closure*) cl,
cif,
&ffi_translate_args,
codeloc,
cl,
codeloc);
if (status == FFI_OK)
{
+15 -8
View File
@@ -84,6 +84,8 @@ typedef struct {
char as_elements, type1, offset2, type2;
} float_struct_info;
#define IS_AGGREGATE(type) ((type) == FFI_TYPE_STRUCT || (type) == FFI_TYPE_COMPLEX)
#if ABI_FLEN >= 64
#define IS_FLOAT(type) ((type) >= FFI_TYPE_FLOAT && (type) <= FFI_TYPE_DOUBLE)
#else
@@ -93,7 +95,12 @@ typedef struct {
static ffi_type **flatten_struct(ffi_type *in, ffi_type **out, ffi_type **out_end) {
int i;
if (out == out_end) return out;
if (in->type != FFI_TYPE_STRUCT) {
if (in->type == FFI_TYPE_COMPLEX) {
/* the psABI passes a complex number like a struct of two reals */
*(out++) = in->elements[0];
if (out == out_end) return out;
*(out++) = in->elements[0];
} else if (in->type != FFI_TYPE_STRUCT) {
*(out++) = in;
} else {
for (i = 0; in->elements[i]; i++)
@@ -102,9 +109,9 @@ static ffi_type **flatten_struct(ffi_type *in, ffi_type **out, ffi_type **out_en
return out;
}
/* Structs with at most two fields after flattening, one of which is of
floating point type, are passed in multiple registers if sufficient
registers are available. */
/* Structs and complex numbers with at most two fields after flattening,
one of which is of floating point type, are passed in multiple registers
if sufficient registers are available. */
static float_struct_info struct_passed_as_elements(call_builder *cb, ffi_type *top) {
float_struct_info ret = {0, 0, 0, 0};
ffi_type *fields[3];
@@ -247,7 +254,7 @@ static void marshal(call_builder *cb, ffi_type *type, int var, void *data) {
size_t realign[2];
#if ABI_FLEN
if (!var && type->type == FFI_TYPE_STRUCT) {
if (!var && IS_AGGREGATE(type->type)) {
float_struct_info fsi = struct_passed_as_elements(cb, type);
if (fsi.as_elements) {
marshal_atom(cb, fsi.type1, data);
@@ -295,7 +302,7 @@ static void *unmarshal(call_builder *cb, ffi_type *type, int var, void *data) {
void *pointer;
#if ABI_FLEN
if (!var && type->type == FFI_TYPE_STRUCT) {
if (!var && IS_AGGREGATE(type->type)) {
float_struct_info fsi = struct_passed_as_elements(cb, type);
if (fsi.as_elements) {
unmarshal_atom(cb, fsi.type1, data);
@@ -340,7 +347,7 @@ static void *unmarshal(call_builder *cb, ffi_type *type, int var, void *data) {
static int passed_by_ref(call_builder *cb, ffi_type *type, int var) {
#if ABI_FLEN
if (!var && type->type == FFI_TYPE_STRUCT) {
if (!var && IS_AGGREGATE(type->type)) {
float_struct_info fsi = struct_passed_as_elements(cb, type);
if (fsi.as_elements) return 0;
}
@@ -414,7 +421,7 @@ ffi_call_int (ffi_cif *cif, void (*fn) (void), void *rvalue, void **avalue,
ffi_call_asm ((void *) alloc_base, cb.aregs, fn, closure);
cb.used_float = cb.used_integer = 0;
if (!return_by_ref && rvalue)
if (!return_by_ref && rvalue && cif->rtype->type != FFI_TYPE_VOID)
{
if (IS_INT(cif->rtype->type)
&& cif->rtype->size < sizeof (ffi_arg))
+1
View File
@@ -65,6 +65,7 @@ typedef enum ffi_abi {
#define FFI_EXTRA_CIF_FIELDS unsigned riscv_nfixedargs; unsigned riscv_unused
#define FFI_TARGET_SPECIFIC_VARIADIC
#define FFI_TARGET_HAS_INT128
#define FFI_TARGET_HAS_COMPLEX_TYPE
#endif
+9 -2
View File
@@ -546,9 +546,16 @@ ffi_closure_helper_SYSV (ffi_cif *cif,
#endif
/* Check how a structure type is passed. */
if (type == FFI_TYPE_STRUCT || type == FFI_TYPE_COMPLEX)
if (type == FFI_TYPE_STRUCT || type == FFI_TYPE_COMPLEX
|| type == FFI_TYPE_SINT128 || type == FFI_TYPE_UINT128)
{
if (type == FFI_TYPE_COMPLEX)
if (type == FFI_TYPE_COMPLEX
|| type == FFI_TYPE_SINT128 || type == FFI_TYPE_UINT128)
/* Complex and 128-bit integer types are passed by reference: one
GPR slot holds a pointer to the value. The call side already
does this; without it here the closure left avalue[] for such
an argument uninitialised and shifted every later argument
(GHSA-wf8m-qr3x-cch4). */
type = FFI_TYPE_POINTER;
else
type = ffi_check_struct_type (*ptr);
+25 -2
View File
@@ -135,12 +135,18 @@ ffi_struct_float_merge (int size_mask, void *vi, void *vf)
/* Similar, but place the data into VD in the end. */
void FFI_HIDDEN
ffi_struct_float_copy (int size_mask, void *vd, void *vi, void *vf)
ffi_struct_float_copy (int flags, void *vd, void *vi, void *vf)
{
int size_mask = flags >> SPARC_SIZEMASK_SHIFT;
int size = size_mask & 0xff;
int mask = size_mask >> 8;
int n = size >> 2;
if (flags & SP_V9_FLAG_RET_COMPLEX_SMALL)
{
FFI_ASSERT (mask == 0 && size < 8);
vi = (char *) vi + 8 - size;
}
if (mask == 0)
;
else if (mask == (1 << n) - 1)
@@ -199,6 +205,9 @@ ffi_prep_cif_machdep_core(ffi_cif *cif)
flags = (size_mask << SPARC_SIZEMASK_SHIFT) | SPARC_RET_STRUCT;
if (rtt == FFI_TYPE_COMPLEX && rtype->size < 8 && fp_mask == 0)
flags |= SP_V9_FLAG_RET_COMPLEX_SMALL;
/* For special cases of all-int or all-fp, we can return
the value directly without popping through a struct copy. */
if (fp_mask == 0)
@@ -398,8 +407,17 @@ ffi_prep_args_v9(ffi_cif *cif, unsigned long *argp, void *rvalue, void **avalue)
*argp++ = *(UINT64 *)a;
break;
case FFI_TYPE_LONGDOUBLE:
case FFI_TYPE_COMPLEX:
z = ty->size;
if (z < 8)
{
*argp = 0;
memcpy ((char *) argp + 8 - z, a, z);
argp++;
break;
}
/* FALLTHRU */
case FFI_TYPE_LONGDOUBLE:
case FFI_TYPE_STRUCT:
z = ty->size;
if (z > 16)
@@ -573,6 +591,11 @@ ffi_closure_sparc_inner_v9(ffi_cif *cif,
case FFI_TYPE_COMPLEX:
case FFI_TYPE_STRUCT:
z = ty->size;
if (ty->type == FFI_TYPE_COMPLEX && z < 8)
{
a = (char *) a + 8 - z;
break;
}
if (z > 16)
a = *(void **)a;
else
+1
View File
@@ -22,5 +22,6 @@
#define SPARC_FLAG_RET_MASK 15
#define SPARC_FLAG_RET_IN_MEM 32
#define SPARC_FLAG_FP_ARGS 64
#define SP_V9_FLAG_RET_COMPLEX_SMALL 128 /* v9 only */
#define SPARC_SIZEMASK_SHIFT 8
+31 -5
View File
@@ -186,7 +186,7 @@ E(SPARC_RET_F_1)
std %f6, [%l2+56]
! Copy the structure into place.
srl %l0, SPARC_SIZEMASK_SHIFT, %o0 ! load size_mask
mov %l0, %o0 ! load flags and size_mask
mov %i2, %o1 ! load dst
mov %l2, %o2 ! load src_gp
call C(ffi_struct_float_copy)
@@ -270,6 +270,7 @@ C(ffi_closure_v9):
add %fp, STACK_BIAS+128, %o4
call C(ffi_closure_sparc_inner_v9)
add %fp, STACK_BIAS-128, %o5
mov %o0, %l0 ! preserve full return flags
0: call 1f ! load pc in %o7
and %o0, SPARC_FLAG_RET_MASK, %o0
@@ -287,10 +288,10 @@ E(SPARC_RET_VOID)
return %i7+8
nop
E(SPARC_RET_STRUCT)
ldx [FP-160], %i0
ldd [FP-160], %f0
b 8f
ldx [FP-152], %i1
b .Lclosure_ret_struct
nop
nop
nop
E(SPARC_RET_UINT8)
ldub [FP-160+7], %i0
return %i7+8
@@ -354,6 +355,31 @@ E(SPARC_RET_F_1)
nop
! Finish the SPARC_RET_STRUCT sequence.
! Small integer complex values are scalar-like in the v9 ABI and
! occupy the low end of %i0, unlike small structures.
.align 8
.Lclosure_ret_struct:
andcc %l0, SP_V9_FLAG_RET_COMPLEX_SMALL, %g0
bne,pn %xcc, .Lclosure_ret_complex_small
srl %l0, SPARC_SIZEMASK_SHIFT, %l1
ldx [FP-160], %i0
ldd [FP-160], %f0
b 8f
ldx [FP-152], %i1
.Lclosure_ret_complex_small:
and %l1, 0xff, %l1
cmp %l1, 2
be,pn %xcc, .Lclosure_ret_complex_2
nop
lduw [FP-160], %i0
return %i7+8
nop
.Lclosure_ret_complex_2:
lduh [FP-160], %i0
return %i7+8
nop
.align 8
8: ldd [FP-152], %f2
ldx [FP-144], %i2
+46 -12
View File
@@ -44,12 +44,14 @@
#include <ffi_common.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <fcntl.h>
#include <pthread.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <tramp.h>
#ifdef __linux__
#include <linux/limits.h>
@@ -209,13 +211,14 @@ static int
ffi_tramp_get_libffi (void)
{
FILE *fp;
/* `file' is sized PATH_MAX+1 so a scanf field width of PATH_MAX
(which permits PATH_MAX characters plus the terminating NUL) cannot
overflow. */
/* `line' holds one /proc/<pid>/maps line; its path field can be up to
PATH_MAX bytes. `file' holds the /proc/<pid>/maps path opened first. */
char file[PATH_MAX+1], line[PATH_MAX+100], perm[10], dev[10];
unsigned long start, end, offset, inode;
uintptr_t addr = (uintptr_t) tramp_globals.text;
int nfields, found;
int nfields, found, path_off;
char *path = NULL, *nl;
struct stat st;
int open_flags = O_RDONLY;
#ifdef O_CLOEXEC
@@ -228,33 +231,64 @@ ffi_tramp_get_libffi (void)
return 0;
found = 0;
inode = 0;
while (feof (fp) == 0) {
if (fgets (line, sizeof (line), fp) == 0)
break;
/* Bound the path field width so a long mapping name cannot overflow
the fixed-size `file' buffer. */
nfields = sscanf (line,
"%lx-%lx %9s %lx %9s %ld %" FFI_TRAMP_STR(PATH_MAX) "s",
&start, &end, perm, &offset, dev, &inode, file);
if (nfields != 7)
/*
* Parse the six fixed fields and record where the path begins with %n.
* The path is taken as the rest of the line rather than with a "%s"
* field because the kernel does not escape spaces in the maps name
* field, so "%s" would truncate a path that contains a space and libffi
* could open and map the wrong file (GHSA-fq46-69xf-x5gf).
*/
path_off = 0;
nfields = sscanf (line, "%lx-%lx %9s %lx %9s %lu %n",
&start, &end, perm, &offset, dev, &inode, &path_off);
if (nfields != 6 || path_off == 0)
continue;
if (addr >= start && addr < end) {
tramp_globals.offset = offset + (addr - start);
path = line + path_off;
found = 1;
break;
}
}
fclose (fp);
if (!found)
if (!found || path == NULL || *path == '\0' || *path == '\n')
return 0;
tramp_globals.fd = open (file, open_flags);
/* Drop the trailing newline so the path can be opened. */
nl = strchr (path, '\n');
if (nl != NULL)
*nl = '\0';
tramp_globals.fd = open (path, open_flags);
if (tramp_globals.fd == -1)
return 0;
/*
* Verify that the file just opened is the file that backs the mapping we
* selected, by comparing its inode with the one from the maps line.
* Without this the path could have been replaced, or be a symlink to
* another file, between reading the maps line and the open, letting an
* attacker substitute the bytes libffi maps as executable trampoline code
* (GHSA-fq46-69xf-x5gf). Only the inode is compared: the device number in
* /proc/<pid>/maps does not match stat(2)'s st_dev on btrfs, overlayfs and
* some other filesystems, so comparing st_dev would reject the real file
* there. On any mismatch, fall back to the temp-file trampoline.
*/
if (fstat (tramp_globals.fd, &st) != 0
|| (unsigned long) st.st_ino != inode)
{
close (tramp_globals.fd);
tramp_globals.fd = -1;
return 0;
}
/*
* Allocate a trampoline table just to make sure that the trampoline code
* table can be mapped.
+236 -41
View File
@@ -42,18 +42,18 @@
#define EM_JS_MACROS(ret, name, args, body...) EM_JS(ret, name, args, body)
EM_JS_DEPS(libffi, "$getWasmTableEntry,$setWasmTableEntry,$getEmptyTableSlot,$convertJsFunctionToWasm");
EM_JS_DEPS(libffi, "$getWasmTableEntry,$setWasmTableEntry,$getEmptyTableSlot,$wasmTable,$stackSave,$stackAlloc,$stackRestore");
#define DEREF_U8(addr, offset) HEAPU8[addr + offset]
#define DEREF_S8(addr, offset) HEAP8[addr + offset]
#define DEREF_U16(addr, offset) HEAPU16[(addr >> 1) + offset]
#define DEREF_S16(addr, offset) HEAP16[(addr >> 1) + offset]
#define DEREF_U32(addr, offset) HEAPU32[(addr >> 2) + offset]
#define DEREF_S32(addr, offset) HEAP32[(addr >> 2) + offset]
#define DEREF_U16(addr, offset) HEAPU16[HEAP_INDEX_16(addr) + offset]
#define DEREF_S16(addr, offset) HEAP16[HEAP_INDEX_16(addr) + offset]
#define DEREF_U32(addr, offset) HEAPU32[HEAP_INDEX_32(addr) + offset]
#define DEREF_S32(addr, offset) HEAP32[HEAP_INDEX_32(addr) + offset]
#define DEREF_F32(addr, offset) HEAPF32[(addr >> 2) + offset]
#define DEREF_F64(addr, offset) HEAPF64[(addr >> 3) + offset]
#define DEREF_U64(addr, offset) HEAPU64[(addr >> 3) + offset]
#define DEREF_F32(addr, offset) HEAPF32[HEAP_INDEX_32(addr) + offset]
#define DEREF_F64(addr, offset) HEAPF64[HEAP_INDEX_64(addr) + offset]
#define DEREF_U64(addr, offset) HEAPU64[HEAP_INDEX_64(addr) + offset]
#define CHECK_FIELD_OFFSET(struct, field, offset) \
_Static_assert( \
@@ -64,10 +64,17 @@ EM_JS_DEPS(libffi, "$getWasmTableEntry,$setWasmTableEntry,$getEmptyTableSlot,$co
#define FFI_EMSCRIPTEN_ABI FFI_WASM32_EMSCRIPTEN
#define PTR_SIG 'i'
#define PTR_WASM_TYPE 0x7f
#define DEC_PTR(p) p
#define ENC_PTR(p) p
// Pointers reach JS as signed 32-bit Numbers, so an address at or above 2 GiB
// is negative and needs an unsigned shift to become a heap view index.
#define HEAP_INDEX_16(addr) ((addr) >>> 1)
#define HEAP_INDEX_32(addr) ((addr) >>> 2)
#define HEAP_INDEX_64(addr) ((addr) >>> 3)
#define DEREF_PTR(addr, offset) DEREF_U32(addr, offset)
#define DEREF_PTR_NUMBER(addr, offset) DEREF_PTR(addr, offset)
@@ -106,14 +113,21 @@ CHECK_FIELD_OFFSET(ffi_type, elements, 8);
#define FFI_EMSCRIPTEN_ABI FFI_WASM64_EMSCRIPTEN
#define PTR_SIG 'j'
#define PTR_WASM_TYPE 0x7e
// DEC_PTR casts a pointer value (comming from Wasm) represented as BigInt (i64) to Number (i53).
// DEC_PTR casts a pointer value (coming from Wasm) represented as BigInt (i64) to Number (i53).
// This should be used for a pointer that is expected to be within the i53 range. If the pointer
// value is outside the Number's range, the value will become NaN.
#define DEC_PTR(p) bigintToI53Checked(p)
// ENC_PTR casts a pointer value represented as Number to BigInt (i64)
#define ENC_PTR(p) BigInt(p)
// JS shifts truncate their operand to 32 bits, so divide to keep addresses
// at or above 4 GiB intact.
#define HEAP_INDEX_16(addr) ((addr) / 2)
#define HEAP_INDEX_32(addr) ((addr) / 4)
#define HEAP_INDEX_64(addr) ((addr) / 8)
#define DEREF_PTR(addr, offset) DEREF_U64(addr, offset)
#define DEREF_PTR_NUMBER(addr, offset) DEC_PTR(DEREF_PTR(addr, offset))
@@ -590,6 +604,34 @@ ffi_closure_free(void *closure) {
return ffi_closure_free_js(closure);
}
/**
* A closure has to appear to its caller as an ordinary wasm function with the
* signature of the cif. In order for it to work with JSPI, the trampoline has
* to be implemented in WebAssembly -- otherwise attempting to suspend inside of
* the closure will trap with "trying to suspend JS frames".
*
* It's a bit annoying to do things in generated WebAssembly so we put most of
* the logic in JS prelude/epilogue.
*
* call prelude(... all closure arguments)
* call_indirect closure->fun(cif, ret_ptr, args_ptr, user_data)
* call epilogue(ret_ptr, orig_stack_ptr)
*
* prelude() which copies the closure arguments into the appropriate places on
* the C stack, builds the argument pointer array, and returns 7 values: The
* closure->fun pointer and its four arguments, and the two arguments for epilogue.
* epilogue() is a JavaScript helper that restores the stack pointer and loads
* the return value from ret_ptr. Doing the load in JavaScript rather than in
* the trampoline avoids needing to specify the memory size in the imports
* section.
*
* The module bytes are a pure function of the signature string. We cache the
* compiled WebAssembly.Module per signature and instantiate it once per closure
* with that closure's prelude.
*/
EM_JS_MACROS(
ffi_status,
ffi_prep_closure_loc_js,
@@ -600,6 +642,35 @@ ffi_prep_closure_loc_js,
fun = DEC_PTR(fun);
user_data = DEC_PTR(user_data);
codeloc = DEC_PTR(codeloc);
var { sig, call_info } = ffi_cif_to_call_info(cif);
LOG_DEBUG("CREATE_CLOSURE", "sig:", sig);
try {
var instance = new WebAssembly.Instance(
ffi_closure_trampoline_module(sig),
{
e: {
p: ffi_closure_prelude(closure, call_info),
e: ffi_closure_epilogue(sig),
t: wasmTable,
},
},
);
} catch (e) {
LOG_DEBUG("CREATE_CLOSURE_FAILED", e);
return FFI_BAD_TYPEDEF_MACRO;
}
var wasm_trampoline = instance.exports["f"];
setWasmTableEntry(codeloc, wasm_trampoline);
CLOSURE__cif(closure) = ENC_PTR(cif);
CLOSURE__fun(closure) = ENC_PTR(fun);
CLOSURE__user_data(closure) = ENC_PTR(user_data);
return FFI_OK_MACRO;
}
// Walk the CIF and compute the metadata we need for ffi_closure_prelude
// and ffi_closure_trampoline_module.
function ffi_cif_to_call_info(cif) {
var abi = CIF__ABI(cif);
var nargs = CIF__NARGS(cif);
var nfixedargs = CIF__NFIXEDARGS(cif);
@@ -696,10 +767,33 @@ ffi_prep_closure_loc_js,
// extra pointer to varargs stack
sig += PTR_SIG;
}
LOG_DEBUG("CREATE_CLOSURE", "sig:", sig);
function trampoline() {
var args = Array.prototype.slice.call(arguments);
var size = 0;
return {
sig,
call_info: {
nfixedargs,
nargs,
ret_by_arg,
unboxed_arg_type_info_list,
unboxed_arg_type_id_list,
},
};
}
// The prelude() function is called by the wasm trampoline with the closure's
// arguments. It marshals them onto the C stack and returns what the trampoline
// needs to make the onward call.
function ffi_closure_prelude(
closure,
{
nfixedargs,
nargs,
ret_by_arg,
unboxed_arg_type_info_list,
unboxed_arg_type_id_list,
},
) {
return function prelude() {
var args = arguments;
var orig_stack_ptr = stackSave();
var cur_ptr = orig_stack_ptr;
var ret_ptr;
@@ -707,7 +801,7 @@ ffi_prep_closure_loc_js,
// Should we return by argument or not? The onwards call returns by argument
// no matter what. (Warning: ret_by_arg means the opposite in ffi_call)
if (ret_by_arg) {
ret_ptr = args[jsarg_idx++];
ret_ptr = DEC_PTR(args[jsarg_idx++]);
} else {
// We might return 4 bytes or 8 bytes, allocate 8 just in case.
STACK_ALLOC(cur_ptr, 8, 8);
@@ -817,37 +911,138 @@ ffi_prep_closure_loc_js,
stackRestore(cur_ptr);
stackAlloc(0); // stackAlloc enforces alignment invariants on the stack pointer
LOG_DEBUG("CALL_CLOSURE", "closure:", closure, "fptr", CLOSURE__fun(closure), "cif", CLOSURE__cif(closure));
getWasmTableEntry(CLOSURE__fun(closure))(
CLOSURE__cif(closure), ENC_PTR(ret_ptr), ENC_PTR(args_ptr),
CLOSURE__user_data(closure)
);
stackRestore(orig_stack_ptr);
// The trampoline now does
// fun(cif, ret_ptr, args_ptr, user_data);
// return epilogue(ret_ptr, orig_stack_ptr);
//
// We return these arguments in reverse order because stack is LIFO.
return [
ENC_PTR(ret_ptr), // epilogue args (in correct order)
ENC_PTR(orig_stack_ptr),
// If we aren't supposed to return by argument, figure out what to return.
if (!ret_by_arg) {
switch (sig[0]) {
case 'i':
return DEREF_U32(ret_ptr, 0);
case 'j':
return DEREF_U64(ret_ptr, 0);
case 'd':
return DEREF_F64(ret_ptr, 0);
case 'f':
return DEREF_F32(ret_ptr, 0);
CLOSURE__cif(closure), // call_indirect args (in correct order)
ENC_PTR(ret_ptr),
ENC_PTR(args_ptr),
CLOSURE__user_data(closure),
CLOSURE__fun(closure), // ...and the table index for call_indirect
];
}
}
// Returns function which restores the stack pointer and loads the closure's
// return value from ret_ptr.
function ffi_closure_epilogue(sig) {
var load;
switch (sig[0]) {
case 'i': load = (ptr) => DEREF_S32(ptr, 0); break;
case 'j': load = (ptr) => DEREF_U64(ptr, 0); break;
case 'f': load = (ptr) => DEREF_F32(ptr, 0); break;
case 'd': load = (ptr) => DEREF_F64(ptr, 0); break;
default: load = (ptr) => undefined; break;
}
return function epilogue(ret_ptr, orig_stack_ptr) {
stackRestore(DEC_PTR(orig_stack_ptr));
return load(DEC_PTR(ret_ptr));
};
}
var ffi_closure_trampoline_module_cache = new Map();
function ffi_closure_trampoline_module(sig) {
var cache = ffi_closure_trampoline_module_cache;
var module = cache.get(sig);
if (module) {
return module;
}
function uleb128(n) {
var result = [];
do {
var byte = n & 0x7f;
n >>>= 7;
if (n) {
byte |= 0x80;
}
}
result.push(byte);
} while (n);
return result;
}
try {
var wasm_trampoline = convertJsFunctionToWasm(trampoline, sig);
} catch(e) {
return FFI_BAD_TYPEDEF_MACRO;
// A vector of single-byte items
function vec(bytes) {
return [...uleb128(bytes.length), ...bytes];
}
setWasmTableEntry(codeloc, wasm_trampoline);
CLOSURE__cif(closure) = ENC_PTR(cif);
CLOSURE__fun(closure) = ENC_PTR(fun);
CLOSURE__user_data(closure) = ENC_PTR(user_data);
return FFI_OK_MACRO;
})
function section(id, bytes) {
return [id, ...vec(bytes)];
}
function funcType(params, results) {
return [0x60, ...vec(params), ...vec(results)];
}
var typeCodes = { 'i': 0x7f, 'j': 0x7e, 'f': 0x7d, 'd': 0x7c };
var P = PTR_WASM_TYPE;
var params = Array.from(sig.slice(1), (c) => typeCodes[c]);
var results = sig[0] === 'v' ? [] : [typeCodes[sig[0]]];
var nparams = params.length;
// Is the function table 64-bit indexed?
// -sMEMORY64=2 compiles with 64-bit pointers but uses a 32-bit memory and
// table, so we have to i32.wrap_i64 pointers.
var idx64 = typeof wasmTable.length === 'bigint';
var idxFlag = idx64 ? 0x04 : 0x00;
// Pointers are wrapped to i32 to be used as a table index.
var wrapPtr = (P === 0x7e && !idx64) ? [0xa7] : []; // i32.wrap_i64
var typeSection = section(0x01, [
...uleb128(4),
...funcType(params, results), // type 0: the trampoline itself
...funcType(params, [P, P, P, P, P, P, P]), // type 1: prelude
...funcType([P, P, P, P], []), // type 2: closure->fun(cif, ret, args, user_data)
...funcType([P, P], results), // type 3: epilogue(ret_ptr, orig_sp)
]);
var importSection = section(0x02, [
...uleb128(3),
// prelude: (import "e" "p" (func (type 1)))
0x01, 0x65, 0x01, 0x70, 0x00, 0x01,
// epilogue: (import "e" "e" (func (type 3)))
0x01, 0x65, 0x01, 0x65, 0x00, 0x03,
// (import "e" "t" (table 0 funcref))
0x01, 0x65, 0x01, 0x74, 0x01, 0x70, 0x00 | idxFlag, 0x00,
]);
// One function, of type 0.
var functionSection = section(0x03, [0x01, 0x00]);
// (export "f" (func 2)) -- funcs 0 and 1 are the imports.
var exportSection = section(0x07, [0x01, 0x01, 0x66, 0x00, 0x02]);
// Function body
var body = [0x00]; // no locals
for (var i = 0; i < nparams; i++) {
body.push(0x20, ...uleb128(i)); // local.get i
}
body.push(0x10, 0x00); // call prelude
// Operand stack is now: ret_ptr, orig_sp, cif, ret_ptr, args_ptr, user_data, fun
body.push(...wrapPtr); // fun is used as a table index
body.push(0x11, 0x02, 0x00); // call_indirect (type 2) (table 0), consumes the top 5
// Operand stack: ret_ptr, orig_sp
body.push(0x10, 0x01); // call epilogue, consumes both and leaves the result (if any)
body.push(0x0b); // end
var codeSection = section(0x0a, [...uleb128(1), ...vec(body)]);
var bytes = new Uint8Array([
0x00, 0x61, 0x73, 0x6d, // magic
0x01, 0x00, 0x00, 0x00, // version
...typeSection,
...importSection,
...functionSection,
...exportSection,
...codeSection,
]);
LOG_DEBUG("CLOSURE_MODULE", "sig:", sig, "bytes:", bytes);
// The module is tiny so compiling synchronously is fine.
module = new WebAssembly.Module(bytes);
cache.set(sig, module);
return module;
}
)
// EM_JS does not correctly handle function pointer arguments, so we need a
// helper
+27 -2
View File
@@ -348,7 +348,7 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue,
size_t z = ty->size;
int t = ty->type;
if (z <= FFI_SIZEOF_ARG && t != FFI_TYPE_STRUCT)
if (z <= FFI_SIZEOF_ARG && t != FFI_TYPE_STRUCT && t != FFI_TYPE_COMPLEX)
{
ffi_arg val = extend_basic_type (valp, t);
@@ -495,7 +495,7 @@ ffi_closure_inner (struct closure_frame *frame, char *stack)
int t = ty->type;
void *valp;
if (z <= FFI_SIZEOF_ARG && t != FFI_TYPE_STRUCT)
if (z <= FFI_SIZEOF_ARG && t != FFI_TYPE_STRUCT && t != FFI_TYPE_COMPLEX)
{
if (t != FFI_TYPE_FLOAT && narg_reg < pabi->nregs)
valp = &frame->regs[pabi->regs[narg_reg++]];
@@ -681,6 +681,10 @@ ffi_prep_go_closure (ffi_go_closure* closure, ffi_cif* cif,
void FFI_HIDDEN ffi_closure_raw_SYSV(void);
void FFI_HIDDEN ffi_closure_raw_THISCALL(void);
#if defined(FFI_EXEC_STATIC_TRAMP)
void FFI_HIDDEN ffi_closure_raw_SYSV_alt(void);
void FFI_HIDDEN ffi_closure_raw_THISCALL_alt(void);
#endif
ffi_status
ffi_prep_raw_closure_loc (ffi_raw_closure *closure,
@@ -717,6 +721,24 @@ ffi_prep_raw_closure_loc (ffi_raw_closure *closure,
return FFI_BAD_ABI;
}
#if defined(FFI_EXEC_STATIC_TRAMP)
if (ffi_tramp_is_present (closure))
{
/* With a static trampoline, set its parameters instead of writing a
dynamic trampoline into closure->tramp. The _alt entry loads the
closure pointer the trampoline passes into %eax, where
ffi_closure_raw_* expect it. Writing the dynamic trampoline here
would instead clobber the ftramp pointer ffi_closure_alloc stored at
offset 0 and leave the static trampoline with no parameters
(GHSA-w6j9-w53f-2857). ftramp is read through ffi_closure, exactly
as ffi_closure_alloc/ffi_closure_free do. */
dest = (dest == ffi_closure_raw_SYSV)
? ffi_closure_raw_SYSV_alt : ffi_closure_raw_THISCALL_alt;
ffi_tramp_set_parms (((ffi_closure *) closure)->ftramp, dest, closure);
goto out;
}
#endif
/* movl imm, %eax. */
tramp[0] = 0xb8;
*(void **)(tramp + 1) = codeloc;
@@ -725,6 +747,9 @@ ffi_prep_raw_closure_loc (ffi_raw_closure *closure,
tramp[5] = 0xe9;
*(unsigned *)(tramp + 6) = (unsigned)dest - ((unsigned)codeloc + 10);
#if defined(FFI_EXEC_STATIC_TRAMP)
out:
#endif
closure->cif = cif;
closure->fun = fun;
closure->user_data = user_data;
+60 -13
View File
@@ -442,6 +442,41 @@ examine_argument (ffi_type *type, enum x86_64_reg_class classes[MAX_CLASSES],
return n;
}
/* Recursively test whether TY is, or contains, a short vector whose x86-64
System V calling convention is undefined, so that libffi must refuse it
rather than marshal it the wrong way.
The psABI only defines the convention for vectors that map to __m64/__m128
(8 and 16 bytes). Narrower vectors (<1 x float>, <4 x uint8>, ...) are
unspecified, and GCC and Clang disagree on them. Among the 8-byte vectors
the two also disagree on the single-element <1 x double>: GCC returns and
passes it in memory, Clang in %xmm0. libffi cannot tell which convention
the target function was compiled for, so it accepts only the shapes both
compilers agree on and this port implements: 16-byte vectors, and 8-byte
vectors other than <1 x double>. Everything else is FFI_BAD_TYPEDEF. */
static int
vector_type_unsupported (ffi_type *ty)
{
ffi_type **p;
if (ty == NULL)
return 0;
if (ty->type == FFI_TYPE_VECTOR)
{
if (ty->size == 16)
return 0;
if (ty->size == 8 && ty->elements[0]->type != FFI_TYPE_DOUBLE)
return 0;
return 1;
}
if (ty->type == FFI_TYPE_STRUCT && ty->elements != NULL)
for (p = ty->elements; *p != NULL; p++)
if (vector_type_unsupported (*p))
return 1;
return 0;
}
/* Perform machine dependent cif processing. */
#ifndef __ILP32__
@@ -469,6 +504,18 @@ ffi_prep_cif_machdep (ffi_cif *cif)
rtype = cif->rtype;
rtype_size = rtype->size;
/* Reject return and argument types that are, or contain, a vector whose
x86-64 System V convention is undefined (see vector_type_unsupported).
Doing it here, before any classification, keeps libffi from silently
marshalling such a value the wrong way -- which for <1 x double> turns a
caller's integer argument into the store address of the result. */
if (vector_type_unsupported (rtype))
return FFI_BAD_TYPEDEF;
for (i = 0, avn = cif->nargs; i < avn; i++)
if (vector_type_unsupported (cif->arg_types[i]))
return FFI_BAD_TYPEDEF;
switch (rtype->type)
{
case FFI_TYPE_VOID:
@@ -533,7 +580,9 @@ ffi_prep_cif_machdep (ffi_cif *cif)
{
_Bool sse0 = SSE_CLASS_P (classes[0]);
if (rtype_size == 4 && sse0)
if (classes[0] == X86_64_X87_CLASS)
flags = UNIX64_RET_X87;
else if (rtype_size == 4 && sse0)
flags = UNIX64_RET_XMM32;
else if (rtype_size == 8)
flags = sse0 ? UNIX64_RET_XMM64 : UNIX64_RET_INT64;
@@ -553,8 +602,9 @@ ffi_prep_cif_machdep (ffi_cif *cif)
}
break;
case FFI_TYPE_VECTOR:
/* An 8-byte vector returns in the low half of %xmm0; a 16-byte vector
fills %xmm0 (SSE + SSEUP). Wider vectors are unsupported here. */
/* Only supported vectors reach here (vector_type_unsupported rejected
the rest above): an 8-byte vector returns in the low half of %xmm0,
a 16-byte vector fills %xmm0 (SSE + SSEUP). */
if (rtype_size == 8)
flags = UNIX64_RET_XMM64;
else if (rtype_size == 16)
@@ -606,15 +656,6 @@ ffi_prep_cif_machdep (ffi_cif *cif)
return FFI_BAD_TYPEDEF;
}
/* Reject vectors wider than 16 bytes as arguments: correct %ymm/%zmm
passing needs unix64.S register-save changes that are out of scope for
this port, and classify_argument would otherwise silently treat them as
an in-memory aggregate. */
for (i = 0, avn = cif->nargs; i < avn; i++)
if (cif->arg_types[i]->type == FFI_TYPE_VECTOR
&& cif->arg_types[i]->size > 16)
return FFI_BAD_TYPEDEF;
/* Go over all arguments and determine the way they should be passed.
If it's in a register and there is space for it, let that be so. If
not, add it's size to the stack byte count. */
@@ -934,8 +975,14 @@ build_plan (ffi_cif *cif)
switch (classes[j])
{
case X86_64_NO_CLASS:
case X86_64_SSEUP_CLASS:
continue; /* nothing placed for this 8-byte */
case X86_64_SSEUP_CLASS:
/* Upper half of the preceding SSE class's %xmm slot. */
m.dst_off = (unsigned) (offsetof (struct register_args, sse)
+ (ssecount - 1)
* sizeof (union big_int_union) + 8);
m.op = FFI_MOVE_SSE64;
break;
case X86_64_INTEGER_CLASS:
case X86_64_INTEGERSI_CLASS:
m.dst_off = gprcount * 8; /* offsetof(register_args,gpr) == 0 */
+28 -2
View File
@@ -351,7 +351,7 @@ L(UW13):
FFI_CLOSURE_SAVE_REGS
FFI_CLOSURE_COPY_TRAMP_DATA
/* Entry point from preceeding Go closures. */
/* Entry point from preceding Go closures. */
L(do_closure_i386):
FFI_CLOSURE_PREP_CALL
@@ -486,7 +486,7 @@ L(do_closure_REGISTER):
FFI_CLOSURE_COPY_TRAMP_DATA
/* Entry point from preceeding Go closure. */
/* Entry point from preceding Go closure. */
L(do_closure_STDCALL):
FFI_CLOSURE_PREP_CALL
@@ -883,6 +883,32 @@ L(UW52):
/* cfi_endproc */
ENDF(C(ffi_closure_raw_THISCALL))
#if defined(FFI_EXEC_STATIC_TRAMP)
/* Static-trampoline entry points for the raw closures. The static
trampoline leaves the closure pointer at 4(%esp); load it into %eax
(where ffi_closure_raw_* expect it), restore the stack, and jump to the
normal body. Mirrors ffi_closure_i386_alt. */
.balign 16
.globl C(ffi_closure_raw_SYSV_alt)
FFI_HIDDEN(C(ffi_closure_raw_SYSV_alt))
C(ffi_closure_raw_SYSV_alt):
_CET_ENDBR
movl 4(%esp), %eax /* Load closure in eax */
add $8, %esp /* Restore the stack */
jmp C(ffi_closure_raw_SYSV)
ENDF(C(ffi_closure_raw_SYSV_alt))
.balign 16
.globl C(ffi_closure_raw_THISCALL_alt)
FFI_HIDDEN(C(ffi_closure_raw_THISCALL_alt))
C(ffi_closure_raw_THISCALL_alt):
_CET_ENDBR
movl 4(%esp), %eax /* Load closure in eax */
add $8, %esp /* Restore the stack */
jmp C(ffi_closure_raw_THISCALL)
ENDF(C(ffi_closure_raw_THISCALL_alt))
#endif /* FFI_EXEC_STATIC_TRAMP */
#endif /* !FFI_NO_RAW_API */
#ifdef X86_DARWIN
+2 -2
View File
@@ -291,7 +291,7 @@ L(UW13):
FFI_CLOSURE_SAVE_REGS
FFI_CLOSURE_COPY_TRAMP_DATA
/* Entry point from preceeding Go closures. */
/* Entry point from preceding Go closures. */
L(do_closure_i386)::
FFI_CLOSURE_PREP_CALL
@@ -420,7 +420,7 @@ L(do_closure_REGISTER)::
FFI_CLOSURE_COPY_TRAMP_DATA
/* Entry point from preceeding Go closure. */
/* Entry point from preceding Go closure. */
L(do_closure_STDCALL)::
FFI_CLOSURE_PREP_CALL
+9 -8
View File
@@ -31,6 +31,7 @@
#define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h>
#include <ffi_cfi.h>
#include "internal64.h"
#include "asmnames.h"
@@ -256,7 +257,7 @@ ENDF(C(ffi_call_unix64))
.globl C(ffi_plan_fast_call)
FFI_HIDDEN(C(ffi_plan_fast_call))
C(ffi_plan_fast_call):
.cfi_startproc
cfi_startproc
_CET_ENDBR
movq %rsi, %r11 /* fn */
movq %rdi, %rax /* img */
@@ -280,12 +281,12 @@ C(ffi_plan_fast_call):
movq 0x28(%rax), %r9
movl %r10d, %eax /* %al = ssecount */
subq $8, %rsp /* realign to 16 across the call */
.cfi_adjust_cfa_offset 8
cfi_adjust_cfa_offset(8)
call *%r11
addq $8, %rsp
.cfi_adjust_cfa_offset -8
cfi_adjust_cfa_offset(-8)
ret /* rax + xmm0 carry the callee's return */
.cfi_endproc
cfi_endproc
ENDF(C(ffi_plan_fast_call))
/* Count-based direct thunks for the pure-GP64 fast path: load avalue[0..N-1]
@@ -297,7 +298,7 @@ C(ffi_plan_fast_call):
rax/xmm0 flow out as the {UINT64,double} return; C stores per return code. */
#define FFI_GP_HEAD \
.cfi_startproc; \
cfi_startproc; \
_CET_ENDBR; \
movq %rsi, %r11; \
movq %rdi, %rax
@@ -307,12 +308,12 @@ C(ffi_plan_fast_call):
#define FFI_GP_TAIL \
xorl %eax, %eax; \
subq $8, %rsp; \
.cfi_adjust_cfa_offset 8; \
cfi_adjust_cfa_offset(8); \
call *%r11; \
addq $8, %rsp; \
.cfi_adjust_cfa_offset -8; \
cfi_adjust_cfa_offset(-8); \
ret; \
.cfi_endproc
cfi_endproc
.balign 8
.globl C(ffi_plan_gp0)
+14 -6
View File
@@ -13,6 +13,7 @@ EXTRA_DIST = config/default.exp emscripten/build.sh emscripten/conftest.py \
libffi.bhaible/alignof.h libffi.bhaible/bhaible.exp libffi.bhaible/test-call.c \
libffi.bhaible/test-callback.c libffi.bhaible/testcases.c libffi.call/align_mixed.c \
libffi.call/align_stdcall.c libffi.call/bpo_38748.c libffi.call/call.exp \
libffi.call/closure_raw.c \
libffi.call/closure_thiscall_fastcall_pop.c \
libffi.call/err_bad_typedef.c libffi.call/ffitest.h libffi.call/float.c \
libffi.call/float1.c libffi.call/float2.c libffi.call/float3.c \
@@ -29,7 +30,7 @@ EXTRA_DIST = config/default.exp emscripten/build.sh emscripten/conftest.py \
libffi.call/return_fl1.c libffi.call/return_fl2.c libffi.call/return_fl3.c \
libffi.call/return_ldl.c libffi.call/return_ll.c libffi.call/return_ll1.c \
libffi.call/return_sc.c libffi.call/return_sl.c libffi.call/return_uc.c \
libffi.call/return_ul.c libffi.call/s55.c libffi.call/strlen.c \
libffi.call/return_ul.c libffi.call/return_void.c libffi.call/s55.c libffi.call/strlen.c \
libffi.call/strlen2.c libffi.call/strlen3.c libffi.call/strlen4.c \
libffi.call/struct1.c libffi.call/struct10.c libffi.call/struct2.c \
libffi.call/struct3.c libffi.call/struct4.c libffi.call/struct5.c \
@@ -37,12 +38,14 @@ EXTRA_DIST = config/default.exp emscripten/build.sh emscripten/conftest.py \
libffi.call/struct9.c libffi.call/struct_by_value_2.c libffi.call/struct_by_value_3.c \
libffi.call/struct_by_value_3f.c libffi.call/struct_by_value_4.c libffi.call/struct_by_value_4f.c \
libffi.call/struct_by_value_big.c libffi.call/struct_by_value_small.c libffi.call/struct_return_2H.c \
libffi.call/struct_int_float.c libffi.call/longjmp.c \
libffi.call/struct_int_float.c libffi.call/struct_stack_small.c libffi.call/longjmp.c \
libffi.call/struct_return_8H.c libffi.call/uninitialized.c libffi.call/va_1.c \
libffi.call/va_2.c libffi.call/va_3.c libffi.call/va_struct1.c \
libffi.call/va_struct2.c libffi.call/va_struct3.c libffi.call/callback.c \
libffi.call/callback2.c libffi.call/callback3.c libffi.call/callback4.c libffi.call/x32.c \
libffi.closures/closure.exp libffi.closures/closure_fn0.c libffi.closures/closure_fn1.c \
libffi.closures/closure.exp libffi.closures/closure_int128.c \
libffi.closures/closure_mmap_failure.c libffi.closures/closure_trampoline_table.c \
libffi.closures/closure_fn0.c libffi.closures/closure_fn1.c \
libffi.closures/closure_fn2.c libffi.closures/closure_fn3.c libffi.closures/closure_fn4.c \
libffi.closures/closure_fn5.c libffi.closures/closure_fn6.c libffi.closures/closure_loc_fn0.c \
libffi.closures/closure_simple.c libffi.closures/cls_12byte.c libffi.closures/cls_16byte.c \
@@ -64,7 +67,7 @@ EXTRA_DIST = config/default.exp emscripten/build.sh emscripten/conftest.py \
libffi.closures/cls_multi_sshortchar.c libffi.closures/cls_multi_uchar.c libffi.closures/cls_multi_ushort.c \
libffi.closures/cls_multi_ushortchar.c libffi.closures/cls_pointer.c libffi.closures/cls_pointer_stack.c \
libffi.closures/cls_schar.c libffi.closures/cls_sint.c libffi.closures/cls_sshort.c \
libffi.closures/cls_struct_va1.c libffi.closures/cls_uchar.c libffi.closures/cls_uint.c \
libffi.closures/cls_struct_fp_return.c libffi.closures/cls_struct_ld_return.c libffi.closures/cls_struct_va1.c libffi.closures/cls_uchar.c libffi.closures/cls_uint.c \
libffi.closures/cls_uint_va.c libffi.closures/cls_ulong_va.c libffi.closures/cls_ulonglong.c \
libffi.closures/cls_ushort.c libffi.closures/err_bad_abi.c libffi.closures/ffitest.h \
libffi.closures/huge_struct.c libffi.closures/nested_struct.c libffi.closures/nested_struct1.c \
@@ -83,7 +86,9 @@ EXTRA_DIST = config/default.exp emscripten/build.sh emscripten/conftest.py \
libffi.complex/cls_complex_va_double.c libffi.complex/cls_complex_va_float.c libffi.complex/cls_complex_va_longdouble.c \
libffi.complex/complex.exp libffi.complex/complex.inc libffi.complex/complex_defs_double.inc \
libffi.complex/complex_defs_float.inc libffi.complex/complex_defs_longdouble.inc libffi.complex/complex_double.c \
libffi.complex/complex_float.c libffi.complex/complex_i128.c libffi.complex/complex_int.c libffi.complex/complex_longdouble.c \
libffi.complex/complex_float.c libffi.complex/complex_i128.c libffi.complex/complex_int.c libffi.complex/complex_int_small.c libffi.complex/complex_longdouble.c \
libffi.complex/complex_longdouble_abi.c libffi.complex/complex_regs.inc libffi.complex/complex_regs_double.c \
libffi.complex/complex_regs_float.c libffi.complex/complex_regs_longdouble.c \
libffi.complex/ffitest.h libffi.complex/many_complex.inc libffi.complex/many_complex_double.c \
libffi.complex/many_complex_float.c libffi.complex/many_complex_longdouble.c libffi.complex/return_complex.inc \
libffi.complex/return_complex1.inc libffi.complex/return_complex1_double.c libffi.complex/return_complex1_float.c \
@@ -92,10 +97,13 @@ EXTRA_DIST = config/default.exp emscripten/build.sh emscripten/conftest.py \
libffi.complex/return_complex_float.c libffi.complex/return_complex_longdouble.c libffi.go/aa-direct.c \
libffi.go/closure1.c libffi.go/ffitest.h libffi.go/go.exp \
libffi.go/static-chain.h Makefile.am Makefile.in \
libffi.jspi/cls_jspi.c libffi.jspi/ffitest.h libffi.jspi/jspi.exp \
libffi.threads/ffitest.h libffi.threads/threads.exp libffi.threads/tsan.c \
libffi.vector/vector.exp libffi.vector/ffitest.h libffi.vector/vector.h \
libffi.vector/vector_float32x4.c libffi.vector/vector_float32x2.c \
libffi.vector/vector_double2.c libffi.vector/vector_int32x4.c \
libffi.vector/vector_args_spill.c libffi.vector/vector_vec3.c \
libffi.vector/vector_double4.c libffi.vector/vector_hva.c \
libffi.vector/cls_vector.c libffi.vector/vector_validate.c
libffi.vector/cls_vector.c libffi.vector/vector_validate.c \
libffi.vector/vector_unsupported_abi.c \
libffi.configure/libdir.sh
+57 -36
View File
@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# Makefile.in generated by automake 1.18.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# Copyright (C) 1994-2025 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -69,6 +69,8 @@ am__make_running_with_option = \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
am__rm_f = rm -f $(am__rm_f_notfound)
am__rm_rf = rm -rf $(am__rm_f_notfound)
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -239,8 +241,10 @@ ac_ct_READELF = @ac_ct_READELF@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__rm_f_notfound = @am__rm_f_notfound@
am__tar = @am__tar@
am__untar = @am__untar@
am__xargs_n = @am__xargs_n@
ax_enable_builddir_sed = @ax_enable_builddir_sed@
bindir = @bindir@
build = @build@
@@ -301,6 +305,7 @@ EXTRA_DIST = config/default.exp emscripten/build.sh emscripten/conftest.py \
libffi.bhaible/alignof.h libffi.bhaible/bhaible.exp libffi.bhaible/test-call.c \
libffi.bhaible/test-callback.c libffi.bhaible/testcases.c libffi.call/align_mixed.c \
libffi.call/align_stdcall.c libffi.call/bpo_38748.c libffi.call/call.exp \
libffi.call/closure_raw.c \
libffi.call/closure_thiscall_fastcall_pop.c \
libffi.call/err_bad_typedef.c libffi.call/ffitest.h libffi.call/float.c \
libffi.call/float1.c libffi.call/float2.c libffi.call/float3.c \
@@ -317,7 +322,7 @@ EXTRA_DIST = config/default.exp emscripten/build.sh emscripten/conftest.py \
libffi.call/return_fl1.c libffi.call/return_fl2.c libffi.call/return_fl3.c \
libffi.call/return_ldl.c libffi.call/return_ll.c libffi.call/return_ll1.c \
libffi.call/return_sc.c libffi.call/return_sl.c libffi.call/return_uc.c \
libffi.call/return_ul.c libffi.call/s55.c libffi.call/strlen.c \
libffi.call/return_ul.c libffi.call/return_void.c libffi.call/s55.c libffi.call/strlen.c \
libffi.call/strlen2.c libffi.call/strlen3.c libffi.call/strlen4.c \
libffi.call/struct1.c libffi.call/struct10.c libffi.call/struct2.c \
libffi.call/struct3.c libffi.call/struct4.c libffi.call/struct5.c \
@@ -325,12 +330,14 @@ EXTRA_DIST = config/default.exp emscripten/build.sh emscripten/conftest.py \
libffi.call/struct9.c libffi.call/struct_by_value_2.c libffi.call/struct_by_value_3.c \
libffi.call/struct_by_value_3f.c libffi.call/struct_by_value_4.c libffi.call/struct_by_value_4f.c \
libffi.call/struct_by_value_big.c libffi.call/struct_by_value_small.c libffi.call/struct_return_2H.c \
libffi.call/struct_int_float.c libffi.call/longjmp.c \
libffi.call/struct_int_float.c libffi.call/struct_stack_small.c libffi.call/longjmp.c \
libffi.call/struct_return_8H.c libffi.call/uninitialized.c libffi.call/va_1.c \
libffi.call/va_2.c libffi.call/va_3.c libffi.call/va_struct1.c \
libffi.call/va_struct2.c libffi.call/va_struct3.c libffi.call/callback.c \
libffi.call/callback2.c libffi.call/callback3.c libffi.call/callback4.c libffi.call/x32.c \
libffi.closures/closure.exp libffi.closures/closure_fn0.c libffi.closures/closure_fn1.c \
libffi.closures/closure.exp libffi.closures/closure_int128.c \
libffi.closures/closure_mmap_failure.c libffi.closures/closure_trampoline_table.c \
libffi.closures/closure_fn0.c libffi.closures/closure_fn1.c \
libffi.closures/closure_fn2.c libffi.closures/closure_fn3.c libffi.closures/closure_fn4.c \
libffi.closures/closure_fn5.c libffi.closures/closure_fn6.c libffi.closures/closure_loc_fn0.c \
libffi.closures/closure_simple.c libffi.closures/cls_12byte.c libffi.closures/cls_16byte.c \
@@ -352,7 +359,7 @@ EXTRA_DIST = config/default.exp emscripten/build.sh emscripten/conftest.py \
libffi.closures/cls_multi_sshortchar.c libffi.closures/cls_multi_uchar.c libffi.closures/cls_multi_ushort.c \
libffi.closures/cls_multi_ushortchar.c libffi.closures/cls_pointer.c libffi.closures/cls_pointer_stack.c \
libffi.closures/cls_schar.c libffi.closures/cls_sint.c libffi.closures/cls_sshort.c \
libffi.closures/cls_struct_va1.c libffi.closures/cls_uchar.c libffi.closures/cls_uint.c \
libffi.closures/cls_struct_fp_return.c libffi.closures/cls_struct_ld_return.c libffi.closures/cls_struct_va1.c libffi.closures/cls_uchar.c libffi.closures/cls_uint.c \
libffi.closures/cls_uint_va.c libffi.closures/cls_ulong_va.c libffi.closures/cls_ulonglong.c \
libffi.closures/cls_ushort.c libffi.closures/err_bad_abi.c libffi.closures/ffitest.h \
libffi.closures/huge_struct.c libffi.closures/nested_struct.c libffi.closures/nested_struct1.c \
@@ -371,7 +378,9 @@ EXTRA_DIST = config/default.exp emscripten/build.sh emscripten/conftest.py \
libffi.complex/cls_complex_va_double.c libffi.complex/cls_complex_va_float.c libffi.complex/cls_complex_va_longdouble.c \
libffi.complex/complex.exp libffi.complex/complex.inc libffi.complex/complex_defs_double.inc \
libffi.complex/complex_defs_float.inc libffi.complex/complex_defs_longdouble.inc libffi.complex/complex_double.c \
libffi.complex/complex_float.c libffi.complex/complex_i128.c libffi.complex/complex_int.c libffi.complex/complex_longdouble.c \
libffi.complex/complex_float.c libffi.complex/complex_i128.c libffi.complex/complex_int.c libffi.complex/complex_int_small.c libffi.complex/complex_longdouble.c \
libffi.complex/complex_longdouble_abi.c libffi.complex/complex_regs.inc libffi.complex/complex_regs_double.c \
libffi.complex/complex_regs_float.c libffi.complex/complex_regs_longdouble.c \
libffi.complex/ffitest.h libffi.complex/many_complex.inc libffi.complex/many_complex_double.c \
libffi.complex/many_complex_float.c libffi.complex/many_complex_longdouble.c libffi.complex/return_complex.inc \
libffi.complex/return_complex1.inc libffi.complex/return_complex1_double.c libffi.complex/return_complex1_float.c \
@@ -380,13 +389,16 @@ EXTRA_DIST = config/default.exp emscripten/build.sh emscripten/conftest.py \
libffi.complex/return_complex_float.c libffi.complex/return_complex_longdouble.c libffi.go/aa-direct.c \
libffi.go/closure1.c libffi.go/ffitest.h libffi.go/go.exp \
libffi.go/static-chain.h Makefile.am Makefile.in \
libffi.jspi/cls_jspi.c libffi.jspi/ffitest.h libffi.jspi/jspi.exp \
libffi.threads/ffitest.h libffi.threads/threads.exp libffi.threads/tsan.c \
libffi.vector/vector.exp libffi.vector/ffitest.h libffi.vector/vector.h \
libffi.vector/vector_float32x4.c libffi.vector/vector_float32x2.c \
libffi.vector/vector_double2.c libffi.vector/vector_int32x4.c \
libffi.vector/vector_args_spill.c libffi.vector/vector_vec3.c \
libffi.vector/vector_double4.c libffi.vector/vector_hva.c \
libffi.vector/cls_vector.c libffi.vector/vector_validate.c
libffi.vector/cls_vector.c libffi.vector/vector_validate.c \
libffi.vector/vector_unsupported_abi.c \
libffi.configure/libdir.sh
all: all-am
@@ -445,37 +457,39 @@ check-DEJAGNU: site.exp
fi; \
exit $$exit_status
site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
@echo 'Making a new site.exp file ...'
@echo '## these variables are automatically generated by make ##' >site.tmp
@echo '# Do not edit here. If you wish to override these values' >>site.tmp
@echo '# edit the last section' >>site.tmp
@echo 'set srcdir "$(srcdir)"' >>site.tmp
@echo "set objdir \"`pwd`\"" >>site.tmp
@echo 'set build_alias "$(build_alias)"' >>site.tmp
@echo 'set build_triplet $(build_triplet)' >>site.tmp
@echo 'set host_alias "$(host_alias)"' >>site.tmp
@echo 'set host_triplet $(host_triplet)' >>site.tmp
@echo 'set target_alias "$(target_alias)"' >>site.tmp
@echo 'set target_triplet $(target_triplet)' >>site.tmp
@list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \
echo "## Begin content included from file $$f. Do not modify. ##" \
&& cat `test -f "$$f" || echo '$(srcdir)/'`$$f \
&& echo "## End content included from file $$f. ##" \
|| exit 1; \
done >> site.tmp
@echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp
@if test -f site.exp; then \
sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \
fi
@-rm -f site.bak
@test ! -f site.exp || mv site.exp site.bak
@mv site.tmp site.exp
$(AM_V_GEN)set -e; ( \
echo '## these variables are automatically generated by make ##'; \
echo '# Do not edit here. If you wish to override these values'; \
echo '# edit the last section'; \
echo 'set srcdir "$(srcdir)"'; \
echo "set objdir \"`pwd`\""; \
echo 'set build_alias "$(build_alias)"'; \
echo 'set build_triplet $(build_triplet)'; \
echo 'set host_alias "$(host_alias)"'; \
echo 'set host_triplet $(host_triplet)'; \
echo 'set target_alias "$(target_alias)"'; \
echo 'set target_triplet $(target_triplet)'; \
list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; \
for f in $$list; do \
echo "## Begin content included from file $$f. Do not modify. ##"; \
cat `test -f "$$f" || echo '$(srcdir)/'`$$f; \
echo "## End content included from file $$f. ##"; \
done; \
echo "## End of auto-generated content; you can edit from here. ##"; \
if test -f site.exp; then \
sed -e '1,/^## End of auto-generated content.*##/d' site.exp; \
fi; \
) >site.tmp; \
rm -f site.bak; \
test ! -f site.exp || mv site.exp site.bak; \
mv site.tmp site.exp
distclean-DEJAGNU:
-rm -f site.exp site.bak
-l='$(DEJATOOL)'; for tool in $$l; do \
rm -f $$tool.sum $$tool.log; \
done
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
@@ -536,11 +550,11 @@ install-strip:
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-$(am__rm_f) $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-$(am__rm_f) $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -632,3 +646,10 @@ uninstall-am:
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
# Tell GNU make to disable its built-in pattern rules.
%:: %,v
%:: RCS/%,v
%:: RCS/%
%:: s.%
%:: SCCS/s.%
+46
View File
@@ -0,0 +1,46 @@
#!/bin/sh
# Check that closures.c keeps the bundled dlmalloc private.
#
# closures.c declares each dl* function static before it includes
# dlmalloc.c. A dl* function missing from that list gets dlmalloc's
# default extern linkage. The version script hides it in libffi.so.
# libffi.a has no version script, so a program that links libffi.a
# exports it.
#
# Usage: check-dlmalloc-static.sh NM LIBTOOL-OBJECT
nm_cmd=$1
lo=$2
case $nm_cmd in
*dumpbin*)
echo "SKIP: $nm_cmd does not print nm-style output"
exit 0
;;
esac
pic_object=none
non_pic_object=none
. "./$lo"
dir=`dirname "$lo"`
status=0
checked=0
for obj in "$pic_object" "$non_pic_object"; do
test "$obj" = none && continue
checked=1
leaked=`$nm_cmd "$dir/$obj" | awk 'NF >= 3 && $2 ~ /^[A-TV-Z]$/ { print $3 }' | grep '^_*dl'`
if test -n "$leaked"; then
echo "FAIL: $dir/$obj defines these dlmalloc functions as external symbols:"
echo "$leaked" | sed 's/^/ /'
echo "Declare them static in src/closures.c, before it includes dlmalloc.c."
status=1
fi
done
if test $checked = 0; then
echo "FAIL: $lo names no object to check"
exit 1
fi
test $status = 0 && echo "PASS: no dlmalloc function in $lo is external"
exit $status
-1
View File
@@ -18,7 +18,6 @@ export LDFLAGS=" \
-sMODULARIZE \
-sMAIN_MODULE \
-sNO_DISABLE_EXCEPTION_CATCHING \
-sWASM_BIGINT \
$EXTRA_LD_FLAGS \
"
+2 -2
View File
@@ -7,8 +7,8 @@ fi
# Common compiler flags
export CFLAGS="-fPIC $EXTRA_CFLAGS"
export CXXFLAGS="$CFLAGS -sNO_DISABLE_EXCEPTION_CATCHING $EXTRA_CXXFLAGS"
export LDFLAGS="-sEXPORTED_FUNCTIONS=_main,_malloc,_free -sALLOW_TABLE_GROWTH -sASSERTIONS -sNO_DISABLE_EXCEPTION_CATCHING -sWASM_BIGINT -Wno-main"
export CXXFLAGS="$CFLAGS -fexceptions $EXTRA_CXXFLAGS"
export LDFLAGS="-sEXPORTED_FUNCTIONS=_main,_malloc,_free -sALLOW_TABLE_GROWTH -sASSERTIONS -Wno-main"
# Specific variables for cross-compilation
export CHOST="${TARGET_HOST}-unknown-linux" # wasm32-unknown-emscripten
+45
View File
@@ -29,6 +29,20 @@ proc check_effective_target_gccbug { } {
return $has_gccbug
}
# True when this is a powerpc64 linux target whose compiler makes long double
# 128 bits wide. A few tests pin -mlong-double-128 to exercise the IBM-128
# paths, but they may only do so when the library they link against was built
# the same way: the powerpc linker refuses to merge objects that disagree about
# the long double ABI. Probe the compiler rather than the target triplet, so a
# -mlong-double-64 build (musl's choice on ppc64le) drops the option and tests
# the 64-bit long double instead.
proc check_effective_target_ppc64_longdouble128 { } {
if { ![istarget powerpc64*-*-linux-gnu*] } {
return 0
}
return [libffi_feature_test "#if defined(__LONG_DOUBLE_128__)"]
}
# Return 1 if the target matches the effective target 'arg', 0 otherwise.
# This can be used with any check_* proc that takes no argument and
# returns only 1 or 0. It could be used with check_* procs that take
@@ -432,6 +446,8 @@ proc libffi_target_compile { source dest type options } {
}
} elseif { [string match "*android*" $target_triplet] } {
lappend options "libs= -lc++"
} elseif { [string match "wasm*-*" $target_triplet] } {
lappend options "additional_flags=-fexceptions"
}
}
@@ -447,10 +463,39 @@ proc libffi_target_compile { source dest type options } {
lappend options "libs= -lpthread"
}
# Newer clang warns about file-scope variables that are assigned
# but never read. Several tests do this deliberately.
if { [libffi_compiler_accepts_flag "-Wno-unused-but-set-global"] } {
lappend options "additional_flags=-Wno-unused-but-set-global"
}
verbose "options: $options"
return [target_compile $source $dest $type $options]
}
# Returns true if the compiler accepts FLAG without complaint. The
# result is cached, so the probe only runs once per flag.
proc libffi_compiler_accepts_flag { flag } {
global libffi_accepted_flags
if { [info exists libffi_accepted_flags($flag)] } {
return $libffi_accepted_flags($flag)
}
set src "ffiflag[pid].c"
set f [open $src "w"]
puts $f "int main() {return 0;}"
close $f
set lines [target_compile $src $src.i preprocess "additional_flags=$flag"]
file delete $src
file delete $src.i
set libffi_accepted_flags($flag) [string match "" $lines]
verbose "compiler accepts $flag: $libffi_accepted_flags($flag)"
return $libffi_accepted_flags($flag)
}
# TEST should be a preprocessor condition. Returns true if it holds.
proc libffi_feature_test { test } {
set src "ffitest[pid].c"
+3
View File
@@ -5,6 +5,9 @@
Originator: David Tenty <daltenty@ibm.com> */
/* { dg-do run } */
/* SPARC64 classifies array members differently from nested structures,
but libffi's documented array emulation has no distinct array tag. */
/* { dg-skip-if "array members are not representable in the SPARC64 ABI" { sparc64-*-* } } */
#include "ffitest.h"
static int i=5;
+3
View File
@@ -5,6 +5,9 @@
Originator: David Tenty <daltenty@ibm.com> */
/* { dg-do run } */
/* SPARC64 classifies array members differently from nested structures,
but libffi's documented array emulation has no distinct array tag. */
/* { dg-skip-if "array members are not representable in the SPARC64 ABI" { sparc64-*-* } } */
#include "ffitest.h"
static int i=5;
+56
View File
@@ -0,0 +1,56 @@
/* Area: ffi_prep_raw_closure_loc
Purpose: Check that a raw-API closure allocated with ffi_closure_alloc
is invoked correctly. With static trampolines the executable
code address differs from the closure data, and the raw API
passed the wrong one as the handler's user_data, so the handler
was read from read-only trampoline bytes and the closure made a
wild indirect call (GHSA-w6j9-w53f-2857). There was previously
no test for ffi_prep_raw_closure*.
Limitations: none.
PR: GHSA-w6j9-w53f-2857. */
/* { dg-do run { xfail i686-pc-cygwin } } */
/* XFAIL: the i686 MSVC native raw-closure path fails at execution; see
libffi issue #1074. */
#include "ffitest.h"
/* The raw API can be configured out (e.g. Emscripten builds with
--disable-raw-api), which drops ffi_prep_raw_closure_loc from the
library. Match raw_api.c's own guard so the test links there too. */
#if FFI_CLOSURES && !FFI_NO_RAW_API
static void
raw_handler (ffi_cif *cif, void *ret, ffi_raw *args, void *ud)
{
(void) cif;
*(ffi_arg *) ret = (ffi_arg) (args[0].sint + args[1].sint + (intptr_t) ud);
}
int
main (void)
{
ffi_cif cif;
ffi_type *args[2] = { &ffi_type_sint, &ffi_type_sint };
ffi_raw_closure *cl;
void *code;
int (*f) (int, int);
CHECK (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, args)
== FFI_OK);
cl = ffi_closure_alloc (sizeof (ffi_raw_closure), &code);
CHECK (cl != NULL);
CHECK (ffi_prep_raw_closure_loc (cl, &cif, raw_handler, (void *) 100, code)
== FFI_OK);
f = (int (*) (int, int)) code;
CHECK (f (20, 3) == 123);
ffi_closure_free (cl);
printf ("raw closure ok\n");
exit (0);
}
#else
int main (void) { return 0; }
#endif
+37
View File
@@ -0,0 +1,37 @@
/* Area: ffi_call
Purpose: Check that a void call ignores its return buffer.
Limitations: none. */
/* { dg-do run } */
#include "ffitest.h"
static unsigned int called;
static void
return_void (unsigned int value)
{
called = value;
}
int
main (void)
{
ffi_cif cif;
ffi_type *args[1] = { &ffi_type_uint };
unsigned int value = 42;
void *values[1] = { &value };
ffi_arg result = ~(ffi_arg)0;
CHECK(ffi_prep_cif (&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_void, args) == FFI_OK);
ffi_call (&cif, FFI_FN(return_void), &result, values);
CHECK(called == value);
CHECK(result == ~(ffi_arg)0);
value = 43;
ffi_call (&cif, FFI_FN(return_void), NULL, values);
CHECK(called == value);
exit (0);
}
+96
View File
@@ -0,0 +1,96 @@
/* Area: ffi_call, closure_call
Purpose: Check a small struct passed on the stack and the argument
following it.
Limitations: none.
PR: none. */
/* { dg-do run } */
#include "ffitest.h"
/* A two-byte struct after eight ints goes to the stack on targets with
eight argument registers, followed by a short that must land in the slot
the ABI assigns after the struct. */
typedef struct
{
unsigned char a;
unsigned char b;
} small_struct;
static int ABI_ATTR
f_stack (int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8,
small_struct s, short t)
{
return i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8
+ s.a * 10 + s.b * 100 + t * 1000;
}
#if FFI_CLOSURES
static void
cls_stack (ffi_cif *cif __UNUSED__, void *resp, void **args,
void *userdata __UNUSED__)
{
*(ffi_arg *) resp = f_stack (*(int *) args[0], *(int *) args[1],
*(int *) args[2], *(int *) args[3],
*(int *) args[4], *(int *) args[5],
*(int *) args[6], *(int *) args[7],
*(small_struct *) args[8],
*(short *) args[9]);
}
#endif
int
main (void)
{
ffi_cif cif;
ffi_type small_struct_type;
ffi_type *small_struct_elements[3];
ffi_type *types[10];
void *values[10];
#if FFI_CLOSURES
ffi_closure *pcl;
void *code;
#endif
int ints[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
small_struct s = { 3, 5 };
short t = 7;
ffi_arg result;
int i;
small_struct_elements[0] = &ffi_type_uchar;
small_struct_elements[1] = &ffi_type_uchar;
small_struct_elements[2] = NULL;
small_struct_type.size = 0;
small_struct_type.alignment = 0;
small_struct_type.type = FFI_TYPE_STRUCT;
small_struct_type.elements = small_struct_elements;
for (i = 0; i < 8; i++)
{
types[i] = &ffi_type_sint;
values[i] = &ints[i];
}
types[8] = &small_struct_type;
values[8] = &s;
types[9] = &ffi_type_sshort;
values[9] = &t;
CHECK (ffi_prep_cif (&cif, ABI_NUM, 10, &ffi_type_sint, types) == FFI_OK);
ffi_call (&cif, FFI_FN (f_stack), &result, values);
printf ("stack: %d\n", (int) result);
CHECK ((int) result == 7566);
#if FFI_CLOSURES
pcl = ffi_closure_alloc (sizeof (ffi_closure), &code);
CHECK (pcl != NULL);
CHECK (ffi_prep_closure_loc (pcl, &cif, cls_stack, NULL, code) == FFI_OK);
result = ((int (ABI_ATTR *) (int, int, int, int, int, int, int, int,
small_struct, short)) code)
(1, 2, 3, 4, 5, 6, 7, 8, s, t);
printf ("closure stack: %d\n", (int) result);
CHECK ((int) result == 7566);
ffi_closure_free (pcl);
#endif
exit (0);
}
+79
View File
@@ -0,0 +1,79 @@
/* Area: ffi_closure
Purpose: Check that a closure receives a 128-bit integer argument, and
the argument after it, correctly. On s390x the closure path
had no SINT128/UINT128 case, so it left the argument's avalue[]
slot uninitialised and shifted every later argument
(GHSA-wf8m-qr3x-cch4).
Limitations: none.
PR: GHSA-wf8m-qr3x-cch4. */
/* { dg-do run } */
#include "ffitest.h"
#if defined(FFI_TARGET_HAS_INT128) && defined(__SIZEOF_INT128__)
typedef __int128_t i128;
static const i128 VAL =
((i128)0x0102030405060708ull << 64) | 0x090a0b0c0d0e0f10ull;
#define TAIL 0x5a5a5a5aL
/* long f(i128 x, long b) => low64(x) + b */
static void h_xb (ffi_cif *cif, void *ret, void **args, void *ud)
{
i128 x = *(i128 *) args[0];
long b = *(long *) args[1];
(void) cif; (void) ud;
*(ffi_arg *) ret = (ffi_arg) ((long) x + b);
}
/* long g(long a, i128 x, long b) => a + low64(x) + b */
static void h_axb (ffi_cif *cif, void *ret, void **args, void *ud)
{
long a = *(long *) args[0];
i128 x = *(i128 *) args[1];
long b = *(long *) args[2];
(void) cif; (void) ud;
*(ffi_arg *) ret = (ffi_arg) (a + (long) x + b);
}
int main (void)
{
ffi_cif cif;
void *code;
ffi_closure *cl;
{
ffi_type *args[2] = { &ffi_type_sint128, &ffi_type_sint64 };
long (*f) (i128, long);
CHECK (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint64, args)
== FFI_OK);
cl = ffi_closure_alloc (sizeof (ffi_closure), &code);
CHECK (cl != NULL);
CHECK (ffi_prep_closure_loc (cl, &cif, h_xb, NULL, code) == FFI_OK);
f = (long (*) (i128, long)) code;
CHECK (f (VAL, TAIL) == (long) ((long) VAL + TAIL));
ffi_closure_free (cl);
}
{
ffi_type *args[3] =
{ &ffi_type_sint64, &ffi_type_sint128, &ffi_type_sint64 };
long (*g) (long, i128, long);
CHECK (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, 3, &ffi_type_sint64, args)
== FFI_OK);
cl = ffi_closure_alloc (sizeof (ffi_closure), &code);
CHECK (cl != NULL);
CHECK (ffi_prep_closure_loc (cl, &cif, h_axb, NULL, code) == FFI_OK);
g = (long (*) (long, i128, long)) code;
CHECK (g (11, VAL, TAIL) == (long) (11 + (long) VAL + TAIL));
ffi_closure_free (cl);
}
printf ("closure int128 ok\n");
exit (0);
}
#else
int main (void) { return 0; }
#endif
@@ -0,0 +1,62 @@
/* Area: closures */
/* { dg-do run { target x86_64-*-linux-gnu* } } */
/* { dg-options "-Wl,--export-dynamic" { target x86_64-*-linux-gnu* } } */
#define _GNU_SOURCE 1
#include "ffitest.h"
/* The Emscripten browser harness compiles every testcase and ignores the
dg-do target above. This test interposes mmap through RTLD_NEXT and needs
dlsym on a glibc/ELF system; on wasm, dlsym from an unopened handle aborts.
Guard the body so it is a harmless no-op anywhere it cannot run. */
#if defined(__GLIBC__)
#include <dlfcn.h>
#include <errno.h>
#include <sys/mman.h>
#include <unistd.h>
typedef void *(*mmap_fn) (void *, size_t, int, int, int, off_t);
static mmap_fn real_mmap;
static int reject_exec_mappings;
/* Model a hardened runtime that rejects every executable mapping. */
void *
mmap (void *addr, size_t length, int prot, int flags, int fd, off_t offset)
{
if (reject_exec_mappings && (prot & PROT_EXEC))
{
errno = EPERM;
return MAP_FAILED;
}
return real_mmap (addr, length, prot, flags, fd, offset);
}
int
main (void)
{
ffi_closure *closure;
void *code = NULL;
real_mmap = (mmap_fn) dlsym (RTLD_NEXT, "mmap");
CHECK (real_mmap != NULL);
reject_exec_mappings = 1;
/* The failure path must terminate instead of cycling through temporary
backing files forever. */
alarm (5);
closure = ffi_closure_alloc (sizeof (ffi_closure), &code);
alarm (0);
CHECK (closure == NULL);
CHECK (code == NULL);
exit (0);
}
#else
int main (void) { return 0; }
#endif
@@ -0,0 +1,62 @@
/* Area: ffi_closure_alloc, ffi_closure_free
Purpose: Churn the closure allocator across many live closures.
On targets that use the Darwin trampoline-table allocator
this spans several trampoline tables and exercises the
allocator's internal table list. Freeing a partially used
non-head table moved it to the head of the list without
unlinking it first, corrupting the doubly-linked list; a
later free then wrote through the stale links into freed
table memory, a heap use-after-free (GHSA-23hx-9rxv-9qfp).
The sequence is harmless on every other allocator.
Limitations: Only the Darwin trampoline-table allocator keeps such a
list, so elsewhere this is just an allocator stress test.
PR: GHSA-23hx-9rxv-9qfp */
/* { dg-do run } */
#include "ffitest.h"
/* Enough closures to span several trampoline tables on the Darwin
allocator (at most 1024 entries per table), so that the interleaved
free order below forces non-head tables to be bumped to the front of
the list and later emptied and freed. */
#define N 4096
int
main (void)
{
ffi_closure **closures;
void *code;
int round, i;
closures = malloc (N * sizeof (*closures));
CHECK (closures != NULL);
for (round = 0; round < 3; round++)
{
for (i = 0; i < N; i++)
{
code = NULL;
closures[i] = ffi_closure_alloc (sizeof (ffi_closure), &code);
CHECK (closures[i] != NULL);
CHECK (code != NULL);
}
/* Interleave the frees: the first pass returns one entry from
many different tables, bumping partially used non-head tables
to the head of the list; the second pass then empties and frees
tables while the list is in that state. Before the fix this
walked stale prev/next links and wrote into freed memory. */
for (i = 0; i < N; i += 2)
ffi_closure_free (closures[i]);
for (i = 1; i < N; i += 2)
ffi_closure_free (closures[i]);
}
free (closures);
printf ("closure trampoline table ok\n");
exit (0);
}
/* { dg-output "closure trampoline table ok" } */
@@ -5,7 +5,7 @@
Originator: <hos@tamanegi.org> 20031203 */
/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
/* { dg-options -mlong-double-128 { target powerpc64*-*-linux-gnu* } } */
/* { dg-options -mlong-double-128 { target ppc64_longdouble128 } } */
#include "ffitest.h"
@@ -6,7 +6,7 @@
*/
/* { dg-do run { xfail strongarm*-*-* } } */
/* { dg-options -mlong-double-128 { target powerpc64*-*-linux-gnu* } } */
/* { dg-options -mlong-double-128 { target ppc64_longdouble128 } } */
#include "ffitest.h"
+1 -1
View File
@@ -7,7 +7,7 @@
/* This test is known to PASS on armv7l-unknown-linux-gnueabihf, so I have
remove the xfail for arm*-*-* below, until we know more. */
/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
/* { dg-options -mlong-double-128 { target powerpc64*-*-linux-gnu* } } */
/* { dg-options -mlong-double-128 { target ppc64_longdouble128 } } */
#include "ffitest.h"
@@ -0,0 +1,102 @@
/* Area: ffi_call, closure_call
Purpose: Check return values of structs with one or two floating-point
fields.
Limitations: none.
PR: none. */
/* { dg-do run { xfail mips64*-*-* } } */
/* XFAIL: mips N64 ABI bug in complex-float/longdouble args and fp-struct
returns; see libffi issue #1071. */
#include "ffitest.h"
/* Several ABIs return these structs in floating-point registers, or with
soft float in pairs of GPRs that differ from those used for other small
structs, so they need their own return paths in ffi_call and in
closures. */
typedef struct { float a; } s_f;
typedef struct { double a; } s_d;
typedef struct { float a; float b; } s_ff;
typedef struct { double a; double b; } s_dd;
typedef struct { float a; double b; } s_fd;
typedef struct { double a; float b; } s_df;
#define DEFINE(name, eq, ...) \
static name ABI_ATTR \
fn_##name (int k) \
{ \
name r = { __VA_ARGS__ }; \
return r; \
} \
\
static void \
cls_##name (ffi_cif *cif __UNUSED__, void *resp, void **argv, \
void *userdata __UNUSED__) \
{ \
*(name *) resp = fn_##name (*(int *) argv[0]); \
} \
\
static int \
eq_##name (name x, name y) \
{ \
return eq; \
}
#define EQ1 (x.a == y.a)
#define EQ2 (x.a == y.a && x.b == y.b)
DEFINE (s_f, EQ1, 1.5f * k)
DEFINE (s_d, EQ1, 2.5 * k)
DEFINE (s_ff, EQ2, 1.5f * k, -0.25f * k)
DEFINE (s_dd, EQ2, 2.5 * k, -0.75 * k)
DEFINE (s_fd, EQ2, 1.5f * k, -0.75 * k)
DEFINE (s_df, EQ2, 2.5 * k, -0.25f * k)
#define CHECK_ONE(name, type1, type2) \
do { \
ffi_type *elements[3] = { type1, type2, NULL }; \
ffi_type type; \
ffi_type *args[1] = { &ffi_type_sint }; \
void *values[1] = { &k }; \
ffi_cif cif; \
ffi_closure *pcl; \
void *code; \
union { ffi_arg align; name value; } result; \
name want = fn_##name (k), got; \
\
type.size = 0; \
type.alignment = 0; \
type.type = FFI_TYPE_STRUCT; \
type.elements = elements; \
CHECK (ffi_prep_cif (&cif, ABI_NUM, 1, &type, args) == FFI_OK); \
\
memset (&result, 0, sizeof (result)); \
ffi_call (&cif, FFI_FN (fn_##name), &result, values); \
CHECK (eq_##name (result.value, want)); \
\
pcl = ffi_closure_alloc (sizeof (ffi_closure), &code); \
CHECK (pcl != NULL); \
CHECK (ffi_prep_closure_loc (pcl, &cif, cls_##name, NULL, code) \
== FFI_OK); \
memset (&got, 0, sizeof (got)); \
got = ((name (ABI_ATTR *)(int)) code) (k); \
CHECK (eq_##name (got, want)); \
ffi_closure_free (pcl); \
printf ("%s: ok\n", #name); \
} while (0)
int
main (void)
{
int k = 3;
CHECK_ONE (s_f, &ffi_type_float, NULL);
CHECK_ONE (s_d, &ffi_type_double, NULL);
CHECK_ONE (s_ff, &ffi_type_float, &ffi_type_float);
CHECK_ONE (s_dd, &ffi_type_double, &ffi_type_double);
CHECK_ONE (s_fd, &ffi_type_float, &ffi_type_double);
CHECK_ONE (s_df, &ffi_type_double, &ffi_type_float);
exit (0);
}
@@ -0,0 +1,66 @@
/* Area: ffi_call, closure_call
Purpose: Check the return value of a struct with one long double field.
Limitations: none.
PR: none. */
/* { dg-do run { xfail mips64*-*-* x86_64-*-linux-android* } } */
/* XFAIL: mips N64 mishandles long-double struct returns (libffi issue
#1071). x86_64 Android mishandles the long-double struct return where
x86_64-linux-gnu does not (libffi issue #1076). */
/* { dg-options -mlong-double-128 { target ppc64_longdouble128 } } */
#include "ffitest.h"
/* x86-64 returns this struct in %st(0), like a plain long double. */
typedef struct { long double a; } s_ld;
static s_ld ABI_ATTR
fn_s_ld (int k)
{
s_ld r = { 1.5L * k };
return r;
}
static void
cls_s_ld (ffi_cif *cif __UNUSED__, void *resp, void **argv,
void *userdata __UNUSED__)
{
*(s_ld *) resp = fn_s_ld (*(int *) argv[0]);
}
int
main (void)
{
ffi_type *elements[2] = { &ffi_type_longdouble, NULL };
ffi_type type;
ffi_type *args[1] = { &ffi_type_sint };
int k = 3;
void *values[1] = { &k };
ffi_cif cif;
ffi_closure *pcl;
void *code;
s_ld got;
type.size = 0;
type.alignment = 0;
type.type = FFI_TYPE_STRUCT;
type.elements = elements;
CHECK (ffi_prep_cif (&cif, ABI_NUM, 1, &type, args) == FFI_OK);
memset (&got, 0, sizeof (got));
ffi_call (&cif, FFI_FN (fn_s_ld), &got, values);
printf ("ffi_call: %Lg\n", got.a);
CHECK (got.a == 4.5L);
pcl = ffi_closure_alloc (sizeof (ffi_closure), &code);
CHECK (pcl != NULL);
CHECK (ffi_prep_closure_loc (pcl, &cif, cls_s_ld, NULL, code) == FFI_OK);
memset (&got, 0, sizeof (got));
got = ((s_ld (ABI_ATTR *)(int)) code) (k + 1);
printf ("closure: %Lg\n", got.a);
CHECK (got.a == 6.0L);
ffi_closure_free (pcl);
exit (0);
}
+1 -1
View File
@@ -6,7 +6,7 @@
*/
/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
/* { dg-options -mlong-double-128 { target powerpc64*-*-linux-gnu* } } */
/* { dg-options -mlong-double-128 { target ppc64_longdouble128 } } */
/* { dg-options -Wformat=0 { target moxie*-*-elf or1k-*-* } } */
#include <inttypes.h>
+170
View File
@@ -0,0 +1,170 @@
/* Area: ffi_call, closure_call
Purpose: Check integer complex types smaller than a register.
Limitations: none.
PR: none. */
/* { dg-do run } */
#include "ffitest.h"
#include <complex.h>
/* _Complex signed char and _Complex short are passed and returned in a
single register or stack slot on most targets, which for complex values
is a different code path from the larger types. The last function
passes both after eight ints, so that they go to the stack on targets
with eight argument registers. */
#define FFI_COMPLEX_TYPEDEF(name, type, ffitype) \
static ffi_type *ffi_elements_complex_##name [2] = { \
(ffi_type *)(&ffitype), NULL \
}; \
struct struct_align_complex_##name { \
char c; \
_Complex type x; \
}; \
static ffi_type ffi_type_complex_##name = { \
sizeof(_Complex type), \
offsetof(struct struct_align_complex_##name, x), \
FFI_TYPE_COMPLEX, \
(ffi_type **)ffi_elements_complex_##name \
}
FFI_COMPLEX_TYPEDEF(schar, signed char, ffi_type_schar);
FFI_COMPLEX_TYPEDEF(sshort, short, ffi_type_sshort);
typedef _Complex signed char cc;
typedef _Complex short cs;
/* ffi_call requires its return storage to be at least register-sized and
suitably aligned, even when the declared return type is smaller. */
typedef union
{
ffi_arg align;
cc cchar;
cs cshort;
} complex_result;
static cc
f_cc (cc a, int k)
{
__real__ a = __real__ a * k;
__imag__ a = __imag__ a - k;
return a;
}
static cs
f_cs (cs a, int k)
{
__real__ a = __real__ a * k;
__imag__ a = __imag__ a - k;
return a;
}
static cs
f_stack (int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8,
cc a, cs b)
{
__real__ b = __real__ b + __real__ a + i1 + i2 + i3 + i4;
__imag__ b = __imag__ b + __imag__ a + i5 + i6 + i7 + i8;
return b;
}
static void
cls_cc (ffi_cif *cif __UNUSED__, void *resp, void **args,
void *userdata __UNUSED__)
{
*(cc *) resp = f_cc (*(cc *) args[0], *(int *) args[1]);
}
static void
cls_cs (ffi_cif *cif __UNUSED__, void *resp, void **args,
void *userdata __UNUSED__)
{
*(cs *) resp = f_cs (*(cs *) args[0], *(int *) args[1]);
}
static void
cls_stack (ffi_cif *cif __UNUSED__, void *resp, void **args,
void *userdata __UNUSED__)
{
*(cs *) resp = f_stack (*(int *) args[0], *(int *) args[1],
*(int *) args[2], *(int *) args[3],
*(int *) args[4], *(int *) args[5],
*(int *) args[6], *(int *) args[7],
*(cc *) args[8], *(cs *) args[9]);
}
int
main (void)
{
ffi_cif cif;
ffi_type *types[10];
void *values[10];
ffi_closure *pcl;
void *code;
int ints[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
cc a, ra;
cs b, rb;
complex_result result;
int k = 3, i;
pcl = ffi_closure_alloc (sizeof (ffi_closure), &code);
CHECK (pcl != NULL);
__real__ a = 5;
__imag__ a = -7;
__real__ b = 300;
__imag__ b = -400;
types[0] = &ffi_type_complex_schar;
types[1] = &ffi_type_sint;
values[0] = &a;
values[1] = &k;
CHECK (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, 2, &ffi_type_complex_schar,
types) == FFI_OK);
ffi_call (&cif, FFI_FN (f_cc), &result, values);
ra = result.cchar;
printf ("cc: %d,%di\n", (int) __real__ ra, (int) __imag__ ra);
CHECK (__real__ ra == 15 && __imag__ ra == -10);
CHECK (ffi_prep_closure_loc (pcl, &cif, cls_cc, NULL, code) == FFI_OK);
ra = ((cc (*)(cc, int)) code) (a, k);
printf ("closure cc: %d,%di\n", (int) __real__ ra, (int) __imag__ ra);
CHECK (__real__ ra == 15 && __imag__ ra == -10);
types[0] = &ffi_type_complex_sshort;
values[0] = &b;
CHECK (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, 2, &ffi_type_complex_sshort,
types) == FFI_OK);
ffi_call (&cif, FFI_FN (f_cs), &result, values);
rb = result.cshort;
printf ("cs: %d,%di\n", (int) __real__ rb, (int) __imag__ rb);
CHECK (__real__ rb == 900 && __imag__ rb == -403);
CHECK (ffi_prep_closure_loc (pcl, &cif, cls_cs, NULL, code) == FFI_OK);
rb = ((cs (*)(cs, int)) code) (b, k);
printf ("closure cs: %d,%di\n", (int) __real__ rb, (int) __imag__ rb);
CHECK (__real__ rb == 900 && __imag__ rb == -403);
for (i = 0; i < 8; i++)
{
types[i] = &ffi_type_sint;
values[i] = &ints[i];
}
types[8] = &ffi_type_complex_schar;
values[8] = &a;
types[9] = &ffi_type_complex_sshort;
values[9] = &b;
CHECK (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, 10, &ffi_type_complex_sshort,
types) == FFI_OK);
ffi_call (&cif, FFI_FN (f_stack), &result, values);
rb = result.cshort;
printf ("stack: %d,%di\n", (int) __real__ rb, (int) __imag__ rb);
CHECK (__real__ rb == 315 && __imag__ rb == -381);
CHECK (ffi_prep_closure_loc (pcl, &cif, cls_stack, NULL, code) == FFI_OK);
rb = ((cs (*)(int, int, int, int, int, int, int, int, cc, cs)) code)
(1, 2, 3, 4, 5, 6, 7, 8, a, b);
printf ("closure stack: %d,%di\n", (int) __real__ rb, (int) __imag__ rb);
CHECK (__real__ rb == 315 && __imag__ rb == -381);
ffi_closure_free (pcl);
exit (0);
}
@@ -0,0 +1,68 @@
/* Area: ffi_prep_types
Purpose: Check that _Complex long double follows the abi's long double width.
Limitations: powerpc64 only -- the one target where long double has more
than one width at run time.
PR: none.
Originator: Anthony Green 20260916 */
/* { dg-do run { target powerpc64*-*-linux-gnu* } } */
#include "ffitest.h"
/* ffi_prep_cif() and ffi_get_struct_offsets() resize ffi_type_longdouble to
match the FFI_LINUX_LONG_DOUBLE_128 bit of the abi they are handed, so that
one libffi can describe calls into libraries built with either width. That
is also why these two types, alone among the ffi_type objects, are not
const. ffi_type_complex_longdouble has to keep up: two halves of whatever
long double currently is. */
static void
check_width (ffi_abi abi, size_t ld_size, unsigned short ld_align)
{
ffi_cif cif;
ffi_type *args[1];
ffi_type *elements[2];
ffi_type s;
size_t offsets[1];
args[0] = &ffi_type_complex_longdouble;
CHECK (ffi_prep_cif (&cif, abi, 1, &ffi_type_complex_longdouble, args)
== FFI_OK);
CHECK (ffi_type_longdouble.size == ld_size);
CHECK (ffi_type_longdouble.alignment == ld_align);
CHECK (ffi_type_complex_longdouble.size == 2 * ld_size);
CHECK (ffi_type_complex_longdouble.alignment == ld_align);
CHECK (ffi_type_complex_longdouble.elements[0]->size == ld_size);
/* A struct built out of that type has to come out the same size, which is
what ffi_get_struct_offsets() and every struct-passing path rely on. */
elements[0] = &ffi_type_complex_longdouble;
elements[1] = NULL;
s.size = 0;
s.alignment = 0;
s.type = FFI_TYPE_STRUCT;
s.elements = elements;
CHECK (ffi_get_struct_offsets (abi, &s, offsets) == FFI_OK);
CHECK (s.size == 2 * ld_size);
CHECK (offsets[0] == 0);
}
int
main (void)
{
size_t native = (FFI_DEFAULT_ABI & FFI_LINUX_LONG_DOUBLE_128) ? 16 : 8;
/* A 64-bit long double, as musl selects on ppc64le. */
check_width ((ffi_abi) FFI_LINUX, 8, 8);
/* A 128-bit long double, either IBM-128 or IEEE-128. */
check_width ((ffi_abi) (FFI_LINUX | FFI_LINUX_LONG_DOUBLE_128), 16, 16);
/* Leave the globals as this build's default abi found them. */
check_width (FFI_DEFAULT_ABI, native, (unsigned short) native);
printf ("success\n");
exit (0);
}
/* { dg-output "success" } */
+142
View File
@@ -0,0 +1,142 @@
/* -*-c-*- */
#include "ffitest.h"
#include <complex.h>
/* A complex argument that arrives when the argument registers are nearly
used up. Seven doubles leave one floating-point argument register on
RISC-V and LoongArch, so the complex value has to move to integer
registers as a whole. Five ints leave an odd number of GPRs on 32-bit
PowerPC, where a two-word complex skips to the next even register pair
and a larger one goes to the stack, followed by every later argument.
Eight doubles and eight ints push the complex value onto the stack on
every target. */
typedef _Complex T_C_TYPE C;
static C
fn_d7 (double d1, double d2, double d3, double d4, double d5, double d6,
double d7, C c, int k)
{
return c * k + (d1 + d2 + d3 + d4 + d5 + d6 + d7);
}
static C
fn_i5 (int i1, int i2, int i3, int i4, int i5, C c, int k)
{
return c * k + (i1 + i2 + i3 + i4 + i5);
}
static C
fn_d8i8 (double d1, double d2, double d3, double d4, double d5, double d6,
double d7, double d8, int i1, int i2, int i3, int i4, int i5, int i6,
int i7, int i8, C c, int k)
{
return c * k + (d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8
+ i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8);
}
/* SHAPE[0] doubles, SHAPE[1] ints, then the complex value and an int. */
static void
cls_fn (ffi_cif *cif __UNUSED__, void *resp, void **args, void *userdata)
{
const int *shape = (const int *) userdata;
T_C_TYPE s = 0;
int i, n = 0;
for (i = 0; i < shape[0]; i++)
s += *(double *) args[n++];
for (i = 0; i < shape[1]; i++)
s += *(int *) args[n++];
*(C *) resp = *(C *) args[n] * *(int *) args[n + 1] + s;
}
static void
check (const char *name, C got, C want)
{
printf ("%s: %.3f,%.3fi (want %.3f,%.3fi)\n", name,
T_CONV creal (got), T_CONV cimag (got),
T_CONV creal (want), T_CONV cimag (want));
CHECK (creal (got) == creal (want));
CHECK (cimag (got) == cimag (want));
}
static void
prep (ffi_cif *cif, ffi_type **types, void **values, int nd, int ni,
double *d, int *i, C *c, int *k)
{
int j, n = 0;
for (j = 0; j < nd; j++, n++)
{
types[n] = &ffi_type_double;
values[n] = &d[j];
}
for (j = 0; j < ni; j++, n++)
{
types[n] = &ffi_type_sint;
values[n] = &i[j];
}
types[n] = &T_FFI_TYPE;
values[n++] = c;
types[n] = &ffi_type_sint;
values[n++] = k;
CHECK (ffi_prep_cif (cif, FFI_DEFAULT_ABI, n, &T_FFI_TYPE, types) == FFI_OK);
}
int
main (void)
{
static const int shape_d7[2] = { 7, 0 };
static const int shape_i5[2] = { 0, 5 };
static const int shape_d8i8[2] = { 8, 8 };
double d[8] = { 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5 };
int i[8] = { 10, 20, 30, 40, 50, 60, 70, 80 };
C c = 1.25 + 2.5 * I;
int k = 77;
ffi_type *types[18];
void *values[18];
ffi_cif cif;
ffi_closure *pcl;
void *code;
C r;
pcl = ffi_closure_alloc (sizeof (ffi_closure), &code);
CHECK (pcl != NULL);
prep (&cif, types, values, 7, 0, d, i, &c, &k);
ffi_call (&cif, FFI_FN (fn_d7), &r, values);
check ("call d7", r, fn_d7 (d[0], d[1], d[2], d[3], d[4], d[5], d[6], c, k));
CHECK (ffi_prep_closure_loc (pcl, &cif, cls_fn, (void *) shape_d7, code)
== FFI_OK);
r = ((C (*)(double, double, double, double, double, double, double, C,
int)) code) (d[0], d[1], d[2], d[3], d[4], d[5], d[6], c, k);
check ("closure d7", r,
fn_d7 (d[0], d[1], d[2], d[3], d[4], d[5], d[6], c, k));
prep (&cif, types, values, 0, 5, d, i, &c, &k);
ffi_call (&cif, FFI_FN (fn_i5), &r, values);
check ("call i5", r, fn_i5 (i[0], i[1], i[2], i[3], i[4], c, k));
CHECK (ffi_prep_closure_loc (pcl, &cif, cls_fn, (void *) shape_i5, code)
== FFI_OK);
r = ((C (*)(int, int, int, int, int, C, int)) code)
(i[0], i[1], i[2], i[3], i[4], c, k);
check ("closure i5", r, fn_i5 (i[0], i[1], i[2], i[3], i[4], c, k));
prep (&cif, types, values, 8, 8, d, i, &c, &k);
ffi_call (&cif, FFI_FN (fn_d8i8), &r, values);
check ("call d8i8", r,
fn_d8i8 (d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7],
i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], c, k));
CHECK (ffi_prep_closure_loc (pcl, &cif, cls_fn, (void *) shape_d8i8, code)
== FFI_OK);
r = ((C (*)(double, double, double, double, double, double, double, double,
int, int, int, int, int, int, int, int, C, int)) code)
(d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7],
i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], c, k);
check ("closure d8i8", r,
fn_d8i8 (d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7],
i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7], c, k));
ffi_closure_free (pcl);
exit (0);
}
@@ -0,0 +1,11 @@
/* Area: ffi_call, closure_call
Purpose: Check complex arguments after the argument registers run low.
Limitations: none.
PR: none. */
/* { dg-do run { xfail mips64*-*-* } } */
/* XFAIL: mips N64 complex-argument ABI bug; the little-endian variant
fails the complex-double case too. See libffi issue #1071. */
#include "complex_defs_double.inc"
#include "complex_regs.inc"
@@ -0,0 +1,11 @@
/* Area: ffi_call, closure_call
Purpose: Check complex arguments after the argument registers run low.
Limitations: none.
PR: none. */
/* { dg-do run { xfail mips64*-*-* } } */
/* XFAIL: mips N64 ABI bug in complex-float/longdouble args and fp-struct
returns; see libffi issue #1071. */
#include "complex_defs_float.inc"
#include "complex_regs.inc"
@@ -0,0 +1,11 @@
/* Area: ffi_call, closure_call
Purpose: Check complex arguments after the argument registers run low.
Limitations: none.
PR: none. */
/* { dg-do run { xfail mips64*-*-* } } */
/* XFAIL: mips N64 ABI bug in complex-float/longdouble args and fp-struct
returns; see libffi issue #1071. */
#include "complex_defs_longdouble.inc"
#include "complex_regs.inc"
+61
View File
@@ -0,0 +1,61 @@
#!/bin/sh
set -eu
srcdir=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd)
test_root=$(mktemp -d "${TMPDIR:-/tmp}/libffi-libdir.XXXXXX")
trap 'rm -rf "$test_root"' EXIT HUP INT TERM
cat > "$test_root/cc" <<'EOF'
#!/bin/sh
for arg do
if test "$arg" = -print-multi-os-directory; then
echo ../lib64
exit 0
fi
done
exec gcc "$@"
EOF
chmod +x "$test_root/cc"
mkdir "$test_root/default" "$test_root/disabled"
(
cd "$test_root/default"
CC="$test_root/cc" "$srcdir/configure" --disable-builddir >/dev/null
)
grep -Fqx 'toolexeclibdir = ${libdir}/../lib64' \
"$test_root/default/Makefile"
(
cd "$test_root/disabled"
CC="$test_root/cc" "$srcdir/configure" --disable-builddir \
--disable-multi-os-directory >/dev/null
)
grep -Fqx 'toolexeclibdir = ${libdir}' "$test_root/disabled/Makefile"
check_explicit_libdir()
{
name=$1
shift
builddir="$test_root/$name"
mkdir "$builddir"
(
cd "$builddir"
CC="$test_root/cc" "$srcdir/configure" --disable-builddir "$@" \
>/dev/null
)
grep -Fqx 'libdir = /test/custom lib' "$builddir/Makefile"
grep -Fqx 'toolexeclibdir = ${libdir}' "$builddir/Makefile"
}
# Keep this list synchronized with the libdir spellings accepted by the
# generated configure option parser.
check_explicit_libdir long-equals '--libdir=/test/custom lib'
check_explicit_libdir long-separate --libdir '/test/custom lib'
check_explicit_libdir libdi-equals '--libdi=/test/custom lib'
check_explicit_libdir libdi-separate --libdi '/test/custom lib'
check_explicit_libdir libd-equals '--libd=/test/custom lib'
check_explicit_libdir libd-separate --libd '/test/custom lib'
check_explicit_libdir single-equals '-libdir=/test/custom lib'
check_explicit_libdir single-separate -libdir '/test/custom lib'
+175
View File
@@ -0,0 +1,175 @@
/* Area: closure_call
Purpose: Check that a closure handler can suspend with JSPI.
Limitations: Emscripten only, needs -sJSPI and a JSPI-enabled engine.
PR: none.
Originator: Hood Chatham 20260912 */
/* { dg-do run { target wasm*-*-* } } */
#include "ffitest.h"
#include <emscripten.h>
/* JSPI suspends the whole wasm stack while the promise is pending. That
only works if every frame between the JSPI entry point (main) and the
suspending import is a wasm frame, so the closure trampoline must not
be a JS function. Exercise each kind of trampoline epilogue: void,
return-by-pointer (struct), i32, i64, f32, f64. */
EM_ASYNC_JS(int, async_add_one, (int x), {
await new Promise(resolve => setTimeout(resolve, 1));
return x + 1;
});
static int n_calls = 0;
typedef struct { double a; int b; long long c; } big_t;
static void int_fn(ffi_cif *cif __UNUSED__, void *ret, void **args,
void *userdata)
{
int x = *(int *)args[0];
short y = *(short *)args[1];
n_calls++;
*(ffi_arg *)ret = async_add_one(x) * 10 + y + *(int *)userdata;
}
static void double_fn(ffi_cif *cif __UNUSED__, void *ret, void **args,
void *userdata __UNUSED__)
{
n_calls++;
*(double *)ret = async_add_one((int)*(double *)args[0]) + 0.5;
}
static void float_fn(ffi_cif *cif __UNUSED__, void *ret, void **args,
void *userdata __UNUSED__)
{
n_calls++;
*(float *)ret = async_add_one((int)*(float *)args[0]) + 0.25f;
}
static void i64_fn(ffi_cif *cif __UNUSED__, void *ret, void **args,
void *userdata __UNUSED__)
{
long long x = *(long long *)args[0];
n_calls++;
*(long long *)ret = ((long long)async_add_one((int)x) << 40) | 7;
}
static void struct_fn(ffi_cif *cif __UNUSED__, void *ret, void **args,
void *userdata __UNUSED__)
{
big_t in = *(big_t *)args[0];
big_t *out = ret;
n_calls++;
out->a = in.a * 2;
out->b = async_add_one(in.b);
out->c = in.c + 1;
}
static void void_fn(ffi_cif *cif __UNUSED__, void *ret __UNUSED__,
void **args, void *userdata)
{
n_calls++;
*(int *)userdata = async_add_one(*(int *)args[0]);
}
int main (void)
{
ffi_cif cif;
void *code;
ffi_closure *pcl;
int ud = 1000;
/* int f(int, short) */
{
ffi_type *cl_arg_types[] = { &ffi_type_sint, &ffi_type_sshort };
int (*f)(int, short);
pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2,
&ffi_type_sint, cl_arg_types) == FFI_OK);
CHECK(ffi_prep_closure_loc(pcl, &cif, int_fn, &ud, code) == FFI_OK);
f = code;
CHECK(f(4, 3) == 50 + 3 + 1000);
CHECK(f(-2, -1) == -10 - 1 + 1000);
/* Nested: a suspending closure call inside the arguments of another. */
CHECK(f(f(0, 0) - 1000, 1) == 110 + 1 + 1000);
ffi_closure_free(pcl);
}
/* double f(double) */
{
ffi_type *cl_arg_types[] = { &ffi_type_double };
double (*f)(double);
pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_double, cl_arg_types) == FFI_OK);
CHECK(ffi_prep_closure_loc(pcl, &cif, double_fn, NULL, code) == FFI_OK);
f = code;
CHECK(f(2.0) == 3.5);
ffi_closure_free(pcl);
}
/* float f(float) */
{
ffi_type *cl_arg_types[] = { &ffi_type_float };
float (*f)(float);
pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_float, cl_arg_types) == FFI_OK);
CHECK(ffi_prep_closure_loc(pcl, &cif, float_fn, NULL, code) == FFI_OK);
f = code;
CHECK(f(2.0f) == 3.25f);
ffi_closure_free(pcl);
}
/* long long f(long long) */
{
ffi_type *cl_arg_types[] = { &ffi_type_sint64 };
long long (*f)(long long);
pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_sint64, cl_arg_types) == FFI_OK);
CHECK(ffi_prep_closure_loc(pcl, &cif, i64_fn, NULL, code) == FFI_OK);
f = code;
CHECK(f(5) == ((6LL << 40) | 7));
ffi_closure_free(pcl);
}
/* big_t f(big_t): returned through a pointer argument. */
{
ffi_type *elements[] = { &ffi_type_double, &ffi_type_sint,
&ffi_type_sint64, NULL };
ffi_type big = { 0, 0, FFI_TYPE_STRUCT, elements };
ffi_type *cl_arg_types[] = { &big };
big_t (*f)(big_t);
big_t in = { 1.5, 10, 1LL << 33 };
big_t out;
pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &big, cl_arg_types) == FFI_OK);
CHECK(ffi_prep_closure_loc(pcl, &cif, struct_fn, NULL, code) == FFI_OK);
f = code;
out = f(in);
CHECK(out.a == 3.0);
CHECK(out.b == 11);
CHECK(out.c == (1LL << 33) + 1);
ffi_closure_free(pcl);
}
/* void f(int) */
{
ffi_type *cl_arg_types[] = { &ffi_type_sint };
void (*f)(int);
int result = 0;
pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_void, cl_arg_types) == FFI_OK);
CHECK(ffi_prep_closure_loc(pcl, &cif, void_fn, &result, code) == FFI_OK);
f = code;
f(41);
CHECK(result == 42);
ffi_closure_free(pcl);
}
printf("%d closure calls\n", n_calls);
/* { dg-output "9 closure calls" } */
exit(0);
}
+1
View File
@@ -0,0 +1 @@
#include "../libffi.call/ffitest.h"
+42
View File
@@ -0,0 +1,42 @@
# Copyright (C) 2003, 2006, 2009, 2010, 2014, 2019 Free Software Foundation, Inc.
# Copyright (C) 2019 Anthony Green
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
# Tests for Emscripten's JavaScript Promise Integration (JSPI). These
# build with -sJSPI and need a JS engine with JSPI enabled to run.
dg-init
libffi-init
global srcdir subdir
set tlist [lsort [glob -nocomplain -- $srcdir/$subdir/*.c]]
# JSPI only exists on Emscripten. emcc warns that -sJSPI is experimental,
# which would otherwise count as an excess error.
if { [istarget "wasm*-*-*"] } {
run-many-tests $tlist "-sJSPI -Wno-experimental"
} else {
foreach test $tlist {
unsupported "$test"
}
}
dg-finish
# Local Variables:
# tcl-indent-level:4
# End:
+11 -3
View File
@@ -8,6 +8,8 @@
#define NUM_THREADS 20
static char thread_failure;
#if defined(_POSIX_BARRIERS) && _POSIX_BARRIERS > 0
pthread_barrier_t barrier;
#endif
@@ -30,14 +32,14 @@ void *thread_func(void *arg) {
if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_float, args) != FFI_OK) {
fprintf(stderr, "ffi_prep_cif failed\n");
return NULL;
return &thread_failure;
}
ffi_closure *closure = ffi_closure_alloc(sizeof(ffi_closure), (void **)&arg);
if (ffi_prep_closure_loc(closure, &cif, callback, NULL, arg) != FFI_OK) {
fprintf(stderr, "ffi_prep_closure_loc failed\n");
return NULL;
return &thread_failure;
}
callback_fn fn = (callback_fn)arg;
@@ -62,7 +64,13 @@ int main() {
}
for (int i = 0; i < NUM_THREADS; ++i) {
pthread_join(threads[i], NULL);
void *result;
if (pthread_join(threads[i], &result) != 0) {
fprintf(stderr, "pthread_join failed\n");
exit(EXIT_FAILURE);
}
if (result == &thread_failure)
exit(EXIT_FAILURE);
}
#if defined(_POSIX_BARRIERS) && _POSIX_BARRIERS > 0
+8 -1
View File
@@ -27,7 +27,8 @@ main (void)
void *values[2];
f32x4 a = { 1, 2, 3, 4 };
f32x4 b = { 10, 20, 30, 40 };
f32x4 r, ref;
f32x4 r, rp, ref;
ffi_call_plan *plan;
int i;
make_vector_type (&vec_type, vec_elems, &ffi_type_float, 4);
@@ -43,11 +44,17 @@ main (void)
ffi_call (&cif, FFI_FN (add_f32x4), &r, values);
plan = ffi_call_plan_alloc (&cif);
CHECK (plan != NULL);
ffi_call_plan_invoke (plan, FFI_FN (add_f32x4), &rp, values);
ffi_call_plan_free (plan);
ref = add_f32x4 (a, b);
for (i = 0; i < 4; i++)
{
printf ("r[%d] = %g (want %g)\n", i, (double) r[i], (double) ref[i]);
CHECK (r[i] == ref[i]);
CHECK (rp[i] == ref[i]);
}
exit (0);
@@ -0,0 +1,105 @@
/* Area: ffi_prep_cif
Purpose: On x86-64 System V, reject vector types whose calling
convention is undefined (so GCC and Clang disagree) with
FFI_BAD_TYPEDEF, while still accepting the shapes both
compilers agree on. Rejecting <1 x double> closes a
type-confusion that turned a caller's integer argument into
the store address of the return value (GHSA-5pc3-hr6f-q3mm).
Limitations: The classification is x86-64 System V specific, so the
assertions only run there; the test passes trivially on
other targets and ABIs.
PR: GHSA-5pc3-hr6f-q3mm.
Originator: libffi vector support. */
/* { dg-do run } */
#include "vector.h"
#if defined(__x86_64__) && !defined(_WIN64) && !defined(__CYGWIN__)
/* Expect ffi_prep_cif for RET f(ARG) to return STATUS. Either type may be
NULL to mean "no argument" / void return as appropriate. */
static void
check_cif (ffi_type *ret, ffi_type *arg, ffi_status expected)
{
ffi_cif cif;
ffi_type *args[1];
unsigned nargs = 0;
if (arg != NULL)
{
args[0] = arg;
nargs = 1;
}
CHECK (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, nargs,
ret ? ret : &ffi_type_void, args) == expected);
}
int
main (void)
{
ffi_type vt, vt2;
ffi_type *elems[17], *elems2[17];
ffi_type *selems[2];
ffi_type st;
/* --- Shapes with an undefined ABI: must be rejected. --- */
/* <1 x double> (8 bytes): GCC returns/passes it in memory, Clang in %xmm0.
This is the one that produced the out-of-bounds write. */
make_vector_type (&vt, elems, &ffi_type_double, 1);
check_cif (&vt, NULL, FFI_BAD_TYPEDEF); /* as return value */
check_cif (NULL, &vt, FFI_BAD_TYPEDEF); /* as argument */
/* <1 x float> (4 bytes): GCC memory, Clang INTEGER (%eax). */
make_vector_type (&vt, elems, &ffi_type_float, 1);
check_cif (NULL, &vt, FFI_BAD_TYPEDEF);
/* <4 x uint8> (4 bytes): sub-8-byte, unspecified. */
make_vector_type (&vt, elems, &ffi_type_uint8, 4);
check_cif (NULL, &vt, FFI_BAD_TYPEDEF);
/* A struct that contains <1 x double> must be rejected recursively. */
make_vector_type (&vt, elems, &ffi_type_double, 1);
selems[0] = &vt;
selems[1] = NULL;
st.size = 0;
st.alignment = 0;
st.type = FFI_TYPE_STRUCT;
st.elements = selems;
check_cif (&st, NULL, FFI_BAD_TYPEDEF);
check_cif (NULL, &st, FFI_BAD_TYPEDEF);
/* --- Shapes both compilers agree on: must still be accepted. --- */
/* <2 x float> (8 bytes, not <1 x double>) -> SSE on GCC and Clang. */
make_vector_type (&vt, elems, &ffi_type_float, 2);
check_cif (&vt, NULL, FFI_OK);
check_cif (NULL, &vt, FFI_OK);
/* <8 x uint8> (8 bytes) -> SSE on both. */
make_vector_type (&vt, elems, &ffi_type_uint8, 8);
check_cif (NULL, &vt, FFI_OK);
/* <4 x float> (16 bytes) -> SSE + SSEUP on both. */
make_vector_type (&vt2, elems2, &ffi_type_float, 4);
check_cif (&vt2, NULL, FFI_OK);
check_cif (NULL, &vt2, FFI_OK);
/* <2 x double> (16 bytes) -> SSE + SSEUP on both. */
make_vector_type (&vt2, elems2, &ffi_type_double, 2);
check_cif (&vt2, NULL, FFI_OK);
printf ("unsupported vector abi ok\n");
exit (0);
}
#else
int
main (void)
{
exit (0);
}
#endif /* x86-64 System V */