Mail Archives: djgpp-workers/1999/07/06/08:47:59
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 -