Fix a bug in codegen for non-updatable selector thunks (#8817)

To evaluate most non-updatable thunks, we can jump directly to the
entry code if we know what it is.  But not for a selector thunk: these
might be updated by the garbage collector, so we have to enter the
closure with an indirect jump through its info pointer.

(cherry picked from commit b1ddec1e6d4695d71d38b59db26829d71ad784e1)
fix comment on allocate() (#8254)

(cherry picked from commit 68c0d8689dd93cb0ce74a288e82f2ed997c31acc)
Add hs_thread_done() (#8124)

See documentation for details.

(cherry picked from commit af6746fb6b5adb5ba5be6e0f647c4ebe767ce084)
PPC: Fix loads of PIC data with > 16 bit offsets (#7830).

Loads should now handle up to 32 bit offsets.

(cherry picked from commit 67029f200c5512f8ba5b9b7c25a5d1131422ef8e)
Documentation updates for 7.8.1 release

Notably, GND is now usable with Safe Haskell. Also, Coercible now is in
Data.Coerce canonically, and we added some more instances.

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit 71611523c25bb89b81e789d5a2dd3d5d9754b025)
Fix binary-dist target with xz/gzip

This was harmless but annoying: we forgot to take the compression
extention into account when copying the binary dist out of bindistprep

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit 025a66e7fc416ab9ee1df56ad26dfe6232d32900)
Note that we need Cabal-1.18 in the release notes

Thanks to George Colpitts for helping us remember this!

Signed-off-by: Austin Seipp <austin@well-typed.com>

(cherry picked from commit f9627252fc278ecaafbb1885c31adad7357c0763)
binary-dist: when using xz, use extreme compression.

When building a binary distribution with TAR_COMP=xz, using the -9e flag
(extremely high compression) results in substantial savings: for the
Mavericks builds, bzip2 scores in at about 120mb, while xz at level 9
scores about 60mb - a huge reduction!

This of course takes significantly longer - but it does not affect
decompression speed for end users, so it's certainly worth it.

Signed-off-by: Austin Seipp <austin@well-typed.com>

(cherry picked from commit 251b18aba97329ff41b8479ff78d38505cf086f8)
Update to latest Cabal 1.18 branch tip (again)

This was already performed in 37d6e2c54f117 but accidentally
reverted as a side-effect of 9976c2ece3aa4.

So this update pulls in the fix into ghc-7.8 for #8266 again.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Update `Cabal` to 1.18.1.3 release

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
(cherry picked from commit 01f9ac3e977fb128388467a31f62e84d769e17ec)
Update to containers-0.5.5.0

This adds role annotations to Map and Set and therefore addresses #8718

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
(cherry picked from commit e55acf007f5109b42a2e388eaca63445bbbc7376)
Update time to 1.4.2 release

Note: The only visible change in `time-1.4.2` is at the SafeHaskell level

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
(cherry picked from commit afb42a54bc0c5cd0dfb69750d3b5e76bcb66ff5a)
Update to containers-0.5.5.1

This fixes a wrong #if around role annotations (see #8718)

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
(cherry picked from commit df265b95a2f3640425b43b17993b9ec78a287f60)
add missing files (#8124)

(cherry picked from commit 3fba87599378afbcf425a0fc2a5a61d21e3719d4)
fix copy/pasto

(cherry picked from commit 176205cf0b89f76d904d381bdcd61e8685116bb7)
Run testcase for 8124 only with threaded ways

(cherry picked from commit 0014fb3dbf4a2096489a4800adf2d79a83a12274)
Make SetLevels do substitution properly (fixes Trac #8714)

Nowadays SetLevels floats case expressions as well as let-bindings,
and case expressions bind type variables.  We need to clone all such
floated binders, to avoid accidental name capture.  But I'd forgotten
to substitute for the cloned type variables, causing #8714.  (In the
olden days only Ids were cloned, from let-bindings.)

This patch fixes the bug and does quite a bit of clean-up refactoring
as well, by putting the context level in the LvlEnv.

There is no effect on performance, except that nofib 'rewrite' improves
allocations by 3%.  On investigation I think it was a fluke to do with
loop-cutting in big letrec nests.  But at least it's a fluke in the
right direction.

        Program           Size    Allocs   Runtime   Elapsed  TotalMem
--------------------------------------------------------------------------------
            Min          -0.4%     -3.0%    -19.4%    -19.4%    -26.7%
            Max          -0.0%     +0.0%    +17.9%    +17.9%      0.0%
 Geometric Mean          -0.1%     -0.0%     -0.7%     -0.7%     -0.4%

(cherry picked from commit ef44a429af4a630a153b5774d0e19dbcad8328d5)
Fix last-minute typo in SetLevels commit ef44a4

Sorry about that...

(cherry picked from commit 41f803105999ffe51a40d3c72d5994520496b7ea)
fix SHELL makefile variable to be set by the configure script (fixes #8783)

The patch provided by Christian Maeder <Christian.Maeder@dfki.de>
Signed-off-by: Karel Gardas <karel.gardas@centrum.cz>
Signed-off-by: Austin Seipp <austin@well-typed.com>

(cherry picked from commit a0bcbb54481297f9ff329766529a8343c4853e3f)
Remove "Safe mode" check for Coercible instances

We assume that library authors supply correct role annotations
for their types, and therefore we do not need to check for
the availability of data constructors in Safe mode. See
discussion in #8725. This effectively fixes #8827 and #8826.

(cherry picked from commit 59722295bb8da8f01d37356fbed6aef7321a8195)