Bug#861806: ghc: Please add platform support for powerpcspe

John Paul Adrian Glaubitz glaubitz at physik.fu-berlin.de
Thu May 4 09:11:37 UTC 2017


Source: ghc
Version: 8.0.1-17
Severity: normal
Tags: patch
User: debian-powerpc at lists.debian.org
Usertags: powerpcspe

Hi!

The attached patch adds support for powerpcspe. It builds GHC with --enable-
unregisterised and adds a patch from upstream [1] which disables some PPC
FPU code on powerpcspe.

Thanks,
Adrian

> [1] https://ghc.haskell.org/trac/ghc/ticket/12075

--
 .''`.  John Paul Adrian Glaubitz
 : :' :  Debian Developer - glaubitz at debian.org
 `. `'   Freie Universitaet Berlin - glaubitz at physik.fu-berlin.de
   `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
-------------- next part --------------
diff -Nru old/ghc-8.0.1/aclocal.m4 new/ghc-8.0.1/aclocal.m4
--- old/ghc-8.0.1/aclocal.m4	2017-05-04 11:02:42.000000000 +0200
+++ new/ghc-8.0.1/aclocal.m4	2017-05-04 10:57:54.000000000 +0200
@@ -185,6 +185,7 @@
             test -z "[$]2" || eval "[$]2=ArchX86_64"
             ;;
         powerpc)
+            FP_CHECK_FOR_SOFT_FLOAT_POWERPC()
             test -z "[$]2" || eval "[$]2=ArchPPC"
             ;;
         powerpc64)
@@ -458,6 +459,25 @@
         AC_SUBST(ARM_ISA)
 ])
 
+# CHECK_FOR_SOFT_FLOAT_POWERPC
+# ----------------------------------
+# Check whether we have hardware floating point support. See #12075
+AC_DEFUN([FP_CHECK_FOR_SOFT_FLOAT_POWERPC],
+[
+  AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM(
+    [],
+    [#if defined(__NO_FPRS__)
+     softfloat
+     #else
+     return 0;
+     #endif
+    ])],
+    [value=NO],
+    [value=YES])
+
+  AC_DEFINE(powerpc_HOST_ARCH_SOFT_FLOAT, $value, [soft-float PowerPC])
+])
 
 # FP_SETTINGS
 # ----------------------------------
diff -Nru old/ghc-8.0.1/debian/changelog new/ghc-8.0.1/debian/changelog
--- old/ghc-8.0.1/debian/changelog	2016-12-17 03:44:45.000000000 +0100
+++ new/ghc-8.0.1/debian/changelog	2017-05-04 11:01:35.068820881 +0200
@@ -1,3 +1,12 @@
+ghc (8.0.1-17.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Add powerpcspe-disable-FPU-code.patch to disable PPC
+    FPU code on powerpcspe.
+  * Build with --enable-unregisterised on powerpcspe.
+
+ -- John Paul Adrian Glaubitz <glaubitz at physik.fu-berlin.de>  Thu, 04 May 2017 11:00:20 +0200
+
 ghc (8.0.1-17) unstable; urgency=medium
 
   * Add upstream patch "Add relocation type R_X86_64_REX_GOTPCRELX".
diff -Nru old/ghc-8.0.1/debian/patches/powerpcspe-disable-FPU-code.patch new/ghc-8.0.1/debian/patches/powerpcspe-disable-FPU-code.patch
--- old/ghc-8.0.1/debian/patches/powerpcspe-disable-FPU-code.patch	1970-01-01 01:00:00.000000000 +0100
+++ new/ghc-8.0.1/debian/patches/powerpcspe-disable-FPU-code.patch	2017-05-04 10:59:02.040928428 +0200
@@ -0,0 +1,66 @@
+Description: Disable FPU code on powerpspe
+ powerpcspe CPUs don't have an FPU, so the FPU PPC assembly
+ code has to be disabled on this architecture.
+ See: https://ghc.haskell.org/trac/ghc/ticket/12075
+ .
+
+--- ghc-8.0.1.orig/aclocal.m4
++++ ghc-8.0.1/aclocal.m4
+@@ -185,6 +185,7 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_V
+             test -z "[$]2" || eval "[$]2=ArchX86_64"
+             ;;
+         powerpc)
++            FP_CHECK_FOR_SOFT_FLOAT_POWERPC()
+             test -z "[$]2" || eval "[$]2=ArchPPC"
+             ;;
+         powerpc64)
+@@ -458,6 +459,25 @@ AC_DEFUN([GET_ARM_ISA],
+         AC_SUBST(ARM_ISA)
+ ])
+ 
++# CHECK_FOR_SOFT_FLOAT_POWERPC
++# ----------------------------------
++# Check whether we have hardware floating point support. See #12075
++AC_DEFUN([FP_CHECK_FOR_SOFT_FLOAT_POWERPC],
++[
++  AC_COMPILE_IFELSE(
++    [AC_LANG_PROGRAM(
++    [],
++    [#if defined(__NO_FPRS__)
++     softfloat
++     #else
++     return 0;
++     #endif
++    ])],
++    [value=NO],
++    [value=YES])
++
++  AC_DEFINE(powerpc_HOST_ARCH_SOFT_FLOAT, $value, [soft-float PowerPC])
++])
+ 
+ # FP_SETTINGS
+ # ----------------------------------
+--- ghc-8.0.1.orig/mk/project.mk.in
++++ ghc-8.0.1/mk/project.mk.in
+@@ -162,3 +162,6 @@ GHC_LLVM_AFFECTED_BY_9439 = @GHC_LLVM_AF
+ ifeq "$(TargetArch_CPP)" "arm"
+ ARM_ISA=@ARM_ISA@
+ endif
++ifeq "$(TargetArch_CPP)" "powerpc"
++POWERPC_SOFT_FLOAT=@powerpc_HOST_ARCH_SOFT_FLOAT@
++endif
+--- ghc-8.0.1.orig/rts/ghc.mk
++++ ghc-8.0.1/rts/ghc.mk
+@@ -55,9 +55,12 @@ rts_S_SRCS += rts/AdjustorAsm.S
+ endif
+ # this matches substrings of powerpc64le, including "powerpc" and "powerpc64"
+ ifneq "$(findstring $(TargetArch_CPP), powerpc64le)" ""
++# and this matches soft-float PPC (#12075)
++ifneq "$(POWERPC_NO_FPRS)" "YES"
+ rts_S_SRCS += rts/StgCRunAsm.S
+ endif
+ endif
++endif
+ 
+ ifeq "$(GhcUnregisterised)" "YES"
+ GENAPPLY_OPTS = -u
diff -Nru old/ghc-8.0.1/debian/patches/series new/ghc-8.0.1/debian/patches/series
--- old/ghc-8.0.1/debian/patches/series	2016-12-17 03:43:34.000000000 +0100
+++ new/ghc-8.0.1/debian/patches/series	2017-05-04 10:57:54.924973081 +0200
@@ -15,3 +15,4 @@
 osdecommitmemory-compat.patch
 smp-arm-fix.patch
 R_X86_64_REX_GOTPCRELX
+powerpcspe-disable-FPU-code.patch
diff -Nru old/ghc-8.0.1/debian/rules new/ghc-8.0.1/debian/rules
--- old/ghc-8.0.1/debian/rules	2016-11-14 17:07:27.000000000 +0100
+++ new/ghc-8.0.1/debian/rules	2017-05-04 10:59:42.672900592 +0200
@@ -38,7 +38,7 @@
 BUILD_HADDOCK_DOCS=YES
 DEB_HOOGLE_TXT_DIR = /usr/lib/ghc-doc/hoogle/
 
-ifeq (x32,$(DEB_HOST_ARCH))
+ifneq (,$(findstring $(DEB_HOST_ARCH), powerpcspe x32))
   EXTRA_CONFIGURE_FLAGS += --enable-unregisterised
 endif
 
diff -Nru old/ghc-8.0.1/mk/project.mk.in new/ghc-8.0.1/mk/project.mk.in
--- old/ghc-8.0.1/mk/project.mk.in	2016-05-16 19:08:53.000000000 +0200
+++ new/ghc-8.0.1/mk/project.mk.in	2017-05-04 10:57:54.000000000 +0200
@@ -162,3 +162,6 @@
 ifeq "$(TargetArch_CPP)" "arm"
 ARM_ISA=@ARM_ISA@
 endif
+ifeq "$(TargetArch_CPP)" "powerpc"
+POWERPC_SOFT_FLOAT=@powerpc_HOST_ARCH_SOFT_FLOAT@
+endif
diff -Nru old/ghc-8.0.1/rts/ghc.mk new/ghc-8.0.1/rts/ghc.mk
--- old/ghc-8.0.1/rts/ghc.mk	2016-05-16 19:08:53.000000000 +0200
+++ new/ghc-8.0.1/rts/ghc.mk	2017-05-04 10:57:54.000000000 +0200
@@ -55,9 +55,12 @@
 endif
 # this matches substrings of powerpc64le, including "powerpc" and "powerpc64"
 ifneq "$(findstring $(TargetArch_CPP), powerpc64le)" ""
+# and this matches soft-float PPC (#12075)
+ifneq "$(POWERPC_NO_FPRS)" "YES"
 rts_S_SRCS += rts/StgCRunAsm.S
 endif
 endif
+endif
 
 ifeq "$(GhcUnregisterised)" "YES"
 GENAPPLY_OPTS = -u


More information about the Pkg-haskell-maintainers mailing list