On 2007-04-02, [email protected] <[email protected]> wrote:

> Is there a compiler/linker parameter to avoid wasted RAM
> between global variables?  I have a significant number of
> global vars, made up of chars, ints, and a few floats.  When I
> look at the list output file it shows that the global vars are
> placed into RAM in a seeming random order (maybe the result of
> a hashing function).  The trouble is everytime a char is
> followed by an int another byte of RAM is wasted.

Last week I posted a patches for 3.2.3/binutils that fixes that
wastage by fixing support for -fdata-sections and -gc-sections.
One of the effects of that is that static variables are sorted
by size so that a minimal amount of RAM is wasted by alignment
fill.

The --sort-common option is supposed to do the same thing, but
it never worked for me.

-- 
Grant Edwards                   grante             Yow!  It was a JOKE!! Get
                                  at               it?? I was receiving
                               visi.com            messages from DAVID
                                                   LETTERMAN!! YOW!!


Reply via email to