Author Topic: Codealignment  (Read 9041 times)

Offline tev

  • New Member
  • Posts: 1
Codealignment
« on: January 23, 2011, 07:19:38 PM »
Hello everybody,
I want to align my code, which I write with nasm.
But the problem is, when I  use "align 4" then is just the instruction 4-byte aligned, but not the following code.

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Codealignment
« Reply #1 on: January 23, 2011, 10:10:03 PM »
Hi Tev,

First, I should mention this apparent bug, which still exists, AFAIK:

http://forum.nasm.us/index.php?topic=930.0

I don't know if this will affect you or not. Is the assembled size what you would expect? You may need to revert to an earlier version (I think I concluded that 2.07 was "safe").

In any case, "align" would affect only the instruction (or data) immediately following the "align". If you want following code (or data) to also be aligned, you'd need to use another "align". (in view of the "bug", this might not be a good idea! :) )

Can you give us an example of what you're trying to do, and what it's not doing? Mention your OS, maybe Nasm version, and what output format you're using, if you would. (we're likely to need that, when anybody is asking for any kind of help!)

Best,
Frank