From: dftxbs3e <dftxbs3e@free.fr>
To: 45252@debbugs.gnu.org
Subject: [bug#45252] [PATCH] gnu: libffi: Add unreleased patch to fix float128 on powerpc64le.
Date: Tue, 15 Dec 2020 10:32:42 +0100 [thread overview]
Message-ID: <8fc771beb3f0f1e2886a238e0ef9087908c98fc1.camel@free.fr> (raw)
[-- Attachment #1: Type: text/plain, Size: 284 bytes --]
Hello!
Based on previous discussions to apply <
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44778> on the master
branch instead I submit this new patch (attached) so that it does not
cause a world rebuild by not altering the package definition hash on
other platforms.
Thank you!
[-- Attachment #2: 0001-gnu-libffi-Add-unreleased-patch-to-fix-float128-on-p.patch --]
[-- Type: text/x-patch, Size: 6389 bytes --]
From 05c3dc588745240fb790f9a39111be70c153d70c Mon Sep 17 00:00:00 2001
From: John Doe <dftxbs3e@free.fr>
Date: Tue, 15 Dec 2020 10:24:11 +0100
Subject: [PATCH] gnu: libffi: Add unreleased patch to fix float128 on
powerpc64le.
* gnu/packages/patches/libffi-float128-powerpc64le.patch: Import patch
file from <https://github.com/libffi/libffi/pull/561.patch>.
* gnu/packages/libffi.scm (libffi):
[arguments]: Apply patch conditionally for powerpc64le-* systems in a phase.
[inputs]: Add patch as input conditionally for powerpc64le-* systems.
* gnu/local.mk (dist_patch_DATA): Add patch file to build system.
---
gnu/local.mk | 1 +
gnu/packages/libffi.scm | 25 ++++++--
.../patches/libffi-float128-powerpc64le.patch | 58 +++++++++++++++++++
3 files changed, 79 insertions(+), 5 deletions(-)
create mode 100644 gnu/packages/patches/libffi-float128-powerpc64le.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index 0b4cf23838..e190df0667 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1208,6 +1208,7 @@ dist_patch_DATA = \
%D%/packages/patches/julia-SOURCE_DATE_EPOCH-mtime.patch \
%D%/packages/patches/kdbusaddons-kinit-file-name.patch \
%D%/packages/patches/libffi-3.3-powerpc-fixes.patch \
+ %D%/packages/patches/libffi-float128-powerpc64le.patch \
%D%/packages/patches/libvirt-create-machine-cgroup.patch \
%D%/packages/patches/libziparchive-add-includes.patch \
%D%/packages/patches/localed-xorg-keyboard.patch \
diff --git a/gnu/packages/libffi.scm b/gnu/packages/libffi.scm
index d324892330..e4bfe6731b 100644
--- a/gnu/packages/libffi.scm
+++ b/gnu/packages/libffi.scm
@@ -57,7 +57,7 @@
;; compiler. See "ax_cc_maxopt.m4" and "ax_gcc_archflag.m4".
#:configure-flags '("--enable-portable-binary" "--without-gcc-arch")
- ;; TODO: Inline patch on next rebuild cycle.
+ ;; TODO: Inline patches on next rebuild cycle.
,@(if (string-prefix? "powerpc-" (or (%current-target-system)
(%current-system)))
'(#:phases (modify-phases %standard-phases
@@ -67,13 +67,28 @@
"powerpc-patch")))
(invoke "patch" "--batch" "-p1"
"-i" patch))))))
+ '())
+ ,@(if (string-prefix? "powerpc64le-" (or (%current-target-system)
+ (%current-system)))
+ '(#:phases (modify-phases %standard-phases
+ (add-after 'unpack 'apply-patch2
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((patch (assoc-ref inputs
+ "powerpc64le-patch")))
+ (invoke "patch" "--batch" "-p1"
+ "-i" patch))))))
'())))
(inputs
- (if (string-prefix? "powerpc-" (or (%current-target-system)
+ (cond
+ ((string-prefix? "powerpc-" (or (%current-target-system)
(%current-system)))
- `(("powerpc-patch" ,@(search-patches
- "libffi-3.3-powerpc-fixes.patch")))
- '()))
+ `(("powerpc-patch" ,@(search-patches
+ "libffi-3.3-powerpc-fixes.patch"))))
+ ((string-prefix? "powerpc64le-" (or (%current-target-system)
+ (%current-system)))
+ `(("powerpc64le-patch" ,@(search-patches
+ "libffi-float128-powerpc64le.patch"))))
+ (else '())))
(outputs '("out" "debug"))
(synopsis "Foreign function call interface library")
(description
diff --git a/gnu/packages/patches/libffi-float128-powerpc64le.patch b/gnu/packages/patches/libffi-float128-powerpc64le.patch
new file mode 100644
index 0000000000..4fd32b0102
--- /dev/null
+++ b/gnu/packages/patches/libffi-float128-powerpc64le.patch
@@ -0,0 +1,58 @@
+From de93adfb6f48100946bba2c3abad2a77a0cfde0b Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Sun, 24 Nov 2019 09:52:01 +0100
+Subject: [PATCH] ffi_powerpc.h: fix build failure with powerpc7
+
+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>
+---
+ 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 8e2f2f0e..960a5c42 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.29.2
next reply other threads:[~2020-12-15 9:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-15 9:32 dftxbs3e [this message]
2020-12-20 20:32 ` [bug#45252] [PATCH] gnu: libffi: Add unreleased patch to fix float128 on powerpc64le Chris Marusich
2020-12-20 20:36 ` dftxbs3e
2020-12-21 1:30 ` bug#45252: " Chris Marusich
[not found] <87y2hqifp3.fsf@netris.org>
[not found] ` <87tuseidlk.fsf@netris.org>
2020-12-23 6:38 ` [bug#45252] " Chris Marusich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8fc771beb3f0f1e2886a238e0ef9087908c98fc1.camel@free.fr \
--to=dftxbs3e@free.fr \
--cc=45252@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).