[commit: ghc] master: Don't use getPackageLinkOpts on iOS; fixes #7720. (e5944d9)
Ian Lynagh
igloo at earth.li
Sat Apr 27 17:46:41 CEST 2013
Repository : http://darcs.haskell.org/ghc.git/
On branch : master
https://github.com/ghc/ghc/commit/e5944d9f04bc6f6e62367be71d5b76e7d0473ee2
>---------------------------------------------------------------
commit e5944d9f04bc6f6e62367be71d5b76e7d0473ee2
Author: Ian Lynagh <ian at well-typed.com>
Date: Sat Apr 27 12:45:04 2013 +0100
Don't use getPackageLinkOpts on iOS; fixes #7720.
On iOS, binaries are really static libraries, so we don't want to use
flags like -lm when linking them.
>---------------------------------------------------------------
compiler/main/DriverPipeline.hs | 8 +++++++-
compiler/utils/Platform.hs | 8 ++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 1328ffe..6c4bff9 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1819,7 +1819,13 @@ linkBinary dflags o_files dep_packages = do
extraLinkObj <- mkExtraObjToLinkIntoBinary dflags
noteLinkObjs <- mkNoteObjsToLinkIntoBinary dflags dep_packages
- pkg_link_opts <- getPackageLinkOpts dflags dep_packages
+ pkg_link_opts <- if platformBinariesAreStaticLibs platform
+ then -- If building an executable really means
+ -- making a static library (e.g. iOS), then
+ -- we don't want the options (like -lm)
+ -- that getPackageLinkOpts gives us. #7720
+ return []
+ else getPackageLinkOpts dflags dep_packages
pkg_framework_path_opts <-
if platformUsesFrameworks platform
diff --git a/compiler/utils/Platform.hs b/compiler/utils/Platform.hs
index 213a63e..617e691 100644
--- a/compiler/utils/Platform.hs
+++ b/compiler/utils/Platform.hs
@@ -13,6 +13,7 @@ module Platform (
isARM,
osElfTarget,
platformUsesFrameworks,
+ platformBinariesAreStaticLibs,
)
where
@@ -135,3 +136,10 @@ osUsesFrameworks _ = False
platformUsesFrameworks :: Platform -> Bool
platformUsesFrameworks = osUsesFrameworks . platformOS
+osBinariesAreStaticLibs :: OS -> Bool
+osBinariesAreStaticLibs OSiOS = True
+osBinariesAreStaticLibs _ = False
+
+platformBinariesAreStaticLibs :: Platform -> Bool
+platformBinariesAreStaticLibs = osBinariesAreStaticLibs . platformOS
+
More information about the ghc-commits
mailing list