gcc output parser
This commit is contained in:
parent
0bf516d018
commit
a5644eeeb9
1 changed files with 23 additions and 10 deletions
|
@ -43,17 +43,30 @@ parseGhcLink = do
|
||||||
restOfLine
|
restOfLine
|
||||||
manglepaths = replace "\\" "/"
|
manglepaths = replace "\\" "/"
|
||||||
|
|
||||||
{- Find where gcc calls collect1. -}
|
{- Find where gcc calls collect2. -}
|
||||||
parseGccLink :: Parser CmdParams
|
parseGccLink :: Parser CmdParams
|
||||||
parseGccLink = do
|
parseGccLink = do
|
||||||
many prelinkline
|
many precollectenvline
|
||||||
error "TODO"
|
env <- collectenvline
|
||||||
|
try $ char ' '
|
||||||
|
path <- manyTill anyChar (try $ string collectcmd)
|
||||||
|
char ' '
|
||||||
|
collect2params <- restOfLine
|
||||||
|
return $ CmdParams (path ++ collectcmd) collect2params
|
||||||
where
|
where
|
||||||
prelinkline = error "TODO"
|
collectcmd = "collect2.exe"
|
||||||
|
collectenv = "COLLECT_GCC_OPTIONS"
|
||||||
|
collectenvline = do
|
||||||
|
string collectenv
|
||||||
|
char '='
|
||||||
|
restOfLine
|
||||||
|
precollectenvline = do
|
||||||
|
notFollowedBy collectenvline
|
||||||
|
restOfLine
|
||||||
|
|
||||||
{- Find where collect1 calls ld. -}
|
{- Find where collect2 calls ld. -}
|
||||||
parseCollect1 :: Parser CmdParams
|
parseCollect2 :: Parser CmdParams
|
||||||
parseCollect1 = error "TODO"
|
parseCollect2 = error "TODO"
|
||||||
|
|
||||||
restOfLine :: Parser String
|
restOfLine :: Parser String
|
||||||
restOfLine = newline `after` many (noneOf "\n")
|
restOfLine = newline `after` many (noneOf "\n")
|
||||||
|
@ -86,6 +99,6 @@ main = do
|
||||||
["build", "--ghc-options=-v -keep-tmp-files"]
|
["build", "--ghc-options=-v -keep-tmp-files"]
|
||||||
gccout <- runAtFile parseGhcLink ghcout "gcc.opt" ["-v"]
|
gccout <- runAtFile parseGhcLink ghcout "gcc.opt" ["-v"]
|
||||||
writeFile "gcc.out" gccout
|
writeFile "gcc.out" gccout
|
||||||
collect1out <- runAtFile parseGccLink gccout "collect1.opt" ["-v"]
|
collect2out <- runAtFile parseGccLink gccout "collect2.opt" ["-v"]
|
||||||
writeFile "collect1.out" collect1out
|
writeFile "collect2.out" collect2out
|
||||||
void $ runAtFile parseCollect1 collect1out "ld.opt" []
|
void $ runAtFile parseCollect2 collect2out "ld.opt" []
|
||||||
|
|
Loading…
Add table
Reference in a new issue