[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Directive .p2align Not As Documented
From: |
Chris Penev |
Subject: |
Directive .p2align Not As Documented |
Date: |
Sat, 20 Jul 2013 13:33:00 -0700 |
If I assemble the following assembly
.text
the .text section begins right after the elf header at 0x34 (as expected). However,
.text
.p2align 4,,1
makes the .text section begin at 0x40, ignoring the third _expression_, which is documented as
If doing the alignment would require skipping more bytes than the specified maximum, then the alignment is not done at all
Additionally, the assembly
.text
.p2align 4,0x90,1
ignores the fill value, as if it were left empty (adding zero padding bytes). Lastly,
.text
xor %eax, %eax
.p2align 4,0x90,15
Once again ignores the fill value, as if it was left unspecified, padding the alignment with lea instructions. The lea instructions take less time to decode, however, the fill value field is documented as
The second _expression_ (also absolute) gives the fill value to be stored in the padding bytes.
Clearly, the lea instructions are not the specified fill value.
Sincerely,
Chris P
- Directive .p2align Not As Documented,
Chris Penev <=