This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Using entry point option (-e) with 'ld' (or gcc)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]