-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 David Daney wrote: > Joe Buck wrote: > >> On Thu, May 04, 2006 at 04:31:15PM +0300, Nikolaos Kavvadias >> wrote: >> >>> My question here is: culdn't "-Os" optimization option force >>> .align 0 alignment? Is there any way to use the minimal data >>> memory requirements for global symbols possible? >> >> >> >> While it could, I hope that it does not go so far as to make the >> reads unaligned (on processors that allow this). -Os currently >> optimizes well for speed as well as for space, and there's a >> substantial performance penalty for unaligned reads and writes in >> many cases. >> > > IIRC, On mips they are trapped and emulated in the Linux/(your OS > here) kernel. That means that literally hundreds of instructions > are executed for each unaligned access. > > On systems where they are not emulated, you would get a hard > failure. > > David Daney.
That's reasonable. And the trap handling routines, being called really often in such case, incur a very high performance cost. In a hypothetical case of a processor, there could be provision for adjusting the unaligned (byte-wise) addresses to the intended alignment in hardware But that's probably unecessary complexity. Nikolaos Kavvadias -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFEWixQMPiy0tCWlz4RApLtAKCQQzW9Sr/b8DuddBuBaNatK4jAfgCgiTl7 LNInrCdFNfMw1cODsgQvuUg= =7O4q -----END PGP SIGNATURE-----