* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libffi/, dev-libs/libffi/files/
@ 2017-10-14 19:57 Sergei Trofimovich
0 siblings, 0 replies; 12+ messages in thread
From: Sergei Trofimovich @ 2017-10-14 19:57 UTC (permalink / raw
To: gentoo-commits
commit: 75b2c980d16c2b137f21e9f6a0a3f1de6ddd7769
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 14 19:51:14 2017 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Oct 14 19:56:54 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=75b2c980
dev-libs/libffi: ia64: fix small struct handling, bug #634190
After FFI_TYPE_COMPLEX was added to libffi ia64 dispatch table
was off-by-one in IA-64 specific handling of return values.
Bug: https://bugs.gentoo.org/634190
Package-Manager: Portage-2.3.10, Repoman-2.3.3
.../libffi/files/libffi-3.2.1-complex-ia64.patch | 41 ++++++++++++++++++++++
dev-libs/libffi/libffi-3.2.1.ebuild | 1 +
2 files changed, 42 insertions(+)
diff --git a/dev-libs/libffi/files/libffi-3.2.1-complex-ia64.patch b/dev-libs/libffi/files/libffi-3.2.1-complex-ia64.patch
new file mode 100644
index 00000000000..fd5c1ea4b28
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.2.1-complex-ia64.patch
@@ -0,0 +1,41 @@
+ia64: fix small struct handling (missing complex type entry)
+
+commit 6e8a4460833594d5af1b4539178025da0077df19
+added FFI_TYPE_COMPLEX value type (comes after FFI_TYPE_POINTER)
+
+ia64 ffi_closure_unix reiles on the ordering of
+types as ia64 has ia64-specific FFI types:
+small struct and others.
+
+As a result all tests handling small structs broke.
+
+The change fixes dispatch table by ignoring FFI_TYPE_COMPLEX.
+This has positive effect of unbreaking most tests:
+
+ === libffi Summary ===
+
+-# of expected passes 1595
+-# of unexpected failures 295
++# of expected passes 1930
++# of unexpected failures 10
+ # of unsupported tests 30
+
+Bug: https://bugs.gentoo.org/634190
+--- a/src/ia64/unix.S
++++ b/src/ia64/unix.S
+@@ -529,6 +529,7 @@ ffi_closure_unix:
+ data8 @pcrel(.Lst_int64) // FFI_TYPE_SINT64
+ data8 @pcrel(.Lst_void) // FFI_TYPE_STRUCT
+ data8 @pcrel(.Lst_int64) // FFI_TYPE_POINTER
++ data8 @pcrel(.Lst_void) // FFI_TYPE_COMPLEX (not implemented)
+ data8 @pcrel(.Lst_small_struct) // FFI_IA64_TYPE_SMALL_STRUCT
+ data8 @pcrel(.Lst_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT
+ data8 @pcrel(.Lst_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE
+@@ -550,6 +551,7 @@ ffi_closure_unix:
+ data8 @pcrel(.Lld_int) // FFI_TYPE_SINT64
+ data8 @pcrel(.Lld_void) // FFI_TYPE_STRUCT
+ data8 @pcrel(.Lld_int) // FFI_TYPE_POINTER
++ data8 @pcrel(.Lld_void) // FFI_TYPE_COMPLEX (not implemented)
+ data8 @pcrel(.Lld_small_struct) // FFI_IA64_TYPE_SMALL_STRUCT
+ data8 @pcrel(.Lld_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT
+ data8 @pcrel(.Lld_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE
diff --git a/dev-libs/libffi/libffi-3.2.1.ebuild b/dev-libs/libffi/libffi-3.2.1.ebuild
index 1160d49a6b8..848a9fedbf1 100644
--- a/dev-libs/libffi/libffi-3.2.1.ebuild
+++ b/dev-libs/libffi/libffi-3.2.1.ebuild
@@ -40,6 +40,7 @@ src_prepare() {
epatch "${FILESDIR}"/${PN}-3.2.1-o-tmpfile-eacces.patch #529044
epatch "${FILESDIR}"/${PN}-3.2.1-complex_alpha.patch
epatch "${FILESDIR}"/${PN}-3.1-darwin-x32.patch
+ epatch "${FILESDIR}"/${PN}-3.2.1-complex-ia64.patch
epatch_user
elibtoolize
}
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libffi/, dev-libs/libffi/files/
@ 2018-01-06 13:03 Sergei Trofimovich
0 siblings, 0 replies; 12+ messages in thread
From: Sergei Trofimovich @ 2018-01-06 13:03 UTC (permalink / raw
To: gentoo-commits
commit: 6b286d934352693e1f9a9cabfe567884e28b0cb5
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 6 13:02:51 2018 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Jan 6 13:03:17 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6b286d93
dev-libs/libffi: allow includedir= override, bug #643582
It's not a fix for bug #643582 as includes location did
not change. But a step towards it.
Changes are:
- updated to EAPI=6
- backported upstream commit
https://github.com/libffi/libffi/commit/982b89c01aca99c7bc229914fc1521f96930919b
("Install public headers in the standard path")
- but overrode default location as
--includedir=/usr/$(get_libdir)/${P}/include/
to keep python from breaking: bug #643582#c2.
Reported-by: William L. Thomson Jr.
Bug: https://bugs.gentoo.org/643582
Package-Manager: Portage-2.3.19, Repoman-2.3.6
.../libffi/files/libffi-3.2.1-complex_alpha.patch | 4 +-
.../files/libffi-3.2.1-include-path-autogen.patch | 56 ++++++++++++++++++
.../libffi/files/libffi-3.2.1-include-path.patch | 39 ++++++++++++
dev-libs/libffi/libffi-3.2.1-r1.ebuild | 69 ++++++++++++++++++++++
4 files changed, 166 insertions(+), 2 deletions(-)
diff --git a/dev-libs/libffi/files/libffi-3.2.1-complex_alpha.patch b/dev-libs/libffi/files/libffi-3.2.1-complex_alpha.patch
index 0d6e0bc2900..5e8c943eee3 100644
--- a/dev-libs/libffi/files/libffi-3.2.1-complex_alpha.patch
+++ b/dev-libs/libffi/files/libffi-3.2.1-complex_alpha.patch
@@ -1,5 +1,5 @@
---- src/alpha/osf.S.orig 2015-01-16 10:46:15.000000000 +0100
-+++ src/alpha/osf.S 2015-01-16 10:46:24.000000000 +0100
+--- a/src/alpha/osf.S.orig 2015-01-16 10:46:15.000000000 +0100
++++ b/src/alpha/osf.S 2015-01-16 10:46:24.000000000 +0100
@@ -279,6 +279,7 @@
.gprel32 $load_64 # FFI_TYPE_SINT64
.gprel32 $load_none # FFI_TYPE_STRUCT
diff --git a/dev-libs/libffi/files/libffi-3.2.1-include-path-autogen.patch b/dev-libs/libffi/files/libffi-3.2.1-include-path-autogen.patch
new file mode 100644
index 00000000000..522e1fa9c48
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.2.1-include-path-autogen.patch
@@ -0,0 +1,56 @@
+Autogenerated part of libffi-3.2.1-include-path.patch
+
+https://bugs.gentoo.org/643582
+diff --git a/include/Makefile.in b/include/Makefile.in
+index 9d747e8..99ecfd7 100644
+--- a/include/Makefile.in
++++ b/include/Makefile.in
+@@ -152,2 +152,2 @@ am__uninstall_files_from_dir = { \
+-am__installdirs = "$(DESTDIR)$(includesdir)"
+-HEADERS = $(nodist_includes_HEADERS)
++am__installdirs = "$(DESTDIR)$(includedir)"
++HEADERS = $(nodist_include_HEADERS)
+@@ -317,2 +317 @@ EXTRA_DIST = ffi.h.in ffi_common.h
+-includesdir = $(libdir)/@PACKAGE_NAME@-@PACKAGE_VERSION@/include
+-nodist_includes_HEADERS = ffi.h ffitarget.h
++nodist_include_HEADERS = ffi.h ffitarget.h
+@@ -360 +359 @@ clean-libtool:
+-install-nodist_includesHEADERS: $(nodist_includes_HEADERS)
++install-nodist_includeHEADERS: $(nodist_include_HEADERS)
+@@ -362 +361 @@ install-nodist_includesHEADERS: $(nodist_includes_HEADERS)
+- @list='$(nodist_includes_HEADERS)'; test -n "$(includesdir)" || list=; \
++ @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \
+@@ -364,2 +363,2 @@ install-nodist_includesHEADERS: $(nodist_includes_HEADERS)
+- echo " $(MKDIR_P) '$(DESTDIR)$(includesdir)'"; \
+- $(MKDIR_P) "$(DESTDIR)$(includesdir)" || exit 1; \
++ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
++ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+@@ -372,2 +371,2 @@ install-nodist_includesHEADERS: $(nodist_includes_HEADERS)
+- echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
+- $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
++ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
++ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
+@@ -376 +375 @@ install-nodist_includesHEADERS: $(nodist_includes_HEADERS)
+-uninstall-nodist_includesHEADERS:
++uninstall-nodist_includeHEADERS:
+@@ -378 +377 @@ uninstall-nodist_includesHEADERS:
+- @list='$(nodist_includes_HEADERS)'; test -n "$(includesdir)" || list=; \
++ @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \
+@@ -380 +379 @@ uninstall-nodist_includesHEADERS:
+- dir='$(DESTDIR)$(includesdir)'; $(am__uninstall_files_from_dir)
++ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
+@@ -468 +467 @@ installdirs:
+- for dir in "$(DESTDIR)$(includesdir)"; do \
++ for dir in "$(DESTDIR)$(includedir)"; do \
+@@ -522 +521 @@ info-am:
+-install-data-am: install-nodist_includesHEADERS
++install-data-am: install-nodist_includeHEADERS
+@@ -566 +565 @@ ps-am:
+-uninstall-am: uninstall-nodist_includesHEADERS
++uninstall-am: uninstall-nodist_includeHEADERS
+@@ -577 +576 @@ uninstall-am: uninstall-nodist_includesHEADERS
+- install-nodist_includesHEADERS install-pdf install-pdf-am \
++ install-nodist_includeHEADERS install-pdf install-pdf-am \
+@@ -582 +581 @@ uninstall-am: uninstall-nodist_includesHEADERS
+- uninstall-am uninstall-nodist_includesHEADERS
++ uninstall-am uninstall-nodist_includeHEADERS
diff --git a/dev-libs/libffi/files/libffi-3.2.1-include-path.patch b/dev-libs/libffi/files/libffi-3.2.1-include-path.patch
new file mode 100644
index 00000000000..e1269b2398a
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.2.1-include-path.patch
@@ -0,0 +1,39 @@
+https://bugs.gentoo.org/643582
+
+From 982b89c01aca99c7bc229914fc1521f96930919b Mon Sep 17 00:00:00 2001
+From: Yen Chi Hsuan <yan12125@gmail.com>
+Date: Sun, 13 Nov 2016 19:17:19 +0800
+Subject: [PATCH] Install public headers in the standard path
+
+---
+ include/Makefile.am | 3 +--
+ libffi.pc.in | 2 +-
+ 2 files changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/include/Makefile.am b/include/Makefile.am
+index bb241e8..c59df9f 100644
+--- a/include/Makefile.am
++++ b/include/Makefile.am
+@@ -6,5 +6,4 @@ DISTCLEANFILES=ffitarget.h
+ noinst_HEADERS=ffi_common.h ffi_cfi.h
+ EXTRA_DIST=ffi.h.in
+
+-includesdir = $(libdir)/@PACKAGE_NAME@-@PACKAGE_VERSION@/include
+-nodist_includes_HEADERS = ffi.h ffitarget.h
++nodist_include_HEADERS = ffi.h ffitarget.h
+diff --git a/libffi.pc.in b/libffi.pc.in
+index edf6fde..6fad83b 100644
+--- a/libffi.pc.in
++++ b/libffi.pc.in
+@@ -2,7 +2,7 @@ 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
+--
+2.15.1
+
diff --git a/dev-libs/libffi/libffi-3.2.1-r1.ebuild b/dev-libs/libffi/libffi-3.2.1-r1.ebuild
new file mode 100644
index 00000000000..4eefabab054
--- /dev/null
+++ b/dev-libs/libffi/libffi-3.2.1-r1.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit eutils libtool multilib multilib-minimal toolchain-funcs
+
+DESCRIPTION="a portable, high level programming interface to various calling conventions"
+HOMEPAGE="https://sourceware.org/libffi/"
+SRC_URI="ftp://sourceware.org/pub/${PN}/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="debug pax_kernel static-libs test"
+
+RDEPEND="abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r1
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+DEPEND="test? ( dev-util/dejagnu )"
+
+DOCS="ChangeLog* README"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.2.1-o-tmpfile-eacces.patch #529044
+ "${FILESDIR}"/${PN}-3.2.1-complex_alpha.patch
+ "${FILESDIR}"/${PN}-3.1-darwin-x32.patch
+ "${FILESDIR}"/${PN}-3.2.1-complex-ia64.patch
+ "${FILESDIR}"/${PN}-3.2.1-include-path.patch
+ "${FILESDIR}"/${PN}-3.2.1-include-path-autogen.patch
+)
+
+ECONF_SOURCE=${S}
+
+pkg_setup() {
+ # Check for orphaned libffi, see https://bugs.gentoo.org/354903 for example
+ if [[ ${ROOT} == "/" && ${EPREFIX} == "" ]] && ! has_version ${CATEGORY}/${PN}; then
+ local base="${T}"/conftest
+ echo 'int main() { }' > "${base}".c
+ $(tc-getCC) -o "${base}" "${base}".c -lffi >&/dev/null
+ if [ $? -eq 0 ]; then
+ eerror "The linker reported linking against -lffi to be working while it shouldn't have."
+ eerror "This is wrong and you should find and delete the old copy of libffi before continuing."
+ die "The system is in inconsistent state with unknown libffi installed."
+ fi
+ fi
+}
+
+src_prepare() {
+ default
+
+ sed -i -e 's:@toolexeclibdir@:$(libdir):g' Makefile.in || die #462814
+ elibtoolize
+}
+
+multilib_src_configure() {
+ use userland_BSD && export HOST="${CHOST}"
+ # python does not like miltilib-wrapped headers: bug #643582
+ # thus we install includes into different headers
+ local includes="${EPREFIX}"/usr/$(get_libdir)/${P}/include/
+ econf \
+ $(use_enable static-libs static) \
+ $(use_enable pax_kernel pax_emutramp) \
+ $(use_enable debug) \
+ --includedir="${includes}"
+}
+
+multilib_src_install_all() {
+ prune_libtool_files
+ einstalldocs
+}
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libffi/, dev-libs/libffi/files/
@ 2018-02-17 19:42 Sergei Trofimovich
0 siblings, 0 replies; 12+ messages in thread
From: Sergei Trofimovich @ 2018-02-17 19:42 UTC (permalink / raw
To: gentoo-commits
commit: 4e5016fe999d1e38f3ba606c977bcea43451ac05
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 17 19:41:37 2018 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Feb 17 19:41:54 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4e5016fe
dev-libs/libffi: fix small struct handling on ia64, bug #634190
Bug: https://github.com/libffi/libffi/pull/407
Closes: https://bugs.gentoo.org/634190
Package-Manager: Portage-2.3.24, Repoman-2.3.6
.../files/libffi-3.2.1-ia64-small-struct.patch | 74 ++++++++++++++++++++++
dev-libs/libffi/libffi-3.2.1-r2.ebuild | 70 ++++++++++++++++++++
2 files changed, 144 insertions(+)
diff --git a/dev-libs/libffi/files/libffi-3.2.1-ia64-small-struct.patch b/dev-libs/libffi/files/libffi-3.2.1-ia64-small-struct.patch
new file mode 100644
index 00000000000..6e21f3566bc
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.2.1-ia64-small-struct.patch
@@ -0,0 +1,74 @@
+From b58caef7fd620408be9239ac24ea89d5bc84f30b Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Sat, 17 Feb 2018 19:00:40 +0000
+Subject: [PATCH 2/2] ia64: fix small struct return
+
+This change fixes libffi.call/struct10.c failure on ia64:
+FAIL: libffi.call/struct10.c -W -Wall -Wno-psabi -O0 execution test
+
+.Lst_small_struct handles returns for structs less than 32 bytes
+(following ia64 return value ABI [1]). Subroutine does roughly the
+following:
+
+```
+ mov [sp+0] = r8
+ mov [sp+8] = r9
+ mov [sp+16] = r10
+ mov [sp+24] = r11
+ memcpy(destination, source=sp, 12);
+```
+
+The problem: ia64 ABI guarantees that top 16 bytes of stack are
+scratch space for callee function. Thus it can clobber it. [1]
+says (7.1 Procedure Frames):
+"""
+* Scratch area. This 16-byte region is provided as scratch storage
+ for procedures that are called by the current procedure. Leaf
+ procedures do not need to allocate this region. A procedure may
+ use the 16 bytes at the top of its own frame as scratch memory,
+ but the contents of this area are not preserved by a procedure call.
+"""
+
+In our case 16 top bytes are clobbered by a PLT resolver when memcpy()
+is called for the first time. As a result memcpy implementation reads
+already clobbered data frop top of stack.
+
+The fix is simple: allocate 16 bytes of scrats space prior to memcpy()
+call.
+
+[1]: https://www.intel.com/content/dam/www/public/us/en/documents/guides/itanium-software-runtime-architecture-guide.pdf
+
+Bug: https://bugs.gentoo.org/634190
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+---
+ src/ia64/unix.S | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/src/ia64/unix.S b/src/ia64/unix.S
+index 4733377..e2547e0 100644
+--- a/src/ia64/unix.S
++++ b/src/ia64/unix.S
+@@ -175,7 +175,6 @@ ffi_call_unix:
+ ;;
+
+ .Lst_small_struct:
+- add sp = -16, sp
+ cmp.lt p6, p0 = 8, in3
+ cmp.lt p7, p0 = 16, in3
+ cmp.lt p8, p0 = 24, in3
+@@ -191,6 +190,12 @@ ffi_call_unix:
+ (p8) st8 [r18] = r11
+ mov out1 = sp
+ mov out2 = in3
++ ;;
++ // ia64 software calling convention requires
++ // top 16 bytes of stack to be scratch space
++ // PLT resolver uses that scratch space at
++ // 'memcpy' symbol reolution time
++ add sp = -16, sp
+ br.call.sptk.many b0 = memcpy#
+ ;;
+ mov ar.pfs = loc0
+--
+2.16.1
+
diff --git a/dev-libs/libffi/libffi-3.2.1-r2.ebuild b/dev-libs/libffi/libffi-3.2.1-r2.ebuild
new file mode 100644
index 00000000000..533e9afa08e
--- /dev/null
+++ b/dev-libs/libffi/libffi-3.2.1-r2.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit eutils libtool multilib multilib-minimal toolchain-funcs
+
+DESCRIPTION="a portable, high level programming interface to various calling conventions"
+HOMEPAGE="https://sourceware.org/libffi/"
+SRC_URI="ftp://sourceware.org/pub/${PN}/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="debug pax_kernel static-libs test"
+
+RDEPEND="abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r1
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+DEPEND="test? ( dev-util/dejagnu )"
+
+DOCS="ChangeLog* README"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.2.1-o-tmpfile-eacces.patch #529044
+ "${FILESDIR}"/${PN}-3.2.1-complex_alpha.patch
+ "${FILESDIR}"/${PN}-3.1-darwin-x32.patch
+ "${FILESDIR}"/${PN}-3.2.1-complex-ia64.patch
+ "${FILESDIR}"/${PN}-3.2.1-include-path.patch
+ "${FILESDIR}"/${PN}-3.2.1-include-path-autogen.patch
+ "${FILESDIR}"/${PN}-3.2.1-ia64-small-struct.patch #634190
+)
+
+ECONF_SOURCE=${S}
+
+pkg_setup() {
+ # Check for orphaned libffi, see https://bugs.gentoo.org/354903 for example
+ if [[ ${ROOT} == "/" && ${EPREFIX} == "" ]] && ! has_version ${CATEGORY}/${PN}; then
+ local base="${T}"/conftest
+ echo 'int main() { }' > "${base}".c
+ $(tc-getCC) -o "${base}" "${base}".c -lffi >&/dev/null
+ if [ $? -eq 0 ]; then
+ eerror "The linker reported linking against -lffi to be working while it shouldn't have."
+ eerror "This is wrong and you should find and delete the old copy of libffi before continuing."
+ die "The system is in inconsistent state with unknown libffi installed."
+ fi
+ fi
+}
+
+src_prepare() {
+ default
+
+ sed -i -e 's:@toolexeclibdir@:$(libdir):g' Makefile.in || die #462814
+ elibtoolize
+}
+
+multilib_src_configure() {
+ use userland_BSD && export HOST="${CHOST}"
+ # python does not like miltilib-wrapped headers: bug #643582
+ # thus we install includes into ABI-specific paths
+ local includes="${EPREFIX}"/usr/$(get_libdir)/${P}/include/
+ econf \
+ $(use_enable static-libs static) \
+ $(use_enable pax_kernel pax_emutramp) \
+ $(use_enable debug) \
+ --includedir="${includes}"
+}
+
+multilib_src_install_all() {
+ prune_libtool_files
+ einstalldocs
+}
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libffi/, dev-libs/libffi/files/
@ 2018-09-30 23:07 Sergei Trofimovich
0 siblings, 0 replies; 12+ messages in thread
From: Sergei Trofimovich @ 2018-09-30 23:07 UTC (permalink / raw
To: gentoo-commits
commit: 6d8e37b7787e68f6b3aafb55b81f2781c54f8665
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 30 23:01:33 2018 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Sep 30 23:07:19 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d8e37b7
dev-libs/libffi: bump up to 3.3_rc0
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
Package-Manager: Portage-2.3.50, Repoman-2.3.11
dev-libs/libffi/Manifest | 1 +
.../files/libffi-3.3_rc0-hppa-no-TEXTREL.patch | 93 ++++++++++++++++++++++
dev-libs/libffi/libffi-3.3_rc0.ebuild | 64 +++++++++++++++
3 files changed, 158 insertions(+)
diff --git a/dev-libs/libffi/Manifest b/dev-libs/libffi/Manifest
index f77899f0229..d70d8b54808 100644
--- a/dev-libs/libffi/Manifest
+++ b/dev-libs/libffi/Manifest
@@ -1 +1,2 @@
DIST libffi-3.2.1.tar.gz 940837 BLAKE2B d202ccaa185acfd2476ed2a9b011891507cd8efbbda60f67c583268d1563853442ed829acecbf81c9b6b9a930345780bb7a4bd80e71e50ef544c7f4eab8cb01f SHA512 980ca30a8d76f963fca722432b1fe5af77d7a4e4d2eac5144fbc5374d4c596609a293440573f4294207e1bdd9fda80ad1e1cafb2ffb543df5a275bc3bd546483
+DIST libffi-3.3-rc0.tar.gz 1084854 BLAKE2B 2c38d60f17ef52bcf270178c13c218f6ee320c9785091621d4689bcf6cee31d07eaaca12790965e1ae3ad71ad2c408342743968bf1d23f81a07fbdf6cfd55b90 SHA512 e6e695d32cd6eb7d65983f32986fccdfc786a593d2ea18af30ce741f58cfa1eb264b1a8d09df5084cb916001aea15187b005c2149a0620a44397a4453b6137d4
diff --git a/dev-libs/libffi/files/libffi-3.3_rc0-hppa-no-TEXTREL.patch b/dev-libs/libffi/files/libffi-3.3_rc0-hppa-no-TEXTREL.patch
new file mode 100644
index 00000000000..c6286f34990
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.3_rc0-hppa-no-TEXTREL.patch
@@ -0,0 +1,93 @@
+From 955e3c56459556284cf4a7fb23c51f9d310be80c Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Sat, 19 May 2018 10:49:07 +0100
+Subject: [PATCH] hppa: avoid TEXTREL in .eh_frame section
+
+Before the change hand-crafted .eh_frame section contained
+ABS relocation and caused TEXTREL tag to be emitted:
+
+```
+$ ./configure --host=hppa2.0-unknown-linux-gnu LDFLAGS=-Wl,-z,text
+$ make
+...
+/usr/libexec/gcc/hppa2.0-unknown-linux-gnu/ld:
+ read-only segment has dynamic relocations.
+```
+
+Link failure is caused by absolute address of FDEs
+encoded into .eh_frame entries.
+
+Fixed TEXTREL by using pcrel (instead of ABS) encoding
+for absolute addresses (__PIC__ code) by adding augmentation
+information ("zR" CIE type).
+
+All tests still pass on hppa2.0. The specific tests that still pass
+and exercise this code path:
+ testsuite/libffi.call/unwindtest.cc
+ testsuite/libffi.call/unwindtest_ffi_call.cc
+
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+---
+ src/pa/linux.S | 25 +++++++++++++++++++++++--
+ 1 file changed, 23 insertions(+), 2 deletions(-)
+
+diff --git a/src/pa/linux.S b/src/pa/linux.S
+index f11ae76..ab04c75 100644
+--- a/src/pa/linux.S
++++ b/src/pa/linux.S
+@@ -297,10 +297,18 @@ ffi_closure_pa32:
+ .LSCIE1:
+ .word 0x0 ;# CIE Identifier Tag
+ .byte 0x1 ;# CIE Version
++#ifdef __PIC__
++ .ascii "zR\0" ;# CIE Augmentation: 'z' - data, 'R' - DW_EH_PE_... data
++#else
+ .ascii "\0" ;# CIE Augmentation
++#endif
+ .uleb128 0x1 ;# CIE Code Alignment Factor
+ .sleb128 4 ;# CIE Data Alignment Factor
+ .byte 0x2 ;# CIE RA Column
++#ifdef __PIC__
++ .uleb128 0x1 ;# Augmentation size
++ .byte 0x1b ;# FDE Encoding (DW_EH_PE_pcrel|DW_EH_PE_sdata4)
++#endif
+ .byte 0xc ;# DW_CFA_def_cfa
+ .uleb128 0x1e
+ .uleb128 0x0
+@@ -310,9 +318,15 @@ ffi_closure_pa32:
+ .word .LEFDE1-.LASFDE1 ;# FDE Length
+ .LASFDE1:
+ .word .LASFDE1-.Lframe1 ;# FDE CIE offset
+- .word .LFB1 ;# FDE initial location
++#ifdef __PIC__
++ .word .LFB1-. ;# FDE initial location
++#else
++ .word .LFB1 ;# FDE initial location
++#endif
+ .word .LFE1-.LFB1 ;# FDE address range
+-
++#ifdef __PIC__
++ .uleb128 0x0 ;# Augmentation size: no data
++#endif
+ .byte 0x4 ;# DW_CFA_advance_loc4
+ .word .LCFI11-.LFB1
+ .byte 0x83 ;# DW_CFA_offset, column 0x3
+@@ -338,8 +352,15 @@ ffi_closure_pa32:
+ .word .LEFDE2-.LASFDE2 ;# FDE Length
+ .LASFDE2:
+ .word .LASFDE2-.Lframe1 ;# FDE CIE offset
++#ifdef __PIC__
++ .word .LFB2-. ;# FDE initial location
++#else
+ .word .LFB2 ;# FDE initial location
++#endif
+ .word .LFE2-.LFB2 ;# FDE address range
++#ifdef __PIC__
++ .uleb128 0x0 ;# Augmentation size: no data
++#endif
+ .byte 0x4 ;# DW_CFA_advance_loc4
+ .word .LCFI21-.LFB2
+ .byte 0x83 ;# DW_CFA_offset, column 0x3
+--
+2.19.0
+
diff --git a/dev-libs/libffi/libffi-3.3_rc0.ebuild b/dev-libs/libffi/libffi-3.3_rc0.ebuild
new file mode 100644
index 00000000000..0a31487e51f
--- /dev/null
+++ b/dev-libs/libffi/libffi-3.3_rc0.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+inherit multilib multilib-minimal toolchain-funcs
+
+MY_PV=${PV/_rc/-rc}
+MY_P=${PN}-${MY_PV}
+
+DESCRIPTION="a portable, high level programming interface to various calling conventions"
+HOMEPAGE="https://sourceware.org/libffi/"
+SRC_URI="https://github.com/libffi/libffi/releases/download/v${MY_PV}/${MY_P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0/7" # SONAME=libffi.so.7
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="debug pax_kernel static-libs test"
+
+RDEPEND=""
+DEPEND=""
+BDEPEND="test? ( dev-util/dejagnu )"
+
+DOCS="ChangeLog* README.md"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.2.1-o-tmpfile-eacces.patch #529044
+ "${FILESDIR}"/${PN}-3.3_rc0-hppa-no-TEXTREL.patch
+)
+
+S=${WORKDIR}/${MY_P}
+
+ECONF_SOURCE=${S}
+
+pkg_setup() {
+ # Check for orphaned libffi, see https://bugs.gentoo.org/354903 for example
+ if [[ ${ROOT} == "/" && ${EPREFIX} == "" ]] && ! has_version ${CATEGORY}/${PN}; then
+ local base="${T}"/conftest
+ echo 'int main() { }' > "${base}".c
+ $(tc-getCC) -o "${base}" "${base}".c -lffi >&/dev/null
+ if [ $? -eq 0 ]; then
+ eerror "The linker reported linking against -lffi to be working while it shouldn't have."
+ eerror "This is wrong and you should find and delete the old copy of libffi before continuing."
+ die "The system is in inconsistent state with unknown libffi installed."
+ fi
+ fi
+}
+
+multilib_src_configure() {
+ use userland_BSD && export HOST="${CHOST}"
+ econf \
+ --includedir="${EPREFIX}"/usr/$(get_libdir)/${P}/include \
+ $(use_enable static-libs static) \
+ $(use_enable pax_kernel pax_emutramp) \
+ $(use_enable debug)
+}
+
+multilib_src_test() {
+ emake check RUNTESTFLAGS='-a -v'
+}
+
+multilib_src_install_all() {
+ find "${ED}" -name "*.la" -delete || die
+ einstalldocs
+}
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libffi/, dev-libs/libffi/files/
@ 2019-11-28 0:16 Sergei Trofimovich
0 siblings, 0 replies; 12+ messages in thread
From: Sergei Trofimovich @ 2019-11-28 0:16 UTC (permalink / raw
To: gentoo-commits
commit: ee2c3dee59595741c93f694357308368f4dfea19
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 28 00:13:27 2019 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Nov 28 00:16:16 2019 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee2c3dee
dev-libs/libffi: fix build on ppc32
Reported-by: qmpcggv2ei0p <AT> opayq.com
Closes: https://bugs.gentoo.org/701128
Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
dev-libs/libffi/files/libffi-3.3-power7.patch | 39 +++++++++++++++++++++++++++
dev-libs/libffi/libffi-3.3-r1.ebuild | 1 +
2 files changed, 40 insertions(+)
diff --git a/dev-libs/libffi/files/libffi-3.3-power7.patch b/dev-libs/libffi/files/libffi-3.3-power7.patch
new file mode 100644
index 00000000000..83f518f4c2e
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.3-power7.patch
@@ -0,0 +1,39 @@
+https://bugs.gentoo.org/701128
+
+From 2138adb2a5b6a0bc2fe3518e0645eacc89b6f392 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Thu, 28 Nov 2019 00:02:42 +0000
+Subject: [PATCH] powerpc: fix build failure on power7 and older
+
+Build failure looks as:
+```
+libtool: compile: powerpc-unknown-linux-gnu-gcc \
+ -O2 -mcpu=powerpc -mtune=powerpc -pipe ... -c src/powerpc/ffi.c ...
+In file included from src/powerpc/ffi.c:33:
+src/powerpc/ffi_powerpc.h:65:9: error: '__int128' is not supported on this target
+ 65 | typedef __int128 float128;
+ | ^~~~~~~~
+```
+
+The fix avoids using __int128 in favour of aligned char[16].
+
+Closes: https://github.com/libffi/libffi/issues/531
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+---
+ src/powerpc/ffi_powerpc.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/src/powerpc/ffi_powerpc.h
++++ b/src/powerpc/ffi_powerpc.h
+@@ -62,7 +62,7 @@ typedef _Float128 float128;
+ #elif defined(__FLOAT128__)
+ typedef __float128 float128;
+ #else
+-typedef __int128 float128;
++typedef char float128[16] __attribute__((aligned(16)));
+ #endif
+
+ void FFI_HIDDEN ffi_closure_SYSV (void);
+--
+2.24.0
+
diff --git a/dev-libs/libffi/libffi-3.3-r1.ebuild b/dev-libs/libffi/libffi-3.3-r1.ebuild
index 53912670ba1..2377c795636 100644
--- a/dev-libs/libffi/libffi-3.3-r1.ebuild
+++ b/dev-libs/libffi/libffi-3.3-r1.ebuild
@@ -27,6 +27,7 @@ DOCS="ChangeLog* README.md"
PATCHES=(
"${FILESDIR}"/${PN}-3.2.1-o-tmpfile-eacces.patch #529044
"${FILESDIR}"/${PN}-3.3_rc0-ppc-macos-go.patch
+ "${FILESDIR}"/${PN}-3.3-power7.patch
)
S=${WORKDIR}/${MY_P}
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libffi/, dev-libs/libffi/files/
@ 2020-03-29 14:06 Sergei Trofimovich
0 siblings, 0 replies; 12+ messages in thread
From: Sergei Trofimovich @ 2020-03-29 14:06 UTC (permalink / raw
To: gentoo-commits
commit: 84408e5274c751b6c52d06850449821acf355e87
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 29 14:06:02 2020 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Mar 29 14:06:10 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=84408e52
dev-libs/libffi: fix ppc64 build, bug 713596
Backport fixes for older power targets without explicit __int128 support.
Reported-by: Agostino Sarubbo
Closes: https://bugs.gentoo.org/713596
Package-Manager: Portage-2.3.96, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
.../libffi/files/libffi-3.3-power7-memcpy-2.patch | 28 +++++++++++++++
.../libffi/files/libffi-3.3-power7-memcpy.patch | 42 ++++++++++++++++++++++
dev-libs/libffi/libffi-3.3-r1.ebuild | 2 ++
3 files changed, 72 insertions(+)
diff --git a/dev-libs/libffi/files/libffi-3.3-power7-memcpy-2.patch b/dev-libs/libffi/files/libffi-3.3-power7-memcpy-2.patch
new file mode 100644
index 00000000000..d9d47acb618
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.3-power7-memcpy-2.patch
@@ -0,0 +1,28 @@
+From 6663047f56c2932a6b10a790f4ac6666dd181326 Mon Sep 17 00:00:00 2001
+From: Anthony Green <green@moxielogic.com>
+Date: Fri, 29 Nov 2019 07:00:35 -0500
+Subject: [PATCH] Address platforms with no __int128.
+
+---
+ src/powerpc/ffi_linux64.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/powerpc/ffi_linux64.c b/src/powerpc/ffi_linux64.c
+index de0d033..7364770 100644
+--- a/src/powerpc/ffi_linux64.c
++++ b/src/powerpc/ffi_linux64.c
+@@ -547,9 +547,9 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
+ if (next_arg.ul == gpr_end.ul)
+ next_arg.ul = rest.ul;
+ if (vecarg_count < NUM_VEC_ARG_REGISTERS64 && i < nfixedargs)
+- *vec_base.f128++ = **p_argv.f128;
++ memcpy (vec_base.f128++, *p_argv.f128, sizeof (float128));
+ else
+- *next_arg.f128 = **p_argv.f128;
++ memcpy (next_arg.f128, *p_argv.f128, sizeof (float128));
+ if (++next_arg.f128 == gpr_end.f128)
+ next_arg.f128 = rest.f128;
+ vecarg_count++;
+--
+2.26.0
+
diff --git a/dev-libs/libffi/files/libffi-3.3-power7-memcpy.patch b/dev-libs/libffi/files/libffi-3.3-power7-memcpy.patch
new file mode 100644
index 00000000000..91f9a6f60fa
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.3-power7-memcpy.patch
@@ -0,0 +1,42 @@
+From e50b9ef8b910fa642ef158f6642e60d54d7ad740 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 7 Dec 2019 02:34:14 -0800
+Subject: [PATCH] powerpc64: Use memcpy to help platforms with no __int128.
+ (#534)
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/powerpc/ffi_linux64.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/powerpc/ffi_linux64.c b/src/powerpc/ffi_linux64.c
+index 7364770..4d50878 100644
+--- a/src/powerpc/ffi_linux64.c
++++ b/src/powerpc/ffi_linux64.c
+@@ -680,9 +680,9 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
+ {
+ if (vecarg_count < NUM_VEC_ARG_REGISTERS64
+ && i < nfixedargs)
+- *vec_base.f128++ = *arg.f128++;
++ memcpy (vec_base.f128++, arg.f128, sizeof (float128));
+ else
+- *next_arg.f128 = *arg.f128++;
++ memcpy (next_arg.f128, arg.f128++, sizeof (float128));
+ if (++next_arg.f128 == gpr_end.f128)
+ next_arg.f128 = rest.f128;
+ vecarg_count++;
+@@ -986,9 +986,9 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
+ do
+ {
+ if (pvec < end_pvec && i < nfixedargs)
+- *to.f128 = *pvec++;
++ memcpy (to.f128, pvec++, sizeof (float128));
+ else
+- *to.f128 = *from.f128;
++ memcpy (to.f128, from.f128, sizeof (float128));
+ to.f128++;
+ from.f128++;
+ }
+--
+2.26.0
+
diff --git a/dev-libs/libffi/libffi-3.3-r1.ebuild b/dev-libs/libffi/libffi-3.3-r1.ebuild
index cbc8682f8c1..79f1d5d690e 100644
--- a/dev-libs/libffi/libffi-3.3-r1.ebuild
+++ b/dev-libs/libffi/libffi-3.3-r1.ebuild
@@ -28,6 +28,8 @@ PATCHES=(
"${FILESDIR}"/${PN}-3.2.1-o-tmpfile-eacces.patch #529044
"${FILESDIR}"/${PN}-3.3_rc0-ppc-macos-go.patch
"${FILESDIR}"/${PN}-3.3-power7.patch
+ "${FILESDIR}"/${PN}-3.3-power7-memcpy.patch
+ "${FILESDIR}"/${PN}-3.3-power7-memcpy-2.patch
)
S=${WORKDIR}/${MY_P}
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libffi/, dev-libs/libffi/files/
@ 2020-07-07 21:59 Sergei Trofimovich
0 siblings, 0 replies; 12+ messages in thread
From: Sergei Trofimovich @ 2020-07-07 21:59 UTC (permalink / raw
To: gentoo-commits
commit: 6364a6a2e066d377e04f3b1f1cbf17ac215d63ec
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 7 21:58:55 2020 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Jul 7 21:59:47 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6364a6a2
dev-libs/libffi: backport upstream ppc32 fixes
USE=test-bhaible exposed a few invalid type handlers.
Enable it by default for tests.
Package-Manager: Portage-2.3.103, Repoman-2.3.23
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
dev-libs/libffi/files/libffi-3.3-ppc-int128.patch | 63 ++++++++++++++++
.../files/libffi-3.3-ppc-vector-offset.patch | 53 +++++++++++++
dev-libs/libffi/libffi-3.3-r2.ebuild | 88 ++++++++++++++++++++++
3 files changed, 204 insertions(+)
diff --git a/dev-libs/libffi/files/libffi-3.3-ppc-int128.patch b/dev-libs/libffi/files/libffi-3.3-ppc-int128.patch
new file mode 100644
index 00000000000..ed53ae99902
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.3-ppc-int128.patch
@@ -0,0 +1,63 @@
+From 4f9e20ac51ce13d46fed3c869e1deb6d9bb89444 Mon Sep 17 00:00:00 2001
+From: Andrew Geissler <geissonator@users.noreply.github.com>
+Date: Fri, 1 May 2020 06:58:30 -0500
+Subject: [PATCH] ffi_powerpc.h: fix build failure with powerpc7 (#561)
+
+This is a patch pulled down from the following:
+https://github.com/buildroot/buildroot/blob/78926f610b1411b03464152472fd430012deb9ac/package/libffi/0004-ffi_powerpc.h-fix-build-failure-with-powerpc7.patch
+
+This issue is being hit on OpenBMC code when pulling the latest
+libffi tag and building on a P8 ppc64le machine. I verified this
+patch fixes the issue we are seeing.
+
+Below is the original commit message:
+
+Sicne commit 73dd43afc8a447ba98ea02e9aad4c6898dc77fb0, build on powerpc7
+fails on:
+
+In file included from ../src/powerpc/ffi.c:33:0:
+../src/powerpc/ffi_powerpc.h:61:9: error: '_Float128' is not supported on this target
+ typedef _Float128 float128;
+ ^~~~~~~~~
+
+Fix this build failure by checking for __HAVE_FLOAT128 before using
+_Float128, as _Float128 is enabled only on specific conditions, see
+output/host/powerpc64-buildroot-linux-gnu/sysroot/usr/include/bits/floatn.h:
+
+ /* Defined to 1 if the current compiler invocation provides a
+ floating-point type with the IEEE 754 binary128 format, and this glibc
+ includes corresponding *f128 interfaces for it. */
+ #if defined _ARCH_PWR8 && defined __LITTLE_ENDIAN__ && (_CALL_ELF == 2) \
+ && defined __FLOAT128__ && !defined __NO_LONG_DOUBLE_MATH
+ # define __HAVE_FLOAT128 1
+ #else
+ # define __HAVE_FLOAT128 0
+ #endif
+
+Fixes:
+ - http://autobuild.buildroot.org/results/5c9dd8fb3b6a128882b6250f197c80232d8a3b53
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
+
+Co-authored-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ src/powerpc/ffi_powerpc.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/powerpc/ffi_powerpc.h b/src/powerpc/ffi_powerpc.h
+index 8e2f2f0..960a5c4 100644
+--- a/src/powerpc/ffi_powerpc.h
++++ b/src/powerpc/ffi_powerpc.h
+@@ -57,7 +57,7 @@ typedef union
+ double d;
+ } ffi_dblfl;
+
+-#if defined(__FLOAT128_TYPE__)
++#if defined(__FLOAT128_TYPE__) && defined(__HAVE_FLOAT128)
+ typedef _Float128 float128;
+ #elif defined(__FLOAT128__)
+ typedef __float128 float128;
+--
+2.27.0
+
diff --git a/dev-libs/libffi/files/libffi-3.3-ppc-vector-offset.patch b/dev-libs/libffi/files/libffi-3.3-ppc-vector-offset.patch
new file mode 100644
index 00000000000..4bcd27e4f15
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.3-ppc-vector-offset.patch
@@ -0,0 +1,53 @@
+From 4d6d2866ae43e55325e8ee96561221804602cd7a Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Fri, 21 Feb 2020 21:06:15 -0600
+Subject: [PATCH] Update powerpc sysv assembly for ffi_powerpc.h changes (#541)
+
+Some of the flag bits were moved when adding powerpc64 vector support.
+
+Fixes #536
+---
+ src/powerpc/sysv.S | 12 +++++-------
+ 1 file changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/src/powerpc/sysv.S b/src/powerpc/sysv.S
+index 1474ce7..df97734 100644
+--- a/src/powerpc/sysv.S
++++ b/src/powerpc/sysv.S
+@@ -104,17 +104,16 @@ ENTRY(ffi_call_SYSV)
+ bctrl
+
+ /* Now, deal with the return value. */
+- mtcrf 0x01,%r31 /* cr7 */
++ mtcrf 0x03,%r31 /* cr6-cr7 */
+ bt- 31,L(small_struct_return_value)
+ bt- 30,L(done_return_value)
+ #ifndef __NO_FPRS__
+ bt- 29,L(fp_return_value)
+ #endif
+ stw %r3,0(%r30)
+- bf+ 28,L(done_return_value)
++ bf+ 27,L(done_return_value)
+ stw %r4,4(%r30)
+- mtcrf 0x02,%r31 /* cr6 */
+- bf 27,L(done_return_value)
++ bf 26,L(done_return_value)
+ stw %r5,8(%r30)
+ stw %r6,12(%r30)
+ /* Fall through... */
+@@ -145,10 +144,9 @@ L(done_return_value):
+ #ifndef __NO_FPRS__
+ L(fp_return_value):
+ .cfi_restore_state
+- bf 28,L(float_return_value)
++ bf 27,L(float_return_value)
+ stfd %f1,0(%r30)
+- mtcrf 0x02,%r31 /* cr6 */
+- bf 27,L(done_return_value)
++ bf 26,L(done_return_value)
+ stfd %f2,8(%r30)
+ b L(done_return_value)
+ L(float_return_value):
+--
+2.27.0
+
diff --git a/dev-libs/libffi/libffi-3.3-r2.ebuild b/dev-libs/libffi/libffi-3.3-r2.ebuild
new file mode 100644
index 00000000000..22591c89471
--- /dev/null
+++ b/dev-libs/libffi/libffi-3.3-r2.ebuild
@@ -0,0 +1,88 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+inherit multilib multilib-minimal toolchain-funcs
+
+MY_PV=${PV/_rc/-rc}
+MY_P=${PN}-${MY_PV}
+
+DESCRIPTION="a portable, high level programming interface to various calling conventions"
+HOMEPAGE="https://sourceware.org/libffi/"
+SRC_URI="https://github.com/libffi/libffi/releases/download/v${MY_PV}/${MY_P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0/7" # SONAME=libffi.so.7
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="debug pax_kernel static-libs test +test-bhaible"
+
+RESTRICT="!test? ( test )"
+
+RDEPEND=""
+DEPEND=""
+BDEPEND="test? ( dev-util/dejagnu )"
+
+DOCS="ChangeLog* README.md"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.2.1-o-tmpfile-eacces.patch #529044
+ "${FILESDIR}"/${PN}-3.3_rc0-ppc-macos-go.patch
+ "${FILESDIR}"/${PN}-3.3-power7.patch
+ "${FILESDIR}"/${PN}-3.3-power7-memcpy.patch
+ "${FILESDIR}"/${PN}-3.3-power7-memcpy-2.patch
+ "${FILESDIR}"/${PN}-3.3-ppc-int128.patch
+ "${FILESDIR}"/${PN}-3.3-ppc-vector-offset.patch
+)
+
+S=${WORKDIR}/${MY_P}
+
+ECONF_SOURCE=${S}
+
+pkg_setup() {
+ # Check for orphaned libffi, see https://bugs.gentoo.org/354903 for example
+ if [[ ${ROOT} == "/" && ${EPREFIX} == "" ]] && ! has_version ${CATEGORY}/${PN}; then
+ local base="${T}"/conftest
+ echo 'int main() { }' > "${base}".c
+ $(tc-getCC) -o "${base}" "${base}".c -lffi >&/dev/null
+ if [ $? -eq 0 ]; then
+ eerror "The linker reported linking against -lffi to be working while it shouldn't have."
+ eerror "This is wrong and you should find and delete the old copy of libffi before continuing."
+ die "The system is in inconsistent state with unknown libffi installed."
+ fi
+ fi
+}
+
+src_prepare() {
+ default
+
+ if ! use test-bhaible; then
+ # These tests are very heavyweight (hours of runtime)
+ rm -v testsuite/libffi.bhaible/bhaible.exp || die
+ fi
+}
+
+multilib_src_configure() {
+ use userland_BSD && export HOST="${CHOST}"
+ # --includedir= path maintains a few properties:
+ # 1. have stable name across libffi versions: some packages like
+ # dev-lang/ghc or kde-frameworks/networkmanager-qt embed
+ # ${includedir} at build-time. Don't require those to be
+ # rebuilt unless SONAME changes. bug #695788
+ #
+ # We use /usr/.../${PN} (instead of former /usr/.../${P}).
+ #
+ # 2. have ${ABI}-specific location as ffi.h is target-dependent.
+ #
+ # We use /usr/$(get_libdir)/... to have ABI identifier.
+ econf \
+ --includedir="${EPREFIX}"/usr/$(get_libdir)/${PN}/include \
+ --disable-multi-os-directory \
+ $(use_enable static-libs static) \
+ $(use_enable pax_kernel pax_emutramp) \
+ $(use_enable debug)
+}
+
+multilib_src_install_all() {
+ find "${ED}" -name "*.la" -delete || die
+ einstalldocs
+}
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libffi/, dev-libs/libffi/files/
@ 2022-07-23 19:43 Sam James
0 siblings, 0 replies; 12+ messages in thread
From: Sam James @ 2022-07-23 19:43 UTC (permalink / raw
To: gentoo-commits
commit: 5cf34d9161de963a4cb6db7501799490c7cf5d31
Author: matoro <matoro <AT> users <DOT> noreply <DOT> github <DOT> com>
AuthorDate: Fri Jul 22 23:13:26 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jul 23 19:43:13 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5cf34d91
dev-libs/libffi: revbump 3.4.2-r2, fix ppc64 header defs (backport)
Backports https://github.com/libffi/libffi/pull/722.
Bug: https://github.com/jnr/jffi/issues/107
Closes: https://bugs.gentoo.org/827215
Closes: https://github.com/gentoo/gentoo/pull/26529
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../files/libffi-3.4.2-backport-pr-722.patch | 88 ++++++++++++++++++++++
dev-libs/libffi/libffi-3.4.2-r2.ebuild | 80 ++++++++++++++++++++
2 files changed, 168 insertions(+)
diff --git a/dev-libs/libffi/files/libffi-3.4.2-backport-pr-722.patch b/dev-libs/libffi/files/libffi-3.4.2-backport-pr-722.patch
new file mode 100644
index 000000000000..41821e89140c
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.4.2-backport-pr-722.patch
@@ -0,0 +1,88 @@
+From f4d413725030b35ec2f01733b154489d0b4c6e1d Mon Sep 17 00:00:00 2001
+From: matoro <matoro@users.noreply.github.com>
+Date: Sun, 26 Jun 2022 23:19:00 -0400
+Subject: [PATCH] Move FFI_TYPE definitions above <ffitarget.h> include
+
+For powerpc at least, these definitions are referenced in the
+target-specific ffitarget.h. Discovered in the jffi project. Should
+close https://github.com/libffi/libffi/issues/637. Downstream jffi bug
+https://github.com/jnr/jffi/issues/107. Downstream distro bug
+https://bugs.gentoo.org/827215.
+
+Testing - both libffi and jffi test suites pass with this patch applied,
+at least on ppc64le linux. I did not see any warnings about
+redefinitions.
+
+Tested versions - libffi 3.4.2, jffi 1.3.6 and 1.3.9.
+---
+ include/ffi.h.in | 50 ++++++++++++++++++++++++------------------------
+ 1 file changed, 25 insertions(+), 25 deletions(-)
+
+diff --git a/include/ffi.h.in b/include/ffi.h.in
+index d16f307e..6cd19baa 100644
+--- a/include/ffi.h.in
++++ b/include/ffi.h.in
+@@ -56,6 +56,31 @@ extern "C" {
+
+ /* ---- System configuration information --------------------------------- */
+
++/* If these change, update src/mips/ffitarget.h. */
++#define FFI_TYPE_VOID 0
++#define FFI_TYPE_INT 1
++#define FFI_TYPE_FLOAT 2
++#define FFI_TYPE_DOUBLE 3
++#if @HAVE_LONG_DOUBLE@
++#define FFI_TYPE_LONGDOUBLE 4
++#else
++#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
++#endif
++#define FFI_TYPE_UINT8 5
++#define FFI_TYPE_SINT8 6
++#define FFI_TYPE_UINT16 7
++#define FFI_TYPE_SINT16 8
++#define FFI_TYPE_UINT32 9
++#define FFI_TYPE_SINT32 10
++#define FFI_TYPE_UINT64 11
++#define FFI_TYPE_SINT64 12
++#define FFI_TYPE_STRUCT 13
++#define FFI_TYPE_POINTER 14
++#define FFI_TYPE_COMPLEX 15
++
++/* This should always refer to the last type code (for sanity checks). */
++#define FFI_TYPE_LAST FFI_TYPE_COMPLEX
++
+ #include <ffitarget.h>
+
+ #ifndef LIBFFI_ASM
+@@ -496,31 +521,6 @@ ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type,
+
+ #endif
+
+-/* If these change, update src/mips/ffitarget.h. */
+-#define FFI_TYPE_VOID 0
+-#define FFI_TYPE_INT 1
+-#define FFI_TYPE_FLOAT 2
+-#define FFI_TYPE_DOUBLE 3
+-#if @HAVE_LONG_DOUBLE@
+-#define FFI_TYPE_LONGDOUBLE 4
+-#else
+-#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
+-#endif
+-#define FFI_TYPE_UINT8 5
+-#define FFI_TYPE_SINT8 6
+-#define FFI_TYPE_UINT16 7
+-#define FFI_TYPE_SINT16 8
+-#define FFI_TYPE_UINT32 9
+-#define FFI_TYPE_SINT32 10
+-#define FFI_TYPE_UINT64 11
+-#define FFI_TYPE_SINT64 12
+-#define FFI_TYPE_STRUCT 13
+-#define FFI_TYPE_POINTER 14
+-#define FFI_TYPE_COMPLEX 15
+-
+-/* This should always refer to the last type code (for sanity checks). */
+-#define FFI_TYPE_LAST FFI_TYPE_COMPLEX
+-
+ #ifdef __cplusplus
+ }
+ #endif
diff --git a/dev-libs/libffi/libffi-3.4.2-r2.ebuild b/dev-libs/libffi/libffi-3.4.2-r2.ebuild
new file mode 100644
index 000000000000..920e5b422175
--- /dev/null
+++ b/dev-libs/libffi/libffi-3.4.2-r2.ebuild
@@ -0,0 +1,80 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit multilib-minimal preserve-libs
+
+MY_PV=${PV/_rc/-rc}
+MY_P=${PN}-${MY_PV}
+
+DESCRIPTION="a portable, high level programming interface to various calling conventions"
+HOMEPAGE="https://sourceware.org/libffi/"
+SRC_URI="https://github.com/libffi/libffi/releases/download/v${MY_PV}/${MY_P}.tar.gz
+ experimental-loong? ( https://dev.gentoo.org/~xen0n/distfiles/${MY_P}-loongarch64-20220428.patch.xz )"
+S="${WORKDIR}"/${MY_P}
+
+LICENSE="MIT"
+# This is a core package which is depended on by e.g. Python
+# Please use preserve-libs.eclass in pkg_{pre,post}inst to cover users
+# with FEATURES="-preserved-libs" or another package manager if SONAME
+# changes.
+SLOT="0/8" # SONAME=libffi.so.8
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="debug exec-static-trampoline experimental-loong pax-kernel static-libs test"
+
+RESTRICT="!test? ( test )"
+BDEPEND="test? ( dev-util/dejagnu )"
+
+DOCS="ChangeLog* README.md"
+
+ECONF_SOURCE=${S}
+
+PATCHES=( "${FILESDIR}/libffi-3.4.2-backport-pr-722.patch" ) # bug 827215
+
+src_prepare() {
+ if use experimental-loong; then
+ PATCHES+=( "${WORKDIR}/${MY_P}-loongarch64-20220428.patch" )
+ fi
+
+ default
+ if [[ ${CHOST} == arm64-*-darwin* ]] ; then
+ # ensure we use aarch64 asm, not x86 on arm64
+ sed -i -e 's/aarch64\*-\*-\*/arm64*-*-*|&/' \
+ configure configure.host || die
+ fi
+}
+
+multilib_src_configure() {
+ # --includedir= path maintains a few properties:
+ # 1. have stable name across libffi versions: some packages like
+ # dev-lang/ghc or kde-frameworks/networkmanager-qt embed
+ # ${includedir} at build-time. Don't require those to be
+ # rebuilt unless SONAME changes. bug #695788
+ #
+ # We use /usr/.../${PN} (instead of former /usr/.../${P}).
+ #
+ # 2. have ${ABI}-specific location as ffi.h is target-dependent.
+ #
+ # We use /usr/$(get_libdir)/... to have ABI identifier.
+ econf \
+ --includedir="${EPREFIX}"/usr/$(get_libdir)/${PN}/include \
+ --disable-multi-os-directory \
+ $(use_enable static-libs static) \
+ $(use_enable exec-static-trampoline exec-static-tramp) \
+ $(use_enable pax-kernel pax_emutramp) \
+ $(use_enable debug)
+}
+
+multilib_src_install_all() {
+ find "${ED}" -name "*.la" -delete || die
+ einstalldocs
+}
+
+pkg_preinst() {
+ preserve_old_lib /usr/$(get_libdir)/libffi.so.7
+}
+
+pkg_postinst() {
+ preserve_old_lib_notify /usr/$(get_libdir)/libffi.so.7
+}
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libffi/, dev-libs/libffi/files/
@ 2023-10-19 19:48 Sam James
0 siblings, 0 replies; 12+ messages in thread
From: Sam James @ 2023-10-19 19:48 UTC (permalink / raw
To: gentoo-commits
commit: a24d0c4442a09fd9b15e538035a7fa317fc0ca73
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 19 19:47:20 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Oct 19 19:48:18 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a24d0c44
dev-libs/libffi: update EAPI 7 -> 8; fix float args on sparc
This fixes the gjs test suite on sparc. Tests continue to pass on libffi
and gjs tests now completely pass (previously GIMarshalling failed). The fix
is obvious so I don't see much of a need to wait until it's merged upstream,
and it only affects sparc.
Bug: https://github.com/libffi/libffi/issues/778
Closes: https://bugs.gentoo.org/882071
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../files/libffi-3.4.4-sparc-float-typo.patch | 28 ++++++++
dev-libs/libffi/libffi-3.4.4-r2.ebuild | 77 ++++++++++++++++++++++
2 files changed, 105 insertions(+)
diff --git a/dev-libs/libffi/files/libffi-3.4.4-sparc-float-typo.patch b/dev-libs/libffi/files/libffi-3.4.4-sparc-float-typo.patch
new file mode 100644
index 000000000000..3768df62df9f
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.4.4-sparc-float-typo.patch
@@ -0,0 +1,28 @@
+https://github.com/libffi/libffi/issues/778
+https://bugs.gentoo.org/882071
+
+Fix incorrect type for passing floats. Thanks to Petr Sumbera and Richard Henderson
+for figuring it out on the upstream bug.
+--- a/src/sparc/ffi64.c
++++ b/src/sparc/ffi64.c
+@@ -382,13 +382,19 @@ ffi_prep_args_v9(ffi_cif *cif, unsigned long *argp, void *rvalue, void **avalue)
+ *argp++ = *(SINT32 *)a;
+ break;
+ case FFI_TYPE_UINT32:
+- case FFI_TYPE_FLOAT:
+ *argp++ = *(UINT32 *)a;
+ break;
+ case FFI_TYPE_SINT64:
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_POINTER:
++ *argp++ = *(UINT64 *)a;
++ break;
++ case FFI_TYPE_FLOAT:
++ flags |= SPARC_FLAG_FP_ARGS;
++ *argp++ = *(UINT32 *)a;
++ break;
+ case FFI_TYPE_DOUBLE:
++ flags |= SPARC_FLAG_FP_ARGS;
+ *argp++ = *(UINT64 *)a;
+ break;
+
diff --git a/dev-libs/libffi/libffi-3.4.4-r2.ebuild b/dev-libs/libffi/libffi-3.4.4-r2.ebuild
new file mode 100644
index 000000000000..63367bd2fe39
--- /dev/null
+++ b/dev-libs/libffi/libffi-3.4.4-r2.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit multilib-minimal preserve-libs
+
+MY_PV=${PV/_rc/-rc}
+MY_P=${PN}-${MY_PV}
+
+DESCRIPTION="Portable, high level programming interface to various calling conventions"
+HOMEPAGE="https://sourceware.org/libffi/"
+SRC_URI="https://github.com/libffi/libffi/releases/download/v${MY_PV}/${MY_P}.tar.gz"
+S="${WORKDIR}"/${MY_P}
+
+LICENSE="MIT"
+# This is a core package which is depended on by e.g. Python
+# Please use preserve-libs.eclass in pkg_{pre,post}inst to cover users
+# with FEATURES="-preserved-libs" or another package manager if SONAME
+# changes.
+SLOT="0/8" # SONAME=libffi.so.8
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+IUSE="debug exec-static-trampoline pax-kernel static-libs test"
+
+RESTRICT="!test? ( test )"
+BDEPEND="test? ( dev-util/dejagnu )"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-hppa-large-struct.patch
+ "${FILESDIR}"/${P}-hppa-closure-function-ptrs.patch
+ "${FILESDIR}"/${P}-hppa-jump-table.patch
+ "${FILESDIR}"/${PN}-3.4.4-sparc-float-typo.patch
+)
+
+src_prepare() {
+ default
+
+ if [[ ${CHOST} == arm64-*-darwin* ]] ; then
+ # ensure we use aarch64 asm, not x86 on arm64
+ sed -i -e 's/aarch64\*-\*-\*/arm64*-*-*|&/' \
+ configure configure.host || die
+ fi
+}
+
+multilib_src_configure() {
+ # --includedir= path maintains a few properties:
+ # 1. have stable name across libffi versions: some packages like
+ # dev-lang/ghc or kde-frameworks/networkmanager-qt embed
+ # ${includedir} at build-time. Don't require those to be
+ # rebuilt unless SONAME changes. bug #695788
+ #
+ # We use /usr/.../${PN} (instead of former /usr/.../${P}).
+ #
+ # 2. have ${ABI}-specific location as ffi.h is target-dependent.
+ #
+ # We use /usr/$(get_libdir)/... to have ABI identifier.
+ ECONF_SOURCE="${S}" econf \
+ --includedir="${EPREFIX}"/usr/$(get_libdir)/${PN}/include \
+ --disable-multi-os-directory \
+ $(use_enable static-libs static) \
+ $(use_enable exec-static-trampoline exec-static-tramp) \
+ $(use_enable pax-kernel pax_emutramp) \
+ $(use_enable debug)
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ find "${ED}" -name "*.la" -delete || die
+}
+
+pkg_preinst() {
+ preserve_old_lib /usr/$(get_libdir)/libffi.so.7
+}
+
+pkg_postinst() {
+ preserve_old_lib_notify /usr/$(get_libdir)/libffi.so.7
+}
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libffi/, dev-libs/libffi/files/
@ 2023-12-13 1:54 Sam James
0 siblings, 0 replies; 12+ messages in thread
From: Sam James @ 2023-12-13 1:54 UTC (permalink / raw
To: gentoo-commits
commit: 6f1da16cf19f06d8a7930165976a0b7c1d76262e
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 13 01:53:21 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec 13 01:53:21 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6f1da16c
dev-libs/libffi: backport lld 17 fix
Closes: https://bugs.gentoo.org/915086
Bug: https://bugs.gentoo.org/912034
Signed-off-by: Sam James <sam <AT> gentoo.org>
dev-libs/libffi/files/libffi-3.4.4-lld-17.patch | 34 ++++++++++
dev-libs/libffi/libffi-3.4.4-r3.ebuild | 82 +++++++++++++++++++++++++
2 files changed, 116 insertions(+)
diff --git a/dev-libs/libffi/files/libffi-3.4.4-lld-17.patch b/dev-libs/libffi/files/libffi-3.4.4-lld-17.patch
new file mode 100644
index 000000000000..8e87814b23bf
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.4.4-lld-17.patch
@@ -0,0 +1,34 @@
+https://bugs.gentoo.org/915086
+https://github.com/libffi/libffi/pull/800
+
+From 65f6869fd74630a9252ef89971b725b921f17061 Mon Sep 17 00:00:00 2001
+From: Alfred Wingate <parona@protonmail.com>
+Date: Tue, 10 Oct 2023 06:32:02 +0300
+Subject: [PATCH] Put optional symbols behind ifdefs
+
+Signed-off-by: Alfred Wingate <parona@protonmail.com>
+--- a/libffi.map.in
++++ b/libffi.map.in
+@@ -33,7 +33,10 @@ LIBFFI_BASE_8.0 {
+ ffi_raw_to_ptrarray;
+ ffi_raw_size;
+
++#if !FFI_NATIVE_RAW_API
+ ffi_java_raw_call;
++#endif
++
+ ffi_java_ptrarray_to_raw;
+ ffi_java_raw_to_ptrarray;
+ ffi_java_raw_size;
+@@ -62,8 +65,10 @@ LIBFFI_CLOSURE_8.0 {
+ ffi_prep_closure_loc;
+ ffi_prep_raw_closure;
+ ffi_prep_raw_closure_loc;
++#if !FFI_NATIVE_RAW_API
+ ffi_prep_java_raw_closure;
+ ffi_prep_java_raw_closure_loc;
++#endif
+ } LIBFFI_BASE_8.0;
+ #endif
+
+
diff --git a/dev-libs/libffi/libffi-3.4.4-r3.ebuild b/dev-libs/libffi/libffi-3.4.4-r3.ebuild
new file mode 100644
index 000000000000..d2f584049789
--- /dev/null
+++ b/dev-libs/libffi/libffi-3.4.4-r3.ebuild
@@ -0,0 +1,82 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit multilib-minimal preserve-libs
+
+MY_PV=${PV/_rc/-rc}
+MY_P=${PN}-${MY_PV}
+
+DESCRIPTION="Portable, high level programming interface to various calling conventions"
+HOMEPAGE="https://sourceware.org/libffi/"
+SRC_URI="https://github.com/libffi/libffi/releases/download/v${MY_PV}/${MY_P}.tar.gz"
+S="${WORKDIR}"/${MY_P}
+
+LICENSE="MIT"
+# This is a core package which is depended on by e.g. Python
+# Please use preserve-libs.eclass in pkg_{pre,post}inst to cover users
+# with FEATURES="-preserved-libs" or another package manager if SONAME
+# changes.
+SLOT="0/8" # SONAME=libffi.so.8
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+IUSE="debug exec-static-trampoline pax-kernel static-libs test"
+
+RESTRICT="!test? ( test )"
+BDEPEND="test? ( dev-util/dejagnu )"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-hppa-large-struct.patch
+ "${FILESDIR}"/${P}-hppa-closure-function-ptrs.patch
+ "${FILESDIR}"/${P}-hppa-jump-table.patch
+ "${FILESDIR}"/${P}-sparc-float-typo.patch
+ "${FILESDIR}"/${P}-lld-17.patch
+)
+
+src_prepare() {
+ default
+
+ if [[ ${CHOST} == arm64-*-darwin* ]] ; then
+ # ensure we use aarch64 asm, not x86 on arm64
+ sed -i -e 's/aarch64\*-\*-\*/arm64*-*-*|&/' \
+ configure configure.host || die
+ fi
+}
+
+multilib_src_configure() {
+ # --includedir= path maintains a few properties:
+ # 1. have stable name across libffi versions: some packages like
+ # dev-lang/ghc or kde-frameworks/networkmanager-qt embed
+ # ${includedir} at build-time. Don't require those to be
+ # rebuilt unless SONAME changes. bug #695788
+ #
+ # We use /usr/.../${PN} (instead of former /usr/.../${P}).
+ #
+ # 2. have ${ABI}-specific location as ffi.h is target-dependent.
+ #
+ # We use /usr/$(get_libdir)/... to have ABI identifier.
+ ECONF_SOURCE="${S}" econf \
+ --includedir="${EPREFIX}"/usr/$(get_libdir)/${PN}/include \
+ --disable-multi-os-directory \
+ $(use_enable static-libs static) \
+ $(use_enable exec-static-trampoline exec-static-tramp) \
+ $(use_enable pax-kernel pax_emutramp) \
+ $(use_enable debug)
+}
+
+multilib_src_test() {
+ emake -Onone check
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ find "${ED}" -name "*.la" -delete || die
+}
+
+pkg_preinst() {
+ preserve_old_lib /usr/$(get_libdir)/libffi.so.7
+}
+
+pkg_postinst() {
+ preserve_old_lib_notify /usr/$(get_libdir)/libffi.so.7
+}
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libffi/, dev-libs/libffi/files/
@ 2024-10-16 3:28 Sam James
0 siblings, 0 replies; 12+ messages in thread
From: Sam James @ 2024-10-16 3:28 UTC (permalink / raw
To: gentoo-commits
commit: 662133e23b6925c1d1adf830f3650a9ddabb92de
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 16 03:22:09 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Oct 16 03:27:35 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=662133e2
dev-libs/libffi: backport further patches (arm64 + BTI/PAC, ASAN)
I should've done this earlier in -r1 but I equivocated.
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../files/libffi-3.4.6-arm64-bti-spelling.patch | 26 ++
dev-libs/libffi/files/libffi-3.4.6-arm64-bti.patch | 81 +++++
.../files/libffi-3.4.6-arm64-fix-build.patch | 36 +++
.../files/libffi-3.4.6-arm64-support-pac.patch | 332 +++++++++++++++++++++
dev-libs/libffi/files/libffi-3.4.6-asan.patch | 88 ++++++
.../files/libffi-3.4.6-regenerate-autotools.patch | 48 +++
dev-libs/libffi/libffi-3.4.6-r2.ebuild | 94 ++++++
7 files changed, 705 insertions(+)
diff --git a/dev-libs/libffi/files/libffi-3.4.6-arm64-bti-spelling.patch b/dev-libs/libffi/files/libffi-3.4.6-arm64-bti-spelling.patch
new file mode 100644
index 000000000000..2a06292546d0
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.4.6-arm64-bti-spelling.patch
@@ -0,0 +1,26 @@
+https://github.com/libffi/libffi/commit/38732240c125b6af9db66d940c0725a69292cc49
+
+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] ffi: fix spelling mistake (#833)
+
+Signed-off-by: Bill Roberts <bill.roberts@arm.com>
+---
+ 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 8661a352..b13738e3 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;
+
diff --git a/dev-libs/libffi/files/libffi-3.4.6-arm64-bti.patch b/dev-libs/libffi/files/libffi-3.4.6-arm64-bti.patch
new file mode 100644
index 000000000000..66dc9f181b79
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.4.6-arm64-bti.patch
@@ -0,0 +1,81 @@
+https://github.com/libffi/libffi/commit/f64141ee3f9e455a060bd09e9ab72b6c94653d7c
+
+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] Fix bti support (#830)
+
+* 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 <bill.roberts@arm.com>
+
+* testsuite: fix whitespace in Makefile.am
+
+Signed-off-by: Bill Roberts <bill.roberts@arm.com>
+
+* 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 <bill.roberts@arm.com>
+
+---------
+
+Signed-off-by: Bill Roberts <bill.roberts@arm.com>
+---
+ 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 fdd0e8b7..60cfa505 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 d286cf7f..6ba98e12 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 \
+
diff --git a/dev-libs/libffi/files/libffi-3.4.6-arm64-fix-build.patch b/dev-libs/libffi/files/libffi-3.4.6-arm64-fix-build.patch
new file mode 100644
index 000000000000..20eaf6a2d8cd
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.4.6-arm64-fix-build.patch
@@ -0,0 +1,36 @@
+https://github.com/libffi/libffi/commit/9c9e8368e49804c4f7c35ac9f0d7c1d0d533308b
+
+From 9c9e8368e49804c4f7c35ac9f0d7c1d0d533308b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
+Date: Tue, 4 Jun 2024 14:13:08 +0300
+Subject: [PATCH] aarch64: Add a missing no-op define of SIGN_LR_LINUX_ONLY
+ (#838)
+
+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 c39f9cb2..50fa5c13 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 */
+
diff --git a/dev-libs/libffi/files/libffi-3.4.6-arm64-support-pac.patch b/dev-libs/libffi/files/libffi-3.4.6-arm64-support-pac.patch
new file mode 100644
index 000000000000..288533367499
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.4.6-arm64-support-pac.patch
@@ -0,0 +1,332 @@
+https://github.com/libffi/libffi/commit/45d284f2d066cc3a080c5be88e51b4d934349797
+
+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] aarch64: support pointer authentication (#834)
+
+* 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 <bill.roberts@arm.com>
+
+* 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 <bill.roberts@arm.com>
+
+* 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 <bill.roberts@arm.com>
+
+* 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 <bill.roberts@arm.com>
+
+---------
+
+Signed-off-by: Bill Roberts <bill.roberts@arm.com>
+---
+ 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 816bfd666..b35a999fb 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 f4c292d00..856566324 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 b13738e38..964934dfb 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 <ptrauth.h>
+ #endif
+ #include <mach/vm_param.h>
+@@ -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 b5d102b4a..c39f9cb22 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 60cfa505b..6a9a5611f 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 67a94a822..02cf78fa2 100644
+--- a/src/closures.c
++++ b/src/closures.c
+@@ -164,7 +164,7 @@ ffi_tramp_is_present (__attribute__((unused)) void *ptr)
+
+ #include <mach/mach.h>
+ #include <pthread.h>
+-#ifdef HAVE_PTRAUTH
++#ifdef HAVE_ARM64E_PTRAUTH
+ #include <ptrauth.h>
+ #endif
+ #include <stdio.h>
+@@ -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
+
+
diff --git a/dev-libs/libffi/files/libffi-3.4.6-asan.patch b/dev-libs/libffi/files/libffi-3.4.6-asan.patch
new file mode 100644
index 000000000000..4c62f970a3c9
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.4.6-asan.patch
@@ -0,0 +1,88 @@
+https://github.com/libffi/libffi/commit/01db744b4af8665f9b7494d00cc2a1cc45ee9636
+
+From 01db744b4af8665f9b7494d00cc2a1cc45ee9636 Mon Sep 17 00:00:00 2001
+From: KJ Tsanaktsidis <kj@kjtsanaktsidis.id.au>
+Date: Fri, 20 Sep 2024 20:00:49 +1000
+Subject: [PATCH] Disable ASAN in ffi_call_int functions (#858)
+
+The pattern for several of the architectures is for ffi_call_int to
+stack-allocate some arguments + the registers, and then
+ffi_call_$ARCH will pop the top of that structure into registers, and
+then adjust the stack pointer such that the alloca'd buffer _becomes_
+the stack-passed arguments for the function being called.
+
+If libffi is compiled with ASAN, then there will be a redzone inserted
+after the alloca'd buffer which is marked as poisoned. This redzone
+appears beyond the end of $sp upon entry to the called function.
+
+If the called function does anything to use this stack memory, ASAN will
+notice that it's poisoned and report an error.
+
+This commit fixes the situation (on the architectures that I have access
+to) disabling instrumentation for ffi_call_int; that means there will be
+no alloca redzone left on the shadow-stack.
+--- a/include/ffi_common.h
++++ b/include/ffi_common.h
+@@ -83,6 +83,23 @@ char *alloca ();
+ #include <stdio.h>
+ #endif
+
++#ifndef __SANITIZE_ADDRESS__
++# ifdef __clang__
++# if __has_feature(address_sanitizer)
++# define FFI_ASAN
++# endif
++# endif
++#endif
++#ifdef __SANITIZE_ADDRESS__
++#define FFI_ASAN
++#endif
++
++#ifdef FFI_ASAN
++#define FFI_ASAN_NO_SANITIZE __attribute__((no_sanitize_address))
++#else
++#define FFI_ASAN_NO_SANITIZE
++#endif
++
+ #ifdef FFI_DEBUG
+ NORETURN void ffi_assert(const char *expr, const char *file, int line);
+ void ffi_stop_here(void);
+--- a/src/aarch64/ffi.c
++++ b/src/aarch64/ffi.c
+@@ -645,7 +645,10 @@ extern void ffi_call_SYSV (struct call_context *context, void *frame,
+ void *closure) FFI_HIDDEN;
+
+ /* Call a function with the provided arguments and capture the return
+- value. */
++ value.
++ n.b. ffi_call_SYSV will steal the alloca'd `stack` variable here for use
++ _as its own stack_ - so we need to compile this function without ASAN */
++FFI_ASAN_NO_SANITIZE
+ static void
+ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
+ void **avalue, void *closure)
+--- a/src/x86/ffi.c
++++ b/src/x86/ffi.c
+@@ -270,6 +270,9 @@ extern void FFI_DECLARE_FASTCALL ffi_call_i386(struct call_frame *, char *) FFI_
+ #if defined(_MSC_VER)
+ #pragma runtime_checks("s", off)
+ #endif
++/* n.b. ffi_call_unix64 will steal the alloca'd `stack` variable here for use
++ _as its own stack_ - so we need to compile this function without ASAN */
++FFI_ASAN_NO_SANITIZE
+ static void
+ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue,
+ void **avalue, void *closure)
+--- a/src/x86/ffi64.c
++++ b/src/x86/ffi64.c
+@@ -557,6 +557,9 @@ ffi_prep_cif_machdep (ffi_cif *cif)
+ return FFI_OK;
+ }
+
++/* n.b. ffi_call_unix64 will steal the alloca'd `stack` variable here for use
++ _as its own stack_ - so we need to compile this function without ASAN */
++FFI_ASAN_NO_SANITIZE
+ static void
+ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue,
+ void **avalue, void *closure)
+
diff --git a/dev-libs/libffi/files/libffi-3.4.6-regenerate-autotools.patch b/dev-libs/libffi/files/libffi-3.4.6-regenerate-autotools.patch
new file mode 100644
index 000000000000..81fe671f509c
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.4.6-regenerate-autotools.patch
@@ -0,0 +1,48 @@
+The arm64 patches we backported to 3.4.6 mean we need to autoreconf ourselves,
+apply this patch to avoid needing to do it in the ebuild b/c of deps.
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -330,8 +330,8 @@ am__define_uniq_tagged_files = \
+ done | $(am__uniquify_input)`
+ DIST_SUBDIRS = include testsuite man doc
+ am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/fficonfig.h.in \
+- $(srcdir)/libffi.pc.in README.md compile config.guess \
+- config.sub depcomp install-sh ltmain.sh missing
++ $(srcdir)/libffi.pc.in ChangeLog README.md compile \
++ config.guess config.sub depcomp install-sh ltmain.sh missing
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ distdir = $(PACKAGE)-$(VERSION)
+ top_distdir = $(distdir)
+--- a/fficonfig.h.in
++++ b/fficonfig.h.in
+@@ -31,6 +31,9 @@
+ /* Define to 1 if you have the <alloca.h> header file. */
+ #undef HAVE_ALLOCA_H
+
++/* Define if your compiler supports pointer authentication. */
++#undef HAVE_ARM64E_PTRAUTH
++
+ /* Define if your assembler supports .cfi_* directives. */
+ #undef HAVE_AS_CFI_PSEUDO_OP
+
+@@ -71,9 +74,6 @@
+ /* Define to 1 if you have the `memfd_create' function. */
+ #undef HAVE_MEMFD_CREATE
+
+-/* Define if your compiler supports pointer authentication. */
+-#undef HAVE_PTRAUTH
+-
+ /* Define if .eh_frame sections should be read-only. */
+ #undef HAVE_RO_EH_FRAME
+
+--- a/testsuite/Makefile.in
++++ b/testsuite/Makefile.in
+@@ -292,7 +292,7 @@ EXTRA_DEJAGNU_SITE_CONFIG = ../local.exp
+ 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 \
diff --git a/dev-libs/libffi/libffi-3.4.6-r2.ebuild b/dev-libs/libffi/libffi-3.4.6-r2.ebuild
new file mode 100644
index 000000000000..bf85a9e552da
--- /dev/null
+++ b/dev-libs/libffi/libffi-3.4.6-r2.ebuild
@@ -0,0 +1,94 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit multilib-minimal preserve-libs
+
+MY_PV=${PV/_rc/-rc}
+MY_P=${PN}-${MY_PV}
+
+DESCRIPTION="Portable, high level programming interface to various calling conventions"
+HOMEPAGE="https://sourceware.org/libffi/"
+
+if [[ ${PV} == 9999 ]] ; then
+ EGIT_REPO_URI="https://github.com/libffi/libffi"
+ inherit git-r3
+else
+ SRC_URI="https://github.com/libffi/libffi/releases/download/v${MY_PV}/${MY_P}.tar.gz"
+
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+fi
+
+S="${WORKDIR}"/${MY_P}
+
+LICENSE="MIT"
+# This is a core package which is depended on by e.g. Python.
+# Please use preserve-libs.eclass in pkg_{pre,post}inst to cover users
+# with FEATURES="-preserved-libs" or another package manager if SONAME changes.
+SLOT="0/8" # SONAME=libffi.so.8
+IUSE="debug exec-static-trampoline pax-kernel static-libs test"
+
+RESTRICT="!test? ( test )"
+BDEPEND="test? ( dev-util/dejagnu )"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-arm64-bti.patch
+ "${FILESDIR}"/${P}-arm64-bti-spelling.patch
+ "${FILESDIR}"/${P}-arm64-support-pac.patch
+ "${FILESDIR}"/${P}-arm64-fix-build.patch
+ "${FILESDIR}"/${P}-sparc-struct-targs.patch
+ "${FILESDIR}"/${P}-test-typo.patch
+ "${FILESDIR}"/${P}-x86-sse.patch
+ "${FILESDIR}"/${P}-arm64-cfi.patch
+ "${FILESDIR}"/${P}-asan.patch
+ "${FILESDIR}"/${P}-regenerate-autotools.patch
+)
+
+src_prepare() {
+ default
+
+ if [[ ${CHOST} == arm64-*-darwin* ]] ; then
+ # ensure we use aarch64 asm, not x86 on arm64
+ sed -i -e 's/aarch64\*-\*-\*/arm64*-*-*|&/' \
+ configure configure.host || die
+ fi
+}
+
+multilib_src_configure() {
+ # --includedir= path maintains a few properties:
+ # 1. have stable name across libffi versions: some packages like
+ # dev-lang/ghc or kde-frameworks/networkmanager-qt embed
+ # ${includedir} at build-time. Don't require those to be
+ # rebuilt unless SONAME changes. bug #695788
+ #
+ # We use /usr/.../${PN} (instead of former /usr/.../${P}).
+ #
+ # 2. have ${ABI}-specific location as ffi.h is target-dependent.
+ #
+ # We use /usr/$(get_libdir)/... to have ABI identifier.
+ ECONF_SOURCE="${S}" econf \
+ --includedir="${EPREFIX}"/usr/$(get_libdir)/${PN}/include \
+ --disable-multi-os-directory \
+ $(use_enable static-libs static) \
+ $(use_enable exec-static-trampoline exec-static-tramp) \
+ $(use_enable pax-kernel pax_emutramp) \
+ $(use_enable debug)
+}
+
+multilib_src_test() {
+ emake -Onone check
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ find "${ED}" -name "*.la" -delete || die
+}
+
+pkg_preinst() {
+ preserve_old_lib /usr/$(get_libdir)/libffi.so.7
+}
+
+pkg_postinst() {
+ preserve_old_lib_notify /usr/$(get_libdir)/libffi.so.7
+}
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libffi/, dev-libs/libffi/files/
@ 2024-10-16 4:34 Sam James
0 siblings, 0 replies; 12+ messages in thread
From: Sam James @ 2024-10-16 4:34 UTC (permalink / raw
To: gentoo-commits
commit: 1074f63fc8c1341b01c09c32c4855beb1a9dac67
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 16 04:33:19 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Oct 16 04:33:19 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1074f63f
dev-libs/libffi: backport test fixes
This fixes some issues w/ the test added in 6521e1f5d4cceb00f082def621d7e28b7788b7f5.
Signed-off-by: Sam James <sam <AT> gentoo.org>
dev-libs/libffi/files/libffi-3.4.6-tests.patch | 104 +++++++++++++++++++++++++
dev-libs/libffi/libffi-3.4.6-r2.ebuild | 1 +
2 files changed, 105 insertions(+)
diff --git a/dev-libs/libffi/files/libffi-3.4.6-tests.patch b/dev-libs/libffi/files/libffi-3.4.6-tests.patch
new file mode 100644
index 000000000000..e24d01f4c028
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.4.6-tests.patch
@@ -0,0 +1,104 @@
+https://github.com/libffi/libffi/commit/efb98a72d8b9bdb71b4f972efced073bee3b30fc
+https://github.com/libffi/libffi/commit/92d384df196a099fde384f9178864dbfe8c6b0fc
+
+From efb98a72d8b9bdb71b4f972efced073bee3b30fc Mon Sep 17 00:00:00 2001
+From: Anthony Green <green@moxielogic.com>
+Date: Sun, 15 Sep 2024 07:31:33 -0400
+Subject: [PATCH] Robustify floating point comparison in test
+
+---
+ testsuite/libffi.call/struct_int_float.c | 24 ++++++++++++------------
+ 1 file changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/testsuite/libffi.call/struct_int_float.c b/testsuite/libffi.call/struct_int_float.c
+index dab1d1fed..82685814c 100644
+--- a/testsuite/libffi.call/struct_int_float.c
++++ b/testsuite/libffi.call/struct_int_float.c
+@@ -54,35 +54,35 @@ int main (void)
+ values[4] = &ts_arg[4];
+ args[5] = &ts_type;
+ values[5] = &ts_arg[5];
+-
++
+ /* Initialize the cif */
+ CHECK(ffi_prep_cif(&cif, ABI_NUM, 6, &ffi_type_float, args) == FFI_OK);
+-
++
+ ts_arg[0].i = 1;
+- ts_arg[0].f = 1.11f;
++ ts_arg[0].f = 11.11f;
+ ts_arg[1].i = 2;
+- ts_arg[1].f = 2.22f;
++ ts_arg[1].f = 22.22f;
+ ts_arg[2].i = 3;
+- ts_arg[2].f = 3.33f;
++ ts_arg[2].f = 33.33f;
+ ts_arg[3].i = 4;
+- ts_arg[3].f = 4.44f;
++ ts_arg[3].f = 44.44f;
+ ts_arg[4].i = 5;
+- ts_arg[4].f = 5.55f;
++ ts_arg[4].f = 55.55f;
+ ts_arg[5].i = 6;
+- ts_arg[5].f = 6.66f;
+-
++ ts_arg[5].f = 66.66f;
++
+ printf ("%g\n", ts_arg[0].f);
+ printf ("%g\n", ts_arg[1].f);
+ printf ("%g\n", ts_arg[2].f);
+ printf ("%g\n", ts_arg[3].f);
+ printf ("%g\n", ts_arg[4].f);
+ printf ("%g\n", ts_arg[5].f);
+-
++
+ ffi_call(&cif, FFI_FN(struct_int_float), &rfloat, values);
+
+ printf ("%g\n", rfloat);
+-
+- CHECK(rfloat == 1.11f);
++
++ CHECK(fabs(rfloat - 11.11) < FLT_EPSILON);
+
+ exit(0);
+ }
+
+From 92d384df196a099fde384f9178864dbfe8c6b0fc Mon Sep 17 00:00:00 2001
+From: Anthony Green <green@moxielogic.com>
+Date: Sun, 15 Sep 2024 12:32:29 -0400
+Subject: [PATCH] Fix floating point compare
+
+---
+ testsuite/libffi.call/struct_int_float.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/testsuite/libffi.call/struct_int_float.c b/testsuite/libffi.call/struct_int_float.c
+index 82685814..66ef6c45 100644
+--- a/testsuite/libffi.call/struct_int_float.c
++++ b/testsuite/libffi.call/struct_int_float.c
+@@ -14,11 +14,11 @@ typedef struct
+ } test_structure_int_float;
+
+ static float ABI_ATTR struct_int_float(test_structure_int_float ts1,
+- test_structure_int_float ts2,
+- test_structure_int_float ts3,
+- test_structure_int_float ts4,
+- test_structure_int_float ts5,
+- test_structure_int_float ts6)
++ test_structure_int_float ts2 __UNUSED__,
++ test_structure_int_float ts3 __UNUSED__,
++ test_structure_int_float ts4 __UNUSED__,
++ test_structure_int_float ts5 __UNUSED__,
++ test_structure_int_float ts6 __UNUSED__)
+ {
+ return ts1.f;
+ }
+@@ -82,7 +82,7 @@ int main (void)
+
+ printf ("%g\n", rfloat);
+
+- CHECK(fabs(rfloat - 11.11) < FLT_EPSILON);
++ CHECK(fabs(rfloat - 11.11) < 3 * FLT_EPSILON);
+
+ exit(0);
+ }
diff --git a/dev-libs/libffi/libffi-3.4.6-r2.ebuild b/dev-libs/libffi/libffi-3.4.6-r2.ebuild
index bf85a9e552da..2235dc0d702f 100644
--- a/dev-libs/libffi/libffi-3.4.6-r2.ebuild
+++ b/dev-libs/libffi/libffi-3.4.6-r2.ebuild
@@ -42,6 +42,7 @@ PATCHES=(
"${FILESDIR}"/${P}-x86-sse.patch
"${FILESDIR}"/${P}-arm64-cfi.patch
"${FILESDIR}"/${P}-asan.patch
+ "${FILESDIR}"/${P}-tests.patch
"${FILESDIR}"/${P}-regenerate-autotools.patch
)
^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2024-10-16 4:34 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-06 13:03 [gentoo-commits] repo/gentoo:master commit in: dev-libs/libffi/, dev-libs/libffi/files/ Sergei Trofimovich
-- strict thread matches above, loose matches on Subject: below --
2024-10-16 4:34 Sam James
2024-10-16 3:28 Sam James
2023-12-13 1:54 Sam James
2023-10-19 19:48 Sam James
2022-07-23 19:43 Sam James
2020-07-07 21:59 Sergei Trofimovich
2020-03-29 14:06 Sergei Trofimovich
2019-11-28 0:16 Sergei Trofimovich
2018-09-30 23:07 Sergei Trofimovich
2018-02-17 19:42 Sergei Trofimovich
2017-10-14 19:57 Sergei Trofimovich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox