Question

How does it works exactly? does the last align override the behavior of the previously one making its effect null or does it do something when used together? I found this from a large assembly source code and I'm asking this because I don't think it's just a typo.

align 64
align 4
Was it helpful?

Solution

align inserts NOPs to bring the current section offset to a multiple of the specified value. (You can also explicitly specify a value other than NOP to insert, such as NULL padding). It does also implicitly call SECTALIGN to set the section's alignment attribute.

See NASM manual section 4.12.12.

So it's a typo -- the second align will do nothing since the first one already padded up to 64-byte alignment. And the implicit SECTALIGN also has no effect since the manual specifies the alignment attribute can only be increased, never decreased.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top