Skip to contentSkip to conversation

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

DISCUSSION Alexandre Nikolaev 2 participants 2 messages Mar 6, 2001 – Mar 7, 2001

lore
Share & tools
lore
#0 lore raw

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!

Alex.

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

#1 lore raw
Quoted 10 lines · Alexandre Nikolaev

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/