can data be aligned in the .data? section?
It surely can. As long as you set the processor model at the start of the file to .486 or higher, you can align data by up to 16 bytes. On DWORD size data you normally require alignment by 4 bytes.
align 2 ; old WORD alignment
align 4 ; normal DWORD alignment
align 8
align 16
With SSE/2 and other specialised circumstances where you need alignment by 32 bytes you allocate memory and write the data to an aligned location in the memory buffer.
You normally place the "align" directive before the item that needs to be aligned in the .DATA section like as follows.
.data?
align 4
myitem dd ?
Thanks for the reply! I wonder though, how is data in the .data? section allocated? In my project I have to allocate about 600kb, and when I had it in the .data section, not only did the assembling take forever but my application size increased by about 600 kb :eek.
The .data? section is uninitialized data, it does not add to the size of your executable. The .data section however does add to the size of the executable. Generally you can rely on uninitialized data being filled with 0 so if you are just creating empty data put it in the .data? section as there is no need to initialize it to zero.