public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [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; 10+ 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] 10+ 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; 10+ 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] 10+ 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; 10+ 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] 10+ 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; 10+ 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] 10+ 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; 10+ 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] 10+ 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; 10+ 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] 10+ 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; 10+ 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] 10+ 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; 10+ 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] 10+ 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; 10+ 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] 10+ 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; 10+ 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] 10+ messages in thread

end of thread, other threads:[~2023-12-13  1:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-07 21:59 [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 --
2023-12-13  1:54 Sam James
2023-10-19 19:48 Sam James
2022-07-23 19:43 Sam James
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
2018-01-06 13:03 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