[commit: ghc] master: -dead_strip is now the default on Darwin (0a6c257)
git at git.haskell.org
git at git.haskell.org
Tue Jan 10 19:21:49 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/0a6c257de5c217436ec61fdf4b06bca059181f83/ghc
>---------------------------------------------------------------
commit 0a6c257de5c217436ec61fdf4b06bca059181f83
Author: Demi Obenour <demiobenour at gmail.com>
Date: Thu Jan 5 17:06:26 2017 -0500
-dead_strip is now the default on Darwin
This enables subsections-via-symbols (-dead_strip) by default on Darwin.
The Static Reference Table (SRT) needs to be split in order for
-dead_strip to be helpful, so this commit always splits it on Darwin
systems.
Test Plan: GHC CI on Darwin
Reviewers: erikd, austin, bgamari
Reviewed By: erikd, bgamari
Subscribers: erikd, thomie
Differential Revision: https://phabricator.haskell.org/D2911
GHC Trac Issues: #11040, #13049
>---------------------------------------------------------------
0a6c257de5c217436ec61fdf4b06bca059181f83
compiler/main/DriverPipeline.hs | 24 ++++++++++++++----------
compiler/main/HscMain.hs | 4 +++-
2 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 133bdde..a62233d 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1794,6 +1794,9 @@ linkBinary' staticLink dflags o_files dep_packages = do
in ["-L" ++ l] ++ ["-Wl,-rpath", "-Wl," ++ libpath]
| otherwise = ["-L" ++ l]
+ let dead_strip = if osMachOTarget (platformOS platform)
+ then ["-Wl,-dead_strip"]
+ else []
let lib_paths = libraryPaths dflags
let lib_path_opts = map ("-L"++) lib_paths
@@ -1808,16 +1811,17 @@ linkBinary' staticLink dflags o_files dep_packages = do
-- 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 ++ package_hs_libs ++ extra_libs -- -Wl,-u,<sym> contained in other_flags
- -- needs to be put before -l<package>,
- -- otherwise Solaris linker fails linking
- -- a binary with unresolved symbols in RTS
- -- which are defined in base package
- -- the reason for this is a note in ld(1) about
- -- '-u' option: "The placement of this option
- -- on the command line is significant.
- -- This option must be placed before the library
- -- that defines the symbol."
+ else other_flags ++ dead_strip ++ package_hs_libs ++ extra_libs
+ -- -Wl,-u,<sym> contained in other_flags
+ -- needs to be put before -l<package>,
+ -- otherwise Solaris linker fails linking
+ -- a binary with unresolved symbols in RTS
+ -- which are defined in base package
+ -- the reason for this is a note in ld(1) about
+ -- '-u' option: "The placement of this option
+ -- on the command line is significant.
+ -- This option must be placed before the library
+ -- that defines the symbol."
-- frameworks
pkg_framework_opts <- getPkgFrameworkOpts dflags platform dep_packages
diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs
index 7d80912..12e8a1d 100644
--- a/compiler/main/HscMain.hs
+++ b/compiler/main/HscMain.hs
@@ -137,6 +137,7 @@ import Maybes
import DynFlags
import ErrUtils
+import Platform ( platformOS, OS(OSDarwin) )
import Outputable
import NameEnv
@@ -1392,7 +1393,8 @@ doCodeGen hsc_env this_mod data_tycons
-- we generate one SRT for the whole module.
let
pipeline_stream
- | gopt Opt_SplitObjs dflags || gopt Opt_SplitSections dflags
+ | gopt Opt_SplitObjs dflags || gopt Opt_SplitSections dflags ||
+ platformOS (targetPlatform dflags) == OSDarwin
= {-# SCC "cmmPipeline" #-}
let run_pipeline us cmmgroup = do
let (topSRT', us') = initUs us emptySRT
More information about the ghc-commits
mailing list