Make the linker more robust to errors

Summary:
When linking fails because there was a problem with the supplied
object file, then we should not barf() or exit, we should emit a
suitable error message and return an error code to the caller.  We
should also free all memory that might have been allocated during
linking, and generally not do any damage.  This patch fixes most
common instances of this problem.

Test Plan: validate

Reviewers: rwbarton, austin, ezyang

Reviewed By: ezyang

Subscribers: simonmar, ezyang, carter, thomie

Differential Revision: https://phabricator.haskell.org/D294
Ignore exe files in base (from tests)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Update haddock submodule with lazy IO fix.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Rewrite section 1 of the Backpack manual. [skip ci]

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Name worker threads using pthread_setname_np

This helps identify threads in gdb particularly in processes with a
lot of threads.
rts: don't crash on 'hs_init(NULL, NULL)' in debug rts

Caught by T6006 as a NULL dereference:

  Command: ./T6006

  Invalid read of size 8
     at 0x660ED9: hs_init_ghc (RtsStartup.c:168)
     by 0x660D90: hs_init (RtsStartup.c:112)
     by 0x40504D: main (in /home/slyfox/dev/git/ghc-validate/testsuite/tests/rts/T6006)
   Address 0x0 is not stack'd, malloc'd or (recently) free'd

The regression was introduced by commit
cb0a503a44bf016de3d9042906c6ac0c0821ffea

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Remove a few redundant `.hs-boot` files

There don't seem to be any corresponding `{-# SOURCE #-}` for the removed
`.hs-boot`-files anymore (if there ever was any in the first place).

This also removes a commented out `{-# SOURCE #-}` import which turns up when
grepping the source for `{-# SOURCE #-}` occurences.
Fallback to `ctypes.cdll` if `ctypes.windll` unavailable

On Windows, we may be using a native build of Python or a mingw/msys build. The
former exports `ctypes.windll`, the latter exports `cdll`. Previously the code
threw an exception when using the msys Python because it expected `windll` to
always be available on Windows.

Differential Revision: https://phabricator.haskell.org/D308
Extend windows detection in testsuite to recognize MSYS target

Currently, the detection recognizes the following `uname -s` strings:

 - `CYGWIN_NT-6.3`
 - `MINGW32_NT-6.3`
 - `MINGW64_NT_6.3`

However, MSYS2 provides an additional target, in which case `uname -s`
returns a string such as `MSYS_NT-6.3`. In all these cases, the system
ought to be recognized as being a `windows` os by the testsuite runner.

See also #9604
Refactor to avoid need for `Unicode.hs-boot`

This avoids the import-cycle caused by the import of `Foreign.C.Types`
by using `Int` instead of `CInt` for the Unicode classification
functions. This refactoring also allows to remove a couple of
`fromIntegral`s.

Reviewed By: rwbarton, ekmett

Differential Revision: https://phabricator.haskell.org/D328
Fix build on some platforms
Merge remote-tracking branch 'origin/master' into wip/ast-annotations-separate

Conflicts:
	utils/haddock