public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Steve Dondley" <stevedondley@attbi.com>
To: "Michiel Buddingh'" <ajuin+mail@stack.nl>, <gcc-help@gcc.gnu.org>
Subject: RE: Giant executables.. what am I doing wrong?
Date: Tue, 15 Oct 2002 03:53:00 -0000	[thread overview]
Message-ID: <FAECKOGIHAIBBPKBOKGNGEEFDOAA.stevedondley@attbi.com> (raw)
In-Reply-To: <20021014234939.GA35014@stack.nl>

> 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.

As someone new to C, I'm a little confused by the above.  According to GNU C
tutorial I'm reading, using static libraries INCREASES the amount of memory
used.  A direct quote: "An executable created with a shared library can
therefore be far smaller than one created with a static library."  Of
course, once the shared libraries are loaded into memory, the entire program
will take up just as much memory as a statically compiled executable (I
assume).  My understanding is that the real memory savings come when a
second program is started that uses some of the same libraries as the first
program and now they can share the code.  So instead of the same code
occupying two locations in memory, it only occupies one location.  This
saves memory.

I'm not saying you are wrong for wanting to use a static library, I just
don't understand why and I'm trying to learn.

> with the --static option, then strip it with "--strip-all" I get a
> program worth 332 kB(!).

This confuses me as well.  I can't find any documentation about
the --strip-all option in the GCC manual.  (Maybe because I'm new to
Linux/gcc?  I did 'info gcc' and then did a search for '--strip' and 'strip'
but could not find any reference to this option.)  I also did a google
search but that turned up nothing.  How/where can I find out what this does?

Thanks.


  parent reply	other threads:[~2002-10-15 10:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-14 16:49 Michiel Buddingh'
2002-10-14 17:08 ` Joshua Nye
2002-10-14 17:21   ` Michiel Buddingh'
2002-10-14 17:35     ` Joshua Nye
2002-10-14 18:50       ` Michiel Buddingh'
2002-10-15  2:38         ` Claudio Bley
2002-10-15  5:15           ` Michiel Buddingh'
2002-10-15  5:12         ` Joshua Nye
2002-10-15  5:19           ` Joshua Nye
2002-10-15  5:20           ` Michiel Buddingh'
2002-10-15  3:53 ` Steve Dondley [this message]
2002-10-15  4:15   ` Claudio Bley
2002-10-15  5:09   ` Michiel Buddingh'
2002-10-14 19:00 Dockeen
2002-10-15  5:31 Ruppert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FAECKOGIHAIBBPKBOKGNGEEFDOAA.stevedondley@attbi.com \
    --to=stevedondley@attbi.com \
    --cc=ajuin+mail@stack.nl \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).