LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-19-2006, 03:10 AM   #1
vkmgeek
Member
 
Registered: Feb 2006
Location: Ahmedabad
Distribution: rhel5
Posts: 185
Blog Entries: 2

Rep: Reputation: 31
what does system does before start executing main()


.o file of .c file having single function say main, contains so many functions like _init, _start , _fini etc..

what r they 4?

what exactly system does b4 executing first instruction of main..

I had started executing instructions from _init , before reaching to first instruction of main.., it had set pc to 0x00.
why it had done so ??

generally 0x00 is for reset, so it will now reset the system
so how program is reaching to main then ??
 
Old 06-19-2006, 06:36 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Please try using plain english in your postings.

Before calling main, the system is preparing the environment for the program to work properly. This is usually done by something called crt0 (for C run time).

Concerning the pc address, don't confuse virtual adresses the application is living in, and physical adresses with which adress 0 may or may not trigger a system reset.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Executing a program on start up andrewthk Debian 3 03-23-2006 12:49 AM
PHP executing System command abdul_zu Linux - General 4 12-28-2005 02:14 PM
Windows Start Key to open Gnome Main Menu shashir Linux - Software 2 12-18-2005 04:29 AM
adding to main menu.. like start on windows khuti2005 Linux - Newbie 3 10-10-2005 06:53 PM
Executing a program with out system() in c++ sobdk Programming 2 11-02-2002 07:45 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration