Fix --enable-unregistered by passing NOSMP to .hc compiler (#8748)

Signed-off-by: Austin Seipp <austin@well-typed.com>
Fix --enable-unregistered by declaring missing RTS functions (#8748)

Signed-off-by: Austin Seipp <austin@well-typed.com>
rts/Capability.c: fix crash in -threaded mode on UNREG build

UNREG mode has quite nasty invariant to maintain:
    capabilities[0] == &MainCapability

and it's a non-heap memory, while other
capabilities are dynamically allocated.

Issue #8748

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Austin Seipp <austin@well-typed.com>
includes/Stg.h: add declarations for hs_popcnt and frinds

This fixes most of implicit function declarations emitted
C codegen in UNREG mode. Found by adding the following to
mk/build.mk:

    SRC_CC_OPTS += -Werror=implicit-function-declaration
    SRC_HC_OPTS += -optc-Werror=implicit-function-declaration

Issue #8748

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Austin Seipp <austin@well-typed.com>
rts/package.conf.in: fix UNREG on --with-system-libffi when include-dir is passed explicitely

Issue #8748

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Austin Seipp <austin@well-typed.com>
mk/config.mk.in: lower -O2 optimization down to -O1 on UNREG

Disable -O2 optimization. Otherwise amount of generated C code makes
things very slow to compile (~5 minutes on core-i7 for 'compiler/hsSyn/HsExpr.lhs')

And sometimes not compile at all (powerpc64 overflows something
on 'compiler/hsSyn/HsExpr.lhs').

Issue #8748

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Austin Seipp <austin@well-typed.com>
Fix installation of hpc (#8735)

Signed-off-by: Austin Seipp <austin@well-typed.com>
Fix check for TLS support in Storage.c

This should have manifested earlier, but for some reason it only seemed
to trigger on Mavericks.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Fix #8754 in a round-about way.

For some reason on OS X, it seems like -Bsymbolic (which we use for
hooks into the RTS) isn't working, which results in #8754, where stats
don't work because defaultHooks doesn't initialize the stats flag. This
seems to work on Linux static/dynamically, but only on OS X statically.

After talking with Simon, really, the entire hooks thing is a bit
fragile. For now, we just work around it (since GHCi is dynamically
linked) by calling into the defaultHooks ourselves when GHC starts.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Fix #8745 - GND is now -XSafe compatible.

As discussed in the ticket, after the landing of #8773, GND is now
-XSafe compatible.

This fixes the test fallout as well. In particular SafeLang07 was
removed following in the steps of SafeLang06, since it no longer failed
from GND, but failed due to roles and was thus invalid.

The other tests were tweaked to use TemplateHaskell instead of GND in
order to trigger safety warnings.

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

As usual, Mac OS X is extremely annoying (or the software is, anyway),
because not only does it load dynamic libraries with the .dylib
extension, but also the .so extension. For whatever reason. At least
it's easy to fix.

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