[Mesa-dev] [PATCH 24/24] automake: ask the linker to do garbage collection

Lauri Kasanen cand at gmx.com
Fri Mar 28 09:44:03 PDT 2014


On Fri, 28 Mar 2014 10:08:53 +0000
Emil Velikov <emil.l.velikov at gmail.com> wrote:

> On 28/03/14 08:35, Lauri Kasanen wrote:
> > Emil Velikov <emil.l.velikov at gmail.com> wrote:
> > 
> >> By doing GC the linker removes all the symbols that are not referenced
> >> and/or used by the final library. This results in a saving of ~100K
> >> up-to ~600K per (stripped) binary (classic vs gallium drivers).
> >>
> >> If interested one can ask the compiler to print the sections that are
> >> removed using -Wl,--print-gc-sections.
> > 
> > I didn't see where you add the corresponding flags to CFLAGS/CXXFLAGS.
> > 
> What do you have in mind with "the corresponding flags" ?

The next paragraph, ie ffunction-sections and fdata-sections.

> > Without -ffunction-sections -fdata-sections in compile flags the garbage
> > collection is handicapped - add those by default too, and see much
> > greater gains.
> > 
> "Handicapped" or not it produces very nice results at this point. AFAICS both
> options that you've mentioned have some interesting side effects, from which I
> would rather opt out at this stage. Speaking of "much greather gains" do you
> have any numbers in mind (wrt mesa) ?

No numbers for mesa, sorry. Without those switches the garbage
collection is effectively file-level, not symbol/function-level.

- Lauri


More information about the mesa-dev mailing list