[commit: ghc] master: Fix building on Sparc/Solaris with non-GNU linker; fixes #5407 (9ef4d48)

Ian Lynagh <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/9ef4d48e296d4b96492a839f9ee569f8f90c617b

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

commit 9ef4d48e296d4b96492a839f9ee569f8f90c617b
Author: Ian Lynagh <[email protected]>
Date:   Fri Nov 23 16:54:15 2012 +0000

    Fix building on Sparc/Solaris with non-GNU linker; fixes #5407
    
    Patch from maeder.

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

 compiler/main/DriverPipeline.hs |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 2326e57..da4f674 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1955,6 +1955,7 @@ hsSourceCppOpts =
 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 ([
                             SysTools.Option "-nostdlib",
                             SysTools.Option "-nodefaultlibs",
@@ -1964,6 +1965,7 @@ joinObjectFiles dflags o_files output_fn = do
                             -- -r and --relax are incompatible for ld, so
                             -- disable --relax explicitly.
                          ++ (if platformArch (targetPlatform dflags) == ArchSPARC
+                             && ldIsGnuLd
                                 then [SysTools.Option "-Wl,-no-relax"]
                                 else [])
                          ++ map SysTools.Option ld_build_id
@@ -1977,7 +1979,7 @@ joinObjectFiles dflags o_files output_fn = do
       ld_build_id | sLdSupportsBuildId mySettings = ["-Wl,--build-id=none"]
                   | otherwise                     = []
 
-  if sLdIsGnuLd mySettings
+  if ldIsGnuLd
      then do
           script <- newTempName dflags "ldscript"
           writeFile script $ "INPUT(" ++ unwords o_files ++ ")"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.