Fix the Win64 RTS linker & disable .ctors

This fixes #7134

Signed-off-by: Austin Seipp <austin@well-typed.com>
build.mk.sample: Don't disable dynamic linking for LLVM flavours

Signed-off-by: Austin Seipp <austin@well-typed.com>
Add short blurb about LLVM dynamic linking to release notes

Signed-off-by: Austin Seipp <austin@well-typed.com>
Abort when binutils ld is used with dynamic linking on ARM

The binutils linker on ARM emits unnecessary R_ARM_COPY relocations
which breaks tables-next-to-code in dynamically linked modules. This
check should be more selective but there is currently no released
version where this bug is fixed.  See
https://sourceware.org/bugzilla/show_bug.cgi?id=16177 and
https://ghc.haskell.org/trac/ghc/ticket/4210#comment:29 for details.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Fix ./validate failure due to unused result.

Fallout from 4ade9627608ea0a88450506222bb9afbbcff4294

Signed-off-by: Austin Seipp <austin@well-typed.com>
Update some mingw32 perf numbers.

I forgot to push these from my win32 machine. A lot of them actually
look like a result of Herbert doing his GMP work, which might slightly
affect allocations on platforms like Windows (where we always use
in-tree GMP - but presumably Windows allocations could fluxuate slightly
due to minute details in the GMP implementation, too.)

Signed-off-by: Austin Seipp <austin@well-typed.com>
Check for __thread in ./configure.ac

Signed-off-by: Austin Seipp <austin@well-typed.com>
Refactor GCTDecl.h, and mitigate #7602 a bit

This basically cleans a lot of GCTDecl up - I found it quite hard to
read and a bit confusing. The changes are mostly cosmetic: better
delineation between the alternative cases and light touchups, and tries
to make every branch as consistent as possible.

However, this patch does have one significant effect: it will ensure
that any LLVM-based compilers will use __thread if they support it.
Before, they would simply always use pthread_getspecific and
pthread_setspecific, which are almost surely even *more* inefficient.

The details are a bit too long and boring to go into here; see #7602.
After talking with Simon, we decided to play it safe - __thread can at
least be optimized by future clang releases even further on OS X if they
choose, and it's safer until we can investigate the pthread
implementation further on Mavericks.

For Linux, the story isn't so bleak if you use Clang (for whatever
reason) - Linux directly writes to `%fs` for __thread slots (while OS X
will perform a load followed by an indirect call.) So it should still be
fairly competitive, speed-wise.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Document a Haddock/Mavericks bug.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Fix inplace dynamic linking on OS X (#8266)

Signed-off-by: Austin Seipp <austin@well-typed.com>
Win64 linker: fix loading foreign imports (#2283)

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