From 166e1c2adf73b69bfbbec81e98a78814a031ddc7 Mon Sep 17 00:00:00 2001 From: Stefan Schulze Frielinghaus Date: Tue, 8 Oct 2019 10:23:21 +0200 Subject: Hadrian: Take care of assembler source files Fixes #17286. --- hadrian/src/Rules/Compile.hs | 3 +++ hadrian/src/Rules/Library.hs | 4 +++- hadrian/src/Rules/Program.hs | 10 ++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'hadrian') diff --git a/hadrian/src/Rules/Compile.hs b/hadrian/src/Rules/Compile.hs index 92a94fe611..546ce08cb6 100644 --- a/hadrian/src/Rules/Compile.hs +++ b/hadrian/src/Rules/Compile.hs @@ -41,6 +41,9 @@ compilePackage rs = do [ root -/- "**/build/s/**/*." ++ wayPat ++ "o" | wayPat <- wayPats] |%> compileNonHsObject rs Asm + [ root -/- "**/build/S/**/*." ++ wayPat ++ "o" + | wayPat <- wayPats] |%> compileNonHsObject rs Asm + -- All else is haskell. -- This comes last as it overlaps with the above rules' file patterns. forM_ ((,) <$> hsExts <*> wayPats) $ \ ((oExt, hiExt), wayPat) -> diff --git a/hadrian/src/Rules/Library.hs b/hadrian/src/Rules/Library.hs index 0daf4681d1..320f45a878 100644 --- a/hadrian/src/Rules/Library.hs +++ b/hadrian/src/Rules/Library.hs @@ -112,11 +112,13 @@ allObjects context = (++) <$> nonHsObjects context <*> hsObjects context -- (object files built from C, C-- and sometimes other things). nonHsObjects :: Context -> Action [FilePath] nonHsObjects context = do + asmSrcs <- interpretInContext context (getContextData asmSrcs) + asmObjs <- mapM (objectPath context) asmSrcs cObjs <- cObjects context cmmSrcs <- interpretInContext context (getContextData cmmSrcs) cmmObjs <- mapM (objectPath context) cmmSrcs eObjs <- extraObjects context - return $ cObjs ++ cmmObjs ++ eObjs + return $ asmObjs ++ cObjs ++ cmmObjs ++ eObjs -- | Return all the C object files needed to build the given library context. cObjects :: Context -> Action [FilePath] diff --git a/hadrian/src/Rules/Program.hs b/hadrian/src/Rules/Program.hs index 6273f3da4d..df542c0f1e 100644 --- a/hadrian/src/Rules/Program.hs +++ b/hadrian/src/Rules/Program.hs @@ -114,10 +114,12 @@ buildBinary rs bin context@Context {..} = do when (stage > Stage0) $ do ways <- interpretInContext context (getLibraryWays <> getRtsWays) needLibrary [ (rtsContext stage) { way = w } | w <- ways ] - cSrcs <- interpretInContext context (getContextData cSrcs) - cObjs <- mapM (objectPath context) cSrcs - hsObjs <- hsObjects context - let binDeps = cObjs ++ hsObjs + asmSrcs <- interpretInContext context (getContextData asmSrcs) + asmObjs <- mapM (objectPath context) asmSrcs + cSrcs <- interpretInContext context (getContextData cSrcs) + cObjs <- mapM (objectPath context) cSrcs + hsObjs <- hsObjects context + let binDeps = asmObjs ++ cObjs ++ hsObjs need binDeps buildWithResources rs $ target context (Ghc LinkHs stage) binDeps [bin] synopsis <- pkgSynopsis package -- cgit v1.2.1