Re: [PATCH v2 0/4] Add support for compiling with -ffunction-sections -fdata-sections

From: Denys Vlasenko
Date: Mon Apr 20 2009 - 21:04:32 EST


On Tuesday 21 April 2009 01:40, Linus Torvalds wrote:
> Quite frankly, every time I see something like this, I shudder.
>
> Why?
>
> The bugs in the toolchains tend to be infinite and _really_ annoying.

Most bugs are annoying. :)

> We'll end up with everything from "gcc-xyz cannot handle it" to
> "binutils-abc which was pre-released by RH/Ubuntu/SUSE will SIGSEGV".
>
> And those are the _good_ cases. The bad cases are just silently
> miscompiled/linked stuff under certain circumstances.
>
> In other words, I'm not going to merge it without a _lot_ of people
> pushing me on it with nice numbers etc. Because I absolutely hate the
> tools issues that I'm convinced will happen the moment I merge it.

In some cases, section garbage collection discards nearly 10% of dead
code/data from kernel image. Actually, every time I add it to
a software project, I see quite an amount of dead code/data
eliminated. Even sadistic manual splitting of every function
and data object into its own .o file doesn't match it.

I can put it another way: let machine do what it does better,
and faster, than humans ever can:

I was pushing a patch for aic7xxx driver which eliminated ~150k
of dead code. It took a lot of time to eventually make it reach
mainline kernel. On and off, it took years.

With section garbage collection, that patch would not be even needed,
as gcc+ld would automagically detect that that code is dead.
--
vda
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/