From 654c7efd26a1a774b619e9fc87ddc53e7af7d0f1 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 3 Feb 2018 18:34:22 +0100 Subject: [PATCH 01/58] Switch to %ldconfig_scriptlets Signed-off-by: Igor Gnatenko --- libffi.spec | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libffi.spec b/libffi.spec index de2b4cc..8132b5f 100644 --- a/libffi.spec +++ b/libffi.spec @@ -2,7 +2,7 @@ Name: libffi Version: 3.1 -Release: 14%{?dist} +Release: 15%{?dist} Summary: A portable foreign function interface library Group: System Environment/Libraries @@ -97,7 +97,7 @@ mv $RPM_BUILD_ROOT%{_libdir}/libffi-%{version}/include/{ffi,ffitarget}.h $RPM_BU rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version} -%post -p /sbin/ldconfig +%ldconfig_scriptlets %post devel /sbin/install-info --info-dir=%{_infodir} %{_infodir}/libffi.info.gz || : @@ -107,8 +107,6 @@ if [ $1 = 0 ] ;then /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/libffi.info.gz || : fi -%postun -p /sbin/ldconfig - %files %{!?_licensedir:%global license %%doc} @@ -124,6 +122,9 @@ fi %{_infodir}/libffi.info.gz %changelog +* Sat Feb 03 2018 Igor Gnatenko - 3.1-15 +- Switch to %%ldconfig_scriptlets + * Thu Aug 03 2017 Fedora Release Engineering - 3.1-14 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild From 15e20ba802088e5d6af11cacaf1d53e3e9ee84cf Mon Sep 17 00:00:00 2001 From: Sergey Turivniy Date: Mon, 5 Feb 2018 18:22:44 +0200 Subject: [PATCH 02/58] Add CI tests using the standard test interface --- tests/tests.yml | 17 +++++ tests/testsuite/Makefile | 63 +++++++++++++++++ tests/testsuite/PURPOSE | 3 + tests/testsuite/dynamic_linking-dg.patch | 29 ++++++++ tests/testsuite/dynamic_linking.patch | 29 ++++++++ tests/testsuite/runtest.sh | 86 ++++++++++++++++++++++++ 6 files changed, 227 insertions(+) create mode 100644 tests/tests.yml create mode 100644 tests/testsuite/Makefile create mode 100644 tests/testsuite/PURPOSE create mode 100644 tests/testsuite/dynamic_linking-dg.patch create mode 100644 tests/testsuite/dynamic_linking.patch create mode 100755 tests/testsuite/runtest.sh diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..4ca04f0 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,17 @@ +--- +# This first play always runs on the local staging system +- hosts: localhost + roles: + - role: standard-test-beakerlib + tags: + - classic + tests: + - testsuite + required_packages: + - libffi + - libffi-devel + - gcc + - dejagnu + - rpm-build + - gcc-c++ + - strace diff --git a/tests/testsuite/Makefile b/tests/testsuite/Makefile new file mode 100644 index 0000000..f729bae --- /dev/null +++ b/tests/testsuite/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/libffi/Sanity/testsuite +# Description: Runs upstream testsuite +# Author: Michal Nowak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2010 Red Hat, 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 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. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/libffi/Sanity/testsuite +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE dynamic_linking.patch dynamic_linking-dg.patch + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Michal Nowak " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Runs upstream testsuite" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 19m" >> $(METADATA) + @echo "RunFor: libffi" >> $(METADATA) + @echo "Requires: libffi libffi-devel gcc dejagnu rpm-build gcc-c++ texinfo strace" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv3" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -RHEL4 -RHEL5" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/testsuite/PURPOSE b/tests/testsuite/PURPOSE new file mode 100644 index 0000000..688fefb --- /dev/null +++ b/tests/testsuite/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/libffi/Sanity/testsuite +Description: Runs upstream testsuite +Author: Michal Nowak diff --git a/tests/testsuite/dynamic_linking-dg.patch b/tests/testsuite/dynamic_linking-dg.patch new file mode 100644 index 0000000..fb10ae3 --- /dev/null +++ b/tests/testsuite/dynamic_linking-dg.patch @@ -0,0 +1,29 @@ +--- testsuite/lib/libffi-dg.exp 2008-02-14 19:45:33.000000000 -0500 ++++ testsuite/lib/libffi-dg.exp 2015-02-13 13:32:08.422053435 -0500 +@@ -110,7 +110,7 @@ + } + verbose "gccdir $gccdir" + +- set ld_library_path "." ++ set ld_library_path "" + append ld_library_path ":${gccdir}" + + set compiler "${gccdir}/xgcc" +@@ -127,16 +127,13 @@ + } + } + } +- # add the library path for libffi. +- append ld_library_path ":${blddirffi}/.libs" +- + verbose "ld_library_path: $ld_library_path" + + # Point to the Libffi headers in libffi. + set libffi_include "${blddirffi}/include" + verbose "libffi_include $libffi_include" + +- set libffi_dir "${blddirffi}/.libs" ++ set libffi_dir "/usr/LIBRARY_DIR" + verbose "libffi_dir $libffi_dir" + if { $libffi_dir != "" } { + set libffi_dir [file dirname ${libffi_dir}] diff --git a/tests/testsuite/dynamic_linking.patch b/tests/testsuite/dynamic_linking.patch new file mode 100644 index 0000000..65de4d7 --- /dev/null +++ b/tests/testsuite/dynamic_linking.patch @@ -0,0 +1,29 @@ +--- testsuite/lib/libffi.exp 2013-03-16 07:19:39.000000000 -0400 ++++ testsuite/lib/libffi.exp 2014-10-22 11:10:42.449143642 -0400 +@@ -118,7 +118,7 @@ + } + verbose "gccdir $gccdir" + +- set ld_library_path "." ++ set ld_library_path "" + append ld_library_path ":${gccdir}" + + set compiler "${gccdir}/xgcc" +@@ -142,16 +142,13 @@ + + } + +- # add the library path for libffi. +- append ld_library_path ":${blddirffi}/.libs" +- + verbose "ld_library_path: $ld_library_path" + + # Point to the Libffi headers in libffi. + set libffi_include "${blddirffi}/include" + verbose "libffi_include $libffi_include" + +- set libffi_dir "${blddirffi}/.libs" ++ set libffi_dir "/usr/LIBRARY_DIR" + verbose "libffi_dir $libffi_dir" + if { $libffi_dir != "" } { + set libffi_dir [file dirname ${libffi_dir}] diff --git a/tests/testsuite/runtest.sh b/tests/testsuite/runtest.sh new file mode 100755 index 0000000..92c2f0f --- /dev/null +++ b/tests/testsuite/runtest.sh @@ -0,0 +1,86 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/libffi/Sanity/testsuite +# Description: Runs upstream testsuite +# Author: Michal Nowak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2010 Red Hat, 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 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. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include rhts environment +. /usr/lib/beakerlib/beakerlib.sh + +PACKAGES=(libffi libffi-devel gcc dejagnu rpm-build gcc-c++) + +rlJournalStart + rlPhaseStartSetup + for p in "${PACKAGES[@]}"; do + if ! rlCheckRpm "$p"; then + rlRun "yum -y install $p" + rlAssertRpm "$p" + fi + done; + + rlRun "TmpDir=`mktemp -d`" 0 "Creating tmp directory" + rlRun "cp *.patch $TmpDir/" + rlRun "pushd $TmpDir" + rlFetchSrcForInstalled libffi + rlRun "rpm -ivh libffi*.src.rpm" + rlRun "popd" + rlRun "specfile=$(rpm --eval='%_specdir')/libffi.spec" + rlRun "rpmbuild -bp $specfile" + rlRun "builddir=$(rpm --eval='%_builddir')" + rlRun "pushd $builddir/libffi-*/" + rlRun "./configure" + rlRUn "make" + rlPhaseEnd + + rlPhaseStartTest "Run testsuite" + + # patching the testsuite to test the installed libraries instead of the built ones + if [ -e /usr/lib64/libffi.so ]; then + export LD_LIBRARY_PATH=/usr/lib64 + perl -i -pe 's/LIBRARY_DIR/lib64/' $TmpDir/dynamic_linking.patch + perl -i -pe 's/LIBRARY_DIR/lib64/' $TmpDir/dynamic_linking-dg.patch + else + export LD_LIBRARY_PATH=/usr/lib + perl -i -pe 's/LIBRARY_DIR/lib/' $TmpDir/dynamic_linking.patch + perl -i -pe 's/LIBRARY_DIR/lib/' $TmpDir/dynamic_linking-dg.patch + fi + test -e testsuite/lib/libffi.exp && rlRun "patch testsuite/lib/libffi.exp < $TmpDir/dynamic_linking.patch" + test -e testsuite/lib/libffi-dg.exp && rlRun "patch testsuite/lib/libffi-dg.exp < $TmpDir/dynamic_linking-dg.patch" + rlLog "Checking whether we test really the installed libraries." + strace -F -e open,openat,stat -o strace.log -- make check + LIBFFI_SO_CALLS=`cat strace.log | grep libffi.so | grep -v ENOENT | grep -v 'usr/lib' | grep -v '\"\/lib' | grep -v 'unfinished' | wc -l` + rlAssertGreater "The just built libraries should not be used, everything should be taken from /usr" 5 $LIBFFI_SO_CALLS + rlRun "cat strace.log | grep libffi.so | grep usr" + rlRun "cat strace.log | grep libffi.so | grep rpmbuild" 1 + rlRun "make check" 0 "RUNNING THE TESTSUITE" + rlRun "popd" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "ls -al $TmpDir" + rlBundleLogs logs $(find . -name 'libffi.sum') $(find . -name 'libffi.log') + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd From 5df41d320b4450084ab10da8c8695e2ac2eedb27 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 7 Feb 2018 21:37:13 +0000 Subject: [PATCH 03/58] - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index 8132b5f..5657313 100644 --- a/libffi.spec +++ b/libffi.spec @@ -2,7 +2,7 @@ Name: libffi Version: 3.1 -Release: 15%{?dist} +Release: 16%{?dist} Summary: A portable foreign function interface library Group: System Environment/Libraries @@ -122,6 +122,9 @@ fi %{_infodir}/libffi.info.gz %changelog +* Wed Feb 07 2018 Fedora Release Engineering - 3.1-16 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + * Sat Feb 03 2018 Igor Gnatenko - 3.1-15 - Switch to %%ldconfig_scriptlets From a67ea03359235d5f4fb0b7badf5fa2da3a0e29c8 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 13 Jul 2018 08:05:43 +0000 Subject: [PATCH 04/58] - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index 5657313..15830dd 100644 --- a/libffi.spec +++ b/libffi.spec @@ -2,7 +2,7 @@ Name: libffi Version: 3.1 -Release: 16%{?dist} +Release: 17%{?dist} Summary: A portable foreign function interface library Group: System Environment/Libraries @@ -122,6 +122,9 @@ fi %{_infodir}/libffi.info.gz %changelog +* Fri Jul 13 2018 Fedora Release Engineering - 3.1-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + * Wed Feb 07 2018 Fedora Release Engineering - 3.1-16 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild From 7c8473e637d7c603cc9a053f66d24809b8ddf746 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sun, 22 Jul 2018 15:36:16 +0100 Subject: [PATCH 05/58] Fix FTBFS --- libffi.spec | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libffi.spec b/libffi.spec index 15830dd..b3da012 100644 --- a/libffi.spec +++ b/libffi.spec @@ -2,12 +2,11 @@ Name: libffi Version: 3.1 -Release: 17%{?dist} +Release: 18%{?dist} Summary: A portable foreign function interface library - -Group: System Environment/Libraries License: BSD URL: http://sourceware.org/libffi + Source0: ftp://sourceware.org/pub/libffi/libffi-%{version}.tar.gz Source1: ffi-multilib.h Source2: ffitarget-multilib.h @@ -16,6 +15,8 @@ Patch1: libffi-3.1-fix-exec-stack.patch Patch2: libffi-aarch64-rhbz1174037.patch Patch3: libffi-3.1-aarch64-fix-exec-stack.patch +BuildRequires: gcc + %description Compilers for high level languages generate code that follow certain conventions. These conventions are necessary, in part, for separate @@ -46,7 +47,6 @@ between the two languages. %package devel Summary: Development files for %{name} -Group: Development/Libraries Requires: %{name} = %{version}-%{release} Requires: pkgconfig Requires(post): /sbin/install-info @@ -109,7 +109,6 @@ fi %files -%{!?_licensedir:%global license %%doc} %license LICENSE %doc README %{_libdir}/*.so.* @@ -122,6 +121,9 @@ fi %{_infodir}/libffi.info.gz %changelog +* Sun Jul 22 2018 Peter Robinson 3.1-28 +- Fix FTBFS + * Fri Jul 13 2018 Fedora Release Engineering - 3.1-17 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild From 159547d75466f12d076bf3bb077dae8360893985 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 27 Jan 2019 19:05:15 +0100 Subject: [PATCH 06/58] Remove obsolete scriptlets References: https://fedoraproject.org/wiki/Changes/RemoveObsoleteScriptlets Signed-off-by: Igor Gnatenko --- libffi.spec | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/libffi.spec b/libffi.spec index b3da012..4544d33 100644 --- a/libffi.spec +++ b/libffi.spec @@ -49,8 +49,6 @@ between the two languages. Summary: Development files for %{name} Requires: %{name} = %{version}-%{release} Requires: pkgconfig -Requires(post): /sbin/install-info -Requires(preun): /sbin/install-info %description devel The %{name}-devel package contains libraries and header files for @@ -99,15 +97,6 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version} %ldconfig_scriptlets -%post devel -/sbin/install-info --info-dir=%{_infodir} %{_infodir}/libffi.info.gz || : - -%preun devel -if [ $1 = 0 ] ;then - /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/libffi.info.gz || : -fi - - %files %license LICENSE %doc README From 4f59ea6259caf33a6fd9edd83fa03e092ec6cdee Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 1 Feb 2019 07:07:30 +0000 Subject: [PATCH 07/58] - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index 4544d33..e9a4730 100644 --- a/libffi.spec +++ b/libffi.spec @@ -2,7 +2,7 @@ Name: libffi Version: 3.1 -Release: 18%{?dist} +Release: 19%{?dist} Summary: A portable foreign function interface library License: BSD URL: http://sourceware.org/libffi @@ -110,6 +110,9 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version} %{_infodir}/libffi.info.gz %changelog +* Fri Feb 01 2019 Fedora Release Engineering - 3.1-19 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + * Sun Jul 22 2018 Peter Robinson 3.1-28 - Fix FTBFS From 34c093380d01ad655d30d1694c2a955f3e2e8d5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= Date: Wed, 24 Apr 2019 14:56:34 +0200 Subject: [PATCH 08/58] Remove hardcoded gzip suffix from GNU info pages --- libffi.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libffi.spec b/libffi.spec index e9a4730..189d7cc 100644 --- a/libffi.spec +++ b/libffi.spec @@ -2,7 +2,7 @@ Name: libffi Version: 3.1 -Release: 19%{?dist} +Release: 20%{?dist} Summary: A portable foreign function interface library License: BSD URL: http://sourceware.org/libffi @@ -107,9 +107,12 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version} %{_includedir}/ffi*.h %{_libdir}/*.so %{_mandir}/man3/*.gz -%{_infodir}/libffi.info.gz +%{_infodir}/libffi.info.* %changelog +* Wed Apr 24 2019 Björn Esser - 3.1-20 +- Remove hardcoded gzip suffix from GNU info pages + * Fri Feb 01 2019 Fedora Release Engineering - 3.1-19 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild From e4104c0a47a7c486238cc564bbd983e85e3af2f2 Mon Sep 17 00:00:00 2001 From: Anthony Green Date: Wed, 19 Jun 2019 18:38:05 -0400 Subject: [PATCH 09/58] Fix license tag in spec file --- libffi.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libffi.spec b/libffi.spec index 189d7cc..7f75f77 100644 --- a/libffi.spec +++ b/libffi.spec @@ -2,9 +2,9 @@ Name: libffi Version: 3.1 -Release: 20%{?dist} +Release: 21%{?dist} Summary: A portable foreign function interface library -License: BSD +License: MIT URL: http://sourceware.org/libffi Source0: ftp://sourceware.org/pub/libffi/libffi-%{version}.tar.gz @@ -110,6 +110,9 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version} %{_infodir}/libffi.info.* %changelog +* Wed Jun 19 2019 Anthony Green - 3.1-21 +- Fix license tag + * Wed Apr 24 2019 Björn Esser - 3.1-20 - Remove hardcoded gzip suffix from GNU info pages From c040208fe2ad09815229f0419a4c6611812fa35d Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 9 Jul 2019 18:44:17 +0200 Subject: [PATCH 10/58] Run test suite during build (#1727088) --- libffi.spec | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index 7f75f77..5644671 100644 --- a/libffi.spec +++ b/libffi.spec @@ -1,8 +1,10 @@ +%bcond_with bootstrap + %global multilib_arches %{ix86} ppc ppc64 ppc64p7 s390 s390x x86_64 Name: libffi Version: 3.1 -Release: 21%{?dist} +Release: 22%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -16,6 +18,10 @@ Patch2: libffi-aarch64-rhbz1174037.patch Patch3: libffi-3.1-aarch64-fix-exec-stack.patch BuildRequires: gcc +%if %{without bootstrap} +BuildRequires: gcc-c++ +BuildRequires: dejagnu +%endif %description Compilers for high level languages generate code that follow certain @@ -67,6 +73,10 @@ developing applications that use %{name}. %configure --disable-static make %{?_smp_mflags} +%check +%if %{without bootstrap} +%make_build check +%endif %install make install DESTDIR=$RPM_BUILD_ROOT @@ -110,6 +120,9 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version} %{_infodir}/libffi.info.* %changelog +* Tue Jul 9 2019 Florian Weimer - 3.1-22 +- Run test suite during build (#1727088) + * Wed Jun 19 2019 Anthony Green - 3.1-21 - Fix license tag From 4fbfbe53fe7f867dedae7562961fd457cd94cd49 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 25 Jul 2019 13:15:15 +0000 Subject: [PATCH 11/58] - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index 5644671..bf98f36 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.1 -Release: 22%{?dist} +Release: 23%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -120,6 +120,9 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version} %{_infodir}/libffi.info.* %changelog +* Thu Jul 25 2019 Fedora Release Engineering - 3.1-23 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + * Tue Jul 9 2019 Florian Weimer - 3.1-22 - Run test suite during build (#1727088) From e39a9572c0020f833f168b3d81cd135a3236da72 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 29 Jan 2020 09:07:01 +0000 Subject: [PATCH 12/58] - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index bf98f36..a90f3ee 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.1 -Release: 23%{?dist} +Release: 24%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -120,6 +120,9 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version} %{_infodir}/libffi.info.* %changelog +* Wed Jan 29 2020 Fedora Release Engineering - 3.1-24 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + * Thu Jul 25 2019 Fedora Release Engineering - 3.1-23 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild From 2c1dc799ce7b56dfb50300e1f78b1b434a83d573 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Thu, 30 Apr 2020 23:01:25 -0400 Subject: [PATCH 13/58] Add $LIBFFI_TMPDIR environment variable support (#1667620) --- libffi-3.1-libffi_tmpdir.patch | 17 +++++++++++++++++ libffi.spec | 8 ++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 libffi-3.1-libffi_tmpdir.patch diff --git a/libffi-3.1-libffi_tmpdir.patch b/libffi-3.1-libffi_tmpdir.patch new file mode 100644 index 0000000..960c328 --- /dev/null +++ b/libffi-3.1-libffi_tmpdir.patch @@ -0,0 +1,17 @@ +Most temp file directories need to be hardened against execution, but +libffi needs execute privileges. Add a libffi-specific temp directory +that can be set up by sysadmins as needed with suitable permissions. +This both ensures that libffi will have a valid temp directory to use +as well as preventing attempts to access other directories. + +diff -rup a/src/closures.c b/src/closures.c +--- a/src/closures.c 2014-05-11 09:54:19.000000000 -0400 ++++ b/src/closures.c 2020-04-29 20:50:00.454853909 -0400 +@@ -362,6 +362,7 @@ static struct + const char *arg; + int repeat; + } open_temp_exec_file_opts[] = { ++ { open_temp_exec_file_env, "LIBFFI_TMPDIR", 0 }, + { open_temp_exec_file_env, "TMPDIR", 0 }, + { open_temp_exec_file_dir, "/tmp", 0 }, + { open_temp_exec_file_dir, "/var/tmp", 0 }, diff --git a/libffi.spec b/libffi.spec index a90f3ee..5f7ca03 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.1 -Release: 24%{?dist} +Release: 25%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -16,6 +16,7 @@ Patch0: libffi-3.1-fix-include-path.patch Patch1: libffi-3.1-fix-exec-stack.patch Patch2: libffi-aarch64-rhbz1174037.patch Patch3: libffi-3.1-aarch64-fix-exec-stack.patch +Patch4: libffi-3.1-libffi_tmpdir.patch BuildRequires: gcc %if %{without bootstrap} @@ -67,7 +68,7 @@ developing applications that use %{name}. %patch1 -p1 -b .execstack %patch2 -p1 -b .aarch64 %patch3 -p1 -b .aarch64execstack - +%patch4 -p1 -b .libffitmpdir %build %configure --disable-static @@ -120,6 +121,9 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version} %{_infodir}/libffi.info.* %changelog +* Thu Apr 30 2020 DJ Delorie - 3.1-25 +- Add $LIBFFI_TMPDIR environment variable support (#1667620) + * Wed Jan 29 2020 Fedora Release Engineering - 3.1-24 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild From fdac85aeb043fc5ce78b59c74c22045fa2fa765a Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 28 Jul 2020 04:38:28 +0000 Subject: [PATCH 14/58] - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index 5f7ca03..e781bae 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.1 -Release: 25%{?dist} +Release: 26%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -121,6 +121,9 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version} %{_infodir}/libffi.info.* %changelog +* Tue Jul 28 2020 Fedora Release Engineering - 3.1-26 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + * Thu Apr 30 2020 DJ Delorie - 3.1-25 - Add $LIBFFI_TMPDIR environment variable support (#1667620) From 7b37dc1150356b04d1de24a8abc4da3155fd2d50 Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Wed, 2 Dec 2020 13:53:37 -0500 Subject: [PATCH 15/58] Use make macros --- libffi.spec | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libffi.spec b/libffi.spec index e781bae..0328b12 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.1 -Release: 26%{?dist} +Release: 27%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -72,7 +72,7 @@ developing applications that use %{name}. %build %configure --disable-static -make %{?_smp_mflags} +%make_build %check %if %{without bootstrap} @@ -80,7 +80,7 @@ make %{?_smp_mflags} %endif %install -make install DESTDIR=$RPM_BUILD_ROOT +%make_install find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' rm -f $RPM_BUILD_ROOT%{_infodir}/dir @@ -121,6 +121,10 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version} %{_infodir}/libffi.info.* %changelog +* Wed Dec 02 2020 Carlos O'Donell - 3.1-27 +- Use make macros +- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro + * Tue Jul 28 2020 Fedora Release Engineering - 3.1-26 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild From 94a646ef3813ecf0a18ceb24817feb78b1246caa Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Wed, 6 Jan 2021 19:04:38 +0000 Subject: [PATCH 16/58] Add BuildRequires: make https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot --- libffi.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/libffi.spec b/libffi.spec index 0328b12..6782c66 100644 --- a/libffi.spec +++ b/libffi.spec @@ -18,6 +18,7 @@ Patch2: libffi-aarch64-rhbz1174037.patch Patch3: libffi-3.1-aarch64-fix-exec-stack.patch Patch4: libffi-3.1-libffi_tmpdir.patch +BuildRequires: make BuildRequires: gcc %if %{without bootstrap} BuildRequires: gcc-c++ From 16342320c793aa9a71ea644f688d69cc313deec4 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 26 Jan 2021 17:03:33 +0000 Subject: [PATCH 17/58] - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index 6782c66..03949eb 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.1 -Release: 27%{?dist} +Release: 28%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -122,6 +122,9 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version} %{_infodir}/libffi.info.* %changelog +* Tue Jan 26 2021 Fedora Release Engineering - 3.1-28 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + * Wed Dec 02 2020 Carlos O'Donell - 3.1-27 - Use make macros - https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro From 4bc39b5505fd4bc02a18aac2a47ae5da96692de2 Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Mon, 28 Jun 2021 22:11:24 -0400 Subject: [PATCH 18/58] Update to libff-3.4.2. --- .gitignore | 1 + libffi-3.1-aarch64-fix-exec-stack.patch | 11 -------- libffi-3.1-fix-exec-stack.patch | 31 --------------------- libffi-3.1-fix-include-path.patch | 17 ------------ libffi-3.1-libffi_tmpdir.patch | 17 ------------ libffi-aarch64-rhbz1174037.patch | 11 -------- libffi.spec | 36 +++++++++++-------------- sources | 2 +- 8 files changed, 17 insertions(+), 109 deletions(-) delete mode 100644 libffi-3.1-aarch64-fix-exec-stack.patch delete mode 100644 libffi-3.1-fix-exec-stack.patch delete mode 100644 libffi-3.1-fix-include-path.patch delete mode 100644 libffi-3.1-libffi_tmpdir.patch delete mode 100644 libffi-aarch64-rhbz1174037.patch diff --git a/.gitignore b/.gitignore index 6d5a2a3..b02cf99 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ libffi-3.0.9.tar.gz /libffi-3.0.11.tar.gz /libffi-3.0.13.tar.gz /libffi-3.1.tar.gz +/libffi-3.4.2.tar.gz diff --git a/libffi-3.1-aarch64-fix-exec-stack.patch b/libffi-3.1-aarch64-fix-exec-stack.patch deleted file mode 100644 index e20c920..0000000 --- a/libffi-3.1-aarch64-fix-exec-stack.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/aarch64/sysv.S -+++ b/src/aarch64/sysv.S -@@ -396,3 +396,8 @@ - #ifdef __ELF__ - .size CNAME(ffi_closure_SYSV), .-CNAME(ffi_closure_SYSV) - #endif -+ -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",%progbits -+#endif -+ diff --git a/libffi-3.1-fix-exec-stack.patch b/libffi-3.1-fix-exec-stack.patch deleted file mode 100644 index 4c2a59f..0000000 --- a/libffi-3.1-fix-exec-stack.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 978c9540154d320525488db1b7049277122f736d Mon Sep 17 00:00:00 2001 -From: Samuli Suominen -Date: Sat, 31 May 2014 08:53:10 -0400 -Subject: [PATCH] Add missing GNU stack markings in win32.S - ---- - src/x86/win32.S | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/src/x86/win32.S b/src/x86/win32.S -index daf0e79..e42baf2 100644 ---- a/src/x86/win32.S -+++ b/src/x86/win32.S -@@ -1,5 +1,6 @@ - /* ----------------------------------------------------------------------- -- win32.S - Copyright (c) 1996, 1998, 2001, 2002, 2009 Red Hat, Inc. -+ win32.S - Copyright (c) 2014 Anthony Green -+ Copyright (c) 1996, 1998, 2001, 2002, 2009 Red Hat, Inc. - Copyright (c) 2001 John Beniton - Copyright (c) 2002 Ranjit Mathew - Copyright (c) 2009 Daniel Witte -@@ -1304,3 +1305,6 @@ L_ffi_closure_SYSV_inner$stub: - - #endif /* !_MSC_VER */ - -+#if defined __ELF__ && defined __linux__ -+ .section .note.GNU-stack,"",@progbits -+#endif --- -1.9.3 - diff --git a/libffi-3.1-fix-include-path.patch b/libffi-3.1-fix-include-path.patch deleted file mode 100644 index 5a3b7a5..0000000 --- a/libffi-3.1-fix-include-path.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -up libffi-3.1/libffi.pc.in.fixpath libffi-3.1/libffi.pc.in ---- libffi-3.1/libffi.pc.in.fixpath 2014-04-25 19:45:13.000000000 +0200 -+++ libffi-3.1/libffi.pc.in 2014-06-12 12:06:06.000000000 +0200 -@@ -1,11 +1,10 @@ - prefix=@prefix@ - exec_prefix=@exec_prefix@ - libdir=@libdir@ --toolexeclibdir=@toolexeclibdir@ --includedir=${libdir}/@PACKAGE_NAME@-@PACKAGE_VERSION@/include -+includedir=@includedir@ - - Name: @PACKAGE_NAME@ - Description: Library supporting Foreign Function Interfaces - Version: @PACKAGE_VERSION@ --Libs: -L${toolexeclibdir} -lffi -+Libs: -L${libdir} -lffi - Cflags: -I${includedir} diff --git a/libffi-3.1-libffi_tmpdir.patch b/libffi-3.1-libffi_tmpdir.patch deleted file mode 100644 index 960c328..0000000 --- a/libffi-3.1-libffi_tmpdir.patch +++ /dev/null @@ -1,17 +0,0 @@ -Most temp file directories need to be hardened against execution, but -libffi needs execute privileges. Add a libffi-specific temp directory -that can be set up by sysadmins as needed with suitable permissions. -This both ensures that libffi will have a valid temp directory to use -as well as preventing attempts to access other directories. - -diff -rup a/src/closures.c b/src/closures.c ---- a/src/closures.c 2014-05-11 09:54:19.000000000 -0400 -+++ b/src/closures.c 2020-04-29 20:50:00.454853909 -0400 -@@ -362,6 +362,7 @@ static struct - const char *arg; - int repeat; - } open_temp_exec_file_opts[] = { -+ { open_temp_exec_file_env, "LIBFFI_TMPDIR", 0 }, - { open_temp_exec_file_env, "TMPDIR", 0 }, - { open_temp_exec_file_dir, "/tmp", 0 }, - { open_temp_exec_file_dir, "/var/tmp", 0 }, diff --git a/libffi-aarch64-rhbz1174037.patch b/libffi-aarch64-rhbz1174037.patch deleted file mode 100644 index dbf6308..0000000 --- a/libffi-aarch64-rhbz1174037.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- libffi-3.1/src/aarch64/ffi.c.orig 2014-04-25 18:45:13.000000000 +0100 -+++ libffi-3.1/src/aarch64/ffi.c 2015-01-15 02:36:56.314906455 +0000 -@@ -728,7 +728,7 @@ - state.ngrn = N_X_ARG_REG; - - memcpy (allocate_to_stack (&state, stack, ty->alignment, -- ty->size), ecif->avalue + i, ty->size); -+ ty->size), ecif->avalue[i], ty->size); - } - break; - diff --git a/libffi.spec b/libffi.spec index 03949eb..30a6785 100644 --- a/libffi.spec +++ b/libffi.spec @@ -1,22 +1,17 @@ %bcond_with bootstrap -%global multilib_arches %{ix86} ppc ppc64 ppc64p7 s390 s390x x86_64 +%global multilib_arches %{ix86} x86_64 Name: libffi -Version: 3.1 -Release: 28%{?dist} +Version: 3.4.2 +Release: 1%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi -Source0: ftp://sourceware.org/pub/libffi/libffi-%{version}.tar.gz +Source0: https://github.com/libffi/libffi/releases/download/v3.4.2/libffi-3.4.2.tar.gz Source1: ffi-multilib.h Source2: ffitarget-multilib.h -Patch0: libffi-3.1-fix-include-path.patch -Patch1: libffi-3.1-fix-exec-stack.patch -Patch2: libffi-aarch64-rhbz1174037.patch -Patch3: libffi-3.1-aarch64-fix-exec-stack.patch -Patch4: libffi-3.1-libffi_tmpdir.patch BuildRequires: make BuildRequires: gcc @@ -65,14 +60,14 @@ developing applications that use %{name}. %prep %setup -q -%patch0 -p1 -b .fixpath -%patch1 -p1 -b .execstack -%patch2 -p1 -b .aarch64 -%patch3 -p1 -b .aarch64execstack -%patch4 -p1 -b .libffitmpdir %build -%configure --disable-static +# For now we disable the static templates to avoid ghc and +# gobject-introspection failures: +# https://gitlab.haskell.org/ghc/ghc/-/issues/20051 +# https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/283 +# We need to get these fixes into Fedora before we can reeanble them. +%configure --disable-static --disable-exec-static-tramp %make_build %check @@ -97,21 +92,17 @@ mkdir -p $RPM_BUILD_ROOT%{_includedir} # can have both a 32- and 64-bit version of the library, and they each need # their own correct-but-different versions of the headers to be usable. for i in ffi ffitarget; do - mv $RPM_BUILD_ROOT%{_libdir}/libffi-%{version}/include/$i.h $RPM_BUILD_ROOT%{_includedir}/$i-${basearch}.h + mv $RPM_BUILD_ROOT%{_includedir}/$i.h $RPM_BUILD_ROOT%{_includedir}/$i-${basearch}.h done install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_includedir}/ffi.h install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h -%else -mv $RPM_BUILD_ROOT%{_libdir}/libffi-%{version}/include/{ffi,ffitarget}.h $RPM_BUILD_ROOT%{_includedir} %endif -rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version} - %ldconfig_scriptlets %files %license LICENSE -%doc README +%doc README.md %{_libdir}/*.so.* %files devel @@ -122,6 +113,9 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version} %{_infodir}/libffi.info.* %changelog +* Mon Jun 28 Carlos O'Donell - 3.4.2-1 +- Rebase to libffi 3.4.2. + * Tue Jan 26 2021 Fedora Release Engineering - 3.1-28 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild diff --git a/sources b/sources index f24e41b..07baa76 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -f5898b29bbfd70502831a212d9249d10 libffi-3.1.tar.gz +SHA512 (libffi-3.4.2.tar.gz) = 31bad35251bf5c0adb998c88ff065085ca6105cf22071b9bd4b5d5d69db4fadf16cadeec9baca944c4bb97b619b035bb8279de8794b922531fddeb0779eb7fb1 From 18f0dfb3dd61b5badeea0d8d4646ef329c8ff351 Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Wed, 14 Jul 2021 11:52:33 -0400 Subject: [PATCH 19/58] Fix %changelog typo. --- libffi.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index 30a6785..a4a7c38 100644 --- a/libffi.spec +++ b/libffi.spec @@ -113,7 +113,7 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog -* Mon Jun 28 Carlos O'Donell - 3.4.2-1 +* Mon Jun 28 2021 Carlos O'Donell - 3.4.2-1 - Rebase to libffi 3.4.2. * Tue Jan 26 2021 Fedora Release Engineering - 3.1-28 From b50252019dc6d527323d39a06052f0105c591be6 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 22 Jul 2021 11:22:06 +0000 Subject: [PATCH 20/58] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index a4a7c38..14136af 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -113,6 +113,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Thu Jul 22 2021 Fedora Release Engineering - 3.4.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + * Mon Jun 28 2021 Carlos O'Donell - 3.4.2-1 - Rebase to libffi 3.4.2. From 382d13fd9fc1f99ae1654c80273bdd0d258ed2b1 Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Thu, 22 Jul 2021 11:00:23 -0400 Subject: [PATCH 21/58] Prevent libffi 3.4 rebuild until after mass rebuild. --- libffi.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libffi.spec b/libffi.spec index 14136af..cffbd9a 100644 --- a/libffi.spec +++ b/libffi.spec @@ -62,6 +62,10 @@ developing applications that use %{name}. %setup -q %build + +# Prevent rebuild within the mass rebuild. +exit 1 + # For now we disable the static templates to avoid ghc and # gobject-introspection failures: # https://gitlab.haskell.org/ghc/ghc/-/issues/20051 From ed0518c208606d2277866f532f7087b1ecdf7590 Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Wed, 11 Aug 2021 00:32:55 -0400 Subject: [PATCH 22/58] Rebuild package and bump NEVRA. --- libffi.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libffi.spec b/libffi.spec index cffbd9a..96d8f42 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -57,7 +57,6 @@ Requires: pkgconfig The %{name}-devel package contains libraries and header files for developing applications that use %{name}. - %prep %setup -q @@ -107,7 +106,8 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %files %license LICENSE %doc README.md -%{_libdir}/*.so.* +%{_libdir}/libffi.so.8 +%{_libdir}/libffi.so.8.1.0 %files devel %{_libdir}/pkgconfig/*.pc @@ -117,6 +117,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Wed Aug 11 2021 Carlos O'Donell - 3.4.2-3 +- Rebuild package and bump NEVRA. + * Thu Jul 22 2021 Fedora Release Engineering - 3.4.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild From 91a1b2a09e240b71c40f5b50cba27b1edc8a6385 Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Wed, 11 Aug 2021 00:55:38 -0400 Subject: [PATCH 23/58] Enable building. --- libffi.spec | 3 --- 1 file changed, 3 deletions(-) diff --git a/libffi.spec b/libffi.spec index 96d8f42..0542cd1 100644 --- a/libffi.spec +++ b/libffi.spec @@ -62,9 +62,6 @@ developing applications that use %{name}. %build -# Prevent rebuild within the mass rebuild. -exit 1 - # For now we disable the static templates to avoid ghc and # gobject-introspection failures: # https://gitlab.haskell.org/ghc/ghc/-/issues/20051 From 69db68caf1eb6f7b3ff5fdfc82ab266257c105b8 Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Wed, 15 Sep 2021 09:01:45 -0400 Subject: [PATCH 24/58] Harmonize spec file layout with downstream. --- libffi.spec | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libffi.spec b/libffi.spec index 0542cd1..1682dad 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.2 -Release: 3%{?dist} +Release: 4%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -47,7 +47,6 @@ layer of a fully featured foreign function interface. A layer must exist above `libffi' that handles type conversions for values passed between the two languages. - %package devel Summary: Development files for %{name} Requires: %{name} = %{version}-%{release} @@ -61,7 +60,6 @@ developing applications that use %{name}. %setup -q %build - # For now we disable the static templates to avoid ghc and # gobject-introspection failures: # https://gitlab.haskell.org/ghc/ghc/-/issues/20051 @@ -77,6 +75,7 @@ developing applications that use %{name}. %install %make_install + find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' rm -f $RPM_BUILD_ROOT%{_infodir}/dir @@ -114,6 +113,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Wed Sep 15 2021 Carlos O'Donell - 3.4.2-4 +- Harmonize spec file layout with downstream. + * Wed Aug 11 2021 Carlos O'Donell - 3.4.2-3 - Rebuild package and bump NEVRA. From 87574daa5cb0f33d8aa48ba9a037ee03b45345d0 Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Wed, 15 Sep 2021 17:26:30 -0400 Subject: [PATCH 25/58] Rebuilt for https://fedoraproject.org/wiki/Changes/LIBFFI34 --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index 1682dad..ff0154b 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.2 -Release: 4%{?dist} +Release: 5%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -113,6 +113,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Wed Sep 15 2021 Carlos O'Donell - 3.4.2-5 +- Rebuilt for https://fedoraproject.org/wiki/Changes/LIBFFI34 + * Wed Sep 15 2021 Carlos O'Donell - 3.4.2-4 - Harmonize spec file layout with downstream. From 5df3302f459b06e06092202111f870a29e12a340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Sat, 8 Jan 2022 10:26:48 +0100 Subject: [PATCH 26/58] Rebuilt for https://fedoraproject.org/wiki/Changes/LIBFFI34 --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index ff0154b..479d969 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.2 -Release: 5%{?dist} +Release: 6%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -113,6 +113,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Sat Jan 08 2022 Miro Hrončok - 3.4.2-6 +- Rebuilt for https://fedoraproject.org/wiki/Changes/LIBFFI34 + * Wed Sep 15 2021 Carlos O'Donell - 3.4.2-5 - Rebuilt for https://fedoraproject.org/wiki/Changes/LIBFFI34 From 53606fd875f21a0879ef5fe9c3c0c66620271731 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 20 Jan 2022 16:12:26 +0000 Subject: [PATCH 27/58] - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index 479d969..0af9ef1 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.2 -Release: 6%{?dist} +Release: 7%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -113,6 +113,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Thu Jan 20 2022 Fedora Release Engineering - 3.4.2-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Sat Jan 08 2022 Miro Hrončok - 3.4.2-6 - Rebuilt for https://fedoraproject.org/wiki/Changes/LIBFFI34 From acfefabea4c5ff807657aebc8549ab28a038a75d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Mon, 31 Jan 2022 09:40:40 +0000 Subject: [PATCH 28/58] Fix handling Float128 structs on ppc64le (#2045797) --- libffi-3.4.2-ppc.patch | 26 ++++++++++++++++++++++++++ libffi.spec | 8 +++++++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 libffi-3.4.2-ppc.patch diff --git a/libffi-3.4.2-ppc.patch b/libffi-3.4.2-ppc.patch new file mode 100644 index 0000000..13b739b --- /dev/null +++ b/libffi-3.4.2-ppc.patch @@ -0,0 +1,26 @@ +From 83ce80f3194bbf95c39764d075b070389c0f8522 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Dan=20Hor=C3=A1k?= +Date: Mon, 31 Jan 2022 09:21:53 +0000 +Subject: [PATCH] powerpc64: fix handling of homogeneous float128 structs + +If there is a homogeneous struct with float128 members, they should be +copied to vector register save area. The current code incorrectly copies +only the value of the first member, not increasing the pointer with each +iteration. Fix this. +--- + src/powerpc/ffi_linux64.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/powerpc/ffi_linux64.c b/src/powerpc/ffi_linux64.c +index 4d50878e4..3454dacd3 100644 +--- a/src/powerpc/ffi_linux64.c ++++ b/src/powerpc/ffi_linux64.c +@@ -680,7 +680,7 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack) + { + if (vecarg_count < NUM_VEC_ARG_REGISTERS64 + && i < nfixedargs) +- memcpy (vec_base.f128++, arg.f128, sizeof (float128)); ++ memcpy (vec_base.f128++, arg.f128++, sizeof (float128)); + else + memcpy (next_arg.f128, arg.f128++, sizeof (float128)); + if (++next_arg.f128 == gpr_end.f128) diff --git a/libffi.spec b/libffi.spec index 0af9ef1..f576d8f 100644 --- a/libffi.spec +++ b/libffi.spec @@ -13,6 +13,9 @@ Source0: https://github.com/libffi/libffi/releases/download/v3.4.2/libffi-3.4.2. Source1: ffi-multilib.h Source2: ffitarget-multilib.h +# https://github.com/libffi/libffi/pull/689 +Patch0: libffi-3.4.2-ppc.patch + BuildRequires: make BuildRequires: gcc %if %{without bootstrap} @@ -57,7 +60,7 @@ The %{name}-devel package contains libraries and header files for developing applications that use %{name}. %prep -%setup -q +%autosetup -p1 %build # For now we disable the static templates to avoid ghc and @@ -113,6 +116,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Mon Jan 31 2022 Dan Horák - 3.4.2-8 +- Fix handling Float128 structs on ppc64le (#2045797) + * Thu Jan 20 2022 Fedora Release Engineering - 3.4.2-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild From 53030a5c0cb515d212a0ffe654b117b7b2eead0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Mon, 31 Jan 2022 14:26:32 +0100 Subject: [PATCH 29/58] bump release --- libffi.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index f576d8f..92d9946 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.2 -Release: 7%{?dist} +Release: 8%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi From 94901f4732e0405635d94c8fc92c088505f7e526 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 21 Jul 2022 17:47:45 +0000 Subject: [PATCH 30/58] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index 92d9946..dd2d259 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.2 -Release: 8%{?dist} +Release: 9%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -116,6 +116,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Thu Jul 21 2022 Fedora Release Engineering - 3.4.2-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + * Mon Jan 31 2022 Dan Horák - 3.4.2-8 - Fix handling Float128 structs on ppc64le (#2045797) From 09778f4c43b87e051249f3788ef39f833635cba8 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Wed, 9 Nov 2022 18:14:52 -0500 Subject: [PATCH 31/58] Update to libffi-3.4.4 --- .gitignore | 1 + libffi-3.4.2-ppc.patch | 26 -------------------------- libffi.spec | 14 +++++++------- sources | 2 +- 4 files changed, 9 insertions(+), 34 deletions(-) delete mode 100644 libffi-3.4.2-ppc.patch diff --git a/.gitignore b/.gitignore index b02cf99..c8e640f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ libffi-3.0.9.tar.gz /libffi-3.0.13.tar.gz /libffi-3.1.tar.gz /libffi-3.4.2.tar.gz +/libffi-3.4.4.tar.gz diff --git a/libffi-3.4.2-ppc.patch b/libffi-3.4.2-ppc.patch deleted file mode 100644 index 13b739b..0000000 --- a/libffi-3.4.2-ppc.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 83ce80f3194bbf95c39764d075b070389c0f8522 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Dan=20Hor=C3=A1k?= -Date: Mon, 31 Jan 2022 09:21:53 +0000 -Subject: [PATCH] powerpc64: fix handling of homogeneous float128 structs - -If there is a homogeneous struct with float128 members, they should be -copied to vector register save area. The current code incorrectly copies -only the value of the first member, not increasing the pointer with each -iteration. Fix this. ---- - src/powerpc/ffi_linux64.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/powerpc/ffi_linux64.c b/src/powerpc/ffi_linux64.c -index 4d50878e4..3454dacd3 100644 ---- a/src/powerpc/ffi_linux64.c -+++ b/src/powerpc/ffi_linux64.c -@@ -680,7 +680,7 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack) - { - if (vecarg_count < NUM_VEC_ARG_REGISTERS64 - && i < nfixedargs) -- memcpy (vec_base.f128++, arg.f128, sizeof (float128)); -+ memcpy (vec_base.f128++, arg.f128++, sizeof (float128)); - else - memcpy (next_arg.f128, arg.f128++, sizeof (float128)); - if (++next_arg.f128 == gpr_end.f128) diff --git a/libffi.spec b/libffi.spec index dd2d259..ab38f15 100644 --- a/libffi.spec +++ b/libffi.spec @@ -3,19 +3,16 @@ %global multilib_arches %{ix86} x86_64 Name: libffi -Version: 3.4.2 -Release: 9%{?dist} +Version: 3.4.4 +Release: 1%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi -Source0: https://github.com/libffi/libffi/releases/download/v3.4.2/libffi-3.4.2.tar.gz +Source0: https://github.com/libffi/libffi/releases/download/v3.4.4/libffi-3.4.4.tar.gz Source1: ffi-multilib.h Source2: ffitarget-multilib.h -# https://github.com/libffi/libffi/pull/689 -Patch0: libffi-3.4.2-ppc.patch - BuildRequires: make BuildRequires: gcc %if %{without bootstrap} @@ -106,7 +103,7 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %license LICENSE %doc README.md %{_libdir}/libffi.so.8 -%{_libdir}/libffi.so.8.1.0 +%{_libdir}/libffi.so.8.1.2 %files devel %{_libdir}/pkgconfig/*.pc @@ -116,6 +113,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Fri Oct 28 2022 DJ Delorie - 3.4.4-1 +- Rebase to libffi 3.4.4. + * Thu Jul 21 2022 Fedora Release Engineering - 3.4.2-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild diff --git a/sources b/sources index 07baa76..2c3f8e3 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libffi-3.4.2.tar.gz) = 31bad35251bf5c0adb998c88ff065085ca6105cf22071b9bd4b5d5d69db4fadf16cadeec9baca944c4bb97b619b035bb8279de8794b922531fddeb0779eb7fb1 +SHA512 (libffi-3.4.4.tar.gz) = 88680aeb0fa0dc0319e5cd2ba45b4b5a340bc9b4bcf20b1e0613b39cd898f177a3863aa94034d8e23a7f6f44d858a53dcd36d1bb8dee13b751ef814224061889 From 4c5c11f73de9993ec167ac8258e741c18dbdc85a Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 19 Jan 2023 16:19:18 +0000 Subject: [PATCH 32/58] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index ab38f15..d05099b 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.4 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -113,6 +113,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Thu Jan 19 2023 Fedora Release Engineering - 3.4.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Fri Oct 28 2022 DJ Delorie - 3.4.4-1 - Rebase to libffi 3.4.4. From 6d176a7c520b417352b2341bc68f8242b0c3f6c3 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Wed, 5 Jul 2023 15:47:57 -0400 Subject: [PATCH 33/58] Enable static trampolines Resolves: #2216763 --- libffi.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libffi.spec b/libffi.spec index d05099b..4d27dcc 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.4 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -65,7 +65,7 @@ developing applications that use %{name}. # https://gitlab.haskell.org/ghc/ghc/-/issues/20051 # https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/283 # We need to get these fixes into Fedora before we can reeanble them. -%configure --disable-static --disable-exec-static-tramp +%configure --disable-static %make_build %check @@ -113,6 +113,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Tue May 02 2023 DJ Delorie - 3.4.4-3 +- Enable static trampolines + * Thu Jan 19 2023 Fedora Release Engineering - 3.4.4-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild From 586a259cea7f24bd5b35fb32bd47218a5528bc6b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 20 Jul 2023 10:50:49 +0000 Subject: [PATCH 34/58] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index 4d27dcc..debd00f 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.4 -Release: 3%{?dist} +Release: 4%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -113,6 +113,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Thu Jul 20 2023 Fedora Release Engineering - 3.4.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Tue May 02 2023 DJ Delorie - 3.4.4-3 - Enable static trampolines From a7063fb8f90aef3137e062e11880a26d36f00129 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 19 Dec 2023 14:21:55 -0500 Subject: [PATCH 35/58] Fix implicit declaration of function 'open_temp_exec_file' https://fedoraproject.org/wiki/Changes/PortingToModernC https://github.com/libffi/libffi/pull/764 --- ...-Forward-declare-open_temp_exec_file.patch | 44 +++++++++++++++++++ libffi.spec | 4 ++ 2 files changed, 48 insertions(+) create mode 100644 0001-Forward-declare-open_temp_exec_file.patch diff --git a/0001-Forward-declare-open_temp_exec_file.patch b/0001-Forward-declare-open_temp_exec_file.patch new file mode 100644 index 0000000..0b9d148 --- /dev/null +++ b/0001-Forward-declare-open_temp_exec_file.patch @@ -0,0 +1,44 @@ +From ce077e5565366171aa1b4438749b0922fce887a4 Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Thu, 2 Feb 2023 14:46:29 +0000 +Subject: [PATCH] Forward declare open_temp_exec_file (#764) + +It's defined in closures.c and used in tramp.c. +Also declare it as an hidden symbol, as it should be. + +Co-authored-by: serge-sans-paille +--- + include/ffi_common.h | 4 ++++ + src/tramp.c | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/include/ffi_common.h b/include/ffi_common.h +index 2bd31b03d..c53a79493 100644 +--- a/include/ffi_common.h ++++ b/include/ffi_common.h +@@ -128,6 +128,10 @@ void *ffi_data_to_code_pointer (void *data) FFI_HIDDEN; + static trampoline. */ + int ffi_tramp_is_present (void *closure) FFI_HIDDEN; + ++/* Return a file descriptor of a temporary zero-sized file in a ++ writable and executable filesystem. */ ++int open_temp_exec_file(void) FFI_HIDDEN; ++ + /* Extended cif, used in callback from assembly routine */ + typedef struct + { +diff --git a/src/tramp.c b/src/tramp.c +index 7e005b054..5f19b557f 100644 +--- a/src/tramp.c ++++ b/src/tramp.c +@@ -39,6 +39,10 @@ + #ifdef __linux__ + #define _GNU_SOURCE 1 + #endif ++ ++#include ++#include ++ + #include + #include + #include diff --git a/libffi.spec b/libffi.spec index debd00f..5412dd7 100644 --- a/libffi.spec +++ b/libffi.spec @@ -13,6 +13,10 @@ Source0: https://github.com/libffi/libffi/releases/download/v3.4.4/libffi-3.4.4. Source1: ffi-multilib.h Source2: ffitarget-multilib.h +# error: implicit declaration of function 'open_temp_exec_file' +# https://github.com/libffi/libffi/pull/764 +Patch0: 0001-Forward-declare-open_temp_exec_file.patch + BuildRequires: make BuildRequires: gcc %if %{without bootstrap} From 18bec18c132f67e2228a9e1ad27037ecd8206f0c Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 2 Jan 2024 18:00:03 +0100 Subject: [PATCH 36/58] Update changelog --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index 5412dd7..116fdde 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.4 -Release: 4%{?dist} +Release: 5%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -117,6 +117,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Tue Jan 02 2024 Florian Weimer - 3.4.4-5 +- Add missing declaration of open_temp_exec_file + * Thu Jul 20 2023 Fedora Release Engineering - 3.4.4-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild From c6d6ad650b97aadfec69d38256865f2162d8b7e0 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 21 Jan 2024 04:04:30 +0000 Subject: [PATCH 37/58] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index 116fdde..a700c5c 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.4 -Release: 5%{?dist} +Release: 6%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -117,6 +117,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Sun Jan 21 2024 Fedora Release Engineering - 3.4.4-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Tue Jan 02 2024 Florian Weimer - 3.4.4-5 - Add missing declaration of open_temp_exec_file From 42d1ff73940369624f7271c9450243bd3555b229 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 25 Jan 2024 02:08:17 +0000 Subject: [PATCH 38/58] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index a700c5c..aab4098 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.4 -Release: 6%{?dist} +Release: 7%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi @@ -117,6 +117,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Thu Jan 25 2024 Fedora Release Engineering - 3.4.4-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Sun Jan 21 2024 Fedora Release Engineering - 3.4.4-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 44990d68e60a26f746ec447e2e7ebc61a84cdfa1 Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Thu, 29 Feb 2024 17:12:24 -0500 Subject: [PATCH 39/58] Analyze libffi-3.4.4-7.fc40 sources for license information - Migrate License field to SPDX identifiers for https://docs.fedoraproject.org/en-US/legal/allowed-licenses/ https://docs.fedoraproject.org/en-US/legal/update-existing-packages Resolves: #2222084 --- libffi.spec | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/libffi.spec b/libffi.spec index aab4098..cc31655 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,9 +4,36 @@ Name: libffi Version: 3.4.4 -Release: 7%{?dist} +Release: 8%{?dist} Summary: A portable foreign function interface library -License: MIT +# The following SPDX licenses are extracted from the sources using +# ScanCode 32.0.8 on build libffi-3.4.4-7.fc40: +# +# MIT - Most of the project sources (Required) +# CC-PDDC - src/dlmalloc.c (Required) +# mit OR gpl-3.0 - ltmain.sh (Ignored) +# mit OR gpl-1.0-plus - ltmain.sh (Ignored) +# gpl-2.0-plus WITH libtool-exception-2.0 - ltmain.sh, libtool.m4, configure (Ignored, not shipped) +# warranty-disclaimer - ltmain.sh (Ignored) +# unknown-license-reference - ltmain.sh (Ignored) +# gpl-2.0-plus - Used by build system only (Ignored) +# gpl-2.0 - Used by build system only (Ignored) +# free-unknown - config.guess, config.sub (Ignored) +# fsf-ap - Used by build system only (Ignored) +# fsf-free - Used by build system only (Ignored) +# fsf-unlimited - Used by build system only (Ignored) +# fsf-unlimited-no-warranty - Used by build system only (Ignored) +# gpl-1.0-plus - False positive in texinfo.tex (Ignored) +# gpl-3.0-plus WITH tex-exception - texinfo.tex used in libffi-devel docs (Required) +# gpl-2.0-plus WITH autoconf-simple-exception-2.0 - Used by build system only (Ignored) +# gpl-3.0 - Used by build system only (Ignored) +# gpl-3.0-plus - Used by the testsuite only (Ignored) +# gpl-3.0-plus WITH autoconf-exception-2.0 - Used by build system only (Ignored) +# gpl-3.0-plus WITH autoconf-simple-exception - Used by build system only (Ignored) +# mpl-1.1 OR gpl-2.0-plus OR lgpl-2.1-plus - Not used in build (Ignored) +# public-domain - Used by build system only (Ignored) +# x11-xconsortium - Used by build system only (Ignored) +License: MIT AND CC-PDDC AND (GPL-3.0-or-later WITH Texinfo-exception) URL: http://sourceware.org/libffi Source0: https://github.com/libffi/libffi/releases/download/v3.4.4/libffi-3.4.4.tar.gz @@ -117,6 +144,13 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Thu Feb 29 2024 Carlos O'Donell - 3.4.4-8 +- Analyze libffi-3.4.4-7.fc40 sources for license information +- Migrate License field to SPDX identifiers for + https://docs.fedoraproject.org/en-US/legal/allowed-licenses/ + https://docs.fedoraproject.org/en-US/legal/update-existing-packages + (#2222084) + * Thu Jan 25 2024 Fedora Release Engineering - 3.4.4-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From f5f2a00867105873af69d3f60d530031111505dc Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Mon, 18 Mar 2024 21:49:11 -0400 Subject: [PATCH 40/58] Update to libffi-3.4.6 --- .gitignore | 1 + libffi.spec | 14 +++++++++----- sources | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index c8e640f..5108e89 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ libffi-3.0.9.tar.gz /libffi-3.1.tar.gz /libffi-3.4.2.tar.gz /libffi-3.4.4.tar.gz +/libffi-3.4.6.tar.gz diff --git a/libffi.spec b/libffi.spec index cc31655..d0cd5df 100644 --- a/libffi.spec +++ b/libffi.spec @@ -3,9 +3,10 @@ %global multilib_arches %{ix86} x86_64 Name: libffi -Version: 3.4.4 -Release: 8%{?dist} +Version: 3.4.6 +Release: 1%{?dist} Summary: A portable foreign function interface library +# No license change for 3.4.6 # The following SPDX licenses are extracted from the sources using # ScanCode 32.0.8 on build libffi-3.4.4-7.fc40: # @@ -36,13 +37,13 @@ Summary: A portable foreign function interface library License: MIT AND CC-PDDC AND (GPL-3.0-or-later WITH Texinfo-exception) URL: http://sourceware.org/libffi -Source0: https://github.com/libffi/libffi/releases/download/v3.4.4/libffi-3.4.4.tar.gz +Source0: https://github.com/libffi/libffi/releases/download/v%{version}/libffi-%{version}.tar.gz Source1: ffi-multilib.h Source2: ffitarget-multilib.h # error: implicit declaration of function 'open_temp_exec_file' # https://github.com/libffi/libffi/pull/764 -Patch0: 0001-Forward-declare-open_temp_exec_file.patch +#Patch0: 0001-Forward-declare-open_temp_exec_file.patch BuildRequires: make BuildRequires: gcc @@ -134,7 +135,7 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %license LICENSE %doc README.md %{_libdir}/libffi.so.8 -%{_libdir}/libffi.so.8.1.2 +%{_libdir}/libffi.so.8.1.4 %files devel %{_libdir}/pkgconfig/*.pc @@ -144,6 +145,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Mon Mar 18 2024 DJ Delorie - 3.4.6-1 +- Rebase to libffi 3.4.6. + * Thu Feb 29 2024 Carlos O'Donell - 3.4.4-8 - Analyze libffi-3.4.4-7.fc40 sources for license information - Migrate License field to SPDX identifiers for diff --git a/sources b/sources index 2c3f8e3..2d2b5ff 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libffi-3.4.4.tar.gz) = 88680aeb0fa0dc0319e5cd2ba45b4b5a340bc9b4bcf20b1e0613b39cd898f177a3863aa94034d8e23a7f6f44d858a53dcd36d1bb8dee13b751ef814224061889 +SHA512 (libffi-3.4.6.tar.gz) = 033d2600e879b83c6bce0eb80f69c5f32aa775bf2e962c9d39fbd21226fa19d1e79173d8eaa0d0157014d54509ea73315ad86842356fc3a303c0831c94c6ab39 From 6e5f455b1acdb5ee37daeb80612cd24bfd7a3cda Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 18 Jul 2024 13:51:01 +0000 Subject: [PATCH 41/58] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index d0cd5df..cf2abf4 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.6 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A portable foreign function interface library # No license change for 3.4.6 # The following SPDX licenses are extracted from the sources using @@ -145,6 +145,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Thu Jul 18 2024 Fedora Release Engineering - 3.4.6-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Mon Mar 18 2024 DJ Delorie - 3.4.6-1 - Rebase to libffi 3.4.6. From fa2107f4e0f1fa1acb1cbf5f75222e2c5c149c03 Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Wed, 21 Aug 2024 08:17:07 -0400 Subject: [PATCH 42/58] Fix AArch64 BTI enablement issues (#2305877) Resolves: #2305877 --- 0001-Fix-bti-support-830.patch | 82 ++ ...-Forward-declare-open_temp_exec_file.patch | 44 - 0002-ffi-fix-spelling-mistake-833.patch | 27 + ...4-support-pointer-authentication-834.patch | 333 ++++++++ 0005-Import-from-upstream.patch | 758 ++++++++++++++++++ ...ssing-no-op-define-of-SIGN_LR_LINUX_.patch | 37 + 0007-Fix-struct-args-Rainer-Orth.patch | 47 ++ libffi.spec | 21 +- 8 files changed, 1301 insertions(+), 48 deletions(-) create mode 100644 0001-Fix-bti-support-830.patch delete mode 100644 0001-Forward-declare-open_temp_exec_file.patch create mode 100644 0002-ffi-fix-spelling-mistake-833.patch create mode 100644 0003-aarch64-support-pointer-authentication-834.patch create mode 100644 0005-Import-from-upstream.patch create mode 100644 0006-aarch64-Add-a-missing-no-op-define-of-SIGN_LR_LINUX_.patch create mode 100644 0007-Fix-struct-args-Rainer-Orth.patch diff --git a/0001-Fix-bti-support-830.patch b/0001-Fix-bti-support-830.patch new file mode 100644 index 0000000..22f68d6 --- /dev/null +++ b/0001-Fix-bti-support-830.patch @@ -0,0 +1,82 @@ +From f64141ee3f9e455a060bd09e9ab72b6c94653d7c Mon Sep 17 00:00:00 2001 +From: Bill Roberts <152999275+billatarm@users.noreply.github.com> +Date: Tue, 19 Mar 2024 11:44:55 -0500 +Subject: [PATCH 1/7] Fix bti support (#830) +Content-type: text/plain; charset=UTF-8 + +* bti: add identifier to ffi_closure_SYSV_V_alt + +This was missing BTI_C identifier. + +Old Code: +ffi_closure_SYSV_V_alt: +0000fffff7f70500: ldr x17, [sp, #8] + +Signed-off-by: Bill Roberts + +* testsuite: fix whitespace in Makefile.am + +Signed-off-by: Bill Roberts + +* aarch64: correct comment describing BTI + +The comment is incorrect, BTI is enabled per mapping via mprotect with +PROT_BTI flag set, not per-process. When the loader loads the library, +if the GNU Notes section is missing this, PROT_BTI will not be enabled +for that mapping, but is independent of other mappings. + +Signed-off-by: Bill Roberts + +--------- + +Signed-off-by: Bill Roberts +--- + src/aarch64/sysv.S | 4 +++- + testsuite/Makefile.am | 2 +- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/aarch64/sysv.S b/src/aarch64/sysv.S +index fdd0e8b..60cfa50 100644 +--- a/src/aarch64/sysv.S ++++ b/src/aarch64/sysv.S +@@ -68,7 +68,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + #define BTI_J hint #36 + /* + * The ELF Notes section needs to indicate if BTI is supported, as the first ELF loaded that doesn't +- * declare this support disables it for the whole process. ++ * declare this support disables it for memory region containing the loaded library. + */ + # define GNU_PROPERTY_AARCH64_BTI (1 << 0) /* Has Branch Target Identification */ + .text +@@ -527,6 +527,7 @@ L(do_closure): + #if defined(FFI_EXEC_STATIC_TRAMP) + .align 4 + CNAME(ffi_closure_SYSV_V_alt): ++ BTI_C + /* See the comments above trampoline_code_table. */ + ldr x17, [sp, #8] /* Load closure in x17 */ + add sp, sp, #16 /* Restore the stack */ +@@ -541,6 +542,7 @@ CNAME(ffi_closure_SYSV_V_alt): + + .align 4 + CNAME(ffi_closure_SYSV_alt): ++ BTI_C + /* See the comments above trampoline_code_table. */ + ldr x17, [sp, #8] /* Load closure in x17 */ + add sp, sp, #16 /* Restore the stack */ +diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am +index d286cf7..6ba98e1 100644 +--- a/testsuite/Makefile.am ++++ b/testsuite/Makefile.am +@@ -8,7 +8,7 @@ CLEANFILES = *.exe core* *.log *.sum + + EXTRA_DIST = config/default.exp emscripten/build.sh emscripten/conftest.py \ + emscripten/node-tests.sh emscripten/test.html emscripten/test_libffi.py \ +- emscripten/build-tests.sh lib/libffi.exp lib/target-libpath.exp \ ++ emscripten/build-tests.sh lib/libffi.exp lib/target-libpath.exp \ + lib/wrapper.exp libffi.bhaible/Makefile libffi.bhaible/README \ + 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 \ +-- +2.46.0 + diff --git a/0001-Forward-declare-open_temp_exec_file.patch b/0001-Forward-declare-open_temp_exec_file.patch deleted file mode 100644 index 0b9d148..0000000 --- a/0001-Forward-declare-open_temp_exec_file.patch +++ /dev/null @@ -1,44 +0,0 @@ -From ce077e5565366171aa1b4438749b0922fce887a4 Mon Sep 17 00:00:00 2001 -From: serge-sans-paille -Date: Thu, 2 Feb 2023 14:46:29 +0000 -Subject: [PATCH] Forward declare open_temp_exec_file (#764) - -It's defined in closures.c and used in tramp.c. -Also declare it as an hidden symbol, as it should be. - -Co-authored-by: serge-sans-paille ---- - include/ffi_common.h | 4 ++++ - src/tramp.c | 4 ++++ - 2 files changed, 8 insertions(+) - -diff --git a/include/ffi_common.h b/include/ffi_common.h -index 2bd31b03d..c53a79493 100644 ---- a/include/ffi_common.h -+++ b/include/ffi_common.h -@@ -128,6 +128,10 @@ void *ffi_data_to_code_pointer (void *data) FFI_HIDDEN; - static trampoline. */ - int ffi_tramp_is_present (void *closure) FFI_HIDDEN; - -+/* Return a file descriptor of a temporary zero-sized file in a -+ writable and executable filesystem. */ -+int open_temp_exec_file(void) FFI_HIDDEN; -+ - /* Extended cif, used in callback from assembly routine */ - typedef struct - { -diff --git a/src/tramp.c b/src/tramp.c -index 7e005b054..5f19b557f 100644 ---- a/src/tramp.c -+++ b/src/tramp.c -@@ -39,6 +39,10 @@ - #ifdef __linux__ - #define _GNU_SOURCE 1 - #endif -+ -+#include -+#include -+ - #include - #include - #include diff --git a/0002-ffi-fix-spelling-mistake-833.patch b/0002-ffi-fix-spelling-mistake-833.patch new file mode 100644 index 0000000..053fcce --- /dev/null +++ b/0002-ffi-fix-spelling-mistake-833.patch @@ -0,0 +1,27 @@ +From 38732240c125b6af9db66d940c0725a69292cc49 Mon Sep 17 00:00:00 2001 +From: Bill Roberts <152999275+billatarm@users.noreply.github.com> +Date: Sat, 1 Jun 2024 12:33:28 -0500 +Subject: [PATCH 2/7] ffi: fix spelling mistake (#833) +Content-type: text/plain; charset=UTF-8 + +Signed-off-by: Bill Roberts +--- + src/aarch64/ffi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/aarch64/ffi.c b/src/aarch64/ffi.c +index 8661a35..b13738e 100644 +--- a/src/aarch64/ffi.c ++++ b/src/aarch64/ffi.c +@@ -682,7 +682,7 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue, + else if (flags & AARCH64_RET_NEED_COPY) + rsize = 16; + +- /* Allocate consectutive stack for everything we'll need. ++ /* Allocate consecutive stack for everything we'll need. + The frame uses 40 bytes for: lr, fp, rvalue, flags, sp */ + context = alloca (sizeof(struct call_context) + stack_bytes + 40 + rsize); + stack = context + 1; +-- +2.46.0 + diff --git a/0003-aarch64-support-pointer-authentication-834.patch b/0003-aarch64-support-pointer-authentication-834.patch new file mode 100644 index 0000000..0386ada --- /dev/null +++ b/0003-aarch64-support-pointer-authentication-834.patch @@ -0,0 +1,333 @@ +From 45d284f2d066cc3a080c5be88e51b4d934349797 Mon Sep 17 00:00:00 2001 +From: Bill Roberts <152999275+billatarm@users.noreply.github.com> +Date: Sat, 1 Jun 2024 12:34:53 -0500 +Subject: [PATCH 3/7] aarch64: support pointer authentication (#834) +Content-type: text/plain; charset=UTF-8 + +* aarch64: fix callstack in ffi_call_SYSV + +The debug stack gets corrupted between the frame and stack pivots, update +the CFI directives so the call stack stays correct in the debugger. + +str x9, [x1, #32] // stack is ffi_call_SYSV() -> ffi_call_int() -> ffi_call_int() -> main() (good) +mov x29, x1 // stack is ffi_call_SYSV() -> ffi_call_int() -> ffi_call_int() -> ffi_call() -> main() (bad) +mov sp, x0 // stack is ffi_call_SYSV() -> ffi_call_int() -> ffi_call_int() -> main() (good) + +The CFA data needs to be updated around the pivots, after this patch the +callstack stays correct. + +Signed-off-by: Bill Roberts + +* aarch64: remove uneeded CFI directive + +This directive doesn't actually set the CFA to anything valid, and +during unwinding this isn't even used. Note that the PAC/Darwin usage +is quite suspect as well, as the CFA is either x1 or x29 after the frame +pivot, and the CFA address is what's used as the modifier when verifying +the PAC. At least this is the behavior on Linux with PAC, I need to +verify ARME ABI unwinding. So for now leave Darwin as is. + +Signed-off-by: Bill Roberts + +* ptrauth: rename define for clarity + +Rename the HAVE_PTRAUTH define for clarity that its associated with the +ARM64E ABI and not the ARM64 ABI that can be supported on Linux and +enabled with -mbranch-protection=standard. + +Signed-off-by: Bill Roberts + +* aarch64: add PAC support to ffi_call_SYSV + +Support AARCH64 Pointer Authentication Codes (PAC) within ffi_call_SYSV +and support exception unwinding. + +The Linux ABI for PAC is to use paciasp/autiasp instructions which also +have hint space equivelent instructions. They sign the LR (x30) with the +A key and the current stack pointer as the salt. Note that this can also be +configured to use the B key and will use pacibsp/autibsp hint instructions. + +The Linux ABI for exception frame data when PAC is enabled assumes that the +Connonical Frame Address, or CFA is equal to the stack pointer. I.E sp is +equal to x29 (fp). When the unwinder is invoked the cfa will point to +the frame which will include the *signed* return address from the LR. +This will then be passed to __builtin_aarch64_autia1716 where the CFA +will be used as the salt and stored to register x16 and register x17 +will contain the signed address to demangle. This can be noted in: + - https://github.com/gcc-mirror/gcc/blob/d6d7afcdbc04adb0ec42a44b2d7e05600945af42/libgcc/config/aarch64/aarch64-unwind.h#L56 + +The other required portion of this is to indicate to the unwinder that +this is a signed address that needs to go the special demangle route in +the unwinder. This is accomplished by using CFI directive "cfi_window_save" +which marks that frame as being signed. + +Putting all of this together is a bit tricky, as the internals of +ffi_call_SYSV the callee allocates its stack and frame and passes it in +arg1 (x0) and arg2 (x1) to the called function, where that function +pivots its stack, so care must be taken to get the sp == fp before +paciasp is called and also restore that state before autiasp is called. + +Signed-off-by: Bill Roberts + +--------- + +Signed-off-by: Bill Roberts +--- + configure.ac | 6 ++-- + include/ffi_cfi.h | 2 ++ + src/aarch64/ffi.c | 4 +-- + src/aarch64/internal.h | 76 ++++++++++++++++++++++++++++++++---------- + src/aarch64/sysv.S | 20 ++++++----- + src/closures.c | 6 ++-- + 6 files changed, 81 insertions(+), 33 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 816bfd6..b35a999 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -189,17 +189,17 @@ AC_CACHE_CHECK([whether compiler supports pointer authentication], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ + #ifdef __clang__ + # if __has_feature(ptrauth_calls) +-# define HAVE_PTRAUTH 1 ++# define HAVE_ARM64E_PTRAUTH 1 + # endif + #endif + +-#ifndef HAVE_PTRAUTH ++#ifndef HAVE_ARM64E_PTRAUTH + # error Pointer authentication not supported + #endif + ]])],[libffi_cv_as_ptrauth=yes],[libffi_cv_as_ptrauth=no]) + ]) + if test "x$libffi_cv_as_ptrauth" = xyes; then +- AC_DEFINE(HAVE_PTRAUTH, 1, ++ AC_DEFINE(HAVE_ARM64E_PTRAUTH, 1, + [Define if your compiler supports pointer authentication.]) + fi + +diff --git a/include/ffi_cfi.h b/include/ffi_cfi.h +index f4c292d..8565663 100644 +--- a/include/ffi_cfi.h ++++ b/include/ffi_cfi.h +@@ -49,6 +49,7 @@ + # define cfi_personality(enc, exp) .cfi_personality enc, exp + # define cfi_lsda(enc, exp) .cfi_lsda enc, exp + # define cfi_escape(...) .cfi_escape __VA_ARGS__ ++# define cfi_window_save .cfi_window_save + + #else + +@@ -71,6 +72,7 @@ + # define cfi_personality(enc, exp) + # define cfi_lsda(enc, exp) + # define cfi_escape(...) ++# define cfi_window_save + + #endif /* HAVE_AS_CFI_PSEUDO_OP */ + #endif /* FFI_CFI_H */ +diff --git a/src/aarch64/ffi.c b/src/aarch64/ffi.c +index b13738e..964934d 100644 +--- a/src/aarch64/ffi.c ++++ b/src/aarch64/ffi.c +@@ -63,7 +63,7 @@ struct call_context + #if FFI_EXEC_TRAMPOLINE_TABLE + + #ifdef __MACH__ +-#ifdef HAVE_PTRAUTH ++#ifdef HAVE_ARM64E_PTRAUTH + #include + #endif + #include +@@ -877,7 +877,7 @@ ffi_prep_closure_loc (ffi_closure *closure, + + #if FFI_EXEC_TRAMPOLINE_TABLE + # ifdef __MACH__ +-# ifdef HAVE_PTRAUTH ++# ifdef HAVE_ARM64E_PTRAUTH + codeloc = ptrauth_auth_data(codeloc, ptrauth_key_function_pointer, 0); + # endif + void **config = (void **)((uint8_t *)codeloc - PAGE_MAX_SIZE); +diff --git a/src/aarch64/internal.h b/src/aarch64/internal.h +index b5d102b..c39f9cb 100644 +--- a/src/aarch64/internal.h ++++ b/src/aarch64/internal.h +@@ -81,20 +81,62 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + /* Helpers for writing assembly compatible with arm ptr auth */ + #ifdef LIBFFI_ASM + +-#ifdef HAVE_PTRAUTH +-#define SIGN_LR pacibsp +-#define SIGN_LR_WITH_REG(x) pacib lr, x +-#define AUTH_LR_AND_RET retab +-#define AUTH_LR_WITH_REG(x) autib lr, x +-#define BRANCH_AND_LINK_TO_REG blraaz +-#define BRANCH_TO_REG braaz +-#else +-#define SIGN_LR +-#define SIGN_LR_WITH_REG(x) +-#define AUTH_LR_AND_RET ret +-#define AUTH_LR_WITH_REG(x) +-#define BRANCH_AND_LINK_TO_REG blr +-#define BRANCH_TO_REG br +-#endif +- +-#endif ++ #if defined(HAVE_ARM64E_PTRAUTH) ++ /* ARM64E ABI For Darwin */ ++ #define SIGN_LR pacibsp ++ #define SIGN_LR_WITH_REG(x) pacib lr, x ++ #define AUTH_LR_AND_RET retab ++ #define AUTH_LR_WITH_REG(x) autib lr, x ++ #define BRANCH_AND_LINK_TO_REG blraaz ++ #define BRANCH_TO_REG braaz ++ #define PAC_CFI_WINDOW_SAVE ++ /* Linux PAC Support */ ++ #elif defined(__ARM_FEATURE_PAC_DEFAULT) ++ #define GNU_PROPERTY_AARCH64_POINTER_AUTH (1 << 1) ++ #define PAC_CFI_WINDOW_SAVE cfi_window_save ++ #define TMP_REG x9 ++ #define BRANCH_TO_REG br ++ #define BRANCH_AND_LINK_TO_REG blr ++ #define SIGN_LR_LINUX_ONLY SIGN_LR ++ /* Which key to sign with? */ ++ #if (__ARM_FEATURE_PAC_DEFAULT & 1) == 1 ++ /* Signed with A-key */ ++ #define SIGN_LR hint #25 /* paciasp */ ++ #define AUTH_LR hint #29 /* autiasp */ ++ #else ++ /* Signed with B-key */ ++ #define SIGN_LR hint #27 /* pacibsp */ ++ #define AUTH_LR hint #31 /* autibsp */ ++ #endif /* __ARM_FEATURE_PAC_DEFAULT */ ++ #define AUTH_LR_WITH_REG(x) _auth_lr_with_reg x ++.macro _auth_lr_with_reg modifier ++ mov TMP_REG, sp ++ mov sp, \modifier ++ AUTH_LR ++ mov sp, TMP_REG ++.endm ++ #define SIGN_LR_WITH_REG(x) _sign_lr_with_reg x ++.macro _sign_lr_with_reg modifier ++ mov TMP_REG, sp ++ mov sp, \modifier ++ SIGN_LR ++ mov sp, TMP_REG ++.endm ++ #define AUTH_LR_AND_RET _auth_lr_and_ret modifier ++.macro _auth_lr_and_ret modifier ++ AUTH_LR ++ ret ++.endm ++ #undef TMP_REG ++ ++ /* No Pointer Auth */ ++ #else ++ #define SIGN_LR ++ #define SIGN_LR_WITH_REG(x) ++ #define AUTH_LR_AND_RET ret ++ #define AUTH_LR_WITH_REG(x) ++ #define BRANCH_AND_LINK_TO_REG blr ++ #define BRANCH_TO_REG br ++ #define PAC_CFI_WINDOW_SAVE ++ #endif /* HAVE_ARM64E_PTRAUTH */ ++#endif /* LIBFFI_ASM */ +diff --git a/src/aarch64/sysv.S b/src/aarch64/sysv.S +index 60cfa50..6a9a561 100644 +--- a/src/aarch64/sysv.S ++++ b/src/aarch64/sysv.S +@@ -92,27 +92,27 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + cfi_startproc + CNAME(ffi_call_SYSV): + BTI_C +- /* Sign the lr with x1 since that is where it will be stored */ ++ PAC_CFI_WINDOW_SAVE ++ /* Sign the lr with x1 since that is the CFA which is the modifer used in auth instructions */ + SIGN_LR_WITH_REG(x1) + +- /* Use a stack frame allocated by our caller. */ +-#if defined(HAVE_PTRAUTH) && defined(__APPLE__) ++#if defined(HAVE_ARM64E_PTRAUTH) && defined(__APPLE__) + /* darwin's libunwind assumes that the cfa is the sp and that's the data + * used to sign the lr. In order to allow unwinding through this + * function it is necessary to point the cfa at the signing register. + */ + cfi_def_cfa(x1, 0); +-#else +- cfi_def_cfa(x1, 40); + #endif ++ /* Use a stack frame allocated by our caller. */ + stp x29, x30, [x1] ++ cfi_def_cfa_register(x1) ++ cfi_rel_offset (x29, 0) ++ cfi_rel_offset (x30, 8) + mov x9, sp + str x9, [x1, #32] + mov x29, x1 +- mov sp, x0 + cfi_def_cfa_register(x29) +- cfi_rel_offset (x29, 0) +- cfi_rel_offset (x30, 8) ++ mov sp, x0 + + mov x9, x2 /* save fn */ + mov x8, x3 /* install structure return */ +@@ -326,6 +326,7 @@ CNAME(ffi_closure_SYSV_V): + cfi_startproc + BTI_C + SIGN_LR ++ PAC_CFI_WINDOW_SAVE + stp x29, x30, [sp, #-ffi_closure_SYSV_FS]! + cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) + cfi_rel_offset (x29, 0) +@@ -351,6 +352,7 @@ CNAME(ffi_closure_SYSV_V): + CNAME(ffi_closure_SYSV): + BTI_C + SIGN_LR ++ PAC_CFI_WINDOW_SAVE + stp x29, x30, [sp, #-ffi_closure_SYSV_FS]! + cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) + cfi_rel_offset (x29, 0) +@@ -648,6 +650,8 @@ CNAME(ffi_go_closure_SYSV_V): + cfi_startproc + CNAME(ffi_go_closure_SYSV): + BTI_C ++ SIGN_LR_LINUX_ONLY ++ PAC_CFI_WINDOW_SAVE + stp x29, x30, [sp, #-ffi_closure_SYSV_FS]! + cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) + cfi_rel_offset (x29, 0) +diff --git a/src/closures.c b/src/closures.c +index 67a94a8..02cf78f 100644 +--- a/src/closures.c ++++ b/src/closures.c +@@ -164,7 +164,7 @@ ffi_tramp_is_present (__attribute__((unused)) void *ptr) + + #include + #include +-#ifdef HAVE_PTRAUTH ++#ifdef HAVE_ARM64E_PTRAUTH + #include + #endif + #include +@@ -223,7 +223,7 @@ ffi_trampoline_table_alloc (void) + /* Remap the trampoline table on top of the placeholder page */ + trampoline_page = config_page + PAGE_MAX_SIZE; + +-#ifdef HAVE_PTRAUTH ++#ifdef HAVE_ARM64E_PTRAUTH + trampoline_page_template = (vm_address_t)(uintptr_t)ptrauth_auth_data((void *)&ffi_closure_trampoline_table_page, ptrauth_key_function_pointer, 0); + #else + trampoline_page_template = (vm_address_t)&ffi_closure_trampoline_table_page; +@@ -268,7 +268,7 @@ ffi_trampoline_table_alloc (void) + ffi_trampoline_table_entry *entry = &table->free_list_pool[i]; + entry->trampoline = + (void *) (trampoline_page + (i * FFI_TRAMPOLINE_SIZE)); +-#ifdef HAVE_PTRAUTH ++#ifdef HAVE_ARM64E_PTRAUTH + entry->trampoline = ptrauth_sign_unauthenticated(entry->trampoline, ptrauth_key_function_pointer, 0); + #endif + +-- +2.46.0 + diff --git a/0005-Import-from-upstream.patch b/0005-Import-from-upstream.patch new file mode 100644 index 0000000..5e68935 --- /dev/null +++ b/0005-Import-from-upstream.patch @@ -0,0 +1,758 @@ +From 6993bc14dad1cd24294d64bf91e4503a4d7835d6 Mon Sep 17 00:00:00 2001 +From: Anthony Green +Date: Sat, 1 Jun 2024 13:42:29 -0400 +Subject: [PATCH 5/7] Import from upstream +Content-type: text/plain; charset=UTF-8 + +--- + config.guess | 102 +++++++++++++++++----- + config.sub | 241 ++++++++++++++++++++++++++++++++++----------------- + 2 files changed, 240 insertions(+), 103 deletions(-) + +diff --git a/config.guess b/config.guess +index 7f76b62..f6d217a 100644 +--- a/config.guess ++++ b/config.guess +@@ -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-01-01' + + # 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. + +@@ -155,6 +155,9 @@ Linux|GNU|GNU/*) + + set_cc_for_build + cat <<-EOF > "$dummy.c" ++ #if defined(__ANDROID__) ++ LIBC=android ++ #else + #include + #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 + /* 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 + ;; +@@ -904,7 +910,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 +972,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 +1068,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 +1192,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 +1232,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 +1373,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 + GUESS=i586-unisys-sysv4 + ;; +@@ -1367,8 +1419,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 +1595,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? +diff --git a/config.sub b/config.sub +index 630b5d9..2c6a07a 100755 +--- a/config.sub ++++ b/config.sub +@@ -1,10 +1,10 @@ + #! /bin/sh + # Configuration validation subroutine script. +-# 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-03' ++timestamp='2024-01-01' + + # 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 +@@ -76,13 +76,13 @@ Report bugs and patches to ." + version="\ + GNU config.sub ($timestamp) + +-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 +@@ -130,7 +130,7 @@ IFS=$saved_IFS + # Separate into logical components for further validation + case $1 in + *-*-*-*-*) +- echo Invalid configuration \`"$1"\': more than four components >&2 ++ echo "Invalid configuration '$1': more than four components" >&2 + exit 1 + ;; + *-*-*-*) +@@ -145,7 +145,8 @@ case $1 in + nto-qnx* | linux-* | uclinux-uclibc* \ + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ +- | storm-chaos* | os2-emx* | rtmk-nova*) ++ | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \ ++ | windows-* ) + basic_machine=$field1 + basic_os=$maybe_os + ;; +@@ -943,7 +944,7 @@ $basic_machine + EOF + IFS=$saved_IFS + ;; +- # We use `pc' rather than `unknown' ++ # We use 'pc' rather than 'unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) +@@ -1075,7 +1076,7 @@ case $cpu-$vendor in + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + cpu=i586 + ;; +- pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*) ++ pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) + cpu=i686 + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) +@@ -1126,7 +1127,7 @@ case $cpu-$vendor in + xscale-* | xscalee[bl]-*) + cpu=`echo "$cpu" | sed 's/^xscale/arm/'` + ;; +- arm64-* | arm64_32-* | aarch64le-*) ++ arm64-* | aarch64le-*) + cpu=aarch64 + ;; + +@@ -1180,7 +1181,7 @@ case $cpu-$vendor in + case $cpu in + 1750a | 580 \ + | a29k \ +- | aarch64 | aarch64_be \ ++ | aarch64 | aarch64_be | aarch64c | arm64ec \ + | abacus \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ +@@ -1199,50 +1200,29 @@ case $cpu-$vendor in + | d10v | d30v | dlx | dsp16xx \ + | e2k | elxsi | epiphany \ + | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ ++ | javascript \ + | h8300 | h8500 \ + | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i*86 | i860 | i960 | ia16 | ia64 \ + | ip2k | iq2000 \ + | k1om \ ++ | kvx \ + | le32 | le64 \ + | lm32 \ +- | loongarch32 | loongarch64 | loongarchx32 \ ++ | loongarch32 | loongarch64 \ + | m32c | m32r | m32rle \ + | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ + | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ + | m88110 | m88k | maxq | mb | mcore | mep | metag \ + | microblaze | microblazeel \ +- | mips | mipsbe | mipseb | mipsel | mipsle \ +- | mips16 \ +- | mips64 | mips64eb | mips64el \ +- | mips64octeon | mips64octeonel \ +- | mips64orion | mips64orionel \ +- | mips64r5900 | mips64r5900el \ +- | mips64vr | mips64vrel \ +- | mips64vr4100 | mips64vr4100el \ +- | mips64vr4300 | mips64vr4300el \ +- | mips64vr5000 | mips64vr5000el \ +- | mips64vr5900 | mips64vr5900el \ +- | mipsisa32 | mipsisa32el \ +- | mipsisa32r2 | mipsisa32r2el \ +- | mipsisa32r3 | mipsisa32r3el \ +- | mipsisa32r5 | mipsisa32r5el \ +- | mipsisa32r6 | mipsisa32r6el \ +- | mipsisa64 | mipsisa64el \ +- | mipsisa64r2 | mipsisa64r2el \ +- | mipsisa64r3 | mipsisa64r3el \ +- | mipsisa64r5 | mipsisa64r5el \ +- | mipsisa64r6 | mipsisa64r6el \ +- | mipsisa64sb1 | mipsisa64sb1el \ +- | mipsisa64sr71k | mipsisa64sr71kel \ +- | mipsr5900 | mipsr5900el \ +- | mipstx39 | mipstx39el \ ++ | mips* \ + | mmix \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ ++ | nanomips* \ + | nds32 | nds32le | nds32be \ + | nfp \ + | nios | nios2 | nios2eb | nios2el \ +@@ -1274,6 +1254,7 @@ case $cpu-$vendor in + | ubicom32 \ + | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ + | vax \ ++ | vc4 \ + | visium \ + | w65 \ + | wasm32 | wasm64 \ +@@ -1285,7 +1266,7 @@ case $cpu-$vendor in + ;; + + *) +- echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 ++ echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2 + exit 1 + ;; + esac +@@ -1306,11 +1287,12 @@ esac + + # Decode manufacturer-specific aliases for certain operating systems. + +-if test x$basic_os != x ++if test x"$basic_os" != x + then + + # First recognize some ad-hoc cases, or perhaps split kernel-os, or else just + # set os. ++obj= + case $basic_os in + gnu/linux*) + kernel=linux +@@ -1341,6 +1323,10 @@ EOF + kernel=linux + os=`echo "$basic_os" | sed -e 's|linux|gnu|'` + ;; ++ managarm*) ++ kernel=managarm ++ os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'` ++ ;; + *) + kernel= + os=$basic_os +@@ -1506,10 +1492,16 @@ case $os in + os=eabi + ;; + *) +- os=elf ++ os= ++ obj=elf + ;; + esac + ;; ++ aout* | coff* | elf* | pe*) ++ # These are machine code file formats, not OSes ++ obj=$os ++ os= ++ ;; + *) + # No normalization, but not necessarily accepted, that comes below. + ;; +@@ -1528,12 +1520,15 @@ else + # system, and we'll never get to this point. + + kernel= ++obj= + case $cpu-$vendor in + score-*) +- os=elf ++ os= ++ obj=elf + ;; + spu-*) +- os=elf ++ os= ++ obj=elf + ;; + *-acorn) + os=riscix1.2 +@@ -1543,28 +1538,35 @@ case $cpu-$vendor in + os=gnu + ;; + arm*-semi) +- os=aout ++ os= ++ obj=aout + ;; + c4x-* | tic4x-*) +- os=coff ++ os= ++ obj=coff + ;; + c8051-*) +- os=elf ++ os= ++ obj=elf + ;; + clipper-intergraph) + os=clix + ;; + hexagon-*) +- os=elf ++ os= ++ obj=elf + ;; + tic54x-*) +- os=coff ++ os= ++ obj=coff + ;; + tic55x-*) +- os=coff ++ os= ++ obj=coff + ;; + tic6x-*) +- os=coff ++ os= ++ obj=coff + ;; + # This must come before the *-dec entry. + pdp10-*) +@@ -1586,19 +1588,24 @@ case $cpu-$vendor in + os=sunos3 + ;; + m68*-cisco) +- os=aout ++ os= ++ obj=aout + ;; + mep-*) +- os=elf ++ os= ++ obj=elf + ;; + mips*-cisco) +- os=elf ++ os= ++ obj=elf + ;; +- mips*-*) +- os=elf ++ mips*-*|nanomips*-*) ++ os= ++ obj=elf + ;; + or32-*) +- os=coff ++ os= ++ obj=coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=sysv3 +@@ -1607,7 +1614,8 @@ case $cpu-$vendor in + os=sunos4.1.1 + ;; + pru-*) +- os=elf ++ os= ++ obj=elf + ;; + *-be) + os=beos +@@ -1688,10 +1696,12 @@ case $cpu-$vendor in + os=uxpv + ;; + *-rom68k) +- os=coff ++ os= ++ obj=coff + ;; + *-*bug) +- os=coff ++ os= ++ obj=coff + ;; + *-apple) + os=macos +@@ -1709,10 +1719,11 @@ esac + + fi + +-# Now, validate our (potentially fixed-up) OS. ++# Now, validate our (potentially fixed-up) individual pieces (OS, OBJ). ++ + case $os in + # Sometimes we do "kernel-libc", so those need to count as OSes. +- musl* | newlib* | relibc* | uclibc*) ++ llvm* | musl* | newlib* | relibc* | uclibc*) + ;; + # Likewise for "kernel-abi" + eabi* | gnueabi*) +@@ -1720,6 +1731,9 @@ case $os in + # VxWorks passes extra cpu info in the 4th filed. + simlinux | simwindows | spe) + ;; ++ # See `case $cpu-$os` validation below ++ ghcjs) ++ ;; + # Now accept the basic system types. + # The portable systems comes first. + # Each alternative MUST end in a * to match a version number. +@@ -1728,7 +1742,7 @@ case $os in + | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ + | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ + | hiux* | abug | nacl* | netware* | windows* \ +- | os9* | macos* | osx* | ios* | watchos* | tvos* \ ++ | os9* | macos* | osx* | ios* | tvos* | watchos* \ + | mpw* | magic* | mmixware* | mon960* | lnews* \ + | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ + | aos* | aros* | cloudabi* | sortix* | twizzler* \ +@@ -1737,11 +1751,11 @@ case $os in + | mirbsd* | netbsd* | dicos* | openedition* | ose* \ + | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ + | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ +- | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ +- | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ ++ | bosx* | nextstep* | cxux* | oabi* \ ++ | ptx* | ecoff* | winnt* | domain* | vsta* \ + | udi* | lites* | ieee* | go32* | aux* | hcos* \ + | chorusrdb* | cegcc* | glidix* | serenity* \ +- | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ ++ | cygwin* | msys* | moss* | proelf* | rtems* \ + | midipix* | mingw32* | mingw64* | mint* \ + | uxpv* | beos* | mpeix* | udk* | moxiebox* \ + | interix* | uwin* | mks* | rhapsody* | darwin* \ +@@ -1754,51 +1768,116 @@ case $os in + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ + | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ +- | fiwix* ) ++ | fiwix* | mlibc* | cos* | mbr* | ironclad* ) + ;; + # This one is extra strict with allowed versions + sco3.2v2 | sco3.2v[4-9]* | sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + ;; ++ # This refers to builds using the UEFI calling convention ++ # (which depends on the architecture) and PE file format. ++ # Note that this is both a different calling convention and ++ # different file format than that of GNU-EFI ++ # (x86_64-w64-mingw32). ++ uefi) ++ ;; + none) + ;; ++ kernel* | msvc* ) ++ # Restricted further below ++ ;; ++ '') ++ if test x"$obj" = x ++ then ++ echo "Invalid configuration '$1': Blank OS only allowed with explicit machine code file format" 1>&2 ++ fi ++ ;; ++ *) ++ echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 ++ exit 1 ++ ;; ++esac ++ ++case $obj in ++ aout* | coff* | elf* | pe*) ++ ;; ++ '') ++ # empty is fine ++ ;; + *) +- echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 ++ echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 ++ exit 1 ++ ;; ++esac ++ ++# Here we handle the constraint that a (synthetic) cpu and os are ++# valid only in combination with each other and nowhere else. ++case $cpu-$os in ++ # The "javascript-unknown-ghcjs" triple is used by GHC; we ++ # accept it here in order to tolerate that, but reject any ++ # variations. ++ javascript-ghcjs) ++ ;; ++ javascript-* | *-ghcjs) ++ echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 + exit 1 + ;; + esac + + # As a final step for OS-related things, validate the OS-kernel combination + # (given a valid OS), if there is a kernel. +-case $kernel-$os in +- linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ +- | linux-musl* | linux-relibc* | linux-uclibc* ) ++case $kernel-$os-$obj in ++ linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ ++ | linux-mlibc*- | linux-musl*- | linux-newlib*- \ ++ | linux-relibc*- | linux-uclibc*- ) ++ ;; ++ uclinux-uclibc*- ) ++ ;; ++ managarm-mlibc*- | managarm-kernel*- ) + ;; +- uclinux-uclibc* ) ++ windows*-msvc*-) + ;; +- -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* ) ++ -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ ++ | -uclibc*- ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. +- echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 ++ echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 + exit 1 + ;; +- kfreebsd*-gnu* | kopensolaris*-gnu*) ++ -kernel*- ) ++ echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 ++ exit 1 + ;; +- vxworks-simlinux | vxworks-simwindows | vxworks-spe) ++ *-kernel*- ) ++ echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 ++ exit 1 + ;; +- nto-qnx*) ++ *-msvc*- ) ++ echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 ++ exit 1 + ;; +- os2-emx) ++ kfreebsd*-gnu*- | kopensolaris*-gnu*-) ++ ;; ++ vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) ++ ;; ++ nto-qnx*-) ++ ;; ++ os2-emx-) + ;; +- ios*-simulator | tvos*-simulator | watchos*-simulator) ++ *-eabi*- | *-gnueabi*-) + ;; +- *-eabi* | *-gnueabi*) ++ none--*) ++ # None (no kernel, i.e. freestanding / bare metal), ++ # can be paired with an machine code file format + ;; +- -*) ++ -*-) + # Blank kernel with real OS is always fine. + ;; +- *-*) +- echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 ++ --*) ++ # Blank kernel and OS with real machine code file format is always fine. ++ ;; ++ *-*-*) ++ echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 + exit 1 + ;; + esac +@@ -1881,7 +1960,7 @@ case $vendor in + ;; + esac + +-echo "$cpu-$vendor-${kernel:+$kernel-}$os" ++echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" + exit + + # Local variables: +-- +2.46.0 + diff --git a/0006-aarch64-Add-a-missing-no-op-define-of-SIGN_LR_LINUX_.patch b/0006-aarch64-Add-a-missing-no-op-define-of-SIGN_LR_LINUX_.patch new file mode 100644 index 0000000..bcf6f0f --- /dev/null +++ b/0006-aarch64-Add-a-missing-no-op-define-of-SIGN_LR_LINUX_.patch @@ -0,0 +1,37 @@ +From 9c9e8368e49804c4f7c35ac9f0d7c1d0d533308b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Martin=20Storsj=C3=B6?= +Date: Tue, 4 Jun 2024 14:13:08 +0300 +Subject: [PATCH 6/7] aarch64: Add a missing no-op define of SIGN_LR_LINUX_ONLY + (#838) +Content-type: text/plain; charset=UTF-8 + +This is needed at least if building for Linux, with a toolchain +that doesn't default to having PAC enabled, fixing build errors +since 45d284f2d066cc3a080c5be88e51b4d934349797. +--- + src/aarch64/internal.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/aarch64/internal.h b/src/aarch64/internal.h +index c39f9cb..50fa5c1 100644 +--- a/src/aarch64/internal.h ++++ b/src/aarch64/internal.h +@@ -88,6 +88,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + #define AUTH_LR_AND_RET retab + #define AUTH_LR_WITH_REG(x) autib lr, x + #define BRANCH_AND_LINK_TO_REG blraaz ++ #define SIGN_LR_LINUX_ONLY + #define BRANCH_TO_REG braaz + #define PAC_CFI_WINDOW_SAVE + /* Linux PAC Support */ +@@ -136,6 +137,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + #define AUTH_LR_AND_RET ret + #define AUTH_LR_WITH_REG(x) + #define BRANCH_AND_LINK_TO_REG blr ++ #define SIGN_LR_LINUX_ONLY + #define BRANCH_TO_REG br + #define PAC_CFI_WINDOW_SAVE + #endif /* HAVE_ARM64E_PTRAUTH */ +-- +2.46.0 + diff --git a/0007-Fix-struct-args-Rainer-Orth.patch b/0007-Fix-struct-args-Rainer-Orth.patch new file mode 100644 index 0000000..cf2ec18 --- /dev/null +++ b/0007-Fix-struct-args-Rainer-Orth.patch @@ -0,0 +1,47 @@ +From 8e3ef965c2d0015ed129a06d0f11f30c2120a413 Mon Sep 17 00:00:00 2001 +From: Anthony Green +Date: Fri, 28 Jun 2024 04:07:09 -0400 +Subject: [PATCH 7/7] Fix struct args (Rainer Orth) +Content-type: text/plain; charset=UTF-8 + +--- + src/sparc/ffi.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/src/sparc/ffi.c b/src/sparc/ffi.c +index 9e406d0..cf819ee 100644 +--- a/src/sparc/ffi.c ++++ b/src/sparc/ffi.c +@@ -286,6 +286,8 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue, + void **avalue, void *closure) + { + size_t bytes = cif->bytes; ++ size_t i, nargs = cif->nargs; ++ ffi_type **arg_types = cif->arg_types; + + FFI_ASSERT (cif->abi == FFI_V8); + +@@ -295,6 +297,20 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue, + && (cif->flags & SPARC_FLAG_RET_MASK) == SPARC_RET_STRUCT) + bytes += FFI_ALIGN (cif->rtype->size, 8); + ++ /* If we have any structure arguments, make a copy so we are passing ++ by value. */ ++ for (i = 0; i < nargs; i++) ++ { ++ ffi_type *at = arg_types[i]; ++ int size = at->size; ++ if (at->type == FFI_TYPE_STRUCT) ++ { ++ char *argcopy = alloca (size); ++ memcpy (argcopy, avalue[i], size); ++ avalue[i] = argcopy; ++ } ++ } ++ + ffi_call_v8(cif, fn, rvalue, avalue, -bytes, closure); + } + +-- +2.46.0 + diff --git a/libffi.spec b/libffi.spec index cf2abf4..87590b8 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.6 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A portable foreign function interface library # No license change for 3.4.6 # The following SPDX licenses are extracted from the sources using @@ -41,9 +41,19 @@ Source0: https://github.com/libffi/libffi/releases/download/v%{version}/libffi-% Source1: ffi-multilib.h Source2: ffitarget-multilib.h -# error: implicit declaration of function 'open_temp_exec_file' -# https://github.com/libffi/libffi/pull/764 -#Patch0: 0001-Forward-declare-open_temp_exec_file.patch +# Fix AArch64 BTI issues by pulling in upstream commits after 3.4.6. +# "Install ISO's die when run on an arm64 machine with BTI" +# https://bugzilla.redhat.com/show_bug.cgi?id=2305877 +# +# Patch numbers relative to v3.4.6 tag: +Patch0: 0001-Fix-bti-support-830.patch +Patch1: 0002-ffi-fix-spelling-mistake-833.patch +Patch2: 0003-aarch64-support-pointer-authentication-834.patch +# Skip manual fix to avoid needing makeinfo to build libffi. +# Patch3: 0004-A-fix-to-the-struct-type-example-837.patch +Patch4: 0005-Import-from-upstream.patch +Patch5: 0006-aarch64-Add-a-missing-no-op-define-of-SIGN_LR_LINUX_.patch +Patch6: 0007-Fix-struct-args-Rainer-Orth.patch BuildRequires: make BuildRequires: gcc @@ -145,6 +155,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Wed Aug 21 2024 Carlos O'Donell 3.4.6-3 +- Fix AArch64 BTI enablement issues (#2305877) + * Thu Jul 18 2024 Fedora Release Engineering - 3.4.6-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From 95f8efdc74dc6c222619bcb6bb7dadb9a06362e1 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 7 Oct 2024 11:41:05 +0200 Subject: [PATCH 43/58] Fix testsuite failure in rawhide gating (bz#2307027) Due to recent changes in rpm 4.20, the rpmbuild build dir is no longer where the test script expected it, causing the said failures. --- tests/testsuite/runtest.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/testsuite/runtest.sh b/tests/testsuite/runtest.sh index 92c2f0f..e98b87a 100755 --- a/tests/testsuite/runtest.sh +++ b/tests/testsuite/runtest.sh @@ -47,7 +47,8 @@ rlJournalStart rlRun "popd" rlRun "specfile=$(rpm --eval='%_specdir')/libffi.spec" rlRun "rpmbuild -bp $specfile" - rlRun "builddir=$(rpm --eval='%_builddir')" + # https://github.com/rpm-software-management/rpm/issues/3147#issuecomment-2154192419 + rlRun "builddir=$(rpmbuild -bc --short-circuit --define '__spec_build_pre echo builddir=%{_builddir}; exit 0' $specfile | sed -n 's/^builddir=//p')" rlRun "pushd $builddir/libffi-*/" rlRun "./configure" rlRUn "make" From b1fac7a4b7dac4937ef598afd2a7dd90a18bc83c Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 7 Oct 2024 12:16:05 +0200 Subject: [PATCH 44/58] Replace testsuite patches with sed expressions (bz#2307027) Using sed expressions instead patches is more portable and is how we are testing this downstream. --- tests/testsuite/Makefile | 2 +- tests/testsuite/dynamic_linking-dg.patch | 29 ------------------------ tests/testsuite/dynamic_linking.patch | 29 ------------------------ tests/testsuite/runtest.sh | 25 +++++++++----------- 4 files changed, 12 insertions(+), 73 deletions(-) delete mode 100644 tests/testsuite/dynamic_linking-dg.patch delete mode 100644 tests/testsuite/dynamic_linking.patch diff --git a/tests/testsuite/Makefile b/tests/testsuite/Makefile index f729bae..6884b7d 100644 --- a/tests/testsuite/Makefile +++ b/tests/testsuite/Makefile @@ -28,7 +28,7 @@ export TESTVERSION=1.0 BUILT_FILES= -FILES=$(METADATA) runtest.sh Makefile PURPOSE dynamic_linking.patch dynamic_linking-dg.patch +FILES=$(METADATA) runtest.sh Makefile PURPOSE .PHONY: all install download clean diff --git a/tests/testsuite/dynamic_linking-dg.patch b/tests/testsuite/dynamic_linking-dg.patch deleted file mode 100644 index fb10ae3..0000000 --- a/tests/testsuite/dynamic_linking-dg.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- testsuite/lib/libffi-dg.exp 2008-02-14 19:45:33.000000000 -0500 -+++ testsuite/lib/libffi-dg.exp 2015-02-13 13:32:08.422053435 -0500 -@@ -110,7 +110,7 @@ - } - verbose "gccdir $gccdir" - -- set ld_library_path "." -+ set ld_library_path "" - append ld_library_path ":${gccdir}" - - set compiler "${gccdir}/xgcc" -@@ -127,16 +127,13 @@ - } - } - } -- # add the library path for libffi. -- append ld_library_path ":${blddirffi}/.libs" -- - verbose "ld_library_path: $ld_library_path" - - # Point to the Libffi headers in libffi. - set libffi_include "${blddirffi}/include" - verbose "libffi_include $libffi_include" - -- set libffi_dir "${blddirffi}/.libs" -+ set libffi_dir "/usr/LIBRARY_DIR" - verbose "libffi_dir $libffi_dir" - if { $libffi_dir != "" } { - set libffi_dir [file dirname ${libffi_dir}] diff --git a/tests/testsuite/dynamic_linking.patch b/tests/testsuite/dynamic_linking.patch deleted file mode 100644 index 65de4d7..0000000 --- a/tests/testsuite/dynamic_linking.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- testsuite/lib/libffi.exp 2013-03-16 07:19:39.000000000 -0400 -+++ testsuite/lib/libffi.exp 2014-10-22 11:10:42.449143642 -0400 -@@ -118,7 +118,7 @@ - } - verbose "gccdir $gccdir" - -- set ld_library_path "." -+ set ld_library_path "" - append ld_library_path ":${gccdir}" - - set compiler "${gccdir}/xgcc" -@@ -142,16 +142,13 @@ - - } - -- # add the library path for libffi. -- append ld_library_path ":${blddirffi}/.libs" -- - verbose "ld_library_path: $ld_library_path" - - # Point to the Libffi headers in libffi. - set libffi_include "${blddirffi}/include" - verbose "libffi_include $libffi_include" - -- set libffi_dir "${blddirffi}/.libs" -+ set libffi_dir "/usr/LIBRARY_DIR" - verbose "libffi_dir $libffi_dir" - if { $libffi_dir != "" } { - set libffi_dir [file dirname ${libffi_dir}] diff --git a/tests/testsuite/runtest.sh b/tests/testsuite/runtest.sh index e98b87a..8102c2c 100755 --- a/tests/testsuite/runtest.sh +++ b/tests/testsuite/runtest.sh @@ -40,7 +40,6 @@ rlJournalStart done; rlRun "TmpDir=`mktemp -d`" 0 "Creating tmp directory" - rlRun "cp *.patch $TmpDir/" rlRun "pushd $TmpDir" rlFetchSrcForInstalled libffi rlRun "rpm -ivh libffi*.src.rpm" @@ -55,19 +54,17 @@ rlJournalStart rlPhaseEnd rlPhaseStartTest "Run testsuite" - - # patching the testsuite to test the installed libraries instead of the built ones - if [ -e /usr/lib64/libffi.so ]; then - export LD_LIBRARY_PATH=/usr/lib64 - perl -i -pe 's/LIBRARY_DIR/lib64/' $TmpDir/dynamic_linking.patch - perl -i -pe 's/LIBRARY_DIR/lib64/' $TmpDir/dynamic_linking-dg.patch - else - export LD_LIBRARY_PATH=/usr/lib - perl -i -pe 's/LIBRARY_DIR/lib/' $TmpDir/dynamic_linking.patch - perl -i -pe 's/LIBRARY_DIR/lib/' $TmpDir/dynamic_linking-dg.patch - fi - test -e testsuite/lib/libffi.exp && rlRun "patch testsuite/lib/libffi.exp < $TmpDir/dynamic_linking.patch" - test -e testsuite/lib/libffi-dg.exp && rlRun "patch testsuite/lib/libffi-dg.exp < $TmpDir/dynamic_linking-dg.patch" + set -xe + # Patch the testsuite to run with the installed libffi libraries, not + # with the ones built from the rpm. + # Do not add the current dir or the build dir to ld_library_path + sed -i 's/set ld_library_path "."/set ld_library_path ""/' testsuite/lib/libffi*.exp + sed -i '/append ld_library_path.*blddirffi/d' testsuite/lib/libffi*.exp + # Set ld_library_path to the system libdir (typically /usr/lib or /usr/lib64) + export MYLIBDIR=$(rpm --eval '%{_libdir}') + sed -i 's;set libffi_dir.*"[^"]*";set libffi_dir "'"${MYLIBDIR}"'";' testsuite/lib/libffi*.exp + fgrep -e 'set ld_library_path' -e 'set libffi_dir' testsuite/lib/libffi.exp + set +xe rlLog "Checking whether we test really the installed libraries." strace -F -e open,openat,stat -o strace.log -- make check LIBFFI_SO_CALLS=`cat strace.log | grep libffi.so | grep -v ENOENT | grep -v 'usr/lib' | grep -v '\"\/lib' | grep -v 'unfinished' | wc -l` From 9c9f6a4b927e7f2cf483fa451447c9135322e748 Mon Sep 17 00:00:00 2001 From: Michal Kolar Date: Wed, 4 Dec 2024 14:31:20 +0000 Subject: [PATCH 45/58] update tests/testsuite Add main.fmf to meet new tmt testing workflow requirements. Update runtest.sh to curent version to fix the CI failures. Adapt runtest.sh to the new behavior under Fedora due to rpmbuild started using specpartsdir and extra -build directory in build path. --- tests/testsuite/Makefile | 6 +++--- tests/testsuite/main.fmf | 33 +++++++++++++++++++++++++++++++++ tests/testsuite/runtest.sh | 13 ++++++------- 3 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 tests/testsuite/main.fmf diff --git a/tests/testsuite/Makefile b/tests/testsuite/Makefile index 6884b7d..59c8522 100644 --- a/tests/testsuite/Makefile +++ b/tests/testsuite/Makefile @@ -6,7 +6,7 @@ # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -# Copyright (c) 2010 Red Hat, Inc. +# Copyright (c) 2010 Red Hat, Inc. All rights reserved. # # This program is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -51,9 +51,9 @@ $(METADATA): Makefile @echo "Path: $(TEST_DIR)" >> $(METADATA) @echo "Description: Runs upstream testsuite" >> $(METADATA) @echo "Type: Sanity" >> $(METADATA) - @echo "TestTime: 19m" >> $(METADATA) + @echo "TestTime: 35m" >> $(METADATA) @echo "RunFor: libffi" >> $(METADATA) - @echo "Requires: libffi libffi-devel gcc dejagnu rpm-build gcc-c++ texinfo strace" >> $(METADATA) + @echo "Requires: libffi libffi-devel libtool gcc dejagnu rpm-build gcc-c++ texinfo strace" >> $(METADATA) @echo "Priority: Normal" >> $(METADATA) @echo "License: GPLv3" >> $(METADATA) @echo "Confidential: no" >> $(METADATA) diff --git a/tests/testsuite/main.fmf b/tests/testsuite/main.fmf new file mode 100644 index 0000000..360ae2b --- /dev/null +++ b/tests/testsuite/main.fmf @@ -0,0 +1,33 @@ +summary: Runs upstream testsuite +description: '' +enabled: true +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1031159 + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=839210 + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1006261 +tag: + - CI-Tier-1 + - RHEL6 + - Tier1 + - rhel-buildroot +tier: '1' +contact: mcermak@redhat.com +component: + - libffi +test: ./runtest.sh +framework: beakerlib +require: + - libffi + - libffi-devel + - libtool + - gcc + - dejagnu + - rpm-build + - gcc-c++ + - texinfo + - strace +duration: 35m +extra-nitrate: TC#0063644 +extra-summary: /tools/libffi/Sanity/testsuite +extra-task: /tools/libffi/Sanity/testsuite +id: 2d3a499f-1f59-40f0-a76c-1c73569d0512 diff --git a/tests/testsuite/runtest.sh b/tests/testsuite/runtest.sh index 8102c2c..19a7f8c 100755 --- a/tests/testsuite/runtest.sh +++ b/tests/testsuite/runtest.sh @@ -8,7 +8,7 @@ # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -# Copyright (c) 2010 Red Hat, Inc. +# Copyright (c) 2010 Red Hat, Inc. All rights reserved. # # This program is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -26,7 +26,7 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Include rhts environment -. /usr/lib/beakerlib/beakerlib.sh +. /usr/share/beakerlib/beakerlib.sh || exit 1 PACKAGES=(libffi libffi-devel gcc dejagnu rpm-build gcc-c++) @@ -45,12 +45,11 @@ rlJournalStart rlRun "rpm -ivh libffi*.src.rpm" rlRun "popd" rlRun "specfile=$(rpm --eval='%_specdir')/libffi.spec" - rlRun "rpmbuild -bp $specfile" - # https://github.com/rpm-software-management/rpm/issues/3147#issuecomment-2154192419 - rlRun "builddir=$(rpmbuild -bc --short-circuit --define '__spec_build_pre echo builddir=%{_builddir}; exit 0' $specfile | sed -n 's/^builddir=//p')" - rlRun "pushd $builddir/libffi-*/" + rlRun "rpmbuild -bp --undefine specpartsdir $specfile" + rlRun "builddir=$(rpm --eval='%_builddir')" + rlRun "pushd $(dirname `find $builddir -name configure`)" rlRun "./configure" - rlRUn "make" + rlRun "make" rlPhaseEnd rlPhaseStartTest "Run testsuite" From ddf7b4cbe303bda38cf702127aa5206ac85d884c Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 17 Jan 2025 11:12:51 +0000 Subject: [PATCH 46/58] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index 87590b8..8199730 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.6 -Release: 3%{?dist} +Release: 4%{?dist} Summary: A portable foreign function interface library # No license change for 3.4.6 # The following SPDX licenses are extracted from the sources using @@ -155,6 +155,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Fri Jan 17 2025 Fedora Release Engineering - 3.4.6-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Wed Aug 21 2024 Carlos O'Donell 3.4.6-3 - Fix AArch64 BTI enablement issues (#2305877) From 1782ee5d69d9d22d133e819be0f65d0769a3876c Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Wed, 22 Jan 2025 20:34:05 -0500 Subject: [PATCH 47/58] Fix FTBFS for C23 (#2340729) Backports 0859f8431242d5adff21420b9cab538d2af527b5 from upstream --- libffi-3.4.6-C23.patch | 40 ++++++++++++++++++++++++++++++++++++++++ libffi.spec | 7 ++++++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 libffi-3.4.6-C23.patch diff --git a/libffi-3.4.6-C23.patch b/libffi-3.4.6-C23.patch new file mode 100644 index 0000000..2dc538a --- /dev/null +++ b/libffi-3.4.6-C23.patch @@ -0,0 +1,40 @@ +From 0859f8431242d5adff21420b9cab538d2af527b5 Mon Sep 17 00:00:00 2001 +From: Joseph Myers +Date: Thu, 24 Oct 2024 18:26:58 +0000 +Subject: Fix testsuite for C23 `va_start` (#861) + +In the C23 revision of the C standard, `va_start` ignores its second +argument, which is no longer required (previously the last named +function parameter - which the compiler knows anyway, so it's +redundant information). + +This has the consequence for the libffi testsuite, when making GCC +default to `-std=gnu23`, of making two tests fail with warnings about +an unused function argument (only passed to `va_start` and not +otherwise used). Fix those test failures by explicitly casting the +argument to `void`. + +diff --git a/testsuite/libffi.call/va_struct2.c b/testsuite/libffi.call/va_struct2.c +index a8daff3..a034087 100644 +--- a/testsuite/libffi.call/va_struct2.c ++++ b/testsuite/libffi.call/va_struct2.c +@@ -33,6 +33,7 @@ test_fn (int n, ...) + struct small_tag s2; + struct large_tag l; + ++ (void) n; + va_start (ap, n); + s1 = va_arg (ap, struct small_tag); + l = va_arg (ap, struct large_tag); +diff --git a/testsuite/libffi.call/va_struct3.c b/testsuite/libffi.call/va_struct3.c +index d3bd280..5a52c9f 100644 +--- a/testsuite/libffi.call/va_struct3.c ++++ b/testsuite/libffi.call/va_struct3.c +@@ -33,6 +33,7 @@ test_fn (int n, ...) + struct small_tag s2; + struct large_tag l; + ++ (void) n; + va_start (ap, n); + s1 = va_arg (ap, struct small_tag); + l = va_arg (ap, struct large_tag); diff --git a/libffi.spec b/libffi.spec index 8199730..eab0d0f 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.6 -Release: 4%{?dist} +Release: 5%{?dist} Summary: A portable foreign function interface library # No license change for 3.4.6 # The following SPDX licenses are extracted from the sources using @@ -55,6 +55,8 @@ Patch4: 0005-Import-from-upstream.patch Patch5: 0006-aarch64-Add-a-missing-no-op-define-of-SIGN_LR_LINUX_.patch Patch6: 0007-Fix-struct-args-Rainer-Orth.patch +Patch7: libffi-3.4.6-C23.patch + BuildRequires: make BuildRequires: gcc %if %{without bootstrap} @@ -155,6 +157,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Wed Jan 22 2025 DJ Delorie - 3.4.6-5 +- Fix FTBFS due to C23 compiler (#2340729) + * Fri Jan 17 2025 Fedora Release Engineering - 3.4.6-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild From 62132c12602bc06eaa75b732a5c312c4172cb17d Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Tue, 18 Feb 2025 21:14:26 -0500 Subject: [PATCH 48/58] Update to libffi-3.4.7 Reviewed-by: Carlos O'Donell --- .gitignore | 1 + 0001-Fix-bti-support-830.patch | 82 -- 0002-ffi-fix-spelling-mistake-833.patch | 27 - ...4-support-pointer-authentication-834.patch | 333 -------- 0005-Import-from-upstream.patch | 758 ------------------ ...ssing-no-op-define-of-SIGN_LR_LINUX_.patch | 37 - 0007-Fix-struct-args-Rainer-Orth.patch | 47 -- libffi-3.4.6-C23.patch | 40 - libffi.spec | 24 +- sources | 2 +- 10 files changed, 8 insertions(+), 1343 deletions(-) delete mode 100644 0001-Fix-bti-support-830.patch delete mode 100644 0002-ffi-fix-spelling-mistake-833.patch delete mode 100644 0003-aarch64-support-pointer-authentication-834.patch delete mode 100644 0005-Import-from-upstream.patch delete mode 100644 0006-aarch64-Add-a-missing-no-op-define-of-SIGN_LR_LINUX_.patch delete mode 100644 0007-Fix-struct-args-Rainer-Orth.patch delete mode 100644 libffi-3.4.6-C23.patch diff --git a/.gitignore b/.gitignore index 5108e89..483789d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ libffi-3.0.9.tar.gz /libffi-3.4.2.tar.gz /libffi-3.4.4.tar.gz /libffi-3.4.6.tar.gz +/libffi-3.4.7.tar.gz diff --git a/0001-Fix-bti-support-830.patch b/0001-Fix-bti-support-830.patch deleted file mode 100644 index 22f68d6..0000000 --- a/0001-Fix-bti-support-830.patch +++ /dev/null @@ -1,82 +0,0 @@ -From f64141ee3f9e455a060bd09e9ab72b6c94653d7c Mon Sep 17 00:00:00 2001 -From: Bill Roberts <152999275+billatarm@users.noreply.github.com> -Date: Tue, 19 Mar 2024 11:44:55 -0500 -Subject: [PATCH 1/7] Fix bti support (#830) -Content-type: text/plain; charset=UTF-8 - -* bti: add identifier to ffi_closure_SYSV_V_alt - -This was missing BTI_C identifier. - -Old Code: -ffi_closure_SYSV_V_alt: -0000fffff7f70500: ldr x17, [sp, #8] - -Signed-off-by: Bill Roberts - -* testsuite: fix whitespace in Makefile.am - -Signed-off-by: Bill Roberts - -* aarch64: correct comment describing BTI - -The comment is incorrect, BTI is enabled per mapping via mprotect with -PROT_BTI flag set, not per-process. When the loader loads the library, -if the GNU Notes section is missing this, PROT_BTI will not be enabled -for that mapping, but is independent of other mappings. - -Signed-off-by: Bill Roberts - ---------- - -Signed-off-by: Bill Roberts ---- - src/aarch64/sysv.S | 4 +++- - testsuite/Makefile.am | 2 +- - 2 files changed, 4 insertions(+), 2 deletions(-) - -diff --git a/src/aarch64/sysv.S b/src/aarch64/sysv.S -index fdd0e8b..60cfa50 100644 ---- a/src/aarch64/sysv.S -+++ b/src/aarch64/sysv.S -@@ -68,7 +68,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - #define BTI_J hint #36 - /* - * The ELF Notes section needs to indicate if BTI is supported, as the first ELF loaded that doesn't -- * declare this support disables it for the whole process. -+ * declare this support disables it for memory region containing the loaded library. - */ - # define GNU_PROPERTY_AARCH64_BTI (1 << 0) /* Has Branch Target Identification */ - .text -@@ -527,6 +527,7 @@ L(do_closure): - #if defined(FFI_EXEC_STATIC_TRAMP) - .align 4 - CNAME(ffi_closure_SYSV_V_alt): -+ BTI_C - /* See the comments above trampoline_code_table. */ - ldr x17, [sp, #8] /* Load closure in x17 */ - add sp, sp, #16 /* Restore the stack */ -@@ -541,6 +542,7 @@ CNAME(ffi_closure_SYSV_V_alt): - - .align 4 - CNAME(ffi_closure_SYSV_alt): -+ BTI_C - /* See the comments above trampoline_code_table. */ - ldr x17, [sp, #8] /* Load closure in x17 */ - add sp, sp, #16 /* Restore the stack */ -diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am -index d286cf7..6ba98e1 100644 ---- a/testsuite/Makefile.am -+++ b/testsuite/Makefile.am -@@ -8,7 +8,7 @@ CLEANFILES = *.exe core* *.log *.sum - - EXTRA_DIST = config/default.exp emscripten/build.sh emscripten/conftest.py \ - emscripten/node-tests.sh emscripten/test.html emscripten/test_libffi.py \ -- emscripten/build-tests.sh lib/libffi.exp lib/target-libpath.exp \ -+ emscripten/build-tests.sh lib/libffi.exp lib/target-libpath.exp \ - lib/wrapper.exp libffi.bhaible/Makefile libffi.bhaible/README \ - 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 \ --- -2.46.0 - diff --git a/0002-ffi-fix-spelling-mistake-833.patch b/0002-ffi-fix-spelling-mistake-833.patch deleted file mode 100644 index 053fcce..0000000 --- a/0002-ffi-fix-spelling-mistake-833.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 38732240c125b6af9db66d940c0725a69292cc49 Mon Sep 17 00:00:00 2001 -From: Bill Roberts <152999275+billatarm@users.noreply.github.com> -Date: Sat, 1 Jun 2024 12:33:28 -0500 -Subject: [PATCH 2/7] ffi: fix spelling mistake (#833) -Content-type: text/plain; charset=UTF-8 - -Signed-off-by: Bill Roberts ---- - src/aarch64/ffi.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/aarch64/ffi.c b/src/aarch64/ffi.c -index 8661a35..b13738e 100644 ---- a/src/aarch64/ffi.c -+++ b/src/aarch64/ffi.c -@@ -682,7 +682,7 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue, - else if (flags & AARCH64_RET_NEED_COPY) - rsize = 16; - -- /* Allocate consectutive stack for everything we'll need. -+ /* Allocate consecutive stack for everything we'll need. - The frame uses 40 bytes for: lr, fp, rvalue, flags, sp */ - context = alloca (sizeof(struct call_context) + stack_bytes + 40 + rsize); - stack = context + 1; --- -2.46.0 - diff --git a/0003-aarch64-support-pointer-authentication-834.patch b/0003-aarch64-support-pointer-authentication-834.patch deleted file mode 100644 index 0386ada..0000000 --- a/0003-aarch64-support-pointer-authentication-834.patch +++ /dev/null @@ -1,333 +0,0 @@ -From 45d284f2d066cc3a080c5be88e51b4d934349797 Mon Sep 17 00:00:00 2001 -From: Bill Roberts <152999275+billatarm@users.noreply.github.com> -Date: Sat, 1 Jun 2024 12:34:53 -0500 -Subject: [PATCH 3/7] aarch64: support pointer authentication (#834) -Content-type: text/plain; charset=UTF-8 - -* aarch64: fix callstack in ffi_call_SYSV - -The debug stack gets corrupted between the frame and stack pivots, update -the CFI directives so the call stack stays correct in the debugger. - -str x9, [x1, #32] // stack is ffi_call_SYSV() -> ffi_call_int() -> ffi_call_int() -> main() (good) -mov x29, x1 // stack is ffi_call_SYSV() -> ffi_call_int() -> ffi_call_int() -> ffi_call() -> main() (bad) -mov sp, x0 // stack is ffi_call_SYSV() -> ffi_call_int() -> ffi_call_int() -> main() (good) - -The CFA data needs to be updated around the pivots, after this patch the -callstack stays correct. - -Signed-off-by: Bill Roberts - -* aarch64: remove uneeded CFI directive - -This directive doesn't actually set the CFA to anything valid, and -during unwinding this isn't even used. Note that the PAC/Darwin usage -is quite suspect as well, as the CFA is either x1 or x29 after the frame -pivot, and the CFA address is what's used as the modifier when verifying -the PAC. At least this is the behavior on Linux with PAC, I need to -verify ARME ABI unwinding. So for now leave Darwin as is. - -Signed-off-by: Bill Roberts - -* ptrauth: rename define for clarity - -Rename the HAVE_PTRAUTH define for clarity that its associated with the -ARM64E ABI and not the ARM64 ABI that can be supported on Linux and -enabled with -mbranch-protection=standard. - -Signed-off-by: Bill Roberts - -* aarch64: add PAC support to ffi_call_SYSV - -Support AARCH64 Pointer Authentication Codes (PAC) within ffi_call_SYSV -and support exception unwinding. - -The Linux ABI for PAC is to use paciasp/autiasp instructions which also -have hint space equivelent instructions. They sign the LR (x30) with the -A key and the current stack pointer as the salt. Note that this can also be -configured to use the B key and will use pacibsp/autibsp hint instructions. - -The Linux ABI for exception frame data when PAC is enabled assumes that the -Connonical Frame Address, or CFA is equal to the stack pointer. I.E sp is -equal to x29 (fp). When the unwinder is invoked the cfa will point to -the frame which will include the *signed* return address from the LR. -This will then be passed to __builtin_aarch64_autia1716 where the CFA -will be used as the salt and stored to register x16 and register x17 -will contain the signed address to demangle. This can be noted in: - - https://github.com/gcc-mirror/gcc/blob/d6d7afcdbc04adb0ec42a44b2d7e05600945af42/libgcc/config/aarch64/aarch64-unwind.h#L56 - -The other required portion of this is to indicate to the unwinder that -this is a signed address that needs to go the special demangle route in -the unwinder. This is accomplished by using CFI directive "cfi_window_save" -which marks that frame as being signed. - -Putting all of this together is a bit tricky, as the internals of -ffi_call_SYSV the callee allocates its stack and frame and passes it in -arg1 (x0) and arg2 (x1) to the called function, where that function -pivots its stack, so care must be taken to get the sp == fp before -paciasp is called and also restore that state before autiasp is called. - -Signed-off-by: Bill Roberts - ---------- - -Signed-off-by: Bill Roberts ---- - configure.ac | 6 ++-- - include/ffi_cfi.h | 2 ++ - src/aarch64/ffi.c | 4 +-- - src/aarch64/internal.h | 76 ++++++++++++++++++++++++++++++++---------- - src/aarch64/sysv.S | 20 ++++++----- - src/closures.c | 6 ++-- - 6 files changed, 81 insertions(+), 33 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 816bfd6..b35a999 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -189,17 +189,17 @@ AC_CACHE_CHECK([whether compiler supports pointer authentication], - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ - #ifdef __clang__ - # if __has_feature(ptrauth_calls) --# define HAVE_PTRAUTH 1 -+# define HAVE_ARM64E_PTRAUTH 1 - # endif - #endif - --#ifndef HAVE_PTRAUTH -+#ifndef HAVE_ARM64E_PTRAUTH - # error Pointer authentication not supported - #endif - ]])],[libffi_cv_as_ptrauth=yes],[libffi_cv_as_ptrauth=no]) - ]) - if test "x$libffi_cv_as_ptrauth" = xyes; then -- AC_DEFINE(HAVE_PTRAUTH, 1, -+ AC_DEFINE(HAVE_ARM64E_PTRAUTH, 1, - [Define if your compiler supports pointer authentication.]) - fi - -diff --git a/include/ffi_cfi.h b/include/ffi_cfi.h -index f4c292d..8565663 100644 ---- a/include/ffi_cfi.h -+++ b/include/ffi_cfi.h -@@ -49,6 +49,7 @@ - # define cfi_personality(enc, exp) .cfi_personality enc, exp - # define cfi_lsda(enc, exp) .cfi_lsda enc, exp - # define cfi_escape(...) .cfi_escape __VA_ARGS__ -+# define cfi_window_save .cfi_window_save - - #else - -@@ -71,6 +72,7 @@ - # define cfi_personality(enc, exp) - # define cfi_lsda(enc, exp) - # define cfi_escape(...) -+# define cfi_window_save - - #endif /* HAVE_AS_CFI_PSEUDO_OP */ - #endif /* FFI_CFI_H */ -diff --git a/src/aarch64/ffi.c b/src/aarch64/ffi.c -index b13738e..964934d 100644 ---- a/src/aarch64/ffi.c -+++ b/src/aarch64/ffi.c -@@ -63,7 +63,7 @@ struct call_context - #if FFI_EXEC_TRAMPOLINE_TABLE - - #ifdef __MACH__ --#ifdef HAVE_PTRAUTH -+#ifdef HAVE_ARM64E_PTRAUTH - #include - #endif - #include -@@ -877,7 +877,7 @@ ffi_prep_closure_loc (ffi_closure *closure, - - #if FFI_EXEC_TRAMPOLINE_TABLE - # ifdef __MACH__ --# ifdef HAVE_PTRAUTH -+# ifdef HAVE_ARM64E_PTRAUTH - codeloc = ptrauth_auth_data(codeloc, ptrauth_key_function_pointer, 0); - # endif - void **config = (void **)((uint8_t *)codeloc - PAGE_MAX_SIZE); -diff --git a/src/aarch64/internal.h b/src/aarch64/internal.h -index b5d102b..c39f9cb 100644 ---- a/src/aarch64/internal.h -+++ b/src/aarch64/internal.h -@@ -81,20 +81,62 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - /* Helpers for writing assembly compatible with arm ptr auth */ - #ifdef LIBFFI_ASM - --#ifdef HAVE_PTRAUTH --#define SIGN_LR pacibsp --#define SIGN_LR_WITH_REG(x) pacib lr, x --#define AUTH_LR_AND_RET retab --#define AUTH_LR_WITH_REG(x) autib lr, x --#define BRANCH_AND_LINK_TO_REG blraaz --#define BRANCH_TO_REG braaz --#else --#define SIGN_LR --#define SIGN_LR_WITH_REG(x) --#define AUTH_LR_AND_RET ret --#define AUTH_LR_WITH_REG(x) --#define BRANCH_AND_LINK_TO_REG blr --#define BRANCH_TO_REG br --#endif -- --#endif -+ #if defined(HAVE_ARM64E_PTRAUTH) -+ /* ARM64E ABI For Darwin */ -+ #define SIGN_LR pacibsp -+ #define SIGN_LR_WITH_REG(x) pacib lr, x -+ #define AUTH_LR_AND_RET retab -+ #define AUTH_LR_WITH_REG(x) autib lr, x -+ #define BRANCH_AND_LINK_TO_REG blraaz -+ #define BRANCH_TO_REG braaz -+ #define PAC_CFI_WINDOW_SAVE -+ /* Linux PAC Support */ -+ #elif defined(__ARM_FEATURE_PAC_DEFAULT) -+ #define GNU_PROPERTY_AARCH64_POINTER_AUTH (1 << 1) -+ #define PAC_CFI_WINDOW_SAVE cfi_window_save -+ #define TMP_REG x9 -+ #define BRANCH_TO_REG br -+ #define BRANCH_AND_LINK_TO_REG blr -+ #define SIGN_LR_LINUX_ONLY SIGN_LR -+ /* Which key to sign with? */ -+ #if (__ARM_FEATURE_PAC_DEFAULT & 1) == 1 -+ /* Signed with A-key */ -+ #define SIGN_LR hint #25 /* paciasp */ -+ #define AUTH_LR hint #29 /* autiasp */ -+ #else -+ /* Signed with B-key */ -+ #define SIGN_LR hint #27 /* pacibsp */ -+ #define AUTH_LR hint #31 /* autibsp */ -+ #endif /* __ARM_FEATURE_PAC_DEFAULT */ -+ #define AUTH_LR_WITH_REG(x) _auth_lr_with_reg x -+.macro _auth_lr_with_reg modifier -+ mov TMP_REG, sp -+ mov sp, \modifier -+ AUTH_LR -+ mov sp, TMP_REG -+.endm -+ #define SIGN_LR_WITH_REG(x) _sign_lr_with_reg x -+.macro _sign_lr_with_reg modifier -+ mov TMP_REG, sp -+ mov sp, \modifier -+ SIGN_LR -+ mov sp, TMP_REG -+.endm -+ #define AUTH_LR_AND_RET _auth_lr_and_ret modifier -+.macro _auth_lr_and_ret modifier -+ AUTH_LR -+ ret -+.endm -+ #undef TMP_REG -+ -+ /* No Pointer Auth */ -+ #else -+ #define SIGN_LR -+ #define SIGN_LR_WITH_REG(x) -+ #define AUTH_LR_AND_RET ret -+ #define AUTH_LR_WITH_REG(x) -+ #define BRANCH_AND_LINK_TO_REG blr -+ #define BRANCH_TO_REG br -+ #define PAC_CFI_WINDOW_SAVE -+ #endif /* HAVE_ARM64E_PTRAUTH */ -+#endif /* LIBFFI_ASM */ -diff --git a/src/aarch64/sysv.S b/src/aarch64/sysv.S -index 60cfa50..6a9a561 100644 ---- a/src/aarch64/sysv.S -+++ b/src/aarch64/sysv.S -@@ -92,27 +92,27 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - cfi_startproc - CNAME(ffi_call_SYSV): - BTI_C -- /* Sign the lr with x1 since that is where it will be stored */ -+ PAC_CFI_WINDOW_SAVE -+ /* Sign the lr with x1 since that is the CFA which is the modifer used in auth instructions */ - SIGN_LR_WITH_REG(x1) - -- /* Use a stack frame allocated by our caller. */ --#if defined(HAVE_PTRAUTH) && defined(__APPLE__) -+#if defined(HAVE_ARM64E_PTRAUTH) && defined(__APPLE__) - /* darwin's libunwind assumes that the cfa is the sp and that's the data - * used to sign the lr. In order to allow unwinding through this - * function it is necessary to point the cfa at the signing register. - */ - cfi_def_cfa(x1, 0); --#else -- cfi_def_cfa(x1, 40); - #endif -+ /* Use a stack frame allocated by our caller. */ - stp x29, x30, [x1] -+ cfi_def_cfa_register(x1) -+ cfi_rel_offset (x29, 0) -+ cfi_rel_offset (x30, 8) - mov x9, sp - str x9, [x1, #32] - mov x29, x1 -- mov sp, x0 - cfi_def_cfa_register(x29) -- cfi_rel_offset (x29, 0) -- cfi_rel_offset (x30, 8) -+ mov sp, x0 - - mov x9, x2 /* save fn */ - mov x8, x3 /* install structure return */ -@@ -326,6 +326,7 @@ CNAME(ffi_closure_SYSV_V): - cfi_startproc - BTI_C - SIGN_LR -+ PAC_CFI_WINDOW_SAVE - stp x29, x30, [sp, #-ffi_closure_SYSV_FS]! - cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) - cfi_rel_offset (x29, 0) -@@ -351,6 +352,7 @@ CNAME(ffi_closure_SYSV_V): - CNAME(ffi_closure_SYSV): - BTI_C - SIGN_LR -+ PAC_CFI_WINDOW_SAVE - stp x29, x30, [sp, #-ffi_closure_SYSV_FS]! - cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) - cfi_rel_offset (x29, 0) -@@ -648,6 +650,8 @@ CNAME(ffi_go_closure_SYSV_V): - cfi_startproc - CNAME(ffi_go_closure_SYSV): - BTI_C -+ SIGN_LR_LINUX_ONLY -+ PAC_CFI_WINDOW_SAVE - stp x29, x30, [sp, #-ffi_closure_SYSV_FS]! - cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) - cfi_rel_offset (x29, 0) -diff --git a/src/closures.c b/src/closures.c -index 67a94a8..02cf78f 100644 ---- a/src/closures.c -+++ b/src/closures.c -@@ -164,7 +164,7 @@ ffi_tramp_is_present (__attribute__((unused)) void *ptr) - - #include - #include --#ifdef HAVE_PTRAUTH -+#ifdef HAVE_ARM64E_PTRAUTH - #include - #endif - #include -@@ -223,7 +223,7 @@ ffi_trampoline_table_alloc (void) - /* Remap the trampoline table on top of the placeholder page */ - trampoline_page = config_page + PAGE_MAX_SIZE; - --#ifdef HAVE_PTRAUTH -+#ifdef HAVE_ARM64E_PTRAUTH - trampoline_page_template = (vm_address_t)(uintptr_t)ptrauth_auth_data((void *)&ffi_closure_trampoline_table_page, ptrauth_key_function_pointer, 0); - #else - trampoline_page_template = (vm_address_t)&ffi_closure_trampoline_table_page; -@@ -268,7 +268,7 @@ ffi_trampoline_table_alloc (void) - ffi_trampoline_table_entry *entry = &table->free_list_pool[i]; - entry->trampoline = - (void *) (trampoline_page + (i * FFI_TRAMPOLINE_SIZE)); --#ifdef HAVE_PTRAUTH -+#ifdef HAVE_ARM64E_PTRAUTH - entry->trampoline = ptrauth_sign_unauthenticated(entry->trampoline, ptrauth_key_function_pointer, 0); - #endif - --- -2.46.0 - diff --git a/0005-Import-from-upstream.patch b/0005-Import-from-upstream.patch deleted file mode 100644 index 5e68935..0000000 --- a/0005-Import-from-upstream.patch +++ /dev/null @@ -1,758 +0,0 @@ -From 6993bc14dad1cd24294d64bf91e4503a4d7835d6 Mon Sep 17 00:00:00 2001 -From: Anthony Green -Date: Sat, 1 Jun 2024 13:42:29 -0400 -Subject: [PATCH 5/7] Import from upstream -Content-type: text/plain; charset=UTF-8 - ---- - config.guess | 102 +++++++++++++++++----- - config.sub | 241 ++++++++++++++++++++++++++++++++++----------------- - 2 files changed, 240 insertions(+), 103 deletions(-) - -diff --git a/config.guess b/config.guess -index 7f76b62..f6d217a 100644 ---- a/config.guess -+++ b/config.guess -@@ -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-01-01' - - # 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. - -@@ -155,6 +155,9 @@ Linux|GNU|GNU/*) - - set_cc_for_build - cat <<-EOF > "$dummy.c" -+ #if defined(__ANDROID__) -+ LIBC=android -+ #else - #include - #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 - /* 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 - ;; -@@ -904,7 +910,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 +972,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 +1068,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 +1192,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 +1232,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 +1373,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 - GUESS=i586-unisys-sysv4 - ;; -@@ -1367,8 +1419,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 +1595,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? -diff --git a/config.sub b/config.sub -index 630b5d9..2c6a07a 100755 ---- a/config.sub -+++ b/config.sub -@@ -1,10 +1,10 @@ - #! /bin/sh - # Configuration validation subroutine script. --# 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-03' -+timestamp='2024-01-01' - - # 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 -@@ -76,13 +76,13 @@ Report bugs and patches to ." - version="\ - GNU config.sub ($timestamp) - --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 -@@ -130,7 +130,7 @@ IFS=$saved_IFS - # Separate into logical components for further validation - case $1 in - *-*-*-*-*) -- echo Invalid configuration \`"$1"\': more than four components >&2 -+ echo "Invalid configuration '$1': more than four components" >&2 - exit 1 - ;; - *-*-*-*) -@@ -145,7 +145,8 @@ case $1 in - nto-qnx* | linux-* | uclinux-uclibc* \ - | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ - | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ -- | storm-chaos* | os2-emx* | rtmk-nova*) -+ | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \ -+ | windows-* ) - basic_machine=$field1 - basic_os=$maybe_os - ;; -@@ -943,7 +944,7 @@ $basic_machine - EOF - IFS=$saved_IFS - ;; -- # We use `pc' rather than `unknown' -+ # We use 'pc' rather than 'unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) -@@ -1075,7 +1076,7 @@ case $cpu-$vendor in - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - cpu=i586 - ;; -- pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*) -+ pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) - cpu=i686 - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) -@@ -1126,7 +1127,7 @@ case $cpu-$vendor in - xscale-* | xscalee[bl]-*) - cpu=`echo "$cpu" | sed 's/^xscale/arm/'` - ;; -- arm64-* | arm64_32-* | aarch64le-*) -+ arm64-* | aarch64le-*) - cpu=aarch64 - ;; - -@@ -1180,7 +1181,7 @@ case $cpu-$vendor in - case $cpu in - 1750a | 580 \ - | a29k \ -- | aarch64 | aarch64_be \ -+ | aarch64 | aarch64_be | aarch64c | arm64ec \ - | abacus \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ -@@ -1199,50 +1200,29 @@ case $cpu-$vendor in - | d10v | d30v | dlx | dsp16xx \ - | e2k | elxsi | epiphany \ - | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ -+ | javascript \ - | h8300 | h8500 \ - | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i*86 | i860 | i960 | ia16 | ia64 \ - | ip2k | iq2000 \ - | k1om \ -+ | kvx \ - | le32 | le64 \ - | lm32 \ -- | loongarch32 | loongarch64 | loongarchx32 \ -+ | loongarch32 | loongarch64 \ - | m32c | m32r | m32rle \ - | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ - | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ - | m88110 | m88k | maxq | mb | mcore | mep | metag \ - | microblaze | microblazeel \ -- | mips | mipsbe | mipseb | mipsel | mipsle \ -- | mips16 \ -- | mips64 | mips64eb | mips64el \ -- | mips64octeon | mips64octeonel \ -- | mips64orion | mips64orionel \ -- | mips64r5900 | mips64r5900el \ -- | mips64vr | mips64vrel \ -- | mips64vr4100 | mips64vr4100el \ -- | mips64vr4300 | mips64vr4300el \ -- | mips64vr5000 | mips64vr5000el \ -- | mips64vr5900 | mips64vr5900el \ -- | mipsisa32 | mipsisa32el \ -- | mipsisa32r2 | mipsisa32r2el \ -- | mipsisa32r3 | mipsisa32r3el \ -- | mipsisa32r5 | mipsisa32r5el \ -- | mipsisa32r6 | mipsisa32r6el \ -- | mipsisa64 | mipsisa64el \ -- | mipsisa64r2 | mipsisa64r2el \ -- | mipsisa64r3 | mipsisa64r3el \ -- | mipsisa64r5 | mipsisa64r5el \ -- | mipsisa64r6 | mipsisa64r6el \ -- | mipsisa64sb1 | mipsisa64sb1el \ -- | mipsisa64sr71k | mipsisa64sr71kel \ -- | mipsr5900 | mipsr5900el \ -- | mipstx39 | mipstx39el \ -+ | mips* \ - | mmix \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ -+ | nanomips* \ - | nds32 | nds32le | nds32be \ - | nfp \ - | nios | nios2 | nios2eb | nios2el \ -@@ -1274,6 +1254,7 @@ case $cpu-$vendor in - | ubicom32 \ - | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ - | vax \ -+ | vc4 \ - | visium \ - | w65 \ - | wasm32 | wasm64 \ -@@ -1285,7 +1266,7 @@ case $cpu-$vendor in - ;; - - *) -- echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 -+ echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2 - exit 1 - ;; - esac -@@ -1306,11 +1287,12 @@ esac - - # Decode manufacturer-specific aliases for certain operating systems. - --if test x$basic_os != x -+if test x"$basic_os" != x - then - - # First recognize some ad-hoc cases, or perhaps split kernel-os, or else just - # set os. -+obj= - case $basic_os in - gnu/linux*) - kernel=linux -@@ -1341,6 +1323,10 @@ EOF - kernel=linux - os=`echo "$basic_os" | sed -e 's|linux|gnu|'` - ;; -+ managarm*) -+ kernel=managarm -+ os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'` -+ ;; - *) - kernel= - os=$basic_os -@@ -1506,10 +1492,16 @@ case $os in - os=eabi - ;; - *) -- os=elf -+ os= -+ obj=elf - ;; - esac - ;; -+ aout* | coff* | elf* | pe*) -+ # These are machine code file formats, not OSes -+ obj=$os -+ os= -+ ;; - *) - # No normalization, but not necessarily accepted, that comes below. - ;; -@@ -1528,12 +1520,15 @@ else - # system, and we'll never get to this point. - - kernel= -+obj= - case $cpu-$vendor in - score-*) -- os=elf -+ os= -+ obj=elf - ;; - spu-*) -- os=elf -+ os= -+ obj=elf - ;; - *-acorn) - os=riscix1.2 -@@ -1543,28 +1538,35 @@ case $cpu-$vendor in - os=gnu - ;; - arm*-semi) -- os=aout -+ os= -+ obj=aout - ;; - c4x-* | tic4x-*) -- os=coff -+ os= -+ obj=coff - ;; - c8051-*) -- os=elf -+ os= -+ obj=elf - ;; - clipper-intergraph) - os=clix - ;; - hexagon-*) -- os=elf -+ os= -+ obj=elf - ;; - tic54x-*) -- os=coff -+ os= -+ obj=coff - ;; - tic55x-*) -- os=coff -+ os= -+ obj=coff - ;; - tic6x-*) -- os=coff -+ os= -+ obj=coff - ;; - # This must come before the *-dec entry. - pdp10-*) -@@ -1586,19 +1588,24 @@ case $cpu-$vendor in - os=sunos3 - ;; - m68*-cisco) -- os=aout -+ os= -+ obj=aout - ;; - mep-*) -- os=elf -+ os= -+ obj=elf - ;; - mips*-cisco) -- os=elf -+ os= -+ obj=elf - ;; -- mips*-*) -- os=elf -+ mips*-*|nanomips*-*) -+ os= -+ obj=elf - ;; - or32-*) -- os=coff -+ os= -+ obj=coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=sysv3 -@@ -1607,7 +1614,8 @@ case $cpu-$vendor in - os=sunos4.1.1 - ;; - pru-*) -- os=elf -+ os= -+ obj=elf - ;; - *-be) - os=beos -@@ -1688,10 +1696,12 @@ case $cpu-$vendor in - os=uxpv - ;; - *-rom68k) -- os=coff -+ os= -+ obj=coff - ;; - *-*bug) -- os=coff -+ os= -+ obj=coff - ;; - *-apple) - os=macos -@@ -1709,10 +1719,11 @@ esac - - fi - --# Now, validate our (potentially fixed-up) OS. -+# Now, validate our (potentially fixed-up) individual pieces (OS, OBJ). -+ - case $os in - # Sometimes we do "kernel-libc", so those need to count as OSes. -- musl* | newlib* | relibc* | uclibc*) -+ llvm* | musl* | newlib* | relibc* | uclibc*) - ;; - # Likewise for "kernel-abi" - eabi* | gnueabi*) -@@ -1720,6 +1731,9 @@ case $os in - # VxWorks passes extra cpu info in the 4th filed. - simlinux | simwindows | spe) - ;; -+ # See `case $cpu-$os` validation below -+ ghcjs) -+ ;; - # Now accept the basic system types. - # The portable systems comes first. - # Each alternative MUST end in a * to match a version number. -@@ -1728,7 +1742,7 @@ case $os in - | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ - | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ - | hiux* | abug | nacl* | netware* | windows* \ -- | os9* | macos* | osx* | ios* | watchos* | tvos* \ -+ | os9* | macos* | osx* | ios* | tvos* | watchos* \ - | mpw* | magic* | mmixware* | mon960* | lnews* \ - | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ - | aos* | aros* | cloudabi* | sortix* | twizzler* \ -@@ -1737,11 +1751,11 @@ case $os in - | mirbsd* | netbsd* | dicos* | openedition* | ose* \ - | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ - | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ -- | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ -- | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ -+ | bosx* | nextstep* | cxux* | oabi* \ -+ | ptx* | ecoff* | winnt* | domain* | vsta* \ - | udi* | lites* | ieee* | go32* | aux* | hcos* \ - | chorusrdb* | cegcc* | glidix* | serenity* \ -- | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ -+ | cygwin* | msys* | moss* | proelf* | rtems* \ - | midipix* | mingw32* | mingw64* | mint* \ - | uxpv* | beos* | mpeix* | udk* | moxiebox* \ - | interix* | uwin* | mks* | rhapsody* | darwin* \ -@@ -1754,51 +1768,116 @@ case $os in - | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ - | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ - | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ -- | fiwix* ) -+ | fiwix* | mlibc* | cos* | mbr* | ironclad* ) - ;; - # This one is extra strict with allowed versions - sco3.2v2 | sco3.2v[4-9]* | sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - ;; -+ # This refers to builds using the UEFI calling convention -+ # (which depends on the architecture) and PE file format. -+ # Note that this is both a different calling convention and -+ # different file format than that of GNU-EFI -+ # (x86_64-w64-mingw32). -+ uefi) -+ ;; - none) - ;; -+ kernel* | msvc* ) -+ # Restricted further below -+ ;; -+ '') -+ if test x"$obj" = x -+ then -+ echo "Invalid configuration '$1': Blank OS only allowed with explicit machine code file format" 1>&2 -+ fi -+ ;; -+ *) -+ echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 -+ exit 1 -+ ;; -+esac -+ -+case $obj in -+ aout* | coff* | elf* | pe*) -+ ;; -+ '') -+ # empty is fine -+ ;; - *) -- echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 -+ echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 -+ exit 1 -+ ;; -+esac -+ -+# Here we handle the constraint that a (synthetic) cpu and os are -+# valid only in combination with each other and nowhere else. -+case $cpu-$os in -+ # The "javascript-unknown-ghcjs" triple is used by GHC; we -+ # accept it here in order to tolerate that, but reject any -+ # variations. -+ javascript-ghcjs) -+ ;; -+ javascript-* | *-ghcjs) -+ echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 - exit 1 - ;; - esac - - # As a final step for OS-related things, validate the OS-kernel combination - # (given a valid OS), if there is a kernel. --case $kernel-$os in -- linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ -- | linux-musl* | linux-relibc* | linux-uclibc* ) -+case $kernel-$os-$obj in -+ linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ -+ | linux-mlibc*- | linux-musl*- | linux-newlib*- \ -+ | linux-relibc*- | linux-uclibc*- ) -+ ;; -+ uclinux-uclibc*- ) -+ ;; -+ managarm-mlibc*- | managarm-kernel*- ) - ;; -- uclinux-uclibc* ) -+ windows*-msvc*-) - ;; -- -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* ) -+ -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ -+ | -uclibc*- ) - # These are just libc implementations, not actual OSes, and thus - # require a kernel. -- echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 -+ echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 - exit 1 - ;; -- kfreebsd*-gnu* | kopensolaris*-gnu*) -+ -kernel*- ) -+ echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 -+ exit 1 - ;; -- vxworks-simlinux | vxworks-simwindows | vxworks-spe) -+ *-kernel*- ) -+ echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 -+ exit 1 - ;; -- nto-qnx*) -+ *-msvc*- ) -+ echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 -+ exit 1 - ;; -- os2-emx) -+ kfreebsd*-gnu*- | kopensolaris*-gnu*-) -+ ;; -+ vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) -+ ;; -+ nto-qnx*-) -+ ;; -+ os2-emx-) - ;; -- ios*-simulator | tvos*-simulator | watchos*-simulator) -+ *-eabi*- | *-gnueabi*-) - ;; -- *-eabi* | *-gnueabi*) -+ none--*) -+ # None (no kernel, i.e. freestanding / bare metal), -+ # can be paired with an machine code file format - ;; -- -*) -+ -*-) - # Blank kernel with real OS is always fine. - ;; -- *-*) -- echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 -+ --*) -+ # Blank kernel and OS with real machine code file format is always fine. -+ ;; -+ *-*-*) -+ echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 - exit 1 - ;; - esac -@@ -1881,7 +1960,7 @@ case $vendor in - ;; - esac - --echo "$cpu-$vendor-${kernel:+$kernel-}$os" -+echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" - exit - - # Local variables: --- -2.46.0 - diff --git a/0006-aarch64-Add-a-missing-no-op-define-of-SIGN_LR_LINUX_.patch b/0006-aarch64-Add-a-missing-no-op-define-of-SIGN_LR_LINUX_.patch deleted file mode 100644 index bcf6f0f..0000000 --- a/0006-aarch64-Add-a-missing-no-op-define-of-SIGN_LR_LINUX_.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 9c9e8368e49804c4f7c35ac9f0d7c1d0d533308b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Martin=20Storsj=C3=B6?= -Date: Tue, 4 Jun 2024 14:13:08 +0300 -Subject: [PATCH 6/7] aarch64: Add a missing no-op define of SIGN_LR_LINUX_ONLY - (#838) -Content-type: text/plain; charset=UTF-8 - -This is needed at least if building for Linux, with a toolchain -that doesn't default to having PAC enabled, fixing build errors -since 45d284f2d066cc3a080c5be88e51b4d934349797. ---- - src/aarch64/internal.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/aarch64/internal.h b/src/aarch64/internal.h -index c39f9cb..50fa5c1 100644 ---- a/src/aarch64/internal.h -+++ b/src/aarch64/internal.h -@@ -88,6 +88,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - #define AUTH_LR_AND_RET retab - #define AUTH_LR_WITH_REG(x) autib lr, x - #define BRANCH_AND_LINK_TO_REG blraaz -+ #define SIGN_LR_LINUX_ONLY - #define BRANCH_TO_REG braaz - #define PAC_CFI_WINDOW_SAVE - /* Linux PAC Support */ -@@ -136,6 +137,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - #define AUTH_LR_AND_RET ret - #define AUTH_LR_WITH_REG(x) - #define BRANCH_AND_LINK_TO_REG blr -+ #define SIGN_LR_LINUX_ONLY - #define BRANCH_TO_REG br - #define PAC_CFI_WINDOW_SAVE - #endif /* HAVE_ARM64E_PTRAUTH */ --- -2.46.0 - diff --git a/0007-Fix-struct-args-Rainer-Orth.patch b/0007-Fix-struct-args-Rainer-Orth.patch deleted file mode 100644 index cf2ec18..0000000 --- a/0007-Fix-struct-args-Rainer-Orth.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 8e3ef965c2d0015ed129a06d0f11f30c2120a413 Mon Sep 17 00:00:00 2001 -From: Anthony Green -Date: Fri, 28 Jun 2024 04:07:09 -0400 -Subject: [PATCH 7/7] Fix struct args (Rainer Orth) -Content-type: text/plain; charset=UTF-8 - ---- - src/sparc/ffi.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/src/sparc/ffi.c b/src/sparc/ffi.c -index 9e406d0..cf819ee 100644 ---- a/src/sparc/ffi.c -+++ b/src/sparc/ffi.c -@@ -286,6 +286,8 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue, - void **avalue, void *closure) - { - size_t bytes = cif->bytes; -+ size_t i, nargs = cif->nargs; -+ ffi_type **arg_types = cif->arg_types; - - FFI_ASSERT (cif->abi == FFI_V8); - -@@ -295,6 +297,20 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue, - && (cif->flags & SPARC_FLAG_RET_MASK) == SPARC_RET_STRUCT) - bytes += FFI_ALIGN (cif->rtype->size, 8); - -+ /* If we have any structure arguments, make a copy so we are passing -+ by value. */ -+ for (i = 0; i < nargs; i++) -+ { -+ ffi_type *at = arg_types[i]; -+ int size = at->size; -+ if (at->type == FFI_TYPE_STRUCT) -+ { -+ char *argcopy = alloca (size); -+ memcpy (argcopy, avalue[i], size); -+ avalue[i] = argcopy; -+ } -+ } -+ - ffi_call_v8(cif, fn, rvalue, avalue, -bytes, closure); - } - --- -2.46.0 - diff --git a/libffi-3.4.6-C23.patch b/libffi-3.4.6-C23.patch deleted file mode 100644 index 2dc538a..0000000 --- a/libffi-3.4.6-C23.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0859f8431242d5adff21420b9cab538d2af527b5 Mon Sep 17 00:00:00 2001 -From: Joseph Myers -Date: Thu, 24 Oct 2024 18:26:58 +0000 -Subject: Fix testsuite for C23 `va_start` (#861) - -In the C23 revision of the C standard, `va_start` ignores its second -argument, which is no longer required (previously the last named -function parameter - which the compiler knows anyway, so it's -redundant information). - -This has the consequence for the libffi testsuite, when making GCC -default to `-std=gnu23`, of making two tests fail with warnings about -an unused function argument (only passed to `va_start` and not -otherwise used). Fix those test failures by explicitly casting the -argument to `void`. - -diff --git a/testsuite/libffi.call/va_struct2.c b/testsuite/libffi.call/va_struct2.c -index a8daff3..a034087 100644 ---- a/testsuite/libffi.call/va_struct2.c -+++ b/testsuite/libffi.call/va_struct2.c -@@ -33,6 +33,7 @@ test_fn (int n, ...) - struct small_tag s2; - struct large_tag l; - -+ (void) n; - va_start (ap, n); - s1 = va_arg (ap, struct small_tag); - l = va_arg (ap, struct large_tag); -diff --git a/testsuite/libffi.call/va_struct3.c b/testsuite/libffi.call/va_struct3.c -index d3bd280..5a52c9f 100644 ---- a/testsuite/libffi.call/va_struct3.c -+++ b/testsuite/libffi.call/va_struct3.c -@@ -33,6 +33,7 @@ test_fn (int n, ...) - struct small_tag s2; - struct large_tag l; - -+ (void) n; - va_start (ap, n); - s1 = va_arg (ap, struct small_tag); - l = va_arg (ap, struct large_tag); diff --git a/libffi.spec b/libffi.spec index eab0d0f..562172a 100644 --- a/libffi.spec +++ b/libffi.spec @@ -3,9 +3,10 @@ %global multilib_arches %{ix86} x86_64 Name: libffi -Version: 3.4.6 -Release: 5%{?dist} +Version: 3.4.7 +Release: 1%{?dist} Summary: A portable foreign function interface library +# No license change for 3.4.7 # No license change for 3.4.6 # The following SPDX licenses are extracted from the sources using # ScanCode 32.0.8 on build libffi-3.4.4-7.fc40: @@ -41,22 +42,6 @@ Source0: https://github.com/libffi/libffi/releases/download/v%{version}/libffi-% Source1: ffi-multilib.h Source2: ffitarget-multilib.h -# Fix AArch64 BTI issues by pulling in upstream commits after 3.4.6. -# "Install ISO's die when run on an arm64 machine with BTI" -# https://bugzilla.redhat.com/show_bug.cgi?id=2305877 -# -# Patch numbers relative to v3.4.6 tag: -Patch0: 0001-Fix-bti-support-830.patch -Patch1: 0002-ffi-fix-spelling-mistake-833.patch -Patch2: 0003-aarch64-support-pointer-authentication-834.patch -# Skip manual fix to avoid needing makeinfo to build libffi. -# Patch3: 0004-A-fix-to-the-struct-type-example-837.patch -Patch4: 0005-Import-from-upstream.patch -Patch5: 0006-aarch64-Add-a-missing-no-op-define-of-SIGN_LR_LINUX_.patch -Patch6: 0007-Fix-struct-args-Rainer-Orth.patch - -Patch7: libffi-3.4.6-C23.patch - BuildRequires: make BuildRequires: gcc %if %{without bootstrap} @@ -157,6 +142,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Tue Feb 18 2025 DJ Delorie - 3.4.7-1 +- Rebase to libffi 3.4.7. + * Wed Jan 22 2025 DJ Delorie - 3.4.6-5 - Fix FTBFS due to C23 compiler (#2340729) diff --git a/sources b/sources index 2d2b5ff..fc31b76 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libffi-3.4.6.tar.gz) = 033d2600e879b83c6bce0eb80f69c5f32aa775bf2e962c9d39fbd21226fa19d1e79173d8eaa0d0157014d54509ea73315ad86842356fc3a303c0831c94c6ab39 +SHA512 (libffi-3.4.7.tar.gz) = d19f59a5b5d61bd7d9e8a7a74b8bf2e697201a19c247c410c789e93ca8678a4eb9f13c9bee19f129be80ade8514f6b1acb38d66f44d86edd32644ed7bbe31dd6 From bbfe6044bc539603b475c8f165b8e1673947c339 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Thu, 6 Mar 2025 18:54:19 -0500 Subject: [PATCH 49/58] Add support for PPC64 static trampolines Note: this is not an upstream patch; this is a test of a patch attached to BZ 2313598 --- libffi-3.4.7-ppc64-static-trampolines.patch | 300 ++++++++++++++++++++ libffi.spec | 7 +- 2 files changed, 306 insertions(+), 1 deletion(-) create mode 100644 libffi-3.4.7-ppc64-static-trampolines.patch diff --git a/libffi-3.4.7-ppc64-static-trampolines.patch b/libffi-3.4.7-ppc64-static-trampolines.patch new file mode 100644 index 0000000..42543bb --- /dev/null +++ b/libffi-3.4.7-ppc64-static-trampolines.patch @@ -0,0 +1,300 @@ +diff --git a/Makefile.am b/Makefile.am +index 1f8aa9c..ba3d166 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -58,7 +58,8 @@ noinst_HEADERS = src/aarch64/ffitarget.h src/aarch64/internal.h \ + src/moxie/ffitarget.h \ + src/or1k/ffitarget.h src/pa/ffitarget.h \ + src/powerpc/ffitarget.h src/powerpc/asm.h \ +- src/powerpc/ffi_powerpc.h src/riscv/ffitarget.h \ ++ src/powerpc/ffi_powerpc.h src/powerpc/internal.h \ ++ src/riscv/ffitarget.h \ + src/s390/ffitarget.h src/s390/internal.h src/sh/ffitarget.h \ + src/sh64/ffitarget.h src/sparc/ffitarget.h \ + src/sparc/internal.h src/tile/ffitarget.h src/vax/ffitarget.h \ +diff --git a/configure.ac b/configure.ac +index a1d02b8..a00342e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -382,7 +382,8 @@ case "$target" in + [Define this if you want statically defined trampolines]) + fi + ;; +- *arm*-*-linux-* | aarch64*-*-linux-* | i*86-*-linux-* | x86_64-*-linux-* | loongarch*-*-linux-* | s390x*-linux-*) ++ *arm*-*-linux-* | aarch64*-*-linux-* | i*86-*-linux-* | x86_64-*-linux-* \ ++ | loongarch*-*-linux-* | s390x*-linux-* | powerpc*-linux-*) + AC_DEFINE(FFI_EXEC_STATIC_TRAMP, 1, + [Define this if you want statically defined trampolines]) + ;; +diff --git a/src/powerpc/ffi.c b/src/powerpc/ffi.c +index a19bcbb..dd6bd6a 100644 +--- a/src/powerpc/ffi.c ++++ b/src/powerpc/ffi.c +@@ -31,6 +31,8 @@ + #include "ffi.h" + #include "ffi_common.h" + #include "ffi_powerpc.h" ++#include "internal.h" ++#include + + #if HAVE_LONG_DOUBLE_VARIANT + /* Adjust ffi_type_longdouble. */ +@@ -173,3 +175,14 @@ ffi_prep_go_closure (ffi_go_closure *closure, + closure->fun = fun; + return FFI_OK; + } ++ ++#if defined(FFI_EXEC_STATIC_TRAMP) ++void * ++ffi_tramp_arch (size_t *tramp_size, size_t *map_size) ++{ ++ extern void *trampoline_code_table; ++ *tramp_size = PPC_TRAMP_SIZE; ++ *map_size = PPC_TRAMP_MAP_SIZE; ++ return &trampoline_code_table; ++} ++#endif +diff --git a/src/powerpc/ffi_linux64.c b/src/powerpc/ffi_linux64.c +index 3454dac..8b78983 100644 +--- a/src/powerpc/ffi_linux64.c ++++ b/src/powerpc/ffi_linux64.c +@@ -29,6 +29,7 @@ + ----------------------------------------------------------------------- */ + + #include "ffi.h" ++#include + + #ifdef POWERPC64 + #include "ffi_common.h" +@@ -820,32 +821,38 @@ ffi_prep_closure_loc_linux64 (ffi_closure *closure, + void *user_data, + void *codeloc) + { +-#if _CALL_ELF == 2 +- unsigned int *tramp = (unsigned int *) &closure->tramp[0]; +- + if (cif->abi < FFI_LINUX || cif->abi >= FFI_LAST_ABI) + return FFI_BAD_ABI; + +- tramp[0] = 0xe96c0018; /* 0: ld 11,2f-0b(12) */ +- tramp[1] = 0xe98c0010; /* ld 12,1f-0b(12) */ +- tramp[2] = 0x7d8903a6; /* mtctr 12 */ +- tramp[3] = 0x4e800420; /* bctr */ ++#if defined(FFI_EXEC_STATIC_TRAMP) ++ if (ffi_tramp_is_present(closure)) ++ { ++ /* Initialize the static trampoline's parameters. */ ++ void (*dest)(void) = ffi_closure_LINUX64; ++ ffi_tramp_set_parms (closure->ftramp, dest, closure); ++ } ++ else ++#endif ++ { ++#if _CALL_ELF == 2 ++ unsigned int *tramp = (unsigned int *) &closure->tramp[0]; ++ tramp[0] = 0xe96c0018; /* 0: ld 11,2f-0b(12) */ ++ tramp[1] = 0xe98c0010; /* ld 12,1f-0b(12) */ ++ tramp[2] = 0x7d8903a6; /* mtctr 12 */ ++ tramp[3] = 0x4e800420; /* bctr */ + /* 1: .quad function_addr */ + /* 2: .quad context */ +- *(void **) &tramp[4] = (void *) ffi_closure_LINUX64; +- *(void **) &tramp[6] = codeloc; +- flush_icache ((char *) tramp, (char *) codeloc, 4 * 4); ++ *(void **) &tramp[4] = (void *) ffi_closure_LINUX64; ++ *(void **) &tramp[6] = codeloc; ++ flush_icache ((char *) tramp, (char *) codeloc, 4 * 4); + #else +- void **tramp = (void **) &closure->tramp[0]; +- +- if (cif->abi < FFI_LINUX || cif->abi >= FFI_LAST_ABI) +- return FFI_BAD_ABI; +- +- /* Copy function address and TOC from ffi_closure_LINUX64 OPD. */ +- memcpy (&tramp[0], (void **) ffi_closure_LINUX64, sizeof (void *)); +- tramp[1] = codeloc; +- memcpy (&tramp[2], (void **) ffi_closure_LINUX64 + 1, sizeof (void *)); ++ /* Copy function address and TOC from ffi_closure_LINUX64 OPD. */ ++ void **tramp = (void **) &closure->tramp[0]; ++ memcpy (&tramp[0], (void **) ffi_closure_LINUX64, sizeof (void *)); ++ tramp[1] = codeloc; ++ memcpy (&tramp[2], (void **) ffi_closure_LINUX64 + 1, sizeof (void *)); + #endif ++ } + + closure->cif = cif; + closure->fun = fun; +diff --git a/src/powerpc/ffi_sysv.c b/src/powerpc/ffi_sysv.c +index 4078e75..5fc84d7 100644 +--- a/src/powerpc/ffi_sysv.c ++++ b/src/powerpc/ffi_sysv.c +@@ -29,6 +29,7 @@ + ----------------------------------------------------------------------- */ + + #include "ffi.h" ++#include + + #ifndef POWERPC64 + #include "ffi_common.h" +@@ -636,25 +637,34 @@ ffi_prep_closure_loc_sysv (ffi_closure *closure, + void *user_data, + void *codeloc) + { +- unsigned int *tramp; +- + if (cif->abi < FFI_SYSV || cif->abi >= FFI_LAST_ABI) + return FFI_BAD_ABI; + +- tramp = (unsigned int *) &closure->tramp[0]; +- tramp[0] = 0x7c0802a6; /* mflr r0 */ +- tramp[1] = 0x429f0005; /* bcl 20,31,.+4 */ +- tramp[2] = 0x7d6802a6; /* mflr r11 */ +- tramp[3] = 0x7c0803a6; /* mtlr r0 */ +- tramp[4] = 0x800b0018; /* lwz r0,24(r11) */ +- tramp[5] = 0x816b001c; /* lwz r11,28(r11) */ +- tramp[6] = 0x7c0903a6; /* mtctr r0 */ +- tramp[7] = 0x4e800420; /* bctr */ +- *(void **) &tramp[8] = (void *) ffi_closure_SYSV; /* function */ +- *(void **) &tramp[9] = codeloc; /* context */ +- +- /* Flush the icache. */ +- flush_icache ((char *)tramp, (char *)codeloc, 8 * 4); ++#if defined(FFI_EXEC_STATIC_TRAMP) ++ if (ffi_tramp_is_present(closure)) ++ { ++ /* Initialize the static trampoline's parameters. */ ++ void (*dest)(void) = ffi_closure_SYSV; ++ ffi_tramp_set_parms (closure->ftramp, dest, closure); ++ } ++ else ++#endif ++ { ++ unsigned int *tramp = (unsigned int *) &closure->tramp[0]; ++ tramp[0] = 0x7c0802a6; /* mflr r0 */ ++ tramp[1] = 0x429f0005; /* bcl 20,31,.+4 */ ++ tramp[2] = 0x7d6802a6; /* mflr r11 */ ++ tramp[3] = 0x7c0803a6; /* mtlr r0 */ ++ tramp[4] = 0x800b0018; /* lwz r0,24(r11) */ ++ tramp[5] = 0x816b001c; /* lwz r11,28(r11) */ ++ tramp[6] = 0x7c0903a6; /* mtctr r0 */ ++ tramp[7] = 0x4e800420; /* bctr */ ++ *(void **) &tramp[8] = (void *) ffi_closure_SYSV; /* function */ ++ *(void **) &tramp[9] = codeloc; /* context */ ++ ++ /* Flush the icache. */ ++ flush_icache ((char *)tramp, (char *)codeloc, 8 * 4); ++ } + + closure->cif = cif; + closure->fun = fun; +diff --git a/src/powerpc/internal.h b/src/powerpc/internal.h +new file mode 100644 +index 0000000..bb97a59 +--- /dev/null ++++ b/src/powerpc/internal.h +@@ -0,0 +1,6 @@ ++#if defined(FFI_EXEC_STATIC_TRAMP) ++/* For the trampoline code table mapping, a mapping size of 64K is chosen. */ ++#define PPC_TRAMP_MAP_SHIFT 16 ++#define PPC_TRAMP_MAP_SIZE (1 << PPC_TRAMP_MAP_SHIFT) ++#define PPC_TRAMP_SIZE 40 ++#endif +diff --git a/src/powerpc/linux64_closure.S b/src/powerpc/linux64_closure.S +index 199981d..3c6110a 100644 +--- a/src/powerpc/linux64_closure.S ++++ b/src/powerpc/linux64_closure.S +@@ -27,6 +27,7 @@ + #define LIBFFI_ASM + #include + #include ++#include "internal.h" + + .file "linux64_closure.S" + +@@ -561,6 +562,44 @@ ffi_go_closure_linux64: + # endif + #endif + ++#if defined (FFI_EXEC_STATIC_TRAMP) && defined (POWERPC64) ++ .text ++ .align PPC_TRAMP_MAP_SHIFT ++ FFI_HIDDEN (trampoline_code_table) ++ .globl trampoline_code_table ++# if _CALL_ELF == 2 ++ .type trampoline_code_table,@function ++trampoline_code_table: ++ .localentry trampoline_code_table,.-trampoline_code_table ++# else ++ .section ".opd","aw" ++ .align 3 ++trampoline_code_table: ++ .quad .L.trampoline_code_table,.TOC.@tocbase,0 ++ .type trampoline_code_table,@function ++ .text ++.L.trampoline_code_table: ++# endif ++ .rept PPC_TRAMP_MAP_SIZE / PPC_TRAMP_SIZE ++ mflr %r0 ++ bcl 20,31,$+4 ++ mflr %r11 ++ addis %r11,%r11,PPC_TRAMP_MAP_SIZE@ha ++ mtlr %r0 ++ ld %r12,0(%r11) ++ mtctr %r12 ++ ld %r11,-8(%r11) ++ bctr ++ nop ++ .endr ++#if _CALL_ELF == 2 ++ .size trampoline_code_table,.-trampoline_code_table ++#else ++ .size trampoline_code_table,.-.L.trampoline_code_table ++#endif ++ .align PPC_TRAMP_MAP_SHIFT ++#endif /* FFI_EXEC_STATIC_TRAMP && POWERPC64 */ ++ + #if (defined __ELF__ && defined __linux__) || _CALL_ELF == 2 + .section .note.GNU-stack,"",@progbits + #endif +diff --git a/src/powerpc/ppc_closure.S b/src/powerpc/ppc_closure.S +index b6d209d..583a1d9 100644 +--- a/src/powerpc/ppc_closure.S ++++ b/src/powerpc/ppc_closure.S +@@ -27,6 +27,7 @@ + #define LIBFFI_ASM + #include + #include ++#include "internal.h" + #include + + .file "ppc_closure.S" +@@ -391,6 +392,29 @@ ENTRY(ffi_go_closure_sysv) + .cfi_endproc + END(ffi_go_closure_sysv) + ++#ifdef FFI_EXEC_STATIC_TRAMP ++ .text ++ .align PPC_TRAMP_MAP_SHIFT ++ FFI_HIDDEN (trampoline_code_table) ++ .globl trampoline_code_table ++ .type trampoline_code_table,@function ++trampoline_code_table: ++ .rept PPC_TRAMP_MAP_SIZE / PPC_TRAMP_SIZE ++ mflr %r0 ++ bcl 20,31,$+4 ++ mflr %r11 ++ addis %r11,%r11,PPC_TRAMP_MAP_SIZE@ha ++ mtlr %r0 ++ lwz %r0,-4(%r11) ++ mtctr %r0 ++ lwz %r11,-8(%r11) ++ bctr ++ nop ++ .endr ++ .size trampoline_code_table,.-trampoline_code_table ++ .align PPC_TRAMP_MAP_SHIFT ++#endif /* FFI_EXEC_STATIC_TRAMP */ ++ + #if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits + #endif diff --git a/libffi.spec b/libffi.spec index 562172a..513fb74 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.7 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A portable foreign function interface library # No license change for 3.4.7 # No license change for 3.4.6 @@ -42,6 +42,8 @@ Source0: https://github.com/libffi/libffi/releases/download/v%{version}/libffi-% Source1: ffi-multilib.h Source2: ffitarget-multilib.h +Patch1: libffi-3.4.7-ppc64-static-trampolines.patch + BuildRequires: make BuildRequires: gcc %if %{without bootstrap} @@ -142,6 +144,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Thu Mar 06 2025 DJ Delorie - 3.4.7-2 +- Add PPC64 static trampoline support (#2313598) + * Tue Feb 18 2025 DJ Delorie - 3.4.7-1 - Rebase to libffi 3.4.7. From 3b930425701adb5e2eb9c5a51d58698429770bc2 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Sun, 30 Mar 2025 01:26:42 -0400 Subject: [PATCH 50/58] Update support for PPC64 static trampolines Updates for previous patch: Updated patch Regenerated configure --- libffi-3.4.7-ppc64-static-trampolines.patch | 78 ++++++++++++++------- libffi.spec | 5 +- 2 files changed, 56 insertions(+), 27 deletions(-) diff --git a/libffi-3.4.7-ppc64-static-trampolines.patch b/libffi-3.4.7-ppc64-static-trampolines.patch index 42543bb..675bbdd 100644 --- a/libffi-3.4.7-ppc64-static-trampolines.patch +++ b/libffi-3.4.7-ppc64-static-trampolines.patch @@ -26,8 +26,21 @@ index a1d02b8..a00342e 100644 AC_DEFINE(FFI_EXEC_STATIC_TRAMP, 1, [Define this if you want statically defined trampolines]) ;; +diff --git a/configure b/configure +--- a/configure 2025-02-08 11:36:35.000000000 -0500 ++++ b/configure 2025-03-27 22:45:25.213522901 -0400 +@@ -19617,7 +19617,8 @@ printf "%s\n" "#define FFI_EXEC_STATIC_T + + fi + ;; +- *arm*-*-linux-* | aarch64*-*-linux-* | i*86-*-linux-* | x86_64-*-linux-* | loongarch*-*-linux-* | s390x*-linux-*) ++ *arm*-*-linux-* | aarch64*-*-linux-* | i*86-*-linux-* | x86_64-*-linux-* \ ++ | loongarch*-*-linux-* | s390x*-linux-* | powerpc*-linux-*) + + printf "%s\n" "#define FFI_EXEC_STATIC_TRAMP 1" >>confdefs.h + diff --git a/src/powerpc/ffi.c b/src/powerpc/ffi.c -index a19bcbb..dd6bd6a 100644 +index a19bcbb..0a97741 100644 --- a/src/powerpc/ffi.c +++ b/src/powerpc/ffi.c @@ -31,6 +31,8 @@ @@ -44,7 +57,7 @@ index a19bcbb..dd6bd6a 100644 return FFI_OK; } + -+#if defined(FFI_EXEC_STATIC_TRAMP) ++#ifdef FFI_EXEC_STATIC_TRAMP +void * +ffi_tramp_arch (size_t *tramp_size, size_t *map_size) +{ @@ -55,7 +68,7 @@ index a19bcbb..dd6bd6a 100644 +} +#endif diff --git a/src/powerpc/ffi_linux64.c b/src/powerpc/ffi_linux64.c -index 3454dac..8b78983 100644 +index 3454dac..90100a4 100644 --- a/src/powerpc/ffi_linux64.c +++ b/src/powerpc/ffi_linux64.c @@ -29,6 +29,7 @@ @@ -80,7 +93,7 @@ index 3454dac..8b78983 100644 - tramp[1] = 0xe98c0010; /* ld 12,1f-0b(12) */ - tramp[2] = 0x7d8903a6; /* mtctr 12 */ - tramp[3] = 0x4e800420; /* bctr */ -+#if defined(FFI_EXEC_STATIC_TRAMP) ++#ifdef FFI_EXEC_STATIC_TRAMP + if (ffi_tramp_is_present(closure)) + { + /* Initialize the static trampoline's parameters. */ @@ -125,7 +138,7 @@ index 3454dac..8b78983 100644 closure->cif = cif; closure->fun = fun; diff --git a/src/powerpc/ffi_sysv.c b/src/powerpc/ffi_sysv.c -index 4078e75..5fc84d7 100644 +index 4078e75..5d7c5c8 100644 --- a/src/powerpc/ffi_sysv.c +++ b/src/powerpc/ffi_sysv.c @@ -29,6 +29,7 @@ @@ -159,7 +172,7 @@ index 4078e75..5fc84d7 100644 - - /* Flush the icache. */ - flush_icache ((char *)tramp, (char *)codeloc, 8 * 4); -+#if defined(FFI_EXEC_STATIC_TRAMP) ++#ifdef FFI_EXEC_STATIC_TRAMP + if (ffi_tramp_is_present(closure)) + { + /* Initialize the static trampoline's parameters. */ @@ -189,18 +202,22 @@ index 4078e75..5fc84d7 100644 closure->fun = fun; diff --git a/src/powerpc/internal.h b/src/powerpc/internal.h new file mode 100644 -index 0000000..bb97a59 +index 0000000..b3db5f0 --- /dev/null +++ b/src/powerpc/internal.h -@@ -0,0 +1,6 @@ -+#if defined(FFI_EXEC_STATIC_TRAMP) +@@ -0,0 +1,10 @@ ++#ifdef FFI_EXEC_STATIC_TRAMP +/* For the trampoline code table mapping, a mapping size of 64K is chosen. */ +#define PPC_TRAMP_MAP_SHIFT 16 +#define PPC_TRAMP_MAP_SIZE (1 << PPC_TRAMP_MAP_SHIFT) -+#define PPC_TRAMP_SIZE 40 -+#endif ++# ifdef __PCREL__ ++# define PPC_TRAMP_SIZE 24 ++# else ++# define PPC_TRAMP_SIZE 40 ++# endif /* __PCREL__ */ ++#endif /* FFI_EXEC_STATIC_TRAMP */ diff --git a/src/powerpc/linux64_closure.S b/src/powerpc/linux64_closure.S -index 199981d..3c6110a 100644 +index 199981d..d9e5cff 100644 --- a/src/powerpc/linux64_closure.S +++ b/src/powerpc/linux64_closure.S @@ -27,6 +27,7 @@ @@ -211,11 +228,12 @@ index 199981d..3c6110a 100644 .file "linux64_closure.S" -@@ -561,6 +562,44 @@ ffi_go_closure_linux64: +@@ -559,7 +560,53 @@ ffi_go_closure_linux64: + .size .ffi_go_closure_linux64,.-.ffi_go_closure_linux64 + # endif # endif - #endif - -+#if defined (FFI_EXEC_STATIC_TRAMP) && defined (POWERPC64) ++ ++#ifdef FFI_EXEC_STATIC_TRAMP + .text + .align PPC_TRAMP_MAP_SHIFT + FFI_HIDDEN (trampoline_code_table) @@ -234,30 +252,38 @@ index 199981d..3c6110a 100644 +.L.trampoline_code_table: +# endif + .rept PPC_TRAMP_MAP_SIZE / PPC_TRAMP_SIZE ++#ifdef __PCREL__ ++ pla %r2,PPC_TRAMP_MAP_SIZE ++ ld %r11,0(%r2) ++ ld %r12,8(%r2) ++ mtctr %r12 ++ bctr ++#else + mflr %r0 + bcl 20,31,$+4 + mflr %r11 + addis %r11,%r11,PPC_TRAMP_MAP_SIZE@ha + mtlr %r0 -+ ld %r12,0(%r11) ++ ld %r12,(PPC_TRAMP_MAP_SIZE+0)@l(%r11) + mtctr %r12 -+ ld %r11,-8(%r11) ++ ld %r11,(PPC_TRAMP_MAP_SIZE-8)@l(%r11) + bctr + nop ++#endif + .endr ++ .align PPC_TRAMP_MAP_SHIFT +#if _CALL_ELF == 2 + .size trampoline_code_table,.-trampoline_code_table +#else + .size trampoline_code_table,.-.L.trampoline_code_table -+#endif -+ .align PPC_TRAMP_MAP_SHIFT -+#endif /* FFI_EXEC_STATIC_TRAMP && POWERPC64 */ -+ + #endif ++#endif /* FFI_EXEC_STATIC_TRAMP */ ++#endif /* POWERPC64 */ + #if (defined __ELF__ && defined __linux__) || _CALL_ELF == 2 .section .note.GNU-stack,"",@progbits - #endif diff --git a/src/powerpc/ppc_closure.S b/src/powerpc/ppc_closure.S -index b6d209d..583a1d9 100644 +index b6d209d..d3556eb 100644 --- a/src/powerpc/ppc_closure.S +++ b/src/powerpc/ppc_closure.S @@ -27,6 +27,7 @@ @@ -285,9 +311,9 @@ index b6d209d..583a1d9 100644 + mflr %r11 + addis %r11,%r11,PPC_TRAMP_MAP_SIZE@ha + mtlr %r0 -+ lwz %r0,-4(%r11) ++ lwz %r0,(PPC_TRAMP_MAP_SIZE-4)@l(%r11) + mtctr %r0 -+ lwz %r11,-8(%r11) ++ lwz %r11,(PPC_TRAMP_MAP_SIZE-8)@l(%r11) + bctr + nop + .endr diff --git a/libffi.spec b/libffi.spec index 513fb74..0ad4d90 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.7 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A portable foreign function interface library # No license change for 3.4.7 # No license change for 3.4.6 @@ -144,6 +144,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Thu Mar 27 2025 DJ Delorie - 3.4.7-3 +- Regenerate configure for previous patch(#2313598) + * Thu Mar 06 2025 DJ Delorie - 3.4.7-2 - Add PPC64 static trampoline support (#2313598) From 336b1a60224c0be0ac6ac242af9e7a512fa36ac1 Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Thu, 27 Mar 2025 19:09:27 +0100 Subject: [PATCH 51/58] Fix riscv64 build Thanks: David Abdurachmanov Thanks: Richard W.M. Jones Signed-off-by: Andrea Bolognani --- libffi.spec | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libffi.spec b/libffi.spec index 0ad4d90..8c9cee4 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.4.7 -Release: 3%{?dist} +Release: 4%{?dist} Summary: A portable foreign function interface library # No license change for 3.4.7 # No license change for 3.4.6 @@ -96,7 +96,11 @@ developing applications that use %{name}. # https://gitlab.haskell.org/ghc/ghc/-/issues/20051 # https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/283 # We need to get these fixes into Fedora before we can reeanble them. -%configure --disable-static +# +# --disable-multi-os-directory is used because otherwise, on riscv64, the +# library is installed under ${_libdir}/lp64d, which we don't want. Other +# architectures don't have the same problem so they're unaffected. +%configure --disable-static --disable-multi-os-directory %make_build %check @@ -144,6 +148,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Fri Apr 04 2025 Andrea Bolognani - 3.4.7-4 +- Fix riscv64 build (thanks David Abdurachmanov and Rich Jones) + * Thu Mar 27 2025 DJ Delorie - 3.4.7-3 - Regenerate configure for previous patch(#2313598) From 136a084f8980d56a79a27f8cdb3b94c1d7e7e9ed Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 4 Apr 2025 16:07:19 +0200 Subject: [PATCH 52/58] Remove misleading comment about static trampolines The --disable-static switch is about static libraries. The real flag for trampolines is --disable-exec-static-tramp. --- libffi.spec | 6 ------ 1 file changed, 6 deletions(-) diff --git a/libffi.spec b/libffi.spec index 8c9cee4..6efe456 100644 --- a/libffi.spec +++ b/libffi.spec @@ -91,12 +91,6 @@ developing applications that use %{name}. %autosetup -p1 %build -# For now we disable the static templates to avoid ghc and -# gobject-introspection failures: -# https://gitlab.haskell.org/ghc/ghc/-/issues/20051 -# https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/283 -# We need to get these fixes into Fedora before we can reeanble them. -# # --disable-multi-os-directory is used because otherwise, on riscv64, the # library is installed under ${_libdir}/lp64d, which we don't want. Other # architectures don't have the same problem so they're unaffected. From fbf3b77c41715efd43d336d660fc4ebf7d649451 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Thu, 10 Apr 2025 17:55:33 -0400 Subject: [PATCH 53/58] Update to libffi-3.4.8 --- .gitignore | 1 + libffi-3.4.7-ppc64-static-trampolines.patch | 326 -------------------- libffi.spec | 10 +- sources | 2 +- 4 files changed, 8 insertions(+), 331 deletions(-) delete mode 100644 libffi-3.4.7-ppc64-static-trampolines.patch diff --git a/.gitignore b/.gitignore index 483789d..30bd324 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ libffi-3.0.9.tar.gz /libffi-3.4.4.tar.gz /libffi-3.4.6.tar.gz /libffi-3.4.7.tar.gz +/libffi-3.4.8.tar.gz diff --git a/libffi-3.4.7-ppc64-static-trampolines.patch b/libffi-3.4.7-ppc64-static-trampolines.patch deleted file mode 100644 index 675bbdd..0000000 --- a/libffi-3.4.7-ppc64-static-trampolines.patch +++ /dev/null @@ -1,326 +0,0 @@ -diff --git a/Makefile.am b/Makefile.am -index 1f8aa9c..ba3d166 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -58,7 +58,8 @@ noinst_HEADERS = src/aarch64/ffitarget.h src/aarch64/internal.h \ - src/moxie/ffitarget.h \ - src/or1k/ffitarget.h src/pa/ffitarget.h \ - src/powerpc/ffitarget.h src/powerpc/asm.h \ -- src/powerpc/ffi_powerpc.h src/riscv/ffitarget.h \ -+ src/powerpc/ffi_powerpc.h src/powerpc/internal.h \ -+ src/riscv/ffitarget.h \ - src/s390/ffitarget.h src/s390/internal.h src/sh/ffitarget.h \ - src/sh64/ffitarget.h src/sparc/ffitarget.h \ - src/sparc/internal.h src/tile/ffitarget.h src/vax/ffitarget.h \ -diff --git a/configure.ac b/configure.ac -index a1d02b8..a00342e 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -382,7 +382,8 @@ case "$target" in - [Define this if you want statically defined trampolines]) - fi - ;; -- *arm*-*-linux-* | aarch64*-*-linux-* | i*86-*-linux-* | x86_64-*-linux-* | loongarch*-*-linux-* | s390x*-linux-*) -+ *arm*-*-linux-* | aarch64*-*-linux-* | i*86-*-linux-* | x86_64-*-linux-* \ -+ | loongarch*-*-linux-* | s390x*-linux-* | powerpc*-linux-*) - AC_DEFINE(FFI_EXEC_STATIC_TRAMP, 1, - [Define this if you want statically defined trampolines]) - ;; -diff --git a/configure b/configure ---- a/configure 2025-02-08 11:36:35.000000000 -0500 -+++ b/configure 2025-03-27 22:45:25.213522901 -0400 -@@ -19617,7 +19617,8 @@ printf "%s\n" "#define FFI_EXEC_STATIC_T - - fi - ;; -- *arm*-*-linux-* | aarch64*-*-linux-* | i*86-*-linux-* | x86_64-*-linux-* | loongarch*-*-linux-* | s390x*-linux-*) -+ *arm*-*-linux-* | aarch64*-*-linux-* | i*86-*-linux-* | x86_64-*-linux-* \ -+ | loongarch*-*-linux-* | s390x*-linux-* | powerpc*-linux-*) - - printf "%s\n" "#define FFI_EXEC_STATIC_TRAMP 1" >>confdefs.h - -diff --git a/src/powerpc/ffi.c b/src/powerpc/ffi.c -index a19bcbb..0a97741 100644 ---- a/src/powerpc/ffi.c -+++ b/src/powerpc/ffi.c -@@ -31,6 +31,8 @@ - #include "ffi.h" - #include "ffi_common.h" - #include "ffi_powerpc.h" -+#include "internal.h" -+#include - - #if HAVE_LONG_DOUBLE_VARIANT - /* Adjust ffi_type_longdouble. */ -@@ -173,3 +175,14 @@ ffi_prep_go_closure (ffi_go_closure *closure, - closure->fun = fun; - return FFI_OK; - } -+ -+#ifdef FFI_EXEC_STATIC_TRAMP -+void * -+ffi_tramp_arch (size_t *tramp_size, size_t *map_size) -+{ -+ extern void *trampoline_code_table; -+ *tramp_size = PPC_TRAMP_SIZE; -+ *map_size = PPC_TRAMP_MAP_SIZE; -+ return &trampoline_code_table; -+} -+#endif -diff --git a/src/powerpc/ffi_linux64.c b/src/powerpc/ffi_linux64.c -index 3454dac..90100a4 100644 ---- a/src/powerpc/ffi_linux64.c -+++ b/src/powerpc/ffi_linux64.c -@@ -29,6 +29,7 @@ - ----------------------------------------------------------------------- */ - - #include "ffi.h" -+#include - - #ifdef POWERPC64 - #include "ffi_common.h" -@@ -820,32 +821,38 @@ ffi_prep_closure_loc_linux64 (ffi_closure *closure, - void *user_data, - void *codeloc) - { --#if _CALL_ELF == 2 -- unsigned int *tramp = (unsigned int *) &closure->tramp[0]; -- - if (cif->abi < FFI_LINUX || cif->abi >= FFI_LAST_ABI) - return FFI_BAD_ABI; - -- tramp[0] = 0xe96c0018; /* 0: ld 11,2f-0b(12) */ -- tramp[1] = 0xe98c0010; /* ld 12,1f-0b(12) */ -- tramp[2] = 0x7d8903a6; /* mtctr 12 */ -- tramp[3] = 0x4e800420; /* bctr */ -+#ifdef FFI_EXEC_STATIC_TRAMP -+ if (ffi_tramp_is_present(closure)) -+ { -+ /* Initialize the static trampoline's parameters. */ -+ void (*dest)(void) = ffi_closure_LINUX64; -+ ffi_tramp_set_parms (closure->ftramp, dest, closure); -+ } -+ else -+#endif -+ { -+#if _CALL_ELF == 2 -+ unsigned int *tramp = (unsigned int *) &closure->tramp[0]; -+ tramp[0] = 0xe96c0018; /* 0: ld 11,2f-0b(12) */ -+ tramp[1] = 0xe98c0010; /* ld 12,1f-0b(12) */ -+ tramp[2] = 0x7d8903a6; /* mtctr 12 */ -+ tramp[3] = 0x4e800420; /* bctr */ - /* 1: .quad function_addr */ - /* 2: .quad context */ -- *(void **) &tramp[4] = (void *) ffi_closure_LINUX64; -- *(void **) &tramp[6] = codeloc; -- flush_icache ((char *) tramp, (char *) codeloc, 4 * 4); -+ *(void **) &tramp[4] = (void *) ffi_closure_LINUX64; -+ *(void **) &tramp[6] = codeloc; -+ flush_icache ((char *) tramp, (char *) codeloc, 4 * 4); - #else -- void **tramp = (void **) &closure->tramp[0]; -- -- if (cif->abi < FFI_LINUX || cif->abi >= FFI_LAST_ABI) -- return FFI_BAD_ABI; -- -- /* Copy function address and TOC from ffi_closure_LINUX64 OPD. */ -- memcpy (&tramp[0], (void **) ffi_closure_LINUX64, sizeof (void *)); -- tramp[1] = codeloc; -- memcpy (&tramp[2], (void **) ffi_closure_LINUX64 + 1, sizeof (void *)); -+ /* Copy function address and TOC from ffi_closure_LINUX64 OPD. */ -+ void **tramp = (void **) &closure->tramp[0]; -+ memcpy (&tramp[0], (void **) ffi_closure_LINUX64, sizeof (void *)); -+ tramp[1] = codeloc; -+ memcpy (&tramp[2], (void **) ffi_closure_LINUX64 + 1, sizeof (void *)); - #endif -+ } - - closure->cif = cif; - closure->fun = fun; -diff --git a/src/powerpc/ffi_sysv.c b/src/powerpc/ffi_sysv.c -index 4078e75..5d7c5c8 100644 ---- a/src/powerpc/ffi_sysv.c -+++ b/src/powerpc/ffi_sysv.c -@@ -29,6 +29,7 @@ - ----------------------------------------------------------------------- */ - - #include "ffi.h" -+#include - - #ifndef POWERPC64 - #include "ffi_common.h" -@@ -636,25 +637,34 @@ ffi_prep_closure_loc_sysv (ffi_closure *closure, - void *user_data, - void *codeloc) - { -- unsigned int *tramp; -- - if (cif->abi < FFI_SYSV || cif->abi >= FFI_LAST_ABI) - return FFI_BAD_ABI; - -- tramp = (unsigned int *) &closure->tramp[0]; -- tramp[0] = 0x7c0802a6; /* mflr r0 */ -- tramp[1] = 0x429f0005; /* bcl 20,31,.+4 */ -- tramp[2] = 0x7d6802a6; /* mflr r11 */ -- tramp[3] = 0x7c0803a6; /* mtlr r0 */ -- tramp[4] = 0x800b0018; /* lwz r0,24(r11) */ -- tramp[5] = 0x816b001c; /* lwz r11,28(r11) */ -- tramp[6] = 0x7c0903a6; /* mtctr r0 */ -- tramp[7] = 0x4e800420; /* bctr */ -- *(void **) &tramp[8] = (void *) ffi_closure_SYSV; /* function */ -- *(void **) &tramp[9] = codeloc; /* context */ -- -- /* Flush the icache. */ -- flush_icache ((char *)tramp, (char *)codeloc, 8 * 4); -+#ifdef FFI_EXEC_STATIC_TRAMP -+ if (ffi_tramp_is_present(closure)) -+ { -+ /* Initialize the static trampoline's parameters. */ -+ void (*dest)(void) = ffi_closure_SYSV; -+ ffi_tramp_set_parms (closure->ftramp, dest, closure); -+ } -+ else -+#endif -+ { -+ unsigned int *tramp = (unsigned int *) &closure->tramp[0]; -+ tramp[0] = 0x7c0802a6; /* mflr r0 */ -+ tramp[1] = 0x429f0005; /* bcl 20,31,.+4 */ -+ tramp[2] = 0x7d6802a6; /* mflr r11 */ -+ tramp[3] = 0x7c0803a6; /* mtlr r0 */ -+ tramp[4] = 0x800b0018; /* lwz r0,24(r11) */ -+ tramp[5] = 0x816b001c; /* lwz r11,28(r11) */ -+ tramp[6] = 0x7c0903a6; /* mtctr r0 */ -+ tramp[7] = 0x4e800420; /* bctr */ -+ *(void **) &tramp[8] = (void *) ffi_closure_SYSV; /* function */ -+ *(void **) &tramp[9] = codeloc; /* context */ -+ -+ /* Flush the icache. */ -+ flush_icache ((char *)tramp, (char *)codeloc, 8 * 4); -+ } - - closure->cif = cif; - closure->fun = fun; -diff --git a/src/powerpc/internal.h b/src/powerpc/internal.h -new file mode 100644 -index 0000000..b3db5f0 ---- /dev/null -+++ b/src/powerpc/internal.h -@@ -0,0 +1,10 @@ -+#ifdef FFI_EXEC_STATIC_TRAMP -+/* For the trampoline code table mapping, a mapping size of 64K is chosen. */ -+#define PPC_TRAMP_MAP_SHIFT 16 -+#define PPC_TRAMP_MAP_SIZE (1 << PPC_TRAMP_MAP_SHIFT) -+# ifdef __PCREL__ -+# define PPC_TRAMP_SIZE 24 -+# else -+# define PPC_TRAMP_SIZE 40 -+# endif /* __PCREL__ */ -+#endif /* FFI_EXEC_STATIC_TRAMP */ -diff --git a/src/powerpc/linux64_closure.S b/src/powerpc/linux64_closure.S -index 199981d..d9e5cff 100644 ---- a/src/powerpc/linux64_closure.S -+++ b/src/powerpc/linux64_closure.S -@@ -27,6 +27,7 @@ - #define LIBFFI_ASM - #include - #include -+#include "internal.h" - - .file "linux64_closure.S" - -@@ -559,7 +560,53 @@ ffi_go_closure_linux64: - .size .ffi_go_closure_linux64,.-.ffi_go_closure_linux64 - # endif - # endif -+ -+#ifdef FFI_EXEC_STATIC_TRAMP -+ .text -+ .align PPC_TRAMP_MAP_SHIFT -+ FFI_HIDDEN (trampoline_code_table) -+ .globl trampoline_code_table -+# if _CALL_ELF == 2 -+ .type trampoline_code_table,@function -+trampoline_code_table: -+ .localentry trampoline_code_table,.-trampoline_code_table -+# else -+ .section ".opd","aw" -+ .align 3 -+trampoline_code_table: -+ .quad .L.trampoline_code_table,.TOC.@tocbase,0 -+ .type trampoline_code_table,@function -+ .text -+.L.trampoline_code_table: -+# endif -+ .rept PPC_TRAMP_MAP_SIZE / PPC_TRAMP_SIZE -+#ifdef __PCREL__ -+ pla %r2,PPC_TRAMP_MAP_SIZE -+ ld %r11,0(%r2) -+ ld %r12,8(%r2) -+ mtctr %r12 -+ bctr -+#else -+ mflr %r0 -+ bcl 20,31,$+4 -+ mflr %r11 -+ addis %r11,%r11,PPC_TRAMP_MAP_SIZE@ha -+ mtlr %r0 -+ ld %r12,(PPC_TRAMP_MAP_SIZE+0)@l(%r11) -+ mtctr %r12 -+ ld %r11,(PPC_TRAMP_MAP_SIZE-8)@l(%r11) -+ bctr -+ nop -+#endif -+ .endr -+ .align PPC_TRAMP_MAP_SHIFT -+#if _CALL_ELF == 2 -+ .size trampoline_code_table,.-trampoline_code_table -+#else -+ .size trampoline_code_table,.-.L.trampoline_code_table - #endif -+#endif /* FFI_EXEC_STATIC_TRAMP */ -+#endif /* POWERPC64 */ - - #if (defined __ELF__ && defined __linux__) || _CALL_ELF == 2 - .section .note.GNU-stack,"",@progbits -diff --git a/src/powerpc/ppc_closure.S b/src/powerpc/ppc_closure.S -index b6d209d..d3556eb 100644 ---- a/src/powerpc/ppc_closure.S -+++ b/src/powerpc/ppc_closure.S -@@ -27,6 +27,7 @@ - #define LIBFFI_ASM - #include - #include -+#include "internal.h" - #include - - .file "ppc_closure.S" -@@ -391,6 +392,29 @@ ENTRY(ffi_go_closure_sysv) - .cfi_endproc - END(ffi_go_closure_sysv) - -+#ifdef FFI_EXEC_STATIC_TRAMP -+ .text -+ .align PPC_TRAMP_MAP_SHIFT -+ FFI_HIDDEN (trampoline_code_table) -+ .globl trampoline_code_table -+ .type trampoline_code_table,@function -+trampoline_code_table: -+ .rept PPC_TRAMP_MAP_SIZE / PPC_TRAMP_SIZE -+ mflr %r0 -+ bcl 20,31,$+4 -+ mflr %r11 -+ addis %r11,%r11,PPC_TRAMP_MAP_SIZE@ha -+ mtlr %r0 -+ lwz %r0,(PPC_TRAMP_MAP_SIZE-4)@l(%r11) -+ mtctr %r0 -+ lwz %r11,(PPC_TRAMP_MAP_SIZE-8)@l(%r11) -+ bctr -+ nop -+ .endr -+ .size trampoline_code_table,.-trampoline_code_table -+ .align PPC_TRAMP_MAP_SHIFT -+#endif /* FFI_EXEC_STATIC_TRAMP */ -+ - #if defined __ELF__ && defined __linux__ - .section .note.GNU-stack,"",@progbits - #endif diff --git a/libffi.spec b/libffi.spec index 6efe456..cb1716e 100644 --- a/libffi.spec +++ b/libffi.spec @@ -3,9 +3,10 @@ %global multilib_arches %{ix86} x86_64 Name: libffi -Version: 3.4.7 -Release: 4%{?dist} +Version: 3.4.8 +Release: 1%{?dist} Summary: A portable foreign function interface library +# No license change for 3.4.8 # No license change for 3.4.7 # No license change for 3.4.6 # The following SPDX licenses are extracted from the sources using @@ -42,8 +43,6 @@ Source0: https://github.com/libffi/libffi/releases/download/v%{version}/libffi-% Source1: ffi-multilib.h Source2: ffitarget-multilib.h -Patch1: libffi-3.4.7-ppc64-static-trampolines.patch - BuildRequires: make BuildRequires: gcc %if %{without bootstrap} @@ -142,6 +141,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Wed May 07 2025 DJ Delorie - 3.4.8-1 +- Rebase to libffi 3.4.8. + * Fri Apr 04 2025 Andrea Bolognani - 3.4.7-4 - Fix riscv64 build (thanks David Abdurachmanov and Rich Jones) diff --git a/sources b/sources index fc31b76..2765063 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libffi-3.4.7.tar.gz) = d19f59a5b5d61bd7d9e8a7a74b8bf2e697201a19c247c410c789e93ca8678a4eb9f13c9bee19f129be80ade8514f6b1acb38d66f44d86edd32644ed7bbe31dd6 +SHA512 (libffi-3.4.8.tar.gz) = 05344c6c1a1a5b44704f6cf99277098d1ea3ac1dc11c2a691c501786a214f76184ec0637135588630db609ce79e49df3dbd00282dd61e7f21137afba70e24ffe From 6a2317105ab530575caad53bbfb27970601c2cc3 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Fri, 13 Jun 2025 16:13:35 -0400 Subject: [PATCH 54/58] Update to libffi-3.5.1 --- .gitignore | 1 + libffi.spec | 8 ++++++-- sources | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 30bd324..7229baf 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ libffi-3.0.9.tar.gz /libffi-3.4.6.tar.gz /libffi-3.4.7.tar.gz /libffi-3.4.8.tar.gz +/libffi-3.5.1.tar.gz diff --git a/libffi.spec b/libffi.spec index cb1716e..0cefe7d 100644 --- a/libffi.spec +++ b/libffi.spec @@ -3,9 +3,10 @@ %global multilib_arches %{ix86} x86_64 Name: libffi -Version: 3.4.8 +Version: 3.5.1 Release: 1%{?dist} Summary: A portable foreign function interface library +# No license change for 3.5.1 # No license change for 3.4.8 # No license change for 3.4.7 # No license change for 3.4.6 @@ -131,7 +132,7 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %license LICENSE %doc README.md %{_libdir}/libffi.so.8 -%{_libdir}/libffi.so.8.1.4 +%{_libdir}/libffi.so.8.2.0 %files devel %{_libdir}/pkgconfig/*.pc @@ -141,6 +142,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Fri Jun 13 2025 DJ Delorie - 3.5.1-1 +- Rebase to libffi 3.5.1. + * Wed May 07 2025 DJ Delorie - 3.4.8-1 - Rebase to libffi 3.4.8. diff --git a/sources b/sources index 2765063..a846100 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libffi-3.4.8.tar.gz) = 05344c6c1a1a5b44704f6cf99277098d1ea3ac1dc11c2a691c501786a214f76184ec0637135588630db609ce79e49df3dbd00282dd61e7f21137afba70e24ffe +SHA512 (libffi-3.5.1.tar.gz) = 3da9e21fdb920e7962ceb01ee671ef36196df4d5dad62e0cdd8e87cc60e350f241c204350560ae26ea04cc898161b5585c8a5a5125bdbcc84508efbb7ea61eb8 From 47999d73940992beaf95b460eb34d3cdc59a2164 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 24 Jul 2025 19:38:43 +0000 Subject: [PATCH 55/58] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- libffi.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libffi.spec b/libffi.spec index 0cefe7d..36878c2 100644 --- a/libffi.spec +++ b/libffi.spec @@ -4,7 +4,7 @@ Name: libffi Version: 3.5.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A portable foreign function interface library # No license change for 3.5.1 # No license change for 3.4.8 @@ -142,6 +142,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Thu Jul 24 2025 Fedora Release Engineering - 3.5.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Fri Jun 13 2025 DJ Delorie - 3.5.1-1 - Rebase to libffi 3.5.1. From 9915d8c0eb3de2dce5de4dc3b6cb7eed8adf5bbc Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 12 Aug 2025 11:21:05 +0200 Subject: [PATCH 56/58] Migrate STI to TMT fixes: rhbz#2382942 --- .fmf/version | 1 + plans/gating.fmf | 6 ++++++ tests/tests.yml | 17 ----------------- 3 files changed, 7 insertions(+), 17 deletions(-) create mode 100644 .fmf/version create mode 100644 plans/gating.fmf delete mode 100644 tests/tests.yml diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/plans/gating.fmf b/plans/gating.fmf new file mode 100644 index 0000000..1ff37e7 --- /dev/null +++ b/plans/gating.fmf @@ -0,0 +1,6 @@ +summary: Gating testplan for libffi +discover: + how: fmf +execute: + how: tmt + diff --git a/tests/tests.yml b/tests/tests.yml deleted file mode 100644 index 4ca04f0..0000000 --- a/tests/tests.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -# This first play always runs on the local staging system -- hosts: localhost - roles: - - role: standard-test-beakerlib - tags: - - classic - tests: - - testsuite - required_packages: - - libffi - - libffi-devel - - gcc - - dejagnu - - rpm-build - - gcc-c++ - - strace From 0cba045b211465fcad0ac42e3238b1e474b8a88f Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 12 Aug 2025 15:12:03 +0200 Subject: [PATCH 57/58] Update testsuite test to run with latest upstream The test runs the upstream testsuite but with the installed libraries. This is done patching the test harness to pick libffi from system's libdir instead the ones from the build directory. Changes in upstream commit 40a7682 break the way we patch the testsuite and this change fixes our script to work as it did before. Additionally, several checks on expected library directories were improved. This commit also fixes several shellcheck warnings. --- tests/testsuite/runtest.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/tests/testsuite/runtest.sh b/tests/testsuite/runtest.sh index 19a7f8c..df1b20b 100755 --- a/tests/testsuite/runtest.sh +++ b/tests/testsuite/runtest.sh @@ -39,7 +39,7 @@ rlJournalStart fi done; - rlRun "TmpDir=`mktemp -d`" 0 "Creating tmp directory" + rlRun "TmpDir=$(mktemp -d)" 0 "Creating tmp directory" rlRun "pushd $TmpDir" rlFetchSrcForInstalled libffi rlRun "rpm -ivh libffi*.src.rpm" @@ -47,7 +47,7 @@ rlJournalStart rlRun "specfile=$(rpm --eval='%_specdir')/libffi.spec" rlRun "rpmbuild -bp --undefine specpartsdir $specfile" rlRun "builddir=$(rpm --eval='%_builddir')" - rlRun "pushd $(dirname `find $builddir -name configure`)" + rlRun "pushd $(dirname "$(find $builddir -name configure)")" rlRun "./configure" rlRun "make" rlPhaseEnd @@ -60,15 +60,20 @@ rlJournalStart sed -i 's/set ld_library_path "."/set ld_library_path ""/' testsuite/lib/libffi*.exp sed -i '/append ld_library_path.*blddirffi/d' testsuite/lib/libffi*.exp # Set ld_library_path to the system libdir (typically /usr/lib or /usr/lib64) - export MYLIBDIR=$(rpm --eval '%{_libdir}') + MYLIBDIR=$(rpm --eval '%{_libdir}') sed -i 's;set libffi_dir.*"[^"]*";set libffi_dir "'"${MYLIBDIR}"'";' testsuite/lib/libffi*.exp - fgrep -e 'set ld_library_path' -e 'set libffi_dir' testsuite/lib/libffi.exp + grep -F -e 'set ld_library_path' -e 'set libffi_dir' testsuite/lib/libffi.exp + # As of upstream commit 40a7682 the link flags hardcode the library dir so we need to edit that too + # by removing the explicit library seach path to the built libraries. + # https://github.com/libffi/libffi/commit/40a7682#diff-b4e449eb85934de2bdcf9ee0ac320872a7d09d60df6a24e3f066d7d74f6ddfd0R345 + sed -i 's;set libffi_link_flags "-L[^"]*";set libffi_link_flags "";' testsuite/lib/libffi*.exp set +xe rlLog "Checking whether we test really the installed libraries." strace -F -e open,openat,stat -o strace.log -- make check - LIBFFI_SO_CALLS=`cat strace.log | grep libffi.so | grep -v ENOENT | grep -v 'usr/lib' | grep -v '\"\/lib' | grep -v 'unfinished' | wc -l` - rlAssertGreater "The just built libraries should not be used, everything should be taken from /usr" 5 $LIBFFI_SO_CALLS - rlRun "cat strace.log | grep libffi.so | grep usr" + # Count library calls from places different than the libdir we want (MYLIBDIR) + LIBFFI_SO_CALLS=$(cat strace.log | grep libffi.so | grep -v ENOENT | grep -v "/usr" | grep -v '"/lib' | grep -c -v 'unfinished') + rlAssertGreater "The just built libraries should not be used, everything should be taken from /usr" 5 "$LIBFFI_SO_CALLS" + rlRun "cat strace.log | grep libffi.so | grep /usr" rlRun "cat strace.log | grep libffi.so | grep rpmbuild" 1 rlRun "make check" 0 "RUNNING THE TESTSUITE" rlRun "popd" @@ -76,7 +81,7 @@ rlJournalStart rlPhaseStartCleanup rlRun "ls -al $TmpDir" - rlBundleLogs logs $(find . -name 'libffi.sum') $(find . -name 'libffi.log') + rlBundleLogs logs "$(find . -name 'libffi.sum')" "$(find . -name 'libffi.log')" rlRun "rm -r $TmpDir" 0 "Removing tmp directory" rlPhaseEnd rlJournalPrintText From 45b9541de445badb2cf3ebb02ff3dcd0bf64e404 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Fri, 5 Sep 2025 16:01:59 -0400 Subject: [PATCH 58/58] Update to libffi-3.5.2 --- .gitignore | 1 + libffi.spec | 8 ++++++-- sources | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7229baf..24dfd22 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ libffi-3.0.9.tar.gz /libffi-3.4.7.tar.gz /libffi-3.4.8.tar.gz /libffi-3.5.1.tar.gz +/libffi-3.5.2.tar.gz diff --git a/libffi.spec b/libffi.spec index 36878c2..a056262 100644 --- a/libffi.spec +++ b/libffi.spec @@ -3,9 +3,10 @@ %global multilib_arches %{ix86} x86_64 Name: libffi -Version: 3.5.1 -Release: 2%{?dist} +Version: 3.5.2 +Release: 1%{?dist} Summary: A portable foreign function interface library +# No license change for 3.5.2 # No license change for 3.5.1 # No license change for 3.4.8 # No license change for 3.4.7 @@ -142,6 +143,9 @@ install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h %{_infodir}/libffi.info.* %changelog +* Fri Sep 5 2025 DJ Delorie - 3.5.2-1 +- Rebase to libffi 3.5.1. + * Thu Jul 24 2025 Fedora Release Engineering - 3.5.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild diff --git a/sources b/sources index a846100..5cd2132 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libffi-3.5.1.tar.gz) = 3da9e21fdb920e7962ceb01ee671ef36196df4d5dad62e0cdd8e87cc60e350f241c204350560ae26ea04cc898161b5585c8a5a5125bdbcc84508efbb7ea61eb8 +SHA512 (libffi-3.5.2.tar.gz) = 76974a84e3aee6bbd646a6da2e641825ae0b791ca6efdc479b2d4cbcd3ad607df59cffcf5031ad5bd30822961a8c6de164ac8ae379d1804acd388b1975cdbf4d