who loads argc in elf binary???????

Daniel Jacobowitz dmj+ at andrew.cmu.edu
Thu Mar 8 06:10:14 EST 2001

On Tue, Mar 06, 2001 at 11:03:15AM -0500, Alexandre Nikolaev wrote:
> Hi!
> We are trying montavista kernel .4 on G4. Upon starting of ELF binary,
> the r3, which should contain argc, always reads 0 (for any program). r4
> is ok.
> What could be the problem?
> Who is responsible for loading r3?
> I would really appreciate if someone can help!

argc and argv are created by the kernel, based on what is given in
exec().  It has to go through the dynamic loader and any start code
before it gets to main, though.  Are you using any custom crt* code, or
otherwise linking oddly?  If so, look there.

I also seem to recall that the arguments are loaded into registers by
the application, off the stack.  I'm not entirely sure of that, though.

Daniel Jacobowitz                           Debian GNU/Linux Developer
Monta Vista Software                              Debian Security Team
                         "I am croutons!"

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

More information about the Linuxppc-dev mailing list