summaryrefslogtreecommitdiff
path: root/hadrian
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-07-12 17:26:47 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-07-27 04:47:51 -0400
commit2ce48fe9d1334dadf6fa1411238e52d65b66ba41 (patch)
tree1f48a9e2e2ae3350c3802875bef128327afdf593 /hadrian
parent246f08ac032392f808c7aa53dd78a96d9b43e63f (diff)
downloadhaskell-2ce48fe9d1334dadf6fa1411238e52d65b66ba41.tar.gz
rts: Break up adjustor logic
Diffstat (limited to 'hadrian')
-rw-r--r--hadrian/cfg/system.config.in1
-rw-r--r--hadrian/src/Oracles/Flag.hs7
-rw-r--r--hadrian/src/Oracles/Setting.hs6
-rw-r--r--hadrian/src/Rules/Generate.hs2
-rw-r--r--hadrian/src/Settings/Packages.hs11
5 files changed, 14 insertions, 13 deletions
diff --git a/hadrian/cfg/system.config.in b/hadrian/cfg/system.config.in
index 4d9d1b752e..e23c79a81d 100644
--- a/hadrian/cfg/system.config.in
+++ b/hadrian/cfg/system.config.in
@@ -47,6 +47,7 @@ hs-cpp-args = @HaskellCPPArgs@
solaris-broken-shld = @SOLARIS_BROKEN_SHLD@
ghc-unregisterised = @Unregisterised@
tables-next-to-code = @TablesNextToCode@
+use-libffi-for-adjustors = @UseLibffiForAdjustors@
ghc-source-path = @hardtop@
leading-underscore = @LeadingUnderscore@
diff --git a/hadrian/src/Oracles/Flag.hs b/hadrian/src/Oracles/Flag.hs
index 1b3aff693e..5b41698be1 100644
--- a/hadrian/src/Oracles/Flag.hs
+++ b/hadrian/src/Oracles/Flag.hs
@@ -2,7 +2,7 @@
module Oracles.Flag (
Flag (..), flag, getFlag, platformSupportsSharedLibs,
- targetSupportsSMP
+ targetSupportsSMP, useLibffiForAdjustors
) where
import Hadrian.Oracles.TextFile
@@ -26,6 +26,7 @@ data Flag = ArSupportsAtFile
| UseSystemFfi
| BootstrapThreadedRts
| SystemDistroMINGW
+ | UseLibffiForAdjustors
-- Note, if a flag is set to empty string we treat it as set to NO. This seems
-- fragile, but some flags do behave like this.
@@ -47,6 +48,7 @@ flag f = do
UseSystemFfi -> "use-system-ffi"
BootstrapThreadedRts -> "bootstrap-threaded-rts"
SystemDistroMINGW -> "system-use-distro-mingw"
+ UseLibffiForAdjustors -> "use-libffi-for-adjustors"
value <- lookupValueOrError configFile key
when (value `notElem` ["YES", "NO", ""]) . error $ "Configuration flag "
++ quote (key ++ " = " ++ value) ++ " cannot be parsed."
@@ -88,3 +90,6 @@ targetSupportsSMP = do
, ver < ARMv7 -> return False
| goodArch -> return True
| otherwise -> return False
+
+useLibffiForAdjustors :: Action Bool
+useLibffiForAdjustors = flag UseLibffiForAdjustors
diff --git a/hadrian/src/Oracles/Setting.hs b/hadrian/src/Oracles/Setting.hs
index 3713b2457a..73fd1ce273 100644
--- a/hadrian/src/Oracles/Setting.hs
+++ b/hadrian/src/Oracles/Setting.hs
@@ -14,7 +14,7 @@ module Oracles.Setting (
isElfTarget,
ArmVersion(..),
targetArmVersion,
- ghcWithInterpreter, useLibFFIForAdjustors
+ ghcWithInterpreter
) where
import Hadrian.Expression
@@ -275,10 +275,6 @@ ghcWithInterpreter = do
, "powerpc64", "powerpc64le" ]
return $ goodOs && goodArch
--- | Check to use @libffi@ for adjustors.
-useLibFFIForAdjustors :: Action Bool
-useLibFFIForAdjustors = notM $ anyTargetArch ["i386", "x86_64"]
-
-- | Variants of the ARM architecture.
data ArmVersion = ARMv5 | ARMv6 | ARMv7
deriving (Eq, Ord, Show, Read)
diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs
index b7b4d17180..3eb100bae5 100644
--- a/hadrian/src/Rules/Generate.hs
+++ b/hadrian/src/Rules/Generate.hs
@@ -341,7 +341,7 @@ generateSettings = do
, ("RTS ways", unwords . map show <$> getRtsWays)
, ("Tables next to code", expr $ yesNo <$> flag TablesNextToCode)
, ("Leading underscore", expr $ yesNo <$> flag LeadingUnderscore)
- , ("Use LibFFI", expr $ yesNo <$> useLibFFIForAdjustors)
+ , ("Use LibFFI", expr $ yesNo <$> useLibffiForAdjustors)
, ("RTS expects libdw", yesNo <$> getFlag WithLibdw)
]
let showTuple (k, v) = "(" ++ show k ++ ", " ++ show v ++ ")"
diff --git a/hadrian/src/Settings/Packages.hs b/hadrian/src/Settings/Packages.hs
index 8161598431..9bf82a6cef 100644
--- a/hadrian/src/Settings/Packages.hs
+++ b/hadrian/src/Settings/Packages.hs
@@ -294,8 +294,6 @@ rtsPackageArgs = package rts ? do
, "-g3"
, "-O0" ]
- , useLibFFIForAdjustors ? arg "-DUSE_LIBFFI_FOR_ADJUSTORS"
-
, inputs ["**/RtsMessages.c", "**/Trace.c"] ?
arg ("-DProjectVersion=" ++ show projectVersion)
@@ -356,10 +354,11 @@ rtsPackageArgs = package rts ? do
mconcat
[ builder (Cabal Flags) ? mconcat
[ any (wayUnit Profiling) rtsWays ? arg "profiling"
- , any (wayUnit Debug) rtsWays ? arg "debug"
- , any (wayUnit Logging) rtsWays ? arg "logging"
- , any (wayUnit Dynamic) rtsWays ? arg "dynamic"
- , Debug `wayUnit` way ? arg "find-ptr"
+ , any (wayUnit Debug) rtsWays ? arg "debug"
+ , any (wayUnit Logging) rtsWays ? arg "logging"
+ , any (wayUnit Dynamic) rtsWays ? arg "dynamic"
+ , useLibffiForAdjustors ? arg "libffi-adjustors"
+ , Debug `wayUnit` way ? arg "find-ptr"
]
, builder (Cabal Setup) ? mconcat
[ if not (null libdwLibraryDir) then arg ("--extra-lib-dirs="++libdwLibraryDir) else mempty