Why is this trivial program so large when compiled?

Viewed 724

I created a file containing the following line:

int main() { return 0; }

After compiling this, I was surprised to find out that the binary for this simple program is 8328 bytes! What is going on here, and what in the world is the binary doing in those 8328 bytes? Surely this program can be expressed in just a few lines of assembly.

Note: I compiled this with the following line:

g++ main.cpp

My g++ version is g++ (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1

3 Answers
Related