diff --git a/ghc-7.8-arm-use-ld-gold.patch b/ghc-7.8-arm-use-ld-gold.patch new file mode 100644 index 0000000..34d4e98 --- /dev/null +++ b/ghc-7.8-arm-use-ld-gold.patch @@ -0,0 +1,42 @@ +armv7 by nomeata: https://ghc.haskell.org/trac/ghc/ticket/8976#comment:12 +arm64 backport of https://ghc.haskell.org/trac/ghc/ticket/9673#comment:28 (erikd) + +--- ghc-7.8.4/aclocal.m4.24~ 2015-04-01 04:48:39.961193022 -0400 ++++ ghc-7.8.4/aclocal.m4 2015-04-01 04:50:19.708203082 -0400 +@@ -553,6 +553,14 @@ + $3="$$3 -D_HPUX_SOURCE" + $5="$$5 -D_HPUX_SOURCE" + ;; ++ arm*) ++ # On arm, link using gold ++ $3="$$3 -fuse-ld=gold" ++ ;; ++ aarch64*) ++ # On arm, link using gold ++ $3="$$3 -fuse-ld=gold" ++ ;; + esac + + # If gcc knows about the stack protector, turn it off. +--- ghc-7.8.4/configure.ac~ 2014-12-22 14:08:24.000000000 -0500 ++++ ghc-7.8.4/configure.ac 2015-04-22 00:08:54.646110535 -0400 +@@ -587,7 +587,18 @@ + dnl ** Which ld to use? + dnl -------------------------------------------------------------- + FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld]) +-LdCmd="$LD" ++case $target in ++arm*linux* | aarch64*linux*) ++ # Arm requires use of the binutils ld.gold linker. ++ # This case should catch at least arm-unknown-linux-gnueabihf and ++ # arm-linux-androideabi. ++ FP_ARG_WITH_PATH_GNU_PROG([LD_GOLD], [ld.gold], [ld.gold]) ++ LdCmd="$LD_GOLD" ++ ;; ++*) ++ LdCmd="$LD" ++ ;; ++esac + AC_SUBST([LdCmd]) + + dnl ** Which nm to use? diff --git a/ghc-config.mk.in-Enable-SMP-and-GHCi-support-for-Aarch64.patch b/ghc-config.mk.in-Enable-SMP-and-GHCi-support-for-Aarch64.patch new file mode 100644 index 0000000..1ee0ff7 --- /dev/null +++ b/ghc-config.mk.in-Enable-SMP-and-GHCi-support-for-Aarch64.patch @@ -0,0 +1,31 @@ +From 44cee4852282f63393d532aad59c5cd865ff3ed6 Mon Sep 17 00:00:00 2001 +From: Erik de Castro Lopo +Date: Wed, 1 Apr 2015 04:46:01 +0000 +Subject: [PATCH] mk/config.mk.in : Enable SMP and GHCi support for Aarch64. + +--- + mk/config.mk.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +Index: ghc-7.8.4/mk/config.mk.in +=================================================================== +--- ghc-7.8.4.orig/mk/config.mk.in ++++ ghc-7.8.4/mk/config.mk.in +@@ -174,7 +174,7 @@ HaveLibDL = @HaveLibDL@ + + # ArchSupportsSMP should be set iff there is support for that arch in + # includes/stg/SMP.h +-ArchSupportsSMP=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 sparc powerpc powerpc64 powerpc64le arm))) ++ArchSupportsSMP=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 sparc powerpc powerpc64 powerpc64le arm aarch64))) + + GhcWithSMP := $(strip $(if $(filter YESNO, $(ArchSupportsSMP)$(GhcUnregisterised)),YES,NO)) + +@@ -182,7 +182,7 @@ GhcWithSMP := $(strip $(if $(filter YESN + # has support for this OS/ARCH combination. + + OsSupportsGHCi=$(strip $(patsubst $(TargetOS_CPP), YES, $(findstring $(TargetOS_CPP), mingw32 cygwin32 linux solaris2 freebsd dragonfly netbsd openbsd darwin kfreebsdgnu))) +-ArchSupportsGHCi=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 powerpc powerpc64 powerpc64le sparc sparc64 arm))) ++ArchSupportsGHCi=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 powerpc powerpc64 powerpc64le sparc sparc64 arm aarch64))) + + ifeq "$(OsSupportsGHCi)$(ArchSupportsGHCi)" "YESYES" + GhcWithInterpreter=YES diff --git a/ghc.spec b/ghc.spec index 1979fe1..3912b6d 100644 --- a/ghc.spec +++ b/ghc.spec @@ -45,7 +45,11 @@ BuildRequires: docbook-utils BuildRequires: docbook-xsl-stylesheets BuildRequires: libxslt %endif -# Patch 19 changes build system +%ifarch aarch64 +BuildRequires: binutils-gold +%endif + +# Patch 19 and 22 change build system BuildRequires: autoconf BuildRequires: automake @@ -71,6 +75,10 @@ Patch19: 0001-implement-native-code-generator-for-ppc64.patch Patch20: ghc-glibc-2.20_BSD_SOURCE.patch # PATCH-FIX-OPENSUSE add aarch64 support Patch21: ghc-arm64.patch +# PATCH-FIX-UPSTREAM ghc-config.mk.in-Enable-SMP-and-GHCi-support-for-Aarch64.patch peter.trommler@ohm-hochschule.de -- Provide SMP implementation and enable GHCi on aarch64. Adapted from Fedora patch 26. +Patch22: ghc-config.mk.in-Enable-SMP-and-GHCi-support-for-Aarch64.patch +# PATCH-FIX-UPSTREAM peter.trommler@ohm-hochschule.de -- GNU ld does not work with ghc on aarch64 so use Gold. Adapted from Fedora patch 24. +Patch23: ghc-7.8-arm-use-ld-gold.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -102,6 +110,9 @@ Requires: ghc-base-devel Requires: glibc-locale Requires(post): update-alternatives Requires(postun): update-alternatives +%ifarch aarch64 +Requires: binutils-gold +%endif %description compiler This package contains the GHC compiler, tools and utilities. @@ -169,9 +180,16 @@ except the ghc library, which is installed by the toplevel ghc metapackage. %patch19 -p1 %patch20 -p1 %patch21 -p1 +%ifarch aarch64 +%patch22 -p1 -b .orig +%endif + +%ifarch armv7hl aarch64 +%patch23 -p1 -b .24~ +%endif %build -# Patch 19 modifies build system +# Patch 19 and 22 modify build system perl boot # Check if bootstrap is required, i.e. version is different from ghc's version