Extract derived constants from nm output for various OSes differently.

Fixes #8783.

In order to avoid querying the nm version that does not work on Mac OS X
we use the "nm -P" output that is supposed to produce (more portable)
POSIX output and works on all tested OSes (MinGW, Mac OS X, Solaris and
Linux using GNU nm) although slightly different (as documented). The "nm
-P" output is actually only needed to recognize the output of a non-GNU
Solaris nm (all other OSes produce sane outut using "nm" only).

Signed-off-by: Austin Seipp <austin@well-typed.com>
Add missing stack checks to stg_ap_* functions (#9001)

(cherry picked from commit fc0ed8a7309e7cc863b8155fae6b57cb23331c44)

Conflicts:
	testsuite/tests/codeGen/should_run/all.T
Only uninstall signal handlers if they were actually installed (#9068)

Submitted by: tomgr

(cherry picked from commit bc7d49a658a516679cc264502e72560c1d2c2314)
rts: remove stable-names from hashtable upon free

This fixes #9078.

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit b75d126e779e8690c675be84e8972dc023e04b9b)
Fix missing unlockClosure() call in tryReadMVar (#9148)

(cherry picked from commit 96a95f0513de785a185fd8a46c7ed2643f698295)
annth_make, annth_compunits: Only run these tests if have_dynamic()
Add ".text.unlikely" to recognized code sections on Windows.

Fixes #9080

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit 56ea745c3dd00c87ad86b80f91a31ced5e86e488)
Fix discarding of unreachable code in the register allocator (#9155)

A previous fix to this was wrong: f5879acd018494b84233f26fba828ce376d0f81d
and left some unreachable code behind.  So rather than try to be clever and
do this at the same time as the strongly-connected-component analysis, I'm
doing a separate reachability pass first.

(cherry picked from commit e577a52363ee7ee8a07f1d863988332ae8fbf2e4)
Fix compilation of cmm files with -outputdir (Trac #9050)

(cherry picked from commit 2a463ebeba4dff6793ae16707712f1e9245225e8)
Emit error in case of duplicate GRE; fixes #7241

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit c226d25fef519db663d0c9efe7845637423f1dca)

Conflicts:
	testsuite/tests/th/all.T
Fix obscure problem with using the system linker (#8935)

See Note [RTLD_LOCAL] for a summary of the problem and solution, and

(cherry picked from commit 2f8b4c9330b455d4cb31c186c747a7db12a69251)
7.8.3 release notes.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Ship xhtml, terminfo, haskeline (#8919)

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit 4caadb7cbee5c176abb99df25c4cc1657ae57f40)
Release notes

Signed-off-by: Austin Seipp <austin@well-typed.com>
Revert "Fix obscure problem with using the system linker (#8935)"

This reverts commit 72bd832eb87975c504654a65f9c88daaa478f677.

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

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit b84748121e777d098198f2583d11a9424c1b1650)
Fix up b84748121e777d

I forgot to amend this to my last commit.

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit 95f95ed6281adf9616d87b97470d68fb54c0b7f3)
Fix over-zealous unused-import warning

See Note [Un-warnable import decls] in RnNames.

Fixes Trac #9061.

(cherry picked from commit 9f3e39d5f8686e511ffca406a6e056dec4095e53)
Second go at fixing #9061

My first attempt introduce a bug in -fprint-minimal-imports, but
fortunately a regression test caught it.

(cherry picked from commit 5b73dc5fda1941d51827ea72614782c10a355a3d)
Fix a serious, but rare, strictness analyser bug (Trac #9128)

In a special case for trivial RHSs (see DmdAnal.unpackTrivial),
I'd forgotten to include a demand for the RHS itself.
See Note [Remember to demand the function itself].

Thanks to David Terei for guiding me to the bug,
at PLDI in Edinburgh.

(cherry picked from commit 7d9feb264a4fc3c15d1e5f88f2e7a04202ed9743)