# How is data allocated in an assembly language using the instruction set?

Consider the following excerpt of assembly code written for the Nios II embedded processor architecture:

    .section .data
.align 2
va:   .long 0x0
vb:   .long 0x11223344
vc:   .long 0x55667788


The following needs to be done:

• Allocate enough memory for all three variables
• Ensure the memory allocated is contiguous
• Translate instructions that use a variable's name into instructions that use the variable's address

I don't see how this can be done through the instruction set and was hoping for some insight on how the translation of the code above to the instruction set occurs.

• The linker does not do the first two items. Jan 21 '15 at 3:23
• @IgnacioVazquez-Abrams Would that be the assembler's job? Jan 21 '15 at 3:23
• No. It's nobody's job. Assembler directives do not allocate memory, and there is no need for the memory to be contiguous regardless. Jan 21 '15 at 3:25
• @IgnacioVazquez-Abrams What do you mean by "assembler directives do not allocate memory"? I though the entire point of the code above was to allocate memory. Secondly, I was taught that memory is allocated contiguously. Jan 21 '15 at 3:27
• That's not quite accurate. Those directives state that arbitrary bytes are to be placed at the current and following memory locations; the "allocation" happens because more bytes have been added to the assembly, not because those directives are being used. Jan 21 '15 at 3:35