Test earlier for self-import (Trac #9032)

This patch makes the renamer check for self-import, especially when
dependencies change, because the typechecker can fall over if that
happens.

I'm still uneasy about *indirect* self-import, but I'll leave that for
another day

(cherry picked from commit edd233acc19d269385c1a870829e0916a3df8e88,
7a2c9dde24b72fe53216881867d5543e5a6f756c, and
add6a30317ca7307a91563afbbf102c3771ee246)
Copy GHC's config.guess/sub over libffi's versions

This should address #9924 as GHC's config.guess/sub versions need to be
up to date anyway.

(cherry picked from commit 9ae78b0ac20199982b994122889a04c6124e01b2)
Make ghc -e not exit on valid import commands (#9905)

Some Trues and Falses were mixed up due to Bool being used in
different senses in different parts of GHCi.

(cherry picked from commit 878910e1c4520732ab9d8372c1c81f00d484e48f)
Fix linker interaction between Template Haskell and HPC (#9762)

I'm not really happy about perpetuating the hackish fix for #8696,
but at least in the context of building with -fhpc, the performance
cost should be negligible.

I'm suspicious about PlainModuleInitLabel and the Windows stuff too,
but I don't know what it does / can't test it (respectively) so I'll
leave those alone for now.

Hopefully out-of-process TH will save us from these hacks some day.

The test is an adaptation of T8696. It's a bit more awkward since
I couldn't think of a way to get cross-module tickbox references
without optimizations (inlining), but ghci doesn't permit -O for
some reason.

(cherry picked from commit 3e3aa9258b521d362d3a51cb48969df3eeab4981)