NASM pads section to 512 bytes

51 views Asked by At

NASM compiler stubbornly pads my data section with 0s making it 512 bytes in size. I can't figure out what happens. As per the documentation the default section alignments are much smaller. Here's en excerpt from the .map file

Vstart            Start             Stop              Length    Class     Name
               0                 0               200  00000200  progbits  .text
               0               200               250  00000050  progbits  data
               0               400               600  00000200  progbits  code

Here are lines from my .asm which I believe may be of concern

...  ; some code
ALIGN 512

[SECTION data VSTART=0]
BITS 32
...  ; some data
ALIGN 16

[SECTION code VSTART=0]
...  ; some code
ALIGN 512

And here's the command line I use to compile it c:\nasm\nasm.exe -f bin secondary.asm -o secondary.bin

With this setup I expect the code section to start at 250 but it starts at 400. Could someone tell me what is wrong with my code?

0

There are 0 answers