[GHC] #8405: experiment with using function-sections for linking (for smaller libs and executables)

GHC ghc-devs at haskell.org
Thu Nov 12 14:54:43 UTC 2015


#8405: experiment with using function-sections for linking (for smaller libs and
executables)
-------------------------------------+-------------------------------------
        Reporter:  carter            |                Owner:  olsner
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  7.6.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D1242
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"4a32bf925b8aba7885d9c745769fe84a10979a53/ghc" 4a32bf9/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="4a32bf925b8aba7885d9c745769fe84a10979a53"
 Implement function-sections for Haskell code, #8405

 This adds a flag -split-sections that does similar things to
 -split-objs, but using sections in single object files instead of
 relying on the Satanic Splitter and other abominations. This is very
 similar to the GCC flags -ffunction-sections and -fdata-sections.

 The --gc-sections linker flag, which allows unused sections to actually
 be removed, is added to all link commands (if the linker supports it) so
 that space savings from having base compiled with sections can be
 realized.

 Supported both in LLVM and the native code-gen, in theory for all
 architectures, but really tested on x86 only.

 In the GHC build, a new SplitSections variable enables -split-sections
 for relevant parts of the build.

 Test Plan: validate with both settings of SplitSections

 Reviewers: dterei, Phyx, austin, simonmar, thomie, bgamari

 Reviewed By: simonmar, thomie, bgamari

 Subscribers: hsyl20, erikd, kgardas, thomie

 Differential Revision: https://phabricator.haskell.org/D1242

 GHC Trac Issues: #8405
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8405#comment:16>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list