unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#44778] [PATCH] gnu: libffi: Add unreleased patch to fix float128 on powerpc64le.
@ 2020-11-21 16:24 dftxbs3e
  2020-11-26 22:31 ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: dftxbs3e @ 2020-11-21 16:24 UTC (permalink / raw)
  To: 44778

[-- Attachment #1: Type: text/plain, Size: 320 bytes --]

Hello,

Merging this and https://issues.guix.gnu.org/38459 onto master allows
to successfully build bootstrap-tarballs for powerpc64le-linux-gnu
using the command:

$ guix build --target=powerpc64le-linux-gnu bootstrap-tarballs

This patch can be removed when libffi releases the next version
(probably 3.4).

Thank you

[-- Attachment #2: 0001-gnu-libffi-Add-unreleased-patch-to-fix-float128-on-p.patch --]
[-- Type: text/x-patch, Size: 4235 bytes --]

From e195e9e9fe0409dd4b76cac87244cb2b5d7636e0 Mon Sep 17 00:00:00 2001
From: John Doe <dftxbs3e@free.fr>
Date: Sat, 21 Nov 2020 17:06:07 +0100
Subject: [PATCH] gnu: libffi: Add unreleased patch to fix float128 on
 powerpc64le.

Patch fetched from https://github.com/libffi/libffi/pull/561.patch
---
 gnu/local.mk                                  |  3 +-
 gnu/packages/libffi.scm                       |  1 +
 .../patches/libffi-float128-powerpc64le.patch | 58 +++++++++++++++++++
 3 files changed, 61 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/libffi-float128-powerpc64le.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 35369063f1..f4a43982cc 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1731,7 +1731,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/xsane-support-ipv6.patch			\
   %D%/packages/patches/xsane-tighten-default-umask.patch	\
   %D%/packages/patches/yggdrasil-extra-config.patch	\
-  %D%/packages/patches/zziplib-CVE-2018-16548.patch
+  %D%/packages/patches/zziplib-CVE-2018-16548.patch	\
+  %D%/packages/patches/libffi-float128-powerpc64le.patch
 
 MISC_DISTRO_FILES =				\
   %D%/packages/ld-wrapper.in
diff --git a/gnu/packages/libffi.scm b/gnu/packages/libffi.scm
index d324892330..f6e2efabe0 100644
--- a/gnu/packages/libffi.scm
+++ b/gnu/packages/libffi.scm
@@ -48,6 +48,7 @@
               (uri
                (string-append "ftp://sourceware.org/pub/libffi/"
                               name "-" version ".tar.gz"))
+	      (patches (search-patches "libffi-float128-powerpc64le.patch"))
               (sha256
                (base32
                 "0mi0cpf8aa40ljjmzxb7im6dbj45bb0kllcd09xgmp834y9agyvj"))))
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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#44778] [PATCH] gnu: libffi: Add unreleased patch to fix float128 on powerpc64le.
  2020-11-21 16:24 [bug#44778] [PATCH] gnu: libffi: Add unreleased patch to fix float128 on powerpc64le dftxbs3e
@ 2020-11-26 22:31 ` Ludovic Courtès
  2020-11-26 23:21   ` dftxbs3e
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2020-11-26 22:31 UTC (permalink / raw)
  To: dftxbs3e; +Cc: 44778, Efraim Flashner

Hi,

dftxbs3e <dftxbs3e@free.fr> skribis:

> From e195e9e9fe0409dd4b76cac87244cb2b5d7636e0 Mon Sep 17 00:00:00 2001
> From: John Doe <dftxbs3e@free.fr>
> Date: Sat, 21 Nov 2020 17:06:07 +0100
> Subject: [PATCH] gnu: libffi: Add unreleased patch to fix float128 on
>  powerpc64le.
>
> Patch fetched from https://github.com/libffi/libffi/pull/561.patch

Bonus points for a ChangeLog-style commit message.  :-)

  https://guix.gnu.org/manual/devel/en/html_node/Submitting-Patches.html

The patch LGTM, but I vaguely remember seeing similar patches by Efraim
in a branch (?), or was it for 32-bit PowerPC?

If there’s no collision with other patches in this area, we can happily
apply it.

Ludo’.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#44778] [PATCH] gnu: libffi: Add unreleased patch to fix float128 on powerpc64le.
  2020-11-26 22:31 ` Ludovic Courtès
@ 2020-11-26 23:21   ` dftxbs3e
  2020-11-27  9:57     ` Ludovic Courtès
  2020-11-28 17:35     ` bug#44778: " Ludovic Courtès
  0 siblings, 2 replies; 6+ messages in thread
From: dftxbs3e @ 2020-11-26 23:21 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 44778, Efraim Flashner

[-- Attachment #1: Type: text/plain, Size: 1319 bytes --]

On Thu, 2020-11-26 at 23:31 +0100, Ludovic Courtès wrote:
> Hi,

Hello!

> dftxbs3e <dftxbs3e@free.fr> skribis:
> 
> > From e195e9e9fe0409dd4b76cac87244cb2b5d7636e0 Mon Sep 17 00:00:00
> > 2001
> > From: John Doe <dftxbs3e@free.fr>
> > Date: Sat, 21 Nov 2020 17:06:07 +0100
> > Subject: [PATCH] gnu: libffi: Add unreleased patch to fix float128
> > on
> >  powerpc64le.
> > 
> > Patch fetched from https://github.com/libffi/libffi/pull/561.patch
> 
> Bonus points for a ChangeLog-style commit message.  :-)
>     
> https://guix.gnu.org/manual/devel/en/html_node/Submitting-Patches.html
> 

Sorry, it's not clear to me yet what that is yet, will read again.

> The patch LGTM, but I vaguely remember seeing similar patches by
> Efraim
> in a branch (?), or was it for 32-bit PowerPC?
> 
> If there’s no collision with other patches in this area, we can
> happily
> apply it.
> 

There's no collision, Efraim's patch is
<https://github.com/libffi/libffi/pull/532> and mine is
<https://github.com/libffi/libffi/pull/561>. Efraim's patch is about
POWER7 and earlier.

There's quite a few PRs relating to PowerPC bugs on libffi:
https://github.com/libffi/libffi/pulls?q=is%3Apr+powerpc+is%3Aclosed

> Ludo’.

Thanks a lot for the review! Attached new patch version, I hope it is
better with the commit message now.

[-- Attachment #2: 0001-gnu-libffi-Add-unreleased-patch-to-fix-float128-on-p.patch --]
[-- Type: text/x-patch, Size: 4426 bytes --]

From 568ff570b8077a3c5691139d72532ebb878f3097 Mon Sep 17 00:00:00 2001
From: John Doe <dftxbs3e@free.fr>
Date: Fri, 27 Nov 2020 00:12:08 +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)[patches]: Apply patch.
* gnu/local.mk (dist_patch_DATA): Add patch file to build system.
---
 gnu/local.mk                                  |  3 +-
 gnu/packages/libffi.scm                       |  1 +
 .../patches/libffi-float128-powerpc64le.patch | 58 +++++++++++++++++++
 3 files changed, 61 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/libffi-float128-powerpc64le.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 289f510c11..55c686f15c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1735,7 +1735,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/xsane-support-ipv6.patch			\
   %D%/packages/patches/xsane-tighten-default-umask.patch	\
   %D%/packages/patches/yggdrasil-extra-config.patch	\
-  %D%/packages/patches/zziplib-CVE-2018-16548.patch
+  %D%/packages/patches/zziplib-CVE-2018-16548.patch	\
+  %D%/packages/patches/libffi-float128-powerpc64le.patch
 
 MISC_DISTRO_FILES =				\
   %D%/packages/ld-wrapper.in
diff --git a/gnu/packages/libffi.scm b/gnu/packages/libffi.scm
index d324892330..f6e2efabe0 100644
--- a/gnu/packages/libffi.scm
+++ b/gnu/packages/libffi.scm
@@ -48,6 +48,7 @@
               (uri
                (string-append "ftp://sourceware.org/pub/libffi/"
                               name "-" version ".tar.gz"))
+	      (patches (search-patches "libffi-float128-powerpc64le.patch"))
               (sha256
                (base32
                 "0mi0cpf8aa40ljjmzxb7im6dbj45bb0kllcd09xgmp834y9agyvj"))))
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.28.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#44778] [PATCH] gnu: libffi: Add unreleased patch to fix float128 on powerpc64le.
  2020-11-26 23:21   ` dftxbs3e
@ 2020-11-27  9:57     ` Ludovic Courtès
  2020-11-27 23:39       ` dftxbs3e
  2020-11-28 17:35     ` bug#44778: " Ludovic Courtès
  1 sibling, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2020-11-27  9:57 UTC (permalink / raw)
  To: dftxbs3e; +Cc: 44778, Efraim Flashner

Hi,

dftxbs3e <dftxbs3e@free.fr> skribis:

> There's no collision, Efraim's patch is
> <https://github.com/libffi/libffi/pull/532> and mine is
> <https://github.com/libffi/libffi/pull/561>. Efraim's patch is about
> POWER7 and earlier.

OK, thanks for clarifying.

> From 568ff570b8077a3c5691139d72532ebb878f3097 Mon Sep 17 00:00:00 2001
> From: John Doe <dftxbs3e@free.fr>
> Date: Fri, 27 Nov 2020 00:12:08 +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)[patches]: Apply patch.
> * gnu/local.mk (dist_patch_DATA): Add patch file to build system.

LGTM.  One thing before I push: do you want to replace “John Doe” by
“dftxbs3e” as the author?

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#44778] [PATCH] gnu: libffi: Add unreleased patch to fix float128 on powerpc64le.
  2020-11-27  9:57     ` Ludovic Courtès
@ 2020-11-27 23:39       ` dftxbs3e
  0 siblings, 0 replies; 6+ messages in thread
From: dftxbs3e @ 2020-11-27 23:39 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 44778, Efraim Flashner

On Fri, 2020-11-27 at 10:57 +0100, Ludovic Courtès wrote:
> Hi,

Hello again!

> LGTM.  One thing before I push: do you want to replace “John Doe” by
> “dftxbs3e” as the author?

As-is is fine for me!

> 
> Thanks,
> Ludo’.

Thank you





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#44778: [PATCH] gnu: libffi: Add unreleased patch to fix float128 on powerpc64le.
  2020-11-26 23:21   ` dftxbs3e
  2020-11-27  9:57     ` Ludovic Courtès
@ 2020-11-28 17:35     ` Ludovic Courtès
  1 sibling, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2020-11-28 17:35 UTC (permalink / raw)
  To: dftxbs3e; +Cc: 44778-done, Efraim Flashner

Hi,

dftxbs3e <dftxbs3e@free.fr> skribis:

> From 568ff570b8077a3c5691139d72532ebb878f3097 Mon Sep 17 00:00:00 2001
> From: John Doe <dftxbs3e@free.fr>
> Date: Fri, 27 Nov 2020 00:12:08 +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)[patches]: Apply patch.
> * gnu/local.mk (dist_patch_DATA): Add patch file to build system.

I fixed the conflicts and applied to ‘core-updates’.  POWER9 support is
coming!  :-)

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-11-28 17:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-21 16:24 [bug#44778] [PATCH] gnu: libffi: Add unreleased patch to fix float128 on powerpc64le dftxbs3e
2020-11-26 22:31 ` Ludovic Courtès
2020-11-26 23:21   ` dftxbs3e
2020-11-27  9:57     ` Ludovic Courtès
2020-11-27 23:39       ` dftxbs3e
2020-11-28 17:35     ` bug#44778: " Ludovic Courtès

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).