Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
There is some startup module linked into each image. I'm not certain of the details, but roughly:
Some loader code executes first inside the image, loading required .so files and doing some relocations. It transfers control to the startup module (as a jump, not a call).
The startup module does some initialization (a lot of things in C++, I'm not sure how much in C) and pushes the arguments for main and calls main. When main returns, it does a few kinds of cleanup before exiting to the OS.
In many compile/link packages, that startup module is named crtbegin.
AFAIK, C runtime library calls it from real entry point - after it builds argument lists (& etc) using os-specific calls. I'd recommend you to check gcc sources to find out how exactly things work.
AFAIK, C runtime library calls it from real entry point - after it builds argument lists (& etc) using os-specific calls. I'd recommend you to check gcc sources to find out how exactly things work.
It's not in the gcc source, but in the glibc - code for ld-linux.so.
From what I understand the program is the one that calls main in an indirect way. First when the binary is called a jump is made to an entry point but that point is not main() but a runtime library which will first activate a few things stdin/stdout/stderr and then some other things then call main().
Try searching google for c + application + "entry point"
Last edited by jstephens84; 12-12-2008 at 01:48 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.