Commit 68c00a1b authored by Moritz Angermann's avatar Moritz Angermann Committed by Ben Gamari
Browse files

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
parent 8121748d
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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
Markdown is supported
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