diff options
| author | Moritz Angermann <moritz@lichtzwerge.de> | 2014-11-19 16:38:22 -0600 |
|---|---|---|
| committer | Austin Seipp <austin@well-typed.com> | 2014-11-19 17:03:06 -0600 |
| commit | 53a4742d037da2bfd00d1d34a8ea0d49d4cdb490 (patch) | |
| tree | 1922721e21e3b6618ff9b7184d9dc96e9145e535 /compiler/llvmGen | |
| parent | 146dd138e2c3b4ec9b211dcbcedf752aeb79d3d1 (diff) | |
| download | haskell-53a4742d037da2bfd00d1d34a8ea0d49d4cdb490.tar.gz | |
Allow -dead_strip linking on platforms with .subsections_via_symbols
Summary:
This allows to link objects produced with the llvm code generator to be linked with -dead_strip. This applies to at least the iOS cross compiler and OS X compiler.
Signed-off-by: Moritz Angermann <moritz@lichtzwerge.de>
Test Plan: Create a ffi library and link it with -dead_strip. If the resulting binary does not crash, the patch works as advertised.
Reviewers: rwbarton, simonmar, hvr, dterei, mzero, ezyang, austin
Reviewed By: dterei, ezyang, austin
Subscribers: thomie, mzero, simonmar, ezyang, carter
Differential Revision: https://phabricator.haskell.org/D206
Diffstat (limited to 'compiler/llvmGen')
| -rw-r--r-- | compiler/llvmGen/LlvmCodeGen/Ppr.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/llvmGen/LlvmCodeGen/Ppr.hs b/compiler/llvmGen/LlvmCodeGen/Ppr.hs index 9c6a719613..80e8949ac8 100644 --- a/compiler/llvmGen/LlvmCodeGen/Ppr.hs +++ b/compiler/llvmGen/LlvmCodeGen/Ppr.hs @@ -114,12 +114,18 @@ pprInfoTable count info_lbl stat = do (ldata, ltypes) <- genLlvmData (Text, stat) dflags <- getDynFlags + platform <- getLlvmPlatform let setSection (LMGlobal (LMGlobalVar _ ty l _ _ c) d) = do lbl <- strCLabel_llvm info_lbl let sec = mkLayoutSection count ilabel = lbl `appendFS` fsLit iTableSuf gv = LMGlobalVar ilabel ty l sec (llvmInfAlign dflags) c - v = if l == Internal then [gv] else [] + -- See Note [Subsections Via Symbols] + v = if (platformHasSubsectionsViaSymbols platform + && l == ExternallyVisible) + || l == Internal + then [gv] + else [] funInsert ilabel ty return (LMGlobal gv d, v) setSection v = return (v,[]) |
