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>
Add comments explaining #8754

Signed-off-by: Austin Seipp <austin@well-typed.com>
More liberally eta-expand a case-expression

at least with -fno-pedantic-bottoms. This fixes #2915, and undoes some
of a522c3b, on the grounds that with a flag `-fpedantic-bottoms`
around, we can be a bit more liberal when the flag is off..
Use NoGen plan for unboxed-tuple bindings

There was a small mixup here, exposed by Trac #8762.
Now clarified with better function names and comments.
Allow ($) to return an unlifted type (Trac #8739)

Since ($) simply returns its result, via a tail call, it can
perfectly well have an unlifted result type; e.g.
    foo $ True    where  foo :: Bool -> Int#
should be perfectly fine.

This used to work in GHC 7.2, but caused a Lint failure.  This patch
makes it work again (which involved removing code in TcExpr), but fixing
the Lint failure meant I had to make ($) into a wired-in Id.  Which
is not hard to do (in MkId).
Add some more traceTcS calls
Keep kind-inconsistent Given type equalities (fixes Trac #8705)

I was too eager when fixing Trac #8566, and dropped too many
equalities on the floor, thereby causing Trac #8705.

The fix is easy: delete code.  Lots of new comments!
Revert "Add comments explaining #8754"

This reverts commit b626c3d4ce0e66216705ba8355c914dc809e3fe7.
Revert "Fix #8754 in a round-about way."

This reverts commit 5023c91780e90947680fe0640f7564a4f6448bea.
Make CallArity make more use of many-calls

by elaborating the domain a bit.