first stab at -ffunction-sections

Simon Marlow
Mon, 18 Nov 2002 16:57:50 -0000

> On Mon, Nov 18, 2002 at 11:55:27AM -0000, Simon Marlow wrote:
> > What exactly are you trying to use -ffunction-sections for?=20
>  I'm pretty
> > sure it won't work as things stand currently, unless you=20
> can guarantee
> > to be able to find a text/data boundary symbol for the=20
> garbage collector
> > (currently it has to be able to distinguish text from data,=20
> we're in the
> > process of lifting the restriction but it's a lot of work).
> Trying to garbage-collect unused functions to reduce the size of the
> .text section.

You should be aware that -split-objs (the trick we use to build our
libraries in lots of little bits) gets most of the benefit that you'd
get from using -ffunction-sections.  You might get slightly more
fine-grained discarding of code with -ffunction-sections, but the effect
won't be dramatic (I'm guessing).  Also there's the issues of telling
the garbage collector and the mangler about it.

However, it would be nice to be able to use
-ffunction-sections/--gc-sections instead of -split-objs.  It's been at
the back of my mind to have a go at this someday...