opt_EmitExternalCore,
opt_PIC,
v_Ld_inputs,
+ tablesNextToCode
) where
#include "HsVersions.h"
import CmdLineParser
-import Config ( cProjectVersionInt, cProjectPatchLevel,
- cGhcUnregisterised )
+import Config
import FastString ( FastString, mkFastString )
import Util
import Maybes ( firstJust )
| otherwise = []
(more_leftover, errs) <- processArgs static_flags (unreg_flags ++ way_flags)
+
+ -- 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 = ["-optc-DTABLES_NEXT_TO_CODE"]
+ | otherwise = []
+
when (not (null errs)) $ ghcError (UsageError (unlines errs))
- return (more_leftover++leftover)
+ return (cg_flags++more_leftover++leftover)
-- note that ordering is important in the following list: any flag which
opt_Static = lookUp FSLIT("-static")
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/InfoTables.h.
+tablesNextToCode = not opt_Unregisterised
+ && cGhcEnableTablesNextToCode == "YES"
+
opt_EmitExternalCore = lookUp FSLIT("-fext-core")
-- Include full span info in error messages, instead of just the start position.