[commit: ghc] master: add support for x86_64-solaris2 platform (6da6032)

git at git.haskell.org git at git.haskell.org
Mon Jul 14 02:43:36 UTC 2014


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

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

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

commit 6da603213b097a267418d8c14cbfaf0021ac2b2c
Author: Karel Gardas <karel.gardas at centrum.cz>
Date:   Sun Jul 13 21:43:20 2014 -0500

    add support for x86_64-solaris2 platform
    
    Summary:
    this set of patches adds support for x86_64-solaris2 platform
    Solaris is multi-lib platform which means it provides 32bit user-land together
    with 32bit and 64bit libraries. The 32bit libraries are located in <somewhere>/lib
    directories while 64bit libraries are located in <somewhere>/lib/64 directories.
    This is why GHCi required the fix since otherwise it'll attempt to load
    /usr/lib/libgmp.so which is 32bit library into 64bit binary process space (GHCi).
    This of course fails with wrong ELFCLASS32 error message.
    Another issue was that by default GNU C distributed with Solaris compiles
    into 32bit binary. We need to enforce compilation to 64bit binary
    by adding appropriate -m64 option.
    
    Test Plan: already built on x86_64-solaris2
    
    Reviewers: austin
    
    Reviewed By: austin
    
    Subscribers: phaskell, simonmar, relrod, carter
    
    Differential Revision: https://phabricator.haskell.org/D68


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

6da603213b097a267418d8c14cbfaf0021ac2b2c
 aclocal.m4               | 6 ++++++
 compiler/ghci/Linker.lhs | 6 +++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/aclocal.m4 b/aclocal.m4
index d857706..782cae5 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -538,6 +538,12 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
         $4="$$4 -arch x86_64"
         $5="$$5 -m64"
         ;;
+    x86_64-unknown-solaris2)
+        $2="$$2 -m64"
+        $3="$$3 -m64"
+        $4="$$4 -m64"
+        $5="$$5 -m64"
+        ;;
     alpha-*)
         # For now, to suppress the gcc warning "call-clobbered
         # register used for global register variable", we simply
diff --git a/compiler/ghci/Linker.lhs b/compiler/ghci/Linker.lhs
index 0b23985..0dbab24 100644
--- a/compiler/ghci/Linker.lhs
+++ b/compiler/ghci/Linker.lhs
@@ -1209,7 +1209,9 @@ locateLib dflags is_hs dirs lib
      mk_hs_dyn_lib_path dir = dir </> mkHsSOName platform hs_dyn_lib_name
 
      so_name = mkSOName platform lib
-     mk_dyn_lib_path dir = dir </> so_name
+     mk_dyn_lib_path dir = case (arch, os) of
+                             (ArchX86_64, OSSolaris2) -> dir </> ("64/" ++ so_name)
+                             _ -> dir </> so_name
 
      findObject     = liftM (fmap Object)  $ findFile mk_obj_path        dirs
      findDynObject  = liftM (fmap Object)  $ findFile mk_dyn_obj_path    dirs
@@ -1226,6 +1228,8 @@ locateLib dflags is_hs dirs lib
                            Nothing -> g
 
      platform = targetPlatform dflags
+     arch = platformArch platform
+     os = platformOS platform
 
 searchForLibUsingGcc :: DynFlags -> String -> [FilePath] -> IO (Maybe FilePath)
 searchForLibUsingGcc dflags so dirs = do



More information about the ghc-commits mailing list