[commit: ghc] master: Allow building static libs. (8c1cedd)

git at git.haskell.org git at git.haskell.org
Sat Jun 25 16:07:48 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/8c1ceddd50158f79f9ff103f8f34be9856d4da1d/ghc

>---------------------------------------------------------------

commit 8c1ceddd50158f79f9ff103f8f34be9856d4da1d
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date:   Sat Jun 25 17:07:57 2016 +0100

    Allow building static libs.
    
    Summary:
    Commit 90538d86af579595987826cd893828d6f379f35a, 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: https://phabricator.haskell.org/D2362


>---------------------------------------------------------------

8c1ceddd50158f79f9ff103f8f34be9856d4da1d
 compiler/main/SysTools.hs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs
index c86935e..6cdb07e 100644
--- a/compiler/main/SysTools.hs
+++ b/compiler/main/SysTools.hs
@@ -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



More information about the ghc-commits mailing list