[Git][ghc/ghc][wip/toolchain-selection] Configure Host toolchain with dummy options, hope they aren't used

Rodrigo Mesquita (@alt-romes) gitlab at gitlab.haskell.org
Mon Jul 10 13:23:56 UTC 2023



Rodrigo Mesquita pushed to branch wip/toolchain-selection at Glasgow Haskell Compiler / GHC


Commits:
9d47c1d0 by Rodrigo Mesquita at 2023-07-10T14:23:46+01:00
Configure Host toolchain with dummy options, hope they aren't used

- - - - -


2 changed files:

- default.host.target.in
- utils/ghc-toolchain/src/GHC/Toolchain/Target.hs


Changes:

=====================================
default.host.target.in
=====================================
@@ -2,39 +2,39 @@ Target
 { tgtArchOs = ArchOS {archOS_arch = @HaskellHostArch@, archOS_OS = @HaskellTargetOs@}
 , tgtVendor = @HostVendor_CPPMaybeStr@
 , tgtLocallyExecutable = True
-, tgtSupportsGnuNonexecStack = undefined
-, tgtSupportsSubsectionsViaSymbols = undefined
-, tgtSupportsIdentDirective = undefined
-, tgtWordSize = undefined
-, tgtEndianness = undefined
-, tgtSymbolsHaveLeadingUnderscore = undefined
-, tgtLlvmTarget = undefined
-, tgtUnregisterised = undefined
-, tgtTablesNextToCode = undefined
-, tgtUseLibffiForAdjustors = undefined
+, tgtSupportsGnuNonexecStack = False
+, tgtSupportsSubsectionsViaSymbols = False
+, tgtSupportsIdentDirective = False
+, tgtWordSize = WS8
+, tgtEndianness = LittleEndian
+, tgtSymbolsHaveLeadingUnderscore = False
+, tgtLlvmTarget = "@HostPlatform@"
+, tgtUnregisterised = False
+, tgtTablesNextToCode = True
+, tgtUseLibffiForAdjustors = True
 , tgtCCompiler = Cc {ccProgram = Program {prgPath = "@CC_STAGE0@", prgFlags = @CONF_CC_OPTS_STAGE0List@}}
 , tgtCxxCompiler = Cxx {cxxProgram = Program {prgPath = "@CC_STAGE0@", prgFlags = @CONF_CXX_OPTS_STAGE0List@}}
 , tgtCPreprocessor = Cpp {cppProgram = Program {prgPath = "@CPPCmd_STAGE0@", prgFlags = @CONF_CPP_OPTS_STAGE0List@}}
 , tgtHsCPreprocessor = HsCpp {hsCppProgram = Program {prgPath = "@CC_STAGE0@", prgFlags = @SettingsHaskellCPPFlagsList@}}
 , tgtCCompilerLink = CcLink
 { ccLinkProgram = Program {prgPath = "@CC_STAGE0@", prgFlags = @CONF_GCC_LINKER_OPTS_STAGE0List@}
-, ccLinkSupportsNoPie = undefined
-, ccLinkSupportsCompactUnwind = undefined
-, ccLinkSupportsFilelist = undefined
-, ccLinkIsGnu = undefined
+, ccLinkSupportsNoPie = False
+, ccLinkSupportsCompactUnwind = False
+, ccLinkSupportsFilelist = False
+, ccLinkIsGnu = False
 }
 
 , tgtAr = Ar
 { arMkArchive = Program {prgPath = "@AR_STAGE0@", prgFlags = @AR_OPTS_STAGE0List@}
-, arIsGnu = undefined
+, arIsGnu = False
 , arSupportsAtFile = @ArSupportsAtFile_STAGE0Bool@
 , arSupportsDashL = @ArSupportsDashL_STAGE0Bool@
-, arNeedsRanlib = undefined
+, arNeedsRanlib = False
 }
 
-, tgtRanlib = undefined
-, tgtNm = undefined
-, tgtMergeObjs = Just (MergeObjs {mergeObjsProgram = Program {prgPath = "@LD_STAGE0@", prgFlags = undefined}, mergeObjsSupportsResponseFiles = undefined})
+, tgtRanlib = Nothing
+, tgtNm = Nm {nmProgram = Program {prgPath = "@NM@", prgFlags = []}}
+, tgtMergeObjs = Just (MergeObjs {mergeObjsProgram = Program {prgPath = "@LD_STAGE0@", prgFlags = ["-r"]}, mergeObjsSupportsResponseFiles = False})
 , tgtDllwrap = @DllWrapCmdMaybeProg@
 , tgtWindres = @WindresCmdMaybeProg@
 }


=====================================
utils/ghc-toolchain/src/GHC/Toolchain/Target.hs
=====================================
@@ -16,10 +16,6 @@ import GHC.Toolchain.Tools.Link
 import GHC.Toolchain.Tools.Nm
 import GHC.Toolchain.Tools.MergeObjs
 
-import GHC.Read
-import Text.ParserCombinators.ReadPrec (prec, reset, (<++))
-import Text.Read.Lex
-
 data WordSize = WS4 | WS8
     deriving (Show, Read, Eq, Ord)
 
@@ -29,7 +25,7 @@ data Endianness = LittleEndian | BigEndian
 -- ROMES:TODO: A target might also need
 -- * Llc command
 -- * Opt command
--- * DistroMinGW?
+-- * DistroMinGW? -- no, this should be configured with existing flags to point to the bindist mingw
 -- * Install_name_tool
 -- * Touch cmd
 -- * otool command
@@ -76,7 +72,7 @@ data Target = Target
     , tgtDllwrap :: Maybe Program
     , tgtWindres :: Maybe Program
     }
-    deriving (Eq, Ord)
+    deriving (Read, Eq, Ord)
 
 -- | The word size as an integer representing the number of bytes
 wordSize2Bytes :: WordSize -> Int
@@ -93,11 +89,8 @@ targetPlatformTriple Target{tgtArchOs, tgtVendor} =
         Nothing -> archStr <> "-" <> osStr
         Just vendor -> archStr <> "-" <> vendor <> "-" <> osStr
 
-{-
-  Handwritten Show and Read instances to have have better diffs and parse
-  toolchain targets generated by configure
--}
-
+-- | Handwritten Show instance to have have better diffs against the toolchain
+-- targets generated by configure
 instance Show Target where
   show Target{..} = unlines
     [ "Target"
@@ -127,64 +120,3 @@ instance Show Target where
     , ", tgtWindres = " ++ show tgtDllwrap
     , "}"
     ]
-
-instance Read GHC.Toolchain.Target.Target where
-  readPrec = parens $ prec 11 $ do
-      expectP (Ident "Target")
-      expectP (Punc "{")
-      tgtArchOs                        <- readFieldOrUndefined "tgtArchOs"
-      expectP (Punc ",")
-      tgtVendor                        <- readFieldOrUndefined "tgtVendor"
-      expectP (Punc ",")
-      tgtLocallyExecutable             <- readFieldOrUndefined "tgtLocallyExecutable"
-      expectP (Punc ",")
-      tgtSupportsGnuNonexecStack       <- readFieldOrUndefined "tgtSupportsGnuNonexecStack"
-      expectP (Punc ",")
-      tgtSupportsSubsectionsViaSymbols <- readFieldOrUndefined "tgtSupportsSubsectionsViaSymbols"
-      expectP (Punc ",")
-      tgtSupportsIdentDirective        <- readFieldOrUndefined "tgtSupportsIdentDirective"
-      expectP (Punc ",")
-      tgtWordSize                      <- readFieldOrUndefined "tgtWordSize"
-      expectP (Punc ",")
-      tgtEndianness                    <- readFieldOrUndefined "tgtEndianness"
-      expectP (Punc ",")
-      tgtSymbolsHaveLeadingUnderscore  <- readFieldOrUndefined "tgtSymbolsHaveLeadingUnderscore"
-      expectP (Punc ",")
-      tgtLlvmTarget                    <- readFieldOrUndefined "tgtLlvmTarget"
-      expectP (Punc ",")
-      tgtUnregisterised                <- readFieldOrUndefined "tgtUnregisterised"
-      expectP (Punc ",")
-      tgtTablesNextToCode              <- readFieldOrUndefined "tgtTablesNextToCode"
-      expectP (Punc ",")
-      tgtUseLibffiForAdjustors         <- readFieldOrUndefined "tgtUseLibffiForAdjustors"
-      expectP (Punc ",")
-      tgtCCompiler                     <- readFieldOrUndefined "tgtCCompiler"
-      expectP (Punc ",")
-      tgtCxxCompiler                   <- readFieldOrUndefined "tgtCxxCompiler"
-      expectP (Punc ",")
-      tgtCPreprocessor                 <- readFieldOrUndefined "tgtCPreprocessor"
-      expectP (Punc ",")
-      tgtHsCPreprocessor               <- readFieldOrUndefined "tgtHsCPreprocessor"
-      expectP (Punc ",")
-      tgtCCompilerLink                 <- readFieldOrUndefined "tgtCCompilerLink"
-      expectP (Punc ",")
-      tgtAr                            <- readFieldOrUndefined "tgtAr"
-      expectP (Punc ",")
-      tgtRanlib                        <- readFieldOrUndefined "tgtRanlib"
-      expectP (Punc ",")
-      tgtNm                            <- readFieldOrUndefined "tgtNm"
-      expectP (Punc ",")
-      tgtMergeObjs                     <- readFieldOrUndefined "tgtMergeObjs"
-      expectP (Punc ",")
-      tgtDllwrap                       <- readFieldOrUndefined "tgtDllwrap"
-      expectP (Punc ",")
-      tgtWindres                       <- readFieldOrUndefined "tgtWindres"
-      expectP (Punc "}")
-      return Target{..}
-    where
-      readFieldOrUndefined fieldName = do
-          expectP (Ident fieldName)
-          expectP (Punc "=")
-          ((reset (expectP (Ident "undefined")) >> return undefined) <++ reset readPrec)
-      {-# NOINLINE readFieldOrUndefined #-}
-



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9d47c1d0fa19b758d1a5f8f3bdd02551a2b0c0d2

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9d47c1d0fa19b758d1a5f8f3bdd02551a2b0c0d2
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230710/c6be889c/attachment-0001.html>


More information about the ghc-commits mailing list