This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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]

Re: Giant executables.. what am I doing wrong?


Are you sure you want to create a static executable? If you are trying to
save memory, shared executables are probably better. With shared executables
the C library will get loaded into memory once and can be used by multiple
programs at the same time. Static programs will eat up more memory by
loading effectively multiple copies of the C library, one for each program
running.

--josh

----- Original Message -----
From: "Michiel Buddingh'" <ajuin+mail@stack.nl>
To: <gcc-help@gcc.gnu.org>
Sent: Monday, October 14, 2002 7:49 PM
Subject: Giant executables.. what am I doing wrong?


> I'm currently trying to write a program for a linux system with limited
> memory, and as such I'd like gcc to generate small, statically linked
> executables.
>
> However, if I compile even a simple program like:
>
> int main() { write(2,"Hello world.\n", 13); return 0; }
>
> with the --static option, then strip it with "--strip-all" I get a
> program worth 332 kB(!).
>
> Needless to say, this is not exactly what I want.
>
> I have tried both gcc 2.95 and gcc 3.2, but the results differ only by
> a few bytes.
>
> Am I missing something really obvious here?
> --
> -- Michiel
>



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