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

GHC ghc-devs at haskell.org
Tue Nov 17 11:04:51 UTC 2015


#8405: experiment with using function-sections for linking (for smaller libs and
executables)
-------------------------------------+-------------------------------------
        Reporter:  carter            |                Owner:  olsner
            Type:  task              |               Status:  closed
        Priority:  normal            |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  7.6.3
      Resolution:  fixed             |             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
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by olsner):

 Replying to [comment:19 carter]:
 > Would this make it practical to disable stripping on libraries and
 executables (so that dwarf metadata could be available by default?)

 I didn't know that was a problem, so if this feature fixes anything it's
 purely a bonus :) I suspect the debug info could get pretty large
 regardless of this patch, so many users might still not want it. (Though
 it might be improved compared to `-split-objs`?)

 Replying to [comment:10 refold]:
 > And it looks like `--gc-sections`
 [https://sourceware.org/git/gitweb.cgi?p=binutils-
 gdb.git;h=0f088b2a9417b1d4ed597849ffa671eba25f5051 is now finally
 supported on Windows] (though the patch still needs testing).

 Since I had my system in Windows today, I decided to test this out - but
 ran into some problems.

 First problem is that linking executables with `SplitSections=YES` gets
 you a "too many sections" error. But when making an executable, those
 sections should be getting merged into just a handful of sections... I
 think this is `ld`'s fault, so I submitted
 https://sourceware.org/bugzilla/show_bug.cgi?id=19254 for it.

 It also seems the `--gc-sections` patch was committed after binutils 2.25
 branched off, so we need to upgrade binutils to use this. (Probably to a
 yet-unreleased version that also has a fix for the sections issue...)

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


More information about the ghc-tickets mailing list