Huge executable file with gcc version 3.1.1

D.Venkatasubramanian, Noida dvenkat@noida.hcltech.com
Tue Sep 24 09:36:00 GMT 2002


Hi,

Yep, that was my concern. Such huge executables, almost totally put C++
out of scope for embedded applications, unless, I do not use libraries
(probably, certain libraries).

I could definitely have used C for this test case, but what about cases, 
where we would like to use C++ features and libraries.

A stripped C Hello World, was just 36 KB in comparison to 268 KB. Problem
is, 
with my configuration, h8300-elf and newlib, it only creates statically
linked executables. And my simulator promptly crashed for this Hello World
C++ Program :-(

Thanks for the help!

Regards,

Venky

-----Original Message-----
From: Douglas Richardson [mailto:douglas.richardson@gaussvip.com]
Sent: Tuesday, September 24, 2002 8:49 PM
To: D.Venkatasubramanian, Noida; Douglas Richardson; Kazu Hirata
Cc: gcc@gcc.gnu.org; gcc-bugs@gcc.gnu.org
Subject: RE: Huge executable file with gcc version 3.1.1


You're right, it does seem large.

I have gcc configured on a Sun sparc to statically link and I tried out your
test program. After I stripped a.out it was still about 190k. A "Hello,
World" C program was only about 3k after I stripped it.

I also tried compiling the C++ program with different optimizations (-Os,
-O2, -O) but they did not effect the size of a.out.

I then compiled a C++ "Hello, World" program including stdio.h instead of
iostream and using printf instead of cout and the program was about the same
size as the C "Hello, World" program.

I then stripped libstdc++.a and tried to compile your "Hello, World"
program. I got undefined references to some initialization routines (like
std::ios_base::Init::Init()). The Standard Template Library is bringing in a
lot of extra code. That must be why your file is so large.

Even with that explanation, your a.out still seems very large.

Douglas Richardson.




_____________________________________________________

"To be or not to be?" is not the question, but "What do you
want to be?" is.  
   --- Anon



More information about the Gcc-bugs mailing list