This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Resources on reducing size of C++ executable
- From: Øyvind Harboe <oyvind dot harboe at zylin dot com>
- To: <newlib at sources dot redhat dot com>
- Date: Wed, 30 Apr 2003 23:46:35 +0200
- Subject: Resources on reducing size of C++ executable
I have been trying to find some resources on how to reduce the
size of newlib C++ executables.
There are a couple of things in the FAQ that I'll
try, but I don't think it will get me all the way there
(e.g. optspace configuration).
I'm making some sort of silly mistake. Just adding #include <iostream>,
without using any of the features piles on 200k to the executable size.
arm-elf-gcc -o hello hello.cpp -lstdc++
#include <iostream>
int main(int argc, char **argv)
{
return 0;
}
"arm-elf-size hello" shows ~250k arm-elf executable.
Using a bit of C++ only adds about 20k or so to the bare-bones
executable...
public Foo
{
public:
Foo()
{
}
};
int main(int argc, char **argv)
{
Foo *foo=new Foo();
delete foo;
return 0;
}
arm-elf-size - shows 40k executable
(I'm not @ work, so I haven't get the exact details here.)
Øyvind Harboe