Peter Trommler pushed to branch wip/T26819 at Glasgow Haskell Compiler / GHC

Commits:

4 changed files:

Changes:

  • hadrian/src/Builder.hs
    ... ... @@ -49,7 +49,7 @@ import GHC.Toolchain.Program
    49 49
     -- * Compile or preprocess a source file.
    
    50 50
     -- * Extract source dependencies by passing @-MM@ command line argument.
    
    51 51
     data CcMode = CompileC | FindCDependencies DependencyType deriving (Eq, Generic, Show)
    
    52
    -data DependencyType = CDep | CxxDep deriving (Eq, Generic, Show)
    
    52
    +data DependencyType = CDep | CxxDep | AsmDep deriving (Eq, Generic, Show)
    
    53 53
     
    
    54 54
     instance Binary   CcMode
    
    55 55
     instance Hashable CcMode
    

  • hadrian/src/Rules/Compile.hs
    ... ... @@ -282,8 +282,11 @@ needDependencies lang context@Context {..} src depFile = do
    282 282
                 discover   -- Continue the discovery process
    
    283 283
     
    
    284 284
         -- We need to pass different flags to cc depending on whether the
    
    285
    -    -- file to compile is a .c or a .cpp file
    
    286
    -    depType = if lang == Cxx then CxxDep else CDep
    
    285
    +    -- file to compile is a .c or a .cpp or a .S file
    
    286
    +    depType = case lang of
    
    287
    +                Cxx -> CxxDep
    
    288
    +                Asm -> AsmDep
    
    289
    +                _   -> CDep
    
    287 290
     
    
    288 291
         parseFile :: FilePath -> Action [String]
    
    289 292
         parseFile file = do
    

  • hadrian/src/Settings/Builders/Cc.hs
    ... ... @@ -18,6 +18,7 @@ ccBuilderArgs = do
    18 18
                 , arg "-o", arg =<< getOutput ]
    
    19 19
             , builder (Cc (FindCDependencies CDep)) ? findCDepExpr CDep
    
    20 20
             , builder (Cc (FindCDependencies CxxDep)) ? findCDepExpr CxxDep
    
    21
    +        , builder (Cc (FindCDependencies AsmDep)) ? findCDepExpr AsmDep
    
    21 22
             ]
    
    22 23
         where
    
    23 24
             findCDepExpr depType = do
    
    ... ... @@ -26,10 +27,10 @@ ccBuilderArgs = do
    26 27
                         , arg "-MM", arg "-MG"
    
    27 28
                         , arg "-MF", arg output
    
    28 29
                         , arg "-MT", arg $ dropExtension output -<.> "o"
    
    29
    -                    , case depType of CDep -> mempty; CxxDep -> arg "-std=c++11"
    
    30
    +                    , case depType of CDep -> mempty; CxxDep -> arg "-std=c++11"; AsmDep -> mempty
    
    30 31
                         , cIncludeArgs
    
    31
    -                    , arg "-x", arg (case depType of CDep -> "c"; CxxDep -> "c++")
    
    32
    -                    , case depType of CDep -> mempty; CxxDep -> getContextData cxxOpts
    
    32
    +                    , arg "-x", arg (case depType of CDep -> "c"; CxxDep -> "c++"; AsmDep -> "assembler-with-cpp")
    
    33
    +                    , case depType of CDep -> mempty; CxxDep -> getContextData cxxOpts; AsmDep -> mempty
    
    33 34
                         -- Pass 'ghcversion.h' to give sources access to the
    
    34 35
                         -- `MIN_VERSION_GLASGOW_HASKELL` macro.
    
    35 36
                         , notStage0 ? arg "-include" <> arg "rts/include/ghcversion.h"
    

  • hadrian/src/Settings/Packages.hs
    ... ... @@ -428,6 +428,7 @@ rtsPackageArgs = package rts ? do
    428 428
                   ]
    
    429 429
             , builder (Cc (FindCDependencies CDep)) ? cArgs
    
    430 430
             , builder (Cc (FindCDependencies  CxxDep)) ? cArgs
    
    431
    +        , builder (Cc (FindCDependencies AsmDep)) ? cArgs
    
    431 432
             , builder (Ghc CompileCWithGhc) ? map ("-optc" ++) <$> cArgs
    
    432 433
             , builder (Ghc CompileCppWithGhc) ? map ("-optcxx" ++) <$> cArgs
    
    433 434
             , builder Ghc ? ghcArgs