DOpt(..),
DynFlag(..),
ExtensionFlag(..),
+ glasgowExtsFlags,
flattenExtensionFlags,
ensureFlattenedExtensionFlags,
lopt_set_flattened,
-- * Compiler configuration suitable for display to the user
Printable(..),
- compilerInfo, rtsIsProfiled
+ compilerInfo
+#ifdef GHCI
+-- Only in stage 2 can we be sure that the RTS
+-- exposes the appropriate runtime boolean
+ , rtsIsProfiled
+#endif
) where
#include "HsVersions.h"
, Opt_GeneralizedNewtypeDeriving
, Opt_TypeFamilies ]
+#ifdef GHCI
-- Consult the RTS to find whether GHC itself has been built profiled
-- If so, you can't use Template Haskell
foreign import ccall unsafe "rts_isProfiled" rtsIsProfiledIO :: IO CInt
rtsIsProfiled :: Bool
-rtsIsProfiled = False -- unsafePerformIO rtsIsProfiledIO /= 0
+rtsIsProfiled = unsafePerformIO rtsIsProfiledIO /= 0
checkTemplateHaskellOk :: Bool -> DynP ()
checkTemplateHaskellOk turn_on
= addErr "You can't use Template Haskell with a profiled compiler"
| otherwise
= return ()
+#else
+-- In stage 1 we don't know that the RTS has rts_isProfiled,
+-- so we simply say "ok". It doesn't matter because TH isn't
+-- available in stage 1 anyway.
+checkTemplateHaskellOk turn_on = return ()
+#endif
{- **********************************************************************
%* *
machdepCCOpts :: DynFlags -> ([String], -- flags for all C compilations
[String]) -- for registerised HC compilations
-machdepCCOpts _dflags
+machdepCCOpts dflags = let (flagsAll, flagsRegHc) = machdepCCOpts' dflags
+ in (cCcOpts ++ flagsAll, flagsRegHc)
+
+machdepCCOpts' :: DynFlags -> ([String], -- flags for all C compilations
+ [String]) -- for registerised HC compilations
+machdepCCOpts' _dflags
#if alpha_TARGET_ARCH
= ( ["-w", "-mieee"
#ifdef HAVE_THREADED_RTS_SUPPORT
-- the fp (%ebp) for our register maps.
= let n_regs = stolen_x86_regs _dflags
in
- (
-#if darwin_TARGET_OS
- -- By default, gcc on OS X will generate SSE
- -- instructions, which need things 16-byte aligned,
- -- but we don't 16-byte align things. Thus drop
- -- back to generic i686 compatibility. Trac #2983.
- --
- -- Since Snow Leopard (10.6), gcc defaults to x86_64.
- ["-march=i686", "-m32"],
-#else
+ (
[ if opt_Static then "-DDONT_WANT_WIN32_DLL_SUPPORT" else ""
],
-#endif
[ "-fno-defer-pop",
"-fomit-frame-pointer",
-- we want -fno-builtin, because when gcc inlines
#elif x86_64_TARGET_ARCH
= (
-#if darwin_TARGET_OS
- ["-m64"],
-#else
- [],
-#endif
+ [],
["-fomit-frame-pointer",
"-fno-asynchronous-unwind-tables",
-- the unwind tables are unnecessary for HC code,