Allow deriving Typeable for more tycons
Update the name cache when creating new names via DeriveGeneric

New external top-level names were being created but the name cache
wasn't being populated, leading to #7878.

Signed-off-by: Jose Pedro Magalhaes <jpm@cs.ox.ac.uk>
Treat foreign imported things in CMM as being in this package

They used to be treated as being in an exnternal package, which went
wrong on Windows (it tried to call them via an imp wrapper, rather
than calling them directly).
Fix dynamically linked GHC on Windows

This is a rather ugly hack to fix dynamically linked GHC on Windows.

If GHC is linked with -threaded, then it links against libHSrts_thr.
But if base is linked against libHSrts, then both end up getting
loaded, and things go wrong. We therefore link the libraries that
link against the RTS with the same RTS flags that we link GHC with.
Fix the name of libffi

On Windows, we need to keep the DLL called libffi-6.dll (rather than
libffi.dll) or Windows can't find it.
Generate dependencies for .cmm files properly
rts_checkSchedStatus: exit the thread, not the process, when Interrupted

This means that when the process is shutting down, if we have calls to
foreign exports in progress, they get forcibly terminated as before,
but now they only shut down the calling thread rather than the whole
process (with -threaded).

This came up in a discussion started by Akio Takano on ghc-users.
Make -fno-flat-cache use a dynamic, rather than static, flag
Remove a redundant wrapper function
Make sure the RTS is built, even when no programs are being built with stage1

Part of #7841
Fix an all-target call in the build system
Some build system tweaks
Modernise code in rename/RnEnv.lhs

Removed a definition of thenM, and used do notation instead
Remove an old commented out import
Whitespace only in typecheck/TcHsSyn.lhs
Remove a "mappM = mapM" wrapper in typecheck/TcHsSyn.lhs
Remove a "returnM = return" wrapper in typecheck/TcHsSyn.lhs
Modernise some code

Use do notation rather than thenM in typecheck/TcHsSyn.lhs
We actually need to use -threaded/-debug when linking /all/ DLLs

Not just base, integer-gmp and ghc-prim.
Remove obsolete documentation.

Type variables can no longer be unqualified operators.

Signed-off-by: Austin Seipp <aseipp@pobox.com>