Commit 6da60321 authored by kgardas's avatar kgardas Committed by Austin Seipp

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
parent 16403f0d
......@@ -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
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment