libffi: fix build+check on ppc*, fix pkg-config file, drop vsed
This commit is contained in:
parent
b15d2675b3
commit
4ed872e00a
6 changed files with 123 additions and 4 deletions
15
srcpkgs/libffi/patches/no-toolexeclibdir.patch
Normal file
15
srcpkgs/libffi/patches/no-toolexeclibdir.patch
Normal file
|
@ -0,0 +1,15 @@
|
|||
--- libffi.pc.in
|
||||
+++ libffi.pc.in
|
||||
@@ -1,11 +1,10 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
-toolexeclibdir=@toolexeclibdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: @PACKAGE_NAME@
|
||||
Description: Library supporting Foreign Function Interfaces
|
||||
Version: @PACKAGE_VERSION@
|
||||
-Libs: -L${toolexeclibdir} -lffi
|
||||
+Libs: -lffi
|
||||
Cflags: -I${includedir}
|
50
srcpkgs/libffi/patches/powerpc-fix-2.patch
Normal file
50
srcpkgs/libffi/patches/powerpc-fix-2.patch
Normal file
|
@ -0,0 +1,50 @@
|
|||
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 1474ce70..df977342 100644
|
||||
--- src/powerpc/sysv.S
|
||||
+++ 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):
|
13
srcpkgs/libffi/patches/powerpc-fix.patch
Normal file
13
srcpkgs/libffi/patches/powerpc-fix.patch
Normal file
|
@ -0,0 +1,13 @@
|
|||
diff --git a/src/powerpc/ffi_powerpc.h b/src/powerpc/ffi_powerpc.h
|
||||
index 5ee2a70..8e2f2f0 100644
|
||||
--- src/powerpc/ffi_powerpc.h
|
||||
+++ 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);
|
28
srcpkgs/libffi/patches/powerpc64-fix-2.patch
Normal file
28
srcpkgs/libffi/patches/powerpc64-fix-2.patch
Normal file
|
@ -0,0 +1,28 @@
|
|||
diff --git a/src/powerpc/ffi_linux64.c b/src/powerpc/ffi_linux64.c
|
||||
index 7364770..4d50878 100644
|
||||
--- src/powerpc/ffi_linux64.c
|
||||
+++ 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++;
|
||||
}
|
16
srcpkgs/libffi/patches/powerpc64-fix.patch
Normal file
16
srcpkgs/libffi/patches/powerpc64-fix.patch
Normal file
|
@ -0,0 +1,16 @@
|
|||
diff --git a/src/powerpc/ffi_linux64.c b/src/powerpc/ffi_linux64.c
|
||||
index de0d033..7364770 100644
|
||||
--- src/powerpc/ffi_linux64.c
|
||||
+++ 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++;
|
|
@ -1,7 +1,7 @@
|
|||
# Template file for 'libffi'
|
||||
pkgname=libffi
|
||||
version=3.3
|
||||
revision=1
|
||||
revision=2
|
||||
build_style=gnu-configure
|
||||
configure_args="--includedir=/usr/include --with-pic"
|
||||
checkdepends="dejagnu"
|
||||
|
@ -17,9 +17,6 @@ pre_install() {
|
|||
ln -s lib ${DESTDIR}/usr/lib64
|
||||
}
|
||||
post_install() {
|
||||
# Fix includedir for pkg-config file.
|
||||
vsed -i -e "s|\${libdir}/libffi-${version}|/usr|" \
|
||||
${DESTDIR}/usr/lib/pkgconfig/libffi.pc
|
||||
vlicense LICENSE
|
||||
rm -f ${DESTDIR}/usr/lib64
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue