This is the mail archive of the
mailing list for the GCC project.
RE: Huge executable file with gcc version 3.1.1
- From: "D.Venkatasubramanian, Noida" <dvenkat at noida dot hcltech dot com>
- To: Douglas Richardson <douglas dot richardson at gaussvip dot com>, Kazu Hirata <kazu at cs dot umass dot edu>, Richard Earnshaw <rearnsha at arm dot com>
- Cc: gcc at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org
- Date: Tue, 24 Sep 2002 21:00:24 +0530
- Subject: RE: Huge executable file with gcc version 3.1.1
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
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!
From: Douglas Richardson [mailto:firstname.lastname@example.org]
Sent: Tuesday, September 24, 2002 8:49 PM
To: D.Venkatasubramanian, Noida; Douglas Richardson; Kazu Hirata
Cc: email@example.com; firstname.lastname@example.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.
"To be or not to be?" is not the question, but "What do you
want to be?" is.