Q: It seems that declaring a large
static array has the effect
of bloating the program image on disk by that many bytes. Surely there is
a more compact way of telling the loader to set the next N bytes of RAM to
A: This only happens in C++ programs and is a (mis-)feature of GCC.
You can use the
-fconserve-space switch to GCC to prevent this from
happening, but that switch also turns off the diagnostics of duplicate
definitions, which, if uncaught, might cause your program to crash.
Thus, this switch isn't recommended for programs which haven't been
completely debugged (if there is such a creature). The
-fconserve-space switch is described in the GCC docs, see GNU C Compiler Manual.
If the problems with using this switch doesn't deter you, you can even
add this switch to your
lib/specs file to make it permanent.
GCC versions 2.95.1 and later don't have this problem, even in C++ programs.