_start and main labels in C programs

Andi Hellmund mail@andihellmund.com
Sat Dec 25 16:29:00 GMT 2010


On 12/25/2010 12:48 PM, ali hagigat wrote:
> When i compile a C program two labels are seen at the final object
> code main and _start.
> Which one is executed first?
>
>    
In default compilation/linking mode, this is _start.

You could also easily verify this by using nm(1) and readelf(1):

andi@randazzo:/development/sandbox$ readelf -h test.exe
[...]
   Entry point address:               0x80482e0
[...]

andi@randazzo:/development/sandbox$ nm test.exe | grep _start
[...]
080482e0 T _start
[...]


Andi



More information about the Gcc-help mailing list