This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: empty function optimizations
- To: <gcc at gcc dot gnu dot org>
- Subject: Re: empty function optimizations
- From: "Ken Clark" <ken at gesn dot com>
- Date: Tue, 11 Jul 2000 11:57:28 -0700
On Mon, 10 Jul 2000, Philipp Rumpf wrote:
> On Sat, Jul 08, 2000 at 09:50:38PM +0200, Geert Uytterhoeven wrote:
> > My idea was to replace empty and most simple functions by predefined
dummy(),
> > dummy_zeros(), dummy_ones() and dummy_einval() functions, so they appear
only
> > once in a kernel image. But is it worth the effort? Note that you don't
compile
> > all code into your favorite kernel image, only the parts you need for
your
> > hardware, so you won't catch all empty functions at once.
>
> This really should be a gcc/ld thing. If/when we moved
to -ffunction-sections,
> all that would be required is a "merge identical read-only ELF sections"
> option to ld (or a standalone hack to do the same thing).
This came up on the Linux kernel list yesterday, but I have been thinking
about this for a long time. In our C++ project, we use container templates
fairly heavily. The problem is that often the templates generate function
code that is independent of the class, or maybe only dependent on the class
sizeof. With hundreds of classes it really adds up.
Would collecting all the identical code at link time be as easy as it
sounds, or are there complications?
Ken