diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-10-24 23:58:28 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-10-29 03:48:20 -0400 |
commit | b741d19dc0380988f4f5663dc72eef4710bb0771 (patch) | |
tree | 03c7709bd118c5b182e065d4d6ab94475c2c276b /hadrian/src/Settings/Packages.hs | |
parent | 6a0902702d64ce683c81c04069f46f6e1078a094 (diff) | |
download | haskell-b741d19dc0380988f4f5663dc72eef4710bb0771.tar.gz |
hadrian: Shuffle around RTS build flags
Some of these flags wanted to be passed to .cmm builds as well as C
builds.
Diffstat (limited to 'hadrian/src/Settings/Packages.hs')
-rw-r--r-- | hadrian/src/Settings/Packages.hs | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/hadrian/src/Settings/Packages.hs b/hadrian/src/Settings/Packages.hs index 014b1283c3..0f1ae6426a 100644 --- a/hadrian/src/Settings/Packages.hs +++ b/hadrian/src/Settings/Packages.hs @@ -199,15 +199,27 @@ rtsPackageArgs = package rts ? do libffiName <- expr libffiLibraryName ffiIncludeDir <- getSetting FfiIncludeDir ffiLibraryDir <- getSetting FfiLibDir - let cArgs = mconcat + + -- Arguments passed to GHC when compiling C and .cmm sources. + let ghcArgs = mconcat [ arg "-Irts" - , rtsWarnings , arg $ "-I" ++ path - , flag UseSystemFfi ? arg ("-I" ++ ffiIncludeDir) , arg $ "-DRtsWay=\"rts_" ++ show way ++ "\"" -- Set the namespace for the rts fs functions , arg $ "-DFS_NAMESPACE=rts" , arg $ "-DCOMPILING_RTS" + , notM targetSupportsSMP ? arg "-DNOSMP" + , way `elem` [debug, debugDynamic] ? arg "-DTICKY_TICKY" + , Profiling `wayUnit` way ? arg "-DPROFILING" + , Threaded `wayUnit` way ? arg "-DTHREADED_RTS" + , notM targetSupportsSMP ? pure [ "-DNOSMP" + , "-optc-DNOSMP" ] + ] + + let cArgs = mconcat + [ rtsWarnings + , flag UseSystemFfi ? arg ("-I" ++ ffiIncludeDir) + , arg "-fomit-frame-pointer" -- RTS *must* be compiled with optimisations. The INLINE_HEADER macro -- requires that functions are inlined to work as expected. Inlining -- only happens for optimised builds. Otherwise we can assume that @@ -215,24 +227,21 @@ rtsPackageArgs = package rts ? do -- provide non-inlined alternatives and hence needs the function to -- be inlined. See https://github.com/snowleopard/hadrian/issues/90. , arg "-O2" - , arg "-fomit-frame-pointer" , arg "-g" + , arg "-Irts" + , arg $ "-I" ++ path + , Debug `wayUnit` way ? pure [ "-DDEBUG" , "-fno-omit-frame-pointer" , "-g3" , "-O0" ] - , way `elem` [debug, debugDynamic] ? arg "-DTICKY_TICKY" - , Profiling `wayUnit` way ? arg "-DPROFILING" - , Threaded `wayUnit` way ? arg "-DTHREADED_RTS" , useLibFFIForAdjustors ? arg "-DUSE_LIBFFI_FOR_ADJUSTORS" , inputs ["**/RtsMessages.c", "**/Trace.c"] ? arg ("-DProjectVersion=" ++ show projectVersion) - , notM targetSupportsSMP ? arg "-DNOSMP" - , input "**/RtsUtils.c" ? pure [ "-DProjectVersion=" ++ show projectVersion , "-DHostPlatform=" ++ show hostPlatform @@ -305,7 +314,7 @@ rtsPackageArgs = package rts ? do ] , builder (Cc FindCDependencies) ? cArgs , builder (Ghc CompileCWithGhc) ? map ("-optc" ++) <$> cArgs - , builder Ghc ? arg "-Irts" + , builder Ghc ? ghcArgs , builder HsCpp ? pure [ "-DTOP=" ++ show top |