
#13378: ghc-stage2 broken for quick-llvm -------------------------------------+------------------------------------- Reporter: angerman | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Building GHC | (amd64) failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): So our options seem to be, in increasing order of desirability: 0. Just don't use `-dead_strip` at link time by default on Darwin. But it doesn't really fix the problem, since a downstream link process could still use `-dead_strip`. Furthermore it would break dead code stripping for the NCG, which currently does work. (We'd then have to use `-split- objs` everywhere to get the same effect.) 1. Disable subsections-via-symbols for modules compiled with the LLVM backend. angerman found that llc unconditionally enables subsections-via- symbols on Darwin with a "funny hack" (https://github.com/llvm- mirror/llvm/blob/f61ad6ec119554f251f44f54c9cf42d8b713866e/lib/Target/X86/X86AsmPrinter.cpp#L607-L612). But we could remove the directive in the LLVM mangler. This would be a sound thing to do, but we'd have no way to do dead code stripping when using LLVM; and on iOS LLVM is the only available option. 2. Insert symbols that point to the start of info tables and give them some kind of externally-visible linkage or mark them as `.no_dead_strip`. I don't think the LLVM input language gives us any way to do this, but we could probably do it in the mangler. This would give us some degree of dead code stripping, but it would keep ''all'' info tables live, even those that were attached to functions that got stripped. As far as I can see that's not a problem except in that the eventual object file will not be as small as it could be. I think this was the strategy used by https://phabricator.haskell.org/D206, but with the adoption of prefix data it's not so easy to implement any more. 3. Insert symbols that point to the start of info tables, and also insert a reference at the end of each function to the start of its info table. Again we could probably do this in the mangler, though it would be more complicated. Ideally we would have some kind of "suffix data" mechanism for this... This would give the best dead code stripping (at the cost of slightly larger code in the non-stripped case) and it's the strategy used by the NCG. (See where `X86.Ppr.pprNatCmmDecl` uses `platformHasSubsectionsViaSymbols`.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13378#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler