Hi Grant,
Grant Edwards wrote:
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.
Your changes look interesting. However, I'm not clear if you consider
them a work in progress, or if you are happy they have reached the point
where we should consider committing them to CVS. You have been posting
new messages related to these changes fairly frequently. If you think
things have stabilised I will try them out.
Regards,
Steve