Commit 8c1ceddd authored by Moritz Angermann's avatar Moritz Angermann Committed by Tamar Christina

Allow building static libs.

Commit 90538d86, seems to have broken static linking.
The introduction of `argFixup` in `runLink` rearranges libs, and considers
anything with an `-l` prefix or `.a` suffix a lib, which fails for libs that are
just being linked together (e.g. `-o lib.a`).

The proposed solution explicitly checks for the existance of the `-o` flag.

Reviewers: rwbarton, erikd, Phyx, bgamari, austin

Reviewed By: Phyx

Subscribers: thomie

Differential Revision:
parent 4cc5a39e
......@@ -928,6 +928,8 @@ runLink dflags args = do
This functions moves libraries on the link all the way back
but keeps the order amongst them the same. -}
argFixup [] r = [] ++ r
-- retain any lib in "-o" position.
argFixup (o@(Option "-o"):o'@(FileOption _ _):xs) r = o:o':argFixup xs r
argFixup (o@(Option opt):xs) r = if testLib opt
then argFixup xs (r ++ [o])
else o:argFixup xs r
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment