[klibc] myths about upwards growing stacks

Matthew Wilcox willy@debian.org
Tue, 14 Jan 2003 23:13:22 +0000


just downloaded klibc 0.72 and took a look.  first thing i found was that
the URL for latest version is out of date:

klibc is archived at:

        ftp://ftp.zytor.com/pub/linux/libs/klibc/

the `libs/' is superfluous.

more importantly, this piece of code in klibc/arch/README is wrong:

#if STACK_GROWS_UP
  argc = (int)*argptr--;
  argv = (char **)argptr;
  envp = argv-(argc+1);
#else
  argc = (int)*argptr++;
  argv = (char **)argptr;
  envp = argv+(argc+1);
#endif

i'm not sure why people think that having an upwards-growing stack
means that argc, argv & envp all change places, but they don't.  see
include/asm-parisc/processor.h for complete details of the stack layout.

-- 
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk