summaryrefslogtreecommitdiff
path: root/dev-lang/ghc/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 20:57:42 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 20:57:42 +0100
commit1798c4aeca70ac8d0a243684d6a798fbc65735f8 (patch)
treee48e19cb6fa03de18e1c63e1a93371b7ebc4eb56 /dev-lang/ghc/files
parentd87262dd706fec50cd150aab3e93883b6337466d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'dev-lang/ghc/files')
-rw-r--r--dev-lang/ghc/files/ghc-7.0.4-CHOST-prefix.patch17
-rw-r--r--dev-lang/ghc/files/ghc-7.10.1-rc3-ghc-7.10-bootstrap.patch78
-rw-r--r--dev-lang/ghc/files/ghc-7.10.3-hardfloat.patch26
-rw-r--r--dev-lang/ghc/files/ghc-7.10.3-relnotes.patch45
-rw-r--r--dev-lang/ghc/files/ghc-7.6.3-preserve-inplace-xattr.patch14
-rw-r--r--dev-lang/ghc/files/ghc-7.8.1_rc1-libbfd.patch81
-rw-r--r--dev-lang/ghc/files/ghc-7.8.2-cgen-constify.patch34
-rw-r--r--dev-lang/ghc/files/ghc-7.8.3-linker-warn.patch35
-rw-r--r--dev-lang/ghc/files/ghc-7.8.3-pic-sparc.patch31
-rw-r--r--dev-lang/ghc/files/ghc-7.8.3-ppc32-fPIC.patch351
-rw-r--r--dev-lang/ghc/files/ghc-7.8.3-prim-lm.patch12
-rw-r--r--dev-lang/ghc/files/ghc-7.8.4-gold.patch27
-rw-r--r--dev-lang/ghc/files/ghc-7.8.4-ia64-CLOSUREs.patch66
-rw-r--r--dev-lang/ghc/files/ghc-8.0.1-limit-jN.patch50
-rw-r--r--dev-lang/ghc/files/ghc-8.0.1-par-g0-on-A32.patch65
-rw-r--r--dev-lang/ghc/files/ghc-8.0.1-ww-args-limit.patch127
-rw-r--r--dev-lang/ghc/files/ghc-8.0.1_rc1-cgen-constify.patch34
-rw-r--r--dev-lang/ghc/files/ghc-8.0.2-O2-unreg.patch35
-rw-r--r--dev-lang/ghc/files/ghc-8.0.2-binutils-2.30.patch65
-rw-r--r--dev-lang/ghc/files/ghc-8.0.2-libffi-alpha.patch57
-rw-r--r--dev-lang/ghc/files/ghc-8.0.2-no-relax-everywhere.patch17
-rw-r--r--dev-lang/ghc/files/ghc-8.0.2_rc2-old-sphinx.patch12
-rw-r--r--dev-lang/ghc/files/ghc-8.2.1-darwin.patch31
-rw-r--r--dev-lang/ghc/files/ghc-8.2.1_rc1-cgen-constify.patch378
-rw-r--r--dev-lang/ghc/files/ghc-8.2.1_rc1-ghci-cross.patch60
-rw-r--r--dev-lang/ghc/files/ghc-8.2.1_rc1-hp2ps-cross.patch104
-rw-r--r--dev-lang/ghc/files/ghc-8.2.1_rc1-stage2-cross.patch81
-rw-r--r--dev-lang/ghc/files/ghc-8.2.1_rc1-staged-cross.patch43
-rw-r--r--dev-lang/ghc/files/ghc-8.2.1_rc1-unphased-cross.patch30
-rw-r--r--dev-lang/ghc/files/ghc-8.2.1_rc1-win32-cross-1.patch124
-rw-r--r--dev-lang/ghc/files/ghc-8.2.1_rc1-win32-cross-2-hack.patch144
-rw-r--r--dev-lang/ghc/files/ghc-8.2.1_rc2-O2-unreg.patch35
-rw-r--r--dev-lang/ghc/files/ghc-8.2.1_rc3-any-vendor.patch44
-rw-r--r--dev-lang/ghc/files/ghc-8.2.1_rc3-stginit-data.patch27
-rw-r--r--dev-lang/ghc/files/ghc-8.4.2-allow-cross-bootstrap.patch23
-rw-r--r--dev-lang/ghc/files/ghc-bash-completion218
36 files changed, 0 insertions, 2621 deletions
diff --git a/dev-lang/ghc/files/ghc-7.0.4-CHOST-prefix.patch b/dev-lang/ghc/files/ghc-7.0.4-CHOST-prefix.patch
deleted file mode 100644
index e38d9165e065..000000000000
--- a/dev-lang/ghc/files/ghc-7.0.4-CHOST-prefix.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Strip versioning components from *HOST for Darwin and Solaris
-
---- a/aclocal.m4
-+++ b/aclocal.m4
-@@ -1358,6 +1358,12 @@
- freebsd*)
- $2="freebsd"
- ;;
-+ darwin*)
-+ $2="darwin"
-+ ;;
-+ solaris2.*)
-+ $2="solaris2"
-+ ;;
- *)
- echo "Unknown OS $1"
- exit 1
diff --git a/dev-lang/ghc/files/ghc-7.10.1-rc3-ghc-7.10-bootstrap.patch b/dev-lang/ghc/files/ghc-7.10.1-rc3-ghc-7.10-bootstrap.patch
deleted file mode 100644
index 60db34b8b362..000000000000
--- a/dev-lang/ghc/files/ghc-7.10.1-rc3-ghc-7.10-bootstrap.patch
+++ /dev/null
@@ -1,78 +0,0 @@
---- ghc-7.10.0.20150316-orig/compiler/utils/Pair.hs 2015-03-10 05:43:13.000000000 +1100
-+++ ghc-7.10.0.20150316/compiler/utils/Pair.hs 2015-03-17 09:50:48.491115080 +1100
-@@ -15,6 +15,8 @@
- import Data.Foldable
- import Data.Monoid
- import Data.Traversable
-+#else
-+import Control.Applicative ((<$>))
- #endif
-
- data Pair a = Pair { pFst :: a, pSnd :: a }
---- ghc-7.10.0.20150316-orig/compiler/types/Coercion.hs 2015-03-10 05:43:13.000000000 +1100
-+++ ghc-7.10.0.20150316/compiler/types/Coercion.hs 2015-03-17 10:11:21.636047380 +1100
-@@ -104,6 +104,8 @@
- #if __GLASGOW_HASKELL__ < 709
- import Control.Applicative hiding ( empty )
- import Data.Traversable (traverse, sequenceA)
-+#else
-+import Control.Applicative ((<$>))
- #endif
- import FastString
- import ListSetOps
---- ghc-7.10.0.20150316-orig/compiler/typecheck/TcEvidence.hs 2015-03-14 08:48:57.000000000 +1100
-+++ ghc-7.10.0.20150316/compiler/typecheck/TcEvidence.hs 2015-03-17 10:26:03.251433371 +1100
-@@ -50,6 +50,8 @@
- #if __GLASGOW_HASKELL__ < 709
- import Control.Applicative
- import Data.Traversable (traverse, sequenceA)
-+#else
-+import Control.Applicative ((<$>))
- #endif
- import qualified Data.Data as Data
- import Outputable
---- ghc-7.10.0.20150316-orig/compiler/hsSyn/HsBinds.hs 2015-03-10 05:43:13.000000000 +1100
-+++ ghc-7.10.0.20150316/compiler/hsSyn/HsBinds.hs 2015-03-17 10:42:21.459519033 +1100
-@@ -47,6 +47,8 @@
- import Data.Traversable ( Traversable(..) )
- import Data.Monoid ( mappend )
- import Control.Applicative hiding (empty)
-+#else
-+import Control.Applicative ((<$>))
- #endif
-
- {-
---- ghc-7.10.0.20150316-orig/compiler/parser/RdrHsSyn.hs 2015-03-10 05:43:13.000000000 +1100
-+++ ghc-7.10.0.20150316/compiler/parser/RdrHsSyn.hs 2015-03-17 11:17:48.950929542 +1100
-@@ -91,9 +91,7 @@
- import Util
- import ApiAnnotation
-
--#if __GLASGOW_HASKELL__ < 709
- import Control.Applicative ((<$>))
--#endif
- import Control.Monad
-
- import Text.ParserCombinators.ReadP as ReadP
---- ghc-7.10.0.20150316-orig/compiler/typecheck/TcGenDeriv.hs 2015-03-14 08:48:57.000000000 +1100
-+++ ghc-7.10.0.20150316/compiler/typecheck/TcGenDeriv.hs 2015-03-17 11:30:39.106508173 +1100
-@@ -59,6 +59,8 @@
- import Var
- #if __GLASGOW_HASKELL__ < 709
- import MonadUtils
-+#else
-+import Control.Applicative ((<$>))
- #endif
- import Outputable
- import Lexeme
---- ghc-7.10.0.20150316-orig/compiler/vectorise/Vectorise/Exp.hs 2015-03-10 05:43:13.000000000 +1100
-+++ ghc-7.10.0.20150316/compiler/vectorise/Vectorise/Exp.hs 2015-03-17 11:46:41.829481669 +1100
-@@ -46,6 +46,8 @@
- import Util
- #if __GLASGOW_HASKELL__ < 709
- import MonadUtils
-+#else
-+import Control.Applicative ((<$>))
- #endif
-
- import Control.Monad
diff --git a/dev-lang/ghc/files/ghc-7.10.3-hardfloat.patch b/dev-lang/ghc/files/ghc-7.10.3-hardfloat.patch
deleted file mode 100644
index 106d07aa31c8..000000000000
--- a/dev-lang/ghc/files/ghc-7.10.3-hardfloat.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-commit 5cc08ebf2f346992a0abd4440252165c90b5ec05
-Author: Sergei Trofimovich <siarheit@google.com>
-Date: Sat Jun 20 12:23:00 2015 +0100
-
- Recognise 'hardhloat' as a valid vendor in a host tuple
-
- Observed on a tuple armv7a-hardfloat-linux-gnueabi:
- > Unknown vendor hardfloat
-
- Reported-by: Sergey Alirzaev
- Signed-off-by: Sergei Trofimovich <siarheit@google.com>
-
-diff --git a/aclocal.m4 b/aclocal.m4
-index 590edb0..958622c 100644
---- a/aclocal.m4
-+++ b/aclocal.m4
-@@ -1966,6 +1966,9 @@ AC_DEFUN([GHC_CONVERT_VENDOR],[
- softfloat) # like armv5tel-softfloat-linux-gnueabi
- $2="unknown"
- ;;
-+ hardfloat) # like armv7a-hardfloat-linux-gnueabi
-+ $2="unknown"
-+ ;;
- *)
- #pass thru by default
- $2="$1"
diff --git a/dev-lang/ghc/files/ghc-7.10.3-relnotes.patch b/dev-lang/ghc/files/ghc-7.10.3-relnotes.patch
deleted file mode 100644
index 675037946e75..000000000000
--- a/dev-lang/ghc/files/ghc-7.10.3-relnotes.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-diff --git a/ANNOUNCE b/ANNOUNCE
-index 7812eba..0018b37 100644
---- a/ANNOUNCE
-+++ b/ANNOUNCE
-@@ -1,6 +1,6 @@
-
- ==============================================================
-- The (Interactive) Glasgow Haskell Compiler -- version 7.10.2
-+ The (Interactive) Glasgow Haskell Compiler -- version 7.10.3
- ==============================================================
-
- The GHC Team is pleased to announce a new minor release of GHC. This is a
-@@ -29,7 +29,7 @@ bug-fix release and contains a number of important fixes,
- A more thorough list of the changes in the release can be found in the release
- notes,
-
-- http://haskell.org/ghc/docs/7.10.2/html/users_guide/release-7-10-2.html
-+ http://haskell.org/ghc/docs/7.10.3/html/users_guide/release-7-10-3.html
-
-
- How to get it
-diff --git a/docs/users_guide/intro.xml b/docs/users_guide/intro.xml
-index 3292334..fb7116e 100644
---- a/docs/users_guide/intro.xml
-+++ b/docs/users_guide/intro.xml
-@@ -309,6 +309,7 @@
-
- &relnotes1;
- &relnotes2;
-+&relnotes3;
-
- </chapter>
-
-diff --git a/docs/users_guide/ug-ent.xml.in b/docs/users_guide/ug-ent.xml.in
-index b696aad..3629e93 100644
---- a/docs/users_guide/ug-ent.xml.in
-+++ b/docs/users_guide/ug-ent.xml.in
-@@ -5,6 +5,7 @@
- <!ENTITY intro SYSTEM "intro.xml" >
- <!ENTITY relnotes1 SYSTEM "7.10.1-notes.xml" >
- <!ENTITY relnotes2 SYSTEM "7.10.2-notes.xml" >
-+<!ENTITY relnotes3 SYSTEM "7.10.3-notes.xml" >
- <!ENTITY using SYSTEM "using.xml" >
- <!ENTITY code-gens SYSTEM "codegens.xml" >
- <!ENTITY runtime SYSTEM "runtime_control.xml" >
diff --git a/dev-lang/ghc/files/ghc-7.6.3-preserve-inplace-xattr.patch b/dev-lang/ghc/files/ghc-7.6.3-preserve-inplace-xattr.patch
deleted file mode 100644
index 08410fa0cd9b..000000000000
--- a/dev-lang/ghc/files/ghc-7.6.3-preserve-inplace-xattr.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-On hardened 'cp' drops out XT-pax parking.
-perfinion suggested using 'install', where portage
-might have a chance to save our marking.
-
-Reported-by: Jay Yang
-Gentoo-bug: https://bugs.gentoo.org/518734
-diff --git a/rules/build-prog.mk b/rules/build-prog.mk
-index 399369e..2ee9cd5 100644
---- a/rules/build-prog.mk
-+++ b/rules/build-prog.mk
-@@ -288,3 +288,3 @@ endif
- $$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG_INPLACE) | $$$$(dir $$$$@)/.
-- "$$(CP)" -p $$< $$@
-+ $$(INSTALL) -m 755 $$< $$@
diff --git a/dev-lang/ghc/files/ghc-7.8.1_rc1-libbfd.patch b/dev-lang/ghc/files/ghc-7.8.1_rc1-libbfd.patch
deleted file mode 100644
index d01cb49affbd..000000000000
--- a/dev-lang/ghc/files/ghc-7.8.1_rc1-libbfd.patch
+++ /dev/null
@@ -1,81 +0,0 @@
-commit bb5953484579968c984d074ca1af5d21e1c9e7a0
-Author: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Mon Feb 10 12:45:58 2014 +0300
-
- rts: unrust 'libbfd' debug symbols parser
-
- Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
-diff --git a/configure.ac b/configure.ac
-index e7fbc7f..e47979c 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -801,7 +801,8 @@ fi
- dnl ** check whether this machine has BFD and libiberty installed (used for debugging)
- dnl the order of these tests matters: bfd needs libiberty
- AC_CHECK_LIB(iberty, xmalloc)
--AC_CHECK_LIB(bfd, bfd_uncompress_section_contents)
-+dnl 'bfd_init' is a rare non-macro in libbfd
-+AC_CHECK_LIB(bfd, bfd_init)
-
- dnl ################################################################
- dnl Check for libraries
-diff --git a/rts/Printer.c b/rts/Printer.c
-index ca9ca49..ce02b02 100644
---- a/rts/Printer.c
-+++ b/rts/Printer.c
-@@ -48,6 +48,9 @@ void printPtr( StgPtr p )
- raw = lookupGHCName(p);
- if (raw != NULL) {
- printZcoded(raw);
-+ /* it can be just a C symbol, like 'stg_returnToStackTop' */
-+ debugBelch("<%s>", raw);
-+ debugBelch("[%p]", p);
- } else {
- debugBelch("%p", p);
- }
-@@ -794,7 +797,7 @@ static void printZcoded( const char *raw )
- disabling this for now.
- */
- #ifdef USING_LIBBFD
--
-+#include "../mk/config.h" /* silly BFD's requirement */
- #include <bfd.h>
-
- /* Fairly ad-hoc piece of code that seems to filter out a lot of
-@@ -863,7 +866,10 @@ extern void DEBUG_LoadSymbols( char *name )
- for( i = 0; i != number_of_symbols; ++i ) {
- symbol_info info;
- bfd_get_symbol_info(abfd,symbol_table[i],&info);
-- /*debugBelch("\t%c\t0x%x \t%s\n",info.type,(nat)info.value,info.name); */
-+ if (0)
-+ {
-+ debugBelch("\t%c\t0x%x \t%s\n",info.type,(nat)info.value,info.name);
-+ }
- if (isReal(info.type, info.name)) {
- num_real_syms += 1;
- }
-diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
-index aa7306f..5bdef94 100644
---- a/rts/RtsStartup.c
-+++ b/rts/RtsStartup.c
-@@ -19,6 +19,7 @@
- #include "RtsFlags.h"
- #include "RtsUtils.h"
- #include "Prelude.h"
-+#include "Printer.h" /* DEBUG_LoadSymbols */
- #include "Schedule.h" /* initScheduler */
- #include "Stats.h" /* initStats */
- #include "STM.h" /* initSTM */
-@@ -162,6 +163,11 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config)
- rts_config.rts_opts_enabled, rts_config.rts_opts, rts_config.rts_hs_main);
- }
-
-+#ifdef DEBUG
-+ /* load debugging symbols */
-+ DEBUG_LoadSymbols((*argv)[0]);
-+#endif /* DEBUG */
-+
- /* Initialise the stats department, phase 1 */
- initStats1();
-
diff --git a/dev-lang/ghc/files/ghc-7.8.2-cgen-constify.patch b/dev-lang/ghc/files/ghc-7.8.2-cgen-constify.patch
deleted file mode 100644
index efdd54fbf3fb..000000000000
--- a/dev-lang/ghc/files/ghc-7.8.2-cgen-constify.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-commit b0cf3ab7a69b878a4335d21a347b56e4b0ca0b7b
-Author: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Mon Apr 14 19:06:24 2014 +0300
-
- compiler/cmm/PprC.hs: constify local string literals
-
- Consider one-line module
- module B (v) where v = "hello"
- in -fvia-C mode it generates code like
- static char gibberish_str[] = "hello";
-
- It uselessly eats data section (precious resource on ia64!).
- The patch switches genrator to emit:
- static const char gibberish_str[] = "hello";
-
- Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
-diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs
-index 2398981..fdb578d 100644
---- a/compiler/cmm/PprC.hs
-+++ b/compiler/cmm/PprC.hs
-@@ -112,6 +112,12 @@ pprTop (CmmProc infos clbl _ graph) =
-
- -- We only handle (a) arrays of word-sized things and (b) strings.
-
-+pprTop (CmmData ReadOnlyData (Statics lbl [CmmString str])) =
-+ hcat [
-+ pprLocalness lbl, ptext (sLit "const char "), ppr lbl,
-+ ptext (sLit "[] = "), pprStringInCStyle str, semi
-+ ]
-+
- pprTop (CmmData _section (Statics lbl [CmmString str])) =
- hcat [
- pprLocalness lbl, ptext (sLit "char "), ppr lbl,
diff --git a/dev-lang/ghc/files/ghc-7.8.3-linker-warn.patch b/dev-lang/ghc/files/ghc-7.8.3-linker-warn.patch
deleted file mode 100644
index c8570c06940b..000000000000
--- a/dev-lang/ghc/files/ghc-7.8.3-linker-warn.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-commit 326046739801a380c5457ef4c87bce8fb95497ba
-Author: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Sun Aug 10 22:12:28 2014 +0300
-
- systools info: fix warning about C compiler (message said about linker)
-
- Summary: Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
- Test Plan: build-tested
-
- Reviewers: austin
-
- Reviewed By: austin
-
- Subscribers: phaskell, simonmar, relrod, ezyang, carter
-
- Differential Revision: https://phabricator.haskell.org/D132
-
-diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs
-index 1c1c52c..72fa19b 100644
---- a/compiler/main/SysTools.lhs
-+++ b/compiler/main/SysTools.lhs
-@@ -809,10 +809,10 @@ getCompilerInfo' dflags = do
- )
- (\err -> do
- debugTraceMsg dflags 2
-- (text "Error (figuring out compiler information):" <+>
-+ (text "Error (figuring out C compiler information):" <+>
- text (show err))
- errorMsg dflags $ hang (text "Warning:") 9 $
-- text "Couldn't figure out linker information!" $$
-+ text "Couldn't figure out C compiler information!" $$
- text "Make sure you're using GNU gcc, or clang"
- return UnknownCC)
- return info
diff --git a/dev-lang/ghc/files/ghc-7.8.3-pic-sparc.patch b/dev-lang/ghc/files/ghc-7.8.3-pic-sparc.patch
deleted file mode 100644
index 16a552fdd4be..000000000000
--- a/dev-lang/ghc/files/ghc-7.8.3-pic-sparc.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-commit 78863edbb0751f5c9694ea10c6132a87cfd0ee10
-Author: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Wed Aug 27 22:20:33 2014 +0300
-
- Revert "disable shared libs on sparc (linux/solaris) (fixes #8857)"
-
- This reverts commit 623883f1ed0ee11cc925c4590fb09565403fd231.
-
- The commit a93ab43ab5f40cadbedea2f6342b93c245e91434
- driver: pass '-fPIC' option to assembler as well
- fixes shared libraries on sparc at least on linux.
-
- Properly fixes Issue #8857
-
- Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
-diff --git a/mk/config.mk.in b/mk/config.mk.in
-index c210cd3..392237f 100644
---- a/mk/config.mk.in
-+++ b/mk/config.mk.in
-@@ -97,9 +97,7 @@ endif
- # Some platforms don't support shared libraries
- NoSharedLibsPlatformList = powerpc-unknown-linux \
- x86_64-unknown-mingw32 \
-- i386-unknown-mingw32 \
-- sparc-sun-solaris2 \
-- sparc-unknown-linux
-+ i386-unknown-mingw32
-
- ifeq "$(SOLARIS_BROKEN_SHLD)" "YES"
- NoSharedLibsPlatformList += i386-unknown-solaris2
diff --git a/dev-lang/ghc/files/ghc-7.8.3-ppc32-fPIC.patch b/dev-lang/ghc/files/ghc-7.8.3-ppc32-fPIC.patch
deleted file mode 100644
index 434be8b1bdad..000000000000
--- a/dev-lang/ghc/files/ghc-7.8.3-ppc32-fPIC.patch
+++ /dev/null
@@ -1,351 +0,0 @@
-commit fa31e8f4a0f853848d96549a429083941877bf8d
-Author: Sergei Trofimovich <siarheit@google.com>
-Date: Sun Dec 14 14:30:12 2014 +0000
-
- powerpc: fix and enable shared libraries by default on linux
-
- Summary:
- And fix things all the way down to it. Namely:
- - remove 'r30' from free registers, it's an .LCTOC1 register
- for gcc. generated .plt stubs expect it to be initialised.
- - fix PicBase computation, which originally forgot to use 'tmp'
- reg in 'initializePicBase_ppc.fetchPC'
- - mark 'ForeighTarget's as implicitly using 'PicBase' register
- (see comment for details)
- - add 64-bit MO_Sub and test on alloclimit3/4 regtests
- - fix dynamic label offsets to match with .LCTOC1 offset
-
- Signed-off-by: Sergei Trofimovich <siarheit@google.com>
-
- Test Plan: validate passes equal amount of vanilla/dyn tests
-
- Reviewers: simonmar, erikd, austin
-
- Reviewed By: erikd, austin
-
- Subscribers: carter, thomie
-
- Differential Revision: https://phabricator.haskell.org/D560
-
- GHC Trac Issues: #8024, #9831
-
-diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs
-index 0f2c0ae..37b8ada 100644
---- a/compiler/cmm/CLabel.hs
-+++ b/compiler/cmm/CLabel.hs
-@@ -1170,7 +1170,8 @@ pprDynamicLinkerAsmLabel platform dllInfo lbl
- else if osElfTarget (platformOS platform)
- then if platformArch platform == ArchPPC
- then case dllInfo of
-- CodeStub -> ppr lbl <> text "@plt"
-+ CodeStub -> -- See Note [.LCTOC1 in PPC PIC code]
-+ ppr lbl <> text "+32768@plt"
- SymbolPtr -> text ".LC_" <> ppr lbl
- _ -> panic "pprDynamicLinkerAsmLabel"
- else if platformArch platform == ArchX86_64
-diff --git a/compiler/nativeGen/PIC.hs b/compiler/nativeGen/PIC.hs
-index 9b5c080..6326a8b 100644
---- a/compiler/nativeGen/PIC.hs
-+++ b/compiler/nativeGen/PIC.hs
-@@ -54,7 +54,6 @@ import qualified X86.Instr as X86
-
- import Platform
- import Instruction
--import Size
- import Reg
- import NCGMonad
-
-@@ -468,11 +467,8 @@ pprGotDeclaration dflags ArchX86 OSDarwin
- pprGotDeclaration _ _ OSDarwin
- = empty
-
---- pprGotDeclaration
-+-- Emit GOT declaration
- -- Output whatever needs to be output once per .s file.
---- The .LCTOC1 label is defined to point 32768 bytes into the table,
---- to make the most of the PPC's 16-bit displacements.
---- Only needed for PIC.
- pprGotDeclaration dflags arch os
- | osElfTarget os
- , arch /= ArchPPC_64
-@@ -482,6 +478,7 @@ pprGotDeclaration dflags arch os
- | osElfTarget os
- , arch /= ArchPPC_64
- = vcat [
-+ -- See Note [.LCTOC1 in PPC PIC code]
- ptext (sLit ".section \".got2\",\"aw\""),
- ptext (sLit ".LCTOC1 = .+32768") ]
-
-@@ -688,12 +685,7 @@ pprImportedSymbol _ _ _
-
-
- -- Get a pointer to our own fake GOT, which is defined on a per-module basis.
---- This is exactly how GCC does it, and it's quite horrible:
---- We first fetch the address of a local label (mkPicBaseLabel).
---- Then we add a 16-bit offset to that to get the address of a .long that we
---- define in .text space right next to the proc. This .long literal contains
---- the (32-bit) offset from our local label to our global offset table
---- (.LCTOC1 aka gotOffLabel).
-+-- This is exactly how GCC does it in linux.
-
- initializePicBase_ppc
- :: Arch -> OS -> Reg
-@@ -704,18 +696,9 @@ initializePicBase_ppc ArchPPC os picReg
- (CmmProc info lab live (ListGraph blocks) : statics)
- | osElfTarget os
- = do
-- dflags <- getDynFlags
-- gotOffLabel <- getNewLabelNat
-- tmp <- getNewRegNat $ intSize (wordWidth dflags)
- let
-- gotOffset = CmmData Text $ Statics gotOffLabel [
-- CmmStaticLit (CmmLabelDiffOff gotLabel
-- mkPicBaseLabel
-- 0)
-- ]
-- offsetToOffset
-- = PPC.ImmConstantDiff
-- (PPC.ImmCLbl gotOffLabel)
-+ gotOffset = PPC.ImmConstantDiff
-+ (PPC.ImmCLbl gotLabel)
- (PPC.ImmCLbl mkPicBaseLabel)
-
- blocks' = case blocks of
-@@ -726,15 +709,23 @@ initializePicBase_ppc ArchPPC os picReg
- | bID `mapMember` info = fetchPC b
- | otherwise = b
-
-+ -- GCC does PIC prologs thusly:
-+ -- bcl 20,31,.L1
-+ -- .L1:
-+ -- mflr 30
-+ -- addis 30,30,.LCTOC1-.L1@ha
-+ -- addi 30,30,.LCTOC1-.L1@l
-+ -- TODO: below we use it over temporary register,
-+ -- it can and should be optimised by picking
-+ -- correct PIC reg.
- fetchPC (BasicBlock bID insns) =
- BasicBlock bID (PPC.FETCHPC picReg
-- : PPC.ADDIS tmp picReg (PPC.HI offsetToOffset)
-- : PPC.LD PPC.archWordSize tmp
-- (PPC.AddrRegImm tmp (PPC.LO offsetToOffset))
-- : PPC.ADD picReg picReg (PPC.RIReg picReg)
-+ : PPC.ADDIS picReg picReg (PPC.HA gotOffset)
-+ : PPC.ADDI picReg picReg (PPC.LO gotOffset)
-+ : PPC.MR PPC.r30 picReg
- : insns)
-
-- return (CmmProc info lab live (ListGraph blocks') : gotOffset : statics)
-+ return (CmmProc info lab live (ListGraph blocks') : statics)
-
-
- initializePicBase_ppc ArchPPC OSDarwin picReg
-diff --git a/compiler/nativeGen/PPC/CodeGen.hs b/compiler/nativeGen/PPC/CodeGen.hs
-index ddf483a..c1c4a74 100644
---- a/compiler/nativeGen/PPC/CodeGen.hs
-+++ b/compiler/nativeGen/PPC/CodeGen.hs
-@@ -54,7 +54,7 @@ import Outputable
- import Unique
- import DynFlags
-
--import Control.Monad ( mapAndUnzipM )
-+import Control.Monad ( mapAndUnzipM, when )
- import Data.Bits
- import Data.Word
-
-@@ -355,6 +355,19 @@ iselExpr64 (CmmMachOp (MO_Add _) [e1,e2]) = do
- ADDE rhi r1hi r2hi ]
- return (ChildCode64 code rlo)
-
-+iselExpr64 (CmmMachOp (MO_Sub _) [e1,e2]) = do
-+ ChildCode64 code1 r1lo <- iselExpr64 e1
-+ ChildCode64 code2 r2lo <- iselExpr64 e2
-+ (rlo,rhi) <- getNewRegPairNat II32
-+ let
-+ r1hi = getHiVRegFromLo r1lo
-+ r2hi = getHiVRegFromLo r2lo
-+ code = code1 `appOL`
-+ code2 `appOL`
-+ toOL [ SUBFC rlo r2lo r1lo,
-+ SUBFE rhi r2hi r1hi ]
-+ return (ChildCode64 code rlo)
-+
- iselExpr64 (CmmMachOp (MO_UU_Conv W32 W64) [expr]) = do
- (expr_reg,expr_code) <- getSomeReg expr
- (rlo, rhi) <- getNewRegPairNat II32
-@@ -918,8 +931,12 @@ genCCall' dflags gcp target dest_regs args0
- (toOL []) []
-
- (labelOrExpr, reduceToFF32) <- case target of
-- ForeignTarget (CmmLit (CmmLabel lbl)) _ -> return (Left lbl, False)
-- ForeignTarget expr _ -> return (Right expr, False)
-+ ForeignTarget (CmmLit (CmmLabel lbl)) _ -> do
-+ uses_pic_base_implicitly
-+ return (Left lbl, False)
-+ ForeignTarget expr _ -> do
-+ uses_pic_base_implicitly
-+ return (Right expr, False)
- PrimTarget mop -> outOfLineMachOp mop
-
- let codeBefore = move_sp_down finalStack `appOL` passArgumentsCode
-@@ -940,6 +957,13 @@ genCCall' dflags gcp target dest_regs args0
- where
- platform = targetPlatform dflags
-
-+ uses_pic_base_implicitly = do
-+ -- See Note [implicit register in PPC PIC code]
-+ -- on why we claim to use PIC register here
-+ when (gopt Opt_PIC dflags) $ do
-+ _ <- getPicBaseNat archWordSize
-+ return ()
-+
- initialStackOffset = case gcp of
- GCPDarwin -> 24
- GCPLinux -> 8
-@@ -1431,3 +1455,21 @@ coerceFP2Int _ toRep x = do
- -- read low word of value (high word is undefined)
- LD II32 dst (spRel dflags 3)]
- return (Any (intSize toRep) code')
-+
-+-- Note [.LCTOC1 in PPC PIC code]
-+-- The .LCTOC1 label is defined to point 32768 bytes into the GOT table
-+-- to make the most of the PPC's 16-bit displacements.
-+-- As 16-bit signed offset is used (usually via addi/lwz instructions)
-+-- first element will have '-32768' offset against .LCTOC1.
-+
-+-- Note [implicit register in PPC PIC code]
-+-- PPC generates calls by labels in assembly
-+-- in form of:
-+-- bl puts+32768@plt
-+-- in this form it's not seen directly (by GHC NCG)
-+-- that r30 (PicBaseReg) is used,
-+-- but r30 is a required part of PLT code setup:
-+-- puts+32768@plt:
-+-- lwz r11,-30484(r30) ; offset in .LCTOC1
-+-- mtctr r11
-+-- bctr
-diff --git a/compiler/nativeGen/PPC/Instr.hs b/compiler/nativeGen/PPC/Instr.hs
-index f5b9506..b7081f9 100644
---- a/compiler/nativeGen/PPC/Instr.hs
-+++ b/compiler/nativeGen/PPC/Instr.hs
-@@ -205,8 +205,11 @@ data Instr
- | ADD Reg Reg RI -- dst, src1, src2
- | ADDC Reg Reg Reg -- (carrying) dst, src1, src2
- | ADDE Reg Reg Reg -- (extend) dst, src1, src2
-+ | ADDI Reg Reg Imm -- Add Immediate dst, src1, src2
- | ADDIS Reg Reg Imm -- Add Immediate Shifted dst, src1, src2
- | SUBF Reg Reg Reg -- dst, src1, src2 ; dst = src2 - src1
-+ | SUBFC Reg Reg Reg -- (carrying) dst, src1, src2 ; dst = src2 - src1
-+ | SUBFE Reg Reg Reg -- (extend) dst, src1, src2 ; dst = src2 - src1
- | MULLW Reg Reg RI
- | DIVW Reg Reg Reg
- | DIVWU Reg Reg Reg
-@@ -284,8 +287,11 @@ ppc_regUsageOfInstr platform instr
- ADD reg1 reg2 ri -> usage (reg2 : regRI ri, [reg1])
- ADDC reg1 reg2 reg3 -> usage ([reg2,reg3], [reg1])
- ADDE reg1 reg2 reg3 -> usage ([reg2,reg3], [reg1])
-+ ADDI reg1 reg2 _ -> usage ([reg2], [reg1])
- ADDIS reg1 reg2 _ -> usage ([reg2], [reg1])
- SUBF reg1 reg2 reg3 -> usage ([reg2,reg3], [reg1])
-+ SUBFC reg1 reg2 reg3 -> usage ([reg2,reg3], [reg1])
-+ SUBFE reg1 reg2 reg3 -> usage ([reg2,reg3], [reg1])
- MULLW reg1 reg2 ri -> usage (reg2 : regRI ri, [reg1])
- DIVW reg1 reg2 reg3 -> usage ([reg2,reg3], [reg1])
- DIVWU reg1 reg2 reg3 -> usage ([reg2,reg3], [reg1])
-@@ -358,8 +364,11 @@ ppc_patchRegsOfInstr instr env
- ADD reg1 reg2 ri -> ADD (env reg1) (env reg2) (fixRI ri)
- ADDC reg1 reg2 reg3 -> ADDC (env reg1) (env reg2) (env reg3)
- ADDE reg1 reg2 reg3 -> ADDE (env reg1) (env reg2) (env reg3)
-+ ADDI reg1 reg2 imm -> ADDI (env reg1) (env reg2) imm
- ADDIS reg1 reg2 imm -> ADDIS (env reg1) (env reg2) imm
- SUBF reg1 reg2 reg3 -> SUBF (env reg1) (env reg2) (env reg3)
-+ SUBFC reg1 reg2 reg3 -> SUBFC (env reg1) (env reg2) (env reg3)
-+ SUBFE reg1 reg2 reg3 -> SUBFE (env reg1) (env reg2) (env reg3)
- MULLW reg1 reg2 ri -> MULLW (env reg1) (env reg2) (fixRI ri)
- DIVW reg1 reg2 reg3 -> DIVW (env reg1) (env reg2) (env reg3)
- DIVWU reg1 reg2 reg3 -> DIVWU (env reg1) (env reg2) (env reg3)
-diff --git a/compiler/nativeGen/PPC/Ppr.hs b/compiler/nativeGen/PPC/Ppr.hs
-index 6851769..f59d51f 100644
---- a/compiler/nativeGen/PPC/Ppr.hs
-+++ b/compiler/nativeGen/PPC/Ppr.hs
-@@ -525,6 +525,16 @@ pprInstr (BCTRL _) = hcat [
- ptext (sLit "bctrl")
- ]
- pprInstr (ADD reg1 reg2 ri) = pprLogic (sLit "add") reg1 reg2 ri
-+pprInstr (ADDI reg1 reg2 imm) = hcat [
-+ char '\t',
-+ ptext (sLit "addi"),
-+ char '\t',
-+ pprReg reg1,
-+ ptext (sLit ", "),
-+ pprReg reg2,
-+ ptext (sLit ", "),
-+ pprImm imm
-+ ]
- pprInstr (ADDIS reg1 reg2 imm) = hcat [
- char '\t',
- ptext (sLit "addis"),
-@@ -539,6 +549,8 @@ pprInstr (ADDIS reg1 reg2 imm) = hcat [
- pprInstr (ADDC reg1 reg2 reg3) = pprLogic (sLit "addc") reg1 reg2 (RIReg reg3)
- pprInstr (ADDE reg1 reg2 reg3) = pprLogic (sLit "adde") reg1 reg2 (RIReg reg3)
- pprInstr (SUBF reg1 reg2 reg3) = pprLogic (sLit "subf") reg1 reg2 (RIReg reg3)
-+pprInstr (SUBFC reg1 reg2 reg3) = pprLogic (sLit "subfc") reg1 reg2 (RIReg reg3)
-+pprInstr (SUBFE reg1 reg2 reg3) = pprLogic (sLit "subfe") reg1 reg2 (RIReg reg3)
- pprInstr (MULLW reg1 reg2 ri@(RIReg _)) = pprLogic (sLit "mullw") reg1 reg2 ri
- pprInstr (MULLW reg1 reg2 ri@(RIImm _)) = pprLogic (sLit "mull") reg1 reg2 ri
- pprInstr (DIVW reg1 reg2 reg3) = pprLogic (sLit "divw") reg1 reg2 (RIReg reg3)
-diff --git a/compiler/nativeGen/PPC/Regs.hs b/compiler/nativeGen/PPC/Regs.hs
-index 0f636bf..69e69c0 100644
---- a/compiler/nativeGen/PPC/Regs.hs
-+++ b/compiler/nativeGen/PPC/Regs.hs
-@@ -37,7 +37,8 @@ module PPC.Regs (
- fits16Bits,
- makeImmediate,
- fReg,
-- sp, r3, r4, r27, r28, f1, f20, f21,
-+ sp, r3, r4, r27, r28, r30,
-+ f1, f20, f21,
-
- allocatableRegs
-
-@@ -295,12 +296,13 @@ point registers.
- fReg :: Int -> RegNo
- fReg x = (32 + x)
-
--sp, r3, r4, r27, r28, f1, f20, f21 :: Reg
-+sp, r3, r4, r27, r28, r30, f1, f20, f21 :: Reg
- sp = regSingle 1
- r3 = regSingle 3
- r4 = regSingle 4
- r27 = regSingle 27
- r28 = regSingle 28
-+r30 = regSingle 30
- f1 = regSingle $ fReg 1
- f20 = regSingle $ fReg 20
- f21 = regSingle $ fReg 21
-diff --git a/includes/CodeGen.Platform.hs b/includes/CodeGen.Platform.hs
-index 9916e0e..1d46a01 100644
---- a/includes/CodeGen.Platform.hs
-+++ b/includes/CodeGen.Platform.hs
-@@ -881,6 +881,8 @@ freeReg 1 = fastBool False -- The Stack Pointer
- # if !MACHREGS_darwin
- -- most non-darwin powerpc OSes use r2 as a TOC pointer or something like that
- freeReg 2 = fastBool False
-+-- at least linux in -fPIC relies on r30 in PLT stubs
-+freeReg 30 = fastBool False
- # endif
- # ifdef REG_Base
- freeReg REG_Base = fastBool False
-diff --git a/mk/config.mk.in b/mk/config.mk.in
-index 0f5820f..8f134bc 100644
---- a/mk/config.mk.in
-+++ b/mk/config.mk.in
-@@ -95,7 +95,7 @@ TargetElf = YES
- endif
-
- # Some platforms don't support shared libraries
--NoSharedLibsPlatformList = powerpc-unknown-linux \
-+NoSharedLibsPlatformList = \
- x86_64-unknown-mingw32 \
- i386-unknown-mingw32
-
diff --git a/dev-lang/ghc/files/ghc-7.8.3-prim-lm.patch b/dev-lang/ghc/files/ghc-7.8.3-prim-lm.patch
deleted file mode 100644
index 3ef2313fcec1..000000000000
--- a/dev-lang/ghc/files/ghc-7.8.3-prim-lm.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-Fix underlinking on ghc-prim.
-Fixes ghc-stage2 crahs on hardened toolchain.
-Reported-by: aranea
-diff --git a/libraries/ghc-prim/ghc-prim.cabal b/libraries/ghc-prim/ghc-prim.cabal
-index ffb32af..0431380 100644
---- a/libraries/ghc-prim/ghc-prim.cabal
-+++ b/libraries/ghc-prim/ghc-prim.cabal
-@@ -68,0 +68,4 @@ Library
-+
-+ -- ghc 'sin' (and other) primops generate 'libm' calls,
-+ -- but ghc itself does not add '-lm'
-+ extra-libraries: m
diff --git a/dev-lang/ghc/files/ghc-7.8.4-gold.patch b/dev-lang/ghc/files/ghc-7.8.4-gold.patch
deleted file mode 100644
index a8e9b1e6c857..000000000000
--- a/dev-lang/ghc/files/ghc-7.8.4-gold.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-Gentoo-bug: https://bugs.gentoo.org/536426
-Reported-by: Eric Siegel
-commit 021b7978d14799bae779907faf7490cfd21b3f46
-Author: Austin Seipp <austin@well-typed.com>
-Date: Sun Jul 20 10:13:15 2014 -0500
-
- driver: use absolute paths in ld scripts (#7452)
-
- Patch contributed by slowmo.
-
- Signed-off-by: Austin Seipp <austin@well-typed.com>
-
-diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
-index 11427e2..49126fe 100644
---- a/compiler/main/DriverPipeline.hs
-+++ b/compiler/main/DriverPipeline.hs
-@@ -2166,7 +2166,9 @@ joinObjectFiles dflags o_files output_fn = do
- if ldIsGnuLd
- then do
- script <- newTempName dflags "ldscript"
-- writeFile script $ "INPUT(" ++ unwords o_files ++ ")"
-+ cwd <- getCurrentDirectory
-+ let o_files_abs = map (cwd </>) o_files
-+ writeFile script $ "INPUT(" ++ unwords o_files_abs ++ ")"
- ld_r [SysTools.FileOption "" script] ccInfo
- else if sLdSupportsFilelist mySettings
- then do
diff --git a/dev-lang/ghc/files/ghc-7.8.4-ia64-CLOSUREs.patch b/dev-lang/ghc/files/ghc-7.8.4-ia64-CLOSUREs.patch
deleted file mode 100644
index 9d50792bcf45..000000000000
--- a/dev-lang/ghc/files/ghc-7.8.4-ia64-CLOSUREs.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-From b677ba51cf8131a6f6ddcdfee8dd2a8c4c2b4ac7 Mon Sep 17 00:00:00 2001
-From: Sergei Trofimovich <siarheit@google.com>
-Date: Sat, 17 Jan 2015 14:27:13 +0000
-Subject: [PATCH 1/3] CMM: add a mechanism to import C data labels
-
-Fixes threaded runtime on ia64.
-sm_mutex there was not referenced correctly.
-
-Signed-off-by: Sergei Trofimovich <siarheit@google.com>
----
- compiler/cmm/CmmParse.y | 4 ++++
- rts/Exception.cmm | 2 +-
- rts/PrimOps.cmm | 6 +++---
- 3 files changed, 8 insertions(+), 4 deletions(-)
-
-diff --git a/compiler/cmm/CmmParse.y.source b/compiler/cmm/CmmParse.y.source
-index 6b51e51..fd9489b 100644
---- a/compiler/cmm/CmmParse.y.source
-+++ b/compiler/cmm/CmmParse.y.source
-@@ -575,6 +575,10 @@ importName
- : NAME
- { ($1, mkForeignLabel $1 Nothing ForeignLabelInExternalPackage IsFunction) }
-
-+ -- as previous 'NAME', but 'IsData'
-+ | 'CLOSURE' NAME
-+ { ($2, mkForeignLabel $2 Nothing ForeignLabelInExternalPackage IsData) }
-+
- -- A label imported with an explicit packageId.
- | STRING NAME
- { ($2, mkCmmCodeLabel (fsToPackageKey (mkFastString $1)) $2) }
-diff --git a/rts/Exception.cmm b/rts/Exception.cmm
-index 5007ef3..8d19c14 100644
---- a/rts/Exception.cmm
-+++ b/rts/Exception.cmm
-@@ -13,7 +13,7 @@
- #include "Cmm.h"
- #include "RaiseAsync.h"
-
--import ghczmprim_GHCziTypes_True_closure;
-+import CLOSURE ghczmprim_GHCziTypes_True_closure;
-
- /* -----------------------------------------------------------------------------
- Exception Primitives
-diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
-index 3e8612c..2e6ca46 100644
---- a/rts/PrimOps.cmm
-+++ b/rts/PrimOps.cmm
-@@ -28,12 +28,12 @@
- import pthread_mutex_lock;
- import pthread_mutex_unlock;
- #endif
--import base_ControlziExceptionziBase_nestedAtomically_closure;
-+import CLOSURE base_ControlziExceptionziBase_nestedAtomically_closure;
- import EnterCriticalSection;
- import LeaveCriticalSection;
--import ghczmprim_GHCziTypes_False_closure;
-+import CLOSURE ghczmprim_GHCziTypes_False_closure;
- #if defined(USE_MINIINTERPRETER) || !defined(mingw32_HOST_OS)
--import sm_mutex;
-+import CLOSURE sm_mutex;
- #endif
-
- /*-----------------------------------------------------------------------------
---
-2.2.1
-
diff --git a/dev-lang/ghc/files/ghc-8.0.1-limit-jN.patch b/dev-lang/ghc/files/ghc-8.0.1-limit-jN.patch
deleted file mode 100644
index dc5410da3020..000000000000
--- a/dev-lang/ghc/files/ghc-8.0.1-limit-jN.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-commit 501e05bb1b8974fc8b6c9eee86c87c367e87a211
-Author: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Tue Aug 30 12:10:47 2016 +0100
-
- GhcMake: limit Capability count to CPU count in parallel mode
-
- In Trac #9221 one of problems using high --jobs=<N>
- is amount of mutator (or GC) threads we crate.
-
- We use userspace spinning-and-yielding (see ACQUIRE_SPIN_LOCK)
- to acess work stealing queues. In case of
- N-worker-threads > N-CPUs fraction of time when
- thread holding spin lock gets descheduled by kernel
- increases. That causes other threads to waste CPU time
- before giving up CPU.
-
- Signed-off-by: Sergei Trofimovich <siarheit@google.com>
-
- Test Plan:
- ghc --make -j8 and -j80 have comparable sys time
- on a 8-core system.
-
- Reviewers: austin, gintas, bgamari, simonmar
-
- Reviewed By: bgamari, simonmar
-
- Subscribers: thomie
-
- Differential Revision: https://phabricator.haskell.org/D2482
-
- GHC Trac Issues: #9221
-
-diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs
-index 9dc43cd..905df63 100644
---- a/compiler/main/GhcMake.hs
-+++ b/compiler/main/GhcMake.hs
-@@ -761,7 +761,12 @@ parUpsweep n_jobs old_hpt stable_mods cleanup sccs = do
-
- let updNumCapabilities = liftIO $ do
- n_capabilities <- getNumCapabilities
-- unless (n_capabilities /= 1) $ setNumCapabilities n_jobs
-+ n_cpus <- getNumProcessors
-+ -- Setting number of capabilities more than
-+ -- CPU count usually leads to high userspace
-+ -- lock contention. Trac #9221
-+ let n_caps = min n_jobs n_cpus
-+ unless (n_capabilities /= 1) $ setNumCapabilities n_caps
- return n_capabilities
- -- Reset the number of capabilities once the upsweep ends.
- let resetNumCapabilities orig_n = liftIO $ setNumCapabilities orig_n
diff --git a/dev-lang/ghc/files/ghc-8.0.1-par-g0-on-A32.patch b/dev-lang/ghc/files/ghc-8.0.1-par-g0-on-A32.patch
deleted file mode 100644
index b46e57301782..000000000000
--- a/dev-lang/ghc/files/ghc-8.0.1-par-g0-on-A32.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-commit bdfc5375f219d6def81effda4e57cb56d01fc917
-Author: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Tue Aug 30 12:10:54 2016 +0100
-
- rts: enable parallel GC scan of large (32M+) allocation area
-
- Parallel GC does not scan large allocation area (-A)
- effectively as it does not do work stealing from nursery
- by default.
-
- That leads to large imbalance when only one of threads
- overflows allocation area: most of GC threads finish
- quickly (as there is not much to collect) and sit idle
- waiting while single GC thread finishes scan of single
- allocation area for that thread.
-
- The patch enables work stealing for (equivalent of -qb0)
- allocation area of -A32M or higher.
-
- Tested on a highlighting-kate package from Trac #9221
-
- On 8-core machine the difference is around 5% faster
- of wall-clock time. On 24-core VM the speedup is 20%.
-
- Signed-off-by: Sergei Trofimovich <siarheit@google.com>
-
- Test Plan: measured wall time and GC parallelism on highlighting-kate build
-
- Reviewers: austin, bgamari, erikd, simonmar
-
- Reviewed By: bgamari, simonmar
-
- Subscribers: thomie
-
- Differential Revision: https://phabricator.haskell.org/D2483
-
- GHC Trac Issues: #9221
-
-diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
-index fda33f0..7a719b9 100644
---- a/rts/RtsFlags.c
-+++ b/rts/RtsFlags.c
-@@ -237,1 +237,1 @@ void initRtsFlagsDefaults(void)
-- RtsFlags.ParFlags.parGcLoadBalancingGen = 1;
-+ RtsFlags.ParFlags.parGcLoadBalancingGen = ~0u; /* auto, based on -A */
-@@ -1398,2 +1390,19 @@ static void normaliseRtsOpts (void)
- }
-
-+#ifdef THREADED_RTS
-+ if (RtsFlags.ParFlags.parGcLoadBalancingGen == ~0u) {
-+ StgWord alloc_area_bytes
-+ = RtsFlags.GcFlags.minAllocAreaSize * BLOCK_SIZE;
-+
-+ // If allocation area is larger that CPU cache
-+ // we can finish scanning quicker doing work-stealing
-+ // scan. Trac #9221
-+ // 32M looks big enough not to fit into L2 cache
-+ // of popular modern CPUs.
-+ if (alloc_area_bytes >= 32 * 1024 * 1024) {
-+ RtsFlags.ParFlags.parGcLoadBalancingGen = 0;
-+ } else {
-+ RtsFlags.ParFlags.parGcLoadBalancingGen = 1;
-+ }
-+ }
-+#endif
diff --git a/dev-lang/ghc/files/ghc-8.0.1-ww-args-limit.patch b/dev-lang/ghc/files/ghc-8.0.1-ww-args-limit.patch
deleted file mode 100644
index 4752f4482678..000000000000
--- a/dev-lang/ghc/files/ghc-8.0.1-ww-args-limit.patch
+++ /dev/null
@@ -1,127 +0,0 @@
-commit 5efbf0d243984444cf352ad6f0d147e226c64498
-Author: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Thu Sep 1 17:34:58 2016 +0100
-
- restore -fmax-worker-args handling (Trac #11565)
-
- maxWorkerArgs handling was accidentally lost 3 years ago
- in a major update of demand analysis
- commit 0831a12ea2fc73c33652eeec1adc79fa19700578
-
- Old regression is noticeable as:
- - code bloat (requires stack reshuffling)
- - compilation slowdown (more code to optimise/generate)
- - and increased heap usage (DynFlags unboxing/reboxing?)
-
- On a simple compile benchmark this change causes heap
- allocation drop from 70G don to 67G (ghc perf build).
-
- Signed-off-by: Sergei Trofimovich <siarheit@google.com>
-
- Reviewers: simonpj, ezyang, goldfire, austin, bgamari
-
- Reviewed By: simonpj, ezyang
-
- Subscribers: thomie
-
- Differential Revision: https://phabricator.haskell.org/D2503
-
- GHC Trac Issues: #11565
-
-diff --git a/compiler/specialise/SpecConstr.hs b/compiler/specialise/SpecConstr.hs
-index 10d5614..7166f57 100644
---- a/compiler/specialise/SpecConstr.hs
-+++ b/compiler/specialise/SpecConstr.hs
-@@ -29,7 +29,7 @@ import CoreFVs ( exprsFreeVarsList )
- import CoreMonad
- import Literal ( litIsLifted )
- import HscTypes ( ModGuts(..) )
--import WwLib ( mkWorkerArgs )
-+import WwLib ( isWorkerSmallEnough, mkWorkerArgs )
- import DataCon
- import Coercion hiding( substCo )
- import Rules
-@@ -1533,10 +1533,14 @@ specialise env bind_calls (RI { ri_fn = fn, ri_lam_bndrs = arg_bndrs
-
- | Just all_calls <- lookupVarEnv bind_calls fn
- = -- pprTrace "specialise entry {" (ppr fn <+> ppr (length all_calls)) $
-- do { (boring_call, pats) <- callsToPats env specs arg_occs all_calls
--
-+ do { (boring_call, all_pats) <- callsToPats env specs arg_occs all_calls
- -- Bale out if too many specialisations
-- ; let n_pats = length pats
-+ ; let pats = filter (is_small_enough . fst) all_pats
-+ is_small_enough vars = isWorkerSmallEnough (sc_dflags env) vars
-+ -- We are about to construct w/w pair in 'spec_one'.
-+ -- Omit specialisation leading to high arity workers.
-+ -- See Note [Limit w/w arity]
-+ n_pats = length pats
- spec_count' = n_pats + spec_count
- ; case sc_count env of
- Just max | not (sc_force env) && spec_count' > max
-diff --git a/compiler/stranal/WwLib.hs b/compiler/stranal/WwLib.hs
-index 09bc204..d9460d9 100644
---- a/compiler/stranal/WwLib.hs
-+++ b/compiler/stranal/WwLib.hs
-@@ -8,6 +8,7 @@
-
- module WwLib ( mkWwBodies, mkWWstr, mkWorkerArgs
- , deepSplitProductType_maybe, findTypeShape
-+ , isWorkerSmallEnough
- ) where
-
- #include "HsVersions.h"
-@@ -144,7 +145,8 @@ mkWwBodies dflags fam_envs fun_ty demands res_info one_shots
- wrapper_body = wrap_fn_args . wrap_fn_cpr . wrap_fn_str . applyToVars work_call_args . Var
- worker_body = mkLams work_lam_args. work_fn_str . work_fn_cpr . work_fn_args
-
-- ; if useful1 && not (only_one_void_argument) || useful2
-+ ; if isWorkerSmallEnough dflags work_args
-+ && (useful1 && not only_one_void_argument || useful2)
- then return (Just (worker_args_dmds, wrapper_body, worker_body))
- else return Nothing
- }
-@@ -165,6 +167,12 @@ mkWwBodies dflags fam_envs fun_ty demands res_info one_shots
- | otherwise
- = False
-
-+-- See Note [Limit w/w arity]
-+isWorkerSmallEnough :: DynFlags -> [Var] -> Bool
-+isWorkerSmallEnough dflags vars = count isId vars <= maxWorkerArgs dflags
-+ -- We count only Free variables (isId) to skip Type, Kind
-+ -- variables which have no runtime representation.
-+
- {-
- Note [Always do CPR w/w]
- ~~~~~~~~~~~~~~~~~~~~~~~~
-@@ -178,6 +186,30 @@ a disaster, because then the enclosing function might say it has the CPR
- property, but now doesn't and there a cascade of disaster. A good example
- is Trac #5920.
-
-+Note [Limit w/w arity]
-+~~~~~~~~~~~~~~~~~~~~~~~~
-+Guard against high worker arity as it generates a lot of stack traffic.
-+A simplified example is Trac #11565#comment:6
-+
-+Current strategy is very simple: don't perform w/w transformation at all
-+if the result produces a wrapper with arity higher than -fmax-worker-args=.
-+
-+It is a bit all or nothing, consider
-+
-+ f (x,y) (a,b,c,d,e ... , z) = rhs
-+
-+Currently we will remove all w/w ness entirely. But actually we could
-+w/w on the (x,y) pair... it's the huge product that is the problem.
-+
-+Could we instead refrain from w/w on an arg-by-arg basis? Yes, that'd
-+solve f. But we can get a lot of args from deeply-nested products:
-+
-+ g (a, (b, (c, (d, ...)))) = rhs
-+
-+This is harder to spot on an arg-by-arg basis. Previously mkWwStr was
-+given some "fuel" saying how many arguments it could add; when we ran
-+out of fuel it would stop w/wing.
-+Still not very clever because it had a left-right bias.
-
- ************************************************************************
- * *
diff --git a/dev-lang/ghc/files/ghc-8.0.1_rc1-cgen-constify.patch b/dev-lang/ghc/files/ghc-8.0.1_rc1-cgen-constify.patch
deleted file mode 100644
index 877a5827e4ea..000000000000
--- a/dev-lang/ghc/files/ghc-8.0.1_rc1-cgen-constify.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-commit b0cf3ab7a69b878a4335d21a347b56e4b0ca0b7b
-Author: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Mon Apr 14 19:06:24 2014 +0300
-
- compiler/cmm/PprC.hs: constify local string literals
-
- Consider one-line module
- module B (v) where v = "hello"
- in -fvia-C mode it generates code like
- static char gibberish_str[] = "hello";
-
- It uselessly eats data section (precious resource on ia64!).
- The patch switches genrator to emit:
- static const char gibberish_str[] = "hello";
-
- Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
-diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs
-index 2398981..fdb578d 100644
---- a/compiler/cmm/PprC.hs
-+++ b/compiler/cmm/PprC.hs
-@@ -112,6 +112,12 @@ pprTop (CmmProc infos clbl _ graph) =
-
- -- We only handle (a) arrays of word-sized things and (b) strings.
-
-+pprTop (CmmData (Section ReadOnlyData _) (Statics lbl [CmmString str])) =
-+ hcat [
-+ pprLocalness lbl, ptext (sLit "const char "), ppr lbl,
-+ ptext (sLit "[] = "), pprStringInCStyle str, semi
-+ ]
-+
- pprTop (CmmData _section (Statics lbl [CmmString str])) =
- hcat [
- pprLocalness lbl, ptext (sLit "char "), ppr lbl,
diff --git a/dev-lang/ghc/files/ghc-8.0.2-O2-unreg.patch b/dev-lang/ghc/files/ghc-8.0.2-O2-unreg.patch
deleted file mode 100644
index b64d65b80a05..000000000000
--- a/dev-lang/ghc/files/ghc-8.0.2-O2-unreg.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-ghc -O2 generates too large C files for unregisterised compiler.
-On ia64 it causes DynFlags to compile for 60 minutes (then assembler
-crashes).
-
-To decrease C code inflation we don't use -O2 in UNREG mode.
-diff --git a/mk/config.mk.in b/mk/config.mk.in
-index bfaaa66..d8f93b3 100644
---- a/mk/config.mk.in
-+++ b/mk/config.mk.in
-@@ -72,11 +72,2 @@ GhcStage3HcOpts=-O2
-
--# Disable -O2 optimization. Otherwise amount of generated C code
--# makes things very slow to compile (~5 minutes on core-i7 for 'compiler/hsSyn/HsExpr.lhs')
--# and sometimes not compile at all (powerpc64 overflows something
--# on 'compiler/hsSyn/HsExpr.lhs').
--ifeq "$(GhcUnregisterised)" "YES"
--GhcStage1HcOpts=
--GhcStage2HcOpts=
--GhcStage3HcOpts=
--endif
-
-@@ -894 +885,13 @@ CURSES_INCLUDE_DIRS = @CURSES_INCLUDE_DIRS@
- CURSES_LIB_DIRS = @CURSES_LIB_DIRS@
-+
-+# Disable -O2 optimization. Otherwise amount of generated C code
-+# makes things very slow to compile (~5 minutes on core-i7 for 'compiler/hsSyn/HsExpr.lhs')
-+# and sometimes not compile at all (powerpc64 overflows something
-+# on 'compiler/hsSyn/HsExpr.lhs').
-+ifeq "$(GhcUnregisterised)" "YES"
-+GhcStage1HcOpts=
-+GhcStage2HcOpts=
-+GhcStage3HcOpts=
-+
-+GhcLibHcOpts=
-+endif
diff --git a/dev-lang/ghc/files/ghc-8.0.2-binutils-2.30.patch b/dev-lang/ghc/files/ghc-8.0.2-binutils-2.30.patch
deleted file mode 100644
index f02cb238c6b9..000000000000
--- a/dev-lang/ghc/files/ghc-8.0.2-binutils-2.30.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From 358b508051333882d4099acca8f269e6fb2b7d65 Mon Sep 17 00:00:00 2001
-From: Bertram Felgenhauer <int-e@gmx.de>
-Date: Thu, 3 May 2018 18:03:53 +0300
-Subject: [PATCH] Compute DW_FORM_block length correctly; also fixes #15068
-
-Before this patch, the pprUnwindwExpr function computed the length of
-by the following assembly fragment:
-
- .uleb128 1f-.-1
- <expression data>
-1:
-
-That is, to compute the length, it takes the difference of the label 1
-and the address of the .uleb128 directive, and subtracts 1.
-
-In #15068 it was reported that `as` from binutils 4.30 has trouble with
-evaluating the `.` part of the expression. However, there is actually a
-problem with the expression, if the length of the data ever becomes
-larger than 128: In that case, the .uleb128 directive will emit more
-than 1 byte, and the computed length will be wrong.
-
-The present patch changes the assembly fragment to use two labels,
-which fixes both these problems.
-
- .uleb128 2f-1f
-1:
- <expression data>
-2:
-
-Test Plan: validate
-
-Reviewers: bgamari, osa1
-
-Reviewed By: bgamari
-
-Subscribers: thomie, carter
-
-GHC Trac Issues: #15068
-
-Differential Revision: https://phabricator.haskell.org/D4654
----
- compiler/nativeGen/Dwarf/Types.hs | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/compiler/nativeGen/Dwarf/Types.hs b/compiler/nativeGen/Dwarf/Types.hs
-index 23a2c920e7..579ed0d256 100644
---- a/compiler/nativeGen/Dwarf/Types.hs
-+++ b/compiler/nativeGen/Dwarf/Types.hs
-@@ -492,9 +492,11 @@ pprUnwindExpr spIsCFA expr
- pprE (UwPlus u1 u2) = pprE u1 $$ pprE u2 $$ pprByte dW_OP_plus
- pprE (UwMinus u1 u2) = pprE u1 $$ pprE u2 $$ pprByte dW_OP_minus
- pprE (UwTimes u1 u2) = pprE u1 $$ pprE u2 $$ pprByte dW_OP_mul
-- in text "\t.uleb128 1f-.-1" $$ -- DW_FORM_block length
-+ in text "\t.uleb128 2f-1f" $$ -- DW_FORM_block length
-+ -- computed as the difference of the following local labels 2: and 1:
-+ text "1:" $$
- pprE expr $$
-- text "1:"
-+ text "2:"
-
- -- | Generate code for re-setting the unwind information for a
- -- register to @undefined@
---
-2.17.0
-
diff --git a/dev-lang/ghc/files/ghc-8.0.2-libffi-alpha.patch b/dev-lang/ghc/files/ghc-8.0.2-libffi-alpha.patch
deleted file mode 100644
index 166f7fe42991..000000000000
--- a/dev-lang/ghc/files/ghc-8.0.2-libffi-alpha.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-commit 2c220c4b053c8efb2098ee20910084a42a0b2dcd
-Author: Sergei Trofimovich <siarheit@google.com>
-Date: Sun Jan 29 11:59:36 2017 +0000
-
- libffi: fix build COMPLEX build failure on alpha
-
- libtool: compile: alpha-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude \
- -I../src -I. -I../include -Iinclude -I../src -Wall -w -mieee -D_REENTRANT -fno-stack-protector \
- -w -MT src/alpha/osf.lo -MMD -MP -MF src/alpha/.deps/osf.Tpo \
- -c ../src/alpha/osf.S -fPIC -DPIC -o src/alpha/.libs/osf.o
-
- ../src/alpha/osf.S:298:2: error: #error "osf.S out of sync with ffi.h"
- #error "osf.S out of sync with ffi.h"
- ^
-
- Signed-off-by: Sergei Trofimovich <siarheit@google.com>
-
-diff --git a/libffi/ghc.mk b/libffi/ghc.mk
-index 7c5bc9e1b3..4297ed449e 100644
---- a/libffi/ghc.mk
-+++ b/libffi/ghc.mk
-@@ -63,6 +63,9 @@ $(libffi_STAMP_CONFIGURE): $(TOUCH_DEP)
- # will use cygwin symbolic links which cannot be read by mingw gcc.
- chmod +x libffi/ln
-
-+ # fix libffi build failure on alpha
-+ ( cd libffi/build && "$(PATCH_CMD)" -p0 < ../libffi.3.2.1-complex_alpha.diff; )
-+
- # We need to use -MMD rather than -MD, as otherwise we get paths
- # like c:/... in the dependency files on Windows, and the extra
- # colons break make
-diff --git a/libffi/libffi.3.2.1-complex_alpha.diff b/libffi/libffi.3.2.1-complex_alpha.diff
-new file mode 100644
-index 0000000000..0d6e0bc290
---- /dev/null
-+++ b/libffi/libffi.3.2.1-complex_alpha.diff
-@@ -0,0 +1,20 @@
-+--- src/alpha/osf.S.orig 2015-01-16 10:46:15.000000000 +0100
-++++ src/alpha/osf.S 2015-01-16 10:46:24.000000000 +0100
-+@@ -279,6 +279,7 @@
-+ .gprel32 $load_64 # FFI_TYPE_SINT64
-+ .gprel32 $load_none # FFI_TYPE_STRUCT
-+ .gprel32 $load_64 # FFI_TYPE_POINTER
-++ .gprel32 $load_none # FFI_TYPE_COMPLEX
-+
-+ /* Assert that the table above is in sync with ffi.h. */
-+
-+@@ -294,7 +295,8 @@
-+ || FFI_TYPE_SINT64 != 12 \
-+ || FFI_TYPE_STRUCT != 13 \
-+ || FFI_TYPE_POINTER != 14 \
-+- || FFI_TYPE_LAST != 14
-++ || FFI_TYPE_COMPLEX != 15 \
-++ || FFI_TYPE_LAST != 15
-+ #error "osf.S out of sync with ffi.h"
-+ #endif
-+
diff --git a/dev-lang/ghc/files/ghc-8.0.2-no-relax-everywhere.patch b/dev-lang/ghc/files/ghc-8.0.2-no-relax-everywhere.patch
deleted file mode 100644
index d6cff3373801..000000000000
--- a/dev-lang/ghc/files/ghc-8.0.2-no-relax-everywhere.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-https://github.com/gentoo-haskell/gentoo-haskell/issues/704
-
-Allow users to specify -W,--relax externally and pass
--Wl,-no-relax unconditonally on all arches.
-
-Reported-by: wmyrda
-diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
-index acd0d61..5830517 100644
---- a/compiler/main/DriverPipeline.hs
-+++ b/compiler/main/DriverPipeline.hs
-@@ -2172,5 +2172,3 @@ joinObjectFiles dflags o_files output_fn = do
- -- disable --relax explicitly.
-- ++ (if platformArch (targetPlatform dflags)
-- `elem` [ArchSPARC, ArchSPARC64]
-- && ldIsGnuLd
-+ ++ (if ldIsGnuLd
- then [SysTools.Option "-Wl,-no-relax"]
diff --git a/dev-lang/ghc/files/ghc-8.0.2_rc2-old-sphinx.patch b/dev-lang/ghc/files/ghc-8.0.2_rc2-old-sphinx.patch
deleted file mode 100644
index a4d49d3ef808..000000000000
--- a/dev-lang/ghc/files/ghc-8.0.2_rc2-old-sphinx.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git a/docs/users_guide/profiling.rst b/docs/users_guide/profiling.rst
-index 4d0bb3a..f980f72 100644
---- a/docs/users_guide/profiling.rst
-+++ b/docs/users_guide/profiling.rst
-@@ -435,7 +435,2 @@ To generate a heap profile from your program:
-
--For example, here is a heap profile produced for the ``sphere`` program
--from GHC's ``nofib`` benchmark suite,
--
--.. image:: images/prof_scc.*
--
- You might also want to take a look at
diff --git a/dev-lang/ghc/files/ghc-8.2.1-darwin.patch b/dev-lang/ghc/files/ghc-8.2.1-darwin.patch
deleted file mode 100644
index 53fedc4e4402..000000000000
--- a/dev-lang/ghc/files/ghc-8.2.1-darwin.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From d39a3409acd3c40fb018ec1c114f15d3ecef6ef9 Mon Sep 17 00:00:00 2001
-From: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Thu, 1 Jun 2017 22:30:05 +0100
-Subject: [PATCH] aclocal.m4: add support for versioned darwin triplets
-
-The change adds support for 'darwin*' OS:
- $ ./configure --target=aarch64-apple-darwin14
-
-Reported-by: jp_rider
-Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
----
- aclocal.m4 | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/aclocal.m4 b/aclocal.m4
-index 7ad9c36453..437974a0c7 100644
---- a/aclocal.m4
-+++ b/aclocal.m4
-@@ -1906,6 +1906,9 @@ AC_DEFUN([GHC_CONVERT_OS],[
- aix*) # e.g. powerpc-ibm-aix7.1.3.0
- $3="aix"
- ;;
-+ darwin*) # e.g. aarch64-apple-darwin14
-+ $3="darwin"
-+ ;;
- freebsd*) # like i686-gentoo-freebsd7
- # i686-gentoo-freebsd8
- # i686-gentoo-freebsd8.2
---
-2.14.1
-
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc1-cgen-constify.patch b/dev-lang/ghc/files/ghc-8.2.1_rc1-cgen-constify.patch
deleted file mode 100644
index 2e1ef932b454..000000000000
--- a/dev-lang/ghc/files/ghc-8.2.1_rc1-cgen-constify.patch
+++ /dev/null
@@ -1,378 +0,0 @@
-From 7e00046772e053c63ac93630a60b0f396e32a2d7 Mon Sep 17 00:00:00 2001
-From: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Sun, 16 Apr 2017 10:43:38 +0100
-Subject: [PATCH] compiler/cmm/PprC.hs: constify labels in .rodata
-
-Summary:
-Consider one-line module
- module B (v) where v = "hello"
-in -fvia-C mode it generates code like
- static char gibberish_str[] = "hello";
-
-It resides in data section (precious resource on ia64!).
-The patch switches genrator to emit:
- static const char gibberish_str[] = "hello";
-
-Other types if symbols that gained 'const' qualifier are:
-
-- info tables (from haskell and CMM)
-- static reference tables (from haskell and CMM)
-
-Cleanups along the way:
-
-- fixed info tables defined in .cmm to reside in .rodata
-- split out closure declaration into 'IC_' / 'EC_'
-- added label declaration (based on label type) right before
- each label definition (based on section type) so that C
- compiler could check if declaration and definition matches
- at definition site.
-
-Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
-Test Plan: ran testsuite on unregisterised x86_64 compiler
-
-Reviewers: simonmar, ezyang, austin, bgamari, erikd
-
-Subscribers: rwbarton, thomie
-
-GHC Trac Issues: #8996
-
-Differential Revision: https://phabricator.haskell.org/D3481
----
- compiler/cmm/CLabel.hs | 24 ++++++++++++++
- compiler/cmm/Cmm.hs | 13 ++++++++
- compiler/cmm/CmmInfo.hs | 2 +-
- compiler/cmm/PprC.hs | 62 +++++++++++++++++++++++-------------
- compiler/llvmGen/LlvmCodeGen/Data.hs | 12 -------
- includes/Stg.h | 22 +++++++++----
- includes/rts/storage/InfoTables.h | 2 +-
- includes/stg/MiscClosures.h | 14 ++++----
- 8 files changed, 102 insertions(+), 49 deletions(-)
-
-diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs
-index 3ba4f7647a..62c8037e9c 100644
---- a/compiler/cmm/CLabel.hs
-+++ b/compiler/cmm/CLabel.hs
-@@ -89,6 +89,8 @@ module CLabel (
- foreignLabelStdcallInfo,
- isBytesLabel,
- isForeignLabel,
-+ isSomeRODataLabel,
-+ isStaticClosureLabel,
- mkCCLabel, mkCCSLabel,
-
- DynamicLinkerLabelInfo(..),
-@@ -575,6 +577,28 @@ isForeignLabel :: CLabel -> Bool
- isForeignLabel (ForeignLabel _ _ _ _) = True
- isForeignLabel _lbl = False
-
-+-- | Whether label is a static closure label (can come from haskell or cmm)
-+isStaticClosureLabel :: CLabel -> Bool
-+-- Closure defined in haskell (.hs)
-+isStaticClosureLabel (IdLabel _ _ Closure) = True
-+-- Closure defined in cmm
-+isStaticClosureLabel (CmmLabel _ _ CmmClosure) = True
-+isStaticClosureLabel _lbl = False
-+
-+-- | Whether label is a .rodata label
-+isSomeRODataLabel :: CLabel -> Bool
-+-- info table defined in haskell (.hs)
-+isSomeRODataLabel (IdLabel _ _ ClosureTable) = True
-+isSomeRODataLabel (IdLabel _ _ ConInfoTable) = True
-+isSomeRODataLabel (IdLabel _ _ InfoTable) = True
-+isSomeRODataLabel (IdLabel _ _ LocalInfoTable) = True
-+-- static reference tables defined in haskell (.hs)
-+isSomeRODataLabel (IdLabel _ _ SRT) = True
-+isSomeRODataLabel (SRTLabel _) = True
-+-- info table defined in cmm (.cmm)
-+isSomeRODataLabel (CmmLabel _ _ CmmInfo) = True
-+isSomeRODataLabel _lbl = False
-+
- -- | Get the label size field from a ForeignLabel
- foreignLabelStdcallInfo :: CLabel -> Maybe Int
- foreignLabelStdcallInfo (ForeignLabel _ info _ _) = info
-diff --git a/compiler/cmm/Cmm.hs b/compiler/cmm/Cmm.hs
-index d2ee531686..bab20f3fdd 100644
---- a/compiler/cmm/Cmm.hs
-+++ b/compiler/cmm/Cmm.hs
-@@ -9,6 +9,7 @@ module Cmm (
- CmmBlock,
- RawCmmDecl, RawCmmGroup,
- Section(..), SectionType(..), CmmStatics(..), CmmStatic(..),
-+ isSecConstant,
-
- -- ** Blocks containing lists
- GenBasicBlock(..), blockId,
-@@ -167,6 +168,18 @@ data SectionType
- | OtherSection String
- deriving (Show)
-
-+-- | Should a data in this section be considered constant
-+isSecConstant :: Section -> Bool
-+isSecConstant (Section t _) = case t of
-+ Text -> True
-+ ReadOnlyData -> True
-+ RelocatableReadOnlyData -> True
-+ ReadOnlyData16 -> True
-+ CString -> True
-+ Data -> False
-+ UninitialisedData -> False
-+ (OtherSection _) -> False
-+
- data Section = Section SectionType CLabel
-
- data CmmStatic
-diff --git a/compiler/cmm/CmmInfo.hs b/compiler/cmm/CmmInfo.hs
-index b5e800a977..35e3a1888d 100644
---- a/compiler/cmm/CmmInfo.hs
-+++ b/compiler/cmm/CmmInfo.hs
-@@ -133,7 +133,7 @@ mkInfoTable dflags proc@(CmmProc infos entry_lbl live blocks)
- --
- return (top_decls ++
- [CmmProc mapEmpty entry_lbl live blocks,
-- mkDataLits (Section Data info_lbl) info_lbl
-+ mkRODataLits info_lbl
- (CmmLabel entry_lbl : rel_std_info ++ rel_extra_bits)])
-
- --
-diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs
-index 56de94079f..21ed6f6516 100644
---- a/compiler/cmm/PprC.hs
-+++ b/compiler/cmm/PprC.hs
-@@ -83,12 +83,13 @@ pprC tops = vcat $ intersperse blankLine $ map pprTop tops
- -- top level procs
- --
- pprTop :: RawCmmDecl -> SDoc
--pprTop (CmmProc infos clbl _ graph) =
-+pprTop (CmmProc infos clbl _in_live_regs graph) =
-
- (case mapLookup (g_entry graph) infos of
- Nothing -> empty
-- Just (Statics info_clbl info_dat) -> pprDataExterns info_dat $$
-- pprWordArray info_clbl info_dat) $$
-+ Just (Statics info_clbl info_dat) ->
-+ pprDataExterns info_dat $$
-+ pprWordArray info_is_in_rodata info_clbl info_dat) $$
- (vcat [
- blankLine,
- extern_decls,
-@@ -99,6 +100,8 @@ pprTop (CmmProc infos clbl _ graph) =
- rbrace ]
- )
- where
-+ -- info tables are always in .rodata
-+ info_is_in_rodata = True
- blocks = toBlockListEntryFirst graph
- (temp_decls, extern_decls) = pprTempAndExternDecls blocks
-
-@@ -107,21 +110,23 @@ pprTop (CmmProc infos clbl _ graph) =
-
- -- We only handle (a) arrays of word-sized things and (b) strings.
-
--pprTop (CmmData _section (Statics lbl [CmmString str])) =
-+pprTop (CmmData section (Statics lbl [CmmString str])) =
-+ pprExternDecl lbl $$
- hcat [
-- pprLocalness lbl, text "char ", ppr lbl,
-+ pprLocalness lbl, pprConstness (isSecConstant section), text "char ", ppr lbl,
- text "[] = ", pprStringInCStyle str, semi
- ]
-
--pprTop (CmmData _section (Statics lbl [CmmUninitialised size])) =
-+pprTop (CmmData section (Statics lbl [CmmUninitialised size])) =
-+ pprExternDecl lbl $$
- hcat [
-- pprLocalness lbl, text "char ", ppr lbl,
-+ pprLocalness lbl, pprConstness (isSecConstant section), text "char ", ppr lbl,
- brackets (int size), semi
- ]
-
--pprTop (CmmData _section (Statics lbl lits)) =
-+pprTop (CmmData section (Statics lbl lits)) =
- pprDataExterns lits $$
-- pprWordArray lbl lits
-+ pprWordArray (isSecConstant section) lbl lits
-
- -- --------------------------------------------------------------------------
- -- BasicBlocks are self-contained entities: they always end in a jump.
-@@ -141,10 +146,12 @@ pprBBlock block =
- -- Info tables. Just arrays of words.
- -- See codeGen/ClosureInfo, and nativeGen/PprMach
-
--pprWordArray :: CLabel -> [CmmStatic] -> SDoc
--pprWordArray lbl ds
-+pprWordArray :: Bool -> CLabel -> [CmmStatic] -> SDoc
-+pprWordArray is_ro lbl ds
- = sdocWithDynFlags $ \dflags ->
-- hcat [ pprLocalness lbl, text "StgWord"
-+ -- TODO: align closures only
-+ pprExternDecl lbl $$
-+ hcat [ pprLocalness lbl, pprConstness is_ro, text "StgWord"
- , space, ppr lbl, text "[]"
- -- See Note [StgWord alignment]
- , pprAlignment (wordWidth dflags)
-@@ -180,6 +187,10 @@ pprLocalness :: CLabel -> SDoc
- pprLocalness lbl | not $ externallyVisibleCLabel lbl = text "static "
- | otherwise = empty
-
-+pprConstness :: Bool -> SDoc
-+pprConstness is_ro | is_ro = text "const "
-+ | otherwise = empty
-+
- -- --------------------------------------------------------------------------
- -- Statements.
- --
-@@ -984,31 +995,38 @@ is_cishCC JavaScriptCallConv = False
- pprTempAndExternDecls :: [CmmBlock] -> (SDoc{-temps-}, SDoc{-externs-})
- pprTempAndExternDecls stmts
- = (pprUFM (getUniqSet temps) (vcat . map pprTempDecl),
-- vcat (map (pprExternDecl False{-ToDo-}) (Map.keys lbls)))
-+ vcat (map pprExternDecl (Map.keys lbls)))
- where (temps, lbls) = runTE (mapM_ te_BB stmts)
-
- pprDataExterns :: [CmmStatic] -> SDoc
- pprDataExterns statics
-- = vcat (map (pprExternDecl False{-ToDo-}) (Map.keys lbls))
-+ = vcat (map pprExternDecl (Map.keys lbls))
- where (_, lbls) = runTE (mapM_ te_Static statics)
-
- pprTempDecl :: LocalReg -> SDoc
- pprTempDecl l@(LocalReg _ rep)
- = hcat [ machRepCType rep, space, pprLocalReg l, semi ]
-
--pprExternDecl :: Bool -> CLabel -> SDoc
--pprExternDecl _in_srt lbl
-+pprExternDecl :: CLabel -> SDoc
-+pprExternDecl lbl
- -- do not print anything for "known external" things
- | not (needsCDecl lbl) = empty
- | Just sz <- foreignLabelStdcallInfo lbl = stdcall_decl sz
- | otherwise =
-- hcat [ visibility, label_type lbl,
-- lparen, ppr lbl, text ");" ]
-+ hcat [ visibility, label_type lbl , lparen, ppr lbl, text ");"
-+ -- occasionally useful to see label type
-+ -- , text "/* ", pprDebugCLabel lbl, text " */"
-+ ]
- where
-- label_type lbl | isBytesLabel lbl = text "B_"
-- | isForeignLabel lbl && isCFunctionLabel lbl = text "FF_"
-- | isCFunctionLabel lbl = text "F_"
-- | otherwise = text "I_"
-+ label_type lbl | isBytesLabel lbl = text "B_"
-+ | isForeignLabel lbl && isCFunctionLabel lbl
-+ = text "FF_"
-+ | isCFunctionLabel lbl = text "F_"
-+ | isStaticClosureLabel lbl = text "C_"
-+ -- generic .rodata labels
-+ | isSomeRODataLabel lbl = text "RO_"
-+ -- generic .data labels (common case)
-+ | otherwise = text "RW_"
-
- visibility
- | externallyVisibleCLabel lbl = char 'E'
-diff --git a/compiler/llvmGen/LlvmCodeGen/Data.hs b/compiler/llvmGen/LlvmCodeGen/Data.hs
-index 9bb5a75bda..adb86d312d 100644
---- a/compiler/llvmGen/LlvmCodeGen/Data.hs
-+++ b/compiler/llvmGen/LlvmCodeGen/Data.hs
-@@ -56,18 +56,6 @@ genLlvmData (sec, Statics lbl xs) = do
-
- return ([globDef], [tyAlias])
-
---- | Should a data in this section be considered constant
--isSecConstant :: Section -> Bool
--isSecConstant (Section t _) = case t of
-- Text -> True
-- ReadOnlyData -> True
-- RelocatableReadOnlyData -> True
-- ReadOnlyData16 -> True
-- CString -> True
-- Data -> False
-- UninitialisedData -> False
-- (OtherSection _) -> False
--
- -- | Format the section type part of a Cmm Section
- llvmSectionType :: Platform -> SectionType -> FastString
- llvmSectionType p t = case t of
-diff --git a/includes/Stg.h b/includes/Stg.h
-index 619984d8e5..b1b3190307 100644
---- a/includes/Stg.h
-+++ b/includes/Stg.h
-@@ -223,13 +223,23 @@ typedef StgInt I_;
- typedef StgWord StgWordArray[];
- typedef StgFunPtr F_;
-
--#define EB_(X) extern char X[]
--#define IB_(X) static char X[]
--#define EI_(X) extern StgWordArray (X) GNU_ATTRIBUTE(aligned (8))
--#define II_(X) static StgWordArray (X) GNU_ATTRIBUTE(aligned (8))
-+/* byte arrays (and strings): */
-+#define EB_(X) extern const char X[]
-+#define IB_(X) static const char X[]
-+/* static (non-heap) closures (requires alignment for pointer tagging): */
-+#define EC_(X) extern StgWordArray (X) GNU_ATTRIBUTE(aligned (8))
-+#define IC_(X) static StgWordArray (X) GNU_ATTRIBUTE(aligned (8))
-+/* writable data (does not require alignment): */
-+#define ERW_(X) extern StgWordArray (X)
-+#define IRW_(X) static StgWordArray (X)
-+/* read-only data (does not require alignment): */
-+#define ERO_(X) extern const StgWordArray (X)
-+#define IRO_(X) static const StgWordArray (X)
-+/* stg-native functions: */
- #define IF_(f) static StgFunPtr GNUC3_ATTRIBUTE(used) f(void)
--#define FN_(f) StgFunPtr f(void)
--#define EF_(f) StgFunPtr f(void) /* External Cmm functions */
-+#define FN_(f) StgFunPtr f(void)
-+#define EF_(f) StgFunPtr f(void) /* External Cmm functions */
-+/* foreign functions: */
- #define EFF_(f) void f() /* See Note [External function prototypes] */
-
- /* Note [External function prototypes] See Trac #8965, #11395
-diff --git a/includes/rts/storage/InfoTables.h b/includes/rts/storage/InfoTables.h
-index 307aac371c..163f1d1c87 100644
---- a/includes/rts/storage/InfoTables.h
-+++ b/includes/rts/storage/InfoTables.h
-@@ -266,7 +266,7 @@ typedef struct {
- } StgFunInfoTable;
-
- // canned bitmap for each arg type, indexed by constants in FunTypes.h
--extern StgWord stg_arg_bitmaps[];
-+extern const StgWord stg_arg_bitmaps[];
-
- /* -----------------------------------------------------------------------------
- Return info tables
-diff --git a/includes/stg/MiscClosures.h b/includes/stg/MiscClosures.h
-index 9d907ab3ba..b604f1c42b 100644
---- a/includes/stg/MiscClosures.h
-+++ b/includes/stg/MiscClosures.h
-@@ -21,10 +21,10 @@
- #define STGMISCCLOSURES_H
-
- #if IN_STG_CODE
--# define RTS_RET_INFO(i) extern W_(i)[]
--# define RTS_FUN_INFO(i) extern W_(i)[]
--# define RTS_THUNK_INFO(i) extern W_(i)[]
--# define RTS_INFO(i) extern W_(i)[]
-+# define RTS_RET_INFO(i) extern const W_(i)[]
-+# define RTS_FUN_INFO(i) extern const W_(i)[]
-+# define RTS_THUNK_INFO(i) extern const W_(i)[]
-+# define RTS_INFO(i) extern const W_(i)[]
- # define RTS_CLOSURE(i) extern W_(i)[]
- # define RTS_FUN_DECL(f) extern DLL_IMPORT_RTS StgFunPtr f(void)
- #else
-@@ -489,9 +489,9 @@ extern StgWord RTS_VAR(sched_mutex);
-
- // Apply.cmm
- // canned bitmap for each arg type
--extern StgWord stg_arg_bitmaps[];
--extern StgWord stg_ap_stack_entries[];
--extern StgWord stg_stack_save_entries[];
-+extern const StgWord stg_arg_bitmaps[];
-+extern const StgWord stg_ap_stack_entries[];
-+extern const StgWord stg_stack_save_entries[];
-
- // Storage.c
- extern unsigned int RTS_VAR(g0);
---
-2.12.2
-
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc1-ghci-cross.patch b/dev-lang/ghc/files/ghc-8.2.1_rc1-ghci-cross.patch
deleted file mode 100644
index dbba18e85c7f..000000000000
--- a/dev-lang/ghc/files/ghc-8.2.1_rc1-ghci-cross.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-commit 732b3dbbff194eb8650c75afd79d892801afa0dc
-Author: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Thu Apr 6 22:48:13 2017 +0100
-
- add $(CrossCompilePrefix) to 'runghc' and 'ghci'
-
- When Stage1Only=YES install mode is used one of rare tools
- that lack $(CrossCompilePrefix) prefix are 'runghc' and 'ghci'.
-
- This causes file collisions when multiple GHC crosscompilers
- are installed in system.
-
- Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
-diff --git a/driver/ghci/ghc.mk b/driver/ghci/ghc.mk
-index 41d1f15c17..0f31884080 100644
---- a/driver/ghci/ghc.mk
-+++ b/driver/ghci/ghc.mk
-@@ -16,16 +16,16 @@ ifneq "$(Windows_Host)" "YES"
- install: install_driver_ghci
-
- .PHONY: install_driver_ghci
--install_driver_ghci: WRAPPER=$(DESTDIR)$(bindir)/ghci-$(ProjectVersion)
-+install_driver_ghci: WRAPPER=$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghci-$(ProjectVersion)
- install_driver_ghci:
- $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
- $(call removeFiles, "$(WRAPPER)")
- $(CREATE_SCRIPT) "$(WRAPPER)"
- echo '#!$(SHELL)' >> "$(WRAPPER)"
-- echo 'exec "$(bindir)/ghc-$(ProjectVersion)" --interactive "$$@"' >> "$(WRAPPER)"
-+ echo 'exec "$(bindir)/$(CrossCompilePrefix)ghc-$(ProjectVersion)" --interactive "$$@"' >> "$(WRAPPER)"
- $(EXECUTABLE_FILE) "$(WRAPPER)"
-- $(call removeFiles,"$(DESTDIR)$(bindir)/ghci")
-- $(LN_S) ghci-$(ProjectVersion) "$(DESTDIR)$(bindir)/ghci"
-+ $(call removeFiles,"$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghci")
-+ $(LN_S) $(CrossCompilePrefix)ghci-$(ProjectVersion) "$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghci"
-
- else # Windows_Host...
-
-diff --git a/utils/runghc/ghc.mk b/utils/runghc/ghc.mk
-index 9169ca21bd..50b11a612e 100644
---- a/utils/runghc/ghc.mk
-+++ b/utils/runghc/ghc.mk
-@@ -34,11 +34,11 @@ install: install_runhaskell
- .PHONY: install_runhaskell
- ifeq "$(Windows_Host)" "YES"
- install_runhaskell: install_bins
-- "$(CP)" $(DESTDIR)$(bindir)/runghc$(exeext1) $(DESTDIR)$(bindir)/runhaskell$(exeext1)
-+ "$(CP)" $(DESTDIR)$(bindir)/$(CrossCompilePrefix)runghc$(exeext1) $(DESTDIR)$(bindir)/$(CrossCompilePrefix)runhaskell$(exeext1)
- else
- install_runhaskell:
-- $(call removeFiles,"$(DESTDIR)$(bindir)/runhaskell")
-- $(LN_S) runghc "$(DESTDIR)$(bindir)/runhaskell"
-- $(call removeFiles,"$(DESTDIR)$(bindir)/runghc")
-- $(LN_S) runghc-$(ProjectVersion) "$(DESTDIR)$(bindir)/runghc"
-+ $(call removeFiles,"$(DESTDIR)$(bindir)/$(CrossCompilePrefix)runhaskell")
-+ $(LN_S) $(CrossCompilePrefix)runghc "$(DESTDIR)$(bindir)/$(CrossCompilePrefix)runhaskell"
-+ $(call removeFiles,"$(DESTDIR)$(bindir)/$(CrossCompilePrefix)runghc")
-+ $(LN_S) $(CrossCompilePrefix)runghc-$(ProjectVersion) "$(DESTDIR)$(bindir)/$(CrossCompilePrefix)runghc"
- endif
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc1-hp2ps-cross.patch b/dev-lang/ghc/files/ghc-8.2.1_rc1-hp2ps-cross.patch
deleted file mode 100644
index 26382b3cf44c..000000000000
--- a/dev-lang/ghc/files/ghc-8.2.1_rc1-hp2ps-cross.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-commit ff84d052850b637b03bbb98cf05202e44886257d
-Author: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Sat Apr 8 10:02:34 2017 +0100
-
- cross-build 'unlit' and 'hp2ps' for stage2 install
-
- In navive build case it does not matter much if we build
- 'unlit' and 'hp2ps' tools with ghc-stage0 or ghc-stage1:
- both GHCs are native compilers and both tools are written
- in C (have no haskell code).
-
- But in cross-case the difference is substantial:
- In Stag1Only=YES case we need to install native tools built
- by ghc-stage0/${host}-cc.
- In Stag1Only=NO case we need to install cross-built tools
- built by ghc-stage1/${target}-cc.
-
- Before this change GHC did not have a rule to build cross-built
- 'unlit' and 'hp2ps'.
-
- The change adds cross-built 'unlit' and 'hp2ps' as 'dist-install'
- targets.
-
- 'inplace/lib/bin/unlit.bin' target is unchanged and still contains
- native binary.
-
- As a result this change allows cross-building and packaging whole
- GHC for target platform!
-
- Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
-diff --git a/utils/hp2ps/ghc.mk b/utils/hp2ps/ghc.mk
-index f6e01ec6c1..21ce87dcfa 100644
---- a/utils/hp2ps/ghc.mk
-+++ b/utils/hp2ps/ghc.mk
-@@ -10,6 +10,7 @@
- #
- # -----------------------------------------------------------------------------
-
-+# stage0
- utils/hp2ps_dist_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \
- Reorder.c TopTwenty.c AuxFile.c Deviation.c \
- HpFile.c Marks.c Scale.c TraceElement.c \
-@@ -17,11 +18,27 @@ utils/hp2ps_dist_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \
- Utilities.c
- utils/hp2ps_dist_EXTRA_LIBRARIES = m
- utils/hp2ps_dist_PROGNAME = hp2ps
--utils/hp2ps_dist_INSTALL = YES
- utils/hp2ps_dist_INSTALL_INPLACE = YES
- utils/hp2ps_dist_SHELL_WRAPPER = YES
- utils/hp2ps_dist_INSTALL_SHELL_WRAPPER_NAME = hp2ps
-
- utils/hp2ps_CC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS))
-
-+# stage 1
-+utils/hp2ps_dist-install_C_SRCS = $(utils/hp2ps_dist_C_SRCS)
-+utils/hp2ps_dist-install_EXTRA_LIBRARIES = $(utils/hp2ps_dist_EXTRA_LIBRARIES)
-+utils/hp2ps_dist-install_PROGNAME = $(utils/hp2ps_dist_PROGNAME)
-+utils/hp2ps_dist-install_INSTALL_INPLACE = NO
-+utils/hp2ps_dist-install_SHELL_WRAPPER = YES
-+utils/hp2ps_dist-install_INSTALL_SHELL_WRAPPER_NAME = $(utils/hp2ps_dist_INSTALL_SHELL_WRAPPER_NAME)
-+
-+ifeq "$(Stage1Only)" "YES"
-+utils/hp2ps_dist_INSTALL = YES
-+utils/hp2ps_dist-install_INSTALL = NO
-+else
-+utils/hp2ps_dist_INSTALL = NO
-+utils/hp2ps_dist-install_INSTALL = YES
-+endif
-+
- $(eval $(call build-prog,utils/hp2ps,dist,0))
-+$(eval $(call build-prog,utils/hp2ps,dist-install,1))
-diff --git a/utils/unlit/ghc.mk b/utils/unlit/ghc.mk
-index e947989b5e..8911f4e856 100644
---- a/utils/unlit/ghc.mk
-+++ b/utils/unlit/ghc.mk
-@@ -10,11 +10,25 @@
- #
- # -----------------------------------------------------------------------------
-
-+# built by ghc-stage0
- utils/unlit_dist_C_SRCS = unlit.c
- utils/unlit_dist_PROGNAME = unlit
- utils/unlit_dist_TOPDIR = YES
--utils/unlit_dist_INSTALL = YES
- utils/unlit_dist_INSTALL_INPLACE = YES
-
--$(eval $(call build-prog,utils/unlit,dist,0))
-+# built by ghc-stage1
-+utils/unlit_dist-install_C_SRCS = $(utils/unlit_dist_C_SRCS)
-+utils/unlit_dist-install_PROGNAME = $(utils/unlit_dist_PROGNAME)
-+utils/unlit_dist-install_TOPDIR = $(utils/unlit_dist_TOPDIR)
-+utils/unlit_dist-install_INSTALL_INPLACE = NO
-+
-+ifeq "$(Stage1Only)" "YES"
-+utils/unlit_dist_INSTALL = YES
-+utils/unlit_dist-install_INSTALL = NO
-+else
-+utils/unlit_dist_INSTALL = NO
-+utils/unlit_dist-install_INSTALL = YES
-+endif
-
-+$(eval $(call build-prog,utils/unlit,dist,0))
-+$(eval $(call build-prog,utils/unlit,dist-install,1))
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc1-stage2-cross.patch b/dev-lang/ghc/files/ghc-8.2.1_rc1-stage2-cross.patch
deleted file mode 100644
index 1439d722fef4..000000000000
--- a/dev-lang/ghc/files/ghc-8.2.1_rc1-stage2-cross.patch
+++ /dev/null
@@ -1,81 +0,0 @@
-commit 54895c90440cb81f18657537b91f2aa35bd54173
-Author: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Fri Apr 7 10:08:58 2017 +0100
-
- fix 'make install' for cross-stage2
-
- When cross-built GHC is being installed one of
- latest steps is to register installed libraries
- with 'ghc-pkg'.
-
- GHC uses freshly installed 'ghc-pkg' and 'ghc-stage2'
- for that.
-
- Tested as:
- ./configure --target=aarch64-unknown-linux-gnu
- make install DESTDIR=$(pwd)/__s2 STRIP_CMD=:
-
- Before the change install failed on ghc-pkg execution phase:
-
- ".../ghc-cross/__s2/usr/local/lib/ghc-8.3.20170406/bin/ghc-pkg" \
- --force \
- --global-package-db \
- ".../ghc-cross/__s2/usr/local/lib/ghc-8.3.20170406/package.conf.d" \
- update rts/dist/package.conf.install
- /bin/sh: .../ghc-cross/__s2/usr/local/lib/ghc-8.3.20170406/bin/ghc-pkg: \
- No such file or directory
-
- To avoid breakage we use 'ghc' and 'ghc-pkg' built by stage0.
-
- Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
- Test Plan: run 'make install' on stage2 crosscompiler
-
- Reviewers: rwbarton, austin, bgamari
-
- Subscribers: thomie, snowleopard
-
- Differential Revision: https://phabricator.haskell.org/D3432
-
-diff --git a/ghc.mk b/ghc.mk
-index caa6c38fbb..8971f25981 100644
---- a/ghc.mk
-+++ b/ghc.mk
-@@ -962,6 +962,12 @@ endif
-
- INSTALLED_PACKAGE_CONF=$(DESTDIR)$(topdir)/package.conf.d
-
-+ifeq "$(CrossCompiling)" "YES"
-+# when installing ghc-stage2 we can't run target's
-+# 'ghc-pkg' and 'ghc-stage2' but those are needed for registration.
-+INSTALLED_GHC_REAL=$(TOP)/inplace/bin/ghc-stage1
-+INSTALLED_GHC_PKG_REAL=$(TOP)/$(ghc-pkg_DIST_BINARY)
-+else # CrossCompiling
- # Install packages in the right order, so that ghc-pkg doesn't complain.
- # Also, install ghc-pkg first.
- ifeq "$(Windows_Host)" "NO"
-@@ -971,6 +977,7 @@ else
- INSTALLED_GHC_REAL=$(DESTDIR)$(bindir)/ghc.exe
- INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe
- endif
-+endif # CrossCompiling
-
- # Set the INSTALL_DISTDIR_p for each package; compiler is special
- $(foreach p,$(filter-out compiler,$(INSTALL_PACKAGES)),\
-diff --git a/utils/ghc-pkg/ghc.mk b/utils/ghc-pkg/ghc.mk
-index 002c8122f2..4d5ef4e108 100644
---- a/utils/ghc-pkg/ghc.mk
-+++ b/utils/ghc-pkg/ghc.mk
-@@ -49,6 +49,12 @@ utils/ghc-pkg_dist_PROGNAME = ghc-pkg
- utils/ghc-pkg_dist_SHELL_WRAPPER = YES
- utils/ghc-pkg_dist_INSTALL_INPLACE = YES
-
-+# When cross-built ghc-stage2 is installed 'make install' needs to call
-+# native ghc-pkg (not the cross-built one) to register installed packages
-+# 'ghc-pkg_DIST_BINARY' variable only refer to native binary.
-+ghc-pkg_DIST_BINARY_NAME = ghc-pkg$(exeext0)
-+ghc-pkg_DIST_BINARY = utils/ghc-pkg/dist/build/tmp/$(ghc-pkg_DIST_BINARY_NAME)
-+
- # See Note [Stage1Only vs stage=1] in mk/config.mk.in.
- ifeq "$(Stage1Only)" "YES"
- # Install the copy of ghc-pkg from the dist directory when running 'make
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc1-staged-cross.patch b/dev-lang/ghc/files/ghc-8.2.1_rc1-staged-cross.patch
deleted file mode 100644
index 7e4ea7a9f610..000000000000
--- a/dev-lang/ghc/files/ghc-8.2.1_rc1-staged-cross.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-commit f2685df3b10e13f142736f28835e9064334bc143
-Author: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Wed Apr 5 22:31:37 2017 +0100
-
- avoid $(CrossCompilerPrefix) for stage2 install
-
- Suppose we are crossbuilding ghc (when ghc-stage2
- is a normal compiler for $target):
-
- For this case 'make install' should install unprefixed
- stage2 'ghc' and not '$(CorssCompilePrefix)-ghc'.
-
- That way cross-built ghc is installable and
- usable on target as if it would be built natively
- on a target.
-
- Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
-diff --git a/mk/config.mk.in b/mk/config.mk.in
-index 4d5d82aa80..5e274bb71f 100644
---- a/mk/config.mk.in
-+++ b/mk/config.mk.in
-@@ -530,7 +530,7 @@ SUPPORTS_THIS_UNIT_ID = @SUPPORTS_THIS_UNIT_ID@
- # needs to know which gcc you're using in order to perform its tests.
-
- GccVersion = @GccVersion@
--CrossCompilePrefix = @CrossCompilePrefix@
-+
- # TargetPlatformFull retains the string passed to configure so we have it in
- # the necessary format to pass to libffi's configure.
- TargetPlatformFull = @TargetPlatformFull@
-@@ -567,6 +567,11 @@ CrossCompiling = @CrossCompiling@
- # See Note [Stage1Only vs stage=1]
- Stage1Only = NO
-
-+# Installed tools prefix:
-+# we add prefix to crosscompiler GHC only (ghc-stage1),
-+# not cross-built GHC (not ghc-stage2).
-+CrossCompilePrefix = $(if $(filter YES,$(Stage1Only)),@CrossCompilePrefix@,)
-+
- # Install stage 2 by default, or stage 1 in the cross compiler
- # case. Can be changed to 3
- INSTALL_GHC_STAGE= $(if $(filter YES,$(Stage1Only)),1,2)
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc1-unphased-cross.patch b/dev-lang/ghc/files/ghc-8.2.1_rc1-unphased-cross.patch
deleted file mode 100644
index a5528956de14..000000000000
--- a/dev-lang/ghc/files/ghc-8.2.1_rc1-unphased-cross.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-commit 6ff98b962db15d18eb1d082fe344cef692ecef8e
-Author: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Thu Apr 6 08:55:56 2017 +0100
-
- config.mk.in: remove phase=0 hack for CrossCompilePrefix
-
- $(CrossCompilePrefix) is used only in 'make install'
- target filenames in $(DESTDIR). None of inplace (or boot)
- files contain $(CrossCompilePrefix).
-
- Thus we don't need to worry about phases.
-
- Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
-diff --git a/mk/config.mk.in b/mk/config.mk.in
-index 4e61eea821..4d5d82aa80 100644
---- a/mk/config.mk.in
-+++ b/mk/config.mk.in
-@@ -530,11 +530,7 @@ SUPPORTS_THIS_UNIT_ID = @SUPPORTS_THIS_UNIT_ID@
- # needs to know which gcc you're using in order to perform its tests.
-
- GccVersion = @GccVersion@
--ifeq "$(phase)" "0"
--CrossCompilePrefix =
--else
- CrossCompilePrefix = @CrossCompilePrefix@
--endif
- # TargetPlatformFull retains the string passed to configure so we have it in
- # the necessary format to pass to libffi's configure.
- TargetPlatformFull = @TargetPlatformFull@
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc1-win32-cross-1.patch b/dev-lang/ghc/files/ghc-8.2.1_rc1-win32-cross-1.patch
deleted file mode 100644
index 79751e1ecbda..000000000000
--- a/dev-lang/ghc/files/ghc-8.2.1_rc1-win32-cross-1.patch
+++ /dev/null
@@ -1,124 +0,0 @@
-commit a691f6a7a191a268380805481d8e63134764a4a1
-Author: Sergei Trofimovich <slyfox@inbox.ru>
-Date: Sat Apr 29 22:02:24 2017 +0100
-
- add basic cross-compilation support (#87)
-
- * fix include case: s/#include <Lmcons.h>/#include <lmcons.h>
-
- Noticed when cross-compiling win32 on linux to i686-w64-mingw32-gcc.
- i686-w64-mingw32 provides all headers in lowercase.
-
- Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
- * Pen.hsc: don't use c99-style comments in enum declarations
-
- Ths change workarounds hsc2hs bug in cross-compile mode:
- https://ghc.haskell.org/trac/ghc/ticket/13619
-
- To reproduce the build failure it's enough to run
- $ cabal configure --hsc2hs-options='--cross-safe --cross-compile'
- $ cabal build --hsc2hs-options='--cross-safe --cross-compile'
-
- Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
- * SimpleMAPI.hsc: don't use #ifdef in enum declarations
-
- This change workarounds hsc2hs bug in cross-compile mode:
- https://ghc.haskell.org/trac/ghc/ticket/13620
-
- To reproduce the build failure it's enough to run
- $ cabal configure --hsc2hs-options='--cross-safe --cross-compile'
- $ cabal build --hsc2hs-options='--cross-safe --cross-compile'
-
- Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
-diff --git a/Graphics/Win32/GDI/Pen.hsc b/Graphics/Win32/GDI/Pen.hsc
-index c880170..8d8df5d 100644
---- a/Graphics/Win32/GDI/Pen.hsc
-+++ b/Graphics/Win32/GDI/Pen.hsc
-@@ -56,7 +56,7 @@ foreign import WINDOWS_CCONV unsafe "windows.h DeleteObject"
-
- type PenStyle = INT
-
--#{enum PenStyle, // Pick one of these
-+#{enum PenStyle,
- , pS_SOLID = PS_SOLID // default
- , pS_DASH = PS_DASH // -------
- , pS_DOT = PS_DOT // .......
-@@ -69,14 +69,14 @@ type PenStyle = INT
- , pS_STYLE_MASK = PS_STYLE_MASK // all the above
- }
-
--#{enum PenStyle , // "or" with one of these
-+#{enum PenStyle,
- , pS_ENDCAP_ROUND = PS_ENDCAP_ROUND // default
- , pS_ENDCAP_SQUARE = PS_ENDCAP_SQUARE
- , pS_ENDCAP_FLAT = PS_ENDCAP_FLAT
- , pS_ENDCAP_MASK = PS_ENDCAP_MASK // all the above
- }
-
--#{enum PenStyle, // "or" with one of these
-+#{enum PenStyle,
- , pS_JOIN_ROUND = PS_JOIN_ROUND // default
- , pS_JOIN_BEVEL = PS_JOIN_BEVEL
- , pS_JOIN_MITER = PS_JOIN_MITER
-@@ -87,7 +87,7 @@ If PS_JOIN_MASK is not defined with your GNU Windows32 header files,
- you'll have to define it.
- -}
-
--#{enum PenStyle, // "or" with one of these
-+#{enum PenStyle,
- , pS_COSMETIC = PS_COSMETIC // default
- , pS_GEOMETRIC = PS_GEOMETRIC
- , pS_TYPE_MASK = PS_TYPE_MASK // all the above
-diff --git a/System/Win32/Info/Computer.hsc b/System/Win32/Info/Computer.hsc
-index bb2eb72..65ae8dc 100644
---- a/System/Win32/Info/Computer.hsc
-+++ b/System/Win32/Info/Computer.hsc
-@@ -65,7 +65,7 @@ import System.Win32.Utils ( tryWithoutNull )
- import System.Win32.Word ( DWORD, LPDWORD )
-
- #include <windows.h>
--#include <Lmcons.h>
-+#include <lmcons.h>
- #include "alignment.h"
- ##include "windows_cconv.h"
-
-diff --git a/System/Win32/SimpleMAPI.hsc b/System/Win32/SimpleMAPI.hsc
-index 9727cfc..5ebf06b 100644
---- a/System/Win32/SimpleMAPI.hsc
-+++ b/System/Win32/SimpleMAPI.hsc
-@@ -53,12 +53,6 @@ type MapiFlag = ULONG
- , mAPI_LOGON_UI = MAPI_LOGON_UI
- , mAPI_NEW_SESSION = MAPI_NEW_SESSION
- , mAPI_FORCE_DOWNLOAD = MAPI_FORCE_DOWNLOAD
--#ifdef MAPI_LOGOFF_SHARED
-- , mAPI_LOGOFF_SHARED = MAPI_LOGOFF_SHARED
--#endif
--#ifdef MAPI_LOGOFF_UI
-- , mAPI_LOGOFF_UI = MAPI_LOGOFF_UI
--#endif
- , mAPI_DIALOG = MAPI_DIALOG
- , mAPI_UNREAD_ONLY = MAPI_UNREAD_ONLY
- , mAPI_LONG_MSGID = MAPI_LONG_MSGID
-@@ -74,6 +68,19 @@ type MapiFlag = ULONG
- , mAPI_RECEIPT_REQUESTED = MAPI_RECEIPT_REQUESTED
- , mAPI_SENT = MAPI_SENT
- }
-+-- Have to define enum values outside previous declaration due to
-+-- hsc2hs bug in --cross-compile mode:
-+-- https://ghc.haskell.org/trac/ghc/ticket/13620
-+#ifdef MAPI_LOGOFF_SHARED
-+#{enum MapiFlag,
-+ , mAPI_LOGOFF_SHARED = MAPI_LOGOFF_SHARED
-+}
-+#endif
-+#ifdef MAPI_LOGOFF_UI
-+#{enum MapiFlag,
-+ , mAPI_LOGOFF_UI = MAPI_LOGOFF_UI
-+}
-+#endif
-
- mapiErrors :: [(ULONG,String)]
- mapiErrors =
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc1-win32-cross-2-hack.patch b/dev-lang/ghc/files/ghc-8.2.1_rc1-win32-cross-2-hack.patch
deleted file mode 100644
index 6fdcf2d1278f..000000000000
--- a/dev-lang/ghc/files/ghc-8.2.1_rc1-win32-cross-2-hack.patch
+++ /dev/null
@@ -1,144 +0,0 @@
-hsc2hs can't detect values at compile-time if those are
-declared as pointers: https://github.com/haskell/win32/issues/88
-
-This patch is a huge hack: we encode absolute vaues from <windows.h>
-diff --git a/Graphics/Win32/GDI/Types.hsc b/Graphics/Win32/GDI/Types.hsc
-index c363530..8643cee 100644
---- a/Graphics/Win32/GDI/Types.hsc
-+++ b/Graphics/Win32/GDI/Types.hsc
-@@ -216,10 +216,10 @@ type HWND = HANDLE
- type MbHWND = Maybe HWND
-
- #{enum HWND, castUINTPtrToPtr
-- , hWND_BOTTOM = (UINT_PTR)HWND_BOTTOM
-- , hWND_NOTOPMOST = (UINT_PTR)HWND_NOTOPMOST
-- , hWND_TOP = (UINT_PTR)HWND_TOP
-- , hWND_TOPMOST = (UINT_PTR)HWND_TOPMOST
-+ , hWND_BOTTOM = (UINT_PTR)(INT_PTR)(1)
-+ , hWND_NOTOPMOST = (UINT_PTR)(INT_PTR)(-2)
-+ , hWND_TOP = (UINT_PTR)(INT_PTR)(0)
-+ , hWND_TOPMOST = (UINT_PTR)(INT_PTR)(-1)
- }
-
- type HMENU = HANDLE
-diff --git a/Graphics/Win32/Misc.hsc b/Graphics/Win32/Misc.hsc
-index 1248b5a..c791a20 100644
---- a/Graphics/Win32/Misc.hsc
-+++ b/Graphics/Win32/Misc.hsc
-@@ -67,23 +67,23 @@ foreign import WINDOWS_CCONV unsafe "windows.h LoadIconW"
- c_LoadIcon :: HINSTANCE -> Icon -> IO HICON
-
- #{enum Cursor, castUINTPtrToPtr
-- , iDC_ARROW = (UINT_PTR)IDC_ARROW
-- , iDC_IBEAM = (UINT_PTR)IDC_IBEAM
-- , iDC_WAIT = (UINT_PTR)IDC_WAIT
-- , iDC_CROSS = (UINT_PTR)IDC_CROSS
-- , iDC_UPARROW = (UINT_PTR)IDC_UPARROW
-- , iDC_SIZENWSE = (UINT_PTR)IDC_SIZENWSE
-- , iDC_SIZENESW = (UINT_PTR)IDC_SIZENESW
-- , iDC_SIZEWE = (UINT_PTR)IDC_SIZEWE
-- , iDC_SIZENS = (UINT_PTR)IDC_SIZENS
-+ , iDC_ARROW = (UINT_PTR)(32512)
-+ , iDC_IBEAM = (UINT_PTR)(32513)
-+ , iDC_WAIT = (UINT_PTR)(32514)
-+ , iDC_CROSS = (UINT_PTR)(32515)
-+ , iDC_UPARROW = (UINT_PTR)(32516)
-+ , iDC_SIZENWSE = (UINT_PTR)(32642)
-+ , iDC_SIZENESW = (UINT_PTR)(32643)
-+ , iDC_SIZEWE = (UINT_PTR)(32644)
-+ , iDC_SIZENS = (UINT_PTR)(32645)
- }
-
- #{enum Icon, castUINTPtrToPtr
-- , iDI_APPLICATION = (UINT_PTR)IDI_APPLICATION
-- , iDI_HAND = (UINT_PTR)IDI_HAND
-- , iDI_QUESTION = (UINT_PTR)IDI_QUESTION
-- , iDI_EXCLAMATION = (UINT_PTR)IDI_EXCLAMATION
-- , iDI_ASTERISK = (UINT_PTR)IDI_ASTERISK
-+ , iDI_APPLICATION = (UINT_PTR)(32512)
-+ , iDI_HAND = (UINT_PTR)(32513)
-+ , iDI_QUESTION = (UINT_PTR)(32514)
-+ , iDI_EXCLAMATION = (UINT_PTR)(32515)
-+ , iDI_ASTERISK = (UINT_PTR)(32516)
- }
-
- ----------------------------------------------------------------
-diff --git a/Graphics/Win32/Resource.hsc b/Graphics/Win32/Resource.hsc
-index e8ad565..ca58fa2 100644
---- a/Graphics/Win32/Resource.hsc
-+++ b/Graphics/Win32/Resource.hsc
-@@ -61,23 +61,23 @@ foreign import WINDOWS_CCONV unsafe "windows.h EndUpdateResourceW"
- type ResourceType = LPCTSTR
-
- #{enum ResourceType, castUINTPtrToPtr
-- , rT_ACCELERATOR = (UINT_PTR)RT_ACCELERATOR // Accelerator table
-- , rT_ANICURSOR = (UINT_PTR)RT_ANICURSOR // Animated cursor
-- , rT_ANIICON = (UINT_PTR)RT_ANIICON // Animated icon
-- , rT_BITMAP = (UINT_PTR)RT_BITMAP // Bitmap resource
-- , rT_CURSOR = (UINT_PTR)RT_CURSOR // Hardware-dependent cursor resource
-- , rT_DIALOG = (UINT_PTR)RT_DIALOG // Dialog box
-- , rT_FONT = (UINT_PTR)RT_FONT // Font resource
-- , rT_FONTDIR = (UINT_PTR)RT_FONTDIR // Font directory resource
-- , rT_GROUP_CURSOR = (UINT_PTR)RT_GROUP_CURSOR // Hardware-independent cursor resource
-- , rT_GROUP_ICON = (UINT_PTR)RT_GROUP_ICON // Hardware-independent icon resource
-- , rT_HTML = (UINT_PTR)RT_HTML // HTML document
-- , rT_ICON = (UINT_PTR)RT_ICON // Hardware-dependent icon resource
-- , rT_MENU = (UINT_PTR)RT_MENU // Menu resource
-- , rT_MESSAGETABLE = (UINT_PTR)RT_MESSAGETABLE // Message-table entry
-- , rT_RCDATA = (UINT_PTR)RT_RCDATA // Application-defined resource (raw data)
-- , rT_STRING = (UINT_PTR)RT_STRING // String-table entry
-- , rT_VERSION = (UINT_PTR)RT_VERSION // Version resource
-+ , rT_ACCELERATOR = (UINT_PTR)(9)
-+ , rT_ANICURSOR = (UINT_PTR)(21)
-+ , rT_ANIICON = (UINT_PTR)(22)
-+ , rT_BITMAP = (UINT_PTR)(2)
-+ , rT_CURSOR = (UINT_PTR)(1)
-+ , rT_DIALOG = (UINT_PTR)(5)
-+ , rT_FONT = (UINT_PTR)(8)
-+ , rT_FONTDIR = (UINT_PTR)(7)
-+ , rT_GROUP_CURSOR = (UINT_PTR)(1 + DIFFERENCE)
-+ , rT_GROUP_ICON = (UINT_PTR)(3 + DIFFERENCE)
-+ , rT_HTML = (UINT_PTR)(23)
-+ , rT_ICON = (UINT_PTR)(3)
-+ , rT_MENU = (UINT_PTR)(4)
-+ , rT_MESSAGETABLE = (UINT_PTR)(11)
-+ , rT_RCDATA = (UINT_PTR)(10)
-+ , rT_STRING = (UINT_PTR)(6)
-+ , rT_VERSION = (UINT_PTR)(16)
- }
-
- findResource :: HMODULE -> String -> ResourceType -> IO HRSRC
-diff --git a/Graphics/Win32/Window/PostMessage.hsc b/Graphics/Win32/Window/PostMessage.hsc
-index 7f4c9f0..609f3f6 100644
---- a/Graphics/Win32/Window/PostMessage.hsc
-+++ b/Graphics/Win32/Window/PostMessage.hsc
-@@ -41,7 +41,7 @@ foreign import WINDOWS_CCONV "windows.h PostThreadMessageW"
- c_PostThreadMessage :: DWORD -> WindowMessage -> WPARAM -> LPARAM -> IO BOOL
-
- #{enum HWND, castUINTPtrToPtr
-- , hWND_BROADCAST = (UINT_PTR)HWND_BROADCAST
-+ , hWND_BROADCAST = (UINT_PTR)(0xffff)
- }
-
- foreign import WINDOWS_CCONV "windows.h InSendMessage"
-diff --git a/System/Win32/Registry.hsc b/System/Win32/Registry.hsc
-index afbb011..c7edfc1 100644
---- a/System/Win32/Registry.hsc
-+++ b/System/Win32/Registry.hsc
-@@ -80,11 +80,11 @@ import System.Win32.Types (castUINTPtrToPtr, failUnlessSuccessOr, maybePtr)
- #include <windows.h>
-
- #{enum HKEY, (unsafePerformIO . newForeignHANDLE . castUINTPtrToPtr)
-- , hKEY_CLASSES_ROOT = (UINT_PTR)HKEY_CLASSES_ROOT
-- , hKEY_CURRENT_CONFIG = (UINT_PTR)HKEY_CURRENT_CONFIG
-- , hKEY_CURRENT_USER = (UINT_PTR)HKEY_CURRENT_USER
-- , hKEY_LOCAL_MACHINE = (UINT_PTR)HKEY_LOCAL_MACHINE
-- , hKEY_USERS = (UINT_PTR)HKEY_USERS
-+ , hKEY_CLASSES_ROOT = (UINT_PTR)(0x80000000)
-+ , hKEY_CURRENT_CONFIG = (UINT_PTR)(0x80000005)
-+ , hKEY_CURRENT_USER = (UINT_PTR)(0x80000001)
-+ , hKEY_LOCAL_MACHINE = (UINT_PTR)(0x80000002)
-+ , hKEY_USERS = (UINT_PTR)(0x80000003)
- }
- -- , PKEYERFORMANCE_DATA NT only
- -- , HKEY_DYN_DATA 95/98 only
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc2-O2-unreg.patch b/dev-lang/ghc/files/ghc-8.2.1_rc2-O2-unreg.patch
deleted file mode 100644
index 00f9ca4fdff9..000000000000
--- a/dev-lang/ghc/files/ghc-8.2.1_rc2-O2-unreg.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-ghc -O2 generates too large C files for unregisterised compiler.
-On ia64 it causes DynFlags to compile for 60 minutes (then assembler
-crashes).
-
-To decrease C code inflation we don't use -O2 in UNREG mode.
-diff --git a/mk/config.mk.in b/mk/config.mk.in
-index 4e61eea..15a56e9 100644
---- a/mk/config.mk.in
-+++ b/mk/config.mk.in
-@@ -72,11 +72,2 @@ GhcStage3HcOpts=-O2
-
--# Disable -O2 optimization. Otherwise amount of generated C code
--# makes things very slow to compile (~5 minutes on core-i7 for 'compiler/hsSyn/HsExpr.hs')
--# and sometimes not compile at all (powerpc64 overflows something
--# on 'compiler/hsSyn/HsExpr.hs').
--ifeq "$(GhcUnregisterised)" "YES"
--GhcStage1HcOpts=
--GhcStage2HcOpts=
--GhcStage3HcOpts=
--endif
-
-@@ -904 +895,13 @@ CURSES_INCLUDE_DIRS = @CURSES_INCLUDE_DIRS@
- CURSES_LIB_DIRS = @CURSES_LIB_DIRS@
-+
-+# Disable -O2 optimization. Otherwise amount of generated C code
-+# makes things very slow to compile (~5 minutes on core-i7 for 'compiler/hsSyn/HsExpr.hs')
-+# and sometimes not compile at all (powerpc64 overflows something
-+# on 'compiler/hsSyn/HsExpr.hs').
-+ifeq "$(GhcUnregisterised)" "YES"
-+GhcStage1HcOpts=
-+GhcStage2HcOpts=
-+GhcStage3HcOpts=
-+
-+GhcLibHcOpts=
-+endif
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc3-any-vendor.patch b/dev-lang/ghc/files/ghc-8.2.1_rc3-any-vendor.patch
deleted file mode 100644
index b55e37a8bf94..000000000000
--- a/dev-lang/ghc/files/ghc-8.2.1_rc3-any-vendor.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From c2303dff95aa174021a1950656fdf9a1cf983959 Mon Sep 17 00:00:00 2001
-From: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Sat, 8 Jul 2017 09:47:12 +0100
-Subject: [PATCH] aclocal.m4: allow arbitrary <vendor> string in toolchain
- triplets
-
-Canonical triplets have a form of
- <arch>-<vendor>-<os>[-<abi>]
-
-Checking for vendor is almost never correct as it's an
-arbitrary string.
-
-It's useful to have multiple "vendors" to denote
-otherwise the same (WRT <arch>, <os>, <abi>) target:
- --target=x86_64-pc-linux-gnu
- --target=x86_64-unknown-linux-gnu
- --target=x86_64-ghc80-linux-gnu
- --target=x86_64-ghchead-linux-gnu
-
-Do not fail unknown vendors. Only emit a warning.
-Ideally configure checks should never use "vendor".
-
-Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
----
- aclocal.m4 | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/aclocal.m4 b/aclocal.m4
-index 001f813dfc..1d9c09b0cd 100644
---- a/aclocal.m4
-+++ b/aclocal.m4
-@@ -230,8 +230,7 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS],
- dec|none|unknown|hp|apple|next|sun|sgi|ibm|montavista|portbld)
- ;;
- *)
-- echo "Unknown vendor [$]1"
-- exit 1
-+ AC_MSG_WARN([Unknown vendor [$]1])
- ;;
- esac
- }
---
-2.13.3
-
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc3-stginit-data.patch b/dev-lang/ghc/files/ghc-8.2.1_rc3-stginit-data.patch
deleted file mode 100644
index 81e751d778c8..000000000000
--- a/dev-lang/ghc/files/ghc-8.2.1_rc3-stginit-data.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-Fix label type for __stginit_* labels: those are .data labels, not .text
-
-Noticed when was building --enable-unregisterised build for x86_64:
-
-/tmp/ghc22931_0/ghc_3.hc:5:9: error:
- error: '__stginit_ghczmprim_GHCziTypes' redeclared as different kind of symbol
- StgWord __stginit_ghczmprim_GHCziTypes[]__attribute__((aligned(8)))= {
- ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- |
-5 | StgWord __stginit_ghczmprim_GHCziTypes[]__attribute__((aligned(8)))= {
- | ^
-
-In file included from /tmp/ghc22931_0/ghc_3.hc:3:0: error:
-
-/tmp/ghc22931_0/ghc_3.hc:4:5: error:
- note: previous declaration of '__stginit_ghczmprim_GHCziTypes' was here
- EF_(__stginit_ghczmprim_GHCziTypes);
- ^
-diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs
-index 77a889a..05d71ab 100644
---- a/compiler/cmm/CLabel.hs
-+++ b/compiler/cmm/CLabel.hs
-@@ -956,3 +956,3 @@ labelType (CaseLabel _ CaseReturnInfo) = DataLabel
- labelType (CaseLabel _ _) = CodeLabel
--labelType (PlainModuleInitLabel _) = CodeLabel
-+labelType (PlainModuleInitLabel _) = DataLabel
- labelType (SRTLabel _) = DataLabel
diff --git a/dev-lang/ghc/files/ghc-8.4.2-allow-cross-bootstrap.patch b/dev-lang/ghc/files/ghc-8.4.2-allow-cross-bootstrap.patch
deleted file mode 100644
index 071d4970a25b..000000000000
--- a/dev-lang/ghc/files/ghc-8.4.2-allow-cross-bootstrap.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Allow using cross-compilers to bootstrap GHC.
-
-In my case I'm using "cross"-compiler from
-x86_64-unknown-linux to x86_64-HEAD-linux.
-
-Those targets have the same ABI and can boot one another.
-diff --git a/configure.ac b/configure.ac
-index a8b8681a36..791367e8bf 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -228,11 +228,11 @@ FPTOOLS_SET_PLATFORM_VARS
- if test "$BuildPlatform" != "$bootstrap_target"
- then
- echo "This GHC (${WithGhc}) does not generate code for the build platform"
- echo " GHC target platform : $bootstrap_target"
- echo " Desired build platform : $BuildPlatform"
-- exit 1
-+ #exit 1
- fi
-
- # Testing if we shall enable shared libs support on Solaris.
- # Anything older than SunOS 5.11 aka Solaris 11 (Express) is broken.
-
diff --git a/dev-lang/ghc/files/ghc-bash-completion b/dev-lang/ghc/files/ghc-bash-completion
deleted file mode 100644
index 0ee2149cd81b..000000000000
--- a/dev-lang/ghc/files/ghc-bash-completion
+++ /dev/null
@@ -1,218 +0,0 @@
-# ghc-pkg command line completion for bash
-#
-# Copyright 2006-2007 Lennart Kolmodin <kolmodin@dtek.chalmers.se>
-
-_ghc-pkg-get-ghc-pkg()
-{
- echo ghc-pkg
-}
-
-_ghc-pkg-pkg-fields()
-{
- # usage: _ghc-pkg-pkg-fields pkg-id
- #
- # list all fields of the pkg-id
-
- # same fields for all packages but different in different versions of
- # ghc-pkg? this can probably be done better/faster
-
- if [[ -z "$1" ]]; then
- echo "usage: _ghc-pkg-pkg-fields pkg-id"
- return 1
- fi
-
- local fields
-
- fields="$( $(_ghc-pkg-get-ghc-pkg) describe $1 )"
-
- #if [[ fields != *"cannot find package"* ]]; then
- echo "$fields" | grep ".*:.*" | sed "s/^\(.*\):.*\$/\1/"
- #fi
-}
-
-_ghc-pkg-pkg-ids()
-{
- # usage: _ghc-pkg-pkg-ids
- #
- # simply lists all package ids known by ghc-pkg.
- $(_ghc-pkg-get-ghc-pkg) list --simple-output
-}
-
-_ghc-pkg-pkgs()
-{
- # usage: _ghc-pkg-pkgs [include-pkgs] [include-ids]
- #
- # with optional parameter include-pkgs it will list all packages known
- # to ghc-pkg.
- # with optional parameter include-ids it will list all package-ids known
- # to ghc-pkg.
- local pkgs
- local result
- pkgs=( $( _ghc-pkg-pkg-ids ) )
- result=( )
-
- local withPkgs="no" withIds="no"
- while [[ -n "$1" ]]; do
- case "$1" in
- include-pkgs)
- withPkgs="yes" ;;
- include-ids)
- withIds="yes" ;;
- *)
- echo "unknown parameter '$1' to _ghc-pkg-pkgs"
- return 1 ;;
- esac
- shift
- done
-
- # user must supply either include-pkgs, include-ids or both
- if [[ $withPkgs != "yes" && $withIds != "yes" ]]; then
- echo "usage: _ghc-pkg-pkgs [include-pkgs] [include-ids]"
- return 1
- fi
-
- # find all packages if the user requested them
- if [[ $withPkgs == "yes" ]]; then
- # O(n^2) algorithm to exclude duplicates
- for p in ${pkgs[*]}; do
- p="${p//-[0-9.]*/}"
- for existing in ${result[*]}; do
- if [[ "$existing" == "$p" ]]; then
- continue 2
- fi
- done
- result=( "${result[@]}" "${p}" )
- done
- fi
-
- # include all pkg-ids if requested
- if [[ $withIds == "yes" ]]; then
- result=( "${result[@]}" "${pkgs[@]}" )
- fi
-
- # we are finished, echo the result
- echo "${result[*]}"
-
- # happy ending
- return 0
-}
-
-_ghc-pkg()
-{
- local cur
- cur=${COMP_WORDS[COMP_CWORD]}
-
- COMPREPLY=()
-
- local actions flags
- actions='register update unregister expose hide list latest describe field'
- dbflags="--user \
- --global \
- -f --package-conf= \
- --global-conf="
- registerflags="--force \
- -g --auto-ghci-libs \
- -D --define-name="
- listflags="--simple-output"
- flags="$dbflags \
- $registerflags \
- $listflags \
- -? --help \
- -V --version"
-
- # if it's the users first word; complete it and return
- if (($COMP_CWORD == 1)); then
- COMPREPLY=( $( compgen -W "$actions $flags" -- $cur ) )
- return 0
- fi
-
- # now we know we have at least one word written
-
- local action="unknown" \
- prev numwords \
- cword act
- prev=${COMP_WORDS[COMP_CWORD-1]}
- numwords=${#COMP_WORDS[@]}
-
- # find the action with O(n*m) algorithm
- # where n = ${#COMP_WORDS[*]}
- # m = number of actions
- for cword in ${COMP_WORDS[*]}; do
- for act in $actions; do
- if [[ "$cword" == "$act" ]]; then
- action=$cword
- fi
- done
- done
-
- case $action in
- register|update)
- # we want to complete both flags and paths, how?
- # we do it by checking if the user has started to write a flag
- # or a path, and then decide what to complete.
- # that is, to complete a flag, the user must start to write a '-'
- if [[ "$cur" == -* ]]; then
- # (we assume) it's the start of a flag
- # set COMPREPLY to flags relevant to these actions
- COMPREPLY=( $( compgen -W "$dbflags $registerflags" -- $cur ) )
- fi
- ;;
- unregister|expose|hide|list|describe)
- # all these actions can be completed with exactly one argument,
- # a pkg-id.
- COMPREPLY=( $( compgen -W "$dbflags" -- $cur ) )
-
- # add special flags for some actions
- if [[ "$action" == "list" ]]; then
- COMPREPLY+=( $( compgen -W "$listflags" -- $cur ) )
- fi
-
- COMPREPLY+=( $( compgen -W "$( _ghc-pkg-pkgs include-ids )" -- $cur ) )
- ;;
- latest)
- # complete only packages, not package ids
- COMPREPLY=( $( compgen -W "$( _ghc-pkg-pkgs include-pkgs )" -- $cur ) )
- ;;
- field)
- # we should always complete on the flags...
- COMPREPLY=( $( compgen -W "$dbflags" -- $cur ) )
-
- # then, we should either complete the package name or the field
- # lets find out which one
-
- # find the number of words in COMP_WORDS before COMP_CWORD that
- # isn't flags. it should be 2 or 3 for us to complete it,
- # exactly 2 if we should complete the package name
- # exactly 3 if we should complete the field name
- # otherwise, don't do any additional completion except the
- # flags
-
- # count the number of non flags up till the current word
- local numnonflags=0 lastword i
- for (( i=0 ; $i < $COMP_CWORD ; i++ )); do
- if [[ ${COMP_WORDS[$i]} != -* ]]; then
- lastword=${COMP_WORDS[$i]}
- numnonflags=$(( ++numnonflags ))
- fi
- done
-
- case $numnonflags in
- 2)
- # complete on pkg-ids
- COMPREPLY+=( $( compgen -W "$( _ghc-pkg-pkgs include-ids )" -- $cur ) ) ;;
- 3)
- # complete on fields
- COMPREPLY+=( $( compgen -W "$( _ghc-pkg-pkg-fields $lastword )" -- $cur ) ) ;;
- esac
- ;;
- *)
- # unknown action, not yet given by the user
- # return all possible completions
- COMPREPLY=( $( compgen -W "$actions $flags" -- $cur ) )
- ;;
- esac
-}
-
-complete -F _ghc-pkg -o default ghc-pkg
-
-# vim: set ft=sh tw=80 sw=4 et :