Commit e5944d9f authored by ian@well-typed.com's avatar ian@well-typed.com
Browse files

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.
parent f6e0dbf3
...@@ -1819,7 +1819,13 @@ linkBinary dflags o_files dep_packages = do ...@@ -1819,7 +1819,13 @@ linkBinary dflags o_files dep_packages = do
extraLinkObj <- mkExtraObjToLinkIntoBinary dflags extraLinkObj <- mkExtraObjToLinkIntoBinary dflags
noteLinkObjs <- mkNoteObjsToLinkIntoBinary dflags dep_packages 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 <- pkg_framework_path_opts <-
if platformUsesFrameworks platform if platformUsesFrameworks platform
......
...@@ -13,6 +13,7 @@ module Platform ( ...@@ -13,6 +13,7 @@ module Platform (
isARM, isARM,
osElfTarget, osElfTarget,
platformUsesFrameworks, platformUsesFrameworks,
platformBinariesAreStaticLibs,
) )
where where
...@@ -135,3 +136,10 @@ osUsesFrameworks _ = False ...@@ -135,3 +136,10 @@ osUsesFrameworks _ = False
platformUsesFrameworks :: Platform -> Bool platformUsesFrameworks :: Platform -> Bool
platformUsesFrameworks = osUsesFrameworks . platformOS platformUsesFrameworks = osUsesFrameworks . platformOS
osBinariesAreStaticLibs :: OS -> Bool
osBinariesAreStaticLibs OSiOS = True
osBinariesAreStaticLibs _ = False
platformBinariesAreStaticLibs :: Platform -> Bool
platformBinariesAreStaticLibs = osBinariesAreStaticLibs . platformOS
Supports Markdown
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