diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2022-11-09 14:01:11 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-01-25 14:47:41 -0500 |
commit | e987e345c807035e4637ca3eae227ae501e16c42 (patch) | |
tree | 463bb77c1762610af0700495eea39f2ae1c66b2f | |
parent | bc038c3bd45ee99db9fba23a823a906735740200 (diff) | |
download | haskell-e987e345c807035e4637ca3eae227ae501e16c42.tar.gz |
Hadrian: correctly detect AR at-file support
Stage0's ar may not support at-files. Take it into account.
Found while cross-compiling from Darwin to Windows.
-rw-r--r-- | hadrian/cfg/system.config.in | 1 | ||||
-rw-r--r-- | hadrian/src/Builder.hs | 4 | ||||
-rw-r--r-- | hadrian/src/Oracles/Flag.hs | 9 |
3 files changed, 11 insertions, 3 deletions
diff --git a/hadrian/cfg/system.config.in b/hadrian/cfg/system.config.in index 78f66df02f..8cefe803ac 100644 --- a/hadrian/cfg/system.config.in +++ b/hadrian/cfg/system.config.in @@ -40,6 +40,7 @@ python = @PythonCmd@ #============================ ar-supports-at-file = @ArSupportsAtFile@ +system-ar-supports-at-file = @ArSupportsAtFile_STAGE0@ ar-supports-dash-l = @ArSupportsDashL@ system-ar-supports-dash-l = @ArSupportsDashL_STAGE0@ cc-llvm-backend = @CcLlvmBackend@ diff --git a/hadrian/src/Builder.hs b/hadrian/src/Builder.hs index 5bc5cacc80..77c0f514d6 100644 --- a/hadrian/src/Builder.hs +++ b/hadrian/src/Builder.hs @@ -312,8 +312,8 @@ instance H.Builder Builder where -- see Note [Capture stdout as a ByteString] writeFileChangedBS output stdout case builder of - Ar Pack _ -> do - useTempFile <- flag ArSupportsAtFile + Ar Pack stg -> do + useTempFile <- arSupportsAtFile stg if useTempFile then runAr path buildArgs buildInputs else runArWithoutTempFile path buildArgs buildInputs diff --git a/hadrian/src/Oracles/Flag.hs b/hadrian/src/Oracles/Flag.hs index 836834cbfc..1f585595c5 100644 --- a/hadrian/src/Oracles/Flag.hs +++ b/hadrian/src/Oracles/Flag.hs @@ -7,7 +7,8 @@ module Oracles.Flag ( targetSupportsThreadedRts, targetSupportsSMP, useLibffiForAdjustors, - arSupportsDashL + arSupportsDashL, + arSupportsAtFile ) where import Hadrian.Oracles.TextFile @@ -18,6 +19,7 @@ import Oracles.Setting data Flag = ArSupportsAtFile | ArSupportsDashL + | SystemArSupportsAtFile | SystemArSupportsDashL | CrossCompiling | CcLlvmBackend @@ -48,6 +50,7 @@ flag f = do let key = case f of ArSupportsAtFile -> "ar-supports-at-file" ArSupportsDashL -> "ar-supports-dash-l" + SystemArSupportsAtFile-> "system-ar-supports-at-file" SystemArSupportsDashL-> "system-ar-supports-dash-l" CrossCompiling -> "cross-compiling" CcLlvmBackend -> "cc-llvm-backend" @@ -89,6 +92,10 @@ arSupportsDashL :: Stage -> Action Bool arSupportsDashL (Stage0 {}) = flag SystemArSupportsDashL arSupportsDashL _ = flag ArSupportsDashL +arSupportsAtFile :: Stage -> Action Bool +arSupportsAtFile (Stage0 {}) = flag SystemArSupportsAtFile +arSupportsAtFile _ = flag ArSupportsAtFile + platformSupportsSharedLibs :: Action Bool platformSupportsSharedLibs = do windows <- isWinTarget |