[PATCH] do not use -rpath-link linker option on Solaris

Karel Gardas karel.gardas at centrum.cz
Thu Jan 24 22:28:10 CET 2013


This patch removes usage of -rpath-link option on Solaris OS since it is
not supported by the Solaris' linker and its usage causes failures of a lot
of `dyn' testcases
---
 compiler/main/DriverPipeline.hs |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index f47aea7..34d045c 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1752,7 +1752,16 @@ linkBinary dflags o_files dep_packages = do
                   rpath = if gopt Opt_RPath dflags
                           then ["-Wl,-rpath",      "-Wl," ++ libpath]
                           else []
-              in ["-L" ++ l, "-Wl,-rpath-link", "-Wl," ++ l] ++ rpath
+                  -- Solaris 11's linker does not support -rpath-link option. It silently
+                  -- ignores it and then complains about next option which is -l<some
+                  -- dir> as being a directory and not expected object file, E.g
+                  -- ld: elf error: file
+                  -- /tmp/ghc-src/libraries/base/dist-install/build:
+                  -- elf_begin: I/O error: region read: Is a directory
+                  rpath-link = if (platformOS platform) == OSSolaris2
+                               then []
+                               else ["-Wl,-rpath-link", "-Wl," ++ l]
+              in ["-L" ++ l] ++ rpath-link ++ rpath
          | otherwise = ["-L" ++ l]
 
     let lib_paths = libraryPaths dflags
-- 
1.7.3.2




More information about the ghc-devs mailing list