This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Using entry point option (-e) with 'ld' (or gcc)
- To: Jeff Parker <JEFFREY dot H dot PARKER at saic dot com>
- Subject: Re: Using entry point option (-e) with 'ld' (or gcc)
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 30 Jun 2001 02:28:06 -0300
- Cc: gcc at gcc dot gnu dot org
- Organization: GCC Team, Red Hat
- References: <3B3B43D0.BDC1A5ED@mtg.saic.com>
On Jun 28, 2001, Jeff Parker <JEFFREY.H.PARKER@saic.com> wrote:
> I've tried using the '-e <entry point>' option for 'ld' and can get to
> my new function but
> I don't get the expected arguments of 'argc and argv' that I would like
> to pass the 'main'.
`-e' gives a replacement for `_start', not `main()'. You have to know
how the system run-time passes arguments to a program and duplicate
some of the functionality of crt[01in].o and crt{begin,end}.o to call
main.
An easier approach may be to rename main() using objcopy and link in
your own main() that calls the renamed one.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me