[Mesa-dev] [PATCH 24/24] automake: ask the linker to do garbagecollection
Marc Dietrich
marvin24 at gmx.de
Fri Mar 28 01:57:15 PDT 2014
Am Freitag, 28. März 2014, 10:35:00 schrieb Lauri Kasanen:
> On Thu, 27 Mar 2014 21:00:39 +0000
>
> 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.
>
> Without -ffunction-sections -fdata-sections in compile flags the garbage
> collection is handicapped - add those by default too, and see much
> greater gains.
>
> I should also add that this is a GNUism, so it should be detected for
> in configure in case people use other compilers/linkers. It's also
> redundant if LTO is used.
>
> In one of my projects I detect as such:
>
> if -flto supported, use it (needs to be added to all three CFLAGS
> CXXFLAGS LDFLAGS)
lto is broken on many compiler/ld combinations. Even if it is supported I
won't recomment to enable it. A config option to enable it would be nice
though.
Lauri, on which compiler/binutils version did you got it going?
Marc
More information about the mesa-dev
mailing list