Skip to content

Commit

Permalink
Don't use getPackageLinkOpts on iOS; fixes #7720.
Browse files Browse the repository at this point in the history
On iOS, binaries are really static libraries, so we don't want to use
flags like -lm when linking them.
  • Loading branch information
Ian Lynagh committed Apr 27, 2013
1 parent f6e0dbf commit e5944d9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
8 changes: 7 additions & 1 deletion compiler/main/DriverPipeline.hs
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions compiler/utils/Platform.hs
Expand Up @@ -13,6 +13,7 @@ module Platform (
isARM,
osElfTarget,
platformUsesFrameworks,
platformBinariesAreStaticLibs,
)

where
Expand Down Expand Up @@ -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

0 comments on commit e5944d9

Please sign in to comment.