[commit: ghc] master: Drop special handling of iOS (68c00a1)

git at git.haskell.org git at git.haskell.org
Wed Apr 12 18:53:43 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/68c00a1b38707b2a5c813cbe3da3ffb7d97893b6/ghc

>---------------------------------------------------------------

commit 68c00a1b38707b2a5c813cbe3da3ffb7d97893b6
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date:   Wed Apr 12 14:12:33 2017 -0400

    Drop special handling of iOS
    
    iOS at least since iOS8 (we are currently at iOS10.3), allows for
    dynamic libaries, hence any artificail restriction on dyanmic
    libraries should be lifted.
    
    Please ping me with any iOS related issues that should potentially
    resurface.  The iOS toolchain has considerably changed over the
    years, and I'm willing to drop work arounds in good faith.
    
    Reviewers: bgamari, austin
    
    Reviewed By: bgamari
    
    Subscribers: rwbarton, thomie
    
    GHC Trac Issues: #13559, #7722
    
    Differential Revision: https://phabricator.haskell.org/D3451


>---------------------------------------------------------------

68c00a1b38707b2a5c813cbe3da3ffb7d97893b6
 compiler/main/DriverPipeline.hs | 9 +--------
 compiler/main/DynFlags.hs       | 9 ---------
 compiler/main/SysTools.hs       | 3 +--
 compiler/utils/Platform.hs      | 9 +--------
 4 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index df1ffd5..8e21b09 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -378,7 +378,7 @@ link' dflags batch_attempt_linking hpt
         let
             staticLink = case ghcLink dflags of
                           LinkStaticLib -> True
-                          _ -> platformBinariesAreStaticLibs (targetPlatform dflags)
+                          _ -> False
 
             home_mod_infos = eltsHpt hpt
 
@@ -1953,13 +1953,6 @@ linkBinary' staticLink dflags o_files dep_packages = do
                           then ["-Wl,-no_compact_unwind"]
                           else [])
 
-                      -- '-no_pie'
-                      -- iOS uses 'dynamic-no-pic', so we must pass this to ld to suppress a warning; see #7722
-                      ++ (if platformOS platform == OSiOS &&
-                             not staticLink
-                          then ["-Wl,-no_pie"]
-                          else [])
-
                       -- '-Wl,-read_only_relocs,suppress'
                       -- ld gives loads of warnings like:
                       --     ld: warning: text reloc in _base_GHCziArr_unsafeArray_info to _base_GHCziArr_unsafeArray_closure
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 07e9517..70efc54 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -5176,15 +5176,6 @@ makeDynFlagsConsistent dflags
       = let dflags' = dflags { hscTarget = HscLlvm }
             warn = "No native code generator, so using LLVM"
         in loop dflags' warn
- | hscTarget dflags == HscLlvm &&
-   not ((arch == ArchX86_64) && (os == OSLinux || os == OSDarwin || os == OSFreeBSD)) &&
-   not ((isARM arch) && (os == OSLinux)) &&
-   (gopt Opt_PIC dflags || WayDyn `elem` ways dflags)
-    = if cGhcWithNativeCodeGen == "YES"
-      then let dflags' = dflags { hscTarget = HscAsm }
-               warn = "Using native code generator rather than LLVM, as LLVM is incompatible with -fPIC and -dynamic on this platform"
-           in loop dflags' warn
-      else throwGhcException $ CmdLineError "Can't use -fPIC or -dynamic on this platform"
  | os == OSDarwin &&
    arch == ArchX86_64 &&
    not (gopt Opt_PIC dflags)
diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs
index fd3faf1..16f8d1a 100644
--- a/compiler/main/SysTools.hs
+++ b/compiler/main/SysTools.hs
@@ -1663,7 +1663,7 @@ linkDynLib dflags0 o_files dep_packages
                  ++ pkg_lib_path_opts
                  ++ pkg_link_opts
                 ))
-        OSDarwin -> do
+        _ | os `elem` [OSDarwin, OSiOS] -> do
             -------------------------------------------------------------------
             -- Making a darwin dylib
             -------------------------------------------------------------------
@@ -1723,7 +1723,6 @@ linkDynLib dflags0 o_files dep_packages
                  ++ map Option pkg_link_opts
                  ++ map Option pkg_framework_opts
               )
-        OSiOS -> throwGhcExceptionIO (ProgramError "dynamic libraries are not supported on iOS target")
         _ -> do
             -------------------------------------------------------------------
             -- Making a DSO
diff --git a/compiler/utils/Platform.hs b/compiler/utils/Platform.hs
index 86c70a9..7f74970 100644
--- a/compiler/utils/Platform.hs
+++ b/compiler/utils/Platform.hs
@@ -16,7 +16,6 @@ module Platform (
         osMachOTarget,
         osSubsectionsViaSymbols,
         platformUsesFrameworks,
-        platformBinariesAreStaticLibs,
 )
 
 where
@@ -148,6 +147,7 @@ osElfTarget OSUnknown   = False
 -- | This predicate tells us whether the OS support Mach-O shared libraries.
 osMachOTarget :: OS -> Bool
 osMachOTarget OSDarwin = True
+osMachOTarget OSiOS    = True
 osMachOTarget _ = False
 
 osUsesFrameworks :: OS -> Bool
@@ -158,15 +158,8 @@ osUsesFrameworks _        = False
 platformUsesFrameworks :: Platform -> Bool
 platformUsesFrameworks = osUsesFrameworks . platformOS
 
-osBinariesAreStaticLibs :: OS -> Bool
-osBinariesAreStaticLibs OSiOS = True
-osBinariesAreStaticLibs _     = False
-
 osSubsectionsViaSymbols :: OS -> Bool
 osSubsectionsViaSymbols OSDarwin = True
 osSubsectionsViaSymbols OSiOS    = True
 osSubsectionsViaSymbols _        = False
 
-platformBinariesAreStaticLibs :: Platform -> Bool
-platformBinariesAreStaticLibs = osBinariesAreStaticLibs . platformOS
-



More information about the ghc-commits mailing list