This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: More on entry point option for ld
- To: Fergus Henderson <fjh at cs dot mu dot oz dot au>
- Subject: Re: More on entry point option for ld
- From: Carlo Wood <carlo at alinoe dot com>
- Date: Fri, 29 Jun 2001 18:28:05 +0200
- Cc: Jeff Parker <JEFFREY dot H dot PARKER at saic dot com>, gcc at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- References: <3B3C9591.A221F6BF@mtg.saic.com> <20010630012651.B10591@hg.cs.mu.oz.au>
On Sat, Jun 30, 2001 at 01:26:51AM +1000, Fergus Henderson wrote:
> > I've tried using the '-e <entry point>' option for 'ld'
>
> That won't work, since the entry point is a procedure in the C runtime
> start-up code (often named `_start'), not `main'. The procedure _start
> initializes the C runtime, sets up the values of argc and argv, and then
> calls main().
>
> Rather than using `-e', you should use `--wrap main'.
> See the documentation for `--wrap' in the GNU ld manual.
And what if you want to do initialization of a shared library
*after* initialization of libc and libstdc++ but *before*
any constructor of global objects of other libraries (or the
main program) are called?
What I need is:
0) zero-ing all static variables (including of shared libs)
1) initialization of the malloc library
2) calling my initialization routine
3) initialization of libstdc++ (cout, cerr etc, global objects if any)
4) initialization of everything else (constructors of global objects etc)
My initialization routine must be called prior to ANY call to malloc().
I already reported a problem with the intialization of cout, cerr etc
(ios::Init), I wonder what happened to this PR? I claimed that it is
not conforming the standard, but I can't remember anyone replying.
See http://gcc.gnu.org/ml/libstdc++/2001-05/msg00189.html
and a correction in http://gcc.gnu.org/ml/libstdc++/2001-05/msg00190.html
I'd really like it when someone would reply to that :).
--
Carlo Wood <carlo@alinoe.com>