From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5038 invoked by alias); 9 Nov 2004 08:45:15 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 4851 invoked from network); 9 Nov 2004 08:44:49 -0000 Received: from unknown (HELO sohm.kpit.com) (203.197.93.236) by sourceware.org with SMTP; 9 Nov 2004 08:44:49 -0000 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: Accumulation of similar size data items to reduce ROM space. Date: Tue, 09 Nov 2004 08:45:00 -0000 Message-ID: <4A1BE23A7B777442B60F4B4916AE0F13035A6A98@sohm.kpit.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: From: "Nitin Yewale" To: "Alan Modra" Cc: X-SW-Source: 2004-11/txt/msg00160.txt.bz2 Hi, Thank you for the informative reply. >No, doing this sort of thing in the compiler is by far the easiest way >to accomplish what you want. Have the compiler emit 1 byte variables >to .data.s1, two byte variables to .data.s2 and so on. Then the linker >can easily combine like sized data items. We have tried to put all similar size variables into one sections by specif= ying attribute for each variable like=20 char ch1a __attribute__ ((section ("charSect"))) =3D { 23 }; With above approach user will have to put each and every variable into the= =20 specific section by specifying the attribute.=20 We would like to put all similar size variables into one section. How can w= e=20 automate this in compiler? Regards, Nitin Yewale, KPIT Cummins InfoSystems Ltd. Pune, India ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Free download of GNU based tool-chains for Renesas' SH and H8 Series. The following site also offers free technical support to its users.=20 Visit http://www.kpitgnutools.com for details.=20 Latest versions of KPIT GNU tools were released on October 1, 2004. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=20 -----Original Message----- From: Alan Modra [mailto:amodra@bigpond.net.au] Sent: Wednesday, November 03, 2004 7:05 PM To: Nitin Yewale Cc: binutils@sources.redhat.com Subject: Re: Accumulation of similar size data items to reduce ROM space. On Wed, Nov 03, 2004 at 01:57:19PM +0530, Nitin Yewale wrote: > 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.=20 No, doing this sort of thing in the compiler is by far the easiest way to accomplish what you want. Have the compiler emit 1 byte variables to .data.s1, two byte variables to .data.s2 and so on. Then the linker can easily combine like sized data items. If you really must do this in the linker alone, then you'll need to a) determine data item boundaries b) rearrange section contents c) adjust all relocs pointing into the rearranged sections. d) adjust all relocs in the rearranged sections. e) adjust all symbols defined in those sections too. (a) is non-trivial. How will you handle aggregates? --=20 Alan Modra IBM OzLabs - Linux Technology Centre