What is a simplest way to set align 64
for some assembler function code with ml64.exe
?
Default alignment for _TEXT
is 16, so ml64
doesn't allow to set more than 16 in align
command.
And ml64
doesn't allow to change alignment for _TEXT
.
It's possible to create another section/segment, but can we get 64 byte
alignment in main _TEXT
section?
Is there any solution?
P.S.
Solution suggested in answer with _TEXT$FOO
works!
_TEXT$FOO SEGMENT ALIGN(64)
align 64
_TEXT$FOO ENDS
I also tried to change the value in alignment field in Characteristics
in section header for _TEXT
in obj (coff) file in hex editor. And the linker used that changed alignment. So why ml and jwasm don't allow to change that default 16 bytes for _TEXT
, if linker can use any value from that field in obj file?
64-byte alignment is useful for code in some cases.
If you use 16-bytes alignment, then another code (it can be C
code) can randomly move your asm
code for 4 different offsets: 0, 16, 32, 48.
And some loops probably can cross 64-bytes or 32-bytes range. So you can see some unpredictable changes of performance of asm
code , when you just change another C
code.