summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-03-29 11:55:17 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-04-25 10:19:29 -0400
commitcb71226f9537e542c6eadb90d8006e525c941605 (patch)
tree8f488b40320083d59dc47fdfe25fc2554398becd
parent9587726f53e51e429bdb8d8ca11f9de4d0902b77 (diff)
downloadhaskell-cb71226f9537e542c6eadb90d8006e525c941605.tar.gz
Drop dead code in GHC.Linker.Static.linkBinary'
Previously we supported building statically-linked executables using libtool. However, this was dropped in 91262e75dd1d80f8f28a3922934ec7e59290e28c in favor of using ar/ranlib directly. Consequently we can drop this logic. Fixes #18826.
-rw-r--r--compiler/GHC/Linker/Static.hs23
1 files changed, 5 insertions, 18 deletions
diff --git a/compiler/GHC/Linker/Static.hs b/compiler/GHC/Linker/Static.hs
index 7a7dc89c82..95c2f2e430 100644
--- a/compiler/GHC/Linker/Static.hs
+++ b/compiler/GHC/Linker/Static.hs
@@ -1,6 +1,5 @@
module GHC.Linker.Static
( linkBinary
- , linkBinary'
, linkStaticLib
)
where
@@ -65,15 +64,12 @@ it is supported by both gcc and clang. Anecdotally nvcc supports
-}
linkBinary :: Logger -> TmpFs -> DynFlags -> UnitEnv -> [FilePath] -> [UnitId] -> IO ()
-linkBinary = linkBinary' False
-
-linkBinary' :: Bool -> Logger -> TmpFs -> DynFlags -> UnitEnv -> [FilePath] -> [UnitId] -> IO ()
-linkBinary' staticLink logger tmpfs dflags unit_env o_files dep_units = do
+linkBinary logger tmpfs dflags unit_env o_files dep_units = do
let platform = ue_platform unit_env
unit_state = ue_units unit_env
toolSettings' = toolSettings dflags
verbFlags = getVerbFlags dflags
- output_fn = exeFileName platform staticLink (outputFile_ dflags)
+ output_fn = exeFileName platform False (outputFile_ dflags)
-- get the full list of packages to link with, by combining the
-- explicit packages with the auto packages and all of their
@@ -153,13 +149,7 @@ linkBinary' staticLink logger tmpfs dflags unit_env o_files dep_units = do
pkg_link_opts <- do
(package_hs_libs, extra_libs, other_flags) <- getUnitLinkOpts dflags unit_env dep_units
- return $ if staticLink
- then package_hs_libs -- If building an executable really means making a static
- -- library (e.g. iOS), then we only keep the -l options for
- -- HS packages, because libtool doesn't accept other options.
- -- In the case of iOS these need to be added by hand to the
- -- final link in Xcode.
- else other_flags ++ dead_strip
+ return $ other_flags ++ dead_strip
++ pre_hs_libs ++ package_hs_libs ++ post_hs_libs
++ extra_libs
-- -Wl,-u,<sym> contained in other_flags
@@ -184,8 +174,7 @@ linkBinary' staticLink logger tmpfs dflags unit_env o_files dep_units = do
OSMinGW32 | gopt Opt_GenManifest dflags -> maybeCreateManifest logger tmpfs dflags output_fn
_ -> return []
- let link dflags args | staticLink = GHC.SysTools.runLibtool logger dflags args
- | platformOS platform == OSDarwin
+ let link dflags args | platformOS platform == OSDarwin
= do
GHC.SysTools.runLink logger tmpfs dflags args
GHC.Linker.MacOS.runInjectRPaths logger dflags pkg_lib_paths output_fn
@@ -220,7 +209,6 @@ linkBinary' staticLink logger tmpfs dflags unit_env o_files dep_units = do
-- on x86.
++ (if not (gopt Opt_CompactUnwind dflags) &&
toolSettings_ldSupportsCompactUnwind toolSettings' &&
- not staticLink &&
(platformOS platform == OSDarwin) &&
case platformArch platform of
ArchX86 -> True
@@ -238,8 +226,7 @@ linkBinary' staticLink logger tmpfs dflags unit_env o_files dep_units = do
-- whether this is something we ought to fix, but
-- for now this flags silences them.
++ (if platformOS platform == OSDarwin &&
- platformArch platform == ArchX86 &&
- not staticLink
+ platformArch platform == ArchX86
then ["-Wl,-read_only_relocs,suppress"]
else [])