This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: _start and main labels in C programs


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]