summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheng Shao <astrohavoc@gmail.com>2022-09-09 15:24:48 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-09-17 06:46:04 -0400
commitbd0f418422a3ace8d05c8ce93850190e57321465 (patch)
treeb749e96063c4075de139a74015cddd62498ab56c
parent63aa006939a8b5284b0f6f6a1c26d52aa3ae47da (diff)
downloadhaskell-bd0f418422a3ace8d05c8ce93850190e57321465.tar.gz
rts: make threaded ways optional
For certain targets (e.g. wasm32-wasi), the threaded rts is known not to work. This patch adds a "threaded" cabal flag to rts to make threaded rts ways optional. Hadrian enables this flag iff the flavour rtsWays contains threaded ways.
-rw-r--r--hadrian/src/Settings/Packages.hs1
-rw-r--r--rts/rts.cabal.in23
2 files changed, 18 insertions, 6 deletions
diff --git a/hadrian/src/Settings/Packages.hs b/hadrian/src/Settings/Packages.hs
index db0db16902..1cd72163aa 100644
--- a/hadrian/src/Settings/Packages.hs
+++ b/hadrian/src/Settings/Packages.hs
@@ -389,6 +389,7 @@ rtsPackageArgs = package rts ? do
[ any (wayUnit Profiling) rtsWays `cabalFlag` "profiling"
, any (wayUnit Debug) rtsWays `cabalFlag` "debug"
, any (wayUnit Dynamic) rtsWays `cabalFlag` "dynamic"
+ , any (wayUnit Threaded) rtsWays `cabalFlag` "threaded"
, useSystemFfi `cabalFlag` "use-system-libffi"
, useLibffiForAdjustors `cabalFlag` "libffi-adjustors"
, Debug `wayUnit` way `cabalFlag` "find-ptr"
diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in
index b072434af5..af76886418 100644
--- a/rts/rts.cabal.in
+++ b/rts/rts.cabal.in
@@ -51,6 +51,8 @@ flag debug
default: False
flag dynamic
default: False
+flag threaded
+ default: False
flag thread-sanitizer
description:
Enable checking for data races using the ThreadSanitizer (TSAN)
@@ -78,17 +80,26 @@ library
-- Here we declare several flavours to be available when passing the
-- suitable (combination of) flag(s) when configuring the RTS from hadrian,
-- using Cabal.
- extra-library-flavours: _thr
+ if flag(threaded)
+ extra-library-flavours: _thr
if flag(profiling)
- extra-library-flavours: _p _thr_p
+ extra-library-flavours: _p
+ if flag(threaded)
+ extra-library-flavours: _thr_p
if flag(debug)
- extra-library-flavours: _debug_p _thr_debug_p
+ extra-library-flavours: _debug_p
+ if flag(threaded)
+ extra-library-flavours: _thr_debug_p
if flag(debug)
- extra-library-flavours: _debug _thr_debug
+ extra-library-flavours: _debug
+ if flag(threaded)
+ extra-library-flavours: _thr_debug
if flag(dynamic)
- extra-dynamic-library-flavours: _debug _thr_debug
- if flag(dynamic)
+ extra-dynamic-library-flavours: _debug
+ if flag(threaded)
+ extra-dynamic-library-flavours: _thr_debug
+ if flag(dynamic) && flag(threaded)
extra-dynamic-library-flavours: _thr
if flag(thread-sanitizer)