Search code examples
visual-studioassemblymasm

Why assembly compilation result has big size?


Visual Studio 2015

I compile simple code, but the compilation result (Release) has 4Kb size. Why does it happen? This is complete code source of my project:

ExitProcess PROTO

.data

qword1 qword 12345678ffeeddcch

.code

main proc 
    mov rax, 2c5h
    mov rbx, qword1
    mov rcx, 0
    call ExitProcess
main endp
end

Solution

  • When an executable file is compiled, it includes a lot of information it uses for its execution; only a small section of the data in the executable is the actual code. A good example of this is when an assembly program uses C functions via extern. Here's an article on the subject if you'd like to read more about it: More info on PE Format

    Portable Executable Format