Re: [PATCH 3/3] build system: section garbage collection for vmlinux

Denys Vlasenko
2007-09-06T10:56:28Z

On Wednesday 05 September 2007 21:46, Sam Ravnborg wrote:
> On Wed, Sep 05, 2007 at 07:40:15PM +0100, Denys Vlasenko wrote:
> > On Wednesday 05 September 2007 14:55, Denys Vlasenko wrote:
> > > Part 3:
> > >
> > > Makefile:
> > > init/Kconfig:
> > > add config DISCARD_UNUSED_SECTIONS with appropriate
> > > big scary warning. It enables gcc and ld options
> > > for section garbage collection.
> >
> > At it typically happens, last-minute "obviously correct" change was a mistake.
> >
> > This doesn't work as intended:
> >
> > LDFLAGS_vmlinux += $(call ld-option, --gc-sections)
> >
> > With the above line, --gc-sections doesn't get added,
> > and vmlinux is not garbage collected.

> Did you find out why it does not work?

ld-option is designed to test whether -Wl,-Wsomething will work
on gcc commandline. I am adding --gc-sections to ld commandline.

> >
> > It must be
> >
> > LDFLAGS_vmlinux += --gc-sections

> Doing a normal kernel build will link vmlinux three or four times.
> If we introduce --gc-sections we should add a preparational link of
> vmlinux where we use --gc-sections and skip it for the rest of the links
> assuming that --gc-sections takes some time for ld to do.

Yes, this will speed up things a bit.

However, for me build time is totally dominated by CC stages, not LD.
I don't have 32 core CPU yet :(
--
vda