[commit: ghc] ghc-7.6: MERGED: Fix building on Sparc/Solaris with non-GNU linker; fixes #5407 (09894b0)

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  : ghc-7.6

http://hackage.haskell.org/trac/ghc/changeset/09894b0af6569ebb19ddaa16dd1bc564b46d7959

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

commit 09894b0af6569ebb19ddaa16dd1bc564b46d7959
Author: Ian Lynagh <[email protected]>
Date:   Thu Nov 29 13:33:05 2012 +0000

    MERGED: Fix building on Sparc/Solaris with non-GNU linker; fixes #5407
    
    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 |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 9f9f9da..6c35f71 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -2097,7 +2097,8 @@ hsSourceCppOpts =
 
 joinObjectFiles :: DynFlags -> [FilePath] -> FilePath -> IO ()
 joinObjectFiles dflags o_files output_fn = do
-  let ld_r args = SysTools.runLink dflags ([
+  let ldIsGnuLd = cLdIsGNULd == "YES"
+      ld_r args = SysTools.runLink dflags ([
                             SysTools.Option "-nostdlib",
                             SysTools.Option "-nodefaultlibs",
                             SysTools.Option "-Wl,-r"
@@ -2106,6 +2107,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 [])
                          ++ [
@@ -2129,7 +2131,7 @@ joinObjectFiles dflags o_files output_fn = do
       ld_build_id | cLdHasBuildId == "YES"  = "-Wl,--build-id=none"
                   | otherwise               = ""
 
-  if cLdIsGNULd == "YES"
+  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.