summaryrefslogtreecommitdiff
path: root/compiler/main
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-08-06 22:51:28 +0100
committerIan Lynagh <ian@well-typed.com>2012-08-06 22:51:28 +0100
commite6ef5ab66f51a8b821a4ae8646faca19cf600d94 (patch)
tree0ac8f5178caa80f1fabc3da22e46db8cb19a553a /compiler/main
parent8e7fb28fc89eb9b99c747698f41995c269cd1090 (diff)
downloadhaskell-e6ef5ab66f51a8b821a4ae8646faca19cf600d94.tar.gz
Make tablesNextToCode "dynamic"
This is a bit odd by itself, but it's a stepping stone on the way to putting "target unregisterised" into the settings file.
Diffstat (limited to 'compiler/main')
-rw-r--r--compiler/main/DynFlags.hs10
-rw-r--r--compiler/main/StaticFlagParser.hs12
-rw-r--r--compiler/main/StaticFlags.hs10
-rw-r--r--compiler/main/SysTools.lhs16
4 files changed, 27 insertions, 21 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index c422980dd8..c528402b7a 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -46,6 +46,7 @@ module DynFlags (
DynLibLoader(..),
fFlags, fWarningFlags, fLangFlags, xFlags,
wayNames, dynFlagDependencies,
+ tablesNextToCode,
printOutputForUser, printInfoForUser,
@@ -881,6 +882,15 @@ defaultObjectTarget
| cGhcWithNativeCodeGen == "YES" = HscAsm
| otherwise = HscLlvm
+-- Derived, not a real option. Determines whether we will be compiling
+-- info tables that reside just before the entry code, or with an
+-- indirection to the entry code. See TABLES_NEXT_TO_CODE in
+-- includes/rts/storage/InfoTables.h.
+tablesNextToCode :: DynFlags -> Bool
+tablesNextToCode _ = not opt_Unregisterised
+ && cGhcEnableTablesNextToCode == "YES"
+
+
data DynLibLoader
= Deployable
| SystemDependent
diff --git a/compiler/main/StaticFlagParser.hs b/compiler/main/StaticFlagParser.hs
index ddb40268fb..adda6f1505 100644
--- a/compiler/main/StaticFlagParser.hs
+++ b/compiler/main/StaticFlagParser.hs
@@ -18,7 +18,7 @@ module StaticFlagParser (
#include "HsVersions.h"
import qualified StaticFlags as SF
-import StaticFlags ( v_opt_C_ready, getWayFlags, tablesNextToCode, WayName(..)
+import StaticFlags ( v_opt_C_ready, getWayFlags, WayName(..)
, opt_SimplExcessPrecision )
import CmdLineParser
import Config
@@ -81,14 +81,6 @@ parseStaticFlagsFull flagsAvailable args = do
-- see sanity code in staticOpts
writeIORef v_opt_C_ready True
- -- TABLES_NEXT_TO_CODE affects the info table layout.
- -- Be careful to do this *after* all processArgs,
- -- because evaluating tablesNextToCode involves looking at the global
- -- static flags. Those pesky global variables...
- let cg_flags | tablesNextToCode = map (mkGeneralLocated "in cg_flags")
- ["-optc-DTABLES_NEXT_TO_CODE"]
- | otherwise = []
-
-- HACK: -fexcess-precision is both a static and a dynamic flag. If
-- the static flag parser has slurped it, we must return it as a
-- leftover too. ToDo: make -fexcess-precision dynamic only.
@@ -98,7 +90,7 @@ parseStaticFlagsFull flagsAvailable args = do
| otherwise = []
when (not (null errs)) $ ghcError $ errorsToGhcException errs
- return (excess_prec ++ cg_flags ++ more_leftover ++ leftover,
+ return (excess_prec ++ more_leftover ++ leftover,
warns1 ++ warns2)
flagsStatic :: [Flag IO]
diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs
index 79faf1ec2f..f19497cb94 100644
--- a/compiler/main/StaticFlags.hs
+++ b/compiler/main/StaticFlags.hs
@@ -74,7 +74,6 @@ module StaticFlags (
opt_HistorySize,
opt_Unregisterised,
v_Ld_inputs,
- tablesNextToCode,
opt_StubDeadValues,
opt_Ticky,
@@ -87,7 +86,6 @@ module StaticFlags (
#include "HsVersions.h"
-import Config
import FastString
import Util
import Maybes ( firstJusts )
@@ -314,14 +312,6 @@ opt_Static = lookUp (fsLit "-static")
opt_Unregisterised :: Bool
opt_Unregisterised = lookUp (fsLit "-funregisterised")
--- Derived, not a real option. Determines whether we will be compiling
--- info tables that reside just before the entry code, or with an
--- indirection to the entry code. See TABLES_NEXT_TO_CODE in
--- includes/rts/storage/InfoTables.h.
-tablesNextToCode :: Bool
-tablesNextToCode = not opt_Unregisterised
- && cGhcEnableTablesNextToCode == "YES"
-
-- Include full span info in error messages, instead of just the start position.
opt_ErrorSpans :: Bool
opt_ErrorSpans = lookUp (fsLit "-ferror-spans")
diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs
index 0928927888..295aa595e1 100644
--- a/compiler/main/SysTools.lhs
+++ b/compiler/main/SysTools.lhs
@@ -51,6 +51,7 @@ import Platform
import Util
import DynFlags
import Exception
+import StaticFlags
import Data.IORef
import Control.Monad
@@ -217,7 +218,12 @@ initSysTools mbMinusB
-- to make that possible, so for now you can't.
gcc_prog <- getSetting "C compiler command"
gcc_args_str <- getSetting "C compiler flags"
- let gcc_args = map Option (words gcc_args_str)
+ let
+ -- TABLES_NEXT_TO_CODE affects the info table layout.
+ tntc_gcc_args
+ | tablesNextToCode' = ["-DTABLES_NEXT_TO_CODE"]
+ | otherwise = []
+ gcc_args = map Option (words gcc_args_str ++ tntc_gcc_args)
ldSupportsCompactUnwind <- getBooleanSetting "ld supports compact unwind"
ldSupportsBuildId <- getBooleanSetting "ld supports build-id"
ldIsGnuLd <- getBooleanSetting "ld is GNU ld"
@@ -316,6 +322,14 @@ initSysTools mbMinusB
sOpt_lo = [],
sOpt_lc = []
}
+
+-- Derived, not a real option. Determines whether we will be compiling
+-- info tables that reside just before the entry code, or with an
+-- indirection to the entry code. See TABLES_NEXT_TO_CODE in
+-- includes/rts/storage/InfoTables.h.
+tablesNextToCode' :: Bool
+tablesNextToCode' = not opt_Unregisterised
+ && cGhcEnableTablesNextToCode == "YES"
\end{code}
\begin{code}