[commit: ghc] master: Don't pass -nodefaultlibs to Clang (d0ed1ff)

git at git.haskell.org git at git.haskell.org
Thu Jan 16 01:16:49 UTC 2014


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

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

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

commit d0ed1ff1185981d2e827a18696f7caa53eef4af3
Author: Austin Seipp <austin at well-typed.com>
Date:   Wed Jan 15 18:56:55 2014 -0600

    Don't pass -nodefaultlibs to Clang
    
    This fixes a large majority of the testsuite failures on Mavericks with
    Clang.
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>


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

d0ed1ff1185981d2e827a18696f7caa53eef4af3
 compiler/main/DriverPipeline.hs |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index a95c179..19fb717 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -2124,11 +2124,12 @@ joinObjectFiles :: DynFlags -> [FilePath] -> FilePath -> IO ()
 joinObjectFiles dflags o_files output_fn = do
   let mySettings = settings dflags
       ldIsGnuLd = sLdIsGnuLd mySettings
-      ld_r args = SysTools.runLink dflags ([
+      ld_r args ccInfo = SysTools.runLink dflags ([
                             SysTools.Option "-nostdlib",
-                            SysTools.Option "-nodefaultlibs",
                             SysTools.Option "-Wl,-r"
                             ]
+                         ++ (if ccInfo == Clang then []
+                              else [SysTools.Option "-nodefaultlibs"])
                             -- gcc on sparc sets -Wl,--relax implicitly, but
                             -- -r and --relax are incompatible for ld, so
                             -- disable --relax explicitly.
@@ -2147,19 +2148,20 @@ joinObjectFiles dflags o_files output_fn = do
       ld_build_id | sLdSupportsBuildId mySettings = ["-Wl,--build-id=none"]
                   | otherwise                     = []
 
+  ccInfo <- getCompilerInfo dflags
   if ldIsGnuLd
      then do
           script <- newTempName dflags "ldscript"
           writeFile script $ "INPUT(" ++ unwords o_files ++ ")"
-          ld_r [SysTools.FileOption "" script]
+          ld_r [SysTools.FileOption "" script] ccInfo
      else if sLdSupportsFilelist mySettings
      then do
           filelist <- newTempName dflags "filelist"
           writeFile filelist $ unlines o_files
           ld_r [SysTools.Option "-Wl,-filelist",
-                SysTools.FileOption "-Wl," filelist]
+                SysTools.FileOption "-Wl," filelist] ccInfo
      else do
-          ld_r (map (SysTools.FileOption "") o_files)
+          ld_r (map (SysTools.FileOption "") o_files) ccInfo
 
 -- -----------------------------------------------------------------------------
 -- Misc.



More information about the ghc-commits mailing list