summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2013-04-27 12:45:04 +0100
committerIan Lynagh <ian@well-typed.com>2013-04-27 13:11:03 +0100
commite5944d9f04bc6f6e62367be71d5b76e7d0473ee2 (patch)
tree75f35c7599cd099c8acb860b6902d682cd6c1c17
parentf6e0dbf32bb19e79690f2233bb925a404f3ab1b6 (diff)
downloadhaskell-e5944d9f04bc6f6e62367be71d5b76e7d0473ee2.tar.gz
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.
-rw-r--r--compiler/main/DriverPipeline.hs8
-rw-r--r--compiler/utils/Platform.hs8
2 files changed, 15 insertions, 1 deletions
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 1328ffe209..6c4bff9364 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 213a63e0c8..617e691ddf 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
+