Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!harvard!think!mit-eddie!martillo From: martillo@ATHENA.MIT.EDU Newsgroups: net.emacs Subject: About crt0 (a question) Message-ID: <1869@mit-eddie.MIT.EDU> Date: Mon, 5-May-86 20:00:54 EDT Article-I.D.: mit-eddi.1869 Posted: Mon May 5 20:00:54 1986 Date-Received: Thu, 8-May-86 07:18:48 EDT Sender: uucp@mit-eddie.MIT.EDU Organization: M.I.T. EE/CS Computer Facility, Cambridge MA Lines: 23 From: Yakim Martillo crt0.c or crt0.s contains the true entry point for execution of a C program. When a program is loaded into memory, the pc is set at fixed location. The first executable statement of the crt0.o is loaded into that location. Exactly what that instruction and the instruction which follows are depends on the nature of the machine, but the executable code must among other things set up the global variable environ and the last thing which the executable code in crt0.o must do is set up the stack and call main so that main appears to have been invoked with 3 arguments, argc, argv, and envp. Many machines really do not need to have their own rewritten crt0.c or crt0.s but a few treat environ as initialized data rather than unitialized bss. Since temacs dumps itself and users run xemacs, the executable code must be sure to set up the environ variable properly for dumped version of emacs as well as the temacs version. The environment from temacs must not be the environment when temacs is run. Also, data locations less than &pure[PURESIZE] are moved into the text segment in some dumped versions of xemacs. You would not want this to happen to the environ. Therefor on some machines rewriting crt0.o is necessary.