From e5944d9f04bc6f6e62367be71d5b76e7d0473ee2 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Sat, 27 Apr 2013 12:45:04 +0100 Subject: [PATCH] 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 1328ffe209dd..6c4bff9364cc 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 213a63e0c810..617e691ddf21 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 +