This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]