delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/07/06/08:47:59

Sender: root AT delorie DOT com
Message-ID: <3781FE13.8DF83801@inti.gov.ar>
Date: Tue, 06 Jul 1999 10:01:07 -0300
From: salvador <salvador AT inti DOT gov DOT ar>
Organization: INTI
X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.0.36 i686)
X-Accept-Language: es-AR, en, es
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
CC: DJ Delorie <dj AT delorie DOT com>
Subject: Re: .align directives in libc.a
References: <Pine DOT SUN DOT 3 DOT 91 DOT 990704154522 DOT 13333K-100000 AT is>
Reply-To: djgpp-workers AT delorie DOT com

Eli Zaretskii wrote:

> Aligning sections to higher powers of 2 seems to be a good idea
> because COFF cannot record the desired alignment on the symbol level;
> every .align directive is relative to the section.  So, if we want
> programs to access, say, long double variables and large data
> structures efficiently, the .data section and the stack need to be
> aligned on at least 16-byte boundary, or else no amount of .align
> directives in the code will guarantee the proper alignment of such
> variables.

I added a special section to my link configuration file (djgpp.djl?). This
section is very well aligned and I put special functions there.
What about including it in 2.03 so we can experiment? It won't break anything
because the section have a special name and nobody knows about it (I didn't
touched the other sections).

> The Intel manuals seem to indicate that optimal alignment of code is
> also 16 bytes, at least for the targets of call/jmp instructions under
> some circumstances.  Again, unless the code section is 16-byte
> aligned, no clever use of .align by the code will ever be able to
> achieve that.

Sections should be aligned to 32 bytes at least.

> So perhaps we need to make the alignment of data, code and stack
> sections be 16 bytes?
>
> And while at that: why does gcc.opt use "-malign-loops=2
> -malign-jumps=2 -malign-functions=2" whereas even on 486 the default
> is 4?
>
> Btw, does the assembler align the data properly?  For example, does it
> automatically align a 4-byte int on a 4-byte boundary?  If not, why
> don't we ever use .align in the .data sections of the assembly sources?

I think the assembler doesn't align anything, but gcc does, so if your variables
are of sizes multiple of 4 (no shorts or chars floating around) you don't need
special aligment. Just after a short value (like gcc does).

SET

--
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Visit my home page: http://welcome.to/SetSoft or
http://www.geocities.com/SiliconValley/Vista/6552/
Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org
                    set AT ieee DOT org set-soft AT bigfoot DOT com
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA Phone: +(5411) 4759 0013



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019