This is the mail archive of the
mailing list for the binutils project.
Accumulation of similar size data items to reduce ROM space.
- From: "Nitin Yewale" <NitinY at KPITCummins dot com>
- To: <binutils at sources dot redhat dot com>
- Date: Wed, 3 Nov 2004 13:57:19 +0530
- Subject: Accumulation of similar size data items to reduce ROM space.
I would like to arrange similar types of initialized data items together to reduce the ROM space. The obvious prerequisite is that the linker should have information regarding the data type of the variables.
After analyzing the sources, I have found that the object files which the linker uses for final linking have information about the sizes of variables but not the data type. It will not be proper if we rearrange variables based on the sizes of the variables as the compiler may have added extra bytes for padding.
char c = 23;
long x = 23213;
char gg = 21;
If you have declaration like above, then the object file contains are as follows.
The object file has the allocation information (i.e. size) of variables and linker will do the final assignment to them. In above case though variable "c" is of char data type and object file shows 4 bytes because compiler has added 3 bytes padding to the same due to alignment.
Even if compiler does the job of accumulating similar size data items but it will be file wise. So it will be better if linker reads all the object files and does the accumulation of similar size data items on the data type basis.
Any help regarding this will be appreciated. Thanks in advance.
KPIT Cummins InfoSystems Ltd.
Free download of GNU based tool-chains for Renesas' SH and H8 Series.
The following site also offers free technical support to its users.
Visit http://www.kpitgnutools.com for details.
Latest versions of KPIT GNU tools were released on October 1, 2004.