[commit: ghc] master: Disable saving the linker options in the binary on Solaris (#5382). (d7ca829)

Simon Marlow marlowsd at gmail.com
Wed Aug 10 13:03:27 CEST 2011


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/d7ca829ec8b1507a47f89e1d2f1d45c26d15e406

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

commit d7ca829ec8b1507a47f89e1d2f1d45c26d15e406
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Wed Aug 10 10:01:44 2011 +0100

    Disable saving the linker options in the binary on Solaris (#5382).
    Also refactor the check into one place.

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

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

diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index fdb5ce3..ee002b2 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -389,7 +389,7 @@ linkingNeeded dflags linkables pkg_deps = do
 -- previous binary was linked with "the same options".
 checkLinkInfo :: DynFlags -> [PackageId] -> FilePath -> IO Bool
 checkLinkInfo dflags pkg_deps exe_file
- | isWindowsTarget || isDarwinTarget
+ | not (platformSupportsSavingLinkOpts (platformOS (targetPlatform dflags)))
  -- ToDo: Windows and OS X do not use the ELF binary format, so
  -- readelf does not work there.  We need to find another way to do
  -- this.
@@ -404,6 +404,11 @@ checkLinkInfo dflags pkg_deps exe_file
    debugTraceMsg dflags 3 $ text ("Exe link info: " ++ show m_exe_link_info)
    return (Just link_info /= m_exe_link_info)
 
+platformSupportsSavingLinkOpts :: OS -> Bool
+platformSupportsSavingLinkOpts os
+  | os == OSSolaris2 = False -- see #5382
+  | otherwise        = osElfTarget os
+
 ghcLinkInfoSectionName :: String
 ghcLinkInfoSectionName = ".debug-ghc-link-info"
    -- if we use the ".debug" prefix, then strip will strip it by default
@@ -1441,9 +1446,9 @@ mkExtraObjToLinkIntoBinary dflags dep_packages = do
           Just opts -> text "char *ghc_rts_opts = " <> text (show opts) <> semi
 
     link_opts info
-      | isDarwinTarget  = empty
-      | isWindowsTarget = empty
-      | otherwise = hcat [
+     | not (platformSupportsSavingLinkOpts (platformOS (targetPlatform dflags)))
+     = empty
+     | otherwise = hcat [
           text "__asm__(\"\\t.section ", text ghcLinkInfoSectionName,
                                     text ",\\\"\\\",",
                                     text elfSectionNote,





More information about the Cvs-ghc mailing list